[
  {
    "path": ".dir-locals.el",
    "content": ";; Project specific Emacs settings\n((nil . ((c-basic-offset . 4)\n         (indent-tabs-mode . nil)\n         (c-file-style . \"ellemtel\")\n         (c-file-offsets . ((innamespace . 0)))\n         (show-trailing-whitespace . t))))\n"
  },
  {
    "path": ".gitattributes",
    "content": "CHANGELOG.md merge=union\n*.mm linguist-language=Objective-C\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug.yml",
    "content": "name: Bug Report\ndescription: Report a bug\nlabels: [T-Bug]\nbody:\n  - type: markdown\n    attributes:\n      value: |\n        Please provide as much detail as you can so we have a better chance of fixing the bug quickly.\n        Thanks for your contribution to improve this project!\n  - type: dropdown\n    id: frequency\n    attributes:\n      label: How frequently does the bug occur?\n      options:\n        - -- select --\n        - Once\n        - Sometimes\n        - Always\n    validations:\n      required: true\n# Description\n  - type: textarea\n    id: description\n    attributes:\n      label: Description\n      description: |\n        Describe what you were expecting and what actually happened.\n    validations:\n      required: true\n  - type: textarea\n    id: stacktrace\n    attributes:\n      label: Stacktrace & log output\n      description: Please paste any relevant log output or stacktrace if you're getting an exception/crash.\n      render: shell\n# Repro information\n  - type: dropdown\n    id: repro\n    attributes:\n      label: Can you reproduce the bug?\n      options:\n        - -- select --\n        - Always\n        - Sometimes\n        - 'No'\n    validations:\n      required: true\n  - type: textarea\n    id: code-snippets\n    attributes:\n      label: Reproduction Steps\n      description: |\n        If you can reproduce the bug, please provide detailed steps for how WE can reproduce it.\n        Ideally, please provide a self contained test case or link (e.g. github repo) to a sample app that demonstrates the bug.\n        If that's not possible, please show code samples that highlight or reproduce the issue.\n        If relevant, include your model definitions.\n        Should you need to share code confidentially, you can send a link to: realm-help (the @) mongodb.com.\n# Version\n  - type: input\n    id: version\n    attributes:\n      label: Version\n      description: What version(s) of the SDK has the bug been observed in?\n    validations:\n      required: true\n  - type: dropdown\n    id: services\n    attributes:\n      label: What Atlas Services are you using?\n      options:\n        - -- select --\n        - Local Database only\n        - Atlas Device Sync\n        - 'Atlas App Services: Functions or GraphQL or DataAPI etc'\n        - Both Atlas Device Sync and Atlas App Services\n    validations:\n      required: true\n  - type: dropdown\n    id: encryption\n    attributes:\n      label: Are you using encryption?\n      options:\n        - -- select --\n        - 'Yes'\n        - 'No'\n    validations:\n      required: true\n# Environment\n  - type: input\n    id: platform\n    attributes:\n      label: Platform OS and version(s)\n      description: OS and version(s) are you seeing the issue on?\n    validations:\n      required: true\n  - type: textarea\n    id: cocoa-build-environment\n    attributes:\n      label: \"Build environment\"\n      description: |\n        Build environment versions\n        In the [CONTRIBUTING guidelines](https://github.com/realm/realm-cocoa/blob/master/CONTRIBUTING.md#speeding-things-up-runner), you will find a script, which will help determining some of these versions.\n # ? Is the script still correct and useful? It seems to output more than needed?\n      value: |\n        Xcode version: ...\n        Dependency manager and version: ...\n    validations:\n      required: false\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "content": "blank_issues_enabled: true\ncontact_links:\n  - name: General Questions and Inquiries\n    url: https://www.mongodb.com/community/forums/tags/c/realm-sdks/58/swift\n    about: Please ask general design/architecture questions in the community forums.\n  - name: MongoDB Device Sync Production Issues\n    url: https://support.mongodb.com/\n    about: Please report urgent production issues to the support portal directly.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature.yml",
    "content": "# NOTE: This is a common file that is overwritten by realm/ci-actions sync service\n# and should only be modified in that repository.\n\nname: Feature Request\ndescription: Request a new feature or enhancement\nlabels: [T-Enhancement]\nbody:\n  - type: markdown\n    attributes:\n      value: |\n        Thanks for taking the time to suggest improvements to Realm!\n  - type: textarea\n    id: problem\n    attributes:\n      label: Problem\n      description: A clear and concise description of the problem you are trying to solve.\n    validations:\n      required: true\n  - type: textarea\n    id: solution\n    attributes:\n      label: Solution\n      description: Describe the solution you envision, including API and usage example if possible.\n    validations:\n      required: false\n  - type: textarea\n    id: alternative-solution\n    attributes:\n      label: Alternatives\n      description: Describe the alternative solutions or features you have considered\n    validations:\n      required: false\n  - type: dropdown\n    id: importance\n    attributes:\n      label: How important is this improvement for you?\n      options:\n        - -- select --\n        - Dealbreaker\n        - Would be a major improvement\n        - I would like to have it but have a workaround\n        - Fairly niche but nice to have anyway\n    validations:\n      required: true\n  - type: dropdown\n    id: sync\n    attributes:\n      label: Feature would mainly be used with\n      options:\n        - -- select --\n        - Local Database only\n        - Atlas Device Sync\n        - 'Atlas App Services: Auth or Functions etc'\n    validations:\n      required: true\n"
  },
  {
    "path": ".github/workflows/build-binaries.yml",
    "content": "name: Build Core binaries\non:\n  workflow_dispatch:\n    inputs:\n      core-version:\n        type: string\n        required: false\n        default: ''\n        description: Core version to use to generate the binaries. It should either be a tag or the version returned by (git describe). If not provided, the version in dependencies.list will be used.\n\njobs:\n  build-packages:\n    runs-on: macos-26\n    name: Build Core ${{ inputs.core-version }} for ${{ matrix.target }}\n    outputs:\n      core-version: ${{ steps.get-core-version.outputs.version }}\n    strategy:\n      fail-fast: false\n      matrix:\n        target: [macosx, iphoneos, iphonesimulator, appletvos, appletvsimulator, watchos, watchsimulator, maccatalyst, xros, xrsimulator]\n    env:\n      DEVELOPER_DIR: /Applications/Xcode_26.1.1.app/Contents/Developer\n    steps:\n      - uses: actions/checkout@v4\n      - name: Download additional platforms\n        run: xcodebuild -downloadAllPlatforms\n\n      - name: Get Core Version\n        id: get-core-version\n        run: |\n          REALM_CORE_VERSION=${{ inputs.core-version }}\n          if [[ -z $REALM_CORE_VERSION ]]; then\n            REALM_CORE_VERSION=$(sed -n 's/^REALM_CORE_VERSION=\\(.*\\)$/\\1/p' dependencies.list)\n          fi\n          echo \"version=$REALM_CORE_VERSION\" >> \"$GITHUB_OUTPUT\"\n\n      - name: Clone Core\n        uses: actions/checkout@v4\n        with:\n          repository: realm/realm-core\n          path: core\n          submodules: recursive\n          fetch-depth: 0\n          fetch-tags: true\n\n      # CMake 3.30 introduced a check which tries to validate that the compiler\n      # supports the requested architextures but it doesn't work.\n      - name: Patch CMake\n        run: sed -i '' 's/CMAKE_HOST_APPLE AND CMAKE_SYSTEM_NAME STREQUAL \"Darwin\"/CMAKE_HOST_APPLE AND CMAKE_SYSTEM_NAME STREQUAL \"Darwin\" AND NOT CMAKE_GENERATOR STREQUAL \"Xcode\"/' /opt/homebrew/Cellar/cmake/*/share/cmake/Modules/CMakeDetermineCompilerABI.cmake \n\n      - name: Checkout Core@${{ steps.get-core-version.outputs.version }}\n        run: git checkout ${{ steps.get-core-version.outputs.version }} --recurse-submodules -f\n        working-directory: core\n\n      - name: Build for ${{ matrix.target }}\n        run: sh tools/${{ matrix.target != 'macosx' && format('build-apple-device.sh -p {0} -c Release', matrix.target) || 'build-cocoa.sh -bm' }} -v ${{ steps.get-core-version.outputs.version }}\n        working-directory: core\n\n      - name: Archive binaries\n        uses: actions/upload-artifact@v4\n        with:\n          name: binaries-${{ matrix.target }}\n          path: core/realm-Release-*.tar.gz\n\n  combine-xcframework:\n    runs-on: macos-14\n    name: Publish xcframework for Core ${{ inputs.core-version }}\n    environment:\n      name: Prebuilds\n      url: ${{ steps.upload-to-s3.outputs.url }}\n    needs:\n      - build-packages\n    steps:\n      - uses: actions/checkout@v4\n\n      - name: Clone Core\n        uses: actions/checkout@v4\n        with:\n          repository: realm/realm-core\n          path: core\n          fetch-depth: 0\n          fetch-tags: true\n\n      - name: Checkout Core@${{ needs.build-packages.outputs.core-version }}\n        run: git checkout ${{ needs.build-packages.outputs.core-version }}\n        working-directory: core\n\n      - name: Download binaries\n        uses: actions/download-artifact@v4\n        with:\n          path: core\n\n      - name: Combine xcframework\n        run: |\n          mv binaries-*/* ./\n          sh tools/build-cocoa.sh -v ${{ needs.build-packages.outputs.core-version }}\n          mkdir ../release\n          mv realm-monorepo-xcframework-${{ needs.build-packages.outputs.core-version }}.tar.xz ../release/\n        working-directory: core\n\n      - name: Archive xcframework\n        uses: actions/upload-artifact@v4\n        with:\n          name: Realm-${{ needs.build-packages.outputs.core-version }}.xcframework.tar.xz\n          path: release\n\n      - name: Configure AWS Credentials\n        uses: aws-actions/configure-aws-credentials@v1\n        with:\n          aws-access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY }}\n          aws-secret-access-key: ${{ secrets.AWS_S3_SECRET_KEY }}\n          aws-region: us-east-1\n\n      - name: Upload release folder to S3\n        id: upload-to-s3\n        run: |\n          s3_folder=\"static.realm.io/downloads/core/${{ needs.build-packages.outputs.core-version }}/cocoa\"\n          aws s3 sync --acl public-read . \"s3://$s3_folder\"\n          echo \"url=https://$s3_folder/realm-monorepo-xcframework-${{ needs.build-packages.outputs.core-version }}.tar.xz\" >> $GITHUB_OUTPUT\n        working-directory: release\n"
  },
  {
    "path": ".github/workflows/build-pr.yml",
    "content": "\n# This is a generated file produced by scripts/pr-ci-matrix.rb.\nname: Pull request build and test\non:\n  pull_request:\n    paths-ignore:\n      - '**.md'\n  workflow_dispatch:\n\njobs:\n  docs:\n    runs-on: macos-26\n    name: Test docs\n    steps:\n      - uses: actions/checkout@v4\n      - uses: ruby/setup-ruby@v1\n        with:\n          bundler-cache: true\n      - run: sudo xcode-select -switch /Applications/Xcode_26.3.app\n      - run: bundle exec sh build.sh verify-docs\n  swiftlint:\n    runs-on: macos-26\n    name: Check swiftlint\n    steps:\n      - uses: actions/checkout@v4\n      - run: sudo xcode-select -switch /Applications/Xcode_26.3.app\n      - run: brew install swiftlint\n      - run: sh build.sh verify-swiftlint\n\n  osx-26_1:\n    runs-on: macos-26\n    name: Test osx on Xcode 26.1\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.1.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr osx\n\n  osx-26_2:\n    runs-on: macos-26\n    name: Test osx on Xcode 26.2\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.2.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr osx\n\n  osx-26_3:\n    runs-on: macos-26\n    name: Test osx on Xcode 26.3\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.3.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr osx\n\n  osx-26_4:\n    runs-on: macos-26\n    name: Test osx on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr osx\n\n  osx-encryption-26_4:\n    runs-on: macos-26\n    name: Test osx-encryption on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr osx-encryption\n\n  swiftpm-26_1:\n    runs-on: macos-26\n    name: Test swiftpm on Xcode 26.1\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.1.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr swiftpm\n\n  swiftpm-26_4:\n    runs-on: macos-26\n    name: Test swiftpm on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr swiftpm\n\n  swiftpm-debug-26_1:\n    runs-on: macos-26\n    name: Test swiftpm-debug on Xcode 26.1\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.1.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr swiftpm-debug\n\n  swiftpm-debug-26_2:\n    runs-on: macos-26\n    name: Test swiftpm-debug on Xcode 26.2\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.2.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr swiftpm-debug\n\n  swiftpm-debug-26_3:\n    runs-on: macos-26\n    name: Test swiftpm-debug on Xcode 26.3\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.3.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr swiftpm-debug\n\n  swiftpm-debug-26_4:\n    runs-on: macos-26\n    name: Test swiftpm-debug on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr swiftpm-debug\n\n  swiftpm-address-26_4:\n    runs-on: macos-26\n    name: Test swiftpm-address on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr swiftpm-address\n\n  swiftpm-thread-26_4:\n    runs-on: macos-26\n    name: Test swiftpm-thread on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr swiftpm-thread\n\n  ios-static-26_1:\n    runs-on: macos-26\n    name: Test ios-static on Xcode 26.1\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.1.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr ios-static\n\n  ios-static-26_4:\n    runs-on: macos-26\n    name: Test ios-static on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr ios-static\n\n  ios-26_1:\n    runs-on: macos-26\n    name: Test ios on Xcode 26.1\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.1.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr ios\n\n  ios-26_4:\n    runs-on: macos-26\n    name: Test ios on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr ios\n\n  watchos-26_1:\n    runs-on: macos-26\n    name: Test watchos on Xcode 26.1\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.1.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr watchos\n\n  watchos-26_4:\n    runs-on: macos-26\n    name: Test watchos on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr watchos\n\n  tvos-26_1:\n    runs-on: macos-26\n    name: Test tvos on Xcode 26.1\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.1.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr tvos\n\n  tvos-26_4:\n    runs-on: macos-26\n    name: Test tvos on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr tvos\n\n  visionos-26_1:\n    runs-on: macos-26\n    name: Test visionos on Xcode 26.1\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.1.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr visionos\n\n  visionos-26_4:\n    runs-on: macos-26\n    name: Test visionos on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr visionos\n\n  osx-swift-26_1:\n    runs-on: macos-26\n    name: Test osx-swift on Xcode 26.1\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.1.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr osx-swift\n\n  osx-swift-26_2:\n    runs-on: macos-26\n    name: Test osx-swift on Xcode 26.2\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.2.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr osx-swift\n\n  osx-swift-26_3:\n    runs-on: macos-26\n    name: Test osx-swift on Xcode 26.3\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.3.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr osx-swift\n\n  osx-swift-26_4:\n    runs-on: macos-26\n    name: Test osx-swift on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr osx-swift\n\n  ios-swift-26_1:\n    runs-on: macos-26\n    name: Test ios-swift on Xcode 26.1\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.1.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr ios-swift\n\n  ios-swift-26_4:\n    runs-on: macos-26\n    name: Test ios-swift on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr ios-swift\n\n  tvos-swift-26_1:\n    runs-on: macos-26\n    name: Test tvos-swift on Xcode 26.1\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.1.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr tvos-swift\n\n  tvos-swift-26_4:\n    runs-on: macos-26\n    name: Test tvos-swift on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr tvos-swift\n\n  osx-swift-evolution-26_4:\n    runs-on: macos-26\n    name: Test osx-swift-evolution on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr osx-swift-evolution\n\n  ios-swift-evolution-26_4:\n    runs-on: macos-26\n    name: Test ios-swift-evolution on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr ios-swift-evolution\n\n  tvos-swift-evolution-26_4:\n    runs-on: macos-26\n    name: Test tvos-swift-evolution on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr tvos-swift-evolution\n\n  catalyst-26_1:\n    runs-on: macos-26\n    name: Test catalyst on Xcode 26.1\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.1.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr catalyst\n\n  catalyst-26_4:\n    runs-on: macos-26\n    name: Test catalyst on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr catalyst\n\n  catalyst-swift-26_1:\n    runs-on: macos-26\n    name: Test catalyst-swift on Xcode 26.1\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.1.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr catalyst-swift\n\n  catalyst-swift-26_4:\n    runs-on: macos-26\n    name: Test catalyst-swift on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr catalyst-swift\n\n  xcframework-26_4:\n    runs-on: macos-26\n    name: Test xcframework on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr xcframework\n\n  cocoapods-osx-26_1:\n    runs-on: macos-26\n    name: Test cocoapods-osx on Xcode 26.1\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.1.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr cocoapods-osx\n\n  cocoapods-osx-26_2:\n    runs-on: macos-26\n    name: Test cocoapods-osx on Xcode 26.2\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.2.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr cocoapods-osx\n\n  cocoapods-osx-26_3:\n    runs-on: macos-26\n    name: Test cocoapods-osx on Xcode 26.3\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.3.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr cocoapods-osx\n\n  cocoapods-osx-26_4:\n    runs-on: macos-26\n    name: Test cocoapods-osx on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr cocoapods-osx\n\n  cocoapods-ios-static-26_4:\n    runs-on: macos-26\n    name: Test cocoapods-ios-static on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr cocoapods-ios-static\n\n  cocoapods-ios-26_4:\n    runs-on: macos-26\n    name: Test cocoapods-ios on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr cocoapods-ios\n\n  cocoapods-watchos-26_4:\n    runs-on: macos-26\n    name: Test cocoapods-watchos on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr cocoapods-watchos\n\n  cocoapods-tvos-26_4:\n    runs-on: macos-26\n    name: Test cocoapods-tvos on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr cocoapods-tvos\n\n  cocoapods-catalyst-26_4:\n    runs-on: macos-26\n    name: Test cocoapods-catalyst on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr cocoapods-catalyst\n\n  ios-swiftui-26_4:\n    runs-on: macos-26\n    name: Test ios-swiftui on Xcode 26.4\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_26.4.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr ios-swiftui\n"
  },
  {
    "path": ".github/workflows/check-changelog.yml",
    "content": "# NOTE: This is a common file that is overwritten by realm/ci-actions sync service\n# and should only be modified in that repository.\n\nname: \"Check Changelog\"\non:\n  pull_request:\n    types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]\n\njobs:\n  changelog:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n        with:\n          submodules: false\n      - name: Enforce Changelog\n        uses: dangoslen/changelog-enforcer@c0b9fd225180a405c5f21f7a74b99e2eccc3e951\n        with:\n          skipLabels: no-changelog\n          missingUpdateErrorMessage: Please add an entry in CHANGELOG.md or apply the 'no-changelog' label to skip this check.\n"
  },
  {
    "path": ".github/workflows/master-push.yml",
    "content": "name: Prepare Release\non:\n  workflow_dispatch:\n  push:\n    branches:\n      - \"master\"\n      - \"release/**\"\nenv:\n  XCODE_VERSION: \"['26.1.1', '26.2', '26.3', '26.4']\"\n  PLATFORM: \"['ios', 'osx', 'watchos', 'tvos', 'catalyst', 'visionos']\"\n  RELEASE_VERSION: '26.3'\n  DEVELOPER_DIR: /Applications/Xcode_26.3.app/Contents/Developer\njobs:\n  prepare:\n      runs-on: ubuntu-latest\n      name: Prepare outputs\n      outputs:\n        XCODE_VERSIONS_MATRIX: ${{ env.XCODE_VERSION }}\n        PLATFORM_MATRIX: ${{ env.PLATFORM }}\n        VERSION: ${{ steps.get-version.outputs.VERSION }}\n      steps:\n        - name: Compute outputs\n          run: |\n            echo \"XCODE_VERSIONS_MATRIX=${{ env.XCODE_VERSION }}\" >> $GITHUB_OUTPUT\n            echo \"PLATFORM_MATRIX=${{ env.PLATFORM }}\" >> $GITHUB_OUTPUT\n        - uses: actions/checkout@v4\n        - name: Read SDK version\n          id: get-version\n          run: |\n            version=\"$(sed -n 's/^VERSION=\\(.*\\)$/\\1/p' \"${GITHUB_WORKSPACE}/dependencies.list\")\"\n            echo \"VERSION=$version\" >> $GITHUB_OUTPUT\n  build-docs:\n      runs-on: macos-26\n      name: Package docs\n      needs: prepare\n      steps:\n        - uses: actions/checkout@v4\n        - uses: ruby/setup-ruby@v1\n          with:\n            bundler-cache: true\n        - name: Prepare docs for packaging\n          run: bundle exec sh -x build.sh release-package-docs\n        - name: Upload docs to artifacts library\n          uses: actions/upload-artifact@v4\n          with:\n            name: realm-docs\n            path: docs/realm-docs.zip\n  build-examples:\n      runs-on: macos-26\n      name: Package examples\n      needs: prepare\n      steps:\n        - uses: actions/checkout@v4\n        - name: Prepare examples for packaging\n          run: sh -x build.sh release-package-examples\n        - name: Upload examples to artifacts library\n          uses: actions/upload-artifact@v4\n          with:\n            name: realm-examples\n            path: realm-examples.zip\n  build-product: # Creates framework for each platform, xcode version, target and configuration\n      name: Package framework\n      needs: prepare\n      strategy:\n        max-parallel: 20\n        fail-fast: false\n        matrix:\n          platform: ${{ fromJSON(needs.prepare.outputs.PLATFORM_MATRIX) }}\n          xcode-version: ${{ fromJSON(needs.prepare.outputs.XCODE_VERSIONS_MATRIX) }}\n          configuration: [swift, static]\n          include:\n            - xcode-version: 26.1.1\n              xcode-version-tag: 26.1\n              os: macos-26\n            - xcode-version: 26.2\n              xcode-version-tag: 26.2\n              os: macos-26\n            - xcode-version: 26.3\n              xcode-version-tag: 26.3\n              os: macos-26\n            - xcode-version: 26.4\n              xcode-version-tag: 26.4\n              os: macos-26\n          exclude:\n            - platform: osx\n              configuration: static\n            - platform: tvos\n              configuration: static\n            - platform: watchos\n              configuration: static\n            - platform: visionos\n              configuration: static\n            - platform: catalyst\n              configuration: static\n      runs-on: ${{ matrix.os }}\n      env:\n        DEVELOPER_DIR: /Applications/Xcode_${{matrix.xcode-version}}.app/Contents/Developer\n      steps:\n        - uses: actions/checkout@v4\n        - name: Install specific platform\n          run: sh build.sh install-xcode-platform \"${{matrix.platform}}\"\n        - run: sh build.sh ${{matrix.platform}}-${{matrix.configuration}}\n        - run: tar cf build.tar build/*/${{matrix.platform}}\n        - name: Upload framework\n          uses: actions/upload-artifact@v4\n          with:\n            name: build-${{matrix.platform}}-${{matrix.xcode-version-tag}}-${{matrix.configuration}}\n            path: build.tar\n            compression-level: 1\n  package-release:\n      runs-on: macos-26\n      name: Package release file\n      needs: [build-product, prepare]\n      steps:\n        - uses: actions/checkout@v4\n        - uses: actions/download-artifact@v4\n        - name: Install the Apple certificate and provisioning profile\n          env:\n            DEVELOPMENT_CERTIFICATE_BASE64: ${{ secrets.DEVELOPMENT_CERTIFICATE_BASE64 }}\n            P12_PASSWORD: ${{ secrets.P12_PASSWORD }}\n            KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}\n          run: sh build.sh install-apple-certificates\n        - name: Create release\n          env:\n            SIGNING_IDENTITY: ${{ secrets.SIGNING_IDENTITY }}\n          run: sh -x build.sh release-package\n        - name: Upload release artifactss\n          uses: actions/upload-artifact@v4\n          with:\n            name: release-package\n            path: pkg/*.zip\n        - name: Upload release for testing\n          uses: actions/upload-artifact@v4\n          with:\n            name: test-release-package\n            path: pkg/realm-swift-${{ needs.prepare.outputs.VERSION }}.zip\n  test-package-examples:\n      runs-on: macos-26\n      name: Test examples\n      needs: [package-release, prepare]\n      steps:\n        - uses: actions/checkout@v4\n        - name: Restore release\n          uses: actions/download-artifact@v4\n          with:\n            name: test-release-package\n        - name: Test examples\n          run: sh -x build.sh release-test-examples\n  test-ios-static:\n      runs-on: macos-26\n      name: Run tests on iOS with configuration Static\n      needs: package-release\n      steps:\n        - uses: actions/checkout@v4\n        - name: Test ios static\n          run: sh -x build.sh test-ios-static\n  test-osx-static:\n      runs-on: macos-26\n      name: Run tests on macOS\n      needs: package-release\n      steps:\n        - uses: actions/checkout@v4\n        - name: Test osx static\n          run: |\n            export REALM_DISABLE_METADATA_ENCRYPTION=1\n            sh -x build.sh test-osx\n  test-installation:\n      runs-on: macos-26\n      name: Run installation test\n      needs: [package-release, prepare]\n      env:\n        REALM_TEST_BRANCH: \"${{github.ref_name}}\"\n      strategy:\n        matrix:\n          platform: ${{ fromJSON(needs.prepare.outputs.PLATFORM_MATRIX) }}\n          installation: [cocoapods, spm, carthage]\n          linkage: [dynamic, static]\n          exclude:\n            - platform: visionos\n            - platform: catalyst\n              installation: carthage\n            - installation: carthage\n              linkage: static\n          include:\n            - platform: ios\n              installation: xcframework\n              linkage: static\n      steps:\n        - uses: actions/checkout@v4\n        - uses: ruby/setup-ruby@v1\n          with:\n            bundler-cache: true\n        - name: Download visionOS\n          if: matrix.platform == 'visionos'\n          run: xcodebuild -downloadPlatform visionOS\n        - name: Restore release\n          uses: actions/download-artifact@v4\n          if: ${{ matrix.installation == 'xcframework' }}\n          with:\n            name: test-release-package\n        - name: Run installation test\n          run: |\n            find . -name '*.zip' -depth 1 -exec mv {} examples/installation \\;\n            cd examples/installation\n            bundle exec ./build.rb ${{ matrix.platform }} ${{ matrix.installation }} ${{ matrix.linkage }}\n  test-installation-xcframework:\n      name: Run installation test for xcframework\n      needs: [package-release, prepare]\n      strategy:\n        matrix:\n          xcode-version: ${{ fromJSON(needs.prepare.outputs.XCODE_VERSIONS_MATRIX) }}\n          include:\n            - xcode-version: 26.1\n              os: macos-26\n            - xcode-version: 26.2\n              os: macos-26\n            - xcode-version: 26.3\n              os: macos-26\n            - xcode-version: 26.4\n              os: macos-26\n      env:\n        PLATFORM: 'osx'\n        DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode-version }}.app/Contents/Developer\n        REALM_TEST_BRANCH: \"${{github.ref_name}}\"\n      runs-on: ${{ matrix.os }}\n      steps:\n        - uses: actions/checkout@v4\n        - uses: ruby/setup-ruby@v1\n          with:\n            bundler-cache: true\n        - name: Restore release\n          uses: actions/download-artifact@v4\n          with:\n            name: test-release-package\n        - name: Run installation test\n          run: |\n            find . -name '*.zip' -depth 1 -exec mv {} examples/installation \\;\n            cd examples/installation\n            bundle exec ./build.rb osx xcframework dynamic\n\n"
  },
  {
    "path": ".github/workflows/publish-release.yml",
    "content": "name: Publish release\non: workflow_dispatch\nenv:\n  XCODE_VERSION: \"['26.1', '26.2', '26.3']\"\n  TEST_XCODE_VERSION: '26.3'\njobs:\n  prepare:\n    runs-on: ubuntu-latest\n    name: Prepare outputs\n    outputs:\n      XCODE_VERSIONS_MATRIX: ${{ env.XCODE_VERSION }}\n      VERSION: ${{ steps.get-version.outputs.VERSION }}\n    steps:\n      - uses: actions/checkout@v4\n      - name: Compute outputs\n        run: |\n          echo \"XCODE_VERSIONS_MATRIX=${{ env.XCODE_VERSION }}\" >> $GITHUB_OUTPUT\n      - name: Read SDK version\n        id: get-version\n        run: |\n          version=\"$(sed -n 's/^VERSION=\\(.*\\)$/\\1/p' \"${GITHUB_WORKSPACE}/dependencies.list\")\"\n          echo \"VERSION=$version\" >> $GITHUB_OUTPUT\n  tag-release:\n      runs-on: ubuntu-latest\n      name: Tag Release\n      needs: prepare\n      steps:\n        - uses: actions/checkout@v4\n        - uses: rickstaa/action-create-tag@v1\n          id: \"tag_create\"\n          with:\n            tag: \"v${{ needs.prepare.outputs.VERSION }}\"\n            tag_exists_error: false\n            message: \"\"\n  create-release:\n      runs-on: macos-26\n      name: Create github release\n      needs: [tag-release, prepare]\n      env:\n        GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n      steps:\n        - uses: actions/checkout@v4\n        - uses: ruby/setup-ruby@v1\n          with:\n            bundler-cache: true\n        - name: Create Github release\n          run: bundle exec ./build.sh publish-github ${{ github.sha }}\n  publish-cocoapods:\n      runs-on: macos-26\n      name: Publish Cocoapods specs\n      needs: [tag-release, prepare]\n      env:\n        COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}\n      steps:\n        - uses: actions/checkout@v4\n        - uses: ruby/setup-ruby@v1\n          with:\n            bundler-cache: true\n        - name: Publish\n          run: bundle exec ./build.sh publish-cocoapods v${{ needs.prepare.outputs.VERSION }}\n  update-checker:\n      runs-on: macos-26\n      name: Update to latest version update checker file\n      needs: tag-release\n      env:\n        AWS_ACCESS_KEY_ID: ${{ secrets.UPDATE_CHECKER_ACCESS_KEY }}\n        AWS_SECRET_ACCESS_KEY: ${{ secrets.UPDATE_CHECKER_SECRET_KEY }}\n      steps:\n        - uses: actions/checkout@v4\n        - uses: ruby/setup-ruby@v1\n          with:\n            bundler-cache: true\n        - run: brew install s3cmd\n        - run: bundle exec ./build.sh publish-update-checker\n  test-installation:\n      runs-on: macos-26\n      name: Run installation test for ${{ matrix.platform }}, ${{ matrix.installation }} and ${{ matrix.linkage }}\n      needs: [create-release, prepare, publish-cocoapods]\n      strategy:\n        fail-fast: false\n        matrix:\n          platform: [ios, osx, watchos, tvos, catalyst, visionos]\n          installation: [cocoapods, spm, carthage, xcframework]\n          linkage: [static, dynamic]\n          exclude:\n            - installation: carthage\n              linkage: static\n            - platform: catalyst\n              installation: carthage\n            - platform: osx\n              installation: xcframework\n              linkage: static\n            - platform: watchos\n              installation: xcframework\n              linkage: static\n            - platform: tvos\n              installation: xcframework\n              linkage: static\n            - platform: catalyst\n              installation: xcframework\n              linkage: static\n            - platform: visionos\n              installation: xcframework\n              linkage: static\n            - platform: catalyst\n              installation: carthage\n              linkage: static\n            - platform: visionos\n              installation: carthage\n            - platform: visionos\n              installation: cocoapods\n      steps:\n        - uses: actions/checkout@v4\n        - uses: ruby/setup-ruby@v1\n          with:\n            bundler-cache: true\n        - uses: maxim-lobanov/setup-xcode@v1\n          with:\n            xcode-version: ${{ env.TEST_XCODE_VERSION }}\n        - name: Run installation test\n          uses: nick-fields/retry@v3\n          env:\n            REALM_TEST_RELEASE: ${{ needs.prepare.outputs.VERSION }}\n          with:\n            command: |\n              cd examples/installation\n              bundle exec ./build.rb ${{ matrix.platform }} ${{ matrix.installation }} ${{ matrix.linkage }}\n            timeout_minutes: 30\n            max_attempts: 10\n            retry_wait_seconds: 60\n            retry_on: error\n"
  },
  {
    "path": ".gitignore",
    "content": "*~\n.DS_Store\n\n# Merge files\n*.orig\n\n# Binaries\n*.dylib\n*.a\n*.o\n*.d\n*.libdeps\n*.zip\n*.realm\n!examples/ios/swift/Migration/RealmTemplates/*.realm\n!examples/ios/objc/Migration/RealmTemplates/*.realm\n*.realm.lock\n\n# core\ncore\ncore-*\nrealm-core-*-xcframework\n\n# sh build.sh test\nbuild/\n\n\n# sh build.sh cocoapods-setup\n/include\n\n# sh build.sh docs\n/docs/objc_output\n/docs/swift_output\n/Realm/RLMPlatform.h\n\n# XCode\n*.bak\nxcuserdata/\nproject.xcworkspace\n*.xccheckout\nDerivedData\n/.build\n\n# AppCode\n.idea/\n*.iml\n# backup and crash files\n*.swp\n\n# xcpretty\nbuild.log\n\n# ruby\n*.gem\n*.rbc\n/.config\n/coverage/\n/InstalledFiles\n/pkg/\n/spec/reports/\n/test/tmp/\n/test/version_tmp/\n/tmp/\n\n## Carthage\n# Cartfiles are ignored because they're generated on demand in the installation examples\nCartfile\nCarthage\n\n## Swift Version\nSwiftVersion.swift\n\nexamples/ios/objc/Draw/Constants.h\n\n## Sync testing\n/ci_scripts/setup_baas/.baas\n\n## Swiftpm\n.swiftpm\n.build\nPackage.resolved\n\nexamples/installation/ios/swift/SwiftPackageManagerExample/SwiftPackageManagerExample.xcodeproj\n"
  },
  {
    "path": ".ruby-version",
    "content": "3.3.4\n"
  },
  {
    "path": ".swiftlint.yml",
    "content": "included:\n  - Realm/ObjectServerTests\n  - RealmSwift\n  - Realm/Swift\n  - examples/installation/watchos/swift\n  - examples/installation/osx/swift\n  - examples/installation/ios/swift\n  - examples/ios/swift\n  - examples/tvos/swift\ntype_name:\n  allowed_symbols:\n    - _\nidentifier_name:\n  allowed_symbols:\n    - _\n  min_length: # not possible to disable this partial rule, so set it to zero\n    warning: 0\n    error: 0\n  excluded:\n    - id\n    - pk\n    - to\ndisabled_rules:\n  - blanket_disable_command\n  - block_based_kvo\n  # SwiftLint considers 'Realm' and 'Realm.Private' to be duplicate imports\n  # because we're using submodules in an unsual way, and normally the parent\n  # module re-exports all of its children.\n  - duplicate_imports\n  - file_length\n  - force_cast\n  - force_try\n  - function_body_length\n  - function_parameter_count\n  - line_length\n  - nesting\n  - syntactic_sugar\n  - todo\n  - trailing_comma\n  - type_body_length\n  - vertical_whitespace\n  # swiftlint complains about superfluous disable commands when the violation\n  # occurs in an inactive #if and doesn't support conditionally disabling it\n  - cyclomatic_complexity\n  # #unavailable was implemented in Swift 5.6 so we can't use it until that's\n  # the minimum version we support\n  - unavailable_condition\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "20.0.4 Release notes (2026-02-22)\n=============================================================\n\n* Update build scripts for Xcode 26.\n* Drop support for Xcode < 26.\n* Prebuilt binaries are no longer code signed as Realm is no longer officially\n  distributed by MongoDB.\n* Fix compilation with Xcode 26.4.\n\n### Compatibility\n\n* Carthage release for Swift is built with Xcode 26.3.\n* CocoaPods: 1.10 or later.\n* Xcode: 26.1-26.4\n\n20.0.3 Release notes (2025-06-15)\n=============================================================\n\n### Enhancements\n\n* Update build scripts for Xcode 16.4.\n* Add support for building with Xcode 26 beta 1.\n\n### Compatibility\n\n* Carthage release for Swift is built with Xcode 16.4.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 15.3.0-26 beta 1.\n\n20.0.2 Release notes (2025-04-14)\n=============================================================\n\n### Enhancements\n\n* Update build scripts for Xcode 16.3.\n\n### Compatibility\n\n* Carthage release for Swift is built with Xcode 16.3.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 15.3.0-16.3.\n\n20.0.1 Release notes (2024-12-27)\n=============================================================\n\n### Enhancements\n\n* Update build scripts for Xcode 16.2.\n\n### Fixed\n\n* A query with a number of predicates ORed together may result in a\n  crash on some platforms (strict weak ordering check failing on iphone)\n  ([#8028](https://github.com/realm/realm-core/issues/8028), since v10.50.0).\n\n### Compatibility\n\n* Realm Studio: 15.0.0 or later.\n* Carthage release for Swift is built with Xcode 16.2.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 15.3.0-16.2.\n\n### Internal\n\n* Upgraded realm-core from v20.0.0 to 20.1.0\n\n20.0.0 Release notes (2024-09-09)\n=============================================================\n\nThe minimum supported version of Xcode is now 15.3.\n\n### Enhancements\n\n* Build in Swift 6 language mode when using Xcode 16. Libraries build in Swift\n  6 mode can be consumed by apps built in Swift 5 mode, so this should not have\n  any immediate effects beyond eliminating some warnings and ensuring that all\n  Realm APIs can be used in Swift 6 mode. Some notes about using Realm Swift in\n  Swift 6:\n  - `try await Realm(actor: actor)` has been replaced with `try await\n  Realm.open()` to work around isolated parameters not being implemented for\n  initializers (https://github.com/swiftlang/swift/issues/71174). The actor is\n  now automatically inferred and should not be manually passed in.\n  - `@ThreadSafe` is not usable as a property wrapper on local variables and\n  function arguments in Swift 6 mode. Sendability checking for property\n  wrappers never got implemented due to them being quietly deprecated in favor\n  of macros. It can still be used as a property wrapper for class properties\n  and as a manual wrapper locally, but note that it does not combine well with\n  actor-isolated Realms.\n* Some SwiftUI components are now explicitly marked as `@MainActor`. These\n  types were implicitly `@MainActor` in Swift 5, but became nonisolated when\n  using Xcode 16 in Swift 5 mode due to the removal of implicit isolation when\n  using property wrappers on member variables. This resulted in some new\n  sendability warnings in Xcode 16 (or errors in Swift 6 mode).\n* Add Xcode 16 and 16.1 binaries to the release packages (currently built with\n  beta 6 and beta 1 respectively).\n\n### Breaking Changes\n\n* All Atlas App Services and Atlas Device Sync functionality has been removed.\n  Users of Atlas Device Sync should pin to v10.\n* Queries on AnyRealmValue properties previously considered strings to be\n  equivalent to Data containing the UTF-8 encoded string. Strings and Data are\n  now considered different types and queries for one of them will not match the\n  other.\n* Realms are no longer autoreleased when initialized. This means that code\n  along the lines of the following will no longer work:\n\n  ```Swift\n  try! Realm().beginWrite()\n  try! Realm().create(MyObject.self, value: ...)\n  try! Realm().commitWrite()\n  ```\n\n  This was a pattern which was somewhat natural with the original version of\n  the objective-c API, but only worked in debug builds and would fail in\n  release builds. We decided to make it consistently work by forcing the Realm\n  to be autoreleased rather than let users write code which appeared to work\n  but was actually broken. In modern Swift this code is very strange, and\n  autoreleasing the Realm made it much more difficult to ensure that the\n  file is actually closed at predictable times.\n\n  Realms are now returned retained in both debug and release modes, so this\n  will always break rather than appearing to work. Note that there is still a\n  weak cache of Realms and `Realm()` will still return a reference to the\n  existing Realm if there is one open on the current thread.\n* Iterating a Map now produces the tuple `(key: KeyType, value: ValueType)`\n  rather than a very similar struct, and `.asKeyValueSequence()` has been\n  removed. This aligns `Map` with `Dictionary` and makes many operations\n  defined by `Sequence` work on `Map`.\n* Passing an empty array for notification keypaths to filter on (e.g.\n  `obj.observe(keyPaths: [])`) was treated the same as passing `nil`, i.e. no\n  filtering was done. It now instead observes no keypaths. For objects this\n  means it will only report the object being deleted, and for collections it\n  will only report collection-level changes and not changes to the objects\n  inside the collection.\n* `Decimal128(string:)` was marked as `throws`, but it never actually threw an\n  error and instead returned `NaN` if the string could not be parsed as a\n  decimal128. That behavior was kept and it is no longer marked as `throws`.\n\n### Compatibility\n\n* Realm Studio: 15.0.0 or later.\n* Carthage release for Swift is built with Xcode 15.4.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 15.3.0-16.1 beta.\n\n### Internal\n\n* Upgraded realm-core from v14.12.1 to v20.0.0.\n\n10.53.1 Release notes (2024-09-05)\n=============================================================\n\n### Enhancements\n\n* Add the file path to the exception thrown by File::rw_lock() when it fails to\n  open the file. ([Core #7999](https://github.com/realm/realm-core/issues/7999))\n\n### Fixed\n\n* Filtering notifications with a LinkingObjects property as the final element\n  could sometimes give wrong results\n  ([Core #7530](https://github.com/realm/realm-core/issues/7530), since v10.11.0)\n* Fix a potential crash during process termination when Logger log level is set\n  higher than Info. ([Core #7969](https://github.com/realm/realm-core/issues/7969), since v10.45.0)\n* The check for maximum path length was incorrect and lengths between 240 and\n  250 would fail to use the hashed fallback ([Core #8007](https://github.com/realm/realm-core/issues/8007), since v10.0.0).\n* API misuse resulting in an exception being thrown from within a callback\n  would sometimes terminate due to hitting `REALM_UNREACHABLE()` rather than\n  the exception being propagated to the caller\n  ([Core #7836](https://github.com/realm/realm-core/issues/7836)).\n\n### Compatibility\n\n* Realm Studio: 15.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.4.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 15.1.0-16 beta 5.\n\n### Internal\n\n* Upgraded realm-core from v14.12.0 to 14.12.1\n\n10.53.0 Release notes (2024-08-20)\n=============================================================\n\n### Enhancements\n\n* Code sign our published xcframeworks. By Apple's requirements, we should sign our release\n  binaries so Xcode can validate it was signed by the same developer on every new version.\n  ([Apple](https://developer.apple.com/support/third-party-SDK-requirements/)).\n* Report sync warnings from the server such as sync being disabled server-side to the sync error handler.\n  ([#8020](https://github.com/realm/realm-swift/issues/8020)).\n* Add support for string comparison queries, which allows building string\n  queries with the following operators (`>`, `>=`, `<`, `<=`).\n  This is a case sensitive lexicographical comparison.\n  ([#8008](https://github.com/realm/realm-swift/issues/8008)).\n\n### Fixed\n\n* `-[RLMAsymmetricObject createObject:withValue:]` was marked as having a\n  non-null return value despite always returning `nil` (since v10.29.0).\n* Eliminate several clang static analyzer warnings which did not report actual\n  bugs.\n* The async and Future versions of `User.functions` only worked for functions\n  which took exactly one argument, which had to be an array ([#8669](https://github.com/realm/realm-swift/issues/8669), since 10.16.0).\n\n### Compatibility\n\n* Realm Studio: 15.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.4.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 15.1.0-16 beta 5.\n\n10.52.3 Release notes (2024-08-09)\n=============================================================\n\n### Enhancements\n\n* Improve performance of bulk object creation when the objects have embedded\n  objects. This is particularly significant for applying sync bootstraps.\n  ([Core #7945](https://github.com/realm/realm-core/issues/7945))\n* Client reset cycle detection now checks if the previous recovery attempt was\n  made by the same version of Realm, and if not attempts recovery again\n  ([Core #7944](https://github.com/realm/realm-core/pull/7944)).\n\n### Fixed\n\n* App change notifications were being sent too soon when a new user was logged\n  in, resulting in the user's profile being empty if it was read from within\n  the change notification (since v10.51.0).\n* A conflict resolution bug related to ArrayErase and Clear instructions could\n  sometimes cause an \"Invalid prior_size\" exception when synchronizing\n  ([Core #7893](https://github.com/realm/realm-core/issues/7893), since v10.51.0).\n* Sync merges which resulted in a changeset's reciprotal transformation being\n  empty were handled incorrectly, possibly resulting in data divergence. No\n  instances of this actually happening have been reported.\n  ([Core #7955](https://github.com/realm/realm-core/pull/7955), since v10.51.0)\n* `Realm.writeCopy()` would sometimes incorrectly throw an exception claiming\n  that there were unuploaded local changes when the source Realm is a\n  synchronized Realm ([Core #7966](https://github.com/realm/realm-core/issues/7966), since v10.7.6).\n\n### Compatibility\n\n* Realm Studio: 15.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.4.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 15.1.0-16 beta 5.\n\n### Internal\n\n* Upgraded realm-core from v14.11.1 to 14.12.0\n\n10.52.2 Release notes (2024-07-19)\n=============================================================\n\n### Enhancements\n\n* Server-side role and permissions changes no longer require a client reset to\n  update the local Realm. ([Core #7440](https://github.com/realm/realm-core/pull/7440))\n\n### Fixed\n\n* Deleting an object with a `List<AnyRealmValue` proeprty which linked to an\n  object which had been deleted by another sync client would switch to the\n  incorrect cascade mode and perform a cascading delete. This meant that if any\n  subsequent properties in the object linked to another top-level object and\n  that was the *only* link to that object, the target object would also be\n  recursively deleted as if it was an embedded object.\n  ([Core #7828](https://github.com/realm/realm-core/issues/7828), since v10.51.0).\n* Fix the assertion failure `array_backlink.cpp:112: Assertion failed:\n  int64_t(value >> 1) == key.value` when removing links to an object (either by\n  reassigning the link or by deleting the object). This could happen if the link\n  came from a collection inside a `AnyRealmValue`, any `Map`, or a\n  `List<AnyRealmValue>`, and there were more than 256 objects of the type which\n  contained the link.\n ([Core #7594](https://github.com/realm/realm-core/issues/7594), since v10.8.0)\n* Fix the assertion failure `array.cpp:319: Array::move() Assertion failed:\n  begin <= end [2, 1]` when deleting objects containing collections nested\n  inside a `AnyRealmValue` when this caused bptree leaves to be merged.\n  ()[Core #7839](https://github.com/realm/realm-core/issues/7839), since v10.51.0).\n* `SyncSession.wait(for .upload)` was inconsistent in how it handled commits\n  which do no produce any changesets to upload (such as modifying flexible sync\n  subscriptions). Previously if all unuploaded commits had empty changesets and\n  the session had never completed a download it would wait for download\n  completion, and otherwise it would complete immediate. It now always\n  completes immediately. ([Core #7796](https://github.com/realm/realm-core/pull/7796)).\n* The sync client could hit an assertion failure if a session is resumed while\n  the session is being suspended. ([Core #7860](https://github.com/realm/realm-core/issues/7860), since v10.27.0)\n* If a sync session was interrupted by a disconnect or restart while downloading\n  a bootstrap (a set of downloads caused by adding or changing a query\n  subscription), stale data from the previous bootstrap could be included when\n  the session reconnected and completed downloading the bootstrap. This could\n  lead to objects stored in the database that do not match the actual state of\n  the server and potentially leading to compensating writes.\n  ([Core #7827](https://github.com/realm/realm-core/issues/7827), since v10.27.0)\n* Fixed unnecessary server roundtrips when there was no download to acknowledge\n  ([Core #2129](https://jira.mongodb.org/browse/RCORE-2129), since v10.51.0).\n\n### Compatibility\n\n* Realm Studio: 15.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.4.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 15.1.0-16 beta 3.\n\n### Internal\n\n* Upgraded realm-core from v14.10.2 to 14.11.0\n\n10.52.1 Release notes (2024-06-28)\n=============================================================\n\n### Fixed\n\n* Realm compaction (triggered by setting `shouldCompactOnLaunch`) on an\n  encrypted Realm file could produce an invalid file unless the encryption key\n  happened to be a valid nul-terminated string.\n  ([Core #7842](https://github.com/realm/realm-core/issues/7842), since v10.52.0.\n* Assigning a List or Dictionary to an AnyRealmValue property which already\n  stored that type of collection would only emit a clear instruction if the\n  collection was not already empty. This meant that assigning to the property\n  on two different clients would merge the collections if the property\n  initially stored an empty collection, but would pick one of the two\n  assignments to win if it was initially non-empty. If merging is the desired\n  behavior, appending to the List rather than assigning a new List will still\n  achieve that ([Core #7809](https://github.com/realm/realm-core/issues/7809), since v10.51.0).\n\n\n### Compatibility\n\n* Realm Studio: 15.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.4.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 15.1.0-15.4.0.\n\n### Internal\n* Upgraded realm-core from v14.10.1 to 14.10.2\n\n10.52.0 Release notes (2024-06-18)\n=============================================================\n\n### Enhancements\n\n* Add `@ObservedSectionedResults.remove(atOffsets:section:)` which adds the ability to\n  remove a Realm Object when using `onDelete` on `ForEach` in a SwiftUI `List`.\n* Add support for Xcode 16 beta 1 and fix some of the new warnings. Note that\n  this does not yet include full support for Swift 6 language mode\n  ([#8618](https://github.com/realm/realm-swift/pull/8618)).\n* `Realm.asyncWrite()` and `Realm.asyncRefresh()` now use the new `#isolation`\n  feature to avoid sendability warnings when building with Xcode 16\n  ([#8618](https://github.com/realm/realm-swift/pull/8618)).\n* Include the originating client reset error message in errors reporting that\n  automatic client reset handling failed. ([Core #7761](https://github.com/realm/realm-core/pull/7761))\n* Improve the performance of insertion-heavy write transactions, particularly\n  when setting a large number of properties on each object created\n  ([Core #7734](https://github.com/realm/realm-core/pull/7734)).\n* App now trims trailing slashes from the base url rather than producing\n  confusing 404 errors. ([Core #7791](https://github.com/realm/realm-core/pull/7791)).\n\n### Fixed\n\n* Deleting a Realm Object used in a `@ObservedSectionedResults` collection in `SwiftUI`\n  would cause a crash during the diff on the `View`. ([#8294](https://github.com/realm/realm-swift/issues/8294), since v10.29.0)\n* Fix some client resets (such as migrating to flexible sync) potentially\n  failing if a new client reset condition (such as rolling back a flexible sync\n  migration) occurred before the first one completed.\n ([Core #7542](https://github.com/realm/realm-core/pull/7542), since v10.40.0)\n* The encryption code no longer behaves differently depending on the system\n  page size, which should entirely eliminate a recurring source of bugs related\n  to copying encrypted Realm files between platforms with different page sizes.\n  One known outstanding bug was ([RNET-1141](https://github.com/realm/realm-dotnet/issues/3592)),\n  where opening files on a system with a larger page size than the writing\n  system would attempt to read sections of the file which had never been\n  written to ([Core #7698](https://github.com/realm/realm-core/pull/7698)).\n* There were several complicated scenarios which could result in stale reads\n  from encrypted files in multiprocess scenarios. These were very difficult to\n  hit and would typically lead to a crash, either due to an assertion failure\n  or DecryptionFailure being thrown ([Core #7698](https://github.com/realm/realm-core/pull/7698), since v10.38.0).\n* Encrypted files have some benign data races where we can memcpy a block of\n  memory while another thread is writing to a limited range of it. It is\n  logically impossible to ever read from that range when this happens, but\n  Thread Sanitizer quite reasonably complains about this. We now perform a\n  slower operations when running with TSan which avoids this benign race\n  ([Core #7698](https://github.com/realm/realm-core/pull/7698)).\n* `Realm.asyncOpen()` on a flexible sync Realm would sometimes fail to wait for\n  pending subscriptions to complete, resulting in it not actually waiting for\n  all data to be downloaded. ([Core #7720](https://github.com/realm/realm-core/issues/7720),\n  since flexible sync was introduced).\n* `List<AnyRealmValue>.clear()` would hit an assertion failure when used on a\n  file originally created by a version of Realm older than v10.49.0.\n  ([Core #7771](https://github.com/realm/realm-core/issues/7771), since 10.49.0)\n\n### Compatibility\n\n* Realm Studio: 15.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.4.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 15.1.0-16 beta\n\n### Internal\n\n* Upgraded realm-core from v14.9.0 to 14.10.1\n\n10.51.0 Release notes (2024-06-06)\n=============================================================\n\n### Enhancements\n\n* Added support for storing nested collections (List and Map not ManagedSet) in a `AnyRealmValue`.\n  ```swift\n  class MixedObject: Object {\n    @Persisted var anyValue: AnyRealmValue\n  }\n\n  // You can build a AnyRealmValue from a Swift's Dictionary.\n  let dictionary: Dictionary<String, AnyRealmValue> = [\"key1\": .string(\"hello\"), \"key2\": .bool(false)]\n\n  // You can build a AnyRealmValue from a Swift's Map\n  // and nest a collection within another collection.\n  let list: Array<AnyRealmValue> = [.int(12), .double(14.17), AnyRealmValue.fromDictionary(dictionary)]\n\n  let realm = realmWithTestPath()\n  try realm.write {\n    let obj = MixedObject()\n    obj.anyValue = AnyRealmValue.fromArray(list)\n    realm.add(obj)\n  }\n  ```\n* Added new operators to Swift's Query API for supporting querying nested collections.\n  ```swift\n  realm.objects(MixedObject.self).where { $0.anyValue[0][0][1] == .double(76.54) }\n  ```\n\n  The `.any` operator allows looking up in all keys or indexes.\n  ```swift\n  realm.objects(MixedObject.self).where { $0.anyValue[\"key\"].any == .bool(false) }\n  ```\n* Report the originating error that caused a client reset to occur.\n  ([Core #6154](https://github.com/realm/realm-core/issues/6154))\n\n### Fixed\n\n* Accessing `App.currentUser` from within a notification produced by `App.switchToUser()`\n  (which includes notifications for a newly logged in user) would deadlock.\n  ([Core #7670](https://github.com/realm/realm-core/issues/7670), since v10.50.0).\n* Inserting the same link to the same key in a dictionary more than once would incorrectly create\n  multiple backlinks to the object. This did not appear to cause any crashes later, but would\n  have affecting explicit backlink count queries and possibly notifications.\n  ([Core #7676](https://github.com/realm/realm-core/issues/7676), since v10.49.2).\n* A non-streaming progress notifier would not immediately call its callback after registration.\n  Instead you would have to wait for a download message to be received to get your first\n  update - if you were already caught up when you registered the notifier you could end up waiting a\n  long time for the server to deliver a download that would call/expire your notifier\n  ([Core #7627](https://github.com/realm/realm-core/issues/7627), since v10.50.0).\n* After compacting, a file upgrade would be triggered. This could cause loss of data\n  if `deleteRealmIfMigrationNeeded` is set to true.\n  ([Core #7747](https://github.com/realm/realm-core/issues/7747), since v10.49.0).\n\n### Compatibility\n\n* Realm Studio: 15.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.4.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 15.1.0-15.4.0.\n\n### Internal\n\n* Upgraded realm-core from v14.6.2 to 14.9.0\n\n10.50.1 Release notes (2024-05-21)\n=============================================================\n\n### Enhancements\n\n* Update release packaging for Xcode 15.4.\n\n### Fixed\n\n* `@AutoOpen` and `@AsyncOpen` failed to use the `initialSubscriptions` set in\n  the configuration passed to them ([PR #8572](https://github.com/realm/realm-swift/pull/8572), since v10.50.0).\n* `App.baseURL` was always `nil` ([PR #8573](https://github.com/realm/realm-swift/pull/8573), since it was introduced in v10.50.0).\n\n### Compatibility\n\n* Realm Studio: 15.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.4.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 15.1.0-15.4.0.\n\n10.50.0 Release notes (2024-05-02)\n=============================================================\n\nDrop support for Xcode 14, as it can no longer be used to submit app to the app\nstore. Xcode 15.1 is now the minimum supported version.\n\n### Known Issues\n* Accessing `App.currentUser` within an `App.subscribe` callback would lead to a deadlock.\n\n### Enhancements\n* Added `SyncConfiguration.initialSubscriptions` which describes the initial\n  subscription configuration that was passed when constructing the\n  `SyncConfiguration`. ([#8548](https://github.com/realm/realm-swift/issues/8548))\n* When connecting to multiple server apps, a unique encryption key is used for\n  each of the metadata Realms rather than sharing one between them\n  ([Core #7552](https://github.com/realm/realm-core/pull/7552)).\n* Improve perfomance of IN queries and chained OR equality queries for\n  UUID/ObjectId types. ([.Net #3566](https://github.com/realm/realm-dotnet/issues/3566))\n* Added support for updating Atlas Device Sync's base url, in case the need to roam between\n  servers (cloud and/or edge server). This API is private and can only be imported using\n  `@_spi(Private)`\n   ```swift\n   @_spi(RealmSwiftExperimental) import RealmSwift\n\n   try await app.updateBaseUrl(to: \"https://services.cloud.mongodb.com\")\n  ```\n  ([#8486](https://github.com/realm/realm-swift/issues/8486)).\n* Enable building RealmSwift as a dynamic framework when installing via SPM, which\n  lets us supply a privacy manifest. When RealmSwift is built as a static\n  library you must supply your own manifest, as Xcode does not build static\n  libraries in a way compatible with xcprivacy embedding. Due to some bugs in\n  Xcode, this may require manual changes to your project:\n   - Targets must now depend on only Realm or RealmSwift. If you use both the\n     obj-c and swift API, depending on RealmSwift will let you import Realm.\n     Trying to directly depend on both will give the error \"Swift package\n     target 'Realm' is linked as a static library by 'App' and 'Realm', but\n     cannot be built dynamically because there is a package product with the\n     same name.\"\n   - To actually build RealmSwift as a dynamic framework, change \"Do Not Embed\"\n     to \"Embed & Sign\" in the \"Frameworks, Libraries, and Embedded Content\"\n     section on the General tab of your target's settings.\n  ([#8561](https://github.com/realm/realm-swift/pull/8561)).\n* The `transferredBytes` and `transferrableBytes` fields on `Progress` have been deprecated\n  in favor of `progressEstimate` which is a value between 0.0 and 1.0 indicating the estimated\n  progress toward the upload/download transfer. ([#8476](https://github.com/realm/realm-swift/issues/8476))\n\n### Fixed\n* `-[RLMUser allSessions]` did not include sessions which were currently\n  waiting for an access token despite including sessions in other non-active\n  states. ([Core #7300](https://github.com/realm/realm-core/pull/7300), since v10.0.0).\n* `[RLMApp allUsers]` included users which were logged out during the current\n  run of the app, but not users which had previously been logged out. It now\n  always includes all logged out users. ([Core #7300](https://github.com/realm/realm-core/pull/7300), since v10.0.0).\n* Deleting the active user (via `User.delete()`) left the active user\n  unset rather than selecting another logged-in user as the active user like\n  logging out and removing users does. ([Core #7300](https://github.com/realm/realm-core/pull/7300), since v10.23.0).\n* Fixed several issues around copying an encrypted Realm between platforms with\n  different page sizes (such as between x86_64 and arm64 Apple platforms):\n  - Fixed `Assertion failed: new_size % (1ULL << m_page_shift) == 0` when\n    opening an encrypted Realm less than 64Mb that was generated on a platform\n    with a different page size than the current platform.\n    ([Core #7322](https://github.com/realm/realm-core/issues/7322), since v10.42.0)\n  - Fixed a `DecryptionFailed` exception thrown when opening a small (<4k of\n    data) Realm generated on a device with a page size of 4k if it was bundled\n    and opened on a device with a larger page size (since the beginning).\n  - Fixed an issue during a subsequent open of an encrypted Realm for some rare\n    allocation patterns when the top ref was within ~50 bytes of the end of a\n    page. This could manifest as a DecryptionFailed exception or as an\n    assertion: `encrypted_file_mapping.hpp:183: Assertion failed: local_ndx <\n    m_page_state.size()`. ([Core #7319](https://github.com/realm/realm-core/issues/7319))\n* Schema initialization could hit an assertion failure if the sync client\n  applied a downloaded changeset while the Realm file was in the process of\n  being opened ([#7041](https://github.com/realm/realm-core/issues/7041), since v10.15.0).\n* The reported download progress for flexible sync Realms was incorrect. It is now replaced by a\n  progress estimate, which is derived by the server based on historical data and other heuristics.\n  ([#8476](https://github.com/realm/realm-swift/issues/8476))\n\n### Deprecations\n\n* `rlm_valueType` is deprecated in favour of `rlm_anyValueType` which now includes collections (List and Dictionary).\n\n<!-- ### Breaking Changes - ONLY INCLUDE FOR NEW MAJOR version -->\n\n### Compatibility\n* Realm Studio: 15.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.3.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 15.1.0-15.3.0.\n\n### Internal\n* Upgraded realm-core from v14.5.2 to 14.6.2\n\n10.49.2 Release notes (2024-04-17)\n=============================================================\n\n### Enhancements\n\n* The default base url in `AppConfiguration` has been updated to point to `services.cloud.mongodb.com`. See https://www.mongodb.com/docs/atlas/app-services/domain-migration/ for more information. ([#8512](https://github.com/realm/realm-swift/issues/8512))\n\n### Fixed\n\n* Fixed a crash that would occur when an http error 401 or 403 is returned upon\n  opening a watch stream for a MongoDB collection. ([#8519](https://github.com/realm/realm-swift/issues/8519))\n* Fix an assertion failure \"m_lock_info && m_lock_info->m_file.get_path() == m_filename\" that appears to be related to opening a Realm while the file is in the process of being closed on another thread. ([#8507](https://github.com/realm/realm-swift/issues/8507))\n* Fixed diverging history due to a bug in the replication code when setting default null values (embedded objects included). ([Core #7536](https://github.com/realm/realm-core/issues/7536))\n* Null pointer exception may be triggered when logging out and async commits callbacks not executed. ([Core #7434](https://github.com/realm/realm-core/issues/7434))\n* `AppConfiguration.baseUrl` will now return the default value of the url when not set rather than `nil`. ([#8512](https://github.com/realm/realm-swift/issues/8512))\n* Added privacy manifest to Core's Swift package ([Swift #8535](https://github.com/realm/realm-swift/issues/8535))\n* Fixed crash when integrating removal of already removed dictionary key ([Core #7488](https://github.com/realm/realm-core/issues/7488), since v10.0.0)\n\n### Compatibility\n\n* Realm Studio: 15.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.3.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.2-15.3.0.\n\n### Internal\n\n* Upgraded realm-core from 14.4.1 to 14.5.2\n\n10.49.1 Release notes (2024-03-22)\n=============================================================\n\n### Enhancements\n\n* Improve file compaction performance on arm64 platforms for encrypted files\n  between 16kB and 4MB in size. ([PR #7492](https://github.com/realm/realm-core/pull/7492)).\n\n### Fixed\n\n* Opening a Realm with a cached user while offline would fail to retry some\n  steps of the connection process and instead report a fatal error.\n  ([#7349](https://github.com/realm/realm-core/issues/7349), since v10.46.0)\n\n### Compatibility\n\n* Realm Studio: 15.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.3.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.2-15.3.0.\n\n### Internal\n\n* Upgraded realm-core from v14.3.0 to 14.4.1\n\n10.49.0 Release notes (2024-03-22)\n=============================================================\n\nThis version introduces a new Realm file format version (v24). Opening existing\nRealm files will automatically upgrade the files, making them unable to be\nopened by older versions. This upgrade process should typically be very fast\nunless you have large Sets of AnyRealmValue, String, or Data, which have to be rewritten.\n\nA backup will automatically be created next to the Realm before performing the\nupgrade. Downgrading to older versions of Realm will attempt to automatically\nrestore the backup, or it will be deleted after three months.\n\n### Enhancements\n\n* Storage of Decimal128 properties has been optimised similarly to Int\n  properties so that the individual values will take up 0 bits (if all nulls),\n  32 bits, 64 bits or 128 bits depending on what is needed.\n  ([Core #6111](https://github.com/realm/realm-core/pull/6111))\n\n### Fixed\n\n* Sorting on binary Data was done by comparing bytes as signed char rather than\n  unsigned char, resulting in very strange orders (since sorting on Data was\n  enabled in v6.0.4)\n* Sorting on AnyRealmValue did not use a valid total ordering, and certain\n  combinations of values could result in values not being sorted or potentially\n  even crashes. The resolution for this will result in some previously-valid\n  combinations of values of different types being sorted in different orders\n  than previously (since the introduction of AnyRealmValue in 10.8.0).\n* RLMSet/MutableSet was inconsistent about if it considered a String and a Data\n  containing the utf-8 encoded bytes of that String to be equivalent. They are\n  now always considered distinct. (since the introduction of sets in v10.8.0).\n* Equality queries on a Mixed property with an index could sometimes return\n  incorrect results if values of different types happened to have the same hash\n  code. ([Core 6407](https://github.com/realm/realm-core/issues/6407) since v10.8.0).\n* Creating more than 8388606 links pointing to a single object would crash.\n  ([Core #6577](https://github.com/realm/realm-core/issues/6577), since v5.0.0)\n* A Realm generated on a non-apple ARM 64 device and copied to another platform\n  (and vice-versa) were non-portable due to a sorting order difference. This\n  impacts strings or binaries that have their first difference at a non-ascii\n  character. These items may not be found in a set, or in an indexed column if\n  the strings had a long common prefix (> 200 characters).\n  ([Core #6670](https://github.com/realm/realm-core/pull/6670), since 2.0.0 for indexes, and since since the introduction of sets in v10.8.0)\n* Fix a spurious crash related to opening a Realm on background thread while\n  the process was in the middle of exiting ([Core #7420](https://github.com/realm/realm-core/pull/7420)).\n\n### Breaking Changes\n\n* Drop support for opening pre-v5.0.0 Realm files.\n\n### Compatibility\n\n* Realm Studio: 15.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.3.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.2-15.3.0. Note that we will be dropping support for Xcode 14 when\n  Apple begins requiring Xcode 15 for app store submissions on April 29.\n\n### Internal\n\n* Upgraded realm-core from 13.26.0 to 14.3.0\n\n10.48.1 Release notes (2024-03-15)\n=============================================================\n\n### Fixed\n\n* The Realm.framework privacy manifest was missing\n  NSPrivacyAccessedAPICategoryDiskSpace, but we check free disk space before\n  attempting to automatically back up Realm files (since 10.46.0).\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.3.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.2-15.3.0.\n\n10.48.0 Release notes (2024-03-07)\n=============================================================\n\n### Enhancements\n\n* Lifted a limitation that would prevent declaring a model with only computed\n  properties. ([#8414](https://github.com/realm/realm-swift/issues/8414))\n* Add Xcode 15.3 to the release package ([PR #8502](https://github.com/realm/realm-swift/pull/8502)).\n\n### Fixed\n\n* Fix multiple arguments support via the `REALM_EXTRA_BUILD_ARGUMENTS`\n  environment variable in `build.sh`. ([PR #8413](https://github.com/realm/realm-swift/pulls/8413)).\n  Thanks, [@hisaac](https://github.com/hisaac)!\n* Fix some of the new sendability warnings introduced in Xcode 15.3\n  ([PR #8502](https://github.com/realm/realm-swift/pull/8502)).\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.3.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.2-15.3.0.\n\n10.47.0 Release notes (2024-02-12)\n=============================================================\n\n### Enhancements\n\n* Added initial support for geospatial queries on points.\n  There is no new dedicated type to store Geospatial points, instead points should\n  be stored as ([GeoJson-shaped](https://www.mongodb.com/docs/manual/reference/geojson/))\n  embedded object, as the example below:\n  ```swift\n  public class Location: EmbeddedObject {\n    @Persisted private var coordinates: List<Double>\n    @Persisted private var type: String = \"Point\"\n\n    public var latitude: Double { return coordinates[1] }\n    public var longitude: Double { return coordinates[0] }\n\n    convenience init(_ latitude: Double, _ longitude: Double) {\n        self.init()\n        // Longitude comes first in the coordinates array of a GeoJson document\n        coordinates.append(objectsIn: [longitude, latitude])\n    }\n  }\n  ```\n  Geospatial queries (`geoWithin`) can only be executed on such a type of\n  objects and will throw otherwise. The queries can be used to filter objects\n  whose points lie within a certain area, using the following pre-established\n  shapes (`GeoBox`, `GeoPolygon`, `GeoCircle`).\n  ```swift\n  class Person: Object {\n    @Persisted var name: String\n    @Persisted var location: Location? // GeoJson embedded object\n  }\n\n  let realm = realmWithTestPath()\n  try realm.write {\n    realm.add(PersonLocation(name: \"Maria\", location: Location(latitude: 55.6761, longitude: 12.5683)))\n  }\n\n  let shape = GeoBox(bottomLeft: (55.6281, 12.0826), topRight: (55.6762, 12.5684))!\n  let locations = realm.objects(PersonLocation.self).where { $0.location.geoWithin(shape) })\n  ```\n  A `filter` or `NSPredicate` can be used as well to perform a Geospatial query.\n  ```swift\n  let shape = GeoPolygon(outerRing: [(-2, -2), (-2, 2), (2, 2), (2, -2), (-2, -2)], holes: [[(0, 0), (1, 1), (-1, 1), (0, 0)]])!\n  let locations = realm.objects(PersonLocation.self).filter(\"location IN %@\", shape)\n\n  let locations = realm.objects(PersonLocation.self).filter(NSPredicate(format: \"location IN %@\", shape))\n  ```\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.2.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.2-15.2.0.\n\n### Internal\n\n* Migrated Release pipelines to Github Actions.\n\n10.46.0 Release notes (2024-01-23)\n=============================================================\n\n### Enhancements\n\n* Add a privacy manifest to both frameworks.\n* Internal C++ symbols are no longer exported from Realm.framework when\n  installing via CocoaPods, which reduces the size of the binary by ~5%,\n  improves app startup time a little, and eliminates some warnings when linking\n  the framework. This was already the case when using Carthage or a prebuilt\n  framework ([PR #8464](https://github.com/realm/realm-swift/pull/8464)).\n* The `baseURL` field of `AppConfiguration` can now be updated, rather than the\n  value being persisted between runs of the application in the metadata\n  storage. ([Core #7201](https://github.com/realm/realm-core/issues/7201))\n* Allow in-memory synced Realms. This will allow setting an in-memory identifier on\n  a flexible sync realm.\n\n### Fixed\n\n* `@Persisted`'s Encodable implementation did not allow the encoder to\n  customize the encoding of values, which broke things like JSONEncoder's\n  `dateEncodingStrategy` ([#8425](https://github.com/realm/realm-swift/issues/8425)).\n* Fix running Package.swift on Linux to support tools like Dependabot which\n  need to build the package description but not the package itself\n  ([#8458](https://github.com/realm/realm-swift/issues/8458), since v10.40.1).\n\n### Breaking Changes\n\n* The `schemaVersion` field of `Realm.Configuration` must now always be zero\n  for synchronized Realms. Schema versions are currently not applicable to\n  synchronized Realms and the field was previously not read.\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.2.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.2-15.2.0.\n\n### Internal\n\n* Upgraded realm-core from 13.25.1 to 13.26.0\n\n10.45.3 Release notes (2024-01-08)\n=============================================================\n\n### Enhancements\n\n* Update release packaging for Xcode 15.2. Prebuilt binaries for 14.1 and 15.0\n  have now been dropped from the release package.\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.2.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.2-15.2.0.\n\n10.45.2 Release notes (2023-12-22)\n=============================================================\n\n### Enhancements\n\n* Greatly improve the performance of creating objects with a very large number\n  of pre-existing incoming links. This is primarily relevant to initial sync\n  bootstrapping when linking objects happen to be synchronized before the\n  target objects they link to ([Core #7217](https://github.com/realm/realm-core/issues/7217), since v10.0.0).\n\n### Fixed\n\n* Registering new notifications inside write transactions before actually\n  making any changes is now actually allowed. This was supposed to be allowed\n  in 10.39.1, but it did not actually work due to some redundant validation.\n* `SyncSession.ProgressDirection` and `SyncSession.ProgressMode` were missing\n  `Sendable` annotations ([PR #8435](https://github.com/realm/realm-swift/pull/8435)).\n* `Realm.Error.subscriptionFailed` was reported with the incorrect error\n  domain, making it impossible to catch (since v10.42.2, [PR #8435](https://github.com/realm/realm-swift/pull/8435)).\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.1.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.1-15.1.0.\n\n### Internal\n\n* Upgraded realm-core from 13.25.0 to 13.25.1\n\n10.45.1 Release notes (2023-12-18)\n=============================================================\n\n### Fixed\n\n* Exceptions thrown while applying the initial download for a sync subscription\n  change terminated the program rather than being reported to the sync error\n  handler ([Core #7196](https://github.com/realm/realm-core/issues/7196) and\n  [Core #7197](https://github.com/realm/realm-core/pull/7197)).\n* Calling `SyncSession.reconnect()` while a reconnect after a non-fatal error\n  was pending would result in an assertion failure mentioning\n  \"!m_try_again_activation_timer\" if another non-fatal error was received\n  ([Core #6961](https://github.com/realm/realm-core/issues/6961)).\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.1.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.1-15.1.0.\n\n### Internal\n\n* Upgraded realm-core from 13.24.1 to 13.25.0\n\n10.45.0 Release notes (2023-12-15)\n=============================================================\n\n### Enhancements\n\n* Update release packaging for Xcode 15.1.\n* Expose waiting for upload/download on SyncSession, which will suspend\n  the current method (or call an asynchronous block) until an upload or download\n  completes for a given sync session, e.g.,:\n  ```swift\n  try realm.write {\n    realm.add(Person())\n  }\n  try await realm.syncSession?.wait(for: .upload)\n  ```\n  Note that this should not generally be used– sync is eventually consistent\n  and should be used as such. However, there are special cases (notably in\n  testing) where this may be used.\n* Sync subscription change notifications are now cancelled if the sync session\n  becomes inactive as is done for upload and download progress handlers. If a\n  fatal sync error occurs it will be reported to the completion handler, and\n  if the user is logged out an \"operation cancelled\" error will be reported.\n  Non-fatal errors are unchanged (i.e. the sync client internally retries\n  without reporting errors). Previously fatal errors would result in the\n  completion handler never being called.\n  ([Core #7073](https://github.com/realm/realm-core/pull/7073))\n* Automatic client reset recovery now preserves the original division of\n  changesets, rather than combining all unsynchronized changes into a single\n  changeset. This will typically improve server-side performance when there are\n  a large number of recovered changes ([Core #7161](https://github.com/realm/realm-core/pull/7161)).\n* Automatic client reset recovery now does a better job of recovering changes\n  when changesets were downloaded from the server after the unuploaded local\n  changes were committed. If the local Realm happened to be fully up to date with\n  the server prior to the client reset, automatic recovery should now always\n  produce exactly the same state as if no client reset was involved\n  ([Core #7161](https://github.com/realm/realm-core/pull/7161)).\n\n### Fixed\n\n* Flexible sync subscriptions would sometimes not be sent to the server if they\n  were created while the client was downloading the bootstrap state for a\n  previous subscription change and the bootstrap did not complete successfully.\n  ([Core #7077](https://github.com/realm/realm-core/issues/7077), since v10.21.1)\n* Flexible sync subscriptions would sometimes not be sent to the server if an\n  UPLOAD message was sent immediately after the subscription was created.\n  ([Core #7076](https://github.com/realm/realm-core/issues/7076), since v10.43.1)\n* Creating or removing flexible sync subscriptions while a client reset with\n  automatic recovery enabled was being processed in the background would\n  occasionally crash with a `KeyNotFound` exception.\n  ([Core #7090](https://github.com/realm/realm-core/issues/7090), since v10.28.2)\n* Automatic client reset recovery would sometimes fail with the error \"Invalid\n  schema change (UPLOAD): cannot process AddColumn instruction for non-existent\n  table\" when recovering schema changes while made offline. This would only\n  occur if the server is using the recently introduced option to allow breaking\n  schema changes in developer mode. ([Core #7042](https://github.com/realm/realm-core/pull/7042)).\n* `MutableSet<String>.formIntersection()` would sometimes cause a\n  use-after-free if asked to intersect a set with itself (since v10.0.0).\n* Errors encountered while reapplying local changes for client reset recovery\n  on partition-based sync Realms would result in the client reset attempt not\n  being recorded, possibly resulting in an endless loop of attempting and\n  failing to automatically recover the client reset. Flexible sync and errors\n  from the server after completing the local recovery were handled correctly\n  ([Core #7149](https://github.com/realm/realm-core/pull/7149), since v10.0.0).\n* During a client reset with recovery when recovering a move or set operation\n  on a `List<Object>` or `List<AnyRealmValue>` that operated on indices that\n  were not also added in the recovery, links to an object which had been\n  deleted by another client while offline would be recreated by the recovering\n  client, but the objects of these links would only have the primary key\n  populated and all other fields would be default values. Now, instead of\n  creating these zombie objects, the lists being recovered skip such deleted\n  links. ([Core #7112](https://github.com/realm/realm-core/issues/7112),\n  since client reset recovery was implemented in v10.25.0).\n* During a client reset recovery a Set of links could be missing items, or an\n  exception could be thrown that prevents recovery (e.g. \"Requested index 1\n  calling get() on set 'source.collection' when max is 0\")\n  ([Core #7112](https://github.com/realm/realm-core/issues/7112),\n  since client reset recovery was implemented in v10.25.0).\n* Calling `sort()` or `distinct()` on a `MutableSet<Object>` that had\n  unresolved links in it (i.e. objects which had been deleted by a different\n  sync client) would produce a Results with duplicate entries.\n* Automatic client reset recovery would duplicate insertions in a list when\n  recovering a write which made an unrecoverable change to a list (i.e.\n  modifying or deleting a pre-existing entry), followed by a subscription\n  change, followed by a write which added an entry to the list\n  ([Core #7155](https://github.com/realm/realm-core/pull/7155), since the\n  introduction of automatic client reset recovery for flexible sync).\n* Fixed several causes of \"decryption failed\" exceptions that could happen when\n  opening multiple encrypted Realm files in the same process while using Realms\n  stored on an exFAT file system.\n  ([Core #7156](https://github.com/realm/realm-core/issues/7156), since v1.0.0)\n* Fixed deadlock which occurred when accessing the current user from the `App`\n  from within a callback from the `User` listener\n  ([Core #7183](https://github.com/realm/realm-core/issues/7183), since v10.42.0)\n* Having a class name of length 57 would make client reset crash as a limit of\n  56 was wrongly enforced (57 is the correct limit)\n  ([Core #7176](https://github.com/realm/realm-core/issues/7176), since v10.0.0)\n* Automatic client reset recovery on flexible sync Realms would apply recovered\n  changes in multiple write transactions, releasing the write lock in between.\n  This had several observable negative effects:\n  - Other threads reading from the Realm while a client reset was in progress\n    could observe invalid mid-reset state.\n  - Other threads could potentially write in the middle of a client reset,\n    resulting in history diverging from the server.\n  - The change notifications produced by client resets were not minimal and\n    would report that some things changed which actually didn't.\n  - All pending subscriptions were marked as Superseded and then recreating,\n    resulting in anything waiting for subscriptions to complete firing early.\n  ([Core #7161](https://github.com/realm/realm-core/pull/7161), since v10.29.0).\n* If the very first open of a flexible sync Realm triggered a client reset, the\n  configuration had an initial subscriptions callback, both before and after\n  reset callbacks, and the initial subscription callback began a read transaction\n  without ending it (which is normally going to be the case), opening the frozen\n  Realm for the after reset callback would trigger a BadVersion exception\n  ([Core #7161](https://github.com/realm/realm-core/pull/7161), since v10.29.0).\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.1.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.1-15.1.0.\n\n### Internal\n\n* Migrated our current CI Pipelines to Xcode Cloud.\n* Upgraded realm-core from 13.23.1 to 13.24.1\n\n10.44.0 Release notes (2023-10-29)\n=============================================================\n\n### Enhancements\n\n* Expose `SyncSession.reconnect()`, which requests an immediate reconnection if\n  the session is currently disconnected rather than waiting for the normal\n  reconnect delay.\n* Update release packaging for Xcode 15.1 beta. visionOS slices are now only\n  included for 15.1 rather than splicing them into the non-beta 15.0 release.\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.0.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.1-15.0.0.\n\n10.43.1 Release notes (2023-10-13)\n=============================================================\n\n### Enhancements\n\n* Empty commits no longer trigger an extra invocation of the sync progress\n  handler reporting the exact same information as the previous invocation\n  ([Core #7031](https://github.com/realm/realm-core/pull/7031)).\n\n### Fixed\n\n* Updating subscriptions did not trigger Realm autorefreshes, sometimes\n  resulting in Realm.asyncRefresh() hanging until another write was performed by\n  something else ([Core #7031](https://github.com/realm/realm-core/pull/7031)).\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.0.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.1-15.0.0.\n\n### Internal\n\n* Upgraded realm-core from 13.22.0 to 13.23.1\n\n10.43.0 Release notes (2023-09-29)\n=============================================================\n\n### Enhancements\n\n* Added `Results.subscribe` API for flexible sync.\n  Now you can subscribe and unsubscribe to a flexible sync subscription through an object `Result`.\n  ```swift\n  // Named subscription query\n  let results = try await realm.objects(Dog.self).where { $0.age > 18 }.subscribe(name: \"adults\")\n  results.unsubscribe()\n\n  // Unnamed subscription query\n  let results = try await realm.objects(Dog.self).subscribe()\n  results.unsubscribe()\n  ````\n\n  After committing the subscription to the realm's local subscription set, the method\n  will wait for downloads according to the `WaitForSyncMode`.\n  ```swift\n  let results = try await realm.objects(Dog.self).where { $0.age > 1 }.subscribe(waitForSync: .always)\n  ```\n  Where `.always` will always download the latest data for the subscription, `.onCreation` will do\n  it only the first time the subscription is created, and `.never` will never wait for the\n  data to be downloaded.\n\n  This API is currently in `Preview` and may be subject to changes in the future.\n* Added a new API which allows to remove all the unnamed subscriptions from the subscription set.\n  ```swift\n  realm.subscriptions.removeAll(unnamedOnly: true)\n  ```\n\n### Fixed\n\n* Build the prebuilt libraries with the classic linker to work around the new\n  linker being broken on iOS <15. When using CocoaPods or SPM, you will need to\n  manually add `-Wl,-ld_classic` to `OTHER_LDFLAGS` for your application until\n  Apple fixes the bug.\n* Remove the visionOS slice from the Carthage build as it makes Carthage reject\n  the xcframework ([#8370](https://github.com/realm/realm-swift/issues/8370)).\n* Permission errors when creating asymmetric objects were not handled\n  correctly, leading to a crash ([Core #6978](https://github.com/realm/realm-core/issues/6978), since 10.35.0)\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.0.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.1-15.0.0.\n\n### Internal\n\n* Upgraded realm-core from 13.21.0 to 13.22.0\n\n10.42.4 Release notes (2023-09-25)\n=============================================================\n\n### Enhancements\n\n* Asymmetric objects are now allowed to link to non-embedded, non-asymmetric\n  objects. ([Core #6981](https://github.com/realm/realm-core/pull/6981))\n\n### Fixed\n\n* The Swift package failed to link some required system libraries when building\n  for Catalyst, potentially resulting in linker errors if the application did\n  not pull them in (since v10.40.1)\n* Logging into a single user using multiple auth providers created a separate\n  SyncUser per auth provider. This mostly worked, but had some quirks:\n  - Sync sessions would not necessarily be associated with the specific\n    SyncUser used to create them. As a result, querying a user for its sessions\n    could give incorrect results, and logging one user out could close the wrong\n    sessions.\n  - Removing one of the SyncUsers would delete all local Realm files for all\n    SyncUsers for that user.\n  - Deleting the server-side user via one of the SyncUsers left the other\n    SyncUsers in an invalid state.\n  - A SyncUser which was originally created via anonymous login and then linked\n    to an identity would still be treated as an anonymous users and removed\n    entirely on logout.\n    ([Core #6837](https://github.com/realm/realm-core/pull/6837), since v10.0.0)\n* Reading existing logged-in users on app startup from the sync metadata Realm\n  performed three no-op writes per user on the metadata Realm\n  ([Core #6837](https://github.com/realm/realm-core/pull/6837), since v10.0.0).\n* If a user was logged out while an access token refresh was in progress, the\n  refresh completing would mark the user as logged in again and the user would\n  be in an inconsistent state ([Core #6837](https://github.com/realm/realm-core/pull/6837), since v10.0.0).\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.0.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.1-15.0.0.\n\n### Internal\n\n* Upgraded realm-core from 13.20.1 to 13.21.0\n* The schema version of the metadata Realm used to cache logged in users has\n  been bumped. Upgrading is handled automatically, but downgrading from this\n  version to older versions will result in cached logins being discarded.\n\n10.42.3 Release notes (2023-09-18)\n=============================================================\n\n### Enhancements\n\n* Update packaging for the Xcode 15.0 release. Carthage release and obj-c\n  binaries are now built with Xcode 15.\n\n### Fixed\n\n* The prebuilt Realm.xcframework for SPM was packaged incorrectly and did not\n  work ([#8361](https://github.com/realm/realm-swift/issues/8361), since v10.42.1).\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 15.0.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.1-15.0.0.\n\n10.42.2 Release notes (2023-09-13)\n=============================================================\n\n### Enhancements\n\n* Add support for logging messages sent by the server.\n  ([Core #6476](https://github.com/realm/realm-core/pull/6476))\n* Unknown protocol errors received from the baas server will no longer cause\n  the application to crash if a valid error action is also received. Unknown\n  error actions will be treated as an ApplicationBug error action and will\n  cause sync to fail with an error via the sync error handler.\n  ([Core #6885](https://github.com/realm/realm-core/pull/6885))\n* Some sync error messages now contain more information about what went wrong.\n\n### Fixed\n\n* The `MultipleSyncAgents` exception from opening a synchronized Realm in\n  multiple processes at once no longer leaves the sync client in an invalid\n  state. ([Core #6868](https://github.com/realm/realm-core/pull/6868), since v10.36.0)\n* Testing the size of a collection of links against zero would sometimes fail\n  (sometimes = \"difficult to explain\"). In particular:\n  ([Core #6850](https://github.com/realm/realm-core/issues/6850), since v10.41.0)\n* When async writes triggered a file compaction some internal state could be\n  corrupted, leading to later crashes in the slab allocator. This typically\n  resulted in the \"ref + size <= next->first\" assertion failure, but other\n  failures were possible. Many issues reported; see [Core #6340](https://github.com/realm/realm-core/issues/6340).\n  (since 10.35.0)\n* `Realm.Configuration.maximumNumberOfActiveVersions` now handles intermediate\n  versions which have been cleaned up correctly and checks the number of live\n  versions rather than the number of versions between the oldest live version\n  and current version (since 10.35.0).\n* If the client disconnected between uploading a change to flexible sync\n  subscriptions and receiving the new object data from the server resulting\n  from that subscription change, the next connection to the server would\n  sometimes result in a client reset\n  ([Core #6966](https://github.com/realm/realm-core/issues/6966), since v10.21.1).\n\n### Deprecations\n\n* `RLMApp` has `localAppName` and `localAppVersion` fields which never ended up\n  being used for anything and are now deprecated.\n* `RLMSyncAuthError` has not been used since v10.0.0 and is now deprecated.\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.3.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.1-15 beta 7.\n\n### Internal\n\n* Upgraded realm-core from 13.17.1 to 13.20.1\n\n10.42.1 Release notes (2023-08-28)\n=============================================================\n\n### Fixed\n\n* The names of the prebuilt zips for SPM have changed to avoid having Carthage\n  download them instead of the intended Carthage zip\n  ([#8326](https://github.com/realm/realm-swift/issues/8326), since v10.42.0).\n* The prebuild Realm.xcframework for SwiftPM now has all platforms other than\n  visionOS built with Xcode 14 to comply with app store rules\n  ([#8339](https://github.com/realm/realm-swift/issues/8339), since 10.42.0).\n* Fix visionOS compilation with Xcode beta 7.\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.3.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.1-15 beta 7.\n\n10.42.0 Release notes (2023-07-30)\n=============================================================\n\n### Enhancements\n\n* Add support for building for visionOS and add Xcode 15 binaries to the\n  release package. visionOS currently requires installing Realm via either\n  Swift Package Manager or by using a XCFramework as CocoaPods and Carthage do\n  not yet support it.\n* Zips compatible with SPM's `.binaryTarget()` are now published as part of the\n  releases on Github.\n* Prebuilt XCFrameworks are now built with LTO enabled. This has insignificant\n  performance benefits, but cuts the size of the library by ~15%.\n\n### Fixed\n\n* Fix nested properties observation on a `Projections` not notifying when there is a property change.\n  ([#8276](https://github.com/realm/realm-swift/issues/8276), since v10.34.0).\n* Fix undefined symbol error for `UIKit` when linking Realm to a framework using SPM.\n  ([#8308](https://github.com/realm/realm-swift/issues/8308), since v10.41.0)\n* If the app crashed at exactly the wrong time while opening a freshly\n  compacted Realm the file could be left in an invalid state\n  ([Core #6807](https://github.com/realm/realm-core/pull/6807), since v10.33.0).\n* Sync progress for DOWNLOAD messages was sometimes stored incorrectly,\n  resulting in an extra round trip to the server.\n  ([Core #6827](https://github.com/realm/realm-core/issues/6827), since v10.31.0)\n\n### Breaking Changes\n\n* Legacy non-xcframework Carthage installations are no longer supported. Please\n  ensure you are using `--use-xcframeworks` if installing via Carthage.\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.3.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.1-15 beta 5.\n\n### Internal\n\n* Upgraded realm-core from 13.17.0 to 13.17.1\n* Release packages were being uploaded to several static.realm.io URLs which\n  are no longer linked to anywhere. These are no longer being updated, and\n  release packages are now only being uploaded to Github.\n\n10.41.1 Release notes (2023-07-17)\n=============================================================\n\n### Enhancements\n\n* Filesystem errors now include more information in the error message.\n* Sync connection and session reconnect timing/backoff logic has been reworked\n  and unified into a single implementation. Previously some categories of errors\n  would cause an hour-long wait before attempting to reconnect, while others\n  would use an exponential backoff strategy. All errors now result in the sync\n  client waiting for 1 second before retrying, doubling the wait after each\n  subsequent failure up to a maximum of five minutes. If the cause of the error\n  changes, the backoff will be reset. If the sync client voluntarily disconnects,\n  no backoff will be used. ([Core #6526]((https://github.com/realm/realm-core/pull/6526)))\n\n### Fixed\n\n* Removed warnings for deprecated APIs internal use.\n  ([#8251](https://github.com/realm/realm-swift/issues/8251), since v10.39.0)\n* Fix an error during async open and client reset if properties have been added\n  to the schema. This fix also applies to partition-based to flexible sync\n  migration if async open is used. ([Core #6707](https://github.com/realm/realm-core/issues/6707), since v10.28.2)\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.3.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.1-15 beta 4.\n\n### Internal\n\n* Upgraded realm-core from 13.15.1 to 13.17.0\n* The location where prebuilt core binaries are published has changed slightly.\n  If you are using `REALM_BASE_URL` to mirror the binaries, you may need to\n  adjust your mirroring logic.\n\n10.41.0 Release notes (2023-06-26)\n=============================================================\n\n### Enhancements\n\n* Add support for multiplexing sync connections. When enabled (the default), a single\n  connection is used per sync user rather than one per synchronized Realm. This\n  reduces resource consumption when multiple Realms are opened and will\n  typically improve performance ([PR #8282](https://github.com/realm/realm-swift/pull/8282)).\n* Sync timeout options can now be set on `RLMAppConfiguration` along with the\n  other app-wide configuration settings ([PR #8282](https://github.com/realm/realm-swift/pull/8282)).\n\n### Fixed\n\n* Import as `RLMRealm_Private.h` as a module would cause issues when using Realm as a subdependency.\n  ([#8164](https://github.com/realm/realm-swift/issues/8164), since 10.37.0)\n* Disable setting a custom logger by default on the sync client when the sync manager is created.\n  This was overriding the default logger set using `RLMLogger.defaultLogger`. (since v10.39.0).\n\n### Breaking Changes\n\n* The `RLMSyncTimeouts.appConfiguration` property has been removed. This was an\n  unimplemented read-only property which did not make any sense on the\n  containing type ([PR #8282](https://github.com/realm/realm-swift/pull/8282)).\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.3.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.1-15 beta 2.\n\n### Internal\n\n* Upgraded realm-core from 13.15.0 to 13.15.1\n\n10.40.2 Release notes (2023-06-09)\n=============================================================\n\n### Enhancements\n\n* `Actor.preconditionIsolated()` is now used for runtime actor checking when\n  available (i.e. building with Xcode 15 and running on iOS 17) rather than the\n  less reliable workaround.\n\n### Fixed\n\n* If downloading the fresh Realm file failed during a client reset on a\n  flexible sync Realm, the sync client would crash the next time the Realm was\n  opened. ([Core #6494](https://github.com/realm/realm-core/issues/6494), since v10.28.2)\n* If the order of properties in the local class definitions did not match the\n  order in the server-side schema, the before-reset Realm argument passed to a\n  client reset handler would have an invalid schema and likely crash if any\n  data was read from it. ([Core #6693](https://github.com/realm/realm-core/issues/6693), since v10.40.0)\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.3.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.1-15 beta 1.\n\n### Internal\n\n* Upgraded realm-core from 13.13.0 to 13.15.0.\n* The prebuilt library used for CocoaPods installations is now built with Xcode\n  14. This should not have any observable effects other than the download being\n  much smaller due to no longer including bitcode.\n\n10.40.1 Release notes (2023-06-06)\n=============================================================\n\n### Enhancements\n\n* Fix compilation with Xcode 15. Note that iOS 12 is the minimum supported\n  deployment target when using Xcode 15.\n* Switch to building the Carthage release with Xcode 14.3.1.\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.3.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.1-15 beta 1.\n\n### Internal\n\n* Overhauled SDK metrics collection to better drive future development efforts.\n\n10.40.0 Release notes (2023-05-26)\n=============================================================\n\nDrop support for Xcode 13 and add Xcode 14.3.1. Xcode 14.1 is now the minimum\nsupported version.\n\n### Enhancements\n\n* Adjust the error message for private `Object` subclasses and subclasses\n  nested inside other types to explain how to make them work rather than state\n  that it's impossible. ([#5662](https://github.com/realm/realm-cocoa/issues/5662)).\n* Improve performance of SectionedResults. With a single section it is now ~10%\n  faster, and the runtime of sectioning no longer scales significantly with\n  section count, giving >100% speedups when there are large numbers of sections\n  ([Core #6606](https://github.com/realm/realm-core/pull/6606)).\n* Very slightly improve performance of runtime thread checking on the main\n  thread. ([Core #6606](https://github.com/realm/realm-core/pull/6606))\n\n### Fixed\n\n* Allow support for implicit boolean queries on Swift's Type Safe Queries API\n  ([#8212](https://github.com/realm/realm-swift/issues/8212)).\n* Fixed a fatal error (reported to the sync error handler) during client reset\n  or automatic partition-based to flexible sync migration if the reset has been\n  triggered during an async open and the schema being applied has added new\n  classes. Due to this bug automatic flexibly sync migration has been disabled\n  for older releases and this is now the minimum version required.\n  ([#6601](https://github.com/realm/realm-core/issues/6601), since automatic\n  client resets were introduced in v10.25.0)\n* Dictionaries sometimes failed to map unresolved links to nil. If the target\n  of a link in a dictionary was deleted by another sync client, reading that\n  field from the dictionary would sometimes give an invalid object rather than\n  nil. In addition, queries on dictionaries would sometimes have incorrect\n  results. ([Core #6644](https://github.com/realm/realm-core/pull/6644), since v10.8.0)\n* Older versions of Realm would sometimes fail to properly mark objects as\n  being the target of an incoming link from another object. When this happened,\n  deleting the target object would hit an assertion failure due to the\n  inconsistent state. We now reconstruct a valid state rather than crashing.\n  ([Core #6585](https://github.com/realm/realm-core/issues/6585), since v5.0.0)\n* Fix several UBSan failures which did not appear to result in functional bugs\n  ([Core #6649](https://github.com/realm/realm-core/pull/6649)).\n* Using both synchronous and asynchronous transactions on the same thread or\n  scheduler could hit the assertion failure \"!realm.is_in_transaction()\" if one\n  of the callbacks for an asynchronous transaction happened to be scheduled\n  during a synchronous transaction\n  ([Core #6659](https://github.com/realm/realm-core/issues/6659), since v10.26.0)\n* The stored deployment location for Apps was not being updated correctly after\n  receiving a redirect response from the server, resulting in every connection\n  attempting to connect to the old URL and getting redirected rather than only\n  the first connection after the deployment location changed.\n  ([Core #6630](https://github.com/realm/realm-core/issues/6630), since v10.38.2)\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.3.\n* CocoaPods: 1.10 or later.\n* Xcode: 14.1-14.3.1.\n\n### Internal\n\n* Upgraded realm-core from 13.10.1 to 13.13.0.\n\n10.39.1 Release notes (2023-05-05)\n=============================================================\n\n### Enhancements\n\n* New notifiers can now be registered in write transactions until changes have\n  actually been made in the write transaction. This makes it so that new\n  notifications can be registered inside change notifications triggered by\n  beginning a write transaction (unless a previous callback performed writes).\n  ([#4818](https://github.com/realm/realm-swift/issues/4818)).\n* Reduce the memory footprint of an automatic (discard or recover) client reset\n  when there are large incoming changes from the server.\n  ([Core #6567](https://github.com/realm/realm-core/issues/6567)).\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.3.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.4-14.3.\n\n### Internal\n\n* Upgraded realm-core from 13.10.0 to 13.10.1.\n\n10.39.0 Release notes (2023-05-03)\n=============================================================\n\n### Enhancements\n\n* Add support for actor-isolated Realms, opened with `try await Realm(actor: actor)`.\n\n  Rather than being confined to the current thread or a dispatch queue,\n  actor-isolated Realms are isolated to an actor. This means that they can be\n  used from any thread as long as it's within a function isolated to that\n  actor, and they remain valid over suspension points where a task may hop\n  between threads. Actor-isolated Realms can be used with either global or\n  local actors:\n\n  ```swift\n  @MainActor function mainThreadFunction() async throws {\n      // These are identical: the async init continues to produce a\n      // MainActor-confined Realm if no actor is supplied\n      let realm1 = try await Realm()\n      let realm2 = try await Realm(MainActor.shared)\n  }\n\n  // A simple example of a custom global actor\n  @globalActor actor BackgroundActor: GlobalActor {\n      static var shared = BackgroundActor()\n  }\n\n  @BackgroundActor backgroundThreadFunction() async throws {\n      // Explicitly specifying the actor is required for everything but MainActor\n      let realm = try await Realm(actor: BackgroundActor.shared)\n      try await realm.write {\n          _ = realm.create(MyObject.self)\n      }\n      // Thread-confined Realms would sometimes throw an exception here, as we\n      // may end up on a different thread after an `await`\n      print(\"\\(realm.objects(MyObject.self).count)\")\n  }\n\n  actor MyActor {\n      // An implicitly-unwrapped optional is used here to let us pass `self` to\n      // `Realm(actor:)` within `init`\n      var realm: Realm!\n      init() async throws {\n          realm = try await Realm(actor: self)\n      }\n\n      var count: Int {\n          realm.objects(MyObject.self).count\n      }\n\n      func create() async throws {\n          try await realm.asyncWrite {\n              realm.create(MyObject.self)\n          }\n      }\n  }\n\n  // This function isn't isolated to the actor, so each operation has to be async\n  func createObjects() async throws {\n      let actor = try await MyActor()\n      for _ in 0..<5 {\n        await actor.create()\n      }\n      print(\"\\(await actor.count)\")\n  }\n\n  // In an isolated function, an actor-isolated Realm can be used synchronously\n  func createObjects(in actor: isolated MyActor) async throws {\n      await actor.realm.write {\n          actor.realm.create(MyObject.self)\n      }\n      print(\"\\(actor.realm.objects(MyObject.self).count)\")\n  }\n  ```\n\n  Actor-isolated Realms come with a more convenient syntax for asynchronous\n  writes. `try await realm.write { ... }` will suspend the current task,\n  acquire the write lock without blocking the current thread, and then invoke\n  the block. The actual data is then written to disk on a background thread,\n  and the task is resumed once that completes. As this does not block the\n  calling thread while waiting to write and does not perform i/o on the calling\n  thread, this will often be safe to use from `@MainActor` functions without\n  blocking the UI. Sufficiently large writes may still benefit from being done\n  on a background thread.\n\n  Asynchronous writes are only supported for actor-isolated Realms or in\n  `@MainActor` functions.\n\n  Actor-isolated Realms require Swift 5.8 (Xcode 14.3). Enabling both strict\n  concurrency checking (`SWIFT_STRICT_CONCURRENCY=complete` in Xcode) and\n  runtime actor data race detection (`OTHER_SWIFT_FLAGS=-Xfrontend\n  -enable-actor-data-race-checks`) is strongly recommended when using\n  actor-isolated Realms.\n* Add support for automatic partition-based to flexible sync migration.\n  Connecting to a server-side app configured to use flexible sync with a\n  client-side partition-based sync configuration is now supported, and will\n  automatically create the appropriate flexible sync subscriptions to subscribe\n  to the requested partition. This allows changing the configuration on the\n  server from partition-based to flexible without breaking existing clients.\n  ([Core #6554](https://github.com/realm/realm-core/issues/6554))\n* Now you can use an array `[[\"_id\": 1], [\"breed\": 0]]` as sorting option for a\n  MongoCollection. This new API fixes the issue where the resulting documents\n  when using more than one sort parameter were not consistent between calls.\n  ([#7188](https://github.com/realm/realm-swift/issues/7188), since v10.0.0).\n* Add support for adding a user created default logger, which allows implementing your own logging logic\n  and the log threshold level.\n  You can define your own logger creating an instance of `Logger` and define the log function which will be\n  invoked whenever there is a log message.\n\n  ```swift\n  let logger = Logger(level: .all) { level, message in\n     print(\"Realm Log - \\(level): \\(message)\")\n  }\n  ```\n\n  Set this custom logger as Realm default logger using `Logger.shared`.\n   ```swift\n  Logger.shared = logger\n   ```\n* It is now possible to change the default log threshold level at any point of the application's lifetime.\n  ```swift\n  Logger.shared.logLevel = .debug\n  ```\n  This will override the log level set anytime before by a user created logger.\n* We have set `.info` as the default log threshold level for Realm. You will now see some\n  log message in your console. To disable use `Logger.shared.level = .off`.\n\n### Fixed\n\n* Several schema initialization functions had incorrect `@MainActor`\n  annotations, resulting in runtime warnings if the first time a Realm was\n  opened was on a background thread\n  ([#8222](https://github.com/realm/realm-swift/issues/8222), since v10.34.0).\n\n### Deprecations\n\n* `App.SyncManager.logLevel` and `App.SyncManager.logFunction` are deprecated in favour of\n  setting a default logger.\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.3.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.4-14.3.\n\n### Internal\n\n* Upgraded realm-core from v13.9.4 to v13.10.0.\n\n10.38.3 Release notes (2023-04-28)\n=============================================================\n\n### Enhancements\n\n* Improve performance of cancelling a write transactions after making changes.\n  If no KVO observers are used this is now constant time rather than taking\n  time proportional to the number of changes to be rolled back. Cancelling a\n  write transaction with KVO observers is 10-20% faster. ([Core PR #6513](https://github.com/realm/realm-core/pull/6513)).\n\n### Fixed\n\n* Performing a large number of queries without ever performing a write resulted\n  in steadily increasing memory usage, some of which was never fully freed due\n  to an unbounded cache ([#7978](https://github.com/realm/realm-swift/issues/7978), since v10.27.0).\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.3.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.4-14.3.\n\n### Internal\n\n* Upgraded realm-core from 13.9.3 to 13.9.4\n\n10.38.2 Release notes (2023-04-25)\n=============================================================\n\n### Enhancements\n\n* Improve performance of equality queries on a non-indexed AnyRealmValue\n  property by about 30%. ([Core #6506](https://github.com/realm/realm-core/issues/6506))\n\n### Fixed\n\n* SSL handshake errors were treated as fatal errors rather than errors which\n  should be retried. ([Core #6434](https://github.com/realm/realm-core/issues/6434), since v10.35.0)\n\n### Compatibility\n\n* Realm Studio: 14.0.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.3.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.4-14.3.\n\n### Internal\n\n* Upgraded realm-core from 13.9.0 to 13.9.3.\n\n10.38.1 Release notes (2023-04-25)\n=============================================================\n\n### Fixed\n\n* The error handler set on EventsConfiguration was not actually used (since v10.26.0).\n\n### Compatibility\n\n* Realm Studio: 13.0.2 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.3.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.4-14.3.\n\n10.38.0 Release notes (2023-03-31)\n=============================================================\n\nSwitch to building the Carthage release with Xcode 14.3.\n\n### Enhancements\n\n* Add Xcode 14.3 binaries to the release package. Note that CocoaPods 1.12.0\n  does not support Xcode 14.3.\n* Add support for sharing encrypted Realms between multiple processes.\n  ([Core #1845](https://github.com/realm/realm-core/issues/1845))\n\n### Fixed\n\n* Fix a memory leak reported by Instruments on `URL.path` in\n  `Realm.Configuration.fileURL` when using a string partition key in Partition\n  Based Sync ([#8195](https://github.com/realm/realm-swift/pull/8195)), since v10.0.0).\n* Fix a data race in version management. If one thread committed a write\n  transaction which increased the number of live versions above the previous\n  highest seen during the current session at the same time as another thread\n  began a read, the reading thread could read from a no-longer-valid memory\n  mapping. This could potentially result in strange crashes when opening,\n  refreshing, freezing or thawing a Realm\n  ([Core #6411](https://github.com/realm/realm-core/pull/6411), since v10.35.0).\n\n### Compatibility\n\n* Realm Studio: 13.0.2 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.3.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.4-14.3.\n\n### Internal\n\n* Upgraded realm-core from 13.8.0 to 13.9.0.\n\n10.37.2 Release notes (2023-03-29)\n=============================================================\n\n### Fixed\n\n* Copying a `RLMRealmConfiguration` failed to copy several fields. This\n  resulted in migrations being passed the incorrect object type in Swift when\n  using the default configuration (since v10.34.0) or async open (since\n  v10.37.0). This also broke using the Events API in those two scenarios (since\n  v10.26.0 for default configuration and v10.37.0 for async open). ([#8190](https://github.com/realm/realm-swift/issues/8190))\n\n### Compatibility\n\n* Realm Studio: 13.0.2 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.2.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.3-14.2.\n\n10.37.1 Release notes (2023-03-27)\n=============================================================\n\n### Enhancements\n\n* Performance improvement for the following queries ([Core #6376](https://github.com/realm/realm-core/issues/6376)):\n    * Significant (~75%) improvement when counting (`Results.count`) the number\n      of exact matches (with no other query conditions) on a\n      string/int/UUID/ObjectID property that has an index. This improvement\n      will be especially noticiable if there are a large number of results\n      returned (duplicate values).\n    * Significant (~99%) improvement when querying for an exact match on a Date\n      property that has an index.\n    * Significant (~99%) improvement when querying for a case insensitive match\n      on an AnyRealmValue property that has an index.\n    * Moderate (~25%) improvement when querying for an exact match on a Bool\n      property that has an index.\n    * Small (~5%) improvement when querying for a case insensitive match on an\n      AnyRealmValue property that does not have an index.\n\n### Fixed\n\n* Add missing `@Sendable` annotations to several sync and app services related\n  callbacks ([PR #8169](https://github.com/realm/realm-swift/pull/8169), since v10.34.0).\n* Fix some bugs in handling task cancellation for async Realm init. Some very\n  specific timing windows could cause crashes, and the download would not be\n  cancelled if the Realm was already open ([PR #8178](https://github.com/realm/realm-swift/pull/8178), since v10.37.0).\n* Fix a crash when querying an AnyRealmValue property with a string operator\n  (contains/like/beginswith/endswith) or with case insensitivity.\n  ([Core #6376](https://github.com/realm/realm-core/issues/6376), since v10.8.0)\n* Querying for case-sensitive equality of a string on an indexed AnyRealmValue\n  property was returning case insensitive matches. For example querying for\n  `myIndexedAny == \"Foo\"` would incorrectly match on values of \"foo\" or \"FOO\" etc.\n  ([Core #6376](https://github.com/realm/realm-core/issues/6376), since v10.8.0)\n* Adding an index to an AnyRealmValue property when objects of that type\n  already existed would crash with an assertion.\n  ([Core #6376](https://github.com/realm/realm-core/issues/6376), since v10.8.0).\n* Fix a bug that may have resulted in arrays being in different orders on\n  different devices. Some cases of “Invalid prior_size” may be fixed too.\n  ([Core #6191](https://github.com/realm/realm-core/issues/6191), since v10.25.0).\n\n### Compatibility\n\n* Realm Studio: 13.0.2 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.2.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.3-14.2.\n\n### Internal\n\n* Upgraded realm-core from 13.6.0 to 13.8.0\n\n10.37.0 Release notes (2023-03-09)\n=============================================================\n\n### Enhancements\n\n* `MongoCollection.watch().subscribe(on:)` now supports any swift Scheduler\n  rather than only dispatch queues ([PR #8131](https://github.com/realm/realm-swift/pull/8130)).\n* Add an async sequence wrapper for `MongoCollection.watch()`, allowing you to\n  do `for try await change in collection.changeEvents { ... }`\n  ([PR #8131](https://github.com/realm/realm-swift/pull/8130)).\n* The internals of error handling and reporting have been significantly\n  reworked. The visible effects of this are that some errors which previously\n  had unhelpful error messages now include more detail about what went wrong,\n  and App errors now expose a much more complete set of error codes\n  ([PR #8002](https://github.com/realm/realm-swift/pull/8002)).\n* Expose compensating write error information. When the server rejects a\n  modification made by the client (such as if the user does not have the\n  required permissions), a `SyncError` is delivered to the sync error handler\n  with the code `.writeRejected` and a non-nil `compensatingWriteInfo` field\n  which contains information about what was rejected and why. This information\n  is intended primarily for debugging and logging purposes and may not have a\n  stable format. ([PR #8002](https://github.com/realm/realm-swift/pull/8002))\n* Async `Realm.init()` now handles Task cancellation and will cancel the async\n  open if the Task is cancelled ([PR #8148](https://github.com/realm/realm-swift/pull/8148)).\n* Cancelling async opens now has more consistent behavior. The previously\n  intended and documented behavior was that cancelling an async open would\n  result in the callback associated with the specific task that was cancelled\n  never being called, and all other pending callbacks would be invoked with an\n  ECANCELED error. This never actually worked correctly, and the callback which\n  was not supposed to be invoked at all sometimes would be. We now\n  unconditionally invoke all of the exactly once, passing ECANCELED to all of\n  them ([PR #8148](https://github.com/realm/realm-swift/pull/8148)).\n\n### Fixed\n\n* `UserPublisher` incorrectly bounced all notifications to the main thread instead\n  of setting up the Combine publisher to correctly receive on the main thread.\n  ([#8132](https://github.com/realm/realm-swift/issues/8132), since 10.21.0)\n* Fix warnings when building with Xcode 14.3 beta 2.\n* Errors in async open resulting from invalid queries in `initialSubscriptions`\n  would result in the callback being invoked with both a non-nil Realm and a\n  non-nil Error even though the Realm was in an invalid state. Now only the\n  error is passed to the callback ([PR #8148](https://github.com/realm/realm-swift/pull/8148), since v10.28.0).\n* Converting a local realm to a synced realm would crash if an embedded object\n  was null ([Core #6294](https://github.com/realm/realm-core/issues/6294), since v10.22.0).\n* Subqueries on indexed properties performed extremely poorly. ([Core #6327](https://github.com/realm/realm-core/issues/6327), since v5.0.0)\n* Fix a crash when a SSL read successfully read a non-zero number of bytes and\n  also reported an error. ([Core #5435](https://github.com/realm/realm-core/issues/5435), since 10.0.0)\n* The sync client could get stuck in an infinite loop if the server sent an\n  invalid changeset which caused a transform error. This now results in a\n  client reset instead. ([Core #6051](https://github.com/realm/realm-core/issues/6051), since v10.0.0)\n* Strings in queries which contained any characters which required multiple\n  bytes when encoded as utf-8 were incorrectly encoded as binary data when\n  serializing the query to send it to the server for a flexible sync\n  subscription, resulting the server rejecting the query\n  ([Core #6350](https://github.com/realm/realm-core/issues/6350), since 10.22.0).\n\n### Compatibility\n\n* Realm Studio: 13.0.2 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.2.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.3-14.2.\n\n### Internal\n\n* Upgraded realm-core from 13.4.1 to 13.6.0\n\n10.36.0 Release notes (2023-02-15)\n=============================================================\n\n### Enhancements\n\n* Add support for multiple overlapping or nested event scopes.\n  `Events.beginScope()` now returns a `Scope` object which is used to commit or\n  cancel that scope, and if more than one scope is active at a time events are\n  reported to all active scopes.\n\n### Fixed\n\n* Fix moving `List` items to a higher index in SwiftUI results in wrong destination index\n  ([#7956](https://github.com/realm/realm-swift/issues/7956), since v10.6.0).\n* Using the `searchable` view modifier with `@ObservedResults` in iOS 16 would\n  cause the collection observation subscription to cancel.\n  ([#8096](https://github.com/realm/realm-swift/issues/8096), since 10.21.0)\n* Client reset with recovery would sometimes crash if the recovery resurrected\n  a dangling link ([Core #6292](https://github.com/realm/realm-core/issues/6292), since v10.32.0).\n\n### Compatibility\n\n* Realm Studio: 13.0.2 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.2.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.3-14.2.\n\n### Internal\n\n* Upgraded realm-core from 13.4.0 to 13.4.1\n\n10.35.1 Release notes (2023-02-10)\n=============================================================\n\n### Fixed\n\n* Client reset with recovery would crash if a client reset occurred the very\n  first time the Realm was opened with async open. The client reset callbacks\n  are now not called if the Realm had never been opened before\n  ([PR #8125](https://github.com/realm/realm-swift/pull/8125), since 10.32.0).\n\n### Compatibility\n\n* Realm Studio: 13.0.2 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.2.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.3-14.2.\n\n10.35.0 Release notes (2023-02-07)\n=============================================================\n\nThis version bumps the Realm file format version to 23. Realm files written by\nthis version cannot be read by older versions of Realm.\n\n### Enhancements\n\n* The Realm file is now automatically shrunk if the file size is larger than\n  needed to store all of the data. ([Core PR #5755](https://github.com/realm/realm-core/pull/5755))\n* Pinning old versions (either with frozen Realms or with Realms on background\n  threads that simply don't get refreshed) now only prevents overwriting the\n  data needed by that version, rather than the data needed by that version and\n  all later versions. In addition, frozen Realms no longer pin the transaction\n  logs used to drive change notifications. This mostly eliminates the file size\n  growth caused by pinning versions. ([Core PR #5440](https://github.com/realm/realm-core/pull/5440))\n* Rework how Dictionaries/Maps are stored in the Realm file. The new design uses\n  less space and is typically significantly faster. This changes the iteration\n  order of Maps, so any code relying on that may be broken. We continue\n  to make no guarantees about iteration order on Maps ([Core #5764](https://github.com/realm/realm-core/issues/5764)).\n* Improve performance of freezing Realms ([Core PR #6211](https://github.com/realm/realm-core/pull/6211)).\n\n### Fixed\n\n* Fix a crash when using client reset with recovery and flexible sync with a\n  single subscription ([Core #6070](https://github.com/realm/realm-core/issues/6070), since v10.28.2)\n* Encrypted Realm files could not be opened on devices with a larger page size\n  than the one which originally wrote the file.\n  ([#8030](https://github.com/realm/realm-swift/issues/8030), since v10.32.1)\n* Creating multiple flexible sync subscriptions at once could hit an assertion\n  failure if the server reported an error for any of them other than the last\n  one ([Core #6038](https://github.com/realm/realm-core/issues/6038), since v10.21.1).\n* `Set<AnyRealmValue>` and `List<AnyRealmValue>` considered a string and binary\n  data containing that string encoded as UTF-8 to be equivalent. This could\n  result in a List entry not changing type on assignment and for the client be\n  inconsistent with the server if a string and some binary data with equivalent\n  content was inserted from Atlas.\n  ([Core #4860](https://github.com/realm/realm-core/issues/4860) and\n  [Core #6201](https://github.com/realm/realm-core/issues/6201), since v10.8.0)\n* Querying for NaN on Decimal128 properties did not match any objects\n  ([Core #6182](https://github.com/realm/realm-core/issues/6182), since v10.8.0).\n* When client reset with recovery is used and the recovery did not need to\n  make any changes to the local Realm, the sync client could incorrectly think\n  the recovery failed and report the error \"A fatal error occured during client\n  reset: 'A previous 'Recovery' mode reset from <timestamp> did not succeed,\n  giving up on 'Recovery' mode to prevent a cycle'\".\n  ([Core #6195](https://github.com/realm/realm-core/issues/6195), since v10.32.0)\n* Fix a crash when using client reset with recovery and flexible sync with a\n  single subscription ([Core #6070](https://github.com/realm/realm-core/issues/6070), since v10.28.2)\n* Writing to newly in-view objects while a flexible sync bootstrap was in\n  progress would not synchronize those changes to the server\n  ([Core #5804](https://github.com/realm/realm-core/issues/5804), since v10.21.1).\n* If a client reset with recovery or discard local was interrupted while the\n  \"fresh\" realm was being downloaded, the sync client could crash with a\n  MultpleSyncAgents exception ([Core #6217](https://github.com/realm/realm-core/issues/6217), since v10.25.0).\n* Sharing Realm files between a Catalyst app and Realm Studio did not properly\n  synchronize access to the Realm file ([Core #6258](https://github.com/realm/realm-core/pull/6258), since v10.0.0).\n\n### Compatibility\n\n* Realm Studio: 13.0.2 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.2.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.3-14.2.\n\n### Internal\n\n* Upgraded realm-core from 12.13.0 to 13.4.0\n\n10.34.1 Release notes (2023-01-20)\n=============================================================\n\n### Fixed\n\n* Add some missing `@preconcurrency` annotations which lead to build failures\n  with Xcode 14.0 when importing via SPM or CocoaPods\n  ([#8104](https://github.com/realm/realm-swift/issues/8104), since v10.34.0).\n\n### Compatibility\n\n* Realm Studio: 11.0.0 - 12.0.0.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.2.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.3-14.2.\n\n10.34.0 Release notes (2023-01-13)\n=============================================================\n\nSwift 5.5 is no longer supported. Swift 5.6 (Xcode 13.3) is now the minimum\nsupported version.\n\nThe prebuilt binary for Carthage is now build with Xcode 14.2.\n\n### Enhancements\n\n* Improve performance of creating Projection objects and of change\n  notifications on projections ([PR #8050](https://github.com/realm/realm-swift/pull/8050)).\n* Allow initialising any sync configuration with `cancelAsyncOpenOnNonFatalErrors`.\n* Improve performance of Combine value publishers which do not use the\n  object/collection changesets a little.\n* All public types have been audited for sendability and are now marked as\n  Sendable when applicable. A few types which were incidentally not thread-safe\n  but make sense to use from multiple threads are now thread-safe.\n* Add support for building Realm with strict concurrency checking enabled.\n\n### Fixed\n\n* Fix bad memory access exception that can occur when watching change streams.\n  [PR #8039](https://github.com/realm/realm-swift/pull/8039).\n* Object change notifications on projections only included the first projected\n  property for each source property ([PR #8050](https://github.com/realm/realm-swift/pull/8050), since v10.21.0).\n* `@AutoOpen` failed to open flexible sync Realms while offline\n  ([#7986](https://github.com/realm/realm-swift/issues/7986), since v10.27.0).\n* Fix \"Publishing changes from within view updates is not allowed\" warnings\n  when using `@ObservedResults` or `@ObservedSectionedResults`\n  ([#7908](https://github.com/realm/realm-swift/issues/7908)).\n* Fix \"Publishing changes from within view updates is not allowed\" warnings\n  when using `@AutoOpen` or `@AsyncOpen`.\n  ([#7908](https://github.com/realm/realm-swift/issues/7908)).\n* Defer `Realm.asyncOpen` execution on `@AsyncOpen` and `@AutoOpen` property\n  wrappers until all the environment values are set. This will guarantee the\n  configuration and partition value are set set before opening the realm.\n  ([#7931](https://github.com/realm/realm-swift/issues/7931), since v10.12.0).\n* `@ObservedResults.remove()` could delete the wrong object if a write on a\n  background thread which changed the index of the object being removed\n  occurred at a very specific time (since v10.6.0).\n\n### Compatibility\n\n* Realm Studio: 11.0.0 - 12.0.0. 13.0.0 is currently incompatible.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.2.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.3-14.2.\n\n10.33.0 Release notes (2022-12-01)\n=============================================================\n\n### Enhancements\n\n* Flexible sync subscription state will change to\n  `SyncSubscriptionState.pending` (`RLMSyncSubscriptionStatePending`) while\n  waiting for the server to have sent all pending history after a bootstrap and\n  before marking a subscription as Complete.\n  ([#5795](https://github.com/realm/realm-core/pull/5795))\n* Add custom column names API, which allows to set a different column name in the realm\n  from the one used in your object declaration.\n  ```swift\n  class Person: Object {\n      @Persisted var firstName: String\n      @Persisted var birthDate: Date\n      @Persisted var age: Int\n\n      override class public func propertiesMapping() -> [String: String] {\n          [\"firstName\": \"first_name\",\n           \"birthDate\": \"birth_date\"]\n      }\n  }\n  ```\n  This is very helpful in cases where you want to name a property differently\n  from your `Device Sync` JSON schema.\n  This API is only available for old and modern object declaration syntax on the\n  `RealmSwift` SDK.\n* Flexible sync bootstraps now apply 1MB of changesets per write transaction\n  rather than applying all of them in a single write transaction.\n  ([Core PR #5999](https://github.com/realm/realm-core/pull/5999)).\n\n### Fixed\n\n* Fix a race condition which could result in \"operation cancelled\" errors being\n  delivered to async open callbacks rather than the actual sync error which\n  caused things to fail ([Core PR #5968](https://github.com/realm/realm-core/pull/5968), since the introduction of async open).\n* Fix database corruption issues which could happen if an application was\n  terminated at a certain point in the process of comitting a write\n  transaciton. ([Core PR #5993](https://github.com/realm/realm-core/pull/5993), since v10.21.1)\n* `@AsyncOpen` and `@AutoOpen` would begin and then cancel a second async open\n  operation ([PR #8038](https://github.com/realm/realm-swift/pull/8038), since v10.12.0).\n* Changing the search text when using the searchable SwiftUI extension would\n  trigger multiple updates on the View for each change\n  ([PR #8038](https://github.com/realm/realm-swift/pull/8038), since v10.19.0).\n* Changing the filter or search properties of an `@ObservedResults` or\n  `@ObservedSectionedResults` would trigger up to three updates on the View\n  ([PR #8038](https://github.com/realm/realm-swift/pull/8038), since v10.6.0).\n* Fetching a user's profile while the user logs out would result in an\n  assertion failure. ([Core PR #6017](https://github.com/realm/realm-core/issues/5571), since v10.8.0)\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.1-14.1.\n\n### Internal\n\n* Upgraded realm-core from 12.11.0 to 12.13.0\n\n10.32.3 Release notes (2022-11-10)\n=============================================================\n\n### Fixed\n\n* Fix name lookup errors when importing Realm Swift built in library evolution\n  mode (([#8014](https://github.com/realm/realm-swift/issues/8014)).\n* The prebuilt watchOS library in the objective-c release package was missing\n  an arm64 slice. The Swift release package was uneffected\n  ([PR #8016](https://github.com/realm/realm-swift/pull/8016)).\n* Fix issue where `RLMUserAPIKey.key`/`UserAPIKey.key` incorrectly returned the name of the API\n  key instead of the key itself. ([#8021](https://github.com/realm/realm-swift/issues/8021), since v10.0.0)\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.1-14.1.\n\n10.32.2 Release notes (2022-11-01)\n=============================================================\n\nSwitch to building the Carthage release with Xcode 14.1.\n\n### Fixed\n\n* Fix linker errors when building a release build with Xcode 14.1 when\n installing via SPM ([#7995](https://github.com/realm/realm-swift/issues/7995)).\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.1-14.1.\n\n10.32.1 Release notes (2022-10-25)\n=============================================================\n\n### Enhancements\n\n* Improve performance of client reset with automatic recovery and converting\n  top-level tables into embedded tables ([Core #5897](https://github.com/realm/realm-core/pull/5897)).\n* `Realm.Error` is now a typealias for `RLMError` rather than a\n  manually-defined version of what the automatic bridging produces. This should\n  have no effect on existing working code, but the manual definition was\n  missing a few things supplied by the automatic bridging.\n* Some sync errors sent by the server include a link to the server-side logs\n  associated with that error. This link is now exposed in the `serverLogURL`\n  property on `SyncError` (or `RLMServerLogURLKey` userInfo field when using NSError).\n\n### Fixed\n\n* Many sync and app errors were reported using undocumented internal error\n  codes and/or domains and could not be progammatically handled. Some notable\n  things which now have public error codes instead of unstable internal ones:\n  - `Realm.Error.subscriptionFailed`: The server rejected a flexible sync subscription.\n  - `AppError.invalidPassword`: A login attempt failed due to a bad password.\n  - `AppError.accountNameInUse`: A registration attempt failed due to the account name being in use.\n  - `AppError.httpRequestFailed`: A HTTP request to Atlas App Services\n    completed with an error HTTP code. The failing code is available in the\n    `httpStatusCode` property.\n  - Many other less common error codes have been added to `AppError`.\n  - All sync errors other than `SyncError.clientResetError` reported incorrect\n    error codes.\n  (since v10.0.0).\n* `UserAPIKey.objectId` was incorrectly bridged to Swift as `RLMObjectId` to\n  `ObjectId`. This may produce warnings about an unneccesary cast if you were\n  previously casting it to the correct type (since v10.0.0).\n* Fixed an assertion failure when observing change notifications on a sectioned\n  result, if the first modification was to a linked property that did not cause\n  the state of the sections to change.\n  ([Core #5912](https://github.com/realm/realm-core/issues/5912),\n  since the introduction of sectioned results in v10.29.0)\n* Fix a use-after-free if the last external reference to an encrypted\n  synchronized Realm was closed between when a client reset error was received\n  and when the download of the new Realm began.\n  ([Core #5949](https://github.com/realm/realm-core/pull/5949), since 10.28.4).\n* Fix an assertion failure during client reset with recovery when recovering\n  a list operation on an embedded object that has a link column in the path\n  prefix to the list from the top level object.\n  ([Core #5957](https://github.com/realm/realm-core/issues/5957),\n  since introduction of automatic recovery in v10.32.0).\n* Creating a write transaction which is rejected by the server due to it\n  exceeding the maximum transaction size now results in a client reset error\n  instead of synchronization breaking and becoming stuck forever\n  ([Core #5209](https://github.com/realm/realm-core/issues/5209), since v10).\n* Opening an unencrypted file with an encryption key would sometimes report a\n  misleading error message that indicated that the problem was something other\n  than a decryption failure ([Core #5915](https://github.com/realm/realm-core/pull/5915), since 0.89.0).\n* Fix a rare deadlock which could occur when closing a synchronized Realm\n  immediately after committing a write transaction when the sync worker thread\n  has also just finished processing a changeset from the server\n  ([Core #5948](https://github.com/realm/realm-core/pull/5948)).\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.0.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.1-14.1.\n\n### Internal\n\n* Upgraded realm-core from 12.9.0 to 12.11.0.\n\n10.32.0 Release notes (2022-10-10)\n=============================================================\n\n### Enhancements\n\n* Add `.recoverUnsyncedChanges` (`RLMClientResetModeRecoverUnsyncedChanges`) and\n`.recoverOrDiscardUnsyncedChanges` (`RLMClientResetModeRecoverOrDiscardUnsyncedChanges`) behaviors to `ClientResetMode` (`RLMClientResetMode`).\n  - The newly added recover modes function by downloading a realm which reflects the latest\n    state of the server after a client reset. A recovery process is run locally in an\n    attempt to integrate the server state with any local changes from before the\n    client reset occurred.\n    The changes are integrated with the following rules:\n    1. Objects created locally that were not synced before client reset, will be integrated.\n    2. If an object has been deleted on the server, but was modified on the client, the delete takes precedence and the update is discarded.\n    3. If an object was deleted on the client, but not the server, then the client delete instruction is applied.\n    4. In the case of conflicting updates to the same field, the client update is applied.\n  - The client reset process will fallback to `ClientResetMode.discardUnsyncedChanges` if the recovery process fails in `.recoverOrDiscardUnsyncedChanges`.\n  - The client reset process will fallback to `ClientResetMode.manual` if the recovery process fails in `.recoverUnsyncedChanges`.\n  - The two new swift recovery modes support client reset callbacks: `.recoverUnsyncedChanges(beforeReset: ((Realm) -> Void)? = nil, afterReset: ((Realm, Realm) -> Void)? = nil)`.\n  - The two new Obj-C recovery modes support client reset callbacks in `notifyBeforeReset`\n    and `notifyAfterReset`for both `[RLMUser configurationWithPartitionValue]` and `[RLMUser flexibleSyncConfigurationWithClientResetMode]`\n    For more detail on client reset callbacks, see `ClientResetMode`, `RLMClientResetBeforeBlock`,\n    `RLMClientResetAfterBlock`, and the 10.25.0 changelog entry.\n* Add two new additional interfaces to define a manual client reset handler:\n  - Add a manual callback handler to `ClientResetMode.manual` -> `ClientResetMode.manual(ErrorReportingBlock? = nil)`.\n  - Add the `RLMSyncConfiguration.manualClientResetHandler` property (type `RLMSyncErrorReportingBlock`).\n  - These error reporting blocks are invoked in the event of a `RLMSyncErrorClientResetError`.\n  - See `ErrorReportingBlock` (`RLMSyncErrorReportingBlock`), and `ClientResetInfo` for more detail.\n  - Previously, manual client resets were handled only through the `SyncManager.ErrorHandler`. You have the\n    option, but not the requirement, to define manual reset handler in these interfaces.\n    Otherwise, the `SyncManager.ErrorHandler` is still invoked during the manual client reset process.\n  - These new interfaces are only invoked during a `RLMSyncErrorClientResetError`. All other sync errors\n    are still handled in the `SyncManager.ErrorHandler`.\n  - See 'Breaking Changes' for information how these interfaces interact with an already existing\n    `SyncManager.ErrorHandler`.\n\n### Breaking Changes\n\n* The default `clientResetMode` (`RLMClientResetMode`) is switched from `.manual` (`RLMClientResetModeManual`)\n  to `.recoverUnsyncedChanges` (`RLMClientResetModeRecoverUnsyncedChanges`).\n  - If you are currently using `.manual` and continue to do so, the only change\n    you must explicitly make is designating manual mode in\n    your `Realm.Configuration.SyncConfiguration`s, since they will now default to `.recoverUnsyncedChanges`.\n  - You may choose to define your manual client reset handler in the newly\n    introduced `manual(ErrorReportingBlock? = nil)`\n    or `RLMSyncConfiguration.manualClientResetHandler`, but this is not required.\n    The `SyncManager.errorHandler` will still be invoked during a client reset if\n    no callback is passed into these new interfaces.\n\n### Deprecations\n\n* `ClientResetMode.discardLocal` is deprecated in favor of `ClientResetMode.discardUnsyncedChanges`.\n  The reasoning is that the name better reflects the effect of this reset mode. There is no actual\n  difference in behavior.\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.0.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.1-14.1.\n\n10.31.0 Release notes (2022-10-05)\n=============================================================\n\nThe prebuilt binary for Carthage is now build with Xcode 14.0.1.\n\n### Enhancements\n\n* Cut the runtime of aggregate operations on large dictionaries in half\n  ([Core #5864](https://github.com/realm/realm-core/pull/5864)).\n* Improve performance of aggregate operations on collections of objects by 2x\n  to 10x ([Core #5864](https://github.com/realm/realm-core/pull/5864)).\n  Greatly improve the performance of sorting or distincting a Dictionary's keys\n  or values. The most expensive operation is now performed O(log N) rather than\n  O(N log N) times, and large Dictionaries can see upwards of 99% reduction in\n  time to sort. ([Core #5166](https://github.com/realm/realm-core/pulls/5166))\n* Add support for changing the deployment location for Atlas Apps. Previously\n  this was assumed to be immutable ([Core #5648](https://github.com/realm/realm-core/issues/5648)).\n* The sync client will now yield the write lock to other threads which are\n  waiting to perform a write transaction even if it still has remaining work to\n  do, rather than always applying all changesets received from the server even\n  when other threads are trying to write. ([Core #5844](https://github.com/realm/realm-core/pull/5844)).\n* The sync client no longer writes an unused temporary copy of the changesets\n  received from the server to the Realm file ([Core #5844](https://github.com/realm/realm-core/pull/5844)).\n\n### Fixed\n\n* Setting a `List` property with `Results` no longer throws an unrecognized\n  selector exception (since 10.8.0-beta.2)\n* `RLMProgressNotificationToken` and `ProgressNotificationToken` now hold a\n  strong reference to the sync session, keeping it alive until the token is\n  deallocated or invalidated, as the other notification tokens do.\n  ([#7831](https://github.com/realm/realm-swift/issues/7831), since v2.3.0).\n* Results permitted some nonsensical aggregate operations on column types which\n  do not make sense to aggregate, giving garbage results rather than reporting\n  an error ([Core #5876](https://github.com/realm/realm-core/pull/5876), since v5.0.0).\n* Upserting a document in a Mongo collection would crash if the document's id\n  type was anything other than ObjectId (since v10.0.0).\n* Fix a use-after-free when a sync session is closed and the app is destroyed\n  at the same time ([Core #5752](https://github.com/realm/realm-core/issues/5752),\n  since v10.19.0).\n\n### Deprecations\n\n* `RLMUpdateResult.objectId` has been deprecated in favor of\n  `RLMUpdateResult.documentId` to support reporting document ids which are not\n  object ids.\n### Breaking Changes\n* Private API `_realmColumnNames` has been renamed to a new public API\n  called `propertiesMapping()`. This change only affects the Swift API\n  and doesn't have any effects in the obj-c API.\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 14.0.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.1-14.1.\n\n### Internal\n\n* Upgraded realm-core from 12.7.0 to 12.9.0\n\n10.30.0 Release notes (2022-09-20)\n=============================================================\n\n### Fixed\n\n* Incoming links from `RealmAny` properties were not handled correctly when\n  migrating an object type from top-level to embedded. `RealmAny` properties\n  currently cannot link to embedded objects.\n  ([Core #5796](https://github.com/realm/realm-core/pull/5796), since 10.8.0).\n* `Realm.refresh()` sometimes did not actually advance to the latest version.\n  It attempted to be semi-non-blocking in a very confusing way which resulted\n  in it sometimes advancing to a newer version that is not the latest version,\n  and sometimes blocking until notifiers are ready so that it could advance to\n  the latest version. This behavior was undocumented and didn't work correctly,\n  so it now always blocks if needed to advance to the latest version.\n  ([#7625](https://github.com/realm/realm-swift/issues/7625), since v0.98.0).\n* Fix the most common cause of thread priority inversions when performing\n  writes on the main thread. If beginning the write transaction has to wait for\n  the background notification calculations to complete, that wait is now done\n  in a QoS-aware way. ([#7902](https://github.com/realm/realm-swift/issues/7902))\n* Subscribing to link properties in a flexible sync Realm did not work due to a\n  mismatch between what the client sent and what the server needed.\n  ([Core #5409](https://github.com/realm/realm-core/issues/5409))\n* Attempting to use `AsymmetricObject` with partition-based sync now reports a\n  sensible error much earlier in the process. Asymmetric sync requires using\n  flexible sync. ([Core #5691](https://github.com/realm/realm-core/issues/5691), since 10.29.0).\n* Case-insensitive but diacritic-sensitive queries would crash on 4-byte UTF-8\n  characters ([Core #5825](https://github.com/realm/realm-core/issues/5825), since v2.2.0)\n* Accented characters are now handled by case-insensitive but\n  diacritic-sensitive queries. ([Core #5825](https://github.com/realm/realm-core/issues/5825), since v2.2.0)\n\n### Breaking Changes\n\n* `-[RLMASLoginDelegate authenticationDidCompleteWithError:]` has been renamed\n  to `-[RLMASLoginDelegate authenticationDidFailWithError:]` to comply with new\n  app store requirements. This only effects the obj-c API.\n  ([#7945](https://github.com/realm/realm-swift/issues/7945))\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.4.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.1 - 14.\n\n### Internal\n\n* Upgraded realm-core from 12.6.0 to 12.7.0\n\n10.29.0 Release notes (2022-09-09)\n=============================================================\n\n### Enhancements\n\n* Add support for asymmetric sync. When a class inherits from\n  `AsymmetricObject`, objects created are synced unidirectionally to the server\n  and cannot be queried or read locally.\n\n```swift\n    class PersonObject: AsymmetricObject {\n       @Persisted(primaryKey: true) var _id: ObjectId\n       @Persisted var name: String\n       @Persisted var age: Int\n    }\n\n    try realm.write {\n       // This will create the object on the server but not locally.\n       realm.create(PersonObject.self, value: [\"_id\": ObjectId.generate(),\n                                               \"name\": \"Dylan\",\n                                               \"age\": 20])\n    }\n```\n* Add ability to section a collection which conforms to `RealmCollection`, `RLMCollection`.\n  Collections can be sectioned by a unique key retrieved from a keyPath or a callback and will return an instance of `SectionedResults`/`RLMSectionedResults`.\n  Each section in the collection will be an instance of `ResultsSection`/`RLMSection` which gives access to the elements corresponding to the section key.\n  `SectionedResults`/`RLMSectionedResults` and `ResultsSection`/`RLMSection` have the ability to be observed.\n  ```swift\n  class DemoObject: Object {\n      @Persisted var title: String\n      @Persisted var date: Date\n      var firstLetter: String {\n          return title.first.map(String.init(_:)) ?? \"\"\n      }\n  }\n  var sectionedResults: SectionedResults<String, DemoObject>\n  // ...\n  sectionedResults = realm.objects(DemoObject.self)\n      .sectioned(by: \\.firstLetter, ascending: true)\n  ```\n* Add `@ObservedSectionedResults` for SwiftUI support. This property wrapper type retrieves sectioned results\n  from a Realm using a keyPath or callback to determine the section key.\n  ```swift\n  struct DemoView: View {\n      @ObservedSectionedResults(DemoObject.self,\n                                sectionKeyPath: \\.firstLetter) var demoObjects\n\n      var body: some View {\n          VStack {\n              List {\n                  ForEach(demoObjects) { section in\n                      Section(header: Text(section.key)) {\n                          ForEach(section) { object in\n                              MyRowView(object: object)\n                          }\n                      }\n                  }\n              }\n          }\n      }\n  }\n  ```\n* Add automatic handing for changing top-level objects to embedded objects in\n  migrations. Any objects of the now-embedded type which have zero incoming\n  links are deleted, and objects with multiple incoming links are duplicated.\n  This happens after the migration callback function completes, so there is no\n  functional change if you already have migration logic which correctly handles\n  this. ([Core #5737](https://github.com/realm/realm-core/pull/5737)).\n* Improve performance when a new Realm file connects to the server for the\n  first time, especially when significant amounts of data has been written\n  while offline. ([Core #5772](https://github.com/realm/realm-core/pull/5772))\n* Shift more of the work done on the sync worker thread out of the write\n  transaction used to apply server changes, reducing how long it blocks other\n  threads from writing. ([Core #5772](https://github.com/realm/realm-core/pull/5772))\n* Improve the performance of the sync changeset parser, which speeds up\n  applying changesets from the server. ([Core #5772](https://github.com/realm/realm-core/pull/5772))\n\n### Fixed\n\n* Fix all of the UBSan failures hit by our tests. It is unclear if any of these\n  manifested as visible bugs. ([Core #5665](https://github.com/realm/realm-core/pull/5665))\n* Upload completion callbacks were sometimes called before the final step of\n  interally marking the upload as complete, which could result in calling\n  `Realm.writeCopy()` from the completion callback failing due to there being\n  unuploaded changes. ([Core #4865](https://github.com/realm/realm-core/issues/4865)).\n* Writing to a Realm stored on an exFAT drive threw the exception \"fcntl() with\n  F_BARRIERFSYNC failed: Inappropriate ioctl for device\" when a write\n  transaction needed to expand the file.\n  ([Core #5789](https://github.com/realm/realm-core/issues/5789), since 10.27.0)\n* Syncing a Decimal128 with big significand could result in a crash.\n  ([Core #5728](https://github.com/realm/realm-core/issues/5728))\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.4.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.1-14 RC.\n\n### Internal\n\n* Upgraded realm-core from 12.5.1 to 12.6.0\n\n10.28.7 Release notes (2022-09-02)\n=============================================================\n\n### Enhancements\n\n* Add prebuilt binaries for Xcode 14 to the release package.\n\n### Fixed\n\n* Fix archiving watchOS release builds with Xcode 14.\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.4.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.1-14 beta 6.\n\n10.28.6 Release notes (2022-08-19)\n=============================================================\n\n### Fixed\n\n* Fixed an issue where having realm-swift as SPM sub-target dependency leads to\n  missing symbols error during iOS archiving ([Core #7645](https://github.com/realm/realm-core/pull/7645)).\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.4.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.1-14 beta 5.\n\n### Internal\n\n* Upgraded realm-core from 12.5.0 to 12.5.1\n\n10.28.5 Release notes (2022-08-09)\n=============================================================\n\n### Enhancements\n\n* Improve performance of accessing `SubscriptionSet` properties when no writes\n  have been made to the Realm since the last access.\n\n### Fixed\n\n* A use-after-free could occur if a Realm with audit events enabled was\n  destroyed while processing an upload completion for the events Realm on a\n  different thread. ([Core PR #5714](https://github.com/realm/realm-core/pull/5714))\n* Opening a read-only synchronized Realm for the first time via asyncOpen did\n  not set the schema version, which could lead to `m_schema_version !=\n  ObjectStore::NotVersioned` assertion failures later on.\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.4.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.1-14 beta 4.\n\n### Internal\n\n* Upgraded realm-core from 12.4.0 to 12.5.0\n\n10.28.4 Release notes (2022-08-03)\n=============================================================\n\n### Enhancements\n\n* Add support for building arm64 watchOS when installing Realm via CocoaPods.\n* Reduce the amount of virtual address space used\n  ([Core #5645](https://github.com/realm/realm-core/pull/5645)).\n\n### Fixed\n\n* Fix some warnings when building with Xcode 14\n  ([Core #5577](https://github.com/realm/realm-core/pull/5577)).\n* Fix compilation failures on watchOS platforms which do not support thread-local storage.\n  ([#7694](https://github.com/realm/realm-swift/issues/7694), [#7695](https://github.com/realm/realm-swift/issues/7695) since v10.21.1)\n* Fix a data race when committing a transaction while multiple threads are\n  waiting to begin write transactions. This appears to not have caused any\n  functional problems.\n* Fix a data race when writing audit events which could occur if the sync\n  client thread was busy with other work when the event Realm was opened.\n* Fix some cases of running out of virtual address space (seen/reported as mmap\n  failures) ([Core #5645](https://github.com/realm/realm-core/pull/5645)).\n* Audit event scopes containing only write events and no read events would\n  occasionally throw a `BadVersion` exception when a write transaction was\n  committed (since v10.26.0).\n* The client reset callbacks for the DiscardLocal mode would be passed invalid\n  Realm instances if the callback was invoked at a point where the Realm was\n  not otherwise open. ([Core #5654](https://github.com/realm/realm-core/pull/5654), since the introduction of DiscardLocal reset mode in v10.25.0)\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.4.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.1-14 beta 4.\n\n### Internal\n\n* Upgraded realm-core from 12.3.0 to 12.4.0.\n\n10.28.3 Release notes (2022-07-27)\n=============================================================\n\n### Enhancements\n\n* Greatly improve the performance of obtaining cached Realm instances in Swift\n  when using a sync configuration.\n\n### Fixed\n\n* Add missing `initialSubscription` and `rerunOnOpen` to copyWithZone method on\n  `RLMRealmConfiguration`. This resulted in incorrect values when using\n  `RLMRealmConfiguration.defaultConfiguration`.\n* The sync error handler did not hold a strong reference to the sync session\n  while dispatching the error from the worker thread to the main thread,\n  resulting in the session passed to the error handler being invalid if there\n  were no other remaining strong references elsewhere.\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.4.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.1-14 beta 3.\n\n10.28.2 Release notes (2022-06-30)\n=============================================================\n\n### Fixed\n\n* Using `seedFilePath` threw an exception if the Realm file being opened\n  already existed ([#7840](https://github.com/realm/realm-swift/issues/7840),\n  since v10.26.0).\n* The `intialSubscriptions` callback was invoked every time a Realm was opened\n  regardless of the value of `rerunOnOpen` and if the Realm was already open on\n  another thread (since v10.28.0).\n* Allow using `RLMSupport.Swift` from RealmSwift's Cocoapods\n  ([#6886](https://github.com/realm/realm-swift/pull/6886)).\n* Fix a UBSan failure when mapping encrypted pages. Fixing this did not change\n  the resulting assembly, so there were probably no functional problems\n  resulting from this (since v5.0.0).\n* Improved performance of sync clients during integration of changesets with\n  many small strings (totalling > 1024 bytes per changeset) on iOS 14, and\n  devices which have restrictive or fragmented memory.\n  ([Core #5614](https://github.com/realm/realm-core/issues/5614))\n* Fix a data race when opening a flexible sync Realm (since v10.28.0).\n* Add a missing backlink removal when assigning null or a non-link value to an\n  `AnyRealmValue` property which previously linked to an object.\n  This could have resulted in \"key not found\" exceptions or assertion failures\n  such as `mixed.hpp:165: [realm-core-12.1.0] Assertion failed: m_type` when\n  removing the destination link object.\n  ([Core #5574](https://github.com/realm/realm-core/pull/5573), since the introduction of AnyRealmValue in v10.8.0)\n\n### Compatibility\n\n* Realm Studio: 12.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.4.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.1-14 beta 2.\n\n### Internal\n\n* Upgraded realm-core from 12.1.0 to 12.3.0.\n\n10.28.1 Release notes (2022-06-10)\n=============================================================\n\n### Enhancements\n\n* Add support for Xcode 14. When building with Xcode 14, the minimum deployment\n  target is now iOS 11.\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.4.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.1-14 beta 1.\n\n10.28.0 Release notes (2022-06-03)\n=============================================================\n\n### Enhancements\n\n* Replace mentions of 'MongoDB Realm' with 'Atlas App Services' in the documentation and update appropriate links to documentation.\n* Allow adding a subscription querying for all documents of a type in swift for flexible sync.\n```\n   try await subscriptions.update {\n      subscriptions.append(QuerySubscription<SwiftPerson>(name: \"all_people\"))\n   }\n```\n* Add Combine API support for flexible sync beta.\n* Add an `initialSubscriptions` parameter when retrieving the flexible sync configuration from a user,\n  which allows to specify a subscription update block, to bootstrap a set of flexible sync subscriptions\n  when the Realm is first opened.\n  There is an additional optional parameter flag `rerunOnOpen`, which allows to run this initial\n  subscriptions on every app startup.\n\n```swift\n    let config = user.flexibleSyncConfiguration(initialSubscriptions: { subs in\n        subs.append(QuerySubscription<SwiftPerson>(name: \"people_10\") {\n            $0.age > 10\n        })\n    }, rerunOnOpen: true)\n    let realm = try Realm(configuration: config)\n```\n* The sync client error handler will report an error, with detailed info about which object caused it, when writing an object to a flexible sync Realm outside of any query subscription. ([#5528](https://github.com/realm/realm-core/pull/5528))\n* Adding an object to a flexible sync Realm for a type that is not within a query subscription will now throw an exception. ([#5488](https://github.com/realm/realm-core/pull/5488)).\n\n### Fixed\n\n* Flexible Sync query subscriptions will correctly complete when data is synced to the local Realm. ([#5553](https://github.com/realm/realm-core/pull/5553), since v12.0.0)\n\n### Breaking Changes\n\n* Rename `SyncSubscriptionSet.write` to `SyncSubscriptionSet.update` to avoid confusion with `Realm.write`.\n* Rename `SyncSubscription.update` to `SyncSubscription.updateQuery` to avoid confusion with `SyncSubscriptionSet.update`.\n* Rename `RLMSyncSubscriptionSet.write` to `RLMSyncSubscriptionSet.update` to align it with swift API.\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.4.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.1-13.4.\n\n### Internal\n\n* Upgraded realm-core from 12.0.0 to 12.1.0.\n\n10.27.0 Release notes (2022-05-26)\n=============================================================\n\n### Enhancements\n\n* `@AsyncOpen`/`@AutoOpen` property wrappers can be used with flexible sync.\n\n### Fixed\n\n* When installing via SPM, debug builds could potentially hit an assertion\n  failure during flexible sync bootstrapping. ([Core #5527](https://github.com/realm/realm-core/pull/5527))\n* Flexible sync now only applies bootstrap data if the entire bootstrap is\n  received. Previously orphaned objects could result from the read snapshot on\n  the server changing. ([Core #5331](https://github.com/realm/realm-core/pull/5331))\n* Partially fix a performance regression in write performance introduced in\n  v10.21.1. v10.21.1 fixed a case where a kernel panic or device's battery\n  dying at the wrong point in a write transaction could potentially result in a\n  corrected Realm file, but at the cost of a severe performance hit. This\n  version adjusts how file synchronization is done to provide the same safety\n  at a much smaller performance hit. ([#7740](https://github.com/realm/realm-swift/issues/7740)).\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later (but see note below).\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.4.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.1-13.4.\n\n### Internal\n\n* Upgraded realm-core from 11.17.0 to 12.0.0.\n* Bump the version number for the lockfile used for interprocess\n  synchronization. This has no effect on persistent data, but means that\n  versions of Realm which use pre-12.0.0 realm-core cannot open Realm files at\n  the same time as they are opened by this version. Notably this includes Realm\n  Studio, and v11.1.2 (the latest at the time of this release) cannot open\n  Realm files which are simultaneously open in the simulator.\n\n10.26.0 Release notes (2022-05-19)\n=============================================================\n\nXcode 13.1 is now the minimum supported version of Xcode, as Apple no longer\nallows submitting to the app store with Xcode 12.\n\n### Enhancements\n\n* Add Xcode 13.4 binaries to the release package.\n* Add Swift API for asynchronous transactions\n```swift\n    try? realm.writeAsync {\n        realm.create(SwiftStringObject.self, value: [\"string\"])\n    } onComplete: { error in\n        // optional handling on write complete\n    }\n\n    try? realm.beginAsyncWrite {\n        realm.create(SwiftStringObject.self, value: [\"string\"])\n        realm.commitAsyncWrite()\n    }\n\n    let asyncTransactionId = try? realm.beginAsyncWrite {\n        // ...\n    }\n    try! realm.cancelAsyncWrite(asyncTransactionId)\n```\n* Add Obj-C API for asynchronous transactions\n```\n   [realm asyncTransactionWithBlock:^{\n        [StringObject createInRealm:realm withValue:@[@\"string\"]];\n    } onComplete:^(NSError *error) {\n        // optional handling\n    }];\n\n    [realm beginAsyncWriteTransaction:^{\n        [StringObject createInRealm:realm withValue:@[@\"string\"]];\n        [realm commitAsyncWriteTransaction];\n    }];\n\n    RLMAsyncTransactionId asyncTransactionId = [realm beginAsyncWriteTransaction:^{\n        // ...\n    }];\n    [realm cancelAsyncTransaction:asyncTransactionId];\n```\n* Improve performance of opening a Realm with `objectClasses`/`objectTypes` set\n  in the configuration.\n* Implement the Realm event recording API for reporting reads and writes on a\n  Realm file to Atlas.\n\n### Fixed\n\n* Lower minimum OS version for `async` login and FunctionCallables to match the\n  rest of the `async` functions. ([#7791]https://github.com/realm/realm-swift/issues/7791)\n* Consuming a RealmSwift XCFramework with library evolution enabled would give the error\n  `'Failed to build module 'RealmSwift'; this SDK is not supported by the compiler'`\n  when the XCFramework was built with an older XCode version and is\n  then consumed with a later version. ([#7313](https://github.com/realm/realm-swift/issues/7313), since v3.18.0)\n* A data race would occur when opening a synchronized Realm with the client\n  reset mode set to `discardLocal` on one thread at the same time as a client\n  reset was being processed on another thread. This probably did not cause any\n  functional problems in practice and the broken timing window was very tight (since 10.25.0).\n* If an async open of a Realm triggered a client reset, the callbacks for\n  `discardLocal` could theoretically fail to be called due to a race condition.\n  The timing for this was probably not possible to hit in practice (since 10.25.0).\n* Calling `[RLMRealm freeze]`/`Realm.freeze` on a Realm which had been created from `writeCopy`\n  would not produce a frozen Realm. ([#7697](https://github.com/realm/realm-swift/issues/7697), since v5.0.0)\n* Using the dynamic subscript API on unmanaged objects before first opening a\n  Realm or if `objectTypes` was set when opening a Realm would throw an\n  exception ([#7786](https://github.com/realm/realm-swift/issues/7786)).\n* The sync client may have sent a corrupted upload cursor leading to a fatal\n  error from the server due to an uninitialized variable.\n  ([#5460](https://github.com/realm/realm-core/pull/5460), since v10.25.1)\n* Flexible sync would not correctly resume syncing if a bootstrap was interrupted\n  ([#5466](https://github.com/realm/realm-core/pull/5466), since v10.21.1).\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.4.\n* CocoaPods: 1.10 or later.\n* Xcode: 13.1-13.4.\n\n### Internal\n\n* Upgraded realm-core from v11.15.0 to v11.17.0\n\n10.25.2 Release notes (2022-04-27)\n=============================================================\n\n### Enhancements\n\n* Replace Xcode 13.3 binaries with 13.3.1 binaries.\n\n### Fixed\n\n* `List<AnyRealmValue>` would contain an invalidated object instead of null when\n  the object linked to was deleted by a difference sync client\n  ([Core #5215](https://github.com/realm/realm-core/pull/5215), since v10.8.0).\n* Adding an object to a Set, deleting the parent object of the Set, and then\n  deleting the object which was added to the Set would crash\n  ([Core #5387](https://github.com/realm/realm-core/issues/5387), since v10.8.0).\n* Synchronized Realm files which were first created using v10.0.0-beta.3 would\n  be redownloaded instead of using the existing file, possibly resulting in the\n  loss of any unsynchronized data in those files (since v10.20.0).\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.3.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.4-13.3.1.\n\n### Internal\n\n* Upgraded realm-core from v11.14.0 to v11.15.0\n\n10.25.1 Release notes (2022-04-11)\n=============================================================\n\n### Fixed\n\n* Fixed various memory corruption bugs when encryption is used caused by not\n  locking a mutex when needed.\n  ([#7640](https://github.com/realm/realm-swift/issues/7640), [#7659](https://github.com/realm/realm-swift/issues/7659), since v10.21.1)\n* Changeset upload batching did not calculate the accumulated size correctly,\n  resulting in “error reading body failed to read: read limited at 16777217\n  bytes” errors from the server when writing large amounts of data\n  ([Core #5373](https://github.com/realm/realm-core/pull/5373), since 10.25.0).\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.3.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.4-13.3.\n\n### Internal\n\n* Upgraded realm-core from v11.13.0 to v11.14.0.\n\n10.25.0 Release notes (2022-03-29)\n=============================================================\n\nSynchronized Realm files written by this version cannot be opened by older\nversions of Realm. Existing files will be automatically upgraded when opened.\n\nNon-synchronized Realm files remain backwards-compatible.\n\n### Enhancements\n\n* Add ability to use Swift Query syntax in `@ObservedResults`, which allows you\n  to filter results using the `where` parameter.\n* Add ability to use `MutableSet` with `StateRealmObject` in SwiftUI.\n* Async/Await extensions are now compatible with iOS 13 and above when building\n  with Xcode 13.3.\n* Sync changesets waiting to be uploaded to the server are now compressed,\n  reducing the disk space needed when large write transactions are performed\n  while offline or limited in bandwidth.([Core #5260](https://github.com/realm/realm-core/pull/5260)).\n* Added new `SyncConfiguration.clientResetMode` and `RLMSyncConfiguration.clientResetMode` properties.\n  - The values of these properties will dictate client behavior in the event of a [client reset](https://docs.mongodb.com/realm/sync/error-handling/client-resets/).\n  - See below for information on `ClientResetMode` values.\n  - `clientResetMode` defaults to `.manual` if not set otherwise.\n* Added new `ClientResetMode` and `RLMClientResetMode` enums.\n  - These enums represent possible client reset behavior for `SyncConfiguration.clientResetMode` and `RLMSyncConfiguration.clientResetMode`, respectively.\n  - `.manual` and `RLMClientResetModeManual`\n    - The local copy of the Realm is copied into a recovery\n      directory for safekeeping, and then deleted from the original location. The next time\n      the Realm for that partition value is opened, the Realm will automatically be re-downloaded from\n      MongoDB Realm, and can be used as normal.\n    - Data written to the Realm after the local copy of the Realm diverged from the backup\n      remote copy will be present in the local recovery copy of the Realm file. The\n      re-downloaded Realm will initially contain only the data present at the time the Realm\n      was backed up on the server.\n    -  `rlmSync_clientResetBackedUpRealmPath` and `SyncError.clientResetInfo()` are used for accessing the recovery directory.\n  - `.discardLocal` and `RLMClientResetDiscardLocal`\n    - All unsynchronized local changes are automatically discarded and the local state is\n      automatically reverted to the most recent state from the server. Unsynchronized changes\n      can then be recovered in a post-client-reset callback block (See changelog below for more details).\n    - If RLMClientResetModeDiscardLocal is enabled but the client reset operation is unable to complete\n      then the client reset process reverts to manual mode.\n    - The realm's underlying object accessors remain bound so the UI may be updated in a non-disruptive way.\n* Added support for client reset notification blocks for `.discardLocal` and `RLMClientResetDiscardLocal`\n  - **RealmSwift implementation**: `discardLocal(((Realm) -> Void)? = nil, ((Realm, Realm) -> Void)? = nil)`\n    - RealmSwift client reset blocks are set when initializing the user configuration\n    ```swift\n    var configuration = user.configuration(partitionValue: \"myPartition\", clientResetMode: .discardLocal(beforeClientResetBlock, afterClientResetBlock))\n    ```\n    - The before client reset block -- `((Realm) -> Void)? = nil` -- is executed prior to a client reset. Possible usage includes:\n    ```swift\n    let beforeClientResetBlock: (Realm) -> Void = { beforeRealm in\n      var recoveryConfig = Realm.Configuration()\n        recoveryConfig.fileURL = myRecoveryPath\n        do {\n          beforeRealm.writeCopy(configuration: recoveryConfig)\n            /* The copied realm could be used later for recovery, debugging, reporting, etc. */\n        } catch {\n            /* handle error */\n        }\n    }\n    ```\n    - The after client reset block -- `((Realm, Realm) -> Void)? = nil)` -- is executed after a client reset. Possible usage includes:\n    ```Swift\n    let afterClientResetBlock: (Realm, Realm) -> Void = { before, after in\n    /* This block could be used to add custom recovery logic, back-up a realm file, send reporting, etc. */\n    for object in before.objects(myClass.self) {\n        let res = after.objects(myClass.self)\n        if (res.filter(\"primaryKey == %@\", object.primaryKey).first != nil) {\n             /* ...custom recovery logic... */\n        } else {\n             /* ...custom recovery logic... */\n        }\n    }\n    ```\n  - **Realm Obj-c implementation**: Both before and after client reset callbacks exist as properties on `RLMSyncConfiguration` and are set at initialization.\n    ```objective-c\n      RLMRealmConfiguration *config = [user configurationWithPartitionValue:partitionValue\n                                                            clientResetMode:RLMClientResetModeDiscardLocal\n                                                          notifyBeforeReset:beforeBlock\n                                                           notifyAfterReset:afterBlock];\n    ```\n    where `beforeBlock` is of type `RLMClientResetBeforeBlock`. And `afterBlock` is of type `RLMClientResetAfterBlock`.\n\n### Breaking Changes\n\n* Xcode 13.2 is no longer supported when building with Async/Await functions. Use\n  Xcode 13.3 to build with Async/Await functionality.\n\n### Fixed\n\n* Adding a Realm Object to a `ObservedResults` or a collections using\n  `StateRealmObject` that is managed by the same Realm would throw if the\n  Object was frozen and not thawed before hand.\n* Setting a Realm Configuration for @ObservedResults using it's initializer\n  would be overrode by the Realm Configuration stored in\n  `.environment(\\.realmConfiguration, ...)` if they did not match\n  ([Cocoa #7463](https://github.com/realm/realm-swift/issues/7463), since v10.6.0).\n* Fix searchable component filter overriding the initial filter on `@ObservedResults`, (since v10.23.0).\n* Comparing `Results`, `LinkingObjects` or `AnyRealmCollection` when using Realm via XCFramework\n  would result in compile time errors ([Cocoa #7615](https://github.com/realm/realm-swift/issues/7615), since v10.21.0)\n* Opening an encrypted Realm while the keychain is locked on macOS would crash\n  ([#7438](https://github.com/realm/realm-swift/issues/7438)).\n* Updating subscriptions while refreshing the access token would crash\n  ([Core #5343](https://github.com/realm/realm-core/issues/5343), since v10.22.0)\n* Fix several race conditions in `SyncSession` related to setting\n  `customRequestHeaders` while using the `SyncSession` on a different thread.\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.3.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.4-13.3.\n\n### Internal\n\n* Upgraded realm-core from v11.12.0 to v11.13.0\n\n10.24.2 Release notes (2022-03-18)\n=============================================================\n\n### Fixed\n\n* Application would sometimes crash with exceptions like 'KeyNotFound' or\n  assertion \"has_refs()\". Other issues indicating file corruption may also be\n  fixed by this. The one mentioned here is the one that lead to solving the\n  problem.\n  ([Core #5283](https://github.com/realm/realm-core/issues/5283), since v5.0.0)\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.3.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.4-13.3.\n\n### Internal\n\n* Upgraded realm-core from 11.11.0 to 11.12.0\n\n10.24.1 Release notes (2022-03-14)\n=============================================================\n\nSwitch to building the Carthage binary with Xcode 13.3. This release contains\nno functional changes from 10.24.0.\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.3.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.4-13.3.\n\n10.24.0 Release notes (2022-03-05)\n=============================================================\n\n### Enhancements\n\n* Add ability to use Swift Query syntax in `@ObservedResults`, which allows you\n  to filter results using the `where` parameter.\n\n### Fixed\n\n* If a list of objects contains links to objects not included in the\n  synchronized partition, collection change notifications for that list could\n  be incorrect ([Core #5164](https://github.com/realm/realm-core/issues/5164), since v10.0.0).\n* Adding a new flexible sync subscription could crash with\n  \"Assertion failed: !m_unbind_message_sent\" in very specific timing scenarios\n  ([Core #5149](https://github.com/realm/realm-core/pull/5149), since v10.22.0).\n* Converting floats/doubles into Decimal128 would yield imprecise results\n  ([Core #5184](https://github.com/realm/realm-core/pull/5184), since v10.0.0)\n* Using accented characters in class and field names in a synchronized Realm\n  could result in sync errors ([Core #5196](https://github.com/realm/realm-core/pull/5196), since v10.0.0).\n* Calling `Realm.invalidate()` from inside a Realm change notification could\n  result in the write transaction which produced the notification not being\n  persisted to disk (since v10.22.0).\n* When a client reset error which results in the current Realm file being\n  backed up and then deleted, deletion errors were ignored as long as the copy\n  succeeded. When this happens the deletion of the old file is now scheduled\n  for the next launch of the app. ([Core #5180](https://github.com/realm/realm-core/issues/5180), since v2.0.0)\n* Fix an error when compiling a watchOS Simulator target not supporting\n  Thread-local storage ([#7623](https://github.com/realm/realm-swift/issues/7623), since v10.21.0).\n* Add a validation check to report a sensible error if a Realm configuration\n  indicates that an in-memory Realm should be encrypted. ([Core #5195](https://github.com/realm/realm-core/issues/5195))\n* The Swift package set the linker flags on the wrong target, resulting in\n  linker errors when SPM decides to build the core library as a dynamic library\n  ([#7266](https://github.com/realm/realm-swift/issues/7266)).\n* The download-core task failed if run in an environment without TMPDIR set\n  ([#7688](https://github.com/realm/realm-swift/issues/7688), since v10.23.0).\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.2.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.4-13.3 beta 3.\n\n### Internal\n\n* Upgraded realm-core from 11.9.0 to 11.11.0\n\n10.23.0 Release notes (2022-02-28)\n=============================================================\n\n### Enhancements\n\n* Add `Realm.writeCopy(configuration:)`/`[RLMRealm writeCopyForConfiguration:]` which gives the\n  following functionality:\n    - Export a local non-sync Realm to be used with MongoDB Realm Sync\n      when the configuration is derived from a sync `RLMUser`/`User`.\n    - Write a copy of a local Realm to a destination specified in the configuration.\n    - Write a copy of a synced Realm in use with user A, and open it with user B.\n    - Note that migrations may be required when using a local realm configuration to open a realm file that\n      was copied from a synchronized realm.\n\n  An exception will be thrown if a Realm exists at the destination.\n* Add a `seedFilePath` option to `RLMRealmConfiguration` and `Configuration`. If this\n  option is set then instead of creating an empty Realm, the realm at the `seedFilePath` will\n  be copied to the `fileURL` of the new Realm. If a Realm file already exists at the\n  desitnation path, the seed file will not be copied and the already existing Realm\n  will be opened instead. Note that to use this parameter with a synced Realm configuration\n  the seed Realm must be appropriately copied to a destination with\n  `Realm.writeCopy(configuration:)`/`[RLMRealm writeCopyForConfiguration:]` first.\n* Add ability to permanently delete a User from a MongoDB Realm app. This can\n  be invoked with `User.delete()`/`[RLMUser deleteWithCompletion:]`.\n* Add `NSCopying` conformance to `RLMDecimal128` and `RLMObjectId`.\n* Add Xcode 13.3 binaries to the release package (and remove 13.0).\n\n### Fixed\n\n* Add support of arm64 in Carthage build ([#7154](https://github.com/realm/realm-cocoa/issues/7154)\n* Adding missing support for `IN` queries to primitives types on Type Safe Queries.\n  ```swift\n  let persons = realm.objects(Person.self).where {\n    let acceptableNames = [\"Tom\", \"James\", \"Tyler\"]\n    $0.name.in([acceptableNames])\n  }\n  ```\n  ([Cocoa #7633](https://github.com/realm/realm-swift/issues/7633), since v10.19.0)\n* Work around a compiler crash when building with Swift 5.6 / Xcode 13.3.\n  CustomPersistable's PersistedType must now always be a built-in type rather\n  than possibly another CustomPersistable type as Swift 5.6 has removed support\n  for infinitely-recursive associated types ([#7654](https://github.com/realm/realm-swift/issues/7654)).\n* Fix redundant call to filter on `@ObservedResults` from `searchable`\n  component (since v10.19.0).\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.2.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.4-13.3 beta 3.\n\n10.22.0 Release notes (2022-01-25)\n=============================================================\n\n### Enhancements\n\n* Add beta support for flexible sync. See the [backend](https://docs.mongodb.com/realm/sync/data-access-patterns/flexible-sync/) and [SDK](https://docs.mongodb.com/realm/sdk/swift/examples/flexible-sync/) documentation for more information. Please report any issues with the beta through Github.\n\n### Fixed\n\n* UserIdentity metadata table grows indefinitely. ([#5152](https://github.com/realm/realm-core/issues/5152), since v10.20.0)\n* We now report a useful error message when opening a sync Realm in non-sync mode or vice-versa.([#5161](https://github.com/realm/realm-core/pull/5161), since v5.0.0).\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.2.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.4-13.2.1.\n\n### Internal\n\n* Upgraded realm-core from 11.8.0 to 11.9.0\n\n10.21.1 Release notes (2022-01-12)\n=============================================================\n\n### Fixed\n\n* The sync client will now drain the receive queue when a send fails with\n  ECONNRESET, ensuring that any error message from the server gets received and\n  processed. ([#5078](https://github.com/realm/realm-core/pull/5078))\n* Schema validation was missing for embedded objects in sets, resulting in an\n  unhelpful error being thrown if a Realm object subclass contained one (since v10.0.0).\n* Opening a Realm with a schema that has an orphaned embedded object type\n  performed an extra empty write transaction (since v10.0.0).\n* Freezing a Realm with a schema that has orphaned embedded object types threw\n  a \"Wrong transactional state\" exception (since v10.19.0).\n* `@sum` and `@avg` queries on Dictionaries of floats or doubles used too much\n  precision for intermediates, resulting in incorrect rounding (since v10.5.0).\n* Change the exception message for calling refresh on an immutable Realm from\n  \"Continuous transaction through DB object without history information.\" to\n  \"Can't refresh a read-only Realm.\"\n  ([#5061](https://github.com/realm/realm-core/issues/5061), since v10.8.0).\n* Queries of the form \"link.collection.@sum = 0\" where `link` is null matched\n  when `collection` was a List or Set, but not a Dictionary\n  ([#5080](https://github.com/realm/realm-core/pull/5080), since v10.8.0).\n* Types which require custom obj-c bridging (such as `PersistableEnum` or\n  `CustomPersistable`) would crash with exceptions mentioning `__SwiftValue` in\n  a variety of places on iOS versions older than iOS 14\n  ([#7604](https://github.com/realm/realm-swift/issues/7604), since v10.21.0)\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.2.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.4-13.2.1.\n\n### Internal\n\n* Upgraded realm-core from 11.6.1 to 11.8.0.\n\n10.21.0 Release notes (2022-01-10)\n=============================================================\n\n### Enhancements\n\n* Add `metadata` property to `RLMUserProfile`/`UserProfile`.\n* Add class `Projection` to allow creation of light weight view models out of Realm Objects.\n```swift\npublic class Person: Object {\n    @Persisted var firstName = \"\"\n    @Persisted var lastName = \"\"\n    @Persisted var address: Address? = nil\n    @Persisted var friends = List<Person>()\n}\n\npublic class Address: EmbeddedObject {\n    @Persisted var city: String = \"\"\n    @Persisted var country = \"\"\n}\n\nclass PersonProjection: Projection<Person> {\n    // `Person.firstName` will have same name and type\n    @Projected(\\Person.firstName) var firstName\n    // There will be the only String for `city` of the original object `Address`\n    @Projected(\\Person.address.city) var homeCity\n    // List<Person> will be mapped to list of firstNames\n    @Projected(\\Person.friends.projectTo.firstName) var firstFriendsName: ProjectedCollection<String>\n}\n\n// `people` will contain projections for every `Person` object in the `realm`\nlet people: Results<PersonProjection> = realm.objects(PersonProjection.self)\n```\n* Greatly improve performance of reading AnyRealmValue and enum types from\n  Realm collections.\n* Allow using Swift enums which conform to `PersistableEnum` as the value type\n  for all Realm collections.\n* `AnyRealmCollection` now conforms to `Encodable`.\n* AnyRealmValue and PersistableEnum values can now be passed directly to an\n  NSPredicate used in a filter() call rather than having to pass the rawValue\n  (the rawValue is still allowed).\n* Queries on collections of PersistableEnums can now be performed with `where()`.\n* Add support for querying on the rawValue of an enum with `where()`.\n* `.count` is supported for Maps of all types rather than just numeric types in `where()`.\n* Add support for querying on the properties of objects contained in\n  dictionaries (e.g. \"dictProperty.@allValues.name CONTAINS 'a'\").\n* Improve the error message for many types of invalid predicates in queries.\n* Add support for comparing `@allKeys` to another property on the same object.\n* Add `Numeric` conformance to `Decimal128`.\n* Make some invalid property declarations such as `List<AnyRealmValue?>` a\n  compile-time error instead of a runtime error.\n* Calling `.sorted(byKeyPath:)` on a collection with an Element type which does\n  not support sorting by keypaths is now a compile-time error instead of a\n  runtime error.\n* `RealmCollection.sorted(ascending:)` can now be called on all\n  non-Object/EmbeddedObject collections rather than only ones where the\n  `Element` conforms to `Comparable`.\n* Add support for using user-defined types with `@Persistable` and in Realm\n  collections by defining a mapping to and from a type which Realm knows how to\n  store. For example, `URL` can be made persistable with:\n  ```swift\n  extension URL: FailableCustomPersistable {\n      // Store URL values as a String in Realm\n      public typealias PersistedType = String\n      // Convert a String to a URL\n      public init?(persistedValue: String) { self.init(string: persistedValue) }\n      // Convert a URL to a String\n      public var persistableValue: String { self.absoluteString }\n  }\n  ```\n  After doing this, `@Persisted var url: URL` is a valid property declaration\n  on a Realm object. More advanced mappings can be done by mapping to an\n  EmbeddedObject which can store multiple values.\n\n### Fixed\n\n* Accessing a non object collection inside a migration would cause a crash\n* [#5633](https://github.com/realm/realm-cocoa/issues/5633).\n* Accessing a `Map` of objects dynamically would not handle nulled values correctly (since v10.8.0).\n* `where()` allowed constructing some nonsensical queries due to boolean\n  comparisons returning `Query<T>` rather than `Query<Bool>` (since v10.19.0).\n* `@allValues` queries on dictionaries accidentally did not require \"ANY\".\n* Case-insensitive and diacritic-insensitive modifiers were ignored when\n  comparing the result of an aggregate operation to another property in a\n  query.\n* `Object.init(value:)` did not allow initializing `RLMDictionary<NSString, RLMObject>`/`Map<String, Object?>`\n  properties with null values for map entries (since v10.8.0).\n* `@ObservedResults` did not refresh when changes were made to the observed\n  collection. (since v10.6.0)\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.2.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.4-13.2.1.\n\n10.20.1 Release notes (2021-12-14)\n=============================================================\n\nXcode 12.4 is now the minimum supported version of Xcode.\n\n### Fixed\n\n* Add missing `Indexable` support for UUID.\n  ([Cocoa #7545](https://github.com/realm/realm-swift/issues/7545), since v10.10.0)\n\n### Breaking Changes\n\n* All `async` functions now require Xcode 13.2 to work around an App\n  Store/TestFlight bug that results in apps built with 13.0/13.1 which do not\n  use libConcurrency but link a library which does crashing on startup.\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.2.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.2-13.2.\n\n10.20.0 Release notes (2021-11-16)\n=============================================================\n\n### Enhancements\n\n* Conform `@ThreadSafe` and `ThreadSafeReference` to `Sendable`.\n* Allow using Swift enums which conform to `PersistableEnum` as the value type\n  for all Realm collections.\n* `AnyRealmCollection` now conforms to `Encodable`.\n* Greatly improve performance of reading AnyRealmValue and enum types from\n  Realm collections.\n* `AnyRealmCollection` now conforms to `Encodable`.\n\n### Fixed\n\n* `@AutoOpen` will open the existing local Realm file on any connection error\n  rather than only when the connection specifically times out.\n* Do not allow `progress` state changes for `@AutoOpen` and `@AsyncOpen` after\n  changing state to `open(let realm)` or `error(let error)`.\n* Logging out a sync user failed to remove the local Realm file for partitions\n  with very long partition values that would have exceeded the maximum path\n  length. ([Core #4187](https://github.com/realm/realm-core/issues/4187), since v10.0.0)\n* Don't keep trying to refresh the access token if the client's clock is more\n  than 30 minutes fast. ([Core #4941](https://github.com/realm/realm-core/issues/4941))\n* Failed auth requests used a fixed long sleep rather than exponential backoff\n  like other sync requests, which could result in very delayed reconnects after\n  a device was offline long enough for the access token to expire (since v10.0.0).\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.2-13.1.\n\n### Internal\n\n* Upgraded realm-core from 11.6.0 to 11.6.1.\n\n10.19.0 Release notes (2021-11-04)\n=============================================================\n\n### Enhancements\n\n* Add `.searchable()` SwiftUI View Modifier which allows filtering\n  `@ObservedResult` results from a search field component by a key path.\n  ```swift\n  List {\n      ForEach(reminders) { reminder in\n        ReminderRowView(reminder: reminder)\n      }\n  }.searchable(text: $searchFilter,\n               collection: $reminders,\n               keyPath: \\.name) {\n    ForEach(reminders) { remindersFiltered in\n      Text(remindersFiltered.name).searchCompletion(remindersFiltered.name)\n    }\n  }\n  ```\n* Add an API for a type safe query syntax. This allows you to filter a Realm\n  and collections managed by a Realm with Swift style expressions. Here is a\n  brief example:\n  ```swift\n  class Person: Object {\n    @Persisted var name: String\n    @Persisted var hobbies: MutableSet<String>\n    @Persisted var pets: List<Pet>\n  }\n  class Pet: Object {\n    @Persisted var name: String\n    @Persisted var age: Int\n  }\n\n  let persons = realm.objects(Person.self).where {\n    $0.hobbies.contains(\"music\") || $0.hobbies.contains(\"baseball\")\n  }\n\n  persons = realm.objects(Person.self).where {\n    ($0.pets.age >= 2) && $0.pets.name.starts(with: \"L\")\n  }\n  ```\n  ([#7419](https://github.com/realm/realm-swift/pull/7419))\n* Add support for dictionary subscript expressions\n  (e.g. `\"phoneNumbers['Jane'] == '123-3456-123'\"`) when querying with an\n  NSPredicate.\n* Add UserProfile to User. This contains metadata from social logins with MongoDB Realm.\n* Slightly reduce the peak memory usage when processing sync changesets.\n\n### Fixed\n\n* Change default request timeout for `RLMApp` from 6 seconds to 60 seconds.\n* Async `Realm` init would often give a Realm instance which could not actually\n  be used and would throw incorrect thread exceptions. It now is `@MainActor`\n  and gives a Realm instance which always works on the main actor. The\n  non-functional `queue:` parameter has been removed (since v10.15.0).\n* Restore the pre-v10.12.0 behavior of calling `writeCopy()` on a synchronized\n  Realm which produced a local non-synchronized Realm\n  ([#7513](https://github.com/realm/realm-swift/issues/7513)).\n* Decimal128 did not properly normalize the value before hashing and so could\n  have multiple values which are equal but had different hash values (since v10.8.0).\n* Fix a rare assertion failure or deadlock when a sync session is racing to\n  close at the same time that external reference to the Realm is being\n  released. ([Core #4931](https://github.com/realm/realm-core/issues/4931))\n* Fix a assertion failure when opening a sync Realm with a user who had been\n  removed. Instead an exception will be thrown. ([Core #4937](https://github.com/realm/realm-core/issues/4937), since v10.0.0)\n* Fixed a rare segfault which could trigger if a user was being logged out\n  while the access token refresh response comes in.\n  ([Core #4944](https://github.com/realm/realm-core/issues/4944), since v10.0.0)\n* Fixed a bug where progress notifiers on an AsyncOpenTask could be called\n  after the open completed. ([Core #4919](https://github.com/realm/realm-core/issues/4919))\n* SecureTransport was not enabled for macCatalyst builds when installing via\n  SPM, resulting in `'SSL/TLS protocol not supported'` exceptions when using\n  Realm Sync. ([#7474](https://github.com/realm/realm-swift/issues/7474))\n* Users were left in the logged in state when their refresh token expired.\n  ([Core #4882](https://github.com/realm/realm-core/issues/4882), since v10)\n* Calling `.count` on a distinct collection would return the total number of\n  objects in the collection rather than the distinct count the first time it is\n  called. ([#7481](https://github.com/realm/realm-swift/issues/7481), since v10.8.0).\n* `realm.delete(collection.distinct(...))` would delete all objects in the\n  collection rather than just the first object with each distinct value in the\n  property being distincted on, unless the distinct Results were read from at\n  least once first (since v10.8.0).\n* Calling `.distinct()` on a collection, accessing the Results, then passing\n  the Results to `realm.delete()` would delete the correct objects, but\n  afterwards report a count of zero even if there were still objects in the\n  Results (since v10.8.0).\n* Download compaction could result in non-streaming sync download notifiers\n  never reporting completion (since v10.0.0,\n  [Core #4989](https://github.com/realm/realm-core/pull/4989)).\n* Fix a deadlock in SyncManager that was probably not possible to hit in\n  real-world code (since v10.0.0).\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.4-13.2.\n\n### Internal\n\n* Upgraded realm-core from v11.4.1 to v11.6.0\n\n10.18.0 Release notes (2021-10-25)\n=============================================================\n\n### Enhancements\n\n* Add support for using multiple users with `@AsyncOpen` and `@AutoOpen`.\n  Setting the current user to a new user will now automatically reopen the\n  Realm with the new user.\n* Add prebuilt binary for Xcode 13.1 to the release package.\n\n### Fixed\n\n* Fix `@AsyncOpen` and `@AutoOpen` using `defaultConfiguration` by default if\n  the user's doesn't provide one, will set an incorrect path which doesn't\n  correspond to the users configuration one. (since v10.12.0)\n* Adding missing subscription completion for `AsyncOpenPublisher` after\n  successfully returning a realm.\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.2-13.1.\n\n10.17.0 Release notes (2021-10-06)\n=============================================================\n\n### Enhancements\n\n* Add a new `@ThreadSafe` property wrapper. Objects and collections wrapped by `@ThreadSafe` may be passed between threads. It's\n  intended to allow local variables and function parameters to be used across\n  threads when needed.\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.2-13.0.\n\n10.16.0 Release notes (2021-09-29)\n=============================================================\n\n### Enhancements\n\n* Add `async` versions of `EmailPasswordAuth.callResetPasswordFunction` and\nr `User.linkUser` methods.\n* Add `async` version of `MongoCollection` methods.\n* Add `async` support for user functions.\n\n### Fixed\n\n* A race condition in Realm.asyncOpen() sometimes resulted in subsequent writes\n  from Realm Sync failing to produce notifications\n  ([#7447](https://github.com/realm/realm-swift/issues/7447),\n  [#7453](https://github.com/realm/realm-swift/issues/7453),\n  [Core #4909](https://github.com/realm/realm-core/issues/4909), since v10.15.0).\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.2-13.0.\n\n10.15.1 Release notes (2021-09-15)\n=============================================================\n\n### Enhancements\n\n* Switch to building the Carthage release with Xcode 13.\n\n### Fixed\n\n* Fix compilation error where Swift 5.5 is available but the macOS 12 SDK was\n  not. This was notable for the Xcode 13 RC. This fix adds a #canImport check\n  for the `_Concurrency` module that was not available before the macOS 12 SDK.\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 13.0.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.2-13.0.\n\n10.15.0 Release notes (2021-09-10)\n=============================================================\n\n### Enhancements\n\n* Add `async` versions of the  `Realm.asyncOpen` and `App.login` methods.\n* ThreadSafeReference no longer pins the source transaction version for\n  anything other than a Results created by filtering a collection. This means\n  that holding on to thread-safe references to other things (such as Objects)\n  will no longer cause file size growth.\n* A ThreadSafeReference to a Results backed by a collection can now be created\n  inside a write transaction as long as the collection was not created in the\n  current write transaction.\n* Synchronized Realms are no longer opened twice, cutting the address space and\n  file descriptors used in half.\n  ([Core #4839](https://github.com/realm/realm-core/pull/4839))\n* When using the SwiftUI helper types (@ObservedRealmObject and friends) to\n  bind to an Equatable property, self-assignment no longer performs a pointless\n  write transaction. SwiftUI appears to sometimes call a Binding's set function\n  multiple times for a single UI action, so this results in significantly fewer\n  writes being performed.\n\n### Fixed\n\n* Adding an unmanaged object to a Realm that was declared with\n  `@StateRealmObject` would throw the exception `\"Cannot add an object with\n  observers to a Realm\"`.\n* The `RealmCollectionChange` docs refered to indicies in modifications as the\n  'new' collection. This is incorrect and the docs now state that modifications\n  refer to the previous version of the collection. ([Cocoa #7390](https://github.com/realm/realm-swift/issues/7390))\n* Fix crash in `RLMSyncConfiguration.initWithUser` error mapping when a user is disabled/deleted from MongoDB Realm dashboard.\n  ([Cocoa #7399](https://github.com/realm/realm-swift/issues/7399), since v10.0.0)\n* If the application crashed at the wrong point when logging a user in, the\n  next run of the application could hit the assertion failure \"m_state ==\n  SyncUser::State::LoggedIn\" when a synchronized Realm is opened with that\n  user. ([Core #4875](https://github.com/realm/realm-core/issues/4875), since v10.0.0)\n* The `keyPaths:` parameter to `@ObservedResults` did not work (since v10.12.0).\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.5.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.2-13.0 beta 5.\n\n### Internal\n\n* Upgraded realm-core from 11.3.1 to 11.4.1\n\n10.14.0 Release notes (2021-09-03)\n=============================================================\n\n### Enhancements\n\n* Add additional `observe` methods for Objects and RealmCollections which take\n  a `PartialKeyPath` type key path parameter.\n* The release package once again contains Xcode 13 binaries.\n* `PersistableEnum` properties can now be indexed or used as the primary key if\n  the RawValue is an indexable or primary key type.\n\n### Fixed\n\n* `Map<Key, Value>` did not conform to `Codable`.\n  ([Cocoa #7418](https://github.com/realm/realm-swift/pull/7418), since v10.8.0)\n* Fixed \"Invalid data type\" assertion failure in the sync client when the\n  client recieved an AddColumn instruction from the server for an AnyRealmValue\n  property when that property already exists locally. ([Core #4873](https://github.com/realm/realm-core/issues/4873), since v10.8.0)\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.5.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.2-13.0 beta 5.\n\n### Internal\n\n* Upgraded realm-core from 11.3.0 to 11.3.1.\n\n10.13.0 Release notes (2021-08-26)\n=============================================================\n\n### Enhancements\n\n* Sync logs now contain information about what object/changeset was being applied when the exception was thrown.\n  ([Core #4836](https://github.com/realm/realm-core/issues/4836))\n* Added ServiceErrorCode for wrong username/password when using '`App.login`.\n  ([Core #7380](https://github.com/realm/realm-swift/issues/7380)\n\n### Fixed\n\n* Fix crash in `MongoCollection.findOneDocument(filter:)` that occurred when no results were\n  found for a given filter.\n  ([Cocoa #7380](https://github.com/realm/realm-swift/issues/7380), since v10.0.0)\n* Some of the SwiftUI property wrappers incorrectly required objects to conform\n  to ObjectKeyIdentifiable rather than Identifiable.\n  ([Cocoa #7372](https://github.com/realm/realm-swift/issues/7372), since v10.6.0)\n* Work around Xcode 13 beta 3+ shipping a broken swiftinterface file for Combine on 32-bit iOS.\n  ([Cocoa #7368](https://github.com/realm/realm-swift/issues/7368))\n* Fixes history corruption when replacing an embedded object in a list.\n  ([Core #4845](https://github.com/realm/realm-core/issues/4845)), since v10.0.0)\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.5.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.2-13.0 beta 5.\n\n### Internal\n\n* Upgraded realm-core from 11.2.0 to 11.3.0\n\n10.12.0 Release notes (2021-08-03)\n=============================================================\n\n### Enhancements\n\n* `Object.observe()` and `RealmCollection.observe()` now include an optional\n  `keyPaths` parameter which filters change notifications to those only\n  occurring on the provided key path or key paths. See method documentation\n  for extended detail on filtering behavior.\n* `ObservedResults<ResultsType>`  now includes an optional `keyPaths` parameter\n  which filters change notifications to those only occurring on the provided\n  key path or key paths. ex) `@ObservedResults(MyObject.self, keyPaths: [\"myList.property\"])`\n* Add two new property wrappers for opening a Realm asynchronously in a\n  SwiftUI View:\n    - `AsyncOpen` is a property wrapper that initiates Realm.asyncOpen\n       for the current user, notifying the view when there is a change in Realm asyncOpen state.\n    - `AutoOpen` behaves similarly to `AsyncOpen`, but in the case of no internet\n       connection this will return an opened realm.\n* Add `EnvironmentValues.partitionValue`. This value can be injected into any view using one of\n  our new property wrappers `AsyncOpen` and `AutoOpen`:\n  `MyView().environment(\\.partitionValue, \"partitionValue\")`.\n* Shift more of the work done when first initializing a collection notifier to\n  the background worker thread rather than doing it on the main thread.\n\n### Fixed\n\n* `configuration(partitionValue: AnyBSON)` would always set a nil partition value\n  for the user sync configuration.\n* Decoding a `@Persisted` property would incorrectly throw a `DecodingError.keyNotFound`\n  for an optional property if the key is missing.\n  ([Cocoa #7358](https://github.com/realm/realm-swift/issues/7358), since v10.10.0)\n* Fixed a symlink which prevented Realm from building on case sensitive file systems.\n  ([#7344](https://github.com/realm/realm-swift/issues/7344), since v10.8.0)\n* Removing a change callback from a Results would sometimes block the calling\n  thread while the query for that Results was running on the background worker\n  thread (since v10.11.0).\n* Object observers did not handle the object being deleted properly, which\n  could result in assertion failures mentioning \"m_table\" in ObjectNotifier\n  ([Core #4824](https://github.com/realm/realm-core/issues/4824), since v10.11.0).\n* Fixed a crash when delivering notifications over a nested hierarchy of lists\n  of Mixed that contain links. ([Core #4803](https://github.com/realm/realm-core/issues/4803), since v10.8.0)\n* Fixed a crash when an object which is linked to by a Mixed is deleted via\n  sync. ([Core #4828](https://github.com/realm/realm-core/pull/4828), since v10.8.0)\n* Fixed a rare crash when setting a mixed link for the first time which would\n  trigger if the link was to the same table and adding the backlink column\n  caused a BPNode split. ([Core #4828](https://github.com/realm/realm-core/pull/4828), since v10.8.0)\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.5.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.2-13.0 beta 4. On iOS Xcode 13 beta 2 is the latest supported\n  version due to betas 3 and 4 having a broken Combine.framework.\n\n### Internal\n\n* Upgraded realm-core from v11.1.1 to v11.2.0\n\n10.11.0 Release notes (2021-07-22)\n=============================================================\n\n### Enhancements\n\n* Add type safe methods for:\n    - `RealmCollection.min(of:)`\n    - `RealmCollection.max(of:)`\n    - `RealmCollection.average(of:)`\n    - `RealmCollection.sum(of:)`\n    - `RealmCollection.sorted(by:ascending:)`\n    - `RealmKeyedCollection.min(of:)`\n    - `RealmKeyedCollection.max(of:)`\n    - `RealmKeyedCollection.average(of:)`\n    - `RealmKeyedCollection.sum(of:)`\n    - `RealmKeyedCollection.sorted(by:ascending:)`\n    - `Results.distinct(by:)`\n    - `SortDescriptor(keyPath:ascending:)\n\n  Calling these methods can now be done via Swift keyPaths, like so:\n  ```swift\n  class Person: Object {\n      @Persisted var name: String\n      @Persisted var age: Int\n  }\n\n  let persons = realm.objects(Person.self)\n  persons.min(of: \\.age)\n  persons.max(of: \\.age)\n  persons.average(of: \\.age)\n  persons.sum(of: \\.age)\n  persons.sorted(by: \\.age)\n  persons.sorted(by: [SortDescriptor(keyPath: \\Person.age)])\n  persons.distinct(by: [\\Person.age])\n  ```\n* Add `List.objects(at indexes:)` in Swift and `[RLMCollection objectsAtIndexes:]` in Objective-C.\n  This allows you to select elements in a collection with a given IndexSet ([#7298](https://github.com/realm/realm-swift/issues/7298)).\n* Add `App.emailPasswordAuth.retryCustomConfirmation(email:completion:)` and `[App.emailPasswordAuth retryCustomConfirmation:completion:]`.\n  These functions support retrying a [custom confirmation](https://docs.mongodb.com/realm/authentication/email-password/#run-a-confirmation-function) function.\n* Improve performance of creating collection notifiers for Realms with a complex schema.\n  This means that the first run of a query or first call to observe() on a collection will\n  do significantly less work on the calling thread.\n* Improve performance of calculating changesets for notifications, particularly\n  for deeply nested object graphs and objects which have List or Set properties\n  with small numbers of objects in the collection.\n\n### Fixed\n\n* `RealmProperty<T?>` would crash when decoding a `null` json value.\n  ([Cocoa #7323](https://github.com/realm/realm-swift/issues/7323), since v10.8.0)\n* `@Persisted<T?>` would crash when decoding a `null` value.\n  ([#7332](https://github.com/realm/realm-swift/issues/7332), since v10.10.0).\n* Fixed an issue where `Realm.Configuration` would be set after views have been laid out\n  when using `.environment(\\.realmConfiguration, ...)` in SwiftUI. This would cause issues if you are\n  required to bump your schema version and are using `@ObservedResults`.\n* Sync user profiles now correctly persist between runs.\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.5.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.2-13.0 beta 3. Note that this release does not contain Xcode 13\n  beta binaries as beta 3 does not include a working version of\n  Combine.framework for iOS.\n\n### Internal\n\n* Upgraded realm-core from 11.0.4 to 11.1.1\n\n10.10.0 Release notes (2021-07-07)\n=============================================================\n\n### Enhancements\n\n* Add a new property wrapper-based declaration syntax for properties on Realm\n  Swift object classes. Rather than using `@objc dynamic` or the\n  `RealmProperty` wrapper type, properties can now be declared with `@Persisted\n  var property: T`, where `T` is any of the supported property types, including\n  optional numbers and collections. This has a few benefits:\n\n    - All property types are now declared in the same way. No more remembering\n      that this type requires `@objc dynamic var` while this other type\n      requires `let`, and the `RealmProperty` or `RealmOptional` helper is no\n      longer needed for types not supported by Objective-C.\n    - No more overriding class methods like `primaryKey()`,\n      `indexedProperties()` or `ignoredProperties()`. The primary key and\n      indexed flags are set directly in the property declaration with\n      `@Persisted(primaryKey: true) var _id: ObjectId` or `@Persisted(indexed:\n      true) var indexedProperty: Int`. If any `@Persisted` properties are present,\n      all other properties are implicitly ignored.\n    - Some performance problems have been fixed. Declaring collection\n      properties as `let listProp = List<T>()` resulted in the `List<T>` object\n      being created eagerly when the parent object is read, which could cause\n      performance problems if a class has a large number of `List` or\n      `RealmOptional` properties. `@Persisted var list: List<T>` allows us to\n      defer creating the `List<T>` until it's accessed, improving performance\n      when looping over objects and using only some of the properties.\n\n      Similarly, `let _id = ObjectId.generate()` was a convenient way to\n      declare a sync-compatible primary key, but resulted in new ObjectIds\n      being generated in some scenarios where the value would never actually be\n      used. `@Persisted var _id: ObjectId` has the same behavior of\n      automatically generating primary keys, but allows us to only generate it\n      when actually needed.\n    - More types of enums are supported. Any `RawRepresentable` enum whose raw\n      type is a type supported by Realm can be stored in an `@Persisted`\n      project, rather than just `@objc` enums. Enums must be declared as\n      conforming to the `PersistableEnum` protocol, and still cannot (yet) be\n      used in collections.\n    - `willSet` and `didSet` can be used with `@Persistable` properties, while\n      they previously did not work on managed Realm objects.\n\n  While we expect the switch to the new syntax to be very simple for most\n  users, we plan to support the existing objc-based declaration syntax for the\n  foreseeable future. The new style and old style cannot be mixed within a\n  single class, but new classes can use the new syntax while existing classes\n  continue to use the old syntax. Updating an existing class to the new syntax\n  does not change what data is stored in the Realm file and so does not require\n  a migration (as long as you don't also change the schema in the process, of\n  course).\n* Add `Map.merge()`, which adds the key-value pairs from another Map or\n  Dictionary to the map.\n* Add `Map.asKeyValueSequence()` which returns an adaptor that can be used with\n  generic functions that operate on Dictionary-styled sequences.\n\n### Fixed\n* AnyRealmValue enum values are now supported in more places when creating\n  objects.\n* Declaring a property as `RealmProperty<AnyRealmValue?>` will now report an\n  error during schema discovery rather than doing broken things when the\n  property is used.\n* Observing the `invalidated` property of `RLMDictionary`/`Map` via KVO did not\n  set old/new values correctly in the notification (since 10.8.0).\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.5.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.2-13.0 beta 2.\n\n10.9.0 Release notes (2021-07-01)\n=============================================================\n\n### Enhancements\n\n* Add `App.emailPasswordAuth.retryCustomConfirmation(email:completion:)` and\n  `[App.emailPasswordAuth retryCustomConfirmation:completion:]`. These\n  functions support retrying a [custom confirmation](https://docs.mongodb.com/realm/authentication/email-password/#run-a-confirmation-function)\n  function.\n* Improve performance of many Dictionary operations, especially when KVO is being used.\n\n### Fixed\n\n* Calling `-[RLMRealm deleteObjects:]` on a `RLMDictionary` cleared the\n  dictionary but did not actually delete the objects in the dictionary (since v10.8.0).\n* Rix an assertion failure when observing a `List<AnyRealmValue>` contains\n  object links. ([Core #4767](https://github.com/realm/realm-core/issues/4767), since v10.8.0)\n* Fix an assertion failure when observing a `RLMDictionary`/`Map` which links\n  to an object which was deleting by a different sync client.\n  ([Core #4770](https://github.com/realm/realm-core/pull/4770), since v10.8.0)\n* Fix an endless recursive loop that could cause a stack overflow when\n  computing changes on a set of objects which contained cycles.\n  ([Core #4770](https://github.com/realm/realm-core/pull/4770), since v10.8.0).\n* Hash collisions in dictionaries were not handled properly.\n  ([Core #4776](https://github.com/realm/realm-core/issues/4776), since v10.8.0).\n* Fix a crash after clearing a list or set of AnyRealmValue containing links to\n  objects ([Core #4774](https://github.com/realm/realm-core/issues/4774), since v10.8.0)\n* Trying to refresh a user token which had been revoked by an admin lead to an\n  infinite loop and then a crash. This situation now properly logs the user out\n  and reports an error. ([Core #4745](https://github.com/realm/realm-core/issues/4745), since v10.0.0).\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.5.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.2-13.0 beta 2.\n\n### Internal\n\n* Upgraded realm-core from v11.0.3 to v11.0.4\n\n10.8.1 Release notes (2021-06-22)\n=============================================================\n\n### Enhancements\n\n* Update Xcode 12.5 to Xcode 12.5.1.\n* Create fewer dynamic classes at runtime, improving memory usage and startup time slightly.\n\n### Fixed\n\n* Importing the Realm swift package produced several warnings about excluded\n  files not existing. Note that one warning will still remain after this change.\n  ([#7295](https://github.com/realm/realm-swift/issues/7295), since v10.8.0).\n* Update the root URL for the API docs so that the links go to the place where\n  new versions of the docs are being published.\n  ([#7299](https://github.com/realm/realm-swift/issues/7299), since v10.6.0).\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later. Note that this version of Realm Studio has not\n  yet been released at the time of this release.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.5.1.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.2-13.0 beta 1.\n\n10.8.0 Release notes (2021-06-14)\n=============================================================\n\nNOTE: This version upgrades the Realm file format version to add support for\nthe new data types and to adjust how primary keys are handled. Realm files\nopened will be automatically upgraded and cannot be read by versions older than\nv10.8.0. This upgrade should be a fairly fast one. Note that we now\nautomatically create a backup of the pre-upgrade Realm.\n\n### Enhancements\n\n* Add support for the `UUID` and `NSUUID` data types. These types can be used\n  for the primary key property of Object classes.\n* Add two new collection types to complement the existing `RLMArray`/`List` type:\n  - `RLMSet<T>` in Objective-C and `MutableSet<T>` in Swift are mutable\n    unordered collections of distinct objects, similar to the built-in\n    `NSMutableSet` and `Set`. The values in a set may be any non-collection\n    type which can be stored as a Realm property. Sets are guaranteed to never\n    contain two objects which compare equal to each other, including when\n    conflicting writes are merged by sync.\n  - `RLMDictionary<NSString *, T>` in Objective-C and `Map<String, T>` are\n    mutable key-value dictionaries, similar to the built-in\n    `NSMutableDictionary` and `Dictionary`. The values in a dictionary may be\n    any non-collection type which can be stored as a Realm property. The keys\n    must currently always be a string.\n* Add support for dynamically typed properties which can store a value of any\n  of the non-collection types supported by Realm, including Object subclasses\n  (but not EmbeddedObject subclasses). These are declared with\n  `@property id<RLMValue> propertyName;` in Objective-C and\n  `let propertyName = RealmProperty<AnyRealmValue>()` in Swift.\n\n### Fixed\n\n* Setting a collection with a nullable value type to null via one of the\n  dynamic interfaces would hit an assertion failure instead of clearing the\n  collection.\n* Fixed an incorrect detection of multiple incoming links in a migration when\n  changing a table to embedded and removing a link to it at the same time.\n  ([#4694](https://github.com/realm/realm-core/issues/4694) since v10.0.0-beta.2)\n* Fixed a divergent merge on Set when one client clears the Set and another\n  client inserts and deletes objects.\n  ([#4720](https://github.com/realm/realm-core/issues/4720))\n* Partially revert to pre-v5.0.0 handling of primary keys to fix a performance\n  regression. v5.0.0 made primary keys determine the position in the low-level\n  table where newly added objects would be inserted, which eliminated the need\n  for a separate index on the primary key. This made some use patterns slightly\n  faster, but also made some reasonable things dramatically slower.\n  ([#4522](https://github.com/realm/realm-core/issues/4522))\n* Fixed an incorrect detection of multiple incoming links in a migration when\n  changing a table to embedded and removing a link to it at the same time.\n  ([#4694](https://github.com/realm/realm-core/issues/4694) since v10.0.0-beta.2)\n* Fix collection notification reporting for modifications. This could be\n  observed by receiving the wrong indices of modifications on sorted or\n  distinct results, or notification blocks sometimes not being called when only\n  modifications have occured.\n  ([#4573](https://github.com/realm/realm-core/pull/4573) since v5.0.0).\n* Fix incorrect sync instruction emission when replacing an existing embedded\n  object with another embedded object.([Core #4740](https://github.com/realm/realm-core/issues/4740)\n\n### Deprecations\n\n* `RealmOptional<T>` has been deprecated in favor of `RealmProperty<T?>`.\n  `RealmProperty` is functionality identical to `RealmOptional` when storing\n  optional numeric types, but can also store the new `AnyRealmValue` type.\n\n### Compatibility\n\n* Realm Studio: 11.0.0 or later. Note that this version of Realm Studio has not\n  yet been released at the time of this release.\n* Carthage release for Swift is built with Xcode 12.5.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.2-13.0 beta 1.\n\n### Internal\n\n* Upgraded realm-core from v10.7.2 to v11.0.3\n\n10.8.0-beta.2 Release notes (2021-06-01)\n=============================================================\n\n### Enhancements\n\n* Add `RLMDictionary`/`Map<>` datatype. This is a Dictionary collection type used for storing key-value pairs in a collection.\n\n### Compatibility\n\n* Realm Studio: 11.0.0-beta.1 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.5.\n* CocoaPods: 1.10 or later.\n\n### Internal\n\n* Upgraded realm-core from v11.0.0-beta.4 to v11.0.0-beta.6\n\n10.8.0-beta.0 Release notes (2021-05-07)\n=============================================================\n\n### Enhancements\n\n* Add `RLMSet`/`MutableSet<>` datatype. This is a Set collection type used for storing distinct values in a collection.\n* Add support for `id<RLMValue>`/`AnyRealmValue`.\n* Add support for `UUID`/`NSUUID` data type.\n\n### Fixed\n\n* None.\n\n### Deprecations\n\n* `RealmOptional` has been deprecated in favor of `RealmProperty`.\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.4.\n* CocoaPods: 1.10 or later.\n\n### Internal\n\n* Upgraded realm-core from v10.7.2 to v10.8.0-beta.5\n\n10.7.7 Release notes (2021-06-10)\n=============================================================\n\nXcode 12.2 is now the minimum supported version.\n\n### Enhancements\n\n* Add Xcode 13 beta 1 binaries to the release package.\n\n### Fixed\n\n* Fix a runtime crash which happens in some Xcode version (Xcode < 12, reported\n  in Xcode 12.5), where SwiftUI is not weak linked by default. This fix only\n  works for Cocoapods projects.\n  ([#7234](https://github.com/realm/realm-swift/issues/7234)\n* Fix warnings when building with Xcode 13 beta 1.\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.5.\n* CocoaPods: 1.10 or later.\n* Xcode: 12.2-13.0 beta 1.\n\n10.7.6 Release notes (2021-05-13)\n=============================================================\n\n### Enhancements\n\n* Realms opened in read-only mode can now be invalidated (although it is\n  unlikely to be useful to do so).\n\n### Fixed\n\n* Fix an availability warning when building Realm. The code path which gave the\n  warning can not currently be hit, so this did not cause any runtime problems\n  ([#7219](https://github.com/realm/realm-swift/issues/7219), since 10.7.3).\n* Proactively check the expiry time on the access token and refresh it before\n  attempting to initiate a sync session. This prevents some error logs from\n  appearing on the client such as: \"ERROR: Connection[1]: Websocket: Expected\n  HTTP response 101 Switching Protocols, but received: HTTP/1.1 401\n  Unauthorized\" ([RCORE-473](https://jira.mongodb.org/browse/RCORE-473), since v10.0.0)\n* Fix a race condition which could result in a skipping notifications failing\n  to skip if several commits using notification skipping were made in\n  succession (since v5.0.0).\n* Fix a crash on exit inside TableRecycler which could happen if Realms were\n  open on background threads when the app exited.\n  ([Core #4600](https://github.com/realm/realm-core/issues/4600), since v5.0.0)\n* Fix errors related to \"uncaught exception in notifier thread:\n  N5realm11KeyNotFoundE: No such object\" which could happen on sycnronized\n  Realms if a linked object was deleted by another client.\n  ([JS #3611](https://github.com/realm/realm-js/issues/3611), since v10.0.0).\n* Reading a link to an object which has been deleted by a different client via\n  a string-based interface (such as value(forKey:) or the subscript operator on\n  DynamicObject) could return an invalid object rather than nil.\n  ([Core #4687](https://github.com/realm/realm-core/pull/4687), since v10.0.0)\n* Recreate the sync metadata Realm if the encryption key for it is missing from\n  the keychain rather than crashing. This can happen if a device is restored\n  from an unencrypted backup, which restores app data but not the app's\n  keychain entries, and results in all cached logics for sync users being\n  discarded but no data being lost.\n  [Core #4285](https://github.com/realm/realm-core/pull/4285)\n* Thread-safe references can now be created for read-only Realms.\n  ([#5475](https://github.com/realm/realm-swift/issues/5475)).\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.5.\n* CocoaPods: 1.10 or later.\n\n### Internal\n\n* Upgraded realm-core from v10.6.0 to v10.7.2\n\n10.7.5 Release notes (2021-05-07)\n=============================================================\n\n### Fixed\n\n* Iterating over frozen collections on multiple threads at the same time could\n  throw a \"count underflow\" NSInternalInconsistencyException.\n  ([#7237](https://github.com/realm/realm-swift/issues/7237), since v5.0.0).\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.5.\n* CocoaPods: 1.10 or later.\n\n10.7.4 Release notes (2021-04-26)\n=============================================================\n\n### Enhancements\n\n* Add Xcode 12.5 binaries to the release package.\n\n### Fixed\n\n* Add the Info.plist file to the XCFrameworks in the Carthage xcframwork\n  package ([#7216](https://github.com/realm/realm-swift/issues/7216), since 10.7.3).\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.5.\n* CocoaPods: 1.10 or later.\n\n10.7.3 Release notes (2021-04-22)\n=============================================================\n\n### Enhancements\n\n* Package a prebuilt XCFramework for Carthage. Carthage 0.38 and later will\n  download this instead of the old frameworks when using `--use-xcframeworks`.\n* We now make a backup of the realm file prior to any file format upgrade. The\n  backup is retained for 3 months. Backups from before a file format upgrade\n  allows for better analysis of any upgrade failure. We also restore a backup,\n  if a) an attempt is made to open a realm file whith a \"future\" file format\n  and b) a backup file exist that fits the current file format.\n  ([Core #4166](https://github.com/realm/realm-core/pull/4166))\n* The error message when the intial steps of opening a Realm file fails is now\n  more descriptive.\n* Make conversion of Decimal128 to/from string work for numbers with more than\n  19 significant digits. This means that Decimal128's initializer which takes a\n  string will now never throw, as it previously threw only for out-of-bounds\n  values. The initializer is still marked as `throws` for\n  backwards compatibility.\n  ([#4548](https://github.com/realm/realm-core/issues/4548))\n\n### Fixed\n\n* Adjust the header paths for the podspec to avoid accidentally finding a file\n  which isn't part of the pod that produced warnings when importing the\n  framework. ([#7113](https://github.com/realm/realm-swift/issues/7113), since 10.5.2).\n* Fixed a crash that would occur when observing unmanaged Objects in multiple\n  views in SwiftUI. When using `@StateRealmObject` or `@ObservedObject` across\n  multiple views with an unmanaged object, each view would subscribe to the\n  object. As each view unsubscribed (generally when trailing back through the\n  view stack), our propertyWrappers would attempt to remove the KVOs for each\n  cancellation, when it should only be done once. We now correctly remove KVOs\n  only once. ([#7131](https://github.com/realm/realm-swift/issues/7131))\n* Fixed `isInvalidated` not returning correct value after object deletion from\n  Realm when using a custom schema. The object's Object Schema was not updated\n  when the object was added to the realm. We now correctly update the object\n  schema when adding it to the realm.\n  ([#7181](https://github.com/realm/realm-swift/issues/7181))\n* Syncing large Decimal128 values would cause \"Assertion failed: cx.w[1] == 0\"\n  ([Core #4519](https://github.com/realm/realm-core/issues/4519), since v10.0.0).\n* Potential/unconfirmed fix for crashes associated with failure to memory map\n  (low on memory, low on virtual address space). For example\n  ([#4514](https://github.com/realm/realm-core/issues/4514), since v5.0.0).\n* Fix assertion failures such as \"!m_notifier_skip_version.version\" or\n  \"m_notifier_sg->get_version() + 1 == new_version.version\" when performing\n  writes inside change notification callbacks. Previously refreshing the Realm\n  by beginning a write transaction would skip delivering notifications, leaving\n  things in an inconsistent state. Notifications are now delivered recursively\n  when needed instead. ([Cocoa #7165](https://github.com/realm/realm-swift/issues/7165)).\n* Fix collection notification reporting for modifications. This could be\n  observed by receiving the wrong indices of modifications on sorted or\n  distinct results, or notification blocks sometimes not being called when only\n  modifications have occured.\n  ([#4573](https://github.com/realm/realm-core/pull/4573) since v5.0.0).\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.4.\n* CocoaPods: 1.10 or later.\n\n### Internal\n\n* Upgraded realm-core from v10.5.5 to v10.6.0\n* Add additional debug validation to file map management that will hopefully\n  catch cases where we unmap something which is still in use.\n\n10.7.2 Release notes (2021-03-08)\n=============================================================\n\n### Fixed\n\n* During integration of a large amount of data from the server, you may get\n  \"Assertion failed: !fields.has_missing_parent_update()\"\n  ([Core #4497](https://github.com/realm/realm-core/issues/4497), since v6.0.0)\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.4.\n* CocoaPods: 1.10 or later.\n\n### Internal\n\n* Upgraded realm-core from v10.5.4 to v10.5.5\n\n10.7.1 Release notes (2021-03-05)\n=============================================================\n\n### Fixed\n\n* Queries of the form \"a.b.c == nil\" would match objects where `b` is `nil` if\n  `c` did not have an index and did not if `c` was indexed. Both will now match\n  to align with NSPredicate's behavior. ([Core #4460]https://github.com/realm/realm-core/pull/4460), since 4.3.0).\n* Restore support for upgrading files from file format 5 (Realm Cocoa 1.x).\n  ([Core #7089](https://github.com/realm/realm-swift/issues/7089), since v5.0.0)\n* On 32bit devices you may get exception with \"No such object\" when upgrading\n  to v10.* ([Java #7314](https://github.com/realm/realm-java/issues/7314), since v5.0.0)\n* The notification worker thread would rerun queries after every commit rather\n  than only commits which modified tables which could effect the query results\n  if the table had any outgoing links to tables not used in the query.\n  ([Core #4456](https://github.com/realm/realm-core/pull/4456), since v5.0.0).\n* Fix \"Invalid ref translation entry [16045690984833335023, 78187493520]\"\n  assertion failure which could occur when using sync or multiple processes\n  writing to a single Realm file.\n  ([#7086](https://github.com/realm/realm-swift/issues/7086), since v5.0.0).\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.4.\n* CocoaPods: 1.10 or later.\n\n### Internal\n\n* Upgraded realm-core from v10.5.3 to v10.5.4\n\n10.7.0 Release notes (2021-02-23)\n=============================================================\n\n### Enhancements\n\n* Add support for some missing query operations on data propertys:\n  - Data properties can be compared to other data properties\n    (e.g. \"dataProperty1 == dataProperty2\").\n  - Case and diacritic-insensitive queries can be performed on data properties.\n    This will only have meaningful results if the data property contains UTF-8\n    string data.\n  - Data properties on linked objects can be queried\n    (e.g. \"link.dataProperty CONTAINS %@\")\n* Implement queries which filter on lists other than object links (lists of\n  objects were already supported). All supported operators for normal\n  properties are now supported for lists (e.g. \"ANY intList = 5\" or \"ANY\n  stringList BEGINSWITH 'prefix'\"), as well as aggregate operations on the\n  lists (such as \"intArray.@sum > 100\").\n* Performance of sorting on more than one property has been improved.\n  Especially important if many elements match on the first property. Mitigates\n  ([#7092](https://github.com/realm/realm-swift/issues/7092))\n\n### Fixed\n\n* Fixed a bug that prevented an object type with incoming links from being\n  marked as embedded during migrations. ([Core #4414](https://github.com/realm/realm-core/pull/4414))\n* The Realm notification listener thread could sometimes hit the assertion\n  failure \"!skip_version.version\" if a write transaction was committed at a\n  very specific time (since v10.5.0).\n* Added workaround for a case where upgrading an old file with illegal string\n  would crash ([#7111](https://github.com/realm/realm-swift/issues/7111))\n* Fixed a conflict resolution bug related to the ArrayMove instruction, which\n  could sometimes cause an \"Invalid prior_size\" exception to prevent\n  synchronization (since v10.5.0).\n* Skipping a change notification in the first write transaction after the\n  observer was added could potentially fail to skip the notification (since v10.5.1).\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.4.\n* CocoaPods: 1.10 or later.\n\n### Internal\n\n* Upgraded realm-core from v10.5.0 to v10.5.3\n\n10.6.0 Release notes (2021-02-15)\n=============================================================\n\n### Enhancements\n\n* Add `@StateRealmObject` for SwiftUI support. This property wrapper type instantiates an observable object on a View.\n  Use in place of `SwiftUI.StateObject` for Realm `Object`, `List`, and `EmbeddedObject` types.\n* Add `@ObservedRealmObject` for SwiftUI support. This property wrapper type subscribes to an observable object\n  and invalidates a view whenever the observable object changes. Use in place of `SwiftUI.ObservedObject` for\n  Realm `Object`, `List`, or `EmbeddedObject` types.\n* Add `@ObservedResults` for SwiftUI support. This property wrapper type retrieves results from a Realm.\n  The results use the realm configuration provided by the environment value `EnvironmentValues.realmConfiguration`.\n* Add `EnvironmentValues.realm` and `EnvironmentValues.realmConfiguration` for `Realm`\n  and `Realm.Configuration` types respectively. Values can be injected into views using the `View.environment` method, e.g., `MyView().environment(\\.realmConfiguration, Realm.Configuration(fileURL: URL(fileURLWithPath: \"myRealmPath.realm\")))`.\n  The value can then be declared on the example `MyView` as `@Environment(\\.realm) var realm`.\n* Add `SwiftUI.Binding` extensions where `Value` is of type `Object`, `List`, or `EmbeddedObject`.\n  These extensions expose methods for wrapped write transactions, to avoid boilerplate within\n  views, e.g., `TextField(\"name\", $personObject.name)` or `$personList.append(Person())`.\n* Add `Object.bind` and `EmbeddedObject.bind` for SwiftUI support. This allows you to create\n  bindings of realm properties when a propertyWrapper is not available for you to do so, e.g., `TextField(\"name\", personObject.bind(\\.name))`.\n* The Sync client now logs error messages received from server rather than just\n  the size of the error message.\n* Errors returned from the server when sync WebSockets get closed are now\n  captured and surfaced as a SyncError.\n* Improve performance of sequential reads on a Results backed directly by a\n  Table (i.e. `realm.object(ClasSName.self)` with no filter/sort/etc.) by 50x.\n* Orphaned embedded object types which are not linked to by any top-level types\n  are now better handled. Previously the server would reject the schema,\n  resulting in delayed and confusing error reporting. Explicitly including an\n  orphan in `objectTypes` is now immediately reported as an error when opening\n  the Realm, and orphans are automatically excluded from the auto-discovered\n  schema when `objectTypes` is not specified.\n\n### Fixed\n\n* Reading from a Results backed directly by a Table (i.e.\n  `realm.object(ClasSName.self)` with no filter/sort/etc.) would give incorrect\n  results if the Results was constructed and accessed before creating a new\n  object with a primary key less than the smallest primary key which previously\n  existed. ([#7014](https://github.com/realm/realm-swift/issues/7014), since v5.0.0).\n* During synchronization you might experience crash with\n  \"Assertion failed: ref + size <= next->first\".\n  ([Core #4388](https://github.com/realm/realm-core/issues/4388))\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.4.\n* CocoaPods: 1.10 or later.\n\n### Internal\n\n* Upgraded realm-core from v10.4.0 to v10.5.0\n\n10.5.2 Release notes (2021-02-09)\n=============================================================\n\n### Enhancements\n\n* Add support for \"thawing\" objects. `Realm`, `Results`, `List` and `Object`\n  now have `thaw()` methods which return a live copy of the frozen object. This\n  enables app behvaior where a frozen object can be made live again in order to\n  mutate values. For example, first freezing an object passed into UI view,\n  then thawing the object in the view to update values.\n* Add Xcode 12.4 binaries to the release package.\n\n### Fixed\n\n* Inserting a date into a synced collection via `AnyBSON.datetime(...)` would\n  be of type `Timestamp` and not `Date`. This could break synced objects with a\n  `Date` property.\n  ([#6654](https://github.com/realm/realm-swift/issues/6654), since v10.0.0).\n* Fixed an issue where creating an object after file format upgrade may fail\n  with assertion \"Assertion failed: lo() <= std::numeric_limits<uint32_t>::max()\"\n  ([#4295](https://github.com/realm/realm-core/issues/4295), since v5.0.0)\n* Allow enumerating objects in migrations with types which are no longer\n  present in the schema.\n* Add `RLMResponse.customStatusCode`. This fixes timeout exceptions that were\n  occurring with a poor connection. ([#4188](https://github.com/realm/realm-core/issues/4188))\n* Limit availability of ObjectKeyIdentifiable to platforms which support\n  Combine to match the change made in the Xcode 12.5 SDK.\n  ([#7083](https://github.com/realm/realm-swift/issues/7083))\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.4.\n* CocoaPods: 1.10 or later.\n\n### Internal\n\n* Upgraded realm-core from v10.3.3 to v10.4.0\n\n10.5.1 Release notes (2021-01-15)\n=============================================================\n\n### Enhancements\n\n* Add Xcode 12.3 binary to release package.\n* Add support for queries which have nil on the left side and a keypath on the\n  right side (e.g. \"nil == name\" rather than \"name == nil\" as was previously\n  required).\n\n### Fixed\n* Timeouts when calling server functions via App would sometimes crash rather\n  than report an error.\n* Fix a race condition which would lead to \"uncaught exception in notifier\n  thread: N5realm15InvalidTableRefE: transaction_ended\" and a crash when the\n  source Realm was closed or invalidated at a very specific time during the\n  first run of a collection notifier\n  ([#3761](https://github.com/realm/realm-core/issues/3761), since v5.0.0).\n* Deleting and recreating objects with embedded objects may fail.\n  ([Core PR #4240](https://github.com/realm/realm-core/pull/4240), since v10.0.0)\n* Fast-enumerating a List after deleting the parent object would crash with an\n  assertion failure rather than a more appropriate exception.\n  ([Core #4114](https://github.com/realm/realm-core/issues/4114), since v5.0.0).\n* Fix an issue where calling a MongoDB Realm Function would never be performed as the reference to the weak `User` was lost.\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.3.\n* CocoaPods: 1.10 or later.\n\n### Internal\n\n* Upgraded realm-core from v10.3.2 to v10.3.3\n\n10.5.0 Release notes (2020-12-14)\n=============================================================\n\n### Enhancements\n\n* MongoDB Realm is now supported when installing Realm via Swift Package Manager.\n\n### Fixed\n\n* The user identifier was added to the file path for synchronized Realms twice\n  and an extra level of escaping was performed on the partition value. This did\n  not cause functional problems, but made file names more confusing than they\n  needed to be. Existing Realm files will continue to be located at the old\n  path, while newly created files will be created at a shorter path. (Since v10.0.0).\n* Fix a race condition which could potentially allow queries on frozen Realms\n  to access an uninitialized structure for search indexes (since v5.0.0).\n* Fix several data races in App and SyncSession initialization. These could\n  possibly have caused strange errors the first time a synchronized Realm was\n  opened (since v10.0.0).\n* Fix a use of a dangling reference when refreshing a user’s custom data that\n  could lead to a crash (since v10.0.0).\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.2.\n* CocoaPods: 1.10 or later.\n\n### Internal\n\n* Upgraded realm-core from v10.1.4 to v10.3.2\n\n10.4.0 Release notes (2020-12-10)\n=============================================================\n\n### Enhancements\n\n* Add Combine support for App and User. These two types now have a\n  `objectWillChange` property that emits each time the state of the object has\n  changed (such as due to the user logging in or out). ([PR #6977](https://github.com/realm/realm-swift/pull/6977)).\n\n### Fixed\n\n* Integrating changesets from the server would sometimes hit the assertion\n  failure \"n != realm::npos\" inside Table::create_object_with_primary_key()\n  when creating an object with a primary key which previously had been used and\n  had incoming links. ([Core PR #4180](https://github.com/realm/realm-core/pull/4180), since v10.0.0).\n* The arm64 simulator slices were not actually included in the XCFramework\n  release package. ([PR #6982](https://github.com/realm/realm-swift/pull/6982), since v10.2.0).\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.2.\n* CocoaPods: 1.10 or later.\n\n### Internal\n\n* Upgraded realm-core from v10.1.3 to v10.1.4\n* Upgraded realm-sync from v10.1.4 to v10.1.5\n\n10.3.0 Release notes (2020-12-08)\n=============================================================\n\n### Enhancements\n\n* Add Google OpenID Connect Credentials, an alternative login credential to the\n  Google OAuth 2.0 credential.\n\n### Fixed\n\n* Fixed a bug that would prevent eventual consistency during conflict\n  resolution. Affected clients would experience data divergence and potentially\n  consistency errors as a result if they experienced conflict resolution\n  between cycles of Create-Erase-Create for objects with primary keys (since v10.0.0).\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.2.\n* CocoaPods: 1.10 or later.\n\n### Internal\n\n* Upgraded realm-sync from v10.1.3 to v10.1.4\n\n10.2.0 Release notes (2020-12-02)\n=============================================================\n\n### Enhancements\n\n* The prebuilt binaries are now packaged as XCFrameworks. This adds support for\n  Catalyst and arm64 simulators when using them to install Realm, removes the\n  need for the strip-frameworks build step, and should simplify installation.\n* The support functionality for using the Objective C API from Swift is now\n  included in Realm Swift and now includes all of the required wrappers for\n  MongoDB Realm types. In mixed Objective C/Swift projects, we recommend\n  continuing to use the Objective C types, but import both Realm and RealmSwift\n  in your Swift files.\n\n### Fixed\n\n* The user identifier was added to the file path for synchronized Realms twice\n  and an extra level of escaping was performed on the partition value. This did\n  not cause functional problems, but made file names more confusing than they\n  needed to be. Existing Realm files will continue to be located at the old\n  path, while newly created files will be created at a shorter path. (Since v10.0.0).\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.2.\n* CocoaPods: 1.10 or later.\n\n10.1.4 Release notes (2020-11-16)\n=============================================================\n\n### Enhancements\n\n* Add arm64 slices to the macOS builds.\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.2.\n* CocoaPods: 1.10 or later.\n\n### Internal\n\n* Upgraded realm-core from v10.0.1 to v10.1.3\n* Upgraded realm-sync from v10.0.1 to v10.1.3\n\n10.1.3 Release notes (2020-11-13)\n=============================================================\n\n### Enhancements\n\n* Add Xcode 12.2 binaries to the release package.\n\n### Fixed\n\n* Disallow setting\n  `RLMRealmConfiguration.deleteRealmIfMigrationNeeded`/`Realm.Config.deleteRealmIfMigrationNeeded`\n  when sync is enabled. This did not actually work as it does not delete the\n  relevant server state and broke in confusing ways ([PR #6931](https://github.com/realm/realm-swift/pull/6931)).\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.1.\n* CocoaPods: 1.10 or later.\n\n10.1.2 Release notes (2020-11-06)\n=============================================================\n\n### Enhancements\n\n* Some error states which previously threw a misleading \"NoSuchTable\" exception\n  now throw a more descriptive exception.\n\n### Fixed\n\n* One of the Swift packages did not have the minimum deployment target set,\n  resulting in errors when archiving an app which imported Realm via SPM.\n* Reenable filelock emulation on watchOS so that the OS does not kill the app\n  when it is suspended while a Realm is open on watchOS 7 ([#6861](https://github.com/realm/realm-swift/issues/6861), since v5.4.8\n* Fix crash in case insensitive query on indexed string columns when nothing\n  matches ([#6836](https://github.com/realm/realm-swift/issues/6836), since v5.0.0).\n* Null values in a `List<Float?>` or `List<Double?>` were incorrectly treated\n  as non-null in some places. It is unknown if this caused any functional\n  problems when using the public API. ([Core PR #3987](https://github.com/realm/realm-core/pull/3987), since v5.0.0).\n* Deleting an entry in a list in two different clients could end deleting the\n  wrong entry in one client when the changes are merged (since v10.0.0).\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.1.\n* CocoaPods: 1.10 or later.\n\n### Internal\n\n* Upgraded realm-core from v10.0.0 to v10.1.1\n* Upgraded realm-sync from v10.0.0 to v10.1.1\n\n10.1.1 Release notes (2020-10-27)\n=============================================================\n\n### Enhancements\n\n* Set the minimum CocoaPods version in the podspec so that trying to install\n  with older versions gives a more useful error ([PR #6892](https://github.com/realm/realm-swift/pull/6892)).\n\n### Fixed\n\n* Embedded objects could not be marked as `ObjectKeyIdentifable`\n  ([PR #6890](https://github.com/realm/realm-swift/pull/6890), since v10.0.0).\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.1.\n* CocoaPods: 1.10 or later.\n\n10.1.0 Release notes (2020-10-22)\n=============================================================\n\nCocoaPods 1.10 or later is now required to install Realm.\n\n### Enhancements\n\n* Throw an exception for Objects that have none of its properties marked with @objc.\n* Mac Catalyst and arm64 simulators are now supported when integrating via Cocoapods.\n* Add Xcode 12.1 binaries to the release package.\n* Add Combine support for `Realm.asyncOpen()`.\n\n### Fixed\n\n* Implement precise and unbatched notification of sync completion events. This\n  avoids a race condition where an earlier upload completion event will notify\n  a later waiter whose changes haven't been uploaded yet.\n  ([#1118](https://github.com/realm/realm-object-store/pull/1118)).\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.1.\n\n10.0.0 Release notes (2020-10-16)\n=============================================================\n\nThis release is functionally identical to v10.0.0-rc.2.\n\nNOTE: This version upgrades the Realm file format version to add support for\nnew data types. Realm files opened will be automatically upgraded and cannot be\nread by versions older than v10.0.0.\n\n### Breaking Changes\n\n* Rename Realm.Publishers to RealmPublishers to avoid confusion with Combine.Publishers.\n* Remove `[RLMSyncManager shared]`. This is now instatiated as a property on App/RLMApp.\n* `RLMSyncManager.pinnedCertificatePaths` has been removed.\n* Classes `RLMUserAccountInfo` & `RLMUserInfo` (swift: `UserInfo`, `UserAccountInfo`) have been removed.\n* `RLMSyncUser`/`SyncUser` has been renamed to `RLMUser`/`User`.\n* We no longer support Realm Cloud (legacy), but instead the new \"MongoDB\n  Realm\" Cloud. MongoDB Realm is a serverless platform that enables developers\n  to quickly build applications without having to set up server infrastructure.\n  MongoDB Realm is built on top of MongoDB Atlas, automatically integrating the\n  connection to your database.\n* Remove support for Query-based sync, including the configuration parameters\n  and the `RLMSyncSubscription` and `SyncSubscription` types ([#6437](https://github.com/realm/realm-swift/pull/6437)).\n* Remove everything related to sync permissions, including both the path-based\n  permission system and the object-level privileges for query-based sync.\n  Permissions are now configured via MongoDB Atlas.\n  ([#6445](https://github.com/realm/realm-swift/pulls/6445))\n* Remove support for Realm Object Server.\n* Non-embedded objects in synchronized Realms must always have a primary key\n  named \"_id\".\n* All Swift callbacks for asynchronous operations which can fail are now passed\n  a `Result<Value, Error>` parameter instead of two separate `Value?` and\n  `Error?` parameters.\n\n### Enhancements\n\n* Add support for next generation sync. Support for syncing to MongoDB instead\n  of Realm Object Server. Applications must be created at realm.mongodb.com\n* The memory mapping scheme for Realm files has changed to better support\n  opening very large files.\n* Add support for the ObjectId data type. This is an automatically-generated\n  unique identifier similar to a GUID or a UUID.\n  ([PR #6450](https://github.com/realm/realm-swift/pull/6450)).\n* Add support for the Decimal128 data type. This is a 128-bit IEEE 754 decimal\n  floating point number similar to NSDecimalNumber.\n  ([PR #6450](https://github.com/realm/realm-swift/pull/6450)).\n* Add support for embedded objects. Embedded objects are objects which are\n  owned by a single parent object, and are deleted when that parent object is\n  deleted. They are defined by subclassing `EmbeddedObject` /\n  `RLMEmbeddedObject` rather than `Object` / `RLMObject`.\n* Add `-[RLMUser customData]`/`User.customData`. Custom data is\n  configured in your MongoDB Realm App.\n* Add `-[RLMUser callFunctionNamed:arguments:completion:]`/`User.functions`.\n  This is the entry point for calling Remote MongoDB Realm functions. Functions\n  allow you to define and execute server-side logic for your application.\n  Functions are written in modern JavaScript (ES6+) and execute in a serverless\n  manner. When you call a function, you can dynamically access components of\n  the current application as well as information about the request to execute\n  the function and the logged in user that sent the request.\n* Add `-[RLMUser mongoClientWithServiceName:]`/`User.mongoClient`. This is\n  the entry point for calling your Remote MongoDB Service. The read operations\n  are `-[RLMMongoCollection findWhere:completion:]`, `-[RLMMongoCollection\n  countWhere:completion:]`and `-[RLMMongoCollection\n  aggregateWithPipeline:completion:]`. The write operations are\n  `-[RLMMongoCollection insertOneDocument:completion:]`, `-[RLMMongoCollection\n  insertManyDocuments:completion:]`, `-[RLMMongoCollection\n  updateOneDocument:completion:]`, `-[RLMMongoCollection\n  updateManyDocuments:completion:]`, `-[RLMMongoCollection\n  deleteOneDocument:completion:]`, and `-[RLMMongoCollection\n  deleteManyDocuments:completion:]`. If you are already familiar with MongoDB\n  drivers, it is important to understand that the remote MongoCollection only\n  provides access to the operations available in MongoDB Realm.\n* Obtaining a Realm configuration from a user is now done with `[RLMUser\n  configurationWithPartitionValue:]`/`User.configuration(partitionValue:)`.\n  Partition values can currently be of types `String`, `Int`, or `ObjectId`,\n  and fill a similar role to Realm URLs did with Realm Cloud.  The main\n  difference is that partitions are meant to be more closely associated with\n  your data.  For example, if you are running a `Dog` kennel, and have a field\n  `breed` that acts as your partition key, you could open up realms based on\n  the breed of the dogs.\n* Add ability to stream change events on a remote MongoDB collection with\n  `[RLMMongoCollection watch:delegate:delegateQueue:]`,\n  `MongoCollection.watch(delegate:)`. When calling `watch(delegate:)` you will be\n  given a `RLMChangeStream` (`ChangeStream`) which can be used to end watching\n  by calling `close()`. Change events can also be streamed using the\n  `MongoCollection.watch` Combine publisher that will stream change events each\n  time the remote MongoDB collection is updated.\n* Add the ability to listen for when a Watch Change Stream is opened when using\n  Combine. Use `onOpen(event:)` directly after opening a `WatchPublisher` to\n  register a callback to be invoked once the change stream is opened.\n* Objects with integer primary keys no longer require a separate index for the\n* primary key column, improving insert performance and slightly reducing file\n  size.\n\n### Compatibility\n\n* Realm Studio: 10.0.0 or later.\n* Carthage release for Swift is built with Xcode 12\n\n### Internal\n\n* Upgraded realm-core from v6.1.4 to v10.0.0\n* Upgraded realm-sync from v5.0.29 to v10.0.0\n\n10.0.0-rc.2 Release notes (2020-10-15)\n=============================================================\n\n### Enhancements\n\n* Add the ability to listen for when a Watch Change Stream is opened when using\n  Combine. Use `onOpen(event:)` directly after opening a `WatchPublisher` to\n  register a callback to be invoked once the change stream is opened.\n\n### Breaking Changes\n\n* The insert operations on Mongo collections now report the inserted documents'\n  IDs as BSON rather than ObjectId.\n* Embedded objects can no longer form cycles at the schema level. For example,\n  type A can no longer have an object property of type A, or an object property\n  of type B if type B links to type A. This was always rejected by the server,\n  but previously was allowed in non-synchronized Realms.\n* Primary key properties are once again marked as being indexed. This reflects\n  an internal change to how primary keys are handled that should not have any\n  other visible effects.\n* Change paired return types from Swift completion handlers to return `Result<Value, Error>`.\n* Adjust how RealmSwift.Object is defined to add support for Swift Library\n  Evolution mode. This should normally not have any effect, but you may need to\n  add `override` to initializers of object subclasses.\n* Add `.null` type to AnyBSON. This creates a distinction between null values\n  and properly absent BSON types.\n\n### Fixed\n\n* Set the precision correctly when serializing doubles in extended json.\n* Reading the `objectTypes` array from a Realm Configuration would not include\n  the embedded object types which were set in the array.\n* Reject loops in embedded objects as part of local schema validation rather\n  than as a server error.\n* Although MongoClient is obtained from a User, it was actually using the\n  User's App's current user rather than the User it was obtained from to make\n  requests.\n\n\nThis release also contains the following changes from 5.4.7 - 5.5.0\n\n### Enhancements\n\n* Add the ability to capture a NotificationToken when using a Combine publisher\n  that observes a Realm Object or Collection. The user will call\n  `saveToken(on:at:)` directly after invoking the publisher to use the feature.\n\n### Fixed\n\n* When using `Realm.write(withoutNotifying:)` there was a chance that the\n  supplied observation blocks would not be skipped when in a write transaction.\n  ([Object Store #1103](https://github.com/realm/realm-object-store/pull/1103))\n* Comparing two identical unmanaged `List<>`/`RLMArray` objects would fail.\n  ([#5665](https://github.com/realm/realm-swift/issues/5665)).\n* Case-insensitive equality queries on indexed string properties failed to\n  clear some internal state when rerunning the query. This could manifest as\n  duplicate results or \"key not found\" errors.\n  ([#6830](https://github.com/realm/realm-swift/issues/6830), [#6694](https://github.com/realm/realm-swift/issues/6694), since 5.0.0).\n* Equality queries on indexed string properties would sometimes throw \"key not\n  found\" exceptions if the hash of the string happened to have bit 62 set.\n  ([.NET #2025](https://github.com/realm/realm-dotnet/issues/2025), since v5.0.0).\n* Queries comparing non-optional int properties to nil would behave as if they\n  were comparing against zero instead (since v5.0.0).\n\n### Compatibility\n\n* File format: Generates Realms with format v12 (Reads and upgrades all previous formats)\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.\n\n### Internal\n\n* Upgraded realm-core from v10.0.0-beta.9 to v10.0.0\n* Upgraded realm-sync from v10.0.0-beta.14 to v10.0.0\n\n10.0.0-rc.1 Release notes (2020-10-01)\n=============================================================\n\n### Breaking Changes\n\n* Change the following methods on RLMUser to properties:\n  - `[RLMUser emailPasswordAuth]` => `RLMUser.emailPasswordAuth`\n  - `[RLMUser identities]` => `RLMUser.identities`\n  - `[RLMUser allSessions]` => `RLMUser.allSessions`\n  - `[RLMUser apiKeysAuth]` => `RLMUser.apiKeysAuth`\n* Other changes to RLMUser:\n  - `nullable` has been removed from `RLMUser.identifier`\n  - `nullable` has been removed from `RLMUser.customData`\n* Change the following methods on RLMApp to properties:\n  - `[RLMApp allUsers]` => `RLMApp.allUsers`\n  - `[RLMApp currentUser]` => `RLMApp.currentUser`\n  - `[RLMApp emailPasswordAuth]` => `RLMApp.emailPasswordAuth`\n* Define `RealmSwift.Credentials` as an enum instead of a `typealias`. Example\n  usage has changed from `Credentials(googleAuthCode: \"token\")` to\n  `Credentials.google(serverAuthCode: \"serverAuthCode\")`, and\n  `Credentials(facebookToken: \"token\")` to `Credentials.facebook(accessToken: \"accessToken\")`, etc.\n* Remove error parameter and redefine payload in\n  `+ (instancetype)credentialsWithFunctionPayload:(NSDictionary *)payload error:(NSError **)error;`.\n  It is now defined as `+ (instancetype)credentialsWithFunctionPayload:(NSDictionary<NSString *, id<RLMBSON>> *)payload;`\n\n### Compatibility\n\n* File format: Generates Realms with format v12 (Reads and upgrades all previous formats)\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 10.x.y series.\n* Carthage release for Swift is built with Xcode 12.\n\n10.0.0-beta.6 Release notes (2020-09-30)\n=============================================================\n\n### Breaking Changes\n\n* Change Google Credential parameter names to better reflect the required auth code:\n    - `Credentials(googleToken:)` => `Credentials(googleAuthCode:)`\n    - `[RLMCredentials credentialsWithGoogleToken:]` => `[RLMCredentials credentialsWithGoogleAuthCode:]`\n* Rename Realm.Publishers to RealmPublishers to avoid confusion with Combine.Publishers\n\n### Fixed\n\n* Deleting objects could sometimes change the ObjectId remaining objects from\n  null to ObjectId(\"deaddeaddeaddeaddeaddead\") when there are more than 1000\n  objects. (Since v10.0.0-alpha.1)\n* Fixed an assertion failure when adding an index to a nullable ObjectId\n  property that contains nulls. (since v10.0.0-alpha.1).\n\nThis release also contains the following changes from 5.4.0 - 5.4.6:\n\n### Enhancements\n\n* Add prebuilt binary for Xcode 11.7 to the release package.\n* Add prebuilt binary for Xcode 12 to the release package.\n* Improve the asymtotic performance of NOT IN queries on indexed properties. It\n  is now O(Number of Rows) rather than O(Number of Rows \\* Number of values in IN clause.)\n* Slightly (<5%) improve the performance of most operations which involve\n  reading from a Realm file.\n\n### Fixed\n\n* Upgrading pre-5.x files with string primary keys would result in a file where\n  `realm.object(ofType:forPrimaryKey:)` would fail to find the object.\n  ([#6716](https://github.com/realm/realm-swift/issues/6716), since 5.2.0)\n* A write transaction which modifies an object with more than 16 managed\n  properties and causes the Realm file to grow larger than 2 GB could cause an\n  assertion failure mentioning \"m_has_refs\". ([JS #3194](https://github.com/realm/realm-js/issues/3194), since 5.0.0).\n* Objects with more than 32 properties could corrupt the Realm file and result\n  in a variety of crashes. ([Java #7057](https://github.com/realm/realm-java/issues/7057), since 5.0.0).\n* Fix deadlocks when opening a Realm file in both the iOS simulator and Realm\n  Studio ([#6743](https://github.com/realm/realm-swift/issues/6743), since 5.3.6).\n* Fix Springboard deadlocking when an app is unsuspended while it has an open\n  Realm file which is stored in an app group on iOS 10-12\n  ([#6749](https://github.com/realm/realm-swift/issues/6749), since 5.3.6).\n* If you use encryption your application cound crash with a message like\n  \"Opening Realm files of format version 0 is not supported by this version of\n  Realm\". ([#6889](https://github.com/realm/realm-java/issues/6889) among others, since 5.0.0)\n* Confining a Realm to a serial queue would throw an error claiming that the\n  queue was not a serial queue on iOS versions older than 12.\n  ([#6735](https://github.com/realm/realm-swift/issues/6735), since 5.0.0).\n* Results would sometimes give stale results inside a write transaction if a\n  write which should have updated the Results was made before the first access\n  of a pre-existing Results object.\n  ([#6721](https://github.com/realm/realm-swift/issues/6721), since 5.0.0)\n* Fix Archiving the Realm and RealmSwift frameworks with Xcode 12.\n  ([#6774](https://github.com/realm/realm-swift/issues/6774))\n* Fix compilation via Carthage when using Xcode 12 ([#6717](https://github.com/realm/realm-swift/issues/6717)).\n* Fix a crash inside `realm::Array(Type)::init_from_mem()` which would\n  sometimes occur when running a query over links immediately after creating\n  objects of the queried type.\n  ([#6789](https://github.com/realm/realm-swift/issues/6789) and possibly others, since 5.0.0).\n* Possibly fix problems when changing the type of the primary key of an object\n  from optional to non-optional.\n* Rerunning a equality query on an indexed string property would give incorrect\n  results if a previous run of the query matched multiple objects and it now\n  matches one object. This could manifest as either finding a non-matching\n  object or a \"key not found\" exception being thrown.\n  ([#6536](https://github.com/realm/realm-swift/issues/6536), since 5.0.0).\n\n### Compatibility\n\n* File format: Generates Realms with format v12 (Reads and upgrades all previous formats)\n* Realm Studio: 10.0.0 or later.\n* Carthage release for Swift is built with Xcode 12.\n\n### Internal\n\n* Upgraded realm-core from v10.0.0-beta.7 to v10.0.0-beta.9\n* Upgraded realm-sync from v10.0.0-beta.11 to v10.0.0-beta.14\n\n10.0.0-beta.5 Release notes (2020-09-15)\n=============================================================\n\n### Enhancements\n\n* Add `User.loggedIn`.\n* Add support for multiple Realm Apps.\n* Remove `[RLMSyncManager shared]`. This is now instatiated as a property on\n  the app itself.\n* Add Combine support for:\n    * PushClient\n    * APIKeyAuth\n    * User\n    * MongoCollection\n    * EmailPasswordAuth\n    * App.login\n\n### Fixed\n\n* Fix `MongoCollection.watch` to consistently deliver events on a given queue.\n* Fix `[RLMUser logOutWithCompletion]` and `User.logOut` to now log out the\n  correct user.\n* Fix crash on startup on iOS versions older than 13 (since v10.0.0-beta.3).\n\n### Breaking Changes\n\n* `RLMSyncManager.pinnedCertificatePaths` has been removed.\n* Classes `RLMUserAccountInfo` & `RLMUserInfo` (swift: `UserInfo`,\n  `UserAccountInfo`) have been removed.\n* The following functionality has been renamed to align Cocoa with the other\n  Realm SDKs:\n\n| Old API                                                      | New API                                                        |\n|:-------------------------------------------------------------|:---------------------------------------------------------------|\n| `RLMUser.identity`                                           | `RLMUser.identifier`                                           |\n| `User.identity`                                              | `User.id`                                                      |\n| `-[RLMCredentials credentialsWithUsername:password:]`        | `-[RLMCredentials credentialsWithEmail:password:]`             |\n| `Credentials(username:password:)`                            | `Credentials(email:password:)`                                 |\n| -`[RLMUser apiKeyAuth]`                                      | `-[RLMUser apiKeysAuth]`                                       |\n| `User.apiKeyAuth()`                                          | `User.apiKeysAuth()`                                           |\n| `-[RLMEmailPasswordAuth registerEmail:password:completion:]` | `-[RLMEmailPasswordAuth registerUserWithEmail:password:completion:]` |\n| `App.emailPasswordAuth().registerEmail(email:password:)`     | `App.emailPasswordAuth().registerUser(email:password:)`        |\n\n### Compatibility\n\n* File format: Generates Realms with format v12 (Reads and upgrades all previous formats)\n* Realm Studio: 10.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 11.6.\n\n### Internal\n\n* Upgraded realm-core from v10.0.0-beta.6 to v10.0.0-beta.7\n* Upgraded realm-sync from v10.0.0-beta.10 to v10.0.0-beta.11\n\n10.0.0-beta.4 Release notes (2020-08-28)\n=============================================================\n\n### Enhancements\n\n* Add support for the 64-bit watchOS simulator added in Xcode 12.\n* Add ability to stream change events on a remote MongoDB collection with\n  `[RLMMongoCollection watch:delegate:delegateQueue]`,\n  `MongoCollection.watch(delegate)`. When calling `watch(delegate)` you will be\n  given a `RLMChangeStream` (`ChangeStream`), this will be used to invalidate\n  and stop the streaming session by calling `[RLMChangeStream close]`\n  (`ChangeStream.close()`) when needed.\n* Add `MongoCollection.watch`, which is a Combine publisher that will stream\n  change events each time the remote MongoDB collection is updated.\n* Add ability to open a synced Realm with a `nil` partition value.\n\n### Fixed\n\n* Realm.Configuration.objectTypes now accepts embedded objects\n* Ports fixes from 5.3.5\n\n### Compatibility\n\n* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)\n* Realm Studio: 3.11 or later.\n* APIs are backwards compatible with all previous releases in the v10.0.0-beta.x series.\n* Carthage release for Swift is built with Xcode 11.5.\n\n### Internal\n\n* Upgraded realm-core from v10.0.0-beta.1 to v10.0.0-beta.6\n* Upgraded realm-sync from v10.0.0-beta.2 to v10.0.0-beta.10\n\n10.0.0-beta.3 Release notes (2020-08-17)\n=============================================================\n\nThis release also contains all changes from 5.3.2.\n\n### Breaking Changes\n* The following classes & aliases have been renamed to align Cocoa with the other Realm SDKs:\n\n| Old API                                                     | New API                                                        |\n|:------------------------------------------------------------|:---------------------------------------------------------------|\n| `RLMSyncUser`                                               | `RLMUser`                                                      |\n| `SyncUser`                                                  | `User`                                                         |\n| `RLMAppCredential`                                          | `RLMCredential`                                                |\n| `AppCredential`                                             | `Credential`                                                   |\n| `RealmApp`                                                  | `App`                                                          |\n| `RLMUserAPIKeyProviderClient`                               | `RLMAPIKeyAuth`                                                |\n| `RLMUsernamePasswordProviderClient`                         | `RLMEmailPasswordAuth`                                         |\n| `UsernamePasswordProviderClient`                            | `EmailPasswordAuth`                                            |\n| `UserAPIKeyProviderClient`                                  | `APIKeyAuth`                                                   |\n\n* The following functionality has also moved to the User\n\n| Old API                                                      | New API                                                       |\n|:-------------------------------------------------------------|:--------------------------------------------------------------|\n| `[RLMApp callFunctionNamed:]`                                | `[RLMUser callFunctionNamed:]`                                |\n| `App.functions`                                              | `User.functions`                                              |\n| `[RLMApp mongoClientWithServiceName:]`                       | `[RLMUser mongoClientWithServiceName:]`                       |\n| `App.mongoClient(serviceName)`                               | `User.mongoClient(serviceName)`                               |\n| `[RLMApp userAPIKeyProviderClient]`                          | `[RLMUser apiKeyAuth]`                                        |\n| `App.userAPIKeyProviderClient`                               | `App.apiKeyAuth()`                                            |\n| `[RLMApp logOut:]`                                           | `[RLMUser logOut]`                                            |\n| `App.logOut(user)`                                           | `User.logOut()`                                               |\n| `[RLMApp removeUser:]`                                       | `[RLMUser remove]`                                            |\n| `App.remove(user)`                                           | `User.remove()`                                               |\n| `[RLMApp linkUser:credentials:]`                             | `[RLMUser linkWithCredentials:]`                              |\n| `App.linkUser(user, credentials)`                            | `User.link(credentials)`                                      |\n\n*  `refreshCustomData()` on User now returns void and passes the custom data to the callback on success.\n\n### Compatibility\n* This release introduces breaking changes w.r.t some sync classes and MongoDB Realm Cloud functionality.\n(See the breaking changes section for the full list)\n* File format: Generates Realms with format v11 (Reads and upgrades all previous formats)\n* Realm Studio: 10.0.0 or later.\n* Carthage release for Swift is built with Xcode 11.5.\n\n10.0.0-beta.2 Release notes (2020-06-09)\n=============================================================\nXcode 11.3 and iOS 9 are now the minimum supported versions.\n\n### Enhancements\n* Add support for building with Xcode 12 beta 1. watchOS currently requires\n  removing x86_64 from the supported architectures. Support for the new 64-bit\n  watch simulator will come in a future release.\n\n### Fixed\n* Opening a SyncSession with LOCAL app deployments would not use the correct endpoints.\n* Linking from embedded objects to top-level objects was incorrectly disallowed.\n* Opening a Realm file in file format v6 (created by Realm Cocoa versions\n  between 2.4 and 2.10) would crash. (Since 5.0.0, [Core #3764](https://github.com/realm/realm-core/issues/3764)).\n* Upgrading v9 (pre-5.0) Realm files would create a redundant search index for\n  primary key properties. This index would then be removed the next time the\n  Realm was opened, resulting in some extra i/o in the upgrade process.\n  (Since 5.0.0, [Core #3787](https://github.com/realm/realm-core/issues/3787)).\n* Fixed a performance issue with upgrading v9 files with search indexes on\n  non-primary-key properties. (Since 5.0.0, [Core #3767](https://github.com/realm/realm-core/issues/3767)).\n\n### Compatibility\n* File format: Generates Realms with format v11 (Reads and upgrades all previous formats)\n* MongoDB Realm: 84893c5 or later.\n* APIs are backwards compatible with all previous releases in the 10.0.0-alpha series.\n* Carthage release for Swift is built with Xcode 11.5.\n\n### Internal\n* Upgraded realm-core from v6.0.3 to v10.0.0-beta.1\n* Upgraded realm-sync from v5.0.1 to v10.0.0-beta.2\n\n10.0.0-beta.1 Release notes (2020-06-08)\n=============================================================\n\nNOTE: This version bumps the Realm file format to version 11. It is not\npossible to downgrade to earlier versions. Older files will automatically be\nupgraded to the new file format. Only [Realm Studio\n10.0.0](https://github.com/realm/realm-studio/releases/tag/v10.0.0-beta.1) or\nlater will be able to open the new file format.\n\n### Enhancements\n\n* Add support for next generation sync. Support for syncing to MongoDB instead\n  of Realm Object Server. Applications must be created at realm.mongodb.com\n* The memory mapping scheme for Realm files has changed to better support\n  opening very large files.\n* Add support for the ObjectId data type. This is an automatically-generated\n  unique identifier similar to a GUID or a UUID.\n  ([PR #6450](https://github.com/realm/realm-swift/pull/6450)).\n* Add support for the Decimal128 data type. This is a 128-bit IEEE 754 decimal\n  floating point number similar to NSDecimalNumber.\n  ([PR #6450](https://github.com/realm/realm-swift/pull/6450)).\n* Add support for embedded objects. Embedded objects are objects which are\n  owned by a single parent object, and are deleted when that parent object is\n  deleted. They are defined by subclassing `EmbeddedObject` /\n  `RLMEmbeddedObject` rather than `Object` / `RLMObject`.\n* Add `-[RLMSyncUser customData]`/`SyncUser.customData`.  Custom data is\n  configured in your MongoDB Realm App.\n* Add `-[RLMApp callFunctionNamed:arguments]`/`RealmApp.functions`. This is the\n  entry point for calling Remote MongoDB Realm functions. Functions allow you\n  to define and execute server-side logic for your application. Functions are\n  written in modern JavaScript (ES6+) and execute in a serverless manner. When\n  you call a function, you can dynamically access components of the current\n  application as well as information about the request to execute the function\n  and the logged in user that sent the request.\n* Add `-[RLMApp mongoClientWithServiceName]`/`RealmApp.mongoClient`. This is\n  the entry point for calling your Remote MongoDB Service. The read operations\n  are `-[RLMMongoCollection findWhere:completion:]`, `-[RLMMongoCollection\n  countWhere:completion:]`and `-[RLMMongoCollection\n  aggregateWithPipeline:completion:]`. The write operations are\n  `-[RLMMongoCollection insertOneDocument:completion:]`, `-[RLMMongoCollection\n  insertManyDocuments:completion:]`, `-[RLMMongoCollection\n  updateOneDocument:completion:]`, `-[RLMMongoCollection\n  updateManyDocuments:completion:]`, `-[RLMMongoCollection\n  deleteOneDocument:completion:]`, and `-[RLMMongoCollection\n  deleteManyDocuments:completion:]`. If you are already familiar with MongoDB\n  drivers, it is important to understand that the remote MongoCollection only\n  provides access to the operations available in MongoDB Realm.\n* Change `[RLMSyncUser\n  configurationWithPartitionValue:]`/`SyncUser.configuration(with:)` to accept\n  all BSON types. Partition values can currently be of types `String`, `Int`,\n  or `ObjectId`. Opening a realm by partition value is the equivalent of\n  previously opening a realm by URL. In this case, partitions are meant to be\n  more closely associated with your data. E.g., if you are running a `Dog`\n  kennel, and have a field `breed` that acts as your partition key, you could\n  open up realms based on the breed of the dogs.\n\n### Breaking Changes\n\n* We no longer support Realm Cloud (legacy), but instead the new \"MongoDB\n  Realm\" Cloud. MongoDB Realm is a serverless platform that enables developers\n  to quickly build applications without having to set up server infrastructure.\n  MongoDB Realm is built on top of MongoDB Atlas, automatically integrating the\n  connection to your database.\n* Remove support for Query-based sync, including the configuration parameters\n  and the `RLMSyncSubscription` and `SyncSubscription` types ([#6437](https://github.com/realm/realm-swift/pull/6437)).\n* Primary key properties are no longer marked as being indexed. This reflects\n  an internal change to how primary keys are handled that should not have any\n  other visible effects. ([#6440](https://github.com/realm/realm-swift/pull/6440)).\n* Remove everything related to sync permissions, including both the path-based\n  permission system and the object-level privileges for query-based sync. ([#6445](https://github.com/realm/realm-swift/pulls/6445))\n* Primary key uniqueness is now enforced when creating new objects during\n  migrations, rather than only at the end of migrations. Previously new objects\n  could be created with duplicate primary keys during a migration as long as\n  the property was changed to a unique value before the end of the migration,\n  but now a unique value must be supplied when creating the object.\n* Remove support for Realm Object Server.\n\n### Compatibility\n\n* File format: Generates Realms with format v11 (Reads and upgrades all previous formats)\n* MongoDB Realm: 84893c5 or later.\n* APIs are backwards compatible with all previous releases in the 10.0.0-alpha series.\n* Carthage release for Swift is built with Xcode 11.5.\n\n### Internal\n\n* Upgraded realm-core from v6.0.3 to v10.0.0-beta.1\n* Upgraded realm-sync from v5.0.1 to v10.0.0-beta.2\n\n5.5.0 Release notes (2020-10-12)\n=============================================================\n\n### Enhancements\n\n* Add the ability to capture a NotificationToken when using a Combine publisher\n  that observes a Realm Object or Collection. The user will call\n  `saveToken(on:at:)` directly after invoking the publisher to use the feature.\n\n### Fixed\n\n* When using `Realm.write(withoutNotifying:)` there was a chance that the\n  supplied observation blocks would not be skipped when in a write transaction.\n  ([Object Store #1103](https://github.com/realm/realm-object-store/pull/1103))\n* Comparing two identical unmanaged `List<>`/`RLMArray` objects would fail.\n  ([#5665](https://github.com/realm/realm-swift/issues/5665)).\n\n### Compatibility\n\n* File format: Generates Realms with format v11 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 5.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 12.\n\n5.4.8 Release notes (2020-10-05)\n=============================================================\n\n### Fixed\n\n* Case-insensitive equality queries on indexed string properties failed to\n  clear some internal state when rerunning the query. This could manifest as\n  duplicate results or \"key not found\" errors.\n  ([#6830](https://github.com/realm/realm-swift/issues/6830), [#6694](https://github.com/realm/realm-swift/issues/6694), since 5.0.0).\n\n### Compatibility\n\n* File format: Generates Realms with format v11 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 5.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 12.\n\n### Internal\n\n* Upgraded realm-core from v6.1.3 to v6.1.4\n* Upgraded realm-sync from v5.0.28 to v5.0.29\n\n5.4.7 Release notes (2020-09-30)\n=============================================================\n\n### Fixed\n\n* Equality queries on indexed string properties would sometimes throw \"key not\n  found\" exceptions if the hash of the string happened to have bit 62 set.\n  ([.NET #2025](https://github.com/realm/realm-dotnet/issues/2025), since v5.0.0).\n* Queries comparing non-optional int properties to nil would behave as if they\n  were comparing against zero instead (since v5.0.0).\n\n### Compatibility\n\n* File format: Generates Realms with format v11 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 5.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 12.\n\n### Internal\n\n* Upgraded realm-core from v6.1.2 to v6.1.3\n* Upgraded realm-sync from v5.0.27 to v5.0.28\n\n5.4.6 Release notes (2020-09-29)\n=============================================================\n\n5.4.5 failed to actually update the core version for installation methods other\nthan SPM. All changes listed there actually happened in this version for\nnon-SPM installation methods.\n\n### Compatibility\n\n* File format: Generates Realms with format v11 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 5.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 12.\n\n### Internal\n\n* Upgraded realm-sync from v5.0.26 to v5.0.27\n\n5.4.5 Release notes (2020-09-28)\n=============================================================\n\n### Enhancements\n\n* Slightly (<5%) improve the performance of most operations which involve\n  reading from a Realm file.\n\n### Fixed\n\n* Rerunning a equality query on an indexed string property would give incorrect\n  results if a previous run of the query matched multiple objects and it now\n  matches one object. This could manifest as either finding a non-matching\n  object or a \"key not found\" exception being thrown.\n  ([#6536](https://github.com/realm/realm-swift/issues/6536), since 5.0.0).\n\n### Compatibility\n\n* File format: Generates Realms with format v11 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 5.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 12.\n\n### Internal\n\n* Upgraded realm-core from v6.1.1 to v6.1.2\n* Upgraded realm-sync from v5.0.25 to v5.0.26\n\n5.4.4 Release notes (2020-09-25)\n=============================================================\n\n### Enhancements\n* Improve the asymtotic performance of NOT IN queries on indexed properties. It\n  is now O(Number of Rows) rather than O(Number of Rows \\* Number of values in IN clause.)\n\n### Fixed\n\n* Fix a crash inside `realm::Array(Type)::init_from_mem()` which would\n  sometimes occur when running a query over links immediately after creating\n  objects of the queried type.\n  ([#6789](https://github.com/realm/realm-swift/issues/6789) and possibly others, since 5.0.0).\n* Possibly fix problems when changing the type of the primary key of an object\n  from optional to non-optional.\n\n### Compatibility\n\n* File format: Generates Realms with format v11 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 5.0.0 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 12.\n\n### Internal\n\n* Upgraded realm-core from v6.0.26 to v6.1.1\n* Upgraded realm-sync from v5.0.23 to v5.0.25\n\n5.4.3 Release notes (2020-09-21)\n=============================================================\n\n### Fixed\n\n* Fix compilation via Carthage when using Xcode 12 ([#6717](https://github.com/realm/realm-swift/issues/6717)).\n\n### Compatibility\n\n* File format: Generates Realms with format v11 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 3.12 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 12.\n\n5.4.2 Release notes (2020-09-17)\n=============================================================\n\n### Enhancements\n\n* Add prebuilt binary for Xcode 12 to the release package.\n\n### Fixed\n\n* Fix Archiving the Realm and RealmSwift frameworks with Xcode 12.\n  ([#6774](https://github.com/realm/realm-swift/issues/6774))\n\n### Compatibility\n\n* File format: Generates Realms with format v11 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 3.12 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 12.\n\n5.4.1 Release notes (2020-09-16)\n=============================================================\n\n### Enhancements\n\n* Add prebuilt binary for Xcode 11.7 to the release package.\n\n### Fixed\n\n* Fix deadlocks when opening a Realm file in both the iOS simulator and Realm\n  Studio ([#6743](https://github.com/realm/realm-swift/issues/6743), since 5.3.6).\n* Fix Springboard deadlocking when an app is unsuspended while it has an open\n  Realm file which is stored in an app group on iOS 10-12\n  ([#6749](https://github.com/realm/realm-swift/issues/6749), since 5.3.6).\n* If you use encryption your application cound crash with a message like\n  \"Opening Realm files of format version 0 is not supported by this version of\n  Realm\". ([#6889](https://github.com/realm/realm-java/issues/6889) among others, since 5.0.0)\n* Confining a Realm to a serial queue would throw an error claiming that the\n  queue was not a serial queue on iOS versions older than 12.\n  ([#6735](https://github.com/realm/realm-swift/issues/6735), since 5.0.0).\n* Results would sometimes give stale results inside a write transaction if a\n  write which should have updated the Results was made before the first access\n  of a pre-existing Results object.\n  ([#6721](https://github.com/realm/realm-swift/issues/6721), since 5.0.0)\n\n### Compatibility\n\n* File format: Generates Realms with format v11 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 3.12 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 11.7.\n\n### Internal\n\n* Upgraded realm-core from v6.0.25 to v6.0.26\n* Upgraded realm-sync from v5.0.22 to v5.0.23\n\n5.4.0 Release notes (2020-09-09)\n=============================================================\n\nThis version bumps the Realm file format version. This means that older\nversions of Realm will be unable to open Realm files written by this version,\nand a new version of Realm Studio will be required. There are no actual format\nchanges and the version bump is just to force a re-migration of incorrectly\nupgraded Realms.\n\n### Fixed\n\n* Upgrading pre-5.x files with string primary keys would result in a file where\n  `realm.object(ofType:forPrimaryKey:)` would fail to find the object.\n  ([#6716](https://github.com/realm/realm-swift/issues/6716), since 5.2.0)\n* A write transaction which modifies an object with more than 16 managed\n  properties and causes the Realm file to grow larger than 2 GB could cause an\n  assertion failure mentioning \"m_has_refs\". ([JS #3194](https://github.com/realm/realm-js/issues/3194), since 5.0.0).\n* Objects with more than 32 properties could corrupt the Realm file and result\n  in a variety of crashes. ([Java #7057](https://github.com/realm/realm-java/issues/7057), since 5.0.0).\n\n### Compatibility\n\n* File format: Generates Realms with format v11 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 3.12 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 11.6.\n\n### Internal\n\n* Upgraded realm-core from v6.0.23 to v6.0.25\n* Upgraded realm-sync from v5.0.20 to v5.0.22\n\n5.3.6 Release notes (2020-09-02)\n=============================================================\n\n### Fixed\n\n* Work around iOS 14 no longer allowing the use of file locks in shared\n  containers, which resulted in the OS killing an app which entered the\n  background while a Realm was open ([#6671](https://github.com/realm/realm-swift/issues/6671)).\n* If an attempt to upgrade a realm has ended with a crash with \"migrate_links()\"\n  in the call stack, the realm was left in an invalid state. The migration\n  logic now handles this state and can complete upgrading files which were\n  incompletely upgraded by pre-5.3.4 versions.\n* Fix deadlocks when writing to a Realm file on an exFAT partition from macOS.\n  ([#6691](https://github.com/realm/realm-swift/issues/6691)).\n\n### Compatibility\n\n* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 3.11 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 11.6.\n\n### Internal\n\n* Upgraded realm-core from v6.0.19 to v6.0.23\n* Upgraded realm-sync from v5.0.16 to v5.0.20\n\n5.3.5 Release notes (2020-08-20)\n=============================================================\n\n### Fixed\n\n* Opening Realms on background threads could produce spurious Incorrect Thread\n  exceptions when a cached Realm existed for a previously existing thread with\n  the same thread ID as the current thread.\n  ([#6659](https://github.com/realm/realm-swift/issues/6659),\n  [#6689](https://github.com/realm/realm-swift/issues/6689),\n  [#6712](https://github.com/realm/realm-swift/issues/6712), since 5.0.0).\n* Upgrading a table with incoming links but no properties would crash. This was\n  probably not possible to hit in practice as we reject object types with no\n  properties.\n* Upgrading a non-nullable List which nonetheless contained null values would\n  crash. This was possible due to missing error-checking in some older versions\n  of Realm.\n\n### Compatibility\n\n* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 3.11 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 11.6.\n\n### Internal\n\n* Upgraded realm-core from v6.0.18 to v6.0.19\n* Upgraded realm-sync from v5.0.15 to v5.0.16\n\n5.3.4 Release notes (2020-08-17)\n=============================================================\n\n### Fixed\n\n* Accessing a Realm after calling `deleteAll()` would sometimes throw an\n  exception with the reason 'ConstIterator copy failed'. ([#6597](https://github.com/realm/realm-swift/issues/6597), since 5.0.0).\n* Fix an assertion failure inside the `migrate_links()` function when upgrading\n  a pre-5.0 Realm file.\n* Fix a bug in memory mapping management. This bug could result in multiple\n  different asserts as well as segfaults. In many cases stack backtraces would\n  include members of the EncyptedFileMapping near the top - even if encryption\n  was not used at all. In other cases asserts or crashes would be in methods\n  reading an array header or array element. In all cases the application would\n  terminate immediately. ([Core #3838](https://github.com/realm/realm-core/pull/3838), since v5.0.0).\n\n### Compatibility\n\n* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 3.11 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 11.6.\n\n### Internal\n\n* Upgraded realm-core from v6.0.14 to v6.0.18\n* Upgraded realm-sync from v5.0.14 to v5.0.15\n\n5.3.3 Release notes (2020-07-30)\n=============================================================\n\n### Enhancements\n\n* Add support for the x86_64 watchOS simulator added in Xcode 12.\n\n### Fixed\n\n* (RLM)Results objects would incorrectly pin old read transaction versions\n  until they were accessed after a Realm was refreshed, resulting in the Realm\n  file growing to large sizes if a Results was retained but not accessed after\n  every write. ([#6677](https://github.com/realm/realm-swift/issues/6677), since 5.0.0).\n* Fix linker errors when using SwiftUI previews with Xcode 12 when Realm was\n  installed via Swift Package Manager. ([#6625](https://github.com/realm/realm-swift/issues/6625))\n\n### Compatibility\n\n* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 3.11 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 11.6.\n\n### Internal\n\n* Upgraded realm-core from v6.0.12 to v6.0.14\n* Upgraded realm-sync from v5.0.12 to v5.0.14\n\n5.3.2 Release notes (2020-07-21)\n=============================================================\n\n### Fixed\n\n* Fix a file format upgrade bug when opening older Realm files. Could cause\n  assertions like \"Assertion failed: ref != 0\" during opning of a Realm.\n  ([Core #6644](https://github.com/realm/realm-swift/issues/6644), since 5.2.0)\n* A use-after-free would occur if a Realm was compacted, opened on multiple\n  threads prior to the first write, then written to while reads were happening\n  on other threads. This could result in a variety of crashes, often inside\n  realm::util::EncryptedFileMapping::read_barrier.\n  (Since v5.0.0, [#6626](https://github.com/realm/realm-swift/issues/6626),\n  [#6628](https://github.com/realm/realm-swift/issues/6628),\n  [#6652](https://github.com/realm/realm-swift/issues/6652),\n  [#6655](https://github.com/realm/realm-swift/issues/6555),\n  [#6656](https://github.com/realm/realm-swift/issues/6656)).\n\n### Compatibility\n\n* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 3.11 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 11.6.\n\n### Internal\n\n* Upgraded realm-core from v6.0.11 to v6.0.12\n* Upgraded realm-sync from v5.0.11 to v5.0.12\n\n5.3.1 Release notes (2020-07-17)\n=============================================================\n\n### Enhancements\n\n* Add prebuilt binary for Xcode 11.6 to the release package.\n\n### Fixed\n\n* Creating an object inside migration which changed that object type's primary\n  key would hit an assertion failure mentioning primary_key_col\n  ([#6613](https://github.com/realm/realm-swift/issues/6613), since 5.0.0).\n* Modifying the value of a string primary key property inside a migration with\n  a Realm file which was upgraded from pre-5.0 would corrupt the property's\n  index, typically resulting in crashes. ([Core #3765](https://github.com/realm/realm-core/issues/3765), since 5.0.0).\n* Some Realm files which hit assertion failures when upgrading from the pre-5.0\n  file format should now upgrade correctly (Since 5.0.0).\n\n### Compatibility\n\n* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 3.11 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 11.6.\n\n### Internal\n\n* Upgraded realm-core from v6.0.9 to v6.0.11\n* Upgraded realm-sync from v5.0.8 to v5.0.11\n\n5.3.0 Release notes (2020-07-14)\n=============================================================\n\n### Enhancements\n\n* Add `Realm.objectWillChange`, which is a Combine publisher that will emit a\n  notification each time the Realm is refreshed or a write transaction is\n  commited.\n\n### Fixed\n\n* Fix the spelling of `ObjectKeyIdentifiable`. The old spelling is available\n  and deprecated for compatibility.\n* Rename `RealmCollection.publisher` to `RealmCollection.collectionPublisher`.\n  The old name interacted with the `publisher` defined by `Sequence` in very\n  confusing ways, so we need to use a different name. The `publisher` name is\n  still available for compatibility. ([#6516](https://github.com/realm/realm-swift/issues/6516))\n* Work around \"xcodebuild timed out while trying to read\n  SwiftPackageManagerExample.xcodeproj\" errors when installing Realm via\n  Carthage. ([#6549](https://github.com/realm/realm-swift/issues/6549)).\n* Fix a performance regression when using change notifications. (Since 5.0.0,\n  [#6629](https://github.com/realm/realm-swift/issues/6629)).\n\n### Compatibility\n\n* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 3.11 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 11.5.\n\n### Internal\n\n* Upgraded realm-core from v6.0.8 to v6.0.9\n* Upgraded realm-sync from v5.0.7 to v5.0.8\n\n5.2.0 Release notes (2020-06-30)\n=============================================================\n\n### Fixed\n* Opening a SyncSession with LOCAL app deployments would not use the correct endpoints.\nThis release also contains all changes from 5.0.3 and 5.1.0.\n\n### Breaking Changes\n* The following classes & aliases have been renamed to align Cocoa with the other Realm SDKs:\n\n| Old API                                                     | New API                                                        |\n|:------------------------------------------------------------|:---------------------------------------------------------------|\n| `RLMSyncUser`                                               | `RLMUser`                                                      |\n| `SyncUser`                                                  | `User`                                                         |\n| `RLMAppCredential`                                          | `RLMCredential`                                                |\n| `AppCredential`                                             | `Credential`                                                   |\n| `RealmApp`                                                  | `App`                                                          |\n| `RLMUserAPIKeyProviderClient`                               | `RLMAPIKeyAuth`                                                |\n| `RLMUsernamePasswordProviderClient`                         | `RLMEmailPasswordAuth`                                         |\n| `UsernamePasswordProviderClient`                            | `EmailPasswordAuth`                                            |\n| `UserAPIKeyProviderClient`                                  | `APIKeyAuth`                                                   |\n\n* The following functionality has also moved to the User:\n\n| Old API                                                      | New API                                                       |\n|:-------------------------------------------------------------|:--------------------------------------------------------------|\n| `[RLMApp callFunctionNamed:]`                                | `[RLMUser callFunctionNamed:]`                                |\n| `App.functions`                                              | `User.functions`                                              |\n| `[RLMApp mongoClientWithServiceName:]`                       | `[RLMUser mongoClientWithServiceName:]`                       |\n| `App.mongoClient(serviceName)`                               | `User.mongoClient(serviceName)`                               |\n| `[RLMApp userAPIKeyProviderClient]`                          | `[RLMUser apiKeyAuth]`                                        |\n| `App.userAPIKeyProviderClient`                               | `App.apiKeyAuth()`                                            |\n| `[RLMApp logOut:]`                                           | `[RLMUser logOut]`                                            |\n| `App.logOut(user)`                                           | `User.logOut()`                                               |\n| `[RLMApp removeUser:]`                                       | `[RLMUser remove]`                                            |\n| `App.remove(user)`                                           | `User.remove()`                                               |\n| `[RLMApp linkUser:credentials:]`                             | `[RLMUser linkWithCredentials:]`                              |\n| `App.linkUser(user, credentials)`                            | `User.link(credentials)`                                      |\n\n* The argument labels in Swift have changed for several methods:\n| Old API                                                      | New API                                                       |\n|:-------------------------------------------------------------|:--------------------------------------------------------------|\n| `APIKeyAuth.createApiKey(withName:completion:)`              | `APIKeyAuth.createApiKey(named:completion:)`                  |\n| `App.login(withCredential:completion:)                       | `App.login(credentials:completion:)`                          |\n| `App.pushClient(withServiceName:)`                           | `App.pushClient(serviceName:)`                                |\n| `MongoClient.database(withName:)`                            | `MongoClient.database(named:)`                                |\n\n* `refreshCustomData()` on User now returns void and passes the custom data to the callback on success.\n\n### Compatibility\n* This release introduces breaking changes w.r.t some sync classes and MongoDB Realm Cloud functionality.\n  (See the breaking changes section for the full list)\n* File format: Generates Realms with format v11 (Reads and upgrades all previous formats)\n* MongoDB Realm: 84893c5 or later.\n* APIs are backwards compatible with all previous releases in the 10.0.0-alpha series.\n* Realm Studio: 10.0.0 or later.\n* Carthage release for Swift is built with Xcode 11.5.\n\n### Internal\n* Upgraded realm-core from v6.0.3 to v10.0.0-beta.1\n* Upgraded realm-sync from v5.0.1 to v10.0.0-beta.2\n\n10.0.0-beta.2 Release notes (2020-06-09)\n=============================================================\nXcode 11.3 and iOS 9 are now the minimum supported versions.\n\n### Enhancements\n\n* Add support for building with Xcode 12 beta 1. watchOS currently requires\n  removing x86_64 from the supported architectures. Support for the new 64-bit\n  watch simulator will come in a future release.\n\n### Fixed\n* Opening a SyncSession with LOCAL app deployments would not use the correct endpoints.\n* Linking from embedded objects to top-level objects was incorrectly disallowed.\n\n* Opening a Realm file in file format v6 (created by Realm Cocoa versions\n  between 2.4 and 2.10) would crash. (Since 5.0.0, [Core #3764](https://github.com/realm/realm-core/issues/3764)).\n* Upgrading v9 (pre-5.0) Realm files would create a redundant search index for\n  primary key properties. This index would then be removed the next time the\n  Realm was opened, resulting in some extra i/o in the upgrade process.\n  (Since 5.0.0, [Core #3787](https://github.com/realm/realm-core/issues/3787)).\n* Fixed a performance issue with upgrading v9 files with search indexes on\n  non-primary-key properties. (Since 5.0.0, [Core #3767](https://github.com/realm/realm-core/issues/3767)).\n\n### Compatibility\n* File format: Generates Realms with format v11 (Reads and upgrades all previous formats)\n* MongoDB Realm: 84893c5 or later.\n* APIs are backwards compatible with all previous releases in the 10.0.0-alpha series.\n* Carthage release for Swift is built with Xcode 11.5.\n\n### Internal\n* Upgraded realm-core from v6.0.3 to v10.0.0-beta.1\n* Upgraded realm-sync from v5.0.1 to v10.0.0-beta.2\n\n10.0.0-beta.1 Release notes (2020-06-08)\n=============================================================\n\nNOTE: This version bumps the Realm file format to version 11. It is not\npossible to downgrade to earlier versions. Older files will automatically be\nupgraded to the new file format. Only [Realm Studio\n10.0.0](https://github.com/realm/realm-studio/releases/tag/v10.0.0-beta.1) or\nlater will be able to open the new file format.\n\n### Enhancements\n\n* Add support for next generation sync. Support for syncing to MongoDB instead\n  of Realm Object Server. Applications must be created at realm.mongodb.com\n* The memory mapping scheme for Realm files has changed to better support\n  opening very large files.\n* Add support for the ObjectId data type. This is an automatically-generated\n  unique identifier similar to a GUID or a UUID.\n  ([PR #6450](https://github.com/realm/realm-swift/pull/6450)).\n* Add support for the Decimal128 data type. This is a 128-bit IEEE 754 decimal\n  floating point number similar to NSDecimalNumber.\n  ([PR #6450](https://github.com/realm/realm-swift/pull/6450)).\n* Add support for embedded objects. Embedded objects are objects which are\n  owned by a single parent object, and are deleted when that parent object is\n  deleted. They are defined by subclassing `EmbeddedObject` /\n  `RLMEmbeddedObject` rather than `Object` / `RLMObject`.\n* Add `-[RLMSyncUser customData]`/`SyncUser.customData`.  Custom data is\n  configured in your MongoDB Realm App.\n* Add `-[RLMApp callFunctionNamed:arguments]`/`RealmApp.functions`. This is the\n  entry point for calling Remote MongoDB Realm functions. Functions allow you\n  to define and execute server-side logic for your application. Functions are\n  written in modern JavaScript (ES6+) and execute in a serverless manner. When\n  you call a function, you can dynamically access components of the current\n  application as well as information about the request to execute the function\n  and the logged in user that sent the request.\n* Add `-[RLMApp mongoClientWithServiceName]`/`RealmApp.mongoClient`. This is\n  the entry point for calling your Remote MongoDB Service. The read operations\n  are `-[RLMMongoCollection findWhere:completion:]`, `-[RLMMongoCollection\n  countWhere:completion:]`and `-[RLMMongoCollection\n  aggregateWithPipeline:completion:]`. The write operations are\n  `-[RLMMongoCollection insertOneDocument:completion:]`, `-[RLMMongoCollection\n  insertManyDocuments:completion:]`, `-[RLMMongoCollection\n  updateOneDocument:completion:]`, `-[RLMMongoCollection\n  updateManyDocuments:completion:]`, `-[RLMMongoCollection\n  deleteOneDocument:completion:]`, and `-[RLMMongoCollection\n  deleteManyDocuments:completion:]`. If you are already familiar with MongoDB\n  drivers, it is important to understand that the remote MongoCollection only\n  provides access to the operations available in MongoDB Realm.\n* Change `[RLMSyncUser\n  configurationWithPartitionValue:]`/`SyncUser.configuration(with:)` to accept\n  all BSON types. Partition values can currently be of types `String`, `Int`,\n  or `ObjectId`. Opening a realm by partition value is the equivalent of\n  previously opening a realm by URL. In this case, partitions are meant to be\n  more closely associated with your data. E.g., if you are running a `Dog`\n  kennel, and have a field `breed` that acts as your partition key, you could\n  open up realms based on the breed of the dogs.\n\n### Breaking Changes\n\n* We no longer support Realm Cloud (legacy), but instead the new \"MongoDB\n  Realm\" Cloud. MongoDB Realm is a serverless platform that enables developers\n  to quickly build applications without having to set up server infrastructure.\n  MongoDB Realm is built on top of MongoDB Atlas, automatically integrating the\n  connection to your database.\n* Remove support for Query-based sync, including the configuration parameters\n  and the `RLMSyncSubscription` and `SyncSubscription` types ([#6437](https://github.com/realm/realm-swift/pull/6437)).\n* Primary key properties are no longer marked as being indexed. This reflects\n  an internal change to how primary keys are handled that should not have any\n  other visible effects. ([#6440](https://github.com/realm/realm-swift/pull/6440)).\n* Remove everything related to sync permissions, including both the path-based\n  permission system and the object-level privileges for query-based sync. ([#6445](https://github.com/realm/realm-swift/pulls/6445))\n* Primary key uniqueness is now enforced when creating new objects during\n  migrations, rather than only at the end of migrations. Previously new objects\n  could be created with duplicate primary keys during a migration as long as\n  the property was changed to a unique value before the end of the migration,\n  but now a unique value must be supplied when creating the object.\n* Remove support for Realm Object Server.\n\n### Compatibility\n\n* File format: Generates Realms with format v11 (Reads and upgrades all previous formats)\n* MongoDB Realm: 84893c5 or later.\n* APIs are backwards compatible with all previous releases in the 10.0.0-alpha series.\n* `List.index(of:)` would give incorrect results if it was the very first thing\n  called on that List after a Realm was refreshed following a write which\n  modified the List. (Since 5.0.0, [#6606](https://github.com/realm/realm-swift/issues/6606)).\n* If a ThreadSafeReference was the only remaining reference to a Realm,\n  multiple copies of the file could end up mapped into memory at once. This\n  probably did not have any symptoms other than increased memory usage. (Since 5.0.0).\n\n### Compatibility\n\n* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 3.11 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 11.5.\n\n### Internal\n\n* Upgraded realm-core from v6.0.3 to v10.0.0-beta.1\n* Upgraded realm-sync from v5.0.1 to v10.0.0-beta.2\n* Upgraded realm-core from v6.0.6 to v6.0.7\n* Upgraded realm-sync from v5.0.5 to v5.0.6\n* Upgraded realm-core from v6.0.6 to v6.0.8\n* Upgraded realm-sync from v5.0.5 to v5.0.7\n\n5.1.0 Release notes (2020-06-22)\n=============================================================\n\n### Enhancements\n\n* Allow opening full-sync Realms in read-only mode. This disables local schema\n  initialization, which makes it possible to open a Realm which the user does\n  not have write access to without using asyncOpen. In addition, it will report\n  errors immediately when an operation would require writing to the Realm\n  rather than reporting it via the sync error handler only after the server\n  rejects the write.\n\n### Fixed\n\n* Opening a Realm using a configuration object read from an existing Realm\n  would incorrectly bind the new Realm to the original Realm's thread/queue,\n  resulting in \"Realm accessed from incorrect thread.\" exceptions.\n  ([#6574](https://github.com/realm/realm-swift/issues/6574),\n  [#6559](https://github.com/realm/realm-swift/issues/6559), since 5.0.0).\n\n### Compatibility\n\n* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 3.11 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 11.5.\n\n5.0.3 Release notes (2020-06-10)\n=============================================================\n\n### Fixed\n\n* `-[RLMObject isFrozen]` always returned false. ([#6568](https://github.com/realm/realm-swift/issues/6568), since 5.0.0).\n* Freezing an object within the write transaction that the object was created\n  in now throws an exception rather than crashing when the object is first\n  used.\n* The schema for frozen Realms was not properly initialized, leading to crashes\n  when accessing a RLMLinkingObjects property.\n  ([#6568](https://github.com/realm/realm-swift/issues/6568), since 5.0.0).\n* Observing `Object.isInvalidated` via a keypath literal would produce a\n  warning in Swift 5.2 due to the property not being marked as @objc.\n  ([#6554](https://github.com/realm/realm-swift/issues/6554))\n\n### Compatibility\n\n* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 3.11 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 11.5.\n\n5.0.2 Release notes (2020-06-02)\n=============================================================\n\n### Fixed\n\n* Fix errSecDuplicateItem (-25299) errors when opening a synchronized Realm\n  when upgrading from pre-5.0 versions of Realm.\n  ([#6538](https://github.com/realm/realm-swift/issues/6538), [#6494](https://github.com/realm/realm-swift/issues/6494), since 5.0.0).\n* Opening Realms stored on filesystems which do not support preallocation (such\n  as ExFAT) would give \"Operation not supported\" exceptions.\n  ([#6508](https://github.com/realm/realm-swift/issues/6508), since 3.2.0).\n* 'NoSuchTable' exceptions would sometimes be thrown after upgrading a Relam\n  file to the v10 format. ([Core #3701](https://github.com/realm/realm-core/issues/3701), since 5.0.0)\n* If the upgrade process was interrupted/killed for various reasons, the\n  following run could stop with some assertions failing. No instances of this\n  happening were reported to us. (Since 5.0.0).\n* Queries filtering a `List` where the query was on an indexed property over a\n  link would sometimes give incomplete results.\n  ([#6540](https://github.com/realm/realm-swift/issues/6540), since 4.1.0 but\n  more common since 5.0.0)\n* Opening a file in read-only mode would attempt to make a spurious write to\n  the file, causing errors if the file was in read-only storage (since 5.0.0).\n\n### Compatibility\n\n* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 3.11 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 11.5.\n\n### Internal\n\n* Upgraded realm-core from v6.0.4 to v6.0.6\n* Upgraded realm-sync from v5.0.3 to v5.0.5\n\n5.0.1 Release notes (2020-05-27)\n=============================================================\n\n### Enhancements\n\n* Add prebuilt binary for Xcode 11.5 to the release package.\n\n### Fixed\n\n* Fix linker error when building a xcframework for Catalyst.\n  ([#6511](https://github.com/realm/realm-swift/issues/6511), since 4.3.1).\n* Fix building for iOS devices when using Swift Package Manager\n  ([#6522](https://github.com/realm/realm-swift/issues/6522), since 5.0.0).\n* `List` and `RealmOptional` properties on frozen objects were not initialized\n  correctly and would always report `nil` or an empty list.\n  ([#6527](https://github.com/realm/realm-swift/issues/6527), since 5.0.0).\n\n### Compatibility\n\n* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 3.11 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 11.5.\n\n5.0.0 Release notes (2020-05-15)\n=============================================================\n\nNOTE: This version bumps the Realm file format to version 10. It is not\npossible to downgrade version 9 or earlier. Files created with older versions\nof Realm will be automatically upgraded. Only\n[Studio 3.11](https://github.com/realm/realm-studio/releases/tag/v3.11.0) or later will be able\nto open the new file format.\n\n### Enhancements\n\n* Storing large binary blobs in Realm files no longer forces the file to be at\n  least 8x the size of the largest blob.\n* Reduce the size of transaction logs stored inside the Realm file, reducing\n  file size growth from large transactions.\n* Add support for frozen objects. `Realm`, `Results`, `List` and `Object` now\n  have `freeze()` methods which return a frozen copy of the object. These\n  objects behave similarly to creating unmanaged deep copies of the source\n  objects. They can be read from any thread and do not update when writes are\n  made to the Realm, but creating frozen objects does not actually copy data\n  out of the Realm and so can be much faster and use less memory. Frozen\n  objects cannot be mutated or observed for changes (as they never change).\n  ([PR #6427](https://github.com/realm/realm-swift/pull/6427)).\n* Add the `isFrozen` property to `Realm`, `Results`, `List` and `Object`.\n* Add `Realm.Configuration.maxNumberOfActiveVersions`. Each time a write\n  transaction is performed, a new version is created inside the Realm, and then\n  any versions which are no longer in use are cleaned up. If too many versions\n  are kept alive while performing writes (either due to a background thread\n  performing a long operation that doesn't let the Realm on that thread\n  refresh, or due to holding onto frozen versions for a long time) the Realm\n  file will grow in size, potentially to the point where it is too large to be\n  opened. Setting this configuration option will make write transactions which\n  would cause the live version count to exceed the limit to instead fail.\n* Add support for queue-confined Realms. Rather than being bound to a specific\n  thread, queue-confined Realms are bound to a serial dispatch queue and can be\n  used within blocks dispatched to that queue regardless of what thread they\n  happen to run on. In addition, change notifications will be delivered to that\n  queue rather than the thread's run loop. ([PR #6478](https://github.com/realm/realm-swift/pull/6478)).\n* Add an option to deliver object and collection notifications to a specific\n  serial queue rather than the current thread. ([PR #6478](https://github.com/realm/realm-swift/pull/6478)).\n* Add Combine publishers for Realm types. Realm collections have a `.publisher`\n  property which publishes the collection each time it changes, and a\n  `.changesetPublisher` which publishes a `RealmCollectionChange` each time the\n  collection changes. Corresponding publishers for Realm Objects can be\n  obtained with the `publisher()` and `changesetPublisher()` global functions.\n* Extend Combine publishers which output Realm types with a `.freeze()`\n  function which will make the publisher instead output frozen objects.\n* String primary keys no longer require a separate index, improving insertion\n  and deletion performance without hurting lookup performance.\n* Reduce the encrypted page reclaimer's impact on battery life when encryption\n  is used. ([Core #3461](https://github.com/realm/realm-core/pull/3461)).\n\n### Fixed\n\n* The uploaded bytes in sync progress notifications was sometimes incorrect and\n  wouldn't exactly equal the uploadable bytes when the uploaded completed.\n* macOS binaries were built with the incorrect deployment target (10.14 rather\n  than 10.9), resulting in linker warnings. ([#6299](https://github.com/realm/realm-swift/issues/6299), since 3.18.0).\n* An internal datastructure for List properties could be double-deleted if the\n  last reference was released from a thread other than the one which the List\n  was created on at the wrong time. This would typically manifest as\n  \"pthread_mutex_destroy() failed\", but could also result in other kinds of\n  crashes. ([#6333](https://github.com/realm/realm-swift/issues/6333)).\n* Sorting on float or double properties containing NaN values had inconsistent\n  results and would sometimes crash due to out-of-bounds memory accesses.\n  ([#6357](https://github.com/realm/realm-swift/issues/6357)).\n\n### Breaking Changes\n\n* The ObjectChange type in Swift is now generic and includes a reference to the\n  object which changed. When using `observe(on:)` to receive notifications on a\n  dispatch queue, the object will be confined to that queue.\n* The Realm instance passed in the callback to asyncOpen() is now confined to\n  the callback queue passed to asyncOpen() rather than the thread which the\n  callback happens to be called on. This means that the Realm instance may be\n  stored and reused in further blocks dispatched to that queue, but the queue\n  must now be a serial queue.\n* Files containing Date properties written by version of Realm prior to 1.0 can\n  no longer be opened.\n* Files containing Any properties can no longer be opened. This property type\n  was never documented and was deprecated in 1.0.\n* Deleting objects now preserves the order of objects reported by unsorted\n  Results rather than performing a swap operation before the delete. Note that\n  it is still not safe to assume that the order of objects in an unsorted\n  Results is the order that the objects were created in.\n* The minimum supported deployment target for iOS when using Swift Package\n  Manager to install Realm is now iOS 11.\n\n### Compatibility\n\n* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Realm Studio: 3.11 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 11.4.1.\n\n### Internal\n\n* Upgraded realm-core from v5.23.8 to v6.0.4\n* Upgraded realm-sync from v4.9.5 to v5.0.3\n\n5.0.0-beta.6 Release notes (2020-05-08)\n=============================================================\n\n### Enhancements\n\n* Add support for queue-confined Realms. Rather than being bound to a specific\n  thread, queue-confined Realms are bound to a serial dispatch queue and can be\n  used within blocks dispatched to that queue regardless of what thread they\n  happen to run on. In addition, change notifications will be delivered to that\n  queue rather than the thread's run loop. ([PR #6478](https://github.com/realm/realm-swift/pull/6478)).\n* Add an option to deliver object and collection notifications to a specific\n  serial queue rather than the current thread. ([PR #6478](https://github.com/realm/realm-swift/pull/6478)).\n\n### Fixed\n\n* The uploaded bytes in sync progress notifications was sometimes incorrect and\n  wouldn't exactly equal the uploadable bytes when the uploaded completed.\n\n### Breaking Changes\n\n* The Realm instance passed in the callback to asyncOpen() is now confined to\n  the callback queue passed to asyncOpen() rather than the thread which the\n  callback happens to be called on. This means that the Realm instance may be\n  stored and reused in further blocks dispatched to that queue, but the queue\n  must now be a serial queue.\n\n### Compatibility\n\n* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 11.4.1.\n\n### Internal\n\n* Upgraded realm-core from v6.0.3 to v6.0.4\n* Upgraded realm-sync from v5.0.1 to v5.0.3\n\n4.4.1 Release notes (2020-04-16)\n=============================================================\n\n### Enhancements\n\n* Upgrade Xcode 11.4 binaries to Xcode 11.4.1.\n\n### Fixed\n\n* Fix a \"previous <= m_schema_transaction_version_max\" assertion failure caused\n  by a race condition that could occur after performing a migration. (Since 3.0.0).\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 11.4.1.\n\n5.0.0-beta.3 Release notes (2020-02-26)\n=============================================================\n\nBased on 4.3.2 and also includes all changes since 4.3.0.\n\n### Enhancements\n\n* Add support for frozen objects. `Realm`, `Results`, `List` and `Object` now\n  have `freeze()` methods which return a frozen copy of the object. These\n  objects behave similarly to creating unmanaged deep copies of the source\n  objects. They can be read from any thread and do not update when writes are\n  made to the Realm, but creating frozen objects does not actually copy data\n  out of the Realm and so can be much faster and use less memory. Frozen\n  objects cannot be mutated or observed for changes (as they never change).\n  ([PR #6427](https://github.com/realm/realm-swift/pull/6427)).\n* Add the `isFrozen` property to `Realm`, `Results`, `List` and `Object`.\n* Add `Realm.Configuration.maxNumberOfActiveVersions`. Each time a write\n  transaction is performed, a new version is created inside the Realm, and then\n  any versions which are no longer in use are cleaned up. If too many versions\n  are kept alive while performing writes (either due to a background thread\n  performing a long operation that doesn't let the Realm on that thread\n  refresh, or due to holding onto frozen versions for a long time) the Realm\n  file will grow in size, potentially to the point where it is too large to be\n  opened. Setting this configuration option will make write transactions which\n  would cause the live version count to exceed the limit to instead fail.\n\n\n### Compatibility\n\n* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 11.3.\n\n### Internal\n\n* Upgraded realm-core from v6.0.0-beta.3 to v6.0.3\n* Upgraded realm-sync from v5.0.0-beta.2 to v5.0.1\n\n5.0.0-beta.2 Release notes (2020-01-13)\n=============================================================\n\nBased on 4.3.0 and also includes all changes since 4.1.1.\n\n### Fixed\n\n* Fix compilation when using CocoaPods targeting iOS versions older than 11 (since 5.0.0-alpha).\n\n### Compatibility\n\n* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 11.3.\n\n### Internal\n\n* Upgraded realm-core from v6.0.0-beta.2 to v6.0.0-beta.3\n* Upgraded realm-sync from v5.0.0-beta.1 to v5.0.0-beta.2\n\n5.0.0-beta.1 Release notes (2019-12-13)\n=============================================================\n\nBased on 4.1.1 and also includes all changes since 4.1.0.\n\nNOTE: 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.\n\n### Enhancements\n\n* String primary keys no longer require a separate index, improving insertion\n  and deletion performance without hurting lookup performance.\n* Reduce the encrypted page reclaimer's impact on battery life when encryption\n  is used. ([Core #3461](https://github.com/realm/realm-core/pull/3461)).\n\n### Fixed\n\n* Fix an error when a table-backed Results was accessed immediately after\n  deleting the object previously at the index being accessed (since\n  5.0.0-alpha.1).\n* macOS binaries were built with the incorrect deployment target (10.14 rather\n  than 10.9), resulting in linker warnings. ([#6299](https://github.com/realm/realm-swift/issues/6299), since 3.18.0).\n* An internal datastructure for List properties could be double-deleted if the\n  last reference was released from a thread other than the one which the List\n  was created on at the wrong time. This would typically manifest as\n  \"pthread_mutex_destroy() failed\", but could also result in other kinds of\n  crashes. ([#6333](https://github.com/realm/realm-swift/issues/6333)).\n* Sorting on float or double properties containing NaN values had inconsistent\n  results and would sometimes crash due to out-of-bounds memory accesses.\n  ([#6357](https://github.com/realm/realm-swift/issues/6357)).\n\n### Known Issues\n\n* Changing which property of an object is the primary key in a migration will\n  break incoming links to objects of that type.\n* Changing the primary key of an object with Data properties in a migration\n  will crash.\n\n### Compatibility\n\n* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* APIs are backwards compatible with all previous releases in the 5.x.y series.\n* Carthage release for Swift is built with Xcode 11.3.\n\n### Internal\n\n* Upgraded realm-core from v6.0.0-alpha.24 to v6.0.0-beta.2\n* Upgraded realm-sync from 4.7.1-core6.5 to v5.0.0-beta.1\n\n5.0.0-alpha.1 Release notes (2019-11-14)\n=============================================================\n\nBased on 4.1.0.\n\n### Enhancements\n\n* Add `-[RLMRealm fileExistsForConfiguration:]`/`Realm.fileExists(for:)`,\n  which checks if a local Realm file exists for the given configuration.\n* Add `-[RLMRealm deleteFilesForConfiguration:]`/`Realm.deleteFiles(for:)`\n  to delete the Realm file and all auxiliary files for the given configuration.\n* Storing large binary blobs in Realm files no longer forces the file to be at\n  least 8x the size of the largest blob.\n* Reduce the size of transaction logs stored inside the Realm file, reducing\n  file size growth from large transactions.\n\nNOTE: This version bumps the Realm file format to version 10. It is not\npossible to downgrade version 9 or earlier. Files created with older versions\nof Realm will be automatically upgraded. This automatic upgrade process is not\nyet well tested. Do not open Realm files with data you care about with this\nalpha version.\n\n### Breaking Changes\n\n* Files containing Date properties written by version of Realm prior to 1.0 can\n  no longer be opened.\n* Files containing Any properties can no longer be opened. This property type\n  was never documented and was deprecated in 1.0.\n\n### Compatibility\n\n* File format: Generates Realms with format v10 (Reads and upgrades v9)\n* Realm Object Server: 3.21.0 or later.\n* APIs are backwards compatible with all previous releases in the 4.x.y series.\n* Carthage release for Swift is built with Xcode 11.3.\n* Carthage release for Swift is built with Xcode 11.2.1.\n\n### Internal\n\n* Upgraded realm-core from 5.23.6 to v6.0.0-alpha.24.\n* Upgraded realm-sync from 4.8.2 to 4.7.1-core6.5.\n\n4.4.0 Release notes (2020-03-26)\n=============================================================\n\nSwift 4.0 and Xcode 10.3 are now the minimum supported versions.\n\n### Enhancements\n\n* Allow setting the `fileUrl` for synchronized Realms. An appropriate local\n  path based on the sync URL will still be used if it is not overridden.\n  ([PR #6454](https://github.com/realm/realm-swift/pull/6454)).\n* Add Xcode 11.4 binaries to the release package.\n\n### Fixed\n\n* None.\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 11.4.\n\n4.3.2 Release notes (2020-02-06)\n=============================================================\n\n### Enhancements\n\n* Similar to `autoreleasepool()`, `realm.write()` now returns the value which\n  the block passed to it returns. Returning `Void` from the block is still allowed.\n\n### Fixed\n\n* Fix a memory leak attributed to `property_copyAttributeList` the first time a\n  Realm is opened when using Realm Swift. ([#6409](https://github.com/realm/realm-swift/issues/6409), since 4.0.0).\n* Connecting to a `realms:` sync URL would crash at runtime on iOS 11 (and no\n  other iOS versions) inside the SSL validation code. (Since 4.3.1).\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 11.3.\n\n### Internal\n\n* Upgraded realm-sync from 4.9.4 to 4.9.5.\n\n4.3.1 Release notes (2020-01-16)\n=============================================================\n\n### Enhancements\n\n* Reduce the encrypted page reclaimer's impact on battery life when encryption\n  is used. ([Core #3461](https://github.com/realm/realm-core/pull/3461)).\n\n### Fixed\n\n* macOS binaries were built with the incorrect deployment target (10.14 rather\n  than 10.9), resulting in linker warnings. ([#6299](https://github.com/realm/realm-swift/issues/6299), since 3.18.0).\n* An internal datastructure for List properties could be double-deleted if the\n  last reference was released from a thread other than the one which the List\n  was created on at the wrong time. This would typically manifest as\n  \"pthread_mutex_destroy() failed\", but could also result in other kinds of\n  crashes. ([#6333](https://github.com/realm/realm-swift/issues/6333)).\n* Sorting on float or double properties containing NaN values had inconsistent\n  results and would sometimes crash due to out-of-bounds memory accesses.\n  ([#6357](https://github.com/realm/realm-swift/issues/6357)).\n* A NOT query on a `List<Object>` which happened to have the objects in a\n  different order than the underlying table would sometimes include the object\n  immediately before an object which matches the query. ([#6289](https://github.com/realm/realm-swift/issues/6289), since 0.90.0).\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 11.3.\n\n### Internal\n\n* Upgraded realm-core from 5.23.6 to 5.23.8.\n* Upgraded realm-sync from 4.9.0 to 4.9.4.\n\n4.3.0 Release notes (2019-12-19)\n=============================================================\n\n### Enhancements\n\n* Add the ability to set a custom logger function on `RLMSyncManager` which is\n  called instead of the default NSLog-based logger.\n* Expose configuration options for the various types of sync connection\n  timeouts and heartbeat intervals on `RLMSyncManager`.\n* Add an option to have `Realm.asyncOpen()` report an error if the connection\n  times out rather than swallowing the error and attempting to reconnect until\n  it succeeds.\n\n### Fixed\n\n* Fix a crash when using value(forKey:) on a LinkingObjects property (including\n  when doing so indirectly, such as by querying on that property).\n  ([#6366](https://github.com/realm/realm-swift/issues/6366), since 4.0.0).\n* Fix a rare crash in `ClientHistoryImpl::integrate_server_changesets()` which\n  would only happen in Debug builds (since v3.0.0).\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 11.3.\n\n### Internal\n\n* Upgraded realm-sync from 4.8.2 to 4.9.0.\n\n4.2.0 Release notes (2019-12-16)\n=============================================================\n\n### Enhancements\n\n* Add `-[RLMRealm fileExistsForConfiguration:]`/`Realm.fileExists(for:)`,\n  which checks if a local Realm file exists for the given configuration.\n* Add `-[RLMRealm deleteFilesForConfiguration:]`/`Realm.deleteFiles(for:)`\n  to delete the Realm file and all auxiliary files for the given configuration.\n\n### Fixed\n\n* None.\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 11.3.\n\n4.1.1 Release notes (2019-11-18)\n=============================================================\n\n### Fixed\n\n* The UpdatePolicy passed to `realm.add()` or `realm.create()` was not properly\n  propagated when adding objects within a `List`, which could result in\n  spurious change notifications when using `.modified`.\n  ([#6321](https://github.com/realm/realm-swift/issues/6321), since v3.16.0)\n* Fix a rare deadlock when a Realm collection or object was observed, then\n  `refresh()` was explicitly called, and then the NotificationToken from the\n  observation was destroyed on a different thread (since 0.98.0).\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 11.2.\n\n4.1.0 Release notes (2019-11-13)\n=============================================================\n\n### Enhancements\n\n* Improve performance of queries over a link where the final target property\n  has an index.\n* Restore support for storing `@objc enum` properties on RealmSwift.Object\n  subclasses (broken in 4.0.0), and add support for storing them in\n  RealmOptional properties.\n\n### Fixed\n\n* The sync client would fail to reconnect after failing to integrate a\n  changeset. The bug would lead to further corruption of the client’s Realm\n  file. ([RSYNC-48](https://jira.mongodb.org/browse/RSYNC-48), since v3.2.0).\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 11.2.\n\n### Internal\n\n* Upgraded realm-core from 5.23.5 to 5.23.6.\n* Upgraded realm-sync from 4.7.11 to 4.8.2\n\n4.0.0 Release notes (2019-11-08)\n=============================================================\n\n### Breaking Changes\n\n* All previously deprecated functionality has now been removed entirely.\n* The schema discovery logic for RealmSwift.Object subclasses has been\n  rewritten in Swift. This should not have any effect on valid class\n  definitions, but there may be types of invalid definitions which previously\n  worked by coincidence and no longer do.\n* `SyncSubscription` no longer has a generic type parameter, as the type was\n  not actually used for anything.\n* The following Swift types have changed from `final class` to `struct`:\n    - AnyRealmCollection\n    - LinkingObjects\n    - ObjectiveCSupport\n    - Realm\n    - Results\n    - SyncSubscription\n    - ThreadSafeReference\n  There is no intended change in semantics from this, but certain edge cases\n  may behave differently.\n* The designated initializers defined by RLMObject and Object other than\n  zero-argument `init` have been replaced with convenience initializers.\n* The implementation of the path-based permissions API has been redesigned to\n  accomodate changes to the server. This should be mostly a transparent change,\n  with two main exceptions:\n  1. SyncPermission objects are no longer live Realm objects, and retrieving\n  permissions gives an Array<SyncPermission> rather than Results<SyncPermission>.\n  Getting up-to-date permissions now requires calling retrievePermissions() again\n  rather than observing the permissions.\n  2. The error codes for permissions functions have changed. Rather than a\n  separate error type and set of error codes, permission functions now produce\n  SyncAuthErrors.\n\n### Enhancements\n\n* Improve performance of initializing Realm objects with List properties.\n\n### Fixed\n\n* None.\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 11.2.\n\n3.21.0 Release notes (2019-11-04)\n=============================================================\n\n### Enhancements\n\n* Add prebuilt binaries for Xcode 11.2.\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 11.2.\n\n3.20.0 Release notes (2019-10-21)\n=============================================================\n\n### Enhancements\n\n* Add support for custom refresh token authentication. This allows a user to be\n  authorized with an externally-issued refresh token when ROS is configured to\n  recognize the external issuer as a refresh token validator.\n  ([PR #6311](https://github.com/realm/realm-swift/pull/6311)).\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 11.\n\n3.19.1 Release notes (2019-10-17)\n=============================================================\n\n### Enhancements\n\n* Improve performance of sync changeset integration. Transactions involving a\n  very large number of objects and cheap operations on each object are as much\n  as 20% faster.\n\n### Fixed\n\n* Fix a crash when a RLMArray/List of primitives was observed and then the\n  containing object was deleted before the first time that the background\n  notifier could run.\n  ([Issue #6234](https://github.com/realm/realm-swift/issues/6234, since 3.0.0)).\n* Remove an incorrect assertion that would cause crashes inside\n  `TableInfoCache::get_table_info()`, with messages like \"Assertion failed: info.object_id_index == 0 [3, 0]\".\n  (Since 3.18.0, [#6268](https://github.com/realm/realm-swift/issues/6268) and [#6257](https://github.com/realm/realm-swift/issues/6257)).\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 11.0.\n\n### Internal\n\n* Upgrade to REALM_SYNC_VERSION=4.7.11\n\n3.19.0 Release notes (2019-09-27)\n=============================================================\n\n### Enhancements\n\n* Expose ObjectSchema.objectClass in Swift as looking up the class via\n  NSClassFromString() can be complicated for Swift types.\n  ([PR #6244](https://github.com/realm/realm-swift/pull/6244)).\n* Add support for suppressing notifications using closure-based write/transaction methods.\n  ([PR #6252](https://github.com/realm/realm-swift/pull/6252)).\n\n### Fixed\n\n* IN or chained OR equals queries on an unindexed string column would fail to\n  match some results if any of the strings were 64 bytes or longer.\n  ([Core #3386](https://github.com/realm/realm-core/pull/3386), since 3.14.2).\n* Query Based Sync subscriptions for queries involving a null timestamp were\n  not sent to the server correctly and would match no objects.\n  ([Core #3389](https://github.com/realm/realm-core/pull/3388), since 3.17.3).\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 11.0.\n\n### Internal\n\n* Upgrade to REALM_CORE_VERSION=5.23.5\n* Upgrade to REALM_SYNC_VERSION=4.7.8\n\n3.18.0 Release notes (2019-09-13)\n=============================================================\n\nThe file format for synchronized Realms has changed. Old Realms will be\nautomatically upgraded when they are opened. Once upgraded, the files will not\nbe openable by older versions of Realm. The upgrade should not take a\nsignificant amount of time to run or run any risk of errors.\n\nThis does not effect non-synchronized Realms.\n\n### Enhancements\n\n* Improve performance of queries on Date properties\n  ([Core #3344](https://github.com/realm/realm-core/pull/3344), [Core #3351](https://github.com/realm/realm-core/pull/3351)).\n* Syncronized Realms are now more aggressive about trimming local history that\n  is no longer needed. This should reduce file size growth in write-heavy\n  workloads. ([Sync #3007](https://github.com/realm/realm-sync/issues/3007)).\n* Add support for building Realm as an xcframework.\n  ([PR #6238](https://github.com/realm/realm-swift/pull/6238)).\n* Add prebuilt libraries for Xcode 11 to the release package.\n  ([PR #6248](https://github.com/realm/realm-swift/pull/6248)).\n* Add a prebuilt library for Catalyst/UIKit For Mac to the release package\n  ([PR #6248](https://github.com/realm/realm-swift/pull/6248)).\n\n### Fixed\n\n* If a signal interrupted a msync() call, Realm would throw an exception and\n  the write transaction would fail. This behavior has new been changed to retry\n  the system call instead. ([Core #3352](https://github.com/realm/realm-core/issues/3352))\n* Queries on the sum or average of an integer property would sometimes give\n  incorrect results. ([Core #3356](https://github.com/realm/realm-core/pull/3356)).\n* Opening query-based synchronized Realms with a small number of subscriptions\n  performed an unneccesary write transaction. ([ObjectStore #815](https://github.com/realm/realm-object-store/pull/815)).\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 11.0\n\n### Deprecations\n\n* `RLMIdentityProviderNickname` has been deprecated in favor of `RLMIdentityProviderUsernamePassword`.\n* `+[RLMIdentityProvider credentialsWithNickname]` has been deprecated in favor of `+[RLMIdentityProvider credentialsWithUsername]`.\n* `Sync.nickname(String, Bool)` has been deprecated in favor of `Sync.usernamePassword(String, String, Bool)`.\n\n3.17.3 Release notes (2019-07-24)\n=============================================================\n\n### Enhancements\n\n* Add Xcode 10.3 binaries to the release package. Remove the Xcode 9.2 and 9.3 binaries.\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 10.3.\n\n3.17.1 Release notes (2019-07-10)\n=============================================================\n\n### Enhancements\n\n* Add support for canceling asynchronous opens using a new AsyncOpenTask\n  returned from the asyncOpen() call. ([PR #6193](https://github.com/realm/realm-swift/pull/6193)).\n* Importing the Realm SPM package can now be done by pinning to a version\n  rather than a branch.\n\n### Fixed\n\n* Queries on a List/RLMArray which checked an indexed int property would\n  sometimes give incorrect results.\n  ([#6154](https://github.com/realm/realm-swift/issues/6154)), since v3.15.0)\n* Queries involving an indexed int property had a memory leak if run multiple\n  times. ([#6186](https://github.com/realm/realm-swift/issues/6186)), since v3.15.0)\n* Creating a subscription with `includeLinkingObjects:` performed unneccesary\n  comparisons, making it extremely slow when large numbers of objects were\n  involved. ([Core #3311](https://github.com/realm/realm-core/issues/3311), since v3.15.0)\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 10.2.1.\n\n3.17.0 Release notes (2019-06-28)\n=============================================================\n\n### Enhancements\n\n* Add support for including Realm via Swift Package Manager. This currently\n  requires depending on the branch \"master\" rather than pinning to a version\n  (i.e. `.package(url: \"https://github.com/realm/realm-swift\", .branch(\"master\"))`).\n  ([#6187](https://github.com/realm/realm-swift/pull/6187)).\n* Add Codable conformance to RealmOptional and List, and Encodable conformance to Results.\n  ([PR #6172](https://github.com/realm/realm-swift/pull/6172)).\n\n### Fixed\n\n* Attempting to observe an unmanaged LinkingObjects object crashed rather than\n  throwing an approriate exception (since v0.100.0).\n* Opening an encrypted Realm could potentially report that a valid file was\n  corrupted if the system was low on free memory.\n  (since 3.14.0, [Core #3267](https://github.com/realm/realm-core/issues/3267))\n* Calling `Realm.asyncOpen()` on multiple Realms at once would sometimes crash\n  due to a `FileNotFound` exception being thrown on a background worker thread.\n  (since 3.16.0, [ObjectStore #806](https://github.com/realm/realm-object-store/pull/806)).\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 10.2.1.\n\n3.16.2 Release notes (2019-06-14)\n=============================================================\n\n### Enhancements\n\n* Add support for Xcode 11 Beta 1. Xcode betas are only supported when building\n  from source, and not when using a prebuilt framework.\n  ([PR #6164](https://github.com/realm/realm-swift/pull/6164)).\n\n### Fixed\n\n* Using asyncOpen on query-based Realms which didn't already exist on the local\n  device would fail with error 214.\n  ([#6178](https://github.com/realm/realm-swift/issues/6178), since 3.16.0).\n* asyncOpen on query-based Realms did not wait for the server-created\n  permission objects to be downloaded, resulting in crashes if modifications to\n  the permissions were made before creating a subscription for the first time (since 3.0.0).\n* EINTR was not handled correctly in the notification worker, which may have\n  resulted in inconsistent and rare assertion failures in\n  `ExternalCommitHelper::listen()` when building with assertions enabled.\n  (PR: [#804](https://github.com/realm/realm-object-store/pull/804), since 0.91.0).\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 10.2.1.\n\n3.16.1 Release notes (2019-05-31)\n=============================================================\n\n### Fixed\n\n* The static type passed at compile time to `realm.create()` was checked for a\n  primary key rather than the actual type passed at runtime, resulting in\n  exceptions like \"''RealmSwiftObject' does not have a primary key and can not\n  be updated'\" being thrown even if the object type being created has a primary\n  key. (since 3.16.0, [#6159](https://github.com/realm/realm-swift/issues/6159)).\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 10.2.1.\n\n3.16.0 Release notes (2019-05-29)\n=============================================================\n\n### Enhancements\n\n* Add an option to only set the properties which have values different from the\n  existing ones when updating an existing object with\n  `Realm.create()`/`-[RLMObject createOrUpdateInRealm:withValue:]`. This makes\n  notifications report only the properties which have actually changed, and\n  improves Object Server performance by reducing the number of operations to\n  merge. (Issue: [#5970](https://github.com/realm/realm-swift/issues/5970),\n  PR: [#6149](https://github.com/realm/realm-swift/pull/6149)).\n* Using `-[RLMRealm asyncOpenWithConfiguration:callbackQueue:]`/`Realm.asyncOpen()` to open a\n  synchronized Realm which does not exist on the local device now uses an\n  optimized transfer method to download the initial data for the Realm, greatly\n  speeding up the first start time for applications which use full\n  synchronization. This is currently not applicable to query-based\n  synchronization. (PR: [#6106](https://github.com/realm/realm-swift/pull/6106)).\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 10.2.1.\n\n3.15.0 Release notes (2019-05-06)\n=============================================================\n\nThe minimum version of Realm Object Server has been increased to 3.21.0 and\nattempting to connect to older versions will produce protocol mismatch errors.\nRealm Cloud has already been upgraded to this version, and users using that do\nnot need to worry about this.\n\n### Enhancements\n\n* Add `createdAt`, `updatedAt`, `expiresAt` and `timeToLive` properties to\n  `RLMSyncSubscription`/`SyncSubscription`. These properties will be `nil` for\n  subscriptions created with older versions of Realm, but will be automatically\n  populated for newly-created subscriptions.\n* Add support for transient subscriptions by setting the `timeToLive` when\n  creating the subscription. The next time a subscription is created or updated\n  after that time has elapsed the subscription will be automatically removed.\n* Add support for updating existing subscriptions with a new query or limit.\n  This is done by passing `update: true` (in swift) or setting\n  `options.overwriteExisting = YES` (in obj-c) when creating the subscription,\n  which will make it update the existing subscription with the same name rather\n  than failing if one already exists with that name.\n* Add an option to include the objects from\n  `RLMLinkingObjects`/`LinkingObjects` properties in sync subscriptions,\n  similarly to how `RLMArray`/`List` automatically pull in the contained\n  objects.\n* Improve query performance for chains of OR conditions (or an IN condition) on\n  an unindexed integer or string property.\n  ([Core PR #2888](https://github.com/realm/realm-core/pull/2888) and\n  [Core PR #3250](https://github.com/realm/realm-core/pull/3250)).\n* Improve query performance for equality conditions on indexed integer properties.\n  ([Core PR #3272](https://github.com/realm/realm-core/pull/3272)).\n* Adjust the file allocation algorithm to reduce fragmentation caused by large\n  numbers of small blocks.\n* Improve file allocator logic to reduce fragmentation and improve commit\n  performance after many writes. ([Core PR #3278](https://github.com/realm/realm-core/pull/3278)).\n\n### Fixed\n\n* Making a query that compares two integer properties could cause a\n  segmentation fault on x86 (i.e. macOS only).\n  ([Core PR #3253](https://github.com/realm/realm-core/pull/3256)).\n* The `downloadable_bytes` parameter passed to sync progress callbacks reported\n  a value which correlated to the amount of data left to download, but not\n  actually the number of bytes which would be downloaded.\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.21.0 or later.\n* Carthage release for Swift is built with Xcode 10.2.1.\n\n3.14.2 Release notes (2019-04-25)\n=============================================================\n\n### Enhancements\n\n* Updating `RLMSyncManager.customRequestHeaders` will immediately update all\n  currently active sync session with the new headers rather than requiring\n  manually closing the Realm and reopening it.\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.11.0 or later.\n* Carthage release for Swift is built with Xcode 10.2.1.\n\n3.14.1 Release notes (2019-04-04)\n=============================================================\n\n### Fixed\n\n* Fix \"Cannot find interface declaration for 'RealmSwiftObject', superclass of\n  'MyRealmObjectClass'\" errors when building for a simulator with Xcode 10.2\n  with \"Install Objective-C Compatibility Header\" enabled.\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.11.0 or later.\n* Carthage release for Swift is built with Xcode 10.2.\n\n3.14.0 Release notes (2019-03-27)\n=============================================================\n\n### Enhancements\n\n* Reduce memory usage when committing write transactions.\n* Improve performance of compacting encrypted Realm files.\n  ([PR #3221](https://github.com/realm/realm-core/pull/3221)).\n* Add a Xcode 10.2 build to the release package.\n\n### Fixed\n\n* Fix a memory leak whenever Realm makes a HTTP(s) request to the Realm Object\n  Server (Issue [#6058](https://github.com/realm/realm-swift/issues/6058), since 3.8.0).\n* Fix an assertion failure when creating an object in a synchronized Realm\n  after creating an object with a null int primary key in the same write\n  transaction.\n  ([PR #3227](https://github.com/realm/realm-core/pull/3227)).\n* Fix some new warnings when building with Xcode 10.2 beta.\n* Properly clean up sync sessions when the last Realm object using the session\n  is deallocated while the session is explicitly suspended (since 3.9.0).\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.11.0 or later.\n* Carthage release for Swift is built with Xcode 10.2.\n\n### Internal\n\n* Throw an exception rather than crashing with an assertion failure in more\n  cases when opening invalid Realm files.\n* Upgrade to REALM_CORE_VERSION=5.14.0\n* Upgrade to REALM_SYNC_VERSION=3.15.1\n\n3.13.1 Release notes (2019-01-03)\n=============================================================\n\n### Fixed\n\n* Fix a crash when iterating over `Realm.subscriptions()` using for-in.\n  (Since 3.13.0, PR [#6050](https://github.com/realm/realm-swift/pull/6050)).\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.11.0 or later.\n\n3.13.0 Release notes (2018-12-14)\n=============================================================\n\n### Enhancements\n\n* Add `Realm.subscriptions()`/`-[RLMRealm subscriptions]` and\n  `Realm.subscription(named:)`/`-[RLMRealm subscriptionWithName:]` to enable\n  looking up existing query-based sync subscriptions.\n  (PR: https://github.com/realm/realm-swift/pull/6029).\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.11.0 or later.\n\n3.12.0 Release notes (2018-11-26)\n=============================================================\n\n### Enhancements\n\n* Add a User-Agent header to HTTP requests made to the Realm Object Server. By\n  default, this contains information about the Realm library version and your\n  app's bundle ID. The application identifier can be customized by setting\n  `RLMSyncManager.sharedManager.userAgent`/`SyncManager.shared.userAgent` prior\n  to opening a synchronized Realm.\n  (PR: https://github.com/realm/realm-swift/pull/6007).\n* Add Xcode 10.1 binary to the prebuilt package.\n\n### Fixed\n\n* None.\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.11.0 or later.\n\n### Internal\n\n* None.\n\n\n3.11.2 Release notes (2018-11-15)\n=============================================================\n\n### Enhancements\n\n* Improve the performance of the merge algorithm used for integrating remote\n  changes from the server. In particular, changesets involving many objects\n  which all link to a single object should be greatly improved.\n\n### Fixed\n\n* Fix a memory leak when removing notification blocks from collections.\n  PR: [#702](https://github.com/realm/realm-object-store/pull/702), since 1.1.0.\n* Fix re-sorting or distincting an already-sorted Results using values from\n  linked objects. Previously the unsorted order was used to read the values\n  from the linked objects.\n  PR [#3102](https://github.com/realm/realm-core/pull/3102), since 3.1.0.\n* Fix a set of bugs which could lead to bad changeset assertions when using\n  sync. The assertions would look something like the following:\n  `[realm-core-5.10.0] Assertion failed: ndx < size() with (ndx, size()) =  [742, 742]`.\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.11.0 or later.\n\n### Internal\n\n* None.\n\n\n3.11.1 Release notes (2018-10-19)\n=============================================================\n\n### Enhancements\n\n* None.\n\n### Fixed\n\n* Fix `SyncUser.requestEmailConfirmation` not triggering the email confirmation\n  flow on ROS. (PR [#5953](https://github.com/realm/realm-swift/pull/5953), since 3.5.0)\n* Add some missing validation in the getters and setters of properties on\n  managed Realm objects, which would sometimes result in an application\n  crashing with a segfault rather than the appropriate exception being thrown\n  when trying to write to an object which has been deleted.\n  (PR [#5952](https://github.com/realm/realm-swift/pull/5952), since 2.8.0)\n\n### Compatibility\n\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* Realm Object Server: 3.11.0 or later.\n\n### Internal\n\n* None.\n\n\n3.11.0 Release notes (2018-10-04)\n=============================================================\n\n### Enhancements\n* Reduce memory usage when integrating synchronized changes sent by ROS.\n* Devices will now report download progress for read-only Realms, allowing the\n  server to compact Realms more aggressively and reducing the amount of\n  server-side storage space required.\n\n### Fixed\n* Fix a crash when adding an object with a non-`@objc` `String?` property which\n  has not been explicitly ignored to a Realm on watchOS 5 (and possibly other\n  platforms when building with Xcode 10).\n  (Issue: [5929](https://github.com/realm/realm-swift/issues/5929)).\n* Fix some merge algorithm bugs which could result in `BadChangesetError`\n  being thrown when integrating changes sent by the server.\n\n### Compatibility\n* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)\n* **NOTE!!!\n  You will need to upgrade your Realm Object Server to at least version 3.11.0\n  or use [Realm Cloud](https://cloud.realm.io).\n  If you try to connect to a ROS v3.10.x or previous, you will see an error\n  like `Wrong protocol version in Sync HTTP request, client protocol version = 25,\n  server protocol version = 24`.**\n\n### Internal\n* Update to Sync 3.12.2.\n\n\n3.10.0 Release notes (2018-09-19)\n=============================================================\n\nPrebuilt binaries are now built for Xcode 9.2, 9.3, 9.4 and 10.0.\n\nOlder versions of Xcode are still supported when building from source, but you\nshould be migrating to at least Xcode 9.2 as soon as possible.\n\n### Enhancements\n\n* Add support for Watch Series 4 by adding an arm64_32 slice to the library.\n\n3.9.0 Release notes (2018-09-10)\n=============================================================\n\n### Enhancements\n\n* Expose RLMSyncUser.refreshToken publicly so that it can be used for custom\n  HTTP requests to Realm Object Server.\n* Add RLMSyncSession.connectionState, which reports whether the session is\n  currently connected to the Realm Object Server or if it is offline.\n* Add `-suspend` and `-resume` methods to `RLMSyncSession` to enable manually\n  pausing data synchronization.\n* Add support for limiting the number of objects matched by a query-based sync\n  subscription. This requires a server running ROS 3.10.1 or newer.\n\n### Bugfixes\n\n* Fix crash when getting the description of a `MigrationObject` which has\n  `List` properties.\n* Fix crash when calling `dynamicList()` on a `MigrationObject`.\n\n3.8.0 Release notes (2018-09-05)\n=============================================================\n\n### Enhancements\n\n* Remove some old and no longer applicable migration logic which created an\n  unencrypted file in the sync metadata directory containing a list of ROS URLs\n  connected to.\n* Add support for pinning SSL certificates used for https and realms\n  connections by setting `RLMSyncManager.sharedManager.pinnedCertificatePaths`\n  in obj-c and `SyncManager.shared.pinnedCertificatePaths` in Swift.\n\n### Bugfixes\n\n* Fix warnings when building Realm as a static framework with CocoaPods.\n\n3.7.6 Release notes (2018-08-08)\n=============================================================\n\n### Enhancements\n\n* Speed up the actual compaction when using compact-on-launch.\n* Reduce memory usage when locally merging changes from sync.\n* When first connecting to a server, wait to begin uploading changes until\n  after all changes have been downloaded to reduce the server-side load for\n  query-based sync.\n\n3.7.5 Release notes (2018-07-23)\n=============================================================\n\n### Enhancements\n\n* Improve performance of applying remote changesets from sync.\n* Improve performance of creating objects with string primary keys.\n* Improve performance of large write transactions.\n* Adjust file space allocation strategy to reduce fragmentation, producing\n  smaller Realm files and typically better performance.\n* Close network connections immediately when a sync session is destroyed.\n* Report more information in `InvalidDatabase` exceptions.\n\n### Bugfixes\n\n* Fix permission denied errors for RLMPlatform.h when building with CocoaPods\n  and Xcode 10 beta 3.\n* Fix a use-after-free when canceling a write transaction which could result in\n  incorrect \"before\" values in KVO observations (typically `nil` when a non-nil\n  value is expected).\n* Fix several bugs in the merge algorithm that could lead to memory corruption\n  and crashes with errors like \"bad changeset\" and \"unreachable code\".\n\n3.7.4 Release notes (2018-06-19)\n=============================================================\n\n### Bugfixes\n\n* Fix a bug which could potentially flood Realm Object Server with PING\n  messages after a client device comes back online.\n\n3.7.3 Release notes (2018-06-18)\n=============================================================\n\n### Enhancements\n\n* Avoid performing potentially large amounts of pointless background work for\n  LinkingObjects instances which are accessed and then not immediate deallocated.\n\n### Bugfixes\n\n* Fix crashes which could result from extremely fragmented Realm files.\n* Fix a bug that could result in a crash with the message \"bad changeset error\"\n  when merging changesets from the server.\n\n3.7.2 Release notes (2018-06-13)\n=============================================================\n\n### Enhancements\n\n* Add some additional consistency checks that will hopefully produce better\n  errors when the \"prev_ref + prev_size <= ref\" assertion failure occurs.\n\n### Bugfixes\n\n* Fix a problem in the changeset indexing algorithm that would sometimes\n  cause \"bad permission object\" and \"bad changeset\" errors.\n* Fix a large number of linking warnings about symbol visibility by aligning\n  compiler flags used.\n* Fix large increase in size of files produced by `Realm.writeCopy()` introduced in 3.6.0.\n\n3.7.1 Release notes (2018-06-07)\n=============================================================\n\n* Add support for compiling Realm Swift with Xcode 10 beta 1.\n\n3.7.0 Release notes (2018-06-06)\n=============================================================\n\nThe feature known as Partial Sync has been renamed to Query-based\nSynchronization. This has impacted a number of API's. See below for the\ndetails.\n\n### Deprecations\n\n* `+[RLMSyncConfiguration initWithUser] has been deprecated in favor of `-[RLMSyncUser configurationWithURL:url].\n* `+[RLMSyncConfiguration automaticConfiguration] has been deprecated in favor of `-[RLMSyncUser configuration].\n* `+[RLMSyncConfiguration automaticConfigurationForUser] has been deprecated in favor of `-[RLMSyncUser configuration].\n* `-[RLMSyncConfiguration isPartial] has been deprecated in favor of `-[RLMSyncConfiguration fullSynchronization]`.\n\n### Enhancements\n\n* Add `-[RLMRealm syncSession]` and  `Realm.syncSession` to obtain the session used for a synchronized Realm.\n* Add `-[RLMSyncUser configuration]`. Query-based sync is the default sync mode for this configuration.\n* Add `-[RLMSyncUser configurationWithURL:url]`. Query-based sync is the default sync mode for this configuration.\n\n3.6.0 Release notes (2018-05-29)\n=============================================================\n\n### Enhancements\n\n* Improve performance of sync metadata operations and resolving thread-safe\n  references.\n* `shouldCompactOnLaunch` is now supported for compacting the local data of\n  synchronized Realms.\n\n### Bugfixes\n\n* Fix a potential deadlock when a sync session progress callback held the last\n  strong reference to the sync session.\n* Fix some cases where comparisons to `nil` in queries were not properly\n  serialized when subscribing to a query.\n* Don't delete objects added during a migration after a call to `-[RLMMigration\n  deleteDataForClassName:]`.\n* Fix incorrect results and/or crashes when multiple `-[RLMMigration\n  enumerateObjects:block:]` blocks deleted objects of the same type.\n* Fix some edge-cases where `-[RLMMigration enumerateObjects:block:]`\n  enumerated the incorrect objects following deletions.\n* Restore the pre-3.5.0 behavior for Swift optional properties missing an ivar\n  rather than crashing.\n\n3.5.0 Release notes (2018-04-25)\n=============================================================\n\n### Enhancements\n\n* Add wrapper functions for email confirmation and password reset to `SyncUser`.\n\n### Bugfixes\n\n* Fix incorrect results when using optional chaining to access a RealmOptional\n  property in Release builds, or otherwise interacting with a RealmOptional\n  object after the owning Object has been deallocated.\n\n3.4.0 Release notes (2018-04-19)\n=============================================================\n\nThe prebuilt binary for Carthage is now built for Swift 4.1.\n\n### Enhancements\n\n* Expose `RLMSyncManager.authorizationHeaderName`/`SyncManager.authorizationHeaderName`\n  as a way to override the transport header for Realm Object Server authorization.\n* Expose `RLMSyncManager.customRequestHeaders`/`SyncManager.customRequestHeaders`\n  which allows custom HTTP headers to be appended on requests to the Realm Object Server.\n* Expose `RLMSSyncConfiguration.urlPrefix`/`SyncConfiguration.urlPrefix` as a mechanism\n  to replace the default path prefix in Realm Sync WebSocket requests.\n\n3.3.2 Release notes (2018-04-03)\n=============================================================\n\nAdd a prebuilt binary for Xcode 9.3.\n\n3.3.1 Release notes (2018-03-28)\n=============================================================\n\nRealm Object Server v3.0.0 or newer is required when using synchronized Realms.\n\n### Enhancements\n\n* Expose `RLMObject.object(forPrimaryKey:)` as a factory method for Swift so\n  that it is callable with recent versions of Swift.\n\n### Bugfixes\n\n* Exclude the RLMObject-derived Permissions classes from the types repored by\n  `Realm.Configuration.defaultConfiguration.objectTypes` to avoid a failed\n  cast.\n* Cancel pending `Realm.asyncOpen()` calls when authentication fails with a\n  non-transient error such as missing the Realm path in the URL.\n* Fix \"fcntl() inside prealloc()\" errors on APFS.\n\n3.3.0 Release notes (2018-03-19)\n=============================================================\n\nRealm Object Server v3.0.0 or newer is required when using synchronized Realms.\n\n### Enhancements\n\n* Add `Realm.permissions`, `Realm.permissions(forType:)`, and `Realm.permissions(forClassNamed:)` as convenience\n  methods for accessing the permissions of the Realm or a type.\n\n### Bugfixes\n\n* Fix `+[RLMClassPermission objectInRealm:forClass:]` to work for classes that are part of the permissions API,\n  such as `RLMPermissionRole`.\n* Fix runtime errors when applications define an `Object` subclass with the\n  same name as one of the Permissions object types.\n\n3.2.0 Release notes (2018-03-15)\n=============================================================\n\nRealm Object Server v3.0.0 or newer is required when using synchronized Realms.\n\n### Enhancements\n\n* Added an improved API for adding subscriptions in partially-synchronized Realms. `Results.subscribe()` can be\n  used to subscribe to any result set, and the returned `SyncSubscription` object can be used to observe the state\n  of the subscription and ultimately to remove the subscription. See the documentation for more information\n  (<https://docs.realm.io/platform/v/3.x/using-synced-realms/syncing-data>).\n* Added a fine-grained permissions system for use with partially-synchronized Realms. This allows permissions to be\n  defined at the level of individual objects or classes. See the documentation for more information\n  (<https://docs.realm.io/platform/v/3.x/using-synced-realms/access-control>).\n* Added `SyncConfiguration.automatic()` and `SyncConfiguration.automatic(user:)`.\n  These methods return a `Realm.Configuration` appropriate for syncing with the default\n  synced Realm for the current (or specified) user. These should be considered the preferred methods\n  for accessing synced Realms going forwards.\n* Added `+[RLMSyncSession sessionForRealm:]` to retrieve the sync session corresponding to a `RLMRealm`.\n\n### Bugfixes\n\n* Fix incorrect initalization of `RLMSyncManager` that made it impossible to\n  set `errorHandler`.\n* Fix compiler warnings when building with Xcode 9.3.\n* Fix some warnings when running with UBsan.\n\n3.2.0-rc.1 Release notes (2018-03-14)\n=============================================================\n\nRealm Object Server v3.0.0-rc.1 or newer is required when using synchronized Realms.\n\n### Enhancements\n\n* Added `SyncConfiguration.automatic()` and `SyncConfiguration.automatic(user:)`.\n  These methods return a `Realm.Configuration` appropriate for syncing with the default\n  synced Realm for the current (or specified). These should be considered the preferred methods\n  for accessing synced Realms going forwards.\n* A role is now automatically created for each user with that user as its only member.\n  This simplifies the common use case of restricting access to specific objects to a single user.\n  This role can be accessed at `PermissionUser.role`.\n* Improved error reporting when the server rejects a schema change due to a lack of permissions.\n\n### Bugfixes\n\n* Fix incorrect initalization of `RLMSyncManager` that made it impossible to\n  set `errorHandler`.\n* Fix compiler warnings when building with Xcode 9.3.\n\n3.2.0-beta.3 Release notes (2018-03-01)\n=============================================================\n\nRealm Object Server v3.0.0-alpha.9 or newer is required when using synchronized Realms.\n\n### Bugfixes\n\n* Fix a crash that would occur when using partial sync with Realm Object Server v3.0.0-alpha.9.\n\n3.2.0-beta.2 Release notes (2018-02-28)\n=============================================================\n\nRealm Object Server v3.0.0-alpha.8 or newer is required when using synchronized Realms.\n\n### Enhancements\n\n* Added `findOrCreate(forRoleNamed:)` and `findOrCreate(forRole:)` to `List<Permission>`\n  to simplify the process of adding permissions for a role.\n* Added `+permissionForRoleNamed:inArray:`, `+permissionForRoleNamed:onRealm:`,\n  `+permissionForRoleNamed:onClass:realm:`, `+permissionForRoleNamed:onClassNamed:realm:`,\n  and `+permissionForRoleNamed:onObject:` to `RLMSyncPermission` to simplify the process\n  of adding permissions for a role.\n* Added `+[RLMSyncSession sessionForRealm:]` to retrieve the sync session corresponding to a `RLMRealm`.\n\n### Bugfixes\n\n* `PermissionRole.users` and `PermissionUser.roles` are now public as intended.\n* Fixed the handling of `setPermissions` in `-[RLMRealm privilegesForRealm]` and related methods.\n\n3.2.0-beta.1 Release notes (2018-02-19)\n=============================================================\n\n### Enhancements\n\n* Added an improved API for adding subscriptions in partially-synchronized Realms. `Results.subscribe()` can be\n  used to subscribe to any result set, and the returned `SyncSubscription` object can be used to observe the state\n  of the subscription and ultimately to remove the subscription.\n* Added a fine-grained permissions system for use with partially-synchronized Realms. This allows permissions to be\n  defined at the level of individual objects or classes. See `Permission` and related types for more information.\n\n### Bugfixes\n\n* Fix some warnings when running with UBsan.\n\n3.1.1 Release notes (2018-02-03)\n=============================================================\n\nPrebuilt Swift frameworks for Carthage are now built with Xcode 9.2.\n\n### Bugfixes\n\n* Fix a memory leak when opening Realms with an explicit `objectTypes` array\n  from Swift.\n\n3.1.0 Release notes (2018-01-16)\n=============================================================\n\n* Prebuilt frameworks are now included for Swift 3.2.3 and 4.0.3.\n* Prebuilt frameworks are no longer included for Swift 3.0.x.\n* Building from source with Xcode versions prior to Xcode 8.3 is no longer supported.\n\n### Enhancements\n\n* Add `Results.distinct(by:)` / `-[RLMResults distinctResultsUsingKeyPaths:]`, which return a `Results`\n  containing only objects with unique values at the given key paths.\n* Improve performance of change checking for notifications in certain cases.\n* Realm Object Server errors not explicitly recognized by the client are now reported to the application\n  regardless.\n* Add support for JSON Web Token as a sync credential source.\n* Add support for Nickname and Anonymous Auth as a sync credential source.\n* Improve allocator performance when writing to a highly fragmented file. This\n  should significantly improve performance when inserting large numbers of\n  objects which have indexed properties.\n* Improve write performance for complex object graphs involving many classes\n  linking to each other.\n\n### Bugfixes\n\n* Add a missing check for a run loop in the permission API methods which\n  require one.\n* Fix some cases where non-fatal sync errors were being treated as fatal errors.\n\n3.0.2 Release notes (2017-11-08)\n=============================================================\n\nPrebuilt frameworks are now included for Swift 3.2.2 and 4.0.2.\n\n### Bugfixes\n\n* Fix a crash when a linking objects property is retrieved from a model object instance via\n  Swift subscripting.\n* Fix incorrect behavior if a call to `posix_fallocate` is interrupted.\n\n3.0.1 Release notes (2017-10-26)\n=============================================================\n\n### Bugfixes\n\n* Explicitly exclude KVO-generated object subclasses from the schema.\n* Fix regression where the type of a Realm model class is not properly determined, causing crashes\n  when a type value derived at runtime by `type(of:)` is passed into certain APIs.\n* Fix a crash when an `Object` subclass has implicitly ignored `let`\n  properties.\n* Fix several cases where adding a notification block from within a\n  notification callback could produce incorrect results.\n\n3.0.0 Release notes (2017-10-16)\n=============================================================\n\n### Breaking Changes\n* iOS 7 is no longer supported.\n* Synchronized Realms require a server running Realm Object Server v2.0 or higher.\n* Computed properties on Realm object types are detected and no\n  longer added to the automatically generated schema.\n* The Objective-C and Swift `create(_:, value: update:)` APIs now\n  correctly nil out nullable properties when updating an existing\n  object when the `value` argument specifies nil or `NSNull` for\n  the property value.\n* `-[RLMRealm addOrUpdateObjects:]` and `-[RLMRealm deleteObjects:]` now\n  require their argument to conform to `NSFastEnumeration`, to match similar\n  APIs that also take collections.\n* The way interactive sync errors (client reset and permission denied)\n  are delivered to the user has been changed. Instead of a block which can\n  be invoked to immediately delete the offending Realm file, an opaque\n  token object of type `RLMSyncErrorActionToken` will be returned in the\n  error object's `userInfo` dictionary. This error object can be passed\n  into the new `+[RLMSyncSession immediatelyHandleError:]` API to delete\n  the files.\n* The return types of the `SyncError.clientResetInfo()` and\n  `SyncError.deleteRealmUserInfo()` APIs have been changed. They now return\n  `RLMSyncErrorActionToken`s or `SyncError.ActionToken`s instead of closures.\n* The class methods `Object.className()`, `Object.objectUtilClass()`, and\n  the property `Object.isInvalidated` can no longer be overriden.\n* The callback which runs when a sync user login succeeds or fails\n  now runs on the main queue by default, or can be explicitly specified\n  by a new `callbackQueue` parameter on the `{RLM}SyncUser.logIn(...)` API.\n* Fix empty strings, binary data, and null on the right side of `BEGINSWITH`,\n  `ENDSWITH` and `CONTAINS` operators in predicates to match Foundation's\n  semantics of never matching any strings or data.\n* Swift `Object` comparison and hashing behavior now works the same way as\n  that of `RLMObject` (objects are now only considered equatable if their\n  model class defines a primary key).\n* Fix the way the hash property works on `Object` when the object model has\n  no primary key.\n* Fix an issue where if a Swift model class defined non-generic managed\n  properties after generic Realm properties (like `List<T>`), the schema\n  would be constructed incorrectly. Fixes an issue where creating such\n  models from an array could fail.\n* Loosen `RLMArray` and `RLMResults`'s generic constraint from `RLMObject` to\n  `NSObject`. This may result in having to add some casts to disambiguate\n  types.\n* Remove `RLMSyncPermissionResults`. `RLMSyncPermission`s are now vended out\n  using a `RLMResults`. This results collection supports all normal collection\n  operations except for setting values using key-value coding (since\n  `RLMSyncPermission`s are immutable) and the property aggregation operations.\n* `RLMSyncUserInfo` has been significantly enhanced. It now contains metadata\n  about a user stored on the Realm Object Server, as well as a list of all user account\n  data associated with that user.\n* Starting with Swift 4, `List` now conforms to `MutableCollection` instead of\n  `RangeReplaceableCollection`. For Swift 4, the empty collection initializer has been\n  removed, and default implementations of range replaceable collection methods that\n  make sense for `List` have been added.\n* `List.removeLast()` now throws an exception if the list is empty, to more closely match\n  the behavior of the standard library's `Collection.removeLast()` implementation.\n* `RealmCollection`'s associated type `Element` has been renamed `ElementType`.\n* The following APIs have been renamed:\n\n| Old API                                                     | New API                                                        |\n|:------------------------------------------------------------|:---------------------------------------------------------------|\n| `NotificationToken.stop()`                                  | `NotificationToken.invalidate()`                               |\n| `-[RLMNotificationToken stop]`                              | `-[RLMNotificationToken invalidate]`                           |\n| `RealmCollection.addNotificationBlock(_:)`                  | `RealmCollection.observe(_:)`                                  |\n| `RLMSyncProgress`                                           | `RLMSyncProgressMode`                                          |\n| `List.remove(objectAtIndex:)`                               | `List.remove(at:)`                                             |\n| `List.swap(_:_:)`                                           | `List.swapAt(_:_:)`                                            |\n| `SyncPermissionValue`                                       | `SyncPermission`                                               |\n| `RLMSyncPermissionValue`                                    | `RLMSyncPermission`                                            |\n| `-[RLMSyncPermission initWithRealmPath:userID:accessLevel]` | `-[RLMSyncPermission initWithRealmPath:identity:accessLevel:]` |\n| `RLMSyncPermission.userId`                                  | `RLMSyncPermission.identity`                                   |\n| `-[RLMRealm addOrUpdateObjectsInArray:]`                    | `-[RLMRealm addOrUpdateObjects:]`                              |\n\n* The following APIs have been removed:\n\n| Removed API                                                  | Replacement                                                                               |\n|:-------------------------------------------------------------|:------------------------------------------------------------------------------------------|\n| `Object.className`                                           | None, was erroneously present.                                                            |\n| `RLMPropertyTypeArray`                                       | `RLMProperty.array`                                                                       |\n| `PropertyType.array`                                         | `Property.array`                                                                          |\n| `-[RLMArray sortedResultsUsingProperty:ascending:]`          | `-[RLMArray sortedResultsUsingKeyPath:ascending:]`                                        |\n| `-[RLMCollection sortedResultsUsingProperty:ascending:]`     | `-[RLMCollection sortedResultsUsingKeyPath:ascending:]`                                   |\n| `-[RLMResults sortedResultsUsingProperty:ascending:]`        | `-[RLMResults sortedResultsUsingKeyPath:ascending:]`                                      |\n| `+[RLMSortDescriptor sortDescriptorWithProperty:ascending:]` | `+[RLMSortDescriptor sortDescriptorWithKeyPath:ascending:]`                               |\n| `RLMSortDescriptor.property`                                 | `RLMSortDescriptor.keyPath`                                                               |\n| `AnyRealmCollection.sorted(byProperty:ascending:)`           | `AnyRealmCollection.sorted(byKeyPath:ascending:)`                                         |\n| `List.sorted(byProperty:ascending:)`                         | `List.sorted(byKeyPath:ascending:)`                                                       |\n| `LinkingObjects.sorted(byProperty:ascending:)`               | `LinkingObjects.sorted(byKeyPath:ascending:)`                                             |\n| `Results.sorted(byProperty:ascending:)`                      | `Results.sorted(byKeyPath:ascending:)`                                                    |\n| `SortDescriptor.init(property:ascending:)`                   | `SortDescriptor.init(keyPath:ascending:)`                                                 |\n| `SortDescriptor.property`                                    | `SortDescriptor.keyPath`                                                                  |\n| `+[RLMRealm migrateRealm:configuration:]`                    | `+[RLMRealm performMigrationForConfiguration:error:]`                                     |\n| `RLMSyncManager.disableSSLValidation`                        | `RLMSyncConfiguration.enableSSLValidation`                                                |\n| `SyncManager.disableSSLValidation`                           | `SyncConfiguration.enableSSLValidation`                                                   |\n| `RLMSyncErrorBadResponse`                                    | `RLMSyncAuthErrorBadResponse`                                                             |\n| `RLMSyncPermissionResults`                                   | `RLMResults`                                                                              |\n| `SyncPermissionResults`                                      | `Results`                                                                                 |\n| `RLMSyncPermissionChange`                                    | `-[RLMSyncUser applyPermission:callback]` / `-[RLMSyncUser deletePermission:callback:]`   |\n| `-[RLMSyncUser permissionRealmWithError:]`                   | `-[RLMSyncUser retrievePermissionsWithCallback:]`                                         |\n| `RLMSyncPermissionOffer`                                     | `-[RLMSyncUser createOfferForRealmAtURL:accessLevel:expiration:callback:]`                |\n| `RLMSyncPermissionOfferResponse`                             | `-[RLMSyncUser acceptOfferForToken:callback:]`                                            |\n| `-[NSError rlmSync_clientResetBlock]`                        | `-[NSError rlmSync_errorActionToken]` / `-[NSError rlmSync_clientResetBackedUpRealmPath]` |\n| `-[NSError rlmSync_deleteRealmBlock]`                        | `-[NSError rlmSync_errorActionToken]`                                                     |\n\n### Enhancements\n* `List` can now contain values of types `Bool`, `Int`, `Int8`, `Int16`,\n  `Int32`, `Int64`, `Float`, `Double`, `String`, `Data`, and `Date` (and\n  optional versions of all of these) in addition to `Object` subclasses.\n  Querying `List`s containing values other than `Object` subclasses is not yet\n  implemented.\n* `RLMArray` can now be constrained with the protocols `RLMBool`, `RLMInt`,\n  `RLMFloat`, `RLMDouble`, `RLMString`, `RLMData`, and `RLMDate` in addition to\n  protocols defined with `RLM_ARRAY_TYPE`. By default `RLMArray`s of\n  non-`RLMObject` types can contain null. Indicating that the property is\n  required (by overriding `+requiredProperties:`) will instead make the values\n  within the array required. Querying `RLMArray`s containing values other than\n  `RLMObject` subclasses is not yet implemented.\n* Add a new error code to denote 'permission denied' errors when working\n  with synchronized Realms, as well as an accompanying block that can be\n  called to inform the binding that the offending Realm's files should be\n  deleted immediately. This allows recovering from 'permission denied'\n  errors in a more robust manner. See the documentation for\n  `RLMSyncErrorPermissionDeniedError` for more information.\n* Add Swift `Object.isSameObject(as:_)` API to perform the same function as\n  the existing Objective-C API `-[RLMObject isEqualToObject:]`.\n* Opening a synced Realm whose local copy was created with an older version of\n  Realm Mobile Platfrom when a migration is not possible to the current version\n  will result in an `RLMErrorIncompatibleSyncedFile` / `incompatibleSyncedFile`\n  error. When such an error occurs, the original file is moved to a backup\n  location, and future attempts to open the synchronized Realm will result in a new\n  file being created. If you wish to migrate any data from the backup Realm you can\n  open it using the backup Realm configuration available on the error object.\n* Add a preview of partial synchronization. Partial synchronization allows a\n  synchronized Realm to be opened in such a way that only objects requested by\n  the user are synchronized to the device. You can use it by setting the\n  `isPartial` property on a `SyncConfiguration`, opening the Realm, and then\n  calling `Realm.subscribe(to:where:callback:)` with the type of object you're\n  interested in, a string containing a query determining which objects you want\n  to subscribe to, and a callback which will report the results. You may add as\n  many subscriptions to a synced Realm as necessary.\n\n### Bugfixes\n* Realm no longer throws an \"unsupported instruction\" exception in some cases\n  when opening a synced Realm asynchronously.\n* Realm Swift APIs that filter or look up the index of an object based on a\n  format string now properly handle optional arguments in their variadic argument\n  list.\n* `-[RLMResults<RLMSyncPermission *> indexOfObject:]` now properly accounts for access\n  level.\n* Fix a race condition that could lead to a crash accessing to the freed configuration object\n  if a default configuration was set from a different thread.\n* Fixed an issue that crash when enumerating after clearing data during migration.\n* Fix a bug where a synced Realm couldn't be reopened even after a successful client reset\n  in some cases.\n* Fix a bug where the sync subsystem waited too long in certain cases to reconnect to the server.\n* Fix a bug where encrypted sync-related metadata was incorrectly deleted from upgrading users,\n  resulting in all users being logged out.\n* Fix a bug where permission-related data continued to be synced to a client even after the user\n  that data belonged to logged out.\n* Fix an issue where collection notifications might be delivered inconsistently if a notification\n  callback was added within another callback for the same collection.\n\n3.0.0-rc.2 Release notes (2017-10-14)\n=============================================================\n\n### Enhancements\n* Reinstate `RLMSyncPermissionSortPropertyUserID` to allow users to sort permissions\n  to their own Realms they've granted to others.\n\n### Bugfixes\n* `-[RLMResults<RLMSyncPermission *> indexOfObject:]` now properly accounts for access\n  level.\n* Fix a race condition that could lead to a crash accessing to the freed configuration object\n  if a default configuration was set from a different thread.\n* Fixed an issue that crash when enumerating after clearing data during migration.\n* Fix a bug where a synced Realm couldn't be reopened even after a successful client reset\n  in some cases.\n* Fix a bug where the sync subsystem waited too long in certain cases to reconnect to the server.\n* Fix a bug where encrypted sync-related metadata was incorrectly deleted from upgrading users,\n  resulting in all users being logged out.\n* Fix a bug where permission-related data continued to be synced to a client even after the user\n  that data belonged to logged out.\n* Fix an issue where collection notifications might be delivered inconsistently if a notification\n  callback was added within another callback for the same collection.\n\n3.0.0-rc.1 Release notes (2017-10-03)\n=============================================================\n\n### Breaking Changes\n* Remove `RLMSyncPermissionSortPropertyUserID` to reflect changes in how the\n  Realm Object Server reports permissions for a user.\n* Remove `RLMSyncPermissionOffer` and `RLMSyncPermissionOfferResponse` classes\n  and associated helper methods and functions. Use the\n  `-[RLMSyncUser createOfferForRealmAtURL:accessLevel:expiration:callback:]`\n  and `-[RLMSyncUser acceptOfferForToken:callback:]` methods instead.\n\n### Bugfixes\n\n* The keychain item name used by Realm to manage the encryption keys for\n  sync-related metadata is now set to a per-app name based on the bundle\n  identifier. Keys that were previously stored within the single, shared Realm\n  keychain item will be transparently migrated to the per-application keychain\n  item.\n* Fix downloading of the Realm core binaries when Xcode's command-line tools are\n  set as the active developer directory for command-line interactions.\n* Fix a crash that could occur when resolving a ThreadSafeReference to a `List`\n  whose parent object had since been deleted.\n\n3.0.0-beta.4 Release notes (2017-09-22)\n=============================================================\n\n### Breaking Changes\n\n* Rename `List.remove(objectAtIndex:)` to `List.remove(at:)` to match the name\n  used by 'RangeReplaceableCollection'.\n* Rename `List.swap()` to `List.swapAt()` to match the name used by 'Array'.\n* Loosen `RLMArray` and `RLMResults`'s generic constraint from `RLMObject` to\n  `NSObject`. This may result in having to add some casts to disambiguate\n  types.\n* Remove `RLMPropertyTypeArray` in favor of a separate bool `array` property on\n  `RLMProperty`/`Property`.\n* Remove `RLMSyncPermissionResults`. `RLMSyncPermission`s are now vended out\n  using a `RLMResults`. This results collection supports all normal collection\n  operations except for setting values using KVO (since `RLMSyncPermission`s are\n  immutable) and the property aggregation operations.\n* `RealmCollection`'s associated type `Element` has been renamed `ElementType`.\n* Realm Swift collection types (`List`, `Results`, `AnyRealmCollection`, and\n  `LinkingObjects` have had their generic type parameter changed from `T` to\n  `Element`).\n* `RealmOptional`'s generic type parameter has been changed from `T` to `Value`.\n* `RLMSyncUserInfo` has been significantly enhanced. It now contains metadata\n  about a user stored on the Realm Object Server, as well as a list of all user account\n  data associated with that user.\n* Starting with Swift 4, `List` now conforms to `MutableCollection` instead of\n  `RangeReplaceableCollection`. For Swift 4, the empty collection initializer has been\n  removed, and default implementations of range replaceable collection methods that\n  make sense for `List` have been added.\n* `List.removeLast()` now throws an exception if the list is empty, to more closely match\n  the behavior of the standard library's `Collection.removeLast()` implementation.\n\n### Enhancements\n\n* `List` can now contain values of types `Bool`, `Int`, `Int8`, `Int16`,\n  `Int32`, `Int64`, `Float`, `Double`, `String`, `Data`, and `Date` (and\n  optional versions of all of these) in addition to `Object` subclasses.\n  Querying `List`s containing values other than `Object` subclasses is not yet\n  implemented.\n* `RLMArray` can now be constrained with the protocols `RLMBool`, `RLMInt`,\n  `RLMFloat`, `RLMDouble`, `RLMString`, `RLMData`, and `RLMDate` in addition to\n  protocols defined with `RLM_ARRAY_TYPE`. By default `RLMArray`s of\n  non-`RLMObject` types can contain null. Indicating that the property is\n  required (by overriding `+requiredProperties:`) will instead make the values\n  within the array required. Querying `RLMArray`s containing values other than\n  `RLMObject` subclasses is not yet implemented.\n* Opening a synced Realm whose local copy was created with an older version of\n  Realm Mobile Platfrom when a migration is not possible to the current version\n  will result in an `RLMErrorIncompatibleSyncedFile` / `incompatibleSyncedFile`\n  error. When such an error occurs, the original file is moved to a backup\n  location, and future attempts to open the synchronized Realm will result in a new\n  file being created. If you wish to migrate any data from the backup Realm you can\n  open it using the backup Realm configuration available on the error object.\n* Add preview support for partial synchronization. Partial synchronization is\n  allows a synchronized Realm to be opened in such a way that only objects\n  requested by the user are synchronized to the device. You can use it by setting\n  the `isPartial` property on a `SyncConfiguration`, opening the Realm, and then\n  calling `Realm.subscribe(to:where:callback:)` with the type of object you're\n  interested in, a string containing a query determining which objects you want\n  to subscribe to, and a callback which will report the results. You may add as\n  many subscriptions to a synced Realm as necessary.\n\n### Bugfixes\n\n* Realm Swift APIs that filter or look up the index of an object based on a\n  format string now properly handle optional arguments in their variadic argument\n  list.\n\n3.0.0-beta.3 Release notes (2017-08-23)\n=============================================================\n\n### Breaking Changes\n\n* iOS 7 is no longer supported.\n* Computed properties on Realm object types are detected and no\n  longer added to the automatically generated schema.\n* `-[RLMRealm addOrUpdateObjectsInArray:]` has been renamed to\n  `-[RLMRealm addOrUpdateObjects:]` for consistency with similar methods\n  that add or delete objects.\n* `-[RLMRealm addOrUpdateObjects:]` and `-[RLMRealm deleteObjects:]` now\n  require their argument to conform to `NSFastEnumeration`, to match similar\n  APIs that also take collections.\n* Remove deprecated `{RLM}SyncPermission` and `{RLM}SyncPermissionChange`\n  classes.\n* `{RLM}SyncPermissionValue` has been renamed to just `{RLM}SyncPermission`.\n  Its `userId` property has been renamed `identity`, and its\n  `-initWithRealmPath:userID:accessLevel:` initializer has been renamed\n  `-initWithRealmPath:identity:accessLevel:`.\n* Remove deprecated `-[RLMSyncUser permissionRealmWithError:]` and\n  `SyncUser.permissionRealm()` APIs. Use the new permissions system.\n* Remove deprecated error `RLMSyncErrorBadResponse`. Use\n  `RLMSyncAuthErrorBadResponse` instead.\n* The way interactive sync errors (client reset and permission denied)\n  are delivered to the user has been changed. Instead of a block which can\n  be invoked to immediately delete the offending Realm file, an opaque\n  token object of type `RLMSyncErrorActionToken` will be returned in the\n  error object's `userInfo` dictionary. This error object can be passed\n  into the new `+[RLMSyncSession immediatelyHandleError:]` API to delete\n  the files.\n* Remove `-[NSError rlmSync_clientResetBlock]` and\n  `-[NSError rlmSync_deleteRealmBlock]` APIs.\n* The return types of the `SyncError.clientResetInfo()` and\n  `SyncError.deleteRealmUserInfo()` APIs have been changed. They now return\n  `RLMSyncErrorActionToken`s or `SyncError.ActionToken`s instead of closures.\n* The (erroneously added) instance property `Object.className` has been\n  removed.\n* The class methods `Object.className()`, `Object.objectUtilClass()`, and\n  the property `Object.isInvalidated` can no longer be overriden.\n* The callback which runs when a sync user login succeeds or fails\n  now runs on the main queue by default, or can be explicitly specified\n  by a new `callbackQueue` parameter on the `{RLM}SyncUser.logIn(...)` API.\n* Rename `{RLM}NotificationToken.stop()` to `invalidate()` and\n  `{RealmCollection,SyncPermissionResults}.addNotificationBlock(_:)` to\n  `observe(_:)` to mirror Foundation's new KVO APIs.\n* The `RLMSyncProgress` enum has been renamed `RLMSyncProgressMode`.\n* Remove deprecated `{RLM}SyncManager.disableSSLValidation` property. Disable\n  SSL validation on a per-Realm basis by setting the `enableSSLValidation`\n  property on `{RLM}SyncConfiguration` instead.\n* Fix empty strings, binary data, and null on the right side of `BEGINSWITH`,\n  `ENDSWITH` and `CONTAINS` operators in predicates to match Foundation's\n  semantics of never matching any strings or data.\n* Swift `Object` comparison and hashing behavior now works the same way as\n  that of `RLMObject` (objects are now only considered equatable if their\n  model class defines a primary key).\n* Fix the way the hash property works on `Object` when the object model has\n  no primary key.\n* Fix an issue where if a Swift model class defined non-generic managed\n  properties after generic Realm properties (like `List<T>`), the schema\n  would be constructed incorrectly. Fixes an issue where creating such\n  models from an array could fail.\n\n### Enhancements\n\n* Add Swift `Object.isSameObject(as:_)` API to perform the same function as\n  the existing Objective-C API `-[RLMObject isEqualToObject:]`.\n* Expose additional authentication-related errors that might be reported by\n  a Realm Object Server.\n* An error handler can now be registered on `{RLM}SyncUser`s in order to\n  report authentication-related errors that affect the user.\n\n### Bugfixes\n\n* Sync users are now automatically logged out upon receiving certain types\n  of errors that indicate they are no longer logged into the server. For\n  example, users who are authenticated using third-party credentials will find\n  themselves logged out of the Realm Object Server if the third-party identity\n  service indicates that their credential is no longer valid.\n* Address high CPU usage and hangs in certain cases when processing collection\n  notifications in highly-connected object graphs.\n\n3.0.0-beta.2 Release notes (2017-07-26)\n=============================================================\n\n### Breaking Changes\n\n* Remove the following deprecated Objective-C APIs:\n  `-[RLMArray sortedResultsUsingProperty:ascending:]`,\n  `-[RLMCollection sortedResultsUsingProperty:ascending:]`,\n  `-[RLMResults sortedResultsUsingProperty:ascending:]`,\n  `+[RLMSortDescriptor sortDescriptorWithProperty:ascending:]`,\n  `RLMSortDescriptor.property`.\n  These APIs have been superseded by equivalent APIs that take\n  or return key paths instead of property names.\n* Remove the following deprecated Objective-C API:\n  `+[RLMRealm migrateRealm:configuration:]`.\n  Please use `+[RLMRealm performMigrationForConfiguration:error:]` instead.\n* Remove the following deprecated Swift APIs:\n  `AnyRealmCollection.sorted(byProperty:, ascending:)`,\n  `LinkingObjects.sorted(byProperty:, ascending:)`,\n  `List.sorted(byProperty:, ascending:)`,\n  `Results.sorted(byProperty:, ascending:)`,\n  `SortDescriptor.init(property:, ascending:)`,\n  `SortDescriptor.property`.\n  These APIs have been superseded by equivalent APIs that take\n  or return key paths instead of property names.\n* The Objective-C and Swift `create(_:, value: update:)` APIs now\n  correctly nil out nullable properties when updating an existing\n  object when the `value` argument specifies nil or `NSNull` for\n  the property value.\n\n### Enhancements\n\n* It is now possible to create and log in multiple Realm Object Server users\n  with the same identity if they originate from different servers. Note that\n  if the URLs are different aliases for the same authentication server each\n  user will still be treated as separate (e.g. they will have their own copy\n  of each synchronized Realm opened using them). It is highly encouraged that\n  users defined using the access token credential type be logged in with an\n  authentication server URL specified; this parameter will become mandatory\n  in a future version of the SDK.\n* Add `-[RLMSyncUser retrieveInfoForUser:identityProvider:completion:]`\n  API allowing administrator users to retrieve information about a user based\n  on their provider identity (for example, a username). Requires any edition\n  of the Realm Object Server 1.8.2 or later.\n\n### Bugfixes\n\n* Realm no longer throws an \"unsupported instruction\" exception in some cases\n  when opening a synced Realm asynchronously.\n\n3.0.0-beta Release notes (2017-07-14)\n=============================================================\n\n### Breaking Changes\n\n* Synchronized Realms require a server running Realm Object Server v2.0 or higher.\n\n### Enhancements\n\n* Add a new error code to denote 'permission denied' errors when working\n  with synchronized Realms, as well as an accompanying block that can be\n  called to inform the binding that the offending Realm's files should be\n  deleted immediately. This allows recovering from 'permission denied'\n  errors in a more robust manner. See the documentation for\n  `RLMSyncErrorPermissionDeniedError` for more information.\n* Add `-[RLMSyncPermissionValue initWithRealmPath:username:accessLevel:]`\n  API allowing permissions to be applied to a user based on their username\n  (usually, an email address). Requires any edition of the Realm Object\n  Server 1.6.0 or later.\n* Improve performance of creating Swift objects which contain at least one List\n  property.\n\n### Bugfixes\n\n* `List.description` now reports the correct types for nested lists.\n* Fix unmanaged object initialization when a nested property type returned\n  `false` from `Object.shouldIncludeInDefaultSchema()`.\n* Don't clear RLMArrays on self-assignment.\n\n2.10.2 Release notes (2017-09-27)\n=============================================================\n\n### Bugfixes\n\n* The keychain item name used by Realm to manage the encryption keys for\n  sync-related metadata is now set to a per-app name based on the bundle\n  identifier. Keys that were previously stored within the single, shared Realm\n  keychain item will be transparently migrated to the per-application keychain\n  item.\n* Fix downloading of the Realm core binaries when Xcode's command-line tools are\n  set as the active developer directory for command-line interactions.\n* Fix a crash that could occur when resolving a ThreadSafeReference to a `List`\n  whose parent object had since been deleted.\n\n2.10.1 Release notes (2017-09-14)\n=============================================================\n\nSwift binaries are now produced for Swift 3.0, 3.0.1, 3.0.2, 3.1, 3.2 and 4.0.\n\n### Enhancements\n\n* Auxiliary files are excluded from backup by default.\n\n### Bugfixes\n\n* Fix more cases where assigning an RLMArray property to itself would clear the\n  RLMArray.\n\n2.10.0 Release notes (2017-08-21)\n=============================================================\n\n### API Breaking Changes\n\n* None.\n\n### Enhancements\n\n* Expose additional authentication-related errors that might be reported by\n  a Realm Object Server.\n* An error handler can now be registered on `{RLM}SyncUser`s in order to\n  report authentication-related errors that affect the user.\n\n### Bugfixes\n\n* Sorting Realm collection types no longer throws an exception on iOS 7.\n* Sync users are now automatically logged out upon receiving certain types\n  of errors that indicate they are no longer logged into the server. For\n  example, users who are authenticated using third-party credentials will find\n  themselves logged out of the Realm Object Server if the third-party identity\n  service indicates that their credential is no longer valid.\n* Address high CPU usage and hangs in certain cases when processing collection\n  notifications in highly-connected object graphs.\n\n2.9.1 Release notes (2017-08-01)\n=============================================================\n\n### API Breaking Changes\n\n* None.\n\n### Enhancements\n\n* None.\n\n### Bugfixes\n\n* The `shouldCompactOnLaunch` block is no longer invoked if the Realm at that\n  path is already open on other threads.\n* Fix an assertion failure in collection notifications when changes are made to\n  the schema via sync while the notification block is active.\n\n2.9.0 Release notes (2017-07-26)\n=============================================================\n\n### API Breaking Changes\n\n* None.\n\n### Enhancements\n\n* Add a new error code to denote 'permission denied' errors when working\n  with synchronized Realms, as well as an accompanying block that can be\n  called to inform the binding that the offending Realm's files should be\n  deleted immediately. This allows recovering from 'permission denied'\n  errors in a more robust manner. See the documentation for\n  `RLMSyncErrorPermissionDeniedError` for more information.\n* Add `-[RLMSyncPermissionValue initWithRealmPath:username:accessLevel:]`\n  API allowing permissions to be applied to a user based on their username\n  (usually, an email address). Requires any edition of the Realm Object\n  Server 1.6.0 or later.\n* Improve performance of creating Swift objects which contain at least one List\n  property.\n* It is now possible to create and log in multiple Realm Object Server users\n  with the same identity if they originate from different servers. Note that\n  if the URLs are different aliases for the same authentication server each\n  user will still be treated as separate (e.g. they will have their own copy\n  of each synchronized Realm opened using them). It is highly encouraged that\n  users defined using the access token credential type be logged in with an\n  authentication server URL specified; this parameter will become mandatory\n  in a future version of the SDK.\n* Add `-[RLMSyncUser retrieveInfoForUser:identityProvider:completion:]`\n  API allowing administrator users to retrieve information about a user based\n  on their provider identity (for example, a username). Requires any edition\n  of the Realm Object Server 1.8.2 or later.\n\n### Bugfixes\n\n* `List.description` now reports the correct types for nested lists.\n* Fix unmanaged object initialization when a nested property type returned\n  `false` from `Object.shouldIncludeInDefaultSchema()`.\n* Don't clear RLMArrays on self-assignment.\n\n2.8.3 Release notes (2017-06-20)\n=============================================================\n\n### Bugfixes\n\n* Properly update RealmOptional properties when adding an object with `add(update: true)`.\n* Add some missing quotes in error messages.\n* Fix a performance regression when creating objects with primary keys.\n\n2.8.2 Release notes (2017-06-16)\n=============================================================\n\n### Bugfixes\n\n* Fix an issue where synchronized Realms would eventually disconnect from the\n  remote server if the user object used to define their sync configuration\n  was destroyed.\n* Restore support for changing primary keys in migrations (broken in 2.8.0).\n* Revert handling of adding objects with nil properties to a Realm to the\n  pre-2.8.0 behavior.\n\n2.8.1 Release notes (2017-06-12)\n=============================================================\n\nAdd support for building with Xcode 9 Beta 1.\n\n### Bugfixes\n\n* Fix setting a float property to NaN.\n* Fix a crash when using compact on launch in combination with collection\n  notifications.\n\n2.8.0 Release notes (2017-06-02)\n=============================================================\n\n### API Breaking Changes\n\n* None.\n\n### Enhancements\n\n* Enable encryption on watchOS.\n* Add `-[RLMSyncUser changePassword:forUserID:completion:]` API to change an\n  arbitrary user's password if the current user has administrative privileges\n  and using Realm's 'password' authentication provider.\n  Requires any edition of the Realm Object Server 1.6.0 or later.\n\n### Bugfixes\n\n* Suppress `-Wdocumentation` warnings in Realm C++ headers when using CocoaPods\n  with Xcode 8.3.2.\n* Throw an appropriate error rather than crashing when an RLMArray is assigned\n  to an RLMArray property of a different type.\n* Fix crash in large (>4GB) encrypted Realm files.\n* Improve accuracy of sync progress notifications.\n* Fix an issue where synchronized Realms did not connect to the remote server\n  in certain situations, such as when an application was offline when the Realms\n  were opened but later regained network connectivity.\n\n2.7.0 Release notes (2017-05-03)\n=============================================================\n\n### API Breaking Changes\n\n* None.\n\n### Enhancements\n\n* Use reachability API to minimize the reconnection delay if the network\n  connection was lost.\n* Add `-[RLMSyncUser changePassword:completion:]` API to change the current\n  user's password if using Realm's 'password' authentication provider.\n  Requires any edition of the Realm Object Server 1.4.0 or later.\n* `{RLM}SyncConfiguration` now has an `enableSSLValidation` property\n  (and default parameter in the Swift initializer) to allow SSL validation\n  to be specified on a per-server basis.\n* Transactions between a synced Realm and a Realm Object Server can now\n  exceed 16 MB in size.\n* Add new APIs for changing and retrieving permissions for synchronized Realms.\n  These APIs are intended to replace the existing Realm Object-based permissions\n  system. Requires any edition of the Realm Object Server 1.1.0 or later.\n\n### Bugfixes\n\n* Support Realm model classes defined in Swift with overridden Objective-C\n  names (e.g. `@objc(Foo) class SwiftFoo: Object {}`).\n* Fix `-[RLMMigration enumerateObjects:block:]` returning incorrect `oldObject`\n  objects when enumerating a class name after previously deleting a `newObject`.\n* Fix an issue where `Realm.asyncOpen(...)` would fail to work when opening a\n  synchronized Realm for which the user only had read permissions.\n* Using KVC to set a `List` property to `nil` now clears it to match the\n  behavior of `RLMArray` properties.\n* Fix crash from `!m_awaiting_pong` assertion failure when using synced Realms.\n* Fix poor performance or hangs when performing case-insensitive queries on\n  indexed string properties that contain many characters that don't differ\n  between upper and lower case (e.g., numbers, punctuation).\n\n2.6.2 Release notes (2017-04-21)\n=============================================================\n\n### API Breaking Changes\n\n* None.\n\n### Enhancements\n\n* None.\n\n### Bugfixes\n\n* Fix an issue where calling `Realm.asyncOpen(...)` with a synchronized Realm\n  configuration would fail with an \"Operation canceled\" error.\n* Fix initial collection notification sometimes not being delivered for synced\n  Realms.\n* Fix circular links sometimes resulting in objects not being marked as\n  modified in change notifications.\n\n2.6.1 Release notes (2017-04-18)\n=============================================================\n\n### API Breaking Changes\n\n* None.\n\n### Enhancements\n\n* None.\n\n### Bugfixes\n\n* Fix an issue where calling `Realm.asyncOpen(...)` with a synchronized Realm\n  configuration would crash in error cases rather than report the error.\n  This is a small source breaking change if you were relying on the error\n  being reported to be a `Realm.Error`.\n\n2.6.0 Release notes (2017-04-18)\n=============================================================\n\n### API Breaking Changes\n\n* None.\n\n### Enhancements\n\n* Add a `{RLM}SyncUser.isAdmin` property indicating whether a user is a Realm\n  Object Server administrator.\n* Add an API to asynchronously open a Realm and deliver it to a block on a\n  given queue. This performs all work needed to get the Realm to\n  a usable state (such as running potentially time-consuming migrations) on a\n  background thread before dispatching to the given queue. In addition,\n  synchronized Realms wait for all remote content available at the time the\n  operation began to be downloaded and available locally.\n* Add `shouldCompactOnLaunch` block property when configuring a Realm to\n  determine if it should be compacted before being returned.\n* Speed up case-insensitive queries on indexed string properties.\n* Add RLMResults's collection aggregate methods to RLMArray.\n* Add support for calling the aggregate methods on unmanaged Lists.\n\n### Bugfixes\n\n* Fix a deadlock when multiple processes open a Realm at the same time.\n* Fix `value(forKey:)`/`value(forKeyPath:)` returning incorrect values for `List` properties.\n\n2.5.1 Release notes (2017-04-05)\n=============================================================\n\n### API Breaking Changes\n\n* None.\n\n### Enhancements\n\n* None.\n\n### Bugfixes\n\n* Fix CocoaPods installation with static libraries and multiple platforms.\n* Fix uncaught \"Bad version number\" exceptions on the notification worker thread\n  followed by deadlocks when Realms refresh.\n\n2.5.0 Release notes (2017-03-28)\n=============================================================\n\nFiles written by Realm this version cannot be read by earlier versions of Realm.\nOld files can still be opened and files open in read-only mode will not be\nmodified.\n\nIf using synchronized Realms, the Realm Object Server must be running version\n1.3.0 or later.\n\nSwift binaries are now produced for Swift 3.0, 3.0.1, 3.0.2 and 3.1.\n\n### API Breaking Changes\n\n* None.\n\n### Enhancements\n\n* Add support for multi-level object equality comparisons against `NULL`.\n* Add support for the `[d]` modifier on string comparison operators to perform\n  diacritic-insensitive comparisons.\n* Explicitly mark `[[RLMRealm alloc] init]` as unavailable.\n* Include the name of the problematic class in the error message when an\n  invalid property type is marked as the primary key.\n\n### Bugfixes\n\n* Fix incorrect column type assertions which could occur after schemas were\n  merged by sync.\n* Eliminate an empty write transaction when opening a synced Realm.\n* Support encrypting synchronized Realms by respecting the `encryptionKey` value\n  of the Realm's configuration.\n* Fix crash when setting an `{NS}Data` property close to 16MB.\n* Fix for reading `{NS}Data` properties incorrectly returning `nil`.\n* Reduce file size growth in cases where Realm versions were pinned while\n  starting write transactions.\n* Fix an assertion failure when writing to large `RLMArray`/`List` properties.\n* Fix uncaught `BadTransactLog` exceptions when pulling invalid changesets from\n  synchronized Realms.\n* Fix an assertion failure when an observed `RLMArray`/`List` is deleted after\n  being modified.\n\n2.4.4 Release notes (2017-03-13)\n=============================================================\n\n### API Breaking Changes\n\n* None.\n\n### Enhancements\n\n* Add `(RLM)SyncPermission` class to allow reviewing access permissions for\n  Realms. Requires any edition of the Realm Object Server 1.1.0 or later.\n* Further reduce the number of files opened per thread-specific Realm on macOS,\n  iOS and watchOS.\n\n### Bugfixes\n\n* Fix a crash that could occur if new Realm instances were created while the\n  application was exiting.\n* Fix a bug that could lead to bad version number errors when delivering\n  change notifications.\n* Fix a potential use-after-free bug when checking validity of results.\n* Fix an issue where a sync session might not close properly if it receives\n  an error while being torn down.\n* Fix some issues where a sync session might not reconnect to the server properly\n  or get into an inconsistent state if revived after invalidation.\n* Fix an issue where notifications might not fire when the children of an\n  observed object are changed.\n* Fix an issue where progress notifications on sync sessions might incorrectly\n  report out-of-date values.\n* Fix an issue where multiple threads accessing encrypted data could result in\n  corrupted data or crashes.\n* Fix an issue where certain `LIKE` queries could hang.\n* Fix an issue where `-[RLMRealm writeCopyToURL:encryptionKey:error]` could create\n  a corrupt Realm file.\n* Fix an issue where incrementing a synced Realm's schema version without actually\n  changing the schema could cause a crash.\n\n2.4.3 Release notes (2017-02-20)\n=============================================================\n\n### API Breaking Changes\n\n* None.\n\n### Enhancements\n\n* Avoid copying copy-on-write data structures, which can grow the file, when the\n  write does not actually change existing values.\n* Improve performance of deleting all objects in an RLMResults.\n* Reduce the number of files opened per thread-specific Realm on macOS.\n* Improve startup performance with large numbers of `RLMObject`/`Object`\n  subclasses.\n\n### Bugfixes\n\n* Fix synchronized Realms not downloading remote changes when an access token\n  expires and there are no local changes to upload.\n* Fix an issue where values set on a Realm object using `setValue(value:, forKey:)`\n  that were not themselves Realm objects were not properly converted into Realm\n  objects or checked for validity.\n* Fix an issue where `-[RLMSyncUser sessionForURL:]` could erroneously return a\n  non-nil value when passed in an invalid URL.\n* `SyncSession.Progress.fractionTransferred` now returns 1 if there are no\n  transferrable bytes.\n* Fix sync progress notifications registered on background threads by always\n  dispatching on a dedicated background queue.\n* Fix compilation issues with Xcode 8.3 beta 2.\n* Fix incorrect sync progress notification values for Realms originally created\n  using a version of Realm prior to 2.3.0.\n* Fix LLDB integration to be able to display summaries of `RLMResults` once more.\n* Reject Swift properties with names which cause them to fall in to ARC method\n  families rather than crashing when they are accessed.\n* Fix sorting by key path when the declared property order doesn't match the order\n  of properties in the Realm file, which can happen when properties are added in\n  different schema versions.\n\n2.4.2 Release notes (2017-01-30)\n=============================================================\n\n### Bugfixes\n\n* Fix an issue where RLMRealm instances could end up in the autorelease pool\n  for other threads.\n\n2.4.1 Release notes (2017-01-27)\n=============================================================\n\n### Bugfixes\n\n* Fix an issue where authentication tokens were not properly refreshed\n  automatically before expiring.\n\n2.4.0 Release notes (2017-01-26)\n=============================================================\n\nThis release drops support for compiling with Swift 2.x.\nSwift 3.0.0 is now the minimum Swift version supported.\n\n### API Breaking Changes\n\n* None.\n\n### Enhancements\n\n* Add change notifications for individual objects with an API similar to that\n  of collection notifications.\n\n### Bugfixes\n\n* Fix Realm Objective-C compilation errors with Xcode 8.3 beta 1.\n* Fix several error handling issues when renewing expired authentication\n  tokens for synchronized Realms.\n* Fix a race condition leading to bad_version exceptions being thrown in\n  Realm's background worker thread.\n\n2.3.0 Release notes (2017-01-19)\n=============================================================\n\n### Sync Breaking Changes\n\n* Make `PermissionChange`'s `id` property a primary key.\n\n### API Breaking Changes\n\n* None.\n\n### Enhancements\n\n* Add `SyncPermissionOffer` and `SyncPermissionOfferResponse` classes to allow\n  creating and accepting permission change events to synchronized Realms between\n  different users.\n* Support monitoring sync transfer progress by registering notification blocks\n  on `SyncSession`. Specify the transfer direction (`.upload`/`.download`) and\n  mode (`.reportIndefinitely`/`.forCurrentlyOutstandingWork`) to monitor.\n\n### Bugfixes\n\n* Fix a call to `commitWrite(withoutNotifying:)` committing a transaction that\n  would not have triggered a notification incorrectly skipping the next\n  notification.\n* Fix incorrect results and crashes when conflicting object insertions are\n  merged by the synchronization mechanism when there is a collection\n  notification registered for that object type.\n\n2.2.0 Release notes (2017-01-12)\n=============================================================\n\n### Sync Breaking Changes (In Beta)\n\n* Sync-related error reporting behavior has been changed. Errors not related\n  to a particular user or session are only reported if they are classed as\n  'fatal' by the underlying sync engine.\n* Added `RLMSyncErrorClientResetError` to `RLMSyncError` enum.\n\n### API Breaking Changes\n\n* The following Objective-C APIs have been deprecated in favor of newer or preferred versions:\n\n| Deprecated API                                              | New API                                                     |\n|:------------------------------------------------------------|:------------------------------------------------------------|\n| `-[RLMArray sortedResultsUsingProperty:]`                   | `-[RLMArray sortedResultsUsingKeyPath:]`                    |\n| `-[RLMCollection sortedResultsUsingProperty:]`              | `-[RLMCollection sortedResultsUsingKeyPath:]`               |\n| `-[RLMResults sortedResultsUsingProperty:]`                 | `-[RLMResults sortedResultsUsingKeyPath:]`                  |\n| `+[RLMSortDescriptor sortDescriptorWithProperty:ascending]` | `+[RLMSortDescriptor sortDescriptorWithKeyPath:ascending:]` |\n| `RLMSortDescriptor.property`                                | `RLMSortDescriptor.keyPath`                                 |\n\n* The following Swift APIs have been deprecated in favor of newer or preferred versions:\n\n| Deprecated API                                        | New API                                          |\n|:------------------------------------------------------|:-------------------------------------------------|\n| `LinkingObjects.sorted(byProperty:ascending:)`        | `LinkingObjects.sorted(byKeyPath:ascending:)`    |\n| `List.sorted(byProperty:ascending:)`                  | `List.sorted(byKeyPath:ascending:)`              |\n| `RealmCollection.sorted(byProperty:ascending:)`       | `RealmCollection.sorted(byKeyPath:ascending:)`   |\n| `Results.sorted(byProperty:ascending:)`               | `Results.sorted(byKeyPath:ascending:)`           |\n| `SortDescriptor(property:ascending:)`                 | `SortDescriptor(keyPath:ascending:)`             |\n| `SortDescriptor.property`                             | `SortDescriptor.keyPath`                         |\n\n### Enhancements\n\n* Introduce APIs for safely passing objects between threads. Create a\n  thread-safe reference to a thread-confined object by passing it to the\n  `+[RLMThreadSafeReference referenceWithThreadConfined:]`/`ThreadSafeReference(to:)`\n  constructor, which you can then safely pass to another thread to resolve in\n  the new Realm with `-[RLMRealm resolveThreadSafeReference:]`/`Realm.resolve(_:)`.\n* Realm collections can now be sorted by properties over to-one relationships.\n* Optimized `CONTAINS` queries to use Boyer-Moore algorithm\n  (around 10x speedup on large datasets).\n\n### Bugfixes\n\n* Setting `deleteRealmIfMigrationNeeded` now also deletes the Realm if a file\n  format migration is required, such as when moving from a file last accessed\n  with Realm 0.x to 1.x, or 1.x to 2.x.\n* Fix queries containing nested `SUBQUERY` expressions.\n* Fix spurious incorrect thread exceptions when a thread id happens to be\n  reused while an RLMRealm instance from the old thread still exists.\n* Fixed various bugs in aggregate methods (max, min, avg, sum).\n\n2.1.2 Release notes (2016--12-19)\n=============================================================\n\nThis release adds binary versions of Swift 3.0.2 frameworks built with Xcode 8.2.\n\n### Sync Breaking Changes (In Beta)\n\n* Rename occurences of \"iCloud\" with \"CloudKit\" in APIs and comments to match\n  naming in the Realm Object Server.\n\n### API Breaking Changes\n\n* None.\n\n### Enhancements\n\n* Add support for 'LIKE' queries (wildcard matching).\n\n### Bugfixes\n\n* Fix authenticating with CloudKit.\n* Fix linker warning about \"Direct access to global weak symbol\".\n\n2.1.1 Release notes (2016-12-02)\n=============================================================\n\n### Enhancements\n\n* Add `RealmSwift.ObjectiveCSupport.convert(object:)` methods to help write\n  code that interoperates between Realm Objective-C and Realm Swift APIs.\n* Throw exceptions when opening a Realm with an incorrect configuration, like:\n    * `readOnly` set with a sync configuration.\n    * `readOnly` set with a migration block.\n    * migration block set with a sync configuration.\n* Greatly improve performance of write transactions which make a large number of\n  changes to indexed properties, including the automatic migration when opening\n  files written by Realm 1.x.\n\n### Bugfixes\n\n* Reset sync metadata Realm in case of decryption error.\n* Fix issue preventing using synchronized Realms in Xcode Playgrounds.\n* Fix assertion failure when migrating a model property from object type to\n  `RLMLinkingObjects` type.\n* Fix a `LogicError: Bad version number` exception when using `RLMResults` with\n  no notification blocks and explicitly called `-[RLMRealm refresh]` from that\n  thread.\n* Logged-out users are no longer returned from `+[RLMSyncUser currentUser]` or\n  `+[RLMSyncUser allUsers]`.\n* Fix several issues which could occur when the 1001st object of a given type\n  was created or added to an RLMArray/List, including crashes when rerunning\n  existing queries and possibly data corruption.\n* Fix a potential crash when the application exits due to a race condition in\n  the destruction of global static variables.\n* Fix race conditions when waiting for sync uploads or downloads to complete\n  which could result in crashes or the callback being called too early.\n\n2.1.0 Release notes (2016-11-18)\n=============================================================\n\n### Sync Breaking Changes (In Beta)\n\n* None.\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* Add the ability to skip calling specific notification blocks when committing\n  a write transaction.\n\n### Bugfixes\n\n* Deliver collection notifications when beginning a write transaction which\n  advances the read version of a Realm (previously only Realm-level\n  notifications were sent).\n* Fix some scenarios which would lead to inconsistent states when using\n  collection notifications.\n* Fix several race conditions in the notification functionality.\n* Don't send Realm change notifications when canceling a write transaction.\n\n2.0.4 Release notes (2016-11-14)\n=============================================================\n\n### Sync Breaking Changes (In Beta)\n\n* Remove `RLMAuthenticationActions` and replace\n  `+[RLMSyncCredential credentialWithUsername:password:actions:]` with\n  `+[RLMSyncCredential credentialsWithUsername:password:register:]`.\n* Rename `+[RLMSyncUser authenticateWithCredential:]` to\n  `+[RLMSyncUser logInWithCredentials:]`.\n* Rename \"credential\"-related types and methods to\n  `RLMSyncCredentials`/`SyncCredentials` and consistently refer to credentials\n  in the plural form.\n* Change `+[RLMSyncUser all]` to return a dictionary of identifiers to users and\n  rename to:\n  * `+[RLMSyncUser allUsers]` in Objective-C.\n  * `SyncUser.allUsers()` in Swift 2.\n  * `SyncUser.all` in Swift 3.\n* Rename `SyncManager.sharedManager()` to `SyncManager.shared` in Swift 3.\n* Change `Realm.Configuration.syncConfiguration` to take a `SyncConfiguration`\n  struct rather than a named tuple.\n* `+[RLMSyncUser logInWithCredentials:]` now invokes its callback block on a\n  background queue.\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* Add `+[RLMSyncUser currentUser]`.\n* Add the ability to change read, write and management permissions for\n  synchronized Realms using the management Realm obtained via the\n  `-[RLMSyncUser managementRealmWithError:]` API and the\n  `RLMSyncPermissionChange` class.\n\n### Bugfixes\n\n* None.\n\n2.0.3 Release notes (2016-10-27)\n=============================================================\n\nThis release adds binary versions of Swift 3.0.1 frameworks built with Xcode 8.1\nGM seed.\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* None.\n\n### Bugfixes\n\n* Fix a `BadVersion` exception caused by a race condition when delivering\n  collection change notifications.\n* Fix an assertion failure when additional model classes are added and\n  `deleteRealmIfMigrationNeeded` is enabled.\n* Fix a `BadTransactLog` exception when deleting an `RLMResults` in a synced\n  Realm.\n* Fix an assertion failure when a write transaction is in progress at the point\n  of process termination.\n* Fix a crash that could occur when working with a `RLMLinkingObject` property\n  of an unmanaged object.\n\n2.0.2 Release notes (2016-10-05)\n=============================================================\n\nThis release is not protocol-compatible with previous version of the Realm\nMobile Platform.\n\n### API breaking changes\n\n* Rename Realm Swift's `User` to `SyncUser` to make clear that it relates to the\n  Realm Mobile Platform, and to avoid potential conflicts with other `User` types.\n\n### Bugfixes\n\n* Fix Realm headers to be compatible with pre-C++11 dialects of Objective-C++.\n* Fix incorrect merging of RLMArray/List changes when objects with the same\n  primary key are created on multiple devices.\n* Fix bad transaction log errors after deleting objects on a different device.\n* Fix a BadVersion error when a background worker finishes running while older\n  results from that worker are being delivered to a different thread.\n\n2.0.1 Release notes (2016-09-29)\n=============================================================\n\n### Bugfixes\n\n* Fix an assertion failure when opening a Realm file written by a 1.x version\n  of Realm which has an indexed nullable int or bool property.\n\n2.0.0 Release notes (2016-09-27)\n=============================================================\n\nThis release introduces support for the Realm Mobile Platform!\nSee <https://realm.io/news/introducing-realm-mobile-platform/> for an overview\nof these great new features.\n\n### API breaking changes\n\n* By popular demand, `RealmSwift.Error` has been moved from the top-level\n  namespace into a `Realm` extension and is now `Realm.Error`, so that it no\n  longer conflicts with `Swift.Error`.\n* Files written by Realm 2.0 cannot be read by 1.x or earlier versions. Old\n  files can still be opened.\n\n### Enhancements\n\n* The .log, .log_a and .log_b files no longer exist and the state tracked in\n  them has been moved to the main Realm file. This reduces the number of open\n  files needed by Realm, improves performance of both opening and writing to\n  Realms, and eliminates a small window where committing write transactions\n  would prevent other processes from opening the file.\n\n### Bugfixes\n\n* Fix an assertion failure when sorting by zero properties.\n* Fix a mid-commit crash in one process also crashing all other processes with\n  the same Realm open.\n* Properly initialize new nullable float and double properties added to\n  existing objects to null rather than 0.\n* Fix a stack overflow when objects with indexed string properties had very\n  long common prefixes.\n* Fix a race condition which could lead to crashes when using async queries or\n  collection notifications.\n* Fix a bug which could lead to incorrect state when an object which links to\n  itself is deleted from the Realm.\n\n1.1.0 Release notes (2016-09-16)\n=============================================================\n\nThis release brings official support for Xcode 8, Swift 2.3 and Swift 3.0.\nPrebuilt frameworks are now built with Xcode 7.3.1 and Xcode 8.0.\n\n### API breaking changes\n\n* Deprecate `migrateRealm:` in favor of new `performMigrationForConfiguration:error:` method\n  that follows Cocoa's NSError conventions.\n* Fix issue where `RLMResults` used `id `instead of its generic type as the return\n  type of subscript.\n\n### Enhancements\n\n* Improve error message when using NSNumber incorrectly in Swift models.\n* Further reduce the download size of the prebuilt static libraries.\n* Improve sort performance, especially on non-nullable columns.\n* Allow partial initialization of object by `initWithValue:`, deferring\n  required property checks until object is added to Realm.\n\n### Bugfixes\n\n* Fix incorrect truncation of the constant value for queries of the form\n  `column < value` for `float` and `double` columns.\n* Fix crash when an aggregate is accessed as an `Int8`, `Int16`, `Int32`, or `Int64`.\n* Fix a race condition that could lead to a crash if an RLMArray or List was\n  deallocated on a different thread than it was created on.\n* Fix a crash when the last reference to an observed object is released from\n  within the observation.\n* Fix a crash when `initWithValue:` is used to create a nested object for a class\n  with an uninitialized schema.\n* Enforce uniqueness for `RealmOptional` primary keys when using the `value` setter.\n\n1.0.2 Release notes (2016-07-13)\n=============================================================\n\n### API breaking changes\n\n* Attempting to add an object with no properties to a Realm now throws rather than silently\n  doing nothing.\n\n### Enhancements\n\n* Swift: A `write` block may now `throw`, reverting any changes already made in\n  the transaction.\n* Reduce address space used when committing write transactions.\n* Significantly reduce the download size of prebuilt binaries and slightly\n  reduce the final size contribution of Realm to applications.\n* Improve performance of accessing RLMArray properties and creating objects\n  with List properties.\n\n### Bugfixes\n\n* Fix a crash when reading the shared schema from an observed Swift object.\n* Fix crashes or incorrect results when passing an array of values to\n  `createOrUpdate` after reordering the class's properties.\n* Ensure that the initial call of a Results notification block is always passed\n  .Initial even if there is a write transaction between when the notification\n  is added and when the first notification is delivered.\n* Fix a crash when deleting all objects in a Realm while fast-enumerating query\n  results from that Realm.\n* Handle EINTR from flock() rather than crashing.\n* Fix incorrect behavior following a call to `[RLMRealm compact]`.\n* Fix live updating and notifications for Results created from a predicate involving\n  an inverse relationship to be triggered when an object at the other end of the relationship\n  is modified.\n\n1.0.1 Release notes (2016-06-12)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* Significantly improve performance of opening Realm files, and slightly\n  improve performance of committing write transactions.\n\n### Bugfixes\n\n* Swift: Fix an error thrown when trying to create or update `Object` instances via\n  `add(:_update:)` with a primary key property of type `RealmOptional`.\n* Xcode playground in Swift release zip now runs successfully.\n* The `key` parameter of `Realm.objectForPrimaryKey(_:key:)`/ `Realm.dynamicObjectForPrimaryKey(_:key:)`\n is now marked as optional.\n* Fix a potential memory leak when closing Realms after a Realm file has been\n  opened on multiple threads which are running in active run loops.\n* Fix notifications breaking on tvOS after a very large number of write\n  transactions have been committed.\n* Fix a \"Destruction of mutex in use\" assertion failure after an error while\n  opening a file.\n* Realm now throws an exception if an `Object` subclass is defined with a managed Swift `lazy` property.\n  Objects with ignored `lazy` properties should now work correctly.\n* Update the LLDB script to work with recent changes to the implementation of `RLMResults`.\n* Fix an assertion failure when a Realm file is deleted while it is still open,\n  and then a new Realm is opened at the same path. Note that this is still not\n  a supported scenario, and may break in other ways.\n\n1.0.0 Release notes (2016-05-25)\n=============================================================\n\nNo changes since 0.103.2.\n\n0.103.2 Release notes (2016-05-24)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* Improve the error messages when an I/O error occurs in `writeCopyToURL`.\n\n### Bugfixes\n\n* Fix an assertion failure which could occur when opening a Realm after opening\n  that Realm failed previously in some specific ways in the same run of the\n  application.\n* Reading optional integers, floats, and doubles from within a migration block\n  now correctly returns `nil` rather than 0 when the stored value is `nil`.\n\n0.103.1 Release notes (2016-05-19)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* None.\n\n### Bugfixes\n\n* Fix a bug that sometimes resulted in a single object's NSData properties\n  changing from `nil` to a zero-length non-`nil` NSData when a different object\n  of the same type was deleted.\n\n0.103.0 Release notes (2016-05-18)\n=============================================================\n\n### API breaking changes\n\n* All functionality deprecated in previous releases has been removed entirely.\n* Support for Xcode 6.x & Swift prior to 2.2 has been completely removed.\n* `RLMResults`/`Results` now become empty when a `RLMArray`/`List` or object\n  they depend on is deleted, rather than throwing an exception when accessed.\n* Migrations are no longer run when `deleteRealmIfMigrationNeeded` is set,\n  recreating the file instead.\n\n### Enhancements\n\n* Added `invalidated` properties to `RLMResults`/`Results`, `RLMLinkingObjects`/`LinkingObjects`,\n  `RealmCollectionType` and `AnyRealmCollection`. These properties report whether the Realm\n  the object is associated with has been invalidated.\n* Some `NSError`s created by Realm now have more descriptive user info payloads.\n\n### Bugfixes\n\n* None.\n\n0.102.1 Release notes (2016-05-13)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* Return `RLMErrorSchemaMismatch` error rather than the more generic `RLMErrorFail`\n  when a migration is required.\n* Improve the performance of allocating instances of `Object` subclasses\n  that have `LinkingObjects` properties.\n\n### Bugfixes\n\n* `RLMLinkingObjects` properties declared in Swift subclasses of `RLMObject`\n  now work correctly.\n* Fix an assertion failure when deleting all objects of a type, inserting more\n  objects, and then deleting some of the newly inserted objects within a single\n  write transaction when there is an active notification block for a different\n  object type which links to the objects being deleted.\n* Fix crashes and/or incorrect results when querying over multiple levels of\n  `LinkingObjects` properties.\n* Fix opening read-only Realms on multiple threads at once.\n* Fix a `BadTransactLog` exception when storing dates before the unix epoch (1970-01-01).\n\n0.102.0 Release notes (2016-05-09)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* Add a method to rename properties during migrations:\n  * Swift: `Migration.renamePropertyForClass(_:oldName:newName:)`\n  * Objective-C: `-[RLMMigration renamePropertyForClass:oldName:newName:]`\n* Add `deleteRealmIfMigrationNeeded` to\n  `RLMRealmConfiguration`/`Realm.Configuration`. When this is set to `true`,\n  the Realm file will be automatically deleted and recreated when there is a\n  schema mismatch rather than migrated to the new schema.\n\n### Bugfixes\n\n* Fix `BETWEEN` queries that traverse `RLMArray`/`List` properties to ensure that\n  a single related object satisfies the `BETWEEN` criteria, rather than allowing\n  different objects in the array to satisfy the lower and upper bounds.\n* Fix a race condition when a Realm is opened on one thread while it is in the\n  middle of being closed on another thread which could result in crashes.\n* Fix a bug which could result in changes made on one thread being applied\n  incorrectly on other threads when those threads are refreshed.\n* Fix crash when migrating to the new date format introduced in 0.101.0.\n* Fix crash when querying inverse relationships when objects are deleted.\n\n0.101.0 Release notes (2016-05-04)\n=============================================================\n\n### API breaking changes\n\n* Files written by this version of Realm cannot be read by older versions of\n  Realm. Existing files will automatically be upgraded when they are opened.\n\n### Enhancements\n\n* Greatly improve performance of collection change calculation for complex\n  object graphs, especially for ones with cycles.\n* NSDate properties now support nanoseconds precision.\n* Opening a single Realm file on multiple threads now shares a single memory\n  mapping of the file for all threads, significantly reducing the memory\n  required to work with large files.\n* Crashing while in the middle of a write transaction no longer blocks other\n  processes from performing write transactions on the same file.\n* Improve the performance of refreshing a Realm (including via autorefresh)\n  when there are live Results/RLMResults objects for that Realm.\n\n### Bugfixes\n\n* Fix an assertion failure of \"!more_before || index >= std::prev(it)->second)\"\n  in `IndexSet::do_add()`.\n* Fix a crash when an `RLMArray` or `List` object is destroyed from the wrong\n  thread.\n\n0.100.0 Release notes (2016-04-29)\n=============================================================\n\n### API breaking changes\n\n* `-[RLMObject linkingObjectsOfClass:forProperty]` and `Object.linkingObjects(_:forProperty:)`\n  are deprecated in favor of properties of type `RLMLinkingObjects` / `LinkingObjects`.\n\n### Enhancements\n\n* The automatically-maintained inverse direction of relationships can now be exposed as\n  properties of type `RLMLinkingObjects` / `LinkingObjects`. These properties automatically\n  update to reflect the objects that link to the target object, can be used in queries, and\n  can be filtered like other Realm collection types.\n* Queries that compare objects for equality now support multi-level key paths.\n\n### Bugfixes\n\n* Fix an assertion failure when a second write transaction is committed after a\n  write transaction deleted the object containing an RLMArray/List which had an\n  active notification block.\n* Queries that compare `RLMArray` / `List` properties using != now give the correct results.\n\n0.99.1 Release notes (2016-04-26)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* None.\n\n### Bugfixes\n\n* Fix a scenario that could lead to the assertion failure\n  \"m_advancer_sg->get_version_of_current_transaction() ==\n  new_notifiers.front()->version()\".\n\n0.99.0 Release notes (2016-04-22)\n=============================================================\n\n### API breaking changes\n\n* Deprecate properties of type `id`/`AnyObject`. This type was rarely used,\n  rarely useful and unsupported in every other Realm binding.\n* The block for `-[RLMArray addNotificationBlock:]` and\n  `-[RLMResults addNotificationBlock:]` now takes another parameter.\n* The following Objective-C APIs have been deprecated in favor of newer or preferred versions:\n\n| Deprecated API                                         | New API                                               |\n|:-------------------------------------------------------|:------------------------------------------------------|\n| `-[RLMRealm removeNotification:]`                      | `-[RLMNotificationToken stop]`                        |\n| `RLMRealmConfiguration.path`                           | `RLMRealmConfiguration.fileURL`                       |\n| `RLMRealm.path`                                        | `RLMRealmConfiguration.fileURL`                       |\n| `RLMRealm.readOnly`                                    | `RLMRealmConfiguration.readOnly`                      |\n| `+[RLMRealm realmWithPath:]`                           | `+[RLMRealm realmWithURL:]`                           |\n| `+[RLMRealm writeCopyToPath:error:]`                   | `+[RLMRealm writeCopyToURL:encryptionKey:error:]`     |\n| `+[RLMRealm writeCopyToPath:encryptionKey:error:]`     | `+[RLMRealm writeCopyToURL:encryptionKey:error:]`     |\n| `+[RLMRealm schemaVersionAtPath:error:]`               | `+[RLMRealm schemaVersionAtURL:encryptionKey:error:]` |\n| `+[RLMRealm schemaVersionAtPath:encryptionKey:error:]` | `+[RLMRealm schemaVersionAtURL:encryptionKey:error:]` |\n\n* The following Swift APIs have been deprecated in favor of newer or preferred versions:\n\n| Deprecated API                                | New API                                  |\n|:----------------------------------------------|:-----------------------------------------|\n| `Realm.removeNotification(_:)`                | `NotificationToken.stop()`               |\n| `Realm.Configuration.path`                    | `Realm.Configuration.fileURL`            |\n| `Realm.path`                                  | `Realm.Configuration.fileURL`            |\n| `Realm.readOnly`                              | `Realm.Configuration.readOnly`           |\n| `Realm.writeCopyToPath(_:encryptionKey:)`     | `Realm.writeCopyToURL(_:encryptionKey:)` |\n| `schemaVersionAtPath(_:encryptionKey:error:)` | `schemaVersionAtURL(_:encryptionKey:)`   |\n\n### Enhancements\n\n* Add information about what rows were added, removed, or modified to the\n  notifications sent to the Realm collections.\n* Improve error when illegally appending to an `RLMArray` / `List` property from a default value\n  or the standalone initializer (`init()`) before the schema is ready.\n\n### Bugfixes\n\n* Fix a use-after-free when an associated object's dealloc method is used to\n  remove observers from an RLMObject.\n* Fix a small memory leak each time a Realm file is opened.\n* Return a recoverable `RLMErrorAddressSpaceExhausted` error rather than\n  crash when there is insufficient available address space on Realm\n  initialization or write commit.\n\n0.98.8 Release notes (2016-04-15)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* None.\n\n### Bugfixes\n\n* Fixed a bug that caused some encrypted files created using\n  `-[RLMRealm writeCopyToPath:encryptionKey:error:]` to fail to open.\n\n0.98.7 Release notes (2016-04-13)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* None.\n\n### Bugfixes\n\n* Mark further initializers in Objective-C as NS_DESIGNATED_INITIALIZER to prevent that these aren't\n  correctly defined in Swift Object subclasses, which don't qualify for auto-inheriting the required initializers.\n* `-[RLMResults indexOfObjectWithPredicate:]` now returns correct results\n  for `RLMResults` instances that were created by filtering an `RLMArray`.\n* Adjust how RLMObjects are destroyed in order to support using an associated\n  object on an RLMObject to remove KVO observers from that RLMObject.\n* `-[RLMResults indexOfObjectWithPredicate:]` now returns the index of the first matching object for a\n  sorted `RLMResults`, matching its documented behavior.\n* Fix a crash when canceling a transaction that set a relationship.\n* Fix a crash when a query referenced a deleted object.\n\n0.98.6 Release notes (2016-03-25)\n=============================================================\n\nPrebuilt frameworks are now built with Xcode 7.3.\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* None.\n\n### Bugfixes\n\n* Fix running unit tests on iOS simulators and devices with Xcode 7.3.\n\n0.98.5 Release notes (2016-03-14)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* None.\n\n### Bugfixes\n\n* Fix a crash when opening a Realm on 32-bit iOS devices.\n\n0.98.4 Release notes (2016-03-10)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* None.\n\n### Bugfixes\n\n* Properly report changes made by adding an object to a Realm with\n  addOrUpdate:/createOrUpdate: to KVO observers for existing objects with that\n  primary key.\n* Fix crashes and assorted issues when a migration which added object link\n  properties is rolled back due to an error in the migration block.\n* Fix assertion failures when deleting objects within a migration block of a\n  type which had an object link property added in that migration.\n* Fix an assertion failure in `Query::apply_patch` when updating certain kinds\n  of queries after a write transaction is committed.\n\n0.98.3 Release notes (2016-02-26)\n=============================================================\n\n### Enhancements\n\n* Initializing the shared schema is 3x faster.\n\n### Bugfixes\n\n* Using Realm Objective-C from Swift while having Realm Swift linked no longer causes that the\n  declared `ignoredProperties` are not taken into account.\n* Fix assertion failures when rolling back a migration which added Object link\n  properties to a class.\n* Fix potential errors when cancelling a write transaction which modified\n  multiple `RLMArray`/`List` properties.\n* Report the correct value for inWriteTransaction after attempting to commit a\n  write transaction fails.\n* Support CocoaPods 1.0 beginning from prerelease 1.0.0.beta.4 while retaining\n  backwards compatibility with 0.39.\n\n0.98.2 Release notes (2016-02-18)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* Aggregate operations (`ANY`, `NONE`, `@count`, `SUBQUERY`, etc.) are now supported for key paths\n  that begin with an object relationship so long as there is a `RLMArray`/`List` property at some\n  point in a key path.\n* Predicates of the form `%@ IN arrayProperty` are now supported.\n\n### Bugfixes\n\n* Use of KVC collection operators on Swift collection types no longer throws an exception.\n* Fix reporting of inWriteTransaction in notifications triggered by\n  `beginWriteTransaction`.\n* The contents of `List` and `Optional` properties are now correctly preserved when copying\n  a Swift object from one Realm to another, and performing other operations that result in a\n  Swift object graph being recursively traversed from Objective-C.\n* Fix a deadlock when queries are performed within a Realm notification block.\n* The `ANY` / `SOME` / `NONE` qualifiers are now required in comparisons involving a key path that\n  traverse a `RLMArray`/`List` property. Previously they were only required if the first key in the\n  key path was an `RLMArray`/`List` property.\n* Fix several scenarios where the default schema would be initialized\n  incorrectly if the first Realm opened used a restricted class subset (via\n  `objectClasses`/`objectTypes`).\n\n0.98.1 Release notes (2016-02-10)\n=============================================================\n\n### Bugfixes\n\n* Fix crashes when deleting an object containing an `RLMArray`/`List` which had\n  previously been queried.\n* Fix a crash when deleting an object containing an `RLMArray`/`List` with\n  active notification blocks.\n* Fix duplicate file warnings when building via CocoaPods.\n* Fix crash or incorrect results when calling `indexOfObject:` on an\n  `RLMResults` derived from an `RLMArray`.\n\n0.98.0 Release notes (2016-02-04)\n=============================================================\n\n### API breaking changes\n\n* `+[RLMRealm realmWithPath:]`/`Realm.init(path:)` now inherits from the default\n  configuration.\n* Swift 1.2 is no longer supported.\n\n### Enhancements\n\n* Add `addNotificationBlock` to `RLMResults`, `Results`, `RLMArray`, and\n  `List`, which calls the given block whenever the collection changes.\n* Do a lot of the work for keeping `RLMResults`/`Results` up-to-date after\n  write transactions on a background thread to help avoid blocking the main\n  thread.\n* `NSPredicate`'s `SUBQUERY` operator is now supported. It has the following limitations:\n  * `@count` is the only operator that may be applied to the `SUBQUERY` expression.\n  * The `SUBQUERY(…).@count` expression must be compared with a constant.\n  * Correlated subqueries are not yet supported.\n\n### Bugfixes\n\n* None.\n\n0.97.1 Release notes (2016-01-29)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* Swift: Added `Error` enum allowing to catch errors e.g. thrown on initializing\n  `RLMRealm`/`Realm` instances.\n* Fail with `RLMErrorFileNotFound` instead of the more generic `RLMErrorFileAccess`,\n  if no file was found when a realm was opened as read-only or if the directory part\n  of the specified path was not found when a copy should be written.\n* Greatly improve performance when deleting objects with one or more indexed\n  properties.\n* Indexing `BOOL`/`Bool` and `NSDate` properties are now supported.\n* Swift: Add support for indexing optional properties.\n\n### Bugfixes\n\n* Fix incorrect results or crashes when using `-[RLMResults setValue:forKey:]`\n  on an RLMResults which was filtered on the key being set.\n* Fix crashes when an RLMRealm is deallocated from the wrong thread.\n* Fix incorrect results from aggregate methods on `Results`/`RLMResults` after\n  objects which were previously in the results are deleted.\n* Fix a crash when adding a new property to an existing class with over a\n  million objects in the Realm.\n* Fix errors when opening encrypted Realm files created with writeCopyToPath.\n* Fix crashes or incorrect results for queries that use relationship equality\n  in cases where the `RLMResults` is kept alive and instances of the target class\n  of the relationship are deleted.\n\n0.97.0 Release notes (2015-12-17)\n=============================================================\n\n### API breaking changes\n\n* All functionality deprecated in previous releases has been removed entirely.\n* Add generic type annotations to NSArrays and NSDictionaries in public APIs.\n* Adding a Realm notification block on a thread not currently running from\n  within a run loop throws an exception rather than silently never calling the\n  notification block.\n\n### Enhancements\n\n* Support for tvOS.\n* Support for building Realm Swift from source when using Carthage.\n* The block parameter of `-[RLMRealm transactionWithBlock:]`/`Realm.write(_:)` is\n  now marked as `__attribute__((noescape))`/`@noescape`.\n* Many forms of queries with key paths on both sides of the comparison operator\n  are now supported.\n* Add support for KVC collection operators in `RLMResults` and `RLMArray`.\n* Fail instead of deadlocking in `+[RLMRealm sharedSchema]`, if a Swift property is initialized\n  to a computed value, which attempts to open a Realm on its own.\n\n### Bugfixes\n\n* Fix poor performance when calling `-[RLMRealm deleteObjects:]` on an\n  `RLMResults` which filtered the objects when there are other classes linking\n  to the type of the deleted objects.\n* An exception is now thrown when defining `Object` properties of an unsupported\n  type.\n\n0.96.3 Release notes (2015-12-04)\n=============================================================\n\n### Enhancements\n\n* Queries are no longer limited to 16 levels of grouping.\n* Rework the implementation of encrypted Realms to no longer interfere with\n  debuggers.\n\n### Bugfixes\n\n* Fix crash when trying to retrieve object instances via `dynamicObjects`.\n* Throw an exception when querying on a link providing objects, which are from a different Realm.\n* Return empty results when querying on a link providing an unattached object.\n* Fix crashes or incorrect results when calling `-[RLMRealm refresh]` during\n  fast enumeration.\n* Add `Int8` support for `RealmOptional`, `MinMaxType` and `AddableType`.\n* Set the default value for newly added non-optional NSData properties to a\n  zero-byte NSData rather than nil.\n* Fix a potential crash when deleting all objects of a class.\n* Fix performance problems when creating large numbers of objects with\n  `RLMArray`/`List` properties.\n* Fix memory leak when using Object(value:) for subclasses with\n  `List` or `RealmOptional` properties.\n* Fix a crash when computing the average of an optional integer property.\n* Fix incorrect search results for some queries on integer properties.\n* Add error-checking for nil realm parameters in many methods such as\n  `+[RLMObject allObjectsInRealm:]`.\n* Fix a race condition between commits and opening Realm files on new threads\n  that could lead to a crash.\n* Fix several crashes when opening Realm files.\n* `-[RLMObject createInRealm:withValue:]`, `-[RLMObject createOrUpdateInRealm:withValue:]`, and\n  their variants for the default Realm now always match the contents of an `NSArray` against properties\n  in the same order as they are defined in the model.\n\n0.96.2 Release notes (2015-10-26)\n=============================================================\n\nPrebuilt frameworks are now built with Xcode 7.1.\n\n### Bugfixes\n\n* Fix ignoring optional properties in Swift.\n* Fix CocoaPods installation on case-sensitive file systems.\n\n0.96.1 Release notes (2015-10-20)\n=============================================================\n\n### Bugfixes\n\n* Support assigning `Results` to `List` properties via KVC.\n* Honor the schema version set in the configuration in `+[RLMRealm migrateRealm:]`.\n* Fix crash when using optional Int16/Int32/Int64 properties in Swift.\n\n0.96.0 Release notes (2015-10-14)\n=============================================================\n\n* No functional changes since beta2.\n\n0.96.0-beta2 Release notes (2015-10-08)\n=============================================================\n\n### Bugfixes\n\n* Add RLMOptionalBase.h to the podspec.\n\n0.96.0-beta Release notes (2015-10-07)\n=============================================================\n\n### API breaking changes\n\n* CocoaPods v0.38 or greater is now required to install Realm and RealmSwift\n  as pods.\n\n### Enhancements\n\n* Functionality common to both `List` and `Results` is now declared in a\n  `RealmCollectionType` protocol that both types conform to.\n* `Results.realm` now returns an `Optional<Realm>` in order to conform to\n  `RealmCollectionType`, but will always return `.Some()` since a `Results`\n  cannot exist independently from a `Realm`.\n* Aggregate operations are now available on `List`: `min`, `max`, `sum`,\n  `average`.\n* Committing write transactions (via `commitWrite` / `commitWriteTransaction` and\n  `write` / `transactionWithBlock`) now optionally allow for handling errors when\n  the disk is out of space.\n* Added `isEmpty` property on `RLMRealm`/`Realm` to indicate if it contains any\n  objects.\n* The `@count`, `@min`, `@max`, `@sum` and `@avg` collection operators are now\n  supported in queries.\n\n### Bugfixes\n\n* Fix assertion failure when inserting NSData between 8MB and 16MB in size.\n* Fix assertion failure when rolling back a migration which removed an object\n  link or `RLMArray`/`List` property.\n* Add the path of the file being opened to file open errors.\n* Fix a crash that could be triggered by rapidly opening and closing a Realm\n  many times on multiple threads at once.\n* Fix several places where exception messages included the name of the wrong\n  function which failed.\n\n0.95.3 Release notes (2015-10-05)\n=============================================================\n\n### Bugfixes\n\n* Compile iOS Simulator framework architectures with `-fembed-bitcode-marker`.\n* Fix crashes when the first Realm opened uses a class subset and later Realms\n  opened do not.\n* Fix inconsistent errors when `Object(value: ...)` is used to initialize the\n  default value of a property of an `Object` subclass.\n* Throw an exception when a class subset has objects with array or object\n  properties of a type that are not part of the class subset.\n\n0.95.2 Release notes (2015-09-24)\n=============================================================\n\n* Enable bitcode for iOS and watchOS frameworks.\n* Build libraries with Xcode 7 final rather than the GM.\n\n0.95.1 Release notes (2015-09-23)\n=============================================================\n\n### Enhancements\n\n* Add missing KVO handling for moving and exchanging objects in `RLMArray` and\n  `List`.\n\n### Bugfixes\n\n* Setting the primary key property on persisted `RLMObject`s / `Object`s\n  via subscripting or key-value coding will cause an exception to be thrown.\n* Fix crash due to race condition in `RLMRealmConfiguration` where the default\n  configuration was in the process of being copied in one thread, while\n  released in another.\n* Fix crash when a migration which removed an object or array property is\n  rolled back due to an error.\n\n0.95.0 Release notes (2015-08-25)\n=============================================================\n\n### API breaking changes\n\n* The following APIs have been deprecated in favor of the new `RLMRealmConfiguration` class in Realm Objective-C:\n\n| Deprecated API                                                    | New API                                                                          |\n|:------------------------------------------------------------------|:---------------------------------------------------------------------------------|\n| `+[RLMRealm realmWithPath:readOnly:error:]`                       | `+[RLMRealm realmWithConfiguration:error:]`                                      |\n| `+[RLMRealm realmWithPath:encryptionKey:readOnly:error:]`         | `+[RLMRealm realmWithConfiguration:error:]`                                      |\n| `+[RLMRealm setEncryptionKey:forRealmsAtPath:]`                   | `-[RLMRealmConfiguration setEncryptionKey:]`                                     |\n| `+[RLMRealm inMemoryRealmWithIdentifier:]`                        | `+[RLMRealm realmWithConfiguration:error:]`                                      |\n| `+[RLMRealm defaultRealmPath]`                                    | `+[RLMRealmConfiguration defaultConfiguration]`                                  |\n| `+[RLMRealm setDefaultRealmPath:]`                                | `+[RLMRealmConfiguration setDefaultConfiguration:]`                              |\n| `+[RLMRealm setDefaultRealmSchemaVersion:withMigrationBlock]`     | `RLMRealmConfiguration.schemaVersion` and `RLMRealmConfiguration.migrationBlock` |\n| `+[RLMRealm setSchemaVersion:forRealmAtPath:withMigrationBlock:]` | `RLMRealmConfiguration.schemaVersion` and `RLMRealmConfiguration.migrationBlock` |\n| `+[RLMRealm migrateRealmAtPath:]`                                 | `+[RLMRealm migrateRealm:]`                                                      |\n| `+[RLMRealm migrateRealmAtPath:encryptionKey:]`                   | `+[RLMRealm migrateRealm:]`                                                      |\n\n* The following APIs have been deprecated in favor of the new `Realm.Configuration` struct in Realm Swift for Swift 1.2:\n\n| Deprecated API                                                | New API                                                                      |\n|:--------------------------------------------------------------|:-----------------------------------------------------------------------------|\n| `Realm.defaultPath`                                           | `Realm.Configuration.defaultConfiguration`                                   |\n| `Realm(path:readOnly:encryptionKey:error:)`                   | `Realm(configuration:error:)`                                                |\n| `Realm(inMemoryIdentifier:)`                                  | `Realm(configuration:error:)`                                                |\n| `Realm.setEncryptionKey(:forPath:)`                           | `Realm(configuration:error:)`                                                |\n| `setDefaultRealmSchemaVersion(schemaVersion:migrationBlock:)` | `Realm.Configuration.schemaVersion` and `Realm.Configuration.migrationBlock` |\n| `setSchemaVersion(schemaVersion:realmPath:migrationBlock:)`   | `Realm.Configuration.schemaVersion` and `Realm.Configuration.migrationBlock` |\n| `migrateRealm(path:encryptionKey:)`                           | `migrateRealm(configuration:)`                                               |\n\n* The following APIs have been deprecated in favor of the new `Realm.Configuration` struct in Realm Swift for Swift 2.0:\n\n| Deprecated API                                                | New API                                                                      |\n|:--------------------------------------------------------------|:-----------------------------------------------------------------------------|\n| `Realm.defaultPath`                                           | `Realm.Configuration.defaultConfiguration`                                   |\n| `Realm(path:readOnly:encryptionKey:) throws`                  | `Realm(configuration:) throws`                                               |\n| `Realm(inMemoryIdentifier:)`                                  | `Realm(configuration:) throws`                                               |\n| `Realm.setEncryptionKey(:forPath:)`                           | `Realm(configuration:) throws`                                               |\n| `setDefaultRealmSchemaVersion(schemaVersion:migrationBlock:)` | `Realm.Configuration.schemaVersion` and `Realm.Configuration.migrationBlock` |\n| `setSchemaVersion(schemaVersion:realmPath:migrationBlock:)`   | `Realm.Configuration.schemaVersion` and `Realm.Configuration.migrationBlock` |\n| `migrateRealm(path:encryptionKey:)`                           | `migrateRealm(configuration:)`                                               |\n\n* `List.extend` in Realm Swift for Swift 2.0 has been replaced with `List.appendContentsOf`,\n  mirroring changes to `RangeReplaceableCollectionType`.\n\n* Object properties on `Object` subclasses in Realm Swift must be marked as optional,\n  otherwise a runtime exception will be thrown.\n\n### Enhancements\n\n* Persisted properties of `RLMObject`/`Object` subclasses are now Key-Value\n  Observing compliant.\n* The different options used to create Realm instances have been consolidated\n  into a single `RLMRealmConfiguration`/`Realm.Configuration` object.\n* Enumerating Realm collections (`RLMArray`, `RLMResults`, `List<>`,\n  `Results<>`) now enumerates over a copy of the collection, making it no\n  longer an error to modify a collection during enumeration (either directly,\n  or indirectly by modifying objects to make them no longer match a query).\n* Improve performance of object insertion in Swift to bring it roughly in line\n  with Objective-C.\n* Allow specifying a specific list of `RLMObject` / `Object` subclasses to include\n  in a given Realm via `RLMRealmConfiguration.objectClasses` / `Realm.Configuration.objectTypes`.\n\n### Bugfixes\n\n* Subscripting on `RLMObject` is now marked as nullable.\n\n0.94.1 Release notes (2015-08-10)\n=============================================================\n\n### API breaking changes\n\n* Building for watchOS requires Xcode 7 beta 5.\n\n### Enhancements\n\n* `Object.className` is now marked as `final`.\n\n### Bugfixes\n\n* Fix crash when adding a property to a model without updating the schema\n  version.\n* Fix unnecessary redownloading of the core library when building from source.\n* Fix crash when sorting by an integer or floating-point property on iOS 7.\n\n0.94.0 Release notes (2015-07-29)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* Reduce the amount of memory used by RLMRealm notification listener threads.\n* Avoid evaluating results eagerly when filtering and sorting.\n* Add nullability annotations to the Objective-C API to provide enhanced compiler\n  warnings and bridging to Swift.\n* Make `RLMResult`s and `RLMArray`s support Objective-C generics.\n* Add support for building watchOS and bitcode-compatible apps.\n* Make the exceptions thrown in getters and setters more informative.\n* Add `-[RLMArray exchangeObjectAtIndex:withObjectAtIndex]` and `List.swap(_:_:)`\n  to allow exchanging the location of two objects in the given `RLMArray` / `List`.\n* Added anonymous analytics on simulator/debugger runs.\n* Add `-[RLMArray moveObjectAtIndex:toIndex:]` and `List.move(from:to:)` to\n  allow moving objects in the given `RLMArray` / `List`.\n\n### Bugfixes\n\n* Processes crashing due to an uncaught exception inside a write transaction will\n  no longer cause other processes using the same Realm to hang indefinitely.\n* Fix incorrect results when querying for < or <= on ints that\n  require 64 bits to represent with a CPU that supports SSE 4.2.\n* An exception will no longer be thrown when attempting to reset the schema\n  version or encryption key on an open Realm to the current value.\n* Date properties on 32 bit devices will retain 64 bit second precision.\n* Wrap calls to the block passed to `enumerate` in an autoreleasepool to reduce\n  memory growth when migrating a large amount of objects.\n* In-memory realms no longer write to the Documents directory on iOS or\n  Application Support on OS X.\n\n0.93.2 Release notes (2015-06-12)\n=============================================================\n\n### Bugfixes\n\n* Fixed an issue where the packaged OS X Realm.framework was built with\n  `GCC_GENERATE_TEST_COVERAGE_FILES` and `GCC_INSTRUMENT_PROGRAM_FLOW_ARCS`\n  enabled.\n* Fix a memory leak when constructing standalone Swift objects with NSDate\n  properties.\n* Throw an exception rather than asserting when an invalidated object is added\n  to an RLMArray.\n* Fix a case where data loss would occur if a device was hard-powered-off\n  shortly after a write transaction was committed which had to expand the Realm\n  file.\n\n0.93.1 Release notes (2015-05-29)\n=============================================================\n\n### Bugfixes\n\n* Objects are no longer copied into standalone objects during object creation. This fixes an issue where\n  nested objects with a primary key are sometimes duplicated rather than updated.\n* Comparison predicates with a constant on the left of the operator and key path on the right now give\n  correct results. An exception is now thrown for predicates that do not yet support this ordering.\n* Fix some crashes in `index_string.cpp` with int primary keys or indexed int properties.\n\n0.93.0 Release notes (2015-05-27)\n=============================================================\n\n### API breaking changes\n\n* Schema versions are now represented as `uint64_t` (Objective-C) and `UInt64` (Swift) so that they have\n  the same representation on all architectures.\n\n### Enhancements\n\n* Swift: `Results` now conforms to `CVarArgType` so it can\n  now be passed as an argument to `Results.filter(_:...)`\n  and `List.filter(_:...)`.\n* Swift: Made `SortDescriptor` conform to the `Equatable` and\n  `StringLiteralConvertible` protocols.\n* Int primary keys are once again automatically indexed.\n* Improve error reporting when attempting to mark a property of a type that\n  cannot be indexed as indexed.\n\n### Bugfixes\n\n* Swift: `RealmSwift.framework` no longer embeds `Realm.framework`,\n  which now allows apps using it to pass iTunes Connect validation.\n\n0.92.4 Release notes (2015-05-22)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* Swift: Made `Object.init()` a required initializer.\n* `RLMObject`, `RLMResults`, `Object` and `Results` can now be safely\n  deallocated (but still not used) from any thread.\n* Improve performance of `-[RLMArray indexOfObjectWhere:]` and `-[RLMArray\n  indexOfObjectWithPredicate:]`, and implement them for standalone RLMArrays.\n* Improved performance of most simple queries.\n\n### Bugfixes\n\n* The interprocess notification mechanism no longer uses dispatch worker threads, preventing it from\n  starving other GCD clients of the opportunity to execute blocks when dozens of Realms are open at once.\n\n0.92.3 Release notes (2015-05-13)\n=============================================================\n\n### API breaking changes\n\n* Swift: `Results.average(_:)` now returns an optional, which is `nil` if and only if the results\n  set is empty.\n\n### Enhancements\n\n* Swift: Added `List.invalidated`, which returns if the given `List` is no longer\n  safe to be accessed, and is analogous to `-[RLMArray isInvalidated]`.\n* Assertion messages are automatically logged to Crashlytics if it's loaded\n  into the current process to make it easier to diagnose crashes.\n\n### Bugfixes\n\n* Swift: Enumerating through a standalone `List` whose objects themselves\n  have list properties won't crash.\n* Swift: Using a subclass of `RealmSwift.Object` in an aggregate operator of a predicate\n  no longer throws a spurious type error.\n* Fix incorrect results for when using OR in a query on a `RLMArray`/`List<>`.\n* Fix incorrect values from `[RLMResults count]`/`Results.count` when using\n  `!=` on an int property with no other query conditions.\n* Lower the maximum doubling threshold for Realm file sizes from 128MB to 16MB\n  to reduce the amount of wasted space.\n\n0.92.2 Release notes (2015-05-08)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* Exceptions raised when incorrect object types are used with predicates now contain more detailed information.\n* Added `-[RLMMigration deleteDataForClassName:]` and `Migration.deleteData(_:)`\n  to enable cleaning up after removing object subclasses\n\n### Bugfixes\n\n* Prevent debugging of an application using an encrypted Realm to work around\n  frequent LLDB hangs. Until the underlying issue is addressed you may set\n  REALM_DISABLE_ENCRYPTION=YES in your application's environment variables to\n  have requests to open an encrypted Realm treated as a request for an\n  unencrypted Realm.\n* Linked objects are properly updated in `createOrUpdateInRealm:withValue:`.\n* List properties on Objects are now properly initialized during fast enumeration.\n\n0.92.1 Release notes (2015-05-06)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* `-[RLMRealm inWriteTransaction]` is now public.\n* Realm Swift is now available on CoocaPods.\n\n### Bugfixes\n\n* Force code re-signing after stripping architectures in `strip-frameworks.sh`.\n\n0.92.0 Release notes (2015-05-05)\n=============================================================\n\n### API breaking changes\n\n* Migration blocks are no longer called when a Realm file is first created.\n* The following APIs have been deprecated in favor of newer method names:\n\n| Deprecated API                                         | New API                                               |\n|:-------------------------------------------------------|:------------------------------------------------------|\n| `-[RLMMigration createObject:withObject:]`             | `-[RLMMigration createObject:withValue:]`             |\n| `-[RLMObject initWithObject:]`                         | `-[RLMObject initWithValue:]`                         |\n| `+[RLMObject createInDefaultRealmWithObject:]`         | `+[RLMObject createInDefaultRealmWithValue:]`         |\n| `+[RLMObject createInRealm:withObject:]`               | `+[RLMObject createInRealm:withValue:]`               |\n| `+[RLMObject createOrUpdateInDefaultRealmWithObject:]` | `+[RLMObject createOrUpdateInDefaultRealmWithValue:]` |\n| `+[RLMObject createOrUpdateInRealm:withObject:]`       | `+[RLMObject createOrUpdateInRealm:withValue:]`       |\n\n### Enhancements\n\n* `Int8` properties defined in Swift are now treated as integers, rather than\n  booleans.\n* NSPredicates created using `+predicateWithValue:` are now supported.\n\n### Bugfixes\n\n* Compound AND predicates with no subpredicates now correctly match all objects.\n\n0.91.5 Release notes (2015-04-28)\n=============================================================\n\n### Bugfixes\n\n* Fix issues with removing search indexes and re-enable it.\n\n0.91.4 Release notes (2015-04-27)\n=============================================================\n\n### Bugfixes\n\n* Temporarily disable removing indexes from existing columns due to bugs.\n\n0.91.3 Release notes (2015-04-17)\n=============================================================\n\n### Bugfixes\n\n* Fix `Extra argument 'objectClassName' in call` errors when building via\n  CocoaPods.\n\n0.91.2 Release notes (2015-04-16)\n=============================================================\n\n* Migration blocks are no longer called when a Realm file is first created.\n\n### Enhancements\n\n* `RLMCollection` supports collection KVC operations.\n* Sorting `RLMResults` is 2-5x faster (typically closer to 2x).\n* Refreshing `RLMRealm` after a write transaction which inserts or modifies\n  strings or `NSData` is committed on another thread is significantly faster.\n* Indexes are now added and removed from existing properties when a Realm file\n  is opened, rather than only when properties are first added.\n\n### Bugfixes\n\n* `+[RLMSchema dynamicSchemaForRealm:]` now respects search indexes.\n* `+[RLMProperty isEqualToProperty:]` now checks for equal `indexed` properties.\n\n0.91.1 Release notes (2015-03-12)\n=============================================================\n\n### Enhancements\n\n* The browser will automatically refresh when the Realm has been modified\n  from another process.\n* Allow using Realm in an embedded framework by setting\n  `APPLICATION_EXTENSION_API_ONLY` to YES.\n\n### Bugfixes\n\n* Fix a crash in CFRunLoopSourceInvalidate.\n\n0.91.0 Release notes (2015-03-10)\n=============================================================\n\n### API breaking changes\n\n* `attributesForProperty:` has been removed from `RLMObject`. You now specify indexed\n  properties by implementing the `indexedProperties` method.\n* An exception will be thrown when calling `setEncryptionKey:forRealmsAtPath:`,\n  `setSchemaVersion:forRealmAtPath:withMigrationBlock:`, and `migrateRealmAtPath:`\n  when a Realm at the given path is already open.\n* Object and array properties of type `RLMObject` will no longer be allowed.\n\n### Enhancements\n\n* Add support for sharing Realm files between processes.\n* The browser will no longer show objects that have no persisted properties.\n* `RLMSchema`, `RLMObjectSchema`, and `RLMProperty` now have more useful descriptions.\n* Opening an encrypted Realm while a debugger is attached to the process no\n  longer throws an exception.\n* `RLMArray` now exposes an `isInvalidated` property to indicate if it can no\n  longer be accessed.\n\n### Bugfixes\n\n* An exception will now be thrown when calling `-beginWriteTransaction` from within a notification\n  triggered by calling `-beginWriteTransaction` elsewhere.\n* When calling `delete:` we now verify that the object being deleted is persisted in the target Realm.\n* Fix crash when calling `createOrUpdate:inRealm` with nested linked objects.\n* Use the key from `+[RLMRealm setEncryptionKey:forRealmsAtPath:]` in\n  `-writeCopyToPath:error:` and `+migrateRealmAtPath:`.\n* Comparing an RLMObject to a non-RLMObject using `-[RLMObject isEqual:]` or\n  `-isEqualToObject:` now returns NO instead of crashing.\n* Improved error message when an `RLMObject` subclass is defined nested within\n  another Swift declaration.\n* Fix crash when the process is terminated by the OS on iOS while encrypted realms are open.\n* Fix crash after large commits to encrypted realms.\n\n0.90.6 Release notes (2015-02-20)\n=============================================================\n\n### Enhancements\n\n* Improve compatibility of encrypted Realms with third-party crash reporters.\n\n### Bugfixes\n\n* Fix incorrect results when using aggregate functions on sorted RLMResults.\n* Fix data corruption when using writeCopyToPath:encryptionKey:.\n* Maybe fix some assertion failures.\n\n0.90.5 Release notes (2015-02-04)\n=============================================================\n\n### Bugfixes\n\n* Fix for crashes when encryption is enabled on 64-bit iOS devices.\n\n0.90.4 Release notes (2015-01-29)\n=============================================================\n\n### Bugfixes\n\n* Fix bug that resulted in columns being dropped and recreated during migrations.\n\n0.90.3 Release notes (2015-01-27)\n=============================================================\n\n### Enhancements\n\n* Calling `createInDefaultRealmWithObject:`, `createInRealm:withObject:`,\n  `createOrUpdateInDefaultRealmWithObject:` or `createOrUpdateInRealm:withObject:`\n  is a no-op if the argument is an RLMObject of the same type as the receiver\n  and is already backed by the target realm.\n\n### Bugfixes\n\n* Fix incorrect column type assertions when the first Realm file opened is a\n  read-only file that is missing tables.\n* Throw an exception when adding an invalidated or deleted object as a link.\n* Throw an exception when calling `createOrUpdateInRealm:withObject:` when the\n  receiver has no primary key defined.\n\n0.90.1 Release notes (2015-01-22)\n=============================================================\n\n### Bugfixes\n\n* Fix for RLMObject being treated as a model object class and showing up in the browser.\n* Fix compilation from the podspec.\n* Fix for crash when calling `objectsWhere:` with grouping in the query on `allObjects`.\n\n0.90.0 Release notes (2015-01-21)\n=============================================================\n\n### API breaking changes\n\n* Rename `-[RLMRealm encryptedRealmWithPath:key:readOnly:error:]` to\n  `-[RLMRealm realmWithPath:encryptionKey:readOnly:error:]`.\n* `-[RLMRealm setSchemaVersion:withMigrationBlock]` is no longer global and must be called\n  for each individual Realm path used. You can now call `-[RLMRealm setDefaultRealmSchemaVersion:withMigrationBlock]`\n  for the default Realm and `-[RLMRealm setSchemaVersion:forRealmAtPath:withMigrationBlock:]` for all others;\n\n### Enhancements\n\n* Add `-[RLMRealm writeCopyToPath:encryptionKey:error:]`.\n* Add support for comparing string columns to other string columns in queries.\n\n### Bugfixes\n\n* Roll back changes made when an exception is thrown during a migration.\n* Throw an exception if the number of items in a RLMResults or RLMArray changes\n  while it's being fast-enumerated.\n* Also encrypt the temporary files used when encryption is enabled for a Realm.\n* Fixed crash in JSONImport example on OS X with non-en_US locale.\n* Fixed infinite loop when opening a Realm file in the Browser at the same time\n  as it is open in a 32-bit simulator.\n* Fixed a crash when adding primary keys to older realm files with no primary\n  keys on any objects.\n* Fixed a crash when removing a primary key in a migration.\n* Fixed a crash when multiple write transactions with no changes followed by a\n  write transaction with changes were committed without the main thread\n  RLMRealm getting a chance to refresh.\n* Fixed incomplete results when querying for non-null relationships.\n* Improve the error message when a Realm file is opened in multiple processes\n  at once.\n\n0.89.2 Release notes (2015-01-02)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* None.\n\n### Bugfixes\n\n* Fix an assertion failure when invalidating a Realm which is in a write\n  transaction, has already been invalidated, or has never been used.\n* Fix an assertion failure when sorting an empty RLMArray property.\n* Fix a bug resulting in the browser never becoming visible on 10.9.\n* Write UTF-8 when generating class files from a realm file in the Browser.\n\n0.89.1 Release notes (2014-12-22)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* Improve the error message when a Realm can't be opened due to lacking write\n  permissions.\n\n### Bugfixes\n\n* Fix an assertion failure when inserting rows after calling `deleteAllObjects`\n  on a Realm.\n* Separate dynamic frameworks are now built for the simulator and devices to\n  work around App Store submission errors due to the simulator version not\n  being automatically stripped from dynamic libraries.\n\n0.89.0 Release notes (2014-12-18)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* Add support for encrypting Realm files on disk.\n* Support using KVC-compliant objects without getters or with custom getter\n  names to initialize RLMObjects with `createObjectInRealm` and friends.\n\n### Bugfixes\n\n* Merge native Swift default property values with defaultPropertyValues().\n* Don't leave the database schema partially updated when opening a realm fails\n  due to a migration being needed.\n* Fixed issue where objects with custom getter names couldn't be used to\n  initialize other objects.\n* Fix a major performance regression on queries on string properties.\n* Fix a memory leak when circularly linked objects are added to a Realm.\n\n0.88.0 Release notes (2014-12-02)\n=============================================================\n\n### API breaking changes\n\n* Deallocating an RLMRealm instance in a write transaction lacking an explicit\n  commit/cancel will now be automatically cancelled instead of committed.\n* `-[RLMObject isDeletedFromRealm]` has been renamed to `-[RLMObject isInvalidated]`.\n\n### Enhancements\n\n* Add `-[RLMRealm writeCopyToPath:]` to write a compacted copy of the Realm\n  another file.\n* Add support for case insensitive, BEGINSWITH, ENDSWITH and CONTAINS string\n  queries on array properties.\n* Make fast enumeration of `RLMArray` and `RLMResults` ~30% faster and\n  `objectAtIndex:` ~55% faster.\n* Added a lldb visualizer script for displaying the contents of persisted\n  RLMObjects when debugging.\n* Added method `-setDefaultRealmPath:` to change the default Realm path.\n* Add `-[RLMRealm invalidate]` to release data locked by the current thread.\n\n### Bugfixes\n\n* Fix for crash when running many simultaneous write transactions on background threads.\n* Fix for crashes caused by opening Realms at multiple paths simultaneously which have had\n  properties re-ordered during migration.\n* Don't run the query twice when `firstObject` or `lastObject` are called on an\n  `RLMResults` which has not had its results accessed already.\n* Fix for bug where schema version is 0 for new Realm created at the latest version.\n* Fix for error message where no migration block is specified when required.\n\n0.87.4 Release notes (2014-11-07)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* None.\n\n### Bugfixes\n\n* Fix browser location in release zip.\n\n0.87.3 Release notes (2014-11-06)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* Added method `-linkingObjectsOfClass:forProperty:` to RLMObject to expose inverse\n  relationships/backlinks.\n\n### Bugfixes\n\n* Fix for crash due to missing search index when migrating an object with a string primary key\n  in a database created using an older versions (0.86.3 and earlier).\n* Throw an exception when passing an array containing a\n  non-RLMObject to -[RLMRealm addObjects:].\n* Fix for crash when deleting an object from multiple threads.\n\n0.87.0 Release notes (2014-10-21)\n=============================================================\n\n### API breaking changes\n\n* RLMArray has been split into two classes, `RLMArray` and `RLMResults`. RLMArray is\n  used for object properties as in previous releases. Moving forward all methods used to\n  enumerate, query, and sort objects return an instance of a new class `RLMResults`. This\n  change was made to support diverging apis and the future addition of change notifications\n  for queries.\n* The api for migrations has changed. You now call `setSchemaVersion:withMigrationBlock:` to\n  register a global migration block and associated version. This block is applied to Realms as\n  needed when opened for Realms at a previous version. The block can be applied manually if\n  desired by calling `migrateRealmAtPath:`.\n* `arraySortedByProperty:ascending:` was renamed to `sortedResultsUsingProperty:ascending`\n* `addObjectsFromArray:` on both `RLMRealm` and `RLMArray` has been renamed to `addObjects:`\n  and now accepts any container class which implements `NSFastEnumeration`\n* Building with Swift support now requires Xcode 6.1\n\n### Enhancements\n\n* Add support for sorting `RLMArray`s by multiple columns with `sortedResultsUsingDescriptors:`\n* Added method `deleteAllObjects` on `RLMRealm` to clear a Realm.\n* Added method `createObject:withObject:` on `RLMMigration` which allows object creation during migrations.\n* Added method `deleteObject:` on `RLMMigration` which allows object deletion during migrations.\n* Updating to core library version 0.85.0.\n* Implement `objectsWhere:` and `objectsWithPredicate:` for array properties.\n* Add `cancelWriteTransaction` to revert all changes made in a write transaction and end the transaction.\n* Make creating `RLMRealm` instances on background threads when an instance\n  exists on another thread take a fifth of the time.\n* Support for partial updates when calling `createOrUpdateWithObject:` and `addOrUpdateObject:`\n* Re-enable Swift support on OS X\n\n### Bugfixes\n\n* Fix exceptions when trying to set `RLMObject` properties after rearranging\n  the properties in a `RLMObject` subclass.\n* Fix crash on IN query with several thousand items.\n* Fix crash when querying indexed `NSString` properties.\n* Fixed an issue which prevented in-memory Realms from being used across multiple threads.\n* Preserve the sort order when querying a sorted `RLMResults`.\n* Fixed an issue with migrations where if a Realm file is deleted after a Realm is initialized,\n  the newly created Realm can be initialized with an incorrect schema version.\n* Fix crash in `RLMSuperSet` when assigning to a `RLMArray` property on a standalone object.\n* Add an error message when the protocol for an `RLMArray` property is not a\n  valid object type.\n* Add an error message when an `RLMObject` subclass is defined nested within\n  another Swift class.\n\n0.86.3 Release notes (2014-10-09)\n=============================================================\n\n### Enhancements\n\n* Add support for != in queries on object relationships.\n\n### Bugfixes\n\n* Re-adding an object to its Realm no longer throws an exception and is now a no-op\n  (as it was previously).\n* Fix another bug which would sometimes result in subclassing RLMObject\n  subclasses not working.\n\n0.86.2 Release notes (2014-10-06)\n=============================================================\n\n### Bugfixes\n\n* Fixed issues with packaging \"Realm Browser.app\" for release.\n\n0.86.1 Release notes (2014-10-03)\n=============================================================\n\n### Bugfixes\n\n* Fix a bug which would sometimes result in subclassing RLMObject subclasses\n  not working.\n\n0.86.0 Release notes (2014-10-03)\n=============================================================\n\n### API breaking changes\n\n* Xcode 6 is now supported from the main Xcode project `Realm.xcodeproj`.\n  Xcode 5 is no longer supported.\n\n### Enhancements\n\n* Support subclassing RLMObject models. Although you can now persist subclasses,\n  polymorphic behavior is not supported (i.e. setting a property to an\n  instance of its subclass).\n* Add support for sorting RLMArray properties.\n* Speed up inserting objects with `addObject:` by ~20%.\n* `readonly` properties are automatically ignored rather than having to be\n  added to `ignoredProperties`.\n* Updating to core library version 0.83.1.\n* Return \"[deleted object]\" rather than throwing an exception when\n  `-description` is called on a deleted RLMObject.\n* Significantly improve performance of very large queries.\n* Allow passing any enumerable to IN clauses rather than just NSArray.\n* Add `objectForPrimaryKey:` and `objectInRealm:forPrimaryKey:` convenience\n  methods to fetch an object by primary key.\n\n### Bugfixes\n\n* Fix error about not being able to persist property 'hash' with incompatible\n  type when building for devices with Xcode 6.\n* Fix spurious notifications of new versions of Realm.\n* Fix for updating nested objects where some types do not have primary keys.\n* Fix for inserting objects from JSON with NSNull values when default values\n  should be used.\n* Trying to add a persisted RLMObject to a different Realm now throws an\n  exception rather than creating an uninitialized object.\n* Fix validation errors when using IN on array properties.\n* Fix errors when an IN clause has zero items.\n* Fix for chained queries ignoring all but the last query's conditions.\n\n0.85.0 Release notes (2014-09-15)\n=============================================================\n\n### API breaking changes\n\n* Notifications for a refresh being needed (when autorefresh is off) now send\n  the notification type RLMRealmRefreshRequiredNotification rather than\n  RLMRealmDidChangeNotification.\n\n### Enhancements\n\n* Updating to core library version 0.83.0.\n* Support for primary key properties (for int and string columns). Declaring a property\n  to be the primary key ensures uniqueness for that property for all objects of a given type.\n  At the moment indexes on primary keys are not yet supported but this will be added in a future\n  release.\n* Added methods to update or insert (upsert) for objects with primary keys defined.\n* `[RLMObject initWithObject:]` and `[RLMObject createInRealmWithObject:]` now support\n  any object type with kvc properties.\n* The Swift support has been reworked to work around Swift not being supported\n  in Frameworks on iOS 7.\n* Improve performance when getting the count of items matching a query but not\n  reading any of the objects in the results.\n* Add a return value to `-[RLMRealm refresh]` that indicates whether or not\n  there was anything to refresh.\n* Add the class name to the error message when an RLMObject is missing a value\n  for a property without a default.\n* Add support for opening Realms in read-only mode.\n* Add an automatic check for updates when using Realm in a simulator (the\n  checker code is not compiled into device builds). This can be disabled by\n  setting the REALM_DISABLE_UPDATE_CHECKER environment variable to any value.\n* Add support for Int16 and Int64 properties in Swift classes.\n\n### Bugfixes\n\n* Realm change notifications when beginning a write transaction are now sent\n  after updating rather than before, to match refresh.\n* `-isEqual:` now uses the default `NSObject` implementation unless a primary key\n  is specified for an RLMObject. When a primary key is specified, `-isEqual:` calls\n  `-isEqualToObject:` and a corresponding implementation for `-hash` is also implemented.\n\n0.84.0 Release notes (2014-08-28)\n=============================================================\n\n### API breaking changes\n\n* The timer used to trigger notifications has been removed. Notifications are now\n  only triggered by commits made in other threads, and can not currently be triggered\n  by changes made by other processes. Interprocess notifications will be re-added in\n  a future commit with an improved design.\n\n### Enhancements\n\n* Updating to core library version 0.82.2.\n* Add property `deletedFromRealm` to RLMObject to indicate objects which have been deleted.\n* Add support for the IN operator in predicates.\n* Add support for the BETWEEN operator in link queries.\n* Add support for multi-level link queries in predicates (e.g. `foo.bar.baz = 5`).\n* Switch to building the SDK from source when using CocoaPods and add a\n  Realm.Headers subspec for use in targets that should not link a copy of Realm\n  (such as test targets).\n* Allow unregistering from change notifications in the change notification\n  handler block.\n* Significant performance improvements when holding onto large numbers of RLMObjects.\n* Realm-Xcode6.xcodeproj now only builds using Xcode6-Beta6.\n* Improved performance during RLMArray iteration, especially when mutating\n  contained objects.\n\n### Bugfixes\n\n* Fix crashes and assorted bugs when sorting or querying a RLMArray returned\n  from a query.\n* Notifications are no longer sent when initializing new RLMRealm instances on background\n  threads.\n* Handle object cycles in -[RLMObject description] and -[RLMArray description].\n* Lowered the deployment target for the Xcode 6 projects and Swift examples to\n  iOS 7.0, as they didn't actually require 8.0.\n* Support setting model properties starting with the letter 'z'\n* Fixed crashes that could result from switching between Debug and Relase\n  builds of Realm.\n\n0.83.0 Release notes (2014-08-13)\n=============================================================\n\n### API breaking changes\n\n* Realm-Xcode6.xcodeproj now only builds using Xcode6-Beta5.\n* Properties to be persisted in Swift classes must be explicitly declared as `dynamic`.\n* Subclasses of RLMObject subclasses now throw an exception on startup, rather\n  than when added to a Realm.\n\n### Enhancements\n\n* Add support for querying for nil object properties.\n* Improve error message when specifying invalid literals when creating or\n  initializing RLMObjects.\n* Throw an exception when an RLMObject is used from the incorrect thread rather\n  than crashing in confusing ways.\n* Speed up RLMRealm instantiation and array property iteration.\n* Allow array and objection relation properties to be missing or null when\n  creating a RLMObject from a NSDictionary.\n\n### Bugfixes\n\n* Fixed a memory leak when querying for objects.\n* Fixed initializing array properties on standalone Swift RLMObject subclasses.\n* Fix for queries on 64bit integers.\n\n0.82.0 Release notes (2014-08-05)\n=============================================================\n\n### API breaking changes\n\n* Realm-Xcode6.xcodeproj now only builds using Xcode6-Beta4.\n\n### Enhancements\n\n* Updating to core library version 0.80.5.\n* Now support disabling the `autorefresh` property on RLMRealm instances.\n* Building Realm-Xcode6 for iOS now builds a universal framework for Simulator & Device.\n* Using NSNumber properties (unsupported) now throws a more informative exception.\n* Added `[RLMRealm defaultRealmPath]`\n* Proper implementation for [RLMArray indexOfObjectWhere:]\n* The default Realm path on OS X is now ~/Library/Application Support/[bundle\n  identifier]/default.realm rather than ~/Documents\n* We now check that the correct framework (ios or osx) is used at compile time.\n\n### Bugfixes\n\n* Fixed rapid growth of the realm file size.\n* Fixed a bug which could cause a crash during RLMArray destruction after a query.\n* Fixed bug related to querying on float properties: `floatProperty = 1.7` now works.\n* Fixed potential bug related to the handling of array properties (RLMArray).\n* Fixed bug where array properties accessed the wrong property.\n* Fixed bug that prevented objects with custom getters to be added to a Realm.\n* Fixed a bug where initializing a standalone object with an array literal would\n  trigger an exception.\n* Clarified exception messages when using unsupported NSPredicate operators.\n* Clarified exception messages when using unsupported property types on RLMObject subclasses.\n* Fixed a memory leak when breaking out of a for-in loop on RLMArray.\n* Fixed a memory leak when removing objects from a RLMArray property.\n* Fixed a memory leak when querying for objects.\n\n\n0.81.0 Release notes (2014-07-22)\n=============================================================\n\n### API breaking changes\n\n* None.\n\n### Enhancements\n\n* Updating to core library version 0.80.3.\n* Added support for basic querying of RLMObject and RLMArray properties (one-to-one and one-to-many relationships).\n  e.g. `[Person objectsWhere:@\"dog.name == 'Alfonso'\"]` or `[Person objectsWhere:@\"ANY dogs.name == 'Alfonso'\"]`\n  Supports all normal operators for numeric and date types. Does not support NSData properties or `BEGINSWITH`, `ENDSWITH`, `CONTAINS`\n  and other options for string properties.\n* Added support for querying for object equality in RLMObject and RLMArray properties (one-to-one and one-to-many relationships).\n  e.g. `[Person objectsWhere:@\"dog == %@\", myDog]` `[Person objectsWhere:@\"ANY dogs == %@\", myDog]` `[Person objectsWhere:@\"ANY friends.dog == %@\", dog]`\n  Only supports comparing objects for equality (i.e. ==)\n* Added a helper method to RLMRealm to perform a block inside a transaction.\n* OSX framework now supported in CocoaPods.\n\n### Bugfixes\n\n* Fixed Unicode support in property names and string contents (Chinese, Russian, etc.). Closing #612 and #604.\n* Fixed bugs related to migration when properties are removed.\n* Fixed keyed subscripting for standalone RLMObjects.\n* Fixed bug related to double clicking on a .realm file to launch the Realm Browser (thanks to Dean Moore).\n\n\n0.80.0 Release notes (2014-07-15)\n=============================================================\n\n### API breaking changes\n\n* Rename migration methods to -migrateDefaultRealmWithBlock: and -migrateRealmAtPath:withBlock:\n* Moved Realm specific query methods from RLMRealm to class methods on RLMObject (-allObjects: to +allObjectsInRealm: ect.)\n\n### Enhancements\n\n* Added +createInDefaultRealmWithObject: method to RLMObject.\n* Added support for array and object literals when calling -createWithObject: and -initWithObject: variants.\n* Added method -deleteObjects: to batch delete objects from a Realm\n* Support for defining RLMObject models entirely in Swift (experimental, see known issues).\n* RLMArrays in Swift support Sequence-style enumeration (for obj in array).\n* Implemented -indexOfObject: for RLMArray\n\n### Known Issues for Swift-defined models\n\n* 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.\n* 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.\n* Array property accessors don't work until its parent object has been added to a realm.\n* Realm-Bridging-Header.h is temporarily exposed as a public header. This is temporary and will be private again once rdar://17633863 is fixed.\n* Does not leverage Swift generics and still uses RLM-prefix everywhere. This is coming in #549.\n\n\n0.22.0 Release notes\n=============================================================\n\n### API breaking changes\n\n* Rename schemaForObject: to schemaForClassName: on RLMSchema\n* Removed -objects:where: and -objects:orderedBy:where: from RLMRealm\n* Removed -indexOfObjectWhere:, -objectsWhere: and -objectsOrderedBy:where: from RLMArray\n* Removed +objectsWhere: and +objectsOrderedBy:where: from RLMObject\n\n### Enhancements\n\n* New Xcode 6 project for experimental swift support.\n* New Realm Editor app for reading and editing Realm db files.\n* Added support for migrations.\n* Added support for RLMArray properties on objects.\n* Added support for creating in-memory default Realm.\n* Added -objectsWithClassName:predicateFormat: and -objectsWithClassName:predicate: to RLMRealm\n* Added -indexOfObjectWithPredicateFormat:, -indexOfObjectWithPredicate:, -objectsWithPredicateFormat:, -objectsWithPredi\n* Added +objectsWithPredicateFormat: and +objectsWithPredicate: to RLMObject\n* Now allows predicates comparing two object properties of the same type.\n\n\n0.20.0 Release notes (2014-05-28)\n=============================================================\n\nCompletely rewritten to be much more object oriented.\n\n### API breaking changes\n\n* Everything\n\n### Enhancements\n\n* None.\n\n### Bugfixes\n\n* None.\n\n\n0.11.0 Release notes (not released)\n=============================================================\n\nThe Objective-C API has been updated and your code will break!\n\n### API breaking changes\n\n* `RLMTable` objects can only be created with an `RLMRealm` object.\n* Renamed `RLMContext` to `RLMTransactionManager`\n* Renamed `RLMContextDidChangeNotification` to `RLMRealmDidChangeNotification`\n* Renamed `contextWithDefaultPersistence` to `managerForDefaultRealm`\n* Renamed `contextPersistedAtPath:` to `managerForRealmWithPath:`\n* Renamed `realmWithDefaultPersistence` to `defaultRealm`\n* Renamed `realmWithDefaultPersistenceAndInitBlock` to `defaultRealmWithInitBlock`\n* Renamed `find:` to `firstWhere:`\n* Renamed `where:` to `allWhere:`\n* Renamed `where:orderBy:` to `allWhere:orderBy:`\n\n### Enhancements\n\n* Added `countWhere:` on `RLMTable`\n* Added `sumOfColumn:where:` on `RLMTable`\n* Added `averageOfColumn:where:` on `RLMTable`\n* Added `minOfProperty:where:` on `RLMTable`\n* Added `maxOfProperty:where:` on `RLMTable`\n* Added `toJSONString` on `RLMRealm`, `RLMTable` and `RLMView`\n* Added support for `NOT` operator in predicates\n* Added support for default values\n* Added validation support in `createInRealm:withObject:`\n\n### Bugfixes\n\n* None.\n\n\n0.10.0 Release notes (2014-04-23)\n=============================================================\n\nTightDB is now Realm! The Objective-C API has been updated\nand your code will break!\n\n### API breaking changes\n\n* All references to TightDB have been changed to Realm.\n* All prefixes changed from `TDB` to `RLM`.\n* `TDBTransaction` and `TDBSmartContext` have merged into `RLMRealm`.\n* Write transactions now take an optional rollback parameter (rather than needing to return a boolean).\n* `addColumnWithName:` and variant methods now return the index of the newly created column if successful, `NSNotFound` otherwise.\n\n### Enhancements\n\n* `createTableWithName:columns:` has been added to `RLMRealm`.\n* Added keyed subscripting for RLMTable's first column if column is of type RLMPropertyTypeString.\n* `setRow:atIndex:` has been added to `RLMTable`.\n* `RLMRealm` constructors now have variants that take an writable initialization block\n* New object interface - tables created/retrieved using `tableWithName:objectClass:` return custom objects\n\n### Bugfixes\n\n* None.\n\n\n0.6.0 Release notes (2014-04-11)\n=============================================================\n\n### API breaking changes\n\n* `contextWithPersistenceToFile:error:` renamed to `contextPersistedAtPath:error:` in `TDBContext`\n* `readWithBlock:` renamed to `readUsingBlock:` in `TDBContext`\n* `writeWithBlock:error:` renamed to `writeUsingBlock:error:` in `TDBContext`\n* `readTable:withBlock:` renamed to `readTable:usingBlock:` in `TDBContext`\n* `writeTable:withBlock:error:` renamed to `writeTable:usingBlock:error:` in `TDBContext`\n* `findFirstRow` renamed to `indexOfFirstMatchingRow` on `TDBQuery`.\n* `findFirstRowFromIndex:` renamed to `indexOfFirstMatchingRowFromIndex:` on `TDBQuery`.\n* Return `NSNotFound` instead of -1 when appropriate.\n* Renamed `castClass` to `castToTytpedTableClass` on `TDBTable`.\n* `removeAllRows`, `removeRowAtIndex`, `removeLastRow`, `addRow` and `insertRow` methods\n  on table now return void instead of BOOL.\n\n### Enhancements\n* A `TDBTable` can now be queried using `where:` and `where:orderBy:` taking\n  `NSPredicate` and `NSSortDescriptor` as arguments.\n* Added `find:` method on `TDBTable` to find first row matching predicate.\n* `contextWithDefaultPersistence` class method added to `TDBContext`. Will create a context persisted\n  to a file in app/documents folder.\n* `renameColumnWithIndex:to:` has been added to `TDBTable`.\n* `distinctValuesInColumnWithIndex` has been added to `TDBTable`.\n* `dateIsBetween::`, `doubleIsBetween::`, `floatIsBetween::` and `intIsBetween::`\n  have been added to `TDBQuery`.\n* Column names in Typed Tables can begin with non-capital letters too. The generated `addX`\n  selector can look odd. For example, a table with one column with name `age`,\n  appending a new row will look like `[table addage:7]`.\n* Mixed typed values are better validated when rows are added, inserted,\n  or modified as object literals.\n* `addRow`, `insertRow`, and row updates can be done using objects\n   derived from `NSObject`.\n* `where` has been added to `TDBView`and `TDBViewProtocol`.\n* Adding support for \"smart\" contexts (`TDBSmartContext`).\n\n### Bugfixes\n\n* Modifications of a `TDBView` and `TDBQuery` now throw an exception in a readtransaction.\n\n\n0.5.0 Release notes (2014-04-02)\n=============================================================\n\nThe Objective-C API has been updated and your code will break!\nOf notable changes a fast interface has been added.\nThis interface includes specific methods to get and set values into Tightdb.\nTo use these methods import `<Tightdb/TightdbFast.h>`.\n\n### API breaking changes\n\n* `getTableWithName:` renamed to `tableWithName:` in `TDBTransaction`.\n* `addColumnWithName:andType:` renamed to `addColumnWithName:type:` in `TDBTable`.\n* `columnTypeOfColumn:` renamed to `columnTypeOfColumnWithIndex` in `TDBTable`.\n* `columnNameOfColumn:` renamed to `nameOfColumnWithIndex:` in `TDBTable`.\n* `addColumnWithName:andType:` renamed to `addColumnWithName:type:` in `TDBDescriptor`.\n* Fast getters and setters moved from `TDBRow.h` to `TDBRowFast.h`.\n\n### Enhancements\n\n* Added `minDateInColumnWithIndex` and `maxDateInColumnWithIndex` to `TDBQuery`.\n* Transactions can now be started directly on named tables.\n* You can create dynamic tables with initial schema.\n* `TDBTable` and `TDBView` now have a shared protocol so they can easier be used interchangeably.\n\n### Bugfixes\n\n* Fixed bug in 64 bit iOS when inserting BOOL as NSNumber.\n\n\n0.4.0 Release notes (2014-03-26)\n=============================================================\n\n### API breaking changes\n\n* Typed interface Cursor has now been renamed to Row.\n* TDBGroup has been renamed to TDBTransaction.\n* Header files are renamed so names match class names.\n* Underscore (_) removed from generated typed table classes.\n* TDBBinary has been removed; use NSData instead.\n* Underscope (_) removed from generated typed table classes.\n* Constructor for TDBContext has been renamed to contextWithPersistenceToFile:\n* Table findFirstRow and min/max/sum/avg operations has been hidden.\n* Table.appendRow has been renamed to addRow.\n* getOrCreateTable on Transaction has been removed.\n* set*:inColumnWithIndex:atRowIndex: methods have been prefixed with TDB\n* *:inColumnWithIndex:atRowIndex: methods have been prefixed with TDB\n* addEmptyRow on table has been removed. Use [table addRow:nil] instead.\n* TDBMixed removed. Use id and NSObject instead.\n* insertEmptyRow has been removed from table. Use insertRow:nil atIndex:index instead.\n\n#### Enhancements\n\n* Added firstRow, lastRow selectors on view.\n* firstRow and lastRow on table now return nil if table is empty.\n* getTableWithName selector added on group.\n* getting and creating table methods on group no longer take error argument.\n* [TDBQuery parent] and [TDBQuery subtable:] selectors now return self.\n* createTable method added on Transaction. Throws exception if table with same name already exists.\n* Experimental support for pinning transactions on Context.\n* TDBView now has support for object subscripting.\n\n### Bugfixes\n\n* None.\n\n\n0.3.0 Release notes (2014-03-14)\n=============================================================\n\nThe Objective-C API has been updated and your code will break!\n\n### API breaking changes\n\n* Most selectors have been renamed in the binding!\n* Prepend TDB-prefix on all classes and types.\n\n### Enhancements\n\n* Return types and parameters changed from size_t to NSUInteger.\n* Adding setObject to TightdbTable (t[2] = @[@1, @\"Hello\"] is possible).\n* Adding insertRow to TightdbTable.\n* Extending appendRow to accept NSDictionary.\n\n### Bugfixes\n\n* None.\n\n\n0.2.0 Release notes (2014-03-07)\n=============================================================\n\nThe Objective-C API has been updated and your code will break!\n\n### API breaking changes\n\n* addRow renamed to addEmptyRow\n\n### Enhancements\n\n* Adding a simple class for version numbering.\n* Adding get-version and set-version targets to build.sh.\n* tableview now supports sort on column with column type bool, date and int\n* tableview has method for checking the column type of a specified column\n* tableview has method for getting the number of columns\n* Adding methods getVersion, getCoreVersion and isAtLeast.\n* Adding appendRow to TightdbTable.\n* Adding object subscripting.\n* Adding method removeColumn on table.\n\n### Bugfixes\n\n* None.\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing\n\n## Filing Issues\n\nWhether you find a bug, typo or an API call that could be clarified, please [file an issue](https://github.com/realm/realm-swift/issues) on our GitHub repository.\n\nWhen filing an issue, please provide as much of the following information as possible in order to help others fix it:\n\n1. **Goals**\n2. **Expected results**\n3. **Actual results**\n4. **Steps to reproduce**\n5. **Code sample that highlights the issue** (full Xcode projects that we can compile ourselves are ideal)\n6. **Version of Realm / Xcode / macOS**\n7. **Version of involved dependency manager (CocoaPods / Carthage)**\n\nIf you'd like to send us sensitive sample code to help troubleshoot your issue, you can email <help-realm@mongodb.com> directly.\n\n### Speeding things up :runner:\n\nYou 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.\n\n```shell\necho \"\\`\\`\\`\n$(sw_vers)\n\n$(xcode-select -p)\n$(xcodebuild -version)\n\n$(which pod && pod --version)\n$(test -e Podfile.lock && cat Podfile.lock | sed -nE 's/^  - (Realm(Swift)? [^:]*):?/\\1/p' || echo \"(not in use here)\")\n\n$(which bash && bash -version | head -n1)\n\n$(which carthage && carthage version)\n$(test -e Cartfile.resolved && cat Cartfile.resolved | grep --color=no realm || echo \"(not in use here)\")\n\n$(which git && git --version)\n\\`\\`\\`\" | tee /dev/tty | pbcopy\n```\n\n## Contributing Enhancements\n\nWe 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-swift/pulls) on our GitHub repository. Make sure to accept our [CLA](#cla) and to follow our [style guide](https://github.com/realm/realm-swift/wiki/Objective-C-Style-Guide).\n\n### Commit Messages\n\nAlthough 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.\n\nBelow are some guidelines about the format of the commit message itself:\n\n* Separate the commit message into a single-line title and a separate body that describes the change.\n* Make the title concise to be easily read within a commit log.\n* 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.\n* If the commit fixes a bug, include the number of the issue in the message.\n* Use the first person present tense - for example \"Fix …\" instead of \"Fixes …\" or \"Fixed …\".\n* For text formatting and spelling, follow the same rules as documentation and in-code comments — for example, the use of capitalization and periods.\n* 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`.\n\n### CLA\n\nRealm 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.\n\n[Please submit your CLA electronically using our Google form](https://docs.google.com/forms/d/e/1FAIpQLSeQ9ROFaTu9pyrmPhXc-dEnLD84DbLuT_-tPNZDOL9J10tOKQ/viewform) 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 <realm-help@mongodb.com>.\n"
  },
  {
    "path": "Configuration/Base.xcconfig",
    "content": "ALWAYS_SEARCH_USER_PATHS = NO;\nCLANG_CXX_LANGUAGE_STANDARD = c++20;\nCLANG_CXX_LIBRARY = libc++;\nCLANG_ENABLE_MODULES = YES;\nCLANG_ENABLE_OBJC_ARC = YES;\nCLANG_WARN_ASSIGN_ENUM = YES;\nCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\nCLANG_WARN_BOOL_CONVERSION = YES;\nCLANG_WARN_COMMA = YES;\nCLANG_WARN_COMPLETION_HANDLER_MISUSE = YES;\nCLANG_WARN_CONSTANT_CONVERSION = YES;\nCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\nCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\nCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\nCLANG_WARN_DUPLICATE_METHOD_MATCH = YES;\nCLANG_WARN_EMPTY_BODY = YES;\nCLANG_WARN_ENUM_CONVERSION = YES;\nCLANG_WARN_FRAMEWORK_INCLUDE_PRIVATE_FROM_PUBLIC = YES;\nCLANG_WARN_INFINITE_RECURSION = YES;\nCLANG_WARN_INT_CONVERSION = YES;\nCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\nCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = NO;\nCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\nCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\nCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\nCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\nCLANG_WARN_STRICT_PROTOTYPES = YES;\nCLANG_WARN_SUSPICIOUS_MOVE = YES;\nCLANG_WARN_UNREACHABLE_CODE = YES;\nCLANG_WARN__DUPLICATE_METHOD_MATCH = YES; // This is Xcode's typo\nCOMBINE_HIDPI_IMAGES = YES;\nEAGER_LINKING = YES;\nENABLE_BITCODE = NO;\nENABLE_STRICT_OBJC_MSGSEND = YES;\nGCC_C_LANGUAGE_STANDARD = gnu99;\nGCC_NO_COMMON_BLOCKS = YES;\nGCC_PRECOMPILE_PREFIX_HEADER = YES;\nGCC_PREFIX_HEADER = $(REALM_PREFIX_HEADER);\nGCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;\nGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\nGCC_WARN_ABOUT_MISSING_NEWLINE = YES;\nGCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;\nGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\nGCC_WARN_SIGN_COMPARE = YES;\nGCC_WARN_UNDECLARED_SELECTOR = YES;\nGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\nGCC_WARN_UNKNOWN_PRAGMAS = YES;\nGCC_WARN_UNUSED_FUNCTION = YES;\nGCC_WARN_UNUSED_PARAMETER = YES;\nGCC_WARN_UNUSED_VARIABLE = YES;\nOTHER_CFLAGS = -fvisibility-inlines-hidden;\nSWIFT_COMPILATION_MODE = wholemodule;\nSWIFT_OPTIMIZATION_LEVEL = -Owholemodule;\nSWIFT_STRICT_CONCURRENCY = complete;\nWARNING_CFLAGS = -Wmismatched-tags -Wunused-private-field -Wpartial-availability;\n\nHEADER_SEARCH_PATHS = $(inherited) core/include;\n\nCODE_SIGN_IDENTITY[sdk=iphone*] = iPhone Developer;\nCODE_SIGNING_REQUIRED[sdk=macosx] = NO;\n\nIPHONEOS_DEPLOYMENT_TARGET_1500 = 12.0;\nIPHONEOS_DEPLOYMENT_TARGET_1600 = 12.0;\nIPHONEOS_DEPLOYMENT_TARGET_2600 = 12.0;\nIPHONEOS_DEPLOYMENT_TARGET = $(IPHONEOS_DEPLOYMENT_TARGET_$(XCODE_VERSION_MAJOR));\nMACOSX_DEPLOYMENT_TARGET_1500 = 10.14;\nMACOSX_DEPLOYMENT_TARGET_1600 = 10.14;\nMACOSX_DEPLOYMENT_TARGET_2600 = 10.14;\nMACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(XCODE_VERSION_MAJOR));\nWATCHOS_DEPLOYMENT_TARGET_1500 = 4.0;\nWATCHOS_DEPLOYMENT_TARGET_1600 = 4.0;\nWATCHOS_DEPLOYMENT_TARGET_2600 = 4.0;\nWATCHOS_DEPLOYMENT_TARGET = $(WATCHOS_DEPLOYMENT_TARGET_$(XCODE_VERSION_MAJOR));\nTVOS_DEPLOYMENT_TARGET_1500 = 12.0;\nTVOS_DEPLOYMENT_TARGET_1600 = 12.0;\nTVOS_DEPLOYMENT_TARGET_2600 = 12.0;\nTVOS_DEPLOYMENT_TARGET = $(TVOS_DEPLOYMENT_TARGET_$(XCODE_VERSION_MAJOR));\n\nAPPLICATION_EXTENSION_API_ONLY = YES;\nREALM_MACH_O_TYPE = mh_dylib;\nSUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator watchos watchsimulator appletvos appletvsimulator xros xrsimulator;\nSUPPORTS_MACCATALYST = YES;\nTARGETED_DEVICE_FAMILY = 1,2,3,4,6,7;\n\nSWIFT_VERSION_1500 = 5.7;\nSWIFT_VERSION_1600 = 5.7;\nSWIFT_VERSION_2600 = 5;\nSWIFT_VERSION = $(SWIFT_VERSION_$(XCODE_VERSION_MAJOR));\n\n"
  },
  {
    "path": "Configuration/Debug.xcconfig",
    "content": "#include \"Base.xcconfig\"\n\nCOPY_PHASE_STRIP = NO;\nENABLE_TESTABILITY = YES;\nGCC_OPTIMIZATION_LEVEL = 0;\nONLY_ACTIVE_ARCH = YES;\nSWIFT_OPTIMIZATION_LEVEL = -Onone;\nOTHER_SWIFT_FLAGS = -Xfrontend -enable-actor-data-race-checks;\n\nGCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 REALM_DEBUG REALM_HAVE_CONFIG __ASSERTMACROS__;\n"
  },
  {
    "path": "Configuration/Realm/PrivateSymbols.txt",
    "content": "# Anything with a C++ mangled name\n__Z*\n# The Bid library used for decimal128\n___bid*\n"
  },
  {
    "path": "Configuration/Realm/Realm.xcconfig",
    "content": "APPLICATION_EXTENSION_API_ONLY = YES;\nDEFINES_MODULE = YES;\nDYLIB_COMPATIBILITY_VERSION = 1;\nDYLIB_CURRENT_VERSION = 1;\nDYLIB_INSTALL_NAME_BASE = @rpath;\nFRAMEWORK_VERSION = A;\nHEADER_SEARCH_PATHS = $(inherited) $(DERIVED_FILE_DIR);\nINFOPLIST_FILE = Realm/Realm-Info.plist;\nMACH_O_TYPE = $(REALM_MACH_O_TYPE);\nMODULEMAP_FILE = $(SRCROOT)/Realm/Realm.modulemap;\nPRODUCT_BUNDLE_IDENTIFIER = io.Realm.${PRODUCT_NAME:rfc1034identifier};\nPRODUCT_NAME = Realm;\nSKIP_INSTALL = YES;\n\nLD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks @loader_path/Frameworks;\nLD_RUNPATH_SEARCH_PATHS[sdk=macosx*] = $(inherited) @executable_path/../Frameworks @loader_path/../Frameworks;\n\nLINKER_FLAG_MACCATALYST_YES = -framework UIKit;\nLINKER_FLAG_MACCATALYST_NO = ;\nOTHER_LDFLAGS = $(REALM_SYMBOLS_FLAGS) -framework UIKit;\nOTHER_LDFLAGS[sdk=macosx*] = $(REALM_SYMBOLS_FLAGS) $(LINKER_FLAG_MACCATALYST_$(IS_MACCATALYST));\n"
  },
  {
    "path": "Configuration/Realm/Tests.xcconfig",
    "content": "#include \"../TestBase.xcconfig\"\n\nINFOPLIST_FILE = Realm/Tests/RealmTests-Info.plist;\nOTHER_CFLAGS = -fobjc-arc-exceptions;\nOTHER_LDFLAGS = -ObjC;\n\nSWIFT_OBJC_BRIDGING_HEADER = Realm/Tests/Swift/Swift-Tests-Bridging-Header.h;\nSWIFT_OPTIMIZATION_LEVEL = -Onone;\n\nEXCLUDED_SOURCE_FILE_NAMES[sdk=iphone*] = InterprocessTests.m SwiftSchemaTests.swift;\nEXCLUDED_SOURCE_FILE_NAMES[sdk=appletv*] = EncryptionTests.mm InterprocessTests.m SwiftSchemaTests.swift;\nEXCLUDED_SOURCE_FILE_NAMES[sdk=watch*] = *;\n"
  },
  {
    "path": "Configuration/RealmSwift/RealmSwift.xcconfig",
    "content": "SKIP_INSTALL = YES;\n\nDEFINES_MODULE = YES;\nDYLIB_COMPATIBILITY_VERSION = 1;\nDYLIB_CURRENT_VERSION = 1;\nDYLIB_INSTALL_NAME_BASE = @rpath;\nINFOPLIST_FILE = RealmSwift/RealmSwift-Info.plist;\nLD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks @loader_path/Frameworks;\nMACH_O_TYPE = $(REALM_MACH_O_TYPE);\nPRODUCT_BUNDLE_IDENTIFIER = io.realm.RealmSwit;\nPRODUCT_NAME = RealmSwift;\n\nREALM_BUILD_LIBRARY_FOR_DISTRIBUTION = NO;\nBUILD_LIBRARY_FOR_DISTRIBUTION = $(REALM_BUILD_LIBRARY_FOR_DISTRIBUTION);\n"
  },
  {
    "path": "Configuration/RealmSwift/Tests.xcconfig",
    "content": "#include \"../TestBase.xcconfig\"\n\nINFOPLIST_FILE = RealmSwift/Tests/RealmSwiftTests-Info.plist;\nOTHER_LDFLAGS = -ObjC;\nSWIFT_OBJC_BRIDGING_HEADER = RealmSwift/Tests/RealmSwiftTests-BridgingHeader.h\nSWIFT_OPTIMIZATION_LEVEL = -Onone;\nSWIFT_STRICT_CONCURRENCY = targeted;\n\nEXCLUDED_SOURCE_FILE_NAMES[sdk=iphone*] = build/osx/*;\nEXCLUDED_SOURCE_FILE_NAMES[sdk=appletv*] = build/osx/*;\nEXCLUDED_SOURCE_FILE_NAMES[sdk=macosx*] = build/ios/*;\n\n"
  },
  {
    "path": "Configuration/Release.xcconfig",
    "content": "#include \"Base.xcconfig\"\n\n// As of beta 1 dSYM generation fails with the unhelpful error \"warning: could\n// not find referenced DIE\" (which seems to not actually be just a warning?)\nDEBUG_INFORMATION_FORMAT_1400 = dwarf-with-dsym;\nDEBUG_INFORMATION_FORMAT_1500 = dwarf;\nDEBUG_INFORMATION_FORMAT = $(DEBUG_INFORMATION_FORMAT_$(XCODE_VERSION_MAJOR));\n\nENABLE_NS_ASSERTIONS = NO;\nGCC_PREPROCESSOR_DEFINITIONS = REALM_HAVE_CONFIG __ASSERTMACROS__;\nLLVM_LTO = YES_THIN;\nVALIDATE_PRODUCT = YES;\n\nREALM_HIDE_SYMBOLS = NO;\nREALM_SYMBOLS_FLAGS_NO = ;\nREALM_SYMBOLS_FLAGS_YES = -Xlinker -unexported_symbols_list -Xlinker Configuration/Realm/PrivateSymbols.txt;\nREALM_SYMBOLS_FLAGS = $(REALM_SYMBOLS_FLAGS_$(REALM_HIDE_SYMBOLS));\n"
  },
  {
    "path": "Configuration/Static.xcconfig",
    "content": "#include \"Release.xcconfig\"\n\nREALM_MACH_O_TYPE = staticlib;\nLLVM_LTO = NO;\nGCC_PREPROCESSOR_DEFINITIONS = REALM_STATIC_FRAMEWORK REALM_HAVE_CONFIG __ASSERTMACROS__;\n"
  },
  {
    "path": "Configuration/SwiftUITestHost.xcconfig",
    "content": "#include \"TestHost.xcconfig\"\n\nINFOPLIST_FILE = Realm/Tests/SwiftUITestHost/Info.plist;\nIPHONEOS_DEPLOYMENT_TARGET = 14.0;\nPRODUCT_BUNDLE_IDENTIFIER = io.realm.SwiftUITestHost;\nSUPPORTED_PLATFORMS = iphonesimulator iphoneos;\n"
  },
  {
    "path": "Configuration/SwiftUITests.xcconfig",
    "content": "#include \"SwiftUITestHost.xcconfig\"\n\nSDKROOT = iphoneos;\nTEST_TARGET_NAME = SwiftUITestHost;\nTEST_HOST[sdk=appletv*] = ;\nTEST_HOST[sdk=iphone*] = ;\n"
  },
  {
    "path": "Configuration/TestBase.xcconfig",
    "content": "SUPPORTED_PLATFORMS = macosx iphonesimulator iphoneos appletvos appletvsimulator xros xrsimulator;\nSKIP_INSTALL = YES;\nPRODUCT_NAME = $(TARGET_NAME);\nPRODUCT_BUNDLE_IDENTIFIER = io.Realm.${PRODUCT_NAME:rfc1034identifier};\n\nLD_RUNPATH_SEARCH_PATHS[sdk=iphone*] = $(inherited) @executable_path/Frameworks @loader_path/Frameworks;\nLD_RUNPATH_SEARCH_PATHS[sdk=appletv*] = $(inherited) @executable_path/Frameworks @loader_path/Frameworks;\nLD_RUNPATH_SEARCH_PATHS[sdk=xr*] = $(inherited) @executable_path/Frameworks @loader_path/Frameworks;\nLD_RUNPATH_SEARCH_PATHS[sdk=macosx*] = $(inherited) @executable_path/../Frameworks @loader_path/../Frameworks;\n\nTEST_HOST[sdk=iphone*] = $(BUILT_PRODUCTS_DIR)/TestHost.app/TestHost;\nTEST_HOST[sdk=appletv*] = $(BUILT_PRODUCTS_DIR)/TestHost.app/TestHost;\nTEST_HOST[sdk=xr*] = $(BUILT_PRODUCTS_DIR)/TestHost.app/TestHost;\n\nMACOSX_DEPLOYMENT_TARGET = 13.0;\nWATCHOS_DEPLOYMENT_TARGET = 7.0;\nTVOS_DEPLOYMENT_TARGET = 14.0;\nIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n"
  },
  {
    "path": "Configuration/TestHost.xcconfig",
    "content": "#include \"TestBase.xcconfig\"\n\nASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\nASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\nCLANG_MODULES_AUTOLINK = NO;\nCODE_SIGN_IDENTITY = \"-\";\nCOPY_PHASE_STRIP = NO;\nINFOPLIST_FILE = Realm/Tests/TestHost/Info.plist;\nINFOPLIST_KEY_LSApplicationCategoryType = \"public.app-category.utilities\";\nLD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks;\nPRODUCT_NAME = $(TARGET_NAME);\n\nREALM_UI_FRAMEWORK_ = Cocoa;\nREALM_UI_FRAMEWORK_uikit = UIKit;\n\nOTHER_LDFLAGS[sdk=iphone*] = -framework UIKit;\nOTHER_LDFLAGS[sdk=appletv*] = -framework UIKit;\nOTHER_LDFLAGS[sdk=xr*] = -framework UIKit;\nOTHER_LDFLAGS[sdk=macosx*] = -framework $(REALM_UI_FRAMEWORK_$(RESOURCES_UI_FRAMEWORK_FAMILY));\n\nPRINCIPAL_CLASS[sdk=iphone*] = UIApplication;\nPRINCIPAL_CLASS[sdk=appletv*] = UIApplication;\nPRINCIPAL_CLASS[sdk=xr*] = UIApplication;\nPRINCIPAL_CLASS[sdk=macosx*] = NSApplication;\n"
  },
  {
    "path": "Gemfile",
    "content": "source \"https://rubygems.org\"\n\ngem 'cocoapods'\ngem 'fileutils'\ngem 'jazzy'\ngem 'jwt'\ngem 'octokit'\ngem 'pathname', '0.3.0'\n"
  },
  {
    "path": "LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n"
  },
  {
    "path": "Package.swift",
    "content": "// swift-tools-version:5.10\n\nimport PackageDescription\nimport Foundation\n\nlet coreVersion = Version(\"20.1.4\")\nlet cocoaVersion = Version(\"20.0.4\")\n\n#if compiler(>=6)\nlet swiftVersion = [SwiftVersion.version(\"6\")]\n#else\nlet swiftVersion = [SwiftVersion.v5]\n#endif\n\nlet cxxSettings: [CXXSetting] = [\n    .headerSearchPath(\".\"),\n    .headerSearchPath(\"include\"),\n    .define(\"REALM_SPM\", to: \"1\"),\n    .define(\"REALM_COCOA_VERSION\", to: \"@\\\"\\(cocoaVersion)\\\"\"),\n    .define(\"REALM_VERSION\", to: \"\\\"\\(coreVersion)\\\"\"),\n\n    .define(\"REALM_DEBUG\", .when(configuration: .debug)),\n    .define(\"REALM_NO_CONFIG\"),\n    .define(\"REALM_INSTALL_LIBEXECDIR\", to: \"\"),\n    .define(\"REALM_ENABLE_ASSERTIONS\", to: \"1\"),\n    .define(\"REALM_ENABLE_ENCRYPTION\", to: \"1\"),\n\n    .define(\"REALM_VERSION_MAJOR\", to: String(coreVersion.major)),\n    .define(\"REALM_VERSION_MINOR\", to: String(coreVersion.minor)),\n    .define(\"REALM_VERSION_PATCH\", to: String(coreVersion.patch)),\n    .define(\"REALM_VERSION_EXTRA\", to: \"\\\"\\(coreVersion.prereleaseIdentifiers.first ?? \"\")\\\"\"),\n    .define(\"REALM_VERSION_STRING\", to: \"\\\"\\(coreVersion)\\\"\"),\n    .define(\"REALM_ENABLE_GEOSPATIAL\", to: \"1\"),\n]\nlet testCxxSettings: [CXXSetting] = cxxSettings + [\n    // Command-line `swift build` resolves header search paths\n    // relative to the package root, while Xcode resolves them\n    // relative to the target root, so we need both.\n    .headerSearchPath(\"Realm\"),\n    .headerSearchPath(\"..\"),\n]\n\nlet package = Package(\n    name: \"Realm\",\n    platforms: [\n        .macOS(.v10_13),\n        .iOS(.v12),\n        .tvOS(.v12),\n        .watchOS(.v4)\n    ],\n    products: [\n        .library(\n            name: \"Realm\",\n            type: .dynamic,\n            targets: [\"Realm\"]),\n        .library(\n            name: \"RealmSwift\",\n            type: .dynamic,\n            targets: [\"RealmSwift\"]),\n    ],\n    dependencies: [\n        .package(url: \"https://github.com/realm/realm-core.git\", exact: coreVersion)\n    ],\n    targets: [\n      .target(\n            name: \"Realm\",\n            dependencies: [.product(name: \"RealmCore\", package: \"realm-core\")],\n            path: \".\",\n            exclude: [\n                \"CHANGELOG.md\",\n                \"CONTRIBUTING.md\",\n                \"Carthage\",\n                \"Configuration\",\n                \"LICENSE\",\n                \"Package.swift\",\n                \"README.md\",\n                \"Realm.podspec\",\n                \"Realm.xcodeproj\",\n                \"Realm/Realm-Info.plist\",\n                \"Realm/Swift/RLMSupport.swift\",\n                \"Realm/TestUtils\",\n                \"Realm/Tests\",\n                \"RealmSwift\",\n                \"RealmSwift.podspec\",\n                \"SUPPORT.md\",\n                \"build.sh\",\n                \"contrib\",\n                \"dependencies.list\",\n                \"docs\",\n                \"examples\",\n                \"include\",\n                \"logo.png\",\n                \"plugin\",\n                \"scripts\",\n            ],\n            sources: [\n                \"Realm/RLMAccessor.mm\",\n                \"Realm/RLMArray.mm\",\n                \"Realm/RLMAsyncTask.mm\",\n                \"Realm/RLMClassInfo.mm\",\n                \"Realm/RLMCollection.mm\",\n                \"Realm/RLMConstants.m\",\n                \"Realm/RLMDecimal128.mm\",\n                \"Realm/RLMDictionary.mm\",\n                \"Realm/RLMEmbeddedObject.mm\",\n                \"Realm/RLMError.mm\",\n                \"Realm/RLMGeospatial.mm\",\n                \"Realm/RLMLogger.mm\",\n                \"Realm/RLMManagedArray.mm\",\n                \"Realm/RLMManagedDictionary.mm\",\n                \"Realm/RLMManagedSet.mm\",\n                \"Realm/RLMMigration.mm\",\n                \"Realm/RLMObject.mm\",\n                \"Realm/RLMObjectBase.mm\",\n                \"Realm/RLMObjectId.mm\",\n                \"Realm/RLMObjectSchema.mm\",\n                \"Realm/RLMObjectStore.mm\",\n                \"Realm/RLMObservation.mm\",\n                \"Realm/RLMPredicateUtil.mm\",\n                \"Realm/RLMProperty.mm\",\n                \"Realm/RLMQueryUtil.mm\",\n                \"Realm/RLMRealm.mm\",\n                \"Realm/RLMRealmConfiguration.mm\",\n                \"Realm/RLMRealmUtil.mm\",\n                \"Realm/RLMResults.mm\",\n                \"Realm/RLMScheduler.mm\",\n                \"Realm/RLMSchema.mm\",\n                \"Realm/RLMSectionedResults.mm\",\n                \"Realm/RLMSet.mm\",\n                \"Realm/RLMSwiftCollectionBase.mm\",\n                \"Realm/RLMSwiftSupport.m\",\n                \"Realm/RLMSwiftValueStorage.mm\",\n                \"Realm/RLMThreadSafeReference.mm\",\n                \"Realm/RLMUUID.mm\",\n                \"Realm/RLMUtil.mm\",\n                \"Realm/RLMValue.mm\",\n            ],\n            resources: [\n                .copy(\"Realm/PrivacyInfo.xcprivacy\")\n            ],\n            publicHeadersPath: \"include\",\n            cxxSettings: cxxSettings,\n            linkerSettings: [\n                .linkedFramework(\"UIKit\", .when(platforms: [.iOS, .macCatalyst, .tvOS, .watchOS]))\n            ]\n        ),\n        .target(\n            name: \"RealmSwift\",\n            dependencies: [\"Realm\"],\n            path: \"RealmSwift\",\n            exclude: [\n                \"RealmSwift-Info.plist\",\n                \"Tests\",\n            ],\n            resources: [\n                .copy(\"PrivacyInfo.xcprivacy\")\n            ]\n        ),\n        .target(\n            name: \"RealmTestSupport\",\n            dependencies: [\"Realm\"],\n            path: \"Realm/TestUtils\",\n            cxxSettings: testCxxSettings\n        ),\n        .target(\n            name: \"RealmSwiftTestSupport\",\n            dependencies: [\"RealmSwift\", \"RealmTestSupport\"],\n            path: \"RealmSwift/Tests\",\n            sources: [\"TestUtils.swift\"]\n        ),\n        .testTarget(\n            name: \"RealmTests\",\n            dependencies: [\"Realm\", \"RealmTestSupport\"],\n            path: \"Realm/Tests\",\n            exclude: [\n                \"PrimitiveArrayPropertyTests.tpl.m\",\n                \"PrimitiveDictionaryPropertyTests.tpl.m\",\n                \"PrimitiveRLMValuePropertyTests.tpl.m\",\n                \"PrimitiveSetPropertyTests.tpl.m\",\n                \"RealmTests-Info.plist\",\n                \"Swift\",\n                \"SwiftUITestHost\",\n                \"SwiftUITestHostUITests\",\n                \"TestHost\",\n                \"array_tests.py\",\n                \"dictionary_tests.py\",\n                \"fileformat-pre-null.realm\",\n                \"mixed_tests.py\",\n                \"set_tests.py\",\n            ],\n            cxxSettings: testCxxSettings\n        ),\n        .testTarget(\n            name: \"RealmObjcSwiftTests\",\n            dependencies: [\"Realm\", \"RealmTestSupport\"],\n            path: \"Realm/Tests/Swift\",\n            exclude: [\"RealmObjcSwiftTests-Info.plist\"]\n        ),\n        .testTarget(\n            name: \"RealmSwiftTests\",\n            dependencies: [\"RealmSwift\", \"RealmTestSupport\", \"RealmSwiftTestSupport\"],\n            path: \"RealmSwift/Tests\",\n            exclude: [\n                \"RealmSwiftTests-Info.plist\",\n                \"QueryTests.swift.gyb\",\n                \"TestUtils.swift\"\n            ]\n        ),\n    ],\n    swiftLanguageVersions: swiftVersion,\n    cxxLanguageStandard: .cxx20\n)\n"
  },
  {
    "path": "README.md",
    "content": "<picture>\n    <source srcset=\"./media/logo-dark.svg\" media=\"(prefers-color-scheme: dark)\" alt=\"realm\">\n    <img src=\"./media/logo.svg\" alt=\"realm\">\n</picture>\n\n# About Realm Database\n\nRealm is a mobile database that runs directly inside phones, tablets or wearables.\nThis repository holds the source code for the iOS, macOS, tvOS & watchOS versions of Realm Swift & Realm Objective-C.\n\n## Why Use Realm\n\n* **Intuitive to Developers:** Realm’s object-oriented data model is simple to learn, doesn’t need an ORM, and lets you write less code.\n* **Built for Mobile:** Realm is fully-featured, lightweight, and efficiently uses memory, disk space, and battery life.\n* **Designed for Offline Use:** Realm’s local database persists data on-disk, so apps work as well offline as they do online.\n\n## Object-Oriented: Streamline Your Code\n\nRealm was built for mobile developers, with simplicity in mind. The idiomatic, object-oriented data model can save you thousands of lines of code.\n\n```swift\n// Define your models like regular Swift classes\nclass Dog: Object {\n    @Persisted var name: String\n    @Persisted var age: Int\n}\nclass Person: Object {\n    @Persisted(primaryKey: true) var _id: String\n    @Persisted var name: String\n    @Persisted var age: Int\n    // Create relationships by pointing an Object field to another Class\n    @Persisted var dogs: List<Dog>\n}\n// Use them like regular Swift objects\nlet dog = Dog()\ndog.name = \"Rex\"\ndog.age = 1\nprint(\"name of dog: \\(dog.name)\")\n\n// Get the default Realm\nlet realm = try! Realm()\n// Persist your data easily with a write transaction\ntry! realm.write {\n    realm.add(dog)\n}\n```\n## Live Objects: Build Reactive Apps\nRealm’s live objects mean data updated anywhere is automatically updated everywhere.\n```swift\n// Open the default realm.\nlet realm = try! Realm()\n\nvar token: NotificationToken?\n\nlet dog = Dog()\ndog.name = \"Max\"\n\n// Create a dog in the realm.\ntry! realm.write {\n    realm.add(dog)\n}\n\n//  Set up the listener & observe object notifications.\ntoken = dog.observe { change in\n    switch change {\n    case .change(let properties):\n        for property in properties {\n            print(\"Property '\\(property.name)' changed to '\\(property.newValue!)'\");\n        }\n    case .error(let error):\n        print(\"An error occurred: (error)\")\n    case .deleted:\n        print(\"The object was deleted.\")\n    }\n}\n\n// Update the dog's name to see the effect.\ntry! realm.write {\n    dog.name = \"Wolfie\"\n}\n```\n### SwiftUI\nRealm integrates directly with SwiftUI, updating your views so you don't have to.\n```swift\nstruct ContactsView: View {\n    @ObservedResults(Person.self) var persons\n\n    var body: some View {\n        List {\n            ForEach(persons) { person in\n                Text(person.name)\n            }\n            .onMove(perform: $persons.move)\n            .onDelete(perform: $persons.remove)\n        }.navigationBarItems(trailing:\n            Button(\"Add\") {\n                $persons.append(Person())\n            }\n        )\n    }\n}\n```\n\n## Fully Encrypted\nData can be encrypted in-flight and at-rest, keeping even the most sensitive data secure.\n```swift\n// Generate a random encryption key\nvar key = Data(count: 64)\n_ = key.withUnsafeMutableBytes { (pointer: UnsafeMutableRawBufferPointer) in\n    guard let baseAddress = pointer.baseAddress else {\n        fatalError(\"Failed to obtain base address\")\n    }\n    SecRandomCopyBytes(kSecRandomDefault, 64, baseAddress)\n}\n\n// Add the encryption key to the config and open the realm\nlet config = Realm.Configuration(encryptionKey: key)\nlet realm = try Realm(configuration: config)\n\n// Use the Realm as normal\nlet dogs = realm.objects(Dog.self).filter(\"name contains 'Fido'\")\n```\n\n## Getting Started\n\nWe support installing Realm via Swift Package Manager, CocoaPods, Carthage, or by importing a dynamic XCFramework.\n\nFor more information, see our [Quick Start](docs/guides/quick-start.md).\n\n## Documentation\n\nThe documentation can be found in the [docs/](docs/README.md) directory.\n\nThe API reference can be generated from source using\n[jazzy](https://github.com/realm/jazzy/) by running `sh build.sh docs` from the root of this repository.\n\n## Getting Help\n\n- **Need help with your code?**: Look for previous questions with the[`realm` tag](https://stackoverflow.com/questions/tagged/realm?sort=newest) on Stack Overflow or [ask a new question](https://stackoverflow.com/questions/ask?tags=realm). For general discussion that might be considered too broad for Stack Overflow, use the [Community Forum](https://developer.mongodb.com/community/forums/tags/c/realm-sdks/58/swift/).\n- **Have a bug to report?** [Open a GitHub issue](https://github.com/realm/realm-swift/issues/new). If possible, include the version of Realm, a full log, the Realm file, and a project that shows the issue.\n- **Have a feature request?** [Open a GitHub issue](https://github.com/realm/realm-swift/issues/new). Tell us what the feature should do and why you want the feature.\n\n## Building Realm\n\nIn case you don't want to use the precompiled version, you can build Realm yourself from source.\n\nPrerequisites:\n\n* Building Realm requires Xcode 15.3 or newer.\n* Building Realm documentation requires [jazzy](https://github.com/realm/jazzy)\n\nOnce you have all the necessary prerequisites, building Realm just takes a single command: `sh build.sh build`.\nYou'll need an internet connection the first time you build Realm to download the core binary.\nThis will produce Realm.xcframework and RealmSwift.xcframework in `build/Release/`.\n\nRun `sh build.sh help` to see all the actions you can perform (build ios/osx, generate docs, test, etc.).\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for more details!\n\n## Code of Conduct\n\nThis project adheres to the [MongoDB Code of Conduct](https://www.mongodb.com/community-code-of-conduct).\nBy participating, you are expected to uphold this code. Please report\nunacceptable behavior to [community-conduct@mongodb.com](mailto:community-conduct@mongodb.com).\n\n## License\n\nRealm Objective-C & Realm Swift are published under the Apache 2.0 license.\nRealm Core is also published under the Apache 2.0 license and is available\n[here](https://github.com/realm/realm-core).\n\n## Feedback\n\n**_If you use Realm and are happy with it, please consider sending out a tweet mentioning [@realm](https://twitter.com/realm) to share your thoughts!_**\n\n**_And if you don't like it, please let us know what you would like improved, so we can fix it!_**\n\n<img style=\"width: 0px; height: 0px;\" src=\"https://3eaz4mshcd.execute-api.us-east-1.amazonaws.com/prod?s=https://github.com/realm/realm-swift#README.md\">\n"
  },
  {
    "path": "Realm/PrivacyInfo.xcprivacy",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>NSPrivacyTrackingDomains</key>\n\t<array/>\n\t<key>NSPrivacyCollectedDataTypes</key>\n\t<array/>\n\t<key>NSPrivacyAccessedAPITypes</key>\n\t<array>\n\t\t<dict>\n\t\t\t<key>NSPrivacyAccessedAPITypeReasons</key>\n\t\t\t<array>\n\t\t\t\t<string>C617.1</string>\n\t\t\t</array>\n\t\t\t<key>NSPrivacyAccessedAPIType</key>\n\t\t\t<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>NSPrivacyAccessedAPITypeReasons</key>\n\t\t\t<array>\n\t\t\t\t<string>E174.1</string>\n\t\t\t</array>\n\t\t\t<key>NSPrivacyAccessedAPIType</key>\n\t\t\t<string>NSPrivacyAccessedAPICategoryDiskSpace</string>\n\t\t</dict>\n\t</array>\n\t<key>NSPrivacyTracking</key>\n\t<false/>\n</dict>\n</plist>\n"
  },
  {
    "path": "Realm/RLMAccessor.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\n@class RLMObjectSchema, RLMProperty, RLMObjectBase;\n\nRLM_HEADER_AUDIT_BEGIN(nullability)\n\n//\n// Accessors Class Creation/Caching\n//\n\n// get accessor classes for an object class - generates classes if not cached\nClass RLMManagedAccessorClassForObjectClass(Class objectClass, RLMObjectSchema *schema, const char *name);\nClass RLMUnmanagedAccessorClassForObjectClass(Class objectClass, RLMObjectSchema *schema);\n\n//\n// Dynamic getters/setters\n//\nFOUNDATION_EXTERN void RLMDynamicValidatedSet(RLMObjectBase *obj, NSString *propName, id __nullable val);\nFOUNDATION_EXTERN id __nullable RLMDynamicGet(RLMObjectBase *obj, RLMProperty *prop);\nFOUNDATION_EXTERN id __nullable RLMDynamicGetByName(RLMObjectBase *obj, NSString *propName);\n\n// by property/column\nvoid RLMDynamicSet(RLMObjectBase *obj, RLMProperty *prop, id val);\n\n//\n// Class modification\n//\n\n// Replace className method for the given class\nvoid RLMReplaceClassNameMethod(Class accessorClass, NSString *className);\n\n// Replace sharedSchema method for the given class\nvoid RLMReplaceSharedSchemaMethod(Class accessorClass, RLMObjectSchema * __nullable schema);\n\nRLM_HEADER_AUDIT_END(nullability)\n"
  },
  {
    "path": "Realm/RLMAccessor.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2017 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMAccessor.h\"\n\n#import \"RLMClassInfo.hpp\"\n#import \"RLMDecimal128_Private.hpp\"\n#import \"RLMObjectId_Private.hpp\"\n#import \"RLMUUID_Private.hpp\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/object-store/object_accessor.hpp>\n\n@class RLMRealm;\nclass RLMClassInfo;\nclass RLMObservationTracker;\ntypedef NS_ENUM(NSUInteger, RLMUpdatePolicy);\n\nRLM_HIDDEN_BEGIN\n\n// std::optional<id> doesn't work because Objective-C types can't\n// be members of unions with ARC, so this covers the subset of Optional that we\n// actually need.\nstruct RLMOptionalId {\n    id value;\n    RLMOptionalId(id value) : value(value) { }\n    explicit operator bool() const noexcept { return value; }\n    id operator*() const noexcept { return value; }\n};\n\n// The subset of RLMAccessorContext which does not require any member variables.\n// Use this if you require to box/unbox types and you do not have access to the\n// parent object or realm.\nstruct RLMStatelessAccessorContext {\n    static id box(bool v) { return @(v); }\n    static id box(double v) { return @(v); }\n    static id box(float v) { return @(v); }\n    static id box(long long v) { return @(v); }\n    static id box(realm::StringData v) { return RLMStringDataToNSString(v) ?: NSNull.null; }\n    static id box(realm::BinaryData v) { return RLMBinaryDataToNSData(v) ?: NSNull.null; }\n    static id box(realm::Timestamp v) { return RLMTimestampToNSDate(v) ?: NSNull.null; }\n    static id box(realm::Decimal128 v) { return v.is_null() ? NSNull.null : [[RLMDecimal128 alloc] initWithDecimal128:v]; }\n    static id box(realm::ObjectId v) { return [[RLMObjectId alloc] initWithValue:v]; }\n    static id box(realm::UUID v) { return [[NSUUID alloc] initWithRealmUUID:v]; }\n\n    static id box(std::optional<bool> v) { return v ? @(*v) : NSNull.null; }\n    static id box(std::optional<double> v) { return v ? @(*v) : NSNull.null; }\n    static id box(std::optional<float> v) { return v ? @(*v) : NSNull.null; }\n    static id box(std::optional<int64_t> v) { return v ? @(*v) : NSNull.null; }\n    static id box(std::optional<realm::ObjectId> v) { return v ? box(*v) : NSNull.null; }\n    static id box(std::optional<realm::UUID> v) { return v ? box(*v) : NSNull.null; }\n\n    template<typename T>\n    static T unbox(id v);\n\n    template<typename Func>\n    static void enumerate_collection(__unsafe_unretained const id v, Func&& func) {\n        id enumerable = RLMAsFastEnumeration(v) ?: v;\n        for (id value in enumerable) {\n            func(value);\n        }\n    }\n\n    template<typename Func>\n    static void enumerate_dictionary(__unsafe_unretained const id v, Func&& func) {\n        id enumerable = RLMAsFastEnumeration(v) ?: v;\n        for (id key in enumerable) {\n            func(unbox<realm::StringData>(key), v[key]);\n        }\n    }\n\n    static bool is_null(id v) noexcept { return v == NSNull.null; }\n    static id null_value() noexcept { return NSNull.null; }\n    static id no_value() noexcept { return nil; }\n    static bool allow_missing(id v) noexcept { return [v isKindOfClass:[NSArray class]]; }\n\n    static bool is_same_list(realm::List const& list, id v) noexcept;\n    static bool is_same_dictionary(realm::object_store::Dictionary const&, id) noexcept;\n    static bool is_same_set(realm::object_store::Set const&, id) noexcept;\n\n    static std::string print(id obj) { return [obj description].UTF8String; }\n};\n\nclass RLMAccessorContext : public RLMStatelessAccessorContext {\npublic:\n    ~RLMAccessorContext();\n\n    // Accessor context interface\n    RLMAccessorContext(RLMAccessorContext& parent, realm::Obj const& parent_obj, realm::Property const& property);\n\n    using RLMStatelessAccessorContext::box;\n    id box(realm::List&&);\n    id box(realm::Results&&);\n    id box(realm::Object&&);\n    id box(realm::Obj&&);\n    id box(realm::object_store::Dictionary&&);\n    id box(realm::object_store::Set&&);\n    id box(realm::Mixed);\n\n    void will_change(realm::Obj const&, realm::Property const&);\n    void will_change(realm::Object& obj, realm::Property const& prop) { will_change(obj.get_obj(), prop); }\n    void did_change();\n\n    RLMOptionalId value_for_property(id dict, realm::Property const&, size_t prop_index);\n    RLMOptionalId default_value_for_property(realm::ObjectSchema const&,\n                                             realm::Property const& prop);\n\n    template<typename T>\n    T unbox(__unsafe_unretained id const v, realm::CreatePolicy = realm::CreatePolicy::Skip, realm::ObjKey = {}) {\n        return RLMStatelessAccessorContext::unbox<T>(v);\n    }\n    template<>\n    realm::Obj unbox(id v, realm::CreatePolicy, realm::ObjKey);\n    template<>\n    realm::Mixed unbox(id v, realm::CreatePolicy, realm::ObjKey);\n\n    realm::Obj create_embedded_object();\n\n    // Internal API\n    RLMAccessorContext(RLMObjectBase *parentObject, const realm::Property *property = nullptr);\n    RLMAccessorContext(RLMObjectBase *parentObject, realm::ColKey);\n    RLMAccessorContext(RLMClassInfo& info);\n    RLMAccessorContext(RLMClassInfo& parentInfo, RLMClassInfo& info, RLMProperty *property);\n\n    // The property currently being accessed; needed for KVO things for boxing\n    // List and Results\n    RLMProperty *currentProperty;\n\n    std::pair<realm::Obj, bool>\n    createObject(id value, realm::CreatePolicy policy, bool forceCreate=false, realm::ObjKey existingKey={});\n\nprivate:\n    __unsafe_unretained RLMRealm *const _realm;\n    RLMClassInfo& _info;\n\n    realm::Obj _parentObject;\n    RLMClassInfo* _parentObjectInfo = nullptr;\n    realm::ColKey _colKey;\n\n    // Cached default values dictionary to avoid having to call the class method\n    // for every property\n    NSDictionary *_defaultValues;\n\n    std::unique_ptr<RLMObservationTracker> _observationHelper;\n\n    id defaultValue(NSString *key);\n    id propertyValue(id obj, size_t propIndex, __unsafe_unretained RLMProperty *const prop);\n};\n\nRLM_HIDDEN_END\n"
  },
  {
    "path": "Realm/RLMAccessor.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMAccessor.hpp\"\n\n#import \"RLMArray_Private.hpp\"\n#import \"RLMDictionary_Private.hpp\"\n#import \"RLMObjectId_Private.hpp\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMObjectStore.h\"\n#import \"RLMObject_Private.hpp\"\n#import \"RLMObservation.hpp\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMResults_Private.hpp\"\n#import \"RLMSchema_Private.h\"\n#import \"RLMSet_Private.hpp\"\n#import \"RLMSwiftProperty.h\"\n#import \"RLMUUID_Private.hpp\"\n#import \"RLMUtil.hpp\"\n#import \"RLMValue.h\"\n\n#import <realm/object-store/object.hpp>\n#import <realm/object-store/property.hpp>\n#import <realm/object-store/results.hpp>\n\n#import <objc/runtime.h>\n#import <objc/message.h>\n\n#pragma mark Helper functions\n\nusing realm::ColKey;\n\nnamespace realm {\ntemplate<>\nObj Obj::get<Obj>(ColKey col) const {\n    ObjKey key = get<ObjKey>(col);\n    return key ? get_target_table(col)->get_object(key) : Obj();\n}\n\n} // namespace realm\n\nnamespace {\nrealm::Property const& getProperty(__unsafe_unretained RLMObjectBase *const obj, NSUInteger index) {\n    return obj->_info->objectSchema->persisted_properties[index];\n}\n\nrealm::Property const& getProperty(__unsafe_unretained RLMObjectBase *const obj,\n                                   __unsafe_unretained RLMProperty *const prop) {\n    if (prop.linkOriginPropertyName) {\n        return obj->_info->objectSchema->computed_properties[prop.index];\n    }\n    return obj->_info->objectSchema->persisted_properties[prop.index];\n}\n\ntemplate<typename T>\nbool isNull(T const& v) {\n    return !v;\n}\ntemplate<>\nbool isNull(realm::Timestamp const& v) {\n    return v.is_null();\n}\ntemplate<>\nbool isNull(realm::ObjectId const&) {\n    return false;\n}\ntemplate<>\nbool isNull(realm::Decimal128 const& v) {\n    return v.is_null();\n}\ntemplate<>\nbool isNull(realm::Mixed const& v) {\n    return v.is_null();\n}\ntemplate<>\nbool isNull(realm::UUID const&) {\n    return false;\n}\n\ntemplate<typename T>\nT get(__unsafe_unretained RLMObjectBase *const obj, NSUInteger index) {\n    RLMVerifyAttached(obj);\n    return obj->_row.get<T>(getProperty(obj, index).column_key);\n}\n\ntemplate<typename T>\nid getBoxed(__unsafe_unretained RLMObjectBase *const obj, NSUInteger index) {\n    RLMVerifyAttached(obj);\n    auto& prop = getProperty(obj, index);\n    RLMAccessorContext ctx(obj, &prop);\n    auto value = obj->_row.get<T>(prop.column_key);\n    return isNull(value) ? nil : ctx.box(std::move(value));\n}\n\ntemplate<typename T>\nT getOptional(__unsafe_unretained RLMObjectBase *const obj, uint16_t key, bool *gotValue) {\n    auto ret = get<std::optional<T>>(obj, key);\n    if (ret) {\n        *gotValue = true;\n    }\n    return ret.value_or(T{});\n}\n\ntemplate<typename T>\nvoid setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key, T val) {\n    obj->_row.set(key, val);\n}\n\ntemplate<typename T>\nvoid setValueOrNull(__unsafe_unretained RLMObjectBase *const obj, ColKey col,\n                    __unsafe_unretained id const value) {\n    RLMVerifyInWriteTransaction(obj);\n\n    RLMTranslateError([&] {\n        if (value) {\n            RLMStatelessAccessorContext ctx;\n            obj->_row.set(col, ctx.unbox<T>(value));\n        }\n        else {\n            obj->_row.set_null(col);\n        }\n    });\n}\n\nvoid setValue(__unsafe_unretained RLMObjectBase *const obj,\n              ColKey key, __unsafe_unretained NSDate *const date) {\n    setValueOrNull<realm::Timestamp>(obj, key, date);\n}\n\nvoid setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key,\n              __unsafe_unretained NSData *const value) {\n    setValueOrNull<realm::BinaryData>(obj, key, value);\n}\n\nvoid setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key,\n              __unsafe_unretained NSString *const value) {\n    setValueOrNull<realm::StringData>(obj, key, value);\n}\n\nvoid setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key,\n              __unsafe_unretained RLMObjectBase *const val) {\n    if (!val) {\n        obj->_row.set(key, realm::null());\n        return;\n    }\n\n    if (!val->_row) {\n        RLMAccessorContext{obj, key}.createObject(val, {.create = true}, false, {});\n    }\n\n    // make sure it is the correct type\n    auto table = val->_row.get_table();\n    if (table != obj->_row.get_table()->get_link_target(key)) {\n        @throw RLMException(@\"Can't set object of type '%@' to property of type '%@'\",\n                            val->_objectSchema.className,\n                            obj->_info->propertyForTableColumn(key).objectClassName);\n    }\n    if (!table->is_embedded()) {\n        obj->_row.set(key, val->_row.get_key());\n    }\n    else if (obj->_row.get_linked_object(key).get_key() != val->_row.get_key()) {\n        @throw RLMException(@\"Can't set link to existing managed embedded object\");\n    }\n}\n\nid RLMCollectionClassForProperty(RLMProperty *prop, bool isManaged) {\n    Class cls = nil;\n    if (prop.array) {\n        cls = isManaged ? [RLMManagedArray class] : [RLMArray class];\n    } else if (prop.set) {\n        cls = isManaged ? [RLMManagedSet class] : [RLMSet class];\n    } else if (prop.dictionary) {\n        cls = isManaged ? [RLMManagedDictionary class] : [RLMDictionary class];\n    } else {\n        @throw RLMException(@\"Invalid collection '%@' for class '%@'.\",\n                            prop.name, prop.objectClassName);\n    }\n    return cls;\n}\n\n// collection getter/setter\nid<RLMCollection> getCollection(__unsafe_unretained RLMObjectBase *const obj, NSUInteger propIndex) {\n    RLMVerifyAttached(obj);\n    auto prop = obj->_info->rlmObjectSchema.properties[propIndex];\n    Class cls = RLMCollectionClassForProperty(prop, true);\n    return [[cls alloc] initWithParent:obj property:prop];\n}\n\ntemplate <typename Collection>\nvoid assignValue(__unsafe_unretained RLMObjectBase *const obj,\n                 __unsafe_unretained RLMProperty *const prop,\n                 ColKey key,\n                 __unsafe_unretained id<NSFastEnumeration> const value) {\n    auto info = obj->_info;\n    Collection collection(obj->_realm->_realm, obj->_row, key);\n    if (collection.get_type() == realm::PropertyType::Object) {\n        info = &obj->_info->linkTargetType(prop.index);\n    }\n    RLMAccessorContext ctx(*info);\n    RLMTranslateError([&] {\n        collection.assign(ctx, value, realm::CreatePolicy::ForceCreate);\n    });\n}\n\nvoid setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key,\n              __unsafe_unretained id<NSFastEnumeration> const value) {\n    auto prop = obj->_info->propertyForTableColumn(key);\n    RLMValidateValueForProperty(value, obj->_info->rlmObjectSchema, prop, true);\n\n    if (prop.array) {\n        assignValue<realm::List>(obj, prop, key, value);\n    }\n    else if (prop.set) {\n        assignValue<realm::object_store::Set>(obj, prop, key, value);\n    }\n    else if (prop.dictionary) {\n        assignValue<realm::object_store::Dictionary>(obj, prop, key, value);\n    }\n}\n\nvoid setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key,\n              __unsafe_unretained NSNumber<RLMInt> *const intObject) {\n    setValueOrNull<int64_t>(obj, key, intObject);\n}\n\nvoid setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key,\n              __unsafe_unretained NSNumber<RLMFloat> *const floatObject) {\n    setValueOrNull<float>(obj, key, floatObject);\n}\n\nvoid setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key,\n              __unsafe_unretained NSNumber<RLMDouble> *const doubleObject) {\n    setValueOrNull<double>(obj, key, doubleObject);\n}\n\nvoid setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key,\n              __unsafe_unretained NSNumber<RLMBool> *const boolObject) {\n    setValueOrNull<bool>(obj, key, boolObject);\n}\n\nvoid setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key,\n              __unsafe_unretained RLMDecimal128 *const value) {\n    setValueOrNull<realm::Decimal128>(obj, key, value);\n}\n\nvoid setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key,\n              __unsafe_unretained RLMObjectId *const value) {\n    setValueOrNull<realm::ObjectId>(obj, key, value);\n}\n\nvoid setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key,\n              __unsafe_unretained NSUUID *const value) {\n    setValueOrNull<realm::UUID>(obj, key, value);\n}\n\nvoid setValue(__unsafe_unretained RLMObjectBase *const obj, __unsafe_unretained RLMProperty *const property, __unsafe_unretained id<RLMValue> const value) {\n    realm::Object o(obj->_realm->_realm, *obj->_info->objectSchema, obj->_row);\n    RLMAccessorContext ctx(obj);\n    o.set_property_value(ctx, getProperty(obj, property), value ?: NSNull.null);\n}\n\nRLMLinkingObjects *getLinkingObjects(__unsafe_unretained RLMObjectBase *const obj,\n                                     __unsafe_unretained RLMProperty *const property) {\n    RLMVerifyAttached(obj);\n    auto& objectInfo = obj->_realm->_info[property.objectClassName];\n    auto& linkOrigin = obj->_info->objectSchema->computed_properties[property.index].link_origin_property_name;\n    auto linkingProperty = objectInfo.objectSchema->property_for_name(linkOrigin);\n    auto backlinkView = obj->_row.get_backlink_view(objectInfo.table(), linkingProperty->column_key);\n    realm::Results results(obj->_realm->_realm, std::move(backlinkView));\n    return [RLMLinkingObjects resultsWithObjectInfo:objectInfo results:std::move(results)];\n}\n\n// any getter/setter\ntemplate<typename Type, typename StorageType=Type>\nid makeGetter(NSUInteger index) {\n    return ^(__unsafe_unretained RLMObjectBase *const obj) {\n        return static_cast<Type>(get<StorageType>(obj, index));\n    };\n}\n\ntemplate<typename Type>\nid makeBoxedGetter(NSUInteger index) {\n    return ^(__unsafe_unretained RLMObjectBase *const obj) {\n        return getBoxed<Type>(obj, index);\n    };\n}\ntemplate<typename Type>\nid makeOptionalGetter(NSUInteger index) {\n    return ^(__unsafe_unretained RLMObjectBase *const obj) {\n        return getBoxed<std::optional<Type>>(obj, index);\n    };\n}\ntemplate<typename Type>\nid makeNumberGetter(NSUInteger index, bool boxed, bool optional) {\n    if (optional) {\n        return makeOptionalGetter<Type>(index);\n    }\n    if (boxed) {\n        return makeBoxedGetter<Type>(index);\n    }\n    return makeGetter<Type>(index);\n}\ntemplate<typename Type>\nid makeWrapperGetter(NSUInteger index, bool optional) {\n    if (optional) {\n        return makeOptionalGetter<Type>(index);\n    }\n    return makeBoxedGetter<Type>(index);\n}\n\n// dynamic getter with column closure\nid managedGetter(RLMProperty *prop, const char *type) {\n    NSUInteger index = prop.index;\n    if (prop.collection && prop.type != RLMPropertyTypeLinkingObjects) {\n        return ^id(__unsafe_unretained RLMObjectBase *const obj) {\n            return getCollection(obj, index);\n        };\n    }\n\n    bool boxed = *type == '@';\n    switch (prop.type) {\n        case RLMPropertyTypeInt:\n            if (prop.optional || boxed) {\n                return makeNumberGetter<long long>(index, boxed, prop.optional);\n            }\n            switch (*type) {\n                case 'c': return makeGetter<char, int64_t>(index);\n                case 's': return makeGetter<short, int64_t>(index);\n                case 'i': return makeGetter<int, int64_t>(index);\n                case 'l': return makeGetter<long, int64_t>(index);\n                case 'q': return makeGetter<long long, int64_t>(index);\n                default:\n                    @throw RLMException(@\"Unexpected property type for Objective-C type code\");\n            }\n        case RLMPropertyTypeFloat:\n            return makeNumberGetter<float>(index, boxed, prop.optional);\n        case RLMPropertyTypeDouble:\n            return makeNumberGetter<double>(index, boxed, prop.optional);\n        case RLMPropertyTypeBool:\n            return makeNumberGetter<bool>(index, boxed, prop.optional);\n        case RLMPropertyTypeString:\n            return makeBoxedGetter<realm::StringData>(index);\n        case RLMPropertyTypeDate:\n            return makeBoxedGetter<realm::Timestamp>(index);\n        case RLMPropertyTypeData:\n            return makeBoxedGetter<realm::BinaryData>(index);\n        case RLMPropertyTypeObject:\n            return makeBoxedGetter<realm::Obj>(index);\n        case RLMPropertyTypeDecimal128:\n            return makeBoxedGetter<realm::Decimal128>(index);\n        case RLMPropertyTypeObjectId:\n            return makeWrapperGetter<realm::ObjectId>(index, prop.optional);\n        case RLMPropertyTypeAny:\n            // Mixed is represented as optional in Core,\n            // but not in Cocoa. We use `makeBoxedGetter` over\n            // `makeWrapperGetter` becuase Mixed can box a `null` representation.\n            return makeBoxedGetter<realm::Mixed>(index);\n        case RLMPropertyTypeLinkingObjects:\n            return ^(__unsafe_unretained RLMObjectBase *const obj) {\n                return getLinkingObjects(obj, prop);\n            };\n        case RLMPropertyTypeUUID:\n            return makeWrapperGetter<realm::UUID>(index, prop.optional);\n    }\n}\n\nstatic realm::ColKey willChange(RLMObservationTracker& tracker,\n                                __unsafe_unretained RLMObjectBase *const obj, NSUInteger index) {\n    auto& prop = getProperty(obj, index);\n    if (prop.is_primary) {\n        @throw RLMException(@\"Primary key can't be changed after an object is inserted.\");\n    }\n    tracker.willChange(RLMGetObservationInfo(obj->_observationInfo, obj->_row.get_key(), *obj->_info),\n                       obj->_objectSchema.properties[index].name);\n    return prop.column_key;\n}\n\ntemplate<typename ArgType, typename StorageType=ArgType>\nvoid kvoSetValue(__unsafe_unretained RLMObjectBase *const obj, NSUInteger index, ArgType value) {\n    RLMVerifyInWriteTransaction(obj);\n    RLMObservationTracker tracker(obj->_realm);\n    auto key = willChange(tracker, obj, index);\n    if constexpr (std::is_same_v<ArgType, RLMObjectBase *>) {\n        tracker.trackDeletions();\n    }\n    setValue(obj, key, static_cast<StorageType>(value));\n}\n\ntemplate<>\nvoid kvoSetValue<id<RLMValue>>(__unsafe_unretained RLMObjectBase *const obj, NSUInteger index, id<RLMValue> value) {\n    RLMVerifyInWriteTransaction(obj);\n    auto& prop = getProperty(obj, index);\n    setValue(obj, obj->_info->propertyForTableColumn(prop.column_key), static_cast<id<RLMValue>>(value));\n}\n\ntemplate<typename ArgType, typename StorageType=ArgType>\nid makeSetter(__unsafe_unretained RLMProperty *const prop) {\n    if (prop.isPrimary) {\n        return ^(__unused RLMObjectBase *obj, __unused ArgType val) {\n            @throw RLMException(@\"Primary key can't be changed after an object is inserted.\");\n        };\n    }\n\n    NSUInteger index = prop.index;\n    return ^(__unsafe_unretained RLMObjectBase *const obj, ArgType val) {\n        kvoSetValue<ArgType, StorageType>(obj, index, val);\n    };\n}\n\n// dynamic setter with column closure\nid managedSetter(RLMProperty *prop, const char *type) {\n    if (prop.collection && prop.type != RLMPropertyTypeLinkingObjects) {\n        return makeSetter<id<NSFastEnumeration>>(prop);\n    }\n\n    bool boxed = prop.optional || *type == '@';\n    switch (prop.type) {\n        case RLMPropertyTypeInt:\n            if (boxed) {\n                return makeSetter<NSNumber<RLMInt> *>(prop);\n            }\n            switch (*type) {\n                case 'c': return makeSetter<char, long long>(prop);\n                case 's': return makeSetter<short, long long>(prop);\n                case 'i': return makeSetter<int, long long>(prop);\n                case 'l': return makeSetter<long, long long>(prop);\n                case 'q': return makeSetter<long long>(prop);\n                default:\n                    @throw RLMException(@\"Unexpected property type for Objective-C type code\");\n            }\n        case RLMPropertyTypeFloat:\n            return boxed ? makeSetter<NSNumber<RLMFloat> *>(prop) : makeSetter<float>(prop);\n        case RLMPropertyTypeDouble:\n            return boxed ? makeSetter<NSNumber<RLMDouble> *>(prop) : makeSetter<double>(prop);\n        case RLMPropertyTypeBool:\n            return boxed ? makeSetter<NSNumber<RLMBool> *>(prop) : makeSetter<BOOL, bool>(prop);\n        case RLMPropertyTypeString:         return makeSetter<NSString *>(prop);\n        case RLMPropertyTypeDate:           return makeSetter<NSDate *>(prop);\n        case RLMPropertyTypeData:           return makeSetter<NSData *>(prop);\n        case RLMPropertyTypeAny:            return makeSetter<id<RLMValue>>(prop);\n        case RLMPropertyTypeLinkingObjects: return nil;\n        case RLMPropertyTypeObject:         return makeSetter<RLMObjectBase *>(prop);\n        case RLMPropertyTypeObjectId:       return makeSetter<RLMObjectId *>(prop);\n        case RLMPropertyTypeDecimal128:     return makeSetter<RLMDecimal128 *>(prop);\n        case RLMPropertyTypeUUID:           return makeSetter<NSUUID *>(prop);\n    }\n}\n\n// call getter for superclass for property at key\nid superGet(RLMObjectBase *obj, NSString *propName) {\n    typedef id (*getter_type)(RLMObjectBase *, SEL);\n    RLMProperty *prop = obj->_objectSchema[propName];\n    Class superClass = class_getSuperclass(obj.class);\n    getter_type superGetter = (getter_type)[superClass instanceMethodForSelector:prop.getterSel];\n    return superGetter(obj, prop.getterSel);\n}\n\n// call setter for superclass for property at key\nvoid superSet(RLMObjectBase *obj, NSString *propName, id val) {\n    typedef void (*setter_type)(RLMObjectBase *, SEL, id<RLMCollection> collection);\n    RLMProperty *prop = obj->_objectSchema[propName];\n    Class superClass = class_getSuperclass(obj.class);\n    setter_type superSetter = (setter_type)[superClass instanceMethodForSelector:prop.setterSel];\n    superSetter(obj, prop.setterSel, val);\n}\n\n// getter/setter for unmanaged object\nid unmanagedGetter(RLMProperty *prop, const char *) {\n    // only override getters for RLMCollection and linking objects properties\n    if (prop.type == RLMPropertyTypeLinkingObjects) {\n        return ^(RLMObjectBase *) { return [RLMResults emptyDetachedResults]; };\n    }\n    if (prop.collection) {\n        NSString *propName = prop.name;\n        Class cls = RLMCollectionClassForProperty(prop, false);\n        if (prop.type == RLMPropertyTypeObject) {\n            NSString *objectClassName = prop.objectClassName;\n            RLMPropertyType keyType = prop.dictionaryKeyType;\n            return ^(RLMObjectBase *obj) {\n                id val = superGet(obj, propName);\n                if (!val) {\n                    val = [[cls alloc] initWithObjectClassName:objectClassName keyType:keyType];\n                    superSet(obj, propName, val);\n                }\n                return val;\n            };\n        }\n        auto type = prop.type;\n        auto optional = prop.optional;\n        auto dictionaryKeyType = prop.dictionaryKeyType;\n        return ^(RLMObjectBase *obj) {\n            id val = superGet(obj, propName);\n            if (!val) {\n                val = [[cls alloc] initWithObjectType:type optional:optional keyType:dictionaryKeyType];\n                superSet(obj, propName, val);\n            }\n            return val;\n        };\n    }\n    return nil;\n}\n\nid unmanagedSetter(RLMProperty *prop, const char *) {\n    // Only RLMCollection types need special handling for the unmanaged setter\n    if (!prop.collection) {\n        return nil;\n    }\n\n    NSString *propName = prop.name;\n    return ^(RLMObjectBase *obj, id<NSFastEnumeration> values) {\n        auto prop = obj->_objectSchema[propName];\n        RLMValidateValueForProperty(values, obj->_objectSchema, prop, true);\n\n        Class cls = RLMCollectionClassForProperty(prop, false);\n        id collection;\n            // make copy when setting (as is the case for all other variants)\n        if (prop.type == RLMPropertyTypeObject) {\n            collection = [[cls alloc] initWithObjectClassName:prop.objectClassName keyType:prop.dictionaryKeyType];\n        }\n        else {\n            collection = [[cls alloc] initWithObjectType:prop.type optional:prop.optional keyType:prop.dictionaryKeyType];\n        }\n\n        if (prop.dictionary)\n            [collection addEntriesFromDictionary:(id)values];\n        else\n            [collection addObjects:values];\n        superSet(obj, propName, collection);\n    };\n}\n\nvoid addMethod(Class cls, __unsafe_unretained RLMProperty *const prop,\n               id (*getter)(RLMProperty *, const char *),\n               id (*setter)(RLMProperty *, const char *)) {\n    SEL sel = prop.getterSel;\n    if (!sel) {\n        return;\n    }\n    auto getterMethod = class_getInstanceMethod(cls, sel);\n    if (!getterMethod) {\n        return;\n    }\n\n    const char *getterType = method_getTypeEncoding(getterMethod);\n    if (id block = getter(prop, getterType)) {\n        class_addMethod(cls, sel, imp_implementationWithBlock(block), getterType);\n    }\n\n    if (!(sel = prop.setterSel)) {\n        return;\n    }\n    auto setterMethod = class_getInstanceMethod(cls, sel);\n    if (!setterMethod) {\n        return;\n    }\n    if (id block = setter(prop, getterType)) { // note: deliberately getterType as it's easier to grab the relevant type from\n        class_addMethod(cls, sel, imp_implementationWithBlock(block), method_getTypeEncoding(setterMethod));\n    }\n}\n\nClass createAccessorClass(Class objectClass,\n                          RLMObjectSchema *schema,\n                          const char *accessorClassName,\n                          id (*getterGetter)(RLMProperty *, const char *),\n                          id (*setterGetter)(RLMProperty *, const char *)) {\n    REALM_ASSERT_DEBUG(RLMIsObjectOrSubclass(objectClass));\n\n    // create and register proxy class which derives from object class\n    Class accClass = objc_allocateClassPair(objectClass, accessorClassName, 0);\n    if (!accClass) {\n        // Class with that name already exists, so just return the pre-existing one\n        // This should only happen for our standalone \"accessors\"\n        return objc_lookUpClass(accessorClassName);\n    }\n\n    // override getters/setters for each propery\n    for (RLMProperty *prop in schema.properties) {\n        addMethod(accClass, prop, getterGetter, setterGetter);\n    }\n    for (RLMProperty *prop in schema.computedProperties) {\n        addMethod(accClass, prop, getterGetter, setterGetter);\n    }\n\n    objc_registerClassPair(accClass);\n\n    return accClass;\n}\n\nbool requiresUnmanagedAccessor(RLMObjectSchema *schema) {\n    for (RLMProperty *prop in schema.properties) {\n        if (prop.collection && !prop.swiftIvar) {\n            return true;\n        }\n    }\n    for (RLMProperty *prop in schema.computedProperties) {\n        if (prop.collection && !prop.swiftIvar) {\n            return true;\n        }\n    }\n    return false;\n}\n} // anonymous namespace\n\n#pragma mark - Public Interface\n\nClass RLMManagedAccessorClassForObjectClass(Class objectClass, RLMObjectSchema *schema, const char *name) {\n    return createAccessorClass(objectClass, schema, name, managedGetter, managedSetter);\n}\n\nClass RLMUnmanagedAccessorClassForObjectClass(Class objectClass, RLMObjectSchema *schema) {\n    if (!requiresUnmanagedAccessor(schema)) {\n        return objectClass;\n    }\n    return createAccessorClass(objectClass, schema,\n                               [@\"RLM:Unmanaged \" stringByAppendingString:schema.className].UTF8String,\n                               unmanagedGetter, unmanagedSetter);\n}\n\n// implement the class method className on accessors to return the className of the\n// base object\nvoid RLMReplaceClassNameMethod(Class accessorClass, NSString *className) {\n    Class metaClass = object_getClass(accessorClass);\n    IMP imp = imp_implementationWithBlock(^(Class) { return className; });\n    class_addMethod(metaClass, @selector(className), imp, \"@@:\");\n}\n\n// implement the shared schema method\nvoid RLMReplaceSharedSchemaMethod(Class accessorClass, RLMObjectSchema *schema) {\n    REALM_ASSERT(accessorClass != [RealmSwiftObject class]);\n    Class metaClass = object_getClass(accessorClass);\n    IMP imp = imp_implementationWithBlock(^(Class cls) {\n        if (cls == accessorClass) {\n            return schema;\n        }\n\n        // If we aren't being called directly on the class this was overridden\n        // for, the class is either a subclass which we haven't initialized yet,\n        // or it's a runtime-generated class which should use the parent's\n        // schema. We check for the latter by checking if the immediate\n        // descendent of the desired class is a class generated by us (there\n        // may be further subclasses not generated by us for things like KVO).\n        Class parent = class_getSuperclass(cls);\n        while (parent != accessorClass) {\n            cls = parent;\n            parent = class_getSuperclass(cls);\n        }\n\n        static const char accessorClassPrefix[] = \"RLM:\";\n        if (!strncmp(class_getName(cls), accessorClassPrefix, sizeof(accessorClassPrefix) - 1)) {\n            return schema;\n        }\n\n        return [RLMSchema sharedSchemaForClass:cls];\n    });\n    class_addMethod(metaClass, @selector(sharedSchema), imp, \"@@:\");\n}\n\nvoid RLMDynamicValidatedSet(RLMObjectBase *obj, NSString *propName, id val) {\n    RLMVerifyAttached(obj);\n    RLMObjectSchema *schema = obj->_objectSchema;\n    RLMProperty *prop = schema[propName];\n    if (!prop) {\n        @throw RLMException(@\"Invalid property name '%@' for class '%@'.\",\n                            propName, obj->_objectSchema.className);\n    }\n    if (prop.isPrimary) {\n        @throw RLMException(@\"Primary key can't be changed to '%@' after an object is inserted.\", val);\n    }\n\n    // Because embedded objects cannot be created directly, we accept anything\n    // that can be converted to an embedded object for dynamic link set operations.\n    bool is_embedded = prop.type == RLMPropertyTypeObject && obj->_info->linkTargetType(prop.index).rlmObjectSchema.isEmbedded;\n    RLMValidateValueForProperty(val, schema, prop, !is_embedded);\n    RLMDynamicSet(obj, prop, RLMCoerceToNil(val));\n}\n\n// Precondition: the property is not a primary key\nvoid RLMDynamicSet(__unsafe_unretained RLMObjectBase *const obj,\n                   __unsafe_unretained RLMProperty *const prop,\n                   __unsafe_unretained id const val) {\n    REALM_ASSERT_DEBUG(!prop.isPrimary);\n    realm::Object o(obj->_info->realm->_realm, *obj->_info->objectSchema, obj->_row);\n    RLMAccessorContext c(obj);\n    RLMTranslateError([&] {\n        o.set_property_value(c, getProperty(obj, prop).name, val ?: NSNull.null);\n    });\n}\n\nid RLMDynamicGet(__unsafe_unretained RLMObjectBase *const obj, __unsafe_unretained RLMProperty *const prop) {\n    if (auto accessor = prop.swiftAccessor; accessor && [obj isKindOfClass:obj->_objectSchema.objectClass]) {\n        return RLMCoerceToNil([accessor get:prop on:obj]);\n    }\n    if (!obj->_realm) {\n        return [obj valueForKey:prop.name];\n    }\n\n    realm::Object o(obj->_realm->_realm, *obj->_info->objectSchema, obj->_row);\n    RLMAccessorContext c(obj);\n    c.currentProperty = prop;\n    return RLMTranslateError([&] {\n        return RLMCoerceToNil(o.get_property_value<id>(c, getProperty(obj, prop)));\n    });\n}\n\nid RLMDynamicGetByName(__unsafe_unretained RLMObjectBase *const obj,\n                       __unsafe_unretained NSString *const propName) {\n    RLMProperty *prop = obj->_objectSchema[propName];\n    if (!prop) {\n        @throw RLMException(@\"Invalid property name '%@' for class '%@'.\",\n                            propName, obj->_objectSchema.className);\n    }\n    return RLMDynamicGet(obj, prop);\n}\n\n#pragma mark - Swift property getters and setter\n\n#define REALM_SWIFT_PROPERTY_ACCESSOR(objc, swift, rlmtype) \\\n    objc RLMGetSwiftProperty##swift(__unsafe_unretained RLMObjectBase *const obj, uint16_t key) { \\\n        return get<objc>(obj, key); \\\n    } \\\n    objc RLMGetSwiftProperty##swift##Optional(__unsafe_unretained RLMObjectBase *const obj, uint16_t key, bool *gotValue) { \\\n        return getOptional<objc>(obj, key, gotValue); \\\n    } \\\n    void RLMSetSwiftProperty##swift(__unsafe_unretained RLMObjectBase *const obj, uint16_t key, objc value) { \\\n        RLMVerifyAttached(obj); \\\n        kvoSetValue(obj, key, value); \\\n    }\nREALM_FOR_EACH_SWIFT_PRIMITIVE_TYPE(REALM_SWIFT_PROPERTY_ACCESSOR)\n#undef REALM_SWIFT_PROPERTY_ACCESSOR\n\n#define REALM_SWIFT_PROPERTY_ACCESSOR(objc, swift, rlmtype) \\\n    void RLMSetSwiftProperty##swift(__unsafe_unretained RLMObjectBase *const obj, uint16_t key, objc *value) { \\\n        RLMVerifyAttached(obj); \\\n        kvoSetValue(obj, key, value); \\\n    }\nREALM_FOR_EACH_SWIFT_OBJECT_TYPE(REALM_SWIFT_PROPERTY_ACCESSOR)\n#undef REALM_SWIFT_PROPERTY_ACCESSOR\n\nNSString *RLMGetSwiftPropertyString(__unsafe_unretained RLMObjectBase *const obj, uint16_t key) {\n    return getBoxed<realm::StringData>(obj, key);\n}\n\nNSData *RLMGetSwiftPropertyData(__unsafe_unretained RLMObjectBase *const obj, uint16_t key) {\n    return getBoxed<realm::BinaryData>(obj, key);\n}\n\nNSDate *RLMGetSwiftPropertyDate(__unsafe_unretained RLMObjectBase *const obj, uint16_t key) {\n    return getBoxed<realm::Timestamp>(obj, key);\n}\n\nNSUUID *RLMGetSwiftPropertyUUID(__unsafe_unretained RLMObjectBase *const obj, uint16_t key) {\n    return getBoxed<std::optional<realm::UUID>>(obj, key);\n}\n\nRLMObjectId *RLMGetSwiftPropertyObjectId(__unsafe_unretained RLMObjectBase *const obj, uint16_t key) {\n    return getBoxed<std::optional<realm::ObjectId>>(obj, key);\n}\n\nRLMDecimal128 *RLMGetSwiftPropertyDecimal128(__unsafe_unretained RLMObjectBase *const obj, uint16_t key) {\n    return getBoxed<realm::Decimal128>(obj, key);\n}\n\nRLMArray *RLMGetSwiftPropertyArray(__unsafe_unretained RLMObjectBase *const obj, uint16_t key) {\n    return (RLMArray *)getCollection(obj, key);\n}\nRLMSet *RLMGetSwiftPropertySet(__unsafe_unretained RLMObjectBase *const obj, uint16_t key) {\n    return getCollection(obj, key);\n}\nRLMDictionary *RLMGetSwiftPropertyMap(__unsafe_unretained RLMObjectBase *const obj, uint16_t key) {\n    return (RLMDictionary *)getCollection(obj, key);\n}\n\nvoid RLMSetSwiftPropertyNil(__unsafe_unretained RLMObjectBase *const obj, uint16_t key) {\n    RLMVerifyInWriteTransaction(obj);\n    if (getProperty(obj, key).type == realm::PropertyType::Object) {\n        kvoSetValue(obj, key, (RLMObjectBase *)nil);\n    }\n    else {\n        // The type used here is arbitrary; it simply needs to be any non-object type\n        kvoSetValue(obj, key, (NSNumber<RLMInt> *)nil);\n    }\n}\n\nvoid RLMSetSwiftPropertyObject(__unsafe_unretained RLMObjectBase *const obj, uint16_t key,\n                               __unsafe_unretained RLMObjectBase *const target) {\n    kvoSetValue(obj, key, target);\n}\n\nRLMObjectBase *RLMGetSwiftPropertyObject(__unsafe_unretained RLMObjectBase *const obj, uint16_t key) {\n    return getBoxed<realm::Obj>(obj, key);\n}\n\nvoid RLMSetSwiftPropertyAny(__unsafe_unretained RLMObjectBase *const obj, uint16_t key,\n                            __unsafe_unretained id<RLMValue> const value) {\n    kvoSetValue(obj, key, value);\n}\n\nid<RLMValue> RLMGetSwiftPropertyAny(__unsafe_unretained RLMObjectBase *const obj, uint16_t key) {\n    return getBoxed<realm::Mixed>(obj, key);\n}\n\n#pragma mark - RLMAccessorContext\n\nRLMAccessorContext::~RLMAccessorContext() = default;\n\nRLMAccessorContext::RLMAccessorContext(RLMAccessorContext& parent, realm::Obj const& obj,\n                                       realm::Property const& property)\n: _realm(parent._realm)\n, _info(property.type == realm::PropertyType::Object ? parent._info.linkTargetType(property) : parent._info)\n, _parentObject(obj)\n, _parentObjectInfo(&parent._info)\n, _colKey(property.column_key)\n {\n }\n\nRLMAccessorContext::RLMAccessorContext(__unsafe_unretained RLMObjectBase *const parent,\n                                       const realm::Property *prop)\n: _realm(parent->_realm)\n, _info(prop && prop->type == realm::PropertyType::Object ? parent->_info->linkTargetType(*prop)\n                                                          : *parent->_info)\n, _parentObject(parent->_row)\n, _parentObjectInfo(parent->_info)\n, _colKey(prop ? prop->column_key : ColKey{})\n{\n}\n\nRLMAccessorContext::RLMAccessorContext(__unsafe_unretained RLMObjectBase *const parent,\n                                       realm::ColKey col)\n: _realm(parent->_realm)\n, _info(_realm->_info[parent->_info->propertyForTableColumn(col).objectClassName])\n, _parentObject(parent->_row)\n, _parentObjectInfo(parent->_info)\n, _colKey(col)\n{\n}\n\nRLMAccessorContext::RLMAccessorContext(RLMClassInfo& info)\n: _realm(info.realm), _info(info)\n{\n}\n\nRLMAccessorContext::RLMAccessorContext(RLMClassInfo& parentInfo, RLMClassInfo& info,\n                                       __unsafe_unretained RLMProperty *const property)\n: _realm(info.realm)\n, _info(info)\n, _parentObjectInfo(&parentInfo)\n, currentProperty(property)\n{\n}\n\nid RLMAccessorContext::defaultValue(__unsafe_unretained NSString *const key) {\n    if (!_defaultValues) {\n        _defaultValues = RLMDefaultValuesForObjectSchema(_info.rlmObjectSchema);\n    }\n    return _defaultValues[key];\n}\n\nid RLMAccessorContext::propertyValue(id obj, size_t propIndex,\n                                     __unsafe_unretained RLMProperty *const prop) {\n    obj = RLMBridgeSwiftValue(obj) ?: obj;\n\n    // Property value from an NSArray\n    if ([obj respondsToSelector:@selector(objectAtIndex:)]) {\n        return propIndex < [obj count] ? [obj objectAtIndex:propIndex] : nil;\n    }\n\n    // Property value from an NSDictionary\n    if ([obj respondsToSelector:@selector(objectForKey:)]) {\n        return [obj objectForKey:prop.name];\n    }\n\n    // Property value from an instance of this object type\n    if ([obj isKindOfClass:_info.rlmObjectSchema.objectClass] && prop.swiftAccessor) {\n        return [prop.swiftAccessor get:prop on:obj];\n    }\n\n    // Property value from some object that's KVC-compatible\n    id value = RLMValidatedValueForProperty(obj, [obj respondsToSelector:prop.getterSel] ? prop.getterName : prop.name,\n                                            _info.rlmObjectSchema.className);\n    return value ?: NSNull.null;\n}\n\nrealm::Obj RLMAccessorContext::create_embedded_object() {\n    if (!_parentObject) {\n        @throw RLMException(@\"Embedded objects cannot be created directly\");\n    }\n    return _parentObject.create_and_set_linked_object(_colKey);\n}\n\nid RLMAccessorContext::box(realm::Mixed v) {\n    auto property = currentProperty ?: _info.propertyForTableColumn(_colKey);\n    // Property and ParentObject are only passed for List and Dictionary boxing\n    return RLMMixedToObjc(v, _realm, &_info, property, _parentObject);\n}\n\nid RLMAccessorContext::box(realm::List&& l) {\n    REALM_ASSERT(_parentObjectInfo);\n    auto property = currentProperty ?: _info.propertyForTableColumn(_colKey);\n    REALM_ASSERT(property);\n    return [[RLMManagedArray alloc] initWithBackingCollection:std::move(l)\n                                                   parentInfo:_parentObjectInfo\n                                                     property:property];\n}\n\nid RLMAccessorContext::box(realm::object_store::Set&& s) {\n    REALM_ASSERT(_parentObjectInfo);\n    REALM_ASSERT(currentProperty);\n    return [[RLMManagedSet alloc] initWithBackingCollection:std::move(s)\n                                                 parentInfo:_parentObjectInfo\n                                                   property:currentProperty];\n}\n\nid RLMAccessorContext::box(realm::object_store::Dictionary&& d) {\n    REALM_ASSERT(_parentObjectInfo);\n    auto property = currentProperty ? currentProperty : _info.propertyForTableColumn(_colKey);\n    REALM_ASSERT(property);\n    return [[RLMManagedDictionary alloc] initWithBackingCollection:std::move(d)\n                                                        parentInfo:_parentObjectInfo\n                                                          property:property];\n}\n\nid RLMAccessorContext::box(realm::Object&& o) {\n    REALM_ASSERT(currentProperty);\n    return RLMCreateObjectAccessor(_info.linkTargetType(currentProperty.index), o.get_obj());\n}\n\nid RLMAccessorContext::box(realm::Obj&& r) {\n    if (!currentProperty) {\n        // If currentProperty is set, then we're reading from a Collection and\n        // that reported an audit read for us. If not, we need to report the\n        // audit read. This happens automatically when creating a\n        // `realm::Object`, but our object accessors don't wrap that type.\n        realm::Object(_realm->_realm, *_info.objectSchema, r, _parentObject, _colKey);\n    }\n    return RLMCreateObjectAccessor(_info, std::move(r));\n}\n\nid RLMAccessorContext::box(realm::Results&& r) {\n    REALM_ASSERT(currentProperty);\n    return [RLMResults resultsWithObjectInfo:_realm->_info[currentProperty.objectClassName]\n                                     results:std::move(r)];\n}\n\nusing realm::ObjKey;\nusing realm::CreatePolicy;\n\ntemplate<typename T>\nstatic T *bridged(__unsafe_unretained id const value) {\n    return [value isKindOfClass:[T class]] ? value : RLMBridgeSwiftValue(value);\n}\n\ntemplate<>\nrealm::Timestamp RLMStatelessAccessorContext::unbox(__unsafe_unretained id const value) {\n    id v = RLMCoerceToNil(value);\n    return RLMTimestampForNSDate(bridged<NSDate>(v));\n}\n\ntemplate<>\nbool RLMStatelessAccessorContext::unbox(__unsafe_unretained id const v) {\n    return [bridged<NSNumber>(v) boolValue];\n}\ntemplate<>\ndouble RLMStatelessAccessorContext::unbox(__unsafe_unretained id const v) {\n    return [bridged<NSNumber>(v) doubleValue];\n}\ntemplate<>\nfloat RLMStatelessAccessorContext::unbox(__unsafe_unretained id const v) {\n    return [bridged<NSNumber>(v) floatValue];\n}\ntemplate<>\nlong long RLMStatelessAccessorContext::unbox(__unsafe_unretained id const v) {\n    return [bridged<NSNumber>(v) longLongValue];\n}\ntemplate<>\nrealm::BinaryData RLMStatelessAccessorContext::unbox(id v) {\n    v = RLMCoerceToNil(v);\n    return RLMBinaryDataForNSData(bridged<NSData>(v));\n}\ntemplate<>\nrealm::StringData RLMStatelessAccessorContext::unbox(id v) {\n    v = RLMCoerceToNil(v);\n    return RLMStringDataWithNSString(bridged<NSString>(v));\n}\ntemplate<>\nrealm::Decimal128 RLMStatelessAccessorContext::unbox(id v) {\n    return RLMObjcToDecimal128(v);\n}\ntemplate<>\nrealm::ObjectId RLMStatelessAccessorContext::unbox(id v) {\n    return bridged<RLMObjectId>(v).value;\n}\ntemplate<>\nrealm::UUID RLMStatelessAccessorContext::unbox(id v) {\n    return RLMObjcToUUID(bridged<NSUUID>(v));\n}\ntemplate<>\nrealm::Mixed RLMAccessorContext::unbox(__unsafe_unretained id v, CreatePolicy p, ObjKey) {\n    return RLMObjcToMixed(v, _realm, p);\n}\n\ntemplate<typename T>\nstatic auto toOptional(__unsafe_unretained id const value) {\n    id v = RLMCoerceToNil(value);\n    return v ? realm::util::make_optional(RLMStatelessAccessorContext::unbox<T>(v))\n             : realm::util::none;\n}\n\ntemplate<>\nstd::optional<bool> RLMStatelessAccessorContext::unbox(__unsafe_unretained id const v) {\n    return toOptional<bool>(v);\n}\ntemplate<>\nstd::optional<double> RLMStatelessAccessorContext::unbox(__unsafe_unretained id const v) {\n    return toOptional<double>(v);\n}\ntemplate<>\nstd::optional<float> RLMStatelessAccessorContext::unbox(__unsafe_unretained id const v) {\n    return toOptional<float>(v);\n}\ntemplate<>\nstd::optional<int64_t> RLMStatelessAccessorContext::unbox(__unsafe_unretained id const v) {\n    return toOptional<int64_t>(v);\n}\ntemplate<>\nstd::optional<realm::ObjectId> RLMStatelessAccessorContext::unbox(__unsafe_unretained id const v) {\n    return toOptional<realm::ObjectId>(v);\n}\ntemplate<>\nstd::optional<realm::UUID> RLMStatelessAccessorContext::unbox(__unsafe_unretained id const v) {\n    return toOptional<realm::UUID>(v);\n}\n\nstd::pair<realm::Obj, bool>\nRLMAccessorContext::createObject(id value, realm::CreatePolicy policy,\n                                 bool forceCreate, ObjKey existingKey) {\n    if (!value || value == NSNull.null) {\n        @throw RLMException(@\"Must provide a non-nil value.\");\n    }\n\n    if ([value isKindOfClass:[NSArray class]] && [value count] > _info.objectSchema->persisted_properties.size()) {\n        @throw RLMException(@\"Invalid array input: more values (%llu) than properties (%llu).\",\n                            (unsigned long long)[value count],\n                            (unsigned long long)_info.objectSchema->persisted_properties.size());\n    }\n\n    RLMObjectBase *objBase = RLMDynamicCast<RLMObjectBase>(value);\n    realm::Obj obj, *outObj = nullptr;\n    bool requiresSwiftUIObservers = false;\n    if (objBase) {\n        if (objBase.isInvalidated) {\n            if (policy.create && !policy.copy) {\n                @throw RLMException(@\"Adding a deleted or invalidated object to a Realm is not permitted\");\n            }\n            else {\n                @throw RLMException(@\"Object has been deleted or invalidated.\");\n            }\n        }\n        if (policy.copy) {\n            if (policy.update || !forceCreate) {\n                // create(update: true) is a no-op when given an object already in\n                // the Realm which is of the correct type\n                if (objBase->_realm == _realm && objBase->_row.get_table() == _info.table() && !_info.table()->is_embedded()) {\n                    return {objBase->_row, true};\n                }\n            }\n            // Otherwise we copy the object\n            objBase = nil;\n        }\n        else {\n            outObj = &objBase->_row;\n            // add() on an object already managed by this Realm is a no-op\n            if (objBase->_realm == _realm) {\n                return {objBase->_row, true};\n            }\n            if (!policy.create) {\n                return {realm::Obj(), false};\n            }\n            if (objBase->_realm) {\n                @throw RLMException(@\"Object is already managed by another Realm. Use create instead to copy it into this Realm.\");\n            }\n            if (objBase->_observationInfo && objBase->_observationInfo->hasObservers()) {\n                requiresSwiftUIObservers = [RLMSwiftUIKVO removeObserversFromObject:objBase];\n                if (!requiresSwiftUIObservers) {\n                    @throw RLMException(@\"Cannot add an object with observers to a Realm\");\n                }\n            }\n\n            REALM_ASSERT([objBase->_objectSchema.className isEqualToString:_info.rlmObjectSchema.className]);\n            REALM_ASSERT([objBase isKindOfClass:_info.rlmObjectSchema.unmanagedClass]);\n\n            objBase->_info = &_info;\n            objBase->_realm = _realm;\n            objBase->_objectSchema = _info.rlmObjectSchema;\n        }\n    }\n    if (!policy.create) {\n        return {realm::Obj(), false};\n    }\n    if (!outObj) {\n        outObj = &obj;\n    }\n\n    try {\n        realm::Object::create(*this, _realm->_realm, *_info.objectSchema,\n                              (id)value, policy, existingKey, outObj);\n    }\n    catch (std::exception const& e) {\n        @throw RLMException(e);\n    }\n\n    if (objBase) {\n        for (RLMProperty *prop in _info.rlmObjectSchema.properties) {\n            // set the ivars for object and array properties to nil as otherwise the\n            // accessors retain objects that are no longer accessible via the properties\n            // this is mainly an issue when the object graph being added has cycles,\n            // as it's not obvious that the user has to set the *ivars* to nil to\n            // avoid leaking memory\n            if (prop.type == RLMPropertyTypeObject && !prop.swiftIvar) {\n                ((void(*)(id, SEL, id))objc_msgSend)(objBase, prop.setterSel, nil);\n            }\n        }\n\n        object_setClass(objBase, _info.rlmObjectSchema.accessorClass);\n        RLMInitializeSwiftAccessor(objBase, true);\n    }\n\n    if (requiresSwiftUIObservers) {\n        [RLMSwiftUIKVO addObserversToObject:objBase];\n    }\n\n    return {*outObj, false};\n}\n\ntemplate<>\nrealm::Obj RLMAccessorContext::unbox(__unsafe_unretained id const v, CreatePolicy policy, ObjKey key) {\n    return createObject(v, policy, false, key).first;\n}\n\nvoid RLMAccessorContext::will_change(realm::Obj const& row, realm::Property const& prop) {\n    auto obsInfo = RLMGetObservationInfo(nullptr, row.get_key(), _info);\n    if (!_observationHelper) {\n        if (obsInfo || prop.type == realm::PropertyType::Object) {\n            _observationHelper = std::make_unique<RLMObservationTracker>(_info.realm);\n        }\n    }\n    if (_observationHelper) {\n        _observationHelper->willChange(obsInfo, _info.propertyForTableColumn(prop.column_key).name);\n        if (prop.type == realm::PropertyType::Object) {\n            _observationHelper->trackDeletions();\n        }\n    }\n}\n\nvoid RLMAccessorContext::did_change() {\n    if (_observationHelper) {\n        _observationHelper->didChange();\n    }\n}\n\nRLMOptionalId RLMAccessorContext::value_for_property(__unsafe_unretained id const obj,\n                                                     realm::Property const&, size_t propIndex) {\n    auto prop = _info.rlmObjectSchema.properties[propIndex];\n    id value = propertyValue(obj, propIndex, prop);\n    if (value) {\n        RLMValidateValueForProperty(value, _info.rlmObjectSchema, prop);\n    }\n    return RLMOptionalId{value};\n}\n\nRLMOptionalId RLMAccessorContext::default_value_for_property(realm::ObjectSchema const&,\n                                                             realm::Property const& prop)\n{\n    return RLMOptionalId{defaultValue(@(prop.name.c_str()))};\n}\n\nbool RLMStatelessAccessorContext::is_same_list(realm::List const& list,\n                                               __unsafe_unretained id const v) noexcept {\n    return [v respondsToSelector:@selector(isBackedByList:)] && [v isBackedByList:list];\n}\n\nbool RLMStatelessAccessorContext::is_same_set(realm::object_store::Set const& set,\n                                              __unsafe_unretained id const v) noexcept {\n    return [v respondsToSelector:@selector(isBackedBySet:)] && [v isBackedBySet:set];\n}\n\nbool RLMStatelessAccessorContext::is_same_dictionary(realm::object_store::Dictionary const& dict,\n                                                     __unsafe_unretained id const v) noexcept {\n    return [v respondsToSelector:@selector(isBackedByDictionary:)] && [v isBackedByDictionary:dict];\n}\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wincomplete-implementation\"\n@implementation RLMManagedPropertyAccessor\n// Most types don't need to distinguish between promote and init so provide a default\n+ (void)promote:(RLMProperty *)property on:(RLMObjectBase *)parent {\n    [self initialize:property on:parent];\n}\n@end\n#pragma clang diagnostic pop\n"
  },
  {
    "path": "Realm/RLMArray.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMCollection.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@class RLMObject, RLMResults<RLMObjectType>;\n\n/**\n `RLMArray` is the container type in Realm used to define to-many relationships.\n\n Unlike an `NSArray`, `RLMArray`s hold a single type, specified by the `objectClassName` property.\n This is referred to in these docs as the “type” of the array.\n\n When declaring an `RLMArray` property, the type must be marked as conforming to a\n protocol by the same name as the objects it should contain (see the\n `RLM_COLLECTION_TYPE` macro). In addition, the property can be declared using Objective-C\n generics for better compile-time type safety.\n\n     RLM_COLLECTION_TYPE(ObjectType)\n     ...\n     @property RLMArray<ObjectType *><ObjectType> *arrayOfObjectTypes;\n\n `RLMArray`s can be queried with the same predicates as `RLMObject` and `RLMResult`s.\n\n `RLMArray`s cannot be created directly. `RLMArray` properties on `RLMObject`s are\n lazily created when accessed, or can be obtained by querying a Realm.\n\n ### Key-Value Observing\n\n `RLMArray` supports array key-value observing on `RLMArray` properties on `RLMObject`\n subclasses, and the `invalidated` property on `RLMArray` instances themselves is\n key-value observing compliant when the `RLMArray` is attached to a managed\n `RLMObject` (`RLMArray`s on unmanaged `RLMObject`s will never become invalidated).\n\n Because `RLMArray`s are attached to the object which they are a property of, they\n do not require using the mutable collection proxy objects from\n `-mutableArrayValueForKey:` or KVC-compatible mutation methods on the containing\n object. Instead, you can call the mutation methods on the `RLMArray` directly.\n */\n\n@interface RLMArray<RLMObjectType> : NSObject<RLMCollection>\n\n#pragma mark - Properties\n\n/**\n The number of objects in the array.\n */\n@property (nonatomic, readonly, assign) NSUInteger count;\n\n/**\n The type of the objects in the array.\n */\n@property (nonatomic, readonly, assign) RLMPropertyType type;\n\n/**\n Indicates whether the objects in the collection can be `nil`.\n */\n@property (nonatomic, readonly, getter = isOptional) BOOL optional;\n\n/**\n The class name  of the objects contained in the array.\n\n Will be `nil` if `type` is not RLMPropertyTypeObject.\n */\n@property (nonatomic, readonly, copy, nullable) NSString *objectClassName;\n\n/**\n The Realm which manages the array. Returns `nil` for unmanaged arrays.\n */\n@property (nonatomic, readonly, nullable) RLMRealm *realm;\n\n/**\n Indicates if the array can no longer be accessed.\n */\n@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated;\n\n/**\n Indicates if the array is frozen.\n\n Frozen arrays are immutable and can be accessed from any thread. Frozen arrays\n are created by calling `-freeze` on a managed live array. Unmanaged arrays are\n never frozen.\n */\n@property (nonatomic, readonly, getter = isFrozen) BOOL frozen;\n\n#pragma mark - Accessing Objects from an Array\n\n/**\n Returns the object at the index specified.\n\n @param index   The index to look up.\n\n @return An object of the type contained in the array.\n */\n- (RLMObjectType)objectAtIndex:(NSUInteger)index;\n\n/**\n Returns an array containing the objects in the array at the indexes specified by a given index set.\n `nil` will be returned if the index set contains an index out of the arrays bounds.\n\n @param indexes The indexes in the array to retrieve objects from.\n\n @return The objects at the specified indexes.\n */\n- (nullable NSArray<RLMObjectType> *)objectsAtIndexes:(NSIndexSet *)indexes;\n\n/**\n Returns the first object in the array.\n\n Returns `nil` if called on an empty array.\n\n @return An object of the type contained in the array.\n */\n- (nullable RLMObjectType)firstObject;\n\n/**\n Returns the last object in the array.\n\n Returns `nil` if called on an empty array.\n\n @return An object of the type contained in the array.\n */\n- (nullable RLMObjectType)lastObject;\n\n\n\n#pragma mark - Adding, Removing, and Replacing Objects in an Array\n\n/**\n Adds an object to the end of the array.\n\n @warning This method may only be called during a write transaction.\n\n @param object  An object of the type contained in the array.\n */\n- (void)addObject:(RLMObjectType)object;\n\n/**\n Adds an array of objects to the end of the array.\n\n @warning This method may only be called during a write transaction.\n\n @param objects     An enumerable object such as `NSArray` or `RLMResults` which contains objects of the\n                    same class as the array.\n */\n- (void)addObjects:(id<NSFastEnumeration>)objects;\n\n/**\n Inserts an object at the given index.\n\n Throws an exception if the index exceeds the bounds of the array.\n\n @warning This method may only be called during a write transaction.\n\n @param anObject  An object of the type contained in the array.\n @param index   The index at which to insert the object.\n */\n- (void)insertObject:(RLMObjectType)anObject atIndex:(NSUInteger)index;\n\n/**\n Removes an object at the given index.\n\n Throws an exception if the index exceeds the bounds of the array.\n\n @warning This method may only be called during a write transaction.\n\n @param index   The array index identifying the object to be removed.\n */\n- (void)removeObjectAtIndex:(NSUInteger)index;\n\n/**\n Removes the last object in the array.\n\n This is a no-op if the array is already empty.\n\n @warning This method may only be called during a write transaction.\n*/\n- (void)removeLastObject;\n\n/**\n Removes all objects from the array.\n\n @warning This method may only be called during a write transaction.\n */\n- (void)removeAllObjects;\n\n/**\n Replaces an object at the given index with a new object.\n\n Throws an exception if the index exceeds the bounds of the array.\n\n @warning This method may only be called during a write transaction.\n\n @param index       The index of the object to be replaced.\n @param anObject    An object (of the same type as returned from the `objectClassName` selector).\n */\n- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(RLMObjectType)anObject;\n\n/**\n Moves the object at the given source index to the given destination index.\n\n Throws an exception if the index exceeds the bounds of the array.\n\n @warning This method may only be called during a write transaction.\n\n @param sourceIndex      The index of the object to be moved.\n @param destinationIndex The index to which the object at `sourceIndex` should be moved.\n */\n- (void)moveObjectAtIndex:(NSUInteger)sourceIndex toIndex:(NSUInteger)destinationIndex;\n\n/**\n Exchanges the objects in the array at given indices.\n\n Throws an exception if either index exceeds the bounds of the array.\n\n @warning This method may only be called during a write transaction.\n\n @param index1 The index of the object which should replace the object at index `index2`.\n @param index2 The index of the object which should replace the object at index `index1`.\n */\n- (void)exchangeObjectAtIndex:(NSUInteger)index1 withObjectAtIndex:(NSUInteger)index2;\n\n#pragma mark - Querying an Array\n\n/**\n Returns the index of an object in the array.\n\n Returns `NSNotFound` if the object is not found in the array.\n\n @param object  An object (of the same type as returned from the `objectClassName` selector).\n */\n- (NSUInteger)indexOfObject:(RLMObjectType)object;\n\n/**\n Returns the index of the first object in the array matching the predicate.\n\n @param predicateFormat A predicate format string, optionally followed by a variable number of arguments.\n\n @return    The index of the object, or `NSNotFound` if the object is not found in the array.\n */\n- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat, ...;\n\n/// :nodoc:\n- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args;\n\n/**\n Returns the index of the first object in the array matching the predicate.\n\n @param predicate   The predicate with which to filter the objects.\n\n @return    The index of the object, or `NSNotFound` if the object is not found in the array.\n */\n- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicate;\n\n/**\n Returns all the objects matching the given predicate in the array.\n\n @param predicateFormat A predicate format string, optionally followed by a variable number of arguments.\n\n @return                An `RLMResults` of objects that match the given predicate.\n */\n- (RLMResults<RLMObjectType> *)objectsWhere:(NSString *)predicateFormat, ...;\n\n/// :nodoc:\n- (RLMResults<RLMObjectType> *)objectsWhere:(NSString *)predicateFormat args:(va_list)args;\n\n/**\n Returns all the objects matching the given predicate in the array.\n\n @param predicate   The predicate with which to filter the objects.\n\n @return            An `RLMResults` of objects that match the given predicate\n */\n- (RLMResults<RLMObjectType> *)objectsWithPredicate:(NSPredicate *)predicate;\n\n/**\n Returns a sorted `RLMResults` from the array.\n\n @param keyPath     The key path to sort by.\n @param ascending   The direction to sort in.\n\n @return    An `RLMResults` sorted by the specified key path.\n */\n- (RLMResults<RLMObjectType> *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending;\n\n/**\n Returns a sorted `RLMResults` from the array.\n\n @param properties  An array of `RLMSortDescriptor`s to sort by.\n\n @return    An `RLMResults` sorted by the specified properties.\n */\n- (RLMResults<RLMObjectType> *)sortedResultsUsingDescriptors:(NSArray<RLMSortDescriptor *> *)properties;\n\n/**\n Returns a distinct `RLMResults` from the array.\n\n @param keyPaths     The key paths to distinct on.\n\n @return    An `RLMResults` with the distinct values of the keypath(s).\n */\n- (RLMResults<RLMObjectType> *)distinctResultsUsingKeyPaths:(NSArray<NSString *> *)keyPaths;\n\n/// :nodoc:\n- (RLMObjectType)objectAtIndexedSubscript:(NSUInteger)index;\n\n/// :nodoc:\n- (void)setObject:(RLMObjectType)newValue atIndexedSubscript:(NSUInteger)index;\n\n#pragma mark - Sectioning an Array\n\n/**\n Sorts and sections this collection from a given property key path, returning the result\n as an instance of `RLMSectionedResults`.\n\n @param keyPath The property key path to sort on.\n @param ascending The direction to sort in.\n @param keyBlock  A callback which is invoked on each element in the Results collection.\n                 This callback is to return the section key for the element in the collection.\n\n @return An instance of RLMSectionedResults.\n */\n- (RLMSectionedResults *)sectionedResultsSortedUsingKeyPath:(NSString *)keyPath\n                                                  ascending:(BOOL)ascending\n                                                   keyBlock:(RLMSectionedResultsKeyBlock)keyBlock;\n\n/**\n Sorts and sections this collection from a given array of sort descriptors, returning the result\n as an instance of `RLMSectionedResults`.\n\n @param sortDescriptors  An array of `RLMSortDescriptor`s to sort by.\n @param keyBlock  A callback which is invoked on each element in the Results collection.\n                 This callback is to return the section key for the element in the collection.\n\n @note The primary sort descriptor must be responsible for determining the section key.\n\n @return An instance of RLMSectionedResults.\n */\n- (RLMSectionedResults *)sectionedResultsUsingSortDescriptors:(NSArray<RLMSortDescriptor *> *)sortDescriptors\n                                                     keyBlock:(RLMSectionedResultsKeyBlock)keyBlock;\n\n\n#pragma mark - Notifications\n\n/**\n Registers a block to be called each time the array changes.\n\n The block will be asynchronously called with the initial array, and then\n called again after each write transaction which changes any of the objects in\n the array, which objects are in the results, or the order of the objects in the\n array.\n\n The `changes` parameter will be `nil` the first time the block is called. For\n each call after that, it will contain information about which rows in the\n array were added, removed or modified. If a write transaction did not modify\n any objects in the array, the block is not called at all. See the\n `RLMCollectionChange` documentation for information on how the changes are\n reported and an example of updating a `UITableView`.\n\n The error parameter is present only for backwards compatibility and will always\n be `nil`.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification. This can include the notification\n with the initial results. For example, the following code performs a write\n transaction immediately after adding the notification block, so there is no\n opportunity for the initial notification to be delivered first. As a\n result, the initial notification will reflect the state of the Realm after\n the write transaction.\n\n     Person *person = [[Person allObjectsInRealm:realm] firstObject];\n     NSLog(@\"person.dogs.count: %zu\", person.dogs.count); // => 0\n     self.token = [person.dogs addNotificationBlock(RLMArray<Dog *> *dogs,\n                                                    RLMCollectionChange *changes,\n                                                    NSError *error) {\n         // Only fired once for the example\n         NSLog(@\"dogs.count: %zu\", dogs.count) // => 1\n     }];\n     [realm transactionWithBlock:^{\n         Dog *dog = [[Dog alloc] init];\n         dog.name = @\"Rex\";\n         [person.dogs addObject:dog];\n     }];\n     // end of run loop execution context\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning This method may only be called on a non-frozen managed array.\n\n @param block The block to be called each time the array changes.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray<RLMObjectType> *_Nullable array,\n                                                         RLMCollectionChange *_Nullable changes,\n                                                         NSError *_Nullable error))block\n__attribute__((warn_unused_result));\n\n/**\n Registers a block to be called each time the array changes.\n\n The block will be asynchronously called with the initial array, and then\n called again after each write transaction which changes any of the objects in\n the array, which objects are in the results, or the order of the objects in the\n array.\n\n The `changes` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the array were added, removed or modified. If a write transaction\n did not modify any objects in the array, the block is not called at all.\n See the `RLMCollectionChange` documentation for information on how the changes\n are reported and an example of updating a `UITableView`.\n\n The error parameter is present only for backwards compatibility and will always\n be `nil`.\n\n Notifications are delivered on the given queue. If the queue is blocked and\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification.\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called when the containing Realm is read-only or frozen.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param queue The serial queue to deliver notifications to.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray<RLMObjectType> *_Nullable array,\n                                                         RLMCollectionChange *_Nullable changes,\n                                                         NSError *_Nullable error))block\n                                         queue:(nullable dispatch_queue_t)queue\n__attribute__((warn_unused_result));\n\n/**\n Registers a block to be called each time the array changes.\n\n The block will be asynchronously called with the initial array, and then\n called again after each write transaction which changes any of the objects in\n the array, which objects are in the results, or the order of the objects in the\n array.\n\n The `changes` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the array were added, removed or modified. If a write transaction\n did not modify any objects in the array, the block is not called at all.\n See the `RLMCollectionChange` documentation for information on how the changes\n are reported and an example of updating a `UITableView`.\n\n The error parameter is present only for backwards compatibility and will always\n be `nil`.\n\n Notifications are delivered on the given queue. If the queue is blocked and\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification.\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called when the containing Realm is read-only or frozen.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param keyPaths The block will be called for changes occurring on these keypaths. If no\n key paths are given, notifications are delivered for every property key path.\n @param queue The serial queue to deliver notifications to.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray<RLMObjectType> *_Nullable array,\n                                                         RLMCollectionChange *_Nullable changes,\n                                                         NSError *_Nullable error))block\n                                      keyPaths:(nullable NSArray<NSString *> *)keyPaths\n                                         queue:(nullable dispatch_queue_t)queue\n__attribute__((warn_unused_result));\n\n/**\n Registers a block to be called each time the array changes.\n\n The block will be asynchronously called with the initial array, and then\n called again after each write transaction which changes any of the objects in\n the array, which objects are in the results, or the order of the objects in the\n array.\n\n The `changes` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the array were added, removed or modified. If a write transaction\n did not modify any objects in the array, the block is not called at all.\n See the `RLMCollectionChange` documentation for information on how the changes\n are reported and an example of updating a `UITableView`.\n\n The error parameter is present only for backwards compatibility and will always\n be `nil`.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification. This can include the notification\n with the initial results. For example, the following code performs a write\n transaction immediately after adding the notification block, so there is no\n opportunity for the initial notification to be delivered first. As a\n result, the initial notification will reflect the state of the Realm after\n the write transaction.\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called when the containing Realm is read-only or frozen.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param keyPaths The block will be called for changes occurring on these keypaths. If no\n key paths are given, notifications are delivered for every property key path.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray<RLMObjectType> *_Nullable array,\n                                                         RLMCollectionChange *_Nullable changes,\n                                                         NSError *_Nullable error))block\n                                      keyPaths:(nullable NSArray<NSString *> *)keyPaths\n__attribute__((warn_unused_result));\n\n#pragma mark - Aggregating Property Values\n\n/**\n Returns the minimum (lowest) value of the given property among all the objects in the array.\n\n     NSNumber *min = [object.arrayProperty minOfProperty:@\"age\"];\n\n @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.\n\n @param property The property whose minimum value is desired. Only properties of\n                 types `int`, `float`, `double`, and `NSDate` are supported.\n\n @return The minimum value of the property, or `nil` if the array is empty.\n */\n- (nullable id)minOfProperty:(NSString *)property;\n\n/**\n Returns the maximum (highest) value of the given property among all the objects in the array.\n\n     NSNumber *max = [object.arrayProperty maxOfProperty:@\"age\"];\n\n @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.\n\n @param property The property whose maximum value is desired. Only properties of\n                 types `int`, `float`, `double`, and `NSDate` are supported.\n\n @return The maximum value of the property, or `nil` if the array is empty.\n */\n- (nullable id)maxOfProperty:(NSString *)property;\n\n/**\n Returns the sum of the values of a given property over all the objects in the array.\n\n     NSNumber *sum = [object.arrayProperty sumOfProperty:@\"age\"];\n\n @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.\n\n @param property The property whose values should be summed. Only properties of\n                 types `int`, `float`, and `double` are supported.\n\n @return The sum of the given property.\n */\n- (NSNumber *)sumOfProperty:(NSString *)property;\n\n/**\n Returns the average value of a given property over the objects in the array.\n\n     NSNumber *average = [object.arrayProperty averageOfProperty:@\"age\"];\n\n @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.\n\n @param property The property whose average value should be calculated. Only\n                 properties of types `int`, `float`, and `double` are supported.\n\n @return    The average value of the given property, or `nil` if the array is empty.\n */\n- (nullable NSNumber *)averageOfProperty:(NSString *)property;\n\n#pragma mark - Freeze\n\n/**\n Returns a frozen (immutable) snapshot of this array.\n\n The frozen copy is an immutable array which contains the same data as this\n array currently contains, but will not update when writes are made to the\n containing Realm. Unlike live arrays, frozen arrays can be accessed from any\n thread.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning This method may only be called on a managed array.\n @warning Holding onto a frozen array for an extended period while performing\n          write transaction on the Realm may result in the Realm file growing\n          to large sizes. See `RLMRealmConfiguration.maximumNumberOfActiveVersions`\n          for more information.\n */\n- (instancetype)freeze;\n\n/**\n Returns a live version of this frozen collection.\n\n This method resolves a reference to a live copy of the same frozen collection.\n If called on a live collection, will return itself.\n*/\n- (instancetype)thaw;\n\n#pragma mark - Unavailable Methods\n\n/**\n `-[RLMArray init]` is not available because `RLMArray`s cannot be created directly.\n `RLMArray` properties on `RLMObject`s are lazily created when accessed.\n */\n- (instancetype)init __attribute__((unavailable(\"RLMArrays cannot be created directly\")));\n\n/**\n `+[RLMArray new]` is not available because `RLMArray`s cannot be created directly.\n `RLMArray` properties on `RLMObject`s are lazily created when accessed.\n */\n+ (instancetype)new __attribute__((unavailable(\"RLMArrays cannot be created directly\")));\n\n@end\n\n/// :nodoc:\n@interface RLMArray (Swift)\n// for use only in Swift class definitions\n- (instancetype)initWithObjectClassName:(NSString *)objectClassName;\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMArray.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMArray_Private.hpp\"\n\n#import \"RLMObjectSchema.h\"\n#import \"RLMObjectStore.h\"\n#import \"RLMObject_Private.h\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMQueryUtil.hpp\"\n#import \"RLMSchema_Private.h\"\n#import \"RLMSwiftSupport.h\"\n#import \"RLMThreadSafeReference_Private.hpp\"\n#import \"RLMUtil.hpp\"\n\n@interface RLMArray () <RLMThreadConfined_Private>\n@end\n\n@implementation RLMArray {\n    // Backing array when this instance is unmanaged\n    @public\n    NSMutableArray *_backingCollection;\n}\n#pragma mark - Initializers\n\n- (instancetype)initWithObjectClassName:(__unsafe_unretained NSString *const)objectClassName\n                                keyType:(__unused RLMPropertyType)keyType {\n    return [self initWithObjectClassName:objectClassName];\n}\n- (instancetype)initWithObjectType:(RLMPropertyType)type optional:(BOOL)optional\n                           keyType:(__unused RLMPropertyType)keyType {\n    return [self initWithObjectType:type optional:optional];\n}\n\n- (instancetype)initWithObjectClassName:(__unsafe_unretained NSString *const)objectClassName {\n    REALM_ASSERT([objectClassName length] > 0);\n    self = [super init];\n    if (self) {\n        _objectClassName = objectClassName;\n        _type = RLMPropertyTypeObject;\n    }\n    return self;\n}\n\n- (instancetype)initWithObjectType:(RLMPropertyType)type optional:(BOOL)optional {\n    REALM_ASSERT(type != RLMPropertyTypeObject);\n    self = [super init];\n    if (self) {\n        _type = type;\n        _optional = optional;\n    }\n    return self;\n}\n\n- (void)setParent:(RLMObjectBase *)parentObject property:(RLMProperty *)property {\n    _parentObject = parentObject;\n    _property = property;\n    _isLegacyProperty = property.isLegacy;\n}\n\n#pragma mark - Convenience wrappers used for all RLMArray types\n\n- (void)addObjects:(id<NSFastEnumeration>)objects {\n    for (id obj in objects) {\n        [self addObject:obj];\n    }\n}\n\n- (void)addObject:(id)object {\n    [self insertObject:object atIndex:self.count];\n}\n\n- (void)removeLastObject {\n    NSUInteger count = self.count;\n    if (count) {\n        [self removeObjectAtIndex:count-1];\n    }\n}\n\n- (id)objectAtIndexedSubscript:(NSUInteger)index {\n    return [self objectAtIndex:index];\n}\n\n- (void)setObject:(id)newValue atIndexedSubscript:(NSUInteger)index {\n    [self replaceObjectAtIndex:index withObject:newValue];\n}\n\n- (RLMResults *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending {\n    return [self sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:keyPath ascending:ascending]]];\n}\n\n- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat, ... {\n    va_list args;\n    va_start(args, predicateFormat);\n    NSUInteger index = [self indexOfObjectWhere:predicateFormat args:args];\n    va_end(args);\n    return index;\n}\n\n- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args {\n    return [self indexOfObjectWithPredicate:[NSPredicate predicateWithFormat:predicateFormat\n                                                                   arguments:args]];\n}\n\n// The compiler complains about the method's argument type not matching due to\n// it not having the generic type attached, but it doesn't seem to be possible\n// to actually include the generic type\n// http://www.openradar.me/radar?id=6135653276319744\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wmismatched-parameter-types\"\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray *, RLMCollectionChange *, NSError *))block {\n    return RLMAddNotificationBlock(self, block, nil, nil);\n}\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray *, RLMCollectionChange *, NSError *))block\n                                         queue:(dispatch_queue_t)queue {\n    return RLMAddNotificationBlock(self, block, nil, queue);\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray *, RLMCollectionChange *, NSError *))block\n                                      keyPaths:(NSArray<NSString *> *)keyPaths {\n    return RLMAddNotificationBlock(self, block, keyPaths, nil);\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray *, RLMCollectionChange *, NSError *))block\n                                      keyPaths:(NSArray<NSString *> *)keyPaths\n                                         queue:(dispatch_queue_t)queue {\n    return RLMAddNotificationBlock(self, block, keyPaths, queue);\n}\n#pragma clang diagnostic pop\n\n#pragma mark - Unmanaged RLMArray implementation\n\n- (RLMRealm *)realm {\n    return nil;\n}\n\n- (id)firstObject {\n    if (self.count) {\n        return [self objectAtIndex:0];\n    }\n    return nil;\n}\n\n- (id)lastObject {\n    NSUInteger count = self.count;\n    if (count) {\n        return [self objectAtIndex:count-1];\n    }\n    return nil;\n}\n\n- (id)objectAtIndex:(NSUInteger)index {\n    validateArrayBounds(self, index);\n    return [_backingCollection objectAtIndex:index];\n}\n\n- (NSUInteger)count {\n    return _backingCollection.count;\n}\n\n- (BOOL)isInvalidated {\n    return NO;\n}\n\n- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state\n                                  objects:(__unused __unsafe_unretained id [])buffer\n                                    count:(__unused NSUInteger)len {\n    return RLMUnmanagedFastEnumerate(_backingCollection, state);\n}\n\ntemplate<typename IndexSetFactory>\nstatic void changeArray(__unsafe_unretained RLMArray *const ar,\n                        NSKeyValueChange kind, dispatch_block_t f, IndexSetFactory&& is) {\n    if (!ar->_backingCollection) {\n        ar->_backingCollection = [NSMutableArray new];\n    }\n\n    if (RLMObjectBase *parent = ar->_parentObject) {\n        NSIndexSet *indexes = is();\n        [parent willChange:kind valuesAtIndexes:indexes forKey:ar->_property.name];\n        f();\n        [parent didChange:kind valuesAtIndexes:indexes forKey:ar->_property.name];\n    }\n    else {\n        f();\n    }\n}\n\nstatic void changeArray(__unsafe_unretained RLMArray *const ar, NSKeyValueChange kind,\n                        NSUInteger index, dispatch_block_t f) {\n    changeArray(ar, kind, f, [=] { return [NSIndexSet indexSetWithIndex:index]; });\n}\n\nstatic void changeArray(__unsafe_unretained RLMArray *const ar, NSKeyValueChange kind,\n                        NSRange range, dispatch_block_t f) {\n    changeArray(ar, kind, f, [=] { return [NSIndexSet indexSetWithIndexesInRange:range]; });\n}\n\nstatic void changeArray(__unsafe_unretained RLMArray *const ar, NSKeyValueChange kind,\n                        NSIndexSet *is, dispatch_block_t f) {\n    changeArray(ar, kind, f, [=] { return is; });\n}\n\nvoid RLMArrayValidateMatchingObjectType(__unsafe_unretained RLMArray *const array,\n                                        __unsafe_unretained id const value) {\n    if (!value && !array->_optional) {\n        @throw RLMException(@\"Invalid nil value for array of '%@'.\",\n                            array->_objectClassName ?: RLMTypeToString(array->_type));\n    }\n    if (array->_type != RLMPropertyTypeObject) {\n        if (!RLMValidateValue(value, array->_type, array->_optional, false, nil)) {\n            @throw RLMException(@\"Invalid value '%@' of type '%@' for expected type '%@%s'.\",\n                                value, [value class], RLMTypeToString(array->_type),\n                                array->_optional ? \"?\" : \"\");\n        }\n        return;\n    }\n\n    auto object = RLMDynamicCast<RLMObjectBase>(value);\n    if (!object) {\n        return;\n    }\n    if (!object->_objectSchema) {\n        @throw RLMException(@\"Object cannot be inserted unless the schema is initialized. \"\n                            \"This can happen if you try to insert objects into a RLMArray / List from a default value or from an overriden unmanaged initializer (`init()`).\");\n    }\n    if (![array->_objectClassName isEqualToString:object->_objectSchema.className]) {\n        @throw RLMException(@\"Object of type '%@' does not match RLMArray type '%@'.\",\n                            object->_objectSchema.className, array->_objectClassName);\n    }\n}\n\nstatic void validateArrayBounds(__unsafe_unretained RLMArray *const ar,\n                                   NSUInteger index, bool allowOnePastEnd=false) {\n    NSUInteger max = ar->_backingCollection.count + allowOnePastEnd;\n    if (index >= max) {\n        @throw RLMException(@\"Index %llu is out of bounds (must be less than %llu).\",\n                            (unsigned long long)index, (unsigned long long)max);\n    }\n}\n\n- (void)addObjectsFromArray:(NSArray *)array {\n    for (id obj in array) {\n        RLMArrayValidateMatchingObjectType(self, obj);\n    }\n    changeArray(self, NSKeyValueChangeInsertion, NSMakeRange(_backingCollection.count, array.count), ^{\n        [_backingCollection addObjectsFromArray:array];\n    });\n}\n\n- (void)insertObject:(id)anObject atIndex:(NSUInteger)index {\n    RLMArrayValidateMatchingObjectType(self, anObject);\n    validateArrayBounds(self, index, true);\n    changeArray(self, NSKeyValueChangeInsertion, index, ^{\n        [_backingCollection insertObject:anObject atIndex:index];\n    });\n}\n\n- (void)insertObjects:(id<NSFastEnumeration>)objects atIndexes:(NSIndexSet *)indexes {\n    changeArray(self, NSKeyValueChangeInsertion, indexes, ^{\n        NSUInteger currentIndex = [indexes firstIndex];\n        for (RLMObject *obj in objects) {\n            RLMArrayValidateMatchingObjectType(self, obj);\n            [_backingCollection insertObject:obj atIndex:currentIndex];\n            currentIndex = [indexes indexGreaterThanIndex:currentIndex];\n        }\n    });\n}\n\n- (void)removeObjectAtIndex:(NSUInteger)index {\n    validateArrayBounds(self, index);\n    changeArray(self, NSKeyValueChangeRemoval, index, ^{\n        [_backingCollection removeObjectAtIndex:index];\n    });\n}\n\n- (void)removeObjectsAtIndexes:(NSIndexSet *)indexes {\n    changeArray(self, NSKeyValueChangeRemoval, indexes, ^{\n        [_backingCollection removeObjectsAtIndexes:indexes];\n    });\n}\n\n- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject {\n    RLMArrayValidateMatchingObjectType(self, anObject);\n    validateArrayBounds(self, index);\n    changeArray(self, NSKeyValueChangeReplacement, index, ^{\n        [_backingCollection replaceObjectAtIndex:index withObject:anObject];\n    });\n}\n\n- (void)moveObjectAtIndex:(NSUInteger)sourceIndex toIndex:(NSUInteger)destinationIndex {\n    validateArrayBounds(self, sourceIndex);\n    validateArrayBounds(self, destinationIndex);\n    id original = _backingCollection[sourceIndex];\n\n    auto start = std::min(sourceIndex, destinationIndex);\n    auto len = std::max(sourceIndex, destinationIndex) - start + 1;\n    changeArray(self, NSKeyValueChangeReplacement, {start, len}, ^{\n        [_backingCollection removeObjectAtIndex:sourceIndex];\n        [_backingCollection insertObject:original atIndex:destinationIndex];\n    });\n}\n\n- (void)exchangeObjectAtIndex:(NSUInteger)index1 withObjectAtIndex:(NSUInteger)index2 {\n    validateArrayBounds(self, index1);\n    validateArrayBounds(self, index2);\n\n    changeArray(self, NSKeyValueChangeReplacement, ^{\n        [_backingCollection exchangeObjectAtIndex:index1 withObjectAtIndex:index2];\n    }, [=] {\n        NSMutableIndexSet *set = [[NSMutableIndexSet alloc] initWithIndex:index1];\n        [set addIndex:index2];\n        return set;\n    });\n}\n\n- (NSUInteger)indexOfObject:(id)object {\n    RLMArrayValidateMatchingObjectType(self, object);\n    if (!_backingCollection) {\n        return NSNotFound;\n    }\n    if (_type != RLMPropertyTypeObject) {\n        return [_backingCollection indexOfObject:object];\n    }\n\n    NSUInteger index = 0;\n    for (RLMObjectBase *cmp in _backingCollection) {\n        if (RLMObjectBaseAreEqual(object, cmp)) {\n            return index;\n        }\n        index++;\n    }\n    return NSNotFound;\n}\n\n- (void)removeAllObjects {\n    changeArray(self, NSKeyValueChangeRemoval, NSMakeRange(0, _backingCollection.count), ^{\n        [_backingCollection removeAllObjects];\n    });\n}\n\n- (void)replaceAllObjectsWithObjects:(NSArray *)objects {\n    if (_backingCollection.count) {\n        changeArray(self, NSKeyValueChangeRemoval, NSMakeRange(0, _backingCollection.count), ^{\n            [_backingCollection removeAllObjects];\n        });\n    }\n    if (![objects respondsToSelector:@selector(count)] || !objects.count) {\n        return;\n    }\n    changeArray(self, NSKeyValueChangeInsertion, NSMakeRange(0, objects.count), ^{\n        for (id object in objects) {\n            // object should always be non-nil since it's a value stored in a\n            // NSArray, but as of Xcode 16.3 [Decimal128?] sometimes ends up\n            // with nil instead of NSNull when bridged from Swift.\n            [_backingCollection addObject:object ?: NSNull.null];\n        }\n    });\n}\n\n- (RLMResults *)objectsWhere:(NSString *)predicateFormat, ... {\n    va_list args;\n    va_start(args, predicateFormat);\n    RLMResults *results = [self objectsWhere:predicateFormat args:args];\n    va_end(args);\n    return results;\n}\n\n- (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args {\n    return [self objectsWithPredicate:[NSPredicate predicateWithFormat:predicateFormat arguments:args]];\n}\n\n- (RLMPropertyType)typeForProperty:(NSString *)propertyName {\n    if ([propertyName isEqualToString:@\"self\"]) {\n        return _type;\n    }\n\n    RLMObjectSchema *objectSchema;\n    if (_backingCollection.count) {\n        objectSchema = [_backingCollection[0] objectSchema];\n    }\n    else {\n        objectSchema = [RLMSchema.partialPrivateSharedSchema schemaForClassName:_objectClassName];\n    }\n\n    return RLMValidatedProperty(objectSchema, propertyName).type;\n}\n\n- (id)aggregateProperty:(NSString *)key operation:(NSString *)op method:(SEL)sel {\n    // Although delegating to valueForKeyPath: here would allow to support\n    // nested key paths as well, limiting functionality gives consistency\n    // between unmanaged and managed arrays.\n    if ([key rangeOfString:@\".\"].location != NSNotFound) {\n        @throw RLMException(@\"Nested key paths are not supported yet for KVC collection operators.\");\n    }\n\n    bool allowDate = false;\n    bool sum = false;\n    if ([op isEqualToString:@\"@min\"] || [op isEqualToString:@\"@max\"]) {\n        allowDate = true;\n    }\n    else if ([op isEqualToString:@\"@sum\"]) {\n        sum = true;\n    }\n    else if (![op isEqualToString:@\"@avg\"]) {\n        // Just delegate to NSArray for all other operators\n        return [_backingCollection valueForKeyPath:[op stringByAppendingPathExtension:key]];\n    }\n\n    RLMPropertyType type = [self typeForProperty:key];\n    if (!canAggregate(type, allowDate)) {\n        NSString *method = sel ? NSStringFromSelector(sel) : op;\n        if (_type == RLMPropertyTypeObject) {\n            @throw RLMException(@\"%@: is not supported for %@ property '%@.%@'\",\n                                method, RLMTypeToString(type), _objectClassName, key);\n        }\n        else {\n            @throw RLMException(@\"%@ is not supported for %@%s array\",\n                                method, RLMTypeToString(_type), _optional ? \"?\" : \"\");\n        }\n    }\n\n    NSArray *values = [key isEqualToString:@\"self\"] ? _backingCollection : [_backingCollection valueForKey:key];\n    if (_optional) {\n        // Filter out NSNull values to match our behavior on managed arrays\n        NSIndexSet *nonnull = [values indexesOfObjectsPassingTest:^BOOL(id obj, NSUInteger, BOOL *) {\n            return obj != NSNull.null;\n        }];\n        if (nonnull.count < values.count) {\n            values = [values objectsAtIndexes:nonnull];\n        }\n    }\n    id result = [values valueForKeyPath:[op stringByAppendingString:@\".self\"]];\n    return sum && !result ? @0 : result;\n}\n\n- (id)valueForKeyPath:(NSString *)keyPath {\n    if ([keyPath characterAtIndex:0] != '@') {\n        return _backingCollection ? [_backingCollection valueForKeyPath:keyPath] : [super valueForKeyPath:keyPath];\n    }\n\n    if (!_backingCollection) {\n        _backingCollection = [NSMutableArray new];\n    }\n\n    NSUInteger dot = [keyPath rangeOfString:@\".\"].location;\n    if (dot == NSNotFound) {\n        return [_backingCollection valueForKeyPath:keyPath];\n    }\n\n    NSString *op = [keyPath substringToIndex:dot];\n    NSString *key = [keyPath substringFromIndex:dot + 1];\n    return [self aggregateProperty:key operation:op method:nil];\n}\n\n- (id)valueForKey:(NSString *)key {\n    if ([key isEqualToString:RLMInvalidatedKey]) {\n        return @NO; // Unmanaged arrays are never invalidated\n    }\n    if (!_backingCollection) {\n        _backingCollection = [NSMutableArray new];\n    }\n    return [_backingCollection valueForKey:key];\n}\n\n- (void)setValue:(id)value forKey:(NSString *)key {\n    if ([key isEqualToString:@\"self\"]) {\n        RLMArrayValidateMatchingObjectType(self, value);\n        for (NSUInteger i = 0, count = _backingCollection.count; i < count; ++i) {\n            _backingCollection[i] = value;\n        }\n        return;\n    }\n    else if (_type == RLMPropertyTypeObject) {\n        [_backingCollection setValue:value forKey:key];\n    }\n    else {\n        [self setValue:value forUndefinedKey:key];\n    }\n}\n\n- (id)minOfProperty:(NSString *)property {\n    return [self aggregateProperty:property operation:@\"@min\" method:_cmd];\n}\n\n- (id)maxOfProperty:(NSString *)property {\n    return [self aggregateProperty:property operation:@\"@max\" method:_cmd];\n}\n\n- (id)sumOfProperty:(NSString *)property {\n    return [self aggregateProperty:property operation:@\"@sum\" method:_cmd];\n}\n\n- (id)averageOfProperty:(NSString *)property {\n    return [self aggregateProperty:property operation:@\"@avg\" method:_cmd];\n}\n\n- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicate {\n    if (!_backingCollection) {\n        return NSNotFound;\n    }\n    return [_backingCollection indexOfObjectPassingTest:^BOOL(id obj, NSUInteger, BOOL *) {\n        return [predicate evaluateWithObject:obj];\n    }];\n}\n\n- (NSArray *)objectsAtIndexes:(NSIndexSet *)indexes {\n    if ([indexes indexGreaterThanOrEqualToIndex:self.count] != NSNotFound) {\n        return nil;\n    }\n    return [_backingCollection objectsAtIndexes:indexes] ?: @[];\n}\n\n- (BOOL)isEqual:(id)object {\n    if (auto array = RLMDynamicCast<RLMArray>(object)) {\n        if (array.realm) {\n            return NO;\n        }\n        NSArray *otherCollection = array->_backingCollection;\n        return (_backingCollection.count == 0 && otherCollection.count == 0)\n            || [_backingCollection isEqual:otherCollection];\n    }\n    return NO;\n}\n\n- (void)addObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath\n            options:(NSKeyValueObservingOptions)options context:(void *)context {\n    RLMValidateArrayObservationKey(keyPath, self);\n    [super addObserver:observer forKeyPath:keyPath options:options context:context];\n}\n\n#pragma mark - Methods unsupported on unmanaged RLMArray instances\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wunused-parameter\"\n\n- (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate {\n    @throw RLMException(@\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n}\n\n- (RLMResults *)sortedResultsUsingDescriptors:(NSArray<RLMSortDescriptor *> *)properties {\n    @throw RLMException(@\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n}\n\n- (RLMResults *)distinctResultsUsingKeyPaths:(NSArray<NSString *> *)keyPaths {\n    @throw RLMException(@\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n}\n\n- (RLMSectionedResults *)sectionedResultsSortedUsingKeyPath:(NSString *)keyPath\n                                                  ascending:(BOOL)ascending\n                                                   keyBlock:(RLMSectionedResultsKeyBlock)keyBlock {\n    @throw RLMException(@\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n}\n\n- (RLMSectionedResults *)sectionedResultsUsingSortDescriptors:(NSArray<RLMSortDescriptor *> *)sortDescriptors\n                                                     keyBlock:(RLMSectionedResultsKeyBlock)keyBlock {\n    @throw RLMException(@\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n}\n\n- (instancetype)freeze {\n    @throw RLMException(@\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n}\n\n- (instancetype)thaw {\n    @throw RLMException(@\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n}\n\n#pragma mark - Thread Confined Protocol Conformance\n\n- (realm::ThreadSafeReference)makeThreadSafeReference {\n    REALM_TERMINATE(\"Unexpected handover of unmanaged `RLMArray`\");\n}\n\n- (id)objectiveCMetadata {\n    REALM_TERMINATE(\"Unexpected handover of unmanaged `RLMArray`\");\n}\n\n+ (instancetype)objectWithThreadSafeReference:(realm::ThreadSafeReference)reference\n                                     metadata:(id)metadata\n                                        realm:(RLMRealm *)realm {\n    REALM_TERMINATE(\"Unexpected handover of unmanaged `RLMArray`\");\n}\n\n#pragma clang diagnostic pop // unused parameter warning\n\n#pragma mark - Superclass Overrides\n\n- (NSString *)description {\n    return [self descriptionWithMaxDepth:RLMDescriptionMaxDepth];\n}\n\n- (NSString *)descriptionWithMaxDepth:(NSUInteger)depth {\n    return RLMDescriptionWithMaxDepth(@\"RLMArray\", self, depth);\n}\n\n#pragma mark - Key Path Strings\n\n- (NSString *)propertyKey {\n    return _property.name;\n}\n\n@end\n\n@implementation RLMSortDescriptor\n\n+ (instancetype)sortDescriptorWithKeyPath:(NSString *)keyPath ascending:(BOOL)ascending {\n    RLMSortDescriptor *desc = [[RLMSortDescriptor alloc] init];\n    desc->_keyPath = keyPath;\n    desc->_ascending = ascending;\n    return desc;\n}\n\n- (instancetype)reversedSortDescriptor {\n    return [self.class sortDescriptorWithKeyPath:_keyPath ascending:!_ascending];\n}\n\n@end\n"
  },
  {
    "path": "Realm/RLMArray_Private.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMArray.h>\n#import <Realm/RLMConstants.h>\n\n@class RLMObjectBase, RLMProperty;\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@interface RLMArray ()\n- (instancetype)initWithObjectClassName:(NSString *)objectClassName;\n- (instancetype)initWithObjectType:(RLMPropertyType)type optional:(BOOL)optional;\n- (NSString *)descriptionWithMaxDepth:(NSUInteger)depth;\n- (void)setParent:(RLMObjectBase *)parentObject property:(RLMProperty *)property;\n- (void)replaceAllObjectsWithObjects:(NSArray *)objects;\n// YES if the property is declared with old property syntax.\n@property (nonatomic, readonly) BOOL isLegacyProperty;\n// The name of the property which this collection represents\n@property (nonatomic, readonly) NSString *propertyKey;\n@end\n\n@interface RLMManagedArray : RLMArray\n- (instancetype)initWithParent:(RLMObjectBase *)parentObject property:(RLMProperty *)property;\n@end\n\nvoid RLMArrayValidateMatchingObjectType(RLMArray *array, id value);\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMArray_Private.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMArray_Private.h\"\n\n#import \"RLMCollection_Private.hpp\"\n\n#import \"RLMResults_Private.hpp\"\n\n#import <realm/table_ref.hpp>\n\nnamespace realm {\n    class Results;\n}\n\n@class RLMObjectBase, RLMObjectSchema, RLMProperty;\nclass RLMClassInfo;\nclass RLMObservationInfo;\n\n@interface RLMArray () {\n@protected\n    NSString *_objectClassName;\n    BOOL _optional;\n@public\n    // The property which this RLMArray represents\n    RLMProperty *_property;\n    __weak RLMObjectBase *_parentObject;\n}\n@end\n\n@interface RLMManagedArray () <RLMCollectionPrivate>\n- (RLMManagedArray *)initWithBackingCollection:(realm::List)list\n                                    parentInfo:(RLMClassInfo *)parentInfo\n                                      property:(RLMProperty *)property;\n- (RLMManagedArray *)initWithParent:(realm::Obj)parent\n                           property:(RLMProperty *)property\n                         parentInfo:(RLMClassInfo&)info;\n\n- (bool)isBackedByList:(realm::List const&)list;\n\n// deletes all objects in the RLMArray from their containing realms\n- (void)deleteObjectsFromRealm;\n@end\n\nvoid RLMValidateArrayObservationKey(NSString *keyPath, RLMArray *array);\n\n// Initialize the observation info for an array if needed\nvoid RLMEnsureArrayObservationInfo(std::unique_ptr<RLMObservationInfo>& info,\n                                   NSString *keyPath, RLMArray *array, id observed);\n"
  },
  {
    "path": "Realm/RLMAsyncTask.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2023 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n/**\n A task object which can be used to observe or cancel an async open.\n\n When a synchronized Realm is opened asynchronously, the latest state of the\n Realm is downloaded from the server before the completion callback is invoked.\n This task object can be used to observe the state of the download or to cancel\n it. This should be used instead of trying to observe the download via the sync\n session as the sync session itself is created asynchronously, and may not exist\n yet when -[RLMRealm asyncOpenWithConfiguration:completion:] returns.\n */\nNS_SWIFT_SENDABLE RLM_FINAL // is internally thread-safe\n@interface RLMAsyncOpenTask : NSObject\n\n/**\n Cancel the asynchronous open.\n\n Any download in progress will be cancelled, and the completion block for this\n async open will never be called. If multiple async opens on the same Realm are\n happening concurrently, all other opens will fail with the error \"operation cancelled\".\n */\n- (void)cancel;\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMAsyncTask.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2023 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMAsyncTask_Private.h\"\n\n#import \"RLMError_Private.hpp\"\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMRealmConfiguration_Private.hpp\"\n#import \"RLMScheduler.h\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/exceptions.hpp>\n#import <realm/object-store/thread_safe_reference.hpp>\n\nstatic dispatch_queue_t s_async_open_queue = dispatch_queue_create(\"io.realm.asyncOpenDispatchQueue\",\n                                                                   DISPATCH_QUEUE_CONCURRENT);\nvoid RLMSetAsyncOpenQueue(dispatch_queue_t queue) {\n    s_async_open_queue = queue;\n}\n\nstatic NSError *s_canceledError = [NSError errorWithDomain:NSPOSIXErrorDomain\n                                                      code:ECANCELED userInfo:@{\n    NSLocalizedDescriptionKey: @\"Operation canceled\"\n}];\n\n__attribute__((objc_direct_members))\n@implementation RLMAsyncOpenTask {\n    RLMUnfairMutex _mutex;\n    bool _cancel;\n\n    RLMRealmConfiguration *_configuration;\n    RLMScheduler *_scheduler;\n    void (^_completion)(NSError *);\n\n    RLMRealm *_backgroundRealm;\n}\n\n- (void)cancel {\n    std::lock_guard lock(_mutex);\n    _cancel = true;\n}\n\n- (instancetype)initWithConfiguration:(RLMRealmConfiguration *)configuration\n                           confinedTo:(RLMScheduler *)scheduler {\n    if (!(self = [super init])) {\n        return self;\n    }\n\n    // Copying the configuration here as the user could potentially modify\n    // the config after calling async open\n    _configuration = configuration.copy;\n    _scheduler = scheduler;\n\n    return self;\n}\n\n- (instancetype)initWithConfiguration:(RLMRealmConfiguration *)configuration\n                           confinedTo:(RLMScheduler *)confinement\n                           completion:(RLMAsyncOpenRealmCallback)completion {\n    self = [self initWithConfiguration:configuration confinedTo:confinement];\n    [self waitForOpen:completion];\n    return self;\n}\n\n- (void)waitForOpen:(RLMAsyncOpenRealmCallback)completion {\n    __weak auto weakSelf = self;\n    [self waitWithCompletion:^(NSError *error) {\n        RLMRealm *realm;\n        if (auto self = weakSelf) {\n            realm = self->_localRealm;\n            self->_localRealm = nil;\n        }\n        completion(realm, error);\n    }];\n}\n\n- (void)waitWithCompletion:(void (^)(NSError *))completion {\n    std::lock_guard lock(_mutex);\n    _completion = completion;\n    if (_cancel) {\n        return [self reportError:s_canceledError];\n    }\n\n    dispatch_async(s_async_open_queue, ^{\n        @autoreleasepool {\n            [self startAsyncOpen];\n        }\n    });\n}\n\n- (void)startAsyncOpen {\n    std::unique_lock lock(_mutex);\n    if ([self checkCancellation]) {\n        return;\n    }\n\n    NSError *error;\n    @autoreleasepool {\n        // Holding onto the Realm so that opening the final Realm on the target\n        // scheduler can hit the fast path\n        _backgroundRealm = [RLMRealm realmWithConfiguration:_configuration\n                                                 confinedTo:RLMScheduler.currentRunLoop error:&error];\n        if (error) {\n            return [self reportError:error];\n        }\n    }\n    if ([self checkCancellation]) {\n        return;\n    }\n\n    [_scheduler invoke:^{\n        [self openFinalRealmAndCallCompletion];\n    }];\n}\n\n- (void)openFinalRealmAndCallCompletion {\n    std::unique_lock lock(_mutex);\n    @autoreleasepool {\n        if ([self checkCancellation]) {\n            return;\n        }\n        if (!_completion) {\n            return;\n        }\n        NSError *error;\n        auto completion = _completion;\n        // It should not actually be possible for this to fail\n        _localRealm = [RLMRealm realmWithConfiguration:_configuration\n                                            confinedTo:_scheduler\n                                                 error:&error];\n        [self releaseResources];\n\n        lock.unlock();\n        completion(error);\n    }\n}\n\n- (bool)checkCancellation {\n    if (_cancel && _completion) {\n        [self reportError:s_canceledError];\n    }\n    return _cancel;\n}\n\n- (void)reportException:(std::exception_ptr const&)err {\n    try {\n        std::rethrow_exception(err);\n    }\n    catch (realm::Exception const& e) {\n        if (e.code() == realm::ErrorCodes::OperationAborted) {\n            return [self reportError:s_canceledError];\n        }\n        [self reportError:makeError(e)];\n    }\n    catch (...) {\n        NSError *error;\n        RLMRealmTranslateException(&error);\n        [self reportError:error];\n    }\n}\n\n- (void)reportError:(NSError *)error {\n    if (!_completion || !_scheduler) {\n        return;\n    }\n\n    auto completion = _completion;\n    auto scheduler = _scheduler;\n    [self releaseResources];\n    [scheduler invoke:^{\n        completion(error);\n    }];\n}\n\n- (void)releaseResources {\n    _backgroundRealm = nil;\n    _configuration = nil;\n    _scheduler = nil;\n    _completion = nil;\n}\n@end\n\n__attribute__((objc_direct_members))\n@implementation RLMAsyncRefreshTask {\n    RLMUnfairMutex _mutex;\n    void (^_completion)(bool);\n    bool _complete;\n    bool _didRefresh;\n}\n\n- (void)complete:(bool)didRefresh {\n    void (^completion)(bool);\n    {\n        std::lock_guard lock(_mutex);\n        std::swap(completion, _completion);\n        _complete = true;\n        // If we're both cancelled and did complete a refresh then continue\n        // to report true\n        _didRefresh = _didRefresh || didRefresh;\n    }\n    if (completion) {\n        completion(didRefresh);\n    }\n}\n\n- (void)wait:(void (^)(bool))completion {\n    bool didRefresh;\n    {\n        std::lock_guard lock(_mutex);\n        if (!_complete) {\n            _completion = completion;\n            return;\n        }\n        didRefresh = _didRefresh;\n    }\n    completion(didRefresh);\n}\n\n+ (RLMAsyncRefreshTask *)completedRefresh {\n    static RLMAsyncRefreshTask *shared = [] {\n        auto refresh = [[RLMAsyncRefreshTask alloc] init];\n        refresh->_complete = true;\n        refresh->_didRefresh = true;\n        return refresh;\n    }();\n    return shared;\n}\n@end\n\n@implementation RLMAsyncWriteTask {\n    // Mutex guards _realm and _completion\n    RLMUnfairMutex _mutex;\n\n    // _realm is non-nil only while waiting for an async write to begin. It is\n    // set to `nil` when it either completes or is cancelled.\n    RLMRealm *_realm;\n    dispatch_block_t _completion;\n\n    RLMAsyncTransactionId _id;\n}\n\n// No locking needed for these two as they have to be called before the\n// cancellation handler is set up\n- (instancetype)initWithRealm:(RLMRealm *)realm {\n    if (self = [super init]) {\n        _realm = realm;\n    }\n    return self;\n}\n- (void)setTransactionId:(RLMAsyncTransactionId)transactionID {\n    _id = transactionID;\n}\n\n- (void)complete:(bool)cancel {\n    // The swap-under-lock pattern is used to avoid invoking the callback with\n    // a lock held\n    dispatch_block_t completion;\n    {\n        std::lock_guard lock(_mutex);\n        std::swap(completion, _completion);\n        if (cancel) {\n            // This is a no-op if cancellation is coming after the wait completed\n            [_realm cancelAsyncTransaction:_id];\n        }\n        _realm = nil;\n    }\n    if (completion) {\n        completion();\n    }\n}\n\n- (void)wait:(void (^)())completion {\n    {\n        std::lock_guard lock(_mutex);\n        // `_realm` being non-nil means it's neither completed nor been cancelled\n        if (_realm) {\n            _completion = completion;\n            return;\n        }\n    }\n\n    // It has either been completed or cancelled, so call the callback immediately\n    completion();\n}\n@end\n"
  },
  {
    "path": "Realm/RLMAsyncTask_Private.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2023 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMAsyncTask.h>\n\n#import \"RLMRealm_Private.h\"\n\nRLM_HEADER_AUDIT_BEGIN(nullability)\n\n@interface RLMAsyncOpenTask ()\n@property (nonatomic, nullable) RLMRealm *localRealm;\n\n- (instancetype)initWithConfiguration:(RLMRealmConfiguration *)configuration\n                           confinedTo:(RLMScheduler *)confinement\n                           completion:(RLMAsyncOpenRealmCallback)completion\n__attribute__((objc_direct));\n\n- (instancetype)initWithConfiguration:(RLMRealmConfiguration *)configuration\n                           confinedTo:(RLMScheduler *)confinement;\n\n- (void)waitWithCompletion:(void (^)(NSError *_Nullable))completion;\n- (void)waitForOpen:(RLMAsyncOpenRealmCallback)completion __attribute__((objc_direct));\n@end\n\n// A cancellable task for beginning an async write\nNS_SWIFT_SENDABLE\n@interface RLMAsyncWriteTask : NSObject\n// Must only be called from within the Actor\n- (instancetype)initWithRealm:(RLMRealm *)realm;\n- (void)setTransactionId:(RLMAsyncTransactionId)transactionID;\n- (void)complete:(bool)cancel;\n\n// Can be called from any thread\n- (void)wait:(void (^)(void))completion;\n@end\n\ntypedef void (^RLMAsyncRefreshCompletion)(bool);\n// A cancellable task for refreshing a Realm\nNS_SWIFT_SENDABLE\n@interface RLMAsyncRefreshTask : NSObject\n- (void)complete:(bool)didRefresh;\n- (void)wait:(RLMAsyncRefreshCompletion)completion;\n+ (RLMAsyncRefreshTask *)completedRefresh;\n@end\n\nRLM_HEADER_AUDIT_END(nullability)\n"
  },
  {
    "path": "Realm/RLMClassInfo.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2016 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\n#import <realm/table_ref.hpp>\n#import <realm/util/optional.hpp>\n\n#import <unordered_map>\n#import <vector>\n\nnamespace realm {\n    class ObjectSchema;\n    class Schema;\n    struct Property;\n    struct ColKey;\n    struct TableKey;\n}\n\nclass RLMObservationInfo;\n@class RLMRealm, RLMSchema, RLMObjectSchema, RLMProperty;\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\nnamespace std {\n// Add specializations so that NSString can be used as the key for hash containers\ntemplate<> struct hash<NSString *> {\n    size_t operator()(__unsafe_unretained NSString *const str) const {\n        return [str hash];\n    }\n};\ntemplate<> struct equal_to<NSString *> {\n    bool operator()(__unsafe_unretained NSString * lhs, __unsafe_unretained NSString *rhs) const {\n        return [lhs isEqualToString:rhs];\n    }\n};\n}\n\n// The per-RLMRealm object schema information which stores the cached table\n// reference, handles table column lookups, and tracks observed objects\nclass RLMClassInfo {\npublic:\n    RLMClassInfo(RLMRealm *, RLMObjectSchema *, const realm::ObjectSchema *);\n\n    RLMClassInfo(RLMRealm *realm, RLMObjectSchema *rlmObjectSchema,\n                 std::unique_ptr<realm::ObjectSchema> objectSchema);\n\n    __unsafe_unretained RLMRealm *const realm;\n    __unsafe_unretained RLMObjectSchema *const rlmObjectSchema;\n    const realm::ObjectSchema *const objectSchema;\n\n    // Storage for the functionality in RLMObservation for handling indirect\n    // changes to KVO-observed things\n    std::vector<RLMObservationInfo *> observedObjects;\n\n    // Get the table for this object type. Will return nullptr only if it's a\n    // read-only Realm that is missing the table entirely.\n    realm::TableRef table() const;\n\n    // Get the RLMProperty for a given table column, or `nil` if it is a column\n    // not used by the current schema\n    RLMProperty *_Nullable propertyForTableColumn(realm::ColKey) const noexcept;\n\n    // Get the RLMProperty that's used as the primary key, or `nil` if there is\n    // no primary key for the current schema\n    RLMProperty *_Nullable propertyForPrimaryKey() const noexcept;\n\n    // Get the table column for the given property. The property must be a valid\n    // persisted property.\n    realm::ColKey tableColumn(NSString *propertyName) const;\n    realm::ColKey tableColumn(RLMProperty *property) const;\n    // Get the table column key for the given computed property. The property\n    // must be a valid computed property.\n    // Subscripting a `realm::ObjectSchema->computed_properties[property.index]`\n    // does not return a valid colKey, unlike subscripting persisted_properties.\n    // This method retrieves a valid column key for computed properties by\n    // getting the opposite table column of the origin's \"forward\" link.\n    realm::ColKey computedTableColumn(RLMProperty *property) const;\n\n    // Get the info for the target of the link at the given property index.\n    RLMClassInfo &linkTargetType(size_t propertyIndex);\n\n    // Get the info for the target of the given property\n    RLMClassInfo &linkTargetType(realm::Property const& property);\n\n    // Get the corresponding ClassInfo for the given Realm\n    RLMClassInfo &resolve(RLMRealm *);\n\n    // Return true if the RLMObjectSchema is for a Swift class\n    bool isSwiftClass() const noexcept;\n\n    // Returns true if this was a dynamically added type\n    bool isDynamic() const noexcept;\n\n    // KeyPathFromString converts a string keypath to a vector of key\n    // pairs to be used for deep change checking across links.\n    std::optional<std::vector<std::vector<std::pair<realm::TableKey, realm::ColKey>>>>\n    keyPathArrayFromStringArray(NSArray<NSString *> *keyPaths) const;\n\nprivate:\n    // If the ObjectSchema is not owned by the realm instance\n    // we need to manually manage the ownership of the object.\n    std::unique_ptr<realm::ObjectSchema> dynamicObjectSchema;\n    [[maybe_unused]] RLMObjectSchema *_Nullable dynamicRLMObjectSchema;\n};\n\n// A per-RLMRealm object schema map which stores RLMClassInfo keyed on the name\nclass RLMSchemaInfo {\n    using impl = std::unordered_map<NSString *, RLMClassInfo>;\n\npublic:\n    RLMSchemaInfo() = default;\n    RLMSchemaInfo(RLMRealm *realm);\n\n    RLMSchemaInfo clone(realm::Schema const& source_schema, RLMRealm *target_realm);\n\n    // Look up by name, throwing if it's not present\n    RLMClassInfo& operator[](NSString *name);\n    // Look up by table key, return none if its not present.\n    RLMClassInfo* operator[](realm::TableKey tableKey);\n\n    // Emplaces a locally derived object schema into RLMSchemaInfo. This is used\n    // when creating objects dynamically that are not registered in the Cocoa schema.\n    // Note: `RLMClassInfo` assumes ownership of `schema`.\n    void appendDynamicObjectSchema(std::unique_ptr<realm::ObjectSchema> schema,\n                                   RLMObjectSchema *objectSchema,\n                                   RLMRealm *const target_realm);\n\n    impl::iterator begin() noexcept;\n    impl::iterator end() noexcept;\n    impl::const_iterator begin() const noexcept;\n    impl::const_iterator end() const noexcept;\n\nprivate:\n    std::unordered_map<NSString *, RLMClassInfo> m_objects;\n};\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMClassInfo.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2016 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMClassInfo.hpp\"\n\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMSchema.h\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMQueryUtil.hpp\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/object-store/object_schema.hpp>\n#import <realm/object-store/object_store.hpp>\n#import <realm/object-store/schema.hpp>\n#import <realm/object-store/shared_realm.hpp>\n#import <realm/table.hpp>\n\nusing namespace realm;\n\nRLMClassInfo::RLMClassInfo(__unsafe_unretained RLMRealm *const realm,\n                           __unsafe_unretained RLMObjectSchema *const rlmObjectSchema,\n                           const realm::ObjectSchema *objectSchema)\n: realm(realm), rlmObjectSchema(rlmObjectSchema), objectSchema(objectSchema) { }\n\nRLMClassInfo::RLMClassInfo(RLMRealm *realm, RLMObjectSchema *rlmObjectSchema,\n                           std::unique_ptr<realm::ObjectSchema> schema)\n: realm(realm)\n, rlmObjectSchema(rlmObjectSchema)\n, objectSchema(&*schema)\n, dynamicObjectSchema(std::move(schema))\n, dynamicRLMObjectSchema(rlmObjectSchema)\n{ }\n\nrealm::TableRef RLMClassInfo::table() const {\n    if (auto key = objectSchema->table_key) {\n        return realm.group.get_table(objectSchema->table_key);\n    }\n    return nullptr;\n}\n\nRLMProperty *RLMClassInfo::propertyForTableColumn(ColKey col) const noexcept {\n    auto const& props = objectSchema->persisted_properties;\n    for (size_t i = 0; i < props.size(); ++i) {\n        if (props[i].column_key == col) {\n            return rlmObjectSchema.properties[i];\n        }\n    }\n    return nil;\n}\n\nRLMProperty *RLMClassInfo::propertyForPrimaryKey() const noexcept {\n    return rlmObjectSchema.primaryKeyProperty;\n}\n\nrealm::ColKey RLMClassInfo::tableColumn(NSString *propertyName) const {\n    return tableColumn(RLMValidatedProperty(rlmObjectSchema, propertyName));\n}\n\nrealm::ColKey RLMClassInfo::tableColumn(RLMProperty *property) const {\n    return objectSchema->persisted_properties[property.index].column_key;\n}\n\nrealm::ColKey RLMClassInfo::computedTableColumn(RLMProperty *property) const {\n    // Retrieve the table key and class info for the origin property\n    // that corresponds to the target property.\n    RLMClassInfo& originInfo = realm->_info[property.objectClassName];\n    TableKey originTableKey = originInfo.objectSchema->table_key;\n\n    TableRef originTable = realm.group.get_table(originTableKey);\n    // Get the column key for origin's forward link that links to the property on the target.\n    ColKey forwardLinkKey = originInfo.tableColumn(property.linkOriginPropertyName);\n\n    // The column key opposite of the origin's forward link is the target's backlink property.\n    return originTable->get_opposite_column(forwardLinkKey);\n}\n\nRLMClassInfo &RLMClassInfo::linkTargetType(size_t propertyIndex) {\n    return realm->_info[rlmObjectSchema.properties[propertyIndex].objectClassName];\n}\n\nRLMClassInfo &RLMClassInfo::linkTargetType(realm::Property const& property) {\n    REALM_ASSERT(property.type == PropertyType::Object);\n    return linkTargetType(&property - &objectSchema->persisted_properties[0]);\n}\n\nRLMClassInfo &RLMClassInfo::resolve(__unsafe_unretained RLMRealm *const realm) {\n    return realm->_info[rlmObjectSchema.className];\n}\n\nbool RLMClassInfo::isSwiftClass() const noexcept {\n    return rlmObjectSchema.isSwiftClass;\n}\n\nbool RLMClassInfo::isDynamic() const noexcept {\n    return !!dynamicObjectSchema;\n}\n\nstatic KeyPath keyPathFromString(RLMRealm *realm,\n                                 RLMSchema *schema,\n                                 const RLMClassInfo *info,\n                                 RLMObjectSchema *rlmObjectSchema,\n                                 NSString *keyPath) {\n    KeyPath keyPairs;\n\n    for (NSString *component in [keyPath componentsSeparatedByString:@\".\"]) {\n        RLMProperty *property = rlmObjectSchema[component];\n        if (!property) {\n            throw RLMException(@\"Invalid property name: property '%@' not found in object of type '%@'\",\n                               component, rlmObjectSchema.className);\n        }\n\n        TableKey tk = info->objectSchema->table_key;\n        ColKey ck;\n        if (property.type == RLMPropertyTypeObject) {\n            ck = info->tableColumn(property.name);\n            info = &realm->_info[property.objectClassName];\n            rlmObjectSchema = schema[property.objectClassName];\n        } else if (property.type == RLMPropertyTypeLinkingObjects) {\n            ck = info->computedTableColumn(property);\n            info = &realm->_info[property.objectClassName];\n            rlmObjectSchema = schema[property.objectClassName];\n        } else {\n            ck = info->tableColumn(property.name);\n        }\n\n        keyPairs.emplace_back(tk, ck);\n    }\n    return keyPairs;\n}\n\nstd::optional<realm::KeyPathArray> RLMClassInfo::keyPathArrayFromStringArray(NSArray<NSString *> *keyPaths) const {\n    std::optional<KeyPathArray> keyPathArray;\n    if (keyPaths) {\n        keyPathArray.emplace();\n        for (NSString *keyPath in keyPaths) {\n            keyPathArray->push_back(keyPathFromString(realm, realm.schema, this,\n                                                      rlmObjectSchema, keyPath));\n        }\n    }\n    return keyPathArray;\n}\n\nRLMSchemaInfo::impl::iterator RLMSchemaInfo::begin() noexcept { return m_objects.begin(); }\nRLMSchemaInfo::impl::iterator RLMSchemaInfo::end() noexcept { return m_objects.end(); }\nRLMSchemaInfo::impl::const_iterator RLMSchemaInfo::begin() const noexcept { return m_objects.begin(); }\nRLMSchemaInfo::impl::const_iterator RLMSchemaInfo::end() const noexcept { return m_objects.end(); }\n\nRLMClassInfo& RLMSchemaInfo::operator[](NSString *name) {\n    auto it = m_objects.find(name);\n    if (it == m_objects.end()) {\n        @throw RLMException(@\"Object type '%@' is not managed by the Realm. \"\n                            @\"If using a custom `objectClasses` / `objectTypes` array in your configuration, \"\n                            @\"add `%@` to the list of `objectClasses` / `objectTypes`.\",\n                            name, name);\n    }\n    return *&it->second;\n}\n\nRLMClassInfo* RLMSchemaInfo::operator[](realm::TableKey key) {\n    for (auto& [name, info] : m_objects) {\n        if (info.objectSchema->table_key == key)\n            return &info;\n    }\n    return nullptr;\n}\n\nRLMSchemaInfo::RLMSchemaInfo(RLMRealm *realm) {\n    RLMSchema *rlmSchema = realm.schema;\n    realm::Schema const& schema = realm->_realm->schema();\n    // rlmSchema can be larger due to multiple classes backed by one table\n    REALM_ASSERT(rlmSchema.objectSchema.count >= schema.size());\n\n    m_objects.reserve(schema.size());\n    for (RLMObjectSchema *rlmObjectSchema in rlmSchema.objectSchema) {\n        auto it = schema.find(rlmObjectSchema.objectStoreName);\n        if (it == schema.end()) {\n            continue;\n        }\n        m_objects.emplace(std::piecewise_construct,\n                          std::forward_as_tuple(rlmObjectSchema.className),\n                          std::forward_as_tuple(realm, rlmObjectSchema,\n                                                &*it));\n    }\n}\n\nRLMSchemaInfo RLMSchemaInfo::clone(realm::Schema const& source_schema,\n                                   __unsafe_unretained RLMRealm *const target_realm) {\n    RLMSchemaInfo info;\n    info.m_objects.reserve(m_objects.size());\n\n    auto& schema = target_realm->_realm->schema();\n    REALM_ASSERT_DEBUG(schema == source_schema);\n    for (auto& [name, class_info] : m_objects) {\n        if (class_info.isDynamic()) {\n            continue;\n        }\n        size_t idx = class_info.objectSchema - &*source_schema.begin();\n        info.m_objects.emplace(std::piecewise_construct,\n                               std::forward_as_tuple(name),\n                               std::forward_as_tuple(target_realm, class_info.rlmObjectSchema,\n                                                     &*schema.begin() + idx));\n    }\n    return info;\n}\n\nvoid RLMSchemaInfo::appendDynamicObjectSchema(std::unique_ptr<realm::ObjectSchema> schema,\n                                              RLMObjectSchema *objectSchema,\n                                              __unsafe_unretained RLMRealm *const target_realm) {\n    m_objects.emplace(std::piecewise_construct,\n                      std::forward_as_tuple(objectSchema.className),\n                      std::forward_as_tuple(target_realm, objectSchema,\n                                            std::move(schema)));\n}\n"
  },
  {
    "path": "Realm/RLMCollection.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n#import <Realm/RLMThreadSafeReference.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@protocol RLMValue;\n@class RLMRealm, RLMResults, RLMSortDescriptor, RLMNotificationToken, RLMCollectionChange, RLMSectionedResults;\ntypedef NS_CLOSED_ENUM(int32_t, RLMPropertyType);\n/// A callback which is invoked on each element in the Results collection which returns the section key.\ntypedef id<RLMValue> _Nullable(^RLMSectionedResultsKeyBlock)(id);\n\n/**\n A homogenous collection of Realm-managed objects. Examples of conforming types\n include `RLMArray`, `RLMSet`, `RLMResults`, and `RLMLinkingObjects`.\n */\n@protocol RLMCollection <NSFastEnumeration, RLMThreadConfined>\n\n#pragma mark - Properties\n\n/**\n The number of objects in the collection.\n */\n@property (nonatomic, readonly) NSUInteger count;\n\n/**\n The type of the objects in the collection.\n */\n@property (nonatomic, readonly) RLMPropertyType type;\n\n/**\n Indicates whether the objects in the collection can be `nil`.\n */\n@property (nonatomic, readonly, getter = isOptional) BOOL optional;\n\n/**\n The class name  of the objects contained in the collection.\n\n Will be `nil` if `type` is not RLMPropertyTypeObject.\n */\n@property (nonatomic, readonly, copy, nullable) NSString *objectClassName;\n\n/**\n The Realm which manages this collection, if any.\n */\n@property (nonatomic, readonly, nullable) RLMRealm *realm;\n\n/**\n Indicates if the collection is no longer valid.\n\n The collection becomes invalid if `invalidate` is called on the managing\n Realm. Unmanaged collections are never invalidated.\n */\n@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated;\n\n#pragma mark - Accessing Objects from a Collection\n\n/**\n Returns the object at the index specified.\n\n @param index   The index to look up.\n\n @return An object of the type contained in the collection.\n */\n- (id)objectAtIndex:(NSUInteger)index;\n\n@optional\n\n/**\n Returns an array containing the objects in the collection at the indexes\n specified by a given index set. `nil` will be returned if the index set\n contains an index out of the collections bounds.\n\n @param indexes The indexes in the collection to retrieve objects from.\n\n @return The objects at the specified indexes.\n */\n- (nullable NSArray *)objectsAtIndexes:(NSIndexSet *)indexes;\n\n/**\n Returns the first object in the collection.\n\n RLMSet is not ordered, and so for sets this will return an arbitrary object in\n the set. It is not guaraneed to be a different object from what `lastObject`\n gives even if the set has multiple objects in it.\n\n Returns `nil` if called on an empty collection.\n\n @return An object of the type contained in the collection.\n */\n- (nullable id)firstObject;\n\n/**\n Returns the last object in the collection.\n\n RLMSet is not ordered, and so for sets this will return an arbitrary object in\n the set. It is not guaraneed to be a different object from what `firstObject`\n gives even if the set has multiple objects in it.\n\n Returns `nil` if called on an empty collection.\n\n @return An object of the type contained in the collection.\n */\n- (nullable id)lastObject;\n\n/// :nodoc:\n- (id)objectAtIndexedSubscript:(NSUInteger)index;\n\n/**\n Returns the index of an object in the collection.\n\n Returns `NSNotFound` if the object is not found in the collection.\n\n @param object  An object (of the same type as returned from the `objectClassName` selector).\n */\n- (NSUInteger)indexOfObject:(id)object;\n\n/**\n Returns the index of the first object in the collection matching the predicate.\n\n @param predicateFormat A predicate format string, optionally followed by a variable number of arguments.\n\n @return    The index of the object, or `NSNotFound` if the object is not found in the collection.\n */\n- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat, ...;\n\n/// :nodoc:\n- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args;\n\n/**\n Returns the index of the first object in the collection matching the predicate.\n\n @param predicate   The predicate with which to filter the objects.\n\n @return    The index of the object, or `NSNotFound` if the object is not found in the collection.\n */\n- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicate;\n\n@required\n\n#pragma mark - Querying a Collection\n\n/**\n Returns all objects matching the given predicate in the collection.\n\n This is only supported for managed collections.\n\n @param predicateFormat A predicate format string, optionally followed by a variable number of arguments.\n @return    An `RLMResults` containing objects that match the given predicate.\n */\n- (RLMResults *)objectsWhere:(NSString *)predicateFormat, ...;\n\n/// :nodoc:\n- (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args;\n\n/**\n Returns all objects matching the given predicate in the collection.\n\n This is only supported for managed collections.\n\n @param predicate   The predicate with which to filter the objects.\n @return            An `RLMResults` containing objects that match the given predicate.\n */\n- (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate;\n\n/**\n Returns a sorted `RLMResults` from the collection.\n\n This is only supported for managed collections.\n\n @param keyPath     The keyPath to sort by.\n @param ascending   The direction to sort in.\n @return    An `RLMResults` sorted by the specified key path.\n */\n- (RLMResults *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending;\n\n/**\n Returns a sorted `RLMResults` from the collection.\n\n This is only supported for managed collections.\n\n @param properties  An array of `RLMSortDescriptor`s to sort by.\n @return    An `RLMResults` sorted by the specified properties.\n */\n- (RLMResults *)sortedResultsUsingDescriptors:(NSArray<RLMSortDescriptor *> *)properties;\n\n/**\n Returns a distinct `RLMResults` from the collection.\n\n This is only supported for managed collections.\n\n @param keyPaths  The key paths used produce distinct results\n @return    An `RLMResults` made distinct based on the specified key paths\n */\n- (RLMResults *)distinctResultsUsingKeyPaths:(NSArray<NSString *> *)keyPaths;\n\n/**\n Returns an `NSArray` containing the results of invoking `valueForKey:` using\n `key` on each of the collection's objects.\n\n @param key The name of the property.\n\n @return An `NSArray` containing results.\n */\n- (nullable id)valueForKey:(NSString *)key;\n\n/**\n Returns the value for the derived property identified by a given key path.\n\n @param keyPath A key path of the form relationship.property (with one or more relationships).\n\n @return The value for the derived property identified by keyPath.\n */\n- (nullable id)valueForKeyPath:(NSString *)keyPath;\n\n/**\n Invokes `setValue:forKey:` on each of the collection's objects using the specified `value` and `key`.\n\n @warning This method may only be called during a write transaction.\n\n @param value The object value.\n @param key   The name of the property.\n */\n- (void)setValue:(nullable id)value forKey:(NSString *)key;\n\n#pragma mark - Notifications\n\n/**\nRegisters a block to be called each time the collection changes.\n\nThe block will be asynchronously called with the initial collection,\nand then called again after each write transaction which changes either any\nof the objects in the collection, or which objects are in the collection.\n\nThe `change` parameter will be `nil` the first time the block is called.\nFor each call after that, it will contain information about\nwhich rows in the collection were added, removed or modified. If a\nwrite transaction did not modify any objects in the results collection,\nthe block is not called at all. See the `RLMCollectionChange` documentation for\ninformation on how the changes are reported and an example of updating a\n`UITableView`.\n\n The error parameter is present only for backwards compatibility and will always\n be `nil`.\n\nAt the time when the block is called, the collection object will be fully\nevaluated and up-to-date, and as long as you do not perform a write transaction\non the same thread or explicitly call `-[RLMRealm refresh]`, accessing it will\nnever perform blocking work.\n\nNotifications are delivered via the standard run loop, and so can't be\ndelivered while the run loop is blocked by other activity. When\nnotifications can't be delivered instantly, multiple notifications may be\ncoalesced into a single notification. This can include the notification\nwith the initial results. For example, the following code performs a write\ntransaction immediately after adding the notification block, so there is no\nopportunity for the initial notification to be delivered first. As a\nresult, the initial notification will reflect the state of the Realm after\nthe write transaction.\n\n RLMResults<Dog *> *results = [Dog allObjects];\n NSLog(@\"dogs.count: %zu\", dogs.count); // => 0\n self.token = [results addNotificationBlock:^(RLMResults *dogs,\n                                              RLMCollectionChange *changes,\n                                              NSError *error) {\n     // Only fired once for the example\n     NSLog(@\"dogs.count: %zu\", dogs.count); // => 1\n }];\n [realm transactionWithBlock:^{\n     Dog *dog = [[Dog alloc] init];\n     dog.name = @\"Rex\";\n     [realm addObject:dog];\n }];\n // end of run loop execution context\n\nYou must retain the returned token for as long as you want updates to continue\nto be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n@warning This method cannot be called during a write transaction, or when the\n         containing Realm is read-only or frozen.\n\n@param block The block to be called whenever a change occurs.\n@return A token which must be held for as long as you want updates to be delivered.\n*/\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults *_Nullable results,\n                                                         RLMCollectionChange *_Nullable change,\n                                                         NSError *_Nullable error))block\n__attribute__((warn_unused_result));\n\n/**\nRegisters a block to be called each time the collection changes.\n\nThe block will be asynchronously called with the initial collection,\nand then called again after each write transaction which changes either any\nof the objects in the collection, or which objects are in the collection.\n\nThe `change` parameter will be `nil` the first time the block is called.\nFor each call after that, it will contain information about\nwhich rows in the collection were added, removed or modified. If a\nwrite transaction did not modify any objects in the results collection,\nthe block is not called at all. See the `RLMCollectionChange` documentation for\ninformation on how the changes are reported and an example of updating a\n`UITableView`.\n\n The error parameter is present only for backwards compatibility and will always\n be `nil`.\n\nAt the time when the block is called, the collection object will be fully\nevaluated and up-to-date, and as long as you do not perform a write transaction\non the same thread or explicitly call `-[RLMRealm refresh]`, accessing it will\nnever perform blocking work.\n\nNotifications are delivered on the given queue. If the queue is blocked and\nnotifications can't be delivered instantly, multiple notifications may be\ncoalesced into a single notification.\n\nYou must retain the returned token for as long as you want updates to continue\nto be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n@warning This method cannot be called when the containing Realm is read-only or frozen.\n@warning The queue must be a serial queue.\n\n@param block The block to be called whenever a change occurs.\n@param queue The serial queue to deliver notifications to.\n@return A token which must be held for as long as you want updates to be delivered.\n*/\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults *_Nullable results,\n                                                         RLMCollectionChange *_Nullable change,\n                                                         NSError *_Nullable error))block\n                                         queue:(nullable dispatch_queue_t)queue\n__attribute__((warn_unused_result));\n\n/**\nRegisters a block to be called each time the collection changes.\n\nThe block will be asynchronously called with the initial collection,\nand then called again after each write transaction which changes either any\nof the objects in the collection, or which objects are in the collection.\n\nThe `change` parameter will be `nil` the first time the block is called.\nFor each call after that, it will contain information about\nwhich rows in the collection were added, removed or modified. If a\nwrite transaction did not modify any objects in the results collection,\nthe block is not called at all. See the `RLMCollectionChange` documentation for\ninformation on how the changes are reported and an example of updating a\n`UITableView`.\n\n The error parameter is present only for backwards compatibility and will always\n be `nil`.\n\nAt the time when the block is called, the collection object will be fully\nevaluated and up-to-date, and as long as you do not perform a write transaction\non the same thread or explicitly call `-[RLMRealm refresh]`, accessing it will\nnever perform blocking work.\n\nNotifications are delivered on the given queue. If the queue is blocked and\nnotifications can't be delivered instantly, multiple notifications may be\ncoalesced into a single notification.\n\nYou must retain the returned token for as long as you want updates to continue\nto be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n@warning This method cannot be called when the containing Realm is read-only or frozen.\n@warning The queue must be a serial queue.\n\n@param block The block to be called whenever a change occurs.\n@param queue The serial queue to deliver notifications to.\n@param keyPaths The block will be called for changes occurring on these keypaths. If no\nkey paths are given, notifications are delivered for every property key path.\n@return A token which must be held for as long as you want updates to be delivered.\n*/\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults *_Nullable results,\n                                                         RLMCollectionChange *_Nullable change,\n                                                         NSError *_Nullable error))block\n                                      keyPaths:(nullable NSArray<NSString *> *)keyPaths\n                                         queue:(nullable dispatch_queue_t)queue\n__attribute__((warn_unused_result));\n\n#pragma mark - Sectioned Results\n\n/**\n Sorts and sections this collection from a given property key path, returning the result\n as an instance of `RLMSectionedResults`.\n\n @param keyPath The property key path to sort on.\n @param ascending The direction to sort in.\n @param keyBlock  A callback which is invoked on each element in the Results collection.\n                 This callback is to return the section key for the element in the collection.\n\n @return An instance of RLMSectionedResults.\n */\n- (RLMSectionedResults *)sectionedResultsSortedUsingKeyPath:(NSString *)keyPath\n                                                  ascending:(BOOL)ascending\n                                                   keyBlock:(RLMSectionedResultsKeyBlock)keyBlock;\n\n/**\n Sorts and sections this collection from a given array of sort descriptors, returning the result\n as an instance of `RLMSectionedResults`.\n\n @param sortDescriptors  An array of `RLMSortDescriptor`s to sort by.\n @param keyBlock  A callback which is invoked on each element in the Results collection.\n                 This callback is to return the section key for the element in the collection.\n\n @note The primary sort descriptor must be responsible for determining the section key.\n\n @return An instance of RLMSectionedResults.\n */\n- (RLMSectionedResults *)sectionedResultsUsingSortDescriptors:(NSArray<RLMSortDescriptor *> *)sortDescriptors\n                                                     keyBlock:(RLMSectionedResultsKeyBlock)keyBlock;\n\n#pragma mark - Aggregating Property Values\n\n/**\n Returns the minimum (lowest) value of the given property among all the objects\n in the collection.\n\n     NSNumber *min = [results minOfProperty:@\"age\"];\n\n @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.\n\n @param property The property whose minimum value is desired. Only properties of\n                 types `int`, `float`, `double`, and `NSDate` are supported.\n\n @return The minimum value of the property, or `nil` if the Results are empty.\n */\n- (nullable id)minOfProperty:(NSString *)property;\n\n/**\n Returns the maximum (highest) value of the given property among all the objects\n in the collection.\n\n     NSNumber *max = [results maxOfProperty:@\"age\"];\n\n @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.\n\n @param property The property whose maximum value is desired. Only properties of\n                 types `int`, `float`, `double`, and `NSDate` are supported.\n\n @return The maximum value of the property, or `nil` if the Results are empty.\n */\n- (nullable id)maxOfProperty:(NSString *)property;\n\n/**\n Returns the sum of the values of a given property over all the objects in the collection.\n\n     NSNumber *sum = [results sumOfProperty:@\"age\"];\n\n @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.\n\n @param property The property whose values should be summed. Only properties of\n                 types `int`, `float`, and `double` are supported.\n\n @return The sum of the given property.\n */\n- (NSNumber *)sumOfProperty:(NSString *)property;\n\n/**\n Returns the average value of a given property over the objects in the collection.\n\n     NSNumber *average = [results averageOfProperty:@\"age\"];\n\n @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.\n\n @param property The property whose average value should be calculated. Only\n                 properties of types `int`, `float`, and `double` are supported.\n\n @return    The average value of the given property, or `nil` if the Results are empty.\n */\n- (nullable NSNumber *)averageOfProperty:(NSString *)property;\n\n#pragma mark - Freeze\n\n/**\n Indicates if the collection is frozen.\n\n Frozen collections are immutable and can be accessed from any thread. The\n objects read from a frozen collection will also be frozen.\n */\n@property (nonatomic, readonly, getter=isFrozen) BOOL frozen;\n\n/**\n Returns a frozen (immutable) snapshot of this collection.\n\n The frozen copy is an immutable collection which contains the same data as\n this collection currently contains, but will not update when writes are made\n to the containing Realm. Unlike live collections, frozen collections can be\n accessed from any thread.\n\n @warning This method cannot be called during a write transaction, or when the containing Realm is read-only.\n @warning Holding onto a frozen collection for an extended period while\n          performing write transaction on the Realm may result in the Realm\n          file growing to large sizes. See\n          `RLMRealmConfiguration.maximumNumberOfActiveVersions`\n          for more information.\n */\n- (instancetype)freeze;\n\n/**\n Returns a live version of this frozen collection.\n\n This method resolves a reference to a live copy of the same frozen collection.\n If called on a live collection, will return itself.\n*/\n- (instancetype)thaw;\n\n@end\n\n/**\n An `RLMSortDescriptor` stores a property name and a sort order for use with\n `sortedResultsUsingDescriptors:`. It is similar to `NSSortDescriptor`, but supports\n only the subset of functionality which can be efficiently run by Realm's query\n engine.\n\n `RLMSortDescriptor` instances are immutable.\n */\nNS_SWIFT_SENDABLE RLM_FINAL\n@interface RLMSortDescriptor : NSObject\n\n#pragma mark - Properties\n\n/**\n The key path which the sort descriptor orders results by.\n */\n@property (nonatomic, readonly) NSString *keyPath;\n\n/**\n Whether the descriptor sorts in ascending or descending order.\n */\n@property (nonatomic, readonly) BOOL ascending;\n\n#pragma mark - Methods\n\n/**\n Returns a new sort descriptor for the given key path and sort direction.\n */\n+ (instancetype)sortDescriptorWithKeyPath:(NSString *)keyPath ascending:(BOOL)ascending;\n\n/**\n Returns a copy of the receiver with the sort direction reversed.\n */\n- (instancetype)reversedSortDescriptor;\n\n@end\n\n/**\n A `RLMCollectionChange` object encapsulates information about changes to collections\n that are reported by Realm notifications.\n\n `RLMCollectionChange` is passed to the notification blocks registered with\n `-addNotificationBlock` on `RLMArray` and `RLMResults`, and reports what rows in the\n collection changed since the last time the notification block was called.\n\n The change information is available in two formats: a simple array of row\n indices in the collection for each type of change, and an array of index paths\n in a requested section suitable for passing directly to `UITableView`'s batch\n update methods. A complete example of updating a `UITableView` named `tv`:\n\n     [tv beginUpdates];\n     [tv deleteRowsAtIndexPaths:[changes deletionsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic];\n     [tv insertRowsAtIndexPaths:[changes insertionsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic];\n     [tv reloadRowsAtIndexPaths:[changes modificationsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic];\n     [tv endUpdates];\n\n All of the arrays in an `RLMCollectionChange` are always sorted in ascending order.\n */\n@interface RLMCollectionChange : NSObject\n/// The indices of objects in the previous version of the collection which have\n/// been removed from this one.\n@property (nonatomic, readonly) NSArray<NSNumber *> *deletions;\n\n/// The indices in the new version of the collection which were newly inserted.\n@property (nonatomic, readonly) NSArray<NSNumber *> *insertions;\n\n/**\n The indices in the new version of the collection which were modified.\n\n For `RLMResults`, this means that one or more of the properties of the object at\n that index were modified (or an object linked to by that object was\n modified).\n\n For `RLMArray`, the array itself being modified to contain a\n different object at that index will also be reported as a modification.\n */\n@property (nonatomic, readonly) NSArray<NSNumber *> *modifications;\n\n/// Returns the index paths of the deletion indices in the given section.\n- (NSArray<NSIndexPath *> *)deletionsInSection:(NSUInteger)section;\n\n/// Returns the index paths of the insertion indices in the given section.\n- (NSArray<NSIndexPath *> *)insertionsInSection:(NSUInteger)section;\n\n/// Returns the index paths of the modification indices in the given section.\n- (NSArray<NSIndexPath *> *)modificationsInSection:(NSUInteger)section;\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMCollection.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2016 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMCollection_Private.hpp\"\n\n#import \"RLMAccessor.hpp\"\n#import \"RLMArray_Private.hpp\"\n#import \"RLMDictionary_Private.hpp\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMObjectStore.h\"\n#import \"RLMObject_Private.hpp\"\n#import \"RLMObservation.hpp\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMSet_Private.hpp\"\n#import \"RLMSwiftCollectionBase.h\"\n\n#import <realm/object-store/dictionary.hpp>\n#import <realm/object-store/list.hpp>\n#import <realm/object-store/results.hpp>\n#import <realm/object-store/set.hpp>\n\nstatic const int RLMEnumerationBufferSize = 16;\n\n@implementation RLMFastEnumerator {\n    // The buffer supplied by fast enumeration does not retain the objects given\n    // to it, but because we create objects on-demand and don't want them\n    // autoreleased (a table can have more rows than the device has memory for\n    // accessor objects) we need a thing to retain them.\n    id _strongBuffer[RLMEnumerationBufferSize];\n\n    RLMRealm *_realm;\n    RLMClassInfo *_info;\n    RLMClassInfo *_parentInfo;\n    RLMProperty *_property;\n\n    // A pointer to either _snapshot or a Results from the source collection,\n    // to avoid having to copy the Results when not in a write transaction\n    realm::Results *_results;\n    realm::Results _snapshot;\n\n    // A strong reference to the collection being enumerated to ensure it stays\n    // alive when we're holding a pointer to a member in it\n    id _collection;\n}\n\n- (instancetype)initWithBackingCollection:(realm::object_store::Collection const&)backingCollection\n                               collection:(id)collection\n                                classInfo:(RLMClassInfo *)info\n                               parentInfo:(RLMClassInfo *)parentInfo\n                                 property:(RLMProperty *)property {\n    self = [super init];\n    if (self) {\n        _info = info;\n        _realm = _info->realm;\n        _parentInfo = parentInfo;\n        _property = property;\n\n        if (_realm.inWriteTransaction) {\n            _snapshot = backingCollection.as_results().snapshot();\n        }\n        else {\n            _snapshot = backingCollection.as_results();\n            _collection = collection;\n            [_realm registerEnumerator:self];\n        }\n        _results = &_snapshot;\n    }\n    return self;\n}\n\n- (instancetype)initWithBackingDictionary:(realm::object_store::Dictionary const&)backingDictionary\n                               dictionary:(RLMManagedDictionary *)dictionary\n                                classInfo:(RLMClassInfo *)info\n                               parentInfo:(RLMClassInfo *)parentInfo\n                                 property:(RLMProperty *)property {\n    self = [super init];\n    if (self) {\n        _info = info;\n        _realm = _info->realm;\n        _parentInfo = parentInfo;\n        _property = property;\n\n        if (_realm.inWriteTransaction) {\n            _snapshot = backingDictionary.get_keys().snapshot();\n        }\n        else {\n            _snapshot = backingDictionary.get_keys();\n            _collection = dictionary;\n            [_realm registerEnumerator:self];\n        }\n        _results = &_snapshot;\n    }\n    return self;\n}\n\n- (instancetype)initWithResults:(realm::Results&)results\n                     collection:(id)collection\n                      classInfo:(RLMClassInfo&)info {\n    self = [super init];\n    if (self) {\n        _info = &info;\n        _realm = _info->realm;\n        if (_realm.inWriteTransaction) {\n            _snapshot = results.snapshot();\n            _results = &_snapshot;\n        }\n        else {\n            _results = &results;\n            _collection = collection;\n            [_realm registerEnumerator:self];\n        }\n    }\n    return self;\n}\n\n- (void)dealloc {\n    if (_collection) {\n        [_realm unregisterEnumerator:self];\n    }\n}\n\n- (void)detach {\n    _snapshot = _results->snapshot();\n    _results = &_snapshot;\n    _collection = nil;\n}\n\n- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state\n                                    count:(NSUInteger)len {\n    [_realm verifyThread];\n    if (!_results->is_valid()) {\n        @throw RLMException(@\"Collection is no longer valid\");\n    }\n    // The fast enumeration buffer size is currently a hardcoded number in the\n    // compiler so this can't actually happen, but just in case it changes in\n    // the future...\n    if (len > RLMEnumerationBufferSize) {\n        len = RLMEnumerationBufferSize;\n    }\n\n    NSUInteger batchCount = 0, count = state->extra[1];\n\n    @autoreleasepool {\n        auto ctx = _parentInfo ? RLMAccessorContext(*_parentInfo, *_info, _property) :\n        RLMAccessorContext(*_info);\n        for (NSUInteger index = state->state; index < count && batchCount < len; ++index) {\n            _strongBuffer[batchCount] = _results->get(ctx, index);\n            batchCount++;\n        }\n    }\n\n    for (NSUInteger i = batchCount; i < len; ++i) {\n        _strongBuffer[i] = nil;\n    }\n\n    if (batchCount == 0) {\n        // Release our data if we're done, as we're autoreleased and so may\n        // stick around for a while\n        if (_collection) {\n            _collection = nil;\n            [_realm unregisterEnumerator:self];\n        }\n\n        _snapshot = {};\n    }\n\n    state->itemsPtr = (__unsafe_unretained id *)(void *)_strongBuffer;\n    state->state += batchCount;\n    state->mutationsPtr = state->extra+1;\n\n    return batchCount;\n}\n@end\n\nNSUInteger RLMFastEnumerate(NSFastEnumerationState *state,\n                            NSUInteger len,\n                            id<RLMCollectionPrivate> collection) {\n    __autoreleasing RLMFastEnumerator *enumerator;\n    if (state->state == 0) {\n        enumerator = collection.fastEnumerator;\n        state->extra[0] = (long)enumerator;\n        state->extra[1] = collection.count;\n    }\n    else {\n        enumerator = (__bridge id)(void *)state->extra[0];\n    }\n\n    return [enumerator countByEnumeratingWithState:state count:len];\n}\n\n@interface RLMArrayHolder : NSObject\n@end\n@implementation RLMArrayHolder {\n    std::unique_ptr<id[]> items;\n}\n\nNSUInteger RLMUnmanagedFastEnumerate(id collection, NSFastEnumerationState *state) {\n    if (state->state != 0) {\n        return 0;\n    }\n\n    // We need to enumerate a copy of the backing array so that it doesn't\n    // reflect changes made during enumeration. This copy has to be autoreleased\n    // (since there's nowhere for us to store a strong reference), and uses\n    // RLMArrayHolder rather than an NSArray because NSArray doesn't guarantee\n    // that it'll use a single contiguous block of memory, and if it doesn't\n    // we'd need to forward multiple calls to this method to the same NSArray,\n    // which would require holding a reference to it somewhere.\n    __autoreleasing RLMArrayHolder *copy = [[RLMArrayHolder alloc] init];\n    copy->items = std::make_unique<id[]>([collection count]);\n\n    NSUInteger i = 0;\n    for (id object in collection) {\n        copy->items.get()[i++] = object;\n    }\n\n    state->itemsPtr = (__unsafe_unretained id *)(void *)copy->items.get();\n    // needs to point to something valid, but the whole point of this is so\n    // that it can't be changed\n    state->mutationsPtr = state->extra;\n    state->state = i;\n\n    return i;\n}\n@end\n\ntemplate<typename Collection>\nNSArray *RLMCollectionValueForKey(Collection& collection, NSString *key, RLMClassInfo& info) {\n    size_t count = collection.size();\n    if (count == 0) {\n        return @[];\n    }\n\n    NSMutableArray *array = [NSMutableArray arrayWithCapacity:count];\n    if ([key isEqualToString:@\"self\"]) {\n        RLMAccessorContext context(info);\n        for (size_t i = 0; i < count; ++i) {\n            [array addObject:collection.get(context, i) ?: NSNull.null];\n        }\n        return array;\n    }\n\n    if (collection.get_type() != realm::PropertyType::Object) {\n        RLMAccessorContext context(info);\n        for (size_t i = 0; i < count; ++i) {\n            [array addObject:[collection.get(context, i) valueForKey:key] ?: NSNull.null];\n        }\n        return array;\n    }\n\n    RLMObject *accessor = RLMCreateManagedAccessor(info.rlmObjectSchema.accessorClass, &info);\n    auto prop = info.rlmObjectSchema[key];\n\n    // Collection properties need to be handled specially since we need to create\n    // a new collection each time\n    if (info.rlmObjectSchema.isSwiftClass) {\n        if (prop.collection && prop.swiftAccessor) {\n            // Grab the actual class for the generic collection from an instance of it\n            // so that we can make instances of the collection without creating a new\n            // object accessor each time\n            Class cls = [[prop.swiftAccessor get:prop on:accessor] class];\n            for (size_t i = 0; i < count; ++i) {\n                RLMSwiftCollectionBase *base = [[cls alloc] init];\n                base._rlmCollection = [[[cls _backingCollectionType] alloc]\n                                       initWithParent:collection.get(i) property:prop parentInfo:info];\n                [array addObject:base];\n            }\n            return array;\n        }\n    }\n\n    auto swiftAccessor = prop.swiftAccessor;\n    for (size_t i = 0; i < count; i++) {\n        accessor->_row = collection.get(i);\n        if (swiftAccessor) {\n            [swiftAccessor initialize:prop on:accessor];\n        }\n        [array addObject:[accessor valueForKey:key] ?: NSNull.null];\n    }\n    return array;\n}\n\nrealm::ColKey columnForProperty(NSString *propertyName,\n                                realm::object_store::Collection const& backingCollection,\n                                RLMClassInfo *objectInfo,\n                                RLMPropertyType propertyType,\n                                RLMCollectionType collectionType) {\n    if (backingCollection.get_type() == realm::PropertyType::Object) {\n        return objectInfo->tableColumn(propertyName);\n    }\n    if (![propertyName isEqualToString:@\"self\"]) {\n        NSString *collectionTypeName;\n        switch (collectionType) {\n            case RLMCollectionTypeArray:\n                collectionTypeName = @\"Arrays\";\n                break;\n            case RLMCollectionTypeSet:\n                collectionTypeName = @\"Sets\";\n                break;\n            case RLMCollectionTypeDictionary:\n                collectionTypeName = @\"Dictionaries\";\n                break;\n        }\n        @throw RLMException(@\"%@ of '%@' can only be aggregated on \\\"self\\\"\",\n                            collectionTypeName, RLMTypeToString(propertyType));\n    }\n    return {};\n}\n\ntemplate NSArray *RLMCollectionValueForKey(realm::Results&, NSString *, RLMClassInfo&);\ntemplate NSArray *RLMCollectionValueForKey(realm::List&, NSString *, RLMClassInfo&);\ntemplate NSArray *RLMCollectionValueForKey(realm::object_store::Set&, NSString *, RLMClassInfo&);\n\nvoid RLMCollectionSetValueForKey(id<RLMCollectionPrivate> collection, NSString *key, id value) {\n    realm::TableView tv = [collection tableView];\n    if (tv.size() == 0) {\n        return;\n    }\n\n    RLMClassInfo *info = collection.objectInfo;\n    RLMObject *accessor = RLMCreateManagedAccessor(info->rlmObjectSchema.accessorClass, info);\n    for (size_t i = 0; i < tv.size(); i++) {\n        accessor->_row = tv[i];\n        RLMInitializeSwiftAccessor(accessor, false);\n        [accessor setValue:value forKey:key];\n    }\n}\n\nvoid RLMAssignToCollection(id<RLMCollection> collection, id value) {\n    [(id)collection replaceAllObjectsWithObjects:value];\n}\n\nNSString *RLMDescriptionWithMaxDepth(NSString *name,\n                                     id<RLMCollection> collection,\n                                     NSUInteger depth) {\n    if (depth == 0) {\n        return @\"<Maximum depth exceeded>\";\n    }\n\n    const NSUInteger maxObjects = 100;\n    auto str = [NSMutableString stringWithFormat:@\"%@<%@> <%p> (\\n\", name,\n                [collection objectClassName] ?: RLMTypeToString([collection type]),\n                (void *)collection];\n    size_t index = 0, skipped = 0;\n    for (id obj in collection) {\n        NSString *sub;\n        if ([obj respondsToSelector:@selector(descriptionWithMaxDepth:)]) {\n            sub = [obj descriptionWithMaxDepth:depth - 1];\n        }\n        else {\n            sub = [obj description];\n        }\n\n        // Indent child objects\n        NSString *objDescription = [sub stringByReplacingOccurrencesOfString:@\"\\n\"\n                                                                  withString:@\"\\n\\t\"];\n        [str appendFormat:@\"\\t[%zu] %@,\\n\", index++, objDescription];\n        if (index >= maxObjects) {\n            skipped = collection.count - maxObjects;\n            break;\n        }\n    }\n\n    // Remove last comma and newline characters\n    if (collection.count > 0) {\n        [str deleteCharactersInRange:NSMakeRange(str.length-2, 2)];\n    }\n    if (skipped) {\n        [str appendFormat:@\"\\n\\t... %zu objects skipped.\", skipped];\n    }\n    [str appendFormat:@\"\\n)\"];\n    return str;\n}\n\nstd::vector<std::pair<std::string, bool>> RLMSortDescriptorsToKeypathArray(NSArray<RLMSortDescriptor *> *properties) {\n    std::vector<std::pair<std::string, bool>> keypaths;\n    keypaths.reserve(properties.count);\n    for (RLMSortDescriptor *desc in properties) {\n        if ([desc.keyPath rangeOfString:@\"@\"].location != NSNotFound) {\n            @throw RLMException(@\"Cannot sort on key path '%@': KVC collection operators are not supported.\", desc.keyPath);\n        }\n        keypaths.push_back({desc.keyPath.UTF8String, desc.ascending});\n    }\n    return keypaths;\n}\n\n@implementation RLMCollectionChange {\n    realm::CollectionChangeSet _indices;\n}\n\n- (instancetype)initWithChanges:(realm::CollectionChangeSet)indices {\n    self = [super init];\n    if (self) {\n        _indices = std::move(indices);\n    }\n    return self;\n}\n\nstatic NSArray *toArray(realm::IndexSet const& set) {\n    NSMutableArray *ret = [NSMutableArray new];\n    for (auto index : set.as_indexes()) {\n        [ret addObject:@(index)];\n    }\n    return ret;\n}\n\n- (NSArray *)insertions {\n    return toArray(_indices.insertions);\n}\n\n- (NSArray *)deletions {\n    return toArray(_indices.deletions);\n}\n\n- (NSArray *)modifications {\n    return toArray(_indices.modifications);\n}\n\n- (NSArray<NSIndexPath *> *)deletionsInSection:(NSUInteger)section {\n    return RLMToIndexPathArray(_indices.deletions, section);\n}\n\n- (NSArray<NSIndexPath *> *)insertionsInSection:(NSUInteger)section {\n    return RLMToIndexPathArray(_indices.insertions, section);\n}\n\n- (NSArray<NSIndexPath *> *)modificationsInSection:(NSUInteger)section {\n    return RLMToIndexPathArray(_indices.modifications, section);\n}\n\n- (NSString *)description {\n    return [NSString stringWithFormat:@\"<RLMCollectionChange: %p> insertions: %@, deletions: %@, modifications: %@\",\n            (__bridge void *)self, self.insertions, self.deletions, self.modifications];\n}\n\n@end\n\nnamespace {\nstruct CollectionCallbackWrapper {\n    void (^block)(id, id, NSError *);\n    id collection;\n    bool ignoreChangesInInitialNotification;\n\n    void operator()(realm::CollectionChangeSet const& changes) {\n        if (ignoreChangesInInitialNotification) {\n            ignoreChangesInInitialNotification = false;\n            block(collection, nil, nil);\n        }\n        else if (changes.empty()) {\n            block(collection, nil, nil);\n        }\n        else if (!changes.collection_root_was_deleted || !changes.deletions.empty()) {\n            block(collection, [[RLMCollectionChange alloc] initWithChanges:changes], nil);\n        }\n    }\n};\n} // anonymous namespace\n\n@interface RLMCancellationToken : RLMNotificationToken\n@end\n\nRLM_HIDDEN\n@implementation RLMCancellationToken {\n    __unsafe_unretained RLMRealm *_realm;\n    realm::NotificationToken _token;\n    RLMUnfairMutex _mutex;\n}\n\n- (RLMRealm *)realm {\n    std::lock_guard lock(_mutex);\n    return _realm;\n}\n\n- (void)suppressNextNotification {\n    std::lock_guard lock(_mutex);\n    if (_realm) {\n        _token.suppress_next();\n    }\n}\n\n- (bool)invalidate {\n    std::lock_guard lock(_mutex);\n    if (_realm) {\n        _token = {};\n        _realm = nil;\n        return true;\n    }\n    return false;\n}\n\nRLMNotificationToken *RLMAddNotificationBlock(id c, id block,\n                                              NSArray<NSString *> *keyPaths,\n                                              dispatch_queue_t queue) {\n    id<RLMThreadConfined, RLMCollectionPrivate> collection = c;\n    RLMRealm *realm = collection.realm;\n    if (!realm) {\n        @throw RLMException(@\"Change notifications are only supported on managed collections.\");\n    }\n    auto token = [[RLMCancellationToken alloc] init];\n    token->_realm = realm;\n\n    RLMClassInfo *info = collection.objectInfo;\n    if (!queue) {\n        [realm verifyNotificationsAreSupported:true];\n        try {\n            token->_token = [collection addNotificationCallback:block keyPaths:info->keyPathArrayFromStringArray(keyPaths)];\n        }\n        catch (const realm::Exception& e) {\n            @throw RLMException(e);\n        }\n        return token;\n    }\n\n    RLMThreadSafeReference *tsr = [RLMThreadSafeReference referenceWithThreadConfined:collection];\n    RLMRealmConfiguration *config = realm.configurationSharingSchema;\n    dispatch_async(queue, ^{\n        std::lock_guard lock(token->_mutex);\n        if (!token->_realm) {\n            return;\n        }\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:config queue:queue error:nil];\n        token->_realm = realm;\n        id collection = [realm resolveThreadSafeReference:tsr];\n        token->_token = [collection addNotificationCallback:block keyPaths:info->keyPathArrayFromStringArray(keyPaths)];\n    });\n    return token;\n}\n\nrealm::CollectionChangeCallback RLMWrapCollectionChangeCallback(void (^block)(id, id, NSError *),\n                                                                id collection, bool skipFirst) {\n    return CollectionCallbackWrapper{block, collection, skipFirst};\n}\n@end\n\nNSArray *RLMToIndexPathArray(realm::IndexSet const& set, NSUInteger section) {\n    NSMutableArray *ret = [NSMutableArray new];\n    NSUInteger path[2] = {section, 0};\n    for (auto index : set.as_indexes()) {\n        path[1] = index;\n        [ret addObject:[NSIndexPath indexPathWithIndexes:path length:2]];\n    }\n    return ret;\n}\n"
  },
  {
    "path": "Realm/RLMCollection_Private.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2016 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMCollection.h>\n\n@protocol RLMCollectionPrivate;\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\nNSUInteger RLMUnmanagedFastEnumerate(id collection, NSFastEnumerationState *);\nvoid RLMCollectionSetValueForKey(id<RLMCollectionPrivate> collection, NSString *key, id _Nullable value);\nFOUNDATION_EXTERN NSString *RLMDescriptionWithMaxDepth(NSString *name, id<RLMCollection> collection, NSUInteger depth);\nFOUNDATION_EXTERN void RLMAssignToCollection(id<RLMCollection> collection, id value);\nFOUNDATION_EXTERN void RLMSetSwiftBridgeCallback(id _Nullable (*_Nonnull)(id));\n\nFOUNDATION_EXTERN\nRLMNotificationToken *RLMAddNotificationBlock(id collection, id block,\n                                              NSArray<NSString *> *_Nullable keyPaths,\n                                              dispatch_queue_t _Nullable queue);\n\ntypedef NS_CLOSED_ENUM(int32_t, RLMCollectionType) {\n    RLMCollectionTypeArray = 0,\n    RLMCollectionTypeSet = 1,\n    RLMCollectionTypeDictionary = 2\n};\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMCollection_Private.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2016 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMCollection_Private.h>\n\n#import <Realm/RLMRealm.h>\n\n#import <realm/keys.hpp>\n#import <realm/object-store/collection_notifications.hpp>\n\n#import <vector>\n#import <mutex>\n\nnamespace realm {\nclass CollectionChangeCallback;\nclass List;\nclass Obj;\nclass Results;\nclass TableView;\nstruct CollectionChangeSet;\nstruct ColKey;\nnamespace object_store {\nclass Collection;\nclass Dictionary;\nclass Set;\n}\n}\nclass RLMClassInfo;\n@class RLMFastEnumerator, RLMManagedArray, RLMManagedSet, RLMManagedDictionary, RLMProperty, RLMObjectBase;\n\nRLM_HIDDEN_BEGIN\n\n@protocol RLMCollectionPrivate\n@property (nonatomic, readonly) RLMRealm *realm;\n@property (nonatomic, readonly) RLMClassInfo *objectInfo;\n@property (nonatomic, readonly) NSUInteger count;\n\n- (realm::TableView)tableView;\n- (RLMFastEnumerator *)fastEnumerator;\n- (realm::NotificationToken)addNotificationCallback:(id)block\nkeyPaths:(std::optional<std::vector<std::vector<std::pair<realm::TableKey, realm::ColKey>>>>&&)keyPaths;\n@end\n\n// An object which encapsulates the shared logic for fast-enumerating RLMArray\n// RLMSet and RLMResults, and has a buffer to store strong references to the current\n// set of enumerated items\nRLM_DIRECT_MEMBERS\n@interface RLMFastEnumerator : NSObject\n- (instancetype)initWithBackingCollection:(realm::object_store::Collection const&)backingCollection\n                               collection:(id)collection\n                                classInfo:(RLMClassInfo *)info\n                               parentInfo:(RLMClassInfo *)parentInfo\n                                 property:(RLMProperty *)property;\n\n- (instancetype)initWithBackingDictionary:(realm::object_store::Dictionary const&)backingDictionary\n                               dictionary:(RLMManagedDictionary *)dictionary\n                                classInfo:(RLMClassInfo *)info\n                               parentInfo:(RLMClassInfo *)parentInfo\n                                 property:(RLMProperty *)property;\n\n- (instancetype)initWithResults:(realm::Results&)results\n                     collection:(id)collection\n                      classInfo:(RLMClassInfo&)info;\n\n// Detach this enumerator from the source collection. Must be called before the\n// source collection is changed.\n- (void)detach;\n\n- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state\n                                    count:(NSUInteger)len;\n@end\nNSUInteger RLMFastEnumerate(NSFastEnumerationState *state, NSUInteger len, id<RLMCollectionPrivate> collection);\n\n@interface RLMNotificationToken ()\n- (void)suppressNextNotification;\n- (RLMRealm *)realm;\n@end\n\n@interface RLMCollectionChange ()\n- (instancetype)initWithChanges:(realm::CollectionChangeSet)indices;\n@end\n\nrealm::CollectionChangeCallback RLMWrapCollectionChangeCallback(void (^block)(id, id, NSError *),\n                                                                id collection, bool skipFirst);\n\ntemplate<typename Collection>\nNSArray *RLMCollectionValueForKey(Collection& collection, NSString *key, RLMClassInfo& info);\n\nstd::vector<std::pair<std::string, bool>> RLMSortDescriptorsToKeypathArray(NSArray<RLMSortDescriptor *> *properties);\n\nrealm::ColKey columnForProperty(NSString *propertyName,\n                                realm::object_store::Collection const& backingCollection,\n                                RLMClassInfo *objectInfo,\n                                RLMPropertyType propertyType,\n                                RLMCollectionType collectionType);\n\nstatic inline bool canAggregate(RLMPropertyType type, bool allowDate) {\n    switch (type) {\n        case RLMPropertyTypeInt:\n        case RLMPropertyTypeFloat:\n        case RLMPropertyTypeDouble:\n        case RLMPropertyTypeDecimal128:\n        case RLMPropertyTypeAny:\n            return true;\n        case RLMPropertyTypeDate:\n            return allowDate;\n        default:\n            return false;\n    }\n}\n\nNSArray *RLMToIndexPathArray(realm::IndexSet const& set, NSUInteger section);\n\nRLM_HIDDEN_END\n"
  },
  {
    "path": "Realm/RLMConstants.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Foundation/Foundation.h>\n\n#define RLM_HEADER_AUDIT_BEGIN NS_HEADER_AUDIT_BEGIN\n#define RLM_HEADER_AUDIT_END NS_HEADER_AUDIT_END\n\n#define RLM_FINAL __attribute__((objc_subclassing_restricted))\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n#if __has_attribute(ns_error_domain) && (!defined(__cplusplus) || !__cplusplus || __cplusplus >= 201103L)\n#define RLM_ERROR_ENUM(type, name, domain) \\\n    _Pragma(\"clang diagnostic push\") \\\n    _Pragma(\"clang diagnostic ignored \\\"-Wignored-attributes\\\"\") \\\n    NS_ENUM(type, __attribute__((ns_error_domain(domain))) name) \\\n    _Pragma(\"clang diagnostic pop\")\n#else\n#define RLM_ERROR_ENUM(type, name, domain) NS_ENUM(type, name)\n#endif\n\n#define RLM_HIDDEN __attribute__((visibility(\"hidden\")))\n#define RLM_VISIBLE __attribute__((visibility(\"default\")))\n#define RLM_HIDDEN_BEGIN _Pragma(\"GCC visibility push(hidden)\")\n#define RLM_HIDDEN_END _Pragma(\"GCC visibility pop\")\n#define RLM_DIRECT __attribute__((objc_direct))\n#define RLM_DIRECT_MEMBERS __attribute__((objc_direct_members))\n\n#pragma mark - Enums\n\n/**\n `RLMPropertyType` is an enumeration describing all property types supported in Realm models.\n\n For more information, see [Realm Models](https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/model-data/object-models/).\n */\ntypedef NS_CLOSED_ENUM(int32_t, RLMPropertyType) {\n\n#pragma mark - Primitive types\n    /** Integers: `NSInteger`, `int`, `long`, `Int` (Swift) */\n    RLMPropertyTypeInt    = 0,\n    /** Booleans: `BOOL`, `bool`, `Bool` (Swift) */\n    RLMPropertyTypeBool   = 1,\n    /** Floating-point numbers: `float`, `Float` (Swift) */\n    RLMPropertyTypeFloat  = 5,\n    /** Double-precision floating-point numbers: `double`, `Double` (Swift) */\n    RLMPropertyTypeDouble = 6,\n    /** NSUUID, UUID */\n    RLMPropertyTypeUUID   = 12,\n\n#pragma mark - Object types\n\n    /** Strings: `NSString`, `String` (Swift) */\n    RLMPropertyTypeString = 2,\n    /** Binary data: `NSData` */\n    RLMPropertyTypeData   = 3,\n    /** Any type: `id<RLMValue>`, `AnyRealmValue` (Swift) */\n    RLMPropertyTypeAny    = 9,\n    /** Dates: `NSDate` */\n    RLMPropertyTypeDate   = 4,\n    RLMPropertyTypeObjectId = 10,\n    RLMPropertyTypeDecimal128 = 11,\n\n#pragma mark - Linked object types\n\n    /** Realm model objects. See [Realm Models](https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/model-data/object-models/) for more information. */\n    RLMPropertyTypeObject = 7,\n    /** Realm linking objects. See [Realm Models](https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/model-data/relationships/#define-an-inverse-relationship-property) for more information. */\n    RLMPropertyTypeLinkingObjects = 8,\n};\n\n/**\n `RLMAnyValueType` is an enumeration describing all property types supported by RLMValue (AnyRealmValue).\n\n For more information, see [Realm Models](https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/model-data/supported-types/#std-label-ios-anyrealmvalue-data-type).\n */\ntypedef NS_CLOSED_ENUM(int32_t, RLMAnyValueType) {\n#pragma mark - Primitive types\n    /** Integers: `NSInteger`, `int`, `long`, `Int` (Swift) */\n    RLMAnyValueTypeInt    = 0,\n    /** Booleans: `BOOL`, `bool`, `Bool` (Swift) */\n    RLMAnyValueTypeBool   = 1,\n    /** Floating-point numbers: `float`, `Float` (Swift) */\n    RLMAnyValueTypeFloat  = 5,\n    /** Double-precision floating-point numbers: `double`, `Double` (Swift) */\n    RLMAnyValueTypeDouble = 6,\n    /** NSUUID, UUID */\n    RLMAnyValueTypeUUID   = 12,\n\n#pragma mark - Object types\n\n    /** Strings: `NSString`, `String` (Swift) */\n    RLMAnyValueTypeString = 2,\n    /** Binary data: `NSData` */\n    RLMAnyValueTypeData   = 3,\n    /** Any type: `id<RLMValue>`, `AnyRealmValue` (Swift) */\n    RLMAnyValueTypeAny    = 9,\n    /** Dates: `NSDate` */\n    RLMAnyValueTypeDate   = 4,\n    RLMAnyValueTypeObjectId = 10,\n    RLMAnyValueTypeDecimal128 = 11,\n\n#pragma mark - Linked object types\n\n    /** Realm model objects. See [Realm Models](https://www.mongodb.com/docs/realm/sdk/swift/fundamentals/object-models-and-schemas/) for more information. */\n    RLMAnyValueTypeObject = 7,\n    /** Realm linking objects. See [Realm Models](https://www.mongodb.com/docs/realm/sdk/swift/fundamentals/relationships/#inverse-relationship) for more information. */\n    RLMAnyValueTypeLinkingObjects = 8,\n\n    /** Dictionary: `RLMDictionary`, `Map` (Swift) */\n    RLMAnyValueTypeDictionary = 512,\n    /** Set: `RLMArray`, `List` (Swift) */\n    RLMAnyValueTypeList = 128,\n};\n\n#pragma mark - Notification Constants\n\n/**\n A notification indicating that changes were made to a Realm.\n*/\ntypedef NSString * RLMNotification NS_EXTENSIBLE_STRING_ENUM;\n\n/**\n This notification is posted when a write transaction has been committed to a Realm on a different thread for\n the same file.\n\n It is not posted if `autorefresh` is enabled, or if the Realm is refreshed before the notification has a chance\n to run.\n\n Realms with autorefresh disabled should normally install a handler for this notification which calls\n `-[RLMRealm refresh]` after doing some work. Refreshing the Realm is optional, but not refreshing the Realm may lead to\n large Realm files. This is because an extra copy of the data must be kept for the stale Realm.\n */\nextern RLMNotification const RLMRealmRefreshRequiredNotification NS_SWIFT_NAME(RefreshRequired);\n\n/**\n This notification is posted by a Realm when a write transaction has been\n committed to a Realm on a different thread for the same file.\n\n It is not posted if `-[RLMRealm autorefresh]` is enabled, or if the Realm is\n refreshed before the notification has a chance to run.\n\n Realms with autorefresh disabled should normally install a handler for this\n notification which calls `-[RLMRealm refresh]` after doing some work. Refreshing\n the Realm is optional, but not refreshing the Realm may lead to large Realm\n files. This is because Realm must keep an extra copy of the data for the stale\n Realm.\n */\nextern RLMNotification const RLMRealmDidChangeNotification NS_SWIFT_NAME(DidChange);\n\n#pragma mark - Error keys\n\n/** Key to identify the associated backup Realm configuration in an error's `userInfo` dictionary */\nextern NSString * const RLMBackupRealmConfigurationErrorKey;\n\n#pragma mark - Other Constants\n\n/** The schema version used for uninitialized Realms */\nextern const uint64_t RLMNotVersioned;\n\n/** The corresponding value is the name of an exception thrown by Realm. */\nextern NSString * const RLMExceptionName;\n\n/** The corresponding value is a Realm file version. */\nextern NSString * const RLMRealmVersionKey;\n\n/** The corresponding key is the version of the underlying database engine. */\nextern NSString * const RLMRealmCoreVersionKey;\n\n/** The corresponding key is the Realm invalidated property name. */\nextern NSString * const RLMInvalidatedKey;\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMConstants.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\nRLMNotification const RLMRealmRefreshRequiredNotification = @\"RLMRealmRefreshRequiredNotification\";\nRLMNotification const RLMRealmDidChangeNotification = @\"RLMRealmDidChangeNotification\";\n\nNSString * const RLMExceptionName = @\"RLMException\";\n\nNSString * const RLMRealmVersionKey = @\"RLMRealmVersion\";\n\nNSString * const RLMRealmCoreVersionKey = @\"RLMRealmCoreVersion\";\n\nNSString * const RLMInvalidatedKey = @\"invalidated\";\n\nNSString * const RLMBackupRealmConfigurationErrorKey = @\"RLMBackupRealmConfiguration\";\n"
  },
  {
    "path": "Realm/RLMDecimal128.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n/**\n A 128-bit IEEE 754-2008 decimal floating point number.\n\n This type is similar to Swift's built-in Decimal type, but allocates bits\n differently, resulting in a different representable range. (NS)Decimal stores a\n significand of up to 38 digits long and an exponent from -128 to 127, while\n this type stores up to 34 digits of significand and an exponent from -6143 to\n 6144.\n */\nNS_SWIFT_SENDABLE // immutable\n@interface RLMDecimal128 : NSObject <NSCopying>\n/// Creates a new zero-initialized decimal128.\n- (instancetype)init;\n\n/// Converts the given value to a RLMDecimal128.\n///\n/// The following types can be converted to RLMDecimal128:\n/// - NSNumber\n/// - NSString\n/// - NSDecimalNumber\n///\n/// Passing a value with a type not in this list is a fatal error. Passing a\n/// string which cannot be parsed as a valid Decimal128 is a fatal error.\n- (instancetype)initWithValue:(id)value;\n\n/// Converts the given number to a RLMDecimal128.\n- (instancetype)initWithNumber:(NSNumber *)number;\n\n/// Parses the given string to a RLMDecimal128.\n///\n/// Returns a decimal where `isNaN` is `YES` if the string cannot be parsed as a decimal.\n- (instancetype)initWithString:(NSString *)string;\n\n/// Converts the given number to a RLMDecimal128.\n+ (instancetype)decimalWithNumber:(NSNumber *)number;\n\n/// The minimum value for RLMDecimal128.\n@property (class, readonly, copy) RLMDecimal128 *minimumDecimalNumber NS_REFINED_FOR_SWIFT;\n\n/// The maximum value for RLMDecimal128.\n@property (class, readonly, copy) RLMDecimal128 *maximumDecimalNumber NS_REFINED_FOR_SWIFT;\n\n/// Convert this value to a double. This is a lossy conversion.\n@property (nonatomic, readonly) double doubleValue;\n\n/// Convert this value to a NSDecimal. This may be a lossy conversion.\n@property (nonatomic, readonly) NSDecimal decimalValue;\n\n/// Convert this value to a string.\n@property (nonatomic, readonly) NSString *stringValue;\n\n/// Gets if this Decimal128 represents a NaN value.\n@property (nonatomic, readonly) BOOL isNaN;\n\n/// The magnitude of this RLMDecimal128.\n@property (nonatomic, readonly) RLMDecimal128 *magnitude NS_REFINED_FOR_SWIFT;\n\n/// Replaces this RLMDecimal128 value with its additive inverse.\n- (void)negate;\n\n/// Adds the right hand side to the current value and returns the result.\n- (RLMDecimal128 *)decimalNumberByAdding:(RLMDecimal128 *)decimalNumber;\n\n/// Divides the right hand side to the current value and returns the result.\n- (RLMDecimal128 *)decimalNumberByDividingBy:(RLMDecimal128 *)decimalNumber;\n\n/// Subtracts the right hand side to the current value and returns the result.\n- (RLMDecimal128 *)decimalNumberBySubtracting:(RLMDecimal128 *)decimalNumber;\n\n/// Multiply the right hand side to the current value and returns the result.\n- (RLMDecimal128 *)decimalNumberByMultiplyingBy:(RLMDecimal128 *)decimalNumber;\n\n/// Comparision operator to check if the right hand side is greater than the current value.\n- (BOOL)isGreaterThan:(nullable RLMDecimal128 *)decimalNumber;\n\n/// Comparision operator to check if the right hand side is greater than or equal to the current value.\n- (BOOL)isGreaterThanOrEqualTo:(nullable RLMDecimal128 *)decimalNumber;\n\n/// Comparision operator to check if the right hand side is less than the current value.\n- (BOOL)isLessThan:(nullable RLMDecimal128 *)decimalNumber;\n\n/// Comparision operator to check if the right hand side is less than or equal to the current value.\n- (BOOL)isLessThanOrEqualTo:(nullable RLMDecimal128 *)decimalNumber;\n\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMDecimal128.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMDecimal128_Private.hpp\"\n\n#import \"RLMUtil.hpp\"\n\n#import <realm/decimal128.hpp>\n\n// Swift's obj-c bridging does not support making an obj-c defined class conform\n// to Decodable, so we need a Swift-defined subclass for that. This means that\n// when Realm Swift is being used, we need to produce objects of that type rather\n// than our obj-c defined type. objc_runtime_visible marks the type as being\n// visible only to the obj-c runtime and not the linker, which means that it'll\n// be `nil` at runtime rather than being a linker error if it's not defined, and\n// valid if it happens to be defined by some other library (i.e. Realm Swift).\n//\n// At the point where the objects are being allocated we generally don't have\n// any good way of knowing whether or not it's going to end up being used by\n// Swift, so we just switch to the subclass unconditionally if the subclass\n// exists. This shouldn't have any impact on obj-c code other than a small\n// performance hit.\n[[clang::objc_runtime_visible]]\n@interface RealmSwiftDecimal128 : RLMDecimal128\n@end\n\n@implementation RLMDecimal128 {\n    realm::Decimal128 _value;\n}\n\n- (instancetype)init {\n    if (self = [super init]) {\n        if (auto cls = [RealmSwiftDecimal128 class]; cls && cls != self.class) {\n            object_setClass(self, cls);\n        }\n    }\n     return self;\n}\n\n- (instancetype)initWithDecimal128:(realm::Decimal128)value {\n    if ((self = [self init])) {\n        _value = value;\n    }\n    return self;\n}\n\n- (instancetype)initWithValue:(id)value {\n    if ((self = [self init])) {\n        _value = RLMObjcToDecimal128(value);\n    }\n    return self;\n}\n\n- (instancetype)initWithNumber:(NSNumber *)number {\n    if ((self = [self init])) {\n        _value = RLMObjcToDecimal128(number);\n    }\n    return self;\n}\n\n- (instancetype)initWithString:(NSString *)string {\n    if ((self = [self init])) {\n        _value = realm::Decimal128(string.UTF8String);\n    }\n    return self;\n}\n\n+ (instancetype)decimalWithNumber:(NSNumber *)number {\n    return [[self alloc] initWithNumber:number];\n}\n\n+ (instancetype)decimalWithNSDecimal:(NSDecimalNumber *)number {\n    return [[self alloc] initWithString:number.stringValue];\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    RLMDecimal128 *copy = [[self.class allocWithZone:zone] init];\n    copy->_value = _value;\n    return copy;\n}\n\n- (realm::Decimal128)decimal128Value {\n    return _value;\n}\n\n- (BOOL)isEqual:(id)object {\n    if (auto decimal128 = RLMDynamicCast<RLMDecimal128>(object)) {\n        return _value == decimal128->_value;\n    }\n    if (auto number = RLMDynamicCast<NSNumber>(object)) {\n        return _value == RLMObjcToDecimal128(number);\n    }\n    return NO;\n}\n\n- (NSUInteger)hash {\n    return @(self.doubleValue).hash;\n}\n\n- (NSString *)description {\n    return self.stringValue;\n}\n\n- (NSComparisonResult)compare:(RLMDecimal128 *)other {\n    return static_cast<NSComparisonResult>(_value.compare(other->_value));\n}\n\n- (double)doubleValue {\n    return [NSDecimalNumber decimalNumberWithDecimal:self.decimalValue].doubleValue;\n}\n\n- (NSDecimal)decimalValue {\n    NSDecimal ret;\n    [[[NSScanner alloc] initWithString:@(_value.to_string().c_str())] scanDecimal:&ret];\n    return ret;\n}\n\n- (NSString *)stringValue {\n    auto str = _value.to_string();\n    // If there's a decimal point, trim trailing zeroes\n    auto decimal_pos = str.find('.');\n    if (decimal_pos != std::string::npos) {\n        // Look specifically at the range between the decimal point and the E\n        // if it's present, and the rest of the string if not\n        std::string_view sv = str;\n        auto e_pos = str.find('E', decimal_pos);\n        if (e_pos != std::string::npos) {\n            sv = sv.substr(0, e_pos);\n        }\n\n        // Remove everything between the character after the final non-zero\n        // and the end of the string (or the E)\n        auto final_non_zero = sv.find_last_not_of('0');\n        REALM_ASSERT(final_non_zero != std::string::npos);\n        if (final_non_zero == decimal_pos) {\n            // Also drop the decimal if there's no non-zero digits after it\n            --final_non_zero;\n        }\n        str.erase(final_non_zero + 1, sv.size() - final_non_zero - 1);\n    }\n    return @(str.c_str());\n}\n\n- (BOOL)isNaN {\n    return _value.is_nan();\n}\n\n- (RLMDecimal128 *)magnitude {\n    auto result = realm::Decimal128(abs(self.doubleValue));\n    return [[RLMDecimal128 alloc] initWithDecimal128:result];\n}\n\n- (void)negate {\n    _value = realm::Decimal128(-self.doubleValue);\n}\n\n+ (RLMDecimal128 *)minimumDecimalNumber {\n    return [[RLMDecimal128 alloc] initWithDecimal128:std::numeric_limits<realm::Decimal128>::lowest()];\n}\n\n+ (RLMDecimal128 *)maximumDecimalNumber {\n    return [[RLMDecimal128 alloc] initWithDecimal128:std::numeric_limits<realm::Decimal128>::max()];\n}\n\n- (RLMDecimal128 *)decimalNumberByAdding:(RLMDecimal128 *)decimalNumber {\n    auto rhs = RLMObjcToDecimal128(decimalNumber);\n    return [[RLMDecimal128 alloc] initWithDecimal128:_value+rhs];\n}\n\n- (RLMDecimal128 *)decimalNumberByDividingBy:(RLMDecimal128 *)decimalNumber {\n    auto rhs = RLMObjcToDecimal128(decimalNumber);\n    return [[RLMDecimal128 alloc] initWithDecimal128:_value/rhs];\n}\n\n- (RLMDecimal128 *)decimalNumberBySubtracting:(RLMDecimal128 *)decimalNumber {\n    auto rhs = RLMObjcToDecimal128(decimalNumber);\n    return [[RLMDecimal128 alloc] initWithDecimal128:_value-rhs];\n}\n\n- (RLMDecimal128 *)decimalNumberByMultiplyingBy:(RLMDecimal128 *)decimalNumber {\n    auto rhs = RLMObjcToDecimal128(decimalNumber);\n    return [[RLMDecimal128 alloc] initWithDecimal128:_value*rhs];\n}\n\n- (BOOL)isGreaterThan:(RLMDecimal128 *)decimalNumber {\n    auto rhs = RLMObjcToDecimal128(decimalNumber);\n    return _value > rhs;\n}\n\n- (BOOL)isGreaterThanOrEqualTo:(RLMDecimal128 *)decimalNumber {\n    auto rhs = RLMObjcToDecimal128(decimalNumber);\n    return _value >= rhs;\n}\n\n- (BOOL)isLessThan:(RLMDecimal128 *)decimalNumber {\n    auto rhs = RLMObjcToDecimal128(decimalNumber);\n    return _value < rhs;\n}\n\n- (BOOL)isLessThanOrEqualTo:(RLMDecimal128 *)decimalNumber {\n    auto rhs = RLMObjcToDecimal128(decimalNumber);\n    return _value <= rhs;\n}\n\n@end\n"
  },
  {
    "path": "Realm/RLMDecimal128_Private.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMDecimal128.h>\n\nnamespace realm {\nclass Decimal128;\n}\n\nRLM_DIRECT_MEMBERS\n@interface RLMDecimal128 ()\n- (instancetype)initWithDecimal128:(realm::Decimal128)value;\n- (realm::Decimal128)decimal128Value;\n@end\n"
  },
  {
    "path": "Realm/RLMDictionary.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMCollection.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@class RLMObject, RLMResults<RLMObjectType>, RLMDictionaryChange;\n\n/**\n `RLMDictionary` is a container type in Realm representing a dynamic collection of key-value pairs.\n\n Unlike `NSDictionary`, `RLMDictionary`s hold a single key and value type.\n This is referred to in these docs as the “type” and “keyType” of the dictionary.\n\n When declaring an `RLMDictionary` property, the object type and keyType must be marked as conforming to a\n protocol by the same name as the objects it should contain.\n\n     RLM_COLLECTION_TYPE(ObjectType)\n     ...\n     @property RLMDictionary<NSString *, ObjectType *><RLMString, ObjectType> *objectTypeDictionary;\n\n `RLMDictionary`s can be queried with the same predicates as `RLMObject` and `RLMResult`s.\n\n `RLMDictionary`s cannot be created directly. `RLMDictionary` properties on `RLMObject`s are\n lazily created when accessed, or can be obtained by querying a Realm.\n\n `RLMDictionary` only supports `NSString` as a key.  Realm disallows the use of `.` or `$` characters within a dictionary key.\n\n ### Key-Value Observing\n\n `RLMDictionary` supports dictionary key-value observing on `RLMDictionary` properties on `RLMObject`\n subclasses, and the `invalidated` property on `RLMDictionary` instances themselves is\n key-value observing compliant when the `RLMDictionary` is attached to a managed\n `RLMObject` (`RLMDictionary`s on unmanaged `RLMObject`s will never become invalidated).\n */\n@interface RLMDictionary<RLMKeyType, RLMObjectType>: NSObject<RLMCollection>\n\n#pragma mark - Properties\n\n/**\n The number of entries in the dictionary.\n */\n@property (nonatomic, readonly, assign) NSUInteger count;\n\n/**\n The type of the objects in the dictionary.\n */\n@property (nonatomic, readonly, assign) RLMPropertyType type;\n\n/**\n The type of the key used in this dictionary.\n */\n@property (nonatomic, readonly, assign) RLMPropertyType keyType;\n\n/**\n Indicates whether the objects in the collection can be `nil`.\n */\n@property (nonatomic, readonly, getter = isOptional) BOOL optional;\n\n/**\n The class name of the objects contained in the dictionary.\n\n Will be `nil` if `type` is not RLMPropertyTypeObject.\n */\n@property (nonatomic, readonly, copy, nullable) NSString *objectClassName;\n\n/**\n The Realm which manages the dictionary. Returns `nil` for unmanaged dictionary.\n */\n@property (nonatomic, readonly, nullable) RLMRealm *realm;\n\n/**\n Indicates if the dictionary can no longer be accessed.\n */\n@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated;\n\n/**\n Indicates if the dictionary is frozen.\n\n Frozen dictionaries are immutable and can be accessed from any thread. Frozen dictionaries\n are created by calling `-freeze` on a managed live dictionary. Unmanaged dictionaries are\n never frozen.\n */\n@property (nonatomic, readonly, getter = isFrozen) BOOL frozen;\n\n#pragma mark - Accessing Objects from a Dictionary\n\n/**\n Returns the value associated with a given key.\n\n @param key The name of the property.\n\n @discussion If key does not start with “@”, invokes object(forKey:). If key does start\n with “@”, strips the “@” and invokes [super valueForKey:] with the rest of the key.\n\n @return A value associated with a given key or `nil`.\n */\n- (nullable id)valueForKey:(nonnull RLMKeyType)key;\n\n/**\n Returns an array containing the dictionary’s keys.\n\n @note The order of the elements in the array is not defined.\n */\n@property(readonly, copy) NSArray<RLMKeyType> *allKeys;\n\n/**\n Returns an array containing the dictionary’s values.\n\n @note The order of the elements in the array is not defined.\n */\n@property(readonly, copy) NSArray<RLMObjectType> *allValues;\n\n/**\n Returns the value associated with a given key.\n\n @note `nil` will be returned if no value is associated with a given key. NSNull will be returned\n       where null is associated with the key.\n\n @param key The key for which to return the corresponding value.\n\n @return The value associated with key.\n */\n- (nullable RLMObjectType)objectForKey:(nonnull RLMKeyType)key;\n\n/**\n Returns the value associated with a given key.\n\n @note `nil` will be returned if no value is associated with a given key. NSNull will be returned\n       where null is associated with the key.\n\n @param key The key for which to return the corresponding value.\n\n @return The value associated with key.\n */\n- (nullable RLMObjectType)objectForKeyedSubscript:(RLMKeyType)key;\n\n/**\n Applies a given block object to the each key-value pair of the dictionary.\n\n @param block A block object to operate on entries in the dictionary.\n\n @note If the block sets *stop to YES, the enumeration stops.\n */\n- (void)enumerateKeysAndObjectsUsingBlock:(void (^)(RLMKeyType key, RLMObjectType obj, BOOL *stop))block;\n\n#pragma mark - Adding, Removing, and Replacing Objects in a Dictionary\n\n/**\n Replace the contents of a dictionary with the contents of another dictionary - NSDictionary or RLMDictionary.\n\n This will remove all elements in this dictionary and then apply each element from the given dictionary.\n\n @warning This method may only be called during a write transaction.\n @warning If otherDictionary is self this will result in an empty dictionary.\n */\n- (void)setDictionary:(id)otherDictionary;\n\n/**\n Removes all contents in the dictionary.\n\n @warning This method may only be called during a write transaction.\n */\n- (void)removeAllObjects;\n\n/**\n Removes from the dictionary entries specified by elements in a given array. If a given key does not\n exist, no mutation will happen for that key.\n\n @warning This method may only be called during a write transaction.\n */\n- (void)removeObjectsForKeys:(NSArray<RLMKeyType> *)keyArray;\n\n/**\n Removes a given key and its associated value from the dictionary. If the key does not exist the dictionary\n will not be modified.\n\n @warning This method may only be called during a write transaction.\n */\n- (void)removeObjectForKey:(RLMKeyType)key;\n\n/**\n Adds a given key-value pair to the dictionary if the key is not present, or updates the value for the given key\n if the key already present.\n\n @warning This method may only be called during a write transaction.\n */\n- (void)setObject:(nullable RLMObjectType)obj forKeyedSubscript:(RLMKeyType)key;\n\n/**\n Adds a given key-value pair to the dictionary if the key is not present, or updates the value for the given key\n if the key already present.\n\n @warning This method may only be called during a write transaction.\n */\n- (void)setObject:(nullable RLMObjectType)anObject forKey:(RLMKeyType)aKey;\n\n/**\n  Adds to the receiving dictionary the entries from another dictionary.\n\n  @note If the receiving dictionary contains the same key(s) as the otherDictionary, then\n        the receiving dictionary will update each key-value pair for the matching key.\n \n  @warning This method may only be called during a write transaction.\n\n  @param otherDictionary An enumerable object such as `NSDictionary` or `RLMDictionary` which contains objects of the\n         same type as the receiving dictionary.\n */\n- (void)addEntriesFromDictionary:(id <NSFastEnumeration>)otherDictionary;\n\n#pragma mark - Querying a Dictionary\n\n/**\n Returns all the values matching the given predicate in the dictionary.\n\n @note The keys in the dictionary are ignored when quering values, and they will not be returned in the `RLMResults`.\n\n @param predicateFormat A predicate format string, optionally followed by a variable number of arguments.\n\n @return                An `RLMResults` of objects that match the given predicate.\n */\n- (RLMResults<RLMObjectType> *)objectsWhere:(NSString *)predicateFormat, ...;\n\n/// :nodoc:\n- (RLMResults<RLMObjectType> *)objectsWhere:(NSString *)predicateFormat args:(va_list)args;\n\n/**\n Returns all the values matching the given predicate in the dictionary.\n\n @note The keys in the dictionary are ignored when quering values, and they will not be returned in the `RLMResults`.\n\n @param predicate   The predicate with which to filter the objects.\n\n @return            An `RLMResults` of objects that match the given predicate\n */\n- (RLMResults<RLMObjectType> *)objectsWithPredicate:(NSPredicate *)predicate;\n\n/**\n Returns a sorted RLMResults of all values in the dictionary.\n\n @note The keys in the dictionary are ignored when sorting values, and they will not be returned in the `RLMResults`.\n\n @param keyPath     The key path to sort by.\n @param ascending   The direction to sort in.\n\n @return    An `RLMResults` sorted by the specified key path.\n */- (RLMResults<RLMObjectType> *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending;\n\n/**\n Returns a sorted RLMResults of all values in the dictionary.\n\n @note The keys in the dictionary are ignored when sorting values, and they will not be returned in the `RLMResults`.\n\n @param properties  An array of `RLMSortDescriptor`s to sort by.\n\n @return    An `RLMResults` sorted by the specified properties.\n */\n- (RLMResults<RLMObjectType> *)sortedResultsUsingDescriptors:(NSArray<RLMSortDescriptor *> *)properties;\n\n/**\n Returns a distinct `RLMResults` from all values in the dictionary.\n\n @note The keys in the dictionary are ignored, and they will not be returned in the `RLMResults`.\n\n @param keyPaths     The key paths to distinct on.\n\n @return    An `RLMResults` with the distinct values of the keypath(s).\n */\n- (RLMResults<RLMObjectType> *)distinctResultsUsingKeyPaths:(NSArray<NSString *> *)keyPaths;\n\n#pragma mark - Aggregating Property Values\n\n/**\n Returns the minimum (lowest) value of the given property among all the values in the dictionary.\n\n     NSNumber *min = [object.dictionaryProperty minOfProperty:@\"age\"];\n\n @param property The property whose minimum value is desired. Only properties of\n                 types `int`, `float`, `double`, `NSDate`, `RLMValue` and `RLMDecimal128` are supported.\n\n @return The minimum value of the property, or `nil` if the dictionary is empty.\n */\n- (nullable id)minOfProperty:(NSString *)property;\n\n/**\n Returns the maximum (highest) value of the given property among all the objects in the dictionary.\n\n     NSNumber *max = [object.dictionaryProperty maxOfProperty:@\"age\"];\n\n @param property The property whose minimum value is desired. Only properties of\n                 types `int`, `float`, `double`, `NSDate`, `RLMValue` and `RLMDecimal128` are supported.\n\n @return The maximum value of the property, or `nil` if the dictionary is empty.\n */\n- (nullable id)maxOfProperty:(NSString *)property;\n\n/**\n Returns the sum of distinct values of a given property over all the objects in the dictionary.\n\n     NSNumber *sum = [object.dictionaryProperty sumOfProperty:@\"age\"];\n\n @param property The property whose minimum value is desired. Only properties of\n                 types `int`, `float`, `double`, `RLMValue` and  `RLMDecimal128` are supported.\n\n @return The sum of the given property.\n */\n- (NSNumber *)sumOfProperty:(NSString *)property;\n\n/**\n Returns the average value of a given property over the objects in the dictionary.\n\n     NSNumber *average = [object.dictionaryProperty averageOfProperty:@\"age\"];\n\n @param property The property whose minimum value is desired. Only properties of\n                 types `int`, `float`, `double`, `NSDate`, `RLMValue` and `RLMDecimal128` are supported.\n\n @return The average value of the given property, or `nil` if the dictionary is empty.\n */\n- (nullable NSNumber *)averageOfProperty:(NSString *)property;\n\n#pragma mark - Notifications\n\n/**\n Registers a block to be called each time the dictionary changes.\n\n The block will be asynchronously called with the initial dictionary, and then\n called again after each write transaction which changes any of the keys or values\n within the dictionary.\n\n The `changes` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which keys in the dictionary were added, modified or deleted. If a write transaction\n did not modify any keys or values in the dictionary, the block is not called at all.\n\n The error parameter is present only for backwards compatibility and will always\n be `nil`.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification. This can include the notification\n with the initial results. For example, the following code performs a write\n transaction immediately after adding the notification block, so there is no\n opportunity for the initial notification to be delivered first. As a\n result, the initial notification will reflect the state of the Realm after\n the write transaction.\n\n     Person *person = [[Person allObjectsInRealm:realm] firstObject];\n     NSLog(@\"person.dogs.count: %zu\", person.dogs.count); // => 0\n     self.token = [person.dogs addNotificationBlock(RLMDictionary<NSString *, Dog *><RLMString, Dog> *dogs,\n                                       RLMDictionaryChange *changes,\n                                       NSError *error) {\n         // Only fired once for the example\n         NSLog(@\"dogs.count: %zu\", dogs.count); // => 1\n     }];\n     [realm transactionWithBlock:^{\n         Dog *dog = [[Dog alloc] init];\n         dog.name = @\"Rex\";\n         person.dogs[@\"frenchBulldog\"] = dog;\n     }];\n     // end of run loop execution context\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning This method may only be called on a non-frozen managed dictionary.\n\n @param block The block to be called each time the dictionary changes.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMDictionary<RLMKeyType, RLMObjectType> *_Nullable dictionary,\n                                                         RLMDictionaryChange *_Nullable changes,\n                                                         NSError *_Nullable error))block\n__attribute__((warn_unused_result));\n\n/**\n Registers a block to be called each time the dictionary changes.\n\n The block will be asynchronously called with the initial dictionary, and then\n called again after each write transaction which changes any of the key-value in\n the dictionary or which objects are in the results.\n\n The `changes` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which keys in the dictionary were added or modified. If a write transaction\n did not modify any objects in the dictionary, the block is not called at all.\n\n The error parameter is present only for backwards compatibility and will always\n be `nil`.\n\n Notifications are delivered on the given queue. If the queue is blocked and\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification.\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called when the containing Realm is read-only or frozen.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param queue The serial queue to deliver notifications to.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMDictionary<RLMKeyType, RLMObjectType> *_Nullable dictionary,\n                                                         RLMDictionaryChange *_Nullable changes,\n                                                         NSError *_Nullable error))block\n                                         queue:(nullable dispatch_queue_t)queue\n__attribute__((warn_unused_result));\n\n/**\n Registers a block to be called each time the dictionary changes.\n\n The block will be asynchronously called with the initial dictionary, and then\n called again after each write transaction which changes any of the key-value in\n the dictionary or which objects are in the results.\n\n The `changes` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which keys in the dictionary were added or modified. If a write transaction\n did not modify any objects in the dictionary, the block is not called at all.\n\n The error parameter is present only for backwards compatibility and will always\n be `nil`.\n\n Notifications are delivered on the given queue. If the queue is blocked and\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification.\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called when the containing Realm is read-only or frozen.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param keyPaths The block will be called for changes occurring on these keypaths. If no\n key paths are given, notifications are delivered for every property key path.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMDictionary<RLMKeyType, RLMObjectType> *_Nullable dictionary,\n                                                         RLMDictionaryChange *_Nullable changes,\n                                                         NSError *_Nullable error))block\n                                      keyPaths:(nullable NSArray<NSString *> *)keyPaths\n                                         queue:(nullable dispatch_queue_t)queue\n__attribute__((warn_unused_result));\n\n/**\n Registers a block to be called each time the dictionary changes.\n\n The block will be asynchronously called with the initial dictionary, and then\n called again after each write transaction which changes any of the key-value in\n the dictionary or which objects are in the results.\n\n The `changes` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which keys in the dictionary were added or modified. If a write transaction\n did not modify any objects in the dictionary, the block is not called at all.\n\n The error parameter is present only for backwards compatibility and will always\n be `nil`.\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called when the containing Realm is read-only or frozen.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param keyPaths The block will be called for changes occurring on these keypaths. If no\n key paths are given, notifications are delivered for every property key path.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMDictionary<RLMKeyType, RLMObjectType> *_Nullable dictionary,\n                                                         RLMDictionaryChange *_Nullable changes,\n                                                         NSError *_Nullable error))block\n                                      keyPaths:(nullable NSArray<NSString *> *)keyPaths\n__attribute__((warn_unused_result));\n\n#pragma mark - Freeze\n\n/**\n Returns a frozen (immutable) snapshot of a dictionary.\n\n The frozen copy is an immutable dictionary which contains the same data as this\n dictionary currently contains, but will not update when writes are made to the\n containing Realm. Unlike live dictionaries, frozen dictionaries can be accessed from any\n thread.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning This method may only be called on a managed dictionary.\n @warning Holding onto a frozen dictionary for an extended period while performing\n          write transaction on the Realm may result in the Realm file growing\n          to large sizes. See `RLMRealmConfiguration.maximumNumberOfActiveVersions`\n          for more information.\n */\n- (instancetype)freeze;\n\n/**\n Returns a live version of this frozen collection.\n\n This method resolves a reference to a live copy of the same frozen collection.\n If called on a live collection, will return itself.\n*/\n- (instancetype)thaw;\n\n#pragma mark - Unavailable Methods\n/**\n `-[RLMDictionary init]` is not available because `RLMDictionary`s cannot be created directly.\n `RLMDictionary` properties on `RLMObject`s are lazily created when accessed.\n */\n- (instancetype)init __attribute__((unavailable(\"RLMDictionary cannot be created directly\")));\n/**\n `+[RLMDictionary new]` is not available because `RLMDictionary`s cannot be created directly.\n `RLMDictionary` properties on `RLMObject`s are lazily created when accessed.\n */\n+ (instancetype)new __attribute__((unavailable(\"RLMDictionary cannot be created directly\")));\n\n@end\n\n/**\n A `RLMDictionaryChange` object encapsulates information about changes to dictionaries\n that are reported by Realm notifications.\n\n `RLMDictionaryChange` is passed to the notification blocks registered with\n `-addNotificationBlock` on `RLMDictionary`, and reports what keys in the\n dictionary changed since the last time the notification block was called.\n */\n@interface RLMDictionaryChange : NSObject\n/// The keys in the new version of the dictionary which were newly inserted.\n@property (nonatomic, readonly) NSArray<id> *insertions;\n\n/// The keys in the new version of the dictionary which were modified.\n@property (nonatomic, readonly) NSArray<id> *modifications;\n\n/// The keys which were deleted from the old version.\n@property (nonatomic, readonly) NSArray<id> *deletions;\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMDictionary.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMDictionary_Private.hpp\"\n#import \"RLMObject_Private.h\"\n#import \"RLMObjectSchema.h\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMQueryUtil.hpp\"\n#import \"RLMSchema_Private.h\"\n#import \"RLMThreadSafeReference_Private.hpp\"\n#import \"RLMUtil.hpp\"\n\n@interface RLMDictionary () <RLMThreadConfined_Private>\n@end\n\n@implementation NSString (RLMDictionaryKey)\n@end\n\n@implementation RLMDictionary {\n@public\n    // Backing dictionary when this instance is unmanaged\n    NSMutableDictionary *_backingCollection;\n}\n\n#pragma mark Initializers\n\n- (instancetype)initWithObjectClassName:(__unsafe_unretained NSString *const)objectClassName\n                                keyType:(RLMPropertyType)keyType {\n    REALM_ASSERT([objectClassName length] > 0);\n    REALM_ASSERT(RLMValidateKeyType(keyType));\n    self = [super init];\n    if (self) {\n        _objectClassName = objectClassName;\n        _type = RLMPropertyTypeObject;\n        _keyType = keyType;\n        _optional = YES;\n    }\n    return self;\n}\n\n- (instancetype)initWithObjectType:(RLMPropertyType)type optional:(BOOL)optional keyType:(RLMPropertyType)keyType {\n    REALM_ASSERT(RLMValidateKeyType(keyType));\n    REALM_ASSERT(type != RLMPropertyTypeObject);\n    self = [super init];\n    if (self) {\n        _type = type;\n        _keyType = keyType;\n        _optional = optional;\n    }\n    return self;\n}\n\n- (void)setParent:(RLMObjectBase *)parentObject property:(RLMProperty *)property {\n    _parentObject = parentObject;\n    _property = property;\n    _isLegacyProperty = property.isLegacy;\n}\n\nstatic bool RLMValidateKeyType(RLMPropertyType keyType) {\n    switch (keyType) {\n        case RLMPropertyTypeString:\n            return true;\n        default:\n            return false;\n    }\n}\n\nid RLMDictionaryKey(__unsafe_unretained RLMDictionary *const dictionary,\n                    __unsafe_unretained id const key) {\n    if (!key) {\n        @throw RLMException(@\"Invalid nil key for dictionary expecting key of type '%@'.\",\n                            dictionary->_objectClassName ?: RLMTypeToString(dictionary.keyType));\n    }\n    id validated = RLMValidateValue(key, dictionary.keyType, false, false, nil);\n    if (!validated) {\n        @throw RLMException(@\"Invalid key '%@' of type '%@' for expected type '%@'.\",\n                            key, [key class], RLMTypeToString(dictionary.keyType));\n    }\n    return validated;\n}\n\nid RLMDictionaryValue(__unsafe_unretained RLMDictionary *const dictionary,\n                      __unsafe_unretained id const value) {\n    if (!value) {\n        return value;\n    }\n    if (dictionary->_type != RLMPropertyTypeObject) {\n        id validated = RLMValidateValue(value, dictionary->_type, dictionary->_optional, false, nil);\n        if (!validated) {\n            @throw RLMException(@\"Invalid value '%@' of type '%@' for expected type '%@%s'.\",\n                                value, [value class], RLMTypeToString(dictionary->_type),\n                                dictionary->_optional ? \"?\" : \"\");\n        }\n        return validated;\n    }\n\n    if (auto valueObject = RLMDynamicCast<RLMObjectBase>(value)) {\n        if (!valueObject->_objectSchema) {\n            @throw RLMException(@\"Object cannot be inserted unless the schema is initialized. \"\n                                \"This can happen if you try to insert objects into a RLMDictionary / Map from a default value or from an overridden unmanaged initializer (`init()`) or if the key is uninitialized.\");\n        }\n        if (![dictionary->_objectClassName isEqualToString:valueObject->_objectSchema.className]) {\n            @throw RLMException(@\"Value of type '%@' does not match RLMDictionary value type '%@'.\",\n                                valueObject->_objectSchema.className, dictionary->_objectClassName);\n        }\n    }\n    else if (![value isKindOfClass:NSNull.class]) {\n        @throw RLMException(@\"Value of type '%@' does not match RLMDictionary value type '%@'.\",\n                            [value className], dictionary->_objectClassName);\n    }\n\n    return value;\n}\n\nstatic void changeDictionary(__unsafe_unretained RLMDictionary *const dictionary,\n                             dispatch_block_t f) {\n    if (!dictionary->_backingCollection) {\n        dictionary->_backingCollection = [NSMutableDictionary new];\n    }\n    if (RLMObjectBase *parent = dictionary->_parentObject) {\n        [parent willChangeValueForKey:dictionary->_property.name];\n        f();\n        [parent didChangeValueForKey:dictionary->_property.name];\n    }\n    else {\n        f();\n    }\n}\n\n// The compiler complains about the method's argument type not matching due to\n// it not having the generic type attached, but it doesn't seem to be possible\n// to actually include the generic type\n// http://www.openradar.me/radar?id=6135653276319744\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wmismatched-parameter-types\"\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMDictionary *, RLMDictionaryChange *, NSError *))block {\n    return RLMAddNotificationBlock(self, block, nil, nil);\n}\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMDictionary *, RLMDictionaryChange *, NSError *))block\n                                         queue:(dispatch_queue_t)queue {\n    return RLMAddNotificationBlock(self, block, nil, queue);\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMDictionary *, RLMDictionaryChange *, NSError *))block\n                                      keyPaths:(nullable NSArray<NSString *> *)keyPaths\n                                         queue:(dispatch_queue_t)queue {\n    return RLMAddNotificationBlock(self, block, keyPaths, queue);\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMDictionary *, RLMDictionaryChange *, NSError *))block\n                                      keyPaths:(nullable NSArray<NSString *> *)keyPaths {\n    return RLMAddNotificationBlock(self, block, keyPaths, nil);\n}\n#pragma clang diagnostic pop\n\n#pragma mark - Unmanaged RLMDictionary implementation\n\n- (RLMRealm *)realm {\n    return nil;\n}\n\n- (NSUInteger)count {\n    return _backingCollection.count;\n}\n\n- (NSArray *)allKeys {\n    return _backingCollection.allKeys ?: @[];\n}\n\n- (NSArray *)allValues {\n    return _backingCollection.allValues ?: @[];\n}\n\n- (nullable id)objectForKey:(id)key {\n    if (!_backingCollection) {\n        _backingCollection = [NSMutableDictionary new];\n    }\n    return [_backingCollection objectForKey:key];\n}\n\n- (nullable id)objectForKeyedSubscript:(id)key {\n    return [self objectForKey:key];\n}\n\n- (BOOL)isInvalidated {\n    return NO;\n}\n\n- (void)setValue:(nullable id)value forKey:(nonnull NSString *)key {\n    [self setObject:value forKeyedSubscript:key];\n}\n\n- (void)setDictionary:(id)dictionary {\n    if (!dictionary || dictionary == NSNull.null) {\n        return [self removeAllObjects];\n    }\n    if (![dictionary respondsToSelector:@selector(enumerateKeysAndObjectsUsingBlock:)]) {\n        @throw RLMException(@\"Cannot set dictionary to object of class '%@'\", [dictionary className]);\n    }\n\n    changeDictionary(self, ^{\n        [_backingCollection removeAllObjects];\n        [dictionary enumerateKeysAndObjectsUsingBlock:^(id key, id value, BOOL *) {\n            [_backingCollection setObject:RLMDictionaryValue(self, value)\n                                   forKey:RLMDictionaryKey(self, key)];\n        }];\n    });\n}\n\n- (void)setObject:(id)obj forKeyedSubscript:(id)key {\n    if (obj) {\n        [self setObject:obj forKey:key];\n    }\n    else {\n        [self removeObjectForKey:key];\n    }\n}\n\n- (void)setObject:(id)obj forKey:(id)key {\n    changeDictionary(self, ^{\n        [_backingCollection setObject:RLMDictionaryValue(self, obj)\n                               forKey:RLMDictionaryKey(self, key)];\n    });\n}\n\n- (void)removeAllObjects {\n    changeDictionary(self, ^{\n        [_backingCollection removeAllObjects];\n    });\n}\n\n- (void)removeObjectsForKeys:(NSArray *)keyArray {\n    changeDictionary(self, ^{\n        [_backingCollection removeObjectsForKeys:keyArray];\n    });\n}\n\n- (void)removeObjectForKey:(id)key {\n    changeDictionary(self, ^{\n        [_backingCollection removeObjectForKey:key];\n    });\n}\n\n- (void)enumerateKeysAndObjectsUsingBlock:(void (^)(id key, id obj, BOOL *stop))block {\n    [_backingCollection enumerateKeysAndObjectsUsingBlock:block];\n}\n\n- (nullable id)valueForKey:(nonnull NSString *)key {\n    if ([key isEqualToString:RLMInvalidatedKey]) {\n        return @NO; // Unmanaged dictionaries are never invalidated\n    }\n    if (!_backingCollection) {\n        _backingCollection = [NSMutableDictionary new];\n    }\n    return [_backingCollection valueForKey:key];\n}\n\n- (id)valueForKeyPath:(NSString *)keyPath {\n    if ([keyPath characterAtIndex:0] != '@') {\n        return _backingCollection ? [_backingCollection valueForKeyPath:keyPath] : [super valueForKeyPath:keyPath];\n    }\n    if (!_backingCollection) {\n        _backingCollection = [NSMutableDictionary new];\n    }\n    NSUInteger dot = [keyPath rangeOfString:@\".\"].location;\n    if (dot == NSNotFound) {\n        return [_backingCollection valueForKeyPath:keyPath];\n    }\n\n    NSString *op = [keyPath substringToIndex:dot];\n    NSString *key = [keyPath substringFromIndex:dot + 1];\n    return [self aggregateProperty:key operation:op method:nil];\n}\n\n- (void)addEntriesFromDictionary:(id)otherDictionary {\n    if (!otherDictionary) {\n        return;\n    }\n    if (![otherDictionary respondsToSelector:@selector(enumerateKeysAndObjectsUsingBlock:)]) {\n        @throw RLMException(@\"Cannot add entries from object of class '%@'\", [otherDictionary className]);\n    }\n\n    changeDictionary(self, ^{\n        [otherDictionary enumerateKeysAndObjectsUsingBlock:^(id key, id value, BOOL *) {\n            _backingCollection[RLMDictionaryKey(self, key)] = RLMDictionaryValue(self, value);\n        }];\n    });\n}\n\n- (NSUInteger)countByEnumeratingWithState:(nonnull NSFastEnumerationState *)state\n                                  objects:(__unsafe_unretained id  _Nullable * _Nonnull)buffer\n                                    count:(NSUInteger)len {\n    return RLMUnmanagedFastEnumerate(_backingCollection.allKeys, state);\n}\n\n#pragma mark - Aggregate operations\n\n- (RLMPropertyType)typeForProperty:(NSString *)propertyName {\n    if ([propertyName isEqualToString:@\"self\"]) {\n        return _type;\n    }\n\n    RLMObjectSchema *objectSchema;\n    if (_backingCollection.count) {\n        objectSchema = [_backingCollection.allValues[0] objectSchema];\n    }\n    else {\n        objectSchema = [RLMSchema.partialPrivateSharedSchema schemaForClassName:_objectClassName];\n    }\n\n    return RLMValidatedProperty(objectSchema, propertyName).type;\n}\n\n- (id)aggregateProperty:(NSString *)key operation:(NSString *)op method:(SEL)sel {\n    // Although delegating to valueForKeyPath: here would allow to support\n    // nested key paths as well, limiting functionality gives consistency\n    // between unmanaged and managed arrays.\n    if ([key rangeOfString:@\".\"].location != NSNotFound) {\n        @throw RLMException(@\"Nested key paths are not supported yet for KVC collection operators.\");\n    }\n\n    if ([op isEqualToString:@\"@distinctUnionOfObjects\"]) {\n        @throw RLMException(@\"this class does not implement the distinctUnionOfObjects\");\n    }\n\n    bool allowDate = false;\n    bool sum = false;\n    if ([op isEqualToString:@\"@min\"] || [op isEqualToString:@\"@max\"]) {\n        allowDate = true;\n    }\n    else if ([op isEqualToString:@\"@sum\"]) {\n        sum = true;\n    }\n    else if (![op isEqualToString:@\"@avg\"]) {\n        // Just delegate to NSDictionary for all other operators\n        return [_backingCollection valueForKeyPath:[op stringByAppendingPathExtension:key]];\n    }\n\n    RLMPropertyType type = [self typeForProperty:key];\n    if (!canAggregate(type, allowDate)) {\n        NSString *method = sel ? NSStringFromSelector(sel) : op;\n        if (_type == RLMPropertyTypeObject) {\n            @throw RLMException(@\"%@: is not supported for %@ property '%@.%@'\",\n                                method, RLMTypeToString(type), _objectClassName, key);\n        }\n        else {\n            @throw RLMException(@\"%@ is not supported for %@%s dictionary\",\n                                method, RLMTypeToString(_type), _optional ? \"?\" : \"\");\n        }\n    }\n\n    NSArray *values = [key isEqualToString:@\"self\"] ? _backingCollection.allValues : [_backingCollection.allValues valueForKey:key];\n\n    if (_optional) {\n        // Filter out NSNull values to match our behavior on managed arrays\n        NSIndexSet *nonnull = [values indexesOfObjectsPassingTest:^BOOL(id obj, NSUInteger, BOOL *) {\n            return obj != NSNull.null;\n        }];\n        if (nonnull.count < values.count) {\n            values = [values objectsAtIndexes:nonnull];\n        }\n    }\n    id result = [values valueForKeyPath:[op stringByAppendingString:@\".self\"]];\n    return sum && !result ? @0 : result;\n}\n\n- (id)minOfProperty:(NSString *)property {\n    return [self aggregateProperty:property operation:@\"@min\" method:_cmd];\n}\n\n- (id)maxOfProperty:(NSString *)property {\n    return [self aggregateProperty:property operation:@\"@max\" method:_cmd];\n}\n\n- (id)sumOfProperty:(NSString *)property {\n    return [self aggregateProperty:property operation:@\"@sum\" method:_cmd];\n}\n\n- (id)averageOfProperty:(NSString *)property {\n    return [self aggregateProperty:property operation:@\"@avg\" method:_cmd];\n}\n\n- (nonnull RLMResults *)objectsWhere:(nonnull NSString *)predicateFormat, ... {\n    va_list args;\n    va_start(args, predicateFormat);\n    RLMResults *results = [self objectsWhere:predicateFormat args:args];\n    va_end(args);\n    return results;\n}\n\n- (nonnull RLMResults *)objectsWhere:(nonnull NSString *)predicateFormat args:(va_list)args {\n    return [self objectsWithPredicate:[NSPredicate predicateWithFormat:predicateFormat arguments:args]];\n}\n\n- (BOOL)isEqual:(id)object {\n    if (auto dictionary = RLMDynamicCast<RLMDictionary>(object)) {\n        return !dictionary.realm\n        && ((_backingCollection.count == 0 && dictionary->_backingCollection.count == 0)\n            || [_backingCollection isEqual:dictionary->_backingCollection]);\n    }\n    return NO;\n}\n\n- (void)addObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath\n            options:(NSKeyValueObservingOptions)options context:(void *)context {\n    RLMDictionaryValidateObservationKey(keyPath, self);\n    [super addObserver:observer forKeyPath:keyPath options:options context:context];\n}\n\n#pragma mark - Key Path Strings\n\n- (NSString *)propertyKey {\n    return _property.name;\n}\n\n#pragma mark - Methods unsupported on unmanaged RLMDictionary instances\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wunused-parameter\"\n\n- (nonnull RLMResults *)objectsWithPredicate:(nonnull NSPredicate *)predicate {\n    @throw RLMException(@\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n}\n\n- (RLMResults *)sortedResultsUsingDescriptors:(nonnull NSArray<RLMSortDescriptor *> *)properties {\n    @throw RLMException(@\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n}\n\n- (RLMResults *)sortedResultsUsingKeyPath:(nonnull NSString *)keyPath ascending:(BOOL)ascending {\n    @throw RLMException(@\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n}\n\n- (RLMResults *)distinctResultsUsingKeyPaths:(NSArray<NSString *> *)keyPaths {\n    @throw RLMException(@\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n}\n\n- (instancetype)freeze {\n    @throw RLMException(@\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n}\n\n- (instancetype)thaw {\n    @throw RLMException(@\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n}\n\n- (NSUInteger)indexOfObject:(id)value {\n    @throw RLMException(@\"This method is not available on RLMDictionary.\");\n}\n\n- (id)objectAtIndex:(NSUInteger)index {\n    @throw RLMException(@\"This method is not available on RLMDictionary.\");\n}\n\n- (nullable NSArray *)objectsAtIndexes:(nonnull NSIndexSet *)indexes {\n    @throw RLMException(@\"This method is not available on RLMDictionary.\");\n}\n\n- (RLMSectionedResults *)sectionedResultsSortedUsingKeyPath:(NSString *)keyPath\n                                                  ascending:(BOOL)ascending\n                                                   keyBlock:(RLMSectionedResultsKeyBlock)keyBlock {\n    @throw RLMException(@\"This method is not available on RLMDictionary.\");\n}\n\n- (RLMSectionedResults *)sectionedResultsUsingSortDescriptors:(NSArray<RLMSortDescriptor *> *)sortDescriptors\n                                                     keyBlock:(RLMSectionedResultsKeyBlock)keyBlock {\n    @throw RLMException(@\"This method is not available on RLMDictionary.\");\n}\n\n#pragma clang diagnostic pop // unused parameter warning\n\n#pragma mark - Thread Confined Protocol Conformance\n\n- (realm::ThreadSafeReference)makeThreadSafeReference {\n    REALM_TERMINATE(\"Unexpected handover of unmanaged `RLMDictionary`\");\n}\n\n- (id)objectiveCMetadata {\n    REALM_TERMINATE(\"Unexpected handover of unmanaged `RLMDictionary`\");\n}\n\n+ (instancetype)objectWithThreadSafeReference:(realm::ThreadSafeReference)reference\n                                     metadata:(id)metadata\n                                        realm:(RLMRealm *)realm {\n    REALM_TERMINATE(\"Unexpected handover of unmanaged `RLMDictionary`\");\n}\n\n#pragma mark - Superclass Overrides\n\n- (NSString *)description {\n    return [self descriptionWithMaxDepth:RLMDescriptionMaxDepth];\n}\n\n- (NSString *)descriptionWithMaxDepth:(NSUInteger)depth {\n    return RLMDictionaryDescriptionWithMaxDepth(@\"RLMDictionary\", self, depth);\n}\n\nNSString *RLMDictionaryDescriptionWithMaxDepth(NSString *name,\n                                               RLMDictionary *dictionary,\n                                               NSUInteger depth) {\n    if (depth == 0) {\n        return @\"<Maximum depth exceeded>\";\n    }\n\n    const NSUInteger maxObjects = 100;\n    auto str = [NSMutableString stringWithFormat:@\"%@<%@, %@> <%p> (\\n\", name,\n                RLMTypeToString([dictionary keyType]),\n                [dictionary objectClassName] ?: RLMTypeToString([dictionary type]),\n                (void *)dictionary];\n    size_t index = 0, skipped = 0;\n    for (id key in dictionary) {\n        id value = dictionary[key];\n        NSString *keyDesc;\n        if ([key respondsToSelector:@selector(descriptionWithMaxDepth:)]) {\n            keyDesc = [key descriptionWithMaxDepth:depth - 1];\n        }\n        else {\n            keyDesc = [key description];\n        }\n        NSString *valDesc;\n        if ([value respondsToSelector:@selector(descriptionWithMaxDepth:)]) {\n            valDesc = [value descriptionWithMaxDepth:depth - 1];\n        }\n        else {\n            valDesc = [value description];\n        }\n\n        // Indent child objects\n        NSString *sub = [NSString stringWithFormat:@\"[%@]: %@\", keyDesc, valDesc];\n        NSString *objDescription = [sub stringByReplacingOccurrencesOfString:@\"\\n\"\n                                                                  withString:@\"\\n\\t\"];\n        [str appendFormat:@\"%@,\\n\", objDescription];\n        if (index >= maxObjects) {\n            skipped = dictionary.count - maxObjects;\n            break;\n        }\n    }\n\n    // Remove last comma and newline characters\n    if (dictionary.count > 0) {\n        [str deleteCharactersInRange:NSMakeRange(str.length-2, 2)];\n    }\n    if (skipped) {\n        [str appendFormat:@\"\\n\\t... %zu objects skipped.\", skipped];\n    }\n    [str appendFormat:@\"\\n)\"];\n    return str;\n}\n\n@end\n"
  },
  {
    "path": "Realm/RLMDictionary_Private.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMDictionary.h>\n\n@class RLMObjectBase, RLMProperty;\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@interface RLMDictionary ()\n- (instancetype)initWithObjectClassName:(NSString *)objectClassName keyType:(RLMPropertyType)keyType;\n- (instancetype)initWithObjectType:(RLMPropertyType)type optional:(BOOL)optional keyType:(RLMPropertyType)keyType;\n- (NSString *)descriptionWithMaxDepth:(NSUInteger)depth;\n- (void)setParent:(RLMObjectBase *)parentObject property:(RLMProperty *)property;\n// YES if the property is declared with old property syntax.\n@property (nonatomic, readonly) BOOL isLegacyProperty;\n// The name of the property which this collection represents\n@property (nonatomic, readonly) NSString *propertyKey;\n@end\n\n@interface RLMManagedDictionary : RLMDictionary\n- (instancetype)initWithParent:(RLMObjectBase *)parentObject property:(RLMProperty *)property;\n@end\n\nFOUNDATION_EXTERN NSString *RLMDictionaryDescriptionWithMaxDepth(NSString *name,\n                                                                 RLMDictionary *dictionary,\n                                                                 NSUInteger depth);\nid RLMDictionaryKey(RLMDictionary *dictionary, id key) RLM_HIDDEN;\nid RLMDictionaryValue(RLMDictionary *dictionary, id value) RLM_HIDDEN;\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMDictionary_Private.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMDictionary_Private.h\"\n\n#import \"RLMCollection_Private.hpp\"\n\n#import \"RLMResults_Private.hpp\"\n\n#import <realm/table_ref.hpp>\n\nnamespace realm {\n    class Results;\n}\n\n@class RLMObjectBase, RLMObjectSchema, RLMProperty;\nclass RLMClassInfo;\nclass RLMObservationInfo;\n\n@interface RLMDictionary () {\n@protected\n    NSString *_objectClassName;\n    BOOL _optional;\n@public\n    // The property which this RLMDictionary represents\n    RLMProperty *_property;\n    __weak RLMObjectBase *_parentObject;\n}\n@end\n\n@interface RLMManagedDictionary () <RLMCollectionPrivate>\n\n- (RLMManagedDictionary *)initWithBackingCollection:(realm::object_store::Dictionary)dictionary\n                                         parentInfo:(RLMClassInfo *)parentInfo\n                                           property:(__unsafe_unretained RLMProperty *const)property;\n- (RLMManagedDictionary *)initWithParent:(realm::Obj)parent\n                                property:(RLMProperty *)property\n                              parentInfo:(RLMClassInfo&)info;\n\n- (bool)isBackedByDictionary:(realm::object_store::Dictionary const&)dictionary;\n\n// deletes all objects in the RLMDictionary from their containing realms\n- (void)deleteObjectsFromRealm;\n@end\n\nvoid RLMDictionaryValidateObservationKey(__unsafe_unretained NSString *const keyPath,\n                                         __unsafe_unretained RLMDictionary *const collection);\n\n// Initialize the observation info for an dictionary if needed\nvoid RLMEnsureDictionaryObservationInfo(std::unique_ptr<RLMObservationInfo>& info,\n                                        NSString *keyPath, RLMDictionary *array, id observed);\n"
  },
  {
    "path": "Realm/RLMEmbeddedObject.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMObjectBase.h>\n#import <Realm/RLMThreadSafeReference.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@class RLMObjectSchema, RLMPropertyDescriptor, RLMRealm, RLMNotificationToken, RLMPropertyChange;\ntypedef void (^RLMObjectChangeBlock)(BOOL deleted,\n                                     NSArray<RLMPropertyChange *> *_Nullable changes,\n                                     NSError *_Nullable error);\n/**\n `RLMEmbeddedObject` is a base class used to define Realm model objects.\n\n Embedded objects work similarly to normal objects, but are owned by a single\n parent Object (which itself may be embedded). Unlike normal top-level objects,\n embedded objects cannot be directly created in or added to a Realm. Instead,\n they can only be created as part of a parent object, or by assigning an\n unmanaged object to a parent object's property. Embedded objects are\n automatically deleted when the parent object is deleted or when the parent is\n modified to no longer point at the embedded object, either by reassigning an\n RLMObject property or by removing the embedded object from the array containing\n it.\n\n Embedded objects can only ever have a single parent object which links to them,\n and attempting to link to an existing managed embedded object will throw an\n exception.\n\n The property types supported on `RLMEmbeddedObject` are the same as for\n `RLMObject`, except for that embedded objects cannot link to top-level objects,\n so `RLMObject` and `RLMArray<RLMObject>` properties are not supported\n (`RLMEmbeddedObject` and `RLMArray<RLMEmbeddedObject>` *are*).\n\n Embedded objects cannot have primary keys or indexed properties.\n */\n\n@interface RLMEmbeddedObject : RLMObjectBase <RLMThreadConfined>\n\n#pragma mark - Creating & Initializing Objects\n\n/**\n Creates an unmanaged instance of a Realm object.\n\n Unmanaged embedded objects can be added to a Realm by assigning them to an\n object property of a managed Realm object or by adding them to a managed\n RLMArray.\n */\n- (instancetype)init NS_DESIGNATED_INITIALIZER;\n\n/**\n Creates an unmanaged instance of a Realm object.\n\n Pass in an `NSArray` or `NSDictionary` instance to set the values of the object's properties.\n\n Unmanaged embedded objects can be added to a Realm by assigning them to an\n object property of a managed Realm object or by adding them to a managed\n RLMArray.\n */\n- (instancetype)initWithValue:(id)value;\n\n/**\n Returns the class name for a Realm object subclass.\n\n @warning Do not override. Realm relies on this method returning the exact class\n          name.\n\n @return  The class name for the model class.\n */\n+ (NSString *)className;\n\n#pragma mark - Properties\n\n/**\n The Realm which manages the object, or `nil` if the object is unmanaged.\n */\n@property (nonatomic, readonly, nullable) RLMRealm *realm;\n\n/**\n The object schema which lists the managed properties for the object.\n */\n@property (nonatomic, readonly) RLMObjectSchema *objectSchema;\n\n/**\n Indicates if the object can no longer be accessed because it is now invalid.\n\n An object can no longer be accessed if the object has been deleted from the Realm that manages it, or\n if `invalidate` is called on that Realm.\n */\n@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated;\n\n/**\n Indicates if this object is frozen.\n\n @see `-[RLMEmbeddedObject freeze]`\n */\n@property (nonatomic, readonly, getter = isFrozen) BOOL frozen;\n\n#pragma mark - Customizing your Objects\n\n/**\n Override this method to specify the default values to be used for each property.\n\n @return    A dictionary mapping property names to their default values.\n */\n+ (nullable NSDictionary *)defaultPropertyValues;\n\n/**\n Override this method to specify the names of properties to ignore. These properties will not be managed by the Realm\n that manages the object.\n\n @return    An array of property names to ignore.\n */\n+ (nullable NSArray<NSString *> *)ignoredProperties;\n\n/**\n Override this method to specify the names of properties that are non-optional (i.e. cannot be assigned a `nil` value).\n\n By default, all properties of a type whose values can be set to `nil` are\n considered optional properties. To require that an object in a Realm always\n store a non-`nil` value for a property, add the name of the property to the\n array returned from this method.\n\n Properties of `RLMEmbeddedObject` type cannot be non-optional. Array and\n `NSNumber` properties can be non-optional, but there is no reason to do so:\n arrays do not support storing nil, and if you want a non-optional number you\n should instead use the primitive type.\n\n @return    An array of property names that are required.\n */\n+ (NSArray<NSString *> *)requiredProperties;\n\n/**\n Override this method to provide information related to properties containing linking objects.\n\n Each property of type `RLMLinkingObjects` must have a key in the dictionary returned by this method consisting\n of the property name. The corresponding value must be an instance of `RLMPropertyDescriptor` that describes the class\n and property that the property is linked to.\n\n     return @{ @\"owners\": [RLMPropertyDescriptor descriptorWithClass:Owner.class propertyName:@\"dogs\"] };\n\n @return     A dictionary mapping property names to `RLMPropertyDescriptor` instances.\n */\n+ (NSDictionary<NSString *, RLMPropertyDescriptor *> *)linkingObjectsProperties;\n\n#pragma mark - Notifications\n\n/**\n Registers a block to be called each time the object changes.\n\n The block will be asynchronously called after each write transaction which\n deletes the object or modifies any of the managed properties of the object,\n including self-assignments that set a property to its existing value.\n\n For write transactions performed on different threads or in differen\n processes, the block will be called when the managing Realm is\n (auto)refreshed to a version including the changes, while for local write\n transactions it will be called at some point in the future after the write\n transaction is committed.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When notifications\n can't be delivered instantly, multiple notifications may be coalesced into a\n single notification.\n\n Unlike with `RLMArray` and `RLMResults`, there is no \"initial\" callback made\n after you add a new notification block.\n\n Only objects which are managed by a Realm can be observed in this way. You\n must retain the returned token for as long as you want updates to be sent to\n the block. To stop receiving updates, call `-invalidate` on the token.\n\n It is safe to capture a strong reference to the observed object within the\n callback block. There is no retain cycle due to that the callback is retained\n by the returned token and not by the object itself.\n\n @warning This method cannot be called during a write transaction, when the\n          containing Realm is read-only, or on an unmanaged object.\n\n @param block The block to be called whenever a change occurs.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block;\n\n/**\n Registers a block to be called each time the object changes.\n\n The block will be asynchronously called after each write transaction which\n deletes the object or modifies any of the managed properties of the object,\n including self-assignments that set a property to its existing value.\n\n For write transactions performed on different threads or in different\n processes, the block will be called when the managing Realm is\n (auto)refreshed to a version including the changes, while for local write\n transactions it will be called at some point in the future after the write\n transaction is committed.\n\n Notifications are delivered on the given queue. If the queue is blocked and\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification.\n\n Unlike with `RLMArray` and `RLMResults`, there is no \"initial\" callback made\n after you add a new notification block.\n\n Only objects which are managed by a Realm can be observed in this way. You\n must retain the returned token for as long as you want updates to be sent to\n the block. To stop receiving updates, call `-invalidate` on the token.\n\n It is safe to capture a strong reference to the observed object within the\n callback block. There is no retain cycle due to that the callback is retained\n by the returned token and not by the object itself.\n\n @warning This method cannot be called during a write transaction, when the\n          containing Realm is read-only, or on an unmanaged object.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param queue The serial queue to deliver notifications to.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block queue:(dispatch_queue_t)queue;\n\n/**\n Registers a block to be called each time the object changes.\n\n The block will be asynchronously called after each write transaction which\n deletes the object or modifies any of the managed properties of the object,\n including self-assignments that set a property to its existing value.\n\n For write transactions performed on different threads or in different\n processes, the block will be called when the managing Realm is\n (auto)refreshed to a version including the changes, while for local write\n transactions it will be called at some point in the future after the write\n transaction is committed.\n\n Notifications are delivered on the given queue. If the queue is blocked and\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification.\n\n Unlike with `RLMArray` and `RLMResults`, there is no \"initial\" callback made\n after you add a new notification block.\n\n Only objects which are managed by a Realm can be observed in this way. You\n must retain the returned token for as long as you want updates to be sent to\n the block. To stop receiving updates, call `-invalidate` on the token.\n\n It is safe to capture a strong reference to the observed object within the\n callback block. There is no retain cycle due to that the callback is retained\n by the returned token and not by the object itself.\n\n @warning This method cannot be called during a write transaction, when the\n          containing Realm is read-only, or on an unmanaged object.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param keyPaths The block will be called for changes occurring on these keypaths. If no\n key paths are given, notifications are delivered for every property key path.\n @param queue The serial queue to deliver notifications to.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block keyPaths:(NSArray<NSString *> *)keyPaths queue:(dispatch_queue_t)queue;\n\n/**\n Registers a block to be called each time the object changes.\n\n The block will be asynchronously called after each write transaction which\n deletes the object or modifies any of the managed properties of the object,\n including self-assignments that set a property to its existing value.\n\n For write transactions performed on different threads or in different\n processes, the block will be called when the managing Realm is\n (auto)refreshed to a version including the changes, while for local write\n transactions it will be called at some point in the future after the write\n transaction is committed.\n\n Notifications are delivered on the given queue. If the queue is blocked and\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification.\n\n Unlike with `RLMArray` and `RLMResults`, there is no \"initial\" callback made\n after you add a new notification block.\n\n Only objects which are managed by a Realm can be observed in this way. You\n must retain the returned token for as long as you want updates to be sent to\n the block. To stop receiving updates, call `-invalidate` on the token.\n\n It is safe to capture a strong reference to the observed object within the\n callback block. There is no retain cycle due to that the callback is retained\n by the returned token and not by the object itself.\n\n @warning This method cannot be called during a write transaction, when the\n          containing Realm is read-only, or on an unmanaged object.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param keyPaths The block will be called for changes occurring on these keypaths. If no\n key paths are given, notifications are delivered for every property key path.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block keyPaths:(NSArray<NSString *> *)keyPaths;\n\n#pragma mark - Other Instance Methods\n\n/**\n Returns YES if another Realm object instance points to the same object as the\n receiver in the Realm managing the receiver.\n\n For frozen objects and object types with a primary key, `isEqual:` is\n overridden to use the same logic as this method (along with a corresponding\n implementation for `hash`). Non-frozen objects without primary keys use\n pointer identity for `isEqual:` and `hash`.\n\n @param object  The object to compare the receiver to.\n\n @return    Whether the object represents the same object as the receiver.\n */\n- (BOOL)isEqualToObject:(RLMEmbeddedObject *)object;\n\n/**\n Returns a frozen (immutable) snapshot of this object.\n\n The frozen copy is an immutable object which contains the same data as this\n object currently contains, but will not update when writes are made to the\n containing Realm. Unlike live objects, frozen objects can be accessed from any\n thread.\n\n - warning: Holding onto a frozen object for an extended period while performing write\n transaction on the Realm may result in the Realm file growing to large sizes. See\n `Realm.Configuration.maximumNumberOfActiveVersions` for more information.\n - warning: This method can only be called on a managed object.\n */\n- (instancetype)freeze NS_RETURNS_RETAINED;\n\n/**\n Returns a live (mutable) reference of this object.\n\n This method creates a managed accessor to a live copy of the same frozen object.\n Will return self if called on an already live object.\n */\n- (instancetype)thaw;\n\n#pragma mark - Dynamic Accessors\n\n/// :nodoc:\n- (nullable id)objectForKeyedSubscript:(NSString *)key;\n\n/// :nodoc:\n- (void)setObject:(nullable id)obj forKeyedSubscript:(NSString *)key;\n\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMEmbeddedObject.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMEmbeddedObject.h\"\n\n#import \"RLMObject_Private.hpp\"\n#import \"RLMSchema_Private.h\"\n\n@implementation RLMEmbeddedObject\n// synthesized in RLMObjectBase but redeclared here for documentation purposes\n@dynamic invalidated, realm, objectSchema;\n\n#pragma mark - Designated Initializers\n\n- (instancetype)init {\n    return [super init];\n}\n\n#pragma mark - Convenience Initializers\n\n- (instancetype)initWithValue:(id)value {\n    if (!(self = [self init])) {\n        return nil;\n    }\n    RLMInitializeWithValue(self, value, RLMSchema.partialPrivateSharedSchema);\n    return self;\n}\n\n#pragma mark - Subscripting\n\n- (id)objectForKeyedSubscript:(NSString *)key {\n    return RLMObjectBaseObjectForKeyedSubscript(self, key);\n}\n\n- (void)setObject:(id)obj forKeyedSubscript:(NSString *)key {\n    RLMObjectBaseSetObjectForKeyedSubscript(self, key, obj);\n}\n\n#pragma mark - Other Instance Methods\n\n- (BOOL)isEqualToObject:(RLMObjectBase *)object {\n    return [object isKindOfClass:RLMObjectBase.class] && RLMObjectBaseAreEqual(self, object);\n}\n\n- (instancetype)freeze {\n    return RLMObjectFreeze(self);\n}\n\n- (instancetype)thaw {\n    return RLMObjectThaw(self);\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block {\n    return RLMObjectAddNotificationBlock(self, block, nil, nil);\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block queue:(dispatch_queue_t)queue {\n    return RLMObjectAddNotificationBlock(self, block, nil, queue);\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block keyPaths:(NSArray<NSString *> *)keyPaths {\n    return RLMObjectAddNotificationBlock(self, block, keyPaths, nil);\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block\n                                      keyPaths:(NSArray<NSString *> *)keyPaths\n                                         queue:(dispatch_queue_t)queue {\n    return RLMObjectAddNotificationBlock(self, block, keyPaths, queue);\n}\n\n+ (NSString *)className {\n    return [super className];\n}\n\n#pragma mark - Default values for schema definition\n\n+ (NSString *)primaryKey {\n    return nil;\n}\n\n+ (NSArray *)indexedProperties {\n    return @[];\n}\n\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{};\n}\n\n+ (NSDictionary *)defaultPropertyValues {\n    return nil;\n}\n\n+ (NSArray *)ignoredProperties {\n    return nil;\n}\n\n+ (NSArray *)requiredProperties {\n    return @[];\n}\n\n+ (bool)_realmIgnoreClass {\n    return false;\n}\n\n+ (bool)isEmbedded {\n    return true;\n}\n@end\n"
  },
  {
    "path": "Realm/RLMError.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2022 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\n@protocol RLMValue;\n\n#pragma mark - Error Domains\n\n/** Error code is a value from the RLMError enum. */\nextern NSString *const RLMErrorDomain;\n\n/** An error domain identifying non-specific system errors. */\nextern NSString *const RLMUnknownSystemErrorDomain;\n\n#pragma mark - RLMError\n\n/// A user info key containing the name of the error code. This is for\n/// debugging purposes only and should not be relied on.\nextern NSString *const RLMErrorCodeNameKey;\n\n/**\n `RLMError` is an enumeration representing all recoverable errors. It is\n associated with the Realm error domain specified in `RLMErrorDomain`.\n */\ntypedef RLM_ERROR_ENUM(NSInteger, RLMError, RLMErrorDomain) {\n    /** Denotes a general error that occurred when trying to open a Realm. */\n    RLMErrorFail                  = 1,\n\n    /** Denotes a file I/O error that occurred when trying to open a Realm. */\n    RLMErrorFileAccess            = 2,\n\n    /**\n     Denotes a file permission error that occurred when trying to open a Realm.\n\n     This error can occur if the user does not have permission to open or create\n     the specified file in the specified access mode when opening a Realm.\n     */\n    RLMErrorFilePermissionDenied  = 3,\n\n    /**\n     Denotes an error where a file was to be written to disk, but another\n     file with the same name already exists.\n     */\n    RLMErrorFileExists            = 4,\n\n    /**\n     Denotes an error that occurs if a file could not be found.\n\n     This error may occur if a Realm file could not be found on disk when\n     trying to open a Realm as read-only, or if the directory part of the\n     specified path was not found when trying to write a copy.\n     */\n    RLMErrorFileNotFound          = 5,\n\n    /**\n     Denotes an error that occurs if a file format upgrade is required to open\n     the file, but upgrades were explicitly disabled or the file is being open\n     in read-only mode.\n     */\n    RLMErrorFileFormatUpgradeRequired = 6,\n\n    /**\n     Denotes an error that occurs if the database file is currently open in\n     another process which cannot share with the current process due to an\n     architecture mismatch.\n\n     This error may occur if trying to share a Realm file between an i386\n     (32-bit) iOS Simulator and the Realm Studio application. In this case,\n     please use the 64-bit version of the iOS Simulator.\n     */\n    RLMErrorIncompatibleLockFile  = 8,\n\n    /**\n     Denotes an error that occurs when there is insufficient available address\n     space to mmap the Realm file.\n     */\n    RLMErrorAddressSpaceExhausted = 9,\n\n    /**\n    Denotes an error that occurs if there is a schema version mismatch and a\n    migration is required.\n    */\n    RLMErrorSchemaMismatch = 10,\n\n    /**\n     Denotes an error where an operation was requested which cannot be\n     performed on an open file.\n     */\n    RLMErrorAlreadyOpen = 12,\n\n    /// Denotes an error where an input value was invalid.\n    RLMErrorInvalidInput = 13,\n\n    /// Denotes an error where a write failed due to insufficient disk space.\n    RLMErrorOutOfDiskSpace = 14,\n\n    /**\n     Denotes an error where a Realm file could not be opened because another\n     process has opened the same file in a way incompatible with inter-process\n     sharing. For example, this can result from opening the backing file for an\n     in-memory Realm in non-in-memory mode.\n     */\n    RLMErrorIncompatibleSession = 15,\n\n    /**\n     Denotes an error that occurs if the file is a valid Realm file, but has a\n     file format version which is not supported by this version of Realm. This\n     typically means that the file was written by a newer version of Realm, but\n     may also mean that it is from a pre-1.0 version of Realm (or for\n     synchronized files, pre-10.0).\n     */\n    RLMErrorUnsupportedFileFormatVersion = 16,\n\n    /// A subscription was rejected by the server.\n    RLMErrorSubscriptionFailed = 18,\n\n    /// A file operation failed in a way which does not have a more specific error code.\n    RLMErrorFileOperationFailed = 19,\n\n    /**\n     Denotes an error that occurs if the file being opened is not a valid Realm\n     file. Some of the possible causes of this are:\n     1. The file at the given URL simply isn't a Realm file at all.\n     2. The wrong encryption key was given.\n     3. The Realm file is encrypted and no encryption key was given.\n     4. The Realm file isn't encrypted but an encryption key was given.\n     5. The file on disk has become corrupted.\n     */\n    RLMErrorInvalidDatabase = 20,\n\n    /**\n     Denotes an error that occurs if a Realm is opened in the wrong history\n     mode. Typically this means that either a local Realm is being opened as a\n     synchronized Realm or vice versa.\n     */\n    RLMErrorIncompatibleHistories = 21,\n};\n"
  },
  {
    "path": "Realm/RLMError.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2022 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMError_Private.hpp\"\n\n#import \"RLMUtil.hpp\"\n\n#import <realm/util/basic_system_errors.hpp>\n\nNSString *const RLMErrorDomain                   = @\"io.realm\";\nNSString *const RLMUnknownSystemErrorDomain      = @\"io.realm.unknown\";\n\nNSString *const RLMErrorCodeKey                  = @\"Error Code\";\nNSString *const RLMErrorCodeNameKey              = @\"Error Name\";\n\nnamespace {\nNSInteger translateFileError(realm::ErrorCodes::Error code) {\n    using ec = realm::ErrorCodes::Error;\n    switch (code) {\n        // Local errors\n        case ec::AddressSpaceExhausted:                return RLMErrorAddressSpaceExhausted;\n        case ec::DeleteOnOpenRealm:                    return RLMErrorAlreadyOpen;\n        case ec::FileAlreadyExists:                    return RLMErrorFileExists;\n        case ec::FileFormatUpgradeRequired:            return RLMErrorFileFormatUpgradeRequired;\n        case ec::FileNotFound:                         return RLMErrorFileNotFound;\n        case ec::FileOperationFailed:                  return RLMErrorFileOperationFailed;\n        case ec::IncompatibleHistories:                return RLMErrorIncompatibleHistories;\n        case ec::IncompatibleLockFile:                 return RLMErrorIncompatibleLockFile;\n        case ec::IncompatibleSession:                  return RLMErrorIncompatibleSession;\n        case ec::InvalidDatabase:                      return RLMErrorInvalidDatabase;\n        case ec::OutOfDiskSpace:                       return RLMErrorOutOfDiskSpace;\n        case ec::PermissionDenied:                     return RLMErrorFilePermissionDenied;\n        case ec::SchemaMismatch:                       return RLMErrorSchemaMismatch;\n        case ec::UnsupportedFileFormatVersion:         return RLMErrorUnsupportedFileFormatVersion;\n\n        default: {\n            auto category = realm::ErrorCodes::error_categories(code);\n            if (category.test(realm::ErrorCategory::file_access)) {\n                return RLMErrorFileAccess;\n            }\n            return RLMErrorFail;\n        }\n    }\n}\n\nNSString *errorString(realm::ErrorCodes::Error error) {\n    return RLMStringViewToNSString(realm::ErrorCodes::error_string(error));\n}\n\nNSError *translateSystemError(std::error_code ec, const char *msg) {\n    int code = ec.value();\n    BOOL isGenericCategoryError = ec.category() == std::generic_category()\n                               || ec.category() == realm::util::error::basic_system_error_category();\n    NSString *errorDomain = isGenericCategoryError ? NSPOSIXErrorDomain : RLMUnknownSystemErrorDomain;\n\n    NSMutableDictionary *userInfo = [NSMutableDictionary new];\n    userInfo[NSLocalizedDescriptionKey] = @(msg);\n    return [NSError errorWithDomain:errorDomain code:code userInfo:userInfo.copy];\n}\n} // anonymous namespace\n\nNSError *makeError(realm::Status const& status) {\n    if (status.is_ok()) {\n        return nil;\n    }\n    auto code = translateFileError(status.code());\n    return [NSError errorWithDomain:RLMErrorDomain\n                               code:code\n                           userInfo:@{NSLocalizedDescriptionKey: @(status.reason().c_str()),\n                                      RLMErrorCodeNameKey: errorString(status.code())}];\n}\n\nNSError *makeError(realm::Exception const& exception) {\n    NSInteger code = translateFileError(exception.code());\n    return [NSError errorWithDomain:RLMErrorDomain\n                               code:code\n                           userInfo:@{NSLocalizedDescriptionKey: @(exception.what()),\n                                      RLMErrorCodeNameKey: errorString(exception.code())}];\n\n}\n\nNSError *makeError(realm::FileAccessError const& exception) {\n    NSInteger code = translateFileError(exception.code());\n    return [NSError errorWithDomain:RLMErrorDomain\n                               code:code\n                           userInfo:@{NSLocalizedDescriptionKey: @(exception.what()),\n                                      NSFilePathErrorKey: @(exception.get_path().data()),\n                                      RLMErrorCodeNameKey: errorString(exception.code())}];\n}\n\nNSError *makeError(std::exception const& exception) {\n    return [NSError errorWithDomain:RLMErrorDomain\n                               code:RLMErrorFail\n                           userInfo:@{NSLocalizedDescriptionKey: @(exception.what())}];\n}\n\nNSError *makeError(std::system_error const& exception) {\n    return translateSystemError(exception.code(), exception.what());\n}\n"
  },
  {
    "path": "Realm/RLMError_Private.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2022 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMError.h>\n\n#import <realm/exceptions.hpp>\n#import <realm/status_with.hpp>\n\nRLM_HIDDEN_BEGIN\n\nNSError *makeError(realm::Status const& status);\n\ntemplate <typename T>\nNSError *makeError(realm::StatusWith<T> const& statusWith) {\n    return makeError(statusWith.get_status());\n}\n\nNSError *makeError(realm::Exception const& exception);\nNSError *makeError(realm::FileAccessError const& exception);\nNSError *makeError(std::exception const& exception);\nNSError *makeError(std::system_error const& exception);\n\nRLM_HIDDEN_END\n"
  },
  {
    "path": "Realm/RLMGeospatial.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2023 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability)\n/// Conforming protocol for a Geo-shape.\n@protocol RLMGeospatial\n@end\n\n/**\n A class that represents the coordinates of a point formed by a latitude and a longitude value.\n\n  * Latitude ranges between -90 and 90 degrees, inclusive.\n  * Longitude ranges between -180 and 180 degrees, inclusive.\n  * Altitude cannot have negative values.\n\n Values outside this ranges will return nil when trying to create a `RLMGeospatialPoint`.\n\n @note There is no dedicated type to store Geospatial points, instead points should be stored as\n [GeoJson-shaped](https://www.mongodb.com/docs/manual/reference/geojson/) \n embedded object, as explained below. Geospatial queries (`geoWithin`) can only be executed\n in such a type of objects and will throw otherwise.\n\n Persisting geo points in Realm is currently done using duck-typing, which means that any model class with a specific **shape**\n can be queried as though it contained a geographical location. The recommended approach is using an embedded object.\n\n @warning This structure cannot be persisted and can only be used to build other geospatial shapes\n such as (`RLMGeospatialBox`, `RLMGeospatialPolygon` and `RLMGeospatialCircle`).\n\n @warning Altitude is not used in any of the query calculations.\n */\nNS_SWIFT_SENDABLE\n@interface RLMGeospatialPoint : NSObject\n/// Latitude in degrees.\n@property (readonly) double latitude;\n/// Longitude in degrees.\n@property (readonly) double longitude;\n/// Altitude distance.\n@property (readonly) double altitude;\n\n/**\nInitialize a `RLMGeospatialPoint`, with the specific values for latitude and longitude.\n\nReturns `nil` if the values of latitude and longitude are not within the ranges specified.\n\n@param latitude Latitude in degrees. Ranges between -90 and 90 degrees, inclusive.\n@param longitude Longitude in degrees. Ranges between -180 and 180 degrees, inclusive.\n */\n- (nullable instancetype)initWithLatitude:(double)latitude longitude:(double)longitude;\n\n/**\nInitialize a `RLMGeospatialPoint`, with the specific values for latitude and longitude.\n\nReturns `nil` if the values of latitude and longitude are not within the ranges specified.\n\n@param latitude Latitude in degrees. Ranges between -90 and 90 degrees, inclusive.\n@param longitude Longitude in degrees. Ranges between -180 and 180 degrees, inclusive.\n@param altitude Altitude. Distance cannot have negative values\n\n @warning Altitude is not used in any of the query calculations.\n */\n- (nullable instancetype)initWithLatitude:(double)latitude longitude:(double)longitude altitude:(double)altitude;\n@end\n\n/**\n A class that represents a rectangle, that can be used in a geospatial `geoWithin`query.\n\n - warning: This class cannot be persisted and can only be use within a geospatial `geoWithin` query.\n */\nNS_SWIFT_SENDABLE\n@interface RLMGeospatialBox : NSObject <RLMGeospatial>\n/// The bottom left corner of the rectangle.\n@property (readonly, strong) RLMGeospatialPoint *bottomLeft;\n/// The top right corner of the rectangle.\n@property (readonly, strong) RLMGeospatialPoint *topRight;\n\n/**\n Initialize a `RLMGeospatialBox`, with values for bottom left corner and top right corner.\n\n@param bottomLeft The bottom left corner of the rectangle.\n@param topRight The top right corner of the rectangle.\n */\n- (instancetype)initWithBottomLeft:(RLMGeospatialPoint *)bottomLeft topRight:(RLMGeospatialPoint *)topRight;\n@end\n\n/**\n A class that represents a polygon, that can be used in a geospatial `geoWithin`query.\n\n A `RLMGeospatialPolygon` describes a shape conformed of and outer `Polygon`, called `outerRing`,\n and 0 or more inner `Polygon`s, called `holes`, which represents an unlimited number of internal holes\n inside the outer `Polygon`.\n A `Polygon` describes a shape conformed by at least three segments, where the last and the first `RLMGeospatialPoint`\n must be the same to indicate a closed polygon (meaning you need at least 4 points to define a polygon).\n Inner holes in a `RLMGeospatialPolygon` must  be entirely inside the outer ring\n\n A `hole` has the following restrictions:\n - Holes may not cross, i.e. the boundary of a hole \n may not intersect both the interior and the exterior of any other\n   hole.\n - Holes may not share edges, i.e. if a hole contains and edge AB, the no other hole may contain it.\n - Holes may share vertices, however no vertex may appear twice in a single hole.\n - No hole may be empty.\n - Only one nesting is allowed.\n\n @warning This class cannot be persisted and can only be use within a geospatial `geoWithin` query.\n */\nNS_SWIFT_SENDABLE\n@interface RLMGeospatialPolygon : NSObject <RLMGeospatial>\n/// The polygon's external (outer) ring.\n@property (readonly, strong) NSArray<RLMGeospatialPoint *> *outerRing;\n/// The holes (if any) in the polygon.\n@property (readonly, strong, nullable) NSArray<NSArray<RLMGeospatialPoint *> *> *holes;\n\n/**\nInitialize a `RLMGeospatialPolygon`, with its outer rings and holes (if any).\n\nReturns `nil` if the `RLMGeospatialPoints` representing a polygon (outer ring or holes), don't have at least 4 points.\nReturns `nil` if the first and the last `RLMGeospatialPoint` in a polygon are not the same.\n\n@param outerRing The polygon's external (outer) ring.\n */\n- (nullable instancetype)initWithOuterRing:(NSArray<RLMGeospatialPoint *> *)outerRing;\n\n/**\nInitialize a `RLMGeospatialPolygon`, with its outer rings and holes (if any).\n\nReturns `nil` if the `RLMGeospatialPoints` representing a polygon (outer ring or holes), don't have at least 4 points.\nReturns `nil` if the first and the last `RLMGeospatialPoint` in a polygon are not the same.\n\n@param outerRing The polygon's external (outer) ring.\n@param holes The holes (if any) in the polygon.\n */\n- (nullable instancetype)initWithOuterRing:(NSArray<RLMGeospatialPoint *> *)outerRing holes:(nullable NSArray<NSArray<RLMGeospatialPoint *> *> *)holes;\n@end\n\n/**\n This structure is a helper to represent/convert a distance. It can be used in geospatial\n queries like those represented by a `RLMGeospatialCircle`\n\n - warning: This structure cannot be persisted and can only be used to build other geospatial shapes\n */\nNS_SWIFT_SENDABLE\n@interface RLMDistance : NSObject\n/// The distance in radians.\n@property (readonly) double radians;\n\n/**\nConstructs a `Distance`.\n\nReturns `nil` if the value is lower than 0, because we cannot construct negative distances.\n@param kilometers Distance in kilometers.\n@returns A value that represents the provided distance in radians.\n */\n+ (nullable instancetype)distanceFromKilometers:(double)kilometers NS_SWIFT_NAME(kilometers(_:));\n\n/**\nConstructs a `Distance`.\n\nReturns `nil` if the value is lower than 0, because we cannot construct negative distances.\n\n@param miles Distance in miles.\n@return A value that represents the provided distance in radians.\n*/\n+ (nullable instancetype)distanceFromMiles:(double)miles NS_SWIFT_NAME(miles(_:));\n\n/**\nConstructs a `Distance`.\n\nReturns `nil` if the value is lower than 0, because we cannot construct negative distances.\n\n@param degrees Distance in degrees.\n@returns A value that represents the provided distance in radians.\n*/\n+ (nullable instancetype)distanceFromDegrees:(double)degrees NS_SWIFT_NAME(degrees(_:));\n\n/**\nConstructs a `Distance`.\n\nReturns `nil` if the value is lower than 0, because we cannot construct negative distances.\n\n@param radians Distance in radians.\n@returns A value that represents the provided distance in radians.\n*/\n+ (nullable instancetype)distanceFromRadians:(double)radians NS_SWIFT_NAME(radians(_:));\n\n/**\nReturns the current `Distance` value in kilometers.\n\n@returns The value un kilometers.\n*/\n- (double)asKilometers;\n\n/**\nReturns the current `Distance` value in miles.\n\n@returns The value un miles.\n*/\n- (double)asMiles;\n\n/**\nReturns the current `Distance` value in degrees.\n\n@returns The value un degrees.\n*/\n- (double)asDegrees;\n@end\n\n/**\nA class that represents a circle, that can be used in a geospatial `geoWithin`query.\n\n@warning This class cannot be persisted and can only be use within a geospatial `geoWithin` query.\n*/\nNS_SWIFT_SENDABLE\n@interface RLMGeospatialCircle : NSObject <RLMGeospatial>\n/// Center of the circle.\n@property (readonly, strong) RLMGeospatialPoint *center;\n/// Radius of the circle.\n@property (readonly) double radians;\n\n/**\nInitialize a `RLMGeospatialCircle`, from its center and radius.\n\n@param center Center of the circle.\n@param radians Radius of the circle.\n*/\n- (nullable instancetype)initWithCenter:(RLMGeospatialPoint *)center radiusInRadians:(double)radians;\n\n/**\nInitialize a `GeoCircle`, from its center and radius.\n\n@param center Center of the circle.\n@param radius Radius of the circle.\n*/\n- (instancetype)initWithCenter:(RLMGeospatialPoint *)center radius:(RLMDistance *)radius;\n@end\n\nRLM_HEADER_AUDIT_END(nullability)\n"
  },
  {
    "path": "Realm/RLMGeospatial.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2023 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMGeospatial_Private.hpp\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/geospatial.hpp>\n\n@implementation RLMGeospatialPoint\n- (nullable instancetype)initWithLatitude:(double)latitude longitude:(double)longitude {\n    return [self initWithLatitude:latitude longitude:longitude altitude:0];\n}\n\n- (nullable instancetype)initWithLatitude:(double)latitude longitude:(double)longitude altitude:(double)altitude {\n    if (self = [super init]) {\n        if ((isnan(latitude) || isnan(longitude) || isnan(altitude)) || (latitude < -90 || latitude > 90) || (longitude < -180 || longitude > 180) || (altitude < 0)) {\n            return nil;\n        }\n        _latitude = latitude;\n        _longitude = longitude;\n        _altitude = altitude;\n    }\n    return self;\n}\n\n- (realm::GeoPoint)value {\n    return realm::GeoPoint{_longitude, _latitude, _altitude};\n}\n\n- (BOOL)isEqual:(id)other {\n    if (auto point = RLMDynamicCast<RLMGeospatialPoint>(other)) {\n        return point.latitude == self.latitude && point.longitude == self.longitude && point.altitude == self.altitude;\n    }\n    return NO;\n}\n@end\n\n@interface RLMGeospatialBox () <RLMGeospatial_Private>\n@end\n\n@implementation RLMGeospatialBox\n- (instancetype)initWithBottomLeft:(RLMGeospatialPoint *)bottomLeft topRight:(RLMGeospatialPoint *)topRight {\n    if (self = [super init]) {\n        _bottomLeft = bottomLeft;\n        _topRight = topRight;\n    }\n    return self;\n}\n\n- (realm::Geospatial)geoSpatial {\n    realm::GeoBox geo_box{realm::GeoPoint{_bottomLeft.longitude, _bottomLeft.latitude}, realm::GeoPoint{_topRight.longitude, _topRight.latitude}};\n    return realm::Geospatial{geo_box};\n}\n\n- (BOOL)isEqual:(id)other {\n    if (auto box = RLMDynamicCast<RLMGeospatialBox>(other)) {\n        if ([box.bottomLeft isEqual:self.bottomLeft] && [box.topRight isEqual: self.topRight])\n            return YES;\n    }\n    return NO;\n}\n@end\n\n@interface RLMGeospatialPolygon () <RLMGeospatial_Private>\n@end\n\n@implementation RLMGeospatialPolygon\n- (nullable instancetype)initWithOuterRing:(NSArray<RLMGeospatialPoint *> *)outerRing holes:(nullable NSArray<NSArray<RLMGeospatialPoint *> *> *)holes {\n    if (self = [super init]) {\n        if (([outerRing count] <= 3) || (![[outerRing firstObject] isEqual:[outerRing lastObject]])) {\n            return nil;\n        }\n        if (holes) {\n            for(NSArray<RLMGeospatialPoint *> *hole in holes) {\n                if (([hole count] <= 3) || (![[hole firstObject] isEqual:[hole lastObject]])) {\n                    return nil;\n                }\n            }\n        }\n        _outerRing = outerRing;\n        _holes = holes;\n    }\n    return self;\n}\n\n- (nullable instancetype)initWithOuterRing:(NSArray<RLMGeospatialPoint *> *)outerRing {\n    return [self initWithOuterRing:outerRing holes:nil];\n}\n\n- (realm::Geospatial)geoSpatial {\n    std::vector<std::vector<realm::GeoPoint>> points;\n    std::vector<realm::GeoPoint> outer_ring;\n    for (RLMGeospatialPoint *point : _outerRing) {\n        outer_ring.push_back(point.value);\n    }\n    points.push_back(outer_ring);\n\n    if (_holes) {\n        for (NSArray<RLMGeospatialPoint *> *array_points : _holes) {\n            std::vector<realm::GeoPoint> hole;\n            for (RLMGeospatialPoint *point : array_points) {\n                hole.push_back(point.value);\n            }\n            points.push_back(hole);\n        }\n    }\n\n    realm::GeoPolygon geo_polygon{points};\n    return realm::Geospatial{geo_polygon};\n}\n\n- (BOOL)isEqual:(id)other {\n    if (auto polygon = RLMDynamicCast<RLMGeospatialPolygon>(other)) {\n        if ([polygon.outerRing isEqualToArray:self.outerRing] && [polygon.holes isEqualToArray:self.holes])\n            return YES;\n    }\n    return NO;\n}\n@end\n\n/// Earth radius.\nstatic double const c_earthRadiusMeters = 6378100.0;\n\n@implementation RLMDistance\n+ (nullable instancetype)distanceFromKilometers:(double)kilometers {\n    double radians = (kilometers * 1000) / c_earthRadiusMeters;\n    return [[RLMDistance alloc] initWithRadians:radians];\n}\n\n+ (nullable instancetype)distanceFromMiles:(double)miles {\n    double radians = (miles * 1609.344) / c_earthRadiusMeters;\n    return [[RLMDistance alloc] initWithRadians:radians];\n}\n\n+ (nullable instancetype)distanceFromDegrees:(double)degrees {\n    double radiansPerDegree = M_PI / 180;\n    return [[RLMDistance alloc] initWithRadians:(degrees * radiansPerDegree)];\n}\n\n+ (nullable instancetype)distanceFromRadians:(double)radians {\n    return [[RLMDistance alloc] initWithRadians:radians];\n}\n\n- (double)asKilometers {\n    return (self.radians * c_earthRadiusMeters) / 1000;\n}\n\n- (double)asMiles {\n    return (self.radians * c_earthRadiusMeters) / 1609.344;\n}\n\n- (double)asDegrees {\n    double radiansPerDegree = M_PI / 180;\n    return (self.radians / radiansPerDegree);\n}\n\n- (nullable instancetype)initWithRadians:(double)radians {\n    if (self = [super init]) {\n        if (isnan(radians) || radians < 0) {\n            return nil;\n        }\n        _radians = radians;\n    }\n    return self;\n}\n\n- (BOOL)isEqual:(id)other {\n    if (auto distance = RLMDynamicCast<RLMDistance>(other)) {\n        if (distance.radians == self.radians)\n            return YES;\n    }\n    return NO;\n}\n@end\n\n@interface RLMGeospatialCircle () <RLMGeospatial_Private>\n@end\n\n@implementation RLMGeospatialCircle\n- (nullable instancetype)initWithCenter:(RLMGeospatialPoint *)center radiusInRadians:(double)radians {\n    if (self = [super init]) {\n        if (isnan(radians) || radians < 0) {\n            return nil;\n        }\n\n        _center = center;\n        _radians = radians;\n    }\n    return self;\n}\n\n- (instancetype)initWithCenter:(RLMGeospatialPoint *)center radius:(RLMDistance *)radius {\n    return [self initWithCenter:center radiusInRadians:radius.radians];\n}\n\n- (realm::Geospatial)geoSpatial {\n    realm::GeoCircle geo_circle{_radians, _center.value};\n    return realm::Geospatial{geo_circle};\n}\n\n- (BOOL)isEqual:(id)other {\n    if (auto circle = RLMDynamicCast<RLMGeospatialCircle>(other)) {\n        if (circle.radians == self.radians && [circle.center isEqual:self.center])\n            return YES;\n    }\n    return NO;\n}\n@end\n"
  },
  {
    "path": "Realm/RLMGeospatial_Private.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2023 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMGeospatial.h>\n\nnamespace realm {\nclass Geospatial;\n}\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@protocol RLMGeospatial_Private <NSObject>\n- (realm::Geospatial)geoSpatial;\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMLogger.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2023 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability)\n\n/// An enum representing different levels of sync-related logging that can be configured.\ntypedef NS_CLOSED_ENUM(NSUInteger, RLMLogLevel) {\n    /// Nothing will ever be logged.\n    RLMLogLevelOff,\n    /// Only fatal errors will be logged.\n    RLMLogLevelFatal,\n    /// Only errors will be logged.\n    RLMLogLevelError,\n    /// Warnings and errors will be logged.\n    RLMLogLevelWarn,\n    /// Information about sync events will be logged. Fewer events will be logged in order to avoid overhead.\n    RLMLogLevelInfo,\n    /// Information about sync events will be logged. More events will be logged than with `RLMLogLevelInfo`.\n    RLMLogLevelDetail,\n    /// Log information that can aid in debugging.\n    ///\n    /// - warning: Will incur a measurable performance impact.\n    RLMLogLevelDebug,\n    /// Log information that can aid in debugging. More events will be logged than with `RLMLogLevelDebug`.\n    ///\n    /// - warning: Will incur a measurable performance impact.\n    RLMLogLevelTrace,\n    /// Log information that can aid in debugging. More events will be logged than with `RLMLogLevelTrace`.\n    ///\n    /// - warning: Will incur a measurable performance impact.\n    RLMLogLevelAll\n} NS_SWIFT_NAME(LogLevel);\n\n/// A log callback function which can be set on RLMLogger.\n///\n/// The log function may be called from multiple threads simultaneously, and is\n/// responsible for performing its own synchronization if any is required.\nNS_SWIFT_SENDABLE // invoked on a background thread\ntypedef void (^RLMLogFunction)(RLMLogLevel level, NSString *message);\n\n/**\n `RLMLogger` is used for creating your own custom logging logic.\n\n You can define your own logger creating an instance of `RLMLogger` and define the log function which will be\n invoked whenever there is a log message.\n Set this custom logger as you default logger using `setDefaultLogger`.\n\n     RLMLogger.defaultLogger = [[RLMLogger alloc] initWithLevel:RLMLogLevelDebug\n                                                logFunction:^(RLMLogLevel level, NSString * message) {\n         NSLog(@\"Realm Log - %lu, %@\", (unsigned long)level, message);\n     }];\n\n @note By default default log threshold level is `RLMLogLevelInfo`, and logging strings are output to Apple System Logger.\n*/\n@interface RLMLogger : NSObject\n\n/**\n  Gets the logging threshold level used by the logger.\n */\n@property (nonatomic) RLMLogLevel level;\n\n/// :nodoc:\n- (instancetype)init NS_UNAVAILABLE;\n\n/**\n Creates a logger with the associated log level and the logic function to define your own logging logic.\n\n @param level The log level to be set for the logger.\n @param logFunction The log function which will be invoked whenever there is a log message.\n*/\n- (instancetype)initWithLevel:(RLMLogLevel)level logFunction:(RLMLogFunction)logFunction;\n\n#pragma mark RLMLogger Default Logger API\n\n/**\n The current default logger. When setting a logger as default, this logger will be used whenever information must be logged.\n */\n@property (class) RLMLogger *defaultLogger NS_SWIFT_NAME(shared);\n\n@end\n\nRLM_HEADER_AUDIT_END(nullability)\n"
  },
  {
    "path": "Realm/RLMLogger.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2023 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMLogger_Private.h\"\n\n#import \"RLMUtil.hpp\"\n\n#import <realm/util/logger.hpp>\n\ntypedef void (^RLMLoggerFunction)(RLMLogLevel level, NSString *message);\n\nusing namespace realm;\nusing Logger = realm::util::Logger;\nusing Level = Logger::Level;\n\nnamespace {\nstatic Level levelForLogLevel(RLMLogLevel logLevel) {\n    switch (logLevel) {\n        case RLMLogLevelOff:    return Level::off;\n        case RLMLogLevelFatal:  return Level::fatal;\n        case RLMLogLevelError:  return Level::error;\n        case RLMLogLevelWarn:   return Level::warn;\n        case RLMLogLevelInfo:   return Level::info;\n        case RLMLogLevelDetail: return Level::detail;\n        case RLMLogLevelDebug:  return Level::debug;\n        case RLMLogLevelTrace:  return Level::trace;\n        case RLMLogLevelAll:    return Level::all;\n    }\n    REALM_UNREACHABLE();    // Unrecognized log level.\n}\n\nstatic RLMLogLevel logLevelForLevel(Level logLevel) {\n    switch (logLevel) {\n        case Level::off:    return RLMLogLevelOff;\n        case Level::fatal:  return RLMLogLevelFatal;\n        case Level::error:  return RLMLogLevelError;\n        case Level::warn:   return RLMLogLevelWarn;\n        case Level::info:   return RLMLogLevelInfo;\n        case Level::detail: return RLMLogLevelDetail;\n        case Level::debug:  return RLMLogLevelDebug;\n        case Level::trace:  return RLMLogLevelTrace;\n        case Level::all:    return RLMLogLevelAll;\n    }\n    REALM_UNREACHABLE();    // Unrecognized log level.\n}\n\nstatic NSString* levelPrefix(Level logLevel) {\n    switch (logLevel) {\n        case Level::off:\n        case Level::all:    return @\"\";\n        case Level::trace:  return @\"Trace\";\n        case Level::debug:  return @\"Debug\";\n        case Level::detail: return @\"Detail\";\n        case Level::info:   return @\"Info\";\n        case Level::error:  return @\"Error\";\n        case Level::warn:   return @\"Warning\";\n        case Level::fatal:  return @\"Fatal\";\n    }\n    REALM_UNREACHABLE();    // Unrecognized log level.\n}\n\nstruct CocoaLogger : public Logger {\n    void do_log(const realm::util::LogCategory&, Level level, const std::string& message) override {\n        NSLog(@\"%@: %@\", levelPrefix(level), RLMStringDataToNSString(message));\n    }\n};\n\nclass CustomLogger : public Logger {\npublic:\n    RLMLoggerFunction function;\n    void do_log(const realm::util::LogCategory&, Level level, const std::string& message) override {\n        @autoreleasepool {\n            if (function) {\n                function(logLevelForLevel(level), RLMStringDataToNSString(message));\n            }\n        }\n    }\n};\n} // anonymous namespace\n\n@implementation RLMLogger {\n    std::shared_ptr<Logger> _logger;\n}\n\ntypedef void(^LoggerBlock)(RLMLogLevel level, NSString *message);\n\n- (RLMLogLevel)level {\n    return logLevelForLevel(_logger->get_level_threshold());\n}\n\n- (void)setLevel:(RLMLogLevel)level {\n    _logger->set_level_threshold(levelForLogLevel(level));\n}\n\n+ (void)initialize {\n    auto defaultLogger = std::make_shared<CocoaLogger>();\n    defaultLogger->set_level_threshold(Level::info);\n    Logger::set_default_logger(defaultLogger);\n}\n\n- (instancetype)initWithLogger:(std::shared_ptr<Logger>)logger {\n    if (self = [self init]) {\n        self->_logger = logger;\n    }\n    return self;\n}\n\n- (instancetype)initWithLevel:(RLMLogLevel)level logFunction:(RLMLogFunction)logFunction {\n    if (self = [super init]) {\n        auto logger = std::make_shared<CustomLogger>();\n        logger->set_level_threshold(levelForLogLevel(level));\n        logger->function = logFunction;\n        self->_logger = logger;\n    }\n    return self;\n}\n\n- (void)logWithLevel:(RLMLogLevel)logLevel message:(NSString *)message, ... {\n    auto level = levelForLogLevel(logLevel);\n    if (_logger->would_log(level)) {\n        va_list args;\n        va_start(args, message);\n        _logger->log(level, \"%1\", [[NSString alloc] initWithFormat:message arguments:args].UTF8String);\n        va_end(args);\n    }\n}\n\n- (void)logLevel:(RLMLogLevel)logLevel message:(NSString *)message {\n    auto level = levelForLogLevel(logLevel);\n    if (_logger->would_log(level)) {\n        _logger->log(level, \"%1\", message.UTF8String);\n    }\n}\n\n#pragma mark Global Logger Setter\n\n+ (instancetype)defaultLogger {\n    return [[RLMLogger alloc] initWithLogger:Logger::get_default_logger()];\n}\n\n+ (void)setDefaultLogger:(RLMLogger *)logger {\n    Logger::set_default_logger(logger->_logger);\n}\n@end\n"
  },
  {
    "path": "Realm/RLMLogger_Private.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2023 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMLogger.h>\n#import <Realm/RLMConstants.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability)\n\n@interface RLMLogger()\n\n/**\n Log a message to the supplied level.\n\n @param logLevel The log level for the message.\n @param message The message to log.\n */\n- (void)logWithLevel:(RLMLogLevel)logLevel message:(NSString *)message, ... NS_SWIFT_UNAVAILABLE(\"\");\n- (void)logLevel:(RLMLogLevel)logLevel message:(NSString *)message;\n@end\n\nRLM_HEADER_AUDIT_END(nullability)\n"
  },
  {
    "path": "Realm/RLMManagedArray.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMArray_Private.hpp\"\n\n#import \"RLMAccessor.hpp\"\n#import \"RLMCollection_Private.hpp\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMObjectStore.h\"\n#import \"RLMObject_Private.hpp\"\n#import \"RLMObservation.hpp\"\n#import \"RLMProperty_Private.hpp\"\n#import \"RLMQueryUtil.hpp\"\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMRealmConfiguration_Private.hpp\"\n#import \"RLMSchema.h\"\n#import \"RLMSectionedResults_Private.hpp\"\n#import \"RLMThreadSafeReference_Private.hpp\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/mixed.hpp>\n#import <realm/object-store/list.hpp>\n#import <realm/object-store/results.hpp>\n#import <realm/object-store/shared_realm.hpp>\n#import <realm/table_view.hpp>\n\n#import <objc/runtime.h>\n\n@interface RLMManagedArrayHandoverMetadata : NSObject\n@property (nonatomic) NSString *parentClassName;\n@property (nonatomic) NSString *key;\n@end\n\n@implementation RLMManagedArrayHandoverMetadata\n@end\n\n@interface RLMManagedArray () <RLMThreadConfined_Private>\n@end\n\n//\n// RLMArray implementation\n//\n@implementation RLMManagedArray {\n@public\n    realm::List _backingList;\n    RLMRealm *_realm;\n    RLMClassInfo *_objectInfo;\n    RLMClassInfo *_ownerInfo;\n    std::unique_ptr<RLMObservationInfo> _observationInfo;\n}\n\n- (RLMManagedArray *)initWithBackingCollection:(realm::List)list\n                                    parentInfo:(RLMClassInfo *)parentInfo\n                                      property:(__unsafe_unretained RLMProperty *const)property {\n    if (property.type == RLMPropertyTypeObject)\n        self = [self initWithObjectClassName:property.objectClassName];\n    else\n        self = [self initWithObjectType:property.type\n                               optional:property.optional];\n    if (self) {\n        _realm = parentInfo->realm;\n        REALM_ASSERT(list.get_realm() == _realm->_realm);\n        _backingList = std::move(list);\n        _ownerInfo = parentInfo;\n        _property = property;\n        if (property.type == RLMPropertyTypeObject)\n            _objectInfo = &parentInfo->linkTargetType(property.index);\n        else\n            _objectInfo = _ownerInfo;\n    }\n    return self;\n}\n\n- (RLMManagedArray *)initWithParent:(realm::Obj)parent\n                           property:(__unsafe_unretained RLMProperty *const)property\n                         parentInfo:(RLMClassInfo&)info {\n    auto col = info.tableColumn(property);\n    return [self initWithBackingCollection:realm::List(info.realm->_realm, parent, col)\n                                parentInfo:&info\n                                  property:property];\n}\n\n- (RLMManagedArray *)initWithParent:(__unsafe_unretained RLMObjectBase *const)parentObject\n                           property:(__unsafe_unretained RLMProperty *const)property {\n    return [self initWithParent:parentObject->_row\n                       property:property\n                     parentInfo:*parentObject->_info];\n}\n\nvoid RLMValidateArrayObservationKey(__unsafe_unretained NSString *const keyPath,\n                                    __unsafe_unretained RLMArray *const array) {\n    if (![keyPath isEqualToString:RLMInvalidatedKey]) {\n        @throw RLMException(@\"[<%@ %p> addObserver:forKeyPath:options:context:] is not supported. Key path: %@\",\n                            [array class], array, keyPath);\n    }\n}\n\nvoid RLMEnsureArrayObservationInfo(std::unique_ptr<RLMObservationInfo>& info,\n                                   __unsafe_unretained NSString *const keyPath,\n                                   __unsafe_unretained RLMArray *const array,\n                                   __unsafe_unretained id const observed) {\n    RLMValidateArrayObservationKey(keyPath, array);\n    if (!info && array.class == [RLMManagedArray class]) {\n        auto lv = static_cast<RLMManagedArray *>(array);\n        info = std::make_unique<RLMObservationInfo>(*lv->_ownerInfo,\n                                                    lv->_backingList.get_parent_object_key(),\n                                                    observed);\n    }\n}\n\ntemplate<typename Function>\n__attribute__((always_inline))\nstatic auto translateErrors(Function&& f) {\n    return translateCollectionError(static_cast<Function&&>(f), @\"List\");\n}\n\ntemplate<typename IndexSetFactory>\nstatic void changeArray(__unsafe_unretained RLMManagedArray *const ar,\n                        NSKeyValueChange kind, dispatch_block_t f, IndexSetFactory&& is) {\n    translateErrors([&] { ar->_backingList.verify_in_transaction(); });\n\n    RLMObservationTracker tracker(ar->_realm);\n    tracker.trackDeletions();\n    auto obsInfo = RLMGetObservationInfo(ar->_observationInfo.get(),\n                                         ar->_backingList.get_parent_object_key(),\n                                         *ar->_ownerInfo);\n    if (obsInfo) {\n        tracker.willChange(obsInfo, ar->_property.name, kind, is());\n    }\n\n    translateErrors(f);\n}\n\nstatic void changeArray(__unsafe_unretained RLMManagedArray *const ar, NSKeyValueChange kind, NSUInteger index, dispatch_block_t f) {\n    changeArray(ar, kind, f, [=] { return [NSIndexSet indexSetWithIndex:index]; });\n}\n\nstatic void changeArray(__unsafe_unretained RLMManagedArray *const ar, NSKeyValueChange kind, NSRange range, dispatch_block_t f) {\n    changeArray(ar, kind, f, [=] { return [NSIndexSet indexSetWithIndexesInRange:range]; });\n}\n\nstatic void changeArray(__unsafe_unretained RLMManagedArray *const ar, NSKeyValueChange kind, NSIndexSet *is, dispatch_block_t f) {\n    changeArray(ar, kind, f, [=] { return is; });\n}\n\n//\n// public method implementations\n//\n- (RLMRealm *)realm {\n    return _realm;\n}\n\n- (NSUInteger)count {\n    return translateErrors([&] { return _backingList.size(); });\n}\n\n- (BOOL)isInvalidated {\n    return translateErrors([&] { return !_backingList.is_valid(); });\n}\n\n- (RLMClassInfo *)objectInfo {\n    return _objectInfo;\n}\n\n\n- (bool)isBackedByList:(realm::List const&)list {\n    return _backingList == list;\n}\n\n- (BOOL)isEqual:(id)object {\n    return [object respondsToSelector:@selector(isBackedByList:)] && [object isBackedByList:_backingList];\n}\n\n- (NSUInteger)hash {\n    return std::hash<realm::List>()(_backingList);\n}\n\n- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state\n                                  objects:(__unused __unsafe_unretained id [])buffer\n                                    count:(NSUInteger)len {\n    return RLMFastEnumerate(state, len, self);\n}\n\n- (id)objectAtIndex:(NSUInteger)index {\n    return translateErrors([&]() -> id {\n        RLMAccessorContext context(*_ownerInfo, *_objectInfo, _property);\n        return _backingList.get(context, index);\n    });\n}\n\nstatic void RLMInsertObject(RLMManagedArray *ar, id object, NSUInteger index) {\n    RLMArrayValidateMatchingObjectType(ar, object);\n    if (index == NSUIntegerMax) {\n        index = translateErrors([&] { return ar->_backingList.size(); });\n    }\n\n    changeArray(ar, NSKeyValueChangeInsertion, index, ^{\n        RLMAccessorContext context(*ar->_ownerInfo, *ar->_objectInfo, ar->_property);\n        ar->_backingList.insert(context, index, object);\n    });\n}\n\n- (void)addObject:(id)object {\n    RLMInsertObject(self, object, NSUIntegerMax);\n}\n\n- (void)insertObject:(id)object atIndex:(NSUInteger)index {\n    RLMInsertObject(self, object, index);\n}\n\n- (void)insertObjects:(id<NSFastEnumeration>)objects atIndexes:(NSIndexSet *)indexes {\n    changeArray(self, NSKeyValueChangeInsertion, indexes, ^{\n        NSUInteger index = [indexes firstIndex];\n        RLMAccessorContext context(*_ownerInfo, *_objectInfo, _property);\n        for (id obj in objects) {\n            RLMArrayValidateMatchingObjectType(self, obj);\n            _backingList.insert(context, index, obj);\n            index = [indexes indexGreaterThanIndex:index];\n        }\n    });\n}\n\n- (void)removeObjectAtIndex:(NSUInteger)index {\n    changeArray(self, NSKeyValueChangeRemoval, index, ^{\n        _backingList.remove(index);\n    });\n}\n\n- (void)removeObjectsAtIndexes:(NSIndexSet *)indexes {\n    changeArray(self, NSKeyValueChangeRemoval, indexes, ^{\n        [indexes enumerateIndexesWithOptions:NSEnumerationReverse usingBlock:^(NSUInteger idx, BOOL *) {\n            _backingList.remove(idx);\n        }];\n    });\n}\n\n- (void)addObjectsFromArray:(NSArray *)array {\n    changeArray(self, NSKeyValueChangeInsertion, NSMakeRange(self.count, array.count), ^{\n        RLMAccessorContext context(*_ownerInfo, *_objectInfo, _property);\n        for (id obj in array) {\n            RLMArrayValidateMatchingObjectType(self, obj);\n            _backingList.add(context, obj);\n        }\n    });\n}\n\n- (void)removeAllObjects {\n    changeArray(self, NSKeyValueChangeRemoval, NSMakeRange(0, self.count), ^{\n        _backingList.remove_all();\n    });\n}\n\n- (void)replaceAllObjectsWithObjects:(NSArray *)objects {\n    if (auto count = self.count) {\n        changeArray(self, NSKeyValueChangeRemoval, NSMakeRange(0, count), ^{\n            _backingList.remove_all();\n        });\n    }\n    if (![objects respondsToSelector:@selector(count)] || !objects.count) {\n        return;\n    }\n    changeArray(self, NSKeyValueChangeInsertion, NSMakeRange(0, objects.count), ^{\n        RLMAccessorContext context(*_ownerInfo, *_objectInfo, _property);\n        _backingList.assign(context, objects);\n    });\n}\n\n- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)object {\n    RLMArrayValidateMatchingObjectType(self, object);\n    changeArray(self, NSKeyValueChangeReplacement, index, ^{\n        RLMAccessorContext context(*_ownerInfo, *_objectInfo, _property);\n        if (index >= _backingList.size()) {\n            @throw RLMException(@\"Index %llu is out of bounds (must be less than %llu).\",\n                                (unsigned long long)index, (unsigned long long)_backingList.size());\n        }\n        _backingList.set(context, index, object);\n    });\n}\n\n- (void)moveObjectAtIndex:(NSUInteger)sourceIndex toIndex:(NSUInteger)destinationIndex {\n    auto start = std::min(sourceIndex, destinationIndex);\n    auto len = std::max(sourceIndex, destinationIndex) - start + 1;\n    changeArray(self, NSKeyValueChangeReplacement, {start, len}, ^{\n        _backingList.move(sourceIndex, destinationIndex);\n    });\n}\n\n- (void)exchangeObjectAtIndex:(NSUInteger)index1 withObjectAtIndex:(NSUInteger)index2 {\n    changeArray(self, NSKeyValueChangeReplacement, ^{\n        _backingList.swap(index1, index2);\n    }, [=] {\n        NSMutableIndexSet *set = [[NSMutableIndexSet alloc] initWithIndex:index1];\n        [set addIndex:index2];\n        return set;\n    });\n}\n\n- (NSUInteger)indexOfObject:(id)object {\n    RLMArrayValidateMatchingObjectType(self, object);\n    return translateErrors([&] {\n        RLMAccessorContext context(*_ownerInfo, *_objectInfo, _property);\n        return RLMConvertNotFound(_backingList.find(context, object));\n    });\n}\n\n- (id)valueForKeyPath:(NSString *)keyPath {\n    if ([keyPath hasPrefix:@\"@\"]) {\n        // Delegate KVC collection operators to RLMResults\n        return translateErrors([&] {\n            auto results = [RLMResults resultsWithObjectInfo:*_objectInfo results:_backingList.as_results()];\n            return [results valueForKeyPath:keyPath];\n        });\n    }\n    return [super valueForKeyPath:keyPath];\n}\n\n- (id)valueForKey:(NSString *)key {\n    // Ideally we'd use \"@invalidated\" for this so that \"invalidated\" would use\n    // normal array KVC semantics, but observing @things works very oddly (when\n    // it's part of a key path, it's triggered automatically when array index\n    // changes occur, and can't be sent explicitly, but works normally when it's\n    // the entire key path), and an RLMManagedArray *can't* have objects where\n    // invalidated is true, so we're not losing much.\n    return translateErrors([&]() -> id {\n        if ([key isEqualToString:RLMInvalidatedKey]) {\n            return @(!_backingList.is_valid());\n        }\n\n        _backingList.verify_attached();\n        return RLMCollectionValueForKey(_backingList, key, *_objectInfo);\n    });\n}\n\n- (void)setValue:(id)value forKey:(NSString *)key {\n    if ([key isEqualToString:@\"self\"]) {\n        RLMArrayValidateMatchingObjectType(self, value);\n        RLMAccessorContext context(*_ownerInfo, *_objectInfo, _property);\n        translateErrors([&] {\n            for (size_t i = 0, count = _backingList.size(); i < count; ++i) {\n                _backingList.set(context, i, value);\n            }\n        });\n        return;\n    }\n    else if (_property->_type == RLMPropertyTypeObject) {\n        RLMArrayValidateMatchingObjectType(self, value);\n        translateErrors([&] { _backingList.verify_in_transaction(); });\n        RLMCollectionSetValueForKey(self, key, value);\n    }\n    else {\n        [self setValue:value forUndefinedKey:key];\n    }\n}\n\n- (id)minOfProperty:(NSString *)property {\n    auto column = columnForProperty(property, _backingList, _objectInfo, _property->_type, RLMCollectionTypeArray);\n    auto value = translateErrors([&] { return _backingList.min(column); });\n    return value ? RLMMixedToObjc(*value) : nil;\n}\n\n- (id)maxOfProperty:(NSString *)property {\n    auto column = columnForProperty(property, _backingList, _objectInfo, _property->_type, RLMCollectionTypeArray);\n    auto value = translateErrors([&] { return _backingList.max(column); });\n    return value ? RLMMixedToObjc(*value) : nil;\n}\n\n- (id)sumOfProperty:(NSString *)property {\n    auto column = columnForProperty(property, _backingList, _objectInfo, _property->_type, RLMCollectionTypeArray);\n    return RLMMixedToObjc(translateErrors([&] { return _backingList.sum(column); }));\n}\n\n- (id)averageOfProperty:(NSString *)property {\n    auto column = columnForProperty(property, _backingList, _objectInfo, _property->_type, RLMCollectionTypeArray);\n    auto value = translateErrors([&] { return _backingList.average(column); });\n    return value ? RLMMixedToObjc(*value) : nil;\n}\n\n- (void)deleteObjectsFromRealm {\n    auto type = _property->_type;\n    if (type != RLMPropertyTypeObject) {\n        @throw RLMException(@\"Cannot delete objects from RLMArray<%@>: only RLMObjects can be deleted.\", RLMTypeToString(type));\n    }\n    // delete all target rows from the realm\n    RLMObservationTracker tracker(_realm, true);\n    translateErrors([&] { _backingList.delete_all(); });\n}\n\n- (RLMResults *)sortedResultsUsingDescriptors:(NSArray<RLMSortDescriptor *> *)properties {\n    return translateErrors([&] {\n        return [RLMResults resultsWithObjectInfo:*_objectInfo\n                                         results:_backingList.sort(RLMSortDescriptorsToKeypathArray(properties))];\n    });\n}\n\n- (RLMResults *)distinctResultsUsingKeyPaths:(NSArray<NSString *> *)keyPaths {\n    return translateErrors([&] {\n        auto results = [RLMResults resultsWithObjectInfo:*_objectInfo results:_backingList.as_results()];\n        return [results distinctResultsUsingKeyPaths:keyPaths];\n    });\n}\n\n- (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate {\n    if (_property->_type != RLMPropertyTypeObject) {\n        @throw RLMException(@\"Querying is currently only implemented for arrays of Realm Objects\");\n    }\n    auto query = RLMPredicateToQuery(predicate, _objectInfo->rlmObjectSchema, _realm.schema, _realm.group);\n    auto results = translateErrors([&] { return _backingList.filter(std::move(query)); });\n    return [RLMResults resultsWithObjectInfo:*_objectInfo results:std::move(results)];\n}\n\n- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicate {\n    if (_property->_type != RLMPropertyTypeObject) {\n        @throw RLMException(@\"Querying is currently only implemented for arrays of Realm Objects\");\n    }\n    realm::Query query = RLMPredicateToQuery(predicate, _objectInfo->rlmObjectSchema,\n                                             _realm.schema, _realm.group);\n\n    return translateErrors([&] {\n        return RLMConvertNotFound(_backingList.find(std::move(query)));\n    });\n}\n\n- (NSArray *)objectsAtIndexes:(NSIndexSet *)indexes {\n    size_t c = self.count;\n    NSMutableArray *result = [[NSMutableArray alloc] initWithCapacity:indexes.count];\n    NSUInteger i = [indexes firstIndex];\n    RLMAccessorContext context(*_ownerInfo, *_objectInfo, _property);\n    while (i != NSNotFound) {\n        // Given KVO relies on `objectsAtIndexes` we need to make sure\n        // that no out of bounds exceptions are generated. This disallows us to mirror\n        // the exception logic in Foundation, but it is better than nothing.\n        if (i >= 0 && i < c) {\n            [result addObject:_backingList.get(context, i)];\n        } else {\n            // silently abort.\n            return nil;\n        }\n        i = [indexes indexGreaterThanIndex:i];\n    }\n    return result;\n}\n\n- (RLMSectionedResults *)sectionedResultsSortedUsingKeyPath:(NSString *)keyPath\n                                                  ascending:(BOOL)ascending\n                                                   keyBlock:(RLMSectionedResultsKeyBlock)keyBlock {\n    return [[RLMSectionedResults alloc] initWithResults:[self sortedResultsUsingKeyPath:keyPath ascending:ascending]\n                                               keyBlock:keyBlock];\n}\n\n- (RLMSectionedResults *)sectionedResultsUsingSortDescriptors:(NSArray<RLMSortDescriptor *> *)sortDescriptors\n                                                     keyBlock:(RLMSectionedResultsKeyBlock)keyBlock {\n    return [[RLMSectionedResults alloc] initWithResults:[self sortedResultsUsingDescriptors:sortDescriptors]\n                                               keyBlock:keyBlock];\n}\n\n- (void)addObserver:(id)observer\n         forKeyPath:(NSString *)keyPath\n            options:(NSKeyValueObservingOptions)options\n            context:(void *)context {\n    RLMEnsureArrayObservationInfo(_observationInfo, keyPath, self, self);\n    [super addObserver:observer forKeyPath:keyPath options:options context:context];\n}\n\n- (realm::TableView)tableView {\n    return translateErrors([&] { return _backingList.get_query(); }).find_all();\n}\n\n- (RLMFastEnumerator *)fastEnumerator {\n    return translateErrors([&] {\n        return [[RLMFastEnumerator alloc] initWithBackingCollection:_backingList\n                                                         collection:self\n                                                          classInfo:_objectInfo\n                                                         parentInfo:_ownerInfo\n                                                           property:_property];\n    });\n}\n\n- (BOOL)isFrozen {\n    return _realm.isFrozen;\n}\n\n- (instancetype)resolveInRealm:(RLMRealm *)realm {\n    auto& parentInfo = _ownerInfo->resolve(realm);\n    return translateErrors([&] {\n        return [[self.class alloc] initWithBackingCollection:_backingList.freeze(realm->_realm)\n                                                  parentInfo:&parentInfo\n                                                    property:parentInfo.rlmObjectSchema[_property.name]];\n    });\n}\n\n- (instancetype)freeze {\n    if (self.frozen) {\n        return self;\n    }\n    return [self resolveInRealm:_realm.freeze];\n}\n\n- (instancetype)thaw {\n    if (!self.frozen) {\n        return self;\n    }\n    return [self resolveInRealm:_realm.thaw];\n}\n\n- (realm::NotificationToken)addNotificationCallback:(id)block\nkeyPaths:(std::optional<std::vector<std::vector<std::pair<realm::TableKey, realm::ColKey>>>>&&)keyPaths {\n    return _backingList.add_notification_callback(RLMWrapCollectionChangeCallback(block, self, false), std::move(keyPaths));\n}\n\n#pragma mark - Thread Confined Protocol Conformance\n\n- (realm::ThreadSafeReference)makeThreadSafeReference {\n    return _backingList;\n}\n\n- (RLMManagedArrayHandoverMetadata *)objectiveCMetadata {\n    RLMManagedArrayHandoverMetadata *metadata = [[RLMManagedArrayHandoverMetadata alloc] init];\n    metadata.parentClassName = _ownerInfo->rlmObjectSchema.className;\n    metadata.key = _property.name;\n    return metadata;\n}\n\n+ (instancetype)objectWithThreadSafeReference:(realm::ThreadSafeReference)reference\n                                     metadata:(RLMManagedArrayHandoverMetadata *)metadata\n                                        realm:(RLMRealm *)realm {\n    auto list = reference.resolve<realm::List>(realm->_realm);\n    if (!list.is_valid()) {\n        return nil;\n    }\n    RLMClassInfo *parentInfo = &realm->_info[metadata.parentClassName];\n    return [[RLMManagedArray alloc] initWithBackingCollection:std::move(list)\n                                                   parentInfo:parentInfo\n                                                     property:parentInfo->rlmObjectSchema[metadata.key]];\n}\n\n@end\n"
  },
  {
    "path": "Realm/RLMManagedDictionary.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMDictionary_Private.hpp\"\n\n#import \"RLMAccessor.hpp\"\n#import \"RLMCollection_Private.hpp\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMObjectStore.h\"\n#import \"RLMObject_Private.hpp\"\n#import \"RLMObservation.hpp\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMQueryUtil.hpp\"\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMRealmConfiguration_Private.hpp\"\n#import \"RLMSchema.h\"\n#import \"RLMThreadSafeReference_Private.hpp\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/mixed.hpp>\n#import <realm/object-store/results.hpp>\n#import <realm/object-store/shared_realm.hpp>\n#import <realm/table_view.hpp>\n\n@interface RLMManagedDictionary () <RLMThreadConfined_Private> {\n    @public\n    realm::object_store::Dictionary _backingCollection;\n}\n@end\n\n@implementation RLMDictionaryChange {\n    realm::DictionaryChangeSet _changes;\n}\n\n- (instancetype)initWithChanges:(realm::DictionaryChangeSet const&)changes {\n    self = [super init];\n    if (self) {\n        _changes = changes;\n    }\n    return self;\n}\n\nstatic NSArray *toArray(std::vector<realm::Mixed> const& v) {\n    NSMutableArray *ret = [[NSMutableArray alloc] initWithCapacity:v.size()];\n    for (auto& mixed : v) {\n        [ret addObject:RLMMixedToObjc(mixed)];\n    }\n    return ret;\n}\n\n- (NSArray *)insertions {\n    return toArray(_changes.insertions);\n}\n\n- (NSArray *)deletions {\n    return toArray(_changes.deletions);\n}\n\n- (NSArray *)modifications {\n    return toArray(_changes.modifications);\n}\n\n- (NSString *)description {\n    return [NSString stringWithFormat:@\"<RLMDictionaryChange: %p> insertions: %@, deletions: %@, modifications: %@\",\n            (__bridge void *)self, self.insertions, self.deletions, self.modifications];\n}\n\n@end\n\n@interface RLMManagedCollectionHandoverMetadata : NSObject\n@property (nonatomic) NSString *parentClassName;\n@property (nonatomic) NSString *key;\n@end\n\n@implementation RLMManagedCollectionHandoverMetadata\n@end\n\n@implementation RLMManagedDictionary {\n@public\n    RLMRealm *_realm;\n    RLMClassInfo *_objectInfo;\n    RLMClassInfo *_ownerInfo;\n    RLMProperty *_property;\n    std::unique_ptr<RLMObservationInfo> _observationInfo;\n}\n\n- (RLMManagedDictionary *)initWithBackingCollection:(realm::object_store::Dictionary)dictionary\n                                         parentInfo:(RLMClassInfo *)parentInfo\n                                           property:(__unsafe_unretained RLMProperty *const)property {\n    if (property.type == RLMPropertyTypeObject)\n        self = [self initWithObjectClassName:property.objectClassName keyType:property.dictionaryKeyType];\n    else if (property.type == RLMPropertyTypeAny)\n        // Because the property is type mixed and we don't know if it will contain a dictionary when the schema\n        // is created, we set RLMPropertyTypeString by default.\n        // If another type is used for the dictionary key in a mixed dictionary context, this will thrown by core.\n        self = [self initWithObjectType:property.type optional:property.optional keyType:RLMPropertyTypeString];\n    else\n        self = [self initWithObjectType:property.type optional:property.optional keyType:property.dictionaryKeyType];\n    if (self) {\n        _realm = parentInfo->realm;\n        REALM_ASSERT(dictionary.get_realm() == _realm->_realm);\n        _backingCollection = std::move(dictionary);\n        _ownerInfo = parentInfo;\n        if (property.type == RLMPropertyTypeObject)\n            _objectInfo = &parentInfo->linkTargetType(property.index);\n        else\n            _objectInfo = _ownerInfo;\n        _property = property;\n    }\n    return self;\n}\n\n- (RLMManagedDictionary *)initWithParent:(realm::Obj)parent\n                                property:(__unsafe_unretained RLMProperty *const)property\n                              parentInfo:(RLMClassInfo&)info {\n    auto col = info.tableColumn(property);\n    return [self initWithBackingCollection:realm::object_store::Dictionary(info.realm->_realm, parent, col)\n                                parentInfo:&info\n                                  property:property];\n}\n\n- (RLMManagedDictionary *)initWithParent:(__unsafe_unretained RLMObjectBase *const)parentObject\n                                property:(__unsafe_unretained RLMProperty *const)property {\n    return [self initWithParent:parentObject->_row\n                       property:property\n                     parentInfo:*parentObject->_info];\n}\n\nvoid RLMDictionaryValidateObservationKey(__unsafe_unretained NSString *const keyPath,\n                                         __unsafe_unretained RLMDictionary *const dictionary) {\n    if (![keyPath isEqualToString:RLMInvalidatedKey]) {\n        @throw RLMException(@\"[<%@ %p> addObserver:forKeyPath:options:context:] is not supported. Key path: %@\",\n                            [dictionary class], dictionary, keyPath);\n    }\n}\n\nvoid RLMEnsureDictionaryObservationInfo(std::unique_ptr<RLMObservationInfo>& info,\n                                        __unsafe_unretained NSString *const keyPath,\n                                        __unsafe_unretained RLMDictionary *const dictionary,\n                                        __unsafe_unretained id const observed) {\n    RLMDictionaryValidateObservationKey(keyPath, dictionary);\n    if (!info && dictionary.class == [RLMManagedDictionary class]) {\n        auto lv = static_cast<RLMManagedDictionary *>(dictionary);\n        info = std::make_unique<RLMObservationInfo>(*lv->_ownerInfo,\n                                                    lv->_backingCollection.get_parent_object_key(),\n                                                    observed);\n    }\n}\n\n//\n// validation helpers\n//\ntemplate<typename Function>\n__attribute__((always_inline))\nstatic auto translateErrors(Function&& f) {\n    return translateCollectionError(static_cast<Function&&>(f), @\"Dictionary\");\n}\n\nstatic void changeDictionary(__unsafe_unretained RLMManagedDictionary *const dict,\n                             dispatch_block_t f) {\n    translateErrors([&] { dict->_backingCollection.verify_in_transaction(); });\n\n    RLMObservationTracker tracker(dict->_realm);\n    tracker.trackDeletions();\n    auto obsInfo = RLMGetObservationInfo(dict->_observationInfo.get(),\n                                         dict->_backingCollection.get_parent_object_key(),\n                                         *dict->_ownerInfo);\n    if (obsInfo) {\n        tracker.willChange(obsInfo, dict->_property.name);\n    }\n\n    translateErrors(f);\n}\n\n//\n// public method implementations\n//\n- (RLMRealm *)realm {\n    return _realm;\n}\n\n- (NSUInteger)count {\n    return translateErrors([&] {\n        return _backingCollection.size();\n    });\n}\n\nstatic NSMutableArray *resultsToArray(RLMClassInfo& info, realm::Results r) {\n    RLMAccessorContext c(info);\n    NSMutableArray *array = [NSMutableArray arrayWithCapacity:r.size()];\n    for (size_t i = 0, size = r.size(); i < size; ++i) {\n        [array addObject:r.get(c, i)];\n    }\n    return array;\n}\n\n- (NSArray *)allKeys {\n    return translateErrors([&] {\n        return resultsToArray(*_objectInfo, _backingCollection.get_keys());\n    });\n}\n\n- (NSArray *)allValues {\n    return translateErrors([&] {\n        return resultsToArray(*_objectInfo, _backingCollection.get_values());\n    });\n}\n\n- (BOOL)isInvalidated {\n    return translateErrors([&] { return !_backingCollection.is_valid(); });\n}\n\n- (RLMClassInfo *)objectInfo {\n    return _objectInfo;\n}\n\n- (bool)isBackedByDictionary:(realm::object_store::Dictionary const&)dictionary {\n    return _backingCollection == dictionary;\n}\n\n- (BOOL)isEqual:(id)object {\n    return [object respondsToSelector:@selector(isBackedByDictionary:)] &&\n           [object isBackedByDictionary:_backingCollection];\n}\n\n- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state\n                                  objects:(__unused __unsafe_unretained id [])buffer\n                                    count:(NSUInteger)len {\n    return RLMFastEnumerate(state, len, self);\n}\n\n#pragma mark - Object Retrieval\n\n- (nullable id)objectForKey:(id)key {\n    return translateErrors([&]() -> id {\n        [self.realm verifyThread];\n        RLMAccessorContext context(*_ownerInfo, *_objectInfo, _property);\n        if (auto value = _backingCollection.try_get_any(context.unbox<realm::StringData>(key))) {\n            if (value->is_type(realm::type_Dictionary)) {\n                return context.box(_backingCollection.get_dictionary(realm::PathElement{context.unbox<realm::StringData>(key)}));\n            }\n            else if (value->is_type(realm::type_List)) {\n                return context.box(_backingCollection.get_list(realm::PathElement{context.unbox<realm::StringData>(key)}));\n            }\n            else {\n                return context.box(*value);\n            }\n        }\n\n        return nil;\n    });\n}\n\n- (void)setObject:(id)obj forKey:(id)key {\n    changeDictionary(self, ^{\n        RLMAccessorContext context(*_ownerInfo, *_objectInfo, _property);\n        _backingCollection.insert(context, context.unbox<realm::StringData>(RLMDictionaryKey(self, key)),\n                                  RLMDictionaryValue(self, obj));\n    });\n}\n\n- (void)removeAllObjects {\n    changeDictionary(self, ^{\n        _backingCollection.remove_all();\n    });\n}\n\n- (void)removeObjectsForKeys:(NSArray *)keyArray {\n    RLMAccessorContext context(*_ownerInfo, *_objectInfo, _property);\n    changeDictionary(self, [&] {\n        for (id key in keyArray) {\n            _backingCollection.try_erase(context.unbox<realm::StringData>(key));\n        }\n    });\n}\n\n- (void)removeObjectForKey:(id)key {\n    changeDictionary(self, ^{\n        RLMAccessorContext context(*_ownerInfo, *_objectInfo, _property);\n        _backingCollection.try_erase(context.unbox<realm::StringData>(key));\n    });\n}\n\n- (void)enumerateKeysAndObjectsUsingBlock:(void (^)(id key, id obj, BOOL *stop))block {\n    RLMAccessorContext context(*_ownerInfo, *_objectInfo, _property);\n    BOOL stop = false;\n    @autoreleasepool {\n        for (auto&& [key, value] : _backingCollection) {\n            block(context.box(key), _backingCollection.get(context, key.get_string()), &stop);\n            if (stop) {\n                break;\n            }\n        }\n    }\n}\n\n- (void)mergeDictionary:(id)dictionary clear:(bool)clear {\n    if (!clear && !dictionary) {\n        return;\n    }\n    if (dictionary && ![dictionary respondsToSelector:@selector(enumerateKeysAndObjectsUsingBlock:)]) {\n        @throw RLMException(@\"Cannot %@ object of class '%@'\",\n                            clear ? @\"set dictionary to\" : @\"add entries from\",\n                            [dictionary className]);\n    }\n\n    changeDictionary(self, ^{\n        RLMAccessorContext context(*_ownerInfo, *_objectInfo, _property);\n        if (clear) {\n            _backingCollection.remove_all();\n        }\n        [dictionary enumerateKeysAndObjectsUsingBlock:[&](id key, id value, BOOL *) {\n            _backingCollection.insert(context, context.unbox<realm::StringData>(RLMDictionaryKey(self, key)),\n                                      RLMDictionaryValue(self, value));\n        }];\n    });\n}\n\n- (void)setDictionary:(id)dictionary {\n    [self mergeDictionary:RLMCoerceToNil(dictionary) clear:true];\n}\n\n- (void)addEntriesFromDictionary:(id)otherDictionary {\n    [self mergeDictionary:otherDictionary clear:false];\n}\n\n#pragma mark - KVC\n\n- (id)valueForKeyPath:(NSString *)keyPath {\n    if ([keyPath hasPrefix:@\"@\"]) {\n        // Delegate KVC collection operators to RLMResults\n        return translateErrors([&] {\n            auto results = [RLMResults resultsWithObjectInfo:*_objectInfo\n                                                     results:_backingCollection.as_results()];\n            return [results valueForKeyPath:keyPath];\n        });\n    }\n    return [super valueForKeyPath:keyPath];\n}\n\n- (id)valueForKey:(NSString *)key {\n    if ([key isEqualToString:RLMInvalidatedKey]) {\n        return @(!_backingCollection.is_valid());\n    }\n    return [self objectForKey:key];\n}\n\n- (void)setValue:(id)value forKey:(nonnull NSString *)key {\n    [self setObject:value forKeyedSubscript:key];\n}\n\n- (id)minOfProperty:(NSString *)property {\n    auto column = columnForProperty(property, _backingCollection, _objectInfo, _property->_type, RLMCollectionTypeDictionary);\n    auto value = translateErrors([&] {\n        return _backingCollection.as_results().min(column);\n    });\n    return value ? RLMMixedToObjc(*value) : nil;\n}\n\n- (id)maxOfProperty:(NSString *)property {\n    auto column = columnForProperty(property, _backingCollection, _objectInfo, _property->_type, RLMCollectionTypeDictionary);\n    auto value = translateErrors([&] {\n        return _backingCollection.as_results().max(column);\n    });\n    return value ? RLMMixedToObjc(*value) : nil;\n}\n\n- (id)sumOfProperty:(NSString *)property {\n    auto column = columnForProperty(property, _backingCollection, _objectInfo, _property->_type, RLMCollectionTypeDictionary);\n    auto value = translateErrors([&] {\n        return _backingCollection.as_results().sum(column);\n    });\n    return value ? RLMMixedToObjc(*value) : @0;\n}\n\n- (id)averageOfProperty:(NSString *)property {\n    auto column = columnForProperty(property, _backingCollection, _objectInfo, _property->_type, RLMCollectionTypeDictionary);\n    auto value = translateErrors([&] {\n        return _backingCollection.as_results().average(column);\n    });\n    return value ? RLMMixedToObjc(*value) : nil;\n}\n\n- (void)deleteObjectsFromRealm {\n    auto type = _property->_type;\n    if (type != RLMPropertyTypeObject) {\n        @throw RLMException(@\"Cannot delete objects from \u0010RLMManagedDictionary<RLMString, %@%@>: only RLMObjects can be deleted.\", RLMTypeToString(type), _optional? @\"?\": @\"\");\n    }\n    // delete all target rows from the realm\n    RLMObservationTracker tracker(_realm, true);\n    translateErrors([&] {\n        for (auto&& [key, value] : _backingCollection) {\n            _realm.group.get_object(value.get_link()).remove();\n        }\n        _backingCollection.remove_all();\n    });\n}\n\n- (RLMResults *)sortedResultsUsingDescriptors:(NSArray<RLMSortDescriptor *> *)properties {\n    return translateErrors([&] {\n        return [RLMResults resultsWithObjectInfo:*_objectInfo\n                                         results:_backingCollection.as_results().sort(RLMSortDescriptorsToKeypathArray(properties))];\n    });\n}\n\n- (RLMResults *)sortedResultsUsingKeyPath:(nonnull NSString *)keyPath ascending:(BOOL)ascending {\n    return [self sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:keyPath ascending:ascending]]];\n}\n\n- (RLMResults *)distinctResultsUsingKeyPaths:(NSArray<NSString *> *)keyPaths {\n    return translateErrors([&] {\n        auto results = [RLMResults resultsWithObjectInfo:*_objectInfo results:_backingCollection.as_results()];\n        return [results distinctResultsUsingKeyPaths:keyPaths];\n    });\n}\n\n- (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate {\n    if (_property->_type != RLMPropertyTypeObject) {\n        @throw RLMException(@\"Querying is currently only implemented for dictionaries of Realm Objects\");\n    }\n    auto query = RLMPredicateToQuery(predicate, _objectInfo->rlmObjectSchema, _realm.schema, _realm.group);\n    auto results = translateErrors([&] {\n        return _backingCollection.as_results().filter(std::move(query));\n    });\n    return [RLMResults resultsWithObjectInfo:*_objectInfo results:std::move(results)];\n}\n\n- (void)addObserver:(id)observer\n         forKeyPath:(NSString *)keyPath\n            options:(NSKeyValueObservingOptions)options\n            context:(void *)context {\n    RLMEnsureDictionaryObservationInfo(_observationInfo, keyPath, self, self);\n    [super addObserver:observer forKeyPath:keyPath options:options context:context];\n}\n\n- (realm::TableView)tableView {\n    return translateErrors([&] {\n        return _backingCollection.as_results().get_query();\n    }).find_all();\n}\n\n- (RLMFastEnumerator *)fastEnumerator {\n    return translateErrors([&] {\n        return [[RLMFastEnumerator alloc] initWithBackingDictionary:_backingCollection\n                                                         dictionary:self\n                                                          classInfo:_objectInfo\n                                                         parentInfo:_ownerInfo\n                                                           property:_property\n        ];\n    });\n}\n\n- (BOOL)isFrozen {\n    return _realm.isFrozen;\n}\n\n- (instancetype)resolveInRealm:(RLMRealm *)realm {\n    auto& parentInfo = _ownerInfo->resolve(realm);\n    return translateErrors([&] {\n        return [[self.class alloc] initWithBackingCollection:_backingCollection.freeze(realm->_realm)\n                                                  parentInfo:&parentInfo\n                                                    property:parentInfo.rlmObjectSchema[_property.name]];\n    });\n}\n\n- (instancetype)freeze {\n    if (self.frozen) {\n        return self;\n    }\n    return [self resolveInRealm:_realm.freeze];\n}\n\n- (instancetype)thaw {\n    if (!self.frozen) {\n        return self;\n    }\n    return [self resolveInRealm:_realm.thaw];\n}\n\nnamespace {\nstruct DictionaryCallbackWrapper {\n    void (^block)(id, RLMDictionaryChange *, NSError *);\n    RLMManagedDictionary *collection;\n    realm::TransactionRef previousTransaction;\n\n    DictionaryCallbackWrapper(void (^block)(id, RLMDictionaryChange *, NSError *), RLMManagedDictionary *dictionary)\n    : block(block)\n    , collection(dictionary)\n    , previousTransaction(static_cast<realm::Transaction&>(collection.realm.group).duplicate())\n    {\n    }\n\n    void operator()(realm::DictionaryChangeSet const& changes) {\n        if (changes.deletions.empty() && changes.insertions.empty() && changes.modifications.empty()) {\n            block(collection, nil, nil);\n        }\n        else {\n            block(collection, [[RLMDictionaryChange alloc] initWithChanges:changes], nil);\n        }\n        if (collection.isInvalidated) {\n            previousTransaction->end_read();\n        }\n        else {\n            previousTransaction->advance_read(static_cast<realm::Transaction&>(collection.realm.group).get_version_of_current_transaction());\n        }\n    }\n};\n} // anonymous namespace\n\n- (realm::NotificationToken)addNotificationCallback:(id)block\nkeyPaths:(std::optional<std::vector<std::vector<std::pair<realm::TableKey, realm::ColKey>>>>&&)keyPaths {\n    return _backingCollection.add_key_based_notification_callback(DictionaryCallbackWrapper{block, self},\n                                                                  std::move(keyPaths));\n}\n\n#pragma mark - Thread Confined Protocol Conformance\n\n- (realm::ThreadSafeReference)makeThreadSafeReference {\n    return _backingCollection;\n}\n\n- (RLMManagedCollectionHandoverMetadata *)objectiveCMetadata {\n    RLMManagedCollectionHandoverMetadata *metadata = [[RLMManagedCollectionHandoverMetadata alloc] init];\n    metadata.parentClassName = _ownerInfo->rlmObjectSchema.className;\n    metadata.key = _property.name;\n    return metadata;\n}\n\n+ (instancetype)objectWithThreadSafeReference:(realm::ThreadSafeReference)reference\n                                     metadata:(RLMManagedCollectionHandoverMetadata *)metadata\n                                        realm:(RLMRealm *)realm {\n    auto dictionary = reference.resolve<realm::object_store::Dictionary>(realm->_realm);\n    if (!dictionary.is_valid()) {\n        return nil;\n    }\n    RLMClassInfo *parentInfo = &realm->_info[metadata.parentClassName];\n    return [[RLMManagedDictionary alloc] initWithBackingCollection:std::move(dictionary)\n                                                        parentInfo:parentInfo\n                                                          property:parentInfo->rlmObjectSchema[metadata.key]];\n}\n\n@end\n"
  },
  {
    "path": "Realm/RLMManagedSet.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMSet_Private.hpp\"\n\n#import \"RLMAccessor.hpp\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMObjectStore.h\"\n#import \"RLMObject_Private.hpp\"\n#import \"RLMObservation.hpp\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMQueryUtil.hpp\"\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMSchema.h\"\n#import \"RLMSectionedResults_Private.hpp\"\n#import \"RLMThreadSafeReference_Private.hpp\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/collection.hpp>\n#import <realm/object-store/set.hpp>\n#import <realm/set.hpp>\n\n#import <realm/object-store/results.hpp>\n#import <realm/object-store/shared_realm.hpp>\n\n@interface RLMManagedSetHandoverMetadata : NSObject\n@property (nonatomic) NSString *parentClassName;\n@property (nonatomic) NSString *key;\n@end\n\n@implementation RLMManagedSetHandoverMetadata\n@end\n\n@interface RLMManagedSet () <RLMThreadConfined_Private>\n@end\n\n//\n// RLMSet implementation\n//\n@implementation RLMManagedSet {\n@public\n    realm::object_store::Set _backingSet;\n    RLMRealm *_realm;\n    RLMClassInfo *_objectInfo;\n    RLMClassInfo *_ownerInfo;\n    std::unique_ptr<RLMObservationInfo> _observationInfo;\n}\n\n- (RLMManagedSet *)initWithBackingCollection:(realm::object_store::Set)set\n                                  parentInfo:(RLMClassInfo *)parentInfo\n                                    property:(__unsafe_unretained RLMProperty *const)property {\n    if (property.type == RLMPropertyTypeObject)\n        self = [self initWithObjectClassName:property.objectClassName];\n    else\n        self = [self initWithObjectType:property.type\n                               optional:property.optional];\n    if (self) {\n        _realm = parentInfo->realm;\n        REALM_ASSERT(set.get_realm() == _realm->_realm);\n        _backingSet = std::move(set);\n        _ownerInfo = parentInfo;\n        _property = property;\n        if (property.type == RLMPropertyTypeObject)\n            _objectInfo = &parentInfo->linkTargetType(property.index);\n        else\n            _objectInfo = _ownerInfo;\n    }\n    return self;\n}\n\n- (RLMManagedSet *)initWithParent:(__unsafe_unretained RLMObjectBase *const)parentObject\n                         property:(__unsafe_unretained RLMProperty *const)property {\n    __unsafe_unretained RLMRealm *const realm = parentObject->_realm;\n    auto col = parentObject->_info->tableColumn(property);\n    return [self initWithBackingCollection:realm::object_store::Set(realm->_realm, parentObject->_row, col)\n                                parentInfo:parentObject->_info\n                                  property:property];\n}\n\n- (RLMManagedSet *)initWithParent:(realm::Obj)parent\n                         property:(__unsafe_unretained RLMProperty *const)property\n                       parentInfo:(RLMClassInfo&)info {\n    auto col = info.tableColumn(property);\n    return [self initWithBackingCollection:realm::object_store::Set(info.realm->_realm, parent, col)\n                                parentInfo:&info\n                                  property:property];\n}\n\nvoid RLMValidateSetObservationKey(__unsafe_unretained NSString *const keyPath,\n                                  __unsafe_unretained RLMSet *const set) {\n    if (![keyPath isEqualToString:RLMInvalidatedKey]) {\n        @throw RLMException(@\"[<%@ %p> addObserver:forKeyPath:options:context:] is not supported. Key path: %@\",\n                            [set class], set, keyPath);\n    }\n}\n\nvoid RLMEnsureSetObservationInfo(std::unique_ptr<RLMObservationInfo>& info,\n                                   __unsafe_unretained NSString *const keyPath,\n                                   __unsafe_unretained RLMSet *const set,\n                                   __unsafe_unretained id const observed) {\n    RLMValidateSetObservationKey(keyPath, set);\n    if (!info && set.class == [RLMManagedSet class]) {\n        auto lv = static_cast<RLMManagedSet *>(set);\n        info = std::make_unique<RLMObservationInfo>(*lv->_ownerInfo,\n                                                    lv->_backingSet.get_parent_object_key(),\n                                                    observed);\n    }\n}\n\ntemplate<typename Function>\n__attribute__((always_inline))\nstatic auto translateErrors(Function&& f) {\n    return translateCollectionError(static_cast<Function&&>(f), @\"Set\");\n}\n\nstatic void changeSet(__unsafe_unretained RLMManagedSet *const set,\n                      dispatch_block_t f) {\n    translateErrors([&] { set->_backingSet.verify_in_transaction(); });\n\n    RLMObservationTracker tracker(set->_realm, false);\n    tracker.trackDeletions();\n    auto obsInfo = RLMGetObservationInfo(set->_observationInfo.get(),\n                                         set->_backingSet.get_parent_object_key(),\n                                         *set->_ownerInfo);\n    if (obsInfo) {\n        tracker.willChange(obsInfo, set->_property.name);\n    }\n\n    translateErrors(f);\n}\n\n//\n// public method implementations\n//\n- (RLMRealm *)realm {\n    return _realm;\n}\n\n- (NSUInteger)count {\n    return translateErrors([&] { return _backingSet.size(); });\n}\n\n- (NSArray<id> *)allObjects {\n    NSMutableArray *arr = [NSMutableArray new];\n    for (id prop : self) {\n        [arr addObject:prop];\n    }\n    return arr;\n}\n\n- (BOOL)isInvalidated {\n    return translateErrors([&] { return !_backingSet.is_valid(); });\n}\n\n- (RLMClassInfo *)objectInfo {\n    return _objectInfo;\n}\n\n\n- (bool)isBackedBySet:(realm::object_store::Set const&)set {\n    return _backingSet == set;\n}\n\n- (BOOL)isEqual:(id)object {\n    return [object respondsToSelector:@selector(isBackedBySet:)] && [object isBackedBySet:_backingSet];\n}\n\n- (NSUInteger)hash {\n    return std::hash<realm::object_store::Set>()(_backingSet);\n}\n\n- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state\n                                  objects:(__unused __unsafe_unretained id [])buffer\n                                    count:(NSUInteger)len {\n    return RLMFastEnumerate(state, len, self);\n}\n\nstatic void RLMInsertObject(RLMManagedSet *set, id object) {\n    RLMSetValidateMatchingObjectType(set, object);\n    changeSet(set, ^{\n        RLMAccessorContext context(*set->_objectInfo);\n        set->_backingSet.insert(context, object);\n    });\n}\n\nstatic void RLMRemoveObject(RLMManagedSet *set, id object) {\n    RLMSetValidateMatchingObjectType(set, object);\n    changeSet(set, ^{\n        RLMAccessorContext context(*set->_objectInfo);\n        set->_backingSet.remove(context, object);\n    });\n}\n\nstatic void ensureInWriteTransaction(NSString *message, RLMManagedSet *set, RLMManagedSet *otherSet) {\n    if (!set.realm.inWriteTransaction && !otherSet.realm.inWriteTransaction) {\n        @throw RLMException(@\"Can only perform %@ in a Realm in a write transaction - call beginWriteTransaction on an RLMRealm instance first.\", message);\n    }\n}\n\n- (void)addObject:(id)object {\n    RLMInsertObject(self, object);\n}\n\n- (void)addObjects:(id<NSFastEnumeration>)objects {\n    changeSet(self, ^{\n        RLMAccessorContext context(*_objectInfo);\n        for (id obj in objects) {\n            RLMSetValidateMatchingObjectType(self, obj);\n            _backingSet.insert(context, obj);\n        }\n    });\n}\n\n- (void)removeObject:(id)object {\n    RLMRemoveObject(self, object);\n}\n\n- (void)removeAllObjects {\n    changeSet(self, ^{\n        _backingSet.remove_all();\n    });\n}\n\n- (void)replaceAllObjectsWithObjects:(NSArray *)objects {\n    changeSet(self, ^{\n        RLMAccessorContext context(*_objectInfo);\n        _backingSet.assign(context, objects);\n    });\n}\n\n- (RLMManagedSet *)managedObjectFrom:(RLMSet *)set {\n    auto managedSet = RLMDynamicCast<RLMManagedSet>(set);\n    if (!managedSet) {\n        @throw RLMException(@\"Right hand side value must be a managed Set.\");\n    }\n    if (_type != managedSet->_type) {\n        @throw RLMException(@\"Cannot intersect sets of type '%@' and '%@'.\",\n                            RLMTypeToString(_type), RLMTypeToString(managedSet->_type));\n    }\n    if (_realm != managedSet->_realm) {\n        @throw RLMException(@\"Cannot insersect sets managed by different Realms.\");\n    }\n    if (_objectInfo != managedSet->_objectInfo) {\n        @throw RLMException(@\"Cannot intersect sets of type '%@' and '%@'.\",\n                            _objectInfo->rlmObjectSchema.className,\n                            managedSet->_objectInfo->rlmObjectSchema.className);\n\n    }\n    return managedSet;\n}\n\n- (BOOL)isSubsetOfSet:(RLMSet<id> *)set {\n    RLMManagedSet *rhs = [self managedObjectFrom:set];\n    return _backingSet.is_subset_of(rhs->_backingSet);\n}\n\n- (BOOL)intersectsSet:(RLMSet<id> *)set {\n    RLMManagedSet *rhs = [self managedObjectFrom:set];\n    return _backingSet.intersects(rhs->_backingSet);\n}\n\n- (BOOL)containsObject:(id)obj {\n    RLMSetValidateMatchingObjectType(self, obj);\n    RLMAccessorContext context(*_objectInfo);\n    auto r = _backingSet.find(context, obj);\n    return r != realm::npos;\n}\n\n- (BOOL)isEqualToSet:(RLMSet<id> *)set {\n    RLMManagedSet *rhs = [self managedObjectFrom:set];\n    return [self isEqual:rhs];\n}\n\n- (void)setSet:(RLMSet<id> *)set {\n    RLMManagedSet *rhs = [self managedObjectFrom:set];\n    ensureInWriteTransaction(@\"[RLMSet setSet:]\", self, rhs);\n    changeSet(self, ^{\n        RLMAccessorContext context(*_objectInfo);\n        _backingSet.assign(context, rhs);\n    });\n}\n\n- (void)intersectSet:(RLMSet<id> *)set {\n    RLMManagedSet *rhs = [self managedObjectFrom:set];\n    ensureInWriteTransaction(@\"[RLMSet intersectSet:]\", self, rhs);\n    changeSet(self, ^{\n        _backingSet.assign_intersection(rhs->_backingSet);\n    });\n}\n\n- (void)unionSet:(RLMSet<id> *)set {\n    RLMManagedSet *rhs = [self managedObjectFrom:set];\n    ensureInWriteTransaction(@\"[RLMSet unionSet:]\", self, rhs);\n    changeSet(self, ^{\n        _backingSet.assign_union(rhs->_backingSet);\n    });\n}\n\n- (void)minusSet:(RLMSet<id> *)set {\n    RLMManagedSet *rhs = [self managedObjectFrom:set];\n    ensureInWriteTransaction(@\"[RLMSet minusSet:]\", self, rhs);\n    changeSet(self, ^{\n        _backingSet.assign_difference(rhs->_backingSet);\n    });\n}\n\n- (id)objectAtIndex:(NSUInteger)index {\n    return translateErrors([&] {\n        RLMAccessorContext context(*_objectInfo);\n        return _backingSet.get(context, index);\n    });\n}\n\n- (NSArray *)objectsAtIndexes:(NSIndexSet *)indexes {\n    size_t count = self.count;\n    NSMutableArray *result = [[NSMutableArray alloc] initWithCapacity:indexes.count];\n    RLMAccessorContext context(*_objectInfo);\n    for (NSUInteger i = indexes.firstIndex; i != NSNotFound; i = [indexes indexGreaterThanIndex:i]) {\n        if (i >= count) {\n            return nil;\n        }\n        [result addObject:_backingSet.get(context, i)];\n    }\n    return result;\n}\n\n- (id)firstObject {\n    return translateErrors([&] {\n        RLMAccessorContext context(*_objectInfo);\n        return _backingSet.size() ? _backingSet.get(context, 0) : nil;\n    });\n}\n\n- (id)lastObject {\n    return translateErrors([&] {\n        RLMAccessorContext context(*_objectInfo);\n        size_t size = _backingSet.size();\n        return size ? _backingSet.get(context, size - 1) : nil;\n    });\n}\n\n- (id)valueForKeyPath:(NSString *)keyPath {\n    if ([keyPath hasPrefix:@\"@\"]) {\n        // Delegate KVC collection operators to RLMResults\n        return translateErrors([&] {\n            auto results = [RLMResults resultsWithObjectInfo:*_objectInfo results:_backingSet.as_results()];\n            return [results valueForKeyPath:keyPath];\n        });\n    }\n    return [super valueForKeyPath:keyPath];\n}\n\n- (id)valueForKey:(NSString *)key {\n    // Ideally we'd use \"@invalidated\" for this so that \"invalidated\" would use\n    // normal array KVC semantics, but observing @things works very oddly (when\n    // it's part of a key path, it's triggered automatically when array index\n    // changes occur, and can't be sent explicitly, but works normally when it's\n    // the entire key path), and an RLMManagedSet *can't* have objects where\n    // invalidated is true, so we're not losing much.\n    return translateErrors([&]() -> id {\n        if ([key isEqualToString:RLMInvalidatedKey]) {\n            return @(!_backingSet.is_valid());\n        }\n\n        _backingSet.verify_attached();\n        return  [NSSet setWithArray:RLMCollectionValueForKey(_backingSet, key, *_objectInfo)];\n    });\n    return nil;\n}\n\n- (void)setValue:(id)value forKey:(NSString *)key {\n    if ([key isEqualToString:@\"self\"]) {\n        RLMSetValidateMatchingObjectType(self, value);\n        RLMAccessorContext context(*_objectInfo);\n        translateErrors([&] {\n            _backingSet.remove_all();\n            _backingSet.insert(context, value);\n            return;\n        });\n    } else if (_type == RLMPropertyTypeObject) {\n        RLMSetValidateMatchingObjectType(self, value);\n        translateErrors([&] { _backingSet.verify_in_transaction(); });\n        RLMCollectionSetValueForKey(self, key, value);\n    }\n    else {\n        [self setValue:value forUndefinedKey:key];\n    }\n}\n\n- (id)minOfProperty:(NSString *)property {\n    auto column = columnForProperty(property, _backingSet, _objectInfo, _type, RLMCollectionTypeSet);\n    auto value = translateErrors([&] { return _backingSet.min(column); });\n    return value ? RLMMixedToObjc(*value) : nil;\n}\n\n- (id)maxOfProperty:(NSString *)property {\n    auto column = columnForProperty(property, _backingSet, _objectInfo, _type, RLMCollectionTypeSet);\n    auto value = translateErrors([&] { return _backingSet.max(column); });\n    return value ? RLMMixedToObjc(*value) : nil;\n}\n\n- (id)sumOfProperty:(NSString *)property {\n    auto column = columnForProperty(property, _backingSet, _objectInfo, _type, RLMCollectionTypeSet);\n    return RLMMixedToObjc(translateErrors([&] { return _backingSet.sum(column); }));\n}\n\n- (id)averageOfProperty:(NSString *)property {\n    auto column = columnForProperty(property, _backingSet, _objectInfo, _type, RLMCollectionTypeSet);\n    auto value = translateErrors([&] { return _backingSet.average(column); });\n    return value ? RLMMixedToObjc(*value) : nil;\n}\n\n- (void)deleteObjectsFromRealm {\n    if (_type != RLMPropertyTypeObject) {\n        @throw RLMException(@\"Cannot delete objects from RLMSet<%@>: only RLMObjects can be deleted.\", RLMTypeToString(_type));\n    }\n    // delete all target rows from the realm\n    RLMObservationTracker tracker(_realm, true);\n    translateErrors([&] { _backingSet.delete_all(); });\n}\n\n- (RLMResults *)sortedResultsUsingDescriptors:(NSArray<RLMSortDescriptor *> *)properties {\n    return translateErrors([&] {\n        return [RLMResults  resultsWithObjectInfo:*_objectInfo\n                                          results:_backingSet.sort(RLMSortDescriptorsToKeypathArray(properties))];\n    });\n}\n\n- (RLMResults *)distinctResultsUsingKeyPaths:(NSArray<NSString *> *)keyPaths {\n    return translateErrors([&] {\n        auto results = [RLMResults resultsWithObjectInfo:*_objectInfo results:_backingSet.as_results()];\n        return [results distinctResultsUsingKeyPaths:keyPaths];\n    });\n}\n\n- (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate {\n    if (_type != RLMPropertyTypeObject) {\n        @throw RLMException(@\"Querying is currently only implemented for sets of Realm Objects\");\n    }\n    auto query = RLMPredicateToQuery(predicate, _objectInfo->rlmObjectSchema, _realm.schema, _realm.group);\n    auto results = translateErrors([&] { return _backingSet.filter(std::move(query)); });\n    return [RLMResults resultsWithObjectInfo:*_objectInfo results:std::move(results)];\n}\n\n- (RLMSectionedResults *)sectionedResultsSortedUsingKeyPath:(NSString *)keyPath\n                                                  ascending:(BOOL)ascending\n                                                   keyBlock:(RLMSectionedResultsKeyBlock)keyBlock {\n    return [[RLMSectionedResults alloc] initWithResults:[self sortedResultsUsingKeyPath:keyPath ascending:ascending]\n                                               keyBlock:keyBlock];\n}\n\n- (RLMSectionedResults *)sectionedResultsUsingSortDescriptors:(NSArray<RLMSortDescriptor *> *)sortDescriptors\n                                                     keyBlock:(RLMSectionedResultsKeyBlock)keyBlock {\n    return [[RLMSectionedResults alloc] initWithResults:[self sortedResultsUsingDescriptors:sortDescriptors]\n                                               keyBlock:keyBlock];\n}\n\n- (void)addObserver:(id)observer\n         forKeyPath:(NSString *)keyPath\n            options:(NSKeyValueObservingOptions)options\n            context:(void *)context {\n    RLMEnsureSetObservationInfo(_observationInfo, keyPath, self, self);\n    [super addObserver:observer forKeyPath:keyPath options:options context:context];\n}\n\n- (RLMFastEnumerator *)fastEnumerator {\n    return translateErrors([&] {\n        return [[RLMFastEnumerator alloc] initWithBackingCollection:_backingSet\n                                                         collection:self\n                                                          classInfo:_objectInfo\n                                                         parentInfo:_ownerInfo\n                                                           property:_property];\n    });\n}\n\n- (realm::TableView)tableView {\n    return translateErrors([&] { return _backingSet.get_query(); }).find_all();\n}\n\n- (BOOL)isFrozen {\n    return _realm.isFrozen;\n}\n\n- (instancetype)resolveInRealm:(RLMRealm *)realm {\n    auto& parentInfo = _ownerInfo->resolve(realm);\n    return translateErrors([&] {\n        return [[self.class alloc] initWithBackingCollection:_backingSet.freeze(realm->_realm)\n                                                  parentInfo:&parentInfo\n                                                    property:parentInfo.rlmObjectSchema[_property.name]];\n    });\n}\n\n- (instancetype)freeze {\n    if (self.frozen) {\n        return self;\n    }\n    return [self resolveInRealm:_realm.freeze];\n}\n\n- (instancetype)thaw {\n    if (!self.frozen) {\n        return self;\n    }\n    return [self resolveInRealm:_realm.thaw];\n}\n\n- (realm::NotificationToken)addNotificationCallback:(id)block\nkeyPaths:(std::optional<std::vector<std::vector<std::pair<realm::TableKey, realm::ColKey>>>>&&)keyPaths {\n    return _backingSet.add_notification_callback(RLMWrapCollectionChangeCallback(block, self, false), std::move(keyPaths));\n}\n\n#pragma mark - Thread Confined Protocol Conformance\n\n- (realm::ThreadSafeReference)makeThreadSafeReference {\n    return _backingSet;\n}\n\n- (RLMManagedSetHandoverMetadata *)objectiveCMetadata {\n    RLMManagedSetHandoverMetadata *metadata = [[RLMManagedSetHandoverMetadata alloc] init];\n    metadata.parentClassName = _ownerInfo->rlmObjectSchema.className;\n    metadata.key = _property.name;\n    return metadata;\n}\n\n+ (instancetype)objectWithThreadSafeReference:(realm::ThreadSafeReference)reference\n                                     metadata:(RLMManagedSetHandoverMetadata *)metadata\n                                        realm:(RLMRealm *)realm {\n    auto set = reference.resolve<realm::object_store::Set>(realm->_realm);\n    if (!set.is_valid()) {\n        return nil;\n    }\n    RLMClassInfo *parentInfo = &realm->_info[metadata.parentClassName];\n    return [[RLMManagedSet alloc] initWithBackingCollection:std::move(set)\n                                                 parentInfo:parentInfo\n                                                   property:parentInfo->rlmObjectSchema[metadata.key]];\n}\n\n@end\n\n"
  },
  {
    "path": "Realm/RLMMigration.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@class RLMSchema;\n@class RLMArray;\n@class RLMObject;\n\n/**\n A block type which provides both the old and new versions of an object in the Realm. Object\n properties can only be accessed using keyed subscripting.\n\n @see `-[RLMMigration enumerateObjects:block:]`\n\n @param oldObject The object from the original Realm (read-only).\n @param newObject The object from the migrated Realm (read-write).\n*/\ntypedef void (^RLMObjectMigrationBlock)(RLMObject * __nullable oldObject, RLMObject * __nullable newObject);\n\n/**\n `RLMMigration` instances encapsulate information intended to facilitate a schema migration.\n\n A `RLMMigration` instance is passed into a user-defined `RLMMigrationBlock` block when updating\n the version of a Realm. This instance provides access to the old and new database schemas, the\n objects in the Realm, and provides functionality for modifying the Realm during the migration.\n */\n@interface RLMMigration : NSObject\n\n#pragma mark - Properties\n\n/**\n Returns the old `RLMSchema`. This is the schema which describes the Realm before the\n migration is applied.\n */\n@property (nonatomic, readonly) RLMSchema *oldSchema NS_REFINED_FOR_SWIFT;\n\n/**\n Returns the new `RLMSchema`. This is the schema which describes the Realm after the\n migration is applied.\n */\n@property (nonatomic, readonly) RLMSchema *newSchema NS_REFINED_FOR_SWIFT;\n\n\n#pragma mark - Altering Objects during a Migration\n\n/**\n Enumerates all the objects of a given type in the Realm, providing both the old and new versions\n of each object. Within the block, object properties can only be accessed using keyed subscripting.\n\n @param className   The name of the `RLMObject` class to enumerate.\n\n @warning   All objects returned are of a type specific to the current migration and should not be cast\n            to `className`. Instead, treat them as `RLMObject`s and use keyed subscripting to access\n            properties.\n */\n- (void)enumerateObjects:(NSString *)className\n                   block:(__attribute__((noescape, swift_attr(\"@nonSendable\"))) RLMObjectMigrationBlock)block NS_REFINED_FOR_SWIFT;\n\n/**\n Creates and returns an `RLMObject` instance of type `className` in the Realm being migrated.\n\n The `value` argument is used to populate the object. It can be a key-value coding compliant object, an array or\n dictionary returned from the methods in `NSJSONSerialization`, or an array containing one element for each managed\n property. An exception will be thrown if any required properties are not present and those properties were not defined\n with default values.\n\n When passing in an `NSArray` as the `value` argument, all properties must be present, valid and in the same order as\n the properties defined in the model.\n\n @param className   The name of the `RLMObject` class to create.\n @param value       The value used to populate the object.\n */\n- (RLMObject *)createObject:(NSString *)className withValue:(id)value NS_REFINED_FOR_SWIFT;\n\n/**\n Deletes an object from a Realm during a migration.\n\n It is permitted to call this method from within the block passed to `-[enumerateObjects:block:]`.\n\n @param object  Object to be deleted from the Realm being migrated.\n */\n- (void)deleteObject:(RLMObject *)object NS_REFINED_FOR_SWIFT;\n\n/**\n Deletes the data for the class with the given name.\n\n All objects of the given class will be deleted. If the `RLMObject` subclass no longer exists in your program,\n any remaining metadata for the class will be removed from the Realm file.\n\n @param  name The name of the `RLMObject` class to delete.\n\n @return A Boolean value indicating whether there was any data to delete.\n */\n- (BOOL)deleteDataForClassName:(NSString *)name NS_REFINED_FOR_SWIFT;\n\n/**\n Renames a property of the given class from `oldName` to `newName`.\n\n @param className The name of the class whose property should be renamed. This class must be present\n                  in both the old and new Realm schemas.\n @param oldName   The old persisted property name for the property to be renamed. There must not be a property with this name in the\n                  class as defined by the new Realm schema.\n @param newName   The new persisted property name for the property to be renamed. There must not be a property with this name in the\n                  class as defined by the old Realm schema.\n */\n- (void)renamePropertyForClass:(NSString *)className oldName:(NSString *)oldName\n                       newName:(NSString *)newName NS_REFINED_FOR_SWIFT;\n\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMMigration.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMMigration_Private.h\"\n\n#import \"RLMAccessor.h\"\n#import \"RLMObject_Private.h\"\n#import \"RLMObject_Private.hpp\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMObjectStore.h\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMRealm_Dynamic.h\"\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMResults_Private.hpp\"\n#import \"RLMSchema_Private.hpp\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/object-store/object_store.hpp>\n#import <realm/object-store/shared_realm.hpp>\n#import <realm/object-store/schema.hpp>\n#import <realm/table.hpp>\n\nusing namespace realm;\n\n@implementation RLMMigration {\n    RLMRealm *_oldRealm;\n    RLMRealm *_realm;\n    realm::Schema *_schema;\n}\n\n- (instancetype)initWithRealm:(RLMRealm *)realm oldRealm:(RLMRealm *)oldRealm schema:(realm::Schema &)schema {\n    self = [super init];\n    if (self) {\n        _realm = realm;\n        _oldRealm = oldRealm;\n        _schema = &schema;\n    }\n    return self;\n}\n\n- (RLMSchema *)oldSchema {\n    return _oldRealm.schema;\n}\n\n- (RLMSchema *)newSchema {\n    return _realm.schema;\n}\n\n- (void)enumerateObjects:(NSString *)className block:(__attribute__((noescape)) RLMObjectMigrationBlock)block {\n    RLMResults *objects = [_realm.schema schemaForClassName:className] ? [_realm allObjects:className] : nil;\n    RLMResults *oldObjects = [_oldRealm.schema schemaForClassName:className] ? [_oldRealm allObjects:className] : nil;\n\n    // For whatever reason if this is a newly added table we enumerate the\n    // objects in it, while in all other cases we enumerate only the existing\n    // objects. It's unclear how this could be useful, but changing it would\n    // also be a pointless breaking change and it's unlikely to be hurting anyone.\n    if (objects && !oldObjects) {\n        for (RLMObject *object in objects) {\n            @autoreleasepool {\n                block(nil, object);\n            }\n        }\n        return;\n    }\n    \n    // If a table will be deleted it can still be enumerated during the migration\n    // so that data can be saved or transfered to other tables if necessary.\n    if (!objects && oldObjects) {\n        for (RLMObject *oldObject in oldObjects) {\n            @autoreleasepool {\n                block(oldObject, nil);\n            }\n        }\n        return;\n    }\n    \n    if (oldObjects.count == 0 || objects.count == 0) {\n        return;\n    }\n\n    auto& info = _realm->_info[className];\n    for (RLMObject *oldObject in oldObjects) {\n        @autoreleasepool {\n            Obj newObj;\n            try {\n                newObj = info.table()->get_object(oldObject->_row.get_key());\n            }\n            catch (KeyNotFound const&) {\n                continue;\n            }\n            block(oldObject, (id)RLMCreateObjectAccessor(info, std::move(newObj)));\n        }\n    }\n}\n\n- (void)execute:(RLMMigrationBlock)block objectClass:(::Class)dynamicObjectClass {\n    if (!dynamicObjectClass) {\n        dynamicObjectClass = RLMDynamicObject.class;\n    }\n    @autoreleasepool {\n        // disable all primary keys for migration and use DynamicObject for all types\n        for (RLMObjectSchema *objectSchema in _realm.schema.objectSchema) {\n            objectSchema.accessorClass = dynamicObjectClass;\n            objectSchema.primaryKeyProperty.isPrimary = NO;\n        }\n        for (RLMObjectSchema *objectSchema in _oldRealm.schema.objectSchema) {\n            objectSchema.accessorClass = dynamicObjectClass;\n        }\n\n        block(self, _oldRealm->_realm->schema_version());\n\n        _oldRealm = nil;\n        _realm = nil;\n    }\n}\n\n- (RLMObject *)createObject:(NSString *)className withValue:(id)value {\n    return [_realm createObject:className withValue:value];\n}\n\n- (RLMObject *)createObject:(NSString *)className withObject:(id)object {\n    return [self createObject:className withValue:object];\n}\n\n- (void)deleteObject:(RLMObject *)object {\n    [_realm deleteObject:object];\n}\n\n- (BOOL)deleteDataForClassName:(NSString *)name {\n    if (!name) {\n        return false;\n    }\n\n    TableRef table = ObjectStore::table_for_object_type(_realm.group, name.UTF8String);\n    if (!table) {\n        return false;\n    }\n    if ([_realm.schema schemaForClassName:name]) {\n        table->clear();\n    }\n    else {\n        _realm.group.remove_table(table->get_key());\n    }\n\n    return true;\n}\n\n- (void)renamePropertyForClass:(NSString *)className oldName:(NSString *)oldName newName:(NSString *)newName {\n    realm::ObjectStore::rename_property(_realm.group, *_schema, className.UTF8String,\n                                        oldName.UTF8String, newName.UTF8String);\n}\n\n@end\n"
  },
  {
    "path": "Realm/RLMMigration_Private.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMMigration.h>\n#import <Realm/RLMObjectBase.h>\n#import <Realm/RLMRealm.h>\n\nnamespace realm {\n    class Schema;\n}\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@interface RLMMigration ()\n- (instancetype)initWithRealm:(RLMRealm *)realm oldRealm:(RLMRealm *)oldRealm schema:(realm::Schema &)schema;\n- (void)execute:(RLMMigrationBlock)block objectClass:(_Nullable Class)cls;\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMObject.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n#import <Realm/RLMObjectBase.h>\n#import <Realm/RLMThreadSafeReference.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@class RLMNotificationToken;\n@class RLMObjectSchema;\n@class RLMPropertyChange;\n@class RLMPropertyDescriptor;\n@class RLMRealm;\n@class RLMResults<RLMObjectType>;\n\n/**\n `RLMObject` is a base class for model objects representing data stored in Realms.\n\n Define your model classes by subclassing `RLMObject` and adding properties to be managed.\n Then instantiate and use your custom subclasses instead of using the `RLMObject` class directly.\n\n     // Dog.h\n     @interface Dog : RLMObject\n     @property NSString *name;\n     @property BOOL      adopted;\n     @end\n\n     // Dog.m\n     @implementation Dog\n     @end //none needed\n\n ### Supported property types\n\n - `NSString`\n - `NSInteger`, `int`, `long`, `float`, and `double`\n - `BOOL` or `bool`\n - `NSDate`\n - `NSData`\n - `NSNumber<X>`, where `X` is one of `RLMInt`, `RLMFloat`, `RLMDouble` or `RLMBool`, for optional number properties\n - `RLMObject` subclasses, to model many-to-one relationships.\n - `RLMArray<X>`, where `X` is an `RLMObject` subclass, to model many-to-many relationships.\n\n ### Querying\n\n You can initiate queries directly via the class methods: `allObjects`, `objectsWhere:`, and `objectsWithPredicate:`.\n These methods allow you to easily query a custom subclass for instances of that class in the default Realm.\n\n To search in a Realm other than the default Realm, use the `allObjectsInRealm:`, `objectsInRealm:where:`,\n and `objectsInRealm:withPredicate:` class methods.\n\n @see `RLMRealm`\n\n ### Relationships\n\n See our [Realm Swift Documentation](https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/model-data/relationships/) for more details.\n\n ### Key-Value Observing\n\n All `RLMObject` properties (including properties you create in subclasses) are\n [Key-Value Observing compliant](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html),\n except for `realm` and `objectSchema`.\n\n Keep the following tips in mind when observing Realm objects:\n\n 1. Unlike `NSMutableArray` properties, `RLMArray` properties do not require\n    using the proxy object returned from `-mutableArrayValueForKey:`, or defining\n    KVC mutation methods on the containing class. You can simply call methods on\n    the `RLMArray` directly; any changes will be automatically observed by the containing\n    object.\n 2. Unmanaged `RLMObject` instances cannot be added to a Realm while they have any\n    observed properties.\n 3. Modifying managed `RLMObject`s within `-observeValueForKeyPath:ofObject:change:context:`\n    is not recommended. Properties may change even when the Realm is not in a write\n    transaction (for example, when `-[RLMRealm refresh]` is called after changes\n    are made on a different thread), and notifications sent prior to the change\n    being applied (when `NSKeyValueObservingOptionPrior` is used) may be sent at\n    times when you *cannot* begin a write transaction.\n */\n\n@interface RLMObject : RLMObjectBase <RLMThreadConfined>\n\n#pragma mark - Creating & Initializing Objects\n\n/**\n Creates an unmanaged instance of a Realm object.\n\n Call `addObject:` on an `RLMRealm` instance to add an unmanaged object into that Realm.\n\n @see `[RLMRealm addObject:]`\n */\n- (instancetype)init NS_DESIGNATED_INITIALIZER;\n\n\n/**\n Creates an unmanaged instance of a Realm object.\n\n Pass in an `NSArray` or `NSDictionary` instance to set the values of the object's properties.\n\n Call `addObject:` on an `RLMRealm` instance to add an unmanaged object into that Realm.\n\n @see `[RLMRealm addObject:]`\n */\n- (instancetype)initWithValue:(id)value;\n\n\n/**\n Returns the class name for a Realm object subclass.\n\n @warning Do not override. Realm relies on this method returning the exact class\n          name.\n\n @return  The class name for the model class.\n */\n+ (NSString *)className;\n\n/**\n Creates an instance of a Realm object with a given value, and adds it to the default Realm.\n\n If nested objects are included in the argument, `createInDefaultRealmWithValue:` will be recursively called\n on them.\n\n The `value` argument can be a key-value coding compliant object, an array or dictionary returned from the methods in\n `NSJSONSerialization`, or an array containing one element for each managed property.\n\n An exception will be thrown if any required properties are not present and those properties\n were not defined with default values.\n\n If the `value` argument is an array, all properties must be present, valid and in the same\n order as the properties defined in the model.\n\n @param value    The value used to populate the object.\n\n @see   `defaultPropertyValues`\n */\n+ (instancetype)createInDefaultRealmWithValue:(id)value;\n\n/**\n Creates an instance of a Realm object with a given value, and adds it to the specified Realm.\n\n If nested objects are included in the argument, `createInRealm:withValue:` will be recursively called\n on them.\n\n The `value` argument can be a key-value coding compliant object, an array or dictionary returned from the methods in\n `NSJSONSerialization`, or an array containing one element for each managed property.\n\n An exception will be thrown if any required properties are not present and those properties\n were not defined with default values.\n\n If the `value` argument is an array, all properties must be present, valid and in the same\n order as the properties defined in the model.\n\n @param realm    The Realm which should manage the newly-created object.\n @param value    The value used to populate the object.\n\n @see   `defaultPropertyValues`\n */\n+ (instancetype)createInRealm:(RLMRealm *)realm withValue:(id)value;\n\n/**\n Creates or updates a Realm object within the default Realm.\n\n This method may only be called on Realm object types with a primary key defined. If there is already\n an object with the same primary key value in the default Realm, its values are updated and the object\n is returned. Otherwise, this method creates and populates a new instance of the object in the default Realm.\n\n If nested objects are included in the argument, `createOrUpdateInDefaultRealmWithValue:` will be\n recursively called on them if they have primary keys, `createInDefaultRealmWithValue:` if they do not.\n\n The `value` argument is used to populate the object. It can be a Realm object, a key-value coding\n compliant object, an array or dictionary returned from the methods in `NSJSONSerialization`, or an\n array containing one element for each managed property.\n\n If the object is being created, an exception will be thrown if any required properties\n are not present and those properties were not defined with default values.\n\n If the `value` argument is a Realm object already managed by the default Realm, the\n argument's type is the same as the receiver, and the objects have identical values for\n their managed properties, this method does nothing.\n\n If the object is being updated, each property defined in its schema will be set by copying from\n `value` using key-value coding. If the `value` argument does not respond to `valueForKey:` for a\n given property name (or getter name, if defined), that value will remain untouched.\n Nullable properties on the object can be set to nil by using `NSNull` as the updated value.\n Each property is set even if the existing value is the same as the new value being set, and\n notifications will report them all being changed. See `createOrUpdateModifiedInDefaultRealmWithValue:`\n for a version of this function which only sets the values which have changed.\n\n If the `value` argument is an array, all properties must be present, valid and in the same\n order as the properties defined in the model.\n\n @param value    The value used to populate the object.\n\n @see   `defaultPropertyValues`, `primaryKey`\n */\n+ (instancetype)createOrUpdateInDefaultRealmWithValue:(id)value;\n\n/**\n Creates or updates a Realm object within the default Realm.\n\n This method may only be called on Realm object types with a primary key defined. If there is already\n an object with the same primary key value in the default Realm, its values are updated and the object\n is returned. Otherwise, this method creates and populates a new instance of the object in the default Realm.\n\n If nested objects are included in the argument, `createOrUpdateModifiedInDefaultRealmWithValue:` will be\n recursively called on them if they have primary keys, `createInDefaultRealmWithValue:` if they do not.\n\n The `value` argument is used to populate the object. It can be a Realm object, a key-value coding\n compliant object, an array or dictionary returned from the methods in `NSJSONSerialization`, or an\n array containing one element for each managed property.\n\n If the object is being created, an exception will be thrown if any required properties\n are not present and those properties were not defined with default values.\n\n If the `value` argument is a Realm object already managed by the default Realm, the\n argument's type is the same as the receiver, and the objects have identical values for\n their managed properties, this method does nothing.\n\n If the object is being updated, each property defined in its schema will be set by copying from\n `value` using key-value coding. If the `value` argument does not respond to `valueForKey:` for a\n given property name (or getter name, if defined), that value will remain untouched.\n Nullable properties on the object can be set to nil by using `NSNull` as the updated value.\n Unlike `createOrUpdateInDefaultRealmWithValue:`, only properties which have changed in value are\n set, and any change notifications produced by this call will report only which properies have\n actually changed.\n\n Checking which properties have changed imposes a small amount of overhead, and so this method\n may be slower when all or nearly all of the properties being set have changed. If most or all\n of the properties being set have not changed, this method will be much faster than unconditionally\n setting all of them, and will also reduce how much data has to be written to the Realm, saving\n both i/o time and disk space.\n\n If the `value` argument is an array, all properties must be present, valid and in the same\n order as the properties defined in the model.\n\n @param value    The value used to populate the object.\n\n @see   `defaultPropertyValues`, `primaryKey`\n */\n+ (instancetype)createOrUpdateModifiedInDefaultRealmWithValue:(id)value;\n\n/**\n Creates or updates an Realm object within a specified Realm.\n\n This method may only be called on Realm object types with a primary key defined. If there is already\n an object with the same primary key value in the given Realm, its values are updated and the object\n is returned. Otherwise this method creates and populates a new instance of this object in the given Realm.\n\n If nested objects are included in the argument, `createOrUpdateInRealm:withValue:` will be\n recursively called on them if they have primary keys, `createInRealm:withValue:` if they do not.\n\n The `value` argument is used to populate the object. It can be a Realm object, a key-value coding\n compliant object, an array or dictionary returned from the methods in `NSJSONSerialization`, or an\n array containing one element for each managed property.\n\n If the object is being created, an exception will be thrown if any required properties\n are not present and those properties were not defined with default values.\n\n If the `value` argument is a Realm object already managed by the given Realm, the\n argument's type is the same as the receiver, and the objects have identical values for\n their managed properties, this method does nothing.\n\n If the object is being updated, each property defined in its schema will be set by copying from\n `value` using key-value coding. If the `value` argument does not respond to `valueForKey:` for a\n given property name (or getter name, if defined), that value will remain untouched.\n Nullable properties on the object can be set to nil by using `NSNull` as the updated value.\n Each property is set even if the existing value is the same as the new value being set, and\n notifications will report them all being changed. See `createOrUpdateModifiedInRealm:withValue:`\n for a version of this function which only sets the values which have changed.\n\n If the `value` argument is an array, all properties must be present, valid and in the same\n order as the properties defined in the model.\n\n @param realm    The Realm which should own the object.\n @param value    The value used to populate the object.\n\n @see   `defaultPropertyValues`, `primaryKey`\n */\n+ (instancetype)createOrUpdateInRealm:(RLMRealm *)realm withValue:(id)value;\n\n/**\n Creates or updates an Realm object within a specified Realm.\n\n This method may only be called on Realm object types with a primary key defined. If there is already\n an object with the same primary key value in the given Realm, its values are updated and the object\n is returned. Otherwise this method creates and populates a new instance of this object in the given Realm.\n\n If nested objects are included in the argument, `createOrUpdateInRealm:withValue:` will be\n recursively called on them if they have primary keys, `createInRealm:withValue:` if they do not.\n\n The `value` argument is used to populate the object. It can be a Realm object, a key-value coding\n compliant object, an array or dictionary returned from the methods in `NSJSONSerialization`, or an\n array containing one element for each managed property.\n\n If the object is being created, an exception will be thrown if any required properties\n are not present and those properties were not defined with default values.\n\n If the `value` argument is a Realm object already managed by the given Realm, the\n argument's type is the same as the receiver, and the objects have identical values for\n their managed properties, this method does nothing.\n\n If the object is being updated, each property defined in its schema will be set by copying from\n `value` using key-value coding. If the `value` argument does not respond to `valueForKey:` for a\n given property name (or getter name, if defined), that value will remain untouched.\n Nullable properties on the object can be set to nil by using `NSNull` as the updated value.\n Unlike `createOrUpdateInRealm:withValue:`, only properties which have changed in value are\n set, and any change notifications produced by this call will report only which properies have\n actually changed.\n\n Checking which properties have changed imposes a small amount of overhead, and so this method\n may be slower when all or nearly all of the properties being set have changed. If most or all\n of the properties being set have not changed, this method will be much faster than unconditionally\n setting all of them, and will also reduce how much data has to be written to the Realm, saving\n both i/o time and disk space.\n\n If the `value` argument is an array, all properties must be present, valid and in the same\n order as the properties defined in the model.\n\n @param realm    The Realm which should own the object.\n @param value    The value used to populate the object.\n\n @see   `defaultPropertyValues`, `primaryKey`\n */\n+ (instancetype)createOrUpdateModifiedInRealm:(RLMRealm *)realm withValue:(id)value;\n\n#pragma mark - Properties\n\n/**\n The Realm which manages the object, or `nil` if the object is unmanaged.\n */\n@property (nonatomic, readonly, nullable) RLMRealm *realm;\n\n/**\n The object schema which lists the managed properties for the object.\n */\n@property (nonatomic, readonly) RLMObjectSchema *objectSchema;\n\n/**\n Indicates if the object can no longer be accessed because it is now invalid.\n\n An object can no longer be accessed if the object has been deleted from the Realm that manages it, or\n if `invalidate` is called on that Realm.\n */\n@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated;\n\n/**\n Indicates if this object is frozen.\n\n @see `-[RLMObject freeze]`\n */\n@property (nonatomic, readonly, getter = isFrozen) BOOL frozen;\n\n\n#pragma mark - Customizing your Objects\n\n/**\n Returns an array of property names for properties which should be indexed.\n\n Only string, integer, boolean, and `NSDate` properties are supported.\n\n @return    An array of property names.\n */\n+ (NSArray<NSString *> *)indexedProperties;\n\n/**\n Override this method to specify the default values to be used for each property.\n\n @return    A dictionary mapping property names to their default values.\n */\n+ (nullable NSDictionary *)defaultPropertyValues;\n\n/**\n Override this method to specify the name of a property to be used as the primary key.\n\n Only properties of types `RLMPropertyTypeString` and `RLMPropertyTypeInt` can be designated as the primary key.\n Primary key properties enforce uniqueness for each value whenever the property is set, which incurs minor overhead.\n Indexes are created automatically for primary key properties.\n\n @return    The name of the property designated as the primary key.\n */\n+ (nullable NSString *)primaryKey;\n\n/**\n Override this method to specify the names of properties to ignore. These properties will not be managed by the Realm\n that manages the object.\n\n @return    An array of property names to ignore.\n */\n+ (nullable NSArray<NSString *> *)ignoredProperties;\n\n/**\n Override this method to specify the names of properties that are non-optional (i.e. cannot be assigned a `nil` value).\n\n By default, all properties of a type whose values can be set to `nil` are considered optional properties.\n To require that an object in a Realm always store a non-`nil` value for a property,\n add the name of the property to the array returned from this method.\n\n Properties of `RLMObject` type cannot be non-optional. Array and `NSNumber` properties\n can be non-optional, but there is no reason to do so: arrays do not support storing nil, and\n if you want a non-optional number you should instead use the primitive type.\n\n @return    An array of property names that are required.\n */\n+ (NSArray<NSString *> *)requiredProperties;\n\n/**\n Override this method to provide information related to properties containing linking objects.\n\n Each property of type `RLMLinkingObjects` must have a key in the dictionary returned by this method consisting\n of the property name. The corresponding value must be an instance of `RLMPropertyDescriptor` that describes the class\n and property that the property is linked to.\n\n     return @{ @\"owners\": [RLMPropertyDescriptor descriptorWithClass:Owner.class propertyName:@\"dogs\"] };\n\n @return     A dictionary mapping property names to `RLMPropertyDescriptor` instances.\n */\n+ (NSDictionary<NSString *, RLMPropertyDescriptor *> *)linkingObjectsProperties;\n\n#pragma mark - Getting & Querying Objects from the Default Realm\n\n/**\n Returns all objects of this object type from the default Realm.\n\n @return    An `RLMResults` containing all objects of this type in the default Realm.\n */\n+ (RLMResults *)allObjects;\n\n/**\n Returns all objects of this object type matching the given predicate from the default Realm.\n\n @param predicateFormat A predicate format string, optionally followed by a variable number of arguments.\n\n @return    An `RLMResults` containing all objects of this type in the default Realm that match the given predicate.\n */\n+ (RLMResults *)objectsWhere:(NSString *)predicateFormat, ...;\n\n/// :nodoc:\n+ (RLMResults<__kindof RLMObject *> *)objectsWhere:(NSString *)predicateFormat args:(va_list)args;\n\n\n/**\n Returns all objects of this object type matching the given predicate from the default Realm.\n\n @param predicate   The predicate with which to filter the objects.\n\n @return    An `RLMResults` containing all objects of this type in the default Realm that match the given predicate.\n */\n+ (RLMResults *)objectsWithPredicate:(nullable NSPredicate *)predicate;\n\n/**\n Retrieves the single instance of this object type with the given primary key from the default Realm.\n\n Returns the object from the default Realm which has the given primary key, or\n `nil` if the object does not exist. This is slightly faster than the otherwise\n equivalent `[[SubclassName objectsWhere:@\"primaryKeyPropertyName = %@\", key] firstObject]`.\n\n This method requires that `primaryKey` be overridden on the receiving subclass.\n\n @return    An object of this object type, or `nil` if an object with the given primary key does not exist.\n @see       `-primaryKey`\n */\n+ (nullable instancetype)objectForPrimaryKey:(nullable id)primaryKey NS_SWIFT_NAME(object(forPrimaryKey:));\n\n\n#pragma mark - Querying Specific Realms\n\n/**\n Returns all objects of this object type from the specified Realm.\n\n @param realm   The Realm to query.\n\n @return        An `RLMResults` containing all objects of this type in the specified Realm.\n */\n+ (RLMResults *)allObjectsInRealm:(RLMRealm *)realm;\n\n/**\n Returns all objects of this object type matching the given predicate from the specified Realm.\n\n @param predicateFormat A predicate format string, optionally followed by a variable number of arguments.\n @param realm           The Realm to query.\n\n @return    An `RLMResults` containing all objects of this type in the specified Realm that match the given predicate.\n */\n+ (RLMResults *)objectsInRealm:(RLMRealm *)realm where:(NSString *)predicateFormat, ...;\n\n/// :nodoc:\n+ (RLMResults<__kindof RLMObject *> *)objectsInRealm:(RLMRealm *)realm where:(NSString *)predicateFormat args:(va_list)args;\n\n/**\n Returns all objects of this object type matching the given predicate from the specified Realm.\n\n @param predicate   A predicate to use to filter the elements.\n @param realm       The Realm to query.\n\n @return    An `RLMResults` containing all objects of this type in the specified Realm that match the given predicate.\n */\n+ (RLMResults *)objectsInRealm:(RLMRealm *)realm withPredicate:(nullable NSPredicate *)predicate;\n\n/**\n Retrieves the single instance of this object type with the given primary key from the specified Realm.\n\n Returns the object from the specified Realm which has the given primary key, or\n `nil` if the object does not exist. This is slightly faster than the otherwise\n equivalent `[[SubclassName objectsInRealm:realm where:@\"primaryKeyPropertyName = %@\", key] firstObject]`.\n\n This method requires that `primaryKey` be overridden on the receiving subclass.\n\n @return    An object of this object type, or `nil` if an object with the given primary key does not exist.\n @see       `-primaryKey`\n */\n+ (nullable instancetype)objectInRealm:(RLMRealm *)realm forPrimaryKey:(nullable id)primaryKey NS_SWIFT_NAME(object(in:forPrimaryKey:));\n\n#pragma mark - Notifications\n\n/**\n A callback block for `RLMObject` notifications.\n\n If the object is deleted from the managing Realm, the block is called with\n `deleted` set to `YES` and the other two arguments are `nil`. The block will\n never be called again after this.\n\n If the object is modified, the block will be called with `deleted` set to\n `NO`, a `nil` error, and an array of `RLMPropertyChange` objects which\n indicate which properties of the objects were modified.\n\n `error` is always `nil` and will be removed in a future version.\n */\ntypedef void (^RLMObjectChangeBlock)(BOOL deleted,\n                                     NSArray<RLMPropertyChange *> *_Nullable changes,\n                                     NSError *_Nullable error);\n\n/**\n Registers a block to be called each time the object changes.\n\n The block will be asynchronously called after each write transaction which\n deletes the object or modifies any of the managed properties of the object,\n including self-assignments that set a property to its existing value.\n\n For write transactions performed on different threads or in different\n processes, the block will be called when the managing Realm is\n (auto)refreshed to a version including the changes, while for local write\n transactions it will be called at some point in the future after the write\n transaction is committed.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When notifications\n can't be delivered instantly, multiple notifications may be coalesced into a\n single notification.\n\n Unlike with `RLMArray` and `RLMResults`, there is no \"initial\" callback made\n after you add a new notification block.\n\n Only objects which are managed by a Realm can be observed in this way. You\n must retain the returned token for as long as you want updates to be sent to\n the block. To stop receiving updates, call `-invalidate` on the token.\n\n It is safe to capture a strong reference to the observed object within the\n callback block. There is no retain cycle due to that the callback is retained\n by the returned token and not by the object itself.\n\n @warning This method cannot be called during a write transaction, when the\n          containing Realm is read-only, or on an unmanaged object.\n\n @param block The block to be called whenever a change occurs.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block;\n\n/**\n Registers a block to be called each time the object changes.\n\n The block will be asynchronously called after each write transaction which\n deletes the object or modifies any of the managed properties of the object,\n including self-assignments that set a property to its existing value.\n\n For write transactions performed on different threads or in different\n processes, the block will be called when the managing Realm is\n (auto)refreshed to a version including the changes, while for local write\n transactions it will be called at some point in the future after the write\n transaction is committed.\n\n Notifications are delivered on the given queue. If the queue is blocked and\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification.\n\n Unlike with `RLMArray` and `RLMResults`, there is no \"initial\" callback made\n after you add a new notification block.\n\n Only objects which are managed by a Realm can be observed in this way. You\n must retain the returned token for as long as you want updates to be sent to\n the block. To stop receiving updates, call `-invalidate` on the token.\n\n It is safe to capture a strong reference to the observed object within the\n callback block. There is no retain cycle due to that the callback is retained\n by the returned token and not by the object itself.\n\n @warning This method cannot be called during a write transaction, when the\n          containing Realm is read-only, or on an unmanaged object.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param queue The serial queue to deliver notifications to.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block queue:(dispatch_queue_t)queue;\n\n/**\n Registers a block to be called each time the object changes.\n\n The block will be asynchronously called after each write transaction which\n deletes the object or modifies any of the managed properties of the object,\n including self-assignments that set a property to its existing value.\n\n For write transactions performed on different threads or in different\n processes, the block will be called when the managing Realm is\n (auto)refreshed to a version including the changes, while for local write\n transactions it will be called at some point in the future after the write\n transaction is committed.\n\n Notifications are delivered on the given queue. If the queue is blocked and\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification.\n\n Unlike with `RLMArray` and `RLMResults`, there is no \"initial\" callback made\n after you add a new notification block.\n\n Only objects which are managed by a Realm can be observed in this way. You\n must retain the returned token for as long as you want updates to be sent to\n the block. To stop receiving updates, call `-invalidate` on the token.\n\n It is safe to capture a strong reference to the observed object within the\n callback block. There is no retain cycle due to that the callback is retained\n by the returned token and not by the object itself.\n\n @warning This method cannot be called during a write transaction, when the\n          containing Realm is read-only, or on an unmanaged object.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param keyPaths The block will be called for changes occurring on these keypaths. If no\n key paths are given, notifications are delivered for every property key path.\n @param queue The serial queue to deliver notifications to.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block keyPaths:(NSArray<NSString *> *)keyPaths queue:(dispatch_queue_t)queue;\n\n/**\n Registers a block to be called each time the object changes.\n\n The block will be asynchronously called after each write transaction which\n deletes the object or modifies any of the managed properties of the object,\n including self-assignments that set a property to its existing value.\n\n For write transactions performed on different threads or in different\n processes, the block will be called when the managing Realm is\n (auto)refreshed to a version including the changes, while for local write\n transactions it will be called at some point in the future after the write\n transaction is committed.\n\n Notifications are delivered on the given queue. If the queue is blocked and\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification.\n\n Unlike with `RLMArray` and `RLMResults`, there is no \"initial\" callback made\n after you add a new notification block.\n\n Only objects which are managed by a Realm can be observed in this way. You\n must retain the returned token for as long as you want updates to be sent to\n the block. To stop receiving updates, call `-invalidate` on the token.\n\n It is safe to capture a strong reference to the observed object within the\n callback block. There is no retain cycle due to that the callback is retained\n by the returned token and not by the object itself.\n\n @warning This method cannot be called during a write transaction, when the\n          containing Realm is read-only, or on an unmanaged object.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param keyPaths The block will be called for changes occurring on these keypaths. If no\n key paths are given, notifications are delivered for every property key path.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block keyPaths:(NSArray<NSString *> *)keyPaths;\n\n\n#pragma mark - Other Instance Methods\n\n/**\n Returns YES if another Realm object instance points to the same object as the receiver in the Realm managing\n the receiver.\n\n For frozen objects and object types with a primary key, `isEqual:` is\n overridden to use the same logic as this method (along with a corresponding\n implementation for `hash`). Non-frozen objects without primary keys use\n pointer identity for `isEqual:` and `hash`.\n\n @param object  The object to compare the receiver to.\n\n @return    Whether the object represents the same object as the receiver.\n */\n- (BOOL)isEqualToObject:(RLMObject *)object;\n\n/**\n Returns a frozen (immutable) snapshot of this object.\n\n The frozen copy is an immutable object which contains the same data as this\n object currently contains, but will not update when writes are made to the\n containing Realm. Unlike live objects, frozen objects can be accessed from any\n thread.\n\n - warning: Holding onto a frozen object for an extended period while performing write\n transaction on the Realm may result in the Realm file growing to large sizes. See\n `Realm.Configuration.maximumNumberOfActiveVersions` for more information.\n - warning: This method can only be called on a managed object.\n */\n- (instancetype)freeze NS_RETURNS_RETAINED;\n\n/**\n Returns a live (mutable) reference of this object.\n\n This method creates a managed accessor to a live copy of the same frozen object.\n Will return self if called on an already live object.\n */\n- (instancetype)thaw;\n\n#pragma mark - Dynamic Accessors\n\n/// :nodoc:\n- (nullable id)objectForKeyedSubscript:(NSString *)key;\n\n/// :nodoc:\n- (void)setObject:(nullable id)obj forKeyedSubscript:(NSString *)key;\n\n@end\n\n/**\n Information about a specific property which changed in an `RLMObject` change notification.\n */\n@interface RLMPropertyChange : NSObject\n\n/**\n The name of the property which changed.\n */\n@property (nonatomic, readonly, strong) NSString *name;\n\n/**\n The value of the property before the change occurred. This will always be `nil`\n if the change happened on the same thread as the notification and for `RLMArray`\n properties.\n\n For object properties this will give the object which was previously linked to,\n but that object will have its new values and not the values it had before the\n changes. This means that `previousValue` may be a deleted object, and you will\n need to check `invalidated` before accessing any of its properties.\n */\n@property (nonatomic, readonly, strong, nullable) id previousValue;\n\n/**\n The value of the property after the change occurred. This will always be `nil`\n for `RLMArray` properties.\n */\n@property (nonatomic, readonly, strong, nullable) id value;\n@end\n\n#pragma mark - RLMArray Property Declaration\n\n/**\n Properties on `RLMObject`s of type `RLMArray` must have an associated type. A type is associated\n with an `RLMArray` property by defining a protocol for the object type that the array should contain.\n To define the protocol for an object, you can use the macro RLM_ARRAY_TYPE:\n\n     RLM_ARRAY_TYPE(ObjectType)\n     ...\n     @property RLMArray<ObjectType *><ObjectType> *arrayOfObjectTypes;\n  */\n#define RLM_ARRAY_TYPE(RLM_OBJECT_SUBCLASS)\\\n__attribute__((deprecated(\"RLM_ARRAY_TYPE has been deprecated. Use RLM_COLLECTION_TYPE instead.\"))) \\\n@protocol RLM_OBJECT_SUBCLASS <NSObject>  \\\n@end\n\n/**\n Properties on `RLMObject`s of type `RLMSet`  /  `RLMArray` must have an associated type. A type is associated\n with an `RLMSet`  /  `RLMArray` property by defining a protocol for the object type that the array should contain.\n To define the protocol for an object, you can use the macro RLM_COLLECTION_TYPE:\n\n     RLM_COLLECTION_TYPE(ObjectType)\n     ...\n     @property RLMSet<ObjectType *><ObjectType> *setOfObjectTypes;\n     @property RLMArray<ObjectType *><ObjectType> *arrayOfObjectTypes;\n  */\n#define RLM_COLLECTION_TYPE(RLM_OBJECT_SUBCLASS)\\\n@protocol RLM_OBJECT_SUBCLASS <NSObject>   \\\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMObject.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMObject_Private.hpp\"\n\n#import \"RLMAccessor.h\"\n#import \"RLMArray.h\"\n#import \"RLMCollection_Private.hpp\"\n#import \"RLMObjectBase_Private.h\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMObjectStore.h\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMQueryUtil.hpp\"\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMSchema_Private.h\"\n\n#import <realm/object-store/object.hpp>\n\n// We declare things in RLMObject which are actually implemented in RLMObjectBase\n// for documentation's sake, which leads to -Wunimplemented-method warnings.\n// Other alternatives to this would be to disable -Wunimplemented-method for this\n// file (but then we could miss legitimately missing things), or declaring the\n// inherited things in a category (but they currently aren't nicely grouped for\n// that).\n@implementation RLMObject\n\n// synthesized in RLMObjectBase\n@dynamic invalidated, realm, objectSchema;\n\n#pragma mark - Designated Initializers\n\n- (instancetype)init {\n    return [super init];\n}\n\n#pragma mark - Convenience Initializers\n\n- (instancetype)initWithValue:(id)value {\n    if (!(self = [self init])) {\n        return nil;\n    }\n    RLMInitializeWithValue(self, value, RLMSchema.partialPrivateSharedSchema);\n    return self;\n}\n\n#pragma mark - Class-based Object Creation\n\n+ (instancetype)createInDefaultRealmWithValue:(id)value {\n    return (RLMObject *)RLMCreateObjectInRealmWithValue([RLMRealm defaultRealm], [self className], value, RLMUpdatePolicyError);\n}\n\n+ (instancetype)createInRealm:(RLMRealm *)realm withValue:(id)value {\n    return (RLMObject *)RLMCreateObjectInRealmWithValue(realm, [self className], value, RLMUpdatePolicyError);\n}\n\n+ (instancetype)createOrUpdateInDefaultRealmWithValue:(id)value {\n    return [self createOrUpdateInRealm:[RLMRealm defaultRealm] withValue:value];\n}\n\n+ (instancetype)createOrUpdateModifiedInDefaultRealmWithValue:(id)value {\n    return [self createOrUpdateModifiedInRealm:[RLMRealm defaultRealm] withValue:value];\n}\n\n+ (instancetype)createOrUpdateInRealm:(RLMRealm *)realm withValue:(id)value {\n    RLMVerifyHasPrimaryKey(self);\n    return (RLMObject *)RLMCreateObjectInRealmWithValue(realm, [self className], value, RLMUpdatePolicyUpdateAll);\n}\n\n+ (instancetype)createOrUpdateModifiedInRealm:(RLMRealm *)realm withValue:(id)value {\n    RLMVerifyHasPrimaryKey(self);\n    return (RLMObject *)RLMCreateObjectInRealmWithValue(realm, [self className], value, RLMUpdatePolicyUpdateChanged);\n}\n\n#pragma mark - Subscripting\n\n- (id)objectForKeyedSubscript:(NSString *)key {\n    return RLMObjectBaseObjectForKeyedSubscript(self, key);\n}\n\n- (void)setObject:(id)obj forKeyedSubscript:(NSString *)key {\n    RLMObjectBaseSetObjectForKeyedSubscript(self, key, obj);\n}\n\n#pragma mark - Getting & Querying\n\n+ (RLMResults *)allObjects {\n    return RLMGetObjects(RLMRealm.defaultRealm, self.className, nil);\n}\n\n+ (RLMResults *)allObjectsInRealm:(__unsafe_unretained RLMRealm *const)realm {\n    return RLMGetObjects(realm, self.className, nil);\n}\n\n+ (RLMResults *)objectsWhere:(NSString *)predicateFormat, ... {\n    va_list args;\n    va_start(args, predicateFormat);\n    RLMResults *results = [self objectsWhere:predicateFormat args:args];\n    va_end(args);\n    return results;\n}\n\n+ (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args {\n    return [self objectsWithPredicate:[NSPredicate predicateWithFormat:predicateFormat arguments:args]];\n}\n\n+ (RLMResults *)objectsInRealm:(RLMRealm *)realm where:(NSString *)predicateFormat, ... {\n    va_list args;\n    va_start(args, predicateFormat);\n    RLMResults *results = [self objectsInRealm:realm where:predicateFormat args:args];\n    va_end(args);\n    return results;\n}\n\n+ (RLMResults *)objectsInRealm:(RLMRealm *)realm where:(NSString *)predicateFormat args:(va_list)args {\n    return [self objectsInRealm:realm withPredicate:[NSPredicate predicateWithFormat:predicateFormat arguments:args]];\n}\n\n+ (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate {\n    return RLMGetObjects(RLMRealm.defaultRealm, self.className, predicate);\n}\n\n+ (RLMResults *)objectsInRealm:(RLMRealm *)realm withPredicate:(NSPredicate *)predicate {\n    return RLMGetObjects(realm, self.className, predicate);\n}\n\n+ (instancetype)objectForPrimaryKey:(id)primaryKey {\n    return RLMGetObject(RLMRealm.defaultRealm, self.className, primaryKey);\n}\n\n+ (instancetype)objectInRealm:(RLMRealm *)realm forPrimaryKey:(id)primaryKey {\n    return RLMGetObject(realm, self.className, primaryKey);\n}\n\n#pragma mark - Other Instance Methods\n\n- (BOOL)isEqualToObject:(RLMObject *)object {\n    return [object isKindOfClass:RLMObject.class] && RLMObjectBaseAreEqual(self, object);\n}\n\n- (instancetype)freeze {\n    return RLMObjectFreeze(self);\n}\n\n- (instancetype)thaw {\n    return RLMObjectThaw(self);\n}\n\n- (BOOL)isFrozen {\n    return _realm.isFrozen;\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block {\n    return RLMObjectAddNotificationBlock(self, block, nil, nil);\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block\n                                         queue:(nonnull dispatch_queue_t)queue {\n    return RLMObjectAddNotificationBlock(self, block, nil, queue);\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block\n                                      keyPaths:(NSArray<NSString *> *)keyPaths {\n    return RLMObjectAddNotificationBlock(self, block, keyPaths, nil);\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block\n                                      keyPaths:(NSArray<NSString *> *)keyPaths\n                                         queue:(dispatch_queue_t)queue {\n    return RLMObjectAddNotificationBlock(self, block, keyPaths, queue);\n\n}\n\n+ (NSString *)className {\n    return [super className];\n}\n\n#pragma mark - Default values for schema definition\n\n+ (NSArray *)indexedProperties {\n    return @[];\n}\n\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{};\n}\n\n+ (NSDictionary *)defaultPropertyValues {\n    return nil;\n}\n\n+ (NSString *)primaryKey {\n    return nil;\n}\n\n+ (NSArray *)ignoredProperties {\n    return nil;\n}\n\n+ (NSArray *)requiredProperties {\n    return @[];\n}\n\n+ (bool)_realmIgnoreClass {\n    return false;\n}\n\n@end\n\n@implementation RLMDynamicObject\n\n+ (bool)_realmIgnoreClass {\n    return true;\n}\n\n+ (BOOL)shouldIncludeInDefaultSchema {\n    return NO;\n}\n\n- (id)valueForUndefinedKey:(NSString *)key {\n    return RLMDynamicGetByName(self, key);\n}\n\n- (void)setValue:(id)value forUndefinedKey:(NSString *)key {\n    RLMDynamicValidatedSet(self, key, value);\n}\n\n+ (RLMObjectSchema *)sharedSchema {\n    return nil;\n}\n\n@end\n\nBOOL RLMIsObjectOrSubclass(Class klass) {\n    return RLMIsKindOfClass(klass, RLMObjectBase.class);\n}\n\nBOOL RLMIsObjectSubclass(Class klass) {\n    return RLMIsKindOfClass(class_getSuperclass(class_getSuperclass(klass)), RLMObjectBase.class);\n}\n"
  },
  {
    "path": "Realm/RLMObjectBase.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n/// :nodoc:\n@interface RLMObjectBase : NSObject\n\n@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated;\n\n- (instancetype)init NS_DESIGNATED_INITIALIZER;\n\n+ (NSString *)className;\n\n// Returns whether the class is included in the default set of classes managed by a Realm.\n+ (BOOL)shouldIncludeInDefaultSchema;\n\n+ (nullable NSString *)_realmObjectName;\n+ (nullable NSDictionary<NSString *, NSString *> *)_realmColumnNames;\n\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMObjectBase.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMObject_Private.hpp\"\n#import \"RLMObjectBase_Private.h\"\n\n#import \"RLMAccessor.h\"\n#import \"RLMArray_Private.hpp\"\n#import \"RLMDecimal128.h\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMObjectStore.h\"\n#import \"RLMObservation.hpp\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMSchema_Private.h\"\n#import \"RLMSet_Private.hpp\"\n#import \"RLMSwiftCollectionBase.h\"\n#import \"RLMSwiftSupport.h\"\n#import \"RLMThreadSafeReference_Private.hpp\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/object-store/object.hpp>\n#import <realm/object-store/object_schema.hpp>\n#import <realm/object-store/shared_realm.hpp>\n\nconst NSUInteger RLMDescriptionMaxDepth = 5;\n\nstatic bool isManagedAccessorClass(Class cls) {\n    const char *className = class_getName(cls);\n    const char accessorClassPrefix[] = \"RLM:Managed\";\n    return strncmp(className, accessorClassPrefix, sizeof(accessorClassPrefix) - 1) == 0;\n}\n\nstatic void maybeInitObjectSchemaForUnmanaged(RLMObjectBase *obj) {\n    Class cls = obj.class;\n    if (isManagedAccessorClass(cls)) {\n        return;\n    }\n\n    obj->_objectSchema = [cls sharedSchema];\n    if (!obj->_objectSchema) {\n        return;\n    }\n\n    // set default values\n    if (!obj->_objectSchema.isSwiftClass) {\n        NSDictionary *dict = RLMDefaultValuesForObjectSchema(obj->_objectSchema);\n        for (NSString *key in dict) {\n            [obj setValue:dict[key] forKey:key];\n        }\n    }\n\n    // set unmanaged accessor class\n    object_setClass(obj, obj->_objectSchema.unmanagedClass);\n}\n\n@interface RLMObjectBase () <RLMThreadConfined, RLMThreadConfined_Private>\n@end\n\n@implementation RLMObjectBase\n\n- (instancetype)init {\n    if ((self = [super init])) {\n        maybeInitObjectSchemaForUnmanaged(self);\n    }\n    return self;\n}\n\n- (void)dealloc {\n    // This can't be a unique_ptr because associated objects are removed\n    // *after* c++ members are destroyed and dealloc is called, and we need it\n    // to be in a validish state when that happens\n    delete _observationInfo;\n    _observationInfo = nullptr;\n}\n\nstatic id coerceToObjectType(id obj, Class cls, RLMSchema *schema) {\n    if ([obj isKindOfClass:cls]) {\n        return obj;\n    }\n    obj = RLMBridgeSwiftValue(obj) ?: obj;\n    id value = [[cls alloc] init];\n    RLMInitializeWithValue(value, obj, schema);\n    return value;\n}\n\nstatic id validatedObjectForProperty(__unsafe_unretained id const obj,\n                                     __unsafe_unretained RLMObjectSchema *const objectSchema,\n                                     __unsafe_unretained RLMProperty *const prop,\n                                     __unsafe_unretained RLMSchema *const schema) {\n    RLMValidateValueForProperty(obj, objectSchema, prop);\n    if (!obj || obj == NSNull.null) {\n        return nil;\n    }\n    if (prop.type == RLMPropertyTypeObject) {\n        Class objectClass = schema[prop.objectClassName].objectClass;\n        id enumerable = RLMAsFastEnumeration(obj);\n        if (prop.dictionary) {\n            NSMutableDictionary *ret = [[NSMutableDictionary alloc] init];\n            for (id key in enumerable) {\n                id val = RLMCoerceToNil(obj[key]);\n                if (val) {\n                    val = coerceToObjectType(obj[key], objectClass, schema);\n                }\n                [ret setObject:val ?: NSNull.null forKey:key];\n            }\n            return ret;\n        }\n        else if (prop.collection) {\n            NSMutableArray *ret = [[NSMutableArray alloc] init];\n            for (id el in enumerable) {\n                [ret addObject:coerceToObjectType(el, objectClass, schema)];\n            }\n            return ret;\n        }\n        return coerceToObjectType(obj, objectClass, schema);\n    }\n    else if (prop.type == RLMPropertyTypeDecimal128 && !prop.collection) {\n        return [[RLMDecimal128 alloc] initWithValue:obj];\n    }\n    return obj;\n}\n\nvoid RLMInitializeWithValue(RLMObjectBase *self, id value, RLMSchema *schema) {\n    if (!value || value == NSNull.null) {\n        @throw RLMException(@\"Must provide a non-nil value.\");\n    }\n\n    RLMObjectSchema *objectSchema = self->_objectSchema;\n    if (!objectSchema) {\n        // Will be nil if we're called during schema init, when we don't want\n        // to actually populate the object anyway\n        return;\n    }\n\n    NSArray *properties = objectSchema.properties;\n    if (NSArray *array = RLMDynamicCast<NSArray>(value)) {\n        if (array.count > properties.count) {\n            @throw RLMException(@\"Invalid array input: more values (%llu) than properties (%llu).\",\n                                (unsigned long long)array.count, (unsigned long long)properties.count);\n        }\n        NSUInteger i = 0;\n        for (id val in array) {\n            RLMProperty *prop = properties[i++];\n            [self setValue:validatedObjectForProperty(RLMCoerceToNil(val), objectSchema, prop, schema)\n                    forKey:prop.name];\n        }\n    }\n    else {\n        // assume our object is an NSDictionary or an object with kvc properties\n        for (RLMProperty *prop in properties) {\n            id obj = RLMValidatedValueForProperty(value, prop.name, objectSchema.className);\n\n            // don't set unspecified properties\n            if (!obj) {\n                continue;\n            }\n\n            [self setValue:validatedObjectForProperty(RLMCoerceToNil(obj), objectSchema, prop, schema)\n                    forKey:prop.name];\n        }\n    }\n}\n\nid RLMCreateManagedAccessor(Class cls, RLMClassInfo *info) {\n    RLMObjectBase *obj = [[cls alloc] init];\n    obj->_info = info;\n    obj->_realm = info->realm;\n    obj->_objectSchema = info->rlmObjectSchema;\n    return obj;\n}\n\n- (id)valueForKey:(NSString *)key {\n    if (_observationInfo) {\n        return _observationInfo->valueForKey(key);\n    }\n    return [super valueForKey:key];\n}\n\n// Generic Swift properties can't be dynamic, so KVO doesn't work for them by default\n- (id)valueForUndefinedKey:(NSString *)key {\n    RLMProperty *prop = _objectSchema[key];\n    if (Class swiftAccessor = prop.swiftAccessor) {\n        return RLMCoerceToNil([swiftAccessor get:prop on:self]);\n    }\n    return [super valueForUndefinedKey:key];\n}\n\n- (void)setValue:(id)value forUndefinedKey:(NSString *)key {\n    value = RLMCoerceToNil(value);\n    RLMProperty *property = _objectSchema[key];\n    if (property.collection) {\n        if (id enumerable = RLMAsFastEnumeration(value)) {\n            value = validatedObjectForProperty(value, _objectSchema, property,\n                                               RLMSchema.partialPrivateSharedSchema);\n        }\n    }\n    if (auto swiftAccessor = property.swiftAccessor) {\n        [swiftAccessor set:property on:self to:value];\n    }\n    else {\n        [super setValue:value forUndefinedKey:key];\n    }\n}\n\n// overridden at runtime per-class for performance\n+ (NSString *)className {\n    NSString *className = NSStringFromClass(self);\n    if ([RLMSwiftSupport isSwiftClassName:className]) {\n        className = [RLMSwiftSupport demangleClassName:className];\n    }\n    return className;\n}\n\n// overridden at runtime per-class for performance\n+ (RLMObjectSchema *)sharedSchema {\n    return [RLMSchema sharedSchemaForClass:self.class];\n}\n\n+ (void)initializeLinkedObjectSchemas {\n    for (RLMProperty *prop in self.sharedSchema.properties) {\n        if (prop.type == RLMPropertyTypeObject && !RLMSchema.partialPrivateSharedSchema[prop.objectClassName]) {\n            [[RLMSchema classForString:prop.objectClassName] initializeLinkedObjectSchemas];\n        }\n    }\n}\n\n+ (nullable NSArray<RLMProperty *> *)_getProperties {\n    return nil;\n}\n\n- (NSString *)description {\n    if (self.isInvalidated) {\n        return @\"[invalid object]\";\n    }\n\n    return [self descriptionWithMaxDepth:RLMDescriptionMaxDepth];\n}\n\n- (NSString *)descriptionWithMaxDepth:(NSUInteger)depth {\n    if (depth == 0) {\n        return @\"<Maximum depth exceeded>\";\n    }\n\n    NSString *baseClassName = _objectSchema.className;\n    NSMutableString *mString = [NSMutableString stringWithFormat:@\"%@ {\\n\", baseClassName];\n\n    for (RLMProperty *property in _objectSchema.properties) {\n        id object = [(id)self objectForKeyedSubscript:property.name];\n        NSString *sub;\n        if ([object respondsToSelector:@selector(descriptionWithMaxDepth:)]) {\n            sub = [object descriptionWithMaxDepth:depth - 1];\n        }\n        else if (property.type == RLMPropertyTypeData) {\n            static NSUInteger maxPrintedDataLength = 24;\n            NSData *data = object;\n            NSUInteger length = data.length;\n            if (length > maxPrintedDataLength) {\n                data = [NSData dataWithBytes:data.bytes length:maxPrintedDataLength];\n            }\n            NSString *dataDescription = [data description];\n            sub = [NSString stringWithFormat:@\"<%@ — %lu total bytes>\", [dataDescription substringWithRange:NSMakeRange(1, dataDescription.length - 2)], (unsigned long)length];\n        }\n        else {\n            sub = [object description];\n        }\n        [mString appendFormat:@\"\\t%@ = %@;\\n\", property.name, [sub stringByReplacingOccurrencesOfString:@\"\\n\" withString:@\"\\n\\t\"]];\n    }\n    [mString appendString:@\"}\"];\n\n    return [NSString stringWithString:mString];\n}\n\n- (RLMRealm *)realm {\n    return _realm;\n}\n\n- (RLMObjectSchema *)objectSchema {\n    return _objectSchema;\n}\n\n- (BOOL)isInvalidated {\n    // if not unmanaged and our accessor has been detached, we have been deleted\n    return _info && !_row.is_valid();\n}\n\n- (BOOL)isEqual:(id)object {\n    if (RLMObjectBase *other = RLMDynamicCast<RLMObjectBase>(object)) {\n        if (_objectSchema.primaryKeyProperty || _realm.isFrozen) {\n            return RLMObjectBaseAreEqual(self, other);\n        }\n    }\n    return [super isEqual:object];\n}\n\n- (NSUInteger)hash {\n    if (_objectSchema.primaryKeyProperty) {\n        // If we have a primary key property, that's an immutable value which we\n        // can use as the identity of the object.\n        id primaryProperty = [self valueForKey:_objectSchema.primaryKeyProperty.name];\n\n        // modify the hash of our primary key value to avoid potential (although unlikely) collisions\n        return [primaryProperty hash] ^ 1;\n    }\n    else if (_realm.isFrozen) {\n        // The object key can never change for frozen objects, so that's usable\n        // for objects without primary keys\n        return static_cast<NSUInteger>(_row.get_key().value);\n    }\n    else {\n        // Non-frozen objects without primary keys don't have any immutable\n        // concept of identity that we can hash so we have to fall back to\n        // pointer equality\n        return [super hash];\n    }\n}\n\n+ (BOOL)shouldIncludeInDefaultSchema {\n    return RLMIsObjectSubclass(self);\n}\n\n+ (NSString *)primaryKey {\n    return nil;\n}\n\n+ (NSString *)_realmObjectName {\n    return nil;\n}\n\n+ (NSDictionary *)_realmColumnNames {\n    return nil;\n}\n\n+ (bool)_realmIgnoreClass {\n    return false;\n}\n\n+ (bool)isEmbedded {\n    return false;\n}\n\n+ (bool)isAsymmetric {\n    return false;\n}\n\n// This enables to override the propertiesMapping in Swift, it is not to be used in Objective-C API.\n+ (NSDictionary *)propertiesMapping {\n    return @{};\n}\n\n- (id)mutableArrayValueForKey:(NSString *)key {\n    id obj = [self valueForKey:key];\n    if ([obj isKindOfClass:[RLMArray class]]) {\n        return obj;\n    }\n    return [super mutableArrayValueForKey:key];\n}\n\n- (id)mutableSetValueForKey:(NSString *)key {\n    id obj = [self valueForKey:key];\n    if ([obj isKindOfClass:[RLMSet class]]) {\n        return obj;\n    }\n    return [super mutableSetValueForKey:key];\n}\n\n- (void)addObserver:(id)observer\n         forKeyPath:(NSString *)keyPath\n            options:(NSKeyValueObservingOptions)options\n            context:(void *)context {\n    if (!_observationInfo) {\n        _observationInfo = new RLMObservationInfo(self);\n    }\n    _observationInfo->recordObserver(_row, _info, _objectSchema, keyPath);\n\n    [super addObserver:observer forKeyPath:keyPath options:options context:context];\n}\n\n- (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath {\n    [super removeObserver:observer forKeyPath:keyPath];\n    if (_observationInfo)\n        _observationInfo->removeObserver();\n}\n\n+ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key {\n    RLMProperty *prop = [self.class sharedSchema][key];\n    if (isManagedAccessorClass(self)) {\n        // Managed accessors explicitly call willChange/didChange for managed\n        // properties, so we don't want KVO to override the setters to do that\n        return !prop;\n    }\n    if (prop.swiftAccessor) {\n        // Properties with swift accessors don't have obj-c getters/setters and\n        // will explode if KVO tries to override them\n        return NO;\n    }\n\n    return [super automaticallyNotifiesObserversForKey:key];\n}\n\n+ (void)observe:(RLMObjectBase *)object\n       keyPaths:(nullable NSArray<NSString *> *)keyPaths\n          block:(RLMObjectNotificationCallback)block\n     completion:(void (^)(RLMNotificationToken *))completion {\n}\n\n#pragma mark - Thread Confined Protocol Conformance\n\n- (realm::ThreadSafeReference)makeThreadSafeReference {\n    return realm::Object(_realm->_realm, *_info->objectSchema, _row);\n}\n\n- (id)objectiveCMetadata {\n    return nil;\n}\n\n+ (instancetype)objectWithThreadSafeReference:(realm::ThreadSafeReference)reference\n                                     metadata:(__unused id)metadata\n                                        realm:(RLMRealm *)realm {\n    auto object = reference.resolve<realm::Object>(realm->_realm);\n    if (!object.is_valid()) {\n        return nil;\n    }\n    NSString *objectClassName = @(object.get_object_schema().name.c_str());\n    return RLMCreateObjectAccessor(realm->_info[objectClassName], object.get_obj());\n}\n\n@end\n\nRLMRealm *RLMObjectBaseRealm(__unsafe_unretained RLMObjectBase *object) {\n    return object ? object->_realm : nil;\n}\n\nRLMObjectSchema *RLMObjectBaseObjectSchema(__unsafe_unretained RLMObjectBase *object) {\n    return object ? object->_objectSchema : nil;\n}\n\nid RLMObjectBaseObjectForKeyedSubscript(RLMObjectBase *object, NSString *key) {\n    if (!object) {\n        return nil;\n    }\n\n    if (object->_realm) {\n        return RLMDynamicGetByName(object, key);\n    }\n    else {\n        return [object valueForKey:key];\n    }\n}\n\nvoid RLMObjectBaseSetObjectForKeyedSubscript(RLMObjectBase *object, NSString *key, id obj) {\n    if (!object) {\n        return;\n    }\n\n    if (object->_realm || object.class == object->_objectSchema.accessorClass) {\n        RLMDynamicValidatedSet(object, key, obj);\n    }\n    else {\n        [object setValue:obj forKey:key];\n    }\n}\n\n\nBOOL RLMObjectBaseAreEqual(RLMObjectBase *o1, RLMObjectBase *o2) {\n    // if not the correct types throw\n    if ((o1 && ![o1 isKindOfClass:RLMObjectBase.class]) || (o2 && ![o2 isKindOfClass:RLMObjectBase.class])) {\n        @throw RLMException(@\"Can only compare objects of class RLMObjectBase\");\n    }\n    // if identical object (or both are nil)\n    if (o1 == o2) {\n        return YES;\n    }\n    // if one is nil\n    if (o1 == nil || o2 == nil) {\n        return NO;\n    }\n    // if not in realm or differing realms\n    if (o1->_realm == nil || o1->_realm != o2->_realm) {\n        return NO;\n    }\n    // if either are detached\n    if (!o1->_row.is_valid() || !o2->_row.is_valid()) {\n        return NO;\n    }\n    // if table and index are the same\n    return o1->_row.get_table() == o2->_row.get_table()\n        && o1->_row.get_key() == o2->_row.get_key();\n}\n\nstatic id resolveObject(RLMObjectBase *obj, RLMRealm *realm) {\n    RLMObjectBase *resolved = RLMCreateManagedAccessor(obj.class, &realm->_info[obj->_info->rlmObjectSchema.className]);\n    resolved->_row = realm->_realm->import_copy_of(obj->_row);\n    if (!resolved->_row.is_valid()) {\n        return nil;\n    }\n    RLMInitializeSwiftAccessor(resolved, false);\n    return resolved;\n}\n\nid RLMObjectFreeze(RLMObjectBase *obj) {\n    if (!obj->_realm && !obj.isInvalidated) {\n        @throw RLMException(@\"Unmanaged objects cannot be frozen.\");\n    }\n    RLMVerifyAttached(obj);\n    if (obj->_realm.frozen) {\n        return obj;\n    }\n    obj = resolveObject(obj, obj->_realm.freeze);\n    if (!obj) {\n        @throw RLMException(@\"Cannot freeze an object in the same write transaction as it was created in.\");\n    }\n    return obj;\n}\n\nid RLMObjectThaw(RLMObjectBase *obj) {\n    if (!obj->_realm && !obj.isInvalidated) {\n        @throw RLMException(@\"Unmanaged objects cannot be frozen.\");\n    }\n    RLMVerifyAttached(obj);\n    if (!obj->_realm.frozen) {\n        return obj;\n    }\n    return resolveObject(obj, obj->_realm.thaw);\n}\n\nid RLMValidatedValueForProperty(id object, NSString *key, NSString *className) {\n    @try {\n        return [object valueForKey:key];\n    }\n    @catch (NSException *e) {\n        if ([e.name isEqualToString:NSUndefinedKeyException]) {\n            @throw RLMException(@\"Invalid value '%@' to initialize object of type '%@': missing key '%@'\",\n                                object, className, key);\n        }\n        @throw;\n    }\n}\n\n#pragma mark - Notifications\n\nnamespace {\nstruct ObjectChangeCallbackWrapper {\n    RLMObjectNotificationCallback block;\n    RLMObjectBase *object;\n    void (^registrationCompletion)();\n\n    NSArray<NSString *> *propertyNames = nil;\n    NSArray *oldValues = nil;\n    bool deleted = false;\n\n    void populateProperties(realm::CollectionChangeSet const& c) {\n        if (propertyNames) {\n            return;\n        }\n        if (!c.deletions.empty()) {\n            deleted = true;\n            return;\n        }\n        if (c.columns.empty()) {\n            return;\n        }\n\n        // FIXME: It's possible for the column key of a persisted property\n        // to equal the column key of a computed property.\n        auto properties = [NSMutableArray new];\n        for (RLMProperty *property in object->_info->rlmObjectSchema.properties) {\n            auto columnKey = object->_info->tableColumn(property).value;\n            if (c.columns.count(columnKey)) {\n                [properties addObject:property.name];\n            }\n        }\n        for (RLMProperty *property in object->_info->rlmObjectSchema.computedProperties) {\n            auto columnKey = object->_info->computedTableColumn(property).value;\n            if (c.columns.count(columnKey)) {\n                [properties addObject:property.name];\n            }\n        }\n        if (properties.count) {\n            propertyNames = properties;\n        }\n    }\n\n    NSArray *readValues(realm::CollectionChangeSet const& c) {\n        if (c.empty()) {\n            return nil;\n        }\n        populateProperties(c);\n        if (!propertyNames) {\n            return nil;\n        }\n\n        auto values = [NSMutableArray arrayWithCapacity:propertyNames.count];\n        for (NSString *name in propertyNames) {\n            id value = [object valueForKey:name];\n            if (!value || [value isKindOfClass:[RLMArray class]]) {\n                [values addObject:NSNull.null];\n            }\n            else {\n                [values addObject:value];\n            }\n        }\n        return values;\n    }\n\n    void before(realm::CollectionChangeSet const& c) {\n        @autoreleasepool {\n            oldValues = readValues(c);\n        }\n    }\n\n    void after(realm::CollectionChangeSet const& c) {\n        @autoreleasepool {\n            if (registrationCompletion) {\n                registrationCompletion();\n                registrationCompletion = nil;\n            }\n            auto newValues = readValues(c);\n            if (deleted) {\n                block(nil, nil, nil, nil, nil);\n            }\n            else if (newValues) {\n                block(object, propertyNames, oldValues, newValues, nil);\n            }\n            propertyNames = nil;\n            oldValues = nil;\n        }\n    }\n};\n} // anonymous namespace\n\n@interface RLMPropertyChange ()\n@property (nonatomic, readwrite, strong) NSString *name;\n@property (nonatomic, readwrite, strong, nullable) id previousValue;\n@property (nonatomic, readwrite, strong, nullable) id value;\n@end\n\n@implementation RLMPropertyChange\n- (NSString *)description {\n    return [NSString stringWithFormat:@\"<RLMPropertyChange: %p> %@ %@ -> %@\",\n            (__bridge void *)self, _name, _previousValue, _value];\n}\n@end\n\nenum class TokenState {\n    Initializing,\n    Cancelled,\n    Ready\n};\n\nRLM_DIRECT_MEMBERS\n@implementation RLMObjectNotificationToken {\n    RLMUnfairMutex _mutex;\n    __unsafe_unretained RLMRealm *_realm;\n    realm::Object _object;\n    realm::NotificationToken _token;\n    void (^_completion)(void);\n    TokenState _state;\n}\n\n- (RLMRealm *)realm {\n    std::lock_guard lock(_mutex);\n    return _realm;\n}\n\n- (void)suppressNextNotification {\n    std::lock_guard lock(_mutex);\n    if (_object.is_valid()) {\n        _token.suppress_next();\n    }\n}\n\n- (bool)invalidate {\n    dispatch_block_t completion;\n    {\n        std::lock_guard lock(_mutex);\n        if (_state == TokenState::Cancelled) {\n            REALM_ASSERT(!_completion);\n            return false;\n        }\n        _realm = nil;\n        _token = {};\n        _object = {};\n        _state = TokenState::Cancelled;\n        std::swap(completion, _completion);\n    }\n    if (completion) {\n        completion();\n    }\n    return true;\n}\n\n- (void)addNotificationBlock:(RLMObjectNotificationCallback)block\n         threadSafeReference:(RLMThreadSafeReference *)tsr\n                      config:(RLMRealmConfiguration *)config\n                    keyPaths:(NSArray *)keyPaths\n                       queue:(dispatch_queue_t)queue {\n    std::lock_guard lock(_mutex);\n    if (_state != TokenState::Initializing) {\n        // Token was invalidated before we got this far\n        return;\n    }\n\n    NSError *error;\n    auto realm = [RLMRealm realmWithConfiguration:config queue:queue error:&error];\n    _realm = realm;\n    if (!realm) {\n        block(nil, nil, nil, nil, error);\n        return;\n    }\n    RLMObjectBase *obj = [realm resolveThreadSafeReference:tsr];\n\n    _object = realm::Object(realm->_realm, *obj->_info->objectSchema, obj->_row);\n    _token = _object.add_notification_callback(ObjectChangeCallbackWrapper{block, obj},\n                                               obj->_info->keyPathArrayFromStringArray(keyPaths));\n}\n\n- (void)observe:(RLMObjectBase *)obj\n       keyPaths:(NSArray *)keyPaths\n          block:(RLMObjectNotificationCallback)block {\n    std::lock_guard lock(_mutex);\n    if (_state != TokenState::Initializing) {\n        return;\n    }\n    _object = realm::Object(obj->_realm->_realm, *obj->_info->objectSchema, obj->_row);\n    _realm = obj->_realm;\n\n    auto completion = [self] {\n        dispatch_block_t completion;\n        {\n            std::lock_guard lock(_mutex);\n            if (_state == TokenState::Initializing) {\n                _state = TokenState::Ready;\n            }\n            std::swap(completion, _completion);\n        }\n        if (completion) {\n            completion();\n        }\n    };\n    try {\n        _token = _object.add_notification_callback(ObjectChangeCallbackWrapper{block, obj, completion},\n                                                   obj->_info->keyPathArrayFromStringArray(keyPaths));\n    }\n    catch (const realm::Exception& e) {\n        @throw RLMException(e);\n    }\n}\n\n- (void)registrationComplete:(void (^)())completion {\n    {\n        std::lock_guard lock(_mutex);\n        if (_state == TokenState::Initializing) {\n            _completion = completion;\n            return;\n        }\n    }\n    completion();\n}\n\nRLMNotificationToken *RLMObjectBaseAddNotificationBlock(RLMObjectBase *obj,\n                                                        NSArray<NSString *> *keyPaths,\n                                                        dispatch_queue_t queue,\n                                                        RLMObjectNotificationCallback block) {\n    if (!obj->_realm) {\n        @throw RLMException(@\"Only objects which are managed by a Realm support change notifications\");\n    }\n\n    if (!queue) {\n        [obj->_realm verifyNotificationsAreSupported:true];\n        auto token = [[RLMObjectNotificationToken alloc] init];\n        [token observe:obj keyPaths:keyPaths block:block];\n        return token;\n    }\n\n    RLMThreadSafeReference *tsr = [RLMThreadSafeReference referenceWithThreadConfined:(id)obj];\n    auto token = [[RLMObjectNotificationToken alloc] init];\n    token->_realm = obj->_realm;\n    RLMRealmConfiguration *config = obj->_realm.configurationSharingSchema;\n    dispatch_async(queue, ^{\n        @autoreleasepool {\n            [token addNotificationBlock:block threadSafeReference:tsr config:config keyPaths:keyPaths queue:queue];\n        }\n    });\n    return token;\n}\n@end\n\nRLMNotificationToken *RLMObjectAddNotificationBlock(RLMObjectBase *obj, RLMObjectChangeBlock block, NSArray<NSString *> *keyPaths, dispatch_queue_t queue) {\n    return RLMObjectBaseAddNotificationBlock(obj, keyPaths, queue, ^(RLMObjectBase *, NSArray<NSString *> *propertyNames,\n                                                           NSArray *oldValues, NSArray *newValues, NSError *error) {\n        if (error) {\n            block(false, nil, error);\n        }\n        else if (!propertyNames) {\n            block(true, nil, nil);\n        }\n        else {\n            auto properties = [NSMutableArray arrayWithCapacity:propertyNames.count];\n            for (NSUInteger i = 0, count = propertyNames.count; i < count; ++i) {\n                auto prop = [RLMPropertyChange new];\n                prop.name = propertyNames[i];\n                prop.previousValue = RLMCoerceToNil(oldValues[i]);\n                prop.value = RLMCoerceToNil(newValues[i]);\n                [properties addObject:prop];\n            }\n            block(false, properties, nil);\n        }\n    });\n}\n\nuint64_t RLMObjectBaseGetCombineId(__unsafe_unretained RLMObjectBase *const obj) {\n    if (obj.invalidated) {\n        RLMVerifyAttached(obj);\n    }\n    if (obj->_realm) {\n        return obj->_row.get_key().value;\n    }\n    return reinterpret_cast<uint64_t>((__bridge void *)obj);\n}\n\n@implementation RealmSwiftObject\n+ (BOOL)accessInstanceVariablesDirectly {\n    // By default KVO will try to directly read ivars if a thing with a matching\n    // name is observed and there's no objc property with that name. This\n    // crashes when it tries to read a property wrapper ivar, and is never\n    // useful for Swift classes.\n    return NO;\n}\n@end\n\n@implementation RealmSwiftEmbeddedObject\n+ (BOOL)accessInstanceVariablesDirectly {\n    return NO;\n}\n@end\n\n@implementation RealmSwiftAsymmetricObject\n+ (BOOL)accessInstanceVariablesDirectly {\n    return NO;\n}\n\n+ (bool)isAsymmetric {\n    return YES;\n}\n@end\n"
  },
  {
    "path": "Realm/RLMObjectBase_Dynamic.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMObject.h>\n\n@class RLMObjectSchema, RLMRealm;\n\nRLM_HEADER_AUDIT_BEGIN(nullability)\n\n/**\n Returns the Realm that manages the object, if one exists.\n\n @warning  This function is useful only in specialized circumstances, for example, when building components\n           that integrate with Realm. If you are simply building an app on Realm, it is\n           recommended to retrieve the Realm that manages the object via `RLMObject`.\n\n @param object\tAn `RLMObjectBase` obtained via a Swift `Object` or `RLMObject`.\n\n @return The Realm which manages this object. Returns `nil `for unmanaged objects.\n */\nFOUNDATION_EXTERN RLMRealm * _Nullable RLMObjectBaseRealm(RLMObjectBase * _Nullable object);\n\n/**\n Returns an `RLMObjectSchema` which describes the managed properties of the object.\n\n @warning  This function is useful only in specialized circumstances, for example, when building components\n           that integrate with Realm. If you are simply building an app on Realm, it is\n           recommended to retrieve `objectSchema` via `RLMObject`.\n\n @param object\tAn `RLMObjectBase` obtained via a Swift `Object` or `RLMObject`.\n\n @return The object schema which lists the managed properties for the object.\n */\nFOUNDATION_EXTERN RLMObjectSchema * _Nullable RLMObjectBaseObjectSchema(RLMObjectBase * _Nullable object);\n\n/**\n Returns the object corresponding to a key value.\n\n @warning  This function is useful only in specialized circumstances, for example, when building components\n           that integrate with Realm. If you are simply building an app on Realm, it is\n           recommended to retrieve key values via `RLMObject`.\n\n @warning Will throw an `NSUndefinedKeyException` if `key` is not present on the object.\n\n @param object\tAn `RLMObjectBase` obtained via a Swift `Object` or `RLMObject`.\n @param key\t\tThe name of the property.\n\n @return The object for the property requested.\n */\nFOUNDATION_EXTERN id _Nullable RLMObjectBaseObjectForKeyedSubscript(RLMObjectBase * _Nullable object, NSString *key);\n\n/**\n Sets a value for a key on the object.\n\n @warning  This function is useful only in specialized circumstances, for example, when building components\n           that integrate with Realm. If you are simply building an app on Realm, it is\n           recommended to set key values via `RLMObject`.\n\n @warning Will throw an `NSUndefinedKeyException` if `key` is not present on the object.\n\n @param object\tAn `RLMObjectBase` obtained via a Swift `Object` or `RLMObject`.\n @param key\t\tThe name of the property.\n @param obj\t\tThe object to set as the value of the key.\n */\nFOUNDATION_EXTERN void RLMObjectBaseSetObjectForKeyedSubscript(RLMObjectBase * _Nullable object, NSString *key, id _Nullable obj);\n\nRLM_HEADER_AUDIT_END(nullability)\n"
  },
  {
    "path": "Realm/RLMObjectBase_Private.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2017 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMObjectBase.h>\n\n@class RLMArray<RLMObjectType>;\n\nRLM_HEADER_AUDIT_BEGIN(nullability)\n\n// RLMObjectBase private\n@interface RLMObjectBase ()\n@property (nonatomic, nullable) NSMutableArray *lastAccessedNames;\n\n+ (void)initializeLinkedObjectSchemas;\n+ (bool)isEmbedded;\n+ (bool)isAsymmetric;\n@end\n\nRLM_HEADER_AUDIT_END(nullability)\n"
  },
  {
    "path": "Realm/RLMObjectId.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n/**\n A 12-byte (probably) unique object identifier.\n\n ObjectIds are similar to a GUID or a UUID, and can be used to uniquely identify\n objects without a centralized ID generator. An ObjectID consists of:\n\n 1. A 4 byte timestamp measuring the creation time of the ObjectId in seconds\n    since the Unix epoch.\n 2. A 5 byte random value\n 3. A 3 byte counter, initialized to a random value.\n\n ObjectIds are intended to be fast to generate. Sorting by an ObjectId field\n will typically result in the objects being sorted in creation order.\n */\nNS_SWIFT_SENDABLE // immutable\n@interface RLMObjectId : NSObject <NSCopying>\n/// Creates a new randomly-initialized ObjectId.\n+ (nonnull instancetype)objectId NS_SWIFT_NAME(generate());\n\n/// Creates a new zero-initialized ObjectId.\n- (instancetype)init;\n\n/// Creates a new ObjectId from the given 24-byte hexadecimal string.\n///\n/// Returns `nil` and sets `error` if the string is not 24 characters long or\n/// contains any characters other than 0-9a-fA-F.\n///\n/// @param string The string to parse.\n- (nullable instancetype)initWithString:(NSString *)string\n                                  error:(NSError **)error;\n\n/// Creates a new ObjectId using the given date, machine identifier, process identifier.\n///\n/// @param timestamp A timestamp as NSDate.\n/// @param machineIdentifier The machine identifier.\n/// @param processIdentifier The process identifier.\n- (instancetype)initWithTimestamp:(NSDate *)timestamp\n                machineIdentifier:(int)machineIdentifier\n                processIdentifier:(int)processIdentifier;\n\n/// Comparision operator to check if the right hand side is greater than the current value.\n- (BOOL)isGreaterThan:(nullable RLMObjectId *)objectId;\n/// Comparision operator to check if the right hand side is greater than or equal to the current value.\n- (BOOL)isGreaterThanOrEqualTo:(nullable RLMObjectId *)objectId;\n/// Comparision operator to check if the right hand side is less than the current value.\n- (BOOL)isLessThan:(nullable RLMObjectId *)objectId;\n/// Comparision operator to check if the right hand side is less than or equal to the current value.\n- (BOOL)isLessThanOrEqualTo:(nullable RLMObjectId *)objectId;\n\n/// Get the ObjectId as a 24-character hexadecimal string.\n@property (nonatomic, readonly) NSString *stringValue;\n/// Get the timestamp for the RLMObjectId\n@property (nonatomic, readonly) NSDate *timestamp;\n\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMObjectId.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMObjectId_Private.hpp\"\n\n#import \"RLMError_Private.hpp\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/object_id.hpp>\n\n// Swift's obj-c bridging does not support making an obj-c defined class conform\n// to Decodable, so we need a Swift-defined subclass for that. This means that\n// when Realm Swift is being used, we need to produce objects of that type rather\n// than our obj-c defined type. objc_runtime_visible marks the type as being\n// visbile only to the obj-c runtime and not the linker, which means that it'll\n// be `nil` at runtime rather than being a linker error if it's not defined, and\n// valid if it happens to be defined by some other library (i.e. Realm Swift).\n//\n// At the point where the objects are being allocated we generally don't have\n// any good way of knowing whether or not it's going to end up being used by\n// Swift, so we just switch to the subclass unconditionally if the subclass\n// exists. This shouldn't have any impact on obj-c code other than a small\n// performance hit.\n[[clang::objc_runtime_visible]]\n@interface RealmSwiftObjectId : RLMObjectId\n@end\n\n@implementation RLMObjectId\n- (instancetype)init {\n    if ((self = [super init])) {\n        if (auto cls = [RealmSwiftObjectId class]; cls && cls != self.class) {\n            object_setClass(self, cls);\n        }\n    }\n    return self;\n}\n\n- (instancetype)initWithString:(NSString *)string error:(NSError **)error {\n    if ((self = [self init])) {\n        const char *str = string.UTF8String;\n        if (!realm::ObjectId::is_valid_str(str)) {\n            if (error) {\n                NSString *msg = [NSString stringWithFormat:@\"Invalid Object ID string '%@': must be 24 hex digits\", string];\n                *error = [NSError errorWithDomain:RLMErrorDomain\n                                             code:RLMErrorInvalidInput\n                                         userInfo:@{NSLocalizedDescriptionKey: msg}];\n            }\n            return nil;\n        }\n        _value = realm::ObjectId(str);\n    }\n    return self;\n}\n\n- (instancetype)initWithTimestamp:(NSDate *)timestamp\n                machineIdentifier:(int)machineIdentifier\n                processIdentifier:(int)processIdentifier {\n    if ((self = [self init])) {\n        _value = realm::ObjectId(RLMTimestampForNSDate(timestamp), machineIdentifier, processIdentifier);\n    }\n    return self;\n}\n\n- (instancetype)initWithValue:(realm::ObjectId)value {\n    if ((self = [self init])) {\n        _value = value;\n    }\n    return self;\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    // RLMObjectID is immutable so we don't have to actually copy\n    return self;\n}\n\n+ (instancetype)objectId {\n    return [[self alloc] initWithValue:realm::ObjectId::gen()];\n}\n\n- (BOOL)isEqual:(id)object {\n    if (RLMObjectId *objectId = RLMDynamicCast<RLMObjectId>(object)) {\n        return objectId->_value == _value;\n    }\n    return NO;\n}\n\n- (BOOL)isGreaterThan:(nullable RLMObjectId *)objectId {\n    return _value > objectId.value;\n}\n\n- (BOOL)isGreaterThanOrEqualTo:(nullable RLMObjectId *)objectId {\n    return _value >= objectId.value;\n}\n\n- (BOOL)isLessThan:(nullable RLMObjectId *)objectId {\n    return _value < objectId.value;\n}\n\n- (BOOL)isLessThanOrEqualTo:(nullable RLMObjectId *)objectId {\n    return _value <= objectId.value;\n}\n\n- (NSUInteger)hash {\n    return _value.hash();\n}\n\n- (NSString *)description {\n    return self.stringValue;\n}\n\n- (NSString *)stringValue {\n    return @(_value.to_string().c_str());\n}\n\n- (NSDate *)timestamp {\n    return RLMTimestampToNSDate(_value.get_timestamp());\n}\n\n@end\n"
  },
  {
    "path": "Realm/RLMObjectId_Private.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMObjectId.h>\n\nnamespace realm {\nclass ObjectId;\n}\n\nRLM_DIRECT_MEMBERS\n@interface RLMObjectId ()\n@property (nonatomic, readonly) realm::ObjectId value;\n- (instancetype)initWithValue:(realm::ObjectId)value;\n@end\n"
  },
  {
    "path": "Realm/RLMObjectSchema.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@class RLMProperty;\n\n/**\n This class represents Realm model object schemas.\n\n When using Realm, `RLMObjectSchema` instances allow performing migrations and\n introspecting the database's schema.\n\n Object schemas map to tables in the core database.\n */\nNS_SWIFT_SENDABLE RLM_FINAL // not actually immutable, but the public API kinda is\n@interface RLMObjectSchema : NSObject<NSCopying>\n\n#pragma mark - Properties\n\n/**\n An array of `RLMProperty` instances representing the managed properties of a class described by the schema.\n\n @see `RLMProperty`\n */\n@property (nonatomic, readonly, copy) NSArray<RLMProperty *> *properties;\n\n/**\n The name of the class the schema describes.\n */\n@property (nonatomic, readonly) NSString *className;\n\n/**\n The property which serves as the primary key for the class the schema describes, if any.\n */\n@property (nonatomic, readonly, nullable) RLMProperty *primaryKeyProperty;\n\n/**\n Whether this object type is embedded.\n */\n@property (nonatomic, readonly) BOOL isEmbedded;\n\n/**\n Whether this object is asymmetric.\n */\n@property (nonatomic, readonly) BOOL isAsymmetric;\n\n#pragma mark - Methods\n\n/**\n Retrieves an `RLMProperty` object by the property name.\n\n @param propertyName The property's name.\n\n @return An `RLMProperty` object, or `nil` if there is no property with the given name.\n */\n- (nullable RLMProperty *)objectForKeyedSubscript:(NSString *)propertyName;\n\n/**\n Returns whether two `RLMObjectSchema` instances are equal.\n */\n- (BOOL)isEqualToObjectSchema:(RLMObjectSchema *)objectSchema;\n\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMObjectSchema.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMObjectSchema_Private.hpp\"\n\n#import \"RLMEmbeddedObject.h\"\n#import \"RLMObject_Private.h\"\n#import \"RLMProperty_Private.hpp\"\n#import \"RLMRealm_Dynamic.h\"\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMSchema_Private.h\"\n#import \"RLMSwiftCollectionBase.h\"\n#import \"RLMSwiftSupport.h\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/object-store/object_schema.hpp>\n#import <realm/object-store/object_store.hpp>\n\nusing namespace realm;\n\n@protocol RLMCustomEventRepresentable\n@end\n\n// private properties\n@interface RLMObjectSchema ()\n@property (nonatomic, readwrite) NSDictionary<id, RLMProperty *> *allPropertiesByName;\n@property (nonatomic, readwrite) NSString *className;\n@end\n\n@implementation RLMObjectSchema {\n    std::string _objectStoreName;\n}\n\n- (instancetype)initWithClassName:(NSString *)objectClassName objectClass:(Class)objectClass properties:(NSArray *)properties {\n    self = [super init];\n    self.className = objectClassName;\n    self.properties = properties;\n    self.objectClass = objectClass;\n    self.accessorClass = objectClass;\n    self.unmanagedClass = objectClass;\n    return self;\n}\n\n// return properties by name\n- (RLMProperty *)objectForKeyedSubscript:(__unsafe_unretained NSString *const)key {\n    return _allPropertiesByName[key];\n}\n\n// create property map when setting property array\n- (void)setProperties:(NSArray *)properties {\n    _properties = properties;\n    [self _propertiesDidChange];\n}\n\n- (void)setComputedProperties:(NSArray *)computedProperties {\n    _computedProperties = computedProperties;\n    [self _propertiesDidChange];\n}\n\n- (void)_propertiesDidChange {\n    _primaryKeyProperty = nil;\n    NSMutableDictionary *map = [NSMutableDictionary dictionaryWithCapacity:_properties.count + _computedProperties.count];\n    NSUInteger index = 0;\n    for (RLMProperty *prop in _properties) {\n        prop.index = index++;\n        map[prop.name] = prop;\n        if (prop.isPrimary) {\n            if (_primaryKeyProperty) {\n                @throw RLMException(@\"Properties '%@' and '%@' are both marked as the primary key of '%@'\",\n                                    prop.name, _primaryKeyProperty.name, _className);\n            }\n            _primaryKeyProperty = prop;\n        }\n    }\n    index = 0;\n    for (RLMProperty *prop in _computedProperties) {\n        prop.index = index++;\n        map[prop.name] = prop;\n    }\n    _allPropertiesByName = map;\n\n    if (RLMIsSwiftObjectClass(_accessorClass)) {\n        NSMutableArray *genericProperties = [NSMutableArray new];\n        for (RLMProperty *prop in _properties) {\n            if (prop.swiftAccessor) {\n                [genericProperties addObject:prop];\n            }\n        }\n        // Currently all computed properties are Swift generics\n        [genericProperties addObjectsFromArray:_computedProperties];\n\n        if (genericProperties.count) {\n            _swiftGenericProperties = genericProperties;\n        }\n        else {\n            _swiftGenericProperties = nil;\n        }\n    }\n}\n\n\n- (void)setPrimaryKeyProperty:(RLMProperty *)primaryKeyProperty {\n    _primaryKeyProperty.isPrimary = NO;\n    primaryKeyProperty.isPrimary = YES;\n    _primaryKeyProperty = primaryKeyProperty;\n    _primaryKeyProperty.indexed = YES;\n}\n\n+ (instancetype)schemaForObjectClass:(Class)objectClass {\n    RLMObjectSchema *schema = [RLMObjectSchema new];\n\n    // determine classname from objectclass as className method has not yet been updated\n    NSString *className = NSStringFromClass(objectClass);\n    bool hasSwiftName = [RLMSwiftSupport isSwiftClassName:className];\n    if (hasSwiftName) {\n        className = [RLMSwiftSupport demangleClassName:className];\n    }\n\n    bool isSwift = hasSwiftName || RLMIsSwiftObjectClass(objectClass);\n\n    schema.className = className;\n    schema.objectClass = objectClass;\n    schema.accessorClass = objectClass;\n    schema.unmanagedClass = objectClass;\n    schema.isSwiftClass = isSwift;\n    schema.hasCustomEventSerialization = [objectClass conformsToProtocol:@protocol(RLMCustomEventRepresentable)];\n\n    bool isEmbedded = [(id)objectClass isEmbedded];\n    bool isAsymmetric = [(id)objectClass isAsymmetric];\n    REALM_ASSERT(!(isEmbedded && isAsymmetric));\n    schema.isEmbedded = isEmbedded;\n    schema.isAsymmetric = isAsymmetric;\n\n    // create array of RLMProperties, inserting properties of superclasses first\n    Class cls = objectClass;\n    Class superClass = class_getSuperclass(cls);\n    NSArray *allProperties = @[];\n    while (superClass && superClass != RLMObjectBase.class) {\n        allProperties = [[RLMObjectSchema propertiesForClass:cls isSwift:isSwift]\n                         arrayByAddingObjectsFromArray:allProperties];\n        cls = superClass;\n        superClass = class_getSuperclass(superClass);\n    }\n    NSArray *persistedProperties = [allProperties filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(RLMProperty *property, NSDictionary *) {\n        return !RLMPropertyTypeIsComputed(property.type);\n    }]];\n    schema.properties = persistedProperties;\n\n    NSArray *computedProperties = [allProperties filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(RLMProperty *property, NSDictionary *) {\n        return RLMPropertyTypeIsComputed(property.type);\n    }]];\n    schema.computedProperties = computedProperties;\n\n    // verify that we didn't add any properties twice due to inheritance\n    if (allProperties.count != [NSSet setWithArray:[allProperties valueForKey:@\"name\"]].count) {\n        NSCountedSet *countedPropertyNames = [NSCountedSet setWithArray:[allProperties valueForKey:@\"name\"]];\n        NSArray *duplicatePropertyNames = [countedPropertyNames filteredSetUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id object, NSDictionary *) {\n            return [countedPropertyNames countForObject:object] > 1;\n        }]].allObjects;\n\n        if (duplicatePropertyNames.count == 1) {\n            @throw RLMException(@\"Property '%@' is declared multiple times in the class hierarchy of '%@'\", duplicatePropertyNames.firstObject, className);\n        } else {\n            @throw RLMException(@\"Object '%@' has properties that are declared multiple times in its class hierarchy: '%@'\", className, [duplicatePropertyNames componentsJoinedByString:@\"', '\"]);\n        }\n    }\n\n    if (NSString *primaryKey = [objectClass primaryKey]) {\n        for (RLMProperty *prop in schema.properties) {\n            if ([primaryKey isEqualToString:prop.name]) {\n                prop.indexed = YES;\n                schema.primaryKeyProperty = prop;\n                break;\n            }\n        }\n\n        if (!schema.primaryKeyProperty) {\n            @throw RLMException(@\"Primary key property '%@' does not exist on object '%@'\", primaryKey, className);\n        }\n        if (schema.primaryKeyProperty.type != RLMPropertyTypeInt &&\n            schema.primaryKeyProperty.type != RLMPropertyTypeString &&\n            schema.primaryKeyProperty.type != RLMPropertyTypeObjectId &&\n            schema.primaryKeyProperty.type != RLMPropertyTypeUUID) {\n            @throw RLMException(@\"Property '%@' cannot be made the primary key of '%@' because it is not a 'string', 'int', 'objectId', or 'uuid' property.\",\n                                primaryKey, className);\n        }\n    }\n\n    for (RLMProperty *prop in schema.properties) {\n        if (prop.optional && prop.collection && !prop.dictionary && (prop.type == RLMPropertyTypeObject || prop.type == RLMPropertyTypeLinkingObjects)) {\n            // FIXME: message is awkward\n            @throw RLMException(@\"Property '%@.%@' cannot be made optional because optional '%@' properties are not supported.\",\n                                className, prop.name, RLMTypeToString(prop.type));\n        }\n    }\n\n    if ([objectClass shouldIncludeInDefaultSchema]\n        && schema.isSwiftClass\n        && schema.properties.count == 0\n        && schema.computedProperties.count == 0) {\n        @throw RLMException(@\"No properties are defined for '%@'. Did you remember to mark them with '@objc' or '@Persisted' in your model?\", schema.className);\n    }\n    return schema;\n}\n\n+ (NSArray *)propertiesForClass:(Class)objectClass isSwift:(bool)isSwiftClass {\n    if (NSArray<RLMProperty *> *props = [objectClass _getProperties]) {\n        return props;\n    }\n\n    // For Swift subclasses of RLMObject we need an instance of the object when parsing properties\n    id swiftObjectInstance = isSwiftClass ? [[objectClass alloc] init] : nil;\n\n    NSArray *ignoredProperties = [objectClass ignoredProperties];\n    NSDictionary *linkingObjectsProperties = [objectClass linkingObjectsProperties];\n    NSDictionary *columnNameMap = [objectClass _realmColumnNames];\n\n    unsigned int count;\n    std::unique_ptr<objc_property_t[], decltype(&free)> props(class_copyPropertyList(objectClass, &count), &free);\n    NSMutableArray<RLMProperty *> *propArray = [NSMutableArray arrayWithCapacity:count];\n    NSSet *indexed = [[NSSet alloc] initWithArray:[objectClass indexedProperties]];\n    for (unsigned int i = 0; i < count; i++) {\n        NSString *propertyName = @(property_getName(props[i]));\n        if ([ignoredProperties containsObject:propertyName]) {\n            continue;\n        }\n\n        RLMProperty *prop = nil;\n        if (isSwiftClass) {\n            prop = [[RLMProperty alloc] initSwiftPropertyWithName:propertyName\n                                                          indexed:[indexed containsObject:propertyName]\n                                           linkPropertyDescriptor:linkingObjectsProperties[propertyName]\n                                                         property:props[i]\n                                                         instance:swiftObjectInstance];\n        }\n        else {\n            prop = [[RLMProperty alloc] initWithName:propertyName\n                                             indexed:[indexed containsObject:propertyName]\n                              linkPropertyDescriptor:linkingObjectsProperties[propertyName]\n                                            property:props[i]];\n        }\n\n        if (prop) {\n            if (columnNameMap) {\n                prop.columnName = columnNameMap[prop.name];\n            }\n            [propArray addObject:prop];\n        }\n    }\n\n    if (auto requiredProperties = [objectClass requiredProperties]) {\n        for (RLMProperty *property in propArray) {\n            bool required = [requiredProperties containsObject:property.name];\n            if (required && property.type == RLMPropertyTypeObject && (!property.collection || property.dictionary)) {\n                @throw RLMException(@\"Object properties cannot be made required, \"\n                                    \"but '+[%@ requiredProperties]' included '%@'\", objectClass, property.name);\n            }\n            property.optional &= !required;\n        }\n    }\n\n    for (RLMProperty *property in propArray) {\n        if (!property.optional && property.type == RLMPropertyTypeObject && !property.collection) {\n            @throw RLMException(@\"The `%@.%@` property must be marked as being optional.\",\n                                [objectClass className], property.name);\n        }\n        if (property.type == RLMPropertyTypeAny) {\n            property.optional = NO;\n        }\n    }\n\n    return propArray;\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    RLMObjectSchema *schema = [[RLMObjectSchema allocWithZone:zone] init];\n    schema->_objectClass = _objectClass;\n    schema->_className = _className;\n    schema->_objectClass = _objectClass;\n    schema->_accessorClass = _objectClass;\n    schema->_unmanagedClass = _unmanagedClass;\n    schema->_isSwiftClass = _isSwiftClass;\n    schema->_isEmbedded = _isEmbedded;\n    schema->_isAsymmetric = _isAsymmetric;\n    schema->_properties = [[NSArray allocWithZone:zone] initWithArray:_properties copyItems:YES];\n    schema->_computedProperties = [[NSArray allocWithZone:zone] initWithArray:_computedProperties copyItems:YES];\n    [schema _propertiesDidChange];\n    return schema;\n}\n\n- (BOOL)isEqualToObjectSchema:(RLMObjectSchema *)objectSchema {\n    if (objectSchema.properties.count != _properties.count) {\n        return NO;\n    }\n\n    if (![_properties isEqualToArray:objectSchema.properties]) {\n        return NO;\n    }\n    if (![_computedProperties isEqualToArray:objectSchema.computedProperties]) {\n        return NO;\n    }\n\n    return YES;\n}\n\n- (NSString *)description {\n    NSMutableString *propertiesString = [NSMutableString string];\n    for (RLMProperty *property in self.properties) {\n        [propertiesString appendFormat:@\"\\t%@\\n\", [property.description stringByReplacingOccurrencesOfString:@\"\\n\" withString:@\"\\n\\t\"]];\n    }\n    for (RLMProperty *property in self.computedProperties) {\n        [propertiesString appendFormat:@\"\\t%@\\n\", [property.description stringByReplacingOccurrencesOfString:@\"\\n\" withString:@\"\\n\\t\"]];\n    }\n    return [NSString stringWithFormat:@\"%@ %@{\\n%@}\",\n            self.className, _isEmbedded ? @\"(embedded) \" : @\"\", propertiesString];\n}\n\n- (NSString *)objectName {\n    return [self.objectClass _realmObjectName] ?: _className;\n}\n\n- (std::string const&)objectStoreName {\n    if (_objectStoreName.empty()) {\n        _objectStoreName = self.objectName.UTF8String;\n    }\n    return _objectStoreName;\n}\n\n- (realm::ObjectSchema)objectStoreCopy:(RLMSchema *)schema {\n    using Type = ObjectSchema::ObjectType;\n    ObjectSchema objectSchema;\n    objectSchema.name = self.objectStoreName;\n    objectSchema.primary_key = _primaryKeyProperty ? _primaryKeyProperty.columnName.UTF8String : \"\";\n    objectSchema.table_type = _isAsymmetric ? Type::TopLevelAsymmetric : _isEmbedded ? Type::Embedded : Type::TopLevel;\n    for (RLMProperty *prop in _properties) {\n        Property p = [prop objectStoreCopy:schema];\n        p.is_primary = (prop == _primaryKeyProperty);\n        objectSchema.persisted_properties.push_back(std::move(p));\n    }\n    for (RLMProperty *prop in _computedProperties) {\n        objectSchema.computed_properties.push_back([prop objectStoreCopy:schema]);\n    }\n    return objectSchema;\n}\n\n+ (instancetype)objectSchemaForObjectStoreSchema:(realm::ObjectSchema const&)objectSchema {\n    RLMObjectSchema *schema = [RLMObjectSchema new];\n    schema.className = @(objectSchema.name.c_str());\n    schema.isEmbedded = objectSchema.table_type == ObjectSchema::ObjectType::Embedded;\n    schema.isAsymmetric = objectSchema.table_type == ObjectSchema::ObjectType::TopLevelAsymmetric;\n\n    // create array of RLMProperties\n    NSMutableArray *properties = [NSMutableArray arrayWithCapacity:objectSchema.persisted_properties.size()];\n    for (const Property &prop : objectSchema.persisted_properties) {\n        RLMProperty *property = [RLMProperty propertyForObjectStoreProperty:prop];\n        property.isPrimary = (prop.name == objectSchema.primary_key);\n        [properties addObject:property];\n    }\n    schema.properties = properties;\n\n    NSMutableArray *computedProperties = [NSMutableArray arrayWithCapacity:objectSchema.computed_properties.size()];\n    for (const Property &prop : objectSchema.computed_properties) {\n        [computedProperties addObject:[RLMProperty propertyForObjectStoreProperty:prop]];\n    }\n    schema.computedProperties = computedProperties;\n\n    // get primary key from realm metadata\n    if (objectSchema.primary_key.length()) {\n        NSString *primaryKeyString = [NSString stringWithUTF8String:objectSchema.primary_key.c_str()];\n        schema.primaryKeyProperty = schema[primaryKeyString];\n        if (!schema.primaryKeyProperty) {\n            @throw RLMException(@\"No property matching primary key '%@'\", primaryKeyString);\n        }\n    }\n\n    // for dynamic schema use vanilla RLMDynamicObject accessor classes\n    schema.objectClass = RLMObject.class;\n    schema.accessorClass = RLMDynamicObject.class;\n    schema.unmanagedClass = RLMObject.class;\n\n    return schema;\n}\n\n@end\n"
  },
  {
    "path": "Realm/RLMObjectSchema_Private.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMObjectSchema.h>\n\n#import <objc/runtime.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability)\n\n// RLMObjectSchema private\n@interface RLMObjectSchema () {\n@public\n    bool _isSwiftClass;\n}\n\n/// The object type name reported to the object store and core.\n@property (nonatomic, readonly) NSString *objectName;\n\n// writable redeclaration\n@property (nonatomic, readwrite, copy) NSArray<RLMProperty *> *properties;\n@property (nonatomic, readwrite, assign) bool isSwiftClass;\n@property (nonatomic, readwrite, assign) BOOL isEmbedded;\n@property (nonatomic, readwrite, assign) BOOL isAsymmetric;\n\n// class used for this object schema\n@property (nonatomic, readwrite, assign) Class objectClass;\n@property (nonatomic, readwrite, assign) Class accessorClass;\n@property (nonatomic, readwrite, assign) Class unmanagedClass;\n\n@property (nonatomic, readwrite, assign) bool hasCustomEventSerialization;\n\n@property (nonatomic, readwrite, nullable) RLMProperty *primaryKeyProperty;\n\n@property (nonatomic, copy) NSArray<RLMProperty *> *computedProperties;\n@property (nonatomic, readonly, nullable) NSArray<RLMProperty *> *swiftGenericProperties;\n\n// returns a cached or new schema for a given object class\n+ (instancetype)schemaForObjectClass:(Class)objectClass;\n@end\n\n@interface RLMObjectSchema (Dynamic)\n/**\n This method is useful only in specialized circumstances, for example, when accessing objects\n in a Realm produced externally. If you are simply building an app on Realm, it is not recommended\n to use this method as an [RLMObjectSchema](RLMObjectSchema) is generated automatically for every [RLMObject](RLMObject) subclass.\n\n Initialize an RLMObjectSchema with classname, objectClass, and an array of properties\n\n @warning This method is useful only in specialized circumstances.\n\n @param objectClassName     The name of the class used to refer to objects of this type.\n @param objectClass         The Objective-C class used when creating instances of this type.\n @param properties          An array of RLMProperty instances describing the managed properties for this type.\n\n @return    An initialized instance of RLMObjectSchema.\n */\n- (instancetype)initWithClassName:(NSString *)objectClassName objectClass:(Class)objectClass properties:(NSArray *)properties;\n@end\n\nRLM_HEADER_AUDIT_END(nullability)\n"
  },
  {
    "path": "Realm/RLMObjectSchema_Private.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMObjectSchema_Private.h\"\n\n#import <string>\n\nnamespace realm {\n    class ObjectSchema;\n}\n@class RLMSchema;\n\n@interface RLMObjectSchema ()\n- (std::string const&)objectStoreName;\n\n// create realm::ObjectSchema copy\n- (realm::ObjectSchema)objectStoreCopy:(RLMSchema *)schema;\n\n// initialize with realm::ObjectSchema\n+ (instancetype)objectSchemaForObjectStoreSchema:(realm::ObjectSchema const&)objectSchema;\n@end\n"
  },
  {
    "path": "Realm/RLMObjectStore.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n@class RLMRealm, RLMSchema, RLMObjectBase, RLMResults, RLMProperty;\n\ntypedef NS_ENUM(NSUInteger, RLMUpdatePolicy) {\n    RLMUpdatePolicyError = 1,\n    RLMUpdatePolicyUpdateChanged = 3,\n    RLMUpdatePolicyUpdateAll = 2,\n};\n\nRLM_HEADER_AUDIT_BEGIN(nullability)\n\nvoid RLMVerifyHasPrimaryKey(Class cls);\n\nvoid RLMVerifyInWriteTransaction(RLMRealm *const realm);\n\n//\n// Adding, Removing, Getting Objects\n//\n\n// add an object to the given realm\nvoid RLMAddObjectToRealm(RLMObjectBase *object, RLMRealm *realm, RLMUpdatePolicy);\n\n// delete an object from its realm\nvoid RLMDeleteObjectFromRealm(RLMObjectBase *object, RLMRealm *realm);\n\n// deletes all objects from a realm\nvoid RLMDeleteAllObjectsFromRealm(RLMRealm *realm);\n\n// get objects of a given class\nRLMResults *RLMGetObjects(RLMRealm *realm, NSString *objectClassName, NSPredicate * _Nullable predicate)\nNS_RETURNS_RETAINED;\n\n// get an object with the given primary key\nid _Nullable RLMGetObject(RLMRealm *realm, NSString *objectClassName, id _Nullable key) NS_RETURNS_RETAINED;\n\n// create object from array or dictionary\nRLMObjectBase *RLMCreateObjectInRealmWithValue(RLMRealm *realm, NSString *className,\n                                               id _Nullable value, RLMUpdatePolicy updatePolicy)\nNS_RETURNS_RETAINED;\n\n// creates an asymmetric object and doesn't return\nvoid RLMCreateAsymmetricObjectInRealm(RLMRealm *realm, NSString *className, id value);\n\n//\n// Accessor Creation\n//\n\n\n// Perform the per-property accessor initialization for a managed RealmSwiftObject\n// promotingExisting should be true if the object was previously used as an\n// unmanaged object, and false if it is a newly created object.\nvoid RLMInitializeSwiftAccessor(RLMObjectBase *object, bool promotingExisting);\n\n#ifdef __cplusplus\n}\n\nnamespace realm {\n    class Obj;\n    class Table;\n    struct ColKey;\n    struct ObjLink;\n}\nclass RLMClassInfo;\n\n// get an object with a given table & object key\nRLMObjectBase *RLMObjectFromObjLink(RLMRealm *realm,\n                                    realm::ObjLink&& objLink,\n                                    bool parentIsSwiftObject) NS_RETURNS_RETAINED;\n\n// Create accessors\nRLMObjectBase *RLMCreateObjectAccessor(RLMClassInfo& info, int64_t key) NS_RETURNS_RETAINED;\nRLMObjectBase *RLMCreateObjectAccessor(RLMClassInfo& info, const realm::Obj& obj) NS_RETURNS_RETAINED;\n#endif\n\nRLM_HEADER_AUDIT_END(nullability)\n"
  },
  {
    "path": "Realm/RLMObjectStore.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMObjectStore.h\"\n\n#import \"RLMAccessor.hpp\"\n#import \"RLMArray_Private.hpp\"\n#import \"RLMObservation.hpp\"\n#import \"RLMObject_Private.hpp\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMQueryUtil.hpp\"\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMSchema_Private.h\"\n#import \"RLMSet_Private.hpp\"\n#import \"RLMSwiftCollectionBase.h\"\n#import \"RLMSwiftSupport.h\"\n#import \"RLMUtil.hpp\"\n#import \"RLMSwiftValueStorage.h\"\n\n#import <realm/object-store/object_store.hpp>\n#import <realm/object-store/results.hpp>\n#import <realm/object-store/shared_realm.hpp>\n#import <realm/group.hpp>\n\n#import <objc/message.h>\n\nstatic inline void RLMVerifyRealmRead(__unsafe_unretained RLMRealm *const realm) {\n    if (!realm) {\n        @throw RLMException(@\"Realm must not be nil\");\n    }\n    [realm verifyThread];\n    if (realm->_realm->is_closed()) {\n        // This message may seem overly specific, but frozen Realms are currently\n        // the only ones which we outright close.\n        @throw RLMException(@\"Cannot read from a frozen Realm which has been invalidated.\");\n    }\n}\n\nvoid RLMVerifyInWriteTransaction(__unsafe_unretained RLMRealm *const realm) {\n    RLMVerifyRealmRead(realm);\n    // if realm is not writable throw\n    if (!realm.inWriteTransaction) {\n        @throw RLMException(@\"Can only add, remove, or create objects in a Realm in a write transaction - call beginWriteTransaction on an RLMRealm instance first.\");\n    }\n}\n\nvoid RLMInitializeSwiftAccessor(__unsafe_unretained RLMObjectBase *const object, bool promoteExisting) {\n    if (!object || !object->_row || !object->_objectSchema->_isSwiftClass) {\n        return;\n    }\n    if (![object isKindOfClass:object->_objectSchema.objectClass]) {\n        // It can be a different class if it's a dynamic object, and those don't\n        // require any init here (and would crash since they don't have the ivars)\n        return;\n    }\n\n    if (promoteExisting) {\n        for (RLMProperty *prop in object->_objectSchema.swiftGenericProperties) {\n            [prop.swiftAccessor promote:prop on:object];\n        }\n    }\n    else {\n        for (RLMProperty *prop in object->_objectSchema.swiftGenericProperties) {\n            [prop.swiftAccessor initialize:prop on:object];\n        }\n    }\n}\n\nvoid RLMVerifyHasPrimaryKey(Class cls) {\n    RLMObjectSchema *schema = [cls sharedSchema];\n    if (!schema.primaryKeyProperty) {\n        NSString *reason = [NSString stringWithFormat:@\"'%@' does not have a primary key and can not be updated\", schema.className];\n        @throw [NSException exceptionWithName:@\"RLMException\" reason:reason userInfo:nil];\n    }\n}\n\nusing realm::CreatePolicy;\nstatic CreatePolicy updatePolicyToCreatePolicy(RLMUpdatePolicy policy) {\n    CreatePolicy createPolicy = {.create = true, .copy = false, .diff = false, .update = false};\n    switch (policy) {\n        case RLMUpdatePolicyError:\n            break;\n        case RLMUpdatePolicyUpdateChanged:\n            createPolicy.diff = true;\n            [[clang::fallthrough]];\n        case RLMUpdatePolicyUpdateAll:\n            createPolicy.update = true;\n            break;\n    }\n    return createPolicy;\n}\n\nvoid RLMAddObjectToRealm(__unsafe_unretained RLMObjectBase *const object,\n                         __unsafe_unretained RLMRealm *const realm,\n                         RLMUpdatePolicy updatePolicy) {\n    RLMVerifyInWriteTransaction(realm);\n\n    CreatePolicy createPolicy = updatePolicyToCreatePolicy(updatePolicy);\n    createPolicy.copy = false;\n    auto& info = realm->_info[object->_objectSchema.className];\n    RLMAccessorContext c{info};\n    c.createObject(object, createPolicy);\n}\n\nRLMObjectBase *RLMCreateObjectInRealmWithValue(RLMRealm *realm, NSString *className,\n                                               id value, RLMUpdatePolicy updatePolicy) {\n    RLMVerifyInWriteTransaction(realm);\n\n    CreatePolicy createPolicy = updatePolicyToCreatePolicy(updatePolicy);\n    createPolicy.copy = true;\n\n    auto& info = realm->_info[className];\n    RLMAccessorContext c{info};\n    RLMObjectBase *object = RLMCreateManagedAccessor(info.rlmObjectSchema.accessorClass, &info);\n    auto [obj, reuseExisting] = c.createObject(value, createPolicy, true);\n    if (reuseExisting) {\n        return value;\n    }\n    object->_row = std::move(obj);\n    RLMInitializeSwiftAccessor(object, false);\n    return object;\n}\n\nvoid RLMCreateAsymmetricObjectInRealm(RLMRealm *realm, NSString *className, id value) {\n    RLMVerifyInWriteTransaction(realm);\n\n    CreatePolicy createPolicy = {.create = true, .copy = true, .diff = false, .update = false};\n\n    auto& info = realm->_info[className];\n    RLMAccessorContext c{info};\n    c.createObject(value, createPolicy);\n}\n\nRLMObjectBase *RLMObjectFromObjLink(RLMRealm *realm, realm::ObjLink&& objLink, bool parentIsSwiftObject) {\n    if (auto* tableInfo = realm->_info[objLink.get_table_key()]) {\n        return RLMCreateObjectAccessor(*tableInfo, objLink.get_obj_key().value);\n    } else {\n        // Construct the object dynamically.\n        // This code path should only be hit on first access of the object.\n        Class cls = parentIsSwiftObject ? [RealmSwiftDynamicObject class] : [RLMDynamicObject class];\n        auto& group = realm->_realm->read_group();\n        auto schema = std::make_unique<realm::ObjectSchema>(group,\n                                                            group.get_table_name(objLink.get_table_key()),\n                                                            objLink.get_table_key());\n        RLMObjectSchema *rlmObjectSchema = [RLMObjectSchema objectSchemaForObjectStoreSchema:*schema];\n        rlmObjectSchema.accessorClass = cls;\n        rlmObjectSchema.isSwiftClass = parentIsSwiftObject;\n        realm->_info.appendDynamicObjectSchema(std::move(schema), rlmObjectSchema, realm);\n        return RLMCreateObjectAccessor(realm->_info[rlmObjectSchema.className], objLink.get_obj_key().value);\n    }\n}\n\nvoid RLMDeleteObjectFromRealm(__unsafe_unretained RLMObjectBase *const object,\n                              __unsafe_unretained RLMRealm *const realm) {\n    if (realm != object->_realm) {\n        @throw RLMException(@\"Can only delete an object from the Realm it belongs to.\");\n    }\n\n    RLMVerifyInWriteTransaction(object->_realm);\n\n    if (object->_row.is_valid()) {\n        RLMObservationTracker tracker(realm, true);\n        object->_row.remove();\n    }\n    object->_realm = nil;\n}\n\nvoid RLMDeleteAllObjectsFromRealm(RLMRealm *realm) {\n    RLMVerifyInWriteTransaction(realm);\n\n    // clear table for each object schema\n    for (auto& info : realm->_info) {\n        RLMClearTable(info.second);\n    }\n}\n\nRLMResults *RLMGetObjects(__unsafe_unretained RLMRealm *const realm,\n                          NSString *objectClassName,\n                          NSPredicate *predicate) {\n    RLMVerifyRealmRead(realm);\n\n    // create view from table and predicate\n    RLMClassInfo& info = realm->_info[objectClassName];\n    if (!info.table()) {\n        // read-only realms may be missing tables since we can't add any\n        // missing ones on init\n        return [RLMResults resultsWithObjectInfo:info results:{}];\n    }\n\n    if (predicate) {\n        realm::Query query = RLMPredicateToQuery(predicate, info.rlmObjectSchema, realm.schema, realm.group);\n        return [RLMResults resultsWithObjectInfo:info\n                                         results:realm::Results(realm->_realm, std::move(query))];\n    }\n\n    return [RLMResults resultsWithObjectInfo:info\n                                     results:realm::Results(realm->_realm, info.table())];\n}\n\nid RLMGetObject(RLMRealm *realm, NSString *objectClassName, id key) {\n    RLMVerifyRealmRead(realm);\n\n    auto& info = realm->_info[objectClassName];\n    if (RLMProperty *prop = info.propertyForPrimaryKey()) {\n        RLMValidateValueForProperty(key, info.rlmObjectSchema, prop);\n    }\n    try {\n        RLMAccessorContext c{info};\n        auto obj = realm::Object::get_for_primary_key(c, realm->_realm, *info.objectSchema,\n                                                      key ?: NSNull.null);\n        if (!obj.is_valid())\n            return nil;\n        return RLMCreateObjectAccessor(info, obj.get_obj());\n    }\n    catch (std::exception const& e) {\n        @throw RLMException(e);\n    }\n}\n\nRLMObjectBase *RLMCreateObjectAccessor(RLMClassInfo& info, int64_t key) {\n    return RLMCreateObjectAccessor(info, info.table()->get_object(realm::ObjKey(key)));\n}\n\n// Create accessor and register with realm\nRLMObjectBase *RLMCreateObjectAccessor(RLMClassInfo& info, const realm::Obj& obj) {\n    RLMObjectBase *accessor = RLMCreateManagedAccessor(info.rlmObjectSchema.accessorClass, &info);\n    accessor->_row = obj;\n    RLMInitializeSwiftAccessor(accessor, false);\n    return accessor;\n}\n"
  },
  {
    "path": "Realm/RLMObject_Private.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMObjectBase_Dynamic.h>\n\n#import <Realm/RLMRealm.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@class RLMProperty, RLMArray, RLMSchema;\ntypedef NS_ENUM(int32_t, RLMPropertyType);\n\nFOUNDATION_EXTERN void RLMInitializeWithValue(RLMObjectBase *, id, RLMSchema *);\n\ntypedef void (^RLMObjectNotificationCallback)(RLMObjectBase *_Nullable object,\n                                              NSArray<NSString *> *_Nullable propertyNames,\n                                              NSArray *_Nullable oldValues,\n                                              NSArray *_Nullable newValues,\n                                              NSError *_Nullable error);\n\n// RLMObject accessor and read/write realm\n@interface RLMObjectBase () {\n@public\n    RLMRealm *_realm;\n    __unsafe_unretained RLMObjectSchema *_objectSchema;\n}\n\n// shared schema for this class\n+ (nullable RLMObjectSchema *)sharedSchema;\n\n+ (nullable NSArray<RLMProperty *> *)_getProperties;\n+ (bool)_realmIgnoreClass;\n\n// This enables to override the propertiesMapping in Swift, it is not to be used in Objective-C API.\n+ (NSDictionary<NSString *, NSString *> *)propertiesMapping;\n@end\n\n@interface RLMDynamicObject : RLMObject\n\n@end\n\n// Calls valueForKey: and re-raises NSUndefinedKeyExceptions\nFOUNDATION_EXTERN id _Nullable RLMValidatedValueForProperty(id object, NSString *key, NSString *className);\n\n// Compare two RLObjectBases\nFOUNDATION_EXTERN BOOL RLMObjectBaseAreEqual(RLMObjectBase * _Nullable o1, RLMObjectBase * _Nullable o2);\n\nFOUNDATION_EXTERN RLMNotificationToken *RLMObjectBaseAddNotificationBlock(RLMObjectBase *obj,\n                                                                          NSArray<NSString *> *_Nullable keyPaths,\n                                                                          dispatch_queue_t _Nullable queue,\n                                                                          RLMObjectNotificationCallback block);\n\nRLMNotificationToken *RLMObjectAddNotificationBlock(RLMObjectBase *obj,\n                                                    RLMObjectChangeBlock block,\n                                                    NSArray<NSString *> *_Nullable keyPaths,\n                                                    dispatch_queue_t _Nullable queue);\n\n// Returns whether the class is a descendent of RLMObjectBase\nFOUNDATION_EXTERN BOOL RLMIsObjectOrSubclass(Class klass);\n\n// Returns whether the class is an indirect descendant of RLMObjectBase\nFOUNDATION_EXTERN BOOL RLMIsObjectSubclass(Class klass);\n\nFOUNDATION_EXTERN const NSUInteger RLMDescriptionMaxDepth;\n\nFOUNDATION_EXTERN id RLMObjectFreeze(RLMObjectBase *obj) NS_RETURNS_RETAINED;\n\nFOUNDATION_EXTERN id RLMObjectThaw(RLMObjectBase *obj);\n\n// Gets an object identifier suitable for use with Combine. This value may\n// change when an unmanaged object is added to the Realm.\nFOUNDATION_EXTERN uint64_t RLMObjectBaseGetCombineId(RLMObjectBase *);\n\n// An accessor object which is used to interact with Swift properties from obj-c\n@interface RLMManagedPropertyAccessor : NSObject\n// Perform any initialization required for KVO on a *unmanaged* object\n+ (void)observe:(RLMProperty *)property on:(RLMObjectBase *)parent;\n// Initialize the given property on a *managed* object which previous was unmanaged\n+ (void)promote:(RLMProperty *)property on:(RLMObjectBase *)parent;\n// Initialize the given property on a newly created *managed* object\n+ (void)initialize:(RLMProperty *)property on:(RLMObjectBase *)parent;\n// Read the value of the property, on either kind of object\n+ (id)get:(RLMProperty *)property on:(RLMObjectBase *)parent;\n// Set the property to the given value, on either kind of object\n+ (void)set:(RLMProperty *)property on:(RLMObjectBase *)parent to:(id)value;\n@end\n\n@interface RLMObjectNotificationToken : RLMNotificationToken\n- (void)observe:(RLMObjectBase *)obj\n       keyPaths:(nullable NSArray<NSString *> *)keyPaths\n          block:(RLMObjectNotificationCallback)block;\n- (void)registrationComplete:(void (^)(void))completion;\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMObject_Private.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMObject_Private.h\"\n\n#import \"RLMSwiftObject.h\"\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/obj.hpp>\n\nclass RLMObservationInfo;\n\n// RLMObject accessor and read/write realm\n@interface RLMObjectBase () {\n    @public\n    realm::Obj _row;\n    RLMObservationInfo *_observationInfo;\n    RLMClassInfo *_info;\n}\n@end\n\nid RLMCreateManagedAccessor(Class cls, RLMClassInfo *info) NS_RETURNS_RETAINED;\n\n// throw an exception if the object is invalidated or on the wrong thread\nstatic inline void RLMVerifyAttached(__unsafe_unretained RLMObjectBase *const obj) {\n    if (!obj->_row.is_valid()) {\n        @throw RLMException(@\"Object has been deleted or invalidated.\");\n    }\n    [obj->_realm verifyThread];\n}\n\n// throw an exception if the object can't be modified for any reason\nstatic inline void RLMVerifyInWriteTransaction(__unsafe_unretained RLMObjectBase *const obj) {\n    // first verify is attached\n    RLMVerifyAttached(obj);\n\n    if (!obj->_realm.inWriteTransaction) {\n        if (obj->_realm.isFrozen) {\n            @throw RLMException(@\"Attempting to modify a frozen object - call thaw on the Object instance first.\");\n        }\n        @throw RLMException(@\"Attempting to modify object outside of a write transaction - call beginWriteTransaction on an RLMRealm instance first.\");\n    }\n}\n\n[[clang::objc_runtime_visible]]\n@interface RealmSwiftDynamicObject : RealmSwiftObject\n@end\n"
  },
  {
    "path": "Realm/RLMObservation.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Foundation/Foundation.h>\n\n#import <realm/obj.hpp>\n#import <realm/object-store/binding_context.hpp>\n#import <realm/object-store/impl/deep_change_checker.hpp>\n#import <realm/table.hpp>\n\n@class RLMObjectBase, RLMRealm, RLMSchema, RLMProperty, RLMObjectSchema;\nclass RLMClassInfo;\nclass RLMSchemaInfo;\n\nnamespace realm {\n    class History;\n    class SharedGroup;\n    struct TableKey;\n    struct ColKey;\n}\n\n// RLMObservationInfo stores all of the KVO-related data for RLMObjectBase and\n// RLMSet/Array. There is a one-to-one relationship between observed objects and\n// RLMObservationInfo instances, so it could be folded into RLMObjectBase, and\n// is a separate class mostly to avoid making all accessor objects far larger.\n//\n// RLMClassInfo stores a vector of pointers to the first observation info\n// created for each row. If there are multiple observation infos for a single\n// row (such as if there are multiple observed objects backed by a single row,\n// or if both an object and an array property of that object are observed),\n// they're stored in an intrusive doubly-linked-list in the `next` and `prev`\n// members. This is done primarily to make it simpler and faster to loop over\n// all of the observed objects for a single row, as that needs to be done for\n// every change.\nclass RLMObservationInfo {\npublic:\n    RLMObservationInfo(id object);\n    RLMObservationInfo(RLMClassInfo &objectSchema, realm::ObjKey row, id object);\n    ~RLMObservationInfo();\n\n    realm::Obj const& getRow() const {\n        return row;\n    }\n\n    NSString *columnName(realm::ColKey col) const noexcept;\n\n    // Send willChange/didChange notifications to all observers for this object/row\n    // Sends the array versions if indexes is non-nil, normal versions otherwise\n    void willChange(NSString *key, NSKeyValueChange kind=NSKeyValueChangeSetting, NSIndexSet *indexes=nil) const;\n    void didChange(NSString *key, NSKeyValueChange kind=NSKeyValueChangeSetting, NSIndexSet *indexes=nil) const;\n\n    bool isForRow(realm::ObjKey key) const {\n        return row.get_key() == key;\n    }\n\n    void recordObserver(realm::Obj& row, RLMClassInfo *objectInfo, RLMObjectSchema *objectSchema, NSString *keyPath);\n    void removeObserver();\n    bool hasObservers() const { return observerCount > 0; }\n\n    // valueForKey: on observed object and array properties needs to return the\n    // same object each time for KVO to work at all. Doing this all the time\n    // requires some odd semantics to avoid reference cycles, so instead we do\n    // it only to the extent specifically required by KVO. In addition, we\n    // need to continue to return the same object even if this row is deleted,\n    // or deleting an object with active observers will explode horribly.\n    // Once prepareForInvalidation() is called, valueForKey() will always return\n    // the cached value for object and array properties without checking the\n    // backing row to verify it's up-to-date.\n    //\n    // prepareForInvalidation() must be called on the head of the linked list\n    // (i.e. on the object pointed to directly by the object schema)\n    id valueForKey(NSString *key);\n\n    void prepareForInvalidation();\n\nprivate:\n    // Doubly-linked-list of observed objects for the same row as this\n    RLMObservationInfo *next = nullptr;\n    RLMObservationInfo *prev = nullptr;\n\n    // Row being observed\n    realm::Obj row;\n    RLMClassInfo *objectSchema = nullptr;\n\n    // Object doing the observing\n    __unsafe_unretained id object = nil;\n\n    // valueForKey: hack\n    bool invalidated = false;\n    size_t observerCount = 0;\n    NSString *lastKey = nil;\n    __unsafe_unretained RLMProperty *lastProp = nil;\n\n    // objects returned from valueForKey() to keep them alive in case observers\n    // are added and so that they can still be accessed after row is detached\n    NSMutableDictionary *cachedObjects;\n\n    void setRow(realm::Table const& table, realm::ObjKey newRow);\n\n    template<typename F>\n    void forEach(F&& f) const {\n        // The user's observation handler may release their last reference to\n        // the object being observed, which will result in the RLMObservationInfo\n        // being destroyed. As a result, we need to retain the object which owns\n        // both `this` and the current info we're looking at.\n        __attribute__((objc_precise_lifetime)) id self = object, current;\n        for (auto info = prev; info; info = info->prev) {\n            current = info->object;\n            f(info->object);\n        }\n        for (auto info = this; info; info = info->next) {\n            current = info->object;\n            f(info->object);\n        }\n    }\n\n    // Default move/copy constructors don't work due to the intrusive linked\n    // list and we don't need them\n    RLMObservationInfo(RLMObservationInfo const&) = delete;\n    RLMObservationInfo(RLMObservationInfo&&) = delete;\n    RLMObservationInfo& operator=(RLMObservationInfo const&) = delete;\n    RLMObservationInfo& operator=(RLMObservationInfo&&) = delete;\n};\n\n// Get the the observation info chain for the given row\n// Will simply return info if it's non-null, and will search ojectSchema's array\n// for a matching one otherwise, and return null if there are none\nRLMObservationInfo *RLMGetObservationInfo(RLMObservationInfo *info, realm::ObjKey row, RLMClassInfo& objectSchema);\n\n// delete all objects from a single table with change notifications\nvoid RLMClearTable(RLMClassInfo &realm);\n\nclass RLMObservationTracker {\npublic:\n    RLMObservationTracker(RLMRealm *realm, bool trackDeletions=false);\n    ~RLMObservationTracker();\n\n    void trackDeletions();\n\n    void willChange(RLMObservationInfo *info, NSString *key,\n                    NSKeyValueChange kind=NSKeyValueChangeSetting,\n                    NSIndexSet *indexes=nil);\n    void didChange();\n\nprivate:\n    std::vector<std::vector<RLMObservationInfo *> *> _observedTables;\n    __unsafe_unretained RLMRealm const*_realm;\n    realm::Group& _group;\n    RLMObservationInfo *_info = nullptr;\n\n    NSString *_key;\n    NSKeyValueChange _kind = NSKeyValueChangeSetting;\n    NSIndexSet *_indexes;\n\n    struct Change {\n        RLMObservationInfo *info;\n        __unsafe_unretained NSString *property;\n        NSMutableIndexSet *indexes;\n    };\n    std::vector<Change> _changes;\n    std::vector<RLMObservationInfo *> _invalidated;\n\n    template<typename CascadeNotification>\n    void cascadeNotification(CascadeNotification const&);\n};\n\nstd::vector<realm::BindingContext::ObserverState> RLMGetObservedRows(RLMSchemaInfo const& schema);\nvoid RLMWillChange(std::vector<realm::BindingContext::ObserverState> const& observed, std::vector<void *> const& invalidated);\nvoid RLMDidChange(std::vector<realm::BindingContext::ObserverState> const& observed, std::vector<void *> const& invalidated);\n\n// Used for checking if an `Object` declared with `@StateRealmObject` needs to have\n// it's accessors temporarily removed and added back so that the `Object` can be\n// managed be the Realm.\n[[clang::objc_runtime_visible]]\n@interface RLMSwiftUIKVO : NSObject\n+ (BOOL)removeObserversFromObject:(NSObject *)object;\n+ (void)addObserversToObject:(NSObject *)object;\n@end\n"
  },
  {
    "path": "Realm/RLMObservation.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMObservation.hpp\"\n\n#import \"RLMAccessor.h\"\n#import \"RLMArray_Private.hpp\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMObject_Private.hpp\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMQueryUtil.hpp\"\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMSchema_Private.h\"\n#import \"RLMSet_Private.hpp\"\n#import \"RLMSwiftCollectionBase.h\"\n#import \"RLMSwiftValueStorage.h\"\n\n#import <realm/group.hpp>\n\nusing namespace realm;\n\nnamespace {\n    template<typename Iterator>\n    struct IteratorPair {\n        Iterator first;\n        Iterator second;\n    };\n    template<typename Iterator>\n    Iterator begin(IteratorPair<Iterator> const& p) {\n        return p.first;\n    }\n    template<typename Iterator>\n    Iterator end(IteratorPair<Iterator> const& p) {\n        return p.second;\n    }\n\n    template<typename Container>\n    auto reverse(Container const& c) {\n        return IteratorPair<typename Container::const_reverse_iterator>{c.rbegin(), c.rend()};\n    }\n}\n\nRLMObservationInfo::RLMObservationInfo(RLMClassInfo &objectSchema, realm::ObjKey row, id object)\n: object(object)\n, objectSchema(&objectSchema)\n{\n    setRow(*objectSchema.table(), row);\n}\n\nRLMObservationInfo::RLMObservationInfo(id object)\n: object(object)\n{\n}\n\nRLMObservationInfo::~RLMObservationInfo() {\n    if (prev) {\n        // Not the head of the linked list, so just detach from the list\n        REALM_ASSERT_DEBUG(prev->next == this);\n        prev->next = next;\n        if (next) {\n            REALM_ASSERT_DEBUG(next->prev == this);\n            next->prev = prev;\n        }\n    }\n    else if (objectSchema) {\n        // The head of the list, so remove self from the object schema's array\n        // of observation info, either replacing self with the next info or\n        // removing entirely if there is no next\n        auto end = objectSchema->observedObjects.end();\n        auto it = find(objectSchema->observedObjects.begin(), end, this);\n        if (it != end) {\n            if (next) {\n                *it = next;\n                next->prev = nullptr;\n            }\n            else {\n                iter_swap(it, std::prev(end));\n                objectSchema->observedObjects.pop_back();\n            }\n        }\n    }\n    // Otherwise the observed object was unmanaged, so nothing to do\n\n#ifdef DEBUG\n    // ensure that incorrect cleanup fails noisily\n    object = (__bridge id)(void *)-1;\n    prev = (RLMObservationInfo *)-1;\n    next = (RLMObservationInfo *)-1;\n#endif\n}\n\nNSString *RLMObservationInfo::columnName(realm::ColKey col) const noexcept {\n    return objectSchema->propertyForTableColumn(col).name;\n}\n\nvoid RLMObservationInfo::willChange(NSString *key, NSKeyValueChange kind, NSIndexSet *indexes) const {\n    if (indexes) {\n        forEach([=](__unsafe_unretained auto o) {\n            [o willChange:kind valuesAtIndexes:indexes forKey:key];\n        });\n    }\n    else {\n        forEach([=](__unsafe_unretained auto o) {\n            [o willChangeValueForKey:key];\n        });\n    }\n}\n\nvoid RLMObservationInfo::didChange(NSString *key, NSKeyValueChange kind, NSIndexSet *indexes) const {\n    if (indexes) {\n        forEach([=](__unsafe_unretained auto o) {\n            [o didChange:kind valuesAtIndexes:indexes forKey:key];\n        });\n    }\n    else {\n        forEach([=](__unsafe_unretained auto o) {\n            [o didChangeValueForKey:key];\n        });\n    }\n}\n\nvoid RLMObservationInfo::prepareForInvalidation() {\n    REALM_ASSERT_DEBUG(objectSchema);\n    REALM_ASSERT_DEBUG(!prev);\n    for (auto info = this; info; info = info->next)\n        info->invalidated = true;\n}\n\nvoid RLMObservationInfo::setRow(realm::Table const& table, realm::ObjKey key) {\n    REALM_ASSERT_DEBUG(!row);\n    REALM_ASSERT_DEBUG(objectSchema);\n    row = table.get_object(key);\n    for (auto info : objectSchema->observedObjects) {\n        if (info->row && info->row.get_key() == key) {\n            prev = info;\n            next = info->next;\n            if (next)\n                next->prev = this;\n            info->next = this;\n            return;\n        }\n    }\n    objectSchema->observedObjects.push_back(this);\n}\n\nvoid RLMObservationInfo::recordObserver(realm::Obj& objectRow, RLMClassInfo *objectInfo,\n                                        __unsafe_unretained RLMObjectSchema *const objectSchema,\n                                        __unsafe_unretained NSString *const keyPath) {\n    ++observerCount;\n    if (row) {\n        return;\n    }\n\n    // add ourselves to the list of observed objects if this is the first time\n    // an observer is being added to a managed object\n    if (objectRow) {\n        this->objectSchema = objectInfo;\n        setRow(*objectRow.get_table(), objectRow.get_key());\n        return;\n    }\n\n    // Arrays need a reference to their containing object to avoid having to\n    // go through the awful proxy object from mutableArrayValueForKey.\n    // For managed objects we do this when the object is added or created\n    // (and have to to support notifications from modifying an object which\n    // was never observed), but for Swift classes (both RealmSwift and\n    // RLMObject) we can't do it then because we don't know what the parent\n    // object is.\n\n    NSUInteger sep = [keyPath rangeOfString:@\".\"].location;\n    NSString *key = sep == NSNotFound ? keyPath : [keyPath substringToIndex:sep];\n    RLMProperty *prop = objectSchema[key];\n    if (auto swiftAccessor = prop.swiftAccessor) {\n        [swiftAccessor observe:prop on:object];\n    }\n    else if (prop.collection) {\n        [valueForKey(key) setParent:object property:prop];\n    }\n}\n\nvoid RLMObservationInfo::removeObserver() {\n    --observerCount;\n}\n\nid RLMObservationInfo::valueForKey(NSString *key) {\n    if (invalidated) {\n        if ([key isEqualToString:RLMInvalidatedKey]) {\n            return @YES;\n        }\n        return cachedObjects[key];\n    }\n\n    if (key != lastKey) {\n        lastKey = key;\n        lastProp = objectSchema ? objectSchema->rlmObjectSchema[key] : nil;\n    }\n\n    static auto superValueForKey = reinterpret_cast<id(*)(id, SEL, NSString *)>([NSObject methodForSelector:@selector(valueForKey:)]);\n    if (!lastProp) {\n        // Not a managed property, so use NSObject's implementation of valueForKey:\n        return RLMCoerceToNil(superValueForKey(object, @selector(valueForKey:), key));\n    }\n\n    auto getSuper = [&] {\n        return row ? RLMDynamicGet(object, lastProp) : RLMCoerceToNil(superValueForKey(object, @selector(valueForKey:), key));\n    };\n\n    // We need to return the same object each time for observing over keypaths\n    // to work, so we store a cache of them here. We can't just cache them on\n    // the object as that leads to retain cycles.\n    if (lastProp.collection) {\n        id value = cachedObjects[key];\n        if (!value) {\n            value = getSuper();\n            if (!cachedObjects) {\n                cachedObjects = [NSMutableDictionary new];\n            }\n            cachedObjects[key] = value;\n        }\n        return value;\n    }\n\n    if (lastProp.type == RLMPropertyTypeObject) {\n        auto col = row.get_table()->get_column_key(lastProp.name.UTF8String);\n        if (row.is_null(col)) {\n            [cachedObjects removeObjectForKey:key];\n            return nil;\n        }\n\n        RLMObjectBase *value = cachedObjects[key];\n        if (value && value->_row.get_key() == row.get<realm::ObjKey>(col)) {\n            return value;\n        }\n        value = getSuper();\n        if (!cachedObjects) {\n            cachedObjects = [NSMutableDictionary new];\n        }\n        cachedObjects[key] = value;\n        return value;\n    }\n\n    return getSuper();\n}\n\nRLMObservationInfo *RLMGetObservationInfo(RLMObservationInfo *info, realm::ObjKey row,\n                                          RLMClassInfo& objectSchema) {\n    if (info) {\n        return info;\n    }\n\n    for (RLMObservationInfo *info : objectSchema.observedObjects) {\n        if (info->isForRow(row)) {\n            return info;\n        }\n    }\n\n    return nullptr;\n}\n\nvoid RLMClearTable(RLMClassInfo &objectSchema) {\n    if (!objectSchema.table()) {\n        // Orphaned embedded object types are included in the schema but do not\n        // create a table at all, so we may not have a table here and just\n        // don't need to do anything\n        return;\n    }\n\n    for (auto info : objectSchema.observedObjects) {\n        info->willChange(RLMInvalidatedKey);\n    }\n\n    {\n        RLMObservationTracker tracker(objectSchema.realm, true);\n        Results(objectSchema.realm->_realm, objectSchema.table()).clear();\n\n        for (auto info : objectSchema.observedObjects) {\n            info->prepareForInvalidation();\n        }\n    }\n\n    for (auto info : reverse(objectSchema.observedObjects)) {\n        info->didChange(RLMInvalidatedKey);\n    }\n\n    objectSchema.observedObjects.clear();\n}\n\nRLMObservationTracker::RLMObservationTracker(__unsafe_unretained RLMRealm *const realm, bool trackDeletions)\n: _realm(realm)\n, _group(realm.group)\n{\n    if (trackDeletions) {\n        this->trackDeletions();\n    }\n}\n\nRLMObservationTracker::~RLMObservationTracker() {\n    didChange();\n}\n\nvoid RLMObservationTracker::willChange(RLMObservationInfo *info, NSString *key,\n                                       NSKeyValueChange kind, NSIndexSet *indexes) {\n    _key = key;\n    _kind = kind;\n    _indexes = indexes;\n    _info = info;\n    if (_info) {\n        _info->willChange(key, kind, indexes);\n    }\n}\n\nvoid RLMObservationTracker::trackDeletions() {\n    if (_group.has_cascade_notification_handler()) {\n        // We're nested inside another call which will handle any cascaded changes for us\n        return;\n    }\n\n    for (auto& info : _realm->_info) {\n        if (!info.second.observedObjects.empty()) {\n            _observedTables.push_back(&info.second.observedObjects);\n        }\n    }\n\n    // No need for change tracking if no objects are observed\n    if (_observedTables.empty()) {\n        return;\n    }\n\n    _group.set_cascade_notification_handler([this](realm::Group::CascadeNotification const& cs) {\n        cascadeNotification(cs);\n    });\n}\n\ntemplate<typename CascadeNotification>\nvoid RLMObservationTracker::cascadeNotification(CascadeNotification const& cs) {\n    if (cs.rows.empty() && cs.links.empty()) {\n        return;\n    }\n\n    size_t invalidatedCount = _invalidated.size();\n    size_t changeCount = _changes.size();\n\n    auto tableKey = [](RLMObservationInfo *info) {\n        return info->getRow().get_table()->get_key();\n    };\n    std::sort(begin(_observedTables), end(_observedTables),\n              [=](auto a, auto b) { return tableKey(a->front()) < tableKey(b->front()); });\n    for (auto const& link : cs.links) {\n        auto table = std::find_if(_observedTables.begin(), _observedTables.end(), [&](auto table) {\n            return tableKey(table->front()) == link.origin_table;\n        });\n        if (table == _observedTables.end()) {\n            continue;\n        }\n\n        for (auto observer : **table) {\n            if (!observer->isForRow(link.origin_key)) {\n                continue;\n            }\n\n            NSString *name = observer->columnName(link.origin_col_key);\n            if (!link.origin_col_key.is_list()) {\n                _changes.push_back({observer, name});\n                continue;\n            }\n\n            auto c = find_if(begin(_changes), end(_changes), [&](auto const& c) {\n                return c.info == observer && c.property == name;\n            });\n            if (c == end(_changes)) {\n                _changes.push_back({observer, name, [NSMutableIndexSet new]});\n                c = prev(end(_changes));\n            }\n\n            // We know what row index is being removed from the LinkView,\n            // but what we actually want is the indexes in the LinkView that\n            // are going away\n            auto linkview = observer->getRow().get_linklist(link.origin_col_key);\n            linkview.find_all(link.old_target_key, [&](size_t index) {\n                [c->indexes addIndex:index];\n            });\n        }\n    }\n    if (!cs.rows.empty()) {\n        using Row = realm::Group::CascadeNotification::row;\n        auto begin = cs.rows.begin();\n        for (auto table : _observedTables) {\n            auto currentTableKey = tableKey(table->front());\n            if (begin->table_key < currentTableKey) {\n                // Find the first deleted object in or after this table\n                begin = std::lower_bound(begin, cs.rows.end(), Row{currentTableKey, realm::ObjKey(0)});\n            }\n            if (begin == cs.rows.end()) {\n                // No more deleted objects\n                break;\n            }\n            if (currentTableKey < begin->table_key) {\n                // Next deleted object is in a table after this one\n                continue;\n            }\n\n            // Find the end of the deletions in this table\n            auto end = std::lower_bound(begin, cs.rows.end(), Row{realm::TableKey(currentTableKey.value + 1), realm::ObjKey(0)});\n\n            // Check each observed object to see if it's in the deleted rows\n            for (auto info : *table) {\n                if (std::binary_search(begin, end, Row{currentTableKey, info->getRow().get_key()})) {\n                    _invalidated.push_back(info);\n                }\n            }\n\n            // Advance the begin iterator to the start of the next table\n            begin = end;\n            if (begin == cs.rows.end()) {\n                break;\n            }\n        }\n    }\n\n    // The relative order of these loops is very important\n    for (size_t i = invalidatedCount; i < _invalidated.size(); ++i) {\n        _invalidated[i]->willChange(RLMInvalidatedKey);\n    }\n    for (size_t i = changeCount; i < _changes.size(); ++i) {\n        auto const& change = _changes[i];\n        change.info->willChange(change.property, NSKeyValueChangeRemoval, change.indexes);\n    }\n    for (size_t i = invalidatedCount; i < _invalidated.size(); ++i) {\n        _invalidated[i]->prepareForInvalidation();\n    }\n}\n\nvoid RLMObservationTracker::didChange() {\n    if (_info) {\n        _info->didChange(_key, _kind, _indexes);\n        _info = nullptr;\n    }\n    if (_observedTables.empty()) {\n        return;\n    }\n    _group.set_cascade_notification_handler(nullptr);\n\n    for (auto const& change : reverse(_changes)) {\n        change.info->didChange(change.property, NSKeyValueChangeRemoval, change.indexes);\n    }\n    for (auto info : reverse(_invalidated)) {\n        info->didChange(RLMInvalidatedKey);\n    }\n    _observedTables.clear();\n    _changes.clear();\n    _invalidated.clear();\n}\n\nnamespace {\ntemplate<typename Func>\nvoid forEach(realm::BindingContext::ObserverState const& state, Func&& func) {\n    for (auto& change : state.changes) {\n        func(realm::ColKey(change.first), change.second, static_cast<RLMObservationInfo *>(state.info));\n    }\n}\n}\n\nstd::vector<realm::BindingContext::ObserverState> RLMGetObservedRows(RLMSchemaInfo const& schema) {\n    std::vector<realm::BindingContext::ObserverState> observers;\n    for (auto& table : schema) {\n        for (auto info : table.second.observedObjects) {\n            auto const& row = info->getRow();\n            if (!row.is_valid())\n                continue;\n            observers.push_back({\n                row.get_table()->get_key(),\n                row.get_key(),\n                info});\n        }\n    }\n    sort(begin(observers), end(observers));\n    return observers;\n}\n\nstatic NSKeyValueChange convert(realm::BindingContext::ColumnInfo::Kind kind) {\n    switch (kind) {\n        case realm::BindingContext::ColumnInfo::Kind::None:\n        case realm::BindingContext::ColumnInfo::Kind::SetAll:\n            return NSKeyValueChangeSetting;\n        case realm::BindingContext::ColumnInfo::Kind::Set:\n            return NSKeyValueChangeReplacement;\n        case realm::BindingContext::ColumnInfo::Kind::Insert:\n            return NSKeyValueChangeInsertion;\n        case realm::BindingContext::ColumnInfo::Kind::Remove:\n            return NSKeyValueChangeRemoval;\n    }\n}\n\nstatic NSIndexSet *convert(realm::IndexSet const& in, NSMutableIndexSet *out) {\n    if (in.empty()) {\n        return nil;\n    }\n\n    [out removeAllIndexes];\n    for (auto range : in) {\n        [out addIndexesInRange:{range.first, range.second - range.first}];\n    }\n    return out;\n}\n\nvoid RLMWillChange(std::vector<realm::BindingContext::ObserverState> const& observed,\n                   std::vector<void *> const& invalidated) {\n    for (auto info : invalidated) {\n        static_cast<RLMObservationInfo *>(info)->willChange(RLMInvalidatedKey);\n    }\n    if (!observed.empty()) {\n        NSMutableIndexSet *indexes = [NSMutableIndexSet new];\n        for (auto const& o : observed) {\n            forEach(o, [&](realm::ColKey colKey, auto const& change, RLMObservationInfo *info) {\n                info->willChange(info->columnName(colKey),\n                                 convert(change.kind), convert(change.indices, indexes));\n            });\n        }\n    }\n    for (auto info : invalidated) {\n        static_cast<RLMObservationInfo *>(info)->prepareForInvalidation();\n    }\n}\n\nvoid RLMDidChange(std::vector<realm::BindingContext::ObserverState> const& observed,\n                  std::vector<void *> const& invalidated) {\n    if (!observed.empty()) {\n        // Loop in reverse order to avoid O(N^2) behavior in Foundation\n        NSMutableIndexSet *indexes = [NSMutableIndexSet new];\n        for (auto const& o : reverse(observed)) {\n            forEach(o, [&](realm::ColKey col, auto const& change, RLMObservationInfo *info) {\n                info->didChange(info->columnName(col), convert(change.kind), convert(change.indices, indexes));\n            });\n        }\n    }\n    for (auto const& info : reverse(invalidated)) {\n        static_cast<RLMObservationInfo *>(info)->didChange(RLMInvalidatedKey);\n    }\n}\n"
  },
  {
    "path": "Realm/RLMPredicateUtil.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n\n#import <Foundation/Foundation.h>\n#import <functional>\n\nusing ExpressionVisitor = std::function<NSExpression *(NSExpression *)>;\nNSPredicate *transformPredicate(NSPredicate *, ExpressionVisitor);\n"
  },
  {
    "path": "Realm/RLMPredicateUtil.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n\n#import \"RLMPredicateUtil.hpp\"\n\n#include <realm/util/assert.hpp>\n\nnamespace {\n\nstruct PredicateExpressionTransformer {\n    PredicateExpressionTransformer(ExpressionVisitor visitor) : m_visitor(visitor) { }\n\n    NSExpression *visit(NSExpression *expression) const;\n    NSPredicate *visit(NSPredicate *predicate) const;\n\n    ExpressionVisitor m_visitor;\n};\n\nNSExpression *PredicateExpressionTransformer::visit(NSExpression *expression) const {\n    expression = m_visitor(expression);\n\n    switch (expression.expressionType) {\n        case NSFunctionExpressionType: {\n            NSMutableArray *arguments = [NSMutableArray array];\n            for (NSExpression *argument in expression.arguments) {\n                [arguments addObject:visit(argument)];\n            }\n            if (expression.operand) {\n                return [NSExpression expressionForFunction:visit(expression.operand) selectorName:expression.function arguments:arguments];\n            } else {\n                return [NSExpression expressionForFunction:expression.function arguments:arguments];\n            }\n        }\n\n        case NSUnionSetExpressionType:\n            return [NSExpression expressionForUnionSet:visit(expression.leftExpression) with:visit(expression.rightExpression)];\n        case NSIntersectSetExpressionType:\n            return [NSExpression expressionForIntersectSet:visit(expression.leftExpression) with:visit(expression.rightExpression)];\n        case NSMinusSetExpressionType:\n            return [NSExpression expressionForMinusSet:visit(expression.leftExpression) with:visit(expression.rightExpression)];\n\n        case NSSubqueryExpressionType: {\n            NSExpression *collection = expression.collection;\n            // NSExpression.collection is declared as id, but appears to always hold an NSExpression for subqueries.\n            REALM_ASSERT([collection isKindOfClass:[NSExpression class]]);\n            return [NSExpression expressionForSubquery:visit(collection) usingIteratorVariable:expression.variable predicate:visit(expression.predicate)];\n        }\n\n        case NSAggregateExpressionType: {\n            NSMutableArray *subexpressions = [NSMutableArray array];\n            for (NSExpression *subexpression in expression.collection) {\n                [subexpressions addObject:visit(subexpression)];\n            }\n            return [NSExpression expressionForAggregate:subexpressions];\n        }\n\n        case NSConditionalExpressionType:\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wpartial-availability\"\n            return [NSExpression expressionForConditional:visit(expression.predicate) trueExpression:visit(expression.trueExpression) falseExpression:visit(expression.falseExpression)];\n#pragma clang diagnostic pop\n\n        default:\n            // The remaining expression types do not contain nested expressions or predicates.\n            return expression;\n    }\n}\n\nNSPredicate *PredicateExpressionTransformer::visit(NSPredicate *predicate) const {\n    if ([predicate isKindOfClass:[NSCompoundPredicate class]]) {\n        NSCompoundPredicate *compoundPredicate = (NSCompoundPredicate *)predicate;\n        NSMutableArray *subpredicates = [NSMutableArray array];\n        for (NSPredicate *subpredicate in compoundPredicate.subpredicates) {\n            [subpredicates addObject:visit(subpredicate)];\n        }\n        return [[NSCompoundPredicate alloc] initWithType:compoundPredicate.compoundPredicateType subpredicates:subpredicates];\n    }\n    if ([predicate isKindOfClass:[NSComparisonPredicate class]]) {\n        NSComparisonPredicate *comparisonPredicate = (NSComparisonPredicate *)predicate;\n        NSExpression *leftExpression = visit(comparisonPredicate.leftExpression);\n        NSExpression *rightExpression = visit(comparisonPredicate.rightExpression);\n        return [NSComparisonPredicate predicateWithLeftExpression:leftExpression rightExpression:rightExpression modifier:comparisonPredicate.comparisonPredicateModifier type:comparisonPredicate.predicateOperatorType options:comparisonPredicate.options];\n    }\n    return predicate;\n}\n\n} // anonymous namespace\n\nNSPredicate *transformPredicate(NSPredicate *predicate, ExpressionVisitor visitor) {\n    PredicateExpressionTransformer transformer(visitor);\n    return transformer.visit(predicate);\n}\n"
  },
  {
    "path": "Realm/RLMPrefix.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#ifdef __OBJC__\n#import <Foundation/Foundation.h>\n#endif\n\n#ifdef __cplusplus\n#import <functional>\n#import <map>\n#import <memory>\n#import <string>\n#import <vector>\n\n#import <realm/group.hpp>\n#import <realm/link_view.hpp>\n#import <realm/row.hpp>\n#import <realm/table.hpp>\n#import <realm/table_view.hpp>\n#endif\n"
  },
  {
    "path": "Realm/RLMProperty.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n/// :nodoc:\n@protocol RLMInt @end\n/// :nodoc:\n@protocol RLMBool @end\n/// :nodoc:\n@protocol RLMDouble @end\n/// :nodoc:\n@protocol RLMFloat @end\n/// :nodoc:\n@protocol RLMString @end\n/// :nodoc:\n@protocol RLMDate @end\n/// :nodoc:\n@protocol RLMData @end\n/// :nodoc:\n@protocol RLMDecimal128 @end\n/// :nodoc:\n@protocol RLMObjectId @end\n/// :nodoc:\n@protocol RLMUUID @end\n\n/// :nodoc:\n@interface NSNumber ()<RLMInt, RLMBool, RLMDouble, RLMFloat>\n@end\n\n/**\n `RLMProperty` instances represent properties managed by a Realm in the context\n of an object schema. Such properties may be persisted to a Realm file or\n computed from other data from the Realm.\n\n When using Realm, `RLMProperty` instances allow performing migrations and\n introspecting the database's schema.\n\n These property instances map to columns in the core database.\n */\nNS_SWIFT_SENDABLE RLM_FINAL // not actually immutable, but the public API kinda is\n@interface RLMProperty : NSObject\n\n#pragma mark - Properties\n\n/**\n The name of the property.\n */\n@property (nonatomic, readonly) NSString *name;\n\n/**\n The type of the property.\n\n @see `RLMPropertyType`\n */\n@property (nonatomic, readonly) RLMPropertyType type;\n\n/**\n Indicates whether this property is indexed.\n\n @see `RLMObject`\n */\n@property (nonatomic, readonly) BOOL indexed;\n\n/**\n For `RLMObject` and `RLMCollection` properties, the name of the class of object stored in the property.\n */\n@property (nonatomic, readonly, copy, nullable) NSString *objectClassName;\n\n/**\n For linking objects properties, the property name of the property the linking objects property is linked to.\n */\n@property (nonatomic, readonly, copy, nullable) NSString *linkOriginPropertyName;\n\n/**\n Indicates whether this property is optional.\n */\n@property (nonatomic, readonly) BOOL optional;\n\n/**\n Indicates whether this property is an array.\n */\n@property (nonatomic, readonly) BOOL array;\n\n/**\n Indicates whether this property is a set.\n */\n@property (nonatomic, readonly) BOOL set;\n\n/**\n Indicates whether this property is a dictionary.\n */\n@property (nonatomic, readonly) BOOL dictionary;\n\n/**\n Indicates whether this property is an array or set.\n */\n@property (nonatomic, readonly) BOOL collection;\n\n#pragma mark - Methods\n\n/**\n Returns whether a given property object is equal to the receiver.\n */\n- (BOOL)isEqualToProperty:(RLMProperty *)property;\n\n@end\n\n\n/**\n An `RLMPropertyDescriptor` instance represents a specific property on a given class.\n */\nNS_SWIFT_SENDABLE RLM_FINAL\n@interface RLMPropertyDescriptor : NSObject\n\n/**\n Creates and returns a property descriptor.\n\n @param objectClass  The class of this property descriptor.\n @param propertyName The name of this property descriptor.\n */\n+ (instancetype)descriptorWithClass:(Class)objectClass propertyName:(NSString *)propertyName;\n\n/// The class of the property.\n@property (nonatomic, readonly) Class objectClass;\n\n/// The name of the property.\n@property (nonatomic, readonly) NSString *propertyName;\n\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMProperty.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMProperty_Private.hpp\"\n\n#import \"RLMArray_Private.hpp\"\n#import \"RLMDictionary_Private.hpp\"\n#import \"RLMObject.h\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMObject_Private.h\"\n#import \"RLMSchema_Private.h\"\n#import \"RLMSet_Private.hpp\"\n#import \"RLMSwiftSupport.h\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/object-store/property.hpp>\n\nstatic_assert((int)RLMPropertyTypeInt        == (int)realm::PropertyType::Int);\nstatic_assert((int)RLMPropertyTypeBool       == (int)realm::PropertyType::Bool);\nstatic_assert((int)RLMPropertyTypeFloat      == (int)realm::PropertyType::Float);\nstatic_assert((int)RLMPropertyTypeDouble     == (int)realm::PropertyType::Double);\nstatic_assert((int)RLMPropertyTypeString     == (int)realm::PropertyType::String);\nstatic_assert((int)RLMPropertyTypeData       == (int)realm::PropertyType::Data);\nstatic_assert((int)RLMPropertyTypeDate       == (int)realm::PropertyType::Date);\nstatic_assert((int)RLMPropertyTypeObject     == (int)realm::PropertyType::Object);\nstatic_assert((int)RLMPropertyTypeObjectId   == (int)realm::PropertyType::ObjectId);\nstatic_assert((int)RLMPropertyTypeDecimal128 == (int)realm::PropertyType::Decimal);\nstatic_assert((int)RLMPropertyTypeUUID       == (int)realm::PropertyType::UUID);\nstatic_assert((int)RLMPropertyTypeAny        == (int)realm::PropertyType::Mixed);\n\nBOOL RLMPropertyTypeIsComputed(RLMPropertyType propertyType) {\n    return propertyType == RLMPropertyTypeLinkingObjects;\n}\n\n// Swift obeys the ARC naming conventions for method families (except for init)\n// but the end result doesn't really work (using KVC on a method returning a\n// retained value results in a leak, but not returning a retained value results\n// in crashes). Objective-C makes properties with naming fitting the method\n// families a compile error, so we just disallow them in Swift as well.\n// http://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-method-families\nvoid RLMValidateSwiftPropertyName(NSString *name) {\n    // To belong to a method family, the property name must begin with the family\n    // name followed by a non-lowercase letter (or nothing), with an optional\n    // leading underscore\n    const char *str = name.UTF8String;\n    if (str[0] == '_')\n        ++str;\n    auto nameSize = strlen(str);\n\n    // Note that \"init\" is deliberately not in this list because Swift does not\n    // infer family membership for it.\n    for (auto family : {\"alloc\", \"new\", \"copy\", \"mutableCopy\"}) {\n        auto familySize = strlen(family);\n        if (nameSize < familySize || !std::equal(str, str + familySize, family)) {\n            continue;\n        }\n        if (familySize == nameSize || !islower(str[familySize])) {\n            @throw RLMException(@\"Property names beginning with '%s' are not \"\n                                 \"supported. Swift follows ARC's ownership \"\n                                 \"rules for methods based on their name, which \"\n                                 \"results in memory leaks when accessing \"\n                                 \"properties which return retained values via KVC.\",\n                                family);\n        }\n        return;\n    }\n}\n\nstatic bool rawTypeShouldBeTreatedAsComputedProperty(NSString *rawType) {\n    return [rawType isEqualToString:@\"@\\\"RLMLinkingObjects\\\"\"] || [rawType hasPrefix:@\"@\\\"RLMLinkingObjects<\"];\n}\n\n@implementation RLMProperty\n\n+ (instancetype)propertyForObjectStoreProperty:(const realm::Property &)prop {\n    auto ret = [[RLMProperty alloc] initWithName:@(prop.name.c_str())\n                                            type:static_cast<RLMPropertyType>(prop.type & ~realm::PropertyType::Flags)\n                                 objectClassName:prop.object_type.length() ? @(prop.object_type.c_str()) : nil\n                          linkOriginPropertyName:prop.link_origin_property_name.length() ? @(prop.link_origin_property_name.c_str()) : nil\n                                         indexed:prop.is_indexed\n                                        optional:isNullable(prop.type)];\n    if (is_array(prop.type)) {\n        ret->_array = true;\n    }\n    if (is_set(prop.type)) {\n        ret->_set = true;\n    }\n    if (is_dictionary(prop.type)) {\n        // TODO: We need a way to store the dictionary\n        // key type in realm::Property once we support more\n        // key types.\n        ret->_dictionaryKeyType = RLMPropertyTypeString;\n        ret->_dictionary = true;\n    }\n    if (!prop.public_name.empty()) {\n        ret->_columnName = ret->_name;\n        ret->_name = @(prop.public_name.c_str());\n    }\n    return ret;\n}\n\n- (instancetype)initWithName:(NSString *)name\n                        type:(RLMPropertyType)type\n             objectClassName:(NSString *)objectClassName\n      linkOriginPropertyName:(NSString *)linkOriginPropertyName\n                     indexed:(BOOL)indexed\n                    optional:(BOOL)optional {\n    self = [super init];\n    if (self) {\n        _name = name;\n        _type = type;\n        _objectClassName = objectClassName;\n        _linkOriginPropertyName = linkOriginPropertyName;\n        _indexed = indexed;\n        _optional = optional;\n        [self updateAccessors];\n    }\n\n    return self;\n}\n\n- (void)updateAccessors {\n    // populate getter/setter names if generic\n    if (!_getterName) {\n        _getterName = _name;\n    }\n    if (!_setterName) {\n        // Objective-C setters only capitalize the first letter of the property name if it falls between 'a' and 'z'\n        int asciiCode = [_name characterAtIndex:0];\n        BOOL shouldUppercase = asciiCode >= 'a' && asciiCode <= 'z';\n        NSString *firstChar = [_name substringToIndex:1];\n        firstChar = shouldUppercase ? firstChar.uppercaseString : firstChar;\n        _setterName = [NSString stringWithFormat:@\"set%@%@:\", firstChar, [_name substringFromIndex:1]];\n    }\n\n    _getterSel = NSSelectorFromString(_getterName);\n    _setterSel = NSSelectorFromString(_setterName);\n}\n\nstatic std::optional<RLMPropertyType> typeFromProtocolString(const char *type) {\n    if (strcmp(type, \"RLMValue>\\\"\") == 0) {\n        return RLMPropertyTypeAny;\n    }\n    if (strncmp(type, \"RLM\", 3)) {\n        return realm::none;\n    }\n    type += 3;\n    if (strcmp(type, \"Int>\\\"\") == 0) {\n        return RLMPropertyTypeInt;\n    }\n    if (strcmp(type, \"Float>\\\"\") == 0) {\n        return RLMPropertyTypeFloat;\n    }\n    if (strcmp(type, \"Double>\\\"\") == 0) {\n        return RLMPropertyTypeDouble;\n    }\n    if (strcmp(type, \"Bool>\\\"\") == 0) {\n        return RLMPropertyTypeBool;\n    }\n    if (strcmp(type, \"String>\\\"\") == 0) {\n        return RLMPropertyTypeString;\n    }\n    if (strcmp(type, \"Data>\\\"\") == 0) {\n        return RLMPropertyTypeData;\n    }\n    if (strcmp(type, \"Date>\\\"\") == 0) {\n        return RLMPropertyTypeDate;\n    }\n    if (strcmp(type, \"Decimal128>\\\"\") == 0) {\n        return RLMPropertyTypeDecimal128;\n    }\n    if (strcmp(type, \"ObjectId>\\\"\") == 0) {\n        return RLMPropertyTypeObjectId;\n    }\n    if (strcmp(type, \"UUID>\\\"\") == 0) {\n        return RLMPropertyTypeUUID;\n    }\n    return realm::none;\n}\n\n// determine RLMPropertyType from objc code - returns true if valid type was found/set\n- (BOOL)setTypeFromRawType:(NSString *)rawType {\n    const char *code = rawType.UTF8String;\n    switch (*code) {\n        case 's':   // short\n        case 'i':   // int\n        case 'l':   // long\n        case 'q':   // long long\n            _type = RLMPropertyTypeInt;\n            return YES;\n        case 'f':\n            _type = RLMPropertyTypeFloat;\n            return YES;\n        case 'd':\n            _type = RLMPropertyTypeDouble;\n            return YES;\n        case 'c':   // BOOL is stored as char - since rlm has no char type this is ok\n        case 'B':\n            _type = RLMPropertyTypeBool;\n            return YES;\n        case '@':\n            break;\n        default:\n            return NO;\n    }\n\n    _optional = true;\n    static const char arrayPrefix[] = \"@\\\"RLMArray<\";\n    static const int arrayPrefixLen = sizeof(arrayPrefix) - 1;\n\n    static const char setPrefix[] = \"@\\\"RLMSet<\";\n    static const int setPrefixLen = sizeof(setPrefix) - 1;\n\n    static const char dictionaryPrefix[] = \"@\\\"RLMDictionary<\";\n    static const int dictionaryPrefixLen = sizeof(dictionaryPrefix) - 1;\n\n    static const char numberPrefix[] = \"@\\\"NSNumber<\";\n    static const int numberPrefixLen = sizeof(numberPrefix) - 1;\n\n    static const char linkingObjectsPrefix[] = \"@\\\"RLMLinkingObjects\";\n    static const int linkingObjectsPrefixLen = sizeof(linkingObjectsPrefix) - 1;\n\n    _array = strncmp(code, arrayPrefix, arrayPrefixLen) == 0;\n    _set = strncmp(code, setPrefix, setPrefixLen) == 0;\n    _dictionary = strncmp(code, dictionaryPrefix, dictionaryPrefixLen) == 0;\n\n    if (strcmp(code, \"@\\\"NSString\\\"\") == 0) {\n        _type = RLMPropertyTypeString;\n    }\n    else if (strcmp(code, \"@\\\"NSDate\\\"\") == 0) {\n        _type = RLMPropertyTypeDate;\n    }\n    else if (strcmp(code, \"@\\\"NSData\\\"\") == 0) {\n        _type = RLMPropertyTypeData;\n    }\n    else if (strcmp(code, \"@\\\"RLMDecimal128\\\"\") == 0) {\n        _type = RLMPropertyTypeDecimal128;\n    }\n    else if (strcmp(code, \"@\\\"RLMObjectId\\\"\") == 0) {\n        _type = RLMPropertyTypeObjectId;\n    }\n    else if (strcmp(code, \"@\\\"NSUUID\\\"\") == 0) {\n        _type = RLMPropertyTypeUUID;\n    }\n    else if (strcmp(code, \"@\\\"<RLMValue>\\\"\") == 0) {\n        _type = RLMPropertyTypeAny;\n        // Mixed can represent a null type but can't explicitly be an optional type.\n        _optional = false;\n    }\n    else if (_array || _set || _dictionary) {\n        size_t prefixLen = 0;\n        NSString *collectionName;\n        if (_array) {\n            prefixLen = arrayPrefixLen;\n            collectionName = @\"RLMArray\";\n        }\n        else if (_set) {\n            prefixLen = setPrefixLen;\n            collectionName = @\"RLMSet\";\n        }\n        else if (_dictionary) {\n            // get the type, by working backward from RLMDictionary<Key, Type>\n            size_t typeLen = 0;\n            size_t codeSize = strlen(code);\n            for (size_t i = codeSize; i > 0; i--) {\n                if (code[i] == '>' && i != (codeSize-2)) { // -2 means we skip the first time we see '>'\n                    typeLen = i;\n                    break;\n                }\n            }\n            prefixLen = typeLen+size_t(2); // +2 start at the type name\n            collectionName = @\"RLMDictionary\";\n\n            // Get the key type\n            if (strstr(code + dictionaryPrefixLen, \"RLMString><\") != NULL) {\n                _dictionaryKeyType = RLMPropertyTypeString;\n            }\n        }\n\n        if (auto type = typeFromProtocolString(code + prefixLen)) {\n            _type = *type;\n            return YES;\n        }\n\n        // get object class from type string - @\"RLMSomeCollection<objectClassName>\"\n        _objectClassName = [[NSString alloc] initWithBytes:code + prefixLen\n                                                    length:strlen(code + prefixLen) - 2 // drop trailing >\"\n                                                  encoding:NSUTF8StringEncoding];\n\n        if ([RLMSchema classForString:_objectClassName]) {\n            // Dictionaries require object types to be nullable. This is due to\n            // the fact that if you delete a realm object that exists in a dictionary\n            // the key should stay present but the value should be null.\n            _optional = _dictionary;\n            _type = RLMPropertyTypeObject;\n            return YES;\n        }\n        @throw RLMException(@\"Property '%@' is of type '%@<%@>' which is not a supported %@ object type. \"\n                            @\"%@ can only contain instances of RLMObject subclasses. \"\n                            @\"See https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/model-data/relationships/#define-a-to-many-relationship-property \"\n                            @\"for more information.\", _name, collectionName, _objectClassName, collectionName, collectionName);\n    }\n    else if (strncmp(code, numberPrefix, numberPrefixLen) == 0) {\n        auto type = typeFromProtocolString(code + numberPrefixLen);\n        if (type && (*type == RLMPropertyTypeInt || *type == RLMPropertyTypeFloat || *type == RLMPropertyTypeDouble || *type == RLMPropertyTypeBool)) {\n            _type = *type;\n            return YES;\n        }\n        @throw RLMException(@\"Property '%@' is of type %s which is not a supported NSNumber object type. \"\n                            @\"NSNumbers can only be RLMInt, RLMFloat, RLMDouble, and RLMBool at the moment. \"\n                            @\"See https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/model-data/supported-types/#std-label-ios-supported-property-types\"\n                            @\"for more information.\", _name, code + 1);\n    }\n    else if (strncmp(code, linkingObjectsPrefix, linkingObjectsPrefixLen) == 0 &&\n             (code[linkingObjectsPrefixLen] == '\"' || code[linkingObjectsPrefixLen] == '<')) {\n        _type = RLMPropertyTypeLinkingObjects;\n        _optional = false;\n        _array = true;\n\n        if (!_objectClassName || !_linkOriginPropertyName) {\n            @throw RLMException(@\"Property '%@' is of type RLMLinkingObjects but +linkingObjectsProperties did not specify the class \"\n                                \"or property that is the origin of the link.\", _name);\n        }\n\n        // If the property was declared with a protocol indicating the contained type, validate that it matches\n        // the class from the dictionary returned by +linkingObjectsProperties.\n        if (code[linkingObjectsPrefixLen] == '<') {\n            NSString *classNameFromProtocol = [[NSString alloc] initWithBytes:code + linkingObjectsPrefixLen + 1\n                                                                       length:strlen(code + linkingObjectsPrefixLen) - 3 // drop trailing >\"\n                                                                     encoding:NSUTF8StringEncoding];\n            if (![_objectClassName isEqualToString:classNameFromProtocol]) {\n                @throw RLMException(@\"Property '%@' was declared with type RLMLinkingObjects<%@>, but a conflicting \"\n                                    \"class name of '%@' was returned by +linkingObjectsProperties.\", _name,\n                                    classNameFromProtocol, _objectClassName);\n            }\n        }\n    }\n    else if (strcmp(code, \"@\\\"NSNumber\\\"\") == 0) {\n        @throw RLMException(@\"Property '%@' requires a protocol defining the contained type - example: NSNumber<RLMInt>.\", _name);\n    }\n    else if (strcmp(code, \"@\\\"RLMArray\\\"\") == 0) {\n        @throw RLMException(@\"Property '%@' requires a protocol defining the contained type - example: RLMArray<Person>.\", _name);\n    }\n    else if (strcmp(code, \"@\\\"RLMSet\\\"\") == 0) {\n        @throw RLMException(@\"Property '%@' requires a protocol defining the contained type - example: RLMSet<Person>.\", _name);\n    }\n    else if (strcmp(code, \"@\\\"RLMDictionary\\\"\") == 0) {\n        @throw RLMException(@\"Property '%@' requires a protocol defining the contained type - example: RLMDictionary<NSString *, Person *><RLMString, Person>.\", _name);\n    }\n    else {\n        NSString *className;\n        Class cls = nil;\n        if (code[1] == '\\0') {\n            className = @\"id\";\n        }\n        else {\n            // for objects strip the quotes and @\n            className = [rawType substringWithRange:NSMakeRange(2, rawType.length-3)];\n            cls = [RLMSchema classForString:className];\n        }\n\n        if (!cls) {\n            @throw RLMException(@\"Property '%@' is declared as '%@', which is not a supported RLMObject property type. \"\n                                @\"All properties must be primitives, NSString, NSDate, NSData, NSNumber, RLMArray, RLMSet, \"\n                                @\"RLMDictionary, RLMLinkingObjects, RLMDecimal128, RLMObjectId, or subclasses of RLMObject. \"\n                                @\"See https://www.mongodb.com/docs/realm-legacy/docs/objc/latest/api/Classes/RLMObject.html \"\n                                @\"for more information.\", _name, className);\n        }\n\n        _type = RLMPropertyTypeObject;\n        _optional = true;\n        _objectClassName = [cls className] ?: className;\n    }\n    return YES;\n}\n\n- (void)parseObjcProperty:(objc_property_t)property\n                 readOnly:(bool *)readOnly\n                 computed:(bool *)computed\n                  rawType:(NSString **)rawType {\n    unsigned int count;\n    objc_property_attribute_t *attrs = property_copyAttributeList(property, &count);\n\n    *computed = true;\n    for (size_t i = 0; i < count; ++i) {\n        switch (*attrs[i].name) {\n            case 'T':\n                *rawType = @(attrs[i].value);\n                break;\n            case 'R':\n                *readOnly = true;\n                break;\n            case 'G':\n                _getterName = @(attrs[i].value);\n                break;\n            case 'S':\n                _setterName = @(attrs[i].value);\n                break;\n            case 'V': // backing ivar name\n                *computed = false;\n                break;\n\n            case '&':\n                // retain/assign\n                break;\n            case 'C':\n                // copy\n                break;\n            case 'D':\n                // dynamic\n                break;\n            case 'N':\n                // nonatomic\n                break;\n            case 'P':\n                // GC'able\n                break;\n            case 'W':\n                // weak\n                break;\n            default:\n                break;\n        }\n    }\n    free(attrs);\n}\n\n- (instancetype)initSwiftPropertyWithName:(NSString *)name\n                                  indexed:(BOOL)indexed\n                   linkPropertyDescriptor:(RLMPropertyDescriptor *)linkPropertyDescriptor\n                                 property:(objc_property_t)property\n                                 instance:(RLMObject *)obj {\n    self = [super init];\n    if (!self) {\n        return nil;\n    }\n\n    RLMValidateSwiftPropertyName(name);\n\n    _name = name;\n    _indexed = indexed;\n\n    if (linkPropertyDescriptor) {\n        _objectClassName = [linkPropertyDescriptor.objectClass className];\n        _linkOriginPropertyName = linkPropertyDescriptor.propertyName;\n    }\n\n    NSString *rawType;\n    bool readOnly = false;\n    bool isComputed = false;\n    [self parseObjcProperty:property readOnly:&readOnly computed:&isComputed rawType:&rawType];\n\n    // Swift sometimes doesn't explicitly set the ivar name in the metadata, so check if\n    // there's an ivar with the same name as the property.\n    if (!readOnly && isComputed && class_getInstanceVariable([obj class], name.UTF8String)) {\n        isComputed = false;\n    }\n\n    // Check if there's a storage ivar for a lazy property in this name. We don't honor\n    // @lazy in managed objects, but allow it for unmanaged objects which are\n    // subclasses of RLMObject (but not RealmSwift.Object). It's unclear if there's a\n    // good reason for this difference.\n    if (!readOnly && isComputed) {\n        // Xcode 10 and earlier\n        NSString *backingPropertyName = [NSString stringWithFormat:@\"%@.storage\", name];\n        isComputed = !class_getInstanceVariable([obj class], backingPropertyName.UTF8String);\n    }\n    if (!readOnly && isComputed) {\n        // Xcode 11\n        NSString *backingPropertyName = [NSString stringWithFormat:@\"$__lazy_storage_$_%@\", name];\n        isComputed = !class_getInstanceVariable([obj class], backingPropertyName.UTF8String);\n    }\n\n    if (readOnly || isComputed) {\n        return nil;\n    }\n\n    id propertyValue = [obj valueForKey:_name];\n\n    // FIXME: temporarily workaround added since Objective-C generics used in Swift show up as `@`\n    //        * broken starting in Swift 3.0 Xcode 8 b1\n    //        * tested to still be broken in Swift 3.0 Xcode 8 b6\n    //        * if the Realm Objective-C Swift tests pass with this removed, it's been fixed\n    //        * once it has been fixed, remove this entire conditional block (contents included) entirely\n    //        * Bug Report: SR-2031 https://bugs.swift.org/browse/SR-2031\n    if ([rawType isEqualToString:@\"@\"]) {\n        if (propertyValue) {\n            rawType = [NSString stringWithFormat:@\"@\\\"%@\\\"\", [propertyValue class]];\n        } else if (linkPropertyDescriptor) {\n            // we're going to naively assume that the user used the correct type since we can't check it\n            rawType = @\"@\\\"RLMLinkingObjects\\\"\";\n        }\n    }\n\n    // convert array / set / dictionary types to objc variant\n    if ([rawType isEqualToString:@\"@\\\"RLMArray\\\"\"]) {\n        RLMArray *value = propertyValue;\n        _type = value.type;\n        _optional = value.optional;\n        _array = true;\n        _objectClassName = value.objectClassName;\n        if (_type == RLMPropertyTypeObject && ![RLMSchema classForString:_objectClassName]) {\n            @throw RLMException(@\"Property '%@' is of type 'RLMArray<%@>' which is not a supported RLMArray object type. \"\n                                @\"RLMArrays can only contain instances of RLMObject subclasses. \"\n                                @\"See https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/model-data/relationships/#define-a-to-many-relationship-property \"\n                                @\"for more information.\", _name, _objectClassName);\n        }\n    }\n    else if ([rawType isEqualToString:@\"@\\\"RLMSet\\\"\"]) {\n        RLMSet *value = propertyValue;\n        _type = value.type;\n        _optional = value.optional;\n        _set = true;\n        _objectClassName = value.objectClassName;\n        if (_type == RLMPropertyTypeObject && ![RLMSchema classForString:_objectClassName]) {\n            @throw RLMException(@\"Property '%@' is of type 'RLMSet<%@>' which is not a supported RLMSet object type. \"\n                                @\"RLMSets can only contain instances of RLMObject subclasses. \"\n                                @\"See https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/model-data/relationships/#define-a-to-many-relationship-property \"\n                                @\"for more information.\", _name, _objectClassName);\n        }\n    }\n    else if ([rawType isEqualToString:@\"@\\\"RLMDictionary\\\"\"]) {\n        RLMDictionary *value = propertyValue;\n        _type = value.type;\n        _dictionaryKeyType = value.keyType;\n        _optional = value.optional;\n        _dictionary = true;\n        _objectClassName = value.objectClassName;\n        if (_type == RLMPropertyTypeObject && ![RLMSchema classForString:_objectClassName]) {\n            @throw RLMException(@\"Property '%@' is of type 'RLMDictionary<KeyType, %@>' which is not a supported RLMDictionary object type. \"\n                                @\"RLMDictionarys can only contain instances of RLMObject subclasses. \"\n                                @\"See https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/model-data/relationships/#define-a-to-many-relationship-property \"\n                                @\"for more information.\", _name, _objectClassName);\n        }\n    }\n    else if ([rawType isEqualToString:@\"@\\\"NSNumber\\\"\"]) {\n        const char *numberType = [propertyValue objCType];\n        if (!numberType) {\n            @throw RLMException(@\"Can't persist NSNumber without default value: use a Swift-native number type or provide a default value.\");\n        }\n        _optional = true;\n        switch (*numberType) {\n            case 'i': case 'l': case 'q':\n                _type = RLMPropertyTypeInt;\n                break;\n            case 'f':\n                _type = RLMPropertyTypeFloat;\n                break;\n            case 'd':\n                _type = RLMPropertyTypeDouble;\n                break;\n            case 'B': case 'c':\n                _type = RLMPropertyTypeBool;\n                break;\n            default:\n                @throw RLMException(@\"Can't persist NSNumber of type '%s': only integers, floats, doubles, and bools are currently supported.\", numberType);\n        }\n    }\n    else if (![self setTypeFromRawType:rawType]) {\n        @throw RLMException(@\"Can't persist property '%@' with incompatible type. \"\n                            \"Add to Object.ignoredProperties() class method to ignore.\",\n                            self.name);\n    }\n\n    if ([rawType isEqualToString:@\"c\"]) {\n        // Check if it's a BOOL or Int8 by trying to set it to 2 and seeing if\n        // it actually sets it to 1.\n        [obj setValue:@2 forKey:name];\n        NSNumber *value = [obj valueForKey:name];\n        _type = value.intValue == 2 ? RLMPropertyTypeInt : RLMPropertyTypeBool;\n    }\n\n    // update getter/setter names\n    [self updateAccessors];\n\n    return self;\n}\n\n- (instancetype)initWithName:(NSString *)name\n                     indexed:(BOOL)indexed\n      linkPropertyDescriptor:(RLMPropertyDescriptor *)linkPropertyDescriptor\n                    property:(objc_property_t)property\n{\n    self = [super init];\n    if (!self) {\n        return nil;\n    }\n\n    _name = name;\n    _indexed = indexed;\n\n    if (linkPropertyDescriptor) {\n        _objectClassName = [linkPropertyDescriptor.objectClass className];\n        _linkOriginPropertyName = linkPropertyDescriptor.propertyName;\n    }\n\n    NSString *rawType;\n    bool isReadOnly = false;\n    bool isComputed = false;\n    [self parseObjcProperty:property readOnly:&isReadOnly computed:&isComputed rawType:&rawType];\n    bool shouldBeTreatedAsComputedProperty = rawTypeShouldBeTreatedAsComputedProperty(rawType);\n    if ((isReadOnly || isComputed) && !shouldBeTreatedAsComputedProperty) {\n        return nil;\n    }\n\n    if (![self setTypeFromRawType:rawType]) {\n        @throw RLMException(@\"Can't persist property '%@' with incompatible type. \"\n                             \"Add to ignoredPropertyNames: method to ignore.\", self.name);\n    }\n\n    if (!isReadOnly && shouldBeTreatedAsComputedProperty) {\n        @throw RLMException(@\"Property '%@' must be declared as readonly as %@ properties cannot be written to.\",\n                            self.name, RLMTypeToString(_type));\n    }\n\n    // update getter/setter names\n    [self updateAccessors];\n\n    return self;\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    RLMProperty *prop = [[RLMProperty allocWithZone:zone] init];\n    prop->_name = _name;\n    prop->_columnName = _columnName;\n    prop->_type = _type;\n    prop->_objectClassName = _objectClassName;\n    prop->_array = _array;\n    prop->_set = _set;\n    prop->_dictionary = _dictionary;\n    prop->_dictionaryKeyType = _dictionaryKeyType;\n    prop->_indexed = _indexed;\n    prop->_getterName = _getterName;\n    prop->_setterName = _setterName;\n    prop->_getterSel = _getterSel;\n    prop->_setterSel = _setterSel;\n    prop->_isPrimary = _isPrimary;\n    prop->_swiftAccessor = _swiftAccessor;\n    prop->_swiftIvar = _swiftIvar;\n    prop->_optional = _optional;\n    prop->_linkOriginPropertyName = _linkOriginPropertyName;\n    return prop;\n}\n\n- (RLMProperty *)copyWithNewName:(NSString *)name {\n    RLMProperty *prop = [self copy];\n    prop.name = name;\n    return prop;\n}\n\n- (BOOL)isEqual:(id)object {\n    if (![object isKindOfClass:[RLMProperty class]]) {\n        return NO;\n    }\n\n    return [self isEqualToProperty:object];\n}\n\n- (BOOL)isEqualToProperty:(RLMProperty *)property {\n    return _type == property->_type\n        && _indexed == property->_indexed\n        && _isPrimary == property->_isPrimary\n        && _optional == property->_optional\n        && [_name isEqualToString:property->_name]\n        && (_objectClassName == property->_objectClassName  || [_objectClassName isEqualToString:property->_objectClassName])\n        && (_linkOriginPropertyName == property->_linkOriginPropertyName ||\n            [_linkOriginPropertyName isEqualToString:property->_linkOriginPropertyName]);\n}\n\n- (BOOL)collection {\n    return self.set || self.array || self.dictionary;\n}\n\n- (NSString *)description {\n    NSString *objectClassName = @\"\";\n    if (self.type == RLMPropertyTypeObject || self.type == RLMPropertyTypeLinkingObjects) {\n        objectClassName = [NSString stringWithFormat:\n                           @\"\\tobjectClassName = %@;\\n\"\n                           @\"\\tlinkOriginPropertyName = %@;\\n\",\n                           self.objectClassName, self.linkOriginPropertyName];\n    }\n    return [NSString stringWithFormat:\n            @\"%@ {\\n\"\n             \"\\ttype = %@;\\n\"\n             \"%@\"\n             \"\\tcolumnName = %@;\\n\"\n             \"\\tindexed = %@;\\n\"\n             \"\\tisPrimary = %@;\\n\"\n             \"\\tarray = %@;\\n\"\n             \"\\tset = %@;\\n\"\n             \"\\tdictionary = %@;\\n\"\n             \"\\toptional = %@;\\n\"\n             \"}\",\n            self.name, RLMTypeToString(self.type),\n            objectClassName,\n            self.columnName,\n            self.indexed ? @\"YES\" : @\"NO\",\n            self.isPrimary ? @\"YES\" : @\"NO\",\n            self.array ? @\"YES\" : @\"NO\",\n            self.set ? @\"YES\" : @\"NO\",\n            self.dictionary ? @\"YES\" : @\"NO\",\n            self.optional ? @\"YES\" : @\"NO\"];\n}\n\n- (NSString *)columnName {\n    return _columnName ?: _name;\n}\n\n- (realm::Property)objectStoreCopy:(RLMSchema *)schema {\n    realm::Property p;\n    p.name = self.columnName.UTF8String;\n    if (_columnName) {\n        p.public_name = _name.UTF8String;\n    }\n    if (_objectClassName) {\n        RLMObjectSchema *targetSchema = schema[_objectClassName];\n        p.object_type = (targetSchema.objectName ?: _objectClassName).UTF8String;\n        if (_linkOriginPropertyName) {\n            p.link_origin_property_name = (targetSchema[_linkOriginPropertyName].columnName ?: _linkOriginPropertyName).UTF8String;\n        }\n    }\n    p.is_indexed = static_cast<bool>(_indexed);\n    p.type = static_cast<realm::PropertyType>(_type);\n    if (_array) {\n        p.type |= realm::PropertyType::Array;\n    }\n    if (_set) {\n        p.type |= realm::PropertyType::Set;\n    }\n    if (_dictionary) {\n        p.type |= realm::PropertyType::Dictionary;\n    }\n    if (_optional || p.type == realm::PropertyType::Mixed) {\n        p.type |= realm::PropertyType::Nullable;\n    }\n    return p;\n}\n\n- (NSString *)typeName {\n    if (!self.collection) {\n        return RLMTypeToString(_type);\n    }\n    NSString *collectionName;\n    if (_swiftAccessor) {\n        collectionName = _array ? @\"List\" :\n                         _set   ? @\"MutableSet\" :\n                                  @\"Map\";\n    }\n    else {\n        collectionName = _array ? @\"RLMArray\" :\n                         _set   ? @\"RLMSet\" :\n                                  @\"RLMDictionary\";\n    }\n    return [NSString stringWithFormat:@\"%@<%@>\", collectionName, RLMTypeToString(_type)];\n}\n\n@end\n\n@implementation RLMPropertyDescriptor\n\n+ (instancetype)descriptorWithClass:(Class)objectClass propertyName:(NSString *)propertyName\n{\n    RLMPropertyDescriptor *descriptor = [[RLMPropertyDescriptor alloc] init];\n    descriptor->_objectClass = objectClass;\n    descriptor->_propertyName = propertyName;\n    return descriptor;\n}\n\n@end\n"
  },
  {
    "path": "Realm/RLMProperty_Private.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMProperty.h>\n\n#import <objc/runtime.h>\n\n@class RLMObjectBase;\n\nRLM_HEADER_AUDIT_BEGIN(nullability)\n\nBOOL RLMPropertyTypeIsComputed(RLMPropertyType propertyType);\nFOUNDATION_EXTERN void RLMValidateSwiftPropertyName(NSString *name);\n\n// Translate an rlmtype to a string representation\nstatic inline NSString *RLMTypeToString(RLMPropertyType type) {\n    switch (type) {\n        case RLMPropertyTypeString:\n            return @\"string\";\n        case RLMPropertyTypeInt:\n            return @\"int\";\n        case RLMPropertyTypeBool:\n            return @\"bool\";\n        case RLMPropertyTypeDate:\n            return @\"date\";\n        case RLMPropertyTypeData:\n            return @\"data\";\n        case RLMPropertyTypeDouble:\n            return @\"double\";\n        case RLMPropertyTypeFloat:\n            return @\"float\";\n        case RLMPropertyTypeAny:\n            return @\"mixed\";\n        case RLMPropertyTypeObject:\n            return @\"object\";\n        case RLMPropertyTypeLinkingObjects:\n            return @\"linking objects\";\n        case RLMPropertyTypeDecimal128:\n            return @\"decimal128\";\n        case RLMPropertyTypeObjectId:\n            return @\"object id\";\n        case RLMPropertyTypeUUID:\n            return @\"uuid\";\n    }\n    return @\"Unknown\";\n}\n\n// private property interface\n@interface RLMProperty () {\n@public\n    RLMPropertyType _type;\n}\n\n- (instancetype)initWithName:(NSString *)name\n                     indexed:(BOOL)indexed\n      linkPropertyDescriptor:(nullable RLMPropertyDescriptor *)linkPropertyDescriptor\n                    property:(objc_property_t)property;\n\n- (instancetype)initSwiftPropertyWithName:(NSString *)name\n                                  indexed:(BOOL)indexed\n                   linkPropertyDescriptor:(nullable RLMPropertyDescriptor *)linkPropertyDescriptor\n                                 property:(objc_property_t)property\n                                 instance:(RLMObjectBase *)objectInstance;\n\n- (void)updateAccessors;\n\n// private setters\n@property (nonatomic, readwrite) NSString *name;\n@property (nonatomic, readwrite, assign) RLMPropertyType type;\n@property (nonatomic, readwrite) BOOL indexed;\n@property (nonatomic, readwrite) BOOL optional;\n@property (nonatomic, readwrite) BOOL array;\n@property (nonatomic, readwrite) BOOL set;\n@property (nonatomic, readwrite) BOOL dictionary;\n@property (nonatomic, copy, nullable) NSString *objectClassName;\n@property (nonatomic, copy, nullable) NSString *linkOriginPropertyName;\n\n// private properties\n@property (nonatomic, readwrite, nullable) NSString *columnName;\n@property (nonatomic, assign) NSUInteger index;\n@property (nonatomic, assign) BOOL isPrimary;\n@property (nonatomic, assign) BOOL isLegacy;\n@property (nonatomic, assign) ptrdiff_t swiftIvar;\n@property (nonatomic, assign, nullable) Class swiftAccessor;\n@property (nonatomic, readwrite, assign) RLMPropertyType dictionaryKeyType;\n@property (nonatomic, readwrite) BOOL customMappingIsOptional;\n\n// getter and setter names\n@property (nonatomic, copy) NSString *getterName;\n@property (nonatomic, copy) NSString *setterName;\n@property (nonatomic, nullable) SEL getterSel;\n@property (nonatomic, nullable) SEL setterSel;\n\n- (RLMProperty *)copyWithNewName:(NSString *)name;\n- (NSString *)typeName;\n\n@end\n\n@interface RLMProperty (Dynamic)\n/**\n This method is useful only in specialized circumstances, for example, in conjunction with\n +[RLMObjectSchema initWithClassName:objectClass:properties:]. If you are simply building an\n app on Realm, it is not recommended to use this method.\n\n Initialize an RLMProperty\n\n @warning This method is useful only in specialized circumstances.\n\n @param name            The property name.\n @param type            The property type.\n @param objectClassName The object type used for Object and Array types.\n @param linkOriginPropertyName The property name of the origin of a link. Used for linking objects properties.\n\n @return    An initialized instance of RLMProperty.\n */\n- (instancetype)initWithName:(NSString *)name\n                        type:(RLMPropertyType)type\n             objectClassName:(nullable NSString *)objectClassName\n      linkOriginPropertyName:(nullable NSString *)linkOriginPropertyName\n                     indexed:(BOOL)indexed\n                    optional:(BOOL)optional;\n@end\n\nRLM_HEADER_AUDIT_END(nullability)\n"
  },
  {
    "path": "Realm/RLMProperty_Private.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2016 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMProperty_Private.h>\n\n#import <realm/object-store/property.hpp>\n\n@class RLMSchema;\n\nRLM_DIRECT_MEMBERS\n@interface RLMProperty ()\n+ (instancetype)propertyForObjectStoreProperty:(const realm::Property&)property;\n- (realm::Property)objectStoreCopy:(RLMSchema *)schema;\n@end\n\nstatic inline bool isNullable(const realm::PropertyType& t) {\n    return t != realm::PropertyType::Mixed && is_nullable(t);\n}\n"
  },
  {
    "path": "Realm/RLMQueryUtil.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Foundation/Foundation.h>\n\n#import <vector>\n\nnamespace realm {\n    class Group;\n    class Query;\n    class SortDescriptor;\n}\n\n@class RLMObjectSchema, RLMProperty, RLMSchema, RLMSortDescriptor;\nclass RLMClassInfo;\n\nrealm::Query RLMPredicateToQuery(NSPredicate *predicate, RLMObjectSchema *objectSchema,\n                                 RLMSchema *schema, realm::Group &group);\n\n// return property - throw for invalid column name\nRLMProperty *RLMValidatedProperty(RLMObjectSchema *objectSchema, NSString *columnName);\n"
  },
  {
    "path": "Realm/RLMQueryUtil.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMQueryUtil.hpp\"\n\n#import \"RLMAccessor.hpp\"\n#import \"RLMGeospatial_Private.hpp\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMObject_Private.hpp\"\n#import \"RLMPredicateUtil.hpp\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMSchema.h\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/geospatial.hpp>\n#import <realm/object-store/object_store.hpp>\n#import <realm/object-store/results.hpp>\n#import <realm/path.hpp>\n#import <realm/query_engine.hpp>\n#import <realm/query_expression.hpp>\n#import <realm/util/cf_ptr.hpp>\n#import <realm/util/overload.hpp>\n\nusing namespace realm;\n\nnamespace {\nNSString * const RLMPropertiesComparisonTypeMismatchException = @\"RLMPropertiesComparisonTypeMismatchException\";\nNSString * const RLMPropertiesComparisonTypeMismatchReason = @\"Property type mismatch between %@ and %@\";\n\n// small helper to create the many exceptions thrown when parsing predicates\n[[gnu::cold]] [[noreturn]]\nvoid throwException(NSString *name, NSString *format, ...) {\n    va_list args;\n    va_start(args, format);\n    NSString *reason = [[NSString alloc] initWithFormat:format arguments:args];\n    va_end(args);\n\n    @throw [NSException exceptionWithName:name reason:reason userInfo:nil];\n}\n\n// check a precondition and throw an exception if it is not met\n// this should be used iff the condition being false indicates a bug in the caller\n// of the function checking its preconditions\nvoid RLMPrecondition(bool condition, NSString *name, NSString *format, ...) {\n    if (__builtin_expect(condition, 1)) {\n        return;\n    }\n\n    va_list args;\n    va_start(args, format);\n    NSString *reason = [[NSString alloc] initWithFormat:format arguments:args];\n    va_end(args);\n\n    @throw [NSException exceptionWithName:name reason:reason userInfo:nil];\n}\n\nBOOL propertyTypeIsNumeric(RLMPropertyType propertyType) {\n    switch (propertyType) {\n        case RLMPropertyTypeInt:\n        case RLMPropertyTypeFloat:\n        case RLMPropertyTypeDouble:\n        case RLMPropertyTypeDecimal128:\n        case RLMPropertyTypeDate:\n        case RLMPropertyTypeAny:\n            return YES;\n        default:\n            return NO;\n    }\n}\n\nbool propertyTypeIsLink(RLMPropertyType type) {\n    return type == RLMPropertyTypeObject || type == RLMPropertyTypeLinkingObjects;\n}\n\nbool isObjectValidForProperty(id value, RLMProperty *prop) {\n    if (prop.collection) {\n        if (propertyTypeIsLink(prop.type)) {\n            RLMObjectBase *obj = RLMDynamicCast<RLMObjectBase>(value);\n            if (!obj) {\n                obj = RLMDynamicCast<RLMObjectBase>(RLMBridgeSwiftValue(value));\n            }\n            if (!obj) {\n                return false;\n            }\n            return [RLMObjectBaseObjectSchema(obj).className isEqualToString:prop.objectClassName];\n        }\n        return RLMValidateValue(value, prop.type, prop.optional, false, nil);\n    }\n    return RLMIsObjectValidForProperty(value, prop);\n}\n\n\n// Equal and ContainsSubstring are used by QueryBuilder::add_string_constraint as the comparator\n// for performing diacritic-insensitive comparisons.\n\nStringData get_string(Mixed const& m) {\n    if (m.is_null())\n        return StringData();\n    if (m.get_type() == type_String)\n        return m.get_string();\n    auto b = m.get_binary();\n    return StringData(b.data(), b.size());\n}\n\nbool equal(CFStringCompareFlags options, StringData v1, StringData v2)\n{\n    if (v1.is_null() || v2.is_null()) {\n        return v1.is_null() == v2.is_null();\n    }\n\n    auto s1 = util::adoptCF(CFStringCreateWithBytesNoCopy(kCFAllocatorSystemDefault, (const UInt8*)v1.data(), v1.size(),\n                                                          kCFStringEncodingUTF8, false, kCFAllocatorNull));\n    auto s2 = util::adoptCF(CFStringCreateWithBytesNoCopy(kCFAllocatorSystemDefault, (const UInt8*)v2.data(), v2.size(),\n                                                          kCFStringEncodingUTF8, false, kCFAllocatorNull));\n\n    return CFStringCompare(s1.get(), s2.get(), options) == kCFCompareEqualTo;\n}\n\ntemplate <CFStringCompareFlags options>\nstruct Equal {\n    using CaseSensitive = Equal<options & ~kCFCompareCaseInsensitive>;\n    using CaseInsensitive = Equal<options | kCFCompareCaseInsensitive>;\n\n    bool operator()(Mixed v1, Mixed v2) const\n    {\n        return equal(options, get_string(v1), get_string(v2));\n    }\n\n    static const char* description() { return options & kCFCompareCaseInsensitive ? \"==[cd]\" : \"==[d]\"; }\n};\n\ntemplate <CFStringCompareFlags options>\nstruct NotEqual {\n    using CaseSensitive = NotEqual<options & ~kCFCompareCaseInsensitive>;\n    using CaseInsensitive = NotEqual<options | kCFCompareCaseInsensitive>;\n\n    bool operator()(Mixed v1, Mixed v2) const\n    {\n        return !equal(options, get_string(v1), get_string(v2));\n    }\n\n    static const char* description() { return options & kCFCompareCaseInsensitive ? \"!=[cd]\" : \"!=[d]\"; }\n};\n\nbool contains_substring(CFStringCompareFlags options, StringData v1, StringData v2)\n{\n    if (v2.is_null()) {\n        // Everything contains NULL\n        return true;\n    }\n\n    if (v1.is_null()) {\n        // NULL contains nothing (except NULL, handled above)\n        return false;\n    }\n\n    if (v2.size() == 0) {\n        // Everything (except NULL, handled above) contains the empty string\n        return true;\n    }\n\n    auto s1 = util::adoptCF(CFStringCreateWithBytesNoCopy(kCFAllocatorSystemDefault, (const UInt8*)v1.data(), v1.size(),\n                                                          kCFStringEncodingUTF8, false, kCFAllocatorNull));\n    auto s2 = util::adoptCF(CFStringCreateWithBytesNoCopy(kCFAllocatorSystemDefault, (const UInt8*)v2.data(), v2.size(),\n                                                          kCFStringEncodingUTF8, false, kCFAllocatorNull));\n\n    return CFStringFind(s1.get(), s2.get(), options).location != kCFNotFound;\n}\n\ntemplate <CFStringCompareFlags options>\nstruct ContainsSubstring {\n    using CaseSensitive = ContainsSubstring<options & ~kCFCompareCaseInsensitive>;\n    using CaseInsensitive = ContainsSubstring<options | kCFCompareCaseInsensitive>;\n\n    bool operator()(Mixed v1, Mixed v2) const\n    {\n        return contains_substring(options, get_string(v1), get_string(v2));\n    }\n\n    static const char* description() { return options & kCFCompareCaseInsensitive ? \"CONTAINS[cd]\" : \"CONTAINS[d]\"; }\n};\n\n\nNSString *operatorName(NSPredicateOperatorType operatorType)\n{\n    switch (operatorType) {\n        case NSLessThanPredicateOperatorType:\n            return @\"<\";\n        case NSLessThanOrEqualToPredicateOperatorType:\n            return @\"<=\";\n        case NSGreaterThanPredicateOperatorType:\n            return @\">\";\n        case NSGreaterThanOrEqualToPredicateOperatorType:\n            return @\">=\";\n        case NSEqualToPredicateOperatorType:\n            return @\"==\";\n        case NSNotEqualToPredicateOperatorType:\n            return @\"!=\";\n        case NSMatchesPredicateOperatorType:\n            return @\"MATCHES\";\n        case NSLikePredicateOperatorType:\n            return @\"LIKE\";\n        case NSBeginsWithPredicateOperatorType:\n            return @\"BEGINSWITH\";\n        case NSEndsWithPredicateOperatorType:\n            return @\"ENDSWITH\";\n        case NSInPredicateOperatorType:\n            return @\"IN\";\n        case NSContainsPredicateOperatorType:\n            return @\"CONTAINS\";\n        case NSBetweenPredicateOperatorType:\n            return @\"BETWEEN\";\n        case NSCustomSelectorPredicateOperatorType:\n            return @\"custom selector\";\n    }\n\n    return [NSString stringWithFormat:@\"unknown operator %lu\", (unsigned long)operatorType];\n}\n\n[[gnu::cold]] [[noreturn]]\nvoid unsupportedOperator(RLMPropertyType datatype, NSPredicateOperatorType operatorType) {\n    throwException(@\"Invalid operator type\",\n                   @\"Operator '%@' not supported for type '%@'\",\n                   operatorName(operatorType), RLMTypeToString(datatype));\n}\n\nbool isNSNull(id value) {\n    return !value || value == NSNull.null;\n}\n\ntemplate<typename T>\nbool isNSNull(T) {\n    return false;\n}\n\nTable& get_table(Group& group, RLMObjectSchema *objectSchema)\n{\n    return *ObjectStore::table_for_object_type(group, objectSchema.objectStoreName);\n}\n\n// A reference to a column within a query. Can be resolved to a Columns<T> for use in query expressions.\nclass ColumnReference {\npublic:\n    ColumnReference(Query& query, Group& group, RLMSchema *schema, RLMProperty* property, std::vector<RLMProperty*>&& links = {})\n    : m_links(std::move(links)), m_property(property), m_schema(schema), m_group(&group), m_query(&query), m_link_chain(query.get_table())\n    {\n        for (const auto& link : m_links) {\n            if (link.type != RLMPropertyTypeLinkingObjects) {\n                m_link_chain.link(link.columnName.UTF8String);\n            }\n            else {\n                auto [link_origin_table, link_origin_column] = link_origin(link);\n                m_link_chain.backlink(link_origin_table, link_origin_column);\n            }\n        }\n        m_col = m_link_chain.get_current_table()->get_column_key(m_property.columnName.UTF8String);\n    }\n\n    ColumnReference(Query& query, Group& group, RLMSchema *schema)\n    : m_schema(schema), m_group(&group), m_query(&query)\n    {\n    }\n\n    template <typename T, typename... SubQuery>\n    auto resolve(SubQuery&&... subquery) const\n    {\n        static_assert(sizeof...(SubQuery) < 2, \"resolve() takes at most one subquery\");\n\n        // LinkChain::column() mutates it, so we need to make a copy\n        auto lc = m_link_chain;\n        if (type() != RLMPropertyTypeLinkingObjects) {\n            return lc.column<T>(column(), std::forward<SubQuery>(subquery)...);\n        }\n\n        if constexpr (std::is_same_v<T, Link>) {\n            auto [table, col] = link_origin(m_property);\n            return lc.column<T>(table, col, std::forward<SubQuery>(subquery)...);\n        }\n\n        REALM_TERMINATE(\"LinkingObjects property did not have column type Link\");\n    }\n\n    RLMProperty *property() const { return m_property; }\n    ColKey column() const { return m_col; }\n    RLMPropertyType type() const { return property().type; }\n\n    RLMObjectSchema *link_target_object_schema() const\n    {\n        REALM_ASSERT(is_link());\n        return m_schema[property().objectClassName];\n    }\n\n    bool is_link() const noexcept {\n        return propertyTypeIsLink(type());\n    }\n\n    bool has_any_to_many_links() const {\n        return std::any_of(begin(m_links), end(m_links),\n                           [](RLMProperty *property) { return property.collection; });\n    }\n\n    ColumnReference last_link_column() const {\n        REALM_ASSERT(!m_links.empty());\n        return {*m_query, *m_group, m_schema, m_links.back(), {m_links.begin(), m_links.end() - 1}};\n    }\n\n    ColumnReference column_ignoring_links(Query& query) const {\n        return {query, *m_group, m_schema, m_property};\n    }\n\n    ColumnReference append(RLMProperty *prop) const {\n        auto links = m_links;\n        if (m_property) {\n            links.push_back(m_property);\n        }\n        return ColumnReference(*m_query, *m_group, m_schema, prop, std::move(links));\n    }\n\n    void validate_comparison(id value) const {\n        RLMPrecondition(isObjectValidForProperty(value, m_property),\n                        @\"Invalid value\", @\"Cannot compare value '%@' of type '%@' to property '%@' of type '%@'\",\n                        value, [value class], m_property.name, m_property.objectClassName ?: RLMTypeToString(m_property.type));\n        if (RLMObjectBase *obj = RLMDynamicCast<RLMObjectBase>(value)) {\n            RLMPrecondition(!obj->_row.is_valid() || m_group == &obj->_realm.group,\n                            @\"Invalid value origin\", @\"Object must be from the Realm being queried\");\n        }\n    }\n\nprivate:\n    std::pair<Table&, ColKey> link_origin(RLMProperty *prop) const\n    {\n        RLMObjectSchema *link_origin_schema = m_schema[prop.objectClassName];\n        Table& link_origin_table = get_table(*m_group, link_origin_schema);\n        NSString *column_name = link_origin_schema[prop.linkOriginPropertyName].columnName;\n        auto link_origin_column = link_origin_table.get_column_key(column_name.UTF8String);\n        return {link_origin_table, link_origin_column};\n    }\n\n    std::vector<RLMProperty*> m_links;\n    RLMProperty *m_property;\n    RLMSchema *m_schema;\n    Group *m_group;\n    Query *m_query;\n    LinkChain m_link_chain;\n    ColKey m_col;\n};\n\nclass CollectionOperation {\npublic:\n    enum Type {\n        None,\n        Count,\n        Minimum,\n        Maximum,\n        Sum,\n        Average,\n        // Dictionary specific.\n        AllKeys\n    };\n\n    CollectionOperation(Type type, ColumnReference&& link_column, ColumnReference&& column)\n        : m_type(type)\n        , m_link_column(std::move(link_column))\n        , m_column(std::move(column))\n    {\n        REALM_ASSERT(m_type != None);\n    }\n\n    Type type() const { return m_type; }\n    const ColumnReference& link_column() const { return m_link_column; }\n    const ColumnReference& column() const { return m_column; }\n\n    void validate_comparison(id value) const {\n        bool valid = true;\n        switch (m_type) {\n            case Count:\n                RLMPrecondition([value isKindOfClass:[NSNumber class]], @\"Invalid operand\",\n                                @\"%@ can only be compared with a numeric value.\", name_for_type(m_type));\n                return;\n            case Average:\n            case Minimum:\n            case Maximum:\n                // Null on min/max/average matches arrays with no non-null values, including on non-nullable types\n                valid = isNSNull(value) || isObjectValidForProperty(value, m_column.property());\n                break;\n            case Sum:\n                // Sums are never null\n                valid = !isNSNull(value) && isObjectValidForProperty(value, m_column.property());\n                break;\n            case AllKeys:\n                RLMPrecondition(isNSNull(value) || [value isKindOfClass:[NSString class]], @\"Invalid operand\",\n                                @\"@allKeys can only be compared with a string value.\");\n                return;\n            case None: break;\n        }\n        RLMPrecondition(valid, @\"Invalid operand\",\n                        @\"%@ on a property of type %@ cannot be compared with '%@'\",\n                        name_for_type(m_type), RLMTypeToString(m_column.type()), value);\n    }\n\n    void validate_comparison(const ColumnReference& column) const {\n        switch (m_type) {\n            case Count:\n                RLMPrecondition(propertyTypeIsNumeric(column.type()), @\"Invalid operand\",\n                                @\"%@ can only be compared with a numeric value.\", name_for_type(m_type));\n                break;\n            case Average: case Minimum: case Maximum: case Sum:\n                RLMPrecondition(propertyTypeIsNumeric(column.type()), @\"Invalid operand\",\n                                @\"%@ on a property of type %@ cannot be compared with property of type '%@'\",\n                                name_for_type(m_type), RLMTypeToString(m_column.type()), RLMTypeToString(column.type()));\n                break;\n            case AllKeys:\n                RLMPrecondition(column.type() == RLMPropertyTypeString, @\"Invalid operand\",\n                                @\"@allKeys can only be compared with a string value.\");\n                break;\n            case None: break;\n        }\n    }\n\n    static Type type_for_name(NSString *name) {\n        if ([name isEqualToString:@\"@count\"]) {\n            return Count;\n        }\n        if ([name isEqualToString:@\"@min\"]) {\n            return Minimum;\n        }\n        if ([name isEqualToString:@\"@max\"]) {\n            return Maximum;\n        }\n        if ([name isEqualToString:@\"@sum\"]) {\n            return Sum;\n        }\n        if ([name isEqualToString:@\"@avg\"]) {\n            return Average;\n        }\n        if ([name isEqualToString:@\"@allKeys\"]) {\n            return AllKeys;\n        }\n        return None;\n    }\n\nprivate:\n    static NSString *name_for_type(Type type) {\n        switch (type) {\n            case Count: return @\"@count\";\n            case Minimum: return @\"@min\";\n            case Maximum: return @\"@max\";\n            case Sum: return @\"@sum\";\n            case Average: return @\"@avg\";\n            case AllKeys: return @\"@allKeys\";\n            case None: REALM_UNREACHABLE();\n        }\n    }\n\n    Type m_type;\n    ColumnReference m_link_column;\n    ColumnReference m_column;\n};\n\nstruct KeyPath;\n\nclass QueryBuilder {\npublic:\n    QueryBuilder(Query& query, Group& group, RLMSchema *schema)\n    : m_query(query), m_group(group), m_schema(schema) { }\n\n    void apply_predicate(NSPredicate *predicate, RLMObjectSchema *objectSchema);\n\n    void apply_collection_operator_expression(KeyPath&& kp, id value, NSComparisonPredicate *pred);\n    void apply_value_expression(KeyPath&& kp, id value, NSComparisonPredicate *pred);\n    void apply_column_expression(KeyPath&& left, KeyPath&& right, NSComparisonPredicate *predicate);\n    void apply_function_expression(RLMObjectSchema *objectSchema, NSExpression *functionExpression,\n                                   NSPredicateOperatorType operatorType, NSExpression *right);\n    void apply_map_expression(RLMObjectSchema *objectSchema, NSExpression *functionExpression,\n                              NSComparisonPredicateOptions options, NSPredicateOperatorType operatorType,\n                              NSExpression *right);\n\n    template <typename A, typename B>\n    void add_numeric_constraint(RLMPropertyType datatype,\n                                NSPredicateOperatorType operatorType,\n                                A&& lhs, B&& rhs);\n\n    template <typename A, typename B>\n    void add_bool_constraint(RLMPropertyType, NSPredicateOperatorType operatorType, A&& lhs, B&& rhs);\n\n    template <typename C, typename T>\n    void add_mixed_constraint(NSPredicateOperatorType operatorType,\n                              NSComparisonPredicateOptions predicateOptions,\n                              Columns<C>&& column, T value);\n\n    template <typename C>\n    void add_mixed_constraint(NSPredicateOperatorType operatorType,\n                              NSComparisonPredicateOptions predicateOptions,\n                              Columns<C>&& column, const ColumnReference& c);\n\n    template <typename C>\n    void do_add_mixed_constraint(NSPredicateOperatorType operatorType,\n                                 NSComparisonPredicateOptions predicateOptions,\n                                 Columns<C>&& column, Mixed&& value);\n\n    template<typename T>\n    void add_substring_constraint(const T& value, Query condition);\n    template<typename T>\n    void add_substring_constraint(const Columns<T>& value, Query condition);\n\n    template <typename C, typename T>\n    void add_string_constraint(NSPredicateOperatorType operatorType,\n                               NSComparisonPredicateOptions predicateOptions,\n                               C&& column, T&& value);\n\n    template <typename C, typename T>\n    void add_diacritic_sensitive_string_constraint(NSPredicateOperatorType operatorType,\n                                                   NSComparisonPredicateOptions predicateOptions,\n                                                   C&& column, T&& value);\n    template <typename C, typename T>\n    void do_add_diacritic_sensitive_string_constraint(NSPredicateOperatorType operatorType,\n                                                      NSComparisonPredicateOptions predicateOptions,\n                                                      C&& column, T&& value);\n\n    template <typename R>\n    void add_constraint(NSPredicateOperatorType operatorType,\n                        NSComparisonPredicateOptions predicateOptions,\n                        ColumnReference const& column, R const& rhs);\n    template <template<typename> typename W, typename T>\n    void do_add_constraint(RLMPropertyType type, NSPredicateOperatorType operatorType,\n                           NSComparisonPredicateOptions predicateOptions, ColumnReference const& column, T&& value);\n\n    void add_between_constraint(const ColumnReference& column, id value);\n\n    void add_memberwise_equality_constraint(const ColumnReference& column, RLMObjectBase *obj);\n\n    void add_link_constraint(NSPredicateOperatorType operatorType, const ColumnReference& column, RLMObjectBase *obj);\n    void add_link_constraint(NSPredicateOperatorType operatorType, const ColumnReference& column, realm::null);\n    void add_link_constraint(NSPredicateOperatorType, const ColumnReference&, const ColumnReference&);\n    void add_within_constraint(const ColumnReference& column, id<RLMGeospatial_Private> geospatial);\n\n    template <CollectionOperation::Type Operation, bool IsLinkCollection, bool IsDictionary, typename R>\n    void add_collection_operation_constraint(NSPredicateOperatorType operatorType,\n                                             const CollectionOperation& collectionOperation, R&& rhs,\n                                             NSComparisonPredicateOptions comparisionOptions);\n    template <CollectionOperation::Type Operation, typename R>\n    void add_collection_operation_constraint(NSPredicateOperatorType operatorType,\n                                             const CollectionOperation& collectionOperation, R&& rhs,\n                                             NSComparisonPredicateOptions comparisionOptions);\n    template <typename R>\n    void add_collection_operation_constraint(NSPredicateOperatorType operatorType,\n                                             const CollectionOperation& collectionOperation, R&& rhs,\n                                             NSComparisonPredicateOptions comparisionOptions);\n\n    CollectionOperation collection_operation_from_key_path(KeyPath&& kp);\n    ColumnReference column_reference_from_key_path(KeyPath&& kp, bool isAggregate);\n    NSString* get_path_elements(std::vector<PathElement> &paths, NSExpression *expression);\n\nprivate:\n    Query& m_query;\n    Group& m_group;\n    RLMSchema *m_schema;\n};\n\n#pragma mark Numeric Constraints\n\n// add a clause for numeric constraints based on operator type\ntemplate <typename A, typename B>\nvoid QueryBuilder::add_numeric_constraint(RLMPropertyType datatype,\n                                          NSPredicateOperatorType operatorType,\n                                          A&& lhs, B&& rhs)\n{\n    switch (operatorType) {\n        case NSLessThanPredicateOperatorType:\n            m_query.and_query(lhs < rhs);\n            break;\n        case NSLessThanOrEqualToPredicateOperatorType:\n            m_query.and_query(lhs <= rhs);\n            break;\n        case NSGreaterThanPredicateOperatorType:\n            m_query.and_query(lhs > rhs);\n            break;\n        case NSGreaterThanOrEqualToPredicateOperatorType:\n            m_query.and_query(lhs >= rhs);\n            break;\n        case NSEqualToPredicateOperatorType:\n            m_query.and_query(lhs == rhs);\n            break;\n        case NSNotEqualToPredicateOperatorType:\n            m_query.and_query(lhs != rhs);\n            break;\n        default:\n            unsupportedOperator(datatype, operatorType);\n    }\n}\n\ntemplate <typename A, typename B>\nvoid QueryBuilder::add_bool_constraint(RLMPropertyType datatype,\n                                       NSPredicateOperatorType operatorType,\n                                       A&& lhs, B&& rhs) {\n    switch (operatorType) {\n        case NSEqualToPredicateOperatorType:\n            m_query.and_query(lhs == rhs);\n            break;\n        case NSNotEqualToPredicateOperatorType:\n            m_query.and_query(lhs != rhs);\n            break;\n        default:\n            unsupportedOperator(datatype, operatorType);\n    }\n}\n\n#pragma mark String Constraints\n\ntemplate<typename T>\nvoid QueryBuilder::add_substring_constraint(const T& value, Query condition) {\n    // Foundation always returns false for substring operations with a RHS of null or \"\".\n    m_query.and_query(value.size() ? std::move(condition)\n                                   : std::unique_ptr<Expression>(new FalseExpression));\n}\n\ntemplate<>\nvoid QueryBuilder::add_substring_constraint(const Mixed& value, Query condition) {\n    // Foundation always returns false for substring operations with a RHS of null or \"\".\n    bool empty = value.is_type(type_String) ? value.get_string().size() : value.get_binary().size();\n    m_query.and_query(empty ? std::move(condition)\n                            : std::unique_ptr<Expression>(new FalseExpression));\n}\n\n\ntemplate<typename T>\nvoid QueryBuilder::add_substring_constraint(const Columns<T>& value, Query condition) {\n    // Foundation always returns false for substring operations with a RHS of null or \"\".\n    // We don't need to concern ourselves with the possibility of value traversing a link list\n    // and producing multiple values per row as such expressions will have been rejected.\n    m_query.and_query(const_cast<Columns<T>&>(value).size() != 0 && std::move(condition));\n}\n\ntemplate<typename Comparator>\nQuery make_diacritic_insensitive_constraint(bool caseSensitive, std::unique_ptr<Subexpr> left, std::unique_ptr<Subexpr> right) {\n    using CompareCS = Compare<typename Comparator::CaseSensitive>;\n    using CompareCI = Compare<typename Comparator::CaseInsensitive>;\n    if (caseSensitive) {\n        return make_expression<CompareCS>(std::move(left), std::move(right));\n    }\n    else {\n        return make_expression<CompareCI>(std::move(left), std::move(right));\n    }\n};\n\nQuery make_diacritic_insensitive_constraint(NSPredicateOperatorType operatorType, bool caseSensitive,\n                                            std::unique_ptr<Subexpr> left, std::unique_ptr<Subexpr> right) {\n    switch (operatorType) {\n        case NSBeginsWithPredicateOperatorType: {\n            constexpr auto flags = kCFCompareDiacriticInsensitive | kCFCompareAnchored;\n            return make_diacritic_insensitive_constraint<ContainsSubstring<flags>>(caseSensitive, std::move(left), std::move(right));\n        }\n        case NSEndsWithPredicateOperatorType: {\n            constexpr auto flags = kCFCompareDiacriticInsensitive | kCFCompareAnchored | kCFCompareBackwards;\n            return make_diacritic_insensitive_constraint<ContainsSubstring<flags>>(caseSensitive, std::move(left), std::move(right));\n        }\n        case NSContainsPredicateOperatorType: {\n            constexpr auto flags = kCFCompareDiacriticInsensitive;\n            return make_diacritic_insensitive_constraint<ContainsSubstring<flags>>(caseSensitive, std::move(left), std::move(right));\n        }\n        default:\n            REALM_COMPILER_HINT_UNREACHABLE();\n    }\n}\n\n// static_assert is always evaluated even if it's inside a if constexpr\n// unless the value is derived from the template argument, in which case it's\n// only evaluated if that branch is active\ntemplate <typename> struct AlwaysFalse : std::false_type {};\n\ntemplate <typename C, typename T>\nQuery make_lexicographical_constraint(NSPredicateOperatorType operatorType,\n                                      bool caseSensitive,\n                                      C& column, T const& value) {\n    if (!caseSensitive) {\n        throwException(@\"Invalid predicate\",\n                       @\"Lexicographical comparisons must be case-sensitive\");\n    }\n    switch (operatorType) {\n        case NSLessThanPredicateOperatorType:\n            return column < value;\n        case NSLessThanOrEqualToPredicateOperatorType:\n            return column <= value;\n        case NSGreaterThanPredicateOperatorType:\n            return column > value;\n        case NSGreaterThanOrEqualToPredicateOperatorType:\n            return column >= value;\n        default:\n            REALM_COMPILER_HINT_UNREACHABLE();\n    }\n}\n\ntemplate <typename C, typename T>\nQuery make_diacritic_sensitive_constraint(NSPredicateOperatorType operatorType,\n                                          bool caseSensitive, C& column, T const& value)\n{\n    switch (operatorType) {\n        case NSBeginsWithPredicateOperatorType:\n            return column.begins_with(value, caseSensitive);\n        case NSEndsWithPredicateOperatorType:\n            return column.ends_with(value, caseSensitive);\n        case NSContainsPredicateOperatorType:\n            return column.contains(value, caseSensitive);\n        case NSEqualToPredicateOperatorType:\n            return column.equal(value, caseSensitive);\n        case NSNotEqualToPredicateOperatorType:\n            return column.not_equal(value, caseSensitive);\n        case NSLikePredicateOperatorType:\n            return column.like(value, caseSensitive);\n        case NSLessThanPredicateOperatorType:\n        case NSLessThanOrEqualToPredicateOperatorType:\n        case NSGreaterThanPredicateOperatorType:\n        case NSGreaterThanOrEqualToPredicateOperatorType:\n            return make_lexicographical_constraint(operatorType, caseSensitive, column, value);\n        default: {\n            if constexpr (is_any_v<C, Columns<String>, Columns<Lst<String>>, Columns<Set<String>>, ColumnDictionaryKeys>) {\n                unsupportedOperator(RLMPropertyTypeString, operatorType);\n            }\n            else if constexpr (is_any_v<C, Columns<Binary>, Columns<Lst<Binary>>, Columns<Set<Binary>>>) {\n                unsupportedOperator(RLMPropertyTypeData, operatorType);\n            }\n            else if constexpr (is_any_v<C, Columns<Mixed>, Columns<Lst<Mixed>>, Columns<Set<Mixed>>>) {\n                unsupportedOperator(RLMPropertyTypeAny, operatorType);\n            }\n            else if constexpr (is_any_v<C, Columns<Dictionary>>) {\n                // The underlying storage type Dictionary is always Mixed. This creates an issue\n                // where we cannot be descriptive about the exception as we do not know\n                // the actual value type.\n                throwException(@\"Invalid operand type\",\n                               @\"Operator '%@' not supported for string queries on Dictionary.\",\n                               operatorName(operatorType));\n            }\n            else {\n                static_assert(AlwaysFalse<C>::value, \"unsupported column type\");\n            }\n        }\n    }\n}\n\ntemplate <typename C, typename T>\nvoid QueryBuilder::do_add_diacritic_sensitive_string_constraint(NSPredicateOperatorType operatorType,\n                                                                NSComparisonPredicateOptions predicateOptions,\n                                                                C&& column, T&& value) {\n    bool caseSensitive = !(predicateOptions & NSCaseInsensitivePredicateOption);\n    Query condition = make_diacritic_sensitive_constraint(operatorType, caseSensitive, column, value);\n\n    switch (operatorType) {\n        case NSBeginsWithPredicateOperatorType:\n        case NSEndsWithPredicateOperatorType:\n        case NSContainsPredicateOperatorType:\n            add_substring_constraint(value, std::move(condition));\n            break;\n\n        default:\n            m_query.and_query(std::move(condition));\n            break;\n    }\n}\n\ntemplate <typename C, typename T>\nvoid QueryBuilder::add_diacritic_sensitive_string_constraint(NSPredicateOperatorType operatorType,\n                                                             NSComparisonPredicateOptions predicateOptions,\n                                                             C&& column, T&& value) {\n\n    if constexpr (is_any_v<C, Columns<Dictionary>> && is_any_v<T, Columns<StringData>, Columns<BinaryData>>) {\n        // Core only implements these for Columns<Mixed> due to Dictionary being Mixed internall\n        throwException(@\"Unsupported predicate\",\n                       @\"String comparisons on a Dictionary and another property are only implemented for AnyRealmValue properties.\");\n    }\n    else {\n        do_add_diacritic_sensitive_string_constraint(operatorType, predicateOptions, std::forward<C>(column), std::forward<T>(value));\n    }\n}\n\ntemplate <typename C, typename T>\nvoid QueryBuilder::add_string_constraint(NSPredicateOperatorType operatorType,\n                                         NSComparisonPredicateOptions predicateOptions,\n                                         C&& column, T&& value) {\n    if (!(predicateOptions & NSDiacriticInsensitivePredicateOption)) {\n        add_diacritic_sensitive_string_constraint(operatorType, predicateOptions, std::forward<C>(column), std::forward<T>(value));\n        return;\n    }\n\n    auto as_subexpr = util::overload{\n        [](StringData value) { return make_subexpr<ConstantStringValue>(value); },\n        [](BinaryData value) { return make_subexpr<ConstantStringValue>(StringData(value.data(), value.size())); },\n        [](Mixed value) {\n            // When Mixed is null calling `get_type` will throw an exception.\n            if (value.is_null())\n                return make_subexpr<ConstantStringValue>(value.get_string());\n            switch (value.get_type()) {\n                case DataType::Type::String:\n                    return make_subexpr<ConstantStringValue>(value.get_string());\n                case DataType::Type::Binary:\n                    return make_subexpr<ConstantStringValue>(StringData(value.get_binary().data(), value.get_binary().size()));\n                default:\n                    REALM_UNREACHABLE();\n            }\n        },\n        [](auto& c) { return c.clone(); }\n    };\n    auto left = as_subexpr(column);\n    auto right = as_subexpr(value);\n\n    bool caseSensitive = !(predicateOptions & NSCaseInsensitivePredicateOption);\n    constexpr auto flags = kCFCompareDiacriticInsensitive | kCFCompareAnchored;\n    switch (operatorType) {\n        case NSBeginsWithPredicateOperatorType:\n        case NSEndsWithPredicateOperatorType:\n        case NSContainsPredicateOperatorType:\n            add_substring_constraint(value, make_diacritic_insensitive_constraint(operatorType, caseSensitive, std::move(left), std::move(right)));\n            break;\n        case NSNotEqualToPredicateOperatorType:\n            m_query.and_query(make_diacritic_insensitive_constraint<NotEqual<flags>>(caseSensitive, std::move(left), std::move(right)));\n            break;\n        case NSEqualToPredicateOperatorType:\n            m_query.and_query(make_diacritic_insensitive_constraint<Equal<flags>>(caseSensitive, std::move(left), std::move(right)));\n            break;\n        case NSLikePredicateOperatorType:\n            throwException(@\"Invalid operator type\",\n                           @\"Operator 'LIKE' not supported with diacritic-insensitive modifier.\");\n        default:\n            unsupportedOperator(RLMPropertyTypeString, operatorType);\n    }\n}\n\nid value_from_constant_expression_or_value(id value) {\n    if (NSExpression *exp = RLMDynamicCast<NSExpression>(value)) {\n        RLMPrecondition(exp.expressionType == NSConstantValueExpressionType,\n                        @\"Invalid value\",\n                        @\"Expressions within predicate aggregates must be constant values\");\n        return exp.constantValue;\n    }\n    return value;\n}\n\nvoid validate_and_extract_between_range(id value, RLMProperty *prop, id *from, id *to) {\n    NSArray *array = RLMDynamicCast<NSArray>(value);\n    RLMPrecondition(array, @\"Invalid value\", @\"object must be of type NSArray for BETWEEN operations\");\n    RLMPrecondition(array.count == 2, @\"Invalid value\", @\"NSArray object must contain exactly two objects for BETWEEN operations\");\n\n    *from = value_from_constant_expression_or_value(array.firstObject);\n    *to = value_from_constant_expression_or_value(array.lastObject);\n    RLMPrecondition(isObjectValidForProperty(*from, prop) && isObjectValidForProperty(*to, prop),\n                    @\"Invalid value\",\n                    @\"NSArray objects must be of type %@ for BETWEEN operations\", RLMTypeToString(prop.type));\n}\n\n#pragma mark Between Constraint\n\nvoid QueryBuilder::add_between_constraint(const ColumnReference& column, id value) {\n    if (column.has_any_to_many_links()) {\n        auto link_column = column.last_link_column();\n        Query subquery = get_table(m_group, link_column.link_target_object_schema()).where();\n        QueryBuilder(subquery, m_group, m_schema).add_between_constraint(column.column_ignoring_links(subquery), value);\n\n        m_query.and_query(link_column.resolve<Link>(std::move(subquery)).count() > 0);\n        return;\n    }\n\n    id from, to;\n    validate_and_extract_between_range(value, column.property(), &from, &to);\n\n    if (!propertyTypeIsNumeric(column.type())) {\n        return unsupportedOperator(column.type(), NSBetweenPredicateOperatorType);\n    }\n\n    m_query.group();\n    add_constraint(NSGreaterThanOrEqualToPredicateOperatorType, 0, column, from);\n    add_constraint(NSLessThanOrEqualToPredicateOperatorType, 0, column, to);\n    m_query.end_group();\n}\n\n#pragma mark Link Constraints\n\nvoid QueryBuilder::add_memberwise_equality_constraint(const ColumnReference& column, RLMObjectBase *obj) {\n    for (RLMProperty *property in obj->_objectSchema.properties) {\n        // Both of these probably are implementable, but are significantly more complicated.\n        RLMPrecondition(!property.collection, @\"Invalid predicate\",\n                        @\"Unsupported property '%@.%@' for memberwise equality query: equality on collections is not implemented.\",\n                        obj->_objectSchema.className, property.name);\n        RLMPrecondition(!propertyTypeIsLink(property.type), @\"Invalid predicate\",\n                        @\"Unsupported property '%@.%@' for memberwise equality query: object links are not implemented.\",\n                        obj->_objectSchema.className, property.name);\n        add_constraint(NSEqualToPredicateOperatorType, 0, column.append(property), RLMDynamicGet(obj, property));\n    }\n}\n\nvoid QueryBuilder::add_link_constraint(NSPredicateOperatorType operatorType,\n                                       const ColumnReference& column, RLMObjectBase *obj) {\n    // If the value isn't actually a RLMObject then it's something which bridges\n    // to RLMObject, i.e. a custom type mapping to an embedded object. For those\n    // we want to perform memberwise equality rather than equality on the link itself.\n    if (![obj isKindOfClass:[RLMObjectBase class]]) {\n        obj = RLMBridgeSwiftValue(obj);\n        REALM_ASSERT([obj isKindOfClass:[RLMObjectBase class]]);\n\n        // Collections need to use subqueries, but unary links can just use a\n        // group. Unary links could also use a subquery but that has worse performance.\n        if (column.property().collection) {\n            Query subquery = get_table(m_group, column.link_target_object_schema()).where();\n            QueryBuilder(subquery, m_group, m_schema)\n                .add_memberwise_equality_constraint(ColumnReference(subquery, m_group, m_schema), obj);\n            if (operatorType == NSEqualToPredicateOperatorType) {\n                m_query.and_query(column.resolve<Link>(std::move(subquery)).count() > 0);\n            }\n            else {\n                // This strange condition is because \"ANY list != x\" isn't\n                // \"NONE list == x\"; there must be an object in the list for\n                // this to match\n                m_query.and_query(column.resolve<Link>().count() > 0 &&\n                                  column.resolve<Link>(std::move(subquery)).count() == 0);\n            }\n        }\n        else {\n            if (operatorType == NSNotEqualToPredicateOperatorType) {\n                m_query.Not();\n            }\n\n            m_query.group();\n            add_memberwise_equality_constraint(column, obj);\n            m_query.end_group();\n        }\n        return;\n    }\n\n    if (!obj->_row.is_valid()) {\n        // Unmanaged or deleted objects are not equal to any managed objects.\n        // For arrays this effectively checks if there are any objects in the\n        // array, while for links it's just always constant true or false\n        // (for != and = respectively).\n        if (column.has_any_to_many_links() || column.property().collection) {\n            add_link_constraint(operatorType, column, null());\n        }\n        else if (operatorType == NSEqualToPredicateOperatorType) {\n            m_query.and_query(std::unique_ptr<Expression>(new FalseExpression));\n        }\n        else {\n            m_query.and_query(std::unique_ptr<Expression>(new TrueExpression));\n        }\n    }\n    else {\n        if (column.property().dictionary) {\n            add_bool_constraint(RLMPropertyTypeObject, operatorType, column.resolve<Dictionary>(), obj->_row);\n        }\n        else {\n            add_bool_constraint(RLMPropertyTypeObject, operatorType, column.resolve<Link>(), obj->_row);\n        }\n    }\n}\n\nvoid QueryBuilder::add_link_constraint(NSPredicateOperatorType operatorType,\n                                       const ColumnReference& column, realm::null) {\n    if (column.property().dictionary) {\n        add_bool_constraint(RLMPropertyTypeObject, operatorType, column.resolve<Dictionary>(), null());\n    }\n    else {\n        add_bool_constraint(RLMPropertyTypeObject, operatorType, column.resolve<Link>(), null());\n    }\n}\n\nvoid QueryBuilder::add_link_constraint(NSPredicateOperatorType operatorType,\n                                       const ColumnReference& a, const ColumnReference& b) {\n    if (a.property().dictionary) {\n        add_bool_constraint(RLMPropertyTypeObject, operatorType, a.resolve<Dictionary>(), b.resolve<Dictionary>());\n    }\n    else {\n        add_bool_constraint(RLMPropertyTypeObject, operatorType, a.resolve<Link>(), b.resolve<Link>());\n    }\n}\n\n#pragma mark Geospatial\n\nvoid QueryBuilder::add_within_constraint(const ColumnReference& column, id<RLMGeospatial_Private> geospatial) {\n    auto geoQuery = column.resolve<Link>().geo_within(geospatial.geoSpatial);\n    m_query.and_query(std::move(geoQuery));\n}\n\n// iterate over an array of subpredicates, using @func to build a query from each\n// one and ORing them together\ntemplate<typename Func>\nvoid process_or_group(Query &query, id array, Func&& func) {\n    array = RLMAsFastEnumeration(array);\n    RLMPrecondition(array, @\"Invalid value\", @\"IN clause requires an array of items\");\n\n    query.group();\n\n    bool first = true;\n    for (id item in array) {\n        if (!first) {\n            query.Or();\n        }\n        first = false;\n\n        func(item);\n    }\n\n    if (first) {\n        // Queries can't be empty, so if there's zero things in the OR group\n        // validation will fail. Work around this by adding an expression which\n        // will never find any rows in a table.\n        query.and_query(std::unique_ptr<Expression>(new FalseExpression));\n    }\n\n    query.end_group();\n}\n\n#pragma mark Conversion Helpers\n\ntemplate <typename>\nrealm::null value_of_type(realm::null) {\n    return realm::null();\n}\n\ntemplate <typename RequestedType>\nauto value_of_type(__unsafe_unretained const id value) {\n    return RLMStatelessAccessorContext::unbox<RequestedType>(value);\n}\n\ntemplate <>\nauto value_of_type<Mixed>(id value) {\n    return RLMObjcToMixed(value, nil, CreatePolicy::Skip);\n}\n\ntemplate <typename RequestedType>\nauto value_of_type(const ColumnReference& column) {\n    return column.resolve<RequestedType>();\n}\n\ntemplate <typename T, typename Fn>\nvoid convert_null(T&& value, Fn&& fn) {\n    if (isNSNull(value)) {\n        fn(null());\n    }\n    else {\n        fn(std::forward<T>(value));\n    }\n}\n\ntemplate <template<typename> typename W, typename T>\nvoid QueryBuilder::do_add_constraint(RLMPropertyType type, NSPredicateOperatorType operatorType,\n                                     NSComparisonPredicateOptions predicateOptions, ColumnReference const& column, T&& value)\n{\n    switch (type) {\n        case RLMPropertyTypeBool:\n            convert_null(value, [&](auto&& value) {\n                add_bool_constraint(type, operatorType, column.resolve<W<bool>>(),\n                                    value_of_type<bool>(value));\n            });\n            break;\n        case RLMPropertyTypeObjectId:\n            convert_null(value, [&](auto&& value) {\n                add_bool_constraint(type, operatorType, column.resolve<W<ObjectId>>(),\n                                    value_of_type<ObjectId>(value));\n            });\n            break;\n        case RLMPropertyTypeDate:\n            convert_null(value, [&](auto&& value) {\n                add_numeric_constraint(type, operatorType, column.resolve<W<Timestamp>>(),\n                                       value_of_type<Timestamp>(value));\n            });\n            break;\n        case RLMPropertyTypeDouble:\n            convert_null(value, [&](auto&& value) {\n                add_numeric_constraint(type, operatorType, column.resolve<W<Double>>(),\n                                       value_of_type<Double>(value));\n            });\n            break;\n        case RLMPropertyTypeFloat:\n            convert_null(value, [&](auto&& value) {\n                add_numeric_constraint(type, operatorType, column.resolve<W<Float>>(),\n                                       value_of_type<Float>(value));\n            });\n            break;\n        case RLMPropertyTypeInt:\n            convert_null(value, [&](auto&& value) {\n                add_numeric_constraint(type, operatorType, column.resolve<W<Int>>(),\n                                       value_of_type<Int>(value));\n            });\n            break;\n        case RLMPropertyTypeDecimal128:\n            convert_null(value, [&](auto&& value) {\n                add_numeric_constraint(type, operatorType, column.resolve<W<Decimal128>>(),\n                                       value_of_type<Decimal128>(value));\n            });\n            break;\n        case RLMPropertyTypeString:\n            add_string_constraint(operatorType, predicateOptions, column.resolve<W<String>>(),\n                                  value_of_type<String>(value));\n            break;\n        case RLMPropertyTypeData:\n            add_string_constraint(operatorType, predicateOptions,\n                                  column.resolve<W<Binary>>(),\n                                  value_of_type<Binary>(value));\n            break;\n        case RLMPropertyTypeObject:\n        case RLMPropertyTypeLinkingObjects:\n            convert_null(value, [&](auto&& value) {\n                add_link_constraint(operatorType, column, value);\n            });\n            break;\n        case RLMPropertyTypeUUID:\n            convert_null(value, [&](auto&& value) {\n                add_bool_constraint(type, operatorType, column.resolve<W<UUID>>(),\n                                    value_of_type<UUID>(value));\n            });\n            break;\n        case RLMPropertyTypeAny:\n            convert_null(value, [&](auto&& value) {\n                add_mixed_constraint(operatorType,\n                                     predicateOptions,\n                                     column.resolve<W<Mixed>>(),\n                                     value);\n            });\n    }\n}\n\n#pragma mark Mixed Constraints\n\ntemplate<typename C, typename T>\nvoid QueryBuilder::add_mixed_constraint(NSPredicateOperatorType operatorType,\n                                        NSComparisonPredicateOptions predicateOptions,\n                                        Columns<C>&& column,\n                                        T value)\n{\n    // Handle cases where a string might be '1' or '0'. Without this the string\n    // will be boxed as a bool and thus string query operations will crash in core.\n    if constexpr(std::is_same_v<T, id>) {\n        if (auto str = RLMDynamicCast<NSString>(value)) {\n            add_string_constraint(operatorType, predicateOptions,\n                                  std::move(column), realm::Mixed([str UTF8String]));\n            return;\n        }\n    }\n    do_add_mixed_constraint(operatorType, predicateOptions,\n                            std::move(column), value_of_type<Mixed>(value));\n}\n\ntemplate<typename C>\nvoid QueryBuilder::do_add_mixed_constraint(NSPredicateOperatorType operatorType,\n                                           NSComparisonPredicateOptions predicateOptions,\n                                           Columns<C>&& column,\n                                           Mixed&& value)\n{\n    switch (operatorType) {\n        case NSLessThanPredicateOperatorType:\n            m_query.and_query(column < value);\n            break;\n        case NSLessThanOrEqualToPredicateOperatorType:\n            m_query.and_query(column <= value);\n            break;\n        case NSGreaterThanPredicateOperatorType:\n            m_query.and_query(column > value);\n            break;\n        case NSGreaterThanOrEqualToPredicateOperatorType:\n            m_query.and_query(column >= value);\n            break;\n        case NSEqualToPredicateOperatorType:\n            m_query.and_query(column == value);\n            break;\n        case NSNotEqualToPredicateOperatorType:\n            m_query.and_query(column != value);\n            break;\n        // String comparison operators: There isn't a way for a string value\n        // to get down here, but a rhs of NULL can\n        case NSLikePredicateOperatorType:\n        case NSMatchesPredicateOperatorType:\n        case NSBeginsWithPredicateOperatorType:\n        case NSEndsWithPredicateOperatorType:\n        case NSContainsPredicateOperatorType:\n            add_string_constraint(operatorType, predicateOptions,\n                                  std::move(column), value);\n            break;\n        default:\n            break;\n    }\n}\n\ntemplate<typename C>\nvoid QueryBuilder::add_mixed_constraint(NSPredicateOperatorType operatorType,\n                                        NSComparisonPredicateOptions,\n                                        Columns<C>&& column,\n                                        const ColumnReference& value)\n{\n    add_bool_constraint(RLMPropertyTypeObject, operatorType, column, value.resolve<Mixed>());\n}\n\ntemplate<typename T>\nusing Identity = T;\ntemplate<typename>\nusing AlwaysDictionary = Dictionary;\n\ntemplate <typename R>\nvoid QueryBuilder::add_constraint(NSPredicateOperatorType operatorType,\n                                  NSComparisonPredicateOptions predicateOptions, ColumnReference const& column, R const& rhs)\n{\n    auto type = column.type();\n    if (column.property().array) {\n        do_add_constraint<Lst>(type, operatorType, predicateOptions, column, rhs);\n    }\n    else if (column.property().set) {\n        do_add_constraint<Set>(type, operatorType, predicateOptions, column, rhs);\n    }\n    else if (column.property().dictionary) {\n        do_add_constraint<AlwaysDictionary>(type, operatorType, predicateOptions, column, rhs);\n    }\n    else {\n        do_add_constraint<Identity>(type, operatorType, predicateOptions, column, rhs);\n    }\n}\n\nstruct KeyPath {\n    std::vector<RLMProperty *> links;\n    RLMProperty *property;\n    CollectionOperation::Type collectionOperation;\n    bool containsToManyRelationship;\n};\n\nKeyPath key_path_from_string(RLMSchema *schema, RLMObjectSchema *objectSchema, NSString *keyPath)\n{\n    RLMProperty *property;\n    std::vector<RLMProperty *> links;\n\n    CollectionOperation::Type collectionOperation = CollectionOperation::None;\n    NSString *collectionOperationName;\n    bool keyPathContainsToManyRelationship = false;\n\n    NSUInteger start = 0, length = keyPath.length, end = length;\n    for (; end != NSNotFound; start = end + 1) {\n        end = [keyPath rangeOfString:@\".\" options:0 range:{start, length - start}].location;\n        RLMPrecondition(end == NSNotFound || end + 1 < length, @\"Invalid predicate\",\n                        @\"Invalid keypath '%@': no key name after last '.'\", keyPath);\n        RLMPrecondition(end > start, @\"Invalid predicate\",\n                        @\"Invalid keypath '%@': no key name before '.'\", keyPath);\n\n        NSString *propertyName = [keyPath substringWithRange:{start, end == NSNotFound ? length - start : end - start}];\n\n        if ([propertyName characterAtIndex:0] == '@') {\n            if ([propertyName isEqualToString:@\"@allValues\"]) {\n                RLMPrecondition(property.dictionary, @\"Invalid predicate\",\n                                @\"Invalid keypath '%@': @allValues must follow a dictionary property.\", keyPath);\n                continue;\n            }\n            RLMPrecondition(collectionOperation == CollectionOperation::None, @\"Invalid predicate\",\n                            @\"Invalid keypath '%@': at most one collection operation per keypath is supported.\", keyPath);\n            collectionOperation = CollectionOperation::type_for_name(propertyName);\n            RLMPrecondition(collectionOperation != CollectionOperation::None, @\"Invalid predicate\",\n                            @\"Invalid keypath '%@': Unsupported collection operation '%@'\", keyPath, propertyName);\n\n            RLMPrecondition(property.collection, @\"Invalid predicate\",\n                            @\"Invalid keypath '%@': collection operation '%@' must be applied to a collection\", keyPath, propertyName);\n            switch (collectionOperation) {\n                case CollectionOperation::None:\n                    REALM_UNREACHABLE();\n                case CollectionOperation::Count:\n                    RLMPrecondition(end == NSNotFound, @\"Invalid predicate\",\n                                    @\"Invalid keypath '%@': @count must appear at the end of a keypath.\", keyPath);\n                    break;\n                case CollectionOperation::AllKeys:\n                    RLMPrecondition(end == NSNotFound, @\"Invalid predicate\",\n                                    @\"Invalid keypath '%@': @allKeys must appear at the end of a keypath.\", keyPath);\n                    RLMPrecondition(property.dictionary, @\"Invalid predicate\",\n                                    @\"Invalid keypath '%@': @allKeys must follow a dictionary property.\", keyPath);\n                    break;\n                default:\n                    if (propertyTypeIsLink(property.type)) {\n                        RLMPrecondition(end != NSNotFound, @\"Invalid predicate\",\n                                        @\"Invalid keypath '%@': %@ on a collection of objects cannot appear at the end of a keypath.\", keyPath, propertyName);\n                    }\n                    else {\n                        RLMPrecondition(end == NSNotFound, @\"Invalid predicate\",\n                                        @\"Invalid keypath '%@': %@ on a collection of values must appear at the end of a keypath.\", keyPath, propertyName);\n                        RLMPrecondition(propertyTypeIsNumeric(property.type), @\"Invalid predicate\",\n                                        @\"Invalid keypath '%@': %@ can only be applied to a collection of numeric values.\", keyPath, propertyName);\n                    }\n            }\n            collectionOperationName = propertyName;\n            continue;\n        }\n\n        RLMPrecondition(objectSchema, @\"Invalid predicate\",\n                        @\"Invalid keypath '%@': %@ property %@ can only be followed by a collection operation.\",\n                        keyPath, property.typeName, property.name);\n\n        property = objectSchema[propertyName];\n        RLMPrecondition(property, @\"Invalid predicate\",\n                        @\"Invalid keypath '%@': Property '%@' not found in object of type '%@'\",\n                        keyPath, propertyName, objectSchema.className);\n        RLMPrecondition(collectionOperation == CollectionOperation::None || (propertyTypeIsNumeric(property.type) && !property.collection),\n                        @\"Invalid predicate\",\n                        @\"Invalid keypath '%@': %@ must be followed by a numeric property.\", keyPath, collectionOperationName);\n\n        if (property.collection)\n            keyPathContainsToManyRelationship = true;\n\n        links.push_back(property);\n\n        if (end != NSNotFound) {\n            RLMPrecondition(property.type == RLMPropertyTypeObject || property.type == RLMPropertyTypeLinkingObjects || property.collection,\n                            @\"Invalid predicate\", @\"Invalid keypath '%@': Property '%@.%@' is not a link or collection and can only appear at the end of a keypath.\",\n                            keyPath, objectSchema.className, propertyName);\n            objectSchema = property.objectClassName ? schema[property.objectClassName] : nil;\n        }\n    };\n\n    links.pop_back();\n    return {std::move(links), property, collectionOperation, keyPathContainsToManyRelationship};\n}\n\nColumnReference QueryBuilder::column_reference_from_key_path(KeyPath&& kp, bool isAggregate)\n{\n    if (isAggregate && !kp.containsToManyRelationship && kp.property.type != RLMPropertyTypeAny) {\n        throwException(@\"Invalid predicate\",\n                       @\"Aggregate operations can only be used on key paths that include an collection property\");\n    } else if (!isAggregate && kp.containsToManyRelationship) {\n        throwException(@\"Invalid predicate\",\n                       @\"Key paths that include a collection property must use aggregate operations\");\n    }\n\n    return ColumnReference(m_query, m_group, m_schema, kp.property, std::move(kp.links));\n}\n\n#pragma mark Collection Operations\n\ntemplate <CollectionOperation::Type OperationType, typename Column>\nauto collection_operation_expr_2(Column&& column) {\n    if constexpr (OperationType == CollectionOperation::Minimum) {\n        return column.min();\n    }\n    else if constexpr (OperationType == CollectionOperation::Maximum) {\n        return column.max();\n    }\n    else if constexpr (OperationType == CollectionOperation::Sum) {\n        return column.sum();\n    }\n    else if constexpr (OperationType == CollectionOperation::Average) {\n        return column.average();\n    }\n    else {\n        static_assert(AlwaysFalse<std::integral_constant<CollectionOperation::Type, OperationType>>::value,\n                      \"invalid operation type\");\n    }\n}\n\ntemplate <typename Requested, CollectionOperation::Type OperationType, bool IsLinkCollection, bool IsDictionary>\nauto collection_operation_expr(CollectionOperation operation) {\n    REALM_ASSERT(operation.type() == OperationType);\n\n    if constexpr (IsLinkCollection) {\n        auto&& resolved = operation.link_column().resolve<Link>();\n        auto col = operation.column().column();\n        return collection_operation_expr_2<OperationType>(resolved.template column<Requested>(col));\n    }\n    else if constexpr (IsDictionary) {\n        return collection_operation_expr_2<OperationType>(operation.link_column().resolve<Dictionary>());\n    }\n    else {\n        return collection_operation_expr_2<OperationType>(operation.link_column().resolve<Lst<Requested>>());\n    }\n}\n\ntemplate <CollectionOperation::Type Operation, bool IsLinkCollection, bool IsDictionary, typename R>\nvoid QueryBuilder::add_collection_operation_constraint(NSPredicateOperatorType operatorType,\n                                                       CollectionOperation const& collectionOperation, R&& rhs,\n                                                       NSComparisonPredicateOptions)\n{\n    auto type = IsLinkCollection ? collectionOperation.column().type() : collectionOperation.link_column().type();\n\n    switch (type) {\n        case RLMPropertyTypeInt:\n            add_numeric_constraint(type, operatorType,\n                                   collection_operation_expr<Int, Operation, IsLinkCollection, IsDictionary>(collectionOperation),\n                                   value_of_type<Int>(rhs));\n            break;\n        case RLMPropertyTypeFloat:\n            add_numeric_constraint(type, operatorType,\n                                   collection_operation_expr<Float, Operation, IsLinkCollection, IsDictionary>(collectionOperation),\n                                   value_of_type<Float>(rhs));\n            break;\n        case RLMPropertyTypeDouble:\n            add_numeric_constraint(type, operatorType,\n                                   collection_operation_expr<Double, Operation, IsLinkCollection, IsDictionary>(collectionOperation),\n                                   value_of_type<Double>(rhs));\n            break;\n        case RLMPropertyTypeDecimal128:\n            add_numeric_constraint(type, operatorType,\n                                   collection_operation_expr<Decimal128, Operation, IsLinkCollection, IsDictionary>(collectionOperation),\n                                   value_of_type<Decimal128>(rhs));\n            break;\n        case RLMPropertyTypeDate:\n            if constexpr (Operation == CollectionOperation::Sum || Operation == CollectionOperation::Average) {\n                throwException(@\"Unsupported predicate value type\",\n                               @\"Cannot sum or average date properties\");\n            }\n            else {\n                add_numeric_constraint(type, operatorType,\n                                       collection_operation_expr<Timestamp, Operation, IsLinkCollection, IsDictionary>(collectionOperation),\n                                       value_of_type<Timestamp>(rhs));\n            }\n            break;\n        case RLMPropertyTypeAny:\n            add_numeric_constraint(type, operatorType,\n                                   collection_operation_expr<Mixed, Operation, IsLinkCollection, IsDictionary>(collectionOperation),\n                                   value_of_type<Mixed>(rhs));\n            break;\n        default:\n            REALM_ASSERT(false && \"Only numeric property types should hit this path.\");\n    }\n}\n\ntemplate <CollectionOperation::Type Operation, typename R>\nvoid QueryBuilder::add_collection_operation_constraint(NSPredicateOperatorType operatorType,\n                                                       CollectionOperation const& collectionOperation, R&& rhs,\n                                                       NSComparisonPredicateOptions options)\n{\n    convert_null(std::forward<R>(rhs), [&]<typename T>(T&& rhs) {\n        if (collectionOperation.link_column().is_link()) {\n            add_collection_operation_constraint<Operation, true, false>(operatorType, collectionOperation, std::forward<T>(rhs), options);\n        }\n        else if (collectionOperation.column().property().dictionary) {\n            add_collection_operation_constraint<Operation, false, true>(operatorType, collectionOperation, std::forward<T>(rhs), options);\n        }\n        else {\n            add_collection_operation_constraint<Operation, false, false>(operatorType, collectionOperation, std::forward<T>(rhs), options);\n        }\n    });\n}\n\ntemplate <typename T, typename Fn>\nvoid get_collection_type(__unsafe_unretained RLMProperty *prop, Fn&& fn) {\n    if (prop.array) {\n        fn((Lst<T>*)0);\n    }\n    else if (prop.set) {\n        fn((Set<T>*)0);\n    }\n    else {\n        fn((Dictionary*)0);\n    }\n}\n\ntemplate <typename R>\nvoid QueryBuilder::add_collection_operation_constraint(NSPredicateOperatorType operatorType,\n                                                       CollectionOperation const& collectionOperation, R&& rhs,\n                                                       NSComparisonPredicateOptions comparisonOptions)\n{\n    switch (collectionOperation.type()) {\n        case CollectionOperation::None:\n            break;\n        case CollectionOperation::Count: {\n            auto& column = collectionOperation.link_column();\n            RLMPropertyType type = column.type();\n            auto rhsValue = value_of_type<Int>(rhs);\n            auto continuation = [&]<typename T>(T *) {\n                add_numeric_constraint(type, operatorType, column.resolve<T>().size(), rhsValue);\n            };\n\n            switch (type) {\n                case RLMPropertyTypeBool:\n                    return get_collection_type<Bool>(column.property(), std::move(continuation));\n                case RLMPropertyTypeObjectId:\n                    return get_collection_type<ObjectId>(column.property(), std::move(continuation));\n                case RLMPropertyTypeDate:\n                    return get_collection_type<Timestamp>(column.property(), std::move(continuation));\n                case RLMPropertyTypeDouble:\n                    return get_collection_type<Double>(column.property(), std::move(continuation));\n                case RLMPropertyTypeFloat:\n                    return get_collection_type<Float>(column.property(), std::move(continuation));\n                case RLMPropertyTypeInt:\n                    return get_collection_type<Int>(column.property(), std::move(continuation));\n                case RLMPropertyTypeDecimal128:\n                    return get_collection_type<Decimal128>(column.property(), std::move(continuation));\n                case RLMPropertyTypeString:\n                    return get_collection_type<String>(column.property(), std::move(continuation));\n                case RLMPropertyTypeData:\n                    return get_collection_type<Binary>(column.property(), std::move(continuation));\n                case RLMPropertyTypeUUID:\n                    return get_collection_type<UUID>(column.property(), std::move(continuation));\n                case RLMPropertyTypeAny:\n                    return get_collection_type<Mixed>(column.property(), std::move(continuation));\n                case RLMPropertyTypeObject:\n                case RLMPropertyTypeLinkingObjects:\n                    return add_numeric_constraint(type, operatorType, column.resolve<Link>().count(), rhsValue);\n            }\n        }\n        case CollectionOperation::Minimum:\n            add_collection_operation_constraint<CollectionOperation::Minimum>(operatorType, collectionOperation, std::forward<R>(rhs), comparisonOptions);\n            break;\n        case CollectionOperation::Maximum:\n            add_collection_operation_constraint<CollectionOperation::Maximum>(operatorType, collectionOperation, std::forward<R>(rhs), comparisonOptions);\n            break;\n        case CollectionOperation::Sum:\n            add_collection_operation_constraint<CollectionOperation::Sum>(operatorType, collectionOperation, std::forward<R>(rhs), comparisonOptions);\n            break;\n        case CollectionOperation::Average:\n            add_collection_operation_constraint<CollectionOperation::Average>(operatorType, collectionOperation, std::forward<R>(rhs), comparisonOptions);\n            break;\n        case CollectionOperation::AllKeys: {\n            // BETWEEN and IN are not supported by @allKeys as the parsing for collection\n            // operators happens before and disection of a rhs array of values.\n            add_string_constraint(operatorType, comparisonOptions,\n                                  Columns<Dictionary>(collectionOperation.link_column().column(), m_query.get_table()).keys(),\n                                  value_of_type<StringData>(rhs));\n            break;\n        }\n    }\n}\n\nbool key_path_contains_collection_operator(const KeyPath& kp) {\n    return kp.collectionOperation != CollectionOperation::None;\n}\n\nCollectionOperation QueryBuilder::collection_operation_from_key_path(KeyPath&& kp) {\n    // Collection operations can either come at the end, or immediately before\n    // the last property. Count and AllKeys are always the end, while\n    // min/max/sum/avg are at the end for collections of primitives and one\n    // before the end for collections of objects (with the aggregate done on a\n    // property of those objects). For one-before-the-end we need to construct\n    // a KeyPath to both the final link and the final property.\n    KeyPath linkPrefix = kp;\n    if (kp.collectionOperation != CollectionOperation::Count && kp.collectionOperation != CollectionOperation::AllKeys && !kp.property.collection) {\n        REALM_ASSERT(!kp.links.empty());\n        linkPrefix.property = linkPrefix.links.back();\n        linkPrefix.links.pop_back();\n    }\n    return CollectionOperation(kp.collectionOperation, column_reference_from_key_path(std::move(linkPrefix), true),\n                               column_reference_from_key_path(std::move(kp), true));\n}\n\nNSPredicateOperatorType invert_comparison_operator(NSPredicateOperatorType type) {\n    switch (type) {\n        case NSLessThanPredicateOperatorType:\n            return NSGreaterThanPredicateOperatorType;\n        case NSLessThanOrEqualToPredicateOperatorType:\n            return NSGreaterThanOrEqualToPredicateOperatorType;\n        case NSGreaterThanPredicateOperatorType:\n            return NSLessThanPredicateOperatorType;\n        case NSGreaterThanOrEqualToPredicateOperatorType:\n            return NSLessThanOrEqualToPredicateOperatorType;\n        case NSBeginsWithPredicateOperatorType:\n        case NSEndsWithPredicateOperatorType:\n        case NSContainsPredicateOperatorType:\n        case NSLikePredicateOperatorType:\n            throwException(@\"Unsupported predicate\", @\"Operator '%@' requires a keypath on the left side.\", operatorName(type));\n        default:\n            return type;\n    }\n}\n\nvoid QueryBuilder::apply_collection_operator_expression(KeyPath&& kp, id value,\n                                                        NSComparisonPredicate *pred) {\n    CollectionOperation operation = collection_operation_from_key_path(std::move(kp));\n    operation.validate_comparison(value);\n\n    auto type = pred.predicateOperatorType;\n    if (pred.leftExpression.expressionType != NSKeyPathExpressionType) {\n        // Turn \"a > b\" into \"b < a\" so that we can always put the column on the lhs\n        type = invert_comparison_operator(type);\n    }\n    add_collection_operation_constraint(type, operation, value, pred.options);\n}\n\nvoid QueryBuilder::apply_value_expression(KeyPath&& kp, id value, NSComparisonPredicate *pred)\n{\n    if (key_path_contains_collection_operator(kp)) {\n        apply_collection_operator_expression(std::move(kp), value, pred);\n        return;\n    }\n\n    bool isAny = pred.comparisonPredicateModifier == NSAnyPredicateModifier;\n    ColumnReference column = column_reference_from_key_path(std::move(kp), isAny);\n\n    // check to see if this is a between query\n    if (pred.predicateOperatorType == NSBetweenPredicateOperatorType) {\n        add_between_constraint(std::move(column), value);\n        return;\n    }\n\n    if (pred.predicateOperatorType == NSInPredicateOperatorType) {\n        if ([value conformsToProtocol:@protocol(RLMGeospatial)]) {\n            // In case of `IN` check if the value is a Geo-shape, create a `geoWithin` query\n            add_within_constraint(std::move(column), value);\n        } else {\n            // turn \"key.path IN collection\" into ored together ==. \"collection IN key.path\" is handled elsewhere.\n            process_or_group(m_query, value, [&](id item) {\n                id normalized = value_from_constant_expression_or_value(item);\n                column.validate_comparison(normalized);\n                add_constraint(NSEqualToPredicateOperatorType, pred.options, column, normalized);\n            });\n        }\n        return;\n    }\n\n    column.validate_comparison(value);\n    if (pred.leftExpression.expressionType == NSKeyPathExpressionType) {\n        add_constraint(pred.predicateOperatorType, pred.options, std::move(column), value);\n    } else {\n        add_constraint(invert_comparison_operator(pred.predicateOperatorType), pred.options, std::move(column), value);\n    }\n}\n\nvoid QueryBuilder::apply_column_expression(KeyPath&& leftKeyPath, KeyPath&& rightKeyPath, NSComparisonPredicate *predicate)\n{\n    bool left_key_path_contains_collection_operator = key_path_contains_collection_operator(leftKeyPath);\n    bool right_key_path_contains_collection_operator = key_path_contains_collection_operator(rightKeyPath);\n    if (left_key_path_contains_collection_operator && right_key_path_contains_collection_operator) {\n        throwException(@\"Unsupported predicate\", @\"Key paths including aggregate operations cannot be compared with other aggregate operations.\");\n    }\n\n    if (left_key_path_contains_collection_operator) {\n        CollectionOperation left = collection_operation_from_key_path(std::move(leftKeyPath));\n        ColumnReference right = column_reference_from_key_path(std::move(rightKeyPath), false);\n        left.validate_comparison(right);\n        add_collection_operation_constraint(predicate.predicateOperatorType, std::move(left), std::move(right), predicate.options);\n        return;\n    }\n    if (right_key_path_contains_collection_operator) {\n        ColumnReference left = column_reference_from_key_path(std::move(leftKeyPath), false);\n        CollectionOperation right = collection_operation_from_key_path(std::move(rightKeyPath));\n        right.validate_comparison(left);\n        add_collection_operation_constraint(invert_comparison_operator(predicate.predicateOperatorType),\n                                            std::move(right), std::move(left), predicate.options);\n        return;\n    }\n\n    bool isAny = false;\n    ColumnReference left = column_reference_from_key_path(std::move(leftKeyPath), isAny);\n    ColumnReference right = column_reference_from_key_path(std::move(rightKeyPath), isAny);\n\n    // NOTE: It's assumed that column type must match and no automatic type conversion is supported.\n    RLMPrecondition(left.type() == right.type(),\n                    RLMPropertiesComparisonTypeMismatchException,\n                    RLMPropertiesComparisonTypeMismatchReason,\n                    RLMTypeToString(left.type()),\n                    RLMTypeToString(right.type()));\n\n    // TODO: Should we handle special case where left row is the same as right row (tautology)\n    add_constraint(predicate.predicateOperatorType, predicate.options,\n                   std::move(left), std::move(right));\n}\n\n// Identify expressions of the form [SELF valueForKeyPath:]\nbool is_self_value_for_key_path_function_expression(NSExpression *expression)\n{\n    if (expression.expressionType != NSFunctionExpressionType)\n        return false;\n\n    if (expression.operand.expressionType != NSEvaluatedObjectExpressionType)\n        return false;\n\n    return [expression.function isEqualToString:@\"valueForKeyPath:\"];\n}\n\n// -[NSPredicate predicateWithSubtitutionVariables:] results in function expressions of the form [SELF valueForKeyPath:]\n// that apply_predicate cannot handle. Replace such expressions with equivalent NSKeyPathExpressionType expressions.\nNSExpression *simplify_self_value_for_key_path_function_expression(NSExpression *expression) {\n    if (is_self_value_for_key_path_function_expression(expression)) {\n        if (NSString *keyPath = [expression.arguments.firstObject keyPath]) {\n            return [NSExpression expressionForKeyPath:keyPath];\n        }\n    }\n    return expression;\n}\n\nvoid QueryBuilder::apply_map_expression(RLMObjectSchema *objectSchema, NSExpression *functionExpression,\n                                        NSComparisonPredicateOptions options, NSPredicateOperatorType operatorType,\n                                        NSExpression *right) {\n    std::vector<PathElement> pathElements;\n    NSString *keyPath = get_path_elements(pathElements, functionExpression);\n\n    ColumnReference collectionColumn = column_reference_from_key_path(key_path_from_string(m_schema, objectSchema, keyPath), true);\n\n    if (collectionColumn.property().type == RLMPropertyTypeAny && !collectionColumn.property().dictionary) {\n        add_mixed_constraint(operatorType, options, std::move(collectionColumn.resolve<realm::Mixed>().path(pathElements)), right.constantValue);\n    } else {\n        RLMPrecondition(collectionColumn.property().dictionary, @\"Invalid predicate\",\n                        @\"Invalid keypath '%@': only dictionaries and realm `Any` support subscript predicates.\", functionExpression);\n        RLMPrecondition(pathElements.size() == 1, @\"Invalid subscript size\",\n                        @\"Invalid subscript size '%@': nested dictionaries queries are only allowed in mixed properties.\", functionExpression);\n        RLMPrecondition(pathElements[0].is_key(), @\"Invalid subscript type\",\n                        @\"Invalid subscript type '%@'; only string keys are allowed as subscripts in dictionary queries.\", functionExpression);\n        add_mixed_constraint(operatorType, options, std::move(collectionColumn.resolve<Dictionary>().key(pathElements[0].get_key())), right.constantValue);\n    }\n}\n\nvoid QueryBuilder::apply_function_expression(RLMObjectSchema *objectSchema, NSExpression *functionExpression,\n                                             NSPredicateOperatorType operatorType, NSExpression *right) {\n    RLMPrecondition(functionExpression.operand.expressionType == NSSubqueryExpressionType,\n                    @\"Invalid predicate\", @\"The '%@' function is not supported.\", functionExpression.function);\n    RLMPrecondition([functionExpression.function isEqualToString:@\"valueForKeyPath:\"] && functionExpression.arguments.count == 1,\n                    @\"Invalid predicate\", @\"The '%@' function is not supported on the result of a SUBQUERY.\", functionExpression.function);\n\n    NSExpression *keyPathExpression = functionExpression.arguments.firstObject;\n    RLMPrecondition([keyPathExpression.keyPath isEqualToString:@\"@count\"],\n                    @\"Invalid predicate\", @\"SUBQUERY is only supported when immediately followed by .@count that is compared with a constant number.\");\n    RLMPrecondition(right.expressionType == NSConstantValueExpressionType && [right.constantValue isKindOfClass:[NSNumber class]],\n                    @\"Invalid predicate expression\", @\"SUBQUERY(…).@count is only supported when compared with a constant number.\");\n\n    NSExpression *subqueryExpression = functionExpression.operand;\n    int64_t value = [right.constantValue integerValue];\n\n    ColumnReference collectionColumn = column_reference_from_key_path(key_path_from_string(m_schema, objectSchema, [subqueryExpression.collection keyPath]), true);\n    RLMObjectSchema *collectionMemberObjectSchema = m_schema[collectionColumn.property().objectClassName];\n\n    // Eliminate references to the iteration variable in the subquery.\n    NSPredicate *subqueryPredicate = [subqueryExpression.predicate predicateWithSubstitutionVariables:@{subqueryExpression.variable: [NSExpression expressionForEvaluatedObject]}];\n    subqueryPredicate = transformPredicate(subqueryPredicate, simplify_self_value_for_key_path_function_expression);\n\n    Query subquery = RLMPredicateToQuery(subqueryPredicate, collectionMemberObjectSchema, m_schema, m_group);\n    add_numeric_constraint(RLMPropertyTypeInt, operatorType,\n                           collectionColumn.resolve<Link>(std::move(subquery)).count(), value);\n}\n\nvoid QueryBuilder::apply_predicate(NSPredicate *predicate, RLMObjectSchema *objectSchema)\n{\n    // Compound predicates.\n    if ([predicate isMemberOfClass:[NSCompoundPredicate class]]) {\n        NSCompoundPredicate *comp = (NSCompoundPredicate *)predicate;\n\n        switch ([comp compoundPredicateType]) {\n            case NSAndPredicateType:\n                if (comp.subpredicates.count) {\n                    // Add all of the subpredicates.\n                    m_query.group();\n                    for (NSPredicate *subp in comp.subpredicates) {\n                        apply_predicate(subp, objectSchema);\n                    }\n                    m_query.end_group();\n                } else {\n                    // NSCompoundPredicate's documentation states that an AND predicate with no subpredicates evaluates to TRUE.\n                    m_query.and_query(std::unique_ptr<Expression>(new TrueExpression));\n                }\n                break;\n\n            case NSOrPredicateType: {\n                // Add all of the subpredicates with ors inbetween.\n                process_or_group(m_query, comp.subpredicates, [&](__unsafe_unretained NSPredicate *const subp) {\n                    apply_predicate(subp, objectSchema);\n                });\n                break;\n            }\n\n            case NSNotPredicateType:\n                // Add the negated subpredicate\n                m_query.Not();\n                apply_predicate(comp.subpredicates.firstObject, objectSchema);\n                break;\n\n            default:\n                // Not actually possible short of users making their own weird\n                // broken subclass of NSPredicate\n                throwException(@\"Invalid compound predicate type\",\n                               @\"Only AND, OR, and NOT compound predicates are supported\");\n        }\n    }\n    else if ([predicate isMemberOfClass:[NSComparisonPredicate class]]) {\n        NSComparisonPredicate *compp = (NSComparisonPredicate *)predicate;\n\n        RLMPrecondition(compp.comparisonPredicateModifier != NSAllPredicateModifier,\n                        @\"Invalid predicate\", @\"ALL modifier not supported\");\n\n        NSExpressionType exp1Type = compp.leftExpression.expressionType;\n        NSExpressionType exp2Type = compp.rightExpression.expressionType;\n\n        if (compp.predicateOperatorType == NSBetweenPredicateOperatorType || compp.predicateOperatorType == NSInPredicateOperatorType) {\n            // Inserting an array via %@ gives NSConstantValueExpressionType, but including it directly gives NSAggregateExpressionType\n            if (exp1Type == NSKeyPathExpressionType && (exp2Type == NSAggregateExpressionType || exp2Type == NSConstantValueExpressionType)) {\n                // \"key.path IN %@\", \"key.path IN {…}\", \"key.path BETWEEN %@\", or \"key.path BETWEEN {…}\".\n                exp2Type = NSConstantValueExpressionType;\n            }\n            else if (compp.predicateOperatorType == NSInPredicateOperatorType && exp1Type == NSConstantValueExpressionType && exp2Type == NSKeyPathExpressionType) {\n                // \"%@ IN key.path\" is equivalent to \"ANY key.path IN %@\". Rewrite the former into the latter.\n                compp = [NSComparisonPredicate predicateWithLeftExpression:compp.rightExpression rightExpression:compp.leftExpression\n                                                                  modifier:NSAnyPredicateModifier type:NSEqualToPredicateOperatorType options:0];\n                exp1Type = NSKeyPathExpressionType;\n                exp2Type = NSConstantValueExpressionType;\n            }\n            else {\n                if (compp.predicateOperatorType == NSBetweenPredicateOperatorType) {\n                    throwException(@\"Invalid predicate\",\n                                   @\"Predicate with BETWEEN operator must compare a KeyPath with an aggregate with two values\");\n                }\n                else if (compp.predicateOperatorType == NSInPredicateOperatorType) {\n                    throwException(@\"Invalid predicate\",\n                                   @\"Predicate with IN operator must compare a KeyPath with an aggregate\");\n                }\n            }\n        }\n\n        if (exp1Type == NSKeyPathExpressionType && exp2Type == NSKeyPathExpressionType) {\n            // both expression are KeyPaths\n            apply_column_expression(key_path_from_string(m_schema, objectSchema, compp.leftExpression.keyPath),\n                                    key_path_from_string(m_schema, objectSchema, compp.rightExpression.keyPath),\n                                    compp);\n        }\n        else if (exp1Type == NSKeyPathExpressionType && exp2Type == NSConstantValueExpressionType) {\n            // comparing keypath to value\n            apply_value_expression(key_path_from_string(m_schema, objectSchema, compp.leftExpression.keyPath),\n                                   compp.rightExpression.constantValue, compp);\n        }\n        else if (exp1Type == NSConstantValueExpressionType && exp2Type == NSKeyPathExpressionType) {\n            // comparing value to keypath\n            apply_value_expression(key_path_from_string(m_schema, objectSchema, compp.rightExpression.keyPath),\n                                   compp.leftExpression.constantValue, compp);\n        }\n        else if (exp1Type == NSFunctionExpressionType) {\n            if (compp.leftExpression.operand.expressionType == NSSubqueryExpressionType) {\n                apply_function_expression(objectSchema, compp.leftExpression, compp.predicateOperatorType, compp.rightExpression);\n            } else {\n                apply_map_expression(objectSchema, compp.leftExpression, compp.options, compp.predicateOperatorType, compp.rightExpression);\n            }\n        }\n        else if (exp1Type == NSSubqueryExpressionType) {\n            // The subquery expressions that we support are handled by the NSFunctionExpressionType case above.\n            throwException(@\"Invalid predicate expression\", @\"SUBQUERY is only supported when immediately followed by .@count.\");\n        }\n        else {\n            throwException(@\"Invalid predicate expressions\",\n                           @\"Predicate expressions must compare a keypath and another keypath or a constant value\");\n        }\n    }\n    else if ([predicate isEqual:[NSPredicate predicateWithValue:YES]]) {\n        m_query.and_query(std::unique_ptr<Expression>(new TrueExpression));\n    } else if ([predicate isEqual:[NSPredicate predicateWithValue:NO]]) {\n        m_query.and_query(std::unique_ptr<Expression>(new FalseExpression));\n    }\n    else {\n        // invalid predicate type\n        throwException(@\"Invalid predicate\",\n                       @\"Only support compound, comparison, and constant predicates\");\n    }\n}\n\n// This function returns the nested subscripts from a NSPredicate with the following format `anyCol[0]['key'][#any]`\n// and its respective keypath (including any linked keypath)\n// This will iterate each argument of the NSExpression and its nested NSExpressions, takes the constant subscript\n// and creates a PathElement to be used in the query. If we use `#any` as a wildcard this will show in the parser \n// predicate as NSKeyPathExpressionType.\nNSString* QueryBuilder::get_path_elements(std::vector<PathElement> &paths, NSExpression *expression) {\n    NSString *keyPath = @\"\";\n    for (NSUInteger i = 0; i < expression.arguments.count; i++) {\n        NSString *nestedKeyPath = @\"\";\n        if (expression.arguments[i].expressionType == NSFunctionExpressionType) {\n            nestedKeyPath = get_path_elements(paths, expression.arguments[i]);\n        } else if (expression.arguments[i].expressionType == NSConstantValueExpressionType) {\n            id value = [expression.arguments[i] constantValue];\n            if ([value isKindOfClass:[NSNumber class]]) {\n                paths.push_back(PathElement{[(NSNumber *)value intValue]});\n            } else if ([value isKindOfClass:[NSString class]]) {\n                NSString *key = (NSString *)value;\n                paths.push_back(PathElement{key.UTF8String});\n            } else {\n                throwException(@\"Invalid subscript type\",\n                               @\"Invalid subscript type '%@': Only `Strings` or index are allowed subscripts\", expression);\n            }\n        } else if (expression.arguments[i].expressionType == NSKeyPathExpressionType) {\n            auto keyPath = [(id)expression.arguments[i] predicateFormat];\n            if ([keyPath isEqual:@\"#any\"]) {\n                paths.emplace_back();\n            } else {\n                nestedKeyPath = keyPath;\n            }\n        } else {\n            throwException(@\"Invalid expression type\",\n                           @\"Invalid expression type '%@': Subscripts queries don't allow any other expression types\", expression);\n        }\n        if ([nestedKeyPath length] > 0) {\n            keyPath = ([keyPath length] > 0) ? [NSString stringWithFormat:@\"%@.%@\", keyPath, nestedKeyPath] : nestedKeyPath;\n        }\n    }\n\n    return keyPath;\n}\n} // namespace\n\nrealm::Query RLMPredicateToQuery(NSPredicate *predicate, RLMObjectSchema *objectSchema,\n                                 RLMSchema *schema, Group &group)\n{\n    auto query = get_table(group, objectSchema).where();\n\n    // passing a nil predicate is a no-op\n    if (!predicate) {\n        return query;\n    }\n\n    try {\n        @autoreleasepool {\n            QueryBuilder(query, group, schema).apply_predicate(predicate, objectSchema);\n        }\n    }\n    catch (std::exception const& e) {\n        @throw RLMException(e);\n    }\n\n    return query;\n}\n\n// return the property for a validated column name\nRLMProperty *RLMValidatedProperty(RLMObjectSchema *desc, NSString *columnName) {\n    RLMProperty *prop = desc[columnName];\n    RLMPrecondition(prop, @\"Invalid property name\",\n                    @\"Property '%@' not found in object of type '%@'\", columnName, desc.className);\n    return prop;\n}\n"
  },
  {
    "path": "Realm/RLMRealm.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\n@class RLMRealmConfiguration, RLMRealm, RLMObject, RLMSchema, RLMMigration, RLMNotificationToken, RLMThreadSafeReference, RLMAsyncOpenTask;\n\n/**\n A callback block for opening Realms asynchronously.\n\n Returns the Realm if the open was successful, or an error otherwise.\n */\ntypedef void(^RLMAsyncOpenRealmCallback)(RLMRealm * _Nullable realm, NSError * _Nullable error);\n\n/// The Id of the asynchronous transaction.\ntypedef unsigned RLMAsyncTransactionId;\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n/**\n An `RLMRealm` instance (also referred to as \"a Realm\") represents a Realm\n database.\n\n Realms can either be stored on disk (see `+[RLMRealm realmWithURL:]`) or in\n memory (see `RLMRealmConfiguration`).\n\n `RLMRealm` instances are cached internally, and constructing equivalent `RLMRealm`\n objects (for example, by using the same path or identifier) multiple times on a single thread\n within a single iteration of the run loop will normally return the same\n `RLMRealm` object.\n\n If you specifically want to ensure an `RLMRealm` instance is\n destroyed (for example, if you wish to open a Realm, check some property, and\n then possibly delete the Realm file and re-open it), place the code which uses\n the Realm within an `@autoreleasepool {}` and ensure you have no other\n strong references to it.\n\n @warning Non-frozen `RLMRealm` instances are thread-confined and cannot be\n shared across threads or dispatch queues. Trying to do so will cause an\n exception to be thrown. You must call this method on each thread you want to\n interact with the Realm on. For dispatch queues, this means that you must call\n it in each block which is dispatched, as a queue is not guaranteed to run all\n of its blocks on the same thread.\n */\n\n@interface RLMRealm : NSObject\n\n#pragma mark - Creating & Initializing a Realm\n\n/**\n Obtains an instance of the default Realm.\n\n The default Realm is used by the `RLMObject` class methods\n which do not take an `RLMRealm` parameter, but is otherwise not special. The\n default Realm is persisted as *default.realm* under the *Documents* directory of\n your Application on iOS, in your application's *Application Support*\n directory on macOS, and in the *Cache* directory on tvOS.\n\n The default Realm is created using the default `RLMRealmConfiguration`, which\n can be changed via `+[RLMRealmConfiguration setDefaultConfiguration:]`.\n\n @return The default `RLMRealm` instance for the current thread.\n */\n+ (instancetype)defaultRealm;\n\n/**\n Obtains an instance of the default Realm bound to the given queue.\n\n Rather than being confined to the thread they are opened on, queue-bound\n RLMRealms are confined to the given queue. They can be accessed from any\n thread as long as it is from within a block dispatch to the queue, and\n notifications will be delivered to the queue instead of a thread's run loop.\n\n Realms can only be confined to a serial queue. Queue-confined RLMRealm\n instances can be obtained when not on that queue, but attempting to do\n anything with that instance without first dispatching to the queue will throw\n an incorrect thread exception.\n\n The default Realm is created using the default `RLMRealmConfiguration`, which\n can be changed via `+[RLMRealmConfiguration setDefaultConfiguration:]`.\n\n @param queue A serial dispatch queue to confine the Realm to.\n @return The default `RLMRealm` instance for the given queue.\n */\n+ (instancetype)defaultRealmForQueue:(dispatch_queue_t)queue;\n\n/**\n Obtains an `RLMRealm` instance with the given configuration.\n\n @param configuration A configuration object to use when creating the Realm.\n @param error         If an error occurs, upon return contains an `NSError` object\n                      that describes the problem. If you are not interested in\n                      possible errors, pass in `NULL`.\n\n @return An `RLMRealm` instance.\n */\n+ (nullable instancetype)realmWithConfiguration:(RLMRealmConfiguration *)configuration error:(NSError **)error NS_RETURNS_RETAINED;\n\n/**\n Obtains an `RLMRealm` instance with the given configuration bound to the given queue.\n\n Rather than being confined to the thread they are opened on, queue-bound\n RLMRealms are confined to the given queue. They can be accessed from any\n thread as long as it is from within a block dispatch to the queue, and\n notifications will be delivered to the queue instead of a thread's run loop.\n\n Realms can only be confined to a serial queue. Queue-confined RLMRealm\n instances can be obtained when not on that queue, but attempting to do\n anything with that instance without first dispatching to the queue will throw\n an incorrect thread exception.\n\n @param configuration A configuration object to use when creating the Realm.\n @param queue         A serial dispatch queue to confine the Realm to.\n @param error         If an error occurs, upon return contains an `NSError` object\n                      that describes the problem. If you are not interested in\n                      possible errors, pass in `NULL`.\n\n @return An `RLMRealm` instance.\n */\n+ (nullable instancetype)realmWithConfiguration:(RLMRealmConfiguration *)configuration\n                                          queue:(nullable dispatch_queue_t)queue\n                                          error:(NSError **)error NS_RETURNS_RETAINED;\n\n/**\n Obtains an `RLMRealm` instance persisted at a specified file URL.\n\n @param fileURL The local URL of the file the Realm should be saved at.\n\n @return An `RLMRealm` instance.\n */\n+ (instancetype)realmWithURL:(NSURL *)fileURL NS_RETURNS_RETAINED;\n\n/**\n Asynchronously open a Realm and deliver it to a block on the given queue.\n\n Opening a Realm asynchronously will perform all work needed to get the Realm to\n a usable state (such as running potentially time-consuming migrations) on a\n background thread before dispatching to the given queue. In addition,\n synchronized Realms wait for all remote content available at the time the\n operation began to be downloaded and available locally.\n\n The Realm passed to the callback function is confined to the callback queue as\n if `-[RLMRealm realmWithConfiguration:queue:error]` was used.\n\n @param configuration A configuration object to use when opening the Realm.\n @param callbackQueue The serial dispatch queue on which the callback should be run.\n @param callback      A callback block. If the Realm was successfully opened,\n                      it will be passed in as an argument.\n                      Otherwise, an `NSError` describing what went wrong will be\n                      passed to the block instead.\n */\n+ (RLMAsyncOpenTask *)asyncOpenWithConfiguration:(RLMRealmConfiguration *)configuration\n                                   callbackQueue:(dispatch_queue_t)callbackQueue\n                                        callback:(RLMAsyncOpenRealmCallback)callback;\n\n/**\n The `RLMSchema` used by the Realm.\n */\n@property (nonatomic, readonly) RLMSchema *schema;\n\n/**\n Indicates if the Realm is currently engaged in a write transaction.\n\n @warning   Do not simply check this property and then start a write transaction whenever an object needs to be\n            created, updated, or removed. Doing so might cause a large number of write transactions to be created,\n            degrading performance. Instead, always prefer performing multiple updates during a single transaction.\n */\n@property (nonatomic, readonly) BOOL inWriteTransaction;\n\n/**\n The `RLMRealmConfiguration` object that was used to create this `RLMRealm` instance.\n */\n@property (nonatomic, readonly) RLMRealmConfiguration *configuration;\n\n/**\n Indicates if this Realm contains any objects.\n */\n@property (nonatomic, readonly) BOOL isEmpty;\n\n/**\n Indicates if this Realm is frozen.\n\n @see `-[RLMRealm freeze]`\n */\n@property (nonatomic, readonly, getter=isFrozen) BOOL frozen;\n\n/**\n Returns a frozen (immutable) snapshot of this Realm.\n\n A frozen Realm is an immutable snapshot view of a particular version of a\n Realm's data. Unlike normal RLMRealm instances, it does not live-update to\n reflect writes made to the Realm, and can be accessed from any thread. Writing\n to a frozen Realm is not allowed, and attempting to begin a write transaction\n will throw an exception.\n\n All objects and collections read from a frozen Realm will also be frozen.\n */\n- (RLMRealm *)freeze NS_RETURNS_RETAINED;\n\n/**\n Returns a live reference of this Realm.\n\n All objects and collections read from the returned Realm will no longer be frozen.\n This method will return `self` if it is not already frozen.\n */\n- (RLMRealm *)thaw;\n\n#pragma mark - File Management\n\n/**\n Writes a compacted and optionally encrypted copy of the Realm to the given local URL.\n\n The destination file cannot already exist.\n\n Note that if this method is called from within a write transaction, the\n *current* data is written, not the data from the point when the previous write\n transaction was committed.\n\n @param fileURL Local URL to save the Realm to.\n @param key     Optional 64-byte encryption key to encrypt the new file with.\n @param error   If an error occurs, upon return contains an `NSError` object\n that describes the problem. If you are not interested in\n possible errors, pass in `NULL`.\n\n @return `YES` if the Realm was successfully written to disk, `NO` if an error occurred.\n */\n- (BOOL)writeCopyToURL:(NSURL *)fileURL encryptionKey:(nullable NSData *)key error:(NSError **)error;\n\n/**\n Writes a copy of the Realm to a given location specified by a given configuration.\n\n The destination file cannot already exist.\n\n @param configuration A Realm Configuration.\n @param error   If an error occurs, upon return contains an `NSError` object\n that describes the problem. If you are not interested in\n possible errors, pass in `NULL`.\n\n @return `YES` if the Realm was successfully written to disk, `NO` if an error occurred.\n */\n- (BOOL)writeCopyForConfiguration:(RLMRealmConfiguration *)configuration error:(NSError **)error;\n\n/**\n Checks if the Realm file for the given configuration exists locally on disk.\n\n For non-synchronized, non-in-memory Realms, this is equivalent to\n `-[NSFileManager.defaultManager fileExistsAtPath:config.path]`. For\n synchronized Realms, it takes care of computing the actual path on disk based\n on the server, virtual path, and user as is done when opening the Realm.\n\n @param config A Realm configuration to check the existence of.\n @return YES if the Realm file for the given configuration exists on disk, NO otherwise.\n */\n+ (BOOL)fileExistsForConfiguration:(RLMRealmConfiguration *)config;\n\n/**\n Deletes the local Realm file and associated temporary files for the given configuration.\n\n This deletes the \".realm\", \".note\" and \".management\" files which would be\n created by opening the Realm with the given configuration. It does not delete\n the \".lock\" file (which contains no persisted data and is recreated from\n scratch every time the Realm file is opened).\n\n The Realm must not be currently open on any thread or in another process. If\n it is, this will return NO and report the error RLMErrorAlreadyOpen. Attempting to open\n the Realm on another thread while the deletion is happening will block (and\n then create a new Realm and open that afterwards).\n\n If the Realm already does not exist this will return `NO` and report the error NSFileNoSuchFileError;\n\n @param config A Realm configuration identifying the Realm to be deleted.\n @return YES if any files were deleted, NO otherwise.\n */\n+ (BOOL)deleteFilesForConfiguration:(RLMRealmConfiguration *)config error:(NSError **)error\n __attribute__((swift_error(nonnull_error)));\n\n#pragma mark - Notifications\n\n/**\n The type of a block to run whenever the data within the Realm is modified.\n\n @see `-[RLMRealm addNotificationBlock:]`\n */\ntypedef void (^RLMNotificationBlock)(RLMNotification notification, RLMRealm *realm);\n\n#pragma mark - Receiving Notification when a Realm Changes\n\n/**\n Adds a notification handler for changes in this Realm, and returns a notification token.\n\n Notification handlers are called after each write transaction is committed,\n either on the current thread or other threads.\n\n Handler blocks are called on the same thread that they were added on, and may\n only be added on threads which are currently within a run loop. Unless you are\n specifically creating and running a run loop on a background thread, this will\n normally only be the main thread.\n\n The block has the following definition:\n\n     typedef void(^RLMNotificationBlock)(RLMNotification notification, RLMRealm *realm);\n\n It receives the following parameters:\n\n - `NSString` \\***notification**:    The name of the incoming notification. See\n                                     `RLMRealmNotification` for information on what\n                                     notifications are sent.\n - `RLMRealm` \\***realm**:           The Realm for which this notification occurred.\n\n @param block   A block which is called to process Realm notifications.\n\n @return A token object which must be retained as long as you wish to continue\n         receiving change notifications.\n */\n- (RLMNotificationToken *)addNotificationBlock:(RLMNotificationBlock)block __attribute__((warn_unused_result));\n\n#pragma mark - Writing to a Realm\n\n/**\n Begins a write transaction on the Realm.\n\n Only one write transaction can be open at a time for each Realm file. Write\n transactions cannot be nested, and trying to begin a write transaction on a\n Realm which is already in a write transaction will throw an exception. Calls to\n `beginWriteTransaction` from `RLMRealm` instances for the same Realm file in\n other threads or other processes will block until the current write transaction\n completes or is cancelled.\n\n Before beginning the write transaction, `beginWriteTransaction` updates the\n `RLMRealm` instance to the latest Realm version, as if `refresh` had been\n called, and generates notifications if applicable. This has no effect if the\n Realm was already up to date.\n\n It is rarely a good idea to have write transactions span multiple cycles of\n the run loop, but if you do wish to do so you will need to ensure that the\n Realm participating in the write transaction is kept alive until the write\n transaction is committed.\n */\n- (void)beginWriteTransaction;\n\n/**\n Commits all write operations in the current write transaction, and ends the\n transaction.\n\n After saving the changes, all notification blocks registered on this specific\n `RLMRealm` instance are invoked synchronously. Notification blocks registered\n on other threads or on collections are invoked asynchronously. If you do not\n want to receive a specific notification for this write tranaction, see\n `commitWriteTransactionWithoutNotifying:error:`.\n\n This method can fail if there is insufficient disk space available to save the\n writes made, or due to unexpected i/o errors. This version of the method throws\n an exception when errors occur. Use the version with a `NSError` out parameter\n instead if you wish to handle errors.\n\n @warning This method may only be called during a write transaction.\n */\n- (void)commitWriteTransaction NS_SWIFT_UNAVAILABLE(\"\");\n\n/**\n Commits all write operations in the current write transaction, and ends the\n transaction.\n\n After saving the changes, all notification blocks registered on this specific\n `RLMRealm` instance are invoked synchronously. Notification blocks registered\n on other threads or on collections are invoked asynchronously. If you do not\n want to receive a specific notification for this write tranaction, see\n `commitWriteTransactionWithoutNotifying:error:`.\n\n This method can fail if there is insufficient disk space available to save the\n writes made, or due to unexpected i/o errors.\n\n @warning This method may only be called during a write transaction.\n\n @param error If an error occurs, upon return contains an `NSError` object\n              that describes the problem. If you are not interested in\n              possible errors, pass in `NULL`.\n\n @return Whether the transaction succeeded.\n */\n- (BOOL)commitWriteTransaction:(NSError **)error;\n\n/**\n Commits all write operations in the current write transaction, without\n notifying specific notification blocks of the changes.\n\n After saving the changes, all notification blocks registered on this specific\n `RLMRealm` instance are invoked synchronously. Notification blocks registered\n on other threads or on collections are scheduled to be invoked asynchronously.\n\n You can skip notifiying specific notification blocks about the changes made\n in this write transaction by passing in their associated notification tokens.\n This is primarily useful when the write transaction is saving changes already\n made in the UI and you do not want to have the notification block attempt to\n re-apply the same changes.\n\n The tokens passed to this method must be for notifications for this specific\n `RLMRealm` instance. Notifications for different threads cannot be skipped\n using this method.\n\n This method can fail if there is insufficient disk space available to save the\n writes made, or due to unexpected i/o errors.\n\n @warning This method may only be called during a write transaction.\n\n @param tokens An array of notification tokens which were returned from adding\n               callbacks which you do not want to be notified for the changes\n               made in this write transaction.\n @param error If an error occurs, upon return contains an `NSError` object\n              that describes the problem. If you are not interested in\n              possible errors, pass in `NULL`.\n\n @return Whether the transaction succeeded.\n */\n- (BOOL)commitWriteTransactionWithoutNotifying:(NSArray<RLMNotificationToken *> *)tokens error:(NSError **)error;\n\n/**\n Reverts all writes made during the current write transaction and ends the transaction.\n\n This rolls back all objects in the Realm to the state they were in at the\n beginning of the write transaction, and then ends the transaction.\n\n This restores the data for deleted objects, but does not revive invalidated\n object instances. Any `RLMObject`s which were added to the Realm will be\n invalidated rather than becoming unmanaged.\n Given the following code:\n\n     ObjectType *oldObject = [[ObjectType objectsWhere:@\"...\"] firstObject];\n     ObjectType *newObject = [[ObjectType alloc] init];\n\n     [realm beginWriteTransaction];\n     [realm addObject:newObject];\n     [realm deleteObject:oldObject];\n     [realm cancelWriteTransaction];\n\n Both `oldObject` and `newObject` will return `YES` for `isInvalidated`,\n but re-running the query which provided `oldObject` will once again return\n the valid object.\n\n KVO observers on any objects which were modified during the transaction will\n be notified about the change back to their initial values, but no other\n notifications are produced by a cancelled write transaction.\n\n @warning This method may only be called during a write transaction.\n */\n- (void)cancelWriteTransaction;\n\n/**\n Performs actions contained within the given block inside a write transaction.\n\n @see `[RLMRealm transactionWithoutNotifying:block:error:]`\n */\n- (void)transactionWithBlock:(__attribute__((noescape)) void(^)(void))block NS_SWIFT_UNAVAILABLE(\"\");\n\n/**\n Performs actions contained within the given block inside a write transaction.\n\n @see `[RLMRealm transactionWithoutNotifying:block:error:]`\n */\n- (BOOL)transactionWithBlock:(__attribute__((noescape)) void(^)(void))block error:(NSError **)error;\n\n/**\n Performs actions contained within the given block inside a write transaction.\n\n @see `[RLMRealm transactionWithoutNotifying:block:error:]`\n */\n- (void)transactionWithoutNotifying:(NSArray<RLMNotificationToken *> *)tokens block:(__attribute__((noescape)) void(^)(void))block;\n\n/**\n Performs actions contained within the given block inside a write transaction.\n\n Write transactions cannot be nested, and trying to execute a write transaction\n on a Realm which is already participating in a write transaction will throw an\n exception. Calls to `transactionWithBlock:` from `RLMRealm` instances in other\n threads will block until the current write transaction completes.\n\n Before beginning the write transaction, `transactionWithBlock:` updates the\n `RLMRealm` instance to the latest Realm version, as if `refresh` had been called, and\n generates notifications if applicable. This has no effect if the Realm\n was already up to date.\n\n You can skip notifiying specific notification blocks about the changes made\n in this write transaction by passing in their associated notification tokens.\n This is primarily useful when the write transaction is saving changes already\n made in the UI and you do not want to have the notification block attempt to\n re-apply the same changes.\n\n The tokens passed to this method must be for notifications for this specific\n `RLMRealm` instance. Notifications for different threads cannot be skipped\n using this method.\n\n @param tokens An array of notification tokens which were returned from adding\n               callbacks which you do not want to be notified for the changes\n               made in this write transaction.\n @param block The block containing actions to perform.\n @param error If an error occurs, upon return contains an `NSError` object\n              that describes the problem. If you are not interested in\n              possible errors, pass in `NULL`.\n\n @return Whether the transaction succeeded.\n */\n- (BOOL)transactionWithoutNotifying:(NSArray<RLMNotificationToken *> *)tokens block:(__attribute__((noescape)) void(^)(void))block error:(NSError **)error;\n\n/**\n Indicates if the Realm is currently performing async write operations.\n This becomes YES following a call to `beginAsyncWriteTransaction`,\n `commitAsyncWriteTransaction`, or `asyncTransactionWithBlock:`, and remains so\n until all scheduled async write work has completed.\n \n @warning If this is `YES`, closing or invalidating the Realm will block until scheduled work has completed.\n */\n@property (nonatomic, readonly) BOOL isPerformingAsynchronousWriteOperations;\n\n/**\n Begins an asynchronous write transaction.\n This function asynchronously begins a write transaction on a background\n thread, and then invokes the block on the original thread or queue once the\n transaction has begun. Unlike `beginWriteTransaction`, this does not block the\n calling thread if another thread is current inside a write transaction, and\n will always return immediately.\n Multiple calls to this function (or the other functions which perform\n asynchronous write transactions) will queue the blocks to be called in the\n same order as they were queued. This includes calls from inside a write\n transaction block, which unlike with synchronous transactions are allowed.\n \n @param block The block containing actions to perform inside the write transaction.\n        `block` should end by calling `commitAsyncWriteTransaction`,\n        `commitWriteTransaction` or `cancelWriteTransaction`.\n        Returning without one of these calls is equivalent to calling `cancelWriteTransaction`.\n \n @return An id identifying the asynchronous transaction which can be passed to\n         `cancelAsyncTransaction:` prior to the block being called to cancel\n         the pending invocation of the block.\n */\n- (RLMAsyncTransactionId)beginAsyncWriteTransaction:(void(^)(void))block;\n\n/**\n Asynchronously commits a write transaction.\n The call returns immediately allowing the caller to proceed while the I/O is\n performed on a dedicated background thread. This can be used regardless of if\n the write transaction was begun with `beginWriteTransaction` or\n `beginAsyncWriteTransaction`.\n \n @param completionBlock A block which will be called on the source thread or\n                        queue once the commit has either completed or failed\n                        with an error.\n \n @param allowGrouping If `YES`, multiple sequential calls to\n                      `commitAsyncWriteTransaction:` may be batched together\n                      and persisted to stable storage in one group. This\n                      improves write performance, particularly when the\n                      individual transactions being batched are small. In the\n                      event of a crash or power failure, either all of the\n                      grouped transactions will be lost or none will, rather\n                      than the usual guarantee that data has been persisted as\n                      soon as a call to commit has returned.\n \n @return An id identifying the asynchronous transaction commit can be passed to\n         `cancelAsyncTransaction:` prior to the completion block being called\n         to cancel the pending invocation of the block. Note that this does\n         *not* cancel the commit itself.\n*/\n- (RLMAsyncTransactionId)commitAsyncWriteTransaction:(nullable void(^)(NSError *_Nullable))completionBlock\n                                       allowGrouping:(BOOL)allowGrouping\n    __attribute__((swift_async(not_swift_private, 1)))\n    __attribute__((swift_attr(\"@_unsafeInheritExecutor\")));\n\n/**\n Asynchronously commits a write transaction.\n The call returns immediately allowing the caller to proceed while the I/O is\n performed on a dedicated background thread. This can be used regardless of if\n the write transaction was begun with `beginWriteTransaction` or\n `beginAsyncWriteTransaction`.\n \n @param completionBlock A block which will be called on the source thread or\n                        queue once the commit has either completed or failed\n                        with an error.\n \n @return An id identifying the asynchronous transaction commit can be passed to\n         `cancelAsyncTransaction:` prior to the completion block being called\n         to cancel the pending invocation of the block. Note that this does\n         *not* cancel the commit itself.\n*/\n- (RLMAsyncTransactionId)commitAsyncWriteTransaction:(void(^)(NSError *_Nullable))completionBlock;\n\n/**\n Asynchronously commits a write transaction.\n The call returns immediately allowing the caller to proceed while the I/O is\n performed on a dedicated background thread. This can be used regardless of if\n the write transaction was begun with `beginWriteTransaction` or\n `beginAsyncWriteTransaction`.\n \n @return An id identifying the asynchronous transaction commit can be passed to\n         `cancelAsyncTransaction:` prior to the completion block being called\n         to cancel the pending invocation of the block. Note that this does\n         *not* cancel the commit itself.\n*/\n- (RLMAsyncTransactionId)commitAsyncWriteTransaction;\n\n/**\n Cancels a queued block for an asynchronous transaction.\n This can cancel a block passed to either an asynchronous begin or an\n asynchronous commit. Canceling a begin cancels that transaction entirely,\n while canceling a commit merely cancels the invocation of the completion\n callback, and the commit will still happen.\n Transactions can only be canceled before the block is invoked, and calling\n `cancelAsyncTransaction:` from within the block is a no-op.\n \n @param asyncTransactionId A transaction id from either `beginAsyncWriteTransaction:` or `commitAsyncWriteTransaction:`.\n*/\n- (void)cancelAsyncTransaction:(RLMAsyncTransactionId)asyncTransactionId;\n\n/**\n Asynchronously performs actions contained within the given block inside a\n write transaction.\n The write transaction is begun asynchronously as if calling\n `beginAsyncWriteTransaction:`, and by default the transaction is commited\n asynchronously after the block completes. You can also explicitly call\n `commitWriteTransaction` or `cancelWriteTransaction` from within the block to\n synchronously commit or cancel the write transaction.\n \n @param block The block containing actions to perform.\n \n @param completionBlock A block which will be called on the source thread or\n                        queue once the commit has either completed or failed\n                        with an error.\n\n @return An id identifying the asynchronous transaction which can be passed to\n         `cancelAsyncTransaction:` prior to the block being called to cancel\n         the pending invocation of the block.\n*/\n- (RLMAsyncTransactionId)asyncTransactionWithBlock:(void(^)(void))block onComplete:(nullable void(^)(NSError *))completionBlock;\n\n/**\n Asynchronously performs actions contained within the given block inside a\n write transaction.\n The write transaction is begun asynchronously as if calling\n `beginAsyncWriteTransaction:`, and by default the transaction is commited\n asynchronously after the block completes. You can also explicitly call\n `commitWriteTransaction` or `cancelWriteTransaction` from within the block to\n synchronously commit or cancel the write transaction.\n \n @param block The block containing actions to perform.\n \n @return An id identifying the asynchronous transaction which can be passed to\n         `cancelAsyncTransaction:` prior to the block being called to cancel\n         the pending invocation of the block.\n*/\n- (RLMAsyncTransactionId)asyncTransactionWithBlock:(void(^)(void))block;\n\n/**\n Updates the Realm and outstanding objects managed by the Realm to point to the\n most recent data.\n\n If the version of the Realm is actually changed, Realm and collection\n notifications will be sent to reflect the changes. This may take some time, as\n collection notifications are prepared on a background thread. As a result,\n calling this method on the main thread is not advisable.\n\n @return Whether there were any updates for the Realm. Note that `YES` may be\n         returned even if no data actually changed.\n */\n- (BOOL)refresh;\n\n/**\n Set this property to `YES` to automatically update this Realm when changes\n happen in other threads.\n\n If set to `YES` (the default), changes made on other threads will be reflected\n in this Realm on the next cycle of the run loop after the changes are\n committed.  If set to `NO`, you must manually call `-refresh` on the Realm to\n update it to get the latest data.\n\n Note that by default, background threads do not have an active run loop and you\n will need to manually call `-refresh` in order to update to the latest version,\n even if `autorefresh` is set to `YES`.\n\n Even with this property enabled, you can still call `-refresh` at any time to\n update the Realm before the automatic refresh would occur.\n\n Write transactions will still always advance a Realm to the latest version and\n produce local notifications on commit even if autorefresh is disabled.\n\n Disabling `autorefresh` on a Realm without any strong references to it will not\n have any effect, and `autorefresh` will revert back to `YES` the next time the\n Realm is created. This is normally irrelevant as it means that there is nothing\n to refresh (as managed `RLMObject`s, `RLMArray`s, and `RLMResults` have strong\n references to the Realm that manages them), but it means that setting\n `RLMRealm.defaultRealm.autorefresh = NO` in\n `application:didFinishLaunchingWithOptions:` and only later storing Realm\n objects will not work.\n\n Defaults to `YES`.\n */\n@property (nonatomic) BOOL autorefresh;\n\n/**\n Invalidates all `RLMObject`s, `RLMResults`, `RLMLinkingObjects`, and `RLMArray`s managed by the Realm.\n\n A Realm holds a read lock on the version of the data accessed by it, so\n that changes made to the Realm on different threads do not modify or delete the\n data seen by this Realm. Calling this method releases the read lock,\n allowing the space used on disk to be reused by later write transactions rather\n than growing the file. This method should be called before performing long\n blocking operations on a background thread on which you previously read data\n from the Realm which you no longer need.\n\n All `RLMObject`, `RLMResults` and `RLMArray` instances obtained from this\n `RLMRealm` instance on the current thread are invalidated. `RLMObject`s and `RLMArray`s\n cannot be used. `RLMResults` will become empty. The Realm itself remains valid,\n and a new read transaction is implicitly begun the next time data is read from the Realm.\n\n Calling this method multiple times in a row without reading any data from the\n Realm, or before ever reading any data from the Realm, is a no-op.\n */\n- (void)invalidate;\n\n#pragma mark - Accessing Objects\n\n/**\n Returns the same object as the one referenced when the `RLMThreadSafeReference` was first created,\n but resolved for the current Realm for this thread. Returns `nil` if this object was deleted after\n the reference was created.\n\n @param reference The thread-safe reference to the thread-confined object to resolve in this Realm.\n\n @warning A `RLMThreadSafeReference` object must be resolved at most once.\n          Failing to resolve a `RLMThreadSafeReference` will result in the source version of the\n          Realm being pinned until the reference is deallocated.\n          An exception will be thrown if a reference is resolved more than once.\n\n @warning Cannot call within a write transaction.\n\n @note Will refresh this Realm if the source Realm was at a later version than this one.\n\n @see `+[RLMThreadSafeReference referenceWithThreadConfined:]`\n */\n- (nullable id)resolveThreadSafeReference:(RLMThreadSafeReference *)reference\nNS_REFINED_FOR_SWIFT;\n\n#pragma mark - Adding and Removing Objects from a Realm\n\n/**\n Adds an object to the Realm.\n\n Once added, this object is considered to be managed by the Realm. It can be retrieved\n using the `objectsWhere:` selectors on `RLMRealm` and on subclasses of `RLMObject`.\n\n When added, all child relationships referenced by this object will also be added to\n the Realm if they are not already in it.\n\n If the object or any related objects are already being managed by a different Realm\n an exception will be thrown. Use `-[RLMObject createInRealm:withObject:]` to insert a copy of a managed object\n into a different Realm.\n\n The object to be added must be valid and cannot have been previously deleted\n from a Realm (i.e. `isInvalidated` must be `NO`).\n\n @warning This method may only be called during a write transaction.\n\n @param object  The object to be added to this Realm.\n */\n- (void)addObject:(RLMObject *)object;\n\n/**\n Adds all the objects in a collection to the Realm.\n\n This is the equivalent of calling `addObject:` for every object in a collection.\n\n @warning This method may only be called during a write transaction.\n\n @param objects   An enumerable collection such as `NSArray`, `RLMArray`, or `RLMResults`,\n                  containing Realm objects to be added to the Realm.\n\n @see   `addObject:`\n */\n- (void)addObjects:(id<NSFastEnumeration>)objects;\n\n/**\n Adds or updates an existing object into the Realm.\n\n The object provided must have a designated primary key. If no objects exist in the Realm\n with the same primary key value, the object is inserted. Otherwise, the existing object is\n updated with any changed values.\n\n As with `addObject:`, the object cannot already be managed by a different\n Realm. Use `-[RLMObject createOrUpdateInRealm:withValue:]` to copy values to\n a different Realm.\n\n If there is a property or KVC value on `object` whose value is nil, and it corresponds\n to a nullable property on an existing object being updated, that nullable property will\n be set to nil.\n\n @warning This method may only be called during a write transaction.\n\n @param object  The object to be added or updated.\n */\n- (void)addOrUpdateObject:(RLMObject *)object;\n\n/**\n Adds or updates all the objects in a collection into the Realm.\n\n This is the equivalent of calling `addOrUpdateObject:` for every object in a collection.\n\n @warning This method may only be called during a write transaction.\n\n @param objects  An enumerable collection such as `NSArray`, `RLMArray`, or `RLMResults`,\n                 containing Realm objects to be added to or updated within the Realm.\n\n @see   `addOrUpdateObject:`\n */\n- (void)addOrUpdateObjects:(id<NSFastEnumeration>)objects;\n\n/**\n Deletes an object from the Realm. Once the object is deleted it is considered invalidated.\n\n @warning This method may only be called during a write transaction.\n\n @param object  The object to be deleted.\n */\n- (void)deleteObject:(RLMObject *)object;\n\n/**\n Deletes one or more objects from the Realm.\n\n This is the equivalent of calling `deleteObject:` for every object in a collection.\n\n @warning This method may only be called during a write transaction.\n\n @param objects  An enumerable collection such as `NSArray`, `RLMArray`, or `RLMResults`,\n                 containing objects to be deleted from the Realm.\n\n @see `deleteObject:`\n */\n- (void)deleteObjects:(id<NSFastEnumeration>)objects;\n\n/**\n Deletes all objects from the Realm.\n\n @warning This method may only be called during a write transaction.\n\n @see `deleteObject:`\n */\n- (void)deleteAllObjects;\n\n#pragma mark - Migrations\n\n/**\n The type of a migration block used to migrate a Realm.\n\n @param migration   A `RLMMigration` object used to perform the migration. The\n                    migration object allows you to enumerate and alter any\n                    existing objects which require migration.\n\n @param oldSchemaVersion    The schema version of the Realm being migrated.\n */\nNS_SWIFT_SENDABLE\ntypedef void (^RLMMigrationBlock)(RLMMigration *migration, uint64_t oldSchemaVersion);\n\n/**\n Returns the schema version for a Realm at a given local URL.\n\n @param fileURL Local URL to a Realm file.\n @param key     64-byte key used to encrypt the file, or `nil` if it is unencrypted.\n @param error   If an error occurs, upon return contains an `NSError` object\n                that describes the problem. If you are not interested in\n                possible errors, pass in `NULL`.\n\n @return The version of the Realm at `fileURL`, or `RLMNotVersioned` if the version cannot be read.\n */\n+ (uint64_t)schemaVersionAtURL:(NSURL *)fileURL encryptionKey:(nullable NSData *)key\n                         error:(NSError **)error\nNS_REFINED_FOR_SWIFT;\n\n/**\n Performs the given Realm configuration's migration block on a Realm at the given path.\n\n This method is called automatically when opening a Realm for the first time and does\n not need to be called explicitly. You can choose to call this method to control\n exactly when and how migrations are performed.\n\n @param configuration The Realm configuration used to open and migrate the Realm.\n @return              The error that occurred while applying the migration, if any.\n\n @see                 RLMMigration\n */\n+ (BOOL)performMigrationForConfiguration:(RLMRealmConfiguration *)configuration error:(NSError **)error;\n\n#pragma mark - Unavailable Methods\n\n/**\n RLMRealm instances are cached internally by Realm and cannot be created directly.\n\n Use `+[RLMRealm defaultRealm]`, `+[RLMRealm realmWithConfiguration:error:]` or\n `+[RLMRealm realmWithURL]` to obtain a reference to an RLMRealm.\n */\n- (instancetype)init __attribute__((unavailable(\"Use +defaultRealm, +realmWithConfiguration: or +realmWithURL:.\")));\n\n/**\n RLMRealm instances are cached internally by Realm and cannot be created directly.\n\n Use `+[RLMRealm defaultRealm]`, `+[RLMRealm realmWithConfiguration:error:]` or\n `+[RLMRealm realmWithURL]` to obtain a reference to an RLMRealm.\n */\n+ (instancetype)new __attribute__((unavailable(\"Use +defaultRealm, +realmWithConfiguration: or +realmWithURL:.\")));\n\n/// :nodoc:\n- (void)addOrUpdateObjectsFromArray:(id)array __attribute__((unavailable(\"Renamed to -addOrUpdateObjects:.\")));\n\n@end\n\n// MARK: - RLMNotificationToken\n\n/**\n A token which is returned from methods which subscribe to changes to a Realm.\n\n Change subscriptions in Realm return an `RLMNotificationToken` instance,\n which can be used to unsubscribe from the changes. You must store a strong\n reference to the token for as long as you want to continue to receive notifications.\n When you wish to stop, call the `-invalidate` method. Notifications are also stopped if\n the token is deallocated.\n */\nNS_SWIFT_SENDABLE // is internally thread-safe\n@interface RLMNotificationToken : NSObject\n/// Stops notifications for the change subscription that returned this token.\n///\n/// @return True if the token was previously valid, and false if it was already invalidated.\n- (bool)invalidate;\n\n/// Stops notifications for the change subscription that returned this token.\n- (void)stop __attribute__((unavailable(\"Renamed to -invalidate.\"))) NS_REFINED_FOR_SWIFT;\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMRealm.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMRealm_Private.hpp\"\n\n#import \"RLMAsyncTask_Private.h\"\n#import \"RLMArray_Private.hpp\"\n#import \"RLMDictionary_Private.hpp\"\n#import \"RLMError_Private.hpp\"\n#import \"RLMLogger.h\"\n#import \"RLMMigration_Private.h\"\n#import \"RLMObject_Private.h\"\n#import \"RLMObject_Private.hpp\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMObjectStore.h\"\n#import \"RLMObservation.hpp\"\n#import \"RLMProperty.h\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMQueryUtil.hpp\"\n#import \"RLMRealmConfiguration_Private.hpp\"\n#import \"RLMRealmUtil.hpp\"\n#import \"RLMScheduler.h\"\n#import \"RLMSchema_Private.hpp\"\n#import \"RLMSet_Private.hpp\"\n#import \"RLMThreadSafeReference_Private.hpp\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/disable_sync_to_disk.hpp>\n#import <realm/object-store/impl/realm_coordinator.hpp>\n#import <realm/object-store/object_store.hpp>\n#import <realm/object-store/schema.hpp>\n#import <realm/object-store/shared_realm.hpp>\n#import <realm/object-store/util/scheduler.hpp>\n#import <realm/util/scope_exit.hpp>\n\n\nusing namespace realm;\nusing util::File;\n\n@interface RLMRealmNotificationToken : RLMNotificationToken\n@property (nonatomic, strong) RLMRealm *realm;\n@property (nonatomic, copy) RLMNotificationBlock block;\n@end\n\n@interface RLMRealm ()\n@property (nonatomic, strong) NSHashTable<RLMRealmNotificationToken *> *notificationHandlers;\n- (void)sendNotifications:(RLMNotification)notification;\n@end\n\nvoid RLMDisableSyncToDisk() {\n    realm::disable_sync_to_disk();\n}\n\nstatic std::atomic<bool> s_set_skip_backup_attribute{true};\nvoid RLMSetSkipBackupAttribute(bool value) {\n    s_set_skip_backup_attribute = value;\n}\n\nstatic void RLMAddSkipBackupAttributeToItemAtPath(std::string_view path) {\n    [[NSURL fileURLWithPath:@(path.data())] setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:nil];\n}\n\nvoid RLMWaitForRealmToClose(NSString *path) {\n    NSString *lockfilePath = [path stringByAppendingString:@\".lock\"];\n    if (![NSFileManager.defaultManager fileExistsAtPath:lockfilePath]) {\n        return;\n    }\n\n    File lockfile(lockfilePath.UTF8String, File::mode_Update);\n    lockfile.set_fifo_path([path stringByAppendingString:@\".management\"].UTF8String, \"lock.fifo\");\n    while (!lockfile.try_rw_lock_exclusive()) {\n        sched_yield();\n    }\n}\n\nBOOL RLMIsRealmCachedAtPath(NSString *path) {\n    return RLMGetAnyCachedRealmForPath([path cStringUsingEncoding:NSUTF8StringEncoding]) != nil;\n}\n\nRLM_HIDDEN\n@implementation RLMRealmNotificationToken\n- (bool)invalidate {\n    if (_realm) {\n        [_realm verifyThread];\n        [_realm.notificationHandlers removeObject:self];\n        _realm = nil;\n        _block = nil;\n        return true;\n    }\n    return false;\n}\n\n- (void)suppressNextNotification {\n    // Temporarily replace the block with one which restores the old block\n    // rather than producing a notification.\n\n    // This briefly creates a retain cycle but it's fine because the block will\n    // be synchronously called shortly after this method is called. Unlike with\n    // collection notifications, this does not have to go through the object\n    // store or do fancy things to handle transaction coalescing because it's\n    // called synchronously by the obj-c code and not by the object store.\n    auto notificationBlock = _block;\n    _block = ^(RLMNotification, RLMRealm *) {\n        _block = notificationBlock;\n    };\n}\n\n- (void)dealloc {\n    if (_realm || _block) {\n        NSLog(@\"RLMNotificationToken released without unregistering a notification. You must hold \"\n              @\"on to the RLMNotificationToken returned from addNotificationBlock and call \"\n              @\"-[RLMNotificationToken invalidate] when you no longer wish to receive RLMRealm notifications.\");\n    }\n}\n@end\n\nstatic bool shouldForciblyDisableEncryption() {\n    static bool disableEncryption = getenv(\"REALM_DISABLE_ENCRYPTION\");\n    return disableEncryption;\n}\n\nNSData *RLMRealmValidatedEncryptionKey(NSData *key) {\n    if (shouldForciblyDisableEncryption()) {\n        return nil;\n    }\n\n    if (key && key.length != 64) {\n        @throw RLMException(@\"Encryption key must be exactly 64 bytes long\");\n    }\n\n    return key;\n}\n\nREALM_NOINLINE void RLMRealmTranslateException(NSError **error) {\n    try {\n        throw;\n    }\n    catch (FileAccessError const& ex) {\n        RLMSetErrorOrThrow(makeError(ex), error);\n    }\n    catch (Exception const& ex) {\n        RLMSetErrorOrThrow(makeError(ex), error);\n    }\n    catch (std::system_error const& ex) {\n        RLMSetErrorOrThrow(makeError(ex), error);\n    }\n    catch (std::exception const& ex) {\n        RLMSetErrorOrThrow(makeError(ex), error);\n    }\n}\n\nnamespace {\nRLMRealm *getCachedRealm(RLMRealmConfiguration *configuration, RLMScheduler *options) NS_RETURNS_RETAINED {\n    auto& config = configuration.configRef;\n    if (!configuration.cache && !configuration.dynamic) {\n        return nil;\n    }\n\n    RLMRealm *realm = RLMGetCachedRealm(configuration, options);\n    if (!realm) {\n        return nil;\n    }\n\n    auto const& oldConfig = realm->_realm->config();\n    if ((oldConfig.read_only() || oldConfig.immutable()) != configuration.readOnly) {\n        @throw RLMException(@\"Realm at path '%@' already opened with different read permissions\", configuration.fileURL.path);\n    }\n    if (oldConfig.in_memory != config.in_memory) {\n        @throw RLMException(@\"Realm at path '%@' already opened with different inMemory settings\", configuration.fileURL.path);\n    }\n    if (realm.dynamic != configuration.dynamic) {\n        @throw RLMException(@\"Realm at path '%@' already opened with different dynamic settings\", configuration.fileURL.path);\n    }\n    if (oldConfig.encryption_key != config.encryption_key) {\n        @throw RLMException(@\"Realm at path '%@' already opened with different encryption key\", configuration.fileURL.path);\n    }\n    return realm;\n}\n\nbool copySeedFile(RLMRealmConfiguration *configuration, NSError **error) {\n    if (!configuration.seedFilePath) {\n        return false;\n    }\n    NSError *copyError;\n    bool didCopySeed = false;\n    @autoreleasepool {\n        DB::call_with_lock(configuration.path, [&](auto const&) {\n            didCopySeed = [[NSFileManager defaultManager] copyItemAtURL:configuration.seedFilePath\n                                                                  toURL:configuration.fileURL\n                                                                  error:&copyError];\n        });\n    }\n    if (!didCopySeed && copyError && copyError.code != NSFileWriteFileExistsError) {\n        RLMSetErrorOrThrow(copyError, error);\n        return true;\n    }\n    return false;\n}\n} // anonymous namespace\n\n@implementation RLMRealm {\n    std::mutex _collectionEnumeratorMutex;\n    NSHashTable<RLMFastEnumerator *> *_collectionEnumerators;\n    bool _sendingNotifications;\n}\n\n+ (void)initialize {\n    // In cases where we are not using a synced Realm, we initialise the default logger\n    // before opening any realm.\n    [RLMLogger class];\n}\n\n- (instancetype)initPrivate {\n    self = [super init];\n    return self;\n}\n\n- (BOOL)isEmpty {\n    return realm::ObjectStore::is_empty(self.group);\n}\n\n- (void)verifyThread {\n    try {\n        _realm->verify_thread();\n    }\n    catch (std::exception const& e) {\n        @throw RLMException(e);\n    }\n}\n\n- (BOOL)inWriteTransaction {\n    return _realm->is_in_transaction();\n}\n\n- (realm::Group &)group {\n    return _realm->read_group();\n}\n\n- (BOOL)autorefresh {\n    return _realm->auto_refresh();\n}\n\n- (void)setAutorefresh:(BOOL)autorefresh {\n    try {\n        _realm->set_auto_refresh(autorefresh);\n    }\n    catch (std::exception const& e) {\n        @throw RLMException(e);\n    }\n}\n\n+ (instancetype)defaultRealm {\n    return [RLMRealm realmWithConfiguration:[RLMRealmConfiguration rawDefaultConfiguration] error:nil];\n}\n\n+ (instancetype)defaultRealmForQueue:(dispatch_queue_t)queue {\n    return [RLMRealm realmWithConfiguration:[RLMRealmConfiguration rawDefaultConfiguration]\n                                      queue:queue error:nil];\n}\n\n+ (instancetype)realmWithURL:(NSURL *)fileURL {\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = fileURL;\n    return [RLMRealm realmWithConfiguration:configuration error:nil];\n}\n\n+ (RLMAsyncOpenTask *)asyncOpenWithConfiguration:(RLMRealmConfiguration *)configuration\n                                   callbackQueue:(dispatch_queue_t)callbackQueue\n                                        callback:(RLMAsyncOpenRealmCallback)callback {\n    return [[RLMAsyncOpenTask alloc] initWithConfiguration:configuration\n                                                confinedTo:[RLMScheduler dispatchQueue:callbackQueue]\n                                                completion:callback];\n}\n\n+ (instancetype)realmWithSharedRealm:(SharedRealm)sharedRealm\n                              schema:(RLMSchema *)schema\n                             dynamic:(bool)dynamic {\n    RLMRealm *realm = [[RLMRealm alloc] initPrivate];\n    realm->_realm = sharedRealm;\n    realm->_dynamic = dynamic;\n    realm->_schema = schema;\n    if (!dynamic) {\n        realm->_realm->set_schema_subset(schema.objectStoreCopy);\n    }\n    realm->_info = RLMSchemaInfo(realm);\n    return realm;\n}\n\n+ (instancetype)realmWithSharedRealm:(std::shared_ptr<Realm>)osRealm\n                              schema:(RLMSchema *)schema\n                             dynamic:(bool)dynamic\n                              freeze:(bool)freeze {\n    RLMRealm *realm = [[RLMRealm alloc] initPrivate];\n    realm->_realm = osRealm;\n    realm->_dynamic = dynamic;\n\n    if (dynamic) {\n        realm->_schema = schema ?: [RLMSchema dynamicSchemaFromObjectStoreSchema:osRealm->schema()];\n    }\n    else @autoreleasepool {\n        if (auto cachedRealm = RLMGetAnyCachedRealmForPath(osRealm->config().path)) {\n            realm->_realm->set_schema_subset(cachedRealm->_realm->schema());\n            realm->_schema = cachedRealm.schema;\n            realm->_info = cachedRealm->_info.clone(cachedRealm->_realm->schema(), realm);\n        }\n        else if (osRealm->is_frozen()) {\n            realm->_schema = schema ?: RLMSchema.sharedSchema;\n            realm->_realm->set_schema_subset(realm->_schema.objectStoreCopy);\n        }\n        else {\n            realm->_schema = schema ?: RLMSchema.sharedSchema;\n            try {\n                // No migration function: currently this is only used as part of\n                // client resets on sync Realms, so none is needed. If that\n                // changes, this'll need to as well.\n                realm->_realm->update_schema(realm->_schema.objectStoreCopy, osRealm->config().schema_version);\n            }\n            catch (...) {\n                RLMRealmTranslateException(nil);\n                REALM_COMPILER_HINT_UNREACHABLE();\n            }\n        }\n    }\n\n    if (realm->_info.begin() == realm->_info.end()) {\n        realm->_info = RLMSchemaInfo(realm);\n    }\n\n    if (freeze && !realm->_realm->is_frozen()) {\n        realm->_realm = realm->_realm->freeze();\n    }\n\n    return realm;\n}\n\n+ (instancetype)realmWithConfiguration:(RLMRealmConfiguration *)configuration error:(NSError **)error {\n    return [self realmWithConfiguration:configuration\n                             confinedTo:RLMScheduler.currentRunLoop\n                                  error:error];\n}\n\n+ (instancetype)realmWithConfiguration:(RLMRealmConfiguration *)configuration\n                                 queue:(dispatch_queue_t)queue\n                                 error:(NSError **)error {\n    return [self realmWithConfiguration:configuration\n                             confinedTo:[RLMScheduler dispatchQueue:queue]\n                                  error:error];\n}\n\n+ (instancetype)realmWithConfiguration:(RLMRealmConfiguration *)configuration\n                            confinedTo:(RLMScheduler *)scheduler\n                                 error:(NSError **)error {\n    // First check if we already have a cached Realm for this config\n    if (auto realm = getCachedRealm(configuration, scheduler)) {\n        return realm;\n    }\n\n    if (copySeedFile(configuration, error)) {\n        return nil;\n    }\n\n    bool dynamic = configuration.dynamic;\n    bool cache = configuration.cache;\n\n    Realm::Config config = configuration.config;\n\n    RLMRealm *realm = [[self alloc] initPrivate];\n    realm->_dynamic = dynamic;\n    realm->_actor = scheduler.actor;\n\n    // protects the realm cache and accessors cache\n    static auto& initLock = *new RLMUnfairMutex;\n    std::lock_guard lock(initLock);\n\n    try {\n        config.scheduler = scheduler.osScheduler;\n        if (config.scheduler && !config.scheduler->is_on_thread()) {\n            throw RLMException(@\"Realm opened from incorrect dispatch queue.\");\n        }\n        realm->_realm = Realm::get_shared_realm(config);\n    }\n    catch (...) {\n        RLMRealmTranslateException(error);\n        return nil;\n    }\n\n    // if we have a cached realm on another thread we can skip a few steps and\n    // just grab its schema\n    @autoreleasepool {\n        // ensure that cachedRealm doesn't end up in this thread's autorelease pool\n        if (auto cachedRealm = RLMGetAnyCachedRealmForPath(config.path)) {\n            realm->_realm->set_schema_subset(cachedRealm->_realm->schema());\n            realm->_schema = cachedRealm.schema;\n            realm->_info = cachedRealm->_info.clone(cachedRealm->_realm->schema(), realm);\n        }\n    }\n\n    if (realm->_schema) { }\n    else if (dynamic) {\n        realm->_schema = [RLMSchema dynamicSchemaFromObjectStoreSchema:realm->_realm->schema()];\n        realm->_info = RLMSchemaInfo(realm);\n    }\n    else {\n        // set/align schema or perform migration if needed\n        RLMSchema *schema = configuration.customSchema ?: RLMSchema.sharedSchema;\n\n        MigrationFunction migrationFunction;\n        auto migrationBlock = configuration.migrationBlock;\n        if (migrationBlock && configuration.schemaVersion > 0) {\n            migrationFunction = [=](SharedRealm old_realm, SharedRealm realm, Schema& mutableSchema) {\n                RLMSchema *oldSchema = [RLMSchema dynamicSchemaFromObjectStoreSchema:old_realm->schema()];\n                RLMRealm *oldRealm = [RLMRealm realmWithSharedRealm:old_realm\n                                                             schema:oldSchema\n                                                            dynamic:true];\n\n                // The destination RLMRealm can't just use the schema from the\n                // SharedRealm because it doesn't have information about whether or\n                // not a class was defined in Swift, which effects how new objects\n                // are created\n                RLMRealm *newRealm = [RLMRealm realmWithSharedRealm:realm\n                                                             schema:schema.copy\n                                                            dynamic:true];\n\n                [[[RLMMigration alloc] initWithRealm:newRealm oldRealm:oldRealm schema:mutableSchema]\n                 execute:migrationBlock objectClass:configuration.migrationObjectClass];\n\n                oldRealm->_realm = nullptr;\n                newRealm->_realm = nullptr;\n            };\n        }\n\n        try {\n            realm->_realm->update_schema(schema.objectStoreCopy, config.schema_version,\n                                         std::move(migrationFunction));\n        }\n        catch (...) {\n            RLMRealmTranslateException(error);\n            return nil;\n        }\n\n        realm->_schema = schema;\n        realm->_info = RLMSchemaInfo(realm);\n        RLMSchemaEnsureAccessorsCreated(realm.schema);\n\n        if (!configuration.readOnly) {\n            REALM_ASSERT(!realm->_realm->is_in_read_transaction());\n\n            if (s_set_skip_backup_attribute) {\n                RLMAddSkipBackupAttributeToItemAtPath(config.path + \".management\");\n                RLMAddSkipBackupAttributeToItemAtPath(config.path + \".lock\");\n                RLMAddSkipBackupAttributeToItemAtPath(config.path + \".note\");\n            }\n        }\n    }\n\n    if (cache) {\n        RLMCacheRealm(configuration, scheduler, realm);\n    }\n\n    if (!configuration.readOnly) {\n        realm->_realm->m_binding_context = RLMCreateBindingContext(realm);\n        realm->_realm->m_binding_context->realm = realm->_realm;\n    }\n\n    return realm;\n}\n\n+ (void)resetRealmState {\n    RLMClearRealmCache();\n    realm::_impl::RealmCoordinator::clear_cache();\n    [RLMRealmConfiguration resetRealmConfigurationState];\n}\n\n- (void)verifyNotificationsAreSupported:(bool)isCollection {\n    [self verifyThread];\n    if (_realm->config().immutable()) {\n        @throw RLMException(@\"Read-only Realms do not change and do not have change notifications.\");\n    }\n    if (_realm->is_frozen()) {\n        @throw RLMException(@\"Frozen Realms do not change and do not have change notifications.\");\n    }\n    if (_realm->config().automatic_change_notifications && !_realm->can_deliver_notifications()) {\n        @throw RLMException(@\"Can only add notification blocks from within runloops.\");\n    }\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(RLMNotificationBlock)block {\n    if (!block) {\n        @throw RLMException(@\"The notification block should not be nil\");\n    }\n    [self verifyNotificationsAreSupported:false];\n\n    _realm->read_group();\n\n    if (!_notificationHandlers) {\n        _notificationHandlers = [NSHashTable hashTableWithOptions:NSPointerFunctionsWeakMemory];\n    }\n\n    RLMRealmNotificationToken *token = [[RLMRealmNotificationToken alloc] init];\n    token.realm = self;\n    token.block = block;\n    [_notificationHandlers addObject:token];\n    return token;\n}\n\n- (void)sendNotifications:(RLMNotification)notification {\n    NSAssert(!_realm->config().immutable(), @\"Read-only realms do not have notifications\");\n    if (_sendingNotifications) {\n        return;\n    }\n    NSUInteger count = _notificationHandlers.count;\n    if (count == 0) {\n        return;\n    }\n\n    _sendingNotifications = true;\n    auto cleanup = realm::util::make_scope_exit([&]() noexcept {\n        _sendingNotifications = false;\n    });\n\n    // call this realm's notification blocks\n    if (count == 1) {\n        if (auto block = [_notificationHandlers.anyObject block]) {\n            block(notification, self);\n        }\n    }\n    else {\n        for (RLMRealmNotificationToken *token in _notificationHandlers.allObjects) {\n            if (auto block = token.block) {\n                block(notification, self);\n            }\n        }\n    }\n}\n\n- (RLMRealmConfiguration *)configuration {\n    RLMRealmConfiguration *configuration = [[RLMRealmConfiguration alloc] init];\n    configuration.configRef = _realm->config();\n    configuration.dynamic = _dynamic;\n    configuration.customSchema = _schema;\n    return configuration;\n}\n\n- (RLMRealmConfiguration *)configurationSharingSchema {\n    RLMRealmConfiguration *configuration = [[RLMRealmConfiguration alloc] init];\n    configuration.configRef = _realm->config();\n    configuration.dynamic = _dynamic;\n    [configuration setCustomSchemaWithoutCopying:_schema];\n    return configuration;\n}\n\n- (void)beginWriteTransaction {\n    [self beginWriteTransactionWithError:nil];\n}\n\n- (BOOL)beginWriteTransactionWithError:(NSError **)error {\n    try {\n        _realm->begin_transaction();\n        return YES;\n    }\n    catch (...) {\n        RLMRealmTranslateException(error);\n        return NO;\n    }\n}\n\n- (void)commitWriteTransaction {\n    [self commitWriteTransaction:nil];\n}\n\n- (BOOL)commitWriteTransaction:(NSError **)error {\n    return [self commitWriteTransactionWithoutNotifying:@[] error:error];\n}\n\n- (BOOL)commitWriteTransactionWithoutNotifying:(NSArray<RLMNotificationToken *> *)tokens error:(NSError **)error {\n    for (RLMNotificationToken *token in tokens) {\n        if (token.realm != self) {\n            @throw RLMException(@\"Incorrect Realm: only notifications for the Realm being modified can be skipped.\");\n        }\n        [token suppressNextNotification];\n    }\n\n    try {\n        _realm->commit_transaction();\n        return YES;\n    }\n    catch (...) {\n        RLMRealmTranslateException(error);\n        return NO;\n    }\n}\n\n- (void)transactionWithBlock:(__attribute__((noescape)) void(^)(void))block {\n    [self transactionWithBlock:block error:nil];\n}\n\n- (BOOL)transactionWithBlock:(__attribute__((noescape)) void(^)(void))block error:(NSError **)outError {\n    return [self transactionWithoutNotifying:@[] block:block error:outError];\n}\n\n- (void)transactionWithoutNotifying:(NSArray<RLMNotificationToken *> *)tokens block:(__attribute__((noescape)) void(^)(void))block {\n    [self transactionWithoutNotifying:tokens block:block error:nil];\n}\n\n- (BOOL)transactionWithoutNotifying:(NSArray<RLMNotificationToken *> *)tokens block:(__attribute__((noescape)) void(^)(void))block error:(NSError **)error {\n    [self beginWriteTransactionWithError:error];\n    block();\n    if (_realm->is_in_transaction()) {\n        return [self commitWriteTransactionWithoutNotifying:tokens error:error];\n    }\n    return YES;\n}\n\n- (void)cancelWriteTransaction {\n    try {\n        _realm->cancel_transaction();\n    }\n    catch (std::exception &ex) {\n        @throw RLMException(ex);\n    }\n}\n\n- (BOOL)isPerformingAsynchronousWriteOperations {\n    return _realm->is_in_async_transaction();\n}\n\n- (RLMAsyncTransactionId)beginAsyncWriteTransaction:(void(^)())block {\n    try {\n        return _realm->async_begin_transaction(block);\n    }\n    catch (std::exception &ex) {\n        @throw RLMException(ex);\n    }\n}\n\n- (RLMAsyncTransactionId)commitAsyncWriteTransaction {\n    try {\n        return _realm->async_commit_transaction();\n    }\n    catch (...) {\n        RLMRealmTranslateException(nil);\n        return 0;\n    }\n}\n\n- (RLMAsyncWriteTask *)beginAsyncWrite {\n    try {\n        auto write = [[RLMAsyncWriteTask alloc] initWithRealm:self];\n        write.transactionId = _realm->async_begin_transaction(^{ [write complete:false]; }, true);\n        return write;\n    }\n    catch (std::exception &ex) {\n        @throw RLMException(ex);\n    }\n}\n\n- (void)commitAsyncWriteWithGrouping:(bool)allowGrouping\n                          completion:(void(^)(NSError *_Nullable))completion {\n    [self commitAsyncWriteTransaction:completion allowGrouping:allowGrouping];\n}\n\n- (RLMAsyncTransactionId)commitAsyncWriteTransaction:(void(^)(NSError *))completionBlock {\n    return [self commitAsyncWriteTransaction:completionBlock allowGrouping:false];\n}\n\n- (RLMAsyncTransactionId)commitAsyncWriteTransaction:(nullable void(^)(NSError *))completionBlock\n                                       allowGrouping:(BOOL)allowGrouping {\n    try {\n        auto completion = [=](std::exception_ptr err) {\n            @autoreleasepool {\n                if (!completionBlock) {\n                    std::rethrow_exception(err);\n                    return;\n                }\n                if (err) {\n                    try {\n                        std::rethrow_exception(err);\n                    }\n                    catch (...) {\n                        NSError *error;\n                        RLMRealmTranslateException(&error);\n                        completionBlock(error);\n                    }\n                } else {\n                    completionBlock(nil);\n                }\n            }\n        };\n\n        if (completionBlock) {\n            return _realm->async_commit_transaction(completion, allowGrouping);\n        }\n        return _realm->async_commit_transaction(nullptr, allowGrouping);\n    }\n    catch (...) {\n        RLMRealmTranslateException(nil);\n        return 0;\n    }\n}\n\n- (void)cancelAsyncTransaction:(RLMAsyncTransactionId)asyncTransactionId {\n    try {\n        _realm->async_cancel_transaction(asyncTransactionId);\n    }\n    catch (std::exception &ex) {\n        @throw RLMException(ex);\n    }\n}\n\n- (RLMAsyncTransactionId)asyncTransactionWithBlock:(void(^)())block onComplete:(nullable void(^)(NSError *))completionBlock {\n    return [self beginAsyncWriteTransaction:^{\n        block();\n        if (_realm->is_in_transaction()) {\n            [self commitAsyncWriteTransaction:completionBlock];\n        }\n    }];\n}\n\n- (RLMAsyncTransactionId)asyncTransactionWithBlock:(void(^)())block {\n    return [self beginAsyncWriteTransaction:^{\n        block();\n        if (_realm->is_in_transaction()) {\n            [self commitAsyncWriteTransaction];\n        }\n    }];\n}\n\n- (void)invalidate {\n    if (_realm->is_in_transaction()) {\n        NSLog(@\"WARNING: An RLMRealm instance was invalidated during a write \"\n              \"transaction and all pending changes have been rolled back.\");\n    }\n\n    [self detachAllEnumerators];\n\n    for (auto& objectInfo : _info) {\n        for (RLMObservationInfo *info : objectInfo.second.observedObjects) {\n            info->willChange(RLMInvalidatedKey);\n        }\n    }\n\n    _realm->invalidate();\n\n    for (auto& objectInfo : _info) {\n        for (RLMObservationInfo *info : objectInfo.second.observedObjects) {\n            info->didChange(RLMInvalidatedKey);\n        }\n    }\n\n    if (_realm->is_frozen()) {\n        _realm->close();\n    }\n}\n\n- (nullable id)resolveThreadSafeReference:(RLMThreadSafeReference *)reference {\n    return [reference resolveReferenceInRealm:self];\n}\n\n/**\n Replaces all string columns in this Realm with a string enumeration column and compacts the\n database file.\n\n Cannot be called from a write transaction.\n\n Compaction will not occur if other `RLMRealm` instances exist.\n\n While compaction is in progress, attempts by other threads or processes to open the database will\n wait.\n\n Be warned that resource requirements for compaction is proportional to the amount of live data in\n the database.\n\n Compaction works by writing the database contents to a temporary database file and then replacing\n the database with the temporary one. The name of the temporary file is formed by appending\n `.tmp_compaction_space` to the name of the database.\n\n @return YES if the compaction succeeded.\n */\n- (BOOL)compact {\n    // compact() automatically ends the read transaction, but we need to clean\n    // up cached state and send invalidated notifications when that happens, so\n    // explicitly end it first unless we're in a write transaction (in which\n    // case compact() will throw an exception)\n    if (!_realm->is_in_transaction()) {\n        [self invalidate];\n    }\n\n    try {\n        return _realm->compact();\n    }\n    catch (std::exception const& ex) {\n        @throw RLMException(ex);\n    }\n}\n\n- (void)dealloc {\n    if (_realm) {\n        if (_realm->is_in_transaction()) {\n            [self cancelWriteTransaction];\n            NSLog(@\"WARNING: An RLMRealm instance was deallocated during a write transaction and all \"\n                  \"pending changes have been rolled back. Make sure to retain a reference to the \"\n                  \"RLMRealm for the duration of the write transaction.\");\n        }\n    }\n}\n\n- (BOOL)refresh {\n    if (_realm->config().immutable()) {\n        @throw RLMException(@\"Read-only Realms do not change and cannot be refreshed.\");\n    }\n    try {\n        return _realm->refresh();\n    }\n    catch (std::exception const& e) {\n        @throw RLMException(e);\n    }\n}\n\n- (void)addObject:(__unsafe_unretained RLMObject *const)object {\n    RLMAddObjectToRealm(object, self, RLMUpdatePolicyError);\n}\n\n- (void)addObjects:(id<NSFastEnumeration>)objects {\n    for (RLMObject *obj in objects) {\n        if (![obj isKindOfClass:RLMObjectBase.class]) {\n            @throw RLMException(@\"Cannot insert objects of type %@ with addObjects:. Only RLMObjects are supported.\",\n                                NSStringFromClass(obj.class));\n        }\n        [self addObject:obj];\n    }\n}\n\n- (void)addOrUpdateObject:(RLMObject *)object {\n    // verify primary key\n    if (!object.objectSchema.primaryKeyProperty) {\n        @throw RLMException(@\"'%@' does not have a primary key and can not be updated\", object.objectSchema.className);\n    }\n\n    RLMAddObjectToRealm(object, self, RLMUpdatePolicyUpdateAll);\n}\n\n- (void)addOrUpdateObjects:(id<NSFastEnumeration>)objects {\n    for (RLMObject *obj in objects) {\n        if (![obj isKindOfClass:RLMObjectBase.class]) {\n            @throw RLMException(@\"Cannot add or update objects of type %@ with addOrUpdateObjects:. Only RLMObjects are\"\n                                \" supported.\",\n                                NSStringFromClass(obj.class));\n        }\n        [self addOrUpdateObject:obj];\n    }\n}\n\n- (void)deleteObject:(RLMObject *)object {\n    RLMDeleteObjectFromRealm(object, self);\n}\n\n- (void)deleteObjects:(id<NSFastEnumeration>)objects {\n    id idObjects = objects;\n    if ([idObjects respondsToSelector:@selector(realm)]\n        && [idObjects respondsToSelector:@selector(deleteObjectsFromRealm)]) {\n        if (self != (RLMRealm *)[idObjects realm]) {\n            @throw RLMException(@\"Can only delete objects from the Realm they belong to.\");\n        }\n        [idObjects deleteObjectsFromRealm];\n        return;\n    }\n\n    if (auto array = RLMDynamicCast<RLMArray>(objects)) {\n        if (array.type != RLMPropertyTypeObject) {\n            @throw RLMException(@\"Cannot delete objects from RLMArray<%@>: only RLMObjects can be deleted.\",\n                                RLMTypeToString(array.type));\n        }\n    }\n    else if (auto set = RLMDynamicCast<RLMSet>(objects)) {\n        if (set.type != RLMPropertyTypeObject) {\n            @throw RLMException(@\"Cannot delete objects from RLMSet<%@>: only RLMObjects can be deleted.\",\n                                RLMTypeToString(set.type));\n        }\n    }\n    else if (auto dictionary = RLMDynamicCast<RLMDictionary>(objects)) {\n        if (dictionary.type != RLMPropertyTypeObject) {\n            @throw RLMException(@\"Cannot delete objects from RLMDictionary of type %@: only RLMObjects can be deleted.\",\n                                RLMTypeToString(dictionary.type));\n        }\n        for (RLMObject *obj in dictionary.allValues) {\n            RLMDeleteObjectFromRealm(obj, self);\n        }\n        return;\n    }\n    for (RLMObject *obj in objects) {\n        if (![obj isKindOfClass:RLMObjectBase.class]) {\n            @throw RLMException(@\"Cannot delete objects of type %@ with deleteObjects:. Only RLMObjects can be deleted.\",\n                                NSStringFromClass(obj.class));\n        }\n        RLMDeleteObjectFromRealm(obj, self);\n    }\n}\n\n- (void)deleteAllObjects {\n    RLMDeleteAllObjectsFromRealm(self);\n}\n\n- (RLMResults *)allObjects:(NSString *)objectClassName {\n    return RLMGetObjects(self, objectClassName, nil);\n}\n\n- (RLMResults *)objects:(NSString *)objectClassName where:(NSString *)predicateFormat, ... {\n    va_list args;\n    va_start(args, predicateFormat);\n    RLMResults *results = [self objects:objectClassName where:predicateFormat args:args];\n    va_end(args);\n    return results;\n}\n\n- (RLMResults *)objects:(NSString *)objectClassName where:(NSString *)predicateFormat args:(va_list)args {\n    return [self objects:objectClassName withPredicate:[NSPredicate predicateWithFormat:predicateFormat arguments:args]];\n}\n\n- (RLMResults *)objects:(NSString *)objectClassName withPredicate:(NSPredicate *)predicate {\n    return RLMGetObjects(self, objectClassName, predicate);\n}\n\n- (RLMObject *)objectWithClassName:(NSString *)className forPrimaryKey:(id)primaryKey {\n    return RLMGetObject(self, className, primaryKey);\n}\n\n+ (uint64_t)schemaVersionAtURL:(NSURL *)fileURL encryptionKey:(NSData *)key error:(NSError **)error {\n    RLMRealmConfiguration *config = [[RLMRealmConfiguration alloc] init];\n    config.fileURL = fileURL;\n    config.encryptionKey = RLMRealmValidatedEncryptionKey(key);\n\n    uint64_t version = RLMNotVersioned;\n    try {\n        version = Realm::get_schema_version(config.configRef);\n    }\n    catch (...) {\n        RLMRealmTranslateException(error);\n        return version;\n    }\n\n    if (error && version == realm::ObjectStore::NotVersioned) {\n        auto msg = [NSString stringWithFormat:@\"Realm at path '%@' has not been initialized.\", fileURL.path];\n        *error = [NSError errorWithDomain:RLMErrorDomain\n                                     code:RLMErrorInvalidDatabase\n                                 userInfo:@{NSLocalizedDescriptionKey: msg,\n                                            NSFilePathErrorKey: fileURL.path}];\n    }\n    return version;\n}\n\n+ (BOOL)performMigrationForConfiguration:(RLMRealmConfiguration *)configuration error:(NSError **)error {\n    if (RLMGetAnyCachedRealmForPath(configuration.path)) {\n        @throw RLMException(@\"Cannot migrate Realms that are already open.\");\n    }\n\n    NSError *localError; // Prevents autorelease\n    BOOL success;\n    @autoreleasepool {\n        success = [RLMRealm realmWithConfiguration:configuration error:&localError] != nil;\n    }\n    if (!success && error) {\n        *error = localError; // Must set outside pool otherwise will free anyway\n    }\n    return success;\n}\n\n- (RLMObject *)createObject:(NSString *)className withValue:(id)value {\n    return (RLMObject *)RLMCreateObjectInRealmWithValue(self, className, value, RLMUpdatePolicyError);\n}\n\n- (BOOL)writeCopyToURL:(NSURL *)fileURL encryptionKey:(NSData *)key error:(NSError **)error {\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration new];\n    configuration.fileURL = fileURL;\n    configuration.encryptionKey = key;\n    return [self writeCopyForConfiguration:configuration error:error];\n}\n\n- (BOOL)writeCopyForConfiguration:(RLMRealmConfiguration *)configuration error:(NSError **)error {\n    try {\n        _realm->convert(configuration.configRef, false);\n        return YES;\n    }\n    catch (...) {\n        if (error) {\n            RLMRealmTranslateException(error);\n        }\n    }\n    return NO;\n}\n\n+ (BOOL)fileExistsForConfiguration:(RLMRealmConfiguration *)config {\n    return [NSFileManager.defaultManager fileExistsAtPath:config.pathOnDisk];\n}\n\n+ (BOOL)deleteFilesForConfiguration:(RLMRealmConfiguration *)config error:(NSError **)error {\n    bool didDeleteAny = false;\n    try {\n        realm::Realm::delete_files(config.path, &didDeleteAny);\n    }\n    catch (realm::FileAccessError const& e) {\n        if (error) {\n            // For backwards compatibility, but this should go away in 11.0\n            if (e.code() == realm::ErrorCodes::PermissionDenied) {\n                *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteNoPermissionError\n                                         userInfo:@{NSLocalizedDescriptionKey: @(e.what()),\n                                                    NSFilePathErrorKey: @(e.get_path().data())}];\n            }\n            else {\n                RLMRealmTranslateException(error);\n            }\n        }\n    }\n    catch (...) {\n        if (error) {\n            RLMRealmTranslateException(error);\n        }\n    }\n    return didDeleteAny;\n}\n\n- (BOOL)isFrozen {\n    return _realm->is_frozen();\n}\n\n- (RLMRealm *)freeze {\n    [self verifyThread];\n    return self.isFrozen ? self : RLMGetFrozenRealmForSourceRealm(self);\n}\n\n- (RLMRealm *)thaw {\n    [self verifyThread];\n    return self.isFrozen ? [RLMRealm realmWithConfiguration:self.configurationSharingSchema error:nil] : self;\n}\n\n- (RLMRealm *)frozenCopy {\n    try {\n        RLMRealm *realm = [[RLMRealm alloc] initPrivate];\n        realm->_realm = _realm->freeze();\n        realm->_realm->read_group();\n        realm->_dynamic = _dynamic;\n        realm->_schema = _schema;\n        realm->_info = RLMSchemaInfo(realm);\n        return realm;\n    }\n    catch (std::exception const& e) {\n        @throw RLMException(e);\n    }\n}\n\n- (void)registerEnumerator:(RLMFastEnumerator *)enumerator {\n    std::lock_guard lock(_collectionEnumeratorMutex);\n    if (!_collectionEnumerators) {\n        _collectionEnumerators = [NSHashTable hashTableWithOptions:NSPointerFunctionsWeakMemory];\n    }\n    [_collectionEnumerators addObject:enumerator];\n}\n\n- (void)unregisterEnumerator:(RLMFastEnumerator *)enumerator {\n    std::lock_guard lock(_collectionEnumeratorMutex);\n    [_collectionEnumerators removeObject:enumerator];\n}\n\n- (void)detachAllEnumerators {\n    std::lock_guard lock(_collectionEnumeratorMutex);\n    for (RLMFastEnumerator *enumerator in _collectionEnumerators) {\n        [enumerator detach];\n    }\n    _collectionEnumerators = nil;\n}\n@end\n"
  },
  {
    "path": "Realm/RLMRealmConfiguration.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMRealm.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n/**\n A block called when opening a Realm for the first time during the life\n of a process to determine if it should be compacted before being returned\n to the user. It is passed the total file size (data + free space) and the total\n bytes used by data in the file.\n\n Return `YES` to indicate that an attempt to compact the file should be made.\n The compaction will be skipped if another process is accessing it.\n */\nNS_SWIFT_SENDABLE\ntypedef BOOL (^RLMShouldCompactOnLaunchBlock)(NSUInteger totalBytes, NSUInteger bytesUsed);\n\n/**\n An `RLMRealmConfiguration` instance describes the different options used to\n create an instance of a Realm.\n\n `RLMRealmConfiguration` instances are just plain `NSObject`s. Unlike `RLMRealm`s\n and `RLMObject`s, they can be freely shared between threads as long as you do not\n mutate them.\n\n Creating configuration objects for class subsets (by setting the\n `objectClasses` property) can be expensive. Because of this, you will normally want to\n cache and reuse a single configuration object for each distinct configuration rather than\n creating a new object each time you open a Realm.\n */\n@interface RLMRealmConfiguration : NSObject<NSCopying>\n\n#pragma mark - Default Configuration\n\n/**\n Returns the default configuration used to create Realms when no other\n configuration is explicitly specified (i.e. `+[RLMRealm defaultRealm]`).\n\n @return The default Realm configuration.\n */\n+ (instancetype)defaultConfiguration;\n\n/**\n Sets the default configuration to the given `RLMRealmConfiguration`.\n\n @param configuration The new default Realm configuration.\n */\n+ (void)setDefaultConfiguration:(RLMRealmConfiguration *)configuration;\n\n#pragma mark - Properties\n\n/// The local URL of the Realm file. Mutually exclusive with `inMemoryIdentifier`;\n/// setting one of the two properties will automatically nil out the other.\n@property (nonatomic, copy, nullable) NSURL *fileURL;\n\n/// A string used to identify a particular in-memory Realm. Mutually exclusive\n/// with `fileURL` and `seedFilePath`.\n/// Setting an in-memory identifier will automatically nil out the other two.\n@property (nonatomic, copy, nullable) NSString *inMemoryIdentifier;\n\n/// A 64-byte key to use to encrypt the data, or `nil` if encryption is not enabled.\n@property (nonatomic, copy, nullable) NSData *encryptionKey;\n\n/// Whether to open the Realm in read-only mode.\n///\n/// For non-synchronized Realms, this is required to be able to open Realm\n/// files which are not writeable or are in a directory which is not writeable.\n/// This should only be used on files which will not be modified by anyone\n/// while they are open, and not just to get a read-only view of a file which\n/// may be written to by another thread or process. Opening in read-only mode\n/// requires disabling Realm's reader/writer coordination, so committing a\n/// write transaction from another process will result in crashes.\n///\n/// Syncronized Realms must always be writeable (as otherwise no\n/// synchronization could happen), and this instead merely disallows performing\n/// write transactions on the Realm. In addition, it will skip some automatic\n/// writes made to the Realm, such as to initialize the Realm's schema. Setting\n/// `readOnly = YES` is not strictly required for Realms which the sync user\n/// does not have write access to, but is highly recommended as it will improve\n/// error reporting and catch some errors earlier.\n///\n/// Realms using query-based sync cannot be opened in read-only mode.\n@property (nonatomic) BOOL readOnly;\n\n/// The current schema version.\n@property (nonatomic) uint64_t schemaVersion;\n\n/// The block which migrates the Realm to the current version.\n@property (nonatomic, copy, nullable) RLMMigrationBlock migrationBlock;\n\n/**\n Whether to recreate the Realm file with the provided schema if a migration is required.\n This is the case when the stored schema differs from the provided schema or\n the stored schema version differs from the version on this configuration.\n Setting this property to `YES` deletes the file if a migration would otherwise be required or executed.\n\n @note Setting this property to `YES` doesn't disable file format migrations.\n */\n@property (nonatomic) BOOL deleteRealmIfMigrationNeeded;\n\n/**\n A block called when opening a Realm for the first time during the life\n of a process to determine if it should be compacted before being returned\n to the user. It is passed the total file size (data + free space) and the total\n bytes used by data in the file.\n\n Return `YES` to indicate that an attempt to compact the file should be made.\n The compaction will be skipped if another process is accessing it.\n */\n@property (nonatomic, copy, nullable) RLMShouldCompactOnLaunchBlock shouldCompactOnLaunch;\n\n/// The classes managed by the Realm.\n@property (nonatomic, copy, nullable) NSArray *objectClasses;\n\n/**\n The maximum number of live versions in the Realm file before an exception will\n be thrown when attempting to start a write transaction.\n\n Realm provides MVCC snapshot isolation, meaning that writes on one thread do\n not overwrite data being read on another thread, and instead write a new copy\n of that data. When a Realm refreshes it updates to the latest version of the\n data and releases the old versions, allowing them to be overwritten by\n subsequent write transactions.\n\n Under normal circumstances this is not a problem, but if the number of active\n versions grow too large, it will have a negative effect on the filesize on\n disk. This can happen when performing writes on many different threads at\n once, when holding on to frozen objects for an extended time, or when\n performing long operations on background threads which do not allow the Realm\n to refresh.\n\n Setting this property to a non-zero value makes it so that exceeding the set\n number of versions will instead throw an exception. This can be used with a\n low value during development to help identify places that may be problematic,\n or in production use to cause the app to crash rather than produce a Realm\n file which is too large to be opened.\n\n */\n@property (nonatomic) NSUInteger maximumNumberOfActiveVersions;\n\n/**\n When opening the Realm for the first time, instead of creating an empty file,\n the Realm file will be copied from the provided seed file path and used instead.\n This can be used to open a Realm file with pre-populated data.\n\n If a realm file already exists at the configuration's destination path, the seed file\n will not be copied and the already existing realm will be opened instead.\n\n Note that to use this parameter with a synced Realm configuration\n the seed Realm must be appropriately copied to a destination with\n `[RLMRealm writeCopyForConfiguration:]` first.\n\n This option is mutually exclusive with `inMemoryIdentifier`. Setting a `seedFilePath`\n will nil out the `inMemoryIdentifier`.\n */\n@property (nonatomic, copy, nullable) NSURL *seedFilePath;\n\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMRealmConfiguration.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMRealmConfiguration_Private.h\"\n\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMRealm_Private.h\"\n#import \"RLMSchema_Private.hpp\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/object-store/schema.hpp>\n#import <realm/object-store/shared_realm.hpp>\n\nstatic NSString *const c_RLMRealmConfigurationProperties[] = {\n    @\"fileURL\",\n    @\"inMemoryIdentifier\",\n    @\"encryptionKey\",\n    @\"readOnly\",\n    @\"schemaVersion\",\n    @\"migrationBlock\",\n    @\"deleteRealmIfMigrationNeeded\",\n    @\"shouldCompactOnLaunch\",\n    @\"dynamic\",\n    @\"customSchema\",\n};\n\nstatic NSString *const c_defaultRealmFileName = @\"default.realm\";\nRLMRealmConfiguration *s_defaultConfiguration;\n\nNSString *RLMRealmPathForFileAndBundleIdentifier(NSString *fileName, NSString *bundleIdentifier) {\n    return [RLMDefaultDirectoryForBundleIdentifier(bundleIdentifier)\n            stringByAppendingPathComponent:fileName];\n}\n\nNSString *RLMRealmPathForFile(NSString *fileName) {\n    static NSString *directory = RLMDefaultDirectoryForBundleIdentifier(nil);\n    return [directory stringByAppendingPathComponent:fileName];\n}\n\n@implementation RLMRealmConfiguration {\n    realm::Realm::Config _config;\n}\n\n- (realm::Realm::Config&)configRef {\n    return _config;\n}\n\n- (std::string const&)path {\n    return _config.path;\n}\n\n+ (instancetype)defaultConfiguration {\n    return [[self rawDefaultConfiguration] copy];\n}\n\n+ (void)setDefaultConfiguration:(RLMRealmConfiguration *)configuration {\n    if (!configuration) {\n        @throw RLMException(@\"Cannot set the default configuration to nil.\");\n    }\n    @synchronized(c_defaultRealmFileName) {\n        s_defaultConfiguration = [configuration copy];\n    }\n}\n\n+ (RLMRealmConfiguration *)rawDefaultConfiguration {\n    RLMRealmConfiguration *configuration;\n    @synchronized(c_defaultRealmFileName) {\n        if (!s_defaultConfiguration) {\n            s_defaultConfiguration = [[RLMRealmConfiguration alloc] init];\n        }\n        configuration = s_defaultConfiguration;\n    }\n    return configuration;\n}\n\n+ (void)resetRealmConfigurationState {\n    @synchronized(c_defaultRealmFileName) {\n        s_defaultConfiguration = nil;\n    }\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        static NSURL *defaultRealmURL = [NSURL fileURLWithPath:RLMRealmPathForFile(c_defaultRealmFileName)];\n        self.fileURL = defaultRealmURL;\n        self.schemaVersion = 0;\n        self.cache = YES;\n        _config.automatically_handle_backlinks_in_migrations = true;\n    }\n\n    return self;\n}\n\n- (instancetype)copyWithZone:(NSZone *)zone {\n    RLMRealmConfiguration *configuration = [[[self class] allocWithZone:zone] init];\n    configuration->_config = _config;\n    configuration->_cache = _cache;\n    configuration->_dynamic = _dynamic;\n    configuration->_migrationBlock = _migrationBlock;\n    configuration->_shouldCompactOnLaunch = _shouldCompactOnLaunch;\n    configuration->_customSchema = _customSchema;\n    configuration->_migrationObjectClass = _migrationObjectClass;\n    configuration->_seedFilePath = _seedFilePath;\n    return configuration;\n}\n\n- (NSString *)description {\n    NSMutableString *string = [NSMutableString stringWithFormat:@\"%@ {\\n\", self.class];\n    for (NSString *key : c_RLMRealmConfigurationProperties) {\n        NSString *description = [[self valueForKey:key] description];\n        description = [description stringByReplacingOccurrencesOfString:@\"\\n\" withString:@\"\\n\\t\"];\n\n        [string appendFormat:@\"\\t%@ = %@;\\n\", key, description];\n    }\n    return [string stringByAppendingString:@\"}\"];\n}\n\n- (NSURL *)fileURL {\n    if (_config.in_memory) {\n        return nil;\n    }\n    return [NSURL fileURLWithPath:@(_config.path.c_str())];\n}\n\n- (void)setFileURL:(NSURL *)fileURL {\n    NSString *path = fileURL.path;\n    if (path.length == 0) {\n        @throw RLMException(@\"Realm path must not be empty\");\n    }\n\n    RLMNSStringToStdString(_config.path, path);\n    _config.in_memory = false;\n}\n\n- (NSString *)inMemoryIdentifier {\n    if (!_config.in_memory) {\n        return nil;\n    }\n    return [@(_config.path.c_str()) lastPathComponent];\n}\n\n- (void)setInMemoryIdentifier:(NSString *)inMemoryIdentifier {\n    if (inMemoryIdentifier.length == 0) {\n        @throw RLMException(@\"In-memory identifier must not be empty\");\n    }\n    _seedFilePath = nil;\n\n    RLMNSStringToStdString(_config.path, [NSTemporaryDirectory() stringByAppendingPathComponent:inMemoryIdentifier]);\n    _config.in_memory = true;\n}\n\n- (void)setSeedFilePath:(NSURL *)seedFilePath {\n    _seedFilePath = seedFilePath;\n    if (_seedFilePath) {\n        _config.in_memory = false;\n    }\n}\n\n- (NSData *)encryptionKey {\n    return _config.encryption_key.empty() ? nil : [NSData dataWithBytes:_config.encryption_key.data() length:_config.encryption_key.size()];\n}\n\n- (void)setEncryptionKey:(NSData * __nullable)encryptionKey {\n    if (NSData *key = RLMRealmValidatedEncryptionKey(encryptionKey)) {\n        auto bytes = static_cast<const char *>(key.bytes);\n        _config.encryption_key.assign(bytes, bytes + key.length);\n    }\n    else {\n        _config.encryption_key.clear();\n    }\n}\n\n- (BOOL)readOnly {\n    return _config.immutable() || _config.read_only();\n}\n\n- (void)updateSchemaMode {\n    if (self.readOnly) {\n        _config.schema_mode = realm::SchemaMode::Immutable;\n    }\n    else {\n        _config.schema_mode = realm::SchemaMode::Automatic;\n    }\n}\n\n- (void)setReadOnly:(BOOL)readOnly {\n    if (readOnly) {\n        if (self.deleteRealmIfMigrationNeeded) {\n            @throw RLMException(@\"Cannot set `readOnly` when `deleteRealmIfMigrationNeeded` is set.\");\n        } else if (self.shouldCompactOnLaunch) {\n            @throw RLMException(@\"Cannot set `readOnly` when `shouldCompactOnLaunch` is set.\");\n        }\n        _config.schema_mode =  realm::SchemaMode::Immutable;\n    }\n    else if (self.readOnly) {\n        _config.schema_mode = realm::SchemaMode::Automatic;\n        [self updateSchemaMode];\n    }\n}\n\n- (uint64_t)schemaVersion {\n    return _config.schema_version;\n}\n\n- (void)setSchemaVersion:(uint64_t)schemaVersion {\n    if (schemaVersion == RLMNotVersioned) {\n        @throw RLMException(@\"Cannot set schema version to %llu (RLMNotVersioned)\", RLMNotVersioned);\n    }\n    _config.schema_version = schemaVersion;\n}\n\n- (BOOL)deleteRealmIfMigrationNeeded {\n    return _config.schema_mode == realm::SchemaMode::SoftResetFile;\n}\n\n- (void)setDeleteRealmIfMigrationNeeded:(BOOL)deleteRealmIfMigrationNeeded {\n    if (deleteRealmIfMigrationNeeded) {\n        if (self.readOnly) {\n            @throw RLMException(@\"Cannot set `deleteRealmIfMigrationNeeded` when `readOnly` is set.\");\n        }\n        _config.schema_mode = realm::SchemaMode::SoftResetFile;\n    }\n    else if (self.deleteRealmIfMigrationNeeded) {\n        _config.schema_mode = realm::SchemaMode::Automatic;\n    }\n}\n\n- (NSArray *)objectClasses {\n    return [_customSchema.objectSchema valueForKeyPath:@\"objectClass\"];\n}\n\n- (void)setObjectClasses:(NSArray *)objectClasses {\n    _customSchema = objectClasses ? [RLMSchema schemaWithObjectClasses:objectClasses] : nil;\n    [self updateSchemaMode];\n}\n\n- (NSUInteger)maximumNumberOfActiveVersions {\n    if (_config.max_number_of_active_versions > std::numeric_limits<NSUInteger>::max()) {\n        return std::numeric_limits<NSUInteger>::max();\n    }\n    return static_cast<NSUInteger>(_config.max_number_of_active_versions);\n}\n\n- (void)setMaximumNumberOfActiveVersions:(NSUInteger)maximumNumberOfActiveVersions {\n    if (maximumNumberOfActiveVersions == 0) {\n        _config.max_number_of_active_versions = std::numeric_limits<uint_fast64_t>::max();\n    }\n    else {\n        _config.max_number_of_active_versions = maximumNumberOfActiveVersions;\n    }\n}\n\n- (void)setDynamic:(bool)dynamic {\n    _dynamic = dynamic;\n    self.cache = !dynamic;\n}\n\n- (bool)disableFormatUpgrade {\n    return _config.disable_format_upgrade;\n}\n\n- (void)setDisableFormatUpgrade:(bool)disableFormatUpgrade {\n    _config.disable_format_upgrade = disableFormatUpgrade;\n}\n\n- (realm::SchemaMode)schemaMode {\n    return _config.schema_mode;\n}\n\n- (void)setSchemaMode:(realm::SchemaMode)mode {\n    _config.schema_mode = mode;\n}\n\n- (NSString *)pathOnDisk {\n    return @(_config.path.c_str());\n}\n\n- (void)setShouldCompactOnLaunch:(RLMShouldCompactOnLaunchBlock)shouldCompactOnLaunch {\n    if (shouldCompactOnLaunch) {\n        if (_config.immutable()) {\n            @throw RLMException(@\"Cannot set `shouldCompactOnLaunch` when `readOnly` is set.\");\n        }\n        _config.should_compact_on_launch_function = shouldCompactOnLaunch;\n    }\n    else {\n        _config.should_compact_on_launch_function = nullptr;\n    }\n    _shouldCompactOnLaunch = shouldCompactOnLaunch;\n}\n\n- (void)setCustomSchemaWithoutCopying:(RLMSchema *)schema {\n    _customSchema = schema;\n}\n\n- (bool)disableAutomaticChangeNotifications {\n    return !_config.automatic_change_notifications;\n}\n\n- (void)setDisableAutomaticChangeNotifications:(bool)disableAutomaticChangeNotifications {\n    _config.automatic_change_notifications = !disableAutomaticChangeNotifications;\n}\n\n- (realm::Realm::Config)config {\n    return _config;\n}\n\n@end\n"
  },
  {
    "path": "Realm/RLMRealmConfiguration_Private.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMRealmConfiguration.h>\n\n@class RLMSchema, RLMEventConfiguration;\n\nRLM_HEADER_AUDIT_BEGIN(nullability)\n\n@interface RLMRealmConfiguration ()\n\n@property (nonatomic, readwrite) bool cache;\n@property (nonatomic, readwrite) bool dynamic;\n@property (nonatomic, readwrite) bool disableFormatUpgrade;\n@property (nonatomic, copy, nullable) RLMSchema *customSchema;\n@property (nonatomic, copy) NSString *pathOnDisk;\n@property (nonatomic, retain, nullable) RLMEventConfiguration *eventConfiguration;\n@property (nonatomic, nullable) Class migrationObjectClass;\n@property (nonatomic) bool disableAutomaticChangeNotifications;\n\n// Get the default configuration without copying it\n+ (RLMRealmConfiguration *)rawDefaultConfiguration;\n\n+ (void)resetRealmConfigurationState;\n\n- (void)setCustomSchemaWithoutCopying:(nullable RLMSchema *)schema;\n@end\n\n// Get a path in the platform-appropriate documents directory with the given filename\nFOUNDATION_EXTERN NSString *RLMRealmPathForFile(NSString *fileName);\nFOUNDATION_EXTERN NSString *RLMRealmPathForFileAndBundleIdentifier(NSString *fileName, NSString *mainBundleIdentifier);\n\nRLM_HEADER_AUDIT_END(nullability)\n"
  },
  {
    "path": "Realm/RLMRealmConfiguration_Private.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMRealmConfiguration_Private.h\"\n\n#import <realm/object-store/shared_realm.hpp>\n\n@interface RLMRealmConfiguration ()\n- (realm::Realm::Config)config;\n- (realm::Realm::Config&)configRef;\n- (std::string const&)path;\n\n@property (nonatomic) realm::SchemaMode schemaMode;\n- (void)updateSchemaMode;\n@end\n\nvoid RLMDeferredAuditConfigInit(realm::AuditConfig& auditConfig, RLMRealmConfiguration *realmConfig);\n"
  },
  {
    "path": "Realm/RLMRealmUtil.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\n#import <memory>\n#import <string>\n\n@class RLMRealm, RLMRealmConfiguration, RLMScheduler;\n\nnamespace realm {\n    class BindingContext;\n}\n\n// Add a Realm to the weak cache\nvoid RLMCacheRealm(RLMRealmConfiguration *configuration,\n                   RLMScheduler *options,\n                   RLMRealm *realm);\nRLMRealm *RLMGetAnyCachedRealmForPath(std::string const& path) NS_RETURNS_RETAINED;\n// Clear the weak cache of Realms\nvoid RLMClearRealmCache();\n\nRLMRealm *RLMGetFrozenRealmForSourceRealm(RLMRealm *realm) NS_RETURNS_RETAINED;\n\nstd::unique_ptr<realm::BindingContext> RLMCreateBindingContext(RLMRealm *realm);\n"
  },
  {
    "path": "Realm/RLMRealmUtil.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMRealmUtil.hpp\"\n\n#import \"RLMAsyncTask_Private.h\"\n#import \"RLMObservation.hpp\"\n#import \"RLMRealmConfiguration_Private.hpp\"\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMScheduler.h\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/object-store/binding_context.hpp>\n#import <realm/object-store/impl/realm_coordinator.hpp>\n#import <realm/object-store/shared_realm.hpp>\n#import <realm/object-store/util/scheduler.hpp>\n\n#import <map>\n\n// Global realm state\nstatic auto& s_realmCacheMutex = *new RLMUnfairMutex;\nstatic auto& s_realmsPerPath = *new std::map<std::string, NSMapTable *>();\nstatic auto& s_frozenRealms = *new std::map<std::string, NSMapTable *>();\n\nvoid RLMCacheRealm(__unsafe_unretained RLMRealmConfiguration *const configuration,\n                   RLMScheduler *scheduler,\n                   __unsafe_unretained RLMRealm *const realm) {\n    auto& path = configuration.path;\n    auto key = scheduler.cacheKey;\n    std::lock_guard lock(s_realmCacheMutex);\n    NSMapTable *realms = s_realmsPerPath[path];\n    if (!realms) {\n        s_realmsPerPath[path] = realms = [NSMapTable mapTableWithKeyOptions:NSPointerFunctionsOpaquePersonality|NSPointerFunctionsOpaqueMemory\n                                                               valueOptions:NSPointerFunctionsWeakMemory];\n    }\n    [realms setObject:realm forKey:(__bridge id)key];\n}\n\nRLMRealm *RLMGetCachedRealm(__unsafe_unretained RLMRealmConfiguration *const configuration,\n                            RLMScheduler *scheduler) {\n    auto key = scheduler.cacheKey;\n    auto& path = configuration.path;\n    std::lock_guard lock(s_realmCacheMutex);\n    RLMRealm *realm = [s_realmsPerPath[path] objectForKey:(__bridge id)key];\n    if (realm && !realm->_realm->scheduler()->is_on_thread()) {\n        // We can get here in two cases: if the user is trying to open a\n        // queue-bound Realm from the wrong queue, or if we have a stale cached\n        // Realm which is bound to a thread that no longer exists. In the first\n        // case we'll throw an error later on; in the second we'll just create\n        // a new RLMRealm and replace the cache entry with one bound to the\n        // thread that now exists.\n        realm = nil;\n    }\n    return realm;\n}\n\nRLMRealm *RLMGetAnyCachedRealm(__unsafe_unretained RLMRealmConfiguration *const configuration) {\n    return RLMGetAnyCachedRealmForPath(configuration.path);\n}\n\nRLMRealm *RLMGetAnyCachedRealmForPath(std::string const& path) {\n    std::lock_guard lock(s_realmCacheMutex);\n    return [s_realmsPerPath[path] objectEnumerator].nextObject;\n}\n\nvoid RLMClearRealmCache() {\n    std::lock_guard lock(s_realmCacheMutex);\n    s_realmsPerPath.clear();\n    s_frozenRealms.clear();\n}\n\nRLMRealm *RLMGetFrozenRealmForSourceRealm(__unsafe_unretained RLMRealm *const sourceRealm) {\n    std::lock_guard lock(s_realmCacheMutex);\n    auto& r = *sourceRealm->_realm;\n    auto& path = r.config().path;\n    NSMapTable *realms = s_realmsPerPath[path];\n    if (!realms) {\n        s_realmsPerPath[path] = realms = [NSMapTable mapTableWithKeyOptions:NSPointerFunctionsIntegerPersonality|NSPointerFunctionsOpaqueMemory\n                                                               valueOptions:NSPointerFunctionsWeakMemory];\n    }\n    r.read_group();\n    auto version = reinterpret_cast<void *>(r.read_transaction_version().version);\n    RLMRealm *realm = [realms objectForKey:(__bridge id)version];\n    if (!realm) {\n        realm = [sourceRealm frozenCopy];\n        [realms setObject:realm forKey:(__bridge id)version];\n    }\n    return realm;\n}\n\nnamespace {\nvoid advance_to_ready(realm::Realm& realm) {\n    if (!realm.auto_refresh()) {\n        realm.set_auto_refresh(true);\n        realm.notify();\n        realm.set_auto_refresh(false);\n    }\n}\n\nclass RLMNotificationHelper : public realm::BindingContext {\npublic:\n    RLMNotificationHelper(RLMRealm *realm) : _realm(realm) { }\n\n    void before_notify() override {\n        @autoreleasepool {\n            auto blocks = std::move(_beforeNotify);\n            _beforeNotify.clear();\n            for (auto block : blocks) {\n                block();\n            }\n        }\n    }\n\n    void changes_available() override {\n        @autoreleasepool {\n            auto realm = _realm;\n            if (!realm || realm.autorefresh) {\n                return;\n            }\n\n            // If an async refresh has been requested, then do that now instead\n            // of notifying of a pending version available. Note that this will\n            // recursively call this function and then exit above due to\n            // autorefresh being true.\n            if (_refreshHandlers.empty()) {\n                [realm sendNotifications:RLMRealmRefreshRequiredNotification];\n            }\n            else {\n                advance_to_ready(*realm->_realm);\n            }\n        }\n    }\n\n    std::vector<ObserverState> get_observed_rows() override {\n        @autoreleasepool {\n            if (auto realm = _realm) {\n                [realm detachAllEnumerators];\n                return RLMGetObservedRows(realm->_info);\n            }\n            return {};\n        }\n    }\n\n    void will_change(std::vector<ObserverState> const& observed,\n                     std::vector<void*> const& invalidated) override {\n        @autoreleasepool {\n            RLMWillChange(observed, invalidated);\n        }\n    }\n\n    void did_change(std::vector<ObserverState> const& observed,\n                    std::vector<void*> const& invalidated, bool version_changed) override {\n        @autoreleasepool {\n            __strong auto realm = _realm;\n            try {\n                RLMDidChange(observed, invalidated);\n                if (version_changed) {\n                    [realm sendNotifications:RLMRealmDidChangeNotification];\n                }\n            }\n            catch (...) {\n                // This can only be called during a write transaction if it was\n                // called due to the transaction beginning, so cancel it to ensure\n                // exceptions thrown here behave the same as exceptions thrown when\n                // actually beginning the write\n                if (realm.inWriteTransaction) {\n                    [realm cancelWriteTransaction];\n                }\n                throw;\n            }\n\n            if (!realm || !version_changed) {\n                return;\n            }\n            auto new_version = realm->_realm->current_transaction_version();\n            if (!new_version) {\n                return;\n            }\n\n            std::erase_if(_refreshHandlers, [&](auto& handler) {\n                auto& [target_version, completion] = handler;\n                if (new_version->version >= target_version) {\n                    completion(true);\n                    return true;\n                }\n                return false;\n            });\n        }\n    }\n\n    void add_before_notify_block(dispatch_block_t block) {\n        _beforeNotify.push_back(block);\n    }\n\n    void wait_for_refresh(realm::DB::version_type version, RLMAsyncRefreshCompletion completion) {\n        _refreshHandlers.emplace_back(version, completion);\n    }\n\nprivate:\n    // This is owned by the realm, so it needs to not retain the realm\n    __weak RLMRealm *const _realm;\n    std::vector<dispatch_block_t> _beforeNotify;\n    std::vector<std::pair<realm::DB::version_type, RLMAsyncRefreshCompletion>> _refreshHandlers;\n};\n} // anonymous namespace\n\nstd::unique_ptr<realm::BindingContext> RLMCreateBindingContext(__unsafe_unretained RLMRealm *const realm) {\n    return std::unique_ptr<realm::BindingContext>(new RLMNotificationHelper(realm));\n}\n\nvoid RLMAddBeforeNotifyBlock(RLMRealm *realm, dispatch_block_t block) {\n    static_cast<RLMNotificationHelper *>(realm->_realm->m_binding_context.get())->add_before_notify_block(block);\n}\n\n@implementation RLMPinnedRealm {\n    realm::TransactionRef _pin;\n}\n\n- (instancetype)initWithRealm:(RLMRealm *)realm {\n    if (self = [super init]) {\n        _pin = realm->_realm->duplicate();\n        _configuration = realm.configurationSharingSchema;\n    }\n    return self;\n}\n\n- (void)unpin {\n    _pin.reset();\n}\n@end\n\nRLMAsyncRefreshTask *RLMRealmRefreshAsync(RLMRealm *rlmRealm) {\n    auto& realm = *rlmRealm->_realm;\n    if (realm.is_frozen() || realm.config().immutable()) {\n        return nil;\n    }\n\n    // Refresh is a no-op if the Realm isn't currently in a read transaction\n    // or is up-to-date\n    auto latest = realm.latest_snapshot_version();\n    auto current = realm.current_transaction_version();\n    if (!latest || !current || current->version == *latest)\n        return nil;\n\n    // If autorefresh is disabled, we may have already been notified of a new\n    // version and simply not advanced to it.\n    advance_to_ready(realm);\n\n    // This may have advanced to the latest version in which case there's\n    // nothing left to do\n    current = realm.current_transaction_version();\n    if (current && current->version >= *latest)\n        return [RLMAsyncRefreshTask completedRefresh];\n    auto refresh = [[RLMAsyncRefreshTask alloc] init];\n\n    // Register the continuation to be called once the new version is ready\n    auto& context = static_cast<RLMNotificationHelper&>(*realm.m_binding_context);\n    context.wait_for_refresh(*latest, ^(bool didRefresh) { [refresh complete:didRefresh]; });\n    return refresh;\n}\n\nvoid RLMRunAsyncNotifiers(NSString *path) {\n    realm::_impl::RealmCoordinator::get_existing_coordinator(path.UTF8String)->on_change();\n}\n"
  },
  {
    "path": "Realm/RLMRealm_Dynamic.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMRealm.h>\n\n#import <Realm/RLMObjectSchema.h>\n#import <Realm/RLMProperty.h>\n\n@class RLMResults<RLMObjectType>;\n\nRLM_HEADER_AUDIT_BEGIN(nullability)\n\n@interface RLMRealm (Dynamic)\n\n#pragma mark - Getting Objects from a Realm\n\n/**\n Returns all objects of a given type from the Realm.\n\n @warning This method is useful only in specialized circumstances, for example, when building components\n          that integrate with Realm. The preferred way to get objects of a single class is to use the class\n          methods on `RLMObject`.\n\n @param className   The name of the `RLMObject` subclass to retrieve on (e.g. `MyClass.className`).\n\n @return    An `RLMResults` containing all objects in the Realm of the given type.\n\n @see       `+[RLMObject allObjects]`\n */\n- (RLMResults<RLMObject *> *)allObjects:(NSString *)className;\n\n/**\n Returns all objects matching the given predicate from the Realm.\n\n @warning This method is useful only in specialized circumstances, for example, when building components\n          that integrate with Realm. The preferred way to get objects of a single class is to use the class\n          methods on `RLMObject`.\n\n @param className       The type of objects you are looking for (name of the class).\n @param predicateFormat A predicate format string, optionally followed by a variable number of arguments.\n\n @return    An `RLMResults` containing results matching the given predicate.\n\n @see       `+[RLMObject objectsWhere:]`\n */\n- (RLMResults<RLMObject *> *)objects:(NSString *)className where:(NSString *)predicateFormat, ...;\n\n/**\n Returns all objects matching the given predicate from the Realm.\n\n @warning This method is useful only in specialized circumstances, for example, when building components\n          that integrate with Realm. The preferred way to get objects of a single class is to use the class\n          methods on `RLMObject`.\n\n @param className   The type of objects you are looking for (name of the class).\n @param predicate   The predicate with which to filter the objects.\n\n @return    An `RLMResults` containing results matching the given predicate.\n\n @see       `+[RLMObject objectsWhere:]`\n */\n- (RLMResults<RLMObject *> *)objects:(NSString *)className withPredicate:(NSPredicate *)predicate;\n\n/**\n Returns the object of the given type with the given primary key from the Realm.\n\n @warning This method is useful only in specialized circumstances, for example, when building components\n          that integrate with Realm. The preferred way to get an object of a single class is to use the class\n          methods on `RLMObject`.\n\n @param className   The class name for the object you are looking for.\n @param primaryKey  The primary key value for the object you are looking for.\n\n @return    An object, or `nil` if an object with the given primary key does not exist.\n\n @see       `+[RLMObject objectForPrimaryKey:]`\n */\n- (nullable RLMObject *)objectWithClassName:(NSString *)className forPrimaryKey:(id)primaryKey;\n\n/**\n Creates an `RLMObject` instance of type `className` in the Realm, and populates it using a given object.\n\n The `value` argument is used to populate the object. It can be a key-value coding compliant object, an array or\n dictionary returned from the methods in `NSJSONSerialization`, or an array containing one element for each managed\n property. An exception will be thrown if any required properties are not present and those properties were not defined\n with default values.\n\n When passing in an array as the `value` argument, all properties must be present, valid and in the same order as the\n properties defined in the model.\n\n @warning This method is useful only in specialized circumstances, for example, when building components\n          that integrate with Realm. If you are simply building an app on Realm, it is recommended to\n          use `[RLMObject createInDefaultRealmWithValue:]`.\n\n @param value    The value used to populate the object.\n\n @return    An `RLMObject` instance of type `className`.\n */\n-(RLMObject *)createObject:(NSString *)className withValue:(id)value;\n\n@end\n\nRLM_HEADER_AUDIT_END(nullability)\n"
  },
  {
    "path": "Realm/RLMRealm_Private.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMRealm.h>\n\n@class RLMFastEnumerator, RLMScheduler, RLMAsyncRefreshTask, RLMAsyncWriteTask;\n\nRLM_HEADER_AUDIT_BEGIN(nullability)\n\n// Disable syncing files to disk. Cannot be re-enabled. Use only for tests.\nFOUNDATION_EXTERN void RLMDisableSyncToDisk(void);\n// Set whether the skip backup attribute should be set on temporary files.\nFOUNDATION_EXTERN void RLMSetSkipBackupAttribute(bool value);\n\nFOUNDATION_EXTERN NSData * _Nullable RLMRealmValidatedEncryptionKey(NSData *key);\n\n// Set the queue used for async open. For testing purposes only.\nFOUNDATION_EXTERN void RLMSetAsyncOpenQueue(dispatch_queue_t queue);\n\n// Translate an in-flight exception resulting from an operation on a SharedGroup to\n// an NSError or NSException (if error is nil)\nvoid RLMRealmTranslateException(NSError **error);\n\n// Block until the Realm at the given path is closed.\nFOUNDATION_EXTERN void RLMWaitForRealmToClose(NSString *path);\nBOOL RLMIsRealmCachedAtPath(NSString *path);\n\n// Register a block to be called from the next before_notify() invocation\nFOUNDATION_EXTERN void RLMAddBeforeNotifyBlock(RLMRealm *realm, dispatch_block_t block);\n\n// Test hook to run the async notifiers for a Realm which has the background thread disabled\nFOUNDATION_EXTERN void RLMRunAsyncNotifiers(NSString *path);\n\n// Get the cached Realm for the given configuration and scheduler, if any\nFOUNDATION_EXTERN RLMRealm *_Nullable RLMGetCachedRealm(RLMRealmConfiguration *, RLMScheduler *) NS_RETURNS_RETAINED;\n// Get a cached Realm for the given configuration and any scheduler. The returned\n// Realm is not confined to the current thread, so very few operations are safe\n// to perform on it\nFOUNDATION_EXTERN RLMRealm *_Nullable RLMGetAnyCachedRealm(RLMRealmConfiguration *) NS_RETURNS_RETAINED;\n\n// Scheduler an async refresh for the given Realm\nFOUNDATION_EXTERN RLMAsyncRefreshTask *_Nullable RLMRealmRefreshAsync(RLMRealm *rlmRealm) NS_RETURNS_RETAINED;\n\n// RLMRealm private members\n@interface RLMRealm ()\n@property (nonatomic, readonly) BOOL dynamic;\n@property (nonatomic, readwrite) RLMSchema *schema;\n@property (nonatomic, readonly, nullable) id actor;\n\n// `-configuration` does a deep copy of the schema as if the user mutates the\n// RLMSchema in use by a RLMRealm things will break horribly. When we know that\n// the configuration won't be exposed we can skip the copy.\n- (RLMRealmConfiguration *)configurationSharingSchema NS_RETURNS_RETAINED;\n\n+ (void)resetRealmState;\n\n- (void)registerEnumerator:(RLMFastEnumerator *)enumerator;\n- (void)unregisterEnumerator:(RLMFastEnumerator *)enumerator;\n- (void)detachAllEnumerators;\n\n- (void)sendNotifications:(RLMNotification)notification;\n- (void)verifyThread;\n- (void)verifyNotificationsAreSupported:(bool)isCollection;\n\n- (RLMRealm *)frozenCopy NS_RETURNS_RETAINED;\n\n+ (nullable instancetype)realmWithConfiguration:(RLMRealmConfiguration *)configuration\n                                     confinedTo:(RLMScheduler *)options\n                                          error:(NSError **)error NS_RETURNS_RETAINED;\n\n- (RLMAsyncWriteTask *)beginAsyncWrite NS_RETURNS_RETAINED;\n- (void)commitAsyncWriteWithGrouping:(bool)allowGrouping\n                          completion:(void(^)(NSError *_Nullable))completion;\n@end\n\n@interface RLMPinnedRealm : NSObject\n@property (nonatomic, readonly) RLMRealmConfiguration *configuration;\n\n- (instancetype)initWithRealm:(RLMRealm *)realm;\n- (void)unpin;\n@end\n\nRLM_HEADER_AUDIT_END(nullability)\n"
  },
  {
    "path": "Realm/RLMRealm_Private.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMRealm_Private.h\"\n\n#import \"RLMClassInfo.hpp\"\n\n#import <memory>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\nnamespace realm {\n    class Group;\n    class Realm;\n}\n\n@interface RLMRealm () {\n    @public\n    std::shared_ptr<realm::Realm> _realm;\n    RLMSchemaInfo _info;\n}\n\n+ (instancetype)realmWithSharedRealm:(std::shared_ptr<realm::Realm>)sharedRealm\n                              schema:(nullable RLMSchema *)schema\n                             dynamic:(bool)dynamic\n    freeze:(bool)freeze NS_RETURNS_RETAINED;\n\n@property (nonatomic, readonly) realm::Group &group;\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMResults.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMCollection.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n/// A block type used for APIs which asynchronously return a `Results`.\ntypedef void(^RLMResultsCompletionBlock)(RLMResults * _Nullable, NSError * _Nullable);\n\n@class RLMObject;\n\n/**\n `RLMResults` is an auto-updating container type in Realm returned from object\n queries. It represents the results of the query in the form of a collection of objects.\n\n `RLMResults` can be queried using the same predicates as `RLMObject` and `RLMArray`,\n and you can chain queries to further filter results.\n\n `RLMResults` always reflect the current state of the Realm on the current thread,\n including during write transactions on the current thread. The one exception to\n this is when using `for...in` fast enumeration, which will always enumerate\n over the objects which matched the query when the enumeration is begun, even if\n some of them are deleted or modified to be excluded by the filter during the\n enumeration.\n\n `RLMResults` are lazily evaluated the first time they are accessed; they only\n run queries when the result of the query is requested. This means that\n chaining several temporary `RLMResults` to sort and filter your data does not\n perform any extra work processing the intermediate state.\n\n Once the results have been evaluated or a notification block has been added,\n the results are eagerly kept up-to-date, with the work done to keep them\n up-to-date done on a background thread whenever possible.\n\n `RLMResults` cannot be directly instantiated.\n */\n@interface RLMResults<RLMObjectType> : NSObject<RLMCollection, NSFastEnumeration>\n\n#pragma mark - Properties\n\n/**\n The number of objects in the results collection.\n */\n@property (nonatomic, readonly, assign) NSUInteger count;\n\n/**\n The type of the objects in the results collection.\n */\n@property (nonatomic, readonly, assign) RLMPropertyType type;\n\n/**\n Indicates whether the objects in the collection can be `nil`.\n */\n@property (nonatomic, readwrite, getter = isOptional) BOOL optional;\n\n/**\n The class name  of the objects contained in the results collection.\n\n Will be `nil` if `type` is not RLMPropertyTypeObject.\n */\n@property (nonatomic, readonly, copy, nullable) NSString *objectClassName;\n\n/**\n The Realm which manages this results collection.\n */\n@property (nonatomic, readonly) RLMRealm *realm;\n\n/**\n Indicates if the results collection is no longer valid.\n\n The results collection becomes invalid if `invalidate` is called on the containing `realm`.\n An invalidated results collection can be accessed, but will always be empty.\n */\n@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated;\n\n#pragma mark - Accessing Objects from an RLMResults\n\n/**\n Returns the object at the index specified.\n\n @param index   The index to look up.\n\n @return An object of the type contained in the results collection.\n */\n- (RLMObjectType)objectAtIndex:(NSUInteger)index;\n\n/**\n Returns an array containing the objects in the results at the indexes specified by a given index set.\n `nil` will be returned if the index set contains an index out of the arrays bounds.\n\n @param indexes The indexes in the results to retrieve objects from.\n\n @return The objects at the specified indexes.\n */\n- (nullable NSArray<RLMObjectType> *)objectsAtIndexes:(NSIndexSet *)indexes;\n\n/**\n Returns the first object in the results collection.\n\n Returns `nil` if called on an empty results collection.\n\n @return An object of the type contained in the results collection.\n */\n- (nullable RLMObjectType)firstObject;\n\n/**\n Returns the last object in the results collection.\n\n Returns `nil` if called on an empty results collection.\n\n @return An object of the type contained in the results collection.\n */\n- (nullable RLMObjectType)lastObject;\n\n#pragma mark - Querying Results\n\n/**\n Returns the index of an object in the results collection.\n\n Returns `NSNotFound` if the object is not found in the results collection.\n\n @param object  An object (of the same type as returned from the `objectClassName` selector).\n */\n- (NSUInteger)indexOfObject:(RLMObjectType)object;\n\n/**\n Returns the index of the first object in the results collection matching the predicate.\n\n @param predicateFormat A predicate format string, optionally followed by a variable number of arguments.\n\n @return    The index of the object, or `NSNotFound` if the object is not found in the results collection.\n */\n- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat, ...;\n\n/// :nodoc:\n- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args;\n\n/**\n Returns the index of the first object in the results collection matching the predicate.\n\n @param predicate   The predicate with which to filter the objects.\n\n @return    The index of the object, or `NSNotFound` if the object is not found in the results collection.\n */\n- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicate;\n\n/**\n Returns all the objects matching the given predicate in the results collection.\n\n @param predicateFormat A predicate format string, optionally followed by a variable number of arguments.\n\n @return                An `RLMResults` of objects that match the given predicate.\n */\n- (RLMResults<RLMObjectType> *)objectsWhere:(NSString *)predicateFormat, ...;\n\n/// :nodoc:\n- (RLMResults<RLMObjectType> *)objectsWhere:(NSString *)predicateFormat args:(va_list)args;\n\n/**\n Returns all the objects matching the given predicate in the results collection.\n\n @param predicate   The predicate with which to filter the objects.\n\n @return            An `RLMResults` of objects that match the given predicate.\n */\n- (RLMResults<RLMObjectType> *)objectsWithPredicate:(NSPredicate *)predicate;\n\n/**\n Returns a sorted `RLMResults` from an existing results collection.\n\n @param keyPath     The key path to sort by.\n @param ascending   The direction to sort in.\n\n @return    An `RLMResults` sorted by the specified key path.\n */\n- (RLMResults<RLMObjectType> *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending;\n\n/**\n Returns a sorted `RLMResults` from an existing results collection.\n\n @param properties  An array of `RLMSortDescriptor`s to sort by.\n\n @return    An `RLMResults` sorted by the specified properties.\n */\n- (RLMResults<RLMObjectType> *)sortedResultsUsingDescriptors:(NSArray<RLMSortDescriptor *> *)properties;\n\n/**\n Returns a distinct `RLMResults` from an existing results collection.\n \n @param keyPaths  The key paths used produce distinct results\n \n @return    An `RLMResults` made distinct based on the specified key paths\n */\n- (RLMResults<RLMObjectType> *)distinctResultsUsingKeyPaths:(NSArray<NSString *> *)keyPaths;\n\n#pragma mark - Notifications\n\n/**\n Registers a block to be called each time the results collection changes.\n\n The block will be asynchronously called with the initial results collection,\n and then called again after each write transaction which changes either any\n of the objects in the results, or which objects are in the results.\n\n The `change` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the results collection were added, removed or modified. If a\n write transaction did not modify any objects in the results collection,\n the block is not called at all. See the `RLMCollectionChange` documentation for\n information on how the changes are reported and an example of updating a\n `UITableView`.\n\n The error parameter is present only for backwards compatibility and will always\n be `nil`.\n\n At the time when the block is called, the `RLMResults` object will be fully\n evaluated and up-to-date, and as long as you do not perform a write transaction\n on the same thread or explicitly call `-[RLMRealm refresh]`, accessing it will\n never perform blocking work.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification. This can include the notification\n with the initial results. For example, the following code performs a write\n transaction immediately after adding the notification block, so there is no\n opportunity for the initial notification to be delivered first. As a\n result, the initial notification will reflect the state of the Realm after\n the write transaction.\n\n     RLMResults<Dog *> *results = [Dog allObjects];\n     NSLog(@\"dogs.count: %zu\", dogs.count); // => 0\n     self.token = [results addNotificationBlock:^(RLMResults *dogs,\n                                                  RLMCollectionChange *changes,\n                                                  NSError *error) {\n         // Only fired once for the example\n         NSLog(@\"dogs.count: %zu\", dogs.count); // => 1\n     }];\n     [realm transactionWithBlock:^{\n         Dog *dog = [[Dog alloc] init];\n         dog.name = @\"Rex\";\n         [realm addObject:dog];\n     }];\n     // end of run loop execution context\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n\n @param block The block to be called whenever a change occurs.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults<RLMObjectType> *_Nullable results,\n                                                         RLMCollectionChange *_Nullable change,\n                                                         NSError *_Nullable error))block\n__attribute__((warn_unused_result));\n\n/**\n Registers a block to be called each time the results collection changes.\n\n The block will be asynchronously called with the initial results collection,\n and then called again after each write transaction which changes either any\n of the objects in the results, or which objects are in the results.\n\n The `change` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the results collection were added, removed or modified. If a\n write transaction did not modify any objects in the results collection,\n the block is not called at all. See the `RLMCollectionChange` documentation for\n information on how the changes are reported and an example of updating a\n `UITableView`.\n\n The error parameter is present only for backwards compatibility and will always\n be `nil`.\n\n At the time when the block is called, the `RLMResults` object will be fully\n evaluated and up-to-date, and as long as you do not perform a write transaction\n on the same thread or explicitly call `-[RLMRealm refresh]`, accessing it will\n never perform blocking work.\n\n Notifications are delivered on the given queue. If the queue is blocked and\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification.\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called when the containing Realm is read-only or frozen.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param queue The serial queue to deliver notifications to.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults<RLMObjectType> *_Nullable results,\n                                                         RLMCollectionChange *_Nullable change,\n                                                         NSError *_Nullable error))block\n                                         queue:(nullable dispatch_queue_t)queue\n__attribute__((warn_unused_result));\n\n/**\n Registers a block to be called each time the results collection changes.\n\n The block will be asynchronously called with the initial results collection,\n and then called again after each write transaction which changes either any\n of the objects in the results, or which objects are in the results.\n\n The `change` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the results collection were added, removed or modified. If a\n write transaction did not modify any objects in the results collection,\n the block is not called at all. See the `RLMCollectionChange` documentation for\n information on how the changes are reported and an example of updating a\n `UITableView`.\n\n The error parameter is present only for backwards compatibility and will always\n be `nil`.\n\n At the time when the block is called, the `RLMResults` object will be fully\n evaluated and up-to-date, and as long as you do not perform a write transaction\n on the same thread or explicitly call `-[RLMRealm refresh]`, accessing it will\n never perform blocking work.\n\n Notifications are delivered on the given queue. If the queue is blocked and\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification.\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called when the containing Realm is read-only or frozen.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param queue The serial queue to deliver notifications to.\n @param keyPaths The block will be called for changes occurring on these keypaths. If no\n key paths are given, notifications are delivered for every property key path.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults<RLMObjectType> *_Nullable results,\n                                                         RLMCollectionChange *_Nullable change,\n                                                         NSError *_Nullable error))block\n                                      keyPaths:(nullable NSArray<NSString *> *)keyPaths\n                                         queue:(nullable dispatch_queue_t)queue\n__attribute__((warn_unused_result));\n\n/**\n Registers a block to be called each time the results collection changes.\n\n The block will be asynchronously called with the initial results collection,\n and then called again after each write transaction which changes either any\n of the objects in the results, or which objects are in the results.\n\n The `change` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the results collection were added, removed or modified. If a\n write transaction did not modify any objects in the results collection,\n the block is not called at all. See the `RLMCollectionChange` documentation for\n information on how the changes are reported and an example of updating a\n `UITableView`.\n\n The error parameter is present only for backwards compatibility and will always\n be `nil`.\n\n At the time when the block is called, the `RLMResults` object will be fully\n evaluated and up-to-date, and as long as you do not perform a write transaction\n on the same thread or explicitly call `-[RLMRealm refresh]`, accessing it will\n never perform blocking work.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification. This can include the notification\n with the initial results. For example, the following code performs a write\n transaction immediately after adding the notification block, so there is no\n opportunity for the initial notification to be delivered first. As a\n result, the initial notification will reflect the state of the Realm after\n the write transaction.\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called when the containing Realm is read-only or frozen.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param keyPaths The block will be called for changes occurring on these keypaths. If no\n key paths are given, notifications are delivered for every property key path.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults<RLMObjectType> *_Nullable results,\n                                                         RLMCollectionChange *_Nullable change,\n                                                         NSError *_Nullable error))block\n                                      keyPaths:(nullable NSArray<NSString *> *)keyPaths\n__attribute__((warn_unused_result));\n\n#pragma mark - Aggregating Property Values\n\n/**\n Returns the minimum (lowest) value of the given property among all the objects\n represented by the results collection.\n\n     NSNumber *min = [results minOfProperty:@\"age\"];\n\n @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.\n\n @param property The property whose minimum value is desired. Only properties of types `int`, `float`, `double`, and\n                 `NSDate` are supported.\n\n @return The minimum value of the property, or `nil` if the Results are empty.\n */\n- (nullable id)minOfProperty:(NSString *)property;\n\n/**\n Returns the maximum (highest) value of the given property among all the objects represented by the results collection.\n\n     NSNumber *max = [results maxOfProperty:@\"age\"];\n\n @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.\n\n @param property The property whose maximum value is desired. Only properties of\n                 types `int`, `float`, `double`, and `NSDate` are supported.\n\n @return The maximum value of the property, or `nil` if the Results are empty.\n */\n- (nullable id)maxOfProperty:(NSString *)property;\n\n/**\n Returns the sum of the values of a given property over all the objects represented by the results collection.\n\n     NSNumber *sum = [results sumOfProperty:@\"age\"];\n\n @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.\n\n @param property The property whose values should be summed. Only properties of\n                 types `int`, `float`, and `double` are supported.\n\n @return The sum of the given property.\n */\n- (NSNumber *)sumOfProperty:(NSString *)property;\n\n/**\n Returns the average value of a given property over the objects represented by the results collection.\n\n     NSNumber *average = [results averageOfProperty:@\"age\"];\n\n @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.\n\n @param property The property whose average value should be calculated. Only\n                 properties of types `int`, `float`, and `double` are supported.\n\n @return    The average value of the given property, or `nil` if the Results are empty.\n */\n- (nullable NSNumber *)averageOfProperty:(NSString *)property;\n\n/// :nodoc:\n- (RLMObjectType)objectAtIndexedSubscript:(NSUInteger)index;\n\n#pragma mark - Sectioned Results\n\n/**\n Sorts and sections this collection from a given property key path, returning the result\n as an instance of `RLMSectionedResults`.\n\n @param keyPath The property key path to sort on.\n @param ascending The direction to sort in.\n @param keyBlock  A callback which is invoked on each element in the Results collection.\n                 This callback is to return the section key for the element in the collection.\n\n @return An instance of RLMSectionedResults.\n */\n- (RLMSectionedResults *)sectionedResultsSortedUsingKeyPath:(NSString *)keyPath\n                                                  ascending:(BOOL)ascending\n                                                   keyBlock:(RLMSectionedResultsKeyBlock)keyBlock;\n\n/**\n Sorts and sections this collection from a given array of sort descriptors, returning the result\n as an instance of `RLMSectionedResults`.\n\n @param sortDescriptors  An array of `RLMSortDescriptor`s to sort by.\n @param keyBlock  A callback which is invoked on each element in the Results collection.\n                 This callback is to return the section key for the element in the collection.\n\n @note The primary sort descriptor must be responsible for determining the section key.\n\n @return An instance of RLMSectionedResults.\n */\n- (RLMSectionedResults *)sectionedResultsUsingSortDescriptors:(NSArray<RLMSortDescriptor *> *)sortDescriptors\n                                                     keyBlock:(RLMSectionedResultsKeyBlock)keyBlock;\n\n#pragma mark - Freeze\n\n/**\n Indicates if the result are frozen.\n\n Frozen Results are immutable and can be accessed from any thread.The objects\n read from a frozen Results will also be frozen.\n */\n@property (nonatomic, readonly, getter=isFrozen) BOOL frozen;\n\n/**\n Returns a frozen (immutable) snapshot of these results.\n\n The frozen copy is an immutable collection which contains the same data as\n this collection currently contains, but will not update when writes are made\n to the containing Realm. Unlike live Results, frozen Results can be accessed\n from any thread.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning Holding onto a frozen collection for an extended period while\n          performing write transaction on the Realm may result in the Realm\n          file growing to large sizes. See\n          `RLMRealmConfiguration.maximumNumberOfActiveVersions` for more\n          information.\n */\n- (instancetype)freeze;\n\n/**\n Returns a live version of this frozen collection.\n\n This method resolves a reference to a live copy of the same frozen collection.\n If called on a live collection, will return itself.\n*/\n- (instancetype)thaw;\n\n#pragma mark - Unavailable Methods\n\n/**\n `-[RLMResults init]` is not available because `RLMResults` cannot be created directly.\n `RLMResults` can be obtained by querying a Realm.\n */\n- (instancetype)init __attribute__((unavailable(\"RLMResults cannot be created directly\")));\n\n/**\n `+[RLMResults new]` is not available because `RLMResults` cannot be created directly.\n `RLMResults` can be obtained by querying a Realm.\n */\n+ (instancetype)new __attribute__((unavailable(\"RLMResults cannot be created directly\")));\n\n@end\n\n/**\n `RLMLinkingObjects` is an auto-updating container type. It represents a collection of objects that link to its\n parent object.\n\n For more information, please see the \"Inverse Relationships\" section in the\n [documentation](https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/model-data/relationships/).\n */\n@interface RLMLinkingObjects<RLMObjectType: RLMObject *> : RLMResults\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMResults.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMResults_Private.hpp\"\n\n#import \"RLMAccessor.hpp\"\n#import \"RLMArray_Private.hpp\"\n#import \"RLMCollection_Private.hpp\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMObjectStore.h\"\n#import \"RLMObject_Private.hpp\"\n#import \"RLMObservation.hpp\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMQueryUtil.hpp\"\n#import \"RLMRealmConfiguration_Private.hpp\"\n#import \"RLMScheduler.h\"\n#import \"RLMSchema_Private.h\"\n#import \"RLMSectionedResults_Private.hpp\"\n#import \"RLMThreadSafeReference_Private.hpp\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/object-store/results.hpp>\n#import <realm/object-store/shared_realm.hpp>\n#import <realm/table_view.hpp>\n\n#import <objc/message.h>\n\nusing namespace realm;\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wincomplete-implementation\"\n@implementation RLMNotificationToken\n- (bool)invalidate {\n    return false;\n}\n@end\n#pragma clang diagnostic pop\n\n@interface RLMResults () <RLMThreadConfined_Private>\n@end\n\n// private properties\n@interface RLMResults ()\n@property (nonatomic, nullable) RLMObjectId *associatedSubscriptionId;\n@end\n\n//\n// RLMResults implementation\n//\n@implementation RLMResults {\n    RLMRealm *_realm;\n    RLMClassInfo *_info;\n}\n\n- (instancetype)initPrivate {\n    self = [super init];\n    return self;\n}\n\n- (instancetype)initWithResults:(Results)results {\n    if (self = [super init]) {\n        _results = std::move(results);\n    }\n    return self;\n}\n\nstatic void assertKeyPathIsNotNested(NSString *keyPath) {\n    if ([keyPath rangeOfString:@\".\"].location != NSNotFound) {\n        @throw RLMException(@\"Nested key paths are not supported yet for KVC collection operators.\");\n    }\n}\n\nvoid RLMThrowCollectionException(NSString *collectionName) {\n    try {\n        throw;\n    }\n    catch (realm::WrongTransactionState const&) {\n        @throw RLMException(@\"Cannot modify %@ outside of a write transaction.\", collectionName);\n    }\n    catch (realm::OutOfBounds const& e) {\n        @throw RLMException(@\"Index %zu is out of bounds (must be less than %zu).\",\n                            e.index, e.size);\n    }\n    catch (realm::Exception const& e) {\n        @throw RLMException(e);\n    }\n    catch (std::exception const& e) {\n        @throw RLMException(e);\n    }\n}\n\ntemplate<typename Function>\n__attribute__((always_inline))\nstatic auto translateErrors(Function&& f) {\n    return translateCollectionError(static_cast<Function&&>(f), @\"Results\");\n}\n\n- (instancetype)initWithObjectInfo:(RLMClassInfo&)info\n                           results:(realm::Results&&)results {\n    if (self = [super init]) {\n        _results = std::move(results);\n        _realm = info.realm;\n        _info = &info;\n    }\n    return self;\n}\n\n+ (instancetype)resultsWithObjectInfo:(RLMClassInfo&)info\n                              results:(realm::Results&&)results {\n    return [[self alloc] initWithObjectInfo:info results:std::move(results)];\n}\n\n+ (instancetype)emptyDetachedResults {\n    return [[self alloc] initPrivate];\n}\n\n- (instancetype)subresultsWithResults:(realm::Results)results {\n    return [self.class resultsWithObjectInfo:*_info results:std::move(results)];\n}\n\nstatic inline void RLMResultsValidateInWriteTransaction(__unsafe_unretained RLMResults *const ar) {\n    ar->_realm->_realm->verify_thread();\n    ar->_realm->_realm->verify_in_write();\n}\n\n- (BOOL)isInvalidated {\n    return translateErrors([&] { return !_results.is_valid(); });\n}\n\n- (NSUInteger)count {\n    return translateErrors([&] { return _results.size(); });\n}\n\n- (RLMPropertyType)type {\n    return translateErrors([&] {\n        return static_cast<RLMPropertyType>(_results.get_type() & ~realm::PropertyType::Nullable);\n    });\n}\n\n- (BOOL)isOptional {\n    return translateErrors([&] {\n        return is_nullable(_results.get_type());\n    });\n}\n\n- (NSString *)objectClassName {\n    return translateErrors([&] {\n        if (_info && _results.get_type() == realm::PropertyType::Object) {\n            return _info->rlmObjectSchema.className;\n        }\n        return (NSString *)nil;\n    });\n}\n\n- (RLMClassInfo *)objectInfo {\n    return _info;\n}\n\n- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state\n                                  objects:(__unused __unsafe_unretained id [])buffer\n                                    count:(NSUInteger)len {\n    if (!_info) {\n        return 0;\n    }\n    if (state->state == 0) {\n        translateErrors([&] {\n            _results.evaluate_query_if_needed();\n        });\n    }\n    return RLMFastEnumerate(state, len, self);\n}\n\n- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat, ... {\n    va_list args;\n    va_start(args, predicateFormat);\n    NSUInteger index = [self indexOfObjectWhere:predicateFormat args:args];\n    va_end(args);\n    return index;\n}\n\n- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args {\n    return [self indexOfObjectWithPredicate:[NSPredicate predicateWithFormat:predicateFormat\n                                                                   arguments:args]];\n}\n\n- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicate {\n    if (_results.get_mode() == Results::Mode::Empty) {\n        return NSNotFound;\n    }\n\n    return translateErrors([&] {\n        if (_results.get_type() != realm::PropertyType::Object) {\n            @throw RLMException(@\"Querying is currently only implemented for arrays of Realm Objects\");\n        }\n        return RLMConvertNotFound(_results.index_of(RLMPredicateToQuery(predicate, _info->rlmObjectSchema, _realm.schema, _realm.group)));\n    });\n}\n\n- (id)objectAtIndex:(NSUInteger)index {\n    RLMAccessorContext ctx(*_info);\n    return translateErrors([&] {\n        return _results.get(ctx, index);\n    });\n}\n\n- (NSArray *)objectsAtIndexes:(NSIndexSet *)indexes {\n    if (!_info) {\n        return nil;\n    }\n    size_t c = self.count;\n    NSMutableArray *result = [[NSMutableArray alloc] initWithCapacity:indexes.count];\n    NSUInteger i = [indexes firstIndex];\n    RLMAccessorContext context(*_info);\n    while (i != NSNotFound) {\n        if (i >= 0 && i < c) {\n            [result addObject:_results.get(context, i)];\n        } else {\n            return nil;\n        }\n        i = [indexes indexGreaterThanIndex:i];\n    }\n    return result;\n}\n\n- (id)firstObject {\n    if (!_info) {\n        return nil;\n    }\n    RLMAccessorContext ctx(*_info);\n    return translateErrors([&] {\n        return _results.first(ctx);\n    });\n}\n\n- (id)lastObject {\n    if (!_info) {\n        return nil;\n    }\n    RLMAccessorContext ctx(*_info);\n    return translateErrors([&] {\n        return _results.last(ctx);\n    });\n}\n\n- (NSUInteger)indexOfObject:(id)object {\n    if (!_info || !object) {\n        return NSNotFound;\n    }\n    if (RLMObjectBase *obj = RLMDynamicCast<RLMObjectBase>(object)) {\n        // Unmanaged objects are considered not equal to all managed objects\n        if (!obj->_realm && !obj.invalidated) {\n            return NSNotFound;\n        }\n    }\n    RLMAccessorContext ctx(*_info);\n    return translateErrors([&] {\n        return RLMConvertNotFound(_results.index_of(ctx, object));\n    });\n}\n\n- (id)valueForKeyPath:(NSString *)keyPath {\n    if ([keyPath characterAtIndex:0] != '@') {\n        return [super valueForKeyPath:keyPath];\n    }\n    if ([keyPath isEqualToString:@\"@count\"]) {\n        return @(self.count);\n    }\n\n    NSRange operatorRange = [keyPath rangeOfString:@\".\" options:NSLiteralSearch];\n    NSUInteger keyPathLength = keyPath.length;\n    NSUInteger separatorIndex = operatorRange.location != NSNotFound ? operatorRange.location : keyPathLength;\n    NSString *operatorName = [keyPath substringWithRange:NSMakeRange(1, separatorIndex - 1)];\n    SEL opSelector = NSSelectorFromString([NSString stringWithFormat:@\"_%@ForKeyPath:\", operatorName]);\n    if (![self respondsToSelector:opSelector]) {\n        @throw RLMException(@\"Unsupported KVC collection operator found in key path '%@'\", keyPath);\n    }\n    if (separatorIndex >= keyPathLength - 1) {\n        @throw RLMException(@\"Missing key path for KVC collection operator %@ in key path '%@'\",\n                            operatorName, keyPath);\n    }\n    NSString *operatorKeyPath = [keyPath substringFromIndex:separatorIndex + 1];\n    return ((id(*)(id, SEL, id))objc_msgSend)(self, opSelector, operatorKeyPath);\n}\n\n- (id)valueForKey:(NSString *)key {\n    if (!_info) {\n        return @[];\n    }\n    return translateErrors([&] {\n        return RLMCollectionValueForKey(_results, key, *_info);\n    });\n}\n\n- (void)setValue:(id)value forKey:(NSString *)key {\n    translateErrors([&] { RLMResultsValidateInWriteTransaction(self); });\n    RLMCollectionSetValueForKey(self, key, value);\n}\n\n- (NSNumber *)_aggregateForKeyPath:(NSString *)keyPath\n                            method:(std::optional<Mixed> (Results::*)(ColKey))method\n                        methodName:(NSString *)methodName returnNilForEmpty:(BOOL)returnNilForEmpty {\n    assertKeyPathIsNotNested(keyPath);\n    return [self aggregate:keyPath method:method returnNilForEmpty:returnNilForEmpty];\n}\n\n- (NSNumber *)_minForKeyPath:(NSString *)keyPath {\n    return [self _aggregateForKeyPath:keyPath method:&Results::min methodName:@\"@min\" returnNilForEmpty:YES];\n}\n\n- (NSNumber *)_maxForKeyPath:(NSString *)keyPath {\n    return [self _aggregateForKeyPath:keyPath method:&Results::max methodName:@\"@max\" returnNilForEmpty:YES];\n}\n\n- (NSNumber *)_sumForKeyPath:(NSString *)keyPath {\n    return [self _aggregateForKeyPath:keyPath method:&Results::sum methodName:@\"@sum\" returnNilForEmpty:NO];\n}\n\n- (NSNumber *)_avgForKeyPath:(NSString *)keyPath {\n    assertKeyPathIsNotNested(keyPath);\n    return [self averageOfProperty:keyPath];\n}\n\n- (NSArray *)_unionOfObjectsForKeyPath:(NSString *)keyPath {\n    assertKeyPathIsNotNested(keyPath);\n    return translateErrors([&] {\n        return RLMCollectionValueForKey(_results, keyPath, *_info);\n    });\n}\n\n- (NSArray *)_distinctUnionOfObjectsForKeyPath:(NSString *)keyPath {\n    return [NSSet setWithArray:[self _unionOfObjectsForKeyPath:keyPath]].allObjects;\n}\n\n- (NSArray *)_unionOfArraysForKeyPath:(NSString *)keyPath {\n    assertKeyPathIsNotNested(keyPath);\n    if ([keyPath isEqualToString:@\"self\"]) {\n        @throw RLMException(@\"self is not a valid key-path for a KVC array collection operator as 'unionOfArrays'.\");\n    }\n\n    return translateErrors([&] {\n        NSMutableArray *flatArray = [NSMutableArray new];\n        for (id<NSFastEnumeration> array in RLMCollectionValueForKey(_results, keyPath, *_info)) {\n            for (id value in array) {\n                [flatArray addObject:value];\n            }\n        }\n        return flatArray;\n    });\n}\n\n- (NSArray *)_distinctUnionOfArraysForKeyPath:(__unused NSString *)keyPath {\n    return [NSSet setWithArray:[self _unionOfArraysForKeyPath:keyPath]].allObjects;\n}\n\n- (RLMResults *)objectsWhere:(NSString *)predicateFormat, ... {\n    va_list args;\n    va_start(args, predicateFormat);\n    RLMResults *results = [self objectsWhere:predicateFormat args:args];\n    va_end(args);\n    return results;\n}\n\n- (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args {\n    return [self objectsWithPredicate:[NSPredicate predicateWithFormat:predicateFormat arguments:args]];\n}\n\n- (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate {\n    return translateErrors([&] {\n        if (_results.get_mode() == Results::Mode::Empty) {\n            return self;\n        }\n        if (_results.get_type() != realm::PropertyType::Object) {\n            @throw RLMException(@\"Querying is currently only implemented for arrays of Realm Objects\");\n        }\n        auto query = RLMPredicateToQuery(predicate, _info->rlmObjectSchema, _realm.schema, _realm.group);\n        return [self subresultsWithResults:_results.filter(std::move(query))];\n    });\n}\n\n- (RLMResults *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending {\n    return [self sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:keyPath ascending:ascending]]];\n}\n\n- (RLMResults *)sortedResultsUsingDescriptors:(NSArray<RLMSortDescriptor *> *)properties {\n    if (properties.count == 0) {\n        return self;\n    }\n    return translateErrors([&] {\n        if (_results.get_mode() == Results::Mode::Empty) {\n            return self;\n        }\n        return [self subresultsWithResults:_results.sort(RLMSortDescriptorsToKeypathArray(properties))];\n    });\n}\n\n- (RLMResults *)distinctResultsUsingKeyPaths:(NSArray<NSString *> *)keyPaths {\n    for (NSString *keyPath in keyPaths) {\n        if ([keyPath rangeOfString:@\"@\"].location != NSNotFound) {\n            @throw RLMException(@\"Cannot distinct on keypath '%@': KVC collection operators are not supported.\", keyPath);\n        }\n    }\n    return translateErrors([&] {\n        if (_results.get_mode() == Results::Mode::Empty) {\n            return self;\n        }\n        \n        std::vector<std::string> keyPathsVector;\n        for (NSString *keyPath in keyPaths) {\n            keyPathsVector.push_back(keyPath.UTF8String);\n        }\n        \n        return [self subresultsWithResults:_results.distinct(keyPathsVector)];\n    });\n}\n\n- (id)objectAtIndexedSubscript:(NSUInteger)index {\n    return [self objectAtIndex:index];\n}\n\n- (id)aggregate:(NSString *)property\n         method:(std::optional<Mixed> (Results::*)(ColKey))method\nreturnNilForEmpty:(BOOL)returnNilForEmpty {\n    if (_results.get_mode() == Results::Mode::Empty) {\n        return returnNilForEmpty ? nil : @0;\n    }\n    ColKey column;\n    if (self.type == RLMPropertyTypeObject || ![property isEqualToString:@\"self\"]) {\n        column = _info->tableColumn(property);\n    }\n\n    auto value = translateErrors([&] { return (_results.*method)(column); });\n    return value ? RLMMixedToObjc(*value) : nil;\n}\n\n- (id)minOfProperty:(NSString *)property {\n    return [self aggregate:property method:&Results::min returnNilForEmpty:YES];\n}\n\n- (id)maxOfProperty:(NSString *)property {\n    return [self aggregate:property method:&Results::max returnNilForEmpty:YES];\n}\n\n- (id)sumOfProperty:(NSString *)property {\n    return [self aggregate:property method:&Results::sum returnNilForEmpty:NO];\n}\n\n- (id)averageOfProperty:(NSString *)property {\n    return [self aggregate:property method:&Results::average returnNilForEmpty:YES];\n}\n\n- (RLMSectionedResults *)sectionedResultsSortedUsingKeyPath:(NSString *)keyPath\n                                                  ascending:(BOOL)ascending\n                                                   keyBlock:(RLMSectionedResultsKeyBlock)keyBlock {\n    return [[RLMSectionedResults alloc] initWithResults:[self sortedResultsUsingKeyPath:keyPath ascending:ascending]\n                                               keyBlock:keyBlock];\n}\n\n- (RLMSectionedResults *)sectionedResultsUsingSortDescriptors:(NSArray<RLMSortDescriptor *> *)sortDescriptors\n                                                     keyBlock:(RLMSectionedResultsKeyBlock)keyBlock {\n    return [[RLMSectionedResults alloc] initWithResults:[self sortedResultsUsingDescriptors:sortDescriptors]\n                                               keyBlock:keyBlock];\n}\n\n- (void)deleteObjectsFromRealm {\n    if (self.type != RLMPropertyTypeObject) {\n        @throw RLMException(@\"Cannot delete objects from RLMResults<%@>: only RLMObjects can be deleted.\",\n                            RLMTypeToString(self.type));\n    }\n    return translateErrors([&] {\n        if (_results.get_mode() == Results::Mode::Table) {\n            RLMResultsValidateInWriteTransaction(self);\n            RLMClearTable(*_info);\n        }\n        else {\n            RLMObservationTracker tracker(_realm, true);\n            _results.clear();\n        }\n    });\n}\n\n- (NSString *)description {\n    return RLMDescriptionWithMaxDepth(@\"RLMResults\", self, RLMDescriptionMaxDepth);\n}\n\n- (realm::TableView)tableView {\n    return translateErrors([&] { return _results.get_tableview(); });\n}\n\n- (RLMFastEnumerator *)fastEnumerator {\n    return translateErrors([&] {\n        return [[RLMFastEnumerator alloc] initWithResults:_results\n                                               collection:self\n                                                classInfo:*_info];\n    });\n}\n\n- (RLMResults *)snapshot {\n    return translateErrors([&] {\n        return [self subresultsWithResults:_results.snapshot()];\n    });\n}\n\n- (BOOL)isFrozen {\n    return _realm.frozen;\n}\n\n- (instancetype)resolveInRealm:(RLMRealm *)realm {\n    return translateErrors([&] {\n        return [self.class resultsWithObjectInfo:_info->resolve(realm)\n                                         results:_results.freeze(realm->_realm)];\n    });\n}\n\n- (instancetype)freeze {\n    if (self.frozen) {\n        return self;\n    }\n    return [self resolveInRealm:_realm.freeze];\n}\n\n- (instancetype)thaw {\n    if (!self.frozen) {\n        return self;\n    }\n    return [self resolveInRealm:_realm.thaw];\n}\n\n// The compiler complains about the method's argument type not matching due to\n// it not having the generic type attached, but it doesn't seem to be possible\n// to actually include the generic type\n// http://www.openradar.me/radar?id=6135653276319744\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wmismatched-parameter-types\"\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults *, RLMCollectionChange *, NSError *))block {\n    return RLMAddNotificationBlock(self, block, nil, nil);\n}\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults *, RLMCollectionChange *, NSError *))block queue:(dispatch_queue_t)queue {\n    return RLMAddNotificationBlock(self, block, nil, queue);\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults *, RLMCollectionChange *, NSError *))block keyPaths:(NSArray<NSString *> *)keyPaths {\n    return RLMAddNotificationBlock(self, block, keyPaths, nil);\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults *, RLMCollectionChange *, NSError *))block\n                                      keyPaths:(NSArray<NSString *> *)keyPaths\n                                         queue:(dispatch_queue_t)queue {\n    return RLMAddNotificationBlock(self, block, keyPaths, queue);\n}\n#pragma clang diagnostic pop\n\n- (realm::NotificationToken)addNotificationCallback:(id)block\nkeyPaths:(std::optional<std::vector<std::vector<std::pair<realm::TableKey, realm::ColKey>>>>&&)keyPaths {\n    return _results.add_notification_callback(RLMWrapCollectionChangeCallback(block, self, true), std::move(keyPaths));\n}\n\n- (BOOL)isAttached {\n    return !!_realm;\n}\n\n#pragma mark - Thread Confined Protocol Conformance\n\n- (realm::ThreadSafeReference)makeThreadSafeReference {\n    return _results;\n}\n\n- (id)objectiveCMetadata {\n    return nil;\n}\n\n+ (instancetype)objectWithThreadSafeReference:(realm::ThreadSafeReference)reference\n                                     metadata:(__unused id)metadata\n                                        realm:(RLMRealm *)realm {\n    auto results = reference.resolve<Results>(realm->_realm);\n    return [RLMResults resultsWithObjectInfo:realm->_info[RLMStringDataToNSString(results.get_object_type())]\n                                     results:std::move(results)];\n}\n\n@end\n\n@implementation RLMLinkingObjects\n- (NSString *)description {\n    return RLMDescriptionWithMaxDepth(@\"RLMLinkingObjects\", self, RLMDescriptionMaxDepth);\n}\n@end\n"
  },
  {
    "path": "Realm/RLMResults_Private.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMResults.h>\n\n#import \"RLMRealm_Private.h\"\n\n@class RLMObjectSchema;\n\nRLM_HEADER_AUDIT_BEGIN(nullability)\n\n@interface RLMResults ()\n@property (nonatomic, readonly, getter=isAttached) BOOL attached;\n\n+ (instancetype)emptyDetachedResults;\n- (RLMResults *)snapshot;\n@end\n\nRLM_HEADER_AUDIT_END(nullability)\n"
  },
  {
    "path": "Realm/RLMResults_Private.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2017 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMResults_Private.h\"\n\n#import \"RLMCollection_Private.hpp\"\n\n#import <realm/object-store/results.hpp>\n\nclass RLMClassInfo;\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@interface RLMResults () <RLMCollectionPrivate> {\n@public\n    realm::Results _results;\n}\n\n/**\n Initialize a 'raw' `RLMResults` using only an object store level Results.\n This is only meant for applications where a results collection is being backed\n by an object store object class that has no binding-level equivalent. The\n consumer is responsible for bridging between the underlying objects and whatever\n binding-level class is being vended out.\n */\n- (instancetype)initWithResults:(realm::Results)results;\n\n- (instancetype)initWithObjectInfo:(RLMClassInfo&)info results:(realm::Results&&)results;\n+ (instancetype)resultsWithObjectInfo:(RLMClassInfo&)info results:(realm::Results&&)results;\n\n- (instancetype)subresultsWithResults:(realm::Results)results;\n- (RLMClassInfo *)objectInfo;\n- (void)deleteObjectsFromRealm;\n@end\n\n// Utility functions\n\n[[gnu::noinline]]\n[[noreturn]]\nvoid RLMThrowCollectionException(NSString *collectionName);\n\ntemplate<typename Function>\nstatic auto translateCollectionError(Function&& f, NSString *collectionName) {\n    try {\n        return f();\n    }\n    catch (...) {\n        RLMThrowCollectionException(collectionName);\n    }\n}\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMScheduler.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2023 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\n#ifdef __cplusplus\n#include <memory>\nnamespace realm::util {\nclass Scheduler;\n}\n#endif\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n// A serial work queue of some sort which represents a thread-confinement context\n// of some sort which blocks can be invoked inside. Realms are confined to a\n// scheduler, which can be a thread (actually a run loop), a dispatch queue, or\n// an actor. The scheduler ensures that the Realm is only used on one thread at\n// a time, and allows us to dispatch work to the thread where we can access the\n// Realm safely.\nNS_SWIFT_SENDABLE // is immutable\n@interface RLMScheduler : NSObject\n+ (RLMScheduler *)mainRunLoop __attribute__((objc_direct));\n+ (RLMScheduler *)currentRunLoop __attribute__((objc_direct));\n// A scheduler for the given queue if it's non-nil, and currentRunLoop otherwise\n+ (RLMScheduler *)dispatchQueue:(nullable dispatch_queue_t)queue;\n+ (RLMScheduler *)actor:(id)actor invoke:(void (^)(dispatch_block_t))invoke\n                 verify:(void (^)(void))verify;\n\n// Invoke the block on this scheduler. Currently not actually implement for run\n// loop schedulers.\n- (void)invoke:(dispatch_block_t)block;\n\n// Cache key for this scheduler suitable for use with NSMapTable. Only valid\n// when called from the current scheduler.\n- (void *)cacheKey;\n\n- (nullable id)actor;\n\n#ifdef __cplusplus\n// The object store Scheduler corresponding to this scheduler\n- (std::shared_ptr<realm::util::Scheduler>)osScheduler;\n#endif\n@end\n\nFOUNDATION_EXTERN void RLMSetMainActor(id actor);\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMScheduler.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2023 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMScheduler.h\"\n\n#import \"RLMUtil.hpp\"\n\n#include <realm/object-store/util/scheduler.hpp>\n\n@interface RLMMainRunLoopScheduler : RLMScheduler\n@end\n\nRLM_HIDDEN\n@implementation RLMMainRunLoopScheduler\n- (std::shared_ptr<realm::util::Scheduler>)osScheduler {\n    return realm::util::Scheduler::make_runloop(CFRunLoopGetMain());\n}\n\n- (void *)cacheKey {\n    // The main thread and main queue share a cache key of `std::numeric_limits<uintptr_t>::max()`\n    // so that they give the same instance. Other Realms are keyed on either the thread or the queue.\n    // Note that despite being a void* the cache key is not actually a pointer;\n    // this is just an artifact of NSMapTable's strange API.\n    return reinterpret_cast<void *>(std::numeric_limits<uintptr_t>::max());\n}\n\n// We can't access MainActor.shared directly from obj-c and need to set it from\n// Swift. The locking here is _almost_ unnecessary as this is set from a static\n// initializer before the value can ever be read, but mixed use of the obj-c and\n// Swift APIs could potentially race on the read.\nstatic auto& g_mainActorLock = *new RLMUnfairMutex;\nstatic id g_mainActor;\nvoid RLMSetMainActor(id actor) {\n    std::lock_guard lock(g_mainActorLock);\n    g_mainActor = actor;\n}\n- (id)actor {\n    std::lock_guard lock(g_mainActorLock);\n    return g_mainActor;\n}\n\n- (void)invoke:(dispatch_block_t)block {\n    dispatch_async(dispatch_get_main_queue(), block);\n}\n@end\n\n@interface RLMDispatchQueueScheduler : RLMScheduler\n@end\n\nRLM_HIDDEN\n@implementation RLMDispatchQueueScheduler {\n    dispatch_queue_t _queue;\n}\n\n- (instancetype)initWithQueue:(dispatch_queue_t)queue {\n    if (self = [super init]) {\n        _queue = queue;\n    }\n    return self;\n}\n\n- (void)invoke:(dispatch_block_t)block {\n    dispatch_async(_queue, block);\n}\n\n- (std::shared_ptr<realm::util::Scheduler>)osScheduler {\n    if (_queue == dispatch_get_main_queue()) {\n        return RLMScheduler.mainRunLoop.osScheduler;\n    }\n    return realm::util::Scheduler::make_dispatch((__bridge void *)_queue);\n}\n\n- (void *)cacheKey {\n    if (_queue == dispatch_get_main_queue()) {\n        return RLMScheduler.mainRunLoop.cacheKey;\n    }\n    return (__bridge void *)_queue;\n}\n@end\n\nnamespace {\nclass ActorScheduler final : public realm::util::Scheduler {\npublic:\n    ActorScheduler(void (^invoke)(dispatch_block_t), dispatch_block_t verify)\n    : _invoke(invoke) , _verify(verify) {}\n\n    void invoke(realm::util::UniqueFunction<void()>&& fn) override {\n        auto ptr = fn.release();\n        _invoke(^{\n            realm::util::UniqueFunction<void()> fn(ptr);\n            fn();\n        });\n    }\n\n    // This currently isn't actually implementable, but fortunately is only used\n    // to report errors when we aren't on the thread, so triggering the actor\n    // data race detection is good enough.\n    bool is_on_thread() const noexcept override {\n        _verify();\n        return true;\n    }\n\n    // This is used for OS Realm caching, which we don't use (as we have our own cache)\n    bool is_same_as(const Scheduler *) const noexcept override {\n        REALM_UNREACHABLE();\n    }\n\n    // Actor isolated Realms can always invoke blocks\n    bool can_invoke() const noexcept override {\n        return true;\n    }\n\nprivate:\n    void (^_invoke)(dispatch_block_t);\n    dispatch_block_t _verify;\n};\n}\n\n@interface RLMActorScheduler : RLMScheduler\n@end\n\nRLM_HIDDEN\n@implementation RLMActorScheduler {\n    id _actor;\n    void (^_invoke)(dispatch_block_t);\n    void (^_verify)();\n}\n\n- (instancetype)initWithActor:(id)actor invoke:(void (^)(dispatch_block_t))invoke verify:(void (^)())verify {\n    if (self = [super init]) {\n        _actor = actor;\n        _invoke = invoke;\n        _verify = verify;\n    }\n    return self;\n}\n\n- (void)invoke:(dispatch_block_t)block {\n    _invoke(block);\n}\n\n- (std::shared_ptr<realm::util::Scheduler>)osScheduler {\n    return std::make_shared<ActorScheduler>(_invoke, _verify);\n}\n\n- (void *)cacheKey {\n    return (__bridge void *)_actor;\n}\n\n- (id)actor {\n    return _actor;\n}\n@end\n\n@implementation RLMScheduler\n+ (RLMScheduler *)currentRunLoop {\n    if (pthread_main_np()) {\n        return RLMScheduler.mainRunLoop;\n    }\n\n    static RLMScheduler *currentRunLoopScheduler = [[RLMScheduler alloc] init];\n    return currentRunLoopScheduler;\n}\n\n+ (RLMScheduler *)mainRunLoop {\n    static RLMScheduler *mainRunLoopScheduler = [[RLMMainRunLoopScheduler alloc] init];\n    return mainRunLoopScheduler;\n}\n\n+ (RLMScheduler *)dispatchQueue:(dispatch_queue_t)queue {\n    if (queue) {\n        return [[RLMDispatchQueueScheduler alloc] initWithQueue:queue];\n    }\n    return RLMScheduler.currentRunLoop;\n}\n\n+ (RLMScheduler *)actor:(id)actor invoke:(void (^)(dispatch_block_t))invoke verify:(void (^)())verify {\n    auto mainRunLoopScheduler = RLMScheduler.mainRunLoop;\n    if (actor == mainRunLoopScheduler.actor) {\n        return mainRunLoopScheduler;\n    }\n    return [[RLMActorScheduler alloc] initWithActor:actor invoke:invoke verify:verify];\n}\n\n- (void)invoke:(dispatch_block_t)block {\n    // Currently not used or needed for run loops\n    REALM_UNREACHABLE();\n}\n\n- (std::shared_ptr<realm::util::Scheduler>)osScheduler {\n    // For normal thread-confined Realms we let object store create the scheduler\n    return nullptr;\n}\n\n- (void *)cacheKey {\n    return pthread_self();\n}\n\n- (id)actor {\n    return nil;\n}\n@end\n"
  },
  {
    "path": "Realm/RLMSchema.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@class RLMObjectSchema;\n\n/**\n `RLMSchema` instances represent collections of model object schemas managed by a Realm.\n\n When using Realm, `RLMSchema` instances allow performing migrations and\n introspecting the database's schema.\n\n Schemas map to collections of tables in the core database.\n */\nNS_SWIFT_SENDABLE // not actually immutable, but the public API kinda is\n@interface RLMSchema : NSObject<NSCopying>\n\n#pragma mark - Properties\n\n/**\n An `NSArray` containing `RLMObjectSchema`s for all object types in the Realm.\n\n This property is intended to be used during migrations for dynamic introspection.\n\n @see `RLMObjectSchema`\n */\n@property (nonatomic, readonly, copy) NSArray<RLMObjectSchema *> *objectSchema;\n\n#pragma mark - Methods\n\n/**\n Returns an `RLMObjectSchema` for the given class name in the schema.\n\n @param className   The object class name.\n @return            An `RLMObjectSchema` for the given class in the schema.\n\n @see               `RLMObjectSchema`\n */\n- (nullable RLMObjectSchema *)schemaForClassName:(NSString *)className;\n\n/**\n Looks up and returns an `RLMObjectSchema` for the given class name in the Realm.\n\n If there is no object of type `className` in the schema, an exception will be thrown.\n\n @param className   The object class name.\n @return            An `RLMObjectSchema` for the given class in this Realm.\n\n @see               `RLMObjectSchema`\n */\n- (RLMObjectSchema *)objectForKeyedSubscript:(NSString *)className;\n\n/**\n Returns whether two `RLMSchema` instances are equivalent.\n */\n- (BOOL)isEqualToSchema:(RLMSchema *)schema;\n\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMSchema.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMSchema_Private.hpp\"\n\n#import \"RLMAccessor.h\"\n#import \"RLMObjectBase_Private.h\"\n#import \"RLMObject_Private.hpp\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMSwiftSupport.h\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/group.hpp>\n#import <realm/object-store/object_schema.hpp>\n#import <realm/object-store/object_store.hpp>\n#import <realm/object-store/schema.hpp>\n#import <realm/util/scope_exit.hpp>\n\n#import <mutex>\n#import <objc/runtime.h>\n\nusing namespace realm;\n\nconst uint64_t RLMNotVersioned = realm::ObjectStore::NotVersioned;\n\n// RLMSchema private properties\n@interface RLMSchema ()\n@property (nonatomic, readwrite) NSMutableDictionary *objectSchemaByName;\n@end\n\n// Private RLMSchema subclass that skips class registration on lookup\n@interface RLMPrivateSchema : RLMSchema\n@end\n@implementation RLMPrivateSchema\n- (RLMObjectSchema *)schemaForClassName:(NSString *)className {\n    return self.objectSchemaByName[className];\n}\n\n- (RLMObjectSchema *)objectForKeyedSubscript:(__unsafe_unretained NSString *const)className {\n    return [self schemaForClassName:className];\n}\n@end\n\nstatic RLMSchema *s_sharedSchema = [[RLMSchema alloc] init];\nstatic NSMutableDictionary *s_localNameToClass = [[NSMutableDictionary alloc] init];\nstatic RLMSchema *s_privateSharedSchema = [[RLMPrivateSchema alloc] init];\n\nstatic enum class SharedSchemaState {\n    Uninitialized,\n    Initializing,\n    Initialized\n} s_sharedSchemaState = SharedSchemaState::Uninitialized;\n\n@implementation RLMSchema {\n    NSArray *_objectSchema;\n    realm::Schema _objectStoreSchema;\n}\n\nstatic void createAccessors(RLMObjectSchema *objectSchema) {\n    constexpr const size_t bufferSize\n        = sizeof(\"RLM:Managed  \") // includes spot for null terminator\n        + std::numeric_limits<unsigned long long>::digits10\n        + realm::Group::max_table_name_length;\n\n    char className[bufferSize] = \"RLM:Managed \";\n    char *const start = className + strlen(className);\n\n    static unsigned long long count = 0;\n    snprintf(start, bufferSize - strlen(className),\n             \"%llu %s\", count++, objectSchema.className.UTF8String);\n    objectSchema.accessorClass = RLMManagedAccessorClassForObjectClass(objectSchema.objectClass, objectSchema, className);\n    objectSchema.unmanagedClass = RLMUnmanagedAccessorClassForObjectClass(objectSchema.objectClass, objectSchema);\n}\n\nvoid RLMSchemaEnsureAccessorsCreated(RLMSchema *schema) {\n    for (RLMObjectSchema *objectSchema in schema.objectSchema) {\n        if (objectSchema.accessorClass == objectSchema.objectClass) {\n            // Locking inside the loop to optimize for the common case at\n            // the expense of worse perf in the rare scenario where this is\n            // actually needed.\n            @synchronized(s_localNameToClass) {\n                createAccessors(objectSchema);\n            }\n        }\n    }\n}\n\n// Caller must @synchronize on s_localNameToClass\nstatic RLMObjectSchema *registerClass(Class cls) {\n    if (RLMObjectSchema *schema = s_privateSharedSchema[[cls className]]) {\n        return schema;\n    }\n\n    auto prevState = s_sharedSchemaState;\n    s_sharedSchemaState = SharedSchemaState::Initializing;\n    RLMObjectSchema *schema;\n    {\n        util::ScopeExit cleanup([&]() noexcept {\n            s_sharedSchemaState = prevState;\n        });\n        schema = [RLMObjectSchema schemaForObjectClass:cls];\n    }\n\n    createAccessors(schema);\n    // override sharedSchema class methods for performance\n    RLMReplaceSharedSchemaMethod(cls, schema);\n\n    s_privateSharedSchema.objectSchemaByName[schema.className] = schema;\n    if ([cls shouldIncludeInDefaultSchema] && prevState != SharedSchemaState::Initialized) {\n        s_sharedSchema.objectSchemaByName[schema.className] = schema;\n    }\n\n    return schema;\n}\n\n// Caller must @synchronize on s_localNameToClass\nstatic void RLMRegisterClassLocalNames(Class *classes, NSUInteger count) {\n    for (NSUInteger i = 0; i < count; i++) {\n        Class cls = classes[i];\n        if (!RLMIsObjectSubclass(cls)) {\n            continue;\n        }\n        if ([cls _realmIgnoreClass]) {\n            continue;\n        }\n\n        NSString *className = NSStringFromClass(cls);\n        if ([className hasPrefix:@\"RLM:\"] || [className hasPrefix:@\"NSKVONotifying\"]) {\n            continue;\n        }\n\n        if ([RLMSwiftSupport isSwiftClassName:className]) {\n            className = [RLMSwiftSupport demangleClassName:className];\n        }\n        // NSStringFromClass demangles the names for top-level Swift classes\n        // but not for nested classes. _T indicates it's a Swift symbol, t\n        // indicates it's a type, and C indicates it's a class.\n        else if ([className hasPrefix:@\"_TtC\"]) {\n            @throw RLMException(@\"Object subclass '%@' must explicitly set the class's objective-c name with @objc(ClassName) because it is not a top-level public class.\", className);\n        }\n\n        if (Class existingClass = s_localNameToClass[className]) {\n            if (existingClass != cls) {\n                @throw RLMException(@\"RLMObject subclasses with the same name cannot be included twice in the same target. \"\n                                    @\"Please make sure '%@' is only linked once to your current target.\", className);\n            }\n            continue;\n        }\n\n        s_localNameToClass[className] = cls;\n        RLMReplaceClassNameMethod(cls, className);\n    }\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        _objectSchemaByName = [[NSMutableDictionary alloc] init];\n    }\n    return self;\n}\n\n- (NSArray *)objectSchema {\n    if (!_objectSchema) {\n        _objectSchema = [_objectSchemaByName allValues];\n    }\n    return _objectSchema;\n}\n\n- (void)setObjectSchema:(NSArray *)objectSchema {\n    _objectSchema = objectSchema;\n    _objectSchemaByName = [NSMutableDictionary dictionaryWithCapacity:objectSchema.count];\n    for (RLMObjectSchema *object in objectSchema) {\n        [_objectSchemaByName setObject:object forKey:object.className];\n    }\n}\n\n- (RLMObjectSchema *)schemaForClassName:(NSString *)className {\n    if (RLMObjectSchema *schema = _objectSchemaByName[className]) {\n        return schema; // fast path for already-initialized schemas\n    } else if (Class cls = [RLMSchema classForString:className]) {\n        [cls sharedSchema];                    // initialize the schema\n        return _objectSchemaByName[className]; // try again\n    } else {\n        return nil;\n    }\n}\n\n- (RLMObjectSchema *)objectForKeyedSubscript:(__unsafe_unretained NSString *const)className {\n    RLMObjectSchema *schema = [self schemaForClassName:className];\n    if (!schema) {\n        @throw RLMException(@\"Object type '%@' not managed by the Realm\", className);\n    }\n    return schema;\n}\n\n+ (instancetype)schemaWithObjectClasses:(NSArray *)classes {\n    NSUInteger count = classes.count;\n    auto classArray = std::make_unique<__unsafe_unretained Class[]>(count);\n    [classes getObjects:classArray.get() range:NSMakeRange(0, count)];\n\n    RLMSchema *schema = [[self alloc] init];\n    @synchronized(s_localNameToClass) {\n        RLMRegisterClassLocalNames(classArray.get(), count);\n\n        schema->_objectSchemaByName = [NSMutableDictionary dictionaryWithCapacity:count];\n        for (Class cls in classes) {\n            if (!RLMIsObjectSubclass(cls)) {\n                @throw RLMException(@\"Can't add non-Object type '%@' to a schema.\", cls);\n            }\n            schema->_objectSchemaByName[[cls className]] = registerClass(cls);\n        }\n    }\n\n    NSMutableArray *errors = [NSMutableArray new];\n    // Verify that all of the targets of links are included in the class list\n    [schema->_objectSchemaByName enumerateKeysAndObjectsUsingBlock:^(id, RLMObjectSchema *objectSchema, BOOL *) {\n        for (RLMProperty *prop in objectSchema.properties) {\n            if (prop.type != RLMPropertyTypeObject) {\n                continue;\n            }\n            if (!schema->_objectSchemaByName[prop.objectClassName]) {\n                [errors addObject:[NSString stringWithFormat:@\"- '%@.%@' links to class '%@', which is missing from the list of classes managed by the Realm\", objectSchema.className, prop.name, prop.objectClassName]];\n            }\n        }\n    }];\n    if (errors.count) {\n        @throw RLMException(@\"Invalid class subset list:\\n%@\", [errors componentsJoinedByString:@\"\\n\"]);\n    }\n\n    return schema;\n}\n\n+ (RLMObjectSchema *)sharedSchemaForClass:(Class)cls {\n    @synchronized(s_localNameToClass) {\n        // We create instances of Swift objects during schema init, and they\n        // obviously need to not also try to initialize the schema\n        if (s_sharedSchemaState == SharedSchemaState::Initializing) {\n            return nil;\n        }\n        // Don't register the base classes in the schema even if someone calls\n        // sharedSchema on them directly\n        if (cls == [RLMObjectBase class] || class_getSuperclass(cls) == [RLMObjectBase class]) {\n            return nil;\n        }\n\n        RLMRegisterClassLocalNames(&cls, 1);\n        RLMObjectSchema *objectSchema = registerClass(cls);\n        [cls initializeLinkedObjectSchemas];\n        return objectSchema;\n    }\n}\n\n+ (instancetype)partialSharedSchema {\n    return s_sharedSchema;\n}\n\n+ (instancetype)partialPrivateSharedSchema {\n    return s_privateSharedSchema;\n}\n\n// schema based on runtime objects\n+ (instancetype)sharedSchema {\n    @synchronized(s_localNameToClass) {\n        // We replace this method with one which just returns s_sharedSchema\n        // once initialization is complete, but we still need to check if it's\n        // already complete because it may have been done by another thread\n        // while we were waiting for the lock\n        if (s_sharedSchemaState == SharedSchemaState::Initialized) {\n            return s_sharedSchema;\n        }\n\n        if (s_sharedSchemaState == SharedSchemaState::Initializing) {\n            @throw RLMException(@\"Illegal recursive call of +[%@ %@]. Note: Properties of Swift `Object` classes must not be prepopulated with queried results from a Realm.\", self, NSStringFromSelector(_cmd));\n        }\n\n        s_sharedSchemaState = SharedSchemaState::Initializing;\n        try {\n            // Make sure we've discovered all classes\n            {\n                unsigned int numClasses;\n                using malloc_ptr = std::unique_ptr<__unsafe_unretained Class[], decltype(&free)>;\n                malloc_ptr classes(objc_copyClassList(&numClasses), &free);\n                RLMRegisterClassLocalNames(classes.get(), numClasses);\n            }\n\n            [s_localNameToClass enumerateKeysAndObjectsUsingBlock:^(NSString *, Class cls, BOOL *) {\n                registerClass(cls);\n            }];\n        }\n        catch (...) {\n            s_sharedSchemaState = SharedSchemaState::Uninitialized;\n            throw;\n        }\n\n        // Replace this method with one that doesn't need to acquire a lock\n        Class metaClass = objc_getMetaClass(class_getName(self));\n        IMP imp = imp_implementationWithBlock(^{ return s_sharedSchema; });\n        class_replaceMethod(metaClass, @selector(sharedSchema), imp, \"@@:\");\n\n        s_sharedSchemaState = SharedSchemaState::Initialized;\n    }\n\n    return s_sharedSchema;\n}\n\n// schema based on tables in a realm\n+ (instancetype)dynamicSchemaFromObjectStoreSchema:(Schema const&)objectStoreSchema {\n    // cache descriptors for all subclasses of RLMObject\n    NSMutableArray *schemaArray = [NSMutableArray arrayWithCapacity:objectStoreSchema.size()];\n    for (auto &objectSchema : objectStoreSchema) {\n        RLMObjectSchema *schema = [RLMObjectSchema objectSchemaForObjectStoreSchema:objectSchema];\n        [schemaArray addObject:schema];\n    }\n\n    // set class array and mapping\n    RLMSchema *schema = [RLMSchema new];\n    schema.objectSchema = schemaArray;\n    return schema;\n}\n\n+ (Class)classForString:(NSString *)className {\n    if (Class cls = s_localNameToClass[className]) {\n        return cls;\n    }\n\n    if (Class cls = NSClassFromString(className)) {\n        return RLMIsObjectSubclass(cls) ? cls : nil;\n    }\n\n    // className might be the local name of a Swift class we haven't registered\n    // yet, so scan them all then recheck\n    {\n        unsigned int numClasses;\n        std::unique_ptr<__unsafe_unretained Class[], decltype(&free)> classes(objc_copyClassList(&numClasses), &free);\n        RLMRegisterClassLocalNames(classes.get(), numClasses);\n    }\n\n    return s_localNameToClass[className];\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    RLMSchema *schema = [[RLMSchema allocWithZone:zone] init];\n    schema->_objectSchemaByName = [[NSMutableDictionary allocWithZone:zone]\n                                   initWithDictionary:_objectSchemaByName copyItems:YES];\n    return schema;\n}\n\n- (BOOL)isEqualToSchema:(RLMSchema *)schema {\n    if (_objectSchemaByName.count != schema->_objectSchemaByName.count) {\n        return NO;\n    }\n    __block BOOL matches = YES;\n    [_objectSchemaByName enumerateKeysAndObjectsUsingBlock:^(NSString *name, RLMObjectSchema *objectSchema, BOOL *stop) {\n        if (![schema->_objectSchemaByName[name] isEqualToObjectSchema:objectSchema]) {\n            *stop = YES;\n            matches = NO;\n        }\n    }];\n    return matches;\n}\n\n- (NSString *)description {\n    NSMutableString *objectSchemaString = [NSMutableString string];\n    NSArray *sort = @[[NSSortDescriptor sortDescriptorWithKey:@\"className\" ascending:YES]];\n    for (RLMObjectSchema *objectSchema in [self.objectSchema sortedArrayUsingDescriptors:sort]) {\n        [objectSchemaString appendFormat:@\"\\t%@\\n\",\n         [objectSchema.description stringByReplacingOccurrencesOfString:@\"\\n\" withString:@\"\\n\\t\"]];\n    }\n    return [NSString stringWithFormat:@\"Schema {\\n%@}\", objectSchemaString];\n}\n\n- (Schema)objectStoreCopy {\n    if (_objectStoreSchema.size() == 0) {\n        std::vector<realm::ObjectSchema> schema;\n        schema.reserve(_objectSchemaByName.count);\n        [_objectSchemaByName enumerateKeysAndObjectsUsingBlock:[&](NSString *, RLMObjectSchema *objectSchema, BOOL *) {\n            schema.push_back([objectSchema objectStoreCopy:self]);\n        }];\n\n        // Having both obj-c and Swift classes for the same tables results in\n        // duplicate ObjectSchemas that we need to filter out\n        std::sort(begin(schema), end(schema), [](auto&& a, auto&& b) { return a.name < b.name; });\n        schema.erase(std::unique(begin(schema), end(schema), [](auto&& a, auto&& b) {\n            if (a.name == b.name) {\n                // If we make _realmObjectName public this needs to be turned into an exception\n                REALM_ASSERT_DEBUG(a.persisted_properties == b.persisted_properties);\n                return true;\n            }\n            return false;\n        }), end(schema));\n\n        _objectStoreSchema = std::move(schema);\n    }\n    return _objectStoreSchema;\n}\n\n@end\n"
  },
  {
    "path": "Realm/RLMSchema_Private.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMSchema.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability)\n\n@class RLMRealm;\n\n//\n// RLMSchema private interface\n//\n@interface RLMSchema ()\n\n/**\n Returns an `RLMSchema` containing only the given `RLMObject` subclasses.\n\n @param classes The classes to be included in the schema.\n\n @return An `RLMSchema` containing only the given classes.\n */\n+ (instancetype)schemaWithObjectClasses:(NSArray<Class> *)classes;\n\n@property (nonatomic, readwrite, copy) NSArray<RLMObjectSchema *> *objectSchema;\n\n// schema based on runtime objects\n+ (instancetype)sharedSchema;\n\n// schema based upon all currently registered object classes\n+ (instancetype)partialSharedSchema;\n\n// private schema based upon all currently registered object classes.\n// includes classes that are excluded from the default schema.\n+ (instancetype)partialPrivateSharedSchema;\n\n// class for string\n+ (nullable Class)classForString:(NSString *)className;\n\n+ (nullable RLMObjectSchema *)sharedSchemaForClass:(Class)cls;\n\n@end\n\nRLM_HEADER_AUDIT_END(nullability)\n"
  },
  {
    "path": "Realm/RLMSchema_Private.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMSchema_Private.h\"\n\n#import <memory>\n\nnamespace realm {\n    class Schema;\n    class ObjectSchema;\n}\n\nRLM_DIRECT_MEMBERS\n@interface RLMSchema ()\n+ (instancetype)dynamicSchemaFromObjectStoreSchema:(realm::Schema const&)objectStoreSchema;\n- (realm::Schema)objectStoreCopy;\n@end\n\n// Ensure that all objectSchema in the given schema have managed accessors created.\n// This is normally done during schema discovery but may not be when using\n// dynamically created schemas.\nvoid RLMSchemaEnsureAccessorsCreated(RLMSchema *schema);\n"
  },
  {
    "path": "Realm/RLMSectionedResults.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2022 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMCollection.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@protocol RLMValue;\n@class RLMResults<RLMObjectType>;\n\n/**\n A `RLMSectionedResultsChange` object encapsulates information about changes to sectioned\n results that are reported by Realm notifications.\n\n `RLMSectionedResultsChange` is passed to the notification blocks registered with\n `-addNotificationBlock` on `RLMSectionedResults`, and reports what sections and rows in the\n collection changed since the last time the notification block was called.\n\n A complete example of updating a `UITableView` named `tv`:\n\n     [tv beginUpdates];\n     [tv deleteRowsAtIndexPaths:changes.deletions withRowAnimation:UITableViewRowAnimationAutomatic];\n     [tv insertRowsAtIndexPaths:changes.insertions withRowAnimation:UITableViewRowAnimationAutomatic];\n     [tv reloadRowsAtIndexPaths:changes.modifications withRowAnimation:UITableViewRowAnimationAutomatic];\n     [tv insertSections:changes.sectionsToInsert withRowAnimation:UITableViewRowAnimationAutomatic];\n     [tv deleteSections:changes.sectionsToRemove withRowAnimation:UITableViewRowAnimationAutomatic];\n     [tv endUpdates];\n\n All of the arrays in an `RLMSectionedResultsChange` are always sorted in ascending order.\n */\n@interface RLMSectionedResultsChange : NSObject\n/// The index paths of objects in the previous version of the collection which have\n/// been removed from this one.\n@property (nonatomic, readonly) NSArray<NSIndexPath *> *deletions;\n/// The index paths in the new version of the collection which were newly inserted.\n@property (nonatomic, readonly) NSArray<NSIndexPath *> *insertions;\n/// The index paths in the old version of the collection which were modified.\n@property (nonatomic, readonly) NSArray<NSIndexPath *> *modifications;\n/// The indices of the sections to be inserted.\n@property (nonatomic, readonly) NSIndexSet *sectionsToInsert;\n/// The indices of the sections to be removed.\n@property (nonatomic, readonly) NSIndexSet *sectionsToRemove;\n/// Returns the index paths of the deletion indices in the given section.\n- (NSArray<NSIndexPath *> *)deletionsInSection:(NSUInteger)section;\n/// Returns the index paths of the insertion indices in the given section.\n- (NSArray<NSIndexPath *> *)insertionsInSection:(NSUInteger)section;\n/// Returns the index paths of the modification indices in the given section.\n- (NSArray<NSIndexPath *> *)modificationsInSection:(NSUInteger)section;\n@end\n\n\n/// The `RLMSectionedResult` protocol defines properties and methods common to both `RLMSectionedResults and RLMSection`\n@protocol RLMSectionedResult <NSFastEnumeration, RLMThreadConfined>\n\n#pragma mark - Object Access\n\n/// The count of objects in the collection.\n@property (nonatomic, readonly) NSUInteger count;\n/// Returns the object for a given index in the collection.\n- (id)objectAtIndexedSubscript:(NSUInteger)index;\n/// Returns the object for a given index in the collection.\n- (id)objectAtIndex:(NSUInteger)index;\n\n#pragma mark - Freeze\n\n/**\n Returns a frozen (immutable) snapshot of this collection.\n\n The frozen copy is an immutable collection which contains the same data as this\n collection currently contains, but will not update when writes are made to the\n containing Realm. Unlike live arrays, frozen collections can be accessed from any\n thread.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning Holding onto a frozen collection for an extended period while performing\n          write transaction on the Realm may result in the Realm file growing\n          to large sizes. See `RLMRealmConfiguration.maximumNumberOfActiveVersions`\n          for more information.\n */\n- (instancetype)freeze;\n/**\n Returns a live version of this frozen collection.\n\n This method resolves a reference to a live copy of the same frozen collection.\n If called on a live collection, will return itself.\n*/\n- (instancetype)thaw;\n/**\n Indicates if the underlying collection is frozen.\n\n Frozen collections are immutable and can be accessed from any thread.\n */\n@property (nonatomic, readonly, getter = isFrozen) BOOL frozen;\n\n#pragma mark - Sectioned Results Notifications\n\n/**\n Registers a block to be called each time the collection changes.\n\n The block will be asynchronously called with the initial sectioned results collection,\n and then called again after each write transaction which changes either any\n of the objects in the results, or which objects are in the results.\n\n The `change` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the section were added, removed or modified. If a\n write transaction did not modify any objects in the section,\n the block is not called at all. See the `RLMSectionedResultsChange` documentation for\n information on how the changes are reported and an example of updating a\n `UITableView`.\n\n At the time when the block is called, the `RLMSection` / `RLMSectionedResults` object will be fully\n evaluated and up-to-date.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification. This can include the notification\n with the initial results. For example, the following code performs a write\n transaction immediately after adding the notification block, so there is no\n opportunity for the initial notification to be delivered first. As a\n result, the initial notification will reflect the state of the Realm after\n the write transaction.\n\n    RLMResults<Dog *> *results = [Dog allObjects];\n    RLMSectionedResults<Dog *> *sectionedResults = [results sectionedResultsUsingKeyPath:@\"age\" ascending:YES];\n    self.token = [sectionedResults addNotificationBlock:^(RLMSectionedResults *sectionedResults, RLMSectionedResultsChange *changes) {\n         // Only fired once for the example\n         NSLog(@\"sectionedResults.count: %zu\", sectionedResults.count); // => 1\n     }];\n     [realm transactionWithBlock:^{\n         Dog *dog = [[Dog alloc] init];\n         dog.name = @\"Rex\";\n         dog.age = 5;\n         [realm addObject:dog];\n     }];\n     // end of run loop execution context\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(id<RLMSectionedResult>, RLMSectionedResultsChange *))block __attribute__((warn_unused_result));\n/**\n Registers a block to be called each time the collection changes.\n\n The block will be asynchronously called with the initial sectioned results collection,\n and then called again after each write transaction which changes either any\n of the objects in the results, or which objects are in the results.\n\n The `change` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the section were added, removed or modified. If a\n write transaction did not modify any objects in the section,\n the block is not called at all. See the `RLMSectionedResultsChange` documentation for\n information on how the changes are reported and an example of updating a\n `UITableView`.\n\n At the time when the block is called, the `RLMSection` / `RLMSectionedResults` object will be fully\n evaluated and up-to-date.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification. This can include the notification\n with the initial results. For example, the following code performs a write\n transaction immediately after adding the notification block, so there is no\n opportunity for the initial notification to be delivered first. As a\n result, the initial notification will reflect the state of the Realm after\n the write transaction.\n\n    RLMResults<Dog *> *results = [Dog allObjects];\n    RLMSectionedResults<Dog *> *sectionedResults = [results sectionedResultsUsingKeyPath:@\"age\" ascending:YES];\n    self.token = [sectionedResults addNotificationBlock:^(RLMSectionedResults *sectionedResults, RLMSectionedResultsChange *changes) {\n         // Only fired once for the example\n         NSLog(@\"sectionedResults.count: %zu\", sectionedResults.count); // => 1\n     }];\n     [realm transactionWithBlock:^{\n         Dog *dog = [[Dog alloc] init];\n         dog.name = @\"Rex\";\n         dog.age = 5;\n         [realm addObject:dog];\n     }];\n     // end of run loop execution context\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param queue The serial queue to deliver notifications to.\n\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(id<RLMSectionedResult>, RLMSectionedResultsChange *))block\n                                         queue:(dispatch_queue_t)queue __attribute__((warn_unused_result));\n/**\n Registers a block to be called each time the collection changes.\n\n The block will be asynchronously called with the initial sectioned results collection,\n and then called again after each write transaction which changes either any\n of the objects in the results, or which objects are in the results.\n\n The `change` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the section were added, removed or modified. If a\n write transaction did not modify any objects in the section,\n the block is not called at all. See the `RLMSectionedResultsChange` documentation for\n information on how the changes are reported and an example of updating a\n `UITableView`.\n\n At the time when the block is called, the `RLMSection` / `RLMSectionedResults` object will be fully\n evaluated and up-to-date.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification. This can include the notification\n with the initial results. For example, the following code performs a write\n transaction immediately after adding the notification block, so there is no\n opportunity for the initial notification to be delivered first. As a\n result, the initial notification will reflect the state of the Realm after\n the write transaction.\n\n    RLMResults<Dog *> *results = [Dog allObjects];\n    RLMSectionedResults<Dog *> *sectionedResults = [results sectionedResultsUsingKeyPath:@\"age\" ascending:YES];\n    self.token = [sectionedResults addNotificationBlock:^(RLMSectionedResults *sectionedResults, RLMSectionedResultsChange *changes) {\n         // Only fired once for the example\n         NSLog(@\"sectionedResults.count: %zu\", sectionedResults.count); // => 1\n     }];\n     [realm transactionWithBlock:^{\n         Dog *dog = [[Dog alloc] init];\n         dog.name = @\"Rex\";\n         dog.age = 5;\n         [realm addObject:dog];\n     }];\n     // end of run loop execution context\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param keyPaths The block will be called for changes occurring on these keypaths. If no\n key paths are given, notifications are delivered for every property key path.\n\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(id<RLMSectionedResult>, RLMSectionedResultsChange *))block\n                                      keyPaths:(NSArray<NSString *> *)keyPaths __attribute__((warn_unused_result));\n/**\n Registers a block to be called each time the collection changes.\n\n The block will be asynchronously called with the initial sectioned results collection,\n and then called again after each write transaction which changes either any\n of the objects in the results, or which objects are in the results.\n\n The `change` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the section were added, removed or modified. If a\n write transaction did not modify any objects in the section,\n the block is not called at all. See the `RLMSectionedResultsChange` documentation for\n information on how the changes are reported and an example of updating a\n `UITableView`.\n\n At the time when the block is called, the `RLMSection` / `RLMSectionedResults` object will be fully\n evaluated and up-to-date.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification. This can include the notification\n with the initial results. For example, the following code performs a write\n transaction immediately after adding the notification block, so there is no\n opportunity for the initial notification to be delivered first. As a\n result, the initial notification will reflect the state of the Realm after\n the write transaction.\n\n    RLMResults<Dog *> *results = [Dog allObjects];\n    RLMSectionedResults<Dog *> *sectionedResults = [results sectionedResultsUsingKeyPath:@\"age\" ascending:YES];\n    self.token = [sectionedResults addNotificationBlock:^(RLMSectionedResults *sectionedResults, RLMSectionedResultsChange *changes) {\n         // Only fired once for the example\n         NSLog(@\"sectionedResults.count: %zu\", sectionedResults.count); // => 1\n     }];\n     [realm transactionWithBlock:^{\n         Dog *dog = [[Dog alloc] init];\n         dog.name = @\"Rex\";\n         dog.age = 5;\n         [realm addObject:dog];\n     }];\n     // end of run loop execution context\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning The queue must be a serial queue.\n\n @note When filtering with key paths a notification will be fired in the following scenarios:\n    - An object in the collection has been modified at the filtered properties.\n    - An object has been modified on the section key path property, and the result of that modification has changed it's position in the section, or the object may need to move to another section.\n    - An object of the same observed type has been inserted or deleted from the Realm.\n\n @param block The block to be called whenever a change occurs.\n @param keyPaths The block will be called for changes occurring on these keypaths. If no\n key paths are given, notifications are delivered for every property key path.\n @param queue The serial queue to deliver notifications to.\n\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(id<RLMSectionedResult>, RLMSectionedResultsChange *))block\n                                      keyPaths:(nullable NSArray<NSString *> *)keyPaths\n                                         queue:(nullable dispatch_queue_t)queue __attribute__((warn_unused_result));\n\n@end\n\n/// An RLMSection contains the objects which belong to a specified section key.\n@interface RLMSection<RLMKeyType: id<RLMValue>, RLMObjectType> : NSObject<RLMSectionedResult>\n/// The value that represents the key in this section.\n@property (nonatomic, readonly) RLMKeyType key;\n/// The count of objects in the section.\n@property (nonatomic, readonly) NSUInteger count;\n/// Returns the object for a given index in the section.\n- (RLMObjectType)objectAtIndexedSubscript:(NSUInteger)index;\n/// Returns the object for a given index in the section.\n- (RLMObjectType)objectAtIndex:(NSUInteger)index;\n\n#pragma mark - Freeze\n\n/**\n Returns a frozen (immutable) snapshot of this section.\n\n The frozen copy is an immutable section which contains the same data as this\n section currently contains, but will not update when writes are made to the\n containing Realm. Unlike live arrays, frozen collections can be accessed from any\n thread.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning Holding onto a frozen section for an extended period while performing\n          write transaction on the Realm may result in the Realm file growing\n          to large sizes. See `RLMRealmConfiguration.maximumNumberOfActiveVersions`\n          for more information.\n */\n- (instancetype)freeze;\n/**\n Returns a live version of this frozen section.\n\n This method resolves a reference to a live copy of the same frozen section.\n If called on a live section, will return itself.\n*/\n- (instancetype)thaw;\n/**\n Indicates if the underlying section is frozen.\n\n Frozen sections are immutable and can be accessed from any thread.\n */\n@property (nonatomic, readonly, getter = isFrozen) BOOL frozen;\n\n#pragma mark - Section Notifications\n\n/**\n Registers a block to be called each time the section changes.\n\n The block will be asynchronously called with the initial section,\n and then called again after each write transaction which changes either any\n of the objects in the results, or which objects are in the results.\n\n The `change` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the section were added, removed or modified. If a\n write transaction did not modify any objects in the section,\n the block is not called at all. See the `RLMSectionedResultsChange` documentation for\n information on how the changes are reported and an example of updating a\n `UITableView`.\n\n At the time when the block is called, the `RLMSection` object will be fully\n evaluated and up-to-date.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification. This can include the notification\n with the initial results. For example, the following code performs a write\n transaction immediately after adding the notification block, so there is no\n opportunity for the initial notification to be delivered first. As a\n result, the initial notification will reflect the state of the Realm after\n the write transaction.\n\n    RLMResults<Dog *> *results = [Dog allObjects];\n    RLMSectionedResults<Dog *> *sectionedResults = [results sectionedResultsUsingKeyPath:@\"age\" ascending:YES];\n    RLMSection<Dog *> *section = sectionedResults[0] // section with dogs aged '5' already exists.\n\n    self.token = [section addNotificationBlock:^(RLMSection *section, RLMSectionedResultsChange *changes) {\n         // Only fired once for the example\n         NSLog(@\"section.count: %zu\", section.count); // => 2\n     }];\n     [realm transactionWithBlock:^{\n         Dog *dog = [[Dog alloc] init];\n         dog.name = @\"Rex\";\n         dog.age = 5;\n         [realm addObject:dog];\n     }];\n     // end of run loop execution context\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMSection<RLMKeyType, RLMObjectType> *, RLMSectionedResultsChange *))block __attribute__((warn_unused_result));\n/**\n Registers a block to be called each time the section changes.\n\n The block will be asynchronously called with the initial section,\n and then called again after each write transaction which changes either any\n of the objects in the results, or which objects are in the results.\n\n The `change` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the section were added, removed or modified. If a\n write transaction did not modify any objects in the section,\n the block is not called at all. See the `RLMSectionedResultsChange` documentation for\n information on how the changes are reported and an example of updating a\n `UITableView`.\n\n At the time when the block is called, the `RLMSection` object will be fully\n evaluated and up-to-date.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification. This can include the notification\n with the initial results. For example, the following code performs a write\n transaction immediately after adding the notification block, so there is no\n opportunity for the initial notification to be delivered first. As a\n result, the initial notification will reflect the state of the Realm after\n the write transaction.\n\n    RLMResults<Dog *> *results = [Dog allObjects];\n    RLMSectionedResults<Dog *> *sectionedResults = [results sectionedResultsUsingKeyPath:@\"age\" ascending:YES];\n    RLMSection<Dog *> *section = sectionedResults[0] // section with dogs aged '5' already exists.\n\n    self.token = [section addNotificationBlock:^(RLMSection *section, RLMSectionedResultsChange *changes) {\n         // Only fired once for the example\n         NSLog(@\"section.count: %zu\", section.count); // => 2\n     }];\n     [realm transactionWithBlock:^{\n         Dog *dog = [[Dog alloc] init];\n         dog.name = @\"Rex\";\n         dog.age = 5;\n         [realm addObject:dog];\n     }];\n     // end of run loop execution context\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param queue The serial queue to deliver notifications to.\n\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMSection<RLMKeyType, RLMObjectType> *, RLMSectionedResultsChange *))block\n                                         queue:(dispatch_queue_t)queue __attribute__((warn_unused_result));\n/**\n Registers a block to be called each time the section changes.\n\n The block will be asynchronously called with the initial section,\n and then called again after each write transaction which changes either any\n of the objects in the results, or which objects are in the results.\n\n The `change` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the section were added, removed or modified. If a\n write transaction did not modify any objects in the section,\n the block is not called at all. See the `RLMSectionedResultsChange` documentation for\n information on how the changes are reported and an example of updating a\n `UITableView`.\n\n At the time when the block is called, the `RLMSection` object will be fully\n evaluated and up-to-date.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification. This can include the notification\n with the initial results. For example, the following code performs a write\n transaction immediately after adding the notification block, so there is no\n opportunity for the initial notification to be delivered first. As a\n result, the initial notification will reflect the state of the Realm after\n the write transaction.\n\n    RLMResults<Dog *> *results = [Dog allObjects];\n    RLMSectionedResults<Dog *> *sectionedResults = [results sectionedResultsUsingKeyPath:@\"age\" ascending:YES];\n    RLMSection<Dog *> *section = sectionedResults[0] // section with dogs aged '5' already exists.\n\n    self.token = [section addNotificationBlock:^(RLMSection *section, RLMSectionedResultsChange *changes) {\n         // Only fired once for the example\n         NSLog(@\"section.count: %zu\", section.count); // => 2\n     }];\n     [realm transactionWithBlock:^{\n         Dog *dog = [[Dog alloc] init];\n         dog.name = @\"Rex\";\n         dog.age = 5;\n         [realm addObject:dog];\n     }];\n     // end of run loop execution context\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning The queue must be a serial queue.\n\n @note When filtering with key paths a notification will be fired in the following scenarios:\n    - An object in the collection has been modified at the filtered properties.\n    - An object has been modified on the section key path property, and the result of that modification has changed it's position in the section, or the object may need to move to another section.\n    - An object of the same observed type has been inserted or deleted from the Realm.\n\n @param block The block to be called whenever a change occurs.\n @param keyPaths The block will be called for changes occurring on these keypaths. If no\n key paths are given, notifications are delivered for every property key path.\n\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMSection<RLMKeyType, RLMObjectType> *, RLMSectionedResultsChange *))block\n                                      keyPaths:(NSArray<NSString *> *)keyPaths __attribute__((warn_unused_result));\n/**\n Registers a block to be called each time the section changes.\n\n The block will be asynchronously called with the initial section,\n and then called again after each write transaction which changes either any\n of the objects in the results, or which objects are in the results.\n\n The `change` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the section were added, removed or modified. If a\n write transaction did not modify any objects in the section,\n the block is not called at all. See the `RLMSectionedResultsChange` documentation for\n information on how the changes are reported and an example of updating a\n `UITableView`.\n\n At the time when the block is called, the `RLMSection` object will be fully\n evaluated and up-to-date.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification. This can include the notification\n with the initial results. For example, the following code performs a write\n transaction immediately after adding the notification block, so there is no\n opportunity for the initial notification to be delivered first. As a\n result, the initial notification will reflect the state of the Realm after\n the write transaction.\n\n    RLMResults<Dog *> *results = [Dog allObjects];\n    RLMSectionedResults<Dog *> *sectionedResults = [results sectionedResultsUsingKeyPath:@\"age\" ascending:YES];\n    RLMSection<Dog *> *section = sectionedResults[0] // section with dogs aged '5' already exists.\n\n    self.token = [section addNotificationBlock:^(RLMSection *section, RLMSectionedResultsChange *changes) {\n         // Only fired once for the example\n         NSLog(@\"section.count: %zu\", section.count); // => 2\n     }];\n     [realm transactionWithBlock:^{\n         Dog *dog = [[Dog alloc] init];\n         dog.name = @\"Rex\";\n         dog.age = 5;\n         [realm addObject:dog];\n     }];\n     // end of run loop execution context\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning The queue must be a serial queue.\n\n @note When filtering with key paths a notification will be fired in the following scenarios:\n    - An object in the collection has been modified at the filtered properties.\n    - An object has been modified on the section key path property, and the result of that modification has changed it's position in the section, or the object may need to move to another section.\n    - An object of the same observed type has been inserted or deleted from the Realm.\n\n @param block The block to be called whenever a change occurs.\n @param keyPaths The block will be called for changes occurring on these keypaths. If no\n key paths are given, notifications are delivered for every property key path.\n @param queue The serial queue to deliver notifications to.\n\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMSection<RLMKeyType, RLMObjectType> *, RLMSectionedResultsChange *))block\n                                      keyPaths:(nullable NSArray<NSString *> *)keyPaths\n                                         queue:(nullable dispatch_queue_t)queue __attribute__((warn_unused_result));\n@end\n\n/// A lazily evaluated collection that holds elements in sections determined by a section key.\n@interface RLMSectionedResults<RLMKeyType: id<RLMValue>, RLMObjectType: id<RLMValue>> : NSObject<RLMSectionedResult>\n/// An array of all keys in the sectioned results collection.\n@property (nonatomic) NSArray<RLMKeyType> *allKeys;\n/// The total amount of sections in this collection.\n@property (nonatomic, readonly, assign) NSUInteger count;\n/// Returns the section at a given index.\n- (RLMSection<RLMKeyType, RLMObjectType> *)objectAtIndexedSubscript:(NSUInteger)index;\n/// Returns the section at a given index.\n- (RLMSection<RLMKeyType, RLMObjectType> *)objectAtIndex:(NSUInteger)index;\n\n#pragma mark - Freeze\n\n/**\n Returns a frozen (immutable) snapshot of this sectioned results collection.\n\n The frozen copy is an immutable sectioned results collection which contains the same data as this\n sectioned results collection currently contains, but will not update when writes are made to the\n containing Realm. Unlike live sectioned results collections, frozen sectioned results collection\n can be accessed from any thread.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning Holding onto a frozen sectioned results collection for an extended period while performing\n          write transaction on the Realm may result in the Realm file growing\n          to large sizes. See `RLMRealmConfiguration.maximumNumberOfActiveVersions`\n          for more information.\n */\n- (instancetype)freeze;\n/**\n Returns a live version of this frozen sectioned results collection.\n\n This method resolves a reference to a live copy of the same frozen sectioned results collection.\n If called on a live section, will return itself.\n*/\n- (instancetype)thaw;\n/**\n Indicates if the underlying sectioned results collection is frozen.\n\n Frozen sectioned results collections are immutable and can be accessed from any thread.\n */\n@property (nonatomic, readonly, getter = isFrozen) BOOL frozen;\n\n#pragma mark - Sectioned Results Notifications\n\n/**\n Registers a block to be called each time the sectioned results collection changes.\n\n The block will be asynchronously called with the initial sectioned results collection,\n and then called again after each write transaction which changes either any\n of the objects in the results, or which objects are in the results.\n\n The `change` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the section were added, removed or modified. If a\n write transaction did not modify any objects in the section,\n the block is not called at all. See the `RLMSectionedResultsChange` documentation for\n information on how the changes are reported and an example of updating a\n `UITableView`.\n\n At the time when the block is called, the `RLMSectionedResults` object will be fully\n evaluated and up-to-date.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification. This can include the notification\n with the initial results. For example, the following code performs a write\n transaction immediately after adding the notification block, so there is no\n opportunity for the initial notification to be delivered first. As a\n result, the initial notification will reflect the state of the Realm after\n the write transaction.\n\n    RLMResults<Dog *> *results = [Dog allObjects];\n    RLMSectionedResults<Dog *> *sectionedResults = [results sectionedResultsUsingKeyPath:@\"age\" ascending:YES];\n    self.token = [sectionedResults addNotificationBlock:^(RLMSectionedResults *sectionedResults, RLMSectionedResultsChange *changes) {\n         // Only fired once for the example\n         NSLog(@\"sectionedResults.count: %zu\", sectionedResults.count); // => 1\n     }];\n     [realm transactionWithBlock:^{\n         Dog *dog = [[Dog alloc] init];\n         dog.name = @\"Rex\";\n         dog.age = 5;\n         [realm addObject:dog];\n     }];\n     // end of run loop execution context\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMSectionedResults<RLMKeyType, RLMObjectType> *, RLMSectionedResultsChange *))block __attribute__((warn_unused_result));\n/**\n Registers a block to be called each time the sectioned results collection changes.\n\n The block will be asynchronously called with the initial sectioned results collection,\n and then called again after each write transaction which changes either any\n of the objects in the results, or which objects are in the results.\n\n The `change` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the section were added, removed or modified. If a\n write transaction did not modify any objects in the section,\n the block is not called at all. See the `RLMSectionedResultsChange` documentation for\n information on how the changes are reported and an example of updating a\n `UITableView`.\n\n At the time when the block is called, the `RLMSectionedResults` object will be fully\n evaluated and up-to-date.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification. This can include the notification\n with the initial results. For example, the following code performs a write\n transaction immediately after adding the notification block, so there is no\n opportunity for the initial notification to be delivered first. As a\n result, the initial notification will reflect the state of the Realm after\n the write transaction.\n\n    RLMResults<Dog *> *results = [Dog allObjects];\n    RLMSectionedResults<Dog *> *sectionedResults = [results sectionedResultsUsingKeyPath:@\"age\" ascending:YES];\n    self.token = [sectionedResults addNotificationBlock:^(RLMSectionedResults *sectionedResults, RLMSectionedResultsChange *changes) {\n         // Only fired once for the example\n         NSLog(@\"sectionedResults.count: %zu\", sectionedResults.count); // => 1\n     }];\n     [realm transactionWithBlock:^{\n         Dog *dog = [[Dog alloc] init];\n         dog.name = @\"Rex\";\n         dog.age = 5;\n         [realm addObject:dog];\n     }];\n     // end of run loop execution context\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param queue The serial queue to deliver notifications to.\n\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMSectionedResults<RLMKeyType, RLMObjectType> *, RLMSectionedResultsChange *))block\n                                         queue:(dispatch_queue_t)queue __attribute__((warn_unused_result));\n/**\n Registers a block to be called each time the sectioned results collection changes.\n\n The block will be asynchronously called with the initial sectioned results collection,\n and then called again after each write transaction which changes either any\n of the objects in the results, or which objects are in the results.\n\n The `change` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the section were added, removed or modified. If a\n write transaction did not modify any objects in the section,\n the block is not called at all. See the `RLMSectionedResultsChange` documentation for\n information on how the changes are reported and an example of updating a\n `UITableView`.\n\n At the time when the block is called, the `RLMSectionedResults` object will be fully\n evaluated and up-to-date.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification. This can include the notification\n with the initial results. For example, the following code performs a write\n transaction immediately after adding the notification block, so there is no\n opportunity for the initial notification to be delivered first. As a\n result, the initial notification will reflect the state of the Realm after\n the write transaction.\n\n    RLMResults<Dog *> *results = [Dog allObjects];\n    RLMSectionedResults<Dog *> *sectionedResults = [results sectionedResultsUsingKeyPath:@\"age\" ascending:YES];\n    self.token = [sectionedResults addNotificationBlock:^(RLMSectionedResults *sectionedResults, RLMSectionedResultsChange *changes) {\n         // Only fired once for the example\n         NSLog(@\"sectionedResults.count: %zu\", sectionedResults.count); // => 1\n     }];\n     [realm transactionWithBlock:^{\n         Dog *dog = [[Dog alloc] init];\n         dog.name = @\"Rex\";\n         dog.age = 5;\n         [realm addObject:dog];\n     }];\n     // end of run loop execution context\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning The queue must be a serial queue.\n\n @note When filtering with key paths a notification will be fired in the following scenarios:\n    - An object in the collection has been modified at the filtered properties.\n    - An object has been modified on the section key path property, and the result of that modification has changed it's position in the section, or the object may need to move to another section.\n    - An object of the same observed type has been inserted or deleted from the Realm.\n\n @param block The block to be called whenever a change occurs.\n @param keyPaths The block will be called for changes occurring on these keypaths. If no\n key paths are given, notifications are delivered for every property key path.\n\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMSectionedResults<RLMKeyType, RLMObjectType> *, RLMSectionedResultsChange *))block\n                                      keyPaths:(NSArray<NSString *> *)keyPaths __attribute__((warn_unused_result));\n/**\n Registers a block to be called each time the sectioned results collection changes.\n\n The block will be asynchronously called with the initial sectioned results collection,\n and then called again after each write transaction which changes either any\n of the objects in the results, or which objects are in the results.\n\n The `change` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the section were added, removed or modified. If a\n write transaction did not modify any objects in the section,\n the block is not called at all. See the `RLMSectionedResultsChange` documentation for\n information on how the changes are reported and an example of updating a\n `UITableView`.\n\n At the time when the block is called, the `RLMSectionedResults` object will be fully\n evaluated and up-to-date.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification. This can include the notification\n with the initial results. For example, the following code performs a write\n transaction immediately after adding the notification block, so there is no\n opportunity for the initial notification to be delivered first. As a\n result, the initial notification will reflect the state of the Realm after\n the write transaction.\n\n    RLMResults<Dog *> *results = [Dog allObjects];\n    RLMSectionedResults<Dog *> *sectionedResults = [results sectionedResultsUsingKeyPath:@\"age\" ascending:YES];\n    self.token = [sectionedResults addNotificationBlock:^(RLMSectionedResults *sectionedResults, RLMSectionedResultsChange *changes) {\n         // Only fired once for the example\n         NSLog(@\"sectionedResults.count: %zu\", sectionedResults.count); // => 1\n     }];\n     [realm transactionWithBlock:^{\n         Dog *dog = [[Dog alloc] init];\n         dog.name = @\"Rex\";\n         dog.age = 5;\n         [realm addObject:dog];\n     }];\n     // end of run loop execution context\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning The queue must be a serial queue.\n\n @note When filtering with key paths a notification will be fired in the following scenarios:\n    - An object in the collection has been modified at the filtered properties.\n    - An object has been modified on the section key path property, and the result of that modification has changed it's position in the section, or the object may need to move to another section.\n    - An object of the same observed type has been inserted or deleted from the Realm.\n\n @param block The block to be called whenever a change occurs.\n @param keyPaths The block will be called for changes occurring on these keypaths. If no\n key paths are given, notifications are delivered for every property key path.\n @param queue The serial queue to deliver notifications to.\n\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMSectionedResults<RLMKeyType, RLMObjectType> *, RLMSectionedResultsChange *))block\n                                      keyPaths:(nullable NSArray<NSString *> *)keyPaths\n                                         queue:(nullable dispatch_queue_t)queue __attribute__((warn_unused_result));\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMSectionedResults.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2022 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMSectionedResults_Private.hpp\"\n#import \"RLMAccessor.hpp\"\n#import \"RLMCollection_Private.hpp\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMObservation.hpp\"\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMResults.h\"\n#import \"RLMResults_Private.hpp\"\n#import \"RLMThreadSafeReference_Private.hpp\"\n\nnamespace {\nstruct CollectionCallbackWrapper {\n    void (^block)(id, RLMSectionedResultsChange *);\n    id collection;\n    bool ignoreChangesInInitialNotification = true;\n\n    void operator()(realm::SectionedResultsChangeSet const& changes) {\n        if (ignoreChangesInInitialNotification) {\n            ignoreChangesInInitialNotification = false;\n            return block(collection, nil);\n        }\n\n        block(collection, [[RLMSectionedResultsChange alloc] initWithChanges:changes]);\n    }\n};\n\ntemplate<typename Function>\n__attribute__((always_inline))\nauto translateErrors(Function&& f) {\n    return translateCollectionError(static_cast<Function&&>(f), @\"SectionedResults\");\n}\n} // anonymous namespace\n\n@implementation RLMSectionedResultsChange {\n    realm::SectionedResultsChangeSet _indices;\n}\n\n- (instancetype)initWithChanges:(realm::SectionedResultsChangeSet)indices {\n    self = [super init];\n    if (self) {\n        _indices = std::move(indices);\n    }\n    return self;\n}\n\n- (NSArray<NSIndexPath *> *)indexesFromVector:(std::vector<realm::IndexSet> const&)indexMap {\n    NSMutableArray<NSIndexPath *> *a = [NSMutableArray new];\n    for (size_t i = 0; i < indexMap.size(); ++i) {\n        NSUInteger path[2] = {i, 0};\n        for (auto index : indexMap[i].as_indexes()) {\n            path[1] = index;\n            [a addObject:[NSIndexPath indexPathWithIndexes:path length:2]];\n        }\n    }\n    return a;\n}\n\n- (NSArray<NSIndexPath *> *)insertions {\n    return [self indexesFromVector:_indices.insertions];\n}\n\n- (NSArray<NSIndexPath *> *)deletions {\n    return [self indexesFromVector:_indices.deletions];\n}\n\n- (NSArray<NSIndexPath *> *)modifications {\n    return [self indexesFromVector:_indices.modifications];\n}\n\n- (NSIndexSet *)sectionsToInsert {\n    NSMutableIndexSet *indices = [NSMutableIndexSet new];\n    for (auto i : _indices.sections_to_insert.as_indexes()) {\n        [indices addIndex:i];\n    }\n    return indices;\n}\n\n- (NSIndexSet *)sectionsToRemove {\n    NSMutableIndexSet *indices = [NSMutableIndexSet new];\n    for (auto i : _indices.sections_to_delete.as_indexes()) {\n        [indices addIndex:i];\n    }\n    return indices;\n}\n\n/// Returns the index paths of the deletion indices in the given section.\n- (NSArray<NSIndexPath *> *)deletionsInSection:(NSUInteger)section {\n    return RLMToIndexPathArray(_indices.deletions[section], section);\n}\n\n/// Returns the index paths of the insertion indices in the given section.\n- (NSArray<NSIndexPath *> *)insertionsInSection:(NSUInteger)section {\n    return RLMToIndexPathArray(_indices.insertions[section], section);\n}\n\n/// Returns the index paths of the modification indices in the given section.\n- (NSArray<NSIndexPath *> *)modificationsInSection:(NSUInteger)section {\n    return RLMToIndexPathArray(_indices.modifications[section], section);\n}\n\nstatic NSString *indexPathToString(NSArray<NSIndexPath *> *indexes) {\n    if (indexes.count == 0) {\n        return @\"[]\";\n    }\n    return [NSString stringWithFormat:@\"[\\n\\t%@\\n\\t]\", [indexes componentsJoinedByString:@\"\\n\\t\\t\"]];\n};\n\nstatic NSString *indexSetToString(NSIndexSet *sections) {\n    if (sections.count == 0) {\n        return @\"[]\";\n    }\n    return [NSString stringWithFormat:@\"[\\n\\t%@\\n\\t]\", sections];\n}\n\n- (NSString *)description {\n    return [NSString stringWithFormat:@\"<RLMSectionedResultsChange: %p> {\\n\\tinsertions: %@,\\n\\tdeletions: %@,\\n\\tmodifications: %@,\\n\\tsectionsToInsert: %@,\\n\\tsectionsToRemove: %@\\n}\",\n            (__bridge void *)self,\n            indexPathToString(self.insertions),\n            indexPathToString(self.deletions),\n            indexPathToString(self.modifications),\n            indexSetToString(self.sectionsToInsert), indexSetToString(self.sectionsToRemove)];\n}\n\n@end\n\nstruct SectionedResultsKeyProjection {\n    RLMClassInfo *_info;\n    RLMSectionedResultsKeyBlock _block;\n\n    realm::Mixed operator()(realm::Mixed obj, realm::SharedRealm) {\n        RLMAccessorContext context(*_info);\n        id value = _block(context.box(obj));\n        return context.unbox<realm::Mixed>(value);\n    }\n};\n\n@interface RLMSectionedResultsEnumerator() {\n    // The buffer supplied by fast enumeration does not retain the objects given\n    // to it, but because we create objects on-demand and don't want them\n    // autoreleased (a table can have more rows than the device has memory for\n    // accessor objects) we need a thing to retain them.\n    id _strongBuffer[16];\n    id<RLMSectionedResult> _sectionedResult;\n}\n@end\n\n@implementation RLMSectionedResultsEnumerator\n\n- (instancetype)initWithSectionedResults:(RLMSectionedResults *)sectionedResults {\n    if (self = [super init]) {\n        _sectionedResult = [sectionedResults snapshot];\n        return self;\n    }\n    return nil;\n}\n\n- (instancetype)initWithResultsSection:(RLMSection *)resultsSection {\n    if (self = [super init]) {\n        _sectionedResult = resultsSection;\n        return self;\n    }\n    return nil;\n}\n\n- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state\n                                    count:(NSUInteger)len {\n    NSUInteger batchCount = 0, count = [_sectionedResult count];\n    for (NSUInteger index = state->state; index < count && batchCount < len; ++index) {\n        id<RLMSectionedResult> sectionedResults = [_sectionedResult objectAtIndex:index];\n        _strongBuffer[batchCount] = sectionedResults;\n        batchCount++;\n    }\n\n    for (NSUInteger i = batchCount; i < len; ++i) {\n        _strongBuffer[i] = nil;\n    }\n\n    if (batchCount == 0) {\n        // Release our data if we're done, as we're autoreleased and so may\n        // stick around for a while\n        if (_sectionedResult) {\n            _sectionedResult = nil;\n        }\n    }\n\n    state->itemsPtr = (__unsafe_unretained id *)(void *)_strongBuffer;\n    state->state += batchCount;\n    state->mutationsPtr = state->extra+1;\n\n    return batchCount;\n}\n\n@end\n\nNSUInteger RLMFastEnumerate(NSFastEnumerationState *state,\n                            NSUInteger len,\n                            RLMSectionedResults *collection) {\n    __autoreleasing RLMSectionedResultsEnumerator *enumerator;\n    if (state->state == 0) {\n        enumerator = collection.fastEnumerator;\n        state->extra[0] = (long)enumerator;\n        state->extra[1] = collection.count;\n    }\n    else {\n        enumerator = (__bridge id)(void *)state->extra[0];\n    }\n\n    return [enumerator countByEnumeratingWithState:state count:len];\n}\n\nNSUInteger RLMFastEnumerate(NSFastEnumerationState *state,\n                            NSUInteger len,\n                            RLMSection *collection) {\n    __autoreleasing RLMSectionedResultsEnumerator *enumerator;\n    if (state->state == 0) {\n        enumerator = collection.fastEnumerator;\n        state->extra[0] = (long)enumerator;\n        state->extra[1] = collection.count;\n    }\n    else {\n        enumerator = (__bridge id)(void *)state->extra[0];\n    }\n\n    return [enumerator countByEnumeratingWithState:state count:len];\n}\n\n@interface RLMSectionedResults () <RLMThreadConfined_Private>\n@end\n\n@implementation RLMSectionedResults {\n    @public\n    realm::SectionedResults _sectionedResults;\n    RLMSectionedResultsKeyBlock _keyBlock;\n    // We need to hold an instance to the parent\n    // `Results` so we can obtain a ThreadSafeReference\n    // for notifications.\n    realm::Results _results;\n    @private\n    RLMRealm *_realm;\n    RLMClassInfo *_info;\n}\n\n- (instancetype)initWithResults:(realm::Results&&)results\n                          realm:(RLMRealm *)realm\n                     objectInfo:(RLMClassInfo&)objectInfo\n                       keyBlock:(RLMSectionedResultsKeyBlock)keyBlock {\n    if (self = [super init]) {\n        _info = &objectInfo;\n        _realm = realm;\n        _keyBlock = keyBlock;\n        _results = std::move(results);\n        _sectionedResults = _results.sectioned_results(SectionedResultsKeyProjection{_info, _keyBlock});\n    }\n    return self;\n}\n\n- (instancetype)initWithSectionedResults:(realm::SectionedResults&&)sectionedResults\n                              objectInfo:(RLMClassInfo&)objectInfo\n                                keyBlock:(RLMSectionedResultsKeyBlock)keyBlock{\n    if (self = [super init]) {\n        _info = &objectInfo;\n        _realm = _info->realm;\n        _sectionedResults = std::move(sectionedResults);\n        _keyBlock = keyBlock;\n    }\n    return self;\n}\n\n- (instancetype)initWithResults:(RLMResults *)results\n                       keyBlock:(RLMSectionedResultsKeyBlock)keyBlock {\n    if (self = [super init]) {\n        _info = results.objectInfo;\n        _realm = results.realm;\n        _keyBlock = keyBlock;\n        _results = results->_results;\n        _sectionedResults = results->_results.sectioned_results(SectionedResultsKeyProjection{_info, _keyBlock});\n    }\n    return self;\n}\n\n- (NSArray *)allKeys {\n    return translateErrors([&] {\n        NSUInteger count = [self count];\n        NSMutableArray *arr = [NSMutableArray arrayWithCapacity:count];\n        for (NSUInteger i = 0; i < count; i++) {\n            [arr addObject:RLMMixedToObjc(_sectionedResults[i].key())];\n        }\n        return arr;\n    });\n}\n\n- (RLMSectionedResultsEnumerator *)fastEnumerator {\n    return [[RLMSectionedResultsEnumerator alloc] initWithSectionedResults:self];\n}\n\n- (RLMRealm *)realm {\n    return _realm;\n}\n\n- (NSUInteger)count {\n    return translateErrors([&] {\n        return _sectionedResults.size();\n    });\n}\n\n- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state\n                                  objects:(__unused __unsafe_unretained id [])buffer\n                                    count:(NSUInteger)len {\n    return RLMFastEnumerate(state, len, self);\n}\n\n- (id)objectAtIndexedSubscript:(NSUInteger)index {\n    return [self objectAtIndex:index];\n}\n\n- (id)objectAtIndex:(NSUInteger)index {\n    return [[RLMSection alloc] initWithResultsSection:_sectionedResults[index]\n                                               parent:self];\n}\n\n// The compiler complains about the method's argument type not matching due to\n// it not having the generic type attached, but it doesn't seem to be possible\n// to actually include the generic type\n// http://www.openradar.me/radar?id=6135653276319744\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wmismatched-parameter-types\"\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults *, RLMSectionedResultsChange *))block {\n    return RLMAddNotificationBlock(self, block, nil, nil);\n}\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults *, RLMSectionedResultsChange *))block queue:(dispatch_queue_t)queue {\n    return RLMAddNotificationBlock(self, block, nil, queue);\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults *, RLMSectionedResultsChange *))block\n                                      keyPaths:(NSArray<NSString *> *)keyPaths {\n    return RLMAddNotificationBlock(self, block, keyPaths, nil);\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults *, RLMSectionedResultsChange *))block\n                                      keyPaths:(NSArray<NSString *> *)keyPaths\n                                         queue:(dispatch_queue_t)queue {\n    return RLMAddNotificationBlock(self, block, keyPaths, queue);\n}\n#pragma clang diagnostic pop\n\n- (realm::NotificationToken)addNotificationCallback:(id)block\nkeyPaths:(std::optional<std::vector<std::vector<std::pair<realm::TableKey, realm::ColKey>>>>&&)keyPaths {\n    return _sectionedResults.add_notification_callback(CollectionCallbackWrapper{block, self}, std::move(keyPaths));\n}\n\n- (RLMClassInfo *)objectInfo {\n    return _info;\n}\n\n- (instancetype)resolveInRealm:(RLMRealm *)realm {\n     return translateErrors([&] {\n        if (realm.isFrozen) {\n            return [[RLMSectionedResults alloc] initWithSectionedResults:_sectionedResults.freeze(realm->_realm)\n                                                              objectInfo:_info->resolve(realm)\n                                                                keyBlock:_keyBlock];\n        }\n        else {\n            auto sr = _sectionedResults.freeze(realm->_realm);\n            sr.reset_section_callback(SectionedResultsKeyProjection {&_info->resolve(realm), _keyBlock});\n            return [[RLMSectionedResults alloc] initWithSectionedResults:std::move(sr)\n                                                              objectInfo:_info->resolve(realm)\n                                                                keyBlock:_keyBlock];\n        }\n    });\n}\n\n- (instancetype)freeze {\n    if (self.frozen) {\n        return self;\n    }\n    return [self resolveInRealm:_realm.freeze];\n}\n\n- (instancetype)thaw {\n    if (!self.frozen) {\n        return self;\n    }\n    return [self resolveInRealm:_realm.thaw];\n}\n\n\n#pragma mark - Thread Confined Protocol Conformance\n\n- (realm::ThreadSafeReference)makeThreadSafeReference {\n    return _results;\n}\n\n- (id)objectiveCMetadata {\n    return _keyBlock;\n}\n\n+ (instancetype)objectWithThreadSafeReference:(realm::ThreadSafeReference)reference\n                                     metadata:(id)metadata\n                                        realm:(RLMRealm *)realm {\n    auto results = reference.resolve<realm::Results>(realm->_realm);\n    auto objType = RLMStringDataToNSString(results.get_object_type());\n    return [[RLMSectionedResults alloc] initWithResults:std::move(results)\n                                                  realm:realm\n                                             objectInfo:realm->_info[objType]\n                                               keyBlock:(RLMSectionedResultsKeyBlock)metadata];\n}\n\n- (BOOL)isInvalidated {\n    return translateErrors([&] { return !_sectionedResults.is_valid(); });\n}\n\n- (NSString *)description {\n    NSString *objType = @\"\";\n    if (_info) {\n        objType = [NSString stringWithFormat:@\"<%@>\", _info->rlmObjectSchema.className];\n    }\n    const NSUInteger maxObjects = 100;\n    auto str = [NSMutableString stringWithFormat:@\"RLMSectionedResults%@ <%p> (\\n\", objType, (void *)self];\n    size_t index = 0, skipped = 0;\n    for (RLMSection *section in self) {\n        NSString *sub = [section description];\n        // Indent child objects\n        NSString *objDescription = [sub stringByReplacingOccurrencesOfString:@\"\\n\"\n                                                                  withString:@\"\\n\\t\"];\n        [str appendFormat:@\"\\t[%@] %@,\\n\", section.key, objDescription];\n        index++;\n        if (index >= maxObjects) {\n            skipped = self.count - maxObjects;\n            break;\n        }\n    }\n\n    // Remove last comma and newline characters\n    if (self.count > 0) {\n        [str deleteCharactersInRange:NSMakeRange(str.length-2, 2)];\n    }\n    if (skipped) {\n        [str appendFormat:@\"\\n\\t... %zu objects skipped.\", skipped];\n    }\n    [str appendFormat:@\"\\n)\"];\n    return str;\n}\n\n- (RLMSectionedResults *)snapshot {\n    RLMSectionedResults *sr = [RLMSectionedResults new];\n    sr->_sectionedResults = _sectionedResults.snapshot();\n    sr->_info = _info;\n    sr->_realm = _realm;\n    return sr;\n}\n\n- (BOOL)isFrozen {\n    return translateErrors([&] { return _sectionedResults.is_frozen(); });\n}\n\n@end\n\n/// Stores information about a given section during thread handover.\n@interface RLMSectionMetadata : NSObject\n\n@property (nonatomic, strong) RLMSectionedResultsKeyBlock keyBlock;\n@property (nonatomic, copy) id<RLMValue> sectionKey;\n\n- (instancetype)initWithKeyBlock:(RLMSectionedResultsKeyBlock)keyBlock\n                      sectionKey:(id<RLMValue>)sectionKey;\n@end\n\n@implementation RLMSectionMetadata\n- (instancetype)initWithKeyBlock:(RLMSectionedResultsKeyBlock)keyBlock\n                      sectionKey:(id<RLMValue>)sectionKey {\n    if (self = [super init]) {\n        _keyBlock = keyBlock;\n        _sectionKey = sectionKey;\n    }\n    return self;\n}\n@end\n\n@interface RLMSection () <RLMThreadConfined_Private>\n@end\n\n@implementation RLMSection {\n    RLMSectionedResults *_parent;\n    realm::ResultsSection _resultsSection;\n}\n\n- (NSString *)description {\n    const NSUInteger maxObjects = 100;\n    auto str = [NSMutableString stringWithFormat:@\"RLMSection <%p> (\\n\", (void *)self];\n    size_t index = 0, skipped = 0;\n    for (id obj in self) {\n        NSString *sub = [obj description];\n        // Indent child objects\n        NSString *objDescription = [sub stringByReplacingOccurrencesOfString:@\"\\n\"\n                                                                  withString:@\"\\n\\t\"];\n        [str appendFormat:@\"\\t[%zu] %@,\\n\", index++, objDescription];\n        if (index >= maxObjects) {\n            skipped = self.count - maxObjects;\n            break;\n        }\n    }\n\n    // Remove last comma and newline characters\n    if (self.count > 0) {\n        [str deleteCharactersInRange:NSMakeRange(str.length-2, 2)];\n    }\n    if (skipped) {\n        [str appendFormat:@\"\\n\\t... %zu objects skipped.\", skipped];\n    }\n    [str appendFormat:@\"\\n)\"];\n    return str;\n}\n\n- (instancetype)initWithResultsSection:(realm::ResultsSection&&)resultsSection\n                                parent:(RLMSectionedResults *)parent\n{\n    if (self = [super init]) {\n        _resultsSection = std::move(resultsSection);\n        _parent = parent;\n    }\n    return self;\n}\n\n- (id)objectAtIndexedSubscript:(NSUInteger)index {\n    return [self objectAtIndex:index];\n}\n\n- (id)objectAtIndex:(NSUInteger)index {\n    RLMAccessorContext ctx(*_parent.objectInfo);\n    return translateErrors([&] {\n        return ctx.box(_resultsSection[index]);\n    });\n}\n\n- (NSUInteger)count {\n    return translateErrors([&] {\n        return _resultsSection.size();\n    });\n}\n\n- (id<RLMValue>)key {\n    return translateErrors([&] {\n        return RLMMixedToObjc(_resultsSection.key());\n    });\n}\n\n- (RLMSectionedResultsEnumerator *)fastEnumerator {\n    return [[RLMSectionedResultsEnumerator alloc] initWithResultsSection:self];\n}\n\n- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state\n                                  objects:(__unused __unsafe_unretained id [])buffer\n                                    count:(NSUInteger)len {\n    return RLMFastEnumerate(state, len, self);\n}\n\n- (RLMRealm *)realm {\n    return _parent.realm;\n}\n\n- (RLMClassInfo *)objectInfo {\n    return _parent.objectInfo;\n}\n\n- (BOOL)isInvalidated {\n    return translateErrors([&] { return !_resultsSection.is_valid(); });\n}\n\n- (BOOL)isFrozen {\n    return translateErrors([&] { return _parent.frozen; });\n}\n\n// The compiler complains about the method's argument type not matching due to\n// it not having the generic type attached, but it doesn't seem to be possible\n// to actually include the generic type\n// http://www.openradar.me/radar?id=6135653276319744\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wmismatched-parameter-types\"\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults *, RLMSectionedResultsChange *))block {\n    return RLMAddNotificationBlock(self, block, nil, nil);\n}\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults *, RLMSectionedResultsChange *))block queue:(dispatch_queue_t)queue {\n    return RLMAddNotificationBlock(self, block, nil, queue);\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults *, RLMSectionedResultsChange *))block keyPaths:(NSArray<NSString *> *)keyPaths {\n    return RLMAddNotificationBlock(self, block, keyPaths, nil);\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults *, RLMSectionedResultsChange *))block\n                                      keyPaths:(NSArray<NSString *> *)keyPaths\n                                         queue:(dispatch_queue_t)queue {\n    return RLMAddNotificationBlock(self, block, keyPaths, queue);\n}\n#pragma clang diagnostic pop\n\n- (realm::NotificationToken)addNotificationCallback:(id)block\nkeyPaths:(std::optional<std::vector<std::vector<std::pair<realm::TableKey, realm::ColKey>>>>&&)keyPaths {\n    return _resultsSection.add_notification_callback(CollectionCallbackWrapper{block, self}, std::move(keyPaths));\n}\n\n#pragma mark - Thread Confined Protocol Conformance\n\n- (realm::ThreadSafeReference)makeThreadSafeReference {\n    return _parent->_results;\n}\n\n- (RLMSectionMetadata *)objectiveCMetadata {\n    return [[RLMSectionMetadata alloc] initWithKeyBlock:_parent->_keyBlock\n                                             sectionKey:self.key];\n}\n\n+ (instancetype)objectWithThreadSafeReference:(realm::ThreadSafeReference)reference\n                                     metadata:(RLMSectionMetadata *)metadata\n                                        realm:(RLMRealm *)realm {\n    auto results = reference.resolve<realm::Results>(realm->_realm);\n    auto objType = RLMStringDataToNSString(results.get_object_type());\n\n    RLMSectionedResults *sr = [[RLMSectionedResults alloc] initWithResults:std::move(results)\n                                                                     realm:realm\n                                                                objectInfo:realm->_info[objType]\n                                                                  keyBlock:metadata.keyBlock];\n    return translateErrors([&] {\n        return [[RLMSection alloc] initWithResultsSection:sr->_sectionedResults[RLMObjcToMixed(metadata.sectionKey)]\n                                                   parent:sr];\n    });\n}\n\n- (instancetype)resolveInRealm:(RLMRealm *)realm {\n     return translateErrors([&] {\n        RLMSectionedResults *sr = realm.isFrozen ? [_parent freeze] : [_parent thaw];\n        return [[RLMSection alloc] initWithResultsSection:sr->_sectionedResults[RLMObjcToMixed(self.key)]\n                                                   parent:sr];\n    });\n}\n\n- (instancetype)freeze {\n    if (self.frozen) {\n        return self;\n    }\n    return [self resolveInRealm:_parent.realm.freeze];\n}\n\n- (instancetype)thaw {\n    if (!self.frozen) {\n        return self;\n    }\n    return [self resolveInRealm:_parent.realm.thaw];\n}\n\n@end\n"
  },
  {
    "path": "Realm/RLMSectionedResults_Private.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2022 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMClassInfo.hpp\"\n#import \"RLMSectionedResults.h\"\n\n#import <realm/object-store/results.hpp>\n#import <realm/object-store/sectioned_results.hpp>\n\n@protocol RLMValue;\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\nRLM_HIDDEN_BEGIN\n\nRLM_DIRECT_MEMBERS\n@interface RLMSectionedResultsChange ()\n- (instancetype)initWithChanges:(realm::SectionedResultsChangeSet)indices;\n@end\n\nRLM_DIRECT_MEMBERS\n@interface RLMSectionedResultsEnumerator : NSObject\n\n- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state\n                                    count:(NSUInteger)len;\n\n- (instancetype)initWithSectionedResults:(RLMSectionedResults *)sectionedResults;\n- (instancetype)initWithResultsSection:(RLMSection *)resultsSection;\n\n@end\n\n@interface RLMSectionedResults ()\n\n- (instancetype)initWithResults:(RLMResults *)results\n                       keyBlock:(RLMSectionedResultsKeyBlock)keyBlock;\n\n- (RLMSectionedResultsEnumerator *)fastEnumerator;\n- (RLMClassInfo *)objectInfo;\n- (RLMSectionedResults *)snapshot;\n\nNSUInteger RLMFastEnumerate(NSFastEnumerationState *state,\n                            NSUInteger len,\n                            RLMSectionedResults *collection);\n\n@end\n\n@interface RLMSection ()\n\n- (instancetype)initWithResultsSection:(realm::ResultsSection&&)resultsSection\n                                parent:(RLMSectionedResults *)parent;\n\n- (RLMSectionedResultsEnumerator *)fastEnumerator;\n- (RLMClassInfo *)objectInfo;\n\nNSUInteger RLMFastEnumerate(NSFastEnumerationState *state,\n                            NSUInteger len,\n                            RLMSection *collection);\n\n@end\n\nRLM_HIDDEN_END\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMSet.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMCollection.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@class RLMObject, RLMResults<RLMObjectType>;\n\n/**\n A collection datatype used for storing distinct objects.\n\n - Note:\n `RLMSet` supports storing primitive and `RLMObject` types. `RLMSet` does not support storing\n Embedded Realm Objects.\n */\n@interface RLMSet<RLMObjectType> : NSObject<RLMCollection>\n\n#pragma mark - Properties\n\n/**\n The number of objects in the set.\n */\n@property (nonatomic, readonly, assign) NSUInteger count;\n\n/**\n The type of the objects in the set.\n */\n@property (nonatomic, readonly, assign) RLMPropertyType type;\n\n/**\n Indicates whether the objects in the collection can be `nil`.\n */\n@property (nonatomic, readonly, getter = isOptional) BOOL optional;\n\n/**\n The objects in the RLMSet as an NSArray value.\n */\n@property (nonatomic, readonly) NSArray<RLMObjectType> *allObjects;\n\n/**\n The class name of the objects contained in the set.\n\n Will be `nil` if `type` is not RLMPropertyTypeObject.\n */\n@property (nonatomic, readonly, copy, nullable) NSString *objectClassName;\n\n/**\n The Realm which manages the set. Returns `nil` for unmanaged set.\n */\n@property (nonatomic, readonly, nullable) RLMRealm *realm;\n\n/**\n Indicates if the set can no longer be accessed.\n */\n@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated;\n\n/**\n Indicates if the set is frozen.\n\n Frozen sets are immutable and can be accessed from any thread. Frozen sets\n are created by calling `-freeze` on a managed live set. Unmanaged sets are\n never frozen.\n */\n@property (nonatomic, readonly, getter = isFrozen) BOOL frozen;\n\n#pragma mark - Adding, Removing, and Replacing Objects in a Set\n\n/**\n Adds an object to the set if it is not already present.\n\n @warning This method may only be called during a write transaction.\n\n @param object  An object of the type contained in the set.\n */\n- (void)addObject:(RLMObjectType)object;\n\n/**\n Adds an array of distinct objects to the set.\n\n @warning This method may only be called during a write transaction.\n\n @param objects     An enumerable object such as `NSArray`, `NSSet` or `RLMResults` which contains objects of the\n                    same class as the set.\n */\n- (void)addObjects:(id<NSFastEnumeration>)objects;\n\n/**\n Removes a given object from the set.\n\n @warning This method may only be called during a write transaction.\n\n @param object The object in the set that you want to remove.\n */\n- (void)removeObject:(RLMObjectType)object;\n\n/**\n Removes all objects from the set.\n\n @warning This method may only be called during a write transaction.\n */\n- (void)removeAllObjects;\n\n/**\n Empties the receiving set, then adds each object contained in another given set.\n\n @warning This method may only be called during a write transaction.\n\n @param set The RLMSet whose members replace the receiving set's content.\n */\n- (void)setSet:(RLMSet<RLMObjectType> *)set;\n\n/**\n Removes from the receiving set each object that isn’t a member of another given set.\n\n @warning This method may only be called during a write transaction.\n\n @param set The RLMSet with which to perform the intersection.\n */\n- (void)intersectSet:(RLMSet<RLMObjectType> *)set;\n\n/**\n Removes each object in another given set from the receiving set, if present.\n\n @warning This method may only be called during a write transaction.\n\n @param set The set of objects to remove from the receiving set.\n */\n- (void)minusSet:(RLMSet<RLMObjectType> *)set;\n\n/**\n Adds each object in another given set to the receiving set, if not present.\n\n @warning This method may only be called during a write transaction.\n\n @param set The set of objects to add to the receiving set.\n */\n- (void)unionSet:(RLMSet<RLMObjectType> *)set;\n\n#pragma mark - Querying a Set\n\n/// :nodoc:\n- (RLMResults<RLMObjectType> *)objectsWhere:(NSString *)predicateFormat, ...;\n\n/// :nodoc:\n- (RLMResults<RLMObjectType> *)objectsWhere:(NSString *)predicateFormat args:(va_list)args;\n\n/// :nodoc:\n- (RLMResults<RLMObjectType> *)objectsWithPredicate:(NSPredicate *)predicate;\n\n/// :nodoc:\n- (RLMResults<RLMObjectType> *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending;\n\n/// :nodoc:\n- (RLMResults<RLMObjectType> *)sortedResultsUsingDescriptors:(NSArray<RLMSortDescriptor *> *)properties;\n\n/// :nodoc:\n- (RLMResults<RLMObjectType> *)distinctResultsUsingKeyPaths:(NSArray<NSString *> *)keyPaths;\n\n/**\n Returns a Boolean value that indicates whether at least one object in the receiving set is also present in another given set.\n\n @param set The RLMSet to compare the receiving set to.\n\n @return YES if at least one object in the receiving set is also present in otherSet, otherwise NO.\n */\n- (BOOL)intersectsSet:(RLMSet<RLMObjectType> *)set;\n\n/**\n Returns a Boolean value that indicates whether every object in the receiving set is also present in another given set.\n\n @param set The RLMSet to compare the receiving set to.\n\n @return YES if every object in the receiving set is also present in otherSet, otherwise NO.\n */\n- (BOOL)isSubsetOfSet:(RLMSet<RLMObjectType> *)set;\n\n/**\n Returns a Boolean value that indicates whether a given object is present in the set.\n\n @param anObject An object to look for in the set.\n\n @return YES if anObject is present in the set, otherwise NO.\n */\n- (BOOL)containsObject:(RLMObjectType)anObject;\n\n/**\n Compares the receiving set to another set.\n\n @param otherSet The set with which to compare the receiving set.\n\n @return YES if the contents of otherSet are equal to the contents of the receiving set, otherwise NO.\n */\n- (BOOL)isEqualToSet:(RLMSet<RLMObjectType> *)otherSet;\n\n#pragma mark - Sectioning a Set\n\n/**\n Sorts and sections this collection from a given property key path, returning the result\n as an instance of `RLMSectionedResults`.\n\n @param keyPath The property key path to sort on.\n @param ascending The direction to sort in.\n @param keyBlock A callback which is invoked on each element in the Results collection.\n                This callback is to return the section key for the element in the collection.\n\n @return An instance of RLMSectionedResults.\n */\n- (RLMSectionedResults *)sectionedResultsSortedUsingKeyPath:(NSString *)keyPath\n                                                  ascending:(BOOL)ascending\n                                                   keyBlock:(RLMSectionedResultsKeyBlock)keyBlock;\n\n/**\n Sorts and sections this collection from a given array of sort descriptors, returning the result\n as an instance of `RLMSectionedResults`.\n\n @param sortDescriptors  An array of `RLMSortDescriptor`s to sort by.\n @param keyBlock  A callback which is invoked on each element in the Results collection.\n                 This callback is to return the section key for the element in the collection.\n\n @note The primary sort descriptor must be responsible for determining the section key.\n\n @return An instance of RLMSectionedResults.\n */\n- (RLMSectionedResults *)sectionedResultsUsingSortDescriptors:(NSArray<RLMSortDescriptor *> *)sortDescriptors\n                                                     keyBlock:(RLMSectionedResultsKeyBlock)keyBlock;\n\n\n#pragma mark - Notifications\n\n/**\n Registers a block to be called each time the set changes.\n\n The block will be asynchronously called with the initial set, and then\n called again after each write transaction which changes any of the objects in\n the set, which objects are in the results, or the order of the objects in the\n set.\n\n The `changes` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the set were added, removed or modified. If a write transaction\n did not modify any objects in the set, the block is not called at all.\n See the `RLMCollectionChange` documentation for information on how the changes\n are reported and an example of updating a `UITableView`.\n\n The error parameter is present only for backwards compatibility and will always\n be `nil`.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification. This can include the notification\n with the initial results. For example, the following code performs a write\n transaction immediately after adding the notification block, so there is no\n opportunity for the initial notification to be delivered first. As a\n result, the initial notification will reflect the state of the Realm after\n the write transaction.\n\n     Person *person = [[Person allObjectsInRealm:realm] firstObject];\n     NSLog(@\"person.dogs.count: %zu\", person.dogs.count); // => 0\n     self.token = [person.dogs addNotificationBlock(RLMSet<Dog *> *dogs,\n                                                    RLMCollectionChange *changes,\n                                                    NSError *error) {\n         // Only fired once for the example\n         NSLog(@\"dogs.count: %zu\", dogs.count) // => 1\n     }];\n     [realm transactionWithBlock:^{\n         Dog *dog = [[Dog alloc] init];\n         dog.name = @\"Rex\";\n         [person.dogs addObject:dog];\n     }];\n     // end of run loop execution context\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning This method may only be called on a non-frozen managed set.\n\n @param block The block to be called each time the set changes.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMSet<RLMObjectType> *_Nullable set,\n                                                         RLMCollectionChange *_Nullable changes,\n                                                         NSError *_Nullable error))block\n__attribute__((warn_unused_result));\n\n/**\n Registers a block to be called each time the set changes.\n\n The block will be asynchronously called with the initial set, and then\n called again after each write transaction which changes any of the objects in\n the set, which objects are in the results, or the order of the objects in the\n set.\n\n The `changes` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the set were added, removed or modified. If a write transaction\n did not modify any objects in the set, the block is not called at all.\n See the `RLMCollectionChange` documentation for information on how the changes\n are reported and an example of updating a `UITableView`.\n\n The error parameter is present only for backwards compatibility and will always\n be `nil`.\n\n Notifications are delivered on the given queue. If the queue is blocked and\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification.\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called when the containing Realm is read-only or frozen.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param queue The serial queue to deliver notifications to.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMSet<RLMObjectType> *_Nullable set,\n                                                         RLMCollectionChange *_Nullable changes,\n                                                         NSError *_Nullable error))block\n                                         queue:(nullable dispatch_queue_t)queue\n__attribute__((warn_unused_result));\n\n/**\n Registers a block to be called each time the set changes.\n\n The block will be asynchronously called with the initial set, and then\n called again after each write transaction which changes any of the objects in\n the set, which objects are in the results, or the order of the objects in the\n set.\n\n The `changes` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the set were added, removed or modified. If a write transaction\n did not modify any objects in the set, the block is not called at all.\n See the `RLMCollectionChange` documentation for information on how the changes\n are reported and an example of updating a `UITableView`.\n\n The error parameter is present only for backwards compatibility and will always\n be `nil`.\n\n Notifications are delivered on the given queue. If the queue is blocked and\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification.\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called when the containing Realm is read-only or frozen.\n @warning The queue must be a serial queue.\n\n @param block The block to be called whenever a change occurs.\n @param keyPaths The block will be called for changes occurring on these keypaths. If no\n key paths are given, notifications are delivered for every property key path.\n @param queue The serial queue to deliver notifications to.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMSet<RLMObjectType> *_Nullable set,\n                                                         RLMCollectionChange *_Nullable changes,\n                                                         NSError *_Nullable error))block\n                                      keyPaths:(nullable NSArray<NSString *> *)keyPaths\n                                         queue:(nullable dispatch_queue_t)queue\n__attribute__((warn_unused_result));\n\n/**\n Registers a block to be called each time the set changes.\n\n The block will be asynchronously called with the initial set, and then\n called again after each write transaction which changes any of the objects in\n the set, which objects are in the results, or the order of the objects in the\n set.\n\n The `changes` parameter will be `nil` the first time the block is called.\n For each call after that, it will contain information about\n which rows in the set were added, removed or modified. If a write transaction\n did not modify any objects in the set, the block is not called at all.\n See the `RLMCollectionChange` documentation for information on how the changes\n are reported and an example of updating a `UITableView`.\n\n The error parameter is present only for backwards compatibility and will always\n be `nil`.\n\n Notifications are delivered via the standard run loop, and so can't be\n delivered while the run loop is blocked by other activity. When\n notifications can't be delivered instantly, multiple notifications may be\n coalesced into a single notification. This can include the notification\n with the initial results. For example, the following code performs a write\n transaction immediately after adding the notification block, so there is no\n opportunity for the initial notification to be delivered first. As a\n result, the initial notification will reflect the state of the Realm after\n the write transaction.\n\n You must retain the returned token for as long as you want updates to continue\n to be sent to the block. To stop receiving updates, call `-invalidate` on the token.\n\n @warning This method cannot be called when the containing Realm is read-only or frozen.\n @warning The queue must be a serial queue.\n @param block The block to be called whenever a change occurs.\n @param keyPaths The block will be called for changes occurring on these keypaths. If no\n key paths are given, notifications are delivered for every property key path.\n @return A token which must be held for as long as you want updates to be delivered.\n */\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMSet<RLMObjectType> *_Nullable set,\n                                                         RLMCollectionChange *_Nullable changes,\n                                                         NSError *_Nullable error))block\n                                      keyPaths:(nullable NSArray<NSString *> *)keyPaths\n__attribute__((warn_unused_result));\n\n#pragma mark - Aggregating Property Values\n\n/**\n Returns the minimum (lowest) value of the given property among all the objects in the set.\n\n     NSNumber *min = [object.setProperty minOfProperty:@\"age\"];\n\n @warning You cannot use this method on `RLMObject`,  `RLMArray`,  `RLMSet`, and `NSData` properties.\n\n @param property The property whose minimum value is desired. Only properties of\n                 types `int`, `float`, `double`, and `NSDate` are supported.\n\n @return The minimum value of the property, or `nil` if the set is empty.\n */\n- (nullable id)minOfProperty:(NSString *)property;\n\n/**\n Returns the maximum (highest) value of the given property among all the objects in the set.\n\n     NSNumber *max = [object.setProperty maxOfProperty:@\"age\"];\n\n @warning You cannot use this method on `RLMObject`, `RLMArray`,  `RLMSet`, and `NSData` properties.\n\n @param property The property whose maximum value is desired. Only properties of\n                 types `int`, `float`, `double`, and `NSDate` are supported.\n\n @return The maximum value of the property, or `nil` if the set is empty.\n */\n- (nullable id)maxOfProperty:(NSString *)property;\n\n/**\n Returns the sum of distinct values of a given property over all the objects in the set.\n\n     NSNumber *sum = [object.setProperty sumOfProperty:@\"age\"];\n\n @warning You cannot use this method on `RLMObject`, `RLMArray`,  `RLMSet and `NSData` properties.\n\n @param property The property whose values should be summed. Only properties of\n                 types `int`, `float`, and `double` are supported.\n\n @return The sum of the given property.\n */\n- (NSNumber *)sumOfProperty:(NSString *)property;\n\n/**\n Returns the average value of a given property over the objects in the set.\n\n     NSNumber *average = [object.setProperty averageOfProperty:@\"age\"];\n\n @warning You cannot use this method on `RLMObject`, `RLMSet`,  `RLMArray`, and `NSData` properties.\n\n @param property The property whose average value should be calculated. Only\n                 properties of types `int`, `float`, and `double` are supported.\n\n @return    The average value of the given property, or `nil` if the set is empty.\n */\n- (nullable NSNumber *)averageOfProperty:(NSString *)property;\n\n#pragma mark - Freeze\n\n/**\n Returns a frozen (immutable) snapshot of this set.\n\n The frozen copy is an immutable set which contains the same data as this\n et currently contains, but will not update when writes are made to the\n containing Realm. Unlike live sets, frozen sets can be accessed from any\n thread.\n\n @warning This method cannot be called during a write transaction, or when the\n          containing Realm is read-only.\n @warning This method may only be called on a managed set.\n @warning Holding onto a frozen set for an extended period while performing\n          write transaction on the Realm may result in the Realm file growing\n          to large sizes. See `RLMRealmConfiguration.maximumNumberOfActiveVersions`\n          for more information.\n */\n- (instancetype)freeze;\n\n/**\n Returns a live version of this frozen collection.\n\n This method resolves a reference to a live copy of the same frozen collection.\n If called on a live collection, will return itself.\n*/\n- (instancetype)thaw;\n\n#pragma mark - Unavailable Methods\n\n/**\n `-[RLMSet init]` is not available because `RLMSet`s cannot be created directly.\n `RLMSet` properties on `RLMObject`s are lazily created when accessed.\n */\n- (instancetype)init __attribute__((unavailable(\"RLMSets cannot be created directly\")));\n\n/**\n `+[RLMSet new]` is not available because `RLMSet`s cannot be created directly.\n `RLMSet` properties on `RLMObject`s are lazily created when accessed.\n */\n+ (instancetype)new __attribute__((unavailable(\"RLMSet cannot be created directly\")));\n\n@end\n\n/// :nodoc:\n@interface RLMSet (Swift)\n// for use only in Swift class definitions\n- (instancetype)initWithObjectClassName:(NSString *)objectClassName;\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMSet.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMSet_Private.hpp\"\n\n#import \"RLMObjectSchema.h\"\n#import \"RLMObjectStore.h\"\n#import \"RLMObject_Private.h\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMQueryUtil.hpp\"\n#import \"RLMSchema_Private.h\"\n#import \"RLMSwiftSupport.h\"\n#import \"RLMThreadSafeReference_Private.hpp\"\n#import \"RLMUtil.hpp\"\n\n@interface RLMSet () <RLMThreadConfined_Private>\n@end\n\n@implementation RLMSet {\n@public\n    // Backing set when this instance is unmanaged\n    NSMutableOrderedSet *_backingCollection;\n}\n\n#pragma mark - Initializers\n\n- (instancetype)initWithObjectClassName:(__unsafe_unretained NSString *const)objectClassName\n                                keyType:(__unused RLMPropertyType)keyType {\n    return [self initWithObjectClassName:objectClassName];\n}\n- (instancetype)initWithObjectType:(RLMPropertyType)type\n                          optional:(BOOL)optional\n                           keyType:(__unused RLMPropertyType)keyType {\n    return [self initWithObjectType:type optional:optional];\n}\n\n- (instancetype)initWithObjectClassName:(__unsafe_unretained NSString *const)objectClassName {\n    REALM_ASSERT([objectClassName length] > 0);\n    self = [super init];\n    if (self) {\n        _objectClassName = objectClassName;\n        _type = RLMPropertyTypeObject;\n    }\n    return self;\n}\n\n- (instancetype)initWithObjectType:(RLMPropertyType)type optional:(BOOL)optional {\n    self = [super init];\n    if (self) {\n        _type = type;\n        _optional = optional;\n    }\n    return self;\n}\n\n- (void)setParent:(RLMObjectBase *)parentObject property:(RLMProperty *)property {\n    _parentObject = parentObject;\n    _property = property;\n    _isLegacyProperty = property.isLegacy;\n}\n\n#pragma mark - Convenience wrappers used for all RLMSet types\n\n- (void)addObjects:(id<NSFastEnumeration>)objects {\n    for (id obj in objects) {\n        [self addObject:obj];\n    }\n}\n\n- (void)addObject:(id)object {\n    RLMSetValidateMatchingObjectType(self, object);\n    changeSet(self, ^{\n        [_backingCollection addObject:object];\n    });\n}\n\n- (void)setObject:(id)newValue atIndexedSubscript:(NSUInteger)index {\n    REALM_TERMINATE(\"Replacing objects at an indexed subscript is not supported on RLMSet\");\n}\n\n- (void)setSet:(RLMSet<id> *)set {\n    for (id obj in set) {\n        RLMSetValidateMatchingObjectType(self, obj);\n    }\n    changeSet(self, ^{\n        [_backingCollection removeAllObjects];\n        [_backingCollection unionOrderedSet:set->_backingCollection];\n    });\n}\n\n- (void)intersectSet:(RLMSet<id> *)set {\n    for (id obj in set) {\n        RLMSetValidateMatchingObjectType(self, obj);\n    }\n    changeSet(self, ^{\n        [_backingCollection intersectOrderedSet:set->_backingCollection];\n    });\n}\n\n- (void)minusSet:(RLMSet<id> *)set {\n    for (id obj in set) {\n        RLMSetValidateMatchingObjectType(self, obj);\n    }\n    changeSet(self, ^{\n        [_backingCollection minusOrderedSet:set->_backingCollection];\n    });\n}\n\n- (void)unionSet:(RLMSet<id> *)set {\n    for (id obj in set) {\n        RLMSetValidateMatchingObjectType(self, obj);\n    }\n    changeSet(self, ^{\n        [_backingCollection unionOrderedSet:set->_backingCollection];\n    });\n}\n\n- (BOOL)isSubsetOfSet:(RLMSet<id> *)set {\n    for (id obj in set) {\n        RLMSetValidateMatchingObjectType(self, obj);\n    }\n    return [_backingCollection isSubsetOfOrderedSet:set->_backingCollection];\n}\n\n- (BOOL)intersectsSet:(RLMSet<id> *)set {\n    for (id obj in set) {\n        RLMSetValidateMatchingObjectType(self, obj);\n    }\n    return [_backingCollection intersectsOrderedSet:set->_backingCollection];\n}\n\n- (BOOL)containsObject:(id)obj {\n    RLMSetValidateMatchingObjectType(self, obj);\n    return [_backingCollection containsObject:obj];\n}\n\n- (BOOL)isEqualToSet:(RLMSet<id> *)set {\n    return [self isEqual:set];\n}\n\n- (RLMResults *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending {\n    return [self sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:keyPath ascending:ascending]]];\n}\n\n- (nonnull id)objectAtIndexedSubscript:(NSUInteger)index {\n    return [self objectAtIndex:index];\n}\n\n// The compiler complains about the method's argument type not matching due to\n// it not having the generic type attached, but it doesn't seem to be possible\n// to actually include the generic type\n// http://www.openradar.me/radar?id=6135653276319744\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wmismatched-parameter-types\"\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray *, RLMCollectionChange *, NSError *))block {\n    return RLMAddNotificationBlock(self, block, nil, nil);\n}\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray *, RLMCollectionChange *, NSError *))block\n                                         queue:(dispatch_queue_t)queue {\n    return RLMAddNotificationBlock(self, block, nil, queue);\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray *, RLMCollectionChange *, NSError *))block\n                                      keyPaths:(NSArray<NSString *> *)keyPaths {\n    return RLMAddNotificationBlock(self, block, keyPaths,nil);\n}\n\n- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray *, RLMCollectionChange *, NSError *))block\n                                      keyPaths:(NSArray<NSString *> *)keyPaths\n                                         queue:(dispatch_queue_t)queue {\n    return RLMAddNotificationBlock(self, block, keyPaths, queue);\n}\n#pragma clang diagnostic pop\n\n#pragma mark - Unmanaged RLMSet implementation\n\n- (RLMRealm *)realm {\n    return nil;\n}\n\n- (NSUInteger)count {\n    return _backingCollection.count;\n}\n\n- (NSArray<id> *)allObjects {\n    return _backingCollection.array;\n}\n\n// For use with \u0010MutableSet subscripting, NSSet does not support\n// subscripting while its Swift counterpart `Set` does.\n- (id)objectAtIndex:(NSUInteger)index {\n    validateSetBounds(self, index);\n    return _backingCollection[index];\n}\n\n- (NSArray *)objectsAtIndexes:(NSIndexSet *)indexes {\n    if ([indexes indexGreaterThanOrEqualToIndex:self.count] != NSNotFound) {\n        return nil;\n    }\n    return [_backingCollection objectsAtIndexes:indexes] ?: @[];\n}\n\n- (id)firstObject {\n    return _backingCollection.firstObject;\n}\n\n- (id)lastObject {\n    return _backingCollection.lastObject;\n}\n\n- (BOOL)isInvalidated {\n    return NO;\n}\n\n- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state\n                                  objects:(__unused __unsafe_unretained id [])buffer\n                                    count:(__unused NSUInteger)len {\n    return RLMUnmanagedFastEnumerate(_backingCollection, state);\n}\n\nstatic void changeSet(__unsafe_unretained RLMSet *const set,\n                      dispatch_block_t f) {\n    if (!set->_backingCollection) {\n        set->_backingCollection = [NSMutableOrderedSet new];\n    }\n\n    if (RLMObjectBase *parent = set->_parentObject) {\n        [parent willChangeValueForKey:set->_property.name];\n        f();\n        [parent didChangeValueForKey:set->_property.name];\n    }\n    else {\n        f();\n    }\n}\n\nstatic void validateSetBounds(__unsafe_unretained RLMSet *const set,\n                              NSUInteger index,\n                              bool allowOnePastEnd=false) {\n    NSUInteger max = set->_backingCollection.count + allowOnePastEnd;\n    if (index >= max) {\n        @throw RLMException(@\"Index %llu is out of bounds (must be less than %llu).\",\n                            (unsigned long long)index, (unsigned long long)max);\n    }\n}\n\n- (void)removeAllObjects {\n    changeSet(self, ^{\n        [_backingCollection removeAllObjects];\n    });\n}\n\n- (void)removeObject:(id)object {\n    RLMSetValidateMatchingObjectType(self, object);\n    changeSet(self, ^{\n        [_backingCollection removeObject:object];\n    });\n}\n\n- (void)replaceAllObjectsWithObjects:(NSArray *)objects {\n    changeSet(self, ^{\n        [_backingCollection removeAllObjects];\n        if (!objects || (id)objects == NSNull.null) {\n            return;\n        }\n        for (id object in objects) {\n            // object should always be non-nil since it's a value stored in a\n            // NSArray, but as of Xcode 16.3 [Decimal128?] sometimes ends up\n            // with nil instead of NSNull when bridged from Swift.\n            [_backingCollection addObject:object ?: NSNull.null];\n        }\n    });\n}\n\n- (RLMResults *)objectsWhere:(NSString *)predicateFormat, ... {\n    va_list args;\n    va_start(args, predicateFormat);\n    RLMResults *results = [self objectsWhere:predicateFormat args:args];\n    va_end(args);\n    return results;\n}\n\n- (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args {\n    return [self objectsWithPredicate:[NSPredicate predicateWithFormat:predicateFormat arguments:args]];\n}\n\n- (RLMPropertyType)typeForProperty:(NSString *)propertyName {\n    if ([propertyName isEqualToString:@\"self\"]) {\n        return _type;\n    }\n\n    RLMObjectSchema *objectSchema;\n    if (_backingCollection.count) {\n        objectSchema = [_backingCollection[0] objectSchema];\n    }\n    else {\n        objectSchema = [RLMSchema.partialPrivateSharedSchema schemaForClassName:_objectClassName];\n    }\n\n    return RLMValidatedProperty(objectSchema, propertyName).type;\n}\n\n- (id)aggregateProperty:(NSString *)key operation:(NSString *)op method:(SEL)sel {\n    // Although delegating to valueForKeyPath: here would allow to support\n    // nested key paths as well, limiting functionality gives consistency\n    // between unmanaged and managed arrays.\n    if ([key rangeOfString:@\".\"].location != NSNotFound) {\n        @throw RLMException(@\"Nested key paths are not supported yet for KVC collection operators.\");\n    }\n\n    if ([op isEqualToString:@\"@distinctUnionOfObjects\"]) {\n        @throw RLMException(@\"this class does not implement the distinctUnionOfObjects\");\n    }\n\n    bool allowDate = false;\n    bool sum = false;\n    if ([op isEqualToString:@\"@min\"] || [op isEqualToString:@\"@max\"]) {\n        allowDate = true;\n    }\n    else if ([op isEqualToString:@\"@sum\"]) {\n        sum = true;\n    }\n    else if (![op isEqualToString:@\"@avg\"]) {\n        // Just delegate to NSSet for all other operators\n        return [_backingCollection valueForKeyPath:[op stringByAppendingPathExtension:key]];\n    }\n\n    RLMPropertyType type = [self typeForProperty:key];\n    if (!canAggregate(type, allowDate)) {\n        NSString *method = sel ? NSStringFromSelector(sel) : op;\n        if (_type == RLMPropertyTypeObject) {\n            @throw RLMException(@\"%@: is not supported for %@ property '%@.%@'\",\n                                method, RLMTypeToString(type), _objectClassName, key);\n        }\n        else {\n            @throw RLMException(@\"%@ is not supported for %@%s set\",\n                                method, RLMTypeToString(_type), _optional ? \"?\" : \"\");\n        }\n    }\n\n    // `valueForKeyPath` on NSSet will only return distinct values, which is an\n    // issue as the realm::object_store::Set aggregate methods will calculate\n    // the result based on each element of a property regardless of uniqueness.\n    // To get around this we will need to use the `array` property of the NSMutableOrderedSet\n    NSArray *values = [key isEqualToString:@\"self\"] ? _backingCollection.array : [_backingCollection.array valueForKey:key];\n    if (_optional) {\n        // Filter out NSNull values to match our behavior on managed arrays\n        NSIndexSet *nonnull = [values indexesOfObjectsPassingTest:^BOOL(id obj, NSUInteger, BOOL *) {\n            return obj != NSNull.null;\n        }];\n        if (nonnull.count < values.count) {\n            values = [values objectsAtIndexes:nonnull];\n        }\n    }\n\n    id result = [values valueForKeyPath:[op stringByAppendingString:@\".self\"]];\n    return sum && !result ? @0 : result;\n}\n\nstatic NSSet *toUnorderedSet(id value) {\n    if (auto orderedSet = RLMDynamicCast<NSOrderedSet>(value)) {\n        return orderedSet.set;\n    }\n    return value;\n}\n\n- (id)valueForKeyPath:(NSString *)keyPath {\n    if ([keyPath characterAtIndex:0] != '@') {\n        return toUnorderedSet(_backingCollection ? [_backingCollection valueForKeyPath:keyPath] : [super valueForKeyPath:keyPath]);\n    }\n\n    if (!_backingCollection) {\n        _backingCollection = [NSMutableOrderedSet new];\n    }\n\n    NSUInteger dot = [keyPath rangeOfString:@\".\"].location;\n    if (dot == NSNotFound) {\n        return [_backingCollection valueForKeyPath:keyPath];\n    }\n\n    NSString *op = [keyPath substringToIndex:dot];\n    NSString *key = [keyPath substringFromIndex:dot + 1];\n    return [self aggregateProperty:key operation:op method:nil];\n}\n\n- (id)valueForKey:(NSString *)key {\n    if ([key isEqualToString:RLMInvalidatedKey]) {\n        return @NO; // Unmanaged sets are never invalidated\n    }\n    if (!_backingCollection) {\n        _backingCollection = [NSMutableOrderedSet new];\n    }\n    return toUnorderedSet([_backingCollection valueForKey:key]);\n}\n\n- (void)setValue:(id)value forKey:(NSString *)key {\n    if ([key isEqualToString:@\"self\"]) {\n        RLMSetValidateMatchingObjectType(self, value);\n        [_backingCollection removeAllObjects];\n        [_backingCollection addObject:value];\n        return;\n    }\n    else if (_type == RLMPropertyTypeObject) {\n        [_backingCollection setValue:value forKey:key];\n    }\n    else {\n        [self setValue:value forUndefinedKey:key];\n    }\n}\n\n- (id)minOfProperty:(NSString *)property {\n    return [self aggregateProperty:property operation:@\"@min\" method:_cmd];\n}\n\n- (id)maxOfProperty:(NSString *)property {\n    return [self aggregateProperty:property operation:@\"@max\" method:_cmd];\n}\n\n- (id)sumOfProperty:(NSString *)property {\n    return [self aggregateProperty:property operation:@\"@sum\" method:_cmd];\n}\n\n- (id)averageOfProperty:(NSString *)property {\n    return [self aggregateProperty:property operation:@\"@avg\" method:_cmd];\n}\n\n- (BOOL)isEqual:(id)object {\n    if (auto set = RLMDynamicCast<RLMSet>(object)) {\n        return !set.realm\n        && ((_backingCollection.count == 0 && set->_backingCollection.count == 0)\n            || [_backingCollection isEqual:set->_backingCollection]);\n    }\n    return NO;\n}\n\n- (void)addObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath\n            options:(NSKeyValueObservingOptions)options context:(void *)context {\n    RLMValidateSetObservationKey(keyPath, self);\n    [super addObserver:observer forKeyPath:keyPath options:options context:context];\n}\n\nvoid RLMSetValidateMatchingObjectType(__unsafe_unretained RLMSet *const set,\n                                      __unsafe_unretained id const value) {\n    if (!value && !set->_optional) {\n        @throw RLMException(@\"Invalid nil value for set of '%@'.\",\n                            set->_objectClassName ?: RLMTypeToString(set->_type));\n    }\n    if (set->_type != RLMPropertyTypeObject) {\n        if (!RLMValidateValue(value, set->_type, set->_optional, false, nil)) {\n            @throw RLMException(@\"Invalid value '%@' of type '%@' for expected type '%@%s'.\",\n                                value, [value class], RLMTypeToString(set->_type),\n                                set->_optional ? \"?\" : \"\");\n        }\n        return;\n    }\n\n    auto object = RLMDynamicCast<RLMObjectBase>(value);\n    if (!object) {\n        return;\n    }\n    if (!object->_objectSchema) {\n        @throw RLMException(@\"Object cannot be inserted unless the schema is initialized. \"\n                            \"This can happen if you try to insert objects into a RLMSet / Set from a default value or from an overriden unmanaged initializer (`init()`).\");\n    }\n    if (![set->_objectClassName isEqualToString:object->_objectSchema.className]\n        && (set->_type != RLMPropertyTypeAny)) {\n        @throw RLMException(@\"Object of type '%@' does not match RLMSet type '%@'.\",\n                            object->_objectSchema.className, set->_objectClassName);\n    }\n}\n\n#pragma mark - Key Path Strings\n\n- (NSString *)propertyKey {\n    return _property.name;\n}\n\n#pragma mark - Methods unsupported on unmanaged RLMSet instances\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wunused-parameter\"\n\n- (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate {\n    @throw RLMException(@\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n}\n\n- (RLMResults *)sortedResultsUsingDescriptors:(NSArray<RLMSortDescriptor *> *)properties {\n    @throw RLMException(@\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n}\n\n- (RLMResults *)distinctResultsUsingKeyPaths:(NSArray<NSString *> *)keyPaths {\n    @throw RLMException(@\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n}\n\n- (RLMSectionedResults *)sectionedResultsSortedUsingKeyPath:(NSString *)keyPath\n                                                  ascending:(BOOL)ascending\n                                                   keyBlock:(RLMSectionedResultsKeyBlock)keyBlock {\n    @throw RLMException(@\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n}\n\n- (RLMSectionedResults *)sectionedResultsUsingSortDescriptors:(NSArray<RLMSortDescriptor *> *)sortDescriptors\n                                                     keyBlock:(RLMSectionedResultsKeyBlock)keyBlock {\n    @throw RLMException(@\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n}\n\n- (instancetype)freeze {\n    @throw RLMException(@\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n}\n\n- (instancetype)thaw {\n    @throw RLMException(@\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n}\n\n#pragma mark - Thread Confined Protocol Conformance\n\n- (realm::ThreadSafeReference)makeThreadSafeReference {\n    REALM_TERMINATE(\"Unexpected handover of unmanaged `RLMSet`\");\n}\n\n- (id)objectiveCMetadata {\n    REALM_TERMINATE(\"Unexpected handover of unmanaged `RLMSet`\");\n}\n\n+ (instancetype)objectWithThreadSafeReference:(realm::ThreadSafeReference)reference\n                                     metadata:(id)metadata\n                                        realm:(RLMRealm *)realm {\n    REALM_TERMINATE(\"Unexpected handover of unmanaged `RLMSet`\");\n}\n\n#pragma clang diagnostic pop // unused parameter warning\n\n#pragma mark - Superclass Overrides\n\n- (NSString *)description {\n    return [self descriptionWithMaxDepth:RLMDescriptionMaxDepth];\n}\n\n- (NSString *)descriptionWithMaxDepth:(NSUInteger)depth {\n    return RLMDescriptionWithMaxDepth(@\"RLMSet\", self, depth);\n}\n@end\n"
  },
  {
    "path": "Realm/RLMSet_Private.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMSet.h>\n#import <Realm/RLMConstants.h>\n\n@class RLMObjectBase, RLMProperty;\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@interface RLMSet ()\n- (instancetype)initWithObjectClassName:(NSString *)objectClassName;\n- (instancetype)initWithObjectType:(RLMPropertyType)type optional:(BOOL)optional;\n- (NSString *)descriptionWithMaxDepth:(NSUInteger)depth;\n- (void)setParent:(RLMObjectBase *)parentObject property:(RLMProperty *)property;\n// YES if the property is declared with old property syntax.\n@property (nonatomic, readonly) BOOL isLegacyProperty;\n// The name of the property which this collection represents\n@property (nonatomic, readonly) NSString *propertyKey;\n@end\n\nvoid RLMSetValidateMatchingObjectType(RLMSet *set, id value);\n\n@interface RLMManagedSet : RLMSet\n- (instancetype)initWithParent:(RLMObjectBase *)parentObject property:(RLMProperty *)property;\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMSet_Private.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMSet_Private.h\"\n\n#import \"RLMCollection_Private.hpp\"\n\n#import \"RLMResults_Private.hpp\"\n\nnamespace realm {\nclass SetBase;\nclass CollectionBase;\n    namespace object_store {\n        class Set;\n    }\n}\n\n@class RLMObjectBase, RLMObjectSchema, RLMProperty;\nclass RLMClassInfo;\nclass RLMObservationInfo;\n\n@interface RLMSet () {\n@protected\n    NSString *_objectClassName;\n    RLMPropertyType _type;\n    BOOL _optional;\n@public\n    // The name of the property which this RLMSet represents\n    RLMProperty *_property;\n    __weak RLMObjectBase *_parentObject;\n}\n@end\n\n@interface RLMManagedSet () <RLMCollectionPrivate>\n\n- (RLMManagedSet *)initWithBackingCollection:(realm::object_store::Set)set\n                                  parentInfo:(RLMClassInfo *)parentInfo\n                                    property:(__unsafe_unretained RLMProperty *const)property;\n\n- (bool)isBackedBySet:(realm::object_store::Set const&)set;\n\n// deletes all objects in the RLMSet from their containing realms\n- (void)deleteObjectsFromRealm;\n\n@end\n\nvoid RLMValidateSetObservationKey(NSString *keyPath, RLMSet *set);\n\n// Initialize the observation info for a set if needed\nvoid RLMEnsureSetObservationInfo(std::unique_ptr<RLMObservationInfo>& info,\n                                 NSString *keyPath, RLMSet *set, id observed);\n"
  },
  {
    "path": "Realm/RLMSwiftBridgingHeader.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMArray.h>\n#import <Realm/RLMObject.h>\n\n@interface RLMRealm (Swift)\n+ (void)resetRealmState;\n@end\n\n@interface RLMArray (Swift)\n\n- (instancetype)initWithObjectClassName:(NSString *)objectClassName;\n\n- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args;\n- (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args;\n\n@end\n\n@interface RLMResults (Swift)\n\n- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args;\n- (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args;\n\n@end\n\n@interface RLMObjectBase (Swift)\n\n- (instancetype)initWithRealm:(RLMRealm *)realm schema:(RLMObjectSchema *)schema defaultValues:(BOOL)useDefaults;\n\n+ (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args;\n+ (RLMResults *)objectsInRealm:(RLMRealm *)realm where:(NSString *)predicateFormat args:(va_list)args;\n\n@end\n"
  },
  {
    "path": "Realm/RLMSwiftCollectionBase.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMCollection.h>\n\n@class RLMObjectBase, RLMResults, RLMProperty, RLMLinkingObjects;\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@interface RLMSwiftCollectionBase : NSProxy <NSFastEnumeration>\n@property (nonatomic, strong) id<RLMCollection> _rlmCollection;\n\n- (instancetype)init;\n+ (Class)_backingCollectionType;\n- (instancetype)initWithCollection:(id<RLMCollection>)collection;\n\n- (nullable id)valueForKey:(NSString *)key;\n- (nullable id)valueForKeyPath:(NSString *)keyPath;\n- (BOOL)isEqual:(nullable id)object;\n@end\n\n@interface RLMLinkingObjectsHandle : NSObject\n- (instancetype)initWithObject:(RLMObjectBase *)object property:(RLMProperty *)property;\n- (instancetype)initWithLinkingObjects:(RLMResults *)linkingObjects;\n\n@property (nonatomic, readonly) RLMLinkingObjects *results;\n@property (nonatomic, readonly) NSString *_propertyKey;\n@property (nonatomic, readonly) BOOL _isLegacyProperty;\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMSwiftCollectionBase.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMSwiftCollectionBase.h\"\n\n#import \"RLMArray_Private.hpp\"\n#import \"RLMObjectSchema_Private.h\"\n#import \"RLMObject_Private.hpp\"\n#import \"RLMObservation.hpp\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMSet_Private.hpp\"\n#import \"RLMDictionary_Private.hpp\"\n\n@interface RLMArray (KVO)\n- (NSArray *)objectsAtIndexes:(__unused NSIndexSet *)indexes;\n@end\n\n// Some of the things declared in the interface are handled by the proxy forwarding\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wincomplete-implementation\"\n\n@implementation RLMSwiftCollectionBase\n\n+ (id<RLMCollection>)_unmanagedCollection {\n    return nil;\n}\n\n+ (Class)_backingCollectionType {\n    REALM_UNREACHABLE();\n}\n\n- (instancetype)init {\n    return self;\n}\n\n- (instancetype)initWithCollection:(id<RLMCollection>)collection {\n    __rlmCollection = collection;\n    return self;\n}\n\n- (id<RLMCollection>)_rlmCollection {\n    if (!__rlmCollection) {\n        __rlmCollection = self.class._unmanagedCollection;\n    }\n    return __rlmCollection;\n}\n\n- (BOOL)isKindOfClass:(Class)aClass {\n    return [self._rlmCollection isKindOfClass:aClass] || RLMIsKindOfClass(object_getClass(self), aClass);\n}\n\n- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel {\n    return [(id)self._rlmCollection methodSignatureForSelector:sel];\n}\n\n- (void)forwardInvocation:(NSInvocation *)invocation {\n    [invocation invokeWithTarget:self._rlmCollection];\n}\n\n- (id)forwardingTargetForSelector:(__unused SEL)sel {\n    return self._rlmCollection;\n}\n\n- (BOOL)respondsToSelector:(SEL)aSelector {\n    return [self._rlmCollection respondsToSelector:aSelector];\n}\n\n- (void)doesNotRecognizeSelector:(SEL)aSelector {\n    [(id)self._rlmCollection doesNotRecognizeSelector:aSelector];\n}\n\n- (BOOL)isEqual:(id)object {\n    if (auto collection = RLMDynamicCast<RLMSwiftCollectionBase>(object)) {\n        if (!__rlmCollection) {\n            return !collection->__rlmCollection.realm && collection->__rlmCollection.count == 0;\n        }\n        return  [__rlmCollection isEqual:collection->__rlmCollection];\n    }\n    return NO;\n}\n\n- (BOOL)conformsToProtocol:(Protocol *)aProtocol {\n    return aProtocol == @protocol(NSFastEnumeration) || [self._rlmCollection conformsToProtocol:aProtocol];\n}\n\n@end\n\n#pragma clang diagnostic pop\n\n@implementation RLMLinkingObjectsHandle {\n    realm::TableKey _tableKey;\n    realm::ObjKey _objKey;\n    RLMClassInfo *_info;\n    RLMRealm *_realm;\n    RLMProperty *_property;\n\n    RLMResults *_results;\n}\n\n- (instancetype)initWithObject:(RLMObjectBase *)object property:(RLMProperty *)prop {\n    if (!(self = [super init])) {\n        return nil;\n    }\n    // KeyPath strings will invoke this initializer with an unmanaged object\n    // so guard against that.\n    if (object->_realm) {\n        auto& obj = object->_row;\n        _tableKey = obj.get_table()->get_key();\n        _objKey = obj.get_key();\n        _info = object->_info;\n        _realm = object->_realm;\n    }\n    _property = prop;\n\n    return self;\n}\n\n- (instancetype)initWithLinkingObjects:(RLMResults *)linkingObjects {\n    if (!(self = [super init])) {\n        return nil;\n    }\n    _realm = linkingObjects.realm;\n    _results = linkingObjects;\n\n    return self;\n}\n\n- (RLMResults *)results {\n    if (_results) {\n        return _results;\n    }\n    [_realm verifyThread];\n\n    auto table = _realm.group.get_table(_tableKey);\n    if (!table->is_valid(_objKey)) {\n        @throw RLMException(@\"Object has been deleted or invalidated.\");\n    }\n\n    auto obj = _realm.group.get_table(_tableKey)->get_object(_objKey);\n    auto& objectInfo = _realm->_info[_property.objectClassName];\n    auto& linkOrigin = _info->objectSchema->computed_properties[_property.index].link_origin_property_name;\n    auto linkingProperty = objectInfo.objectSchema->property_for_name(linkOrigin);\n    realm::Results results(_realm->_realm, obj.get_backlink_view(objectInfo.table(), linkingProperty->column_key));\n    _results = [RLMLinkingObjects resultsWithObjectInfo:objectInfo results:std::move(results)];\n    _realm = nil;\n    return _results;\n}\n\n- (NSString *)_propertyKey {\n    return _property.name;\n}\n\n- (BOOL)_isLegacyProperty {\n    return _property.isLegacy;\n}\n\n@end\n"
  },
  {
    "path": "Realm/RLMSwiftObject.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2023 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMObjectBase.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n/**\n `Object` is a class used to define Realm model objects.\n\n In Realm you define your model classes by subclassing `Object` and adding properties to be managed.\n You then instantiate and use your custom subclasses instead of using the `Object` class directly.\n\n ```swift\n class Dog: Object {\n @objc dynamic var name: String = \"\"\n @objc dynamic var adopted: Bool = false\n let siblings = List<Dog>()\n }\n ```\n\n ### Supported property types\n\n - `String`, `NSString`\n - `Int`\n - `Int8`, `Int16`, `Int32`, `Int64`\n - `Float`\n - `Double`\n - `Bool`\n - `Date`, `NSDate`\n - `Data`, `NSData`\n - `Decimal128`\n - `ObjectId`\n - `@objc enum` which has been delcared as conforming to `RealmEnum`.\n - `RealmOptional<Value>` for optional numeric properties\n - `Object` subclasses, to model many-to-one relationships\n - `EmbeddedObject` subclasses, to model owning one-to-one relationships\n - `List<Element>`, to model many-to-many relationships\n\n `String`, `NSString`, `Date`, `NSDate`, `Data`, `NSData`, `Decimal128`, and `ObjectId`  properties\n can be declared as optional. `Object` and `EmbeddedObject` subclasses *must* be declared as optional.\n `Int`, `Int8`, `Int16`, `Int32`, `Int64`, `Float`, `Double`, `Bool`,  enum, and `List` properties cannot.\n To store an optional number, use `RealmOptional<Int>`, `RealmOptional<Float>`, `RealmOptional<Double>`, or\n `RealmOptional<Bool>` instead, which wraps an optional numeric value. Lists cannot be optional at all.\n\n All property types except for `List` and `RealmOptional` *must* be declared as `@objc dynamic var`. `List` and\n `RealmOptional` properties must be declared as non-dynamic `let` properties. Swift `lazy` properties are not allowed.\n\n Note that none of the restrictions listed above apply to properties that are configured to be ignored by Realm.\n\n ### Querying\n\n You can retrieve all objects of a given type from a Realm by calling the `objects(_:)` instance method.\n\n ### Relationships\n\n See our [Objective-C guide](https://docs.mongodb.com/realm/sdk/swift/fundamentals/relationships/) for more details.\n */\n@interface RealmSwiftObject : RLMObjectBase\n@end\n\n/**\n `EmbeddedObject` is a base class used to define embedded Realm model objects.\n\n Embedded objects work similarly to normal objects, but are owned by a single\n parent Object (which itself may be embedded). Unlike normal top-level objects,\n embedded objects cannot be directly created in or added to a Realm. Instead,\n they can only be created as part of a parent object, or by assigning an\n unmanaged object to a parent object's property. Embedded objects are\n automatically deleted when the parent object is deleted or when the parent is\n modified to no longer point at the embedded object, either by reassigning an\n Object property or by removing the embedded object from the List containing it.\n\n Embedded objects can only ever have a single parent object which links to\n them, and attempting to link to an existing managed embedded object will throw\n an exception.\n\n The property types supported on `EmbeddedObject` are the same as for `Object`,\n except for that embedded objects cannot link to top-level objects, so `Object`\n and `List<Object>` properties are not supported (`EmbeddedObject` and\n `List<EmbeddedObject>` *are*).\n\n Embedded objects cannot have primary keys or indexed properties.\n\n ```swift\n class Owner: Object {\n @objc dynamic var name: String = \"\"\n let dogs = List<Dog>()\n }\n class Dog: EmbeddedObject {\n @objc dynamic var name: String = \"\"\n @objc dynamic var adopted: Bool = false\n let owner = LinkingObjects(fromType: Owner.self, property: \"dogs\")\n }\n ```\n */\n@interface RealmSwiftEmbeddedObject : RLMObjectBase\n@end\n\n/**\n `AsymmetricObject` is a base class used to define asymmetric Realm objects.\n\n Asymmetric objects can only be created using the `create(_ object:)`\n function, and cannot be added, removed or queried.\n When created, asymmetric objects will be synced unidirectionally to the MongoDB\n database and cannot be accessed locally.\n\n Incoming links from any asymmetric table are not allowed, meaning embedding\n an asymmetric object within an `Object` will throw an error.\n\n The property types supported on `AsymmetricObject` are the same as for `Object`,\n except for that asymmetric objects can only link to embedded objects, so `Object`\n and `List<Object>` properties are not supported (`EmbeddedObject` and\n `List<EmbeddedObject>` *are*).\n\n ```swift\n class Person: AsymmetricObject {\n     @Persisted(primaryKey: true) var _id: ObjectId = ObjectId.generate()\n     @Persisted var name: String\n     @Persisted var age: Int\n }\n ```\n */\n@interface RealmSwiftAsymmetricObject : RLMObjectBase\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n\n"
  },
  {
    "path": "Realm/RLMSwiftProperty.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Foundation/Foundation.h>\n#import <stdint.h>\n\n@class RLMObjectBase, RLMArray, RLMSet;\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nRLM_HEADER_AUDIT_BEGIN(nullability)\n\n#define REALM_FOR_EACH_SWIFT_PRIMITIVE_TYPE(macro) \\\n    macro(bool, Bool, bool) \\\n    macro(double, Double, double) \\\n    macro(float, Float, float) \\\n    macro(int64_t, Int64, int)\n\n#define REALM_FOR_EACH_SWIFT_OBJECT_TYPE(macro) \\\n    macro(NSString, String, string) \\\n    macro(NSDate, Date, date) \\\n    macro(NSData, Data, data) \\\n    macro(NSUUID, UUID, uuid) \\\n    macro(RLMDecimal128, Decimal128, decimal128) \\\n    macro(RLMObjectId, ObjectId, objectId)\n\n#define REALM_SWIFT_PROPERTY_ACCESSOR(objc, swift, rlmtype) \\\n    objc RLMGetSwiftProperty##swift(RLMObjectBase *, uint16_t); \\\n    objc RLMGetSwiftProperty##swift##Optional(RLMObjectBase *, uint16_t, bool *); \\\n    void RLMSetSwiftProperty##swift(RLMObjectBase *, uint16_t, objc);\nREALM_FOR_EACH_SWIFT_PRIMITIVE_TYPE(REALM_SWIFT_PROPERTY_ACCESSOR)\n#undef REALM_SWIFT_PROPERTY_ACCESSOR\n\n#define REALM_SWIFT_PROPERTY_ACCESSOR(objc, swift, rlmtype) \\\n    objc *_Nullable RLMGetSwiftProperty##swift(RLMObjectBase *, uint16_t); \\\n    void RLMSetSwiftProperty##swift(RLMObjectBase *, uint16_t, objc *_Nullable);\nREALM_FOR_EACH_SWIFT_OBJECT_TYPE(REALM_SWIFT_PROPERTY_ACCESSOR)\n#undef REALM_SWIFT_PROPERTY_ACCESSOR\n\nid<RLMValue> _Nullable RLMGetSwiftPropertyAny(RLMObjectBase *, uint16_t);\nvoid RLMSetSwiftPropertyAny(RLMObjectBase *, uint16_t, id<RLMValue>);\nRLMObjectBase *_Nullable RLMGetSwiftPropertyObject(RLMObjectBase *, uint16_t);\nvoid RLMSetSwiftPropertyNil(RLMObjectBase *, uint16_t);\nvoid RLMSetSwiftPropertyObject(RLMObjectBase *, uint16_t, RLMObjectBase *_Nullable);\n\nRLMArray *_Nonnull RLMGetSwiftPropertyArray(RLMObjectBase *obj, uint16_t);\nRLMSet *_Nonnull RLMGetSwiftPropertySet(RLMObjectBase *obj, uint16_t);\nRLMDictionary *_Nonnull RLMGetSwiftPropertyMap(RLMObjectBase *obj, uint16_t);\n\nRLM_HEADER_AUDIT_END(nullability)\n\n#ifdef __cplusplus\n} // extern \"C\"\n#endif\n"
  },
  {
    "path": "Realm/RLMSwiftSupport.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMCollection.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@interface RLMSwiftSupport : NSObject\n\n+ (BOOL)isSwiftClassName:(NSString *)className;\n+ (NSString *)demangleClassName:(NSString *)className;\n\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMSwiftSupport.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMSwiftSupport.h\"\n\n@implementation RLMSwiftSupport\n\n+ (BOOL)isSwiftClassName:(NSString *)className {\n    return [className rangeOfString:@\".\"].location != NSNotFound;\n}\n\n+ (NSString *)demangleClassName:(NSString *)className {\n    return [className substringFromIndex:[className rangeOfString:@\".\"].location + 1];\n}\n\n@end\n"
  },
  {
    "path": "Realm/RLMSwiftValueStorage.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@class RLMObjectBase, RLMProperty;\n\n/// This class implements the backing storage for `RealmProperty<>` and `RealmOptional<>`.\n/// This class should not be subclassed or used directly.\n@interface RLMSwiftValueStorage : NSProxy\n- (instancetype)init;\n@end\n/// Retrieves the value that is stored, or nil if it is empty.\nFOUNDATION_EXTERN id _Nullable RLMGetSwiftValueStorage(RLMSwiftValueStorage *);\n/// Sets a value on the property this instance represents for an object.\nFOUNDATION_EXTERN void RLMSetSwiftValueStorage(RLMSwiftValueStorage *, id _Nullable);\n\n/// Initialises managed accessors on an instance of `RLMSwiftValueStorage`\n/// @param parent The enclosing parent object.\n/// @param prop The property which this class represents.\nFOUNDATION_EXTERN void RLMInitializeManagedSwiftValueStorage(RLMSwiftValueStorage *,\n                                                             RLMObjectBase *parent,\n                                                             RLMProperty *prop);\n\n/// Initialises unmanaged accessors on an instance of `RLMSwiftValueStorage`\n/// @param parent The enclosing parent object.\n/// @param prop The property which this class represents.\nFOUNDATION_EXTERN void RLMInitializeUnmanagedSwiftValueStorage(RLMSwiftValueStorage *,\n                                                               RLMObjectBase *parent,\n                                                               RLMProperty *prop);\n\n/// Gets the property name for the RealmProperty instance. This is required for tracing the key path on\n/// objects that use the legacy property declaration syntax.\nFOUNDATION_EXTERN NSString *RLMSwiftValueStorageGetPropertyName(RLMSwiftValueStorage *);\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMSwiftValueStorage.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMSwiftValueStorage.h\"\n\n#import \"RLMAccessor.hpp\"\n#import \"RLMObject_Private.hpp\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/object-store/object.hpp>\n\nnamespace {\nstruct SwiftValueStorageBase {\n    virtual id get() = 0;\n    virtual void set(id) = 0;\n    virtual NSString *propertyName() = 0;\n    virtual ~SwiftValueStorageBase() = default;\n};\n\nclass UnmanagedSwiftValueStorage : public SwiftValueStorageBase {\npublic:\n    id get() override {\n        return _value;\n    }\n\n    void set(__unsafe_unretained const id newValue) override {\n        @autoreleasepool {\n            RLMObjectBase *object = _parent;\n            [object willChangeValueForKey:_property];\n            _value = newValue;\n            [object didChangeValueForKey:_property];\n        }\n    }\n\n    void attach(__unsafe_unretained RLMObjectBase *const obj, NSString *property) {\n        if (!_property) {\n            _property = property;\n            _parent = obj;\n        }\n    }\n\n    NSString *propertyName() override {\n        return _property;\n    }\n\nprivate:\n    id _value;\n    NSString *_property;\n    __weak RLMObjectBase *_parent;\n\n};\n\nclass ManagedSwiftValueStorage : public SwiftValueStorageBase {\npublic:\n    ManagedSwiftValueStorage(RLMObjectBase *obj, RLMProperty *prop)\n    : _realm(obj->_realm)\n    , _object(obj->_realm->_realm, *obj->_info->objectSchema, obj->_row)\n    , _columnName(prop.columnName.UTF8String)\n    , _ctx(obj, &obj->_info->objectSchema->persisted_properties[prop.index])\n    {\n    }\n\n    id get() override {\n        return _object.get_property_value<id>(_ctx, _columnName);\n    }\n\n    void set(__unsafe_unretained id const value) override {\n        _object.set_property_value(_ctx, _columnName, value ?: NSNull.null);\n    }\n\n    NSString *propertyName() override {\n        // Should never be called on a managed object.\n        REALM_UNREACHABLE();\n    }\n\nprivate:\n    // We have to hold onto a strong reference to the Realm as\n    // RLMAccessorContext holds a non-retaining one.\n    __unused RLMRealm *_realm;\n    realm::Object _object;\n    std::string _columnName;\n    RLMAccessorContext _ctx;\n};\n} // anonymous namespace\n\n@interface RLMSwiftValueStorage () {\n    std::unique_ptr<SwiftValueStorageBase> _impl;\n}\n@end\n\n@implementation RLMSwiftValueStorage\n- (instancetype)init {\n    return self;\n}\n\n- (BOOL)isKindOfClass:(Class)aClass {\n    return [RLMGetSwiftValueStorage(self) isKindOfClass:aClass] || RLMIsKindOfClass(object_getClass(self), aClass);\n}\n\n- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel {\n    return [RLMGetSwiftValueStorage(self) methodSignatureForSelector:sel];\n}\n\n- (void)forwardInvocation:(NSInvocation *)invocation {\n    [invocation invokeWithTarget:RLMGetSwiftValueStorage(self)];\n}\n\n- (id)forwardingTargetForSelector:(__unused SEL)sel {\n    return RLMGetSwiftValueStorage(self);\n}\n\n- (BOOL)respondsToSelector:(SEL)aSelector {\n    return [RLMGetSwiftValueStorage(self) respondsToSelector:aSelector];\n}\n\n- (void)doesNotRecognizeSelector:(SEL)aSelector {\n    [RLMGetSwiftValueStorage(self) doesNotRecognizeSelector:aSelector];\n}\n\nid RLMGetSwiftValueStorage(__unsafe_unretained RLMSwiftValueStorage *const self) {\n    try {\n        return self->_impl ? RLMCoerceToNil(self->_impl->get()) : nil;\n    }\n    catch (std::exception const& err) {\n        @throw RLMException(err);\n    }\n}\n\nvoid RLMSetSwiftValueStorage(__unsafe_unretained RLMSwiftValueStorage *const self, __unsafe_unretained const id value) {\n    try {\n        if (!self->_impl && value) {\n            self->_impl.reset(new UnmanagedSwiftValueStorage);\n        }\n        if (self->_impl) {\n            self->_impl->set(value);\n        }\n    }\n    catch (std::exception const& err) {\n        @throw RLMException(err);\n    }\n}\n\nvoid RLMInitializeManagedSwiftValueStorage(__unsafe_unretained RLMSwiftValueStorage *const self,\n                                  __unsafe_unretained RLMObjectBase *const parent,\n                                  __unsafe_unretained RLMProperty *const prop) {\n    REALM_ASSERT(parent->_realm);\n    self->_impl.reset(new ManagedSwiftValueStorage(parent, prop));\n}\n\nvoid RLMInitializeUnmanagedSwiftValueStorage(__unsafe_unretained RLMSwiftValueStorage *const self,\n                                    __unsafe_unretained RLMObjectBase *const parent,\n                                    __unsafe_unretained RLMProperty *const prop) {\n    if (parent->_realm) {\n        return;\n    }\n    if (!self->_impl) {\n        self->_impl.reset(new UnmanagedSwiftValueStorage);\n    }\n    static_cast<UnmanagedSwiftValueStorage&>(*self->_impl).attach(parent, prop.name);\n}\n\nNSString *RLMSwiftValueStorageGetPropertyName(RLMSwiftValueStorage *const self) {\n    return self->_impl->propertyName();\n}\n\n@end\n"
  },
  {
    "path": "Realm/RLMThreadSafeReference.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2016 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n\n@class RLMRealm;\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n/**\n Objects of types which conform to `RLMThreadConfined` can be managed by a Realm, which will make\n them bound to a thread-specific `RLMRealm` instance. Managed objects must be explicitly exported\n and imported to be passed between threads.\n\n Managed instances of objects conforming to this protocol can be converted to a thread-safe\n reference for transport between threads by passing to the\n `+[RLMThreadSafeReference referenceWithThreadConfined:]` constructor.\n\n Note that only types defined by Realm can meaningfully conform to this protocol, and defining new\n classes which attempt to conform to it will not make them work with `RLMThreadSafeReference`.\n */\n@protocol RLMThreadConfined <NSObject>\n// Conformance to the `RLMThreadConfined_Private` protocol will be enforced at runtime.\n\n/**\n The Realm which manages the object, or `nil` if the object is unmanaged.\n\n Unmanaged objects are not confined to a thread and cannot be passed to methods expecting a\n `RLMThreadConfined` object.\n */\n@property (nonatomic, readonly, nullable) RLMRealm *realm;\n\n/// Indicates if the object can no longer be accessed because it is now invalid.\n@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated;\n\n@end\n\n/**\n An object intended to be passed between threads containing a thread-safe reference to its\n thread-confined object.\n\n To resolve a thread-safe reference on a target Realm on a different thread, pass to\n `-[RLMRealm resolveThreadSafeReference:]`.\n\n @warning A `RLMThreadSafeReference` object must be resolved at most once.\n          Failing to resolve a `RLMThreadSafeReference` will result in the source version of the\n          Realm being pinned until the reference is deallocated.\n\n @note Prefer short-lived `RLMThreadSafeReference`s as the data for the version of the source Realm\n       will be retained until all references have been resolved or deallocated.\n\n @see `RLMThreadConfined`\n @see `-[RLMRealm resolveThreadSafeReference:]`\n */\nNS_SWIFT_SENDABLE RLM_FINAL // is internally thread-safe\n@interface RLMThreadSafeReference<__covariant Confined : id<RLMThreadConfined>> : NSObject\n\n/**\n Create a thread-safe reference to the thread-confined object.\n\n @param threadConfined The thread-confined object to create a thread-safe reference to.\n\n @note You may continue to use and access the thread-confined object after passing it to this\n       constructor.\n */\n+ (instancetype)referenceWithThreadConfined:(Confined)threadConfined;\n\n/**\n Indicates if the reference can no longer be resolved because an attempt to resolve it has already\n occurred. References can only be resolved once.\n */\n@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated;\n\n#pragma mark - Unavailable Methods\n\n/**\n `-[RLMThreadSafeReference init]` is not available because `RLMThreadSafeReference` cannot be\n created directly. `RLMThreadSafeReference` instances must be obtained by calling\n `-[RLMRealm resolveThreadSafeReference:]`.\n */\n- (instancetype)init __attribute__((unavailable(\"RLMThreadSafeReference cannot be created directly\")));\n\n/**\n `-[RLMThreadSafeReference new]` is not available because `RLMThreadSafeReference` cannot be\n created directly. `RLMThreadSafeReference` instances must be obtained by calling\n `-[RLMRealm resolveThreadSafeReference:]`.\n */\n+ (instancetype)new __attribute__((unavailable(\"RLMThreadSafeReference cannot be created directly\")));\n\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMThreadSafeReference.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2016 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMThreadSafeReference_Private.hpp\"\n#import \"RLMUtil.hpp\"\n\n@implementation RLMThreadSafeReference {\n    realm::ThreadSafeReference _reference;\n    id _metadata;\n    Class _type;\n}\n\n- (instancetype)initWithThreadConfined:(id<RLMThreadConfined>)threadConfined {\n    if (!(self = [super init])) {\n        return nil;\n    }\n\n    REALM_ASSERT_DEBUG([threadConfined conformsToProtocol:@protocol(RLMThreadConfined)]);\n    if (![threadConfined conformsToProtocol:@protocol(RLMThreadConfined_Private)]) {\n        @throw RLMException(@\"Illegal custom conformance to `RLMThreadConfined` by `%@`\", threadConfined.class);\n    } else if (threadConfined.invalidated) {\n        @throw RLMException(@\"Cannot construct reference to invalidated object\");\n    } else if (!threadConfined.realm) {\n        @throw RLMException(@\"Cannot construct reference to unmanaged object, \"\n                            \"which can be passed across threads directly\");\n    }\n\n    RLMTranslateError([&] {\n        _reference = [(id<RLMThreadConfined_Private>)threadConfined makeThreadSafeReference];\n        _metadata = ((id<RLMThreadConfined_Private>)threadConfined).objectiveCMetadata;\n    });\n    _type = threadConfined.class;\n\n    return self;\n}\n\n+ (instancetype)referenceWithThreadConfined:(id<RLMThreadConfined>)threadConfined {\n    return [[self alloc] initWithThreadConfined:threadConfined];\n}\n\n- (id<RLMThreadConfined>)resolveReferenceInRealm:(RLMRealm *)realm {\n    if (!_reference) {\n        @throw RLMException(@\"Can only resolve a thread safe reference once.\");\n    }\n    return RLMTranslateError([&] {\n        return [_type objectWithThreadSafeReference:std::move(_reference) metadata:_metadata realm:realm];\n    });\n}\n\n- (BOOL)isInvalidated {\n    return !_reference;\n}\n\n@end\n"
  },
  {
    "path": "Realm/RLMThreadSafeReference_Private.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2016 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMThreadSafeReference.h\"\n\n#import <realm/object-store/thread_safe_reference.hpp>\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\nRLM_HIDDEN\n@protocol RLMThreadConfined_Private <NSObject>\n\n// Constructs a new `ThreadSafeReference`\n- (realm::ThreadSafeReference)makeThreadSafeReference;\n\n// The extra information needed to construct an instance of this type from the Object Store type\n@property (nonatomic, readonly, nullable) id objectiveCMetadata;\n\n// Constructs an new instance of this type\n+ (nullable instancetype)objectWithThreadSafeReference:(realm::ThreadSafeReference)reference\n                                              metadata:(nullable id)metadata\n                                                 realm:(RLMRealm *)realm;\n@end\n\nRLM_DIRECT_MEMBERS\n@interface RLMThreadSafeReference ()\n- (nullable id<RLMThreadConfined>)resolveReferenceInRealm:(RLMRealm *)realm;\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMUUID.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMUUID_Private.hpp\"\n\n#import <realm/uuid.hpp>\n\n@implementation NSUUID (RLMUUIDSupport)\n\n- (instancetype)initWithRealmUUID:(realm::UUID)rUuid {\n    self = [self initWithUUIDBytes:rUuid.to_bytes().data()];\n    return self;\n}\n\n- (realm::UUID)rlm_uuidValue {\n    return realm::UUID(self.UUIDString.UTF8String);\n}\n\n@end\n"
  },
  {
    "path": "Realm/RLMUUID_Private.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or utilied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMProperty.h\"\n\nnamespace realm {\nclass UUID;\n}\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n@interface NSUUID (RLMUUIDSupport) <RLMUUID>\n- (instancetype)initWithRealmUUID:(realm::UUID)uuidValue;\n- (realm::UUID)rlm_uuidValue;\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/RLMUtil.hpp",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMConstants.h>\n#import <Realm/RLMSwiftValueStorage.h>\n#import <Realm/RLMValue.h>\n\n#import <realm/array.hpp>\n#import <realm/binary_data.hpp>\n#import <realm/object-store/object.hpp>\n#import <realm/string_data.hpp>\n#import <realm/timestamp.hpp>\n#import <realm/util/file.hpp>\n\n#import <objc/runtime.h>\n#import <os/lock.h>\n\nnamespace realm {\nclass Decimal128;\nclass Exception;\nclass Mixed;\n}\n\nclass RLMClassInfo;\n\n@class RLMObjectSchema;\n@class RLMProperty;\n\n__attribute__((format(NSString, 1, 2)))\nNSException *RLMException(NSString *fmt, ...);\nNSException *RLMException(std::exception const& exception);\nNSException *RLMException(realm::Exception const& exception);\n\nvoid RLMSetErrorOrThrow(NSError *error, NSError **outError);\n\nRLM_HIDDEN_BEGIN\n\n// returns if the object can be inserted as the given type\nBOOL RLMIsObjectValidForProperty(id obj, RLMProperty *prop);\n// throw an exception if the object is not a valid value for the property\nvoid RLMValidateValueForProperty(id obj, RLMObjectSchema *objectSchema,\n                                 RLMProperty *prop, bool validateObjects=false);\nid RLMValidateValue(id value, RLMPropertyType type, bool optional, bool collection,\n                    NSString *objectClassName);\n\nvoid RLMThrowTypeError(id obj, RLMObjectSchema *objectSchema, RLMProperty *prop);\n\n// gets default values for the given schema (+defaultPropertyValues)\n// merges with native property defaults if Swift class\nNSDictionary *RLMDefaultValuesForObjectSchema(RLMObjectSchema *objectSchema);\n\nBOOL RLMIsDebuggerAttached();\nBOOL RLMIsRunningInPlayground();\n\n// C version of isKindOfClass\nstatic inline BOOL RLMIsKindOfClass(Class class1, Class class2) {\n    while (class1) {\n        if (class1 == class2) return YES;\n        class1 = class_getSuperclass(class1);\n    }\n    return NO;\n}\n\ntemplate<typename T>\nstatic inline T *RLMDynamicCast(__unsafe_unretained id obj) {\n    if ([obj isKindOfClass:[T class]]) {\n        return obj;\n    }\n    return nil;\n}\n\nstatic inline id RLMCoerceToNil(__unsafe_unretained id obj) {\n    if (static_cast<id>(obj) == NSNull.null) {\n        return nil;\n    }\n    else if (__unsafe_unretained auto optional = RLMDynamicCast<RLMSwiftValueStorage>(obj)) {\n        return RLMCoerceToNil(RLMGetSwiftValueStorage(optional));\n    }\n    return obj;\n}\n\ntemplate<typename T>\nstatic inline T RLMCoerceToNil(__unsafe_unretained T obj) {\n    return RLMCoerceToNil(static_cast<id>(obj));\n}\n\nid<NSFastEnumeration> RLMAsFastEnumeration(id obj);\nid RLMBridgeSwiftValue(id obj);\n\nbool RLMIsSwiftObjectClass(Class cls);\n\n// String conversion utilities\nstatic inline NSString *RLMStringDataToNSString(realm::StringData stringData) {\n    static_assert(sizeof(NSUInteger) >= sizeof(size_t),\n                  \"Need runtime overflow check for size_t to NSUInteger conversion\");\n    if (stringData.is_null()) {\n        return nil;\n    }\n    else {\n        return [[NSString alloc] initWithBytes:stringData.data()\n                                        length:stringData.size()\n                                      encoding:NSUTF8StringEncoding];\n    }\n}\n\nstatic inline NSString *RLMStringViewToNSString(std::string_view stringView) {\n    if (stringView.size() == 0) {\n        return nil;\n    }\n    return [[NSString alloc] initWithBytes:stringView.data()\n                                    length:stringView.size()\n                                  encoding:NSUTF8StringEncoding];\n}\n\nstatic inline realm::StringData RLMStringDataWithNSString(__unsafe_unretained NSString *const string) {\n    static_assert(sizeof(size_t) >= sizeof(NSUInteger),\n                  \"Need runtime overflow check for NSUInteger to size_t conversion\");\n    return realm::StringData(string.UTF8String,\n                             [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);\n}\n\n// Binary conversion utilities\nstatic inline NSData *RLMBinaryDataToNSData(realm::BinaryData binaryData) {\n    return binaryData ? [NSData dataWithBytes:binaryData.data() length:binaryData.size()] : nil;\n}\n\nstatic inline realm::BinaryData RLMBinaryDataForNSData(__unsafe_unretained NSData *const data) {\n    // this is necessary to ensure that the empty NSData isn't treated by core as the null realm::BinaryData\n    // because data.bytes == 0 when data.length == 0\n    // the casting bit ensures that we create a data with a non-null pointer\n    auto bytes = static_cast<const char *>(data.bytes) ?: static_cast<char *>((__bridge void *)data);\n    return realm::BinaryData(bytes, data.length);\n}\n\n// Date conversion utilities\n// These use the reference date and shift the seconds rather than just getting\n// the time interval since the epoch directly to avoid losing sub-second precision\nstatic inline NSDate *RLMTimestampToNSDate(realm::Timestamp ts) NS_RETURNS_RETAINED {\n    if (ts.is_null())\n        return nil;\n    auto timeInterval = ts.get_seconds() - NSTimeIntervalSince1970 + ts.get_nanoseconds() / 1'000'000'000.0;\n    return [[NSDate alloc] initWithTimeIntervalSinceReferenceDate:timeInterval];\n}\n\nstatic inline realm::Timestamp RLMTimestampForNSDate(__unsafe_unretained NSDate *const date) {\n    if (!date)\n        return {};\n    auto timeInterval = date.timeIntervalSinceReferenceDate;\n    if (isnan(timeInterval))\n        return {0, 0}; // Arbitrary choice\n\n    // Clamp dates that we can't represent as a Timestamp to the maximum value\n    if (timeInterval >= std::numeric_limits<int64_t>::max() - NSTimeIntervalSince1970)\n        return {std::numeric_limits<int64_t>::max(), 1'000'000'000 - 1};\n    if (timeInterval - NSTimeIntervalSince1970 < std::numeric_limits<int64_t>::min())\n        return {std::numeric_limits<int64_t>::min(), -1'000'000'000 + 1};\n\n    auto seconds = static_cast<int64_t>(timeInterval);\n    auto nanoseconds = static_cast<int32_t>((timeInterval - seconds) * 1'000'000'000.0);\n    seconds += static_cast<int64_t>(NSTimeIntervalSince1970);\n\n    // Seconds and nanoseconds have to have the same sign\n    if (nanoseconds < 0 && seconds > 0) {\n        nanoseconds += 1'000'000'000;\n        --seconds;\n    }\n    return {seconds, nanoseconds};\n}\n\nstatic inline NSUInteger RLMConvertNotFound(size_t index) {\n    return index == realm::not_found ? NSNotFound : index;\n}\n\nstatic inline void RLMNSStringToStdString(std::string &out, NSString *in) {\n    if (!in)\n        return;\n    \n    out.resize([in maximumLengthOfBytesUsingEncoding:NSUTF8StringEncoding]);\n    if (out.empty()) {\n        return;\n    }\n\n    NSUInteger size = out.size();\n    [in getBytes:&out[0]\n       maxLength:size\n      usedLength:&size\n        encoding:NSUTF8StringEncoding\n         options:0 range:{0, in.length} remainingRange:nullptr];\n    out.resize(size);\n}\nrealm::Mixed RLMObjcToMixed(__unsafe_unretained id const value,\n                            __unsafe_unretained RLMRealm *const realm=nil,\n                            realm::CreatePolicy createPolicy={});\nrealm::Mixed RLMObjcToMixedPrimitives(__unsafe_unretained id const value,\n                                      __unsafe_unretained RLMRealm *const realm,\n                                      realm::CreatePolicy createPolicy);\nid RLMMixedToObjc(realm::Mixed const& value,\n                  __unsafe_unretained RLMRealm *realm=nil,\n                  RLMClassInfo *classInfo=nullptr,\n                  RLMProperty *property=nullptr,\n                  realm::Obj obj={});\n\nrealm::Decimal128 RLMObjcToDecimal128(id value);\nrealm::UUID RLMObjcToUUID(__unsafe_unretained id const value);\n\n// Given a bundle identifier, return the base directory on the disk within which Realm database and support files should\n// be stored.\nFOUNDATION_EXTERN RLM_VISIBLE\nNSString *RLMDefaultDirectoryForBundleIdentifier(NSString *bundleIdentifier);\n\n// Get a NSDateFormatter for ISO8601-formatted strings\nNSDateFormatter *RLMISO8601Formatter();\n\ntemplate<typename Fn>\nstatic auto RLMTranslateError(Fn&& fn) {\n    try {\n        return fn();\n    }\n    catch (std::exception const& e) {\n        @throw RLMException(e);\n    }\n}\n\nstatic inline bool numberIsInteger(__unsafe_unretained NSNumber *const obj) {\n    char data_type = [obj objCType][0];\n    return data_type == *@encode(bool) ||\n           data_type == *@encode(char) ||\n           data_type == *@encode(short) ||\n           data_type == *@encode(int) ||\n           data_type == *@encode(long) ||\n           data_type == *@encode(long long) ||\n           data_type == *@encode(unsigned short) ||\n           data_type == *@encode(unsigned int) ||\n           data_type == *@encode(unsigned long) ||\n           data_type == *@encode(unsigned long long);\n}\n\nstatic inline bool numberIsBool(__unsafe_unretained NSNumber *const obj) {\n    // @encode(BOOL) is 'B' on iOS 64 and 'c'\n    // objcType is always 'c'. Therefore compare to \"c\".\n    if ([obj objCType][0] == 'c') {\n        return true;\n    }\n\n    if (numberIsInteger(obj)) {\n        int value = [obj intValue];\n        return value == 0 || value == 1;\n    }\n\n    return false;\n}\n\nstatic inline bool numberIsFloat(__unsafe_unretained NSNumber *const obj) {\n    char data_type = [obj objCType][0];\n    return data_type == *@encode(float) ||\n           data_type == *@encode(short) ||\n           data_type == *@encode(int) ||\n           data_type == *@encode(long) ||\n           data_type == *@encode(long long) ||\n           data_type == *@encode(unsigned short) ||\n           data_type == *@encode(unsigned int) ||\n           data_type == *@encode(unsigned long) ||\n           data_type == *@encode(unsigned long long) ||\n           // A double is like float if it fits within float bounds or is NaN.\n           (data_type == *@encode(double) && (ABS([obj doubleValue]) <= FLT_MAX || isnan([obj doubleValue])));\n}\n\nstatic inline bool numberIsDouble(__unsafe_unretained NSNumber *const obj) {\n    char data_type = [obj objCType][0];\n    return data_type == *@encode(double) ||\n           data_type == *@encode(float) ||\n           data_type == *@encode(short) ||\n           data_type == *@encode(int) ||\n           data_type == *@encode(long) ||\n           data_type == *@encode(long long) ||\n           data_type == *@encode(unsigned short) ||\n           data_type == *@encode(unsigned int) ||\n           data_type == *@encode(unsigned long) ||\n           data_type == *@encode(unsigned long long);\n}\n\nclass RLMUnfairMutex {\npublic:\n    RLMUnfairMutex() = default;\n\n    void lock() noexcept {\n        os_unfair_lock_lock(&_lock);\n    }\n\n    bool try_lock() noexcept {\n        return os_unfair_lock_trylock(&_lock);\n    }\n\n    void unlock() noexcept {\n        os_unfair_lock_unlock(&_lock);\n    }\n\nprivate:\n    os_unfair_lock _lock = OS_UNFAIR_LOCK_INIT;\n    RLMUnfairMutex(RLMUnfairMutex const&) = delete;\n    RLMUnfairMutex& operator=(RLMUnfairMutex const&) = delete;\n};\n\nRLM_HIDDEN_END\n"
  },
  {
    "path": "Realm/RLMUtil.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMUtil.hpp\"\n\n#import \"RLMArray_Private.hpp\"\n#import \"RLMAccessor.hpp\"\n#import \"RLMDecimal128_Private.hpp\"\n#import \"RLMDictionary_Private.hpp\"\n#import \"RLMError_Private.hpp\"\n#import \"RLMObjectId_Private.hpp\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMObjectStore.h\"\n#import \"RLMObject_Private.hpp\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMSwiftValueStorage.h\"\n#import \"RLMSchema_Private.h\"\n#import \"RLMSet_Private.hpp\"\n#import \"RLMSwiftCollectionBase.h\"\n#import \"RLMSwiftSupport.h\"\n#import \"RLMUUID_Private.hpp\"\n#import \"RLMValue.h\"\n\n#import <realm/mixed.hpp>\n#import <realm/data_type.hpp>\n#import <realm/util/overload.hpp>\n\n#include <sys/sysctl.h>\n#include <sys/types.h>\n\n#if !defined(REALM_COCOA_VERSION)\n#import \"RLMVersion.h\"\n#endif\n\nstatic inline RLMArray *asRLMArray(__unsafe_unretained id const value) {\n    return RLMDynamicCast<RLMArray>(value) ?: (RLMArray *)RLMDynamicCast<RLMSwiftCollectionBase>(value)._rlmCollection;\n}\n\nstatic inline RLMSet *asRLMSet(__unsafe_unretained id const value) {\n    return RLMDynamicCast<RLMSet>(value) ?: RLMDynamicCast<RLMSwiftCollectionBase>(value)._rlmCollection;\n}\n\nstatic inline RLMDictionary *asRLMDictionary(__unsafe_unretained id const value) {\n    return RLMDynamicCast<RLMDictionary>(value) ?: (RLMDictionary *)RLMDynamicCast<RLMSwiftCollectionBase>(value)._rlmCollection;\n}\n\nstatic inline bool checkCollectionType(__unsafe_unretained id<RLMCollection> const collection,\n                                  RLMPropertyType type,\n                                  bool optional,\n                                  __unsafe_unretained NSString *const objectClassName) {\n    return collection.type == type && collection.optional == optional\n        && (type != RLMPropertyTypeObject || [collection.objectClassName isEqualToString:objectClassName]);\n}\n\nstatic id (*s_bridgeValue)(id);\nid<NSFastEnumeration> RLMAsFastEnumeration(__unsafe_unretained id obj) {\n    if (!obj) {\n        return nil;\n    }\n    if ([obj conformsToProtocol:@protocol(NSFastEnumeration)]) {\n        return obj;\n    }\n    if (s_bridgeValue) {\n        id bridged = s_bridgeValue(obj);\n        if ([bridged conformsToProtocol:@protocol(NSFastEnumeration)]) {\n            return bridged;\n        }\n    }\n    return nil;\n}\n\nvoid RLMSetSwiftBridgeCallback(id (*callback)(id)) {\n    s_bridgeValue = callback;\n}\n\nid RLMBridgeSwiftValue(__unsafe_unretained id value) {\n    if (!value || !s_bridgeValue) {\n        return nil;\n    }\n    return s_bridgeValue(value);\n}\n\nbool RLMIsSwiftObjectClass(Class cls) {\n    return [cls isSubclassOfClass:RealmSwiftObject.class]\n        || [cls isSubclassOfClass:RealmSwiftEmbeddedObject.class];\n}\n\nstatic BOOL validateValue(__unsafe_unretained id const value,\n                          RLMPropertyType type,\n                          bool optional,\n                          bool collection,\n                          __unsafe_unretained NSString *const objectClassName) {\n    if (optional && !RLMCoerceToNil(value)) {\n        return YES;\n    }\n\n    if (collection) {\n        if (auto rlmArray = asRLMArray(value)) {\n            return checkCollectionType(rlmArray, type, optional, objectClassName);\n        }\n        else if (auto rlmSet = asRLMSet(value)) {\n            return checkCollectionType(rlmSet, type, optional, objectClassName);\n        }\n        else if (auto rlmDictionary = asRLMDictionary(value)) {\n            return checkCollectionType(rlmDictionary, type, optional, objectClassName);\n        }\n        if (id enumeration = RLMAsFastEnumeration(value)) {\n            // check each element for compliance\n            for (id el in enumeration) {\n                if (!RLMValidateValue(el, type, optional, false, objectClassName)) {\n                    return NO;\n                }\n            }\n            return YES;\n        }\n        if (!value || value == NSNull.null) {\n            return YES;\n        }\n        return NO;\n    }\n\n    switch (type) {\n        case RLMPropertyTypeString:\n            return [value isKindOfClass:[NSString class]];\n        case RLMPropertyTypeBool:\n            if ([value isKindOfClass:[NSNumber class]]) {\n                return numberIsBool(value);\n            }\n            return NO;\n        case RLMPropertyTypeDate:\n            return [value isKindOfClass:[NSDate class]];\n        case RLMPropertyTypeInt:\n            if (NSNumber *number = RLMDynamicCast<NSNumber>(value)) {\n                return numberIsInteger(number);\n            }\n            return NO;\n        case RLMPropertyTypeFloat:\n            if (NSNumber *number = RLMDynamicCast<NSNumber>(value)) {\n                return numberIsFloat(number);\n            }\n            return NO;\n        case RLMPropertyTypeDouble:\n            if (NSNumber *number = RLMDynamicCast<NSNumber>(value)) {\n                return numberIsDouble(number);\n            }\n            return NO;\n        case RLMPropertyTypeData:\n            return [value isKindOfClass:[NSData class]];\n        case RLMPropertyTypeAny: {\n            return !value\n                || [value conformsToProtocol:@protocol(RLMValue)];\n        }\n        case RLMPropertyTypeLinkingObjects:\n            return YES;\n        case RLMPropertyTypeObject: {\n            // only NSNull, nil, or objects which derive from RLMObject and match the given\n            // object class are valid\n            RLMObjectBase *objBase = RLMDynamicCast<RLMObjectBase>(value);\n            return objBase && [objBase->_objectSchema.className isEqualToString:objectClassName];\n        }\n        case RLMPropertyTypeObjectId:\n            return [value isKindOfClass:[RLMObjectId class]];\n        case RLMPropertyTypeDecimal128:\n            return [value isKindOfClass:[NSNumber class]]\n                || [value isKindOfClass:[RLMDecimal128 class]]\n                || ([value isKindOfClass:[NSString class]] && realm::Decimal128::is_valid_str([value UTF8String]));\n        case RLMPropertyTypeUUID:\n            return [value isKindOfClass:[NSUUID class]]\n                || ([value isKindOfClass:[NSString class]] && realm::UUID::is_valid_string([value UTF8String]));\n    }\n    @throw RLMException(@\"Invalid RLMPropertyType specified\");\n}\n\nid RLMValidateValue(__unsafe_unretained id const value,\n                    RLMPropertyType type, bool optional, bool collection,\n                    __unsafe_unretained NSString *const objectClassName) {\n    if (validateValue(value, type, optional, collection, objectClassName)) {\n        return value ?: NSNull.null;\n    }\n    if (id bridged = RLMBridgeSwiftValue(value)) {\n        if (validateValue(bridged, type, optional, collection, objectClassName)) {\n            return bridged ?: NSNull.null;\n        }\n    }\n    return nil;\n }\n\n\nvoid RLMThrowTypeError(__unsafe_unretained id const obj,\n                       __unsafe_unretained RLMObjectSchema *const objectSchema,\n                       __unsafe_unretained RLMProperty *const prop) {\n    @throw RLMException(@\"Invalid value '%@' of type '%@' for '%@%s'%s property '%@.%@'.\",\n                        obj, [obj class],\n                        prop.objectClassName ?: RLMTypeToString(prop.type), prop.optional ? \"?\" : \"\",\n                        prop.array ? \" array\" : prop.set ? \" set\" : prop.dictionary ? \" dictionary\" : \"\", objectSchema.className, prop.name);\n}\n\nvoid RLMValidateValueForProperty(__unsafe_unretained id const obj,\n                                 __unsafe_unretained RLMObjectSchema *const objectSchema,\n                                 __unsafe_unretained RLMProperty *const prop,\n                                 bool validateObjects) {\n    // This duplicates a lot of the checks in RLMIsObjectValidForProperty()\n    // for the sake of more specific error messages\n    if (prop.collection) {\n        // nil is considered equivalent to an empty array for historical reasons\n        // since we don't support null arrays (only arrays containing null),\n        // it's not worth the BC break to change this\n        if (!obj || obj == NSNull.null) {\n            return;\n        }\n        id enumeration = RLMAsFastEnumeration(obj);\n        if (!enumeration) {\n            @throw RLMException(@\"Invalid value (%@) for '%@%s' %@ property '%@.%@': value is not enumerable.\",\n                                obj,\n                                prop.objectClassName ?: RLMTypeToString(prop.type),\n                                prop.optional ? \"?\" : \"\",\n                                prop.array ? @\"array\" : @\"set\",\n                                objectSchema.className, prop.name);\n        }\n        if (!validateObjects && prop.type == RLMPropertyTypeObject) {\n            return;\n        }\n\n        if (RLMArray *array = asRLMArray(obj)) {\n            if (!checkCollectionType(array, prop.type, prop.optional, prop.objectClassName)) {\n                @throw RLMException(@\"RLMArray<%@%s> does not match expected type '%@%s' for property '%@.%@'.\",\n                                    array.objectClassName ?: RLMTypeToString(array.type), array.optional ? \"?\" : \"\",\n                                    prop.objectClassName ?: RLMTypeToString(prop.type), prop.optional ? \"?\" : \"\",\n                                    objectSchema.className, prop.name);\n            }\n            return;\n        }\n        else if (RLMSet *set = asRLMSet(obj)) {\n            if (!checkCollectionType(set, prop.type, prop.optional, prop.objectClassName)) {\n                @throw RLMException(@\"RLMSet<%@%s> does not match expected type '%@%s' for property '%@.%@'.\",\n                                    set.objectClassName ?: RLMTypeToString(set.type), set.optional ? \"?\" : \"\",\n                                    prop.objectClassName ?: RLMTypeToString(prop.type), prop.optional ? \"?\" : \"\",\n                                    objectSchema.className, prop.name);\n            }\n            return;\n        }\n        else if (RLMDictionary *dictionary = asRLMDictionary(obj)) {\n            if (!checkCollectionType(dictionary, prop.type, prop.optional, prop.objectClassName)) {\n                @throw RLMException(@\"RLMDictionary<%@, %@%s> does not match expected type '%@%s' for property '%@.%@'.\",\n                                    RLMTypeToString(dictionary.keyType),\n                                    dictionary.objectClassName ?: RLMTypeToString(dictionary.type), dictionary.optional ? \"?\" : \"\",\n                                    prop.objectClassName ?: RLMTypeToString(prop.type), prop.optional ? \"?\" : \"\",\n                                    objectSchema.className, prop.name);\n            }\n            return;\n        }\n\n        if (prop.dictionary) {\n            for (id key in enumeration) {\n                id value = enumeration[key];\n                if (!RLMValidateValue(value, prop.type, prop.optional, false, prop.objectClassName)) {\n                    RLMThrowTypeError(value, objectSchema, prop);\n                }\n            }\n        }\n        else {\n            for (id value in enumeration) {\n                if (!RLMValidateValue(value, prop.type, prop.optional, false, prop.objectClassName)) {\n                    RLMThrowTypeError(value, objectSchema, prop);\n                }\n            }\n        }\n        return;\n    }\n\n    // For create() we want to skip the validation logic for objects because\n    // we allow much fuzzier matching (any KVC-compatible object with at least\n    // all the non-defaulted fields), and all the logic for that lives in the\n    // object store rather than here\n    if (prop.type == RLMPropertyTypeObject && !validateObjects) {\n        return;\n    }\n    \n    if (RLMIsObjectValidForProperty(obj, prop)) {\n        return;\n    }\n\n    RLMThrowTypeError(obj, objectSchema, prop);\n}\n\nBOOL RLMIsObjectValidForProperty(__unsafe_unretained id const obj,\n                                 __unsafe_unretained RLMProperty *const property) {\n    return RLMValidateValue(obj, property.type, property.optional, property.collection, property.objectClassName) != nil;\n}\n\nNSDictionary *RLMDefaultValuesForObjectSchema(__unsafe_unretained RLMObjectSchema *const objectSchema) {\n    if (!objectSchema.isSwiftClass) {\n        return [objectSchema.objectClass defaultPropertyValues];\n    }\n\n    NSMutableDictionary *defaults = nil;\n    if ([objectSchema.objectClass isSubclassOfClass:RLMObject.class]) {\n        defaults = [NSMutableDictionary dictionaryWithDictionary:[objectSchema.objectClass defaultPropertyValues]];\n    }\n    else {\n        defaults = [NSMutableDictionary dictionary];\n    }\n    RLMObject *defaultObject = [[objectSchema.objectClass alloc] init];\n    for (RLMProperty *prop in objectSchema.properties) {\n        if (!defaults[prop.name] && defaultObject[prop.name]) {\n            defaults[prop.name] = defaultObject[prop.name];\n        }\n    }\n    return defaults;\n}\n\nstatic NSException *RLMException(NSString *reason, NSDictionary *additionalUserInfo) {\n    NSMutableDictionary *userInfo = @{RLMRealmVersionKey: REALM_COCOA_VERSION,\n                                      RLMRealmCoreVersionKey: @REALM_VERSION}.mutableCopy;\n    if (additionalUserInfo != nil) {\n        [userInfo addEntriesFromDictionary:additionalUserInfo];\n    }\n    NSException *e = [NSException exceptionWithName:RLMExceptionName\n                                             reason:reason\n                                           userInfo:userInfo];\n    return e;\n}\n\nNSException *RLMException(NSString *fmt, ...) {\n    va_list args;\n    va_start(args, fmt);\n    NSException *e = RLMException([[NSString alloc] initWithFormat:fmt arguments:args], @{});\n    va_end(args);\n    return e;\n}\n\nNSException *RLMException(std::exception const& exception) {\n    return RLMException(@\"%s\", exception.what());\n}\n\nNSException *RLMException(realm::Exception const& exception) {\n    return RLMException(@(exception.what()),\n                        @{@\"Error Code\": @(exception.code()),\n                          @\"Underlying\": makeError(exception.to_status())});\n}\n\nvoid RLMSetErrorOrThrow(NSError *error, NSError **outError) {\n    if (outError) {\n        *outError = error;\n    }\n    else {\n        @throw RLMException(error.localizedDescription, @{NSUnderlyingErrorKey: error});\n    }\n}\n\nBOOL RLMIsDebuggerAttached()\n{\n    int name[] = {\n        CTL_KERN,\n        KERN_PROC,\n        KERN_PROC_PID,\n        getpid()\n    };\n\n    struct kinfo_proc info;\n    size_t info_size = sizeof(info);\n    if (sysctl(name, sizeof(name)/sizeof(name[0]), &info, &info_size, NULL, 0) == -1) {\n        NSLog(@\"sysctl() failed: %s\", strerror(errno));\n        return false;\n    }\n\n    return (info.kp_proc.p_flag & P_TRACED) != 0;\n}\n\nBOOL RLMIsRunningInPlayground() {\n    return [[NSBundle mainBundle].bundleIdentifier hasPrefix:@\"com.apple.dt.playground.\"];\n}\n\nrealm::Mixed RLMObjcToMixed(__unsafe_unretained id const value,\n                            __unsafe_unretained RLMRealm *const realm,\n                            realm::CreatePolicy createPolicy) {\n    if (!value || value == NSNull.null) {\n        return realm::Mixed();\n    }\n    id v;\n    if ([value conformsToProtocol:@protocol(RLMValue)]) {\n        v = value;\n    }\n    else {\n        v = RLMBridgeSwiftValue(value);\n        if (v == NSNull.null) {\n            return realm::Mixed();\n        }\n        REALM_ASSERT([v conformsToProtocol:@protocol(RLMValue)]);\n    }\n    \n    switch ([v rlm_anyValueType]) {\n        case RLMAnyValueTypeList:\n            return realm::Mixed(0, realm::CollectionType::List);\n        case RLMAnyValueTypeDictionary:\n            return realm::Mixed(0, realm::CollectionType::Dictionary);\n        default:\n            return RLMObjcToMixedPrimitives(v, realm, createPolicy);\n    }\n}\n\nrealm::Mixed RLMObjcToMixedPrimitives(__unsafe_unretained id const value,\n                                      __unsafe_unretained RLMRealm *const realm,\n                                      realm::CreatePolicy createPolicy) {\n    RLMAnyValueType type = [value rlm_anyValueType];\n    return switch_on_type(static_cast<realm::PropertyType>(type), realm::util::overload{[&](realm::Obj*) {\n        // The RLMObjectBase may be unmanaged and therefore has no RLMClassInfo attached.\n        // So we fetch from the Realm instead.\n        // If the Object is managed use it's RLMClassInfo instead so we do not have to do a\n        // lookup in the table of schemas.\n        RLMObjectBase *objBase = value;\n        RLMAccessorContext c{objBase->_info ? *objBase->_info : realm->_info[objBase->_objectSchema.className]};\n        auto obj = c.unbox<realm::Obj>(value, createPolicy);\n        return obj.is_valid() ? realm::Mixed(obj) : realm::Mixed();\n    }, [&]<typename T>(T *) {\n        RLMStatelessAccessorContext c;\n        return realm::Mixed(c.unbox<T>(value));\n    }, [&](realm::Mixed*) -> realm::Mixed {\n        REALM_UNREACHABLE();\n    }});\n}\n\nid RLMMixedToObjc(realm::Mixed const& mixed,\n                  __unsafe_unretained RLMRealm *realm,\n                  RLMClassInfo *classInfo,\n                  RLMProperty *property,\n                  realm::Obj obj) {\n    if (mixed.is_null()) {\n        return NSNull.null;\n    }\n    switch (mixed.get_type()) {\n        case realm::type_String:\n            return RLMStringDataToNSString(mixed.get_string());\n        case realm::type_Int:\n            return @(mixed.get_int());\n        case realm::type_Float:\n            return @(mixed.get_float());\n        case realm::type_Double:\n            return @(mixed.get_double());\n        case realm::type_Bool:\n            return @(mixed.get_bool());\n        case realm::type_Timestamp:\n            return RLMTimestampToNSDate(mixed.get_timestamp());\n        case realm::type_Binary:\n            return RLMBinaryDataToNSData(mixed.get<realm::BinaryData>());\n        case realm::type_Decimal:\n            return [[RLMDecimal128 alloc] initWithDecimal128:mixed.get<realm::Decimal128>()];\n        case realm::type_ObjectId:\n            return [[RLMObjectId alloc] initWithValue:mixed.get<realm::ObjectId>()];\n        case realm::type_TypedLink:\n            return RLMObjectFromObjLink(realm, mixed.get<realm::ObjLink>(), classInfo->isSwiftClass());\n        case realm::type_Link: {\n            auto obj = classInfo->table()->get_object((mixed).get<realm::ObjKey>());\n            return RLMCreateObjectAccessor(*classInfo, std::move(obj));\n        }\n        case realm::type_UUID:\n            return [[NSUUID alloc] initWithRealmUUID:mixed.get<realm::UUID>()];\n        default:\n            if (mixed.is_type(realm::type_Dictionary)) {\n                return [[RLMManagedDictionary alloc] initWithParent:obj property:property parentInfo:*classInfo];\n            }\n            else if (mixed.is_type(realm::type_List)) {\n                return [[RLMManagedArray alloc] initWithParent:obj property:property parentInfo:*classInfo];\n            }\n            else {\n                @throw RLMException(@\"Invalid data type for RLMPropertyTypeAny property.\");\n            }\n    }\n}\n\nrealm::UUID RLMObjcToUUID(__unsafe_unretained id const value) {\n    try {\n        if (auto uuid = RLMDynamicCast<NSUUID>(value)) {\n            return uuid.rlm_uuidValue;\n        }\n        if (auto string = RLMDynamicCast<NSString>(value)) {\n            return realm::UUID(string.UTF8String);\n        }\n    }\n    catch (std::exception const& e) {\n        @throw RLMException(@\"Cannot convert value '%@' of type '%@' to uuid: %s\",\n                            value, [value class], e.what());\n    }\n    @throw RLMException(@\"Cannot convert value '%@' of type '%@' to uuid\", value, [value class]);\n}\n\nrealm::Decimal128 RLMObjcToDecimal128(__unsafe_unretained id const value) {\n    try {\n        if (!value || value == NSNull.null) {\n            return realm::Decimal128(realm::null());\n        }\n        if (auto decimal = RLMDynamicCast<RLMDecimal128>(value)) {\n            return decimal.decimal128Value;\n        }\n        if (auto string = RLMDynamicCast<NSString>(value)) {\n            return realm::Decimal128(string.UTF8String);\n        }\n        if (auto decimal = RLMDynamicCast<NSDecimalNumber>(value)) {\n            return realm::Decimal128(decimal.stringValue.UTF8String);\n        }\n        if (auto number = RLMDynamicCast<NSNumber>(value)) {\n            auto type = number.objCType[0];\n            if (type == *@encode(double) || type == *@encode(float)) {\n                return realm::Decimal128(number.doubleValue);\n            }\n            else if (std::isupper(type)) {\n                return realm::Decimal128(number.unsignedLongLongValue);\n            }\n            else {\n                return realm::Decimal128(number.longLongValue);\n            }\n        }\n        if (id bridged = RLMBridgeSwiftValue(value); bridged != value) {\n            return RLMObjcToDecimal128(bridged);\n        }\n    }\n    catch (std::exception const& e) {\n        @throw RLMException(@\"Cannot convert value '%@' of type '%@' to decimal128: %s\",\n                            value, [value class], e.what());\n    }\n    @throw RLMException(@\"Cannot convert value '%@' of type '%@' to decimal128\", value, [value class]);\n}\n\nNSString *RLMDefaultDirectoryForBundleIdentifier(NSString *bundleIdentifier) {\n#if TARGET_OS_TV\n    (void)bundleIdentifier;\n    // tvOS prohibits writing to the Documents directory, so we use the Library/Caches directory instead.\n    return NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)[0];\n#elif TARGET_OS_IPHONE && !TARGET_OS_MACCATALYST\n    (void)bundleIdentifier;\n    // On iOS the Documents directory isn't user-visible, so put files there\n    return NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];\n#else\n    // On OS X it is, so put files in Application Support. If we aren't running\n    // in a sandbox, put it in a subdirectory based on the bundle identifier\n    // to avoid accidentally sharing files between applications\n    NSString *path = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES)[0];\n    if (![[NSProcessInfo processInfo] environment][@\"APP_SANDBOX_CONTAINER_ID\"]) {\n        if (!bundleIdentifier) {\n            bundleIdentifier = [NSBundle mainBundle].bundleIdentifier;\n        }\n        if (!bundleIdentifier) {\n            bundleIdentifier = [NSBundle mainBundle].executablePath.lastPathComponent;\n        }\n\n        path = [path stringByAppendingPathComponent:bundleIdentifier];\n\n        // create directory\n        [[NSFileManager defaultManager] createDirectoryAtPath:path\n                                  withIntermediateDirectories:YES\n                                                   attributes:nil\n                                                        error:nil];\n    }\n    return path;\n#endif\n}\n\nNSDateFormatter *RLMISO8601Formatter() {\n    // note: NSISO8601DateFormatter can't be used as it doesn't support milliseconds\n    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];\n    dateFormatter.locale = [NSLocale localeWithLocaleIdentifier:@\"en_US_POSIX\"];\n    dateFormatter.dateFormat = @\"yyyy-MM-dd'T'HH:mm:ss.SSSZ\";\n    dateFormatter.calendar = [NSCalendar calendarWithIdentifier:NSCalendarIdentifierGregorian];\n    return dateFormatter;\n}\n"
  },
  {
    "path": "Realm/RLMValue.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/RLMArray.h>\n#import <Realm/RLMConstants.h>\n#import <Realm/RLMDecimal128.h>\n#import <Realm/RLMDictionary.h>\n#import <Realm/RLMObject.h>\n#import <Realm/RLMObjectBase.h>\n#import <Realm/RLMObjectId.h>\n#import <Realm/RLMProperty.h>\n\n#pragma mark RLMValue\n\n/**\n RLMValue is a property type which represents a polymorphic Realm value. This is similar to the usage of\n `AnyObject` / `Any` in Swift.\n```\n // A property on `MyObject`\n @property (nonatomic) id<RLMValue> myAnyValue;\n\n // A property on `AnotherObject`\n @property (nonatomic) id<RLMValue> myAnyValue;\n\n MyObject *myObject = [MyObject createInRealm:realm withValue:@[]];\n myObject.myAnyValue = @1234; // underlying type is NSNumber.\n myObject.myAnyValue = @\"hello\"; // underlying type is NSString.\n AnotherObject *anotherObject = [AnotherObject createInRealm:realm withValue:@[]];\n myObject.myAnyValue = anotherObject; // underlying type is RLMObject.\n```\n The following types conform to RLMValue:\n\n `NSData`\n `NSDate`\n `NSNull`\n `NSNumber`\n `NSUUID`\n `NSString`\n `RLMObject\n `RLMObjectId`\n `RLMDecimal128`\n `RLMDictionary`\n `RLMArray`\n `NSArray`\n `NSDictionary`\n */\n@protocol RLMValue\n\n/// Describes the type of property stored.\n@property (readonly) RLMAnyValueType rlm_valueType __attribute__((deprecated(\"Use `rlm_anyValueType` instead, which includes collection types as well\")));\n/// Describes the type of property stored.\n@property (readonly) RLMAnyValueType rlm_anyValueType;\n\n@end\n\n/// :nodoc:\n@interface NSNull (RLMValue)<RLMValue>\n@end\n\n/// :nodoc:\n@interface NSNumber (RLMValue)<RLMValue>\n@end\n\n/// :nodoc:\n@interface NSString (RLMValue)<RLMValue>\n@end\n\n/// :nodoc:\n@interface NSData (RLMValue)<RLMValue>\n@end\n\n/// :nodoc:\n@interface NSDate (RLMValue)<RLMValue>\n@end\n\n/// :nodoc:\n@interface NSUUID (RLMValue)<RLMValue>\n@end\n\n/// :nodoc:\n@interface RLMDecimal128 (RLMValue)<RLMValue>\n@end\n\n/// :nodoc:\n@interface RLMObjectBase (RLMValue)<RLMValue>\n@end\n\n/// :nodoc:\n@interface RLMObjectId (RLMValue)<RLMValue>\n@end\n\n/// :nodoc:\n@interface NSDictionary (RLMValue)<RLMValue>\n@end\n\n/// :nodoc:\n@interface NSArray (RLMValue)<RLMValue>\n@end\n\n/// :nodoc:\n@interface RLMArray (RLMValue)<RLMValue>\n@end\n\n/// :nodoc:\n@interface RLMDictionary (RLMValue)<RLMValue>\n@end\n"
  },
  {
    "path": "Realm/RLMValue.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMValue.h\"\n#import \"RLMUtil.hpp\"\n\n#pragma mark NSData\n\n@implementation NSData (RLMValue)\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-implementations\"\n- (RLMPropertyType)rlm_valueType {\n    return RLMPropertyTypeData;\n}\n#pragma clang diagnostic pop\n\n- (RLMAnyValueType)rlm_anyValueType {\n    return RLMAnyValueTypeData;\n}\n\n@end\n\n#pragma mark NSDate\n\n@implementation NSDate (RLMValue)\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-implementations\"\n- (RLMPropertyType)rlm_valueType {\n    return RLMPropertyTypeDate;\n}\n#pragma clang diagnostic pop\n\n- (RLMAnyValueType)rlm_anyValueType {\n    return RLMAnyValueTypeDate;\n}\n\n@end\n\n#pragma mark NSNumber\n\n@implementation NSNumber (RLMValue)\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-implementations\"\n- (RLMPropertyType)rlm_valueType {\n    if ([self objCType][0] == 'c' && (self.intValue == 0 || self.intValue == 1)) {\n        return RLMPropertyTypeBool;\n    }\n    else if (numberIsInteger(self)) {\n        return RLMPropertyTypeInt;\n    }\n    else if (*@encode(float) == [self objCType][0]) {\n        return RLMPropertyTypeFloat;\n    }\n    else if (*@encode(double) == [self objCType][0]) {\n        return RLMPropertyTypeDouble;\n    }\n    else {\n        @throw RLMException(@\"Unknown numeric type on type RLMValue.\");\n    }\n}\n#pragma clang diagnostic pop\n\n- (RLMAnyValueType)rlm_anyValueType {\n    if ([self objCType][0] == 'c' && (self.intValue == 0 || self.intValue == 1)) {\n        return RLMAnyValueTypeBool;\n    }\n    else if (numberIsInteger(self)) {\n        return RLMAnyValueTypeInt;\n    }\n    else if (*@encode(float) == [self objCType][0]) {\n        return RLMAnyValueTypeFloat;\n    }\n    else if (*@encode(double) == [self objCType][0]) {\n        return RLMAnyValueTypeDouble;\n    }\n    else {\n        @throw RLMException(@\"Unknown numeric type on type RLMValue.\");\n    }\n}\n\n@end\n\n#pragma mark NSNull\n\n@implementation NSNull (RLMValue)\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-implementations\"\n- (RLMPropertyType)rlm_valueType {\n    return RLMPropertyTypeAny;\n}\n#pragma clang diagnostic pop\n\n- (RLMAnyValueType)rlm_anyValueType {\n    return RLMAnyValueTypeAny;\n}\n\n@end\n\n#pragma mark NSString\n\n@implementation NSString (RLMValue)\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-implementations\"\n- (RLMPropertyType)rlm_valueType {\n    return RLMPropertyTypeString;\n}\n#pragma clang diagnostic pop\n\n- (RLMAnyValueType)rlm_anyValueType {\n    return RLMAnyValueTypeString;\n}\n\n@end\n\n#pragma mark NSUUID\n\n@implementation NSUUID (RLMValue)\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-implementations\"\n- (RLMPropertyType)rlm_valueType {\n    return RLMPropertyTypeUUID;\n}\n#pragma clang diagnostic pop\n\n- (RLMAnyValueType)rlm_anyValueType {\n    return RLMAnyValueTypeUUID;\n}\n\n@end\n\n#pragma mark RLMDecimal128\n\n@implementation RLMDecimal128 (RLMValue)\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-implementations\"\n- (RLMPropertyType)rlm_valueType {\n    return RLMPropertyTypeDecimal128;\n}\n#pragma clang diagnostic pop\n\n- (RLMAnyValueType)rlm_anyValueType {\n    return RLMAnyValueTypeDecimal128;\n}\n\n@end\n\n#pragma mark RLMObjectBase\n\n@implementation RLMObjectBase (RLMValue)\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-implementations\"\n- (RLMPropertyType)rlm_valueType {\n    return RLMPropertyTypeObject;\n}\n#pragma clang diagnostic pop\n\n- (RLMAnyValueType)rlm_anyValueType {\n    return RLMAnyValueTypeObject;\n}\n\n@end\n\n#pragma mark RLMObjectId\n\n@implementation RLMObjectId (RLMValue)\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-implementations\"\n- (RLMPropertyType)rlm_valueType {\n    return RLMPropertyTypeObjectId;\n}\n#pragma clang diagnostic pop\n\n- (RLMAnyValueType)rlm_anyValueType {\n    return RLMAnyValueTypeObjectId;\n}\n\n@end\n\n#pragma mark Dictionary\n\n@implementation NSDictionary (RLMValue)\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-implementations\"\n- (RLMPropertyType)rlm_valueType {\n    return RLMPropertyTypeAny;\n}\n#pragma clang diagnostic pop\n\n- (RLMAnyValueType)rlm_anyValueType {\n    return RLMAnyValueTypeDictionary;\n}\n\n@end\n\n@implementation RLMDictionary (RLMValue)\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-implementations\"\n- (RLMPropertyType)rlm_valueType { return RLMPropertyTypeAny;\n    return RLMPropertyTypeAny;\n}\n#pragma clang diagnostic pop\n\n- (RLMAnyValueType)rlm_anyValueType {\n    return RLMAnyValueTypeDictionary;\n}\n\n@end\n\n#pragma mark Array\n\n@implementation NSArray (RLMValue)\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-implementations\"\n- (RLMPropertyType)rlm_valueType {\n    return RLMPropertyTypeAny;\n}\n#pragma clang diagnostic pop\n\n- (RLMAnyValueType)rlm_anyValueType {\n    return RLMAnyValueTypeList;\n}\n\n@end\n\n@implementation RLMArray (RLMValue)\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-implementations\"\n- (RLMPropertyType)rlm_valueType {\n    return RLMPropertyTypeAny;\n}\n#pragma clang diagnostic pop\n\n- (RLMAnyValueType)rlm_anyValueType {\n    return RLMAnyValueTypeList;\n}\n\n@end\n"
  },
  {
    "path": "Realm/Realm-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>English</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIconFile</key>\n\t<string></string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>FMWK</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>20.0.4</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>20.0.4</string>\n\t<key>NSHumanReadableCopyright</key>\n\t<string>Copyright © 2014-2021 Realm. All rights reserved.</string>\n\t<key>NSPrincipalClass</key>\n\t<string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Realm/Realm.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Foundation/Foundation.h>\n\n#import <Realm/RLMArray.h>\n#import <Realm/RLMAsyncTask.h>\n#import <Realm/RLMDecimal128.h>\n#import <Realm/RLMDictionary.h>\n#import <Realm/RLMEmbeddedObject.h>\n#import <Realm/RLMError.h>\n#import <Realm/RLMGeospatial.h>\n#import <Realm/RLMLogger.h>\n#import <Realm/RLMMigration.h>\n#import <Realm/RLMObject.h>\n#import <Realm/RLMObjectId.h>\n#import <Realm/RLMObjectSchema.h>\n#import <Realm/RLMProperty.h>\n#import <Realm/RLMRealm.h>\n#import <Realm/RLMRealmConfiguration.h>\n#import <Realm/RLMResults.h>\n#import <Realm/RLMSchema.h>\n#import <Realm/RLMSectionedResults.h>\n#import <Realm/RLMSet.h>\n#import <Realm/RLMValue.h>\n"
  },
  {
    "path": "Realm/Realm.modulemap",
    "content": "framework module Realm {\n    export Foundation\n\n    umbrella header \"Realm.h\"\n\n    header \"RLMArray.h\"\n    header \"RLMDecimal128.h\"\n    header \"RLMDictionary.h\"\n    header \"RLMEmbeddedObject.h\"\n    header \"RLMGeospatial.h\"\n    header \"RLMLogger.h\"\n    header \"RLMMigration.h\"\n    header \"RLMObject.h\"\n    header \"RLMObjectId.h\"\n    header \"RLMObjectSchema.h\"\n    header \"RLMProperty.h\"\n    header \"RLMRealm.h\"\n    header \"RLMRealmConfiguration.h\"\n    header \"RLMResults.h\"\n    header \"RLMSchema.h\"\n    header \"RLMSectionedResults.h\"\n    header \"RLMSet.h\"\n    header \"RLMValue.h\"\n\n    explicit module Private {\n        header \"RLMAccessor.h\"\n        header \"RLMArray_Private.h\"\n        header \"RLMAsyncTask_Private.h\"\n        header \"RLMCollection_Private.h\"\n        header \"RLMDictionary_Private.h\"\n        header \"RLMLogger_Private.h\"\n        header \"RLMObjectBase_Dynamic.h\"\n        header \"RLMObjectBase_Private.h\"\n        header \"RLMObjectSchema_Private.h\"\n        header \"RLMObjectStore.h\"\n        header \"RLMObject_Private.h\"\n        header \"RLMProperty_Private.h\"\n        header \"RLMRealmConfiguration_Private.h\"\n        header \"RLMRealm_Private.h\"\n        header \"RLMResults_Private.h\"\n        header \"RLMScheduler.h\"\n        header \"RLMSchema_Private.h\"\n        header \"RLMSectionedResults.h\"\n        header \"RLMSet_Private.h\"\n        header \"RLMSwiftCollectionBase.h\"\n        header \"RLMSwiftProperty.h\"\n        header \"RLMSwiftValueStorage.h\"\n    }\n\n    explicit module Dynamic {\n        header \"RLMRealm_Dynamic.h\"\n        header \"RLMObjectBase_Dynamic.h\"\n    }\n\n    explicit module Swift {\n        header \"RLMSwiftObject.h\"\n    }\n}\n"
  },
  {
    "path": "Realm/Swift/RLMSupport.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Realm\n\nextension RLMRealm {\n    /**\n     Returns the schema version for a Realm at a given local URL.\n\n     - see: `+ [RLMRealm schemaVersionAtURL:encryptionKey:error:]`\n     */\n    @nonobjc public class func schemaVersion(at url: URL, usingEncryptionKey key: Data? = nil) throws -> UInt64 {\n        var error: NSError?\n        let version = __schemaVersion(at: url, encryptionKey: key, error: &error)\n        guard version != RLMNotVersioned else { throw error! }\n        return version\n    }\n\n    /**\n     Returns the same object as the one referenced when the `RLMThreadSafeReference` was first created,\n     but resolved for the current Realm for this thread. Returns `nil` if this object was deleted after\n     the reference was created.\n\n     - see `- [RLMRealm resolveThreadSafeReference:]`\n     */\n    @nonobjc public func resolve<Confined>(reference: RLMThreadSafeReference<Confined>) -> Confined? {\n        return __resolve(reference as! RLMThreadSafeReference<RLMThreadConfined>) as! Confined?\n    }\n}\n\nextension RLMObject {\n    /**\n     Returns all objects of this object type matching the given predicate from the default Realm.\n\n     - see `+ [RLMObject objectsWithPredicate:]`\n     */\n    public class func objects(where predicateFormat: String, _ args: CVarArg...) -> RLMResults<RLMObject> {\n        return objects(with: NSPredicate(format: predicateFormat, arguments: getVaList(args))) as! RLMResults<RLMObject>\n    }\n\n    /**\n     Returns all objects of this object type matching the given predicate from the specified Realm.\n\n     - see `+ [RLMObject objectsInRealm:withPredicate:]`\n     */\n    public class func objects(in realm: RLMRealm,\n                              where predicateFormat: String,\n                              _ args: CVarArg...) -> RLMResults<RLMObject> {\n        return objects(in: realm, with: NSPredicate(format: predicateFormat, arguments: getVaList(args))) as! RLMResults<RLMObject>\n    }\n}\n\n/// A protocol defining iterator support for RLMArray, RLMSet & RLMResults.\npublic protocol _RLMCollectionIterator: Sequence {\n    /**\n     Returns a `RLMCollectionIterator` that yields successive elements in the collection.\n     This enables support for sequence-style enumeration of `RLMObject` subclasses in Swift.\n     */\n    func makeIterator() -> RLMCollectionIterator\n}\n\nextension _RLMCollectionIterator where Self: RLMCollection {\n    /// :nodoc:\n    public func makeIterator() -> RLMCollectionIterator {\n        return RLMCollectionIterator(self)\n    }\n}\n/// :nodoc:\npublic typealias RLMDictionarySingleEntry = (key: String, value: RLMObject)\n/// A protocol defining iterator support for RLMDictionary\npublic protocol _RLMDictionaryIterator {\n    /// :nodoc:\n    func makeIterator() -> RLMDictionaryIterator\n}\n\nextension _RLMDictionaryIterator where Self: RLMCollection {\n    /// :nodoc:\n    public func makeIterator() -> RLMDictionaryIterator {\n        return RLMDictionaryIterator(self)\n    }\n}\n\n// Sequence conformance for RLMArray, RLMDictionary, RLMSet and RLMResults is provided by RLMCollection's\n// `makeIterator()` implementation.\n#if compiler(<6.0)\nextension RLMArray: Sequence, _RLMCollectionIterator { }\nextension RLMDictionary: Sequence, _RLMDictionaryIterator {}\nextension RLMSet: Sequence, _RLMCollectionIterator {}\nextension RLMResults: Sequence, _RLMCollectionIterator {}\n#else\nextension RLMArray: @retroactive Sequence, _RLMCollectionIterator { }\nextension RLMDictionary: @retroactive Sequence, _RLMDictionaryIterator {}\nextension RLMSet: @retroactive Sequence, _RLMCollectionIterator {}\nextension RLMResults: @retroactive Sequence, _RLMCollectionIterator {}\n#endif\n\n/**\n This struct enables sequence-style enumeration for RLMObjects in Swift via `RLMCollection.makeIterator`\n */\npublic struct RLMCollectionIterator: IteratorProtocol {\n    private var iteratorBase: NSFastEnumerationIterator\n\n    internal init(_ collection: RLMCollection) {\n        iteratorBase = NSFastEnumerationIterator(collection)\n    }\n\n    public mutating func next() -> RLMObject? {\n        return iteratorBase.next() as! RLMObject?\n    }\n}\n\n/**\n This struct enables sequence-style enumeration for RLMDictionary in Swift via `RLMDictionary.makeIterator`\n */\npublic struct RLMDictionaryIterator: IteratorProtocol {\n    private var iteratorBase: NSFastEnumerationIterator\n    private let dictionary: RLMDictionary<AnyObject, AnyObject>\n\n    internal init(_ collection: RLMCollection) {\n        dictionary = collection as! RLMDictionary<AnyObject, AnyObject>\n        iteratorBase = NSFastEnumerationIterator(collection)\n    }\n\n    public mutating func next() -> RLMDictionarySingleEntry? {\n        let key = iteratorBase.next()\n        if let key = key {\n            return (key: key as Any, value: dictionary[key as AnyObject]) as? RLMDictionarySingleEntry\n        }\n        if key != nil {\n            fatalError(\"unsupported key type\")\n        }\n        return nil\n    }\n}\n\n// Swift query convenience functions\nextension RLMCollection {\n    /**\n     Returns the index of the first object in the collection matching the predicate.\n     */\n    public func indexOfObject(where predicateFormat: String, _ args: CVarArg...) -> UInt {\n        guard let index = indexOfObject?(with: NSPredicate(format: predicateFormat, arguments: getVaList(args))) else {\n            fatalError(\"This RLMCollection does not support indexOfObject(where:)\")\n        }\n        return index\n    }\n\n    /**\n     Returns all objects matching the given predicate in the collection.\n     */\n    public func objects(where predicateFormat: String, _ args: CVarArg...) -> RLMResults<NSObject> {\n        return objects(with: NSPredicate(format: predicateFormat, arguments: getVaList(args))) as! RLMResults<NSObject>\n    }\n}\n\nextension RLMCollection {\n    /// Allows for subscript support with RLMDictionary.\n    public subscript(_ key: String) -> AnyObject? {\n        get {\n            (self as! RLMDictionary<NSString, AnyObject>).object(forKey: key as NSString)\n        }\n        set {\n            (self as! RLMDictionary<NSString, AnyObject>).setObject(newValue, forKey: key as NSString)\n        }\n    }\n}\n"
  },
  {
    "path": "Realm/TestUtils/RLMChildProcessEnvironment.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMChildProcessEnvironment.h\"\n\n@implementation RLMChildProcessEnvironment\n\n- (instancetype)init {\n    if (self = [super init]) {\n        _appIds = @[];\n        _identifier = 0;\n    }\n\n    return self;\n}\n\n- (instancetype)initWithAppIds:(NSArray<NSString *> *)appIds\n                         email:(NSString *)email\n                      password:(NSString *)password\n                     identifer:(NSInteger)identifier {\n    if (self = [super init]) {\n        _appIds = appIds ?: @[];\n        _email = email;\n        _password = password;\n        _identifier = identifier;\n    }\n\n    return self;\n}\n\n- (NSString *)_appId {\n    return self.appIds == nil ? nil : [self.appIds firstObject];\n}\n\n- (NSDictionary<NSString *,NSString *> *)dictionaryValue {\n    NSMutableDictionary<NSString *, NSString *> *environment = [NSMutableDictionary new];\n    if ([self.appIds count] > 0) {\n        environment[@\"RLMParentAppId\"] = [self.appIds firstObject];\n        environment[@\"RLMParentAppIds\"] = [self.appIds componentsJoinedByString:@\",\"];\n    }\n    if (self.email != nil) {\n        environment[@\"RLMChildEmail\"] = self.email;\n    }\n    if (self.password != nil) {\n        environment[@\"RLMChildPassword\"] = self.password;\n    }\n    environment[@\"RLMChildIdentifier\"] = [@(self.identifier) stringValue];\n\n    return environment;\n}\n\n+ (RLMChildProcessEnvironment *)current {\n    NSDictionary<NSString *, NSString *> *environment = [NSProcessInfo processInfo].environment;\n    NSString *identifier = [environment objectForKey:@\"RLMChildIdentifier\"] ?: @\"0\";\n    NSString *appIds = environment[@\"RLMParentAppIds\"] ?: @\"\";\n\n    return [[RLMChildProcessEnvironment new] initWithAppIds:[appIds componentsSeparatedByString:@\",\"]\n                                                      email:environment[@\"RLMChildEmail\"]\n                                                   password:environment[@\"RLMChildPassword\"]\n                                                  identifer:[identifier intValue]];\n}\n\n@end\n"
  },
  {
    "path": "Realm/TestUtils/RLMMultiProcessTestCase.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMMultiProcessTestCase.h\"\n#import \"RLMChildProcessEnvironment.h\"\n\n#include <mach-o/dyld.h>\n\n@interface RLMMultiProcessTestCase ()\n@property (nonatomic) bool isParent;\n@property (nonatomic, strong) NSString *testName;\n\n@property (nonatomic, strong) NSString *xctestPath;\n@property (nonatomic, strong) NSString *testsPath;\n@end\n\n@interface RLMMultiProcessTestCase (Sync)\n- (NSString *)appId;\n@end\n\n@implementation RLMMultiProcessTestCase\n// Override all of the methods for creating a XCTestCase object to capture the current test name\n+ (id)testCaseWithInvocation:(NSInvocation *)invocation {\n    RLMMultiProcessTestCase *testCase = [super testCaseWithInvocation:invocation];\n    testCase.testName = NSStringFromSelector(invocation.selector);\n    return testCase;\n}\n\n- (id)initWithInvocation:(NSInvocation *)invocation {\n    self = [super initWithInvocation:invocation];\n    if (self) {\n        self.testName = NSStringFromSelector(invocation.selector);\n    }\n    return self;\n}\n\n+ (id)testCaseWithSelector:(SEL)selector {\n    RLMMultiProcessTestCase *testCase = [super testCaseWithSelector:selector];\n    testCase.testName = NSStringFromSelector(selector);\n    return testCase;\n}\n\n- (id)initWithSelector:(SEL)selector {\n    self = [super initWithSelector:selector];\n    if (self) {\n        self.testName = NSStringFromSelector(selector);\n    }\n    return self;\n}\n\n- (BOOL)encryptTests {\n    return NO;\n}\n\n- (void)setUp {\n    self.isParent = !getenv(\"RLMProcessIsChild\");\n    self.xctestPath = [self locateXCTest];\n    self.testsPath = [NSBundle bundleForClass:[self class]].bundlePath;\n\n    if (!self.isParent) {\n        // For multi-process tests, the child's concept of a default path needs to match the parent.\n        // RLMRealmConfiguration isn't aware of this, but our test's RLMDefaultRealmURL helper does.\n        // Use it to reset the default configuration's path so it matches the parent.\n        RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n        configuration.fileURL = RLMDefaultRealmURL();\n        [RLMRealmConfiguration setDefaultConfiguration:configuration];\n    }\n\n    [super setUp];\n}\n\n- (void)invokeTest {\n    CFRunLoopPerformBlock(CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, ^{\n        [super invokeTest];\n        CFRunLoopStop(CFRunLoopGetCurrent());\n    });\n    CFRunLoopRun();\n}\n\n- (void)deleteFiles {\n    // Only the parent should delete files in setUp/tearDown\n    if (self.isParent) {\n        [super deleteFiles];\n    }\n}\n\n+ (void)preintializeSchema {\n    // Do nothing so that we can test global schema init in child processes\n}\n\n- (NSString *)locateXCTest {\n    NSProcessInfo *info = [NSProcessInfo processInfo];\n    NSString *pathString = info.environment[@\"PATH\"];\n    NSFileManager *fileManager = [NSFileManager defaultManager];\n    for (NSString *directory in [pathString componentsSeparatedByString:@\":\"]) {\n        NSString *candidatePath = [directory stringByAppendingPathComponent:@\"xctest\"];\n        if ([fileManager isExecutableFileAtPath:candidatePath])\n            return candidatePath;\n    }\n    return info.arguments[0];\n}\n\n#if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR\n- (NSTask *)childTaskWithEnvironment:(RLMChildProcessEnvironment *)environment {\n    NSString *testName = [NSString stringWithFormat:@\"%@/%@\", self.className, self.testName];\n    NSMutableDictionary *env = [NSProcessInfo.processInfo.environment mutableCopy];\n    env[@\"RLMProcessIsChild\"] = @\"true\";\n    env[@\"RLMParentProcessBundleID\"] = [NSBundle mainBundle].bundleIdentifier;\n    [env addEntriesFromDictionary:[environment dictionaryValue]];\n\n    // If we're running with address sanitizer or thread sanitizer we need to\n    // explicitly tell dyld to inject the appropriate runtime library into\n    // the child process\n    for (int  i = 0, count = _dyld_image_count(); i < count; i++) {\n        const char *imageName = _dyld_get_image_name(i);\n        if (imageName && strstr(imageName, \"libclang_rt\")) {\n            env[@\"DYLD_INSERT_LIBRARIES\"] = @(imageName);\n        }\n    }\n\n    // Don't inherit the config file in the subprocess, as multiple XCTest\n    // processes talking to a single Xcode instance doesn't work at all\n    [env removeObjectForKey:@\"XCTestConfigurationFilePath\"];\n    [env removeObjectForKey:@\"XCTestSessionIdentifier\"];\n    [env removeObjectForKey:@\"XPC_SERVICE_NAME\"];\n    [env removeObjectForKey:@\"XCTestBundlePath\"];\n\n    NSTask *task = [[NSTask alloc] init];\n    task.launchPath = self.xctestPath;\n    task.arguments = @[@\"-XCTest\", testName, self.testsPath];\n    task.environment = env;\n    task.standardError = nil;\n    return task;\n}\n\n- (NSTask *)childTaskWithAppIds:(NSArray *)appIds {\n    return [self childTaskWithEnvironment:[[RLMChildProcessEnvironment new] initWithAppIds:appIds\n                                                                                     email:nil\n                                                                                  password:nil\n                                                                                 identifer:0]];\n}\n\n- (NSTask *)childTask {\n    return [self childTaskWithAppIds:@[]];\n}\n\n- (NSPipe *)filterPipe {\n    NSPipe *pipe = [NSPipe pipe];\n    NSMutableData *buffer = [[NSMutableData alloc] init];\n\n    // Filter the output from the child process to reduce xctest noise\n    pipe.fileHandleForReading.readabilityHandler = ^(NSFileHandle *file) {\n        [buffer appendData:[file availableData]];\n        const char *newline;\n        const char *start = buffer.bytes;\n        const char *end = start + buffer.length;\n        while ((newline = memchr(start, '\\n', end - start))) {\n            if (newline < start + 17 ||\n                (memcmp(start, \"Test Suite\", 10) && memcmp(start, \"Test Case\", 9) && memcmp(start, \"     Executed 1 test\", 17))) {\n                fwrite(start, newline - start + 1, 1, stderr);\n            }\n            start = newline + 1;\n        }\n\n        // Remove everything up to the last newline, leaving any data not newline-terminated in the buffer\n        [buffer replaceBytesInRange:NSMakeRange(0, start - (char *)buffer.bytes) withBytes:0 length:0];\n    };\n    return pipe;\n}\n\n- (int)runChildAndWaitWithEnvironment:(RLMChildProcessEnvironment *)environment {\n    NSTask *task = [self childTaskWithEnvironment:environment];\n    task.standardError = self.filterPipe;\n    [task launch];\n    [task waitUntilExit];\n    return task.terminationStatus;\n}\n\n- (int)runChildAndWaitWithAppIds:(NSArray *)appIds {\n    return [self runChildAndWaitWithEnvironment:[[RLMChildProcessEnvironment new] initWithAppIds:appIds email:nil password:nil identifer:0]];\n}\n\n- (int)runChildAndWait {\n    NSTask *task = [self childTask];\n    task.standardError = self.filterPipe;\n    [task launch];\n    [task waitUntilExit];\n    return task.terminationStatus;\n}\n\n#else\n- (NSTask *)childTask {\n    return nil;\n}\n- (NSTask *)childTaskWithAppIds:(__unused NSArray *)appIds {\n    return nil;\n}\n\n- (int)runChildAndWait {\n    return 1;\n}\n\n- (int)runChildAndWaitWithAppIds:(__unused NSArray *)appIds {\n    return 1;\n}\n\n- (int)runChildAndWaitWithEnvironment:(RLMChildProcessEnvironment *)environment {\n    return 1;\n}\n#endif\n@end\n"
  },
  {
    "path": "Realm/TestUtils/RLMTestCase.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#import \"RLMRealmConfiguration_Private.h\"\n#import <Realm/RLMRealm_Private.h>\n#import <Realm/RLMSchema_Private.h>\n#import <Realm/RLMRealmConfiguration_Private.h>\n\nstatic NSString *parentProcessBundleIdentifier(void)\n{\n    static BOOL hasInitializedIdentifier;\n    static NSString *identifier;\n    if (!hasInitializedIdentifier) {\n        identifier = [NSProcessInfo processInfo].environment[@\"RLMParentProcessBundleID\"];\n        hasInitializedIdentifier = YES;\n    }\n\n    return identifier;\n}\n\nNSURL *RLMDefaultRealmURL(void) {\n    return [NSURL fileURLWithPath:RLMRealmPathForFileAndBundleIdentifier(@\"default.realm\", parentProcessBundleIdentifier())];\n}\n\nNSURL *RLMTestRealmURL(void) {\n    return [NSURL fileURLWithPath:RLMRealmPathForFileAndBundleIdentifier(@\"test.realm\", parentProcessBundleIdentifier())];\n}\n\nstatic void deleteOrThrow(NSURL *fileURL) {\n    NSError *error;\n    if (![[NSFileManager defaultManager] removeItemAtURL:fileURL error:&error]) {\n        if (error.code != NSFileNoSuchFileError) {\n            @throw [NSException exceptionWithName:@\"RLMTestException\"\n                                           reason:[@\"Unable to delete realm: \" stringByAppendingString:error.description]\n                                         userInfo:nil];\n        }\n    }\n}\n\nNSData *RLMGenerateKey(void) {\n    uint8_t buffer[64];\n    (void)SecRandomCopyBytes(kSecRandomDefault, 64, buffer);\n    return [[NSData alloc] initWithBytes:buffer length:sizeof(buffer)];\n}\n\nstatic BOOL encryptTests(void) {\n    static BOOL encryptAll = NO;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        const char *str = getenv(\"REALM_ENCRYPT_ALL\");\n        if (str && *str) {\n            encryptAll = YES;\n        }\n    });\n    return encryptAll;\n}\n\n@implementation RLMTestCaseBase\n+ (void)setUp {\n    [super setUp];\n#if DEBUG || !TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR\n    // Disable actually syncing anything to the disk to greatly speed up the\n    // tests, but only when not running on device because it can't be\n    // re-enabled and we need it enabled for performance tests\n    RLMDisableSyncToDisk();\n#endif\n    // Don't bother disabling backups on our non-Realm files because it takes\n    // a while and we're going to delete them anyway.\n    RLMSetSkipBackupAttribute(false);\n\n    if (!getenv(\"RLMProcessIsChild\")) {\n        [self preinitializeSchema];\n\n        // Clean up any potentially lingering Realm files from previous runs\n        [NSFileManager.defaultManager removeItemAtPath:RLMRealmPathForFile(@\"\") error:nil];\n    }\n\n    // Ensure the documents directory exists as it sometimes doesn't after\n    // resetting the simulator\n    [NSFileManager.defaultManager createDirectoryAtURL:RLMDefaultRealmURL().URLByDeletingLastPathComponent\n                           withIntermediateDirectories:YES attributes:nil error:nil];\n}\n\n// This ensures the shared schema is initialized outside of of a test case,\n// so if an exception is thrown, it will kill the test process rather than\n// allowing hundreds of test cases to fail in strange ways\n// This is overridden by RLMMultiProcessTestCase to support testing the schema init\n+ (void)preinitializeSchema {\n    [RLMSchema sharedSchema];\n}\n\n// A hook point for subclasses to override the cleanup\n- (void)resetRealmState {\n    [RLMRealm resetRealmState];\n}\n@end\n\n@implementation RLMTestCase {\n    dispatch_queue_t _bgQueue;\n}\n\n- (void)deleteFiles {\n    // Clear cache\n    [self resetRealmState];\n\n    // Delete Realm files\n    NSURL *directory = RLMDefaultRealmURL().URLByDeletingLastPathComponent;\n    NSError *error = nil;\n    for (NSString *file in [NSFileManager.defaultManager\n                            contentsOfDirectoryAtPath:directory.path error:&error]) {\n        deleteOrThrow([directory URLByAppendingPathComponent:file]);\n    }\n}\n\n- (void)deleteRealmFileAtURL:(NSURL *)fileURL {\n    deleteOrThrow(fileURL);\n    deleteOrThrow([fileURL URLByAppendingPathExtension:@\"lock\"]);\n    deleteOrThrow([fileURL URLByAppendingPathExtension:@\"note\"]);\n}\n\n- (BOOL)encryptTests {\n    return encryptTests();\n}\n\n- (void)invokeTest {\n    @autoreleasepool {\n        [self deleteFiles];\n\n        if (self.encryptTests) {\n            RLMRealmConfiguration *configuration = [RLMRealmConfiguration rawDefaultConfiguration];\n            configuration.encryptionKey = RLMGenerateKey();\n        }\n    }\n    @autoreleasepool {\n        [super invokeTest];\n    }\n    @autoreleasepool {\n        if (_bgQueue) {\n            dispatch_sync(_bgQueue, ^{});\n            _bgQueue = nil;\n        }\n        [self deleteFiles];\n    }\n}\n\n- (RLMRealm *)realmWithTestPath {\n    return [RLMRealm realmWithURL:RLMTestRealmURL()];\n}\n\n- (RLMRealm *)realmWithTestPathAndSchema:(RLMSchema *)schema {\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = RLMTestRealmURL();\n    if (schema)\n        configuration.customSchema = schema;\n    else\n        configuration.dynamic = true;\n    return [RLMRealm realmWithConfiguration:configuration error:nil];\n}\n\n- (RLMRealm *)inMemoryRealmWithIdentifier:(NSString *)identifier {\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.encryptionKey = nil;\n    configuration.inMemoryIdentifier = identifier;\n    return [RLMRealm realmWithConfiguration:configuration error:nil];\n}\n\n- (RLMRealm *)readOnlyRealmWithURL:(NSURL *)fileURL error:(NSError **)error {\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = fileURL;\n    configuration.readOnly = true;\n    return [RLMRealm realmWithConfiguration:configuration error:error];\n}\n\n- (void)waitForNotification:(NSString *)expectedNote realm:(RLMRealm *)realm block:(dispatch_block_t)block {\n    XCTestExpectation *notificationFired = [self expectationWithDescription:@\"notification fired\"];\n    __block RLMNotificationToken *token = [realm addNotificationBlock:^(NSString *note, RLMRealm *realm) {\n        XCTAssertNotNil(note, @\"Note should not be nil\");\n        XCTAssertNotNil(realm, @\"Realm should not be nil\");\n        if (note == expectedNote) { // Check pointer equality to ensure we're using the interned string constant\n            [notificationFired fulfill];\n            [token invalidate];\n        }\n    }];\n\n    dispatch_queue_t queue = dispatch_queue_create(\"background\", 0);\n    dispatch_async(queue, ^{\n        @autoreleasepool {\n            block();\n        }\n    });\n\n    [self waitForExpectationsWithTimeout:30.0 handler:nil];\n\n    // wait for queue to finish\n    dispatch_sync(queue, ^{});\n}\n\n- (dispatch_queue_t)bgQueue {\n    if (!_bgQueue) {\n        _bgQueue = dispatch_queue_create(\"test background queue\", 0);\n    }\n    return _bgQueue;\n}\n\n- (void)dispatchAsync:(NS_SWIFT_SENDABLE dispatch_block_t)block {\n    dispatch_async(self.bgQueue, ^{\n        @autoreleasepool {\n            block();\n        }\n    });\n}\n\n- (void)dispatchAsyncAndWait:(NS_SWIFT_SENDABLE dispatch_block_t)block {\n    [self dispatchAsync:block];\n    dispatch_sync(_bgQueue, ^{});\n}\n\n- (id)nonLiteralNil {\n    return nil;\n}\n\n@end\n\n"
  },
  {
    "path": "Realm/TestUtils/RLMTestObjects.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestObjects.h\"\n#import <Realm/RLMObject_Private.h>\n\n#pragma mark - Abstract Objects\n#pragma mark -\n\n#pragma mark OneTypeObjects\n\n@implementation StringObject\n\n- (NSString *)firstLetter {\n    return [self.stringCol substringToIndex:1];\n}\n\n@end\n\n@implementation IntObject\n@end\n\n@implementation AllIntSizesObject\n@end\n\n@implementation FloatObject\n@end\n\n@implementation DoubleObject\n@end\n\n@implementation BoolObject\n@end\n\n@implementation DateObject\n@end\n\n@implementation BinaryObject\n@end\n\n@implementation DecimalObject\n@end\n\n@implementation MixedObject\n@end\n\n@implementation UTF8Object\n@end\n\n@implementation IndexedStringObject\n+ (NSArray *)indexedProperties {\n    return @[@\"stringCol\"];\n}\n@end\n\n@implementation LinkStringObject\n@end\n\n@implementation LinkIndexedStringObject\n@end\n\n@implementation RequiredPropertiesObject\n+ (NSArray *)requiredProperties {\n    return @[@\"stringCol\", @\"binaryCol\"];\n}\n@end\n\n@implementation IgnoredURLObject\n+ (NSArray *)ignoredProperties {\n    return @[@\"url\"];\n}\n@end\n\n@implementation EmbeddedIntObject\n@end\n\n@implementation EmbeddedIntParentObject\n+ (NSString *)primaryKey {\n    return @\"pk\";\n}\n@end\n\n@implementation UuidObject\n@end\n\n#pragma mark AllTypesObject\n\n@implementation AllTypesObject\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{@\"linkingObjectsCol\": [RLMPropertyDescriptor descriptorWithClass:LinkToAllTypesObject.class propertyName:@\"allTypesCol\"]};\n}\n\n+ (NSArray *)requiredProperties {\n    return @[@\"stringCol\", @\"dateCol\", @\"binaryCol\", @\"decimalCol\", @\"objectIdCol\", @\"uuidCol\"];\n}\n\n+ (NSDictionary *)values:(int)i stringObject:(StringObject *)so {\n    char str[] = \"a\";\n    str[0] += i - 1;\n    return @{\n        @\"boolCol\": @(i % 2),\n        @\"cBoolCol\": @(i % 2),\n        @\"intCol\": @(i),\n        @\"floatCol\": @(1.1f * i),\n        @\"doubleCol\": @(1.11 * i),\n        @\"stringCol\": @(str),\n        @\"binaryCol\": [@(str) dataUsingEncoding:NSUTF8StringEncoding],\n        @\"dateCol\": [NSDate dateWithTimeIntervalSince1970:i],\n        @\"longCol\": @((long long)i * INT_MAX + 1),\n        @\"decimalCol\": [[RLMDecimal128 alloc] initWithNumber:@(i)],\n        @\"objectIdCol\": [RLMObjectId objectId],\n        @\"objectCol\": so ?: NSNull.null,\n        @\"uuidCol\": i < 4 ? @[[[NSUUID alloc] initWithUUIDString:@\"85d4fbee-6ec6-47df-bfa1-615931903d7e\"],\n                              [[NSUUID alloc] initWithUUIDString:@\"00000000-0000-0000-0000-000000000000\"],\n                              [[NSUUID alloc] initWithUUIDString:@\"137DECC8-B300-4954-A233-F89909F4FD89\"],\n                              [[NSUUID alloc] initWithUUIDString:@\"b84e8912-a7c2-41cd-8385-86d200d7b31e\"]][i] :\n            [[NSUUID alloc] initWithUUIDString:@\"b9d325b0-3058-4838-8473-8f1aaae410db\"],\n        @\"anyCol\": @(i+1)\n    };\n}\n\n+ (NSDictionary *)values:(int)i stringObject:(StringObject *)so mixedObject:(MixedObject *)mo {\n    NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:[self values:i stringObject:so]];\n    dict[@\"mixedObjectCol\"] = mo ?: NSNull.null;\n    return dict;\n}\n@end\n\n@implementation AllPrimitiveRLMValues\n@end\n\n@implementation ArrayOfAllTypesObject\n@end\n\n@implementation DictionaryOfAllTypesObject\n@end\n\n@implementation SetOfAllTypesObject\n@end\n\n@implementation LinkToAllTypesObject\n@end\n\n@implementation AllOptionalTypes\n@end\n@implementation AllPrimitiveArrays\n+ (NSArray *)requiredProperties {\n    return @[@\"intObj\", @\"floatObj\", @\"doubleObj\", @\"boolObj\", @\"stringObj\",\n             @\"dateObj\", @\"dataObj\", @\"decimalObj\", @\"objectIdObj\", @\"uuidObj\"];\n}\n@end\n\n@implementation AllPrimitiveSets\n+ (NSArray *)requiredProperties {\n    return @[@\"intObj\", @\"floatObj\", @\"doubleObj\", @\"boolObj\", @\"stringObj\",\n             @\"dateObj\", @\"dataObj\", @\"decimalObj\", @\"objectIdObj\", @\"uuidObj\",\n             @\"intObj2\", @\"floatObj2\", @\"doubleObj2\", @\"boolObj2\", @\"stringObj2\",\n             @\"dateObj2\", @\"dataObj2\", @\"decimalObj2\", @\"objectIdObj2\", @\"uuidObj2\"];\n}\n@end\n\n@implementation AllOptionalPrimitiveArrays\n@end\n\n@implementation AllDictionariesObject\n@end\n\n@implementation AllOptionalPrimitiveSets\n@end\n\n@implementation AllPrimitiveDictionaries\n+ (NSArray *)requiredProperties {\n    return @[@\"intObj\", @\"floatObj\", @\"doubleObj\", @\"boolObj\", @\"stringObj\",\n             @\"dateObj\", @\"dataObj\", @\"decimalObj\", @\"objectIdObj\", @\"uuidObj\",\n             @\"intObj2\", @\"floatObj2\", @\"doubleObj2\", @\"boolObj2\", @\"stringObj2\",\n             @\"dateObj2\", @\"dataObj2\", @\"decimalObj2\", @\"objectIdObj2\", @\"uuidObj2\"];\n}\n@end\n\n@implementation AllOptionalPrimitiveDictionaries\n@end\n\n@implementation AllOptionalTypesPK\n+ (NSString *)primaryKey {\n    return @\"pk\";\n}\n+ (NSDictionary *)defaultPropertyValues {\n    return @{@\"pk\": NSUUID.UUID.UUIDString};\n}\n@end\n\n#pragma mark - Real Life Objects\n#pragma mark -\n\n#pragma mark EmployeeObject\n\n@implementation EmployeeObject\n@end\n\n#pragma mark CompanyObject\n\n@implementation CompanyObject\n@end\n\n@implementation PrimaryEmployeeObject\n+ (NSString *)primaryKey {\n    return @\"name\";\n}\n@end\n\n@implementation LinkToPrimaryEmployeeObject\n@end\n\n@implementation PrimaryCompanyObject\n+ (NSString *)primaryKey {\n    return @\"name\";\n}\n@end\n\n@implementation ArrayOfPrimaryCompanies\n@end\n\n@implementation SetOfPrimaryCompanies\n@end\n\n#pragma mark LinkToCompanyObject\n\n@implementation LinkToCompanyObject\n@end\n\n#pragma mark DogObject\n\n@class OwnerObject;\n\n@implementation DogObject\n+ (NSDictionary *)linkingObjectsProperties\n{\n    return @{ @\"owners\": [RLMPropertyDescriptor descriptorWithClass:OwnerObject.class propertyName:@\"dog\"] };\n}\n@end\n\n#pragma mark OwnerObject\n\n@implementation OwnerObject\n\n- (BOOL)isEqual:(id)other\n{\n    return [self isEqualToObject:other];\n}\n\n@end\n\n#pragma mark - Specific Use Objects\n#pragma mark -\n\n#pragma mark CustomAccessorsObject\n\n@implementation CustomAccessorsObject\n@end\n\n#pragma mark BaseClassStringObject\n\n@implementation BaseClassStringObject\n@end\n\n#pragma mark CircleObject\n\n@implementation CircleObject\n@end\n\n#pragma mark CircleArrayObject\n\n@implementation CircleArrayObject\n@end\n\n#pragma mark CircleSetObject\n\n@implementation CircleSetObject\n@end\n\n#pragma mark CircleDictionaryObject\n\n@implementation CircleDictionaryObject\n@end\n\n#pragma mark ArrayPropertyObject\n\n@implementation ArrayPropertyObject\n@end\n\n#pragma mark SetPropertyObject\n\n@implementation SetPropertyObject\n@end\n\n#pragma mark DictionaryPropertyObject\n\n@implementation DictionaryPropertyObject\n@end\n\n#pragma mark DynamicTestObject\n\n@implementation DynamicTestObject\n@end\n\n#pragma mark AggregateObject\n\n@implementation AggregateObject\n@end\n@implementation AggregateArrayObject\n@end\n@implementation AggregateSetObject\n@end\n@implementation AggregateDictionaryObject\n@end\n\n#pragma mark PrimaryStringObject\n\n@implementation PrimaryStringObject\n+ (NSString *)primaryKey {\n    return @\"stringCol\";\n}\n+ (NSArray *)requiredProperties {\n    return @[@\"stringCol\"];\n}\n@end\n\n@implementation PrimaryNullableStringObject\n+ (NSString *)primaryKey {\n    return @\"stringCol\";\n}\n@end\n\n@implementation PrimaryIntObject\n+ (NSString *)primaryKey {\n    return @\"intCol\";\n}\n@end\n\n@implementation PrimaryInt64Object\n+ (NSString *)primaryKey {\n    return @\"int64Col\";\n}\n@end\n\n@implementation PrimaryNullableIntObject\n+ (NSString *)primaryKey {\n    return @\"optIntCol\";\n}\n@end\n\n\n#pragma mark ReadOnlyPropertyObject\n\n@interface ReadOnlyPropertyObject ()\n@property (readwrite) int readOnlyPropertyMadeReadWriteInClassExtension;\n@end\n\n@implementation ReadOnlyPropertyObject\n- (NSNumber *)readOnlyUnsupportedProperty {\n    return nil;\n}\n@end\n\n#pragma mark IntegerArrayPropertyObject\n\n@implementation IntegerArrayPropertyObject\n@end\n\n#pragma mark IntegerSetPropertyObject\n\n@implementation IntegerSetPropertyObject\n@end\n\n#pragma mark IntegerDictionaryPropertyObject\n\n@implementation IntegerDictionaryPropertyObject\n@end\n\n@implementation NumberObject\n@end\n\n@implementation NumberDefaultsObject\n+ (NSDictionary *)defaultPropertyValues {\n    return @{@\"intObj\" : @1,\n             @\"floatObj\" : @2.2f,\n             @\"doubleObj\" : @3.3,\n             @\"boolObj\" : @NO};\n}\n@end\n\n@implementation RequiredNumberObject\n+ (NSArray *)requiredProperties {\n    return @[@\"intObj\", @\"floatObj\", @\"doubleObj\", @\"boolObj\"];\n}\n@end\n\n#pragma mark CustomInitializerObject\n\n@implementation CustomInitializerObject\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        self.stringCol = @\"test\";\n    }\n    return self;\n}\n\n@end\n\n#pragma mark AbstractObject\n\n@implementation AbstractObject\n@end\n\n#pragma mark PersonObject\n\n@implementation PersonObject\n\n+ (NSDictionary *)linkingObjectsProperties\n{\n    return @{ @\"parents\": [RLMPropertyDescriptor descriptorWithClass:PersonObject.class propertyName:@\"children\"] };\n}\n\n- (BOOL)isEqual:(id)other\n{\n    if (![other isKindOfClass:[PersonObject class]]) {\n        return NO;\n    }\n\n    PersonObject *otherPerson = other;\n    return [self.name isEqual:otherPerson.name] && self.age == otherPerson.age && [self.children isEqual:otherPerson.children];\n}\n\n@end\n\n@implementation RenamedProperties\n+ (NSDictionary *)_realmColumnNames {\n    return @{@\"intCol\": @\"custom_intCol\",\n             @\"stringCol\": @\"custom_stringCol\"};\n}\n@end\n\n@implementation RenamedProperties1\n+ (NSString *)_realmObjectName {\n    return @\"Renamed Properties\";\n}\n+ (NSDictionary *)_realmColumnNames {\n    return @{@\"propA\": @\"prop 1\",\n             @\"propB\": @\"prop 2\"};\n}\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{@\"linking1\": [RLMPropertyDescriptor descriptorWithClass:LinkToRenamedProperties1.class propertyName:@\"linkA\"],\n             @\"linking2\": [RLMPropertyDescriptor descriptorWithClass:LinkToRenamedProperties2.class propertyName:@\"linkD\"]};\n}\n@end\n\n@implementation RenamedProperties2\n+ (NSString *)_realmObjectName {\n    return @\"Renamed Properties\";\n}\n+ (NSDictionary *)_realmColumnNames {\n    return @{@\"propC\": @\"prop 1\",\n             @\"propD\": @\"prop 2\"};\n}\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{@\"linking1\": [RLMPropertyDescriptor descriptorWithClass:LinkToRenamedProperties1.class propertyName:@\"linkA\"],\n             @\"linking2\": [RLMPropertyDescriptor descriptorWithClass:LinkToRenamedProperties2.class propertyName:@\"linkD\"]};\n}\n@end\n\n@implementation LinkToRenamedProperties\n+ (NSDictionary *)_realmColumnNames {\n    return @{@\"link\": @\"Link\"};\n}\n@end\n\n@implementation LinkToRenamedProperties1\n+ (NSString *)_realmObjectName {\n    return @\"Link To Renamed Properties\";\n}\n+ (NSDictionary *)_realmColumnNames {\n    return @{@\"linkA\": @\"Link A\",\n             @\"linkB\": @\"Link B\"};\n}\n@end\n\n@implementation LinkToRenamedProperties2\n+ (NSString *)_realmObjectName {\n    return @\"Link To Renamed Properties\";\n}\n+ (NSDictionary *)_realmColumnNames {\n    return @{@\"linkC\": @\"Link A\",\n             @\"linkD\": @\"Link B\"};\n}\n@end\n\n@implementation RenamedPrimaryKey\n+ (NSString *)primaryKey {\n    return @\"pk\";\n}\n+ (NSDictionary *)_realmColumnNames {\n    return @{@\"pk\": @\"Primary Key\",\n             @\"value\": @\"Value\"};\n}\n@end\n\n#pragma mark FakeObject\n\n@implementation FakeObject\n+ (bool)_realmIgnoreClass { return true; }\n@end\n\n@implementation FakeEmbeddedObject\n+ (bool)_realmIgnoreClass { return true; }\n@end\n\n#pragma mark ComputedPropertyNotExplicitlyIgnoredObject\n\n@implementation ComputedPropertyNotExplicitlyIgnoredObject\n\n- (NSURL *)URL {\n    return [NSURL URLWithString:self._URLBacking];\n}\n\n- (void)setURL:(NSURL *)URL {\n    self._URLBacking = URL.absoluteString;\n}\n\n@end\n"
  },
  {
    "path": "Realm/TestUtils/RealmTestSupport.h",
    "content": "// A dummy module header to let us import RealmTestSupport in non-swiftpm builds\n#import \"RLMChildProcessEnvironment.h\"\n"
  },
  {
    "path": "Realm/TestUtils/TestUtils.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"TestUtils.h\"\n#import \"RLMAssertions.h\"\n\n#import <Realm/Realm.h>\n#import <Realm/RLMSchema_Private.h>\n\n#import \"RLMRealmConfiguration_Private.hpp\"\n#import \"RLMRealmUtil.hpp\"\n\n#import <realm/util/base64.hpp>\n\n#import <Availability.h>\n\nstatic void recordFailure(XCTestCase *self, NSString *message, NSString *fileName, NSUInteger lineNumber) {\n    XCTSourceCodeLocation *loc = [[XCTSourceCodeLocation alloc] initWithFilePath:fileName lineNumber:lineNumber];\n    XCTIssue *issue = [[XCTIssue alloc] initWithType:XCTIssueTypeAssertionFailure\n                                  compactDescription:message\n                                 detailedDescription:nil\n                                   sourceCodeContext:[[XCTSourceCodeContext alloc] initWithLocation:loc]\n                                     associatedError:nil\n                                         attachments:@[]];\n    [self recordIssue:issue];\n}\n\nvoid RLMAssertThrowsWithReasonMatchingSwift(XCTestCase *self,\n                                            __attribute__((noescape)) dispatch_block_t block,\n                                            NSString *regexString, NSString *message,\n                                            NSString *fileName, NSUInteger lineNumber) {\n    BOOL didThrow = NO;\n    @try {\n        block();\n    }\n    @catch (NSException *e) {\n        didThrow = YES;\n        NSString *reason = e.reason;\n        NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:regexString options:(NSRegularExpressionOptions)0 error:nil];\n        if ([regex numberOfMatchesInString:reason options:(NSMatchingOptions)0 range:NSMakeRange(0, reason.length)] == 0) {\n            NSString *msg = [NSString stringWithFormat:@\"The given expression threw an exception with reason '%@', but expected to match '%@'\",\n                             reason, regexString];\n            recordFailure(self, msg, fileName, lineNumber);\n        }\n    }\n    if (!didThrow) {\n        NSString *prefix = @\"The given expression failed to throw an exception\";\n        message = message ? [NSString stringWithFormat:@\"%@ (%@)\",  prefix, message] : prefix;\n        recordFailure(self, message, fileName, lineNumber);\n    }\n}\n\nstatic void assertThrows(XCTestCase *self, dispatch_block_t block, NSString *message,\n                         NSString *fileName, NSUInteger lineNumber,\n                         NSString *(^condition)(NSException *)) {\n    @try {\n        block();\n        NSString *prefix = @\"The given expression failed to throw an exception\";\n        message = message ? [NSString stringWithFormat:@\"%@ (%@)\",  prefix, message] : prefix;\n        recordFailure(self, message, fileName, lineNumber);\n    }\n    @catch (NSException *e) {\n        if (NSString *failure = condition(e)) {\n            recordFailure(self, failure, fileName, lineNumber);\n        }\n    }\n}\n\nvoid (RLMAssertThrowsWithName)(XCTestCase *self, __attribute__((noescape)) dispatch_block_t block,\n                               NSString *name, NSString *message, NSString *fileName, NSUInteger lineNumber) {\n    assertThrows(self, block, message, fileName, lineNumber, ^NSString *(NSException *e) {\n        if ([name isEqualToString:e.name]) {\n            return nil;\n        }\n        return [NSString stringWithFormat:@\"The given expression threw an exception named '%@', but expected '%@'\",\n                             e.name, name];\n    });\n}\n\nvoid (RLMAssertThrowsWithReason)(XCTestCase *self, __attribute__((noescape)) dispatch_block_t block,\n                                 NSString *expected, NSString *message, NSString *fileName, NSUInteger lineNumber) {\n    assertThrows(self, block, message, fileName, lineNumber, ^NSString *(NSException *e) {\n        if ([e.reason rangeOfString:expected].location != NSNotFound) {\n            return nil;\n        }\n        return [NSString stringWithFormat:@\"The given expression threw an exception with reason '%@', but expected '%@'\",\n                             e.reason, expected];\n    });\n}\n\nvoid (RLMAssertThrowsWithReasonMatching)(XCTestCase *self, __attribute__((noescape)) dispatch_block_t block,\n                                         NSString *regexString, NSString *message,\n                                         NSString *fileName, NSUInteger lineNumber) {\n    auto regex = [NSRegularExpression regularExpressionWithPattern:regexString\n                                                           options:(NSRegularExpressionOptions)0 error:nil];\n    assertThrows(self, block, message, fileName, lineNumber, ^NSString *(NSException *e) {\n        if ([regex numberOfMatchesInString:e.reason options:(NSMatchingOptions)0 range:{0, e.reason.length}] > 0) {\n            return nil;\n        }\n        return [NSString stringWithFormat:@\"The given expression threw an exception with reason '%@', but expected to match '%@'\",\n                             e.reason, regexString];\n    });\n}\n\n\nvoid (RLMAssertMatches)(XCTestCase *self, __attribute__((noescape)) NSString *(^block)(),\n                        NSString *regexString, NSString *message, NSString *fileName, NSUInteger lineNumber) {\n    NSString *result = block();\n    NSError *err;\n    NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:regexString options:(NSRegularExpressionOptions)0 error:&err];\n    if (err) {\n        recordFailure(self, err.localizedDescription, fileName, lineNumber);\n        return;\n    }\n    if ([regex numberOfMatchesInString:result options:(NSMatchingOptions)0 range:NSMakeRange(0, result.length)] == 0) {\n        NSString *msg = [NSString stringWithFormat:@\"The given expression '%@' did not match '%@'%@\",\n                         result, regexString, message ? [NSString stringWithFormat:@\": %@\", message] : @\"\"];\n        recordFailure(self, msg, fileName, lineNumber);\n    }\n}\n\nvoid (RLMAssertExceptionReason)(XCTestCase *self,\n                                NSException *exception, NSString *expected, NSString *expression,\n                                NSString *fileName, NSUInteger lineNumber) {\n    if (!exception) {\n        return;\n    }\n    if ([exception.reason rangeOfString:(expected)].location != NSNotFound) {\n        return;\n    }\n\n    auto location = [[XCTSourceCodeContext alloc] initWithLocation:[[XCTSourceCodeLocation alloc] initWithFilePath:fileName lineNumber:lineNumber]];\n    NSString *desc = [NSString stringWithFormat:@\"The expression %@ threw an exception with reason '%@', but expected to contain '%@'\", expression, exception.reason ?: @\"<nil>\", expected];\n    auto issue = [[XCTIssue alloc] initWithType:XCTIssueTypeAssertionFailure\n                             compactDescription:desc\n                            detailedDescription:nil\n                              sourceCodeContext:location\n                                associatedError:nil\n                                    attachments:@[]];\n    [self recordIssue:issue];\n}\n\nbool RLMHasCachedRealmForPath(NSString *path) {\n    return RLMGetAnyCachedRealmForPath(path.UTF8String);\n}\n\nbool RLMThreadSanitizerEnabled() {\n#if __has_feature(thread_sanitizer)\n    return true;\n#else\n    return false;\n#endif\n}\n\n#if !REALM_TVOS && !REALM_WATCHOS && !REALM_APPLE_DEVICE\nbool RLMCanFork() {\n    return true;\n}\npid_t RLMFork() {\n    return fork();\n}\n#else\nbool RLMCanFork() {\n    return false;\n}\npid_t RLMFork() {\n    abort();\n}\n#endif\n"
  },
  {
    "path": "Realm/TestUtils/include/RLMAssertions.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <XCTest/XCTest.h>\n\n#if !TARGET_OS_IOS || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_14_0\n#define RLMConstantInt \"NSConstantIntegerNumber\"\n#define RLMConstantDouble \"NSConstantDoubleNumber\"\n#define RLMConstantFloat \"NSConstantFloatNumber\"\n#define RLMConstantString \"__NSCFConstantString\"\n#else\n#define RLMConstantInt \"__NSCFNumber\"\n#define RLMConstantDouble \"__NSCFNumber\"\n#define RLMConstantFloat \"__NSCFNumber\"\n#define RLMConstantString \"__NSCFConstantString\"\n#endif\n\nFOUNDATION_EXTERN\nvoid RLMAssertThrowsWithReasonMatchingSwift(XCTestCase *self,\n                                            __attribute__((noescape)) dispatch_block_t block,\n                                            NSString *regexString, NSString *message,\n                                            NSString *fileName, NSUInteger lineNumber);\n\nFOUNDATION_EXTERN\nvoid RLMAssertThrowsWithName(XCTestCase *self, __attribute__((noescape)) dispatch_block_t block,\n                             NSString *name, NSString *message, NSString *fileName,\n                             NSUInteger lineNumber);\n\n\nFOUNDATION_EXTERN\nvoid RLMAssertThrowsWithReasonMatching(XCTestCase *self,\n                                       __attribute__((noescape)) dispatch_block_t block,\n                                       NSString *regexString, NSString *message,\n                                       NSString *fileName, NSUInteger lineNumber);\n\nFOUNDATION_EXTERN\nvoid RLMAssertMatches(XCTestCase *self, __attribute__((noescape)) NSString *(^block)(void),\n                      NSString *regexString, NSString *message, NSString *fileName,\n                      NSUInteger lineNumber);\n\nFOUNDATION_EXTERN\nvoid RLMAssertThrowsWithReason(XCTestCase *self,\n                               __attribute__((noescape)) dispatch_block_t block,\n                               NSString *regexString, NSString *message,\n                               NSString *fileName, NSUInteger lineNumber);\n\nFOUNDATION_EXTERN\nvoid RLMAssertExceptionReason(XCTestCase *self,\n                              NSException *exception, NSString *expected, NSString *expression,\n                              NSString *fileName, NSUInteger lineNumber);\n\nFOUNDATION_EXTERN bool RLMHasCachedRealmForPath(NSString *path);\n\n#define RLMAssertThrows(expression, ...) \\\n    RLMPrimitiveAssertThrows(self, expression,  __VA_ARGS__)\n\n#define RLMPrimitiveAssertThrows(self, expression, format...) \\\n({ \\\n    NSException *caughtException = nil; \\\n    @try { \\\n        (void)(expression); \\\n    } \\\n    @catch (id exception) { \\\n        caughtException = exception; \\\n    } \\\n    if (!caughtException) { \\\n        _XCTRegisterFailure(self, _XCTFailureDescription(_XCTAssertion_Throws, 0, @#expression), format); \\\n    } \\\n    caughtException; \\\n})\n\n#define RLMAssertMatches(expression, regex, ...) \\\n    RLMPrimitiveAssertMatches(self, expression, regex,  __VA_ARGS__)\n\n#define RLMPrimitiveAssertMatches(self, expression, regexString, format...) \\\n({ \\\n    NSString *string = (expression); \\\n    NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:regexString options:(NSRegularExpressionOptions)0 error:nil]; \\\n    if ([regex numberOfMatchesInString:string options:(NSMatchingOptions)0 range:NSMakeRange(0, string.length)] == 0) { \\\n        _XCTRegisterFailure(self, [_XCTFailureDescription(_XCTAssertion_True, 0, @#expression @\" (EXPR_STRING) matches \" @#regexString) stringByReplacingOccurrencesOfString:@\"EXPR_STRING\" withString:string ?: @\"<nil>\"], format); \\\n    } \\\n})\n\n#define RLMAssertThrowsWithReasonMatching(expression, regex, ...) \\\n({ \\\n    NSException *exception = RLMAssertThrows(expression, __VA_ARGS__); \\\n    if (exception) { \\\n        RLMAssertMatches(exception.reason, regex, __VA_ARGS__); \\\n    } \\\n    exception; \\\n})\n\n#define RLMAssertThrowsWithReason(expression, expected) \\\n({ \\\n    NSException *exception = RLMAssertThrows(expression); \\\n    RLMAssertExceptionReason(self, exception, expected, @#expression, @\"\" __FILE__, __LINE__); \\\n    exception; \\\n})\n\n#define RLMAssertThrowsWithCodeMatching(expression, expectedCode, ...) \\\n({ \\\n    NSException *exception = RLMAssertThrows(expression, __VA_ARGS__); \\\n    XCTAssertEqual([(NSError *)exception.userInfo[NSUnderlyingErrorKey] code], expectedCode, __VA_ARGS__); \\\n})\n\n#define RLMValidateError(error, errDomain, errCode, msg) do {                                           \\\n    XCTAssertNotNil(error);                                                                             \\\n    XCTAssertEqual(error.domain, errDomain);                                                            \\\n    XCTAssertEqual(error.code, errCode);                                                                \\\n    XCTAssertEqualObjects(error.localizedDescription, msg);                                             \\\n} while (0)\n\n#define RLMValidateErrorContains(error, errDomain, errCode, msg) do {                                   \\\n    XCTAssertNotNil(error);                                                                             \\\n    XCTAssertEqual(error.domain, errDomain);                                                            \\\n    XCTAssertEqual(error.code, errCode);                                                                \\\n    XCTAssert([error.localizedDescription containsString:msg],                                          \\\n              @\"'%@' should contain '%@'\", error.localizedDescription, msg);                            \\\n} while (0)\n\n#define RLMValidateRealmError(macroError, errCode, msg, path) do {                                      \\\n    NSError *error2 = (NSError *)macroError;                                                            \\\n    RLMValidateError(error2, RLMErrorDomain, errCode, ([NSString stringWithFormat:msg, path]));         \\\n    XCTAssertEqualObjects(error2.userInfo[NSFilePathErrorKey], path);                                   \\\n} while (0)\n\n#define RLMValidateRealmErrorContains(macroError, errCode, msg, path) do {                              \\\n    NSError *error2 = (NSError *)macroError;                                                            \\\n    RLMValidateErrorContains(error2, RLMErrorDomain, errCode, ([NSString stringWithFormat:msg, path])); \\\n    XCTAssertEqualObjects(error2.userInfo[NSFilePathErrorKey], path);                                   \\\n} while (0)\n\n#define RLMAssertRealmException(expr, errCode, msg, path) do {                                          \\\n    NSException* exception = RLMAssertThrows(expr);                                                     \\\n    XCTAssertEqual(exception.name, RLMExceptionName);                                                   \\\n    NSString* reason = [NSString stringWithFormat:msg, path];                                           \\\n    XCTAssertEqualObjects(exception.reason, reason);                                                    \\\n    RLMValidateRealmError(exception.userInfo[NSUnderlyingErrorKey], errCode, msg, path);                \\\n} while (0)\n\n#define RLMAssertRealmExceptionContains(expr, errCode, msg, path) do {                                  \\\n    NSException* exception = RLMAssertThrows(expr);                                                     \\\n    XCTAssertEqual(exception.name, RLMExceptionName);                                                   \\\n    NSString* reason = [NSString stringWithFormat:msg, path];                                           \\\n    XCTAssert([exception.reason containsString:reason],                                                 \\\n              @\"'%@' should contain '%@'\", exception.reason, reason);                                   \\\n    RLMValidateRealmErrorContains(exception.userInfo[NSUnderlyingErrorKey], errCode, msg, path);        \\\n} while (0)\n\n// XCTest assertions wrap each assertion in a try/catch to provide nice\n// reporting if an assertion unexpectedly throws an exception. This is normally\n// quite nice, but becomes a problem with the very large number of assertions\n// in the primitive collection test files builds. Replacing these with\n// assertions which do not try/catch cuts those files' build times by about\n// 75%. The normal XCTest assertions should still be used by default in places\n// where it does not cause problems.\n#define uncheckedAssertEqual(ex1, ex2) do { \\\n    __typeof__(ex1) value1 = (ex1); \\\n    __typeof__(ex2) value2 = (ex2); \\\n    if (value1 != value2) { \\\n        NSValue *box1 = [NSValue value:&value1 withObjCType:@encode(__typeof__(ex1))]; \\\n        NSValue *box2 = [NSValue value:&value2 withObjCType:@encode(__typeof__(ex2))]; \\\n        _XCTRegisterFailure(nil, _XCTFailureDescription(_XCTAssertion_Equal, 0, @#ex1, @#ex2, _XCTDescriptionForValue(box1), _XCTDescriptionForValue(box2))); \\\n    } \\\n} while (0)\n\n#define uncheckedAssertEqualObjects(ex1, ex2) do { \\\n    id value1 = (ex1); \\\n    id value2 = (ex2); \\\n    if (value1 != value2 && ![(id)value1 isEqual:value2]) { \\\n        _XCTRegisterFailure(nil, _XCTFailureDescription(_XCTAssertion_EqualObjects, 0, @#ex1, @#ex2, value1, value2)); \\\n    } \\\n} while (0)\n\n#define uncheckedAssertTrue(ex) uncheckedAssertEqual(ex, true)\n#define uncheckedAssertFalse(ex) uncheckedAssertEqual(ex, false)\n#define uncheckedAssertNil(ex) uncheckedAssertEqual(ex, nil)\n"
  },
  {
    "path": "Realm/TestUtils/include/RLMChildProcessEnvironment.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Foundation/Foundation.h>\n\n@interface RLMChildProcessEnvironment : NSObject \n\n/// A single app identifier provided by the parent process.\n@property (nonatomic, readonly, nullable) NSString *appId;\n/// A list of app identifiers provided by the parent process.\n@property (nonatomic, readonly, nonnull) NSArray<NSString *> *appIds;\n/// An email credential provided by the parent process.\n@property (nonatomic, readonly, nullable) NSString *email;\n/// A password credential provided by the parent process.\n@property (nonatomic, readonly, nullable) NSString *password;\n/// A unique identifier set by the user (this differs from the PID).\n@property (nonatomic, readonly) NSInteger identifier;\n\n- (nonnull instancetype)init;\n\n- (nonnull instancetype)initWithAppIds:(NSArray<NSString *> * _Nullable)appIds\n                                 email:(NSString * _Nullable)email\n                              password:(NSString * _Nullable)password\n                             identifer:(NSInteger)identifier;\n\n- (NSDictionary<NSString *, NSString *> * _Nonnull)dictionaryValue;\n\n+ (instancetype _Nonnull)current;\n\n@end\n"
  },
  {
    "path": "Realm/TestUtils/include/RLMMultiProcessTestCase.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n@class NSTask, RLMChildProcessEnvironment;\n\n@interface RLMMultiProcessTestCase : RLMTestCase\n// if true, this is running the main test process\n@property (nonatomic, readonly) bool isParent;\n\n// spawn a child process running the current test and wait for it complete\n// returns the return code of the process\n- (int)runChildAndWait;\n- (int)runChildAndWaitWithAppIds:(NSArray *)appIds;\n- (int)runChildAndWaitWithEnvironment:(RLMChildProcessEnvironment *)environment;\n\n- (NSTask *)childTask;\n- (NSTask *)childTaskWithAppIds:(NSArray *)appIds;\n\n@end\n\n#define RLMRunChildAndWait() \\\n    XCTAssertEqual(0, [self runChildAndWait], @\"Tests in child process failed\")\n\n#define RLMRunChildAndWaitWithAppIds(...) \\\n    XCTAssertEqual(0, [self runChildAndWaitWithAppIds:@[__VA_ARGS__]], @\"Tests in child process failed\")\n"
  },
  {
    "path": "Realm/TestUtils/include/RLMTestCase.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <XCTest/XCTest.h>\n#import \"RLMAssertions.h\"\n#import \"RLMTestObjects.h\"\n\nRLM_HEADER_AUDIT_BEGIN(nullability, sendability)\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\nNSURL *RLMTestRealmURL(void);\nNSURL *RLMDefaultRealmURL(void);\nNSString *RLMRealmPathForFile(NSString *);\nNSData *RLMGenerateKey(void);\n#ifdef __cplusplus\n}\n#endif\n\n@interface RLMTestCaseBase : XCTestCase\n- (void)resetRealmState;\n@end\n\n@interface RLMTestCase : RLMTestCaseBase\n\n- (RLMRealm *)realmWithTestPath;\n- (RLMRealm *)realmWithTestPathAndSchema:(nullable RLMSchema *)schema;\n\n- (RLMRealm *)inMemoryRealmWithIdentifier:(NSString *)identifier;\n- (RLMRealm *)readOnlyRealmWithURL:(NSURL *)fileURL error:(NSError **)error;\n\n- (void)deleteFiles;\n- (void)deleteRealmFileAtURL:(NSURL *)fileURL;\n\n- (void)waitForNotification:(RLMNotification)expectedNote realm:(RLMRealm *)realm block:(dispatch_block_t)block;\n\n- (nullable id)nonLiteralNil;\n- (BOOL)encryptTests;\n\n- (void)dispatchAsync:(NS_SWIFT_SENDABLE dispatch_block_t)block;\n- (void)dispatchAsyncAndWait:(NS_SWIFT_SENDABLE dispatch_block_t)block;\n\n@property (nonatomic, readonly) dispatch_queue_t bgQueue;\n\n@end\n\nRLM_HEADER_AUDIT_END(nullability, sendability)\n"
  },
  {
    "path": "Realm/TestUtils/include/RLMTestObjects.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/Realm.h>\n\n#define RLM_GENERIC_ARRAY(CLASS) RLMArray<CLASS *><CLASS>\n#define RLM_GENERIC_SET(CLASS) RLMSet<CLASS *><CLASS>\n\n#pragma mark - Abstract Objects\n#pragma mark -\n\n#pragma mark SingleTypeObjects\n\n@interface StringObject : RLMObject\n\n@property NSString *stringCol;\n\n@property(readonly) NSString *firstLetter;\n\n@end\n\n@interface IntObject : RLMObject\n\n@property int intCol;\n\n@end\n\n@interface AllIntSizesObject : RLMObject\n// int8_t not supported due to being ambiguous with BOOL\n\n@property int16_t int16;\n@property int32_t int32;\n@property int64_t int64;\n\n@end\n\n@interface FloatObject : RLMObject\n\n@property float floatCol;\n\n@end\n\n@interface DoubleObject : RLMObject\n\n@property double doubleCol;\n\n@end\n\n@interface BoolObject : RLMObject\n\n@property BOOL boolCol;\n\n@end\n\n@interface DateObject : RLMObject\n\n@property NSDate *dateCol;\n\n@end\n\n@interface BinaryObject : RLMObject\n\n@property NSData *binaryCol;\n\n@end\n\n@interface DecimalObject : RLMObject\n@property RLMDecimal128 *decimalCol;\n@end\n\n@interface UTF8Object : RLMObject\n@property NSString *柱колоéнǢкƱаم;\n@end\n\n@interface IndexedStringObject : RLMObject\n@property NSString *stringCol;\n@end\n\nRLM_COLLECTION_TYPE(StringObject)\nRLM_COLLECTION_TYPE(IntObject)\n\n@interface LinkStringObject : RLMObject\n@property StringObject *objectCol;\n@end\n\n@interface LinkIndexedStringObject : RLMObject\n@property IndexedStringObject *objectCol;\n@end\n\n@interface RequiredPropertiesObject : RLMObject\n@property NSString *stringCol;\n@property NSData *binaryCol;\n@property NSDate *dateCol;\n@end\n\n@interface IgnoredURLObject : RLMObject\n@property NSString *name;\n@property NSURL *url;\n@end\n\n@interface EmbeddedIntObject : RLMEmbeddedObject\n@property int intCol;\n@end\nRLM_COLLECTION_TYPE(EmbeddedIntObject)\n\n@interface EmbeddedIntParentObject : RLMObject\n@property int pk;\n@property EmbeddedIntObject *object;\n@property RLMArray<EmbeddedIntObject> *array;\n@end\n\n@interface UuidObject: RLMObject\n@property NSUUID *uuidCol;\n@end\n\n@interface MixedObject: RLMObject\n@property id<RLMValue> anyCol;\n@property RLMArray<RLMValue> *anyArray;\n@end\n\n#pragma mark AllTypesObject\n\n@interface AllTypesObject : RLMObject\n@property BOOL          boolCol;\n@property int           intCol;\n@property float         floatCol;\n@property double        doubleCol;\n@property NSString     *stringCol;\n@property NSData       *binaryCol;\n@property NSDate       *dateCol;\n@property bool          cBoolCol;\n@property int64_t       longCol;\n@property RLMDecimal128 *decimalCol;\n@property RLMObjectId  *objectIdCol;\n@property NSUUID       *uuidCol;\n@property StringObject *objectCol;\n@property MixedObject  *mixedObjectCol;\n@property (readonly) RLMLinkingObjects *linkingObjectsCol;\n@property id<RLMValue> anyCol;\n\n+ (NSDictionary *)values:(int)i stringObject:(StringObject *)so;\n+ (NSDictionary *)values:(int)i\n            stringObject:(StringObject *)so\n             mixedObject:(MixedObject *)mo;\n@end\n\nRLM_COLLECTION_TYPE(AllTypesObject)\n\n@interface LinkToAllTypesObject : RLMObject\n@property AllTypesObject *allTypesCol;\n@end\n\n@interface ArrayOfAllTypesObject : RLMObject\n@property RLM_GENERIC_ARRAY(AllTypesObject) *array;\n@end\n\n@interface SetOfAllTypesObject : RLMObject\n@property RLM_GENERIC_SET(AllTypesObject) *set;\n@end\n\n@interface DictionaryOfAllTypesObject : RLMObject\n@property RLMDictionary<NSString *, AllTypesObject*><RLMString, AllTypesObject> *dictionary;\n@end\n\n@interface AllOptionalTypes : RLMObject\n@property NSNumber<RLMInt> *intObj;\n@property NSNumber<RLMFloat> *floatObj;\n@property NSNumber<RLMDouble> *doubleObj;\n@property NSNumber<RLMBool> *boolObj;\n@property NSString *string;\n@property NSData *data;\n@property NSDate *date;\n@property RLMDecimal128 *decimal;\n@property RLMObjectId *objectId;\n@property NSUUID *uuidCol;\n@end\n\n@interface AllOptionalTypesPK : RLMObject\n@property int pk;\n\n@property NSNumber<RLMInt> *intObj;\n@property NSNumber<RLMFloat> *floatObj;\n@property NSNumber<RLMDouble> *doubleObj;\n@property NSNumber<RLMBool> *boolObj;\n@property NSString *string;\n@property NSData *data;\n@property NSDate *date;\n@property RLMDecimal128 *decimal;\n@property RLMObjectId *objectId;\n@property NSUUID *uuidCol;\n@end\n\n@interface AllPrimitiveArrays : RLMObject\n@property RLMArray<RLMInt> *intObj;\n@property RLMArray<RLMFloat> *floatObj;\n@property RLMArray<RLMDouble> *doubleObj;\n@property RLMArray<RLMBool> *boolObj;\n@property RLMArray<RLMString> *stringObj;\n@property RLMArray<RLMDate> *dateObj;\n@property RLMArray<RLMData> *dataObj;\n@property RLMArray<RLMDecimal128> *decimalObj;\n@property RLMArray<RLMObjectId> *objectIdObj;\n@property RLMArray<RLMUUID> *uuidObj;\n@property RLMArray<RLMValue> *anyBoolObj;\n@property RLMArray<RLMValue> *anyIntObj;\n@property RLMArray<RLMValue> *anyFloatObj;\n@property RLMArray<RLMValue> *anyDoubleObj;\n@property RLMArray<RLMValue> *anyStringObj;\n@property RLMArray<RLMValue> *anyDataObj;\n@property RLMArray<RLMValue> *anyDateObj;\n@property RLMArray<RLMValue> *anyDecimalObj;\n@property RLMArray<RLMValue> *anyObjectIdObj;\n@property RLMArray<RLMValue> *anyUUIDObj;\n@end\n\n@interface AllOptionalPrimitiveArrays : RLMObject\n@property RLMArray<RLMInt> *intObj;\n@property RLMArray<RLMFloat> *floatObj;\n@property RLMArray<RLMDouble> *doubleObj;\n@property RLMArray<RLMBool> *boolObj;\n@property RLMArray<RLMString> *stringObj;\n@property RLMArray<RLMDate> *dateObj;\n@property RLMArray<RLMData> *dataObj;\n@property RLMArray<RLMDecimal128> *decimalObj;\n@property RLMArray<RLMObjectId> *objectIdObj;\n@property RLMArray<RLMUUID> *uuidObj;\n@end\n\n@interface AllPrimitiveSets : RLMObject\n@property RLMSet<RLMInt> *intObj;\n@property RLMSet<RLMInt> *intObj2;\n@property RLMSet<RLMFloat> *floatObj;\n@property RLMSet<RLMFloat> *floatObj2;\n@property RLMSet<RLMDouble> *doubleObj;\n@property RLMSet<RLMDouble> *doubleObj2;\n@property RLMSet<RLMBool> *boolObj;\n@property RLMSet<RLMBool> *boolObj2;\n@property RLMSet<RLMString> *stringObj;\n@property RLMSet<RLMString> *stringObj2;\n@property RLMSet<RLMDate> *dateObj;\n@property RLMSet<RLMDate> *dateObj2;\n@property RLMSet<RLMData> *dataObj;\n@property RLMSet<RLMData> *dataObj2;\n@property RLMSet<RLMDecimal128> *decimalObj;\n@property RLMSet<RLMDecimal128> *decimalObj2;\n@property RLMSet<RLMObjectId> *objectIdObj;\n@property RLMSet<RLMObjectId> *objectIdObj2;\n@property RLMSet<RLMUUID> *uuidObj;\n@property RLMSet<RLMUUID> *uuidObj2;\n\n@property RLMSet<RLMValue> *anyBoolObj;\n@property RLMSet<RLMValue> *anyBoolObj2;\n@property RLMSet<RLMValue> *anyIntObj;\n@property RLMSet<RLMValue> *anyIntObj2;\n@property RLMSet<RLMValue> *anyFloatObj;\n@property RLMSet<RLMValue> *anyFloatObj2;\n@property RLMSet<RLMValue> *anyDoubleObj;\n@property RLMSet<RLMValue> *anyDoubleObj2;\n@property RLMSet<RLMValue> *anyStringObj;\n@property RLMSet<RLMValue> *anyStringObj2;\n@property RLMSet<RLMValue> *anyDataObj;\n@property RLMSet<RLMValue> *anyDataObj2;\n@property RLMSet<RLMValue> *anyDateObj;\n@property RLMSet<RLMValue> *anyDateObj2;\n@property RLMSet<RLMValue> *anyDecimalObj;\n@property RLMSet<RLMValue> *anyDecimalObj2;\n@property RLMSet<RLMValue> *anyObjectIdObj;\n@property RLMSet<RLMValue> *anyObjectIdObj2;\n@property RLMSet<RLMValue> *anyUUIDObj;\n@property RLMSet<RLMValue> *anyUUIDObj2;\n\n@end\n\n@interface AllOptionalPrimitiveSets : RLMObject\n@property RLMSet<RLMInt> *intObj;\n@property RLMSet<RLMInt> *intObj2;\n@property RLMSet<RLMFloat> *floatObj;\n@property RLMSet<RLMFloat> *floatObj2;\n@property RLMSet<RLMDouble> *doubleObj;\n@property RLMSet<RLMDouble> *doubleObj2;\n@property RLMSet<RLMBool> *boolObj;\n@property RLMSet<RLMBool> *boolObj2;\n@property RLMSet<RLMString> *stringObj;\n@property RLMSet<RLMString> *stringObj2;\n@property RLMSet<RLMDate> *dateObj;\n@property RLMSet<RLMDate> *dateObj2;\n@property RLMSet<RLMData> *dataObj;\n@property RLMSet<RLMData> *dataObj2;\n@property RLMSet<RLMDecimal128> *decimalObj;\n@property RLMSet<RLMDecimal128> *decimalObj2;\n@property RLMSet<RLMObjectId> *objectIdObj;\n@property RLMSet<RLMObjectId> *objectIdObj2;\n@property RLMSet<RLMUUID> *uuidObj;\n@property RLMSet<RLMUUID> *uuidObj2;\n@end\n\n@interface AllPrimitiveRLMValues : RLMObject\n@property id<RLMValue> nullVal;\n@property id<RLMValue> intVal;\n@property id<RLMValue> floatVal;\n@property id<RLMValue> doubleVal;\n@property id<RLMValue> boolVal;\n@property id<RLMValue> stringVal;\n@property id<RLMValue> dateVal;\n@property id<RLMValue> dataVal;\n@property id<RLMValue> decimalVal;\n@property id<RLMValue> objectIdVal;\n@property id<RLMValue> uuidVal;\n@end\n\n@interface AllDictionariesObject : RLMObject\n@property RLMDictionary<NSString *, NSNumber *><RLMString, RLMInt> *intDict;\n@property RLMDictionary<NSString *, NSNumber *><RLMString, RLMFloat> *floatDict;\n@property RLMDictionary<NSString *, NSNumber *><RLMString, RLMDouble> *doubleDict;\n@property RLMDictionary<NSString *, NSNumber *><RLMString, RLMBool> *boolDict;\n@property RLMDictionary<NSString *, NSString *><RLMString, RLMString> *stringDict;\n@property RLMDictionary<NSString *, NSDate *><RLMString, RLMDate> *dateDict;\n@property RLMDictionary<NSString *, NSData *><RLMString, RLMData> *dataDict;\n@property RLMDictionary<NSString *, RLMDecimal128 *><RLMString, RLMDecimal128> *decimalDict;\n@property RLMDictionary<NSString *, RLMObjectId *><RLMString, RLMObjectId> *objectIdDict;\n@property RLMDictionary<NSString *, NSUUID *><RLMString, RLMUUID> *uuidDict;\n@property RLMDictionary<NSString *, StringObject *><RLMString, StringObject> *stringObjDict;\n@end\n\n@interface AllPrimitiveDictionaries : RLMObject\n@property RLMDictionary<NSString *, NSNumber *><RLMString, RLMInt> *intObj;\n@property RLMDictionary<NSString *, NSNumber *><RLMString, RLMFloat> *floatObj;\n@property RLMDictionary<NSString *, NSNumber *><RLMString, RLMDouble> *doubleObj;\n@property RLMDictionary<NSString *, NSNumber *><RLMString, RLMBool> *boolObj;\n@property RLMDictionary<NSString *, NSString *><RLMString, RLMString> *stringObj;\n@property RLMDictionary<NSString *, NSDate *><RLMString, RLMDate> *dateObj;\n@property RLMDictionary<NSString *, NSData *><RLMString, RLMData> *dataObj;\n@property RLMDictionary<NSString *, RLMDecimal128 *><RLMString, RLMDecimal128> *decimalObj;\n@property RLMDictionary<NSString *, RLMObjectId *><RLMString, RLMObjectId> *objectIdObj;\n@property RLMDictionary<NSString *, NSUUID *><RLMString, RLMUUID> *uuidObj;\n@property RLMDictionary<NSString *, NSObject *><RLMString, RLMValue> *anyBoolObj;\n@property RLMDictionary<NSString *, NSObject *><RLMString, RLMValue> *anyIntObj;\n@property RLMDictionary<NSString *, NSObject *><RLMString, RLMValue> *anyFloatObj;\n@property RLMDictionary<NSString *, NSObject *><RLMString, RLMValue> *anyDoubleObj;\n@property RLMDictionary<NSString *, NSObject *><RLMString, RLMValue> *anyStringObj;\n@property RLMDictionary<NSString *, NSObject *><RLMString, RLMValue> *anyDataObj;\n@property RLMDictionary<NSString *, NSObject *><RLMString, RLMValue> *anyDateObj;\n@property RLMDictionary<NSString *, NSObject *><RLMString, RLMValue> *anyDecimalObj;\n@property RLMDictionary<NSString *, NSObject *><RLMString, RLMValue> *anyObjectIdObj;\n@property RLMDictionary<NSString *, NSObject *><RLMString, RLMValue> *anyUUIDObj;\n@end\n\n@interface AllOptionalPrimitiveDictionaries : RLMObject\n@property RLMDictionary<NSString *, NSNumber *><RLMString, RLMInt> *intObj;\n@property RLMDictionary<NSString *, NSNumber *><RLMString, RLMFloat> *floatObj;\n@property RLMDictionary<NSString *, NSNumber *><RLMString, RLMDouble> *doubleObj;\n@property RLMDictionary<NSString *, NSNumber *><RLMString, RLMBool> *boolObj;\n@property RLMDictionary<NSString *, NSString *><RLMString, RLMString> *stringObj;\n@property RLMDictionary<NSString *, NSDate *><RLMString, RLMDate> *dateObj;\n@property RLMDictionary<NSString *, NSData *><RLMString, RLMData> *dataObj;\n@property RLMDictionary<NSString *, RLMDecimal128 *><RLMString, RLMDecimal128> *decimalObj;\n@property RLMDictionary<NSString *, RLMObjectId *><RLMString, RLMObjectId> *objectIdObj;\n@property RLMDictionary<NSString *, NSUUID *><RLMString, RLMUUID> *uuidObj;\n@end\n\n#pragma mark - Real Life Objects\n#pragma mark -\n\n#pragma mark EmployeeObject\n\n@interface EmployeeObject : RLMObject\n\n@property NSString *name;\n@property int age;\n@property BOOL hired;\n\n@end\n\nRLM_COLLECTION_TYPE(EmployeeObject)\n\n#pragma mark CompanyObject\n\n@interface CompanyObject : RLMObject\n\n@property NSString *name;\n@property RLM_GENERIC_ARRAY(EmployeeObject) *employees;\n@property RLM_GENERIC_SET(EmployeeObject) *employeeSet;\n@property RLMDictionary<NSString *, EmployeeObject *><RLMString, EmployeeObject> *employeeDict;\n\n@end\n\n#pragma mark LinkToCompanyObject\n\n@interface LinkToCompanyObject : RLMObject\n\n@property CompanyObject *company;\n\n@end\n\n#pragma mark DogObject\n\n@interface DogObject : RLMObject\n@property NSString *dogName;\n@property int age;\n@property (readonly) RLMLinkingObjects *owners;\n@end\n\nRLM_COLLECTION_TYPE(DogObject)\n\n@interface DogArrayObject : RLMObject\n@property RLM_GENERIC_ARRAY(DogObject) *dogs;\n@end\n\n@interface DogSetObject : RLMObject\n@property RLM_GENERIC_SET(DogObject) *dogs;\n@end\n\n@interface DogDictionaryObject : RLMObject\n@property RLMDictionary<NSString *, DogObject *><RLMString, DogObject> *dogs;\n@end\n\n#pragma mark OwnerObject\n\n@interface OwnerObject : RLMObject\n\n@property NSString *name;\n@property DogObject *dog;\n\n@end\n\n#pragma mark - Specific Use Objects\n#pragma mark -\n\n#pragma mark CustomAccessorsObject\n\n@interface CustomAccessorsObject : RLMObject\n\n@property (getter = getThatName) NSString *name;\n@property (setter = setTheInt:)  int age;\n\n@end\n\n#pragma mark BaseClassStringObject\n\n@interface BaseClassStringObject : RLMObject\n\n@property int intCol;\n\n@end\n\n@interface BaseClassStringObject ()\n\n@property NSString *stringCol;\n\n@end\n\n#pragma mark CircleObject\n\n@interface CircleObject : RLMObject\n\n@property NSString *data;\n@property CircleObject *next;\n\n@end\n\nRLM_COLLECTION_TYPE(CircleObject);\n\n#pragma mark CircleArrayObject\n\n@interface CircleArrayObject : RLMObject\n@property RLM_GENERIC_ARRAY(CircleObject) *circles;\n@end\n\n#pragma mark CircleSetObject\n\n@interface CircleSetObject : RLMObject\n@property RLM_GENERIC_SET(CircleObject) *circles;\n@end\n\n#pragma mark CircleDictionaryObject\n\n@interface CircleDictionaryObject : RLMObject\n@property RLMDictionary<NSString *, CircleObject *><RLMString, CircleObject> *circles;\n@end\n\n#pragma mark ArrayPropertyObject\n\n@interface ArrayPropertyObject : RLMObject\n\n@property NSString *name;\n@property RLM_GENERIC_ARRAY(StringObject) *array;\n@property RLM_GENERIC_ARRAY(IntObject) *intArray;\n\n@end\n\n#pragma mark SetPropertyObject\n\n@interface SetPropertyObject : RLMObject\n\n@property NSString *name;\n@property RLM_GENERIC_SET(StringObject) *set;\n@property RLM_GENERIC_SET(IntObject) *intSet;\n\n@end\n\n#pragma mark DictionaryPropertyObject\n\n@interface DictionaryPropertyObject : RLMObject\n@property RLMDictionary<NSString *, StringObject *><RLMString, StringObject> *stringDictionary;\n@property RLMDictionary<NSString *, NSNumber *><RLMString, RLMInt> *intDictionary;\n@property RLMDictionary<NSString *, NSString *><RLMString, RLMString> *primitiveStringDictionary;\n@property RLMDictionary<NSString *, EmbeddedIntObject *><RLMString, EmbeddedIntObject> *embeddedDictionary;\n@property RLMDictionary<NSString *, IntObject *><RLMString, IntObject> *intObjDictionary;\n@end\n\n#pragma mark DynamicObject\n\n@interface DynamicTestObject : RLMObject\n\n@property NSString *stringCol;\n@property int intCol;\n\n@end\n\n#pragma mark AggregateObject\n\n@interface AggregateObject : RLMObject\n\n@property int     intCol;\n@property float   floatCol;\n@property double  doubleCol;\n@property BOOL    boolCol;\n@property NSDate *dateCol;\n@property id<RLMValue> anyCol;\n\n@end\n\nRLM_COLLECTION_TYPE(AggregateObject)\n@interface AggregateArrayObject : RLMObject\n@property RLMArray<AggregateObject *><AggregateObject> *array;\n@end\n\n@interface AggregateSetObject : RLMObject\n@property RLMSet<AggregateObject *><AggregateObject> *set;\n@end\n\n@interface AggregateDictionaryObject : RLMObject\n@property RLMDictionary<NSString *, AggregateObject *><RLMString, AggregateObject> *dictionary;\n@end\n\n#pragma mark PrimaryStringObject\n\n@interface PrimaryStringObject : RLMObject\n@property NSString *stringCol;\n@property int intCol;\n@end\n\n@interface PrimaryNullableStringObject : RLMObject\n@property NSString *stringCol;\n@property int intCol;\n@end\n\n@interface PrimaryIntObject : RLMObject\n@property int intCol;\n@end\nRLM_COLLECTION_TYPE(PrimaryIntObject);\n\n@interface PrimaryInt64Object : RLMObject\n@property int64_t int64Col;\n@end\n\n@interface PrimaryNullableIntObject : RLMObject\n@property NSNumber<RLMInt> *optIntCol;\n@property int value;\n@end\n\n@interface ReadOnlyPropertyObject : RLMObject\n@property (readonly) NSNumber *readOnlyUnsupportedProperty;\n@property (readonly) int readOnlySupportedProperty;\n@property (readonly) int readOnlyPropertyMadeReadWriteInClassExtension;\n@end\n\n#pragma mark IntegerArrayPropertyObject\n\n@interface IntegerArrayPropertyObject : RLMObject\n\n@property NSInteger number;\n@property RLM_GENERIC_ARRAY(IntObject) *array;\n\n@end\n\n#pragma mark IntegerSetPropertyObject\n\n@interface IntegerSetPropertyObject : RLMObject\n\n@property NSInteger number;\n@property RLM_GENERIC_SET(IntObject) *set;\n\n@end\n\n#pragma mark IntegerDictionaryPropertyObject\n\n@interface IntegerDictionaryPropertyObject : RLMObject\n\n@property NSInteger number;\n@property RLMDictionary<NSString *, IntObject *><RLMString, IntObject> *dictionary;\n\n@end\n\n@interface NumberObject : RLMObject\n@property NSNumber<RLMInt> *intObj;\n@property NSNumber<RLMFloat> *floatObj;\n@property NSNumber<RLMDouble> *doubleObj;\n@property NSNumber<RLMBool> *boolObj;\n@end\n\n@interface NumberDefaultsObject : NumberObject\n@end\n\n@interface RequiredNumberObject : RLMObject\n@property NSNumber<RLMInt> *intObj;\n@property NSNumber<RLMFloat> *floatObj;\n@property NSNumber<RLMDouble> *doubleObj;\n@property NSNumber<RLMBool> *boolObj;\n@end\n\n#pragma mark CustomInitializerObject\n\n@interface CustomInitializerObject : RLMObject\n@property NSString *stringCol;\n@end\n\n#pragma mark AbstractObject\n\n@interface AbstractObject : RLMObject\n@end\n\n#pragma mark PersonObject\n\n@class PersonObject;\nRLM_COLLECTION_TYPE(PersonObject);\n\n@interface PersonObject : RLMObject\n@property NSString *name;\n@property NSInteger age;\n@property RLMArray<PersonObject> *children;\n@property (readonly) RLMLinkingObjects *parents;\n@end\n\n@interface PrimaryEmployeeObject : EmployeeObject\n@end\nRLM_COLLECTION_TYPE(PrimaryEmployeeObject);\n\n@interface LinkToPrimaryEmployeeObject : RLMObject\n@property PrimaryEmployeeObject *wrapped;\n@end\n\n@interface PrimaryCompanyObject : RLMObject\n@property NSString *name;\n@property RLM_GENERIC_ARRAY(PrimaryEmployeeObject) *employees;\n@property RLM_GENERIC_SET(PrimaryEmployeeObject) *employeeSet;\n@property RLMDictionary<NSString *, PrimaryEmployeeObject *><RLMString, PrimaryEmployeeObject> *employeeDict;\n@property PrimaryEmployeeObject *intern;\n@property LinkToPrimaryEmployeeObject *wrappedIntern;\n@end\nRLM_COLLECTION_TYPE(PrimaryCompanyObject);\n\n@interface ArrayOfPrimaryCompanies : RLMObject\n@property RLM_GENERIC_ARRAY(PrimaryCompanyObject) *companies;\n@end\n\n@interface SetOfPrimaryCompanies : RLMObject\n@property RLM_GENERIC_SET(PrimaryCompanyObject) *companies;\n@end\n\n#pragma mark ComputedPropertyNotExplicitlyIgnoredObject\n\n@interface ComputedPropertyNotExplicitlyIgnoredObject : RLMObject\n@property NSString *_URLBacking;\n@property NSURL *URL;\n@end\n\n@interface RenamedProperties : RLMObject\n@property (nonatomic) int intCol;\n@property NSString *stringCol;\n@end\n\n@interface RenamedProperties1 : RLMObject\n@property (nonatomic) int propA;\n@property (nonatomic) NSString *propB;\n@property (readonly, nonatomic) RLMLinkingObjects *linking1;\n@property (readonly, nonatomic) RLMLinkingObjects *linking2;\n@end\n\n@interface RenamedProperties2 : RLMObject\n@property (nonatomic) int propC;\n@property (nonatomic) NSString *propD;\n@property (readonly, nonatomic) RLMLinkingObjects *linking1;\n@property (readonly, nonatomic) RLMLinkingObjects *linking2;\n@end\n\nRLM_COLLECTION_TYPE(RenamedProperties1)\nRLM_COLLECTION_TYPE(RenamedProperties2)\nRLM_COLLECTION_TYPE(RenamedProperties)\n\n@interface LinkToRenamedProperties : RLMObject\n@property (nonatomic) RenamedProperties *link;\n@property (nonatomic) RLM_GENERIC_ARRAY(RenamedProperties) *array;\n@property (nonatomic) RLM_GENERIC_SET(RenamedProperties) *set;\n@property (nonatomic) RLMDictionary<NSString *, RenamedProperties *><RLMString, RenamedProperties> *dictionary;\n@end\n\n@interface LinkToRenamedProperties1 : RLMObject\n@property (nonatomic) RenamedProperties1 *linkA;\n@property (nonatomic) RenamedProperties2 *linkB;\n@property (nonatomic) RLM_GENERIC_ARRAY(RenamedProperties1) *array;\n@property (nonatomic) RLM_GENERIC_SET(RenamedProperties1) *set;\n@property (nonatomic) RLMDictionary<NSString *, RenamedProperties1 *><RLMString, RenamedProperties1> *dictionary;\n@end\n\n@interface LinkToRenamedProperties2 : RLMObject\n@property (nonatomic) RenamedProperties2 *linkC;\n@property (nonatomic) RenamedProperties1 *linkD;\n@property (nonatomic) RLM_GENERIC_ARRAY(RenamedProperties2) *array;\n@property (nonatomic) RLM_GENERIC_SET(RenamedProperties2) *set;\n@property (nonatomic) RLMDictionary<NSString *, RenamedProperties2 *><RLMString, RenamedProperties2> *dictionary;\n@end\n\n@interface RenamedPrimaryKey : RLMObject\n@property (nonatomic) int pk;\n@property (nonatomic) int value;\n@end\n\n#pragma mark FakeObject\n\n@interface FakeObject : RLMObject\n@end\n\n@interface FakeEmbeddedObject : RLMEmbeddedObject\n@end\n"
  },
  {
    "path": "Realm/TestUtils/include/TestUtils.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Foundation/Foundation.h>\n#import <XCTest/XCTestCase.h>\n#import <Realm/RLMConstants.h>\n\nRLM_HEADER_AUDIT_BEGIN(nullability)\n\nFOUNDATION_EXTERN void RLMAssertThrowsWithReasonMatchingSwift(XCTestCase *self,\n                                                              __attribute__((noescape)) dispatch_block_t block,\n                                                              NSString *regexString,\n                                                              NSString *_Nullable message,\n                                                              NSString *fileName,\n                                                              NSUInteger lineNumber);\n\n\n// It appears to be impossible to check this from Swift so we need a helper function\nFOUNDATION_EXTERN bool RLMThreadSanitizerEnabled(void);\n\nFOUNDATION_EXTERN bool RLMCanFork(void);\nFOUNDATION_EXTERN pid_t RLMFork(void);\n\nRLM_HEADER_AUDIT_END(nullability)\n"
  },
  {
    "path": "Realm/Tests/ArrayPropertyTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n@implementation DogArrayObject\n@end\n\n@interface ArrayPropertyTests : RLMTestCase\n@end\n\n@implementation ArrayPropertyTests\n\n-(void)testPopulateEmptyArray {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    ArrayPropertyObject *array = [ArrayPropertyObject createInRealm:realm withValue:@[@\"arrayObject\", @[], @[]]];\n    XCTAssertNotNil(array.array, @\"Should be able to get an empty array\");\n    XCTAssertEqual(array.array.count, 0U, @\"Should start with no array elements\");\n\n    StringObject *obj = [[StringObject alloc] init];\n    obj.stringCol = @\"a\";\n    [array.array addObject:obj];\n    [array.array addObject:[StringObject createInRealm:realm withValue:@[@\"b\"]]];\n    [array.array addObject:obj];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(array.array.count, 3U, @\"Should have three elements in array\");\n    XCTAssertEqualObjects([array.array[0] stringCol], @\"a\", @\"First element should have property value 'a'\");\n    XCTAssertEqualObjects([array.array[1] stringCol], @\"b\", @\"Second element should have property value 'b'\");\n    XCTAssertEqualObjects([array.array[2] stringCol], @\"a\", @\"Third element should have property value 'a'\");\n\n    RLMArray *arrayProp = array.array;\n    RLMAssertThrowsWithReasonMatching([arrayProp addObject:obj], @\"write transaction\");\n\n    // make sure we can fast enumerate\n    for (RLMObject *obj in array.array) {\n        XCTAssertTrue(obj.description.length, @\"Object should have description\");\n    }\n}\n\n-(void)testModifyDetatchedArray {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    ArrayPropertyObject *arObj = [ArrayPropertyObject createInRealm:realm withValue:@[@\"arrayObject\", @[], @[]]];\n    XCTAssertNotNil(arObj.array, @\"Should be able to get an empty array\");\n    XCTAssertEqual(arObj.array.count, 0U, @\"Should start with no array elements\");\n\n    StringObject *obj = [[StringObject alloc] init];\n    obj.stringCol = @\"a\";\n    RLMArray *array = arObj.array;\n    [array addObject:obj];\n    [array addObject:[StringObject createInRealm:realm withValue:@[@\"b\"]]];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(array.count, 2U, @\"Should have two elements in array\");\n    XCTAssertEqualObjects([array[0] stringCol], @\"a\", @\"First element should have property value 'a'\");\n    XCTAssertEqualObjects([arObj.array[1] stringCol], @\"b\", @\"Second element should have property value 'b'\");\n\n    RLMAssertThrowsWithReasonMatching([array addObject:obj], @\"write transaction\");\n}\n\n- (void)testDeleteUnmanagedObjectWithArrayProperty {\n    ArrayPropertyObject *arObj = [[ArrayPropertyObject alloc] initWithValue:@[@\"arrayObject\", @[@[@\"a\"]], @[]]];\n    RLMArray *stringArray = arObj.array;\n    XCTAssertFalse(stringArray.isInvalidated, @\"stringArray should be valid after creation.\");\n    arObj = nil;\n    XCTAssertFalse(stringArray.isInvalidated, @\"stringArray should still be valid after parent deletion.\");\n}\n\n- (void)testDeleteObjectWithArrayProperty {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    ArrayPropertyObject *arObj = [ArrayPropertyObject createInRealm:realm withValue:@[@\"arrayObject\", @[@[@\"a\"]], @[]]];\n    RLMArray *stringArray = arObj.array;\n    XCTAssertFalse(stringArray.isInvalidated, @\"stringArray should be valid after creation.\");\n    [realm deleteObject:arObj];\n    XCTAssertTrue(stringArray.isInvalidated, @\"stringArray should be invalid after parent deletion.\");\n    [realm commitWriteTransaction];\n}\n\n- (void)testDeleteObjectInArrayProperty {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    ArrayPropertyObject *arObj = [ArrayPropertyObject createInRealm:realm withValue:@[@\"arrayObject\", @[@[@\"a\"]], @[]]];\n    RLMArray *stringArray = arObj.array;\n    StringObject *firstObject = stringArray.firstObject;\n    [realm deleteObjects:[StringObject allObjectsInRealm:realm]];\n    XCTAssertFalse(stringArray.isInvalidated, @\"stringArray should be valid after member object deletion.\");\n    XCTAssertTrue(firstObject.isInvalidated, @\"firstObject should be invalid after deletion.\");\n    XCTAssertEqual(stringArray.count, 0U, @\"stringArray.count should be zero after deleting its only member.\");\n    [realm commitWriteTransaction];\n}\n\n-(void)testInsertMultiple {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    ArrayPropertyObject *obj = [ArrayPropertyObject createInRealm:realm withValue:@[@\"arrayObject\", @[], @[]]];\n    StringObject *child1 = [StringObject createInRealm:realm withValue:@[@\"a\"]];\n    StringObject *child2 = [[StringObject alloc] init];\n    child2.stringCol = @\"b\";\n    [obj.array addObjects:@[child2, child1]];\n    [realm commitWriteTransaction];\n\n    RLMResults *children = [StringObject allObjectsInRealm:realm];\n    XCTAssertEqualObjects([children[0] stringCol], @\"a\", @\"First child should be 'a'\");\n    XCTAssertEqualObjects([children[1] stringCol], @\"b\", @\"Second child should be 'b'\");\n}\n\n-(void)testInsertAtIndex {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    ArrayPropertyObject *obj = [ArrayPropertyObject createInRealm:realm withValue:@[@\"arrayObject\", @[], @[]]];\n    StringObject *child1 = [StringObject createInRealm:realm withValue:@[@\"a\"]];\n    StringObject *child2 = [[StringObject alloc] init];\n    child2.stringCol = @\"b\";\n    [obj.array addObject:child2];\n    RLMAssertThrowsWithReasonMatching([obj.array insertObject:child1 atIndex:2], @\"must be less than 2\");\n    [realm commitWriteTransaction];\n\n    RLMArray *children = obj.array;\n    XCTAssertEqual(children.count, 1U);\n    XCTAssertEqualObjects([children[0] stringCol], @\"b\", @\"Only child should be 'b'\");\n}\n\n- (void)testMove {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    ArrayPropertyObject *obj = [[ArrayPropertyObject alloc] initWithValue:@[@\"arrayObject\", @[@[@\"a\"], @[@\"b\"]], @[]]];\n    RLM_GENERIC_ARRAY(StringObject) *children = obj.array;\n\n    [children moveObjectAtIndex:1 toIndex:0];\n\n    XCTAssertEqualObjects([children[0] stringCol], @\"b\");\n    XCTAssertEqualObjects([children[1] stringCol], @\"a\");\n\n    [children moveObjectAtIndex:0 toIndex:1];\n\n    XCTAssertEqualObjects([children[0] stringCol], @\"a\");\n    XCTAssertEqualObjects([children[1] stringCol], @\"b\");\n\n    [children moveObjectAtIndex:0 toIndex:0];\n\n    XCTAssertEqualObjects([children[0] stringCol], @\"a\");\n    XCTAssertEqualObjects([children[1] stringCol], @\"b\");\n\n    RLMAssertThrowsWithReasonMatching([children moveObjectAtIndex:0 toIndex:2], @\"must be less than 2\");\n    RLMAssertThrowsWithReasonMatching([children moveObjectAtIndex:2 toIndex:0], @\"must be less than 2\");\n\n    [realm beginWriteTransaction];\n\n    [realm addObject:obj];\n    children = obj.array;\n\n    [children moveObjectAtIndex:1 toIndex:0];\n\n    XCTAssertEqualObjects([children[0] stringCol], @\"b\");\n    XCTAssertEqualObjects([children[1] stringCol], @\"a\");\n\n    [children moveObjectAtIndex:0 toIndex:1];\n\n    XCTAssertEqualObjects([children[0] stringCol], @\"a\");\n    XCTAssertEqualObjects([children[1] stringCol], @\"b\");\n\n    [children moveObjectAtIndex:0 toIndex:0];\n\n    XCTAssertEqualObjects([children[0] stringCol], @\"a\");\n    XCTAssertEqualObjects([children[1] stringCol], @\"b\");\n\n    RLMAssertThrowsWithReasonMatching([children moveObjectAtIndex:0 toIndex:2], @\"must be less than 2\");\n    RLMAssertThrowsWithReasonMatching([children moveObjectAtIndex:2 toIndex:0], @\"must be less than 2\");\n\n    [realm commitWriteTransaction];\n\n    RLMAssertThrowsWithReasonMatching([children moveObjectAtIndex:1 toIndex:0], @\"write transaction\");\n}\n\n- (void)testAddInvalidated {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    CompanyObject *company = [CompanyObject createInDefaultRealmWithValue:@[@\"company\", @[]]];\n\n    EmployeeObject *person = [[EmployeeObject alloc] init];\n    person.name = @\"Mary\";\n    [realm addObject:person];\n    [realm deleteObjects:[EmployeeObject allObjects]];\n\n    RLMAssertThrowsWithReasonMatching([company.employees addObject:person], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([company.employees insertObject:person atIndex:0], @\"invalidated\");\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAddNil {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    CompanyObject *company = [CompanyObject createInDefaultRealmWithValue:@[@\"company\", @[]]];\n\n    RLMAssertThrowsWithReason([company.employees addObject:self.nonLiteralNil],\n                              @\"Invalid nil value for array of 'EmployeeObject'.\");\n    [realm cancelWriteTransaction];\n}\n\n- (void)testUnmanaged {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    ArrayPropertyObject *array = [[ArrayPropertyObject alloc] init];\n    array.name = @\"name\";\n    XCTAssertNotNil(array.array, @\"RLMArray property should get created on access\");\n\n    XCTAssertNil(array.array.firstObject, @\"No objects added yet\");\n    XCTAssertNil(array.array.lastObject, @\"No objects added yet\");\n\n    StringObject *obj1 = [[StringObject alloc] init];\n    obj1.stringCol = @\"a\";\n    StringObject *obj2 = [[StringObject alloc] init];\n    obj2.stringCol = @\"b\";\n    StringObject *obj3 = [[StringObject alloc] init];\n    obj3.stringCol = @\"c\";\n    [array.array addObject:obj1];\n    [array.array addObject:obj2];\n    [array.array addObject:obj3];\n\n    XCTAssertEqualObjects(array.array.firstObject, obj1, @\"Objects should be equal\");\n    XCTAssertEqualObjects(array.array.lastObject, obj3, @\"Objects should be equal\");\n    XCTAssertEqualObjects([array.array objectAtIndex:1], obj2, @\"Objects should be equal\");\n    NSMutableIndexSet *indexSet = [NSMutableIndexSet new];\n    [indexSet addIndex:0];\n    [indexSet addIndex:2];\n    XCTAssertEqualObjects([array.array objectsAtIndexes:indexSet], (@[obj1, obj3]), @\"Objects should be equal\");\n\n    [realm beginWriteTransaction];\n    [realm addObject:array];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(array.array.count, 3U, @\"Should have two elements in array\");\n    XCTAssertEqualObjects([array.array[0] stringCol], @\"a\", @\"First element should have property value 'a'\");\n    XCTAssertEqualObjects([array.array[1] stringCol], @\"b\", @\"Second element should have property value 'b'\");\n    NSArray<StringObject *> *objectsAtIndexes = [array.array objectsAtIndexes:indexSet];\n    XCTAssertEqualObjects([objectsAtIndexes[0] stringCol], @\"a\", @\"First element should have property value 'a'\");\n    XCTAssertEqualObjects([objectsAtIndexes[1] stringCol], @\"c\", @\"Second element should have property value 'c'\");\n\n    [realm beginWriteTransaction];\n    [array.array replaceObjectAtIndex:0 withObject:obj3];\n    XCTAssertTrue([[array.array objectAtIndex:0] isEqualToObject:obj3], @\"Objects should be replaced\");\n    array.array[0] = obj1;\n    XCTAssertTrue([obj1 isEqualToObject:[array.array objectAtIndex:0]], @\"Objects should be replaced\");\n    [array.array removeLastObject];\n    XCTAssertEqual(array.array.count, 2U, @\"2 objects left\");\n    [array.array addObject:obj1];\n    [array.array removeAllObjects];\n    XCTAssertEqual(array.array.count, 0U, @\"All objects removed\");\n    [realm commitWriteTransaction];\n\n    ArrayPropertyObject *intArray = [[ArrayPropertyObject alloc] init];\n    IntObject *intObj = [[IntObject alloc] init];\n    intObj.intCol = 1;\n    RLMAssertThrowsWithReasonMatching([intArray.array addObject:(id)intObj], @\"IntObject.*StringObject\");\n    [intArray.intArray addObject:intObj];\n\n    XCTAssertThrows([intArray.intArray objectsWhere:@\"intCol == 1\"], @\"Should throw on unmanaged RLMArray\");\n    XCTAssertThrows(([intArray.intArray objectsWithPredicate:[NSPredicate predicateWithFormat:@\"intCol == %i\", 1]]), @\"Should throw on unmanaged RLMArray\");\n    XCTAssertThrows([intArray.intArray sortedResultsUsingKeyPath:@\"intCol\" ascending:YES], @\"Should throw on unmanaged RLMArray\");\n\n    XCTAssertEqual(0U, [intArray.intArray indexOfObjectWhere:@\"intCol == 1\"]);\n    XCTAssertEqual(0U, ([intArray.intArray indexOfObjectWithPredicate:[NSPredicate predicateWithFormat:@\"intCol == %i\", 1]]));\n\n    XCTAssertEqual([intArray.intArray indexOfObject:intObj], 0U, @\"Should be first element\");\n    XCTAssertEqual([intArray.intArray indexOfObject:intObj], 0U, @\"Should be first element\");\n\n    // test unmanaged with literals\n    __unused ArrayPropertyObject *obj = [[ArrayPropertyObject alloc] initWithValue:@[@\"n\", @[], @[[[IntObject alloc] initWithValue:@[@1]]]]];\n}\n\n- (void)testUnmanagedComparision {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    ArrayPropertyObject *array = [[ArrayPropertyObject alloc] init];\n    ArrayPropertyObject *array2 = [[ArrayPropertyObject alloc] init];\n\n    array.name = @\"name\";\n    array2.name = @\"name2\";\n    XCTAssertNotNil(array.array, @\"RLMArray property should get created on access\");\n    XCTAssertNotNil(array2.array, @\"RLMArray property should get created on access\");\n    XCTAssertTrue([array.array isEqual:array2.array], @\"Empty arrays should be equal\");\n\n    XCTAssertNil(array.array.firstObject, @\"No objects added yet\");\n    XCTAssertNil(array2.array.lastObject, @\"No objects added yet\");\n\n    StringObject *obj1 = [[StringObject alloc] init];\n    obj1.stringCol = @\"a\";\n    StringObject *obj2 = [[StringObject alloc] init];\n    obj2.stringCol = @\"b\";\n    StringObject *obj3 = [[StringObject alloc] init];\n    obj3.stringCol = @\"c\";\n    [array.array addObject:obj1];\n    [array.array addObject:obj2];\n    [array.array addObject:obj3];\n\n    [array2.array addObject:obj1];\n    [array2.array addObject:obj2];\n    [array2.array addObject:obj3];\n\n    XCTAssertTrue([array.array isEqual:array2.array], @\"Arrays should be equal\");\n    [array2.array removeLastObject];\n    XCTAssertFalse([array.array isEqual:array2.array], @\"Arrays should not be equal\");\n    [array2.array addObject:obj3];\n    XCTAssertTrue([array.array isEqual:array2.array], @\"Arrays should be equal\");\n\n    [realm beginWriteTransaction];\n    [realm addObject:array];\n    [realm commitWriteTransaction];\n\n    XCTAssertFalse([array.array isEqual:array2.array], @\"Comparing a managed array to an unmanaged one should fail\");\n    XCTAssertFalse([array2.array isEqual:array.array], @\"Comparing a managed array to an unmanaged one should fail\");\n}\n\n- (void)testUnmanagedPrimitive {\n    AllPrimitiveArrays *obj = [[AllPrimitiveArrays alloc] init];\n    XCTAssertTrue([obj.intObj isKindOfClass:[RLMArray class]]);\n    XCTAssertTrue([obj.floatObj isKindOfClass:[RLMArray class]]);\n    XCTAssertTrue([obj.doubleObj isKindOfClass:[RLMArray class]]);\n    XCTAssertTrue([obj.boolObj isKindOfClass:[RLMArray class]]);\n    XCTAssertTrue([obj.stringObj isKindOfClass:[RLMArray class]]);\n    XCTAssertTrue([obj.dataObj isKindOfClass:[RLMArray class]]);\n    XCTAssertTrue([obj.dateObj isKindOfClass:[RLMArray class]]);\n    XCTAssertTrue([obj.uuidObj isKindOfClass:[RLMArray class]]);\n    \n    [obj.intObj addObject:@1];\n    XCTAssertEqualObjects(obj.intObj[0], @1);\n    XCTAssertThrows([obj.intObj addObject:@\"\"]);\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    obj = [AllPrimitiveArrays createInRealm:realm withValue:@[@[],@[],@[],@[],@[],@[],@[]]];\n\n    XCTAssertTrue([obj.intObj isKindOfClass:[RLMArray class]]);\n    XCTAssertTrue([obj.floatObj isKindOfClass:[RLMArray class]]);\n    XCTAssertTrue([obj.doubleObj isKindOfClass:[RLMArray class]]);\n    XCTAssertTrue([obj.boolObj isKindOfClass:[RLMArray class]]);\n    XCTAssertTrue([obj.stringObj isKindOfClass:[RLMArray class]]);\n    XCTAssertTrue([obj.dataObj isKindOfClass:[RLMArray class]]);\n    XCTAssertTrue([obj.dateObj isKindOfClass:[RLMArray class]]);\n    XCTAssertTrue([obj.uuidObj isKindOfClass:[RLMArray class]]);\n    \n    [obj.intObj addObject:@5];\n    XCTAssertEqualObjects(obj.intObj.firstObject, @5);\n    [realm cancelWriteTransaction];\n}\n\n- (void)testReplaceObjectAtIndexInUnmanagedArray {\n    ArrayPropertyObject *array = [[ArrayPropertyObject alloc] init];\n    array.name = @\"name\";\n\n    StringObject *stringObj1 = [[StringObject alloc] init];\n    stringObj1.stringCol = @\"a\";\n    StringObject *stringObj2 = [[StringObject alloc] init];\n    stringObj2.stringCol = @\"b\";\n    StringObject *stringObj3 = [[StringObject alloc] init];\n    stringObj3.stringCol = @\"c\";\n    [array.array addObject:stringObj1];\n    [array.array addObject:stringObj2];\n    [array.array addObject:stringObj3];\n\n    IntObject *intObj1 = [[IntObject alloc] init];\n    intObj1.intCol = 0;\n    IntObject *intObj2 = [[IntObject alloc] init];\n    intObj2.intCol = 1;\n    IntObject *intObj3 = [[IntObject alloc] init];\n    intObj3.intCol = 2;\n    [array.intArray addObject:intObj1];\n    [array.intArray addObject:intObj2];\n    [array.intArray addObject:intObj3];\n\n    XCTAssertEqualObjects(array.array[0], stringObj1, @\"Objects should be equal\");\n    XCTAssertEqualObjects(array.array[1], stringObj2, @\"Objects should be equal\");\n    XCTAssertEqualObjects(array.array[2], stringObj3, @\"Objects should be equal\");\n    XCTAssertEqual(array.array.count, 3U, @\"Should have 3 elements in string array\");\n\n    XCTAssertEqualObjects(array.intArray[0], intObj1, @\"Objects should be equal\");\n    XCTAssertEqualObjects(array.intArray[1], intObj2, @\"Objects should be equal\");\n    XCTAssertEqualObjects(array.intArray[2], intObj3, @\"Objects should be equal\");\n    XCTAssertEqual(array.intArray.count, 3U, @\"Should have 3 elements in int array\");\n\n    StringObject *stringObj4 = [[StringObject alloc] init];\n    stringObj4.stringCol = @\"d\";\n\n    [array.array replaceObjectAtIndex:0 withObject:stringObj4];\n    XCTAssertTrue([[array.array objectAtIndex:0] isEqualToObject:stringObj4], @\"Objects should be replaced\");\n    XCTAssertEqual(array.array.count, 3U, @\"Should have 3 elements in int array\");\n\n    IntObject *intObj4 = [[IntObject alloc] init];\n    intObj4.intCol = 3;\n\n    [array.intArray replaceObjectAtIndex:1 withObject:intObj4];\n    XCTAssertTrue([[array.intArray objectAtIndex:1] isEqualToObject:intObj4], @\"Objects should be replaced\");\n    XCTAssertEqual(array.intArray.count, 3U, @\"Should have 3 elements in int array\");\n\n    RLMAssertThrowsWithReasonMatching([array.array replaceObjectAtIndex:0 withObject:(id)intObj4],\n                                      @\"IntObject.*StringObject\");\n    RLMAssertThrowsWithReasonMatching([array.intArray replaceObjectAtIndex:1 withObject:(id)stringObj4],\n                                      @\"StringObject.*IntObject\");\n}\n\n- (void)testDeleteObjectInUnmanagedArray {\n    ArrayPropertyObject *array = [[ArrayPropertyObject alloc] init];\n    array.name = @\"name\";\n\n    StringObject *stringObj1 = [[StringObject alloc] init];\n    stringObj1.stringCol = @\"a\";\n    StringObject *stringObj2 = [[StringObject alloc] init];\n    stringObj2.stringCol = @\"b\";\n    StringObject *stringObj3 = [[StringObject alloc] init];\n    stringObj3.stringCol = @\"c\";\n    [array.array addObject:stringObj1];\n    [array.array addObject:stringObj2];\n    [array.array addObject:stringObj3];\n\n    IntObject *intObj1 = [[IntObject alloc] init];\n    intObj1.intCol = 0;\n    IntObject *intObj2 = [[IntObject alloc] init];\n    intObj2.intCol = 1;\n    IntObject *intObj3 = [[IntObject alloc] init];\n    intObj3.intCol = 2;\n    [array.intArray addObject:intObj1];\n    [array.intArray addObject:intObj2];\n    [array.intArray addObject:intObj3];\n\n    XCTAssertEqualObjects(array.array[0], stringObj1, @\"Objects should be equal\");\n    XCTAssertEqualObjects(array.array[1], stringObj2, @\"Objects should be equal\");\n    XCTAssertEqualObjects(array.array[2], stringObj3, @\"Objects should be equal\");\n    XCTAssertEqual(array.array.count, 3U, @\"Should have 3 elements in string array\");\n\n    XCTAssertEqualObjects(array.intArray[0], intObj1, @\"Objects should be equal\");\n    XCTAssertEqualObjects(array.intArray[1], intObj2, @\"Objects should be equal\");\n    XCTAssertEqualObjects(array.intArray[2], intObj3, @\"Objects should be equal\");\n    XCTAssertEqual(array.intArray.count, 3U, @\"Should have 3 elements in int array\");\n\n    [array.array removeLastObject];\n\n    XCTAssertEqualObjects(array.array[0], stringObj1, @\"Objects should be equal\");\n    XCTAssertEqualObjects(array.array[1], stringObj2, @\"Objects should be equal\");\n    XCTAssertEqual(array.array.count, 2U, @\"Should have 2 elements in string array\");\n\n    [array.array removeLastObject];\n\n    XCTAssertEqualObjects(array.array[0], stringObj1, @\"Objects should be equal\");\n    XCTAssertEqual(array.array.count, 1U, @\"Should have 1 elements in string array\");\n\n    [array.array removeLastObject];\n\n    XCTAssertEqual(array.array.count, 0U, @\"Should have 0 elements in string array\");\n\n    [array.intArray removeAllObjects];\n    XCTAssertEqual(array.intArray.count, 0U, @\"Should have 0 elements in int array\");\n}\n\n- (void)testExchangeObjectAtIndexWithObjectAtIndex {\n\n    void (^test)(RLMArray *) = ^(RLMArray *array) {\n        [array exchangeObjectAtIndex:0 withObjectAtIndex:1];\n        XCTAssertEqual(2U, array.count);\n        XCTAssertEqualObjects(@\"b\", [array[0] stringCol]);\n        XCTAssertEqualObjects(@\"a\", [array[1] stringCol]);\n\n        [array exchangeObjectAtIndex:1 withObjectAtIndex:1];\n        XCTAssertEqual(2U, array.count);\n        XCTAssertEqualObjects(@\"b\", [array[0] stringCol]);\n        XCTAssertEqualObjects(@\"a\", [array[1] stringCol]);\n\n        [array exchangeObjectAtIndex:1 withObjectAtIndex:0];\n        XCTAssertEqual(2U, array.count);\n        XCTAssertEqualObjects(@\"a\", [array[0] stringCol]);\n        XCTAssertEqualObjects(@\"b\", [array[1] stringCol]);\n\n        RLMAssertThrowsWithReasonMatching([array exchangeObjectAtIndex:1 withObjectAtIndex:20], @\"less than 2\");\n    };\n\n    ArrayPropertyObject *array = [[ArrayPropertyObject alloc] initWithValue:@[@\"foo\", @[@[@\"a\"], @[@\"b\"]], @[]]];\n    test(array.array);\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    [realm addObject:array];\n    test(array.array);\n    [realm commitWriteTransaction];\n}\n\n- (void)testIndexOfObject\n{\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    EmployeeObject *po1 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES}];\n    EmployeeObject *po2 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"John\", @\"age\": @30, @\"hired\": @NO}];\n    EmployeeObject *po3 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Jill\", @\"age\": @25, @\"hired\": @YES}];\n    EmployeeObject *deleted = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Jill\", @\"age\": @25, @\"hired\": @YES}];\n    EmployeeObject *indirectlyDeleted = [EmployeeObject allObjectsInRealm:realm].lastObject;\n    [realm deleteObject:deleted];\n\n    // create company\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n    [company.employees addObjects:[EmployeeObject allObjects]];\n    [company.employees removeObjectAtIndex:1];\n\n    // test unmanaged\n    XCTAssertEqual(0U, [company.employees indexOfObject:po1]);\n    XCTAssertEqual(1U, [company.employees indexOfObject:po3]);\n    XCTAssertEqual((NSUInteger)NSNotFound, [company.employees indexOfObject:po2]);\n\n    // add to realm\n    [realm addObject:company];\n    [realm commitWriteTransaction];\n\n    // test LinkView RLMArray\n    XCTAssertEqual(0U, [company.employees indexOfObject:po1]);\n    XCTAssertEqual(1U, [company.employees indexOfObject:po3]);\n    XCTAssertEqual((NSUInteger)NSNotFound, [company.employees indexOfObject:po2]);\n\n    // non realm employee\n    EmployeeObject *notInRealm = [[EmployeeObject alloc] initWithValue:@[@\"NoName\", @1, @NO]];\n    XCTAssertEqual((NSUInteger)NSNotFound, [company.employees indexOfObject:notInRealm]);\n\n    // invalid object\n    XCTAssertThrows([company.employees indexOfObject:(EmployeeObject *)company]);\n    RLMAssertThrowsWithReasonMatching([company.employees indexOfObject:deleted], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([company.employees indexOfObject:indirectlyDeleted], @\"invalidated\");\n\n    RLMResults *employees = [company.employees objectsWhere:@\"age = %@\", @40];\n    XCTAssertEqual(0U, [employees indexOfObject:po1]);\n    XCTAssertEqual((NSUInteger)NSNotFound, [employees indexOfObject:po3]);\n}\n\n- (void)testIndexOfObjectWhere\n{\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    EmployeeObject *po1 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES}];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"John\", @\"age\": @30, @\"hired\": @NO}];\n    EmployeeObject *po3 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Jill\", @\"age\": @25, @\"hired\": @YES}];\n    EmployeeObject *po4 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Bill\", @\"age\": @55, @\"hired\": @YES}];\n\n    // create company\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n    [company.employees addObjects:@[po3, po1, po4]];\n\n    // test unmanaged\n    XCTAssertEqual(0U, [company.employees indexOfObjectWhere:@\"name = 'Jill'\"]);\n    XCTAssertEqual(1U, [company.employees indexOfObjectWhere:@\"name = 'Joe'\"]);\n    XCTAssertEqual((NSUInteger)NSNotFound, [company.employees indexOfObjectWhere:@\"name = 'John'\"]);\n\n    // add to realm\n    [realm addObject:company];\n    [realm commitWriteTransaction];\n\n    // test LinkView RLMArray\n    XCTAssertEqual(0U, [company.employees indexOfObjectWhere:@\"name = 'Jill'\"]);\n    XCTAssertEqual(1U, [company.employees indexOfObjectWhere:@\"name = 'Joe'\"]);\n    XCTAssertEqual((NSUInteger)NSNotFound, [company.employees indexOfObjectWhere:@\"name = 'John'\"]);\n\n    RLMResults *results = [company.employees objectsWhere:@\"age > 30\"];\n    XCTAssertEqual(0U, [results indexOfObjectWhere:@\"name = 'Joe'\"]);\n    XCTAssertEqual(1U, [results indexOfObjectWhere:@\"name = 'Bill'\"]);\n    XCTAssertEqual((NSUInteger)NSNotFound, [results indexOfObjectWhere:@\"name = 'John'\"]);\n    XCTAssertEqual((NSUInteger)NSNotFound, [results indexOfObjectWhere:@\"name = 'Jill'\"]);\n}\n\n- (void)testFastEnumeration\n{\n    RLMRealm *realm = self.realmWithTestPath;\n\n    [realm beginWriteTransaction];\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n    [realm addObject:company];\n    [realm commitWriteTransaction];\n\n    // enumerate empty array\n    for (__unused id obj in company.employees) {\n        XCTFail(@\"Should be empty\");\n    }\n\n    [realm beginWriteTransaction];\n    for (int i = 0; i < 30; ++i) {\n        EmployeeObject *eo = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES}];\n        [company.employees addObject:eo];\n    }\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(company.employees.count, 30U);\n\n    __weak id objects[30];\n    NSInteger count = 0;\n    for (EmployeeObject *e in company.employees) {\n        XCTAssertNotNil(e, @\"Object is not nil and accessible\");\n        if (count > 16) {\n            // 16 is the size of blocks fast enumeration happens to ask for at\n            // the moment, but of course that's just an implementation detail\n            // that may change\n            XCTAssertNil(objects[count - 16]);\n        }\n        objects[count++] = e;\n    }\n\n    XCTAssertEqual(count, 30, @\"should have enumerated 30 objects\");\n\n    for (int i = 0; i < count; i++) {\n        XCTAssertNil(objects[i], @\"Object should have been released\");\n    }\n\n    @autoreleasepool {\n        for (EmployeeObject *e in company.employees) {\n            objects[0] = e;\n            break;\n        }\n    }\n    XCTAssertNil(objects[0], @\"Object should have been released\");\n}\n\n- (void)testModifyDuringEnumeration {\n    RLMRealm *realm = self.realmWithTestPath;\n\n    [realm beginWriteTransaction];\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n    [realm addObject:company];\n\n    const size_t totalCount = 40;\n    for (size_t i = 0; i < totalCount; ++i) {\n        [company.employees addObject:[EmployeeObject createInRealm:realm withValue:@[@\"name\", @(i), @NO]]];\n    }\n\n    size_t count = 0;\n    for (EmployeeObject *eo in company.employees) {\n        ++count;\n        [company.employees addObject:eo];\n    }\n    XCTAssertEqual(totalCount, count);\n    XCTAssertEqual(totalCount * 2, company.employees.count);\n\n    [realm cancelWriteTransaction];\n\n    // Unmanaged array\n    company = [[CompanyObject alloc] init];\n    for (size_t i = 0; i < totalCount; ++i) {\n        [company.employees addObject:[[EmployeeObject alloc] initWithValue:@[@\"name\", @(i), @NO]]];\n    }\n\n    count = 0;\n    for (EmployeeObject *eo in company.employees) {\n        ++count;\n        [company.employees addObject:eo];\n    }\n    XCTAssertEqual(totalCount, count);\n    XCTAssertEqual(totalCount * 2, company.employees.count);\n}\n\n- (void)testDeleteDuringEnumeration {\n    RLMRealm *realm = self.realmWithTestPath;\n\n    [realm beginWriteTransaction];\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n    [realm addObject:company];\n\n    const size_t totalCount = 40;\n    for (size_t i = 0; i < totalCount; ++i) {\n        [company.employees addObject:[EmployeeObject createInRealm:realm withValue:@[@\"name\", @(i), @NO]]];\n    }\n\n    [realm commitWriteTransaction];\n\n    [realm beginWriteTransaction];\n    for (__unused EmployeeObject *eo in company.employees) {\n        [realm deleteObjects:company.employees];\n    }\n    [realm commitWriteTransaction];\n}\n\n- (void)testValueForKey {\n    RLMRealm *realm = self.realmWithTestPath;\n\n    [realm beginWriteTransaction];\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n    XCTAssertEqualObjects([company.employees valueForKey:@\"name\"], @[]);\n    [realm addObject:company];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqualObjects([company.employees valueForKey:@\"age\"], @[]);\n\n    // managed\n    NSMutableArray *ages = [NSMutableArray array];\n    [realm beginWriteTransaction];\n    for (int i = 0; i < 30; ++i) {\n        [ages addObject:@(i)];\n        EmployeeObject *eo = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @(i), @\"hired\": @YES}];\n        [company.employees addObject:eo];\n    }\n    [realm commitWriteTransaction];\n\n    RLM_GENERIC_ARRAY(EmployeeObject) *employeeObjects = [company valueForKey:@\"employees\"];\n    NSMutableArray *kvcAgeProperties = [NSMutableArray array];\n    for (EmployeeObject *employee in employeeObjects) {\n        [kvcAgeProperties addObject:@(employee.age)];\n    }\n    XCTAssertEqualObjects(kvcAgeProperties, ages);\n\n    XCTAssertEqualObjects([company.employees valueForKey:@\"age\"], ages);\n    XCTAssertTrue([[[company.employees valueForKey:@\"self\"] firstObject] isEqualToObject:company.employees.firstObject]);\n    XCTAssertTrue([[[company.employees valueForKey:@\"self\"] lastObject] isEqualToObject:company.employees.lastObject]);\n\n    XCTAssertEqual([[company.employees valueForKeyPath:@\"@count\"] integerValue], 30);\n    XCTAssertEqual([[company.employees valueForKeyPath:@\"@min.age\"] integerValue], 0);\n    XCTAssertEqual([[company.employees valueForKeyPath:@\"@max.age\"] integerValue], 29);\n    XCTAssertEqualWithAccuracy([[company.employees valueForKeyPath:@\"@avg.age\"] doubleValue], 14.5, 0.1f);\n\n    XCTAssertEqualObjects([company.employees valueForKeyPath:@\"@unionOfObjects.age\"],\n                          (@[@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14, @15, @16, @17, @18, @19, @20, @21, @22, @23, @24, @25, @26, @27, @28, @29]));\n    XCTAssertEqualObjects([company.employees valueForKeyPath:@\"@distinctUnionOfObjects.name\"], (@[@\"Joe\"]));\n\n    RLMAssertThrowsWithReasonMatching([company.employees valueForKeyPath:@\"@sum.dogs.@sum.age\"], @\"Nested key paths.*not supported\");\n\n    // unmanaged object\n    company = [[CompanyObject alloc] init];\n    ages = [NSMutableArray array];\n    for (int i = 0; i < 30; ++i) {\n        [ages addObject:@(i)];\n        EmployeeObject *eo = [[EmployeeObject alloc] initWithValue:@{@\"name\": @\"Joe\",  @\"age\": @(i), @\"hired\": @YES}];\n        [company.employees addObject:eo];\n    }\n\n    XCTAssertEqualObjects([company.employees valueForKey:@\"age\"], ages);\n    XCTAssertTrue([[[company.employees valueForKey:@\"self\"] firstObject] isEqualToObject:company.employees.firstObject]);\n    XCTAssertTrue([[[company.employees valueForKey:@\"self\"] lastObject] isEqualToObject:company.employees.lastObject]);\n\n    XCTAssertEqual([[company.employees valueForKeyPath:@\"@count\"] integerValue], 30);\n    XCTAssertEqual([[company.employees valueForKeyPath:@\"@min.age\"] integerValue], 0);\n    XCTAssertEqual([[company.employees valueForKeyPath:@\"@max.age\"] integerValue], 29);\n    XCTAssertEqualWithAccuracy([[company.employees valueForKeyPath:@\"@avg.age\"] doubleValue], 14.5, 0.1f);\n\n    XCTAssertEqualObjects([company.employees valueForKeyPath:@\"@unionOfObjects.age\"],\n                          (@[@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14, @15, @16, @17, @18, @19, @20, @21, @22, @23, @24, @25, @26, @27, @28, @29]));\n    XCTAssertEqualObjects([company.employees valueForKeyPath:@\"@distinctUnionOfObjects.name\"], (@[@\"Joe\"]));\n\n    RLMAssertThrowsWithReasonMatching([company.employees valueForKeyPath:@\"@sum.dogs.@sum.age\"], @\"Nested key paths.*not supported\");\n}\n\n- (void)testSetValueForKey {\n    RLMRealm *realm = self.realmWithTestPath;\n\n    [realm beginWriteTransaction];\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n\n    [company.employees setValue:@\"name\" forKey:@\"name\"];\n    XCTAssertEqualObjects([company.employees valueForKey:@\"name\"], @[]);\n\n    [realm addObject:company];\n    [realm commitWriteTransaction];\n\n    XCTAssertThrows([company.employees setValue:@10 forKey:@\"age\"]);\n    XCTAssertEqualObjects([company.employees valueForKey:@\"age\"], @[]);\n\n    // managed\n    NSMutableArray *ages = [NSMutableArray array];\n    [realm beginWriteTransaction];\n    for (int i = 0; i < 30; ++i) {\n        [ages addObject:@(20)];\n        EmployeeObject *eo = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @(i), @\"hired\": @YES}];\n        [company.employees addObject:eo];\n    }\n\n    [company.employees setValue:@20 forKey:@\"age\"];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqualObjects([company.employees valueForKey:@\"age\"], ages);\n\n    // unmanaged object\n    company = [[CompanyObject alloc] init];\n    ages = [NSMutableArray array];\n    for (int i = 0; i < 30; ++i) {\n        [ages addObject:@(20)];\n        EmployeeObject *eo = [[EmployeeObject alloc] initWithValue:@{@\"name\": @\"Joe\",  @\"age\": @(i), @\"hired\": @YES}];\n        [company.employees addObject:eo];\n    }\n\n    [company.employees setValue:@20 forKey:@\"age\"];\n\n    XCTAssertEqualObjects([company.employees valueForKey:@\"age\"], ages);\n}\n\n- (void)testObjectAggregate {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    AggregateArrayObject *obj = [AggregateArrayObject new];\n    XCTAssertEqual(0, [obj.array sumOfProperty:@\"intCol\"].intValue);\n    XCTAssertNil([obj.array averageOfProperty:@\"intCol\"]);\n    XCTAssertNil([obj.array minOfProperty:@\"intCol\"]);\n    XCTAssertNil([obj.array maxOfProperty:@\"intCol\"]);\n\n    NSDate *dateMinInput = [NSDate date];\n    NSDate *dateMaxInput = [dateMinInput dateByAddingTimeInterval:1000];\n\n    [realm transactionWithBlock:^{\n        [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n        [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n        [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n        [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n        [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n        [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n        [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n        [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n        [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n        [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n\n        [obj.array addObjects:[AggregateObject allObjectsInRealm:realm]];\n    }];\n\n    void (^test)(void) = ^{\n        RLMArray *array = obj.array;\n\n        // SUM\n        XCTAssertEqual([array sumOfProperty:@\"intCol\"].integerValue, 4);\n        XCTAssertEqualWithAccuracy([array sumOfProperty:@\"floatCol\"].floatValue, 7.2f, 0.1f);\n        XCTAssertEqualWithAccuracy([array sumOfProperty:@\"doubleCol\"].doubleValue, 10.0, 0.1f);\n        RLMAssertThrowsWithReasonMatching([array sumOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n        RLMAssertThrowsWithReasonMatching([array sumOfProperty:@\"boolCol\"], @\"sum.*bool\");\n        RLMAssertThrowsWithReasonMatching([array sumOfProperty:@\"dateCol\"], @\"sum.*date\");\n\n        // Average\n        XCTAssertEqualWithAccuracy([array averageOfProperty:@\"intCol\"].doubleValue, 0.4, 0.1f);\n        XCTAssertEqualWithAccuracy([array averageOfProperty:@\"floatCol\"].doubleValue, 0.72, 0.1f);\n        XCTAssertEqualWithAccuracy([array averageOfProperty:@\"doubleCol\"].doubleValue, 1.0, 0.1f);\n        RLMAssertThrowsWithReasonMatching([array averageOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n        RLMAssertThrowsWithReasonMatching([array averageOfProperty:@\"boolCol\"], @\"average.*bool\");\n        RLMAssertThrowsWithReasonMatching([array averageOfProperty:@\"dateCol\"], @\"average.*date\");\n\n        // MIN\n        XCTAssertEqual(0, [[array minOfProperty:@\"intCol\"] intValue]);\n        XCTAssertEqual(0.0f, [[array minOfProperty:@\"floatCol\"] floatValue]);\n        XCTAssertEqual(0.0, [[array minOfProperty:@\"doubleCol\"] doubleValue]);\n        XCTAssertEqualObjects(dateMinInput, [array minOfProperty:@\"dateCol\"]);\n        RLMAssertThrowsWithReasonMatching([array minOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n        RLMAssertThrowsWithReasonMatching([array minOfProperty:@\"boolCol\"], @\"min.*bool\");\n\n        // MAX\n        XCTAssertEqual(1, [[array maxOfProperty:@\"intCol\"] intValue]);\n        XCTAssertEqual(1.2f, [[array maxOfProperty:@\"floatCol\"] floatValue]);\n        XCTAssertEqual(2.5, [[array maxOfProperty:@\"doubleCol\"] doubleValue]);\n        XCTAssertEqualObjects(dateMaxInput, [array maxOfProperty:@\"dateCol\"]);\n        RLMAssertThrowsWithReasonMatching([array maxOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n        RLMAssertThrowsWithReasonMatching([array maxOfProperty:@\"boolCol\"], @\"max.*bool\");\n    };\n\n    test();\n    [realm transactionWithBlock:^{ [realm addObject:obj]; }];\n    test();\n}\n\n- (void)testRenamedPropertyAggregate {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    LinkToRenamedProperties1 *obj = [LinkToRenamedProperties1 new];\n    XCTAssertEqual(0, [obj.array sumOfProperty:@\"propA\"].intValue);\n    XCTAssertNil([obj.array averageOfProperty:@\"propA\"]);\n    XCTAssertNil([obj.array minOfProperty:@\"propA\"]);\n    XCTAssertNil([obj.array maxOfProperty:@\"propA\"]);\n    XCTAssertThrows([obj.array sumOfProperty:@\"prop 1\"]);\n\n    [realm transactionWithBlock:^{\n        [RenamedProperties1 createInRealm:realm withValue:@[@1, @\"\"]];\n        [RenamedProperties1 createInRealm:realm withValue:@[@2, @\"\"]];\n        [RenamedProperties1 createInRealm:realm withValue:@[@3, @\"\"]];\n\n        [obj.array addObjects:[RenamedProperties1 allObjectsInRealm:realm]];\n    }];\n\n    XCTAssertEqual(6, [obj.array sumOfProperty:@\"propA\"].intValue);\n    XCTAssertEqual(2.0, [obj.array averageOfProperty:@\"propA\"].doubleValue);\n    XCTAssertEqual(1, [[obj.array minOfProperty:@\"propA\"] intValue]);\n    XCTAssertEqual(3, [[obj.array maxOfProperty:@\"propA\"] intValue]);\n\n    [realm transactionWithBlock:^{ [realm addObject:obj]; }];\n\n    XCTAssertEqual(6, [obj.array sumOfProperty:@\"propA\"].intValue);\n    XCTAssertEqual(2.0, [obj.array averageOfProperty:@\"propA\"].doubleValue);\n    XCTAssertEqual(1, [[obj.array minOfProperty:@\"propA\"] intValue]);\n    XCTAssertEqual(3, [[obj.array maxOfProperty:@\"propA\"] intValue]);\n}\n\n- (void)testRenamedPropertyObservation {\n    RLMRealm *realm = self.realmWithTestPath;\n\n    __block LinkToRenamedProperties *obj;\n    [realm transactionWithBlock:^{\n        [RenamedProperties1 createInRealm:realm withValue:@[@1, @\"\"]];\n\n        obj = [LinkToRenamedProperties createInRealm:realm withValue:@[]];\n        RenamedProperties *linkedObject = [RenamedProperties createInRealm:realm withValue:@[@1, @\"\"]];\n        [obj.array addObject:linkedObject];\n    }];\n\n    __block bool first = true;\n    __block id expectation = [self expectationWithDescription:@\"\"];\n\n    id token = [obj.array addNotificationBlock:^(RLMArray *array, RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(array);\n        XCTAssert(first ? !change : !!change);\n        XCTAssertNil(error);\n        first = false;\n        [expectation fulfill];\n    } keyPaths:@[@\"stringCol\"]];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = self.realmWithTestPath;\n        [realm transactionWithBlock:^{\n            RLMArray *array = [(LinkToRenamedProperties *)[LinkToRenamedProperties allObjectsInRealm:realm].firstObject array];\n            [array setValue:@\"newValue\" forKey:@\"stringCol\"];\n        }];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testValueForCollectionOperationKeyPath\n{\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    EmployeeObject *e1 = [PrimaryEmployeeObject createInRealm:realm withValue:@{@\"name\": @\"A\", @\"age\": @20, @\"hired\": @YES}];\n    EmployeeObject *e2 = [PrimaryEmployeeObject createInRealm:realm withValue:@{@\"name\": @\"B\", @\"age\": @30, @\"hired\": @NO}];\n    EmployeeObject *e3 = [PrimaryEmployeeObject createInRealm:realm withValue:@{@\"name\": @\"C\", @\"age\": @40, @\"hired\": @YES}];\n    EmployeeObject *e4 = [PrimaryEmployeeObject createInRealm:realm withValue:@{@\"name\": @\"D\", @\"age\": @50, @\"hired\": @YES}];\n    PrimaryCompanyObject *c1 = [PrimaryCompanyObject createInRealm:realm withValue:@{@\"name\": @\"ABC AG\", @\"employees\": @[e1, e2, e3, e2], @\"employeeSet\": @[]}];\n    PrimaryCompanyObject *c2 = [PrimaryCompanyObject createInRealm:realm withValue:@{@\"name\": @\"ABC AG 2\", @\"employees\": @[e1, e4], @\"employeeSet\": @[]}];\n\n    ArrayOfPrimaryCompanies *companies = [ArrayOfPrimaryCompanies createInRealm:realm withValue:@[@[c1, c2]]];\n    [realm commitWriteTransaction];\n\n    // count operator\n    XCTAssertEqual([[c1.employees valueForKeyPath:@\"@count\"] integerValue], 4);\n\n    // numeric operators\n    XCTAssertEqual([[c1.employees valueForKeyPath:@\"@min.age\"] intValue], 20);\n    XCTAssertEqual([[c1.employees valueForKeyPath:@\"@max.age\"] intValue], 40);\n    XCTAssertEqual([[c1.employees valueForKeyPath:@\"@sum.age\"] integerValue], 120);\n    XCTAssertEqualWithAccuracy([[c1.employees valueForKeyPath:@\"@avg.age\"] doubleValue], 30, 0.1f);\n\n    // collection\n    XCTAssertEqualObjects([c1.employees valueForKeyPath:@\"@unionOfObjects.name\"],\n                          (@[@\"A\", @\"B\", @\"C\", @\"B\"]));\n    XCTAssertEqualObjects([[c1.employees valueForKeyPath:@\"@distinctUnionOfObjects.name\"] sortedArrayUsingSelector:@selector(compare:)],\n                          (@[@\"A\", @\"B\", @\"C\"]));\n    XCTAssertEqualObjects([companies.companies valueForKeyPath:@\"@unionOfArrays.employees\"],\n                          (@[e1, e2, e3, e2, e1, e4]));\n    NSComparator cmp = ^NSComparisonResult(id obj1, id obj2) { return [[obj1 name] compare:[obj2 name]]; };\n    XCTAssertEqualObjects([[companies.companies valueForKeyPath:@\"@distinctUnionOfArrays.employees\"] sortedArrayUsingComparator:cmp],\n                          (@[e1, e2, e3, e4]));\n\n    // invalid key paths\n    RLMAssertThrowsWithReasonMatching([c1.employees valueForKeyPath:@\"@invalid.name\"],\n                                      @\"Unsupported KVC collection operator found in key path '@invalid.name'\");\n    RLMAssertThrowsWithReasonMatching([c1.employees valueForKeyPath:@\"@sum\"],\n                                      @\"Missing key path for KVC collection operator sum in key path '@sum'\");\n    RLMAssertThrowsWithReasonMatching([c1.employees valueForKeyPath:@\"@sum.\"],\n                                      @\"Missing key path for KVC collection operator sum in key path '@sum.'\");\n    RLMAssertThrowsWithReasonMatching([c1.employees valueForKeyPath:@\"@sum.employees.@sum.age\"],\n                                      @\"Nested key paths.*not supported\");\n}\n\n- (void)testCrossThreadAccess\n{\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n\n    EmployeeObject *eo = [[EmployeeObject alloc] init];\n    eo.name = @\"Joe\";\n    eo.age = 40;\n    eo.hired = YES;\n    [company.employees addObject:eo];\n    RLMArray *employees = company.employees;\n\n    // Unmanaged object can be accessed from other threads\n    [self dispatchAsyncAndWait:^{\n        XCTAssertNoThrow(company.employees);\n        XCTAssertNoThrow([employees lastObject]);\n    }];\n\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n    [realm addObject:company];\n    [realm commitWriteTransaction];\n\n    employees = company.employees;\n    XCTAssertNoThrow(company.employees);\n    XCTAssertNoThrow([employees lastObject]);\n    [self dispatchAsyncAndWait:^{\n        XCTAssertThrows(company.employees);\n        XCTAssertThrows([employees lastObject]);\n    }];\n}\n\n- (void)testSortByNoColumns {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    DogObject *a2 = [DogObject createInDefaultRealmWithValue:@[@\"a\", @2]];\n    DogObject *b1 = [DogObject createInDefaultRealmWithValue:@[@\"b\", @1]];\n    DogObject *a1 = [DogObject createInDefaultRealmWithValue:@[@\"a\", @1]];\n    DogObject *b2 = [DogObject createInDefaultRealmWithValue:@[@\"b\", @2]];\n\n    RLMArray<DogObject *> *array = [DogArrayObject createInDefaultRealmWithValue:@[@[a2, b1, a1, b2]]].dogs;\n    [realm commitWriteTransaction];\n\n    RLMResults *notActuallySorted = [array sortedResultsUsingDescriptors:@[]];\n    XCTAssertTrue([array[0] isEqualToObject:notActuallySorted[0]]);\n    XCTAssertTrue([array[1] isEqualToObject:notActuallySorted[1]]);\n    XCTAssertTrue([array[2] isEqualToObject:notActuallySorted[2]]);\n    XCTAssertTrue([array[3] isEqualToObject:notActuallySorted[3]]);\n}\n\n- (void)testSortByMultipleColumns {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    DogObject *a1 = [DogObject createInDefaultRealmWithValue:@[@\"a\", @1]];\n    DogObject *a2 = [DogObject createInDefaultRealmWithValue:@[@\"a\", @2]];\n    DogObject *b1 = [DogObject createInDefaultRealmWithValue:@[@\"b\", @1]];\n    DogObject *b2 = [DogObject createInDefaultRealmWithValue:@[@\"b\", @2]];\n\n    DogArrayObject *array = [DogArrayObject createInDefaultRealmWithValue:@[@[a1, a2, b1, b2]]];\n    [realm commitWriteTransaction];\n\n    bool (^checkOrder)(NSArray *, NSArray *, NSArray *) = ^bool(NSArray *properties, NSArray *ascending, NSArray *dogs) {\n        NSArray *sort = @[[RLMSortDescriptor sortDescriptorWithKeyPath:properties[0] ascending:[ascending[0] boolValue]],\n                          [RLMSortDescriptor sortDescriptorWithKeyPath:properties[1] ascending:[ascending[1] boolValue]]];\n        RLMResults *actual = [array.dogs sortedResultsUsingDescriptors:sort];\n\n        return [actual[0] isEqualToObject:dogs[0]]\n            && [actual[1] isEqualToObject:dogs[1]]\n            && [actual[2] isEqualToObject:dogs[2]]\n            && [actual[3] isEqualToObject:dogs[3]];\n    };\n\n    // Check each valid sort\n    XCTAssertTrue(checkOrder(@[@\"dogName\", @\"age\"], @[@YES, @YES], @[a1, a2, b1, b2]));\n    XCTAssertTrue(checkOrder(@[@\"dogName\", @\"age\"], @[@YES, @NO], @[a2, a1, b2, b1]));\n    XCTAssertTrue(checkOrder(@[@\"dogName\", @\"age\"], @[@NO, @YES], @[b1, b2, a1, a2]));\n    XCTAssertTrue(checkOrder(@[@\"dogName\", @\"age\"], @[@NO, @NO], @[b2, b1, a2, a1]));\n    XCTAssertTrue(checkOrder(@[@\"age\", @\"dogName\"], @[@YES, @YES], @[a1, b1, a2, b2]));\n    XCTAssertTrue(checkOrder(@[@\"age\", @\"dogName\"], @[@YES, @NO], @[b1, a1, b2, a2]));\n    XCTAssertTrue(checkOrder(@[@\"age\", @\"dogName\"], @[@NO, @YES], @[a2, b2, a1, b1]));\n    XCTAssertTrue(checkOrder(@[@\"age\", @\"dogName\"], @[@NO, @NO], @[b2, a2, b1, a1]));\n}\n\n- (void)testSortByRenamedColumns {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    id value = @{@\"array\": @[@[@1, @\"c\"], @[@2, @\"b\"], @[@3, @\"a\"]], @\"set\": @[]};\n    LinkToRenamedProperties *obj = [LinkToRenamedProperties createInRealm:realm withValue:value];\n\n    XCTAssertEqualObjects([[obj.array sortedResultsUsingKeyPath:@\"intCol\" ascending:YES] valueForKeyPath:@\"intCol\"],\n                          (@[@1, @2, @3]));\n    XCTAssertEqualObjects([[obj.array sortedResultsUsingKeyPath:@\"intCol\" ascending:NO] valueForKeyPath:@\"intCol\"],\n                          (@[@3, @2, @1]));\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testDeleteLinksAndObjectsInArray\n{\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    EmployeeObject *po1 = [EmployeeObject createInRealm:realm withValue:@[@\"Joe\", @40, @YES]];\n    EmployeeObject *po2 = [EmployeeObject createInRealm:realm withValue:@[@\"John\", @30, @NO]];\n    EmployeeObject *po3 = [EmployeeObject createInRealm:realm withValue:@[@\"Jill\", @25, @YES]];\n\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n    [company.employees addObjects:[EmployeeObject allObjects]];\n    [realm addObject:company];\n\n    [realm commitWriteTransaction];\n\n    RLMArray *peopleInCompany = company.employees;\n\n    // Delete link to employee\n    XCTAssertThrowsSpecificNamed([peopleInCompany removeObjectAtIndex:1], NSException, @\"RLMException\", @\"Not allowed in read transaction\");\n    XCTAssertEqual(peopleInCompany.count, 3U, @\"No links should have been deleted\");\n\n    [realm beginWriteTransaction];\n    XCTAssertThrowsSpecificNamed([peopleInCompany removeObjectAtIndex:3], NSException, @\"RLMException\", @\"Out of bounds\");\n    XCTAssertNoThrow([peopleInCompany removeObjectAtIndex:1], @\"Should delete link to employee\");\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(peopleInCompany.count, 2U, @\"link deleted when accessing via links\");\n    EmployeeObject *test = peopleInCompany[0];\n    XCTAssertEqual(test.age, po1.age, @\"Should be equal\");\n    XCTAssertEqualObjects(test.name, po1.name, @\"Should be equal\");\n    XCTAssertEqual(test.hired, po1.hired, @\"Should be equal\");\n    XCTAssertTrue([test isEqualToObject:po1], @\"Should be equal\");\n\n    test = peopleInCompany[1];\n    XCTAssertEqual(test.age, po3.age, @\"Should be equal\");\n    XCTAssertEqualObjects(test.name, po3.name, @\"Should be equal\");\n    XCTAssertEqual(test.hired, po3.hired, @\"Should be equal\");\n    XCTAssertTrue([test isEqualToObject:po3], @\"Should be equal\");\n\n    XCTAssertThrowsSpecificNamed([peopleInCompany removeLastObject], NSException, @\"RLMException\", @\"Not allowed in read transaction\");\n    XCTAssertThrowsSpecificNamed([peopleInCompany removeAllObjects], NSException, @\"RLMException\", @\"Not allowed in read transaction\");\n    XCTAssertThrowsSpecificNamed([peopleInCompany replaceObjectAtIndex:0 withObject:po2], NSException, @\"RLMException\", @\"Not allowed in read transaction\");\n    XCTAssertThrowsSpecificNamed([peopleInCompany insertObject:po2 atIndex:0], NSException, @\"RLMException\", @\"Not allowed in read transaction\");\n\n    [realm beginWriteTransaction];\n    XCTAssertNoThrow([peopleInCompany removeLastObject], @\"Should delete last link\");\n    XCTAssertEqual(peopleInCompany.count, 1U, @\"1 remaining link\");\n    [peopleInCompany replaceObjectAtIndex:0 withObject:po2];\n    XCTAssertEqual(peopleInCompany.count, 1U, @\"1 link replaced\");\n    [peopleInCompany insertObject:po1 atIndex:0];\n    XCTAssertEqual(peopleInCompany.count, 2U, @\"2 links\");\n    XCTAssertNoThrow([peopleInCompany removeAllObjects], @\"Should delete all links\");\n    XCTAssertEqual(peopleInCompany.count, 0U, @\"0 remaining links\");\n    [realm commitWriteTransaction];\n\n    RLMResults *allPeople = [EmployeeObject allObjects];\n    XCTAssertEqual(allPeople.count, 3U, @\"Only links should have been deleted, not the employees\");\n}\n\n- (void)testArrayDescription {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    RLMArray<EmployeeObject *> *employees = [CompanyObject createInDefaultRealmWithValue:@[@\"company\"]].employees;\n    RLMArray<NSNumber *> *ints = [AllPrimitiveArrays createInDefaultRealmWithValue:@[]].intObj;\n    for (NSInteger i = 0; i < 1012; ++i) {\n        EmployeeObject *person = [[EmployeeObject alloc] init];\n        person.name = @\"Mary\";\n        person.age = 24;\n        person.hired = YES;\n        [employees addObject:person];\n        [ints addObject:@(i + 100)];\n    }\n    [realm commitWriteTransaction];\n\n    RLMAssertMatches(employees.description,\n                     @\"(?s)RLMArray\\\\<EmployeeObject\\\\> \\\\<0x[a-z0-9]+\\\\> \\\\(\\n\"\n                     @\"\\t\\\\[0\\\\] EmployeeObject \\\\{\\n\"\n                     @\"\\t\\tname = Mary;\\n\"\n                     @\"\\t\\tage = 24;\\n\"\n                     @\"\\t\\thired = 1;\\n\"\n                     @\"\\t\\\\},\\n\"\n                     @\".*\\n\"\n                     @\"\\t... 912 objects skipped.\\n\"\n                     @\"\\\\)\");\n    RLMAssertMatches(ints.description,\n                     @\"(?s)RLMArray\\\\<int\\\\> \\\\<0x[a-z0-9]+\\\\> \\\\(\\n\"\n                     @\"\\t\\\\[0\\\\] 100,\\n\"\n                     @\"\\t\\\\[1\\\\] 101,\\n\"\n                     @\"\\t\\\\[2\\\\] 102,\\n\"\n                     @\".*\\n\"\n                     @\"\\t... 912 objects skipped.\\n\"\n                     @\"\\\\)\");\n}\n\n- (void)testUnmanagedAssignment {\n    IntObject *io1 = [[IntObject alloc] init];\n    IntObject *io2 = [[IntObject alloc] init];\n    IntObject *io3 = [[IntObject alloc] init];\n\n    ArrayPropertyObject *array1 = [[ArrayPropertyObject alloc] init];\n    ArrayPropertyObject *array2 = [[ArrayPropertyObject alloc] init];\n\n    // Assigning NSArray shallow copies\n    array1.intArray = (id)@[io1, io2];\n    XCTAssertEqualObjects([array1.intArray valueForKey:@\"self\"], (@[io1, io2]));\n\n    [array1 setValue:@[io3, io1] forKey:@\"intArray\"];\n    XCTAssertEqualObjects([array1.intArray valueForKey:@\"self\"], (@[io3, io1]));\n\n    array1[@\"intArray\"] = @[io2, io3];\n    XCTAssertEqualObjects([array1.intArray valueForKey:@\"self\"], (@[io2, io3]));\n\n    // Assigning RLMArray shallow copies\n    array2.intArray = array1.intArray;\n    XCTAssertEqualObjects([array2.intArray valueForKey:@\"self\"], (@[io2, io3]));\n\n    [array1.intArray removeAllObjects];\n    XCTAssertEqualObjects([array2.intArray valueForKey:@\"self\"], (@[io2, io3]));\n\n    // Self-assignment is a no-op\n    array2.intArray = array2.intArray;\n    XCTAssertEqualObjects([array2.intArray valueForKey:@\"self\"], (@[io2, io3]));\n    array2[@\"intArray\"] = array2[@\"intArray\"];\n    XCTAssertEqualObjects([array2[@\"intArray\"] valueForKey:@\"self\"], (@[io2, io3]));\n}\n\n- (void)testManagedAssignment {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n\n    IntObject *io1 = [IntObject createInRealm:realm withValue:@[@1]];\n    IntObject *io2 = [IntObject createInRealm:realm withValue:@[@2]];\n    IntObject *io3 = [IntObject createInRealm:realm withValue:@[@3]];\n\n    ArrayPropertyObject *array1 = [ArrayPropertyObject createInRealm:realm withValue:@[@\"\"]];\n    ArrayPropertyObject *array2 = [ArrayPropertyObject createInRealm:realm withValue:@[@\"\"]];\n\n    // Assigning NSArray shallow copies\n    array1.intArray = (id)@[io1, io2];\n    XCTAssertEqualObjects([array1.intArray valueForKey:@\"intCol\"], (@[@1, @2]));\n\n    [array1 setValue:@[io3, io1] forKey:@\"intArray\"];\n    XCTAssertEqualObjects([array1.intArray valueForKey:@\"intCol\"], (@[@3, @1]));\n\n    array1[@\"intArray\"] = @[io2, io3];\n    XCTAssertEqualObjects([array1.intArray valueForKey:@\"intCol\"], (@[@2, @3]));\n\n    // Assigning RLMArray shallow copies\n    array2.intArray = array1.intArray;\n    XCTAssertEqualObjects([array2.intArray valueForKey:@\"intCol\"], (@[@2, @3]));\n\n    [array1.intArray removeAllObjects];\n    XCTAssertEqualObjects([array2.intArray valueForKey:@\"intCol\"], (@[@2, @3]));\n\n    // Self-assignment is a no-op\n    array2.intArray = array2.intArray;\n    XCTAssertEqualObjects([array2.intArray valueForKey:@\"intCol\"], (@[@2, @3]));\n    array2[@\"intArray\"] = array2[@\"intArray\"];\n    XCTAssertEqualObjects([array2[@\"intArray\"] valueForKey:@\"intCol\"], (@[@2, @3]));\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAssignIncorrectType {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    ArrayPropertyObject *array = [ArrayPropertyObject createInRealm:realm\n                                                          withValue:@[@\"\", @[@[@\"a\"]], @[@[@0]]]];\n    RLMAssertThrowsWithReason(array.intArray = (id)array.array,\n                              @\"RLMArray<StringObject> does not match expected type 'IntObject' for property 'ArrayPropertyObject.intArray'.\");\n    RLMAssertThrowsWithReason(array[@\"intArray\"] = array[@\"array\"],\n                              @\"RLMArray<StringObject> does not match expected type 'IntObject' for property 'ArrayPropertyObject.intArray'.\");\n    [realm cancelWriteTransaction];\n}\n\n- (void)testNotificationSentInitially {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    ArrayPropertyObject *array = [ArrayPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[]]];\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    id token = [array.array addNotificationBlock:^(RLMArray *array, RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(array);\n        XCTAssertNil(change);\n        XCTAssertNil(error);\n        [expectation fulfill];\n    }];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationSentAfterCommit {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    ArrayPropertyObject *array = [ArrayPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[]]];\n    [realm commitWriteTransaction];\n\n    __block bool first = true;\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [array.array addNotificationBlock:^(RLMArray *array, RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(array);\n        XCTAssert(first ? !change : !!change);\n        XCTAssertNil(error);\n        first = false;\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = self.realmWithTestPath;\n        [realm transactionWithBlock:^{\n            RLMArray *array = [(ArrayPropertyObject *)[ArrayPropertyObject allObjectsInRealm:realm].firstObject array];\n            [array addObject:[[StringObject alloc] init]];\n        }];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationNotSentForUnrelatedChange {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    ArrayPropertyObject *array = [ArrayPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[]]];\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    id token = [array.array addNotificationBlock:^(__unused RLMArray *array, __unused RLMCollectionChange *change, __unused NSError *error) {\n        // will throw if it's incorrectly called a second time due to the\n        // unrelated write transaction\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmDidChangeNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *realm = self.realmWithTestPath;\n            [realm transactionWithBlock:^{\n                [ArrayPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[]]];\n            }];\n        }];\n    }];\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationSentOnlyForActualRefresh {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    ArrayPropertyObject *array = [ArrayPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[]]];\n    [realm commitWriteTransaction];\n\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [array.array addNotificationBlock:^(RLMArray *array, __unused RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(array);\n        XCTAssertNil(error);\n        // will throw if it's called a second time before we create the new\n        // expectation object immediately before manually refreshing\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // Turn off autorefresh, so the background commit should not result in a notification\n    realm.autorefresh = NO;\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmRefreshRequiredNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *realm = self.realmWithTestPath;\n            [realm transactionWithBlock:^{\n                RLMArray *array = [(ArrayPropertyObject *)[ArrayPropertyObject allObjectsInRealm:realm].firstObject array];\n                [array addObject:[[StringObject alloc] init]];\n            }];\n        }];\n    }];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [realm refresh];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testDeletingObjectWithNotificationsRegistered {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    ArrayPropertyObject *array = [ArrayPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[]]];\n    [realm commitWriteTransaction];\n\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [array.array addNotificationBlock:^(RLMArray *array, __unused RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(array);\n        XCTAssertNil(error);\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [realm beginWriteTransaction];\n    [realm deleteObject:array];\n    [realm commitWriteTransaction];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\nstatic RLMArray<IntObject *> *managedTestArray(void) {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    __block RLMArray *array;\n    [realm transactionWithBlock:^{\n        ArrayPropertyObject *obj = [ArrayPropertyObject createInDefaultRealmWithValue:@[@\"\", @[], @[@[@0], @[@1]]]];\n        array = obj.intArray;\n    }];\n    return array;\n}\n\n- (void)testAllMethodsCheckThread {\n    RLMArray<IntObject *> *array = managedTestArray();\n    IntObject *io = array.firstObject;\n    RLMRealm *realm = array.realm;\n    [realm beginWriteTransaction];\n\n    [self dispatchAsyncAndWait:^{\n        RLMAssertThrowsWithReasonMatching([array count], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([array objectAtIndex:0], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([array firstObject], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([array lastObject], @\"thread\");\n\n        RLMAssertThrowsWithReasonMatching([array addObject:io], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([array addObjects:@[io]], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([array insertObject:io atIndex:0], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([array removeObjectAtIndex:0], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([array removeLastObject], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([array removeAllObjects], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([array replaceObjectAtIndex:0 withObject:io], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([array moveObjectAtIndex:0 toIndex:1], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([array exchangeObjectAtIndex:0 withObjectAtIndex:1], @\"thread\");\n\n        RLMAssertThrowsWithReasonMatching([array indexOfObject:[IntObject allObjects].firstObject], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([array indexOfObjectWhere:@\"intCol = 0\"], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([array indexOfObjectWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([array objectsWhere:@\"intCol = 0\"], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([array objectsWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([array sortedResultsUsingKeyPath:@\"intCol\" ascending:YES], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([array sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"intCol\" ascending:YES]]], @\"thread\");\n        RLMAssertThrowsWithReasonMatching(array[0], @\"thread\");\n        RLMAssertThrowsWithReasonMatching(array[0] = io, @\"thread\");\n        RLMAssertThrowsWithReasonMatching([array valueForKey:@\"intCol\"], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([array setValue:@1 forKey:@\"intCol\"], @\"thread\");\n        RLMAssertThrowsWithReasonMatching(({for (__unused id obj in array);}), @\"thread\");\n    }];\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAllMethodsCheckForInvalidation {\n    RLMArray<IntObject *> *array = managedTestArray();\n    IntObject *io = array.firstObject;\n    RLMRealm *realm = array.realm;\n\n    [realm beginWriteTransaction];\n\n    XCTAssertNoThrow([array objectClassName]);\n    XCTAssertNoThrow([array realm]);\n    XCTAssertNoThrow([array isInvalidated]);\n\n    XCTAssertNoThrow([array count]);\n    XCTAssertNoThrow([array objectAtIndex:0]);\n    XCTAssertNoThrow([array firstObject]);\n    XCTAssertNoThrow([array lastObject]);\n\n    XCTAssertNoThrow([array addObject:io]);\n    XCTAssertNoThrow([array addObjects:@[io]]);\n    XCTAssertNoThrow([array insertObject:io atIndex:0]);\n    XCTAssertNoThrow([array removeObjectAtIndex:0]);\n    XCTAssertNoThrow([array removeLastObject]);\n    XCTAssertNoThrow([array removeAllObjects]);\n    [array addObjects:@[io, io, io]];\n    XCTAssertNoThrow([array replaceObjectAtIndex:0 withObject:io]);\n    XCTAssertNoThrow([array moveObjectAtIndex:0 toIndex:1]);\n    XCTAssertNoThrow([array exchangeObjectAtIndex:0 withObjectAtIndex:1]);\n\n    XCTAssertNoThrow([array indexOfObject:[IntObject allObjects].firstObject]);\n    XCTAssertNoThrow([array indexOfObjectWhere:@\"intCol = 0\"]);\n    XCTAssertNoThrow([array indexOfObjectWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]]);\n    XCTAssertNoThrow([array objectsWhere:@\"intCol = 0\"]);\n    XCTAssertNoThrow([array objectsWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]]);\n    XCTAssertNoThrow([array sortedResultsUsingKeyPath:@\"intCol\" ascending:YES]);\n    XCTAssertNoThrow([array sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"intCol\" ascending:YES]]]);\n    XCTAssertNoThrow(array[0]);\n    XCTAssertNoThrow(array[0] = io);\n    XCTAssertNoThrow([array valueForKey:@\"intCol\"]);\n    XCTAssertNoThrow([array setValue:@1 forKey:@\"intCol\"]);\n    XCTAssertNoThrow(({for (__unused id obj in array);}));\n\n    [realm cancelWriteTransaction];\n    [realm invalidate];\n    [realm beginWriteTransaction];\n    io = [IntObject createInDefaultRealmWithValue:@[@0]];\n\n    XCTAssertNoThrow([array objectClassName]);\n    XCTAssertNoThrow([array realm]);\n    XCTAssertNoThrow([array isInvalidated]);\n\n    RLMAssertThrowsWithReasonMatching([array count], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([array objectAtIndex:0], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([array firstObject], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([array lastObject], @\"invalidated\");\n\n    RLMAssertThrowsWithReasonMatching([array addObject:io], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([array addObjects:@[io]], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([array insertObject:io atIndex:0], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([array removeObjectAtIndex:0], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([array removeLastObject], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([array removeAllObjects], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([array replaceObjectAtIndex:0 withObject:io], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([array moveObjectAtIndex:0 toIndex:1], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([array exchangeObjectAtIndex:0 withObjectAtIndex:1], @\"invalidated\");\n\n    RLMAssertThrowsWithReasonMatching([array indexOfObject:[IntObject allObjects].firstObject], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([array indexOfObjectWhere:@\"intCol = 0\"], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([array indexOfObjectWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([array objectsWhere:@\"intCol = 0\"], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([array objectsWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([array sortedResultsUsingKeyPath:@\"intCol\" ascending:YES], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([array sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"intCol\" ascending:YES]]], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching(array[0], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching(array[0] = io, @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([array valueForKey:@\"intCol\"], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([array setValue:@1 forKey:@\"intCol\"], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching(({for (__unused id obj in array);}), @\"invalidated\");\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testMutatingMethodsCheckForWriteTransaction {\n    RLMArray<IntObject *> *array = managedTestArray();\n    IntObject *io = array.firstObject;\n\n    XCTAssertNoThrow([array objectClassName]);\n    XCTAssertNoThrow([array realm]);\n    XCTAssertNoThrow([array isInvalidated]);\n\n    XCTAssertNoThrow([array count]);\n    XCTAssertNoThrow([array objectAtIndex:0]);\n    XCTAssertNoThrow([array firstObject]);\n    XCTAssertNoThrow([array lastObject]);\n\n    XCTAssertNoThrow([array indexOfObject:[IntObject allObjects].firstObject]);\n    XCTAssertNoThrow([array indexOfObjectWhere:@\"intCol = 0\"]);\n    XCTAssertNoThrow([array indexOfObjectWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]]);\n    XCTAssertNoThrow([array objectsWhere:@\"intCol = 0\"]);\n    XCTAssertNoThrow([array objectsWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]]);\n    XCTAssertNoThrow([array sortedResultsUsingKeyPath:@\"intCol\" ascending:YES]);\n    XCTAssertNoThrow([array sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"intCol\" ascending:YES]]]);\n    XCTAssertNoThrow(array[0]);\n    XCTAssertNoThrow([array valueForKey:@\"intCol\"]);\n    XCTAssertNoThrow(({for (__unused id obj in array);}));\n\n\n    RLMAssertThrowsWithReasonMatching([array addObject:io], @\"write transaction\");\n    RLMAssertThrowsWithReasonMatching([array addObjects:@[io]], @\"write transaction\");\n    RLMAssertThrowsWithReasonMatching([array insertObject:io atIndex:0], @\"write transaction\");\n    RLMAssertThrowsWithReasonMatching([array removeObjectAtIndex:0], @\"write transaction\");\n    RLMAssertThrowsWithReasonMatching([array removeLastObject], @\"write transaction\");\n    RLMAssertThrowsWithReasonMatching([array removeAllObjects], @\"write transaction\");\n    RLMAssertThrowsWithReasonMatching([array replaceObjectAtIndex:0 withObject:io], @\"write transaction\");\n    RLMAssertThrowsWithReasonMatching([array moveObjectAtIndex:0 toIndex:1], @\"write transaction\");\n    RLMAssertThrowsWithReasonMatching([array exchangeObjectAtIndex:0 withObjectAtIndex:1], @\"write transaction\");\n\n    RLMAssertThrowsWithReasonMatching(array[0] = io, @\"write transaction\");\n    RLMAssertThrowsWithReasonMatching([array setValue:@1 forKey:@\"intCol\"], @\"write transaction\");\n}\n\n- (void)testIsFrozen {\n    RLMArray *unfrozen = managedTestArray();\n    RLMArray *frozen = [unfrozen freeze];\n    XCTAssertFalse(unfrozen.isFrozen);\n    XCTAssertTrue(frozen.isFrozen);\n}\n\n- (void)testFreezingFrozenObjectReturnsSelf {\n    RLMArray *array = managedTestArray();\n    RLMArray *frozen = [array freeze];\n    XCTAssertNotEqual(array, frozen);\n    XCTAssertNotEqual(array.freeze, frozen);\n    XCTAssertEqual(frozen, frozen.freeze);\n}\n\n- (void)testFreezeFromWrongThread {\n    RLMArray *array = managedTestArray();\n    [self dispatchAsyncAndWait:^{\n        RLMAssertThrowsWithReason([array freeze],\n                                  @\"Realm accessed from incorrect thread\");\n    }];\n}\n\n- (void)testAccessFrozenFromDifferentThread {\n    RLMArray *frozen = [managedTestArray() freeze];\n    [self dispatchAsyncAndWait:^{\n        XCTAssertEqualObjects([frozen valueForKey:@\"intCol\"], (@[@0, @1]));\n    }];\n}\n\n- (void)testObserveFrozenArray {\n    RLMArray *frozen = [managedTestArray() freeze];\n    id block = ^(__unused BOOL deleted, __unused NSArray *changes, __unused NSError *error) {};\n    RLMAssertThrowsWithReason([frozen addNotificationBlock:block],\n                              @\"Frozen Realms do not change and do not have change notifications.\");\n}\n\n- (void)testQueryFrozenArray {\n    RLMArray *frozen = [managedTestArray() freeze];\n    XCTAssertEqualObjects([[frozen objectsWhere:@\"intCol > 0\"] valueForKey:@\"intCol\"], (@[@1]));\n}\n\n- (void)testFrozenArraysDoNotUpdate {\n    RLMArray *array = managedTestArray();\n    RLMArray *frozen = [array freeze];\n    XCTAssertEqual(frozen.count, 2);\n    [array.realm transactionWithBlock:^{\n        [array removeLastObject];\n    }];\n    XCTAssertEqual(frozen.count, 2);\n}\n@end\n"
  },
  {
    "path": "Realm/Tests/AsyncTests.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#import \"RLMRealmConfiguration_Private.hpp\"\n#import \"RLMRealm_Private.hpp\"\n\n#import <realm/object-store/impl/realm_coordinator.hpp>\n\n#import <sys/resource.h>\n\n// A whole bunch of blocks don't use their RLMResults parameter\n#pragma clang diagnostic ignored \"-Wunused-parameter\"\n\n@interface ManualRefreshRealm : RLMRealm\n@end\n@implementation ManualRefreshRealm\n- (void)verifyNotificationsAreSupported:(__unused bool)isCollection {\n    // The normal implementation of this will reject realms with automatic change notifications disabled\n}\n@end\n\n@interface AsyncTests : RLMTestCase\n@end\n\n@implementation AsyncTests\n- (void)createObject:(int)value {\n    @autoreleasepool {\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            [IntObject createInDefaultRealmWithValue:@[@(value)]];\n        }];\n    }\n}\n\n- (void)testInitialResultsAreDelivered {\n    [self createObject:1];\n\n    XCTestExpectation *expectation = [self expectationWithDescription:@\"\"];\n    auto token = [[IntObject objectsWhere:@\"intCol > 0\"] addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *e) {\n        XCTAssertNil(e);\n        XCTAssertEqualObjects(results.objectClassName, @\"IntObject\");\n        XCTAssertEqual(results.count, 1U);\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [token invalidate];\n}\n\n- (void)testNewResultsAreDeliveredAfterLocalCommit {\n    __block XCTestExpectation *expectation = [self expectationWithDescription:@\"\"];\n    __block NSUInteger expected = 0;\n    auto token = [[IntObject objectsWhere:@\"intCol > 0\"] addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *e) {\n        XCTAssertEqual(results.count, expected++);\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self createObject:1];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self createObject:2];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [token invalidate];\n}\n\n- (void)testNewResultsAreDeliveredAfterBackgroundCommit {\n    __block XCTestExpectation *expectation = [self expectationWithDescription:@\"\"];\n    __block NSUInteger expected = 0;\n    auto token = [[IntObject objectsWhere:@\"intCol > 0\"] addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *e) {\n        XCTAssertEqual(results.count, expected++);\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{ [self createObject:1]; }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{ [self createObject:2]; }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [token invalidate];\n}\n\n- (void)testResultsPerserveQuery {\n    __block XCTestExpectation *expectation = [self expectationWithDescription:@\"\"];\n    __block NSUInteger expected = 0;\n    auto token = [[IntObject objectsWhere:@\"intCol > 0\"] addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *e) {\n        XCTAssertEqual(results.count, expected);\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    ++expected;\n    [self dispatchAsyncAndWait:^{\n        [self createObject:1];\n        [self createObject:-11];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [token invalidate];\n}\n\n- (void)testResultsPerserveSort {\n    __block XCTestExpectation *expectation = [self expectationWithDescription:@\"\"];\n    __block int expected = 0;\n    auto token = [[IntObject.allObjects sortedResultsUsingKeyPath:@\"intCol\" ascending:NO] addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *e) {\n        XCTAssertEqual([results.firstObject intCol], expected);\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    expected = 1;\n    [self dispatchAsyncAndWait:^{ [self createObject:1]; }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{ [self createObject:-1]; }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    expected = 2;\n    [self dispatchAsyncAndWait:^{ [self createObject:2]; }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [token invalidate];\n}\n\n- (void)testQueryingDeliveredQueryResults {\n    __block XCTestExpectation *expectation = [self expectationWithDescription:@\"\"];\n    __block NSUInteger expected = 0;\n    auto token = [[IntObject objectsWhere:@\"intCol > 0\"] addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *e) {\n        XCTAssertEqual([results objectsWhere:@\"intCol < 10\"].count, expected++);\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{ [self createObject:1]; }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{ [self createObject:2]; }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [token invalidate];\n}\n\n- (void)testQueryingDeliveredTableResults {\n    __block XCTestExpectation *expectation = [self expectationWithDescription:@\"\"];\n    __block NSUInteger expected = 0;\n    auto token = [[IntObject allObjects] addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *e) {\n        XCTAssertEqual([results objectsWhere:@\"intCol < 10\"].count, expected++);\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{ [self createObject:1]; }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{ [self createObject:2]; }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [token invalidate];\n}\n\n- (void)testQueryingDeliveredSortedResults {\n    __block XCTestExpectation *expectation = [self expectationWithDescription:@\"\"];\n    __block int expected = 0;\n    auto token = [[IntObject.allObjects sortedResultsUsingKeyPath:@\"intCol\" ascending:NO] addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *e) {\n        XCTAssertEqual([[results objectsWhere:@\"intCol < 10\"].firstObject intCol], expected++);\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{ [self createObject:1]; }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{ [self createObject:2]; }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [token invalidate];\n}\n\n- (void)testSortingDeliveredResults {\n    __block XCTestExpectation *expectation = [self expectationWithDescription:@\"\"];\n    __block int expected = 0;\n    auto token = [[IntObject allObjects] addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *e) {\n        XCTAssertEqual([[results sortedResultsUsingKeyPath:@\"intCol\" ascending:NO].firstObject intCol], expected++);\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{ [self createObject:1]; }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{ [self createObject:2]; }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [token invalidate];\n}\n\n- (void)testQueryingLinkList {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    ArrayPropertyObject *array = [ArrayPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[]]];\n    [realm commitWriteTransaction];\n\n    __block XCTestExpectation *expectation = [self expectationWithDescription:@\"\"];\n    __block int expected = 0;\n    auto token = [[array.intArray objectsWhere:@\"intCol > 0\"] addNotificationBlock:^(RLMResults<IntObject *> *results,\n                                                                                     RLMCollectionChange *change, NSError *e) {\n//        NSLog(@\"IntArray: %d\", (int)array.intArray.count);\n        XCTAssertNil(e);\n        XCTAssertNotNil(results);\n        XCTAssertEqual((int)results.count, expected);\n        for (int i = 0; i < expected; ++i) {\n            XCTAssertEqual(results[i].intCol, i + 1);\n        }\n        ++expected;\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    for (int i = 0; i < 3; ++i) {\n        expectation = [self expectationWithDescription:@\"\"];\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *realm = [RLMRealm defaultRealm];\n            ArrayPropertyObject *array = [[ArrayPropertyObject allObjectsInRealm:realm] firstObject];\n\n            // Create two objects, one in the list and one not, to verify that the\n            // LinkList is actually be used\n            [realm beginWriteTransaction];\n            [IntObject createInRealm:realm withValue:@[@(i + 1)]];\n            [array.intArray addObject:[IntObject createInRealm:realm withValue:@[@(i + 1)]]];\n            [realm commitWriteTransaction];\n        }];\n        [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    }\n\n    [token invalidate];\n}\n\n- (RLMNotificationToken *)subscribeAndWaitForInitial:(id<RLMCollection>)query block:(void (^)(id))block {\n    __block XCTestExpectation *exp = [self expectationWithDescription:@\"wait for initial results\"];\n    auto token = [query addNotificationBlock:^(id results, RLMCollectionChange *change, NSError *e) {\n        XCTAssertNotNil(results);\n        XCTAssertNil(e);\n        if (exp) {\n            [exp fulfill];\n            exp = nil;\n        }\n        else {\n            block(results);\n        }\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    return token;\n}\n\n- (void)testManualRefreshUsesAsyncResultsWhenPossible {\n    __block bool called = false;\n    auto token = [self subscribeAndWaitForInitial:IntObject.allObjects block:^(RLMResults *results) {\n        called = true;\n    }];\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    realm.autorefresh = NO;\n\n    [self waitForNotification:RLMRealmRefreshRequiredNotification realm:realm block:^{\n        [self dispatchAsync:^{\n            [RLMRealm.defaultRealm transactionWithBlock:^{\n                [IntObject createInDefaultRealmWithValue:@[@0]];\n            }];\n        }];\n    }];\n\n    XCTAssertFalse(called);\n    [realm refresh];\n    XCTAssertTrue(called);\n\n    [token invalidate];\n}\n\n- (void)testModifyingUnrelatedTableDoesNotTriggerResend {\n    __block XCTestExpectation *expectation = [self expectationWithDescription:@\"\"];\n    auto token = [[IntObject allObjects] addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *e) {\n        // will throw if called a second time\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [self waitForNotification:RLMRealmDidChangeNotification realm:RLMRealm.defaultRealm block:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            [StringObject createInDefaultRealmWithValue:@[@\"\"]];\n        }];\n    }];\n    [token invalidate];\n}\n\n- (void)testStaleResultsAreDiscardedWhenThreadIsBlocked {\n    XCTestExpectation *expectation = [self expectationWithDescription:@\"\"];\n    auto token = [IntObject.allObjects addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *e) {\n        // Will fail if this is called with the initial results\n        XCTAssertEqual(1U, results.count);\n        // Will fail if it's called twice\n        [expectation fulfill];\n    }];\n\n    // Advance the version on a different thread, and then wait for async work\n    // to complete for that new version\n    [self dispatchAsyncAndWait:^{\n        [RLMRealm.defaultRealm transactionWithBlock:^{\n            [IntObject createInDefaultRealmWithValue:@[@0]];\n        } error:nil];\n\n        __block RLMNotificationToken *token;\n        CFRunLoopPerformBlock(CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, ^{\n            token = [IntObject.allObjects addNotificationBlock:^(RLMResults *, RLMCollectionChange *, NSError *) {\n                [token invalidate];\n                token = nil;\n                CFRunLoopStop(CFRunLoopGetCurrent());\n            }];\n        });\n        CFRunLoopRun();\n    }];\n\n    // Only now let the main thread pick up the notifications\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [token invalidate];\n}\n\n- (void)testCommitInOneNotificationDoesNotCancelOtherNotifications {\n    __block XCTestExpectation *exp1 = nil;\n    __block XCTestExpectation *exp2 = nil;\n    __block int firstBlockCalls = 0;\n    __block int secondBlockCalls = 0;\n\n    auto token = [self subscribeAndWaitForInitial:IntObject.allObjects block:^(RLMResults *results) {\n        ++firstBlockCalls;\n        if (firstBlockCalls == 2) {\n            [exp1 fulfill];\n        }\n        else {\n            [results.realm beginWriteTransaction];\n            [IntObject createInDefaultRealmWithValue:@[@1]];\n            [results.realm commitWriteTransaction];\n        }\n    }];\n    auto token2 = [self subscribeAndWaitForInitial:IntObject.allObjects block:^(RLMResults *results) {\n        ++secondBlockCalls;\n        if (secondBlockCalls == 2) {\n            [exp2 fulfill];\n        }\n    }];\n\n    exp1 = [self expectationWithDescription:@\"\"];\n    exp2 = [self expectationWithDescription:@\"\"];\n\n    [RLMRealm.defaultRealm transactionWithBlock:^{\n        [IntObject createInDefaultRealmWithValue:@[@0]];\n    } error:nil];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    XCTAssertEqual(2, firstBlockCalls);\n    XCTAssertEqual(2, secondBlockCalls);\n\n    [token invalidate];\n    [token2 invalidate];\n}\n\n- (void)testRLMResultsInstanceIsReused {\n    __weak __block RLMResults *prev;\n    __block bool first = true;\n\n    XCTestExpectation *expectation = [self expectationWithDescription:@\"\"];\n    auto token = [IntObject.allObjects addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *e) {\n        if (first) {\n            prev = results;\n            first = false;\n        }\n        else {\n            XCTAssertEqual(prev, results); // deliberately not EqualObjects\n        }\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    XCTAssertNotNil(prev);\n    [token invalidate];\n}\n\n- (void)testCancellationTokenKeepsSubscriptionAlive {\n    __block XCTestExpectation *expectation = [self expectationWithDescription:@\"\"];\n    RLMNotificationToken *token;\n    @autoreleasepool {\n        token = [IntObject.allObjects addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *err) {\n            XCTAssertNotNil(results);\n            XCTAssertNil(err);\n            [expectation fulfill];\n        }];\n    }\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // at this point there are no strong references to anything other than the\n    // token, so verify that things haven't magically gone away\n    // this would be better as a multi-process tests with the commit done\n    // from a different process\n\n    expectation = [self expectationWithDescription:@\"\"];\n    @autoreleasepool {\n        [RLMRealm.defaultRealm transactionWithBlock:^{\n            [IntObject createInDefaultRealmWithValue:@[@0]];\n        }];\n    }\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [token invalidate];\n}\n\n- (void)testCancellationTokenPreventsOpeningRealmWithMismatchedConfig {\n    __block XCTestExpectation *expectation = [self expectationWithDescription:@\"\"];\n    RLMNotificationToken *token;\n    @autoreleasepool {\n        token = [IntObject.allObjects addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *err) {\n            XCTAssertNotNil(results);\n            XCTAssertNil(err);\n            [expectation fulfill];\n        }];\n    }\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.readOnly = true;\n    @autoreleasepool {\n        XCTAssertThrows([RLMRealm realmWithConfiguration:config error:nil]);\n    }\n\n    [token invalidate];\n    XCTAssertNoThrow([RLMRealm realmWithConfiguration:config error:nil]);\n}\n\n- (void)testAddAndRemoveQueries {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    @autoreleasepool {\n        RLMResults *results = IntObject.allObjects;\n        [[self subscribeAndWaitForInitial:results block:^(RLMResults *r) {\n            XCTFail(@\"results delivered after removal\");\n        }] invalidate];\n\n        // Readd same results at same version\n        [[self subscribeAndWaitForInitial:results block:^(RLMResults *r) {\n            XCTFail(@\"results delivered after removal\");\n        }] invalidate];\n\n        // Add different results at same version\n        [[self subscribeAndWaitForInitial:IntObject.allObjects block:^(RLMResults *r) {\n            XCTFail(@\"results delivered after removal\");\n        }] invalidate];\n\n        [self waitForNotification:RLMRealmDidChangeNotification realm:RLMRealm.defaultRealm block:^{\n            [RLMRealm.defaultRealm transactionWithBlock:^{ }];\n        }];\n\n        // Readd at later version\n        [[self subscribeAndWaitForInitial:results block:^(RLMResults *r) {\n            XCTFail(@\"results delivered after removal\");\n        }] invalidate];\n\n        // Add different results at later version\n        [[self subscribeAndWaitForInitial:[IntObject allObjectsInRealm:realm] block:^(RLMResults *r) {\n            XCTFail(@\"results delivered after removal\");\n        }] invalidate];\n    }\n\n    // Add different results after all of the previous async queries have been\n    // removed entirely\n    [[self subscribeAndWaitForInitial:[IntObject allObjectsInRealm:realm] block:^(RLMResults *r) {\n        XCTFail(@\"results delivered after removal\");\n    }] invalidate];\n}\n\n- (void)testMultipleSourceVersionsForAsyncQueries {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.cache = false;\n\n    // Create ten RLMRealm instances, each with a different read version\n    RLMRealm *realms[10];\n    for (int i = 0; i < 10; ++i) {\n        RLMRealm *realm = realms[i] = [RLMRealm realmWithConfiguration:config error:nil];\n        [realm transactionWithBlock:^{\n            [IntObject createInRealm:realm withValue:@[@(i)]];\n        }];\n    }\n\n    // Each Realm should see a different number of objects as they're on different versions\n    for (NSUInteger i = 0; i < 10; ++i) {\n        XCTAssertEqual(i + 1, [IntObject allObjectsInRealm:realms[i]].count);\n    }\n\n    RLMNotificationToken *tokens[10];\n\n    // asyncify them in reverse order so that the version pin has to go backwards\n    for (int i = 9; i >= 0; --i) {\n        XCTestExpectation *exp = [self expectationWithDescription:@(i).stringValue];\n        tokens[i] = [[IntObject allObjectsInRealm:realms[i]] addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *error) {\n            XCTAssertEqual(10U, results.count);\n            XCTAssertNil(error);\n            [exp fulfill];\n        }];\n    }\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    for (int i = 0; i < 10; ++i) {\n        [tokens[i] invalidate];\n    }\n}\n\n- (void)testMultipleSourceVersionsWithNotifiersRemovedBeforeRunning {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.cache = false;\n    config.configRef.automatic_change_notifications = false;\n\n    // Create ten RLMRealm instances, each with a different read version\n    RLMRealm *realms[10];\n    for (int i = 0; i < 10; ++i) {\n        RLMRealm *realm = realms[i] = [ManualRefreshRealm realmWithConfiguration:config error:nil];\n        [realm transactionWithBlock:^{\n            [IntObject createInRealm:realm withValue:@[@(i)]];\n        }];\n    }\n\n    __block int calls = 0;\n    RLMNotificationToken *tokens[10];\n    @autoreleasepool {\n        for (int i = 0; i < 10; ++i) {\n            tokens[i] = [[IntObject allObjectsInRealm:realms[i]]\n                         addNotificationBlock:^(RLMResults *, RLMCollectionChange *, NSError *) {\n                             ++calls;\n                         }];\n        }\n\n        // Each Realm should see a different number of objects as they're on different versions\n        for (NSUInteger i = 0; i < 10; ++i) {\n            XCTAssertEqual(i + 1, [IntObject allObjectsInRealm:realms[i]].count);\n        }\n\n        // remove all but the last two so that the version pin is for a version\n        // that doesn't have a notifier anymore\n        for (int i = 0; i < 7; ++i) {\n            [tokens[i] invalidate];\n        }\n    }\n\n    // Let the background job run now\n    auto coord = realm::_impl::RealmCoordinator::get_coordinator(config.path);\n    coord->on_change();\n\n    for (int i = 7; i < 10; ++i) {\n        realms[i]->_realm->notify();\n        XCTAssertEqual(calls, i - 6);\n    }\n\n    for (int i = 7; i < 10; ++i) {\n        [tokens[i] invalidate];\n    }\n}\n\n- (void)testMultipleCallbacksForOneQuery {\n    RLMResults *results = IntObject.allObjects;\n\n    __block int calls1 = 0;\n    auto token1 = [self subscribeAndWaitForInitial:results block:^(RLMResults *results) {\n        ++calls1;\n    }];\n    XCTAssertEqual(calls1, 0);\n\n    __block int calls2 = 0;\n    auto token2 = [self subscribeAndWaitForInitial:results block:^(RLMResults *results) {\n        ++calls2;\n    }];\n    XCTAssertEqual(calls1, 0);\n    XCTAssertEqual(calls2, 0);\n\n    [self waitForNotification:RLMRealmDidChangeNotification realm:results.realm block:^{\n        [self createObject:0];\n    }];\n\n    XCTAssertEqual(calls1, 1);\n    XCTAssertEqual(calls2, 1);\n\n    [token1 invalidate];\n\n    [self waitForNotification:RLMRealmDidChangeNotification realm:results.realm block:^{\n        [self createObject:0];\n    }];\n\n    XCTAssertEqual(calls1, 1);\n    XCTAssertEqual(calls2, 2);\n\n    [token2 invalidate];\n\n    [self waitForNotification:RLMRealmDidChangeNotification realm:results.realm block:^{\n        [self createObject:0];\n    }];\n\n    XCTAssertEqual(calls1, 1);\n    XCTAssertEqual(calls2, 2);\n}\n\n- (void)testRemovingBlockFromWithinNotificationBlock {\n    RLMResults *results = IntObject.allObjects;\n\n    __block int calls = 0;\n    __block RLMNotificationToken *token1, *token2;\n    token1 = [self subscribeAndWaitForInitial:results block:^(RLMResults *results) {\n        [token1 invalidate];\n        ++calls;\n    }];\n    token2 = [self subscribeAndWaitForInitial:results block:^(RLMResults *results) {\n        [token2 invalidate];\n        ++calls;\n    }];\n\n    [self waitForNotification:RLMRealmDidChangeNotification realm:results.realm block:^{\n        [self createObject:0];\n    }];\n\n    [self waitForNotification:RLMRealmDidChangeNotification realm:results.realm block:^{\n        [self createObject:0];\n    }];\n    XCTAssertEqual(calls, 2);\n}\n\n- (void)testAddingBlockFromWithinNotificationBlock {\n    RLMResults *results = IntObject.allObjects;\n\n    __block int calls = 0;\n    __block RLMNotificationToken *token1, *token2;\n    token1 = [self subscribeAndWaitForInitial:results block:^(RLMResults *results) {\n        if (++calls == 1) {\n            token2 = [results addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *error) {\n                ++calls;\n            }];\n        }\n    }];\n\n    // Triggers one call on each block. Nested call is deferred until next refresh.\n    [self waitForNotification:RLMRealmDidChangeNotification realm:results.realm block:^{\n        [self createObject:0];\n    }];\n    XCTAssertEqual(calls, 1);\n    [results.realm refresh];\n    XCTAssertEqual(calls, 2);\n\n    // Triggers one call on each block\n    [self waitForNotification:RLMRealmDidChangeNotification realm:results.realm block:^{\n        [self createObject:0];\n    }];\n    XCTAssertEqual(calls, 4);\n\n    [token1 invalidate];\n    [token2 invalidate];\n}\n\n- (void)testAddingNewQueryWithinNotificationBlock {\n    RLMResults *results1 = IntObject.allObjects;\n    RLMResults *results2 = IntObject.allObjects;\n\n    __block int calls = 0;\n    __block RLMNotificationToken *token1, *token2;\n    token1 = [self subscribeAndWaitForInitial:results1 block:^(RLMResults *results) {\n        ++calls;\n        if (calls == 1) {\n            CFRunLoopStop(CFRunLoopGetCurrent());\n            token2 = [results2 addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *error) {\n                CFRunLoopStop(CFRunLoopGetCurrent());\n                ++calls;\n            }];\n        }\n    }];\n\n    // Triggers one call on outer block, but inner does not get a chance to deliver\n    [self dispatchAsync:^{ [self createObject:0]; }];\n    CFRunLoopRun();\n    XCTAssertEqual(calls, 1);\n\n    // Pick up the initial run of the inner block\n    CFRunLoopRun();\n    assert(calls == 2);\n    XCTAssertEqual(calls, 2);\n\n    // Triggers a call on each block\n    [self dispatchAsync:^{ [self createObject:0]; }];\n    CFRunLoopRun();\n    XCTAssertEqual(calls, 4);\n\n    [token1 invalidate];\n    [token2 invalidate];\n}\n\n- (void)testAddingNewQueryWithinRealmNotificationBlock {\n    __block RLMNotificationToken *queryToken;\n    __block XCTestExpectation *exp;\n    auto realmToken = [RLMRealm.defaultRealm addNotificationBlock:^(RLMNotification notification, RLMRealm *realm) {\n        CFRunLoopStop(CFRunLoopGetCurrent());\n        exp = [self expectationWithDescription:@\"query notification\"];\n        queryToken = [IntObject.allObjects addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *e) {\n            [exp fulfill];\n        }];\n    }];\n\n    // Make a background commit to trigger a Realm notification\n    [self dispatchAsync:^{ [RLMRealm.defaultRealm transactionWithBlock:^{}]; }];\n\n    // Wait for the notification\n    CFRunLoopRun();\n    [realmToken invalidate];\n\n    // Wait for the initial async query results created within the notification\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [queryToken invalidate];\n}\n\n- (void)testBlockedThreadWithNotificationsDoesNotPreventDeliveryOnOtherThreads {\n    dispatch_group_t group1 = dispatch_group_create();\n    dispatch_group_t group2 = dispatch_group_create();\n    // Add a notification block on a background thread, run the runloop\n    // until the initial results are ready, and then block the thread without\n    // running the runloop until the main thread is done testing things\n    __block RLMNotificationToken *token;\n    dispatch_group_enter(group1);\n    dispatch_group_enter(group2);\n    token = [IntObject.allObjects addNotificationBlock:^(RLMResults *, RLMCollectionChange *, NSError *) {\n        dispatch_group_leave(group1);\n        dispatch_group_wait(group2, DISPATCH_TIME_FOREVER);\n    } queue:self.bgQueue];\n\n    dispatch_group_wait(group1, DISPATCH_TIME_FOREVER);\n\n    __block int calls = 0;\n    auto token2 = [self subscribeAndWaitForInitial:IntObject.allObjects block:^(RLMResults *results) {\n        ++calls;\n    }];\n    XCTAssertEqual(calls, 0);\n\n    [self waitForNotification:RLMRealmDidChangeNotification realm:RLMRealm.defaultRealm block:^{\n        [self createObject:0];\n    }];\n    XCTAssertEqual(calls, 1);\n\n    [token invalidate];\n    [token2 invalidate];\n    dispatch_group_leave(group2);\n}\n\n- (void)testAddNotificationBlockFromWrongThread {\n    RLMResults *results = [IntObject allObjects];\n    [self dispatchAsyncAndWait:^{\n        CFRunLoopPerformBlock(CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, ^{\n            XCTAssertThrows([results addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *error) {\n                XCTFail(@\"should not be called\");\n            }]);\n            CFRunLoopStop(CFRunLoopGetCurrent());\n        });\n        CFRunLoopRun();\n    }];\n}\n\n- (void)testAddNotificationBlockFromWrongQueue {\n    auto queue = dispatch_queue_create(\"background queue\", DISPATCH_QUEUE_SERIAL);\n    __block RLMResults *results;\n    dispatch_sync(queue, ^{\n        RLMRealm *realm = [RLMRealm defaultRealmForQueue:queue];\n        results = [IntObject allObjectsInRealm:realm];\n    });\n    XCTAssertThrows([results addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *error) {\n        XCTFail(@\"should not be called\");\n    }]);\n}\n\n- (void)testRemoveNotificationBlockFromWrongThread {\n    // Unlike adding this is allowed, because it can happen due to capturing\n    // tokens in blocks and users are very confused by errors from deallocation\n    // on the wrong thread\n    RLMResults *results = [IntObject allObjects];\n    auto token = [results addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *error) {\n        XCTFail(@\"should not be called\");\n    }];\n    [self dispatchAsyncAndWait:^{\n        [token invalidate];\n    }];\n}\n\n- (void)testSimultaneouslyRemoveCallbacksFromCallbacksForOtherResults {\n    dispatch_semaphore_t sema1 = dispatch_semaphore_create(0);\n    dispatch_semaphore_t sema2 = dispatch_semaphore_create(0);\n    __block RLMNotificationToken *token1, *token2;\n\n    [self dispatchAsync:^{\n        CFRunLoopPerformBlock(CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, ^{\n            __block bool first = true;\n            token1 = [IntObject.allObjects addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *error) {\n                XCTAssertTrue(first);\n                first = false;\n                dispatch_semaphore_signal(sema1);\n                dispatch_semaphore_wait(sema2, DISPATCH_TIME_FOREVER);\n                [token2 invalidate];\n                CFRunLoopStop(CFRunLoopGetCurrent());\n            }];\n        });\n        CFRunLoopRun();\n    }];\n\n    CFRunLoopPerformBlock(CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, ^{\n        __block bool first = true;\n        token2 = [IntObject.allObjects addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *error) {\n            XCTAssertTrue(first);\n            first = false;\n            dispatch_semaphore_signal(sema2);\n            dispatch_semaphore_wait(sema1, DISPATCH_TIME_FOREVER);\n            [token1 invalidate];\n            CFRunLoopStop(CFRunLoopGetCurrent());\n        }];\n    });\n    CFRunLoopRun();\n}\n\n- (void)testAsyncNotSupportedForReadOnlyRealms {\n    @autoreleasepool { [RLMRealm defaultRealm]; }\n\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.readOnly = true;\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n\n    XCTAssertThrows([[IntObject allObjectsInRealm:realm] addNotificationBlock:^(RLMResults *results, RLMCollectionChange *change, NSError *error) {\n        XCTFail(@\"should not be called\");\n    }]);\n}\n\n- (void)testAsyncNotSupportedAfterMakingChangesInWriteTransactions {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm transactionWithBlock:^{\n        XCTAssertNoThrow([IntObject.allObjects addNotificationBlock:^(RLMResults *, RLMCollectionChange *, NSError *) {}]);\n        [IntObject createInRealm:realm withValue:@[@0]];\n        RLMAssertThrowsWithReason([IntObject.allObjects addNotificationBlock:^(RLMResults *, RLMCollectionChange *, NSError *) {}],\n                                  @\"Cannot create asynchronous query after making changes in a write transaction.\");\n        RLMAssertThrowsWithReason([IntObject.allObjects[0] addNotificationBlock:^(BOOL, NSArray *, NSError *) {}],\n                                  @\"Cannot create asynchronous query after making changes in a write transaction.\");\n    }];\n}\n\n- (void)testTransactionsAfterDeletingArrayLinkView {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    IntObject *io = [IntObject createInRealm:realm withValue:@[@5]];\n    ArrayPropertyObject *apo = [ArrayPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[io]]];\n    [realm commitWriteTransaction];\n\n    RLMNotificationToken *token1 = [self subscribeAndWaitForInitial:apo.intArray block:^(RLMArray *array) {\n        XCTAssertTrue(array.invalidated);\n    }];\n    RLMResults *asResults = [apo.intArray objectsWhere:@\"intCol = 5\"];\n    RLMNotificationToken *token2 = [self subscribeAndWaitForInitial:asResults block:^(RLMResults *results) {\n        XCTAssertEqual(results.count, 0U);\n    }];\n\n    // Delete the object containing the RLMArray with notifiers\n    [self waitForNotification:RLMRealmDidChangeNotification realm:realm block:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            [realm deleteObject:[ArrayPropertyObject allObjectsInRealm:realm].firstObject];\n        }];\n    }];\n\n    // Perform another transaction while the notifiers are still alive as\n    // transactions deleting the RLMArray and transactions with the RLMArray\n    // already deleted hit different code paths\n    [self waitForNotification:RLMRealmDidChangeNotification realm:realm block:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            [ArrayPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[]]];\n        }];\n    }];\n\n    [token1 invalidate];\n    [token2 invalidate];\n}\n\n- (void)testTransactionsAfterDeletingSetLinkView {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    IntObject *io = [IntObject createInRealm:realm withValue:@[@5]];\n    SetPropertyObject *spo = [SetPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[io]]];\n    [realm commitWriteTransaction];\n\n    RLMNotificationToken *token1 = [self subscribeAndWaitForInitial:spo.intSet block:^(RLMSet *set) {\n        XCTAssertTrue(set.invalidated);\n    }];\n    RLMResults *asResults = [spo.intSet objectsWhere:@\"intCol = 5\"];\n    RLMNotificationToken *token2 = [self subscribeAndWaitForInitial:asResults block:^(RLMResults *results) {\n        XCTAssertEqual(results.count, 0U);\n    }];\n\n    // Delete the object containing the RLMArray with notifiers\n    [self waitForNotification:RLMRealmDidChangeNotification realm:realm block:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            [realm deleteObject:[SetPropertyObject allObjectsInRealm:realm].firstObject];\n        }];\n    }];\n\n    // Perform another transaction while the notifiers are still alive as\n    // transactions deleting the RLMArray and transactions with the RLMArray\n    // already deleted hit different code paths\n    [self waitForNotification:RLMRealmDidChangeNotification realm:realm block:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            [SetPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[]]];\n        }];\n    }];\n\n    [token1 invalidate];\n    [token2 invalidate];\n}\n\n- (void)testInitialResultDiscardsChanges {\n    auto token = [IntObject.allObjects addNotificationBlock:^(RLMResults *results, RLMCollectionChange *changes, NSError *) {\n        XCTAssertEqual(results.count, 1U);\n        XCTAssertNil(changes);\n        CFRunLoopStop(CFRunLoopGetCurrent());\n    }];\n\n    // Make a write on a background thread, and then wait for the notification\n    // for that write to be delivered to ensure that the notification we get on\n    // the main thread actually would include changes\n    dispatch_semaphore_t sema = dispatch_semaphore_create(0);\n    [self dispatchAsync:^{\n        CFRunLoopPerformBlock(CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, ^{\n            auto token = [IntObject.allObjects addNotificationBlock:^(RLMResults *results, RLMCollectionChange *changes, NSError *) {\n                if (changes) {\n                    dispatch_semaphore_signal(sema);\n                    CFRunLoopStop(CFRunLoopGetCurrent());\n                }\n            }];\n\n            [RLMRealm.defaultRealm transactionWithBlock:^{\n                [IntObject createInDefaultRealmWithValue:@[@0]];\n            }];\n\n            CFRunLoopRun();\n            [token invalidate];\n            CFRunLoopStop(CFRunLoopGetCurrent());\n        });\n        CFRunLoopRun();\n    }];\n\n    dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);\n    CFRunLoopRun();\n    [token invalidate];\n}\n\n- (void)testNotificationDeliveryToQueue {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    __block RLMNotificationToken *token;\n    dispatch_semaphore_t sema = dispatch_semaphore_create(0);\n\n    [self dispatchAsync:^{\n        RLMRealm *bgRealm = [RLMRealm defaultRealmForQueue:self.bgQueue];\n        token = [[IntObject allObjectsInRealm:bgRealm] addNotificationBlock:^(RLMResults *results, RLMCollectionChange *, NSError *) {\n            XCTAssertNotNil(results);\n            XCTAssertNoThrow(results.count);\n            dispatch_semaphore_signal(sema);\n        }];\n    }];\n    dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);\n\n    [realm transactionWithBlock:^{\n        [IntObject createInRealm:realm withValue:@[@1]];\n    }];\n    dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);\n    [token invalidate];\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/CompactionTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2017 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n@interface RLMRealm ()\n- (BOOL)compact;\n@end\n\n@interface CompactionTests : RLMTestCase\n@end\n\n@implementation CompactionTests {\n    uint64_t _expectedTotalBytesBefore;\n}\n\nstatic const NSUInteger expectedUsedBytesBeforeMin = 50000;\nstatic const NSUInteger count = 1000;\n\n#pragma mark - Helpers\n\n- (unsigned long long)fileSize:(NSURL *)fileURL {\n    NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:fileURL.path error:nil];\n    return [attributes[NSFileSize] unsignedLongLongValue];\n}\n\n- (void)setUp {\n    [super setUp];\n    @autoreleasepool {\n        // Make compactable Realm\n        RLMRealm *realm = self.realmWithTestPath;\n        NSString *uuid = [[NSUUID UUID] UUIDString];\n        [realm transactionWithBlock:^{\n            [StringObject createInRealm:realm withValue:@[@\"A\"]];\n            for (NSUInteger i = 0; i < count; ++i) {\n                [StringObject createInRealm:realm withValue:@[uuid]];\n            }\n            [StringObject createInRealm:realm withValue:@[@\"B\"]];\n        }];\n    }\n    _expectedTotalBytesBefore = [self fileSize:RLMTestRealmURL()];\n}\n\n#pragma mark - Tests\n\n- (void)testCompact {\n    RLMRealm *realm = self.realmWithTestPath;\n    unsigned long long fileSizeBefore = [self fileSize:realm.configuration.fileURL];\n    StringObject *object = [StringObject allObjectsInRealm:realm].firstObject;\n\n    XCTAssertTrue([realm compact]);\n\n    XCTAssertTrue(object.isInvalidated);\n    XCTAssertEqual([[StringObject allObjectsInRealm:realm] count], count + 2);\n    XCTAssertEqualObjects(@\"A\", [[StringObject allObjectsInRealm:realm].firstObject stringCol]);\n    XCTAssertEqualObjects(@\"B\", [[StringObject allObjectsInRealm:realm].lastObject stringCol]);\n\n    unsigned long long fileSizeAfter = [self fileSize:realm.configuration.fileURL];\n    XCTAssertGreaterThan(fileSizeBefore, fileSizeAfter);\n}\n\n- (void)testSuccessfulCompactOnLaunch {\n    // Configure the Realm to compact on launch\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = RLMTestRealmURL();\n    configuration.shouldCompactOnLaunch = ^BOOL(NSUInteger totalBytes, NSUInteger usedBytes){\n        // The reported size is the logical size of the file and not the size\n        // on disk for encrypted Realms\n        if (!self.encryptTests) {\n            XCTAssertEqual(totalBytes, _expectedTotalBytesBefore);\n        }\n        XCTAssertTrue((usedBytes < totalBytes) && (usedBytes > expectedUsedBytesBeforeMin));\n        return true;\n    };\n\n    // Confirm expected sizes before and after opening the Realm\n    XCTAssertEqual([self fileSize:configuration.fileURL], _expectedTotalBytesBefore);\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:configuration error:nil];\n    XCTAssertLessThan([self fileSize:configuration.fileURL], _expectedTotalBytesBefore);\n\n    // Validate that the file still contains what it should\n    XCTAssertEqual([[StringObject allObjectsInRealm:realm] count], count + 2);\n    XCTAssertEqualObjects(@\"A\", [[StringObject allObjectsInRealm:realm].firstObject stringCol]);\n    XCTAssertEqualObjects(@\"B\", [[StringObject allObjectsInRealm:realm].lastObject stringCol]);\n}\n\n- (void)testNoBlockCompactOnLaunch {\n    // Configure the Realm to compact on launch\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = RLMTestRealmURL();\n    // Confirm expected sizes before and after opening the Realm\n    XCTAssertEqual([self fileSize:configuration.fileURL], _expectedTotalBytesBefore);\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:configuration error:nil];\n    XCTAssertEqual([self fileSize:configuration.fileURL], _expectedTotalBytesBefore);\n\n    // Validate that the file still contains what it should\n    XCTAssertEqual([[StringObject allObjectsInRealm:realm] count], count + 2);\n    XCTAssertEqualObjects(@\"A\", [[StringObject allObjectsInRealm:realm].firstObject stringCol]);\n    XCTAssertEqualObjects(@\"B\", [[StringObject allObjectsInRealm:realm].lastObject stringCol]);\n}\n\n- (void)testCachedRealmCompactOnLaunch {\n    // Test that the compaction block never gets called if there are cached Realms\n    // Access Realm before opening it with a compaction block\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = RLMTestRealmURL();\n    __unused RLMRealm *firstRealm = [RLMRealm realmWithConfiguration:configuration error:nil];\n\n    // Configure the Realm to compact on launch\n    RLMRealmConfiguration *configurationWithCompactBlock = [configuration copy];\n    __block BOOL compactBlockInvoked = NO;\n    configurationWithCompactBlock.shouldCompactOnLaunch = ^BOOL(__unused NSUInteger totalBytes, __unused NSUInteger usedBytes){\n        compactBlockInvoked = YES;\n        // Always attempt to compact\n        return YES;\n    };\n\n    // Confirm expected sizes before and after opening the Realm\n    XCTAssertEqual([self fileSize:configuration.fileURL], _expectedTotalBytesBefore);\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:configurationWithCompactBlock error:nil];\n    XCTAssertFalse(compactBlockInvoked);\n    XCTAssertEqual([self fileSize:configuration.fileURL], _expectedTotalBytesBefore);\n\n    // Validate that the file still contains what it should\n    XCTAssertEqual([[StringObject allObjectsInRealm:realm] count], count + 2);\n    XCTAssertEqualObjects(@\"A\", [[StringObject allObjectsInRealm:realm].firstObject stringCol]);\n    XCTAssertEqualObjects(@\"B\", [[StringObject allObjectsInRealm:realm].lastObject stringCol]);\n}\n\n- (void)testCachedRealmOtherThreadCompactOnLaunch {\n    // Test that the compaction block never gets called if the Realm is open on a different thread\n    // Access Realm before opening it with a compaction block\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = RLMTestRealmURL();\n\n    dispatch_semaphore_t failedCompactTestCompleteSema = dispatch_semaphore_create(0);\n    dispatch_semaphore_t bgRealmClosedSema = dispatch_semaphore_create(0);\n\n    XCTestExpectation *realmOpenedExpectation = [self expectationWithDescription:@\"Realm was opened on background thread\"];\n    [self dispatchAsync:^{\n        @autoreleasepool {\n            __unused RLMRealm *firstRealm = [RLMRealm realmWithConfiguration:configuration error:nil];\n            [realmOpenedExpectation fulfill];\n            dispatch_semaphore_wait(failedCompactTestCompleteSema, DISPATCH_TIME_FOREVER);\n        }\n        dispatch_semaphore_signal(bgRealmClosedSema);\n    }];\n    [self waitForExpectationsWithTimeout:2 handler:nil];\n\n    @autoreleasepool {\n        // Configure the Realm to compact on launch\n        RLMRealmConfiguration *configurationWithCompactBlock = [configuration copy];\n        __block BOOL compactBlockInvoked = NO;\n\n        configurationWithCompactBlock.shouldCompactOnLaunch = ^BOOL(__unused NSUInteger totalBytes, __unused NSUInteger usedBytes){\n            compactBlockInvoked = YES;\n            // Always attempt to compact\n            return YES;\n        };\n\n        // Confirm expected sizes before and after opening the Realm\n        XCTAssertEqual([self fileSize:configuration.fileURL], _expectedTotalBytesBefore);\n        __unused RLMRealm *realm = [RLMRealm realmWithConfiguration:configurationWithCompactBlock error:nil];\n        XCTAssertFalse(compactBlockInvoked);\n        XCTAssertEqual([self fileSize:configuration.fileURL], _expectedTotalBytesBefore);\n        dispatch_semaphore_signal(failedCompactTestCompleteSema);\n    }\n\n    dispatch_semaphore_wait(bgRealmClosedSema, DISPATCH_TIME_FOREVER);\n\n    // Configure the Realm to compact on launch\n    RLMRealmConfiguration *configurationWithCompactBlock = [configuration copy];\n    __block BOOL compactBlockInvoked = NO;\n\n    configurationWithCompactBlock.shouldCompactOnLaunch = ^BOOL(NSUInteger totalBytes, NSUInteger usedBytes){\n        // The reported size is the logical size of the file and not the size\n        // on disk for encrypted Realms\n        if (!self.encryptTests) {\n            XCTAssertEqual(totalBytes, _expectedTotalBytesBefore);\n        }\n        XCTAssertTrue((usedBytes < totalBytes) && (usedBytes > expectedUsedBytesBeforeMin));\n        compactBlockInvoked = YES;\n        return true;\n    };\n\n    // Confirm expected sizes before and after opening the Realm\n    XCTAssertEqual([self fileSize:configuration.fileURL], _expectedTotalBytesBefore);\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:configurationWithCompactBlock error:nil];\n    XCTAssertTrue(compactBlockInvoked);\n    XCTAssertLessThan([self fileSize:configuration.fileURL], _expectedTotalBytesBefore);\n\n    // Validate that the file still contains what it should\n    XCTAssertEqual([[StringObject allObjectsInRealm:realm] count], count + 2);\n    XCTAssertEqualObjects(@\"A\", [[StringObject allObjectsInRealm:realm].firstObject stringCol]);\n    XCTAssertEqualObjects(@\"B\", [[StringObject allObjectsInRealm:realm].lastObject stringCol]);\n}\n\n- (void)testReturnNoCompactOnLaunch {\n    // Configure the Realm to compact on launch\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = RLMTestRealmURL();\n    configuration.shouldCompactOnLaunch = ^BOOL(NSUInteger totalBytes, NSUInteger usedBytes){\n        // The reported size is the logical size of the file and not the size\n        // on disk for encrypted Realms\n        if (!self.encryptTests) {\n            XCTAssertEqual(totalBytes, _expectedTotalBytesBefore);\n        }\n        XCTAssertTrue((usedBytes < totalBytes) && (usedBytes > expectedUsedBytesBeforeMin));\n\n        // Don't compact.\n        return NO;\n    };\n\n    // Confirm expected sizes before and after opening the Realm\n    XCTAssertEqual([self fileSize:configuration.fileURL], _expectedTotalBytesBefore);\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:configuration error:nil];\n    XCTAssertEqual([self fileSize:configuration.fileURL], _expectedTotalBytesBefore);\n\n    // Validate that the file still contains what it should\n    XCTAssertEqual([[StringObject allObjectsInRealm:realm] count], count + 2);\n    XCTAssertEqualObjects(@\"A\", [[StringObject allObjectsInRealm:realm].firstObject stringCol]);\n    XCTAssertEqualObjects(@\"B\", [[StringObject allObjectsInRealm:realm].lastObject stringCol]);\n}\n\n- (void)testCompactOnLaunchValidation {\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.readOnly = YES;\n\n    BOOL (^compactBlock)(NSUInteger, NSUInteger) = ^BOOL(__unused NSUInteger totalBytes, __unused NSUInteger usedBytes){\n        return NO;\n    };\n    RLMAssertThrowsWithReasonMatching(configuration.shouldCompactOnLaunch = compactBlock,\n                                      @\"Cannot set `shouldCompactOnLaunch` when `readOnly` is set.\");\n\n    configuration.readOnly = NO;\n    configuration.shouldCompactOnLaunch = compactBlock;\n    RLMAssertThrowsWithReasonMatching(configuration.readOnly = YES,\n                                      @\"Cannot set `readOnly` when `shouldCompactOnLaunch` is set.\");\n}\n\n- (void)testAccessDeniedOnTemporaryFile {\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = RLMTestRealmURL();\n    configuration.shouldCompactOnLaunch = ^(__unused NSUInteger totalBytes, __unused NSUInteger usedBytes){\n        return YES;\n    };\n    NSURL *tmpURL = [configuration.fileURL URLByAppendingPathExtension:@\"tmp_compaction_space\"];\n    [NSData.data writeToURL:tmpURL atomically:NO];\n    [NSFileManager.defaultManager setAttributes:@{NSFileImmutable: @YES}\n                                   ofItemAtPath:tmpURL.path error:nil];\n    RLMAssertRealmException([RLMRealm realmWithConfiguration:configuration error:nil],\n                            RLMErrorFilePermissionDenied,\n                            @\"Failed to delete file at '%@': Operation not permitted\", tmpURL.path);\n    [NSFileManager.defaultManager setAttributes:@{NSFileImmutable: @NO}\n                                   ofItemAtPath:tmpURL.path error:nil];\n    XCTAssertNoThrow([RLMRealm realmWithConfiguration:configuration error:nil]);\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/Decimal128Tests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n#import <Realm/RLMDecimal128.h>\n\n@interface Decimal128Tests : RLMTestCase\n@end\n\n@implementation Decimal128Tests\n\n#pragma mark - Initialization\n\n- (void)testDecimal128Initialization {\n    RLMDecimal128 *d1 = [[RLMDecimal128 alloc] initWithNumber:@3.14159];\n    RLMDecimal128 *d2 = [[RLMDecimal128 alloc] initWithString:@\"3.14159\"];\n    RLMDecimal128 *d3 = [[RLMDecimal128 alloc] initWithString:@\"1.2.3\"];\n    RLMDecimal128 *d4 = [[RLMDecimal128 alloc] initWithValue:@3.14159];\n    RLMDecimal128 *d5 = [[RLMDecimal128 alloc] initWithValue:@\"123.456\"];\n    RLMDecimal128 *d6 = [[RLMDecimal128 alloc] initWithNumber:@123456789];\n    RLMDecimal128 *d7 = [[RLMDecimal128 alloc] init];\n    XCTAssertEqual(d1.doubleValue, 3.14159);\n    XCTAssertTrue([d1.stringValue isEqualToString:@\"3.14159\"]);\n    XCTAssertEqual(d2.doubleValue, 3.14159);\n    XCTAssertTrue([d2.stringValue isEqualToString:@\"3.14159\"]);\n    XCTAssertTrue(d3.isNaN);\n    XCTAssertEqual(d4.doubleValue, 3.14159);\n    XCTAssertTrue([d5.stringValue isEqualToString:@\"123.456\"]);\n    XCTAssertTrue([d6.stringValue isEqualToString:@\"123456789\"]);\n    XCTAssertEqual(d7.doubleValue, 0);\n}\n\n- (void)testDecimal128Decimal {\n    NSNumber *n1 = @3.14159;\n    RLMDecimal128 *d1 = [[RLMDecimal128 alloc] initWithString:@\"3.14159\"];\n    XCTAssertEqual((int)n1.decimalValue._exponent, (int)d1.decimalValue._exponent);\n    XCTAssertEqual((int)n1.decimalValue._isCompact, (int)d1.decimalValue._isCompact);\n    XCTAssertEqual((int)n1.decimalValue._isNegative, (int)d1.decimalValue._isNegative);\n    XCTAssertEqual((int)n1.decimalValue._length, (int)d1.decimalValue._length);\n    XCTAssertEqual(n1.decimalValue._mantissa[0], d1.decimalValue._mantissa[0]);\n    XCTAssertEqual((int)n1.decimalValue._reserved, (int)d1.decimalValue._reserved);\n}\n\n#pragma mark - Arithmetic\n\n- (void)testDecimal128Addition {\n    RLMDecimal128 *d1 = [[RLMDecimal128 alloc] initWithNumber:@3.14159];\n    RLMDecimal128 *d2 = [d1 decimalNumberByAdding:[[RLMDecimal128 alloc] initWithString:@\"3.14159\"]];\n    XCTAssertEqual(d2.doubleValue, 6.28318);\n    XCTAssertTrue([d2.stringValue isEqualToString:@\"6.28318\"]);\n    XCTAssertEqual(d2.doubleValue, 6.28318);\n}\n\n- (void)testDecimal128Subtraction {\n    RLMDecimal128 *d1 = [[RLMDecimal128 alloc] initWithNumber:@2.5];\n    RLMDecimal128 *d2 = [d1 decimalNumberBySubtracting:[[RLMDecimal128 alloc] initWithString:@\"5.5\"]];\n    XCTAssertEqual(d2.doubleValue, -3.0);\n    XCTAssertTrue([d2.stringValue isEqualToString:@\"-3\"]);\n}\n\n- (void)testDecimal128Division {\n    RLMDecimal128 *d1 = [[RLMDecimal128 alloc] initWithNumber:@0.21];\n    RLMDecimal128 *d2 = [[RLMDecimal128 alloc] initWithString:@\"0.7\"];\n    RLMDecimal128 *result = [d1 decimalNumberByDividingBy:d2];\n    XCTAssertEqual(result.doubleValue, 0.3);\n    XCTAssertTrue([result.stringValue isEqualToString:@\"3E-1\"]);\n}\n\n- (void)testDecimal128Multiplication {\n    RLMDecimal128 *d1 = [[RLMDecimal128 alloc] initWithNumber:@1.5];\n    RLMDecimal128 *d2 = [[RLMDecimal128 alloc] initWithString:@\"2.5\"];\n    RLMDecimal128 *result = [d1 decimalNumberByMultiplyingBy:d2];\n    XCTAssertEqual(result.doubleValue, 3.75);\n    XCTAssertTrue([result.stringValue isEqualToString:@\"3.75\"]);\n}\n\n#pragma mark - Comparison\n\n- (void)testDecimal128InitializationEquals {\n    RLMDecimal128 *d1 = [[RLMDecimal128 alloc] initWithNumber:@3.14159];\n    RLMDecimal128 *d2 = [[RLMDecimal128 alloc] initWithString:@\"3.14159\"];\n    XCTAssertTrue([d1 isEqual:d2]);\n}\n\n- (void)testDecimal128InitializationGreaterThan {\n    RLMDecimal128 *d1 = [[RLMDecimal128 alloc] initWithNumber:@3.14160];\n    RLMDecimal128 *d2 = [[RLMDecimal128 alloc] initWithString:@\"3.14159\"];\n    XCTAssertTrue([d1 isGreaterThan:d2]);\n}\n\n- (void)testDecimal128InitializationGreaterThanEquals {\n    RLMDecimal128 *d1 = [[RLMDecimal128 alloc] initWithNumber:@3.14158];\n    RLMDecimal128 *d2 = [[RLMDecimal128 alloc] initWithString:@\"3.14159\"];\n    RLMDecimal128 *d3 = [[RLMDecimal128 alloc] initWithString:@\"3.14159\"];\n    XCTAssertFalse([d1 isGreaterThanOrEqualTo:d2]);\n    XCTAssertTrue([d2 isLessThanOrEqualTo:d3]);\n}\n\n- (void)testDecimal128InitializationLessThan {\n    RLMDecimal128 *d1 = [[RLMDecimal128 alloc] initWithNumber:@3.14159];\n    RLMDecimal128 *d2 = [[RLMDecimal128 alloc] initWithString:@\"3.14160\"];\n    XCTAssertTrue([d1 isLessThan:d2]);\n}\n\n- (void)testDecimal128InitializationLessThanEquals {\n    RLMDecimal128 *d1 = [[RLMDecimal128 alloc] initWithNumber:@3.14159];\n    RLMDecimal128 *d2 = [[RLMDecimal128 alloc] initWithString:@\"3.14160\"];\n    RLMDecimal128 *d3 = [[RLMDecimal128 alloc] initWithString:@\"3.14160\"];\n    XCTAssertTrue([d1 isLessThanOrEqualTo:d2]);\n    XCTAssertTrue([d2 isLessThanOrEqualTo:d3]);\n}\n\n#pragma mark - Miscellaneous\n\n- (void)testNaN {\n    RLMDecimal128 *nan = [[RLMDecimal128 alloc] initWithValue:[NSNull null]];\n    XCTAssertTrue(nan.isNaN);\n}\n\n- (void)testMinimumMaximumValue {\n    RLMDecimal128 *min = RLMDecimal128.minimumDecimalNumber;\n    RLMDecimal128 *max = RLMDecimal128.maximumDecimalNumber;\n    XCTAssertTrue([min isLessThan:max]);\n    XCTAssertTrue([max isGreaterThan:min]);\n}\n\n- (void)testMagnitude {\n    RLMDecimal128 *d1 = [[RLMDecimal128 alloc] initWithNumber:@-123.321];\n    RLMDecimal128 *exp1 = [RLMDecimal128 decimalWithNumber:@123.321];\n    RLMDecimal128 *d2 = [[RLMDecimal128 alloc] initWithNumber:@456.321];\n    RLMDecimal128 *exp2 = [RLMDecimal128 decimalWithNumber:@456.321];\n    XCTAssertTrue([d1.magnitude isEqual:exp1]);\n    XCTAssertTrue([d2.magnitude isEqual:exp2]);\n}\n\n- (void)testNegate {\n    RLMDecimal128 *d1 = [[RLMDecimal128 alloc] initWithNumber:@-123.321];\n    RLMDecimal128 *exp1 = [RLMDecimal128 decimalWithNumber:@123.321];\n    RLMDecimal128 *d2 = [[RLMDecimal128 alloc] initWithNumber:@456.321];\n    RLMDecimal128 *exp2 = [RLMDecimal128 decimalWithNumber:@-456.321];\n    [d1 negate];\n    [d2 negate];\n    XCTAssertTrue([d1 isEqual:exp1]);\n    XCTAssertTrue([d2 isEqual:exp2]);\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/DictionaryPropertyTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n@interface DictionaryPropertyTests : RLMTestCase\n@end\n\n@implementation DogDictionaryObject\n@end\n    \n@implementation DictionaryPropertyTests\n\n- (void)testPopulateEmptyDictionary {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    DictionaryPropertyObject *dict = [DictionaryPropertyObject createInRealm:realm withValue:@[@{}, @{}]];\n    XCTAssertNotNil(dict.stringDictionary, @\"Should be able to get an empty dictionary\");\n    XCTAssertEqual(dict.stringDictionary.count, 0U, @\"Should start with no dictionary elements\");\n\n    StringObject *obj = [[StringObject alloc] init];\n    obj.stringCol = @\"a\";\n\n    dict.stringDictionary[@\"one\"] = obj;\n    dict.stringDictionary[@\"two\"] = [StringObject createInRealm:realm withValue:@[@\"b\"]];\n    dict.stringDictionary[@\"three\"] = obj;\n\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(dict.stringDictionary.count, 3U, @\"Should have three elements in the dictionary\");\n    XCTAssertEqualObjects([dict.stringDictionary[@\"one\"] stringCol], @\"a\", @\"First element should have property value 'a'\");\n    XCTAssertEqualObjects([dict.stringDictionary[@\"two\"] stringCol], @\"b\", @\"Second element should have property value 'b'\");\n    XCTAssertEqualObjects([dict.stringDictionary[@\"three\"] stringCol], @\"a\", @\"Third element should have property value 'a'\");\n\n    RLMDictionary *dictionaryProp = dict.stringDictionary;\n    RLMAssertThrowsWithReasonMatching([dictionaryProp setObject:obj forKey:@\"four\"], @\"write transaction\");\n\n    for (NSString *key in dictionaryProp) {\n        XCTAssertTrue(((RLMDictionary *)dictionaryProp[key]).description.length, @\"Object should have description\");\n    }\n}\n\n- (void)testKeyType {\n    DictionaryPropertyObject *unmanaged = [[DictionaryPropertyObject alloc] init];\n    XCTAssertEqual(unmanaged.intDictionary.keyType, RLMPropertyTypeString);\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    DictionaryPropertyObject *managed = [DictionaryPropertyObject createInRealm:realm withValue:@[]];\n    [realm commitWriteTransaction];\n    XCTAssertEqual(managed.intDictionary.keyType, RLMPropertyTypeString);\n}\n\n-(void)testModifyDetatchedDictionary {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    DictionaryPropertyObject *dictObj = [DictionaryPropertyObject createInRealm:realm withValue:@[]];\n    XCTAssertNotNil(dictObj.stringDictionary, @\"Should be able to get an empty dictionary\");\n    XCTAssertEqual(dictObj.stringDictionary.count, 0U, @\"Should start with no dictionary elements\");\n\n    StringObject *obj = [[StringObject alloc] init];\n    obj.stringCol = @\"a\";\n    RLMDictionary *dict = dictObj.stringDictionary;\n    dict[@\"one\"] = obj;\n    [dict setObject:[StringObject createInRealm:realm withValue:@[@\"b\"]] forKey:@\"two\"];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(dictObj.stringDictionary.count, 2U, @\"Should have two elements in dictionary\");\n    XCTAssertEqualObjects([dictObj.stringDictionary[@\"one\"] stringCol], @\"a\", @\"First element should have property value 'a'\");\n    XCTAssertEqualObjects([dictObj.stringDictionary[@\"two\"] stringCol], @\"b\", @\"Second element should have property value 'b'\");\n\n    RLMAssertThrowsWithReasonMatching([dictObj.stringDictionary setObject:obj forKey:@\"one\"], @\"write transaction\");\n}\n\n- (void)testDeleteUnmanagedObjectWithDictionaryProperty {\n    DictionaryPropertyObject *dictObj = [[DictionaryPropertyObject alloc] initWithValue:@[]];\n    RLMDictionary *stringDictionary = dictObj.stringDictionary;\n    XCTAssertFalse(stringDictionary.isInvalidated, @\"stringDictionary should be valid after creation.\");\n    dictObj = nil;\n    XCTAssertFalse(stringDictionary.isInvalidated, @\"stringDictionary should still be valid after parent deletion.\");\n}\n\n- (void)testDeleteObjectWithDictionaryProperty {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    DictionaryPropertyObject *dictObj = [DictionaryPropertyObject createInRealm:realm withValue:@[]];\n    RLMDictionary *dictionary = dictObj.stringDictionary;\n    XCTAssertFalse(dictionary.isInvalidated, @\"dictionary should be valid after creation.\");\n    [realm deleteObject:dictObj];\n    XCTAssertTrue(dictionary.isInvalidated, @\"dictionary should be invalid after parent deletion.\");\n    [realm commitWriteTransaction];\n}\n\n- (void)testDeleteObjectInDictionaryProperty {\n    RLMRealm *realm = [self realmWithTestPath];\n    StringObject *obj = [[StringObject alloc] init];\n    [realm beginWriteTransaction];\n    DictionaryPropertyObject *dictObj = [DictionaryPropertyObject createInRealm:realm withValue: @{@\"stringDictionary\": @{@\"one\": obj}}];\n    RLMDictionary *stringDictionary = dictObj.stringDictionary;\n    StringObject *one = stringDictionary[@\"one\"];\n    [realm deleteObjects:[StringObject allObjectsInRealm:realm]];\n    XCTAssertFalse(stringDictionary.isInvalidated, @\"stringDictionary should be valid after member object deletion.\");\n    XCTAssertTrue(one.isInvalidated, @\"firstObject should be invalid after deletion.\");\n    XCTAssertEqual(stringDictionary.count, 1U, @\"stringDictionary.count should be one as it holds onto the invalidated object.\");\n    [realm commitWriteTransaction];\n}\n\n-(void)testKeyedSubscript {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    DictionaryPropertyObject *obj = [DictionaryPropertyObject createInRealm:realm withValue:@[]];\n    StringObject *child1 = [StringObject createInRealm:realm withValue:@[@\"a\"]];\n    StringObject *child2 = [[StringObject alloc] init];\n    StringObject *child3 = [StringObject createInRealm:realm withValue:@[@\"c\"]];\n\n    obj.stringDictionary[@\"one\"] = child1;\n    XCTAssertTrue([[obj.stringDictionary[@\"one\"] stringCol] isEqualToString:@\"a\"]);\n    obj.stringDictionary[@\"two\"] = child2;\n    XCTAssertNil([obj.stringDictionary[@\"two\"] stringCol]);\n    // reassign\n    obj.stringDictionary[@\"two\"] = child3;\n    XCTAssertTrue([[obj.stringDictionary[@\"two\"] stringCol] isEqualToString:@\"c\"]);\n    [realm commitWriteTransaction];\n}\n\n-(void)testRemoveObject {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    DictionaryPropertyObject *obj = [DictionaryPropertyObject createInRealm:realm withValue:@[]];\n    StringObject *child1 = [StringObject createInRealm:realm withValue:@[@\"a\"]];\n    StringObject *child2 = [[StringObject alloc] init];\n    StringObject *child3 = [StringObject createInRealm:realm withValue:@[@\"c\"]];\n\n    obj.stringDictionary[@\"one\"] = child1;\n    XCTAssertTrue([[obj.stringDictionary[@\"one\"] stringCol] isEqualToString:@\"a\"]);\n    obj.stringDictionary[@\"two\"] = child2;\n    XCTAssertNil([obj.stringDictionary[@\"two\"] stringCol]);\n    // reassign\n    obj.stringDictionary[@\"two\"] = child3;\n    XCTAssertTrue([[obj.stringDictionary[@\"two\"] stringCol] isEqualToString:@\"c\"]);\n    [realm commitWriteTransaction];\n    [realm beginWriteTransaction];\n    [obj.stringDictionary removeObjectForKey:@\"one\"];\n    XCTAssertNil(obj.stringDictionary[@\"one\"]);\n    [obj.stringDictionary removeObjectForKey:@\"two\"];\n    XCTAssertNil(obj.stringDictionary[@\"two\"]);\n    obj.stringDictionary[@\"three\"] = child3;\n    XCTAssertTrue([[obj.stringDictionary[@\"three\"] stringCol] isEqualToString:@\"c\"]);\n    [obj.stringDictionary removeAllObjects];\n    XCTAssertNil(obj.stringDictionary[@\"three\"]);\n\n    obj.stringDictionary[@\"one\"] = child1;\n    XCTAssertNotNil(obj.stringDictionary[@\"one\"]);\n    obj.stringDictionary[@\"two\"] = child2;\n    XCTAssertNotNil(obj.stringDictionary[@\"two\"]);\n    [obj.stringDictionary removeObjectsForKeys:@[@\"one\", @\"two\"]];\n    XCTAssertNil(obj.stringDictionary[@\"one\"]);\n    XCTAssertNil(obj.stringDictionary[@\"two\"]);\n    \n    obj.stringDictionary[@\"one\"] = child1;\n    XCTAssertNotNil(obj.stringDictionary[@\"one\"]);\n    obj.stringDictionary[@\"one\"] = nil;\n    XCTAssertNil(obj.stringDictionary[@\"one\"]);\n\n    [realm commitWriteTransaction];\n}\n\n-(void)testAddInvalidated {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    CompanyObject *company = [CompanyObject createInDefaultRealmWithValue:@[@\"company\", @[]]];\n    EmployeeObject *person = [[EmployeeObject alloc] init];\n    person.name = @\"Mary\";\n    [realm addObject:person];\n    [realm deleteObjects:[EmployeeObject allObjects]];\n    RLMAssertThrowsWithReasonMatching([company.employeeDict setObject:person forKey:@\"person1\"], @\"invalidated\");\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAddNil {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    CompanyObject *company = [CompanyObject createInDefaultRealmWithValue:@[@\"company\", @[]]];\n    RLMAssertThrowsWithReason([company.employeeDict setObject:self.nonLiteralNil forKey:@\"blah\"],\n                              @\"Must provide a non-nil value.\");\n    [realm cancelWriteTransaction];\n}\n\n- (void)testUnmanaged {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    DictionaryPropertyObject *dict = [[DictionaryPropertyObject alloc] init];\n    XCTAssertNotNil(dict.stringDictionary, @\"RLMDictionary property should get created on access\");\n\n    XCTAssertEqual(dict.stringDictionary.allValues.count, 0U, @\"No objects added yet\");\n    XCTAssertEqual(dict.stringDictionary.allKeys.count, 0U, @\"No objects added yet\");\n\n    StringObject *obj1 = [[StringObject alloc] init];\n    obj1.stringCol = @\"a\";\n    StringObject *obj2 = [[StringObject alloc] init];\n    obj2.stringCol = @\"b\";\n    StringObject *obj3 = [[StringObject alloc] init];\n    obj3.stringCol = @\"c\";\n    dict.stringDictionary[@\"one\"] = obj1;\n    dict.stringDictionary[@\"two\"] = obj2;\n    dict.stringDictionary[@\"three\"] = obj3;\n\n    XCTAssertEqual(dict.stringDictionary.allValues.count, 3U);\n    XCTAssertEqual(dict.stringDictionary.allKeys.count, 3U);\n\n    XCTAssertEqualObjects(dict.stringDictionary[@\"one\"], obj1, @\"Objects should be equal\");\n    XCTAssertEqualObjects(dict.stringDictionary[@\"three\"], obj3, @\"Objects should be equal\");\n    XCTAssertEqualObjects(dict.stringDictionary.allValues[1], obj2, @\"Objects should be equal\");\n\n    [realm beginWriteTransaction];\n    [realm addObject:dict];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(dict.stringDictionary.allValues.count, 3U);\n    XCTAssertEqual(dict.stringDictionary.allKeys.count, 3U);\n\n    XCTAssertEqual(dict.stringDictionary.count, 3U, @\"Should have two elements in dictionary\");\n    XCTAssertEqualObjects([dict.stringDictionary[@\"one\"] stringCol], @\"a\", @\"First element should have property value 'a'\");\n    XCTAssertEqualObjects([dict.stringDictionary[@\"two\"] stringCol], @\"b\", @\"Second element should have property value 'b'\");\n\n    [realm beginWriteTransaction];\n    dict.stringDictionary[@\"one\"] = obj3;\n    XCTAssertTrue([dict.stringDictionary[@\"one\"] isEqualToObject:obj3], @\"Objects should be replaced\");\n    dict.stringDictionary[@\"one\"] = obj1;\n    XCTAssertTrue([obj1 isEqualToObject:dict.stringDictionary[@\"one\"]], @\"Objects should be replaced\");\n    [dict.stringDictionary removeObjectForKey:@\"one\"];\n    XCTAssertEqual(dict.stringDictionary.count, 2U, @\"2 objects left\");\n    [dict.stringDictionary removeAllObjects];\n    XCTAssertEqual(dict.stringDictionary.count, 0U, @\"All objects removed\");\n    [realm commitWriteTransaction];\n\n    DictionaryPropertyObject *intDictionary = [[DictionaryPropertyObject alloc] init];\n    IntObject *intObj = [[IntObject alloc] init];\n    intObj.intCol = 1;\n    [intDictionary.intObjDictionary setObject:intObj forKey:@\"one\"];\n    [intDictionary.intObjDictionary setObject:intObj forKey:@\"two\"];\n\n    XCTAssertThrows([intDictionary.intObjDictionary objectsWhere:@\"intCol == 1\"], @\"Should throw on unmanaged RLMDictionary\");\n    XCTAssertThrows(([intDictionary.intObjDictionary objectsWithPredicate:[NSPredicate predicateWithFormat:@\"intCol == %i\", 1]]), @\"Should throw on unmanaged RLMDictionary\");\n    XCTAssertThrows([intDictionary.intObjDictionary sortedResultsUsingKeyPath:@\"intCol\" ascending:YES], @\"Should throw on unmanaged RLMDictionary\");\n\n    // test unmanaged with literals\n    __unused DictionaryPropertyObject *obj = [[DictionaryPropertyObject alloc] initWithValue:@[@{}, @{}, @{}, @{@\"one\": [[IntObject alloc] initWithValue:@[@1]]}]];\n}\n\n- (void)testUnmanagedComparision {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    DictionaryPropertyObject *dict = [[DictionaryPropertyObject alloc] init];\n    DictionaryPropertyObject *dict2 = [[DictionaryPropertyObject alloc] init];\n\n    XCTAssertNotNil(dict.stringDictionary, @\"RLMDictionary property should get created on access\");\n    XCTAssertNotNil(dict2.stringDictionary, @\"RLMDictionary property should get created on access\");\n    XCTAssertTrue([dict.stringDictionary isEqual:dict2.stringDictionary], @\"Empty dictionaries should be equal\");\n\n    XCTAssertEqual(dict.stringDictionary.count, 0U);\n    XCTAssertEqual(dict2.stringDictionary.count, 0U);\n\n    StringObject *obj1 = [[StringObject alloc] init];\n    obj1.stringCol = @\"a\";\n    StringObject *obj2 = [[StringObject alloc] init];\n    obj2.stringCol = @\"b\";\n    StringObject *obj3 = [[StringObject alloc] init];\n    obj3.stringCol = @\"c\";\n    [dict.stringDictionary setObject:obj1 forKey:@\"one\"];\n    dict.stringDictionary[@\"two\"] = obj2;\n    [dict.stringDictionary setObject:obj3 forKey:@\"three\"];\n\n    [dict2.stringDictionary setObject:obj1 forKey:@\"one\"];\n    dict2.stringDictionary[@\"two\"] = obj2;\n    [dict2.stringDictionary setObject:obj3 forKey:@\"three\"];\n\n    XCTAssertTrue([dict.stringDictionary isEqual:dict2.stringDictionary], @\"Dictionaries should be equal\");\n    [dict2.stringDictionary removeObjectForKey:@\"three\"];\n    XCTAssertFalse([dict.stringDictionary isEqual:dict2.stringDictionary], @\"Dictionaries should not be equal\");\n    dict2.stringDictionary[@\"three\"] = obj3;\n    XCTAssertTrue([dict.stringDictionary isEqual:dict2.stringDictionary], @\"Dictionaries should be equal\");\n\n    [realm beginWriteTransaction];\n    [realm addObject:dict];\n    [realm commitWriteTransaction];\n\n    XCTAssertFalse([dict.stringDictionary isEqual:dict2.stringDictionary], @\"Comparing a managed dictionary to an unmanaged one should fail\");\n    XCTAssertFalse([dict2.stringDictionary isEqual:dict.stringDictionary], @\"Comparing a managed dictionary to an unmanaged one should fail\");\n}\n\n- (void)testUnmanagedPrimitive {\n    AllPrimitiveDictionaries *obj = [[AllPrimitiveDictionaries alloc] init];\n    XCTAssertTrue([obj.intObj isKindOfClass:[RLMDictionary class]]);\n    XCTAssertTrue([obj.floatObj isKindOfClass:[RLMDictionary class]]);\n    XCTAssertTrue([obj.doubleObj isKindOfClass:[RLMDictionary class]]);\n    XCTAssertTrue([obj.boolObj isKindOfClass:[RLMDictionary class]]);\n    XCTAssertTrue([obj.stringObj isKindOfClass:[RLMDictionary class]]);\n    XCTAssertTrue([obj.dataObj isKindOfClass:[RLMDictionary class]]);\n    XCTAssertTrue([obj.dateObj isKindOfClass:[RLMDictionary class]]);\n    XCTAssertTrue([obj.uuidObj isKindOfClass:[RLMDictionary class]]);\n\n    [obj.intObj setObject:@1 forKey:@\"one\"];\n    XCTAssertEqualObjects(obj.intObj[@\"one\"], @1);\n    id nilValue;\n    XCTAssertThrows([obj.intObj setObject:nilValue forKey:@\"one\"]);\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    obj = [AllPrimitiveDictionaries createInRealm:realm withValue:@[]];\n\n    XCTAssertTrue([obj.intObj isKindOfClass:[RLMDictionary class]]);\n    XCTAssertTrue([obj.floatObj isKindOfClass:[RLMDictionary class]]);\n    XCTAssertTrue([obj.doubleObj isKindOfClass:[RLMDictionary class]]);\n    XCTAssertTrue([obj.boolObj isKindOfClass:[RLMDictionary class]]);\n    XCTAssertTrue([obj.stringObj isKindOfClass:[RLMDictionary class]]);\n    XCTAssertTrue([obj.dataObj isKindOfClass:[RLMDictionary class]]);\n    XCTAssertTrue([obj.dateObj isKindOfClass:[RLMDictionary class]]);\n    XCTAssertTrue([obj.uuidObj isKindOfClass:[RLMDictionary class]]);\n\n    obj.intObj[@\"two\"] = @2;\n    XCTAssertEqualObjects(obj.intObj[@\"two\"], @2);\n    [realm cancelWriteTransaction];\n}\n\n- (void)testDeleteObjectInUnmanagedDictionary {\n    DictionaryPropertyObject *dict = [[DictionaryPropertyObject alloc] init];\n\n    StringObject *stringObj1 = [[StringObject alloc] init];\n    stringObj1.stringCol = @\"a\";\n    StringObject *stringObj2 = [[StringObject alloc] init];\n    stringObj2.stringCol = @\"b\";\n    StringObject *stringObj3 = [[StringObject alloc] init];\n    stringObj3.stringCol = @\"c\";\n    dict.stringDictionary[@\"one\"] = stringObj1;\n    dict.stringDictionary[@\"two\"] = stringObj2;\n    [dict.stringDictionary setObject:stringObj3 forKey:@\"three\"];\n\n    IntObject *intObj1 = [[IntObject alloc] init];\n    intObj1.intCol = 0;\n    IntObject *intObj2 = [[IntObject alloc] init];\n    intObj2.intCol = 1;\n    IntObject *intObj3 = [[IntObject alloc] init];\n    intObj3.intCol = 2;\n    dict.intObjDictionary[@\"one\"] = intObj1;\n    dict.intObjDictionary[@\"two\"] = intObj2;\n    [dict.intObjDictionary setObject:intObj3 forKey:@\"three\"];\n\n    XCTAssertEqualObjects(dict.stringDictionary[@\"one\"], stringObj1, @\"Objects should be equal\");\n    XCTAssertEqualObjects([dict.stringDictionary objectForKey:@\"two\"], stringObj2, @\"Objects should be equal\");\n    XCTAssertEqualObjects(dict.stringDictionary[@\"three\"], stringObj3, @\"Objects should be equal\");\n    XCTAssertEqual(dict.stringDictionary.count, 3U, @\"Should have 3 elements in string dictionary\");\n\n    XCTAssertEqualObjects(dict.intObjDictionary[@\"one\"], intObj1, @\"Objects should be equal\");\n    XCTAssertEqualObjects([dict.intObjDictionary objectForKey:@\"two\"], intObj2, @\"Objects should be equal\");\n    XCTAssertEqualObjects(dict.intObjDictionary[@\"three\"], intObj3, @\"Objects should be equal\");\n    XCTAssertEqual(dict.intObjDictionary.count, 3U, @\"Should have 3 elements in int dictionary\");\n\n    [dict.stringDictionary removeObjectForKey:@\"three\"];\n\n    XCTAssertEqualObjects(dict.stringDictionary[@\"one\"], stringObj1, @\"Objects should be equal\");\n    XCTAssertEqualObjects([dict.stringDictionary objectForKey:@\"two\"], stringObj2, @\"Objects should be equal\");\n    XCTAssertEqual(dict.stringDictionary.count, 2U, @\"Should have 2 elements in string dictionary\");\n\n    [dict.stringDictionary removeObjectForKey:@\"three\"]; // already deleted\n\n    [dict.stringDictionary removeObjectForKey:@\"two\"];\n\n    XCTAssertEqualObjects(dict.stringDictionary[@\"one\"], stringObj1, @\"Objects should be equal\");\n    XCTAssertEqualObjects([dict.stringDictionary objectForKey:@\"one\"], stringObj1, @\"Objects should be equal\");\n    XCTAssertEqual(dict.stringDictionary.count, 1U, @\"Should have 1 elements in string dictionary\");\n\n    [dict.stringDictionary removeAllObjects];\n\n    XCTAssertEqual(dict.stringDictionary.count, 0U, @\"Should have 0 elements in string dictionary\");\n\n    [dict.intDictionary removeObjectsForKeys:@[@\"one\", @\"two\", @\"three\"]];\n    XCTAssertEqual(dict.intDictionary.count, 0U, @\"Should have 0 elements in int dictionary\");\n}\n\n- (void)testFastEnumeration {\n    RLMRealm *realm = self.realmWithTestPath;\n\n    [realm beginWriteTransaction];\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n    [realm addObject:company];\n    [realm commitWriteTransaction];\n\n    // enumerate empty dictionary\n    for (__unused id obj in company.employeeDict) {\n        XCTFail(@\"Should be empty\");\n    }\n\n    [company.employeeDict enumerateKeysAndObjectsUsingBlock:^(__unused id  _Nonnull key,\n                                                              __unused id _Nonnull value,\n                                                              __unused BOOL * _Nonnull stop) {\n        XCTFail(@\"Should be empty\");\n    }];\n\n    [realm beginWriteTransaction];\n    for (int i = 0; i < 30; ++i) {\n        EmployeeObject *eo = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES}];\n        NSString *key = [NSString stringWithFormat:@\"item%d\", i];\n        company.employeeDict[key] = eo;\n    }\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(company.employeeDict.count, 30U);\n\n    NSInteger count = 0;\n    for (id key in company.employeeDict) {\n        XCTAssertNotNil(key, @\"Object is not nil and accessible\");\n        count++;\n    }\n\n    XCTAssertEqual(count, 30, @\"should have enumerated 30 objects\");\n\n    [company.employeeDict enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key,\n                                                              EmployeeObject * _Nonnull obj,\n                                                              __unused BOOL * _Nonnull stop) {\n        XCTAssertEqualObjects([company.employeeDict[key] name], [obj name]);\n        XCTAssertEqual(((EmployeeObject *)company.employeeDict[key]).age, [obj age]);\n        XCTAssertEqual([company.employeeDict[key] hired], [obj hired]);\n    }];\n}\n\n- (void)testDeleteDuringEnumeration {\n    RLMRealm *realm = self.realmWithTestPath;\n\n    [realm beginWriteTransaction];\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n    [realm addObject:company];\n\n    const size_t totalCount = 40;\n    for (size_t i = 0; i < totalCount; ++i) {\n        NSString *key = [NSString stringWithFormat:@\"item%zu\", i];\n        company.employeeDict[key] = [EmployeeObject createInRealm:realm withValue:@[@\"name\", @(i), @NO]];\n    }\n\n    [realm commitWriteTransaction];\n\n    [realm beginWriteTransaction];\n    for (NSString *key in company.employeeDict) {\n        [realm deleteObject:company.employeeDict[key]];\n    }\n    [realm commitWriteTransaction];\n\n    [realm beginWriteTransaction];\n    for (size_t i = 0; i < totalCount; ++i) {\n        NSString *key = [NSString stringWithFormat:@\"item%zu\", i];\n        company.employeeDict[key] = [EmployeeObject createInRealm:realm withValue:@[@\"name\", @(i), @NO]];\n    }\n    [realm commitWriteTransaction];\n\n    [realm beginWriteTransaction];\n    [company.employeeDict enumerateKeysAndObjectsUsingBlock:^(__unused id _Nonnull key,\n                                                              __unused id _Nonnull obj,\n                                                              __unused BOOL * _Nonnull stop) {\n        [realm deleteObjects:company.employees];\n    }];\n    [realm commitWriteTransaction];\n}\n\n- (void)testValueForKey {\n    // unmanaged\n    DictionaryPropertyObject *unmanObj = [DictionaryPropertyObject new];\n    StringObject *unmanChild1 = [[StringObject alloc] initWithValue:@[@\"a\"]];\n    EmbeddedIntObject *unmanChild2 = [[EmbeddedIntObject alloc] initWithValue:@[@123]];\n\n    [unmanObj.stringDictionary setValue:unmanChild1 forKey:@\"one\"];\n    XCTAssertTrue([[unmanObj.stringDictionary valueForKey:@\"one\"][@\"stringCol\"] isEqualToString:unmanChild1.stringCol]);\n\n    [unmanObj.embeddedDictionary setValue:unmanChild2 forKey:@\"two\"];\n    XCTAssertEqual([[unmanObj.embeddedDictionary valueForKey:@\"two\"][@\"intCol\"] integerValue], unmanChild2.intCol);\n\n    unmanObj.intDictionary[@\"one\"] = @1;\n    XCTAssertEqualObjects([unmanObj.intDictionary valueForKey:@\"invalidated\"], @NO);\n\n    // managed\n    RLMRealm *realm = [self realmWithTestPath];\n    [realm beginWriteTransaction];\n    DictionaryPropertyObject *obj = [DictionaryPropertyObject createInRealm:realm withValue:@[]];\n    StringObject *child1 = [StringObject createInRealm:realm withValue:@[@\"a\"]];\n    EmbeddedIntObject *child2 = [[EmbeddedIntObject alloc] initWithValue:@[@123]];\n\n    [obj.stringDictionary setValue:child1 forKey:@\"one\"];\n    XCTAssertTrue([[obj.stringDictionary valueForKey:@\"one\"][@\"stringCol\"] isEqualToString:child1.stringCol]);\n\n    [obj.embeddedDictionary setValue:child2 forKey:@\"two\"];\n    XCTAssertEqual([[obj.embeddedDictionary valueForKey:@\"two\"][@\"intCol\"] integerValue], child2.intCol);\n\n    [realm commitWriteTransaction];\n    XCTAssertEqualObjects([obj.stringDictionary valueForKey:@\"invalidated\"], @NO);\n}\n\n- (void)testObjectAggregate {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    AggregateDictionaryObject *obj = [AggregateDictionaryObject new];\n    XCTAssertEqual(0, [obj.dictionary sumOfProperty:@\"intCol\"].intValue);\n    XCTAssertNil([obj.dictionary averageOfProperty:@\"intCol\"]);\n    XCTAssertNil([obj.dictionary minOfProperty:@\"intCol\"]);\n    XCTAssertNil([obj.dictionary maxOfProperty:@\"intCol\"]);\n\n    NSDate *dateMinInput = [NSDate date];\n    NSDate *dateMaxInput = [dateMinInput dateByAddingTimeInterval:1000];\n\n    [realm transactionWithBlock:^{\n        [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n        [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n        [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n        [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n        [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n        [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n        [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n        [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n        [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n        [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n\n        RLMResults<AggregateObject *> *allObjects = [AggregateObject allObjectsInRealm:realm];\n        for (NSUInteger i = 0; i < allObjects.count; i++) {\n            NSString *key = [NSString stringWithFormat:@\"item%lu\", (unsigned long)i];\n            obj.dictionary[key] = allObjects[i];\n        }\n    }];\n\n    void (^test)(void) = ^{\n        RLMDictionary *dictionary = obj.dictionary;\n\n        // SUM\n        XCTAssertEqual([dictionary sumOfProperty:@\"intCol\"].integerValue, 4);\n        XCTAssertEqualWithAccuracy([dictionary sumOfProperty:@\"floatCol\"].floatValue, 7.2f, 0.1f);\n        XCTAssertEqualWithAccuracy([dictionary sumOfProperty:@\"doubleCol\"].doubleValue, 10.0, 0.1f);\n        RLMAssertThrowsWithReasonMatching([dictionary sumOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n        RLMAssertThrowsWithReasonMatching([dictionary sumOfProperty:@\"boolCol\"], @\"sum.*bool\");\n        RLMAssertThrowsWithReasonMatching([dictionary sumOfProperty:@\"dateCol\"], @\"sum.*date\");\n\n        // Average\n        XCTAssertEqualWithAccuracy([dictionary averageOfProperty:@\"intCol\"].doubleValue, 0.4, 0.1f);\n        XCTAssertEqualWithAccuracy([dictionary averageOfProperty:@\"floatCol\"].doubleValue, 0.72, 0.1f);\n        XCTAssertEqualWithAccuracy([dictionary averageOfProperty:@\"doubleCol\"].doubleValue, 1.0, 0.1f);\n        RLMAssertThrowsWithReasonMatching([dictionary averageOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n        RLMAssertThrowsWithReasonMatching([dictionary averageOfProperty:@\"boolCol\"], @\"average.*bool\");\n        RLMAssertThrowsWithReasonMatching([dictionary averageOfProperty:@\"dateCol\"], @\"average.*date\");\n\n        // MIN\n        XCTAssertEqual(0, [[dictionary minOfProperty:@\"intCol\"] intValue]);\n        XCTAssertEqual(0.0f, [[dictionary minOfProperty:@\"floatCol\"] floatValue]);\n        XCTAssertEqual(0.0, [[dictionary minOfProperty:@\"doubleCol\"] doubleValue]);\n        XCTAssertEqualObjects(dateMinInput, [dictionary minOfProperty:@\"dateCol\"]);\n        RLMAssertThrowsWithReasonMatching([dictionary minOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n        RLMAssertThrowsWithReasonMatching([dictionary minOfProperty:@\"boolCol\"], @\"min.*bool\");\n\n        // MAX\n        XCTAssertEqual(1, [[dictionary maxOfProperty:@\"intCol\"] intValue]);\n        XCTAssertEqual(1.2f, [[dictionary maxOfProperty:@\"floatCol\"] floatValue]);\n        XCTAssertEqual(2.5, [[dictionary maxOfProperty:@\"doubleCol\"] doubleValue]);\n        XCTAssertEqualObjects(dateMaxInput, [dictionary maxOfProperty:@\"dateCol\"]);\n        RLMAssertThrowsWithReasonMatching([dictionary maxOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n        RLMAssertThrowsWithReasonMatching([dictionary maxOfProperty:@\"boolCol\"], @\"max.*bool\");\n    };\n\n    test();\n    [realm transactionWithBlock:^{ [realm addObject:obj]; }];\n    test();\n}\n\n- (void)testRenamedPropertyAggregate {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    LinkToRenamedProperties1 *obj = [LinkToRenamedProperties1 new];\n    XCTAssertEqual(0, [obj.dictionary sumOfProperty:@\"propA\"].intValue);\n    XCTAssertNil([obj.dictionary averageOfProperty:@\"propA\"]);\n    XCTAssertNil([obj.dictionary minOfProperty:@\"propA\"]);\n    XCTAssertNil([obj.dictionary maxOfProperty:@\"propA\"]);\n    XCTAssertThrows([obj.dictionary sumOfProperty:@\"prop 1\"]);\n\n    [realm transactionWithBlock:^{\n        [RenamedProperties1 createInRealm:realm withValue:@[@1, @\"\"]];\n        [RenamedProperties1 createInRealm:realm withValue:@[@2, @\"\"]];\n        [RenamedProperties1 createInRealm:realm withValue:@[@3, @\"\"]];\n\n        RLMResults<RenamedProperties1 *> *allObjects = [RenamedProperties1 allObjectsInRealm:realm];\n        for (NSUInteger i = 0; i < allObjects.count; i++) {\n            NSString *key = [NSString stringWithFormat:@\"item%lu\", (unsigned long)i];\n            obj.dictionary[key] = allObjects[i];\n        }\n    }];\n\n    XCTAssertEqual(6, [obj.dictionary sumOfProperty:@\"propA\"].intValue);\n    XCTAssertEqual(2.0, [obj.dictionary averageOfProperty:@\"propA\"].doubleValue);\n    XCTAssertEqual(1, [[obj.dictionary minOfProperty:@\"propA\"] intValue]);\n    XCTAssertEqual(3, [[obj.dictionary maxOfProperty:@\"propA\"] intValue]);\n\n    [realm transactionWithBlock:^{ [realm addObject:obj]; }];\n\n    XCTAssertEqual(6, [obj.dictionary sumOfProperty:@\"propA\"].intValue);\n    XCTAssertEqual(2.0, [obj.dictionary averageOfProperty:@\"propA\"].doubleValue);\n    XCTAssertEqual(1, [[obj.dictionary minOfProperty:@\"propA\"] intValue]);\n    XCTAssertEqual(3, [[obj.dictionary maxOfProperty:@\"propA\"] intValue]);\n}\n\n-(void)testRenamedPropertyObservation {\n    RLMRealm *realm = self.realmWithTestPath;\n\n    __block LinkToRenamedProperties *obj;\n    [realm transactionWithBlock:^{\n        obj = [LinkToRenamedProperties createInRealm:realm withValue:@[]];\n        RenamedProperties *linkedObject = [RenamedProperties createInRealm:realm withValue:@[@1, @\"\"]];\n        obj.dictionary[@\"item\"] = linkedObject;\n    }];\n\n    __block bool first = true;\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [obj.dictionary addNotificationBlock:^(RLMDictionary *dictionary, RLMDictionaryChange *change, NSError *error) {\n        XCTAssertNotNil(dictionary);\n        XCTAssert(first ? !change : !!change);\n        XCTAssertNil(error);\n        first = false;\n        [expectation fulfill];\n    } keyPaths:@[@\"stringCol\"]];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = self.realmWithTestPath;\n        [realm transactionWithBlock:^{\n            RLMDictionary *dict = [(LinkToRenamedProperties *)[LinkToRenamedProperties allObjectsInRealm:realm].firstObject dictionary];\n            RenamedProperties *property = dict[@\"item\"];\n            property.stringCol = @\"newValue\";\n        }];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n-(void)testInsertMultiple {\n    RLMRealm *realm = [self realmWithTestPath];\n    \n    [realm beginWriteTransaction];\n    DictionaryPropertyObject *obj = [DictionaryPropertyObject createInRealm:realm withValue: @{@\"stringDictionary\": @{}}];\n\n    StringObject *child1 = [StringObject createInRealm:realm withValue:@[@\"a\"]];\n    StringObject *child2 = [[StringObject alloc] init];\n    child2.stringCol = @\"b\";\n    [obj.stringDictionary setValuesForKeysWithDictionary:@{@\"a\": child1, @\"b\": child2}];\n    [realm commitWriteTransaction];\n    \n    RLMResults *children = [StringObject allObjectsInRealm:realm];\n    XCTAssertEqualObjects([children[0] stringCol], @\"a\", @\"First child should be 'a'\");\n    XCTAssertEqualObjects([children[1] stringCol], @\"b\", @\"Second child should be 'b'\");\n}\n\n- (void)testReplaceObjectInUnmanagedDictionary {\n    DictionaryPropertyObject *dict = [[DictionaryPropertyObject alloc] init];\n    \n    StringObject *stringObj1 = [[StringObject alloc] initWithValue:@{@\"stringCol\": @\"a\"}];\n    StringObject *stringObj2 = [[StringObject alloc] initWithValue:@{@\"stringCol\": @\"b\"}];\n    StringObject *stringObj3 = [[StringObject alloc] initWithValue:@{@\"stringCol\": @\"c\"}];\n    dict.stringDictionary[@\"a\"] = stringObj1;\n    dict.stringDictionary[@\"b\"] = stringObj2;\n    dict.stringDictionary[@\"c\"] = stringObj3;\n    \n    IntObject *intObj1 = [[IntObject alloc] initWithValue:@{@\"intCol\": @0}];\n    IntObject *intObj2 = [[IntObject alloc] initWithValue:@{@\"intCol\": @1}];\n    IntObject *intObj3 = [[IntObject alloc] initWithValue:@{@\"intCol\": @2}];\n    dict.intObjDictionary[@\"a\"] = intObj1;\n    dict.intObjDictionary[@\"b\"] = intObj2;\n    dict.intObjDictionary[@\"c\"] = intObj3;\n\n    XCTAssertEqualObjects(dict.stringDictionary[@\"a\"], stringObj1, @\"Objects should be equal\");\n    XCTAssertEqualObjects(dict.stringDictionary[@\"b\"], stringObj2, @\"Objects should be equal\");\n    XCTAssertEqualObjects(dict.stringDictionary[@\"c\"], stringObj3, @\"Objects should be equal\");\n    XCTAssertEqual(dict.stringDictionary.count, 3U, @\"Should have 3 elements in stringDictionary\");\n    \n    XCTAssertEqualObjects(dict.intObjDictionary[@\"a\"], intObj1, @\"Objects should be equal\");\n    XCTAssertEqualObjects(dict.intObjDictionary[@\"b\"], intObj2, @\"Objects should be equal\");\n    XCTAssertEqualObjects(dict.intObjDictionary[@\"c\"], intObj3, @\"Objects should be equal\");\n    XCTAssertEqual(dict.intObjDictionary.count, 3U, @\"Should have 3 elements in intDictionary\");\n    \n    StringObject *stringObj4 = [[StringObject alloc] initWithValue:@{@\"stringCol\": @\"d\"}];\n    \n    dict.stringDictionary[@\"a\"] = stringObj4;\n    \n    XCTAssertEqualObjects(dict.stringDictionary[@\"a\"], stringObj4, @\"Objects should be replaced\");\n    XCTAssertEqual(dict.stringDictionary.count, 3U, @\"Should have 3 elements in stringDictionary\");\n\n    IntObject *intObj4 = [[IntObject alloc] initWithValue:@{@\"intCol\": @3}];\n    \n    dict.intObjDictionary[@\"a\"] = intObj4;\n\n    XCTAssertEqualObjects(dict.intObjDictionary[@\"a\"], intObj4, @\"Objects should be replaced\");\n    XCTAssertEqual(dict.intObjDictionary.count, 3U, @\"Should have 3 elements in intDictionary\");\n    \n    RLMAssertThrowsWithReasonMatching([dict.stringDictionary setObject:(id)intObj4 forKey:@\"a\"],\n                                      @\"IntObject.*StringObject\");\n    RLMAssertThrowsWithReasonMatching([dict.intObjDictionary setObject:(id)stringObj4 forKey:@\"a\"],\n                                      @\"StringObject.*IntObject\");\n}\n\n- (void)testExchangeObjectForKeyWithObjectForKey {\n    \n    void (^test)(RLMDictionary *) = ^(RLMDictionary *dict) {\n        id obj = dict[@\"a\"];\n        dict[@\"a\"] = dict[@\"b\"];\n        dict[@\"b\"] = obj;\n        XCTAssertEqual(2U, dict.count);\n        XCTAssertEqualObjects(@\"b\", [dict[@\"a\"] stringCol]);\n        XCTAssertEqualObjects(@\"a\", [dict[@\"b\"] stringCol]);\n        \n        obj = dict[@\"a\"];\n        dict[@\"a\"] = dict[@\"b\"];\n        dict[@\"b\"] = obj;\n        XCTAssertEqual(2U, dict.count);\n        XCTAssertEqualObjects(@\"a\", [dict[@\"a\"] stringCol]);\n        XCTAssertEqualObjects(@\"b\", [dict[@\"b\"] stringCol]);\n    };\n    \n    DictionaryPropertyObject *dict = [[DictionaryPropertyObject alloc] initWithValue:@{@\"stringDictionary\": @{@\"a\": [[StringObject alloc] initWithValue:@{@\"stringCol\": @\"a\"}], @\"b\": [[StringObject alloc] initWithValue:@{@\"stringCol\": @\"b\"}]}}];\n\n    test(dict.stringDictionary);\n    \n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    [realm addObject:dict];\n    test(dict.stringDictionary);\n    [realm commitWriteTransaction];\n}\n\n- (void)testObjectForKey {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    \n    [realm beginWriteTransaction];\n    EmployeeObject *po1 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES}];\n    EmployeeObject *po2 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"John\", @\"age\": @30, @\"hired\": @NO}];\n    EmployeeObject *po3 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Jill\", @\"age\": @25, @\"hired\": @YES}];\n    EmployeeObject *deleted = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Jill\", @\"age\": @25, @\"hired\": @YES}];\n    EmployeeObject *indirectlyDeleted = [EmployeeObject allObjectsInRealm:realm].lastObject;\n    [realm deleteObject:deleted];\n    \n    // create company\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n    [company.employeeDict setObject:po1 forKey:@\"po1\"];\n    [company.employeeDict setObject:po2 forKey:@\"po2\"];\n    [company.employeeDict setObject:po3 forKey:@\"po3\"];\n    [company.employeeDict setObject:deleted forKey:@\"deleted\"];\n    \n    // test unmanaged\n    XCTAssertNotNil(company.employeeDict[@\"deleted\"]);\n    XCTAssertTrue(deleted.isInvalidated);\n    [company.employeeDict removeObjectForKey:@\"deleted\"];\n    \n    // add to realm\n    [realm addObject:company];\n    [realm commitWriteTransaction];\n    \n    // test LinkView\n    XCTAssertEqual(3U, company.employeeDict.count);\n    XCTAssertEqualObjects(po2.name, [company.employeeDict[@\"po2\"] name]);\n        \n    // invalid object\n    XCTAssertTrue(indirectlyDeleted.isInvalidated);\n    \n    RLMResults *employees = [company.employeeDict objectsWhere:@\"age = %@\", @40];\n    XCTAssertEqual(0U, [employees indexOfObject:po1]);\n    XCTAssertEqual((NSUInteger)NSNotFound, [employees indexOfObject:po3]);\n}\n\n- (void)testObjectWhere {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    \n    [realm beginWriteTransaction];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES}];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"John\", @\"age\": @30, @\"hired\": @NO}];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Jill\", @\"age\": @25, @\"hired\": @YES}];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Bill\", @\"age\": @55, @\"hired\": @YES}];\n    \n    // create company\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n    for(EmployeeObject *eo in [EmployeeObject allObjectsInRealm:realm]) {\n        company.employeeDict[eo.name] = eo;\n    }\n    \n    // test unmanaged\n    RLMAssertThrowsWithReasonMatching([company.employeeDict objectsWhere:@\"name = 'Jill'\"],\n                                      @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n\n    // add to realm\n    [realm addObject:company];\n    [realm commitWriteTransaction];\n    \n    // test LinkView RLMDictionary\n    XCTAssertEqualObjects(@\"Jill\", [[company.employeeDict objectsWhere:@\"name = 'Jill'\"].firstObject name]);\n    XCTAssertEqualObjects(@\"Joe\", [[company.employeeDict objectsWhere:@\"name = 'Joe'\"].firstObject name]);\n    XCTAssertEqual([company.employeeDict objectsWhere:@\"name = 'JoJo'\"].count, 0U);\n    \n    RLMResults *results = [company.employeeDict objectsWhere:@\"age > 30\"];\n    XCTAssertEqual(1U, [results indexOfObjectWhere:@\"name = 'Joe'\"]);\n    XCTAssertEqual(0U, [results indexOfObjectWhere:@\"name = 'Bill'\"]);\n    XCTAssertEqual((NSUInteger)NSNotFound, [results indexOfObjectWhere:@\"name = 'John'\"]);\n    XCTAssertEqual((NSUInteger)NSNotFound, [results indexOfObjectWhere:@\"name = 'Jill'\"]);\n}\n\n- (void)testSetValueForKey {\n    RLMRealm *realm = self.realmWithTestPath;\n    \n    [realm beginWriteTransaction];\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n\n    RLMAssertThrowsWithReasonMatching([company.employeeDict setValue:@\"name\" forKey:@\"name\"], @\"Value of type '__NSCFConstantString' does not match RLMDictionary value type 'EmployeeObject'.\");\n\n    EmployeeObject *e = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Jane\",  @\"age\": @(1), @\"hired\": @YES}];\n    [company.employeeDict setValue:e forKey:@\"e\"];\n    XCTAssertEqualObjects(((EmployeeObject *)[company.employeeDict valueForKey:@\"e\"]).name, @\"Jane\");\n\n    [realm addObject:company];\n    [realm commitWriteTransaction];\n    \n    XCTAssertThrows([company.employeeDict setValue:@{} forKey:@\"e2\"]);\n    XCTAssertNil([company.employeeDict valueForKey:@\"e2\"]);\n    \n    // managed\n    NSMutableArray *ages = [NSMutableArray array];\n    [realm beginWriteTransaction];\n    for (int i = 0; i < 30; ++i) {\n        [ages addObject:@(20)];\n        EmployeeObject *eo = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @(i), @\"hired\": @YES}];\n        company.employeeDict[[NSString stringWithFormat:@\"%d\", i]] = eo;\n    }\n    \n    [realm commitWriteTransaction];\n    EmployeeObject *o = [[EmployeeObject objectsInRealm:realm where:@\"name = 'Jane'\"] firstObject];\n    XCTAssertEqualObjects(((EmployeeObject *)[company.employeeDict valueForKey:@\"e\"]).name, o.name);\n    \n    // unmanaged object\n    company = [[CompanyObject alloc] init];\n    ages = [NSMutableArray array];\n    for (int i = 0; i < 30; ++i) {\n        [ages addObject:@(20)];\n        EmployeeObject *eo = [[EmployeeObject alloc] initWithValue:@{@\"name\": @\"Jamie\",  @\"age\": @(i), @\"hired\": @YES}];\n        company.employeeDict[[NSString stringWithFormat:@\"%d\", i]] = eo;\n    }\n\n    XCTAssertEqualObjects(((EmployeeObject *)[company.employeeDict valueForKey:@\"0\"]).name, @\"Jamie\");\n}\n\n- (void)testValueForCollectionOperationKeyPath {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    \n    [realm beginWriteTransaction];\n    EmployeeObject *e1 = [PrimaryEmployeeObject createInRealm:realm withValue:@{@\"name\": @\"A\", @\"age\": @20, @\"hired\": @YES}];\n    EmployeeObject *e2 = [PrimaryEmployeeObject createInRealm:realm withValue:@{@\"name\": @\"B\", @\"age\": @30, @\"hired\": @NO}];\n    EmployeeObject *e3 = [PrimaryEmployeeObject createInRealm:realm withValue:@{@\"name\": @\"C\", @\"age\": @40, @\"hired\": @YES}];\n    EmployeeObject *e4 = [PrimaryEmployeeObject createInRealm:realm withValue:@{@\"name\": @\"D\", @\"age\": @50, @\"hired\": @YES}];\n    PrimaryCompanyObject *c1 = [PrimaryCompanyObject createInRealm:realm withValue:@{@\"name\": @\"ABC AG\", @\"employeeDict\": @{@\"e1\": e1, @\"e2\": e2, @\"e3\": e3, @\"e4\": e2}, @\"employee\": @[], @\"employeeSet\": @[]}];\n    PrimaryCompanyObject *c2 = [PrimaryCompanyObject createInRealm:realm withValue:@{@\"name\": @\"ABC AG 2\", @\"employeeDict\": @{@\"e1\": e1, @\"e4\": e4}, @\"employee\": @[], @\"employeeSet\": @[]}];\n    \n    ArrayOfPrimaryCompanies *companies = [ArrayOfPrimaryCompanies createInRealm:realm withValue:@[@[c1, c2]]];\n    [realm commitWriteTransaction];\n    \n    // count operator\n    XCTAssertEqual([[c1.employeeDict valueForKeyPath:@\"@count\"] integerValue], 4);\n    \n    // numeric operators\n    XCTAssertEqual([[c1.employeeDict valueForKeyPath:@\"@min.age\"] intValue], 20);\n    XCTAssertEqual([[c1.employeeDict valueForKeyPath:@\"@max.age\"] intValue], 40);\n    XCTAssertEqual([[c1.employeeDict valueForKeyPath:@\"@sum.age\"] integerValue], 120);\n    XCTAssertEqualWithAccuracy([[c1.employeeDict valueForKeyPath:@\"@avg.age\"] doubleValue], 30, 0.1f);\n    \n    // collection\n    XCTAssertEqualObjects([[c1.employeeDict valueForKeyPath:@\"@unionOfObjects.name\"] sortedArrayUsingSelector:@selector(compare:)],\n                          ([@[@\"A\", @\"B\", @\"C\", @\"B\"] sortedArrayUsingSelector:@selector(compare:)]));\n    XCTAssertEqualObjects([[c1.employeeDict valueForKeyPath:@\"@distinctUnionOfObjects.name\"] sortedArrayUsingSelector:@selector(compare:)],\n                          (@[@\"A\", @\"B\", @\"C\"]));\n    NSComparator cmp = ^NSComparisonResult(id obj1, id obj2) {\n        return [obj1 compare: obj2];\n        \n    };\n    XCTAssertEqualObjects([[companies.companies valueForKeyPath:@\"@unionOfArrays.employeeDict\"] sortedArrayUsingComparator:cmp],\n                          (@[@\"e1\", @\"e1\", @\"e2\", @\"e3\", @\"e4\", @\"e4\"]));\n    XCTAssertEqualObjects([[companies.companies valueForKeyPath:@\"@distinctUnionOfArrays.employeeDict\"] sortedArrayUsingComparator:cmp],\n                          (@[@\"e1\", @\"e2\", @\"e3\", @\"e4\"]));\n\n    // invalid key paths\n    RLMAssertThrowsWithReasonMatching([c1.employeeDict valueForKeyPath:@\"@invalid.name\"],\n                                      @\"Unsupported KVC collection operator found in key path '@invalid.name'\");\n    RLMAssertThrowsWithReasonMatching([c1.employeeDict valueForKeyPath:@\"@sum\"],\n                                      @\"Missing key path for KVC collection operator sum in key path '@sum'\");\n    RLMAssertThrowsWithReasonMatching([c1.employeeDict valueForKeyPath:@\"@sum.\"],\n                                      @\"Missing key path for KVC collection operator sum in key path '@sum.'\");\n    RLMAssertThrowsWithReasonMatching([c1.employeeDict valueForKeyPath:@\"@sum.employees.@sum.age\"],\n                                      @\"Nested key paths.*not supported\");\n}\n\n- (void)testCrossThreadAccess {\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n    \n    EmployeeObject *eo = [[EmployeeObject alloc] initWithValue:@{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES}];\n    company.employeeDict[@\"eo\"] = eo;\n    RLMDictionary *employees = company.employeeDict;\n    \n    // Unmanaged object can be accessed from other threads\n    [self dispatchAsyncAndWait:^{\n        XCTAssertNoThrow(company.employeeDict);\n        XCTAssertNoThrow(employees[@\"eo\"]);\n    }];\n\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n    [realm addObject:company];\n    [realm commitWriteTransaction];\n    \n    employees = company.employeeDict;\n    XCTAssertNoThrow(company.employeeDict);\n    XCTAssertNoThrow(employees[@\"eo\"]);\n    [self dispatchAsyncAndWait:^{\n        XCTAssertThrows(company.employeeDict);\n        XCTAssertThrows(employees.allValues);\n        XCTAssertThrows(employees.allKeys);\n        XCTAssertThrows(employees[@\"eo\"]);\n    }];\n}\n\n- (void)testSortByNoColumns {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    DogObject *a2 = [DogObject createInDefaultRealmWithValue:@[@\"a\", @2]];\n    DogObject *b1 = [DogObject createInDefaultRealmWithValue:@[@\"b\", @1]];\n    DogObject *a1 = [DogObject createInDefaultRealmWithValue:@[@\"a\", @1]];\n    DogObject *b2 = [DogObject createInDefaultRealmWithValue:@[@\"b\", @2]];\n    \n    RLMDictionary<NSString *, DogObject *><RLMString, DogObject> *dict\n        = [DogDictionaryObject createInDefaultRealmWithValue:@[@{@\"a1\": a1, @\"b1\": b1, @\"a2\": a2, @\"b2\": b2}]].dogs;\n    [realm commitWriteTransaction];\n    \n    RLMResults *notActuallySorted = [dict sortedResultsUsingDescriptors:@[]];\n    XCTAssertEqual(notActuallySorted.count, dict.count);\n    XCTAssertTrue([dict[@\"a1\"] isEqualToObject:notActuallySorted[0]]);\n    XCTAssertTrue([dict[@\"a2\"] isEqualToObject:notActuallySorted[1]]);\n    XCTAssertTrue([dict[@\"b1\"] isEqualToObject:notActuallySorted[2]]);\n    XCTAssertTrue([dict[@\"b2\"] isEqualToObject:notActuallySorted[3]]);\n}\n\n- (void)testSortByMultipleColumns {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    DogObject *a1 = [DogObject createInDefaultRealmWithValue:@[@\"a\", @1]];\n    DogObject *a2 = [DogObject createInDefaultRealmWithValue:@[@\"a\", @2]];\n    DogObject *b1 = [DogObject createInDefaultRealmWithValue:@[@\"b\", @1]];\n    DogObject *b2 = [DogObject createInDefaultRealmWithValue:@[@\"b\", @2]];\n    \n    DogDictionaryObject *ddo = [DogDictionaryObject createInDefaultRealmWithValue:@[@{@\"a1\": a1, @\"b1\": b1, @\"a2\": a2, @\"b2\": b2}]];\n    [realm commitWriteTransaction];\n    \n    bool (^checkOrder)(NSArray *, NSArray *, NSArray *) = ^bool(NSArray *properties, NSArray *ascending, NSArray *dogs) {\n        NSArray *sort = @[[RLMSortDescriptor sortDescriptorWithKeyPath:properties[0] ascending:[ascending[0] boolValue]],\n                          [RLMSortDescriptor sortDescriptorWithKeyPath:properties[1] ascending:[ascending[1] boolValue]]];\n        RLMResults *actual = [ddo.dogs sortedResultsUsingDescriptors:sort];\n        \n        return [actual[0] isEqualToObject:dogs[0]]\n        && [actual[1] isEqualToObject:dogs[1]]\n        && [actual[2] isEqualToObject:dogs[2]]\n        && [actual[3] isEqualToObject:dogs[3]];\n    };\n    \n    // Check each valid sort\n    XCTAssertTrue(checkOrder(@[@\"dogName\", @\"age\"], @[@YES, @YES], @[a1, a2, b1, b2]));\n    XCTAssertTrue(checkOrder(@[@\"dogName\", @\"age\"], @[@YES, @NO], @[a2, a1, b2, b1]));\n    XCTAssertTrue(checkOrder(@[@\"dogName\", @\"age\"], @[@NO, @YES], @[b1, b2, a1, a2]));\n    XCTAssertTrue(checkOrder(@[@\"dogName\", @\"age\"], @[@NO, @NO], @[b2, b1, a2, a1]));\n    XCTAssertTrue(checkOrder(@[@\"age\", @\"dogName\"], @[@YES, @YES], @[a1, b1, a2, b2]));\n    XCTAssertTrue(checkOrder(@[@\"age\", @\"dogName\"], @[@YES, @NO], @[b1, a1, b2, a2]));\n    XCTAssertTrue(checkOrder(@[@\"age\", @\"dogName\"], @[@NO, @YES], @[a2, b2, a1, b1]));\n    XCTAssertTrue(checkOrder(@[@\"age\", @\"dogName\"], @[@NO, @NO], @[b2, a2, b1, a1]));\n}\n\n- (void)testSortByRenamedColumns {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    id value = @{@\"dictionary\": @{@\"0\": @[@1, @\"c\"], @\"1\": @[@2, @\"b\"], @\"2\": @[@3, @\"a\"]}, @\"set\": @[]};\n    LinkToRenamedProperties *obj = [LinkToRenamedProperties createInRealm:realm withValue:value];\n\n    XCTAssertEqualObjects([[obj.dictionary sortedResultsUsingKeyPath:@\"intCol\" ascending:YES] valueForKeyPath:@\"intCol\"],\n                          (@[@1, @2, @3]));\n    XCTAssertEqualObjects([[obj.dictionary sortedResultsUsingKeyPath:@\"intCol\" ascending:NO] valueForKeyPath:@\"intCol\"],\n                          (@[@3, @2, @1]));\n    \n    [realm cancelWriteTransaction];\n}\n\n- (void)testDeleteLinksAndObjectsInDictionary {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    EmployeeObject *po1 = [EmployeeObject createInRealm:realm withValue:@[@\"Joe\", @40, @YES]];\n    EmployeeObject *po2 = [EmployeeObject createInRealm:realm withValue:@[@\"John\", @30, @NO]];\n    EmployeeObject *po3 = [EmployeeObject createInRealm:realm withValue:@[@\"Jill\", @25, @YES]];\n    \n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n    for (EmployeeObject *eo in [EmployeeObject allObjects]) {\n        company.employeeDict[eo.name] = eo;\n    }\n    [realm addObject:company];\n    [realm commitWriteTransaction];\n    \n    RLMDictionary *peopleInCompany = company.employeeDict;\n    \n    // Delete link to employee\n    XCTAssertThrowsSpecificNamed([peopleInCompany removeObjectForKey:@\"Joe\"], NSException, @\"RLMException\", @\"Not allowed in read transaction\");\n    XCTAssertEqual(peopleInCompany.count, 3U, @\"No links should have been deleted\");\n    \n    [realm beginWriteTransaction];\n    XCTAssertNoThrow([peopleInCompany removeObjectForKey:@\"John\"], @\"Should delete link to employee\");\n    [realm commitWriteTransaction];\n    \n    XCTAssertEqual(peopleInCompany.count, 2U, @\"link deleted when accessing via links\");\n    EmployeeObject *test = peopleInCompany[@\"Joe\"];\n    XCTAssertEqual(test.age, po1.age, @\"Should be equal\");\n    XCTAssertEqualObjects(test.name, po1.name, @\"Should be equal\");\n    XCTAssertEqual(test.hired, po1.hired, @\"Should be equal\");\n    XCTAssertTrue([test isEqualToObject:po1], @\"Should be equal\");\n    \n    test = peopleInCompany[@\"Jill\"];\n    XCTAssertEqual(test.age, po3.age, @\"Should be equal\");\n    XCTAssertEqualObjects(test.name, po3.name, @\"Should be equal\");\n    XCTAssertEqual(test.hired, po3.hired, @\"Should be equal\");\n    XCTAssertTrue([test isEqualToObject:po3], @\"Should be equal\");\n    \n    XCTAssertThrowsSpecificNamed([peopleInCompany removeAllObjects], NSException, @\"RLMException\", @\"Not allowed in read transaction\");\n    XCTAssertThrowsSpecificNamed(peopleInCompany[@\"Joe\"] = po2, NSException, @\"RLMException\", @\"Replace not allowed in read transaction\");\n    XCTAssertThrowsSpecificNamed(peopleInCompany[@\"John\"] = po2, NSException, @\"RLMException\", @\"Add not allowed in read transaction\");\n    \n    [realm beginWriteTransaction];\n    XCTAssertNoThrow(peopleInCompany[@\"Jill\"] = nil, @\"Should delete value for key\");\n    XCTAssertEqual(peopleInCompany.count, 1U, @\"1 remaining link\");\n    peopleInCompany[@\"Joe\"] = po2;\n    XCTAssertEqual(peopleInCompany.count, 1U, @\"1 link replaced\");\n    peopleInCompany[@\"Jill\"] = po3;\n    XCTAssertEqual(peopleInCompany.count, 2U, @\"2 links\");\n    XCTAssertNoThrow([peopleInCompany removeAllObjects], @\"Should delete all links\");\n    XCTAssertEqual(peopleInCompany.count, 0U, @\"0 remaining links\");\n    [realm commitWriteTransaction];\n    \n    RLMResults *allPeople = [EmployeeObject allObjects];\n    XCTAssertEqual(allPeople.count, 3U, @\"Only links should have been deleted, not the employees\");\n}\n\n- (void)testDictionaryDescription {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    \n    [realm beginWriteTransaction];\n    RLMDictionary<NSString *, EmployeeObject *><RLMString, EmployeeObject> *employees = [CompanyObject createInDefaultRealmWithValue:@[@\"company\"]].employeeDict;\n    RLMDictionary<NSString *, NSNumber *><RLMString, RLMInt> *ints = [AllPrimitiveDictionaries createInDefaultRealmWithValue:@[]].intObj;\n    for (NSInteger i = 0; i < 1012; ++i) {\n        EmployeeObject *person = [[EmployeeObject alloc] init];\n        person.name = @\"Mary\";\n        person.age = 24;\n        person.hired = YES;\n        NSString *key = [NSString stringWithFormat:@\"%li\", (long)i];\n        employees[key] = person;\n        ints[key] = @(i + 100);\n    }\n    [realm commitWriteTransaction];\n\n    RLMAssertMatches(employees.description,\n                     @\"(?s)RLMDictionary\\\\<string, EmployeeObject\\\\> \\\\<0x[a-z0-9]+\\\\> \\\\(\\n\"\n                     @\"\\\\[[0-9]+\\\\]: EmployeeObject \\\\{\\n\"\n                     @\"\\t\\tname = Mary;\\n\"\n                     @\"\\t\\tage = 24;\\n\"\n                     @\"\\t\\thired = 1;\\n\"\n                     @\"\\t\\\\},\\n\"\n                     @\".*\\n\"\n                     @\"\\\\)\");\n\n    RLMAssertMatches(ints.description,\n                     @\"(?s)RLMDictionary\\\\<string, int\\\\> \\\\<0x[a-z0-9]+\\\\> \\\\(\\n\"\n                     @\"\\\\[[0-9]+\\\\]: [0-9]+,\\n\"\n                     @\"\\\\[[0-9]+\\\\]: [0-9]+,\\n\"\n                     @\".*\\n\"\n                     @\"\\\\[[0-9]+\\\\]: [0-9]+\\n\"\n                     @\"\\\\)\");\n}\n\n- (void)testUnmanagedAssignment {\n    IntObject *io1 = [[IntObject alloc] init];\n    IntObject *io2 = [[IntObject alloc] init];\n    IntObject *io3 = [[IntObject alloc] init];\n    \n    DictionaryPropertyObject *dict1 = [[DictionaryPropertyObject alloc] init];\n    DictionaryPropertyObject *dict2 = [[DictionaryPropertyObject alloc] init];\n    \n    // Assigning NSDictionary shallow copies\n    dict1.intObjDictionary = (id)@{@\"io1\": io1, @\"io2\": io2};\n    XCTAssertEqualObjects([dict1.intObjDictionary valueForKey:@\"io1\"], io1);\n    \n    [dict1 setValue:@{@\"io1\": io1, @\"io3\": io3} forKey:@\"intObjDictionary\"];\n    XCTAssertEqualObjects([dict1.intObjDictionary valueForKey:@\"io3\"], io3);\n    \n    dict1[@\"intObjDictionary\"] = @{@\"io2\": io2, @\"io3\": io3};\n    XCTAssertEqualObjects([dict1.intObjDictionary valueForKey:@\"io3\"], io3);\n\n    // Assigning RLMDictionary shallow copies\n    dict2.intObjDictionary = dict1.intObjDictionary;\n    XCTAssertEqualObjects([dict2.intObjDictionary valueForKey:@\"io3\"], io3);\n\n    [dict1.intObjDictionary removeAllObjects];\n    XCTAssertEqualObjects([dict2.intObjDictionary valueForKey:@\"io3\"], io3);\n\n    // Self-assignment is a no-op\n    dict2.intObjDictionary = dict2.intObjDictionary;\n    XCTAssertEqualObjects([dict2.intObjDictionary valueForKey:@\"io3\"], io3);\n    dict2[@\"intObjDictionary\"] = dict2[@\"intObjDictionary\"];\n    XCTAssertEqualObjects([dict2.intObjDictionary valueForKey:@\"io3\"], io3);\n}\n\n- (void)testManagedAssignment {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    \n    IntObject *io1 = [IntObject createInRealm:realm withValue:@[@1]];\n    IntObject *io2 = [IntObject createInRealm:realm withValue:@[@2]];\n    IntObject *io3 = [IntObject createInRealm:realm withValue:@[@3]];\n    \n    DictionaryPropertyObject *dict1 = [[DictionaryPropertyObject alloc] init];\n    DictionaryPropertyObject *dict2 = [[DictionaryPropertyObject alloc] init];\n\n    // Assigning NSDictonary shallow copies\n    dict1.intObjDictionary = (id)@{@\"io1\": io1, @\"io2\": io2};\n    XCTAssertEqualObjects([dict1.intObjDictionary valueForKey:@\"io1\"], io1);\n    \n    [dict1 setValue:@{@\"io1\": io1, @\"io3\": io3} forKey:@\"intObjDictionary\"];\n    XCTAssertEqualObjects([dict1.intObjDictionary valueForKey:@\"io3\"], io3);\n    \n    dict1[@\"intObjDictionary\"] = @{@\"io2\": io2, @\"io3\": io3};\n    XCTAssertEqualObjects([dict1.intObjDictionary valueForKey:@\"io2\"], io2);\n    \n    // Assigning RLMDictionary shallow copies\n    dict2.intObjDictionary = dict1.intObjDictionary;\n    XCTAssertEqualObjects([dict2.intObjDictionary valueForKey:@\"io2\"], io2);\n    \n    [dict1.intObjDictionary removeAllObjects];\n    XCTAssertEqualObjects([dict2.intObjDictionary valueForKey:@\"io2\"], io2);\n    \n    // Self-assignment is a no-op\n    dict2.intObjDictionary = dict2.intObjDictionary;\n    XCTAssertEqualObjects([dict2.intObjDictionary valueForKey:@\"io2\"], io2);\n    dict2[@\"intObjDictionary\"] = dict2[@\"intObjDictionary\"];\n    XCTAssertEqualObjects([dict2.intObjDictionary valueForKey:@\"io2\"], io2);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAssignIncorrectType {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    DictionaryPropertyObject *dict = [DictionaryPropertyObject createInRealm:realm\n                                                                   withValue:@{@\"stringDictionary\": @{@\"a\": [[StringObject alloc] initWithValue:@[@\"a\"]]}}];\n\n    RLMAssertThrowsWithReason(dict.intObjDictionary = (id)dict.stringDictionary,\n                              @\"RLMDictionary<string, StringObject?> does not match expected type 'IntObject?' for property 'DictionaryPropertyObject.intObjDictionary'.\");\n    RLMAssertThrowsWithReason(dict[@\"intObjDictionary\"] = dict[@\"stringDictionary\"],\n                              @\"RLMDictionary<string, StringObject?> does not match expected type 'IntObject?' for property 'DictionaryPropertyObject.intObjDictionary'.\");\n    [realm cancelWriteTransaction];\n}\n\n- (void)testNotificationSentInitially {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    DictionaryPropertyObject *dict = [DictionaryPropertyObject createInRealm:realm\n                                                                   withValue:@{@\"stringDictionary\": @{@\"a\": [[StringObject alloc] initWithValue:@[@\"a\"]]}}];\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    id token = [dict.stringDictionary addNotificationBlock:^(RLMDictionary *dictionary, RLMDictionaryChange *change, NSError *error) {\n        XCTAssertNotNil(dictionary);\n        XCTAssertNil(change);\n        XCTAssertNil(error);\n        [expectation fulfill];\n    }];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationSentAfterCommit {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    DictionaryPropertyObject *dict = [DictionaryPropertyObject createInRealm:realm withValue:@{}];\n    [realm commitWriteTransaction];\n\n    __block bool first = true;\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [dict.stringDictionary addNotificationBlock:^(RLMDictionary *dictionary, RLMDictionaryChange *change, NSError *error) {\n        XCTAssertNotNil(dictionary);\n        XCTAssert(first ? !change : !!change);\n        XCTAssertNil(error);\n        first = false;\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = self.realmWithTestPath;\n        [realm transactionWithBlock:^{\n            RLMDictionary *dict = [(DictionaryPropertyObject *)[DictionaryPropertyObject allObjectsInRealm:realm].firstObject stringDictionary];\n            dict[@\"new\"] = [[StringObject alloc] init];\n        }];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationNotSentForUnrelatedChange {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    DictionaryPropertyObject *dict = [DictionaryPropertyObject createInRealm:realm withValue:@{}];\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    id token = [dict.stringDictionary addNotificationBlock:^(__unused RLMDictionary *dictionary,\n                                                             __unused RLMDictionaryChange *change,\n                                                             __unused NSError *error) {\n        // will throw if it's incorrectly called a second time due to the\n        // unrelated write transaction\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmDidChangeNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *realm = self.realmWithTestPath;\n            [realm transactionWithBlock:^{\n                [DictionaryPropertyObject createInRealm:realm withValue:@{}];\n            }];\n        }];\n    }];\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationSentOnlyForActualRefresh {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    DictionaryPropertyObject *dict = [DictionaryPropertyObject createInRealm:realm withValue:@{}];\n    [realm commitWriteTransaction];\n\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [dict.stringDictionary addNotificationBlock:^(__unused RLMDictionary *dictionary,\n                                                             __unused RLMDictionaryChange *change,\n                                                             __unused NSError *error) {\n        XCTAssertNotNil(dictionary);\n        XCTAssertNil(error);\n        // will throw if it's called a second time before we create the new\n        // expectation object immediately before manually refreshing\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // Turn off autorefresh, so the background commit should not result in a notification\n    realm.autorefresh = NO;\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmRefreshRequiredNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *realm = self.realmWithTestPath;\n            [realm transactionWithBlock:^{\n                RLMDictionary *dict = [(DictionaryPropertyObject *)[DictionaryPropertyObject allObjectsInRealm:realm].firstObject stringDictionary];\n                dict[@\"new\"] = [[StringObject alloc] init];\n            }];\n        }];\n    }];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [realm refresh];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testDeletingObjectWithNotificationsRegistered {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    DictionaryPropertyObject *dict = [DictionaryPropertyObject createInRealm:realm withValue:@{}];\n    [realm commitWriteTransaction];\n    \n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [dict.stringDictionary addNotificationBlock:^(__unused RLMDictionary *dictionary,\n                                                             __unused RLMDictionaryChange *change,\n                                                             __unused NSError *error) {\n        XCTAssertNotNil(dictionary);\n        XCTAssertNil(error);\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    \n    [realm beginWriteTransaction];\n    [realm deleteObject:dict];\n    [realm commitWriteTransaction];\n    \n    [(RLMNotificationToken *)token invalidate];\n}\n\nstatic RLMDictionary<NSString *, IntObject *><RLMString, IntObject> *managedTestDictionary(void) {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    RLMDictionary<NSString *, IntObject *><RLMString, IntObject> *dict;\n    [realm beginWriteTransaction];\n    dict = [DictionaryPropertyObject createInDefaultRealmWithValue:\n            @{@\"intObjDictionary\": @{@\"0\": @[@0], @\"1\": @[@1]}}].intObjDictionary;\n    [realm commitWriteTransaction];\n    return dict;\n}\n\n- (void)testAllMethodsCheckThread {\n    RLMDictionary<NSString *, IntObject *><RLMString, IntObject> *dict = managedTestDictionary();\n    IntObject *io = dict.allValues.firstObject;\n    RLMRealm *realm = dict.realm;\n    [realm beginWriteTransaction];\n    \n    [self dispatchAsyncAndWait:^{\n        RLMAssertThrowsWithReasonMatching([dict count], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([dict objectForKey:@\"thread\"], @\"thread\");\n        \n        RLMAssertThrowsWithReasonMatching([dict setObject:io forKey:@\"thread\"], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([dict removeObjectForKey:@\"thread\"], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([dict setObject:nil forKey:@\"thread\"], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([dict removeAllObjects], @\"thread\");\n\n        RLMAssertThrowsWithReasonMatching([dict objectsWhere:@\"intCol = 0\"], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([dict objectsWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([dict sortedResultsUsingKeyPath:@\"intCol\" ascending:YES], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([dict sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"intCol\" ascending:YES]]], @\"thread\");\n        RLMAssertThrowsWithReasonMatching(dict[@\"thread\"], @\"thread\");\n        RLMAssertThrowsWithReasonMatching(dict[@\"thread\"] = io, @\"thread\");\n        RLMAssertThrowsWithReasonMatching([dict valueForKey:@\"intCol\"], @\"thread\");\n        RLMAssertThrowsWithReasonMatching(({for (__unused id obj in dict);}), @\"thread\");\n    }];\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAllMethodsCheckForInvalidation {\n    RLMDictionary<NSString *, IntObject *><RLMString, IntObject> *dictionary = managedTestDictionary();\n    IntObject *io = dictionary[@\"0\"];\n    RLMRealm *realm = dictionary.realm;\n\n    [realm beginWriteTransaction];\n\n    XCTAssertNoThrow([dictionary objectClassName]);\n    XCTAssertNoThrow([dictionary realm]);\n    XCTAssertNoThrow([dictionary isInvalidated]);\n\n    XCTAssertNoThrow([dictionary count]);\n    XCTAssertNoThrow([dictionary allValues]);\n    XCTAssertNoThrow([dictionary allKeys]);\n\n    XCTAssertNoThrow(dictionary[@\"new\"] = io);\n    XCTAssertNoThrow([dictionary setObject:io forKey:@\"another\"]);\n    XCTAssertNoThrow(dictionary[@\"new\"] = nil);\n    XCTAssertNoThrow([dictionary removeObjectForKey:@\"another\"]);\n\n    XCTAssertNoThrow([dictionary objectsWhere:@\"intCol = 0\"]);\n    XCTAssertNoThrow([dictionary objectsWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]]);\n    XCTAssertNoThrow([dictionary sortedResultsUsingKeyPath:@\"intCol\" ascending:YES]);\n    XCTAssertNoThrow([dictionary sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"intCol\" ascending:YES]]]);\n    XCTAssertNoThrow([dictionary valueForKey:@\"0\"]);\n    XCTAssertNoThrow([dictionary setValue:io forKey:@\"foo\"]);\n    XCTAssertNoThrow(({for (__unused id obj in dictionary);}));\n\n    [realm cancelWriteTransaction];\n    [realm invalidate];\n    [realm beginWriteTransaction];\n    io = [IntObject createInDefaultRealmWithValue:@[@0]];\n\n    XCTAssertNoThrow([dictionary objectClassName]);\n    XCTAssertNoThrow([dictionary realm]);\n    XCTAssertNoThrow([dictionary isInvalidated]);\n\n    RLMAssertThrowsWithReasonMatching([dictionary count], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([dictionary allValues], @\"invalidated\");\n    XCTAssertNil(dictionary[@\"new\"]);\n\n    RLMAssertThrowsWithReasonMatching(dictionary[@\"new\"] = io, @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([dictionary setObject:io forKey:@\"another\"], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching(dictionary[@\"new\"] = nil, @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([dictionary removeObjectForKey:@\"another\"], @\"invalidated\");\n\n    RLMAssertThrowsWithReasonMatching([dictionary objectsWhere:@\"intCol = 0\"], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([dictionary objectsWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([dictionary sortedResultsUsingKeyPath:@\"intCol\" ascending:YES], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([dictionary sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"intCol\" ascending:YES]]], @\"invalidated\");\n    XCTAssertNil([dictionary valueForKey:@\"new\"]);\n    RLMAssertThrowsWithReasonMatching([dictionary setValue:io forKey:@\"foo\"], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching(({for (__unused id obj in dictionary);}), @\"invalidated\");\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testMutatingMethodsCheckForWriteTransaction {\n    RLMDictionary<NSString *, IntObject *><RLMString, IntObject> *dict = managedTestDictionary();\n    IntObject *io = dict.allValues.firstObject;\n    \n    XCTAssertNoThrow([dict objectClassName]);\n    XCTAssertNoThrow([dict realm]);\n    XCTAssertNoThrow([dict isInvalidated]);\n    \n    XCTAssertNoThrow([dict count]);\n    XCTAssertNoThrow([dict objectForKey:@\"0\"]);\n\n    XCTAssertNoThrow([dict objectsWhere:@\"intCol = 0\"]);\n    XCTAssertNoThrow([dict objectsWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]]);\n    XCTAssertNoThrow([dict sortedResultsUsingKeyPath:@\"intCol\" ascending:YES]);\n    XCTAssertNoThrow([dict sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"intCol\" ascending:YES]]]);\n    XCTAssertNoThrow(dict[@\"0\"]);\n    XCTAssertNoThrow([dict valueForKey:@\"intCol\"]);\n    XCTAssertNoThrow(({for (__unused id obj in dict);}));\n    \n    RLMAssertThrowsWithReasonMatching([dict setObject:io forKey:@\"thread\"], @\"write transaction\");\n    RLMAssertThrowsWithReasonMatching([dict removeObjectForKey:@\"thread\"], @\"write transaction\");\n    RLMAssertThrowsWithReasonMatching([dict setObject:nil forKey:@\"thread\"], @\"write transaction\");\n    RLMAssertThrowsWithReasonMatching([dict removeAllObjects], @\"write transaction\");\n\n    RLMAssertThrowsWithReasonMatching(dict[@\"0\"] = io, @\"write transaction\");\n    RLMAssertThrowsWithReasonMatching([dict setValue:io forKey:@\"intCol\"], @\"write transaction\");\n}\n\n- (void)testDeleteObjectFromOutsideDictionary {\n    RLMDictionary<NSString *, IntObject *><RLMString, IntObject> *dict = managedTestDictionary();\n    RLMRealm *realm = dict.realm;\n    [realm beginWriteTransaction];\n\n    XCTAssertNotNil(dict[@\"0\"]);\n    IntObject *o = dict.allValues[0];\n    IntObject *o2 = dict.allValues[1];\n    [realm deleteObject:o];\n    [realm deleteObject:o2];\n    XCTAssertEqualObjects(dict[@\"0\"], NSNull.null);\n    XCTAssertEqualObjects(dict[@\"1\"], NSNull.null);\n\n    [realm commitWriteTransaction];\n}\n\n- (void)testIsFrozen {\n    RLMDictionary *unfrozen = managedTestDictionary();\n    RLMDictionary *frozen = [unfrozen freeze];\n    XCTAssertFalse(unfrozen.isFrozen);\n    XCTAssertTrue(frozen.isFrozen);\n}\n\n- (void)testFreezingFrozenObjectReturnsSelf {\n    RLMDictionary *dict = managedTestDictionary();\n    RLMDictionary *frozen = [dict freeze];\n    XCTAssertNotEqual(dict, frozen);\n    XCTAssertNotEqual(dict.freeze, frozen);\n    XCTAssertEqual(frozen, frozen.freeze);\n}\n\n- (void)testFreezeFromWrongThread {\n    RLMDictionary *dict = managedTestDictionary();\n    [self dispatchAsyncAndWait:^{\n        RLMAssertThrowsWithReason([dict freeze],\n                                  @\"Realm accessed from incorrect thread\");\n    }];\n}\n\n- (void)testAccessFrozenFromDifferentThread {\n    RLMDictionary *frozen = [managedTestDictionary() freeze];\n    [self dispatchAsyncAndWait:^{\n        XCTAssertEqualObjects(@([[frozen valueForKey:@\"0\"] intCol]), (@0));\n    }];\n}\n\n- (void)testObserveFrozenDictionary {\n    RLMDictionary *frozen = [managedTestDictionary() freeze];\n    id block = ^(__unused BOOL deleted, __unused NSArray *changes, __unused NSError *error) {};\n    RLMAssertThrowsWithReason([frozen addNotificationBlock:block],\n                              @\"Frozen Realms do not change and do not have change notifications.\");\n}\n\n- (void)testQueryFrozenDictionary {\n    RLMDictionary *frozen = [managedTestDictionary() freeze];\n    XCTAssertEqualObjects([[frozen objectsWhere:@\"intCol > 0\"] valueForKey:@\"intCol\"], (@[@1]));\n}\n\n- (void)testFrozenDictionarysDoNotUpdate {\n    RLMDictionary *dict = managedTestDictionary();\n    RLMDictionary *frozen = [dict freeze];\n    XCTAssertEqual(frozen.count, 2);\n    [dict.realm transactionWithBlock:^{\n        [dict removeObjectForKey:dict.allKeys.lastObject];\n    }];\n    XCTAssertEqual(frozen.count, 2);\n}\n\n- (void)testAddEntriesFromDictionaryUnmanaged {\n    RLMDictionary<NSString *, StringObject *> *dict = [[DictionaryPropertyObject alloc] init].stringDictionary;\n    RLMAssertThrowsWithReasonMatching([dict addEntriesFromDictionary:@[@\"string\"]],\n                                      @\"Cannot add entries from object of class '.*Array.*'\");\n    RLMAssertThrowsWithReason([dict addEntriesFromDictionary:@{@\"\": [[IntObject alloc] init]}],\n                              @\"Value of type 'IntObject' does not match RLMDictionary value type 'StringObject'.\");\n    RLMAssertThrowsWithReason([dict addEntriesFromDictionary:@{@1: [[StringObject alloc] init]}],\n                              @\"Invalid key '1' of type '\" RLMConstantInt \"' for expected type 'string'.\");\n\n    // Adding nil is a no-op\n    XCTAssertNoThrow([dict addEntriesFromDictionary:self.nonLiteralNil]);\n    XCTAssertEqual(dict.count, 0U);\n\n    // Add into empty adds those entries\n    [dict addEntriesFromDictionary:@{@\"a\": [[StringObject alloc] initWithValue:@[@\"1\"]],\n                                     @\"b\": [[StringObject alloc] initWithValue:@[@\"2\"]]}];\n    XCTAssertEqual(dict.count, 2U);\n    XCTAssertEqualObjects(dict[@\"a\"].stringCol, @\"1\");\n    XCTAssertEqualObjects(dict[@\"b\"].stringCol, @\"2\");\n\n    // Duplicate keys overwrite the old values and leave any non-duplicates\n    [dict addEntriesFromDictionary:@{@\"a\": [[StringObject alloc] initWithValue:@[@\"3\"]],\n                                     @\"c\": [[StringObject alloc] initWithValue:@[@\"4\"]]}];\n    XCTAssertEqual(dict.count, 3U);\n    XCTAssertEqualObjects(dict[@\"a\"].stringCol, @\"3\");\n    XCTAssertEqualObjects(dict[@\"b\"].stringCol, @\"2\");\n    XCTAssertEqualObjects(dict[@\"c\"].stringCol, @\"4\");\n\n    // Add from a RLMDictionary rather than a NSDictionary\n    RLMDictionary<NSString *, StringObject *> *dict2 = [[DictionaryPropertyObject alloc] init].stringDictionary;\n    dict2[@\"d\"] = [[StringObject alloc] initWithValue:@[@\"5\"]];\n    [dict addEntriesFromDictionary:dict2];\n    XCTAssertEqual(dict.count, 4U);\n    XCTAssertEqualObjects(dict[@\"a\"].stringCol, @\"3\");\n    XCTAssertEqualObjects(dict[@\"b\"].stringCol, @\"2\");\n    XCTAssertEqualObjects(dict[@\"c\"].stringCol, @\"4\");\n    XCTAssertEqualObjects(dict[@\"d\"].stringCol, @\"5\");\n}\n\n- (void)testAddEntriesFromDictionaryManaged {\n    RLMDictionary<NSString *, IntObject *> *dict = managedTestDictionary();\n    [dict.realm beginWriteTransaction];\n    [dict removeAllObjects];\n\n    RLMAssertThrowsWithReasonMatching([dict addEntriesFromDictionary:@[@\"string\"]],\n                                      @\"Cannot add entries from object of class '.*Array.*'\");\n    RLMAssertThrowsWithReason([dict addEntriesFromDictionary:@{@\"\": [[StringObject alloc] init]}],\n                              @\"Value of type 'StringObject' does not match RLMDictionary value type 'IntObject'.\");\n    RLMAssertThrowsWithReason([dict addEntriesFromDictionary:@{@1: [[IntObject alloc] init]}],\n                              @\"Invalid key '1' of type '\" RLMConstantInt \"' for expected type 'string'.\");\n\n    // Adding nil is a no-op\n    XCTAssertNoThrow([dict addEntriesFromDictionary:self.nonLiteralNil]);\n    XCTAssertEqual(dict.count, 0U);\n\n    // Add into empty adds those entries\n    [dict addEntriesFromDictionary:@{@\"a\": [[IntObject alloc] initWithValue:@[@1]],\n                                     @\"b\": [[IntObject alloc] initWithValue:@[@2]]}];\n    XCTAssertEqual(dict.count, 2U);\n    XCTAssertEqual(dict[@\"a\"].intCol, 1);\n    XCTAssertEqual(dict[@\"b\"].intCol, 2);\n\n    // Duplicate keys overwrite the old values and leave any non-duplicates\n    [dict addEntriesFromDictionary:@{@\"a\": [[IntObject alloc] initWithValue:@[@3]],\n                                     @\"c\": [[IntObject alloc] initWithValue:@[@4]]}];\n    XCTAssertEqual(dict.count, 3U);\n    XCTAssertEqual(dict[@\"a\"].intCol, 3);\n    XCTAssertEqual(dict[@\"b\"].intCol, 2);\n    XCTAssertEqual(dict[@\"c\"].intCol, 4);\n\n    // Add from a RLMDictionary rather than a NSDictionary\n    RLMDictionary<NSString *, IntObject *> *dict2 = [[DictionaryPropertyObject alloc] init].intObjDictionary;\n    dict2[@\"d\"] = [[IntObject alloc] initWithValue:@[@5]];\n    [dict addEntriesFromDictionary:dict2];\n    XCTAssertEqual(dict.count, 4U);\n    XCTAssertEqual(dict[@\"a\"].intCol, 3);\n    XCTAssertEqual(dict[@\"b\"].intCol, 2);\n    XCTAssertEqual(dict[@\"c\"].intCol, 4);\n    XCTAssertEqual(dict[@\"d\"].intCol, 5);\n\n    [dict.realm cancelWriteTransaction];\n}\n\n- (void)testSetDictionaryUnmanaged {\n    RLMDictionary<NSString *, StringObject *> *dict = [[DictionaryPropertyObject alloc] init].stringDictionary;\n    RLMAssertThrowsWithReasonMatching([dict setDictionary:@[@\"string\"]],\n                                      @\"Cannot set dictionary to object of class '.*Array.*'\");\n    RLMAssertThrowsWithReason([dict setDictionary:@{@\"\": [[IntObject alloc] init]}],\n                              @\"Value of type 'IntObject' does not match RLMDictionary value type 'StringObject'.\");\n    RLMAssertThrowsWithReason([dict setDictionary:@{@1: [[StringObject alloc] init]}],\n                              @\"Invalid key '1' of type '\" RLMConstantInt \"' for expected type 'string'.\");\n\n    // Set into empty adds those entries\n    [dict setDictionary:@{@\"a\": [[StringObject alloc] initWithValue:@[@\"1\"]],\n                          @\"b\": [[StringObject alloc] initWithValue:@[@\"2\"]]}];\n    XCTAssertEqual(dict.count, 2U);\n    XCTAssertEqualObjects(dict[@\"a\"].stringCol, @\"1\");\n    XCTAssertEqualObjects(dict[@\"b\"].stringCol, @\"2\");\n\n    // New dictionary replaces the old one entirely\n    [dict setDictionary:@{@\"a\": [[StringObject alloc] initWithValue:@[@\"3\"]],\n                          @\"c\": [[StringObject alloc] initWithValue:@[@\"4\"]]}];\n    XCTAssertEqual(dict.count, 2U);\n    XCTAssertEqualObjects(dict[@\"a\"].stringCol, @\"3\");\n    XCTAssertEqualObjects(dict[@\"c\"].stringCol, @\"4\");\n\n    // Setting to nil clears\n    XCTAssertNoThrow([dict setDictionary:self.nonLiteralNil]);\n    XCTAssertEqual(dict.count, 0U);\n\n    // Self-setting clears\n    [dict setDictionary:@{@\"a\": [[StringObject alloc] initWithValue:@[@\"3\"]],\n                          @\"c\": [[StringObject alloc] initWithValue:@[@\"4\"]]}];\n    XCTAssertEqual(dict.count, 2U);\n    [dict setDictionary:dict];\n    XCTAssertEqual(dict.count, 0U);\n\n    // Type error clears\n    [dict setDictionary:@{@\"a\": [[StringObject alloc] initWithValue:@[@\"3\"]],\n                          @\"c\": [[StringObject alloc] initWithValue:@[@\"4\"]]}];\n    XCTAssertEqual(dict.count, 2U);\n    RLMAssertThrowsWithReason([dict setDictionary:@{@\"\": [[IntObject alloc] init]}],\n                              @\"Value of type 'IntObject' does not match RLMDictionary value type 'StringObject'.\");\n    XCTAssertEqual(dict.count, 0U);\n}\n\n- (void)testSetDictionaryManaged {\n    RLMDictionary<NSString *, IntObject *> *dict = managedTestDictionary();\n    [dict.realm beginWriteTransaction];\n    [dict removeAllObjects];\n\n    RLMAssertThrowsWithReasonMatching([dict setDictionary:@[@\"string\"]],\n                                      @\"Cannot set dictionary to object of class '.*Array.*'\");\n    RLMAssertThrowsWithReason([dict setDictionary:@{@\"\": [[StringObject alloc] init]}],\n                              @\"Value of type 'StringObject' does not match RLMDictionary value type 'IntObject'.\");\n    RLMAssertThrowsWithReason([dict setDictionary:@{@1: [[IntObject alloc] init]}],\n                              @\"Invalid key '1' of type '\" RLMConstantInt \"' for expected type 'string'.\");\n\n    // Set into empty adds those entries\n    [dict setDictionary:@{@\"a\": [[IntObject alloc] initWithValue:@[@1]],\n                          @\"b\": [[IntObject alloc] initWithValue:@[@2]]}];\n    XCTAssertEqual(dict.count, 2U);\n    XCTAssertEqual(dict[@\"a\"].intCol, 1);\n    XCTAssertEqual(dict[@\"b\"].intCol, 2);\n\n    // New dictionary replaces the old one entirely\n    [dict setDictionary:@{@\"a\": [[IntObject alloc] initWithValue:@[@3]],\n                          @\"c\": [[IntObject alloc] initWithValue:@[@4]]}];\n    XCTAssertEqual(dict.count, 2U);\n    XCTAssertEqual(dict[@\"a\"].intCol, 3);\n    XCTAssertEqual(dict[@\"c\"].intCol, 4);\n\n    // Setting to nil clears\n    XCTAssertNoThrow([dict setDictionary:self.nonLiteralNil]);\n    XCTAssertEqual(dict.count, 0U);\n\n    // Self-setting clears\n    [dict setDictionary:@{@\"a\": [[IntObject alloc] initWithValue:@[@3]],\n                          @\"c\": [[IntObject alloc] initWithValue:@[@4]]}];\n    XCTAssertEqual(dict.count, 2U);\n    [dict setDictionary:dict];\n    XCTAssertEqual(dict.count, 0U);\n\n    // Type error clears\n    [dict setDictionary:@{@\"a\": [[IntObject alloc] initWithValue:@[@3]],\n                          @\"c\": [[IntObject alloc] initWithValue:@[@4]]}];\n    XCTAssertEqual(dict.count, 2U);\n    RLMAssertThrowsWithReason([dict setDictionary:@{@\"\": [[StringObject alloc] init]}],\n                              @\"Value of type 'StringObject' does not match RLMDictionary value type 'IntObject'.\");\n    XCTAssertEqual(dict.count, 0U);\n\n    [dict.realm cancelWriteTransaction];\n}\n\n- (void)testInitWithNullLink {\n    id value = @{@\"stringDictionary\": @{@\"1\": NSNull.null},\n                 @\"intDictionary\": @{@\"2\": NSNull.null},\n                 @\"primitiveStringDictionary\": @{@\"3\": NSNull.null},\n                 @\"embeddedDictionary\": @{@\"4\": NSNull.null},\n                 @\"intObjDictionary\": @{@\"5\": NSNull.null}};\n\n    DictionaryPropertyObject *obj = [[DictionaryPropertyObject alloc] initWithValue:value];\n    XCTAssertEqual(obj.stringDictionary[@\"1\"], (id)NSNull.null);\n    XCTAssertEqual(obj.intDictionary[@\"2\"], (id)NSNull.null);\n    XCTAssertEqual(obj.primitiveStringDictionary[@\"3\"], (id)NSNull.null);\n    XCTAssertEqual(obj.embeddedDictionary[@\"4\"], (id)NSNull.null);\n    XCTAssertEqual(obj.intObjDictionary[@\"5\"], (id)NSNull.null);\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    obj = [DictionaryPropertyObject createInRealm:realm withValue:value];\n    XCTAssertEqual(obj.stringDictionary[@\"1\"], (id)NSNull.null);\n    XCTAssertEqual(obj.intDictionary[@\"2\"], (id)NSNull.null);\n    XCTAssertEqual(obj.primitiveStringDictionary[@\"3\"], (id)NSNull.null);\n    XCTAssertEqual(obj.embeddedDictionary[@\"4\"], (id)NSNull.null);\n    XCTAssertEqual(obj.intObjDictionary[@\"5\"], (id)NSNull.null);\n    [realm cancelWriteTransaction];\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/DynamicTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n#import \"RLMRealm_Dynamic.h\"\n#import \"RLMRealm_Private.h\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMObjectSchema_Private.h\"\n#import \"RLMSchema_Private.h\"\n\n@interface DynamicTests : RLMTestCase\n@end\n\n@implementation DynamicTests\n\n#pragma mark - Tests\n\n- (void)testDynamicRealmExists {\n    @autoreleasepool {\n        // open realm in autoreleasepool to create tables and then dispose\n        RLMRealm *realm = [RLMRealm realmWithURL:RLMTestRealmURL()];\n        [realm beginWriteTransaction];\n        [DynamicTestObject createInRealm:realm withValue:@[@\"column1\", @1]];\n        [DynamicTestObject createInRealm:realm withValue:@[@\"column2\", @2]];\n        [realm commitWriteTransaction];\n    }\n\n    RLMRealm *dyrealm = [self realmWithTestPathAndSchema:nil];\n    XCTAssertNotNil(dyrealm, @\"realm should not be nil\");\n\n    // verify schema\n    RLMObjectSchema *dynSchema = dyrealm.schema[@\"DynamicTestObject\"];\n    XCTAssertNotNil(dynSchema, @\"Should be able to get object schema dynamically\");\n    XCTAssertEqual(dynSchema.properties.count, (NSUInteger)2, @\"DynamicTestObject should have 2 properties\");\n    XCTAssertEqualObjects([dynSchema.properties[0] name], @\"stringCol\", @\"Invalid property name\");\n    XCTAssertEqual([(RLMProperty *)dynSchema.properties[1] type], RLMPropertyTypeInt, @\"Invalid type\");\n\n    // verify object type\n    RLMResults *results = [dyrealm allObjects:@\"DynamicTestObject\"];\n    XCTAssertEqual(results.count, (NSUInteger)2, @\"Array should have 2 elements\");\n    XCTAssertNotEqual(results.objectClassName, DynamicTestObject.className,\n                      @\"Array class should by a dynamic object class\");\n}\n\n- (void)testDynamicObjectRetrieval {\n    @autoreleasepool {\n        // open realm in autoreleasepool to create tables and then dispose\n        RLMRealm *realm = [self realmWithTestPath];\n        [realm beginWriteTransaction];\n        [PrimaryStringObject createInRealm:realm withValue:@[@\"key\", @1]];\n        [realm commitWriteTransaction];\n    }\n\n    RLMRealm *testRealm = [self realmWithTestPath];\n\n    RLMObject *object = [testRealm objectWithClassName:@\"PrimaryStringObject\" forPrimaryKey:@\"key\"];\n\n    XCTAssertNotNil(object, @\"Should be able to retrieve object by primary key dynamically\");\n    XCTAssert([[object valueForKey:@\"stringCol\"] isEqualToString:@\"key\"],@\"stringCol should equal 'key'\");\n    XCTAssert([[[object class] className] isEqualToString:@\"PrimaryStringObject\"],@\"Object class name should equal 'PrimaryStringObject'\");\n    XCTAssert([object isKindOfClass:[PrimaryStringObject class]], @\"Object should be of class 'PrimaryStringObject'\");\n}\n\n- (void)testDynamicSchemaMatchesRegularSchema {\n    RLMSchema *expectedSchema = nil;\n    @autoreleasepool {\n        expectedSchema = self.realmWithTestPath.schema;\n    }\n    XCTAssertNotNil(expectedSchema);\n\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.fileURL = RLMTestRealmURL();\n    config.dynamic = YES;\n\n    NSError *error = nil;\n    RLMSchema *dynamicSchema = [[RLMRealm realmWithConfiguration:config error:&error] schema];\n    XCTAssertNil(error);\n    for (RLMObjectSchema *expectedObjectSchema in expectedSchema.objectSchema) {\n        Class cls = expectedObjectSchema.objectClass;\n        if ([cls _realmObjectName] || [cls _realmColumnNames]) {\n            // Class overrides names, so the dynamic schema for it shoudn't match\n            continue;\n        }\n        if (expectedObjectSchema.primaryKeyProperty.index != 0) {\n            // The dynamic schema will always put the primary key first, so it\n            // won't match if the static schema doesn't have it there\n            continue;\n        }\n\n        RLMObjectSchema *dynamicObjectSchema = dynamicSchema[expectedObjectSchema.className];\n        XCTAssertEqual(dynamicObjectSchema.properties.count, expectedObjectSchema.properties.count);\n        for (NSUInteger propertyIndex = 0; propertyIndex < expectedObjectSchema.properties.count; propertyIndex++) {\n            RLMProperty *dynamicProperty = dynamicObjectSchema.properties[propertyIndex];\n            RLMProperty *expectedProperty = expectedObjectSchema.properties[propertyIndex];\n            XCTAssertEqualObjects(dynamicProperty, expectedProperty);\n        }\n    }\n}\n\n- (void)testDynamicSchema {\n    RLMSchema *schema = [[RLMSchema alloc] init];\n    RLMProperty *prop = [[RLMProperty alloc] initWithName:@\"a\"\n                                                     type:RLMPropertyTypeInt\n                                          objectClassName:nil\n                                   linkOriginPropertyName:nil\n                                                  indexed:NO\n                                                 optional:NO];\n    RLMObjectSchema *objectSchema = [[RLMObjectSchema alloc] initWithClassName:@\"TrulyDynamicObject\"\n                                                                   objectClass:RLMObject.class\n                                                                    properties:@[prop]];\n    schema.objectSchema = @[objectSchema];\n    RLMRealm *dyrealm = [self realmWithTestPathAndSchema:schema];\n    XCTAssertNotNil(dyrealm, @\"dynamic realm shouldn't be nil\");\n}\n\n- (void)testDynamicProperties {\n    @autoreleasepool {\n        // open realm in autoreleasepool to create tables and then dispose\n        RLMRealm *realm = [RLMRealm realmWithURL:RLMTestRealmURL()];\n        [realm beginWriteTransaction];\n        [DynamicTestObject createInRealm:realm withValue:@[@\"column1\", @1]];\n        [DynamicTestObject createInRealm:realm withValue:@[@\"column2\", @2]];\n        [realm commitWriteTransaction];\n    }\n\n    // verify properties\n    RLMRealm *dyrealm = [self realmWithTestPathAndSchema:nil];\n    RLMResults *results = [dyrealm allObjects:@\"DynamicTestObject\"];\n\n    RLMObject *o1 = results[0], *o2 = results[1];\n    XCTAssertEqualObjects(o1[@\"intCol\"], @1);\n    XCTAssertEqualObjects(o2[@\"stringCol\"], @\"column2\");\n    RLMAssertThrowsWithReason(o1[@\"invalid\"], @\"Invalid property name\");\n    RLMAssertThrowsWithReason(o1[@\"invalid\"] = nil, @\"Invalid property name\");\n}\n\n- (void)testDynamicTypes {\n    StringObject *so = [[StringObject alloc] init];\n    so.stringCol = @\"string\";\n    id obj1 = [AllTypesObject values:0 stringObject:nil];\n    id obj2 = [AllTypesObject values:1 stringObject:so];\n    @autoreleasepool {\n        // open realm in autoreleasepool to create tables and then dispose\n        RLMRealm *realm = [RLMRealm realmWithURL:RLMTestRealmURL()];\n        [realm beginWriteTransaction];\n        [AllTypesObject createInRealm:realm withValue:obj1];\n        [AllTypesObject createInRealm:realm withValue:obj2];\n        [realm commitWriteTransaction];\n    }\n\n    // verify properties\n    RLMRealm *dyrealm = [self realmWithTestPathAndSchema:nil];\n    RLMResults<RLMObject *> *results = [dyrealm allObjects:AllTypesObject.className];\n    XCTAssertEqual(results.count, 2U, @\"Should have 2 objects\");\n\n    RLMObjectSchema *schema = dyrealm.schema[AllTypesObject.className];\n    for (int i = 0; i < 12; i++) {\n        NSString *propName = [schema.properties[i] name];\n        XCTAssertEqualObjects(obj1[propName], results[0][propName]);\n        XCTAssertEqualObjects(obj2[propName], results[1][propName]);\n    }\n\n    // check sub object type\n    XCTAssertEqualObjects([schema.properties[12] objectClassName], @\"StringObject\",\n                          @\"Sub-object type in schema should be 'StringObject'\");\n\n    // check object equality\n    XCTAssertNil(results[0][@\"objectCol\"], @\"object should be nil\");\n    XCTAssertEqualObjects(results[1][@\"objectCol\"][@\"stringCol\"], @\"string\",\n                          @\"Child object should have string value 'string'\");\n\n    [dyrealm beginWriteTransaction];\n    RLMObject *o = results[0];\n    for (int i = 0; i < 12; i++) {\n        RLMProperty *prop = schema.properties[i];\n        id value = prop.type == RLMPropertyTypeString ? @1 : @\"\";\n        RLMAssertThrowsWithReason(o[prop.name] = value,\n                                  @\"Invalid value '\");\n        RLMAssertThrowsWithReason(o[prop.name] = NSNull.null,\n                                  @\"Invalid value '<null>' of type 'NSNull' for\");\n        RLMAssertThrowsWithReason(o[prop.name] = nil,\n                                  @\"Invalid value '(null)' of type '(null)' for\");\n    }\n\n    RLMProperty *prop = schema.properties[12];\n    RLMAssertThrowsWithReason(o[prop.name] = @\"str\",\n                              @\"Invalid value 'str' of type '__NSCFConstantString' for 'StringObject?' property 'AllTypesObject.objectCol'.\");\n    XCTAssertNoThrow(o[prop.name] = nil);\n    XCTAssertNoThrow(o[prop.name] = NSNull.null);\n\n    id otherObjectType = [dyrealm createObject:IntObject.className withValue:@[@1]];\n    RLMAssertThrowsWithReason(o[prop.name] = otherObjectType,\n                              @\"Invalid value 'IntObject\");\n\n    [dyrealm cancelWriteTransaction];\n}\n\n- (void)testDynamicAdd {\n    @autoreleasepool {\n        // open realm in autoreleasepool to create tables and then dispose\n        [RLMRealm realmWithURL:RLMTestRealmURL()];\n    }\n\n    RLMRealm *dyrealm = [self realmWithTestPathAndSchema:nil];\n    [dyrealm beginWriteTransaction];\n    id stringObject = [dyrealm createObject:StringObject.className withValue:@[@\"string\"]];\n    [dyrealm createObject:AllTypesObject.className withValue:[AllTypesObject values:0 stringObject:stringObject]];\n    [dyrealm commitWriteTransaction];\n\n    XCTAssertEqual(1U, [dyrealm allObjects:StringObject.className].count);\n    XCTAssertEqual(1U, [dyrealm allObjects:AllTypesObject.className].count);\n}\n\n- (void)testDynamicArray {\n    @autoreleasepool {\n        // open realm in autoreleasepool to create tables and then dispose\n        [RLMRealm realmWithURL:RLMTestRealmURL()];\n    }\n    RLMRealm *dyrealm = [self realmWithTestPathAndSchema:nil];\n    [dyrealm beginWriteTransaction];\n\n    RLMObject *stringObject = [dyrealm createObject:StringObject.className withValue:@[@\"string\"]];\n    RLMObject *stringObject1 = [dyrealm createObject:StringObject.className withValue:@[@\"string1\"]];\n    [dyrealm createObject:ArrayPropertyObject.className withValue:@[@\"name\", @[stringObject, stringObject1], @[]]];\n\n    RLMResults<RLMObject *> *results = [dyrealm allObjects:ArrayPropertyObject.className];\n    XCTAssertEqual(1U, results.count);\n    RLMObject *arrayObj = results.firstObject;\n    RLMArray<RLMObject *> *array = arrayObj[@\"array\"];\n    XCTAssertEqual(2U, array.count);\n    XCTAssertEqualObjects(array[0][@\"stringCol\"], stringObject[@\"stringCol\"]);\n\n    [array removeObjectAtIndex:0];\n    [array addObject:stringObject];\n\n    XCTAssertEqual(2U, array.count);\n    XCTAssertEqualObjects(array[0][@\"stringCol\"], stringObject1[@\"stringCol\"]);\n    XCTAssertEqualObjects(array[1][@\"stringCol\"], stringObject[@\"stringCol\"]);\n\n    arrayObj[@\"array\"] = NSNull.null;\n    XCTAssertEqual(0U, array.count);\n\n    [array addObject:stringObject];\n    XCTAssertEqual(1U, array.count);\n\n    arrayObj[@\"array\"] = nil;\n    XCTAssertEqual(0U, array.count);\n\n    arrayObj[@\"array\"] = @[stringObject, stringObject1];\n    XCTAssertEqualObjects(array[0][@\"stringCol\"], stringObject[@\"stringCol\"]);\n    XCTAssertEqualObjects(array[1][@\"stringCol\"], stringObject1[@\"stringCol\"]);\n\n    [dyrealm commitWriteTransaction];\n}\n\n- (void)testDynamicSet {\n    @autoreleasepool {\n        // open realm in autoreleasepool to create tables and then dispose\n        [RLMRealm realmWithURL:RLMTestRealmURL()];\n    }\n    RLMRealm *dyrealm = [self realmWithTestPathAndSchema:nil];\n    [dyrealm beginWriteTransaction];\n\n    RLMObject *stringObject = [dyrealm createObject:StringObject.className withValue:@[@\"string\"]];\n    RLMObject *stringObject1 = [dyrealm createObject:StringObject.className withValue:@[@\"string1\"]];\n    [dyrealm createObject:SetPropertyObject.className withValue:@[@\"name\", @[stringObject, stringObject1], @[]]];\n\n    RLMResults<RLMObject *> *results = [dyrealm allObjects:SetPropertyObject.className];\n    XCTAssertEqual(1U, results.count);\n    RLMObject *setObj = results.firstObject;\n    RLMSet<RLMObject *> *set = setObj[@\"set\"];\n    XCTAssertEqual(2U, set.count);\n    XCTAssertEqualObjects(set.allObjects[0][@\"stringCol\"], stringObject[@\"stringCol\"]);\n\n    [set addObject:stringObject];\n\n    XCTAssertEqual(2U, set.count);\n    XCTAssertEqualObjects(set.allObjects[0][@\"stringCol\"], stringObject[@\"stringCol\"]);\n    XCTAssertEqualObjects(set.allObjects[1][@\"stringCol\"], stringObject1[@\"stringCol\"]);\n\n    setObj[@\"set\"] = NSNull.null;\n    XCTAssertEqual(0U, set.count);\n\n    [set addObject:stringObject];\n    XCTAssertEqual(1U, set.count);\n\n    setObj[@\"set\"] = nil;\n    XCTAssertEqual(0U, set.count);\n\n    setObj[@\"set\"] = @[stringObject, stringObject1];\n    XCTAssertEqualObjects(set.allObjects[0][@\"stringCol\"], stringObject[@\"stringCol\"]);\n    XCTAssertEqualObjects(set.allObjects[1][@\"stringCol\"], stringObject1[@\"stringCol\"]);\n\n    [dyrealm commitWriteTransaction];\n}\n\n- (void)testDynamicDictionary {\n    @autoreleasepool {\n        // open realm in autoreleasepool to create tables and then dispose\n        [RLMRealm realmWithURL:RLMTestRealmURL()];\n    }\n    RLMRealm *dyrealm = [self realmWithTestPathAndSchema:nil];\n    [dyrealm beginWriteTransaction];\n\n    RLMObject *stringObject = [dyrealm createObject:StringObject.className withValue:@[@\"string\"]];\n    RLMObject *stringObject1 = [dyrealm createObject:StringObject.className withValue:@[@\"string1\"]];\n    [dyrealm createObject:DictionaryPropertyObject.className withValue:@{\n        @\"stringDictionary\": @{@\"0\": stringObject, @\"1\": stringObject1},\n        @\"intObjDictionary\": @{@\"0\": @{@\"intCol\":@0}, @\"1\": @{@\"intCol\":@1}},\n        @\"primitiveStringDictionary\": @{},\n        @\"embeddedDictionary\": @{}\n    }];\n\n    RLMResults<RLMObject *> *results = [dyrealm allObjects:DictionaryPropertyObject.className];\n    XCTAssertEqual(1U, results.count);\n    RLMObject *dictionaryObj = results.firstObject;\n    RLMDictionary<NSString *, RLMObject *> *dictionary = dictionaryObj[@\"stringDictionary\"];\n\n    XCTAssertEqual(2U, dictionary.count);\n    XCTAssertEqualObjects(dictionary[@\"0\"][@\"stringCol\"], stringObject[@\"stringCol\"]);\n    XCTAssertEqualObjects(dictionary[@\"1\"][@\"stringCol\"], stringObject1[@\"stringCol\"]);\n\n    dictionaryObj[@\"stringDictionary\"][@\"0\"] = nil;\n    XCTAssertEqual(1U, dictionary.count);\n\n    dictionaryObj[@\"stringDictionary\"] = @{};\n    XCTAssertEqual(0U, dictionary.count);\n\n    dictionaryObj[@\"stringDictionary\"] = @{@\"0\": stringObject, @\"1\": stringObject1};\n    XCTAssertEqualObjects(dictionary.allValues[0][@\"stringCol\"], stringObject[@\"stringCol\"]);\n    XCTAssertEqualObjects(dictionary.allValues[1][@\"stringCol\"], stringObject1[@\"stringCol\"]);\n\n    [dyrealm commitWriteTransaction];\n}\n\n- (void)testOptionalProperties {\n    @autoreleasepool {\n        // open realm in autoreleasepool to create tables and then dispose\n        [RLMRealm realmWithURL:RLMTestRealmURL()];\n    }\n\n    RLMRealm *dyrealm = [self realmWithTestPathAndSchema:nil];\n    [dyrealm beginWriteTransaction];\n    RLMObject *object = [dyrealm createObject:AllOptionalTypes.className withValue:@[]];\n\n    XCTAssertNil(object[@\"intObj\"]);\n    XCTAssertNil(object[@\"floatObj\"]);\n    XCTAssertNil(object[@\"doubleObj\"]);\n    XCTAssertNil(object[@\"boolObj\"]);\n    XCTAssertNil(object[@\"string\"]);\n    XCTAssertNil(object[@\"data\"]);\n    XCTAssertNil(object[@\"date\"]);\n    XCTAssertNil(object[@\"uuidCol\"]);\n\n    NSDate *date = [NSDate date];\n    NSData *data = [NSData data];\n    NSUUID *uuid = [NSUUID new];\n\n    object[@\"intObj\"] = @1;\n    object[@\"floatObj\"] = @2.2f;\n    object[@\"doubleObj\"] = @3.3;\n    object[@\"boolObj\"] = @YES;\n    object[@\"string\"] = @\"str\";\n    object[@\"date\"] = date;\n    object[@\"data\"] = data;\n    object[@\"uuidCol\"] = uuid;\n\n    XCTAssertEqualObjects(object[@\"intObj\"], @1);\n    XCTAssertEqualObjects(object[@\"floatObj\"], @2.2f);\n    XCTAssertEqualObjects(object[@\"doubleObj\"], @3.3);\n    XCTAssertEqualObjects(object[@\"boolObj\"], @YES);\n    XCTAssertEqualObjects(object[@\"string\"], @\"str\");\n    XCTAssertEqualObjects(object[@\"date\"], date);\n    XCTAssertEqualObjects(object[@\"data\"], data);\n    XCTAssertEqualObjects(object[@\"uuidCol\"], uuid);\n\n    object[@\"intObj\"] = NSNull.null;\n    object[@\"floatObj\"] = NSNull.null;\n    object[@\"doubleObj\"] = NSNull.null;\n    object[@\"boolObj\"] = NSNull.null;\n    object[@\"string\"] = NSNull.null;\n    object[@\"date\"] = NSNull.null;\n    object[@\"data\"] = NSNull.null;\n    object[@\"uuidCol\"] = NSNull.null;\n\n    XCTAssertNil(object[@\"intObj\"]);\n    XCTAssertNil(object[@\"floatObj\"]);\n    XCTAssertNil(object[@\"doubleObj\"]);\n    XCTAssertNil(object[@\"boolObj\"]);\n    XCTAssertNil(object[@\"string\"]);\n    XCTAssertNil(object[@\"data\"]);\n    XCTAssertNil(object[@\"date\"]);\n    XCTAssertNil(object[@\"uuidCol\"]);\n\n    object[@\"intObj\"] = nil;\n    object[@\"floatObj\"] = nil;\n    object[@\"doubleObj\"] = nil;\n    object[@\"boolObj\"] = nil;\n    object[@\"string\"] = nil;\n    object[@\"date\"] = nil;\n    object[@\"data\"] = nil;\n    object[@\"uuidCol\"] = nil;\n\n    XCTAssertNil(object[@\"intObj\"]);\n    XCTAssertNil(object[@\"floatObj\"]);\n    XCTAssertNil(object[@\"doubleObj\"]);\n    XCTAssertNil(object[@\"boolObj\"]);\n    XCTAssertNil(object[@\"string\"]);\n    XCTAssertNil(object[@\"data\"]);\n    XCTAssertNil(object[@\"date\"]);\n    XCTAssertNil(object[@\"uuidCol\"]);\n\n    [dyrealm commitWriteTransaction];\n}\n\n- (void)testLinkingObjects {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    RLMObject *person = [realm createObject:PersonObject.className\n                                  withValue:@[@\"parent\", @10, @[@[@\"child\", @5, @[]]]]];\n    XCTAssertEqual([person[@\"parents\"] count], 0U);\n    RLMObject *child = [person[@\"children\"] firstObject];\n    XCTAssertEqual([child[@\"parents\"] count], 1U);\n    XCTAssertTrue([person isEqualToObject:[child[@\"parents\"] firstObject]]);\n\n    RLMAssertThrowsWithReason(person[@\"parents\"] = @[],\n                              @\"Cannot modify read-only property 'PersonObject.parents'\");\n\n    [realm commitWriteTransaction];\n}\n\n- (void)testDynamicSetEmbeddedLink {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    RLMObject *parent = [realm createObject:@\"EmbeddedIntParentObject\" withValue:@[@1]];\n    XCTAssertNil(parent[@\"object\"]);\n    XCTAssertEqual(0U, [parent[@\"array\"] count]);\n\n    XCTAssertNoThrow(parent[@\"object\"] = @[@1]);\n    XCTAssertEqualObjects(parent[@\"object\"][@\"intCol\"], @1);\n\n    XCTAssertNoThrow(parent[@\"object\"] = nil);\n    XCTAssertNil(parent[@\"object\"]);\n\n    XCTAssertNoThrow(parent[@\"object\"] = @[@1]);\n    XCTAssertNoThrow(parent[@\"object\"] = NSNull.null);\n    XCTAssertNil(parent[@\"object\"]);\n\n    [parent[@\"array\"] addObject:@[@2]];\n    RLMAssertThrowsWithReason(parent[@\"object\"] = [parent[@\"array\"] firstObject],\n                              @\"Cannot set a link to an existing managed embedded object\");\n\n    [realm cancelWriteTransaction];\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/EncryptionTests.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#import \"RLMObjectSchema_Private.h\"\n#import \"RLMRealmConfiguration_Private.h\"\n#import \"RLMRealm_Private.h\"\n#import \"RLMSchema_Private.h\"\n#import \"RLMUtil.hpp\"\n\n@interface EncryptionTests : RLMTestCase\n@end\n\n@implementation EncryptionTests\n\n- (RLMRealmConfiguration *)configurationWithKey:(NSData *)key {\n    RLMRealmConfiguration *configuration = [[RLMRealmConfiguration alloc] init];\n    configuration.fileURL = RLMDefaultRealmURL();\n    configuration.encryptionKey = key;\n    return configuration;\n}\n\n- (RLMRealm *)realmWithKey:(NSData *)key {\n    return [RLMRealm realmWithConfiguration:[self configurationWithKey:key] error:nil];\n}\n\n#pragma mark - Key validation\n\n- (void)testBadEncryptionKeys {\n    XCTAssertThrows([RLMRealm.defaultRealm writeCopyToURL:RLMTestRealmURL() encryptionKey:NSData.data error:nil]);\n}\n\n- (void)testValidEncryptionKeys {\n    XCTAssertNoThrow([RLMRealm.defaultRealm writeCopyToURL:RLMTestRealmURL() encryptionKey:self.nonLiteralNil error:nil]);\n    NSData *key = [[NSMutableData alloc] initWithLength:64];\n    XCTAssertNoThrow([RLMRealm.defaultRealm writeCopyToURL:RLMTestRealmURL() encryptionKey:key error:nil]);\n}\n\n#pragma mark - realmWithURL:\n\n- (void)testReopenWithSameKeyWorks {\n    NSData *key = RLMGenerateKey();\n    @autoreleasepool {\n        RLMRealm *realm = [self realmWithKey:key];\n        [realm transactionWithBlock:^{\n            [IntObject createInRealm:realm withValue:@[@1]];\n        }];\n    }\n\n    @autoreleasepool {\n        RLMRealm *realm = [self realmWithKey:key];\n        XCTAssertEqual(1U, [IntObject allObjectsInRealm:realm].count);\n    }\n}\n\n- (void)testReopenWithNoKeyThrows {\n    @autoreleasepool {\n        [self realmWithKey:RLMGenerateKey()];\n    }\n\n    RLMAssertRealmExceptionContains([self realmWithKey:nil],\n                                    RLMErrorInvalidDatabase,\n                                    @\"Failed to open Realm file at path '%@': header has invalid mnemonic.\",\n                                    RLMDefaultRealmURL().path);\n}\n\n- (void)testReopenWithWrongKeyThrows {\n    @autoreleasepool {\n        [self realmWithKey:RLMGenerateKey()];\n    }\n\n    NSData *key = RLMGenerateKey();\n    RLMAssertRealmExceptionContains([self realmWithKey:key],\n                                    RLMErrorInvalidDatabase,\n                                    @\"Failed to open Realm file at path '%@': Realm file decryption failed (Decryption failed: page 0 in file of size\",\n                                    RLMDefaultRealmURL().path);\n}\n\n- (void)testOpenUnencryptedWithKeyThrows {\n    @autoreleasepool {\n        [self realmWithKey:nil];\n    }\n\n    NSData *key = RLMGenerateKey();\n    RLMAssertRealmExceptionContains([self realmWithKey:key],\n                                    RLMErrorInvalidDatabase,\n                                    @\"Failed to open Realm file at path '%@': Realm file decryption failed (Decryption failed: page 0 in file of size\",\n                                    RLMDefaultRealmURL().path);\n}\n\n- (void)testOpenWithNewKeyWhileAlreadyOpenThrows {\n    [self realmWithKey:RLMGenerateKey()];\n    RLMAssertThrows([self realmWithKey:RLMGenerateKey()],\n                    @\"already opened with different encryption key\");\n}\n\n#pragma mark - writeCopyToURL:\n\n- (void)testWriteCopyToPathWithNoKeyWritesDecrypted {\n    NSData *key = RLMGenerateKey();\n    @autoreleasepool {\n        RLMRealm *realm = [self realmWithKey:key];\n        [realm transactionWithBlock:^{\n            [IntObject createInRealm:realm withValue:@[@1]];\n        }];\n        [realm writeCopyToURL:RLMTestRealmURL() encryptionKey:nil error:nil];\n    }\n\n    @autoreleasepool {\n        RLMRealmConfiguration *config = [self configurationWithKey:nil];\n        config.fileURL = RLMTestRealmURL();\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n        XCTAssertEqual(1U, [IntObject allObjectsInRealm:realm].count);\n    }\n}\n\n- (void)testWriteCopyToPathWithNewKey {\n    NSData *key1 = RLMGenerateKey();\n    NSData *key2 = RLMGenerateKey();\n\n    @autoreleasepool {\n        RLMRealm *realm = [self realmWithKey:key1];\n        [realm transactionWithBlock:^{\n            [IntObject createInRealm:realm withValue:@[@1]];\n        }];\n        [realm writeCopyToURL:RLMTestRealmURL() encryptionKey:key2 error:nil];\n    }\n\n    @autoreleasepool {\n        RLMRealmConfiguration *config = [self configurationWithKey:key2];\n        config.fileURL = RLMTestRealmURL();\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n        XCTAssertEqual(1U, [IntObject allObjectsInRealm:realm].count);\n    }\n}\n\n- (void)testWriteCopyForConfigurationAndKey {\n    NSData *key1 = RLMGenerateKey();\n    NSData *key2 = RLMGenerateKey();\n\n    RLMRealmConfiguration *destinationConfig = [self configurationWithKey:key2];\n    destinationConfig.encryptionKey = key2;\n    destinationConfig.fileURL = RLMTestRealmURL();\n\n    @autoreleasepool {\n        RLMRealm *realm = [self realmWithKey:key1];\n        [realm transactionWithBlock:^{\n            [IntObject createInRealm:realm withValue:@[@1]];\n        }];\n        [realm writeCopyForConfiguration:destinationConfig error:nil];\n    }\n\n    @autoreleasepool {\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:destinationConfig error:nil];\n        XCTAssertEqual(1U, [IntObject allObjectsInRealm:realm].count);\n    }\n}\n\n#pragma mark - Migrations\n\n- (void)createRealmRequiringMigrationWithKey:(NSData *)key migrationRun:(BOOL *)migrationRun {\n    // Create an object schema which requires migration to the shared schema\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:IntObject.class];\n    objectSchema.properties = @[];\n\n    RLMSchema *schema = [[RLMSchema alloc] init];\n    schema.objectSchema = @[objectSchema];\n\n    // Create the Realm file on disk\n    @autoreleasepool {\n        RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n        config.encryptionKey = key;\n        config.customSchema = schema;\n        [RLMRealm realmWithConfiguration:config error:nil];\n    }\n\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.schemaVersion = 1;\n    config.migrationBlock = ^(__unused RLMMigration *migration, __unused uint64_t oldSchemaVersion) {\n        *migrationRun = YES;\n    };\n    [RLMRealmConfiguration setDefaultConfiguration:config];\n}\n\n- (void)testImplicitMigration {\n    NSData *key = RLMGenerateKey();\n    BOOL migrationRan = NO;\n    [self createRealmRequiringMigrationWithKey:key migrationRun:&migrationRan];\n\n    XCTAssertThrows([RLMRealm defaultRealm]);\n    XCTAssertFalse(migrationRan);\n\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.encryptionKey = key;\n    XCTAssertNoThrow([RLMRealm realmWithConfiguration:config error:nil]);\n    XCTAssertTrue(migrationRan);\n}\n\n- (void)testExplicitMigration {\n    NSData *key = RLMGenerateKey();\n    __block BOOL migrationRan = NO;\n    [self createRealmRequiringMigrationWithKey:key migrationRun:&migrationRan];\n\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.schemaVersion = 1;\n    configuration.migrationBlock = ^(__unused RLMMigration *migration, __unused uint64_t oldSchemaVersion) {\n        migrationRan = YES;\n    };\n\n    XCTAssertFalse([RLMRealm performMigrationForConfiguration:configuration error:nil]);\n    XCTAssertFalse(migrationRan);\n\n    configuration.encryptionKey = key;\n    XCTAssertTrue([RLMRealm performMigrationForConfiguration:configuration error:nil]);\n    XCTAssertTrue(migrationRan);\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/EnumeratorTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n@interface EnumeratorTests : RLMTestCase\n@end\n\n@implementation EnumeratorTests\n\n- (void)testEnum\n{\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    RLMResults *emptyPeople = [EmployeeObject allObjects];\n\n    // Enum for zero rows added\n    for (EmployeeObject *row in emptyPeople) {\n        XCTFail(@\"No objects should have been added %@\", row);\n    }\n\n    NSArray *rowsArray = @[@{@\"name\": @\"John\", @\"age\": @20, @\"hired\": @YES},\n                           @{@\"name\": @\"Mary\", @\"age\": @21, @\"hired\": @NO},\n                           @{@\"name\": @\"Lars\", @\"age\": @21, @\"hired\": @YES},\n                           @{@\"name\": @\"Phil\", @\"age\": @43, @\"hired\": @NO},\n                           @{@\"name\": @\"Anni\", @\"age\": @54, @\"hired\": @YES}];\n\n\n    // Add objects\n    [realm beginWriteTransaction];\n    for (NSArray *rowArray in rowsArray) {\n        [EmployeeObject createInRealm:realm withValue:rowArray];\n    }\n    [realm commitWriteTransaction];\n\n    // Get all objects\n    RLMResults *people = [EmployeeObject allObjects];\n\n    // Iterate using for...in\n    NSUInteger index = 0;\n    for (EmployeeObject *row in people) {\n        XCTAssertEqualObjects(row.name, rowsArray[index][@\"name\"], @\"Name in iteration should be equal to what was set.\");\n        XCTAssertEqualObjects(@(row.age), rowsArray[index][@\"age\"], @\"Age in iteration should be equal to what was set.\");\n        XCTAssertEqualObjects(@(row.hired), rowsArray[index][@\"hired\"], @\"Hired in iteration should be equal to what was set.\");\n        index++;\n    }\n\n    NSPredicate *pred = [NSPredicate predicateWithFormat:@\"hired = YES && age BETWEEN {20, 30}\"];\n    NSArray *filteredArray = [rowsArray filteredArrayUsingPredicate:pred];\n\n    // Do a query, and get all matches as RLMResults\n    RLMResults *res = [EmployeeObject objectsWithPredicate:pred];\n\n    // Iterate over the resulting RLMResults\n    index = 0;\n    for (EmployeeObject *row in res) {\n        XCTAssertEqualObjects(row.name, filteredArray[index][@\"name\"], @\"Name in iteration should be equal to what was set.\");\n        XCTAssertEqualObjects(@(row.age), filteredArray[index][@\"age\"], @\"Age in iteration should be equal to what was set.\");\n        XCTAssertEqualObjects(@(row.hired), filteredArray[index][@\"hired\"], @\"Hired in iteration should be equal to what was set.\");\n        index++;\n    }\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/InterprocessTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMMultiProcessTestCase.h\"\n\n#import \"RLMConstants.h\"\n\n#if TARGET_OS_OSX && !TARGET_OS_MACCATALYST\n\n@interface InterprocessTest : RLMMultiProcessTestCase\n@end\n\n@implementation InterprocessTest\n- (void)setUp {\n    [super setUp];\n\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.objectClasses = @[IntObject.class, DoubleObject.class];\n    [RLMRealmConfiguration setDefaultConfiguration:config];\n}\n\n- (void)testCreateInitialRealmInChild {\n    if (self.isParent) {\n        RLMRunChildAndWait();\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        XCTAssertEqual(1U, [IntObject allObjectsInRealm:realm].count);\n    }\n    else {\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm beginWriteTransaction];\n        [IntObject createInRealm:realm withValue:@[@0]];\n        [realm commitWriteTransaction];\n    }\n}\n\n- (void)testCreateInitialRealmInParent {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    if (self.isParent) {\n        [realm beginWriteTransaction];\n        [IntObject createInRealm:realm withValue:@[@0]];\n        [realm commitWriteTransaction];\n\n        RLMRunChildAndWait();\n    }\n    else {\n        XCTAssertEqual(1U, [IntObject allObjectsInRealm:realm].count);\n    }\n}\n\n- (void)testCompactOnLaunchSuccessful {\n    if (self.isParent) {\n        @autoreleasepool {\n            RLMRealm *realm = RLMRealm.defaultRealm;\n            [realm transactionWithBlock:^{\n                for (int i = 0; i < 1000; ++i) {\n                    [IntObject createInRealm:realm withValue:@[@(i)]];\n                }\n            }];\n            [realm transactionWithBlock:^{\n                [realm deleteAllObjects];\n            }];\n        }\n        RLMRunChildAndWait(); // runs the event loop\n    } else {\n        unsigned long long (^fileSize)(NSString *) = ^unsigned long long(NSString *path) {\n            NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil];\n            return [(NSNumber *)attributes[NSFileSize] unsignedLongLongValue];\n        };\n\n        RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n        config.shouldCompactOnLaunch = ^BOOL(__unused NSUInteger totalBytes, __unused NSUInteger usedBytes){\n            return YES;\n        };\n        unsigned long long sizeBefore = fileSize(config.fileURL.path);\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n        unsigned long long sizeAfter = fileSize(config.fileURL.path);\n        XCTAssertGreaterThan(sizeBefore, sizeAfter);\n        XCTAssertTrue(realm.isEmpty);\n    }\n}\n\n- (void)testCompactOnLaunchBeginWriteFailed {\n    if (self.isParent) {\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm beginWriteTransaction];\n        RLMRunChildAndWait(); // runs the event loop\n        [realm cancelWriteTransaction];\n    } else {\n        unsigned long long (^fileSize)(NSString *) = ^unsigned long long(NSString *path) {\n            NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil];\n            return [(NSNumber *)attributes[NSFileSize] unsignedLongLongValue];\n        };\n\n        RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n        config.shouldCompactOnLaunch = ^BOOL(__unused NSUInteger totalBytes, __unused NSUInteger usedBytes){\n            return YES;\n        };\n        unsigned long long sizeBefore = fileSize(config.fileURL.path);\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n        unsigned long long sizeAfter = fileSize(config.fileURL.path);\n        XCTAssertEqual(sizeBefore, sizeAfter);\n        XCTAssertTrue(realm.isEmpty);\n    }\n}\n\n- (void)testCompactOnLaunchFailSilently {\n    if (self.isParent) {\n        RLMRealm *realm  = [RLMRealm defaultRealm];\n        RLMRunChildAndWait(); // runs the event loop\n        (void)[realm configuration]; // ensure the Realm stays open while the child process runs\n    } else {\n        unsigned long long (^fileSize)(NSString *) = ^unsigned long long(NSString *path) {\n            NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil];\n            return [(NSNumber *)attributes[NSFileSize] unsignedLongLongValue];\n        };\n\n        __block BOOL blockCalled = NO;\n\n        RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n        config.shouldCompactOnLaunch = ^BOOL(__unused NSUInteger totalBytes, __unused NSUInteger usedBytes){\n            blockCalled = YES;\n            return YES;\n        };\n        unsigned long long sizeBefore = fileSize(config.fileURL.path);\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n        unsigned long long sizeAfter = fileSize(config.fileURL.path);\n        XCTAssertLessThanOrEqual(sizeBefore, sizeAfter);\n        XCTAssertTrue(realm.isEmpty);\n        XCTAssertTrue(blockCalled);\n    }\n}\n\n- (void)testOpenInParentThenAddObjectInChild {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    XCTAssertEqual(0U, [IntObject allObjectsInRealm:realm].count);\n\n    if (self.isParent) {\n        RLMRunChildAndWait(); // runs the event loop\n        XCTAssertEqual(1U, [IntObject allObjectsInRealm:realm].count);\n    }\n    else {\n        [realm beginWriteTransaction];\n        [IntObject createInRealm:realm withValue:@[@0]];\n        [realm commitWriteTransaction];\n    }\n}\n\n- (void)testOpenInParentThenAddObjectInChildWithoutAutorefresh {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    realm.autorefresh = NO;\n    XCTAssertEqual(0U, [IntObject allObjectsInRealm:realm].count);\n\n    if (self.isParent) {\n        RLMRunChildAndWait();\n        XCTAssertEqual(0U, [IntObject allObjectsInRealm:realm].count);\n        [realm refresh];\n        XCTAssertEqual(1U, [IntObject allObjectsInRealm:realm].count);\n    }\n    else {\n        [realm beginWriteTransaction];\n        [IntObject createInRealm:realm withValue:@[@0]];\n        [realm commitWriteTransaction];\n    }\n}\n\n- (void)testOpenInParentThenAddObjectInChildWithNoChanceToAutorefresh {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    XCTAssertEqual(0U, [IntObject allObjectsInRealm:realm].count);\n\n    if (self.isParent) {\n        // Wait on a different thread so that this thread doesn't get the chance\n        // to autorefresh\n        [self dispatchAsyncAndWait:^{\n            RLMRunChildAndWait();\n        }];\n\n        XCTAssertEqual(0U, [IntObject allObjectsInRealm:realm].count);\n        [realm refresh];\n        XCTAssertEqual(1U, [IntObject allObjectsInRealm:realm].count);\n    }\n    else {\n        [realm beginWriteTransaction];\n        [IntObject createInRealm:realm withValue:@[@0]];\n        [realm commitWriteTransaction];\n    }\n}\n\n- (void)testChangeInChildTriggersNotificationInParent {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    XCTAssertEqual(0U, [IntObject allObjectsInRealm:realm].count);\n\n    if (self.isParent) {\n        [self waitForNotification:RLMRealmDidChangeNotification realm:realm block:^{\n            RLMRunChildAndWait();\n        }];\n        XCTAssertEqual(1U, [IntObject allObjectsInRealm:realm].count);\n    }\n    else {\n        [realm beginWriteTransaction];\n        [IntObject createInRealm:realm withValue:@[@0]];\n        [realm commitWriteTransaction];\n    }\n}\n\n- (void)testBackgroundProcessDoesNotTriggerSpuriousNotifications {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    RLMNotificationToken *token = [realm addNotificationBlock:^(__unused RLMNotification notification, __unused RLMRealm *realm) {\n        XCTFail(@\"Notification should not have been triggered\");\n    }];\n\n    if (self.isParent) {\n        RLMRunChildAndWait();\n    }\n    else {\n        // Just a meaningless thing that reads from the realm\n        XCTAssertEqual(0U, [IntObject allObjectsInRealm:realm].count);\n    }\n\n    [token invalidate];\n}\n\n// FIXME: Re-enable this test when it can be made to pass reliably.\n- (void)DISABLED_testShareInMemoryRealm {\n    RLMRealm *realm = [self inMemoryRealmWithIdentifier:@\"test\"];\n    XCTAssertEqual(0U, [IntObject allObjectsInRealm:realm].count);\n\n    if (self.isParent) {\n        [self waitForNotification:RLMRealmDidChangeNotification realm:realm block:^{\n            RLMRunChildAndWait();\n        }];\n        XCTAssertEqual(1U, [IntObject allObjectsInRealm:realm].count);\n    }\n    else {\n        [realm beginWriteTransaction];\n        [IntObject createInRealm:realm withValue:@[@0]];\n        [realm commitWriteTransaction];\n    }\n}\n\n- (void)testBidirectionalCommunication {\n    const int stopValue = 100;\n\n    RLMRealm *realm = [self inMemoryRealmWithIdentifier:@\"test\"];\n    [realm beginWriteTransaction];\n    IntObject *obj = [IntObject allObjectsInRealm:realm].firstObject;\n    if (!obj) {\n        obj = [IntObject createInRealm:realm withValue:@[@0]];\n        [realm commitWriteTransaction];\n    }\n    else {\n        [realm cancelWriteTransaction];\n    }\n\n    RLMNotificationToken *token = [realm addNotificationBlock:^(__unused NSString *note, __unused RLMRealm *realm) {\n        if (obj.intCol % 2 == self.isParent && obj.intCol < stopValue) {\n            [realm transactionWithBlock:^{\n                obj.intCol++;\n            }];\n        }\n    }];\n\n    if (self.isParent) {\n        dispatch_queue_t queue = dispatch_queue_create(\"background\", 0);\n        dispatch_async(queue, ^{ RLMRunChildAndWait(); });\n        while (obj.intCol < stopValue) {\n            [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];\n        }\n        dispatch_sync(queue, ^{});\n    }\n    else {\n        [realm transactionWithBlock:^{\n            obj.intCol++;\n        }];\n        while (obj.intCol < stopValue) {\n            [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];\n        }\n    }\n\n    [token invalidate];\n}\n\n- (void)testManyWriters {\n    const int stopValue = 100;\n    const int workers = 10;\n    const RLMRealm *realm = RLMRealm.defaultRealm;\n\n    if (self.isParent) {\n        [realm beginWriteTransaction];\n        IntObject *obj = [IntObject createInDefaultRealmWithValue:@[@(-workers)]];\n        [realm commitWriteTransaction];\n\n        dispatch_queue_t queue = dispatch_queue_create(\"queue\", DISPATCH_QUEUE_CONCURRENT);\n        for (int i = 0; i < workers; ++i) {\n            dispatch_async(queue, ^{ RLMRunChildAndWait(); });\n        }\n        dispatch_barrier_sync(queue, ^{});\n\n        [realm refresh];\n        XCTAssertEqual(stopValue, obj.intCol);\n        XCTAssertEqual(stopValue, [DoubleObject allObjects].count);\n        XCTAssertEqual(stopValue / 2 + 1, [[DoubleObject.allObjects minOfProperty:@\"doubleCol\"] intValue]);\n        return;\n    }\n\n    // Run the run loop until someone else makes a commit\n    dispatch_block_t waitForExternalChange = ^{\n        RLMNotificationToken *token = [realm addNotificationBlock:^(__unused NSString *note, __unused RLMRealm *realm) {\n            CFRunLoopStop(CFRunLoopGetCurrent());\n        }];\n        CFRunLoopRun();\n        [token invalidate];\n    };\n\n    IntObject *obj = [IntObject allObjects].firstObject;\n    int nextRun = -1;\n\n    // Wait for all of the workers to start up\n    while (obj.intCol < 0) {\n        if (nextRun == -1) {\n            [realm beginWriteTransaction];\n            ++obj.intCol;\n            [realm commitWriteTransaction];\n            nextRun = 0;\n        }\n        waitForExternalChange();\n    }\n\n    while (true) {\n        // Wait for someone else to run if it's not our turn yet\n        if (obj.intCol < nextRun && nextRun < 100) {\n            waitForExternalChange();\n            continue;\n        }\n\n        [realm beginWriteTransaction];\n        if (obj.intCol == stopValue) {\n            [realm commitWriteTransaction];\n            break;\n        }\n\n        ++obj.intCol;\n\n        // Do some stuff\n        [DoubleObject createInDefaultRealmWithValue:@[@(obj.intCol)]];\n        [DoubleObject createInDefaultRealmWithValue:@[@(obj.intCol)]];\n        RLMResults *min = [DoubleObject objectsWhere:@\"doubleCol = %@\", [DoubleObject.allObjects minOfProperty:@\"doubleCol\"]];\n        [realm deleteObject:min.firstObject];\n        [realm commitWriteTransaction];\n\n        // Wait for a random number of other workers to do some work to avoid\n        // having a strict order that processes run in and to avoid having a\n        // single process do everything\n        nextRun = obj.intCol + arc4random() % 10;\n    }\n}\n\n- (void)testRecoverAfterCrash {\n    if (self.isParent) {\n        [self runChildAndWait];\n        RLMRealm *realm = RLMRealm.defaultRealm;\n        [realm beginWriteTransaction];\n        [IntObject createInRealm:realm withValue:@[@0]];\n        [realm commitWriteTransaction];\n        XCTAssertEqual(1U, [IntObject allObjects].count);\n    }\n    else {\n        RLMRealm *realm = RLMRealm.defaultRealm;\n        [realm beginWriteTransaction];\n        _Exit(1);\n    }\n}\n\n- (void)testRecoverAfterCrashWithFileAlreadyOpen {\n    if (self.isParent) {\n        RLMRealm *realm = RLMRealm.defaultRealm;\n        [self runChildAndWait];\n        [realm beginWriteTransaction];\n        [IntObject createInRealm:realm withValue:@[@0]];\n        [realm commitWriteTransaction];\n        XCTAssertEqual(1U, [IntObject allObjects].count);\n    }\n    else {\n        RLMRealm *realm = RLMRealm.defaultRealm;\n        [realm beginWriteTransaction];\n        _Exit(1);\n    }\n}\n\n- (void)testCanOpenAndReadWhileOtherProcessHoldsWriteLock {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    if (self.isParent) {\n        [realm beginWriteTransaction];\n        RLMRunChildAndWait();\n        [realm commitWriteTransaction];\n    }\n    else {\n        XCTAssertEqual(0U, [IntObject allObjectsInRealm:realm].count);\n    }\n}\n\n@end\n\n#endif\n"
  },
  {
    "path": "Realm/Tests/KVOTests.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMObjectStore.h\"\n#import \"RLMObject_Private.hpp\"\n#import \"RLMRealmConfiguration_Private.hpp\"\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMSchema_Private.h\"\n\n#import <atomic>\n#import <memory>\n#import <objc/runtime.h>\n#import <vector>\n\nRLM_COLLECTION_TYPE(KVOObject)\nRLM_COLLECTION_TYPE(KVOLinkObject1)\n\n@interface KVOObject : RLMObject\n@property int pk; // Primary key for isEqual:\n@property int ignored;\n\n@property BOOL                 boolCol;\n@property int16_t              int16Col;\n@property int32_t              int32Col;\n@property int64_t              int64Col;\n@property float                floatCol;\n@property double               doubleCol;\n@property bool                 cBoolCol;\n@property NSString            *stringCol;\n@property NSData              *binaryCol;\n@property NSDate              *dateCol;\n@property RLMObjectId         *objectIdCol;\n@property RLMDecimal128       *decimal128Col;\n@property NSUUID              *uuidCol;\n@property id<RLMValue>         anyCol;\n\n@property KVOObject           *objectCol;\n\n@property RLMArray<RLMBool>       *boolArray;\n@property RLMArray<RLMInt>        *intArray;\n@property RLMArray<RLMFloat>      *floatArray;\n@property RLMArray<RLMDouble>     *doubleArray;\n@property RLMArray<RLMString>     *stringArray;\n@property RLMArray<RLMData>       *dataArray;\n@property RLMArray<RLMDate>       *dateArray;\n@property RLMArray<RLMObjectId>   *objectIdArray;\n@property RLMArray<RLMDecimal128> *decimal128Array;\n@property RLMArray<RLMUUID>       *uuidArray;\n@property RLMArray<RLMValue>      *anyArray;\n@property RLMArray<KVOObject>     *objectArray;\n\n@property RLMSet<RLMBool>       *boolSet;\n@property RLMSet<RLMInt>        *intSet;\n@property RLMSet<RLMFloat>      *floatSet;\n@property RLMSet<RLMDouble>     *doubleSet;\n@property RLMSet<RLMString>     *stringSet;\n@property RLMSet<RLMData>       *dataSet;\n@property RLMSet<RLMDate>       *dateSet;\n@property RLMSet<RLMObjectId>   *objectIdSet;\n@property RLMSet<RLMDecimal128> *decimal128Set;\n@property RLMSet<RLMUUID>       *uuidSet;\n@property RLMSet<RLMValue>      *anySet;\n@property RLMSet<KVOObject>     *objectSet;\n\n@property RLMDictionary<NSString *, NSNumber *><RLMString, RLMBool>       *boolDictionary;\n@property RLMDictionary<NSString *, NSNumber *><RLMString, RLMInt>        *intDictionary;\n@property RLMDictionary<NSString *, NSNumber *><RLMString, RLMFloat>      *floatDictionary;\n@property RLMDictionary<NSString *, NSNumber *><RLMString, RLMDouble>     *doubleDictionary;\n@property RLMDictionary<NSString *, NSString *><RLMString, RLMString>     *stringDictionary;\n@property RLMDictionary<NSString *, NSData *><RLMString, RLMData>         *dataDictionary;\n@property RLMDictionary<NSString *, NSDate *><RLMString, RLMDate>         *dateDictionary;\n@property RLMDictionary<NSString *, RLMObjectId *><RLMString, RLMObjectId>     *objectIdDictionary;\n@property RLMDictionary<NSString *, RLMDecimal128 *><RLMString, RLMDecimal128> *decimal128Dictionary;\n@property RLMDictionary<NSString *, NSUUID *><RLMString, RLMUUID>         *uuidDictionary;\n@property RLMDictionary<NSString *, NSObject *><RLMString, RLMValue>      *anyDictionary;\n@property RLMDictionary<NSString *, KVOObject *><RLMString, KVOObject>    *objectDictionary;\n\n@property NSNumber<RLMInt>    *optIntCol;\n@property NSNumber<RLMFloat>  *optFloatCol;\n@property NSNumber<RLMDouble> *optDoubleCol;\n@property NSNumber<RLMBool>   *optBoolCol;\n@end\n@implementation KVOObject\n+ (NSString *)primaryKey {\n    return @\"pk\";\n}\n+ (NSArray *)ignoredProperties {\n    return @[@\"ignored\"];\n}\n@end\n\n@interface KVOLinkObject1 : RLMObject\n@property int pk; // Primary key for isEqual:\n@property KVOObject *obj;\n@property RLMArray<KVOObject> *array;\n@property RLMSet<KVOObject> *set;\n@end\n@implementation KVOLinkObject1\n+ (NSString *)primaryKey {\n    return @\"pk\";\n}\n@end\n\n@interface KVOLinkObject2 : RLMObject\n@property int pk; // Primary key for isEqual:\n@property KVOLinkObject1 *obj;\n@property RLMArray<KVOLinkObject1> *array;\n@property RLMSet<KVOLinkObject1> *set;\n@property RLMDictionary<NSString *, KVOLinkObject1 *><RLMString, KVOLinkObject1> *dictionary;\n@end\n@implementation KVOLinkObject2\n+ (NSString *)primaryKey {\n    return @\"pk\";\n}\n@end\n\n@interface PlainKVOObject : NSObject\n@property int ignored;\n\n@property BOOL            boolCol;\n@property int16_t         int16Col;\n@property int32_t         int32Col;\n@property int64_t         int64Col;\n@property float           floatCol;\n@property double          doubleCol;\n@property bool            cBoolCol;\n@property NSString       *stringCol;\n@property NSData         *binaryCol;\n@property NSDate         *dateCol;\n@property PlainKVOObject *objectCol;\n@property RLMObjectId    *objectIdCol;\n@property RLMDecimal128  *decimal128Col;\n@property NSUUID         *uuidCol;\n@property id<RLMValue>    anyCol;\n\n@property NSMutableArray *boolArray;\n@property NSMutableArray *intArray;\n@property NSMutableArray *floatArray;\n@property NSMutableArray *doubleArray;\n@property NSMutableArray *stringArray;\n@property NSMutableArray *dataArray;\n@property NSMutableArray *dateArray;\n@property NSMutableArray *objectArray;\n@property NSMutableArray *objectIdArray;\n@property NSMutableArray *decimal128Array;\n@property NSMutableArray *uuidArray;\n@property NSMutableArray *anyArray;\n\n@property NSMutableSet *boolSet;\n@property NSMutableSet *intSet;\n@property NSMutableSet *floatSet;\n@property NSMutableSet *doubleSet;\n@property NSMutableSet *stringSet;\n@property NSMutableSet *dataSet;\n@property NSMutableSet *dateSet;\n@property NSMutableSet *objectSet;\n@property NSMutableSet *objectIdSet;\n@property NSMutableSet *decimal128Set;\n@property NSMutableSet *uuidSet;\n@property NSMutableSet *anySet;\n\n@property NSMutableDictionary *boolDictionary;\n@property NSMutableDictionary *intDictionary;\n@property NSMutableDictionary *floatDictionary;\n@property NSMutableDictionary *doubleDictionary;\n@property NSMutableDictionary *stringDictionary;\n@property NSMutableDictionary *dataDictionary;\n@property NSMutableDictionary *dateDictionary;\n@property NSMutableDictionary *objectDictionary;\n@property NSMutableDictionary *objectIdDictionary;\n@property NSMutableDictionary *decimal128Dictionary;\n@property NSMutableDictionary *uuidDictionary;\n@property NSMutableDictionary *anyDictionary;\n\n@property NSNumber<RLMInt> *optIntCol;\n@property NSNumber<RLMFloat> *optFloatCol;\n@property NSNumber<RLMDouble> *optDoubleCol;\n@property NSNumber<RLMBool> *optBoolCol;\n@end\n@implementation PlainKVOObject\n@end\n\n@interface PlainLinkObject1 : NSObject\n@property PlainKVOObject *obj;\n@property NSMutableArray *array;\n@property NSMutableSet *set;\n@property NSMutableDictionary *dictionary;\n@end\n@implementation PlainLinkObject1\n@end\n\n@interface PlainLinkObject2 : NSObject\n@property PlainLinkObject1 *obj;\n@property NSMutableArray *array;\n@property NSMutableSet *set;\n@property NSMutableDictionary *dictionary;\n@end\n@implementation PlainLinkObject2\n@end\n\n// Tables with no links (or backlinks) preserve the order of rows on\n// insertion/deletion, while tables with links do not, so we need an object\n// class known to have no links to test the ordered case\n@interface ObjectWithNoLinksToOrFrom : RLMObject\n@property int value;\n@end\n@implementation ObjectWithNoLinksToOrFrom\n@end\n\n// An object which removes a KVO registration when it's deallocated, for use\n// as an associated object\n@interface KVOUnregisterHelper : NSObject\n@end\n@implementation KVOUnregisterHelper {\n    __unsafe_unretained id _obj;\n    __unsafe_unretained id _observer;\n    NSString *_keyPath;\n}\n\n+ (void)automaticallyUnregister:(id)observer object:(id)obj keyPath:(NSString *)keyPath {\n    KVOUnregisterHelper *helper = [self new];\n    helper->_observer = observer;\n    helper->_obj = obj;\n    helper->_keyPath = keyPath;\n    objc_setAssociatedObject(obj, (__bridge void *)helper, helper, OBJC_ASSOCIATION_RETAIN);\n}\n\n- (void)dealloc {\n    [_obj removeObserver:_observer forKeyPath:_keyPath];\n}\n@end\n\n// A KVO observer which retains the given object until it observes a change\n@interface ReleaseOnObservation : NSObject\n@property (strong) id object;\n@end\n@implementation ReleaseOnObservation\n- (void)observeValueForKeyPath:(NSString *)keyPath\n                      ofObject:(id)object\n                        change:(__unused NSDictionary *)change\n                       context:(void *)context\n{\n    [object removeObserver:self forKeyPath:keyPath context:context];\n    _object = nil;\n}\n@end\n\n@interface KVOTests : RLMTestCase\n// get an object that should be observed for the given object being mutated\n// used by some of the subclasses to observe a different accessor for the same row\n- (id)observableForObject:(id)obj;\n@end\n\n// subscribes to kvo notifications on the passed object on creation, records\n// all change notifications sent and makes them available in `notifications`,\n// and automatically unsubscribes on destruction\nclass KVORecorder {\n    id _observer;\n    id _obj;\n    NSString *_keyPath;\n    RLMRealm *_mutationRealm;\n    RLMRealm *_observationRealm;\n    NSMutableArray *_notifications;\n\npublic:\n    // construct a new recorder for the given `keyPath` on `obj`, using `observer`\n    // as the NSObject helper to actually add as an observer\n    KVORecorder(id observer, id obj, NSString *keyPath,\n                int options = NSKeyValueObservingOptionOld|NSKeyValueObservingOptionNew)\n    : _observer(observer)\n    , _obj([observer observableForObject:obj])\n    , _keyPath(keyPath)\n    , _mutationRealm([obj respondsToSelector:@selector(realm)] ? (RLMRealm *)[obj realm] : nil)\n    , _observationRealm([_obj respondsToSelector:@selector(realm)] ? (RLMRealm *)[_obj realm] : nil)\n    , _notifications([NSMutableArray new])\n    {\n        [_obj addObserver:observer forKeyPath:keyPath options:options context:this];\n    }\n\n    ~KVORecorder() {\n        @try {\n            [_obj removeObserver:_observer forKeyPath:_keyPath context:this];\n        }\n        @catch (NSException *e) {\n            XCTFail(@\"%@\", e.description);\n        }\n        XCTAssertEqual(0U, _notifications.count);\n    }\n\n    // record a single notification\n    void operator()(NSString *key, id obj, NSDictionary *changeDictionary) {\n        XCTAssertEqual(obj, _obj);\n        XCTAssertEqualObjects(key, _keyPath);\n        [_notifications addObject:[NSDictionary dictionaryWithDictionary:changeDictionary]];\n    }\n\n    // ensure that the observed object is updated for any changes made to the\n    // object being mutated if they are different\n    void refresh() {\n        if (_mutationRealm != _observationRealm) {\n            [_mutationRealm commitWriteTransaction];\n            [_observationRealm refresh];\n            [_mutationRealm beginWriteTransaction];\n        }\n    }\n\n    NSDictionary *pop_front() {\n        NSDictionary *value = [_notifications firstObject];\n        if (value) {\n            [_notifications removeObjectAtIndex:0U];\n        }\n        return value;\n    }\n\n    NSUInteger size() const {\n        return _notifications.count;\n    }\n\n    bool empty() const {\n        return _notifications.count == 0;\n    }\n};\n\n// Assert that `recorder` has a notification at `index` and return it if so\n#define AssertNotification(recorder) ([&]{ \\\n    (recorder).refresh(); \\\n    NSDictionary *value = recorder.pop_front(); \\\n    XCTAssertNotNil(value, @\"Did not get a notification when expected\"); \\\n    return value; \\\n})()\n\n// Validate that `recorder` has at least one notification, and that the first\n// notification is the expected one\n#define AssertChanged(recorder, from, to) do { \\\n    if (NSDictionary *note = AssertNotification((recorder))) { \\\n        XCTAssertEqualObjects(@(NSKeyValueChangeSetting), note[NSKeyValueChangeKindKey]); \\\n        XCTAssertEqualObjects((from), note[NSKeyValueChangeOldKey]); \\\n        XCTAssertEqualObjects((to), note[NSKeyValueChangeNewKey]); \\\n    } \\\n    else { \\\n        return; \\\n    } \\\n} while (false)\n\n#define AssertCollectionChanged(s) do { \\\n    AssertNotification(r); \\\n    XCTAssertTrue(r.empty()); \\\n} while (false)\n\n// Validate that `r` has a notification with the given kind and changed indexes,\n// remove it, and verify that there are no more notifications\n#define AssertIndexChange(kind, indexes) do { \\\n    if (NSDictionary *note = AssertNotification(r)) { \\\n        XCTAssertEqual([note[NSKeyValueChangeKindKey] intValue], static_cast<int>(kind)); \\\n        XCTAssertEqualObjects(note[NSKeyValueChangeIndexesKey], indexes); \\\n    } \\\n    XCTAssertTrue(r.empty()); \\\n} while (0)\n\n// Tests for plain Foundation key-value observing to verify that we correctly\n// match the standard semantics. Each of the subclasses of KVOTests runs the\n// same set of tests on RLMObjects in difference scenarios\n@implementation KVOTests\n// forward a KVO notification to the KVORecorder stored in the context\n- (void)observeValueForKeyPath:(NSString *)keyPath\n                      ofObject:(id)object\n                        change:(NSDictionary *)change\n                       context:(void *)context\n{\n    (*static_cast<KVORecorder *>(context))(keyPath, object, change);\n}\n\n// overridden in the multiple accessors, one realm and multiple realms cases\n- (id)observableForObject:(id)obj {\n    return obj;\n}\n\n// overridden in the multiple realms case because `-refresh` does not send\n// notifications for intermediate states\n- (bool)collapsesNotifications {\n    return false;\n}\n\n// overridden in all subclases to return the appropriate object\n// base class runs the tests on a plain NSObject using stock KVO to ensure that\n// the tests are actually covering the correct behavior, since there's a great\n// deal that the documentation doesn't specify\n- (id)createObject {\n    PlainKVOObject *obj = [PlainKVOObject new];\n    obj.int16Col = 1;\n    obj.int32Col = 2;\n    obj.int64Col = 3;\n    obj.binaryCol = NSData.data;\n    obj.stringCol = @\"\";\n    obj.dateCol = [NSDate dateWithTimeIntervalSinceReferenceDate:0];\n    obj.boolArray = [NSMutableArray array];\n    obj.intArray = [NSMutableArray array];\n    obj.floatArray = [NSMutableArray array];\n    obj.doubleArray = [NSMutableArray array];\n    obj.stringArray = [NSMutableArray array];\n    obj.dataArray = [NSMutableArray array];\n    obj.dateArray = [NSMutableArray array];\n    obj.objectIdArray = [NSMutableArray array];\n    obj.decimal128Array = [NSMutableArray array];\n    obj.objectArray = [NSMutableArray array];\n    obj.uuidArray = [NSMutableArray array];\n    obj.anyArray = [NSMutableArray array];\n\n    obj.boolSet = [NSMutableSet set];\n    obj.intSet = [NSMutableSet set];\n    obj.floatSet = [NSMutableSet set];\n    obj.doubleSet = [NSMutableSet set];\n    obj.stringSet = [NSMutableSet set];\n    obj.dataSet = [NSMutableSet set];\n    obj.dateSet = [NSMutableSet set];\n    obj.objectIdSet = [NSMutableSet set];\n    obj.decimal128Set = [NSMutableSet set];\n    obj.objectSet = [NSMutableSet set];\n    obj.uuidSet = [NSMutableSet set];\n    obj.anySet = [NSMutableSet set];\n\n    obj.boolDictionary = [NSMutableDictionary dictionary];\n    obj.intDictionary = [NSMutableDictionary dictionary];\n    obj.floatDictionary = [NSMutableDictionary dictionary];\n    obj.doubleDictionary = [NSMutableDictionary dictionary];\n    obj.stringDictionary = [NSMutableDictionary dictionary];\n    obj.dataDictionary = [NSMutableDictionary dictionary];\n    obj.dateDictionary = [NSMutableDictionary dictionary];\n    obj.objectIdDictionary = [NSMutableDictionary dictionary];\n    obj.decimal128Dictionary = [NSMutableDictionary dictionary];\n    obj.objectDictionary = [NSMutableDictionary dictionary];\n    obj.uuidDictionary = [NSMutableDictionary dictionary];\n    obj.anyDictionary = [NSMutableDictionary dictionary];\n    return obj;\n}\n\n- (id)createLinkObject {\n    PlainLinkObject1 *obj1 = [PlainLinkObject1 new];\n    obj1.obj = [self createObject];\n    obj1.array = [NSMutableArray new];\n    obj1.set = [NSMutableSet new];\n    obj1.dictionary = [NSMutableDictionary new];\n\n    PlainLinkObject2 *obj2 = [PlainLinkObject2 new];\n    obj2.obj = obj1;\n    obj2.array = [NSMutableArray new];\n    obj2.set = [NSMutableSet new];\n    obj2.dictionary = [NSMutableDictionary new];\n\n    return obj2;\n}\n\n// actual tests follow\n\n- (void)testRegisterForUnknownProperty {\n    KVOObject *obj = [self createObject];\n\n    XCTAssertNoThrow([obj addObserver:self forKeyPath:@\"non-existent\" options:0 context:nullptr]);\n    XCTAssertNoThrow([obj removeObserver:self forKeyPath:@\"non-existent\"]);\n\n    XCTAssertNoThrow([obj addObserver:self forKeyPath:@\"non-existent\" options:NSKeyValueObservingOptionOld context:nullptr]);\n    XCTAssertNoThrow([obj removeObserver:self forKeyPath:@\"non-existent\"]);\n\n    XCTAssertNoThrow([obj addObserver:self forKeyPath:@\"non-existent\" options:NSKeyValueObservingOptionPrior context:nullptr]);\n    XCTAssertNoThrow([obj removeObserver:self forKeyPath:@\"non-existent\"]);\n}\n\n- (void)testRemoveObserver {\n    // iOS 14.2 beta 2 has stopped throwing exceptions when a KVO observer is removed that does not exist\n    // FIXME: revisit this once 14.2 is out to see if this was an intended change\n#if REALM_PLATFORM_IOS\n    if (@available(iOS 14.2, *)) {\n        return;\n    }\n#endif\n\n    KVOObject *obj = [self createObject];\n    XCTAssertThrowsSpecificNamed([obj removeObserver:self forKeyPath:@\"int32Col\"], NSException, NSRangeException);\n    XCTAssertThrowsSpecificNamed([obj removeObserver:self forKeyPath:@\"int32Col\" context:nullptr], NSException, NSRangeException);\n    XCTAssertNoThrow([obj addObserver:self forKeyPath:@\"int32Col\" options:0 context:nullptr]);\n    XCTAssertNoThrow([obj removeObserver:self forKeyPath:@\"int32Col\"]);\n    XCTAssertThrowsSpecificNamed([obj removeObserver:self forKeyPath:@\"int32Col\"], NSException, NSRangeException);\n\n    // `context` parameter must match if it's passed, but the overload that doesn't\n    // take one will unregister any context\n    void *context1 = (void *)1;\n    void *context2 = (void *)2;\n    XCTAssertNoThrow([obj addObserver:self forKeyPath:@\"int32Col\" options:0 context:context1]);\n    XCTAssertThrows([obj removeObserver:self forKeyPath:@\"int32Col\" context:context2]);\n    XCTAssertNoThrow([obj removeObserver:self forKeyPath:@\"int32Col\" context:context1]);\n\n    XCTAssertNoThrow([obj addObserver:self forKeyPath:@\"int32Col\" options:0 context:context2]);\n    XCTAssertNoThrow([obj removeObserver:self forKeyPath:@\"int32Col\" context:context2]);\n\n    XCTAssertNoThrow([obj addObserver:self forKeyPath:@\"int32Col\" options:0 context:context2]);\n    XCTAssertNoThrow([obj removeObserver:self forKeyPath:@\"int32Col\"]);\n    XCTAssertThrows([obj removeObserver:self forKeyPath:@\"int32Col\"]);\n\n    XCTAssertNoThrow([obj addObserver:self forKeyPath:@\"int32Col\" options:0 context:context1]);\n    XCTAssertNoThrow([obj addObserver:self forKeyPath:@\"int32Col\" options:0 context:context2]);\n    XCTAssertNoThrow([obj removeObserver:self forKeyPath:@\"int32Col\" context:context1]);\n    XCTAssertThrows([obj removeObserver:self forKeyPath:@\"int32Col\" context:context1]);\n    XCTAssertNoThrow([obj removeObserver:self forKeyPath:@\"int32Col\" context:context2]);\n    XCTAssertThrows([obj removeObserver:self forKeyPath:@\"int32Col\" context:context2]);\n\n    XCTAssertNoThrow([obj addObserver:self forKeyPath:@\"int32Col\" options:0 context:context1]);\n    XCTAssertNoThrow([obj addObserver:self forKeyPath:@\"int32Col\" options:0 context:context2]);\n    XCTAssertNoThrow([obj removeObserver:self forKeyPath:@\"int32Col\" context:context2]);\n    XCTAssertThrows([obj removeObserver:self forKeyPath:@\"int32Col\" context:context2]);\n    XCTAssertNoThrow([obj removeObserver:self forKeyPath:@\"int32Col\" context:context1]);\n    XCTAssertThrows([obj removeObserver:self forKeyPath:@\"int32Col\" context:context1]);\n\n    // no context version should only unregister one (unspecified) observer\n    XCTAssertNoThrow([obj addObserver:self forKeyPath:@\"int32Col\" options:0 context:context1]);\n    XCTAssertNoThrow([obj addObserver:self forKeyPath:@\"int32Col\" options:0 context:context2]);\n    XCTAssertNoThrow([obj removeObserver:self forKeyPath:@\"int32Col\"]);\n    XCTAssertNoThrow([obj removeObserver:self forKeyPath:@\"int32Col\"]);\n    XCTAssertThrows([obj removeObserver:self forKeyPath:@\"int32Col\"]);\n}\n\n- (void)testRemoveObserverInObservation {\n    auto helper = [ReleaseOnObservation new];\n\n    __unsafe_unretained id obj;\n    __weak id weakObj;\n    @autoreleasepool {\n        obj = weakObj = helper.object = [self createObject];\n        [obj addObserver:helper forKeyPath:@\"int32Col\" options:NSKeyValueObservingOptionOld context:nullptr];\n    }\n\n    [obj setInt32Col:0];\n    XCTAssertNil(helper.object);\n    XCTAssertNil(weakObj);\n}\n\n- (void)testSimple {\n    KVOObject *obj = [self createObject];\n    {\n        KVORecorder r(self, obj, @\"int32Col\");\n        obj.int32Col = 10;\n        AssertChanged(r, @2, @10);\n    }\n    {\n        KVORecorder r(self, obj, @\"int32Col\");\n        obj.int32Col = 1;\n        AssertChanged(r, @10, @1);\n    }\n}\n\n- (void)testSelfAssignmentNotifies {\n    KVOObject *obj = [self createObject];\n    {\n        KVORecorder r(self, obj, @\"int32Col\");\n        obj.int32Col = obj.int32Col;\n        AssertChanged(r, @2, @2);\n    }\n}\n\n- (void)testMultipleObserversAreNotified {\n    KVOObject *obj = [self createObject];\n    {\n        KVORecorder r1(self, obj, @\"int32Col\");\n        KVORecorder r2(self, obj, @\"int32Col\");\n        KVORecorder r3(self, obj, @\"int32Col\");\n        obj.int32Col = 10;\n        AssertChanged(r1, @2, @10);\n        AssertChanged(r2, @2, @10);\n        AssertChanged(r3, @2, @10);\n    }\n}\n\n- (void)testOnlyObserversForTheCorrectPropertyAreNotified {\n    KVOObject *obj = [self createObject];\n    {\n        KVORecorder r16(self, obj, @\"int16Col\");\n        KVORecorder r32(self, obj, @\"int32Col\");\n        KVORecorder r64(self, obj, @\"int64Col\");\n\n        obj.int16Col = 2;\n        AssertChanged(r16, @1, @2);\n        XCTAssertTrue(r16.empty());\n        XCTAssertTrue(r32.empty());\n        XCTAssertTrue(r64.empty());\n\n        obj.int32Col = 2;\n        AssertChanged(r32, @2, @2);\n        XCTAssertTrue(r16.empty());\n        XCTAssertTrue(r32.empty());\n        XCTAssertTrue(r64.empty());\n\n        obj.int64Col = 2;\n        AssertChanged(r64, @3, @2);\n        XCTAssertTrue(r16.empty());\n        XCTAssertTrue(r32.empty());\n        XCTAssertTrue(r64.empty());\n    }\n}\n\n- (void)testMultipleChangesWithSingleObserver {\n    KVOObject *obj = [self createObject];\n    KVORecorder r(self, obj, @\"int32Col\");\n\n    obj.int32Col = 1;\n    obj.int32Col = 2;\n    obj.int32Col = 3;\n    obj.int32Col = 3;\n\n    if (self.collapsesNotifications) {\n        AssertChanged(r, @2, @3);\n    }\n    else {\n        AssertChanged(r, @2, @1);\n        AssertChanged(r, @1, @2);\n        AssertChanged(r, @2, @3);\n        AssertChanged(r, @3, @3);\n    }\n}\n\n- (void)testOnlyObserversForTheCorrectObjectAreNotified {\n    KVOObject *obj1 = [self createObject];\n    KVOObject *obj2 = [self createObject];\n\n    KVORecorder r1(self, obj1, @\"int32Col\");\n    KVORecorder r2(self, obj2, @\"int32Col\");\n\n    obj1.int32Col = 10;\n    AssertChanged(r1, @2, @10);\n    XCTAssertEqual(0U, r2.size());\n\n    obj2.int32Col = 5;\n    AssertChanged(r2, @2, @5);\n}\n\n- (void)testOptionsInitial {\n    KVOObject *obj = [self createObject];\n\n    {\n        KVORecorder r(self, obj, @\"int32Col\", 0);\n        XCTAssertEqual(0U, r.size());\n    }\n    {\n        KVORecorder r(self, obj, @\"int32Col\", NSKeyValueObservingOptionInitial);\n        r.pop_front();\n    }\n}\n\n- (void)testOptionsOld {\n    KVOObject *obj = [self createObject];\n\n    {\n        KVORecorder r(self, obj, @\"int32Col\", 0);\n        obj.int32Col = 0;\n        if (NSDictionary *note = AssertNotification(r)) {\n            XCTAssertNil(note[NSKeyValueChangeOldKey]);\n        }\n    }\n    {\n        KVORecorder r(self, obj, @\"int32Col\", NSKeyValueObservingOptionOld);\n        obj.int32Col = 0;\n        if (NSDictionary *note = AssertNotification(r)) {\n            XCTAssertNotNil(note[NSKeyValueChangeOldKey]);\n        }\n    }\n}\n\n- (void)testOptionsNew {\n    KVOObject *obj = [self createObject];\n\n    {\n        KVORecorder r(self, obj, @\"int32Col\", 0);\n        obj.int32Col = 0;\n        if (NSDictionary *note = AssertNotification(r)) {\n            XCTAssertNil(note[NSKeyValueChangeNewKey]);\n        }\n    }\n    {\n        KVORecorder r(self, obj, @\"int32Col\", NSKeyValueObservingOptionNew);\n        obj.int32Col = 0;\n        if (NSDictionary *note = AssertNotification(r)) {\n            XCTAssertNotNil(note[NSKeyValueChangeNewKey]);\n        }\n    }\n}\n\n- (void)testOptionsPrior {\n    KVOObject *obj = [self createObject];\n\n    KVORecorder r(self, obj, @\"int32Col\", NSKeyValueObservingOptionNew|NSKeyValueObservingOptionPrior);\n    obj.int32Col = 0;\n    r.refresh();\n\n    XCTAssertEqual(2U, r.size());\n    if (NSDictionary *note = AssertNotification(r)) {\n        XCTAssertNil(note[NSKeyValueChangeNewKey]);\n        XCTAssertEqualObjects(@YES, note[NSKeyValueChangeNotificationIsPriorKey]);\n    }\n    if (NSDictionary *note = AssertNotification(r)) {\n        XCTAssertNotNil(note[NSKeyValueChangeNewKey]);\n        XCTAssertNil(note[NSKeyValueChangeNotificationIsPriorKey]);\n    }\n}\n\n- (void)testAllPropertyTypes {\n    KVOObject *obj = [self createObject];\n\n    {\n        KVORecorder r(self, obj, @\"boolCol\");\n        obj.boolCol = YES;\n        AssertChanged(r, @NO, @YES);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"int16Col\");\n        obj.int16Col = 0;\n        AssertChanged(r, @1, @0);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"int32Col\");\n        obj.int32Col = 0;\n        AssertChanged(r, @2, @0);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"int64Col\");\n        obj.int64Col = 0;\n        AssertChanged(r, @3, @0);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"floatCol\");\n        obj.floatCol = 1.0f;\n        AssertChanged(r, @0, @1);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"doubleCol\");\n        obj.doubleCol = 1.0;\n        AssertChanged(r, @0, @1);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"cBoolCol\");\n        obj.cBoolCol = YES;\n        AssertChanged(r, @NO, @YES);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"stringCol\");\n        obj.stringCol = @\"abc\";\n        AssertChanged(r, @\"\", @\"abc\");\n        obj.stringCol = nil;\n        AssertChanged(r, @\"abc\", NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"binaryCol\");\n        NSData *data = [@\"abc\" dataUsingEncoding:NSUTF8StringEncoding];\n        obj.binaryCol = data;\n        AssertChanged(r, NSData.data, data);\n        obj.binaryCol = nil;\n        AssertChanged(r, data, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"dateCol\");\n        NSDate *date = [NSDate dateWithTimeIntervalSinceReferenceDate:1];\n        obj.dateCol = date;\n        AssertChanged(r, [NSDate dateWithTimeIntervalSinceReferenceDate:0], date);\n        obj.dateCol = nil;\n        AssertChanged(r, date, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"objectIdCol\");\n        RLMObjectId *objectId = [RLMObjectId objectId];\n        obj.objectIdCol = objectId;\n        AssertChanged(r, NSNull.null, objectId);\n        obj.objectIdCol = nil;\n        AssertChanged(r, objectId, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"decimal128Col\");\n        RLMDecimal128 *decimal128 = [[RLMDecimal128 alloc] initWithNumber:@1];\n        obj.decimal128Col = decimal128;\n        AssertChanged(r, NSNull.null, decimal128);\n        obj.decimal128Col = nil;\n        AssertChanged(r, decimal128, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"objectCol\");\n        obj.objectCol = obj;\n        AssertChanged(r, NSNull.null, [self observableForObject:obj]);\n        obj.objectCol = nil;\n        AssertChanged(r, [self observableForObject:obj], NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"uuidCol\");\n        NSUUID *uuid = [NSUUID UUID];\n        obj.uuidCol = uuid;\n        AssertChanged(r, NSNull.null, uuid);\n        obj.uuidCol = nil;\n        AssertChanged(r, uuid, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"anyCol\");\n        obj.anyCol = @\"abc\";\n        AssertChanged(r, NSNull.null, @\"abc\");\n        obj.anyCol = nil;\n        AssertChanged(r, @\"abc\", NSNull.null);\n    }\n    // Array\n    {\n        KVORecorder r(self, obj, @\"intArray\");\n        obj.intArray = obj.intArray;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"boolArray\");\n        obj.boolArray = obj.boolArray;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"floatArray\");\n        obj.floatArray = obj.floatArray;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"doubleArray\");\n        obj.doubleArray = obj.doubleArray;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"stringArray\");\n        obj.stringArray = obj.stringArray;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"dataArray\");\n        obj.dataArray = obj.dataArray;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"dateArray\");\n        obj.dateArray = obj.dateArray;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"objectIdArray\");\n        obj.objectIdArray = obj.objectIdArray;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"decimal128Array\");\n        obj.decimal128Array = obj.decimal128Array;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"objectArray\");\n        obj.objectArray = obj.objectArray;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"uuidArray\");\n        obj.uuidArray = obj.uuidArray;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"anyArray\");\n        obj.anyArray = obj.anyArray;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n    // Set\n    {\n        KVORecorder r(self, obj, @\"intSet\");\n        obj.intSet = obj.intSet;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"boolSet\");\n        obj.boolSet = obj.boolSet;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"floatSet\");\n        obj.floatSet = obj.floatSet;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"doubleSet\");\n        obj.doubleSet = obj.doubleSet;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"stringSet\");\n        obj.stringSet = obj.stringSet;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"dataSet\");\n        obj.dataSet = obj.dataSet;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"dateSet\");\n        obj.dateSet = obj.dateSet;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"objectIdSet\");\n        obj.objectIdSet = obj.objectIdSet;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"decimal128Set\");\n        obj.decimal128Set = obj.decimal128Set;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"objectSet\");\n        obj.objectSet = obj.objectSet;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"uuidSet\");\n        obj.uuidSet = obj.uuidSet;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"anySet\");\n        obj.anySet = obj.anySet;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n    // Dictionary\n    {\n        KVORecorder r(self, obj, @\"intDictionary\");\n        obj.intDictionary = obj.intDictionary;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"boolDictionary\");\n        obj.boolDictionary = obj.boolDictionary;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"floatDictionary\");\n        obj.floatDictionary = obj.floatDictionary;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"doubleDictionary\");\n        obj.doubleDictionary = obj.doubleDictionary;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"stringDictionary\");\n        obj.stringDictionary = obj.stringDictionary;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"dataDictionary\");\n        obj.dataDictionary = obj.dataDictionary;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"dateDictionary\");\n        obj.dateDictionary = obj.dateDictionary;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"objectIdDictionary\");\n        obj.objectIdDictionary = obj.objectIdDictionary;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"decimal128Dictionary\");\n        obj.decimal128Dictionary = obj.decimal128Dictionary;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"objectDictionary\");\n        obj.objectDictionary = obj.objectDictionary;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"uuidDictionary\");\n        obj.uuidDictionary = obj.uuidDictionary;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"anyDictionary\");\n        obj.anyDictionary = obj.anyDictionary;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"optIntCol\");\n        obj.optIntCol = @1;\n        AssertChanged(r, NSNull.null, @1);\n        obj.optIntCol = nil;\n        AssertChanged(r, @1, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"optFloatCol\");\n        obj.optFloatCol = @1.1f;\n        AssertChanged(r, NSNull.null, @1.1f);\n        obj.optFloatCol = nil;\n        AssertChanged(r, @1.1f, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"optDoubleCol\");\n        obj.optDoubleCol = @1.1;\n        AssertChanged(r, NSNull.null, @1.1);\n        obj.optDoubleCol = nil;\n        AssertChanged(r, @1.1, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"optBoolCol\");\n        obj.optBoolCol = @YES;\n        AssertChanged(r, NSNull.null, @YES);\n        obj.optBoolCol = nil;\n        AssertChanged(r, @YES, NSNull.null);\n    }\n}\n\n- (void)testAllPropertyTypesKVC {\n    KVOObject *obj = [self createObject];\n\n    {\n        KVORecorder r(self, obj, @\"boolCol\");\n        [obj setValue:@YES forKey:@\"boolCol\"];\n        AssertChanged(r, @NO, @YES);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"int16Col\");\n        [obj setValue:@0 forKey:@\"int16Col\"];\n        AssertChanged(r, @1, @0);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"int32Col\");\n        [obj setValue:@0 forKey:@\"int32Col\"];\n        AssertChanged(r, @2, @0);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"int64Col\");\n        [obj setValue:@0 forKey:@\"int64Col\"];\n        AssertChanged(r, @3, @0);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"floatCol\");\n        [obj setValue:@1.0f forKey:@\"floatCol\"];\n        AssertChanged(r, @0, @1);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"doubleCol\");\n        [obj setValue:@1.0 forKey:@\"doubleCol\"];\n        AssertChanged(r, @0, @1);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"cBoolCol\");\n        [obj setValue:@YES forKey:@\"cBoolCol\"];\n        AssertChanged(r, @NO, @YES);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"stringCol\");\n        [obj setValue:@\"abc\" forKey:@\"stringCol\"];\n        AssertChanged(r, @\"\", @\"abc\");\n        [obj setValue:nil forKey:@\"stringCol\"];\n        AssertChanged(r, @\"abc\", NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"binaryCol\");\n        NSData *data = [@\"abc\" dataUsingEncoding:NSUTF8StringEncoding];\n        [obj setValue:data forKey:@\"binaryCol\"];\n        AssertChanged(r, NSData.data, data);\n        [obj setValue:nil forKey:@\"binaryCol\"];\n        AssertChanged(r, data, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"dateCol\");\n        NSDate *date = [NSDate dateWithTimeIntervalSinceReferenceDate:1];\n        [obj setValue:date forKey:@\"dateCol\"];\n        AssertChanged(r, [NSDate dateWithTimeIntervalSinceReferenceDate:0], date);\n        [obj setValue:nil forKey:@\"dateCol\"];\n        AssertChanged(r, date, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"objectIdCol\");\n        RLMObjectId *objectId = [RLMObjectId objectId];\n        [obj setValue:objectId forKey:@\"objectIdCol\"];\n        AssertChanged(r, NSNull.null, objectId);\n        [obj setValue:nil forKey:@\"objectIdCol\"];\n        AssertChanged(r, objectId, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"decimal128Col\");\n        RLMDecimal128 *decimal128 = [[RLMDecimal128 alloc] initWithNumber:@1];\n        [obj setValue:decimal128 forKey:@\"decimal128Col\"];\n        AssertChanged(r, NSNull.null, decimal128);\n        [obj setValue:nil forKey:@\"decimal128Col\"];\n        AssertChanged(r, decimal128, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"objectCol\");\n        [obj setValue:obj forKey:@\"objectCol\"];\n        AssertChanged(r, NSNull.null, [self observableForObject:obj]);\n        [obj setValue:nil forKey:@\"objectCol\"];\n        AssertChanged(r, [self observableForObject:obj], NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"uuidCol\");\n        NSUUID *uuid = [NSUUID UUID];\n        [obj setValue:uuid forKey:@\"uuidCol\"];\n        AssertChanged(r, NSNull.null, uuid);\n        [obj setValue:nil forKey:@\"uuidCol\"];\n        AssertChanged(r, uuid, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"objectArray\");\n        [obj setValue:obj.objectArray forKey:@\"objectArray\"];\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"optIntCol\");\n        [obj setValue:@1 forKey:@\"optIntCol\"];\n        AssertChanged(r, NSNull.null, @1);\n        [obj setValue:nil forKey:@\"optIntCol\"];\n        AssertChanged(r, @1, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"optFloatCol\");\n        [obj setValue:@1.1f forKey:@\"optFloatCol\"];\n        AssertChanged(r, NSNull.null, @1.1f);\n        [obj setValue:nil forKey:@\"optFloatCol\"];\n        AssertChanged(r, @1.1f, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"optDoubleCol\");\n        [obj setValue:@1.1 forKey:@\"optDoubleCol\"];\n        AssertChanged(r, NSNull.null, @1.1);\n        [obj setValue:nil forKey:@\"optDoubleCol\"];\n        AssertChanged(r, @1.1, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"optBoolCol\");\n        [obj setValue:@YES forKey:@\"optBoolCol\"];\n        AssertChanged(r, NSNull.null, @YES);\n        [obj setValue:nil forKey:@\"optBoolCol\"];\n        AssertChanged(r, @YES, NSNull.null);\n    }\n}\n\n- (void)testAllPropertyTypesDynamic {\n    KVOObject *obj = [self createObject];\n    if (![obj respondsToSelector:@selector(setObject:forKeyedSubscript:)]) {\n        return;\n    }\n\n    {\n        KVORecorder r(self, obj, @\"boolCol\");\n        obj[@\"boolCol\"] = @YES;\n        AssertChanged(r, @NO, @YES);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"int16Col\");\n        obj[@\"int16Col\"] = @0;\n        AssertChanged(r, @1, @0);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"int32Col\");\n        obj[@\"int32Col\"] = @0;\n        AssertChanged(r, @2, @0);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"int64Col\");\n        obj[@\"int64Col\"] = @0;\n        AssertChanged(r, @3, @0);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"floatCol\");\n        obj[@\"floatCol\"] = @1.0f;\n        AssertChanged(r, @0, @1);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"doubleCol\");\n        obj[@\"doubleCol\"] = @1.0;\n        AssertChanged(r, @0, @1);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"cBoolCol\");\n        obj[@\"cBoolCol\"] = @YES;\n        AssertChanged(r, @NO, @YES);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"stringCol\");\n        obj[@\"stringCol\"] = @\"abc\";\n        AssertChanged(r, @\"\", @\"abc\");\n        obj[@\"stringCol\"] = nil;\n        AssertChanged(r, @\"abc\", NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"binaryCol\");\n        NSData *data = [@\"abc\" dataUsingEncoding:NSUTF8StringEncoding];\n        obj[@\"binaryCol\"] = data;\n        AssertChanged(r, NSData.data, data);\n        obj[@\"binaryCol\"] = nil;\n        AssertChanged(r, data, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"dateCol\");\n        NSDate *date = [NSDate dateWithTimeIntervalSinceReferenceDate:1];\n        obj[@\"dateCol\"] = date;\n        AssertChanged(r, [NSDate dateWithTimeIntervalSinceReferenceDate:0], date);\n        obj[@\"dateCol\"] = nil;\n        AssertChanged(r, date, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"objectCol\");\n        obj[@\"objectCol\"] = obj;\n        AssertChanged(r, NSNull.null, [self observableForObject:obj]);\n        obj[@\"objectCol\"] = nil;\n        AssertChanged(r, [self observableForObject:obj], NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"uuidCol\");\n        NSUUID *uuid = [NSUUID UUID];\n        obj[@\"uuidCol\"] = uuid;\n        AssertChanged(r, NSNull.null, uuid);\n        obj[@\"uuidCol\"] = nil;\n        AssertChanged(r, uuid, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"anyCol\");\n        obj[@\"anyCol\"] = @\"abc\";\n        AssertChanged(r, NSNull.null, @\"abc\");\n        obj[@\"anyCol\"] = nil;\n        AssertChanged(r, @\"abc\", NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"objectArray\");\n        obj[@\"objectArray\"] = obj.objectArray;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"objectSet\");\n        obj[@\"objectSet\"] = obj.objectSet;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"objectDictionary\");\n        obj[@\"objectDictionary\"] = obj.objectDictionary;\n        r.refresh();\n        r.pop_front(); // asserts that there's something to pop\n    }\n\n    {\n        KVORecorder r(self, obj, @\"optIntCol\");\n        obj[@\"optIntCol\"] = @1;\n        AssertChanged(r, NSNull.null, @1);\n        obj[@\"optIntCol\"] = nil;\n        AssertChanged(r, @1, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"optFloatCol\");\n        obj[@\"optFloatCol\"] = @1.1f;\n        AssertChanged(r, NSNull.null, @1.1f);\n        obj[@\"optFloatCol\"] = nil;\n        AssertChanged(r, @1.1f, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"optDoubleCol\");\n        obj[@\"optDoubleCol\"] = @1.1;\n        AssertChanged(r, NSNull.null, @1.1);\n        obj[@\"optDoubleCol\"] = nil;\n        AssertChanged(r, @1.1, NSNull.null);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"optBoolCol\");\n        obj[@\"optBoolCol\"] = @YES;\n        AssertChanged(r, NSNull.null, @YES);\n        obj[@\"optBoolCol\"] = nil;\n        AssertChanged(r, @YES, NSNull.null);\n    }\n}\n\n- (void)testArrayDiffs {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVORecorder r(self, obj, @\"array\");\n\n    id mutator = [obj mutableArrayValueForKey:@\"array\"];\n\n    [mutator addObject:obj.obj];\n    AssertIndexChange(NSKeyValueChangeInsertion, [NSIndexSet indexSetWithIndex:0]);\n\n    [mutator addObject:obj.obj];\n    AssertIndexChange(NSKeyValueChangeInsertion, [NSIndexSet indexSetWithIndex:1]);\n\n    [mutator removeObjectAtIndex:0];\n    AssertIndexChange(NSKeyValueChangeRemoval, [NSIndexSet indexSetWithIndex:0]);\n\n    [mutator replaceObjectAtIndex:0 withObject:obj.obj];\n    AssertIndexChange(NSKeyValueChangeReplacement, [NSIndexSet indexSetWithIndex:0]);\n\n    NSMutableIndexSet *indexes = [NSMutableIndexSet new];\n    [indexes addIndex:0];\n    [indexes addIndex:2];\n    [mutator insertObjects:@[obj.obj, obj.obj] atIndexes:indexes];\n    AssertIndexChange(NSKeyValueChangeInsertion, indexes);\n\n    [mutator removeObjectsAtIndexes:indexes];\n    AssertIndexChange(NSKeyValueChangeRemoval, indexes);\n\n    if (![obj.array isKindOfClass:[NSArray class]]) {\n        // We deliberately diverge from NSMutableArray for `removeAllObjects` and\n        // `addObjectsFromArray:`, because generating a separate notification for\n        // each object added or removed is needlessly pessimal.\n        [mutator addObjectsFromArray:@[obj.obj, obj.obj]];\n        AssertIndexChange(NSKeyValueChangeInsertion, [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(1, 2)]);\n\n        // NSArray sends multiple notifications for exchange, which we can't do\n        // on refresh\n        [mutator exchangeObjectAtIndex:0 withObjectAtIndex:1];\n        AssertIndexChange(NSKeyValueChangeReplacement, [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 2)]);\n\n        // NSArray doesn't have move\n        [mutator moveObjectAtIndex:1 toIndex:0];\n        AssertIndexChange(NSKeyValueChangeReplacement, [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 2)]);\n\n        [mutator removeLastObject];\n        AssertIndexChange(NSKeyValueChangeRemoval, [NSIndexSet indexSetWithIndex:2]);\n\n        [mutator removeAllObjects];\n        AssertIndexChange(NSKeyValueChangeRemoval, [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 2)]);\n    }\n}\n\n- (void)testPrimitiveArrayDiffs {\n    KVOObject *obj = [self createObject];\n    KVORecorder r(self, obj, @\"intArray\");\n\n    id mutator = [obj mutableArrayValueForKey:@\"intArray\"];\n\n    [mutator addObject:@1];\n    AssertIndexChange(NSKeyValueChangeInsertion, [NSIndexSet indexSetWithIndex:0]);\n\n    [mutator addObject:@2];\n    AssertIndexChange(NSKeyValueChangeInsertion, [NSIndexSet indexSetWithIndex:1]);\n\n    [mutator removeObjectAtIndex:0];\n    AssertIndexChange(NSKeyValueChangeRemoval, [NSIndexSet indexSetWithIndex:0]);\n\n    [mutator replaceObjectAtIndex:0 withObject:@3];\n    AssertIndexChange(NSKeyValueChangeReplacement, [NSIndexSet indexSetWithIndex:0]);\n\n    NSMutableIndexSet *indexes = [NSMutableIndexSet new];\n    [indexes addIndex:0];\n    [indexes addIndex:2];\n    [mutator insertObjects:@[@4, @5] atIndexes:indexes];\n    AssertIndexChange(NSKeyValueChangeInsertion, indexes);\n\n    [mutator removeObjectsAtIndexes:indexes];\n    AssertIndexChange(NSKeyValueChangeRemoval, indexes);\n\n    if (![obj.intArray isKindOfClass:[NSArray class]]) {\n        // We deliberately diverge from NSMutableArray for `removeAllObjects` and\n        // `addObjectsFromArray:`, because generating a separate notification for\n        // each object added or removed is needlessly pessimal.\n        [mutator addObjectsFromArray:@[@6, @7]];\n        AssertIndexChange(NSKeyValueChangeInsertion, [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(1, 2)]);\n\n        // NSArray sends multiple notifications for exchange, which we can't do\n        // on refresh\n        [mutator exchangeObjectAtIndex:0 withObjectAtIndex:1];\n        AssertIndexChange(NSKeyValueChangeReplacement, [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 2)]);\n\n        // NSArray doesn't have move\n        [mutator moveObjectAtIndex:1 toIndex:0];\n        AssertIndexChange(NSKeyValueChangeReplacement, [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 2)]);\n\n        [mutator removeLastObject];\n        AssertIndexChange(NSKeyValueChangeRemoval, [NSIndexSet indexSetWithIndex:2]);\n\n        [mutator removeAllObjects];\n        AssertIndexChange(NSKeyValueChangeRemoval, [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 2)]);\n    }\n}\n\n- (void)testSetKVO {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVOLinkObject2 *obj2 = [self createLinkObject];\n    KVORecorder r(self, obj, @\"set\");\n\n    id mutator = [obj mutableSetValueForKey:@\"set\"];\n    id mutator2 = [obj2 mutableSetValueForKey:@\"set\"];\n    id set2 = [obj2 valueForKey:@\"set\"];\n\n    [mutator addObject:obj.obj];\n    AssertCollectionChanged();\n    [mutator removeObject:obj.obj];\n    AssertCollectionChanged();\n    [mutator addObject:obj.obj];\n    AssertCollectionChanged();\n    [mutator2 addObject:obj2.obj];\n    [mutator setSet:set2];\n    AssertCollectionChanged();\n\n    [mutator intersectSet:set2];\n    AssertCollectionChanged();\n    [mutator minusSet:set2];\n    AssertCollectionChanged();\n    [mutator unionSet:set2];\n    AssertCollectionChanged();\n}\n\n- (void)testPrimitiveSetKVO {\n    KVOObject *obj = [self createObject];\n    KVOObject *obj2 = [self createObject];\n    KVORecorder r(self, obj, @\"intSet\");\n\n    id mutator = [obj mutableSetValueForKey:@\"intSet\"];\n    id mutator2 = [obj2 mutableSetValueForKey:@\"intSet\"];\n\n    [mutator addObject:@1];\n    AssertCollectionChanged();\n    [mutator removeObject:@1];\n    AssertCollectionChanged();\n    [mutator addObject:@1];\n    AssertCollectionChanged();\n    [mutator2 addObject:@2];\n    [mutator setSet:mutator2];\n    AssertCollectionChanged();\n\n    [mutator intersectSet:mutator2];\n    AssertCollectionChanged();\n    [mutator minusSet:mutator2];\n    AssertCollectionChanged();\n    [mutator unionSet:mutator2];\n    AssertCollectionChanged();\n}\n\n- (void)testDictionaryKVO {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVOLinkObject2 *obj2 = [self createLinkObject];\n    KVORecorder r(self, obj, @\"dictionary\");\n\n    id mutator = [obj valueForKey:@\"dictionary\"];\n    id mutator2 = [obj2 valueForKey:@\"dictionary\"];\n\n    // Foundation doesn't expose any notifying proxy classes for NSMutableDictionary\n    // and it doesnt really make sense to create a wrapper purely for testing.\n    // So if `mutator` is NSMutableDictionary return.\n\n    if ([mutator isKindOfClass:[NSMutableDictionary class]]) {\n        return;\n    }\n\n    [mutator setObject:obj.obj forKey:@\"key\"];\n    AssertCollectionChanged();\n    [mutator removeObjectForKey:@\"key\"];\n    AssertCollectionChanged();\n    [mutator setObject:obj.obj forKey:@\"key2\"];\n    AssertCollectionChanged();\n    [mutator2 setObject:obj2.obj forKey:@\"key\"];\n    [mutator removeAllObjects];\n    AssertCollectionChanged();\n}\n\n- (void)testPrimitiveDictionaryKVO {\n    KVOObject *obj = [self createObject];\n    KVOObject *obj2 = [self createObject];\n    KVORecorder r(self, obj, @\"intDictionary\");\n\n    id mutator = [obj valueForKey:@\"intDictionary\"];\n    id mutator2 = [obj2 valueForKey:@\"intDictionary\"];\n\n    if ([mutator isKindOfClass:[NSMutableDictionary class]]) {\n        return;\n    }\n\n    [mutator setObject:@1 forKey:@\"key\"];\n    AssertCollectionChanged();\n    [mutator removeObjectForKey:@\"key\"];\n    AssertCollectionChanged();\n    [mutator setObject:@2 forKey:@\"key2\"];\n    AssertCollectionChanged();\n    [mutator2 setObject:@3 forKey:@\"key\"];\n    [mutator removeAllObjects];\n    AssertCollectionChanged();\n}\n\n- (void)testIgnoredProperty {\n    KVOObject *obj = [self createObject];\n    KVORecorder r(self, obj, @\"ignored\");\n    obj.ignored = 10;\n    AssertChanged(r, @0, @10);\n}\n\n- (void)testChangeEndOfKeyPath {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    std::unique_ptr<KVORecorder> r;\n    @autoreleasepool {\n        r = std::make_unique<KVORecorder>(self, obj, @\"obj.obj.boolCol\");\n    }\n    obj.obj.obj.boolCol = YES;\n    AssertChanged(*r, @NO, @YES);\n}\n\n- (void)testChangeMiddleOfKeyPath {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVOObject *oldObj = obj.obj.obj;\n    KVOObject *newObj = [self createObject];\n    newObj.boolCol = YES;\n\n    KVORecorder r(self, obj, @\"obj.obj.boolCol\");\n    obj.obj.obj = newObj;\n    AssertChanged(r, @NO, @YES);\n    newObj.boolCol = NO;\n    AssertChanged(r, @YES, @NO);\n    oldObj.boolCol = YES;\n}\n\n- (void)testNullifyMiddleOfKeyPath {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVORecorder r(self, obj, @\"obj.obj.boolCol\");\n    obj.obj = nil;\n    AssertChanged(r, @NO, NSNull.null);\n}\n\n- (void)testChangeMiddleOfKeyPathToNonNil {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVOLinkObject1 *obj2 = obj.obj;\n    obj.obj = nil;\n    obj2.obj.boolCol = YES;\n\n    KVORecorder r(self, obj, @\"obj.obj.boolCol\");\n    obj.obj = obj2;\n    AssertChanged(r, NSNull.null, @YES);\n}\n\n- (void)testArrayKVC {\n    KVOObject *obj = [self createObject];\n    [obj.objectArray addObject:obj];\n\n    KVORecorder r(self, obj, @\"boolCol\");\n    [obj.objectArray setValue:@YES forKey:@\"boolCol\"];\n    AssertChanged(r, @NO, @YES);\n}\n\n- (void)testSetKVC {\n    KVOObject *obj = [self createObject];\n    [obj.objectSet addObject:obj];\n\n    KVORecorder r(self, obj, @\"boolCol\");\n    [obj.objectSet setValue:@YES forKey:@\"boolCol\"];\n    AssertChanged(r, @NO, @YES);\n}\n\n- (void)testSharedSchemaOnObservedObjectGivesOriginalSchema {\n    KVOObject *obj = [self createObject];\n    if (![obj isKindOfClass:RLMObjectBase.class]) {\n        return;\n    }\n\n    RLMObjectSchema *original = [obj.class sharedSchema];\n    KVORecorder r(self, obj, @\"boolCol\");\n    XCTAssertEqual(original, [obj.class sharedSchema]); // note: intentionally not EqualObjects\n}\n\n// RLMArray doesn't support @count at all\n- (void)testObserveArrayCount {\n    KVOObject *obj = [self createObject];\n    KVORecorder r(self, obj, @\"objectArray.@count\");\n    id mutator = [obj mutableArrayValueForKey:@\"objectArray\"];\n    [mutator addObject:obj];\n    AssertChanged(r, @0, @1);\n}\n\n- (void)testMixedCollectionKVC {\n    KVOObject *obj = [self createObject];\n    NSDictionary *d = @{ @\"key2\" : @\"hello2\",\n                          @\"key3\" : @YES,\n                          @\"key4\" : @123,\n                          @\"key5\" : @456.789 };\n\n    NSArray *a = @[ @\"hello2\", @YES, @123, @456.789 ];\n\n    {\n        KVORecorder r(self, obj, @\"anyCol\");\n        obj.anyCol = d;\n        AssertCollectionChanged();\n    }\n\n    {\n        KVORecorder r(self, obj, @\"anyCol\");\n        [obj setValue:d forKey:@\"anyCol\"];\n        AssertCollectionChanged();\n        [obj setValue:nil forKey:@\"anyCol\"];\n        AssertCollectionChanged();\n    }\n\n    {\n        KVORecorder r(self, obj, @\"anyCol\");\n        obj.anyCol = a;\n        AssertCollectionChanged();\n    }\n\n    {\n        KVORecorder r(self, obj, @\"anyCol\");\n        [obj setValue:a forKey:@\"anyCol\"];\n        AssertCollectionChanged();\n        [obj setValue:nil forKey:@\"anyCol\"];\n        AssertCollectionChanged();\n    }\n\n    if (![obj respondsToSelector:@selector(setObject:forKeyedSubscript:)]) {\n        return;\n    }\n\n    {\n        KVORecorder r(self, obj, @\"anyCol\");\n        obj[@\"anyCol\"] = d;\n        AssertCollectionChanged();\n        obj[@\"anyCol\"] = nil;\n        AssertCollectionChanged();\n    }\n\n    {\n        KVORecorder r(self, obj, @\"anyCol\");\n        obj[@\"anyCol\"] = a;\n        AssertCollectionChanged();\n        obj[@\"anyCol\"] = nil;\n        AssertCollectionChanged();\n    }\n}\n@end\n\n// Run tests on an unmanaged RLMObject instance\n@interface KVOUnmanagedObjectTests : KVOTests\n@end\n@implementation KVOUnmanagedObjectTests\n- (id)createObject {\n    static int pk = 0;\n    KVOObject *obj = [KVOObject new];\n    obj.pk = pk++;\n    obj.int16Col = 1;\n    obj.int32Col = 2;\n    obj.int64Col = 3;\n    obj.binaryCol = NSData.data;\n    obj.stringCol = @\"\";\n    obj.dateCol = [NSDate dateWithTimeIntervalSinceReferenceDate:0];\n    return obj;\n}\n\n- (id)createLinkObject {\n    static int pk = 0;\n    KVOLinkObject1 *obj1 = [KVOLinkObject1 new];\n    obj1.pk = pk++;\n    obj1.obj = [self createObject];\n    KVOLinkObject2 *obj2 = [KVOLinkObject2 new];\n    obj2.pk = pk++;\n    obj2.obj = obj1;\n    return obj2;\n}\n\n- (void)testAddToRealmAfterAddingObservers {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    KVOObject *obj = [self createObject];\n    {\n        KVORecorder r(self, obj, @\"int32Col\");\n        XCTAssertThrows([realm addObject:obj]);\n    }\n    XCTAssertNoThrow([realm addObject:obj]);\n    [realm cancelWriteTransaction];\n}\n\n- (void)testObserveInvalidArrayProperty {\n    KVOObject *obj = [self createObject];\n    XCTAssertThrows([obj.objectArray addObserver:self forKeyPath:@\"self\" options:0 context:0]);\n    XCTAssertNoThrow([obj.objectArray addObserver:self forKeyPath:RLMInvalidatedKey options:0 context:0]);\n    XCTAssertNoThrow([obj.objectArray removeObserver:self forKeyPath:RLMInvalidatedKey context:0]);\n}\n\n- (void)testUnregisteringViaAnAssociatedObject {\n    @autoreleasepool {\n        __attribute__((objc_precise_lifetime)) KVOObject *obj = [self createObject];\n        [obj addObserver:self forKeyPath:@\"boolCol\" options:0 context:0];\n        [KVOUnregisterHelper automaticallyUnregister:self object:obj keyPath:@\"boolCol\"];\n    }\n    // Throws if the unregistration doesn't succeed\n}\n\n@end\n\n// Run tests on a managed object, modifying the actual object instance being\n// observed\n@interface KVOManagedObjectTests : KVOTests\n@property (nonatomic, strong) RLMRealm *realm;\n@end\n\n@implementation KVOManagedObjectTests\n- (void)setUp {\n    [super setUp];\n    _realm = [self getRealm];\n    [_realm beginWriteTransaction];\n}\n\n- (void)tearDown {\n    [self.realm cancelWriteTransaction];\n    self.realm = nil;\n    [super tearDown];\n}\n\n- (RLMRealm *)getRealm {\n    RLMRealmConfiguration *configuration = [[RLMRealmConfiguration alloc] init];\n    configuration.inMemoryIdentifier = @\"test\";\n    configuration.schemaMode = realm::SchemaMode::AdditiveDiscovered;\n    return [RLMRealm realmWithConfiguration:configuration error:nil];\n}\n\n- (id)createObject {\n    static std::atomic<int> pk{0};\n    return [KVOObject createInRealm:_realm withValue:@[@(++pk),\n                                                       @NO, @1, @2, @3, @0, @0, @NO, @\"\",\n                                                       NSData.data, [NSDate dateWithTimeIntervalSinceReferenceDate:0]]];\n}\n\n- (id)createLinkObject {\n    static std::atomic<int> pk{0};\n    return [KVOLinkObject2 createInRealm:_realm withValue:@[@(++pk), @[@(++pk), [self createObject], @[]], @[]]];\n}\n\n- (EmbeddedIntParentObject *)createEmbeddedObject {\n    return [EmbeddedIntParentObject createInRealm:_realm withValue:@[@1, @[@2], @[@[@3]]]];\n}\n\n- (void)testDeleteObservedObject {\n    KVOObject *obj = [self createObject];\n    KVORecorder r1(self, obj, @\"boolCol\");\n    KVORecorder r2(self, obj, RLMInvalidatedKey);\n    [self.realm deleteObject:obj];\n    AssertChanged(r2, @NO, @YES);\n    // should not crash\n}\n\n- (void)testDeleteMultipleObservedObjects {\n    KVOObject *obj1 = [self createObject];\n    KVOObject *obj2 = [self createObject];\n    KVOObject *obj3 = [self createObject];\n\n    KVORecorder r1(self, obj1, RLMInvalidatedKey);\n    KVORecorder r2(self, obj2, RLMInvalidatedKey);\n    KVORecorder r3(self, obj3, RLMInvalidatedKey);\n\n    [self.realm deleteObject:obj2];\n    AssertChanged(r2, @NO, @YES);\n    XCTAssertTrue(r1.empty());\n    XCTAssertTrue(r3.empty());\n\n    [self.realm deleteObject:obj3];\n    AssertChanged(r3, @NO, @YES);\n    XCTAssertTrue(r1.empty());\n    XCTAssertTrue(r2.empty());\n\n    [self.realm deleteObject:obj1];\n    AssertChanged(r1, @NO, @YES);\n    XCTAssertTrue(r2.empty());\n    XCTAssertTrue(r3.empty());\n}\n\n- (void)testDeleteMiddleOfKeyPath {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVORecorder r(self, obj, @\"obj.obj.boolCol\");\n    [self.realm deleteObject:obj.obj];\n    AssertChanged(r, @NO, NSNull.null);\n}\n\n- (void)testDeleteParentOfObservedRLMArray {\n    KVOObject *obj = [self createObject];\n    KVORecorder r1(self, obj, @\"objectArray\");\n    KVORecorder r2(self, obj, @\"objectArray.invalidated\");\n    KVORecorder r3(self, obj.objectArray, RLMInvalidatedKey);\n    [self.realm deleteObject:obj];\n    AssertChanged(r2, @NO, @YES);\n    AssertChanged(r3, @NO, @YES);\n}\n\n- (void)testDeleteAllObjects {\n    KVOObject *obj = [self createObject];\n    KVORecorder r1(self, obj, @\"boolCol\");\n    KVORecorder r2(self, obj, RLMInvalidatedKey);\n    [self.realm deleteAllObjects];\n    AssertChanged(r2, @NO, @YES);\n    // should not crash\n}\n\n- (void)testClearTable {\n    KVOObject *obj = [self createObject];\n    KVORecorder r1(self, obj, @\"boolCol\");\n    KVORecorder r2(self, obj, RLMInvalidatedKey);\n    [self.realm deleteObjects:[KVOObject allObjectsInRealm:self.realm]];\n    AssertChanged(r2, @NO, @YES);\n    // should not crash\n}\n\n- (void)testClearQuery {\n    KVOObject *obj = [self createObject];\n    KVORecorder r1(self, obj, @\"boolCol\");\n    KVORecorder r2(self, obj, RLMInvalidatedKey);\n    [self.realm deleteObjects:[KVOObject objectsInRealm:self.realm where:@\"TRUEPREDICATE\"]];\n    AssertChanged(r2, @NO, @YES);\n    // should not crash\n}\n\n- (void)testClearLinkView {\n    KVOObject *obj = [self createObject];\n    KVOObject *obj2 = [self createObject];\n    [obj2.objectArray addObject:obj];\n\n    KVORecorder r1(self, obj, @\"boolCol\");\n    KVORecorder r2(self, obj, RLMInvalidatedKey);\n    [self.realm deleteObjects:obj2.objectArray];\n    AssertChanged(r2, @NO, @YES);\n    // should not crash\n}\n\n- (void)testCreateObserverAfterDealloc {\n    @autoreleasepool {\n        KVOObject *obj = [self createObject];\n        KVORecorder r(self, obj, @\"boolCol\");\n        obj.boolCol = YES;\n        AssertChanged(r, @NO, @YES);\n    }\n    @autoreleasepool {\n        KVOObject *obj = [self createObject];\n        KVORecorder r(self, obj, @\"boolCol\");\n        obj.boolCol = YES;\n        AssertChanged(r, @NO, @YES);\n    }\n}\n\n- (void)testDirectlyDeleteLinkedToObject {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVOLinkObject1 *linked = obj.obj;\n    KVORecorder r(self, obj, @\"obj\");\n    KVORecorder r2(self, obj, @\"obj.invalidated\");\n    [self.realm deleteObject:linked];\n\n    if (NSDictionary *note = AssertNotification(r)) {\n        XCTAssertTrue([note[NSKeyValueChangeOldKey] isKindOfClass:[RLMObjectBase class]]);\n        XCTAssertEqualObjects(note[NSKeyValueChangeNewKey], NSNull.null);\n    }\n    AssertChanged(r2, @NO, NSNull.null);\n}\n\n- (void)testDeleteLinkedToObjectViaTableClear {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVORecorder r(self, obj, @\"obj\");\n    KVORecorder r2(self, obj, @\"obj.invalidated\");\n    [self.realm deleteObjects:[KVOLinkObject1 allObjectsInRealm:self.realm]];\n\n    if (NSDictionary *note = AssertNotification(r)) {\n        XCTAssertTrue([note[NSKeyValueChangeOldKey] isKindOfClass:[RLMObjectBase class]]);\n        XCTAssertEqualObjects(note[NSKeyValueChangeNewKey], NSNull.null);\n    }\n    AssertChanged(r2, @NO, NSNull.null);\n}\n\n- (void)testDeleteLinkedToObjectViaQueryClear {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVORecorder r(self, obj, @\"obj\");\n    KVORecorder r2(self, obj, @\"obj.invalidated\");\n    [self.realm deleteObjects:[KVOLinkObject1 objectsInRealm:self.realm where:@\"TRUEPREDICATE\"]];\n\n    if (NSDictionary *note = AssertNotification(r)) {\n        XCTAssertTrue([note[NSKeyValueChangeOldKey] isKindOfClass:[RLMObjectBase class]]);\n        XCTAssertEqualObjects(note[NSKeyValueChangeNewKey], NSNull.null);\n    }\n    AssertChanged(r2, @NO, NSNull.null);\n}\n\n- (void)testDeleteObjectInArray {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVOLinkObject1 *linked = obj.obj;\n    [obj.array addObject:linked];\n    KVORecorder r(self, obj, @\"array\");\n    [self.realm deleteObject:linked];\n    AssertIndexChange(NSKeyValueChangeRemoval, [NSIndexSet indexSetWithIndex:0]);\n}\n\n- (void)testDeleteObjectsInArrayViaTableClear {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVOLinkObject2 *obj2 = [self createLinkObject];\n    [obj.array addObject:obj.obj];\n    [obj.array addObject:obj.obj];\n    [obj.array addObject:obj2.obj];\n\n    KVORecorder r(self, obj, @\"array\");\n    [self.realm deleteObjects:[KVOLinkObject1 allObjectsInRealm:self.realm]];\n    AssertIndexChange(NSKeyValueChangeRemoval, ([NSIndexSet indexSetWithIndexesInRange:{0, 3}]));\n}\n\n- (void)testDeleteObjectsInArrayViaTableViewClear {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVOLinkObject2 *obj2 = [self createLinkObject];\n    [obj.array addObject:obj2.obj];\n    [obj.array addObject:obj.obj];\n    [obj.array addObject:obj.obj];\n\n    KVORecorder r(self, obj, @\"array\");\n    RLMResults *results = [KVOLinkObject1 objectsInRealm:self.realm where:@\"TRUEPREDICATE\"];\n    [results lastObject];\n    [self.realm deleteObjects:results];\n    AssertIndexChange(NSKeyValueChangeRemoval, ([NSIndexSet indexSetWithIndexesInRange:{0, 3}]));\n}\n\n- (void)testDeleteObjectsInArrayViaQueryClear {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVOLinkObject2 *obj2 = [self createLinkObject];\n    [obj.array addObject:obj.obj];\n    [obj.array addObject:obj.obj];\n    [obj.array addObject:obj2.obj];\n\n    KVORecorder r(self, obj, @\"array\");\n    [self.realm deleteObjects:[KVOLinkObject1 objectsInRealm:self.realm where:@\"TRUEPREDICATE\"]];\n    AssertIndexChange(NSKeyValueChangeRemoval, ([NSIndexSet indexSetWithIndexesInRange:{0, 3}]));\n}\n\n- (void)testObserveInvalidArrayProperty {\n    KVOObject *obj = [self createObject];\n    RLMArray *array = obj.objectArray;\n    XCTAssertThrows([array addObserver:self forKeyPath:@\"self\" options:0 context:0]);\n    XCTAssertNoThrow([array addObserver:self forKeyPath:RLMInvalidatedKey options:0 context:0]);\n    XCTAssertNoThrow([array removeObserver:self forKeyPath:RLMInvalidatedKey context:0]);\n}\n\n- (void)testInvalidOperationOnObservedArray {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVOLinkObject1 *linked = obj.obj;\n    [obj.array addObject:linked];\n    KVORecorder r(self, obj, @\"array\");\n    XCTAssertThrows([obj.array exchangeObjectAtIndex:2 withObjectAtIndex:3]);\n    // A KVO notification is still sent to observers on the same thread since we\n    // can't cancel willChange, but the data is not very meaningful so don't check it\n    if (!self.collapsesNotifications) {\n        AssertNotification(r);\n    }\n}\n\n- (void)testDeleteObjectInSet {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVOLinkObject1 *linked = obj.obj;\n    [obj.set addObject:linked];\n    KVORecorder r(self, obj, @\"set\");\n    [self.realm deleteObject:linked];\n    AssertCollectionChanged();\n}\n\n- (void)testDeleteObjectsInSetViaTableClear {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVORecorder r(self, obj, @\"set\");\n\n    [obj.set addObject:obj.obj];\n    AssertCollectionChanged();\n\n    [self.realm deleteObjects:[KVOLinkObject1 allObjectsInRealm:self.realm]];\n    AssertCollectionChanged();\n}\n\n- (void)testDeleteObjectsInSetViaTableViewClear {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVOLinkObject2 *obj2 = [self createLinkObject];\n    KVORecorder r(self, obj, @\"set\");\n    [obj.set addObject:obj2.obj];\n    AssertCollectionChanged();\n\n    RLMResults *results = [KVOLinkObject1 objectsInRealm:self.realm where:@\"TRUEPREDICATE\"];\n    [results lastObject];\n    [self.realm deleteObjects:results];\n    AssertCollectionChanged();\n}\n\n- (void)testDeleteObjectsInSetViaQueryClear {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVORecorder r(self, obj, @\"set\");\n    [obj.set addObject:obj.obj];\n    AssertCollectionChanged();\n\n    [self.realm deleteObjects:[KVOLinkObject1 objectsInRealm:self.realm where:@\"TRUEPREDICATE\"]];\n    AssertCollectionChanged();\n}\n\n- (void)testObserveInvalidSetProperty {\n    KVOObject *obj = [self createObject];\n    RLMSet *set = obj.objectSet;\n    XCTAssertThrows([set addObserver:self forKeyPath:@\"self\" options:0 context:0]);\n    XCTAssertNoThrow([set addObserver:self forKeyPath:RLMInvalidatedKey options:0 context:0]);\n    XCTAssertNoThrow([set removeObserver:self forKeyPath:RLMInvalidatedKey context:0]);\n}\n\n- (void)testInvalidOperationOnObservedSet {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVOLinkObject1 *linked = obj.obj;\n    [obj.set addObject:linked];\n    KVORecorder r(self, obj, @\"set\");\n    XCTAssertThrows([obj.set addObject:(id)@1]);\n    // A KVO notification is still sent to observers on the same thread since we\n    // can't cancel willChange, but the data is not very meaningful so don't check it\n    if (!self.collapsesNotifications) {\n        AssertNotification(r);\n    }\n}\n\n- (void)testDeleteObjectInDictionary {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVOLinkObject1 *linked = obj.obj;\n    [obj.dictionary setObject:linked forKey:@\"key\"];\n    KVORecorder r(self, obj, @\"dictionary\");\n    [self.realm deleteObject:linked];\n    AssertCollectionChanged();\n}\n\n- (void)testDeleteObjectsInDictionaryViaTableClear {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVORecorder r(self, obj, @\"dictionary\");\n\n    [obj.dictionary setObject:obj.obj forKey:@\"key\"];\n    AssertCollectionChanged();\n\n    [self.realm deleteObjects:[KVOLinkObject1 allObjectsInRealm:self.realm]];\n    AssertCollectionChanged();\n}\n\n- (void)testDeleteObjectsInDictionaryViaTableViewClear {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVOLinkObject2 *obj2 = [self createLinkObject];\n    KVORecorder r(self, obj, @\"dictionary\");\n    [obj.dictionary setObject:obj2.obj forKey:@\"key\"];\n    AssertCollectionChanged();\n\n    RLMResults *results = [KVOLinkObject1 objectsInRealm:self.realm where:@\"TRUEPREDICATE\"];\n    [results lastObject];\n    [self.realm deleteObjects:results];\n    AssertCollectionChanged();\n}\n\n- (void)testDeleteObjectsInDictionaryViaQueryClear {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVORecorder r(self, obj, @\"dictionary\");\n    [obj.dictionary setObject:obj.obj forKey:@\"key\"];\n    AssertCollectionChanged();\n\n    [self.realm deleteObjects:[KVOLinkObject1 objectsInRealm:self.realm where:@\"TRUEPREDICATE\"]];\n    AssertCollectionChanged();\n}\n\n- (void)testObserveInvalidDictionaryProperty {\n    KVOObject *obj = [self createObject];\n    RLMDictionary *dictionary = obj.objectDictionary;\n    XCTAssertThrows([dictionary addObserver:self forKeyPath:@\"self\" options:0 context:0]);\n    XCTAssertNoThrow([dictionary addObserver:self forKeyPath:RLMInvalidatedKey options:0 context:0]);\n    XCTAssertNoThrow([dictionary removeObserver:self forKeyPath:RLMInvalidatedKey context:0]);\n}\n\n- (void)testInvalidOperationOnObservedDictionary {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    KVORecorder r(self, obj, @\"dictionary\");\n    XCTAssertThrows([obj.dictionary setObject:(id)@1 forKey:@\"key\"]);\n    // A KVO notification is still sent to observers on the same thread since we\n    // can't cancel willChange, but the data is not very meaningful so don't check it\n    if (!self.collapsesNotifications) {\n        AssertNotification(r);\n    }\n}\n\n- (void)testDeleteParentOfObservedEmbeddedObject {\n    EmbeddedIntParentObject *obj = [self createEmbeddedObject];\n    KVORecorder r1(self, obj, @\"object\");\n    KVORecorder r2(self, obj, @\"object.invalidated\");\n    KVORecorder r3(self, obj.object, RLMInvalidatedKey);\n    [self.realm deleteObject:obj];\n    AssertChanged(r2, @NO, @YES);\n    AssertChanged(r3, @NO, @YES);\n}\n\n- (void)testSetLinkToEmbeddedObjectToNil {\n    EmbeddedIntParentObject *obj = [self createEmbeddedObject];\n    KVORecorder r1(self, obj, @\"object.invalidated\");\n    KVORecorder r2(self, obj.object, RLMInvalidatedKey);\n    obj.object = nil;\n\n    AssertChanged(r1, @NO, NSNull.null);\n    AssertChanged(r2, @NO, @YES);\n}\n\n- (void)testSetLinkToEmbeddedObjectToNewObject {\n    EmbeddedIntParentObject *obj = [self createEmbeddedObject];\n    KVORecorder r1(self, obj, @\"object.invalidated\");\n    KVORecorder r2(self, obj.object, RLMInvalidatedKey);\n    obj.object = [[EmbeddedIntObject alloc] init];\n\n    AssertChanged(r1, @NO, @NO);\n    AssertChanged(r2, @NO, @YES);\n}\n\n- (void)testDynamicSetLinkToEmbeddedObjectToNil {\n    EmbeddedIntParentObject *obj = [self createEmbeddedObject];\n    KVORecorder r1(self, obj, @\"object.invalidated\");\n    KVORecorder r2(self, obj.object, RLMInvalidatedKey);\n    obj[@\"object\"] = nil;\n\n    AssertChanged(r1, @NO, NSNull.null);\n    AssertChanged(r2, @NO, @YES);\n}\n\n- (void)testDynamicSetLinkToEmbeddedObjectToNewObject {\n    EmbeddedIntParentObject *obj = [self createEmbeddedObject];\n    KVORecorder r1(self, obj, @\"object.invalidated\");\n    KVORecorder r2(self, obj.object, RLMInvalidatedKey);\n    obj[@\"object\"] = [[EmbeddedIntObject alloc] init];\n\n    AssertChanged(r1, @NO, @NO);\n    AssertChanged(r2, @NO, @YES);\n}\n\n- (void)testRemoveEmbeddedObjectFromArray {\n    EmbeddedIntParentObject *obj = [self createEmbeddedObject];\n    KVORecorder r(self, obj.array[0], RLMInvalidatedKey);\n    [obj.array removeAllObjects];\n    AssertChanged(r, @NO, @YES);\n}\n\n- (void)testOverwriteEmbeddedObjectInArray {\n    EmbeddedIntParentObject *obj = [self createEmbeddedObject];\n    KVORecorder r(self, obj, @\"array\");\n    KVORecorder r2(self, obj.array[0], RLMInvalidatedKey);\n    obj.array[0] = [[EmbeddedIntObject alloc] init];\n    AssertIndexChange(NSKeyValueChangeReplacement, ([NSIndexSet indexSetWithIndexesInRange:{0, 1}]));\n    AssertChanged(r2, @NO, @YES);\n}\n\n- (void)testOverwriteEmbeddedObjectViaAddParent {\n    EmbeddedIntParentObject *obj = [self createEmbeddedObject];\n    KVORecorder r1(self, obj.object, RLMInvalidatedKey);\n    KVORecorder r2(self, obj.array[0], RLMInvalidatedKey);\n\n    [self.realm addOrUpdateObject:[[EmbeddedIntParentObject alloc] initWithValue:@[@1]]];\n    AssertChanged(r1, @NO, @YES);\n    AssertChanged(r2, @NO, @YES);\n}\n\n- (void)testOverwriteEmbeddedObjectViaCreateParent {\n    EmbeddedIntParentObject *obj = [self createEmbeddedObject];\n    KVORecorder r1(self, obj.object, RLMInvalidatedKey);\n    KVORecorder r2(self, obj.array[0], RLMInvalidatedKey);\n\n    [EmbeddedIntParentObject createOrUpdateInRealm:self.realm withValue:@[@1, NSNull.null, NSNull.null]];\n    AssertChanged(r1, @NO, @YES);\n    AssertChanged(r2, @NO, @YES);\n}\n@end\n\n// Mutate a different accessor backed by the same row as the accessor being observed\n@interface KVOMultipleAccessorsTests : KVOManagedObjectTests\n@end\n@implementation KVOMultipleAccessorsTests\n- (id)observableForObject:(id)value {\n    if (RLMObjectBase *obj = RLMDynamicCast<RLMObjectBase>(value)) {\n        RLMObject *copy = RLMCreateManagedAccessor(RLMObjectBaseObjectSchema(obj).accessorClass, obj->_info);\n        copy->_row = obj->_row;\n        return copy;\n    }\n    else if (RLMArray *array = RLMDynamicCast<RLMArray>(value)) {\n        return array;\n    }\n    else {\n        XCTFail(@\"unsupported type\");\n        return nil;\n    }\n}\n\n- (void)testIgnoredProperty {\n    // ignored properties do not notify other accessors for the same row\n}\n\n- (void)testAddOrUpdate {\n    KVOObject *obj = [self createObject];\n    KVOObject *obj2 = [[KVOObject alloc] initWithValue:obj];\n\n    KVORecorder r(self, obj, @\"boolCol\");\n    obj2.boolCol = true;\n    XCTAssertTrue(r.empty());\n    [self.realm addOrUpdateObject:obj2];\n    AssertChanged(r, @NO, @YES);\n}\n\n- (void)testCreateOrUpdate {\n    KVOObject *obj = [self createObject];\n    KVOObject *obj2 = [[KVOObject alloc] initWithValue:obj];\n\n    KVORecorder r(self, obj, @\"boolCol\");\n    obj2.boolCol = true;\n    XCTAssertTrue(r.empty());\n    [KVOObject createOrUpdateInRealm:self.realm withValue:obj2];\n    AssertChanged(r, @NO, @YES);\n}\n\n// The following tests aren't really multiple-accessor-specific, but they're\n// conceptually similar and don't make sense in the multiple realm instances case\n- (void)testCancelWriteTransactionWhileObservingNewObject {\n    KVOObject *obj = [self createObject];\n    KVORecorder r(self, obj, RLMInvalidatedKey);\n    KVORecorder r2(self, obj, @\"boolCol\");\n    [self.realm cancelWriteTransaction];\n    AssertChanged(r, @NO, @YES);\n    r2.pop_front();\n    [self.realm beginWriteTransaction];\n}\n\n- (void)testCancelWriteTransactionWhileObservingChangedProperty {\n    KVOObject *obj = [self createObject];\n    [self.realm commitWriteTransaction];\n    [self.realm beginWriteTransaction];\n\n    obj.boolCol = YES;\n\n    KVORecorder r(self, obj, @\"boolCol\");\n    [self.realm cancelWriteTransaction];\n    AssertChanged(r, @YES, @NO);\n\n    [self.realm beginWriteTransaction];\n}\n\n- (void)testCancelWriteTransactionWhileObservingLinkToExistingObject {\n    KVOObject *obj = [self createObject];\n    KVOObject *obj2 = [self createObject];\n    [self.realm commitWriteTransaction];\n    [self.realm beginWriteTransaction];\n\n    obj.objectCol = obj2;\n\n    KVORecorder r(self, obj, @\"objectCol\");\n    [self.realm cancelWriteTransaction];\n    AssertChanged(r, obj2, NSNull.null);\n\n    [self.realm beginWriteTransaction];\n}\n\n- (void)testCancelWriteTransactionWhileObservingLinkToNewObject {\n    KVOObject *obj = [self createObject];\n    [self.realm commitWriteTransaction];\n    [self.realm beginWriteTransaction];\n\n    obj.objectCol = [self createObject];\n\n    KVORecorder r(self, obj, @\"objectCol\");\n    [self.realm cancelWriteTransaction];\n\n    if (NSDictionary *note = AssertNotification(r)) {\n        XCTAssertTrue([note[NSKeyValueChangeOldKey] isKindOfClass:[RLMObjectBase class]]);\n        XCTAssertEqualObjects(note[NSKeyValueChangeNewKey], NSNull.null);\n    }\n\n    [self.realm beginWriteTransaction];\n}\n\n- (void)testCancelWriteTransactionWhileObservingNewObjectLinkingToNewObject {\n    KVOObject *obj = [self createObject];\n    obj.objectCol = [self createObject];\n    KVORecorder r(self, obj, RLMInvalidatedKey);\n    KVORecorder r2(self, obj, @\"objectCol\");\n    KVORecorder r3(self, obj, @\"objectCol.boolCol\");\n    [self.realm cancelWriteTransaction];\n    AssertChanged(r, @NO, @YES);\n    [self.realm beginWriteTransaction];\n}\n\n- (void)testCancelWriteWithArrayChanges {\n    KVOObject *obj = [self createObject];\n    [obj.objectArray addObject:obj];\n    [self.realm commitWriteTransaction];\n    [self.realm beginWriteTransaction];\n\n    {\n        [obj.objectArray addObject:obj];\n        KVORecorder r(self, obj, @\"objectArray\");\n        [self.realm cancelWriteTransaction];\n        [self.realm beginWriteTransaction];\n        AssertIndexChange(NSKeyValueChangeRemoval, [NSIndexSet indexSetWithIndex:1]);\n    }\n    {\n        [obj.objectArray removeLastObject];\n        KVORecorder r(self, obj, @\"objectArray\");\n        [self.realm cancelWriteTransaction];\n        [self.realm beginWriteTransaction];\n        AssertIndexChange(NSKeyValueChangeInsertion, [NSIndexSet indexSetWithIndex:0]);\n    }\n    {\n        obj.objectArray[0] = obj;\n        KVORecorder r(self, obj, @\"objectArray\");\n        [self.realm cancelWriteTransaction];\n        [self.realm beginWriteTransaction];\n        AssertIndexChange(NSKeyValueChangeReplacement, [NSIndexSet indexSetWithIndex:0]);\n    }\n\n    // test batching with multiple items changed\n    [obj.objectArray addObject:obj];\n    [self.realm commitWriteTransaction];\n    [self.realm beginWriteTransaction];\n    {\n        [obj.objectArray removeAllObjects];\n        KVORecorder r(self, obj, @\"objectArray\");\n        [self.realm cancelWriteTransaction];\n        [self.realm beginWriteTransaction];\n        AssertIndexChange(NSKeyValueChangeInsertion, ([NSIndexSet indexSetWithIndexesInRange:{0, 2}]));\n    }\n    {\n        [obj.objectArray removeLastObject];\n        [obj.objectArray removeLastObject];\n        KVORecorder r(self, obj, @\"objectArray\");\n        [self.realm cancelWriteTransaction];\n        [self.realm beginWriteTransaction];\n        AssertIndexChange(NSKeyValueChangeInsertion, ([NSIndexSet indexSetWithIndexesInRange:{0, 2}]));\n    }\n    {\n        [obj.objectArray insertObject:obj atIndex:1];\n        [obj.objectArray insertObject:obj atIndex:0];\n        KVORecorder r(self, obj, @\"objectArray\");\n        [self.realm cancelWriteTransaction];\n        [self.realm beginWriteTransaction];\n        NSMutableIndexSet *expected = [NSMutableIndexSet new];\n        [expected addIndex:0];\n        [expected addIndex:2]; // shifted due to inserting at 0 after 1\n        AssertIndexChange(NSKeyValueChangeRemoval, expected);\n    }\n    {\n        [obj.objectArray insertObject:obj atIndex:0];\n        [obj.objectArray removeLastObject];\n        KVORecorder r(self, obj, @\"objectArray\");\n        [self.realm cancelWriteTransaction];\n        [self.realm beginWriteTransaction];\n        AssertChanged(r, obj.objectArray, obj.objectArray);\n    }\n}\n\n- (void)testCancelWriteWithPrimitiveArrayChanges {\n    KVOObject *obj = [self createObject];\n    [obj.intArray addObject:@1];\n    [self.realm commitWriteTransaction];\n    [self.realm beginWriteTransaction];\n\n    {\n        [obj.intArray addObject:@2];\n        KVORecorder r(self, obj, @\"intArray\");\n        [self.realm cancelWriteTransaction];\n        [self.realm beginWriteTransaction];\n        AssertIndexChange(NSKeyValueChangeRemoval, [NSIndexSet indexSetWithIndex:1]);\n    }\n    {\n        [obj.intArray removeLastObject];\n        KVORecorder r(self, obj, @\"intArray\");\n        [self.realm cancelWriteTransaction];\n        [self.realm beginWriteTransaction];\n        AssertIndexChange(NSKeyValueChangeInsertion, [NSIndexSet indexSetWithIndex:0]);\n    }\n    {\n        obj.intArray[0] = @3;\n        KVORecorder r(self, obj, @\"intArray\");\n        [self.realm cancelWriteTransaction];\n        [self.realm beginWriteTransaction];\n        AssertIndexChange(NSKeyValueChangeReplacement, [NSIndexSet indexSetWithIndex:0]);\n    }\n\n    // test batching with multiple items changed\n    [obj.intArray addObject:@4];\n    [self.realm commitWriteTransaction];\n    [self.realm beginWriteTransaction];\n    {\n        [obj.intArray removeAllObjects];\n        KVORecorder r(self, obj, @\"intArray\");\n        [self.realm cancelWriteTransaction];\n        [self.realm beginWriteTransaction];\n        AssertIndexChange(NSKeyValueChangeInsertion, ([NSIndexSet indexSetWithIndexesInRange:{0, 2}]));\n    }\n    {\n        [obj.intArray removeLastObject];\n        [obj.intArray removeLastObject];\n        KVORecorder r(self, obj, @\"intArray\");\n        [self.realm cancelWriteTransaction];\n        [self.realm beginWriteTransaction];\n        AssertIndexChange(NSKeyValueChangeInsertion, ([NSIndexSet indexSetWithIndexesInRange:{0, 2}]));\n    }\n    {\n        [obj.intArray insertObject:@5 atIndex:1];\n        [obj.intArray insertObject:@6 atIndex:0];\n        KVORecorder r(self, obj, @\"intArray\");\n        [self.realm cancelWriteTransaction];\n        [self.realm beginWriteTransaction];\n        NSMutableIndexSet *expected = [NSMutableIndexSet new];\n        [expected addIndex:0];\n        [expected addIndex:2]; // shifted due to inserting at 0 after 1\n        AssertIndexChange(NSKeyValueChangeRemoval, expected);\n    }\n    {\n        [obj.intArray insertObject:@7 atIndex:0];\n        [obj.intArray removeLastObject];\n        KVORecorder r(self, obj, @\"intArray\");\n        [self.realm cancelWriteTransaction];\n        [self.realm beginWriteTransaction];\n        AssertChanged(r, obj.intArray, obj.intArray);\n    }\n}\n\n- (void)testCancelWriteWithLinkedObjectedRemoved {\n    KVOLinkObject2 *obj = [self createLinkObject];\n    [obj.array addObject:obj.obj];\n    [self.realm commitWriteTransaction];\n    [self.realm beginWriteTransaction];\n\n    {\n        [self.realm deleteObject:obj.obj];\n\n        KVORecorder r(self, obj, @\"array\");\n        KVORecorder r2(self, obj, @\"obj\");\n        [self.realm cancelWriteTransaction];\n        [self.realm beginWriteTransaction];\n        AssertIndexChange(NSKeyValueChangeInsertion, [NSIndexSet indexSetWithIndex:0]);\n        AssertChanged(r2, NSNull.null, [KVOLinkObject1 allObjectsInRealm:self.realm].firstObject);\n    }\n    {\n        [self.realm deleteObjects:[KVOLinkObject1 allObjectsInRealm:self.realm]];\n\n        KVORecorder r(self, obj, @\"array\");\n        KVORecorder r2(self, obj, @\"obj\");\n        [self.realm cancelWriteTransaction];\n        [self.realm beginWriteTransaction];\n        AssertIndexChange(NSKeyValueChangeInsertion, [NSIndexSet indexSetWithIndex:0]);\n        AssertChanged(r2, NSNull.null, [KVOLinkObject1 allObjectsInRealm:self.realm].firstObject);\n    }\n    {\n        [self.realm deleteObjects:obj.array];\n\n        KVORecorder r(self, obj, @\"array\");\n        KVORecorder r2(self, obj, @\"obj\");\n        [self.realm cancelWriteTransaction];\n        [self.realm beginWriteTransaction];\n        AssertIndexChange(NSKeyValueChangeInsertion, [NSIndexSet indexSetWithIndex:0]);\n        AssertChanged(r2, NSNull.null, [KVOLinkObject1 allObjectsInRealm:self.realm].firstObject);\n    }\n}\n\n- (void)testInvalidateRealm {\n    KVOObject *obj = [self createObject];\n    [self.realm commitWriteTransaction];\n\n    KVORecorder r1(self, obj, RLMInvalidatedKey);\n    KVORecorder r2(self, obj, @\"objectArray.invalidated\");\n    [self.realm invalidate];\n    [self.realm beginWriteTransaction];\n\n    AssertChanged(r1, @NO, @YES);\n    AssertChanged(r2, @NO, @YES);\n}\n\n- (void)testRenamedProperties {\n    auto obj = [RenamedProperties1 createInRealm:self.realm withValue:@[@1, @\"a\"]];\n    [self.realm commitWriteTransaction];\n    [self.realm beginWriteTransaction];\n    KVORecorder r(self, obj, @\"propA\");\n\n    obj.propA = 2;\n    AssertChanged(r, @1, @2);\n\n    obj[@\"propA\"] = @3;\n    AssertChanged(r, @2, @3);\n\n    [obj setValue:@4 forKey:@\"propA\"];\n    AssertChanged(r, @3, @4);\n\n    // Only rollback will notify objects of different types with the same table,\n    // not direct modification. Probably not worth fixing this.\n    RenamedProperties2 *obj2 = [RenamedProperties2 allObjectsInRealm:self.realm].firstObject;\n    KVORecorder r2(self, obj2, @\"propC\");\n\n    [self.realm cancelWriteTransaction];\n    [self.realm beginWriteTransaction];\n\n    AssertChanged(r, @4, @1);\n    AssertChanged(r2, @4, @1);\n}\n@end\n\n// Observing an object from a different RLMRealm instance backed by the same\n// row as the managed object being mutated\n@interface KVOMultipleRealmsTests : KVOManagedObjectTests\n@property RLMRealm *secondaryRealm;\n@end\n\n@implementation KVOMultipleRealmsTests\n- (void)setUp {\n    [super setUp];\n    RLMRealmConfiguration *config = self.realm.configuration;\n    config.cache = false;\n    self.secondaryRealm = [RLMRealm realmWithConfiguration:config error:nil];\n}\n\n- (void)tearDown {\n    self.secondaryRealm = nil;\n    [super tearDown];\n}\n\n- (id)observableForObject:(id)value {\n    [self.realm commitWriteTransaction];\n    [self.realm beginWriteTransaction];\n    [self.secondaryRealm refresh];\n\n    if (RLMObjectBase *obj = RLMDynamicCast<RLMObjectBase>(value)) {\n        RLMObjectSchema *objectSchema = RLMObjectBaseObjectSchema(obj);\n        RLMObject *copy = RLMCreateManagedAccessor(objectSchema.accessorClass,\n                                                   &self.secondaryRealm->_info[objectSchema.className]);\n        copy->_row = (*copy->_info->table()).get_object(obj->_row.get_key());\n        return copy;\n    }\n    else if (RLMArray *array = RLMDynamicCast<RLMArray>(value)) {\n        return array;\n    }\n    else {\n        XCTFail(@\"unsupported type\");\n        return nil;\n    }\n\n}\n\n- (bool)collapsesNotifications {\n    return true;\n}\n\n- (void)testIgnoredProperty {\n    // ignored properties do not notify other accessors for the same row\n}\n\n- (void)testBatchArrayChanges {\n    KVOObject *obj = [self createObject];\n    [obj.objectArray addObject:obj];\n    [obj.objectArray addObject:obj];\n    [obj.objectArray addObject:obj];\n\n    {\n        KVORecorder r(self, obj, @\"objectArray\");\n        [obj.objectArray insertObject:obj atIndex:1];\n        [obj.objectArray insertObject:obj atIndex:0];\n\n        NSMutableIndexSet *expected = [NSMutableIndexSet new];\n        [expected addIndex:0];\n        [expected addIndex:2]; // shifted due to inserting at 0 after 1\n        AssertIndexChange(NSKeyValueChangeInsertion, expected);\n    }\n\n    {\n        KVORecorder r(self, obj, @\"objectArray\");\n        [obj.objectArray removeObjectAtIndex:3];\n        [obj.objectArray removeObjectAtIndex:3];\n        AssertIndexChange(NSKeyValueChangeRemoval, ([NSIndexSet indexSetWithIndexesInRange:{3, 2}]));\n    }\n\n    {\n        KVORecorder r(self, obj, @\"objectArray\");\n        [obj.objectArray removeObjectAtIndex:0];\n        [obj.objectArray removeAllObjects];\n        AssertIndexChange(NSKeyValueChangeRemoval, ([NSIndexSet indexSetWithIndexesInRange:{0, 3}]));\n    }\n\n    [obj.objectArray addObject:obj];\n    {\n        KVORecorder r(self, obj, @\"objectArray\");\n        [obj.objectArray addObject:obj];\n        [obj.objectArray removeAllObjects];\n        AssertIndexChange(NSKeyValueChangeRemoval, [NSIndexSet indexSetWithIndex:0]);\n    }\n\n    [obj.objectArray addObject:obj];\n    {\n        KVORecorder r(self, obj, @\"objectArray\");\n        obj.objectArray[0] = obj;\n        [obj.objectArray removeAllObjects];\n        AssertIndexChange(NSKeyValueChangeRemoval, [NSIndexSet indexSetWithIndex:0]);\n    }\n}\n\n- (void)testOrderedErase {\n    NSMutableArray *objects = [NSMutableArray arrayWithCapacity:10];\n    for (int i = 0; i < 10; ++i) @autoreleasepool {\n        [objects addObject:[ObjectWithNoLinksToOrFrom createInRealm:self.realm withValue:@[@(i)]]];\n    }\n\n    // deleteObject: always uses move_last_over(), but TableView::clear() uses\n    // erase() if there's no links\n    auto deleteObject = ^(int value) {\n        [self.realm deleteObjects:[ObjectWithNoLinksToOrFrom objectsInRealm:self.realm where:@\"value = %d\", value]];\n    };\n\n    { // delete object before observed, then observed\n        KVORecorder r(self, objects[2], @\"invalidated\");\n        deleteObject(1);\n        deleteObject(2);\n        AssertChanged(r, @NO, @YES);\n    }\n\n    { // delete object after observed, then observed\n        KVORecorder r(self, objects[3], @\"invalidated\");\n        deleteObject(4);\n        deleteObject(3);\n        AssertChanged(r, @NO, @YES);\n    }\n\n    { // delete observed, then object before observed\n        KVORecorder r(self, objects[6], @\"invalidated\");\n        deleteObject(6);\n        deleteObject(5);\n        AssertChanged(r, @NO, @YES);\n    }\n\n    { // delete observed, then object after observed\n        KVORecorder r(self, objects[7], @\"invalidated\");\n        deleteObject(7);\n        deleteObject(8);\n        AssertChanged(r, @NO, @YES);\n    }\n}\n@end\n\n// Test with the table column order not matching the order of the properties\n@interface KVOManagedObjectWithReorderedPropertiesTests : KVOManagedObjectTests\n@end\n\n@implementation KVOManagedObjectWithReorderedPropertiesTests\n- (RLMRealm *)getRealm {\n    // Initialize the file with the properties in reverse order, then re-open\n    // with it in the normal order while the reversed one is still open (as\n    // otherwise it'll recreate the file due to being in-memory)\n    RLMSchema *schema = [RLMSchema new];\n    schema.objectSchema = @[[self reverseProperties:KVOObject.sharedSchema],\n                            [self reverseProperties:KVOLinkObject1.sharedSchema],\n                            [self reverseProperties:KVOLinkObject2.sharedSchema]];\n\n    RLMRealmConfiguration *configuration = [[RLMRealmConfiguration alloc] init];\n    configuration.cache = false;\n    configuration.inMemoryIdentifier = @\"test\";\n    configuration.customSchema = schema;\n    RLMRealm *reversedRealm = [RLMRealm realmWithConfiguration:configuration error:nil];\n\n    configuration.customSchema = nil;\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:configuration error:nil];\n    XCTAssertNotEqualObjects(realm.schema, reversedRealm.schema);\n    return realm;\n}\n\n- (RLMObjectSchema *)reverseProperties:(RLMObjectSchema *)source {\n    RLMObjectSchema *objectSchema = [source copy];\n    objectSchema.properties = objectSchema.properties.reverseObjectEnumerator.allObjects;\n    return objectSchema;\n}\n@end\n"
  },
  {
    "path": "Realm/Tests/LinkTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n#import \"RLMRealm_Dynamic.h\"\n\nRLM_COLLECTION_TYPE(CircularArrayObject)\n@interface CircularArrayObject : RLMObject\n@property RLM_GENERIC_ARRAY(CircularArrayObject) *array;\n@end\n@implementation CircularArrayObject\n@end\n\nRLM_COLLECTION_TYPE(CircularSetObject)\n@interface CircularSetObject : RLMObject\n@property RLM_GENERIC_SET(CircularSetObject) *set;\n@end\n@implementation CircularSetObject\n@end\n\n@interface LinkTests : RLMTestCase\n@end\n\n@implementation LinkTests\n\n- (void)makeDogWithName:(NSString *)name owner:(NSString *)ownerName {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    OwnerObject *owner = [[OwnerObject alloc] init];\n    owner.name = ownerName;\n    owner.dog = [[DogObject alloc] init];\n    owner.dog.dogName = name;\n    owner.dog.age = 0;\n\n    [realm beginWriteTransaction];\n    [realm addObject:owner];\n    [realm commitWriteTransaction];\n}\n\n- (void)testBasicLink\n{\n    [self makeDogWithName:@\"Harvie\" owner:@\"Tim\"];\n\n    RLMRealm *realm = [self realmWithTestPath];\n    RLMResults *owners = [OwnerObject objectsInRealm:realm withPredicate:nil];\n    RLMResults *dogs = [DogObject objectsInRealm:realm withPredicate:nil];\n    XCTAssertEqual(owners.count, 1U);\n    XCTAssertEqual(dogs.count, 1U);\n    XCTAssertEqualObjects([owners[0] name], @\"Tim\", @\"Tim is named Tim\");\n    XCTAssertEqualObjects([dogs[0] dogName], @\"Harvie\", @\"Harvie is named Harvie\");\n\n    OwnerObject *tim = owners[0];\n    XCTAssertEqualObjects(tim.dog.dogName, @\"Harvie\", @\"Tim's dog should be Harvie\");\n}\n\n-(void)testBasicLinkWithNil\n{\n    RLMRealm *realm = [self realmWithTestPath];\n\n    OwnerObject *owner = [[OwnerObject alloc] init];\n    owner.name = @\"Tim\";\n    owner.dog = nil;\n\n    [realm beginWriteTransaction];\n    [realm addObject:owner];\n    [realm commitWriteTransaction];\n\n    RLMResults *owners = [OwnerObject objectsInRealm:realm withPredicate:nil];\n    RLMResults *dogs = [DogObject objectsInRealm:realm withPredicate:nil];\n    XCTAssertEqual(owners.count, 1U);\n    XCTAssertEqual(dogs.count, 0U);\n    XCTAssertEqualObjects([owners[0] name], @\"Tim\", @\"Tim is named Tim\");\n\n    OwnerObject *tim = owners[0];\n    XCTAssertEqualObjects(tim.dog, nil, @\"Tim does not have a dog\");\n}\n\n- (void)testMultipleOwnerLink\n{\n    [self makeDogWithName:@\"Harvie\" owner:@\"Tim\"];\n\n    RLMRealm *realm = [self realmWithTestPath];\n\n    XCTAssertEqual([OwnerObject allObjectsInRealm:realm].count, 1U);\n    XCTAssertEqual([DogObject allObjectsInRealm:realm].count, 1U);\n\n    [realm beginWriteTransaction];\n    OwnerObject *fiel = [OwnerObject createInRealm:realm withValue:@[@\"Fiel\", [NSNull null]]];\n    fiel.dog = [DogObject allObjectsInRealm:realm].firstObject;\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual([OwnerObject objectsInRealm:realm withPredicate:nil].count, 2U);\n    XCTAssertEqual([DogObject objectsInRealm:realm withPredicate:nil].count, 1U);\n}\n\n- (void)testLinkRemoval\n{\n    [self makeDogWithName:@\"Harvie\" owner:@\"Tim\"];\n\n    RLMRealm *realm = [self realmWithTestPath];\n    XCTAssertEqual([OwnerObject objectsInRealm:realm withPredicate:nil].count, 1U);\n    XCTAssertEqual([DogObject objectsInRealm:realm withPredicate:nil].count, 1U);\n\n    DogObject *dog = [DogObject allObjectsInRealm:realm].firstObject;\n    OwnerObject *owner = [OwnerObject allObjectsInRealm:realm].firstObject;\n\n    [realm beginWriteTransaction];\n    [realm deleteObject:dog];\n    [realm commitWriteTransaction];\n\n    XCTAssertNil(owner.dog, @\"Dog should be nullified when deleted\");\n    XCTAssertThrows(dog.dogName, @\"Dog object should be invalid after being deleted from the realm\");\n\n    // refresh owner and check\n    owner = [OwnerObject allObjectsInRealm:realm].firstObject;\n    XCTAssertNotNil(owner, @\"Should have 1 owner\");\n    XCTAssertNil(owner.dog, @\"Dog should be nullified when deleted\");\n    XCTAssertEqual([DogObject objectsInRealm:realm withPredicate:nil].count, 0U);\n}\n\n- (void)testInvalidLinks\n{\n    RLMRealm *realm = [self realmWithTestPath];\n\n    LinkToAllTypesObject *linkObject = [[LinkToAllTypesObject alloc] init];\n    linkObject.allTypesCol = [[AllTypesObject alloc] init];\n    [realm beginWriteTransaction];\n    XCTAssertThrows([realm addObject:linkObject], @\"dateCol not set on linked object\");\n\n    StringObject *to = [StringObject createInRealm:realm withValue:@[@\"testObject\"]];\n    NSArray *args = @[@\"Tim\", to];\n    XCTAssertThrows([OwnerObject createInRealm:realm withValue:args], @\"Inserting wrong object type should throw\");\n    [realm commitWriteTransaction];\n}\n\n- (void)testLinkTooManyRelationships\n{\n    RLMRealm *realm = [self realmWithTestPath];\n\n    OwnerObject *owner = [[OwnerObject alloc] init];\n    owner.name = @\"Tim\";\n    owner.dog = [[DogObject alloc] init];\n    owner.dog.dogName = @\"Harvie\";\n\n    [realm beginWriteTransaction];\n    [realm addObject:owner];\n    [realm commitWriteTransaction];\n\n    XCTAssertThrows([OwnerObject objectsInRealm:realm where:@\"dog.dogName.first = 'Fifo'\"], @\"3 levels of relationship\");\n}\n\n- (void)testBidirectionalRelationship {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    CircleObject *obj0 = [[CircleObject alloc] initWithValue:@[@\"a\", NSNull.null]];\n    CircleObject *obj1 = [[CircleObject alloc] initWithValue:@[@\"b\", obj0]];\n    obj0.next = obj1;\n\n    [realm beginWriteTransaction];\n    [realm addObject:obj0];\n    [realm addObject:obj1];\n    [realm commitWriteTransaction];\n\n    RLMResults *results = [CircleObject allObjects];\n    XCTAssertEqualObjects(@\"a\", [results[0] data]);\n    XCTAssertEqualObjects(@\"b\", [results[1] data]);\n}\n\n- (void)testAddingCircularReferenceDoesNotLeakSourceObjects {\n    CircleObject __weak *weakObj0, __weak *weakObj1;\n    @autoreleasepool {\n        CircleObject *obj0 = [[CircleObject alloc] initWithValue:@[@\"a\", NSNull.null]];\n        CircleObject *obj1 = [[CircleObject alloc] initWithValue:@[@\"b\", obj0]];\n        obj0.next = obj1;\n\n        weakObj0 = obj0;\n        weakObj1 = obj1;\n\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm beginWriteTransaction];\n        [realm addObject:obj0];\n        obj0.next = nil;\n        obj1.next = nil;\n        [realm commitWriteTransaction];\n    }\n\n    XCTAssertNil(weakObj0);\n    XCTAssertNil(weakObj1);\n}\n\n- (void)testAddingCircularReferenceInArrayDoesNotLeakSourceObjects {\n    CircularArrayObject __weak *weakObj0, __weak *weakObj1;\n    @autoreleasepool {\n        CircularArrayObject *obj0 = [[CircularArrayObject alloc] initWithValue:@[@[]]];\n        CircularArrayObject *obj1 = [[CircularArrayObject alloc] initWithValue:@[@[obj0]]];\n        [obj0.array addObject:obj1];\n\n        weakObj0 = obj0;\n        weakObj1 = obj1;\n\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm beginWriteTransaction];\n        [realm addObject:obj0];\n        [realm commitWriteTransaction];\n    }\n\n    XCTAssertNil(weakObj0);\n    XCTAssertNil(weakObj1);\n}\n\n- (void)testAddingCircularReferenceInSetDoesNotLeakSourceObjects {\n    CircularSetObject __weak *weakObj0, __weak *weakObj1;\n    @autoreleasepool {\n        CircularSetObject *obj0 = [[CircularSetObject alloc] initWithValue:@[@[]]];\n        CircularSetObject *obj1 = [[CircularSetObject alloc] initWithValue:@[@[obj0]]];\n        [obj0.set addObject:obj1];\n\n        weakObj0 = obj0;\n        weakObj1 = obj1;\n\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm beginWriteTransaction];\n        [realm addObject:obj0];\n        [realm commitWriteTransaction];\n    }\n\n    XCTAssertNil(weakObj0);\n    XCTAssertNil(weakObj1);\n}\n\n- (void)testCircularLinks {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    CircleObject *obj = [[CircleObject alloc] init];\n    obj.data = @\"a\";\n    obj.next = obj;\n\n    [realm beginWriteTransaction];\n    [realm addObject:obj];\n    obj.next.data = @\"b\";\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(1U, [CircleObject allObjectsInRealm:realm].count);\n    CircleObject *obj1 = [CircleObject allObjectsInRealm:realm].firstObject;\n    XCTAssertEqualObjects(obj1.data, @\"b\", @\"data should be 'b'\");\n    XCTAssertEqualObjects(obj1.data, obj.next.data, @\"objects should be equal\");\n}\n\n@end\n\n"
  },
  {
    "path": "Realm/Tests/LinkingObjectsTests.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2016 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n@interface LinkingObjectsTests : RLMTestCase\n@end\n\n@implementation LinkingObjectsTests\n\n- (void)testBasics {\n    NSArray *(^asArray)(id) = ^(id arrayLike) {\n        return [arrayLike valueForKeyPath:@\"self\"];\n    };\n\n    RLMRealm *realm = [self realmWithTestPath];\n    [realm beginWriteTransaction];\n\n    PersonObject *hannah = [PersonObject createInRealm:realm withValue:@[ @\"Hannah\", @0 ]];\n    PersonObject *mark   = [PersonObject createInRealm:realm withValue:@[ @\"Mark\",  @30, @[ hannah ]]];\n\n    RLMLinkingObjects *hannahsParents = hannah.parents;\n    XCTAssertEqualObjects(asArray(hannahsParents), (@[ mark ]));\n\n    [realm commitWriteTransaction];\n\n    XCTAssertEqualObjects(asArray(hannahsParents), (@[ mark ]));\n\n    [realm beginWriteTransaction];\n    PersonObject *diane = [PersonObject createInRealm:realm withValue:@[ @\"Diane\", @29, @[ hannah ]]];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqualObjects(asArray(hannahsParents), (@[ mark, diane ]));\n\n    [realm beginWriteTransaction];\n    [realm deleteObject:hannah];\n    [realm commitWriteTransaction];\n    XCTAssertEqualObjects(asArray(hannahsParents), (@[ ]));\n}\n\n- (void)testLinkingObjectsOnUnmanagedObject {\n    PersonObject *don = [[PersonObject alloc] initWithValue:@[ @\"Don\", @60, @[] ]];\n\n    XCTAssertEqual(0u, don.parents.count);\n    XCTAssertNil(don.parents.firstObject);\n    XCTAssertNil(don.parents.lastObject);\n\n    for (__unused id parent in don.parents) {\n        XCTFail(@\"Got an item in empty linking objects\");\n    }\n\n    XCTAssertEqual(0u, [don.parents sortedResultsUsingKeyPath:@\"age\" ascending:YES].count);\n    XCTAssertEqual(0u, [don.parents objectsWhere:@\"TRUEPREDICATE\"].count);\n\n    XCTAssertNil([don.parents minOfProperty:@\"age\"]);\n    XCTAssertNil([don.parents maxOfProperty:@\"age\"]);\n    XCTAssertEqualObjects(@0, [don.parents sumOfProperty:@\"age\"]);\n    XCTAssertNil([don.parents averageOfProperty:@\"age\"]);\n\n    XCTAssertEqualObjects(@[], [don.parents valueForKey:@\"age\"]);\n    XCTAssertEqualObjects(@0, [don.parents valueForKeyPath:@\"@count\"]);\n    XCTAssertNil([don.parents valueForKeyPath:@\"@min.age\"]);\n    XCTAssertNil([don.parents valueForKeyPath:@\"@max.age\"]);\n    XCTAssertEqualObjects(@0, [don.parents valueForKeyPath:@\"@sum.age\"]);\n    XCTAssertNil([don.parents valueForKeyPath:@\"@avg.age\"]);\n\n    PersonObject *mark = [[PersonObject alloc] initWithValue:@[ @\"Mark\", @30, @[] ]];\n    XCTAssertEqual(NSNotFound, [don.parents indexOfObject:mark]);\n    XCTAssertEqual(NSNotFound, [don.parents indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n\n    RLMAssertThrowsWithReason(([don.parents addNotificationBlock:^(RLMResults *, RLMCollectionChange *, NSError *) { }]),\n                              @\"Change notifications are only supported on managed collections.\");\n}\n\n- (void)testLinkingObjectsOnFrozenObject {\n    NSArray *(^asArray)(id) = ^(id arrayLike) {\n        return [arrayLike valueForKeyPath:@\"self\"];\n    };\n\n    RLMRealm *realm = [self realmWithTestPath];\n    [realm beginWriteTransaction];\n    PersonObject *hannah = [PersonObject createInRealm:realm withValue:@[@\"Hannah\", @0]];\n    PersonObject *mark   = [PersonObject createInRealm:realm withValue:@[@\"Mark\",  @30, @[hannah]]];\n    [realm commitWriteTransaction];\n\n    PersonObject *frozenHannah = hannah.freeze;\n    PersonObject *frozenMark = mark.freeze;\n    XCTAssertEqualObjects(asArray(frozenHannah.parents), (@[frozenMark]));\n\n    [realm beginWriteTransaction];\n    PersonObject *diane = [PersonObject createInRealm:realm withValue:@[@\"Diane\", @29, @[hannah]]];\n    [realm commitWriteTransaction];\n\n    PersonObject *frozenHannah2 = hannah.freeze;\n    PersonObject *frozenMark2 = mark.freeze;\n    PersonObject *frozenDiane = diane.freeze;\n    XCTAssertEqualObjects(asArray(frozenHannah.parents), (@[frozenMark]));\n    XCTAssertEqualObjects(asArray(frozenHannah2.parents), (@[frozenMark2, frozenDiane]));\n\n    [realm beginWriteTransaction];\n    [realm deleteObject:hannah];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqualObjects(asArray(frozenHannah.parents), (@[frozenMark]));\n    XCTAssertEqualObjects(asArray(frozenHannah2.parents), (@[frozenMark2, frozenDiane]));\n}\n\n- (void)testFilteredLinkingObjects {\n    NSArray *(^asArray)(id) = ^(id arrayLike) {\n        return [arrayLike valueForKeyPath:@\"self\"];\n    };\n\n    RLMRealm *realm = [self realmWithTestPath];\n    [realm beginWriteTransaction];\n\n    PersonObject *hannah = [PersonObject createInRealm:realm withValue:@[ @\"Hannah\", @0 ]];\n    PersonObject *mark   = [PersonObject createInRealm:realm withValue:@[ @\"Mark\",  @30, @[ hannah ]]];\n    PersonObject *diane  = [PersonObject createInRealm:realm withValue:@[ @\"Diane\", @29, @[ hannah ]]];\n\n    RLMLinkingObjects *hannahsParents = hannah.parents;\n\n    // Three separate queries so that accessing a property on one doesn't invalidate testing of other properties.\n    RLMResults *resultsA = [hannahsParents objectsWhere:@\"age > 25\"];\n    RLMResults *resultsB = [hannahsParents objectsWhere:@\"age > 25\"];\n    RLMResults *resultsC = [hannahsParents objectsWhere:@\"age > 25\"];\n\n    [mark.children removeAllObjects];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(resultsA.count, 1u);\n    XCTAssertEqual(NSNotFound, [resultsB indexOfObjectWhere:@\"name = 'Mark'\"]);\n    XCTAssertEqualObjects(asArray(resultsC), (@[ diane ]));\n}\n\n- (void)testNotificationSentInitially {\n    RLMRealm *realm = [self realmWithTestPath];\n    [realm beginWriteTransaction];\n\n    PersonObject *hannah = [PersonObject createInRealm:realm withValue:@[ @\"Hannah\", @0 ]];\n    PersonObject *mark   = [PersonObject createInRealm:realm withValue:@[ @\"Mark\",  @30, @[ hannah ]]];\n\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    RLMNotificationToken *token = [hannah.parents addNotificationBlock:^(RLMResults *linkingObjects, RLMCollectionChange *change, NSError *error) {\n        XCTAssertEqualObjects([linkingObjects valueForKeyPath:@\"self\"], (@[ mark ]));\n        XCTAssertNil(change);\n        XCTAssertNil(error);\n        [expectation fulfill];\n    }];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [token invalidate];\n}\n\n- (void)testNotificationSentAfterCommit {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    PersonObject *hannah = [PersonObject createInRealm:realm withValue:@[ @\"Hannah\", @0 ]];\n    [realm commitWriteTransaction];\n\n    __block bool first = true;\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    RLMNotificationToken *token = [hannah.parents addNotificationBlock:^(RLMResults *linkingObjects, RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(linkingObjects);\n        XCTAssert(first ? !change : !!change);\n        XCTAssertNil(error);\n        first = false;\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = self.realmWithTestPath;\n        [realm transactionWithBlock:^{\n            [PersonObject createInRealm:realm withValue:@[ @\"Mark\",  @30, [PersonObject objectsInRealm:realm where:@\"name == 'Hannah'\"] ]];\n        }];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [token invalidate];\n}\n\n- (void)testNotificationNotSentForUnrelatedChange {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    PersonObject *hannah = [PersonObject createInRealm:realm withValue:@[ @\"Hannah\", @0 ]];\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    RLMNotificationToken *token = [hannah.parents addNotificationBlock:^(RLMResults *, RLMCollectionChange *, NSError *) {\n        // will throw if it's incorrectly called a second time due to the\n        // unrelated write transaction\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmDidChangeNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            [self.realmWithTestPath transactionWithBlock:^{ }];\n        }];\n    }];\n    [token invalidate];\n}\n\n- (void)testNotificationSentOnlyForActualRefresh {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    PersonObject *hannah = [PersonObject createInRealm:realm withValue:@[ @\"Hannah\", @0 ]];\n    [realm commitWriteTransaction];\n\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    RLMNotificationToken *token = [hannah.parents addNotificationBlock:^(RLMResults *linkingObjects, RLMCollectionChange *, NSError *error) {\n        XCTAssertNotNil(linkingObjects);\n        XCTAssertNil(error);\n        // will throw if it's called a second time before we create the new\n        // expectation object immediately before manually refreshing\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // Turn off autorefresh, so the background commit should not result in a notification\n    realm.autorefresh = NO;\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmRefreshRequiredNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *realm = self.realmWithTestPath;\n            [realm transactionWithBlock:^{\n                [PersonObject createInRealm:realm withValue:@[ @\"Mark\",  @30, [PersonObject objectsInRealm:realm where:@\"name == 'Hannah'\"] ]];\n            }];\n        }];\n    }];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [realm refresh];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [token invalidate];\n}\n\n- (void)testDeletingObjectWithNotificationsRegistered {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    PersonObject *hannah = [PersonObject createInRealm:realm withValue:@[ @\"Hannah\", @0 ]];\n    PersonObject *mark   = [PersonObject createInRealm:realm withValue:@[ @\"Mark\",  @30, @[ hannah ]]];\n    [realm commitWriteTransaction];\n\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    RLMNotificationToken *token = [hannah.parents addNotificationBlock:^(RLMResults *linkingObjects, RLMCollectionChange *, NSError *error) {\n        XCTAssertNotNil(linkingObjects);\n        XCTAssertNil(error);\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [realm beginWriteTransaction];\n    [realm deleteObject:mark];\n    [realm commitWriteTransaction];\n\n    [token invalidate];\n}\n\n- (void)testRenamedProperties {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    auto obj1 = [RenamedProperties1 createInRealm:realm withValue:@[@1, @\"a\"]];\n    auto obj2 = [RenamedProperties2 createInRealm:realm withValue:@[@2, @\"b\"]];\n    auto link = [LinkToRenamedProperties1 createInRealm:realm withValue:@[obj1, obj2, @[obj1, obj1]]];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqualObjects(obj1.linking1.objectClassName, @\"LinkToRenamedProperties1\");\n    XCTAssertEqualObjects(obj1.linking2.objectClassName, @\"LinkToRenamedProperties2\");\n\n    XCTAssertTrue([obj1.linking1[0] isEqualToObject:link]);\n    XCTAssertTrue([obj2.linking2[0] isEqualToObject:link]);\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/MigrationTests.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#import \"RLMMigration.h\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMObjectStore.h\"\n#import \"RLMObject_Private.h\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMRealmConfiguration_Private.h\"\n#import \"RLMRealm_Dynamic.h\"\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMSchema_Private.h\"\n#import \"RLMUtil.hpp\"\n#import \"RLMRealmUtil.hpp\"\n\n#import <realm/object-store/object_store.hpp>\n#import <realm/object-store/shared_realm.hpp>\n#import <realm/table.hpp>\n#import <realm/version.hpp>\n\n#import <objc/runtime.h>\n\nusing namespace realm;\n\nstatic void RLMAssertRealmSchemaMatchesTable(id self, RLMRealm *realm) {\n    for (RLMObjectSchema *objectSchema in realm.schema.objectSchema) {\n        auto& info = realm->_info[objectSchema.className];\n        TableRef table = ObjectStore::table_for_object_type(realm.group, objectSchema.objectStoreName);\n        for (RLMProperty *property in objectSchema.properties) {\n            auto column = info.tableColumn(property);\n            XCTAssertEqual(column, table->get_column_key(RLMStringDataWithNSString(property.columnName)));\n            if (property.isPrimary)\n                XCTAssertTrue(property.indexed);\n            XCTAssertEqual(property.indexed, table->has_search_index(column));\n        }\n    }\n    static_cast<void>(self);\n}\n\n@interface MigrationTestObject : RLMObject\n@property int intCol;\n@property NSString *stringCol;\n@end\nRLM_COLLECTION_TYPE(MigrationTestObject);\n\n@implementation MigrationTestObject\n@end\n\n@interface MigrationPrimaryKeyObject : RLMObject\n@property int intCol;\n@end\n\n@implementation MigrationPrimaryKeyObject\n+ (NSString *)primaryKey {\n    return @\"intCol\";\n}\n@end\n\n@interface MigrationStringPrimaryKeyObject : RLMObject\n@property NSString * stringCol;\n@end\n\n@implementation MigrationStringPrimaryKeyObject\n+ (NSString *)primaryKey {\n    return @\"stringCol\";\n}\n@end\n\n@interface ThreeFieldMigrationTestObject : RLMObject\n@property int col1;\n@property int col2;\n@property int col3;\n@end\n\n@implementation ThreeFieldMigrationTestObject\n@end\n\n@interface MigrationTwoStringObject : RLMObject\n@property NSString *col1;\n@property NSString *col2;\n@end\n\n@implementation MigrationTwoStringObject\n@end\n\n@interface MigrationLinkObject : RLMObject\n@property MigrationTestObject *object;\n@property RLMArray<MigrationTestObject> *array;\n@property RLMSet<MigrationTestObject> *set;\n@property RLMDictionary<NSString *, MigrationTestObject *><RLMString, MigrationTestObject> *dictionary;\n@end\n\n@implementation MigrationLinkObject\n@end\n\n@interface MigrationTests : RLMTestCase\n@end\n\n@interface DateMigrationObject : RLMObject\n@property (nonatomic, strong) NSDate *nonNullNonIndexed;\n@property (nonatomic, strong) NSDate *nullNonIndexed;\n@property (nonatomic, strong) NSDate *nonNullIndexed;\n@property (nonatomic, strong) NSDate *nullIndexed;\n@property (nonatomic) int cookie;\n@end\n\n#define RLM_OLD_DATE_FORMAT (REALM_VER_MAJOR < 1 && REALM_VER_MINOR < 100)\n\n@implementation DateMigrationObject\n+ (NSArray *)requiredProperties {\n    return @[@\"nonNullNonIndexed\", @\"nonNullIndexed\"];\n}\n\n+ (NSArray *)indexedProperties {\n    return @[@\"nonNullIndexed\", @\"nullIndexed\"];\n}\n@end\n\n@implementation MigrationTests\n\n#pragma mark - Helper methods\n\n- (RLMSchema *)schemaWithObjects:(NSArray *)objects {\n    RLMSchema *schema = [[RLMSchema alloc] init];\n    schema.objectSchema = objects;\n    return schema;\n}\n\n- (RLMRealm *)realmWithSingleObject:(RLMObjectSchema *)objectSchema {\n    return [self realmWithTestPathAndSchema:[self schemaWithObjects:@[objectSchema]]];\n}\n\n- (RLMRealmConfiguration *)config {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration new];\n    config.fileURL = RLMTestRealmURL();\n    config.encryptionKey = RLMRealmConfiguration.rawDefaultConfiguration.encryptionKey;\n    return config;\n}\n\n- (void)createTestRealmWithClasses:(NSArray *)classes block:(void (^)(RLMRealm *realm))block {\n    NSMutableArray *objectSchema = [NSMutableArray arrayWithCapacity:classes.count];\n    for (::Class cls in classes) {\n        [objectSchema addObject:[RLMObjectSchema schemaForObjectClass:cls]];\n    }\n    [self createTestRealmWithSchema:objectSchema block:block];\n}\n\n- (void)createTestRealmWithSchema:(NSArray *)objectSchema block:(void (^)(RLMRealm *realm))block {\n    @autoreleasepool {\n        RLMRealmConfiguration *config = self.config;\n        config.customSchema = [self schemaWithObjects:objectSchema];\n\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n        [realm beginWriteTransaction];\n        block(realm);\n        [realm commitWriteTransaction];\n    }\n}\n\n- (RLMRealm *)migrateTestRealmWithBlock:(RLMMigrationBlock)block NS_RETURNS_RETAINED {\n    @autoreleasepool {\n        RLMRealmConfiguration *config = self.config;\n        config.schemaVersion = 1;\n        config.migrationBlock = block;\n        XCTAssertTrue([RLMRealm performMigrationForConfiguration:config error:nil]);\n\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n        RLMAssertRealmSchemaMatchesTable(self, realm);\n        return realm;\n    }\n}\n\n- (void)failToMigrateTestRealmWithBlock:(RLMMigrationBlock)block {\n    @autoreleasepool {\n        RLMRealmConfiguration *config = self.config;\n        config.schemaVersion = 1;\n        config.migrationBlock = block;\n        XCTAssertFalse([RLMRealm performMigrationForConfiguration:config error:nil]);\n    }\n}\n\n- (void)assertMigrationRequiredForChangeFrom:(NSArray *)from to:(NSArray *)to {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration new];\n    config.customSchema = [self schemaWithObjects:from];\n    @autoreleasepool { [RLMRealm realmWithConfiguration:config error:nil]; }\n\n    config.customSchema = [self schemaWithObjects:to];\n    config.migrationBlock = ^(__unused RLMMigration *migration, __unused uint64_t oldSchemaVersion) {\n        XCTFail(@\"Migration block should not have been called\");\n    };\n\n    RLMAssertThrowsWithCodeMatching([RLMRealm realmWithConfiguration:config error:nil], RLMErrorSchemaMismatch);\n\n    __block bool migrationCalled = false;\n    config.schemaVersion = 1;\n    config.migrationBlock = ^(__unused RLMMigration *migration, __unused uint64_t oldSchemaVersion) {\n        migrationCalled = true;\n    };\n\n    XCTAssertNoThrow([RLMRealm realmWithConfiguration:config error:nil]);\n    XCTAssertTrue(migrationCalled);\n    RLMAssertRealmSchemaMatchesTable(self, [RLMRealm realmWithConfiguration:config error:nil]);\n}\n\n- (void)assertNoMigrationRequiredForChangeFrom:(NSArray *)from to:(NSArray *)to {\n    RLMRealmConfiguration *config = self.config;\n    config.customSchema = [self schemaWithObjects:from];\n    @autoreleasepool { [RLMRealm realmWithConfiguration:config error:nil]; }\n\n    config.customSchema = [self schemaWithObjects:to];\n    config.migrationBlock = ^(__unused RLMMigration *migration, __unused uint64_t oldSchemaVersion) {\n        XCTFail(@\"Migration block should not have been called\");\n    };\n\n    XCTAssertNoThrow([RLMRealm realmWithConfiguration:config error:nil]);\n    RLMAssertRealmSchemaMatchesTable(self, [RLMRealm realmWithConfiguration:config error:nil]);\n}\n\n- (RLMRealmConfiguration *)renameConfigurationWithObjectSchemas:(NSArray *)objectSchemas migrationBlock:(RLMMigrationBlock)block {\n    RLMRealmConfiguration *configuration = self.config;\n    configuration.schemaVersion = 1;\n    configuration.customSchema = [self schemaWithObjects:objectSchemas];\n    configuration.migrationBlock = block;\n    return configuration;\n}\n\n- (RLMRealmConfiguration *)renameConfigurationWithObjectSchemas:(NSArray *)objectSchemas className:(NSString *)className\n                                                        oldName:(NSString *)oldName newName:(NSString *)newName {\n    return [self renameConfigurationWithObjectSchemas:objectSchemas migrationBlock:^(RLMMigration *migration, uint64_t) {\n        [migration renamePropertyForClass:className oldName:oldName newName:newName];\n        [migration enumerateObjects:AllTypesObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertNotNil(oldObject[oldName]);\n            RLMAssertThrowsWithReasonMatching(newObject[newName], @\"Invalid property name\");\n            XCTAssertEqualObjects(oldObject[oldName], newObject[newName]);\n            XCTAssertEqualObjects([oldObject.description stringByReplacingOccurrencesOfString:@\"before_\" withString:@\"\"], newObject.description);\n        }];\n    }];\n}\n\n- (void)assertPropertyRenameError:(NSString *)errorMessage objectSchemas:(NSArray *)objectSchemas\n                        className:(NSString *)className oldName:(NSString *)oldName newName:(NSString *)newName {\n    RLMRealmConfiguration *config = [self renameConfigurationWithObjectSchemas:objectSchemas className:className\n                                                                       oldName:oldName newName:newName];\n    NSError *error;\n    [RLMRealm performMigrationForConfiguration:config error:&error];\n    XCTAssertTrue([error.localizedDescription rangeOfString:errorMessage].location != NSNotFound,\n                  @\"\\\"%@\\\" should contain \\\"%@\\\"\", error.localizedDescription, errorMessage);\n}\n\n- (void)assertPropertyRenameError:(NSString *)errorMessage\n             firstSchemaTransform:(void (^)(RLMObjectSchema *, RLMProperty *, RLMProperty *))transform1\n            secondSchemaTransform:(void (^)(RLMObjectSchema *, RLMProperty *, RLMProperty *))transform2 {\n    RLMObjectSchema *schema = [RLMObjectSchema schemaForObjectClass:StringObject.class];\n    RLMProperty *afterProperty = schema.properties.firstObject;\n    RLMProperty *beforeProperty = [afterProperty copyWithNewName:@\"before_stringCol\"];\n    schema.properties = @[beforeProperty];\n    if (transform1) {\n        transform1(schema, beforeProperty, afterProperty);\n    }\n\n    [self createTestRealmWithSchema:@[schema] block:^(RLMRealm *realm) {\n        if (errorMessage == nil) {\n            [StringObject createInRealm:realm withValue:@[@\"0\"]];\n        }\n    }];\n\n    schema.properties = @[afterProperty];\n    if (transform2) {\n        transform2(schema, beforeProperty, afterProperty);\n    }\n\n    auto config = [self renameConfigurationWithObjectSchemas:@[schema]\n                                                   className:StringObject.className\n                                                     oldName:beforeProperty.name\n                                                     newName:afterProperty.name];\n\n    if (errorMessage) {\n        NSError *error;\n        [RLMRealm performMigrationForConfiguration:config error:&error];\n        XCTAssertEqualObjects([error localizedDescription], errorMessage);\n    } else {\n        XCTAssertTrue([RLMRealm performMigrationForConfiguration:config error:nil]);\n        XCTAssertEqualObjects(@\"0\", [[[StringObject allObjectsInRealm:[RLMRealm realmWithConfiguration:config error:nil]] firstObject] stringCol]);\n    }\n}\n\n#pragma mark - Schema versions\n\n- (void)testGetSchemaVersion {\n    XCTAssertEqual(RLMNotVersioned, [RLMRealm schemaVersionAtURL:RLMDefaultRealmURL() encryptionKey:nil error:nil]);\n    NSError *error;\n    XCTAssertEqual(RLMNotVersioned, [RLMRealm schemaVersionAtURL:RLMDefaultRealmURL() encryptionKey:nil error:&error]);\n    RLMValidateRealmError(error, RLMErrorInvalidDatabase,\n                          @\"Realm at path '%@' has not been initialized.\", RLMDefaultRealmURL().path);\n\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.encryptionKey = nil;\n    @autoreleasepool { [RLMRealm realmWithConfiguration:config error:nil]; }\n    XCTAssertEqual(0U, [RLMRealm schemaVersionAtURL:config.fileURL encryptionKey:nil error:nil]);\n\n    config.schemaVersion = 1;\n    config.migrationBlock = ^(__unused RLMMigration *migration, uint64_t oldSchemaVersion) {\n        XCTAssertEqual(0U, oldSchemaVersion);\n    };\n\n    @autoreleasepool { [RLMRealm realmWithConfiguration:config error:nil]; }\n    XCTAssertEqual(1U, [RLMRealm schemaVersionAtURL:config.fileURL encryptionKey:nil error:nil]);\n}\n\n- (void)testSchemaVersionCannotGoDown {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.schemaVersion = 10;\n    @autoreleasepool { [RLMRealm realmWithConfiguration:config error:nil]; }\n    XCTAssertEqual(10U, [RLMRealm schemaVersionAtURL:config.fileURL encryptionKey:config.encryptionKey error:nil]);\n\n    config.schemaVersion = 5;\n    RLMAssertThrowsWithReasonMatching([RLMRealm realmWithConfiguration:config error:nil],\n                                      @\"Provided schema version 5 is less than last set version 10.\");\n}\n\n- (void)testDifferentSchemaVersionsAtDifferentPaths {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.schemaVersion = 10;\n    @autoreleasepool { [RLMRealm realmWithConfiguration:config error:nil]; }\n    XCTAssertEqual(10U, [RLMRealm schemaVersionAtURL:config.fileURL encryptionKey:config.encryptionKey error:nil]);\n\n    RLMRealmConfiguration *config2 = [RLMRealmConfiguration defaultConfiguration];\n    config2.schemaVersion = 5;\n    config2.fileURL = RLMTestRealmURL();\n    @autoreleasepool { [RLMRealm realmWithConfiguration:config2 error:nil]; }\n    XCTAssertEqual(5U, [RLMRealm schemaVersionAtURL:config2.fileURL encryptionKey:config.encryptionKey error:nil]);\n\n    // Should not have been changed\n    XCTAssertEqual(10U, [RLMRealm schemaVersionAtURL:config.fileURL encryptionKey:config.encryptionKey error:nil]);\n}\n\n#pragma mark - Migration Requirements\n\n- (void)testAddingClassDoesNotRequireMigration {\n    RLMRealmConfiguration *config = self.config;\n    config.objectClasses = @[MigrationTestObject.class];\n    @autoreleasepool { [RLMRealm realmWithConfiguration:config error:nil]; }\n\n    config.objectClasses = @[MigrationTestObject.class, ThreeFieldMigrationTestObject.class];\n    XCTAssertNoThrow([RLMRealm realmWithConfiguration:config error:nil]);\n}\n\n- (void)testRemovingClassDoesNotRequireMigration {\n    RLMRealmConfiguration *config = self.config;\n    config.objectClasses = @[MigrationTestObject.class, ThreeFieldMigrationTestObject.class];\n    @autoreleasepool { [RLMRealm realmWithConfiguration:config error:nil]; }\n\n    config.objectClasses = @[MigrationTestObject.class];\n    XCTAssertNoThrow([RLMRealm realmWithConfiguration:config error:nil]);\n}\n\n- (void)testAddingColumnRequiresMigration {\n    RLMObjectSchema *from = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n    from.properties = [from.properties subarrayWithRange:{0, 1}];\n\n    RLMObjectSchema *to = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n\n    [self assertMigrationRequiredForChangeFrom:@[from] to:@[to]];\n}\n\n- (void)testRemovingColumnRequiresMigration {\n    RLMObjectSchema *from = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n\n    RLMObjectSchema *to = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n    to.properties = [to.properties subarrayWithRange:{0, 1}];\n\n    [self assertMigrationRequiredForChangeFrom:@[from] to:@[to]];\n}\n\n- (void)testChangingColumnOrderDoesNotRequireMigration {\n    RLMObjectSchema *from = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n\n    RLMObjectSchema *to = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n    to.properties = @[to.properties[1], to.properties[0]];\n\n    [self assertNoMigrationRequiredForChangeFrom:@[from] to:@[to]];\n}\n\n- (void)testAddingIndexDoesNotRequireMigration {\n    RLMObjectSchema *from = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n\n    RLMObjectSchema *to = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n    [to.properties[0] setIndexed:YES];\n\n    [self assertNoMigrationRequiredForChangeFrom:@[from] to:@[to]];\n}\n\n- (void)testRemovingIndexDoesNotRequireMigration {\n    RLMObjectSchema *from = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n    [from.properties[0] setIndexed:YES];\n\n    RLMObjectSchema *to = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n\n    [self assertNoMigrationRequiredForChangeFrom:@[from] to:@[to]];\n}\n\n- (void)testAddingPrimaryKeyRequiresMigration {\n    RLMObjectSchema *from = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n\n    RLMObjectSchema *to = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n    to.primaryKeyProperty = to.properties[0];\n\n    [self assertMigrationRequiredForChangeFrom:@[from] to:@[to]];\n}\n\n- (void)testRemovingPrimaryKeyRequiresMigration {\n    RLMObjectSchema *from = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n    from.primaryKeyProperty = from.properties[0];\n\n    RLMObjectSchema *to = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n\n    [self assertMigrationRequiredForChangeFrom:@[from] to:@[to]];\n}\n\n- (void)testChangingPrimaryKeyRequiresMigration {\n    RLMObjectSchema *from = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n    from.primaryKeyProperty = from.properties[0];\n\n    RLMObjectSchema *to = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n    to.primaryKeyProperty = to.properties[1];\n\n    [self assertMigrationRequiredForChangeFrom:@[from] to:@[to]];\n}\n\n- (void)testMakingPropertyOptionalRequiresMigration {\n    RLMObjectSchema *from = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n    [from.properties[0] setOptional:NO];\n\n    RLMObjectSchema *to = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n\n    [self assertMigrationRequiredForChangeFrom:@[from] to:@[to]];\n}\n\n- (void)testMakingPropertyNonOptionalRequiresMigration {\n    RLMObjectSchema *from = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n\n    RLMObjectSchema *to = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n    [to.properties[0] setOptional:NO];\n\n    [self assertMigrationRequiredForChangeFrom:@[from] to:@[to]];\n}\n\n- (void)testChangingLinkTargetRequiresMigration {\n    NSArray *linkTargets = @[[RLMObjectSchema schemaForObjectClass:MigrationTestObject.class],\n                             [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class]];\n    RLMObjectSchema *from = [RLMObjectSchema schemaForObjectClass:MigrationLinkObject.class];\n\n    RLMObjectSchema *to = [RLMObjectSchema schemaForObjectClass:MigrationLinkObject.class];\n    [to.properties[0] setObjectClassName:@\"MigrationTwoStringObject\"];\n\n    [self assertMigrationRequiredForChangeFrom:[linkTargets arrayByAddingObject:from]\n                                            to:[linkTargets arrayByAddingObject:to]];\n}\n\n- (void)testChangingLinkListTargetRequiresMigration {\n    NSArray *linkTargets = @[[RLMObjectSchema schemaForObjectClass:MigrationTestObject.class],\n                             [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class]];\n    RLMObjectSchema *from = [RLMObjectSchema schemaForObjectClass:MigrationLinkObject.class];\n\n    RLMObjectSchema *to = [RLMObjectSchema schemaForObjectClass:MigrationLinkObject.class];\n    [to.properties[1] setObjectClassName:@\"MigrationTwoStringObject\"];\n\n    [self assertMigrationRequiredForChangeFrom:[linkTargets arrayByAddingObject:from]\n                                            to:[linkTargets arrayByAddingObject:to]];\n}\n\n- (void)testChangingPropertyTypesRequiresMigration {\n    RLMObjectSchema *from = [RLMObjectSchema schemaForObjectClass:MigrationTestObject.class];\n\n    RLMObjectSchema *to = [RLMObjectSchema schemaForObjectClass:MigrationTestObject.class];\n    to.objectClass = RLMObject.class;\n    RLMProperty *prop = to.properties[0];\n    RLMProperty *strProp = to.properties[1];\n    prop.type = strProp.type;\n\n    [self assertMigrationRequiredForChangeFrom:@[from] to:@[to]];\n}\n\n- (void)testDeleteRealmIfMigrationNeededWithSetCustomSchema {\n    RLMObjectSchema *from = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n    from.properties = [from.properties subarrayWithRange:{0, 1}];\n\n    RLMObjectSchema *to = [RLMObjectSchema schemaForObjectClass:MigrationTwoStringObject.class];\n\n    RLMRealmConfiguration *config = self.config;\n    config.customSchema = [self schemaWithObjects:@[from]];\n    @autoreleasepool { [RLMRealm realmWithConfiguration:config error:nil]; }\n\n    config.customSchema = [self schemaWithObjects:@[to]];\n    config.migrationBlock = ^(__unused RLMMigration *migration, __unused uint64_t oldSchemaVersion) {\n        XCTFail(@\"Migration block should not have been called\");\n    };\n\n    config.deleteRealmIfMigrationNeeded = YES;\n\n    XCTAssertNoThrow([RLMRealm realmWithConfiguration:config error:nil]);\n    RLMAssertRealmSchemaMatchesTable(self, [RLMRealm realmWithConfiguration:config error:nil]);\n}\n\n- (void)testDeleteRealmIfMigrationNeeded {\n    for (uint64_t targetSchemaVersion = 1; targetSchemaVersion < 2; targetSchemaVersion++) {\n        RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n        RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:MigrationTestObject.class];\n        configuration.customSchema = [self schemaWithObjects:@[objectSchema]];\n\n        @autoreleasepool {\n            [[NSFileManager defaultManager] removeItemAtURL:configuration.fileURL error:nil];\n            RLMRealm *realm = [RLMRealm realmWithConfiguration:configuration error:nil];\n            [realm transactionWithBlock:^{\n                [realm addObject:[MigrationTestObject new]];\n            }];\n        }\n\n        // Change string to int, requiring a migration\n        objectSchema.objectClass = RLMObject.class;\n        RLMProperty *stringCol = objectSchema.properties[1];\n        stringCol.type = RLMPropertyTypeInt;\n        stringCol.optional = NO;\n        objectSchema.properties = @[stringCol];\n\n        configuration.customSchema = [self schemaWithObjects:@[objectSchema]];\n\n        @autoreleasepool {\n            XCTAssertThrows([RLMRealm realmWithConfiguration:configuration error:nil]);\n            RLMRealmConfiguration *dynamicConfiguration = [RLMRealmConfiguration defaultConfiguration];\n            dynamicConfiguration.dynamic = YES;\n            XCTAssertFalse([[RLMRealm realmWithConfiguration:dynamicConfiguration error:nil] isEmpty]);\n        }\n\n        configuration.schemaVersion = targetSchemaVersion;\n        configuration.migrationBlock = ^(__unused RLMMigration *migration, __unused uint64_t oldSchemaVersion) {\n            XCTFail(@\"Migration block should not have been called\");\n        };\n        configuration.deleteRealmIfMigrationNeeded = YES;\n\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:configuration error:nil];\n        RLMAssertRealmSchemaMatchesTable(self, realm);\n        XCTAssertTrue(realm.isEmpty);\n    }\n}\n\n#pragma mark - Allowed schema mismatches\n\n- (void)testMismatchedIndexAllowedForReadOnly {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:StringObject.class];\n    [objectSchema.properties[0] setIndexed:YES];\n\n    [self createTestRealmWithSchema:@[objectSchema] block:^(RLMRealm *) { }];\n\n    // should be able to open readonly with mismatched index schema\n    RLMRealmConfiguration *config = [self config];\n    config.readOnly = true;\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n    auto& info = realm->_info[@\"StringObject\"];\n    XCTAssertTrue(info.table()->has_search_index(info.tableColumn(objectSchema.properties[0].name)));\n}\n\n- (void)testRearrangeProperties {\n    // create object in default realm\n    [RLMRealm.defaultRealm transactionWithBlock:^{\n        [CircleObject createInDefaultRealmWithValue:@[@\"data\", NSNull.null]];\n    }];\n\n    // create realm with the properties reversed\n    RLMSchema *schema = [[RLMSchema sharedSchema] copy];\n    RLMObjectSchema *objectSchema = schema[@\"CircleObject\"];\n    objectSchema.properties = @[objectSchema.properties[1], objectSchema.properties[0]];\n\n    RLMRealm *realm = [self realmWithTestPathAndSchema:schema];\n    [realm beginWriteTransaction];\n\n    // -createObject:withValue: takes values in the order the properties appear in the array\n    [realm createObject:CircleObject.className withValue:@[NSNull.null, @\"data\"]];\n    RLMAssertThrowsWithReasonMatching(([realm createObject:CircleObject.className withValue:@[@\"data\", NSNull.null]]),\n                                      @\"Invalid value 'data' to initialize object of type 'CircleObject'\");\n    [realm commitWriteTransaction];\n\n    // accessors should work\n    CircleObject *obj = [[CircleObject allObjectsInRealm:realm] firstObject];\n    XCTAssertEqualObjects(@\"data\", obj.data);\n    XCTAssertNil(obj.next);\n    [realm beginWriteTransaction];\n    XCTAssertNoThrow(obj.data = @\"new data\");\n    XCTAssertNoThrow(obj.next = obj);\n    [realm commitWriteTransaction];\n\n    // open the default Realm and make sure accessors with alternate ordering work\n    CircleObject *defaultObj = [[CircleObject allObjects] firstObject];\n    XCTAssertEqualObjects(defaultObj.data, @\"data\");\n\n    RLMAssertRealmSchemaMatchesTable(self, realm);\n\n    // re-check that things still work for the realm with the swapped order\n    XCTAssertEqualObjects(obj.data, @\"new data\");\n\n    [realm beginWriteTransaction];\n    [realm createObject:CircleObject.className withValue:@[NSNull.null, @\"data\"]];\n    RLMAssertThrowsWithReasonMatching(([realm createObject:CircleObject.className withValue:@[@\"data\", NSNull.null]]),\n                                      @\"Invalid value 'data' to initialize object of type 'CircleObject'\");\n    [realm commitWriteTransaction];\n}\n\n#pragma mark - Migration block invocatios\n\n- (void)testMigrationBlockNotCalledForIntialRealmCreation {\n    RLMRealmConfiguration *config = self.config;\n    config.migrationBlock = ^(__unused RLMMigration *migration, __unused uint64_t oldSchemaVersion) {\n        XCTFail(@\"Migration block should not have been called\");\n    };\n    XCTAssertNoThrow([RLMRealm realmWithConfiguration:config error:nil]);\n}\n\n- (void)testMigrationBlockNotCalledWhenSchemaVersionIsUnchanged {\n    RLMRealmConfiguration *config = self.config;\n    config.schemaVersion = 1;\n    @autoreleasepool { XCTAssertNoThrow([RLMRealm realmWithConfiguration:config error:nil]); }\n\n    config.migrationBlock = ^(__unused RLMMigration *migration, __unused uint64_t oldSchemaVersion) {\n        XCTFail(@\"Migration block should not have been called\");\n    };\n    @autoreleasepool { XCTAssertNoThrow([RLMRealm realmWithConfiguration:config error:nil]); }\n    @autoreleasepool { XCTAssertTrue([RLMRealm performMigrationForConfiguration:config error:nil]); }\n}\n\n- (void)testMigrationBlockCalledWhenSchemaVersionHasChanged {\n    RLMRealmConfiguration *config = self.config;\n    config.schemaVersion = 1;\n    @autoreleasepool { XCTAssertNoThrow([RLMRealm realmWithConfiguration:config error:nil]); }\n\n    __block bool migrationCalled = false;\n    config.schemaVersion = 2;\n    config.migrationBlock = ^(__unused RLMMigration *migration, __unused uint64_t oldSchemaVersion) {\n        migrationCalled = true;\n    };\n    @autoreleasepool { XCTAssertNoThrow([RLMRealm realmWithConfiguration:config error:nil]); }\n    XCTAssertTrue(migrationCalled);\n\n    migrationCalled = false;\n    config.schemaVersion = 3;\n    @autoreleasepool { XCTAssertTrue([RLMRealm performMigrationForConfiguration:config error:nil]); }\n    XCTAssertTrue(migrationCalled);\n}\n\n#pragma mark - Async Migration\n\n- (void)testAsyncMigration {\n    RLMRealmConfiguration *c = self.config;\n    c.schemaVersion = 1;\n    @autoreleasepool { XCTAssertNoThrow([RLMRealm realmWithConfiguration:c error:nil]); }\n    XCTAssertNil(RLMGetAnyCachedRealmForPath(c.pathOnDisk.UTF8String));\n    XCTestExpectation *ex = [self expectationWithDescription:@\"async-migration\"];\n    __block bool migrationCalled = false;\n    c.schemaVersion = 2;\n    c.migrationBlock = ^(__unused RLMMigration *migration, __unused uint64_t oldSchemaVersion) {\n        migrationCalled = true;\n    };\n    [RLMRealm asyncOpenWithConfiguration:c\n                           callbackQueue:dispatch_get_main_queue()\n                                 callback:^(RLMRealm *realm, NSError *error) {\n        XCTAssertTrue(migrationCalled);\n        XCTAssertNil(error);\n        XCTAssertNotNil(realm);\n        [ex fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:1 handler:nil];\n    XCTAssertTrue(migrationCalled);\n    XCTAssertNil(RLMGetAnyCachedRealmForPath(c.pathOnDisk.UTF8String));\n}\n\n#pragma mark - Migration Correctness\n\n- (void)testRemovingSubclass {\n    RLMProperty *prop = [[RLMProperty alloc] initWithName:@\"id\"\n                                                     type:RLMPropertyTypeInt\n                                          objectClassName:nil\n                                   linkOriginPropertyName:nil\n                                                  indexed:NO\n                                                 optional:NO];\n    RLMObjectSchema *objectSchema = [[RLMObjectSchema alloc] initWithClassName:@\"DeletedClass\" objectClass:RLMObject.class properties:@[prop]];\n    [self createTestRealmWithSchema:@[objectSchema] block:^(RLMRealm *realm) {\n        [realm createObject:@\"DeletedClass\" withValue:@[@0]];\n    }];\n\n    // apply migration\n    RLMRealm *realm = [self migrateTestRealmWithBlock:^(RLMMigration *migration, uint64_t oldSchemaVersion) {\n        XCTAssertEqual(oldSchemaVersion, 0U, @\"Initial schema version should be 0\");\n\n        XCTAssertTrue([migration deleteDataForClassName:@\"DeletedClass\"]);\n        XCTAssertFalse([migration deleteDataForClassName:@\"NoSuchClass\"]);\n        XCTAssertFalse([migration deleteDataForClassName:self.nonLiteralNil]);\n\n        [migration createObject:StringObject.className withValue:@[@\"migration\"]];\n        XCTAssertTrue([migration deleteDataForClassName:StringObject.className]);\n    }];\n\n    XCTAssertFalse(ObjectStore::table_for_object_type(realm.group, \"DeletedClass\"), @\"The deleted class should not have a table.\");\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm].count);\n}\n\n- (void)testAddingPropertyAtEnd {\n    // create schema to migrate from with single string column\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:MigrationTestObject.class];\n    objectSchema.properties = @[objectSchema.properties[0]];\n    [self createTestRealmWithSchema:@[objectSchema] block:^(RLMRealm *realm) {\n        [realm createObject:MigrationTestObject.className withValue:@[@1]];\n        [realm createObject:MigrationTestObject.className withValue:@[@2]];\n    }];\n\n    // apply migration\n    RLMRealm *realm = [self migrateTestRealmWithBlock:^(RLMMigration *migration, uint64_t oldSchemaVersion) {\n        XCTAssertEqual(oldSchemaVersion, 0U, @\"Initial schema version should be 0\");\n        [migration enumerateObjects:MigrationTestObject.className\n                              block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertThrows(oldObject[@\"stringCol\"], @\"stringCol should not exist on old object\");\n            NSNumber *intObj;\n            XCTAssertNoThrow(intObj = oldObject[@\"intCol\"], @\"Should be able to access intCol on oldObject\");\n            XCTAssertEqualObjects(newObject[@\"intCol\"], oldObject[@\"intCol\"]);\n            NSString *stringObj = [NSString stringWithFormat:@\"%@\", intObj];\n            XCTAssertNoThrow(newObject[@\"stringCol\"] = stringObj, @\"Should be able to set stringCol\");\n        }];\n    }];\n\n    // verify migration\n    MigrationTestObject *mig1 = [MigrationTestObject allObjectsInRealm:realm][1];\n    XCTAssertEqual(mig1.intCol, 2, @\"Int column should have value 2\");\n    XCTAssertEqualObjects(mig1.stringCol, @\"2\", @\"String column should be populated\");\n}\n\n- (void)testAddingPropertyAtBeginningPreservesData {\n    // create schema to migrate from with the second and third columns from the final data\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:ThreeFieldMigrationTestObject.class];\n    objectSchema.properties = @[objectSchema.properties[1], objectSchema.properties[2]];\n\n    [self createTestRealmWithSchema:@[objectSchema] block:^(RLMRealm *realm) {\n        [realm createObject:ThreeFieldMigrationTestObject.className withValue:@[@1, @2]];\n    }];\n\n    RLMRealm *realm = [self migrateTestRealmWithBlock:^(RLMMigration *migration, uint64_t) {\n        [migration enumerateObjects:ThreeFieldMigrationTestObject.className\n                              block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertThrows(oldObject[@\"col1\"]);\n            XCTAssertEqualObjects(oldObject[@\"col2\"], newObject[@\"col2\"]);\n            XCTAssertEqualObjects(oldObject[@\"col3\"], newObject[@\"col3\"]);\n        }];\n    }];\n\n    // verify migration\n    ThreeFieldMigrationTestObject *mig = [ThreeFieldMigrationTestObject allObjectsInRealm:realm][0];\n    XCTAssertEqual(0, mig.col1);\n    XCTAssertEqual(1, mig.col2);\n    XCTAssertEqual(2, mig.col3);\n}\n\n- (void)testRemoveProperty {\n    // create schema with an extra column\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:MigrationTestObject.class];\n    RLMProperty *thirdProperty = [[RLMProperty alloc] initWithName:@\"deletedCol\" type:RLMPropertyTypeBool objectClassName:nil linkOriginPropertyName:nil indexed:NO optional:NO];\n    objectSchema.properties = [objectSchema.properties arrayByAddingObject:thirdProperty];\n\n    // create realm with old schema and populate\n    [self createTestRealmWithSchema:@[objectSchema] block:^(RLMRealm *realm) {\n        [realm createObject:MigrationTestObject.className withValue:@[@1, @\"1\", @YES]];\n        [realm createObject:MigrationTestObject.className withValue:@[@2, @\"2\", @NO]];\n    }];\n\n    // apply migration\n    RLMRealm *realm = [self migrateTestRealmWithBlock:^(RLMMigration *migration, uint64_t oldSchemaVersion) {\n        XCTAssertEqual(oldSchemaVersion, 0U, @\"Initial schema version should be 0\");\n        [migration enumerateObjects:MigrationTestObject.className\n                                       block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertNoThrow(oldObject[@\"deletedCol\"], @\"Deleted column should be accessible on old object.\");\n            XCTAssertThrows(newObject[@\"deletedCol\"], @\"Deleted column should not be accessible on new object.\");\n\n            XCTAssertEqualObjects(newObject[@\"intCol\"], oldObject[@\"intCol\"]);\n            XCTAssertEqualObjects(newObject[@\"stringCol\"], oldObject[@\"stringCol\"]);\n        }];\n    }];\n\n    // verify migration\n    MigrationTestObject *mig1 = [MigrationTestObject allObjectsInRealm:realm][1];\n    XCTAssertThrows(mig1[@\"deletedCol\"], @\"Deleted column should no longer be accessible.\");\n}\n\n- (void)testRemoveAndAddProperty {\n    // create schema to migrate from with single string column\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:MigrationTestObject.class];\n    RLMProperty *oldInt = [[RLMProperty alloc] initWithName:@\"oldIntCol\" type:RLMPropertyTypeInt objectClassName:nil linkOriginPropertyName:nil indexed:NO optional:NO];\n    objectSchema.properties = @[oldInt, objectSchema.properties[1]];\n\n    // create realm with old schema and populate\n    [self createTestRealmWithSchema:@[objectSchema] block:^(RLMRealm *realm) {\n        [realm createObject:MigrationTestObject.className withValue:@[@1, @\"1\"]];\n        [realm createObject:MigrationTestObject.className withValue:@[@1, @\"2\"]];\n    }];\n\n    // object migration object\n    void (^migrateObjectBlock)(RLMObject *, RLMObject *) = ^(RLMObject *oldObject, RLMObject *newObject) {\n        XCTAssertNoThrow(oldObject[@\"oldIntCol\"], @\"Deleted column should be accessible on old object.\");\n        XCTAssertThrows(oldObject[@\"intCol\"], @\"New column should not be accessible on old object.\");\n        XCTAssertEqual([oldObject[@\"oldIntCol\"] intValue], 1, @\"Deleted column value is correct.\");\n        XCTAssertNoThrow(newObject[@\"intCol\"], @\"New column is accessible on new object.\");\n        XCTAssertThrows(newObject[@\"oldIntCol\"], @\"Old column should not be accessible on old object.\");\n        XCTAssertEqual([newObject[@\"intCol\"] intValue], 0, @\"New column value is uninitialized.\");\n    };\n\n    // apply migration\n    RLMRealm *realm = [self migrateTestRealmWithBlock:^(RLMMigration *migration, uint64_t oldSchemaVersion) {\n        XCTAssertEqual(oldSchemaVersion, 0U, @\"Initial schema version should be 0\");\n        [migration enumerateObjects:MigrationTestObject.className block:migrateObjectBlock];\n    }];\n\n    // verify migration\n    MigrationTestObject *mig1 = [MigrationTestObject allObjectsInRealm:realm][1];\n    XCTAssertThrows(mig1[@\"oldIntCol\"], @\"Deleted column should no longer be accessible.\");\n}\n\n- (void)testChangePropertyType {\n    // make string an int\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:MigrationTestObject.class];\n    objectSchema.objectClass = RLMObject.class;\n    RLMProperty *stringCol = objectSchema.properties[1];\n    stringCol.type = RLMPropertyTypeInt;\n    stringCol.optional = NO;\n\n    // create realm with old schema and populate\n    [self createTestRealmWithSchema:@[objectSchema] block:^(RLMRealm *realm) {\n        [realm createObject:MigrationTestObject.className withValue:@[@1, @1]];\n        [realm createObject:MigrationTestObject.className withValue:@[@2, @2]];\n    }];\n\n    // apply migration\n    RLMRealm *realm = [self migrateTestRealmWithBlock:^(RLMMigration *migration, uint64_t oldSchemaVersion) {\n        XCTAssertEqual(oldSchemaVersion, 0U, @\"Initial schema version should be 0\");\n        [migration enumerateObjects:MigrationTestObject.className\n                              block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertEqualObjects(newObject[@\"intCol\"], oldObject[@\"intCol\"]);\n            NSNumber *intObj = oldObject[@\"stringCol\"];\n            XCTAssert([intObj isKindOfClass:NSNumber.class], @\"Old stringCol should be int\");\n            newObject[@\"stringCol\"] = intObj.stringValue;\n        }];\n    }];\n\n    // verify migration\n    MigrationTestObject *mig1 = [MigrationTestObject allObjectsInRealm:realm][1];\n    XCTAssertEqualObjects(mig1[@\"stringCol\"], @\"2\", @\"stringCol should be string after migration.\");\n}\n\n- (void)testChangeObjectLinkType {\n    // create realm with old schema and populate\n    [self createTestRealmWithSchema:RLMSchema.sharedSchema.objectSchema block:^(RLMRealm *realm) {\n        id obj = [realm createObject:MigrationTestObject.className withValue:@[@1, @\"1\"]];\n        [realm createObject:MigrationLinkObject.className withValue:@[obj, @[obj], @[obj]]];\n    }];\n\n    // Make the object link property link to a different class\n    RLMRealmConfiguration *config = self.config;\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:MigrationLinkObject.class];\n    [objectSchema.properties[0] setObjectClassName:MigrationLinkObject.className];\n    config.customSchema = [self schemaWithObjects:@[objectSchema, [RLMObjectSchema schemaForObjectClass:MigrationTestObject.class]]];\n\n    // Apply migration\n    config.schemaVersion = 1;\n    config.migrationBlock = ^(RLMMigration *migration, uint64_t oldSchemaVersion) {\n        XCTAssertEqual(oldSchemaVersion, 0U, @\"Initial schema version should be 0\");\n        [migration enumerateObjects:MigrationLinkObject.className\n                                       block:^(RLMObject *oldObject, RLMObject *newObject) {\n                                           XCTAssertNotNil(oldObject[@\"object\"]);\n                                           XCTAssertNil(newObject[@\"object\"]);\n\n                                           XCTAssertEqual(1U, [oldObject[@\"array\"] count]);\n                                           XCTAssertEqual(1U, [newObject[@\"array\"] count]);\n                                           XCTAssertEqual(1U, [oldObject[@\"set\"] count]);\n                                           XCTAssertEqual(1U, [newObject[@\"set\"] count]);\n                                       }];\n    };\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n    RLMAssertRealmSchemaMatchesTable(self, realm);\n}\n\n- (void)testChangeArrayLinkType {\n    // create realm with old schema and populate\n    RLMRealmConfiguration *config = [self config];\n    [self createTestRealmWithSchema:RLMSchema.sharedSchema.objectSchema block:^(RLMRealm *realm) {\n        id obj = [realm createObject:MigrationTestObject.className withValue:@[@1, @\"1\"]];\n        [realm createObject:MigrationLinkObject.className withValue:@[obj, @[obj]]];\n    }];\n\n    // Make the array linklist property link to a different class\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:MigrationLinkObject.class];\n    [objectSchema.properties[1] setObjectClassName:MigrationLinkObject.className];\n    config.customSchema = [self schemaWithObjects:@[objectSchema, [RLMObjectSchema schemaForObjectClass:MigrationTestObject.class]]];\n\n    // Apply migration\n    config.schemaVersion = 1;\n    config.migrationBlock = ^(RLMMigration *migration, uint64_t oldSchemaVersion) {\n        XCTAssertEqual(oldSchemaVersion, 0U, @\"Initial schema version should be 0\");\n        [migration enumerateObjects:MigrationLinkObject.className\n                                       block:^(RLMObject *oldObject, RLMObject *newObject) {\n                                           XCTAssertNotNil(oldObject[@\"object\"]);\n                                           XCTAssertNotNil(newObject[@\"object\"]);\n\n                                           XCTAssertEqual(1U, [oldObject[@\"array\"] count]);\n                                           XCTAssertEqual(0U, [newObject[@\"array\"] count]);\n                                       }];\n    };\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n    RLMAssertRealmSchemaMatchesTable(self, realm);\n}\n\n- (void)testChangeSetLinkType {\n    // create realm with old schema and populate\n    RLMRealmConfiguration *config = [self config];\n    [self createTestRealmWithSchema:RLMSchema.sharedSchema.objectSchema block:^(RLMRealm *realm) {\n        id obj = [realm createObject:MigrationTestObject.className withValue:@[@1, @\"1\"]];\n        [realm createObject:MigrationLinkObject.className withValue:@[obj, @[obj], @[obj]]];\n    }];\n\n    // Make the set linklist property link to a different class\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:MigrationLinkObject.class];\n    [objectSchema.properties[2] setObjectClassName:MigrationLinkObject.className];\n    config.customSchema = [self schemaWithObjects:@[objectSchema, [RLMObjectSchema schemaForObjectClass:MigrationTestObject.class]]];\n\n    // Apply migration\n    config.schemaVersion = 1;\n    config.migrationBlock = ^(RLMMigration *migration, uint64_t oldSchemaVersion) {\n        XCTAssertEqual(oldSchemaVersion, 0U, @\"Initial schema version should be 0\");\n        [migration enumerateObjects:MigrationLinkObject.className\n                                       block:^(RLMObject *oldObject, RLMObject *newObject) {\n                                           XCTAssertNotNil(oldObject[@\"object\"]);\n                                           XCTAssertNotNil(newObject[@\"object\"]);\n\n                                           XCTAssertEqual(1U, [oldObject[@\"set\"] count]);\n                                           XCTAssertEqual(0U, [newObject[@\"set\"] count]);\n                                       }];\n    };\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n    RLMAssertRealmSchemaMatchesTable(self, realm);\n}\n\n- (void)testMakingPropertyPrimaryPreservesValues {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:MigrationStringPrimaryKeyObject.class];\n    objectSchema.primaryKeyProperty = nil;\n\n    [self createTestRealmWithSchema:@[objectSchema] block:^(RLMRealm *realm) {\n        [realm createObject:MigrationStringPrimaryKeyObject.className withValue:@[@\"1\"]];\n        [realm createObject:MigrationStringPrimaryKeyObject.className withValue:@[@\"2\"]];\n    }];\n\n    RLMRealm *realm = [self migrateTestRealmWithBlock:nil];\n    RLMResults *objects = [MigrationStringPrimaryKeyObject allObjectsInRealm:realm];\n    XCTAssertEqualObjects(@\"1\", [objects[0] stringCol]);\n    XCTAssertEqualObjects(@\"2\", [objects[1] stringCol]);\n}\n\n- (void)testAddingPrimaryKeyShouldRejectDuplicateValues {\n    // make the pk non-primary so that we can add duplicate values\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:MigrationPrimaryKeyObject.class];\n    objectSchema.primaryKeyProperty = nil;\n    [self createTestRealmWithSchema:@[objectSchema] block:^(RLMRealm *realm) {\n        // populate with values that will be invalid when the property is made primary\n        [realm createObject:MigrationPrimaryKeyObject.className withValue:@[@1]];\n        [realm createObject:MigrationPrimaryKeyObject.className withValue:@[@1]];\n    }];\n\n    // Fails due to duplicate values\n    [self failToMigrateTestRealmWithBlock:nil];\n\n    // apply good migration that deletes duplicates\n    RLMRealm *realm = [self migrateTestRealmWithBlock:^(RLMMigration *migration, uint64_t) {\n        NSMutableSet *seen = [NSMutableSet set];\n        __block bool duplicateDeleted = false;\n        [migration enumerateObjects:@\"MigrationPrimaryKeyObject\" block:^(__unused RLMObject *oldObject, RLMObject *newObject) {\n           if ([seen containsObject:newObject[@\"intCol\"]]) {\n               duplicateDeleted = true;\n               [migration deleteObject:newObject];\n           }\n           else {\n               [seen addObject:newObject[@\"intCol\"]];\n           }\n        }];\n        XCTAssertEqual(true, duplicateDeleted);\n    }];\n\n    // make sure deletion occurred\n    XCTAssertEqual(1U, [[MigrationPrimaryKeyObject allObjectsInRealm:realm] count]);\n}\n\n- (void)testIncompleteMigrationIsRolledBack {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:MigrationPrimaryKeyObject.class];\n    objectSchema.primaryKeyProperty = nil;\n    [self createTestRealmWithSchema:@[objectSchema] block:^(RLMRealm *realm) {\n        [realm createObject:MigrationPrimaryKeyObject.className withValue:@[@1]];\n        [realm createObject:MigrationPrimaryKeyObject.className withValue:@[@1]];\n    }];\n\n    // fail to apply migration\n    [self failToMigrateTestRealmWithBlock:nil];\n\n    // should still be able to open with pre-migration schema\n    XCTAssertNoThrow([self realmWithSingleObject:objectSchema]);\n}\n\n- (void)testAddObjectDuringMigration {\n    // initialize realm\n    @autoreleasepool { [self realmWithTestPath]; }\n\n    RLMRealm *realm = [self migrateTestRealmWithBlock:^(RLMMigration * migration, uint64_t) {\n        [migration createObject:StringObject.className withValue:@[@\"string\"]];\n    }];\n    XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n}\n\n- (void)testEnumeratedObjectsDuringMigration {\n    [self createTestRealmWithClasses:@[StringObject.class, ArrayPropertyObject.class, SetPropertyObject.class, IntObject.class]\n                               block:^(RLMRealm *realm) {\n        [StringObject createInRealm:realm withValue:@[@\"string\"]];\n        [ArrayPropertyObject createInRealm:realm withValue:@[@\"array\", @[@[@\"string\"]], @[@[@1]]]];\n        [SetPropertyObject createInRealm:realm withValue:@[@\"set\", @[@[@\"string\"]], @[@[@1]]]];\n    }];\n\n    RLMRealm *realm = [self migrateTestRealmWithBlock:^(RLMMigration *migration, uint64_t) {\n        [migration enumerateObjects:StringObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertEqualObjects([oldObject valueForKey:@\"stringCol\"], oldObject[@\"stringCol\"]);\n            [newObject setValue:@\"otherString\" forKey:@\"stringCol\"];\n            XCTAssertEqualObjects([oldObject valueForKey:@\"realm\"], oldObject.realm);\n            XCTAssertThrows([oldObject valueForKey:@\"noSuchKey\"]);\n            XCTAssertThrows([newObject setValue:@1 forKey:@\"noSuchKey\"]);\n        }];\n\n        [migration enumerateObjects:ArrayPropertyObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertEqual(RLMDynamicObject.class, newObject.class);\n            XCTAssertEqual(RLMDynamicObject.class, oldObject.class);\n            XCTAssertEqual(RLMDynamicObject.class, [[oldObject[@\"array\"] firstObject] class]);\n            XCTAssertEqual(RLMDynamicObject.class, [[newObject[@\"array\"] firstObject] class]);\n        }];\n\n        [migration enumerateObjects:SetPropertyObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertEqual(RLMDynamicObject.class, newObject.class);\n            XCTAssertEqual(RLMDynamicObject.class, oldObject.class);\n            XCTAssertEqual(RLMDynamicObject.class, [[oldObject[@\"set\"] allObjects][0] class]);\n            XCTAssertEqual(RLMDynamicObject.class, [[newObject[@\"set\"] allObjects][0] class]);\n        }];\n    }];\n\n    XCTAssertEqualObjects(@\"otherString\", [[StringObject allObjectsInRealm:realm].firstObject stringCol]);\n}\n\n- (void)testEnumerateObjectsAfterDeleteObjects {\n    [self createTestRealmWithClasses:@[StringObject.class, IntObject.class, BoolObject.class] block:^(RLMRealm *realm) {\n        [StringObject createInRealm:realm withValue:@[@\"1\"]];\n        [StringObject createInRealm:realm withValue:@[@\"2\"]];\n        [StringObject createInRealm:realm withValue:@[@\"3\"]];\n        [IntObject createInRealm:realm withValue:@[@1]];\n        [IntObject createInRealm:realm withValue:@[@2]];\n        [IntObject createInRealm:realm withValue:@[@3]];\n        [BoolObject createInRealm:realm withValue:@[@YES]];\n        [BoolObject createInRealm:realm withValue:@[@NO]];\n        [BoolObject createInRealm:realm withValue:@[@YES]];\n    }];\n\n    [self migrateTestRealmWithBlock:^(RLMMigration *migration, uint64_t) {\n        __block NSInteger count = 0;\n        [migration enumerateObjects:StringObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertEqualObjects(oldObject[@\"stringCol\"], newObject[@\"stringCol\"]);\n            if ([oldObject[@\"stringCol\"] isEqualToString:@\"2\"]) {\n                [migration deleteObject:newObject];\n            }\n        }];\n        [migration enumerateObjects:StringObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertEqualObjects(oldObject[@\"stringCol\"], newObject[@\"stringCol\"]);\n            count++;\n        }];\n        XCTAssertEqual(count, 2);\n\n        count = 0;\n        [migration enumerateObjects:IntObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertEqualObjects(oldObject[@\"intCol\"], newObject[@\"intCol\"]);\n            if ([oldObject[@\"intCol\"] isEqualToNumber:@1]) {\n                [migration deleteObject:newObject];\n            }\n        }];\n        [migration enumerateObjects:IntObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertEqualObjects(oldObject[@\"intCol\"], newObject[@\"intCol\"]);\n            count++;\n        }];\n        XCTAssertEqual(count, 2);\n\n        [migration enumerateObjects:BoolObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertEqualObjects(oldObject[@\"boolCol\"], newObject[@\"boolCol\"]);\n            [migration deleteObject:newObject];\n        }];\n        [migration enumerateObjects:BoolObject.className block:^(__unused RLMObject *oldObject, __unused RLMObject *newObject) {\n            XCTFail(@\"This line should not executed since all objects have been deleted.\");\n        }];\n    }];\n}\n\n- (void)testEnumerateObjectsAfterDeleteInsertObjects {\n    [self createTestRealmWithClasses:@[StringObject.class, IntObject.class, BoolObject.class] block:^(RLMRealm *realm) {\n        [StringObject createInRealm:realm withValue:@[@\"1\"]];\n        [StringObject createInRealm:realm withValue:@[@\"2\"]];\n        [StringObject createInRealm:realm withValue:@[@\"3\"]];\n        [IntObject createInRealm:realm withValue:@[@1]];\n        [IntObject createInRealm:realm withValue:@[@2]];\n        [IntObject createInRealm:realm withValue:@[@3]];\n        [BoolObject createInRealm:realm withValue:@[@YES]];\n        [BoolObject createInRealm:realm withValue:@[@NO]];\n        [BoolObject createInRealm:realm withValue:@[@YES]];\n    }];\n\n    [self migrateTestRealmWithBlock:^(RLMMigration *migration, uint64_t) {\n        __block NSInteger count = 0;\n        [migration enumerateObjects:StringObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertEqualObjects(oldObject[@\"stringCol\"], newObject[@\"stringCol\"]);\n            if ([newObject[@\"stringCol\"] isEqualToString:@\"2\"]) {\n                [migration deleteObject:newObject];\n                [migration createObject:StringObject.className withValue:@[@\"A\"]];\n            }\n        }];\n        [migration enumerateObjects:StringObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertEqualObjects(oldObject[@\"stringCol\"], newObject[@\"stringCol\"]);\n            count++;\n        }];\n        XCTAssertEqual(count, 2);\n\n        count = 0;\n        [migration enumerateObjects:IntObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertEqualObjects(oldObject[@\"intCol\"], newObject[@\"intCol\"]);\n            if ([newObject[@\"intCol\"] isEqualToNumber:@1]) {\n                [migration deleteObject:newObject];\n                [migration createObject:IntObject.className withValue:@[@0]];\n            }\n        }];\n        [migration enumerateObjects:IntObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertEqualObjects(oldObject[@\"intCol\"], newObject[@\"intCol\"]);\n            count++;\n        }];\n        XCTAssertEqual(count, 2);\n\n        [migration enumerateObjects:BoolObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertEqualObjects(oldObject[@\"boolCol\"], newObject[@\"boolCol\"]);\n            [migration deleteObject:newObject];\n            [migration createObject:BoolObject.className withValue:@[@NO]];\n        }];\n        [migration enumerateObjects:BoolObject.className block:^(__unused RLMObject *oldObject, __unused RLMObject *newObject) {\n            XCTFail(@\"This line should not executed since all objects have been deleted.\");\n        }];\n    }];\n}\n\n- (void)testEnumerateObjectTypeRemovedFromSchema {\n    [self createTestRealmWithClasses:@[IntObject.class] block:^(RLMRealm *realm) {\n        [IntObject createInRealm:realm withValue:@[@1]];\n        [IntObject createInRealm:realm withValue:@[@2]];\n    }];\n\n    RLMRealmConfiguration *config = self.config;\n    config.objectClasses = @[StringObject.class];\n    config.schemaVersion = 1;\n    __block int enumerateCalls = 0;\n    config.migrationBlock = ^(RLMMigration *migration, uint64_t) {\n        [migration enumerateObjects:IntObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertNotNil(oldObject);\n            XCTAssertNil(newObject);\n            ++enumerateCalls;\n            XCTAssertGreaterThan([oldObject[@\"intCol\"] intValue], 0);\n        }];\n    };\n    XCTAssertTrue([RLMRealm performMigrationForConfiguration:config error:nil]);\n    XCTAssertEqual(enumerateCalls, 2);\n}\n\n- (void)testEnumerateObjectsAfterDeleteData {\n    [self createTestRealmWithClasses:@[IntObject.class] block:^(RLMRealm *realm) {\n        [IntObject createInRealm:realm withValue:@[@1]];\n        [IntObject createInRealm:realm withValue:@[@2]];\n    }];\n\n    [self migrateTestRealmWithBlock:^(RLMMigration *migration, uint64_t) {\n        [migration enumerateObjects:IntObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            XCTAssertNotNil(oldObject);\n            XCTAssertNotNil(newObject);\n        }];\n        [migration deleteDataForClassName:IntObject.className];\n        [migration enumerateObjects:IntObject.className block:^(RLMObject *, RLMObject *) {\n            XCTFail(@\"should not have enumerated any objects\");\n        }];\n    }];\n}\n\n- (RLMResults *)objectsOfType:(::Class)cls {\n    auto config = self.config;\n    config.schemaVersion = 1;\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n    return [cls allObjectsInRealm:realm];\n}\n\n- (void)testDeleteSomeObjectsWithinMigration {\n    [self createTestRealmWithClasses:@[IntObject.class] block:^(RLMRealm *realm) {\n        [IntObject createInRealm:realm withValue:@[@1]];\n        [IntObject createInRealm:realm withValue:@[@2]];\n        [IntObject createInRealm:realm withValue:@[@3]];\n    }];\n\n    [self migrateTestRealmWithBlock:^(RLMMigration *migration, uint64_t) {\n        [migration enumerateObjects:IntObject.className block:^(RLMObject *, RLMObject *newObject) {\n            if ([newObject[@\"intCol\"] intValue] != 2) {\n                [migration deleteObject:newObject];\n            }\n        }];\n    }];\n\n    XCTAssertEqualObjects([[self objectsOfType:IntObject.class] valueForKey:@\"intCol\"], (@[@2]));\n}\n\n- (void)testDeleteObjectsWithinSeparateEnumerations {\n    [self createTestRealmWithClasses:@[IntObject.class] block:^(RLMRealm *realm) {\n        [IntObject createInRealm:realm withValue:@[@1]];\n        [IntObject createInRealm:realm withValue:@[@2]];\n        [IntObject createInRealm:realm withValue:@[@3]];\n    }];\n\n    [self migrateTestRealmWithBlock:^(RLMMigration *migration, uint64_t) {\n        [migration enumerateObjects:IntObject.className block:^(RLMObject *, RLMObject *newObject) {\n            if ([newObject[@\"intCol\"] intValue] == 1) {\n                [migration deleteObject:newObject];\n            }\n        }];\n        [migration enumerateObjects:IntObject.className block:^(RLMObject *, RLMObject *newObject) {\n            if ([newObject[@\"intCol\"] intValue] == 3) {\n                [migration deleteObject:newObject];\n            }\n        }];\n    }];\n\n    XCTAssertEqualObjects([[self objectsOfType:IntObject.class] valueForKey:@\"intCol\"], (@[@2]));\n}\n\n- (void)testDeleteAndRecreateObjectsWithinMigration {\n    [self createTestRealmWithClasses:@[IntObject.class, PrimaryIntObject.class] block:^(RLMRealm *realm) {\n        [IntObject createInRealm:realm withValue:@[@1]];\n        [IntObject createInRealm:realm withValue:@[@2]];\n        [PrimaryIntObject createInRealm:realm withValue:@[@1]];\n        [PrimaryIntObject createInRealm:realm withValue:@[@2]];\n    }];\n\n    [self migrateTestRealmWithBlock:^(RLMMigration *migration, uint64_t) {\n        [migration enumerateObjects:IntObject.className block:^(RLMObject *, RLMObject *newObject) {\n            [migration deleteObject:newObject];\n        }];\n        [migration enumerateObjects:PrimaryIntObject.className block:^(RLMObject *, RLMObject *newObject) {\n            [migration deleteObject:newObject];\n        }];\n\n        [migration createObject:IntObject.className withValue:@[@2]];\n        [migration createObject:IntObject.className withValue:@[@4]];\n        [migration createObject:PrimaryIntObject.className withValue:@[@2]];\n        [migration createObject:PrimaryIntObject.className withValue:@[@4]];\n    }];\n\n    XCTAssertEqualObjects([[self objectsOfType:IntObject.class] valueForKey:@\"intCol\"], (@[@2, @4]));\n    XCTAssertEqualObjects([[self objectsOfType:PrimaryIntObject.class] valueForKey:@\"intCol\"], (@[@2, @4]));\n}\n\n- (void)testDeleteAllDataAndRecreateObjectsWithinMigration {\n    [self createTestRealmWithClasses:@[IntObject.class, PrimaryIntObject.class] block:^(RLMRealm *realm) {\n        [IntObject createInRealm:realm withValue:@[@1]];\n        [IntObject createInRealm:realm withValue:@[@2]];\n        [PrimaryIntObject createInRealm:realm withValue:@[@1]];\n        [PrimaryIntObject createInRealm:realm withValue:@[@2]];\n    }];\n\n    [self migrateTestRealmWithBlock:^(RLMMigration *migration, uint64_t) {\n        [migration deleteDataForClassName:IntObject.className];\n        [migration deleteDataForClassName:PrimaryIntObject.className];\n\n        [migration createObject:IntObject.className withValue:@[@2]];\n        [migration createObject:IntObject.className withValue:@[@4]];\n        [migration createObject:PrimaryIntObject.className withValue:@[@2]];\n        [migration createObject:PrimaryIntObject.className withValue:@[@4]];\n    }];\n\n    XCTAssertEqualObjects([[self objectsOfType:IntObject.class] valueForKey:@\"intCol\"], (@[@2, @4]));\n    XCTAssertEqualObjects([[self objectsOfType:PrimaryIntObject.class] valueForKey:@\"intCol\"], (@[@2, @4]));\n}\n\n- (void)testRequiredToNullableAutoMigration {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:AllOptionalTypes.class];\n    [objectSchema.properties setValue:@NO forKey:@\"optional\"];\n\n    // create initial required column\n    [self createTestRealmWithSchema:@[objectSchema] block:^(RLMRealm *realm) {\n        [AllOptionalTypes createInRealm:realm withValue:@[@1, @1, @1, @1, @\"str\",\n                                                          [@\"data\" dataUsingEncoding:NSUTF8StringEncoding],\n                                                          [NSDate dateWithTimeIntervalSince1970:1]]];\n        [AllOptionalTypes createInRealm:realm withValue:@[@2, @2, @2, @0, @\"str2\",\n                                                          [@\"data2\" dataUsingEncoding:NSUTF8StringEncoding],\n                                                          [NSDate dateWithTimeIntervalSince1970:2]]];\n    }];\n\n    RLMRealm *realm = [self migrateTestRealmWithBlock:nil];\n    RLMResults *allObjects = [AllOptionalTypes allObjectsInRealm:realm];\n    XCTAssertEqual(2U, allObjects.count);\n\n    AllOptionalTypes *obj = allObjects[0];\n    XCTAssertEqualObjects(@1, obj.intObj);\n    XCTAssertEqualObjects(@1, obj.floatObj);\n    XCTAssertEqualObjects(@1, obj.doubleObj);\n    XCTAssertEqualObjects(@1, obj.boolObj);\n    XCTAssertEqualObjects(@\"str\", obj.string);\n    XCTAssertEqualObjects([@\"data\" dataUsingEncoding:NSUTF8StringEncoding], obj.data);\n    XCTAssertEqualObjects([NSDate dateWithTimeIntervalSince1970:1], obj.date);\n\n    obj = allObjects[1];\n    XCTAssertEqualObjects(@2, obj.intObj);\n    XCTAssertEqualObjects(@2, obj.floatObj);\n    XCTAssertEqualObjects(@2, obj.doubleObj);\n    XCTAssertEqualObjects(@0, obj.boolObj);\n    XCTAssertEqualObjects(@\"str2\", obj.string);\n    XCTAssertEqualObjects([@\"data2\" dataUsingEncoding:NSUTF8StringEncoding], obj.data);\n    XCTAssertEqualObjects([NSDate dateWithTimeIntervalSince1970:2], obj.date);\n}\n\n- (void)testNullableToRequiredMigration {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:AllOptionalTypes.class];\n\n    // create initial nullable column\n    [self createTestRealmWithSchema:@[objectSchema] block:^(RLMRealm *realm) {\n        [AllOptionalTypes createInRealm:realm withValue:@[ [NSNull null], [NSNull null], [NSNull null], [NSNull null],\n                                                           [NSNull null], [NSNull null], [NSNull null]]];\n        [AllOptionalTypes createInRealm:realm withValue:@[@2, @2, @2, @0, @\"str2\",\n                                                          [@\"data2\" dataUsingEncoding:NSUTF8StringEncoding],\n                                                          [NSDate dateWithTimeIntervalSince1970:2]]];\n    }];\n\n    objectSchema.objectClass = RLMObject.class;\n    [objectSchema.properties setValue:@NO forKey:@\"optional\"];\n\n    RLMRealm *realm;\n    @autoreleasepool {\n        RLMRealmConfiguration *config = self.config;\n        config.customSchema = [self schemaWithObjects:@[ objectSchema ]];\n        config.schemaVersion = 1;\n        XCTAssertTrue([RLMRealm performMigrationForConfiguration:config error:nil]);\n\n        realm = [RLMRealm realmWithConfiguration:config error:nil];\n        RLMAssertRealmSchemaMatchesTable(self, realm);\n    }\n\n    RLMResults *allObjects = [AllOptionalTypes allObjectsInRealm:realm];\n    XCTAssertEqual(2U, allObjects.count);\n\n    AllOptionalTypes *obj = allObjects[0];\n    XCTAssertEqualObjects(@0, obj[@\"intObj\"]);\n    XCTAssertEqualObjects(@0, obj[@\"floatObj\"]);\n    XCTAssertEqualObjects(@0, obj[@\"doubleObj\"]);\n    XCTAssertEqualObjects(@0, obj[@\"boolObj\"]);\n    XCTAssertEqualObjects(@\"\", obj[@\"string\"]);\n    XCTAssertEqualObjects(NSData.data, obj[@\"data\"]);\n    XCTAssertEqualObjects([NSDate dateWithTimeIntervalSince1970:0], obj[@\"date\"]);\n\n    obj = allObjects[1];\n    XCTAssertEqualObjects(@0, obj[@\"intObj\"]);\n    XCTAssertEqualObjects(@0, obj[@\"floatObj\"]);\n    XCTAssertEqualObjects(@0, obj[@\"doubleObj\"]);\n    XCTAssertEqualObjects(@0, obj[@\"boolObj\"]);\n    XCTAssertEqualObjects(@\"\", obj[@\"string\"]);\n    XCTAssertEqualObjects(NSData.data, obj[@\"data\"]);\n    XCTAssertEqualObjects([NSDate dateWithTimeIntervalSince1970:0], obj[@\"date\"]);\n}\n\n- (void)testMigrationAfterReorderingProperties {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:RequiredPropertiesObject.class];\n    // Create a table where the order of columns does not match the order the properties are declared in the class.\n    objectSchema.properties = @[ objectSchema.properties[2], objectSchema.properties[0], objectSchema.properties[1] ];\n\n    [self createTestRealmWithSchema:@[objectSchema] block:^(RLMRealm *realm) {\n        // We use a dictionary here to ensure that the test reaches the migration case below, even if the non-migration\n        // case doesn't handle the ordering correctly. The non-migration case is tested in testRearrangeProperties.\n        [RequiredPropertiesObject createInRealm:realm withValue:@{ @\"stringCol\": @\"Hello\", @\"dateCol\": [NSDate date], @\"binaryCol\": [NSData data] }];\n    }];\n\n    objectSchema = [RLMObjectSchema schemaForObjectClass:RequiredPropertiesObject.class];\n    RLMRealmConfiguration *config = self.config;\n    config.customSchema = [self schemaWithObjects:@[objectSchema]];\n    config.schemaVersion = 1;\n    config.migrationBlock = ^(RLMMigration *migration, uint64_t) {\n        [migration createObject:RequiredPropertiesObject.className withValue:@[@\"World\", [NSData data], [NSDate date]]];\n    };\n\n    XCTAssertTrue([RLMRealm performMigrationForConfiguration:config error:nil]);\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n\n    RLMResults *allObjects = [RequiredPropertiesObject allObjectsInRealm:realm];\n    XCTAssertEqualObjects(@\"Hello\", [allObjects[0] stringCol]);\n    XCTAssertEqualObjects(@\"World\", [allObjects[1] stringCol]);\n}\n\n- (void)testModifyPrimaryKeyInMigration {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:PrimaryStringObject.class];\n\n    objectSchema.primaryKeyProperty = objectSchema[@\"intCol\"];\n    [self createTestRealmWithSchema:@[objectSchema] block:^(RLMRealm *realm) {\n        for (int i = 0; i < 10; ++i) {\n            [PrimaryStringObject createInRealm:realm withValue:@[@(i).stringValue, @(i + 10)]];\n        }\n    }];\n\n    auto realm = [self migrateTestRealmWithBlock:^(RLMMigration *migration, uint64_t) {\n        [migration enumerateObjects:@\"PrimaryStringObject\" block:^(RLMObject *oldObject, RLMObject *newObject) {\n            newObject[@\"stringCol\"] = [oldObject[@\"intCol\"] stringValue];\n        }];\n    }];\n\n    for (int i = 10; i < 20; ++i) {\n        auto obj = [PrimaryStringObject objectInRealm:realm forPrimaryKey:@(i).stringValue];\n        XCTAssertNotNil(obj);\n        XCTAssertEqual(obj.intCol, i);\n    }\n}\n\n- (void)testChangeEmptyTableFromTopLevelToEmbedded {\n    RLMObjectSchema *fromChild = [RLMObjectSchema schemaForObjectClass:EmbeddedIntObject.class];\n    fromChild.isEmbedded = false;\n    RLMObjectSchema *fromParent = [RLMObjectSchema schemaForObjectClass:EmbeddedIntParentObject.class];\n\n    RLMObjectSchema *toChild = [RLMObjectSchema schemaForObjectClass:EmbeddedIntObject.class];\n    RLMObjectSchema *toParent = [RLMObjectSchema schemaForObjectClass:EmbeddedIntParentObject.class];\n\n    [self assertMigrationRequiredForChangeFrom:@[fromChild, fromParent] to:@[toChild, toParent]];\n}\n\n- (void)testChangeEmptyTableFromEmbeddedToTopLevel {\n    RLMObjectSchema *fromChild = [RLMObjectSchema schemaForObjectClass:EmbeddedIntObject.class];\n    RLMObjectSchema *fromParent = [RLMObjectSchema schemaForObjectClass:EmbeddedIntParentObject.class];\n\n    RLMObjectSchema *toChild = [RLMObjectSchema schemaForObjectClass:EmbeddedIntObject.class];\n    toChild.isEmbedded = false;\n    RLMObjectSchema *toParent = [RLMObjectSchema schemaForObjectClass:EmbeddedIntParentObject.class];\n\n    [self assertMigrationRequiredForChangeFrom:@[fromChild, fromParent] to:@[toChild, toParent]];\n}\n\n- (void)testChangeToEmbeddedRequiresMigration {\n    RLMObjectSchema *fromChild = [RLMObjectSchema schemaForObjectClass:EmbeddedIntObject.class];\n    fromChild.isEmbedded = false;\n    RLMObjectSchema *fromParent = [RLMObjectSchema schemaForObjectClass:EmbeddedIntParentObject.class];\n\n    RLMObjectSchema *toChild = [RLMObjectSchema schemaForObjectClass:EmbeddedIntObject.class];\n    RLMObjectSchema *toParent = [RLMObjectSchema schemaForObjectClass:EmbeddedIntParentObject.class];\n    \n    [self createTestRealmWithSchema:@[fromChild, fromParent] block:^(RLMRealm *realm) {\n        EmbeddedIntObject *childObject = (EmbeddedIntObject *)[realm createObject:EmbeddedIntObject.className withValue:@[@42]];\n        [realm createObject:EmbeddedIntParentObject.className withValue:@[@42, childObject, NSNull.null]];\n        [realm createObject:EmbeddedIntParentObject.className withValue:@[@43, childObject, NSNull.null]];\n    }];\n    \n    [self assertMigrationRequiredForChangeFrom:@[fromChild, fromParent] to:@[toChild, toParent]];\n}\n\n- (void)testChangeTableToEmbeddedWithOnlyOneLinkPerObject {\n    RLMObjectSchema *fromChild = [RLMObjectSchema schemaForObjectClass:EmbeddedIntObject.class];\n    fromChild.isEmbedded = false;\n    RLMObjectSchema *fromParent = [RLMObjectSchema schemaForObjectClass:EmbeddedIntParentObject.class];\n\n    [self createTestRealmWithSchema:@[fromChild, fromParent] block:^(RLMRealm *realm) {\n        EmbeddedIntObject *childObject1 = (EmbeddedIntObject *)[realm createObject:EmbeddedIntObject.className withValue:@[@42]];\n        [realm createObject:EmbeddedIntParentObject.className withValue:@[@42, childObject1, NSNull.null]];\n        EmbeddedIntObject *childObject2 = (EmbeddedIntObject *)[realm createObject:EmbeddedIntObject.className withValue:@[@43]];\n        [realm createObject:EmbeddedIntParentObject.className withValue:@[@43, childObject2, NSNull.null]];\n    }];\n    \n    __block int parentEnumerateCalls = 0;\n    __block int childEnumerateCalls = 0;\n    RLMRealm *realm = [self migrateTestRealmWithBlock:^(RLMMigration *migration, uint64_t) {\n        [migration enumerateObjects:EmbeddedIntParentObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            parentEnumerateCalls++;\n            XCTAssertNotNil(oldObject);\n            XCTAssertNotNil(newObject);\n            NSNumber *newIntProperty = newObject[@\"object\"][@\"intCol\"];\n            XCTAssertEqualObjects(oldObject[@\"object\"][@\"intCol\"], newIntProperty);\n            XCTAssert([newIntProperty isEqual: @42] || [newIntProperty isEqual:@43]);\n        }];\n        [migration enumerateObjects:EmbeddedIntObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            childEnumerateCalls++;\n            XCTAssertNotNil(oldObject);\n            XCTAssertNotNil(newObject);\n            NSNumber *newIntProperty = newObject[@\"intCol\"];\n            XCTAssertEqualObjects(oldObject[@\"intCol\"], newIntProperty);\n            XCTAssert([newIntProperty isEqual:@42] || [newIntProperty isEqual:@43]);\n        }];\n    }];\n    XCTAssertNotNil(realm);\n    XCTAssertEqual(parentEnumerateCalls, 2);\n    XCTAssertEqual(childEnumerateCalls, 2);\n    RLMResults<EmbeddedIntParentObject *> *parentObjects = RLMGetObjects(realm, EmbeddedIntParentObject.className, nil);\n    XCTAssertEqual(parentObjects.count, 2U);\n    EmbeddedIntParentObject *firstParentObject = parentObjects[0];\n    XCTAssertEqual(firstParentObject.pk, 42);\n    EmbeddedIntObject *firstParentsChild = firstParentObject.object;\n    XCTAssertEqual(firstParentsChild.intCol, 42);\n    EmbeddedIntParentObject *secondParentObject = parentObjects[1];\n    EmbeddedIntObject *secondParentsChild = secondParentObject.object;\n    XCTAssertEqual(secondParentsChild.intCol, 43);\n}\n\n- (void)testChangeToEmbeddedWithMultipleBacklinksHandledAutomatically {\n    RLMObjectSchema *fromChild = [RLMObjectSchema schemaForObjectClass:EmbeddedIntObject.class];\n    fromChild.isEmbedded = false;\n    RLMObjectSchema *fromParent = [RLMObjectSchema schemaForObjectClass:EmbeddedIntParentObject.class];\n\n    [self createTestRealmWithSchema:@[fromChild, fromParent] block:^(RLMRealm *realm) {\n        EmbeddedIntObject *childObject = (EmbeddedIntObject *)[realm createObject:EmbeddedIntObject.className withValue:@[@42]];\n        [realm createObject:EmbeddedIntParentObject.className withValue:@[@42, childObject, NSNull.null]];\n        [realm createObject:EmbeddedIntParentObject.className withValue:@[@43, childObject, NSNull.null]];\n    }];\n\n    RLMRealm *realm = [self migrateTestRealmWithBlock:^(RLMMigration *, uint64_t) {}];\n    RLMResults<EmbeddedIntParentObject *> *parents = [EmbeddedIntParentObject allObjectsInRealm:realm];\n    XCTAssertEqual(parents.count, 2U);\n    XCTAssertEqual(parents[0].object.intCol, 42);\n    XCTAssertEqual(parents[1].object.intCol, 42);\n    XCTAssertFalse([parents[0].object isEqualToObject:parents[1].object]);\n}\n\n- (void)testConvertToEmbeddedWithMultipleIncomingLinksResolvedInMigrationBlock {\n    RLMObjectSchema *fromChild = [RLMObjectSchema schemaForObjectClass:EmbeddedIntObject.class];\n    fromChild.isEmbedded = false;\n    RLMObjectSchema *fromParent = [RLMObjectSchema schemaForObjectClass:EmbeddedIntParentObject.class];\n\n    [self createTestRealmWithSchema:@[fromChild, fromParent] block:^(RLMRealm *realm) {\n        EmbeddedIntObject *childObject = (EmbeddedIntObject *)[realm createObject:EmbeddedIntObject.className withValue:@[@42]];\n        [realm createObject:EmbeddedIntParentObject.className withValue:@[@42, childObject, NSNull.null]];\n        [realm createObject:EmbeddedIntParentObject.className withValue:@[@43, childObject, NSNull.null]];\n    }];\n    \n    __block int parentEnumerateCalls = 0;\n    __block int childEnumerateCalls = 0;\n    RLMRealm *realm = [self migrateTestRealmWithBlock:^(RLMMigration *migration, uint64_t) {\n        [migration enumerateObjects:EmbeddedIntParentObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            parentEnumerateCalls++;\n            XCTAssertNotNil(oldObject);\n            XCTAssertNotNil(newObject);\n            newObject[@\"object\"] = nil;\n        }];\n        [migration enumerateObjects:EmbeddedIntObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            childEnumerateCalls++;\n            XCTAssertNotNil(oldObject);\n            XCTAssertNotNil(newObject);\n            [migration deleteObject:newObject];\n        }];\n    }];\n    XCTAssertEqual(parentEnumerateCalls, 2);\n    XCTAssertEqual(childEnumerateCalls, 1);\n\n    RLMResults<EmbeddedIntParentObject *> *parentObjects = RLMGetObjects(realm, EmbeddedIntParentObject.className, nil);\n    XCTAssertEqual(parentObjects.count, 2U);\n    EmbeddedIntParentObject *firstParentObject = parentObjects[0];\n    XCTAssertNil(firstParentObject.object);\n    EmbeddedIntParentObject *secondParentObject = parentObjects[1];\n    XCTAssertNil(secondParentObject.object);\n    RLMResults<EmbeddedIntObject *> *childObjects = RLMGetObjects(realm, EmbeddedIntObject.className, nil);\n    XCTAssertEqual(childObjects.count, 0U);\n}\n\n- (void)testConvertToEmbeddedAddingMoreLinks {\n    RLMObjectSchema *fromChild = [RLMObjectSchema schemaForObjectClass:EmbeddedIntObject.class];\n    fromChild.isEmbedded = false;\n    RLMObjectSchema *fromParent = [RLMObjectSchema schemaForObjectClass:EmbeddedIntParentObject.class];\n\n    [self createTestRealmWithSchema:@[fromChild, fromParent] block:^(RLMRealm *realm) {\n        EmbeddedIntObject *childObject = (EmbeddedIntObject *)[realm createObject:EmbeddedIntObject.className withValue:@[@42]];\n        [realm createObject:EmbeddedIntParentObject.className withValue:@[@42, childObject, NSNull.null]];\n        [realm createObject:EmbeddedIntParentObject.className withValue:@[@43, childObject, NSNull.null]];\n    }];\n    \n    __block int parentEnumerateCalls = 0;\n    [self failToMigrateTestRealmWithBlock:^(RLMMigration *migration, uint64_t) {\n        [migration enumerateObjects:EmbeddedIntParentObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            parentEnumerateCalls++;\n            XCTAssertNotNil(oldObject);\n            XCTAssertNotNil(newObject);\n            RLMObject *childObject = newObject[@\"object\"];\n            XCTAssertNotNil(childObject);\n            if (childObject == nil) {\n                return;\n            }\n            [migration createObject:EmbeddedIntParentObject.className withValue:@[@43, childObject, NSNull.null]];\n        }];\n    }];\n    XCTAssertEqual(parentEnumerateCalls, 2);\n}\n\n#pragma mark - Property Rename\n\n// Successful Property Rename Tests\n\n- (void)testMigrationRenameProperty {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:AllTypesObject.class];\n    RLMObjectSchema *stringObjectSchema = [RLMObjectSchema schemaForObjectClass:StringObject.class];\n    RLMObjectSchema *mixedObjectSchema = [RLMObjectSchema schemaForObjectClass:MixedObject.class];\n    RLMObjectSchema *linkingObjectsSchema = [RLMObjectSchema schemaForObjectClass:LinkToAllTypesObject.class];\n    NSMutableArray *beforeProperties = [NSMutableArray arrayWithCapacity:objectSchema.properties.count];\n    for (RLMProperty *property in objectSchema.properties) {\n        [beforeProperties addObject:[property copyWithNewName:[NSString stringWithFormat:@\"before_%@\", property.name]]];\n    }\n    NSArray *afterProperties = objectSchema.properties;\n    objectSchema.properties = beforeProperties;\n\n    NSDictionary *valueDictionary = [AllTypesObject values:1 stringObject:(id)@[@\"a\"] mixedObject:(id)@[@\"a\"]];\n    NSMutableArray *inputValue = [NSMutableArray arrayWithCapacity:valueDictionary.count];\n    for (NSString *key in [afterProperties valueForKey:@\"name\"]) {\n        [inputValue addObject:valueDictionary[key]];\n    }\n\n    [self createTestRealmWithSchema:@[objectSchema, stringObjectSchema, mixedObjectSchema, linkingObjectsSchema]\n                              block:^(RLMRealm *realm) {\n        [AllTypesObject createInRealm:realm withValue:inputValue];\n    }];\n\n    objectSchema.properties = afterProperties;\n\n    RLMRealmConfiguration *config = [self renameConfigurationWithObjectSchemas:@[objectSchema, stringObjectSchema, mixedObjectSchema, linkingObjectsSchema]\n                                                                migrationBlock:^(RLMMigration *migration, __unused uint64_t oldSchemaVersion) {\n        [afterProperties enumerateObjectsUsingBlock:^(RLMProperty *property, NSUInteger idx, __unused BOOL *stop) {\n            [migration renamePropertyForClass:AllTypesObject.className oldName:[beforeProperties[idx] name] newName:property.name];\n            [migration enumerateObjects:AllTypesObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n                XCTAssertNotNil(oldObject[[beforeProperties[idx] name]]);\n                RLMAssertThrowsWithReasonMatching(newObject[[beforeProperties[idx] name]], @\"Invalid property name\");\n                if ([property.objectClassName isEqualToString:@\"\"]) {\n                    XCTAssertEqualObjects(oldObject[[beforeProperties[idx] name]], newObject[property.name]);\n                }\n            }];\n        }];\n        [migration enumerateObjects:AllTypesObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            NSString *(^regexReplace)(NSString *) = ^(NSString *desc) {\n                NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@\"<0x[0-9a-f]+>\"\n                                                                                       options:NSRegularExpressionCaseInsensitive\n                                                                                         error:nil];\n                return [regex stringByReplacingMatchesInString:desc\n                                                       options:0\n                                                         range:NSMakeRange(0, desc.length)\n                                                  withTemplate:@\"\"];\n            };\n\n            NSString *oldDescription = [oldObject.description stringByReplacingOccurrencesOfString:@\"before_\" withString:@\"\"];\n            NSString *newDescription = newObject.description;\n\n            oldDescription = regexReplace(oldDescription);\n            newDescription = regexReplace(newDescription);\n\n            XCTAssertEqualObjects(oldDescription, newDescription);\n        }];\n    }];\n    XCTAssertTrue([RLMRealm performMigrationForConfiguration:config error:nil]);\n\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n    RLMAssertRealmSchemaMatchesTable(self, realm);\n\n    RLMResults *allObjects = [AllTypesObject allObjectsInRealm:realm];\n    XCTAssertEqual(1U, allObjects.count);\n    XCTAssertEqual(1U, [[StringObject allObjectsInRealm:realm] count]);\n\n    AllTypesObject *obj = allObjects.firstObject;\n    XCTAssertEqualObjects(inputValue[0], @(obj.boolCol));\n    XCTAssertEqualObjects(inputValue[1], @(obj.intCol));\n    XCTAssertEqualObjects(inputValue[2], @(obj.floatCol));\n    XCTAssertEqualObjects(inputValue[3], @(obj.doubleCol));\n    XCTAssertEqualObjects(inputValue[4], obj.stringCol);\n    XCTAssertEqualObjects(inputValue[5], obj.binaryCol);\n    XCTAssertEqualObjects(inputValue[6], obj.dateCol);\n    XCTAssertEqualObjects(inputValue[7], @(obj.cBoolCol));\n    XCTAssertEqualObjects(inputValue[8], @(obj.longCol));\n    XCTAssertEqualObjects(inputValue[9], obj.decimalCol);\n    XCTAssertEqualObjects(inputValue[10], obj.objectIdCol);\n    XCTAssertEqualObjects(inputValue[11], obj.uuidCol);\n    XCTAssertEqualObjects(inputValue[12], @[obj.objectCol.stringCol]);\n    XCTAssertEqualObjects(inputValue[13], @[obj.mixedObjectCol.anyCol]);\n    XCTAssertEqualObjects(inputValue[14], obj.anyCol);\n}\n\n- (void)testMultipleMigrationRenameProperty {\n    RLMObjectSchema *schema = [RLMObjectSchema schemaForObjectClass:StringObject.class];\n    schema.properties = @[[schema.properties.firstObject copyWithNewName:@\"stringCol0\"]];\n\n    [self createTestRealmWithSchema:@[schema] block:^(RLMRealm *realm) {\n        [StringObject createInRealm:realm withValue:@[@\"0\"]];\n    }];\n\n    schema.properties = @[[schema.properties.firstObject copyWithNewName:@\"stringCol\"]];\n\n    __block bool migrationCalled = false;\n\n    RLMRealmConfiguration *config = self.config;\n    config.customSchema = [self schemaWithObjects:@[schema]];\n    config.schemaVersion = 2;\n    config.migrationBlock = ^(RLMMigration *migration, uint64_t oldVersion){\n        migrationCalled = true;\n        __block id oldValue = nil;\n        if (oldVersion < 1) {\n            [migration renamePropertyForClass:StringObject.className oldName:@\"stringCol0\" newName:@\"stringCol1\"];\n            [migration enumerateObjects:StringObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n                oldValue = oldObject[@\"stringCol0\"];\n                XCTAssertNotNil(oldValue);\n                RLMAssertThrowsWithReasonMatching(newObject[@\"stringCol0\"], @\"Invalid property name\");\n                RLMAssertThrowsWithReasonMatching(newObject[@\"stringCol1\"], @\"Invalid property name\");\n            }];\n        }\n        if (oldVersion < 2) {\n            [migration renamePropertyForClass:StringObject.className oldName:@\"stringCol1\" newName:@\"stringCol\"];\n\n            [migration enumerateObjects:StringObject.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n                XCTAssertEqualObjects(oldObject[@\"stringCol0\"], oldValue);\n                XCTAssertEqualObjects(newObject[@\"stringCol\"], oldValue);\n                RLMAssertThrowsWithReasonMatching(newObject[@\"stringCol0\"], @\"Invalid property name\");\n                RLMAssertThrowsWithReasonMatching(newObject[@\"stringCol1\"], @\"Invalid property name\");\n            }];\n        }\n    };\n\n    XCTAssertTrue([RLMRealm performMigrationForConfiguration:config error:nil]);\n    XCTAssertTrue(migrationCalled);\n    XCTAssertEqualObjects(@\"0\", [[[StringObject allObjectsInRealm:[RLMRealm realmWithConfiguration:config error:nil]] firstObject] stringCol]);\n}\n\n- (void)testMigrationRenamePropertyPrimaryKeyBoth {\n    [self assertPropertyRenameError:nil firstSchemaTransform:^(RLMObjectSchema *schema, RLMProperty *beforeProperty, __unused RLMProperty *afterProperty) {\n        schema.primaryKeyProperty = beforeProperty;\n    } secondSchemaTransform:^(RLMObjectSchema *schema, __unused RLMProperty *beforeProperty, RLMProperty *afterProperty) {\n        schema.primaryKeyProperty = afterProperty;\n    }];\n}\n\n- (void)testMigrationRenamePropertyUnsetPrimaryKey {\n    [self assertPropertyRenameError:nil firstSchemaTransform:^(RLMObjectSchema *schema, RLMProperty *beforeProperty, __unused RLMProperty *afterProperty) {\n        schema.primaryKeyProperty = beforeProperty;\n    } secondSchemaTransform:^(RLMObjectSchema *schema, __unused RLMProperty *beforeProperty, __unused RLMProperty *afterProperty) {\n        schema.primaryKeyProperty = nil;\n    }];\n}\n\n- (void)testMigrationRenamePropertySetPrimaryKey {\n    [self assertPropertyRenameError:nil firstSchemaTransform:nil\n              secondSchemaTransform:^(RLMObjectSchema *schema, RLMProperty *, RLMProperty *afterProperty) {\n        schema.primaryKeyProperty = afterProperty;\n    }];\n}\n\n- (void)testMigrationRenamePropertyIndexBoth {\n    [self assertPropertyRenameError:nil firstSchemaTransform:^(__unused RLMObjectSchema *schema, RLMProperty *beforeProperty, __unused RLMProperty *afterProperty) {\n        afterProperty.indexed = YES;\n        beforeProperty.indexed = YES;\n    } secondSchemaTransform:nil];\n}\n\n- (void)testMigrationRenamePropertyUnsetIndex {\n    [self assertPropertyRenameError:nil firstSchemaTransform:^(__unused RLMObjectSchema *schema, RLMProperty *beforeProperty, __unused RLMProperty *afterProperty) {\n        beforeProperty.indexed = YES;\n    } secondSchemaTransform:nil];\n}\n\n- (void)testMigrationRenamePropertySetIndex {\n    [self assertPropertyRenameError:nil firstSchemaTransform:^(__unused RLMObjectSchema *schema, __unused RLMProperty *beforeProperty, RLMProperty *afterProperty) {\n        afterProperty.indexed = YES;\n    } secondSchemaTransform:nil];\n}\n\n- (void)testMigrationRenamePropertySetOptional {\n    [self assertPropertyRenameError:nil firstSchemaTransform:^(__unused RLMObjectSchema *schema, RLMProperty *beforeProperty, __unused RLMProperty *afterProperty) {\n        beforeProperty.optional = NO;\n    } secondSchemaTransform:nil];\n}\n\n// Unsuccessful Property Rename Tests\n\n- (void)testMigrationRenamePropertySetRequired {\n    [self assertPropertyRenameError:@\"Cannot rename property 'StringObject.before_stringCol' to 'stringCol' because it would change from optional to required.\"\n               firstSchemaTransform:^(__unused RLMObjectSchema *schema, __unused RLMProperty *beforeProperty, RLMProperty *afterProperty) {\n        afterProperty.optional = NO;\n    } secondSchemaTransform:nil];\n}\n\n- (void)testMigrationRenamePropertyTypeMismatch {\n    [self assertPropertyRenameError:@\"Cannot rename property 'StringObject.before_stringCol' to 'stringCol' because it would change from type 'int' to 'string'.\"\n               firstSchemaTransform:^(RLMObjectSchema *, RLMProperty *beforeProperty, RLMProperty *) {\n        beforeProperty.type = RLMPropertyTypeInt;\n    } secondSchemaTransform:nil];\n}\n\n- (void)testMigrationRenamePropertyObjectTypeMismatch {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:MigrationLinkObject.class];\n    RLMObjectSchema *migrationObjectSchema = [RLMObjectSchema schemaForObjectClass:MigrationTestObject.class];\n    NSArray *afterProperties = objectSchema.properties;\n    NSMutableArray *beforeProperties = [NSMutableArray arrayWithCapacity:2];\n    for (RLMProperty *property in afterProperties) {\n        RLMProperty *beforeProperty = [property copyWithNewName:[NSString stringWithFormat:@\"before_%@\", property.name]];\n        beforeProperty.objectClassName = MigrationLinkObject.className;\n        [beforeProperties addObject:beforeProperty];\n    }\n    objectSchema.properties = beforeProperties;\n\n    [self createTestRealmWithSchema:@[objectSchema] block:^(__unused RLMRealm *realm) {\n        // No need to create an object\n    }];\n\n    objectSchema.properties = afterProperties;\n\n    [self assertPropertyRenameError:@\"Cannot rename property 'MigrationLinkObject.before_object' to 'object' because it would change from type '<MigrationLinkObject>' to '<MigrationTestObject>'.\"\n                      objectSchemas:@[objectSchema, migrationObjectSchema]\n                          className:MigrationLinkObject.className\n                            oldName:[beforeProperties[0] name]\n                            newName:[afterProperties[0] name]];\n\n    [self assertPropertyRenameError:@\"Cannot rename property 'MigrationLinkObject.before_array' to 'array' because it would change from type 'array<MigrationLinkObject>' to 'array<MigrationTestObject>'.\"\n                      objectSchemas:@[objectSchema, migrationObjectSchema]\n                          className:MigrationLinkObject.className\n                            oldName:[beforeProperties[1] name]\n                            newName:[afterProperties[1] name]];\n}\n\n- (void)testMigrationRenameMissingPropertiesAndClasses {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:StringObject.class];\n\n    [self createTestRealmWithSchema:@[objectSchema] block:^(__unused RLMRealm *realm) {\n        // No need to create an object\n    }];\n\n    // Missing Old Property\n    [self assertPropertyRenameError:@\"Cannot rename property 'StringObject.nonExistentProperty1' because it does not exist.\"\n                      objectSchemas:@[objectSchema] className:StringObject.className\n                            oldName:@\"nonExistentProperty1\" newName:@\"nonExistentProperty2\"];\n\n    // Missing New Property\n    RLMObjectSchema *renamedProperty = [objectSchema copy];\n    renamedProperty.properties[0].name = @\"stringCol2\";\n    [self assertPropertyRenameError:@\"Renamed property 'StringObject.nonExistentProperty' does not exist.\"\n                      objectSchemas:@[renamedProperty] className:StringObject.className\n                            oldName:@\"stringCol\" newName:@\"nonExistentProperty\"];\n\n    // Removed Class\n    [self assertPropertyRenameError:@\"Cannot rename properties for type 'StringObject' because it has been removed from the Realm.\"\n                      objectSchemas:@[[RLMObjectSchema schemaForObjectClass:IntObject.class]]\n                          className:StringObject.className oldName:@\"stringCol\" newName:@\"stringCol2\"];\n\n    // Without Removing Old Property\n    RLMProperty *secondProperty = [objectSchema.properties.firstObject copyWithNewName:@\"stringCol2\"];\n    objectSchema.properties = [objectSchema.properties arrayByAddingObject:secondProperty];\n    [self assertPropertyRenameError:@\"Cannot rename property 'StringObject.stringCol' to 'stringCol2' because the source property still exists.\"\n                      objectSchemas:@[objectSchema] className:StringObject.className oldName:@\"stringCol\" newName:@\"stringCol2\"];\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/NotificationTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#import \"RLMRealmConfiguration_Private.h\"\n\n@interface NotificationTests : RLMTestCase\n@property (nonatomic, strong) RLMNotificationToken *token;\n@property (nonatomic) bool called;\n@end\n\n@implementation NotificationTests\n- (void)setUp {\n    @autoreleasepool {\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            for (int i = 0; i < 10; ++i)\n                [IntObject createInDefaultRealmWithValue:@[@(i)]];\n        }];\n    }\n\n    _token = [self.query addNotificationBlock:^(RLMResults *results, __unused RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(results);\n        XCTAssertNil(error);\n        self.called = true;\n        CFRunLoopStop(CFRunLoopGetCurrent());\n    }];\n    CFRunLoopRun();\n}\n\n- (void)tearDown {\n    [_token invalidate];\n    [super tearDown];\n}\n\n- (RLMResults *)query {\n    return [IntObject objectsWhere:@\"intCol > 0 AND intCol < 5\"];\n}\n\n- (void)runAndWaitForNotification:(void (^)(RLMRealm *))block {\n    _called = false;\n    [self waitForNotification:RLMRealmDidChangeNotification realm:RLMRealm.defaultRealm block:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            block(realm);\n        }];\n    }];\n}\n\n- (void)expectNotification:(void (^)(RLMRealm *))block {\n    [self runAndWaitForNotification:block];\n    XCTAssertTrue(_called);\n}\n\n- (void)expectNoNotification:(void (^)(RLMRealm *))block {\n    [self runAndWaitForNotification:block];\n    XCTAssertFalse(_called);\n}\n\n- (void)testInsertObjectMatchingQuery {\n    [self expectNotification:^(RLMRealm *realm) {\n        [IntObject createInRealm:realm withValue:@[@3]];\n    }];\n}\n\n- (void)testInsertObjectNotMatchingQuery {\n    [self expectNoNotification:^(RLMRealm *realm) {\n        [IntObject createInRealm:realm withValue:@[@10]];\n    }];\n}\n\n- (void)testModifyObjectMatchingQuery {\n    [self expectNotification:^(RLMRealm *realm) {\n        [[IntObject objectsInRealm:realm where:@\"intCol = 3\"] setValue:@4 forKey:@\"intCol\"];\n    }];\n}\n\n- (void)testModifyObjectToNoLongerMatchQuery {\n    [self expectNotification:^(RLMRealm *realm) {\n        [[IntObject objectsInRealm:realm where:@\"intCol = 3\"] setValue:@5 forKey:@\"intCol\"];\n    }];\n}\n\n- (void)testModifyObjectNotMatchingQuery {\n    [self expectNoNotification:^(RLMRealm *realm) {\n        [[IntObject objectsInRealm:realm where:@\"intCol = 5\"] setValue:@6 forKey:@\"intCol\"];\n    }];\n}\n\n- (void)testModifyObjectToMatchQuery {\n    [self expectNotification:^(RLMRealm *realm) {\n        [[IntObject objectsInRealm:realm where:@\"intCol = 5\"] setValue:@4 forKey:@\"intCol\"];\n    }];\n}\n\n- (void)testDeleteObjectMatchingQuery {\n    [self expectNotification:^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 4\"]];\n    }];\n}\n\n- (void)testDeleteObjectNotMatchingQuery {\n    [self expectNoNotification:^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 5\"]];\n    }];\n    [self expectNoNotification:^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 0\"]];\n    }];\n}\n\n- (void)testNonMatchingObjectMovedToIndexOfMatchingRowAndMadeMatching {\n    [self expectNotification:^(RLMRealm *realm) {\n        // Make the last object match the query\n        [[[IntObject allObjectsInRealm:realm] lastObject] setIntCol:3];\n        // Move the now-matching object over a previously matching object\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 2\"]];\n    }];\n}\n\n- (void)testSuppressCollectionNotification {\n    _called = false;\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    [realm deleteAllObjects];\n    [realm commitWriteTransactionWithoutNotifying:@[_token] error:nil];\n\n    // Add a new callback that we can wait for, as we can't wait for a\n    // notification to not be delivered\n    RLMNotificationToken *token = [self.query addNotificationBlock:^(__unused RLMResults *results,\n                                                                     __unused RLMCollectionChange *change,\n                                                                     __unused NSError *error) {\n        CFRunLoopStop(CFRunLoopGetCurrent());\n    }];\n    CFRunLoopRun();\n    [token invalidate];\n\n    XCTAssertFalse(_called);\n}\n\n- (void)testSuppressRealmNotification {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    RLMNotificationToken *token = [realm addNotificationBlock:^(__unused RLMNotification notification, __unused RLMRealm *realm) {\n        XCTFail(@\"should not have been called\");\n    }];\n\n    [realm beginWriteTransaction];\n    [realm deleteAllObjects];\n    [realm commitWriteTransactionWithoutNotifying:@[token] error:nil];\n\n    // local realm notifications are called synchronously so no need to wait for anything\n    [token invalidate];\n}\n\n- (void)testSuppressRealmNotificationInTransactionWithBlock {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    RLMNotificationToken *token = [realm addNotificationBlock:^(__unused RLMNotification notification, __unused RLMRealm *realm) {\n        XCTFail(@\"should not have been called\");\n    }];\n\n    [realm transactionWithoutNotifying:@[token] block:^{\n        [realm deleteAllObjects];\n    }];\n\n    // local realm notifications are called synchronously so no need to wait for anything\n    [token invalidate];\n}\n\n- (void)testSuppressRealmNotificationForWrongRealm {\n    RLMRealm *otherRealm = [self realmWithTestPath];\n    RLMNotificationToken *token = [otherRealm addNotificationBlock:^(__unused RLMNotification notification, __unused RLMRealm *realm) {\n        XCTFail(@\"should not have been called\");\n    }];\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    XCTAssertThrows([realm commitWriteTransactionWithoutNotifying:@[token] error:nil]);\n    [realm cancelWriteTransaction];\n    [token invalidate];\n}\n\n- (void)testSuppressCollectionNotificationForWrongRealm {\n    // Test with the token's realm not in a write transaction\n    RLMRealm *otherRealm = [self realmWithTestPath];\n    [otherRealm beginWriteTransaction];\n    XCTAssertThrows([otherRealm commitWriteTransactionWithoutNotifying:@[_token] error:nil]);\n\n    // and in a write transaction\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    XCTAssertThrows([otherRealm commitWriteTransactionWithoutNotifying:@[_token] error:nil]);\n    [realm cancelWriteTransaction];\n    [otherRealm cancelWriteTransaction];\n}\n@end\n\n@interface SortedNotificationTests : NotificationTests\n@end\n@implementation SortedNotificationTests\n- (RLMResults *)query {\n    return [[IntObject objectsWhere:@\"intCol > 0 AND intCol < 5\"]\n            sortedResultsUsingKeyPath:@\"intCol\" ascending:NO];\n}\n\n- (void)testMoveMatchingObjectDueToDeletionOfNonMatchingObject {\n    [self expectNoNotification:^(RLMRealm *realm) {\n        // Make a matching object be the last row\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol >= 5\"]];\n        // Delete a non-last, non-match row so that a matched row is moved\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 0\"]];\n    }];\n}\n\n- (void)testMultipleMovesOfSingleRow {\n    [self expectNotification:^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject allObjectsInRealm:realm]];\n        [IntObject createInRealm:realm withValue:@[@10]];\n        [IntObject createInRealm:realm withValue:@[@10]];\n        [IntObject createInRealm:realm withValue:@[@3]];\n    }];\n\n    [self expectNoNotification:^(RLMRealm *realm) {\n        RLMResults *objects = [IntObject allObjectsInRealm:realm];\n        [realm deleteObject:objects[1]];\n        [realm deleteObject:objects[0]];\n    }];\n}\n@end\n\n@protocol ChangesetTestCase\n- (RLMResults *)query;\n- (void)prepare;\n@end\n\n@interface NSIndexPath (TableViewHelpers)\n@property (nonatomic, readonly) NSInteger section;\n@property (nonatomic, readonly) NSInteger row;\n@end\n\n@implementation NSIndexPath (TableViewHelpers)\n- (NSInteger)section {\n    return [self indexAtPosition:0];\n}\n- (NSInteger)row {\n    return [self indexAtPosition:1];\n}\n@end\n\nstatic RLMCollectionChange *getChange(RLMTestCase<ChangesetTestCase> *self, void (^block)(RLMRealm *realm)) {\n    [self prepare];\n\n    __block bool first = true;\n    RLMResults *query = [self query];\n    __block RLMCollectionChange *changes;\n    id token = [query addNotificationBlock:^(RLMResults *results, RLMCollectionChange *c, NSError *error) {\n        XCTAssertNotNil(results);\n        XCTAssertNil(error);\n        changes = c;\n        XCTAssertTrue(first == !changes);\n        first = false;\n        CFRunLoopStop(CFRunLoopGetCurrent());\n    }];\n    CFRunLoopRun();\n\n    [self waitForNotification:RLMRealmDidChangeNotification realm:RLMRealm.defaultRealm block:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            block(realm);\n        }];\n    }];\n\n    [(RLMNotificationToken *)token invalidate];\n    token = nil;\n\n    return changes;\n}\n\nstatic void ExpectChange(id self, NSArray *deletions, NSArray *insertions,\n                         NSArray *modifications, void (^block)(RLMRealm *realm)) {\n    RLMCollectionChange *changes = getChange(self, block);\n    XCTAssertNotNil(changes);\n    if (!changes) {\n        return;\n    }\n\n    XCTAssertEqualObjects(deletions, changes.deletions);\n    XCTAssertEqualObjects(insertions, changes.insertions);\n    XCTAssertEqualObjects(modifications, changes.modifications);\n\n    NSInteger section = __LINE__;\n    NSArray *deletionPaths = [changes deletionsInSection:section];\n    NSArray *insertionPaths = [changes insertionsInSection:section + 1];\n    NSArray *modificationPaths = [changes modificationsInSection:section + 2];\n    XCTAssert(deletionPaths.count == 0 || [deletionPaths[0] section] == section);\n    XCTAssert(insertionPaths.count == 0 || [insertionPaths[0] section] == section + 1);\n    XCTAssert(modificationPaths.count == 0 || [modificationPaths[0] section] == section + 2);\n    XCTAssertEqualObjects(deletions, [deletionPaths valueForKey:@\"row\"]);\n    XCTAssertEqualObjects(insertions, [insertionPaths valueForKey:@\"row\"]);\n    XCTAssertEqualObjects(modifications, [modificationPaths valueForKey:@\"row\"]);\n}\n\n#define ExpectNoChange(self, block) XCTAssertNil(getChange((self), (block)))\n\n@interface ChangesetTests : RLMTestCase <ChangesetTestCase>\n@end\n\n@implementation ChangesetTests\n - (void)prepare {\n    @autoreleasepool {\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            [realm deleteAllObjects];\n            for (int i = 0; i < 10; ++i) {\n                IntObject *io = [IntObject createInDefaultRealmWithValue:@[@(i)]];\n                [ArrayPropertyObject createInDefaultRealmWithValue:@[@\"\", @[], @[io]]];\n            }\n        }];\n    }\n }\n\n- (RLMResults *)query {\n    return [IntObject objectsWhere:@\"intCol > 0 AND intCol < 5\"];\n}\n\n- (void)testDeleteMultiple {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol > 4\"]];\n    });\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol > 4\"]];\n    });\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol > 5\"]];\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 0\"]];\n    });\n\n    ExpectChange(self, @[@1, @2, @3], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol > 1\"]];\n    });\n    ExpectChange(self, @[@1, @2, @3], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 2\"]];\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 3\"]];\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 4\"]];\n    });\n    ExpectChange(self, @[@1, @2, @3], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 4\"]];\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 3\"]];\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 2\"]];\n    });\n\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol > 4\"]];\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol < 1\"]];\n    });\n\n    ExpectChange(self, @[@0, @1, @2, @3], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[[IntObject allObjectsInRealm:realm] valueForKey:@\"self\"]];\n    });\n}\n\n- (void)testDeleteNewlyInsertedRowMatchingQuery {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [IntObject createInRealm:realm withValue:@[@3]];\n        [realm deleteObject:[IntObject allObjectsInRealm:realm].lastObject];\n    });\n}\n\n- (void)testInsertObjectMatchingQuery {\n    ExpectChange(self, @[], @[@4], @[], ^(RLMRealm *realm) {\n        [IntObject createInRealm:realm withValue:@[@3]];\n    });\n}\n\n- (void)testInsertObjectNotMatchingQuery {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [IntObject createInRealm:realm withValue:@[@5]];\n    });\n}\n\n- (void)testInsertBothMatchingAndNonMatching {\n    ExpectChange(self, @[], @[@4], @[], ^(RLMRealm *realm) {\n        [IntObject createInRealm:realm withValue:@[@5]];\n        [IntObject createInRealm:realm withValue:@[@3]];\n    });\n}\n\n- (void)testInsertMultipleMatching {\n    ExpectChange(self, @[], @[@4, @5], @[], ^(RLMRealm *realm) {\n        [IntObject createInRealm:realm withValue:@[@5]];\n        [IntObject createInRealm:realm withValue:@[@3]];\n        [IntObject createInRealm:realm withValue:@[@5]];\n        [IntObject createInRealm:realm withValue:@[@2]];\n    });\n}\n\n- (void)testModifyObjectMatchingQuery {\n    ExpectChange(self, @[], @[], @[@2], ^(RLMRealm *realm) {\n        [[IntObject objectsInRealm:realm where:@\"intCol = 3\"] setValue:@4 forKey:@\"intCol\"];\n    });\n}\n\n- (void)testModifyObjectToNoLongerMatchQuery {\n    ExpectChange(self, @[@2], @[], @[], ^(RLMRealm *realm) {\n        [[IntObject objectsInRealm:realm where:@\"intCol = 3\"] setValue:@5 forKey:@\"intCol\"];\n    });\n}\n\n- (void)testModifyObjectNotMatchingQuery {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [[IntObject objectsInRealm:realm where:@\"intCol = 5\"] setValue:@6 forKey:@\"intCol\"];\n    });\n}\n\n- (void)testModifyObjectToMatchQuery {\n    ExpectChange(self, @[], @[@4], @[], ^(RLMRealm *realm) {\n        [[IntObject objectsInRealm:realm where:@\"intCol = 5\"] setValue:@4 forKey:@\"intCol\"];\n    });\n}\n\n- (void)testModifyObjectShiftedByDeletion {\n    ExpectChange(self, @[@1], @[], @[@2], ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 2\"]];\n        [[IntObject objectsInRealm:realm where:@\"intCol = 3\"] setValue:@4 forKey:@\"intCol\"];\n    });\n}\n\n- (void)testDeleteObjectMatchingQuery {\n    ExpectChange(self, @[@0], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 1\"]];\n    });\n    ExpectChange(self, @[@3], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 4\"]];\n    });\n}\n\n- (void)testDeleteNonMatchingBeforeMatches {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 0\"]];\n    });\n}\n\n- (void)testDeleteNonMatchingAfterMatches {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 5\"]];\n    });\n}\n\n#if 0 // maybe relevant to queries on backlinks?\n- (void)testMoveMatchingObjectDueToDeletionOfNonMatchingObject {\n    ExpectChange(self, @[@3], @[@0], @[], ^(RLMRealm *realm) {\n        // Make a matching object be the last row\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol >= 5\"]];\n        // Delete a non-last, non-match row so that a matched row is moved\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 0\"]];\n    });\n}\n\n- (void)testNonMatchingObjectMovedToIndexOfMatchingRowAndMadeMatching {\n    ExpectChange(self, @[@1], @[@1], @[], ^(RLMRealm *realm) {\n        // Make the last object match the query\n        [[[IntObject allObjectsInRealm:realm] lastObject] setIntCol:3];\n        // Move the now-matching object over a previously matching object\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 2\"]];\n    });\n}\n#endif\n\n- (void)testExcludingChangesFromSkippedTransaction {\n    [self prepare];\n\n    __block bool first = true;\n    RLMResults *query = [self query];\n    __block RLMCollectionChange *changes;\n    RLMNotificationToken *token = [query addNotificationBlock:^(RLMResults *results, RLMCollectionChange *c, NSError *error) {\n        XCTAssertNotNil(results);\n        XCTAssertNil(error);\n        changes = c;\n        XCTAssertTrue(first || changes);\n        first = false;\n        CFRunLoopStop(CFRunLoopGetCurrent());\n    }];\n    CFRunLoopRun();\n\n    [query.realm beginWriteTransaction];\n    [IntObject createInRealm:query.realm withValue:@[@3]];\n    [query.realm commitWriteTransactionWithoutNotifying:@[token] error:nil];\n\n    [self waitForNotification:RLMRealmDidChangeNotification realm:RLMRealm.defaultRealm block:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            [IntObject createInRealm:realm withValue:@[@3]];\n        }];\n    }];\n\n    [token invalidate];\n    token = nil;\n\n    XCTAssertNotNil(changes);\n    // Should only have the row inserted in the background transaction\n    XCTAssertEqualObjects(@[@5], changes.insertions);\n}\n\n- (void)testMultipleWriteTransactionsWithinNotification {\n    [self prepare];\n\n    RLMResults *query1 = [self query];\n    __block int calls1 = 0;\n    RLMNotificationToken *token1 = [query1 addNotificationBlock:^(RLMResults *results, RLMCollectionChange *c, NSError *error) {\n        XCTAssertNotNil(results);\n        XCTAssertNil(error);\n        if (calls1++ == 0) {\n            XCTAssertNil(c);\n            return;\n        }\n        XCTAssertEqualObjects(c.deletions, @[@(5 - calls1)]);\n    }];\n\n    RLMResults *query2 = [self query];\n    __block int calls2 = 0;\n    RLMNotificationToken *token2 = [query2 addNotificationBlock:^(RLMResults *results, __unused RLMCollectionChange *c, NSError *error) {\n        XCTAssertNotNil(results);\n        XCTAssertNil(error);\n        ++calls2;\n        RLMRealm *realm = results.realm;\n        if (realm.inWriteTransaction) {\n            return;\n        }\n        while (results.count) {\n            [realm beginWriteTransaction];\n            [realm deleteObject:[results lastObject]];\n            [realm commitWriteTransaction];\n        }\n    }];\n\n    id ex = [self expectationWithDescription:@\"last query gets final notification\"];\n    RLMResults *query3 = [self query];\n    __block int calls3 = 0;\n    RLMNotificationToken *token3 = [query3 addNotificationBlock:^(RLMResults *results, RLMCollectionChange *c, NSError *error) {\n        XCTAssertNotNil(results);\n        XCTAssertNil(error);\n        if (++calls3 == 1) {\n            XCTAssertNil(c);\n        }\n        else {\n            XCTAssertEqualObjects(c.deletions, @[@(5 - calls3)]);\n        }\n        if (results.count == 0) {\n            [ex fulfill];\n        }\n    }];\n\n    [self waitForExpectations:@[ex] timeout:2.0];\n\n    XCTAssertEqual(calls1, 5);\n    XCTAssertEqual(calls2, 5);\n    XCTAssertEqual(calls3, 5);\n\n    [token1 invalidate];\n    [token2 invalidate];\n    [token3 invalidate];\n}\n\n@end\n\n@interface LinkViewArrayChangesetTests : RLMTestCase <ChangesetTestCase>\n@end\n\n@implementation LinkViewArrayChangesetTests\n- (void)prepare {\n    @autoreleasepool {\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            [realm deleteAllObjects];\n            for (int i = 0; i < 10; ++i) {\n                [IntObject createInDefaultRealmWithValue:@[@(i)]];\n            }\n            [ArrayPropertyObject createInDefaultRealmWithValue:@[@\"\", @[], [IntObject allObjectsInRealm:realm]]];\n        }];\n    }\n}\n\n- (RLMResults *)query {\n    return [[[ArrayPropertyObject.allObjects firstObject] intArray]\n            objectsWhere:@\"intCol > 0 AND intCol < 5\"];\n}\n\n- (void)testDeleteMultiple {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol > 4\"]];\n    });\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol > 5\"]];\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 0\"]];\n    });\n\n    ExpectChange(self, @[@1, @2, @3], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol > 1\"]];\n    });\n    ExpectChange(self, @[@1, @2, @3], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 2\"]];\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 3\"]];\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 4\"]];\n    });\n    ExpectChange(self, @[@1, @2, @3], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 4\"]];\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 3\"]];\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 2\"]];\n    });\n\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol > 4\"]];\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol < 1\"]];\n    });\n}\n\n- (void)testModifyObjectMatchingQuery {\n    ExpectChange(self, @[], @[], @[@2], ^(RLMRealm *realm) {\n        [[IntObject objectsInRealm:realm where:@\"intCol = 3\"] setValue:@4 forKey:@\"intCol\"];\n    });\n}\n\n- (void)testModifyObjectToNoLongerMatchQuery {\n    ExpectChange(self, @[@2], @[], @[], ^(RLMRealm *realm) {\n        [[IntObject objectsInRealm:realm where:@\"intCol = 3\"] setValue:@5 forKey:@\"intCol\"];\n    });\n}\n\n- (void)testModifyObjectNotMatchingQuery {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [[IntObject objectsInRealm:realm where:@\"intCol = 5\"] setValue:@6 forKey:@\"intCol\"];\n    });\n}\n\n- (void)testModifyObjectToMatchQuery {\n    ExpectChange(self, @[], @[@4], @[], ^(RLMRealm *realm) {\n        [[IntObject objectsInRealm:realm where:@\"intCol = 5\"] setValue:@4 forKey:@\"intCol\"];\n    });\n}\n\n- (void)testDeleteObjectMatchingQuery {\n    ExpectChange(self, @[@0], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 1\"]];\n    });\n    ExpectChange(self, @[@3], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 4\"]];\n    });\n}\n\n- (void)testDeleteNonMatchingBeforeMatches {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 0\"]];\n    });\n}\n\n- (void)testDeleteNonMatchingAfterMatches {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 5\"]];\n    });\n}\n\n- (void)testMoveMatchingObjectDueToDeletionOfNonMatchingObject {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        // Make a matching object be the last row\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol >= 5\"]];\n        // Delete a non-last, non-match row so that a matched row is moved\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 0\"]];\n    });\n}\n\n- (void)testNonMatchingObjectMovedToIndexOfMatchingRowAndMadeMatching {\n    ExpectChange(self, @[@1], @[@3], @[], ^(RLMRealm *realm) {\n        // Make the last object match the query\n        [[[IntObject allObjectsInRealm:realm] lastObject] setIntCol:3];\n        // Move the now-matching object over a previously matching object\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 2\"]];\n    });\n}\n\n- (void)testDeleteNewlyInsertedRowMatchingQuery {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        RLMArray *array = [[[ArrayPropertyObject allObjectsInRealm:realm] firstObject] intArray];\n        [array addObject:[IntObject createInRealm:realm withValue:@[@3]]];\n        [realm deleteObject:[IntObject allObjectsInRealm:realm].lastObject];\n    });\n}\n\n- (void)testInsertObjectMatchingQuery {\n    ExpectChange(self, @[], @[@4], @[], ^(RLMRealm *realm) {\n        RLMArray *array = [[[ArrayPropertyObject allObjectsInRealm:realm] firstObject] intArray];\n        [array addObject:[IntObject createInRealm:realm withValue:@[@3]]];\n    });\n}\n\n- (void)testInsertObjectNotMatchingQuery {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        RLMArray *array = [[[ArrayPropertyObject allObjectsInRealm:realm] firstObject] intArray];\n        [array addObject:[IntObject createInRealm:realm withValue:@[@5]]];\n    });\n}\n\n- (void)testInsertBothMatchingAndNonMatching {\n    ExpectChange(self, @[], @[@4], @[], ^(RLMRealm *realm) {\n        RLMArray *array = [[[ArrayPropertyObject allObjectsInRealm:realm] firstObject] intArray];\n        [array addObject:[IntObject createInRealm:realm withValue:@[@5]]];\n        [array addObject:[IntObject createInRealm:realm withValue:@[@3]]];\n    });\n}\n\n- (void)testInsertMultipleMatching {\n    ExpectChange(self, @[], @[@4, @5], @[], ^(RLMRealm *realm) {\n        RLMArray *array = [[[ArrayPropertyObject allObjectsInRealm:realm] firstObject] intArray];\n        [array addObject:[IntObject createInRealm:realm withValue:@[@5]]];\n        [array addObject:[IntObject createInRealm:realm withValue:@[@3]]];\n        [array addObject:[IntObject createInRealm:realm withValue:@[@5]]];\n        [array addObject:[IntObject createInRealm:realm withValue:@[@2]]];\n    });\n}\n\n- (void)testInsertAtIndex {\n    ExpectChange(self, @[], @[@0], @[], ^(RLMRealm *realm) {\n        RLMArray *array = [[[ArrayPropertyObject allObjectsInRealm:realm] firstObject] intArray];\n        IntObject *io = [IntObject createInRealm:realm withValue:@[@3]];\n        [array insertObject:io atIndex:0];\n    });\n\n    ExpectChange(self, @[], @[@0], @[], ^(RLMRealm *realm) {\n        RLMArray *array = [[[ArrayPropertyObject allObjectsInRealm:realm] firstObject] intArray];\n        IntObject *io = [IntObject createInRealm:realm withValue:@[@3]];\n        [array insertObject:io atIndex:1];\n    });\n\n    ExpectChange(self, @[], @[@1], @[], ^(RLMRealm *realm) {\n        RLMArray *array = [[[ArrayPropertyObject allObjectsInRealm:realm] firstObject] intArray];\n        IntObject *io = [IntObject createInRealm:realm withValue:@[@3]];\n        [array insertObject:io atIndex:2];\n    });\n\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        RLMArray *array = [[[ArrayPropertyObject allObjectsInRealm:realm] firstObject] intArray];\n        IntObject *io = [IntObject createInRealm:realm withValue:@[@5]];\n        [array insertObject:io atIndex:2];\n    });\n}\n\n- (void)testExchangeObjects {\n    // adjacent swap: one move, since second is redundant\n//    ExpectChange(self, @[@1, @0], @[], @[], ^(RLMRealm *realm) {\n//        RLMArray *array = [[[ArrayPropertyObject allObjectsInRealm:realm] firstObject] intArray];\n//        [array exchangeObjectAtIndex:1 withObjectAtIndex:2];\n//    });\n\n    // non-adjacent: two moves needed\n//    ExpectChange(self, @[@0, @2], ^(RLMRealm *realm) {\n//        RLMArray *array = [[[ArrayPropertyObject allObjectsInRealm:realm] firstObject] intArray];\n//        [array exchangeObjectAtIndex:1 withObjectAtIndex:3];\n//    });\n}\n\n- (void)testRemoveFromArray {\n    ExpectChange(self, @[@0], @[], @[], ^(RLMRealm *realm) {\n        RLMArray *array = [[[ArrayPropertyObject allObjectsInRealm:realm] firstObject] intArray];\n        [array removeObjectAtIndex:1];\n    });\n\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        RLMArray *array = [[[ArrayPropertyObject allObjectsInRealm:realm] firstObject] intArray];\n        [array removeObjectAtIndex:0];\n    });\n}\n\n- (void)testClearArray {\n    ExpectChange(self, @[@0, @1, @2, @3], @[], @[], ^(RLMRealm *realm) {\n        RLMArray *array = [[[ArrayPropertyObject allObjectsInRealm:realm] firstObject] intArray];\n        [array removeAllObjects];\n    });\n}\n\n- (void)testDeleteArray {\n    ExpectChange(self, @[@0, @1, @2, @3], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[ArrayPropertyObject allObjectsInRealm:realm]];\n    });\n}\n\n- (void)testDeleteAlreadyEmptyArray {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm transactionWithBlock:^{\n        [ArrayPropertyObject createInRealm:realm withValue:@[]];\n    }];\n    RLMArray *array = [[ArrayPropertyObject allObjectsInRealm:realm].firstObject intArray];\n    __block RLMCollectionChange *changes;\n    __block int calls = 0;\n    id token = [array addNotificationBlock:^(RLMArray *results, RLMCollectionChange *c, NSError *error) {\n        XCTAssertNotNil(results);\n        XCTAssertNil(error);\n        changes = c;\n        ++calls;\n        CFRunLoopStop(CFRunLoopGetCurrent());\n    }];\n    CFRunLoopRun();\n\n    [self waitForNotification:RLMRealmDidChangeNotification realm:realm block:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            [realm deleteObjects:[ArrayPropertyObject allObjectsInRealm:realm]];\n        }];\n    }];\n\n    [(RLMNotificationToken *)token invalidate];\n    XCTAssertEqual(calls, 1);\n}\n\n- (void)testModifyObjectShiftedByInsertsAndDeletions {\n    ExpectChange(self, @[@1], @[], @[@2], ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 2\"]];\n        [[IntObject objectsInRealm:realm where:@\"intCol = 3\"] setValue:@4 forKey:@\"intCol\"];\n    });\n    ExpectChange(self, @[], @[@0], @[@3], ^(RLMRealm *realm) {\n        RLMArray *array = [[[ArrayPropertyObject allObjectsInRealm:realm] firstObject] intArray];\n        [array insertObject:[IntObject createInRealm:realm withValue:@[@3]] atIndex:0];\n        [[IntObject objectsInRealm:realm where:@\"intCol = 4\"] setValue:@3 forKey:@\"intCol\"];\n    });\n}\n@end\n\n@interface LinkViewSetChangesetTests : RLMTestCase <ChangesetTestCase>\n@end\n\n@implementation LinkViewSetChangesetTests\n- (void)prepare {\n    @autoreleasepool {\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            [realm deleteAllObjects];\n            for (int i = 0; i < 10; ++i) {\n                [IntObject createInDefaultRealmWithValue:@[@(i)]];\n            }\n            [SetPropertyObject createInDefaultRealmWithValue:@[@\"\", @[], [IntObject allObjectsInRealm:realm]]];\n        }];\n    }\n}\n\n- (RLMResults *)query {\n    return [[[SetPropertyObject.allObjects firstObject] intSet]\n            objectsWhere:@\"intCol > 0 AND intCol < 5\"];\n}\n\n- (void)testDeleteMultiple {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol > 4\"]];\n    });\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol > 5\"]];\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 0\"]];\n    });\n\n    ExpectChange(self, @[@1, @2, @3], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol > 1\"]];\n    });\n    ExpectChange(self, @[@1, @2, @3], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 2\"]];\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 3\"]];\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 4\"]];\n    });\n    ExpectChange(self, @[@1, @2, @3], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 4\"]];\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 3\"]];\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 2\"]];\n    });\n\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol > 4\"]];\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol < 1\"]];\n    });\n}\n\n- (void)testModifyObjectMatchingQuery {\n    ExpectChange(self, @[], @[], @[@2], ^(RLMRealm *realm) {\n        [[IntObject objectsInRealm:realm where:@\"intCol = 3\"] setValue:@4 forKey:@\"intCol\"];\n    });\n}\n\n- (void)testModifyObjectToNoLongerMatchQuery {\n    ExpectChange(self, @[@2], @[], @[], ^(RLMRealm *realm) {\n        [[IntObject objectsInRealm:realm where:@\"intCol = 3\"] setValue:@5 forKey:@\"intCol\"];\n    });\n}\n\n- (void)testModifyObjectNotMatchingQuery {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [[IntObject objectsInRealm:realm where:@\"intCol = 5\"] setValue:@6 forKey:@\"intCol\"];\n    });\n}\n\n- (void)testModifyObjectToMatchQuery {\n    ExpectChange(self, @[], @[@4], @[], ^(RLMRealm *realm) {\n        [[IntObject objectsInRealm:realm where:@\"intCol = 5\"] setValue:@4 forKey:@\"intCol\"];\n    });\n}\n\n- (void)testDeleteObjectMatchingQuery {\n    ExpectChange(self, @[@0], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 1\"]];\n    });\n    ExpectChange(self, @[@3], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 4\"]];\n    });\n}\n\n- (void)testDeleteNonMatchingBeforeMatches {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 0\"]];\n    });\n}\n\n- (void)testDeleteNonMatchingAfterMatches {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 5\"]];\n    });\n}\n\n- (void)testMoveMatchingObjectDueToDeletionOfNonMatchingObject {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        // Make a matching object be the last row\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol >= 5\"]];\n        // Delete a non-last, non-match row so that a matched row is moved\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 0\"]];\n    });\n}\n\n- (void)testNonMatchingObjectMovedToIndexOfMatchingRowAndMadeMatching {\n    ExpectChange(self, @[@1], @[@3], @[], ^(RLMRealm *realm) {\n        // Make the last object match the query\n        [[[IntObject allObjectsInRealm:realm] lastObject] setIntCol:3];\n        // Move the now-matching object over a previously matching object\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 2\"]];\n    });\n}\n\n- (void)testDeleteNewlyInsertedRowMatchingQuery {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        RLMSet *set = [[[SetPropertyObject allObjectsInRealm:realm] firstObject] intSet];\n        [set addObject:[IntObject createInRealm:realm withValue:@[@3]]];\n        [realm deleteObject:[IntObject allObjectsInRealm:realm].lastObject];\n    });\n}\n\n- (void)testInsertObjectMatchingQuery {\n    ExpectChange(self, @[], @[@4], @[], ^(RLMRealm *realm) {\n        RLMSet *set = [[[SetPropertyObject allObjectsInRealm:realm] firstObject] intSet];\n        [set addObject:[IntObject createInRealm:realm withValue:@[@3]]];\n    });\n}\n\n- (void)testInsertObjectNotMatchingQuery {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        RLMSet *set = [[[SetPropertyObject allObjectsInRealm:realm] firstObject] intSet];\n        [set addObject:[IntObject createInRealm:realm withValue:@[@5]]];\n    });\n}\n\n- (void)testInsertBothMatchingAndNonMatching {\n    ExpectChange(self, @[], @[@4], @[], ^(RLMRealm *realm) {\n        RLMSet *set = [[[SetPropertyObject allObjectsInRealm:realm] firstObject] intSet];\n        [set addObject:[IntObject createInRealm:realm withValue:@[@5]]];\n        [set addObject:[IntObject createInRealm:realm withValue:@[@3]]];\n    });\n}\n\n- (void)testInsertMultipleMatching {\n    ExpectChange(self, @[], @[@4, @5], @[], ^(RLMRealm *realm) {\n        RLMSet *set = [[[SetPropertyObject allObjectsInRealm:realm] firstObject] intSet];\n        [set addObject:[IntObject createInRealm:realm withValue:@[@5]]];\n        [set addObject:[IntObject createInRealm:realm withValue:@[@3]]];\n        [set addObject:[IntObject createInRealm:realm withValue:@[@5]]];\n        [set addObject:[IntObject createInRealm:realm withValue:@[@2]]];\n    });\n}\n\n- (void)testRemoveFromSet {\n    ExpectChange(self, @[@0], @[], @[], ^(RLMRealm *realm) {\n        RLMSet *set = [[[SetPropertyObject allObjectsInRealm:realm] firstObject] intSet];\n        [set removeObject:set.allObjects[1]];\n    });\n\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        RLMSet *set = [[[SetPropertyObject allObjectsInRealm:realm] firstObject] intSet];\n        [set removeObject:set.allObjects[0]];\n    });\n}\n\n- (void)testClearSet {\n    ExpectChange(self, @[@0, @1, @2, @3], @[], @[], ^(RLMRealm *realm) {\n        RLMSet *set = [[[SetPropertyObject allObjectsInRealm:realm] firstObject] intSet];\n        [set removeAllObjects];\n    });\n}\n\n- (void)testDeleteSet {\n    ExpectChange(self, @[@0, @1, @2, @3], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[SetPropertyObject allObjectsInRealm:realm]];\n    });\n}\n\n- (void)testModifyObjectShiftedByInsertsAndDeletions {\n    ExpectChange(self, @[@0, @1], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[IntObject objectsInRealm:realm where:@\"intCol = 2\"]];\n        [[IntObject objectsInRealm:realm where:@\"intCol = 1\"] setValue:@10 forKey:@\"intCol\"];\n    });\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [[IntObject objectsInRealm:realm where:@\"intCol = 9\"] setValue:@11 forKey:@\"intCol\"];\n    });\n}\n@end\n\n@interface DictionaryChangesetTests : RLMTestCase <ChangesetTestCase>\n@end\n\n@implementation DictionaryChangesetTests\n- (void)prepare {\n    @autoreleasepool {\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            DictionaryPropertyObject *dictObj = [DictionaryPropertyObject new];\n            [realm deleteAllObjects];\n            for (int i = 0; i < 10; ++i) {\n                IntObject *intObject = [IntObject createInDefaultRealmWithValue:@[@(i)]];\n                NSString *key = [NSString stringWithFormat:@\"key%d\", i];\n                [dictObj.intObjDictionary setObject:intObject forKey:key];\n            }\n            [realm addObject:dictObj];\n        }];\n    }\n}\n\n- (RLMResults *)query {\n    return [[[DictionaryPropertyObject.allObjects firstObject] intObjDictionary]\n            objectsWhere:@\"intCol > 0 AND intCol < 5\"];\n}\n\n- (void)testDeleteNewlyInsertedRowMatchingQuery {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        RLMDictionary *dictionary = [[[DictionaryPropertyObject allObjectsInRealm:realm] firstObject] intObjDictionary];\n        dictionary[@\"anotherKey\"] = [IntObject createInRealm:realm withValue:@[@3]];\n        [realm deleteObject:[IntObject allObjectsInRealm:realm].lastObject];\n    });\n}\n\n- (void)testInsertObjectMatchingQuery {\n    ExpectChange(self, @[], @[@0], @[], ^(RLMRealm *realm) {\n        RLMDictionary *dictionary = [[[DictionaryPropertyObject allObjectsInRealm:realm] firstObject] intObjDictionary];\n        dictionary[@\"key\"] = [IntObject createInRealm:realm withValue:@[@3]];\n    });\n}\n\n- (void)testInsertObjectNotMatchingQuery {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        RLMDictionary *dictionary = [[[DictionaryPropertyObject allObjectsInRealm:realm] firstObject] intObjDictionary];\n        dictionary[@\"key\"] = [IntObject createInRealm:realm withValue:@[@5]];\n    });\n}\n\n- (void)testInsertBothMatchingAndNonMatching {\n    ExpectChange(self, @[], @[@4], @[], ^(RLMRealm *realm) {\n        RLMDictionary *dictionary = [[[DictionaryPropertyObject allObjectsInRealm:realm] firstObject] intObjDictionary];\n        dictionary[@\"keyA\"] = [IntObject createInRealm:realm withValue:@[@5]];\n        dictionary[@\"keyB\"] = [IntObject createInRealm:realm withValue:@[@3]];\n    });\n}\n\n- (void)testInsertMultipleMatching {\n    ExpectChange(self, @[], @[@4, @5], @[], ^(RLMRealm *realm) {\n        RLMDictionary *dictionary = [[[DictionaryPropertyObject allObjectsInRealm:realm] firstObject] intObjDictionary];\n        dictionary[@\"keyA\"] = [IntObject createInRealm:realm withValue:@[@5]];\n        dictionary[@\"keyB\"] = [IntObject createInRealm:realm withValue:@[@3]];\n        dictionary[@\"keyC\"] = [IntObject createInRealm:realm withValue:@[@5]];\n        dictionary[@\"keyD\"] = [IntObject createInRealm:realm withValue:@[@2]];\n    });\n}\n\n- (void)testRemoveFromDictionary {\n    ExpectChange(self, @[@0], @[], @[], ^(RLMRealm *realm) {\n        RLMDictionary *dictionary = [[[DictionaryPropertyObject allObjectsInRealm:realm] firstObject] intObjDictionary];\n        [dictionary removeObjectForKey:@\"key1\"];\n    });\n\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        RLMDictionary *dictionary = [[[DictionaryPropertyObject allObjectsInRealm:realm] firstObject] intObjDictionary];\n        [dictionary removeObjectForKey:@\"key0\"];\n    });\n}\n\n- (void)testClearDictionary {\n    ExpectChange(self, @[@0, @1, @2, @3], @[], @[], ^(RLMRealm *realm) {\n        RLMDictionary *dictionary = [[[DictionaryPropertyObject allObjectsInRealm:realm] firstObject] intObjDictionary];\n        [dictionary removeAllObjects];\n    });\n}\n\n- (void)testDeleteDictionary {\n    ExpectChange(self, @[@0, @1, @2, @3], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[DictionaryPropertyObject allObjectsInRealm:realm]];\n    });\n}\n\n@end\n\n@interface LinkedObjectChangesetTests : RLMTestCase <ChangesetTestCase>\n@end\n\n@implementation LinkedObjectChangesetTests\n- (void)prepare {\n    @autoreleasepool {\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            [realm deleteAllObjects];\n            for (int i = 0; i < 5; ++i) {\n                [LinkStringObject createInRealm:realm\n                                      withValue:@[[StringObject createInRealm:realm\n                                                                    withValue:@[@\"\"]]]];\n            }\n        }];\n    }\n}\n\n- (RLMResults *)query {\n    return LinkStringObject.allObjects;\n}\n\n- (void)testDeleteLinkedObject {\n    ExpectChange(self, @[], @[], @[@3], ^(RLMRealm *realm) {\n        [realm deleteObject:[StringObject allObjectsInRealm:realm][3]];\n    });\n}\n\n- (void)testModifyLinkedObject {\n    ExpectChange(self, @[], @[], @[@3], ^(RLMRealm *realm) {\n        [[StringObject allObjectsInRealm:realm][3] setStringCol:@\"a\"];\n    });\n}\n\n- (void)testInsertUnlinkedObject {\n    ExpectNoChange(self, ^(RLMRealm *realm) {\n        [StringObject createInRealm:realm withValue:@[@\"\"]];\n    });\n}\n\n- (void)testTableClearFollowedByInsertsAndDeletes {\n    ExpectChange(self, @[], @[], @[@0, @1, @2, @3, @4], ^(RLMRealm *realm) {\n        [realm deleteObjects:[StringObject allObjectsInRealm:realm]];\n        [StringObject createInRealm:realm withValue:@[@\"\"]];\n        [realm deleteObject:[StringObject createInRealm:realm withValue:@[@\"\"]]];\n    });\n}\n@end\n\n@interface LinkingObjectsChangesetTests : RLMTestCase <ChangesetTestCase>\n@end\n\n@implementation LinkingObjectsChangesetTests\n- (void)prepare {\n    @autoreleasepool {\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            [realm deleteAllObjects];\n            PersonObject *child = [PersonObject createInDefaultRealmWithValue:@[ @\"Child\", @0 ]];\n            for (int i = 0; i < 10; ++i) {\n                // It takes a village to raise a child…\n                NSString *name = [NSString stringWithFormat:@\"Parent %d\", i];\n                [PersonObject createInDefaultRealmWithValue:@[ name, @(25 + i), @[ child ]]];\n            }\n        }];\n    }\n}\n\n- (RLMResults *)query {\n    return [[PersonObject.allObjects firstObject] parents];\n}\n\n- (void)testDeleteOneLinkingObject {\n    ExpectChange(self, @[@5, @9], @[@5], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[PersonObject objectsInRealm:realm where:@\"age == 30\"]];\n    });\n}\n\n- (void)testDeleteSomeLinkingObjects {\n    ExpectChange(self, @[@2, @7, @8, @9], @[@2], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[PersonObject objectsInRealm:realm where:@\"age > 32\"]];\n        [realm deleteObjects:[PersonObject objectsInRealm:realm where:@\"age == 27\"]];\n    });\n}\n\n- (void)testDeleteAllLinkingObjects {\n    ExpectChange(self, @[@0, @1, @2, @3, @4, @5, @6, @7, @8, @9], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[PersonObject objectsInRealm:realm where:@\"age > 20\"]];\n    });\n}\n\n- (void)testDeleteAll {\n    ExpectChange(self, @[@0, @1, @2, @3, @4, @5, @6, @7, @8, @9], @[], @[], ^(RLMRealm *realm) {\n        [realm deleteObjects:[PersonObject allObjectsInRealm:realm]];\n    });\n}\n\n- (void)testUnlinkOne {\n    ExpectChange(self, @[@4, @9], @[@4], @[], ^(RLMRealm *realm) {\n        PersonObject *parent = [[PersonObject objectsInRealm:realm where:@\"age == 29\"] firstObject];\n        [parent.children removeAllObjects];\n    });\n}\n\n- (void)testUnlinkAll {\n    ExpectChange(self, @[@0, @1, @2, @3, @4, @5, @6, @7, @8, @9], @[], @[], ^(RLMRealm *realm) {\n        for (PersonObject *parent in [PersonObject objectsInRealm:realm where:@\"age > 20\"])\n            [parent.children removeAllObjects];\n    });\n}\n\n- (void)testAddNewParent {\n    ExpectChange(self, @[], @[@10], @[], ^(RLMRealm *realm) {\n        PersonObject *child = [[PersonObject objectsInRealm:realm where:@\"children.@count == 0\"] firstObject];\n        [PersonObject createInDefaultRealmWithValue:@[ @\"New parent\", @40, @[ child ]]];\n    });\n}\n\n- (void)testAddDuplicateParent {\n    ExpectChange(self, @[], @[@10], @[@7], ^(RLMRealm *realm) {\n        PersonObject *parent = [[PersonObject objectsInRealm:realm where:@\"age == 32\"] firstObject];\n        [parent.children addObject:[parent.children firstObject]];\n    });\n}\n\n- (void)testModifyParent {\n    ExpectChange(self, @[], @[], @[@3], ^(RLMRealm *realm) {\n        PersonObject *parent = [[PersonObject objectsInRealm:realm where:@\"age == 28\"] firstObject];\n        parent.age = parent.age + 1;\n    });\n}\n\n@end\n\n@interface AllTypesWithPrimaryKey : RLMObject\n@property BOOL          boolCol;\n@property int           intCol;\n@property float         floatCol;\n@property double        doubleCol;\n@property NSString     *stringCol;\n@property NSData       *binaryCol;\n@property NSDate       *dateCol;\n@property bool          cBoolCol;\n@property int64_t       longCol;\n@property RLMObjectId  *objectIdCol;\n@property RLMDecimal128 *decimalCol;\n@property StringObject *objectCol;\n@property NSUUID *uuidCol;\n@property id<RLMValue> anyCol;\n@property MixedObject *mixedObjectCol;\n\n@property (nonatomic) int pk;\n@end\n@implementation AllTypesWithPrimaryKey\n+ (NSString *)primaryKey { return @\"pk\"; }\n@end\n\n// clang thinks the tests below have retain cycles because `_obj` could retain\n// the block passed to addNotificationBlock (but it doesn't)\n#pragma clang diagnostic ignored \"-Warc-retain-cycles\"\n\n@interface ObjectNotifierTests : RLMTestCase\n@end\n\n@implementation ObjectNotifierTests {\n    NSDictionary *_initialValues;\n    NSDictionary *_values;\n    NSArray<NSString *> *_propertyNames;\n    AllTypesObject *_obj;\n}\n\n- (void)setUp {\n    StringObject *so = [[StringObject alloc] init];\n    so.stringCol = @\"string\";\n    MixedObject *mo = [[MixedObject alloc] init];\n    mo.anyCol = @\"string\";\n    _initialValues = [AllTypesObject values:1 stringObject:nil mixedObject:nil];\n    _values = [AllTypesObject values:2 stringObject:so mixedObject:mo];\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    _obj = [AllTypesObject createInRealm:realm withValue:_initialValues];\n    [realm commitWriteTransaction];\n\n    _propertyNames = [_obj.objectSchema.properties valueForKey:@\"name\"];\n}\n\n- (void)tearDown {\n    _values = nil;\n    _initialValues = nil;\n    _obj = nil;\n    [super tearDown];\n}\n\n- (void)testObserveUnmanagedObject {\n    AllTypesObject *unmanagedObj = [[AllTypesObject alloc] init];\n    XCTAssertThrows([unmanagedObj addNotificationBlock:^(__unused BOOL deletd,\n                                                         __unused NSArray<RLMPropertyChange *> *changes,\n                                                         __unused NSError *error) {}]);\n    XCTAssertThrows([unmanagedObj addNotificationBlock:^(__unused BOOL deletd,\n                                                         __unused NSArray<RLMPropertyChange *> *changes,\n                                                         __unused NSError *error) {} keyPaths:@[@\"boolCol\"]]);\n}\n\n- (void)testDeleteObservedObject {\n    XCTestExpectation *expectation0 = [self expectationWithDescription:@\"delete observed object\"];\n    XCTestExpectation *expectation1 = [self expectationWithDescription:@\"delete observed object\"];\n\n    RLMNotificationToken *token0 = [_obj addNotificationBlock:^(BOOL deleted, NSArray *changes, NSError *error) {\n        XCTAssertTrue(deleted);\n        XCTAssertNil(error);\n        XCTAssertNil(changes);\n        [expectation0 fulfill];\n    }];\n    RLMNotificationToken *token1 = [_obj addNotificationBlock:^(BOOL deleted, NSArray *changes, NSError *error) {\n        XCTAssertTrue(deleted);\n        XCTAssertNil(error);\n        XCTAssertNil(changes);\n        [expectation1 fulfill];\n    } keyPaths:@[@\"boolCol\"]];\n\n    RLMRealm *realm = _obj.realm;\n    [realm beginWriteTransaction];\n    [realm deleteObject:_obj];\n    [realm commitWriteTransaction];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [token0 invalidate];\n    [token1 invalidate];\n}\n\n- (void)testChangeAllPropertyTypes {\n    __block NSString *property;\n    __block XCTestExpectation *expectation = nil;\n    RLMNotificationToken *token = [_obj addNotificationBlock:^(BOOL deleted, NSArray *changes, NSError *error) {\n        XCTAssertFalse(deleted);\n        XCTAssertNil(error);\n        XCTAssertEqual(changes.count, 1U);\n        RLMPropertyChange *prop = changes[0];\n        XCTAssertEqualObjects(prop.name, property);\n        XCTAssertNil(prop.previousValue);\n        if ([prop.name isEqualToString:@\"objectCol\"]) {\n            XCTAssertTrue([prop.value isEqualToObject:_values[property]],\n                          @\"%@: %@ %@\", property, prop.value, _values[property]);\n        }\n        else if ([prop.name isEqualToString:@\"mixedObjectCol\"]) {\n            XCTAssertEqualObjects(((MixedObject *)prop.value).anyCol,\n                                  ((MixedObject *)_values[property]).anyCol);\n        }\n        else {\n            XCTAssertEqualObjects(prop.value, _values[property]);\n        }\n\n        [expectation fulfill];\n    }];\n\n    for (property in _propertyNames) {\n        expectation = [self expectationWithDescription:@\"\"];\n\n        [_obj.realm beginWriteTransaction];\n        _obj[property] = _values[property];\n        [_obj.realm commitWriteTransaction];\n\n        [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    }\n    [token invalidate];\n}\n\n- (void)testChangeAllPropertyTypesFromBackground {\n    __block NSString *propertyName;\n    __block RLMThreadSafeReference *mixedObject;\n    RLMNotificationToken *token = [_obj addNotificationBlock:^(BOOL deleted, NSArray *changes, NSError *error) {\n        XCTAssertFalse(deleted);\n        XCTAssertNil(error);\n        XCTAssertEqual(changes.count, 1U);\n        RLMPropertyChange *prop = changes[0];\n        XCTAssertEqualObjects(prop.name, propertyName);\n        if ([prop.name isEqualToString:@\"objectCol\"]) {\n            XCTAssertNil(prop.previousValue);\n            XCTAssertNotNil(prop.value);\n        }\n        else if ([prop.name isEqualToString:@\"mixedObjectCol\"]) {\n            XCTAssertNil(prop.previousValue);\n            RLMRealm *realm = [RLMRealm defaultRealm];\n            MixedObject *mo = [realm resolveThreadSafeReference:mixedObject];\n            XCTAssertEqualObjects(((MixedObject *)prop.value).anyCol,\n                                  mo.anyCol);\n        }\n        else {\n            XCTAssertEqualObjects(prop.previousValue, _initialValues[prop.name]);\n            XCTAssertEqualObjects(prop.value, _values[prop.name]);\n        }\n    }];\n\n    for (propertyName in _propertyNames) {\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *realm = [RLMRealm defaultRealm];\n            AllTypesObject *obj = [[AllTypesObject allObjectsInRealm:realm] firstObject];\n            [realm beginWriteTransaction];\n            obj[propertyName] = _values[propertyName];\n            if ([propertyName isEqualToString:@\"mixedObjectCol\"]) {\n                mixedObject = [RLMThreadSafeReference referenceWithThreadConfined:_values[@\"mixedObjectCol\"]];\n            }\n            [realm commitWriteTransaction];\n        }];\n        [_obj.realm refresh];\n    }\n    [token invalidate];\n}\n\n- (void)testChangeAllPropertyTypesInSingleTransaction {\n    XCTestExpectation *expectation = [self expectationWithDescription:@\"\"];\n    RLMNotificationToken *token = [_obj addNotificationBlock:^(BOOL deleted, NSArray *changes, NSError *error) {\n        XCTAssertFalse(deleted);\n        XCTAssertNil(error);\n        XCTAssertEqual(changes.count, _values.count);\n\n        NSUInteger i = 0;\n        for (RLMPropertyChange *prop in changes) {\n            XCTAssertEqualObjects(prop.name, _propertyNames[i]);\n            if ([prop.name isEqualToString:@\"objectCol\"]) {\n                XCTAssertTrue([prop.value isEqualToObject:_values[prop.name]]);\n            }\n            else if ([prop.name isEqualToString:@\"mixedObjectCol\"]) {\n                XCTAssertEqualObjects(((MixedObject *)prop.value).anyCol,\n                                      ((MixedObject *)_values[prop.name]).anyCol);\n            }\n            else {\n                XCTAssertEqualObjects(prop.value, _values[prop.name]);\n            }\n            ++i;\n        }\n        [expectation fulfill];\n    }];\n\n    [_obj.realm beginWriteTransaction];\n    for (NSString *propertyName in _propertyNames) {\n        _obj[propertyName] = _values[propertyName];\n    }\n    [_obj.realm commitWriteTransaction];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [token invalidate];\n}\n\n- (void)testMultipleObjectNotifiers {\n    [_obj.realm beginWriteTransaction];\n    AllTypesObject *obj2 = [AllTypesObject createInRealm:_obj.realm withValue:_obj];\n    [_obj.realm commitWriteTransaction];\n\n    XCTestExpectation *expectation = [self expectationWithDescription:@\"\"];\n    __block NSUInteger calls = 0;\n    id block = ^(BOOL deleted, NSArray<RLMPropertyChange *> *changes, NSError *error) {\n        XCTAssertFalse(deleted);\n        XCTAssertNil(error);\n        XCTAssertEqual(changes.count, 1U);\n        XCTAssertEqualObjects(changes[0].name, @\"intCol\");\n        XCTAssertEqualObjects(changes[0].previousValue, @1);\n        XCTAssertEqualObjects(changes[0].value, @2);\n        if (++calls == 2) {\n            [expectation fulfill];\n        }\n    };\n    RLMNotificationToken *token1 = [_obj addNotificationBlock:block];\n    RLMNotificationToken *token2 = [_obj addNotificationBlock:block];\n    RLMNotificationToken *token3 = [obj2 addNotificationBlock:^(__unused BOOL deletd,\n                                                                __unused NSArray<RLMPropertyChange *> *changes,\n                                                                __unused NSError *error) {\n        XCTFail(@\"notification block for wrong object called\");\n    }];\n\n    // Ensure initial notification is processed so that the change can report previousValue\n    [_obj.realm transactionWithBlock:^{}];\n\n    [self dispatchAsync:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        AllTypesObject *obj = [[AllTypesObject allObjectsInRealm:realm] firstObject];\n        [realm beginWriteTransaction];\n        obj.intCol = 2;\n        [realm commitWriteTransaction];\n    }];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [token1 invalidate];\n    [token2 invalidate];\n    [token3 invalidate];\n}\n\n- (void)testArrayPropertiesMerelyReportModification {\n    [_obj.realm beginWriteTransaction];\n    ArrayOfAllTypesObject *array = [ArrayOfAllTypesObject createInRealm:_obj.realm withValue:@[@[]]];\n    [_obj.realm commitWriteTransaction];\n\n    XCTestExpectation *expectation = [self expectationWithDescription:@\"\"];\n    RLMNotificationToken *token = [array addNotificationBlock:^(BOOL deleted, NSArray<RLMPropertyChange *> *changes, NSError *error) {\n        XCTAssertFalse(deleted);\n        XCTAssertNil(error);\n        XCTAssertEqual(changes.count, 1U);\n\n        XCTAssertEqualObjects(changes[0].name, @\"array\");\n        XCTAssertNil(changes[0].previousValue);\n        XCTAssertNil(changes[0].value);\n        [expectation fulfill];\n    }];\n\n    [self dispatchAsync:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        ArrayOfAllTypesObject *obj = [[ArrayOfAllTypesObject allObjectsInRealm:realm] firstObject];\n        [realm beginWriteTransaction];\n        [obj.array addObject:[[AllTypesObject allObjectsInRealm:realm] firstObject]];\n        [realm commitWriteTransaction];\n    }];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [token invalidate];\n}\n\n- (void)testDiffedUpdatesOnlyNotifyForPropertiesWhichActuallyChanged {\n    NSMutableDictionary *values = [_initialValues mutableCopy];\n    values[@\"pk\"] = @1;\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    [realm addObject:_values[@\"objectCol\"]];\n    AllTypesWithPrimaryKey *obj = [AllTypesWithPrimaryKey createInRealm:realm withValue:values];\n    [realm commitWriteTransaction];\n\n    __block NSString *propertyName;\n    __block XCTestExpectation *expectation = nil;\n    RLMNotificationToken *token = [obj addNotificationBlock:^(BOOL deleted, NSArray *changes, NSError *error) {\n        XCTAssertFalse(deleted);\n        XCTAssertNil(error);\n        XCTAssertEqual(changes.count, 1U);\n        RLMPropertyChange *prop = changes[0];\n        XCTAssertEqualObjects(prop.name, propertyName);\n        XCTAssertNil(prop.previousValue);\n        if ([prop.name isEqualToString:@\"objectCol\"]) {\n            XCTAssertTrue([prop.value isEqualToObject:_values[prop.name]],\n                          @\"%@: %@ %@\", prop.name, prop.value, _values[prop.name]);\n        }\n        else if ([prop.name isEqualToString:@\"mixedObjectCol\"]) {\n            XCTAssertEqualObjects(((MixedObject *)prop.value).anyCol,\n                                  ((MixedObject *)_values[prop.name]).anyCol);\n        }\n        else {\n            XCTAssertEqualObjects(prop.value, _values[prop.name]);\n        }\n\n        [expectation fulfill];\n    }];\n\n\n    for (propertyName in _propertyNames) {\n        expectation = [self expectationWithDescription:propertyName];\n\n        [realm beginWriteTransaction];\n        values[propertyName] = _values[propertyName];\n        [AllTypesWithPrimaryKey createOrUpdateModifiedInRealm:realm withValue:values];\n        [realm commitWriteTransaction];\n\n        [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    }\n    [token invalidate];\n}\n\n#pragma mark - Object Notification Key Path Filtering\n\n- (void)testModifyObservedKeyPathLocally {\n    XCTestExpectation *ex = [self expectationWithDescription:@\"change notification\"];\n    RLMNotificationToken *token = [_obj addNotificationBlock:^(BOOL deleted, NSArray *changes, NSError *error) {\n        XCTAssertFalse(deleted);\n        XCTAssertNil(error);\n        XCTAssertEqual(changes.count, 1U);\n        RLMPropertyChange *prop = changes[0];\n        XCTAssertEqualObjects(prop.name, @\"boolCol\");\n        [ex fulfill];\n    } keyPaths:@[@\"boolCol\"]];\n\n    [_obj.realm beginWriteTransaction];\n    XCTAssertNotEqual(_obj.boolCol, [_values[@\"boolCol\"] boolValue]);\n    _obj.boolCol = [_values[@\"boolCol\"] boolValue];\n    [_obj.realm commitWriteTransaction];\n    [self waitForExpectationsWithTimeout:0.1 handler:nil];\n\n    [token invalidate];\n}\n\n- (void)testModifyUnobservedKeyPathLocally {\n    XCTestExpectation *ex = [self expectationWithDescription:@\"no change notification\"];\n    ex.inverted = true;\n    RLMNotificationToken *token = [_obj addNotificationBlock:^(__unused BOOL deletd,\n                                                               __unused NSArray<RLMPropertyChange *> *changes,\n                                                               __unused NSError *error) {\n        [ex fulfill];\n    } keyPaths:@[@\"boolCol\"]];\n\n    [_obj.realm beginWriteTransaction];\n    _obj.intCol = _obj.intCol + _obj.intCol;\n    [_obj.realm commitWriteTransaction];\n    [self waitForExpectationsWithTimeout:0.1 handler:nil];\n\n    [token invalidate];\n}\n\n- (void)testModifyObservedKeyPathRemotely {\n    XCTestExpectation *ex = [self expectationWithDescription:@\"change notification\"];\n    RLMNotificationToken *token = [_obj addNotificationBlock:^(BOOL deleted, NSArray *changes, NSError *error) {\n        XCTAssertFalse(deleted);\n        XCTAssertNil(error);\n        XCTAssertEqual(changes.count, 1U);\n        RLMPropertyChange *prop = changes[0];\n        XCTAssertEqualObjects(prop.name, @\"boolCol\");\n        [ex fulfill];\n    } keyPaths:@[@\"boolCol\"]];\n\n    [self dispatchAsync:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        AllTypesObject *obj = [[AllTypesObject allObjectsInRealm:realm] firstObject];\n        [realm beginWriteTransaction];\n        XCTAssertNotEqual(obj.boolCol, [_values[@\"boolCol\"] boolValue]);\n        obj.boolCol = [_values[@\"boolCol\"] boolValue];\n        [realm commitWriteTransaction];\n    }];\n    [self waitForExpectationsWithTimeout:0.1 handler:nil];\n\n    [token invalidate];\n}\n\n- (void)testModifyUnobservedKeyPathRemotely {\n    XCTestExpectation *ex = [self expectationWithDescription:@\"no change notification\"];\n    ex.inverted = true;\n\n    RLMNotificationToken *token = [_obj addNotificationBlock:^(__unused BOOL deletd,\n                                                               __unused NSArray<RLMPropertyChange *> *changes,\n                                                               __unused NSError *error) {\n        [ex fulfill];\n    } keyPaths:@[@\"boolCol\"]];\n\n    [self dispatchAsync:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        AllTypesObject *obj = [[AllTypesObject allObjectsInRealm:realm] firstObject];\n        [realm beginWriteTransaction];\n        obj.intCol = obj.intCol + obj.intCol;\n        [realm commitWriteTransaction];\n    }];\n    [self waitForExpectationsWithTimeout:0.1 handler:nil];\n\n    [token invalidate];\n}\n\n- (void)testModifyObservedKeyPathArrayProperty {\n    XCTestExpectation *ex = [self expectationWithDescription:@\"change notification\"];\n\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n    CompanyObject *company = [CompanyObject createInRealm:realm withValue:@{}];\n    EmployeeObject *employee = [EmployeeObject createInRealm:realm withValue:@{@\"age\": @30, @\"hired\": @NO}];\n    [company.employees addObject:employee];\n    [realm commitWriteTransaction];\n\n    RLMNotificationToken *token = [company addNotificationBlock:^(BOOL deleted, NSArray *changes, NSError *error) {\n        XCTAssertFalse(deleted);\n        XCTAssertNil(error);\n        XCTAssertEqual(changes.count, 1U);\n\n        for (RLMPropertyChange *prop in changes) {\n            XCTAssertEqualObjects(prop.name, @\"employees\");\n            XCTAssertFalse(prop.previousValue);\n            XCTAssertFalse(prop.value); // Observing an array will lead to nil here.\n        }\n        [ex fulfill];\n    } keyPaths:@[@\"employees.hired\"]];\n\n    [realm beginWriteTransaction];\n    employee.hired = true;\n    [realm commitWriteTransaction];\n    [self waitForExpectationsWithTimeout:0.1 handler:nil];\n\n    [token invalidate];\n}\n\n- (void)testModifyUnobservedKeyPathArrayProperty {\n    XCTestExpectation *ex = [self expectationWithDescription:@\"no change notification\"];\n    ex.inverted = true;\n\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n    CompanyObject *company = [CompanyObject createInRealm:realm withValue:@{}];\n    EmployeeObject *employee = [EmployeeObject createInRealm:realm withValue:@{@\"age\": @30, @\"hired\": @NO}];\n    [company.employees addObject:employee];\n    [realm commitWriteTransaction];\n\n    RLMNotificationToken *token = [company addNotificationBlock:^(__unused BOOL deletd,\n                                                                  __unused NSArray<RLMPropertyChange *> *changes,\n                                                                  __unused NSError *error) {\n        [ex fulfill];\n    } keyPaths:@[@\"employees.hired\"]];\n\n    [realm beginWriteTransaction];\n    employee.age = 42;\n    [realm commitWriteTransaction];\n    [self waitForExpectationsWithTimeout:0.1 handler:nil];\n\n    [token invalidate];\n}\n\n@end\n\nstatic void ExpectObjectChange(RLMTestCase<ChangesetTestCase> *self, void (^block)(RLMRealm *realm)) {\n    [self prepare];\n    RLMResults *query = [self query];\n    __block XCTestExpectation *expectation = nil;\n    RLMNotificationToken *token = [[query firstObject] addNotificationBlock:^(BOOL deleted, NSArray *changes, NSError *error) {\n        XCTAssertFalse(deleted);\n        XCTAssertNil(error);\n        XCTAssertEqual(changes.count, 1);\n        [expectation fulfill];\n    }];\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    expectation = [self expectationWithDescription:@\"collections_mixed_notifications\"];\n    [realm beginWriteTransaction];\n    block(realm);\n    [realm commitWriteTransaction];\n    [self waitForExpectationsWithTimeout:10.0 handler:nil];\n\n    [token invalidate];\n}\n\nstatic void ExpectMixedDictionaryChange(RLMTestCase<ChangesetTestCase> *self, NSArray *deletions, NSArray *insertions,\n                                        NSArray *modifications, void (^block)(RLMRealm *realm)) {\n    [self prepare];\n    MixedObject *mixedObject = [[self query] firstObject];\n    RLMDictionary *dictionary = (RLMDictionary *)mixedObject.anyCol;\n    __block XCTestExpectation *expectation = nil;\n    RLMNotificationToken *token = [dictionary addNotificationBlock:^(RLMDictionary *dictionary, RLMDictionaryChange *changes, NSError *error) {\n        XCTAssertNil(error);\n        XCTAssertNotNil(dictionary);\n        if (!changes) {\n            return;\n        }\n\n        XCTAssertEqualObjects(deletions, changes.deletions);\n        XCTAssertEqualObjects(insertions, changes.insertions);\n        XCTAssertEqualObjects(modifications, changes.modifications);\n\n        [expectation fulfill];\n    }];\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    expectation = [self expectationWithDescription:@\"collections_mixed_notifications\"];\n    [realm beginWriteTransaction];\n    block(realm);\n    [realm commitWriteTransaction];\n    [self waitForExpectationsWithTimeout:10.0 handler:nil];\n\n    [token invalidate];\n}\n\n@interface MixedDictionaryCollectionChangesetTests : RLMTestCase <ChangesetTestCase>\n@end\n\n@implementation MixedDictionaryCollectionChangesetTests\n\n- (NSDictionary *)testDictionary {\n    return @{ @\"key2\" : @\"hello2\",\n              @\"key3\" : @YES,\n              @\"key4\" : @123,\n              @\"key5\" : @456.789 };\n}\n\n- (void)prepare {\n    @autoreleasepool {\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            [realm deleteAllObjects];\n            MixedObject *mixedObject = [MixedObject new];\n            mixedObject.anyCol = [self testDictionary];\n            [realm addObject:mixedObject];\n        }];\n    }\n}\n\n- (RLMResults *)query {\n    return MixedObject.allObjects;\n}\n\n- (void)testAddToMixedObservationWithKeypath {\n    [self prepare];\n    __block XCTestExpectation *expectation = nil;\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n    RLMNotificationToken *token = [mixedObject addNotificationBlock:^(BOOL deleted, NSArray *changes, NSError *error) {\n        XCTAssertFalse(deleted);\n        XCTAssertNil(error);\n        XCTAssertEqual(changes.count, 1);\n        [expectation fulfill];\n    } keyPaths:@[ @\"anyCol\" ]];\n\n\n    expectation = [self expectationWithDescription:@\"collections_mixed_notifications\"];\n    [realm beginWriteTransaction];\n    mixedObject.anyCol = @{ @\"key2\": @987.321 };\n    [realm commitWriteTransaction];\n    [self waitForExpectationsWithTimeout:10.0 handler:nil];\n\n    [token invalidate];\n}\n\n- (void)testMixedDictionaryChangesInResults {\n    ExpectChange(self, @[], @[], @[@0], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        mixedObject.anyCol = [self testDictionary];\n    });\n\n    ExpectChange(self, @[], @[], @[@0], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        mixedObject.anyCol = @{ @\"key\": @987.321 };\n    });\n\n    ExpectChange(self, @[], @[], @[@0], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMDictionary *dict = (RLMDictionary *)mixedObject.anyCol;\n        dict[@\"key\"] = @NO;\n    });\n\n    ExpectChange(self, @[], @[], @[@0], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMDictionary *dict = (RLMDictionary *)mixedObject.anyCol;\n        dict[@\"key1\"] = @\"newvalue\";\n    });\n\n    ExpectChange(self, @[], @[], @[@0], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMDictionary *dict = (RLMDictionary *)mixedObject.anyCol;\n        [dict removeAllObjects];\n    });\n\n    ExpectChange(self, @[], @[], @[@0], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMDictionary *dict = (RLMDictionary *)mixedObject.anyCol;\n        [dict removeObjectForKey:@\"key5\"];\n    });\n}\n\n- (void)testMixedDictionaryObjectNotifications {\n    ExpectObjectChange(self, ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        mixedObject.anyCol = [self testDictionary];\n    });\n\n    ExpectObjectChange(self, ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMDictionary *dictionary = (RLMDictionary *)mixedObject.anyCol;\n        dictionary[@\"key2\"] = @NO;\n    });\n\n    ExpectObjectChange(self, ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMDictionary *dictionary = (RLMDictionary *)mixedObject.anyCol;\n        dictionary[@\"key4\"] = [NSNull null];\n    });\n\n    ExpectObjectChange(self, ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMDictionary *dictionary = (RLMDictionary *)mixedObject.anyCol;\n        [dictionary removeAllObjects];\n    });\n}\n\n- (void)testMixedDictionaryCollectionChanges {\n    ExpectMixedDictionaryChange(self, @[@\"key2\", @\"key3\", @\"key4\", @\"key5\"], @[@\"key1\", @\"key3\"], @[], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        mixedObject.anyCol = @{ @\"key1\": @YES, @\"key3\": @987.321 };\n    });\n\n    ExpectMixedDictionaryChange(self, @[], @[], @[@\"key3\"], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMDictionary *dictionary = (RLMDictionary *)mixedObject.anyCol;\n        dictionary[@\"key3\"] = @NO;\n    });\n\n    ExpectMixedDictionaryChange(self, @[@\"key4\"], @[], @[], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMDictionary *dictionary = (RLMDictionary *)mixedObject.anyCol;\n        dictionary[@\"key4\"] = nil;\n    });\n\n    ExpectMixedDictionaryChange(self, @[], @[@\"key1\"], @[], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMDictionary *dictionary = (RLMDictionary *)mixedObject.anyCol;\n        dictionary[@\"key1\"] = @345;\n    });\n\n    ExpectMixedDictionaryChange(self, @[@\"key2\"], @[], @[], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMDictionary *dictionary = (RLMDictionary *)mixedObject.anyCol;\n        [dictionary removeObjectForKey:@\"key2\"];\n    });\n\n    ExpectMixedDictionaryChange(self, @[@\"key2\", @\"key3\", @\"key4\", @\"key5\"], @[], @[], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMDictionary *dictionary = (RLMDictionary *)mixedObject.anyCol;\n        [dictionary removeAllObjects];\n    });\n}\n\n@end\n\nstatic void ExpectMixedArrayChange(RLMTestCase<ChangesetTestCase> *self, NSArray *deletions, NSArray *insertions,\n                                   NSArray *modifications, void (^block)(RLMRealm *realm)) {\n    [self prepare];\n     MixedObject *mixedObject = [[self query] firstObject];\n     RLMArray *array = (RLMArray *)mixedObject.anyCol;\n    __block XCTestExpectation *expectation = nil;\n     RLMNotificationToken *token = [array addNotificationBlock:^(RLMArray *array, RLMCollectionChange *changes, NSError *error) {\n         XCTAssertNil(error);\n         XCTAssertNotNil(array);\n         if (!changes) {\n             return;\n         }\n\n         XCTAssertEqualObjects(deletions, changes.deletions);\n         XCTAssertEqualObjects(insertions, changes.insertions);\n         XCTAssertEqualObjects(modifications, changes.modifications);\n         [expectation fulfill];\n     }];\n\n     RLMRealm *realm = [RLMRealm defaultRealm];\n     expectation = [self expectationWithDescription:@\"collections_mixed_notifications\"];\n     [realm beginWriteTransaction];\n     block(realm);\n     [realm commitWriteTransaction];\n     [self waitForExpectationsWithTimeout:10.0 handler:nil];\n\n     [token invalidate];\n }\n\n@interface MixedArrayCollectionChangesetTests : RLMTestCase <ChangesetTestCase>\n@end\n\n@implementation MixedArrayCollectionChangesetTests\n\n- (NSArray *)testArray {\n    return @[ @\"hello2\", @YES, @123, @456.789 ];\n}\n\n- (void)prepare {\n    @autoreleasepool {\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            [realm deleteAllObjects];\n            MixedObject *mixedObject = [MixedObject new];\n            mixedObject.anyCol = [self testArray];\n            [realm addObject:mixedObject];\n        }];\n    }\n}\n\n- (RLMResults *)query {\n    return MixedObject.allObjects;\n}\n\n- (void)testAddToMixedObservationWithKeypath {\n    [self prepare];\n    __block XCTestExpectation *expectation = nil;\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n    RLMNotificationToken *token = [mixedObject addNotificationBlock:^(BOOL deleted, NSArray *changes, NSError *error) {\n        XCTAssertFalse(deleted);\n        XCTAssertNil(error);\n        XCTAssertEqual(changes.count, 1);\n        [expectation fulfill];\n    } keyPaths:@[ @\"anyCol\" ]];\n\n    expectation = [self expectationWithDescription:@\"collections_mixed_notifications\"];\n    [realm beginWriteTransaction];\n    mixedObject.anyCol = @[ @987.321 ];\n    [realm commitWriteTransaction];\n    [self waitForExpectationsWithTimeout:10.0 handler:nil];\n\n    [token invalidate];\n}\n\n- (void)testMixedArrayChangesInResults {\n    ExpectChange(self, @[], @[], @[@0], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        mixedObject.anyCol = [self testArray];\n    });\n\n    ExpectChange(self, @[], @[], @[@0], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        mixedObject.anyCol = @[ @987.321 ];\n    });\n\n    ExpectChange(self, @[], @[], @[@0], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMArray *array = (RLMArray *)mixedObject.anyCol;\n        array[0] = @NO;\n    });\n\n    ExpectChange(self, @[], @[], @[@0], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMArray *array = (RLMArray *)mixedObject.anyCol;\n        [array addObject:@\"newvalue\"];\n    });\n\n    ExpectChange(self, @[], @[], @[@0], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMArray *array = (RLMArray *)mixedObject.anyCol;\n        [array insertObject:@765 atIndex:1];\n    });\n\n    ExpectChange(self, @[], @[], @[@0], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMArray *array = (RLMArray *)mixedObject.anyCol;\n        [array removeLastObject];\n    });\n\n    ExpectChange(self, @[], @[], @[@0], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMArray *array = (RLMArray *)mixedObject.anyCol;\n        [array removeAllObjects];\n    });\n}\n\n- (void)testMixedArrayObjectNotifications {\n    ExpectObjectChange(self, ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        mixedObject.anyCol = [self testArray];\n    });\n\n    ExpectObjectChange(self, ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMArray *array = (RLMArray *)mixedObject.anyCol;\n        [array addObject:@NO];\n    });\n\n    ExpectObjectChange(self, ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMArray *array = (RLMArray *)mixedObject.anyCol;\n        array[3] = @\"hey\";\n    });\n\n    ExpectObjectChange(self, ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMArray *array = (RLMArray *)mixedObject.anyCol;\n        [array removeObjectAtIndex:2];\n    });\n\n    ExpectObjectChange(self, ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMArray *array = (RLMArray *)mixedObject.anyCol;\n        [array removeAllObjects];\n    });\n}\n\n\n- (void)testMixedArrayCollectionChanges {\n    ExpectMixedArrayChange(self, @[@0, @1, @2, @3], @[@0, @1], @[], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        mixedObject.anyCol = @[ @YES, @987.321 ];\n    });\n\n    ExpectMixedArrayChange(self, @[], @[@4], @[], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMArray *array = (RLMArray *)mixedObject.anyCol;\n        [array addObject: @NO];\n    });\n\n    ExpectMixedArrayChange(self, @[], @[@1], @[], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMArray *array = (RLMArray *)mixedObject.anyCol;\n        [array insertObject:@\"hey\" atIndex:1];\n    });\n\n    ExpectMixedArrayChange(self, @[], @[], @[@0], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMArray *array = (RLMArray *)mixedObject.anyCol;\n        array[0] = [RLMObjectId objectId];\n    });\n\n    ExpectMixedArrayChange(self, @[@3], @[], @[], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMArray *array = (RLMArray *)mixedObject.anyCol;\n        [array removeLastObject];\n    });\n\n    ExpectMixedArrayChange(self, @[@0, @1, @2, @3], @[], @[], ^(RLMRealm *realm) {\n        MixedObject *mixedObject = [[MixedObject allObjectsInRealm:realm] firstObject];\n        RLMArray *array = (RLMArray *)mixedObject.anyCol;\n        [array removeAllObjects];\n    });\n}\n\n@end\n\n"
  },
  {
    "path": "Realm/Tests/ObjectCreationTests.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2017 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#pragma mark - Test Objects\n\n@interface DogExtraObject : RLMObject\n@property NSString *dogName;\n@property int age;\n@property NSString *breed;\n@end\n\n@implementation DogExtraObject\n@end\n\n@interface BizzaroDog : RLMObject\n@property int dogName;\n@property NSString *age;\n@end\n\n@implementation BizzaroDog\n@end\n\n@interface PrimaryKeyWithDefault : RLMObject\n@property NSString *stringCol;\n@property int intCol;\n@end\n@implementation PrimaryKeyWithDefault\n+ (NSString *)primaryKey {\n    return @\"stringCol\";\n}\n+ (NSDictionary *)defaultPropertyValues {\n    return @{@\"intCol\": @10};\n}\n@end\n\n@interface AllLinks : RLMObject\n@property StringObject *string;\n@property PrimaryStringObject *primaryString;\n@property RLM_GENERIC_ARRAY(IntObject) *intArray;\n@property RLM_GENERIC_ARRAY(PrimaryIntObject) *primaryIntArray;\n@property RLM_GENERIC_SET(IntObject) *intSet;\n@property RLM_GENERIC_SET(PrimaryIntObject) *primaryIntSet;\n@end\n\n@implementation AllLinks\n@end\n\n@interface AllLinksWithPrimary : RLMObject\n@property NSString *pk;\n@property StringObject *string;\n@property PrimaryStringObject *primaryString;\n@property RLM_GENERIC_ARRAY(IntObject) *intArray;\n@property RLM_GENERIC_ARRAY(PrimaryIntObject) *primaryIntArray;\n@property RLM_GENERIC_SET(IntObject) *intSet;\n@property RLM_GENERIC_SET(PrimaryIntObject) *primaryIntSet;\n@end\n\n@implementation AllLinksWithPrimary\n+ (NSString *)primaryKey {\n    return @\"pk\";\n}\n@end\n\n@interface PrimaryKeyAndRequiredString : RLMObject\n@property int pk;\n@property NSString *value;\n@end\n@implementation PrimaryKeyAndRequiredString\n+ (NSString *)primaryKey {\n    return @\"pk\";\n}\n+ (NSArray *)requiredProperties {\n    return @[@\"value\"];\n}\n@end\n\n\n#pragma mark - Tests\n\n@interface ObjectCreationTests : RLMTestCase\n@end\n\n@implementation ObjectCreationTests\n\n#pragma mark - Init With Value\n\n- (void)testInitWithInvalidThings {\n    RLMAssertThrowsWithReasonMatching([[DogObject alloc] initWithValue:self.nonLiteralNil],\n                                      @\"Must provide a non-nil value\");\n    RLMAssertThrowsWithReasonMatching([[DogObject alloc] initWithValue:NSNull.null],\n                                      @\"Must provide a non-nil value\");\n    RLMAssertThrowsWithReasonMatching([[DogObject alloc] initWithValue:@\"name\"],\n                                      @\"Invalid value 'name' to initialize object of type 'DogObject'\");\n}\n\n- (void)testInitWithArray {\n    auto co = [[CompanyObject alloc] initWithValue:@[]];\n    XCTAssertNil(co.name);\n    XCTAssertEqual(co.employees.count, 0U);\n\n    co = [[CompanyObject alloc] initWithValue:@[@\"empty company\"]];\n    XCTAssertEqualObjects(co.name, @\"empty company\");\n    XCTAssertEqual(co.employees.count, 0U);\n\n    co = [[CompanyObject alloc] initWithValue:@[@\"empty company\", NSNull.null]];\n    XCTAssertEqualObjects(co.name, @\"empty company\");\n    XCTAssertEqual(co.employees.count, 0U);\n\n    co = [[CompanyObject alloc] initWithValue:@[@\"empty company\", @[]]];\n    XCTAssertEqualObjects(co.name, @\"empty company\");\n    XCTAssertEqual(co.employees.count, 0U);\n\n    co = [[CompanyObject alloc] initWithValue:@[@\"one employee\",\n                                                @[@[@\"name\", @2, @YES]]]];\n    XCTAssertEqualObjects(co.name, @\"one employee\");\n    XCTAssertEqual(co.employees.count, 1U);\n    EmployeeObject *eo = co.employees.firstObject;\n    XCTAssertEqualObjects(eo.name, @\"name\");\n    XCTAssertEqual(eo.age, 2);\n    XCTAssertEqual(eo.hired, YES);\n\n    co = [[CompanyObject alloc] initWithValue:@[@\"one employee\", @[eo]]];\n    XCTAssertEqualObjects(co.name, @\"one employee\");\n    XCTAssertEqual(co.employees.count, 1U);\n    eo = co.employees.firstObject;\n    XCTAssertEqualObjects(eo.name, @\"name\");\n    XCTAssertEqual(eo.age, 2);\n    XCTAssertEqual(eo.hired, YES);\n}\n\n- (void)testInitWithSet {\n    auto co = [[CompanyObject alloc] initWithValue:@[]];\n    XCTAssertNil(co.name);\n    XCTAssertEqual(co.employeeSet.count, 0U);\n\n    co = [[CompanyObject alloc] initWithValue:@[@\"empty company\"]];\n    XCTAssertEqualObjects(co.name, @\"empty company\");\n    XCTAssertEqual(co.employeeSet.count, 0U);\n\n    co = [[CompanyObject alloc] initWithValue:@[@\"empty company\", NSNull.null]];\n    XCTAssertEqualObjects(co.name, @\"empty company\");\n    XCTAssertEqual(co.employeeSet.count, 0U);\n\n    co = [[CompanyObject alloc] initWithValue:@[@\"empty company\", @[]]];\n    XCTAssertEqualObjects(co.name, @\"empty company\");\n    XCTAssertEqual(co.employeeSet.count, 0U);\n\n    co = [[CompanyObject alloc] initWithValue:@[@\"one employee\",\n                                                @[@[@\"name\", @2, @YES]],\n                                                @[@[@\"name\", @2, @YES]]]];\n    XCTAssertEqualObjects(co.name, @\"one employee\");\n    XCTAssertEqual(co.employeeSet.count, 1U);\n    EmployeeObject *eo = co.employeeSet.allObjects[0];\n    XCTAssertEqualObjects(eo.name, @\"name\");\n    XCTAssertEqual(eo.age, 2);\n    XCTAssertEqual(eo.hired, YES);\n\n    co = [[CompanyObject alloc] initWithValue:@[@\"one employee\", @[eo], @[eo]]];\n    XCTAssertEqualObjects(co.name, @\"one employee\");\n    XCTAssertEqual(co.employeeSet.count, 1U);\n    eo = co.employeeSet.allObjects[0];\n    XCTAssertEqualObjects(eo.name, @\"name\");\n    XCTAssertEqual(eo.age, 2);\n    XCTAssertEqual(eo.hired, YES);\n}\n\n- (void)testWithNonArrayEnumerableForRLMArrayProperty {\n    auto employees = @[@[@\"name\", @2, @YES], @[@\"name 2\", @3, @NO]];\n    auto co = [[CompanyObject alloc] initWithValue:@[@\"one employee\", employees.reverseObjectEnumerator]];\n    XCTAssertEqual(2U, co.employees.count);\n    XCTAssertEqualObjects(@\"name 2\", co.employees[0].name);\n    XCTAssertEqualObjects(@\"name\", co.employees[1].name);\n}\n\n- (void)testWithNonSetEnumerableForRLMSetProperty {\n    auto employees = @[@[@\"name\", @2, @YES], @[@\"name 2\", @3, @NO]];\n    auto co = [[CompanyObject alloc] initWithValue:@[@\"one employee\",\n                                                     employees.reverseObjectEnumerator,\n                                                     employees.reverseObjectEnumerator]];\n    XCTAssertEqual(2U, co.employeeSet.count);\n\n    XCTAssertTrue([[co.employeeSet valueForKey:@\"name\"] containsObject:@\"name\"]);\n    XCTAssertTrue([[co.employeeSet valueForKey:@\"name\"] containsObject:@\"name 2\"]);\n}\n\n- (void)testInitWithArrayUsesDefaultValuesForMissingFields {\n    auto obj = [[NumberDefaultsObject alloc] initWithValue:@[]];\n    XCTAssertEqualObjects(obj.intObj, @1);\n    XCTAssertEqualObjects(obj.floatObj, @2.2f);\n    XCTAssertEqualObjects(obj.doubleObj, @3.3);\n    XCTAssertEqualObjects(obj.boolObj, @NO);\n\n    obj = [[NumberDefaultsObject alloc] initWithValue:@[@10, @22.2f]];\n    XCTAssertEqualObjects(obj.intObj, @10);\n    XCTAssertEqualObjects(obj.floatObj, @22.2f);\n    XCTAssertEqualObjects(obj.doubleObj, @3.3);\n    XCTAssertEqualObjects(obj.boolObj, @NO);\n}\n\n- (void)testInitWithInvalidArray {\n    RLMAssertThrowsWithReason(([[DogObject alloc] initWithValue:@[@\"name\", @\"age\"]]),\n                              @\"Invalid value 'age' of type '__NSCFConstantString' for 'int' property 'DogObject.age'.\");\n    RLMAssertThrowsWithReason(([[DogObject alloc] initWithValue:@[@\"name\", NSNull.null]]),\n                              @\"Invalid value '(null)' of type '(null)' for 'int' property 'DogObject.age'.\");\n    RLMAssertThrowsWithReason(([[DogObject alloc] initWithValue:@[@\"name\", @5, @\"too many values\"]]),\n                              @\"Invalid array input: more values (3) than properties (2).\");\n}\n\n- (void)testInitWithDictionary {\n    auto co = [[CompanyObject alloc] initWithValue:@{}];\n    XCTAssertNil(co.name);\n    XCTAssertEqual(co.employees.count, 0U);\n\n    co = [[CompanyObject alloc] initWithValue:@{@\"name\": NSNull.null}];\n    XCTAssertNil(co.name);\n    XCTAssertEqual(co.employees.count, 0U);\n\n    co = [[CompanyObject alloc] initWithValue:@{@\"name\": @\"empty company\"}];\n    XCTAssertEqualObjects(co.name, @\"empty company\");\n    XCTAssertEqual(co.employees.count, 0U);\n\n    co = [[CompanyObject alloc] initWithValue:@{@\"name\": @\"empty company\",\n                                                @\"employees\": NSNull.null,\n                                                @\"employeeSet\": NSNull.null}];\n    XCTAssertEqualObjects(co.name, @\"empty company\");\n    XCTAssertEqual(co.employees.count, 0U);\n    XCTAssertEqual(co.employeeSet.count, 0U);\n\n    co = [[CompanyObject alloc] initWithValue:@{@\"name\": @\"empty company\",\n                                                @\"employees\": @[],\n                                                @\"employeeSet\": @[]}];\n    XCTAssertEqualObjects(co.name, @\"empty company\");\n    XCTAssertEqual(co.employees.count, 0U);\n    XCTAssertEqual(co.employeeSet.count, 0U);\n\n    co = [[CompanyObject alloc] initWithValue:@{@\"name\": @\"one employee\",\n                                                @\"employees\": @[@[@\"name\", @2, @YES]],\n                                                @\"employeeSet\": @[@[@\"name\", @2, @YES]]}];\n    XCTAssertEqualObjects(co.name, @\"one employee\");\n    XCTAssertEqual(co.employees.count, 1U);\n    XCTAssertEqual(co.employeeSet.count, 1U);\n    EmployeeObject *eo = co.employees.firstObject;\n    EmployeeObject *eo2 = co.employeeSet.allObjects[0];\n    XCTAssertEqualObjects(eo.name, @\"name\");\n    XCTAssertEqualObjects(eo2.name, @\"name\");\n    XCTAssertEqual(eo.age, 2);\n    XCTAssertEqual(eo.hired, YES);\n    XCTAssertEqual(eo2.age, 2);\n    XCTAssertEqual(eo2.hired, YES);\n\n    co = [[CompanyObject alloc] initWithValue:@{@\"name\": @\"one employee\",\n                                                @\"employees\": @[@{@\"name\": @\"name\",\n                                                                  @\"age\": @2,\n                                                                  @\"hired\": @YES}],\n                                                @\"employeeSet\": @[@{@\"name\": @\"name\",\n                                                                  @\"age\": @2,\n                                                                  @\"hired\": @YES}]}];\n    XCTAssertEqualObjects(co.name, @\"one employee\");\n    XCTAssertEqual(co.employees.count, 1U);\n    XCTAssertEqual(co.employeeSet.count, 1U);\n    eo = co.employees.firstObject;\n    eo2 = co.employeeSet.allObjects[0];\n    XCTAssertEqualObjects(eo.name, @\"name\");\n    XCTAssertEqual(eo.age, 2);\n    XCTAssertEqual(eo.hired, YES);\n    XCTAssertEqualObjects(eo2.name, @\"name\");\n    XCTAssertEqual(eo2.age, 2);\n    XCTAssertEqual(eo2.hired, YES);\n\n    co = [[CompanyObject alloc] initWithValue:@{@\"name\": @\"no employees\",\n                                                @\"extra fields\": @\"are okay\"}];\n    XCTAssertEqualObjects(co.name, @\"no employees\");\n    XCTAssertEqual(co.employees.count, 0U);\n    XCTAssertEqual(co.employeeSet.count, 0U);\n}\n\n- (void)testInitWithInvalidDictionary {\n    RLMAssertThrowsWithReason(([[DogObject alloc] initWithValue:@{@\"name\": @\"a\", @\"age\": NSNull.null}]),\n                              @\"Invalid value '(null)' of type '(null)' for 'int' property 'DogObject.age'\");\n    RLMAssertThrowsWithReasonMatching(([[DogObject alloc] initWithValue:@{@\"name\": @\"a\", @\"age\": NSDate.date}]),\n                                      @\"Invalid value '20.*' of type '.*Date' for 'int' property 'DogObject.age'\");\n}\n\n- (void)testInitWithDictionaryUsesDefaultValuesForMissingFields {\n    auto obj = [[NumberDefaultsObject alloc] initWithValue:@{}];\n    XCTAssertEqualObjects(obj.intObj, @1);\n    XCTAssertEqualObjects(obj.floatObj, @2.2f);\n    XCTAssertEqualObjects(obj.doubleObj, @3.3);\n    XCTAssertEqualObjects(obj.boolObj, @NO);\n\n    obj = [[NumberDefaultsObject alloc] initWithValue:@{@\"intObj\": @10}];\n    XCTAssertEqualObjects(obj.intObj, @10);\n    XCTAssertEqualObjects(obj.floatObj, @2.2f);\n    XCTAssertEqualObjects(obj.doubleObj, @3.3);\n    XCTAssertEqualObjects(obj.boolObj, @NO);\n}\n\n- (void)testInitWithObject {\n    auto eo = [[EmployeeObject alloc] init];\n    eo.name = @\"employee name\";\n    eo.age = 1;\n    eo.hired = NO;\n\n    auto co = [[CompanyObject alloc] init];\n    co.name = @\"name\";\n    [co.employees addObject:eo];\n\n    auto co2 = [[CompanyObject alloc] initWithValue:co];\n    XCTAssertEqualObjects(co.name, co2.name);\n    XCTAssertEqual(co.employees[0], co2.employees[0]); // not EqualObjects as it's a shallow copy\n\n    auto dogExt = [[DogExtraObject alloc] initWithValue:@[@\"Fido\", @12, @\"Poodle\"]];\n    auto dog = [[DogObject alloc] initWithValue:dogExt];\n    XCTAssertEqualObjects(dog.dogName, @\"Fido\");\n    XCTAssertEqual(dog.age, 12);\n\n    auto owner = [[OwnerObject alloc] initWithValue:@[@\"Alex\", dogExt]];\n    XCTAssertEqualObjects(owner.dog.dogName, @\"Fido\");\n\n    auto array1 = [[AllPrimitiveArrays alloc] init];\n    [array1.intObj addObject:@2];\n    auto array2 = [[AllPrimitiveArrays alloc] initWithValue:array1];\n    XCTAssertEqual(array2.intObj.count, 1U);\n    XCTAssertEqualObjects(array2.intObj.firstObject, @2);\n\n    auto set1 = [[AllPrimitiveSets alloc] init];\n    [set1.intObj addObject:@2];\n    auto set2 = [[AllPrimitiveSets alloc] initWithValue:set1];\n    XCTAssertEqual(set2.intObj.count, 1U);\n    XCTAssertEqualObjects(set2.intObj.allObjects[0], @2);\n}\n\n- (void)testInitWithInvalidObject {\n    // No overlap in properties\n    auto so = [[StringObject alloc] initWithValue:@[@\"str\"]];\n    RLMAssertThrowsWithReason([[IntObject alloc] initWithValue:so], @\"missing key 'intCol'\");\n\n    // Dog has some but not all of DogExtra's properties\n    auto dog = [[DogObject alloc] initWithValue:@[@\"Fido\", @10]];\n    RLMAssertThrowsWithReason([[DogExtraObject alloc] initWithValue:dog], @\"missing key 'breed'\");\n\n    // Same property names, but different types\n    RLMAssertThrowsWithReason([[BizzaroDog alloc] initWithValue:dog],\n                              @\"Invalid value 'Fido' of type '__NSCFConstantString' for 'int' property 'BizzaroDog.dogName'\");\n}\n\n- (void)testInitPrimitiveArraysWithInvalidValues {\n    RLMAssertThrowsWithReason([[AllPrimitiveArrays alloc] initWithValue:@{@\"intObj\": @[NSNull.null]}],\n                             @\"Invalid value '<null>' of type 'NSNull' for 'int' array property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason([[AllPrimitiveArrays alloc] initWithValue:@{@\"intObj\": @[@1.1]}],\n                             @\"Invalid value '1.1' of type '\" RLMConstantDouble \"' for 'int' array property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason([[AllPrimitiveArrays alloc] initWithValue:@{@\"intObj\": @[@\"0\"]}],\n                             @\"Invalid value '0' of type '__NSCFConstantString' for 'int' array property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason([[AllPrimitiveArrays alloc] initWithValue:@{@\"intObj\": @1}],\n                             @\"Invalid value (1) for 'int' array property 'AllPrimitiveArrays.intObj': value is not enumerable.\");\n}\n\n- (void)testInitPrimitiveSetsWithInvalidValues {\n    RLMAssertThrowsWithReason([[AllPrimitiveSets alloc] initWithValue:@{@\"intObj\": @[NSNull.null]}],\n                             @\"Invalid value '<null>' of type 'NSNull' for 'int' set property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason([[AllPrimitiveSets alloc] initWithValue:@{@\"intObj\": @[@1.1]}],\n                             @\"Invalid value '1.1' of type '\" RLMConstantDouble \"' for 'int' set property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason([[AllPrimitiveSets alloc] initWithValue:@{@\"intObj\": @[@\"0\"]}],\n                             @\"Invalid value '0' of type '\" RLMConstantString \"' for 'int' set property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason([[AllPrimitiveSets alloc] initWithValue:@{@\"intObj\": @1}],\n                             @\"Invalid value (1) for 'int' set property 'AllPrimitiveSets.intObj': value is not enumerable.\");\n}\n\n- (void)testInitWithCustomAccessors {\n    // Create with array\n    auto ca = [[CustomAccessorsObject alloc] initWithValue:@[@\"a\", @1]];\n    XCTAssertEqualObjects(ca.name, @\"a\");\n    XCTAssertEqual(ca.age, 1);\n\n    // Create with dictionary\n    ca = [[CustomAccessorsObject alloc] initWithValue:@{@\"name\": @\"b\", @\"age\": @2}];\n    XCTAssertEqualObjects(ca.name, @\"b\");\n    XCTAssertEqual(ca.age, 2);\n\n    // Create with KVC-compatible object\n    ca = [[CustomAccessorsObject alloc] initWithValue:ca];\n    XCTAssertEqualObjects(ca.name, @\"b\");\n    XCTAssertEqual(ca.age, 2);\n}\n\n- (void)testInitWithRenamedColumns {\n    // Create with array\n    auto obj = [[RenamedProperties1 alloc] initWithValue:@[@1, @\"a\"]];\n    XCTAssertEqual(obj.propA, 1);\n    XCTAssertEqualObjects(obj.propB, @\"a\");\n\n    // Create with dictionary\n    obj = [[RenamedProperties1 alloc] initWithValue:@{@\"propB\": @\"b\", @\"propA\": @2}];\n    XCTAssertEqual(obj.propA, 2);\n    XCTAssertEqualObjects(obj.propB, @\"b\");\n\n    // Create with KVC-compatible object\n    obj = [[RenamedProperties1 alloc] initWithValue:obj];\n    XCTAssertEqual(obj.propA, 2);\n    XCTAssertEqualObjects(obj.propB, @\"b\");\n}\n\n- (void)testInitAllPropertyTypes {\n    auto now = [NSDate dateWithTimeIntervalSince1970:1];\n    auto bytes = [NSData dataWithBytes:\"a\" length:1];\n    auto so = [[StringObject alloc] init];\n    so.stringCol = @\"string\";\n    auto ao = [[AllTypesObject alloc] initWithValue:[AllTypesObject values:1 stringObject:so]];\n    XCTAssertEqual(ao.boolCol, YES);\n    XCTAssertEqual(ao.intCol, 1);\n    XCTAssertEqual(ao.floatCol, 1.1f);\n    XCTAssertEqual(ao.doubleCol, 1.11);\n    XCTAssertEqualObjects(ao.stringCol, @\"a\");\n    XCTAssertEqualObjects(ao.binaryCol, bytes);\n    XCTAssertEqualObjects(ao.decimalCol, [[RLMDecimal128 alloc] initWithNumber:@(1)]);\n    XCTAssertEqualObjects(ao.dateCol, now);\n    XCTAssertEqual(ao.cBoolCol, true);\n    XCTAssertEqual(ao.longCol, INT_MAX + 1LL);\n    XCTAssertEqual(ao.objectCol, so);\n\n    auto opt = [[AllOptionalTypes alloc] initWithValue:@[NSNull.null, NSNull.null,\n                                                         NSNull.null, NSNull.null,\n                                                         NSNull.null, NSNull.null,\n                                                         NSNull.null]];\n    XCTAssertNil(opt.intObj);\n    XCTAssertNil(opt.boolObj);\n    XCTAssertNil(opt.floatObj);\n    XCTAssertNil(opt.doubleObj);\n    XCTAssertNil(opt.date);\n    XCTAssertNil(opt.data);\n    XCTAssertNil(opt.string);\n\n    opt = [[AllOptionalTypes alloc] initWithValue:@[@1, @2.2f, @3.3, @YES,\n                                                    @\"str\", bytes, now]];\n    XCTAssertEqualObjects(opt.intObj, @1);\n    XCTAssertEqualObjects(opt.boolObj, @YES);\n    XCTAssertEqualObjects(opt.floatObj, @2.2f);\n    XCTAssertEqualObjects(opt.doubleObj, @3.3);\n    XCTAssertEqualObjects(opt.date, now);\n    XCTAssertEqualObjects(opt.data, bytes);\n    XCTAssertEqualObjects(opt.string, @\"str\");\n\n    auto arrays = [[AllPrimitiveArrays alloc] initWithValue:@{@\"intObj\": @[@1, @2, @3],\n                                                              @\"boolObj\": @[@YES, @NO],\n                                                              @\"floatObj\": @[@1.1f, @2.2f],\n                                                              @\"doubleObj\": @[@3.3, @4.4],\n                                                              @\"stringObj\": @[@\"a\", @\"b\"],\n                                                              @\"dateObj\": @[now],\n                                                              @\"dataObj\": @[bytes]}];\n    XCTAssertEqual(3U, arrays.intObj.count);\n    XCTAssertEqual(2U, arrays.boolObj.count);\n    XCTAssertEqual(2U, arrays.floatObj.count);\n    XCTAssertEqual(2U, arrays.doubleObj.count);\n    XCTAssertEqual(2U, arrays.stringObj.count);\n    XCTAssertEqual(1U, arrays.dateObj.count);\n    XCTAssertEqual(1U, arrays.dataObj.count);\n\n    XCTAssertEqualObjects([arrays.intObj valueForKey:@\"self\"], (@[@1, @2, @3]));\n    XCTAssertEqualObjects([arrays.boolObj valueForKey:@\"self\"], (@[@YES, @NO]));\n    XCTAssertEqualObjects([arrays.floatObj valueForKey:@\"self\"], (@[@1.1f, @2.2f]));\n    XCTAssertEqualObjects([arrays.doubleObj valueForKey:@\"self\"], (@[@3.3, @4.4]));\n    XCTAssertEqualObjects([arrays.stringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    XCTAssertEqualObjects([arrays.dateObj valueForKey:@\"self\"], (@[now]));\n    XCTAssertEqualObjects([arrays.dataObj valueForKey:@\"self\"], (@[bytes]));\n\n    auto sets = [[AllPrimitiveSets alloc] initWithValue:@{@\"intObj\": @[@1, @2, @3],\n                                                          @\"boolObj\": @[@YES, @NO],\n                                                          @\"floatObj\": @[@1.1f, @2.2f],\n                                                          @\"doubleObj\": @[@3.3, @4.4],\n                                                          @\"stringObj\": @[@\"a\", @\"b\"],\n                                                          @\"dateObj\": @[now],\n                                                          @\"dataObj\": @[bytes]}];\n    XCTAssertEqual(3U, sets.intObj.count);\n    XCTAssertEqual(2U, sets.boolObj.count);\n    XCTAssertEqual(2U, sets.floatObj.count);\n    XCTAssertEqual(2U, sets.doubleObj.count);\n    XCTAssertEqual(2U, sets.stringObj.count);\n    XCTAssertEqual(1U, sets.dateObj.count);\n    XCTAssertEqual(1U, sets.dataObj.count);\n\n    XCTAssertTrue([[NSSet setWithArray:[[sets.intObj valueForKey:@\"self\"] allObjects]] isEqualToSet:[NSSet setWithArray:(@[@1, @2, @3])]]);\n    XCTAssertTrue([[NSSet setWithArray:[[sets.boolObj valueForKey:@\"self\"] allObjects]] isEqualToSet:[NSSet setWithArray:(@[@YES, @NO])]]);\n    XCTAssertTrue([[NSSet setWithArray:[[sets.floatObj valueForKey:@\"self\"] allObjects]] isEqualToSet:[NSSet setWithArray:(@[@1.1f, @2.2f])]]);\n    XCTAssertTrue([[NSSet setWithArray:[[sets.doubleObj valueForKey:@\"self\"] allObjects]] isEqualToSet:[NSSet setWithArray:(@[@3.3, @4.4])]]);\n    XCTAssertTrue([[NSSet setWithArray:[[sets.stringObj valueForKey:@\"self\"] allObjects]] isEqualToSet:[NSSet setWithArray:(@[@\"a\", @\"b\"])]]);\n    XCTAssertTrue([[NSSet setWithArray:[[sets.dateObj valueForKey:@\"self\"] allObjects]] isEqualToSet:[NSSet setWithArray:(@[now])]]);\n    XCTAssertTrue([[NSSet setWithArray:[[sets.dataObj valueForKey:@\"self\"] allObjects]] isEqualToSet:[NSSet setWithArray:(@[bytes])]]);\n}\n\n- (void)testInitValidatesNumberTypes {\n    XCTAssertNoThrow(([[NumberObject alloc] initWithValue:@{}]));\n    RLMAssertThrowsWithReason(([[NumberObject alloc] initWithValue:@{@\"intObj\": @1.1}]),\n                              @\"Invalid value '1.1' of type '\" RLMConstantDouble \"' for 'int?' property 'NumberObject.intObj'.\");\n    RLMAssertThrowsWithReason(([[NumberObject alloc] initWithValue:@{@\"intObj\": @1.1f}]),\n                              @\"Invalid value '1.1' of type '\" RLMConstantFloat \"' for 'int?' property 'NumberObject.intObj'.\");\n\n    XCTAssertNoThrow(([[NumberObject alloc] initWithValue:@{@\"boolObj\": @YES}]));\n    XCTAssertNoThrow(([[NumberObject alloc] initWithValue:@{@\"boolObj\": @1}]));\n    XCTAssertNoThrow(([[NumberObject alloc] initWithValue:@{@\"boolObj\": @0}]));\n    // This error is kinda bad....\n    RLMAssertThrowsWithReason(([[NumberObject alloc] initWithValue:@{@\"boolObj\": @1.0}]),\n                              @\"Invalid value '1' of type '\" RLMConstantDouble \"' for 'bool?' property 'NumberObject.boolObj'.\");\n    RLMAssertThrowsWithReason(([[NumberObject alloc] initWithValue:@{@\"boolObj\": @1.0f}]),\n                              @\"Invalid value '1' of type '\" RLMConstantFloat \"' for 'bool?' property 'NumberObject.boolObj'.\");\n    RLMAssertThrowsWithReason(([[NumberObject alloc] initWithValue:@{@\"boolObj\": @2}]),\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for 'bool?' property 'NumberObject.boolObj'.\");\n\n    XCTAssertNoThrow(([[NumberObject alloc] initWithValue:@{@\"floatObj\": @1.1}]));\n    RLMAssertThrowsWithReasonMatching(([[NumberObject alloc] initWithValue:@{@\"floatObj\": @DBL_MAX}]),\n                                      @\"Invalid value '.*' of type '\" RLMConstantDouble \"' for 'float\\\\?' property 'NumberObject.floatObj'\");\n\n    XCTAssertNoThrow(([[NumberObject alloc] initWithValue:@{@\"doubleObj\": @DBL_MAX}]));\n}\n\n#pragma mark - Create\n\n- (void)testCreateWithArray {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    auto co = [CompanyObject createInRealm:realm withValue:@[@\"empty company\", NSNull.null, NSNull.null]];\n    XCTAssertEqualObjects(co.name, @\"empty company\");\n    XCTAssertEqual(co.employees.count, 0U);\n    XCTAssertEqual(co.employeeSet.count, 0U);\n\n    co = [CompanyObject createInRealm:realm withValue:@[@\"empty company\", @[], @[]]];\n    XCTAssertEqualObjects(co.name, @\"empty company\");\n    XCTAssertEqual(co.employees.count, 0U);\n    XCTAssertEqual(co.employeeSet.count, 0U);\n\n    co = [CompanyObject createInRealm:realm withValue:@[@\"one employee\",\n                                                        @[@[@\"name\", @2, @YES]],\n                                                        @[@[@\"name\", @2, @YES]]]];\n    XCTAssertEqualObjects(co.name, @\"one employee\");\n    XCTAssertEqual(co.employees.count, 1U);\n    XCTAssertEqual(co.employeeSet.count, 1U);\n    EmployeeObject *eo = co.employees.firstObject;\n    XCTAssertEqualObjects(eo.name, @\"name\");\n    XCTAssertEqual(eo.age, 2);\n    XCTAssertEqual(eo.hired, YES);\n    eo = co.employeeSet.allObjects[0];\n    XCTAssertEqualObjects(eo.name, @\"name\");\n    XCTAssertEqual(eo.age, 2);\n    XCTAssertEqual(eo.hired, YES);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateWithInvalidArray {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    RLMAssertThrowsWithReason(([DogObject createInRealm:realm withValue:@[@\"name\", @\"age\"]]),\n                              @\"Invalid value 'age' of type '__NSCFConstantString' for 'int' property 'DogObject.age'\");\n    RLMAssertThrowsWithReason(([DogObject createInRealm:realm withValue:@[@\"name\", NSNull.null]]),\n                              @\"Invalid value '<null>' of type 'NSNull' for 'int' property 'DogObject.age'\");\n    RLMAssertThrowsWithReason(([DogObject createInRealm:realm withValue:@[@\"name\", @5, @\"too many values\"]]),\n                              @\"Invalid array input: more values (3) than properties (2).\");\n    RLMAssertThrowsWithReason(([PrimaryStringObject createInRealm:realm withValue:@[]]),\n                              @\"Missing value for property 'PrimaryStringObject.stringCol'\");\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateWithDictionary {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    auto co = [CompanyObject createInRealm:realm withValue:@{}];\n    XCTAssertNil(co.name);\n    XCTAssertEqual(co.employees.count, 0U);\n\n    co = [CompanyObject createInRealm:realm withValue:@{@\"name\": NSNull.null}];\n    XCTAssertNil(co.name);\n    XCTAssertEqual(co.employees.count, 0U);\n\n    co = [CompanyObject createInRealm:realm withValue:@{@\"name\": @\"empty company\"}];\n    XCTAssertEqualObjects(co.name, @\"empty company\");\n    XCTAssertEqual(co.employees.count, 0U);\n\n    co = [CompanyObject createInRealm:realm withValue:@{@\"name\": @\"empty company\",\n                                                        @\"employees\": NSNull.null,\n                                                        @\"employeeSet\": NSNull.null}];\n    XCTAssertEqualObjects(co.name, @\"empty company\");\n    XCTAssertEqual(co.employees.count, 0U);\n    XCTAssertEqual(co.employeeSet.count, 0U);\n\n    co = [CompanyObject createInRealm:realm withValue:@{@\"name\": @\"empty company\",\n                                                        @\"employees\": @[],\n                                                        @\"employeeSet\": @[]}];\n    XCTAssertEqualObjects(co.name, @\"empty company\");\n    XCTAssertEqual(co.employees.count, 0U);\n    XCTAssertEqual(co.employeeSet.count, 0U);\n\n    co = [CompanyObject createInRealm:realm withValue:@{@\"name\": @\"one employee\",\n                                                        @\"employees\": @[@[@\"name\", @2, @YES]],\n                                                        @\"employeeSet\": @[@[@\"name\", @2, @YES]]}];\n    XCTAssertEqualObjects(co.name, @\"one employee\");\n    XCTAssertEqual(co.employees.count, 1U);\n    XCTAssertEqual(co.employeeSet.count, 1U);\n    EmployeeObject *eo = co.employees.firstObject;\n    XCTAssertEqualObjects(eo.name, @\"name\");\n    XCTAssertEqual(eo.age, 2);\n    XCTAssertEqual(eo.hired, YES);\n    eo = co.employeeSet.allObjects[0];\n    XCTAssertEqualObjects(eo.name, @\"name\");\n    XCTAssertEqual(eo.age, 2);\n    XCTAssertEqual(eo.hired, YES);\n\n    co = [CompanyObject createInRealm:realm withValue:@{@\"name\": @\"one employee\",\n                                                        @\"employees\": @[@{@\"name\": @\"name\",\n                                                                          @\"age\": @2,\n                                                                          @\"hired\": @YES}],\n                                                        @\"employeeSet\": @[@{@\"name\": @\"name\",\n                                                                          @\"age\": @2,\n                                                                          @\"hired\": @YES}]}];\n    XCTAssertEqualObjects(co.name, @\"one employee\");\n    XCTAssertEqual(co.employees.count, 1U);\n    XCTAssertEqual(co.employeeSet.count, 1U);\n    eo = co.employees.firstObject;\n    XCTAssertEqualObjects(eo.name, @\"name\");\n    XCTAssertEqual(eo.age, 2);\n    XCTAssertEqual(eo.hired, YES);\n    eo = co.employeeSet.allObjects[0];\n    XCTAssertEqualObjects(eo.name, @\"name\");\n    XCTAssertEqual(eo.age, 2);\n    XCTAssertEqual(eo.hired, YES);\n\n    co = [CompanyObject createInRealm:realm withValue:@{@\"name\": @\"no employees\",\n                                                        @\"extra fields\": @\"are okay\"}];\n    XCTAssertEqualObjects(co.name, @\"no employees\");\n    XCTAssertEqual(co.employees.count, 0U);\n    XCTAssertEqual(co.employeeSet.count, 0U);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateWithInvalidDictionary {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    RLMAssertThrowsWithReason(([DogObject createInRealm:realm withValue:@{@\"name\": @\"a\", @\"age\": NSNull.null}]),\n                              @\"Invalid value '<null>' of type 'NSNull' for 'int' property 'DogObject.age'\");\n    RLMAssertThrowsWithReasonMatching(([DogObject createInRealm:realm withValue:@{@\"name\": @\"a\", @\"age\": NSDate.date}]),\n                                      @\"Invalid value '20.*' for 'int' property 'DogObject.age'\");\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateWithObject {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    auto eo = [[EmployeeObject alloc] init];\n    eo.name = @\"employee name\";\n    eo.age = 1;\n    eo.hired = NO;\n\n    auto co = [[CompanyObject alloc] init];\n    co.name = @\"name\";\n    [co.employees addObject:eo];\n    [co.employeeSet addObject:eo];\n\n    auto co2 = [CompanyObject createInRealm:realm withValue:co];\n    XCTAssertEqualObjects(co.name, co2.name);\n    // Deep copy, so it's a different object\n    XCTAssertFalse([co.employees[0] isEqualToObject:co2.employees[0]]);\n    XCTAssertEqualObjects(co.employees[0].name, co2.employees[0].name);\n    XCTAssertFalse([co.employeeSet.allObjects[0] isEqualToObject:co2.employeeSet.allObjects[0]]);\n    XCTAssertEqualObjects(co.employeeSet.allObjects[0].name, co2.employeeSet.allObjects[0].name);\n\n    auto dogExt = [DogExtraObject createInRealm:realm withValue:@[@\"Fido\", @12, @\"Poodle\"]];\n    auto dog = [DogObject createInRealm:realm withValue:dogExt];\n    XCTAssertEqualObjects(dog.dogName, @\"Fido\");\n    XCTAssertEqual(dog.age, 12);\n\n    auto owner = [OwnerObject createInRealm:realm withValue:@[@\"Alex\", dogExt]];\n    XCTAssertEqualObjects(owner.dog.dogName, @\"Fido\");\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateWithInvalidObject {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    RLMAssertThrowsWithReasonMatching([DogObject createInRealm:realm withValue:self.nonLiteralNil],\n                                      @\"Must provide a non-nil value\");\n    RLMAssertThrowsWithReasonMatching([DogObject createInRealm:realm withValue:NSNull.null],\n                                      @\"Must provide a non-nil value\");\n    RLMAssertThrowsWithReasonMatching([DogObject createInRealm:realm withValue:@\"\"],\n                                      @\"Invalid value '' to initialize object of type 'DogObject'\");\n\n    // No overlap in properties\n    auto so = [StringObject createInRealm:realm withValue:@[@\"str\"]];\n    RLMAssertThrowsWithReasonMatching([IntObject createInRealm:realm withValue:so], @\"missing key 'intCol'\");\n\n    // Dog has some but not all of DogExtra's properties\n    auto dog = [DogObject createInRealm:realm withValue:@[@\"Fido\", @10]];\n    RLMAssertThrowsWithReasonMatching([DogExtraObject createInRealm:realm withValue:dog],\n                                      @\"missing key 'breed'\");\n\n    // Same property names, but different types\n    RLMAssertThrowsWithReasonMatching([BizzaroDog createInRealm:realm withValue:dog],\n                                      @\"Invalid value 'Fido' of type '.*' for 'int' property 'BizzaroDog.dogName'\");\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateAllPropertyTypes {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    auto now = [NSDate dateWithTimeIntervalSince1970:1];\n    auto bytes = [NSData dataWithBytes:\"a\" length:1];\n    auto so = [[StringObject alloc] init];\n    so.stringCol = @\"string\";\n    auto ao = [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:1 stringObject:so]];\n    XCTAssertEqual(ao.boolCol, YES);\n    XCTAssertEqual(ao.intCol, 1);\n    XCTAssertEqual(ao.floatCol, 1.1f);\n    XCTAssertEqual(ao.doubleCol, 1.11);\n    XCTAssertEqualObjects(ao.stringCol, @\"a\");\n    XCTAssertEqualObjects(ao.binaryCol, bytes);\n    XCTAssertEqualObjects(ao.dateCol, now);\n    XCTAssertEqual(ao.cBoolCol, true);\n    XCTAssertEqual(ao.longCol, INT_MAX + 1LL);\n    XCTAssertNotEqual(ao.objectCol, so);\n    XCTAssertEqualObjects(ao.objectCol.stringCol, @\"string\");\n\n    auto opt = [AllOptionalTypes createInRealm:realm withValue:@[NSNull.null, NSNull.null,\n                                                                 NSNull.null, NSNull.null,\n                                                                 NSNull.null, NSNull.null,\n                                                                 NSNull.null]];\n    XCTAssertNil(opt.intObj);\n    XCTAssertNil(opt.boolObj);\n    XCTAssertNil(opt.floatObj);\n    XCTAssertNil(opt.doubleObj);\n    XCTAssertNil(opt.date);\n    XCTAssertNil(opt.data);\n    XCTAssertNil(opt.string);\n\n    opt = [AllOptionalTypes createInRealm:realm withValue:@[@1, @2.2f, @3.3, @YES,\n                                                            @\"str\", bytes, now]];\n    XCTAssertEqualObjects(opt.intObj, @1);\n    XCTAssertEqualObjects(opt.boolObj, @YES);\n    XCTAssertEqualObjects(opt.floatObj, @2.2f);\n    XCTAssertEqualObjects(opt.doubleObj, @3.3);\n    XCTAssertEqualObjects(opt.date, now);\n    XCTAssertEqualObjects(opt.data, bytes);\n    XCTAssertEqualObjects(opt.string, @\"str\");\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateRequiredPrimitiveArrays {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    auto now = [NSDate date];\n    auto bytes = [NSData dataWithBytes:\"a\" length:1];\n    auto req = [AllPrimitiveArrays createInRealm:realm\n                                       withValue:@{@\"intObj\": @[@1, @2, @3],\n                                                   @\"boolObj\": @[@YES, @NO],\n                                                   @\"floatObj\": @[@1.1f, @2.2f],\n                                                   @\"doubleObj\": @[@3.3, @4.4],\n                                                   @\"stringObj\": @[@\"a\", @\"b\"],\n                                                   @\"dateObj\": @[now],\n                                                   @\"dataObj\": @[bytes]}];\n    XCTAssertEqual(3U, req.intObj.count);\n    XCTAssertEqual(2U, req.boolObj.count);\n    XCTAssertEqual(2U, req.floatObj.count);\n    XCTAssertEqual(2U, req.doubleObj.count);\n    XCTAssertEqual(2U, req.stringObj.count);\n    XCTAssertEqual(1U, req.dateObj.count);\n    XCTAssertEqual(1U, req.dataObj.count);\n\n    XCTAssertEqualObjects([req.intObj valueForKey:@\"self\"], (@[@1, @2, @3]));\n    XCTAssertEqualObjects([req.boolObj valueForKey:@\"self\"], (@[@YES, @NO]));\n    XCTAssertEqualObjects([req.floatObj valueForKey:@\"self\"], (@[@1.1f, @2.2f]));\n    XCTAssertEqualObjects([req.doubleObj valueForKey:@\"self\"], (@[@3.3, @4.4]));\n    XCTAssertEqualObjects([req.stringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    XCTAssertEqualObjects([req.dateObj valueForKey:@\"self\"], (@[now]));\n    XCTAssertEqualObjects([req.dataObj valueForKey:@\"self\"], (@[bytes]));\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateRequiredPrimitiveSets {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    auto now = [NSDate date];\n    auto bytes = [NSData dataWithBytes:\"a\" length:1];\n    auto req = [AllPrimitiveSets createInRealm:realm\n                                     withValue:@{@\"intObj\": @[@1, @2, @3],\n                                                 @\"boolObj\": @[@YES, @NO],\n                                                 @\"floatObj\": @[@1.1f, @2.2f],\n                                                 @\"doubleObj\": @[@3.3, @4.4],\n                                                 @\"stringObj\": @[@\"a\", @\"b\"],\n                                                 @\"dateObj\": @[now],\n                                                 @\"dataObj\": @[bytes]}];\n    XCTAssertEqual(3U, req.intObj.count);\n    XCTAssertEqual(2U, req.boolObj.count);\n    XCTAssertEqual(2U, req.floatObj.count);\n    XCTAssertEqual(2U, req.doubleObj.count);\n    XCTAssertEqual(2U, req.stringObj.count);\n    XCTAssertEqual(1U, req.dateObj.count);\n    XCTAssertEqual(1U, req.dataObj.count);\n\n    XCTAssertEqualObjects([req.intObj valueForKey:@\"self\"], ([NSSet setWithArray:@[@1, @2, @3]]));\n    XCTAssertEqualObjects([req.boolObj valueForKey:@\"self\"], ([NSSet setWithArray:@[@NO, @YES]]));\n    XCTAssertEqualObjects([req.floatObj valueForKey:@\"self\"], ([NSSet setWithArray:@[@1.1f, @2.2f]]));\n    XCTAssertEqualObjects([req.doubleObj valueForKey:@\"self\"], ([NSSet setWithArray:@[@3.3, @4.4]]));\n    XCTAssertEqualObjects([req.stringObj valueForKey:@\"self\"], ([NSSet setWithArray:@[@\"a\", @\"b\"]]));\n    XCTAssertEqualObjects([req.dateObj valueForKey:@\"self\"], ([NSSet setWithArray:@[now]]));\n    XCTAssertEqualObjects([req.dataObj valueForKey:@\"self\"], ([NSSet setWithArray:@[bytes]]));\n\n    [realm cancelWriteTransaction];\n}\n\n#if 0\n- (void)testCreateRequiredPrimitiveArraysWithNonNSArrayEnumerable {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    auto now = [NSDate date];\n    auto bytes = [NSData dataWithBytes:\"a\" length:1];\n    auto req = [AllPrimitiveArrays createInRealm:realm\n                                       withValue:@{@\"intObj\": @[@1, @2, @3].reverseObjectEnumerator,\n                                                   @\"boolObj\": @[@YES, @NO].reverseObjectEnumerator,\n                                                   @\"floatObj\": @[@1.1f, @2.2f].reverseObjectEnumerator,\n                                                   @\"doubleObj\": @[@3.3, @4.4].reverseObjectEnumerator,\n                                                   @\"stringObj\": @[@\"a\", @\"b\"].reverseObjectEnumerator,\n                                                   @\"dateObj\": @[now].reverseObjectEnumerator,\n                                                   @\"dataObj\": @[bytes].reverseObjectEnumerator}];\n    XCTAssertEqual(3U, req.intObj.count);\n    XCTAssertEqual(2U, req.boolObj.count);\n    XCTAssertEqual(2U, req.floatObj.count);\n    XCTAssertEqual(2U, req.doubleObj.count);\n    XCTAssertEqual(2U, req.stringObj.count);\n    XCTAssertEqual(1U, req.dateObj.count);\n    XCTAssertEqual(1U, req.dataObj.count);\n\n    XCTAssertEqualObjects([req.intObj valueForKey:@\"self\"], (@[@3, @2, @1]));\n    XCTAssertEqualObjects([req.boolObj valueForKey:@\"self\"], (@[@NO, @YES]));\n    XCTAssertEqualObjects([req.floatObj valueForKey:@\"self\"], (@[@2.2f, @1.1f]));\n    XCTAssertEqualObjects([req.doubleObj valueForKey:@\"self\"], (@[@4.4, @3.3]));\n    XCTAssertEqualObjects([req.stringObj valueForKey:@\"self\"], (@[@\"b\", @\"a\"]));\n    XCTAssertEqualObjects([req.dateObj valueForKey:@\"self\"], (@[now]));\n    XCTAssertEqualObjects([req.dataObj valueForKey:@\"self\"], (@[bytes]));\n\n    [realm cancelWriteTransaction];\n}\n#endif\n\n- (void)testCreatePrimitiveArraysWithNSNull {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    auto req = [AllPrimitiveArrays createInRealm:realm\n                                       withValue:@{@\"intObj\": NSNull.null,\n                                                   @\"boolObj\": NSNull.null,\n                                                   @\"floatObj\": NSNull.null,\n                                                   @\"doubleObj\": NSNull.null,\n                                                   @\"stringObj\": NSNull.null,\n                                                   @\"dateObj\": NSNull.null,\n                                                   @\"dataObj\": NSNull.null}];\n    XCTAssertEqual(0U, req.intObj.count);\n    XCTAssertEqual(0U, req.boolObj.count);\n    XCTAssertEqual(0U, req.floatObj.count);\n    XCTAssertEqual(0U, req.doubleObj.count);\n    XCTAssertEqual(0U, req.stringObj.count);\n    XCTAssertEqual(0U, req.dateObj.count);\n    XCTAssertEqual(0U, req.dataObj.count);\n}\n\n- (void)testCreatePrimitiveSetsWithNSNull {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    auto req = [AllPrimitiveSets createInRealm:realm\n                                     withValue:@{@\"intObj\": NSNull.null,\n                                                 @\"boolObj\": NSNull.null,\n                                                 @\"floatObj\": NSNull.null,\n                                                 @\"doubleObj\": NSNull.null,\n                                                 @\"stringObj\": NSNull.null,\n                                                 @\"dateObj\": NSNull.null,\n                                                 @\"dataObj\": NSNull.null}];\n    XCTAssertEqual(0U, req.intObj.count);\n    XCTAssertEqual(0U, req.boolObj.count);\n    XCTAssertEqual(0U, req.floatObj.count);\n    XCTAssertEqual(0U, req.doubleObj.count);\n    XCTAssertEqual(0U, req.stringObj.count);\n    XCTAssertEqual(0U, req.dateObj.count);\n    XCTAssertEqual(0U, req.dataObj.count);\n}\n\n- (void)testCreatePrimitiveArraysWithMissingKeys {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    auto req = [AllPrimitiveArrays createInRealm:realm\n                                       withValue:@{@\"intObj\": @[@1, @2, @2],\n                                                   @\"dataObj\": NSNull.null}];\n    XCTAssertEqual(3U, req.intObj.count);\n    XCTAssertEqual(0U, req.boolObj.count);\n    XCTAssertEqual(0U, req.floatObj.count);\n    XCTAssertEqual(0U, req.doubleObj.count);\n    XCTAssertEqual(0U, req.stringObj.count);\n    XCTAssertEqual(0U, req.dateObj.count);\n    XCTAssertEqual(0U, req.dataObj.count);\n}\n\n- (void)testCreatePrimitiveSetsWithMissingKeys {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    auto req = [AllPrimitiveSets createInRealm:realm\n                                     withValue:@{@\"intObj\": @[@1, @2, @2],\n                                                 @\"dataObj\": NSNull.null}];\n    XCTAssertEqual(2U, req.intObj.count);\n    XCTAssertEqual(0U, req.boolObj.count);\n    XCTAssertEqual(0U, req.floatObj.count);\n    XCTAssertEqual(0U, req.doubleObj.count);\n    XCTAssertEqual(0U, req.stringObj.count);\n    XCTAssertEqual(0U, req.dateObj.count);\n    XCTAssertEqual(0U, req.dataObj.count);\n}\n\n- (void)testCreateRequiredPrimitiveArraysWithInvalidValues {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    RLMAssertThrowsWithReason([AllPrimitiveArrays createInRealm:realm\n                                       withValue:@{@\"intObj\": @[NSNull.null]}],\n                             @\"Invalid value '<null>' of type 'NSNull' for 'int' array property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason([AllPrimitiveArrays createInRealm:realm\n                                       withValue:@{@\"intObj\": @[@1.1]}],\n                             @\"Invalid value '1.1' of type '\" RLMConstantDouble \"' for 'int' array property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason([AllPrimitiveArrays createInRealm:realm\n                                       withValue:@{@\"intObj\": @[@\"0\"]}],\n                             @\"Invalid value '0' of type '__NSCFConstantString' for 'int' array property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason([AllPrimitiveArrays createInRealm:realm\n                                       withValue:@{@\"intObj\": @1}],\n                             @\"Invalid value (1) for 'int' array property 'AllPrimitiveArrays.intObj': value is not enumerable.\");\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateRequiredPrimitiveSetsWithInvalidValues {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    RLMAssertThrowsWithReason([AllPrimitiveSets createInRealm:realm\n                                       withValue:@{@\"intObj\": @[NSNull.null]}],\n                             @\"Invalid value '<null>' of type 'NSNull' for 'int' set property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason([AllPrimitiveSets createInRealm:realm\n                                       withValue:@{@\"intObj\": @[@1.1]}],\n                             @\"Invalid value '1.1' of type '\" RLMConstantDouble \"' for 'int' set property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason([AllPrimitiveSets createInRealm:realm\n                                       withValue:@{@\"intObj\": @[@\"0\"]}],\n                             @\"Invalid value '0' of type '\" RLMConstantString \"' for 'int' set property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason([AllPrimitiveSets createInRealm:realm\n                                       withValue:@{@\"intObj\": @1}],\n                             @\"Invalid value (1) for 'int' set property 'AllPrimitiveSets.intObj': value is not enumerable.\");\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateOptionalPrimitiveArrays {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    auto now = [NSDate date];\n    auto bytes = [NSData dataWithBytes:\"a\" length:1];\n    auto req = [AllOptionalPrimitiveArrays createInRealm:realm\n                                               withValue:@{@\"intObj\": @[@1, @2, @3, NSNull.null],\n                                                           @\"boolObj\": @[@YES, @NO, NSNull.null],\n                                                           @\"floatObj\": @[@1.1f, @2.2f, NSNull.null],\n                                                           @\"doubleObj\": @[@3.3, @4.4, NSNull.null],\n                                                           @\"stringObj\": @[@\"a\", @\"b\", NSNull.null],\n                                                           @\"dateObj\": @[now, NSNull.null],\n                                                           @\"dataObj\": @[bytes, NSNull.null],\n                                                           @\"uuidObj\": @[[[NSUUID alloc] initWithUUIDString:@\"137decc8-b300-4954-a233-f89909f4fd89\"], [[NSUUID alloc] initWithUUIDString:@\"00000000-0000-0000-0000-000000000000\"]]}];\n    XCTAssertEqual(4U, req.intObj.count);\n    XCTAssertEqual(3U, req.boolObj.count);\n    XCTAssertEqual(3U, req.floatObj.count);\n    XCTAssertEqual(3U, req.doubleObj.count);\n    XCTAssertEqual(3U, req.stringObj.count);\n    XCTAssertEqual(2U, req.dateObj.count);\n    XCTAssertEqual(2U, req.dataObj.count);\n\n    XCTAssertEqualObjects([req.intObj valueForKey:@\"self\"], (@[@1, @2, @3, NSNull.null]));\n    XCTAssertEqualObjects([req.boolObj valueForKey:@\"self\"], (@[@YES, @NO, NSNull.null]));\n    XCTAssertEqualObjects([req.floatObj valueForKey:@\"self\"], (@[@1.1f, @2.2f, NSNull.null]));\n    XCTAssertEqualObjects([req.doubleObj valueForKey:@\"self\"], (@[@3.3, @4.4, NSNull.null]));\n    XCTAssertEqualObjects([req.stringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\", NSNull.null]));\n    XCTAssertEqualObjects([req.dateObj valueForKey:@\"self\"], (@[now, NSNull.null]));\n    XCTAssertEqualObjects([req.dataObj valueForKey:@\"self\"], (@[bytes, NSNull.null]));\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateOptionalPrimitiveSets {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    auto now = [NSDate date];\n    auto bytes = [NSData dataWithBytes:\"a\" length:1];\n    auto req = [AllOptionalPrimitiveSets createInRealm:realm\n                                             withValue:@{@\"intObj\": @[@1, @2, @3, NSNull.null],\n                                                         @\"boolObj\": @[@YES, @NO, NSNull.null],\n                                                         @\"floatObj\": @[@1.1f, @2.2f, NSNull.null],\n                                                         @\"doubleObj\": @[@3.3, @4.4, NSNull.null],\n                                                         @\"stringObj\": @[@\"a\", @\"b\", NSNull.null],\n                                                         @\"dateObj\": @[now, NSNull.null],\n                                                         @\"dataObj\": @[bytes, NSNull.null]}];\n    XCTAssertEqual(4U, req.intObj.count);\n    XCTAssertEqual(3U, req.boolObj.count);\n    XCTAssertEqual(3U, req.floatObj.count);\n    XCTAssertEqual(3U, req.doubleObj.count);\n    XCTAssertEqual(3U, req.stringObj.count);\n    XCTAssertEqual(2U, req.dateObj.count);\n    XCTAssertEqual(2U, req.dataObj.count);\n\n    XCTAssertEqualObjects([req.intObj valueForKey:@\"self\"], ([NSSet setWithArray:@[NSNull.null, @1, @2, @3]]));\n    XCTAssertEqualObjects([req.boolObj valueForKey:@\"self\"], ([NSSet setWithArray:@[NSNull.null, @NO, @YES]]));\n    XCTAssertEqualObjects([req.floatObj valueForKey:@\"self\"], ([NSSet setWithArray:@[NSNull.null, @1.1f, @2.2f]]));\n    XCTAssertEqualObjects([req.doubleObj valueForKey:@\"self\"], ([NSSet setWithArray:@[NSNull.null, @3.3, @4.4]]));\n    XCTAssertEqualObjects([req.stringObj valueForKey:@\"self\"], ([NSSet setWithArray:@[NSNull.null, @\"a\", @\"b\"]]));\n    XCTAssertEqualObjects([req.dateObj valueForKey:@\"self\"], ([NSSet setWithArray:@[NSNull.null, now]]));\n    XCTAssertEqualObjects([req.dataObj valueForKey:@\"self\"], ([NSSet setWithArray:@[NSNull.null, bytes]]));\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateOptionalPrimitiveArraysWithInvalidValues {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    RLMAssertThrowsWithReasonMatching([AllOptionalPrimitiveArrays createInRealm:realm\n                                                                      withValue:@{@\"intObj\": @[@1.1]}],\n                                      @\"Invalid value '1.1' of type '.*NS.*Number' for 'int\\\\?' array property 'AllOptionalPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason([AllOptionalPrimitiveArrays createInRealm:realm\n                                                              withValue:@{@\"intObj\": @[@\"0\"]}],\n                              @\"Invalid value '0' of type '__NSCFConstantString' for 'int?' array property 'AllOptionalPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason([AllOptionalPrimitiveArrays createInRealm:realm\n                                                              withValue:@{@\"intObj\": @1}],\n                              @\"Invalid value (1) for 'int?' array property 'AllOptionalPrimitiveArrays.intObj': value is not enumerable.\");\n}\n\n- (void)testCreateOptionalPrimitiveSetsWithInvalidValues {\n    auto realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    RLMAssertThrowsWithReason([AllOptionalPrimitiveSets createInRealm:realm\n                                                            withValue:@{@\"intObj\": @[@1.1]}],\n                              @\"Invalid value '1.1' of type '\" RLMConstantDouble \"' for 'int?' set property 'AllOptionalPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason([AllOptionalPrimitiveSets createInRealm:realm\n                                                            withValue:@{@\"intObj\": @[@\"0\"]}],\n                              @\"Invalid value '0' of type '\" RLMConstantString \"' for 'int?' set property 'AllOptionalPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason([AllOptionalPrimitiveSets createInRealm:realm\n                                                            withValue:@{@\"intObj\": @1}],\n                              @\"Invalid value (1) for 'int?' set property 'AllOptionalPrimitiveSets.intObj': value is not enumerable.\");\n}\n\n- (void)testCreateUsesDefaultValuesForMissingDictionaryKeys {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto obj = [NumberDefaultsObject createInRealm:realm withValue:@{}];\n    XCTAssertEqualObjects(obj.intObj, @1);\n    XCTAssertEqualObjects(obj.floatObj, @2.2f);\n    XCTAssertEqualObjects(obj.doubleObj, @3.3);\n    XCTAssertEqualObjects(obj.boolObj, @NO);\n\n    obj = [NumberDefaultsObject createInRealm:realm withValue:@{@\"intObj\": @10}];\n    XCTAssertEqualObjects(obj.intObj, @10);\n    XCTAssertEqualObjects(obj.floatObj, @2.2f);\n    XCTAssertEqualObjects(obj.doubleObj, @3.3);\n    XCTAssertEqualObjects(obj.boolObj, @NO);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateOnManagedObjectInSameRealmShallowCopies {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto so = [StringObject createInRealm:realm withValue:@[@\"str\"]];\n    auto pso = [PrimaryStringObject createInRealm:realm withValue:@[@\"pk\", @1]];\n    auto io = [IntObject createInRealm:realm withValue:@[@2]];\n    auto pio = [PrimaryIntObject createInRealm:realm withValue:@[@3]];\n\n    auto links = [AllLinks createInRealm:realm withValue:@[so, pso, @[io, io], @[pio, pio]]];\n    auto copy = [AllLinks createInRealm:realm withValue:links];\n\n    XCTAssertEqual(2U, [AllLinks allObjectsInRealm:realm].count);\n    XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n    XCTAssertEqual(1U, [PrimaryStringObject allObjectsInRealm:realm].count);\n    XCTAssertEqual(1U, [IntObject allObjectsInRealm:realm].count);\n    XCTAssertEqual(1U, [PrimaryIntObject allObjectsInRealm:realm].count);\n\n    XCTAssertTrue([links.string isEqualToObject:so]);\n    XCTAssertTrue([copy.string isEqualToObject:so]);\n    XCTAssertTrue([links.primaryString isEqualToObject:pso]);\n    XCTAssertTrue([copy.primaryString isEqualToObject:pso]);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateOnManagedObjectInDifferentRealmDeepCopies {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    auto realm2 = [self realmWithTestPath];\n    [realm2 beginWriteTransaction];\n\n    auto so = [StringObject createInRealm:realm withValue:@[@\"str\"]];\n    auto pso = [PrimaryStringObject createInRealm:realm withValue:@[@\"pk\", @1]];\n    auto io = [IntObject createInRealm:realm withValue:@[@2]];\n    auto pio = [PrimaryIntObject createInRealm:realm withValue:@[@3]];\n\n    auto links = [AllLinks createInRealm:realm withValue:@[so, pso, @[io, io], @[pio]]];\n    [AllLinks createInRealm:realm2 withValue:links];\n\n    XCTAssertEqual(1U, [AllLinks allObjectsInRealm:realm2].count);\n    XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm2].count);\n    XCTAssertEqual(1U, [PrimaryStringObject allObjectsInRealm:realm2].count);\n    XCTAssertEqual(2U, [IntObject allObjectsInRealm:realm2].count);\n    XCTAssertEqual(1U, [PrimaryIntObject allObjectsInRealm:realm2].count);\n\n    [realm cancelWriteTransaction];\n    [realm2 cancelWriteTransaction];\n}\n\n- (void)testCreateOnManagedObjectInDifferentRealmDoesntReallyWorkUsefullyWithLinkedPKs {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    auto realm2 = [self realmWithTestPath];\n    [realm2 beginWriteTransaction];\n\n    auto pio = [PrimaryIntObject createInRealm:realm withValue:@[@3]];\n    auto links = [AllLinks createInRealm:realm withValue:@[NSNull.null, NSNull.null, NSNull.null, @[pio, pio]]];\n    RLMAssertThrowsWithReason([AllLinks createInRealm:realm2 withValue:links],\n                              @\"existing primary key value '3'\");\n\n    [realm cancelWriteTransaction];\n    [realm2 cancelWriteTransaction];\n}\n\n- (void)testCreateWithInvalidatedObject {\n    auto realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    auto obj1 = [IntObject createInRealm:realm withValue:@[@0]];\n    auto obj2 = [IntObject createInRealm:realm withValue:@[@1]];\n    id obj1alias = [IntObject allObjectsInRealm:realm].firstObject;\n\n    [realm deleteObject:obj1];\n    RLMAssertThrowsWithReasonMatching([IntObject createInRealm:realm withValue:obj1],\n                                      @\"Object has been deleted or invalidated.\");\n    RLMAssertThrowsWithReasonMatching([IntObject createInRealm:realm withValue:obj1alias],\n                                      @\"Object has been deleted or invalidated.\");\n\n    [realm commitWriteTransaction];\n    [realm invalidate];\n    [realm beginWriteTransaction];\n    RLMAssertThrowsWithReasonMatching([IntObject createInRealm:realm withValue:obj2],\n                                      @\"Object has been deleted or invalidated.\");\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateOutsideWriteTransaction {\n    auto realm = [RLMRealm defaultRealm];\n    RLMAssertThrowsWithReasonMatching([IntObject createInRealm:realm withValue:@[@0]],\n                                      @\"call beginWriteTransaction\");\n}\n\n- (void)testCreateInNilRealm {\n    RLMAssertThrowsWithReasonMatching(([IntObject createInRealm:self.nonLiteralNil withValue:@[@0]]),\n                                      @\"Realm must not be nil\");\n}\n\n- (void)testCreatingObjectWithoutAnyPropertiesWorks {\n    @autoreleasepool {\n        auto realm = [RLMRealm defaultRealm];\n        [realm beginWriteTransaction];\n        [AbstractObject createInRealm:realm withValue:@[]];\n        [realm commitWriteTransaction];\n    }\n    auto realm = [RLMRealm defaultRealm];\n    XCTAssertEqual(1U, [AbstractObject allObjectsInRealm:realm].count);\n}\n\n- (void)testCreateWithNonEnumerableValueForArrayProperty {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    RLMAssertThrowsWithReason(([CompanyObject createInRealm:realm withValue:@[@\"one employee\", @1]]),\n                              @\"Invalid value (1) for 'EmployeeObject' array property 'CompanyObject.employees': value is not enumerable.\");\n    RLMAssertThrowsWithReason(([CompanyObject createInRealm:realm withValue:@[@\"one employee\", @[], @1]]),\n                              @\"Invalid value (1) for 'EmployeeObject' set property 'CompanyObject.employeeSet': value is not enumerable.\");\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateWithNonArrayEnumerableValueForArrayProperty {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto employees = @[@[@\"name\", @2, @YES], @[@\"name 2\", @3, @NO]];\n    auto co = [CompanyObject createInRealm:realm withValue:@[@\"one employee\",\n                                                             employees.reverseObjectEnumerator,\n                                                             employees.reverseObjectEnumerator]];\n    XCTAssertEqual(2U, co.employees.count);\n    XCTAssertEqualObjects(@\"name 2\", co.employees[0].name);\n    XCTAssertEqualObjects(@\"name\", co.employees[1].name);\n    XCTAssertEqual(2U, co.employeeSet.count);\n    XCTAssertTrue([[co.employeeSet valueForKey:@\"name\"] containsObject:@\"name 2\"]);\n    XCTAssertTrue([[co.employeeSet valueForKey:@\"name\"] containsObject:@\"name\"]);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateWithCustomAccessors {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    // Create with array\n    auto ca = [CustomAccessorsObject createInRealm:realm withValue:@[@\"a\", @1]];\n    XCTAssertEqualObjects(ca.name, @\"a\");\n    XCTAssertEqual(ca.age, 1);\n\n    // Create with dictionary\n    ca = [CustomAccessorsObject createInRealm:realm withValue:@{@\"name\": @\"b\", @\"age\": @2}];\n    XCTAssertEqualObjects(ca.name, @\"b\");\n    XCTAssertEqual(ca.age, 2);\n\n    // Create with KVC-compatible object\n    auto ca2 = [CustomAccessorsObject createInRealm:realm withValue:ca];\n    XCTAssertEqualObjects(ca2.name, @\"b\");\n    XCTAssertEqual(ca2.age, 2);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateWithRenamedColumns {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    // Create with array\n    auto obj = [RenamedProperties1 createInRealm:realm withValue:@[@1, @\"a\"]];\n    XCTAssertEqual(obj.propA, 1);\n    XCTAssertEqualObjects(obj.propB, @\"a\");\n\n    // Create with dictionary\n    obj = [RenamedProperties1 createInRealm:realm withValue:@{@\"propB\": @\"b\", @\"propA\": @2}];\n    XCTAssertEqual(obj.propA, 2);\n    XCTAssertEqualObjects(obj.propB, @\"b\");\n\n    // Create with KVC-compatible object\n    obj = [RenamedProperties1 createInRealm:realm withValue:obj];\n    XCTAssertEqual(obj.propA, 2);\n    XCTAssertEqualObjects(obj.propB, @\"b\");\n\n    // Verify that they're all readable via the other class\n    RLMResults<RenamedProperties2 *> *results = [RenamedProperties2 allObjectsInRealm:realm];\n    XCTAssertEqual(results[0].propC, 1);\n    XCTAssertEqualObjects(results[0].propD, @\"a\");\n    XCTAssertEqual(results[1].propC, 2);\n    XCTAssertEqualObjects(results[1].propD, @\"b\");\n    XCTAssertEqual(results[2].propC, 2);\n    XCTAssertEqualObjects(results[2].propD, @\"b\");\n\n    [realm cancelWriteTransaction];\n}\n\n#pragma mark - Create Or Update\n\n- (void)testCreateOrUpdateWithoutPKThrows {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    RLMAssertThrowsWithReason([DogObject createOrUpdateInRealm:realm withValue:@[]],\n                              @\"'DogObject' does not have a primary key\");\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateOrUpdateUpdatesExistingItemWithSamePK {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto so = [PrimaryStringObject createOrUpdateInRealm:realm withValue:@[@\"pk\", @2]];\n    XCTAssertEqual(1U, [PrimaryStringObject allObjectsInRealm:realm].count);\n    XCTAssertEqual(so.intCol, 2);\n\n    auto so2 = [PrimaryStringObject createOrUpdateInRealm:realm withValue:@[@\"pk\", @3]];\n    XCTAssertEqual(1U, [PrimaryStringObject allObjectsInRealm:realm].count);\n    XCTAssertEqual(so.intCol, 3);\n    XCTAssertEqualObjects(so, so2);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateOrUpdateWithNullPrimaryKey {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    [PrimaryNullableStringObject createOrUpdateInRealm:realm withValue:@{@\"intCol\": @5}];\n    [PrimaryNullableStringObject createOrUpdateInRealm:realm withValue:@{@\"intCol\": @7}];\n    XCTAssertEqual([PrimaryNullableStringObject objectInRealm:realm forPrimaryKey:NSNull.null].intCol, 7);\n    [PrimaryNullableStringObject createOrUpdateInRealm:realm withValue:@{@\"stringCol\": NSNull.null, @\"intCol\": @11}];\n    XCTAssertEqual([PrimaryNullableStringObject objectInRealm:realm forPrimaryKey:nil].intCol, 11);\n\n    [PrimaryNullableIntObject createOrUpdateInRealm:realm withValue:@{@\"value\": @5}];\n    [PrimaryNullableIntObject createOrUpdateInRealm:realm withValue:@{@\"value\": @7}];\n    XCTAssertEqual([PrimaryNullableIntObject objectInRealm:realm forPrimaryKey:NSNull.null].value, 7);\n    [PrimaryNullableIntObject createOrUpdateInRealm:realm withValue:@{@\"optIntCol\": NSNull.null, @\"value\": @11}];\n    XCTAssertEqual([PrimaryNullableIntObject objectInRealm:realm forPrimaryKey:nil].value, 11);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateOrUpdateDoesNotModifyKeysNotPresent {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto so = [PrimaryStringObject createOrUpdateInRealm:realm withValue:@[@\"pk\", @2]];\n    auto so2 = [PrimaryStringObject createOrUpdateInRealm:realm withValue:@{@\"stringCol\": @\"pk\"}];\n    XCTAssertEqual(1U, [PrimaryStringObject allObjectsInRealm:realm].count);\n    XCTAssertEqual(so.intCol, 2);\n    XCTAssertEqual(so2.intCol, 2);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateOrUpdateDoesNotReplaceExistingValuesWithDefaults {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto so = [PrimaryKeyWithDefault createInRealm:realm withValue:@[@\"pk\", @2]];\n    [PrimaryKeyWithDefault createOrUpdateInRealm:realm withValue:@{@\"stringCol\": @\"pk\"}];\n    XCTAssertEqual(so.intCol, 2);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateOrUpdateReplacesExistingArrayPropertiesAndDoesNotMergeThem {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto obj = [AllLinksWithPrimary createInRealm:realm withValue:@[@\"pk\", @[@\"str\"],\n                                                                    @[@\"str pk\", @5],\n                                                                    @[@[@1], @[@2], @[@3]]]];\n    [AllLinksWithPrimary createOrUpdateInRealm:realm withValue:@[@\"pk\", @[@\"str\"],\n                                                                 @[@\"str pk\", @6],\n                                                                 @[@[@4]]]];\n    XCTAssertEqual(1U, obj.intArray.count);\n    XCTAssertEqual(4, obj.intArray[0].intCol);\n    XCTAssertEqual(6, obj.primaryString.intCol);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateOrUpdateReusesExistingLinkedObjectsWithPrimaryKeys {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    [AllLinksWithPrimary createInRealm:realm withValue:@[@\"pk\", NSNull.null,\n                                                         @[@\"str pk\", @5]]];\n    [AllLinksWithPrimary createOrUpdateInRealm:realm withValue:@[@\"pk\", NSNull.null,\n                                                                 @{@\"stringCol\": @\"str pk\"}]];\n    XCTAssertEqual(1U, [PrimaryStringObject allObjectsInRealm:realm].count);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateOrUpdateCreatesNewLinkedObjectsWithoutPrimaryKeys {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    [AllLinksWithPrimary createInRealm:realm withValue:@[@\"pk\", @[@\"str\"]]];\n    [AllLinksWithPrimary createOrUpdateInRealm:realm withValue:@[@\"pk\", @[@\"str\"]]];\n    XCTAssertEqual(2U, [StringObject allObjectsInRealm:realm].count);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateOrUpdateWithMissingValuesAndNoExistingObject {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    RLMAssertThrowsWithReason([PrimaryStringObject createOrUpdateInRealm:realm withValue:@{@\"stringCol\": @\"pk\"}],\n                              @\"Missing value for property 'PrimaryStringObject.intCol'\");\n    RLMAssertThrowsWithReason(([PrimaryStringObject createOrUpdateInRealm:realm\n                                                                withValue:@{@\"stringCol\": @\"pk\",\n                                                                            @\"intCol\": NSNull.null}]),\n                              @\"Invalid value '<null>' of type 'NSNull' for 'int' property 'PrimaryStringObject.intCol'\");\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateOrUpdateOnManagedObjectInSameRealmReturnsExistingObjectInstance {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto so = [PrimaryStringObject createOrUpdateInRealm:realm withValue:@[@\"pk\", @2]];\n    auto so2 = [PrimaryStringObject createOrUpdateInRealm:realm withValue:so];\n    XCTAssertEqual(so, so2);\n    XCTAssertEqual(1U, [PrimaryStringObject allObjectsInRealm:realm].count);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateOrUpdateOnManagedObjectInDifferentRealmDeepCopies {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    auto realm2 = [self realmWithTestPath];\n    [realm2 beginWriteTransaction];\n\n    auto so = [StringObject createInRealm:realm withValue:@[@\"str\"]];\n    auto pso = [PrimaryStringObject createInRealm:realm withValue:@[@\"pk\", @1]];\n    auto io = [IntObject createInRealm:realm withValue:@[@2]];\n    auto pio = [PrimaryIntObject createInRealm:realm withValue:@[@3]];\n\n    auto links = [AllLinksWithPrimary createInRealm:realm withValue:@[@\"pk\", so, pso, @[io, io], @[pio, pio]]];\n    auto copy = [AllLinksWithPrimary createOrUpdateInRealm:realm2 withValue:links];\n\n    XCTAssertEqual(1U, [AllLinksWithPrimary allObjectsInRealm:realm2].count);\n    XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm2].count);\n    XCTAssertEqual(1U, [PrimaryStringObject allObjectsInRealm:realm2].count);\n    XCTAssertEqual(2U, [IntObject allObjectsInRealm:realm2].count);\n    XCTAssertEqual(1U, [PrimaryIntObject allObjectsInRealm:realm2].count);\n\n    XCTAssertEqualObjects(so.stringCol, copy.string.stringCol);\n    XCTAssertEqualObjects(pso.stringCol, copy.primaryString.stringCol);\n    XCTAssertEqual(pso.intCol, copy.primaryString.intCol);\n    XCTAssertEqual(2U, copy.intArray.count);\n    XCTAssertEqual(2U, copy.primaryIntArray.count);\n\n    [realm cancelWriteTransaction];\n    [realm2 cancelWriteTransaction];\n}\n\n- (void)testCreateOrUpdateWithNilValues {\n    auto now = [NSDate date];\n    auto bytes = [NSData dataWithBytes:\"a\" length:1];\n    auto nonnull = [[AllOptionalTypesPK alloc] initWithValue:@[@0, @1, @2.2f, @3.3, @YES, @\"a\", bytes, now]];\n    auto null = [[AllOptionalTypesPK alloc] initWithValue:@[@0]];\n\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto obj = [AllOptionalTypesPK createInRealm:realm withValue:nonnull];\n    [AllOptionalTypesPK createOrUpdateInRealm:realm withValue:null];\n\n    XCTAssertNil(obj.intObj);\n    XCTAssertNil(obj.floatObj);\n    XCTAssertNil(obj.doubleObj);\n    XCTAssertNil(obj.boolObj);\n    XCTAssertNil(obj.string);\n    XCTAssertNil(obj.data);\n    XCTAssertNil(obj.date);\n\n    [AllOptionalTypesPK createOrUpdateInRealm:realm withValue:nonnull];\n    [AllOptionalTypesPK createOrUpdateInRealm:realm withValue:@[@0]];\n\n    // No values specified, so old values should remain\n    XCTAssertNotNil(obj.intObj);\n    XCTAssertNotNil(obj.floatObj);\n    XCTAssertNotNil(obj.doubleObj);\n    XCTAssertNotNil(obj.boolObj);\n    XCTAssertNotNil(obj.string);\n    XCTAssertNotNil(obj.data);\n    XCTAssertNotNil(obj.date);\n\n    [AllOptionalTypesPK createOrUpdateInRealm:realm withValue:@{@\"pk\": @0}];\n    XCTAssertNotNil(obj.intObj);\n    XCTAssertNotNil(obj.floatObj);\n    XCTAssertNotNil(obj.doubleObj);\n    XCTAssertNotNil(obj.boolObj);\n    XCTAssertNotNil(obj.string);\n    XCTAssertNotNil(obj.data);\n    XCTAssertNotNil(obj.date);\n\n    [AllOptionalTypesPK createOrUpdateInRealm:realm withValue:@{@\"pk\": @0,\n                                                                @\"intObj\": NSNull.null,\n                                                                @\"floatObj\": NSNull.null,\n                                                                @\"doubleObj\": NSNull.null,\n                                                                @\"boolObj\": NSNull.null,\n                                                                @\"string\": NSNull.null,\n                                                                @\"data\": NSNull.null,\n                                                                @\"date\": NSNull.null,\n                                                                }];\n    XCTAssertNil(obj.intObj);\n    XCTAssertNil(obj.floatObj);\n    XCTAssertNil(obj.doubleObj);\n    XCTAssertNil(obj.boolObj);\n    XCTAssertNil(obj.string);\n    XCTAssertNil(obj.data);\n    XCTAssertNil(obj.date);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCreateOrUpdateWithRenamedPrimaryKey {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto obj = [RenamedPrimaryKey createInRealm:realm withValue:@[@1, @2]];\n    [RenamedPrimaryKey createOrUpdateInRealm:realm withValue:@[@1, @3]];\n    XCTAssertEqual(obj.pk, 1);\n    XCTAssertEqual(obj.value, 3);\n\n    [RenamedPrimaryKey createOrUpdateInRealm:realm withValue:@{@\"pk\": @1, @\"value\": @4}];\n    XCTAssertEqual(obj.value, 4);\n\n    [realm cancelWriteTransaction];\n}\n\n#pragma mark - Add\n\n- (void)testAddInvalidated {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    id dog = [DogObject createInRealm:realm withValue:@[@\"name\", @1]];\n    id dog2 = [DogObject allObjectsInRealm:realm].firstObject;\n    [realm deleteObject:dog];\n    RLMAssertThrowsWithReason([realm addObject:dog],\n                              @\"Adding a deleted or invalidated\");\n    RLMAssertThrowsWithReason([realm addObject:dog2],\n                              @\"Adding a deleted or invalidated\");\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAddDuplicatePrimaryKey {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    [realm addObject:[[PrimaryStringObject alloc] initWithValue:@[@\"pk\", @1]]];\n    RLMAssertThrowsWithReason(([realm addObject:[[PrimaryStringObject alloc] initWithValue:@[@\"pk\", @1]]]),\n                              @\"existing primary key value 'pk'\");\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAddNested {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto co = [[CompanyObject alloc] initWithValue:@[@\"one employee\",\n                                                     @[@[@\"name\", @2, @YES]]]];\n    [realm addObject:co];\n    XCTAssertEqual(co.realm, realm);\n    XCTAssertEqualObjects(co.name, @\"one employee\");\n\n    auto eo = co.employees[0];\n    XCTAssertEqual(eo.realm, realm);\n    XCTAssertEqualObjects(eo.name, @\"name\");\n\n    eo = [[EmployeeObject alloc] initWithValue:@[@\"name 2\", @3, @NO]];\n    co = [[CompanyObject alloc] initWithValue:@[@\"one employee\", @[eo]]];\n\n    [realm addObject:co];\n    XCTAssertEqual(co.realm, realm);\n    XCTAssertEqual(eo.realm, realm);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAddingObjectWithoutAnyPropertiesWorks {\n    @autoreleasepool {\n        auto realm = [RLMRealm defaultRealm];\n        [realm beginWriteTransaction];\n        [realm addObject:[[AbstractObject alloc] initWithValue:@[]]];\n        [realm commitWriteTransaction];\n    }\n    auto realm = [RLMRealm defaultRealm];\n    XCTAssertEqual(1U, [AbstractObject allObjectsInRealm:realm].count);\n}\n\n- (void)testAddWithCustomAccessors {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto ca = [[CustomAccessorsObject alloc] initWithValue:@[@\"a\", @1]];\n    [realm addObject:ca];\n    XCTAssertEqualObjects(ca.name, @\"a\");\n    XCTAssertEqual(ca.age, 1);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAddWithRenamedColumns {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto obj = [[RenamedProperties1 alloc] initWithValue:@[@1, @\"a\"]];\n    [realm addObject:obj];\n    XCTAssertEqual(obj.propA, 1);\n    XCTAssertEqualObjects(obj.propB, @\"a\");\n\n    RLMResults<RenamedProperties2 *> *results = [RenamedProperties2 allObjectsInRealm:realm];\n    XCTAssertEqual(results[0].propC, 1);\n    XCTAssertEqualObjects(results[0].propD, @\"a\");\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAddToCurrentRealmIsNoOp {\n    DogObject *dog = [[DogObject alloc] init];\n\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    [realm addObject:dog];\n    XCTAssertEqual(dog.realm, realm);\n    XCTAssertEqual(1U, [DogObject allObjectsInRealm:realm].count);\n\n    XCTAssertNoThrow([realm addObject:dog]);\n    XCTAssertEqual(dog.realm, realm);\n    XCTAssertEqual(1U, [DogObject allObjectsInRealm:realm].count);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAddToDifferentRealmThrows {\n    auto eo = [[EmployeeObject alloc] init];\n\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    [realm addObject:eo];\n\n    auto realm2 = [self realmWithTestPath];\n    [realm2 beginWriteTransaction];\n\n    RLMAssertThrowsWithReason([realm2 addObject:eo],\n                              @\"Object is already managed by another Realm. Use create instead to copy it into this Realm.\");\n    XCTAssertEqual(eo.realm, realm);\n\n    auto co = [CompanyObject new];\n    [co.employees addObject:eo];\n    RLMAssertThrowsWithReason([realm2 addObject:co],\n                              @\"Object is already managed by another Realm. Use create instead to copy it into this Realm.\");\n    XCTAssertEqual(co.realm, realm2);\n\n    [realm cancelWriteTransaction];\n    [realm2 cancelWriteTransaction];\n}\n\n- (void)testAddToCurrentRealmChecksForWrite {\n    DogObject *dog = [[DogObject alloc] init];\n\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    [realm addObject:dog];\n    [realm commitWriteTransaction];\n\n    RLMAssertThrowsWithReason([realm addObject:dog],\n                              @\"call beginWriteTransaction\");\n}\n\n- (void)testAddObjectWithObserver {\n    DogObject *dog = [[DogObject alloc] init];\n    [dog addObserver:self forKeyPath:@\"name\" options:(NSKeyValueObservingOptions)0 context:0];\n\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    RLMAssertThrowsWithReason([realm addObject:dog],\n                              @\"Cannot add an object with observers to a Realm\");\n    [realm cancelWriteTransaction];\n    [dog removeObserver:self forKeyPath:@\"name\"];\n}\n\n- (void)testAddObjectWithNilValueForRequiredProperty {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    RLMAssertThrowsWithReason([realm addObject:[[RequiredPropertiesObject alloc] init]],\n                              @\"Invalid value '<null>' of type 'NSNull' for 'string' property 'RequiredPropertiesObject.stringCol'.\");\n    [realm cancelWriteTransaction];\n}\n\n#pragma mark - Add Or Update\n\n- (void)testAddOrUpdateWithoutPKThrows {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    RLMAssertThrowsWithReason([realm addOrUpdateObject:[DogObject new]],\n                              @\"'DogObject' does not have a primary key\");\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAddOrUpdateUpdatesExistingItemWithSamePK {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    auto so1 = [[PrimaryStringObject alloc] initWithValue:@[@\"pk\", @2]];\n    auto so2 = [[PrimaryStringObject alloc] initWithValue:@[@\"pk\", @3]];\n\n    [realm addOrUpdateObject:so1];\n    XCTAssertEqual(1U, [PrimaryStringObject allObjectsInRealm:realm].count);\n    XCTAssertEqual(so1.intCol, 2);\n\n    [realm addOrUpdateObject:so2];\n    XCTAssertEqual(1U, [PrimaryStringObject allObjectsInRealm:realm].count);\n    XCTAssertEqual(so1.intCol, 3);\n    XCTAssertEqualObjects(so1, so2);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAddOrUpdateWithNullPrimaryKey {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    auto so1 = [[PrimaryNullableStringObject alloc] initWithValue:@{@\"intCol\": @5}];\n    auto so2 = [[PrimaryNullableStringObject alloc] initWithValue:@{@\"intCol\": @7}];\n\n    XCTAssertNil([PrimaryNullableStringObject objectInRealm:realm forPrimaryKey:NSNull.null]);\n    XCTAssertNil([PrimaryNullableStringObject objectInRealm:realm forPrimaryKey:nil]);\n\n    [realm addOrUpdateObject:so1];\n    XCTAssertEqual([PrimaryNullableStringObject objectInRealm:realm forPrimaryKey:NSNull.null].intCol, 5);\n    XCTAssertEqual([PrimaryNullableStringObject objectInRealm:realm forPrimaryKey:nil].intCol, 5);\n\n    [realm addOrUpdateObject:so2];\n    XCTAssertEqual([PrimaryNullableStringObject objectInRealm:realm forPrimaryKey:NSNull.null].intCol, 7);\n    XCTAssertEqual([PrimaryNullableStringObject objectInRealm:realm forPrimaryKey:nil].intCol, 7);\n\n    auto io1 = [[PrimaryNullableIntObject alloc] initWithValue:@{@\"value\": @5}];\n    auto io2 = [[PrimaryNullableIntObject alloc] initWithValue:@{@\"value\": @7}];\n\n    XCTAssertNil([PrimaryNullableIntObject objectInRealm:realm forPrimaryKey:NSNull.null]);\n    XCTAssertNil([PrimaryNullableIntObject objectInRealm:realm forPrimaryKey:nil]);\n\n    [realm addOrUpdateObject:io1];\n    XCTAssertEqual([PrimaryNullableIntObject objectInRealm:realm forPrimaryKey:NSNull.null].value, 5);\n    XCTAssertEqual([PrimaryNullableIntObject objectInRealm:realm forPrimaryKey:nil].value, 5);\n\n    [realm addOrUpdateObject:io2];\n    XCTAssertEqual([PrimaryNullableIntObject objectInRealm:realm forPrimaryKey:NSNull.null].value, 7);\n    XCTAssertEqual([PrimaryNullableIntObject objectInRealm:realm forPrimaryKey:nil].value, 7);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAddOrUpdateDoesNotHaveAnyConceptOfKeysNotPresentThatShouldBeLeftAlone {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto obj1 = [[PrimaryKeyWithDefault alloc] initWithValue:@[@\"pk\", @2]];\n    auto obj2 = [[PrimaryKeyWithDefault alloc] initWithValue:@[@\"pk\"]];\n    [realm addOrUpdateObject:obj1];\n    [realm addOrUpdateObject:obj2];\n    XCTAssertEqual(obj1.intCol, 10);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAddObjectWithNilValueForRequiredPropertyDoesNotUseExistingValue {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    [PrimaryKeyAndRequiredString createInRealm:realm withValue:@[@0, @\"value\"]];\n    RLMAssertThrowsWithReason([realm addOrUpdateObject:[[PrimaryKeyAndRequiredString alloc] init]],\n                              @\"Invalid value '<null>' of type 'NSNull' for 'string' property 'PrimaryKeyAndRequiredString.value'\");\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAddOrUpdateWithDuplicateConflictingValuesForPrimaryKeyInArrayProperty {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto company = [[PrimaryCompanyObject alloc] init];\n    [company.employees addObject:[[PrimaryEmployeeObject alloc] initWithValue:@[@\"a\", @1, @NO]]];\n    [company.employees addObject:[[PrimaryEmployeeObject alloc] initWithValue:@[@\"a\", @2, @NO]]];\n    [company.employeeSet addObject:[[PrimaryEmployeeObject alloc] initWithValue:@[@\"a\", @1, @NO]]];\n    [company.employeeSet addObject:[[PrimaryEmployeeObject alloc] initWithValue:@[@\"a\", @2, @NO]]];\n    [realm addOrUpdateObject:company];\n\n    XCTAssertEqual(1U, [PrimaryEmployeeObject allObjectsInRealm:realm].count);\n    XCTAssertEqual(2, company.employees[0].age);\n    XCTAssertEqual(2, company.employees[1].age);\n    XCTAssertEqualObjects(company.employees[0], company.employees[1]);\n    XCTAssertEqual(2, company.employeeSet.allObjects[0].age);\n    XCTAssertEqualObjects(company.employeeSet.allObjects[0], company.employeeSet.allObjects.lastObject);\n}\n\n- (void)testAddOrUpdateReplacesExistingArrayPropertiesAndDoesNotMergeThem {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto obj1 = [[AllLinksWithPrimary alloc] initWithValue:@[@\"pk\", @[@\"str\"],\n                                                             @[@\"str pk\", @5],\n                                                             @[@[@1], @[@2], @[@3]],\n                                                             @[],\n                                                             @[@[@1], @[@2], @[@3]]]];\n    auto obj2 = [[AllLinksWithPrimary alloc] initWithValue:@[@\"pk\", @[@\"str\"],\n                                                             @[@\"str pk\", @6],\n                                                             @[@[@4]],\n                                                             @[],\n                                                             @[@[@4]]]];\n    [realm addOrUpdateObject:obj1];\n    [realm addOrUpdateObject:obj2];\n    XCTAssertEqual(1U, obj1.intArray.count);\n    XCTAssertEqual(4, obj1.intArray[0].intCol);\n    XCTAssertEqual(1U, obj1.intSet.count);\n    XCTAssertEqual(4, obj1.intSet.allObjects[0].intCol);\n    XCTAssertEqual(6, obj1.primaryString.intCol);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAddOrUpdateReusesExistingLinkedObjectsWithPrimaryKeys {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto obj1 = [[AllLinksWithPrimary alloc] initWithValue:@[@\"pk\", NSNull.null,\n                                                             @[@\"str pk\", @5]]];\n    auto obj2 = [[AllLinksWithPrimary alloc] initWithValue:@[@\"pk\", NSNull.null,\n                                                             @{@\"stringCol\": @\"str pk\"}]];\n\n    [realm addOrUpdateObject:obj1];\n    [realm addOrUpdateObject:obj2];\n    XCTAssertEqual(1U, [PrimaryStringObject allObjectsInRealm:realm].count);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAddOrUpdateAddsNewLinkedObjectsWithoutPrimaryKeys {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto obj1 = [[AllLinksWithPrimary alloc] initWithValue:@[@\"pk\", @[@\"str\"]]];\n    auto obj2 = [[AllLinksWithPrimary alloc] initWithValue:@[@\"pk\", @[@\"str\"]]];\n\n    [realm addOrUpdateObject:obj1];\n    [realm addOrUpdateObject:obj2];\n    XCTAssertEqual(2U, [StringObject allObjectsInRealm:realm].count);\n    XCTAssertFalse([obj1.string isEqualToObject:[StringObject allObjectsInRealm:realm][0]]);\n    XCTAssertTrue([obj1.string isEqualToObject:[StringObject allObjectsInRealm:realm][1]]);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAddOrUpdateOnManagedObjectInSameRealmIsNoOp {\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto so = [PrimaryStringObject createOrUpdateInRealm:realm withValue:@[@\"pk\", @2]];\n    XCTAssertNoThrow([realm addOrUpdateObject:so]);\n    XCTAssertEqual(1U, [PrimaryStringObject allObjectsInRealm:realm].count);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAddOrUpdateOnManagedObjectInDifferentRealmThrows {\n    auto eo = [[PrimaryEmployeeObject alloc] init];\n\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    [realm addObject:eo];\n\n    auto realm2 = [self realmWithTestPath];\n    [realm2 beginWriteTransaction];\n\n    RLMAssertThrowsWithReason([realm2 addOrUpdateObject:eo],\n                              @\"Object is already managed by another Realm. Use create instead to copy it into this Realm.\");\n    XCTAssertEqual(eo.realm, realm);\n\n    auto co = [PrimaryCompanyObject new];\n    [co.employees addObject:eo];\n    RLMAssertThrowsWithReason([realm2 addOrUpdateObject:co],\n                              @\"Object is already managed by another Realm. Use create instead to copy it into this Realm.\");\n    XCTAssertEqual(co.realm, realm2);\n\n    [realm cancelWriteTransaction];\n    [realm2 cancelWriteTransaction];\n}\n\n- (void)testAddOrUpdateWithNilValues {\n    auto now = [NSDate date];\n    auto bytes = [NSData dataWithBytes:\"a\" length:1];\n    auto nonnull = [[AllOptionalTypesPK alloc] initWithValue:@[@0, @1, @2.2f, @3.3, @YES, @\"a\", bytes, now]];\n    auto null = [[AllOptionalTypesPK alloc] initWithValue:@[@0]];\n\n    auto realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    auto obj = [AllOptionalTypesPK createInRealm:realm withValue:nonnull];\n    auto nullobj = [[AllOptionalTypesPK alloc] initWithValue:null];\n    [realm addOrUpdateObject:nullobj];\n\n    XCTAssertNil(obj.intObj);\n    XCTAssertNil(obj.floatObj);\n    XCTAssertNil(obj.doubleObj);\n    XCTAssertNil(obj.boolObj);\n    XCTAssertNil(obj.string);\n    XCTAssertNil(obj.data);\n    XCTAssertNil(obj.date);\n\n    [realm cancelWriteTransaction];\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/ObjectIdTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n#import <Realm/RLMObjectId.h>\n\n@interface ObjectIdTests : RLMTestCase\n@end\n\n@implementation ObjectIdTests\n\n#pragma mark - Initialization\n\n- (void)testObjectIdInitialization {\n    NSString *strValue = @\"000123450000ffbeef91906c\";\n    RLMObjectId *objectId = [[RLMObjectId alloc] initWithString:strValue error:nil];\n    XCTAssertTrue([objectId.stringValue isEqualToString:strValue]);\n    XCTAssertTrue([strValue isEqualToString:objectId.stringValue]);\n\n    NSDate *now = [NSDate date];\n    RLMObjectId *objectId2 = [[RLMObjectId alloc] initWithTimestamp:now\n                                                  machineIdentifier:10\n                                                  processIdentifier:20];\n    XCTAssertEqual((int)now.timeIntervalSince1970, objectId2.timestamp.timeIntervalSince1970);\n}\n\n- (void)testObjectIdComparision {\n    NSString *strValue = @\"000123450000ffbeef91906c\";\n    RLMObjectId *objectId = [[RLMObjectId alloc] initWithString:strValue error:nil];\n\n    NSString *strValue2 = @\"000123450000ffbeef91906d\";\n    RLMObjectId *objectId2 = [[RLMObjectId alloc] initWithString:strValue2 error:nil];\n\n    NSString *strValue3 = @\"000123450000ffbeef91906c\";\n    RLMObjectId *objectId3 = [[RLMObjectId alloc] initWithString:strValue3 error:nil];\n\n    XCTAssertFalse([objectId isEqual:objectId2]);\n    XCTAssertTrue([objectId isEqual:objectId3]);\n}\n\n- (void)testObjectIdGreaterThan {\n    NSString *strValue = @\"000123450000ffbeef91906c\";\n    RLMObjectId *objectId = [[RLMObjectId alloc] initWithString:strValue error:nil];\n\n    NSString *strValue2 = @\"000154850000ffbaaf20906d\";\n    RLMObjectId *objectId2 = [[RLMObjectId alloc] initWithString:strValue2 error:nil];\n\n    NSString *strValue3 = @\"000123450000ffbeef91906c\";\n    RLMObjectId *objectId3 = [[RLMObjectId alloc] initWithString:strValue3 error:nil];\n\n    XCTAssertTrue([objectId2 isGreaterThan:objectId]);\n    XCTAssertFalse([objectId isGreaterThan:objectId3]);\n}\n\n- (void)testObjectIdGreaterThanOrEqualTo {\n    NSString *strValue = @\"000123450000ffbeef91906c\";\n    RLMObjectId *objectId = [[RLMObjectId alloc] initWithString:strValue error:nil];\n\n    NSString *strValue2 = @\"000154850000ffbaaf20906d\";\n    RLMObjectId *objectId2 = [[RLMObjectId alloc] initWithString:strValue2 error:nil];\n\n    NSString *strValue3 = @\"000123450000ffbeef91906c\";\n    RLMObjectId *objectId3 = [[RLMObjectId alloc] initWithString:strValue3 error:nil];\n\n    XCTAssertTrue([objectId2 isGreaterThanOrEqualTo:objectId]);\n    XCTAssertTrue([objectId isGreaterThanOrEqualTo:objectId3]);\n}\n\n- (void)testObjectIdLessThan {\n    NSString *strValue = @\"000123450000ffbeef91906c\";\n    RLMObjectId *objectId = [[RLMObjectId alloc] initWithString:strValue error:nil];\n\n    NSString *strValue2 = @\"000154850000ffbaaf20906d\";\n    RLMObjectId *objectId2 = [[RLMObjectId alloc] initWithString:strValue2 error:nil];\n\n    NSString *strValue3 = @\"000123450000ffbeef91906c\";\n    RLMObjectId *objectId3 = [[RLMObjectId alloc] initWithString:strValue3 error:nil];\n\n    XCTAssertTrue([objectId isLessThan:objectId2]);\n    XCTAssertFalse([objectId isLessThan:objectId3]);\n}\n\n- (void)testObjectIdLessThanOrEqualTo {\n    NSString *strValue = @\"000123450000ffbeef91906c\";\n    RLMObjectId *objectId = [[RLMObjectId alloc] initWithString:strValue error:nil];\n\n    NSString *strValue2 = @\"000154850000ffbaaf20906d\";\n    RLMObjectId *objectId2 = [[RLMObjectId alloc] initWithString:strValue2 error:nil];\n\n    NSString *strValue3 = @\"000123450000ffbeef91906c\";\n    RLMObjectId *objectId3 = [[RLMObjectId alloc] initWithString:strValue3 error:nil];\n\n    XCTAssertTrue([objectId isLessThanOrEqualTo:objectId2]);\n    XCTAssertTrue([objectId isLessThanOrEqualTo:objectId3]);\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/ObjectInterfaceTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#pragma mark - Test Objects\n\n@interface PrimaryKeyWithLinkObject : RLMObject\n@property NSString *primaryKey;\n@property StringObject *string;\n@end\n\n@implementation PrimaryKeyWithLinkObject\n+ (NSString *)primaryKey {\n    return @\"primaryKey\";\n}\n@end\n\n#pragma mark - Tests\n\n@interface ObjectInterfaceTests : RLMTestCase\n@end\n\n@implementation ObjectInterfaceTests\n\n- (void)testCustomAccessorsObject {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    CustomAccessorsObject *ca = [CustomAccessorsObject createInRealm:realm withValue:@[@\"name\", @2]];\n    XCTAssertEqualObjects(ca.name, @\"name\");\n    XCTAssertEqualObjects([ca getThatName], @\"name\");\n    XCTAssertEqual(ca.age, 2);\n    XCTAssertEqual([ca age], 2);\n\n    [ca setTheInt:99];\n    XCTAssertEqual(ca.age, 99);\n    XCTAssertEqual([ca age], 99);\n    [realm cancelWriteTransaction];\n}\n\n- (void)testClassExtension {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    BaseClassStringObject *bObject = [[BaseClassStringObject alloc ] init];\n    bObject.intCol = 1;\n    bObject.stringCol = @\"stringVal\";\n    [realm addObject:bObject];\n    [realm commitWriteTransaction];\n\n    BaseClassStringObject *objectFromRealm = [BaseClassStringObject allObjects][0];\n    XCTAssertEqual(1, objectFromRealm.intCol, @\"Should be 1\");\n    XCTAssertEqualObjects(@\"stringVal\", objectFromRealm.stringCol, @\"Should be stringVal\");\n}\n\n- (void)testNSNumberProperties {\n    NumberObject *obj = [NumberObject new];\n    obj.intObj = @20;\n    obj.floatObj = @0.7f;\n    obj.doubleObj = @33.3;\n    obj.boolObj = @YES;\n    XCTAssertEqualObjects(@20, obj.intObj);\n    XCTAssertEqualObjects(@0.7f, obj.floatObj);\n    XCTAssertEqualObjects(@33.3, obj.doubleObj);\n    XCTAssertEqualObjects(@YES, obj.boolObj);\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    [realm addObject:obj];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqualObjects(@20, obj.intObj);\n    XCTAssertEqualObjects(@0.7f, obj.floatObj);\n    XCTAssertEqualObjects(@33.3, obj.doubleObj);\n    XCTAssertEqualObjects(@YES, obj.boolObj);\n}\n\n- (void)testOptionalStringProperties {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    StringObject *so = [[StringObject alloc] init];\n\n    XCTAssertNil(so.stringCol);\n    XCTAssertNil([so valueForKey:@\"stringCol\"]);\n    XCTAssertNil(so[@\"stringCol\"]);\n\n    so.stringCol = @\"a\";\n    XCTAssertEqualObjects(so.stringCol, @\"a\");\n    XCTAssertEqualObjects([so valueForKey:@\"stringCol\"], @\"a\");\n    XCTAssertEqualObjects(so[@\"stringCol\"], @\"a\");\n\n    [so setValue:nil forKey:@\"stringCol\"];\n    XCTAssertNil(so.stringCol);\n    XCTAssertNil([so valueForKey:@\"stringCol\"]);\n    XCTAssertNil(so[@\"stringCol\"]);\n\n    [realm transactionWithBlock:^{\n        [realm addObject:so];\n        XCTAssertNil(so.stringCol);\n        XCTAssertNil([so valueForKey:@\"stringCol\"]);\n        XCTAssertNil(so[@\"stringCol\"]);\n    }];\n\n    so = [StringObject allObjectsInRealm:realm].firstObject;\n\n    XCTAssertNil(so.stringCol);\n    XCTAssertNil([so valueForKey:@\"stringCol\"]);\n    XCTAssertNil(so[@\"stringCol\"]);\n\n    [realm transactionWithBlock:^{\n        so.stringCol = @\"b\";\n    }];\n    XCTAssertEqualObjects(so.stringCol, @\"b\");\n    XCTAssertEqualObjects([so valueForKey:@\"stringCol\"], @\"b\");\n    XCTAssertEqualObjects(so[@\"stringCol\"], @\"b\");\n\n    [realm transactionWithBlock:^{\n        so.stringCol = @\"\";\n    }];\n    XCTAssertEqualObjects(so.stringCol, @\"\");\n    XCTAssertEqualObjects([so valueForKey:@\"stringCol\"], @\"\");\n    XCTAssertEqualObjects(so[@\"stringCol\"], @\"\");\n}\n\n- (void)testOptionalBinaryProperties {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    BinaryObject *bo = [[BinaryObject alloc] init];\n\n    XCTAssertNil(bo.binaryCol);\n    XCTAssertNil([bo valueForKey:@\"binaryCol\"]);\n    XCTAssertNil(bo[@\"binaryCol\"]);\n\n    NSData *aData = [@\"a\" dataUsingEncoding:NSUTF8StringEncoding];\n    bo.binaryCol = aData;\n    XCTAssertEqualObjects(bo.binaryCol, aData);\n    XCTAssertEqualObjects([bo valueForKey:@\"binaryCol\"], aData);\n    XCTAssertEqualObjects(bo[@\"binaryCol\"], aData);\n\n    [bo setValue:nil forKey:@\"binaryCol\"];\n    XCTAssertNil(bo.binaryCol);\n    XCTAssertNil([bo valueForKey:@\"binaryCol\"]);\n    XCTAssertNil(bo[@\"binaryCol\"]);\n\n    [realm transactionWithBlock:^{\n        [realm addObject:bo];\n        XCTAssertNil(bo.binaryCol);\n        XCTAssertNil([bo valueForKey:@\"binaryCol\"]);\n        XCTAssertNil(bo[@\"binaryCol\"]);\n    }];\n\n    bo = [BinaryObject allObjectsInRealm:realm].firstObject;\n\n    XCTAssertNil(bo.binaryCol);\n    XCTAssertNil([bo valueForKey:@\"binaryCol\"]);\n    XCTAssertNil(bo[@\"binaryCol\"]);\n\n    NSData *bData = [@\"b\" dataUsingEncoding:NSUTF8StringEncoding];\n    [realm transactionWithBlock:^{\n        bo.binaryCol = bData;\n    }];\n    XCTAssertEqualObjects(bo.binaryCol, bData);\n    XCTAssertEqualObjects([bo valueForKey:@\"binaryCol\"], bData);\n    XCTAssertEqualObjects(bo[@\"binaryCol\"], bData);\n\n    NSData *emptyData = [NSData data];\n    [realm transactionWithBlock:^{\n        bo.binaryCol = emptyData;\n    }];\n    XCTAssertEqualObjects(bo.binaryCol, emptyData);\n    XCTAssertEqualObjects([bo valueForKey:@\"binaryCol\"], emptyData);\n    XCTAssertEqualObjects(bo[@\"binaryCol\"], emptyData);\n}\n\n- (void)testOptionalNumberProperties {\n    void (^assertNullProperties)(NumberObject *) = ^(NumberObject *no){\n        XCTAssertNil(no.intObj);\n        XCTAssertNil(no.doubleObj);\n        XCTAssertNil(no.floatObj);\n        XCTAssertNil(no.boolObj);\n\n        XCTAssertNil([no valueForKey:@\"intObj\"]);\n        XCTAssertNil([no valueForKey:@\"doubleObj\"]);\n        XCTAssertNil([no valueForKey:@\"floatObj\"]);\n        XCTAssertNil([no valueForKey:@\"boolObj\"]);\n\n        XCTAssertNil(no[@\"intObj\"]);\n        XCTAssertNil(no[@\"doubleObj\"]);\n        XCTAssertNil(no[@\"floatObj\"]);\n        XCTAssertNil(no[@\"boolObj\"]);\n    };\n\n    void (^assertNonNullProperties)(NumberObject *) = ^(NumberObject *no){\n        XCTAssertEqualObjects(no.intObj, @1);\n        XCTAssertEqualObjects(no.doubleObj, @1.1);\n        XCTAssertEqualObjects(no.floatObj, @2.2f);\n        XCTAssertEqualObjects(no.boolObj, @YES);\n\n        XCTAssertEqualObjects([no valueForKey:@\"intObj\"], @1);\n        XCTAssertEqualObjects([no valueForKey:@\"doubleObj\"], @1.1);\n        XCTAssertEqualObjects([no valueForKey:@\"floatObj\"], @2.2f);\n        XCTAssertEqualObjects([no valueForKey:@\"boolObj\"], @YES);\n\n        XCTAssertEqualObjects(no[@\"intObj\"], @1);\n        XCTAssertEqualObjects(no[@\"doubleObj\"], @1.1);\n        XCTAssertEqualObjects(no[@\"floatObj\"], @2.2f);\n        XCTAssertEqualObjects(no[@\"boolObj\"], @YES);\n    };\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    NumberObject *no = [[NumberObject alloc] init];\n\n    assertNullProperties(no);\n\n    no.intObj = @1;\n    no.doubleObj = @1.1;\n    no.floatObj = @2.2f;\n    no.boolObj = @YES;\n\n    assertNonNullProperties(no);\n\n    no.intObj = nil;\n    no.doubleObj = nil;\n    no.floatObj = nil;\n    no.boolObj = nil;\n\n    assertNullProperties(no);\n\n    no[@\"intObj\"] = @1;\n    no[@\"doubleObj\"] = @1.1;\n    no[@\"floatObj\"] = @2.2f;\n    no[@\"boolObj\"] = @YES;\n\n    assertNonNullProperties(no);\n\n    no.intObj = nil;\n    no.doubleObj = nil;\n    no.floatObj = nil;\n    no.boolObj = nil;\n\n    [realm transactionWithBlock:^{\n        [realm addObject:no];\n        assertNullProperties(no);\n    }];\n\n    no = [NumberObject allObjectsInRealm:realm].firstObject;\n    assertNullProperties(no);\n\n    [realm transactionWithBlock:^{\n        no.intObj = @1;\n        no.doubleObj = @1.1;\n        no.floatObj = @2.2f;\n        no.boolObj = @YES;\n    }];\n    assertNonNullProperties(no);\n}\n\n- (void)testRequiredNumberProperties {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    RequiredNumberObject *obj = [RequiredNumberObject createInRealm:realm withValue:@[@0, @0, @0, @0]];\n\n    RLMAssertThrowsWithReason(obj.intObj = nil,\n                              @\"Invalid null value for non-nullable property 'RequiredNumberObject.intObj'\");\n    RLMAssertThrowsWithReason(obj.floatObj = nil,\n                              @\"Invalid null value for non-nullable property 'RequiredNumberObject.floatObj'\");\n    RLMAssertThrowsWithReason(obj.doubleObj = nil,\n                              @\"Invalid null value for non-nullable property 'RequiredNumberObject.doubleObj'\");\n    RLMAssertThrowsWithReason(obj.boolObj = nil,\n                              @\"Invalid null value for non-nullable property 'RequiredNumberObject.boolObj'\");\n\n    obj.intObj = @1;\n    XCTAssertEqualObjects(obj.intObj, @1);\n    obj.floatObj = @2.2f;\n    XCTAssertEqualObjects(obj.floatObj, @2.2f);\n    obj.doubleObj = @3.3;\n    XCTAssertEqualObjects(obj.doubleObj, @3.3);\n    obj.boolObj = @YES;\n    XCTAssertEqualObjects(obj.boolObj, @YES);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testSettingNonOptionalPropertiesToNil {\n    RequiredPropertiesObject *ro = [[RequiredPropertiesObject alloc] init];\n\n    ro.stringCol = nil;\n    ro.binaryCol = nil;\n\n    XCTAssertNil(ro.stringCol);\n    XCTAssertNil(ro.binaryCol);\n\n    ro.stringCol = @\"a\";\n    ro.binaryCol = [@\"a\" dataUsingEncoding:NSUTF8StringEncoding];\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    [realm addObject:ro];\n    RLMAssertThrowsWithReasonMatching(ro.stringCol = nil,\n                                      @\"Invalid null value for non-nullable property 'RequiredPropertiesObject.stringCol'.\");\n    RLMAssertThrowsWithReasonMatching(ro.binaryCol = nil,\n                                      @\"Invalid null value for non-nullable property 'RequiredPropertiesObject.binaryCol'.\");\n    [realm cancelWriteTransaction];\n}\n\n\n- (void)testIntSizes {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    int16_t v16 = 1 << 12;\n    int32_t v32 = 1 << 30;\n    int64_t v64 = 1LL << 40;\n\n    AllIntSizesObject *obj = [AllIntSizesObject new];\n\n    // Test unmanaged\n    obj[@\"int16\"] = @(v16);\n    XCTAssertEqual([obj[@\"int16\"] shortValue], v16);\n    obj[@\"int16\"] = @(v32);\n    XCTAssertNotEqual([obj[@\"int16\"] intValue], v32, @\"should truncate\");\n\n    obj.int16 = 0;\n    obj.int16 = v16;\n    XCTAssertEqual(obj.int16, v16);\n\n    obj[@\"int32\"] = @(v32);\n    XCTAssertEqual([obj[@\"int32\"] intValue], v32);\n    obj[@\"int32\"] = @(v64);\n    XCTAssertNotEqual([obj[@\"int32\"] longLongValue], v64, @\"should truncate\");\n\n    obj.int32 = 0;\n    obj.int32 = v32;\n    XCTAssertEqual(obj.int32, v32);\n\n    obj[@\"int64\"] = @(v64);\n    XCTAssertEqual([obj[@\"int64\"] longLongValue], v64);\n    obj.int64 = 0;\n    obj.int64 = v64;\n    XCTAssertEqual(obj.int64, v64);\n\n    // Test in realm\n    [realm beginWriteTransaction];\n    [realm addObject:obj];\n\n    XCTAssertEqual(obj.int16, v16);\n    XCTAssertEqual(obj.int32, v32);\n    XCTAssertEqual(obj.int64, v64);\n\n    obj.int16 = 0;\n    obj.int32 = 0;\n    obj.int64 = 0;\n\n    obj[@\"int16\"] = @(v16);\n    XCTAssertEqual([obj[@\"int16\"] shortValue], v16);\n\n    obj.int16 = 0;\n    obj.int16 = v16;\n    XCTAssertEqual(obj.int16, v16);\n\n    obj[@\"int32\"] = @(v32);\n    XCTAssertEqual([obj[@\"int32\"] intValue], v32);\n\n    obj.int32 = 0;\n    obj.int32 = v32;\n    XCTAssertEqual(obj.int32, v32);\n\n    obj[@\"int64\"] = @(v64);\n    XCTAssertEqual([obj[@\"int64\"] longLongValue], v64);\n    obj.int64 = 0;\n    obj.int64 = v64;\n    XCTAssertEqual(obj.int64, v64);\n\n    [realm commitWriteTransaction];\n}\n\n- (void)testRenamedProperties {\n    RenamedProperties1 *obj1 = [[RenamedProperties1 alloc] initWithValue:@{@\"propA\": @5, @\"propB\": @\"a\"}];\n    XCTAssertEqual(obj1.propA, 5);\n    XCTAssertEqualObjects(obj1.propB, @\"a\");\n    XCTAssertEqualObjects(obj1[@\"propA\"], @5);\n    XCTAssertEqualObjects(obj1[@\"propB\"], @\"a\");\n    XCTAssertEqualObjects([obj1 valueForKey:@\"propA\"], @5);\n    XCTAssertEqualObjects([obj1 valueForKey:@\"propB\"], @\"a\");\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    [realm addObject:obj1];\n    XCTAssertEqual(obj1.propA, 5);\n    XCTAssertEqualObjects(obj1.propB, @\"a\");\n    XCTAssertEqualObjects(obj1[@\"propA\"], @5);\n    XCTAssertEqualObjects(obj1[@\"propB\"], @\"a\");\n    XCTAssertEqualObjects([obj1 valueForKey:@\"propA\"], @5);\n    XCTAssertEqualObjects([obj1 valueForKey:@\"propB\"], @\"a\");\n\n    RenamedProperties2 *obj2 = [RenamedProperties2 createInRealm:realm withValue:@{@\"propC\": @6, @\"propD\": @\"b\"}];\n    XCTAssertEqual(obj2.propC, 6);\n    XCTAssertEqualObjects(obj2.propD, @\"b\");\n    XCTAssertEqualObjects(obj2[@\"propC\"], @6);\n    XCTAssertEqualObjects(obj2[@\"propD\"], @\"b\");\n    XCTAssertEqualObjects([obj2 valueForKey:@\"propC\"], @6);\n    XCTAssertEqualObjects([obj2 valueForKey:@\"propD\"], @\"b\");\n\n    RLMResults<RenamedProperties1 *> *results1 = [RenamedProperties1 allObjectsInRealm:realm];\n    RLMResults<RenamedProperties2 *> *results2 = [RenamedProperties2 allObjectsInRealm:realm];\n    XCTAssertTrue([results1[0] isEqualToObject:results2[0]]);\n    XCTAssertTrue([results1[1] isEqualToObject:results2[1]]);\n\n    LinkToRenamedProperties1 *link1 = [LinkToRenamedProperties1 createInRealm:realm withValue:@[obj1, obj2, @[obj1, results1[1]]]];\n    LinkToRenamedProperties2 *link2 = [LinkToRenamedProperties2 createInRealm:realm withValue:@[obj2, obj1, @[obj2, results2[0]]]];\n\n    XCTAssertTrue([link1.linkA isKindOfClass:[RenamedProperties1 class]]);\n    XCTAssertTrue([link1.linkB isKindOfClass:[RenamedProperties2 class]]);\n    XCTAssertTrue([link1.array[0] isKindOfClass:[RenamedProperties1 class]]);\n    XCTAssertTrue([link1.array[1] isKindOfClass:[RenamedProperties1 class]]);\n\n    XCTAssertTrue([link2.linkC isKindOfClass:[RenamedProperties2 class]]);\n    XCTAssertTrue([link2.linkD isKindOfClass:[RenamedProperties1 class]]);\n    XCTAssertTrue([link2.array[0] isKindOfClass:[RenamedProperties2 class]]);\n    XCTAssertTrue([link2.array[1] isKindOfClass:[RenamedProperties2 class]]);\n\n    XCTAssertTrue([link1.linkA isEqualToObject:results1[0]]);\n    XCTAssertTrue([link1.linkB isEqualToObject:results1[1]]);\n    XCTAssertTrue([link1.linkA isEqualToObject:results2[0]]);\n    XCTAssertTrue([link1.linkB isEqualToObject:results2[1]]);\n\n    XCTAssertTrue([link2.linkC isEqualToObject:results1[1]]);\n    XCTAssertTrue([link2.linkD isEqualToObject:results1[0]]);\n    XCTAssertTrue([link2.linkC isEqualToObject:results2[1]]);\n    XCTAssertTrue([link2.linkD isEqualToObject:results2[0]]);\n\n    XCTAssertEqualObjects([link1.array valueForKey:@\"propB\"], (@[@\"a\", @\"b\"]));\n    XCTAssertEqualObjects([link2.array valueForKey:@\"propD\"], (@[@\"b\", @\"a\"]));\n\n    XCTAssertTrue([obj1.linking1[0] isEqualToObject:link1]);\n    XCTAssertTrue([obj1.linking2[0] isEqualToObject:link2]);\n    XCTAssertTrue([obj2.linking1[0] isEqualToObject:link2]);\n    XCTAssertTrue([obj2.linking2[0] isEqualToObject:link1]);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAllMethodsCheckThread {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    __block AllTypesObject *obj;\n    __block StringObject *stringObj;\n    NSDictionary *values = [AllTypesObject values:1 stringObject:nil];\n    [realm transactionWithBlock:^{\n        obj = [AllTypesObject createInRealm:realm withValue:values];\n        stringObj = [StringObject createInRealm:realm withValue:@[@\"\"]];\n    }];\n    [realm beginWriteTransaction];\n\n    NSArray<NSString *> *propertyNames = [obj.objectSchema.properties valueForKey:@\"name\"];\n    [self dispatchAsyncAndWait:^{\n        // Getters\n        for (NSString *prop in propertyNames) {\n            RLMAssertThrowsWithReasonMatching(obj[prop], @\"thread\");\n            RLMAssertThrowsWithReasonMatching([obj valueForKey:prop], @\"thread\");\n        }\n        RLMAssertThrowsWithReasonMatching(obj.boolCol, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.intCol, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.floatCol, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.doubleCol, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.stringCol, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.binaryCol, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.dateCol, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.cBoolCol, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.longCol, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.objectIdCol, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.decimalCol, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.objectCol, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.linkingObjectsCol, @\"thread\");\n\n        // Setters\n        for (NSString *prop in propertyNames) {\n            RLMAssertThrowsWithReasonMatching(obj[prop] = values[prop], @\"thread\");\n            RLMAssertThrowsWithReasonMatching([obj setValue:values[prop] forKey:prop], @\"thread\");\n        }\n        RLMAssertThrowsWithReasonMatching(obj.boolCol = 0, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.intCol = 0, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.floatCol = 0, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.doubleCol = 0, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.stringCol = nil, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.binaryCol = nil, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.dateCol = nil, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.cBoolCol = 0, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.longCol = 0, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.objectIdCol = nil, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.decimalCol = nil, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.objectCol = nil, @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.objectCol = [StringObject new], @\"thread\");\n        RLMAssertThrowsWithReasonMatching(obj.objectCol = stringObj, @\"thread\");\n    }];\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAllMethodsCheckForInvalidation {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    __block StringObject *stringObj;\n    NSDictionary *values = [AllTypesObject values:1 stringObject:nil];\n    [realm transactionWithBlock:^{\n        [AllTypesObject createInRealm:realm withValue:values];\n        stringObj = [StringObject createInRealm:realm withValue:@[@\"\"]];\n    }];\n\n    for (int i = 0; i < 2; ++i) {\n        AllTypesObject *obj = [[AllTypesObject allObjectsInRealm:realm] firstObject];\n        [realm beginWriteTransaction];\n        // Deleting the object directly and indirectly leave the managed\n        // accessor in different states, so test both\n        if (i == 0) {\n            [realm deleteObject:obj];\n        }\n        else {\n            [realm deleteObjects:[AllTypesObject allObjectsInRealm:realm]];\n        }\n\n        NSArray<NSString *> *propertyNames = [obj.objectSchema.properties valueForKey:@\"name\"];\n        // Getters\n        for (NSString *prop in propertyNames) {\n            RLMAssertThrowsWithReasonMatching(obj[prop], @\"invalidated\");\n            RLMAssertThrowsWithReasonMatching([obj valueForKey:prop], @\"invalidated\");\n        }\n        RLMAssertThrowsWithReasonMatching(obj.boolCol, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.intCol, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.floatCol, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.doubleCol, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.stringCol, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.binaryCol, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.dateCol, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.cBoolCol, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.longCol, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.objectIdCol, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.decimalCol, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.objectCol, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.linkingObjectsCol, @\"invalidated\");\n\n        // Setters\n        for (NSString *prop in propertyNames) {\n            RLMAssertThrowsWithReasonMatching(obj[prop] = values[prop], @\"invalidated\");\n            RLMAssertThrowsWithReasonMatching([obj setValue:values[prop] forKey:prop], @\"invalidated\");\n        }\n        RLMAssertThrowsWithReasonMatching(obj.boolCol = 0, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.intCol = 0, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.floatCol = 0, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.doubleCol = 0, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.stringCol = nil, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.binaryCol = nil, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.dateCol = nil, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.cBoolCol = 0, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.longCol = 0, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.objectIdCol = nil, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.decimalCol = nil, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.objectCol = nil, @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.objectCol = [StringObject new], @\"invalidated\");\n        RLMAssertThrowsWithReasonMatching(obj.objectCol = stringObj, @\"invalidated\");\n        [realm cancelWriteTransaction];\n    }\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/ObjectSchemaTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#import \"RLMObjectSchema_Private.h\"\n\n#pragma mark - Test Objects\n\n@interface IndexedObject : RLMObject\n@property NSString *stringCol;\n@property NSInteger integerCol;\n@property int intCol;\n@property long longCol;\n@property long long longlongCol;\n@property BOOL boolCol;\n@property NSDate *dateCol;\n@property NSNumber<RLMInt> *optionalIntCol;\n@property NSNumber<RLMBool> *optionalBoolCol;\n\n@property float floatCol;\n@property double doubleCol;\n@property NSData *dataCol;\n@property NSNumber<RLMFloat> *optionalFloatCol;\n@property NSNumber<RLMDouble> *optionalDoubleCol;\n@end\n\n@implementation IndexedObject\n+ (NSArray *)indexedProperties {\n    return @[@\"stringCol\", @\"integerCol\", @\"intCol\", @\"longCol\", @\"longlongCol\",\n             @\"boolCol\", @\"dateCol\", @\"optionalIntCol\", @\"optionalBoolCol\"];\n}\n@end\n\n#pragma mark - Tests\n\n@interface ObjectSchemaTests : RLMTestCase\n@end\n\n@implementation ObjectSchemaTests\n\n- (void)testDescription {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:[PrimaryStringObject class]];\n    XCTAssertEqualObjects(objectSchema.description, @\"PrimaryStringObject {\\n\"\n                                                    @\"\\tstringCol {\\n\"\n                                                    @\"\\t\\ttype = string;\\n\"\n                                                    @\"\\t\\tcolumnName = stringCol;\\n\"\n                                                    @\"\\t\\tindexed = YES;\\n\"\n                                                    @\"\\t\\tisPrimary = YES;\\n\"\n                                                    @\"\\t\\tarray = NO;\\n\"\n                                                    @\"\\t\\tset = NO;\\n\"\n                                                    @\"\\t\\tdictionary = NO;\\n\"\n                                                    @\"\\t\\toptional = NO;\\n\"\n                                                    @\"\\t}\\n\"\n                                                    @\"\\tintCol {\\n\"\n                                                    @\"\\t\\ttype = int;\\n\"\n                                                    @\"\\t\\tcolumnName = intCol;\\n\"\n                                                    @\"\\t\\tindexed = NO;\\n\"\n                                                    @\"\\t\\tisPrimary = NO;\\n\"\n                                                    @\"\\t\\tarray = NO;\\n\"\n                                                    @\"\\t\\tset = NO;\\n\"\n                                                    @\"\\t\\tdictionary = NO;\\n\"\n                                                    @\"\\t\\toptional = NO;\\n\"\n                                                    @\"\\t}\\n\"\n                                                    @\"}\");\n    objectSchema = [RLMObjectSchema schemaForObjectClass:[EmbeddedIntObject class]];\n    XCTAssertEqualObjects(objectSchema.description,\n                          @\"EmbeddedIntObject (embedded) {\\n\"\n                          @\"\\tintCol {\\n\"\n                          @\"\\t\\ttype = int;\\n\"\n                          @\"\\t\\tcolumnName = intCol;\\n\"\n                          @\"\\t\\tindexed = NO;\\n\"\n                          @\"\\t\\tisPrimary = NO;\\n\"\n                          @\"\\t\\tarray = NO;\\n\"\n                          @\"\\t\\tset = NO;\\n\"\n                          @\"\\t\\tdictionary = NO;\\n\"\n                          @\"\\t\\toptional = NO;\\n\"\n                          @\"\\t}\\n\"\n                          @\"}\");\n\n    objectSchema = [RLMObjectSchema schemaForObjectClass:[RenamedProperties class]];\n    XCTAssertEqualObjects(objectSchema.description,\n                          @\"RenamedProperties {\\n\"\n                          @\"\\tintCol {\\n\"\n                          @\"\\t\\ttype = int;\\n\"\n                          @\"\\t\\tcolumnName = custom_intCol;\\n\"\n                          @\"\\t\\tindexed = NO;\\n\"\n                          @\"\\t\\tisPrimary = NO;\\n\"\n                          @\"\\t\\tarray = NO;\\n\"\n                          @\"\\t\\tset = NO;\\n\"\n                          @\"\\t\\tdictionary = NO;\\n\"\n                          @\"\\t\\toptional = NO;\\n\"\n                          @\"\\t}\\n\"\n                          @\"\\tstringCol {\\n\"\n                          @\"\\t\\ttype = string;\\n\"\n                          @\"\\t\\tcolumnName = custom_stringCol;\\n\"\n                          @\"\\t\\tindexed = NO;\\n\"\n                          @\"\\t\\tisPrimary = NO;\\n\"\n                          @\"\\t\\tarray = NO;\\n\"\n                          @\"\\t\\tset = NO;\\n\"\n                          @\"\\t\\tdictionary = NO;\\n\"\n                          @\"\\t\\toptional = YES;\\n\"\n                          @\"\\t}\\n\"\n                          @\"}\");\n}\n\n- (void)testObjectForKeyedSubscript {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:[PrimaryStringObject class]];\n    XCTAssertEqualObjects(objectSchema[@\"stringCol\"].name, @\"stringCol\");\n    XCTAssertEqualObjects(objectSchema[@\"intCol\"].name, @\"intCol\");\n    XCTAssertNil(objectSchema[@\"missing\"]);\n}\n\n- (void)testPrimaryKeyProperty {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:[PrimaryStringObject class]];\n    XCTAssertEqualObjects(objectSchema.primaryKeyProperty.name, @\"stringCol\");\n\n    objectSchema = [RLMObjectSchema schemaForObjectClass:[StringObject class]];\n    XCTAssertNil(objectSchema.primaryKeyProperty);\n}\n\n#pragma mark - Schema Discovery\n\n- (void)testIgnoredUnsupportedProperty {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:[IgnoredURLObject class]];\n    XCTAssertEqual(1U, objectSchema.properties.count);\n    XCTAssertEqualObjects(objectSchema.properties[0].name, @\"name\");\n}\n\n- (void)testReadOnlyPropertiesImplicitlyIgnored {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:[ReadOnlyPropertyObject class]];\n    XCTAssertEqual(1U, objectSchema.properties.count);\n    XCTAssertEqualObjects(objectSchema.properties[0].name, @\"readOnlyPropertyMadeReadWriteInClassExtension\");\n}\n\n- (void)testIndex {\n    RLMObjectSchema *schema = [RLMObjectSchema schemaForObjectClass:[IndexedObject class]];\n\n    XCTAssertTrue(schema[@\"stringCol\"].indexed);\n    XCTAssertTrue(schema[@\"integerCol\"].indexed);\n    XCTAssertTrue(schema[@\"intCol\"].indexed);\n    XCTAssertTrue(schema[@\"longCol\"].indexed);\n    XCTAssertTrue(schema[@\"longlongCol\"].indexed);\n    XCTAssertTrue(schema[@\"boolCol\"].indexed);\n    XCTAssertTrue(schema[@\"dateCol\"].indexed);\n    XCTAssertTrue(schema[@\"optionalIntCol\"].indexed);\n    XCTAssertTrue(schema[@\"optionalBoolCol\"].indexed);\n\n    XCTAssertFalse(schema[@\"floatCol\"].indexed);\n    XCTAssertFalse(schema[@\"doubleCol\"].indexed);\n    XCTAssertFalse(schema[@\"dataCol\"].indexed);\n    XCTAssertFalse(schema[@\"optionalFloatCol\"].indexed);\n    XCTAssertFalse(schema[@\"optionalDoubleCol\"].indexed);\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/ObjectTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#import \"RLMObjectSchema_Private.h\"\n#import \"RLMSchema_Private.h\"\n\n#import <libkern/OSAtomic.h>\n#import <math.h>\n#import <objc/runtime.h>\n#import <stdalign.h>\n\n#pragma mark - Test Objects\n\n@interface DefaultObject : RLMObject\n@property int       intCol;\n@property float     floatCol;\n@property double    doubleCol;\n@property BOOL      boolCol;\n@property NSDate   *dateCol;\n@property NSString *stringCol;\n@property NSData   *binaryCol;\n@end\n\n@implementation DefaultObject\n+ (NSDictionary *)defaultPropertyValues {\n    NSString *binaryString = @\"binary\";\n    NSData *binaryData = [binaryString dataUsingEncoding:NSUTF8StringEncoding];\n\n    return @{@\"intCol\": @12,\n             @\"floatCol\": @88.9f,\n             @\"doubleCol\": @1002.892,\n             @\"boolCol\": @YES,\n             @\"dateCol\": [NSDate dateWithTimeIntervalSince1970:999999],\n             @\"stringCol\": @\"potato\",\n             @\"binaryCol\": binaryData};\n}\n@end\n\n@interface DynamicDefaultObject : RLMObject\n@property int       intCol;\n@property float     floatCol;\n@property double    doubleCol;\n@property NSDate   *dateCol;\n@property NSString *stringCol;\n@property NSData   *binaryCol;\n@end\n\n@implementation DynamicDefaultObject\n+ (BOOL)shouldIncludeInDefaultSchema {\n    return NO;\n}\n+ (NSDictionary *)defaultPropertyValues {\n    static NSInteger dynamicDefaultSeed = 0;\n    dynamicDefaultSeed++;\n    return @{@\"intCol\": @(dynamicDefaultSeed),\n             @\"floatCol\": @((float)dynamicDefaultSeed),\n             @\"doubleCol\": @((double)dynamicDefaultSeed),\n             @\"dateCol\": [NSDate dateWithTimeIntervalSince1970:dynamicDefaultSeed],\n             @\"stringCol\": [[NSUUID UUID] UUIDString],\n             @\"binaryCol\": [[[NSUUID UUID] UUIDString] dataUsingEncoding:NSUTF8StringEncoding]};\n}\n+ (NSString *)primaryKey {\n    return @\"intCol\";\n}\n@end\n\n@class CycleObject;\nRLM_COLLECTION_TYPE(CycleObject)\n@interface CycleObject : RLMObject\n@property RLM_GENERIC_ARRAY(CycleObject) *objects;\n@property RLM_GENERIC_SET(CycleObject) *objectSet;\n@end\n\n@implementation CycleObject\n@end\n\n@interface PrimaryStringObjectWrapper : RLMObject\n@property PrimaryStringObject *primaryStringObject;\n@end\n\n@implementation PrimaryStringObjectWrapper\n@end\n\n@interface PrimaryNestedObject : RLMObject\n@property int primaryCol;\n@property PrimaryStringObject *primaryStringObject;\n@property PrimaryStringObjectWrapper *primaryStringObjectWrapper;\n@property StringObject *stringObject;\n@property RLM_GENERIC_ARRAY(PrimaryIntObject) *primaryIntArray;\n@property RLM_GENERIC_SET(PrimaryIntObject) *primaryIntSet;\n@property NSString *stringCol;\n@end\n\n@implementation PrimaryNestedObject\n+ (NSString *)primaryKey {\n    return @\"primaryCol\";\n}\n+ (NSDictionary *)defaultPropertyValues {\n    return @{@\"stringCol\": @\"default\"};\n}\n@end\n\n@interface StringSubclassObject : StringObject\n@property NSString *stringCol2;\n@end\n\n@implementation StringSubclassObject\n@end\n\n@interface StringObjectNoThrow : StringObject\n@end\n\n@implementation StringObjectNoThrow\n- (id)valueForUndefinedKey:(__unused NSString *)key {\n    return nil;\n}\n@end\n\n@interface StringSubclassObjectWithDefaults : StringObjectNoThrow\n@property NSString *stringCol2;\n@end\n\n@implementation StringSubclassObjectWithDefaults\n+(NSDictionary *)defaultPropertyValues {\n    return @{@\"stringCol2\": @\"default\"};\n}\n@end\n\n@interface StringLinkObject : RLMObject\n@property StringObject *stringObjectCol;\n@property RLM_GENERIC_ARRAY(StringObject) *stringObjectArrayCol;\n@end\n\n@implementation StringLinkObject\n@end\n\n@interface ReadOnlyPropertyObject ()\n@property (readwrite) int readOnlyPropertyMadeReadWriteInClassExtension;\n@end\n\n@interface DataObject : RLMObject\n@property NSData *data1;\n@property NSData *data2;\n@end\n\n@implementation DataObject\n@end\n\n@interface DateObjectNoThrow : DateObject\n@property NSDate *date2;\n@end\n\n@implementation DateObjectNoThrow\n- (id)valueForUndefinedKey:(__unused NSString *)key {\n    return nil;\n}\n@end\n\n@interface DateSubclassObject : DateObjectNoThrow\n@property NSDate *date3;\n@end\n\n@implementation DateSubclassObject\n@end\n\n@interface DateDefaultsObject : DateObjectNoThrow\n@property NSDate *date3;\n@end\n\n@implementation DateDefaultsObject\n+ (NSDictionary *)defaultPropertyValues {\n    return @{@\"date3\": [NSDate date]};\n}\n@end\n\n@interface SubclassDateObject : NSObject\n@property NSDate *dateCol;\n@property (getter=customGetter) NSDate *date2;\n@property (setter=customSetter:) NSDate *date3;\n@end\n\n@implementation SubclassDateObject\n@end\n\n#pragma mark - Tests\n\n@interface ObjectTests : RLMTestCase\n@end\n\n@implementation ObjectTests\n\n- (void)testKeyedSubscripting {\n    EmployeeObject *objs = [[EmployeeObject alloc] initWithValue:@{@\"name\": @\"Test0\", @\"age\": @23, @\"hired\": @NO}];\n    XCTAssertEqualObjects(objs[@\"name\"], @\"Test0\",  @\"Name should be Test0\");\n    XCTAssertEqualObjects(objs[@\"age\"], @23,  @\"age should be 23\");\n    XCTAssertEqualObjects(objs[@\"hired\"], @NO,  @\"hired should be NO\");\n    objs[@\"name\"] = @\"Test1\";\n    XCTAssertEqualObjects(objs.name, @\"Test1\",  @\"Name should be Test1\");\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    EmployeeObject *obj0 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Test1\", @\"age\": @24, @\"hired\": @NO}];\n    EmployeeObject *obj1 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Test2\", @\"age\": @25, @\"hired\": @YES}];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqualObjects(obj0[@\"name\"], @\"Test1\",  @\"Name should be Test1\");\n    XCTAssertEqualObjects(obj1[@\"name\"], @\"Test2\", @\"Name should be Test1\");\n\n    [realm beginWriteTransaction];\n    obj0[@\"name\"] = @\"newName\";\n    [realm commitWriteTransaction];\n\n    XCTAssertEqualObjects(obj0[@\"name\"], @\"newName\",  @\"Name should be newName\");\n\n    [realm beginWriteTransaction];\n    obj0[@\"name\"] = nil;\n    [realm commitWriteTransaction];\n\n    XCTAssertNil(obj0[@\"name\"]);\n}\n\n- (void)testCannotUpdatePrimaryKey {\n    PrimaryIntObject *intObj = [[PrimaryIntObject alloc] init];\n    intObj.intCol = 1;\n    XCTAssertNoThrow(intObj.intCol = 0);\n\n    PrimaryStringObject *stringObj = [[PrimaryStringObject alloc] init];\n    stringObj.stringCol = @\"a\";\n    XCTAssertNoThrow(stringObj.stringCol = @\"b\");\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    [realm addObject:intObj];\n\n    RLMAssertThrowsWithReason(intObj.intCol = 1, @\"Primary key can't be changed\");\n    RLMAssertThrowsWithReason(intObj[@\"intCol\"] = @1, @\"Primary key can't be changed\");\n    RLMAssertThrowsWithReason([intObj setValue:@1 forKey:@\"intCol\"], @\"Primary key can't be changed\");\n\n    [realm addObject:stringObj];\n\n    RLMAssertThrowsWithReason(stringObj.stringCol = @\"a\", @\"Primary key can't be changed\");\n    RLMAssertThrowsWithReason(stringObj[@\"stringCol\"] = @\"a\", @\"Primary key can't be changed\");\n    RLMAssertThrowsWithReason([stringObj setValue:@\"a\" forKey:@\"stringCol\"], @\"Primary key can't be changed\");\n    [realm cancelWriteTransaction];\n}\n\n- (void)testDataTypes {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    const char bin[4] = { 0, 1, 2, 3 };\n    NSData *bin1 = [[NSData alloc] initWithBytes:bin length:sizeof bin / 2];\n    NSData *bin2 = [[NSData alloc] initWithBytes:bin length:sizeof bin];\n    NSDate *timeNow = [NSDate dateWithTimeIntervalSince1970:1000000];\n    NSDate *timeZero = [NSDate dateWithTimeIntervalSince1970:0];\n    RLMObjectId *objectId1 = [RLMObjectId objectId];\n    RLMObjectId *objectId2 = [RLMObjectId objectId];\n\n    AllTypesObject *c = [[AllTypesObject alloc] init];\n\n    c.boolCol   = NO;\n    c.intCol  = 54;\n    c.floatCol = 0.7f;\n    c.doubleCol = 0.8;\n    c.stringCol = @\"foo\";\n    c.binaryCol = bin1;\n    c.dateCol = timeZero;\n    c.cBoolCol = false;\n    c.longCol = 99;\n    c.decimalCol = [RLMDecimal128 decimalWithNumber:@1];\n    c.objectIdCol = objectId1;\n    c.objectCol = [[StringObject alloc] init];\n    c.objectCol.stringCol = @\"c\";\n    c.uuidCol = [[NSUUID alloc] initWithUUIDString:@\"137DECC8-B300-4954-A233-F89909F4FD89\"];\n    [realm addObject:c];\n\n    [AllTypesObject createInRealm:realm withValue:@[@YES, @506, @7.7f, @8.8, @\"banach\", bin2,\n                                                    timeNow, @YES, @(-20), [RLMDecimal128 decimalWithNumber:@2],\n                                                    objectId2, [[NSUUID alloc] initWithUUIDString:@\"137DECC8-B300-4954-A233-F89909F4FD89\"], NSNull.null]];\n    [realm commitWriteTransaction];\n\n    AllTypesObject *row1 = [AllTypesObject allObjects][0];\n    AllTypesObject *row2 = [AllTypesObject allObjects][1];\n\n    XCTAssertEqual(row1.boolCol, NO,                    @\"row1.BoolCol\");\n    XCTAssertEqual(row2.boolCol, YES,                   @\"row2.BoolCol\");\n    XCTAssertEqual(row1.intCol, 54,                     @\"row1.IntCol\");\n    XCTAssertEqual(row2.intCol, 506,                    @\"row2.IntCol\");\n    XCTAssertEqual(row1.floatCol, 0.7f,                 @\"row1.FloatCol\");\n    XCTAssertEqual(row2.floatCol, 7.7f,                 @\"row2.FloatCol\");\n    XCTAssertEqual(row1.doubleCol, 0.8,                 @\"row1.DoubleCol\");\n    XCTAssertEqual(row2.doubleCol, 8.8,                 @\"row2.DoubleCol\");\n    XCTAssertTrue([row1.stringCol isEqual:@\"foo\"],      @\"row1.StringCol\");\n    XCTAssertTrue([row2.stringCol isEqual:@\"banach\"],   @\"row2.StringCol\");\n    XCTAssertTrue([row1.binaryCol isEqual:bin1],        @\"row1.BinaryCol\");\n    XCTAssertTrue([row2.binaryCol isEqual:bin2],        @\"row2.BinaryCol\");\n    XCTAssertTrue(([row1.dateCol isEqual:timeZero]),    @\"row1.DateCol\");\n    XCTAssertTrue(([row2.dateCol isEqual:timeNow]),     @\"row2.DateCol\");\n    XCTAssertEqual(row1.cBoolCol, false,                @\"row1.cBoolCol\");\n    XCTAssertEqual(row2.cBoolCol, true,                 @\"row2.cBoolCol\");\n    XCTAssertEqual(row1.longCol, 99L,                   @\"row1.IntCol\");\n    XCTAssertEqual(row2.longCol, -20L,                  @\"row2.IntCol\");\n    XCTAssertEqualObjects(row1.decimalCol, [RLMDecimal128 decimalWithNumber:@1]);\n    XCTAssertEqualObjects(row2.decimalCol, [RLMDecimal128 decimalWithNumber:@2]);\n    XCTAssertEqualObjects(row1.objectIdCol, objectId1);\n    XCTAssertEqualObjects(row2.objectIdCol, objectId2);\n    XCTAssertTrue([row1.objectCol.stringCol isEqual:@\"c\"], @\"row1.objectCol\");\n    XCTAssertNil(row2.objectCol,                        @\"row2.objectCol\");\n    XCTAssertTrue([row1.uuidCol.UUIDString isEqualToString: @\"137DECC8-B300-4954-A233-F89909F4FD89\"], @\"row1.uuidCol\");\n    XCTAssertTrue([row2.uuidCol.UUIDString isEqualToString: @\"137DECC8-B300-4954-A233-F89909F4FD89\"], @\"row2.uuidCol\");\n\n    [realm transactionWithBlock:^{\n        row1.boolCol = NO;\n        row1.cBoolCol = false;\n        row1.boolCol = (BOOL)6;\n        row1.cBoolCol = (BOOL)6;\n    }];\n    XCTAssertEqual(row1.boolCol, true);\n    XCTAssertEqual(row1.cBoolCol, true);\n\n    AllTypesObject *o = [[AllTypesObject alloc] initWithValue:row1];\n    o.floatCol = NAN;\n    o.doubleCol = NAN;\n    o.decimalCol = [RLMDecimal128 decimalWithNumber:[NSDecimalNumber notANumber]];\n    [realm transactionWithBlock:^{\n        [realm addObject:o];\n    }];\n    XCTAssertTrue(isnan(o.floatCol));\n    XCTAssertTrue(isnan(o.doubleCol));\n    XCTAssertTrue(o.decimalCol.isNaN);\n}\n\n- (void)testObjectSubclass {\n    // test className methods\n    XCTAssertEqualObjects(@\"StringObject\", [StringObject className]);\n    XCTAssertEqualObjects(@\"StringSubclassObject\", [StringSubclassObject className]);\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    [StringObject createInDefaultRealmWithValue:@[@\"string\"]];\n    StringSubclassObject *obj = [StringSubclassObject createInDefaultRealmWithValue:@[@\"string\", @\"string2\"]];\n\n    // ensure property ordering\n    XCTAssertEqualObjects([obj.objectSchema.properties[0] name], @\"stringCol\");\n    XCTAssertEqualObjects([obj.objectSchema.properties[1] name], @\"stringCol2\");\n\n    [realm commitWriteTransaction];\n\n    // ensure creation in proper table\n    RLMResults *results = StringSubclassObject.allObjects;\n    XCTAssertEqual(1U, results.count);\n    XCTAssertEqual(1U, StringObject.allObjects.count);\n\n    // ensure exceptions on when using polymorphism\n    [realm beginWriteTransaction];\n    StringLinkObject *linkObject = [StringLinkObject createInDefaultRealmWithValue:@[NSNull.null, @[]]];\n    RLMAssertThrowsWithReasonMatching(linkObject.stringObjectCol = obj,\n                                      @\"Can't .*StringSubclassObject.*StringObject\");\n    RLMAssertThrowsWithReasonMatching([linkObject.stringObjectArrayCol addObject:obj],\n                                      @\"Object of type .*StringSubclassObject.*does not match.*StringObject.*\");\n    [realm commitWriteTransaction];\n}\n\n- (void)testDateDistantFuture {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    DateObject *dateObject = [DateObject createInRealm:realm withValue:@[NSDate.distantFuture]];\n    [realm commitWriteTransaction];\n    XCTAssertEqualObjects(NSDate.distantFuture, dateObject.dateCol);\n}\n\n- (void)testDateDistantPast {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    DateObject *dateObject = [DateObject createInRealm:realm withValue:@[NSDate.distantPast]];\n    [realm commitWriteTransaction];\n    XCTAssertEqualObjects(NSDate.distantPast, dateObject.dateCol);\n}\n\n- (void)testDate50kYears {\n    NSCalendarUnit units = (NSCalendarUnit)(NSCalendarUnitMonth | NSCalendarUnitYear | NSCalendarUnitDay);\n    NSDateComponents *components = [[NSCalendar currentCalendar] components:units fromDate:NSDate.date];\n    components.calendar = [NSCalendar currentCalendar];\n    components.year += 50000;\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    DateObject *dateObject = [DateObject createInRealm:realm withValue:@[components.date]];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqualObjects(components.date, dateObject.dateCol);\n}\n\nstatic void testDatesInRange(NSTimeInterval from, NSTimeInterval to, void (^check)(NSDate *, NSDate *)) {\n    NSDate *date = [NSDate dateWithTimeIntervalSinceReferenceDate:from];\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    DateObject *dateObject = [DateObject createInRealm:realm withValue:@[date]];\n\n    while (from < to) @autoreleasepool {\n        check(dateObject.dateCol, date);\n        from = nextafter(from, DBL_MAX);\n        date = [NSDate dateWithTimeIntervalSinceReferenceDate:from];\n        dateObject.dateCol = date;\n    }\n    [realm commitWriteTransaction];\n}\n\n- (void)testExactRepresentationOfDatesAroundNow {\n    NSDate *date = [NSDate date];\n    NSTimeInterval time = date.timeIntervalSinceReferenceDate;\n    testDatesInRange(time - .001, time + .001, ^(NSDate *d1, NSDate *d2) {\n        XCTAssertEqualObjects(d1, d2);\n    });\n}\n\n- (void)testExactRepresentationOfDatesAroundDistantFuture {\n    NSDate *date = [NSDate distantFuture];\n    NSTimeInterval time = date.timeIntervalSinceReferenceDate;\n    testDatesInRange(time - .001, time + .001, ^(NSDate *d1, NSDate *d2) {\n        XCTAssertEqualObjects(d1, d2);\n    });\n}\n\n- (void)testExactRepresentationOfDatesAroundEpoch {\n    NSDate *date = [NSDate dateWithTimeIntervalSince1970:0];\n    NSTimeInterval time = date.timeIntervalSinceReferenceDate;\n    testDatesInRange(time - .001, time + .001, ^(NSDate *d1, NSDate *d2) {\n        XCTAssertEqualObjects(d1, d2);\n    });\n}\n\n- (void)testExactRepresentationOfDatesAroundReferenceDate {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    NSDate *zero = [NSDate dateWithTimeIntervalSinceReferenceDate:0];\n    DateObject *dateObject = [DateObject createInRealm:realm withValue:@[zero]];\n    XCTAssertEqualObjects(dateObject.dateCol, zero);\n\n    // Just shy of 1ns should still be zero\n    dateObject.dateCol = [NSDate dateWithTimeIntervalSinceReferenceDate:nextafter(1e-9, -DBL_MAX)];\n    XCTAssertEqualObjects(dateObject.dateCol, zero);\n\n    // Very slightly over 1ns (since 1e-9 can't be exactly represented by a double)\n    dateObject.dateCol = [NSDate dateWithTimeIntervalSinceReferenceDate:1e-9];\n    XCTAssertNotEqualObjects(dateObject.dateCol, zero);\n\n    // Round toward zero, so -1ns + epsilon is zero\n    dateObject.dateCol = [NSDate dateWithTimeIntervalSinceReferenceDate:nextafter(0, -DBL_MAX)];\n    XCTAssertEqualObjects(dateObject.dateCol, zero);\n    dateObject.dateCol = [NSDate dateWithTimeIntervalSinceReferenceDate:nextafter(-1e-9, DBL_MAX)];\n    XCTAssertEqualObjects(dateObject.dateCol, zero);\n\n    dateObject.dateCol = [NSDate dateWithTimeIntervalSinceReferenceDate:-1e-9];\n    XCTAssertNotEqualObjects(dateObject.dateCol, zero);\n\n    [realm commitWriteTransaction];\n}\n\n- (void)testDatesOutsideOfTimestampRange {\n    NSDate *date = [NSDate date];\n    NSDate *maxDate = [NSDate dateWithTimeIntervalSince1970:(double)(1ULL << 63) + .999999999];\n    NSDate *minDate = [NSDate dateWithTimeIntervalSince1970:-(double)(1ULL << 63) - .999999999];\n    NSDate *justOverMaxDate = [NSDate dateWithTimeIntervalSince1970:nextafter(maxDate.timeIntervalSince1970, DBL_MAX)];\n    NSDate *justUnderMaxDate = [NSDate dateWithTimeIntervalSince1970:nextafter(maxDate.timeIntervalSince1970, -DBL_MAX)];\n    NSDate *justOverMinDate = [NSDate dateWithTimeIntervalSince1970:nextafter(minDate.timeIntervalSince1970, DBL_MAX)];\n    NSDate *justUnderMinDate = [NSDate dateWithTimeIntervalSince1970:nextafter(minDate.timeIntervalSince1970, -DBL_MAX)];\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    DateObject *dateObject = [DateObject createInRealm:realm withValue:@[date]];\n\n    dateObject.dateCol = [NSDate dateWithTimeIntervalSinceReferenceDate:0.0/0.0];\n    XCTAssertEqualObjects(dateObject.dateCol, [NSDate dateWithTimeIntervalSince1970:0]);\n\n    dateObject.dateCol = maxDate;\n    XCTAssertEqualObjects(dateObject.dateCol, maxDate);\n    dateObject.dateCol = justOverMaxDate;\n    XCTAssertEqualObjects(dateObject.dateCol, maxDate);\n    dateObject.dateCol = [NSDate dateWithTimeIntervalSinceReferenceDate:DBL_MAX];\n    XCTAssertEqualObjects(dateObject.dateCol, maxDate);\n    dateObject.dateCol = [NSDate dateWithTimeIntervalSinceReferenceDate:1.0/0.0];\n    XCTAssertEqualObjects(dateObject.dateCol, maxDate);\n\n    dateObject.dateCol = minDate;\n    XCTAssertEqualObjects(dateObject.dateCol, minDate);\n    dateObject.dateCol = justUnderMinDate;\n    XCTAssertEqualObjects(dateObject.dateCol, minDate);\n    dateObject.dateCol = [NSDate dateWithTimeIntervalSinceReferenceDate:-DBL_MAX];\n    XCTAssertEqualObjects(dateObject.dateCol, minDate);\n    dateObject.dateCol = [NSDate dateWithTimeIntervalSinceReferenceDate:-1.0/0.0];\n    XCTAssertEqualObjects(dateObject.dateCol, minDate);\n\n    dateObject.dateCol = justUnderMaxDate;\n    XCTAssertEqualObjects(dateObject.dateCol, justUnderMaxDate);\n\n    dateObject.dateCol = justOverMinDate;\n    XCTAssertEqualObjects(dateObject.dateCol, justOverMinDate);\n\n    [realm commitWriteTransaction];\n}\n\n- (void)testDataSizeLimits {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    // Allocation must be < 16 MB, with an 8-byte header and the allocation size\n    // 8-byte aligned\n    static const int maxSize = 0xFFFFFF - 15;\n\n    // Multiple 16 MB blobs should be fine\n    void *buffer = malloc(maxSize);\n    strcpy((char *)buffer + maxSize - sizeof(\"hello\") - 1, \"hello\");\n    DataObject *obj = [[DataObject alloc] init];\n    obj.data1 = obj.data2 = [NSData dataWithBytesNoCopy:buffer length:maxSize freeWhenDone:YES];\n\n    [realm beginWriteTransaction];\n    [realm addObject:obj];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(maxSize, obj.data1.length);\n    XCTAssertEqual(maxSize, obj.data2.length);\n    XCTAssertTrue(strcmp((const char *)obj.data1.bytes + obj.data1.length - sizeof(\"hello\") - 1, \"hello\") == 0);\n    XCTAssertTrue(strcmp((const char *)obj.data2.bytes + obj.data2.length - sizeof(\"hello\") - 1, \"hello\") == 0);\n\n    // A blob over 16 MB should throw (and not crash)\n    [realm beginWriteTransaction];\n    RLMAssertThrowsWithReason(obj.data1 = [NSData dataWithBytesNoCopy:malloc(maxSize + 1)\n                                                               length:maxSize + 1 freeWhenDone:YES],\n                              @\"Binary too big\");\n    [realm commitWriteTransaction];\n}\n\n- (void)testStringSizeLimits {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    // Allocation must be < 16 MB, with an 8-byte header, trailing NUL,  and the\n    // allocation size 8-byte aligned\n    static const int maxSize = 0xFFFFFF - 16;\n\n    void *buffer = calloc(maxSize, 1);\n    strcpy((char *)buffer + maxSize - sizeof(\"hello\") - 1, \"hello\");\n    NSString *str = [[NSString alloc] initWithBytesNoCopy:buffer length:maxSize\n                                                 encoding:NSUTF8StringEncoding freeWhenDone:YES];\n    StringObject *obj = [[StringObject alloc] init];\n    obj.stringCol = str;\n\n    [realm beginWriteTransaction];\n    [realm addObject:obj];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqualObjects(str, obj.stringCol);\n\n    // A blob over 16 MB should throw (and not crash)\n    [realm beginWriteTransaction];\n    XCTAssertThrows(obj.stringCol = [[NSString alloc] initWithBytesNoCopy:calloc(maxSize + 1, 1)\n                                                                   length:maxSize + 1\n                                                                 encoding:NSUTF8StringEncoding\n                                                             freeWhenDone:YES]);\n    [realm commitWriteTransaction];\n}\n\n- (void)testAddingObjectNotInSchemaThrows {\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.objectClasses = @[StringObject.class];\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:configuration error:nil];\n\n    [realm beginWriteTransaction];\n    RLMAssertThrowsWithReasonMatching([realm addObject:[[IntObject alloc] initWithValue:@[@1]]],\n                                      @\"Object type 'IntObject' is not managed by the Realm.*custom `objectClasses`\");\n    RLMAssertThrowsWithReasonMatching([IntObject createInRealm:realm withValue:@[@1]],\n                                      @\"Object type 'IntObject' is not managed by the Realm.*custom `objectClasses`\");\n    XCTAssertNoThrow([realm addObject:[[StringObject alloc] initWithValue:@[@\"A\"]]]);\n    XCTAssertNoThrow([StringObject createInRealm:realm withValue:@[@\"A\"]]);\n    [realm cancelWriteTransaction];\n}\n\nstatic void addProperty(Class cls, const char *name, const char *type, size_t size, size_t align, id getter) {\n    objc_property_attribute_t objectColAttrs[] = {\n        {\"T\", type},\n        {\"V\", name},\n    };\n    class_addIvar(cls, name, size, align, type);\n    class_addProperty(cls, name, objectColAttrs, sizeof(objectColAttrs) / sizeof(objc_property_attribute_t));\n\n    char encoding[4] = \" @:\";\n    encoding[0] = *type;\n    class_addMethod(cls, sel_registerName(name), imp_implementationWithBlock(getter), encoding);\n}\n\n- (void)testObjectSubclassAddedAtRuntime {\n    Class objectClass = objc_allocateClassPair(RLMObject.class, \"RuntimeGeneratedObject\", 0);\n    addProperty(objectClass, \"objectCol\", \"@\\\"RuntimeGeneratedObject\\\"\", sizeof(id), alignof(id), ^(__unused id obj) { return nil; });\n    addProperty(objectClass, \"intCol\", \"i\", sizeof(int), alignof(int), ^int(__unused id obj) { return 0; });\n    objc_registerClassPair(objectClass);\n    XCTAssertEqualObjects([objectClass className], @\"RuntimeGeneratedObject\");\n\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.objectClasses = @[objectClass];\n    XCTAssertEqualObjects([objectClass className], @\"RuntimeGeneratedObject\");\n\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:configuration error:nil];\n    [realm beginWriteTransaction];\n    id object = [objectClass createInRealm:realm withValue:@{@\"objectCol\": [[objectClass alloc] init], @\"intCol\": @17}];\n    RLMObjectSchema *schema = [object objectSchema];\n    XCTAssertNotNil(schema[@\"objectCol\"]);\n    XCTAssertNotNil(schema[@\"intCol\"]);\n    XCTAssert([[object objectCol] isKindOfClass:objectClass]);\n    XCTAssertEqual([object intCol], 17);\n    [realm commitWriteTransaction];\n}\n\n#pragma mark - Default Property Values\n\n- (NSDictionary *)defaultValuesDictionary {\n    return @{@\"intCol\"    : @98,\n             @\"floatCol\"  : @231.0f,\n             @\"doubleCol\": @123732.9231,\n             @\"boolCol\"   : @NO,\n             @\"dateCol\"   : [NSDate dateWithTimeIntervalSince1970:454321],\n             @\"stringCol\": @\"Westeros\",\n             @\"binaryCol\": [@\"inputData\" dataUsingEncoding:NSUTF8StringEncoding]};\n}\n\n- (void)testDefaultValuesFromNoValuePresent {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n\n    NSDictionary *inputValues = [self defaultValuesDictionary];\n    NSArray *keys = [inputValues allKeys]; // To ensure iteration order is stable\n    for (NSString *key in keys) {\n        NSMutableDictionary *dict = [inputValues mutableCopy];\n        [dict removeObjectForKey:key];\n        [DefaultObject createInRealm:realm withValue:dict];\n    }\n\n    [realm commitWriteTransaction];\n\n    // Test allObject for DefaultObject\n    NSDictionary *defaultValues = [DefaultObject defaultPropertyValues];\n    RLMResults *allObjects = [DefaultObject allObjectsInRealm:realm];\n    for (NSUInteger i = 0; i < keys.count; ++i) {\n        DefaultObject *object = allObjects[i];\n        for (NSUInteger j = 0; j < keys.count; ++j) {\n            NSString *key = keys[j];\n            if (i == j) {\n                XCTAssertEqualObjects(object[key], defaultValues[key]);\n            }\n            else {\n                XCTAssertEqualObjects(object[key], inputValues[key]);\n            }\n        }\n    }\n}\n\n- (void)testDefaultValuesFromNSNull {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    NSDictionary *defaultValues = [DefaultObject defaultPropertyValues];\n    NSDictionary *inputValues = [self defaultValuesDictionary];\n    NSArray *keys = [inputValues allKeys]; // To ensure iteration order is stable\n    for (NSString *key in keys) {\n        NSMutableDictionary *dict = [inputValues mutableCopy];\n        dict[key] = NSNull.null;\n        RLMProperty *prop = realm.schema[@\"DefaultObject\"][key];\n        if (prop.optional) {\n            [realm beginWriteTransaction];\n            [DefaultObject createInRealm:realm withValue:dict];\n            [realm commitWriteTransaction];\n\n            DefaultObject *object = DefaultObject.allObjects.lastObject;\n            for (NSUInteger j = 0; j < keys.count; ++j) {\n                NSString *key2 = keys[j];\n                if ([key isEqualToString:key2]) {\n                    XCTAssertEqualObjects(object[key2], prop.optional ? nil : defaultValues[key2]);\n                }\n                else {\n                    XCTAssertEqualObjects(object[key2], inputValues[key2]);\n                }\n            }\n        }\n        else {\n            [realm beginWriteTransaction];\n            RLMAssertThrowsWithReason([DefaultObject createInRealm:realm withValue:dict],\n                                      @\"Invalid value '<null>' of type 'NSNull' for \");\n            [realm commitWriteTransaction];\n        }\n    }\n}\n\n- (void)testDefaultNSNumberPropertyValues {\n    void (^assertDefaults)(NumberObject *) = ^(NumberObject *no) {\n        XCTAssertEqualObjects(no.intObj, @1);\n        XCTAssertEqualObjects(no.floatObj, @2.2f);\n        XCTAssertEqualObjects(no.doubleObj, @3.3);\n        XCTAssertEqualObjects(no.boolObj, @NO);\n    };\n\n    assertDefaults([[NumberDefaultsObject alloc] init]);\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    assertDefaults([NumberDefaultsObject createInRealm:realm withValue:@{}]);\n    [realm cancelWriteTransaction];\n}\n\n- (void)testDynamicDefaultPropertyValues {\n    void (^assertDifferentPropertyValues)(DynamicDefaultObject *, DynamicDefaultObject *) = ^(DynamicDefaultObject *obj1, DynamicDefaultObject *obj2) {\n        XCTAssertNotEqual(obj1.intCol, obj2.intCol);\n        XCTAssertNotEqual(obj1.floatCol, obj2.floatCol);\n        XCTAssertNotEqual(obj1.doubleCol, obj2.doubleCol);\n        XCTAssertNotEqualWithAccuracy(obj1.dateCol.timeIntervalSinceReferenceDate, obj2.dateCol.timeIntervalSinceReferenceDate, 0.01f);\n        XCTAssertNotEqualObjects(obj1.stringCol, obj2.stringCol);\n        XCTAssertNotEqualObjects(obj1.binaryCol, obj2.binaryCol);\n    };\n    assertDifferentPropertyValues([[DynamicDefaultObject alloc] init], [[DynamicDefaultObject alloc] init]);\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.objectClasses = @[[DynamicDefaultObject class]];\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:configuration error:nil];\n    [realm beginWriteTransaction];\n    assertDifferentPropertyValues([DynamicDefaultObject createInRealm:realm withValue:@{}], [DynamicDefaultObject createInRealm:realm withValue:@{}]);\n    [realm cancelWriteTransaction];\n}\n\n#pragma mark - Ignored Properties\n\n- (void)testCanUseIgnoredProperty {\n    NSURL *url = [NSURL URLWithString:@\"http://realm.io\"];\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n\n    IgnoredURLObject *obj = [IgnoredURLObject new];\n    obj.name = @\"Realm\";\n    obj.url = url;\n    [realm addObject:obj];\n    XCTAssertEqual(obj.url, url, @\"ignored properties should still be assignable and gettable inside a write block\");\n\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(obj.url, url, @\"ignored properties should still be assignable and gettable outside a write block\");\n\n    IgnoredURLObject *obj2 = [[IgnoredURLObject objectsWithPredicate:nil] firstObject];\n    XCTAssertNotNil(obj2, @\"object with ignored property should still be stored and accessible through the realm\");\n\n    XCTAssertEqualObjects(obj2.name, obj.name, @\"managed property should be the same\");\n    XCTAssertNil(obj2.url, @\"ignored property should be nil when getting from realm\");\n}\n\n#pragma mark - Create\n\n- (void)testCreateInRealmValidationForDictionary {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    NSDictionary *dictValidAllTypes = [AllTypesObject values:0 stringObject:nil mixedObject: nil];\n    [realm beginWriteTransaction];\n\n    XCTAssertNoThrow(([AllTypesObject createInRealm:realm withValue:dictValidAllTypes]),\n                     @\"Creating object with valid value types should not throw exception\");\n\n    for (NSString *keyToInvalidate in dictValidAllTypes) {\n        NSMutableDictionary *invalidInput = [dictValidAllTypes mutableCopy];\n        id obj = @\"invalid\";\n        if ([keyToInvalidate isEqualToString:@\"stringCol\"]) {\n            obj = @1;\n        }\n\n        if ([keyToInvalidate isEqualToString:@\"anyCol\"]) {\n            obj = self;\n        }\n\n        invalidInput[keyToInvalidate] = obj;\n\n        RLMAssertThrowsWithReasonMatching([AllTypesObject createInRealm:realm withValue:invalidInput],\n                                          @\"Invalid value '.*'\");\n    }\n\n    [realm commitWriteTransaction];\n}\n\n- (void)testCreateInRealmValidationForArray {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    // add test/link object to realm\n    [realm beginWriteTransaction];\n    StringObject *to = [StringObject createInRealm:realm withValue:@[@\"c\"]];\n    [realm commitWriteTransaction];\n\n    const char bin[4] = { 0, 1, 2, 3 };\n    NSData *bin1 = [[NSData alloc] initWithBytes:bin length:sizeof bin / 2];\n    NSDate *timeNow = [NSDate dateWithTimeIntervalSince1970:1000000];\n    NSArray *const arrayValidAllTypes = @[@NO, @54, @0.7f, @0.8, @\"foo\", bin1,\n                                          timeNow, @NO, @(99),\n                                          [RLMDecimal128 decimalWithNumber:@2],\n                                          [RLMObjectId objectId],\n                                          [[NSUUID alloc] init], to];\n\n    [realm beginWriteTransaction];\n\n    // Test NSArray\n    XCTAssertNoThrow(([AllTypesObject createInRealm:realm withValue:arrayValidAllTypes]),\n                     @\"Creating object with valid value types should not throw exception\");\n\n    const NSInteger stringColIndex = 4;\n    for (NSUInteger i = 0; i < arrayValidAllTypes.count; i++) {\n        NSMutableArray *invalidInput = [arrayValidAllTypes mutableCopy];\n\n        id obj = @\"invalid\";\n        if (i == stringColIndex) {\n            obj = @1;\n        }\n\n        invalidInput[i] = obj;\n\n        RLMAssertThrowsWithReasonMatching([AllTypesObject createInRealm:realm withValue:invalidInput],\n                                          @\"Invalid value '.*'\");\n    }\n\n    [realm commitWriteTransaction];\n}\n\n- (void)testCreateInRealmReusesExistingObjects {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    DogObject *dog = [DogObject createInDefaultRealmWithValue:@[@\"Fido\", @5]];\n    OwnerObject *owner = [OwnerObject createInDefaultRealmWithValue:@[@\"name\", dog]];\n    XCTAssertTrue([owner.dog isEqualToObject:dog]);\n    XCTAssertEqual(1U, DogObject.allObjects.count);\n\n    DogArrayObject *dogArray = [DogArrayObject createInDefaultRealmWithValue:@[@[dog]]];\n    XCTAssertTrue([dogArray.dogs[0] isEqualToObject:dog]);\n    XCTAssertEqual(1U, DogObject.allObjects.count);\n\n    [realm commitWriteTransaction];\n}\n\n- (void)testCreateInRealmReusesExistingNestedObjectsByPrimaryKey {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    PrimaryEmployeeObject *eo = [PrimaryEmployeeObject createInRealm:realm withValue:@[@\"Samuel\", @19, @NO]];\n    PrimaryCompanyObject *co = [PrimaryCompanyObject createInRealm:realm withValue:@[@\"Realm\", @[eo], @[eo], @{ @\"key\": eo }, eo, @[eo]]];\n    [realm commitWriteTransaction];\n\n    [realm beginWriteTransaction];\n    [PrimaryCompanyObject createOrUpdateInRealm:realm withValue:@{\n                                                                   @\"name\": @\"Realm\",\n                                                                   @\"intern\": @{@\"name\":@\"Samuel\", @\"hired\":@YES},\n                                                                   }];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(1U, co.employees.count);\n    XCTAssertEqual(1U, [PrimaryEmployeeObject allObjectsInRealm:realm].count);\n    XCTAssertEqualObjects(@\"Samuel\", eo.name);\n    XCTAssertEqual(YES, eo.hired);\n    XCTAssertEqual(19, eo.age);\n\n    [realm beginWriteTransaction];\n    [PrimaryCompanyObject createOrUpdateInRealm:realm withValue:@{\n                                                                   @\"name\": @\"Realm\",\n                                                                   @\"employees\": @[@{@\"name\":@\"Samuel\", @\"hired\":@NO}],\n                                                                   @\"employeeSet\": @[@{@\"name\":@\"Samuel\", @\"hired\":@NO}],\n                                                                   @\"intern\": @{@\"name\":@\"Samuel\", @\"age\":@20},\n                                                                   }];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(1U, co.employees.count);\n    XCTAssertEqual(1U, [PrimaryEmployeeObject allObjectsInRealm:realm].count);\n    XCTAssertEqualObjects(@\"Samuel\", eo.name);\n    XCTAssertEqual(NO, eo.hired);\n    XCTAssertEqual(20, eo.age);\n\n    [realm beginWriteTransaction];\n    [PrimaryCompanyObject createOrUpdateInRealm:realm withValue:@{@\"name\": @\"Realm\",\n                                                                  @\"wrappedIntern\": @[eo]}];\n    [realm commitWriteTransaction];\n    XCTAssertEqual(1U, [[PrimaryEmployeeObject allObjectsInRealm:realm] count]);\n}\n\n- (void)testCreateInRealmCopiesFromOtherRealm {\n    RLMRealm *realm1 = [RLMRealm defaultRealm];\n    RLMRealm *realm2 = [self realmWithTestPath];\n    [realm1 beginWriteTransaction];\n    [realm2 beginWriteTransaction];\n\n    DogObject *dog = [DogObject createInDefaultRealmWithValue:@[@\"Fido\", @5]];\n    OwnerObject *owner = [OwnerObject createInRealm:realm2 withValue:@[@\"name\", dog]];\n    XCTAssertFalse([owner.dog isEqualToObject:dog]);\n    XCTAssertEqual(1U, DogObject.allObjects.count);\n    XCTAssertEqual(1U, [DogObject allObjectsInRealm:realm2].count);\n\n    DogArrayObject *dogArray = [DogArrayObject createInRealm:realm2 withValue:@[@[dog]]];\n    XCTAssertFalse([dogArray.dogs[0] isEqualToObject:dog]);\n    XCTAssertEqual(1U, DogObject.allObjects.count);\n    XCTAssertEqual(2U, [DogObject allObjectsInRealm:realm2].count);\n\n    [realm1 commitWriteTransaction];\n    [realm2 commitWriteTransaction];\n}\n\n- (void)testCreateInRealmWithOtherObjects {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    DateObjectNoThrow *object = [DateObjectNoThrow createInDefaultRealmWithValue:@[NSDate.date, NSDate.date]];\n\n    // create subclass with instance of base class with/without default objects\n    XCTAssertNoThrow([DateSubclassObject createInDefaultRealmWithValue:object]);\n    XCTAssertNoThrow([DateObjectNoThrow createInDefaultRealmWithValue:object]);\n\n    // create using non-realm object with custom getter\n    SubclassDateObject *obj = [SubclassDateObject new];\n    obj.dateCol = [NSDate dateWithTimeIntervalSinceReferenceDate:1000];\n    obj.date2 = [NSDate dateWithTimeIntervalSinceReferenceDate:2000];\n    obj.date3 = [NSDate dateWithTimeIntervalSinceReferenceDate:3000];\n    [DateDefaultsObject createInDefaultRealmWithValue:obj];\n\n    XCTAssertEqual(2U, DateObjectNoThrow.allObjects.count);\n    [realm commitWriteTransaction];\n}\n\n#pragma mark - Description\n\n- (void)testObjectDescription {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n\n    // Init object before adding to realm\n    EmployeeObject *soInit = [[EmployeeObject alloc] init];\n    soInit.name = @\"Peter\";\n    soInit.age = 30;\n    soInit.hired = YES;\n    [realm addObject:soInit];\n\n    // description asserts block\n    void (^descriptionAsserts)(NSString *) = ^(NSString *description) {\n        XCTAssertTrue([description rangeOfString:@\"name\"].location != NSNotFound,\n                      @\"column names should be displayed when calling \\\"description\\\" on RLMObject subclasses\");\n        XCTAssertTrue([description rangeOfString:@\"Peter\"].location != NSNotFound,\n                      @\"column values should be displayed when calling \\\"description\\\" on RLMObject subclasses\");\n\n        XCTAssertTrue([description rangeOfString:@\"age\"].location != NSNotFound,\n                      @\"column names should be displayed when calling \\\"description\\\" on RLMObject subclasses\");\n        XCTAssertTrue([description rangeOfString:[@30 description]].location != NSNotFound,\n                      @\"column values should be displayed when calling \\\"description\\\" on RLMObject subclasses\");\n\n        XCTAssertTrue([description rangeOfString:@\"hired\"].location != NSNotFound,\n                      @\"column names should be displayed when calling \\\"description\\\" on RLMObject subclasses\");\n        XCTAssertTrue([description rangeOfString:[@YES description]].location != NSNotFound,\n                      @\"column values should be displayed when calling \\\"description\\\" on RLMObject subclasses\");\n    };\n\n    // Test description in write block\n    descriptionAsserts(soInit.description);\n\n    [realm commitWriteTransaction];\n\n    // Test description in read block\n    NSString *objDescription = [[[EmployeeObject objectsWithPredicate:nil] firstObject] description];\n    descriptionAsserts(objDescription);\n\n    soInit = [[EmployeeObject alloc] init];\n    soInit.age = 20;\n    XCTAssert([soInit.description rangeOfString:@\"(null)\"].location != NSNotFound);\n}\n\n- (void)testObjectCycleDescription {\n    CycleObject *obj = [[CycleObject alloc] init];\n    [RLMRealm.defaultRealm transactionWithBlock:^{\n        [RLMRealm.defaultRealm addObject:obj];\n        [obj.objects addObject:obj];\n        [obj.objectSet addObject:obj];\n    }];\n    XCTAssertNoThrow(obj.description);\n}\n\n- (void)testDataObjectDescription {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    char longData[200];\n    [DataObject createInRealm:realm withValue:@[[NSData dataWithBytes:&longData length:200], [NSData dataWithBytes:&longData length:2]]];\n    [realm commitWriteTransaction];\n\n    DataObject *obj = [DataObject allObjectsInRealm:realm].firstObject;\n    XCTAssertTrue([obj.description rangeOfString:@\"200 total bytes\"].location != NSNotFound);\n    XCTAssertTrue([obj.description rangeOfString:@\"2 total bytes\"].location != NSNotFound);\n}\n\n- (void)testDeletedObjectDescription {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    EmployeeObject *obj = [EmployeeObject createInRealm:realm withValue:@[@\"Peter\", @30, @YES]];\n    [realm deleteObject:obj];\n    [realm commitWriteTransaction];\n\n    XCTAssertNoThrow(obj.description);\n}\n\n- (void)testManagedObjectUnknownKey {\n    IntObject *obj = [[IntObject alloc] init];\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    [realm addObject:obj];\n    [realm commitWriteTransaction];\n    RLMAssertThrowsWithReason([obj objectForKeyedSubscript:@\"\"],\n                              @\"Invalid property name '' for class 'IntObject'\");\n    RLMAssertThrowsWithReason([obj setObject:@0 forKeyedSubscript:@\"\"],\n                              @\"Invalid property name '' for class 'IntObject'\");\n}\n\n- (void)testUnmanagedRealmObjectUnknownKey {\n    IntObject *obj = [[IntObject alloc] init];\n    XCTAssertThrows([obj objectForKeyedSubscript:@\"\"]);\n    XCTAssertThrows([obj setObject:@0 forKeyedSubscript:@\"\"]);\n}\n\n- (void)testEquality {\n    IntObject *obj = [[IntObject alloc] init];\n    IntObject *otherObj = [[IntObject alloc] init];\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    RLMRealm *otherRealm = [self realmWithTestPath];\n\n    XCTAssertFalse([obj isEqual:[NSObject new]], @\"Comparing an RLMObject to a non-RLMObject should be false.\");\n    XCTAssertFalse([obj isEqualToObject:(RLMObject *)[NSObject new]], @\"Comparing an RLMObject to a non-RLMObject should be false.\");\n    XCTAssertTrue([obj isEqual:obj], @\"Same instance.\");\n    XCTAssertTrue([obj isEqualToObject:obj], @\"Same instance.\");\n    XCTAssertFalse([obj isEqualToObject:otherObj], @\"Comparison outside of realm.\");\n\n    [realm beginWriteTransaction];\n    [realm addObject:obj];\n    [realm commitWriteTransaction];\n\n    XCTAssertFalse([obj isEqualToObject:otherObj], @\"One in realm, the other is not.\");\n    XCTAssertTrue([obj isEqualToObject:[IntObject allObjects][0]], @\"Same table and index.\");\n\n    [otherRealm beginWriteTransaction];\n    [otherRealm addObject:otherObj];\n    [otherRealm commitWriteTransaction];\n\n    XCTAssertFalse([obj isEqualToObject:otherObj], @\"Different realms.\");\n\n    [realm beginWriteTransaction];\n    [realm addObject:[[IntObject alloc] init]];\n    [realm addObject:[[BoolObject alloc] init]];\n    [realm commitWriteTransaction];\n\n    XCTAssertFalse([obj isEqualToObject:[IntObject allObjects][1]], @\"Same table, different index.\");\n    XCTAssertFalse([obj isEqualToObject:[BoolObject allObjects][0]], @\"Different tables.\");\n}\n\n- (void)testCrossThreadAccess {\n    IntObject *obj = [[IntObject alloc] init];\n\n    // Unmanaged object can be accessed from other threads\n    [self dispatchAsyncAndWait:^{ XCTAssertNoThrow(obj.intCol = 5); }];\n\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n    [realm addObject:obj];\n    [realm commitWriteTransaction];\n\n    [self dispatchAsyncAndWait:^{ RLMAssertThrowsWithReason(obj.intCol, @\"incorrect thread\"); }];\n}\n\n- (void)testIsDeleted {\n    StringObject *obj1 = [[StringObject alloc] initWithValue:@[@\"a\"]];\n    XCTAssertEqual(obj1.invalidated, NO);\n\n    RLMRealm *realm = [self realmWithTestPath];\n    [realm beginWriteTransaction];\n    [realm addObject:obj1];\n    StringObject *obj2 = [StringObject createInRealm:realm withValue:@[@\"b\"]];\n\n    XCTAssertEqual([obj1 isInvalidated], NO);\n    XCTAssertEqual(obj2.invalidated, NO);\n\n    [realm commitWriteTransaction];\n\n    // delete\n    [realm beginWriteTransaction];\n    // Delete directly\n    [realm deleteObject:obj1];\n    // Delete as result of query since then obj2's realm could point to a different instance\n    [realm deleteObject:[[StringObject allObjectsInRealm:realm] firstObject]];\n\n    XCTAssertEqual(obj1.invalidated, YES);\n    XCTAssertEqual(obj2.invalidated, YES);\n\n    RLMAssertThrowsWithReason([realm addObject:obj1], @\"deleted or invalidated\");\n\n    NSArray *propObject = @[@\"\", @[obj2], @[]];\n    RLMAssertThrowsWithReason([ArrayPropertyObject createInRealm:realm withValue:propObject],\n                              @\"deleted or invalidated\");\n\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(obj1.invalidated, YES);\n    XCTAssertNil(obj1.realm, @\"Realm should be nil after deletion\");\n}\n\n#pragma mark - Invalidated\n\n- (void)testIsInvalidated {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    StringObject *obj1 = [[StringObject alloc] initWithValue:@[@\"a\"]];\n    XCTAssertEqual(obj1.isInvalidated, NO);\n    [realm transactionWithBlock:^{\n        [realm addObject:obj1];\n    }];\n    XCTAssertEqual(obj1.isInvalidated, NO);\n    [realm transactionWithBlock:^{\n        [realm deleteObject:obj1];\n    }];\n    XCTAssertEqual(obj1.isInvalidated, YES);\n}\n\n- (void)testInvalidatedWithCustomObjectClasses {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.objectClasses = @[[StringObject class]];\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n\n    StringObject *obj1 = [[StringObject alloc] initWithValue:@[@\"a\"]];\n    XCTAssertEqual(obj1.isInvalidated, NO);\n    [realm transactionWithBlock:^{\n        [realm addObject:obj1];\n    }];\n    XCTAssertEqual(obj1.isInvalidated, NO);\n    [realm transactionWithBlock:^{\n        [realm deleteObject:obj1];\n    }];\n    XCTAssertEqual(obj1.isInvalidated, YES);\n}\n\n#pragma mark - Primary Keys\n\n- (void)testPrimaryKey {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    [PrimaryStringObject createInDefaultRealmWithValue:(@[@\"string\", @1])];\n    [PrimaryStringObject createInDefaultRealmWithValue:(@[@\"string2\", @1])];\n    RLMAssertThrowsWithReason([PrimaryStringObject createInDefaultRealmWithValue:(@[@\"string\", @1])],\n                              @\"existing primary key value\");\n\n    [PrimaryIntObject createInDefaultRealmWithValue:(@[@1])];\n    [PrimaryIntObject createInDefaultRealmWithValue:(@{@\"intCol\": @2})];\n    RLMAssertThrowsWithReason([PrimaryIntObject createInDefaultRealmWithValue:(@[@1])],\n                              @\"existing primary key value\");\n\n    [PrimaryInt64Object createInDefaultRealmWithValue:(@[@(1LL << 40)])];\n    [PrimaryInt64Object createInDefaultRealmWithValue:(@[@(1LL << 41)])];\n    RLMAssertThrowsWithReason([PrimaryInt64Object createInDefaultRealmWithValue:(@[@(1LL << 40)])],\n                              @\"existing primary key value\");\n\n    [PrimaryNullableIntObject createInDefaultRealmWithValue:@[@1]];\n    [PrimaryNullableIntObject createInDefaultRealmWithValue:(@{@\"optIntCol\": @2, @\"value\": @0})];\n    [PrimaryNullableIntObject createInDefaultRealmWithValue:@[NSNull.null]];\n    RLMAssertThrowsWithReason([PrimaryNullableIntObject createInDefaultRealmWithValue:(@[@1, @0])],\n                              @\"existing primary key value\");\n    RLMAssertThrowsWithReason([PrimaryNullableIntObject createInDefaultRealmWithValue:(@[NSNull.null, @0])],\n                              @\"existing primary key value\");\n\n    [realm commitWriteTransaction];\n}\n\n- (void)testCreateOrUpdate {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    PrimaryNullableStringObject *obj1 = [PrimaryNullableStringObject\n                                         createOrUpdateInDefaultRealmWithValue:@[@\"string\", @1]];\n    RLMResults *objects = [PrimaryNullableStringObject allObjects];\n    XCTAssertEqual([objects count], 1U, @\"Should have 1 object\");\n    XCTAssertEqual(obj1.intCol, 1, @\"Value should be 1\");\n\n    [PrimaryNullableStringObject createOrUpdateInRealm:realm withValue:@{@\"stringCol\": @\"string2\", @\"intCol\": @2}];\n    XCTAssertEqual([objects count], 2U, @\"Should have 2 objects\");\n\n    [PrimaryNullableStringObject createOrUpdateInRealm:realm withValue:@{@\"intCol\": @5}];\n    [PrimaryNullableStringObject createOrUpdateInRealm:realm withValue:@{@\"intCol\": @7}];\n    XCTAssertEqual([PrimaryNullableStringObject objectInRealm:realm forPrimaryKey:NSNull.null].intCol, 7);\n    [PrimaryNullableStringObject createOrUpdateInRealm:realm withValue:@{@\"stringCol\": NSNull.null, @\"intCol\": @11}];\n    XCTAssertEqual([PrimaryNullableStringObject objectInRealm:realm forPrimaryKey:nil].intCol, 11);\n\n    // upsert with new secondary property\n    [PrimaryNullableStringObject createOrUpdateInDefaultRealmWithValue:@[@\"string\", @3]];\n    XCTAssertEqual([objects count], 3U, @\"Should have 3 objects\");\n    XCTAssertEqual(obj1.intCol, 3, @\"Value should be 3\");\n\n    [realm commitWriteTransaction];\n}\n\n- (void)testCreateOrUpdateNestedObjects {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    [PrimaryNestedObject createOrUpdateInDefaultRealmWithValue:@[@0, @[@\"string\", @1], @[@[@\"string\", @1]], @[@\"string\"], @[@[@1]], @[@[@1]], @\"\"]];\n    XCTAssertEqual([[PrimaryNestedObject allObjects] count], 1U, @\"Should have 1 object\");\n    XCTAssertEqual([[PrimaryStringObject allObjects] count], 1U, @\"Should have 1 object\");\n    XCTAssertEqual([[PrimaryIntObject allObjects] count], 1U, @\"Should have 1 object\");\n\n    // update parent and nested object\n    [PrimaryNestedObject createOrUpdateInDefaultRealmWithValue:@{@\"primaryCol\": @0,\n                                                                  @\"primaryStringObject\": @[@\"string\", @2],\n                                                                  @\"primaryStringObjectWrapper\": @[@[@\"string\", @2]],\n                                                                  @\"stringObject\": @[@\"string2\"]}];\n    XCTAssertEqual([[PrimaryNestedObject allObjects] count], 1U, @\"Should have 1 object\");\n    XCTAssertEqual([[PrimaryStringObject allObjects] count], 1U, @\"Should have 1 object\");\n    XCTAssertEqual([PrimaryStringObject.allObjects.lastObject intCol], 2, @\"intCol should be 2\");\n    XCTAssertEqualObjects([PrimaryNestedObject.allObjects.lastObject stringCol], @\"\", @\"stringCol should not have been updated\");\n    XCTAssertEqual(1U, [PrimaryNestedObject.allObjects.lastObject primaryIntArray].count, @\"intArray should not have been overwritten\");\n    XCTAssertEqual(1U, [PrimaryNestedObject.allObjects.lastObject primaryIntSet].count, @\"intSet should not have been overwritten\");\n    XCTAssertEqual([[StringObject allObjects] count], 2U, @\"Should have 2 objects\");\n\n    // test partial update nulling out object/array properties\n    [PrimaryNestedObject createOrUpdateInDefaultRealmWithValue:@{@\"primaryCol\": @0,\n                                                                  @\"stringCol\": @\"updated\",\n                                                                  @\"stringObject\": NSNull.null,\n                                                                  @\"primaryIntArray\": NSNull.null,\n                                                                  @\"primaryIntSet\": NSNull.null}];\n    PrimaryNestedObject *obj = PrimaryNestedObject.allObjects.lastObject;\n    XCTAssertEqual(2, obj.primaryStringObject.intCol, @\"primaryStringObject should not have changed\");\n    XCTAssertEqualObjects(obj.stringCol, @\"updated\", @\"stringCol should have been updated\");\n    XCTAssertEqual(0U, obj.primaryIntArray.count, @\"intArray should not have been emptied\");\n    XCTAssertEqual(0U, obj.primaryIntSet.count, @\"intSet should not have been emptied\");\n    XCTAssertNil(obj.stringObject, @\"stringObject should be nil\");\n\n    // inserting new object should update nested\n    obj = [PrimaryNestedObject createOrUpdateInDefaultRealmWithValue:@[@1, @[@\"string\", @3], @[@[@\"string\", @3]], @[@\"string\"], @[], @[], @\"\"]];\n    XCTAssertEqual([[PrimaryNestedObject allObjects] count], 2U, @\"Should have 2 objects\");\n    XCTAssertEqual([[PrimaryStringObject allObjects] count], 1U, @\"Should have 1 object\");\n    XCTAssertEqual([(PrimaryStringObject *)[[PrimaryStringObject allObjects] lastObject] intCol], 3, @\"intCol should be 3\");\n\n    // test addOrUpdateObject\n    obj.primaryStringObject = [PrimaryStringObject createInDefaultRealmWithValue:@[@\"string2\", @1]];\n    PrimaryNestedObject *obj1 = [[PrimaryNestedObject alloc] initWithValue:@[@1, @[@\"string2\", @4], @[@[@\"string2\", @4]], @[@\"string\"], @[@[@1], @[@2]], @[@[@1], @[@2]], @\"\"]];\n    [realm addOrUpdateObject:obj1];\n    XCTAssertEqual([[PrimaryNestedObject allObjects] count], 2U, @\"Should have 2 objects\");\n    XCTAssertEqual([[PrimaryStringObject allObjects] count], 2U, @\"Should have 2 objects\");\n    XCTAssertEqual([[PrimaryIntObject allObjects] count], 2U, @\"Should have 2 objects\");\n    XCTAssertEqual([(PrimaryStringObject *)[[PrimaryStringObject allObjects] lastObject] intCol], 4, @\"intCol should be 4\");\n\n    [realm commitWriteTransaction];\n}\n\n- (void)testCreateOrUpdateWithReorderedColumns {\n    @autoreleasepool {\n        // Create a Realm file with the properties in reverse order\n        RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:PrimaryStringObject.class];\n        objectSchema.properties = @[objectSchema.properties[1], objectSchema.properties[0]];\n        RLMSchema *schema = [RLMSchema new];\n        schema.objectSchema = @[objectSchema];\n\n        RLMRealm *realm = [self realmWithTestPathAndSchema:schema];\n        [realm beginWriteTransaction];\n        [PrimaryStringObject createOrUpdateInRealm:realm withValue:@[@5, @\"a\"]];\n        [realm commitWriteTransaction];\n    }\n\n    RLMRealm *realm = [self realmWithTestPath];\n    [realm beginWriteTransaction];\n\n    XCTAssertEqual([PrimaryStringObject objectInRealm:realm forPrimaryKey:@\"a\"].intCol, 5);\n\n    // Values in array are used in property declaration order, not table column order\n    [PrimaryStringObject createOrUpdateInRealm:realm withValue:@[@\"a\", @6]];\n    XCTAssertEqual([PrimaryStringObject objectInRealm:realm forPrimaryKey:@\"a\"].intCol, 6);\n\n    [PrimaryStringObject createOrUpdateInRealm:realm withValue:@{@\"stringCol\": @\"a\", @\"intCol\": @7}];\n    XCTAssertEqual([PrimaryStringObject objectInRealm:realm forPrimaryKey:@\"a\"].intCol, 7);\n    [realm commitWriteTransaction];\n}\n\n- (void)testObjectInSet {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n\n    // set object with primary and non primary keys as they both override isEqual and hash\n    PrimaryStringObject *obj = [PrimaryStringObject createInDefaultRealmWithValue:(@[@\"string2\", @1])];\n    StringObject *strObj = [StringObject createInDefaultRealmWithValue:@[@\"string\"]];\n    NSMutableSet *dict = [NSMutableSet set];\n    [dict addObject:obj];\n    [dict addObject:strObj];\n\n    // primary key objects should match even with duplicate instances of the same object\n    XCTAssertTrue([dict containsObject:obj]);\n    XCTAssertTrue([dict containsObject:[[PrimaryStringObject allObjects] firstObject]]);\n\n    // non-primary key objects should only match when comparing identical instances\n    XCTAssertTrue([dict containsObject:strObj]);\n    XCTAssertFalse([dict containsObject:[[StringObject allObjects] firstObject]]);\n\n    [realm commitWriteTransaction];\n}\n\n- (void)testObjectForKey {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n    PrimaryStringObject *strObj = [PrimaryStringObject createInDefaultRealmWithValue:@[@\"key\", @0]];\n    PrimaryNullableStringObject *nullStrObj = [PrimaryNullableStringObject createInDefaultRealmWithValue:@[NSNull.null, @0]];\n    PrimaryIntObject *intObj = [PrimaryIntObject createInDefaultRealmWithValue:@[@0]];\n    PrimaryNullableIntObject *nonNullIntObj = [PrimaryNullableIntObject createInDefaultRealmWithValue:@[@0]];\n    PrimaryNullableIntObject *nullIntObj = [PrimaryNullableIntObject createInDefaultRealmWithValue:@[NSNull.null]];\n    [realm commitWriteTransaction];\n\n    // no PK\n    RLMAssertThrowsWithReason([StringObject objectForPrimaryKey:@\"\"],\n                              @\"does not have a primary key\");\n    RLMAssertThrowsWithReason([IntObject objectForPrimaryKey:@0],\n                              @\"does not have a primary key\");\n    RLMAssertThrowsWithReason([StringObject objectForPrimaryKey:NSNull.null],\n                              @\"does not have a primary key\");\n    RLMAssertThrowsWithReason([StringObject objectForPrimaryKey:nil],\n                              @\"does not have a primary key\");\n    RLMAssertThrowsWithReason([IntObject objectForPrimaryKey:nil],\n                              @\"does not have a primary key\");\n\n    // wrong PK type\n    RLMAssertThrowsWithReasonMatching([PrimaryStringObject objectForPrimaryKey:@0],\n                                      @\"Invalid value '0' of type '.*Number.*' for 'string' property 'PrimaryStringObject.stringCol'.\");\n    RLMAssertThrowsWithReasonMatching([PrimaryStringObject objectForPrimaryKey:@[]],\n                                      @\"of type '.*Array.*' for 'string' property 'PrimaryStringObject.stringCol'.\");\n    RLMAssertThrowsWithReasonMatching([PrimaryIntObject objectForPrimaryKey:@\"\"],\n                                      @\"Invalid value '' of type '.*String.*' for 'int' property 'PrimaryIntObject.intCol'.\");\n    RLMAssertThrowsWithReason([PrimaryIntObject objectForPrimaryKey:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for 'int' property 'PrimaryIntObject.intCol'.\");\n    RLMAssertThrowsWithReason([PrimaryIntObject objectForPrimaryKey:nil],\n                              @\"Invalid value '(null)' of type '(null)' for 'int' property 'PrimaryIntObject.intCol'.\");\n   RLMAssertThrowsWithReason([PrimaryStringObject objectForPrimaryKey:NSNull.null],\n                             @\"Invalid value '<null>' of type 'NSNull' for 'string' property 'PrimaryStringObject.stringCol'.\");\n   RLMAssertThrowsWithReason([PrimaryStringObject objectForPrimaryKey:nil],\n                             @\"Invalid value '(null)' of type '(null)' for 'string' property 'PrimaryStringObject.stringCol'.\");\n\n    // no object with key\n    XCTAssertNil([PrimaryStringObject objectForPrimaryKey:@\"bad key\"]);\n    XCTAssertNil([PrimaryIntObject objectForPrimaryKey:@1]);\n\n    // object with key exists\n    XCTAssertEqualObjects(strObj, [PrimaryStringObject objectForPrimaryKey:@\"key\"]);\n    XCTAssertEqualObjects(nullStrObj, [PrimaryNullableStringObject objectForPrimaryKey:NSNull.null]);\n    XCTAssertEqualObjects(nullStrObj, [PrimaryNullableStringObject objectForPrimaryKey:nil]);\n    XCTAssertEqualObjects(intObj, [PrimaryIntObject objectForPrimaryKey:@0]);\n    XCTAssertEqualObjects(nonNullIntObj, [PrimaryNullableIntObject objectForPrimaryKey:@0]);\n    XCTAssertEqualObjects(nullIntObj, [PrimaryNullableIntObject objectForPrimaryKey:NSNull.null]);\n    XCTAssertEqualObjects(nullIntObj, [PrimaryNullableIntObject objectForPrimaryKey:nil]);\n\n    // nil realm throws\n    RLMAssertThrowsWithReason([PrimaryIntObject objectInRealm:self.nonLiteralNil forPrimaryKey:@0],\n                              @\"Realm must not be nil\");\n}\n\n- (void)testClassExtension {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    BaseClassStringObject *bObject = [[BaseClassStringObject alloc ] init];\n    bObject.intCol = 1;\n    bObject.stringCol = @\"stringVal\";\n    [realm addObject:bObject];\n    [realm commitWriteTransaction];\n\n    BaseClassStringObject *objectFromRealm = [BaseClassStringObject allObjects][0];\n    XCTAssertEqual(1, objectFromRealm.intCol);\n    XCTAssertEqualObjects(@\"stringVal\", objectFromRealm.stringCol);\n}\n\n#pragma mark - Frozen Objects\n\nstatic IntObject *managedObject(void) {\n    IntObject *obj = [[IntObject alloc] init];\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    [realm transactionWithBlock:^{\n        [realm addObject:obj];\n    }];\n    return obj;\n}\n\n- (void)testIsFrozen {\n    IntObject *standalone = [[IntObject alloc] init];\n    IntObject *managed = managedObject();\n    IntObject *frozen = [managed freeze];\n    XCTAssertFalse(standalone.isFrozen);\n    XCTAssertFalse(managed.isFrozen);\n    XCTAssertTrue(frozen.isFrozen);\n}\n\n- (void)testFreezeUnmanagedObject {\n    RLMAssertThrowsWithReason([[[IntObject alloc] init] freeze],\n                              @\"Unmanaged objects cannot be frozen.\");\n}\n\n- (void)testFreezingFrozenObjectReturnsSelf {\n    IntObject *obj = managedObject();\n    IntObject *frozen = obj.freeze;\n    XCTAssertNotEqual(obj, frozen);\n    XCTAssertNotEqual(obj.freeze, frozen);\n    XCTAssertEqual(frozen, frozen.freeze);\n}\n\n- (void)testFreezingDeletedObject {\n    IntObject *obj = managedObject();\n    [obj.realm transactionWithBlock:^{\n        [obj.realm deleteObject:obj];\n    }];\n    RLMAssertThrowsWithReason([obj freeze],\n                              @\"Object has been deleted or invalidated.\");\n}\n\n- (void)testFreezeFromWrongThread {\n    IntObject *obj = managedObject();\n    [self dispatchAsyncAndWait:^{\n        RLMAssertThrowsWithReason([obj freeze],\n                                  @\"Realm accessed from incorrect thread\");\n    }];\n}\n\n- (void)testAccessFrozenObjectFromDifferentThread {\n    IntObject *obj = managedObject();\n    IntObject *frozen = [obj freeze];\n    [self dispatchAsyncAndWait:^{\n        XCTAssertEqual(frozen.intCol, 0);\n    }];\n}\n\n- (void)testMutateFrozenObject {\n    IntObject *obj = managedObject();\n    IntObject *frozen = obj.freeze;\n\n    RLMRealm *realm = frozen.realm;\n    RLMAssertThrowsWithReason([realm beginWriteTransaction], @\"Can't perform transactions on a frozen Realm\");\n    XCTAssertThrows(frozen.intCol = 1);\n}\n\n- (void)testObserveFrozenObject {\n    IntObject *frozen = [managedObject() freeze];\n    id block = ^(__unused BOOL deleted, __unused NSArray *changes, __unused NSError *error) {};\n    RLMAssertThrowsWithReason([frozen addNotificationBlock:block],\n                              @\"Frozen Realms do not change and do not have change notifications.\");\n}\n\n- (void)testFrozenObjectEquality {\n    IntObject *liveObj = [[IntObject alloc] init];\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    [realm transactionWithBlock:^{\n        [realm addObject:liveObj];\n    }];\n\n    IntObject *frozen1 = [liveObj freeze];\n    IntObject *frozen2 = [liveObj freeze];\n    XCTAssertNotEqual(frozen1, frozen2);\n    XCTAssertEqualObjects(frozen1, frozen2);\n\n    [realm transactionWithBlock:^{\n        [StringObject createInRealm:realm withValue:@[@\"a\"]];\n    }];\n    IntObject *frozen3 = [liveObj freeze];\n\n    XCTAssertEqualObjects(frozen1, frozen2);\n    XCTAssertNotEqualObjects(frozen1, frozen3);\n    XCTAssertNotEqualObjects(frozen2, frozen3);\n}\n\n- (void)testFrozenObjectHashing {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    [realm transactionWithBlock:^{\n        // NSSet does a linear search on an array for very small sets, so make\n        // enough objects to ensure it actually does hash lookups\n        for (int i = 0; i < 200; ++i) {\n            [IntObject createInRealm:realm withValue:@[@(i)]];\n        }\n    }];\n\n    NSMutableSet *frozenSet = [NSMutableSet new];\n    NSMutableSet *thawedSet = [NSMutableSet new];\n    RLMResults<IntObject *> *allObjects = [IntObject allObjectsInRealm:realm];\n    for (int i = 0; i < 100; ++i) {\n        [thawedSet addObject:allObjects[i]];\n        [frozenSet addObject:allObjects[i].freeze];\n    }\n\n    for (IntObject *obj in allObjects) {\n        XCTAssertFalse([thawedSet containsObject:obj]);\n        XCTAssertFalse([frozenSet containsObject:obj]);\n        XCTAssertEqual([frozenSet containsObject:obj.freeze], obj.intCol < 100);\n    }\n}\n\n- (void)testFreezeInsideWriteTransaction {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n    IntObject *obj = [IntObject createInRealm:realm withValue:@[@1]];\n    RLMAssertThrowsWithReason([obj freeze], @\"Cannot freeze an object in the same write transaction as it was created in.\");\n    [realm commitWriteTransaction];\n\n    [realm beginWriteTransaction];\n    obj.intCol = 2;\n    // Frozen objects have the value of the object at the start of the transaction\n    XCTAssertEqual(obj.freeze.intCol, 1);\n    [realm cancelWriteTransaction];\n}\n\n- (void)testThaw {\n    IntObject *frozen = [managedObject() freeze];\n    XCTAssertTrue([frozen isFrozen]);\n\n    IntObject *live = [frozen thaw];\n    XCTAssertFalse([live isFrozen]);\n\n    RLMRealm *liveRealm = live.realm;\n    [liveRealm beginWriteTransaction];\n    live.intCol = 1;\n    [liveRealm commitWriteTransaction];\n    XCTAssertNotEqual(live.intCol, frozen.intCol);\n}\n\n- (void)testThawDeleted {\n    IntObject *obj = managedObject();\n    IntObject *frozen = [obj freeze];\n    XCTAssertTrue([frozen isFrozen]);\n\n    RLMRealm *realm = obj.realm;\n    [realm beginWriteTransaction];\n    [realm deleteObject:obj];\n    [realm commitWriteTransaction];\n    \n    IntObject *thawed = [frozen thaw];\n    XCTAssertNil(thawed, @\"Thaw should return nil when object was deleted\");\n}\n\n- (void)testThawPreviousVersion {\n    IntObject *obj = managedObject();\n    IntObject *frozen = [obj freeze];\n    XCTAssertTrue([frozen isFrozen]);\n    XCTAssertEqual(obj.intCol, frozen.intCol);\n    \n    RLMRealm *realm = obj.realm;\n    [realm beginWriteTransaction];\n    obj.intCol = 1;\n    [realm commitWriteTransaction];\n    XCTAssertNotEqual(obj.intCol, frozen.intCol, @\"Frozen object shouldn't mutate\");\n    \n    IntObject *thawed = [frozen thaw];\n    XCTAssertFalse(thawed.frozen);\n    XCTAssertEqual(thawed.intCol, obj.intCol, @\"Thawed object should reflect transactions since the original reference was frozen.\");\n}\n\n- (void)testThawUpdatedOnDifferentThread {\n    IntObject *obj = managedObject();\n    RLMThreadSafeReference *tsr = [RLMThreadSafeReference referenceWithThreadConfined:obj];\n\n    __block IntObject *frozen;\n    [self dispatchAsyncAndWait:^{\n        IntObject *obj = [RLMRealm.defaultRealm resolveThreadSafeReference:tsr];\n        [RLMRealm.defaultRealm beginWriteTransaction];\n        obj.intCol = 1;\n        [RLMRealm.defaultRealm commitWriteTransaction];\n        frozen = [obj freeze];\n    }];\n\n    IntObject* thawed = [frozen thaw];\n    XCTAssertEqual(thawed.intCol, 0, @\"Thaw shouldn't reflect background transactions until main thread realm is refreshed\");\n    [RLMRealm.defaultRealm refresh];\n    XCTAssertEqual(thawed.intCol, 1);\n}\n\n- (void)testThawCreatedOnDifferentThread {\n    __attribute((objc_precise_lifetime)) RLMRealm *realm = [RLMRealm defaultRealm];\n    XCTAssertEqual([[IntObject allObjects] count], 0);\n\n    __block IntObject *frozen;\n    [self dispatchAsyncAndWait:^{\n        IntObject *obj = managedObject();\n        frozen = [obj freeze];\n    }];\n    XCTAssertNil([frozen thaw]);\n    XCTAssertEqual([[IntObject allObjects] count], 0);\n    [RLMRealm.defaultRealm refresh];\n    XCTAssertEqual([[IntObject allObjects] count], 1);\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/PerformanceTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#import \"RLMRealm_Dynamic.h\"\n#import \"RLMRealm_Private.h\"\n\n#if !DEBUG && TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR\n\n@interface PerformanceTests : RLMTestCase\n@property (nonatomic) dispatch_queue_t queue;\n@property (nonatomic) dispatch_semaphore_t sema;\n@end\n\nstatic RLMRealm *s_smallRealm, *s_mediumRealm, *s_largeRealm;\n\n@implementation PerformanceTests\n\n+ (void)setUp {\n    [super setUp];\n\n    s_smallRealm = [self createStringObjects:1];\n    s_mediumRealm = [self createStringObjects:5];\n    s_largeRealm = [self createStringObjects:50];\n}\n\n+ (void)tearDown {\n    s_smallRealm = s_mediumRealm = s_largeRealm = nil;\n    [RLMRealm resetRealmState];\n    [super tearDown];\n}\n\n- (void)resetRealmState {\n    // Do nothing, as we need to keep our in-memory realms around between tests\n}\n\n- (void)measureBlock:(__attribute__((noescape)) void (^)(void))block {\n    [super measureBlock:^{\n        @autoreleasepool {\n            block();\n        }\n    }];\n}\n\n- (void)measureMetrics:(NSArray *)metrics automaticallyStartMeasuring:(BOOL)automaticallyStartMeasuring forBlock:(__attribute__((noescape)) void (^)(void))block {\n    [super measureMetrics:metrics automaticallyStartMeasuring:automaticallyStartMeasuring forBlock:^{\n        @autoreleasepool {\n            block();\n        }\n    }];\n}\n\n+ (RLMRealm *)createStringObjects:(int)factor {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration new];\n    config.inMemoryIdentifier = @(factor).stringValue;\n\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n    [realm beginWriteTransaction];\n    for (int i = 0; i < 10000 * factor; ++i) {\n        [StringObject createInRealm:realm withValue:@[@\"a\"]];\n        [StringObject createInRealm:realm withValue:@[@\"b\"]];\n    }\n    [realm commitWriteTransaction];\n\n    return realm;\n}\n\n- (RLMRealm *)testRealm {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration new];\n    config.inMemoryIdentifier = @\"test\";\n    return [RLMRealm realmWithConfiguration:config error:nil];\n}\n\n- (void)testInsertMultiple {\n    [self measureMetrics:self.class.defaultPerformanceMetrics automaticallyStartMeasuring:NO forBlock:^{\n        RLMRealm *realm = self.realmWithTestPath;\n        [self startMeasuring];\n        [realm beginWriteTransaction];\n        for (int i = 0; i < 500000; ++i) {\n            StringObject *obj = [[StringObject alloc] init];\n            obj.stringCol = @\"a\";\n            [realm addObject:obj];\n        }\n        [realm commitWriteTransaction];\n        [self stopMeasuring];\n        [self tearDown];\n    }];\n}\n\n- (void)testInsertSingleLiteral {\n    [self measureBlock:^{\n        RLMRealm *realm = self.realmWithTestPath;\n        for (int i = 0; i < 5000; ++i) {\n            [realm beginWriteTransaction];\n            [StringObject createInRealm:realm withValue:@[@\"a\"]];\n            [realm commitWriteTransaction];\n        }\n        [self tearDown];\n    }];\n}\n\n- (void)testInsertMultipleLiteral {\n    [self measureBlock:^{\n        RLMRealm *realm = self.realmWithTestPath;\n        [realm beginWriteTransaction];\n        for (int i = 0; i < 500000; ++i) {\n            [StringObject createInRealm:realm withValue:@[@\"a\"]];\n        }\n        [realm commitWriteTransaction];\n        [self tearDown];\n    }];\n}\n\n- (RLMRealm *)getStringObjects:(int)factor {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration new];\n    config.inMemoryIdentifier = @(factor).stringValue;\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n    [NSFileManager.defaultManager removeItemAtURL:RLMTestRealmURL() error:nil];\n    [realm writeCopyToURL:RLMTestRealmURL() encryptionKey:nil error:nil];\n    return [self realmWithTestPath];\n}\n\n- (void)testCountWhereQuery {\n    RLMRealm *realm = [self getStringObjects:50];\n    [self measureBlock:^{\n        for (int i = 0; i < 50; ++i) {\n            RLMResults *array = [StringObject objectsInRealm:realm where:@\"stringCol = 'a'\"];\n            [array count];\n        }\n    }];\n}\n\n- (void)testCountWhereTableView {\n    RLMRealm *realm = [self getStringObjects:50];\n    [self measureBlock:^{\n        for (int i = 0; i < 100; ++i) {\n            RLMResults *array = [StringObject objectsInRealm:realm where:@\"stringCol = 'a'\"];\n            [array firstObject]; // Force materialization of backing table view\n            [array count];\n        }\n    }];\n}\n\n- (void)testEnumerateAndAccessQuery {\n    RLMRealm *realm = [self getStringObjects:50];\n\n    [self measureBlock:^{\n        for (StringObject *so in [StringObject objectsInRealm:realm where:@\"stringCol = 'a'\"]) {\n            (void)[so stringCol];\n        }\n    }];\n}\n\n- (void)testEnumerateAndAccessAll {\n    RLMRealm *realm = [self getStringObjects:50];\n\n    [self measureBlock:^{\n        for (StringObject *so in [StringObject allObjectsInRealm:realm]) {\n            (void)[so stringCol];\n        }\n    }];\n}\n\n- (void)testEnumerateAndAccessAllTV {\n    RLMRealm *realm = [self getStringObjects:50];\n\n    [self measureBlock:^{\n        [realm beginWriteTransaction];\n        for (StringObject *so in [StringObject allObjectsInRealm:realm]) {\n            (void)[so stringCol];\n        }\n        [realm cancelWriteTransaction];\n    }];\n}\n\n- (void)testEnumerateAndAccessAllSlow {\n    RLMRealm *realm = [self getStringObjects:50];\n\n    [self measureBlock:^{\n        RLMResults *all = [StringObject allObjectsInRealm:realm];\n        for (NSUInteger i = 0; i < all.count; ++i) {\n            (void)[all[i] stringCol];\n\n        }\n    }];\n}\n\n- (void)testEnumerateAndAccessArrayProperty {\n    RLMRealm *realm = [self getStringObjects:50];\n\n    [realm beginWriteTransaction];\n    ArrayPropertyObject *apo = [ArrayPropertyObject createInRealm:realm\n                                                       withValue:@[@\"name\", [StringObject allObjectsInRealm:realm], @[]]];\n    [realm commitWriteTransaction];\n\n    [self measureBlock:^{\n        for (StringObject *so in apo.array) {\n            (void)[so stringCol];\n        }\n    }];\n}\n\n- (void)testEnumerateAndAccessArrayPropertySlow {\n    RLMRealm *realm = [self getStringObjects:50];\n\n    [realm beginWriteTransaction];\n    ArrayPropertyObject *apo = [ArrayPropertyObject createInRealm:realm\n                                                       withValue:@[@\"name\", [StringObject allObjectsInRealm:realm], @[]]];\n    [realm commitWriteTransaction];\n\n    [self measureBlock:^{\n        RLMArray *array = apo.array;\n        for (NSUInteger i = 0; i < array.count; ++i) {\n            (void)[array[i] stringCol];\n        }\n    }];\n}\n\n- (void)testEnumerateAndAccessSetProperty {\n    RLMRealm *realm = [self getStringObjects:50];\n\n    [realm beginWriteTransaction];\n    SetPropertyObject *spo = [SetPropertyObject createInRealm:realm\n                                                    withValue:@[@\"name\", [StringObject allObjectsInRealm:realm], @[]]];\n    [realm commitWriteTransaction];\n\n    [self measureBlock:^{\n        for (StringObject *so in spo.set) {\n            (void)[so stringCol];\n        }\n    }];\n}\n\n- (void)testEnumerateAndAccessSetPropertySlow {\n    RLMRealm *realm = [self getStringObjects:50];\n\n    [realm beginWriteTransaction];\n    SetPropertyObject *spo = [SetPropertyObject createInRealm:realm\n                                                    withValue:@[@\"name\", [StringObject allObjectsInRealm:realm], @[]]];\n    [realm commitWriteTransaction];\n\n    [self measureBlock:^{\n        RLMSet *set = spo.set;\n        for (NSUInteger i = 0; i < set.count; ++i) {\n            (void)set.count;\n        }\n    }];\n}\n\n- (void)testEnumerateAndAccessDictionaryPropertySlow {\n    RLMRealm *realm = [self getStringObjects:50];\n\n    [realm beginWriteTransaction];\n    DictionaryPropertyObject *dpo = [DictionaryPropertyObject\n                                     createInRealm:realm\n                                     withValue:@[]];\n    for (StringObject *so in [StringObject allObjectsInRealm:realm]) {\n        NSString *key = [[NSUUID UUID] UUIDString];\n        dpo.stringDictionary[key] = so;\n    }\n    [realm commitWriteTransaction];\n\n    [self measureBlock:^{\n        RLMDictionary *d = dpo.stringDictionary;\n        for (NSUInteger i = 0; i < d.count; ++i) {\n            (void)d.count;\n        }\n    }];\n}\n\n- (void)testEnumerateAndMutateAll {\n    RLMRealm *realm = [self getStringObjects:50];\n\n    [self measureBlock:^{\n        [realm beginWriteTransaction];\n        for (StringObject *so in [StringObject allObjectsInRealm:realm]) {\n            so.stringCol = @\"c\";\n        }\n        [realm commitWriteTransaction];\n    }];\n}\n\n- (void)testEnumerateAndMutateQuery {\n    RLMRealm *realm = [self getStringObjects:5];\n\n    [self measureBlock:^{\n        [realm beginWriteTransaction];\n        for (StringObject *so in [StringObject objectsInRealm:realm where:@\"stringCol != 'b'\"]) {\n            so.stringCol = @\"c\";\n        }\n        [realm commitWriteTransaction];\n    }];\n}\n\n- (void)testQueryConstruction {\n    RLMRealm *realm = self.realmWithTestPath;\n    NSPredicate *predicate = [NSPredicate predicateWithFormat:@\"boolCol = false and (intCol = 5 or floatCol = 1.0) and objectCol = nil and longCol != 7 and stringCol IN {'a', 'b', 'c'}\"];\n\n    [self measureBlock:^{\n        for (int i = 0; i < 5000; ++i) {\n            [AllTypesObject objectsInRealm:realm withPredicate:predicate];\n        }\n    }];\n}\n\n- (void)testDeleteAll {\n    [self measureMetrics:self.class.defaultPerformanceMetrics automaticallyStartMeasuring:NO forBlock:^{\n        RLMRealm *realm = [self getStringObjects:50];\n\n        [self startMeasuring];\n        [realm beginWriteTransaction];\n        [realm deleteObjects:[StringObject allObjectsInRealm:realm]];\n        [realm commitWriteTransaction];\n        [self stopMeasuring];\n    }];\n}\n\n- (void)testQueryDeletion {\n    [self measureMetrics:self.class.defaultPerformanceMetrics automaticallyStartMeasuring:NO forBlock:^{\n        RLMRealm *realm = [self getStringObjects:5];\n\n        [self startMeasuring];\n        [realm beginWriteTransaction];\n        [realm deleteObjects:[StringObject objectsInRealm:realm where:@\"stringCol = 'a' OR stringCol = 'b'\"]];\n        [realm commitWriteTransaction];\n        [self stopMeasuring];\n    }];\n}\n\n- (void)testManualDeletion {\n    [self measureMetrics:self.class.defaultPerformanceMetrics automaticallyStartMeasuring:NO forBlock:^{\n        RLMRealm *realm = [self getStringObjects:5];\n\n        NSMutableArray *objects = [NSMutableArray arrayWithCapacity:10000];\n        for (StringObject *obj in [StringObject allObjectsInRealm:realm]) {\n            [objects addObject:obj];\n        }\n\n        [self startMeasuring];\n        [realm beginWriteTransaction];\n        [realm deleteObjects:objects];\n        [realm commitWriteTransaction];\n        [self stopMeasuring];\n    }];\n}\n\n- (void)testUnIndexedStringLookup {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    for (int i = 0; i < 10000; ++i) {\n        [StringObject createInRealm:realm withValue:@[@(i).stringValue]];\n    }\n    [realm commitWriteTransaction];\n\n    [self measureBlock:^{\n        for (int i = 0; i < 10000; ++i) {\n            [[StringObject objectsInRealm:realm where:@\"stringCol = %@\", @(i).stringValue] firstObject];\n        }\n    }];\n}\n\n- (void)testIndexedStringLookup {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    for (int i = 0; i < 10000; ++i) {\n        [IndexedStringObject createInRealm:realm withValue:@[@(i).stringValue]];\n    }\n    [realm commitWriteTransaction];\n\n    [self measureBlock:^{\n        for (int i = 0; i < 10000; ++i) {\n            [[IndexedStringObject objectsInRealm:realm where:@\"stringCol = %@\", @(i).stringValue] firstObject];\n        }\n    }];\n}\n\n- (void)testLargeINQuery {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    NSMutableArray *ids = [NSMutableArray arrayWithCapacity:300000];\n    for (int i = 0; i < 300000; ++i) {\n        [IntObject createInRealm:realm withValue:@[@(i)]];\n        if (i % 2) {\n            [ids addObject:@(i)];\n        }\n    }\n    [realm commitWriteTransaction];\n\n    [self measureBlock:^{\n        (void)[[IntObject objectsInRealm:realm where:@\"intCol IN %@\", ids] firstObject];\n    }];\n}\n\n- (void)testSortingAllObjects {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    for (int i = 0; i < 300000; ++i) {\n        [IntObject createInRealm:realm withValue:@[@(arc4random())]];\n    }\n    [realm commitWriteTransaction];\n\n    [self measureBlock:^{\n        (void)[[IntObject allObjectsInRealm:realm] sortedResultsUsingKeyPath:@\"intCol\" ascending:YES].lastObject;\n    }];\n}\n\n- (void)testRealmCreationCached {\n    __block RLMRealm *realm;\n    [self dispatchAsyncAndWait:^{\n        realm = [self realmWithTestPath]; // ensure a cached realm for the path\n    }];\n\n    [self measureBlock:^{\n        for (int i = 0; i < 2500; ++i) {\n            @autoreleasepool {\n                [self realmWithTestPath];\n            }\n        }\n    }];\n    [realm configuration];\n}\n\n- (void)testRealmCreationUncached {\n    [self measureBlock:^{\n        for (int i = 0; i < 500; ++i) {\n            @autoreleasepool {\n                [self realmWithTestPath];\n            }\n        }\n    }];\n}\n\n- (void)testRealmFileCreation {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration new];\n    __block int measurement = 0;\n    const int iterations = 100;\n    [self measureBlock:^{\n        for (int i = 0; i < iterations; ++i) {\n            @autoreleasepool {\n                config.inMemoryIdentifier = @(measurement * iterations + i).stringValue;\n                [RLMRealm realmWithConfiguration:config error:nil];\n            }\n        }\n        ++measurement;\n    }];\n}\n\n- (void)testInvalidateRefresh {\n    RLMRealm *realm = [self testRealm];\n    [self measureBlock:^{\n        for (int i = 0; i < 500000; ++i) {\n            @autoreleasepool {\n                [realm invalidate];\n                [realm refresh];\n            }\n        }\n    }];\n}\n\n- (void)testCommitWriteTransaction {\n    [self measureMetrics:self.class.defaultPerformanceMetrics automaticallyStartMeasuring:NO forBlock:^{\n        RLMRealm *realm = self.testRealm;\n        [realm beginWriteTransaction];\n        IntObject *obj = [IntObject createInRealm:realm withValue:@[@0]];\n        [realm commitWriteTransaction];\n\n        [self startMeasuring];\n        while (obj.intCol < 1000) {\n            [realm transactionWithBlock:^{\n                obj.intCol++;\n            }];\n        }\n        [self stopMeasuring];\n    }];\n}\n\n- (void)testCommitWriteTransactionWithLocalNotification {\n    [self measureMetrics:self.class.defaultPerformanceMetrics automaticallyStartMeasuring:NO forBlock:^{\n        RLMRealm *realm = self.testRealm;\n        [realm beginWriteTransaction];\n        IntObject *obj = [IntObject createInRealm:realm withValue:@[@0]];\n        [realm commitWriteTransaction];\n\n        RLMNotificationToken *token = [realm addNotificationBlock:^(__unused NSString *note, __unused RLMRealm *realm) { }];\n        [self startMeasuring];\n        while (obj.intCol < 5000) {\n            [realm transactionWithBlock:^{\n                obj.intCol++;\n            }];\n        }\n        [self stopMeasuring];\n        [token invalidate];\n    }];\n}\n\n- (void)testCommitWriteTransactionWithCrossThreadNotification {\n    const int stopValue = 5000;\n\n    [self measureMetrics:self.class.defaultPerformanceMetrics automaticallyStartMeasuring:NO forBlock:^{\n        RLMRealm *realm = self.testRealm;\n        [realm beginWriteTransaction];\n        IntObject *obj = [IntObject createInRealm:realm withValue:@[@0]];\n        [realm commitWriteTransaction];\n\n        dispatch_semaphore_t sema = dispatch_semaphore_create(0);\n        [self dispatchAsync:^{\n            RLMRealm *realm = self.testRealm;\n            IntObject *obj = [[IntObject allObjectsInRealm:realm] firstObject];\n            __block RLMNotificationToken *token;\n\n            CFRunLoopPerformBlock(CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, ^{\n                token = [realm addNotificationBlock:^(__unused NSString *note, __unused RLMRealm *realm) {\n                    if (obj.intCol == stopValue) {\n                        CFRunLoopStop(CFRunLoopGetCurrent());\n                    }\n                }];\n                dispatch_semaphore_signal(sema);\n            });\n            CFRunLoopRun();\n\n            [token invalidate];\n        }];\n\n        dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);\n        [self startMeasuring];\n        while (obj.intCol < stopValue) {\n            [realm transactionWithBlock:^{\n                obj.intCol++;\n            }];\n        }\n\n        [self dispatchAsyncAndWait:^{}];\n        [self stopMeasuring];\n    }];\n}\n\n- (void)testCommitWriteTransactionWithResultsNotification {\n    [self measureMetrics:self.class.defaultPerformanceMetrics automaticallyStartMeasuring:NO forBlock:^{\n        RLMRealm *realm = [self getStringObjects:5];\n        RLMResults *results = [StringObject allObjectsInRealm:realm];\n        RLMNotificationToken *token = [results addNotificationBlock:^(__unused RLMResults *results, __unused RLMCollectionChange *change, __unused NSError *error) {\n            CFRunLoopStop(CFRunLoopGetCurrent());\n        }];\n        CFRunLoopRun();\n\n        [realm beginWriteTransaction];\n        [realm deleteObjects:[StringObject objectsInRealm:realm where:@\"stringCol = 'a'\"]];\n        [realm commitWriteTransaction];\n\n        [self startMeasuring];\n        CFRunLoopRun();\n        [token invalidate];\n    }];\n}\n\n- (void)testCommitWriteTransactionWithListNotification {\n    [self measureMetrics:self.class.defaultPerformanceMetrics automaticallyStartMeasuring:NO forBlock:^{\n        RLMRealm *realm = [self getStringObjects:5];\n        [realm beginWriteTransaction];\n        ArrayPropertyObject *arrayObj = [ArrayPropertyObject createInRealm:realm withValue:@[@\"\", [StringObject allObjectsInRealm:realm], @[]]];\n        [realm commitWriteTransaction];\n\n        RLMNotificationToken *token = [arrayObj.array addNotificationBlock:^(__unused RLMArray *results, __unused RLMCollectionChange *change, __unused NSError *error) {\n            CFRunLoopStop(CFRunLoopGetCurrent());\n        }];\n        CFRunLoopRun();\n\n        [realm beginWriteTransaction];\n        [realm deleteObjects:[StringObject objectsInRealm:realm where:@\"stringCol = 'a'\"]];\n        [realm commitWriteTransaction];\n\n        [self startMeasuring];\n        CFRunLoopRun();\n        [token invalidate];\n    }];\n}\n\n- (void)testCommitWriteTransactionWithObjectNotifications {\n    RLMRealm *realm = [self getStringObjects:5];\n    NSMutableArray *tokens = [NSMutableArray new];\n    for (StringObject *so in [StringObject allObjectsInRealm:realm]) {\n        [tokens addObject:[so addNotificationBlock:^(__unused BOOL deleted, __unused NSArray *changes, __unused NSError *error) {\n            CFRunLoopStop(CFRunLoopGetCurrent());\n        }]];\n    }\n\n    // Object notifiers don't have an initial notification, so trigger a\n    // small unmeasured notification we can wait for\n    [realm beginWriteTransaction];\n    [[StringObject allObjectsInRealm:realm].firstObject setStringCol:@\"a\"];\n    [realm commitWriteTransaction];\n    CFRunLoopRun();\n\n    [self measureMetrics:self.class.defaultPerformanceMetrics automaticallyStartMeasuring:NO forBlock:^{\n        [realm beginWriteTransaction];\n        for (StringObject *so in [StringObject allObjectsInRealm:realm]) {\n            so.stringCol = @\"a\";\n        }\n        [realm commitWriteTransaction];\n\n        [self startMeasuring];\n        CFRunLoopRun();\n    }];\n\n    for (RLMNotificationToken *token in tokens) {\n        [token invalidate];\n    }\n}\n\n- (void)testRegisterObjectNotififers {\n    [self measureBlock:^{\n        RLMRealm *realm = [self getStringObjects:1];\n        NSMutableArray *tokens = [NSMutableArray new];\n        for (StringObject *so in [StringObject allObjectsInRealm:realm]) {\n            [tokens addObject:[so addNotificationBlock:^(__unused BOOL deleted, __unused NSArray *changes, __unused NSError *error) {\n                CFRunLoopStop(CFRunLoopGetCurrent());\n            }]];\n        }\n\n        // Object notifiers don't have an initial notification, so trigger a\n        // small unmeasured notification we can wait for\n        [realm beginWriteTransaction];\n        [[StringObject allObjectsInRealm:realm].firstObject setStringCol:@\"a\"];\n        [realm commitWriteTransaction];\n        CFRunLoopRun();\n\n        for (RLMNotificationToken *token in tokens) {\n            [token invalidate];\n        }\n\n        // Destroying the Realm waits for the notifiers to tear down\n    }];\n}\n\n- (void)testCrossThreadSyncLatency {\n    const int stopValue = 5000;\n\n    [self measureMetrics:self.class.defaultPerformanceMetrics automaticallyStartMeasuring:NO forBlock:^{\n        RLMRealm *realm = self.testRealm;\n        [realm beginWriteTransaction];\n        [realm deleteAllObjects];\n        IntObject *obj = [IntObject createInRealm:realm withValue:@[@0]];\n        [realm commitWriteTransaction];\n\n        dispatch_semaphore_t sema = dispatch_semaphore_create(0);\n        [self dispatchAsync:^{\n            RLMRealm *realm = self.testRealm;\n            IntObject *obj = [[IntObject allObjectsInRealm:realm] firstObject];\n            __block RLMNotificationToken *token;\n\n            CFRunLoopPerformBlock(CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, ^{\n                token = [realm addNotificationBlock:^(__unused NSString *note, __unused RLMRealm *realm) {\n                    if (obj.intCol == stopValue) {\n                        CFRunLoopStop(CFRunLoopGetCurrent());\n                    }\n                    else if (obj.intCol % 2 == 0) {\n                        [realm transactionWithBlock:^{\n                            obj.intCol++;\n                        }];\n                    }\n                }];\n\n                dispatch_semaphore_signal(sema);\n            });\n            CFRunLoopRun();\n\n            [token invalidate];\n        }];\n\n        RLMNotificationToken *token = [realm addNotificationBlock:^(__unused NSString *note, __unused RLMRealm *realm) {\n            if (obj.intCol % 2 == 1 && obj.intCol < stopValue) {\n                [realm transactionWithBlock:^{\n                    obj.intCol++;\n                }];\n            }\n        }];\n\n        dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);\n        [self startMeasuring];\n        [realm transactionWithBlock:^{\n            obj.intCol++;\n        }];\n        while (obj.intCol < stopValue) {\n            [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];\n        }\n\n        [self dispatchAsyncAndWait:^{}];\n        [self stopMeasuring];\n\n        [token invalidate];\n    }];\n}\n\n- (void)testArrayKVOIndexHandlingRemoveForward {\n    [self measureMetrics:self.class.defaultPerformanceMetrics automaticallyStartMeasuring:NO forBlock:^{\n        RLMRealm *realm = [self getStringObjects:50];\n        [realm beginWriteTransaction];\n        ArrayPropertyObject *obj = [ArrayPropertyObject createInRealm:realm withValue:@[@\"\", [StringObject allObjectsInRealm:realm], @[]]];\n        [realm commitWriteTransaction];\n\n        const NSUInteger initial = obj.array.count;\n        [self observeObject:obj keyPath:@\"array\"\n                      until:^(ArrayPropertyObject *obj) { return obj.array.count < initial; }];\n\n        [self startMeasuring];\n        [realm beginWriteTransaction];\n        for (NSUInteger i = 0; i < obj.array.count; i += 10) {\n            [obj.array removeObjectAtIndex:i];\n        }\n        [realm commitWriteTransaction];\n        dispatch_sync(_queue, ^{});\n    }];\n}\n\n- (void)testArrayKVOIndexHandlingRemoveBackwards {\n    [self measureMetrics:self.class.defaultPerformanceMetrics automaticallyStartMeasuring:NO forBlock:^{\n        RLMRealm *realm = [self getStringObjects:50];\n        [realm beginWriteTransaction];\n        ArrayPropertyObject *obj = [ArrayPropertyObject createInRealm:realm withValue:@[@\"\", [StringObject allObjectsInRealm:realm], @[]]];\n        [realm commitWriteTransaction];\n\n        const NSUInteger initial = obj.array.count;\n        [self observeObject:obj keyPath:@\"array\"\n                      until:^(ArrayPropertyObject *o) {\n            return o.array.count < initial;\n\n        }];\n\n        [self startMeasuring];\n        [realm beginWriteTransaction];\n        for (NSUInteger i = obj.array.count; i > 0; i -= i > 10 ? 10 : i) {\n            [obj.array removeObjectAtIndex:i - 1];\n        }\n        [realm commitWriteTransaction];\n        dispatch_sync(_queue, ^{});\n    }];\n}\n\n- (void)testArrayKVOIndexHandlingInsertCompact {\n    [self measureMetrics:self.class.defaultPerformanceMetrics automaticallyStartMeasuring:NO forBlock:^{\n        RLMRealm *realm = [self getStringObjects:50];\n        [realm beginWriteTransaction];\n        ArrayPropertyObject *obj = [ArrayPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[]]];\n        [realm commitWriteTransaction];\n\n        const NSUInteger count = [StringObject allObjectsInRealm:realm].count / 8;\n        const NSUInteger factor = count / 10;\n\n        [self observeObject:obj keyPath:@\"array\"\n                      until:^(ArrayPropertyObject *obj) { return obj.array.count >= count; }];\n\n        RLMArray *array = obj.array;\n        [self startMeasuring];\n        [realm beginWriteTransaction];\n        for (StringObject *so in [StringObject allObjectsInRealm:realm]) {\n            [array addObject:so];\n            if (array.count % factor == 0) {\n                [realm commitWriteTransaction];\n                dispatch_semaphore_wait(_sema, DISPATCH_TIME_FOREVER);\n                [realm beginWriteTransaction];\n            }\n            if (array.count > count) {\n                break;\n            }\n        }\n        [realm commitWriteTransaction];\n\n        dispatch_sync(_queue, ^{});\n    }];\n}\n\n- (void)testArrayKVOIndexHandlingInsertSparse {\n    [self measureMetrics:self.class.defaultPerformanceMetrics automaticallyStartMeasuring:NO forBlock:^{\n        RLMRealm *realm = [self getStringObjects:50];\n        [realm beginWriteTransaction];\n        ArrayPropertyObject *obj = [ArrayPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[]]];\n        [realm commitWriteTransaction];\n\n        const NSUInteger count = [StringObject allObjectsInRealm:realm].count / 8;\n        const NSUInteger factor = count / 10;\n\n        [self observeObject:obj keyPath:@\"array\"\n                      until:^(ArrayPropertyObject *obj) { return obj.array.count >= count; }];\n\n        RLMArray *array = obj.array;\n        [self startMeasuring];\n        [realm beginWriteTransaction];\n        for (StringObject *so in [StringObject allObjectsInRealm:realm]) {\n            NSUInteger index = array.count;\n            if (array.count > factor) {\n                index = index * 3 % factor;\n            }\n            [array insertObject:so atIndex:index];\n\n            if (array.count % factor == 0) {\n                [realm commitWriteTransaction];\n                dispatch_semaphore_wait(_sema, DISPATCH_TIME_FOREVER);\n                [realm beginWriteTransaction];\n            }\n            if (array.count > count) {\n                break;\n            }\n        }\n        [realm commitWriteTransaction];\n\n        dispatch_sync(_queue, ^{});\n    }];\n}\n\n- (void)testSetKVOIndexHandlingRemoveForward {\n    [self measureMetrics:self.class.defaultPerformanceMetrics automaticallyStartMeasuring:NO forBlock:^{\n        RLMRealm *realm = [self getStringObjects:50];\n        [realm beginWriteTransaction];\n        SetPropertyObject *obj = [SetPropertyObject createInRealm:realm withValue:@[@\"\", [StringObject allObjectsInRealm:realm], @[]]];\n        [realm commitWriteTransaction];\n\n        const NSUInteger initial = obj.set.count;\n        [self observeObject:obj keyPath:@\"set\"\n                      until:^(SetPropertyObject *obj) { return obj.set.count < initial; }];\n\n        [self startMeasuring];\n        [realm beginWriteTransaction];\n        [obj.set removeAllObjects];\n        [realm commitWriteTransaction];\n        dispatch_sync(_queue, ^{});\n    }];\n}\n\n- (void)testSetKVOIndexHandlingRemoveBackwards {\n    [self measureMetrics:self.class.defaultPerformanceMetrics automaticallyStartMeasuring:NO forBlock:^{\n        RLMRealm *realm = [self getStringObjects:50];\n        [realm beginWriteTransaction];\n        SetPropertyObject *obj = [SetPropertyObject createInRealm:realm withValue:@[@\"\", [StringObject allObjectsInRealm:realm], @[]]];\n        [realm commitWriteTransaction];\n\n        const NSUInteger initial = obj.set.count;\n        [self observeObject:obj keyPath:@\"set\"\n                      until:^(SetPropertyObject *obj) { return obj.set.count < initial; }];\n\n        [self startMeasuring];\n        [realm beginWriteTransaction];\n        [obj.set removeAllObjects];\n        [realm commitWriteTransaction];\n        dispatch_sync(_queue, ^{});\n    }];\n}\n\n- (void)testSetKVOIndexHandlingInsertCompact {\n    [self measureMetrics:self.class.defaultPerformanceMetrics automaticallyStartMeasuring:NO forBlock:^{\n        RLMRealm *realm = [self getStringObjects:50];\n        [realm beginWriteTransaction];\n        SetPropertyObject *obj = [SetPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[]]];\n        [realm commitWriteTransaction];\n\n        const NSUInteger count = [StringObject allObjectsInRealm:realm].count / 8;\n        const NSUInteger factor = count / 10;\n\n        [self observeObject:obj keyPath:@\"set\"\n                      until:^(SetPropertyObject *obj) { return obj.set.count >= count; }];\n\n        RLMSet *set = obj.set;\n        [self startMeasuring];\n        [realm beginWriteTransaction];\n        for (StringObject *so in [StringObject allObjectsInRealm:realm]) {\n            [set addObject:so];\n            if (set.count % factor == 0) {\n                [realm commitWriteTransaction];\n                dispatch_semaphore_wait(_sema, DISPATCH_TIME_FOREVER);\n                [realm beginWriteTransaction];\n            }\n            if (set.count > count) {\n                break;\n            }\n        }\n        [realm commitWriteTransaction];\n\n        dispatch_sync(_queue, ^{});\n    }];\n}\n\n- (void)testSetKVOIndexHandlingInsertSparse {\n    [self measureMetrics:self.class.defaultPerformanceMetrics automaticallyStartMeasuring:NO forBlock:^{\n        RLMRealm *realm = [self getStringObjects:50];\n        [realm beginWriteTransaction];\n        SetPropertyObject *obj = [SetPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[]]];\n        [realm commitWriteTransaction];\n\n        const NSUInteger count = [StringObject allObjectsInRealm:realm].count / 8;\n\n        [self observeObject:obj keyPath:@\"set\"\n                      until:^(SetPropertyObject *o) { return [o set].count >= count; }];\n        RLMSet *set = obj.set;\n        [self startMeasuring];\n        [realm beginWriteTransaction];\n        for (StringObject *so in [StringObject allObjectsInRealm:realm]) {\n            [set addObject:so];\n            if (set.count > count) {\n                break;\n            }\n        }\n        [realm commitWriteTransaction];\n\n        dispatch_sync(_queue, ^{});\n    }];\n}\n\n- (void)observeObject:(RLMObject *)object keyPath:(NSString *)keyPath until:(int (^)(id))block {\n    self.sema = dispatch_semaphore_create(0);\n    self.queue = dispatch_queue_create(\"bg\", 0);\n\n    RLMRealmConfiguration *config = object.realm.configuration;\n    NSString *className = [object.class className];\n    dispatch_async(_queue, ^{\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n        id obj = [[realm allObjects:className] firstObject];\n        [obj addObserver:self forKeyPath:keyPath options:(NSKeyValueObservingOptions)0 context:(__bridge void *)_sema];\n\n        dispatch_semaphore_signal(_sema);\n        while (!block(obj)) {\n            [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];\n        }\n\n        [obj removeObserver:self forKeyPath:keyPath context:(__bridge void *)_sema];\n    });\n    dispatch_semaphore_wait(_sema, DISPATCH_TIME_FOREVER);\n}\n\n- (void)observeValueForKeyPath:(__unused NSString *)keyPath\n                      ofObject:(__unused id)object\n                        change:(__unused NSDictionary *)change\n                       context:(void *)context {\n    dispatch_semaphore_signal((__bridge dispatch_semaphore_t)context);\n}\n\n@end\n\n#endif\n"
  },
  {
    "path": "Realm/Tests/PredicateUtilTests.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2016 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#import \"RLMPredicateUtil.hpp\"\n\n@interface PredicateUtilTests : RLMTestCase\n\n@end\n\n@implementation PredicateUtilTests\n\n- (void)testVisitingAllExpressionTypes {\n    auto testPredicate = [&](NSPredicate *predicate, size_t expectedExpressionCount) {\n        size_t visitCount = 0;\n        auto visitExpression = [&](NSExpression *expression) {\n            visitCount++;\n            return expression;\n        };\n        NSPredicate *transformedPredicate = transformPredicate(predicate, visitExpression);\n        XCTAssertEqualObjects(predicate, transformedPredicate);\n        XCTAssertEqual(visitCount, expectedExpressionCount);\n    };\n    auto testPredicateString = [=](NSString *predicateString, size_t expectedExpressionCount) {\n        return testPredicate([NSPredicate predicateWithFormat:predicateString], expectedExpressionCount);\n    };\n\n    testPredicateString(@\"TRUEPREDICATE\", 0);\n    testPredicateString(@\"A == B\", 2);\n    testPredicateString(@\"A == B AND C == 1\", 4);\n    testPredicateString(@\"A.@count == 2\", 2);\n    testPredicateString(@\"SUBQUERY(collection, $variable, $variable.property == 1).@count > 2\", 9);\n    testPredicateString(@\"A IN {1, 2, 3}\", 5);\n    testPredicateString(@\"A IN B UNION C\", 4);\n    testPredicateString(@\"A IN B INTERSECT C\", 4);\n    testPredicateString(@\"A IN B MINUS C\", 4);\n    if ([NSExpression respondsToSelector:@selector(expressionForConditional:trueExpression:falseExpression:)]) {\n        // Only test conditional predicates on platforms that support them (i.e. iOS 9 and later).\n        testPredicateString(@\"TERNARY(TRUEPREDICATE, A, B) == 1\", 4);\n    }\n    testPredicateString(@\"ANYKEY == 1\", 2);\n    testPredicateString(@\"SELF == 1\", 2);\n\n    testPredicate([NSPredicate predicateWithBlock:^(id, NSDictionary*) { return NO; }], 0);\n\n    auto block = ^(id, NSArray *, NSMutableDictionary *) {\n        return @\"Hello\";\n    };\n    testPredicate([NSComparisonPredicate predicateWithLeftExpression:[NSExpression expressionForBlock:block arguments:nil]\n                                                     rightExpression:[NSExpression expressionForConstantValue:@\"hello\"]\n                                                            modifier:NSDirectPredicateModifier\n                                                                type:NSEqualToPredicateOperatorType\n                                                             options:0], 2);\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/PrimitiveArrayPropertyTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2017 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\nstatic NSDate *date(int i) {\n    return [NSDate dateWithTimeIntervalSince1970:i];\n}\nstatic NSData *data(int i) {\n    return [NSData dataWithBytesNoCopy:calloc(i, 1) length:i freeWhenDone:YES];\n}\nstatic RLMDecimal128 *decimal128(int i) {\n    return [RLMDecimal128 decimalWithNumber:@(i)];\n}\nstatic NSMutableArray *objectIds;\nstatic RLMObjectId *objectId(NSUInteger i) {\n    if (!objectIds) {\n        objectIds = [NSMutableArray new];\n    }\n    while (i >= objectIds.count) {\n        [objectIds addObject:RLMObjectId.objectId];\n    }\n    return objectIds[i];\n}\nstatic NSUUID *uuid(NSString *uuidString) {\n    return [[NSUUID alloc] initWithUUIDString:uuidString];\n}\nstatic void count(NSArray *values, double *sum, NSUInteger *count) {\n    for (id value in values) {\n        if (value != NSNull.null) {\n            ++*count;\n            *sum += [value doubleValue];\n        }\n    }\n}\nstatic double sum(NSArray *values) {\n    double sum = 0;\n    NSUInteger c = 0;\n    count(values, &sum, &c);\n    return sum;\n}\nstatic double average(NSArray *values) {\n    double sum = 0;\n    NSUInteger c = 0;\n    count(values, &sum, &c);\n    return sum / c;\n}\n\n@interface LinkToAllPrimitiveArrays : RLMObject\n@property (nonatomic) AllPrimitiveArrays *link;\n@end\n@implementation LinkToAllPrimitiveArrays\n@end\n\n@interface LinkToAllOptionalPrimitiveArrays : RLMObject\n@property (nonatomic) AllOptionalPrimitiveArrays *link;\n@end\n@implementation LinkToAllOptionalPrimitiveArrays\n@end\n\n@interface PrimitiveArrayPropertyTests : RLMTestCase\n@end\n\n@implementation PrimitiveArrayPropertyTests {\n    AllPrimitiveArrays *unmanaged;\n    AllPrimitiveArrays *managed;\n    AllOptionalPrimitiveArrays *optUnmanaged;\n    AllOptionalPrimitiveArrays *optManaged;\n    RLMRealm *realm;\n    NSArray<RLMArray *> *allArrays;\n}\n\n- (void)setUp {\n    unmanaged = [[AllPrimitiveArrays alloc] init];\n    optUnmanaged = [[AllOptionalPrimitiveArrays alloc] init];\n    realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    managed = [AllPrimitiveArrays createInRealm:realm withValue:@[]];\n    optManaged = [AllOptionalPrimitiveArrays createInRealm:realm withValue:@[]];\n    allArrays = @[\n        unmanaged.boolObj,\n        unmanaged.intObj,\n        unmanaged.floatObj,\n        unmanaged.doubleObj,\n        unmanaged.stringObj,\n        unmanaged.dataObj,\n        unmanaged.dateObj,\n        unmanaged.decimalObj,\n        unmanaged.objectIdObj,\n        unmanaged.uuidObj,\n        unmanaged.anyBoolObj,\n        unmanaged.anyIntObj,\n        unmanaged.anyFloatObj,\n        unmanaged.anyDoubleObj,\n        unmanaged.anyStringObj,\n        unmanaged.anyDataObj,\n        unmanaged.anyDateObj,\n        unmanaged.anyDecimalObj,\n        unmanaged.anyObjectIdObj,\n        unmanaged.anyUUIDObj,\n        optUnmanaged.boolObj,\n        optUnmanaged.intObj,\n        optUnmanaged.floatObj,\n        optUnmanaged.doubleObj,\n        optUnmanaged.stringObj,\n        optUnmanaged.dataObj,\n        optUnmanaged.dateObj,\n        optUnmanaged.decimalObj,\n        optUnmanaged.objectIdObj,\n        optUnmanaged.uuidObj,\n        managed.boolObj,\n        managed.intObj,\n        managed.floatObj,\n        managed.doubleObj,\n        managed.stringObj,\n        managed.dataObj,\n        managed.dateObj,\n        managed.decimalObj,\n        managed.objectIdObj,\n        managed.uuidObj,\n        managed.anyBoolObj,\n        managed.anyIntObj,\n        managed.anyFloatObj,\n        managed.anyDoubleObj,\n        managed.anyStringObj,\n        managed.anyDataObj,\n        managed.anyDateObj,\n        managed.anyDecimalObj,\n        managed.anyObjectIdObj,\n        managed.anyUUIDObj,\n        optManaged.boolObj,\n        optManaged.intObj,\n        optManaged.floatObj,\n        optManaged.doubleObj,\n        optManaged.stringObj,\n        optManaged.dataObj,\n        optManaged.dateObj,\n        optManaged.decimalObj,\n        optManaged.objectIdObj,\n        optManaged.uuidObj,\n    ];\n}\n\n- (void)tearDown {\n    if (realm.inWriteTransaction) {\n        [realm cancelWriteTransaction];\n    }\n}\n\n- (void)addObjects {\n    [unmanaged.boolObj addObjects:@[@NO, @YES]];\n    [unmanaged.intObj addObjects:@[@2, @3]];\n    [unmanaged.floatObj addObjects:@[@2.2f, @3.3f]];\n    [unmanaged.doubleObj addObjects:@[@2.2, @3.3]];\n    [unmanaged.stringObj addObjects:@[@\"a\", @\"b\"]];\n    [unmanaged.dataObj addObjects:@[data(1), data(2)]];\n    [unmanaged.dateObj addObjects:@[date(1), date(2)]];\n    [unmanaged.decimalObj addObjects:@[decimal128(2), decimal128(3)]];\n    [unmanaged.objectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [unmanaged.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [unmanaged.anyBoolObj addObjects:@[@NO, @YES]];\n    [unmanaged.anyIntObj addObjects:@[@2, @3]];\n    [unmanaged.anyFloatObj addObjects:@[@2.2f, @3.3f]];\n    [unmanaged.anyDoubleObj addObjects:@[@2.2, @3.3]];\n    [unmanaged.anyStringObj addObjects:@[@\"a\", @\"b\"]];\n    [unmanaged.anyDataObj addObjects:@[data(1), data(2)]];\n    [unmanaged.anyDateObj addObjects:@[date(1), date(2)]];\n    [unmanaged.anyDecimalObj addObjects:@[decimal128(2), decimal128(3)]];\n    [unmanaged.anyObjectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [unmanaged.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optUnmanaged.boolObj addObjects:@[@NO, @YES, NSNull.null]];\n    [optUnmanaged.intObj addObjects:@[@2, @3, NSNull.null]];\n    [optUnmanaged.floatObj addObjects:@[@2.2f, @3.3f, NSNull.null]];\n    [optUnmanaged.doubleObj addObjects:@[@2.2, @3.3, NSNull.null]];\n    [optUnmanaged.stringObj addObjects:@[@\"a\", @\"b\", NSNull.null]];\n    [optUnmanaged.dataObj addObjects:@[data(1), data(2), NSNull.null]];\n    [optUnmanaged.dateObj addObjects:@[date(1), date(2), NSNull.null]];\n    [optUnmanaged.decimalObj addObjects:@[decimal128(2), decimal128(3), NSNull.null]];\n    [optUnmanaged.objectIdObj addObjects:@[objectId(1), objectId(2), NSNull.null]];\n    [optUnmanaged.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n    [managed.boolObj addObjects:@[@NO, @YES]];\n    [managed.intObj addObjects:@[@2, @3]];\n    [managed.floatObj addObjects:@[@2.2f, @3.3f]];\n    [managed.doubleObj addObjects:@[@2.2, @3.3]];\n    [managed.stringObj addObjects:@[@\"a\", @\"b\"]];\n    [managed.dataObj addObjects:@[data(1), data(2)]];\n    [managed.dateObj addObjects:@[date(1), date(2)]];\n    [managed.decimalObj addObjects:@[decimal128(2), decimal128(3)]];\n    [managed.objectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [managed.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [managed.anyBoolObj addObjects:@[@NO, @YES]];\n    [managed.anyIntObj addObjects:@[@2, @3]];\n    [managed.anyFloatObj addObjects:@[@2.2f, @3.3f]];\n    [managed.anyDoubleObj addObjects:@[@2.2, @3.3]];\n    [managed.anyStringObj addObjects:@[@\"a\", @\"b\"]];\n    [managed.anyDataObj addObjects:@[data(1), data(2)]];\n    [managed.anyDateObj addObjects:@[date(1), date(2)]];\n    [managed.anyDecimalObj addObjects:@[decimal128(2), decimal128(3)]];\n    [managed.anyObjectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [managed.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optManaged.boolObj addObjects:@[@NO, @YES, NSNull.null]];\n    [optManaged.intObj addObjects:@[@2, @3, NSNull.null]];\n    [optManaged.floatObj addObjects:@[@2.2f, @3.3f, NSNull.null]];\n    [optManaged.doubleObj addObjects:@[@2.2, @3.3, NSNull.null]];\n    [optManaged.stringObj addObjects:@[@\"a\", @\"b\", NSNull.null]];\n    [optManaged.dataObj addObjects:@[data(1), data(2), NSNull.null]];\n    [optManaged.dateObj addObjects:@[date(1), date(2), NSNull.null]];\n    [optManaged.decimalObj addObjects:@[decimal128(2), decimal128(3), NSNull.null]];\n    [optManaged.objectIdObj addObjects:@[objectId(1), objectId(2), NSNull.null]];\n    [optManaged.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n}\n\n- (void)testCount {\n    uncheckedAssertEqual(unmanaged.intObj.count, 0U);\n    [unmanaged.intObj addObject:@1];\n    uncheckedAssertEqual(unmanaged.intObj.count, 1U);\n}\n\n- (void)testType {\n    uncheckedAssertEqual(unmanaged.boolObj.type, RLMPropertyTypeBool);\n    uncheckedAssertEqual(unmanaged.intObj.type, RLMPropertyTypeInt);\n    uncheckedAssertEqual(unmanaged.floatObj.type, RLMPropertyTypeFloat);\n    uncheckedAssertEqual(unmanaged.doubleObj.type, RLMPropertyTypeDouble);\n    uncheckedAssertEqual(unmanaged.stringObj.type, RLMPropertyTypeString);\n    uncheckedAssertEqual(unmanaged.dataObj.type, RLMPropertyTypeData);\n    uncheckedAssertEqual(unmanaged.dateObj.type, RLMPropertyTypeDate);\n    uncheckedAssertEqual(unmanaged.anyBoolObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(unmanaged.anyIntObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(unmanaged.anyFloatObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(unmanaged.anyDoubleObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(unmanaged.anyStringObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(unmanaged.anyDataObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(unmanaged.anyDateObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(unmanaged.anyDecimalObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(unmanaged.anyObjectIdObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(unmanaged.anyUUIDObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(optUnmanaged.boolObj.type, RLMPropertyTypeBool);\n    uncheckedAssertEqual(optUnmanaged.intObj.type, RLMPropertyTypeInt);\n    uncheckedAssertEqual(optUnmanaged.floatObj.type, RLMPropertyTypeFloat);\n    uncheckedAssertEqual(optUnmanaged.doubleObj.type, RLMPropertyTypeDouble);\n    uncheckedAssertEqual(optUnmanaged.stringObj.type, RLMPropertyTypeString);\n    uncheckedAssertEqual(optUnmanaged.dataObj.type, RLMPropertyTypeData);\n    uncheckedAssertEqual(optUnmanaged.dateObj.type, RLMPropertyTypeDate);\n}\n\n- (void)testOptional {\n    uncheckedAssertFalse(unmanaged.boolObj.optional);\n    uncheckedAssertFalse(unmanaged.intObj.optional);\n    uncheckedAssertFalse(unmanaged.floatObj.optional);\n    uncheckedAssertFalse(unmanaged.doubleObj.optional);\n    uncheckedAssertFalse(unmanaged.stringObj.optional);\n    uncheckedAssertFalse(unmanaged.dataObj.optional);\n    uncheckedAssertFalse(unmanaged.dateObj.optional);\n    uncheckedAssertFalse(unmanaged.anyBoolObj.optional);\n    uncheckedAssertFalse(unmanaged.anyIntObj.optional);\n    uncheckedAssertFalse(unmanaged.anyFloatObj.optional);\n    uncheckedAssertFalse(unmanaged.anyDoubleObj.optional);\n    uncheckedAssertFalse(unmanaged.anyStringObj.optional);\n    uncheckedAssertFalse(unmanaged.anyDataObj.optional);\n    uncheckedAssertFalse(unmanaged.anyDateObj.optional);\n    uncheckedAssertFalse(unmanaged.anyDecimalObj.optional);\n    uncheckedAssertFalse(unmanaged.anyObjectIdObj.optional);\n    uncheckedAssertFalse(unmanaged.anyUUIDObj.optional);\n    uncheckedAssertTrue(optUnmanaged.boolObj.optional);\n    uncheckedAssertTrue(optUnmanaged.intObj.optional);\n    uncheckedAssertTrue(optUnmanaged.floatObj.optional);\n    uncheckedAssertTrue(optUnmanaged.doubleObj.optional);\n    uncheckedAssertTrue(optUnmanaged.stringObj.optional);\n    uncheckedAssertTrue(optUnmanaged.dataObj.optional);\n    uncheckedAssertTrue(optUnmanaged.dateObj.optional);\n}\n\n- (void)testObjectClassName {\n    uncheckedAssertNil(unmanaged.boolObj.objectClassName);\n    uncheckedAssertNil(unmanaged.intObj.objectClassName);\n    uncheckedAssertNil(unmanaged.floatObj.objectClassName);\n    uncheckedAssertNil(unmanaged.doubleObj.objectClassName);\n    uncheckedAssertNil(unmanaged.stringObj.objectClassName);\n    uncheckedAssertNil(unmanaged.dataObj.objectClassName);\n    uncheckedAssertNil(unmanaged.dateObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyBoolObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyIntObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyFloatObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyDoubleObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyStringObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyDataObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyDateObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyDecimalObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyObjectIdObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyUUIDObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.boolObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.intObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.floatObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.doubleObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.stringObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.dataObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.dateObj.objectClassName);\n}\n\n- (void)testRealm {\n    uncheckedAssertNil(unmanaged.boolObj.realm);\n    uncheckedAssertNil(unmanaged.intObj.realm);\n    uncheckedAssertNil(unmanaged.floatObj.realm);\n    uncheckedAssertNil(unmanaged.doubleObj.realm);\n    uncheckedAssertNil(unmanaged.stringObj.realm);\n    uncheckedAssertNil(unmanaged.dataObj.realm);\n    uncheckedAssertNil(unmanaged.dateObj.realm);\n    uncheckedAssertNil(unmanaged.anyBoolObj.realm);\n    uncheckedAssertNil(unmanaged.anyIntObj.realm);\n    uncheckedAssertNil(unmanaged.anyFloatObj.realm);\n    uncheckedAssertNil(unmanaged.anyDoubleObj.realm);\n    uncheckedAssertNil(unmanaged.anyStringObj.realm);\n    uncheckedAssertNil(unmanaged.anyDataObj.realm);\n    uncheckedAssertNil(unmanaged.anyDateObj.realm);\n    uncheckedAssertNil(unmanaged.anyDecimalObj.realm);\n    uncheckedAssertNil(unmanaged.anyObjectIdObj.realm);\n    uncheckedAssertNil(unmanaged.anyUUIDObj.realm);\n    uncheckedAssertNil(optUnmanaged.boolObj.realm);\n    uncheckedAssertNil(optUnmanaged.intObj.realm);\n    uncheckedAssertNil(optUnmanaged.floatObj.realm);\n    uncheckedAssertNil(optUnmanaged.doubleObj.realm);\n    uncheckedAssertNil(optUnmanaged.stringObj.realm);\n    uncheckedAssertNil(optUnmanaged.dataObj.realm);\n    uncheckedAssertNil(optUnmanaged.dateObj.realm);\n}\n\n- (void)testInvalidated {\n    RLMArray *array;\n    @autoreleasepool {\n        AllPrimitiveArrays *obj = [[AllPrimitiveArrays alloc] init];\n        array = obj.intObj;\n        uncheckedAssertFalse(array.invalidated);\n    }\n    uncheckedAssertFalse(array.invalidated);\n}\n\n- (void)testDeleteObjectsInRealm {\n    for (RLMArray *array in allArrays) {\n        RLMAssertThrowsWithReason([realm deleteObjects:array], @\"Cannot delete objects from RLMArray\");\n    }\n}\n\n- (void)testObjectAtIndex {\n    RLMAssertThrowsWithReason([unmanaged.intObj objectAtIndex:0],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n\n    [unmanaged.intObj addObject:@1];\n    uncheckedAssertEqualObjects([unmanaged.intObj objectAtIndex:0], @1);\n}\n\n- (void)testObjectsAtIndexes {\n    NSMutableIndexSet *indexSet = [NSMutableIndexSet new];\n    [indexSet addIndex:0];\n    [indexSet addIndex:2];\n    XCTAssertNil([unmanaged.intObj objectsAtIndexes:indexSet]);\n    XCTAssertNil([managed.intObj objectsAtIndexes:indexSet]);\n\n    [unmanaged.intObj addObject:@1];\n    [unmanaged.intObj addObject:@2];\n    [unmanaged.intObj addObject:@3];\n    uncheckedAssertEqualObjects([unmanaged.intObj objectsAtIndexes:indexSet], (@[@1, @3]));\n    [managed.intObj addObject:@1];\n    [managed.intObj addObject:@2];\n    [managed.intObj addObject:@3];\n    uncheckedAssertEqualObjects([managed.intObj objectsAtIndexes:indexSet], (@[@1, @3]));\n\n    [indexSet addIndex:3];\n    XCTAssertNil([unmanaged.intObj objectsAtIndexes:indexSet]);\n    XCTAssertNil([managed.intObj objectsAtIndexes:indexSet]);\n}\n\n- (void)testFirstObject {\n    for (RLMArray *array in allArrays) {\n        uncheckedAssertNil(array.firstObject);\n    }\n\n    [self addObjects];\n    uncheckedAssertEqualObjects(unmanaged.boolObj.firstObject, @NO);\n    uncheckedAssertEqualObjects(unmanaged.intObj.firstObject, @2);\n    uncheckedAssertEqualObjects(unmanaged.floatObj.firstObject, @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj.firstObject, @2.2);\n    uncheckedAssertEqualObjects(unmanaged.stringObj.firstObject, @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.dataObj.firstObject, data(1));\n    uncheckedAssertEqualObjects(unmanaged.dateObj.firstObject, date(1));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj.firstObject, decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj.firstObject, objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj.firstObject, uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj.firstObject, @NO);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj.firstObject, @2);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj.firstObject, @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj.firstObject, @2.2);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj.firstObject, @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj.firstObject, data(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj.firstObject, date(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj.firstObject, decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj.firstObject, objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj.firstObject, uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj.firstObject, @NO);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj.firstObject, @2);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj.firstObject, @2.2f);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj.firstObject, @2.2);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj.firstObject, @\"a\");\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj.firstObject, data(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj.firstObject, date(1));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj.firstObject, decimal128(2));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj.firstObject, objectId(1));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj.firstObject, uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.boolObj.firstObject, @NO);\n    uncheckedAssertEqualObjects(managed.intObj.firstObject, @2);\n    uncheckedAssertEqualObjects(managed.floatObj.firstObject, @2.2f);\n    uncheckedAssertEqualObjects(managed.doubleObj.firstObject, @2.2);\n    uncheckedAssertEqualObjects(managed.stringObj.firstObject, @\"a\");\n    uncheckedAssertEqualObjects(managed.dataObj.firstObject, data(1));\n    uncheckedAssertEqualObjects(managed.dateObj.firstObject, date(1));\n    uncheckedAssertEqualObjects(managed.decimalObj.firstObject, decimal128(2));\n    uncheckedAssertEqualObjects(managed.objectIdObj.firstObject, objectId(1));\n    uncheckedAssertEqualObjects(managed.uuidObj.firstObject, uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj.firstObject, @NO);\n    uncheckedAssertEqualObjects(managed.anyIntObj.firstObject, @2);\n    uncheckedAssertEqualObjects(managed.anyFloatObj.firstObject, @2.2f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj.firstObject, @2.2);\n    uncheckedAssertEqualObjects(managed.anyStringObj.firstObject, @\"a\");\n    uncheckedAssertEqualObjects(managed.anyDataObj.firstObject, data(1));\n    uncheckedAssertEqualObjects(managed.anyDateObj.firstObject, date(1));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj.firstObject, decimal128(2));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj.firstObject, objectId(1));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj.firstObject, uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optManaged.boolObj.firstObject, @NO);\n    uncheckedAssertEqualObjects(optManaged.intObj.firstObject, @2);\n    uncheckedAssertEqualObjects(optManaged.floatObj.firstObject, @2.2f);\n    uncheckedAssertEqualObjects(optManaged.doubleObj.firstObject, @2.2);\n    uncheckedAssertEqualObjects(optManaged.stringObj.firstObject, @\"a\");\n    uncheckedAssertEqualObjects(optManaged.dataObj.firstObject, data(1));\n    uncheckedAssertEqualObjects(optManaged.dateObj.firstObject, date(1));\n    uncheckedAssertEqualObjects(optManaged.decimalObj.firstObject, decimal128(2));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj.firstObject, objectId(1));\n    uncheckedAssertEqualObjects(optManaged.uuidObj.firstObject, uuid(@\"00000000-0000-0000-0000-000000000000\"));\n\n    for (RLMArray *array in allArrays) {\n        [array removeAllObjects];\n    }\n\n    [optUnmanaged.boolObj addObject:NSNull.null];\n    [optUnmanaged.intObj addObject:NSNull.null];\n    [optUnmanaged.floatObj addObject:NSNull.null];\n    [optUnmanaged.doubleObj addObject:NSNull.null];\n    [optUnmanaged.stringObj addObject:NSNull.null];\n    [optUnmanaged.dataObj addObject:NSNull.null];\n    [optUnmanaged.dateObj addObject:NSNull.null];\n    [optUnmanaged.decimalObj addObject:NSNull.null];\n    [optUnmanaged.objectIdObj addObject:NSNull.null];\n    [optUnmanaged.uuidObj addObject:NSNull.null];\n    [optManaged.boolObj addObject:NSNull.null];\n    [optManaged.intObj addObject:NSNull.null];\n    [optManaged.floatObj addObject:NSNull.null];\n    [optManaged.doubleObj addObject:NSNull.null];\n    [optManaged.stringObj addObject:NSNull.null];\n    [optManaged.dataObj addObject:NSNull.null];\n    [optManaged.dateObj addObject:NSNull.null];\n    [optManaged.decimalObj addObject:NSNull.null];\n    [optManaged.objectIdObj addObject:NSNull.null];\n    [optManaged.uuidObj addObject:NSNull.null];\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj.firstObject, NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj.firstObject, NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj.firstObject, NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj.firstObject, NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj.firstObject, NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj.firstObject, NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj.firstObject, NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj.firstObject, NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj.firstObject, NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj.firstObject, NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.boolObj.firstObject, NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.intObj.firstObject, NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.floatObj.firstObject, NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.doubleObj.firstObject, NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.stringObj.firstObject, NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dataObj.firstObject, NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dateObj.firstObject, NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.decimalObj.firstObject, NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.objectIdObj.firstObject, NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.uuidObj.firstObject, NSNull.null);\n}\n\n- (void)testLastObject {\n    for (RLMArray *array in allArrays) {\n        uncheckedAssertNil(array.lastObject);\n    }\n\n    [self addObjects];\n\n    uncheckedAssertEqualObjects(unmanaged.boolObj.lastObject, @YES);\n    uncheckedAssertEqualObjects(unmanaged.intObj.lastObject, @3);\n    uncheckedAssertEqualObjects(unmanaged.floatObj.lastObject, @3.3f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj.lastObject, @3.3);\n    uncheckedAssertEqualObjects(unmanaged.stringObj.lastObject, @\"b\");\n    uncheckedAssertEqualObjects(unmanaged.dataObj.lastObject, data(2));\n    uncheckedAssertEqualObjects(unmanaged.dateObj.lastObject, date(2));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj.lastObject, decimal128(3));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj.lastObject, objectId(2));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj.lastObject, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj.lastObject, @YES);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj.lastObject, @3);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj.lastObject, @3.3f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj.lastObject, @3.3);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj.lastObject, @\"b\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj.lastObject, data(2));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj.lastObject, date(2));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj.lastObject, decimal128(3));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj.lastObject, objectId(2));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj.lastObject, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj.lastObject, NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj.lastObject, NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj.lastObject, NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj.lastObject, NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj.lastObject, NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj.lastObject, NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj.lastObject, NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj.lastObject, NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj.lastObject, NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj.lastObject, NSNull.null);\n    uncheckedAssertEqualObjects(managed.boolObj.lastObject, @YES);\n    uncheckedAssertEqualObjects(managed.intObj.lastObject, @3);\n    uncheckedAssertEqualObjects(managed.floatObj.lastObject, @3.3f);\n    uncheckedAssertEqualObjects(managed.doubleObj.lastObject, @3.3);\n    uncheckedAssertEqualObjects(managed.stringObj.lastObject, @\"b\");\n    uncheckedAssertEqualObjects(managed.dataObj.lastObject, data(2));\n    uncheckedAssertEqualObjects(managed.dateObj.lastObject, date(2));\n    uncheckedAssertEqualObjects(managed.decimalObj.lastObject, decimal128(3));\n    uncheckedAssertEqualObjects(managed.objectIdObj.lastObject, objectId(2));\n    uncheckedAssertEqualObjects(managed.uuidObj.lastObject, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj.lastObject, @YES);\n    uncheckedAssertEqualObjects(managed.anyIntObj.lastObject, @3);\n    uncheckedAssertEqualObjects(managed.anyFloatObj.lastObject, @3.3f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj.lastObject, @3.3);\n    uncheckedAssertEqualObjects(managed.anyStringObj.lastObject, @\"b\");\n    uncheckedAssertEqualObjects(managed.anyDataObj.lastObject, data(2));\n    uncheckedAssertEqualObjects(managed.anyDateObj.lastObject, date(2));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj.lastObject, decimal128(3));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj.lastObject, objectId(2));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj.lastObject, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(optManaged.boolObj.lastObject, NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.intObj.lastObject, NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.floatObj.lastObject, NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.doubleObj.lastObject, NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.stringObj.lastObject, NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dataObj.lastObject, NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dateObj.lastObject, NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.decimalObj.lastObject, NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.objectIdObj.lastObject, NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.uuidObj.lastObject, NSNull.null);\n\n    for (RLMArray *array in allArrays) {\n        [array removeLastObject];\n    }\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj.lastObject, @YES);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj.lastObject, @3);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj.lastObject, @3.3f);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj.lastObject, @3.3);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj.lastObject, @\"b\");\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj.lastObject, data(2));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj.lastObject, date(2));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj.lastObject, decimal128(3));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj.lastObject, objectId(2));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj.lastObject, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(optManaged.boolObj.lastObject, @YES);\n    uncheckedAssertEqualObjects(optManaged.intObj.lastObject, @3);\n    uncheckedAssertEqualObjects(optManaged.floatObj.lastObject, @3.3f);\n    uncheckedAssertEqualObjects(optManaged.doubleObj.lastObject, @3.3);\n    uncheckedAssertEqualObjects(optManaged.stringObj.lastObject, @\"b\");\n    uncheckedAssertEqualObjects(optManaged.dataObj.lastObject, data(2));\n    uncheckedAssertEqualObjects(optManaged.dateObj.lastObject, date(2));\n    uncheckedAssertEqualObjects(optManaged.decimalObj.lastObject, decimal128(3));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj.lastObject, objectId(2));\n    uncheckedAssertEqualObjects(optManaged.uuidObj.lastObject, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n}\n\n- (void)testAddObject {\n    RLMAssertThrowsWithReason([unmanaged.boolObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj addObject:@2],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj addObject:@2],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([managed.boolObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.intObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.floatObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.doubleObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.stringObj addObject:@2],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.dataObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dateObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.decimalObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.uuidObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([optManaged.intObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([optManaged.floatObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj addObject:@2],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj addObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([unmanaged.boolObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([managed.boolObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.intObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.floatObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.doubleObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.stringObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.dataObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dateObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.decimalObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.uuidObj addObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n\n    [unmanaged.boolObj addObject:@NO];\n    [unmanaged.intObj addObject:@2];\n    [unmanaged.floatObj addObject:@2.2f];\n    [unmanaged.doubleObj addObject:@2.2];\n    [unmanaged.stringObj addObject:@\"a\"];\n    [unmanaged.dataObj addObject:data(1)];\n    [unmanaged.dateObj addObject:date(1)];\n    [unmanaged.decimalObj addObject:decimal128(2)];\n    [unmanaged.objectIdObj addObject:objectId(1)];\n    [unmanaged.uuidObj addObject:uuid(@\"00000000-0000-0000-0000-000000000000\")];\n    [unmanaged.anyBoolObj addObject:@NO];\n    [unmanaged.anyIntObj addObject:@2];\n    [unmanaged.anyFloatObj addObject:@2.2f];\n    [unmanaged.anyDoubleObj addObject:@2.2];\n    [unmanaged.anyStringObj addObject:@\"a\"];\n    [unmanaged.anyDataObj addObject:data(1)];\n    [unmanaged.anyDateObj addObject:date(1)];\n    [unmanaged.anyDecimalObj addObject:decimal128(2)];\n    [unmanaged.anyObjectIdObj addObject:objectId(1)];\n    [unmanaged.anyUUIDObj addObject:uuid(@\"00000000-0000-0000-0000-000000000000\")];\n    [optUnmanaged.boolObj addObject:@NO];\n    [optUnmanaged.intObj addObject:@2];\n    [optUnmanaged.floatObj addObject:@2.2f];\n    [optUnmanaged.doubleObj addObject:@2.2];\n    [optUnmanaged.stringObj addObject:@\"a\"];\n    [optUnmanaged.dataObj addObject:data(1)];\n    [optUnmanaged.dateObj addObject:date(1)];\n    [optUnmanaged.decimalObj addObject:decimal128(2)];\n    [optUnmanaged.objectIdObj addObject:objectId(1)];\n    [optUnmanaged.uuidObj addObject:uuid(@\"00000000-0000-0000-0000-000000000000\")];\n    [managed.boolObj addObject:@NO];\n    [managed.intObj addObject:@2];\n    [managed.floatObj addObject:@2.2f];\n    [managed.doubleObj addObject:@2.2];\n    [managed.stringObj addObject:@\"a\"];\n    [managed.dataObj addObject:data(1)];\n    [managed.dateObj addObject:date(1)];\n    [managed.decimalObj addObject:decimal128(2)];\n    [managed.objectIdObj addObject:objectId(1)];\n    [managed.uuidObj addObject:uuid(@\"00000000-0000-0000-0000-000000000000\")];\n    [managed.anyBoolObj addObject:@NO];\n    [managed.anyIntObj addObject:@2];\n    [managed.anyFloatObj addObject:@2.2f];\n    [managed.anyDoubleObj addObject:@2.2];\n    [managed.anyStringObj addObject:@\"a\"];\n    [managed.anyDataObj addObject:data(1)];\n    [managed.anyDateObj addObject:date(1)];\n    [managed.anyDecimalObj addObject:decimal128(2)];\n    [managed.anyObjectIdObj addObject:objectId(1)];\n    [managed.anyUUIDObj addObject:uuid(@\"00000000-0000-0000-0000-000000000000\")];\n    [optManaged.boolObj addObject:@NO];\n    [optManaged.intObj addObject:@2];\n    [optManaged.floatObj addObject:@2.2f];\n    [optManaged.doubleObj addObject:@2.2];\n    [optManaged.stringObj addObject:@\"a\"];\n    [optManaged.dataObj addObject:data(1)];\n    [optManaged.dateObj addObject:date(1)];\n    [optManaged.decimalObj addObject:decimal128(2)];\n    [optManaged.objectIdObj addObject:objectId(1)];\n    [optManaged.uuidObj addObject:uuid(@\"00000000-0000-0000-0000-000000000000\")];\n    uncheckedAssertEqualObjects(unmanaged.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(unmanaged.intObj[0], @2);\n    uncheckedAssertEqualObjects(unmanaged.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(unmanaged.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[0], @NO);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[0], @2);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[0], data(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[0], date(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[0], @2);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(managed.intObj[0], @2);\n    uncheckedAssertEqualObjects(managed.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(managed.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(managed.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(managed.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(managed.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(managed.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(managed.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(managed.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[0], @NO);\n    uncheckedAssertEqualObjects(managed.anyIntObj[0], @2);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(managed.anyStringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[0], data(1));\n    uncheckedAssertEqualObjects(managed.anyDateObj[0], date(1));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optManaged.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(optManaged.intObj[0], @2);\n    uncheckedAssertEqualObjects(optManaged.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(optManaged.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(optManaged.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(optManaged.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n\n    [optUnmanaged.boolObj addObject:NSNull.null];\n    [optUnmanaged.intObj addObject:NSNull.null];\n    [optUnmanaged.floatObj addObject:NSNull.null];\n    [optUnmanaged.doubleObj addObject:NSNull.null];\n    [optUnmanaged.stringObj addObject:NSNull.null];\n    [optUnmanaged.dataObj addObject:NSNull.null];\n    [optUnmanaged.dateObj addObject:NSNull.null];\n    [optUnmanaged.decimalObj addObject:NSNull.null];\n    [optUnmanaged.objectIdObj addObject:NSNull.null];\n    [optUnmanaged.uuidObj addObject:NSNull.null];\n    [optManaged.boolObj addObject:NSNull.null];\n    [optManaged.intObj addObject:NSNull.null];\n    [optManaged.floatObj addObject:NSNull.null];\n    [optManaged.doubleObj addObject:NSNull.null];\n    [optManaged.stringObj addObject:NSNull.null];\n    [optManaged.dataObj addObject:NSNull.null];\n    [optManaged.dateObj addObject:NSNull.null];\n    [optManaged.decimalObj addObject:NSNull.null];\n    [optManaged.objectIdObj addObject:NSNull.null];\n    [optManaged.uuidObj addObject:NSNull.null];\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.boolObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.intObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.floatObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.stringObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dataObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dateObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.decimalObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.uuidObj[1], NSNull.null);\n}\n\n- (void)testAddObjects {\n    RLMAssertThrowsWithReason([unmanaged.boolObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj addObjects:@[@2]],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj addObjects:@[@2]],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([managed.boolObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.intObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.floatObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.doubleObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.stringObj addObjects:@[@2]],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.dataObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dateObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.decimalObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.uuidObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([optManaged.intObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([optManaged.floatObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj addObjects:@[@2]],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj addObjects:@[@\"a\"]],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([unmanaged.boolObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([managed.boolObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.intObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.floatObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.doubleObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.stringObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.dataObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dateObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.decimalObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.uuidObj addObjects:@[NSNull.null]],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n\n    [self addObjects];\n    uncheckedAssertEqualObjects(unmanaged.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(unmanaged.intObj[0], @2);\n    uncheckedAssertEqualObjects(unmanaged.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(unmanaged.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[0], @NO);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[0], @2);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[0], data(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[0], date(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[0], @2);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(managed.intObj[0], @2);\n    uncheckedAssertEqualObjects(managed.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(managed.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(managed.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(managed.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(managed.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(managed.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(managed.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(managed.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[0], @NO);\n    uncheckedAssertEqualObjects(managed.anyIntObj[0], @2);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(managed.anyStringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[0], data(1));\n    uncheckedAssertEqualObjects(managed.anyDateObj[0], date(1));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optManaged.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(optManaged.intObj[0], @2);\n    uncheckedAssertEqualObjects(optManaged.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(optManaged.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(optManaged.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(optManaged.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.boolObj[1], @YES);\n    uncheckedAssertEqualObjects(unmanaged.intObj[1], @3);\n    uncheckedAssertEqualObjects(unmanaged.floatObj[1], @3.3f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[1], @3.3);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[1], @\"b\");\n    uncheckedAssertEqualObjects(unmanaged.dataObj[1], data(2));\n    uncheckedAssertEqualObjects(unmanaged.dateObj[1], date(2));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[1], decimal128(3));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[1], objectId(2));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[1], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[1], @YES);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[1], @3);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[1], @3.3f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[1], @3.3);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[1], @\"b\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[1], data(2));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[1], date(2));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[1], decimal128(3));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[1], objectId(2));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[1], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[1], @YES);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[1], @3);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[1], @3.3f);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[1], @3.3);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[1], @\"b\");\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[1], data(2));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[1], date(2));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[1], decimal128(3));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[1], objectId(2));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[1], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(managed.boolObj[1], @YES);\n    uncheckedAssertEqualObjects(managed.intObj[1], @3);\n    uncheckedAssertEqualObjects(managed.floatObj[1], @3.3f);\n    uncheckedAssertEqualObjects(managed.doubleObj[1], @3.3);\n    uncheckedAssertEqualObjects(managed.stringObj[1], @\"b\");\n    uncheckedAssertEqualObjects(managed.dataObj[1], data(2));\n    uncheckedAssertEqualObjects(managed.dateObj[1], date(2));\n    uncheckedAssertEqualObjects(managed.decimalObj[1], decimal128(3));\n    uncheckedAssertEqualObjects(managed.objectIdObj[1], objectId(2));\n    uncheckedAssertEqualObjects(managed.uuidObj[1], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[1], @YES);\n    uncheckedAssertEqualObjects(managed.anyIntObj[1], @3);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[1], @3.3f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[1], @3.3);\n    uncheckedAssertEqualObjects(managed.anyStringObj[1], @\"b\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[1], data(2));\n    uncheckedAssertEqualObjects(managed.anyDateObj[1], date(2));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[1], decimal128(3));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[1], objectId(2));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[1], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(optManaged.boolObj[1], @YES);\n    uncheckedAssertEqualObjects(optManaged.intObj[1], @3);\n    uncheckedAssertEqualObjects(optManaged.floatObj[1], @3.3f);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[1], @3.3);\n    uncheckedAssertEqualObjects(optManaged.stringObj[1], @\"b\");\n    uncheckedAssertEqualObjects(optManaged.dataObj[1], data(2));\n    uncheckedAssertEqualObjects(optManaged.dateObj[1], date(2));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[1], decimal128(3));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[1], objectId(2));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[1], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[2], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[2], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[2], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[2], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[2], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[2], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[2], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[2], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[2], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[2], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.boolObj[2], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.intObj[2], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.floatObj[2], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[2], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.stringObj[2], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dataObj[2], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dateObj[2], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.decimalObj[2], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[2], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.uuidObj[2], NSNull.null);\n}\n\n- (void)testInsertObject {\n    RLMAssertThrowsWithReason([unmanaged.boolObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj insertObject:@2 atIndex:0],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj insertObject:@2 atIndex:0],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([managed.boolObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.intObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.floatObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.doubleObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.stringObj insertObject:@2 atIndex:0],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.dataObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dateObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.decimalObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.uuidObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([optManaged.intObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([optManaged.floatObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj insertObject:@2 atIndex:0],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj insertObject:@\"a\" atIndex:0],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([unmanaged.boolObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([managed.boolObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.intObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.floatObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.doubleObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.stringObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.dataObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dateObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.decimalObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.uuidObj insertObject:NSNull.null atIndex:0],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([unmanaged.boolObj insertObject:@NO atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([unmanaged.intObj insertObject:@2 atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj insertObject:@2.2f atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj insertObject:@2.2 atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj insertObject:@\"a\" atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj insertObject:data(1) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj insertObject:date(1) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj insertObject:decimal128(2) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj insertObject:objectId(1) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj insertObject:uuid(@\"00000000-0000-0000-0000-000000000000\") atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([unmanaged.anyBoolObj insertObject:@NO atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([unmanaged.anyIntObj insertObject:@2 atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([unmanaged.anyFloatObj insertObject:@2.2f atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([unmanaged.anyDoubleObj insertObject:@2.2 atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([unmanaged.anyStringObj insertObject:@\"a\" atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([unmanaged.anyDataObj insertObject:data(1) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([unmanaged.anyDateObj insertObject:date(1) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([unmanaged.anyDecimalObj insertObject:decimal128(2) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([unmanaged.anyObjectIdObj insertObject:objectId(1) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([unmanaged.anyUUIDObj insertObject:uuid(@\"00000000-0000-0000-0000-000000000000\") atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj insertObject:@NO atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj insertObject:@2 atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj insertObject:@2.2f atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj insertObject:@2.2 atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj insertObject:@\"a\" atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj insertObject:data(1) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj insertObject:date(1) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj insertObject:decimal128(2) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj insertObject:objectId(1) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj insertObject:uuid(@\"00000000-0000-0000-0000-000000000000\") atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.boolObj insertObject:@NO atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.intObj insertObject:@2 atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.floatObj insertObject:@2.2f atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.doubleObj insertObject:@2.2 atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.stringObj insertObject:@\"a\" atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.dataObj insertObject:data(1) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.dateObj insertObject:date(1) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.decimalObj insertObject:decimal128(2) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.objectIdObj insertObject:objectId(1) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.uuidObj insertObject:uuid(@\"00000000-0000-0000-0000-000000000000\") atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.anyBoolObj insertObject:@NO atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.anyIntObj insertObject:@2 atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.anyFloatObj insertObject:@2.2f atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.anyDoubleObj insertObject:@2.2 atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.anyStringObj insertObject:@\"a\" atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.anyDataObj insertObject:data(1) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.anyDateObj insertObject:date(1) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.anyDecimalObj insertObject:decimal128(2) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.anyObjectIdObj insertObject:objectId(1) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([managed.anyUUIDObj insertObject:uuid(@\"00000000-0000-0000-0000-000000000000\") atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optManaged.boolObj insertObject:@NO atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optManaged.intObj insertObject:@2 atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optManaged.floatObj insertObject:@2.2f atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj insertObject:@2.2 atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optManaged.stringObj insertObject:@\"a\" atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optManaged.dataObj insertObject:data(1) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optManaged.dateObj insertObject:date(1) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj insertObject:decimal128(2) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj insertObject:objectId(1) atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj insertObject:uuid(@\"00000000-0000-0000-0000-000000000000\") atIndex:1],\n                              @\"Index 1 is out of bounds (must be less than 1).\");\n\n    [unmanaged.boolObj insertObject:@NO atIndex:0];\n    [unmanaged.intObj insertObject:@2 atIndex:0];\n    [unmanaged.floatObj insertObject:@2.2f atIndex:0];\n    [unmanaged.doubleObj insertObject:@2.2 atIndex:0];\n    [unmanaged.stringObj insertObject:@\"a\" atIndex:0];\n    [unmanaged.dataObj insertObject:data(1) atIndex:0];\n    [unmanaged.dateObj insertObject:date(1) atIndex:0];\n    [unmanaged.decimalObj insertObject:decimal128(2) atIndex:0];\n    [unmanaged.objectIdObj insertObject:objectId(1) atIndex:0];\n    [unmanaged.uuidObj insertObject:uuid(@\"00000000-0000-0000-0000-000000000000\") atIndex:0];\n    [unmanaged.anyBoolObj insertObject:@NO atIndex:0];\n    [unmanaged.anyIntObj insertObject:@2 atIndex:0];\n    [unmanaged.anyFloatObj insertObject:@2.2f atIndex:0];\n    [unmanaged.anyDoubleObj insertObject:@2.2 atIndex:0];\n    [unmanaged.anyStringObj insertObject:@\"a\" atIndex:0];\n    [unmanaged.anyDataObj insertObject:data(1) atIndex:0];\n    [unmanaged.anyDateObj insertObject:date(1) atIndex:0];\n    [unmanaged.anyDecimalObj insertObject:decimal128(2) atIndex:0];\n    [unmanaged.anyObjectIdObj insertObject:objectId(1) atIndex:0];\n    [unmanaged.anyUUIDObj insertObject:uuid(@\"00000000-0000-0000-0000-000000000000\") atIndex:0];\n    [optUnmanaged.boolObj insertObject:@NO atIndex:0];\n    [optUnmanaged.intObj insertObject:@2 atIndex:0];\n    [optUnmanaged.floatObj insertObject:@2.2f atIndex:0];\n    [optUnmanaged.doubleObj insertObject:@2.2 atIndex:0];\n    [optUnmanaged.stringObj insertObject:@\"a\" atIndex:0];\n    [optUnmanaged.dataObj insertObject:data(1) atIndex:0];\n    [optUnmanaged.dateObj insertObject:date(1) atIndex:0];\n    [optUnmanaged.decimalObj insertObject:decimal128(2) atIndex:0];\n    [optUnmanaged.objectIdObj insertObject:objectId(1) atIndex:0];\n    [optUnmanaged.uuidObj insertObject:uuid(@\"00000000-0000-0000-0000-000000000000\") atIndex:0];\n    [managed.boolObj insertObject:@NO atIndex:0];\n    [managed.intObj insertObject:@2 atIndex:0];\n    [managed.floatObj insertObject:@2.2f atIndex:0];\n    [managed.doubleObj insertObject:@2.2 atIndex:0];\n    [managed.stringObj insertObject:@\"a\" atIndex:0];\n    [managed.dataObj insertObject:data(1) atIndex:0];\n    [managed.dateObj insertObject:date(1) atIndex:0];\n    [managed.decimalObj insertObject:decimal128(2) atIndex:0];\n    [managed.objectIdObj insertObject:objectId(1) atIndex:0];\n    [managed.uuidObj insertObject:uuid(@\"00000000-0000-0000-0000-000000000000\") atIndex:0];\n    [managed.anyBoolObj insertObject:@NO atIndex:0];\n    [managed.anyIntObj insertObject:@2 atIndex:0];\n    [managed.anyFloatObj insertObject:@2.2f atIndex:0];\n    [managed.anyDoubleObj insertObject:@2.2 atIndex:0];\n    [managed.anyStringObj insertObject:@\"a\" atIndex:0];\n    [managed.anyDataObj insertObject:data(1) atIndex:0];\n    [managed.anyDateObj insertObject:date(1) atIndex:0];\n    [managed.anyDecimalObj insertObject:decimal128(2) atIndex:0];\n    [managed.anyObjectIdObj insertObject:objectId(1) atIndex:0];\n    [managed.anyUUIDObj insertObject:uuid(@\"00000000-0000-0000-0000-000000000000\") atIndex:0];\n    [optManaged.boolObj insertObject:@NO atIndex:0];\n    [optManaged.intObj insertObject:@2 atIndex:0];\n    [optManaged.floatObj insertObject:@2.2f atIndex:0];\n    [optManaged.doubleObj insertObject:@2.2 atIndex:0];\n    [optManaged.stringObj insertObject:@\"a\" atIndex:0];\n    [optManaged.dataObj insertObject:data(1) atIndex:0];\n    [optManaged.dateObj insertObject:date(1) atIndex:0];\n    [optManaged.decimalObj insertObject:decimal128(2) atIndex:0];\n    [optManaged.objectIdObj insertObject:objectId(1) atIndex:0];\n    [optManaged.uuidObj insertObject:uuid(@\"00000000-0000-0000-0000-000000000000\") atIndex:0];\n    uncheckedAssertEqualObjects(unmanaged.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(unmanaged.intObj[0], @2);\n    uncheckedAssertEqualObjects(unmanaged.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(unmanaged.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[0], @NO);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[0], @2);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[0], data(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[0], date(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[0], @2);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(managed.intObj[0], @2);\n    uncheckedAssertEqualObjects(managed.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(managed.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(managed.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(managed.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(managed.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(managed.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(managed.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(managed.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[0], @NO);\n    uncheckedAssertEqualObjects(managed.anyIntObj[0], @2);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(managed.anyStringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[0], data(1));\n    uncheckedAssertEqualObjects(managed.anyDateObj[0], date(1));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optManaged.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(optManaged.intObj[0], @2);\n    uncheckedAssertEqualObjects(optManaged.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(optManaged.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(optManaged.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(optManaged.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n\n    [unmanaged.boolObj insertObject:@YES atIndex:0];\n    [unmanaged.intObj insertObject:@3 atIndex:0];\n    [unmanaged.floatObj insertObject:@3.3f atIndex:0];\n    [unmanaged.doubleObj insertObject:@3.3 atIndex:0];\n    [unmanaged.stringObj insertObject:@\"b\" atIndex:0];\n    [unmanaged.dataObj insertObject:data(2) atIndex:0];\n    [unmanaged.dateObj insertObject:date(2) atIndex:0];\n    [unmanaged.decimalObj insertObject:decimal128(3) atIndex:0];\n    [unmanaged.objectIdObj insertObject:objectId(2) atIndex:0];\n    [unmanaged.uuidObj insertObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") atIndex:0];\n    [unmanaged.anyBoolObj insertObject:@YES atIndex:0];\n    [unmanaged.anyIntObj insertObject:@3 atIndex:0];\n    [unmanaged.anyFloatObj insertObject:@3.3f atIndex:0];\n    [unmanaged.anyDoubleObj insertObject:@3.3 atIndex:0];\n    [unmanaged.anyStringObj insertObject:@\"b\" atIndex:0];\n    [unmanaged.anyDataObj insertObject:data(2) atIndex:0];\n    [unmanaged.anyDateObj insertObject:date(2) atIndex:0];\n    [unmanaged.anyDecimalObj insertObject:decimal128(3) atIndex:0];\n    [unmanaged.anyObjectIdObj insertObject:objectId(2) atIndex:0];\n    [unmanaged.anyUUIDObj insertObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") atIndex:0];\n    [optUnmanaged.boolObj insertObject:@YES atIndex:0];\n    [optUnmanaged.intObj insertObject:@3 atIndex:0];\n    [optUnmanaged.floatObj insertObject:@3.3f atIndex:0];\n    [optUnmanaged.doubleObj insertObject:@3.3 atIndex:0];\n    [optUnmanaged.stringObj insertObject:@\"b\" atIndex:0];\n    [optUnmanaged.dataObj insertObject:data(2) atIndex:0];\n    [optUnmanaged.dateObj insertObject:date(2) atIndex:0];\n    [optUnmanaged.decimalObj insertObject:decimal128(3) atIndex:0];\n    [optUnmanaged.objectIdObj insertObject:objectId(2) atIndex:0];\n    [optUnmanaged.uuidObj insertObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") atIndex:0];\n    [managed.boolObj insertObject:@YES atIndex:0];\n    [managed.intObj insertObject:@3 atIndex:0];\n    [managed.floatObj insertObject:@3.3f atIndex:0];\n    [managed.doubleObj insertObject:@3.3 atIndex:0];\n    [managed.stringObj insertObject:@\"b\" atIndex:0];\n    [managed.dataObj insertObject:data(2) atIndex:0];\n    [managed.dateObj insertObject:date(2) atIndex:0];\n    [managed.decimalObj insertObject:decimal128(3) atIndex:0];\n    [managed.objectIdObj insertObject:objectId(2) atIndex:0];\n    [managed.uuidObj insertObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") atIndex:0];\n    [managed.anyBoolObj insertObject:@YES atIndex:0];\n    [managed.anyIntObj insertObject:@3 atIndex:0];\n    [managed.anyFloatObj insertObject:@3.3f atIndex:0];\n    [managed.anyDoubleObj insertObject:@3.3 atIndex:0];\n    [managed.anyStringObj insertObject:@\"b\" atIndex:0];\n    [managed.anyDataObj insertObject:data(2) atIndex:0];\n    [managed.anyDateObj insertObject:date(2) atIndex:0];\n    [managed.anyDecimalObj insertObject:decimal128(3) atIndex:0];\n    [managed.anyObjectIdObj insertObject:objectId(2) atIndex:0];\n    [managed.anyUUIDObj insertObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") atIndex:0];\n    [optManaged.boolObj insertObject:@YES atIndex:0];\n    [optManaged.intObj insertObject:@3 atIndex:0];\n    [optManaged.floatObj insertObject:@3.3f atIndex:0];\n    [optManaged.doubleObj insertObject:@3.3 atIndex:0];\n    [optManaged.stringObj insertObject:@\"b\" atIndex:0];\n    [optManaged.dataObj insertObject:data(2) atIndex:0];\n    [optManaged.dateObj insertObject:date(2) atIndex:0];\n    [optManaged.decimalObj insertObject:decimal128(3) atIndex:0];\n    [optManaged.objectIdObj insertObject:objectId(2) atIndex:0];\n    [optManaged.uuidObj insertObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") atIndex:0];\n    uncheckedAssertEqualObjects(unmanaged.boolObj[0], @YES);\n    uncheckedAssertEqualObjects(unmanaged.intObj[0], @3);\n    uncheckedAssertEqualObjects(unmanaged.floatObj[0], @3.3f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[0], @3.3);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[0], @\"b\");\n    uncheckedAssertEqualObjects(unmanaged.dataObj[0], data(2));\n    uncheckedAssertEqualObjects(unmanaged.dateObj[0], date(2));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[0], decimal128(3));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[0], objectId(2));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[0], @YES);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[0], @3);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[0], @3.3f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[0], @3.3);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[0], @\"b\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[0], data(2));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[0], date(2));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[0], decimal128(3));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[0], objectId(2));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[0], @YES);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[0], @3);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[0], @3.3f);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[0], @3.3);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[0], @\"b\");\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[0], data(2));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[0], date(2));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[0], decimal128(3));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[0], objectId(2));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(managed.boolObj[0], @YES);\n    uncheckedAssertEqualObjects(managed.intObj[0], @3);\n    uncheckedAssertEqualObjects(managed.floatObj[0], @3.3f);\n    uncheckedAssertEqualObjects(managed.doubleObj[0], @3.3);\n    uncheckedAssertEqualObjects(managed.stringObj[0], @\"b\");\n    uncheckedAssertEqualObjects(managed.dataObj[0], data(2));\n    uncheckedAssertEqualObjects(managed.dateObj[0], date(2));\n    uncheckedAssertEqualObjects(managed.decimalObj[0], decimal128(3));\n    uncheckedAssertEqualObjects(managed.objectIdObj[0], objectId(2));\n    uncheckedAssertEqualObjects(managed.uuidObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[0], @YES);\n    uncheckedAssertEqualObjects(managed.anyIntObj[0], @3);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[0], @3.3f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[0], @3.3);\n    uncheckedAssertEqualObjects(managed.anyStringObj[0], @\"b\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[0], data(2));\n    uncheckedAssertEqualObjects(managed.anyDateObj[0], date(2));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[0], decimal128(3));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[0], objectId(2));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(optManaged.boolObj[0], @YES);\n    uncheckedAssertEqualObjects(optManaged.intObj[0], @3);\n    uncheckedAssertEqualObjects(optManaged.floatObj[0], @3.3f);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[0], @3.3);\n    uncheckedAssertEqualObjects(optManaged.stringObj[0], @\"b\");\n    uncheckedAssertEqualObjects(optManaged.dataObj[0], data(2));\n    uncheckedAssertEqualObjects(optManaged.dateObj[0], date(2));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[0], decimal128(3));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[0], objectId(2));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(unmanaged.boolObj[1], @NO);\n    uncheckedAssertEqualObjects(unmanaged.intObj[1], @2);\n    uncheckedAssertEqualObjects(unmanaged.floatObj[1], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[1], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[1], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.dataObj[1], data(1));\n    uncheckedAssertEqualObjects(unmanaged.dateObj[1], date(1));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[1], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[1], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[1], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[1], @NO);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[1], @2);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[1], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[1], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[1], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[1], data(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[1], date(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[1], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[1], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[1], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[1], @NO);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[1], @2);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[1], @2.2f);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[1], @2.2);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[1], @\"a\");\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[1], data(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[1], date(1));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[1], decimal128(2));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[1], objectId(1));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[1], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.boolObj[1], @NO);\n    uncheckedAssertEqualObjects(managed.intObj[1], @2);\n    uncheckedAssertEqualObjects(managed.floatObj[1], @2.2f);\n    uncheckedAssertEqualObjects(managed.doubleObj[1], @2.2);\n    uncheckedAssertEqualObjects(managed.stringObj[1], @\"a\");\n    uncheckedAssertEqualObjects(managed.dataObj[1], data(1));\n    uncheckedAssertEqualObjects(managed.dateObj[1], date(1));\n    uncheckedAssertEqualObjects(managed.decimalObj[1], decimal128(2));\n    uncheckedAssertEqualObjects(managed.objectIdObj[1], objectId(1));\n    uncheckedAssertEqualObjects(managed.uuidObj[1], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[1], @NO);\n    uncheckedAssertEqualObjects(managed.anyIntObj[1], @2);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[1], @2.2f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[1], @2.2);\n    uncheckedAssertEqualObjects(managed.anyStringObj[1], @\"a\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[1], data(1));\n    uncheckedAssertEqualObjects(managed.anyDateObj[1], date(1));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[1], decimal128(2));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[1], objectId(1));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[1], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optManaged.boolObj[1], @NO);\n    uncheckedAssertEqualObjects(optManaged.intObj[1], @2);\n    uncheckedAssertEqualObjects(optManaged.floatObj[1], @2.2f);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[1], @2.2);\n    uncheckedAssertEqualObjects(optManaged.stringObj[1], @\"a\");\n    uncheckedAssertEqualObjects(optManaged.dataObj[1], data(1));\n    uncheckedAssertEqualObjects(optManaged.dateObj[1], date(1));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[1], decimal128(2));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[1], objectId(1));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[1], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n\n    [optUnmanaged.boolObj insertObject:NSNull.null atIndex:1];\n    [optUnmanaged.intObj insertObject:NSNull.null atIndex:1];\n    [optUnmanaged.floatObj insertObject:NSNull.null atIndex:1];\n    [optUnmanaged.doubleObj insertObject:NSNull.null atIndex:1];\n    [optUnmanaged.stringObj insertObject:NSNull.null atIndex:1];\n    [optUnmanaged.dataObj insertObject:NSNull.null atIndex:1];\n    [optUnmanaged.dateObj insertObject:NSNull.null atIndex:1];\n    [optUnmanaged.decimalObj insertObject:NSNull.null atIndex:1];\n    [optUnmanaged.objectIdObj insertObject:NSNull.null atIndex:1];\n    [optUnmanaged.uuidObj insertObject:NSNull.null atIndex:1];\n    [optManaged.boolObj insertObject:NSNull.null atIndex:1];\n    [optManaged.intObj insertObject:NSNull.null atIndex:1];\n    [optManaged.floatObj insertObject:NSNull.null atIndex:1];\n    [optManaged.doubleObj insertObject:NSNull.null atIndex:1];\n    [optManaged.stringObj insertObject:NSNull.null atIndex:1];\n    [optManaged.dataObj insertObject:NSNull.null atIndex:1];\n    [optManaged.dateObj insertObject:NSNull.null atIndex:1];\n    [optManaged.decimalObj insertObject:NSNull.null atIndex:1];\n    [optManaged.objectIdObj insertObject:NSNull.null atIndex:1];\n    [optManaged.uuidObj insertObject:NSNull.null atIndex:1];\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[0], @YES);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[0], @3);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[0], @3.3f);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[0], @3.3);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[0], @\"b\");\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[0], data(2));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[0], date(2));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[0], decimal128(3));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[0], objectId(2));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(optManaged.boolObj[0], @YES);\n    uncheckedAssertEqualObjects(optManaged.intObj[0], @3);\n    uncheckedAssertEqualObjects(optManaged.floatObj[0], @3.3f);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[0], @3.3);\n    uncheckedAssertEqualObjects(optManaged.stringObj[0], @\"b\");\n    uncheckedAssertEqualObjects(optManaged.dataObj[0], data(2));\n    uncheckedAssertEqualObjects(optManaged.dateObj[0], date(2));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[0], decimal128(3));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[0], objectId(2));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.boolObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.intObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.floatObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.stringObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dataObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dateObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.decimalObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.uuidObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[2], @NO);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[2], @2);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[2], @2.2f);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[2], @2.2);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[2], @\"a\");\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[2], data(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[2], date(1));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[2], decimal128(2));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[2], objectId(1));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[2], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optManaged.boolObj[2], @NO);\n    uncheckedAssertEqualObjects(optManaged.intObj[2], @2);\n    uncheckedAssertEqualObjects(optManaged.floatObj[2], @2.2f);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[2], @2.2);\n    uncheckedAssertEqualObjects(optManaged.stringObj[2], @\"a\");\n    uncheckedAssertEqualObjects(optManaged.dataObj[2], data(1));\n    uncheckedAssertEqualObjects(optManaged.dateObj[2], date(1));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[2], decimal128(2));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[2], objectId(1));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[2], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n}\n\n- (void)testRemoveObject {\n    for (RLMArray *array in allArrays) {\n        RLMAssertThrowsWithReason([array removeObjectAtIndex:0],\n                                  @\"Index 0 is out of bounds (must be less than 0).\");\n    }\n\n    [self addObjects];\n    uncheckedAssertEqual(unmanaged.boolObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.intObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.floatObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.doubleObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.stringObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.dataObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.dateObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.decimalObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.objectIdObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.uuidObj.count, 2U);\n    uncheckedAssertEqual(managed.boolObj.count, 2U);\n    uncheckedAssertEqual(managed.intObj.count, 2U);\n    uncheckedAssertEqual(managed.floatObj.count, 2U);\n    uncheckedAssertEqual(managed.doubleObj.count, 2U);\n    uncheckedAssertEqual(managed.stringObj.count, 2U);\n    uncheckedAssertEqual(managed.dataObj.count, 2U);\n    uncheckedAssertEqual(managed.dateObj.count, 2U);\n    uncheckedAssertEqual(managed.decimalObj.count, 2U);\n    uncheckedAssertEqual(managed.objectIdObj.count, 2U);\n    uncheckedAssertEqual(managed.uuidObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.boolObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.intObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.floatObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.doubleObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.stringObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.dataObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.dateObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.decimalObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.objectIdObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.uuidObj.count, 3U);\n    uncheckedAssertEqual(optManaged.boolObj.count, 3U);\n    uncheckedAssertEqual(optManaged.intObj.count, 3U);\n    uncheckedAssertEqual(optManaged.floatObj.count, 3U);\n    uncheckedAssertEqual(optManaged.doubleObj.count, 3U);\n    uncheckedAssertEqual(optManaged.stringObj.count, 3U);\n    uncheckedAssertEqual(optManaged.dataObj.count, 3U);\n    uncheckedAssertEqual(optManaged.dateObj.count, 3U);\n    uncheckedAssertEqual(optManaged.decimalObj.count, 3U);\n    uncheckedAssertEqual(optManaged.objectIdObj.count, 3U);\n    uncheckedAssertEqual(optManaged.uuidObj.count, 3U);\n\n    RLMAssertThrowsWithReason([unmanaged.boolObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([unmanaged.intObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([managed.boolObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([managed.intObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([managed.floatObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([managed.doubleObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([managed.stringObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([managed.dataObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([managed.dateObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([managed.decimalObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([managed.objectIdObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([managed.uuidObj removeObjectAtIndex:2],\n                              @\"Index 2 is out of bounds (must be less than 2).\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n    RLMAssertThrowsWithReason([optManaged.boolObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n    RLMAssertThrowsWithReason([optManaged.intObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n    RLMAssertThrowsWithReason([optManaged.floatObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n    RLMAssertThrowsWithReason([optManaged.stringObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n    RLMAssertThrowsWithReason([optManaged.dataObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n    RLMAssertThrowsWithReason([optManaged.dateObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj removeObjectAtIndex:3],\n                              @\"Index 3 is out of bounds (must be less than 3).\");\n\n    for (RLMArray *array in allArrays) {\n        [array removeObjectAtIndex:0];\n    }\n    uncheckedAssertEqual(unmanaged.boolObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.intObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.floatObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.doubleObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.stringObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.dataObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.dateObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.decimalObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.objectIdObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.uuidObj.count, 1U);\n    uncheckedAssertEqual(managed.boolObj.count, 1U);\n    uncheckedAssertEqual(managed.intObj.count, 1U);\n    uncheckedAssertEqual(managed.floatObj.count, 1U);\n    uncheckedAssertEqual(managed.doubleObj.count, 1U);\n    uncheckedAssertEqual(managed.stringObj.count, 1U);\n    uncheckedAssertEqual(managed.dataObj.count, 1U);\n    uncheckedAssertEqual(managed.dateObj.count, 1U);\n    uncheckedAssertEqual(managed.decimalObj.count, 1U);\n    uncheckedAssertEqual(managed.objectIdObj.count, 1U);\n    uncheckedAssertEqual(managed.uuidObj.count, 1U);\n    uncheckedAssertEqual(optUnmanaged.boolObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.intObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.floatObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.doubleObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.stringObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.dataObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.dateObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.decimalObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.objectIdObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.uuidObj.count, 2U);\n    uncheckedAssertEqual(optManaged.boolObj.count, 2U);\n    uncheckedAssertEqual(optManaged.intObj.count, 2U);\n    uncheckedAssertEqual(optManaged.floatObj.count, 2U);\n    uncheckedAssertEqual(optManaged.doubleObj.count, 2U);\n    uncheckedAssertEqual(optManaged.stringObj.count, 2U);\n    uncheckedAssertEqual(optManaged.dataObj.count, 2U);\n    uncheckedAssertEqual(optManaged.dateObj.count, 2U);\n    uncheckedAssertEqual(optManaged.decimalObj.count, 2U);\n    uncheckedAssertEqual(optManaged.objectIdObj.count, 2U);\n    uncheckedAssertEqual(optManaged.uuidObj.count, 2U);\n\n    uncheckedAssertEqualObjects(unmanaged.boolObj[0], @YES);\n    uncheckedAssertEqualObjects(unmanaged.intObj[0], @3);\n    uncheckedAssertEqualObjects(unmanaged.floatObj[0], @3.3f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[0], @3.3);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[0], @\"b\");\n    uncheckedAssertEqualObjects(unmanaged.dataObj[0], data(2));\n    uncheckedAssertEqualObjects(unmanaged.dateObj[0], date(2));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[0], decimal128(3));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[0], objectId(2));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[0], @YES);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[0], @3);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[0], @3.3f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[0], @3.3);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[0], @\"b\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[0], data(2));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[0], date(2));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[0], decimal128(3));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[0], objectId(2));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[0], @YES);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[0], @3);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[0], @3.3f);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[0], @3.3);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[0], @\"b\");\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[0], data(2));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[0], date(2));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[0], decimal128(3));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[0], objectId(2));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(managed.boolObj[0], @YES);\n    uncheckedAssertEqualObjects(managed.intObj[0], @3);\n    uncheckedAssertEqualObjects(managed.floatObj[0], @3.3f);\n    uncheckedAssertEqualObjects(managed.doubleObj[0], @3.3);\n    uncheckedAssertEqualObjects(managed.stringObj[0], @\"b\");\n    uncheckedAssertEqualObjects(managed.dataObj[0], data(2));\n    uncheckedAssertEqualObjects(managed.dateObj[0], date(2));\n    uncheckedAssertEqualObjects(managed.decimalObj[0], decimal128(3));\n    uncheckedAssertEqualObjects(managed.objectIdObj[0], objectId(2));\n    uncheckedAssertEqualObjects(managed.uuidObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[0], @YES);\n    uncheckedAssertEqualObjects(managed.anyIntObj[0], @3);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[0], @3.3f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[0], @3.3);\n    uncheckedAssertEqualObjects(managed.anyStringObj[0], @\"b\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[0], data(2));\n    uncheckedAssertEqualObjects(managed.anyDateObj[0], date(2));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[0], decimal128(3));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[0], objectId(2));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(optManaged.boolObj[0], @YES);\n    uncheckedAssertEqualObjects(optManaged.intObj[0], @3);\n    uncheckedAssertEqualObjects(optManaged.floatObj[0], @3.3f);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[0], @3.3);\n    uncheckedAssertEqualObjects(optManaged.stringObj[0], @\"b\");\n    uncheckedAssertEqualObjects(optManaged.dataObj[0], data(2));\n    uncheckedAssertEqualObjects(optManaged.dateObj[0], date(2));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[0], decimal128(3));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[0], objectId(2));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.boolObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.intObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.floatObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.stringObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dataObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dateObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.decimalObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[1], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.uuidObj[1], NSNull.null);\n}\n\n- (void)testRemoveLastObject {\n    for (RLMArray *array in allArrays) {\n        XCTAssertNoThrow([array removeLastObject]);\n    }\n\n    [self addObjects];\n    uncheckedAssertEqual(unmanaged.boolObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.intObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.floatObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.doubleObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.stringObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.dataObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.dateObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.decimalObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.objectIdObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.uuidObj.count, 2U);\n    uncheckedAssertEqual(managed.boolObj.count, 2U);\n    uncheckedAssertEqual(managed.intObj.count, 2U);\n    uncheckedAssertEqual(managed.floatObj.count, 2U);\n    uncheckedAssertEqual(managed.doubleObj.count, 2U);\n    uncheckedAssertEqual(managed.stringObj.count, 2U);\n    uncheckedAssertEqual(managed.dataObj.count, 2U);\n    uncheckedAssertEqual(managed.dateObj.count, 2U);\n    uncheckedAssertEqual(managed.decimalObj.count, 2U);\n    uncheckedAssertEqual(managed.objectIdObj.count, 2U);\n    uncheckedAssertEqual(managed.uuidObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.boolObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.intObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.floatObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.doubleObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.stringObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.dataObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.dateObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.decimalObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.objectIdObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.uuidObj.count, 3U);\n    uncheckedAssertEqual(optManaged.boolObj.count, 3U);\n    uncheckedAssertEqual(optManaged.intObj.count, 3U);\n    uncheckedAssertEqual(optManaged.floatObj.count, 3U);\n    uncheckedAssertEqual(optManaged.doubleObj.count, 3U);\n    uncheckedAssertEqual(optManaged.stringObj.count, 3U);\n    uncheckedAssertEqual(optManaged.dataObj.count, 3U);\n    uncheckedAssertEqual(optManaged.dateObj.count, 3U);\n    uncheckedAssertEqual(optManaged.decimalObj.count, 3U);\n    uncheckedAssertEqual(optManaged.objectIdObj.count, 3U);\n    uncheckedAssertEqual(optManaged.uuidObj.count, 3U);\n\n    for (RLMArray *array in allArrays) {\n        [array removeLastObject];\n    }\n    uncheckedAssertEqual(unmanaged.boolObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.intObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.floatObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.doubleObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.stringObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.dataObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.dateObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.decimalObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.objectIdObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.uuidObj.count, 1U);\n    uncheckedAssertEqual(managed.boolObj.count, 1U);\n    uncheckedAssertEqual(managed.intObj.count, 1U);\n    uncheckedAssertEqual(managed.floatObj.count, 1U);\n    uncheckedAssertEqual(managed.doubleObj.count, 1U);\n    uncheckedAssertEqual(managed.stringObj.count, 1U);\n    uncheckedAssertEqual(managed.dataObj.count, 1U);\n    uncheckedAssertEqual(managed.dateObj.count, 1U);\n    uncheckedAssertEqual(managed.decimalObj.count, 1U);\n    uncheckedAssertEqual(managed.objectIdObj.count, 1U);\n    uncheckedAssertEqual(managed.uuidObj.count, 1U);\n    uncheckedAssertEqual(optUnmanaged.boolObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.intObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.floatObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.doubleObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.stringObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.dataObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.dateObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.decimalObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.objectIdObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.uuidObj.count, 2U);\n    uncheckedAssertEqual(optManaged.boolObj.count, 2U);\n    uncheckedAssertEqual(optManaged.intObj.count, 2U);\n    uncheckedAssertEqual(optManaged.floatObj.count, 2U);\n    uncheckedAssertEqual(optManaged.doubleObj.count, 2U);\n    uncheckedAssertEqual(optManaged.stringObj.count, 2U);\n    uncheckedAssertEqual(optManaged.dataObj.count, 2U);\n    uncheckedAssertEqual(optManaged.dateObj.count, 2U);\n    uncheckedAssertEqual(optManaged.decimalObj.count, 2U);\n    uncheckedAssertEqual(optManaged.objectIdObj.count, 2U);\n    uncheckedAssertEqual(optManaged.uuidObj.count, 2U);\n\n    uncheckedAssertEqualObjects(unmanaged.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(unmanaged.intObj[0], @2);\n    uncheckedAssertEqualObjects(unmanaged.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(unmanaged.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[0], @NO);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[0], @2);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[0], data(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[0], date(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[0], @2);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(managed.intObj[0], @2);\n    uncheckedAssertEqualObjects(managed.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(managed.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(managed.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(managed.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(managed.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(managed.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(managed.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(managed.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[0], @NO);\n    uncheckedAssertEqualObjects(managed.anyIntObj[0], @2);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(managed.anyStringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[0], data(1));\n    uncheckedAssertEqualObjects(managed.anyDateObj[0], date(1));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optManaged.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(optManaged.intObj[0], @2);\n    uncheckedAssertEqualObjects(optManaged.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(optManaged.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(optManaged.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(optManaged.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[1], @YES);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[1], @3);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[1], @3.3f);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[1], @3.3);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[1], @\"b\");\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[1], data(2));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[1], date(2));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[1], decimal128(3));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[1], objectId(2));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[1], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(optManaged.boolObj[1], @YES);\n    uncheckedAssertEqualObjects(optManaged.intObj[1], @3);\n    uncheckedAssertEqualObjects(optManaged.floatObj[1], @3.3f);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[1], @3.3);\n    uncheckedAssertEqualObjects(optManaged.stringObj[1], @\"b\");\n    uncheckedAssertEqualObjects(optManaged.dataObj[1], data(2));\n    uncheckedAssertEqualObjects(optManaged.dateObj[1], date(2));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[1], decimal128(3));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[1], objectId(2));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[1], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n}\n\n- (void)testReplace {\n    RLMAssertThrowsWithReason([unmanaged.boolObj replaceObjectAtIndex:0 withObject:@NO],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([unmanaged.intObj replaceObjectAtIndex:0 withObject:@2],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj replaceObjectAtIndex:0 withObject:@2.2f],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj replaceObjectAtIndex:0 withObject:@2.2],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj replaceObjectAtIndex:0 withObject:data(1)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj replaceObjectAtIndex:0 withObject:date(1)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj replaceObjectAtIndex:0 withObject:decimal128(2)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj replaceObjectAtIndex:0 withObject:objectId(1)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj replaceObjectAtIndex:0 withObject:uuid(@\"00000000-0000-0000-0000-000000000000\")],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([unmanaged.anyBoolObj replaceObjectAtIndex:0 withObject:@NO],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([unmanaged.anyIntObj replaceObjectAtIndex:0 withObject:@2],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([unmanaged.anyFloatObj replaceObjectAtIndex:0 withObject:@2.2f],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([unmanaged.anyDoubleObj replaceObjectAtIndex:0 withObject:@2.2],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([unmanaged.anyStringObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([unmanaged.anyDataObj replaceObjectAtIndex:0 withObject:data(1)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([unmanaged.anyDateObj replaceObjectAtIndex:0 withObject:date(1)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([unmanaged.anyDecimalObj replaceObjectAtIndex:0 withObject:decimal128(2)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([unmanaged.anyObjectIdObj replaceObjectAtIndex:0 withObject:objectId(1)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([unmanaged.anyUUIDObj replaceObjectAtIndex:0 withObject:uuid(@\"00000000-0000-0000-0000-000000000000\")],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj replaceObjectAtIndex:0 withObject:@NO],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj replaceObjectAtIndex:0 withObject:@2],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj replaceObjectAtIndex:0 withObject:@2.2f],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj replaceObjectAtIndex:0 withObject:@2.2],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj replaceObjectAtIndex:0 withObject:data(1)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj replaceObjectAtIndex:0 withObject:date(1)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj replaceObjectAtIndex:0 withObject:decimal128(2)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj replaceObjectAtIndex:0 withObject:objectId(1)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj replaceObjectAtIndex:0 withObject:uuid(@\"00000000-0000-0000-0000-000000000000\")],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.boolObj replaceObjectAtIndex:0 withObject:@NO],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.intObj replaceObjectAtIndex:0 withObject:@2],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.floatObj replaceObjectAtIndex:0 withObject:@2.2f],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.doubleObj replaceObjectAtIndex:0 withObject:@2.2],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.stringObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.dataObj replaceObjectAtIndex:0 withObject:data(1)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.dateObj replaceObjectAtIndex:0 withObject:date(1)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.decimalObj replaceObjectAtIndex:0 withObject:decimal128(2)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.objectIdObj replaceObjectAtIndex:0 withObject:objectId(1)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.uuidObj replaceObjectAtIndex:0 withObject:uuid(@\"00000000-0000-0000-0000-000000000000\")],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.anyBoolObj replaceObjectAtIndex:0 withObject:@NO],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.anyIntObj replaceObjectAtIndex:0 withObject:@2],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.anyFloatObj replaceObjectAtIndex:0 withObject:@2.2f],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.anyDoubleObj replaceObjectAtIndex:0 withObject:@2.2],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.anyStringObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.anyDataObj replaceObjectAtIndex:0 withObject:data(1)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.anyDateObj replaceObjectAtIndex:0 withObject:date(1)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.anyDecimalObj replaceObjectAtIndex:0 withObject:decimal128(2)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.anyObjectIdObj replaceObjectAtIndex:0 withObject:objectId(1)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([managed.anyUUIDObj replaceObjectAtIndex:0 withObject:uuid(@\"00000000-0000-0000-0000-000000000000\")],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optManaged.boolObj replaceObjectAtIndex:0 withObject:@NO],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optManaged.intObj replaceObjectAtIndex:0 withObject:@2],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optManaged.floatObj replaceObjectAtIndex:0 withObject:@2.2f],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj replaceObjectAtIndex:0 withObject:@2.2],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optManaged.stringObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optManaged.dataObj replaceObjectAtIndex:0 withObject:data(1)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optManaged.dateObj replaceObjectAtIndex:0 withObject:date(1)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj replaceObjectAtIndex:0 withObject:decimal128(2)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj replaceObjectAtIndex:0 withObject:objectId(1)],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj replaceObjectAtIndex:0 withObject:uuid(@\"00000000-0000-0000-0000-000000000000\")],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n\n    [unmanaged.boolObj addObject:@NO];\n    [unmanaged.boolObj replaceObjectAtIndex:0 withObject:@YES];\n    uncheckedAssertEqualObjects(unmanaged.boolObj[0], @YES);\n    \n    [unmanaged.intObj addObject:@2];\n    [unmanaged.intObj replaceObjectAtIndex:0 withObject:@3];\n    uncheckedAssertEqualObjects(unmanaged.intObj[0], @3);\n    \n    [unmanaged.floatObj addObject:@2.2f];\n    [unmanaged.floatObj replaceObjectAtIndex:0 withObject:@3.3f];\n    uncheckedAssertEqualObjects(unmanaged.floatObj[0], @3.3f);\n    \n    [unmanaged.doubleObj addObject:@2.2];\n    [unmanaged.doubleObj replaceObjectAtIndex:0 withObject:@3.3];\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[0], @3.3);\n    \n    [unmanaged.stringObj addObject:@\"a\"];\n    [unmanaged.stringObj replaceObjectAtIndex:0 withObject:@\"b\"];\n    uncheckedAssertEqualObjects(unmanaged.stringObj[0], @\"b\");\n    \n    [unmanaged.dataObj addObject:data(1)];\n    [unmanaged.dataObj replaceObjectAtIndex:0 withObject:data(2)];\n    uncheckedAssertEqualObjects(unmanaged.dataObj[0], data(2));\n    \n    [unmanaged.dateObj addObject:date(1)];\n    [unmanaged.dateObj replaceObjectAtIndex:0 withObject:date(2)];\n    uncheckedAssertEqualObjects(unmanaged.dateObj[0], date(2));\n    \n    [unmanaged.decimalObj addObject:decimal128(2)];\n    [unmanaged.decimalObj replaceObjectAtIndex:0 withObject:decimal128(3)];\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[0], decimal128(3));\n    \n    [unmanaged.objectIdObj addObject:objectId(1)];\n    [unmanaged.objectIdObj replaceObjectAtIndex:0 withObject:objectId(2)];\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[0], objectId(2));\n    \n    [unmanaged.uuidObj addObject:uuid(@\"00000000-0000-0000-0000-000000000000\")];\n    [unmanaged.uuidObj replaceObjectAtIndex:0 withObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    \n    [unmanaged.anyBoolObj addObject:@NO];\n    [unmanaged.anyBoolObj replaceObjectAtIndex:0 withObject:@YES];\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[0], @YES);\n    \n    [unmanaged.anyIntObj addObject:@2];\n    [unmanaged.anyIntObj replaceObjectAtIndex:0 withObject:@3];\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[0], @3);\n    \n    [unmanaged.anyFloatObj addObject:@2.2f];\n    [unmanaged.anyFloatObj replaceObjectAtIndex:0 withObject:@3.3f];\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[0], @3.3f);\n    \n    [unmanaged.anyDoubleObj addObject:@2.2];\n    [unmanaged.anyDoubleObj replaceObjectAtIndex:0 withObject:@3.3];\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[0], @3.3);\n    \n    [unmanaged.anyStringObj addObject:@\"a\"];\n    [unmanaged.anyStringObj replaceObjectAtIndex:0 withObject:@\"b\"];\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[0], @\"b\");\n    \n    [unmanaged.anyDataObj addObject:data(1)];\n    [unmanaged.anyDataObj replaceObjectAtIndex:0 withObject:data(2)];\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[0], data(2));\n    \n    [unmanaged.anyDateObj addObject:date(1)];\n    [unmanaged.anyDateObj replaceObjectAtIndex:0 withObject:date(2)];\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[0], date(2));\n    \n    [unmanaged.anyDecimalObj addObject:decimal128(2)];\n    [unmanaged.anyDecimalObj replaceObjectAtIndex:0 withObject:decimal128(3)];\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[0], decimal128(3));\n    \n    [unmanaged.anyObjectIdObj addObject:objectId(1)];\n    [unmanaged.anyObjectIdObj replaceObjectAtIndex:0 withObject:objectId(2)];\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[0], objectId(2));\n    \n    [unmanaged.anyUUIDObj addObject:uuid(@\"00000000-0000-0000-0000-000000000000\")];\n    [unmanaged.anyUUIDObj replaceObjectAtIndex:0 withObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    \n    [optUnmanaged.boolObj addObject:@NO];\n    [optUnmanaged.boolObj replaceObjectAtIndex:0 withObject:@YES];\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[0], @YES);\n    \n    [optUnmanaged.intObj addObject:@2];\n    [optUnmanaged.intObj replaceObjectAtIndex:0 withObject:@3];\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[0], @3);\n    \n    [optUnmanaged.floatObj addObject:@2.2f];\n    [optUnmanaged.floatObj replaceObjectAtIndex:0 withObject:@3.3f];\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[0], @3.3f);\n    \n    [optUnmanaged.doubleObj addObject:@2.2];\n    [optUnmanaged.doubleObj replaceObjectAtIndex:0 withObject:@3.3];\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[0], @3.3);\n    \n    [optUnmanaged.stringObj addObject:@\"a\"];\n    [optUnmanaged.stringObj replaceObjectAtIndex:0 withObject:@\"b\"];\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[0], @\"b\");\n    \n    [optUnmanaged.dataObj addObject:data(1)];\n    [optUnmanaged.dataObj replaceObjectAtIndex:0 withObject:data(2)];\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[0], data(2));\n    \n    [optUnmanaged.dateObj addObject:date(1)];\n    [optUnmanaged.dateObj replaceObjectAtIndex:0 withObject:date(2)];\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[0], date(2));\n    \n    [optUnmanaged.decimalObj addObject:decimal128(2)];\n    [optUnmanaged.decimalObj replaceObjectAtIndex:0 withObject:decimal128(3)];\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[0], decimal128(3));\n    \n    [optUnmanaged.objectIdObj addObject:objectId(1)];\n    [optUnmanaged.objectIdObj replaceObjectAtIndex:0 withObject:objectId(2)];\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[0], objectId(2));\n    \n    [optUnmanaged.uuidObj addObject:uuid(@\"00000000-0000-0000-0000-000000000000\")];\n    [optUnmanaged.uuidObj replaceObjectAtIndex:0 withObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    \n    [managed.boolObj addObject:@NO];\n    [managed.boolObj replaceObjectAtIndex:0 withObject:@YES];\n    uncheckedAssertEqualObjects(managed.boolObj[0], @YES);\n    \n    [managed.intObj addObject:@2];\n    [managed.intObj replaceObjectAtIndex:0 withObject:@3];\n    uncheckedAssertEqualObjects(managed.intObj[0], @3);\n    \n    [managed.floatObj addObject:@2.2f];\n    [managed.floatObj replaceObjectAtIndex:0 withObject:@3.3f];\n    uncheckedAssertEqualObjects(managed.floatObj[0], @3.3f);\n    \n    [managed.doubleObj addObject:@2.2];\n    [managed.doubleObj replaceObjectAtIndex:0 withObject:@3.3];\n    uncheckedAssertEqualObjects(managed.doubleObj[0], @3.3);\n    \n    [managed.stringObj addObject:@\"a\"];\n    [managed.stringObj replaceObjectAtIndex:0 withObject:@\"b\"];\n    uncheckedAssertEqualObjects(managed.stringObj[0], @\"b\");\n    \n    [managed.dataObj addObject:data(1)];\n    [managed.dataObj replaceObjectAtIndex:0 withObject:data(2)];\n    uncheckedAssertEqualObjects(managed.dataObj[0], data(2));\n    \n    [managed.dateObj addObject:date(1)];\n    [managed.dateObj replaceObjectAtIndex:0 withObject:date(2)];\n    uncheckedAssertEqualObjects(managed.dateObj[0], date(2));\n    \n    [managed.decimalObj addObject:decimal128(2)];\n    [managed.decimalObj replaceObjectAtIndex:0 withObject:decimal128(3)];\n    uncheckedAssertEqualObjects(managed.decimalObj[0], decimal128(3));\n    \n    [managed.objectIdObj addObject:objectId(1)];\n    [managed.objectIdObj replaceObjectAtIndex:0 withObject:objectId(2)];\n    uncheckedAssertEqualObjects(managed.objectIdObj[0], objectId(2));\n    \n    [managed.uuidObj addObject:uuid(@\"00000000-0000-0000-0000-000000000000\")];\n    [managed.uuidObj replaceObjectAtIndex:0 withObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects(managed.uuidObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    \n    [managed.anyBoolObj addObject:@NO];\n    [managed.anyBoolObj replaceObjectAtIndex:0 withObject:@YES];\n    uncheckedAssertEqualObjects(managed.anyBoolObj[0], @YES);\n    \n    [managed.anyIntObj addObject:@2];\n    [managed.anyIntObj replaceObjectAtIndex:0 withObject:@3];\n    uncheckedAssertEqualObjects(managed.anyIntObj[0], @3);\n    \n    [managed.anyFloatObj addObject:@2.2f];\n    [managed.anyFloatObj replaceObjectAtIndex:0 withObject:@3.3f];\n    uncheckedAssertEqualObjects(managed.anyFloatObj[0], @3.3f);\n    \n    [managed.anyDoubleObj addObject:@2.2];\n    [managed.anyDoubleObj replaceObjectAtIndex:0 withObject:@3.3];\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[0], @3.3);\n    \n    [managed.anyStringObj addObject:@\"a\"];\n    [managed.anyStringObj replaceObjectAtIndex:0 withObject:@\"b\"];\n    uncheckedAssertEqualObjects(managed.anyStringObj[0], @\"b\");\n    \n    [managed.anyDataObj addObject:data(1)];\n    [managed.anyDataObj replaceObjectAtIndex:0 withObject:data(2)];\n    uncheckedAssertEqualObjects(managed.anyDataObj[0], data(2));\n    \n    [managed.anyDateObj addObject:date(1)];\n    [managed.anyDateObj replaceObjectAtIndex:0 withObject:date(2)];\n    uncheckedAssertEqualObjects(managed.anyDateObj[0], date(2));\n    \n    [managed.anyDecimalObj addObject:decimal128(2)];\n    [managed.anyDecimalObj replaceObjectAtIndex:0 withObject:decimal128(3)];\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[0], decimal128(3));\n    \n    [managed.anyObjectIdObj addObject:objectId(1)];\n    [managed.anyObjectIdObj replaceObjectAtIndex:0 withObject:objectId(2)];\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[0], objectId(2));\n    \n    [managed.anyUUIDObj addObject:uuid(@\"00000000-0000-0000-0000-000000000000\")];\n    [managed.anyUUIDObj replaceObjectAtIndex:0 withObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    \n    [optManaged.boolObj addObject:@NO];\n    [optManaged.boolObj replaceObjectAtIndex:0 withObject:@YES];\n    uncheckedAssertEqualObjects(optManaged.boolObj[0], @YES);\n    \n    [optManaged.intObj addObject:@2];\n    [optManaged.intObj replaceObjectAtIndex:0 withObject:@3];\n    uncheckedAssertEqualObjects(optManaged.intObj[0], @3);\n    \n    [optManaged.floatObj addObject:@2.2f];\n    [optManaged.floatObj replaceObjectAtIndex:0 withObject:@3.3f];\n    uncheckedAssertEqualObjects(optManaged.floatObj[0], @3.3f);\n    \n    [optManaged.doubleObj addObject:@2.2];\n    [optManaged.doubleObj replaceObjectAtIndex:0 withObject:@3.3];\n    uncheckedAssertEqualObjects(optManaged.doubleObj[0], @3.3);\n    \n    [optManaged.stringObj addObject:@\"a\"];\n    [optManaged.stringObj replaceObjectAtIndex:0 withObject:@\"b\"];\n    uncheckedAssertEqualObjects(optManaged.stringObj[0], @\"b\");\n    \n    [optManaged.dataObj addObject:data(1)];\n    [optManaged.dataObj replaceObjectAtIndex:0 withObject:data(2)];\n    uncheckedAssertEqualObjects(optManaged.dataObj[0], data(2));\n    \n    [optManaged.dateObj addObject:date(1)];\n    [optManaged.dateObj replaceObjectAtIndex:0 withObject:date(2)];\n    uncheckedAssertEqualObjects(optManaged.dateObj[0], date(2));\n    \n    [optManaged.decimalObj addObject:decimal128(2)];\n    [optManaged.decimalObj replaceObjectAtIndex:0 withObject:decimal128(3)];\n    uncheckedAssertEqualObjects(optManaged.decimalObj[0], decimal128(3));\n    \n    [optManaged.objectIdObj addObject:objectId(1)];\n    [optManaged.objectIdObj replaceObjectAtIndex:0 withObject:objectId(2)];\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[0], objectId(2));\n    \n    [optManaged.uuidObj addObject:uuid(@\"00000000-0000-0000-0000-000000000000\")];\n    [optManaged.uuidObj replaceObjectAtIndex:0 withObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects(optManaged.uuidObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    \n\n    [optUnmanaged.boolObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[0], NSNull.null);\n    [optUnmanaged.intObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[0], NSNull.null);\n    [optUnmanaged.floatObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[0], NSNull.null);\n    [optUnmanaged.doubleObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[0], NSNull.null);\n    [optUnmanaged.stringObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[0], NSNull.null);\n    [optUnmanaged.dataObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[0], NSNull.null);\n    [optUnmanaged.dateObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[0], NSNull.null);\n    [optUnmanaged.decimalObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[0], NSNull.null);\n    [optUnmanaged.objectIdObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[0], NSNull.null);\n    [optUnmanaged.uuidObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[0], NSNull.null);\n    [optManaged.boolObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optManaged.boolObj[0], NSNull.null);\n    [optManaged.intObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optManaged.intObj[0], NSNull.null);\n    [optManaged.floatObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optManaged.floatObj[0], NSNull.null);\n    [optManaged.doubleObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optManaged.doubleObj[0], NSNull.null);\n    [optManaged.stringObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optManaged.stringObj[0], NSNull.null);\n    [optManaged.dataObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optManaged.dataObj[0], NSNull.null);\n    [optManaged.dateObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optManaged.dateObj[0], NSNull.null);\n    [optManaged.decimalObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optManaged.decimalObj[0], NSNull.null);\n    [optManaged.objectIdObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[0], NSNull.null);\n    [optManaged.uuidObj replaceObjectAtIndex:0 withObject:NSNull.null];\n    uncheckedAssertEqualObjects(optManaged.uuidObj[0], NSNull.null);\n\n    RLMAssertThrowsWithReason([unmanaged.boolObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj replaceObjectAtIndex:0 withObject:@2],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj replaceObjectAtIndex:0 withObject:@2],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([managed.boolObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.intObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.floatObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.doubleObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.stringObj replaceObjectAtIndex:0 withObject:@2],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.dataObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dateObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.decimalObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.uuidObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([optManaged.intObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([optManaged.floatObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj replaceObjectAtIndex:0 withObject:@2],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj replaceObjectAtIndex:0 withObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([unmanaged.boolObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([managed.boolObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.intObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.floatObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.doubleObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.stringObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.dataObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dateObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.decimalObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.uuidObj replaceObjectAtIndex:0 withObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n}\n\n- (void)testMove {\n    for (RLMArray *array in allArrays) {\n        RLMAssertThrowsWithReason([array moveObjectAtIndex:0 toIndex:1],\n                                  @\"Index 0 is out of bounds (must be less than 0).\");\n    }\n    for (RLMArray *array in allArrays) {\n        RLMAssertThrowsWithReason([array moveObjectAtIndex:1 toIndex:0],\n                                  @\"Index 1 is out of bounds (must be less than 0).\");\n    }\n\n    [unmanaged.boolObj addObjects:@[@NO, @YES, @NO, @YES]];\n    [unmanaged.intObj addObjects:@[@2, @3, @2, @3]];\n    [unmanaged.floatObj addObjects:@[@2.2f, @3.3f, @2.2f, @3.3f]];\n    [unmanaged.doubleObj addObjects:@[@2.2, @3.3, @2.2, @3.3]];\n    [unmanaged.stringObj addObjects:@[@\"a\", @\"b\", @\"a\", @\"b\"]];\n    [unmanaged.dataObj addObjects:@[data(1), data(2), data(1), data(2)]];\n    [unmanaged.dateObj addObjects:@[date(1), date(2), date(1), date(2)]];\n    [unmanaged.decimalObj addObjects:@[decimal128(2), decimal128(3), decimal128(2), decimal128(3)]];\n    [unmanaged.objectIdObj addObjects:@[objectId(1), objectId(2), objectId(1), objectId(2)]];\n    [unmanaged.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [unmanaged.anyBoolObj addObjects:@[@NO, @YES, @NO, @YES]];\n    [unmanaged.anyIntObj addObjects:@[@2, @3, @2, @3]];\n    [unmanaged.anyFloatObj addObjects:@[@2.2f, @3.3f, @2.2f, @3.3f]];\n    [unmanaged.anyDoubleObj addObjects:@[@2.2, @3.3, @2.2, @3.3]];\n    [unmanaged.anyStringObj addObjects:@[@\"a\", @\"b\", @\"a\", @\"b\"]];\n    [unmanaged.anyDataObj addObjects:@[data(1), data(2), data(1), data(2)]];\n    [unmanaged.anyDateObj addObjects:@[date(1), date(2), date(1), date(2)]];\n    [unmanaged.anyDecimalObj addObjects:@[decimal128(2), decimal128(3), decimal128(2), decimal128(3)]];\n    [unmanaged.anyObjectIdObj addObjects:@[objectId(1), objectId(2), objectId(1), objectId(2)]];\n    [unmanaged.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optUnmanaged.boolObj addObjects:@[@NO, @YES, @NO, @YES]];\n    [optUnmanaged.intObj addObjects:@[@2, @3, @2, @3]];\n    [optUnmanaged.floatObj addObjects:@[@2.2f, @3.3f, @2.2f, @3.3f]];\n    [optUnmanaged.doubleObj addObjects:@[@2.2, @3.3, @2.2, @3.3]];\n    [optUnmanaged.stringObj addObjects:@[@\"a\", @\"b\", @\"a\", @\"b\"]];\n    [optUnmanaged.dataObj addObjects:@[data(1), data(2), data(1), data(2)]];\n    [optUnmanaged.dateObj addObjects:@[date(1), date(2), date(1), date(2)]];\n    [optUnmanaged.decimalObj addObjects:@[decimal128(2), decimal128(3), decimal128(2), decimal128(3)]];\n    [optUnmanaged.objectIdObj addObjects:@[objectId(1), objectId(2), objectId(1), objectId(2)]];\n    [optUnmanaged.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [managed.boolObj addObjects:@[@NO, @YES, @NO, @YES]];\n    [managed.intObj addObjects:@[@2, @3, @2, @3]];\n    [managed.floatObj addObjects:@[@2.2f, @3.3f, @2.2f, @3.3f]];\n    [managed.doubleObj addObjects:@[@2.2, @3.3, @2.2, @3.3]];\n    [managed.stringObj addObjects:@[@\"a\", @\"b\", @\"a\", @\"b\"]];\n    [managed.dataObj addObjects:@[data(1), data(2), data(1), data(2)]];\n    [managed.dateObj addObjects:@[date(1), date(2), date(1), date(2)]];\n    [managed.decimalObj addObjects:@[decimal128(2), decimal128(3), decimal128(2), decimal128(3)]];\n    [managed.objectIdObj addObjects:@[objectId(1), objectId(2), objectId(1), objectId(2)]];\n    [managed.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [managed.anyBoolObj addObjects:@[@NO, @YES, @NO, @YES]];\n    [managed.anyIntObj addObjects:@[@2, @3, @2, @3]];\n    [managed.anyFloatObj addObjects:@[@2.2f, @3.3f, @2.2f, @3.3f]];\n    [managed.anyDoubleObj addObjects:@[@2.2, @3.3, @2.2, @3.3]];\n    [managed.anyStringObj addObjects:@[@\"a\", @\"b\", @\"a\", @\"b\"]];\n    [managed.anyDataObj addObjects:@[data(1), data(2), data(1), data(2)]];\n    [managed.anyDateObj addObjects:@[date(1), date(2), date(1), date(2)]];\n    [managed.anyDecimalObj addObjects:@[decimal128(2), decimal128(3), decimal128(2), decimal128(3)]];\n    [managed.anyObjectIdObj addObjects:@[objectId(1), objectId(2), objectId(1), objectId(2)]];\n    [managed.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optManaged.boolObj addObjects:@[@NO, @YES, @NO, @YES]];\n    [optManaged.intObj addObjects:@[@2, @3, @2, @3]];\n    [optManaged.floatObj addObjects:@[@2.2f, @3.3f, @2.2f, @3.3f]];\n    [optManaged.doubleObj addObjects:@[@2.2, @3.3, @2.2, @3.3]];\n    [optManaged.stringObj addObjects:@[@\"a\", @\"b\", @\"a\", @\"b\"]];\n    [optManaged.dataObj addObjects:@[data(1), data(2), data(1), data(2)]];\n    [optManaged.dateObj addObjects:@[date(1), date(2), date(1), date(2)]];\n    [optManaged.decimalObj addObjects:@[decimal128(2), decimal128(3), decimal128(2), decimal128(3)]];\n    [optManaged.objectIdObj addObjects:@[objectId(1), objectId(2), objectId(1), objectId(2)]];\n    [optManaged.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n\n    for (RLMArray *array in allArrays) {\n        [array moveObjectAtIndex:2 toIndex:0];\n    }\n\n    uncheckedAssertEqualObjects([unmanaged.boolObj valueForKey:@\"self\"],\n                                (@[@NO, @NO, @YES, @YES]));\n    uncheckedAssertEqualObjects([unmanaged.intObj valueForKey:@\"self\"],\n                                (@[@2, @2, @3, @3]));\n    uncheckedAssertEqualObjects([unmanaged.floatObj valueForKey:@\"self\"],\n                                (@[@2.2f, @2.2f, @3.3f, @3.3f]));\n    uncheckedAssertEqualObjects([unmanaged.doubleObj valueForKey:@\"self\"],\n                                (@[@2.2, @2.2, @3.3, @3.3]));\n    uncheckedAssertEqualObjects([unmanaged.stringObj valueForKey:@\"self\"],\n                                (@[@\"a\", @\"a\", @\"b\", @\"b\"]));\n    uncheckedAssertEqualObjects([unmanaged.dataObj valueForKey:@\"self\"],\n                                (@[data(1), data(1), data(2), data(2)]));\n    uncheckedAssertEqualObjects([unmanaged.dateObj valueForKey:@\"self\"],\n                                (@[date(1), date(1), date(2), date(2)]));\n    uncheckedAssertEqualObjects([unmanaged.decimalObj valueForKey:@\"self\"],\n                                (@[decimal128(2), decimal128(2), decimal128(3), decimal128(3)]));\n    uncheckedAssertEqualObjects([unmanaged.objectIdObj valueForKey:@\"self\"],\n                                (@[objectId(1), objectId(1), objectId(2), objectId(2)]));\n    uncheckedAssertEqualObjects([unmanaged.uuidObj valueForKey:@\"self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([unmanaged.anyBoolObj valueForKey:@\"self\"],\n                                (@[@NO, @NO, @YES, @YES]));\n    uncheckedAssertEqualObjects([unmanaged.anyIntObj valueForKey:@\"self\"],\n                                (@[@2, @2, @3, @3]));\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj valueForKey:@\"self\"],\n                                (@[@2.2f, @2.2f, @3.3f, @3.3f]));\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj valueForKey:@\"self\"],\n                                (@[@2.2, @2.2, @3.3, @3.3]));\n    uncheckedAssertEqualObjects([unmanaged.anyStringObj valueForKey:@\"self\"],\n                                (@[@\"a\", @\"a\", @\"b\", @\"b\"]));\n    uncheckedAssertEqualObjects([unmanaged.anyDataObj valueForKey:@\"self\"],\n                                (@[data(1), data(1), data(2), data(2)]));\n    uncheckedAssertEqualObjects([unmanaged.anyDateObj valueForKey:@\"self\"],\n                                (@[date(1), date(1), date(2), date(2)]));\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj valueForKey:@\"self\"],\n                                (@[decimal128(2), decimal128(2), decimal128(3), decimal128(3)]));\n    uncheckedAssertEqualObjects([unmanaged.anyObjectIdObj valueForKey:@\"self\"],\n                                (@[objectId(1), objectId(1), objectId(2), objectId(2)]));\n    uncheckedAssertEqualObjects([unmanaged.anyUUIDObj valueForKey:@\"self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([optUnmanaged.boolObj valueForKey:@\"self\"],\n                                (@[@NO, @NO, @YES, @YES]));\n    uncheckedAssertEqualObjects([optUnmanaged.intObj valueForKey:@\"self\"],\n                                (@[@2, @2, @3, @3]));\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj valueForKey:@\"self\"],\n                                (@[@2.2f, @2.2f, @3.3f, @3.3f]));\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj valueForKey:@\"self\"],\n                                (@[@2.2, @2.2, @3.3, @3.3]));\n    uncheckedAssertEqualObjects([optUnmanaged.stringObj valueForKey:@\"self\"],\n                                (@[@\"a\", @\"a\", @\"b\", @\"b\"]));\n    uncheckedAssertEqualObjects([optUnmanaged.dataObj valueForKey:@\"self\"],\n                                (@[data(1), data(1), data(2), data(2)]));\n    uncheckedAssertEqualObjects([optUnmanaged.dateObj valueForKey:@\"self\"],\n                                (@[date(1), date(1), date(2), date(2)]));\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj valueForKey:@\"self\"],\n                                (@[decimal128(2), decimal128(2), decimal128(3), decimal128(3)]));\n    uncheckedAssertEqualObjects([optUnmanaged.objectIdObj valueForKey:@\"self\"],\n                                (@[objectId(1), objectId(1), objectId(2), objectId(2)]));\n    uncheckedAssertEqualObjects([optUnmanaged.uuidObj valueForKey:@\"self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([managed.boolObj valueForKey:@\"self\"],\n                                (@[@NO, @NO, @YES, @YES]));\n    uncheckedAssertEqualObjects([managed.intObj valueForKey:@\"self\"],\n                                (@[@2, @2, @3, @3]));\n    uncheckedAssertEqualObjects([managed.floatObj valueForKey:@\"self\"],\n                                (@[@2.2f, @2.2f, @3.3f, @3.3f]));\n    uncheckedAssertEqualObjects([managed.doubleObj valueForKey:@\"self\"],\n                                (@[@2.2, @2.2, @3.3, @3.3]));\n    uncheckedAssertEqualObjects([managed.stringObj valueForKey:@\"self\"],\n                                (@[@\"a\", @\"a\", @\"b\", @\"b\"]));\n    uncheckedAssertEqualObjects([managed.dataObj valueForKey:@\"self\"],\n                                (@[data(1), data(1), data(2), data(2)]));\n    uncheckedAssertEqualObjects([managed.dateObj valueForKey:@\"self\"],\n                                (@[date(1), date(1), date(2), date(2)]));\n    uncheckedAssertEqualObjects([managed.decimalObj valueForKey:@\"self\"],\n                                (@[decimal128(2), decimal128(2), decimal128(3), decimal128(3)]));\n    uncheckedAssertEqualObjects([managed.objectIdObj valueForKey:@\"self\"],\n                                (@[objectId(1), objectId(1), objectId(2), objectId(2)]));\n    uncheckedAssertEqualObjects([managed.uuidObj valueForKey:@\"self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([managed.anyBoolObj valueForKey:@\"self\"],\n                                (@[@NO, @NO, @YES, @YES]));\n    uncheckedAssertEqualObjects([managed.anyIntObj valueForKey:@\"self\"],\n                                (@[@2, @2, @3, @3]));\n    uncheckedAssertEqualObjects([managed.anyFloatObj valueForKey:@\"self\"],\n                                (@[@2.2f, @2.2f, @3.3f, @3.3f]));\n    uncheckedAssertEqualObjects([managed.anyDoubleObj valueForKey:@\"self\"],\n                                (@[@2.2, @2.2, @3.3, @3.3]));\n    uncheckedAssertEqualObjects([managed.anyStringObj valueForKey:@\"self\"],\n                                (@[@\"a\", @\"a\", @\"b\", @\"b\"]));\n    uncheckedAssertEqualObjects([managed.anyDataObj valueForKey:@\"self\"],\n                                (@[data(1), data(1), data(2), data(2)]));\n    uncheckedAssertEqualObjects([managed.anyDateObj valueForKey:@\"self\"],\n                                (@[date(1), date(1), date(2), date(2)]));\n    uncheckedAssertEqualObjects([managed.anyDecimalObj valueForKey:@\"self\"],\n                                (@[decimal128(2), decimal128(2), decimal128(3), decimal128(3)]));\n    uncheckedAssertEqualObjects([managed.anyObjectIdObj valueForKey:@\"self\"],\n                                (@[objectId(1), objectId(1), objectId(2), objectId(2)]));\n    uncheckedAssertEqualObjects([managed.anyUUIDObj valueForKey:@\"self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([optManaged.boolObj valueForKey:@\"self\"],\n                                (@[@NO, @NO, @YES, @YES]));\n    uncheckedAssertEqualObjects([optManaged.intObj valueForKey:@\"self\"],\n                                (@[@2, @2, @3, @3]));\n    uncheckedAssertEqualObjects([optManaged.floatObj valueForKey:@\"self\"],\n                                (@[@2.2f, @2.2f, @3.3f, @3.3f]));\n    uncheckedAssertEqualObjects([optManaged.doubleObj valueForKey:@\"self\"],\n                                (@[@2.2, @2.2, @3.3, @3.3]));\n    uncheckedAssertEqualObjects([optManaged.stringObj valueForKey:@\"self\"],\n                                (@[@\"a\", @\"a\", @\"b\", @\"b\"]));\n    uncheckedAssertEqualObjects([optManaged.dataObj valueForKey:@\"self\"],\n                                (@[data(1), data(1), data(2), data(2)]));\n    uncheckedAssertEqualObjects([optManaged.dateObj valueForKey:@\"self\"],\n                                (@[date(1), date(1), date(2), date(2)]));\n    uncheckedAssertEqualObjects([optManaged.decimalObj valueForKey:@\"self\"],\n                                (@[decimal128(2), decimal128(2), decimal128(3), decimal128(3)]));\n    uncheckedAssertEqualObjects([optManaged.objectIdObj valueForKey:@\"self\"],\n                                (@[objectId(1), objectId(1), objectId(2), objectId(2)]));\n    uncheckedAssertEqualObjects([optManaged.uuidObj valueForKey:@\"self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n}\n\n- (void)testExchange {\n    for (RLMArray *array in allArrays) {\n        RLMAssertThrowsWithReason([array exchangeObjectAtIndex:0 withObjectAtIndex:1],\n                                  @\"Index 0 is out of bounds (must be less than 0).\");\n    }\n    for (RLMArray *array in allArrays) {\n        RLMAssertThrowsWithReason([array exchangeObjectAtIndex:1 withObjectAtIndex:0],\n                                  @\"Index 1 is out of bounds (must be less than 0).\");\n    }\n\n    [unmanaged.boolObj addObjects:@[@NO, @YES, @NO, @YES]];\n    [unmanaged.intObj addObjects:@[@2, @3, @2, @3]];\n    [unmanaged.floatObj addObjects:@[@2.2f, @3.3f, @2.2f, @3.3f]];\n    [unmanaged.doubleObj addObjects:@[@2.2, @3.3, @2.2, @3.3]];\n    [unmanaged.stringObj addObjects:@[@\"a\", @\"b\", @\"a\", @\"b\"]];\n    [unmanaged.dataObj addObjects:@[data(1), data(2), data(1), data(2)]];\n    [unmanaged.dateObj addObjects:@[date(1), date(2), date(1), date(2)]];\n    [unmanaged.decimalObj addObjects:@[decimal128(2), decimal128(3), decimal128(2), decimal128(3)]];\n    [unmanaged.objectIdObj addObjects:@[objectId(1), objectId(2), objectId(1), objectId(2)]];\n    [unmanaged.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [unmanaged.anyBoolObj addObjects:@[@NO, @YES, @NO, @YES]];\n    [unmanaged.anyIntObj addObjects:@[@2, @3, @2, @3]];\n    [unmanaged.anyFloatObj addObjects:@[@2.2f, @3.3f, @2.2f, @3.3f]];\n    [unmanaged.anyDoubleObj addObjects:@[@2.2, @3.3, @2.2, @3.3]];\n    [unmanaged.anyStringObj addObjects:@[@\"a\", @\"b\", @\"a\", @\"b\"]];\n    [unmanaged.anyDataObj addObjects:@[data(1), data(2), data(1), data(2)]];\n    [unmanaged.anyDateObj addObjects:@[date(1), date(2), date(1), date(2)]];\n    [unmanaged.anyDecimalObj addObjects:@[decimal128(2), decimal128(3), decimal128(2), decimal128(3)]];\n    [unmanaged.anyObjectIdObj addObjects:@[objectId(1), objectId(2), objectId(1), objectId(2)]];\n    [unmanaged.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optUnmanaged.boolObj addObjects:@[@NO, @YES, @NO, @YES]];\n    [optUnmanaged.intObj addObjects:@[@2, @3, @2, @3]];\n    [optUnmanaged.floatObj addObjects:@[@2.2f, @3.3f, @2.2f, @3.3f]];\n    [optUnmanaged.doubleObj addObjects:@[@2.2, @3.3, @2.2, @3.3]];\n    [optUnmanaged.stringObj addObjects:@[@\"a\", @\"b\", @\"a\", @\"b\"]];\n    [optUnmanaged.dataObj addObjects:@[data(1), data(2), data(1), data(2)]];\n    [optUnmanaged.dateObj addObjects:@[date(1), date(2), date(1), date(2)]];\n    [optUnmanaged.decimalObj addObjects:@[decimal128(2), decimal128(3), decimal128(2), decimal128(3)]];\n    [optUnmanaged.objectIdObj addObjects:@[objectId(1), objectId(2), objectId(1), objectId(2)]];\n    [optUnmanaged.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [managed.boolObj addObjects:@[@NO, @YES, @NO, @YES]];\n    [managed.intObj addObjects:@[@2, @3, @2, @3]];\n    [managed.floatObj addObjects:@[@2.2f, @3.3f, @2.2f, @3.3f]];\n    [managed.doubleObj addObjects:@[@2.2, @3.3, @2.2, @3.3]];\n    [managed.stringObj addObjects:@[@\"a\", @\"b\", @\"a\", @\"b\"]];\n    [managed.dataObj addObjects:@[data(1), data(2), data(1), data(2)]];\n    [managed.dateObj addObjects:@[date(1), date(2), date(1), date(2)]];\n    [managed.decimalObj addObjects:@[decimal128(2), decimal128(3), decimal128(2), decimal128(3)]];\n    [managed.objectIdObj addObjects:@[objectId(1), objectId(2), objectId(1), objectId(2)]];\n    [managed.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [managed.anyBoolObj addObjects:@[@NO, @YES, @NO, @YES]];\n    [managed.anyIntObj addObjects:@[@2, @3, @2, @3]];\n    [managed.anyFloatObj addObjects:@[@2.2f, @3.3f, @2.2f, @3.3f]];\n    [managed.anyDoubleObj addObjects:@[@2.2, @3.3, @2.2, @3.3]];\n    [managed.anyStringObj addObjects:@[@\"a\", @\"b\", @\"a\", @\"b\"]];\n    [managed.anyDataObj addObjects:@[data(1), data(2), data(1), data(2)]];\n    [managed.anyDateObj addObjects:@[date(1), date(2), date(1), date(2)]];\n    [managed.anyDecimalObj addObjects:@[decimal128(2), decimal128(3), decimal128(2), decimal128(3)]];\n    [managed.anyObjectIdObj addObjects:@[objectId(1), objectId(2), objectId(1), objectId(2)]];\n    [managed.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optManaged.boolObj addObjects:@[@NO, @YES, @NO, @YES]];\n    [optManaged.intObj addObjects:@[@2, @3, @2, @3]];\n    [optManaged.floatObj addObjects:@[@2.2f, @3.3f, @2.2f, @3.3f]];\n    [optManaged.doubleObj addObjects:@[@2.2, @3.3, @2.2, @3.3]];\n    [optManaged.stringObj addObjects:@[@\"a\", @\"b\", @\"a\", @\"b\"]];\n    [optManaged.dataObj addObjects:@[data(1), data(2), data(1), data(2)]];\n    [optManaged.dateObj addObjects:@[date(1), date(2), date(1), date(2)]];\n    [optManaged.decimalObj addObjects:@[decimal128(2), decimal128(3), decimal128(2), decimal128(3)]];\n    [optManaged.objectIdObj addObjects:@[objectId(1), objectId(2), objectId(1), objectId(2)]];\n    [optManaged.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n\n    for (RLMArray *array in allArrays) {\n        [array exchangeObjectAtIndex:2 withObjectAtIndex:1];\n    }\n\n    uncheckedAssertEqualObjects([unmanaged.boolObj valueForKey:@\"self\"],\n                                (@[@NO, @NO, @YES, @YES]));\n    uncheckedAssertEqualObjects([unmanaged.intObj valueForKey:@\"self\"],\n                                (@[@2, @2, @3, @3]));\n    uncheckedAssertEqualObjects([unmanaged.floatObj valueForKey:@\"self\"],\n                                (@[@2.2f, @2.2f, @3.3f, @3.3f]));\n    uncheckedAssertEqualObjects([unmanaged.doubleObj valueForKey:@\"self\"],\n                                (@[@2.2, @2.2, @3.3, @3.3]));\n    uncheckedAssertEqualObjects([unmanaged.stringObj valueForKey:@\"self\"],\n                                (@[@\"a\", @\"a\", @\"b\", @\"b\"]));\n    uncheckedAssertEqualObjects([unmanaged.dataObj valueForKey:@\"self\"],\n                                (@[data(1), data(1), data(2), data(2)]));\n    uncheckedAssertEqualObjects([unmanaged.dateObj valueForKey:@\"self\"],\n                                (@[date(1), date(1), date(2), date(2)]));\n    uncheckedAssertEqualObjects([unmanaged.decimalObj valueForKey:@\"self\"],\n                                (@[decimal128(2), decimal128(2), decimal128(3), decimal128(3)]));\n    uncheckedAssertEqualObjects([unmanaged.objectIdObj valueForKey:@\"self\"],\n                                (@[objectId(1), objectId(1), objectId(2), objectId(2)]));\n    uncheckedAssertEqualObjects([unmanaged.uuidObj valueForKey:@\"self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([unmanaged.anyBoolObj valueForKey:@\"self\"],\n                                (@[@NO, @NO, @YES, @YES]));\n    uncheckedAssertEqualObjects([unmanaged.anyIntObj valueForKey:@\"self\"],\n                                (@[@2, @2, @3, @3]));\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj valueForKey:@\"self\"],\n                                (@[@2.2f, @2.2f, @3.3f, @3.3f]));\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj valueForKey:@\"self\"],\n                                (@[@2.2, @2.2, @3.3, @3.3]));\n    uncheckedAssertEqualObjects([unmanaged.anyStringObj valueForKey:@\"self\"],\n                                (@[@\"a\", @\"a\", @\"b\", @\"b\"]));\n    uncheckedAssertEqualObjects([unmanaged.anyDataObj valueForKey:@\"self\"],\n                                (@[data(1), data(1), data(2), data(2)]));\n    uncheckedAssertEqualObjects([unmanaged.anyDateObj valueForKey:@\"self\"],\n                                (@[date(1), date(1), date(2), date(2)]));\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj valueForKey:@\"self\"],\n                                (@[decimal128(2), decimal128(2), decimal128(3), decimal128(3)]));\n    uncheckedAssertEqualObjects([unmanaged.anyObjectIdObj valueForKey:@\"self\"],\n                                (@[objectId(1), objectId(1), objectId(2), objectId(2)]));\n    uncheckedAssertEqualObjects([unmanaged.anyUUIDObj valueForKey:@\"self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([optUnmanaged.boolObj valueForKey:@\"self\"],\n                                (@[@NO, @NO, @YES, @YES]));\n    uncheckedAssertEqualObjects([optUnmanaged.intObj valueForKey:@\"self\"],\n                                (@[@2, @2, @3, @3]));\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj valueForKey:@\"self\"],\n                                (@[@2.2f, @2.2f, @3.3f, @3.3f]));\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj valueForKey:@\"self\"],\n                                (@[@2.2, @2.2, @3.3, @3.3]));\n    uncheckedAssertEqualObjects([optUnmanaged.stringObj valueForKey:@\"self\"],\n                                (@[@\"a\", @\"a\", @\"b\", @\"b\"]));\n    uncheckedAssertEqualObjects([optUnmanaged.dataObj valueForKey:@\"self\"],\n                                (@[data(1), data(1), data(2), data(2)]));\n    uncheckedAssertEqualObjects([optUnmanaged.dateObj valueForKey:@\"self\"],\n                                (@[date(1), date(1), date(2), date(2)]));\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj valueForKey:@\"self\"],\n                                (@[decimal128(2), decimal128(2), decimal128(3), decimal128(3)]));\n    uncheckedAssertEqualObjects([optUnmanaged.objectIdObj valueForKey:@\"self\"],\n                                (@[objectId(1), objectId(1), objectId(2), objectId(2)]));\n    uncheckedAssertEqualObjects([optUnmanaged.uuidObj valueForKey:@\"self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([managed.boolObj valueForKey:@\"self\"],\n                                (@[@NO, @NO, @YES, @YES]));\n    uncheckedAssertEqualObjects([managed.intObj valueForKey:@\"self\"],\n                                (@[@2, @2, @3, @3]));\n    uncheckedAssertEqualObjects([managed.floatObj valueForKey:@\"self\"],\n                                (@[@2.2f, @2.2f, @3.3f, @3.3f]));\n    uncheckedAssertEqualObjects([managed.doubleObj valueForKey:@\"self\"],\n                                (@[@2.2, @2.2, @3.3, @3.3]));\n    uncheckedAssertEqualObjects([managed.stringObj valueForKey:@\"self\"],\n                                (@[@\"a\", @\"a\", @\"b\", @\"b\"]));\n    uncheckedAssertEqualObjects([managed.dataObj valueForKey:@\"self\"],\n                                (@[data(1), data(1), data(2), data(2)]));\n    uncheckedAssertEqualObjects([managed.dateObj valueForKey:@\"self\"],\n                                (@[date(1), date(1), date(2), date(2)]));\n    uncheckedAssertEqualObjects([managed.decimalObj valueForKey:@\"self\"],\n                                (@[decimal128(2), decimal128(2), decimal128(3), decimal128(3)]));\n    uncheckedAssertEqualObjects([managed.objectIdObj valueForKey:@\"self\"],\n                                (@[objectId(1), objectId(1), objectId(2), objectId(2)]));\n    uncheckedAssertEqualObjects([managed.uuidObj valueForKey:@\"self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([managed.anyBoolObj valueForKey:@\"self\"],\n                                (@[@NO, @NO, @YES, @YES]));\n    uncheckedAssertEqualObjects([managed.anyIntObj valueForKey:@\"self\"],\n                                (@[@2, @2, @3, @3]));\n    uncheckedAssertEqualObjects([managed.anyFloatObj valueForKey:@\"self\"],\n                                (@[@2.2f, @2.2f, @3.3f, @3.3f]));\n    uncheckedAssertEqualObjects([managed.anyDoubleObj valueForKey:@\"self\"],\n                                (@[@2.2, @2.2, @3.3, @3.3]));\n    uncheckedAssertEqualObjects([managed.anyStringObj valueForKey:@\"self\"],\n                                (@[@\"a\", @\"a\", @\"b\", @\"b\"]));\n    uncheckedAssertEqualObjects([managed.anyDataObj valueForKey:@\"self\"],\n                                (@[data(1), data(1), data(2), data(2)]));\n    uncheckedAssertEqualObjects([managed.anyDateObj valueForKey:@\"self\"],\n                                (@[date(1), date(1), date(2), date(2)]));\n    uncheckedAssertEqualObjects([managed.anyDecimalObj valueForKey:@\"self\"],\n                                (@[decimal128(2), decimal128(2), decimal128(3), decimal128(3)]));\n    uncheckedAssertEqualObjects([managed.anyObjectIdObj valueForKey:@\"self\"],\n                                (@[objectId(1), objectId(1), objectId(2), objectId(2)]));\n    uncheckedAssertEqualObjects([managed.anyUUIDObj valueForKey:@\"self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([optManaged.boolObj valueForKey:@\"self\"],\n                                (@[@NO, @NO, @YES, @YES]));\n    uncheckedAssertEqualObjects([optManaged.intObj valueForKey:@\"self\"],\n                                (@[@2, @2, @3, @3]));\n    uncheckedAssertEqualObjects([optManaged.floatObj valueForKey:@\"self\"],\n                                (@[@2.2f, @2.2f, @3.3f, @3.3f]));\n    uncheckedAssertEqualObjects([optManaged.doubleObj valueForKey:@\"self\"],\n                                (@[@2.2, @2.2, @3.3, @3.3]));\n    uncheckedAssertEqualObjects([optManaged.stringObj valueForKey:@\"self\"],\n                                (@[@\"a\", @\"a\", @\"b\", @\"b\"]));\n    uncheckedAssertEqualObjects([optManaged.dataObj valueForKey:@\"self\"],\n                                (@[data(1), data(1), data(2), data(2)]));\n    uncheckedAssertEqualObjects([optManaged.dateObj valueForKey:@\"self\"],\n                                (@[date(1), date(1), date(2), date(2)]));\n    uncheckedAssertEqualObjects([optManaged.decimalObj valueForKey:@\"self\"],\n                                (@[decimal128(2), decimal128(2), decimal128(3), decimal128(3)]));\n    uncheckedAssertEqualObjects([optManaged.objectIdObj valueForKey:@\"self\"],\n                                (@[objectId(1), objectId(1), objectId(2), objectId(2)]));\n    uncheckedAssertEqualObjects([optManaged.uuidObj valueForKey:@\"self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n}\n\n- (void)testIndexOfObject {\n    uncheckedAssertEqual(NSNotFound, [unmanaged.boolObj indexOfObject:@NO]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.intObj indexOfObject:@2]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.floatObj indexOfObject:@2.2f]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.doubleObj indexOfObject:@2.2]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.stringObj indexOfObject:@\"a\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.dataObj indexOfObject:data(1)]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.dateObj indexOfObject:date(1)]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.decimalObj indexOfObject:decimal128(2)]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.objectIdObj indexOfObject:objectId(1)]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.uuidObj indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyBoolObj indexOfObject:@NO]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyIntObj indexOfObject:@2]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyFloatObj indexOfObject:@2.2f]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDoubleObj indexOfObject:@2.2]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyStringObj indexOfObject:@\"a\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDataObj indexOfObject:data(1)]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDateObj indexOfObject:date(1)]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDecimalObj indexOfObject:decimal128(2)]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyObjectIdObj indexOfObject:objectId(1)]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyUUIDObj indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.boolObj indexOfObject:@NO]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.intObj indexOfObject:@2]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.floatObj indexOfObject:@2.2f]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.doubleObj indexOfObject:@2.2]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.stringObj indexOfObject:@\"a\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.dataObj indexOfObject:data(1)]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.dateObj indexOfObject:date(1)]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.decimalObj indexOfObject:decimal128(2)]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.objectIdObj indexOfObject:objectId(1)]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.uuidObj indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertEqual(NSNotFound, [managed.boolObj indexOfObject:@NO]);\n    uncheckedAssertEqual(NSNotFound, [managed.intObj indexOfObject:@2]);\n    uncheckedAssertEqual(NSNotFound, [managed.floatObj indexOfObject:@2.2f]);\n    uncheckedAssertEqual(NSNotFound, [managed.doubleObj indexOfObject:@2.2]);\n    uncheckedAssertEqual(NSNotFound, [managed.stringObj indexOfObject:@\"a\"]);\n    uncheckedAssertEqual(NSNotFound, [managed.dataObj indexOfObject:data(1)]);\n    uncheckedAssertEqual(NSNotFound, [managed.dateObj indexOfObject:date(1)]);\n    uncheckedAssertEqual(NSNotFound, [managed.decimalObj indexOfObject:decimal128(2)]);\n    uncheckedAssertEqual(NSNotFound, [managed.objectIdObj indexOfObject:objectId(1)]);\n    uncheckedAssertEqual(NSNotFound, [managed.uuidObj indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertEqual(NSNotFound, [managed.anyBoolObj indexOfObject:@NO]);\n    uncheckedAssertEqual(NSNotFound, [managed.anyIntObj indexOfObject:@2]);\n    uncheckedAssertEqual(NSNotFound, [managed.anyFloatObj indexOfObject:@2.2f]);\n    uncheckedAssertEqual(NSNotFound, [managed.anyDoubleObj indexOfObject:@2.2]);\n    uncheckedAssertEqual(NSNotFound, [managed.anyStringObj indexOfObject:@\"a\"]);\n    uncheckedAssertEqual(NSNotFound, [managed.anyDataObj indexOfObject:data(1)]);\n    uncheckedAssertEqual(NSNotFound, [managed.anyDateObj indexOfObject:date(1)]);\n    uncheckedAssertEqual(NSNotFound, [managed.anyDecimalObj indexOfObject:decimal128(2)]);\n    uncheckedAssertEqual(NSNotFound, [managed.anyObjectIdObj indexOfObject:objectId(1)]);\n    uncheckedAssertEqual(NSNotFound, [managed.anyUUIDObj indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.boolObj indexOfObject:@NO]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.intObj indexOfObject:@2]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.floatObj indexOfObject:@2.2f]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.doubleObj indexOfObject:@2.2]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.stringObj indexOfObject:@\"a\"]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.dataObj indexOfObject:data(1)]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.dateObj indexOfObject:date(1)]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.decimalObj indexOfObject:decimal128(2)]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.objectIdObj indexOfObject:objectId(1)]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.uuidObj indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n\n    RLMAssertThrowsWithReason([unmanaged.boolObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj indexOfObject:@2],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj indexOfObject:@2],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([managed.boolObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.intObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.floatObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.doubleObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.stringObj indexOfObject:@2],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.dataObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dateObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.decimalObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.uuidObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([optManaged.intObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([optManaged.floatObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj indexOfObject:@2],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj indexOfObject:@\"a\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n\n    RLMAssertThrowsWithReason([unmanaged.boolObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([managed.boolObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.intObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.floatObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.doubleObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.stringObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.dataObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dateObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.decimalObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.uuidObj indexOfObject:NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.boolObj indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.intObj indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.floatObj indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.doubleObj indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.stringObj indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.dataObj indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.dateObj indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.decimalObj indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.objectIdObj indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.uuidObj indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.boolObj indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.intObj indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.floatObj indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.doubleObj indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.stringObj indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.dataObj indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.dateObj indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.decimalObj indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.objectIdObj indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(NSNotFound, [optManaged.uuidObj indexOfObject:NSNull.null]);\n\n    [self addObjects];\n\n    uncheckedAssertEqual(1U, [unmanaged.boolObj indexOfObject:@YES]);\n    uncheckedAssertEqual(1U, [unmanaged.intObj indexOfObject:@3]);\n    uncheckedAssertEqual(1U, [unmanaged.floatObj indexOfObject:@3.3f]);\n    uncheckedAssertEqual(1U, [unmanaged.doubleObj indexOfObject:@3.3]);\n    uncheckedAssertEqual(1U, [unmanaged.stringObj indexOfObject:@\"b\"]);\n    uncheckedAssertEqual(1U, [unmanaged.dataObj indexOfObject:data(2)]);\n    uncheckedAssertEqual(1U, [unmanaged.dateObj indexOfObject:date(2)]);\n    uncheckedAssertEqual(1U, [unmanaged.decimalObj indexOfObject:decimal128(3)]);\n    uncheckedAssertEqual(1U, [unmanaged.objectIdObj indexOfObject:objectId(2)]);\n    uncheckedAssertEqual(1U, [unmanaged.uuidObj indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    uncheckedAssertEqual(1U, [unmanaged.anyBoolObj indexOfObject:@YES]);\n    uncheckedAssertEqual(1U, [unmanaged.anyIntObj indexOfObject:@3]);\n    uncheckedAssertEqual(1U, [unmanaged.anyFloatObj indexOfObject:@3.3f]);\n    uncheckedAssertEqual(1U, [unmanaged.anyDoubleObj indexOfObject:@3.3]);\n    uncheckedAssertEqual(1U, [unmanaged.anyStringObj indexOfObject:@\"b\"]);\n    uncheckedAssertEqual(1U, [unmanaged.anyDataObj indexOfObject:data(2)]);\n    uncheckedAssertEqual(1U, [unmanaged.anyDateObj indexOfObject:date(2)]);\n    uncheckedAssertEqual(1U, [unmanaged.anyDecimalObj indexOfObject:decimal128(3)]);\n    uncheckedAssertEqual(1U, [unmanaged.anyObjectIdObj indexOfObject:objectId(2)]);\n    uncheckedAssertEqual(1U, [unmanaged.anyUUIDObj indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    uncheckedAssertEqual(1U, [optUnmanaged.boolObj indexOfObject:@YES]);\n    uncheckedAssertEqual(1U, [optUnmanaged.intObj indexOfObject:@3]);\n    uncheckedAssertEqual(1U, [optUnmanaged.floatObj indexOfObject:@3.3f]);\n    uncheckedAssertEqual(1U, [optUnmanaged.doubleObj indexOfObject:@3.3]);\n    uncheckedAssertEqual(1U, [optUnmanaged.stringObj indexOfObject:@\"b\"]);\n    uncheckedAssertEqual(1U, [optUnmanaged.dataObj indexOfObject:data(2)]);\n    uncheckedAssertEqual(1U, [optUnmanaged.dateObj indexOfObject:date(2)]);\n    uncheckedAssertEqual(1U, [optUnmanaged.decimalObj indexOfObject:decimal128(3)]);\n    uncheckedAssertEqual(1U, [optUnmanaged.objectIdObj indexOfObject:objectId(2)]);\n    uncheckedAssertEqual(1U, [optUnmanaged.uuidObj indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    uncheckedAssertEqual(1U, [managed.boolObj indexOfObject:@YES]);\n    uncheckedAssertEqual(1U, [managed.intObj indexOfObject:@3]);\n    uncheckedAssertEqual(1U, [managed.floatObj indexOfObject:@3.3f]);\n    uncheckedAssertEqual(1U, [managed.doubleObj indexOfObject:@3.3]);\n    uncheckedAssertEqual(1U, [managed.stringObj indexOfObject:@\"b\"]);\n    uncheckedAssertEqual(1U, [managed.dataObj indexOfObject:data(2)]);\n    uncheckedAssertEqual(1U, [managed.dateObj indexOfObject:date(2)]);\n    uncheckedAssertEqual(1U, [managed.decimalObj indexOfObject:decimal128(3)]);\n    uncheckedAssertEqual(1U, [managed.objectIdObj indexOfObject:objectId(2)]);\n    uncheckedAssertEqual(1U, [managed.uuidObj indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    uncheckedAssertEqual(1U, [managed.anyBoolObj indexOfObject:@YES]);\n    uncheckedAssertEqual(1U, [managed.anyIntObj indexOfObject:@3]);\n    uncheckedAssertEqual(1U, [managed.anyFloatObj indexOfObject:@3.3f]);\n    uncheckedAssertEqual(1U, [managed.anyDoubleObj indexOfObject:@3.3]);\n    uncheckedAssertEqual(1U, [managed.anyStringObj indexOfObject:@\"b\"]);\n    uncheckedAssertEqual(1U, [managed.anyDataObj indexOfObject:data(2)]);\n    uncheckedAssertEqual(1U, [managed.anyDateObj indexOfObject:date(2)]);\n    uncheckedAssertEqual(1U, [managed.anyDecimalObj indexOfObject:decimal128(3)]);\n    uncheckedAssertEqual(1U, [managed.anyObjectIdObj indexOfObject:objectId(2)]);\n    uncheckedAssertEqual(1U, [managed.anyUUIDObj indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    uncheckedAssertEqual(1U, [optManaged.boolObj indexOfObject:@YES]);\n    uncheckedAssertEqual(1U, [optManaged.intObj indexOfObject:@3]);\n    uncheckedAssertEqual(1U, [optManaged.floatObj indexOfObject:@3.3f]);\n    uncheckedAssertEqual(1U, [optManaged.doubleObj indexOfObject:@3.3]);\n    uncheckedAssertEqual(1U, [optManaged.stringObj indexOfObject:@\"b\"]);\n    uncheckedAssertEqual(1U, [optManaged.dataObj indexOfObject:data(2)]);\n    uncheckedAssertEqual(1U, [optManaged.dateObj indexOfObject:date(2)]);\n    uncheckedAssertEqual(1U, [optManaged.decimalObj indexOfObject:decimal128(3)]);\n    uncheckedAssertEqual(1U, [optManaged.objectIdObj indexOfObject:objectId(2)]);\n    uncheckedAssertEqual(1U, [optManaged.uuidObj indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n}\n\n- (void)testIndexOfObjectSorted {\n    [managed.boolObj addObjects:@[@NO, @YES, @NO, @YES]];\n    [managed.intObj addObjects:@[@2, @3, @2, @3]];\n    [managed.floatObj addObjects:@[@2.2f, @3.3f, @2.2f, @3.3f]];\n    [managed.doubleObj addObjects:@[@2.2, @3.3, @2.2, @3.3]];\n    [managed.stringObj addObjects:@[@\"a\", @\"b\", @\"a\", @\"b\"]];\n    [managed.dataObj addObjects:@[data(1), data(2), data(1), data(2)]];\n    [managed.dateObj addObjects:@[date(1), date(2), date(1), date(2)]];\n    [managed.decimalObj addObjects:@[decimal128(2), decimal128(3), decimal128(2), decimal128(3)]];\n    [managed.objectIdObj addObjects:@[objectId(1), objectId(2), objectId(1), objectId(2)]];\n    [managed.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optManaged.boolObj addObjects:@[@NO, @YES, NSNull.null, @YES, @NO]];\n    [optManaged.intObj addObjects:@[@2, @3, NSNull.null, @3, @2]];\n    [optManaged.floatObj addObjects:@[@2.2f, @3.3f, NSNull.null, @3.3f, @2.2f]];\n    [optManaged.doubleObj addObjects:@[@2.2, @3.3, NSNull.null, @3.3, @2.2]];\n    [optManaged.stringObj addObjects:@[@\"a\", @\"b\", NSNull.null, @\"b\", @\"a\"]];\n    [optManaged.dataObj addObjects:@[data(1), data(2), NSNull.null, data(2), data(1)]];\n    [optManaged.dateObj addObjects:@[date(1), date(2), NSNull.null, date(2), date(1)]];\n    [optManaged.decimalObj addObjects:@[decimal128(2), decimal128(3), NSNull.null, decimal128(3), decimal128(2)]];\n    [optManaged.objectIdObj addObjects:@[objectId(1), objectId(2), NSNull.null, objectId(2), objectId(1)]];\n    [optManaged.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]];\n\n    uncheckedAssertEqual(0U, [[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@YES]);\n    uncheckedAssertEqual(0U, [[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3]);\n    uncheckedAssertEqual(0U, [[managed.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3.3f]);\n    uncheckedAssertEqual(0U, [[managed.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3.3]);\n    uncheckedAssertEqual(0U, [[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@\"b\"]);\n    uncheckedAssertEqual(0U, [[managed.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:data(2)]);\n    uncheckedAssertEqual(0U, [[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:date(2)]);\n    uncheckedAssertEqual(0U, [[managed.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:decimal128(3)]);\n    uncheckedAssertEqual(0U, [[managed.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:objectId(2)]);\n    uncheckedAssertEqual(0U, [[managed.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    uncheckedAssertEqual(2U, [[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@NO]);\n    uncheckedAssertEqual(2U, [[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2]);\n    uncheckedAssertEqual(2U, [[managed.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2.2f]);\n    uncheckedAssertEqual(2U, [[managed.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2.2]);\n    uncheckedAssertEqual(2U, [[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@\"a\"]);\n    uncheckedAssertEqual(2U, [[managed.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:data(1)]);\n    uncheckedAssertEqual(2U, [[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:date(1)]);\n    uncheckedAssertEqual(2U, [[managed.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:decimal128(2)]);\n    uncheckedAssertEqual(2U, [[managed.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:objectId(1)]);\n    uncheckedAssertEqual(2U, [[managed.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n\n    uncheckedAssertEqual(0U, [[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@YES]);\n    uncheckedAssertEqual(0U, [[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3]);\n    uncheckedAssertEqual(0U, [[optManaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3.3f]);\n    uncheckedAssertEqual(0U, [[optManaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3.3]);\n    uncheckedAssertEqual(0U, [[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@\"b\"]);\n    uncheckedAssertEqual(0U, [[optManaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:data(2)]);\n    uncheckedAssertEqual(0U, [[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:date(2)]);\n    uncheckedAssertEqual(0U, [[optManaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:decimal128(3)]);\n    uncheckedAssertEqual(0U, [[optManaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:objectId(2)]);\n    uncheckedAssertEqual(0U, [[optManaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    uncheckedAssertEqual(2U, [[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@NO]);\n    uncheckedAssertEqual(2U, [[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2]);\n    uncheckedAssertEqual(2U, [[optManaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2.2f]);\n    uncheckedAssertEqual(2U, [[optManaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2.2]);\n    uncheckedAssertEqual(2U, [[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@\"a\"]);\n    uncheckedAssertEqual(2U, [[optManaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:data(1)]);\n    uncheckedAssertEqual(2U, [[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:date(1)]);\n    uncheckedAssertEqual(2U, [[optManaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:decimal128(2)]);\n    uncheckedAssertEqual(2U, [[optManaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:objectId(1)]);\n    uncheckedAssertEqual(2U, [[optManaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertEqual(4U, [[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(4U, [[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(4U, [[optManaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(4U, [[optManaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(4U, [[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(4U, [[optManaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(4U, [[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(4U, [[optManaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(4U, [[optManaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(4U, [[optManaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null]);\n}\n\n- (void)testIndexOfObjectDistinct {\n    [managed.boolObj addObjects:@[@NO, @NO, @YES]];\n    [managed.intObj addObjects:@[@2, @2, @3]];\n    [managed.floatObj addObjects:@[@2.2f, @2.2f, @3.3f]];\n    [managed.doubleObj addObjects:@[@2.2, @2.2, @3.3]];\n    [managed.stringObj addObjects:@[@\"a\", @\"a\", @\"b\"]];\n    [managed.dataObj addObjects:@[data(1), data(1), data(2)]];\n    [managed.dateObj addObjects:@[date(1), date(1), date(2)]];\n    [managed.decimalObj addObjects:@[decimal128(2), decimal128(2), decimal128(3)]];\n    [managed.objectIdObj addObjects:@[objectId(1), objectId(1), objectId(2)]];\n    [managed.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optManaged.boolObj addObjects:@[@NO, @NO, NSNull.null, @YES, @NO]];\n    [optManaged.intObj addObjects:@[@2, @2, NSNull.null, @3, @2]];\n    [optManaged.floatObj addObjects:@[@2.2f, @2.2f, NSNull.null, @3.3f, @2.2f]];\n    [optManaged.doubleObj addObjects:@[@2.2, @2.2, NSNull.null, @3.3, @2.2]];\n    [optManaged.stringObj addObjects:@[@\"a\", @\"a\", NSNull.null, @\"b\", @\"a\"]];\n    [optManaged.dataObj addObjects:@[data(1), data(1), NSNull.null, data(2), data(1)]];\n    [optManaged.dateObj addObjects:@[date(1), date(1), NSNull.null, date(2), date(1)]];\n    [optManaged.decimalObj addObjects:@[decimal128(2), decimal128(2), NSNull.null, decimal128(3), decimal128(2)]];\n    [optManaged.objectIdObj addObjects:@[objectId(1), objectId(1), NSNull.null, objectId(2), objectId(1)]];\n    [optManaged.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]];\n\n    uncheckedAssertEqual(0U, [[managed.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@NO]);\n    uncheckedAssertEqual(0U, [[managed.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2]);\n    uncheckedAssertEqual(0U, [[managed.floatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2.2f]);\n    uncheckedAssertEqual(0U, [[managed.doubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2.2]);\n    uncheckedAssertEqual(0U, [[managed.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@\"a\"]);\n    uncheckedAssertEqual(0U, [[managed.dataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:data(1)]);\n    uncheckedAssertEqual(0U, [[managed.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:date(1)]);\n    uncheckedAssertEqual(0U, [[managed.decimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:decimal128(2)]);\n    uncheckedAssertEqual(0U, [[managed.objectIdObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:objectId(1)]);\n    uncheckedAssertEqual(0U, [[managed.uuidObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertEqual(1U, [[managed.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@YES]);\n    uncheckedAssertEqual(1U, [[managed.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3]);\n    uncheckedAssertEqual(1U, [[managed.floatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3.3f]);\n    uncheckedAssertEqual(1U, [[managed.doubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3.3]);\n    uncheckedAssertEqual(1U, [[managed.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@\"b\"]);\n    uncheckedAssertEqual(1U, [[managed.dataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:data(2)]);\n    uncheckedAssertEqual(1U, [[managed.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:date(2)]);\n    uncheckedAssertEqual(1U, [[managed.decimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:decimal128(3)]);\n    uncheckedAssertEqual(1U, [[managed.objectIdObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:objectId(2)]);\n    uncheckedAssertEqual(1U, [[managed.uuidObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n\n    uncheckedAssertEqual(0U, [[optManaged.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@NO]);\n    uncheckedAssertEqual(0U, [[optManaged.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2]);\n    uncheckedAssertEqual(0U, [[optManaged.floatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2.2f]);\n    uncheckedAssertEqual(0U, [[optManaged.doubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2.2]);\n    uncheckedAssertEqual(0U, [[optManaged.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@\"a\"]);\n    uncheckedAssertEqual(0U, [[optManaged.dataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:data(1)]);\n    uncheckedAssertEqual(0U, [[optManaged.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:date(1)]);\n    uncheckedAssertEqual(0U, [[optManaged.decimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:decimal128(2)]);\n    uncheckedAssertEqual(0U, [[optManaged.objectIdObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:objectId(1)]);\n    uncheckedAssertEqual(0U, [[optManaged.uuidObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertEqual(2U, [[optManaged.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@YES]);\n    uncheckedAssertEqual(2U, [[optManaged.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3]);\n    uncheckedAssertEqual(2U, [[optManaged.floatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3.3f]);\n    uncheckedAssertEqual(2U, [[optManaged.doubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3.3]);\n    uncheckedAssertEqual(2U, [[optManaged.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@\"b\"]);\n    uncheckedAssertEqual(2U, [[optManaged.dataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:data(2)]);\n    uncheckedAssertEqual(2U, [[optManaged.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:date(2)]);\n    uncheckedAssertEqual(2U, [[optManaged.decimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:decimal128(3)]);\n    uncheckedAssertEqual(2U, [[optManaged.objectIdObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:objectId(2)]);\n    uncheckedAssertEqual(2U, [[optManaged.uuidObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    uncheckedAssertEqual(1U, [[optManaged.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.floatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.doubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.dataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.decimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.objectIdObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.uuidObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null]);\n}\n\n- (void)testIndexOfObjectWhere {\n    RLMAssertThrowsWithReason([managed.boolObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.intObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.floatObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.doubleObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.stringObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.dataObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.dateObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.decimalObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.objectIdObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.uuidObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyBoolObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyIntObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyFloatObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDoubleObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyStringObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDataObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDateObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDecimalObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyObjectIdObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyUUIDObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.boolObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.intObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.floatObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.stringObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.dataObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.dateObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyObjectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n\n    uncheckedAssertEqual(NSNotFound, [unmanaged.boolObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.intObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.floatObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.doubleObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.stringObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.dataObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.dateObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.decimalObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.objectIdObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.uuidObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyBoolObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyIntObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyFloatObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDoubleObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyStringObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDataObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDateObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDecimalObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyObjectIdObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyUUIDObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.boolObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.intObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.floatObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.doubleObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.stringObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.dataObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.dateObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.decimalObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.objectIdObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.uuidObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n\n    [self addObjects];\n\n    uncheckedAssertEqual(0U, [unmanaged.boolObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [unmanaged.intObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [unmanaged.floatObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [unmanaged.doubleObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [unmanaged.stringObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [unmanaged.dataObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [unmanaged.dateObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [unmanaged.decimalObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [unmanaged.objectIdObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [unmanaged.uuidObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [unmanaged.anyBoolObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [unmanaged.anyIntObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [unmanaged.anyFloatObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [unmanaged.anyDoubleObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [unmanaged.anyStringObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [unmanaged.anyDataObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [unmanaged.anyDateObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [unmanaged.anyDecimalObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [unmanaged.anyObjectIdObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [unmanaged.anyUUIDObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [optUnmanaged.boolObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [optUnmanaged.intObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [optUnmanaged.floatObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [optUnmanaged.doubleObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [optUnmanaged.stringObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [optUnmanaged.dataObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [optUnmanaged.dateObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [optUnmanaged.decimalObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [optUnmanaged.objectIdObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(0U, [optUnmanaged.uuidObj indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.boolObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.intObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.floatObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.doubleObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.stringObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.dataObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.dateObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.decimalObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.objectIdObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.uuidObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyBoolObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyIntObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyFloatObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDoubleObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyStringObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDataObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDateObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDecimalObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyObjectIdObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyUUIDObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.boolObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.intObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.floatObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.doubleObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.stringObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.dataObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.dateObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.decimalObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.objectIdObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.uuidObj indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n}\n\n- (void)testIndexOfObjectWithPredicate {\n    RLMAssertThrowsWithReason([managed.boolObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.intObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.floatObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.doubleObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.stringObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.dataObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.dateObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.decimalObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.objectIdObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.uuidObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyBoolObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyIntObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyFloatObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDoubleObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyStringObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDataObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDateObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDecimalObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyObjectIdObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyUUIDObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.boolObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.intObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.floatObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.stringObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.dataObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.dateObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyObjectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n\n    uncheckedAssertEqual(NSNotFound, [unmanaged.boolObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.intObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.floatObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.doubleObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.stringObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.dataObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.dateObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.decimalObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.objectIdObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.uuidObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyBoolObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyIntObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyFloatObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDoubleObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyStringObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDataObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDateObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDecimalObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyObjectIdObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyUUIDObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.boolObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.intObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.floatObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.doubleObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.stringObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.dataObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.dateObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.decimalObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.objectIdObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.uuidObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n\n    [self addObjects];\n\n    uncheckedAssertEqual(0U, [unmanaged.boolObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [unmanaged.intObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [unmanaged.floatObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [unmanaged.doubleObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [unmanaged.stringObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [unmanaged.dataObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [unmanaged.dateObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [unmanaged.decimalObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [unmanaged.objectIdObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [unmanaged.uuidObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [unmanaged.anyBoolObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [unmanaged.anyIntObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [unmanaged.anyFloatObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [unmanaged.anyDoubleObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [unmanaged.anyStringObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [unmanaged.anyDataObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [unmanaged.anyDateObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [unmanaged.anyDecimalObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [unmanaged.anyObjectIdObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [unmanaged.anyUUIDObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [optUnmanaged.boolObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [optUnmanaged.intObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [optUnmanaged.floatObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [optUnmanaged.doubleObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [optUnmanaged.stringObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [optUnmanaged.dataObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [optUnmanaged.dateObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [optUnmanaged.decimalObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [optUnmanaged.objectIdObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(0U, [optUnmanaged.uuidObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.boolObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.intObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.floatObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.doubleObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.stringObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.dataObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.dateObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.decimalObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.objectIdObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.uuidObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyBoolObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyIntObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyFloatObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDoubleObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyStringObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDataObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDateObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyDecimalObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyObjectIdObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [unmanaged.anyUUIDObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.boolObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.intObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.floatObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.doubleObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.stringObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.dataObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.dateObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.decimalObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.objectIdObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n    uncheckedAssertEqual(NSNotFound, [optUnmanaged.uuidObj indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n}\n\n- (void)testSort {\n    RLMAssertThrowsWithReason([unmanaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyObjectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.boolObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.intObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyBoolObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyIntObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyFloatObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDoubleObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyStringObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDataObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDateObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDecimalObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyObjectIdObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyUUIDObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([managed.boolObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.intObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.floatObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.doubleObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.stringObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.dataObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.dateObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.decimalObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.uuidObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyBoolObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyIntObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyFloatObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyDoubleObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyStringObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyDataObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyDateObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyDecimalObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyObjectIdObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyUUIDObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.intObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.floatObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n\n    [managed.boolObj addObjects:@[@NO, @YES, @NO]];\n    [managed.intObj addObjects:@[@2, @3, @2]];\n    [managed.floatObj addObjects:@[@2.2f, @3.3f, @2.2f]];\n    [managed.doubleObj addObjects:@[@2.2, @3.3, @2.2]];\n    [managed.stringObj addObjects:@[@\"a\", @\"b\", @\"a\"]];\n    [managed.dataObj addObjects:@[data(1), data(2), data(1)]];\n    [managed.dateObj addObjects:@[date(1), date(2), date(1)]];\n    [managed.decimalObj addObjects:@[decimal128(2), decimal128(3), decimal128(2)]];\n    [managed.objectIdObj addObjects:@[objectId(1), objectId(2), objectId(1)]];\n    [managed.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]];\n    [optManaged.boolObj addObjects:@[@NO, @YES, NSNull.null, @YES, @NO]];\n    [optManaged.intObj addObjects:@[@2, @3, NSNull.null, @3, @2]];\n    [optManaged.floatObj addObjects:@[@2.2f, @3.3f, NSNull.null, @3.3f, @2.2f]];\n    [optManaged.doubleObj addObjects:@[@2.2, @3.3, NSNull.null, @3.3, @2.2]];\n    [optManaged.stringObj addObjects:@[@\"a\", @\"b\", NSNull.null, @\"b\", @\"a\"]];\n    [optManaged.dataObj addObjects:@[data(1), data(2), NSNull.null, data(2), data(1)]];\n    [optManaged.dateObj addObjects:@[date(1), date(2), NSNull.null, date(2), date(1)]];\n    [optManaged.decimalObj addObjects:@[decimal128(2), decimal128(3), NSNull.null, decimal128(3), decimal128(2)]];\n    [optManaged.objectIdObj addObjects:@[objectId(1), objectId(2), NSNull.null, objectId(2), objectId(1)]];\n    [optManaged.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]];\n\n    uncheckedAssertEqualObjects([[managed.boolObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@NO, @YES, @NO]));\n    uncheckedAssertEqualObjects([[managed.intObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@2, @3, @2]));\n    uncheckedAssertEqualObjects([[managed.floatObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@2.2f, @3.3f, @2.2f]));\n    uncheckedAssertEqualObjects([[managed.doubleObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@2.2, @3.3, @2.2]));\n    uncheckedAssertEqualObjects([[managed.stringObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@\"a\", @\"b\", @\"a\"]));\n    uncheckedAssertEqualObjects([[managed.dataObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[data(1), data(2), data(1)]));\n    uncheckedAssertEqualObjects([[managed.dateObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[date(1), date(2), date(1)]));\n    uncheckedAssertEqualObjects([[managed.decimalObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[decimal128(2), decimal128(3), decimal128(2)]));\n    uncheckedAssertEqualObjects([[managed.objectIdObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[objectId(1), objectId(2), objectId(1)]));\n    uncheckedAssertEqualObjects([[managed.uuidObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]));\n    uncheckedAssertEqualObjects([[optManaged.boolObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@NO, @YES, NSNull.null, @YES, @NO]));\n    uncheckedAssertEqualObjects([[optManaged.intObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@2, @3, NSNull.null, @3, @2]));\n    uncheckedAssertEqualObjects([[optManaged.floatObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@2.2f, @3.3f, NSNull.null, @3.3f, @2.2f]));\n    uncheckedAssertEqualObjects([[optManaged.doubleObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@2.2, @3.3, NSNull.null, @3.3, @2.2]));\n    uncheckedAssertEqualObjects([[optManaged.stringObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@\"a\", @\"b\", NSNull.null, @\"b\", @\"a\"]));\n    uncheckedAssertEqualObjects([[optManaged.dataObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[data(1), data(2), NSNull.null, data(2), data(1)]));\n    uncheckedAssertEqualObjects([[optManaged.dateObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[date(1), date(2), NSNull.null, date(2), date(1)]));\n    uncheckedAssertEqualObjects([[optManaged.decimalObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[decimal128(2), decimal128(3), NSNull.null, decimal128(3), decimal128(2)]));\n    uncheckedAssertEqualObjects([[optManaged.objectIdObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[objectId(1), objectId(2), NSNull.null, objectId(2), objectId(1)]));\n    uncheckedAssertEqualObjects([[optManaged.uuidObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]));\n\n    uncheckedAssertEqualObjects([[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@YES, @NO, @NO]));\n    uncheckedAssertEqualObjects([[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@3, @2, @2]));\n    uncheckedAssertEqualObjects([[managed.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@3.3f, @2.2f, @2.2f]));\n    uncheckedAssertEqualObjects([[managed.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@3.3, @2.2, @2.2]));\n    uncheckedAssertEqualObjects([[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@\"b\", @\"a\", @\"a\"]));\n    uncheckedAssertEqualObjects([[managed.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[data(2), data(1), data(1)]));\n    uncheckedAssertEqualObjects([[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[date(2), date(1), date(1)]));\n    uncheckedAssertEqualObjects([[managed.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[decimal128(3), decimal128(2), decimal128(2)]));\n    uncheckedAssertEqualObjects([[managed.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[objectId(2), objectId(1), objectId(1)]));\n    uncheckedAssertEqualObjects([[managed.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]));\n    uncheckedAssertEqualObjects([[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@YES, @YES, @NO, @NO, NSNull.null]));\n    uncheckedAssertEqualObjects([[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@3, @3, @2, @2, NSNull.null]));\n    uncheckedAssertEqualObjects([[optManaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@3.3f, @3.3f, @2.2f, @2.2f, NSNull.null]));\n    uncheckedAssertEqualObjects([[optManaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@3.3, @3.3, @2.2, @2.2, NSNull.null]));\n    uncheckedAssertEqualObjects([[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@\"b\", @\"b\", @\"a\", @\"a\", NSNull.null]));\n    uncheckedAssertEqualObjects([[optManaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[data(2), data(2), data(1), data(1), NSNull.null]));\n    uncheckedAssertEqualObjects([[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[date(2), date(2), date(1), date(1), NSNull.null]));\n    uncheckedAssertEqualObjects([[optManaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[decimal128(3), decimal128(3), decimal128(2), decimal128(2), NSNull.null]));\n    uncheckedAssertEqualObjects([[optManaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[objectId(2), objectId(2), objectId(1), objectId(1), NSNull.null]));\n    uncheckedAssertEqualObjects([[optManaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), NSNull.null]));\n\n    uncheckedAssertEqualObjects([[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[@NO, @NO, @YES]));\n    uncheckedAssertEqualObjects([[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[@2, @2, @3]));\n    uncheckedAssertEqualObjects([[managed.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[@2.2f, @2.2f, @3.3f]));\n    uncheckedAssertEqualObjects([[managed.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[@2.2, @2.2, @3.3]));\n    uncheckedAssertEqualObjects([[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[@\"a\", @\"a\", @\"b\"]));\n    uncheckedAssertEqualObjects([[managed.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[data(1), data(1), data(2)]));\n    uncheckedAssertEqualObjects([[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[date(1), date(1), date(2)]));\n    uncheckedAssertEqualObjects([[managed.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[decimal128(2), decimal128(2), decimal128(3)]));\n    uncheckedAssertEqualObjects([[managed.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[objectId(1), objectId(1), objectId(2)]));\n    uncheckedAssertEqualObjects([[managed.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[NSNull.null, @NO, @NO, @YES, @YES]));\n    uncheckedAssertEqualObjects([[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[NSNull.null, @2, @2, @3, @3]));\n    uncheckedAssertEqualObjects([[optManaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[NSNull.null, @2.2f, @2.2f, @3.3f, @3.3f]));\n    uncheckedAssertEqualObjects([[optManaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[NSNull.null, @2.2, @2.2, @3.3, @3.3]));\n    uncheckedAssertEqualObjects([[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[NSNull.null, @\"a\", @\"a\", @\"b\", @\"b\"]));\n    uncheckedAssertEqualObjects([[optManaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[NSNull.null, data(1), data(1), data(2), data(2)]));\n    uncheckedAssertEqualObjects([[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[NSNull.null, date(1), date(1), date(2), date(2)]));\n    uncheckedAssertEqualObjects([[optManaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[NSNull.null, decimal128(2), decimal128(2), decimal128(3), decimal128(3)]));\n    uncheckedAssertEqualObjects([[optManaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[NSNull.null, objectId(1), objectId(1), objectId(2), objectId(2)]));\n    uncheckedAssertEqualObjects([[optManaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[NSNull.null, uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n}\n\n- (void)testFilter {\n    RLMAssertThrowsWithReason([unmanaged.boolObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.intObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyBoolObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyIntObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyFloatObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDoubleObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyStringObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDataObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDateObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDecimalObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyObjectIdObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyUUIDObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.boolObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.intObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyBoolObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyIntObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyFloatObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDoubleObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyStringObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDataObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDateObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDecimalObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyObjectIdObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyUUIDObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n\n    RLMAssertThrowsWithReason([managed.boolObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.intObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.floatObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.doubleObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.stringObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.dataObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.dateObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.decimalObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.objectIdObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.uuidObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyBoolObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyIntObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyFloatObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDoubleObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyStringObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDataObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDateObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDecimalObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyObjectIdObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyUUIDObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.boolObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.intObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.floatObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.stringObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.dataObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.dateObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.boolObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.intObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.floatObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.doubleObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.stringObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.dataObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.dateObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.decimalObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.objectIdObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.uuidObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyBoolObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyIntObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyFloatObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDoubleObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyStringObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDataObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDateObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDecimalObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyObjectIdObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyUUIDObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.boolObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.intObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.floatObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.stringObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.dataObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.dateObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n\n    RLMAssertThrowsWithReason([[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyObjectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyObjectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n}\n\n- (void)testNotifications {\n    RLMAssertThrowsWithReason([unmanaged.boolObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.intObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyBoolObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyIntObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyFloatObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyDoubleObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyStringObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyDataObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyDateObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyDecimalObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyObjectIdObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyUUIDObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n}\n\n- (void)testMin {\n    RLMAssertThrowsWithReason([unmanaged.boolObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for bool array\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for string array\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for data array\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for object id array\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for uuid array\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for bool? array\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for string? array\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for data? array\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for object id? array\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for uuid? array\");\n    RLMAssertThrowsWithReason([managed.boolObj minOfProperty:@\"self\"],\n                              @\"Operation 'min' not supported for bool list 'AllPrimitiveArrays.boolObj'\");\n    RLMAssertThrowsWithReason([managed.stringObj minOfProperty:@\"self\"],\n                              @\"Operation 'min' not supported for string list 'AllPrimitiveArrays.stringObj'\");\n    RLMAssertThrowsWithReason([managed.dataObj minOfProperty:@\"self\"],\n                              @\"Operation 'min' not supported for data list 'AllPrimitiveArrays.dataObj'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj minOfProperty:@\"self\"],\n                              @\"Operation 'min' not supported for object id list 'AllPrimitiveArrays.objectIdObj'\");\n    RLMAssertThrowsWithReason([managed.uuidObj minOfProperty:@\"self\"],\n                              @\"Operation 'min' not supported for uuid list 'AllPrimitiveArrays.uuidObj'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj minOfProperty:@\"self\"],\n                              @\"Operation 'min' not supported for bool? list 'AllOptionalPrimitiveArrays.boolObj'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj minOfProperty:@\"self\"],\n                              @\"Operation 'min' not supported for string? list 'AllOptionalPrimitiveArrays.stringObj'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj minOfProperty:@\"self\"],\n                              @\"Operation 'min' not supported for data? list 'AllOptionalPrimitiveArrays.dataObj'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj minOfProperty:@\"self\"],\n                              @\"Operation 'min' not supported for object id? list 'AllOptionalPrimitiveArrays.objectIdObj'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj minOfProperty:@\"self\"],\n                              @\"Operation 'min' not supported for uuid? list 'AllOptionalPrimitiveArrays.uuidObj'\");\n\n    uncheckedAssertNil([unmanaged.intObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.floatObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.doubleObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.dateObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.decimalObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyFloatObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDoubleObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDateObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDecimalObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.intObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.floatObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.doubleObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.dateObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.decimalObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.intObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.floatObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.doubleObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.dateObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.decimalObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyIntObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyFloatObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDoubleObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDateObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDecimalObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.intObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.floatObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.doubleObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.dateObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.decimalObj minOfProperty:@\"self\"]);\n\n    [self addObjects];\n\n    uncheckedAssertEqualObjects([unmanaged.intObj minOfProperty:@\"self\"], @2);\n    uncheckedAssertEqualObjects([unmanaged.floatObj minOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([unmanaged.doubleObj minOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([unmanaged.dateObj minOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([unmanaged.decimalObj minOfProperty:@\"self\"], decimal128(2));\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj minOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj minOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([unmanaged.anyDateObj minOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj minOfProperty:@\"self\"], decimal128(2));\n    uncheckedAssertEqualObjects([optUnmanaged.intObj minOfProperty:@\"self\"], @2);\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj minOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj minOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([optUnmanaged.dateObj minOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj minOfProperty:@\"self\"], decimal128(2));\n    uncheckedAssertEqualObjects([managed.intObj minOfProperty:@\"self\"], @2);\n    uncheckedAssertEqualObjects([managed.floatObj minOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([managed.doubleObj minOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([managed.dateObj minOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([managed.decimalObj minOfProperty:@\"self\"], decimal128(2));\n    uncheckedAssertEqualObjects([managed.anyIntObj minOfProperty:@\"self\"], @2);\n    uncheckedAssertEqualObjects([managed.anyFloatObj minOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([managed.anyDoubleObj minOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([managed.anyDateObj minOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([managed.anyDecimalObj minOfProperty:@\"self\"], decimal128(2));\n    uncheckedAssertEqualObjects([optManaged.intObj minOfProperty:@\"self\"], @2);\n    uncheckedAssertEqualObjects([optManaged.floatObj minOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([optManaged.doubleObj minOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([optManaged.dateObj minOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([optManaged.decimalObj minOfProperty:@\"self\"], decimal128(2));\n}\n\n- (void)testMax {\n    RLMAssertThrowsWithReason([unmanaged.boolObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for bool array\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for string array\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for data array\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for object id array\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for uuid array\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for bool? array\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for string? array\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for data? array\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for object id? array\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for uuid? array\");\n    RLMAssertThrowsWithReason([managed.boolObj maxOfProperty:@\"self\"],\n                              @\"Operation 'max' not supported for bool list 'AllPrimitiveArrays.boolObj'\");\n    RLMAssertThrowsWithReason([managed.stringObj maxOfProperty:@\"self\"],\n                              @\"Operation 'max' not supported for string list 'AllPrimitiveArrays.stringObj'\");\n    RLMAssertThrowsWithReason([managed.dataObj maxOfProperty:@\"self\"],\n                              @\"Operation 'max' not supported for data list 'AllPrimitiveArrays.dataObj'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj maxOfProperty:@\"self\"],\n                              @\"Operation 'max' not supported for object id list 'AllPrimitiveArrays.objectIdObj'\");\n    RLMAssertThrowsWithReason([managed.uuidObj maxOfProperty:@\"self\"],\n                              @\"Operation 'max' not supported for uuid list 'AllPrimitiveArrays.uuidObj'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj maxOfProperty:@\"self\"],\n                              @\"Operation 'max' not supported for bool? list 'AllOptionalPrimitiveArrays.boolObj'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj maxOfProperty:@\"self\"],\n                              @\"Operation 'max' not supported for string? list 'AllOptionalPrimitiveArrays.stringObj'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj maxOfProperty:@\"self\"],\n                              @\"Operation 'max' not supported for data? list 'AllOptionalPrimitiveArrays.dataObj'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj maxOfProperty:@\"self\"],\n                              @\"Operation 'max' not supported for object id? list 'AllOptionalPrimitiveArrays.objectIdObj'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj maxOfProperty:@\"self\"],\n                              @\"Operation 'max' not supported for uuid? list 'AllOptionalPrimitiveArrays.uuidObj'\");\n\n    uncheckedAssertNil([unmanaged.intObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.floatObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.doubleObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.dateObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.decimalObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyFloatObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDoubleObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDateObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDecimalObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.intObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.floatObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.doubleObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.dateObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.decimalObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.intObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.floatObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.doubleObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.dateObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.decimalObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyIntObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyFloatObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDoubleObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDateObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDecimalObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.intObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.floatObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.doubleObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.dateObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.decimalObj maxOfProperty:@\"self\"]);\n\n    [self addObjects];\n\n    uncheckedAssertEqualObjects([unmanaged.intObj maxOfProperty:@\"self\"], @3);\n    uncheckedAssertEqualObjects([unmanaged.floatObj maxOfProperty:@\"self\"], @3.3f);\n    uncheckedAssertEqualObjects([unmanaged.doubleObj maxOfProperty:@\"self\"], @3.3);\n    uncheckedAssertEqualObjects([unmanaged.dateObj maxOfProperty:@\"self\"], date(2));\n    uncheckedAssertEqualObjects([unmanaged.decimalObj maxOfProperty:@\"self\"], decimal128(3));\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj maxOfProperty:@\"self\"], @3.3f);\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj maxOfProperty:@\"self\"], @3.3);\n    uncheckedAssertEqualObjects([unmanaged.anyDateObj maxOfProperty:@\"self\"], date(2));\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj maxOfProperty:@\"self\"], decimal128(3));\n    uncheckedAssertEqualObjects([optUnmanaged.intObj maxOfProperty:@\"self\"], @3);\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj maxOfProperty:@\"self\"], @3.3f);\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj maxOfProperty:@\"self\"], @3.3);\n    uncheckedAssertEqualObjects([optUnmanaged.dateObj maxOfProperty:@\"self\"], date(2));\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj maxOfProperty:@\"self\"], decimal128(3));\n    uncheckedAssertEqualObjects([managed.intObj maxOfProperty:@\"self\"], @3);\n    uncheckedAssertEqualObjects([managed.floatObj maxOfProperty:@\"self\"], @3.3f);\n    uncheckedAssertEqualObjects([managed.doubleObj maxOfProperty:@\"self\"], @3.3);\n    uncheckedAssertEqualObjects([managed.dateObj maxOfProperty:@\"self\"], date(2));\n    uncheckedAssertEqualObjects([managed.decimalObj maxOfProperty:@\"self\"], decimal128(3));\n    uncheckedAssertEqualObjects([managed.anyIntObj maxOfProperty:@\"self\"], @3);\n    uncheckedAssertEqualObjects([managed.anyFloatObj maxOfProperty:@\"self\"], @3.3f);\n    uncheckedAssertEqualObjects([managed.anyDoubleObj maxOfProperty:@\"self\"], @3.3);\n    uncheckedAssertEqualObjects([managed.anyDateObj maxOfProperty:@\"self\"], date(2));\n    uncheckedAssertEqualObjects([managed.anyDecimalObj maxOfProperty:@\"self\"], decimal128(3));\n    uncheckedAssertEqualObjects([optManaged.intObj maxOfProperty:@\"self\"], @3);\n    uncheckedAssertEqualObjects([optManaged.floatObj maxOfProperty:@\"self\"], @3.3f);\n    uncheckedAssertEqualObjects([optManaged.doubleObj maxOfProperty:@\"self\"], @3.3);\n    uncheckedAssertEqualObjects([optManaged.dateObj maxOfProperty:@\"self\"], date(2));\n    uncheckedAssertEqualObjects([optManaged.decimalObj maxOfProperty:@\"self\"], decimal128(3));\n}\n\n- (void)testSum {\n    RLMAssertThrowsWithReason([unmanaged.boolObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for bool array\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for string array\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for data array\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for date array\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for object id array\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for uuid array\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for bool? array\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for string? array\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for data? array\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for date? array\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for object id? array\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for uuid? array\");\n    RLMAssertThrowsWithReason([managed.boolObj sumOfProperty:@\"self\"],\n                              @\"Operation 'sum' not supported for bool list 'AllPrimitiveArrays.boolObj'\");\n    RLMAssertThrowsWithReason([managed.stringObj sumOfProperty:@\"self\"],\n                              @\"Operation 'sum' not supported for string list 'AllPrimitiveArrays.stringObj'\");\n    RLMAssertThrowsWithReason([managed.dataObj sumOfProperty:@\"self\"],\n                              @\"Operation 'sum' not supported for data list 'AllPrimitiveArrays.dataObj'\");\n    RLMAssertThrowsWithReason([managed.dateObj sumOfProperty:@\"self\"],\n                              @\"Operation 'sum' not supported for date list 'AllPrimitiveArrays.dateObj'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj sumOfProperty:@\"self\"],\n                              @\"Operation 'sum' not supported for object id list 'AllPrimitiveArrays.objectIdObj'\");\n    RLMAssertThrowsWithReason([managed.uuidObj sumOfProperty:@\"self\"],\n                              @\"Operation 'sum' not supported for uuid list 'AllPrimitiveArrays.uuidObj'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj sumOfProperty:@\"self\"],\n                              @\"Operation 'sum' not supported for bool? list 'AllOptionalPrimitiveArrays.boolObj'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj sumOfProperty:@\"self\"],\n                              @\"Operation 'sum' not supported for string? list 'AllOptionalPrimitiveArrays.stringObj'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj sumOfProperty:@\"self\"],\n                              @\"Operation 'sum' not supported for data? list 'AllOptionalPrimitiveArrays.dataObj'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj sumOfProperty:@\"self\"],\n                              @\"Operation 'sum' not supported for date? list 'AllOptionalPrimitiveArrays.dateObj'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj sumOfProperty:@\"self\"],\n                              @\"Operation 'sum' not supported for object id? list 'AllOptionalPrimitiveArrays.objectIdObj'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj sumOfProperty:@\"self\"],\n                              @\"Operation 'sum' not supported for uuid? list 'AllOptionalPrimitiveArrays.uuidObj'\");\n\n    uncheckedAssertEqualObjects([unmanaged.intObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.floatObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.doubleObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.decimalObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyIntObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.intObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.intObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.floatObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.doubleObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.decimalObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyIntObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyFloatObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyDoubleObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyDecimalObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.intObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.floatObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.doubleObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.decimalObj sumOfProperty:@\"self\"], @0);\n\n    [self addObjects];\n\n    XCTAssertEqualWithAccuracy([unmanaged.intObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.floatObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.doubleObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.decimalObj sumOfProperty:@\"self\"].doubleValue, sum(@[decimal128(2), decimal128(3)]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyIntObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyFloatObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyDoubleObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyDecimalObj sumOfProperty:@\"self\"].doubleValue, sum(@[decimal128(2), decimal128(3)]), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.intObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2, @3, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.floatObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2f, @3.3f, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.doubleObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2, @3.3, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.decimalObj sumOfProperty:@\"self\"].doubleValue, sum(@[decimal128(2), decimal128(3), NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([managed.intObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([managed.floatObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([managed.doubleObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([managed.decimalObj sumOfProperty:@\"self\"].doubleValue, sum(@[decimal128(2), decimal128(3)]), .001);\n    XCTAssertEqualWithAccuracy([managed.anyIntObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([managed.anyFloatObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([managed.anyDoubleObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([managed.anyDecimalObj sumOfProperty:@\"self\"].doubleValue, sum(@[decimal128(2), decimal128(3)]), .001);\n    XCTAssertEqualWithAccuracy([optManaged.intObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2, @3, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([optManaged.floatObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2f, @3.3f, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([optManaged.doubleObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2, @3.3, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([optManaged.decimalObj sumOfProperty:@\"self\"].doubleValue, sum(@[decimal128(2), decimal128(3), NSNull.null]), .001);\n}\n\n- (void)testAverage {\n    RLMAssertThrowsWithReason([unmanaged.boolObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for bool array\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for string array\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for data array\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for date array\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for object id array\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for uuid array\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for bool? array\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for string? array\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for data? array\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for date? array\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for object id? array\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for uuid? array\");\n    RLMAssertThrowsWithReason([managed.boolObj averageOfProperty:@\"self\"],\n                              @\"Operation 'average' not supported for bool list 'AllPrimitiveArrays.boolObj'\");\n    RLMAssertThrowsWithReason([managed.stringObj averageOfProperty:@\"self\"],\n                              @\"Operation 'average' not supported for string list 'AllPrimitiveArrays.stringObj'\");\n    RLMAssertThrowsWithReason([managed.dataObj averageOfProperty:@\"self\"],\n                              @\"Operation 'average' not supported for data list 'AllPrimitiveArrays.dataObj'\");\n    RLMAssertThrowsWithReason([managed.dateObj averageOfProperty:@\"self\"],\n                              @\"Operation 'average' not supported for date list 'AllPrimitiveArrays.dateObj'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj averageOfProperty:@\"self\"],\n                              @\"Operation 'average' not supported for object id list 'AllPrimitiveArrays.objectIdObj'\");\n    RLMAssertThrowsWithReason([managed.uuidObj averageOfProperty:@\"self\"],\n                              @\"Operation 'average' not supported for uuid list 'AllPrimitiveArrays.uuidObj'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj averageOfProperty:@\"self\"],\n                              @\"Operation 'average' not supported for bool? list 'AllOptionalPrimitiveArrays.boolObj'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj averageOfProperty:@\"self\"],\n                              @\"Operation 'average' not supported for string? list 'AllOptionalPrimitiveArrays.stringObj'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj averageOfProperty:@\"self\"],\n                              @\"Operation 'average' not supported for data? list 'AllOptionalPrimitiveArrays.dataObj'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj averageOfProperty:@\"self\"],\n                              @\"Operation 'average' not supported for date? list 'AllOptionalPrimitiveArrays.dateObj'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj averageOfProperty:@\"self\"],\n                              @\"Operation 'average' not supported for object id? list 'AllOptionalPrimitiveArrays.objectIdObj'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj averageOfProperty:@\"self\"],\n                              @\"Operation 'average' not supported for uuid? list 'AllOptionalPrimitiveArrays.uuidObj'\");\n\n    uncheckedAssertNil([unmanaged.intObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.floatObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.doubleObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.decimalObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyIntObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyFloatObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDoubleObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDecimalObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.intObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.floatObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.doubleObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.decimalObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.intObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.floatObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.doubleObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.decimalObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyIntObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyFloatObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDoubleObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDecimalObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.intObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.floatObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.doubleObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.decimalObj averageOfProperty:@\"self\"]);\n\n    [self addObjects];\n\n    XCTAssertEqualWithAccuracy([unmanaged.intObj averageOfProperty:@\"self\"].doubleValue, average(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.floatObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.doubleObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.decimalObj averageOfProperty:@\"self\"].doubleValue, average(@[decimal128(2), decimal128(3)]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyIntObj averageOfProperty:@\"self\"].doubleValue, average(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyFloatObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyDoubleObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyDecimalObj averageOfProperty:@\"self\"].doubleValue, average(@[decimal128(2), decimal128(3)]), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.intObj averageOfProperty:@\"self\"].doubleValue, average(@[@2, @3, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.floatObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2f, @3.3f, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.doubleObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2, @3.3, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.decimalObj averageOfProperty:@\"self\"].doubleValue, average(@[decimal128(2), decimal128(3), NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([managed.intObj averageOfProperty:@\"self\"].doubleValue, average(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([managed.floatObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([managed.doubleObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([managed.decimalObj averageOfProperty:@\"self\"].doubleValue, average(@[decimal128(2), decimal128(3)]), .001);\n    XCTAssertEqualWithAccuracy([managed.anyIntObj averageOfProperty:@\"self\"].doubleValue, average(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([managed.anyFloatObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([managed.anyDoubleObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([managed.anyDecimalObj averageOfProperty:@\"self\"].doubleValue, average(@[decimal128(2), decimal128(3)]), .001);\n    XCTAssertEqualWithAccuracy([optManaged.intObj averageOfProperty:@\"self\"].doubleValue, average(@[@2, @3, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([optManaged.floatObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2f, @3.3f, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([optManaged.doubleObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2, @3.3, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([optManaged.decimalObj averageOfProperty:@\"self\"].doubleValue, average(@[decimal128(2), decimal128(3), NSNull.null]), .001);\n}\n\n- (void)testFastEnumeration {\n    for (int i = 0; i < 10; ++i) {\n        [self addObjects];\n    }\n\n    // This is wrapped in a block to work around a compiler bug in Xcode 12.5:\n    // in release builds, reads on `values` will read the wrong local variable,\n    // resulting in a crash when it tries to send a message to some unitialized\n    // stack space. Putting them in separate obj-c blocks prevents this\n    // incorrect optimization.\n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@NO, @YES];\n    for (id value in unmanaged.boolObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.boolObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@2, @3];\n    for (id value in unmanaged.intObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.intObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@2.2f, @3.3f];\n    for (id value in unmanaged.floatObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.floatObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@2.2, @3.3];\n    for (id value in unmanaged.doubleObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.doubleObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@\"a\", @\"b\"];\n    for (id value in unmanaged.stringObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.stringObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[data(1), data(2)];\n    for (id value in unmanaged.dataObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.dataObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[date(1), date(2)];\n    for (id value in unmanaged.dateObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.dateObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[decimal128(2), decimal128(3)];\n    for (id value in unmanaged.decimalObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.decimalObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[objectId(1), objectId(2)];\n    for (id value in unmanaged.objectIdObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.objectIdObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    for (id value in unmanaged.uuidObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.uuidObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@NO, @YES];\n    for (id value in unmanaged.anyBoolObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.anyBoolObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@2, @3];\n    for (id value in unmanaged.anyIntObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.anyIntObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@2.2f, @3.3f];\n    for (id value in unmanaged.anyFloatObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.anyFloatObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@2.2, @3.3];\n    for (id value in unmanaged.anyDoubleObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.anyDoubleObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@\"a\", @\"b\"];\n    for (id value in unmanaged.anyStringObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.anyStringObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[data(1), data(2)];\n    for (id value in unmanaged.anyDataObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.anyDataObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[date(1), date(2)];\n    for (id value in unmanaged.anyDateObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.anyDateObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[decimal128(2), decimal128(3)];\n    for (id value in unmanaged.anyDecimalObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.anyDecimalObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[objectId(1), objectId(2)];\n    for (id value in unmanaged.anyObjectIdObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.anyObjectIdObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    for (id value in unmanaged.anyUUIDObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, unmanaged.anyUUIDObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@NO, @YES, NSNull.null];\n    for (id value in optUnmanaged.boolObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optUnmanaged.boolObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@2, @3, NSNull.null];\n    for (id value in optUnmanaged.intObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optUnmanaged.intObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@2.2f, @3.3f, NSNull.null];\n    for (id value in optUnmanaged.floatObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optUnmanaged.floatObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@2.2, @3.3, NSNull.null];\n    for (id value in optUnmanaged.doubleObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optUnmanaged.doubleObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@\"a\", @\"b\", NSNull.null];\n    for (id value in optUnmanaged.stringObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optUnmanaged.stringObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[data(1), data(2), NSNull.null];\n    for (id value in optUnmanaged.dataObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optUnmanaged.dataObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[date(1), date(2), NSNull.null];\n    for (id value in optUnmanaged.dateObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optUnmanaged.dateObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[decimal128(2), decimal128(3), NSNull.null];\n    for (id value in optUnmanaged.decimalObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optUnmanaged.decimalObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[objectId(1), objectId(2), NSNull.null];\n    for (id value in optUnmanaged.objectIdObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optUnmanaged.objectIdObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null];\n    for (id value in optUnmanaged.uuidObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optUnmanaged.uuidObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@NO, @YES];\n    for (id value in managed.boolObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.boolObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@2, @3];\n    for (id value in managed.intObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.intObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@2.2f, @3.3f];\n    for (id value in managed.floatObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.floatObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@2.2, @3.3];\n    for (id value in managed.doubleObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.doubleObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@\"a\", @\"b\"];\n    for (id value in managed.stringObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.stringObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[data(1), data(2)];\n    for (id value in managed.dataObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.dataObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[date(1), date(2)];\n    for (id value in managed.dateObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.dateObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[decimal128(2), decimal128(3)];\n    for (id value in managed.decimalObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.decimalObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[objectId(1), objectId(2)];\n    for (id value in managed.objectIdObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.objectIdObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    for (id value in managed.uuidObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.uuidObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@NO, @YES];\n    for (id value in managed.anyBoolObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.anyBoolObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@2, @3];\n    for (id value in managed.anyIntObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.anyIntObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@2.2f, @3.3f];\n    for (id value in managed.anyFloatObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.anyFloatObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@2.2, @3.3];\n    for (id value in managed.anyDoubleObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.anyDoubleObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@\"a\", @\"b\"];\n    for (id value in managed.anyStringObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.anyStringObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[data(1), data(2)];\n    for (id value in managed.anyDataObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.anyDataObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[date(1), date(2)];\n    for (id value in managed.anyDateObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.anyDateObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[decimal128(2), decimal128(3)];\n    for (id value in managed.anyDecimalObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.anyDecimalObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[objectId(1), objectId(2)];\n    for (id value in managed.anyObjectIdObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.anyObjectIdObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    for (id value in managed.anyUUIDObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, managed.anyUUIDObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@NO, @YES, NSNull.null];\n    for (id value in optManaged.boolObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optManaged.boolObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@2, @3, NSNull.null];\n    for (id value in optManaged.intObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optManaged.intObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@2.2f, @3.3f, NSNull.null];\n    for (id value in optManaged.floatObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optManaged.floatObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@2.2, @3.3, NSNull.null];\n    for (id value in optManaged.doubleObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optManaged.doubleObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[@\"a\", @\"b\", NSNull.null];\n    for (id value in optManaged.stringObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optManaged.stringObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[data(1), data(2), NSNull.null];\n    for (id value in optManaged.dataObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optManaged.dataObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[date(1), date(2), NSNull.null];\n    for (id value in optManaged.dateObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optManaged.dateObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[decimal128(2), decimal128(3), NSNull.null];\n    for (id value in optManaged.decimalObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optManaged.decimalObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[objectId(1), objectId(2), NSNull.null];\n    for (id value in optManaged.objectIdObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optManaged.objectIdObj.count);\n    }();\n    \n    ^{\n    NSUInteger i = 0;\n    NSArray *values = @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null];\n    for (id value in optManaged.uuidObj) {\n    uncheckedAssertEqualObjects(values[i++ % values.count], value);\n    }\n    uncheckedAssertEqual(i, optManaged.uuidObj.count);\n    }();\n    \n}\n\n- (void)testValueForKeySelf {\n    for (RLMArray *array in allArrays) {\n        uncheckedAssertEqualObjects([array valueForKey:@\"self\"], @[]);\n    }\n\n    [self addObjects];\n\n    uncheckedAssertEqualObjects([unmanaged.boolObj valueForKey:@\"self\"], (@[@NO, @YES]));\n    uncheckedAssertEqualObjects([unmanaged.intObj valueForKey:@\"self\"], (@[@2, @3]));\n    uncheckedAssertEqualObjects([unmanaged.floatObj valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    uncheckedAssertEqualObjects([unmanaged.doubleObj valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    uncheckedAssertEqualObjects([unmanaged.stringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    uncheckedAssertEqualObjects([unmanaged.dataObj valueForKey:@\"self\"], (@[data(1), data(2)]));\n    uncheckedAssertEqualObjects([unmanaged.dateObj valueForKey:@\"self\"], (@[date(1), date(2)]));\n    uncheckedAssertEqualObjects([unmanaged.decimalObj valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    uncheckedAssertEqualObjects([unmanaged.objectIdObj valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    uncheckedAssertEqualObjects([unmanaged.uuidObj valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([unmanaged.anyBoolObj valueForKey:@\"self\"], (@[@NO, @YES]));\n    uncheckedAssertEqualObjects([unmanaged.anyIntObj valueForKey:@\"self\"], (@[@2, @3]));\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    uncheckedAssertEqualObjects([unmanaged.anyStringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    uncheckedAssertEqualObjects([unmanaged.anyDataObj valueForKey:@\"self\"], (@[data(1), data(2)]));\n    uncheckedAssertEqualObjects([unmanaged.anyDateObj valueForKey:@\"self\"], (@[date(1), date(2)]));\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    uncheckedAssertEqualObjects([unmanaged.anyObjectIdObj valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    uncheckedAssertEqualObjects([unmanaged.anyUUIDObj valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([optUnmanaged.boolObj valueForKey:@\"self\"], (@[@NO, @YES, NSNull.null]));\n    uncheckedAssertEqualObjects([optUnmanaged.intObj valueForKey:@\"self\"], (@[@2, @3, NSNull.null]));\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj valueForKey:@\"self\"], (@[@2.2f, @3.3f, NSNull.null]));\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj valueForKey:@\"self\"], (@[@2.2, @3.3, NSNull.null]));\n    uncheckedAssertEqualObjects([optUnmanaged.stringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\", NSNull.null]));\n    uncheckedAssertEqualObjects([optUnmanaged.dataObj valueForKey:@\"self\"], (@[data(1), data(2), NSNull.null]));\n    uncheckedAssertEqualObjects([optUnmanaged.dateObj valueForKey:@\"self\"], (@[date(1), date(2), NSNull.null]));\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj valueForKey:@\"self\"], (@[decimal128(2), decimal128(3), NSNull.null]));\n    uncheckedAssertEqualObjects([optUnmanaged.objectIdObj valueForKey:@\"self\"], (@[objectId(1), objectId(2), NSNull.null]));\n    uncheckedAssertEqualObjects([optUnmanaged.uuidObj valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]));\n    uncheckedAssertEqualObjects([managed.boolObj valueForKey:@\"self\"], (@[@NO, @YES]));\n    uncheckedAssertEqualObjects([managed.intObj valueForKey:@\"self\"], (@[@2, @3]));\n    uncheckedAssertEqualObjects([managed.floatObj valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    uncheckedAssertEqualObjects([managed.doubleObj valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    uncheckedAssertEqualObjects([managed.stringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    uncheckedAssertEqualObjects([managed.dataObj valueForKey:@\"self\"], (@[data(1), data(2)]));\n    uncheckedAssertEqualObjects([managed.dateObj valueForKey:@\"self\"], (@[date(1), date(2)]));\n    uncheckedAssertEqualObjects([managed.decimalObj valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    uncheckedAssertEqualObjects([managed.objectIdObj valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    uncheckedAssertEqualObjects([managed.uuidObj valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([managed.anyBoolObj valueForKey:@\"self\"], (@[@NO, @YES]));\n    uncheckedAssertEqualObjects([managed.anyIntObj valueForKey:@\"self\"], (@[@2, @3]));\n    uncheckedAssertEqualObjects([managed.anyFloatObj valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    uncheckedAssertEqualObjects([managed.anyDoubleObj valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    uncheckedAssertEqualObjects([managed.anyStringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    uncheckedAssertEqualObjects([managed.anyDataObj valueForKey:@\"self\"], (@[data(1), data(2)]));\n    uncheckedAssertEqualObjects([managed.anyDateObj valueForKey:@\"self\"], (@[date(1), date(2)]));\n    uncheckedAssertEqualObjects([managed.anyDecimalObj valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    uncheckedAssertEqualObjects([managed.anyObjectIdObj valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    uncheckedAssertEqualObjects([managed.anyUUIDObj valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([optManaged.boolObj valueForKey:@\"self\"], (@[@NO, @YES, NSNull.null]));\n    uncheckedAssertEqualObjects([optManaged.intObj valueForKey:@\"self\"], (@[@2, @3, NSNull.null]));\n    uncheckedAssertEqualObjects([optManaged.floatObj valueForKey:@\"self\"], (@[@2.2f, @3.3f, NSNull.null]));\n    uncheckedAssertEqualObjects([optManaged.doubleObj valueForKey:@\"self\"], (@[@2.2, @3.3, NSNull.null]));\n    uncheckedAssertEqualObjects([optManaged.stringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\", NSNull.null]));\n    uncheckedAssertEqualObjects([optManaged.dataObj valueForKey:@\"self\"], (@[data(1), data(2), NSNull.null]));\n    uncheckedAssertEqualObjects([optManaged.dateObj valueForKey:@\"self\"], (@[date(1), date(2), NSNull.null]));\n    uncheckedAssertEqualObjects([optManaged.decimalObj valueForKey:@\"self\"], (@[decimal128(2), decimal128(3), NSNull.null]));\n    uncheckedAssertEqualObjects([optManaged.objectIdObj valueForKey:@\"self\"], (@[objectId(1), objectId(2), NSNull.null]));\n    uncheckedAssertEqualObjects([optManaged.uuidObj valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]));\n}\n\n- (void)testValueForKeyNumericAggregates {\n    uncheckedAssertNil([unmanaged.intObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.floatObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.doubleObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.dateObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.decimalObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.anyFloatObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.anyDoubleObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.anyDateObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.anyDecimalObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optUnmanaged.intObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optUnmanaged.floatObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optUnmanaged.doubleObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optUnmanaged.dateObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optUnmanaged.decimalObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.intObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.floatObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.doubleObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.dateObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.decimalObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.anyIntObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.anyFloatObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.anyDoubleObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.anyDateObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.anyDecimalObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optManaged.intObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optManaged.floatObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optManaged.doubleObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optManaged.dateObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optManaged.decimalObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.intObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.floatObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.doubleObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.dateObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.decimalObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.anyFloatObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.anyDoubleObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.anyDateObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.anyDecimalObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optUnmanaged.intObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optUnmanaged.floatObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optUnmanaged.doubleObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optUnmanaged.dateObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optUnmanaged.decimalObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.intObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.floatObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.doubleObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.dateObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.decimalObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.anyIntObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.anyFloatObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.anyDoubleObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.anyDateObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.anyDecimalObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optManaged.intObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optManaged.floatObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optManaged.doubleObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optManaged.dateObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optManaged.decimalObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertEqualObjects([unmanaged.intObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.floatObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.doubleObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.decimalObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.intObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.intObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.floatObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.doubleObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.decimalObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.intObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.floatObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.doubleObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.decimalObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertNil([unmanaged.intObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([unmanaged.floatObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([unmanaged.doubleObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([unmanaged.decimalObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optUnmanaged.intObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optUnmanaged.floatObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optUnmanaged.doubleObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optUnmanaged.decimalObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.intObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.floatObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.doubleObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.decimalObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optManaged.intObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optManaged.floatObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optManaged.doubleObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optManaged.decimalObj valueForKeyPath:@\"@avg.self\"]);\n\n    [self addObjects];\n\n    uncheckedAssertEqualObjects([unmanaged.intObj valueForKeyPath:@\"@min.self\"], @2);\n    uncheckedAssertEqualObjects([unmanaged.floatObj valueForKeyPath:@\"@min.self\"], @2.2f);\n    uncheckedAssertEqualObjects([unmanaged.doubleObj valueForKeyPath:@\"@min.self\"], @2.2);\n    uncheckedAssertEqualObjects([unmanaged.dateObj valueForKeyPath:@\"@min.self\"], date(1));\n    uncheckedAssertEqualObjects([unmanaged.decimalObj valueForKeyPath:@\"@min.self\"], decimal128(2));\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj valueForKeyPath:@\"@min.self\"], @2.2f);\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj valueForKeyPath:@\"@min.self\"], @2.2);\n    uncheckedAssertEqualObjects([unmanaged.anyDateObj valueForKeyPath:@\"@min.self\"], date(1));\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj valueForKeyPath:@\"@min.self\"], decimal128(2));\n    uncheckedAssertEqualObjects([optUnmanaged.intObj valueForKeyPath:@\"@min.self\"], @2);\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj valueForKeyPath:@\"@min.self\"], @2.2f);\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj valueForKeyPath:@\"@min.self\"], @2.2);\n    uncheckedAssertEqualObjects([optUnmanaged.dateObj valueForKeyPath:@\"@min.self\"], date(1));\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj valueForKeyPath:@\"@min.self\"], decimal128(2));\n    uncheckedAssertEqualObjects([managed.intObj valueForKeyPath:@\"@min.self\"], @2);\n    uncheckedAssertEqualObjects([managed.floatObj valueForKeyPath:@\"@min.self\"], @2.2f);\n    uncheckedAssertEqualObjects([managed.doubleObj valueForKeyPath:@\"@min.self\"], @2.2);\n    uncheckedAssertEqualObjects([managed.dateObj valueForKeyPath:@\"@min.self\"], date(1));\n    uncheckedAssertEqualObjects([managed.decimalObj valueForKeyPath:@\"@min.self\"], decimal128(2));\n    uncheckedAssertEqualObjects([managed.anyIntObj valueForKeyPath:@\"@min.self\"], @2);\n    uncheckedAssertEqualObjects([managed.anyFloatObj valueForKeyPath:@\"@min.self\"], @2.2f);\n    uncheckedAssertEqualObjects([managed.anyDoubleObj valueForKeyPath:@\"@min.self\"], @2.2);\n    uncheckedAssertEqualObjects([managed.anyDateObj valueForKeyPath:@\"@min.self\"], date(1));\n    uncheckedAssertEqualObjects([managed.anyDecimalObj valueForKeyPath:@\"@min.self\"], decimal128(2));\n    uncheckedAssertEqualObjects([optManaged.intObj valueForKeyPath:@\"@min.self\"], @2);\n    uncheckedAssertEqualObjects([optManaged.floatObj valueForKeyPath:@\"@min.self\"], @2.2f);\n    uncheckedAssertEqualObjects([optManaged.doubleObj valueForKeyPath:@\"@min.self\"], @2.2);\n    uncheckedAssertEqualObjects([optManaged.dateObj valueForKeyPath:@\"@min.self\"], date(1));\n    uncheckedAssertEqualObjects([optManaged.decimalObj valueForKeyPath:@\"@min.self\"], decimal128(2));\n    uncheckedAssertEqualObjects([unmanaged.intObj valueForKeyPath:@\"@max.self\"], @3);\n    uncheckedAssertEqualObjects([unmanaged.floatObj valueForKeyPath:@\"@max.self\"], @3.3f);\n    uncheckedAssertEqualObjects([unmanaged.doubleObj valueForKeyPath:@\"@max.self\"], @3.3);\n    uncheckedAssertEqualObjects([unmanaged.dateObj valueForKeyPath:@\"@max.self\"], date(2));\n    uncheckedAssertEqualObjects([unmanaged.decimalObj valueForKeyPath:@\"@max.self\"], decimal128(3));\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj valueForKeyPath:@\"@max.self\"], @3.3f);\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj valueForKeyPath:@\"@max.self\"], @3.3);\n    uncheckedAssertEqualObjects([unmanaged.anyDateObj valueForKeyPath:@\"@max.self\"], date(2));\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj valueForKeyPath:@\"@max.self\"], decimal128(3));\n    uncheckedAssertEqualObjects([optUnmanaged.intObj valueForKeyPath:@\"@max.self\"], @3);\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj valueForKeyPath:@\"@max.self\"], @3.3f);\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj valueForKeyPath:@\"@max.self\"], @3.3);\n    uncheckedAssertEqualObjects([optUnmanaged.dateObj valueForKeyPath:@\"@max.self\"], date(2));\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj valueForKeyPath:@\"@max.self\"], decimal128(3));\n    uncheckedAssertEqualObjects([managed.intObj valueForKeyPath:@\"@max.self\"], @3);\n    uncheckedAssertEqualObjects([managed.floatObj valueForKeyPath:@\"@max.self\"], @3.3f);\n    uncheckedAssertEqualObjects([managed.doubleObj valueForKeyPath:@\"@max.self\"], @3.3);\n    uncheckedAssertEqualObjects([managed.dateObj valueForKeyPath:@\"@max.self\"], date(2));\n    uncheckedAssertEqualObjects([managed.decimalObj valueForKeyPath:@\"@max.self\"], decimal128(3));\n    uncheckedAssertEqualObjects([managed.anyIntObj valueForKeyPath:@\"@max.self\"], @3);\n    uncheckedAssertEqualObjects([managed.anyFloatObj valueForKeyPath:@\"@max.self\"], @3.3f);\n    uncheckedAssertEqualObjects([managed.anyDoubleObj valueForKeyPath:@\"@max.self\"], @3.3);\n    uncheckedAssertEqualObjects([managed.anyDateObj valueForKeyPath:@\"@max.self\"], date(2));\n    uncheckedAssertEqualObjects([managed.anyDecimalObj valueForKeyPath:@\"@max.self\"], decimal128(3));\n    uncheckedAssertEqualObjects([optManaged.intObj valueForKeyPath:@\"@max.self\"], @3);\n    uncheckedAssertEqualObjects([optManaged.floatObj valueForKeyPath:@\"@max.self\"], @3.3f);\n    uncheckedAssertEqualObjects([optManaged.doubleObj valueForKeyPath:@\"@max.self\"], @3.3);\n    uncheckedAssertEqualObjects([optManaged.dateObj valueForKeyPath:@\"@max.self\"], date(2));\n    uncheckedAssertEqualObjects([optManaged.decimalObj valueForKeyPath:@\"@max.self\"], decimal128(3));\n    XCTAssertEqualWithAccuracy([[unmanaged.intObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.floatObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.doubleObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.decimalObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[decimal128(2), decimal128(3)]), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.intObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2, @3, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.floatObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2.2f, @3.3f, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.doubleObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2.2, @3.3, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.decimalObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[decimal128(2), decimal128(3), NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([[managed.intObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([[managed.floatObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([[managed.doubleObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([[managed.decimalObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[decimal128(2), decimal128(3)]), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.intObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2, @3, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.floatObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2.2f, @3.3f, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.doubleObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2.2, @3.3, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.decimalObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[decimal128(2), decimal128(3), NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.intObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.floatObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.doubleObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.decimalObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[decimal128(2), decimal128(3)]), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.intObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2, @3, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.floatObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2.2f, @3.3f, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.doubleObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2.2, @3.3, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.decimalObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[decimal128(2), decimal128(3), NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([[managed.intObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([[managed.floatObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([[managed.doubleObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([[managed.decimalObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[decimal128(2), decimal128(3)]), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.intObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2, @3, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.floatObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2.2f, @3.3f, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.doubleObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2.2, @3.3, NSNull.null]), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.decimalObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[decimal128(2), decimal128(3), NSNull.null]), .001);\n}\n\n- (void)testValueForKeyLength {\n    for (RLMArray *array in allArrays) {\n        uncheckedAssertEqualObjects([array valueForKey:@\"length\"], @[]);\n    }\n\n    [self addObjects];\n\n    uncheckedAssertEqualObjects([unmanaged.stringObj valueForKey:@\"length\"], ([@[@\"a\", @\"b\"] valueForKey:@\"length\"]));\n    uncheckedAssertEqualObjects([unmanaged.anyStringObj valueForKey:@\"length\"], ([@[@\"a\", @\"b\"] valueForKey:@\"length\"]));\n    uncheckedAssertEqualObjects([optUnmanaged.stringObj valueForKey:@\"length\"], ([@[@\"a\", @\"b\", NSNull.null] valueForKey:@\"length\"]));\n    uncheckedAssertEqualObjects([managed.stringObj valueForKey:@\"length\"], ([@[@\"a\", @\"b\"] valueForKey:@\"length\"]));\n    uncheckedAssertEqualObjects([managed.anyStringObj valueForKey:@\"length\"], ([@[@\"a\", @\"b\"] valueForKey:@\"length\"]));\n    uncheckedAssertEqualObjects([optManaged.stringObj valueForKey:@\"length\"], ([@[@\"a\", @\"b\", NSNull.null] valueForKey:@\"length\"]));\n}\n\n// Sort the distinct results to match the order used in values, as it\n// doesn't preserve the order naturally\nstatic NSArray *sortedDistinctUnion(id array, NSString *type, NSString *prop) {\n    return [[array valueForKeyPath:[NSString stringWithFormat:@\"@distinctUnionOf%@.%@\", type, prop]]\n            sortedArrayUsingComparator:^NSComparisonResult(id a, id b) {\n                bool aIsNull = a == NSNull.null;\n                bool bIsNull = b == NSNull.null;\n                if (aIsNull && bIsNull) {\n                    return 0;\n                }\n                if (aIsNull) {\n                    return 1;\n                }\n                if (bIsNull) {\n                    return -1;\n                }\n\n                if ([a isKindOfClass:[NSData class]]) {\n                    if ([a length] != [b length]) {\n                        return [a length] < [b length] ? -1 : 1;\n                    }\n                    int result = memcmp([a bytes], [b bytes], [a length]);\n                    if (!result) {\n                        return 0;\n                    }\n                    return result < 0 ? -1 : 1;\n                }\n\n                if ([a isKindOfClass:[RLMObjectId class]]) {\n                    int64_t idx1 = [objectIds indexOfObject:a];\n                    int64_t idx2 = [objectIds indexOfObject:b];\n                    return idx1 - idx2;\n                }\n\n                if ([a respondsToSelector:@selector(objCType)]\n                    && [b respondsToSelector:@selector(objCType)]) {\n                    return [a compare:b];\n                } else {\n                    if ([a isKindOfClass:[RLMDecimal128 class]]) {\n                        a = [NSNumber numberWithDouble:[(RLMDecimal128 *)a doubleValue]];\n                    }\n                    if ([b isKindOfClass:[RLMDecimal128 class]]) {\n                        b = [NSNumber numberWithDouble:[(RLMDecimal128 *)b doubleValue]];\n                    }\n                    return [a compare:b];\n                }\n            }];\n}\n\n- (void)testUnionOfObjects {\n    for (RLMArray *array in allArrays) {\n        uncheckedAssertEqualObjects([array valueForKeyPath:@\"@unionOfObjects.self\"], @[]);\n    }\n    for (RLMArray *array in allArrays) {\n        uncheckedAssertEqualObjects([array valueForKeyPath:@\"@distinctUnionOfObjects.self\"], @[]);\n    }\n\n    [self addObjects];\n    [self addObjects];\n\n    uncheckedAssertEqualObjects([unmanaged.boolObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@NO, @YES, @NO, @YES]));\n    uncheckedAssertEqualObjects([unmanaged.intObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@2, @3, @2, @3]));\n    uncheckedAssertEqualObjects([unmanaged.floatObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@2.2f, @3.3f, @2.2f, @3.3f]));\n    uncheckedAssertEqualObjects([unmanaged.doubleObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@2.2, @3.3, @2.2, @3.3]));\n    uncheckedAssertEqualObjects([unmanaged.stringObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@\"a\", @\"b\", @\"a\", @\"b\"]));\n    uncheckedAssertEqualObjects([unmanaged.dataObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[data(1), data(2), data(1), data(2)]));\n    uncheckedAssertEqualObjects([unmanaged.dateObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[date(1), date(2), date(1), date(2)]));\n    uncheckedAssertEqualObjects([unmanaged.decimalObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[decimal128(2), decimal128(3), decimal128(2), decimal128(3)]));\n    uncheckedAssertEqualObjects([unmanaged.objectIdObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[objectId(1), objectId(2), objectId(1), objectId(2)]));\n    uncheckedAssertEqualObjects([unmanaged.uuidObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([unmanaged.anyBoolObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@NO, @YES, @NO, @YES]));\n    uncheckedAssertEqualObjects([unmanaged.anyIntObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@2, @3, @2, @3]));\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@2.2f, @3.3f, @2.2f, @3.3f]));\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@2.2, @3.3, @2.2, @3.3]));\n    uncheckedAssertEqualObjects([unmanaged.anyStringObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@\"a\", @\"b\", @\"a\", @\"b\"]));\n    uncheckedAssertEqualObjects([unmanaged.anyDataObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[data(1), data(2), data(1), data(2)]));\n    uncheckedAssertEqualObjects([unmanaged.anyDateObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[date(1), date(2), date(1), date(2)]));\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[decimal128(2), decimal128(3), decimal128(2), decimal128(3)]));\n    uncheckedAssertEqualObjects([unmanaged.anyObjectIdObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[objectId(1), objectId(2), objectId(1), objectId(2)]));\n    uncheckedAssertEqualObjects([unmanaged.anyUUIDObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([optUnmanaged.boolObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@NO, @YES, NSNull.null, @NO, @YES, NSNull.null]));\n    uncheckedAssertEqualObjects([optUnmanaged.intObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@2, @3, NSNull.null, @2, @3, NSNull.null]));\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@2.2f, @3.3f, NSNull.null, @2.2f, @3.3f, NSNull.null]));\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@2.2, @3.3, NSNull.null, @2.2, @3.3, NSNull.null]));\n    uncheckedAssertEqualObjects([optUnmanaged.stringObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@\"a\", @\"b\", NSNull.null, @\"a\", @\"b\", NSNull.null]));\n    uncheckedAssertEqualObjects([optUnmanaged.dataObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[data(1), data(2), NSNull.null, data(1), data(2), NSNull.null]));\n    uncheckedAssertEqualObjects([optUnmanaged.dateObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[date(1), date(2), NSNull.null, date(1), date(2), NSNull.null]));\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[decimal128(2), decimal128(3), NSNull.null, decimal128(2), decimal128(3), NSNull.null]));\n    uncheckedAssertEqualObjects([optUnmanaged.objectIdObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[objectId(1), objectId(2), NSNull.null, objectId(1), objectId(2), NSNull.null]));\n    uncheckedAssertEqualObjects([optUnmanaged.uuidObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null, uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]));\n    uncheckedAssertEqualObjects([managed.boolObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@NO, @YES, @NO, @YES]));\n    uncheckedAssertEqualObjects([managed.intObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@2, @3, @2, @3]));\n    uncheckedAssertEqualObjects([managed.floatObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@2.2f, @3.3f, @2.2f, @3.3f]));\n    uncheckedAssertEqualObjects([managed.doubleObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@2.2, @3.3, @2.2, @3.3]));\n    uncheckedAssertEqualObjects([managed.stringObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@\"a\", @\"b\", @\"a\", @\"b\"]));\n    uncheckedAssertEqualObjects([managed.dataObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[data(1), data(2), data(1), data(2)]));\n    uncheckedAssertEqualObjects([managed.dateObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[date(1), date(2), date(1), date(2)]));\n    uncheckedAssertEqualObjects([managed.decimalObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[decimal128(2), decimal128(3), decimal128(2), decimal128(3)]));\n    uncheckedAssertEqualObjects([managed.objectIdObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[objectId(1), objectId(2), objectId(1), objectId(2)]));\n    uncheckedAssertEqualObjects([managed.uuidObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([managed.anyBoolObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@NO, @YES, @NO, @YES]));\n    uncheckedAssertEqualObjects([managed.anyIntObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@2, @3, @2, @3]));\n    uncheckedAssertEqualObjects([managed.anyFloatObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@2.2f, @3.3f, @2.2f, @3.3f]));\n    uncheckedAssertEqualObjects([managed.anyDoubleObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@2.2, @3.3, @2.2, @3.3]));\n    uncheckedAssertEqualObjects([managed.anyStringObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@\"a\", @\"b\", @\"a\", @\"b\"]));\n    uncheckedAssertEqualObjects([managed.anyDataObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[data(1), data(2), data(1), data(2)]));\n    uncheckedAssertEqualObjects([managed.anyDateObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[date(1), date(2), date(1), date(2)]));\n    uncheckedAssertEqualObjects([managed.anyDecimalObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[decimal128(2), decimal128(3), decimal128(2), decimal128(3)]));\n    uncheckedAssertEqualObjects([managed.anyObjectIdObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[objectId(1), objectId(2), objectId(1), objectId(2)]));\n    uncheckedAssertEqualObjects([managed.anyUUIDObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([optManaged.boolObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@NO, @YES, NSNull.null, @NO, @YES, NSNull.null]));\n    uncheckedAssertEqualObjects([optManaged.intObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@2, @3, NSNull.null, @2, @3, NSNull.null]));\n    uncheckedAssertEqualObjects([optManaged.floatObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@2.2f, @3.3f, NSNull.null, @2.2f, @3.3f, NSNull.null]));\n    uncheckedAssertEqualObjects([optManaged.doubleObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@2.2, @3.3, NSNull.null, @2.2, @3.3, NSNull.null]));\n    uncheckedAssertEqualObjects([optManaged.stringObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[@\"a\", @\"b\", NSNull.null, @\"a\", @\"b\", NSNull.null]));\n    uncheckedAssertEqualObjects([optManaged.dataObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[data(1), data(2), NSNull.null, data(1), data(2), NSNull.null]));\n    uncheckedAssertEqualObjects([optManaged.dateObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[date(1), date(2), NSNull.null, date(1), date(2), NSNull.null]));\n    uncheckedAssertEqualObjects([optManaged.decimalObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[decimal128(2), decimal128(3), NSNull.null, decimal128(2), decimal128(3), NSNull.null]));\n    uncheckedAssertEqualObjects([optManaged.objectIdObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[objectId(1), objectId(2), NSNull.null, objectId(1), objectId(2), NSNull.null]));\n    uncheckedAssertEqualObjects([optManaged.uuidObj valueForKeyPath:@\"@unionOfObjects.self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null, uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.boolObj, @\"Objects\", @\"self\"),\n                                (@[@NO, @YES]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.intObj, @\"Objects\", @\"self\"),\n                                (@[@2, @3]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.floatObj, @\"Objects\", @\"self\"),\n                                (@[@2.2f, @3.3f]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.doubleObj, @\"Objects\", @\"self\"),\n                                (@[@2.2, @3.3]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.stringObj, @\"Objects\", @\"self\"),\n                                (@[@\"a\", @\"b\"]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.dataObj, @\"Objects\", @\"self\"),\n                                (@[data(1), data(2)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.dateObj, @\"Objects\", @\"self\"),\n                                (@[date(1), date(2)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.decimalObj, @\"Objects\", @\"self\"),\n                                (@[decimal128(2), decimal128(3)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.objectIdObj, @\"Objects\", @\"self\"),\n                                (@[objectId(1), objectId(2)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.uuidObj, @\"Objects\", @\"self\"),\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.anyBoolObj, @\"Objects\", @\"self\"),\n                                (@[@NO, @YES]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.anyIntObj, @\"Objects\", @\"self\"),\n                                (@[@2, @3]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.anyFloatObj, @\"Objects\", @\"self\"),\n                                (@[@2.2f, @3.3f]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.anyDoubleObj, @\"Objects\", @\"self\"),\n                                (@[@2.2, @3.3]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.anyStringObj, @\"Objects\", @\"self\"),\n                                (@[@\"a\", @\"b\"]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.anyDataObj, @\"Objects\", @\"self\"),\n                                (@[data(1), data(2)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.anyDateObj, @\"Objects\", @\"self\"),\n                                (@[date(1), date(2)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.anyDecimalObj, @\"Objects\", @\"self\"),\n                                (@[decimal128(2), decimal128(3)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.anyObjectIdObj, @\"Objects\", @\"self\"),\n                                (@[objectId(1), objectId(2)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(unmanaged.anyUUIDObj, @\"Objects\", @\"self\"),\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optUnmanaged.boolObj, @\"Objects\", @\"self\"),\n                                (@[@NO, @YES, NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optUnmanaged.intObj, @\"Objects\", @\"self\"),\n                                (@[@2, @3, NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optUnmanaged.floatObj, @\"Objects\", @\"self\"),\n                                (@[@2.2f, @3.3f, NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optUnmanaged.doubleObj, @\"Objects\", @\"self\"),\n                                (@[@2.2, @3.3, NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optUnmanaged.stringObj, @\"Objects\", @\"self\"),\n                                (@[@\"a\", @\"b\", NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optUnmanaged.dataObj, @\"Objects\", @\"self\"),\n                                (@[data(1), data(2), NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optUnmanaged.dateObj, @\"Objects\", @\"self\"),\n                                (@[date(1), date(2), NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optUnmanaged.decimalObj, @\"Objects\", @\"self\"),\n                                (@[decimal128(2), decimal128(3), NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optUnmanaged.objectIdObj, @\"Objects\", @\"self\"),\n                                (@[objectId(1), objectId(2), NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optUnmanaged.uuidObj, @\"Objects\", @\"self\"),\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.boolObj, @\"Objects\", @\"self\"),\n                                (@[@NO, @YES]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.intObj, @\"Objects\", @\"self\"),\n                                (@[@2, @3]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.floatObj, @\"Objects\", @\"self\"),\n                                (@[@2.2f, @3.3f]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.doubleObj, @\"Objects\", @\"self\"),\n                                (@[@2.2, @3.3]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.stringObj, @\"Objects\", @\"self\"),\n                                (@[@\"a\", @\"b\"]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.dataObj, @\"Objects\", @\"self\"),\n                                (@[data(1), data(2)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.dateObj, @\"Objects\", @\"self\"),\n                                (@[date(1), date(2)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.decimalObj, @\"Objects\", @\"self\"),\n                                (@[decimal128(2), decimal128(3)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.objectIdObj, @\"Objects\", @\"self\"),\n                                (@[objectId(1), objectId(2)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.uuidObj, @\"Objects\", @\"self\"),\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.anyBoolObj, @\"Objects\", @\"self\"),\n                                (@[@NO, @YES]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.anyIntObj, @\"Objects\", @\"self\"),\n                                (@[@2, @3]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.anyFloatObj, @\"Objects\", @\"self\"),\n                                (@[@2.2f, @3.3f]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.anyDoubleObj, @\"Objects\", @\"self\"),\n                                (@[@2.2, @3.3]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.anyStringObj, @\"Objects\", @\"self\"),\n                                (@[@\"a\", @\"b\"]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.anyDataObj, @\"Objects\", @\"self\"),\n                                (@[data(1), data(2)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.anyDateObj, @\"Objects\", @\"self\"),\n                                (@[date(1), date(2)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.anyDecimalObj, @\"Objects\", @\"self\"),\n                                (@[decimal128(2), decimal128(3)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.anyObjectIdObj, @\"Objects\", @\"self\"),\n                                (@[objectId(1), objectId(2)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(managed.anyUUIDObj, @\"Objects\", @\"self\"),\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optManaged.boolObj, @\"Objects\", @\"self\"),\n                                (@[@NO, @YES, NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optManaged.intObj, @\"Objects\", @\"self\"),\n                                (@[@2, @3, NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optManaged.floatObj, @\"Objects\", @\"self\"),\n                                (@[@2.2f, @3.3f, NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optManaged.doubleObj, @\"Objects\", @\"self\"),\n                                (@[@2.2, @3.3, NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optManaged.stringObj, @\"Objects\", @\"self\"),\n                                (@[@\"a\", @\"b\", NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optManaged.dataObj, @\"Objects\", @\"self\"),\n                                (@[data(1), data(2), NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optManaged.dateObj, @\"Objects\", @\"self\"),\n                                (@[date(1), date(2), NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optManaged.decimalObj, @\"Objects\", @\"self\"),\n                                (@[decimal128(2), decimal128(3), NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optManaged.objectIdObj, @\"Objects\", @\"self\"),\n                                (@[objectId(1), objectId(2), NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(optManaged.uuidObj, @\"Objects\", @\"self\"),\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]));\n}\n\n- (void)testUnionOfArrays {\n    RLMResults *allRequired = [AllPrimitiveArrays allObjectsInRealm:realm];\n    RLMResults *allOptional = [AllOptionalPrimitiveArrays allObjectsInRealm:realm];\n\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.boolObj\"], @[]);\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.intObj\"], @[]);\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.floatObj\"], @[]);\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.doubleObj\"], @[]);\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.stringObj\"], @[]);\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.dataObj\"], @[]);\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.dateObj\"], @[]);\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.decimalObj\"], @[]);\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.objectIdObj\"], @[]);\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.uuidObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.boolObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.intObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.floatObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.doubleObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.stringObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.dataObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.dateObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.decimalObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.objectIdObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.uuidObj\"], @[]);\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.boolObj\"], @[]);\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.intObj\"], @[]);\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.floatObj\"], @[]);\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.doubleObj\"], @[]);\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.stringObj\"], @[]);\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.dataObj\"], @[]);\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.dateObj\"], @[]);\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.decimalObj\"], @[]);\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.objectIdObj\"], @[]);\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.uuidObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@distinctUnionOfArrays.boolObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@distinctUnionOfArrays.intObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@distinctUnionOfArrays.floatObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@distinctUnionOfArrays.doubleObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@distinctUnionOfArrays.stringObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@distinctUnionOfArrays.dataObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@distinctUnionOfArrays.dateObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@distinctUnionOfArrays.decimalObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@distinctUnionOfArrays.objectIdObj\"], @[]);\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@distinctUnionOfArrays.uuidObj\"], @[]);\n\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyBoolObj\"], @[]);\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyIntObj\"], @[]);\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyFloatObj\"], @[]);\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyDoubleObj\"], @[]);\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyStringObj\"], @[]);\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyDataObj\"], @[]);\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyDateObj\"], @[]);\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyDecimalObj\"], @[]);\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyObjectIdObj\"], @[]);\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyUUIDObj\"], @[]);\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.anyBoolObj\"], @[]);\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.anyIntObj\"], @[]);\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.anyFloatObj\"], @[]);\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.anyDoubleObj\"], @[]);\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.anyStringObj\"], @[]);\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.anyDataObj\"], @[]);\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.anyDateObj\"], @[]);\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.anyDecimalObj\"], @[]);\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.anyObjectIdObj\"], @[]);\n    XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.anyUUIDObj\"], @[]);\n\n\n    [self addObjects];\n\n    [AllPrimitiveArrays createInRealm:realm withValue:managed];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:optManaged];\n\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.boolObj\"],\n                                (@[@NO, @YES, @NO, @YES]));\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.intObj\"],\n                                (@[@2, @3, @2, @3]));\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.floatObj\"],\n                                (@[@2.2f, @3.3f, @2.2f, @3.3f]));\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.doubleObj\"],\n                                (@[@2.2, @3.3, @2.2, @3.3]));\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.stringObj\"],\n                                (@[@\"a\", @\"b\", @\"a\", @\"b\"]));\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.dataObj\"],\n                                (@[data(1), data(2), data(1), data(2)]));\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.dateObj\"],\n                                (@[date(1), date(2), date(1), date(2)]));\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.decimalObj\"],\n                                (@[decimal128(2), decimal128(3), decimal128(2), decimal128(3)]));\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.objectIdObj\"],\n                                (@[objectId(1), objectId(2), objectId(1), objectId(2)]));\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.uuidObj\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.boolObj\"],\n                                (@[@NO, @YES, NSNull.null, @NO, @YES, NSNull.null]));\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.intObj\"],\n                                (@[@2, @3, NSNull.null, @2, @3, NSNull.null]));\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.floatObj\"],\n                                (@[@2.2f, @3.3f, NSNull.null, @2.2f, @3.3f, NSNull.null]));\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.doubleObj\"],\n                                (@[@2.2, @3.3, NSNull.null, @2.2, @3.3, NSNull.null]));\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.stringObj\"],\n                                (@[@\"a\", @\"b\", NSNull.null, @\"a\", @\"b\", NSNull.null]));\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.dataObj\"],\n                                (@[data(1), data(2), NSNull.null, data(1), data(2), NSNull.null]));\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.dateObj\"],\n                                (@[date(1), date(2), NSNull.null, date(1), date(2), NSNull.null]));\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.decimalObj\"],\n                                (@[decimal128(2), decimal128(3), NSNull.null, decimal128(2), decimal128(3), NSNull.null]));\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.objectIdObj\"],\n                                (@[objectId(1), objectId(2), NSNull.null, objectId(1), objectId(2), NSNull.null]));\n    uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.uuidObj\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null, uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"boolObj\"),\n                                (@[@NO, @YES]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"intObj\"),\n                                (@[@2, @3]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"floatObj\"),\n                                (@[@2.2f, @3.3f]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"doubleObj\"),\n                                (@[@2.2, @3.3]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"stringObj\"),\n                                (@[@\"a\", @\"b\"]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"dataObj\"),\n                                (@[data(1), data(2)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"dateObj\"),\n                                (@[date(1), date(2)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"decimalObj\"),\n                                (@[decimal128(2), decimal128(3)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"objectIdObj\"),\n                                (@[objectId(1), objectId(2)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"uuidObj\"),\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allOptional, @\"Arrays\", @\"boolObj\"),\n                                (@[@NO, @YES, NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allOptional, @\"Arrays\", @\"intObj\"),\n                                (@[@2, @3, NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allOptional, @\"Arrays\", @\"floatObj\"),\n                                (@[@2.2f, @3.3f, NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allOptional, @\"Arrays\", @\"doubleObj\"),\n                                (@[@2.2, @3.3, NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allOptional, @\"Arrays\", @\"stringObj\"),\n                                (@[@\"a\", @\"b\", NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allOptional, @\"Arrays\", @\"dataObj\"),\n                                (@[data(1), data(2), NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allOptional, @\"Arrays\", @\"dateObj\"),\n                                (@[date(1), date(2), NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allOptional, @\"Arrays\", @\"decimalObj\"),\n                                (@[decimal128(2), decimal128(3), NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allOptional, @\"Arrays\", @\"objectIdObj\"),\n                                (@[objectId(1), objectId(2), NSNull.null]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allOptional, @\"Arrays\", @\"uuidObj\"),\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]));\n\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyBoolObj\"],\n                                (@[@NO, @YES, @NO, @YES]));\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyIntObj\"],\n                                (@[@2, @3, @2, @3]));\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyFloatObj\"],\n                                (@[@2.2f, @3.3f, @2.2f, @3.3f]));\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyDoubleObj\"],\n                                (@[@2.2, @3.3, @2.2, @3.3]));\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyStringObj\"],\n                                (@[@\"a\", @\"b\", @\"a\", @\"b\"]));\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyDataObj\"],\n                                (@[data(1), data(2), data(1), data(2)]));\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyDateObj\"],\n                                (@[date(1), date(2), date(1), date(2)]));\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyDecimalObj\"],\n                                (@[decimal128(2), decimal128(3), decimal128(2), decimal128(3)]));\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyObjectIdObj\"],\n                                (@[objectId(1), objectId(2), objectId(1), objectId(2)]));\n    uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.anyUUIDObj\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"anyBoolObj\"),\n                                (@[@NO, @YES]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"anyIntObj\"),\n                                (@[@2, @3]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"anyFloatObj\"),\n                                (@[@2.2f, @3.3f]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"anyDoubleObj\"),\n                                (@[@2.2, @3.3]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"anyStringObj\"),\n                                (@[@\"a\", @\"b\"]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"anyDataObj\"),\n                                (@[data(1), data(2)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"anyDateObj\"),\n                                (@[date(1), date(2)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"anyDecimalObj\"),\n                                (@[decimal128(2), decimal128(3)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"anyObjectIdObj\"),\n                                (@[objectId(1), objectId(2)]));\n    uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"anyUUIDObj\"),\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n}\n\n- (void)testSetValueForKey {\n    for (RLMArray *array in allArrays) {\n        RLMAssertThrowsWithReason([array setValue:@0 forKey:@\"not self\"],\n                                  @\"this class is not key value coding-compliant for the key not self.\");\n    }\n    RLMAssertThrowsWithReason([unmanaged.boolObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj setValue:@2 forKey:@\"self\"],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj setValue:@2 forKey:@\"self\"],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([managed.boolObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.intObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.floatObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.doubleObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.stringObj setValue:@2 forKey:@\"self\"],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.dataObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dateObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.decimalObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.uuidObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([optManaged.intObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([optManaged.floatObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj setValue:@2 forKey:@\"self\"],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj setValue:@\"a\" forKey:@\"self\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([unmanaged.boolObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([managed.boolObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.intObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.floatObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.doubleObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.stringObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.dataObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dateObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.decimalObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.uuidObj setValue:NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n\n    [self addObjects];\n\n    [unmanaged.boolObj setValue:@NO forKey:@\"self\"];\n    [unmanaged.intObj setValue:@2 forKey:@\"self\"];\n    [unmanaged.floatObj setValue:@2.2f forKey:@\"self\"];\n    [unmanaged.doubleObj setValue:@2.2 forKey:@\"self\"];\n    [unmanaged.stringObj setValue:@\"a\" forKey:@\"self\"];\n    [unmanaged.dataObj setValue:data(1) forKey:@\"self\"];\n    [unmanaged.dateObj setValue:date(1) forKey:@\"self\"];\n    [unmanaged.decimalObj setValue:decimal128(2) forKey:@\"self\"];\n    [unmanaged.objectIdObj setValue:objectId(1) forKey:@\"self\"];\n    [unmanaged.uuidObj setValue:uuid(@\"00000000-0000-0000-0000-000000000000\") forKey:@\"self\"];\n    [unmanaged.anyBoolObj setValue:@NO forKey:@\"self\"];\n    [unmanaged.anyIntObj setValue:@2 forKey:@\"self\"];\n    [unmanaged.anyFloatObj setValue:@2.2f forKey:@\"self\"];\n    [unmanaged.anyDoubleObj setValue:@2.2 forKey:@\"self\"];\n    [unmanaged.anyStringObj setValue:@\"a\" forKey:@\"self\"];\n    [unmanaged.anyDataObj setValue:data(1) forKey:@\"self\"];\n    [unmanaged.anyDateObj setValue:date(1) forKey:@\"self\"];\n    [unmanaged.anyDecimalObj setValue:decimal128(2) forKey:@\"self\"];\n    [unmanaged.anyObjectIdObj setValue:objectId(1) forKey:@\"self\"];\n    [unmanaged.anyUUIDObj setValue:uuid(@\"00000000-0000-0000-0000-000000000000\") forKey:@\"self\"];\n    [optUnmanaged.boolObj setValue:@NO forKey:@\"self\"];\n    [optUnmanaged.intObj setValue:@2 forKey:@\"self\"];\n    [optUnmanaged.floatObj setValue:@2.2f forKey:@\"self\"];\n    [optUnmanaged.doubleObj setValue:@2.2 forKey:@\"self\"];\n    [optUnmanaged.stringObj setValue:@\"a\" forKey:@\"self\"];\n    [optUnmanaged.dataObj setValue:data(1) forKey:@\"self\"];\n    [optUnmanaged.dateObj setValue:date(1) forKey:@\"self\"];\n    [optUnmanaged.decimalObj setValue:decimal128(2) forKey:@\"self\"];\n    [optUnmanaged.objectIdObj setValue:objectId(1) forKey:@\"self\"];\n    [optUnmanaged.uuidObj setValue:uuid(@\"00000000-0000-0000-0000-000000000000\") forKey:@\"self\"];\n    [managed.boolObj setValue:@NO forKey:@\"self\"];\n    [managed.intObj setValue:@2 forKey:@\"self\"];\n    [managed.floatObj setValue:@2.2f forKey:@\"self\"];\n    [managed.doubleObj setValue:@2.2 forKey:@\"self\"];\n    [managed.stringObj setValue:@\"a\" forKey:@\"self\"];\n    [managed.dataObj setValue:data(1) forKey:@\"self\"];\n    [managed.dateObj setValue:date(1) forKey:@\"self\"];\n    [managed.decimalObj setValue:decimal128(2) forKey:@\"self\"];\n    [managed.objectIdObj setValue:objectId(1) forKey:@\"self\"];\n    [managed.uuidObj setValue:uuid(@\"00000000-0000-0000-0000-000000000000\") forKey:@\"self\"];\n    [managed.anyBoolObj setValue:@NO forKey:@\"self\"];\n    [managed.anyIntObj setValue:@2 forKey:@\"self\"];\n    [managed.anyFloatObj setValue:@2.2f forKey:@\"self\"];\n    [managed.anyDoubleObj setValue:@2.2 forKey:@\"self\"];\n    [managed.anyStringObj setValue:@\"a\" forKey:@\"self\"];\n    [managed.anyDataObj setValue:data(1) forKey:@\"self\"];\n    [managed.anyDateObj setValue:date(1) forKey:@\"self\"];\n    [managed.anyDecimalObj setValue:decimal128(2) forKey:@\"self\"];\n    [managed.anyObjectIdObj setValue:objectId(1) forKey:@\"self\"];\n    [managed.anyUUIDObj setValue:uuid(@\"00000000-0000-0000-0000-000000000000\") forKey:@\"self\"];\n    [optManaged.boolObj setValue:@NO forKey:@\"self\"];\n    [optManaged.intObj setValue:@2 forKey:@\"self\"];\n    [optManaged.floatObj setValue:@2.2f forKey:@\"self\"];\n    [optManaged.doubleObj setValue:@2.2 forKey:@\"self\"];\n    [optManaged.stringObj setValue:@\"a\" forKey:@\"self\"];\n    [optManaged.dataObj setValue:data(1) forKey:@\"self\"];\n    [optManaged.dateObj setValue:date(1) forKey:@\"self\"];\n    [optManaged.decimalObj setValue:decimal128(2) forKey:@\"self\"];\n    [optManaged.objectIdObj setValue:objectId(1) forKey:@\"self\"];\n    [optManaged.uuidObj setValue:uuid(@\"00000000-0000-0000-0000-000000000000\") forKey:@\"self\"];\n\n    uncheckedAssertEqualObjects(unmanaged.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(unmanaged.intObj[0], @2);\n    uncheckedAssertEqualObjects(unmanaged.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(unmanaged.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[0], @NO);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[0], @2);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[0], data(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[0], date(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[0], @2);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(managed.intObj[0], @2);\n    uncheckedAssertEqualObjects(managed.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(managed.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(managed.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(managed.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(managed.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(managed.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(managed.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(managed.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[0], @NO);\n    uncheckedAssertEqualObjects(managed.anyIntObj[0], @2);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(managed.anyStringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[0], data(1));\n    uncheckedAssertEqualObjects(managed.anyDateObj[0], date(1));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optManaged.boolObj[0], @NO);\n    uncheckedAssertEqualObjects(optManaged.intObj[0], @2);\n    uncheckedAssertEqualObjects(optManaged.floatObj[0], @2.2f);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[0], @2.2);\n    uncheckedAssertEqualObjects(optManaged.stringObj[0], @\"a\");\n    uncheckedAssertEqualObjects(optManaged.dataObj[0], data(1));\n    uncheckedAssertEqualObjects(optManaged.dateObj[0], date(1));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[0], decimal128(2));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[0], objectId(1));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.boolObj[1], @NO);\n    uncheckedAssertEqualObjects(unmanaged.intObj[1], @2);\n    uncheckedAssertEqualObjects(unmanaged.floatObj[1], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[1], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[1], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.dataObj[1], data(1));\n    uncheckedAssertEqualObjects(unmanaged.dateObj[1], date(1));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[1], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[1], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[1], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[1], @NO);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[1], @2);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[1], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[1], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[1], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[1], data(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[1], date(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[1], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[1], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[1], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[1], @NO);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[1], @2);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[1], @2.2f);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[1], @2.2);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[1], @\"a\");\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[1], data(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[1], date(1));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[1], decimal128(2));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[1], objectId(1));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[1], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.boolObj[1], @NO);\n    uncheckedAssertEqualObjects(managed.intObj[1], @2);\n    uncheckedAssertEqualObjects(managed.floatObj[1], @2.2f);\n    uncheckedAssertEqualObjects(managed.doubleObj[1], @2.2);\n    uncheckedAssertEqualObjects(managed.stringObj[1], @\"a\");\n    uncheckedAssertEqualObjects(managed.dataObj[1], data(1));\n    uncheckedAssertEqualObjects(managed.dateObj[1], date(1));\n    uncheckedAssertEqualObjects(managed.decimalObj[1], decimal128(2));\n    uncheckedAssertEqualObjects(managed.objectIdObj[1], objectId(1));\n    uncheckedAssertEqualObjects(managed.uuidObj[1], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[1], @NO);\n    uncheckedAssertEqualObjects(managed.anyIntObj[1], @2);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[1], @2.2f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[1], @2.2);\n    uncheckedAssertEqualObjects(managed.anyStringObj[1], @\"a\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[1], data(1));\n    uncheckedAssertEqualObjects(managed.anyDateObj[1], date(1));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[1], decimal128(2));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[1], objectId(1));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[1], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optManaged.boolObj[1], @NO);\n    uncheckedAssertEqualObjects(optManaged.intObj[1], @2);\n    uncheckedAssertEqualObjects(optManaged.floatObj[1], @2.2f);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[1], @2.2);\n    uncheckedAssertEqualObjects(optManaged.stringObj[1], @\"a\");\n    uncheckedAssertEqualObjects(optManaged.dataObj[1], data(1));\n    uncheckedAssertEqualObjects(optManaged.dateObj[1], date(1));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[1], decimal128(2));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[1], objectId(1));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[1], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[2], @NO);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[2], @2);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[2], @2.2f);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[2], @2.2);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[2], @\"a\");\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[2], data(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[2], date(1));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[2], decimal128(2));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[2], objectId(1));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[2], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optManaged.boolObj[2], @NO);\n    uncheckedAssertEqualObjects(optManaged.intObj[2], @2);\n    uncheckedAssertEqualObjects(optManaged.floatObj[2], @2.2f);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[2], @2.2);\n    uncheckedAssertEqualObjects(optManaged.stringObj[2], @\"a\");\n    uncheckedAssertEqualObjects(optManaged.dataObj[2], data(1));\n    uncheckedAssertEqualObjects(optManaged.dateObj[2], date(1));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[2], decimal128(2));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[2], objectId(1));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[2], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n\n    [optUnmanaged.boolObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.intObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.floatObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.doubleObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.stringObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.dataObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.dateObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.decimalObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.objectIdObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.uuidObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.boolObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.intObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.floatObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.doubleObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.stringObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.dataObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.dateObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.decimalObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.objectIdObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.uuidObj setValue:NSNull.null forKey:@\"self\"];\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.boolObj[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.intObj[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.floatObj[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.stringObj[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dataObj[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dateObj[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.decimalObj[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.uuidObj[0], NSNull.null);\n}\n\n- (void)testAssignment {\n    unmanaged.boolObj = (id)@[@YES];\n    uncheckedAssertEqualObjects(unmanaged.boolObj[0], @YES);\n    unmanaged.intObj = (id)@[@3];\n    uncheckedAssertEqualObjects(unmanaged.intObj[0], @3);\n    unmanaged.floatObj = (id)@[@3.3f];\n    uncheckedAssertEqualObjects(unmanaged.floatObj[0], @3.3f);\n    unmanaged.doubleObj = (id)@[@3.3];\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[0], @3.3);\n    unmanaged.stringObj = (id)@[@\"b\"];\n    uncheckedAssertEqualObjects(unmanaged.stringObj[0], @\"b\");\n    unmanaged.dataObj = (id)@[data(2)];\n    uncheckedAssertEqualObjects(unmanaged.dataObj[0], data(2));\n    unmanaged.dateObj = (id)@[date(2)];\n    uncheckedAssertEqualObjects(unmanaged.dateObj[0], date(2));\n    unmanaged.decimalObj = (id)@[decimal128(3)];\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[0], decimal128(3));\n    unmanaged.objectIdObj = (id)@[objectId(2)];\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[0], objectId(2));\n    unmanaged.uuidObj = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    unmanaged.anyBoolObj = (id)@[@YES];\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[0], @YES);\n    unmanaged.anyIntObj = (id)@[@3];\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[0], @3);\n    unmanaged.anyFloatObj = (id)@[@3.3f];\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[0], @3.3f);\n    unmanaged.anyDoubleObj = (id)@[@3.3];\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[0], @3.3);\n    unmanaged.anyStringObj = (id)@[@\"b\"];\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[0], @\"b\");\n    unmanaged.anyDataObj = (id)@[data(2)];\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[0], data(2));\n    unmanaged.anyDateObj = (id)@[date(2)];\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[0], date(2));\n    unmanaged.anyDecimalObj = (id)@[decimal128(3)];\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[0], decimal128(3));\n    unmanaged.anyObjectIdObj = (id)@[objectId(2)];\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[0], objectId(2));\n    unmanaged.anyUUIDObj = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    optUnmanaged.boolObj = (id)@[@YES];\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[0], @YES);\n    optUnmanaged.intObj = (id)@[@3];\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[0], @3);\n    optUnmanaged.floatObj = (id)@[@3.3f];\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[0], @3.3f);\n    optUnmanaged.doubleObj = (id)@[@3.3];\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[0], @3.3);\n    optUnmanaged.stringObj = (id)@[@\"b\"];\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[0], @\"b\");\n    optUnmanaged.dataObj = (id)@[data(2)];\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[0], data(2));\n    optUnmanaged.dateObj = (id)@[date(2)];\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[0], date(2));\n    optUnmanaged.decimalObj = (id)@[decimal128(3)];\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[0], decimal128(3));\n    optUnmanaged.objectIdObj = (id)@[objectId(2)];\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[0], objectId(2));\n    optUnmanaged.uuidObj = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    managed.boolObj = (id)@[@YES];\n    uncheckedAssertEqualObjects(managed.boolObj[0], @YES);\n    managed.intObj = (id)@[@3];\n    uncheckedAssertEqualObjects(managed.intObj[0], @3);\n    managed.floatObj = (id)@[@3.3f];\n    uncheckedAssertEqualObjects(managed.floatObj[0], @3.3f);\n    managed.doubleObj = (id)@[@3.3];\n    uncheckedAssertEqualObjects(managed.doubleObj[0], @3.3);\n    managed.stringObj = (id)@[@\"b\"];\n    uncheckedAssertEqualObjects(managed.stringObj[0], @\"b\");\n    managed.dataObj = (id)@[data(2)];\n    uncheckedAssertEqualObjects(managed.dataObj[0], data(2));\n    managed.dateObj = (id)@[date(2)];\n    uncheckedAssertEqualObjects(managed.dateObj[0], date(2));\n    managed.decimalObj = (id)@[decimal128(3)];\n    uncheckedAssertEqualObjects(managed.decimalObj[0], decimal128(3));\n    managed.objectIdObj = (id)@[objectId(2)];\n    uncheckedAssertEqualObjects(managed.objectIdObj[0], objectId(2));\n    managed.uuidObj = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects(managed.uuidObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    managed.anyBoolObj = (id)@[@YES];\n    uncheckedAssertEqualObjects(managed.anyBoolObj[0], @YES);\n    managed.anyIntObj = (id)@[@3];\n    uncheckedAssertEqualObjects(managed.anyIntObj[0], @3);\n    managed.anyFloatObj = (id)@[@3.3f];\n    uncheckedAssertEqualObjects(managed.anyFloatObj[0], @3.3f);\n    managed.anyDoubleObj = (id)@[@3.3];\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[0], @3.3);\n    managed.anyStringObj = (id)@[@\"b\"];\n    uncheckedAssertEqualObjects(managed.anyStringObj[0], @\"b\");\n    managed.anyDataObj = (id)@[data(2)];\n    uncheckedAssertEqualObjects(managed.anyDataObj[0], data(2));\n    managed.anyDateObj = (id)@[date(2)];\n    uncheckedAssertEqualObjects(managed.anyDateObj[0], date(2));\n    managed.anyDecimalObj = (id)@[decimal128(3)];\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[0], decimal128(3));\n    managed.anyObjectIdObj = (id)@[objectId(2)];\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[0], objectId(2));\n    managed.anyUUIDObj = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    optManaged.boolObj = (id)@[@YES];\n    uncheckedAssertEqualObjects(optManaged.boolObj[0], @YES);\n    optManaged.intObj = (id)@[@3];\n    uncheckedAssertEqualObjects(optManaged.intObj[0], @3);\n    optManaged.floatObj = (id)@[@3.3f];\n    uncheckedAssertEqualObjects(optManaged.floatObj[0], @3.3f);\n    optManaged.doubleObj = (id)@[@3.3];\n    uncheckedAssertEqualObjects(optManaged.doubleObj[0], @3.3);\n    optManaged.stringObj = (id)@[@\"b\"];\n    uncheckedAssertEqualObjects(optManaged.stringObj[0], @\"b\");\n    optManaged.dataObj = (id)@[data(2)];\n    uncheckedAssertEqualObjects(optManaged.dataObj[0], data(2));\n    optManaged.dateObj = (id)@[date(2)];\n    uncheckedAssertEqualObjects(optManaged.dateObj[0], date(2));\n    optManaged.decimalObj = (id)@[decimal128(3)];\n    uncheckedAssertEqualObjects(optManaged.decimalObj[0], decimal128(3));\n    optManaged.objectIdObj = (id)@[objectId(2)];\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[0], objectId(2));\n    optManaged.uuidObj = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects(optManaged.uuidObj[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n\n    // Should replace and not append\n    unmanaged.boolObj = (id)@[@NO, @YES];\n    uncheckedAssertEqualObjects([unmanaged.boolObj valueForKey:@\"self\"], (@[@NO, @YES]));\n    \n    unmanaged.intObj = (id)@[@2, @3];\n    uncheckedAssertEqualObjects([unmanaged.intObj valueForKey:@\"self\"], (@[@2, @3]));\n    \n    unmanaged.floatObj = (id)@[@2.2f, @3.3f];\n    uncheckedAssertEqualObjects([unmanaged.floatObj valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    \n    unmanaged.doubleObj = (id)@[@2.2, @3.3];\n    uncheckedAssertEqualObjects([unmanaged.doubleObj valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    \n    unmanaged.stringObj = (id)@[@\"a\", @\"b\"];\n    uncheckedAssertEqualObjects([unmanaged.stringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    \n    unmanaged.dataObj = (id)@[data(1), data(2)];\n    uncheckedAssertEqualObjects([unmanaged.dataObj valueForKey:@\"self\"], (@[data(1), data(2)]));\n    \n    unmanaged.dateObj = (id)@[date(1), date(2)];\n    uncheckedAssertEqualObjects([unmanaged.dateObj valueForKey:@\"self\"], (@[date(1), date(2)]));\n    \n    unmanaged.decimalObj = (id)@[decimal128(2), decimal128(3)];\n    uncheckedAssertEqualObjects([unmanaged.decimalObj valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    \n    unmanaged.objectIdObj = (id)@[objectId(1), objectId(2)];\n    uncheckedAssertEqualObjects([unmanaged.objectIdObj valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    \n    unmanaged.uuidObj = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects([unmanaged.uuidObj valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    \n    unmanaged.anyBoolObj = (id)@[@NO, @YES];\n    uncheckedAssertEqualObjects([unmanaged.anyBoolObj valueForKey:@\"self\"], (@[@NO, @YES]));\n    \n    unmanaged.anyIntObj = (id)@[@2, @3];\n    uncheckedAssertEqualObjects([unmanaged.anyIntObj valueForKey:@\"self\"], (@[@2, @3]));\n    \n    unmanaged.anyFloatObj = (id)@[@2.2f, @3.3f];\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    \n    unmanaged.anyDoubleObj = (id)@[@2.2, @3.3];\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    \n    unmanaged.anyStringObj = (id)@[@\"a\", @\"b\"];\n    uncheckedAssertEqualObjects([unmanaged.anyStringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    \n    unmanaged.anyDataObj = (id)@[data(1), data(2)];\n    uncheckedAssertEqualObjects([unmanaged.anyDataObj valueForKey:@\"self\"], (@[data(1), data(2)]));\n    \n    unmanaged.anyDateObj = (id)@[date(1), date(2)];\n    uncheckedAssertEqualObjects([unmanaged.anyDateObj valueForKey:@\"self\"], (@[date(1), date(2)]));\n    \n    unmanaged.anyDecimalObj = (id)@[decimal128(2), decimal128(3)];\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    \n    unmanaged.anyObjectIdObj = (id)@[objectId(1), objectId(2)];\n    uncheckedAssertEqualObjects([unmanaged.anyObjectIdObj valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    \n    unmanaged.anyUUIDObj = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects([unmanaged.anyUUIDObj valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    \n    optUnmanaged.boolObj = (id)@[@NO, @YES, NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged.boolObj valueForKey:@\"self\"], (@[@NO, @YES, NSNull.null]));\n    \n    optUnmanaged.intObj = (id)@[@2, @3, NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged.intObj valueForKey:@\"self\"], (@[@2, @3, NSNull.null]));\n    \n    optUnmanaged.floatObj = (id)@[@2.2f, @3.3f, NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj valueForKey:@\"self\"], (@[@2.2f, @3.3f, NSNull.null]));\n    \n    optUnmanaged.doubleObj = (id)@[@2.2, @3.3, NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj valueForKey:@\"self\"], (@[@2.2, @3.3, NSNull.null]));\n    \n    optUnmanaged.stringObj = (id)@[@\"a\", @\"b\", NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged.stringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\", NSNull.null]));\n    \n    optUnmanaged.dataObj = (id)@[data(1), data(2), NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged.dataObj valueForKey:@\"self\"], (@[data(1), data(2), NSNull.null]));\n    \n    optUnmanaged.dateObj = (id)@[date(1), date(2), NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged.dateObj valueForKey:@\"self\"], (@[date(1), date(2), NSNull.null]));\n    \n    optUnmanaged.decimalObj = (id)@[decimal128(2), decimal128(3), NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj valueForKey:@\"self\"], (@[decimal128(2), decimal128(3), NSNull.null]));\n    \n    optUnmanaged.objectIdObj = (id)@[objectId(1), objectId(2), NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged.objectIdObj valueForKey:@\"self\"], (@[objectId(1), objectId(2), NSNull.null]));\n    \n    optUnmanaged.uuidObj = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged.uuidObj valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]));\n    \n    managed.boolObj = (id)@[@NO, @YES];\n    uncheckedAssertEqualObjects([managed.boolObj valueForKey:@\"self\"], (@[@NO, @YES]));\n    \n    managed.intObj = (id)@[@2, @3];\n    uncheckedAssertEqualObjects([managed.intObj valueForKey:@\"self\"], (@[@2, @3]));\n    \n    managed.floatObj = (id)@[@2.2f, @3.3f];\n    uncheckedAssertEqualObjects([managed.floatObj valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    \n    managed.doubleObj = (id)@[@2.2, @3.3];\n    uncheckedAssertEqualObjects([managed.doubleObj valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    \n    managed.stringObj = (id)@[@\"a\", @\"b\"];\n    uncheckedAssertEqualObjects([managed.stringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    \n    managed.dataObj = (id)@[data(1), data(2)];\n    uncheckedAssertEqualObjects([managed.dataObj valueForKey:@\"self\"], (@[data(1), data(2)]));\n    \n    managed.dateObj = (id)@[date(1), date(2)];\n    uncheckedAssertEqualObjects([managed.dateObj valueForKey:@\"self\"], (@[date(1), date(2)]));\n    \n    managed.decimalObj = (id)@[decimal128(2), decimal128(3)];\n    uncheckedAssertEqualObjects([managed.decimalObj valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    \n    managed.objectIdObj = (id)@[objectId(1), objectId(2)];\n    uncheckedAssertEqualObjects([managed.objectIdObj valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    \n    managed.uuidObj = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects([managed.uuidObj valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    \n    managed.anyBoolObj = (id)@[@NO, @YES];\n    uncheckedAssertEqualObjects([managed.anyBoolObj valueForKey:@\"self\"], (@[@NO, @YES]));\n    \n    managed.anyIntObj = (id)@[@2, @3];\n    uncheckedAssertEqualObjects([managed.anyIntObj valueForKey:@\"self\"], (@[@2, @3]));\n    \n    managed.anyFloatObj = (id)@[@2.2f, @3.3f];\n    uncheckedAssertEqualObjects([managed.anyFloatObj valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    \n    managed.anyDoubleObj = (id)@[@2.2, @3.3];\n    uncheckedAssertEqualObjects([managed.anyDoubleObj valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    \n    managed.anyStringObj = (id)@[@\"a\", @\"b\"];\n    uncheckedAssertEqualObjects([managed.anyStringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    \n    managed.anyDataObj = (id)@[data(1), data(2)];\n    uncheckedAssertEqualObjects([managed.anyDataObj valueForKey:@\"self\"], (@[data(1), data(2)]));\n    \n    managed.anyDateObj = (id)@[date(1), date(2)];\n    uncheckedAssertEqualObjects([managed.anyDateObj valueForKey:@\"self\"], (@[date(1), date(2)]));\n    \n    managed.anyDecimalObj = (id)@[decimal128(2), decimal128(3)];\n    uncheckedAssertEqualObjects([managed.anyDecimalObj valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    \n    managed.anyObjectIdObj = (id)@[objectId(1), objectId(2)];\n    uncheckedAssertEqualObjects([managed.anyObjectIdObj valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    \n    managed.anyUUIDObj = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects([managed.anyUUIDObj valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    \n    optManaged.boolObj = (id)@[@NO, @YES, NSNull.null];\n    uncheckedAssertEqualObjects([optManaged.boolObj valueForKey:@\"self\"], (@[@NO, @YES, NSNull.null]));\n    \n    optManaged.intObj = (id)@[@2, @3, NSNull.null];\n    uncheckedAssertEqualObjects([optManaged.intObj valueForKey:@\"self\"], (@[@2, @3, NSNull.null]));\n    \n    optManaged.floatObj = (id)@[@2.2f, @3.3f, NSNull.null];\n    uncheckedAssertEqualObjects([optManaged.floatObj valueForKey:@\"self\"], (@[@2.2f, @3.3f, NSNull.null]));\n    \n    optManaged.doubleObj = (id)@[@2.2, @3.3, NSNull.null];\n    uncheckedAssertEqualObjects([optManaged.doubleObj valueForKey:@\"self\"], (@[@2.2, @3.3, NSNull.null]));\n    \n    optManaged.stringObj = (id)@[@\"a\", @\"b\", NSNull.null];\n    uncheckedAssertEqualObjects([optManaged.stringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\", NSNull.null]));\n    \n    optManaged.dataObj = (id)@[data(1), data(2), NSNull.null];\n    uncheckedAssertEqualObjects([optManaged.dataObj valueForKey:@\"self\"], (@[data(1), data(2), NSNull.null]));\n    \n    optManaged.dateObj = (id)@[date(1), date(2), NSNull.null];\n    uncheckedAssertEqualObjects([optManaged.dateObj valueForKey:@\"self\"], (@[date(1), date(2), NSNull.null]));\n    \n    optManaged.decimalObj = (id)@[decimal128(2), decimal128(3), NSNull.null];\n    uncheckedAssertEqualObjects([optManaged.decimalObj valueForKey:@\"self\"], (@[decimal128(2), decimal128(3), NSNull.null]));\n    \n    optManaged.objectIdObj = (id)@[objectId(1), objectId(2), NSNull.null];\n    uncheckedAssertEqualObjects([optManaged.objectIdObj valueForKey:@\"self\"], (@[objectId(1), objectId(2), NSNull.null]));\n    \n    optManaged.uuidObj = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null];\n    uncheckedAssertEqualObjects([optManaged.uuidObj valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]));\n    \n\n    // Should not clear the array\n    unmanaged.boolObj = unmanaged.boolObj;\n    uncheckedAssertEqualObjects([unmanaged.boolObj valueForKey:@\"self\"], (@[@NO, @YES]));\n    \n    unmanaged.intObj = unmanaged.intObj;\n    uncheckedAssertEqualObjects([unmanaged.intObj valueForKey:@\"self\"], (@[@2, @3]));\n    \n    unmanaged.floatObj = unmanaged.floatObj;\n    uncheckedAssertEqualObjects([unmanaged.floatObj valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    \n    unmanaged.doubleObj = unmanaged.doubleObj;\n    uncheckedAssertEqualObjects([unmanaged.doubleObj valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    \n    unmanaged.stringObj = unmanaged.stringObj;\n    uncheckedAssertEqualObjects([unmanaged.stringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    \n    unmanaged.dataObj = unmanaged.dataObj;\n    uncheckedAssertEqualObjects([unmanaged.dataObj valueForKey:@\"self\"], (@[data(1), data(2)]));\n    \n    unmanaged.dateObj = unmanaged.dateObj;\n    uncheckedAssertEqualObjects([unmanaged.dateObj valueForKey:@\"self\"], (@[date(1), date(2)]));\n    \n    unmanaged.decimalObj = unmanaged.decimalObj;\n    uncheckedAssertEqualObjects([unmanaged.decimalObj valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    \n    unmanaged.objectIdObj = unmanaged.objectIdObj;\n    uncheckedAssertEqualObjects([unmanaged.objectIdObj valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    \n    unmanaged.uuidObj = unmanaged.uuidObj;\n    uncheckedAssertEqualObjects([unmanaged.uuidObj valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    \n    unmanaged.anyBoolObj = unmanaged.anyBoolObj;\n    uncheckedAssertEqualObjects([unmanaged.anyBoolObj valueForKey:@\"self\"], (@[@NO, @YES]));\n    \n    unmanaged.anyIntObj = unmanaged.anyIntObj;\n    uncheckedAssertEqualObjects([unmanaged.anyIntObj valueForKey:@\"self\"], (@[@2, @3]));\n    \n    unmanaged.anyFloatObj = unmanaged.anyFloatObj;\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    \n    unmanaged.anyDoubleObj = unmanaged.anyDoubleObj;\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    \n    unmanaged.anyStringObj = unmanaged.anyStringObj;\n    uncheckedAssertEqualObjects([unmanaged.anyStringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    \n    unmanaged.anyDataObj = unmanaged.anyDataObj;\n    uncheckedAssertEqualObjects([unmanaged.anyDataObj valueForKey:@\"self\"], (@[data(1), data(2)]));\n    \n    unmanaged.anyDateObj = unmanaged.anyDateObj;\n    uncheckedAssertEqualObjects([unmanaged.anyDateObj valueForKey:@\"self\"], (@[date(1), date(2)]));\n    \n    unmanaged.anyDecimalObj = unmanaged.anyDecimalObj;\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    \n    unmanaged.anyObjectIdObj = unmanaged.anyObjectIdObj;\n    uncheckedAssertEqualObjects([unmanaged.anyObjectIdObj valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    \n    unmanaged.anyUUIDObj = unmanaged.anyUUIDObj;\n    uncheckedAssertEqualObjects([unmanaged.anyUUIDObj valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    \n    optUnmanaged.boolObj = optUnmanaged.boolObj;\n    uncheckedAssertEqualObjects([optUnmanaged.boolObj valueForKey:@\"self\"], (@[@NO, @YES, NSNull.null]));\n    \n    optUnmanaged.intObj = optUnmanaged.intObj;\n    uncheckedAssertEqualObjects([optUnmanaged.intObj valueForKey:@\"self\"], (@[@2, @3, NSNull.null]));\n    \n    optUnmanaged.floatObj = optUnmanaged.floatObj;\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj valueForKey:@\"self\"], (@[@2.2f, @3.3f, NSNull.null]));\n    \n    optUnmanaged.doubleObj = optUnmanaged.doubleObj;\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj valueForKey:@\"self\"], (@[@2.2, @3.3, NSNull.null]));\n    \n    optUnmanaged.stringObj = optUnmanaged.stringObj;\n    uncheckedAssertEqualObjects([optUnmanaged.stringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\", NSNull.null]));\n    \n    optUnmanaged.dataObj = optUnmanaged.dataObj;\n    uncheckedAssertEqualObjects([optUnmanaged.dataObj valueForKey:@\"self\"], (@[data(1), data(2), NSNull.null]));\n    \n    optUnmanaged.dateObj = optUnmanaged.dateObj;\n    uncheckedAssertEqualObjects([optUnmanaged.dateObj valueForKey:@\"self\"], (@[date(1), date(2), NSNull.null]));\n    \n    optUnmanaged.decimalObj = optUnmanaged.decimalObj;\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj valueForKey:@\"self\"], (@[decimal128(2), decimal128(3), NSNull.null]));\n    \n    optUnmanaged.objectIdObj = optUnmanaged.objectIdObj;\n    uncheckedAssertEqualObjects([optUnmanaged.objectIdObj valueForKey:@\"self\"], (@[objectId(1), objectId(2), NSNull.null]));\n    \n    optUnmanaged.uuidObj = optUnmanaged.uuidObj;\n    uncheckedAssertEqualObjects([optUnmanaged.uuidObj valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]));\n    \n    managed.boolObj = managed.boolObj;\n    uncheckedAssertEqualObjects([managed.boolObj valueForKey:@\"self\"], (@[@NO, @YES]));\n    \n    managed.intObj = managed.intObj;\n    uncheckedAssertEqualObjects([managed.intObj valueForKey:@\"self\"], (@[@2, @3]));\n    \n    managed.floatObj = managed.floatObj;\n    uncheckedAssertEqualObjects([managed.floatObj valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    \n    managed.doubleObj = managed.doubleObj;\n    uncheckedAssertEqualObjects([managed.doubleObj valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    \n    managed.stringObj = managed.stringObj;\n    uncheckedAssertEqualObjects([managed.stringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    \n    managed.dataObj = managed.dataObj;\n    uncheckedAssertEqualObjects([managed.dataObj valueForKey:@\"self\"], (@[data(1), data(2)]));\n    \n    managed.dateObj = managed.dateObj;\n    uncheckedAssertEqualObjects([managed.dateObj valueForKey:@\"self\"], (@[date(1), date(2)]));\n    \n    managed.decimalObj = managed.decimalObj;\n    uncheckedAssertEqualObjects([managed.decimalObj valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    \n    managed.objectIdObj = managed.objectIdObj;\n    uncheckedAssertEqualObjects([managed.objectIdObj valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    \n    managed.uuidObj = managed.uuidObj;\n    uncheckedAssertEqualObjects([managed.uuidObj valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    \n    managed.anyBoolObj = managed.anyBoolObj;\n    uncheckedAssertEqualObjects([managed.anyBoolObj valueForKey:@\"self\"], (@[@NO, @YES]));\n    \n    managed.anyIntObj = managed.anyIntObj;\n    uncheckedAssertEqualObjects([managed.anyIntObj valueForKey:@\"self\"], (@[@2, @3]));\n    \n    managed.anyFloatObj = managed.anyFloatObj;\n    uncheckedAssertEqualObjects([managed.anyFloatObj valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    \n    managed.anyDoubleObj = managed.anyDoubleObj;\n    uncheckedAssertEqualObjects([managed.anyDoubleObj valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    \n    managed.anyStringObj = managed.anyStringObj;\n    uncheckedAssertEqualObjects([managed.anyStringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    \n    managed.anyDataObj = managed.anyDataObj;\n    uncheckedAssertEqualObjects([managed.anyDataObj valueForKey:@\"self\"], (@[data(1), data(2)]));\n    \n    managed.anyDateObj = managed.anyDateObj;\n    uncheckedAssertEqualObjects([managed.anyDateObj valueForKey:@\"self\"], (@[date(1), date(2)]));\n    \n    managed.anyDecimalObj = managed.anyDecimalObj;\n    uncheckedAssertEqualObjects([managed.anyDecimalObj valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    \n    managed.anyObjectIdObj = managed.anyObjectIdObj;\n    uncheckedAssertEqualObjects([managed.anyObjectIdObj valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    \n    managed.anyUUIDObj = managed.anyUUIDObj;\n    uncheckedAssertEqualObjects([managed.anyUUIDObj valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    \n    optManaged.boolObj = optManaged.boolObj;\n    uncheckedAssertEqualObjects([optManaged.boolObj valueForKey:@\"self\"], (@[@NO, @YES, NSNull.null]));\n    \n    optManaged.intObj = optManaged.intObj;\n    uncheckedAssertEqualObjects([optManaged.intObj valueForKey:@\"self\"], (@[@2, @3, NSNull.null]));\n    \n    optManaged.floatObj = optManaged.floatObj;\n    uncheckedAssertEqualObjects([optManaged.floatObj valueForKey:@\"self\"], (@[@2.2f, @3.3f, NSNull.null]));\n    \n    optManaged.doubleObj = optManaged.doubleObj;\n    uncheckedAssertEqualObjects([optManaged.doubleObj valueForKey:@\"self\"], (@[@2.2, @3.3, NSNull.null]));\n    \n    optManaged.stringObj = optManaged.stringObj;\n    uncheckedAssertEqualObjects([optManaged.stringObj valueForKey:@\"self\"], (@[@\"a\", @\"b\", NSNull.null]));\n    \n    optManaged.dataObj = optManaged.dataObj;\n    uncheckedAssertEqualObjects([optManaged.dataObj valueForKey:@\"self\"], (@[data(1), data(2), NSNull.null]));\n    \n    optManaged.dateObj = optManaged.dateObj;\n    uncheckedAssertEqualObjects([optManaged.dateObj valueForKey:@\"self\"], (@[date(1), date(2), NSNull.null]));\n    \n    optManaged.decimalObj = optManaged.decimalObj;\n    uncheckedAssertEqualObjects([optManaged.decimalObj valueForKey:@\"self\"], (@[decimal128(2), decimal128(3), NSNull.null]));\n    \n    optManaged.objectIdObj = optManaged.objectIdObj;\n    uncheckedAssertEqualObjects([optManaged.objectIdObj valueForKey:@\"self\"], (@[objectId(1), objectId(2), NSNull.null]));\n    \n    optManaged.uuidObj = optManaged.uuidObj;\n    uncheckedAssertEqualObjects([optManaged.uuidObj valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]));\n    \n\n    [unmanaged.intObj removeAllObjects];\n    unmanaged.intObj = managed.intObj;\n    uncheckedAssertEqualObjects([unmanaged.intObj valueForKey:@\"self\"], (@[@2, @3]));\n\n    [managed.intObj removeAllObjects];\n    managed.intObj = unmanaged.intObj;\n    uncheckedAssertEqualObjects([managed.intObj valueForKey:@\"self\"], (@[@2, @3]));\n}\n\n- (void)testDynamicAssignment {\n    unmanaged[@\"boolObj\"] = (id)@[@YES];\n    uncheckedAssertEqualObjects(unmanaged[@\"boolObj\"][0], @YES);\n    unmanaged[@\"intObj\"] = (id)@[@3];\n    uncheckedAssertEqualObjects(unmanaged[@\"intObj\"][0], @3);\n    unmanaged[@\"floatObj\"] = (id)@[@3.3f];\n    uncheckedAssertEqualObjects(unmanaged[@\"floatObj\"][0], @3.3f);\n    unmanaged[@\"doubleObj\"] = (id)@[@3.3];\n    uncheckedAssertEqualObjects(unmanaged[@\"doubleObj\"][0], @3.3);\n    unmanaged[@\"stringObj\"] = (id)@[@\"b\"];\n    uncheckedAssertEqualObjects(unmanaged[@\"stringObj\"][0], @\"b\");\n    unmanaged[@\"dataObj\"] = (id)@[data(2)];\n    uncheckedAssertEqualObjects(unmanaged[@\"dataObj\"][0], data(2));\n    unmanaged[@\"dateObj\"] = (id)@[date(2)];\n    uncheckedAssertEqualObjects(unmanaged[@\"dateObj\"][0], date(2));\n    unmanaged[@\"decimalObj\"] = (id)@[decimal128(3)];\n    uncheckedAssertEqualObjects(unmanaged[@\"decimalObj\"][0], decimal128(3));\n    unmanaged[@\"objectIdObj\"] = (id)@[objectId(2)];\n    uncheckedAssertEqualObjects(unmanaged[@\"objectIdObj\"][0], objectId(2));\n    unmanaged[@\"uuidObj\"] = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects(unmanaged[@\"uuidObj\"][0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    unmanaged[@\"anyBoolObj\"] = (id)@[@YES];\n    uncheckedAssertEqualObjects(unmanaged[@\"anyBoolObj\"][0], @YES);\n    unmanaged[@\"anyIntObj\"] = (id)@[@3];\n    uncheckedAssertEqualObjects(unmanaged[@\"anyIntObj\"][0], @3);\n    unmanaged[@\"anyFloatObj\"] = (id)@[@3.3f];\n    uncheckedAssertEqualObjects(unmanaged[@\"anyFloatObj\"][0], @3.3f);\n    unmanaged[@\"anyDoubleObj\"] = (id)@[@3.3];\n    uncheckedAssertEqualObjects(unmanaged[@\"anyDoubleObj\"][0], @3.3);\n    unmanaged[@\"anyStringObj\"] = (id)@[@\"b\"];\n    uncheckedAssertEqualObjects(unmanaged[@\"anyStringObj\"][0], @\"b\");\n    unmanaged[@\"anyDataObj\"] = (id)@[data(2)];\n    uncheckedAssertEqualObjects(unmanaged[@\"anyDataObj\"][0], data(2));\n    unmanaged[@\"anyDateObj\"] = (id)@[date(2)];\n    uncheckedAssertEqualObjects(unmanaged[@\"anyDateObj\"][0], date(2));\n    unmanaged[@\"anyDecimalObj\"] = (id)@[decimal128(3)];\n    uncheckedAssertEqualObjects(unmanaged[@\"anyDecimalObj\"][0], decimal128(3));\n    unmanaged[@\"anyObjectIdObj\"] = (id)@[objectId(2)];\n    uncheckedAssertEqualObjects(unmanaged[@\"anyObjectIdObj\"][0], objectId(2));\n    unmanaged[@\"anyUUIDObj\"] = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects(unmanaged[@\"anyUUIDObj\"][0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    optUnmanaged[@\"boolObj\"] = (id)@[@YES];\n    uncheckedAssertEqualObjects(optUnmanaged[@\"boolObj\"][0], @YES);\n    optUnmanaged[@\"intObj\"] = (id)@[@3];\n    uncheckedAssertEqualObjects(optUnmanaged[@\"intObj\"][0], @3);\n    optUnmanaged[@\"floatObj\"] = (id)@[@3.3f];\n    uncheckedAssertEqualObjects(optUnmanaged[@\"floatObj\"][0], @3.3f);\n    optUnmanaged[@\"doubleObj\"] = (id)@[@3.3];\n    uncheckedAssertEqualObjects(optUnmanaged[@\"doubleObj\"][0], @3.3);\n    optUnmanaged[@\"stringObj\"] = (id)@[@\"b\"];\n    uncheckedAssertEqualObjects(optUnmanaged[@\"stringObj\"][0], @\"b\");\n    optUnmanaged[@\"dataObj\"] = (id)@[data(2)];\n    uncheckedAssertEqualObjects(optUnmanaged[@\"dataObj\"][0], data(2));\n    optUnmanaged[@\"dateObj\"] = (id)@[date(2)];\n    uncheckedAssertEqualObjects(optUnmanaged[@\"dateObj\"][0], date(2));\n    optUnmanaged[@\"decimalObj\"] = (id)@[decimal128(3)];\n    uncheckedAssertEqualObjects(optUnmanaged[@\"decimalObj\"][0], decimal128(3));\n    optUnmanaged[@\"objectIdObj\"] = (id)@[objectId(2)];\n    uncheckedAssertEqualObjects(optUnmanaged[@\"objectIdObj\"][0], objectId(2));\n    optUnmanaged[@\"uuidObj\"] = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects(optUnmanaged[@\"uuidObj\"][0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    managed[@\"boolObj\"] = (id)@[@YES];\n    uncheckedAssertEqualObjects(managed[@\"boolObj\"][0], @YES);\n    managed[@\"intObj\"] = (id)@[@3];\n    uncheckedAssertEqualObjects(managed[@\"intObj\"][0], @3);\n    managed[@\"floatObj\"] = (id)@[@3.3f];\n    uncheckedAssertEqualObjects(managed[@\"floatObj\"][0], @3.3f);\n    managed[@\"doubleObj\"] = (id)@[@3.3];\n    uncheckedAssertEqualObjects(managed[@\"doubleObj\"][0], @3.3);\n    managed[@\"stringObj\"] = (id)@[@\"b\"];\n    uncheckedAssertEqualObjects(managed[@\"stringObj\"][0], @\"b\");\n    managed[@\"dataObj\"] = (id)@[data(2)];\n    uncheckedAssertEqualObjects(managed[@\"dataObj\"][0], data(2));\n    managed[@\"dateObj\"] = (id)@[date(2)];\n    uncheckedAssertEqualObjects(managed[@\"dateObj\"][0], date(2));\n    managed[@\"decimalObj\"] = (id)@[decimal128(3)];\n    uncheckedAssertEqualObjects(managed[@\"decimalObj\"][0], decimal128(3));\n    managed[@\"objectIdObj\"] = (id)@[objectId(2)];\n    uncheckedAssertEqualObjects(managed[@\"objectIdObj\"][0], objectId(2));\n    managed[@\"uuidObj\"] = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects(managed[@\"uuidObj\"][0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    managed[@\"anyBoolObj\"] = (id)@[@YES];\n    uncheckedAssertEqualObjects(managed[@\"anyBoolObj\"][0], @YES);\n    managed[@\"anyIntObj\"] = (id)@[@3];\n    uncheckedAssertEqualObjects(managed[@\"anyIntObj\"][0], @3);\n    managed[@\"anyFloatObj\"] = (id)@[@3.3f];\n    uncheckedAssertEqualObjects(managed[@\"anyFloatObj\"][0], @3.3f);\n    managed[@\"anyDoubleObj\"] = (id)@[@3.3];\n    uncheckedAssertEqualObjects(managed[@\"anyDoubleObj\"][0], @3.3);\n    managed[@\"anyStringObj\"] = (id)@[@\"b\"];\n    uncheckedAssertEqualObjects(managed[@\"anyStringObj\"][0], @\"b\");\n    managed[@\"anyDataObj\"] = (id)@[data(2)];\n    uncheckedAssertEqualObjects(managed[@\"anyDataObj\"][0], data(2));\n    managed[@\"anyDateObj\"] = (id)@[date(2)];\n    uncheckedAssertEqualObjects(managed[@\"anyDateObj\"][0], date(2));\n    managed[@\"anyDecimalObj\"] = (id)@[decimal128(3)];\n    uncheckedAssertEqualObjects(managed[@\"anyDecimalObj\"][0], decimal128(3));\n    managed[@\"anyObjectIdObj\"] = (id)@[objectId(2)];\n    uncheckedAssertEqualObjects(managed[@\"anyObjectIdObj\"][0], objectId(2));\n    managed[@\"anyUUIDObj\"] = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects(managed[@\"anyUUIDObj\"][0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    optManaged[@\"boolObj\"] = (id)@[@YES];\n    uncheckedAssertEqualObjects(optManaged[@\"boolObj\"][0], @YES);\n    optManaged[@\"intObj\"] = (id)@[@3];\n    uncheckedAssertEqualObjects(optManaged[@\"intObj\"][0], @3);\n    optManaged[@\"floatObj\"] = (id)@[@3.3f];\n    uncheckedAssertEqualObjects(optManaged[@\"floatObj\"][0], @3.3f);\n    optManaged[@\"doubleObj\"] = (id)@[@3.3];\n    uncheckedAssertEqualObjects(optManaged[@\"doubleObj\"][0], @3.3);\n    optManaged[@\"stringObj\"] = (id)@[@\"b\"];\n    uncheckedAssertEqualObjects(optManaged[@\"stringObj\"][0], @\"b\");\n    optManaged[@\"dataObj\"] = (id)@[data(2)];\n    uncheckedAssertEqualObjects(optManaged[@\"dataObj\"][0], data(2));\n    optManaged[@\"dateObj\"] = (id)@[date(2)];\n    uncheckedAssertEqualObjects(optManaged[@\"dateObj\"][0], date(2));\n    optManaged[@\"decimalObj\"] = (id)@[decimal128(3)];\n    uncheckedAssertEqualObjects(optManaged[@\"decimalObj\"][0], decimal128(3));\n    optManaged[@\"objectIdObj\"] = (id)@[objectId(2)];\n    uncheckedAssertEqualObjects(optManaged[@\"objectIdObj\"][0], objectId(2));\n    optManaged[@\"uuidObj\"] = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects(optManaged[@\"uuidObj\"][0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n\n    // Should replace and not append\n    unmanaged[@\"boolObj\"] = (id)@[@NO, @YES];\n    uncheckedAssertEqualObjects([unmanaged[@\"boolObj\"] valueForKey:@\"self\"], (@[@NO, @YES]));\n    \n    unmanaged[@\"intObj\"] = (id)@[@2, @3];\n    uncheckedAssertEqualObjects([unmanaged[@\"intObj\"] valueForKey:@\"self\"], (@[@2, @3]));\n    \n    unmanaged[@\"floatObj\"] = (id)@[@2.2f, @3.3f];\n    uncheckedAssertEqualObjects([unmanaged[@\"floatObj\"] valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    \n    unmanaged[@\"doubleObj\"] = (id)@[@2.2, @3.3];\n    uncheckedAssertEqualObjects([unmanaged[@\"doubleObj\"] valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    \n    unmanaged[@\"stringObj\"] = (id)@[@\"a\", @\"b\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"stringObj\"] valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    \n    unmanaged[@\"dataObj\"] = (id)@[data(1), data(2)];\n    uncheckedAssertEqualObjects([unmanaged[@\"dataObj\"] valueForKey:@\"self\"], (@[data(1), data(2)]));\n    \n    unmanaged[@\"dateObj\"] = (id)@[date(1), date(2)];\n    uncheckedAssertEqualObjects([unmanaged[@\"dateObj\"] valueForKey:@\"self\"], (@[date(1), date(2)]));\n    \n    unmanaged[@\"decimalObj\"] = (id)@[decimal128(2), decimal128(3)];\n    uncheckedAssertEqualObjects([unmanaged[@\"decimalObj\"] valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    \n    unmanaged[@\"objectIdObj\"] = (id)@[objectId(1), objectId(2)];\n    uncheckedAssertEqualObjects([unmanaged[@\"objectIdObj\"] valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    \n    unmanaged[@\"uuidObj\"] = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects([unmanaged[@\"uuidObj\"] valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    \n    unmanaged[@\"anyBoolObj\"] = (id)@[@NO, @YES];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyBoolObj\"] valueForKey:@\"self\"], (@[@NO, @YES]));\n    \n    unmanaged[@\"anyIntObj\"] = (id)@[@2, @3];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyIntObj\"] valueForKey:@\"self\"], (@[@2, @3]));\n    \n    unmanaged[@\"anyFloatObj\"] = (id)@[@2.2f, @3.3f];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyFloatObj\"] valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    \n    unmanaged[@\"anyDoubleObj\"] = (id)@[@2.2, @3.3];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyDoubleObj\"] valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    \n    unmanaged[@\"anyStringObj\"] = (id)@[@\"a\", @\"b\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyStringObj\"] valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    \n    unmanaged[@\"anyDataObj\"] = (id)@[data(1), data(2)];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyDataObj\"] valueForKey:@\"self\"], (@[data(1), data(2)]));\n    \n    unmanaged[@\"anyDateObj\"] = (id)@[date(1), date(2)];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyDateObj\"] valueForKey:@\"self\"], (@[date(1), date(2)]));\n    \n    unmanaged[@\"anyDecimalObj\"] = (id)@[decimal128(2), decimal128(3)];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyDecimalObj\"] valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    \n    unmanaged[@\"anyObjectIdObj\"] = (id)@[objectId(1), objectId(2)];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyObjectIdObj\"] valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    \n    unmanaged[@\"anyUUIDObj\"] = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyUUIDObj\"] valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    \n    optUnmanaged[@\"boolObj\"] = (id)@[@NO, @YES, NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"boolObj\"] valueForKey:@\"self\"], (@[@NO, @YES, NSNull.null]));\n    \n    optUnmanaged[@\"intObj\"] = (id)@[@2, @3, NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"intObj\"] valueForKey:@\"self\"], (@[@2, @3, NSNull.null]));\n    \n    optUnmanaged[@\"floatObj\"] = (id)@[@2.2f, @3.3f, NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"floatObj\"] valueForKey:@\"self\"], (@[@2.2f, @3.3f, NSNull.null]));\n    \n    optUnmanaged[@\"doubleObj\"] = (id)@[@2.2, @3.3, NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"doubleObj\"] valueForKey:@\"self\"], (@[@2.2, @3.3, NSNull.null]));\n    \n    optUnmanaged[@\"stringObj\"] = (id)@[@\"a\", @\"b\", NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"stringObj\"] valueForKey:@\"self\"], (@[@\"a\", @\"b\", NSNull.null]));\n    \n    optUnmanaged[@\"dataObj\"] = (id)@[data(1), data(2), NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"dataObj\"] valueForKey:@\"self\"], (@[data(1), data(2), NSNull.null]));\n    \n    optUnmanaged[@\"dateObj\"] = (id)@[date(1), date(2), NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"dateObj\"] valueForKey:@\"self\"], (@[date(1), date(2), NSNull.null]));\n    \n    optUnmanaged[@\"decimalObj\"] = (id)@[decimal128(2), decimal128(3), NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"decimalObj\"] valueForKey:@\"self\"], (@[decimal128(2), decimal128(3), NSNull.null]));\n    \n    optUnmanaged[@\"objectIdObj\"] = (id)@[objectId(1), objectId(2), NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"objectIdObj\"] valueForKey:@\"self\"], (@[objectId(1), objectId(2), NSNull.null]));\n    \n    optUnmanaged[@\"uuidObj\"] = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"uuidObj\"] valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]));\n    \n    managed[@\"boolObj\"] = (id)@[@NO, @YES];\n    uncheckedAssertEqualObjects([managed[@\"boolObj\"] valueForKey:@\"self\"], (@[@NO, @YES]));\n    \n    managed[@\"intObj\"] = (id)@[@2, @3];\n    uncheckedAssertEqualObjects([managed[@\"intObj\"] valueForKey:@\"self\"], (@[@2, @3]));\n    \n    managed[@\"floatObj\"] = (id)@[@2.2f, @3.3f];\n    uncheckedAssertEqualObjects([managed[@\"floatObj\"] valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    \n    managed[@\"doubleObj\"] = (id)@[@2.2, @3.3];\n    uncheckedAssertEqualObjects([managed[@\"doubleObj\"] valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    \n    managed[@\"stringObj\"] = (id)@[@\"a\", @\"b\"];\n    uncheckedAssertEqualObjects([managed[@\"stringObj\"] valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    \n    managed[@\"dataObj\"] = (id)@[data(1), data(2)];\n    uncheckedAssertEqualObjects([managed[@\"dataObj\"] valueForKey:@\"self\"], (@[data(1), data(2)]));\n    \n    managed[@\"dateObj\"] = (id)@[date(1), date(2)];\n    uncheckedAssertEqualObjects([managed[@\"dateObj\"] valueForKey:@\"self\"], (@[date(1), date(2)]));\n    \n    managed[@\"decimalObj\"] = (id)@[decimal128(2), decimal128(3)];\n    uncheckedAssertEqualObjects([managed[@\"decimalObj\"] valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    \n    managed[@\"objectIdObj\"] = (id)@[objectId(1), objectId(2)];\n    uncheckedAssertEqualObjects([managed[@\"objectIdObj\"] valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    \n    managed[@\"uuidObj\"] = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects([managed[@\"uuidObj\"] valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    \n    managed[@\"anyBoolObj\"] = (id)@[@NO, @YES];\n    uncheckedAssertEqualObjects([managed[@\"anyBoolObj\"] valueForKey:@\"self\"], (@[@NO, @YES]));\n    \n    managed[@\"anyIntObj\"] = (id)@[@2, @3];\n    uncheckedAssertEqualObjects([managed[@\"anyIntObj\"] valueForKey:@\"self\"], (@[@2, @3]));\n    \n    managed[@\"anyFloatObj\"] = (id)@[@2.2f, @3.3f];\n    uncheckedAssertEqualObjects([managed[@\"anyFloatObj\"] valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    \n    managed[@\"anyDoubleObj\"] = (id)@[@2.2, @3.3];\n    uncheckedAssertEqualObjects([managed[@\"anyDoubleObj\"] valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    \n    managed[@\"anyStringObj\"] = (id)@[@\"a\", @\"b\"];\n    uncheckedAssertEqualObjects([managed[@\"anyStringObj\"] valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    \n    managed[@\"anyDataObj\"] = (id)@[data(1), data(2)];\n    uncheckedAssertEqualObjects([managed[@\"anyDataObj\"] valueForKey:@\"self\"], (@[data(1), data(2)]));\n    \n    managed[@\"anyDateObj\"] = (id)@[date(1), date(2)];\n    uncheckedAssertEqualObjects([managed[@\"anyDateObj\"] valueForKey:@\"self\"], (@[date(1), date(2)]));\n    \n    managed[@\"anyDecimalObj\"] = (id)@[decimal128(2), decimal128(3)];\n    uncheckedAssertEqualObjects([managed[@\"anyDecimalObj\"] valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    \n    managed[@\"anyObjectIdObj\"] = (id)@[objectId(1), objectId(2)];\n    uncheckedAssertEqualObjects([managed[@\"anyObjectIdObj\"] valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    \n    managed[@\"anyUUIDObj\"] = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    uncheckedAssertEqualObjects([managed[@\"anyUUIDObj\"] valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    \n    optManaged[@\"boolObj\"] = (id)@[@NO, @YES, NSNull.null];\n    uncheckedAssertEqualObjects([optManaged[@\"boolObj\"] valueForKey:@\"self\"], (@[@NO, @YES, NSNull.null]));\n    \n    optManaged[@\"intObj\"] = (id)@[@2, @3, NSNull.null];\n    uncheckedAssertEqualObjects([optManaged[@\"intObj\"] valueForKey:@\"self\"], (@[@2, @3, NSNull.null]));\n    \n    optManaged[@\"floatObj\"] = (id)@[@2.2f, @3.3f, NSNull.null];\n    uncheckedAssertEqualObjects([optManaged[@\"floatObj\"] valueForKey:@\"self\"], (@[@2.2f, @3.3f, NSNull.null]));\n    \n    optManaged[@\"doubleObj\"] = (id)@[@2.2, @3.3, NSNull.null];\n    uncheckedAssertEqualObjects([optManaged[@\"doubleObj\"] valueForKey:@\"self\"], (@[@2.2, @3.3, NSNull.null]));\n    \n    optManaged[@\"stringObj\"] = (id)@[@\"a\", @\"b\", NSNull.null];\n    uncheckedAssertEqualObjects([optManaged[@\"stringObj\"] valueForKey:@\"self\"], (@[@\"a\", @\"b\", NSNull.null]));\n    \n    optManaged[@\"dataObj\"] = (id)@[data(1), data(2), NSNull.null];\n    uncheckedAssertEqualObjects([optManaged[@\"dataObj\"] valueForKey:@\"self\"], (@[data(1), data(2), NSNull.null]));\n    \n    optManaged[@\"dateObj\"] = (id)@[date(1), date(2), NSNull.null];\n    uncheckedAssertEqualObjects([optManaged[@\"dateObj\"] valueForKey:@\"self\"], (@[date(1), date(2), NSNull.null]));\n    \n    optManaged[@\"decimalObj\"] = (id)@[decimal128(2), decimal128(3), NSNull.null];\n    uncheckedAssertEqualObjects([optManaged[@\"decimalObj\"] valueForKey:@\"self\"], (@[decimal128(2), decimal128(3), NSNull.null]));\n    \n    optManaged[@\"objectIdObj\"] = (id)@[objectId(1), objectId(2), NSNull.null];\n    uncheckedAssertEqualObjects([optManaged[@\"objectIdObj\"] valueForKey:@\"self\"], (@[objectId(1), objectId(2), NSNull.null]));\n    \n    optManaged[@\"uuidObj\"] = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null];\n    uncheckedAssertEqualObjects([optManaged[@\"uuidObj\"] valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]));\n    \n\n    // Should not clear the array\n    unmanaged[@\"boolObj\"] = unmanaged[@\"boolObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"boolObj\"] valueForKey:@\"self\"], (@[@NO, @YES]));\n    \n    unmanaged[@\"intObj\"] = unmanaged[@\"intObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"intObj\"] valueForKey:@\"self\"], (@[@2, @3]));\n    \n    unmanaged[@\"floatObj\"] = unmanaged[@\"floatObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"floatObj\"] valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    \n    unmanaged[@\"doubleObj\"] = unmanaged[@\"doubleObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"doubleObj\"] valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    \n    unmanaged[@\"stringObj\"] = unmanaged[@\"stringObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"stringObj\"] valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    \n    unmanaged[@\"dataObj\"] = unmanaged[@\"dataObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"dataObj\"] valueForKey:@\"self\"], (@[data(1), data(2)]));\n    \n    unmanaged[@\"dateObj\"] = unmanaged[@\"dateObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"dateObj\"] valueForKey:@\"self\"], (@[date(1), date(2)]));\n    \n    unmanaged[@\"decimalObj\"] = unmanaged[@\"decimalObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"decimalObj\"] valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    \n    unmanaged[@\"objectIdObj\"] = unmanaged[@\"objectIdObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"objectIdObj\"] valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    \n    unmanaged[@\"uuidObj\"] = unmanaged[@\"uuidObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"uuidObj\"] valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    \n    unmanaged[@\"anyBoolObj\"] = unmanaged[@\"anyBoolObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyBoolObj\"] valueForKey:@\"self\"], (@[@NO, @YES]));\n    \n    unmanaged[@\"anyIntObj\"] = unmanaged[@\"anyIntObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyIntObj\"] valueForKey:@\"self\"], (@[@2, @3]));\n    \n    unmanaged[@\"anyFloatObj\"] = unmanaged[@\"anyFloatObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyFloatObj\"] valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    \n    unmanaged[@\"anyDoubleObj\"] = unmanaged[@\"anyDoubleObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyDoubleObj\"] valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    \n    unmanaged[@\"anyStringObj\"] = unmanaged[@\"anyStringObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyStringObj\"] valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    \n    unmanaged[@\"anyDataObj\"] = unmanaged[@\"anyDataObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyDataObj\"] valueForKey:@\"self\"], (@[data(1), data(2)]));\n    \n    unmanaged[@\"anyDateObj\"] = unmanaged[@\"anyDateObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyDateObj\"] valueForKey:@\"self\"], (@[date(1), date(2)]));\n    \n    unmanaged[@\"anyDecimalObj\"] = unmanaged[@\"anyDecimalObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyDecimalObj\"] valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    \n    unmanaged[@\"anyObjectIdObj\"] = unmanaged[@\"anyObjectIdObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyObjectIdObj\"] valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    \n    unmanaged[@\"anyUUIDObj\"] = unmanaged[@\"anyUUIDObj\"];\n    uncheckedAssertEqualObjects([unmanaged[@\"anyUUIDObj\"] valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    \n    optUnmanaged[@\"boolObj\"] = optUnmanaged[@\"boolObj\"];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"boolObj\"] valueForKey:@\"self\"], (@[@NO, @YES, NSNull.null]));\n    \n    optUnmanaged[@\"intObj\"] = optUnmanaged[@\"intObj\"];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"intObj\"] valueForKey:@\"self\"], (@[@2, @3, NSNull.null]));\n    \n    optUnmanaged[@\"floatObj\"] = optUnmanaged[@\"floatObj\"];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"floatObj\"] valueForKey:@\"self\"], (@[@2.2f, @3.3f, NSNull.null]));\n    \n    optUnmanaged[@\"doubleObj\"] = optUnmanaged[@\"doubleObj\"];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"doubleObj\"] valueForKey:@\"self\"], (@[@2.2, @3.3, NSNull.null]));\n    \n    optUnmanaged[@\"stringObj\"] = optUnmanaged[@\"stringObj\"];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"stringObj\"] valueForKey:@\"self\"], (@[@\"a\", @\"b\", NSNull.null]));\n    \n    optUnmanaged[@\"dataObj\"] = optUnmanaged[@\"dataObj\"];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"dataObj\"] valueForKey:@\"self\"], (@[data(1), data(2), NSNull.null]));\n    \n    optUnmanaged[@\"dateObj\"] = optUnmanaged[@\"dateObj\"];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"dateObj\"] valueForKey:@\"self\"], (@[date(1), date(2), NSNull.null]));\n    \n    optUnmanaged[@\"decimalObj\"] = optUnmanaged[@\"decimalObj\"];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"decimalObj\"] valueForKey:@\"self\"], (@[decimal128(2), decimal128(3), NSNull.null]));\n    \n    optUnmanaged[@\"objectIdObj\"] = optUnmanaged[@\"objectIdObj\"];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"objectIdObj\"] valueForKey:@\"self\"], (@[objectId(1), objectId(2), NSNull.null]));\n    \n    optUnmanaged[@\"uuidObj\"] = optUnmanaged[@\"uuidObj\"];\n    uncheckedAssertEqualObjects([optUnmanaged[@\"uuidObj\"] valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]));\n    \n    managed[@\"boolObj\"] = managed[@\"boolObj\"];\n    uncheckedAssertEqualObjects([managed[@\"boolObj\"] valueForKey:@\"self\"], (@[@NO, @YES]));\n    \n    managed[@\"intObj\"] = managed[@\"intObj\"];\n    uncheckedAssertEqualObjects([managed[@\"intObj\"] valueForKey:@\"self\"], (@[@2, @3]));\n    \n    managed[@\"floatObj\"] = managed[@\"floatObj\"];\n    uncheckedAssertEqualObjects([managed[@\"floatObj\"] valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    \n    managed[@\"doubleObj\"] = managed[@\"doubleObj\"];\n    uncheckedAssertEqualObjects([managed[@\"doubleObj\"] valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    \n    managed[@\"stringObj\"] = managed[@\"stringObj\"];\n    uncheckedAssertEqualObjects([managed[@\"stringObj\"] valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    \n    managed[@\"dataObj\"] = managed[@\"dataObj\"];\n    uncheckedAssertEqualObjects([managed[@\"dataObj\"] valueForKey:@\"self\"], (@[data(1), data(2)]));\n    \n    managed[@\"dateObj\"] = managed[@\"dateObj\"];\n    uncheckedAssertEqualObjects([managed[@\"dateObj\"] valueForKey:@\"self\"], (@[date(1), date(2)]));\n    \n    managed[@\"decimalObj\"] = managed[@\"decimalObj\"];\n    uncheckedAssertEqualObjects([managed[@\"decimalObj\"] valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    \n    managed[@\"objectIdObj\"] = managed[@\"objectIdObj\"];\n    uncheckedAssertEqualObjects([managed[@\"objectIdObj\"] valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    \n    managed[@\"uuidObj\"] = managed[@\"uuidObj\"];\n    uncheckedAssertEqualObjects([managed[@\"uuidObj\"] valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    \n    managed[@\"anyBoolObj\"] = managed[@\"anyBoolObj\"];\n    uncheckedAssertEqualObjects([managed[@\"anyBoolObj\"] valueForKey:@\"self\"], (@[@NO, @YES]));\n    \n    managed[@\"anyIntObj\"] = managed[@\"anyIntObj\"];\n    uncheckedAssertEqualObjects([managed[@\"anyIntObj\"] valueForKey:@\"self\"], (@[@2, @3]));\n    \n    managed[@\"anyFloatObj\"] = managed[@\"anyFloatObj\"];\n    uncheckedAssertEqualObjects([managed[@\"anyFloatObj\"] valueForKey:@\"self\"], (@[@2.2f, @3.3f]));\n    \n    managed[@\"anyDoubleObj\"] = managed[@\"anyDoubleObj\"];\n    uncheckedAssertEqualObjects([managed[@\"anyDoubleObj\"] valueForKey:@\"self\"], (@[@2.2, @3.3]));\n    \n    managed[@\"anyStringObj\"] = managed[@\"anyStringObj\"];\n    uncheckedAssertEqualObjects([managed[@\"anyStringObj\"] valueForKey:@\"self\"], (@[@\"a\", @\"b\"]));\n    \n    managed[@\"anyDataObj\"] = managed[@\"anyDataObj\"];\n    uncheckedAssertEqualObjects([managed[@\"anyDataObj\"] valueForKey:@\"self\"], (@[data(1), data(2)]));\n    \n    managed[@\"anyDateObj\"] = managed[@\"anyDateObj\"];\n    uncheckedAssertEqualObjects([managed[@\"anyDateObj\"] valueForKey:@\"self\"], (@[date(1), date(2)]));\n    \n    managed[@\"anyDecimalObj\"] = managed[@\"anyDecimalObj\"];\n    uncheckedAssertEqualObjects([managed[@\"anyDecimalObj\"] valueForKey:@\"self\"], (@[decimal128(2), decimal128(3)]));\n    \n    managed[@\"anyObjectIdObj\"] = managed[@\"anyObjectIdObj\"];\n    uncheckedAssertEqualObjects([managed[@\"anyObjectIdObj\"] valueForKey:@\"self\"], (@[objectId(1), objectId(2)]));\n    \n    managed[@\"anyUUIDObj\"] = managed[@\"anyUUIDObj\"];\n    uncheckedAssertEqualObjects([managed[@\"anyUUIDObj\"] valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    \n    optManaged[@\"boolObj\"] = optManaged[@\"boolObj\"];\n    uncheckedAssertEqualObjects([optManaged[@\"boolObj\"] valueForKey:@\"self\"], (@[@NO, @YES, NSNull.null]));\n    \n    optManaged[@\"intObj\"] = optManaged[@\"intObj\"];\n    uncheckedAssertEqualObjects([optManaged[@\"intObj\"] valueForKey:@\"self\"], (@[@2, @3, NSNull.null]));\n    \n    optManaged[@\"floatObj\"] = optManaged[@\"floatObj\"];\n    uncheckedAssertEqualObjects([optManaged[@\"floatObj\"] valueForKey:@\"self\"], (@[@2.2f, @3.3f, NSNull.null]));\n    \n    optManaged[@\"doubleObj\"] = optManaged[@\"doubleObj\"];\n    uncheckedAssertEqualObjects([optManaged[@\"doubleObj\"] valueForKey:@\"self\"], (@[@2.2, @3.3, NSNull.null]));\n    \n    optManaged[@\"stringObj\"] = optManaged[@\"stringObj\"];\n    uncheckedAssertEqualObjects([optManaged[@\"stringObj\"] valueForKey:@\"self\"], (@[@\"a\", @\"b\", NSNull.null]));\n    \n    optManaged[@\"dataObj\"] = optManaged[@\"dataObj\"];\n    uncheckedAssertEqualObjects([optManaged[@\"dataObj\"] valueForKey:@\"self\"], (@[data(1), data(2), NSNull.null]));\n    \n    optManaged[@\"dateObj\"] = optManaged[@\"dateObj\"];\n    uncheckedAssertEqualObjects([optManaged[@\"dateObj\"] valueForKey:@\"self\"], (@[date(1), date(2), NSNull.null]));\n    \n    optManaged[@\"decimalObj\"] = optManaged[@\"decimalObj\"];\n    uncheckedAssertEqualObjects([optManaged[@\"decimalObj\"] valueForKey:@\"self\"], (@[decimal128(2), decimal128(3), NSNull.null]));\n    \n    optManaged[@\"objectIdObj\"] = optManaged[@\"objectIdObj\"];\n    uncheckedAssertEqualObjects([optManaged[@\"objectIdObj\"] valueForKey:@\"self\"], (@[objectId(1), objectId(2), NSNull.null]));\n    \n    optManaged[@\"uuidObj\"] = optManaged[@\"uuidObj\"];\n    uncheckedAssertEqualObjects([optManaged[@\"uuidObj\"] valueForKey:@\"self\"], (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]));\n    \n\n    [unmanaged[@\"intObj\"] removeAllObjects];\n    unmanaged[@\"intObj\"] = managed.intObj;\n    uncheckedAssertEqualObjects([unmanaged[@\"intObj\"] valueForKey:@\"self\"], (@[@2, @3]));\n\n    [managed[@\"intObj\"] removeAllObjects];\n    managed[@\"intObj\"] = unmanaged.intObj;\n    uncheckedAssertEqualObjects([managed[@\"intObj\"] valueForKey:@\"self\"], (@[@2, @3]));\n}\n\n- (void)testInvalidAssignment {\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)@[NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for 'int' array property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)@[@\"a\"],\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' array property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)(@[@1, @\"a\"]),\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' array property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)unmanaged.floatObj,\n                              @\"RLMArray<float> does not match expected type 'int' for property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)optUnmanaged.intObj,\n                              @\"RLMArray<int?> does not match expected type 'int' for property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged[@\"intObj\"] = unmanaged[@\"floatObj\"],\n                              @\"RLMArray<float> does not match expected type 'int' for property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged[@\"intObj\"] = optUnmanaged[@\"intObj\"],\n                              @\"RLMArray<int?> does not match expected type 'int' for property 'AllPrimitiveArrays.intObj'.\");\n\n    RLMAssertThrowsWithReason(managed.intObj = (id)@[NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for 'int' array property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)@[@\"a\"],\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' array property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)(@[@1, @\"a\"]),\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' array property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)managed.floatObj,\n                              @\"RLMArray<float> does not match expected type 'int' for property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)optManaged.intObj,\n                              @\"RLMArray<int?> does not match expected type 'int' for property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(managed[@\"intObj\"] = (id)managed[@\"floatObj\"],\n                              @\"RLMArray<float> does not match expected type 'int' for property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(managed[@\"intObj\"] = (id)optManaged[@\"intObj\"],\n                              @\"RLMArray<int?> does not match expected type 'int' for property 'AllPrimitiveArrays.intObj'.\");\n}\n\n- (void)testAllMethodsCheckThread {\n    RLMArray *array = managed.intObj;\n    [self dispatchAsyncAndWait:^{\n        RLMAssertThrowsWithReason([array count], @\"thread\");\n        RLMAssertThrowsWithReason([array objectAtIndex:0], @\"thread\");\n        RLMAssertThrowsWithReason([array firstObject], @\"thread\");\n        RLMAssertThrowsWithReason([array lastObject], @\"thread\");\n\n        RLMAssertThrowsWithReason([array addObject:@0], @\"thread\");\n        RLMAssertThrowsWithReason([array addObjects:@[@0]], @\"thread\");\n        RLMAssertThrowsWithReason([array insertObject:@0 atIndex:0], @\"thread\");\n        RLMAssertThrowsWithReason([array removeObjectAtIndex:0], @\"thread\");\n        RLMAssertThrowsWithReason([array removeLastObject], @\"thread\");\n        RLMAssertThrowsWithReason([array removeAllObjects], @\"thread\");\n        RLMAssertThrowsWithReason([array replaceObjectAtIndex:0 withObject:@0], @\"thread\");\n        RLMAssertThrowsWithReason([array moveObjectAtIndex:0 toIndex:1], @\"thread\");\n        RLMAssertThrowsWithReason([array exchangeObjectAtIndex:0 withObjectAtIndex:1], @\"thread\");\n\n        RLMAssertThrowsWithReason([array indexOfObject:@1], @\"thread\");\n        /* RLMAssertThrowsWithReason([array indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"thread\"); */\n        /* RLMAssertThrowsWithReason([array indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]], @\"thread\"); */\n        /* RLMAssertThrowsWithReason([array objectsWhere:@\"TRUEPREDICATE\"], @\"thread\"); */\n        /* RLMAssertThrowsWithReason([array objectsWithPredicate:[NSPredicate predicateWithValue:NO]], @\"thread\"); */\n        RLMAssertThrowsWithReason([array sortedResultsUsingKeyPath:@\"self\" ascending:YES], @\"thread\");\n        RLMAssertThrowsWithReason([array sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"self\" ascending:YES]]], @\"thread\");\n        RLMAssertThrowsWithReason(array[0], @\"thread\");\n        RLMAssertThrowsWithReason(array[0] = @0, @\"thread\");\n        RLMAssertThrowsWithReason([array valueForKey:@\"self\"], @\"thread\");\n        RLMAssertThrowsWithReason([array setValue:@1 forKey:@\"self\"], @\"thread\");\n        RLMAssertThrowsWithReason(({for (__unused id obj in array);}), @\"thread\");\n    }];\n}\n\n- (void)testAllMethodsCheckForInvalidation {\n    RLMArray *array = managed.intObj;\n    [realm cancelWriteTransaction];\n    [realm invalidate];\n\n    XCTAssertNoThrow([array objectClassName]);\n    XCTAssertNoThrow([array realm]);\n    XCTAssertNoThrow([array isInvalidated]);\n\n    RLMAssertThrowsWithReason([array count], @\"invalidated\");\n    RLMAssertThrowsWithReason([array objectAtIndex:0], @\"invalidated\");\n    RLMAssertThrowsWithReason([array firstObject], @\"invalidated\");\n    RLMAssertThrowsWithReason([array lastObject], @\"invalidated\");\n\n    RLMAssertThrowsWithReason([array addObject:@0], @\"invalidated\");\n    RLMAssertThrowsWithReason([array addObjects:@[@0]], @\"invalidated\");\n    RLMAssertThrowsWithReason([array insertObject:@0 atIndex:0], @\"invalidated\");\n    RLMAssertThrowsWithReason([array removeObjectAtIndex:0], @\"invalidated\");\n    RLMAssertThrowsWithReason([array removeLastObject], @\"invalidated\");\n    RLMAssertThrowsWithReason([array removeAllObjects], @\"invalidated\");\n    RLMAssertThrowsWithReason([array replaceObjectAtIndex:0 withObject:@0], @\"invalidated\");\n    RLMAssertThrowsWithReason([array moveObjectAtIndex:0 toIndex:1], @\"invalidated\");\n    RLMAssertThrowsWithReason([array exchangeObjectAtIndex:0 withObjectAtIndex:1], @\"invalidated\");\n\n    RLMAssertThrowsWithReason([array indexOfObject:@1], @\"invalidated\");\n    /* RLMAssertThrowsWithReason([array indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"invalidated\"); */\n    /* RLMAssertThrowsWithReason([array indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"invalidated\"); */\n    /* RLMAssertThrowsWithReason([array objectsWhere:@\"TRUEPREDICATE\"], @\"invalidated\"); */\n    /* RLMAssertThrowsWithReason([array objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"invalidated\"); */\n    RLMAssertThrowsWithReason([array sortedResultsUsingKeyPath:@\"self\" ascending:YES], @\"invalidated\");\n    RLMAssertThrowsWithReason([array sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"self\" ascending:YES]]], @\"invalidated\");\n    RLMAssertThrowsWithReason(array[0], @\"invalidated\");\n    RLMAssertThrowsWithReason(array[0] = @0, @\"invalidated\");\n    RLMAssertThrowsWithReason([array valueForKey:@\"self\"], @\"invalidated\");\n    RLMAssertThrowsWithReason([array setValue:@1 forKey:@\"self\"], @\"invalidated\");\n    RLMAssertThrowsWithReason(({for (__unused id obj in array);}), @\"invalidated\");\n\n    [realm beginWriteTransaction];\n}\n\n- (void)testMutatingMethodsCheckForWriteTransaction {\n    RLMArray *array = managed.intObj;\n    [array addObject:@0];\n    [realm commitWriteTransaction];\n\n    XCTAssertNoThrow([array objectClassName]);\n    XCTAssertNoThrow([array realm]);\n    XCTAssertNoThrow([array isInvalidated]);\n\n    XCTAssertNoThrow([array count]);\n    XCTAssertNoThrow([array objectAtIndex:0]);\n    XCTAssertNoThrow([array firstObject]);\n    XCTAssertNoThrow([array lastObject]);\n\n    XCTAssertNoThrow([array indexOfObject:@1]);\n    /* XCTAssertNoThrow([array indexOfObjectWhere:@\"TRUEPREDICATE\"]); */\n    /* XCTAssertNoThrow([array indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]); */\n    /* XCTAssertNoThrow([array objectsWhere:@\"TRUEPREDICATE\"]); */\n    /* XCTAssertNoThrow([array objectsWithPredicate:[NSPredicate predicateWithValue:YES]]); */\n    XCTAssertNoThrow([array sortedResultsUsingKeyPath:@\"self\" ascending:YES]);\n    XCTAssertNoThrow([array sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"self\" ascending:YES]]]);\n    XCTAssertNoThrow(array[0]);\n    XCTAssertNoThrow([array valueForKey:@\"self\"]);\n    XCTAssertNoThrow(({for (__unused id obj in array);}));\n\n\n    RLMAssertThrowsWithReason([array addObject:@0], @\"write transaction\");\n    RLMAssertThrowsWithReason([array addObjects:@[@0]], @\"write transaction\");\n    RLMAssertThrowsWithReason([array insertObject:@0 atIndex:0], @\"write transaction\");\n    RLMAssertThrowsWithReason([array removeObjectAtIndex:0], @\"write transaction\");\n    RLMAssertThrowsWithReason([array removeLastObject], @\"write transaction\");\n    RLMAssertThrowsWithReason([array removeAllObjects], @\"write transaction\");\n    RLMAssertThrowsWithReason([array replaceObjectAtIndex:0 withObject:@0], @\"write transaction\");\n    RLMAssertThrowsWithReason([array moveObjectAtIndex:0 toIndex:1], @\"write transaction\");\n    RLMAssertThrowsWithReason([array exchangeObjectAtIndex:0 withObjectAtIndex:1], @\"write transaction\");\n\n    RLMAssertThrowsWithReason(array[0] = @0, @\"write transaction\");\n    RLMAssertThrowsWithReason([array setValue:@1 forKey:@\"self\"], @\"write transaction\");\n}\n\n- (void)testDeleteOwningObject {\n    RLMArray *array = managed.intObj;\n    uncheckedAssertFalse(array.isInvalidated);\n    [realm deleteObject:managed];\n    uncheckedAssertTrue(array.isInvalidated);\n}\n\n#pragma clang diagnostic ignored \"-Warc-retain-cycles\"\n\n- (void)testNotificationSentInitially {\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMArray *array, RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(array);\n        uncheckedAssertNil(change);\n        uncheckedAssertNil(error);\n        [expectation fulfill];\n    }];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationSentAfterCommit {\n    [realm commitWriteTransaction];\n\n    __block bool first = true;\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMArray *array, RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(array);\n        uncheckedAssertNil(error);\n        if (first) {\n            uncheckedAssertNil(change);\n        }\n        else {\n            uncheckedAssertEqualObjects(change.insertions, @[@0]);\n        }\n\n        first = false;\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *r = [RLMRealm defaultRealm];\n        [r transactionWithBlock:^{\n            RLMArray *array = [(AllPrimitiveArrays *)[AllPrimitiveArrays allObjectsInRealm:r].firstObject intObj];\n            [array addObject:@0];\n        }];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationNotSentForUnrelatedChange {\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(__unused RLMArray *array, __unused RLMCollectionChange *change, __unused NSError *error) {\n        // will throw if it's incorrectly called a second time due to the\n        // unrelated write transaction\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmDidChangeNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *r = [RLMRealm defaultRealm];\n            [r transactionWithBlock:^{\n                [AllPrimitiveArrays createInRealm:r withValue:@[]];\n            }];\n        }];\n    }];\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationSentOnlyForActualRefresh {\n    [realm commitWriteTransaction];\n\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMArray *array, __unused RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(array);\n        uncheckedAssertNil(error);\n        // will throw if it's called a second time before we create the new\n        // expectation object immediately before manually refreshing\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // Turn off autorefresh, so the background commit should not result in a notification\n    realm.autorefresh = NO;\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmRefreshRequiredNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *r = [RLMRealm defaultRealm];\n            [r transactionWithBlock:^{\n                RLMArray *array = [(AllPrimitiveArrays *)[AllPrimitiveArrays allObjectsInRealm:r].firstObject intObj];\n                [array addObject:@0];\n            }];\n        }];\n    }];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [realm refresh];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testDeletingObjectWithNotificationsRegistered {\n    [managed.intObj addObjects:@[@10, @20]];\n    [realm commitWriteTransaction];\n\n    __block bool first = true;\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMArray *array, RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(array);\n        uncheckedAssertNil(error);\n        if (first) {\n            uncheckedAssertNil(change);\n            first = false;\n        }\n        else {\n            uncheckedAssertEqualObjects(change.deletions, (@[@0, @1]));\n        }\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [realm beginWriteTransaction];\n    [realm deleteObject:managed];\n    [realm commitWriteTransaction];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n#pragma mark - Queries\n\n#define RLMAssertCount(cls, expectedCount, ...) \\\n    uncheckedAssertEqual(expectedCount, ([cls objectsInRealm:realm where:__VA_ARGS__].count))\n\n- (void)createObjectWithValueIndex:(NSUInteger)index {\n    NSRange range = {index, 1};\n    id obj = [AllPrimitiveArrays createInRealm:realm withValue:@{\n        @\"boolObj\": [@[@NO, @YES] subarrayWithRange:range],\n        @\"intObj\": [@[@2, @3] subarrayWithRange:range],\n        @\"floatObj\": [@[@2.2f, @3.3f] subarrayWithRange:range],\n        @\"doubleObj\": [@[@2.2, @3.3] subarrayWithRange:range],\n        @\"stringObj\": [@[@\"a\", @\"b\"] subarrayWithRange:range],\n        @\"dataObj\": [@[data(1), data(2)] subarrayWithRange:range],\n        @\"dateObj\": [@[date(1), date(2)] subarrayWithRange:range],\n        @\"decimalObj\": [@[decimal128(2), decimal128(3)] subarrayWithRange:range],\n        @\"objectIdObj\": [@[objectId(1), objectId(2)] subarrayWithRange:range],\n        @\"uuidObj\": [@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")] subarrayWithRange:range],\n        @\"anyBoolObj\": [@[@NO, @YES] subarrayWithRange:range],\n        @\"anyIntObj\": [@[@2, @3] subarrayWithRange:range],\n        @\"anyFloatObj\": [@[@2.2f, @3.3f] subarrayWithRange:range],\n        @\"anyDoubleObj\": [@[@2.2, @3.3] subarrayWithRange:range],\n        @\"anyStringObj\": [@[@\"a\", @\"b\"] subarrayWithRange:range],\n        @\"anyDataObj\": [@[data(1), data(2)] subarrayWithRange:range],\n        @\"anyDateObj\": [@[date(1), date(2)] subarrayWithRange:range],\n        @\"anyDecimalObj\": [@[decimal128(2), decimal128(3)] subarrayWithRange:range],\n        @\"anyObjectIdObj\": [@[objectId(1), objectId(2)] subarrayWithRange:range],\n        @\"anyUUIDObj\": [@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")] subarrayWithRange:range],\n    }];\n    [LinkToAllPrimitiveArrays createInRealm:realm withValue:@[obj]];\n    obj = [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        @\"boolObj\": [@[@NO, @YES, NSNull.null] subarrayWithRange:range],\n        @\"intObj\": [@[@2, @3, NSNull.null] subarrayWithRange:range],\n        @\"floatObj\": [@[@2.2f, @3.3f, NSNull.null] subarrayWithRange:range],\n        @\"doubleObj\": [@[@2.2, @3.3, NSNull.null] subarrayWithRange:range],\n        @\"stringObj\": [@[@\"a\", @\"b\", NSNull.null] subarrayWithRange:range],\n        @\"dataObj\": [@[data(1), data(2), NSNull.null] subarrayWithRange:range],\n        @\"dateObj\": [@[date(1), date(2), NSNull.null] subarrayWithRange:range],\n        @\"decimalObj\": [@[decimal128(2), decimal128(3), NSNull.null] subarrayWithRange:range],\n        @\"objectIdObj\": [@[objectId(1), objectId(2), NSNull.null] subarrayWithRange:range],\n        @\"uuidObj\": [@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null] subarrayWithRange:range],\n    }];\n    [LinkToAllOptionalPrimitiveArrays createInRealm:realm withValue:@[obj]];\n}\n\n- (void)testQueryBasicOperators {\n    [realm deleteAllObjects];\n\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY boolObj = %@\", @NO);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY intObj = %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY floatObj = %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY doubleObj = %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY stringObj = %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dataObj = %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dateObj = %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY decimalObj = %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY objectIdObj = %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY uuidObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyBoolObj = %@\", @NO);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyIntObj = %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyFloatObj = %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDoubleObj = %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyStringObj = %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDataObj = %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDateObj = %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDecimalObj = %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyObjectIdObj = %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyUUIDObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY boolObj = %@\", @NO);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY intObj = %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY floatObj = %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY doubleObj = %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY stringObj = %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dataObj = %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dateObj = %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY decimalObj = %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY objectIdObj = %@\", objectId(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY uuidObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY boolObj != %@\", @NO);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY intObj != %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY floatObj != %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY doubleObj != %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY stringObj != %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dataObj != %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dateObj != %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY decimalObj != %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY objectIdObj != %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY uuidObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyBoolObj != %@\", @NO);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyIntObj != %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyFloatObj != %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDoubleObj != %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyStringObj != %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDataObj != %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDateObj != %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDecimalObj != %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyObjectIdObj != %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyUUIDObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY boolObj != %@\", @NO);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY intObj != %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY floatObj != %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY doubleObj != %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY stringObj != %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dataObj != %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dateObj != %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY decimalObj != %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY objectIdObj != %@\", objectId(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY uuidObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY intObj > %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY floatObj > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY doubleObj > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY stringObj > %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dataObj > %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dateObj > %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY decimalObj > %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyIntObj > %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyFloatObj > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDoubleObj > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyStringObj > %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDataObj > %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDateObj > %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDecimalObj > %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY intObj > %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY floatObj > %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY doubleObj > %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY stringObj > %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dataObj > %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dateObj > %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY decimalObj > %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY intObj >= %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY floatObj >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY doubleObj >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY stringObj >= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dataObj >= %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dateObj >= %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY decimalObj >= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyIntObj >= %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyFloatObj >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDoubleObj >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyStringObj >= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDataObj >= %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDateObj >= %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDecimalObj >= %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY intObj >= %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY floatObj >= %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY doubleObj >= %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY stringObj >= %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dataObj >= %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dateObj >= %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY decimalObj >= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY intObj < %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY floatObj < %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY doubleObj < %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY stringObj < %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dataObj < %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dateObj < %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY decimalObj < %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyIntObj < %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyFloatObj < %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDoubleObj < %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyStringObj < %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDataObj < %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDateObj < %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDecimalObj < %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY intObj < %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY floatObj < %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY doubleObj < %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY stringObj < %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dataObj < %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dateObj < %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY decimalObj < %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY intObj <= %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY floatObj <= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY doubleObj <= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY stringObj <= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dataObj <= %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dateObj <= %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY decimalObj <= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyIntObj <= %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyFloatObj <= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDoubleObj <= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyStringObj <= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDataObj <= %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDateObj <= %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDecimalObj <= %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY intObj <= %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY floatObj <= %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY doubleObj <= %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY stringObj <= %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dataObj <= %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dateObj <= %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY decimalObj <= %@\", decimal128(2));\n\n    [self createObjectWithValueIndex:0];\n\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY boolObj = %@\", @YES);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY intObj = %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY floatObj = %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY doubleObj = %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY stringObj = %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dataObj = %@\", data(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dateObj = %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY decimalObj = %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY objectIdObj = %@\", objectId(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY uuidObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyBoolObj = %@\", @YES);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyIntObj = %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyFloatObj = %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDoubleObj = %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyStringObj = %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDataObj = %@\", data(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDateObj = %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDecimalObj = %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyObjectIdObj = %@\", objectId(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyUUIDObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY boolObj = %@\", @YES);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY intObj = %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY floatObj = %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY doubleObj = %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY stringObj = %@\", @\"b\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dataObj = %@\", data(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dateObj = %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY decimalObj = %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY objectIdObj = %@\", objectId(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY uuidObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY boolObj = %@\", @NO);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY intObj = %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY floatObj = %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY doubleObj = %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY stringObj = %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dataObj = %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dateObj = %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY decimalObj = %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY objectIdObj = %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY uuidObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyBoolObj = %@\", @NO);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyIntObj = %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyFloatObj = %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDoubleObj = %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyStringObj = %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDataObj = %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDateObj = %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDecimalObj = %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyObjectIdObj = %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyUUIDObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY boolObj = %@\", @NO);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY intObj = %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY floatObj = %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY doubleObj = %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY stringObj = %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dataObj = %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dateObj = %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY decimalObj = %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY objectIdObj = %@\", objectId(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY uuidObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY boolObj != %@\", @NO);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY intObj != %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY floatObj != %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY doubleObj != %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY stringObj != %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dataObj != %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dateObj != %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY decimalObj != %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY objectIdObj != %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY uuidObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyBoolObj != %@\", @NO);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyIntObj != %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyFloatObj != %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDoubleObj != %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyStringObj != %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDataObj != %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDateObj != %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDecimalObj != %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyObjectIdObj != %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyUUIDObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY boolObj != %@\", @NO);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY intObj != %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY floatObj != %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY doubleObj != %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY stringObj != %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dataObj != %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dateObj != %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY decimalObj != %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY objectIdObj != %@\", objectId(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY uuidObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY boolObj != %@\", @YES);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY intObj != %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY floatObj != %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY doubleObj != %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY stringObj != %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dataObj != %@\", data(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dateObj != %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY decimalObj != %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY objectIdObj != %@\", objectId(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY uuidObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyBoolObj != %@\", @YES);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyIntObj != %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyFloatObj != %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDoubleObj != %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyStringObj != %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDataObj != %@\", data(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDateObj != %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDecimalObj != %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyObjectIdObj != %@\", objectId(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyUUIDObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY boolObj != %@\", @YES);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY intObj != %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY floatObj != %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY doubleObj != %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY stringObj != %@\", @\"b\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dataObj != %@\", data(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dateObj != %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY decimalObj != %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY objectIdObj != %@\", objectId(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY uuidObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY intObj > %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY floatObj > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY doubleObj > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY stringObj > %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dataObj > %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dateObj > %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY decimalObj > %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyIntObj > %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyFloatObj > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDoubleObj > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyStringObj > %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDataObj > %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDateObj > %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDecimalObj > %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY intObj > %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY floatObj > %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY doubleObj > %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY stringObj > %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dataObj > %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dateObj > %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY decimalObj > %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY intObj >= %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY floatObj >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY doubleObj >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY stringObj >= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dataObj >= %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dateObj >= %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY decimalObj >= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyIntObj >= %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyFloatObj >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDoubleObj >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyStringObj >= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDataObj >= %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDateObj >= %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDecimalObj >= %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY intObj >= %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY floatObj >= %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY doubleObj >= %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY stringObj >= %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dataObj >= %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dateObj >= %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY decimalObj >= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY intObj < %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY floatObj < %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY doubleObj < %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY stringObj < %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dataObj < %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dateObj < %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY decimalObj < %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyIntObj < %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyFloatObj < %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDoubleObj < %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyStringObj < %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDataObj < %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDateObj < %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDecimalObj < %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY intObj < %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY floatObj < %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY doubleObj < %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY stringObj < %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dataObj < %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dateObj < %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY decimalObj < %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY intObj < %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY floatObj < %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY doubleObj < %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY stringObj < %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dataObj < %@\", data(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dateObj < %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY decimalObj < %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyIntObj < %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyFloatObj < %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDoubleObj < %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyStringObj < %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDataObj < %@\", data(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDateObj < %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDecimalObj < %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY intObj < %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY floatObj < %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY doubleObj < %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY stringObj < %@\", @\"b\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dataObj < %@\", data(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dateObj < %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY decimalObj < %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY intObj <= %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY floatObj <= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY doubleObj <= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY stringObj <= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dataObj <= %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dateObj <= %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY decimalObj <= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyIntObj <= %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyFloatObj <= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDoubleObj <= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyStringObj <= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDataObj <= %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDateObj <= %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDecimalObj <= %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY intObj <= %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY floatObj <= %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY doubleObj <= %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY stringObj <= %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dataObj <= %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dateObj <= %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY decimalObj <= %@\", decimal128(2));\n\n    [self createObjectWithValueIndex:1];\n\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY boolObj = %@\", @NO);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY intObj = %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY floatObj = %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY doubleObj = %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY stringObj = %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dataObj = %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dateObj = %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY decimalObj = %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY objectIdObj = %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY uuidObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyBoolObj = %@\", @NO);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyIntObj = %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyFloatObj = %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDoubleObj = %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyStringObj = %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDataObj = %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDateObj = %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDecimalObj = %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyObjectIdObj = %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyUUIDObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY boolObj = %@\", @NO);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY intObj = %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY floatObj = %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY doubleObj = %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY stringObj = %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dataObj = %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dateObj = %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY decimalObj = %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY objectIdObj = %@\", objectId(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY uuidObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY boolObj = %@\", @YES);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY intObj = %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY floatObj = %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY doubleObj = %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY stringObj = %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dataObj = %@\", data(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dateObj = %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY decimalObj = %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY objectIdObj = %@\", objectId(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY uuidObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyBoolObj = %@\", @YES);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyIntObj = %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyFloatObj = %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDoubleObj = %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyStringObj = %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDataObj = %@\", data(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDateObj = %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDecimalObj = %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyObjectIdObj = %@\", objectId(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyUUIDObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY boolObj = %@\", @YES);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY intObj = %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY floatObj = %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY doubleObj = %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY stringObj = %@\", @\"b\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dataObj = %@\", data(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dateObj = %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY decimalObj = %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY objectIdObj = %@\", objectId(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY uuidObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY boolObj != %@\", @NO);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY intObj != %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY floatObj != %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY doubleObj != %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY stringObj != %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dataObj != %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dateObj != %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY decimalObj != %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY objectIdObj != %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY uuidObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyBoolObj != %@\", @NO);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyIntObj != %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyFloatObj != %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDoubleObj != %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyStringObj != %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDataObj != %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDateObj != %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDecimalObj != %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyObjectIdObj != %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyUUIDObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY boolObj != %@\", @NO);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY intObj != %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY floatObj != %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY doubleObj != %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY stringObj != %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dataObj != %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dateObj != %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY decimalObj != %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY objectIdObj != %@\", objectId(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY uuidObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY boolObj != %@\", @YES);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY intObj != %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY floatObj != %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY doubleObj != %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY stringObj != %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dataObj != %@\", data(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dateObj != %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY decimalObj != %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY objectIdObj != %@\", objectId(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY uuidObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyBoolObj != %@\", @YES);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyIntObj != %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyFloatObj != %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDoubleObj != %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyStringObj != %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDataObj != %@\", data(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDateObj != %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDecimalObj != %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyObjectIdObj != %@\", objectId(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyUUIDObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY boolObj != %@\", @YES);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY intObj != %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY floatObj != %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY doubleObj != %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY stringObj != %@\", @\"b\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dataObj != %@\", data(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dateObj != %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY decimalObj != %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY objectIdObj != %@\", objectId(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY uuidObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY intObj > %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY floatObj > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY doubleObj > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY stringObj > %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dataObj > %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dateObj > %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY decimalObj > %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyIntObj > %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyFloatObj > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDoubleObj > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyStringObj > %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDataObj > %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDateObj > %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDecimalObj > %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY intObj > %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY floatObj > %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY doubleObj > %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY stringObj > %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dataObj > %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dateObj > %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY decimalObj > %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY intObj >= %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY floatObj >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY doubleObj >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY stringObj >= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY dataObj >= %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY dateObj >= %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY decimalObj >= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY anyIntObj >= %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY anyFloatObj >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY anyDoubleObj >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY anyStringObj >= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY anyDataObj >= %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY anyDateObj >= %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY anyDecimalObj >= %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2, @\"ANY intObj >= %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2, @\"ANY floatObj >= %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2, @\"ANY doubleObj >= %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2, @\"ANY stringObj >= %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2, @\"ANY dataObj >= %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2, @\"ANY dateObj >= %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2, @\"ANY decimalObj >= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY intObj < %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY floatObj < %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY doubleObj < %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY stringObj < %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dataObj < %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dateObj < %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY decimalObj < %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyIntObj < %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyFloatObj < %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDoubleObj < %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyStringObj < %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDataObj < %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDateObj < %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDecimalObj < %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY intObj < %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY floatObj < %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY doubleObj < %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY stringObj < %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dataObj < %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dateObj < %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY decimalObj < %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY intObj < %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY floatObj < %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY doubleObj < %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY stringObj < %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dataObj < %@\", data(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dateObj < %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY decimalObj < %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyIntObj < %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyFloatObj < %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDoubleObj < %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyStringObj < %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDataObj < %@\", data(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDateObj < %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDecimalObj < %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY intObj < %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY floatObj < %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY doubleObj < %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY stringObj < %@\", @\"b\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dataObj < %@\", data(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dateObj < %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY decimalObj < %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY intObj <= %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY floatObj <= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY doubleObj <= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY stringObj <= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dataObj <= %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dateObj <= %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY decimalObj <= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyIntObj <= %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyFloatObj <= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDoubleObj <= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyStringObj <= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDataObj <= %@\", data(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDateObj <= %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDecimalObj <= %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY intObj <= %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY floatObj <= %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY doubleObj <= %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY stringObj <= %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dataObj <= %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dateObj <= %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY decimalObj <= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY intObj <= %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY floatObj <= %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY doubleObj <= %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY stringObj <= %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY dataObj <= %@\", data(2));\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY dateObj <= %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY decimalObj <= %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY anyIntObj <= %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY anyFloatObj <= %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY anyDoubleObj <= %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY anyStringObj <= %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY anyDataObj <= %@\", data(2));\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY anyDateObj <= %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 2, @\"ANY anyDecimalObj <= %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2, @\"ANY intObj <= %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2, @\"ANY floatObj <= %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2, @\"ANY doubleObj <= %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2, @\"ANY stringObj <= %@\", @\"b\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2, @\"ANY dataObj <= %@\", data(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2, @\"ANY dateObj <= %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2, @\"ANY decimalObj <= %@\", decimal128(3));\n\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"ANY boolObj > %@\", @NO]),\n                              @\"Operator '>' not supported for type 'bool'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"ANY objectIdObj > %@\", objectId(1)]),\n                              @\"Operator '>' not supported for type 'object id'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"ANY uuidObj > %@\", uuid(@\"00000000-0000-0000-0000-000000000000\")]),\n                              @\"Operator '>' not supported for type 'uuid'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"ANY boolObj > %@\", @NO]),\n                              @\"Operator '>' not supported for type 'bool'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"ANY objectIdObj > %@\", objectId(1)]),\n                              @\"Operator '>' not supported for type 'object id'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"ANY uuidObj > %@\", uuid(@\"00000000-0000-0000-0000-000000000000\")]),\n                              @\"Operator '>' not supported for type 'uuid'\");\n}\n\n- (void)testQueryBetween {\n    [realm deleteAllObjects];\n\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"ANY boolObj BETWEEN %@\", @[@NO, @YES]]),\n                              @\"Operator 'BETWEEN' not supported for type 'bool'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"ANY stringObj BETWEEN %@\", @[@\"a\", @\"b\"]]),\n                              @\"Operator 'BETWEEN' not supported for type 'string'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"ANY dataObj BETWEEN %@\", @[data(1), data(2)]]),\n                              @\"Operator 'BETWEEN' not supported for type 'data'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"ANY objectIdObj BETWEEN %@\", @[objectId(1), objectId(2)]]),\n                              @\"Operator 'BETWEEN' not supported for type 'object id'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"ANY uuidObj BETWEEN %@\", @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]]),\n                              @\"Operator 'BETWEEN' not supported for type 'uuid'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"ANY boolObj BETWEEN %@\", @[@NO, @YES]]),\n                              @\"Operator 'BETWEEN' not supported for type 'bool'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"ANY stringObj BETWEEN %@\", @[@\"a\", @\"b\"]]),\n                              @\"Operator 'BETWEEN' not supported for type 'string'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"ANY dataObj BETWEEN %@\", @[data(1), data(2)]]),\n                              @\"Operator 'BETWEEN' not supported for type 'data'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"ANY objectIdObj BETWEEN %@\", @[objectId(1), objectId(2)]]),\n                              @\"Operator 'BETWEEN' not supported for type 'object id'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"ANY uuidObj BETWEEN %@\", @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]]),\n                              @\"Operator 'BETWEEN' not supported for type 'uuid'\");\n\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY intObj BETWEEN %@\", @[@2, @3]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY floatObj BETWEEN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY doubleObj BETWEEN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dateObj BETWEEN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY decimalObj BETWEEN %@\", @[decimal128(2), decimal128(3)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyIntObj BETWEEN %@\", @[@2, @3]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyFloatObj BETWEEN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDoubleObj BETWEEN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDateObj BETWEEN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDecimalObj BETWEEN %@\", @[decimal128(2), decimal128(3)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY intObj BETWEEN %@\", @[@2, @3]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY floatObj BETWEEN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY doubleObj BETWEEN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dateObj BETWEEN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY decimalObj BETWEEN %@\", @[decimal128(2), decimal128(3)]);\n\n    [self createObjectWithValueIndex:0];\n\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY intObj BETWEEN %@\", @[@2, @2]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY floatObj BETWEEN %@\", @[@2.2f, @2.2f]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY doubleObj BETWEEN %@\", @[@2.2, @2.2]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dateObj BETWEEN %@\", @[date(1), date(1)]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY decimalObj BETWEEN %@\", @[decimal128(2), decimal128(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyIntObj BETWEEN %@\", @[@2, @2]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyFloatObj BETWEEN %@\", @[@2.2f, @2.2f]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDoubleObj BETWEEN %@\", @[@2.2, @2.2]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDateObj BETWEEN %@\", @[date(1), date(1)]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDecimalObj BETWEEN %@\", @[decimal128(2), decimal128(2)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY intObj BETWEEN %@\", @[@2, @2]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY floatObj BETWEEN %@\", @[@2.2f, @2.2f]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY doubleObj BETWEEN %@\", @[@2.2, @2.2]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dateObj BETWEEN %@\", @[date(1), date(1)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY decimalObj BETWEEN %@\", @[decimal128(2), decimal128(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY intObj BETWEEN %@\", @[@2, @3]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY floatObj BETWEEN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY doubleObj BETWEEN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dateObj BETWEEN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY decimalObj BETWEEN %@\", @[decimal128(2), decimal128(3)]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyIntObj BETWEEN %@\", @[@2, @3]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyFloatObj BETWEEN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDoubleObj BETWEEN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDateObj BETWEEN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDecimalObj BETWEEN %@\", @[decimal128(2), decimal128(3)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY intObj BETWEEN %@\", @[@2, @3]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY floatObj BETWEEN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY doubleObj BETWEEN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dateObj BETWEEN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY decimalObj BETWEEN %@\", @[decimal128(2), decimal128(3)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY intObj BETWEEN %@\", @[@3, @3]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY floatObj BETWEEN %@\", @[@3.3f, @3.3f]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY doubleObj BETWEEN %@\", @[@3.3, @3.3]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dateObj BETWEEN %@\", @[date(2), date(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY decimalObj BETWEEN %@\", @[decimal128(3), decimal128(3)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyIntObj BETWEEN %@\", @[@3, @3]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyFloatObj BETWEEN %@\", @[@3.3f, @3.3f]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDoubleObj BETWEEN %@\", @[@3.3, @3.3]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDateObj BETWEEN %@\", @[date(2), date(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDecimalObj BETWEEN %@\", @[decimal128(3), decimal128(3)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY intObj BETWEEN %@\", @[@3, @3]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY floatObj BETWEEN %@\", @[@3.3f, @3.3f]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY doubleObj BETWEEN %@\", @[@3.3, @3.3]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dateObj BETWEEN %@\", @[date(2), date(2)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY decimalObj BETWEEN %@\", @[decimal128(3), decimal128(3)]);\n}\n\n- (void)testQueryIn {\n    [realm deleteAllObjects];\n\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY boolObj IN %@\", @[@NO, @YES]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY intObj IN %@\", @[@2, @3]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY floatObj IN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY doubleObj IN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY stringObj IN %@\", @[@\"a\", @\"b\"]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dataObj IN %@\", @[data(1), data(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dateObj IN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY decimalObj IN %@\", @[decimal128(2), decimal128(3)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY objectIdObj IN %@\", @[objectId(1), objectId(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY uuidObj IN %@\", @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyBoolObj IN %@\", @[@NO, @YES]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyIntObj IN %@\", @[@2, @3]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyFloatObj IN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDoubleObj IN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyStringObj IN %@\", @[@\"a\", @\"b\"]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDataObj IN %@\", @[data(1), data(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDateObj IN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDecimalObj IN %@\", @[decimal128(2), decimal128(3)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyObjectIdObj IN %@\", @[objectId(1), objectId(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyUUIDObj IN %@\", @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY boolObj IN %@\", @[@NO, @YES]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY intObj IN %@\", @[@2, @3]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY floatObj IN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY doubleObj IN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY stringObj IN %@\", @[@\"a\", @\"b\"]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dataObj IN %@\", @[data(1), data(2)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dateObj IN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY decimalObj IN %@\", @[decimal128(2), decimal128(3)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY objectIdObj IN %@\", @[objectId(1), objectId(2)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY uuidObj IN %@\", @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n\n    [self createObjectWithValueIndex:0];\n\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY boolObj IN %@\", @[@YES]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY intObj IN %@\", @[@3]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY floatObj IN %@\", @[@3.3f]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY doubleObj IN %@\", @[@3.3]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY stringObj IN %@\", @[@\"b\"]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dataObj IN %@\", @[data(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY dateObj IN %@\", @[date(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY decimalObj IN %@\", @[decimal128(3)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY objectIdObj IN %@\", @[objectId(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY uuidObj IN %@\", @[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyBoolObj IN %@\", @[@YES]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyIntObj IN %@\", @[@3]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyFloatObj IN %@\", @[@3.3f]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDoubleObj IN %@\", @[@3.3]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyStringObj IN %@\", @[@\"b\"]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDataObj IN %@\", @[data(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDateObj IN %@\", @[date(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyDecimalObj IN %@\", @[decimal128(3)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyObjectIdObj IN %@\", @[objectId(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 0, @\"ANY anyUUIDObj IN %@\", @[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY boolObj IN %@\", @[@YES]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY intObj IN %@\", @[@3]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY floatObj IN %@\", @[@3.3f]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY doubleObj IN %@\", @[@3.3]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY stringObj IN %@\", @[@\"b\"]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dataObj IN %@\", @[data(2)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY dateObj IN %@\", @[date(2)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY decimalObj IN %@\", @[decimal128(3)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY objectIdObj IN %@\", @[objectId(2)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0, @\"ANY uuidObj IN %@\", @[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY boolObj IN %@\", @[@NO, @YES]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY intObj IN %@\", @[@2, @3]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY floatObj IN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY doubleObj IN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY stringObj IN %@\", @[@\"a\", @\"b\"]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dataObj IN %@\", @[data(1), data(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY dateObj IN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY decimalObj IN %@\", @[decimal128(2), decimal128(3)]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY objectIdObj IN %@\", @[objectId(1), objectId(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY uuidObj IN %@\", @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyBoolObj IN %@\", @[@NO, @YES]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyIntObj IN %@\", @[@2, @3]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyFloatObj IN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDoubleObj IN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyStringObj IN %@\", @[@\"a\", @\"b\"]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDataObj IN %@\", @[data(1), data(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDateObj IN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyDecimalObj IN %@\", @[decimal128(2), decimal128(3)]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyObjectIdObj IN %@\", @[objectId(1), objectId(2)]);\n    RLMAssertCount(AllPrimitiveArrays, 1, @\"ANY anyUUIDObj IN %@\", @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY boolObj IN %@\", @[@NO, @YES]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY intObj IN %@\", @[@2, @3]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY floatObj IN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY doubleObj IN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY stringObj IN %@\", @[@\"a\", @\"b\"]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dataObj IN %@\", @[data(1), data(2)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY dateObj IN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY decimalObj IN %@\", @[decimal128(2), decimal128(3)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY objectIdObj IN %@\", @[objectId(1), objectId(2)]);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1, @\"ANY uuidObj IN %@\", @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n}\n\n- (void)testQueryCount {\n    [realm deleteAllObjects];\n\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        @\"boolObj\": @[],\n        @\"intObj\": @[],\n        @\"floatObj\": @[],\n        @\"doubleObj\": @[],\n        @\"stringObj\": @[],\n        @\"dataObj\": @[],\n        @\"dateObj\": @[],\n        @\"decimalObj\": @[],\n        @\"objectIdObj\": @[],\n        @\"uuidObj\": @[],\n        @\"anyBoolObj\": @[],\n        @\"anyIntObj\": @[],\n        @\"anyFloatObj\": @[],\n        @\"anyDoubleObj\": @[],\n        @\"anyStringObj\": @[],\n        @\"anyDataObj\": @[],\n        @\"anyDateObj\": @[],\n        @\"anyDecimalObj\": @[],\n        @\"anyObjectIdObj\": @[],\n        @\"anyUUIDObj\": @[],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        @\"boolObj\": @[],\n        @\"intObj\": @[],\n        @\"floatObj\": @[],\n        @\"doubleObj\": @[],\n        @\"stringObj\": @[],\n        @\"dataObj\": @[],\n        @\"dateObj\": @[],\n        @\"decimalObj\": @[],\n        @\"objectIdObj\": @[],\n        @\"uuidObj\": @[],\n    }];\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        @\"boolObj\": @[@NO],\n        @\"intObj\": @[@2],\n        @\"floatObj\": @[@2.2f],\n        @\"doubleObj\": @[@2.2],\n        @\"stringObj\": @[@\"a\"],\n        @\"dataObj\": @[data(1)],\n        @\"dateObj\": @[date(1)],\n        @\"decimalObj\": @[decimal128(2)],\n        @\"objectIdObj\": @[objectId(1)],\n        @\"uuidObj\": @[uuid(@\"00000000-0000-0000-0000-000000000000\")],\n        @\"anyBoolObj\": @[@NO],\n        @\"anyIntObj\": @[@2],\n        @\"anyFloatObj\": @[@2.2f],\n        @\"anyDoubleObj\": @[@2.2],\n        @\"anyStringObj\": @[@\"a\"],\n        @\"anyDataObj\": @[data(1)],\n        @\"anyDateObj\": @[date(1)],\n        @\"anyDecimalObj\": @[decimal128(2)],\n        @\"anyObjectIdObj\": @[objectId(1)],\n        @\"anyUUIDObj\": @[uuid(@\"00000000-0000-0000-0000-000000000000\")],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        @\"boolObj\": @[@NO],\n        @\"intObj\": @[@2],\n        @\"floatObj\": @[@2.2f],\n        @\"doubleObj\": @[@2.2],\n        @\"stringObj\": @[@\"a\"],\n        @\"dataObj\": @[data(1)],\n        @\"dateObj\": @[date(1)],\n        @\"decimalObj\": @[decimal128(2)],\n        @\"objectIdObj\": @[objectId(1)],\n        @\"uuidObj\": @[uuid(@\"00000000-0000-0000-0000-000000000000\")],\n    }];\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        @\"boolObj\": @[@NO, @NO],\n        @\"intObj\": @[@2, @2],\n        @\"floatObj\": @[@2.2f, @2.2f],\n        @\"doubleObj\": @[@2.2, @2.2],\n        @\"stringObj\": @[@\"a\", @\"a\"],\n        @\"dataObj\": @[data(1), data(1)],\n        @\"dateObj\": @[date(1), date(1)],\n        @\"decimalObj\": @[decimal128(2), decimal128(2)],\n        @\"objectIdObj\": @[objectId(1), objectId(1)],\n        @\"uuidObj\": @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\")],\n        @\"anyBoolObj\": @[@NO, @NO],\n        @\"anyIntObj\": @[@2, @2],\n        @\"anyFloatObj\": @[@2.2f, @2.2f],\n        @\"anyDoubleObj\": @[@2.2, @2.2],\n        @\"anyStringObj\": @[@\"a\", @\"a\"],\n        @\"anyDataObj\": @[data(1), data(1)],\n        @\"anyDateObj\": @[date(1), date(1)],\n        @\"anyDecimalObj\": @[decimal128(2), decimal128(2)],\n        @\"anyObjectIdObj\": @[objectId(1), objectId(1)],\n        @\"anyUUIDObj\": @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\")],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        @\"boolObj\": @[@NO, @NO],\n        @\"intObj\": @[@2, @2],\n        @\"floatObj\": @[@2.2f, @2.2f],\n        @\"doubleObj\": @[@2.2, @2.2],\n        @\"stringObj\": @[@\"a\", @\"a\"],\n        @\"dataObj\": @[data(1), data(1)],\n        @\"dateObj\": @[date(1), date(1)],\n        @\"decimalObj\": @[decimal128(2), decimal128(2)],\n        @\"objectIdObj\": @[objectId(1), objectId(1)],\n        @\"uuidObj\": @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\")],\n    }];\n\n    for (unsigned int i = 0; i < 3; ++i) {\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"boolObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"intObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"floatObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"doubleObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"stringObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"dataObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"dateObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"decimalObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"objectIdObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"uuidObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyBoolObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyIntObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyFloatObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDoubleObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyStringObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDataObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDateObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDecimalObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyObjectIdObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyUUIDObj.@count == %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"boolObj.@count == %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"intObj.@count == %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"floatObj.@count == %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"doubleObj.@count == %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"stringObj.@count == %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"dataObj.@count == %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"dateObj.@count == %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"decimalObj.@count == %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"objectIdObj.@count == %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"uuidObj.@count == %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"boolObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"intObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"floatObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"doubleObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"stringObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"dataObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"dateObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"decimalObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"objectIdObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"uuidObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyBoolObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyIntObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyFloatObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyDoubleObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyStringObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyDataObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyDateObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyDecimalObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyObjectIdObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyUUIDObj.@count != %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"boolObj.@count != %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"intObj.@count != %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"floatObj.@count != %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"doubleObj.@count != %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"stringObj.@count != %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"dataObj.@count != %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"dateObj.@count != %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"decimalObj.@count != %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"objectIdObj.@count != %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"uuidObj.@count != %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"boolObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"intObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"floatObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"doubleObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"stringObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"dataObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"dateObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"decimalObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"objectIdObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"uuidObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"anyBoolObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"anyIntObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"anyFloatObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"anyDoubleObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"anyStringObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"anyDataObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"anyDateObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"anyDecimalObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"anyObjectIdObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 2 - i, @\"anyUUIDObj.@count > %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2 - i, @\"boolObj.@count > %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2 - i, @\"intObj.@count > %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2 - i, @\"floatObj.@count > %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2 - i, @\"doubleObj.@count > %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2 - i, @\"stringObj.@count > %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2 - i, @\"dataObj.@count > %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2 - i, @\"dateObj.@count > %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2 - i, @\"decimalObj.@count > %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2 - i, @\"objectIdObj.@count > %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 2 - i, @\"uuidObj.@count > %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"boolObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"intObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"floatObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"doubleObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"stringObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"dataObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"dateObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"decimalObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"objectIdObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"uuidObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"anyBoolObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"anyIntObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"anyFloatObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"anyDoubleObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"anyStringObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"anyDataObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"anyDateObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"anyDecimalObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"anyObjectIdObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, 3 - i, @\"anyUUIDObj.@count >= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 3 - i, @\"boolObj.@count >= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 3 - i, @\"intObj.@count >= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 3 - i, @\"floatObj.@count >= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 3 - i, @\"doubleObj.@count >= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 3 - i, @\"stringObj.@count >= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 3 - i, @\"dataObj.@count >= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 3 - i, @\"dateObj.@count >= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 3 - i, @\"decimalObj.@count >= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 3 - i, @\"objectIdObj.@count >= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, 3 - i, @\"uuidObj.@count >= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"boolObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"intObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"floatObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"doubleObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"stringObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"dataObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"dateObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"decimalObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"objectIdObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"uuidObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"anyBoolObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"anyIntObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"anyFloatObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"anyDoubleObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"anyStringObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"anyDataObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"anyDateObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"anyDecimalObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"anyObjectIdObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i, @\"anyUUIDObj.@count < %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i, @\"boolObj.@count < %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i, @\"intObj.@count < %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i, @\"floatObj.@count < %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i, @\"doubleObj.@count < %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i, @\"stringObj.@count < %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i, @\"dataObj.@count < %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i, @\"dateObj.@count < %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i, @\"decimalObj.@count < %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i, @\"objectIdObj.@count < %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i, @\"uuidObj.@count < %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"boolObj.@count <= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"intObj.@count <= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"floatObj.@count <= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"doubleObj.@count <= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"stringObj.@count <= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"dataObj.@count <= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"dateObj.@count <= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"decimalObj.@count <= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"objectIdObj.@count <= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"uuidObj.@count <= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"anyBoolObj.@count <= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"anyIntObj.@count <= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"anyFloatObj.@count <= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"anyDoubleObj.@count <= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"anyStringObj.@count <= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"anyDataObj.@count <= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"anyDateObj.@count <= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"anyDecimalObj.@count <= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"anyObjectIdObj.@count <= %@\", @(i));\n        RLMAssertCount(AllPrimitiveArrays, i + 1, @\"anyUUIDObj.@count <= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i + 1, @\"boolObj.@count <= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i + 1, @\"intObj.@count <= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i + 1, @\"floatObj.@count <= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i + 1, @\"doubleObj.@count <= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i + 1, @\"stringObj.@count <= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i + 1, @\"dataObj.@count <= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i + 1, @\"dateObj.@count <= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i + 1, @\"decimalObj.@count <= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i + 1, @\"objectIdObj.@count <= %@\", @(i));\n        RLMAssertCount(AllOptionalPrimitiveArrays, i + 1, @\"uuidObj.@count <= %@\", @(i));\n    }\n}\n\n- (void)testQuerySum {\n    [realm deleteAllObjects];\n\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"boolObj.@sum = %@\", @NO]),\n                              @\"Invalid keypath 'boolObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"stringObj.@sum = %@\", @\"a\"]),\n                              @\"Invalid keypath 'stringObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"dataObj.@sum = %@\", data(1)]),\n                              @\"Invalid keypath 'dataObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"objectIdObj.@sum = %@\", objectId(1)]),\n                              @\"Invalid keypath 'objectIdObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"uuidObj.@sum = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\")]),\n                              @\"Invalid keypath 'uuidObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"boolObj.@sum = %@\", @NO]),\n                              @\"Invalid keypath 'boolObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"stringObj.@sum = %@\", @\"a\"]),\n                              @\"Invalid keypath 'stringObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"dataObj.@sum = %@\", data(1)]),\n                              @\"Invalid keypath 'dataObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"objectIdObj.@sum = %@\", objectId(1)]),\n                              @\"Invalid keypath 'objectIdObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"uuidObj.@sum = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\")]),\n                              @\"Invalid keypath 'uuidObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"dateObj.@sum = %@\", date(1)]),\n                              @\"Cannot sum or average date properties\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"dateObj.@sum = %@\", date(1)]),\n                              @\"Cannot sum or average date properties\");\n\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"intObj.@sum = %@\", @\"a\"]),\n                              @\"@sum on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"floatObj.@sum = %@\", @\"a\"]),\n                              @\"@sum on a property of type float cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"doubleObj.@sum = %@\", @\"a\"]),\n                              @\"@sum on a property of type double cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"decimalObj.@sum = %@\", @\"a\"]),\n                              @\"@sum on a property of type decimal128 cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"intObj.@sum = %@\", @\"a\"]),\n                              @\"@sum on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"floatObj.@sum = %@\", @\"a\"]),\n                              @\"@sum on a property of type float cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"doubleObj.@sum = %@\", @\"a\"]),\n                              @\"@sum on a property of type double cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"decimalObj.@sum = %@\", @\"a\"]),\n                              @\"@sum on a property of type decimal128 cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"intObj.@sum.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'intObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"floatObj.@sum.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'floatObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"doubleObj.@sum.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'doubleObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"decimalObj.@sum.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'decimalObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"intObj.@sum.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'intObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"floatObj.@sum.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'floatObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"doubleObj.@sum.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'doubleObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"decimalObj.@sum.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'decimalObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"intObj.@sum = %@\", NSNull.null]),\n                              @\"@sum on a property of type int cannot be compared with '<null>'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"floatObj.@sum = %@\", NSNull.null]),\n                              @\"@sum on a property of type float cannot be compared with '<null>'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"doubleObj.@sum = %@\", NSNull.null]),\n                              @\"@sum on a property of type double cannot be compared with '<null>'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"decimalObj.@sum = %@\", NSNull.null]),\n                              @\"@sum on a property of type decimal128 cannot be compared with '<null>'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"intObj.@sum = %@\", NSNull.null]),\n                              @\"@sum on a property of type int cannot be compared with '<null>'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"floatObj.@sum = %@\", NSNull.null]),\n                              @\"@sum on a property of type float cannot be compared with '<null>'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"doubleObj.@sum = %@\", NSNull.null]),\n                              @\"@sum on a property of type double cannot be compared with '<null>'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"decimalObj.@sum = %@\", NSNull.null]),\n                              @\"@sum on a property of type decimal128 cannot be compared with '<null>'\");\n\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[],\n        @\"floatObj\": @[],\n        @\"doubleObj\": @[],\n        @\"decimalObj\": @[],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[],\n        @\"floatObj\": @[],\n        @\"doubleObj\": @[],\n        @\"decimalObj\": @[],\n    }];\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[@2],\n        @\"floatObj\": @[@2.2f],\n        @\"doubleObj\": @[@2.2],\n        @\"decimalObj\": @[decimal128(2)],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[@2],\n        @\"floatObj\": @[@2.2f],\n        @\"doubleObj\": @[@2.2],\n        @\"decimalObj\": @[decimal128(2)],\n    }];\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[@2, @2],\n        @\"floatObj\": @[@2.2f, @2.2f],\n        @\"doubleObj\": @[@2.2, @2.2],\n        @\"decimalObj\": @[decimal128(2), decimal128(2)],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[@2, @2],\n        @\"floatObj\": @[@2.2f, @2.2f],\n        @\"doubleObj\": @[@2.2, @2.2],\n        @\"decimalObj\": @[decimal128(2), decimal128(2)],\n    }];\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[@2, @2, @2],\n        @\"floatObj\": @[@2.2f, @2.2f, @2.2f],\n        @\"doubleObj\": @[@2.2, @2.2, @2.2],\n        @\"decimalObj\": @[decimal128(2), decimal128(2), decimal128(2)],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[@2, @2, @2],\n        @\"floatObj\": @[@2.2f, @2.2f, @2.2f],\n        @\"doubleObj\": @[@2.2, @2.2, @2.2],\n        @\"decimalObj\": @[decimal128(2), decimal128(2), decimal128(2)],\n    }];\n\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"intObj.@sum == %@\", @0);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"floatObj.@sum == %@\", @0);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"doubleObj.@sum == %@\", @0);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"decimalObj.@sum == %@\", @0);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"intObj.@sum == %@\", @0);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"floatObj.@sum == %@\", @0);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"doubleObj.@sum == %@\", @0);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"decimalObj.@sum == %@\", @0);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"intObj.@sum == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"floatObj.@sum == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"doubleObj.@sum == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"decimalObj.@sum == %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"intObj.@sum == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"floatObj.@sum == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"doubleObj.@sum == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"decimalObj.@sum == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"intObj.@sum != %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"floatObj.@sum != %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"doubleObj.@sum != %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"decimalObj.@sum != %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"intObj.@sum != %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"floatObj.@sum != %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"doubleObj.@sum != %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"decimalObj.@sum != %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"intObj.@sum >= %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"floatObj.@sum >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"doubleObj.@sum >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"decimalObj.@sum >= %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"intObj.@sum >= %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"floatObj.@sum >= %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"doubleObj.@sum >= %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"decimalObj.@sum >= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"intObj.@sum > %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"floatObj.@sum > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"doubleObj.@sum > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"decimalObj.@sum > %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"intObj.@sum > %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"floatObj.@sum > %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"doubleObj.@sum > %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"decimalObj.@sum > %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"intObj.@sum < %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"floatObj.@sum < %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"doubleObj.@sum < %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"decimalObj.@sum < %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"intObj.@sum < %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"floatObj.@sum < %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"doubleObj.@sum < %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"decimalObj.@sum < %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"intObj.@sum <= %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"floatObj.@sum <= %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"doubleObj.@sum <= %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"decimalObj.@sum <= %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"intObj.@sum <= %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"floatObj.@sum <= %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"doubleObj.@sum <= %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"decimalObj.@sum <= %@\", decimal128(3));\n}\n\n- (void)testQueryAverage {\n    [realm deleteAllObjects];\n\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"boolObj.@avg = %@\", @NO]),\n                              @\"Invalid keypath 'boolObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"stringObj.@avg = %@\", @\"a\"]),\n                              @\"Invalid keypath 'stringObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"dataObj.@avg = %@\", data(1)]),\n                              @\"Invalid keypath 'dataObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"objectIdObj.@avg = %@\", objectId(1)]),\n                              @\"Invalid keypath 'objectIdObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"uuidObj.@avg = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\")]),\n                              @\"Invalid keypath 'uuidObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"boolObj.@avg = %@\", @NO]),\n                              @\"Invalid keypath 'boolObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"stringObj.@avg = %@\", @\"a\"]),\n                              @\"Invalid keypath 'stringObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"dataObj.@avg = %@\", data(1)]),\n                              @\"Invalid keypath 'dataObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"objectIdObj.@avg = %@\", objectId(1)]),\n                              @\"Invalid keypath 'objectIdObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"uuidObj.@avg = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\")]),\n                              @\"Invalid keypath 'uuidObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"dateObj.@avg = %@\", date(1)]),\n                              @\"Cannot sum or average date properties\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"dateObj.@avg = %@\", date(1)]),\n                              @\"Cannot sum or average date properties\");\n\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"intObj.@avg = %@\", @\"a\"]),\n                              @\"@avg on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"floatObj.@avg = %@\", @\"a\"]),\n                              @\"@avg on a property of type float cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"doubleObj.@avg = %@\", @\"a\"]),\n                              @\"@avg on a property of type double cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"decimalObj.@avg = %@\", @\"a\"]),\n                              @\"@avg on a property of type decimal128 cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"intObj.@avg = %@\", @\"a\"]),\n                              @\"@avg on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"floatObj.@avg = %@\", @\"a\"]),\n                              @\"@avg on a property of type float cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"doubleObj.@avg = %@\", @\"a\"]),\n                              @\"@avg on a property of type double cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"decimalObj.@avg = %@\", @\"a\"]),\n                              @\"@avg on a property of type decimal128 cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"intObj.@avg.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'intObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"floatObj.@avg.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'floatObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"doubleObj.@avg.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'doubleObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"decimalObj.@avg.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'decimalObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"intObj.@avg.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'intObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"floatObj.@avg.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'floatObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"doubleObj.@avg.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'doubleObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"decimalObj.@avg.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'decimalObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[],\n        @\"floatObj\": @[],\n        @\"doubleObj\": @[],\n        @\"decimalObj\": @[],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[],\n        @\"floatObj\": @[],\n        @\"doubleObj\": @[],\n        @\"decimalObj\": @[],\n    }];\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[@2],\n        @\"floatObj\": @[@2.2f],\n        @\"doubleObj\": @[@2.2],\n        @\"decimalObj\": @[decimal128(2)],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[@2],\n        @\"floatObj\": @[@2.2f],\n        @\"doubleObj\": @[@2.2],\n        @\"decimalObj\": @[decimal128(2)],\n    }];\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[@2, @3],\n        @\"floatObj\": @[@2.2f, @3.3f],\n        @\"doubleObj\": @[@2.2, @3.3],\n        @\"decimalObj\": @[decimal128(2), decimal128(3)],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[@2, @3],\n        @\"floatObj\": @[@2.2f, @3.3f],\n        @\"doubleObj\": @[@2.2, @3.3],\n        @\"decimalObj\": @[decimal128(2), decimal128(3)],\n    }];\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[@3],\n        @\"floatObj\": @[@3.3f],\n        @\"doubleObj\": @[@3.3],\n        @\"decimalObj\": @[decimal128(3)],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[@3],\n        @\"floatObj\": @[@3.3f],\n        @\"doubleObj\": @[@3.3],\n        @\"decimalObj\": @[decimal128(3)],\n    }];\n\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"intObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"floatObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"doubleObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"decimalObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"intObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"floatObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"doubleObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"decimalObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"intObj.@avg == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"floatObj.@avg == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"doubleObj.@avg == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"decimalObj.@avg == %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"intObj.@avg == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"floatObj.@avg == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"doubleObj.@avg == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"decimalObj.@avg == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"intObj.@avg != %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"floatObj.@avg != %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"doubleObj.@avg != %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"decimalObj.@avg != %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"intObj.@avg != %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"floatObj.@avg != %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"doubleObj.@avg != %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"decimalObj.@avg != %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"intObj.@avg >= %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"floatObj.@avg >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"doubleObj.@avg >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"decimalObj.@avg >= %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"intObj.@avg >= %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"floatObj.@avg >= %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"doubleObj.@avg >= %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"decimalObj.@avg >= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"intObj.@avg > %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"floatObj.@avg > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"doubleObj.@avg > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"decimalObj.@avg > %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"intObj.@avg > %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"floatObj.@avg > %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"doubleObj.@avg > %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"decimalObj.@avg > %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"intObj.@avg < %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"floatObj.@avg < %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"doubleObj.@avg < %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"decimalObj.@avg < %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"intObj.@avg < %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"floatObj.@avg < %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"doubleObj.@avg < %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"decimalObj.@avg < %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"intObj.@avg <= %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"floatObj.@avg <= %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"doubleObj.@avg <= %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 3U, @\"decimalObj.@avg <= %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"intObj.@avg <= %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"floatObj.@avg <= %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"doubleObj.@avg <= %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 3U, @\"decimalObj.@avg <= %@\", decimal128(3));\n}\n\n- (void)testQueryMin {\n    [realm deleteAllObjects];\n\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"boolObj.@min = %@\", @NO]),\n                              @\"Invalid keypath 'boolObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"stringObj.@min = %@\", @\"a\"]),\n                              @\"Invalid keypath 'stringObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"dataObj.@min = %@\", data(1)]),\n                              @\"Invalid keypath 'dataObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"objectIdObj.@min = %@\", objectId(1)]),\n                              @\"Invalid keypath 'objectIdObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"uuidObj.@min = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\")]),\n                              @\"Invalid keypath 'uuidObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"boolObj.@min = %@\", @NO]),\n                              @\"Invalid keypath 'boolObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"stringObj.@min = %@\", @\"a\"]),\n                              @\"Invalid keypath 'stringObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"dataObj.@min = %@\", data(1)]),\n                              @\"Invalid keypath 'dataObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"objectIdObj.@min = %@\", objectId(1)]),\n                              @\"Invalid keypath 'objectIdObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"uuidObj.@min = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\")]),\n                              @\"Invalid keypath 'uuidObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"intObj.@min = %@\", @\"a\"]),\n                              @\"@min on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"floatObj.@min = %@\", @\"a\"]),\n                              @\"@min on a property of type float cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"doubleObj.@min = %@\", @\"a\"]),\n                              @\"@min on a property of type double cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"dateObj.@min = %@\", @\"a\"]),\n                              @\"@min on a property of type date cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"decimalObj.@min = %@\", @\"a\"]),\n                              @\"@min on a property of type decimal128 cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"intObj.@min = %@\", @\"a\"]),\n                              @\"@min on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"floatObj.@min = %@\", @\"a\"]),\n                              @\"@min on a property of type float cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"doubleObj.@min = %@\", @\"a\"]),\n                              @\"@min on a property of type double cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"dateObj.@min = %@\", @\"a\"]),\n                              @\"@min on a property of type date cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"decimalObj.@min = %@\", @\"a\"]),\n                              @\"@min on a property of type decimal128 cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"intObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'intObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"floatObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'floatObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"doubleObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'doubleObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"dateObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'dateObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"decimalObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'decimalObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"anyIntObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyIntObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"anyFloatObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyFloatObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"anyDoubleObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyDoubleObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"anyDateObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyDateObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"anyDecimalObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyDecimalObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"intObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'intObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"floatObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'floatObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"doubleObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'doubleObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"dateObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'dateObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"decimalObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'decimalObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n\n    // No objects, so count is zero\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"floatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"doubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"decimalObj.@min == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyIntObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyFloatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDoubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDecimalObj.@min == %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"floatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"doubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"decimalObj.@min == %@\", decimal128(2));\n\n    [AllPrimitiveArrays createInRealm:realm withValue:@{}];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{}];\n\n    // Only empty arrays, so count is zero\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"floatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"doubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"decimalObj.@min == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyIntObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyFloatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDoubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDecimalObj.@min == %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"floatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"doubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"decimalObj.@min == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"intObj.@min == %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"floatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"doubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"dateObj.@min == %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"decimalObj.@min == %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyIntObj.@min == %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyFloatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDoubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDateObj.@min == %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDecimalObj.@min == %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"intObj.@min == %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"floatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"doubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"dateObj.@min == %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"decimalObj.@min == %@\", decimal128(3));\n\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"intObj.@min == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"floatObj.@min == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"doubleObj.@min == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"dateObj.@min == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"decimalObj.@min == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyIntObj.@min == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyFloatObj.@min == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDoubleObj.@min == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDateObj.@min == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDecimalObj.@min == nil\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"intObj.@min == nil\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"floatObj.@min == nil\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"doubleObj.@min == nil\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"dateObj.@min == nil\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"decimalObj.@min == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"intObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"floatObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"doubleObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"dateObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"decimalObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyIntObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyFloatObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDoubleObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDateObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDecimalObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"intObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"floatObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"doubleObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"dateObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"decimalObj.@min == %@\", NSNull.null);\n\n    [self createObjectWithValueIndex:0];\n\n    // One object where v0 is min and zero with v1\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"floatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"doubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"decimalObj.@min == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyIntObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyFloatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDoubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDecimalObj.@min == %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"floatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"doubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"decimalObj.@min == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"intObj.@min == %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"floatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"doubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"dateObj.@min == %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"decimalObj.@min == %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyIntObj.@min == %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyFloatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDoubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDateObj.@min == %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDecimalObj.@min == %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"intObj.@min == %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"floatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"doubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"dateObj.@min == %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"decimalObj.@min == %@\", decimal128(3));\n\n    [self createObjectWithValueIndex:1];\n\n    // One object where v0 is min and one with v1\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"floatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"doubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"decimalObj.@min == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyIntObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyFloatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDoubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDecimalObj.@min == %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"floatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"doubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"decimalObj.@min == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"intObj.@min == %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"floatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"doubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"dateObj.@min == %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"decimalObj.@min == %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyIntObj.@min == %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyFloatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDoubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDateObj.@min == %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDecimalObj.@min == %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"intObj.@min == %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"floatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"doubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"dateObj.@min == %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"decimalObj.@min == %@\", decimal128(3));\n\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[@3, @2],\n        @\"floatObj\": @[@3.3f, @2.2f],\n        @\"doubleObj\": @[@3.3, @2.2],\n        @\"dateObj\": @[date(2), date(1)],\n        @\"decimalObj\": @[decimal128(3), decimal128(2)],\n        @\"anyIntObj\": @[@3, @2],\n        @\"anyFloatObj\": @[@3.3f, @2.2f],\n        @\"anyDoubleObj\": @[@3.3, @2.2],\n        @\"anyDateObj\": @[date(2), date(1)],\n        @\"anyDecimalObj\": @[decimal128(3), decimal128(2)],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[@3, @2],\n        @\"floatObj\": @[@3.3f, @2.2f],\n        @\"doubleObj\": @[@3.3, @2.2],\n        @\"dateObj\": @[date(2), date(1)],\n        @\"decimalObj\": @[decimal128(3), decimal128(2)],\n    }];\n\n    // New object with both v0 and v1 matches v0 but not v1\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"floatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"doubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"decimalObj.@min == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyIntObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyFloatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyDoubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyDateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyDecimalObj.@min == %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"floatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"doubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"decimalObj.@min == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"intObj.@min == %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"floatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"doubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"dateObj.@min == %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"decimalObj.@min == %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyIntObj.@min == %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyFloatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDoubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDateObj.@min == %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDecimalObj.@min == %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"intObj.@min == %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"floatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"doubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"dateObj.@min == %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"decimalObj.@min == %@\", decimal128(3));\n}\n\n- (void)testQueryMax {\n    [realm deleteAllObjects];\n\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"boolObj.@max = %@\", @NO]),\n                              @\"Invalid keypath 'boolObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"stringObj.@max = %@\", @\"a\"]),\n                              @\"Invalid keypath 'stringObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"dataObj.@max = %@\", data(1)]),\n                              @\"Invalid keypath 'dataObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"objectIdObj.@max = %@\", objectId(1)]),\n                              @\"Invalid keypath 'objectIdObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"uuidObj.@max = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\")]),\n                              @\"Invalid keypath 'uuidObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"boolObj.@max = %@\", @NO]),\n                              @\"Invalid keypath 'boolObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"stringObj.@max = %@\", @\"a\"]),\n                              @\"Invalid keypath 'stringObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"dataObj.@max = %@\", data(1)]),\n                              @\"Invalid keypath 'dataObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"objectIdObj.@max = %@\", objectId(1)]),\n                              @\"Invalid keypath 'objectIdObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"uuidObj.@max = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\")]),\n                              @\"Invalid keypath 'uuidObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"intObj.@max = %@\", @\"a\"]),\n                              @\"@max on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"floatObj.@max = %@\", @\"a\"]),\n                              @\"@max on a property of type float cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"doubleObj.@max = %@\", @\"a\"]),\n                              @\"@max on a property of type double cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"dateObj.@max = %@\", @\"a\"]),\n                              @\"@max on a property of type date cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"decimalObj.@max = %@\", @\"a\"]),\n                              @\"@max on a property of type decimal128 cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"intObj.@max = %@\", @\"a\"]),\n                              @\"@max on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"floatObj.@max = %@\", @\"a\"]),\n                              @\"@max on a property of type float cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"doubleObj.@max = %@\", @\"a\"]),\n                              @\"@max on a property of type double cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"dateObj.@max = %@\", @\"a\"]),\n                              @\"@max on a property of type date cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"decimalObj.@max = %@\", @\"a\"]),\n                              @\"@max on a property of type decimal128 cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"intObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'intObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"floatObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'floatObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"doubleObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'doubleObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"dateObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'dateObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"decimalObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'decimalObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"anyIntObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyIntObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"anyFloatObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyFloatObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"anyDoubleObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyDoubleObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"anyDateObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyDateObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveArrays objectsInRealm:realm where:@\"anyDecimalObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyDecimalObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"intObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'intObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"floatObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'floatObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"doubleObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'doubleObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"dateObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'dateObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveArrays objectsInRealm:realm where:@\"decimalObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'decimalObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n\n    // No objects, so count is zero\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"floatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"doubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"decimalObj.@max == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyIntObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyFloatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDoubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDecimalObj.@max == %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"floatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"doubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"decimalObj.@max == %@\", decimal128(2));\n\n    [AllPrimitiveArrays createInRealm:realm withValue:@{}];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{}];\n\n    // Only empty arrays, so count is zero\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"floatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"doubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"decimalObj.@max == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyIntObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyFloatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDoubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDecimalObj.@max == %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"floatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"doubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"decimalObj.@max == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"intObj.@max == %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"floatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"doubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"dateObj.@max == %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"decimalObj.@max == %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyIntObj.@max == %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyFloatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDoubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDateObj.@max == %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDecimalObj.@max == %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"intObj.@max == %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"floatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"doubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"dateObj.@max == %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"decimalObj.@max == %@\", decimal128(3));\n\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"intObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"floatObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"doubleObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"dateObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"decimalObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyIntObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyFloatObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDoubleObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDateObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDecimalObj.@max == nil\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"intObj.@max == nil\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"floatObj.@max == nil\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"doubleObj.@max == nil\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"dateObj.@max == nil\");\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"decimalObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"intObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"floatObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"doubleObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"dateObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"decimalObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyIntObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyFloatObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDoubleObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDateObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDecimalObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"intObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"floatObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"doubleObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"dateObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"decimalObj.@max == %@\", NSNull.null);\n\n    [self createObjectWithValueIndex:0];\n\n    // One object where v0 is min and zero with v1\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"floatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"doubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"decimalObj.@max == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyIntObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyFloatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDoubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDecimalObj.@max == %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"floatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"doubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"decimalObj.@max == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"intObj.@max == %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"floatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"doubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"dateObj.@max == %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"decimalObj.@max == %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyIntObj.@max == %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyFloatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDoubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDateObj.@max == %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 0U, @\"anyDecimalObj.@max == %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"intObj.@max == %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"floatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"doubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"dateObj.@max == %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 0U, @\"decimalObj.@max == %@\", decimal128(3));\n\n    [self createObjectWithValueIndex:1];\n\n    // One object where v0 is min and one with v1\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"floatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"doubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"decimalObj.@max == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyIntObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyFloatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDoubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDecimalObj.@max == %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"floatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"doubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"decimalObj.@max == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"intObj.@max == %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"floatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"doubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"dateObj.@max == %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"decimalObj.@max == %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyIntObj.@max == %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyFloatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDoubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDateObj.@max == %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDecimalObj.@max == %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"intObj.@max == %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"floatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"doubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"dateObj.@max == %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"decimalObj.@max == %@\", decimal128(3));\n\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[@3, @2],\n        @\"floatObj\": @[@3.3f, @2.2f],\n        @\"doubleObj\": @[@3.3, @2.2],\n        @\"dateObj\": @[date(2), date(1)],\n        @\"decimalObj\": @[decimal128(3), decimal128(2)],\n        @\"anyIntObj\": @[@3, @2],\n        @\"anyFloatObj\": @[@3.3f, @2.2f],\n        @\"anyDoubleObj\": @[@3.3, @2.2],\n        @\"anyDateObj\": @[date(2), date(1)],\n        @\"anyDecimalObj\": @[decimal128(3), decimal128(2)],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        @\"intObj\": @[@3, @2],\n        @\"floatObj\": @[@3.3f, @2.2f],\n        @\"doubleObj\": @[@3.3, @2.2],\n        @\"dateObj\": @[date(2), date(1)],\n        @\"decimalObj\": @[decimal128(3), decimal128(2)],\n    }];\n\n    // New object with both v0 and v1 matches v1 but not v0\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"floatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"doubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"decimalObj.@max == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyIntObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyFloatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDoubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveArrays, 1U, @\"anyDecimalObj.@max == %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"floatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"doubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 1U, @\"decimalObj.@max == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"intObj.@max == %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"floatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"doubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"dateObj.@max == %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"decimalObj.@max == %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyIntObj.@max == %@\", @3);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyFloatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyDoubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyDateObj.@max == %@\", date(2));\n    RLMAssertCount(AllPrimitiveArrays, 2U, @\"anyDecimalObj.@max == %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"intObj.@max == %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"floatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"doubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"dateObj.@max == %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveArrays, 2U, @\"decimalObj.@max == %@\", decimal128(3));\n}\n\n- (void)testQueryBasicOperatorsOverLink {\n    [realm deleteAllObjects];\n\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.boolObj = %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.intObj = %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.floatObj = %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.doubleObj = %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.stringObj = %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dataObj = %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dateObj = %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.decimalObj = %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.objectIdObj = %@\", objectId(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.uuidObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyBoolObj = %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyIntObj = %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyFloatObj = %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDoubleObj = %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyStringObj = %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDataObj = %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDateObj = %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDecimalObj = %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyObjectIdObj = %@\", objectId(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyUUIDObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.boolObj = %@\", @NO);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.intObj = %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.floatObj = %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.doubleObj = %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.stringObj = %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dataObj = %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dateObj = %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.decimalObj = %@\", decimal128(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.objectIdObj = %@\", objectId(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.uuidObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.boolObj != %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.intObj != %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.floatObj != %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.doubleObj != %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.stringObj != %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dataObj != %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dateObj != %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.decimalObj != %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.objectIdObj != %@\", objectId(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.uuidObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyBoolObj != %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyIntObj != %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyFloatObj != %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDoubleObj != %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyStringObj != %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDataObj != %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDateObj != %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDecimalObj != %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyObjectIdObj != %@\", objectId(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyUUIDObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.boolObj != %@\", @NO);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.intObj != %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.floatObj != %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.doubleObj != %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.stringObj != %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dataObj != %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dateObj != %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.decimalObj != %@\", decimal128(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.objectIdObj != %@\", objectId(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.uuidObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.intObj > %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.floatObj > %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.doubleObj > %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.stringObj > %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dataObj > %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dateObj > %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.decimalObj > %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyIntObj > %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyFloatObj > %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDoubleObj > %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyStringObj > %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDataObj > %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDateObj > %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDecimalObj > %@\", decimal128(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.intObj > %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.floatObj > %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.doubleObj > %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.stringObj > %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dataObj > %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dateObj > %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.decimalObj > %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.intObj >= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.floatObj >= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.doubleObj >= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.stringObj >= %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dataObj >= %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dateObj >= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.decimalObj >= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyIntObj >= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyFloatObj >= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDoubleObj >= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyStringObj >= %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDataObj >= %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDateObj >= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDecimalObj >= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.intObj >= %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.floatObj >= %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.doubleObj >= %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.stringObj >= %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dataObj >= %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dateObj >= %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.decimalObj >= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.intObj < %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.floatObj < %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.doubleObj < %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.stringObj < %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dataObj < %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dateObj < %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.decimalObj < %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyIntObj < %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyFloatObj < %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDoubleObj < %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyStringObj < %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDataObj < %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDateObj < %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDecimalObj < %@\", decimal128(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.intObj < %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.floatObj < %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.doubleObj < %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.stringObj < %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dataObj < %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dateObj < %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.decimalObj < %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.intObj <= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.floatObj <= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.doubleObj <= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.stringObj <= %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dataObj <= %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dateObj <= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.decimalObj <= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyIntObj <= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyFloatObj <= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDoubleObj <= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyStringObj <= %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDataObj <= %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDateObj <= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDecimalObj <= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.intObj <= %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.floatObj <= %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.doubleObj <= %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.stringObj <= %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dataObj <= %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dateObj <= %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.decimalObj <= %@\", decimal128(2));\n\n    [self createObjectWithValueIndex:0];\n\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.boolObj = %@\", @YES);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.intObj = %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.floatObj = %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.doubleObj = %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.stringObj = %@\", @\"b\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dataObj = %@\", data(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dateObj = %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.decimalObj = %@\", decimal128(3));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.objectIdObj = %@\", objectId(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.uuidObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyBoolObj = %@\", @YES);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyIntObj = %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyFloatObj = %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDoubleObj = %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyStringObj = %@\", @\"b\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDataObj = %@\", data(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDateObj = %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDecimalObj = %@\", decimal128(3));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyObjectIdObj = %@\", objectId(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyUUIDObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.boolObj = %@\", @YES);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.intObj = %@\", @3);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.floatObj = %@\", @3.3f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.doubleObj = %@\", @3.3);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.stringObj = %@\", @\"b\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dataObj = %@\", data(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dateObj = %@\", date(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.decimalObj = %@\", decimal128(3));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.objectIdObj = %@\", objectId(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.uuidObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.boolObj = %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.intObj = %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.floatObj = %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.doubleObj = %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.stringObj = %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dataObj = %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dateObj = %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.decimalObj = %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.objectIdObj = %@\", objectId(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.uuidObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyBoolObj = %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyIntObj = %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyFloatObj = %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDoubleObj = %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyStringObj = %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDataObj = %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDateObj = %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDecimalObj = %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyObjectIdObj = %@\", objectId(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyUUIDObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.boolObj = %@\", @NO);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.intObj = %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.floatObj = %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.doubleObj = %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.stringObj = %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dataObj = %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dateObj = %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.decimalObj = %@\", decimal128(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.objectIdObj = %@\", objectId(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.uuidObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.boolObj != %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.intObj != %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.floatObj != %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.doubleObj != %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.stringObj != %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dataObj != %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dateObj != %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.decimalObj != %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.objectIdObj != %@\", objectId(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.uuidObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyBoolObj != %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyIntObj != %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyFloatObj != %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDoubleObj != %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyStringObj != %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDataObj != %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDateObj != %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDecimalObj != %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyObjectIdObj != %@\", objectId(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyUUIDObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.boolObj != %@\", @NO);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.intObj != %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.floatObj != %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.doubleObj != %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.stringObj != %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dataObj != %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dateObj != %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.decimalObj != %@\", decimal128(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.objectIdObj != %@\", objectId(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.uuidObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.boolObj != %@\", @YES);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.intObj != %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.floatObj != %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.doubleObj != %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.stringObj != %@\", @\"b\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dataObj != %@\", data(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dateObj != %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.decimalObj != %@\", decimal128(3));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.objectIdObj != %@\", objectId(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.uuidObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyBoolObj != %@\", @YES);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyIntObj != %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyFloatObj != %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDoubleObj != %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyStringObj != %@\", @\"b\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDataObj != %@\", data(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDateObj != %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDecimalObj != %@\", decimal128(3));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyObjectIdObj != %@\", objectId(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyUUIDObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.boolObj != %@\", @YES);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.intObj != %@\", @3);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.floatObj != %@\", @3.3f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.doubleObj != %@\", @3.3);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.stringObj != %@\", @\"b\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dataObj != %@\", data(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dateObj != %@\", date(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.decimalObj != %@\", decimal128(3));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.objectIdObj != %@\", objectId(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.uuidObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.intObj > %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.floatObj > %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.doubleObj > %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.stringObj > %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dataObj > %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dateObj > %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.decimalObj > %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyIntObj > %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyFloatObj > %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDoubleObj > %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyStringObj > %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDataObj > %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDateObj > %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDecimalObj > %@\", decimal128(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.intObj > %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.floatObj > %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.doubleObj > %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.stringObj > %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dataObj > %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dateObj > %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.decimalObj > %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.intObj >= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.floatObj >= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.doubleObj >= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.stringObj >= %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dataObj >= %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dateObj >= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.decimalObj >= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyIntObj >= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyFloatObj >= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDoubleObj >= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyStringObj >= %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDataObj >= %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDateObj >= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDecimalObj >= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.intObj >= %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.floatObj >= %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.doubleObj >= %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.stringObj >= %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dataObj >= %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dateObj >= %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.decimalObj >= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.intObj < %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.floatObj < %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.doubleObj < %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.stringObj < %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dataObj < %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dateObj < %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.decimalObj < %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyIntObj < %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyFloatObj < %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDoubleObj < %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyStringObj < %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDataObj < %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDateObj < %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDecimalObj < %@\", decimal128(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.intObj < %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.floatObj < %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.doubleObj < %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.stringObj < %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dataObj < %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dateObj < %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.decimalObj < %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.intObj < %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.floatObj < %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.doubleObj < %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.stringObj < %@\", @\"b\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dataObj < %@\", data(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dateObj < %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.decimalObj < %@\", decimal128(3));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyIntObj < %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyFloatObj < %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDoubleObj < %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyStringObj < %@\", @\"b\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDataObj < %@\", data(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDateObj < %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDecimalObj < %@\", decimal128(3));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.intObj < %@\", @3);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.floatObj < %@\", @3.3f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.doubleObj < %@\", @3.3);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.stringObj < %@\", @\"b\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dataObj < %@\", data(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dateObj < %@\", date(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.decimalObj < %@\", decimal128(3));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.intObj <= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.floatObj <= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.doubleObj <= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.stringObj <= %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dataObj <= %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dateObj <= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.decimalObj <= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyIntObj <= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyFloatObj <= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDoubleObj <= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyStringObj <= %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDataObj <= %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDateObj <= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDecimalObj <= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.intObj <= %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.floatObj <= %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.doubleObj <= %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.stringObj <= %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dataObj <= %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dateObj <= %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.decimalObj <= %@\", decimal128(2));\n\n    [self createObjectWithValueIndex:1];\n\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.boolObj = %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.intObj = %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.floatObj = %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.doubleObj = %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.stringObj = %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dataObj = %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dateObj = %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.decimalObj = %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.objectIdObj = %@\", objectId(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.uuidObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyBoolObj = %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyIntObj = %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyFloatObj = %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDoubleObj = %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyStringObj = %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDataObj = %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDateObj = %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDecimalObj = %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyObjectIdObj = %@\", objectId(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyUUIDObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.boolObj = %@\", @NO);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.intObj = %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.floatObj = %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.doubleObj = %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.stringObj = %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dataObj = %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dateObj = %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.decimalObj = %@\", decimal128(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.objectIdObj = %@\", objectId(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.uuidObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.boolObj = %@\", @YES);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.intObj = %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.floatObj = %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.doubleObj = %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.stringObj = %@\", @\"b\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dataObj = %@\", data(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dateObj = %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.decimalObj = %@\", decimal128(3));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.objectIdObj = %@\", objectId(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.uuidObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyBoolObj = %@\", @YES);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyIntObj = %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyFloatObj = %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDoubleObj = %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyStringObj = %@\", @\"b\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDataObj = %@\", data(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDateObj = %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDecimalObj = %@\", decimal128(3));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyObjectIdObj = %@\", objectId(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyUUIDObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.boolObj = %@\", @YES);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.intObj = %@\", @3);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.floatObj = %@\", @3.3f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.doubleObj = %@\", @3.3);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.stringObj = %@\", @\"b\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dataObj = %@\", data(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dateObj = %@\", date(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.decimalObj = %@\", decimal128(3));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.objectIdObj = %@\", objectId(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.uuidObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.boolObj != %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.intObj != %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.floatObj != %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.doubleObj != %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.stringObj != %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dataObj != %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dateObj != %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.decimalObj != %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.objectIdObj != %@\", objectId(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.uuidObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyBoolObj != %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyIntObj != %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyFloatObj != %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDoubleObj != %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyStringObj != %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDataObj != %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDateObj != %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDecimalObj != %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyObjectIdObj != %@\", objectId(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyUUIDObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.boolObj != %@\", @NO);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.intObj != %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.floatObj != %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.doubleObj != %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.stringObj != %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dataObj != %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dateObj != %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.decimalObj != %@\", decimal128(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.objectIdObj != %@\", objectId(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.uuidObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.boolObj != %@\", @YES);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.intObj != %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.floatObj != %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.doubleObj != %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.stringObj != %@\", @\"b\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dataObj != %@\", data(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dateObj != %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.decimalObj != %@\", decimal128(3));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.objectIdObj != %@\", objectId(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.uuidObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyBoolObj != %@\", @YES);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyIntObj != %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyFloatObj != %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDoubleObj != %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyStringObj != %@\", @\"b\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDataObj != %@\", data(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDateObj != %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDecimalObj != %@\", decimal128(3));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyObjectIdObj != %@\", objectId(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyUUIDObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.boolObj != %@\", @YES);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.intObj != %@\", @3);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.floatObj != %@\", @3.3f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.doubleObj != %@\", @3.3);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.stringObj != %@\", @\"b\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dataObj != %@\", data(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dateObj != %@\", date(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.decimalObj != %@\", decimal128(3));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.objectIdObj != %@\", objectId(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.uuidObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.intObj > %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.floatObj > %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.doubleObj > %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.stringObj > %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dataObj > %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dateObj > %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.decimalObj > %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyIntObj > %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyFloatObj > %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDoubleObj > %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyStringObj > %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDataObj > %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDateObj > %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDecimalObj > %@\", decimal128(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.intObj > %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.floatObj > %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.doubleObj > %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.stringObj > %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dataObj > %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dateObj > %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.decimalObj > %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.intObj >= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.floatObj >= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.doubleObj >= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.stringObj >= %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.dataObj >= %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.dateObj >= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.decimalObj >= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.anyIntObj >= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.anyFloatObj >= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.anyDoubleObj >= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.anyStringObj >= %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.anyDataObj >= %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.anyDateObj >= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.anyDecimalObj >= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 2, @\"ANY link.intObj >= %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 2, @\"ANY link.floatObj >= %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 2, @\"ANY link.doubleObj >= %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 2, @\"ANY link.stringObj >= %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 2, @\"ANY link.dataObj >= %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 2, @\"ANY link.dateObj >= %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 2, @\"ANY link.decimalObj >= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.intObj < %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.floatObj < %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.doubleObj < %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.stringObj < %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dataObj < %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.dateObj < %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.decimalObj < %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyIntObj < %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyFloatObj < %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDoubleObj < %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyStringObj < %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDataObj < %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDateObj < %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 0, @\"ANY link.anyDecimalObj < %@\", decimal128(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.intObj < %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.floatObj < %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.doubleObj < %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.stringObj < %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dataObj < %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.dateObj < %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 0, @\"ANY link.decimalObj < %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.intObj < %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.floatObj < %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.doubleObj < %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.stringObj < %@\", @\"b\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dataObj < %@\", data(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dateObj < %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.decimalObj < %@\", decimal128(3));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyIntObj < %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyFloatObj < %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDoubleObj < %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyStringObj < %@\", @\"b\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDataObj < %@\", data(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDateObj < %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDecimalObj < %@\", decimal128(3));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.intObj < %@\", @3);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.floatObj < %@\", @3.3f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.doubleObj < %@\", @3.3);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.stringObj < %@\", @\"b\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dataObj < %@\", data(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dateObj < %@\", date(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.decimalObj < %@\", decimal128(3));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.intObj <= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.floatObj <= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.doubleObj <= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.stringObj <= %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dataObj <= %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.dateObj <= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.decimalObj <= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyIntObj <= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyFloatObj <= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDoubleObj <= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyStringObj <= %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDataObj <= %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDateObj <= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 1, @\"ANY link.anyDecimalObj <= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.intObj <= %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.floatObj <= %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.doubleObj <= %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.stringObj <= %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dataObj <= %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.dateObj <= %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 1, @\"ANY link.decimalObj <= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.intObj <= %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.floatObj <= %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.doubleObj <= %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.stringObj <= %@\", @\"b\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.dataObj <= %@\", data(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.dateObj <= %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.decimalObj <= %@\", decimal128(3));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.anyIntObj <= %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.anyFloatObj <= %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.anyDoubleObj <= %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.anyStringObj <= %@\", @\"b\");\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.anyDataObj <= %@\", data(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.anyDateObj <= %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveArrays, 2, @\"ANY link.anyDecimalObj <= %@\", decimal128(3));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 2, @\"ANY link.intObj <= %@\", @3);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 2, @\"ANY link.floatObj <= %@\", @3.3f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 2, @\"ANY link.doubleObj <= %@\", @3.3);\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 2, @\"ANY link.stringObj <= %@\", @\"b\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 2, @\"ANY link.dataObj <= %@\", data(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 2, @\"ANY link.dateObj <= %@\", date(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveArrays, 2, @\"ANY link.decimalObj <= %@\", decimal128(3));\n\n    RLMAssertThrowsWithReason(([LinkToAllPrimitiveArrays objectsInRealm:realm where:@\"ANY link.boolObj > %@\", @NO]),\n                              @\"Operator '>' not supported for type 'bool'\");\n    RLMAssertThrowsWithReason(([LinkToAllPrimitiveArrays objectsInRealm:realm where:@\"ANY link.objectIdObj > %@\", objectId(1)]),\n                              @\"Operator '>' not supported for type 'object id'\");\n    RLMAssertThrowsWithReason(([LinkToAllPrimitiveArrays objectsInRealm:realm where:@\"ANY link.uuidObj > %@\", uuid(@\"00000000-0000-0000-0000-000000000000\")]),\n                              @\"Operator '>' not supported for type 'uuid'\");\n    RLMAssertThrowsWithReason(([LinkToAllOptionalPrimitiveArrays objectsInRealm:realm where:@\"ANY link.boolObj > %@\", @NO]),\n                              @\"Operator '>' not supported for type 'bool'\");\n    RLMAssertThrowsWithReason(([LinkToAllOptionalPrimitiveArrays objectsInRealm:realm where:@\"ANY link.objectIdObj > %@\", objectId(1)]),\n                              @\"Operator '>' not supported for type 'object id'\");\n    RLMAssertThrowsWithReason(([LinkToAllOptionalPrimitiveArrays objectsInRealm:realm where:@\"ANY link.uuidObj > %@\", uuid(@\"00000000-0000-0000-0000-000000000000\")]),\n                              @\"Operator '>' not supported for type 'uuid'\");\n}\n\n- (void)testSubstringQueries {\n    NSArray *values = @[\n        @\"\",\n\n        @\"á\", @\"ó\", @\"ú\",\n\n        @\"áá\", @\"áó\", @\"áú\",\n        @\"óá\", @\"óó\", @\"óú\",\n        @\"úá\", @\"úó\", @\"úú\",\n\n        @\"ááá\", @\"ááó\", @\"ááú\", @\"áóá\", @\"áóó\", @\"áóú\", @\"áúá\", @\"áúó\", @\"áúú\",\n        @\"óáá\", @\"óáó\", @\"óáú\", @\"óóá\", @\"óóó\", @\"óóú\", @\"óúá\", @\"óúó\", @\"óúú\",\n        @\"úáá\", @\"úáó\", @\"úáú\", @\"úóá\", @\"úóó\", @\"úóú\", @\"úúá\", @\"úúó\", @\"úúú\",\n    ];\n\n    void (^create)(NSString *) = ^(NSString *value) {\n        id obj = [AllPrimitiveArrays createInRealm:realm withValue:@{\n            @\"stringObj\": @[value],\n            @\"dataObj\": @[[value dataUsingEncoding:NSUTF8StringEncoding]]\n        }];\n        [LinkToAllPrimitiveArrays createInRealm:realm withValue:@[obj]];\n        obj = [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n            @\"stringObj\": @[value],\n            @\"dataObj\": @[[value dataUsingEncoding:NSUTF8StringEncoding]]\n        }];\n        [LinkToAllOptionalPrimitiveArrays createInRealm:realm withValue:@[obj]];\n    };\n\n    for (NSString *value in values) {\n        create(value);\n        create(value.uppercaseString);\n        create([value stringByApplyingTransform:NSStringTransformStripDiacritics reverse:NO]);\n        create([value.uppercaseString stringByApplyingTransform:NSStringTransformStripDiacritics reverse:NO]);\n    }\n\n    void (^test)(NSString *, id, NSUInteger) = ^(NSString *operator, NSString *value, NSUInteger count) {\n        NSData *data = [value dataUsingEncoding:NSUTF8StringEncoding];\n\n        NSString *query = [NSString stringWithFormat:@\"ANY stringObj %@ %%@\", operator];\n        RLMAssertCount(AllPrimitiveArrays, count, query, value);\n        RLMAssertCount(AllPrimitiveArrays, count, query, value);\n        RLMAssertCount(AllOptionalPrimitiveArrays, count, query, value);\n        query = [NSString stringWithFormat:@\"ANY link.stringObj %@ %%@\", operator];\n        RLMAssertCount(LinkToAllPrimitiveArrays, count, query, value);\n        RLMAssertCount(LinkToAllPrimitiveArrays, count, query, value);\n        RLMAssertCount(LinkToAllOptionalPrimitiveArrays, count, query, value);\n\n        query = [NSString stringWithFormat:@\"ANY dataObj %@ %%@\", operator];\n        RLMAssertCount(AllPrimitiveArrays, count, query, data);\n        RLMAssertCount(AllPrimitiveArrays, count, query, data);\n        RLMAssertCount(AllOptionalPrimitiveArrays, count, query, data);\n        query = [NSString stringWithFormat:@\"ANY link.dataObj %@ %%@\", operator];\n        RLMAssertCount(LinkToAllPrimitiveArrays, count, query, data);\n        RLMAssertCount(LinkToAllPrimitiveArrays, count, query, data);\n        RLMAssertCount(LinkToAllOptionalPrimitiveArrays, count, query, data);\n    };\n    void (^testNull)(NSString *, NSUInteger) = ^(NSString *operator, NSUInteger count) {\n        NSString *query = [NSString stringWithFormat:@\"ANY stringObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([AllPrimitiveArrays objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'stringObj' of type 'string'\");\n        RLMAssertCount(AllOptionalPrimitiveArrays, count, query, NSNull.null);\n        query = [NSString stringWithFormat:@\"ANY link.stringObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([LinkToAllPrimitiveArrays objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'stringObj' of type 'string'\");\n        RLMAssertCount(LinkToAllOptionalPrimitiveArrays, count, query, NSNull.null);\n\n        query = [NSString stringWithFormat:@\"ANY dataObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([AllPrimitiveArrays objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'dataObj' of type 'data'\");\n        RLMAssertCount(AllOptionalPrimitiveArrays, count, query, NSNull.null);\n\n        query = [NSString stringWithFormat:@\"ANY link.dataObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([LinkToAllPrimitiveArrays objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'dataObj' of type 'data'\");\n        RLMAssertCount(LinkToAllOptionalPrimitiveArrays, count, query, NSNull.null);\n    };\n\n    testNull(@\"==\", 0);\n    test(@\"==\", @\"\", 4);\n    test(@\"==\", @\"a\", 1);\n    test(@\"==\", @\"á\", 1);\n    test(@\"==[c]\", @\"a\", 2);\n    test(@\"==[c]\", @\"á\", 2);\n    test(@\"==\", @\"A\", 1);\n    test(@\"==\", @\"Á\", 1);\n    test(@\"==[c]\", @\"A\", 2);\n    test(@\"==[c]\", @\"Á\", 2);\n    test(@\"==[d]\", @\"a\", 2);\n    test(@\"==[d]\", @\"á\", 2);\n    test(@\"==[cd]\", @\"a\", 4);\n    test(@\"==[cd]\", @\"á\", 4);\n    test(@\"==[d]\", @\"A\", 2);\n    test(@\"==[d]\", @\"Á\", 2);\n    test(@\"==[cd]\", @\"A\", 4);\n    test(@\"==[cd]\", @\"Á\", 4);\n\n    testNull(@\"!=\", 160);\n    test(@\"!=\", @\"\", 156);\n    test(@\"!=\", @\"a\", 159);\n    test(@\"!=\", @\"á\", 159);\n    test(@\"!=[c]\", @\"a\", 158);\n    test(@\"!=[c]\", @\"á\", 158);\n    test(@\"!=\", @\"A\", 159);\n    test(@\"!=\", @\"Á\", 159);\n    test(@\"!=[c]\", @\"A\", 158);\n    test(@\"!=[c]\", @\"Á\", 158);\n    test(@\"!=[d]\", @\"a\", 158);\n    test(@\"!=[d]\", @\"á\", 158);\n    test(@\"!=[cd]\", @\"a\", 156);\n    test(@\"!=[cd]\", @\"á\", 156);\n    test(@\"!=[d]\", @\"A\", 158);\n    test(@\"!=[d]\", @\"Á\", 158);\n    test(@\"!=[cd]\", @\"A\", 156);\n    test(@\"!=[cd]\", @\"Á\", 156);\n\n    testNull(@\"CONTAINS\", 0);\n    testNull(@\"CONTAINS[c]\", 0);\n    testNull(@\"CONTAINS[d]\", 0);\n    testNull(@\"CONTAINS[cd]\", 0);\n    test(@\"CONTAINS\", @\"a\", 25);\n    test(@\"CONTAINS\", @\"á\", 25);\n    test(@\"CONTAINS[c]\", @\"a\", 50);\n    test(@\"CONTAINS[c]\", @\"á\", 50);\n    test(@\"CONTAINS\", @\"A\", 25);\n    test(@\"CONTAINS\", @\"Á\", 25);\n    test(@\"CONTAINS[c]\", @\"A\", 50);\n    test(@\"CONTAINS[c]\", @\"Á\", 50);\n    test(@\"CONTAINS[d]\", @\"a\", 50);\n    test(@\"CONTAINS[d]\", @\"á\", 50);\n    test(@\"CONTAINS[cd]\", @\"a\", 100);\n    test(@\"CONTAINS[cd]\", @\"á\", 100);\n    test(@\"CONTAINS[d]\", @\"A\", 50);\n    test(@\"CONTAINS[d]\", @\"Á\", 50);\n    test(@\"CONTAINS[cd]\", @\"A\", 100);\n    test(@\"CONTAINS[cd]\", @\"Á\", 100);\n\n    test(@\"BEGINSWITH\", @\"a\", 13);\n    test(@\"BEGINSWITH\", @\"á\", 13);\n    test(@\"BEGINSWITH[c]\", @\"a\", 26);\n    test(@\"BEGINSWITH[c]\", @\"á\", 26);\n    test(@\"BEGINSWITH\", @\"A\", 13);\n    test(@\"BEGINSWITH\", @\"Á\", 13);\n    test(@\"BEGINSWITH[c]\", @\"A\", 26);\n    test(@\"BEGINSWITH[c]\", @\"Á\", 26);\n    test(@\"BEGINSWITH[d]\", @\"a\", 26);\n    test(@\"BEGINSWITH[d]\", @\"á\", 26);\n    test(@\"BEGINSWITH[cd]\", @\"a\", 52);\n    test(@\"BEGINSWITH[cd]\", @\"á\", 52);\n    test(@\"BEGINSWITH[d]\", @\"A\", 26);\n    test(@\"BEGINSWITH[d]\", @\"Á\", 26);\n    test(@\"BEGINSWITH[cd]\", @\"A\", 52);\n    test(@\"BEGINSWITH[cd]\", @\"Á\", 52);\n\n    test(@\"ENDSWITH\", @\"a\", 13);\n    test(@\"ENDSWITH\", @\"á\", 13);\n    test(@\"ENDSWITH[c]\", @\"a\", 26);\n    test(@\"ENDSWITH[c]\", @\"á\", 26);\n    test(@\"ENDSWITH\", @\"A\", 13);\n    test(@\"ENDSWITH\", @\"Á\", 13);\n    test(@\"ENDSWITH[c]\", @\"A\", 26);\n    test(@\"ENDSWITH[c]\", @\"Á\", 26);\n    test(@\"ENDSWITH[d]\", @\"a\", 26);\n    test(@\"ENDSWITH[d]\", @\"á\", 26);\n    test(@\"ENDSWITH[cd]\", @\"a\", 52);\n    test(@\"ENDSWITH[cd]\", @\"á\", 52);\n    test(@\"ENDSWITH[d]\", @\"A\", 26);\n    test(@\"ENDSWITH[d]\", @\"Á\", 26);\n    test(@\"ENDSWITH[cd]\", @\"A\", 52);\n    test(@\"ENDSWITH[cd]\", @\"Á\", 52);\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/PrimitiveArrayPropertyTests.tpl.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2017 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\nstatic NSDate *date(int i) {\n    return [NSDate dateWithTimeIntervalSince1970:i];\n}\nstatic NSData *data(int i) {\n    return [NSData dataWithBytesNoCopy:calloc(i, 1) length:i freeWhenDone:YES];\n}\nstatic RLMDecimal128 *decimal128(int i) {\n    return [RLMDecimal128 decimalWithNumber:@(i)];\n}\nstatic NSMutableArray *objectIds;\nstatic RLMObjectId *objectId(NSUInteger i) {\n    if (!objectIds) {\n        objectIds = [NSMutableArray new];\n    }\n    while (i >= objectIds.count) {\n        [objectIds addObject:RLMObjectId.objectId];\n    }\n    return objectIds[i];\n}\nstatic NSUUID *uuid(NSString *uuidString) {\n    return [[NSUUID alloc] initWithUUIDString:uuidString];\n}\nstatic void count(NSArray *values, double *sum, NSUInteger *count) {\n    for (id value in values) {\n        if (value != NSNull.null) {\n            ++*count;\n            *sum += [value doubleValue];\n        }\n    }\n}\nstatic double sum(NSArray *values) {\n    double sum = 0;\n    NSUInteger c = 0;\n    count(values, &sum, &c);\n    return sum;\n}\nstatic double average(NSArray *values) {\n    double sum = 0;\n    NSUInteger c = 0;\n    count(values, &sum, &c);\n    return sum / c;\n}\n\n@interface LinkToAllPrimitiveArrays : RLMObject\n@property (nonatomic) AllPrimitiveArrays *link;\n@end\n@implementation LinkToAllPrimitiveArrays\n@end\n\n@interface LinkToAllOptionalPrimitiveArrays : RLMObject\n@property (nonatomic) AllOptionalPrimitiveArrays *link;\n@end\n@implementation LinkToAllOptionalPrimitiveArrays\n@end\n\n@interface PrimitiveArrayPropertyTests : RLMTestCase\n@end\n\n@implementation PrimitiveArrayPropertyTests {\n    AllPrimitiveArrays *unmanaged;\n    AllPrimitiveArrays *managed;\n    AllOptionalPrimitiveArrays *optUnmanaged;\n    AllOptionalPrimitiveArrays *optManaged;\n    RLMRealm *realm;\n    NSArray<RLMArray *> *allArrays;\n}\n\n- (void)setUp {\n    unmanaged = [[AllPrimitiveArrays alloc] init];\n    optUnmanaged = [[AllOptionalPrimitiveArrays alloc] init];\n    realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    managed = [AllPrimitiveArrays createInRealm:realm withValue:@[]];\n    optManaged = [AllOptionalPrimitiveArrays createInRealm:realm withValue:@[]];\n    allArrays = @[\n        $array,\n    ];\n}\n\n- (void)tearDown {\n    if (realm.inWriteTransaction) {\n        [realm cancelWriteTransaction];\n    }\n}\n\n- (void)addObjects {\n    [$array addObjects:$values];\n}\n\n- (void)testCount {\n    uncheckedAssertEqual(unmanaged.intObj.count, 0U);\n    [unmanaged.intObj addObject:@1];\n    uncheckedAssertEqual(unmanaged.intObj.count, 1U);\n}\n\n- (void)testType {\n    uncheckedAssertEqual(unmanaged.boolObj.type, RLMPropertyTypeBool);\n    uncheckedAssertEqual(unmanaged.intObj.type, RLMPropertyTypeInt);\n    uncheckedAssertEqual(unmanaged.floatObj.type, RLMPropertyTypeFloat);\n    uncheckedAssertEqual(unmanaged.doubleObj.type, RLMPropertyTypeDouble);\n    uncheckedAssertEqual(unmanaged.stringObj.type, RLMPropertyTypeString);\n    uncheckedAssertEqual(unmanaged.dataObj.type, RLMPropertyTypeData);\n    uncheckedAssertEqual(unmanaged.dateObj.type, RLMPropertyTypeDate);\n    uncheckedAssertEqual(unmanaged.anyBoolObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(unmanaged.anyIntObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(unmanaged.anyFloatObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(unmanaged.anyDoubleObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(unmanaged.anyStringObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(unmanaged.anyDataObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(unmanaged.anyDateObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(unmanaged.anyDecimalObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(unmanaged.anyObjectIdObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(unmanaged.anyUUIDObj.type, RLMPropertyTypeAny);\n    uncheckedAssertEqual(optUnmanaged.boolObj.type, RLMPropertyTypeBool);\n    uncheckedAssertEqual(optUnmanaged.intObj.type, RLMPropertyTypeInt);\n    uncheckedAssertEqual(optUnmanaged.floatObj.type, RLMPropertyTypeFloat);\n    uncheckedAssertEqual(optUnmanaged.doubleObj.type, RLMPropertyTypeDouble);\n    uncheckedAssertEqual(optUnmanaged.stringObj.type, RLMPropertyTypeString);\n    uncheckedAssertEqual(optUnmanaged.dataObj.type, RLMPropertyTypeData);\n    uncheckedAssertEqual(optUnmanaged.dateObj.type, RLMPropertyTypeDate);\n}\n\n- (void)testOptional {\n    uncheckedAssertFalse(unmanaged.boolObj.optional);\n    uncheckedAssertFalse(unmanaged.intObj.optional);\n    uncheckedAssertFalse(unmanaged.floatObj.optional);\n    uncheckedAssertFalse(unmanaged.doubleObj.optional);\n    uncheckedAssertFalse(unmanaged.stringObj.optional);\n    uncheckedAssertFalse(unmanaged.dataObj.optional);\n    uncheckedAssertFalse(unmanaged.dateObj.optional);\n    uncheckedAssertFalse(unmanaged.anyBoolObj.optional);\n    uncheckedAssertFalse(unmanaged.anyIntObj.optional);\n    uncheckedAssertFalse(unmanaged.anyFloatObj.optional);\n    uncheckedAssertFalse(unmanaged.anyDoubleObj.optional);\n    uncheckedAssertFalse(unmanaged.anyStringObj.optional);\n    uncheckedAssertFalse(unmanaged.anyDataObj.optional);\n    uncheckedAssertFalse(unmanaged.anyDateObj.optional);\n    uncheckedAssertFalse(unmanaged.anyDecimalObj.optional);\n    uncheckedAssertFalse(unmanaged.anyObjectIdObj.optional);\n    uncheckedAssertFalse(unmanaged.anyUUIDObj.optional);\n    uncheckedAssertTrue(optUnmanaged.boolObj.optional);\n    uncheckedAssertTrue(optUnmanaged.intObj.optional);\n    uncheckedAssertTrue(optUnmanaged.floatObj.optional);\n    uncheckedAssertTrue(optUnmanaged.doubleObj.optional);\n    uncheckedAssertTrue(optUnmanaged.stringObj.optional);\n    uncheckedAssertTrue(optUnmanaged.dataObj.optional);\n    uncheckedAssertTrue(optUnmanaged.dateObj.optional);\n}\n\n- (void)testObjectClassName {\n    uncheckedAssertNil(unmanaged.boolObj.objectClassName);\n    uncheckedAssertNil(unmanaged.intObj.objectClassName);\n    uncheckedAssertNil(unmanaged.floatObj.objectClassName);\n    uncheckedAssertNil(unmanaged.doubleObj.objectClassName);\n    uncheckedAssertNil(unmanaged.stringObj.objectClassName);\n    uncheckedAssertNil(unmanaged.dataObj.objectClassName);\n    uncheckedAssertNil(unmanaged.dateObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyBoolObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyIntObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyFloatObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyDoubleObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyStringObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyDataObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyDateObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyDecimalObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyObjectIdObj.objectClassName);\n    uncheckedAssertNil(unmanaged.anyUUIDObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.boolObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.intObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.floatObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.doubleObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.stringObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.dataObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.dateObj.objectClassName);\n}\n\n- (void)testRealm {\n    uncheckedAssertNil(unmanaged.boolObj.realm);\n    uncheckedAssertNil(unmanaged.intObj.realm);\n    uncheckedAssertNil(unmanaged.floatObj.realm);\n    uncheckedAssertNil(unmanaged.doubleObj.realm);\n    uncheckedAssertNil(unmanaged.stringObj.realm);\n    uncheckedAssertNil(unmanaged.dataObj.realm);\n    uncheckedAssertNil(unmanaged.dateObj.realm);\n    uncheckedAssertNil(unmanaged.anyBoolObj.realm);\n    uncheckedAssertNil(unmanaged.anyIntObj.realm);\n    uncheckedAssertNil(unmanaged.anyFloatObj.realm);\n    uncheckedAssertNil(unmanaged.anyDoubleObj.realm);\n    uncheckedAssertNil(unmanaged.anyStringObj.realm);\n    uncheckedAssertNil(unmanaged.anyDataObj.realm);\n    uncheckedAssertNil(unmanaged.anyDateObj.realm);\n    uncheckedAssertNil(unmanaged.anyDecimalObj.realm);\n    uncheckedAssertNil(unmanaged.anyObjectIdObj.realm);\n    uncheckedAssertNil(unmanaged.anyUUIDObj.realm);\n    uncheckedAssertNil(optUnmanaged.boolObj.realm);\n    uncheckedAssertNil(optUnmanaged.intObj.realm);\n    uncheckedAssertNil(optUnmanaged.floatObj.realm);\n    uncheckedAssertNil(optUnmanaged.doubleObj.realm);\n    uncheckedAssertNil(optUnmanaged.stringObj.realm);\n    uncheckedAssertNil(optUnmanaged.dataObj.realm);\n    uncheckedAssertNil(optUnmanaged.dateObj.realm);\n}\n\n- (void)testInvalidated {\n    RLMArray *array;\n    @autoreleasepool {\n        AllPrimitiveArrays *obj = [[AllPrimitiveArrays alloc] init];\n        array = obj.intObj;\n        uncheckedAssertFalse(array.invalidated);\n    }\n    uncheckedAssertFalse(array.invalidated);\n}\n\n- (void)testDeleteObjectsInRealm {\n    RLMAssertThrowsWithReason([realm deleteObjects:$allArrays], @\"Cannot delete objects from RLMArray\");\n}\n\n- (void)testObjectAtIndex {\n    RLMAssertThrowsWithReason([unmanaged.intObj objectAtIndex:0],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n\n    [unmanaged.intObj addObject:@1];\n    uncheckedAssertEqualObjects([unmanaged.intObj objectAtIndex:0], @1);\n}\n\n- (void)testObjectsAtIndexes {\n    NSMutableIndexSet *indexSet = [NSMutableIndexSet new];\n    [indexSet addIndex:0];\n    [indexSet addIndex:2];\n    XCTAssertNil([unmanaged.intObj objectsAtIndexes:indexSet]);\n    XCTAssertNil([managed.intObj objectsAtIndexes:indexSet]);\n\n    [unmanaged.intObj addObject:@1];\n    [unmanaged.intObj addObject:@2];\n    [unmanaged.intObj addObject:@3];\n    uncheckedAssertEqualObjects([unmanaged.intObj objectsAtIndexes:indexSet], (@[@1, @3]));\n    [managed.intObj addObject:@1];\n    [managed.intObj addObject:@2];\n    [managed.intObj addObject:@3];\n    uncheckedAssertEqualObjects([managed.intObj objectsAtIndexes:indexSet], (@[@1, @3]));\n\n    [indexSet addIndex:3];\n    XCTAssertNil([unmanaged.intObj objectsAtIndexes:indexSet]);\n    XCTAssertNil([managed.intObj objectsAtIndexes:indexSet]);\n}\n\n- (void)testFirstObject {\n    uncheckedAssertNil($allArrays.firstObject);\n\n    [self addObjects];\n    uncheckedAssertEqualObjects($array.firstObject, $first);\n\n    [$allArrays removeAllObjects];\n\n    %o [$array addObject:NSNull.null];\n    %o uncheckedAssertEqualObjects($array.firstObject, NSNull.null);\n}\n\n- (void)testLastObject {\n    uncheckedAssertNil($allArrays.lastObject);\n\n    [self addObjects];\n\n    uncheckedAssertEqualObjects($array.lastObject, $last);\n\n    [$allArrays removeLastObject];\n    %o uncheckedAssertEqualObjects($array.lastObject, $v1);\n}\n\n- (void)testAddObject {\n    %noany RLMAssertThrowsWithReason([$array addObject:$wrong], ^n @\"Invalid value '$wdesc' of type '\" $wtype \"' for expected type '$type'\");\n    %noany %r RLMAssertThrowsWithReason([$array addObject:NSNull.null], ^n @\"Invalid value '<null>' of type 'NSNull' for expected type '$type'\");\n\n    [$array addObject:$v0];\n    uncheckedAssertEqualObjects($array[0], $v0);\n\n    %o [$array addObject:NSNull.null];\n    %o uncheckedAssertEqualObjects($array[1], NSNull.null);\n}\n\n- (void)testAddObjects {\n    %noany RLMAssertThrowsWithReason([$array addObjects:@[$wrong]], ^n @\"Invalid value '$wdesc' of type '\" $wtype \"' for expected type '$type'\");\n    %noany %r RLMAssertThrowsWithReason([$array addObjects:@[NSNull.null]], ^n @\"Invalid value '<null>' of type 'NSNull' for expected type '$type'\");\n\n    [self addObjects];\n    uncheckedAssertEqualObjects($array[0], $v0);\n    uncheckedAssertEqualObjects($array[1], $v1);\n    %o uncheckedAssertEqualObjects($array[2], NSNull.null);\n}\n\n- (void)testInsertObject {\n    %noany RLMAssertThrowsWithReason([$array insertObject:$wrong atIndex:0], ^n @\"Invalid value '$wdesc' of type '\" $wtype \"' for expected type '$type'\");\n    %noany %r RLMAssertThrowsWithReason([$array insertObject:NSNull.null atIndex:0], ^n @\"Invalid value '<null>' of type 'NSNull' for expected type '$type'\");\n    RLMAssertThrowsWithReason([$array insertObject:$v0 atIndex:1], ^n @\"Index 1 is out of bounds (must be less than 1).\");\n\n    [$array insertObject:$v0 atIndex:0];\n    uncheckedAssertEqualObjects($array[0], $v0);\n\n    [$array insertObject:$v1 atIndex:0];\n    uncheckedAssertEqualObjects($array[0], $v1);\n    uncheckedAssertEqualObjects($array[1], $v0);\n\n    %o [$array insertObject:NSNull.null atIndex:1];\n    %o uncheckedAssertEqualObjects($array[0], $v1);\n    %o uncheckedAssertEqualObjects($array[1], NSNull.null);\n    %o uncheckedAssertEqualObjects($array[2], $v0);\n}\n\n- (void)testRemoveObject {\n    RLMAssertThrowsWithReason([$allArrays removeObjectAtIndex:0], ^n @\"Index 0 is out of bounds (must be less than 0).\");\n\n    [self addObjects];\n    %r uncheckedAssertEqual($array.count, 2U);\n    %o uncheckedAssertEqual($array.count, 3U);\n\n    %r RLMAssertThrowsWithReason([$array removeObjectAtIndex:2], ^n @\"Index 2 is out of bounds (must be less than 2).\");\n    %o RLMAssertThrowsWithReason([$array removeObjectAtIndex:3], ^n @\"Index 3 is out of bounds (must be less than 3).\");\n\n    [$allArrays removeObjectAtIndex:0];\n    %r uncheckedAssertEqual($array.count, 1U);\n    %o uncheckedAssertEqual($array.count, 2U);\n\n    uncheckedAssertEqualObjects($array[0], $v1);\n    %o uncheckedAssertEqualObjects($array[1], NSNull.null);\n}\n\n- (void)testRemoveLastObject {\n    XCTAssertNoThrow([$allArrays removeLastObject]);\n\n    [self addObjects];\n    %r uncheckedAssertEqual($array.count, 2U);\n    %o uncheckedAssertEqual($array.count, 3U);\n\n    [$allArrays removeLastObject];\n    %r uncheckedAssertEqual($array.count, 1U);\n    %o uncheckedAssertEqual($array.count, 2U);\n\n    uncheckedAssertEqualObjects($array[0], $v0);\n    %o uncheckedAssertEqualObjects($array[1], $v1);\n}\n\n- (void)testReplace {\n    RLMAssertThrowsWithReason([$array replaceObjectAtIndex:0 withObject:$v0], ^n @\"Index 0 is out of bounds (must be less than 0).\");\n\n    [$array addObject:$v0]; ^nl [$array replaceObjectAtIndex:0 withObject:$v1]; ^nl uncheckedAssertEqualObjects($array[0], $v1); ^nl \n\n    %o [$array replaceObjectAtIndex:0 withObject:NSNull.null]; ^nl uncheckedAssertEqualObjects($array[0], NSNull.null);\n\n    %noany RLMAssertThrowsWithReason([$array replaceObjectAtIndex:0 withObject:$wrong], ^n @\"Invalid value '$wdesc' of type '\" $wtype \"' for expected type '$type'\");\n    %noany %r RLMAssertThrowsWithReason([$array replaceObjectAtIndex:0 withObject:NSNull.null], ^n @\"Invalid value '<null>' of type 'NSNull' for expected type '$type'\");\n}\n\n- (void)testMove {\n    RLMAssertThrowsWithReason([$allArrays moveObjectAtIndex:0 toIndex:1], ^n @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([$allArrays moveObjectAtIndex:1 toIndex:0], ^n @\"Index 1 is out of bounds (must be less than 0).\");\n\n    [$array addObjects:@[$v0, $v1, $v0, $v1]];\n\n    [$allArrays moveObjectAtIndex:2 toIndex:0];\n\n    uncheckedAssertEqualObjects([$array valueForKey:@\"self\"], ^n (@[$v0, $v0, $v1, $v1]));\n}\n\n- (void)testExchange {\n    RLMAssertThrowsWithReason([$allArrays exchangeObjectAtIndex:0 withObjectAtIndex:1], ^n @\"Index 0 is out of bounds (must be less than 0).\");\n    RLMAssertThrowsWithReason([$allArrays exchangeObjectAtIndex:1 withObjectAtIndex:0], ^n @\"Index 1 is out of bounds (must be less than 0).\");\n\n    [$array addObjects:@[$v0, $v1, $v0, $v1]];\n\n    [$allArrays exchangeObjectAtIndex:2 withObjectAtIndex:1];\n\n    uncheckedAssertEqualObjects([$array valueForKey:@\"self\"], ^n (@[$v0, $v0, $v1, $v1]));\n}\n\n- (void)testIndexOfObject {\n    uncheckedAssertEqual(NSNotFound, [$array indexOfObject:$v0]);\n\n    %noany RLMAssertThrowsWithReason([$array indexOfObject:$wrong], ^n @\"Invalid value '$wdesc' of type '\" $wtype \"' for expected type '$type'\");\n\n    %noany %r RLMAssertThrowsWithReason([$array indexOfObject:NSNull.null], ^n @\"Invalid value '<null>' of type 'NSNull' for expected type '$type'\");\n    %o uncheckedAssertEqual(NSNotFound, [$array indexOfObject:NSNull.null]);\n\n    [self addObjects];\n\n    uncheckedAssertEqual(1U, [$array indexOfObject:$v1]);\n}\n\n- (void)testIndexOfObjectSorted {\n    %man %r [$array addObjects:@[$v0, $v1, $v0, $v1]];\n    %man %o [$array addObjects:@[$v0, $v1, NSNull.null, $v1, $v0]];\n\n    %man %r uncheckedAssertEqual(0U, [[$array sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:$v1]);\n    %man %r uncheckedAssertEqual(2U, [[$array sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:$v0]);\n\n    %man %o uncheckedAssertEqual(0U, [[$array sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:$v1]);\n    %man %o uncheckedAssertEqual(2U, [[$array sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:$v0]);\n    %man %o uncheckedAssertEqual(4U, [[$array sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null]);\n}\n\n- (void)testIndexOfObjectDistinct {\n    %man %r [$array addObjects:@[$v0, $v0, $v1]];\n    %man %o [$array addObjects:@[$v0, $v0, NSNull.null, $v1, $v0]];\n\n    %man %r uncheckedAssertEqual(0U, [[$array distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:$v0]);\n    %man %r uncheckedAssertEqual(1U, [[$array distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:$v1]);\n\n    %man %o uncheckedAssertEqual(0U, [[$array distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:$v0]);\n    %man %o uncheckedAssertEqual(2U, [[$array distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:$v1]);\n    %man %o uncheckedAssertEqual(1U, [[$array distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null]);\n}\n\n- (void)testIndexOfObjectWhere {\n    %man RLMAssertThrowsWithReason([$array indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    %man RLMAssertThrowsWithReason([[$array sortedResultsUsingKeyPath:@\"self\" ascending:NO] ^n  indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n\n    %unman uncheckedAssertEqual(NSNotFound, [$array indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n\n    [self addObjects];\n\n    %unman uncheckedAssertEqual(0U, [$array indexOfObjectWhere:@\"TRUEPREDICATE\"]);\n    %unman uncheckedAssertEqual(NSNotFound, [$array indexOfObjectWhere:@\"FALSEPREDICATE\"]);\n}\n\n- (void)testIndexOfObjectWithPredicate {\n    %man RLMAssertThrowsWithReason([$array indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    %man RLMAssertThrowsWithReason([[$array sortedResultsUsingKeyPath:@\"self\" ascending:NO] ^n  indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n\n    %unman uncheckedAssertEqual(NSNotFound, [$array indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n\n    [self addObjects];\n\n    %unman uncheckedAssertEqual(0U, [$array indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]);\n    %unman uncheckedAssertEqual(NSNotFound, [$array indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]]);\n}\n\n- (void)testSort {\n    %unman RLMAssertThrowsWithReason([$array sortedResultsUsingKeyPath:@\"self\" ascending:NO], ^n @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    %unman RLMAssertThrowsWithReason([$array sortedResultsUsingDescriptors:@[]], ^n @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    %man RLMAssertThrowsWithReason([$array sortedResultsUsingKeyPath:@\"not self\" ascending:NO], ^n @\"can only be sorted on 'self'\");\n\n    %man %r [$array addObjects:@[$v0, $v1, $v0]];\n    %man %o [$array addObjects:@[$v0, $v1, NSNull.null, $v1, $v0]];\n\n    %man %r uncheckedAssertEqualObjects([[$array sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"], ^n (@[$v0, $v1, $v0]));\n    %man %o uncheckedAssertEqualObjects([[$array sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"], ^n (@[$v0, $v1, NSNull.null, $v1, $v0]));\n\n    %man %r uncheckedAssertEqualObjects([[$array sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"], ^n (@[$v1, $v0, $v0]));\n    %man %o uncheckedAssertEqualObjects([[$array sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"], ^n (@[$v1, $v1, $v0, $v0, NSNull.null]));\n\n    %man %r uncheckedAssertEqualObjects([[$array sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"], ^n (@[$v0, $v0, $v1]));\n    %man %o uncheckedAssertEqualObjects([[$array sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"], ^n (@[NSNull.null, $v0, $v0, $v1, $v1]));\n}\n\n- (void)testFilter {\n    %unman RLMAssertThrowsWithReason([$array objectsWhere:@\"TRUEPREDICATE\"], ^n @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n    %unman RLMAssertThrowsWithReason([$array objectsWithPredicate:[NSPredicate predicateWithValue:YES]], ^n @\"This method may only be called on RLMArray instances retrieved from an RLMRealm\");\n\n    %man RLMAssertThrowsWithReason([$array objectsWhere:@\"TRUEPREDICATE\"], ^n @\"implemented\");\n    %man RLMAssertThrowsWithReason([$array objectsWithPredicate:[NSPredicate predicateWithValue:YES]], ^n @\"implemented\");\n\n    %man RLMAssertThrowsWithReason([[$array sortedResultsUsingKeyPath:@\"self\" ascending:NO] ^n  objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    %man RLMAssertThrowsWithReason([[$array sortedResultsUsingKeyPath:@\"self\" ascending:NO] ^n  objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n}\n\n- (void)testNotifications {\n    %unman RLMAssertThrowsWithReason([$array addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], ^n @\"Change notifications are only supported on managed collections.\");\n}\n\n- (void)testMin {\n    %noany %nominmax %unman RLMAssertThrowsWithReason([$array minOfProperty:@\"self\"], ^n @\"minOfProperty: is not supported for $type array\");\n    %noany %nominmax %man RLMAssertThrowsWithReason([$array minOfProperty:@\"self\"], ^n @\"Operation 'min' not supported for $type list '$class.$prop'\");\n\n    %minmax uncheckedAssertNil([$array minOfProperty:@\"self\"]);\n\n    [self addObjects];\n\n    %minmax uncheckedAssertEqualObjects([$array minOfProperty:@\"self\"], $v0);\n}\n\n- (void)testMax {\n    %noany %nominmax %unman RLMAssertThrowsWithReason([$array maxOfProperty:@\"self\"], ^n @\"maxOfProperty: is not supported for $type array\");\n    %noany %nominmax %man RLMAssertThrowsWithReason([$array maxOfProperty:@\"self\"], ^n @\"Operation 'max' not supported for $type list '$class.$prop'\");\n\n    %minmax uncheckedAssertNil([$array maxOfProperty:@\"self\"]);\n\n    [self addObjects];\n\n    %minmax uncheckedAssertEqualObjects([$array maxOfProperty:@\"self\"], $v1);\n}\n\n- (void)testSum {\n    %noany %nosum %unman RLMAssertThrowsWithReason([$array sumOfProperty:@\"self\"], ^n @\"sumOfProperty: is not supported for $type array\");\n    %noany %nosum %man RLMAssertThrowsWithReason([$array sumOfProperty:@\"self\"], ^n @\"Operation 'sum' not supported for $type list '$class.$prop'\");\n\n    %sum uncheckedAssertEqualObjects([$array sumOfProperty:@\"self\"], @0);\n\n    [self addObjects];\n\n    %sum XCTAssertEqualWithAccuracy([$array sumOfProperty:@\"self\"].doubleValue, sum($values), .001);\n}\n\n- (void)testAverage {\n    %noany %noavg %unman RLMAssertThrowsWithReason([$array averageOfProperty:@\"self\"], ^n @\"averageOfProperty: is not supported for $type array\");\n    %noany %noavg %man RLMAssertThrowsWithReason([$array averageOfProperty:@\"self\"], ^n @\"Operation 'average' not supported for $type list '$class.$prop'\");\n\n    %avg uncheckedAssertNil([$array averageOfProperty:@\"self\"]);\n\n    [self addObjects];\n\n    %avg XCTAssertEqualWithAccuracy([$array averageOfProperty:@\"self\"].doubleValue, average($values), .001);\n}\n\n- (void)testFastEnumeration {\n    for (int i = 0; i < 10; ++i) {\n        [self addObjects];\n    }\n\n    // This is wrapped in a block to work around a compiler bug in Xcode 12.5:\n    // in release builds, reads on `values` will read the wrong local variable,\n    // resulting in a crash when it tries to send a message to some unitialized\n    // stack space. Putting them in separate obj-c blocks prevents this\n    // incorrect optimization.\n    ^{ ^nl NSUInteger i = 0; ^nl NSArray *values = $values; ^nl for (id value in $array) { ^nl uncheckedAssertEqualObjects(values[i++ % values.count], value); ^nl } ^nl uncheckedAssertEqual(i, $array.count); ^nl }(); ^nl \n}\n\n- (void)testValueForKeySelf {\n    uncheckedAssertEqualObjects([$allArrays valueForKey:@\"self\"], @[]);\n\n    [self addObjects];\n\n    uncheckedAssertEqualObjects([$array valueForKey:@\"self\"], ($values));\n}\n\n- (void)testValueForKeyNumericAggregates {\n    %minmax uncheckedAssertNil([$array valueForKeyPath:@\"@min.self\"]);\n    %minmax uncheckedAssertNil([$array valueForKeyPath:@\"@max.self\"]);\n    %noany %sum uncheckedAssertEqualObjects([$array valueForKeyPath:@\"@sum.self\"], @0);\n    %noany %avg uncheckedAssertNil([$array valueForKeyPath:@\"@avg.self\"]);\n\n    [self addObjects];\n\n    %minmax uncheckedAssertEqualObjects([$array valueForKeyPath:@\"@min.self\"], $v0);\n    %minmax uncheckedAssertEqualObjects([$array valueForKeyPath:@\"@max.self\"], $v1);\n    %noany %sum XCTAssertEqualWithAccuracy([[$array valueForKeyPath:@\"@sum.self\"] doubleValue], sum($values), .001);\n    %noany %avg XCTAssertEqualWithAccuracy([[$array valueForKeyPath:@\"@avg.self\"] doubleValue], average($values), .001);\n}\n\n- (void)testValueForKeyLength {\n    uncheckedAssertEqualObjects([$allArrays valueForKey:@\"length\"], @[]);\n\n    [self addObjects];\n\n    %string uncheckedAssertEqualObjects([$array valueForKey:@\"length\"], ([$values valueForKey:@\"length\"]));\n}\n\n// Sort the distinct results to match the order used in values, as it\n// doesn't preserve the order naturally\nstatic NSArray *sortedDistinctUnion(id array, NSString *type, NSString *prop) {\n    return [[array valueForKeyPath:[NSString stringWithFormat:@\"@distinctUnionOf%@.%@\", type, prop]]\n            sortedArrayUsingComparator:^NSComparisonResult(id a, id b) {\n                bool aIsNull = a == NSNull.null;\n                bool bIsNull = b == NSNull.null;\n                if (aIsNull && bIsNull) {\n                    return 0;\n                }\n                if (aIsNull) {\n                    return 1;\n                }\n                if (bIsNull) {\n                    return -1;\n                }\n\n                if ([a isKindOfClass:[NSData class]]) {\n                    if ([a length] != [b length]) {\n                        return [a length] < [b length] ? -1 : 1;\n                    }\n                    int result = memcmp([a bytes], [b bytes], [a length]);\n                    if (!result) {\n                        return 0;\n                    }\n                    return result < 0 ? -1 : 1;\n                }\n\n                if ([a isKindOfClass:[RLMObjectId class]]) {\n                    int64_t idx1 = [objectIds indexOfObject:a];\n                    int64_t idx2 = [objectIds indexOfObject:b];\n                    return idx1 - idx2;\n                }\n\n                if ([a respondsToSelector:@selector(objCType)]\n                    && [b respondsToSelector:@selector(objCType)]) {\n                    return [a compare:b];\n                } else {\n                    if ([a isKindOfClass:[RLMDecimal128 class]]) {\n                        a = [NSNumber numberWithDouble:[(RLMDecimal128 *)a doubleValue]];\n                    }\n                    if ([b isKindOfClass:[RLMDecimal128 class]]) {\n                        b = [NSNumber numberWithDouble:[(RLMDecimal128 *)b doubleValue]];\n                    }\n                    return [a compare:b];\n                }\n            }];\n}\n\n- (void)testUnionOfObjects {\n    uncheckedAssertEqualObjects([$allArrays valueForKeyPath:@\"@unionOfObjects.self\"], @[]);\n    uncheckedAssertEqualObjects([$allArrays valueForKeyPath:@\"@distinctUnionOfObjects.self\"], @[]);\n\n    [self addObjects];\n    [self addObjects];\n\n    uncheckedAssertEqualObjects([$array valueForKeyPath:@\"@unionOfObjects.self\"], ^n ($values2));\n    uncheckedAssertEqualObjects(sortedDistinctUnion($array, @\"Objects\", @\"self\"), ^n ($values));\n}\n\n- (void)testUnionOfArrays {\n    RLMResults *allRequired = [AllPrimitiveArrays allObjectsInRealm:realm];\n    RLMResults *allOptional = [AllOptionalPrimitiveArrays allObjectsInRealm:realm];\n\n    %man %r uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.$prop\"], @[]);\n    %man %o uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.$prop\"], @[]);\n    %man %r uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.$prop\"], @[]);\n    %man %o uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@distinctUnionOfArrays.$prop\"], @[]);\n\n    %man %any XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.$prop\"], @[]);\n    %man %any XCTAssertEqualObjects([allRequired valueForKeyPath:@\"@distinctUnionOfArrays.$prop\"], @[]);\n\n\n    [self addObjects];\n\n    [AllPrimitiveArrays createInRealm:realm withValue:managed];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:optManaged];\n\n    %man %r uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.$prop\"], ^n ($values2));\n    %man %o uncheckedAssertEqualObjects([allOptional valueForKeyPath:@\"@unionOfArrays.$prop\"], ^n ($values2));\n    %man %r uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"$prop\"), ^n ($values));\n    %man %o uncheckedAssertEqualObjects(sortedDistinctUnion(allOptional, @\"Arrays\", @\"$prop\"), ^n ($values));\n\n    %man %any uncheckedAssertEqualObjects([allRequired valueForKeyPath:@\"@unionOfArrays.$prop\"], ^n ($values2));\n    %man %any uncheckedAssertEqualObjects(sortedDistinctUnion(allRequired, @\"Arrays\", @\"$prop\"), ^n ($values));\n}\n\n- (void)testSetValueForKey {\n    RLMAssertThrowsWithReason([$allArrays setValue:@0 forKey:@\"not self\"], ^n @\"this class is not key value coding-compliant for the key not self.\");\n    %noany RLMAssertThrowsWithReason([$array setValue:$wrong forKey:@\"self\"], ^n @\"Invalid value '$wdesc' of type '\" $wtype \"' for expected type '$type'\");\n    %noany %r RLMAssertThrowsWithReason([$array setValue:NSNull.null forKey:@\"self\"], ^n @\"Invalid value '<null>' of type 'NSNull' for expected type '$type'\");\n\n    [self addObjects];\n\n    [$array setValue:$v0 forKey:@\"self\"];\n\n    uncheckedAssertEqualObjects($array[0], $v0);\n    uncheckedAssertEqualObjects($array[1], $v0);\n    %o uncheckedAssertEqualObjects($array[2], $v0);\n\n    %o [$array setValue:NSNull.null forKey:@\"self\"];\n    %o uncheckedAssertEqualObjects($array[0], NSNull.null);\n}\n\n- (void)testAssignment {\n    $array = (id)@[$v1]; ^nl uncheckedAssertEqualObjects($array[0], $v1);\n\n    // Should replace and not append\n    $array = (id)$values; ^nl uncheckedAssertEqualObjects([$array valueForKey:@\"self\"], ($values)); ^nl \n\n    // Should not clear the array\n    $array = $array; ^nl uncheckedAssertEqualObjects([$array valueForKey:@\"self\"], ($values)); ^nl \n\n    [unmanaged.intObj removeAllObjects];\n    unmanaged.intObj = managed.intObj;\n    uncheckedAssertEqualObjects([unmanaged.intObj valueForKey:@\"self\"], (@[@2, @3]));\n\n    [managed.intObj removeAllObjects];\n    managed.intObj = unmanaged.intObj;\n    uncheckedAssertEqualObjects([managed.intObj valueForKey:@\"self\"], (@[@2, @3]));\n}\n\n- (void)testDynamicAssignment {\n    $obj[@\"$prop\"] = (id)@[$v1]; ^nl uncheckedAssertEqualObjects($obj[@\"$prop\"][0], $v1);\n\n    // Should replace and not append\n    $obj[@\"$prop\"] = (id)$values; ^nl uncheckedAssertEqualObjects([$obj[@\"$prop\"] valueForKey:@\"self\"], ($values)); ^nl \n\n    // Should not clear the array\n    $obj[@\"$prop\"] = $obj[@\"$prop\"]; ^nl uncheckedAssertEqualObjects([$obj[@\"$prop\"] valueForKey:@\"self\"], ($values)); ^nl \n\n    [unmanaged[@\"intObj\"] removeAllObjects];\n    unmanaged[@\"intObj\"] = managed.intObj;\n    uncheckedAssertEqualObjects([unmanaged[@\"intObj\"] valueForKey:@\"self\"], (@[@2, @3]));\n\n    [managed[@\"intObj\"] removeAllObjects];\n    managed[@\"intObj\"] = unmanaged.intObj;\n    uncheckedAssertEqualObjects([managed[@\"intObj\"] valueForKey:@\"self\"], (@[@2, @3]));\n}\n\n- (void)testInvalidAssignment {\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)@[NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for 'int' array property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)@[@\"a\"],\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' array property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)(@[@1, @\"a\"]),\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' array property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)unmanaged.floatObj,\n                              @\"RLMArray<float> does not match expected type 'int' for property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)optUnmanaged.intObj,\n                              @\"RLMArray<int?> does not match expected type 'int' for property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged[@\"intObj\"] = unmanaged[@\"floatObj\"],\n                              @\"RLMArray<float> does not match expected type 'int' for property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged[@\"intObj\"] = optUnmanaged[@\"intObj\"],\n                              @\"RLMArray<int?> does not match expected type 'int' for property 'AllPrimitiveArrays.intObj'.\");\n\n    RLMAssertThrowsWithReason(managed.intObj = (id)@[NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for 'int' array property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)@[@\"a\"],\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' array property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)(@[@1, @\"a\"]),\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' array property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)managed.floatObj,\n                              @\"RLMArray<float> does not match expected type 'int' for property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)optManaged.intObj,\n                              @\"RLMArray<int?> does not match expected type 'int' for property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(managed[@\"intObj\"] = (id)managed[@\"floatObj\"],\n                              @\"RLMArray<float> does not match expected type 'int' for property 'AllPrimitiveArrays.intObj'.\");\n    RLMAssertThrowsWithReason(managed[@\"intObj\"] = (id)optManaged[@\"intObj\"],\n                              @\"RLMArray<int?> does not match expected type 'int' for property 'AllPrimitiveArrays.intObj'.\");\n}\n\n- (void)testAllMethodsCheckThread {\n    RLMArray *array = managed.intObj;\n    [self dispatchAsyncAndWait:^{\n        RLMAssertThrowsWithReason([array count], @\"thread\");\n        RLMAssertThrowsWithReason([array objectAtIndex:0], @\"thread\");\n        RLMAssertThrowsWithReason([array firstObject], @\"thread\");\n        RLMAssertThrowsWithReason([array lastObject], @\"thread\");\n\n        RLMAssertThrowsWithReason([array addObject:@0], @\"thread\");\n        RLMAssertThrowsWithReason([array addObjects:@[@0]], @\"thread\");\n        RLMAssertThrowsWithReason([array insertObject:@0 atIndex:0], @\"thread\");\n        RLMAssertThrowsWithReason([array removeObjectAtIndex:0], @\"thread\");\n        RLMAssertThrowsWithReason([array removeLastObject], @\"thread\");\n        RLMAssertThrowsWithReason([array removeAllObjects], @\"thread\");\n        RLMAssertThrowsWithReason([array replaceObjectAtIndex:0 withObject:@0], @\"thread\");\n        RLMAssertThrowsWithReason([array moveObjectAtIndex:0 toIndex:1], @\"thread\");\n        RLMAssertThrowsWithReason([array exchangeObjectAtIndex:0 withObjectAtIndex:1], @\"thread\");\n\n        RLMAssertThrowsWithReason([array indexOfObject:@1], @\"thread\");\n        /* RLMAssertThrowsWithReason([array indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"thread\"); */\n        /* RLMAssertThrowsWithReason([array indexOfObjectWithPredicate:[NSPredicate predicateWithValue:NO]], @\"thread\"); */\n        /* RLMAssertThrowsWithReason([array objectsWhere:@\"TRUEPREDICATE\"], @\"thread\"); */\n        /* RLMAssertThrowsWithReason([array objectsWithPredicate:[NSPredicate predicateWithValue:NO]], @\"thread\"); */\n        RLMAssertThrowsWithReason([array sortedResultsUsingKeyPath:@\"self\" ascending:YES], @\"thread\");\n        RLMAssertThrowsWithReason([array sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"self\" ascending:YES]]], @\"thread\");\n        RLMAssertThrowsWithReason(array[0], @\"thread\");\n        RLMAssertThrowsWithReason(array[0] = @0, @\"thread\");\n        RLMAssertThrowsWithReason([array valueForKey:@\"self\"], @\"thread\");\n        RLMAssertThrowsWithReason([array setValue:@1 forKey:@\"self\"], @\"thread\");\n        RLMAssertThrowsWithReason(({for (__unused id obj in array);}), @\"thread\");\n    }];\n}\n\n- (void)testAllMethodsCheckForInvalidation {\n    RLMArray *array = managed.intObj;\n    [realm cancelWriteTransaction];\n    [realm invalidate];\n\n    XCTAssertNoThrow([array objectClassName]);\n    XCTAssertNoThrow([array realm]);\n    XCTAssertNoThrow([array isInvalidated]);\n\n    RLMAssertThrowsWithReason([array count], @\"invalidated\");\n    RLMAssertThrowsWithReason([array objectAtIndex:0], @\"invalidated\");\n    RLMAssertThrowsWithReason([array firstObject], @\"invalidated\");\n    RLMAssertThrowsWithReason([array lastObject], @\"invalidated\");\n\n    RLMAssertThrowsWithReason([array addObject:@0], @\"invalidated\");\n    RLMAssertThrowsWithReason([array addObjects:@[@0]], @\"invalidated\");\n    RLMAssertThrowsWithReason([array insertObject:@0 atIndex:0], @\"invalidated\");\n    RLMAssertThrowsWithReason([array removeObjectAtIndex:0], @\"invalidated\");\n    RLMAssertThrowsWithReason([array removeLastObject], @\"invalidated\");\n    RLMAssertThrowsWithReason([array removeAllObjects], @\"invalidated\");\n    RLMAssertThrowsWithReason([array replaceObjectAtIndex:0 withObject:@0], @\"invalidated\");\n    RLMAssertThrowsWithReason([array moveObjectAtIndex:0 toIndex:1], @\"invalidated\");\n    RLMAssertThrowsWithReason([array exchangeObjectAtIndex:0 withObjectAtIndex:1], @\"invalidated\");\n\n    RLMAssertThrowsWithReason([array indexOfObject:@1], @\"invalidated\");\n    /* RLMAssertThrowsWithReason([array indexOfObjectWhere:@\"TRUEPREDICATE\"], @\"invalidated\"); */\n    /* RLMAssertThrowsWithReason([array indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]], @\"invalidated\"); */\n    /* RLMAssertThrowsWithReason([array objectsWhere:@\"TRUEPREDICATE\"], @\"invalidated\"); */\n    /* RLMAssertThrowsWithReason([array objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"invalidated\"); */\n    RLMAssertThrowsWithReason([array sortedResultsUsingKeyPath:@\"self\" ascending:YES], @\"invalidated\");\n    RLMAssertThrowsWithReason([array sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"self\" ascending:YES]]], @\"invalidated\");\n    RLMAssertThrowsWithReason(array[0], @\"invalidated\");\n    RLMAssertThrowsWithReason(array[0] = @0, @\"invalidated\");\n    RLMAssertThrowsWithReason([array valueForKey:@\"self\"], @\"invalidated\");\n    RLMAssertThrowsWithReason([array setValue:@1 forKey:@\"self\"], @\"invalidated\");\n    RLMAssertThrowsWithReason(({for (__unused id obj in array);}), @\"invalidated\");\n\n    [realm beginWriteTransaction];\n}\n\n- (void)testMutatingMethodsCheckForWriteTransaction {\n    RLMArray *array = managed.intObj;\n    [array addObject:@0];\n    [realm commitWriteTransaction];\n\n    XCTAssertNoThrow([array objectClassName]);\n    XCTAssertNoThrow([array realm]);\n    XCTAssertNoThrow([array isInvalidated]);\n\n    XCTAssertNoThrow([array count]);\n    XCTAssertNoThrow([array objectAtIndex:0]);\n    XCTAssertNoThrow([array firstObject]);\n    XCTAssertNoThrow([array lastObject]);\n\n    XCTAssertNoThrow([array indexOfObject:@1]);\n    /* XCTAssertNoThrow([array indexOfObjectWhere:@\"TRUEPREDICATE\"]); */\n    /* XCTAssertNoThrow([array indexOfObjectWithPredicate:[NSPredicate predicateWithValue:YES]]); */\n    /* XCTAssertNoThrow([array objectsWhere:@\"TRUEPREDICATE\"]); */\n    /* XCTAssertNoThrow([array objectsWithPredicate:[NSPredicate predicateWithValue:YES]]); */\n    XCTAssertNoThrow([array sortedResultsUsingKeyPath:@\"self\" ascending:YES]);\n    XCTAssertNoThrow([array sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"self\" ascending:YES]]]);\n    XCTAssertNoThrow(array[0]);\n    XCTAssertNoThrow([array valueForKey:@\"self\"]);\n    XCTAssertNoThrow(({for (__unused id obj in array);}));\n\n\n    RLMAssertThrowsWithReason([array addObject:@0], @\"write transaction\");\n    RLMAssertThrowsWithReason([array addObjects:@[@0]], @\"write transaction\");\n    RLMAssertThrowsWithReason([array insertObject:@0 atIndex:0], @\"write transaction\");\n    RLMAssertThrowsWithReason([array removeObjectAtIndex:0], @\"write transaction\");\n    RLMAssertThrowsWithReason([array removeLastObject], @\"write transaction\");\n    RLMAssertThrowsWithReason([array removeAllObjects], @\"write transaction\");\n    RLMAssertThrowsWithReason([array replaceObjectAtIndex:0 withObject:@0], @\"write transaction\");\n    RLMAssertThrowsWithReason([array moveObjectAtIndex:0 toIndex:1], @\"write transaction\");\n    RLMAssertThrowsWithReason([array exchangeObjectAtIndex:0 withObjectAtIndex:1], @\"write transaction\");\n\n    RLMAssertThrowsWithReason(array[0] = @0, @\"write transaction\");\n    RLMAssertThrowsWithReason([array setValue:@1 forKey:@\"self\"], @\"write transaction\");\n}\n\n- (void)testDeleteOwningObject {\n    RLMArray *array = managed.intObj;\n    uncheckedAssertFalse(array.isInvalidated);\n    [realm deleteObject:managed];\n    uncheckedAssertTrue(array.isInvalidated);\n}\n\n#pragma clang diagnostic ignored \"-Warc-retain-cycles\"\n\n- (void)testNotificationSentInitially {\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMArray *array, RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(array);\n        uncheckedAssertNil(change);\n        uncheckedAssertNil(error);\n        [expectation fulfill];\n    }];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationSentAfterCommit {\n    [realm commitWriteTransaction];\n\n    __block bool first = true;\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMArray *array, RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(array);\n        uncheckedAssertNil(error);\n        if (first) {\n            uncheckedAssertNil(change);\n        }\n        else {\n            uncheckedAssertEqualObjects(change.insertions, @[@0]);\n        }\n\n        first = false;\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *r = [RLMRealm defaultRealm];\n        [r transactionWithBlock:^{\n            RLMArray *array = [(AllPrimitiveArrays *)[AllPrimitiveArrays allObjectsInRealm:r].firstObject intObj];\n            [array addObject:@0];\n        }];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationNotSentForUnrelatedChange {\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(__unused RLMArray *array, __unused RLMCollectionChange *change, __unused NSError *error) {\n        // will throw if it's incorrectly called a second time due to the\n        // unrelated write transaction\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmDidChangeNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *r = [RLMRealm defaultRealm];\n            [r transactionWithBlock:^{\n                [AllPrimitiveArrays createInRealm:r withValue:@[]];\n            }];\n        }];\n    }];\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationSentOnlyForActualRefresh {\n    [realm commitWriteTransaction];\n\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMArray *array, __unused RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(array);\n        uncheckedAssertNil(error);\n        // will throw if it's called a second time before we create the new\n        // expectation object immediately before manually refreshing\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // Turn off autorefresh, so the background commit should not result in a notification\n    realm.autorefresh = NO;\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmRefreshRequiredNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *r = [RLMRealm defaultRealm];\n            [r transactionWithBlock:^{\n                RLMArray *array = [(AllPrimitiveArrays *)[AllPrimitiveArrays allObjectsInRealm:r].firstObject intObj];\n                [array addObject:@0];\n            }];\n        }];\n    }];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [realm refresh];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testDeletingObjectWithNotificationsRegistered {\n    [managed.intObj addObjects:@[@10, @20]];\n    [realm commitWriteTransaction];\n\n    __block bool first = true;\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMArray *array, RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(array);\n        uncheckedAssertNil(error);\n        if (first) {\n            uncheckedAssertNil(change);\n            first = false;\n        }\n        else {\n            uncheckedAssertEqualObjects(change.deletions, (@[@0, @1]));\n        }\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [realm beginWriteTransaction];\n    [realm deleteObject:managed];\n    [realm commitWriteTransaction];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n#pragma mark - Queries\n\n#define RLMAssertCount(cls, expectedCount, ...) \\\n    uncheckedAssertEqual(expectedCount, ([cls objectsInRealm:realm where:__VA_ARGS__].count))\n\n- (void)createObjectWithValueIndex:(NSUInteger)index {\n    NSRange range = {index, 1};\n    id obj = [AllPrimitiveArrays createInRealm:realm withValue:@{\n        %r %man @\"$prop\": [$values subarrayWithRange:range],\n        %any %man @\"$prop\": [$values subarrayWithRange:range],\n    }];\n    [LinkToAllPrimitiveArrays createInRealm:realm withValue:@[obj]];\n    obj = [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        %o %man @\"$prop\": [$values subarrayWithRange:range],\n    }];\n    [LinkToAllOptionalPrimitiveArrays createInRealm:realm withValue:@[obj]];\n}\n\n- (void)testQueryBasicOperators {\n    [realm deleteAllObjects];\n\n    %man RLMAssertCount($class, 0, @\"ANY $prop = %@\", $v0);\n    %man RLMAssertCount($class, 0, @\"ANY $prop != %@\", $v0);\n    %man %comp RLMAssertCount($class, 0, @\"ANY $prop > %@\", $v0);\n    %man %comp RLMAssertCount($class, 0, @\"ANY $prop >= %@\", $v0);\n    %man %comp RLMAssertCount($class, 0, @\"ANY $prop < %@\", $v0);\n    %man %comp RLMAssertCount($class, 0, @\"ANY $prop <= %@\", $v0);\n\n    [self createObjectWithValueIndex:0];\n\n    %man RLMAssertCount($class, 0, @\"ANY $prop = %@\", $v1);\n    %man RLMAssertCount($class, 1, @\"ANY $prop = %@\", $v0);\n    %man RLMAssertCount($class, 0, @\"ANY $prop != %@\", $v0);\n    %man RLMAssertCount($class, 1, @\"ANY $prop != %@\", $v1);\n    %man %comp RLMAssertCount($class, 0, @\"ANY $prop > %@\", $v0);\n    %man %comp RLMAssertCount($class, 1, @\"ANY $prop >= %@\", $v0);\n    %man %comp RLMAssertCount($class, 0, @\"ANY $prop < %@\", $v0);\n    %man %comp RLMAssertCount($class, 1, @\"ANY $prop < %@\", $v1);\n    %man %comp RLMAssertCount($class, 1, @\"ANY $prop <= %@\", $v0);\n\n    [self createObjectWithValueIndex:1];\n\n    %man RLMAssertCount($class, 1, @\"ANY $prop = %@\", $v0);\n    %man RLMAssertCount($class, 1, @\"ANY $prop = %@\", $v1);\n    %man RLMAssertCount($class, 1, @\"ANY $prop != %@\", $v0);\n    %man RLMAssertCount($class, 1, @\"ANY $prop != %@\", $v1);\n    %man %comp RLMAssertCount($class, 1, @\"ANY $prop > %@\", $v0);\n    %man %comp RLMAssertCount($class, 2, @\"ANY $prop >= %@\", $v0);\n    %man %comp RLMAssertCount($class, 0, @\"ANY $prop < %@\", $v0);\n    %man %comp RLMAssertCount($class, 1, @\"ANY $prop < %@\", $v1);\n    %man %comp RLMAssertCount($class, 1, @\"ANY $prop <= %@\", $v0);\n    %man %comp RLMAssertCount($class, 2, @\"ANY $prop <= %@\", $v1);\n\n    %man %nocomp %noany RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"ANY $prop > %@\", $v0]), ^n @\"Operator '>' not supported for type '$basetype'\");\n}\n\n- (void)testQueryBetween {\n    [realm deleteAllObjects];\n\n    %noany %man %nominmax RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"ANY $prop BETWEEN %@\", @[$v0, $v1]]), ^n @\"Operator 'BETWEEN' not supported for type '$basetype'\");\n\n    %man %minmax RLMAssertCount($class, 0, @\"ANY $prop BETWEEN %@\", @[$v0, $v1]);\n\n    [self createObjectWithValueIndex:0];\n\n    %man %minmax RLMAssertCount($class, 1, @\"ANY $prop BETWEEN %@\", @[$v0, $v0]);\n    %man %minmax RLMAssertCount($class, 1, @\"ANY $prop BETWEEN %@\", @[$v0, $v1]);\n    %man %minmax RLMAssertCount($class, 0, @\"ANY $prop BETWEEN %@\", @[$v1, $v1]);\n}\n\n- (void)testQueryIn {\n    [realm deleteAllObjects];\n\n    %man RLMAssertCount($class, 0, @\"ANY $prop IN %@\", @[$v0, $v1]);\n\n    [self createObjectWithValueIndex:0];\n\n    %man RLMAssertCount($class, 0, @\"ANY $prop IN %@\", @[$v1]);\n    %man RLMAssertCount($class, 1, @\"ANY $prop IN %@\", @[$v0, $v1]);\n}\n\n- (void)testQueryCount {\n    [realm deleteAllObjects];\n\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        %r %man @\"$prop\": @[],\n        %any %man @\"$prop\": @[],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        %o %man @\"$prop\": @[],\n    }];\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        %r %man @\"$prop\": @[$v0],\n        %any %man @\"$prop\": @[$v0],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        %o %man @\"$prop\": @[$v0],\n    }];\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        %r %man @\"$prop\": @[$v0, $v0],\n        %any %man @\"$prop\": @[$v0, $v0],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        %o %man @\"$prop\": @[$v0, $v0],\n    }];\n\n    for (unsigned int i = 0; i < 3; ++i) {\n        %man RLMAssertCount($class, 1U, @\"$prop.@count == %@\", @(i));\n        %man RLMAssertCount($class, 2U, @\"$prop.@count != %@\", @(i));\n        %man RLMAssertCount($class, 2 - i, @\"$prop.@count > %@\", @(i));\n        %man RLMAssertCount($class, 3 - i, @\"$prop.@count >= %@\", @(i));\n        %man RLMAssertCount($class, i, @\"$prop.@count < %@\", @(i));\n        %man RLMAssertCount($class, i + 1, @\"$prop.@count <= %@\", @(i));\n    }\n}\n\n- (void)testQuerySum {\n    [realm deleteAllObjects];\n\n    %noany %nodate %nosum %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@sum = %@\", $v0]), ^n @\"Invalid keypath '$prop.@sum': @sum can only be applied to a collection of numeric values.\");\n    %noany %date %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@sum = %@\", $v0]), ^n @\"Cannot sum or average date properties\");\n\n    %noany %sum %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@sum = %@\", $wrong]), ^n @\"@sum on a property of type $basetype cannot be compared with '$wdesc'\");\n    %noany %sum %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@sum.prop = %@\", $wrong]), ^n @\"Invalid keypath '$prop.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    %noany %sum %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@sum = %@\", NSNull.null]), ^n @\"@sum on a property of type $basetype cannot be compared with '<null>'\");\n\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        %man %r %sum @\"$prop\": @[],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        %man %o %sum @\"$prop\": @[],\n    }];\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        %man %r %sum @\"$prop\": @[$v0],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        %man %o %sum @\"$prop\": @[$v0],\n    }];\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        %man %r %sum @\"$prop\": @[$v0, $v0],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        %man %o %sum @\"$prop\": @[$v0, $v0],\n    }];\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        %man %r %sum @\"$prop\": @[$v0, $v0, $v0],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        %man %o %sum @\"$prop\": @[$v0, $v0, $v0],\n    }];\n\n    %noany %sum %man RLMAssertCount($class, 1U, @\"$prop.@sum == %@\", @0);\n    %noany %sum %man RLMAssertCount($class, 1U, @\"$prop.@sum == %@\", $v0);\n    %noany %sum %man RLMAssertCount($class, 3U, @\"$prop.@sum != %@\", $v0);\n    %noany %sum %man RLMAssertCount($class, 3U, @\"$prop.@sum >= %@\", $v0);\n    %noany %sum %man RLMAssertCount($class, 2U, @\"$prop.@sum > %@\", $v0);\n    %noany %sum %man RLMAssertCount($class, 2U, @\"$prop.@sum < %@\", $v1);\n    %noany %sum %man RLMAssertCount($class, 2U, @\"$prop.@sum <= %@\", $v1);\n}\n\n- (void)testQueryAverage {\n    [realm deleteAllObjects];\n\n    %noany %nodate %noavg %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@avg = %@\", $v0]), ^n @\"Invalid keypath '$prop.@avg': @avg can only be applied to a collection of numeric values.\");\n    %noany %date %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@avg = %@\", $v0]), ^n @\"Cannot sum or average date properties\");\n    %noany %any %date %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@avg = %@\", $v0]), ^n @\"Cannot sum or average date properties\");\n\n    %noany %avg %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@avg = %@\", $wrong]), ^n @\"@avg on a property of type $basetype cannot be compared with '$wdesc'\");\n    %noany %avg %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@avg.prop = %@\", $wrong]), ^n @\"Invalid keypath '$prop.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        %man %r %avg @\"$prop\": @[],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        %man %o %avg @\"$prop\": @[],\n    }];\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        %man %r %avg @\"$prop\": @[$v0],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        %man %o %avg @\"$prop\": @[$v0],\n    }];\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        %man %r %avg @\"$prop\": @[$v0, $v1],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        %man %o %avg @\"$prop\": @[$v0, $v1],\n    }];\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        %man %r %avg @\"$prop\": @[$v1],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        %man %o %avg @\"$prop\": @[$v1],\n    }];\n\n    %noany %avg %man RLMAssertCount($class, 1U, @\"$prop.@avg == %@\", NSNull.null);\n    %noany %avg %man RLMAssertCount($class, 1U, @\"$prop.@avg == %@\", $v0);\n    %noany %avg %man RLMAssertCount($class, 3U, @\"$prop.@avg != %@\", $v0);\n    %noany %avg %man RLMAssertCount($class, 3U, @\"$prop.@avg >= %@\", $v0);\n    %noany %avg %man RLMAssertCount($class, 2U, @\"$prop.@avg > %@\", $v0);\n    %noany %avg %man RLMAssertCount($class, 2U, @\"$prop.@avg < %@\", $v1);\n    %noany %avg %man RLMAssertCount($class, 3U, @\"$prop.@avg <= %@\", $v1);\n}\n\n- (void)testQueryMin {\n    [realm deleteAllObjects];\n\n    %noany %nominmax %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@min = %@\", $v0]), ^n @\"Invalid keypath '$prop.@min': @min can only be applied to a collection of numeric values.\");\n    %noany %minmax %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@min = %@\", $wrong]), ^n @\"@min on a property of type $basetype cannot be compared with '$wdesc'\");\n    %minmax %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@min.prop = %@\", $wrong]), ^n @\"Invalid keypath '$prop.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n\n    // No objects, so count is zero\n    %minmax %man RLMAssertCount($class, 0U, @\"$prop.@min == %@\", $v0);\n\n    [AllPrimitiveArrays createInRealm:realm withValue:@{}];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{}];\n\n    // Only empty arrays, so count is zero\n    %minmax %man RLMAssertCount($class, 0U, @\"$prop.@min == %@\", $v0);\n    %minmax %man RLMAssertCount($class, 0U, @\"$prop.@min == %@\", $v1);\n\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@min == nil\");\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@min == %@\", NSNull.null);\n\n    [self createObjectWithValueIndex:0];\n\n    // One object where v0 is min and zero with v1\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@min == %@\", $v0);\n    %minmax %man RLMAssertCount($class, 0U, @\"$prop.@min == %@\", $v1);\n\n    [self createObjectWithValueIndex:1];\n\n    // One object where v0 is min and one with v1\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@min == %@\", $v0);\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@min == %@\", $v1);\n\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        %minmax %r %man @\"$prop\": @[$v1, $v0],\n        %minmax %any %man @\"$prop\": @[$v1, $v0],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        %minmax %o %man @\"$prop\": @[$v1, $v0],\n    }];\n\n    // New object with both v0 and v1 matches v0 but not v1\n    %minmax %man RLMAssertCount($class, 2U, @\"$prop.@min == %@\", $v0);\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@min == %@\", $v1);\n}\n\n- (void)testQueryMax {\n    [realm deleteAllObjects];\n\n    %noany %nominmax %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@max = %@\", $v0]), ^n @\"Invalid keypath '$prop.@max': @max can only be applied to a collection of numeric values.\");\n    %noany %minmax %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@max = %@\", $wrong]), ^n @\"@max on a property of type $basetype cannot be compared with '$wdesc'\");\n    %minmax %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@max.prop = %@\", $wrong]), ^n @\"Invalid keypath '$prop.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n\n    // No objects, so count is zero\n    %minmax %man RLMAssertCount($class, 0U, @\"$prop.@max == %@\", $v0);\n\n    [AllPrimitiveArrays createInRealm:realm withValue:@{}];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{}];\n\n    // Only empty arrays, so count is zero\n    %minmax %man RLMAssertCount($class, 0U, @\"$prop.@max == %@\", $v0);\n    %minmax %man RLMAssertCount($class, 0U, @\"$prop.@max == %@\", $v1);\n\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@max == nil\");\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@max == %@\", NSNull.null);\n\n    [self createObjectWithValueIndex:0];\n\n    // One object where v0 is min and zero with v1\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@max == %@\", $v0);\n    %minmax %man RLMAssertCount($class, 0U, @\"$prop.@max == %@\", $v1);\n\n    [self createObjectWithValueIndex:1];\n\n    // One object where v0 is min and one with v1\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@max == %@\", $v0);\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@max == %@\", $v1);\n\n    [AllPrimitiveArrays createInRealm:realm withValue:@{\n        %minmax %r %man @\"$prop\": @[$v1, $v0],\n        %any %minmax %man @\"$prop\": @[$v1, $v0],\n    }];\n    [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n        %minmax %o %man @\"$prop\": @[$v1, $v0],\n    }];\n\n    // New object with both v0 and v1 matches v1 but not v0\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@max == %@\", $v0);\n    %minmax %man RLMAssertCount($class, 2U, @\"$prop.@max == %@\", $v1);\n}\n\n- (void)testQueryBasicOperatorsOverLink {\n    [realm deleteAllObjects];\n\n    %man RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop = %@\", $v0);\n    %man RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop != %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop > %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop >= %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop < %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop <= %@\", $v0);\n\n    [self createObjectWithValueIndex:0];\n\n    %man RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop = %@\", $v1);\n    %man RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop = %@\", $v0);\n    %man RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop != %@\", $v0);\n    %man RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop != %@\", $v1);\n    %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop > %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop >= %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop < %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop < %@\", $v1);\n    %man %comp RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop <= %@\", $v0);\n\n    [self createObjectWithValueIndex:1];\n\n    %man RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop = %@\", $v0);\n    %man RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop = %@\", $v1);\n    %man RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop != %@\", $v0);\n    %man RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop != %@\", $v1);\n    %man %comp RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop > %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 2, @\"ANY link.$prop >= %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop < %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop < %@\", $v1);\n    %man %comp RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop <= %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 2, @\"ANY link.$prop <= %@\", $v1);\n\n    %man %nocomp %noany RLMAssertThrowsWithReason(([LinkTo$class objectsInRealm:realm where:@\"ANY link.$prop > %@\", $v0]), ^n @\"Operator '>' not supported for type '$basetype'\");\n}\n\n- (void)testSubstringQueries {\n    NSArray *values = @[\n        @\"\",\n\n        @\"á\", @\"ó\", @\"ú\",\n\n        @\"áá\", @\"áó\", @\"áú\",\n        @\"óá\", @\"óó\", @\"óú\",\n        @\"úá\", @\"úó\", @\"úú\",\n\n        @\"ááá\", @\"ááó\", @\"ááú\", @\"áóá\", @\"áóó\", @\"áóú\", @\"áúá\", @\"áúó\", @\"áúú\",\n        @\"óáá\", @\"óáó\", @\"óáú\", @\"óóá\", @\"óóó\", @\"óóú\", @\"óúá\", @\"óúó\", @\"óúú\",\n        @\"úáá\", @\"úáó\", @\"úáú\", @\"úóá\", @\"úóó\", @\"úóú\", @\"úúá\", @\"úúó\", @\"úúú\",\n    ];\n\n    void (^create)(NSString *) = ^(NSString *value) {\n        id obj = [AllPrimitiveArrays createInRealm:realm withValue:@{\n            @\"stringObj\": @[value],\n            @\"dataObj\": @[[value dataUsingEncoding:NSUTF8StringEncoding]]\n        }];\n        [LinkToAllPrimitiveArrays createInRealm:realm withValue:@[obj]];\n        obj = [AllOptionalPrimitiveArrays createInRealm:realm withValue:@{\n            @\"stringObj\": @[value],\n            @\"dataObj\": @[[value dataUsingEncoding:NSUTF8StringEncoding]]\n        }];\n        [LinkToAllOptionalPrimitiveArrays createInRealm:realm withValue:@[obj]];\n    };\n\n    for (NSString *value in values) {\n        create(value);\n        create(value.uppercaseString);\n        create([value stringByApplyingTransform:NSStringTransformStripDiacritics reverse:NO]);\n        create([value.uppercaseString stringByApplyingTransform:NSStringTransformStripDiacritics reverse:NO]);\n    }\n\n    void (^test)(NSString *, id, NSUInteger) = ^(NSString *operator, NSString *value, NSUInteger count) {\n        NSData *data = [value dataUsingEncoding:NSUTF8StringEncoding];\n\n        NSString *query = [NSString stringWithFormat:@\"ANY stringObj %@ %%@\", operator];\n        %man %string RLMAssertCount($class, count, query, value);\n        query = [NSString stringWithFormat:@\"ANY link.stringObj %@ %%@\", operator];\n        %man %string RLMAssertCount(LinkTo$class, count, query, value);\n\n        query = [NSString stringWithFormat:@\"ANY dataObj %@ %%@\", operator];\n        %man %string RLMAssertCount($class, count, query, data);\n        query = [NSString stringWithFormat:@\"ANY link.dataObj %@ %%@\", operator];\n        %man %string RLMAssertCount(LinkTo$class, count, query, data);\n    };\n    void (^testNull)(NSString *, NSUInteger) = ^(NSString *operator, NSUInteger count) {\n        NSString *query = [NSString stringWithFormat:@\"ANY stringObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([AllPrimitiveArrays objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'stringObj' of type 'string'\");\n        RLMAssertCount(AllOptionalPrimitiveArrays, count, query, NSNull.null);\n        query = [NSString stringWithFormat:@\"ANY link.stringObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([LinkToAllPrimitiveArrays objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'stringObj' of type 'string'\");\n        RLMAssertCount(LinkToAllOptionalPrimitiveArrays, count, query, NSNull.null);\n\n        query = [NSString stringWithFormat:@\"ANY dataObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([AllPrimitiveArrays objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'dataObj' of type 'data'\");\n        RLMAssertCount(AllOptionalPrimitiveArrays, count, query, NSNull.null);\n\n        query = [NSString stringWithFormat:@\"ANY link.dataObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([LinkToAllPrimitiveArrays objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'dataObj' of type 'data'\");\n        RLMAssertCount(LinkToAllOptionalPrimitiveArrays, count, query, NSNull.null);\n    };\n\n    testNull(@\"==\", 0);\n    test(@\"==\", @\"\", 4);\n    test(@\"==\", @\"a\", 1);\n    test(@\"==\", @\"á\", 1);\n    test(@\"==[c]\", @\"a\", 2);\n    test(@\"==[c]\", @\"á\", 2);\n    test(@\"==\", @\"A\", 1);\n    test(@\"==\", @\"Á\", 1);\n    test(@\"==[c]\", @\"A\", 2);\n    test(@\"==[c]\", @\"Á\", 2);\n    test(@\"==[d]\", @\"a\", 2);\n    test(@\"==[d]\", @\"á\", 2);\n    test(@\"==[cd]\", @\"a\", 4);\n    test(@\"==[cd]\", @\"á\", 4);\n    test(@\"==[d]\", @\"A\", 2);\n    test(@\"==[d]\", @\"Á\", 2);\n    test(@\"==[cd]\", @\"A\", 4);\n    test(@\"==[cd]\", @\"Á\", 4);\n\n    testNull(@\"!=\", 160);\n    test(@\"!=\", @\"\", 156);\n    test(@\"!=\", @\"a\", 159);\n    test(@\"!=\", @\"á\", 159);\n    test(@\"!=[c]\", @\"a\", 158);\n    test(@\"!=[c]\", @\"á\", 158);\n    test(@\"!=\", @\"A\", 159);\n    test(@\"!=\", @\"Á\", 159);\n    test(@\"!=[c]\", @\"A\", 158);\n    test(@\"!=[c]\", @\"Á\", 158);\n    test(@\"!=[d]\", @\"a\", 158);\n    test(@\"!=[d]\", @\"á\", 158);\n    test(@\"!=[cd]\", @\"a\", 156);\n    test(@\"!=[cd]\", @\"á\", 156);\n    test(@\"!=[d]\", @\"A\", 158);\n    test(@\"!=[d]\", @\"Á\", 158);\n    test(@\"!=[cd]\", @\"A\", 156);\n    test(@\"!=[cd]\", @\"Á\", 156);\n\n    testNull(@\"CONTAINS\", 0);\n    testNull(@\"CONTAINS[c]\", 0);\n    testNull(@\"CONTAINS[d]\", 0);\n    testNull(@\"CONTAINS[cd]\", 0);\n    test(@\"CONTAINS\", @\"a\", 25);\n    test(@\"CONTAINS\", @\"á\", 25);\n    test(@\"CONTAINS[c]\", @\"a\", 50);\n    test(@\"CONTAINS[c]\", @\"á\", 50);\n    test(@\"CONTAINS\", @\"A\", 25);\n    test(@\"CONTAINS\", @\"Á\", 25);\n    test(@\"CONTAINS[c]\", @\"A\", 50);\n    test(@\"CONTAINS[c]\", @\"Á\", 50);\n    test(@\"CONTAINS[d]\", @\"a\", 50);\n    test(@\"CONTAINS[d]\", @\"á\", 50);\n    test(@\"CONTAINS[cd]\", @\"a\", 100);\n    test(@\"CONTAINS[cd]\", @\"á\", 100);\n    test(@\"CONTAINS[d]\", @\"A\", 50);\n    test(@\"CONTAINS[d]\", @\"Á\", 50);\n    test(@\"CONTAINS[cd]\", @\"A\", 100);\n    test(@\"CONTAINS[cd]\", @\"Á\", 100);\n\n    test(@\"BEGINSWITH\", @\"a\", 13);\n    test(@\"BEGINSWITH\", @\"á\", 13);\n    test(@\"BEGINSWITH[c]\", @\"a\", 26);\n    test(@\"BEGINSWITH[c]\", @\"á\", 26);\n    test(@\"BEGINSWITH\", @\"A\", 13);\n    test(@\"BEGINSWITH\", @\"Á\", 13);\n    test(@\"BEGINSWITH[c]\", @\"A\", 26);\n    test(@\"BEGINSWITH[c]\", @\"Á\", 26);\n    test(@\"BEGINSWITH[d]\", @\"a\", 26);\n    test(@\"BEGINSWITH[d]\", @\"á\", 26);\n    test(@\"BEGINSWITH[cd]\", @\"a\", 52);\n    test(@\"BEGINSWITH[cd]\", @\"á\", 52);\n    test(@\"BEGINSWITH[d]\", @\"A\", 26);\n    test(@\"BEGINSWITH[d]\", @\"Á\", 26);\n    test(@\"BEGINSWITH[cd]\", @\"A\", 52);\n    test(@\"BEGINSWITH[cd]\", @\"Á\", 52);\n\n    test(@\"ENDSWITH\", @\"a\", 13);\n    test(@\"ENDSWITH\", @\"á\", 13);\n    test(@\"ENDSWITH[c]\", @\"a\", 26);\n    test(@\"ENDSWITH[c]\", @\"á\", 26);\n    test(@\"ENDSWITH\", @\"A\", 13);\n    test(@\"ENDSWITH\", @\"Á\", 13);\n    test(@\"ENDSWITH[c]\", @\"A\", 26);\n    test(@\"ENDSWITH[c]\", @\"Á\", 26);\n    test(@\"ENDSWITH[d]\", @\"a\", 26);\n    test(@\"ENDSWITH[d]\", @\"á\", 26);\n    test(@\"ENDSWITH[cd]\", @\"a\", 52);\n    test(@\"ENDSWITH[cd]\", @\"á\", 52);\n    test(@\"ENDSWITH[d]\", @\"A\", 26);\n    test(@\"ENDSWITH[d]\", @\"Á\", 26);\n    test(@\"ENDSWITH[cd]\", @\"A\", 52);\n    test(@\"ENDSWITH[cd]\", @\"Á\", 52);\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/PrimitiveDictionaryPropertyTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\nstatic NSDate *date(int i) {\n    return [NSDate dateWithTimeIntervalSince1970:i];\n}\nstatic NSData *data(int i) {\n    return [NSData dataWithBytesNoCopy:calloc(i, 1) length:i freeWhenDone:YES];\n}\nstatic RLMDecimal128 *decimal128(int i) {\n    return [RLMDecimal128 decimalWithNumber:@(i)];\n}\nstatic NSMutableArray *objectIds;\nstatic RLMObjectId *objectId(NSUInteger i) {\n    if (!objectIds) {\n        objectIds = [NSMutableArray new];\n    }\n    while (i >= objectIds.count) {\n        [objectIds addObject:RLMObjectId.objectId];\n    }\n    return objectIds[i];\n}\nstatic NSUUID *uuid(NSString *uuidString) {\n    return [[NSUUID alloc] initWithUUIDString:uuidString];\n}\nstatic void count(NSArray *values, double *sum, NSUInteger *count) {\n    for (id value in values) {\n        if (value != NSNull.null) {\n            ++*count;\n            *sum += [value doubleValue];\n        }\n    }\n}\nstatic double sum(NSDictionary *dictionary) {\n    NSArray *values = dictionary.allValues;\n    double sum = 0;\n    NSUInteger c = 0;\n    count(values, &sum, &c);\n    return sum;\n}\nstatic double average(NSDictionary *dictionary) {\n    NSArray *values = dictionary.allValues;\n    double sum = 0;\n    NSUInteger c = 0;\n    count(values, &sum, &c);\n    return sum / c;\n}\n\n@interface LinkToAllPrimitiveDictionaries : RLMObject\n@property (nonatomic) AllPrimitiveDictionaries *link;\n@end\n@implementation LinkToAllPrimitiveDictionaries\n@end\n\n@interface LinkToAllOptionalPrimitiveDictionaries : RLMObject\n@property (nonatomic) AllOptionalPrimitiveDictionaries *link;\n@end\n@implementation LinkToAllOptionalPrimitiveDictionaries\n@end\n\n@interface PrimitiveDictionaryPropertyTests : RLMTestCase\n@end\n\n@implementation PrimitiveDictionaryPropertyTests {\n    AllPrimitiveDictionaries *unmanaged;\n    AllPrimitiveDictionaries *managed;\n    AllOptionalPrimitiveDictionaries *optUnmanaged;\n    AllOptionalPrimitiveDictionaries *optManaged;\n    RLMRealm *realm;\n    NSArray<RLMDictionary *> *allDictionaries;\n}\n\n- (void)setUp {\n    unmanaged = [[AllPrimitiveDictionaries alloc] init];\n    optUnmanaged = [[AllOptionalPrimitiveDictionaries alloc] init];\n    realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    managed = [AllPrimitiveDictionaries createInRealm:realm withValue:@[]];\n    optManaged = [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@[]];\n    allDictionaries = @[\n        unmanaged.boolObj,\n        optUnmanaged.boolObj,\n        managed.boolObj,\n        optManaged.boolObj,\n        unmanaged.intObj,\n        optUnmanaged.intObj,\n        managed.intObj,\n        optManaged.intObj,\n        unmanaged.stringObj,\n        optUnmanaged.stringObj,\n        managed.stringObj,\n        optManaged.stringObj,\n        unmanaged.dateObj,\n        optUnmanaged.dateObj,\n        managed.dateObj,\n        optManaged.dateObj,\n        unmanaged.floatObj,\n        optUnmanaged.floatObj,\n        managed.floatObj,\n        optManaged.floatObj,\n        unmanaged.doubleObj,\n        optUnmanaged.doubleObj,\n        managed.doubleObj,\n        optManaged.doubleObj,\n        unmanaged.dataObj,\n        optUnmanaged.dataObj,\n        managed.dataObj,\n        optManaged.dataObj,\n        unmanaged.decimalObj,\n        optUnmanaged.decimalObj,\n        managed.decimalObj,\n        optManaged.decimalObj,\n        unmanaged.objectIdObj,\n        optUnmanaged.objectIdObj,\n        managed.objectIdObj,\n        optManaged.objectIdObj,\n        unmanaged.uuidObj,\n        optUnmanaged.uuidObj,\n        managed.uuidObj,\n        optManaged.uuidObj,\n        unmanaged.anyBoolObj,\n        unmanaged.anyIntObj,\n        unmanaged.anyFloatObj,\n        unmanaged.anyDoubleObj,\n        unmanaged.anyStringObj,\n        unmanaged.anyDataObj,\n        unmanaged.anyDateObj,\n        unmanaged.anyDecimalObj,\n        unmanaged.anyObjectIdObj,\n        unmanaged.anyUUIDObj,\n        managed.anyBoolObj,\n        managed.anyIntObj,\n        managed.anyFloatObj,\n        managed.anyDoubleObj,\n        managed.anyStringObj,\n        managed.anyDataObj,\n        managed.anyDateObj,\n        managed.anyDecimalObj,\n        managed.anyObjectIdObj,\n        managed.anyUUIDObj,\n    ];\n}\n\n- (void)tearDown {\n    if (realm.inWriteTransaction) {\n        [realm cancelWriteTransaction];\n    }\n}\n\n- (void)addObjects {\n    [unmanaged.boolObj addEntriesFromDictionary:@{ @\"key1\": @NO, @\"key2\": @YES }];\n    [optUnmanaged.boolObj addEntriesFromDictionary:@{ @\"key1\": @NO, @\"key2\": NSNull.null }];\n    [managed.boolObj addEntriesFromDictionary:@{ @\"key1\": @NO, @\"key2\": @YES }];\n    [optManaged.boolObj addEntriesFromDictionary:@{ @\"key1\": @NO, @\"key2\": NSNull.null }];\n    [unmanaged.intObj addEntriesFromDictionary:@{ @\"key1\": @2, @\"key2\": @3 }];\n    [optUnmanaged.intObj addEntriesFromDictionary:@{ @\"key1\": @2, @\"key2\": NSNull.null }];\n    [managed.intObj addEntriesFromDictionary:@{ @\"key1\": @2, @\"key2\": @3 }];\n    [optManaged.intObj addEntriesFromDictionary:@{ @\"key1\": @2, @\"key2\": NSNull.null }];\n    [unmanaged.stringObj addEntriesFromDictionary:@{ @\"key1\": @\"bar\", @\"key2\": @\"foo\" }];\n    [optUnmanaged.stringObj addEntriesFromDictionary:@{ @\"key1\": @\"bar\", @\"key2\": NSNull.null }];\n    [managed.stringObj addEntriesFromDictionary:@{ @\"key1\": @\"bar\", @\"key2\": @\"foo\" }];\n    [optManaged.stringObj addEntriesFromDictionary:@{ @\"key1\": @\"bar\", @\"key2\": NSNull.null }];\n    [unmanaged.dateObj addEntriesFromDictionary:@{ @\"key1\": date(1), @\"key2\": date(2) }];\n    [optUnmanaged.dateObj addEntriesFromDictionary:@{ @\"key1\": date(1), @\"key2\": NSNull.null }];\n    [managed.dateObj addEntriesFromDictionary:@{ @\"key1\": date(1), @\"key2\": date(2) }];\n    [optManaged.dateObj addEntriesFromDictionary:@{ @\"key1\": date(1), @\"key2\": NSNull.null }];\n    [unmanaged.floatObj addEntriesFromDictionary:@{ @\"key1\": @2.2f, @\"key2\": @3.3f }];\n    [optUnmanaged.floatObj addEntriesFromDictionary:@{ @\"key1\": @2.2f, @\"key2\": NSNull.null }];\n    [managed.floatObj addEntriesFromDictionary:@{ @\"key1\": @2.2f, @\"key2\": @3.3f }];\n    [optManaged.floatObj addEntriesFromDictionary:@{ @\"key1\": @2.2f, @\"key2\": NSNull.null }];\n    [unmanaged.doubleObj addEntriesFromDictionary:@{ @\"key1\": @2.2, @\"key2\": @3.3 }];\n    [optUnmanaged.doubleObj addEntriesFromDictionary:@{ @\"key1\": @2.2, @\"key2\": NSNull.null }];\n    [managed.doubleObj addEntriesFromDictionary:@{ @\"key1\": @2.2, @\"key2\": @3.3 }];\n    [optManaged.doubleObj addEntriesFromDictionary:@{ @\"key1\": @2.2, @\"key2\": NSNull.null }];\n    [unmanaged.dataObj addEntriesFromDictionary:@{ @\"key1\": data(1), @\"key2\": data(2) }];\n    [optUnmanaged.dataObj addEntriesFromDictionary:@{ @\"key1\": data(1), @\"key2\": NSNull.null }];\n    [managed.dataObj addEntriesFromDictionary:@{ @\"key1\": data(1), @\"key2\": data(2) }];\n    [optManaged.dataObj addEntriesFromDictionary:@{ @\"key1\": data(1), @\"key2\": NSNull.null }];\n    [unmanaged.decimalObj addEntriesFromDictionary:@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }];\n    [optUnmanaged.decimalObj addEntriesFromDictionary:@{ @\"key1\": decimal128(2), @\"key2\": NSNull.null }];\n    [managed.decimalObj addEntriesFromDictionary:@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }];\n    [optManaged.decimalObj addEntriesFromDictionary:@{ @\"key1\": decimal128(2), @\"key2\": NSNull.null }];\n    [unmanaged.objectIdObj addEntriesFromDictionary:@{ @\"key1\": objectId(1), @\"key2\": objectId(2) }];\n    [optUnmanaged.objectIdObj addEntriesFromDictionary:@{ @\"key1\": objectId(1), @\"key2\": NSNull.null }];\n    [managed.objectIdObj addEntriesFromDictionary:@{ @\"key1\": objectId(1), @\"key2\": objectId(2) }];\n    [optManaged.objectIdObj addEntriesFromDictionary:@{ @\"key1\": objectId(1), @\"key2\": NSNull.null }];\n    [unmanaged.uuidObj addEntriesFromDictionary:@{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") }];\n    [optUnmanaged.uuidObj addEntriesFromDictionary:@{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": NSNull.null }];\n    [managed.uuidObj addEntriesFromDictionary:@{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") }];\n    [optManaged.uuidObj addEntriesFromDictionary:@{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": NSNull.null }];\n    [unmanaged.anyBoolObj addEntriesFromDictionary:@{ @\"key1\": @NO, @\"key2\": @YES }];\n    [unmanaged.anyIntObj addEntriesFromDictionary:@{ @\"key1\": @2, @\"key2\": @3 }];\n    [unmanaged.anyFloatObj addEntriesFromDictionary:@{ @\"key1\": @2.2f, @\"key2\": @3.3f }];\n    [unmanaged.anyDoubleObj addEntriesFromDictionary:@{ @\"key1\": @2.2, @\"key2\": @3.3 }];\n    [unmanaged.anyStringObj addEntriesFromDictionary:@{ @\"key1\": @\"a\", @\"key2\": @\"b\" }];\n    [unmanaged.anyDataObj addEntriesFromDictionary:@{ @\"key1\": data(1), @\"key2\": data(2) }];\n    [unmanaged.anyDateObj addEntriesFromDictionary:@{ @\"key1\": date(1), @\"key2\": date(2) }];\n    [unmanaged.anyDecimalObj addEntriesFromDictionary:@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }];\n    [unmanaged.anyObjectIdObj addEntriesFromDictionary:@{ @\"key1\": objectId(1), @\"key2\": objectId(2) }];\n    [unmanaged.anyUUIDObj addEntriesFromDictionary:@{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") }];\n    [managed.anyBoolObj addEntriesFromDictionary:@{ @\"key1\": @NO, @\"key2\": @YES }];\n    [managed.anyIntObj addEntriesFromDictionary:@{ @\"key1\": @2, @\"key2\": @3 }];\n    [managed.anyFloatObj addEntriesFromDictionary:@{ @\"key1\": @2.2f, @\"key2\": @3.3f }];\n    [managed.anyDoubleObj addEntriesFromDictionary:@{ @\"key1\": @2.2, @\"key2\": @3.3 }];\n    [managed.anyStringObj addEntriesFromDictionary:@{ @\"key1\": @\"a\", @\"key2\": @\"b\" }];\n    [managed.anyDataObj addEntriesFromDictionary:@{ @\"key1\": data(1), @\"key2\": data(2) }];\n    [managed.anyDateObj addEntriesFromDictionary:@{ @\"key1\": date(1), @\"key2\": date(2) }];\n    [managed.anyDecimalObj addEntriesFromDictionary:@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }];\n    [managed.anyObjectIdObj addEntriesFromDictionary:@{ @\"key1\": objectId(1), @\"key2\": objectId(2) }];\n    [managed.anyUUIDObj addEntriesFromDictionary:@{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") }];\n}\n\n- (void)testCount {\n    uncheckedAssertEqual(unmanaged.intObj.count, 0U);\n    unmanaged.intObj[@\"testVal\"] = @1;\n    uncheckedAssertEqual(unmanaged.intObj.count, 1U);\n}\n\n- (void)testType {\n    uncheckedAssertEqual(unmanaged.boolObj.type, RLMPropertyTypeBool);\n    uncheckedAssertEqual(unmanaged.intObj.type, RLMPropertyTypeInt);\n    uncheckedAssertEqual(unmanaged.floatObj.type, RLMPropertyTypeFloat);\n    uncheckedAssertEqual(unmanaged.doubleObj.type, RLMPropertyTypeDouble);\n    uncheckedAssertEqual(unmanaged.stringObj.type, RLMPropertyTypeString);\n    uncheckedAssertEqual(unmanaged.dataObj.type, RLMPropertyTypeData);\n    uncheckedAssertEqual(unmanaged.dateObj.type, RLMPropertyTypeDate);\n    uncheckedAssertEqual(optUnmanaged.boolObj.type, RLMPropertyTypeBool);\n    uncheckedAssertEqual(optUnmanaged.intObj.type, RLMPropertyTypeInt);\n    uncheckedAssertEqual(optUnmanaged.floatObj.type, RLMPropertyTypeFloat);\n    uncheckedAssertEqual(optUnmanaged.doubleObj.type, RLMPropertyTypeDouble);\n    uncheckedAssertEqual(optUnmanaged.stringObj.type, RLMPropertyTypeString);\n    uncheckedAssertEqual(optUnmanaged.dataObj.type, RLMPropertyTypeData);\n    uncheckedAssertEqual(optUnmanaged.dateObj.type, RLMPropertyTypeDate);\n}\n\n- (void)testOptional {\n    uncheckedAssertFalse(unmanaged.boolObj.optional);\n    uncheckedAssertFalse(unmanaged.intObj.optional);\n    uncheckedAssertFalse(unmanaged.floatObj.optional);\n    uncheckedAssertFalse(unmanaged.doubleObj.optional);\n    uncheckedAssertFalse(unmanaged.stringObj.optional);\n    uncheckedAssertFalse(unmanaged.dataObj.optional);\n    uncheckedAssertFalse(unmanaged.dateObj.optional);\n    uncheckedAssertTrue(optUnmanaged.boolObj.optional);\n    uncheckedAssertTrue(optUnmanaged.intObj.optional);\n    uncheckedAssertTrue(optUnmanaged.floatObj.optional);\n    uncheckedAssertTrue(optUnmanaged.doubleObj.optional);\n    uncheckedAssertTrue(optUnmanaged.stringObj.optional);\n    uncheckedAssertTrue(optUnmanaged.dataObj.optional);\n    uncheckedAssertTrue(optUnmanaged.dateObj.optional);\n}\n\n- (void)testObjectClassName {\n    uncheckedAssertNil(unmanaged.boolObj.objectClassName);\n    uncheckedAssertNil(unmanaged.intObj.objectClassName);\n    uncheckedAssertNil(unmanaged.floatObj.objectClassName);\n    uncheckedAssertNil(unmanaged.doubleObj.objectClassName);\n    uncheckedAssertNil(unmanaged.stringObj.objectClassName);\n    uncheckedAssertNil(unmanaged.dataObj.objectClassName);\n    uncheckedAssertNil(unmanaged.dateObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.boolObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.intObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.floatObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.doubleObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.stringObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.dataObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.dateObj.objectClassName);\n}\n\n- (void)testRealm {\n    uncheckedAssertNil(unmanaged.boolObj.realm);\n    uncheckedAssertNil(unmanaged.intObj.realm);\n    uncheckedAssertNil(unmanaged.floatObj.realm);\n    uncheckedAssertNil(unmanaged.doubleObj.realm);\n    uncheckedAssertNil(unmanaged.stringObj.realm);\n    uncheckedAssertNil(unmanaged.dataObj.realm);\n    uncheckedAssertNil(unmanaged.dateObj.realm);\n    uncheckedAssertNil(optUnmanaged.boolObj.realm);\n    uncheckedAssertNil(optUnmanaged.intObj.realm);\n    uncheckedAssertNil(optUnmanaged.floatObj.realm);\n    uncheckedAssertNil(optUnmanaged.doubleObj.realm);\n    uncheckedAssertNil(optUnmanaged.stringObj.realm);\n    uncheckedAssertNil(optUnmanaged.dataObj.realm);\n    uncheckedAssertNil(optUnmanaged.dateObj.realm);\n}\n\n- (void)testInvalidated {\n    RLMDictionary *dictionary;\n    @autoreleasepool {\n        AllPrimitiveDictionaries *obj = [[AllPrimitiveDictionaries alloc] init];\n        dictionary = obj.intObj;\n        uncheckedAssertFalse(dictionary.invalidated);\n    }\n    uncheckedAssertFalse(dictionary.invalidated);\n}\n\n- (void)testDeleteObjectsInRealm {\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.boolObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:optUnmanaged.boolObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.intObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:optUnmanaged.intObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.stringObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:optUnmanaged.stringObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.dateObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:optUnmanaged.dateObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.floatObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:optUnmanaged.floatObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.doubleObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:optUnmanaged.doubleObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.dataObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:optUnmanaged.dataObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.decimalObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:optUnmanaged.decimalObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.objectIdObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:optUnmanaged.objectIdObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.uuidObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:optUnmanaged.uuidObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.anyBoolObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.anyIntObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.anyFloatObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.anyDoubleObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.anyStringObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.anyDataObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.anyDateObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.anyDecimalObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.anyObjectIdObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:unmanaged.anyUUIDObj], @\"Cannot delete objects from RLMDictionary\");\n    RLMAssertThrowsWithReason([realm deleteObjects:managed.boolObj], @\"Cannot delete objects from \u0010RLMManagedDictionary<RLMString, bool>: only RLMObjects can be deleted.\");\n    RLMAssertThrowsWithReason([realm deleteObjects:optManaged.boolObj], @\"Cannot delete objects from \u0010RLMManagedDictionary<RLMString, bool?>: only RLMObjects can be deleted.\");\n    RLMAssertThrowsWithReason([realm deleteObjects:managed.intObj], @\"Cannot delete objects from \u0010RLMManagedDictionary<RLMString, int>: only RLMObjects can be deleted.\");\n    RLMAssertThrowsWithReason([realm deleteObjects:optManaged.intObj], @\"Cannot delete objects from \u0010RLMManagedDictionary<RLMString, int?>: only RLMObjects can be deleted.\");\n    RLMAssertThrowsWithReason([realm deleteObjects:managed.stringObj], @\"Cannot delete objects from \u0010RLMManagedDictionary<RLMString, string>: only RLMObjects can be deleted.\");\n    RLMAssertThrowsWithReason([realm deleteObjects:optManaged.stringObj], @\"Cannot delete objects from \u0010RLMManagedDictionary<RLMString, string?>: only RLMObjects can be deleted.\");\n    RLMAssertThrowsWithReason([realm deleteObjects:managed.dateObj], @\"Cannot delete objects from \u0010RLMManagedDictionary<RLMString, date>: only RLMObjects can be deleted.\");\n    RLMAssertThrowsWithReason([realm deleteObjects:optManaged.dateObj], @\"Cannot delete objects from \u0010RLMManagedDictionary<RLMString, date?>: only RLMObjects can be deleted.\");\n    RLMAssertThrowsWithReason([realm deleteObjects:managed.anyBoolObj], @\"Cannot delete objects from \u0010RLMManagedDictionary<RLMString, mixed>: only RLMObjects can be deleted.\");\n    RLMAssertThrowsWithReason([realm deleteObjects:managed.anyIntObj], @\"Cannot delete objects from \u0010RLMManagedDictionary<RLMString, mixed>: only RLMObjects can be deleted.\");\n    RLMAssertThrowsWithReason([realm deleteObjects:managed.anyFloatObj], @\"Cannot delete objects from \u0010RLMManagedDictionary<RLMString, mixed>: only RLMObjects can be deleted.\");\n    RLMAssertThrowsWithReason([realm deleteObjects:managed.anyDoubleObj], @\"Cannot delete objects from \u0010RLMManagedDictionary<RLMString, mixed>: only RLMObjects can be deleted.\");\n    RLMAssertThrowsWithReason([realm deleteObjects:managed.anyStringObj], @\"Cannot delete objects from \u0010RLMManagedDictionary<RLMString, mixed>: only RLMObjects can be deleted.\");\n    RLMAssertThrowsWithReason([realm deleteObjects:managed.anyDataObj], @\"Cannot delete objects from \u0010RLMManagedDictionary<RLMString, mixed>: only RLMObjects can be deleted.\");\n    RLMAssertThrowsWithReason([realm deleteObjects:managed.anyDateObj], @\"Cannot delete objects from \u0010RLMManagedDictionary<RLMString, mixed>: only RLMObjects can be deleted.\");\n    RLMAssertThrowsWithReason([realm deleteObjects:managed.anyDecimalObj], @\"Cannot delete objects from \u0010RLMManagedDictionary<RLMString, mixed>: only RLMObjects can be deleted.\");\n    RLMAssertThrowsWithReason([realm deleteObjects:managed.anyUUIDObj], @\"Cannot delete objects from \u0010RLMManagedDictionary<RLMString, mixed>: only RLMObjects can be deleted.\");\n}\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wnonnull\"\n\n- (void)testSetObject {\n    // Managed non-optional\n    uncheckedAssertNil(managed.boolObj[@\"key1\"]);\n    uncheckedAssertNil(managed.intObj[@\"key1\"]);\n    uncheckedAssertNil(managed.stringObj[@\"key1\"]);\n    uncheckedAssertNil(managed.dateObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyBoolObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyIntObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyFloatObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyDoubleObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyStringObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyDataObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyDateObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyDecimalObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyUUIDObj[@\"key1\"]);\n    XCTAssertNoThrow(managed.boolObj[@\"key1\"] = @NO);\n    XCTAssertNoThrow(managed.intObj[@\"key1\"] = @2);\n    XCTAssertNoThrow(managed.stringObj[@\"key1\"] = @\"bar\");\n    XCTAssertNoThrow(managed.dateObj[@\"key1\"] = date(1));\n    XCTAssertNoThrow(managed.anyBoolObj[@\"key1\"] = @NO);\n    XCTAssertNoThrow(managed.anyIntObj[@\"key1\"] = @2);\n    XCTAssertNoThrow(managed.anyFloatObj[@\"key1\"] = @2.2f);\n    XCTAssertNoThrow(managed.anyDoubleObj[@\"key1\"] = @2.2);\n    XCTAssertNoThrow(managed.anyStringObj[@\"key1\"] = @\"a\");\n    XCTAssertNoThrow(managed.anyDataObj[@\"key1\"] = data(1));\n    XCTAssertNoThrow(managed.anyDateObj[@\"key1\"] = date(1));\n    XCTAssertNoThrow(managed.anyDecimalObj[@\"key1\"] = decimal128(2));\n    XCTAssertNoThrow(managed.anyUUIDObj[@\"key1\"] = uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(managed.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(managed.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(managed.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(managed.anyIntObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(managed.anyStringObj[@\"key1\"], @\"a\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(managed.anyDateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertThrowsWithReason(managed.boolObj[@\"key1\"] = (id)NSNull.null, @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'.\");\n    RLMAssertThrowsWithReason(managed.intObj[@\"key1\"] = (id)NSNull.null, @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'.\");\n    RLMAssertThrowsWithReason(managed.stringObj[@\"key1\"] = (id)NSNull.null, @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'.\");\n    RLMAssertThrowsWithReason(managed.dateObj[@\"key1\"] = (id)NSNull.null, @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'.\");\n    XCTAssertNoThrow(managed.boolObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(managed.intObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(managed.stringObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(managed.dateObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(managed.anyBoolObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(managed.anyIntObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(managed.anyFloatObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(managed.anyDoubleObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(managed.anyStringObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(managed.anyDataObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(managed.anyDateObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(managed.anyDecimalObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(managed.anyUUIDObj[@\"key1\"] = nil);\n    uncheckedAssertNil(managed.boolObj[@\"key1\"]);\n    uncheckedAssertNil(managed.intObj[@\"key1\"]);\n    uncheckedAssertNil(managed.stringObj[@\"key1\"]);\n    uncheckedAssertNil(managed.dateObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyBoolObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyIntObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyFloatObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyDoubleObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyStringObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyDataObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyDateObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyDecimalObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyUUIDObj[@\"key1\"]);\n\n    // Managed optional\n    uncheckedAssertNil(optManaged.boolObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.intObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.stringObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.dateObj[@\"key1\"]);\n    XCTAssertNoThrow(optManaged.boolObj[@\"key1\"] = @NO);\n    XCTAssertNoThrow(optManaged.intObj[@\"key1\"] = @2);\n    XCTAssertNoThrow(optManaged.stringObj[@\"key1\"] = @\"bar\");\n    XCTAssertNoThrow(optManaged.dateObj[@\"key1\"] = date(1));\n    uncheckedAssertEqualObjects(optManaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(optManaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(optManaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(optManaged.dateObj[@\"key1\"], date(1));\n    XCTAssertNoThrow(optManaged.boolObj[@\"key1\"] = (id)NSNull.null);\n    XCTAssertNoThrow(optManaged.intObj[@\"key1\"] = (id)NSNull.null);\n    XCTAssertNoThrow(optManaged.stringObj[@\"key1\"] = (id)NSNull.null);\n    XCTAssertNoThrow(optManaged.dateObj[@\"key1\"] = (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.boolObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.intObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.stringObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dateObj[@\"key1\"], (id)NSNull.null);\n    XCTAssertNoThrow(optManaged.boolObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(optManaged.intObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(optManaged.stringObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(optManaged.dateObj[@\"key1\"] = nil);\n    uncheckedAssertNil(optManaged.boolObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.intObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.stringObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.dateObj[@\"key1\"]);\n\n    // Unmanaged non-optional\n    uncheckedAssertNil(unmanaged.boolObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.intObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.stringObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.dateObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.floatObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.doubleObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.dataObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.decimalObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.objectIdObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.uuidObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyBoolObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyIntObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyFloatObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyDoubleObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyStringObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyDataObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyDateObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyDecimalObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyObjectIdObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyUUIDObj[@\"key1\"]);\n    XCTAssertNoThrow(unmanaged.boolObj[@\"key1\"] = @NO);\n    XCTAssertNoThrow(unmanaged.intObj[@\"key1\"] = @2);\n    XCTAssertNoThrow(unmanaged.stringObj[@\"key1\"] = @\"bar\");\n    XCTAssertNoThrow(unmanaged.dateObj[@\"key1\"] = date(1));\n    XCTAssertNoThrow(unmanaged.floatObj[@\"key1\"] = @2.2f);\n    XCTAssertNoThrow(unmanaged.doubleObj[@\"key1\"] = @2.2);\n    XCTAssertNoThrow(unmanaged.dataObj[@\"key1\"] = data(1));\n    XCTAssertNoThrow(unmanaged.decimalObj[@\"key1\"] = decimal128(2));\n    XCTAssertNoThrow(unmanaged.objectIdObj[@\"key1\"] = objectId(1));\n    XCTAssertNoThrow(unmanaged.uuidObj[@\"key1\"] = uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    XCTAssertNoThrow(unmanaged.anyBoolObj[@\"key1\"] = @NO);\n    XCTAssertNoThrow(unmanaged.anyIntObj[@\"key1\"] = @2);\n    XCTAssertNoThrow(unmanaged.anyFloatObj[@\"key1\"] = @2.2f);\n    XCTAssertNoThrow(unmanaged.anyDoubleObj[@\"key1\"] = @2.2);\n    XCTAssertNoThrow(unmanaged.anyStringObj[@\"key1\"] = @\"a\");\n    XCTAssertNoThrow(unmanaged.anyDataObj[@\"key1\"] = data(1));\n    XCTAssertNoThrow(unmanaged.anyDateObj[@\"key1\"] = date(1));\n    XCTAssertNoThrow(unmanaged.anyDecimalObj[@\"key1\"] = decimal128(2));\n    XCTAssertNoThrow(unmanaged.anyObjectIdObj[@\"key1\"] = objectId(1));\n    XCTAssertNoThrow(unmanaged.anyUUIDObj[@\"key1\"] = uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(unmanaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(unmanaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(unmanaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[@\"key1\"], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertThrowsWithReason(unmanaged.boolObj[@\"key1\"] = (id)NSNull.null, @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj[@\"key1\"] = (id)NSNull.null, @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'.\");\n    RLMAssertThrowsWithReason(unmanaged.stringObj[@\"key1\"] = (id)NSNull.null, @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'.\");\n    RLMAssertThrowsWithReason(unmanaged.dateObj[@\"key1\"] = (id)NSNull.null, @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'.\");\n    RLMAssertThrowsWithReason(unmanaged.floatObj[@\"key1\"] = (id)NSNull.null, @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'.\");\n    RLMAssertThrowsWithReason(unmanaged.doubleObj[@\"key1\"] = (id)NSNull.null, @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'.\");\n    RLMAssertThrowsWithReason(unmanaged.dataObj[@\"key1\"] = (id)NSNull.null, @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'.\");\n    RLMAssertThrowsWithReason(unmanaged.decimalObj[@\"key1\"] = (id)NSNull.null, @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'.\");\n    RLMAssertThrowsWithReason(unmanaged.objectIdObj[@\"key1\"] = (id)NSNull.null, @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'.\");\n    RLMAssertThrowsWithReason(unmanaged.uuidObj[@\"key1\"] = (id)NSNull.null, @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'.\");\n    XCTAssertNoThrow(unmanaged.boolObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(unmanaged.intObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(unmanaged.stringObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(unmanaged.dateObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(unmanaged.floatObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(unmanaged.doubleObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(unmanaged.dataObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(unmanaged.decimalObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(unmanaged.objectIdObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(unmanaged.uuidObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(unmanaged.anyBoolObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(unmanaged.anyIntObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(unmanaged.anyFloatObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(unmanaged.anyDoubleObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(unmanaged.anyStringObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(unmanaged.anyDataObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(unmanaged.anyDateObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(unmanaged.anyDecimalObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(unmanaged.anyObjectIdObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(unmanaged.anyUUIDObj[@\"key1\"] = nil);\n    uncheckedAssertNil(unmanaged.boolObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.intObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.stringObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.dateObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.floatObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.doubleObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.dataObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.decimalObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.objectIdObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.uuidObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyBoolObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyIntObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyFloatObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyDoubleObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyStringObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyDataObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyDateObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyDecimalObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyObjectIdObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyUUIDObj[@\"key1\"]);\n\n    // Unmanaged optional\n    uncheckedAssertNil(optUnmanaged.boolObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.intObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.stringObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.dateObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.floatObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.doubleObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.dataObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.decimalObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.objectIdObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.uuidObj[@\"key1\"]);\n    XCTAssertNoThrow(optUnmanaged.boolObj[@\"key1\"] = @NO);\n    XCTAssertNoThrow(optUnmanaged.intObj[@\"key1\"] = @2);\n    XCTAssertNoThrow(optUnmanaged.stringObj[@\"key1\"] = @\"bar\");\n    XCTAssertNoThrow(optUnmanaged.dateObj[@\"key1\"] = date(1));\n    XCTAssertNoThrow(optUnmanaged.floatObj[@\"key1\"] = @2.2f);\n    XCTAssertNoThrow(optUnmanaged.doubleObj[@\"key1\"] = @2.2);\n    XCTAssertNoThrow(optUnmanaged.dataObj[@\"key1\"] = data(1));\n    XCTAssertNoThrow(optUnmanaged.decimalObj[@\"key1\"] = decimal128(2));\n    XCTAssertNoThrow(optUnmanaged.objectIdObj[@\"key1\"] = objectId(1));\n    XCTAssertNoThrow(optUnmanaged.uuidObj[@\"key1\"] = uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    XCTAssertNoThrow(optUnmanaged.boolObj[@\"key1\"] = (id)NSNull.null);\n    XCTAssertNoThrow(optUnmanaged.intObj[@\"key1\"] = (id)NSNull.null);\n    XCTAssertNoThrow(optUnmanaged.stringObj[@\"key1\"] = (id)NSNull.null);\n    XCTAssertNoThrow(optUnmanaged.dateObj[@\"key1\"] = (id)NSNull.null);\n    XCTAssertNoThrow(optUnmanaged.floatObj[@\"key1\"] = (id)NSNull.null);\n    XCTAssertNoThrow(optUnmanaged.doubleObj[@\"key1\"] = (id)NSNull.null);\n    XCTAssertNoThrow(optUnmanaged.dataObj[@\"key1\"] = (id)NSNull.null);\n    XCTAssertNoThrow(optUnmanaged.decimalObj[@\"key1\"] = (id)NSNull.null);\n    XCTAssertNoThrow(optUnmanaged.objectIdObj[@\"key1\"] = (id)NSNull.null);\n    XCTAssertNoThrow(optUnmanaged.uuidObj[@\"key1\"] = (id)NSNull.null);\n    uncheckedAssertEqual(optUnmanaged.boolObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqual(optUnmanaged.intObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqual(optUnmanaged.stringObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqual(optUnmanaged.dateObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqual(optUnmanaged.floatObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqual(optUnmanaged.doubleObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqual(optUnmanaged.dataObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqual(optUnmanaged.decimalObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqual(optUnmanaged.objectIdObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqual(optUnmanaged.uuidObj[@\"key1\"], (id)NSNull.null);\n    XCTAssertNoThrow(optUnmanaged.boolObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(optUnmanaged.intObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(optUnmanaged.stringObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(optUnmanaged.dateObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(optUnmanaged.floatObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(optUnmanaged.doubleObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(optUnmanaged.dataObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(optUnmanaged.decimalObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(optUnmanaged.objectIdObj[@\"key1\"] = nil);\n    XCTAssertNoThrow(optUnmanaged.uuidObj[@\"key1\"] = nil);\n    uncheckedAssertNil(optUnmanaged.boolObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.intObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.stringObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.dateObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.floatObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.doubleObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.dataObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.decimalObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.objectIdObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.uuidObj[@\"key1\"]);\n\n    // Fail with nil key\n    RLMAssertThrowsWithReason([unmanaged.boolObj setObject:@NO forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj setObject:@NO forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.boolObj setObject:@NO forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optManaged.boolObj setObject:@NO forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([unmanaged.intObj setObject:@2 forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj setObject:@2 forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.intObj setObject:@2 forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optManaged.intObj setObject:@2 forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj setObject:@\"bar\" forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj setObject:@\"bar\" forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.stringObj setObject:@\"bar\" forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optManaged.stringObj setObject:@\"bar\" forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj setObject:date(1) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj setObject:date(1) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.dateObj setObject:date(1) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optManaged.dateObj setObject:date(1) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj setObject:@2.2f forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj setObject:@2.2f forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.floatObj setObject:@2.2f forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optManaged.floatObj setObject:@2.2f forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj setObject:@2.2 forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj setObject:@2.2 forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.doubleObj setObject:@2.2 forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj setObject:@2.2 forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj setObject:data(1) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj setObject:data(1) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.dataObj setObject:data(1) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optManaged.dataObj setObject:data(1) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj setObject:decimal128(2) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj setObject:decimal128(2) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.decimalObj setObject:decimal128(2) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj setObject:decimal128(2) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj setObject:objectId(1) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj setObject:objectId(1) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.objectIdObj setObject:objectId(1) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj setObject:objectId(1) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj setObject:uuid(@\"00000000-0000-0000-0000-000000000000\") forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj setObject:uuid(@\"00000000-0000-0000-0000-000000000000\") forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.uuidObj setObject:uuid(@\"00000000-0000-0000-0000-000000000000\") forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj setObject:uuid(@\"00000000-0000-0000-0000-000000000000\") forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([unmanaged.anyBoolObj setObject:@NO forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([unmanaged.anyIntObj setObject:@2 forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([unmanaged.anyFloatObj setObject:@2.2f forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([unmanaged.anyDoubleObj setObject:@2.2 forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([unmanaged.anyStringObj setObject:@\"a\" forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([unmanaged.anyDataObj setObject:data(1) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([unmanaged.anyDateObj setObject:date(1) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([unmanaged.anyDecimalObj setObject:decimal128(2) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([unmanaged.anyObjectIdObj setObject:objectId(1) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([unmanaged.anyUUIDObj setObject:uuid(@\"00000000-0000-0000-0000-000000000000\") forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.anyBoolObj setObject:@NO forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.anyIntObj setObject:@2 forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.anyFloatObj setObject:@2.2f forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.anyDoubleObj setObject:@2.2 forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.anyStringObj setObject:@\"a\" forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.anyDataObj setObject:data(1) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.anyDateObj setObject:date(1) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.anyDecimalObj setObject:decimal128(2) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.anyObjectIdObj setObject:objectId(1) forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    RLMAssertThrowsWithReason([managed.anyUUIDObj setObject:uuid(@\"00000000-0000-0000-0000-000000000000\") forKey:nil],\n                              @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    // Fail on set nil for non-optional\n    RLMAssertThrowsWithReason([unmanaged.boolObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.boolObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.intObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.stringObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.dateObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.floatObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.doubleObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dataObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.decimalObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([managed.uuidObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n\n    RLMAssertThrowsWithReason([unmanaged.boolObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([managed.boolObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([managed.intObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([optManaged.intObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj setObject:(id)@2 forKey:@\"key1\"],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj setObject:(id)@2 forKey:@\"key1\"],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([managed.stringObj setObject:(id)@2 forKey:@\"key1\"],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj setObject:(id)@2 forKey:@\"key1\"],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([managed.dateObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([managed.floatObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([optManaged.floatObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([managed.doubleObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([managed.dataObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([managed.decimalObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([managed.uuidObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj setObject:(id)@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([unmanaged.boolObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.boolObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.intObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.stringObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.dateObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.floatObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.doubleObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dataObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.decimalObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([managed.uuidObj setObject:(id)NSNull.null forKey:@\"key1\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n\n    unmanaged.boolObj[@\"key1\"] = @NO;\n    optUnmanaged.boolObj[@\"key1\"] = @NO;\n    managed.boolObj[@\"key1\"] = @NO;\n    optManaged.boolObj[@\"key1\"] = @NO;\n    unmanaged.intObj[@\"key1\"] = @2;\n    optUnmanaged.intObj[@\"key1\"] = @2;\n    managed.intObj[@\"key1\"] = @2;\n    optManaged.intObj[@\"key1\"] = @2;\n    unmanaged.stringObj[@\"key1\"] = @\"bar\";\n    optUnmanaged.stringObj[@\"key1\"] = @\"bar\";\n    managed.stringObj[@\"key1\"] = @\"bar\";\n    optManaged.stringObj[@\"key1\"] = @\"bar\";\n    unmanaged.dateObj[@\"key1\"] = date(1);\n    optUnmanaged.dateObj[@\"key1\"] = date(1);\n    managed.dateObj[@\"key1\"] = date(1);\n    optManaged.dateObj[@\"key1\"] = date(1);\n    unmanaged.floatObj[@\"key1\"] = @2.2f;\n    optUnmanaged.floatObj[@\"key1\"] = @2.2f;\n    managed.floatObj[@\"key1\"] = @2.2f;\n    optManaged.floatObj[@\"key1\"] = @2.2f;\n    unmanaged.doubleObj[@\"key1\"] = @2.2;\n    optUnmanaged.doubleObj[@\"key1\"] = @2.2;\n    managed.doubleObj[@\"key1\"] = @2.2;\n    optManaged.doubleObj[@\"key1\"] = @2.2;\n    unmanaged.dataObj[@\"key1\"] = data(1);\n    optUnmanaged.dataObj[@\"key1\"] = data(1);\n    managed.dataObj[@\"key1\"] = data(1);\n    optManaged.dataObj[@\"key1\"] = data(1);\n    unmanaged.decimalObj[@\"key1\"] = decimal128(2);\n    optUnmanaged.decimalObj[@\"key1\"] = decimal128(2);\n    managed.decimalObj[@\"key1\"] = decimal128(2);\n    optManaged.decimalObj[@\"key1\"] = decimal128(2);\n    unmanaged.objectIdObj[@\"key1\"] = objectId(1);\n    optUnmanaged.objectIdObj[@\"key1\"] = objectId(1);\n    managed.objectIdObj[@\"key1\"] = objectId(1);\n    optManaged.objectIdObj[@\"key1\"] = objectId(1);\n    unmanaged.uuidObj[@\"key1\"] = uuid(@\"00000000-0000-0000-0000-000000000000\");\n    optUnmanaged.uuidObj[@\"key1\"] = uuid(@\"00000000-0000-0000-0000-000000000000\");\n    managed.uuidObj[@\"key1\"] = uuid(@\"00000000-0000-0000-0000-000000000000\");\n    optManaged.uuidObj[@\"key1\"] = uuid(@\"00000000-0000-0000-0000-000000000000\");\n    unmanaged.anyBoolObj[@\"key1\"] = @NO;\n    unmanaged.anyIntObj[@\"key1\"] = @2;\n    unmanaged.anyFloatObj[@\"key1\"] = @2.2f;\n    unmanaged.anyDoubleObj[@\"key1\"] = @2.2;\n    unmanaged.anyStringObj[@\"key1\"] = @\"a\";\n    unmanaged.anyDataObj[@\"key1\"] = data(1);\n    unmanaged.anyDateObj[@\"key1\"] = date(1);\n    unmanaged.anyDecimalObj[@\"key1\"] = decimal128(2);\n    unmanaged.anyObjectIdObj[@\"key1\"] = objectId(1);\n    unmanaged.anyUUIDObj[@\"key1\"] = uuid(@\"00000000-0000-0000-0000-000000000000\");\n    managed.anyBoolObj[@\"key1\"] = @NO;\n    managed.anyIntObj[@\"key1\"] = @2;\n    managed.anyFloatObj[@\"key1\"] = @2.2f;\n    managed.anyDoubleObj[@\"key1\"] = @2.2;\n    managed.anyStringObj[@\"key1\"] = @\"a\";\n    managed.anyDataObj[@\"key1\"] = data(1);\n    managed.anyDateObj[@\"key1\"] = date(1);\n    managed.anyDecimalObj[@\"key1\"] = decimal128(2);\n    managed.anyObjectIdObj[@\"key1\"] = objectId(1);\n    managed.anyUUIDObj[@\"key1\"] = uuid(@\"00000000-0000-0000-0000-000000000000\");\n    uncheckedAssertEqualObjects(unmanaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(managed.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(optManaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(unmanaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(managed.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(optManaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(managed.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(optManaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(unmanaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(managed.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(optManaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(unmanaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(managed.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(optManaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(managed.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(managed.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(optManaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(managed.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(managed.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[@\"key1\"], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(managed.anyIntObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(managed.anyStringObj[@\"key1\"], @\"a\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(managed.anyDateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n\n    optUnmanaged.boolObj[@\"key1\"] = (id)NSNull.null;\n    optManaged.boolObj[@\"key1\"] = (id)NSNull.null;\n    optUnmanaged.intObj[@\"key1\"] = (id)NSNull.null;\n    optManaged.intObj[@\"key1\"] = (id)NSNull.null;\n    optUnmanaged.stringObj[@\"key1\"] = (id)NSNull.null;\n    optManaged.stringObj[@\"key1\"] = (id)NSNull.null;\n    optUnmanaged.dateObj[@\"key1\"] = (id)NSNull.null;\n    optManaged.dateObj[@\"key1\"] = (id)NSNull.null;\n    optUnmanaged.floatObj[@\"key1\"] = (id)NSNull.null;\n    optManaged.floatObj[@\"key1\"] = (id)NSNull.null;\n    optUnmanaged.doubleObj[@\"key1\"] = (id)NSNull.null;\n    optManaged.doubleObj[@\"key1\"] = (id)NSNull.null;\n    optUnmanaged.dataObj[@\"key1\"] = (id)NSNull.null;\n    optManaged.dataObj[@\"key1\"] = (id)NSNull.null;\n    optUnmanaged.decimalObj[@\"key1\"] = (id)NSNull.null;\n    optManaged.decimalObj[@\"key1\"] = (id)NSNull.null;\n    optUnmanaged.objectIdObj[@\"key1\"] = (id)NSNull.null;\n    optManaged.objectIdObj[@\"key1\"] = (id)NSNull.null;\n    optUnmanaged.uuidObj[@\"key1\"] = (id)NSNull.null;\n    optManaged.uuidObj[@\"key1\"] = (id)NSNull.null;\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.boolObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.intObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.stringObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dateObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.floatObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dataObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.decimalObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.uuidObj[@\"key1\"], (id)NSNull.null);\n}\n#pragma clang diagnostic pop\n\n- (void)testAddObjects {\n    RLMAssertThrowsWithReason([unmanaged.boolObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([managed.boolObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([managed.intObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([optManaged.intObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj addEntriesFromDictionary:@{@\"key1\": @2}],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj addEntriesFromDictionary:@{@\"key1\": @2}],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([managed.stringObj addEntriesFromDictionary:@{@\"key1\": @2}],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj addEntriesFromDictionary:@{@\"key1\": @2}],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([managed.dateObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([managed.floatObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([optManaged.floatObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([managed.doubleObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([managed.dataObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([managed.decimalObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([managed.uuidObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj addEntriesFromDictionary:@{@\"key1\": @\"a\"}],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([unmanaged.boolObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.boolObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.intObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.stringObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.dateObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.floatObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.doubleObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dataObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.decimalObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([managed.uuidObj addEntriesFromDictionary:@{@\"key1\": (id)NSNull.null}],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n\n    [self addObjects];\n    uncheckedAssertEqualObjects(unmanaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(managed.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(optManaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(unmanaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(managed.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(optManaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(managed.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(optManaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(unmanaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(managed.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(optManaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(unmanaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(managed.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(optManaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(managed.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(managed.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(optManaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(managed.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(managed.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[@\"key1\"], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(managed.anyIntObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(managed.anyStringObj[@\"key1\"], @\"a\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(managed.anyDateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.boolObj[@\"key2\"], @YES);\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.boolObj[@\"key2\"], @YES);\n    uncheckedAssertEqualObjects(optManaged.boolObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.intObj[@\"key2\"], @3);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.intObj[@\"key2\"], @3);\n    uncheckedAssertEqualObjects(optManaged.intObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[@\"key2\"], @\"foo\");\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.stringObj[@\"key2\"], @\"foo\");\n    uncheckedAssertEqualObjects(optManaged.stringObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.dateObj[@\"key2\"], date(2));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.dateObj[@\"key2\"], date(2));\n    uncheckedAssertEqualObjects(optManaged.dateObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.floatObj[@\"key2\"], @3.3f);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.floatObj[@\"key2\"], @3.3f);\n    uncheckedAssertEqualObjects(optManaged.floatObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[@\"key2\"], @3.3);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.doubleObj[@\"key2\"], @3.3);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.dataObj[@\"key2\"], data(2));\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.dataObj[@\"key2\"], data(2));\n    uncheckedAssertEqualObjects(optManaged.dataObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[@\"key2\"], decimal128(3));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.decimalObj[@\"key2\"], decimal128(3));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[@\"key2\"], objectId(2));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.objectIdObj[@\"key2\"], objectId(2));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[@\"key2\"], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.uuidObj[@\"key2\"], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[@\"key2\"], @YES);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[@\"key2\"], @3);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[@\"key2\"], @3.3f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[@\"key2\"], @3.3);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[@\"key2\"], @\"b\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[@\"key2\"], data(2));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[@\"key2\"], date(2));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[@\"key2\"], decimal128(3));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[@\"key2\"], objectId(2));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[@\"key2\"], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[@\"key2\"], @YES);\n    uncheckedAssertEqualObjects(managed.anyIntObj[@\"key2\"], @3);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[@\"key2\"], @3.3f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[@\"key2\"], @3.3);\n    uncheckedAssertEqualObjects(managed.anyStringObj[@\"key2\"], @\"b\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[@\"key2\"], data(2));\n    uncheckedAssertEqualObjects(managed.anyDateObj[@\"key2\"], date(2));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[@\"key2\"], decimal128(3));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[@\"key2\"], objectId(2));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[@\"key2\"], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[@\"key2\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.boolObj[@\"key2\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[@\"key2\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.intObj[@\"key2\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[@\"key2\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.stringObj[@\"key2\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[@\"key2\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dateObj[@\"key2\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[@\"key2\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.floatObj[@\"key2\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[@\"key2\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[@\"key2\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[@\"key2\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dataObj[@\"key2\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[@\"key2\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.decimalObj[@\"key2\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[@\"key2\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[@\"key2\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[@\"key2\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.uuidObj[@\"key2\"], (id)NSNull.null);\n}\n\n- (void)testRemoveObject {\n    [self addObjects];\n    uncheckedAssertEqual(unmanaged.boolObj.count, 2U);\n    uncheckedAssertEqual(managed.boolObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.intObj.count, 2U);\n    uncheckedAssertEqual(managed.intObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.stringObj.count, 2U);\n    uncheckedAssertEqual(managed.stringObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.dateObj.count, 2U);\n    uncheckedAssertEqual(managed.dateObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.floatObj.count, 2U);\n    uncheckedAssertEqual(managed.floatObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.doubleObj.count, 2U);\n    uncheckedAssertEqual(managed.doubleObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.dataObj.count, 2U);\n    uncheckedAssertEqual(managed.dataObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.decimalObj.count, 2U);\n    uncheckedAssertEqual(managed.decimalObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.objectIdObj.count, 2U);\n    uncheckedAssertEqual(managed.objectIdObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.uuidObj.count, 2U);\n    uncheckedAssertEqual(managed.uuidObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyBoolObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyIntObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyFloatObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyDoubleObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyStringObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyDataObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyDateObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyDecimalObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyObjectIdObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyUUIDObj.count, 2U);\n    uncheckedAssertEqual(managed.anyBoolObj.count, 2U);\n    uncheckedAssertEqual(managed.anyIntObj.count, 2U);\n    uncheckedAssertEqual(managed.anyFloatObj.count, 2U);\n    uncheckedAssertEqual(managed.anyDoubleObj.count, 2U);\n    uncheckedAssertEqual(managed.anyStringObj.count, 2U);\n    uncheckedAssertEqual(managed.anyDataObj.count, 2U);\n    uncheckedAssertEqual(managed.anyDateObj.count, 2U);\n    uncheckedAssertEqual(managed.anyDecimalObj.count, 2U);\n    uncheckedAssertEqual(managed.anyObjectIdObj.count, 2U);\n    uncheckedAssertEqual(managed.anyUUIDObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.boolObj.count, 2U);\n    uncheckedAssertEqual(optManaged.boolObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.intObj.count, 2U);\n    uncheckedAssertEqual(optManaged.intObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.stringObj.count, 2U);\n    uncheckedAssertEqual(optManaged.stringObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.dateObj.count, 2U);\n    uncheckedAssertEqual(optManaged.dateObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.floatObj.count, 2U);\n    uncheckedAssertEqual(optManaged.floatObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.doubleObj.count, 2U);\n    uncheckedAssertEqual(optManaged.doubleObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.dataObj.count, 2U);\n    uncheckedAssertEqual(optManaged.dataObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.decimalObj.count, 2U);\n    uncheckedAssertEqual(optManaged.decimalObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.objectIdObj.count, 2U);\n    uncheckedAssertEqual(optManaged.objectIdObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.uuidObj.count, 2U);\n    uncheckedAssertEqual(optManaged.uuidObj.count, 2U);\n\n    uncheckedAssertEqualObjects(unmanaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(managed.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(optManaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(unmanaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(managed.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(optManaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(managed.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(optManaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(unmanaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(managed.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(optManaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(unmanaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(managed.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(optManaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(managed.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(managed.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(optManaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(managed.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(managed.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[@\"key1\"], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(managed.anyIntObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(managed.anyStringObj[@\"key1\"], @\"a\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(managed.anyDateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n\n    [unmanaged.boolObj removeObjectForKey:@\"key1\"];\n    [optUnmanaged.boolObj removeObjectForKey:@\"key1\"];\n    [managed.boolObj removeObjectForKey:@\"key1\"];\n    [optManaged.boolObj removeObjectForKey:@\"key1\"];\n    [unmanaged.intObj removeObjectForKey:@\"key1\"];\n    [optUnmanaged.intObj removeObjectForKey:@\"key1\"];\n    [managed.intObj removeObjectForKey:@\"key1\"];\n    [optManaged.intObj removeObjectForKey:@\"key1\"];\n    [unmanaged.stringObj removeObjectForKey:@\"key1\"];\n    [optUnmanaged.stringObj removeObjectForKey:@\"key1\"];\n    [managed.stringObj removeObjectForKey:@\"key1\"];\n    [optManaged.stringObj removeObjectForKey:@\"key1\"];\n    [unmanaged.dateObj removeObjectForKey:@\"key1\"];\n    [optUnmanaged.dateObj removeObjectForKey:@\"key1\"];\n    [managed.dateObj removeObjectForKey:@\"key1\"];\n    [optManaged.dateObj removeObjectForKey:@\"key1\"];\n    [unmanaged.floatObj removeObjectForKey:@\"key1\"];\n    [optUnmanaged.floatObj removeObjectForKey:@\"key1\"];\n    [managed.floatObj removeObjectForKey:@\"key1\"];\n    [optManaged.floatObj removeObjectForKey:@\"key1\"];\n    [unmanaged.doubleObj removeObjectForKey:@\"key1\"];\n    [optUnmanaged.doubleObj removeObjectForKey:@\"key1\"];\n    [managed.doubleObj removeObjectForKey:@\"key1\"];\n    [optManaged.doubleObj removeObjectForKey:@\"key1\"];\n    [unmanaged.dataObj removeObjectForKey:@\"key1\"];\n    [optUnmanaged.dataObj removeObjectForKey:@\"key1\"];\n    [managed.dataObj removeObjectForKey:@\"key1\"];\n    [optManaged.dataObj removeObjectForKey:@\"key1\"];\n    [unmanaged.decimalObj removeObjectForKey:@\"key1\"];\n    [optUnmanaged.decimalObj removeObjectForKey:@\"key1\"];\n    [managed.decimalObj removeObjectForKey:@\"key1\"];\n    [optManaged.decimalObj removeObjectForKey:@\"key1\"];\n    [unmanaged.objectIdObj removeObjectForKey:@\"key1\"];\n    [optUnmanaged.objectIdObj removeObjectForKey:@\"key1\"];\n    [managed.objectIdObj removeObjectForKey:@\"key1\"];\n    [optManaged.objectIdObj removeObjectForKey:@\"key1\"];\n    [unmanaged.uuidObj removeObjectForKey:@\"key1\"];\n    [optUnmanaged.uuidObj removeObjectForKey:@\"key1\"];\n    [managed.uuidObj removeObjectForKey:@\"key1\"];\n    [optManaged.uuidObj removeObjectForKey:@\"key1\"];\n    [unmanaged.anyBoolObj removeObjectForKey:@\"key1\"];\n    [unmanaged.anyIntObj removeObjectForKey:@\"key1\"];\n    [unmanaged.anyFloatObj removeObjectForKey:@\"key1\"];\n    [unmanaged.anyDoubleObj removeObjectForKey:@\"key1\"];\n    [unmanaged.anyStringObj removeObjectForKey:@\"key1\"];\n    [unmanaged.anyDataObj removeObjectForKey:@\"key1\"];\n    [unmanaged.anyDateObj removeObjectForKey:@\"key1\"];\n    [unmanaged.anyDecimalObj removeObjectForKey:@\"key1\"];\n    [unmanaged.anyObjectIdObj removeObjectForKey:@\"key1\"];\n    [unmanaged.anyUUIDObj removeObjectForKey:@\"key1\"];\n    [managed.anyBoolObj removeObjectForKey:@\"key1\"];\n    [managed.anyIntObj removeObjectForKey:@\"key1\"];\n    [managed.anyFloatObj removeObjectForKey:@\"key1\"];\n    [managed.anyDoubleObj removeObjectForKey:@\"key1\"];\n    [managed.anyStringObj removeObjectForKey:@\"key1\"];\n    [managed.anyDataObj removeObjectForKey:@\"key1\"];\n    [managed.anyDateObj removeObjectForKey:@\"key1\"];\n    [managed.anyDecimalObj removeObjectForKey:@\"key1\"];\n    [managed.anyObjectIdObj removeObjectForKey:@\"key1\"];\n    [managed.anyUUIDObj removeObjectForKey:@\"key1\"];\n\n    uncheckedAssertEqual(unmanaged.boolObj.count, 1U);\n    uncheckedAssertEqual(managed.boolObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.intObj.count, 1U);\n    uncheckedAssertEqual(managed.intObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.stringObj.count, 1U);\n    uncheckedAssertEqual(managed.stringObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.dateObj.count, 1U);\n    uncheckedAssertEqual(managed.dateObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.floatObj.count, 1U);\n    uncheckedAssertEqual(managed.floatObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.doubleObj.count, 1U);\n    uncheckedAssertEqual(managed.doubleObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.dataObj.count, 1U);\n    uncheckedAssertEqual(managed.dataObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.decimalObj.count, 1U);\n    uncheckedAssertEqual(managed.decimalObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.objectIdObj.count, 1U);\n    uncheckedAssertEqual(managed.objectIdObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.uuidObj.count, 1U);\n    uncheckedAssertEqual(managed.uuidObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyBoolObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyIntObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyFloatObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyDoubleObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyStringObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyDataObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyDateObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyDecimalObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyObjectIdObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyUUIDObj.count, 1U);\n    uncheckedAssertEqual(managed.anyBoolObj.count, 1U);\n    uncheckedAssertEqual(managed.anyIntObj.count, 1U);\n    uncheckedAssertEqual(managed.anyFloatObj.count, 1U);\n    uncheckedAssertEqual(managed.anyDoubleObj.count, 1U);\n    uncheckedAssertEqual(managed.anyStringObj.count, 1U);\n    uncheckedAssertEqual(managed.anyDataObj.count, 1U);\n    uncheckedAssertEqual(managed.anyDateObj.count, 1U);\n    uncheckedAssertEqual(managed.anyDecimalObj.count, 1U);\n    uncheckedAssertEqual(managed.anyObjectIdObj.count, 1U);\n    uncheckedAssertEqual(managed.anyUUIDObj.count, 1U);\n    uncheckedAssertEqual(optUnmanaged.boolObj.count, 1U);\n    uncheckedAssertEqual(optManaged.boolObj.count, 1U);\n    uncheckedAssertEqual(optUnmanaged.intObj.count, 1U);\n    uncheckedAssertEqual(optManaged.intObj.count, 1U);\n    uncheckedAssertEqual(optUnmanaged.stringObj.count, 1U);\n    uncheckedAssertEqual(optManaged.stringObj.count, 1U);\n    uncheckedAssertEqual(optUnmanaged.dateObj.count, 1U);\n    uncheckedAssertEqual(optManaged.dateObj.count, 1U);\n    uncheckedAssertEqual(optUnmanaged.floatObj.count, 1U);\n    uncheckedAssertEqual(optManaged.floatObj.count, 1U);\n    uncheckedAssertEqual(optUnmanaged.doubleObj.count, 1U);\n    uncheckedAssertEqual(optManaged.doubleObj.count, 1U);\n    uncheckedAssertEqual(optUnmanaged.dataObj.count, 1U);\n    uncheckedAssertEqual(optManaged.dataObj.count, 1U);\n    uncheckedAssertEqual(optUnmanaged.decimalObj.count, 1U);\n    uncheckedAssertEqual(optManaged.decimalObj.count, 1U);\n    uncheckedAssertEqual(optUnmanaged.objectIdObj.count, 1U);\n    uncheckedAssertEqual(optManaged.objectIdObj.count, 1U);\n    uncheckedAssertEqual(optUnmanaged.uuidObj.count, 1U);\n    uncheckedAssertEqual(optManaged.uuidObj.count, 1U);\n\n    uncheckedAssertNil(unmanaged.boolObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.boolObj[@\"key1\"]);\n    uncheckedAssertNil(managed.boolObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.boolObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.intObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.intObj[@\"key1\"]);\n    uncheckedAssertNil(managed.intObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.intObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.stringObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.stringObj[@\"key1\"]);\n    uncheckedAssertNil(managed.stringObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.stringObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.dateObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.dateObj[@\"key1\"]);\n    uncheckedAssertNil(managed.dateObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.dateObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.floatObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.floatObj[@\"key1\"]);\n    uncheckedAssertNil(managed.floatObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.floatObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.doubleObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.doubleObj[@\"key1\"]);\n    uncheckedAssertNil(managed.doubleObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.doubleObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.dataObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.dataObj[@\"key1\"]);\n    uncheckedAssertNil(managed.dataObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.dataObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.decimalObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.decimalObj[@\"key1\"]);\n    uncheckedAssertNil(managed.decimalObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.decimalObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.objectIdObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.objectIdObj[@\"key1\"]);\n    uncheckedAssertNil(managed.objectIdObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.objectIdObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.uuidObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.uuidObj[@\"key1\"]);\n    uncheckedAssertNil(managed.uuidObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.uuidObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyBoolObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyIntObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyFloatObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyDoubleObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyStringObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyDataObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyDateObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyDecimalObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyObjectIdObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyUUIDObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyBoolObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyIntObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyFloatObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyDoubleObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyStringObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyDataObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyDateObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyDecimalObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyObjectIdObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyUUIDObj[@\"key1\"]);\n}\n\n- (void)testRemoveObjects {\n    [self addObjects];\n    uncheckedAssertEqual(unmanaged.boolObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.boolObj.count, 2U);\n    uncheckedAssertEqual(managed.boolObj.count, 2U);\n    uncheckedAssertEqual(optManaged.boolObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.intObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.intObj.count, 2U);\n    uncheckedAssertEqual(managed.intObj.count, 2U);\n    uncheckedAssertEqual(optManaged.intObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.stringObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.stringObj.count, 2U);\n    uncheckedAssertEqual(managed.stringObj.count, 2U);\n    uncheckedAssertEqual(optManaged.stringObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.dateObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.dateObj.count, 2U);\n    uncheckedAssertEqual(managed.dateObj.count, 2U);\n    uncheckedAssertEqual(optManaged.dateObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.floatObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.floatObj.count, 2U);\n    uncheckedAssertEqual(managed.floatObj.count, 2U);\n    uncheckedAssertEqual(optManaged.floatObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.doubleObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.doubleObj.count, 2U);\n    uncheckedAssertEqual(managed.doubleObj.count, 2U);\n    uncheckedAssertEqual(optManaged.doubleObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.dataObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.dataObj.count, 2U);\n    uncheckedAssertEqual(managed.dataObj.count, 2U);\n    uncheckedAssertEqual(optManaged.dataObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.decimalObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.decimalObj.count, 2U);\n    uncheckedAssertEqual(managed.decimalObj.count, 2U);\n    uncheckedAssertEqual(optManaged.decimalObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.objectIdObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.objectIdObj.count, 2U);\n    uncheckedAssertEqual(managed.objectIdObj.count, 2U);\n    uncheckedAssertEqual(optManaged.objectIdObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.uuidObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.uuidObj.count, 2U);\n    uncheckedAssertEqual(managed.uuidObj.count, 2U);\n    uncheckedAssertEqual(optManaged.uuidObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyBoolObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyIntObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyFloatObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyDoubleObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyStringObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyDataObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyDateObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyDecimalObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyObjectIdObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyUUIDObj.count, 2U);\n    uncheckedAssertEqual(managed.anyBoolObj.count, 2U);\n    uncheckedAssertEqual(managed.anyIntObj.count, 2U);\n    uncheckedAssertEqual(managed.anyFloatObj.count, 2U);\n    uncheckedAssertEqual(managed.anyDoubleObj.count, 2U);\n    uncheckedAssertEqual(managed.anyStringObj.count, 2U);\n    uncheckedAssertEqual(managed.anyDataObj.count, 2U);\n    uncheckedAssertEqual(managed.anyDateObj.count, 2U);\n    uncheckedAssertEqual(managed.anyDecimalObj.count, 2U);\n    uncheckedAssertEqual(managed.anyObjectIdObj.count, 2U);\n    uncheckedAssertEqual(managed.anyUUIDObj.count, 2U);\n\n    uncheckedAssertEqualObjects(unmanaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(managed.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(optManaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(unmanaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(managed.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(optManaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(managed.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(optManaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(unmanaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(managed.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(optManaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(unmanaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(managed.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(optManaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(managed.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(managed.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(optManaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(managed.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(managed.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[@\"key1\"], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(managed.anyIntObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(managed.anyStringObj[@\"key1\"], @\"a\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(managed.anyDateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n\n    [unmanaged.boolObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optUnmanaged.boolObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.boolObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optManaged.boolObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [unmanaged.intObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optUnmanaged.intObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.intObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optManaged.intObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [unmanaged.stringObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optUnmanaged.stringObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.stringObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optManaged.stringObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [unmanaged.dateObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optUnmanaged.dateObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.dateObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optManaged.dateObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [unmanaged.floatObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optUnmanaged.floatObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.floatObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optManaged.floatObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [unmanaged.doubleObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optUnmanaged.doubleObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.doubleObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optManaged.doubleObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [unmanaged.dataObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optUnmanaged.dataObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.dataObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optManaged.dataObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [unmanaged.decimalObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optUnmanaged.decimalObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.decimalObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optManaged.decimalObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [unmanaged.objectIdObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optUnmanaged.objectIdObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.objectIdObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optManaged.objectIdObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [unmanaged.uuidObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optUnmanaged.uuidObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.uuidObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [optManaged.uuidObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [unmanaged.anyBoolObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [unmanaged.anyIntObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [unmanaged.anyFloatObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [unmanaged.anyDoubleObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [unmanaged.anyStringObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [unmanaged.anyDataObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [unmanaged.anyDateObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [unmanaged.anyDecimalObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [unmanaged.anyObjectIdObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [unmanaged.anyUUIDObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.anyBoolObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.anyIntObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.anyFloatObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.anyDoubleObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.anyStringObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.anyDataObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.anyDateObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.anyDecimalObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.anyObjectIdObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n    [managed.anyUUIDObj removeObjectsForKeys:@[@\"key1\", @\"key2\"]];\n\n    uncheckedAssertEqual(unmanaged.boolObj.count, 0U);\n    uncheckedAssertEqual(optUnmanaged.boolObj.count, 0U);\n    uncheckedAssertEqual(managed.boolObj.count, 0U);\n    uncheckedAssertEqual(optManaged.boolObj.count, 0U);\n    uncheckedAssertEqual(unmanaged.intObj.count, 0U);\n    uncheckedAssertEqual(optUnmanaged.intObj.count, 0U);\n    uncheckedAssertEqual(managed.intObj.count, 0U);\n    uncheckedAssertEqual(optManaged.intObj.count, 0U);\n    uncheckedAssertEqual(unmanaged.stringObj.count, 0U);\n    uncheckedAssertEqual(optUnmanaged.stringObj.count, 0U);\n    uncheckedAssertEqual(managed.stringObj.count, 0U);\n    uncheckedAssertEqual(optManaged.stringObj.count, 0U);\n    uncheckedAssertEqual(unmanaged.dateObj.count, 0U);\n    uncheckedAssertEqual(optUnmanaged.dateObj.count, 0U);\n    uncheckedAssertEqual(managed.dateObj.count, 0U);\n    uncheckedAssertEqual(optManaged.dateObj.count, 0U);\n    uncheckedAssertEqual(unmanaged.floatObj.count, 0U);\n    uncheckedAssertEqual(optUnmanaged.floatObj.count, 0U);\n    uncheckedAssertEqual(managed.floatObj.count, 0U);\n    uncheckedAssertEqual(optManaged.floatObj.count, 0U);\n    uncheckedAssertEqual(unmanaged.doubleObj.count, 0U);\n    uncheckedAssertEqual(optUnmanaged.doubleObj.count, 0U);\n    uncheckedAssertEqual(managed.doubleObj.count, 0U);\n    uncheckedAssertEqual(optManaged.doubleObj.count, 0U);\n    uncheckedAssertEqual(unmanaged.dataObj.count, 0U);\n    uncheckedAssertEqual(optUnmanaged.dataObj.count, 0U);\n    uncheckedAssertEqual(managed.dataObj.count, 0U);\n    uncheckedAssertEqual(optManaged.dataObj.count, 0U);\n    uncheckedAssertEqual(unmanaged.decimalObj.count, 0U);\n    uncheckedAssertEqual(optUnmanaged.decimalObj.count, 0U);\n    uncheckedAssertEqual(managed.decimalObj.count, 0U);\n    uncheckedAssertEqual(optManaged.decimalObj.count, 0U);\n    uncheckedAssertEqual(unmanaged.objectIdObj.count, 0U);\n    uncheckedAssertEqual(optUnmanaged.objectIdObj.count, 0U);\n    uncheckedAssertEqual(managed.objectIdObj.count, 0U);\n    uncheckedAssertEqual(optManaged.objectIdObj.count, 0U);\n    uncheckedAssertEqual(unmanaged.uuidObj.count, 0U);\n    uncheckedAssertEqual(optUnmanaged.uuidObj.count, 0U);\n    uncheckedAssertEqual(managed.uuidObj.count, 0U);\n    uncheckedAssertEqual(optManaged.uuidObj.count, 0U);\n    uncheckedAssertEqual(unmanaged.anyBoolObj.count, 0U);\n    uncheckedAssertEqual(unmanaged.anyIntObj.count, 0U);\n    uncheckedAssertEqual(unmanaged.anyFloatObj.count, 0U);\n    uncheckedAssertEqual(unmanaged.anyDoubleObj.count, 0U);\n    uncheckedAssertEqual(unmanaged.anyStringObj.count, 0U);\n    uncheckedAssertEqual(unmanaged.anyDataObj.count, 0U);\n    uncheckedAssertEqual(unmanaged.anyDateObj.count, 0U);\n    uncheckedAssertEqual(unmanaged.anyDecimalObj.count, 0U);\n    uncheckedAssertEqual(unmanaged.anyObjectIdObj.count, 0U);\n    uncheckedAssertEqual(unmanaged.anyUUIDObj.count, 0U);\n    uncheckedAssertEqual(managed.anyBoolObj.count, 0U);\n    uncheckedAssertEqual(managed.anyIntObj.count, 0U);\n    uncheckedAssertEqual(managed.anyFloatObj.count, 0U);\n    uncheckedAssertEqual(managed.anyDoubleObj.count, 0U);\n    uncheckedAssertEqual(managed.anyStringObj.count, 0U);\n    uncheckedAssertEqual(managed.anyDataObj.count, 0U);\n    uncheckedAssertEqual(managed.anyDateObj.count, 0U);\n    uncheckedAssertEqual(managed.anyDecimalObj.count, 0U);\n    uncheckedAssertEqual(managed.anyObjectIdObj.count, 0U);\n    uncheckedAssertEqual(managed.anyUUIDObj.count, 0U);\n    uncheckedAssertNil(unmanaged.boolObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.boolObj[@\"key1\"]);\n    uncheckedAssertNil(managed.boolObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.boolObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.intObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.intObj[@\"key1\"]);\n    uncheckedAssertNil(managed.intObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.intObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.stringObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.stringObj[@\"key1\"]);\n    uncheckedAssertNil(managed.stringObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.stringObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.dateObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.dateObj[@\"key1\"]);\n    uncheckedAssertNil(managed.dateObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.dateObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.floatObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.floatObj[@\"key1\"]);\n    uncheckedAssertNil(managed.floatObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.floatObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.doubleObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.doubleObj[@\"key1\"]);\n    uncheckedAssertNil(managed.doubleObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.doubleObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.dataObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.dataObj[@\"key1\"]);\n    uncheckedAssertNil(managed.dataObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.dataObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.decimalObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.decimalObj[@\"key1\"]);\n    uncheckedAssertNil(managed.decimalObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.decimalObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.objectIdObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.objectIdObj[@\"key1\"]);\n    uncheckedAssertNil(managed.objectIdObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.objectIdObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.uuidObj[@\"key1\"]);\n    uncheckedAssertNil(optUnmanaged.uuidObj[@\"key1\"]);\n    uncheckedAssertNil(managed.uuidObj[@\"key1\"]);\n    uncheckedAssertNil(optManaged.uuidObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyBoolObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyIntObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyFloatObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyDoubleObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyStringObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyDataObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyDateObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyDecimalObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyObjectIdObj[@\"key1\"]);\n    uncheckedAssertNil(unmanaged.anyUUIDObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyBoolObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyIntObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyFloatObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyDoubleObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyStringObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyDataObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyDateObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyDecimalObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyObjectIdObj[@\"key1\"]);\n    uncheckedAssertNil(managed.anyUUIDObj[@\"key1\"]);\n}\n\n- (void)testUpdateObjects {\n    [self addObjects];\n    uncheckedAssertEqual(unmanaged.boolObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.boolObj.count, 2U);\n    uncheckedAssertEqual(managed.boolObj.count, 2U);\n    uncheckedAssertEqual(optManaged.boolObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.intObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.intObj.count, 2U);\n    uncheckedAssertEqual(managed.intObj.count, 2U);\n    uncheckedAssertEqual(optManaged.intObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.stringObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.stringObj.count, 2U);\n    uncheckedAssertEqual(managed.stringObj.count, 2U);\n    uncheckedAssertEqual(optManaged.stringObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.dateObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.dateObj.count, 2U);\n    uncheckedAssertEqual(managed.dateObj.count, 2U);\n    uncheckedAssertEqual(optManaged.dateObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.floatObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.floatObj.count, 2U);\n    uncheckedAssertEqual(managed.floatObj.count, 2U);\n    uncheckedAssertEqual(optManaged.floatObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.doubleObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.doubleObj.count, 2U);\n    uncheckedAssertEqual(managed.doubleObj.count, 2U);\n    uncheckedAssertEqual(optManaged.doubleObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.dataObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.dataObj.count, 2U);\n    uncheckedAssertEqual(managed.dataObj.count, 2U);\n    uncheckedAssertEqual(optManaged.dataObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.decimalObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.decimalObj.count, 2U);\n    uncheckedAssertEqual(managed.decimalObj.count, 2U);\n    uncheckedAssertEqual(optManaged.decimalObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.objectIdObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.objectIdObj.count, 2U);\n    uncheckedAssertEqual(managed.objectIdObj.count, 2U);\n    uncheckedAssertEqual(optManaged.objectIdObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.uuidObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.uuidObj.count, 2U);\n    uncheckedAssertEqual(managed.uuidObj.count, 2U);\n    uncheckedAssertEqual(optManaged.uuidObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyBoolObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyIntObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyFloatObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyDoubleObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyStringObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyDataObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyDateObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyDecimalObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyObjectIdObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyUUIDObj.count, 2U);\n    uncheckedAssertEqual(managed.anyBoolObj.count, 2U);\n    uncheckedAssertEqual(managed.anyIntObj.count, 2U);\n    uncheckedAssertEqual(managed.anyFloatObj.count, 2U);\n    uncheckedAssertEqual(managed.anyDoubleObj.count, 2U);\n    uncheckedAssertEqual(managed.anyStringObj.count, 2U);\n    uncheckedAssertEqual(managed.anyDataObj.count, 2U);\n    uncheckedAssertEqual(managed.anyDateObj.count, 2U);\n    uncheckedAssertEqual(managed.anyDecimalObj.count, 2U);\n    uncheckedAssertEqual(managed.anyObjectIdObj.count, 2U);\n    uncheckedAssertEqual(managed.anyUUIDObj.count, 2U);\n\n    uncheckedAssertEqualObjects(unmanaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(managed.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(optManaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(unmanaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(managed.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(optManaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(managed.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(optManaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(unmanaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(managed.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(optManaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(unmanaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(managed.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(optManaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(managed.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(managed.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(optManaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(managed.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(managed.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[@\"key1\"], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(managed.anyIntObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(managed.anyStringObj[@\"key1\"], @\"a\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(managed.anyDateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.boolObj[@\"key2\"], @YES);\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.boolObj[@\"key2\"], @YES);\n    uncheckedAssertEqualObjects(optManaged.boolObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.intObj[@\"key2\"], @3);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.intObj[@\"key2\"], @3);\n    uncheckedAssertEqualObjects(optManaged.intObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[@\"key2\"], @\"foo\");\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.stringObj[@\"key2\"], @\"foo\");\n    uncheckedAssertEqualObjects(optManaged.stringObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.dateObj[@\"key2\"], date(2));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.dateObj[@\"key2\"], date(2));\n    uncheckedAssertEqualObjects(optManaged.dateObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.floatObj[@\"key2\"], @3.3f);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.floatObj[@\"key2\"], @3.3f);\n    uncheckedAssertEqualObjects(optManaged.floatObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[@\"key2\"], @3.3);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.doubleObj[@\"key2\"], @3.3);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.dataObj[@\"key2\"], data(2));\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.dataObj[@\"key2\"], data(2));\n    uncheckedAssertEqualObjects(optManaged.dataObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[@\"key2\"], decimal128(3));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.decimalObj[@\"key2\"], decimal128(3));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[@\"key2\"], objectId(2));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.objectIdObj[@\"key2\"], objectId(2));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[@\"key2\"], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(managed.uuidObj[@\"key2\"], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[@\"key2\"], NSNull.null);\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[@\"key2\"], @YES);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[@\"key2\"], @3);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[@\"key2\"], @3.3f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[@\"key2\"], @3.3);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[@\"key2\"], @\"b\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[@\"key2\"], data(2));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[@\"key2\"], date(2));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[@\"key2\"], decimal128(3));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[@\"key2\"], objectId(2));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[@\"key2\"], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[@\"key2\"], @YES);\n    uncheckedAssertEqualObjects(managed.anyIntObj[@\"key2\"], @3);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[@\"key2\"], @3.3f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[@\"key2\"], @3.3);\n    uncheckedAssertEqualObjects(managed.anyStringObj[@\"key2\"], @\"b\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[@\"key2\"], data(2));\n    uncheckedAssertEqualObjects(managed.anyDateObj[@\"key2\"], date(2));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[@\"key2\"], decimal128(3));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[@\"key2\"], objectId(2));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[@\"key2\"], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n\n    unmanaged.boolObj[@\"key2\"] = unmanaged.boolObj[@\"key1\"];\n    optUnmanaged.boolObj[@\"key2\"] = optUnmanaged.boolObj[@\"key1\"];\n    managed.boolObj[@\"key2\"] = managed.boolObj[@\"key1\"];\n    optManaged.boolObj[@\"key2\"] = optManaged.boolObj[@\"key1\"];\n    unmanaged.intObj[@\"key2\"] = unmanaged.intObj[@\"key1\"];\n    optUnmanaged.intObj[@\"key2\"] = optUnmanaged.intObj[@\"key1\"];\n    managed.intObj[@\"key2\"] = managed.intObj[@\"key1\"];\n    optManaged.intObj[@\"key2\"] = optManaged.intObj[@\"key1\"];\n    unmanaged.stringObj[@\"key2\"] = unmanaged.stringObj[@\"key1\"];\n    optUnmanaged.stringObj[@\"key2\"] = optUnmanaged.stringObj[@\"key1\"];\n    managed.stringObj[@\"key2\"] = managed.stringObj[@\"key1\"];\n    optManaged.stringObj[@\"key2\"] = optManaged.stringObj[@\"key1\"];\n    unmanaged.dateObj[@\"key2\"] = unmanaged.dateObj[@\"key1\"];\n    optUnmanaged.dateObj[@\"key2\"] = optUnmanaged.dateObj[@\"key1\"];\n    managed.dateObj[@\"key2\"] = managed.dateObj[@\"key1\"];\n    optManaged.dateObj[@\"key2\"] = optManaged.dateObj[@\"key1\"];\n    unmanaged.floatObj[@\"key2\"] = unmanaged.floatObj[@\"key1\"];\n    optUnmanaged.floatObj[@\"key2\"] = optUnmanaged.floatObj[@\"key1\"];\n    managed.floatObj[@\"key2\"] = managed.floatObj[@\"key1\"];\n    optManaged.floatObj[@\"key2\"] = optManaged.floatObj[@\"key1\"];\n    unmanaged.doubleObj[@\"key2\"] = unmanaged.doubleObj[@\"key1\"];\n    optUnmanaged.doubleObj[@\"key2\"] = optUnmanaged.doubleObj[@\"key1\"];\n    managed.doubleObj[@\"key2\"] = managed.doubleObj[@\"key1\"];\n    optManaged.doubleObj[@\"key2\"] = optManaged.doubleObj[@\"key1\"];\n    unmanaged.dataObj[@\"key2\"] = unmanaged.dataObj[@\"key1\"];\n    optUnmanaged.dataObj[@\"key2\"] = optUnmanaged.dataObj[@\"key1\"];\n    managed.dataObj[@\"key2\"] = managed.dataObj[@\"key1\"];\n    optManaged.dataObj[@\"key2\"] = optManaged.dataObj[@\"key1\"];\n    unmanaged.decimalObj[@\"key2\"] = unmanaged.decimalObj[@\"key1\"];\n    optUnmanaged.decimalObj[@\"key2\"] = optUnmanaged.decimalObj[@\"key1\"];\n    managed.decimalObj[@\"key2\"] = managed.decimalObj[@\"key1\"];\n    optManaged.decimalObj[@\"key2\"] = optManaged.decimalObj[@\"key1\"];\n    unmanaged.objectIdObj[@\"key2\"] = unmanaged.objectIdObj[@\"key1\"];\n    optUnmanaged.objectIdObj[@\"key2\"] = optUnmanaged.objectIdObj[@\"key1\"];\n    managed.objectIdObj[@\"key2\"] = managed.objectIdObj[@\"key1\"];\n    optManaged.objectIdObj[@\"key2\"] = optManaged.objectIdObj[@\"key1\"];\n    unmanaged.uuidObj[@\"key2\"] = unmanaged.uuidObj[@\"key1\"];\n    optUnmanaged.uuidObj[@\"key2\"] = optUnmanaged.uuidObj[@\"key1\"];\n    managed.uuidObj[@\"key2\"] = managed.uuidObj[@\"key1\"];\n    optManaged.uuidObj[@\"key2\"] = optManaged.uuidObj[@\"key1\"];\n    unmanaged.anyBoolObj[@\"key2\"] = unmanaged.anyBoolObj[@\"key1\"];\n    unmanaged.anyIntObj[@\"key2\"] = unmanaged.anyIntObj[@\"key1\"];\n    unmanaged.anyFloatObj[@\"key2\"] = unmanaged.anyFloatObj[@\"key1\"];\n    unmanaged.anyDoubleObj[@\"key2\"] = unmanaged.anyDoubleObj[@\"key1\"];\n    unmanaged.anyStringObj[@\"key2\"] = unmanaged.anyStringObj[@\"key1\"];\n    unmanaged.anyDataObj[@\"key2\"] = unmanaged.anyDataObj[@\"key1\"];\n    unmanaged.anyDateObj[@\"key2\"] = unmanaged.anyDateObj[@\"key1\"];\n    unmanaged.anyDecimalObj[@\"key2\"] = unmanaged.anyDecimalObj[@\"key1\"];\n    unmanaged.anyObjectIdObj[@\"key2\"] = unmanaged.anyObjectIdObj[@\"key1\"];\n    unmanaged.anyUUIDObj[@\"key2\"] = unmanaged.anyUUIDObj[@\"key1\"];\n    managed.anyBoolObj[@\"key2\"] = managed.anyBoolObj[@\"key1\"];\n    managed.anyIntObj[@\"key2\"] = managed.anyIntObj[@\"key1\"];\n    managed.anyFloatObj[@\"key2\"] = managed.anyFloatObj[@\"key1\"];\n    managed.anyDoubleObj[@\"key2\"] = managed.anyDoubleObj[@\"key1\"];\n    managed.anyStringObj[@\"key2\"] = managed.anyStringObj[@\"key1\"];\n    managed.anyDataObj[@\"key2\"] = managed.anyDataObj[@\"key1\"];\n    managed.anyDateObj[@\"key2\"] = managed.anyDateObj[@\"key1\"];\n    managed.anyDecimalObj[@\"key2\"] = managed.anyDecimalObj[@\"key1\"];\n    managed.anyObjectIdObj[@\"key2\"] = managed.anyObjectIdObj[@\"key1\"];\n    managed.anyUUIDObj[@\"key2\"] = managed.anyUUIDObj[@\"key1\"];\n    unmanaged.boolObj[@\"key1\"] = unmanaged.boolObj[@\"key2\"];\n    optUnmanaged.boolObj[@\"key1\"] = optUnmanaged.boolObj[@\"key2\"];\n    managed.boolObj[@\"key1\"] = managed.boolObj[@\"key2\"];\n    optManaged.boolObj[@\"key1\"] = optManaged.boolObj[@\"key2\"];\n    unmanaged.intObj[@\"key1\"] = unmanaged.intObj[@\"key2\"];\n    optUnmanaged.intObj[@\"key1\"] = optUnmanaged.intObj[@\"key2\"];\n    managed.intObj[@\"key1\"] = managed.intObj[@\"key2\"];\n    optManaged.intObj[@\"key1\"] = optManaged.intObj[@\"key2\"];\n    unmanaged.stringObj[@\"key1\"] = unmanaged.stringObj[@\"key2\"];\n    optUnmanaged.stringObj[@\"key1\"] = optUnmanaged.stringObj[@\"key2\"];\n    managed.stringObj[@\"key1\"] = managed.stringObj[@\"key2\"];\n    optManaged.stringObj[@\"key1\"] = optManaged.stringObj[@\"key2\"];\n    unmanaged.dateObj[@\"key1\"] = unmanaged.dateObj[@\"key2\"];\n    optUnmanaged.dateObj[@\"key1\"] = optUnmanaged.dateObj[@\"key2\"];\n    managed.dateObj[@\"key1\"] = managed.dateObj[@\"key2\"];\n    optManaged.dateObj[@\"key1\"] = optManaged.dateObj[@\"key2\"];\n    unmanaged.floatObj[@\"key1\"] = unmanaged.floatObj[@\"key2\"];\n    optUnmanaged.floatObj[@\"key1\"] = optUnmanaged.floatObj[@\"key2\"];\n    managed.floatObj[@\"key1\"] = managed.floatObj[@\"key2\"];\n    optManaged.floatObj[@\"key1\"] = optManaged.floatObj[@\"key2\"];\n    unmanaged.doubleObj[@\"key1\"] = unmanaged.doubleObj[@\"key2\"];\n    optUnmanaged.doubleObj[@\"key1\"] = optUnmanaged.doubleObj[@\"key2\"];\n    managed.doubleObj[@\"key1\"] = managed.doubleObj[@\"key2\"];\n    optManaged.doubleObj[@\"key1\"] = optManaged.doubleObj[@\"key2\"];\n    unmanaged.dataObj[@\"key1\"] = unmanaged.dataObj[@\"key2\"];\n    optUnmanaged.dataObj[@\"key1\"] = optUnmanaged.dataObj[@\"key2\"];\n    managed.dataObj[@\"key1\"] = managed.dataObj[@\"key2\"];\n    optManaged.dataObj[@\"key1\"] = optManaged.dataObj[@\"key2\"];\n    unmanaged.decimalObj[@\"key1\"] = unmanaged.decimalObj[@\"key2\"];\n    optUnmanaged.decimalObj[@\"key1\"] = optUnmanaged.decimalObj[@\"key2\"];\n    managed.decimalObj[@\"key1\"] = managed.decimalObj[@\"key2\"];\n    optManaged.decimalObj[@\"key1\"] = optManaged.decimalObj[@\"key2\"];\n    unmanaged.objectIdObj[@\"key1\"] = unmanaged.objectIdObj[@\"key2\"];\n    optUnmanaged.objectIdObj[@\"key1\"] = optUnmanaged.objectIdObj[@\"key2\"];\n    managed.objectIdObj[@\"key1\"] = managed.objectIdObj[@\"key2\"];\n    optManaged.objectIdObj[@\"key1\"] = optManaged.objectIdObj[@\"key2\"];\n    unmanaged.uuidObj[@\"key1\"] = unmanaged.uuidObj[@\"key2\"];\n    optUnmanaged.uuidObj[@\"key1\"] = optUnmanaged.uuidObj[@\"key2\"];\n    managed.uuidObj[@\"key1\"] = managed.uuidObj[@\"key2\"];\n    optManaged.uuidObj[@\"key1\"] = optManaged.uuidObj[@\"key2\"];\n    unmanaged.anyBoolObj[@\"key1\"] = unmanaged.anyBoolObj[@\"key2\"];\n    unmanaged.anyIntObj[@\"key1\"] = unmanaged.anyIntObj[@\"key2\"];\n    unmanaged.anyFloatObj[@\"key1\"] = unmanaged.anyFloatObj[@\"key2\"];\n    unmanaged.anyDoubleObj[@\"key1\"] = unmanaged.anyDoubleObj[@\"key2\"];\n    unmanaged.anyStringObj[@\"key1\"] = unmanaged.anyStringObj[@\"key2\"];\n    unmanaged.anyDataObj[@\"key1\"] = unmanaged.anyDataObj[@\"key2\"];\n    unmanaged.anyDateObj[@\"key1\"] = unmanaged.anyDateObj[@\"key2\"];\n    unmanaged.anyDecimalObj[@\"key1\"] = unmanaged.anyDecimalObj[@\"key2\"];\n    unmanaged.anyObjectIdObj[@\"key1\"] = unmanaged.anyObjectIdObj[@\"key2\"];\n    unmanaged.anyUUIDObj[@\"key1\"] = unmanaged.anyUUIDObj[@\"key2\"];\n    managed.anyBoolObj[@\"key1\"] = managed.anyBoolObj[@\"key2\"];\n    managed.anyIntObj[@\"key1\"] = managed.anyIntObj[@\"key2\"];\n    managed.anyFloatObj[@\"key1\"] = managed.anyFloatObj[@\"key2\"];\n    managed.anyDoubleObj[@\"key1\"] = managed.anyDoubleObj[@\"key2\"];\n    managed.anyStringObj[@\"key1\"] = managed.anyStringObj[@\"key2\"];\n    managed.anyDataObj[@\"key1\"] = managed.anyDataObj[@\"key2\"];\n    managed.anyDateObj[@\"key1\"] = managed.anyDateObj[@\"key2\"];\n    managed.anyDecimalObj[@\"key1\"] = managed.anyDecimalObj[@\"key2\"];\n    managed.anyObjectIdObj[@\"key1\"] = managed.anyObjectIdObj[@\"key2\"];\n    managed.anyUUIDObj[@\"key1\"] = managed.anyUUIDObj[@\"key2\"];\n\n    uncheckedAssertEqualObjects(unmanaged.boolObj[@\"key2\"], @NO);\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[@\"key2\"], @NO);\n    uncheckedAssertEqualObjects(managed.boolObj[@\"key2\"], @NO);\n    uncheckedAssertEqualObjects(optManaged.boolObj[@\"key2\"], @NO);\n    uncheckedAssertEqualObjects(unmanaged.intObj[@\"key2\"], @2);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[@\"key2\"], @2);\n    uncheckedAssertEqualObjects(managed.intObj[@\"key2\"], @2);\n    uncheckedAssertEqualObjects(optManaged.intObj[@\"key2\"], @2);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[@\"key2\"], @\"bar\");\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[@\"key2\"], @\"bar\");\n    uncheckedAssertEqualObjects(managed.stringObj[@\"key2\"], @\"bar\");\n    uncheckedAssertEqualObjects(optManaged.stringObj[@\"key2\"], @\"bar\");\n    uncheckedAssertEqualObjects(unmanaged.dateObj[@\"key2\"], date(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[@\"key2\"], date(1));\n    uncheckedAssertEqualObjects(managed.dateObj[@\"key2\"], date(1));\n    uncheckedAssertEqualObjects(optManaged.dateObj[@\"key2\"], date(1));\n    uncheckedAssertEqualObjects(unmanaged.floatObj[@\"key2\"], @2.2f);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[@\"key2\"], @2.2f);\n    uncheckedAssertEqualObjects(managed.floatObj[@\"key2\"], @2.2f);\n    uncheckedAssertEqualObjects(optManaged.floatObj[@\"key2\"], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[@\"key2\"], @2.2);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[@\"key2\"], @2.2);\n    uncheckedAssertEqualObjects(managed.doubleObj[@\"key2\"], @2.2);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[@\"key2\"], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.dataObj[@\"key2\"], data(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[@\"key2\"], data(1));\n    uncheckedAssertEqualObjects(managed.dataObj[@\"key2\"], data(1));\n    uncheckedAssertEqualObjects(optManaged.dataObj[@\"key2\"], data(1));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[@\"key2\"], decimal128(2));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[@\"key2\"], decimal128(2));\n    uncheckedAssertEqualObjects(managed.decimalObj[@\"key2\"], decimal128(2));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[@\"key2\"], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[@\"key2\"], objectId(1));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[@\"key2\"], objectId(1));\n    uncheckedAssertEqualObjects(managed.objectIdObj[@\"key2\"], objectId(1));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[@\"key2\"], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[@\"key2\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[@\"key2\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.uuidObj[@\"key2\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[@\"key2\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[@\"key2\"], @NO);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[@\"key2\"], @2);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[@\"key2\"], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[@\"key2\"], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[@\"key2\"], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[@\"key2\"], data(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[@\"key2\"], date(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[@\"key2\"], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[@\"key2\"], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[@\"key2\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[@\"key2\"], @NO);\n    uncheckedAssertEqualObjects(managed.anyIntObj[@\"key2\"], @2);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[@\"key2\"], @2.2f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[@\"key2\"], @2.2);\n    uncheckedAssertEqualObjects(managed.anyStringObj[@\"key2\"], @\"a\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[@\"key2\"], data(1));\n    uncheckedAssertEqualObjects(managed.anyDateObj[@\"key2\"], date(1));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[@\"key2\"], decimal128(2));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[@\"key2\"], objectId(1));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[@\"key2\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n}\n\n- (void)testIndexOfObjectSorted {\n    [unmanaged.boolObj addEntriesFromDictionary:@{ @\"key1\": @NO, @\"key2\": @YES }];\n    [optUnmanaged.boolObj addEntriesFromDictionary:@{ @\"key1\": @NO, @\"key2\": NSNull.null }];\n    [managed.boolObj addEntriesFromDictionary:@{ @\"key1\": @NO, @\"key2\": @YES }];\n    [optManaged.boolObj addEntriesFromDictionary:@{ @\"key1\": @NO, @\"key2\": NSNull.null }];\n    [unmanaged.intObj addEntriesFromDictionary:@{ @\"key1\": @2, @\"key2\": @3 }];\n    [optUnmanaged.intObj addEntriesFromDictionary:@{ @\"key1\": @2, @\"key2\": NSNull.null }];\n    [managed.intObj addEntriesFromDictionary:@{ @\"key1\": @2, @\"key2\": @3 }];\n    [optManaged.intObj addEntriesFromDictionary:@{ @\"key1\": @2, @\"key2\": NSNull.null }];\n    [unmanaged.stringObj addEntriesFromDictionary:@{ @\"key1\": @\"bar\", @\"key2\": @\"foo\" }];\n    [optUnmanaged.stringObj addEntriesFromDictionary:@{ @\"key1\": @\"bar\", @\"key2\": NSNull.null }];\n    [managed.stringObj addEntriesFromDictionary:@{ @\"key1\": @\"bar\", @\"key2\": @\"foo\" }];\n    [optManaged.stringObj addEntriesFromDictionary:@{ @\"key1\": @\"bar\", @\"key2\": NSNull.null }];\n    [unmanaged.dateObj addEntriesFromDictionary:@{ @\"key1\": date(1), @\"key2\": date(2) }];\n    [optUnmanaged.dateObj addEntriesFromDictionary:@{ @\"key1\": date(1), @\"key2\": NSNull.null }];\n    [managed.dateObj addEntriesFromDictionary:@{ @\"key1\": date(1), @\"key2\": date(2) }];\n    [optManaged.dateObj addEntriesFromDictionary:@{ @\"key1\": date(1), @\"key2\": NSNull.null }];\n    [unmanaged.floatObj addEntriesFromDictionary:@{ @\"key1\": @2.2f, @\"key2\": @3.3f }];\n    [optUnmanaged.floatObj addEntriesFromDictionary:@{ @\"key1\": @2.2f, @\"key2\": NSNull.null }];\n    [managed.floatObj addEntriesFromDictionary:@{ @\"key1\": @2.2f, @\"key2\": @3.3f }];\n    [optManaged.floatObj addEntriesFromDictionary:@{ @\"key1\": @2.2f, @\"key2\": NSNull.null }];\n    [unmanaged.doubleObj addEntriesFromDictionary:@{ @\"key1\": @2.2, @\"key2\": @3.3 }];\n    [optUnmanaged.doubleObj addEntriesFromDictionary:@{ @\"key1\": @2.2, @\"key2\": NSNull.null }];\n    [managed.doubleObj addEntriesFromDictionary:@{ @\"key1\": @2.2, @\"key2\": @3.3 }];\n    [optManaged.doubleObj addEntriesFromDictionary:@{ @\"key1\": @2.2, @\"key2\": NSNull.null }];\n    [unmanaged.dataObj addEntriesFromDictionary:@{ @\"key1\": data(1), @\"key2\": data(2) }];\n    [optUnmanaged.dataObj addEntriesFromDictionary:@{ @\"key1\": data(1), @\"key2\": NSNull.null }];\n    [managed.dataObj addEntriesFromDictionary:@{ @\"key1\": data(1), @\"key2\": data(2) }];\n    [optManaged.dataObj addEntriesFromDictionary:@{ @\"key1\": data(1), @\"key2\": NSNull.null }];\n    [unmanaged.decimalObj addEntriesFromDictionary:@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }];\n    [optUnmanaged.decimalObj addEntriesFromDictionary:@{ @\"key1\": decimal128(2), @\"key2\": NSNull.null }];\n    [managed.decimalObj addEntriesFromDictionary:@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }];\n    [optManaged.decimalObj addEntriesFromDictionary:@{ @\"key1\": decimal128(2), @\"key2\": NSNull.null }];\n    [unmanaged.objectIdObj addEntriesFromDictionary:@{ @\"key1\": objectId(1), @\"key2\": objectId(2) }];\n    [optUnmanaged.objectIdObj addEntriesFromDictionary:@{ @\"key1\": objectId(1), @\"key2\": NSNull.null }];\n    [managed.objectIdObj addEntriesFromDictionary:@{ @\"key1\": objectId(1), @\"key2\": objectId(2) }];\n    [optManaged.objectIdObj addEntriesFromDictionary:@{ @\"key1\": objectId(1), @\"key2\": NSNull.null }];\n    [unmanaged.uuidObj addEntriesFromDictionary:@{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") }];\n    [optUnmanaged.uuidObj addEntriesFromDictionary:@{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": NSNull.null }];\n    [managed.uuidObj addEntriesFromDictionary:@{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") }];\n    [optManaged.uuidObj addEntriesFromDictionary:@{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": NSNull.null }];\n    [unmanaged.anyBoolObj addEntriesFromDictionary:@{ @\"key1\": @NO, @\"key2\": @YES }];\n    [unmanaged.anyIntObj addEntriesFromDictionary:@{ @\"key1\": @2, @\"key2\": @3 }];\n    [unmanaged.anyFloatObj addEntriesFromDictionary:@{ @\"key1\": @2.2f, @\"key2\": @3.3f }];\n    [unmanaged.anyDoubleObj addEntriesFromDictionary:@{ @\"key1\": @2.2, @\"key2\": @3.3 }];\n    [unmanaged.anyStringObj addEntriesFromDictionary:@{ @\"key1\": @\"a\", @\"key2\": @\"b\" }];\n    [unmanaged.anyDataObj addEntriesFromDictionary:@{ @\"key1\": data(1), @\"key2\": data(2) }];\n    [unmanaged.anyDateObj addEntriesFromDictionary:@{ @\"key1\": date(1), @\"key2\": date(2) }];\n    [unmanaged.anyDecimalObj addEntriesFromDictionary:@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }];\n    [unmanaged.anyObjectIdObj addEntriesFromDictionary:@{ @\"key1\": objectId(1), @\"key2\": objectId(2) }];\n    [unmanaged.anyUUIDObj addEntriesFromDictionary:@{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") }];\n    [managed.anyBoolObj addEntriesFromDictionary:@{ @\"key1\": @NO, @\"key2\": @YES }];\n    [managed.anyIntObj addEntriesFromDictionary:@{ @\"key1\": @2, @\"key2\": @3 }];\n    [managed.anyFloatObj addEntriesFromDictionary:@{ @\"key1\": @2.2f, @\"key2\": @3.3f }];\n    [managed.anyDoubleObj addEntriesFromDictionary:@{ @\"key1\": @2.2, @\"key2\": @3.3 }];\n    [managed.anyStringObj addEntriesFromDictionary:@{ @\"key1\": @\"a\", @\"key2\": @\"b\" }];\n    [managed.anyDataObj addEntriesFromDictionary:@{ @\"key1\": data(1), @\"key2\": data(2) }];\n    [managed.anyDateObj addEntriesFromDictionary:@{ @\"key1\": date(1), @\"key2\": date(2) }];\n    [managed.anyDecimalObj addEntriesFromDictionary:@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }];\n    [managed.anyObjectIdObj addEntriesFromDictionary:@{ @\"key1\": objectId(1), @\"key2\": objectId(2) }];\n    [managed.anyUUIDObj addEntriesFromDictionary:@{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") }];\n\n    uncheckedAssertEqual(0U, [[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@NO]);\n    uncheckedAssertEqual(0U, [[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2]);\n    uncheckedAssertEqual(0U, [[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@\"bar\"]);\n    uncheckedAssertEqual(0U, [[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:date(1)]);\n    uncheckedAssertEqual(1U, [[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:(id)NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:(id)NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:(id)NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:(id)NSNull.null]);\n    uncheckedAssertEqual(1U, [[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@NO]);\n    uncheckedAssertEqual(1U, [[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2]);\n    uncheckedAssertEqual(1U, [[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@\"bar\"]);\n    uncheckedAssertEqual(1U, [[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:date(1)]);\n    uncheckedAssertEqual(1U, [[managed.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@NO]);\n    uncheckedAssertEqual(1U, [[managed.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2]);\n    uncheckedAssertEqual(1U, [[managed.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2.2f]);\n    uncheckedAssertEqual(1U, [[managed.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2.2]);\n    uncheckedAssertEqual(1U, [[managed.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@\"a\"]);\n    uncheckedAssertEqual(1U, [[managed.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:data(1)]);\n    uncheckedAssertEqual(1U, [[managed.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:date(1)]);\n    uncheckedAssertEqual(1U, [[managed.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:decimal128(2)]);\n    uncheckedAssertEqual(1U, [[managed.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertEqual(0U, [[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@YES]);\n    uncheckedAssertEqual(0U, [[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3]);\n    uncheckedAssertEqual(0U, [[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@\"foo\"]);\n    uncheckedAssertEqual(0U, [[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:date(2)]);\n    uncheckedAssertEqual(0U, [[managed.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@YES]);\n    uncheckedAssertEqual(0U, [[managed.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3]);\n    uncheckedAssertEqual(0U, [[managed.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3.3f]);\n    uncheckedAssertEqual(0U, [[managed.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3.3]);\n    uncheckedAssertEqual(0U, [[managed.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@\"b\"]);\n    uncheckedAssertEqual(0U, [[managed.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:data(2)]);\n    uncheckedAssertEqual(0U, [[managed.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:date(2)]);\n    uncheckedAssertEqual(0U, [[managed.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:decimal128(3)]);\n    uncheckedAssertEqual(0U, [[managed.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n\n    uncheckedAssertEqual(1U, [[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:(id)NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:(id)NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:(id)NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:(id)NSNull.null]);\n}\n\n- (void)testIndexOfObjectDistinct {\n    [unmanaged.boolObj addEntriesFromDictionary:@{ @\"key1\": @NO, @\"key2\": @YES }];\n    [optUnmanaged.boolObj addEntriesFromDictionary:@{ @\"key1\": @NO, @\"key2\": NSNull.null }];\n    [managed.boolObj addEntriesFromDictionary:@{ @\"key1\": @NO, @\"key2\": @YES }];\n    [optManaged.boolObj addEntriesFromDictionary:@{ @\"key1\": @NO, @\"key2\": NSNull.null }];\n    [unmanaged.intObj addEntriesFromDictionary:@{ @\"key1\": @2, @\"key2\": @3 }];\n    [optUnmanaged.intObj addEntriesFromDictionary:@{ @\"key1\": @2, @\"key2\": NSNull.null }];\n    [managed.intObj addEntriesFromDictionary:@{ @\"key1\": @2, @\"key2\": @3 }];\n    [optManaged.intObj addEntriesFromDictionary:@{ @\"key1\": @2, @\"key2\": NSNull.null }];\n    [unmanaged.stringObj addEntriesFromDictionary:@{ @\"key1\": @\"bar\", @\"key2\": @\"foo\" }];\n    [optUnmanaged.stringObj addEntriesFromDictionary:@{ @\"key1\": @\"bar\", @\"key2\": NSNull.null }];\n    [managed.stringObj addEntriesFromDictionary:@{ @\"key1\": @\"bar\", @\"key2\": @\"foo\" }];\n    [optManaged.stringObj addEntriesFromDictionary:@{ @\"key1\": @\"bar\", @\"key2\": NSNull.null }];\n    [unmanaged.dateObj addEntriesFromDictionary:@{ @\"key1\": date(1), @\"key2\": date(2) }];\n    [optUnmanaged.dateObj addEntriesFromDictionary:@{ @\"key1\": date(1), @\"key2\": NSNull.null }];\n    [managed.dateObj addEntriesFromDictionary:@{ @\"key1\": date(1), @\"key2\": date(2) }];\n    [optManaged.dateObj addEntriesFromDictionary:@{ @\"key1\": date(1), @\"key2\": NSNull.null }];\n    [unmanaged.floatObj addEntriesFromDictionary:@{ @\"key1\": @2.2f, @\"key2\": @3.3f }];\n    [optUnmanaged.floatObj addEntriesFromDictionary:@{ @\"key1\": @2.2f, @\"key2\": NSNull.null }];\n    [managed.floatObj addEntriesFromDictionary:@{ @\"key1\": @2.2f, @\"key2\": @3.3f }];\n    [optManaged.floatObj addEntriesFromDictionary:@{ @\"key1\": @2.2f, @\"key2\": NSNull.null }];\n    [unmanaged.doubleObj addEntriesFromDictionary:@{ @\"key1\": @2.2, @\"key2\": @3.3 }];\n    [optUnmanaged.doubleObj addEntriesFromDictionary:@{ @\"key1\": @2.2, @\"key2\": NSNull.null }];\n    [managed.doubleObj addEntriesFromDictionary:@{ @\"key1\": @2.2, @\"key2\": @3.3 }];\n    [optManaged.doubleObj addEntriesFromDictionary:@{ @\"key1\": @2.2, @\"key2\": NSNull.null }];\n    [unmanaged.dataObj addEntriesFromDictionary:@{ @\"key1\": data(1), @\"key2\": data(2) }];\n    [optUnmanaged.dataObj addEntriesFromDictionary:@{ @\"key1\": data(1), @\"key2\": NSNull.null }];\n    [managed.dataObj addEntriesFromDictionary:@{ @\"key1\": data(1), @\"key2\": data(2) }];\n    [optManaged.dataObj addEntriesFromDictionary:@{ @\"key1\": data(1), @\"key2\": NSNull.null }];\n    [unmanaged.decimalObj addEntriesFromDictionary:@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }];\n    [optUnmanaged.decimalObj addEntriesFromDictionary:@{ @\"key1\": decimal128(2), @\"key2\": NSNull.null }];\n    [managed.decimalObj addEntriesFromDictionary:@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }];\n    [optManaged.decimalObj addEntriesFromDictionary:@{ @\"key1\": decimal128(2), @\"key2\": NSNull.null }];\n    [unmanaged.objectIdObj addEntriesFromDictionary:@{ @\"key1\": objectId(1), @\"key2\": objectId(2) }];\n    [optUnmanaged.objectIdObj addEntriesFromDictionary:@{ @\"key1\": objectId(1), @\"key2\": NSNull.null }];\n    [managed.objectIdObj addEntriesFromDictionary:@{ @\"key1\": objectId(1), @\"key2\": objectId(2) }];\n    [optManaged.objectIdObj addEntriesFromDictionary:@{ @\"key1\": objectId(1), @\"key2\": NSNull.null }];\n    [unmanaged.uuidObj addEntriesFromDictionary:@{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") }];\n    [optUnmanaged.uuidObj addEntriesFromDictionary:@{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": NSNull.null }];\n    [managed.uuidObj addEntriesFromDictionary:@{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") }];\n    [optManaged.uuidObj addEntriesFromDictionary:@{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": NSNull.null }];\n    [unmanaged.anyBoolObj addEntriesFromDictionary:@{ @\"key1\": @NO, @\"key2\": @YES }];\n    [unmanaged.anyIntObj addEntriesFromDictionary:@{ @\"key1\": @2, @\"key2\": @3 }];\n    [unmanaged.anyFloatObj addEntriesFromDictionary:@{ @\"key1\": @2.2f, @\"key2\": @3.3f }];\n    [unmanaged.anyDoubleObj addEntriesFromDictionary:@{ @\"key1\": @2.2, @\"key2\": @3.3 }];\n    [unmanaged.anyStringObj addEntriesFromDictionary:@{ @\"key1\": @\"a\", @\"key2\": @\"b\" }];\n    [unmanaged.anyDataObj addEntriesFromDictionary:@{ @\"key1\": data(1), @\"key2\": data(2) }];\n    [unmanaged.anyDateObj addEntriesFromDictionary:@{ @\"key1\": date(1), @\"key2\": date(2) }];\n    [unmanaged.anyDecimalObj addEntriesFromDictionary:@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }];\n    [unmanaged.anyObjectIdObj addEntriesFromDictionary:@{ @\"key1\": objectId(1), @\"key2\": objectId(2) }];\n    [unmanaged.anyUUIDObj addEntriesFromDictionary:@{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") }];\n    [managed.anyBoolObj addEntriesFromDictionary:@{ @\"key1\": @NO, @\"key2\": @YES }];\n    [managed.anyIntObj addEntriesFromDictionary:@{ @\"key1\": @2, @\"key2\": @3 }];\n    [managed.anyFloatObj addEntriesFromDictionary:@{ @\"key1\": @2.2f, @\"key2\": @3.3f }];\n    [managed.anyDoubleObj addEntriesFromDictionary:@{ @\"key1\": @2.2, @\"key2\": @3.3 }];\n    [managed.anyStringObj addEntriesFromDictionary:@{ @\"key1\": @\"a\", @\"key2\": @\"b\" }];\n    [managed.anyDataObj addEntriesFromDictionary:@{ @\"key1\": data(1), @\"key2\": data(2) }];\n    [managed.anyDateObj addEntriesFromDictionary:@{ @\"key1\": date(1), @\"key2\": date(2) }];\n    [managed.anyDecimalObj addEntriesFromDictionary:@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }];\n    [managed.anyObjectIdObj addEntriesFromDictionary:@{ @\"key1\": objectId(1), @\"key2\": objectId(2) }];\n    [managed.anyUUIDObj addEntriesFromDictionary:@{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") }];\n\n    uncheckedAssertEqual(0U, [[managed.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@NO]);\n    uncheckedAssertEqual(0U, [[managed.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2]);\n    uncheckedAssertEqual(0U, [[managed.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@\"bar\"]);\n    uncheckedAssertEqual(0U, [[managed.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:date(1)]);\n    uncheckedAssertEqual(0U, [[managed.anyBoolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@NO]);\n    uncheckedAssertEqual(0U, [[managed.anyIntObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2]);\n    uncheckedAssertEqual(0U, [[managed.anyFloatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2.2f]);\n    uncheckedAssertEqual(0U, [[managed.anyDoubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2.2]);\n    uncheckedAssertEqual(0U, [[managed.anyStringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@\"a\"]);\n    uncheckedAssertEqual(0U, [[managed.anyDataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:data(1)]);\n    uncheckedAssertEqual(0U, [[managed.anyDateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:date(1)]);\n    uncheckedAssertEqual(0U, [[managed.anyDecimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:decimal128(2)]);\n    uncheckedAssertEqual(0U, [[managed.anyUUIDObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertEqual(1U, [[managed.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@YES]);\n    uncheckedAssertEqual(1U, [[managed.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3]);\n    uncheckedAssertEqual(1U, [[managed.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@\"foo\"]);\n    uncheckedAssertEqual(1U, [[managed.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:date(2)]);\n    uncheckedAssertEqual(1U, [[managed.anyBoolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@YES]);\n    uncheckedAssertEqual(1U, [[managed.anyIntObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3]);\n    uncheckedAssertEqual(1U, [[managed.anyFloatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3.3f]);\n    uncheckedAssertEqual(1U, [[managed.anyDoubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3.3]);\n    uncheckedAssertEqual(1U, [[managed.anyStringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@\"b\"]);\n    uncheckedAssertEqual(1U, [[managed.anyDataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:data(2)]);\n    uncheckedAssertEqual(1U, [[managed.anyDateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:date(2)]);\n    uncheckedAssertEqual(1U, [[managed.anyDecimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:decimal128(3)]);\n    uncheckedAssertEqual(1U, [[managed.anyUUIDObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n\n    uncheckedAssertEqual(0U, [[optManaged.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@NO]);\n    uncheckedAssertEqual(0U, [[optManaged.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2]);\n    uncheckedAssertEqual(0U, [[optManaged.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@\"bar\"]);\n    uncheckedAssertEqual(0U, [[optManaged.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:date(1)]);\n    uncheckedAssertEqual(1U, [[optManaged.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:(id)NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:(id)NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:(id)NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:(id)NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:(id)NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:(id)NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:(id)NSNull.null]);\n    uncheckedAssertEqual(1U, [[optManaged.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:(id)NSNull.null]);\n}\n\n- (void)testSort {\n    RLMAssertThrowsWithReason([unmanaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyObjectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:NO],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.boolObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.intObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyBoolObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyIntObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyFloatObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDoubleObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyStringObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDataObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDateObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDecimalObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyObjectIdObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyUUIDObj sortedResultsUsingDescriptors:@[]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([managed.boolObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.intObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.intObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.stringObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.dateObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyBoolObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyIntObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyFloatObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyDoubleObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyStringObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyDataObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyDateObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyDecimalObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyUUIDObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO],\n                              @\"can only be sorted on 'self'\");\n\n    [unmanaged.boolObj addEntriesFromDictionary:@{@\"key1\": @NO, @\"key2\": @YES}];\n    [optUnmanaged.boolObj addEntriesFromDictionary:@{@\"key1\": @NO, @\"key2\": NSNull.null}];\n    [managed.boolObj addEntriesFromDictionary:@{@\"key1\": @NO, @\"key2\": @YES}];\n    [optManaged.boolObj addEntriesFromDictionary:@{@\"key1\": @NO, @\"key2\": NSNull.null}];\n    [unmanaged.intObj addEntriesFromDictionary:@{@\"key1\": @2, @\"key2\": @3}];\n    [optUnmanaged.intObj addEntriesFromDictionary:@{@\"key1\": @2, @\"key2\": NSNull.null}];\n    [managed.intObj addEntriesFromDictionary:@{@\"key1\": @2, @\"key2\": @3}];\n    [optManaged.intObj addEntriesFromDictionary:@{@\"key1\": @2, @\"key2\": NSNull.null}];\n    [unmanaged.stringObj addEntriesFromDictionary:@{@\"key1\": @\"bar\", @\"key2\": @\"foo\"}];\n    [optUnmanaged.stringObj addEntriesFromDictionary:@{@\"key1\": @\"bar\", @\"key2\": NSNull.null}];\n    [managed.stringObj addEntriesFromDictionary:@{@\"key1\": @\"bar\", @\"key2\": @\"foo\"}];\n    [optManaged.stringObj addEntriesFromDictionary:@{@\"key1\": @\"bar\", @\"key2\": NSNull.null}];\n    [unmanaged.dateObj addEntriesFromDictionary:@{@\"key1\": date(1), @\"key2\": date(2)}];\n    [optUnmanaged.dateObj addEntriesFromDictionary:@{@\"key1\": date(1), @\"key2\": NSNull.null}];\n    [managed.dateObj addEntriesFromDictionary:@{@\"key1\": date(1), @\"key2\": date(2)}];\n    [optManaged.dateObj addEntriesFromDictionary:@{@\"key1\": date(1), @\"key2\": NSNull.null}];\n    [unmanaged.floatObj addEntriesFromDictionary:@{@\"key1\": @2.2f, @\"key2\": @3.3f}];\n    [optUnmanaged.floatObj addEntriesFromDictionary:@{@\"key1\": @2.2f, @\"key2\": NSNull.null}];\n    [managed.floatObj addEntriesFromDictionary:@{@\"key1\": @2.2f, @\"key2\": @3.3f}];\n    [optManaged.floatObj addEntriesFromDictionary:@{@\"key1\": @2.2f, @\"key2\": NSNull.null}];\n    [unmanaged.doubleObj addEntriesFromDictionary:@{@\"key1\": @2.2, @\"key2\": @3.3}];\n    [optUnmanaged.doubleObj addEntriesFromDictionary:@{@\"key1\": @2.2, @\"key2\": NSNull.null}];\n    [managed.doubleObj addEntriesFromDictionary:@{@\"key1\": @2.2, @\"key2\": @3.3}];\n    [optManaged.doubleObj addEntriesFromDictionary:@{@\"key1\": @2.2, @\"key2\": NSNull.null}];\n    [unmanaged.dataObj addEntriesFromDictionary:@{@\"key1\": data(1), @\"key2\": data(2)}];\n    [optUnmanaged.dataObj addEntriesFromDictionary:@{@\"key1\": data(1), @\"key2\": NSNull.null}];\n    [managed.dataObj addEntriesFromDictionary:@{@\"key1\": data(1), @\"key2\": data(2)}];\n    [optManaged.dataObj addEntriesFromDictionary:@{@\"key1\": data(1), @\"key2\": NSNull.null}];\n    [unmanaged.decimalObj addEntriesFromDictionary:@{@\"key1\": decimal128(2), @\"key2\": decimal128(3)}];\n    [optUnmanaged.decimalObj addEntriesFromDictionary:@{@\"key1\": decimal128(2), @\"key2\": NSNull.null}];\n    [managed.decimalObj addEntriesFromDictionary:@{@\"key1\": decimal128(2), @\"key2\": decimal128(3)}];\n    [optManaged.decimalObj addEntriesFromDictionary:@{@\"key1\": decimal128(2), @\"key2\": NSNull.null}];\n    [unmanaged.objectIdObj addEntriesFromDictionary:@{@\"key1\": objectId(1), @\"key2\": objectId(2)}];\n    [optUnmanaged.objectIdObj addEntriesFromDictionary:@{@\"key1\": objectId(1), @\"key2\": NSNull.null}];\n    [managed.objectIdObj addEntriesFromDictionary:@{@\"key1\": objectId(1), @\"key2\": objectId(2)}];\n    [optManaged.objectIdObj addEntriesFromDictionary:@{@\"key1\": objectId(1), @\"key2\": NSNull.null}];\n    [unmanaged.uuidObj addEntriesFromDictionary:@{@\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")}];\n    [optUnmanaged.uuidObj addEntriesFromDictionary:@{@\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": NSNull.null}];\n    [managed.uuidObj addEntriesFromDictionary:@{@\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")}];\n    [optManaged.uuidObj addEntriesFromDictionary:@{@\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": NSNull.null}];\n    [unmanaged.anyBoolObj addEntriesFromDictionary:@{@\"key1\": @NO, @\"key2\": @YES}];\n    [unmanaged.anyIntObj addEntriesFromDictionary:@{@\"key1\": @2, @\"key2\": @3}];\n    [unmanaged.anyFloatObj addEntriesFromDictionary:@{@\"key1\": @2.2f, @\"key2\": @3.3f}];\n    [unmanaged.anyDoubleObj addEntriesFromDictionary:@{@\"key1\": @2.2, @\"key2\": @3.3}];\n    [unmanaged.anyStringObj addEntriesFromDictionary:@{@\"key1\": @\"a\", @\"key2\": @\"b\"}];\n    [unmanaged.anyDataObj addEntriesFromDictionary:@{@\"key1\": data(1), @\"key2\": data(2)}];\n    [unmanaged.anyDateObj addEntriesFromDictionary:@{@\"key1\": date(1), @\"key2\": date(2)}];\n    [unmanaged.anyDecimalObj addEntriesFromDictionary:@{@\"key1\": decimal128(2), @\"key2\": decimal128(3)}];\n    [unmanaged.anyObjectIdObj addEntriesFromDictionary:@{@\"key1\": objectId(1), @\"key2\": objectId(2)}];\n    [unmanaged.anyUUIDObj addEntriesFromDictionary:@{@\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")}];\n    [managed.anyBoolObj addEntriesFromDictionary:@{@\"key1\": @NO, @\"key2\": @YES}];\n    [managed.anyIntObj addEntriesFromDictionary:@{@\"key1\": @2, @\"key2\": @3}];\n    [managed.anyFloatObj addEntriesFromDictionary:@{@\"key1\": @2.2f, @\"key2\": @3.3f}];\n    [managed.anyDoubleObj addEntriesFromDictionary:@{@\"key1\": @2.2, @\"key2\": @3.3}];\n    [managed.anyStringObj addEntriesFromDictionary:@{@\"key1\": @\"a\", @\"key2\": @\"b\"}];\n    [managed.anyDataObj addEntriesFromDictionary:@{@\"key1\": data(1), @\"key2\": data(2)}];\n    [managed.anyDateObj addEntriesFromDictionary:@{@\"key1\": date(1), @\"key2\": date(2)}];\n    [managed.anyDecimalObj addEntriesFromDictionary:@{@\"key1\": decimal128(2), @\"key2\": decimal128(3)}];\n    [managed.anyObjectIdObj addEntriesFromDictionary:@{@\"key1\": objectId(1), @\"key2\": objectId(2)}];\n    [managed.anyUUIDObj addEntriesFromDictionary:@{@\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")}];\n\n    uncheckedAssertEqualObjects([[managed.boolObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@NO, @YES]));\n    uncheckedAssertEqualObjects([[optManaged.boolObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@NO, NSNull.null]));\n    uncheckedAssertEqualObjects([[managed.intObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@2, @3]));\n    uncheckedAssertEqualObjects([[optManaged.intObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@2, NSNull.null]));\n    uncheckedAssertEqualObjects([[managed.stringObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@\"bar\", @\"foo\"]));\n    uncheckedAssertEqualObjects([[optManaged.stringObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@\"bar\", NSNull.null]));\n    uncheckedAssertEqualObjects([[managed.dateObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[date(1), date(2)]));\n    uncheckedAssertEqualObjects([[optManaged.dateObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[date(1), NSNull.null]));\n    uncheckedAssertEqualObjects([[managed.anyBoolObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@NO, @YES]));\n    uncheckedAssertEqualObjects([[managed.anyIntObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@2, @3]));\n    uncheckedAssertEqualObjects([[managed.anyFloatObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@2.2f, @3.3f]));\n    uncheckedAssertEqualObjects([[managed.anyDoubleObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@2.2, @3.3]));\n    uncheckedAssertEqualObjects([[managed.anyStringObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[@\"a\", @\"b\"]));\n    uncheckedAssertEqualObjects([[managed.anyDataObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[data(1), data(2)]));\n    uncheckedAssertEqualObjects([[managed.anyDateObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[date(1), date(2)]));\n    uncheckedAssertEqualObjects([[managed.anyDecimalObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[decimal128(2), decimal128(3)]));\n    uncheckedAssertEqualObjects([[managed.anyUUIDObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n\n    uncheckedAssertEqualObjects([[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@YES, @NO]));\n    uncheckedAssertEqualObjects([[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@3, @2]));\n    uncheckedAssertEqualObjects([[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@\"foo\", @\"bar\"]));\n    uncheckedAssertEqualObjects([[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[date(2), date(1)]));\n    uncheckedAssertEqualObjects([[managed.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@YES, @NO]));\n    uncheckedAssertEqualObjects([[managed.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@3, @2]));\n    uncheckedAssertEqualObjects([[managed.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@3.3f, @2.2f]));\n    uncheckedAssertEqualObjects([[managed.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@3.3, @2.2]));\n    uncheckedAssertEqualObjects([[managed.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@\"b\", @\"a\"]));\n    uncheckedAssertEqualObjects([[managed.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[data(2), data(1)]));\n    uncheckedAssertEqualObjects([[managed.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[date(2), date(1)]));\n    uncheckedAssertEqualObjects([[managed.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[decimal128(3), decimal128(2)]));\n    uncheckedAssertEqualObjects([[managed.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]));\n    uncheckedAssertEqualObjects([[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@NO, NSNull.null]));\n    uncheckedAssertEqualObjects([[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@2, NSNull.null]));\n    uncheckedAssertEqualObjects([[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[@\"bar\", NSNull.null]));\n    uncheckedAssertEqualObjects([[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"],\n                                (@[date(1), NSNull.null]));\n\n    uncheckedAssertEqualObjects([[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[@NO, @YES]));\n    uncheckedAssertEqualObjects([[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[@2, @3]));\n    uncheckedAssertEqualObjects([[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[@\"bar\", @\"foo\"]));\n    uncheckedAssertEqualObjects([[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[date(1), date(2)]));\n    uncheckedAssertEqualObjects([[managed.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[@NO, @YES]));\n    uncheckedAssertEqualObjects([[managed.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[@2, @3]));\n    uncheckedAssertEqualObjects([[managed.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[@2.2f, @3.3f]));\n    uncheckedAssertEqualObjects([[managed.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[@2.2, @3.3]));\n    uncheckedAssertEqualObjects([[managed.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[@\"a\", @\"b\"]));\n    uncheckedAssertEqualObjects([[managed.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[data(1), data(2)]));\n    uncheckedAssertEqualObjects([[managed.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[date(1), date(2)]));\n    uncheckedAssertEqualObjects([[managed.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[decimal128(2), decimal128(3)]));\n    uncheckedAssertEqualObjects([[managed.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    uncheckedAssertEqualObjects([[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[NSNull.null, @NO]));\n    uncheckedAssertEqualObjects([[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[NSNull.null, @2]));\n    uncheckedAssertEqualObjects([[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[NSNull.null, @\"bar\"]));\n    uncheckedAssertEqualObjects([[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"],\n                                (@[NSNull.null, date(1)]));\n}\n\n- (void)testFilter {\n    RLMAssertThrowsWithReason([unmanaged.boolObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.intObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyBoolObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyIntObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyFloatObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDoubleObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyStringObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDataObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDateObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDecimalObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyObjectIdObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyUUIDObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.boolObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.intObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyBoolObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyIntObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyFloatObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDoubleObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyStringObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDataObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDateObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDecimalObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyObjectIdObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyUUIDObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n\n    RLMAssertThrowsWithReason([managed.boolObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.boolObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.intObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.intObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.stringObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.stringObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.dateObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.dateObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyBoolObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyIntObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyFloatObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDoubleObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyStringObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDataObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDateObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDecimalObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyUUIDObj objectsWhere:@\"TRUEPREDICATE\"],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.boolObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.boolObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.intObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.intObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.stringObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.stringObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.dateObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.dateObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyBoolObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyIntObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyFloatObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDoubleObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyStringObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDataObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDateObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDecimalObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyUUIDObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]],\n                              @\"implemented\");\n\n    RLMAssertThrowsWithReason([[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:NO]\n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n}\n\n- (void)testNotifications {\n    RLMAssertThrowsWithReason([unmanaged.boolObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.intObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyBoolObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyIntObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyFloatObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyDoubleObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyStringObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyDataObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyDateObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyDecimalObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyObjectIdObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyUUIDObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }],\n                              @\"Change notifications are only supported on managed collections.\");\n}\n\n- (void)testMin {\n    RLMAssertThrowsWithReason([unmanaged.boolObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for bool dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for bool? dictionary\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for string dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for string? dictionary\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for data dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for data? dictionary\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for object id dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for object id? dictionary\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for uuid dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj minOfProperty:@\"self\"],\n                              @\"minOfProperty: is not supported for uuid? dictionary\");\n    RLMAssertThrowsWithReason([managed.boolObj minOfProperty:@\"self\"],\n                              @\"Operation 'min' not supported for bool dictionary 'AllPrimitiveDictionaries.boolObj'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj minOfProperty:@\"self\"],\n                              @\"Operation 'min' not supported for bool? dictionary 'AllOptionalPrimitiveDictionaries.boolObj'\");\n    RLMAssertThrowsWithReason([managed.stringObj minOfProperty:@\"self\"],\n                              @\"Operation 'min' not supported for string dictionary 'AllPrimitiveDictionaries.stringObj'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj minOfProperty:@\"self\"],\n                              @\"Operation 'min' not supported for string? dictionary 'AllOptionalPrimitiveDictionaries.stringObj'\");\n\n    uncheckedAssertNil([unmanaged.intObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.intObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.intObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.intObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.dateObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.dateObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.dateObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.dateObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.floatObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.floatObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.floatObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.floatObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.doubleObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.doubleObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.doubleObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.doubleObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.decimalObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.decimalObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.decimalObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.decimalObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyFloatObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDoubleObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDateObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDecimalObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyFloatObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDoubleObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDateObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDecimalObj minOfProperty:@\"self\"]);\n\n    [self addObjects];\n\n    uncheckedAssertEqualObjects([unmanaged.intObj minOfProperty:@\"self\"], @2);\n    uncheckedAssertEqualObjects([optUnmanaged.intObj minOfProperty:@\"self\"], @2);\n    uncheckedAssertEqualObjects([managed.intObj minOfProperty:@\"self\"], @2);\n    uncheckedAssertEqualObjects([optManaged.intObj minOfProperty:@\"self\"], @2);\n    uncheckedAssertEqualObjects([unmanaged.dateObj minOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([optUnmanaged.dateObj minOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([managed.dateObj minOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([optManaged.dateObj minOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([unmanaged.floatObj minOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj minOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([managed.floatObj minOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([optManaged.floatObj minOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([unmanaged.doubleObj minOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj minOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([managed.doubleObj minOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([optManaged.doubleObj minOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([unmanaged.decimalObj minOfProperty:@\"self\"], decimal128(2));\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj minOfProperty:@\"self\"], decimal128(2));\n    uncheckedAssertEqualObjects([managed.decimalObj minOfProperty:@\"self\"], decimal128(2));\n    uncheckedAssertEqualObjects([optManaged.decimalObj minOfProperty:@\"self\"], decimal128(2));\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj minOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj minOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([unmanaged.anyDateObj minOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj minOfProperty:@\"self\"], decimal128(2));\n    uncheckedAssertEqualObjects([managed.anyFloatObj minOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([managed.anyDoubleObj minOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([managed.anyDateObj minOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([managed.anyDecimalObj minOfProperty:@\"self\"], decimal128(2));\n}\n\n- (void)testMax {\n    RLMAssertThrowsWithReason([unmanaged.boolObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for bool dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for bool? dictionary\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for string dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for string? dictionary\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for data dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for data? dictionary\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for object id dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for object id? dictionary\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for uuid dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj maxOfProperty:@\"self\"],\n                              @\"maxOfProperty: is not supported for uuid? dictionary\");\n    RLMAssertThrowsWithReason([managed.boolObj maxOfProperty:@\"self\"],\n                              @\"Operation 'max' not supported for bool dictionary 'AllPrimitiveDictionaries.boolObj'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj maxOfProperty:@\"self\"],\n                              @\"Operation 'max' not supported for bool? dictionary 'AllOptionalPrimitiveDictionaries.boolObj'\");\n    RLMAssertThrowsWithReason([managed.stringObj maxOfProperty:@\"self\"],\n                              @\"Operation 'max' not supported for string dictionary 'AllPrimitiveDictionaries.stringObj'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj maxOfProperty:@\"self\"],\n                              @\"Operation 'max' not supported for string? dictionary 'AllOptionalPrimitiveDictionaries.stringObj'\");\n\n    uncheckedAssertNil([unmanaged.intObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.intObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.intObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.intObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.dateObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.dateObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.dateObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.dateObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.floatObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.floatObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.floatObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.floatObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.doubleObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.doubleObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.doubleObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.doubleObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.decimalObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.decimalObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.decimalObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.decimalObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyFloatObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDoubleObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDateObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDecimalObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyFloatObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDoubleObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDateObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDecimalObj maxOfProperty:@\"self\"]);\n\n    [self addObjects];\n\n    uncheckedAssertEqualObjects([unmanaged.intObj maxOfProperty:@\"self\"], @3);\n    uncheckedAssertEqualObjects([managed.intObj maxOfProperty:@\"self\"], @3);\n    uncheckedAssertEqualObjects([unmanaged.dateObj maxOfProperty:@\"self\"], date(2));\n    uncheckedAssertEqualObjects([managed.dateObj maxOfProperty:@\"self\"], date(2));\n    uncheckedAssertEqualObjects([unmanaged.floatObj maxOfProperty:@\"self\"], @3.3f);\n    uncheckedAssertEqualObjects([managed.floatObj maxOfProperty:@\"self\"], @3.3f);\n    uncheckedAssertEqualObjects([unmanaged.doubleObj maxOfProperty:@\"self\"], @3.3);\n    uncheckedAssertEqualObjects([managed.doubleObj maxOfProperty:@\"self\"], @3.3);\n    uncheckedAssertEqualObjects([unmanaged.decimalObj maxOfProperty:@\"self\"], decimal128(3));\n    uncheckedAssertEqualObjects([managed.decimalObj maxOfProperty:@\"self\"], decimal128(3));\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj maxOfProperty:@\"self\"], @3.3f);\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj maxOfProperty:@\"self\"], @3.3);\n    uncheckedAssertEqualObjects([unmanaged.anyDateObj maxOfProperty:@\"self\"], date(2));\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj maxOfProperty:@\"self\"], decimal128(3));\n    uncheckedAssertEqualObjects([managed.anyFloatObj maxOfProperty:@\"self\"], @3.3f);\n    uncheckedAssertEqualObjects([managed.anyDoubleObj maxOfProperty:@\"self\"], @3.3);\n    uncheckedAssertEqualObjects([managed.anyDateObj maxOfProperty:@\"self\"], date(2));\n    uncheckedAssertEqualObjects([managed.anyDecimalObj maxOfProperty:@\"self\"], decimal128(3));\n    uncheckedAssertEqualObjects([optUnmanaged.intObj maxOfProperty:@\"self\"], @2);\n    uncheckedAssertEqualObjects([optManaged.intObj maxOfProperty:@\"self\"], @2);\n    uncheckedAssertEqualObjects([optUnmanaged.dateObj maxOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([optManaged.dateObj maxOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj maxOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([optManaged.floatObj maxOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj maxOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([optManaged.doubleObj maxOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj maxOfProperty:@\"self\"], decimal128(2));\n    uncheckedAssertEqualObjects([optManaged.decimalObj maxOfProperty:@\"self\"], decimal128(2));\n}\n\n- (void)testSum {\n    RLMAssertThrowsWithReason([unmanaged.boolObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for bool dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for bool? dictionary\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for string dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for string? dictionary\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for date dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for date? dictionary\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for data dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for data? dictionary\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for object id dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for object id? dictionary\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for uuid dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj sumOfProperty:@\"self\"],\n                              @\"sumOfProperty: is not supported for uuid? dictionary\");\n    RLMAssertThrowsWithReason([managed.boolObj sumOfProperty:@\"self\"],\n                              @\"Operation 'sum' not supported for bool dictionary 'AllPrimitiveDictionaries.boolObj'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj sumOfProperty:@\"self\"],\n                              @\"Operation 'sum' not supported for bool? dictionary 'AllOptionalPrimitiveDictionaries.boolObj'\");\n    RLMAssertThrowsWithReason([managed.stringObj sumOfProperty:@\"self\"],\n                              @\"Operation 'sum' not supported for string dictionary 'AllPrimitiveDictionaries.stringObj'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj sumOfProperty:@\"self\"],\n                              @\"Operation 'sum' not supported for string? dictionary 'AllOptionalPrimitiveDictionaries.stringObj'\");\n    RLMAssertThrowsWithReason([managed.dateObj sumOfProperty:@\"self\"],\n                              @\"Operation 'sum' not supported for date dictionary 'AllPrimitiveDictionaries.dateObj'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj sumOfProperty:@\"self\"],\n                              @\"Operation 'sum' not supported for date? dictionary 'AllOptionalPrimitiveDictionaries.dateObj'\");\n\n    uncheckedAssertEqualObjects([unmanaged.intObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.intObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.intObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.intObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.floatObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.floatObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.floatObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.doubleObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.doubleObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.doubleObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.decimalObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.decimalObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.decimalObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyIntObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyIntObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyFloatObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyDoubleObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyDecimalObj sumOfProperty:@\"self\"], @0);\n\n    [self addObjects];\n\n    XCTAssertEqualWithAccuracy([unmanaged.intObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": @2, @\"key2\": @3 }), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.intObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": @2, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([managed.intObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": @2, @\"key2\": @3 }), .001);\n    XCTAssertEqualWithAccuracy([optManaged.intObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": @2, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.floatObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": @2.2f, @\"key2\": @3.3f }), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.floatObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": @2.2f, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([managed.floatObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": @2.2f, @\"key2\": @3.3f }), .001);\n    XCTAssertEqualWithAccuracy([optManaged.floatObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": @2.2f, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.doubleObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": @2.2, @\"key2\": @3.3 }), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.doubleObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": @2.2, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([managed.doubleObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": @2.2, @\"key2\": @3.3 }), .001);\n    XCTAssertEqualWithAccuracy([optManaged.doubleObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": @2.2, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.decimalObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.decimalObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": decimal128(2), @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([managed.decimalObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }), .001);\n    XCTAssertEqualWithAccuracy([optManaged.decimalObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": decimal128(2), @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyIntObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": @2, @\"key2\": @3 }), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyFloatObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": @2.2f, @\"key2\": @3.3f }), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyDoubleObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": @2.2, @\"key2\": @3.3 }), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyDecimalObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }), .001);\n    XCTAssertEqualWithAccuracy([managed.anyIntObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": @2, @\"key2\": @3 }), .001);\n    XCTAssertEqualWithAccuracy([managed.anyFloatObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": @2.2f, @\"key2\": @3.3f }), .001);\n    XCTAssertEqualWithAccuracy([managed.anyDoubleObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": @2.2, @\"key2\": @3.3 }), .001);\n    XCTAssertEqualWithAccuracy([managed.anyDecimalObj sumOfProperty:@\"self\"].doubleValue, sum(@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }), .001);\n}\n\n- (void)testAverage {\n    RLMAssertThrowsWithReason([unmanaged.boolObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for bool dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for bool? dictionary\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for string dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for string? dictionary\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for date dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for date? dictionary\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for data dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for data? dictionary\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for object id dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for object id? dictionary\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for uuid dictionary\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj averageOfProperty:@\"self\"],\n                              @\"averageOfProperty: is not supported for uuid? dictionary\");\n    RLMAssertThrowsWithReason([managed.boolObj averageOfProperty:@\"self\"],\n                              @\"Operation 'average' not supported for bool dictionary 'AllPrimitiveDictionaries.boolObj'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj averageOfProperty:@\"self\"],\n                              @\"Operation 'average' not supported for bool? dictionary 'AllOptionalPrimitiveDictionaries.boolObj'\");\n    RLMAssertThrowsWithReason([managed.stringObj averageOfProperty:@\"self\"],\n                              @\"Operation 'average' not supported for string dictionary 'AllPrimitiveDictionaries.stringObj'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj averageOfProperty:@\"self\"],\n                              @\"Operation 'average' not supported for string? dictionary 'AllOptionalPrimitiveDictionaries.stringObj'\");\n    RLMAssertThrowsWithReason([managed.dateObj averageOfProperty:@\"self\"],\n                              @\"Operation 'average' not supported for date dictionary 'AllPrimitiveDictionaries.dateObj'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj averageOfProperty:@\"self\"],\n                              @\"Operation 'average' not supported for date? dictionary 'AllOptionalPrimitiveDictionaries.dateObj'\");\n\n    uncheckedAssertNil([unmanaged.intObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.intObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.intObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.intObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.floatObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.floatObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.floatObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.floatObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.doubleObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.doubleObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.doubleObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.doubleObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.decimalObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.decimalObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.decimalObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.decimalObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyIntObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyFloatObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDoubleObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDecimalObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyIntObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyFloatObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDoubleObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDecimalObj averageOfProperty:@\"self\"]);\n\n    [self addObjects];\n\n    XCTAssertEqualWithAccuracy([unmanaged.intObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": @2, @\"key2\": @3 }), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.intObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": @2, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([managed.intObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": @2, @\"key2\": @3 }), .001);\n    XCTAssertEqualWithAccuracy([optManaged.intObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": @2, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.floatObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": @2.2f, @\"key2\": @3.3f }), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.floatObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": @2.2f, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([managed.floatObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": @2.2f, @\"key2\": @3.3f }), .001);\n    XCTAssertEqualWithAccuracy([optManaged.floatObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": @2.2f, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.doubleObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": @2.2, @\"key2\": @3.3 }), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.doubleObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": @2.2, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([managed.doubleObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": @2.2, @\"key2\": @3.3 }), .001);\n    XCTAssertEqualWithAccuracy([optManaged.doubleObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": @2.2, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.decimalObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.decimalObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": decimal128(2), @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([managed.decimalObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }), .001);\n    XCTAssertEqualWithAccuracy([optManaged.decimalObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": decimal128(2), @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyIntObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": @2, @\"key2\": @3 }), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyFloatObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": @2.2f, @\"key2\": @3.3f }), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyDoubleObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": @2.2, @\"key2\": @3.3 }), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyDecimalObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }), .001);\n    XCTAssertEqualWithAccuracy([managed.anyIntObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": @2, @\"key2\": @3 }), .001);\n    XCTAssertEqualWithAccuracy([managed.anyFloatObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": @2.2f, @\"key2\": @3.3f }), .001);\n    XCTAssertEqualWithAccuracy([managed.anyDoubleObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": @2.2, @\"key2\": @3.3 }), .001);\n    XCTAssertEqualWithAccuracy([managed.anyDecimalObj averageOfProperty:@\"self\"].doubleValue, average(@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }), .001);\n}\n\n- (void)testFastEnumeration {\n    for (int i = 0; i < 10; ++i) {\n        [self addObjects];\n    }\n\n    // This is wrapped in a block to work around a compiler bug in Xcode 12.5:\n    // in release builds, reads on `values` will read the wrong local variable,\n    // resulting in a crash when it tries to send a message to some unitialized\n    // stack space. Putting them in separate obj-c blocks prevents this\n    // incorrect optimization.\n    ^{\n    NSDictionary *values = @{ @\"key1\": @NO, @\"key2\": @YES };\n    for (id key in unmanaged.boolObj) {\n        id value = unmanaged.boolObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.boolObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @NO, @\"key2\": NSNull.null };\n    for (id key in optUnmanaged.boolObj) {\n        id value = optUnmanaged.boolObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optUnmanaged.boolObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @NO, @\"key2\": @YES };\n    for (id key in managed.boolObj) {\n        id value = managed.boolObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.boolObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @NO, @\"key2\": NSNull.null };\n    for (id key in optManaged.boolObj) {\n        id value = optManaged.boolObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optManaged.boolObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @2, @\"key2\": @3 };\n    for (id key in unmanaged.intObj) {\n        id value = unmanaged.intObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.intObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @2, @\"key2\": NSNull.null };\n    for (id key in optUnmanaged.intObj) {\n        id value = optUnmanaged.intObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optUnmanaged.intObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @2, @\"key2\": @3 };\n    for (id key in managed.intObj) {\n        id value = managed.intObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.intObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @2, @\"key2\": NSNull.null };\n    for (id key in optManaged.intObj) {\n        id value = optManaged.intObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optManaged.intObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @\"bar\", @\"key2\": @\"foo\" };\n    for (id key in unmanaged.stringObj) {\n        id value = unmanaged.stringObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.stringObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @\"bar\", @\"key2\": NSNull.null };\n    for (id key in optUnmanaged.stringObj) {\n        id value = optUnmanaged.stringObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optUnmanaged.stringObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @\"bar\", @\"key2\": @\"foo\" };\n    for (id key in managed.stringObj) {\n        id value = managed.stringObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.stringObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @\"bar\", @\"key2\": NSNull.null };\n    for (id key in optManaged.stringObj) {\n        id value = optManaged.stringObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optManaged.stringObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": date(1), @\"key2\": date(2) };\n    for (id key in unmanaged.dateObj) {\n        id value = unmanaged.dateObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.dateObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": date(1), @\"key2\": NSNull.null };\n    for (id key in optUnmanaged.dateObj) {\n        id value = optUnmanaged.dateObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optUnmanaged.dateObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": date(1), @\"key2\": date(2) };\n    for (id key in managed.dateObj) {\n        id value = managed.dateObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.dateObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": date(1), @\"key2\": NSNull.null };\n    for (id key in optManaged.dateObj) {\n        id value = optManaged.dateObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optManaged.dateObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @2.2f, @\"key2\": @3.3f };\n    for (id key in unmanaged.floatObj) {\n        id value = unmanaged.floatObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.floatObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @2.2f, @\"key2\": NSNull.null };\n    for (id key in optUnmanaged.floatObj) {\n        id value = optUnmanaged.floatObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optUnmanaged.floatObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @2.2f, @\"key2\": @3.3f };\n    for (id key in managed.floatObj) {\n        id value = managed.floatObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.floatObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @2.2f, @\"key2\": NSNull.null };\n    for (id key in optManaged.floatObj) {\n        id value = optManaged.floatObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optManaged.floatObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @2.2, @\"key2\": @3.3 };\n    for (id key in unmanaged.doubleObj) {\n        id value = unmanaged.doubleObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.doubleObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @2.2, @\"key2\": NSNull.null };\n    for (id key in optUnmanaged.doubleObj) {\n        id value = optUnmanaged.doubleObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optUnmanaged.doubleObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @2.2, @\"key2\": @3.3 };\n    for (id key in managed.doubleObj) {\n        id value = managed.doubleObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.doubleObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @2.2, @\"key2\": NSNull.null };\n    for (id key in optManaged.doubleObj) {\n        id value = optManaged.doubleObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optManaged.doubleObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": data(1), @\"key2\": data(2) };\n    for (id key in unmanaged.dataObj) {\n        id value = unmanaged.dataObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.dataObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": data(1), @\"key2\": NSNull.null };\n    for (id key in optUnmanaged.dataObj) {\n        id value = optUnmanaged.dataObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optUnmanaged.dataObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": data(1), @\"key2\": data(2) };\n    for (id key in managed.dataObj) {\n        id value = managed.dataObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.dataObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": data(1), @\"key2\": NSNull.null };\n    for (id key in optManaged.dataObj) {\n        id value = optManaged.dataObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optManaged.dataObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) };\n    for (id key in unmanaged.decimalObj) {\n        id value = unmanaged.decimalObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.decimalObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": decimal128(2), @\"key2\": NSNull.null };\n    for (id key in optUnmanaged.decimalObj) {\n        id value = optUnmanaged.decimalObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optUnmanaged.decimalObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) };\n    for (id key in managed.decimalObj) {\n        id value = managed.decimalObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.decimalObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": decimal128(2), @\"key2\": NSNull.null };\n    for (id key in optManaged.decimalObj) {\n        id value = optManaged.decimalObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optManaged.decimalObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": objectId(1), @\"key2\": objectId(2) };\n    for (id key in unmanaged.objectIdObj) {\n        id value = unmanaged.objectIdObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.objectIdObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": objectId(1), @\"key2\": NSNull.null };\n    for (id key in optUnmanaged.objectIdObj) {\n        id value = optUnmanaged.objectIdObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optUnmanaged.objectIdObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": objectId(1), @\"key2\": objectId(2) };\n    for (id key in managed.objectIdObj) {\n        id value = managed.objectIdObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.objectIdObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": objectId(1), @\"key2\": NSNull.null };\n    for (id key in optManaged.objectIdObj) {\n        id value = optManaged.objectIdObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optManaged.objectIdObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") };\n    for (id key in unmanaged.uuidObj) {\n        id value = unmanaged.uuidObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.uuidObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": NSNull.null };\n    for (id key in optUnmanaged.uuidObj) {\n        id value = optUnmanaged.uuidObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optUnmanaged.uuidObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") };\n    for (id key in managed.uuidObj) {\n        id value = managed.uuidObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.uuidObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": NSNull.null };\n    for (id key in optManaged.uuidObj) {\n        id value = optManaged.uuidObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, optManaged.uuidObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @NO, @\"key2\": @YES };\n    for (id key in unmanaged.anyBoolObj) {\n        id value = unmanaged.anyBoolObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.anyBoolObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @2, @\"key2\": @3 };\n    for (id key in unmanaged.anyIntObj) {\n        id value = unmanaged.anyIntObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.anyIntObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @2.2f, @\"key2\": @3.3f };\n    for (id key in unmanaged.anyFloatObj) {\n        id value = unmanaged.anyFloatObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.anyFloatObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @2.2, @\"key2\": @3.3 };\n    for (id key in unmanaged.anyDoubleObj) {\n        id value = unmanaged.anyDoubleObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.anyDoubleObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @\"a\", @\"key2\": @\"b\" };\n    for (id key in unmanaged.anyStringObj) {\n        id value = unmanaged.anyStringObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.anyStringObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": data(1), @\"key2\": data(2) };\n    for (id key in unmanaged.anyDataObj) {\n        id value = unmanaged.anyDataObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.anyDataObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": date(1), @\"key2\": date(2) };\n    for (id key in unmanaged.anyDateObj) {\n        id value = unmanaged.anyDateObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.anyDateObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) };\n    for (id key in unmanaged.anyDecimalObj) {\n        id value = unmanaged.anyDecimalObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.anyDecimalObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": objectId(1), @\"key2\": objectId(2) };\n    for (id key in unmanaged.anyObjectIdObj) {\n        id value = unmanaged.anyObjectIdObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.anyObjectIdObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") };\n    for (id key in unmanaged.anyUUIDObj) {\n        id value = unmanaged.anyUUIDObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, unmanaged.anyUUIDObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @NO, @\"key2\": @YES };\n    for (id key in managed.anyBoolObj) {\n        id value = managed.anyBoolObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.anyBoolObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @2, @\"key2\": @3 };\n    for (id key in managed.anyIntObj) {\n        id value = managed.anyIntObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.anyIntObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @2.2f, @\"key2\": @3.3f };\n    for (id key in managed.anyFloatObj) {\n        id value = managed.anyFloatObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.anyFloatObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @2.2, @\"key2\": @3.3 };\n    for (id key in managed.anyDoubleObj) {\n        id value = managed.anyDoubleObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.anyDoubleObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": @\"a\", @\"key2\": @\"b\" };\n    for (id key in managed.anyStringObj) {\n        id value = managed.anyStringObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.anyStringObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": data(1), @\"key2\": data(2) };\n    for (id key in managed.anyDataObj) {\n        id value = managed.anyDataObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.anyDataObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": date(1), @\"key2\": date(2) };\n    for (id key in managed.anyDateObj) {\n        id value = managed.anyDateObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.anyDateObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) };\n    for (id key in managed.anyDecimalObj) {\n        id value = managed.anyDecimalObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.anyDecimalObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": objectId(1), @\"key2\": objectId(2) };\n    for (id key in managed.anyObjectIdObj) {\n        id value = managed.anyObjectIdObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.anyObjectIdObj.count);\n    }();\n    \n    ^{\n    NSDictionary *values = @{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") };\n    for (id key in managed.anyUUIDObj) {\n        id value = managed.anyUUIDObj[key];\n        uncheckedAssertEqualObjects(values[key], value);\n    }\n    uncheckedAssertEqual(values.count, managed.anyUUIDObj.count);\n    }();\n    \n}\n\n- (void)testValueForKeyNumericAggregates {\n    uncheckedAssertNil([unmanaged.intObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optUnmanaged.intObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.intObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optManaged.intObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.dateObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optUnmanaged.dateObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.dateObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optManaged.dateObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.floatObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optUnmanaged.floatObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.floatObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optManaged.floatObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.doubleObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optUnmanaged.doubleObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.doubleObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optManaged.doubleObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.decimalObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optUnmanaged.decimalObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.decimalObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optManaged.decimalObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.anyFloatObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.anyDoubleObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.anyDateObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.anyDecimalObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.anyFloatObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.anyDoubleObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.anyDateObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.anyDecimalObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.intObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optUnmanaged.intObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.intObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optManaged.intObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.dateObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optUnmanaged.dateObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.dateObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optManaged.dateObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.floatObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optUnmanaged.floatObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.floatObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optManaged.floatObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.doubleObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optUnmanaged.doubleObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.doubleObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optManaged.doubleObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.decimalObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optUnmanaged.decimalObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.decimalObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optManaged.decimalObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.anyFloatObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.anyDoubleObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.anyDateObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.anyDecimalObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.anyFloatObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.anyDoubleObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.anyDateObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.anyDecimalObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertEqualObjects([unmanaged.intObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.intObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.intObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.intObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.floatObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.floatObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.floatObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.doubleObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.doubleObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.doubleObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.decimalObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.decimalObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.decimalObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyIntObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyIntObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyFloatObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyDoubleObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyDecimalObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertNil([unmanaged.intObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optUnmanaged.intObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.intObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optManaged.intObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([unmanaged.floatObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optUnmanaged.floatObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.floatObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optManaged.floatObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([unmanaged.doubleObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optUnmanaged.doubleObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.doubleObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optManaged.doubleObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([unmanaged.decimalObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optUnmanaged.decimalObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.decimalObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optManaged.decimalObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([unmanaged.anyIntObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([unmanaged.anyFloatObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([unmanaged.anyDoubleObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([unmanaged.anyDecimalObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.anyIntObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.anyFloatObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.anyDoubleObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.anyDecimalObj valueForKeyPath:@\"@avg.self\"]);\n\n    [self addObjects];\n\n    uncheckedAssertEqualObjects([unmanaged.intObj valueForKeyPath:@\"@min.self\"], @2);\n    uncheckedAssertEqualObjects([optUnmanaged.intObj valueForKeyPath:@\"@min.self\"], @2);\n    uncheckedAssertEqualObjects([managed.intObj valueForKeyPath:@\"@min.self\"], @2);\n    uncheckedAssertEqualObjects([optManaged.intObj valueForKeyPath:@\"@min.self\"], @2);\n    uncheckedAssertEqualObjects([unmanaged.dateObj valueForKeyPath:@\"@min.self\"], date(1));\n    uncheckedAssertEqualObjects([optUnmanaged.dateObj valueForKeyPath:@\"@min.self\"], date(1));\n    uncheckedAssertEqualObjects([managed.dateObj valueForKeyPath:@\"@min.self\"], date(1));\n    uncheckedAssertEqualObjects([optManaged.dateObj valueForKeyPath:@\"@min.self\"], date(1));\n    uncheckedAssertEqualObjects([unmanaged.floatObj valueForKeyPath:@\"@min.self\"], @2.2f);\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj valueForKeyPath:@\"@min.self\"], @2.2f);\n    uncheckedAssertEqualObjects([managed.floatObj valueForKeyPath:@\"@min.self\"], @2.2f);\n    uncheckedAssertEqualObjects([optManaged.floatObj valueForKeyPath:@\"@min.self\"], @2.2f);\n    uncheckedAssertEqualObjects([unmanaged.doubleObj valueForKeyPath:@\"@min.self\"], @2.2);\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj valueForKeyPath:@\"@min.self\"], @2.2);\n    uncheckedAssertEqualObjects([managed.doubleObj valueForKeyPath:@\"@min.self\"], @2.2);\n    uncheckedAssertEqualObjects([optManaged.doubleObj valueForKeyPath:@\"@min.self\"], @2.2);\n    uncheckedAssertEqualObjects([unmanaged.decimalObj valueForKeyPath:@\"@min.self\"], decimal128(2));\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj valueForKeyPath:@\"@min.self\"], decimal128(2));\n    uncheckedAssertEqualObjects([managed.decimalObj valueForKeyPath:@\"@min.self\"], decimal128(2));\n    uncheckedAssertEqualObjects([optManaged.decimalObj valueForKeyPath:@\"@min.self\"], decimal128(2));\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj valueForKeyPath:@\"@min.self\"], @2.2f);\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj valueForKeyPath:@\"@min.self\"], @2.2);\n    uncheckedAssertEqualObjects([unmanaged.anyDateObj valueForKeyPath:@\"@min.self\"], date(1));\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj valueForKeyPath:@\"@min.self\"], decimal128(2));\n    uncheckedAssertEqualObjects([managed.anyFloatObj valueForKeyPath:@\"@min.self\"], @2.2f);\n    uncheckedAssertEqualObjects([managed.anyDoubleObj valueForKeyPath:@\"@min.self\"], @2.2);\n    uncheckedAssertEqualObjects([managed.anyDateObj valueForKeyPath:@\"@min.self\"], date(1));\n    uncheckedAssertEqualObjects([managed.anyDecimalObj valueForKeyPath:@\"@min.self\"], decimal128(2));\n    uncheckedAssertEqualObjects([unmanaged.intObj valueForKeyPath:@\"@max.self\"], @3);\n    uncheckedAssertEqualObjects([managed.intObj valueForKeyPath:@\"@max.self\"], @3);\n    uncheckedAssertEqualObjects([unmanaged.dateObj valueForKeyPath:@\"@max.self\"], date(2));\n    uncheckedAssertEqualObjects([managed.dateObj valueForKeyPath:@\"@max.self\"], date(2));\n    uncheckedAssertEqualObjects([unmanaged.floatObj valueForKeyPath:@\"@max.self\"], @3.3f);\n    uncheckedAssertEqualObjects([managed.floatObj valueForKeyPath:@\"@max.self\"], @3.3f);\n    uncheckedAssertEqualObjects([unmanaged.doubleObj valueForKeyPath:@\"@max.self\"], @3.3);\n    uncheckedAssertEqualObjects([managed.doubleObj valueForKeyPath:@\"@max.self\"], @3.3);\n    uncheckedAssertEqualObjects([unmanaged.decimalObj valueForKeyPath:@\"@max.self\"], decimal128(3));\n    uncheckedAssertEqualObjects([managed.decimalObj valueForKeyPath:@\"@max.self\"], decimal128(3));\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj valueForKeyPath:@\"@max.self\"], @3.3f);\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj valueForKeyPath:@\"@max.self\"], @3.3);\n    uncheckedAssertEqualObjects([unmanaged.anyDateObj valueForKeyPath:@\"@max.self\"], date(2));\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj valueForKeyPath:@\"@max.self\"], decimal128(3));\n    uncheckedAssertEqualObjects([managed.anyFloatObj valueForKeyPath:@\"@max.self\"], @3.3f);\n    uncheckedAssertEqualObjects([managed.anyDoubleObj valueForKeyPath:@\"@max.self\"], @3.3);\n    uncheckedAssertEqualObjects([managed.anyDateObj valueForKeyPath:@\"@max.self\"], date(2));\n    uncheckedAssertEqualObjects([managed.anyDecimalObj valueForKeyPath:@\"@max.self\"], decimal128(3));\n    uncheckedAssertEqualObjects([optUnmanaged.intObj valueForKeyPath:@\"@max.self\"], @2);\n    uncheckedAssertEqualObjects([optManaged.intObj valueForKeyPath:@\"@max.self\"], @2);\n    uncheckedAssertEqualObjects([optUnmanaged.dateObj valueForKeyPath:@\"@max.self\"], date(1));\n    uncheckedAssertEqualObjects([optManaged.dateObj valueForKeyPath:@\"@max.self\"], date(1));\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj valueForKeyPath:@\"@max.self\"], @2.2f);\n    uncheckedAssertEqualObjects([optManaged.floatObj valueForKeyPath:@\"@max.self\"], @2.2f);\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj valueForKeyPath:@\"@max.self\"], @2.2);\n    uncheckedAssertEqualObjects([optManaged.doubleObj valueForKeyPath:@\"@max.self\"], @2.2);\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj valueForKeyPath:@\"@max.self\"], decimal128(2));\n    uncheckedAssertEqualObjects([optManaged.decimalObj valueForKeyPath:@\"@max.self\"], decimal128(2));\n    XCTAssertEqualWithAccuracy([[unmanaged.intObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": @2, @\"key2\": @3 }), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.intObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": @2, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([[managed.intObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": @2, @\"key2\": @3 }), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.intObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": @2, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.floatObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": @2.2f, @\"key2\": @3.3f }), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.floatObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": @2.2f, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([[managed.floatObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": @2.2f, @\"key2\": @3.3f }), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.floatObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": @2.2f, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.doubleObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": @2.2, @\"key2\": @3.3 }), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.doubleObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": @2.2, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([[managed.doubleObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": @2.2, @\"key2\": @3.3 }), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.doubleObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": @2.2, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.decimalObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.decimalObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": decimal128(2), @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([[managed.decimalObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.decimalObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": decimal128(2), @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.anyIntObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": @2, @\"key2\": @3 }), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.anyFloatObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": @2.2f, @\"key2\": @3.3f }), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.anyDoubleObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": @2.2, @\"key2\": @3.3 }), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.anyDecimalObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }), .001);\n    XCTAssertEqualWithAccuracy([[managed.anyIntObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": @2, @\"key2\": @3 }), .001);\n    XCTAssertEqualWithAccuracy([[managed.anyFloatObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": @2.2f, @\"key2\": @3.3f }), .001);\n    XCTAssertEqualWithAccuracy([[managed.anyDoubleObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": @2.2, @\"key2\": @3.3 }), .001);\n    XCTAssertEqualWithAccuracy([[managed.anyDecimalObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.intObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": @2, @\"key2\": @3 }), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.intObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": @2, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([[managed.intObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": @2, @\"key2\": @3 }), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.intObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": @2, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.floatObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": @2.2f, @\"key2\": @3.3f }), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.floatObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": @2.2f, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([[managed.floatObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": @2.2f, @\"key2\": @3.3f }), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.floatObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": @2.2f, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.doubleObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": @2.2, @\"key2\": @3.3 }), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.doubleObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": @2.2, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([[managed.doubleObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": @2.2, @\"key2\": @3.3 }), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.doubleObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": @2.2, @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.decimalObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.decimalObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": decimal128(2), @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([[managed.decimalObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.decimalObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": decimal128(2), @\"key2\": NSNull.null }), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.anyIntObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": @2, @\"key2\": @3 }), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.anyFloatObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": @2.2f, @\"key2\": @3.3f }), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.anyDoubleObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": @2.2, @\"key2\": @3.3 }), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.anyDecimalObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }), .001);\n    XCTAssertEqualWithAccuracy([[managed.anyIntObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": @2, @\"key2\": @3 }), .001);\n    XCTAssertEqualWithAccuracy([[managed.anyFloatObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": @2.2f, @\"key2\": @3.3f }), .001);\n    XCTAssertEqualWithAccuracy([[managed.anyDoubleObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": @2.2, @\"key2\": @3.3 }), .001);\n    XCTAssertEqualWithAccuracy([[managed.anyDecimalObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) }), .001);\n}\n\n- (void)testSetValueForKey {\n    RLMAssertThrowsWithReason([unmanaged.boolObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([managed.boolObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([managed.intObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([optManaged.intObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj setValue:@2 forKey:@\"key1\"],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj setValue:@2 forKey:@\"key1\"],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([managed.stringObj setValue:@2 forKey:@\"key1\"],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj setValue:@2 forKey:@\"key1\"],\n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([managed.dateObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([managed.floatObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([optManaged.floatObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([managed.doubleObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([managed.dataObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([managed.decimalObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([managed.uuidObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj setValue:@\"a\" forKey:@\"key1\"],\n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([unmanaged.boolObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.boolObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.intObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.stringObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.dateObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.floatObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.doubleObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dataObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.decimalObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([managed.uuidObj setValue:(id)NSNull.null forKey:@\"self\"],\n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n\n    [self addObjects];\n\n    uncheckedAssertEqualObjects(unmanaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(managed.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(optManaged.boolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(unmanaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(managed.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(optManaged.intObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(unmanaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(managed.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(optManaged.stringObj[@\"key1\"], @\"bar\");\n    uncheckedAssertEqualObjects(unmanaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(managed.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(optManaged.dateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(unmanaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(managed.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(optManaged.floatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(managed.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(managed.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(optManaged.dataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(managed.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(optManaged.decimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(managed.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optManaged.uuidObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[@\"key1\"], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj[@\"key1\"], @NO);\n    uncheckedAssertEqualObjects(managed.anyIntObj[@\"key1\"], @2);\n    uncheckedAssertEqualObjects(managed.anyFloatObj[@\"key1\"], @2.2f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[@\"key1\"], @2.2);\n    uncheckedAssertEqualObjects(managed.anyStringObj[@\"key1\"], @\"a\");\n    uncheckedAssertEqualObjects(managed.anyDataObj[@\"key1\"], data(1));\n    uncheckedAssertEqualObjects(managed.anyDateObj[@\"key1\"], date(1));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[@\"key1\"], decimal128(2));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[@\"key1\"], objectId(1));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[@\"key1\"], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n\n    [optUnmanaged.boolObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    [optManaged.boolObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    [optUnmanaged.intObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    [optManaged.intObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    [optUnmanaged.stringObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    [optManaged.stringObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    [optUnmanaged.dateObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    [optManaged.dateObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    [optUnmanaged.floatObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    [optManaged.floatObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    [optUnmanaged.doubleObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    [optManaged.doubleObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    [optUnmanaged.dataObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    [optManaged.dataObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    [optUnmanaged.decimalObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    [optManaged.decimalObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    [optUnmanaged.objectIdObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    [optManaged.objectIdObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    [optUnmanaged.uuidObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    [optManaged.uuidObj setValue:(id)NSNull.null forKey:@\"key1\"];\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.boolObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.intObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.stringObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dateObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.floatObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.doubleObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dataObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.decimalObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[@\"key1\"], (id)NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.uuidObj[@\"key1\"], (id)NSNull.null);\n}\n\n- (void)testAssignment {\n    unmanaged.boolObj = (id)@{@\"key2\": @YES};\n    uncheckedAssertEqualObjects(unmanaged.boolObj[@\"key2\"], @YES);\n    optUnmanaged.boolObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj[@\"key2\"], NSNull.null);\n    managed.boolObj = (id)@{@\"key2\": @YES};\n    uncheckedAssertEqualObjects(managed.boolObj[@\"key2\"], @YES);\n    optManaged.boolObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optManaged.boolObj[@\"key2\"], NSNull.null);\n    unmanaged.intObj = (id)@{@\"key2\": @3};\n    uncheckedAssertEqualObjects(unmanaged.intObj[@\"key2\"], @3);\n    optUnmanaged.intObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optUnmanaged.intObj[@\"key2\"], NSNull.null);\n    managed.intObj = (id)@{@\"key2\": @3};\n    uncheckedAssertEqualObjects(managed.intObj[@\"key2\"], @3);\n    optManaged.intObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optManaged.intObj[@\"key2\"], NSNull.null);\n    unmanaged.stringObj = (id)@{@\"key2\": @\"foo\"};\n    uncheckedAssertEqualObjects(unmanaged.stringObj[@\"key2\"], @\"foo\");\n    optUnmanaged.stringObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj[@\"key2\"], NSNull.null);\n    managed.stringObj = (id)@{@\"key2\": @\"foo\"};\n    uncheckedAssertEqualObjects(managed.stringObj[@\"key2\"], @\"foo\");\n    optManaged.stringObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optManaged.stringObj[@\"key2\"], NSNull.null);\n    unmanaged.dateObj = (id)@{@\"key2\": date(2)};\n    uncheckedAssertEqualObjects(unmanaged.dateObj[@\"key2\"], date(2));\n    optUnmanaged.dateObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj[@\"key2\"], NSNull.null);\n    managed.dateObj = (id)@{@\"key2\": date(2)};\n    uncheckedAssertEqualObjects(managed.dateObj[@\"key2\"], date(2));\n    optManaged.dateObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optManaged.dateObj[@\"key2\"], NSNull.null);\n    unmanaged.floatObj = (id)@{@\"key2\": @3.3f};\n    uncheckedAssertEqualObjects(unmanaged.floatObj[@\"key2\"], @3.3f);\n    optUnmanaged.floatObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj[@\"key2\"], NSNull.null);\n    managed.floatObj = (id)@{@\"key2\": @3.3f};\n    uncheckedAssertEqualObjects(managed.floatObj[@\"key2\"], @3.3f);\n    optManaged.floatObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optManaged.floatObj[@\"key2\"], NSNull.null);\n    unmanaged.doubleObj = (id)@{@\"key2\": @3.3};\n    uncheckedAssertEqualObjects(unmanaged.doubleObj[@\"key2\"], @3.3);\n    optUnmanaged.doubleObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj[@\"key2\"], NSNull.null);\n    managed.doubleObj = (id)@{@\"key2\": @3.3};\n    uncheckedAssertEqualObjects(managed.doubleObj[@\"key2\"], @3.3);\n    optManaged.doubleObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optManaged.doubleObj[@\"key2\"], NSNull.null);\n    unmanaged.dataObj = (id)@{@\"key2\": data(2)};\n    uncheckedAssertEqualObjects(unmanaged.dataObj[@\"key2\"], data(2));\n    optUnmanaged.dataObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj[@\"key2\"], NSNull.null);\n    managed.dataObj = (id)@{@\"key2\": data(2)};\n    uncheckedAssertEqualObjects(managed.dataObj[@\"key2\"], data(2));\n    optManaged.dataObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optManaged.dataObj[@\"key2\"], NSNull.null);\n    unmanaged.decimalObj = (id)@{@\"key2\": decimal128(3)};\n    uncheckedAssertEqualObjects(unmanaged.decimalObj[@\"key2\"], decimal128(3));\n    optUnmanaged.decimalObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj[@\"key2\"], NSNull.null);\n    managed.decimalObj = (id)@{@\"key2\": decimal128(3)};\n    uncheckedAssertEqualObjects(managed.decimalObj[@\"key2\"], decimal128(3));\n    optManaged.decimalObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optManaged.decimalObj[@\"key2\"], NSNull.null);\n    unmanaged.objectIdObj = (id)@{@\"key2\": objectId(2)};\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj[@\"key2\"], objectId(2));\n    optUnmanaged.objectIdObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj[@\"key2\"], NSNull.null);\n    managed.objectIdObj = (id)@{@\"key2\": objectId(2)};\n    uncheckedAssertEqualObjects(managed.objectIdObj[@\"key2\"], objectId(2));\n    optManaged.objectIdObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optManaged.objectIdObj[@\"key2\"], NSNull.null);\n    unmanaged.uuidObj = (id)@{@\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")};\n    uncheckedAssertEqualObjects(unmanaged.uuidObj[@\"key2\"], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    optUnmanaged.uuidObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj[@\"key2\"], NSNull.null);\n    managed.uuidObj = (id)@{@\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")};\n    uncheckedAssertEqualObjects(managed.uuidObj[@\"key2\"], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    optManaged.uuidObj = (id)@{@\"key2\": NSNull.null};\n    uncheckedAssertEqualObjects(optManaged.uuidObj[@\"key2\"], NSNull.null);\n    unmanaged.anyBoolObj = (id)@{@\"key2\": @YES};\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj[@\"key2\"], @YES);\n    unmanaged.anyIntObj = (id)@{@\"key2\": @3};\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj[@\"key2\"], @3);\n    unmanaged.anyFloatObj = (id)@{@\"key2\": @3.3f};\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj[@\"key2\"], @3.3f);\n    unmanaged.anyDoubleObj = (id)@{@\"key2\": @3.3};\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj[@\"key2\"], @3.3);\n    unmanaged.anyStringObj = (id)@{@\"key2\": @\"b\"};\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj[@\"key2\"], @\"b\");\n    unmanaged.anyDataObj = (id)@{@\"key2\": data(2)};\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj[@\"key2\"], data(2));\n    unmanaged.anyDateObj = (id)@{@\"key2\": date(2)};\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj[@\"key2\"], date(2));\n    unmanaged.anyDecimalObj = (id)@{@\"key2\": decimal128(3)};\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj[@\"key2\"], decimal128(3));\n    unmanaged.anyObjectIdObj = (id)@{@\"key2\": objectId(2)};\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj[@\"key2\"], objectId(2));\n    unmanaged.anyUUIDObj = (id)@{@\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")};\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj[@\"key2\"], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    managed.anyBoolObj = (id)@{@\"key2\": @YES};\n    uncheckedAssertEqualObjects(managed.anyBoolObj[@\"key2\"], @YES);\n    managed.anyIntObj = (id)@{@\"key2\": @3};\n    uncheckedAssertEqualObjects(managed.anyIntObj[@\"key2\"], @3);\n    managed.anyFloatObj = (id)@{@\"key2\": @3.3f};\n    uncheckedAssertEqualObjects(managed.anyFloatObj[@\"key2\"], @3.3f);\n    managed.anyDoubleObj = (id)@{@\"key2\": @3.3};\n    uncheckedAssertEqualObjects(managed.anyDoubleObj[@\"key2\"], @3.3);\n    managed.anyStringObj = (id)@{@\"key2\": @\"b\"};\n    uncheckedAssertEqualObjects(managed.anyStringObj[@\"key2\"], @\"b\");\n    managed.anyDataObj = (id)@{@\"key2\": data(2)};\n    uncheckedAssertEqualObjects(managed.anyDataObj[@\"key2\"], data(2));\n    managed.anyDateObj = (id)@{@\"key2\": date(2)};\n    uncheckedAssertEqualObjects(managed.anyDateObj[@\"key2\"], date(2));\n    managed.anyDecimalObj = (id)@{@\"key2\": decimal128(3)};\n    uncheckedAssertEqualObjects(managed.anyDecimalObj[@\"key2\"], decimal128(3));\n    managed.anyObjectIdObj = (id)@{@\"key2\": objectId(2)};\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj[@\"key2\"], objectId(2));\n    managed.anyUUIDObj = (id)@{@\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")};\n    uncheckedAssertEqualObjects(managed.anyUUIDObj[@\"key2\"], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n\n    [unmanaged.intObj removeAllObjects];\n    unmanaged.intObj = managed.intObj;\n\n    uncheckedAssertEqual(unmanaged.intObj.count, 1);\n    uncheckedAssertEqualObjects(unmanaged.intObj.allValues, managed.intObj.allValues);\n\n    [managed.intObj removeAllObjects];\n    managed.intObj = unmanaged.intObj;\n\n    uncheckedAssertEqual(managed.intObj.count, 1);\n    uncheckedAssertEqualObjects(managed.intObj.allValues, unmanaged.intObj.allValues);\n}\n\n- (void)testInvalidAssignment {\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)@{@\"0\": (id)NSNull.null},\n                              @\"Invalid value '<null>' of type 'NSNull' for 'int' dictionary property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)@{@\"0\": @\"a\"},\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' dictionary property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)(@{@\"0\": @1, @\"1\": @\"a\"}),\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' dictionary property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)unmanaged.floatObj,\n                              @\"RLMDictionary<string, float> does not match expected type 'int' for property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)optUnmanaged.intObj,\n                              @\"RLMDictionary<string, int?> does not match expected type 'int' for property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged[@\"intObj\"] = unmanaged[@\"floatObj\"],\n                              @\"RLMDictionary<string, float> does not match expected type 'int' for property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged[@\"intObj\"] = optUnmanaged[@\"intObj\"],\n                              @\"RLMDictionary<string, int?> does not match expected type 'int' for property 'AllPrimitiveDictionaries.intObj'.\");\n\n    RLMAssertThrowsWithReason(managed.intObj = (id)@{@\"0\": (id)NSNull.null},\n                              @\"Invalid value '<null>' of type 'NSNull' for 'int' dictionary property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)@{@\"0\": @\"a\"},\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' dictionary property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)(@{@\"0\": @1, @\"1\": @\"a\"}),\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' dictionary property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)managed.floatObj,\n                              @\"RLMDictionary<string, float> does not match expected type 'int' for property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)optManaged.intObj,\n                              @\"RLMDictionary<string, int?> does not match expected type 'int' for property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(managed[@\"intObj\"] = (id)managed[@\"floatObj\"],\n                              @\"RLMDictionary<string, float> does not match expected type 'int' for property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(managed[@\"intObj\"] = (id)optManaged[@\"intObj\"],\n                              @\"RLMDictionary<string, int?> does not match expected type 'int' for property 'AllPrimitiveDictionaries.intObj'.\");\n}\n\n- (void)testAllMethodsCheckThread {\n    RLMDictionary *dictionary = managed.intObj;\n    [self dispatchAsyncAndWait:^{\n        RLMAssertThrowsWithReason([dictionary count], @\"thread\");\n        RLMAssertThrowsWithReason(dictionary[@\"0\"], @\"thread\");\n        RLMAssertThrowsWithReason([dictionary count], @\"thread\");\n\n        RLMAssertThrowsWithReason([dictionary setObject:@0 forKey:@\"thread\"], @\"thread\");\n        RLMAssertThrowsWithReason([dictionary addEntriesFromDictionary:@{@\"thread\": @0}], @\"thread\");\n        RLMAssertThrowsWithReason([dictionary removeObjectForKey:@\"thread\"], @\"thread\");\n        RLMAssertThrowsWithReason([dictionary removeObjectsForKeys:(id)@[@\"thread\"]], @\"thread\");\n        RLMAssertThrowsWithReason([dictionary removeAllObjects], @\"thread\");\n        RLMAssertThrowsWithReason([optManaged.intObj setObject:(id)NSNull.null forKey:@\"thread\"], @\"thread\");\n\n        RLMAssertThrowsWithReason([dictionary sortedResultsUsingKeyPath:@\"self\" ascending:YES], @\"thread\");\n        RLMAssertThrowsWithReason([dictionary sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"self\" ascending:YES]]], @\"thread\");\n        RLMAssertThrowsWithReason(dictionary[@\"thread\"], @\"thread\");\n        RLMAssertThrowsWithReason(dictionary[@\"thread\"] = @0, @\"thread\");\n        RLMAssertThrowsWithReason([dictionary valueForKey:@\"self\"], @\"thread\");\n        RLMAssertThrowsWithReason([dictionary setValue:@1 forKey:@\"self\"], @\"thread\");\n        RLMAssertThrowsWithReason(({for (__unused id obj in dictionary);}), @\"thread\");\n    }];\n}\n\n- (void)testAllMethodsCheckForInvalidation {\n    RLMDictionary *dictionary = managed.intObj;\n    [realm cancelWriteTransaction];\n    [realm invalidate];\n\n    XCTAssertNoThrow([dictionary objectClassName]);\n    XCTAssertNoThrow([dictionary realm]);\n    XCTAssertNoThrow([dictionary isInvalidated]);\n\n    RLMAssertThrowsWithReason([dictionary count], @\"invalidated\");\n    uncheckedAssertNil(dictionary[@\"0\"]);\n    RLMAssertThrowsWithReason([dictionary count], @\"invalidated\");\n\n    RLMAssertThrowsWithReason([dictionary setObject:@0 forKey:@\"thread\"], @\"invalidated\");\n    RLMAssertThrowsWithReason([dictionary addEntriesFromDictionary:@{@\"invalidated\": @0}], @\"invalidated\");\n    RLMAssertThrowsWithReason([dictionary removeObjectForKey:@\"invalidated\"], @\"invalidated\");\n    RLMAssertThrowsWithReason([dictionary removeObjectsForKeys:(id)@[@\"invalidated\"]], @\"invalidated\");\n    RLMAssertThrowsWithReason([dictionary removeAllObjects], @\"invalidated\");\n    RLMAssertThrowsWithReason([optManaged.intObj setObject:(id)NSNull.null forKey:@\"invalidated\"], @\"invalidated\");\n\n    RLMAssertThrowsWithReason([dictionary sortedResultsUsingKeyPath:@\"self\" ascending:YES], @\"invalidated\");\n    RLMAssertThrowsWithReason([dictionary sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"self\" ascending:YES]]], @\"invalidated\");\n    RLMAssertThrowsWithReason(dictionary[@\"invalidated\"] = @0, @\"invalidated\");\n    uncheckedAssertNil([dictionary valueForKey:@\"self\"]);\n    RLMAssertThrowsWithReason([dictionary setValue:@1 forKey:@\"self\"], @\"invalidated\");\n    RLMAssertThrowsWithReason(({for (__unused id obj in dictionary);}), @\"invalidated\");\n\n    [realm beginWriteTransaction];\n}\n\n- (void)testMutatingMethodsCheckForWriteTransaction {\n    RLMDictionary *dictionary = managed.intObj;\n    [dictionary setObject:@0 forKey:@\"testKey\"];\n    [realm commitWriteTransaction];\n\n    XCTAssertNoThrow([dictionary objectClassName]);\n    XCTAssertNoThrow([dictionary realm]);\n    XCTAssertNoThrow([dictionary isInvalidated]);\n\n    XCTAssertNoThrow([dictionary count]);\n    XCTAssertNoThrow(dictionary[@\"0\"]);\n    XCTAssertNoThrow([dictionary count]);\n\n    XCTAssertNoThrow([dictionary sortedResultsUsingKeyPath:@\"self\" ascending:YES]);\n    XCTAssertNoThrow([dictionary sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"self\" ascending:YES]]]);\n    XCTAssertNoThrow(dictionary[@\"0\"]);\n    XCTAssertNoThrow([dictionary valueForKey:@\"self\"]);\n    XCTAssertNoThrow(({for (__unused id obj in dictionary);}));\n\n    RLMAssertThrowsWithReason([dictionary setObject:@0 forKey:@\"testKey\"], @\"write transaction\");\n    RLMAssertThrowsWithReason([dictionary addEntriesFromDictionary:@{@\"testKey\": @0}], @\"write transaction\");\n    RLMAssertThrowsWithReason([dictionary removeObjectForKey:@\"testKey\"], @\"write transaction\");\n    RLMAssertThrowsWithReason([dictionary removeObjectsForKeys:(id)@[@\"testKey\"]], @\"write transaction\");\n    RLMAssertThrowsWithReason([dictionary removeAllObjects], @\"write transaction\");\n    RLMAssertThrowsWithReason([optManaged.intObj setObject:(id)NSNull.null forKey:@\"testKey\"], @\"write transaction\");\n\n    RLMAssertThrowsWithReason(dictionary[@\"testKey\"] = @0, @\"write transaction\");\n    RLMAssertThrowsWithReason([dictionary setValue:@1 forKey:@\"self\"], @\"write transaction\");\n}\n\n- (void)testDeleteOwningObject {\n    RLMDictionary *dictionary = managed.intObj;\n    uncheckedAssertFalse(dictionary.isInvalidated);\n    [realm deleteObject:managed];\n    uncheckedAssertTrue(dictionary.isInvalidated);\n}\n\n#pragma clang diagnostic ignored \"-Warc-retain-cycles\"\n\n- (void)testNotificationSentInitially {\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMDictionary *dictionary, RLMDictionaryChange *change, NSError *error) {\n        XCTAssertNotNil(dictionary);\n        uncheckedAssertNil(change);\n        uncheckedAssertNil(error);\n        [expectation fulfill];\n    }];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationSentAfterCommit {\n    [realm commitWriteTransaction];\n\n    __block bool first = true;\n    __block bool second = false;\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMDictionary *dictionary, RLMDictionaryChange *change, NSError *error) {\n        XCTAssertNotNil(dictionary);\n        uncheckedAssertNil(error);\n        if (first) {\n            uncheckedAssertNil(change);\n        }\n        else if (!second) {\n            uncheckedAssertEqualObjects(change.insertions, @[@\"testKey\"]);\n        } else {\n            uncheckedAssertEqualObjects(change.deletions, @[@\"testKey\"]);\n        }\n\n        first = false;\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *r = [RLMRealm defaultRealm];\n        [r transactionWithBlock:^{\n            RLMDictionary *dictionary = [(AllPrimitiveDictionaries *)[AllPrimitiveDictionaries allObjectsInRealm:r].firstObject intObj];\n            dictionary[@\"testKey\"] = @0;\n        }];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    second = true;\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *r = [RLMRealm defaultRealm];\n        [r transactionWithBlock:^{\n            RLMDictionary *dictionary = [(AllPrimitiveDictionaries *)[AllPrimitiveDictionaries allObjectsInRealm:r].firstObject intObj];\n            [dictionary removeObjectForKey:@\"testKey\"];\n        }];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationNotSentForUnrelatedChange {\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(__unused RLMDictionary *dictionary, __unused RLMDictionaryChange *change, __unused NSError *error) {\n        // will throw if it's incorrectly called a second time due to the\n        // unrelated write transaction\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmDidChangeNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *r = [RLMRealm defaultRealm];\n            [r transactionWithBlock:^{\n                [AllPrimitiveDictionaries createInRealm:r withValue:@[]];\n            }];\n        }];\n    }];\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationSentOnlyForActualRefresh {\n    [realm commitWriteTransaction];\n\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMDictionary *dictionary, __unused RLMDictionaryChange *change, NSError *error) {\n        XCTAssertNotNil(dictionary);\n        uncheckedAssertNil(error);\n        // will throw if it's called a second time before we create the new\n        // expectation object immediately before manually refreshing\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // Turn off autorefresh, so the background commit should not result in a notification\n    realm.autorefresh = NO;\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmRefreshRequiredNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *r = [RLMRealm defaultRealm];\n            [r transactionWithBlock:^{\n                RLMDictionary *dictionary = [(AllPrimitiveDictionaries *)[AllPrimitiveDictionaries allObjectsInRealm:r].firstObject intObj];\n                dictionary[@\"testKey\"] = @0;\n            }];\n        }];\n    }];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [realm refresh];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n#pragma mark - Queries\n\n#define RLMAssertCount(cls, expectedCount, ...) \\\n    uncheckedAssertEqual(expectedCount, ([cls objectsInRealm:realm where:__VA_ARGS__].count))\n\n- (void)createObject {\n    id boolObj = @{@\"key1\": @NO};\n    id intObj = @{@\"key1\": @2};\n    id stringObj = @{@\"key1\": @\"bar\"};\n    id dateObj = @{@\"key1\": date(1)};\n    id anyBoolObj = @{@\"key1\": @NO};\n    id anyIntObj = @{@\"key1\": @2};\n    id anyFloatObj = @{@\"key1\": @2.2f};\n    id anyDoubleObj = @{@\"key1\": @2.2};\n    id anyStringObj = @{@\"key1\": @\"a\"};\n    id anyDataObj = @{@\"key1\": data(1)};\n    id anyDateObj = @{@\"key1\": date(1)};\n    id anyDecimalObj = @{@\"key1\": decimal128(2)};\n    id anyUUIDObj = @{@\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\")};\n\n    id obj = [AllPrimitiveDictionaries createInRealm:realm withValue: @{\n        @\"boolObj\": boolObj,\n        @\"intObj\": intObj,\n        @\"stringObj\": stringObj,\n        @\"dateObj\": dateObj,\n        @\"anyBoolObj\": anyBoolObj,\n        @\"anyIntObj\": anyIntObj,\n        @\"anyFloatObj\": anyFloatObj,\n        @\"anyDoubleObj\": anyDoubleObj,\n        @\"anyStringObj\": anyStringObj,\n        @\"anyDataObj\": anyDataObj,\n        @\"anyDateObj\": anyDateObj,\n        @\"anyDecimalObj\": anyDecimalObj,\n        @\"anyUUIDObj\": anyUUIDObj,\n    }];\n    [LinkToAllPrimitiveDictionaries createInRealm:realm withValue:@[obj]];\n    obj = [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        @\"boolObj\": boolObj,\n        @\"intObj\": intObj,\n        @\"stringObj\": stringObj,\n        @\"dateObj\": dateObj,\n    }];\n    [LinkToAllOptionalPrimitiveDictionaries createInRealm:realm withValue:@[obj]];\n}\n\n- (void)testQueryBasicOperators {\n    [realm deleteAllObjects];\n\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY boolObj = %@\", @NO);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY boolObj = %@\", @NO);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY intObj = %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY intObj = %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY stringObj = %@\", @\"bar\");\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY stringObj = %@\", @\"bar\");\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY dateObj = %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY dateObj = %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyBoolObj = %@\", @NO);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyIntObj = %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyFloatObj = %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDoubleObj = %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyStringObj = %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDataObj = %@\", data(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDateObj = %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDecimalObj = %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyUUIDObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY boolObj != %@\", @NO);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY boolObj != %@\", @NO);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY intObj != %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY intObj != %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY stringObj != %@\", @\"bar\");\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY stringObj != %@\", @\"bar\");\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY dateObj != %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY dateObj != %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyBoolObj != %@\", @NO);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyIntObj != %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyFloatObj != %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDoubleObj != %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyStringObj != %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDataObj != %@\", data(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDateObj != %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDecimalObj != %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyUUIDObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY intObj > %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY intObj > %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY stringObj > %@\", @\"bar\");\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY stringObj > %@\", @\"bar\");\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY dateObj > %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY dateObj > %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyFloatObj > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDoubleObj > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDecimalObj > %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY intObj >= %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY intObj >= %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY stringObj >= %@\", @\"bar\");\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY stringObj >= %@\", @\"bar\");\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY dateObj >= %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY dateObj >= %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyFloatObj >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDoubleObj >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDecimalObj >= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY intObj < %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY intObj < %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY stringObj < %@\", @\"bar\");\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY stringObj < %@\", @\"bar\");\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY dateObj < %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY dateObj < %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyFloatObj < %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDoubleObj < %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDecimalObj < %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY intObj <= %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY intObj <= %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY stringObj <= %@\", @\"bar\");\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY stringObj <= %@\", @\"bar\");\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY dateObj <= %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY dateObj <= %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyFloatObj <= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDoubleObj <= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDecimalObj <= %@\", decimal128(2));\n\n    [self createObject];\n\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY boolObj = %@\", @YES);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY boolObj = %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY intObj = %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY intObj = %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY stringObj = %@\", @\"foo\");\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY stringObj = %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY dateObj = %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY dateObj = %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyBoolObj = %@\", @YES);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyIntObj = %@\", @3);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyFloatObj = %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDoubleObj = %@\", @3.3);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyStringObj = %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDataObj = %@\", data(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDateObj = %@\", date(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDecimalObj = %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyUUIDObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY boolObj = %@\", @NO);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY boolObj = %@\", @NO);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY intObj = %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY intObj = %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY stringObj = %@\", @\"bar\");\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY stringObj = %@\", @\"bar\");\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY dateObj = %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY dateObj = %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyBoolObj = %@\", @NO);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyIntObj = %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyFloatObj = %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDoubleObj = %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyStringObj = %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDataObj = %@\", data(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDateObj = %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDecimalObj = %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyUUIDObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY boolObj != %@\", @NO);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY boolObj != %@\", @NO);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY intObj != %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY intObj != %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY stringObj != %@\", @\"bar\");\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY stringObj != %@\", @\"bar\");\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY dateObj != %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY dateObj != %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyBoolObj != %@\", @NO);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyIntObj != %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyFloatObj != %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDoubleObj != %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyStringObj != %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDataObj != %@\", data(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDateObj != %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDecimalObj != %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyUUIDObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY boolObj != %@\", @YES);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY boolObj != %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY intObj != %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY intObj != %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY stringObj != %@\", @\"foo\");\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY stringObj != %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY dateObj != %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY dateObj != %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyBoolObj != %@\", @YES);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyIntObj != %@\", @3);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyFloatObj != %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDoubleObj != %@\", @3.3);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyStringObj != %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDataObj != %@\", data(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDateObj != %@\", date(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDecimalObj != %@\", decimal128(3));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyUUIDObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY intObj > %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY intObj > %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY stringObj > %@\", @\"bar\");\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY stringObj > %@\", @\"bar\");\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY dateObj > %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY dateObj > %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyFloatObj > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDoubleObj > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDecimalObj > %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY intObj >= %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY intObj >= %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY stringObj >= %@\", @\"bar\");\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY stringObj >= %@\", @\"bar\");\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY dateObj >= %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY dateObj >= %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyFloatObj >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDoubleObj >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDecimalObj >= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY intObj < %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY intObj < %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY stringObj < %@\", @\"bar\");\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY stringObj < %@\", @\"bar\");\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY dateObj < %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY dateObj < %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyFloatObj < %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDoubleObj < %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDecimalObj < %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY intObj < %@\", @3);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY stringObj < %@\", @\"foo\");\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY dateObj < %@\", date(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyFloatObj < %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDoubleObj < %@\", @3.3);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDecimalObj < %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY intObj < %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY stringObj < %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY dateObj < %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY intObj <= %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY intObj <= %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY stringObj <= %@\", @\"bar\");\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY stringObj <= %@\", @\"bar\");\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY dateObj <= %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY dateObj <= %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyFloatObj <= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDoubleObj <= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDecimalObj <= %@\", decimal128(2));\n\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"ANY boolObj > %@\", @NO]),\n                              @\"Operator '>' not supported for type 'bool'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"ANY boolObj > %@\", @NO]),\n                              @\"Operator '>' not supported for type 'bool'\");\n}\n\n- (void)testQueryBetween {\n    [realm deleteAllObjects];\n\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"ANY boolObj BETWEEN %@\", @[@NO, @YES]]),\n                              @\"Operator 'BETWEEN' not supported for type 'bool'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"ANY boolObj BETWEEN %@\", @[@NO, NSNull.null]]),\n                              @\"Operator 'BETWEEN' not supported for type 'bool'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"ANY stringObj BETWEEN %@\", @[@\"bar\", @\"foo\"]]),\n                              @\"Operator 'BETWEEN' not supported for type 'string'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"ANY stringObj BETWEEN %@\", @[@\"bar\", NSNull.null]]),\n                              @\"Operator 'BETWEEN' not supported for type 'string'\");\n\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY intObj BETWEEN %@\", @[@2, @3]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY intObj BETWEEN %@\", @[@2, NSNull.null]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY dateObj BETWEEN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY dateObj BETWEEN %@\", @[date(1), NSNull.null]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyFloatObj BETWEEN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDoubleObj BETWEEN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDateObj BETWEEN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDecimalObj BETWEEN %@\", @[decimal128(2), decimal128(3)]);\n\n    [self createObject];\n\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY intObj BETWEEN %@\", @[@2, @2]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY dateObj BETWEEN %@\", @[date(1), date(1)]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyFloatObj BETWEEN %@\", @[@2.2f, @2.2f]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDoubleObj BETWEEN %@\", @[@2.2, @2.2]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDateObj BETWEEN %@\", @[date(1), date(1)]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDecimalObj BETWEEN %@\", @[decimal128(2), decimal128(2)]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY intObj BETWEEN %@\", @[@2, @3]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY dateObj BETWEEN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyFloatObj BETWEEN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDoubleObj BETWEEN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDateObj BETWEEN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDecimalObj BETWEEN %@\", @[decimal128(2), decimal128(3)]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY intObj BETWEEN %@\", @[@3, @3]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY dateObj BETWEEN %@\", @[date(2), date(2)]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyFloatObj BETWEEN %@\", @[@3.3f, @3.3f]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDoubleObj BETWEEN %@\", @[@3.3, @3.3]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDateObj BETWEEN %@\", @[date(2), date(2)]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDecimalObj BETWEEN %@\", @[decimal128(3), decimal128(3)]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY intObj BETWEEN %@\", @[@2, @2]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY dateObj BETWEEN %@\", @[date(1), date(1)]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY intObj BETWEEN %@\", @[@2, NSNull.null]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY dateObj BETWEEN %@\", @[date(1), NSNull.null]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY intObj BETWEEN %@\", @[NSNull.null, NSNull.null]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY dateObj BETWEEN %@\", @[NSNull.null, NSNull.null]);\n}\n\n- (void)testQueryIn {\n    [realm deleteAllObjects];\n\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY boolObj IN %@\", @[@NO, @YES]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY boolObj IN %@\", @[@NO, NSNull.null]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY intObj IN %@\", @[@2, @3]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY intObj IN %@\", @[@2, NSNull.null]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY stringObj IN %@\", @[@\"bar\", @\"foo\"]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY stringObj IN %@\", @[@\"bar\", NSNull.null]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY dateObj IN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY dateObj IN %@\", @[date(1), NSNull.null]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyBoolObj IN %@\", @[@NO, @YES]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyIntObj IN %@\", @[@2, @3]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyFloatObj IN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDoubleObj IN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyStringObj IN %@\", @[@\"a\", @\"b\"]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDataObj IN %@\", @[data(1), data(2)]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDateObj IN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDecimalObj IN %@\", @[decimal128(2), decimal128(3)]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyUUIDObj IN %@\", @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n\n    [self createObject];\n\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY boolObj IN %@\", @[@YES]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY boolObj IN %@\", @[NSNull.null]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY intObj IN %@\", @[@3]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY intObj IN %@\", @[NSNull.null]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY stringObj IN %@\", @[@\"foo\"]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY stringObj IN %@\", @[NSNull.null]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY dateObj IN %@\", @[date(2)]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"ANY dateObj IN %@\", @[NSNull.null]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyBoolObj IN %@\", @[@YES]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyIntObj IN %@\", @[@3]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyFloatObj IN %@\", @[@3.3f]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDoubleObj IN %@\", @[@3.3]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyStringObj IN %@\", @[@\"b\"]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDataObj IN %@\", @[data(2)]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDateObj IN %@\", @[date(2)]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyDecimalObj IN %@\", @[decimal128(3)]);\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"ANY anyUUIDObj IN %@\", @[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY boolObj IN %@\", @[@NO, @YES]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY boolObj IN %@\", @[@NO, NSNull.null]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY intObj IN %@\", @[@2, @3]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY intObj IN %@\", @[@2, NSNull.null]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY stringObj IN %@\", @[@\"bar\", @\"foo\"]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY stringObj IN %@\", @[@\"bar\", NSNull.null]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY dateObj IN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"ANY dateObj IN %@\", @[date(1), NSNull.null]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyBoolObj IN %@\", @[@NO, @YES]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyIntObj IN %@\", @[@2, @3]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyFloatObj IN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDoubleObj IN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyStringObj IN %@\", @[@\"a\", @\"b\"]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDataObj IN %@\", @[data(1), data(2)]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDateObj IN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyDecimalObj IN %@\", @[decimal128(2), decimal128(3)]);\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"ANY anyUUIDObj IN %@\", @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n}\n\n- (void)testQueryCount {\n    [realm deleteAllObjects];\n\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n        @\"boolObj\": @{ @\"key1\": @NO, @\"key2\": @YES },\n        @\"intObj\": @{ @\"key1\": @2, @\"key2\": @3 },\n        @\"stringObj\": @{ @\"key1\": @\"bar\", @\"key2\": @\"foo\" },\n        @\"dateObj\": @{ @\"key1\": date(1), @\"key2\": date(2) },\n        @\"anyBoolObj\": @{ @\"key1\": @NO, @\"key2\": @YES },\n        @\"anyIntObj\": @{ @\"key1\": @2, @\"key2\": @3 },\n        @\"anyFloatObj\": @{ @\"key1\": @2.2f, @\"key2\": @3.3f },\n        @\"anyDoubleObj\": @{ @\"key1\": @2.2, @\"key2\": @3.3 },\n        @\"anyStringObj\": @{ @\"key1\": @\"a\", @\"key2\": @\"b\" },\n        @\"anyDataObj\": @{ @\"key1\": data(1), @\"key2\": data(2) },\n        @\"anyDateObj\": @{ @\"key1\": date(1), @\"key2\": date(2) },\n        @\"anyDecimalObj\": @{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) },\n        @\"anyUUIDObj\": @{ @\"key1\": uuid(@\"00000000-0000-0000-0000-000000000000\"), @\"key2\": uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") },\n    }];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        @\"boolObj\": @{ @\"key1\": @NO, @\"key2\": NSNull.null },\n        @\"intObj\": @{ @\"key1\": @2, @\"key2\": NSNull.null },\n        @\"stringObj\": @{ @\"key1\": @\"bar\", @\"key2\": NSNull.null },\n        @\"dateObj\": @{ @\"key1\": date(1), @\"key2\": NSNull.null },\n    }];\n\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"boolObj.@count == %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"boolObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"intObj.@count == %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"intObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"stringObj.@count == %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"stringObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"dateObj.@count == %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"dateObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyBoolObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyIntObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyFloatObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDoubleObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyStringObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDataObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDateObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDecimalObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyUUIDObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"boolObj.@count != %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0U, @\"boolObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"intObj.@count != %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0U, @\"intObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"stringObj.@count != %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0U, @\"stringObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"dateObj.@count != %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0U, @\"dateObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyBoolObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyIntObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyFloatObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDoubleObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyStringObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDataObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDateObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDecimalObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyUUIDObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"boolObj.@count > %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"boolObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"intObj.@count > %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"intObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"stringObj.@count > %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"stringObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"dateObj.@count > %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"dateObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"anyBoolObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"anyIntObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"anyFloatObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"anyDoubleObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"anyStringObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"anyDataObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"anyDateObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"anyDecimalObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"anyUUIDObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"boolObj.@count >= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"boolObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"intObj.@count >= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"intObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"stringObj.@count >= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"stringObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"dateObj.@count >= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"dateObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"anyBoolObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"anyIntObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"anyFloatObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"anyDoubleObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"anyStringObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"anyDataObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"anyDateObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"anyDecimalObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"anyUUIDObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"boolObj.@count < %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"boolObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"intObj.@count < %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"intObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"stringObj.@count < %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"stringObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"dateObj.@count < %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0, @\"dateObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"anyBoolObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"anyIntObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"anyFloatObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"anyDoubleObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"anyStringObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"anyDataObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"anyDateObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"anyDecimalObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0, @\"anyUUIDObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"boolObj.@count <= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"boolObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"intObj.@count <= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"intObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"stringObj.@count <= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"stringObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"dateObj.@count <= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1, @\"dateObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"anyBoolObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"anyIntObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"anyFloatObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"anyDoubleObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"anyStringObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"anyDataObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"anyDateObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"anyDecimalObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 1, @\"anyUUIDObj.@count <= %@\", @(2));\n}\n\n- (void)testQuerySum {\n    [realm deleteAllObjects];\n\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"boolObj.@sum = %@\", @NO]),\n                              @\"Invalid keypath 'boolObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"boolObj.@sum = %@\", @NO]),\n                              @\"Invalid keypath 'boolObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"stringObj.@sum = %@\", @\"bar\"]),\n                              @\"Invalid keypath 'stringObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"stringObj.@sum = %@\", @\"bar\"]),\n                              @\"Invalid keypath 'stringObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"dateObj.@sum = %@\", date(1)]),\n                              @\"Cannot sum or average date properties\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"dateObj.@sum = %@\", date(1)]),\n                              @\"Cannot sum or average date properties\");\n\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"intObj.@sum = %@\", @\"a\"]),\n                              @\"@sum on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"intObj.@sum = %@\", @\"a\"]),\n                              @\"@sum on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"intObj.@sum.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'intObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"intObj.@sum.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'intObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyIntObj.@sum.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyIntObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyFloatObj.@sum.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyFloatObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyDoubleObj.@sum.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyDoubleObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyDecimalObj.@sum.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyDecimalObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"intObj.@sum = %@\", (id)NSNull.null]),\n                              @\"@sum on a property of type int cannot be compared with '<null>'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"intObj.@sum = %@\", (id)NSNull.null]),\n                              @\"@sum on a property of type int cannot be compared with '<null>'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyIntObj.@sum = %@\", (id)NSNull.null]),\n                              @\"@sum on a property of type mixed cannot be compared with '<null>'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyFloatObj.@sum = %@\", (id)NSNull.null]),\n                              @\"@sum on a property of type mixed cannot be compared with '<null>'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyDoubleObj.@sum = %@\", (id)NSNull.null]),\n                              @\"@sum on a property of type mixed cannot be compared with '<null>'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyDecimalObj.@sum = %@\", (id)NSNull.null]),\n                              @\"@sum on a property of type mixed cannot be compared with '<null>'\");\n\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n        @\"intObj\": @{},\n        @\"anyIntObj\": @{},\n        @\"anyFloatObj\": @{},\n        @\"anyDoubleObj\": @{},\n        @\"anyDecimalObj\": @{},\n    }];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        @\"intObj\": @{},\n    }];\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n        @\"intObj\": @{@\"key1\": @2},\n        @\"anyIntObj\": @{@\"key1\": @2},\n        @\"anyFloatObj\": @{@\"key1\": @2.2f},\n        @\"anyDoubleObj\": @{@\"key1\": @2.2},\n        @\"anyDecimalObj\": @{@\"key1\": decimal128(2)},\n    }];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        @\"intObj\": @{@\"key1\": @2},\n    }];\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n        @\"intObj\": @{ @\"key1\": @2, @\"key2\": @3 },\n        @\"anyIntObj\": @{ @\"key1\": @2, @\"key2\": @3 },\n        @\"anyFloatObj\": @{ @\"key1\": @2.2f, @\"key2\": @3.3f },\n        @\"anyDoubleObj\": @{ @\"key1\": @2.2, @\"key2\": @3.3 },\n        @\"anyDecimalObj\": @{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) },\n    }];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        @\"intObj\": @{ @\"key1\": @2, @\"key2\": NSNull.null },\n    }];\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n        @\"intObj\": @{ @\"key1\": @2, @\"key2\": @3 },\n        @\"anyIntObj\": @{ @\"key1\": @2, @\"key2\": @3 },\n        @\"anyFloatObj\": @{ @\"key1\": @2.2f, @\"key2\": @3.3f },\n        @\"anyDoubleObj\": @{ @\"key1\": @2.2, @\"key2\": @3.3 },\n        @\"anyDecimalObj\": @{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) },\n    }];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        @\"intObj\": @{ @\"key1\": @2, @\"key2\": NSNull.null },\n    }];\n\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"intObj.@sum == %@\", @0);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"intObj.@sum == %@\", @0);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyIntObj.@sum == %@\", @0);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyFloatObj.@sum == %@\", @0);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDoubleObj.@sum == %@\", @0);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDecimalObj.@sum == %@\", @0);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"intObj.@sum == %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyIntObj.@sum == %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyFloatObj.@sum == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDoubleObj.@sum == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDecimalObj.@sum == %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 3U, @\"intObj.@sum == %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"intObj.@sum != %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyIntObj.@sum != %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyFloatObj.@sum != %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyDoubleObj.@sum != %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyDecimalObj.@sum != %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"intObj.@sum != %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"intObj.@sum >= %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 3U, @\"intObj.@sum >= %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyIntObj.@sum >= %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyFloatObj.@sum >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyDoubleObj.@sum >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyDecimalObj.@sum >= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"intObj.@sum > %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyIntObj.@sum > %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyFloatObj.@sum > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyDoubleObj.@sum > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyDecimalObj.@sum > %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0U, @\"intObj.@sum > %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"intObj.@sum < %@\", @3);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyIntObj.@sum < %@\", @3);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyFloatObj.@sum < %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyDoubleObj.@sum < %@\", @3.3);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyDecimalObj.@sum < %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"intObj.@sum < %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"intObj.@sum <= %@\", @3);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyIntObj.@sum <= %@\", @3);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyFloatObj.@sum <= %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyDoubleObj.@sum <= %@\", @3.3);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyDecimalObj.@sum <= %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 4U, @\"intObj.@sum <= %@\", @2);\n}\n\n- (void)testQueryAverage {\n    [realm deleteAllObjects];\n\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"boolObj.@avg = %@\", @NO]),\n                              @\"Invalid keypath 'boolObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"boolObj.@avg = %@\", @NO]),\n                              @\"Invalid keypath 'boolObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"stringObj.@avg = %@\", @\"bar\"]),\n                              @\"Invalid keypath 'stringObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"stringObj.@avg = %@\", @\"bar\"]),\n                              @\"Invalid keypath 'stringObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"dateObj.@avg = %@\", date(1)]),\n                              @\"Cannot sum or average date properties\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"dateObj.@avg = %@\", date(1)]),\n                              @\"Cannot sum or average date properties\");\n\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"intObj.@avg = %@\", @\"a\"]),\n                              @\"@avg on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"intObj.@avg = %@\", @\"a\"]),\n                              @\"@avg on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"intObj.@avg.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'intObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"intObj.@avg.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'intObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyIntObj.@avg.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyIntObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyFloatObj.@avg.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyFloatObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyDoubleObj.@avg.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyDoubleObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyDecimalObj.@avg.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyDecimalObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n        @\"intObj\": @{},\n        @\"anyIntObj\": @{},\n        @\"anyFloatObj\": @{},\n        @\"anyDoubleObj\": @{},\n        @\"anyDecimalObj\": @{},\n    }];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        @\"intObj\": @{},\n    }];\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n        @\"intObj\": @{@\"key1\": @2},\n        @\"anyIntObj\": @{@\"key1\": @2},\n        @\"anyFloatObj\": @{@\"key1\": @2.2f},\n        @\"anyDoubleObj\": @{@\"key1\": @2.2},\n        @\"anyDecimalObj\": @{@\"key1\": decimal128(2)},\n    }];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        @\"intObj\": @{@\"key1\": @2},\n    }];\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n        @\"intObj\": @{ @\"key1\": @2, @\"key2\": @3 },\n        @\"anyIntObj\": @{ @\"key1\": @2, @\"key2\": @3 },\n        @\"anyFloatObj\": @{ @\"key1\": @2.2f, @\"key2\": @3.3f },\n        @\"anyDoubleObj\": @{ @\"key1\": @2.2, @\"key2\": @3.3 },\n        @\"anyDecimalObj\": @{ @\"key1\": decimal128(2), @\"key2\": decimal128(3) },\n    }];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        @\"intObj\": @{ @\"key1\": @2, @\"key2\": NSNull.null },\n    }];\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n        @\"intObj\": @{@\"key1\": @3},\n        @\"anyIntObj\": @{@\"key1\": @3},\n        @\"anyFloatObj\": @{@\"key1\": @3.3f},\n        @\"anyDoubleObj\": @{@\"key1\": @3.3},\n        @\"anyDecimalObj\": @{@\"key1\": decimal128(3)},\n    }];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        @\"intObj\": @{@\"key1\": @2},\n    }];\n\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"intObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"intObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyIntObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyFloatObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDoubleObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDecimalObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"intObj.@avg == %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyIntObj.@avg == %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyFloatObj.@avg == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDoubleObj.@avg == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDecimalObj.@avg == %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 3U, @\"intObj.@avg == %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"intObj.@avg != %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyIntObj.@avg != %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyFloatObj.@avg != %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyDoubleObj.@avg != %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyDecimalObj.@avg != %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"intObj.@avg != %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"intObj.@avg >= %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 3U, @\"intObj.@avg >= %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyIntObj.@avg >= %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyFloatObj.@avg >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyDoubleObj.@avg >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyDecimalObj.@avg >= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"intObj.@avg > %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyIntObj.@avg > %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyFloatObj.@avg > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyDoubleObj.@avg > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyDecimalObj.@avg > %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0U, @\"intObj.@avg > %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"intObj.@avg < %@\", @3);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyIntObj.@avg < %@\", @3);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyFloatObj.@avg < %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyDoubleObj.@avg < %@\", @3.3);\n    RLMAssertCount(AllPrimitiveDictionaries, 2U, @\"anyDecimalObj.@avg < %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0U, @\"intObj.@avg < %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"intObj.@avg <= %@\", @3);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyIntObj.@avg <= %@\", @3);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyFloatObj.@avg <= %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyDoubleObj.@avg <= %@\", @3.3);\n    RLMAssertCount(AllPrimitiveDictionaries, 3U, @\"anyDecimalObj.@avg <= %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"intObj.@avg <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 3U, @\"intObj.@avg <= %@\", @2);\n}\n\n- (void)testQueryMin {\n    [realm deleteAllObjects];\n\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"boolObj.@min = %@\", @NO]),\n                              @\"Invalid keypath 'boolObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"boolObj.@min = %@\", @NO]),\n                              @\"Invalid keypath 'boolObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"stringObj.@min = %@\", @\"bar\"]),\n                              @\"Invalid keypath 'stringObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"stringObj.@min = %@\", @\"bar\"]),\n                              @\"Invalid keypath 'stringObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"intObj.@min = %@\", @\"a\"]),\n                              @\"@min on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"intObj.@min = %@\", @\"a\"]),\n                              @\"@min on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"dateObj.@min = %@\", @\"a\"]),\n                              @\"@min on a property of type date cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"dateObj.@min = %@\", @\"a\"]),\n                              @\"@min on a property of type date cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"intObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'intObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"intObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'intObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"dateObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'dateObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"dateObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'dateObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyFloatObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyFloatObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyDoubleObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyDoubleObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyDateObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyDateObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyDecimalObj.@min.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyDecimalObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n\n    // No objects, so count is zero\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyFloatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDoubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDecimalObj.@min == %@\", decimal128(2));\n\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{}];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{}];\n\n    // Only empty dictionarys, so count is zero\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyFloatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDoubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDecimalObj.@min == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"intObj.@min == %@\", @3);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"dateObj.@min == %@\", date(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyFloatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDoubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDateObj.@min == %@\", date(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDecimalObj.@min == %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"intObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"dateObj.@min == %@\", NSNull.null);\n\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"intObj.@min == nil\");\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"intObj.@min == nil\");\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"dateObj.@min == nil\");\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"dateObj.@min == nil\");\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyFloatObj.@min == nil\");\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDoubleObj.@min == nil\");\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDateObj.@min == nil\");\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDecimalObj.@min == nil\");\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"intObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"intObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"dateObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"dateObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyFloatObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDoubleObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDateObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDecimalObj.@min == %@\", NSNull.null);\n\n    [self createObject];\n\n    // One object where v0 is min and zero with v1\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyFloatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDoubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDecimalObj.@min == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"intObj.@min == %@\", @3);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"dateObj.@min == %@\", date(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyFloatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDoubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDateObj.@min == %@\", date(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDecimalObj.@min == %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"intObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"dateObj.@min == %@\", NSNull.null);\n}\n\n- (void)testQueryMax {\n    [realm deleteAllObjects];\n\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"boolObj.@max = %@\", @NO]),\n                              @\"Invalid keypath 'boolObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"boolObj.@max = %@\", @NO]),\n                              @\"Invalid keypath 'boolObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"stringObj.@max = %@\", @\"bar\"]),\n                              @\"Invalid keypath 'stringObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"stringObj.@max = %@\", @\"bar\"]),\n                              @\"Invalid keypath 'stringObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"intObj.@max = %@\", @\"a\"]),\n                              @\"@max on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"intObj.@max = %@\", @\"a\"]),\n                              @\"@max on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"dateObj.@max = %@\", @\"a\"]),\n                              @\"@max on a property of type date cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"dateObj.@max = %@\", @\"a\"]),\n                              @\"@max on a property of type date cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"intObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'intObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"intObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'intObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"dateObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'dateObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"dateObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'dateObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyFloatObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyFloatObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyDoubleObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyDoubleObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyDateObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyDateObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveDictionaries objectsInRealm:realm where:@\"anyDecimalObj.@max.prop = %@\", @\"a\"]),\n                              @\"Invalid keypath 'anyDecimalObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n\n    // No objects, so count is zero\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyFloatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDoubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDecimalObj.@max == %@\", decimal128(2));\n\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{}];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{}];\n\n    // Only empty dictionarys, so count is zero.\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyFloatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDoubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDecimalObj.@max == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"intObj.@max == %@\", @3);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"dateObj.@max == %@\", date(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyFloatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDoubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDateObj.@max == %@\", date(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDecimalObj.@max == %@\", decimal128(3));\n\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 0U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"intObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"dateObj.@max == %@\", NSNull.null);\n\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"intObj.@max == nil\");\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"intObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"dateObj.@max == nil\");\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"dateObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyFloatObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDoubleObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDateObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDecimalObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"intObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"intObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"dateObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"dateObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyFloatObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDoubleObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDateObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDecimalObj.@max == %@\", NSNull.null);\n\n    [self createObject];\n\n    // One object where v0 is min and zero with v1\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyFloatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDoubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveDictionaries, 1U, @\"anyDecimalObj.@max == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"intObj.@max == %@\", @3);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"dateObj.@max == %@\", date(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyFloatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDoubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDateObj.@max == %@\", date(2));\n    RLMAssertCount(AllPrimitiveDictionaries, 0U, @\"anyDecimalObj.@max == %@\", decimal128(3));\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"intObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveDictionaries, 1U, @\"dateObj.@max == %@\", NSNull.null);\n}\n\n- (void)testQueryBasicOperatorsOverLink {\n    [realm deleteAllObjects];\n\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.boolObj = %@\", @NO);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.boolObj = %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.intObj = %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.intObj = %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.stringObj = %@\", @\"bar\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.stringObj = %@\", @\"bar\");\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.dateObj = %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.dateObj = %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyBoolObj = %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyIntObj = %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyFloatObj = %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDoubleObj = %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyStringObj = %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDataObj = %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDateObj = %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDecimalObj = %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyUUIDObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.boolObj != %@\", @NO);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.boolObj != %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.intObj != %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.intObj != %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.stringObj != %@\", @\"bar\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.stringObj != %@\", @\"bar\");\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.dateObj != %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.dateObj != %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyBoolObj != %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyIntObj != %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyFloatObj != %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDoubleObj != %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyStringObj != %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDataObj != %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDateObj != %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDecimalObj != %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyUUIDObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.intObj > %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.intObj > %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.stringObj > %@\", @\"bar\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.stringObj > %@\", @\"bar\");\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.dateObj > %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.dateObj > %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyFloatObj > %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDoubleObj > %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDecimalObj > %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.intObj >= %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.intObj >= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.stringObj >= %@\", @\"bar\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.stringObj >= %@\", @\"bar\");\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.dateObj >= %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.dateObj >= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyFloatObj >= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDoubleObj >= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDecimalObj >= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.intObj < %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.intObj < %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.stringObj < %@\", @\"bar\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.stringObj < %@\", @\"bar\");\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.dateObj < %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.dateObj < %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyFloatObj < %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDoubleObj < %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDecimalObj < %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.intObj <= %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.intObj <= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.stringObj <= %@\", @\"bar\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.stringObj <= %@\", @\"bar\");\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.dateObj <= %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.dateObj <= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyFloatObj <= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDoubleObj <= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDecimalObj <= %@\", decimal128(2));\n\n    [self createObject];\n\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.boolObj = %@\", @YES);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.boolObj = %@\", NSNull.null);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.intObj = %@\", @3);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.intObj = %@\", NSNull.null);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.stringObj = %@\", @\"foo\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.stringObj = %@\", NSNull.null);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.dateObj = %@\", date(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.dateObj = %@\", NSNull.null);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyBoolObj = %@\", @YES);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyIntObj = %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyFloatObj = %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDoubleObj = %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyStringObj = %@\", @\"b\");\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDataObj = %@\", data(2));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDateObj = %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDecimalObj = %@\", decimal128(3));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyUUIDObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.boolObj = %@\", @NO);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 1, @\"ANY link.boolObj = %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.intObj = %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 1, @\"ANY link.intObj = %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.stringObj = %@\", @\"bar\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 1, @\"ANY link.stringObj = %@\", @\"bar\");\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.dateObj = %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 1, @\"ANY link.dateObj = %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyBoolObj = %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyIntObj = %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyFloatObj = %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyDoubleObj = %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyStringObj = %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyDataObj = %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyDateObj = %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyDecimalObj = %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyUUIDObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.boolObj != %@\", @NO);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.boolObj != %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.intObj != %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.intObj != %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.stringObj != %@\", @\"bar\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.stringObj != %@\", @\"bar\");\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.dateObj != %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.dateObj != %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyBoolObj != %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyIntObj != %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyFloatObj != %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDoubleObj != %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyStringObj != %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDataObj != %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDateObj != %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDecimalObj != %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyUUIDObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.boolObj != %@\", @YES);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 1, @\"ANY link.boolObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.intObj != %@\", @3);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 1, @\"ANY link.intObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.stringObj != %@\", @\"foo\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 1, @\"ANY link.stringObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.dateObj != %@\", date(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 1, @\"ANY link.dateObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyBoolObj != %@\", @YES);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyIntObj != %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyFloatObj != %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyDoubleObj != %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyStringObj != %@\", @\"b\");\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyDataObj != %@\", data(2));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyDateObj != %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyDecimalObj != %@\", decimal128(3));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyUUIDObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.intObj > %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.intObj > %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.stringObj > %@\", @\"bar\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.stringObj > %@\", @\"bar\");\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.dateObj > %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.dateObj > %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyFloatObj > %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDoubleObj > %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDecimalObj > %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.intObj >= %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 1, @\"ANY link.intObj >= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.stringObj >= %@\", @\"bar\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 1, @\"ANY link.stringObj >= %@\", @\"bar\");\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.dateObj >= %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 1, @\"ANY link.dateObj >= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyFloatObj >= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyDoubleObj >= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyDecimalObj >= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.intObj < %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.intObj < %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.stringObj < %@\", @\"bar\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.stringObj < %@\", @\"bar\");\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.dateObj < %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.dateObj < %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyFloatObj < %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDoubleObj < %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 0, @\"ANY link.anyDecimalObj < %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.intObj < %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.stringObj < %@\", @\"foo\");\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.dateObj < %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyFloatObj < %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyDoubleObj < %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyDecimalObj < %@\", decimal128(3));\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.intObj < %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.stringObj < %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 0, @\"ANY link.dateObj < %@\", NSNull.null);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.intObj <= %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 1, @\"ANY link.intObj <= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.stringObj <= %@\", @\"bar\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 1, @\"ANY link.stringObj <= %@\", @\"bar\");\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.dateObj <= %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, 1, @\"ANY link.dateObj <= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyFloatObj <= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyDoubleObj <= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveDictionaries, 1, @\"ANY link.anyDecimalObj <= %@\", decimal128(2));\n\n    RLMAssertThrowsWithReason(([LinkToAllPrimitiveDictionaries objectsInRealm:realm where:@\"ANY link.boolObj > %@\", @NO]),\n                              @\"Operator '>' not supported for type 'bool'\");\n    RLMAssertThrowsWithReason(([LinkToAllOptionalPrimitiveDictionaries objectsInRealm:realm where:@\"ANY link.boolObj > %@\", @NO]),\n                              @\"Operator '>' not supported for type 'bool'\");\n}\n\n- (void)testSubstringQueries {\n    [realm deleteAllObjects];\n    NSArray *values = @[\n        @\"\",\n\n        @\"á\", @\"ó\", @\"ú\",\n\n        @\"áá\", @\"áó\", @\"áú\",\n        @\"óá\", @\"óó\", @\"óú\",\n        @\"úá\", @\"úó\", @\"úú\",\n\n        @\"ááá\", @\"ááó\", @\"ááú\", @\"áóá\", @\"áóó\", @\"áóú\", @\"áúá\", @\"áúó\", @\"áúú\",\n        @\"óáá\", @\"óáó\", @\"óáú\", @\"óóá\", @\"óóó\", @\"óóú\", @\"óúá\", @\"óúó\", @\"óúú\",\n        @\"úáá\", @\"úáó\", @\"úáú\", @\"úóá\", @\"úóó\", @\"úóú\", @\"úúá\", @\"úúó\", @\"úúú\",\n    ];\n\n    void (^create)(NSString *) = ^(NSString *value) {\n        id obj = [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n            @\"stringObj\": @{@\"key\": value},\n            @\"dataObj\": @{@\"key\": [value dataUsingEncoding:NSUTF8StringEncoding]}\n        }];\n        [LinkToAllPrimitiveDictionaries createInRealm:realm withValue:@[obj]];\n        obj = [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n            @\"stringObj\": @{@\"key\": value},\n            @\"dataObj\": @{@\"key\": [value dataUsingEncoding:NSUTF8StringEncoding]}\n        }];\n        [LinkToAllOptionalPrimitiveDictionaries createInRealm:realm withValue:@[obj]];\n    };\n\n    for (NSString *value in values) {\n        create(value);\n        create(value.uppercaseString);\n        create([value stringByApplyingTransform:NSStringTransformStripDiacritics reverse:NO]);\n        create([value.uppercaseString stringByApplyingTransform:NSStringTransformStripDiacritics reverse:NO]);\n    }\n\n    void (^test)(NSString *, id, NSUInteger) = ^(NSString *operator, NSString *value, NSUInteger count) {\n        NSData *data = [value dataUsingEncoding:NSUTF8StringEncoding];\n\n        NSString *query = [NSString stringWithFormat:@\"ANY stringObj %@ %%@\", operator];\n        RLMAssertCount(AllPrimitiveDictionaries, count, query, value);\n        RLMAssertCount(AllOptionalPrimitiveDictionaries, count, query, value);\n        RLMAssertCount(AllPrimitiveDictionaries, count, query, value);\n        query = [NSString stringWithFormat:@\"ANY link.stringObj %@ %%@\", operator];\n        RLMAssertCount(LinkToAllPrimitiveDictionaries, count, query, value);\n        RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, count, query, value);\n        RLMAssertCount(LinkToAllPrimitiveDictionaries, count, query, value);\n\n        query = [NSString stringWithFormat:@\"ANY dataObj %@ %%@\", operator];\n        RLMAssertCount(AllPrimitiveDictionaries, count, query, data);\n        RLMAssertCount(AllOptionalPrimitiveDictionaries, count, query, data);\n        RLMAssertCount(AllPrimitiveDictionaries, count, query, data);\n        query = [NSString stringWithFormat:@\"ANY link.dataObj %@ %%@\", operator];\n        RLMAssertCount(LinkToAllPrimitiveDictionaries, count, query, data);\n        RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, count, query, data);\n        RLMAssertCount(LinkToAllPrimitiveDictionaries, count, query, data);\n    };\n    void (^testNull)(NSString *, NSUInteger) = ^(NSString *operator, NSUInteger count) {\n        NSString *query = [NSString stringWithFormat:@\"ANY stringObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([AllPrimitiveDictionaries objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'stringObj' of type 'string'\");\n        RLMAssertCount(AllOptionalPrimitiveDictionaries, count, query, NSNull.null);\n        query = [NSString stringWithFormat:@\"ANY link.stringObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([LinkToAllPrimitiveDictionaries objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'stringObj' of type 'string'\");\n        RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, count, query, NSNull.null);\n\n        query = [NSString stringWithFormat:@\"ANY dataObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([AllPrimitiveDictionaries objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'dataObj' of type 'data'\");\n        RLMAssertCount(AllOptionalPrimitiveDictionaries, count, query, NSNull.null);\n\n        query = [NSString stringWithFormat:@\"ANY link.dataObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([LinkToAllPrimitiveDictionaries objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'dataObj' of type 'data'\");\n        RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, count, query, NSNull.null);\n    };\n\n    testNull(@\"==\", 0);\n    test(@\"==\", @\"\", 4);\n    test(@\"==\", @\"a\", 1);\n    test(@\"==\", @\"á\", 1);\n    test(@\"==[c]\", @\"a\", 2);\n    test(@\"==[c]\", @\"á\", 2);\n    test(@\"==\", @\"A\", 1);\n    test(@\"==\", @\"Á\", 1);\n    test(@\"==[c]\", @\"A\", 2);\n    test(@\"==[c]\", @\"Á\", 2);\n    test(@\"==[d]\", @\"a\", 2);\n    test(@\"==[d]\", @\"á\", 2);\n    test(@\"==[cd]\", @\"a\", 4);\n    test(@\"==[cd]\", @\"á\", 4);\n    test(@\"==[d]\", @\"A\", 2);\n    test(@\"==[d]\", @\"Á\", 2);\n    test(@\"==[cd]\", @\"A\", 4);\n    test(@\"==[cd]\", @\"Á\", 4);\n\n    testNull(@\"!=\", 160);\n    test(@\"!=\", @\"\", 156);\n    test(@\"!=\", @\"a\", 159);\n    test(@\"!=\", @\"á\", 159);\n    test(@\"!=[c]\", @\"a\", 158);\n    test(@\"!=[c]\", @\"á\", 158);\n    test(@\"!=\", @\"A\", 159);\n    test(@\"!=\", @\"Á\", 159);\n    test(@\"!=[c]\", @\"A\", 158);\n    test(@\"!=[c]\", @\"Á\", 158);\n    test(@\"!=[d]\", @\"a\", 158);\n    test(@\"!=[d]\", @\"á\", 158);\n    test(@\"!=[cd]\", @\"a\", 156);\n    test(@\"!=[cd]\", @\"á\", 156);\n    test(@\"!=[d]\", @\"A\", 158);\n    test(@\"!=[d]\", @\"Á\", 158);\n    test(@\"!=[cd]\", @\"A\", 156);\n    test(@\"!=[cd]\", @\"Á\", 156);\n\n    testNull(@\"CONTAINS\", 0);\n    testNull(@\"CONTAINS[c]\", 0);\n    testNull(@\"CONTAINS[d]\", 0);\n    testNull(@\"CONTAINS[cd]\", 0);\n    test(@\"CONTAINS\", @\"a\", 25);\n    test(@\"CONTAINS\", @\"á\", 25);\n    test(@\"CONTAINS[c]\", @\"a\", 50);\n    test(@\"CONTAINS[c]\", @\"á\", 50);\n    test(@\"CONTAINS\", @\"A\", 25);\n    test(@\"CONTAINS\", @\"Á\", 25);\n    test(@\"CONTAINS[c]\", @\"A\", 50);\n    test(@\"CONTAINS[c]\", @\"Á\", 50);\n    test(@\"CONTAINS[d]\", @\"a\", 50);\n    test(@\"CONTAINS[d]\", @\"á\", 50);\n    test(@\"CONTAINS[cd]\", @\"a\", 100);\n    test(@\"CONTAINS[cd]\", @\"á\", 100);\n    test(@\"CONTAINS[d]\", @\"A\", 50);\n    test(@\"CONTAINS[d]\", @\"Á\", 50);\n    test(@\"CONTAINS[cd]\", @\"A\", 100);\n    test(@\"CONTAINS[cd]\", @\"Á\", 100);\n\n    test(@\"BEGINSWITH\", @\"a\", 13);\n    test(@\"BEGINSWITH\", @\"á\", 13);\n    test(@\"BEGINSWITH[c]\", @\"a\", 26);\n    test(@\"BEGINSWITH[c]\", @\"á\", 26);\n    test(@\"BEGINSWITH\", @\"A\", 13);\n    test(@\"BEGINSWITH\", @\"Á\", 13);\n    test(@\"BEGINSWITH[c]\", @\"A\", 26);\n    test(@\"BEGINSWITH[c]\", @\"Á\", 26);\n    test(@\"BEGINSWITH[d]\", @\"a\", 26);\n    test(@\"BEGINSWITH[d]\", @\"á\", 26);\n    test(@\"BEGINSWITH[cd]\", @\"a\", 52);\n    test(@\"BEGINSWITH[cd]\", @\"á\", 52);\n    test(@\"BEGINSWITH[d]\", @\"A\", 26);\n    test(@\"BEGINSWITH[d]\", @\"Á\", 26);\n    test(@\"BEGINSWITH[cd]\", @\"A\", 52);\n    test(@\"BEGINSWITH[cd]\", @\"Á\", 52);\n\n    test(@\"ENDSWITH\", @\"a\", 13);\n    test(@\"ENDSWITH\", @\"á\", 13);\n    test(@\"ENDSWITH[c]\", @\"a\", 26);\n    test(@\"ENDSWITH[c]\", @\"á\", 26);\n    test(@\"ENDSWITH\", @\"A\", 13);\n    test(@\"ENDSWITH\", @\"Á\", 13);\n    test(@\"ENDSWITH[c]\", @\"A\", 26);\n    test(@\"ENDSWITH[c]\", @\"Á\", 26);\n    test(@\"ENDSWITH[d]\", @\"a\", 26);\n    test(@\"ENDSWITH[d]\", @\"á\", 26);\n    test(@\"ENDSWITH[cd]\", @\"a\", 52);\n    test(@\"ENDSWITH[cd]\", @\"á\", 52);\n    test(@\"ENDSWITH[d]\", @\"A\", 26);\n    test(@\"ENDSWITH[d]\", @\"Á\", 26);\n    test(@\"ENDSWITH[cd]\", @\"A\", 52);\n    test(@\"ENDSWITH[cd]\", @\"Á\", 52);\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/PrimitiveDictionaryPropertyTests.tpl.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\nstatic NSDate *date(int i) {\n    return [NSDate dateWithTimeIntervalSince1970:i];\n}\nstatic NSData *data(int i) {\n    return [NSData dataWithBytesNoCopy:calloc(i, 1) length:i freeWhenDone:YES];\n}\nstatic RLMDecimal128 *decimal128(int i) {\n    return [RLMDecimal128 decimalWithNumber:@(i)];\n}\nstatic NSMutableArray *objectIds;\nstatic RLMObjectId *objectId(NSUInteger i) {\n    if (!objectIds) {\n        objectIds = [NSMutableArray new];\n    }\n    while (i >= objectIds.count) {\n        [objectIds addObject:RLMObjectId.objectId];\n    }\n    return objectIds[i];\n}\nstatic NSUUID *uuid(NSString *uuidString) {\n    return [[NSUUID alloc] initWithUUIDString:uuidString];\n}\nstatic void count(NSArray *values, double *sum, NSUInteger *count) {\n    for (id value in values) {\n        if (value != NSNull.null) {\n            ++*count;\n            *sum += [value doubleValue];\n        }\n    }\n}\nstatic double sum(NSDictionary *dictionary) {\n    NSArray *values = dictionary.allValues;\n    double sum = 0;\n    NSUInteger c = 0;\n    count(values, &sum, &c);\n    return sum;\n}\nstatic double average(NSDictionary *dictionary) {\n    NSArray *values = dictionary.allValues;\n    double sum = 0;\n    NSUInteger c = 0;\n    count(values, &sum, &c);\n    return sum / c;\n}\n\n@interface LinkToAllPrimitiveDictionaries : RLMObject\n@property (nonatomic) AllPrimitiveDictionaries *link;\n@end\n@implementation LinkToAllPrimitiveDictionaries\n@end\n\n@interface LinkToAllOptionalPrimitiveDictionaries : RLMObject\n@property (nonatomic) AllOptionalPrimitiveDictionaries *link;\n@end\n@implementation LinkToAllOptionalPrimitiveDictionaries\n@end\n\n@interface PrimitiveDictionaryPropertyTests : RLMTestCase\n@end\n\n@implementation PrimitiveDictionaryPropertyTests {\n    AllPrimitiveDictionaries *unmanaged;\n    AllPrimitiveDictionaries *managed;\n    AllOptionalPrimitiveDictionaries *optUnmanaged;\n    AllOptionalPrimitiveDictionaries *optManaged;\n    RLMRealm *realm;\n    NSArray<RLMDictionary *> *allDictionaries;\n}\n\n- (void)setUp {\n    unmanaged = [[AllPrimitiveDictionaries alloc] init];\n    optUnmanaged = [[AllOptionalPrimitiveDictionaries alloc] init];\n    realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    managed = [AllPrimitiveDictionaries createInRealm:realm withValue:@[]];\n    optManaged = [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@[]];\n    allDictionaries = @[\n        $dictionary,\n    ];\n}\n\n- (void)tearDown {\n    if (realm.inWriteTransaction) {\n        [realm cancelWriteTransaction];\n    }\n}\n\n- (void)addObjects {\n    [$dictionary addEntriesFromDictionary:$values];\n}\n\n- (void)testCount {\n    uncheckedAssertEqual(unmanaged.intObj.count, 0U);\n    unmanaged.intObj[@\"testVal\"] = @1;\n    uncheckedAssertEqual(unmanaged.intObj.count, 1U);\n}\n\n- (void)testType {\n    uncheckedAssertEqual(unmanaged.boolObj.type, RLMPropertyTypeBool);\n    uncheckedAssertEqual(unmanaged.intObj.type, RLMPropertyTypeInt);\n    uncheckedAssertEqual(unmanaged.floatObj.type, RLMPropertyTypeFloat);\n    uncheckedAssertEqual(unmanaged.doubleObj.type, RLMPropertyTypeDouble);\n    uncheckedAssertEqual(unmanaged.stringObj.type, RLMPropertyTypeString);\n    uncheckedAssertEqual(unmanaged.dataObj.type, RLMPropertyTypeData);\n    uncheckedAssertEqual(unmanaged.dateObj.type, RLMPropertyTypeDate);\n    uncheckedAssertEqual(optUnmanaged.boolObj.type, RLMPropertyTypeBool);\n    uncheckedAssertEqual(optUnmanaged.intObj.type, RLMPropertyTypeInt);\n    uncheckedAssertEqual(optUnmanaged.floatObj.type, RLMPropertyTypeFloat);\n    uncheckedAssertEqual(optUnmanaged.doubleObj.type, RLMPropertyTypeDouble);\n    uncheckedAssertEqual(optUnmanaged.stringObj.type, RLMPropertyTypeString);\n    uncheckedAssertEqual(optUnmanaged.dataObj.type, RLMPropertyTypeData);\n    uncheckedAssertEqual(optUnmanaged.dateObj.type, RLMPropertyTypeDate);\n}\n\n- (void)testOptional {\n    uncheckedAssertFalse(unmanaged.boolObj.optional);\n    uncheckedAssertFalse(unmanaged.intObj.optional);\n    uncheckedAssertFalse(unmanaged.floatObj.optional);\n    uncheckedAssertFalse(unmanaged.doubleObj.optional);\n    uncheckedAssertFalse(unmanaged.stringObj.optional);\n    uncheckedAssertFalse(unmanaged.dataObj.optional);\n    uncheckedAssertFalse(unmanaged.dateObj.optional);\n    uncheckedAssertTrue(optUnmanaged.boolObj.optional);\n    uncheckedAssertTrue(optUnmanaged.intObj.optional);\n    uncheckedAssertTrue(optUnmanaged.floatObj.optional);\n    uncheckedAssertTrue(optUnmanaged.doubleObj.optional);\n    uncheckedAssertTrue(optUnmanaged.stringObj.optional);\n    uncheckedAssertTrue(optUnmanaged.dataObj.optional);\n    uncheckedAssertTrue(optUnmanaged.dateObj.optional);\n}\n\n- (void)testObjectClassName {\n    uncheckedAssertNil(unmanaged.boolObj.objectClassName);\n    uncheckedAssertNil(unmanaged.intObj.objectClassName);\n    uncheckedAssertNil(unmanaged.floatObj.objectClassName);\n    uncheckedAssertNil(unmanaged.doubleObj.objectClassName);\n    uncheckedAssertNil(unmanaged.stringObj.objectClassName);\n    uncheckedAssertNil(unmanaged.dataObj.objectClassName);\n    uncheckedAssertNil(unmanaged.dateObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.boolObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.intObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.floatObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.doubleObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.stringObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.dataObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.dateObj.objectClassName);\n}\n\n- (void)testRealm {\n    uncheckedAssertNil(unmanaged.boolObj.realm);\n    uncheckedAssertNil(unmanaged.intObj.realm);\n    uncheckedAssertNil(unmanaged.floatObj.realm);\n    uncheckedAssertNil(unmanaged.doubleObj.realm);\n    uncheckedAssertNil(unmanaged.stringObj.realm);\n    uncheckedAssertNil(unmanaged.dataObj.realm);\n    uncheckedAssertNil(unmanaged.dateObj.realm);\n    uncheckedAssertNil(optUnmanaged.boolObj.realm);\n    uncheckedAssertNil(optUnmanaged.intObj.realm);\n    uncheckedAssertNil(optUnmanaged.floatObj.realm);\n    uncheckedAssertNil(optUnmanaged.doubleObj.realm);\n    uncheckedAssertNil(optUnmanaged.stringObj.realm);\n    uncheckedAssertNil(optUnmanaged.dataObj.realm);\n    uncheckedAssertNil(optUnmanaged.dateObj.realm);\n}\n\n- (void)testInvalidated {\n    RLMDictionary *dictionary;\n    @autoreleasepool {\n        AllPrimitiveDictionaries *obj = [[AllPrimitiveDictionaries alloc] init];\n        dictionary = obj.intObj;\n        uncheckedAssertFalse(dictionary.invalidated);\n    }\n    uncheckedAssertFalse(dictionary.invalidated);\n}\n\n- (void)testDeleteObjectsInRealm {\n    %unman RLMAssertThrowsWithReason([realm deleteObjects:$dictionary], @\"Cannot delete objects from RLMDictionary\");\n    %man RLMAssertThrowsWithReason([realm deleteObjects:$dictionary], @\"Cannot delete objects from \u0010RLMManagedDictionary<RLMString, $type>: only RLMObjects can be deleted.\");\n}\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wnonnull\"\n\n- (void)testSetObject {\n    // Managed non-optional\n    %man %r uncheckedAssertNil($dictionary[$firstKey]);\n    %man %r XCTAssertNoThrow($dictionary[$firstKey] = $firstValue);\n    %man %r uncheckedAssertEqualObjects($dictionary[$firstKey], $firstValue);\n    %noany %man %r RLMAssertThrowsWithReason($dictionary[$firstKey] = (id)NSNull.null, @\"Invalid value '<null>' of type 'NSNull' for expected type '$type'.\");\n    %man %r XCTAssertNoThrow($dictionary[$firstKey] = nil);\n    %man %r uncheckedAssertNil($dictionary[$firstKey]);\n\n    // Managed optional\n    %man %o uncheckedAssertNil($dictionary[$firstKey]);\n    %man %o XCTAssertNoThrow($dictionary[$firstKey] = $firstValue);\n    %man %o uncheckedAssertEqualObjects($dictionary[$firstKey], $firstValue);\n    %man %o XCTAssertNoThrow($dictionary[$firstKey] = (id)NSNull.null);\n    %man %o uncheckedAssertEqualObjects($dictionary[$firstKey], (id)NSNull.null);\n    %man %o XCTAssertNoThrow($dictionary[$firstKey] = nil);\n    %man %o uncheckedAssertNil($dictionary[$firstKey]);\n\n    // Unmanaged non-optional\n    %unman %r uncheckedAssertNil($dictionary[$firstKey]);\n    %unman %r XCTAssertNoThrow($dictionary[$firstKey] = $firstValue);\n    %unman %r uncheckedAssertEqualObjects($dictionary[$firstKey], $firstValue);\n    %noany %unman %r RLMAssertThrowsWithReason($dictionary[$firstKey] = (id)NSNull.null, @\"Invalid value '<null>' of type 'NSNull' for expected type '$type'.\");\n    %unman %r XCTAssertNoThrow($dictionary[$firstKey] = nil);\n    %unman %r uncheckedAssertNil($dictionary[$firstKey]);\n\n    // Unmanaged optional\n    %unman %o uncheckedAssertNil($dictionary[$firstKey]);\n    %unman %o XCTAssertNoThrow($dictionary[$firstKey] = $firstValue);\n    %unman %o uncheckedAssertEqualObjects($dictionary[$firstKey], $firstValue);\n    %unman %o XCTAssertNoThrow($dictionary[$firstKey] = (id)NSNull.null);\n    %unman %o uncheckedAssertEqual($dictionary[$firstKey], (id)NSNull.null);\n    %unman %o XCTAssertNoThrow($dictionary[$firstKey] = nil);\n    %unman %o uncheckedAssertNil($dictionary[$firstKey]);\n\n    // Fail with nil key\n    RLMAssertThrowsWithReason([$dictionary setObject:$firstValue forKey:nil], ^n @\"Invalid nil key for dictionary expecting key of type 'string'.\");\n    // Fail on set nil for non-optional\n    %noany %r RLMAssertThrowsWithReason([$dictionary setObject:(id)NSNull.null forKey:$firstKey], ^n @\"Invalid value '<null>' of type 'NSNull' for expected type '$type'\");\n\n    %noany RLMAssertThrowsWithReason([$dictionary setObject:(id)$wrong forKey:$firstKey], ^n @\"Invalid value '$wdesc' of type '\" $wtype \"' for expected type '$type'\");\n    %noany %r RLMAssertThrowsWithReason([$dictionary setObject:(id)NSNull.null forKey:$firstKey], ^n @\"Invalid value '<null>' of type 'NSNull' for expected type '$type'\");\n\n    $dictionary[$firstKey] = $v0;\n    uncheckedAssertEqualObjects($dictionary[$firstKey], $v0);\n\n    %o $dictionary[$firstKey] = (id)NSNull.null;\n    %o uncheckedAssertEqualObjects($dictionary[$firstKey], (id)NSNull.null);\n}\n#pragma clang diagnostic pop\n\n- (void)testAddObjects {\n    %noany RLMAssertThrowsWithReason([$dictionary addEntriesFromDictionary:@{$firstKey: $wrong}], ^n @\"Invalid value '$wdesc' of type '\" $wtype \"' for expected type '$type'\");\n    %noany %r RLMAssertThrowsWithReason([$dictionary addEntriesFromDictionary:@{$firstKey: (id)NSNull.null}], ^n @\"Invalid value '<null>' of type 'NSNull' for expected type '$type'\");\n\n    [self addObjects];\n    uncheckedAssertEqualObjects($dictionary[$k0], $v0);\n    uncheckedAssertEqualObjects($dictionary[$k1], $v1);\n    %o uncheckedAssertEqualObjects($dictionary[$k1], (id)NSNull.null);\n}\n\n- (void)testRemoveObject {\n    [self addObjects];\n    %r uncheckedAssertEqual($dictionary.count, 2U);\n    %o uncheckedAssertEqual($dictionary.count, 2U);\n\n    uncheckedAssertEqualObjects($dictionary[$k0], $v0);\n\n    [$dictionary removeObjectForKey:$k0];\n\n    %r uncheckedAssertEqual($dictionary.count, 1U);\n    %o uncheckedAssertEqual($dictionary.count, 1U);\n\n    uncheckedAssertNil($dictionary[$k0]);\n}\n\n- (void)testRemoveObjects {\n    [self addObjects];\n    uncheckedAssertEqual($dictionary.count, 2U);\n\n    uncheckedAssertEqualObjects($dictionary[$k0], $v0);\n\n    [$dictionary removeObjectsForKeys:@[$k0, $k1]];\n\n    uncheckedAssertEqual($dictionary.count, 0U);\n    uncheckedAssertNil($dictionary[$k0]);\n}\n\n- (void)testUpdateObjects {\n    [self addObjects];\n    uncheckedAssertEqual($dictionary.count, 2U);\n\n    uncheckedAssertEqualObjects($dictionary[$k0], $v0);\n    uncheckedAssertEqualObjects($dictionary[$k1], $v1);\n\n    $dictionary[$k1] = $dictionary[$k0];\n    $dictionary[$k0] = $dictionary[$k1];\n\n    uncheckedAssertEqualObjects($dictionary[$k1], $v0);\n}\n\n- (void)testIndexOfObjectSorted {\n    [$dictionary addEntriesFromDictionary:@{ $k0: $v0, $k1: $v1 }];\n\n    %man %o uncheckedAssertEqual(0U, [[$dictionary sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:$v0]);\n    %man %o uncheckedAssertEqual(1U, [[$dictionary sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:(id)$v1]);\n    %man %r uncheckedAssertEqual(1U, [[$dictionary sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:$v0]);\n    %man %r uncheckedAssertEqual(0U, [[$dictionary sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:$v1]);\n\n    %man %o uncheckedAssertEqual(1U, [[$dictionary sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:(id)NSNull.null]);\n}\n\n- (void)testIndexOfObjectDistinct {\n    [$dictionary addEntriesFromDictionary:@{ $k0: $v0, $k1: $v1 }];\n\n    %man %r uncheckedAssertEqual(0U, [[$dictionary distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:$v0]);\n    %man %r uncheckedAssertEqual(1U, [[$dictionary distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:$v1]);\n\n    %man %o uncheckedAssertEqual(0U, [[$dictionary distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:$v0]);\n    %man %o uncheckedAssertEqual(1U, [[$dictionary distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:(id)$v1]);\n    %man %o uncheckedAssertEqual(1U, [[$dictionary distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:(id)NSNull.null]);\n}\n\n- (void)testSort {\n    %unman RLMAssertThrowsWithReason([$dictionary sortedResultsUsingKeyPath:@\"self\" ascending:NO], ^n @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    %unman RLMAssertThrowsWithReason([$dictionary sortedResultsUsingDescriptors:@[]], ^n @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    %man RLMAssertThrowsWithReason([$dictionary sortedResultsUsingKeyPath:@\"not self\" ascending:NO], ^n @\"can only be sorted on 'self'\");\n\n    [$dictionary addEntriesFromDictionary:@{$k0: $v0, $k1: $v1}];\n\n    %man uncheckedAssertEqualObjects([[$dictionary sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"], ^n (@[$v0, $v1]));\n\n    %man %r uncheckedAssertEqualObjects([[$dictionary sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"], ^n (@[$v1, $v0]));\n    %man %o uncheckedAssertEqualObjects([[$dictionary sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"], ^n (@[$v0, $v1]));\n\n    %man %r uncheckedAssertEqualObjects([[$dictionary sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"], ^n (@[$v0, $v1]));\n    %man %o uncheckedAssertEqualObjects([[$dictionary sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"], ^n (@[$v1, $v0]));\n}\n\n- (void)testFilter {\n    %unman RLMAssertThrowsWithReason([$dictionary objectsWhere:@\"TRUEPREDICATE\"], ^n @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n    %unman RLMAssertThrowsWithReason([$dictionary objectsWithPredicate:[NSPredicate predicateWithValue:YES]], ^n @\"This method may only be called on RLMDictionary instances retrieved from an RLMRealm\");\n\n    %man RLMAssertThrowsWithReason([$dictionary objectsWhere:@\"TRUEPREDICATE\"], ^n @\"implemented\");\n    %man RLMAssertThrowsWithReason([$dictionary objectsWithPredicate:[NSPredicate predicateWithValue:YES]], ^n @\"implemented\");\n\n    %man RLMAssertThrowsWithReason([[$dictionary sortedResultsUsingKeyPath:@\"self\" ascending:NO] ^n  objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    %man RLMAssertThrowsWithReason([[$dictionary sortedResultsUsingKeyPath:@\"self\" ascending:NO] ^n  objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n}\n\n- (void)testNotifications {\n    %unman RLMAssertThrowsWithReason([$dictionary addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], ^n @\"Change notifications are only supported on managed collections.\");\n}\n\n- (void)testMin {\n    %noany %nominmax %unman RLMAssertThrowsWithReason([$dictionary minOfProperty:@\"self\"], ^n @\"minOfProperty: is not supported for $type dictionary\");\n    %noany %nominmax %man RLMAssertThrowsWithReason([$dictionary minOfProperty:@\"self\"], ^n @\"Operation 'min' not supported for $type dictionary '$class.$prop'\");\n\n    %minmax uncheckedAssertNil([$dictionary minOfProperty:@\"self\"]);\n\n    [self addObjects];\n\n    %minmax uncheckedAssertEqualObjects([$dictionary minOfProperty:@\"self\"], $v0);\n}\n\n- (void)testMax {\n    %noany %nominmax %unman RLMAssertThrowsWithReason([$dictionary maxOfProperty:@\"self\"], ^n @\"maxOfProperty: is not supported for $type dictionary\");\n    %noany %nominmax %man RLMAssertThrowsWithReason([$dictionary maxOfProperty:@\"self\"], ^n @\"Operation 'max' not supported for $type dictionary '$class.$prop'\");\n\n    %minmax uncheckedAssertNil([$dictionary maxOfProperty:@\"self\"]);\n\n    [self addObjects];\n\n    %r %minmax uncheckedAssertEqualObjects([$dictionary maxOfProperty:@\"self\"], $v1);\n    %o %minmax uncheckedAssertEqualObjects([$dictionary maxOfProperty:@\"self\"], $v0);\n}\n\n- (void)testSum {\n    %noany %nosum %unman RLMAssertThrowsWithReason([$dictionary sumOfProperty:@\"self\"], ^n @\"sumOfProperty: is not supported for $type dictionary\");\n    %noany %nosum %man RLMAssertThrowsWithReason([$dictionary sumOfProperty:@\"self\"], ^n @\"Operation 'sum' not supported for $type dictionary '$class.$prop'\");\n\n    %sum uncheckedAssertEqualObjects([$dictionary sumOfProperty:@\"self\"], @0);\n\n    [self addObjects];\n\n    %sum XCTAssertEqualWithAccuracy([$dictionary sumOfProperty:@\"self\"].doubleValue, sum($values), .001);\n}\n\n- (void)testAverage {\n    %noany %noavg %unman RLMAssertThrowsWithReason([$dictionary averageOfProperty:@\"self\"], ^n @\"averageOfProperty: is not supported for $type dictionary\");\n    %noany %noavg %man RLMAssertThrowsWithReason([$dictionary averageOfProperty:@\"self\"], ^n @\"Operation 'average' not supported for $type dictionary '$class.$prop'\");\n\n    %avg uncheckedAssertNil([$dictionary averageOfProperty:@\"self\"]);\n\n    [self addObjects];\n\n    %avg XCTAssertEqualWithAccuracy([$dictionary averageOfProperty:@\"self\"].doubleValue, average($values), .001);\n}\n\n- (void)testFastEnumeration {\n    for (int i = 0; i < 10; ++i) {\n        [self addObjects];\n    }\n\n    // This is wrapped in a block to work around a compiler bug in Xcode 12.5:\n    // in release builds, reads on `values` will read the wrong local variable,\n    // resulting in a crash when it tries to send a message to some unitialized\n    // stack space. Putting them in separate obj-c blocks prevents this\n    // incorrect optimization.\n    ^{ ^nl NSDictionary *values = $values; ^nl for (id key in $dictionary) { ^nl     id value = $dictionary[key]; ^nl     uncheckedAssertEqualObjects(values[key], value); ^nl } ^nl uncheckedAssertEqual(values.count, $dictionary.count); ^nl }(); ^nl \n}\n\n- (void)testValueForKeyNumericAggregates {\n    %minmax uncheckedAssertNil([$dictionary valueForKeyPath:@\"@min.self\"]);\n    %minmax uncheckedAssertNil([$dictionary valueForKeyPath:@\"@max.self\"]);\n    %sum uncheckedAssertEqualObjects([$dictionary valueForKeyPath:@\"@sum.self\"], @0);\n    %avg uncheckedAssertNil([$dictionary valueForKeyPath:@\"@avg.self\"]);\n\n    [self addObjects];\n\n    %minmax uncheckedAssertEqualObjects([$dictionary valueForKeyPath:@\"@min.self\"], $v0);\n    %r %minmax uncheckedAssertEqualObjects([$dictionary valueForKeyPath:@\"@max.self\"], $v1);\n    %o %minmax uncheckedAssertEqualObjects([$dictionary valueForKeyPath:@\"@max.self\"], $v0);\n    %sum XCTAssertEqualWithAccuracy([[$dictionary valueForKeyPath:@\"@sum.self\"] doubleValue], sum($values), .001);\n    %avg XCTAssertEqualWithAccuracy([[$dictionary valueForKeyPath:@\"@avg.self\"] doubleValue], average($values), .001);\n}\n\n- (void)testSetValueForKey {\n    %noany RLMAssertThrowsWithReason([$dictionary setValue:$wrong forKey:$k0], ^n @\"Invalid value '$wdesc' of type '\" $wtype \"' for expected type '$type'\");\n    %noany %r RLMAssertThrowsWithReason([$dictionary setValue:(id)NSNull.null forKey:@\"self\"], ^n @\"Invalid value '<null>' of type 'NSNull' for expected type '$type'\");\n\n    [self addObjects];\n\n    uncheckedAssertEqualObjects($dictionary[$k0], $v0);\n\n    %o [$dictionary setValue:(id)NSNull.null forKey:$k0];\n    %o uncheckedAssertEqualObjects($dictionary[$k0], (id)NSNull.null);\n}\n\n- (void)testAssignment {\n    $dictionary = (id)@{$k1: $v1}; ^nl uncheckedAssertEqualObjects($dictionary[$k1], $v1);\n\n    [unmanaged.intObj removeAllObjects];\n    unmanaged.intObj = managed.intObj;\n\n    uncheckedAssertEqual(unmanaged.intObj.count, 1);\n    uncheckedAssertEqualObjects(unmanaged.intObj.allValues, managed.intObj.allValues);\n\n    [managed.intObj removeAllObjects];\n    managed.intObj = unmanaged.intObj;\n\n    uncheckedAssertEqual(managed.intObj.count, 1);\n    uncheckedAssertEqualObjects(managed.intObj.allValues, unmanaged.intObj.allValues);\n}\n\n- (void)testInvalidAssignment {\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)@{@\"0\": (id)NSNull.null},\n                              @\"Invalid value '<null>' of type 'NSNull' for 'int' dictionary property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)@{@\"0\": @\"a\"},\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' dictionary property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)(@{@\"0\": @1, @\"1\": @\"a\"}),\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' dictionary property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)unmanaged.floatObj,\n                              @\"RLMDictionary<string, float> does not match expected type 'int' for property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)optUnmanaged.intObj,\n                              @\"RLMDictionary<string, int?> does not match expected type 'int' for property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged[@\"intObj\"] = unmanaged[@\"floatObj\"],\n                              @\"RLMDictionary<string, float> does not match expected type 'int' for property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged[@\"intObj\"] = optUnmanaged[@\"intObj\"],\n                              @\"RLMDictionary<string, int?> does not match expected type 'int' for property 'AllPrimitiveDictionaries.intObj'.\");\n\n    RLMAssertThrowsWithReason(managed.intObj = (id)@{@\"0\": (id)NSNull.null},\n                              @\"Invalid value '<null>' of type 'NSNull' for 'int' dictionary property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)@{@\"0\": @\"a\"},\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' dictionary property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)(@{@\"0\": @1, @\"1\": @\"a\"}),\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' dictionary property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)managed.floatObj,\n                              @\"RLMDictionary<string, float> does not match expected type 'int' for property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)optManaged.intObj,\n                              @\"RLMDictionary<string, int?> does not match expected type 'int' for property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(managed[@\"intObj\"] = (id)managed[@\"floatObj\"],\n                              @\"RLMDictionary<string, float> does not match expected type 'int' for property 'AllPrimitiveDictionaries.intObj'.\");\n    RLMAssertThrowsWithReason(managed[@\"intObj\"] = (id)optManaged[@\"intObj\"],\n                              @\"RLMDictionary<string, int?> does not match expected type 'int' for property 'AllPrimitiveDictionaries.intObj'.\");\n}\n\n- (void)testAllMethodsCheckThread {\n    RLMDictionary *dictionary = managed.intObj;\n    [self dispatchAsyncAndWait:^{\n        RLMAssertThrowsWithReason([dictionary count], @\"thread\");\n        RLMAssertThrowsWithReason(dictionary[@\"0\"], @\"thread\");\n        RLMAssertThrowsWithReason([dictionary count], @\"thread\");\n\n        RLMAssertThrowsWithReason([dictionary setObject:@0 forKey:@\"thread\"], @\"thread\");\n        RLMAssertThrowsWithReason([dictionary addEntriesFromDictionary:@{@\"thread\": @0}], @\"thread\");\n        RLMAssertThrowsWithReason([dictionary removeObjectForKey:@\"thread\"], @\"thread\");\n        RLMAssertThrowsWithReason([dictionary removeObjectsForKeys:(id)@[@\"thread\"]], @\"thread\");\n        RLMAssertThrowsWithReason([dictionary removeAllObjects], @\"thread\");\n        RLMAssertThrowsWithReason([optManaged.intObj setObject:(id)NSNull.null forKey:@\"thread\"], @\"thread\");\n\n        RLMAssertThrowsWithReason([dictionary sortedResultsUsingKeyPath:@\"self\" ascending:YES], @\"thread\");\n        RLMAssertThrowsWithReason([dictionary sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"self\" ascending:YES]]], @\"thread\");\n        RLMAssertThrowsWithReason(dictionary[@\"thread\"], @\"thread\");\n        RLMAssertThrowsWithReason(dictionary[@\"thread\"] = @0, @\"thread\");\n        RLMAssertThrowsWithReason([dictionary valueForKey:@\"self\"], @\"thread\");\n        RLMAssertThrowsWithReason([dictionary setValue:@1 forKey:@\"self\"], @\"thread\");\n        RLMAssertThrowsWithReason(({for (__unused id obj in dictionary);}), @\"thread\");\n    }];\n}\n\n- (void)testAllMethodsCheckForInvalidation {\n    RLMDictionary *dictionary = managed.intObj;\n    [realm cancelWriteTransaction];\n    [realm invalidate];\n\n    XCTAssertNoThrow([dictionary objectClassName]);\n    XCTAssertNoThrow([dictionary realm]);\n    XCTAssertNoThrow([dictionary isInvalidated]);\n\n    RLMAssertThrowsWithReason([dictionary count], @\"invalidated\");\n    uncheckedAssertNil(dictionary[@\"0\"]);\n    RLMAssertThrowsWithReason([dictionary count], @\"invalidated\");\n\n    RLMAssertThrowsWithReason([dictionary setObject:@0 forKey:@\"thread\"], @\"invalidated\");\n    RLMAssertThrowsWithReason([dictionary addEntriesFromDictionary:@{@\"invalidated\": @0}], @\"invalidated\");\n    RLMAssertThrowsWithReason([dictionary removeObjectForKey:@\"invalidated\"], @\"invalidated\");\n    RLMAssertThrowsWithReason([dictionary removeObjectsForKeys:(id)@[@\"invalidated\"]], @\"invalidated\");\n    RLMAssertThrowsWithReason([dictionary removeAllObjects], @\"invalidated\");\n    RLMAssertThrowsWithReason([optManaged.intObj setObject:(id)NSNull.null forKey:@\"invalidated\"], @\"invalidated\");\n\n    RLMAssertThrowsWithReason([dictionary sortedResultsUsingKeyPath:@\"self\" ascending:YES], @\"invalidated\");\n    RLMAssertThrowsWithReason([dictionary sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"self\" ascending:YES]]], @\"invalidated\");\n    RLMAssertThrowsWithReason(dictionary[@\"invalidated\"] = @0, @\"invalidated\");\n    uncheckedAssertNil([dictionary valueForKey:@\"self\"]);\n    RLMAssertThrowsWithReason([dictionary setValue:@1 forKey:@\"self\"], @\"invalidated\");\n    RLMAssertThrowsWithReason(({for (__unused id obj in dictionary);}), @\"invalidated\");\n\n    [realm beginWriteTransaction];\n}\n\n- (void)testMutatingMethodsCheckForWriteTransaction {\n    RLMDictionary *dictionary = managed.intObj;\n    [dictionary setObject:@0 forKey:@\"testKey\"];\n    [realm commitWriteTransaction];\n\n    XCTAssertNoThrow([dictionary objectClassName]);\n    XCTAssertNoThrow([dictionary realm]);\n    XCTAssertNoThrow([dictionary isInvalidated]);\n\n    XCTAssertNoThrow([dictionary count]);\n    XCTAssertNoThrow(dictionary[@\"0\"]);\n    XCTAssertNoThrow([dictionary count]);\n\n    XCTAssertNoThrow([dictionary sortedResultsUsingKeyPath:@\"self\" ascending:YES]);\n    XCTAssertNoThrow([dictionary sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"self\" ascending:YES]]]);\n    XCTAssertNoThrow(dictionary[@\"0\"]);\n    XCTAssertNoThrow([dictionary valueForKey:@\"self\"]);\n    XCTAssertNoThrow(({for (__unused id obj in dictionary);}));\n\n    RLMAssertThrowsWithReason([dictionary setObject:@0 forKey:@\"testKey\"], @\"write transaction\");\n    RLMAssertThrowsWithReason([dictionary addEntriesFromDictionary:@{@\"testKey\": @0}], @\"write transaction\");\n    RLMAssertThrowsWithReason([dictionary removeObjectForKey:@\"testKey\"], @\"write transaction\");\n    RLMAssertThrowsWithReason([dictionary removeObjectsForKeys:(id)@[@\"testKey\"]], @\"write transaction\");\n    RLMAssertThrowsWithReason([dictionary removeAllObjects], @\"write transaction\");\n    RLMAssertThrowsWithReason([optManaged.intObj setObject:(id)NSNull.null forKey:@\"testKey\"], @\"write transaction\");\n\n    RLMAssertThrowsWithReason(dictionary[@\"testKey\"] = @0, @\"write transaction\");\n    RLMAssertThrowsWithReason([dictionary setValue:@1 forKey:@\"self\"], @\"write transaction\");\n}\n\n- (void)testDeleteOwningObject {\n    RLMDictionary *dictionary = managed.intObj;\n    uncheckedAssertFalse(dictionary.isInvalidated);\n    [realm deleteObject:managed];\n    uncheckedAssertTrue(dictionary.isInvalidated);\n}\n\n#pragma clang diagnostic ignored \"-Warc-retain-cycles\"\n\n- (void)testNotificationSentInitially {\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMDictionary *dictionary, RLMDictionaryChange *change, NSError *error) {\n        XCTAssertNotNil(dictionary);\n        uncheckedAssertNil(change);\n        uncheckedAssertNil(error);\n        [expectation fulfill];\n    }];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationSentAfterCommit {\n    [realm commitWriteTransaction];\n\n    __block bool first = true;\n    __block bool second = false;\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMDictionary *dictionary, RLMDictionaryChange *change, NSError *error) {\n        XCTAssertNotNil(dictionary);\n        uncheckedAssertNil(error);\n        if (first) {\n            uncheckedAssertNil(change);\n        }\n        else if (!second) {\n            uncheckedAssertEqualObjects(change.insertions, @[@\"testKey\"]);\n        } else {\n            uncheckedAssertEqualObjects(change.deletions, @[@\"testKey\"]);\n        }\n\n        first = false;\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *r = [RLMRealm defaultRealm];\n        [r transactionWithBlock:^{\n            RLMDictionary *dictionary = [(AllPrimitiveDictionaries *)[AllPrimitiveDictionaries allObjectsInRealm:r].firstObject intObj];\n            dictionary[@\"testKey\"] = @0;\n        }];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    second = true;\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *r = [RLMRealm defaultRealm];\n        [r transactionWithBlock:^{\n            RLMDictionary *dictionary = [(AllPrimitiveDictionaries *)[AllPrimitiveDictionaries allObjectsInRealm:r].firstObject intObj];\n            [dictionary removeObjectForKey:@\"testKey\"];\n        }];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationNotSentForUnrelatedChange {\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(__unused RLMDictionary *dictionary, __unused RLMDictionaryChange *change, __unused NSError *error) {\n        // will throw if it's incorrectly called a second time due to the\n        // unrelated write transaction\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmDidChangeNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *r = [RLMRealm defaultRealm];\n            [r transactionWithBlock:^{\n                [AllPrimitiveDictionaries createInRealm:r withValue:@[]];\n            }];\n        }];\n    }];\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationSentOnlyForActualRefresh {\n    [realm commitWriteTransaction];\n\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMDictionary *dictionary, __unused RLMDictionaryChange *change, NSError *error) {\n        XCTAssertNotNil(dictionary);\n        uncheckedAssertNil(error);\n        // will throw if it's called a second time before we create the new\n        // expectation object immediately before manually refreshing\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // Turn off autorefresh, so the background commit should not result in a notification\n    realm.autorefresh = NO;\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmRefreshRequiredNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *r = [RLMRealm defaultRealm];\n            [r transactionWithBlock:^{\n                RLMDictionary *dictionary = [(AllPrimitiveDictionaries *)[AllPrimitiveDictionaries allObjectsInRealm:r].firstObject intObj];\n                dictionary[@\"testKey\"] = @0;\n            }];\n        }];\n    }];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [realm refresh];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n#pragma mark - Queries\n\n#define RLMAssertCount(cls, expectedCount, ...) \\\n    uncheckedAssertEqual(expectedCount, ([cls objectsInRealm:realm where:__VA_ARGS__].count))\n\n- (void)createObject {\n    %r %man id $prop = @{$k0: $v0};\n\n    id obj = [AllPrimitiveDictionaries createInRealm:realm withValue: @{\n        %r %man @\"$prop\": $prop,\n    }];\n    [LinkToAllPrimitiveDictionaries createInRealm:realm withValue:@[obj]];\n    obj = [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        %o %man @\"$prop\": $prop,\n    }];\n    [LinkToAllOptionalPrimitiveDictionaries createInRealm:realm withValue:@[obj]];\n}\n\n- (void)testQueryBasicOperators {\n    [realm deleteAllObjects];\n\n    %man RLMAssertCount($class, 0, @\"ANY $prop = %@\", $v0);\n    %man RLMAssertCount($class, 0, @\"ANY $prop != %@\", $v0);\n    %man %comp RLMAssertCount($class, 0, @\"ANY $prop > %@\", $v0);\n    %man %comp RLMAssertCount($class, 0, @\"ANY $prop >= %@\", $v0);\n    %man %comp RLMAssertCount($class, 0, @\"ANY $prop < %@\", $v0);\n    %man %comp RLMAssertCount($class, 0, @\"ANY $prop <= %@\", $v0);\n\n    [self createObject];\n\n    %man RLMAssertCount($class, 0, @\"ANY $prop = %@\", $v1);\n    %man RLMAssertCount($class, 1, @\"ANY $prop = %@\", $v0);\n    %man RLMAssertCount($class, 0, @\"ANY $prop != %@\", $v0);\n    %man RLMAssertCount($class, 1, @\"ANY $prop != %@\", $v1);\n    %man %comp RLMAssertCount($class, 0, @\"ANY $prop > %@\", $v0);\n    %man %comp RLMAssertCount($class, 1, @\"ANY $prop >= %@\", $v0);\n    %man %comp RLMAssertCount($class, 0, @\"ANY $prop < %@\", $v0);\n    %r %man %comp RLMAssertCount($class, 1, @\"ANY $prop < %@\", $v1);\n    %o %man %comp RLMAssertCount($class, 0, @\"ANY $prop < %@\", $v1);\n    %man %comp RLMAssertCount($class, 1, @\"ANY $prop <= %@\", $v0);\n\n    %noany %man %nocomp RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"ANY $prop > %@\", $v0]), ^n @\"Operator '>' not supported for type '$basetype'\");\n}\n\n- (void)testQueryBetween {\n    [realm deleteAllObjects];\n\n    %noany %man %nominmax RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"ANY $prop BETWEEN %@\", @[$v0, $v1]]), ^n @\"Operator 'BETWEEN' not supported for type '$basetype'\");\n\n    %man %minmax RLMAssertCount($class, 0, @\"ANY $prop BETWEEN %@\", @[$v0, $v1]);\n\n    [self createObject];\n\n    %r %man %minmax RLMAssertCount($class, 1, @\"ANY $prop BETWEEN %@\", @[$v0, $v0]);\n    %r %man %minmax RLMAssertCount($class, 1, @\"ANY $prop BETWEEN %@\", @[$v0, $v1]);\n    %r %man %minmax RLMAssertCount($class, 0, @\"ANY $prop BETWEEN %@\", @[$v1, $v1]);\n    %o %man %minmax RLMAssertCount($class, 1, @\"ANY $prop BETWEEN %@\", @[$v0, $v0]);\n    %o %man %minmax RLMAssertCount($class, 0, @\"ANY $prop BETWEEN %@\", @[$v0, $v1]);\n    %o %man %minmax RLMAssertCount($class, 0, @\"ANY $prop BETWEEN %@\", @[$v1, $v1]);\n}\n\n- (void)testQueryIn {\n    [realm deleteAllObjects];\n\n    %man RLMAssertCount($class, 0, @\"ANY $prop IN %@\", @[$v0, $v1]);\n\n    [self createObject];\n\n    %man RLMAssertCount($class, 0, @\"ANY $prop IN %@\", @[$v1]);\n    %man RLMAssertCount($class, 1, @\"ANY $prop IN %@\", @[$v0, $v1]);\n}\n\n- (void)testQueryCount {\n    [realm deleteAllObjects];\n\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n        %r %man @\"$prop\": $values,\n    }];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        %o %man @\"$prop\": $values,\n    }];\n\n    %man RLMAssertCount($class, 1U, @\"$prop.@count == %@\", @(2));\n    %man RLMAssertCount($class, 0U, @\"$prop.@count != %@\", @(2));\n    %man RLMAssertCount($class, 0, @\"$prop.@count > %@\", @(2));\n    %man RLMAssertCount($class, 1, @\"$prop.@count >= %@\", @(2));\n    %man RLMAssertCount($class, 0, @\"$prop.@count < %@\", @(2));\n    %man RLMAssertCount($class, 1, @\"$prop.@count <= %@\", @(2));\n}\n\n- (void)testQuerySum {\n    [realm deleteAllObjects];\n\n    %noany %nodate %nosum %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@sum = %@\", $v0]), ^n @\"Invalid keypath '$prop.@sum': @sum can only be applied to a collection of numeric values.\");\n    %date %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@sum = %@\", $v0]), ^n @\"Cannot sum or average date properties\");\n\n    %noany %sum %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@sum = %@\", $wrong]), ^n @\"@sum on a property of type $basetype cannot be compared with '$wdesc'\");\n    %sum %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@sum.prop = %@\", $wrong]), ^n @\"Invalid keypath '$prop.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    %sum %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@sum = %@\", (id)NSNull.null]), ^n @\"@sum on a property of type $basetype cannot be compared with '<null>'\");\n\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n        %man %r %sum @\"$prop\": @{},\n    }];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        %man %o %sum @\"$prop\": @{},\n    }];\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n        %man %r %sum @\"$prop\": @{$k0: $v0},\n    }];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        %man %o %sum @\"$prop\": @{$k0: $v0},\n    }];\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n        %man %r %sum @\"$prop\": $values,\n    }];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        %man %o %sum @\"$prop\": $values,\n    }];\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n        %man %r %sum @\"$prop\": $values,\n    }];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        %man %o %sum @\"$prop\": $values,\n    }];\n\n    %sum %man RLMAssertCount($class, 1U, @\"$prop.@sum == %@\", @0);\n    %r %sum %man RLMAssertCount($class, 1U, @\"$prop.@sum == %@\", $v0);\n    %o %sum %man RLMAssertCount($class, 3U, @\"$prop.@sum == %@\", $v0);\n    %r %sum %man RLMAssertCount($class, 3U, @\"$prop.@sum != %@\", $v0);\n    %o %sum %man RLMAssertCount($class, 1U, @\"$prop.@sum != %@\", $v0);\n    %sum %man RLMAssertCount($class, 3U, @\"$prop.@sum >= %@\", $v0);\n    %r %sum %man RLMAssertCount($class, 2U, @\"$prop.@sum > %@\", $v0);\n    %o %sum %man RLMAssertCount($class, 0U, @\"$prop.@sum > %@\", $v0);\n    %r %sum %man RLMAssertCount($class, 2U, @\"$prop.@sum < %@\", $v1);\n    %o %sum %man RLMAssertCount($class, 1U, @\"$prop.@sum < %@\", $v0);\n    %r %sum %man RLMAssertCount($class, 2U, @\"$prop.@sum <= %@\", $v1);\n    %o %sum %man RLMAssertCount($class, 4U, @\"$prop.@sum <= %@\", $v0);\n}\n\n- (void)testQueryAverage {\n    [realm deleteAllObjects];\n\n    %noany %nodate %noavg %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@avg = %@\", $v0]), ^n @\"Invalid keypath '$prop.@avg': @avg can only be applied to a collection of numeric values.\");\n    %date %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@avg = %@\", $v0]), ^n @\"Cannot sum or average date properties\");\n\n    %noany %avg %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@avg = %@\", $wrong]), ^n @\"@avg on a property of type $basetype cannot be compared with '$wdesc'\");\n    %avg %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@avg.prop = %@\", $wrong]), ^n @\"Invalid keypath '$prop.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n        %man %r %avg @\"$prop\": @{},\n    }];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        %man %o %avg @\"$prop\": @{},\n    }];\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n        %man %r %avg @\"$prop\": @{$k0: $v0},\n    }];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        %man %o %avg @\"$prop\": @{$k0: $v0},\n    }];\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n        %man %r %avg @\"$prop\": $values,\n    }];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        %man %o %avg @\"$prop\": $values,\n    }];\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n        %man %r %avg @\"$prop\": @{$k0: $v1},\n    }];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n        %man %o %avg @\"$prop\": @{$k0: $v0},\n    }];\n\n    %avg %man RLMAssertCount($class, 1U, @\"$prop.@avg == %@\", NSNull.null);\n    %r %avg %man RLMAssertCount($class, 1U, @\"$prop.@avg == %@\", $v0);\n    %o %avg %man RLMAssertCount($class, 3U, @\"$prop.@avg == %@\", $v0);\n    %r %avg %man RLMAssertCount($class, 3U, @\"$prop.@avg != %@\", $v0);\n    %o %avg %man RLMAssertCount($class, 1U, @\"$prop.@avg != %@\", $v0);\n    %avg %man RLMAssertCount($class, 3U, @\"$prop.@avg >= %@\", $v0);\n    %r %avg %man RLMAssertCount($class, 2U, @\"$prop.@avg > %@\", $v0);\n    %o %avg %man RLMAssertCount($class, 0U, @\"$prop.@avg > %@\", $v0);\n    %r %avg %man RLMAssertCount($class, 2U, @\"$prop.@avg < %@\", $v1);\n    %o %avg %man RLMAssertCount($class, 0U, @\"$prop.@avg < %@\", $v0);\n    %r %avg %man RLMAssertCount($class, 3U, @\"$prop.@avg <= %@\", $v1);\n    %o %avg %man RLMAssertCount($class, 1U, @\"$prop.@avg <= %@\", $v1);\n    %o %avg %man RLMAssertCount($class, 3U, @\"$prop.@avg <= %@\", $v0);\n}\n\n- (void)testQueryMin {\n    [realm deleteAllObjects];\n\n    %noany %nominmax %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@min = %@\", $v0]), ^n @\"Invalid keypath '$prop.@min': @min can only be applied to a collection of numeric values.\");\n    %noany %minmax %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@min = %@\", $wrong]), ^n @\"@min on a property of type $basetype cannot be compared with '$wdesc'\");\n    %minmax %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@min.prop = %@\", $wrong]), ^n @\"Invalid keypath '$prop.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n\n    // No objects, so count is zero\n    %minmax %man RLMAssertCount($class, 0U, @\"$prop.@min == %@\", $v0);\n\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{}];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{}];\n\n    // Only empty dictionarys, so count is zero\n    %minmax %man RLMAssertCount($class, 0U, @\"$prop.@min == %@\", $v0);\n    %r %minmax %man RLMAssertCount($class, 0U, @\"$prop.@min == %@\", $v1);\n    %o %minmax %man RLMAssertCount($class, 1U, @\"$prop.@min == %@\", $v1);\n\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@min == nil\");\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@min == %@\", NSNull.null);\n\n    [self createObject];\n\n    // One object where v0 is min and zero with v1\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@min == %@\", $v0);\n    %r %minmax %man RLMAssertCount($class, 0U, @\"$prop.@min == %@\", $v1);\n    %o %minmax %man RLMAssertCount($class, 1U, @\"$prop.@min == %@\", $v1);\n}\n\n- (void)testQueryMax {\n    [realm deleteAllObjects];\n\n    %noany %nominmax %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@max = %@\", $v0]), ^n @\"Invalid keypath '$prop.@max': @max can only be applied to a collection of numeric values.\");\n    %noany %minmax %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@max = %@\", $wrong]), ^n @\"@max on a property of type $basetype cannot be compared with '$wdesc'\");\n    %minmax %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@max.prop = %@\", $wrong]), ^n @\"Invalid keypath '$prop.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n\n    // No objects, so count is zero\n    %minmax %man RLMAssertCount($class, 0U, @\"$prop.@max == %@\", $v0);\n\n    [AllPrimitiveDictionaries createInRealm:realm withValue:@{}];\n    [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{}];\n\n    // Only empty dictionarys, so count is zero.\n    %r %minmax %man RLMAssertCount($class, 0U, @\"$prop.@max == %@\", $v0);\n    %r %minmax %man RLMAssertCount($class, 0U, @\"$prop.@max == %@\", $v1);\n\n    %o %minmax %man RLMAssertCount($class, 0U, @\"$prop.@max == %@\", $v0);\n    %o %minmax %man RLMAssertCount($class, 1U, @\"$prop.@max == %@\", $v1);\n\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@max == nil\");\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@max == %@\", NSNull.null);\n\n    [self createObject];\n\n    // One object where v0 is min and zero with v1\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@max == %@\", $v0);\n    %r %minmax %man RLMAssertCount($class, 0U, @\"$prop.@max == %@\", $v1);\n    %o %minmax %man RLMAssertCount($class, 1U, @\"$prop.@max == %@\", $v1);\n}\n\n- (void)testQueryBasicOperatorsOverLink {\n    [realm deleteAllObjects];\n\n    %man RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop = %@\", $v0);\n    %man RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop != %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop > %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop >= %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop < %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop <= %@\", $v0);\n\n    [self createObject];\n\n    %man RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop = %@\", $v1);\n    %man RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop = %@\", $v0);\n    %man RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop != %@\", $v0);\n    %man RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop != %@\", $v1);\n    %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop > %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop >= %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop < %@\", $v0);\n    %r %man %comp RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop < %@\", $v1);\n    %o %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop < %@\", $v1);\n    %man %comp RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop <= %@\", $v0);\n\n    %noany %man %nocomp RLMAssertThrowsWithReason(([LinkTo$class objectsInRealm:realm where:@\"ANY link.$prop > %@\", $v0]), ^n @\"Operator '>' not supported for type '$basetype'\");\n}\n\n- (void)testSubstringQueries {\n    [realm deleteAllObjects];\n    NSArray *values = @[\n        @\"\",\n\n        @\"á\", @\"ó\", @\"ú\",\n\n        @\"áá\", @\"áó\", @\"áú\",\n        @\"óá\", @\"óó\", @\"óú\",\n        @\"úá\", @\"úó\", @\"úú\",\n\n        @\"ááá\", @\"ááó\", @\"ááú\", @\"áóá\", @\"áóó\", @\"áóú\", @\"áúá\", @\"áúó\", @\"áúú\",\n        @\"óáá\", @\"óáó\", @\"óáú\", @\"óóá\", @\"óóó\", @\"óóú\", @\"óúá\", @\"óúó\", @\"óúú\",\n        @\"úáá\", @\"úáó\", @\"úáú\", @\"úóá\", @\"úóó\", @\"úóú\", @\"úúá\", @\"úúó\", @\"úúú\",\n    ];\n\n    void (^create)(NSString *) = ^(NSString *value) {\n        id obj = [AllPrimitiveDictionaries createInRealm:realm withValue:@{\n            @\"stringObj\": @{@\"key\": value},\n            @\"dataObj\": @{@\"key\": [value dataUsingEncoding:NSUTF8StringEncoding]}\n        }];\n        [LinkToAllPrimitiveDictionaries createInRealm:realm withValue:@[obj]];\n        obj = [AllOptionalPrimitiveDictionaries createInRealm:realm withValue:@{\n            @\"stringObj\": @{@\"key\": value},\n            @\"dataObj\": @{@\"key\": [value dataUsingEncoding:NSUTF8StringEncoding]}\n        }];\n        [LinkToAllOptionalPrimitiveDictionaries createInRealm:realm withValue:@[obj]];\n    };\n\n    for (NSString *value in values) {\n        create(value);\n        create(value.uppercaseString);\n        create([value stringByApplyingTransform:NSStringTransformStripDiacritics reverse:NO]);\n        create([value.uppercaseString stringByApplyingTransform:NSStringTransformStripDiacritics reverse:NO]);\n    }\n\n    void (^test)(NSString *, id, NSUInteger) = ^(NSString *operator, NSString *value, NSUInteger count) {\n        NSData *data = [value dataUsingEncoding:NSUTF8StringEncoding];\n\n        NSString *query = [NSString stringWithFormat:@\"ANY stringObj %@ %%@\", operator];\n        %man %string RLMAssertCount($class, count, query, value);\n        query = [NSString stringWithFormat:@\"ANY link.stringObj %@ %%@\", operator];\n        %man %string RLMAssertCount(LinkTo$class, count, query, value);\n\n        query = [NSString stringWithFormat:@\"ANY dataObj %@ %%@\", operator];\n        %man %string RLMAssertCount($class, count, query, data);\n        query = [NSString stringWithFormat:@\"ANY link.dataObj %@ %%@\", operator];\n        %man %string RLMAssertCount(LinkTo$class, count, query, data);\n    };\n    void (^testNull)(NSString *, NSUInteger) = ^(NSString *operator, NSUInteger count) {\n        NSString *query = [NSString stringWithFormat:@\"ANY stringObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([AllPrimitiveDictionaries objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'stringObj' of type 'string'\");\n        RLMAssertCount(AllOptionalPrimitiveDictionaries, count, query, NSNull.null);\n        query = [NSString stringWithFormat:@\"ANY link.stringObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([LinkToAllPrimitiveDictionaries objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'stringObj' of type 'string'\");\n        RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, count, query, NSNull.null);\n\n        query = [NSString stringWithFormat:@\"ANY dataObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([AllPrimitiveDictionaries objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'dataObj' of type 'data'\");\n        RLMAssertCount(AllOptionalPrimitiveDictionaries, count, query, NSNull.null);\n\n        query = [NSString stringWithFormat:@\"ANY link.dataObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([LinkToAllPrimitiveDictionaries objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'dataObj' of type 'data'\");\n        RLMAssertCount(LinkToAllOptionalPrimitiveDictionaries, count, query, NSNull.null);\n    };\n\n    testNull(@\"==\", 0);\n    test(@\"==\", @\"\", 4);\n    test(@\"==\", @\"a\", 1);\n    test(@\"==\", @\"á\", 1);\n    test(@\"==[c]\", @\"a\", 2);\n    test(@\"==[c]\", @\"á\", 2);\n    test(@\"==\", @\"A\", 1);\n    test(@\"==\", @\"Á\", 1);\n    test(@\"==[c]\", @\"A\", 2);\n    test(@\"==[c]\", @\"Á\", 2);\n    test(@\"==[d]\", @\"a\", 2);\n    test(@\"==[d]\", @\"á\", 2);\n    test(@\"==[cd]\", @\"a\", 4);\n    test(@\"==[cd]\", @\"á\", 4);\n    test(@\"==[d]\", @\"A\", 2);\n    test(@\"==[d]\", @\"Á\", 2);\n    test(@\"==[cd]\", @\"A\", 4);\n    test(@\"==[cd]\", @\"Á\", 4);\n\n    testNull(@\"!=\", 160);\n    test(@\"!=\", @\"\", 156);\n    test(@\"!=\", @\"a\", 159);\n    test(@\"!=\", @\"á\", 159);\n    test(@\"!=[c]\", @\"a\", 158);\n    test(@\"!=[c]\", @\"á\", 158);\n    test(@\"!=\", @\"A\", 159);\n    test(@\"!=\", @\"Á\", 159);\n    test(@\"!=[c]\", @\"A\", 158);\n    test(@\"!=[c]\", @\"Á\", 158);\n    test(@\"!=[d]\", @\"a\", 158);\n    test(@\"!=[d]\", @\"á\", 158);\n    test(@\"!=[cd]\", @\"a\", 156);\n    test(@\"!=[cd]\", @\"á\", 156);\n    test(@\"!=[d]\", @\"A\", 158);\n    test(@\"!=[d]\", @\"Á\", 158);\n    test(@\"!=[cd]\", @\"A\", 156);\n    test(@\"!=[cd]\", @\"Á\", 156);\n\n    testNull(@\"CONTAINS\", 0);\n    testNull(@\"CONTAINS[c]\", 0);\n    testNull(@\"CONTAINS[d]\", 0);\n    testNull(@\"CONTAINS[cd]\", 0);\n    test(@\"CONTAINS\", @\"a\", 25);\n    test(@\"CONTAINS\", @\"á\", 25);\n    test(@\"CONTAINS[c]\", @\"a\", 50);\n    test(@\"CONTAINS[c]\", @\"á\", 50);\n    test(@\"CONTAINS\", @\"A\", 25);\n    test(@\"CONTAINS\", @\"Á\", 25);\n    test(@\"CONTAINS[c]\", @\"A\", 50);\n    test(@\"CONTAINS[c]\", @\"Á\", 50);\n    test(@\"CONTAINS[d]\", @\"a\", 50);\n    test(@\"CONTAINS[d]\", @\"á\", 50);\n    test(@\"CONTAINS[cd]\", @\"a\", 100);\n    test(@\"CONTAINS[cd]\", @\"á\", 100);\n    test(@\"CONTAINS[d]\", @\"A\", 50);\n    test(@\"CONTAINS[d]\", @\"Á\", 50);\n    test(@\"CONTAINS[cd]\", @\"A\", 100);\n    test(@\"CONTAINS[cd]\", @\"Á\", 100);\n\n    test(@\"BEGINSWITH\", @\"a\", 13);\n    test(@\"BEGINSWITH\", @\"á\", 13);\n    test(@\"BEGINSWITH[c]\", @\"a\", 26);\n    test(@\"BEGINSWITH[c]\", @\"á\", 26);\n    test(@\"BEGINSWITH\", @\"A\", 13);\n    test(@\"BEGINSWITH\", @\"Á\", 13);\n    test(@\"BEGINSWITH[c]\", @\"A\", 26);\n    test(@\"BEGINSWITH[c]\", @\"Á\", 26);\n    test(@\"BEGINSWITH[d]\", @\"a\", 26);\n    test(@\"BEGINSWITH[d]\", @\"á\", 26);\n    test(@\"BEGINSWITH[cd]\", @\"a\", 52);\n    test(@\"BEGINSWITH[cd]\", @\"á\", 52);\n    test(@\"BEGINSWITH[d]\", @\"A\", 26);\n    test(@\"BEGINSWITH[d]\", @\"Á\", 26);\n    test(@\"BEGINSWITH[cd]\", @\"A\", 52);\n    test(@\"BEGINSWITH[cd]\", @\"Á\", 52);\n\n    test(@\"ENDSWITH\", @\"a\", 13);\n    test(@\"ENDSWITH\", @\"á\", 13);\n    test(@\"ENDSWITH[c]\", @\"a\", 26);\n    test(@\"ENDSWITH[c]\", @\"á\", 26);\n    test(@\"ENDSWITH\", @\"A\", 13);\n    test(@\"ENDSWITH\", @\"Á\", 13);\n    test(@\"ENDSWITH[c]\", @\"A\", 26);\n    test(@\"ENDSWITH[c]\", @\"Á\", 26);\n    test(@\"ENDSWITH[d]\", @\"a\", 26);\n    test(@\"ENDSWITH[d]\", @\"á\", 26);\n    test(@\"ENDSWITH[cd]\", @\"a\", 52);\n    test(@\"ENDSWITH[cd]\", @\"á\", 52);\n    test(@\"ENDSWITH[d]\", @\"A\", 26);\n    test(@\"ENDSWITH[d]\", @\"Á\", 26);\n    test(@\"ENDSWITH[cd]\", @\"A\", 52);\n    test(@\"ENDSWITH[cd]\", @\"Á\", 52);\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/PrimitiveRLMValuePropertyTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\nstatic NSDate *date(int i) {\n    return [NSDate dateWithTimeIntervalSince1970:i];\n}\n\nstatic NSData *data(int i) {\n    return [NSData dataWithBytesNoCopy:calloc(i, 1) length:i freeWhenDone:YES];\n}\n\nstatic RLMDecimal128 *decimal128(int i) {\n    return [RLMDecimal128 decimalWithNumber:@(i)];\n}\n\nstatic NSUUID *uuid(NSString *uuidString) {\n    return [[NSUUID alloc] initWithUUIDString:uuidString];\n}\n\nstatic NSMutableArray *objectIds;\nstatic RLMObjectId *objectId(NSUInteger i) {\n    if (!objectIds) {\n        objectIds = [NSMutableArray new];\n    }\n    while (i >= objectIds.count) {\n        [objectIds addObject:RLMObjectId.objectId];\n    }\n    return objectIds[i];\n}\n\n@interface PrimitiveRLMValuePropertyTests : RLMTestCase\n@end\n\n@implementation PrimitiveRLMValuePropertyTests {\n    AllPrimitiveRLMValues *unmanaged;\n    AllPrimitiveRLMValues *managed;\n    RLMRealm *realm;\n    RLMArray<RLMValue> *allMixed;\n    NSArray *allVals;\n}\n\n- (void)setUp {\n    realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    [self initValues];\n    [allMixed addObjects:@[\n        unmanaged.boolVal,\n        unmanaged.intVal,\n        unmanaged.floatVal,\n        unmanaged.doubleVal,\n        unmanaged.stringVal,\n        unmanaged.dataVal,\n        unmanaged.dateVal,\n        unmanaged.decimalVal,\n        unmanaged.objectIdVal,\n        unmanaged.uuidVal,\n        managed.boolVal,\n        managed.intVal,\n        managed.floatVal,\n        managed.doubleVal,\n        managed.stringVal,\n        managed.dataVal,\n        managed.dateVal,\n        managed.decimalVal,\n        managed.objectIdVal,\n        managed.uuidVal,\n    ]];\n}\n\n- (void)tearDown {\n    if (realm.inWriteTransaction) {\n        [realm cancelWriteTransaction];\n    }\n}\n\n- (void)initValues {\n    unmanaged = [[AllPrimitiveRLMValues alloc] initWithValue:@{\n        @\"boolVal\": @NO,\n        @\"intVal\": @2,\n        @\"floatVal\": @2.2f,\n        @\"doubleVal\": @2.2,\n        @\"stringVal\": @\"a\",\n        @\"dataVal\": data(1),\n        @\"dateVal\": date(1),\n        @\"decimalVal\": decimal128(2),\n        @\"objectIdVal\": objectId(1),\n        @\"uuidVal\": uuid(@\"00000000-0000-0000-0000-000000000000\"),\n    }];\n    XCTAssertNil(unmanaged.realm);\n    \n    managed = [AllPrimitiveRLMValues createInRealm:realm withValue:@{\n        @\"boolVal\": @NO,\n        @\"intVal\": @2,\n        @\"floatVal\": @2.2f,\n        @\"doubleVal\": @2.2,\n        @\"stringVal\": @\"a\",\n        @\"dataVal\": data(1),\n        @\"dateVal\": date(1),\n        @\"decimalVal\": decimal128(2),\n        @\"objectIdVal\": objectId(1),\n        @\"uuidVal\": uuid(@\"00000000-0000-0000-0000-000000000000\"),\n    }];\n    XCTAssertNotNil(managed.realm);\n    \n    XCTAssert([(NSNumber *)unmanaged.boolVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)unmanaged.intVal isEqual:@2]);\n    XCTAssert([(NSNumber *)unmanaged.floatVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)unmanaged.doubleVal isEqual:@2.2]);\n    XCTAssert([(NSString *)unmanaged.stringVal isEqual:@\"a\"]);\n    XCTAssert([(NSData *)unmanaged.dataVal isEqual:data(1)]);\n    XCTAssert([(NSDate *)unmanaged.dateVal isEqual:date(1)]);\n    XCTAssert([(RLMDecimal128 *)unmanaged.decimalVal isEqual:decimal128(2)]);\n    XCTAssert([(RLMObjectId *)unmanaged.objectIdVal isEqual:objectId(1)]);\n    XCTAssert([(NSUUID *)unmanaged.uuidVal isEqual:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    XCTAssert([(NSNumber *)managed.boolVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)managed.intVal isEqual:@2]);\n    XCTAssert([(NSNumber *)managed.floatVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)managed.doubleVal isEqual:@2.2]);\n    XCTAssert([(NSString *)managed.stringVal isEqual:@\"a\"]);\n    XCTAssert([(NSData *)managed.dataVal isEqual:data(1)]);\n    XCTAssert([(NSDate *)managed.dateVal isEqual:date(1)]);\n    XCTAssert([(RLMDecimal128 *)managed.decimalVal isEqual:decimal128(2)]);\n    XCTAssert([(RLMObjectId *)managed.objectIdVal isEqual:objectId(1)]);\n    XCTAssert([(NSUUID *)managed.uuidVal isEqual:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n}\n\n- (void)testType {\n    XCTAssertEqual(unmanaged.boolVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(unmanaged.intVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(unmanaged.floatVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(unmanaged.doubleVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(unmanaged.stringVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(unmanaged.dataVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(unmanaged.dateVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(managed.boolVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(managed.intVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(managed.floatVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(managed.doubleVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(managed.stringVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(managed.dataVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(managed.dateVal.rlm_anyValueType, RLMAnyValueTypeDate);\n}\n\n- (void)testInitNull {\n    AllPrimitiveRLMValues *unman = [[AllPrimitiveRLMValues alloc] init];\n    AllPrimitiveRLMValues *man = [AllPrimitiveRLMValues createInRealm:realm withValue:@[]];\n    \n    XCTAssertNil(unman.boolVal, @\"RLMValue should be able to initialize as null\");\n    XCTAssertNil(unman.intVal, @\"RLMValue should be able to initialize as null\");\n    XCTAssertNil(unman.floatVal, @\"RLMValue should be able to initialize as null\");\n    XCTAssertNil(unman.doubleVal, @\"RLMValue should be able to initialize as null\");\n    XCTAssertNil(unman.stringVal, @\"RLMValue should be able to initialize as null\");\n    XCTAssertNil(unman.dataVal, @\"RLMValue should be able to initialize as null\");\n    XCTAssertNil(unman.dateVal, @\"RLMValue should be able to initialize as null\");\n    XCTAssertNil(unman.decimalVal, @\"RLMValue should be able to initialize as null\");\n    XCTAssertNil(unman.objectIdVal, @\"RLMValue should be able to initialize as null\");\n    XCTAssertNil(unman.uuidVal, @\"RLMValue should be able to initialize as null\");\n    XCTAssertNil(man.boolVal, @\"RLMValue should be able to initialize as null\");\n    XCTAssertNil(man.intVal, @\"RLMValue should be able to initialize as null\");\n    XCTAssertNil(man.floatVal, @\"RLMValue should be able to initialize as null\");\n    XCTAssertNil(man.doubleVal, @\"RLMValue should be able to initialize as null\");\n    XCTAssertNil(man.stringVal, @\"RLMValue should be able to initialize as null\");\n    XCTAssertNil(man.dataVal, @\"RLMValue should be able to initialize as null\");\n    XCTAssertNil(man.dateVal, @\"RLMValue should be able to initialize as null\");\n    XCTAssertNil(man.decimalVal, @\"RLMValue should be able to initialize as null\");\n    XCTAssertNil(man.objectIdVal, @\"RLMValue should be able to initialize as null\");\n    XCTAssertNil(man.uuidVal, @\"RLMValue should be able to initialize as null\");\n}\n\n- (void)testUpdateBoolType {\n    unmanaged.boolVal = @NO;\n    unmanaged.intVal = @NO;\n    unmanaged.floatVal = @NO;\n    unmanaged.doubleVal = @NO;\n    unmanaged.stringVal = @NO;\n    unmanaged.dataVal = @NO;\n    unmanaged.dateVal = @NO;\n    unmanaged.decimalVal = @NO;\n    unmanaged.objectIdVal = @NO;\n    unmanaged.uuidVal = @NO;\n    managed.boolVal = @NO;\n    managed.intVal = @NO;\n    managed.floatVal = @NO;\n    managed.doubleVal = @NO;\n    managed.stringVal = @NO;\n    managed.dataVal = @NO;\n    managed.dateVal = @NO;\n    managed.decimalVal = @NO;\n    managed.objectIdVal = @NO;\n    managed.uuidVal = @NO;\n    XCTAssert([(NSNumber *)unmanaged.boolVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)unmanaged.intVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)unmanaged.floatVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)unmanaged.doubleVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)unmanaged.stringVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)unmanaged.dataVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)unmanaged.dateVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)unmanaged.decimalVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)unmanaged.objectIdVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)unmanaged.uuidVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)managed.boolVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)managed.intVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)managed.floatVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)managed.doubleVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)managed.stringVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)managed.dataVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)managed.dateVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)managed.decimalVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)managed.objectIdVal isEqual:@NO]);\n    XCTAssert([(NSNumber *)managed.uuidVal isEqual:@NO]);\n    XCTAssertEqual(unmanaged.boolVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(unmanaged.intVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(unmanaged.floatVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(unmanaged.doubleVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(unmanaged.stringVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(unmanaged.dataVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(unmanaged.dateVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(unmanaged.decimalVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(unmanaged.objectIdVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(unmanaged.uuidVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(managed.boolVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(managed.intVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(managed.floatVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(managed.doubleVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(managed.stringVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(managed.dataVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(managed.dateVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(managed.decimalVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(managed.objectIdVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(managed.uuidVal.rlm_anyValueType, RLMAnyValueTypeBool);\n}\n\n- (void)testUpdateIntType {\n    unmanaged.boolVal = @2;\n    unmanaged.intVal = @2;\n    unmanaged.floatVal = @2;\n    unmanaged.doubleVal = @2;\n    unmanaged.stringVal = @2;\n    unmanaged.dataVal = @2;\n    unmanaged.dateVal = @2;\n    unmanaged.decimalVal = @2;\n    unmanaged.objectIdVal = @2;\n    unmanaged.uuidVal = @2;\n    managed.boolVal = @2;\n    managed.intVal = @2;\n    managed.floatVal = @2;\n    managed.doubleVal = @2;\n    managed.stringVal = @2;\n    managed.dataVal = @2;\n    managed.dateVal = @2;\n    managed.decimalVal = @2;\n    managed.objectIdVal = @2;\n    managed.uuidVal = @2;\n    XCTAssert([(NSNumber *)unmanaged.boolVal isEqual:@2]);\n    XCTAssert([(NSNumber *)unmanaged.intVal isEqual:@2]);\n    XCTAssert([(NSNumber *)unmanaged.floatVal isEqual:@2]);\n    XCTAssert([(NSNumber *)unmanaged.doubleVal isEqual:@2]);\n    XCTAssert([(NSNumber *)unmanaged.stringVal isEqual:@2]);\n    XCTAssert([(NSNumber *)unmanaged.dataVal isEqual:@2]);\n    XCTAssert([(NSNumber *)unmanaged.dateVal isEqual:@2]);\n    XCTAssert([(NSNumber *)unmanaged.decimalVal isEqual:@2]);\n    XCTAssert([(NSNumber *)unmanaged.objectIdVal isEqual:@2]);\n    XCTAssert([(NSNumber *)unmanaged.uuidVal isEqual:@2]);\n    XCTAssert([(NSNumber *)managed.boolVal isEqual:@2]);\n    XCTAssert([(NSNumber *)managed.intVal isEqual:@2]);\n    XCTAssert([(NSNumber *)managed.floatVal isEqual:@2]);\n    XCTAssert([(NSNumber *)managed.doubleVal isEqual:@2]);\n    XCTAssert([(NSNumber *)managed.stringVal isEqual:@2]);\n    XCTAssert([(NSNumber *)managed.dataVal isEqual:@2]);\n    XCTAssert([(NSNumber *)managed.dateVal isEqual:@2]);\n    XCTAssert([(NSNumber *)managed.decimalVal isEqual:@2]);\n    XCTAssert([(NSNumber *)managed.objectIdVal isEqual:@2]);\n    XCTAssert([(NSNumber *)managed.uuidVal isEqual:@2]);\n    XCTAssertEqual(unmanaged.boolVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(unmanaged.intVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(unmanaged.floatVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(unmanaged.doubleVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(unmanaged.stringVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(unmanaged.dataVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(unmanaged.dateVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(unmanaged.decimalVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(unmanaged.objectIdVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(unmanaged.uuidVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(managed.boolVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(managed.intVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(managed.floatVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(managed.doubleVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(managed.stringVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(managed.dataVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(managed.dateVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(managed.decimalVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(managed.objectIdVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(managed.uuidVal.rlm_anyValueType, RLMAnyValueTypeInt);\n}\n\n- (void)testUpdateFloatType {\n    unmanaged.boolVal = @2.2f;\n    unmanaged.intVal = @2.2f;\n    unmanaged.floatVal = @2.2f;\n    unmanaged.doubleVal = @2.2f;\n    unmanaged.stringVal = @2.2f;\n    unmanaged.dataVal = @2.2f;\n    unmanaged.dateVal = @2.2f;\n    unmanaged.decimalVal = @2.2f;\n    unmanaged.objectIdVal = @2.2f;\n    unmanaged.uuidVal = @2.2f;\n    managed.boolVal = @2.2f;\n    managed.intVal = @2.2f;\n    managed.floatVal = @2.2f;\n    managed.doubleVal = @2.2f;\n    managed.stringVal = @2.2f;\n    managed.dataVal = @2.2f;\n    managed.dateVal = @2.2f;\n    managed.decimalVal = @2.2f;\n    managed.objectIdVal = @2.2f;\n    managed.uuidVal = @2.2f;\n    XCTAssert([(NSNumber *)unmanaged.boolVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)unmanaged.intVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)unmanaged.floatVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)unmanaged.doubleVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)unmanaged.stringVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)unmanaged.dataVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)unmanaged.dateVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)unmanaged.decimalVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)unmanaged.objectIdVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)unmanaged.uuidVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)managed.boolVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)managed.intVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)managed.floatVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)managed.doubleVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)managed.stringVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)managed.dataVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)managed.dateVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)managed.decimalVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)managed.objectIdVal isEqual:@2.2f]);\n    XCTAssert([(NSNumber *)managed.uuidVal isEqual:@2.2f]);\n    XCTAssertEqual(unmanaged.boolVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(unmanaged.intVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(unmanaged.floatVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(unmanaged.doubleVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(unmanaged.stringVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(unmanaged.dataVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(unmanaged.dateVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(unmanaged.decimalVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(unmanaged.objectIdVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(unmanaged.uuidVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(managed.boolVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(managed.intVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(managed.floatVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(managed.doubleVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(managed.stringVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(managed.dataVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(managed.dateVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(managed.decimalVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(managed.objectIdVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(managed.uuidVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n}\n\n- (void)testUpdateDoubleType {\n    unmanaged.boolVal = @3.3;\n    unmanaged.intVal = @3.3;\n    unmanaged.floatVal = @3.3;\n    unmanaged.doubleVal = @3.3;\n    unmanaged.stringVal = @3.3;\n    unmanaged.dataVal = @3.3;\n    unmanaged.dateVal = @3.3;\n    unmanaged.decimalVal = @3.3;\n    unmanaged.objectIdVal = @3.3;\n    unmanaged.uuidVal = @3.3;\n    managed.boolVal = @3.3;\n    managed.intVal = @3.3;\n    managed.floatVal = @3.3;\n    managed.doubleVal = @3.3;\n    managed.stringVal = @3.3;\n    managed.dataVal = @3.3;\n    managed.dateVal = @3.3;\n    managed.decimalVal = @3.3;\n    managed.objectIdVal = @3.3;\n    managed.uuidVal = @3.3;\n    XCTAssert([(NSNumber *)unmanaged.boolVal isEqual:@3.3]);\n    XCTAssert([(NSNumber *)unmanaged.intVal isEqual:@3.3]);\n    XCTAssert([(NSNumber *)unmanaged.floatVal isEqual:@3.3]);\n    XCTAssert([(NSNumber *)unmanaged.doubleVal isEqual:@3.3]);\n    XCTAssert([(NSNumber *)unmanaged.stringVal isEqual:@3.3]);\n    XCTAssert([(NSNumber *)unmanaged.dataVal isEqual:@3.3]);\n    XCTAssert([(NSNumber *)unmanaged.dateVal isEqual:@3.3]);\n    XCTAssert([(NSNumber *)unmanaged.decimalVal isEqual:@3.3]);\n    XCTAssert([(NSNumber *)unmanaged.objectIdVal isEqual:@3.3]);\n    XCTAssert([(NSNumber *)unmanaged.uuidVal isEqual:@3.3]);\n    XCTAssert([(NSNumber *)managed.boolVal isEqual:@3.3]);\n    XCTAssert([(NSNumber *)managed.intVal isEqual:@3.3]);\n    XCTAssert([(NSNumber *)managed.floatVal isEqual:@3.3]);\n    XCTAssert([(NSNumber *)managed.doubleVal isEqual:@3.3]);\n    XCTAssert([(NSNumber *)managed.stringVal isEqual:@3.3]);\n    XCTAssert([(NSNumber *)managed.dataVal isEqual:@3.3]);\n    XCTAssert([(NSNumber *)managed.dateVal isEqual:@3.3]);\n    XCTAssert([(NSNumber *)managed.decimalVal isEqual:@3.3]);\n    XCTAssert([(NSNumber *)managed.objectIdVal isEqual:@3.3]);\n    XCTAssert([(NSNumber *)managed.uuidVal isEqual:@3.3]);\n    XCTAssertEqual(unmanaged.boolVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(unmanaged.intVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(unmanaged.floatVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(unmanaged.doubleVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(unmanaged.stringVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(unmanaged.dataVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(unmanaged.dateVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(unmanaged.decimalVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(unmanaged.objectIdVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(unmanaged.uuidVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(managed.boolVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(managed.intVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(managed.floatVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(managed.doubleVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(managed.stringVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(managed.dataVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(managed.dateVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(managed.decimalVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(managed.objectIdVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(managed.uuidVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n}\n\n- (void)testUpdateStringType {\n    unmanaged.boolVal = @\"four\";\n    unmanaged.intVal = @\"four\";\n    unmanaged.floatVal = @\"four\";\n    unmanaged.doubleVal = @\"four\";\n    unmanaged.stringVal = @\"four\";\n    unmanaged.dataVal = @\"four\";\n    unmanaged.dateVal = @\"four\";\n    unmanaged.decimalVal = @\"four\";\n    unmanaged.objectIdVal = @\"four\";\n    unmanaged.uuidVal = @\"four\";\n    managed.boolVal = @\"four\";\n    managed.intVal = @\"four\";\n    managed.floatVal = @\"four\";\n    managed.doubleVal = @\"four\";\n    managed.stringVal = @\"four\";\n    managed.dataVal = @\"four\";\n    managed.dateVal = @\"four\";\n    managed.decimalVal = @\"four\";\n    managed.objectIdVal = @\"four\";\n    managed.uuidVal = @\"four\";\n    XCTAssert([(NSNumber *)unmanaged.boolVal isEqual:@\"four\"]);\n    XCTAssert([(NSNumber *)unmanaged.intVal isEqual:@\"four\"]);\n    XCTAssert([(NSNumber *)unmanaged.floatVal isEqual:@\"four\"]);\n    XCTAssert([(NSNumber *)unmanaged.doubleVal isEqual:@\"four\"]);\n    XCTAssert([(NSNumber *)unmanaged.stringVal isEqual:@\"four\"]);\n    XCTAssert([(NSNumber *)unmanaged.dataVal isEqual:@\"four\"]);\n    XCTAssert([(NSNumber *)unmanaged.dateVal isEqual:@\"four\"]);\n    XCTAssert([(NSNumber *)unmanaged.decimalVal isEqual:@\"four\"]);\n    XCTAssert([(NSNumber *)unmanaged.objectIdVal isEqual:@\"four\"]);\n    XCTAssert([(NSNumber *)unmanaged.uuidVal isEqual:@\"four\"]);\n    XCTAssert([(NSNumber *)managed.boolVal isEqual:@\"four\"]);\n    XCTAssert([(NSNumber *)managed.intVal isEqual:@\"four\"]);\n    XCTAssert([(NSNumber *)managed.floatVal isEqual:@\"four\"]);\n    XCTAssert([(NSNumber *)managed.doubleVal isEqual:@\"four\"]);\n    XCTAssert([(NSNumber *)managed.stringVal isEqual:@\"four\"]);\n    XCTAssert([(NSNumber *)managed.dataVal isEqual:@\"four\"]);\n    XCTAssert([(NSNumber *)managed.dateVal isEqual:@\"four\"]);\n    XCTAssert([(NSNumber *)managed.decimalVal isEqual:@\"four\"]);\n    XCTAssert([(NSNumber *)managed.objectIdVal isEqual:@\"four\"]);\n    XCTAssert([(NSNumber *)managed.uuidVal isEqual:@\"four\"]);\n    XCTAssertEqual(unmanaged.boolVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(unmanaged.intVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(unmanaged.floatVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(unmanaged.doubleVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(unmanaged.stringVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(unmanaged.dataVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(unmanaged.dateVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(unmanaged.decimalVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(unmanaged.objectIdVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(unmanaged.uuidVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(managed.boolVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(managed.intVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(managed.floatVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(managed.doubleVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(managed.stringVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(managed.dataVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(managed.dateVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(managed.decimalVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(managed.objectIdVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(managed.uuidVal.rlm_anyValueType, RLMAnyValueTypeString);\n}\n\n- (void)testUpdateDataType {\n    unmanaged.boolVal = data(5);\n    unmanaged.intVal = data(5);\n    unmanaged.floatVal = data(5);\n    unmanaged.doubleVal = data(5);\n    unmanaged.stringVal = data(5);\n    unmanaged.dataVal = data(5);\n    unmanaged.dateVal = data(5);\n    unmanaged.decimalVal = data(5);\n    unmanaged.objectIdVal = data(5);\n    unmanaged.uuidVal = data(5);\n    managed.boolVal = data(5);\n    managed.intVal = data(5);\n    managed.floatVal = data(5);\n    managed.doubleVal = data(5);\n    managed.stringVal = data(5);\n    managed.dataVal = data(5);\n    managed.dateVal = data(5);\n    managed.decimalVal = data(5);\n    managed.objectIdVal = data(5);\n    managed.uuidVal = data(5);\n    XCTAssert([(NSNumber *)unmanaged.boolVal isEqual:data(5)]);\n    XCTAssert([(NSNumber *)unmanaged.intVal isEqual:data(5)]);\n    XCTAssert([(NSNumber *)unmanaged.floatVal isEqual:data(5)]);\n    XCTAssert([(NSNumber *)unmanaged.doubleVal isEqual:data(5)]);\n    XCTAssert([(NSNumber *)unmanaged.stringVal isEqual:data(5)]);\n    XCTAssert([(NSNumber *)unmanaged.dataVal isEqual:data(5)]);\n    XCTAssert([(NSNumber *)unmanaged.dateVal isEqual:data(5)]);\n    XCTAssert([(NSNumber *)unmanaged.decimalVal isEqual:data(5)]);\n    XCTAssert([(NSNumber *)unmanaged.objectIdVal isEqual:data(5)]);\n    XCTAssert([(NSNumber *)unmanaged.uuidVal isEqual:data(5)]);\n    XCTAssert([(NSNumber *)managed.boolVal isEqual:data(5)]);\n    XCTAssert([(NSNumber *)managed.intVal isEqual:data(5)]);\n    XCTAssert([(NSNumber *)managed.floatVal isEqual:data(5)]);\n    XCTAssert([(NSNumber *)managed.doubleVal isEqual:data(5)]);\n    XCTAssert([(NSNumber *)managed.stringVal isEqual:data(5)]);\n    XCTAssert([(NSNumber *)managed.dataVal isEqual:data(5)]);\n    XCTAssert([(NSNumber *)managed.dateVal isEqual:data(5)]);\n    XCTAssert([(NSNumber *)managed.decimalVal isEqual:data(5)]);\n    XCTAssert([(NSNumber *)managed.objectIdVal isEqual:data(5)]);\n    XCTAssert([(NSNumber *)managed.uuidVal isEqual:data(5)]);\n    XCTAssertEqual(unmanaged.boolVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(unmanaged.intVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(unmanaged.floatVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(unmanaged.doubleVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(unmanaged.stringVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(unmanaged.dataVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(unmanaged.dateVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(unmanaged.decimalVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(unmanaged.objectIdVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(unmanaged.uuidVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(managed.boolVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(managed.intVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(managed.floatVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(managed.doubleVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(managed.stringVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(managed.dataVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(managed.dateVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(managed.decimalVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(managed.objectIdVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(managed.uuidVal.rlm_anyValueType, RLMAnyValueTypeData);\n}\n\n- (void)testUpdateDateType {\n    unmanaged.boolVal = date(6);\n    unmanaged.intVal = date(6);\n    unmanaged.floatVal = date(6);\n    unmanaged.doubleVal = date(6);\n    unmanaged.stringVal = date(6);\n    unmanaged.dataVal = date(6);\n    unmanaged.dateVal = date(6);\n    unmanaged.decimalVal = date(6);\n    unmanaged.objectIdVal = date(6);\n    unmanaged.uuidVal = date(6);\n    managed.boolVal = date(6);\n    managed.intVal = date(6);\n    managed.floatVal = date(6);\n    managed.doubleVal = date(6);\n    managed.stringVal = date(6);\n    managed.dataVal = date(6);\n    managed.dateVal = date(6);\n    managed.decimalVal = date(6);\n    managed.objectIdVal = date(6);\n    managed.uuidVal = date(6);\n    XCTAssert([(NSNumber *)unmanaged.boolVal isEqual:date(6)]);\n    XCTAssert([(NSNumber *)unmanaged.intVal isEqual:date(6)]);\n    XCTAssert([(NSNumber *)unmanaged.floatVal isEqual:date(6)]);\n    XCTAssert([(NSNumber *)unmanaged.doubleVal isEqual:date(6)]);\n    XCTAssert([(NSNumber *)unmanaged.stringVal isEqual:date(6)]);\n    XCTAssert([(NSNumber *)unmanaged.dataVal isEqual:date(6)]);\n    XCTAssert([(NSNumber *)unmanaged.dateVal isEqual:date(6)]);\n    XCTAssert([(NSNumber *)unmanaged.decimalVal isEqual:date(6)]);\n    XCTAssert([(NSNumber *)unmanaged.objectIdVal isEqual:date(6)]);\n    XCTAssert([(NSNumber *)unmanaged.uuidVal isEqual:date(6)]);\n    XCTAssert([(NSNumber *)managed.boolVal isEqual:date(6)]);\n    XCTAssert([(NSNumber *)managed.intVal isEqual:date(6)]);\n    XCTAssert([(NSNumber *)managed.floatVal isEqual:date(6)]);\n    XCTAssert([(NSNumber *)managed.doubleVal isEqual:date(6)]);\n    XCTAssert([(NSNumber *)managed.stringVal isEqual:date(6)]);\n    XCTAssert([(NSNumber *)managed.dataVal isEqual:date(6)]);\n    XCTAssert([(NSNumber *)managed.dateVal isEqual:date(6)]);\n    XCTAssert([(NSNumber *)managed.decimalVal isEqual:date(6)]);\n    XCTAssert([(NSNumber *)managed.objectIdVal isEqual:date(6)]);\n    XCTAssert([(NSNumber *)managed.uuidVal isEqual:date(6)]);\n    XCTAssertEqual(unmanaged.boolVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(unmanaged.intVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(unmanaged.floatVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(unmanaged.doubleVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(unmanaged.stringVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(unmanaged.dataVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(unmanaged.dateVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(unmanaged.decimalVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(unmanaged.objectIdVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(unmanaged.uuidVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(managed.boolVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(managed.intVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(managed.floatVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(managed.doubleVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(managed.stringVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(managed.dataVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(managed.dateVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(managed.decimalVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(managed.objectIdVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(managed.uuidVal.rlm_anyValueType, RLMAnyValueTypeDate);\n}\n\n- (void)testUpdateDecimal {\n    unmanaged.boolVal = decimal128(7);\n    unmanaged.intVal = decimal128(7);\n    unmanaged.floatVal = decimal128(7);\n    unmanaged.doubleVal = decimal128(7);\n    unmanaged.stringVal = decimal128(7);\n    unmanaged.dataVal = decimal128(7);\n    unmanaged.dateVal = decimal128(7);\n    unmanaged.decimalVal = decimal128(7);\n    unmanaged.objectIdVal = decimal128(7);\n    unmanaged.uuidVal = decimal128(7);\n    managed.boolVal = decimal128(7);\n    managed.intVal = decimal128(7);\n    managed.floatVal = decimal128(7);\n    managed.doubleVal = decimal128(7);\n    managed.stringVal = decimal128(7);\n    managed.dataVal = decimal128(7);\n    managed.dateVal = decimal128(7);\n    managed.decimalVal = decimal128(7);\n    managed.objectIdVal = decimal128(7);\n    managed.uuidVal = decimal128(7);\n    XCTAssert([(NSNumber *)unmanaged.boolVal isEqual:decimal128(7)]);\n    XCTAssert([(NSNumber *)unmanaged.intVal isEqual:decimal128(7)]);\n    XCTAssert([(NSNumber *)unmanaged.floatVal isEqual:decimal128(7)]);\n    XCTAssert([(NSNumber *)unmanaged.doubleVal isEqual:decimal128(7)]);\n    XCTAssert([(NSNumber *)unmanaged.stringVal isEqual:decimal128(7)]);\n    XCTAssert([(NSNumber *)unmanaged.dataVal isEqual:decimal128(7)]);\n    XCTAssert([(NSNumber *)unmanaged.dateVal isEqual:decimal128(7)]);\n    XCTAssert([(NSNumber *)unmanaged.decimalVal isEqual:decimal128(7)]);\n    XCTAssert([(NSNumber *)unmanaged.objectIdVal isEqual:decimal128(7)]);\n    XCTAssert([(NSNumber *)unmanaged.uuidVal isEqual:decimal128(7)]);\n    XCTAssert([(NSNumber *)managed.boolVal isEqual:decimal128(7)]);\n    XCTAssert([(NSNumber *)managed.intVal isEqual:decimal128(7)]);\n    XCTAssert([(NSNumber *)managed.floatVal isEqual:decimal128(7)]);\n    XCTAssert([(NSNumber *)managed.doubleVal isEqual:decimal128(7)]);\n    XCTAssert([(NSNumber *)managed.stringVal isEqual:decimal128(7)]);\n    XCTAssert([(NSNumber *)managed.dataVal isEqual:decimal128(7)]);\n    XCTAssert([(NSNumber *)managed.dateVal isEqual:decimal128(7)]);\n    XCTAssert([(NSNumber *)managed.decimalVal isEqual:decimal128(7)]);\n    XCTAssert([(NSNumber *)managed.objectIdVal isEqual:decimal128(7)]);\n    XCTAssert([(NSNumber *)managed.uuidVal isEqual:decimal128(7)]);\n    XCTAssertEqual(unmanaged.boolVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(unmanaged.intVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(unmanaged.floatVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(unmanaged.doubleVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(unmanaged.stringVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(unmanaged.dataVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(unmanaged.dateVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(unmanaged.decimalVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(unmanaged.objectIdVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(unmanaged.uuidVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(managed.boolVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(managed.intVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(managed.floatVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(managed.doubleVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(managed.stringVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(managed.dataVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(managed.dateVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(managed.decimalVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(managed.objectIdVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(managed.uuidVal.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n}\n\n- (void)testUpdateObjectIdType {\n    unmanaged.boolVal = objectId(8);\n    unmanaged.intVal = objectId(8);\n    unmanaged.floatVal = objectId(8);\n    unmanaged.doubleVal = objectId(8);\n    unmanaged.stringVal = objectId(8);\n    unmanaged.dataVal = objectId(8);\n    unmanaged.dateVal = objectId(8);\n    unmanaged.decimalVal = objectId(8);\n    unmanaged.objectIdVal = objectId(8);\n    unmanaged.uuidVal = objectId(8);\n    managed.boolVal = objectId(8);\n    managed.intVal = objectId(8);\n    managed.floatVal = objectId(8);\n    managed.doubleVal = objectId(8);\n    managed.stringVal = objectId(8);\n    managed.dataVal = objectId(8);\n    managed.dateVal = objectId(8);\n    managed.decimalVal = objectId(8);\n    managed.objectIdVal = objectId(8);\n    managed.uuidVal = objectId(8);\n    XCTAssert([(NSUUID *)unmanaged.boolVal isEqual:objectId(8)]);\n    XCTAssert([(NSUUID *)unmanaged.intVal isEqual:objectId(8)]);\n    XCTAssert([(NSUUID *)unmanaged.floatVal isEqual:objectId(8)]);\n    XCTAssert([(NSUUID *)unmanaged.doubleVal isEqual:objectId(8)]);\n    XCTAssert([(NSUUID *)unmanaged.stringVal isEqual:objectId(8)]);\n    XCTAssert([(NSUUID *)unmanaged.dataVal isEqual:objectId(8)]);\n    XCTAssert([(NSUUID *)unmanaged.dateVal isEqual:objectId(8)]);\n    XCTAssert([(NSUUID *)unmanaged.decimalVal isEqual:objectId(8)]);\n    XCTAssert([(NSUUID *)unmanaged.objectIdVal isEqual:objectId(8)]);\n    XCTAssert([(NSUUID *)unmanaged.uuidVal isEqual:objectId(8)]);\n    XCTAssert([(NSUUID *)managed.boolVal isEqual:objectId(8)]);\n    XCTAssert([(NSUUID *)managed.intVal isEqual:objectId(8)]);\n    XCTAssert([(NSUUID *)managed.floatVal isEqual:objectId(8)]);\n    XCTAssert([(NSUUID *)managed.doubleVal isEqual:objectId(8)]);\n    XCTAssert([(NSUUID *)managed.stringVal isEqual:objectId(8)]);\n    XCTAssert([(NSUUID *)managed.dataVal isEqual:objectId(8)]);\n    XCTAssert([(NSUUID *)managed.dateVal isEqual:objectId(8)]);\n    XCTAssert([(NSUUID *)managed.decimalVal isEqual:objectId(8)]);\n    XCTAssert([(NSUUID *)managed.objectIdVal isEqual:objectId(8)]);\n    XCTAssert([(NSUUID *)managed.uuidVal isEqual:objectId(8)]);\n    XCTAssertEqual(unmanaged.boolVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(unmanaged.intVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(unmanaged.floatVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(unmanaged.doubleVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(unmanaged.stringVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(unmanaged.dataVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(unmanaged.dateVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(unmanaged.decimalVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(unmanaged.objectIdVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(unmanaged.uuidVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(managed.boolVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(managed.intVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(managed.floatVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(managed.doubleVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(managed.stringVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(managed.dataVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(managed.dateVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(managed.decimalVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(managed.objectIdVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(managed.uuidVal.rlm_anyValueType, RLMAnyValueTypeObjectId);\n}\n\n- (void)testUpdateUuidType {\n    unmanaged.boolVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    unmanaged.intVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    unmanaged.floatVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    unmanaged.doubleVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    unmanaged.stringVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    unmanaged.dataVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    unmanaged.dateVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    unmanaged.decimalVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    unmanaged.objectIdVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    unmanaged.uuidVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    managed.boolVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    managed.intVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    managed.floatVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    managed.doubleVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    managed.stringVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    managed.dataVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    managed.dateVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    managed.decimalVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    managed.objectIdVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    managed.uuidVal = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    XCTAssert([(NSUUID *)unmanaged.boolVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssert([(NSUUID *)unmanaged.intVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssert([(NSUUID *)unmanaged.floatVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssert([(NSUUID *)unmanaged.doubleVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssert([(NSUUID *)unmanaged.stringVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssert([(NSUUID *)unmanaged.dataVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssert([(NSUUID *)unmanaged.dateVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssert([(NSUUID *)unmanaged.decimalVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssert([(NSUUID *)unmanaged.objectIdVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssert([(NSUUID *)unmanaged.uuidVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssert([(NSUUID *)managed.boolVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssert([(NSUUID *)managed.intVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssert([(NSUUID *)managed.floatVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssert([(NSUUID *)managed.doubleVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssert([(NSUUID *)managed.stringVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssert([(NSUUID *)managed.dataVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssert([(NSUUID *)managed.dateVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssert([(NSUUID *)managed.decimalVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssert([(NSUUID *)managed.objectIdVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssert([(NSUUID *)managed.uuidVal isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssertEqual(unmanaged.boolVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n    XCTAssertEqual(unmanaged.intVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n    XCTAssertEqual(unmanaged.floatVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n    XCTAssertEqual(unmanaged.doubleVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n    XCTAssertEqual(unmanaged.stringVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n    XCTAssertEqual(unmanaged.dataVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n    XCTAssertEqual(unmanaged.dateVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n    XCTAssertEqual(unmanaged.decimalVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n    XCTAssertEqual(unmanaged.objectIdVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n    XCTAssertEqual(unmanaged.uuidVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n    XCTAssertEqual(managed.boolVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n    XCTAssertEqual(managed.intVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n    XCTAssertEqual(managed.floatVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n    XCTAssertEqual(managed.doubleVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n    XCTAssertEqual(managed.stringVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n    XCTAssertEqual(managed.dataVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n    XCTAssertEqual(managed.dateVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n    XCTAssertEqual(managed.decimalVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n    XCTAssertEqual(managed.objectIdVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n    XCTAssertEqual(managed.uuidVal.rlm_anyValueType, RLMAnyValueTypeUUID);\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/PrimitiveRLMValuePropertyTests.tpl.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\nstatic NSDate *date(int i) {\n    return [NSDate dateWithTimeIntervalSince1970:i];\n}\n\nstatic NSData *data(int i) {\n    return [NSData dataWithBytesNoCopy:calloc(i, 1) length:i freeWhenDone:YES];\n}\n\nstatic RLMDecimal128 *decimal128(int i) {\n    return [RLMDecimal128 decimalWithNumber:@(i)];\n}\n\nstatic NSUUID *uuid(NSString *uuidString) {\n    return [[NSUUID alloc] initWithUUIDString:uuidString];\n}\n\nstatic NSMutableArray *objectIds;\nstatic RLMObjectId *objectId(NSUInteger i) {\n    if (!objectIds) {\n        objectIds = [NSMutableArray new];\n    }\n    while (i >= objectIds.count) {\n        [objectIds addObject:RLMObjectId.objectId];\n    }\n    return objectIds[i];\n}\n\n@interface PrimitiveRLMValuePropertyTests : RLMTestCase\n@end\n\n@implementation PrimitiveRLMValuePropertyTests {\n    AllPrimitiveRLMValues *unmanaged;\n    AllPrimitiveRLMValues *managed;\n    RLMRealm *realm;\n    RLMArray<RLMValue> *allMixed;\n    NSArray *allVals;\n}\n\n- (void)setUp {\n    realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    [self initValues];\n    [allMixed addObjects:@[\n        $rlmValue,\n    ]];\n}\n\n- (void)tearDown {\n    if (realm.inWriteTransaction) {\n        [realm cancelWriteTransaction];\n    }\n}\n\n- (void)initValues {\n    unmanaged = [[AllPrimitiveRLMValues alloc] initWithValue:@{\n        %unman @\"$member\": $value0,\n    }];\n    XCTAssertNil(unmanaged.realm);\n    \n    managed = [AllPrimitiveRLMValues createInRealm:realm withValue:@{\n        %man @\"$member\": $value0,\n    }];\n    XCTAssertNotNil(managed.realm);\n    \n    %unman XCTAssert([$cast$rlmValue isEqual:$value0]);\n    %man XCTAssert([$cast$rlmValue isEqual:$value0]);\n}\n\n- (void)testType {\n    XCTAssertEqual(unmanaged.boolVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(unmanaged.intVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(unmanaged.floatVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(unmanaged.doubleVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(unmanaged.stringVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(unmanaged.dataVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(unmanaged.dateVal.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(managed.boolVal.rlm_anyValueType, RLMAnyValueTypeBool);\n    XCTAssertEqual(managed.intVal.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(managed.floatVal.rlm_anyValueType, RLMAnyValueTypeFloat);\n    XCTAssertEqual(managed.doubleVal.rlm_anyValueType, RLMAnyValueTypeDouble);\n    XCTAssertEqual(managed.stringVal.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(managed.dataVal.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(managed.dateVal.rlm_anyValueType, RLMAnyValueTypeDate);\n}\n\n- (void)testInitNull {\n    AllPrimitiveRLMValues *unman = [[AllPrimitiveRLMValues alloc] init];\n    AllPrimitiveRLMValues *man = [AllPrimitiveRLMValues createInRealm:realm withValue:@[]];\n    \n    %unman XCTAssertNil(unman.$member, @\"RLMValue should be able to initialize as null\");\n    %man XCTAssertNil(man.$member, @\"RLMValue should be able to initialize as null\");\n}\n\n- (void)testUpdateBoolType {\n    $rlmValue = @NO;\n    XCTAssert([(NSNumber *)$rlmValue isEqual:@NO]);\n    XCTAssertEqual($rlmValue.rlm_anyValueType, RLMAnyValueTypeBool);\n}\n\n- (void)testUpdateIntType {\n    $rlmValue = @2;\n    XCTAssert([(NSNumber *)$rlmValue isEqual:@2]);\n    XCTAssertEqual($rlmValue.rlm_anyValueType, RLMAnyValueTypeInt);\n}\n\n- (void)testUpdateFloatType {\n    $rlmValue = @2.2f;\n    XCTAssert([(NSNumber *)$rlmValue isEqual:@2.2f]);\n    XCTAssertEqual($rlmValue.rlm_anyValueType, RLMAnyValueTypeFloat);\n}\n\n- (void)testUpdateDoubleType {\n    $rlmValue = @3.3;\n    XCTAssert([(NSNumber *)$rlmValue isEqual:@3.3]);\n    XCTAssertEqual($rlmValue.rlm_anyValueType, RLMAnyValueTypeDouble);\n}\n\n- (void)testUpdateStringType {\n    $rlmValue = @\"four\";\n    XCTAssert([(NSNumber *)$rlmValue isEqual:@\"four\"]);\n    XCTAssertEqual($rlmValue.rlm_anyValueType, RLMAnyValueTypeString);\n}\n\n- (void)testUpdateDataType {\n    $rlmValue = data(5);\n    XCTAssert([(NSNumber *)$rlmValue isEqual:data(5)]);\n    XCTAssertEqual($rlmValue.rlm_anyValueType, RLMAnyValueTypeData);\n}\n\n- (void)testUpdateDateType {\n    $rlmValue = date(6);\n    XCTAssert([(NSNumber *)$rlmValue isEqual:date(6)]);\n    XCTAssertEqual($rlmValue.rlm_anyValueType, RLMAnyValueTypeDate);\n}\n\n- (void)testUpdateDecimal {\n    $rlmValue = decimal128(7);\n    XCTAssert([(NSNumber *)$rlmValue isEqual:decimal128(7)]);\n    XCTAssertEqual($rlmValue.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n}\n\n- (void)testUpdateObjectIdType {\n    $rlmValue = objectId(8);\n    XCTAssert([(NSUUID *)$rlmValue isEqual:objectId(8)]);\n    XCTAssertEqual($rlmValue.rlm_anyValueType, RLMAnyValueTypeObjectId);\n}\n\n- (void)testUpdateUuidType {\n    $rlmValue = uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\");\n    XCTAssert([(NSUUID *)$rlmValue isEqual:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    XCTAssertEqual($rlmValue.rlm_anyValueType, RLMAnyValueTypeUUID);\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/PrimitiveSetPropertyTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\nstatic NSDate *date(int i) {\n    return [NSDate dateWithTimeIntervalSince1970:i];\n}\nstatic NSData *data(int i) {\n    return [NSData dataWithBytesNoCopy:calloc(i, 1) length:i freeWhenDone:YES];\n}\nstatic RLMDecimal128 *decimal128(int i) {\n    return [RLMDecimal128 decimalWithNumber:@(i)];\n}\nstatic NSMutableArray *objectIds;\nstatic RLMObjectId *objectId(NSUInteger i) {\n    if (!objectIds) {\n        objectIds = [NSMutableArray new];\n    }\n    while (i >= objectIds.count) {\n        [objectIds addObject:RLMObjectId.objectId];\n    }\n    return objectIds[i];\n}\nstatic NSUUID *uuid(NSString *uuidString) {\n    return [[NSUUID alloc] initWithUUIDString:uuidString];\n}\nstatic void count(NSArray *values, double *sum, NSUInteger *count) {\n    for (id value in values) {\n        if (value != NSNull.null) {\n            ++*count;\n            *sum += [value doubleValue];\n        }\n    }\n}\nstatic double sum(NSArray *values) {\n    double sum = 0;\n    NSUInteger c = 0;\n    count(values, &sum, &c);\n    return sum;\n}\nstatic double average(NSArray *values) {\n    double sum = 0;\n    NSUInteger c = 0;\n    count(values, &sum, &c);\n    return sum / c;\n}\n\n@interface LinkToAllPrimitiveSets : RLMObject\n@property (nonatomic) AllPrimitiveSets *link;\n@end\n@implementation LinkToAllPrimitiveSets\n@end\n\n@interface LinkToAllOptionalPrimitiveSets : RLMObject\n@property (nonatomic) AllOptionalPrimitiveSets *link;\n@end\n@implementation LinkToAllOptionalPrimitiveSets\n@end\n\n@interface PrimitiveSetPropertyTests : RLMTestCase\n@end\n\n@implementation PrimitiveSetPropertyTests {\n    AllPrimitiveSets *unmanaged;\n    AllPrimitiveSets *managed;\n    AllOptionalPrimitiveSets *optUnmanaged;\n    AllOptionalPrimitiveSets *optManaged;\n    RLMRealm *realm;\n    NSArray<RLMSet *> *allSets;\n}\n\n- (void)setUp {\n    unmanaged = [[AllPrimitiveSets alloc] init];\n    optUnmanaged = [[AllOptionalPrimitiveSets alloc] init];\n    realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    managed = [AllPrimitiveSets createInRealm:realm withValue:@[]];\n    optManaged = [AllOptionalPrimitiveSets createInRealm:realm withValue:@[]];\n    allSets = @[\n        unmanaged.boolObj,\n        unmanaged.intObj,\n        unmanaged.floatObj,\n        unmanaged.doubleObj,\n        unmanaged.stringObj,\n        unmanaged.dataObj,\n        unmanaged.dateObj,\n        unmanaged.decimalObj,\n        unmanaged.objectIdObj,\n        unmanaged.uuidObj,\n        unmanaged.anyBoolObj,\n        unmanaged.anyIntObj,\n        unmanaged.anyFloatObj,\n        unmanaged.anyDoubleObj,\n        unmanaged.anyStringObj,\n        unmanaged.anyDataObj,\n        unmanaged.anyDateObj,\n        unmanaged.anyDecimalObj,\n        unmanaged.anyObjectIdObj,\n        unmanaged.anyUUIDObj,\n        optUnmanaged.boolObj,\n        optUnmanaged.intObj,\n        optUnmanaged.floatObj,\n        optUnmanaged.doubleObj,\n        optUnmanaged.stringObj,\n        optUnmanaged.dataObj,\n        optUnmanaged.dateObj,\n        optUnmanaged.decimalObj,\n        optUnmanaged.objectIdObj,\n        optUnmanaged.uuidObj,\n        managed.boolObj,\n        managed.intObj,\n        managed.floatObj,\n        managed.doubleObj,\n        managed.stringObj,\n        managed.dataObj,\n        managed.dateObj,\n        managed.decimalObj,\n        managed.objectIdObj,\n        managed.uuidObj,\n        managed.anyBoolObj,\n        managed.anyIntObj,\n        managed.anyFloatObj,\n        managed.anyDoubleObj,\n        managed.anyStringObj,\n        managed.anyDataObj,\n        managed.anyDateObj,\n        managed.anyDecimalObj,\n        managed.anyObjectIdObj,\n        managed.anyUUIDObj,\n        optManaged.boolObj,\n        optManaged.intObj,\n        optManaged.floatObj,\n        optManaged.doubleObj,\n        optManaged.stringObj,\n        optManaged.dataObj,\n        optManaged.dateObj,\n        optManaged.decimalObj,\n        optManaged.objectIdObj,\n        optManaged.uuidObj,\n    ];\n}\n\n- (void)tearDown {\n    if (realm.inWriteTransaction) {\n        [realm cancelWriteTransaction];\n    }\n}\n\n- (void)addObjects {\n    [unmanaged.boolObj addObjects:@[@NO, @YES]];\n    [unmanaged.intObj addObjects:@[@2, @3]];\n    [unmanaged.floatObj addObjects:@[@2.2f, @3.3f]];\n    [unmanaged.doubleObj addObjects:@[@2.2, @3.3]];\n    [unmanaged.stringObj addObjects:@[@\"a\", @\"bc\"]];\n    [unmanaged.dataObj addObjects:@[data(1), data(2)]];\n    [unmanaged.dateObj addObjects:@[date(1), date(2)]];\n    [unmanaged.decimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [unmanaged.objectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [unmanaged.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [unmanaged.anyBoolObj addObjects:@[@NO, @YES]];\n    [unmanaged.anyIntObj addObjects:@[@2, @3]];\n    [unmanaged.anyFloatObj addObjects:@[@2.2f, @3.3f]];\n    [unmanaged.anyDoubleObj addObjects:@[@2.2, @3.3]];\n    [unmanaged.anyStringObj addObjects:@[@\"a\", @\"b\"]];\n    [unmanaged.anyDataObj addObjects:@[data(1), data(2)]];\n    [unmanaged.anyDateObj addObjects:@[date(1), date(2)]];\n    [unmanaged.anyDecimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [unmanaged.anyObjectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [unmanaged.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optUnmanaged.boolObj addObjects:@[NSNull.null, @NO, @YES]];\n    [optUnmanaged.intObj addObjects:@[NSNull.null, @2, @3]];\n    [optUnmanaged.floatObj addObjects:@[NSNull.null, @2.2f, @3.3f]];\n    [optUnmanaged.doubleObj addObjects:@[NSNull.null, @2.2, @3.3]];\n    [optUnmanaged.stringObj addObjects:@[NSNull.null, @\"a\", @\"bc\"]];\n    [optUnmanaged.dataObj addObjects:@[NSNull.null, data(1), data(2)]];\n    [optUnmanaged.dateObj addObjects:@[NSNull.null, date(1), date(2)]];\n    [optUnmanaged.decimalObj addObjects:@[NSNull.null, decimal128(1), decimal128(2)]];\n    [optUnmanaged.objectIdObj addObjects:@[NSNull.null, objectId(1), objectId(2)]];\n    [optUnmanaged.uuidObj addObjects:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]];\n    [managed.boolObj addObjects:@[@NO, @YES]];\n    [managed.intObj addObjects:@[@2, @3]];\n    [managed.floatObj addObjects:@[@2.2f, @3.3f]];\n    [managed.doubleObj addObjects:@[@2.2, @3.3]];\n    [managed.stringObj addObjects:@[@\"a\", @\"bc\"]];\n    [managed.dataObj addObjects:@[data(1), data(2)]];\n    [managed.dateObj addObjects:@[date(1), date(2)]];\n    [managed.decimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [managed.objectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [managed.uuidObj addObjects:@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]];\n    [managed.anyBoolObj addObjects:@[@NO, @YES]];\n    [managed.anyIntObj addObjects:@[@2, @3]];\n    [managed.anyFloatObj addObjects:@[@2.2f, @3.3f]];\n    [managed.anyDoubleObj addObjects:@[@2.2, @3.3]];\n    [managed.anyStringObj addObjects:@[@\"a\", @\"b\"]];\n    [managed.anyDataObj addObjects:@[data(1), data(2)]];\n    [managed.anyDateObj addObjects:@[date(1), date(2)]];\n    [managed.anyDecimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [managed.anyObjectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [managed.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optManaged.boolObj addObjects:@[NSNull.null, @NO, @YES]];\n    [optManaged.intObj addObjects:@[NSNull.null, @2, @3]];\n    [optManaged.floatObj addObjects:@[NSNull.null, @2.2f, @3.3f]];\n    [optManaged.doubleObj addObjects:@[NSNull.null, @2.2, @3.3]];\n    [optManaged.stringObj addObjects:@[NSNull.null, @\"a\", @\"bc\"]];\n    [optManaged.dataObj addObjects:@[NSNull.null, data(1), data(2)]];\n    [optManaged.dateObj addObjects:@[NSNull.null, date(1), date(2)]];\n    [optManaged.decimalObj addObjects:@[NSNull.null, decimal128(1), decimal128(2)]];\n    [optManaged.objectIdObj addObjects:@[NSNull.null, objectId(1), objectId(2)]];\n    [optManaged.uuidObj addObjects:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]];\n}\n\n- (void)testCount {\n    uncheckedAssertEqual(unmanaged.intObj.count, 0U);\n    [unmanaged.intObj addObject:@1];\n    uncheckedAssertEqual(unmanaged.intObj.count, 1U);\n}\n\n- (void)testType {\n    uncheckedAssertEqual(unmanaged.boolObj.type, RLMPropertyTypeBool);\n    uncheckedAssertEqual(unmanaged.intObj.type, RLMPropertyTypeInt);\n    uncheckedAssertEqual(unmanaged.floatObj.type, RLMPropertyTypeFloat);\n    uncheckedAssertEqual(unmanaged.doubleObj.type, RLMPropertyTypeDouble);\n    uncheckedAssertEqual(unmanaged.stringObj.type, RLMPropertyTypeString);\n    uncheckedAssertEqual(unmanaged.dataObj.type, RLMPropertyTypeData);\n    uncheckedAssertEqual(unmanaged.dateObj.type, RLMPropertyTypeDate);\n    uncheckedAssertEqual(optUnmanaged.boolObj.type, RLMPropertyTypeBool);\n    uncheckedAssertEqual(optUnmanaged.intObj.type, RLMPropertyTypeInt);\n    uncheckedAssertEqual(optUnmanaged.floatObj.type, RLMPropertyTypeFloat);\n    uncheckedAssertEqual(optUnmanaged.doubleObj.type, RLMPropertyTypeDouble);\n    uncheckedAssertEqual(optUnmanaged.stringObj.type, RLMPropertyTypeString);\n    uncheckedAssertEqual(optUnmanaged.dataObj.type, RLMPropertyTypeData);\n    uncheckedAssertEqual(optUnmanaged.dateObj.type, RLMPropertyTypeDate);\n}\n\n- (void)testOptional {\n    uncheckedAssertFalse(unmanaged.boolObj.optional);\n    uncheckedAssertFalse(unmanaged.intObj.optional);\n    uncheckedAssertFalse(unmanaged.floatObj.optional);\n    uncheckedAssertFalse(unmanaged.doubleObj.optional);\n    uncheckedAssertFalse(unmanaged.stringObj.optional);\n    uncheckedAssertFalse(unmanaged.dataObj.optional);\n    uncheckedAssertFalse(unmanaged.dateObj.optional);\n    uncheckedAssertTrue(optUnmanaged.boolObj.optional);\n    uncheckedAssertTrue(optUnmanaged.intObj.optional);\n    uncheckedAssertTrue(optUnmanaged.floatObj.optional);\n    uncheckedAssertTrue(optUnmanaged.doubleObj.optional);\n    uncheckedAssertTrue(optUnmanaged.stringObj.optional);\n    uncheckedAssertTrue(optUnmanaged.dataObj.optional);\n    uncheckedAssertTrue(optUnmanaged.dateObj.optional);\n}\n\n- (void)testObjectClassName {\n    uncheckedAssertNil(unmanaged.boolObj.objectClassName);\n    uncheckedAssertNil(unmanaged.intObj.objectClassName);\n    uncheckedAssertNil(unmanaged.floatObj.objectClassName);\n    uncheckedAssertNil(unmanaged.doubleObj.objectClassName);\n    uncheckedAssertNil(unmanaged.stringObj.objectClassName);\n    uncheckedAssertNil(unmanaged.dataObj.objectClassName);\n    uncheckedAssertNil(unmanaged.dateObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.boolObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.intObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.floatObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.doubleObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.stringObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.dataObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.dateObj.objectClassName);\n}\n\n- (void)testRealm {\n    uncheckedAssertNil(unmanaged.boolObj.realm);\n    uncheckedAssertNil(unmanaged.intObj.realm);\n    uncheckedAssertNil(unmanaged.floatObj.realm);\n    uncheckedAssertNil(unmanaged.doubleObj.realm);\n    uncheckedAssertNil(unmanaged.stringObj.realm);\n    uncheckedAssertNil(unmanaged.dataObj.realm);\n    uncheckedAssertNil(unmanaged.dateObj.realm);\n    uncheckedAssertNil(optUnmanaged.boolObj.realm);\n    uncheckedAssertNil(optUnmanaged.intObj.realm);\n    uncheckedAssertNil(optUnmanaged.floatObj.realm);\n    uncheckedAssertNil(optUnmanaged.doubleObj.realm);\n    uncheckedAssertNil(optUnmanaged.stringObj.realm);\n    uncheckedAssertNil(optUnmanaged.dataObj.realm);\n    uncheckedAssertNil(optUnmanaged.dateObj.realm);\n}\n\n- (void)testInvalidated {\n    RLMSet *set;\n    @autoreleasepool {\n        AllPrimitiveSets *obj = [[AllPrimitiveSets alloc] init];\n        set = obj.intObj;\n        uncheckedAssertFalse(set.invalidated);\n    }\n    uncheckedAssertFalse(set.invalidated);\n}\n\n- (void)testDeleteObjectsInRealm {\n    for (RLMSet *set in allSets) {\n        RLMAssertThrowsWithReason([realm deleteObjects:set], @\"Cannot delete objects from RLMSet\");\n    }\n}\n\n- (void)testObjectAtIndex {\n    RLMAssertThrowsWithReason([unmanaged.intObj objectAtIndex:0],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n\n    [unmanaged.intObj addObject:@1];\n    uncheckedAssertEqualObjects([unmanaged.intObj objectAtIndex:0], @1);\n}\n\n- (void)testContainsObject {\n    uncheckedAssertFalse([unmanaged.boolObj containsObject:@NO]);\n    uncheckedAssertFalse([unmanaged.intObj containsObject:@2]);\n    uncheckedAssertFalse([unmanaged.floatObj containsObject:@2.2f]);\n    uncheckedAssertFalse([unmanaged.doubleObj containsObject:@2.2]);\n    uncheckedAssertFalse([unmanaged.stringObj containsObject:@\"a\"]);\n    uncheckedAssertFalse([unmanaged.dataObj containsObject:data(1)]);\n    uncheckedAssertFalse([unmanaged.dateObj containsObject:date(1)]);\n    uncheckedAssertFalse([unmanaged.decimalObj containsObject:decimal128(1)]);\n    uncheckedAssertFalse([unmanaged.objectIdObj containsObject:objectId(1)]);\n    uncheckedAssertFalse([unmanaged.uuidObj containsObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertFalse([unmanaged.anyBoolObj containsObject:@NO]);\n    uncheckedAssertFalse([unmanaged.anyIntObj containsObject:@2]);\n    uncheckedAssertFalse([unmanaged.anyFloatObj containsObject:@2.2f]);\n    uncheckedAssertFalse([unmanaged.anyDoubleObj containsObject:@2.2]);\n    uncheckedAssertFalse([unmanaged.anyStringObj containsObject:@\"a\"]);\n    uncheckedAssertFalse([unmanaged.anyDataObj containsObject:data(1)]);\n    uncheckedAssertFalse([unmanaged.anyDateObj containsObject:date(1)]);\n    uncheckedAssertFalse([unmanaged.anyDecimalObj containsObject:decimal128(1)]);\n    uncheckedAssertFalse([unmanaged.anyObjectIdObj containsObject:objectId(1)]);\n    uncheckedAssertFalse([unmanaged.anyUUIDObj containsObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertFalse([optUnmanaged.boolObj containsObject:NSNull.null]);\n    uncheckedAssertFalse([optUnmanaged.intObj containsObject:NSNull.null]);\n    uncheckedAssertFalse([optUnmanaged.floatObj containsObject:NSNull.null]);\n    uncheckedAssertFalse([optUnmanaged.doubleObj containsObject:NSNull.null]);\n    uncheckedAssertFalse([optUnmanaged.stringObj containsObject:NSNull.null]);\n    uncheckedAssertFalse([optUnmanaged.dataObj containsObject:NSNull.null]);\n    uncheckedAssertFalse([optUnmanaged.dateObj containsObject:NSNull.null]);\n    uncheckedAssertFalse([optUnmanaged.decimalObj containsObject:NSNull.null]);\n    uncheckedAssertFalse([optUnmanaged.objectIdObj containsObject:NSNull.null]);\n    uncheckedAssertFalse([optUnmanaged.uuidObj containsObject:NSNull.null]);\n    uncheckedAssertFalse([managed.boolObj containsObject:@NO]);\n    uncheckedAssertFalse([managed.intObj containsObject:@2]);\n    uncheckedAssertFalse([managed.floatObj containsObject:@2.2f]);\n    uncheckedAssertFalse([managed.doubleObj containsObject:@2.2]);\n    uncheckedAssertFalse([managed.stringObj containsObject:@\"a\"]);\n    uncheckedAssertFalse([managed.dataObj containsObject:data(1)]);\n    uncheckedAssertFalse([managed.dateObj containsObject:date(1)]);\n    uncheckedAssertFalse([managed.decimalObj containsObject:decimal128(1)]);\n    uncheckedAssertFalse([managed.objectIdObj containsObject:objectId(1)]);\n    uncheckedAssertFalse([managed.uuidObj containsObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    uncheckedAssertFalse([managed.anyBoolObj containsObject:@NO]);\n    uncheckedAssertFalse([managed.anyIntObj containsObject:@2]);\n    uncheckedAssertFalse([managed.anyFloatObj containsObject:@2.2f]);\n    uncheckedAssertFalse([managed.anyDoubleObj containsObject:@2.2]);\n    uncheckedAssertFalse([managed.anyStringObj containsObject:@\"a\"]);\n    uncheckedAssertFalse([managed.anyDataObj containsObject:data(1)]);\n    uncheckedAssertFalse([managed.anyDateObj containsObject:date(1)]);\n    uncheckedAssertFalse([managed.anyDecimalObj containsObject:decimal128(1)]);\n    uncheckedAssertFalse([managed.anyObjectIdObj containsObject:objectId(1)]);\n    uncheckedAssertFalse([managed.anyUUIDObj containsObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertFalse([optManaged.boolObj containsObject:NSNull.null]);\n    uncheckedAssertFalse([optManaged.intObj containsObject:NSNull.null]);\n    uncheckedAssertFalse([optManaged.floatObj containsObject:NSNull.null]);\n    uncheckedAssertFalse([optManaged.doubleObj containsObject:NSNull.null]);\n    uncheckedAssertFalse([optManaged.stringObj containsObject:NSNull.null]);\n    uncheckedAssertFalse([optManaged.dataObj containsObject:NSNull.null]);\n    uncheckedAssertFalse([optManaged.dateObj containsObject:NSNull.null]);\n    uncheckedAssertFalse([optManaged.decimalObj containsObject:NSNull.null]);\n    uncheckedAssertFalse([optManaged.objectIdObj containsObject:NSNull.null]);\n    uncheckedAssertFalse([optManaged.uuidObj containsObject:NSNull.null]);\n    [unmanaged.boolObj addObject:@NO];\n    [unmanaged.intObj addObject:@2];\n    [unmanaged.floatObj addObject:@2.2f];\n    [unmanaged.doubleObj addObject:@2.2];\n    [unmanaged.stringObj addObject:@\"a\"];\n    [unmanaged.dataObj addObject:data(1)];\n    [unmanaged.dateObj addObject:date(1)];\n    [unmanaged.decimalObj addObject:decimal128(1)];\n    [unmanaged.objectIdObj addObject:objectId(1)];\n    [unmanaged.uuidObj addObject:uuid(@\"00000000-0000-0000-0000-000000000000\")];\n    [unmanaged.anyBoolObj addObject:@NO];\n    [unmanaged.anyIntObj addObject:@2];\n    [unmanaged.anyFloatObj addObject:@2.2f];\n    [unmanaged.anyDoubleObj addObject:@2.2];\n    [unmanaged.anyStringObj addObject:@\"a\"];\n    [unmanaged.anyDataObj addObject:data(1)];\n    [unmanaged.anyDateObj addObject:date(1)];\n    [unmanaged.anyDecimalObj addObject:decimal128(1)];\n    [unmanaged.anyObjectIdObj addObject:objectId(1)];\n    [unmanaged.anyUUIDObj addObject:uuid(@\"00000000-0000-0000-0000-000000000000\")];\n    [optUnmanaged.boolObj addObject:NSNull.null];\n    [optUnmanaged.intObj addObject:NSNull.null];\n    [optUnmanaged.floatObj addObject:NSNull.null];\n    [optUnmanaged.doubleObj addObject:NSNull.null];\n    [optUnmanaged.stringObj addObject:NSNull.null];\n    [optUnmanaged.dataObj addObject:NSNull.null];\n    [optUnmanaged.dateObj addObject:NSNull.null];\n    [optUnmanaged.decimalObj addObject:NSNull.null];\n    [optUnmanaged.objectIdObj addObject:NSNull.null];\n    [optUnmanaged.uuidObj addObject:NSNull.null];\n    [managed.boolObj addObject:@NO];\n    [managed.intObj addObject:@2];\n    [managed.floatObj addObject:@2.2f];\n    [managed.doubleObj addObject:@2.2];\n    [managed.stringObj addObject:@\"a\"];\n    [managed.dataObj addObject:data(1)];\n    [managed.dateObj addObject:date(1)];\n    [managed.decimalObj addObject:decimal128(1)];\n    [managed.objectIdObj addObject:objectId(1)];\n    [managed.uuidObj addObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    [managed.anyBoolObj addObject:@NO];\n    [managed.anyIntObj addObject:@2];\n    [managed.anyFloatObj addObject:@2.2f];\n    [managed.anyDoubleObj addObject:@2.2];\n    [managed.anyStringObj addObject:@\"a\"];\n    [managed.anyDataObj addObject:data(1)];\n    [managed.anyDateObj addObject:date(1)];\n    [managed.anyDecimalObj addObject:decimal128(1)];\n    [managed.anyObjectIdObj addObject:objectId(1)];\n    [managed.anyUUIDObj addObject:uuid(@\"00000000-0000-0000-0000-000000000000\")];\n    [optManaged.boolObj addObject:NSNull.null];\n    [optManaged.intObj addObject:NSNull.null];\n    [optManaged.floatObj addObject:NSNull.null];\n    [optManaged.doubleObj addObject:NSNull.null];\n    [optManaged.stringObj addObject:NSNull.null];\n    [optManaged.dataObj addObject:NSNull.null];\n    [optManaged.dateObj addObject:NSNull.null];\n    [optManaged.decimalObj addObject:NSNull.null];\n    [optManaged.objectIdObj addObject:NSNull.null];\n    [optManaged.uuidObj addObject:NSNull.null];\n    uncheckedAssertTrue([unmanaged.boolObj containsObject:@NO]);\n    uncheckedAssertTrue([unmanaged.intObj containsObject:@2]);\n    uncheckedAssertTrue([unmanaged.floatObj containsObject:@2.2f]);\n    uncheckedAssertTrue([unmanaged.doubleObj containsObject:@2.2]);\n    uncheckedAssertTrue([unmanaged.stringObj containsObject:@\"a\"]);\n    uncheckedAssertTrue([unmanaged.dataObj containsObject:data(1)]);\n    uncheckedAssertTrue([unmanaged.dateObj containsObject:date(1)]);\n    uncheckedAssertTrue([unmanaged.decimalObj containsObject:decimal128(1)]);\n    uncheckedAssertTrue([unmanaged.objectIdObj containsObject:objectId(1)]);\n    uncheckedAssertTrue([unmanaged.uuidObj containsObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertTrue([unmanaged.anyBoolObj containsObject:@NO]);\n    uncheckedAssertTrue([unmanaged.anyIntObj containsObject:@2]);\n    uncheckedAssertTrue([unmanaged.anyFloatObj containsObject:@2.2f]);\n    uncheckedAssertTrue([unmanaged.anyDoubleObj containsObject:@2.2]);\n    uncheckedAssertTrue([unmanaged.anyStringObj containsObject:@\"a\"]);\n    uncheckedAssertTrue([unmanaged.anyDataObj containsObject:data(1)]);\n    uncheckedAssertTrue([unmanaged.anyDateObj containsObject:date(1)]);\n    uncheckedAssertTrue([unmanaged.anyDecimalObj containsObject:decimal128(1)]);\n    uncheckedAssertTrue([unmanaged.anyObjectIdObj containsObject:objectId(1)]);\n    uncheckedAssertTrue([unmanaged.anyUUIDObj containsObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertTrue([optUnmanaged.boolObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.intObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.floatObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.doubleObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.stringObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.dataObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.dateObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.decimalObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.objectIdObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.uuidObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([managed.boolObj containsObject:@NO]);\n    uncheckedAssertTrue([managed.intObj containsObject:@2]);\n    uncheckedAssertTrue([managed.floatObj containsObject:@2.2f]);\n    uncheckedAssertTrue([managed.doubleObj containsObject:@2.2]);\n    uncheckedAssertTrue([managed.stringObj containsObject:@\"a\"]);\n    uncheckedAssertTrue([managed.dataObj containsObject:data(1)]);\n    uncheckedAssertTrue([managed.dateObj containsObject:date(1)]);\n    uncheckedAssertTrue([managed.decimalObj containsObject:decimal128(1)]);\n    uncheckedAssertTrue([managed.objectIdObj containsObject:objectId(1)]);\n    uncheckedAssertTrue([managed.uuidObj containsObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    uncheckedAssertTrue([managed.anyBoolObj containsObject:@NO]);\n    uncheckedAssertTrue([managed.anyIntObj containsObject:@2]);\n    uncheckedAssertTrue([managed.anyFloatObj containsObject:@2.2f]);\n    uncheckedAssertTrue([managed.anyDoubleObj containsObject:@2.2]);\n    uncheckedAssertTrue([managed.anyStringObj containsObject:@\"a\"]);\n    uncheckedAssertTrue([managed.anyDataObj containsObject:data(1)]);\n    uncheckedAssertTrue([managed.anyDateObj containsObject:date(1)]);\n    uncheckedAssertTrue([managed.anyDecimalObj containsObject:decimal128(1)]);\n    uncheckedAssertTrue([managed.anyObjectIdObj containsObject:objectId(1)]);\n    uncheckedAssertTrue([managed.anyUUIDObj containsObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertTrue([optManaged.boolObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.intObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.floatObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.doubleObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.stringObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.dataObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.dateObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.decimalObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.objectIdObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.uuidObj containsObject:NSNull.null]);\n}\n\n- (void)testAddObject {\n    RLMAssertThrowsWithReason([unmanaged.boolObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj addObject:@2], \n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj addObject:@2], \n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([managed.boolObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.intObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.floatObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.doubleObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.stringObj addObject:@2], \n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.dataObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dateObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.decimalObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.uuidObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([optManaged.intObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([optManaged.floatObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj addObject:@2], \n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj addObject:@\"a\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([unmanaged.boolObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([managed.boolObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.intObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.floatObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.doubleObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.stringObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.dataObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dateObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.decimalObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.uuidObj addObject:NSNull.null], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n\n    [unmanaged.boolObj addObject:@NO];\n    [unmanaged.intObj addObject:@2];\n    [unmanaged.floatObj addObject:@2.2f];\n    [unmanaged.doubleObj addObject:@2.2];\n    [unmanaged.stringObj addObject:@\"a\"];\n    [unmanaged.dataObj addObject:data(1)];\n    [unmanaged.dateObj addObject:date(1)];\n    [unmanaged.decimalObj addObject:decimal128(1)];\n    [unmanaged.objectIdObj addObject:objectId(1)];\n    [unmanaged.uuidObj addObject:uuid(@\"00000000-0000-0000-0000-000000000000\")];\n    [unmanaged.anyBoolObj addObject:@NO];\n    [unmanaged.anyIntObj addObject:@2];\n    [unmanaged.anyFloatObj addObject:@2.2f];\n    [unmanaged.anyDoubleObj addObject:@2.2];\n    [unmanaged.anyStringObj addObject:@\"a\"];\n    [unmanaged.anyDataObj addObject:data(1)];\n    [unmanaged.anyDateObj addObject:date(1)];\n    [unmanaged.anyDecimalObj addObject:decimal128(1)];\n    [unmanaged.anyObjectIdObj addObject:objectId(1)];\n    [unmanaged.anyUUIDObj addObject:uuid(@\"00000000-0000-0000-0000-000000000000\")];\n    [optUnmanaged.boolObj addObject:NSNull.null];\n    [optUnmanaged.intObj addObject:NSNull.null];\n    [optUnmanaged.floatObj addObject:NSNull.null];\n    [optUnmanaged.doubleObj addObject:NSNull.null];\n    [optUnmanaged.stringObj addObject:NSNull.null];\n    [optUnmanaged.dataObj addObject:NSNull.null];\n    [optUnmanaged.dateObj addObject:NSNull.null];\n    [optUnmanaged.decimalObj addObject:NSNull.null];\n    [optUnmanaged.objectIdObj addObject:NSNull.null];\n    [optUnmanaged.uuidObj addObject:NSNull.null];\n    [managed.boolObj addObject:@NO];\n    [managed.intObj addObject:@2];\n    [managed.floatObj addObject:@2.2f];\n    [managed.doubleObj addObject:@2.2];\n    [managed.stringObj addObject:@\"a\"];\n    [managed.dataObj addObject:data(1)];\n    [managed.dateObj addObject:date(1)];\n    [managed.decimalObj addObject:decimal128(1)];\n    [managed.objectIdObj addObject:objectId(1)];\n    [managed.uuidObj addObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")];\n    [managed.anyBoolObj addObject:@NO];\n    [managed.anyIntObj addObject:@2];\n    [managed.anyFloatObj addObject:@2.2f];\n    [managed.anyDoubleObj addObject:@2.2];\n    [managed.anyStringObj addObject:@\"a\"];\n    [managed.anyDataObj addObject:data(1)];\n    [managed.anyDateObj addObject:date(1)];\n    [managed.anyDecimalObj addObject:decimal128(1)];\n    [managed.anyObjectIdObj addObject:objectId(1)];\n    [managed.anyUUIDObj addObject:uuid(@\"00000000-0000-0000-0000-000000000000\")];\n    [optManaged.boolObj addObject:NSNull.null];\n    [optManaged.intObj addObject:NSNull.null];\n    [optManaged.floatObj addObject:NSNull.null];\n    [optManaged.doubleObj addObject:NSNull.null];\n    [optManaged.stringObj addObject:NSNull.null];\n    [optManaged.dataObj addObject:NSNull.null];\n    [optManaged.dateObj addObject:NSNull.null];\n    [optManaged.decimalObj addObject:NSNull.null];\n    [optManaged.objectIdObj addObject:NSNull.null];\n    [optManaged.uuidObj addObject:NSNull.null];\n    uncheckedAssertTrue([unmanaged.boolObj containsObject:@NO]);\n    uncheckedAssertTrue([unmanaged.intObj containsObject:@2]);\n    uncheckedAssertTrue([unmanaged.floatObj containsObject:@2.2f]);\n    uncheckedAssertTrue([unmanaged.doubleObj containsObject:@2.2]);\n    uncheckedAssertTrue([unmanaged.stringObj containsObject:@\"a\"]);\n    uncheckedAssertTrue([unmanaged.dataObj containsObject:data(1)]);\n    uncheckedAssertTrue([unmanaged.dateObj containsObject:date(1)]);\n    uncheckedAssertTrue([unmanaged.decimalObj containsObject:decimal128(1)]);\n    uncheckedAssertTrue([unmanaged.objectIdObj containsObject:objectId(1)]);\n    uncheckedAssertTrue([unmanaged.uuidObj containsObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertTrue([unmanaged.anyBoolObj containsObject:@NO]);\n    uncheckedAssertTrue([unmanaged.anyIntObj containsObject:@2]);\n    uncheckedAssertTrue([unmanaged.anyFloatObj containsObject:@2.2f]);\n    uncheckedAssertTrue([unmanaged.anyDoubleObj containsObject:@2.2]);\n    uncheckedAssertTrue([unmanaged.anyStringObj containsObject:@\"a\"]);\n    uncheckedAssertTrue([unmanaged.anyDataObj containsObject:data(1)]);\n    uncheckedAssertTrue([unmanaged.anyDateObj containsObject:date(1)]);\n    uncheckedAssertTrue([unmanaged.anyDecimalObj containsObject:decimal128(1)]);\n    uncheckedAssertTrue([unmanaged.anyObjectIdObj containsObject:objectId(1)]);\n    uncheckedAssertTrue([unmanaged.anyUUIDObj containsObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertTrue([optUnmanaged.boolObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.intObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.floatObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.doubleObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.stringObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.dataObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.dateObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.decimalObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.objectIdObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.uuidObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([managed.boolObj containsObject:@NO]);\n    uncheckedAssertTrue([managed.intObj containsObject:@2]);\n    uncheckedAssertTrue([managed.floatObj containsObject:@2.2f]);\n    uncheckedAssertTrue([managed.doubleObj containsObject:@2.2]);\n    uncheckedAssertTrue([managed.stringObj containsObject:@\"a\"]);\n    uncheckedAssertTrue([managed.dataObj containsObject:data(1)]);\n    uncheckedAssertTrue([managed.dateObj containsObject:date(1)]);\n    uncheckedAssertTrue([managed.decimalObj containsObject:decimal128(1)]);\n    uncheckedAssertTrue([managed.objectIdObj containsObject:objectId(1)]);\n    uncheckedAssertTrue([managed.uuidObj containsObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    uncheckedAssertTrue([managed.anyBoolObj containsObject:@NO]);\n    uncheckedAssertTrue([managed.anyIntObj containsObject:@2]);\n    uncheckedAssertTrue([managed.anyFloatObj containsObject:@2.2f]);\n    uncheckedAssertTrue([managed.anyDoubleObj containsObject:@2.2]);\n    uncheckedAssertTrue([managed.anyStringObj containsObject:@\"a\"]);\n    uncheckedAssertTrue([managed.anyDataObj containsObject:data(1)]);\n    uncheckedAssertTrue([managed.anyDateObj containsObject:date(1)]);\n    uncheckedAssertTrue([managed.anyDecimalObj containsObject:decimal128(1)]);\n    uncheckedAssertTrue([managed.anyObjectIdObj containsObject:objectId(1)]);\n    uncheckedAssertTrue([managed.anyUUIDObj containsObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertTrue([optManaged.boolObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.intObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.floatObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.doubleObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.stringObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.dataObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.dateObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.decimalObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.objectIdObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.uuidObj containsObject:NSNull.null]);\n\n    [optUnmanaged.intObj addObject:NSNull.null];\n    [optUnmanaged.floatObj addObject:NSNull.null];\n    [optUnmanaged.doubleObj addObject:NSNull.null];\n    [optUnmanaged.stringObj addObject:NSNull.null];\n    [optUnmanaged.dataObj addObject:NSNull.null];\n    [optUnmanaged.dateObj addObject:NSNull.null];\n    [optUnmanaged.decimalObj addObject:NSNull.null];\n    [optUnmanaged.objectIdObj addObject:NSNull.null];\n    [optUnmanaged.uuidObj addObject:NSNull.null];\n    [optManaged.boolObj addObject:NSNull.null];\n    [optManaged.intObj addObject:NSNull.null];\n    [optManaged.floatObj addObject:NSNull.null];\n    [optManaged.doubleObj addObject:NSNull.null];\n    [optManaged.stringObj addObject:NSNull.null];\n    [optManaged.dataObj addObject:NSNull.null];\n    [optManaged.dateObj addObject:NSNull.null];\n    [optManaged.decimalObj addObject:NSNull.null];\n    [optManaged.objectIdObj addObject:NSNull.null];\n    [optManaged.uuidObj addObject:NSNull.null];\n    uncheckedAssertTrue([optUnmanaged.intObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.floatObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.doubleObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.stringObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.dataObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.dateObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.decimalObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.objectIdObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.uuidObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.boolObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.intObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.floatObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.doubleObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.stringObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.dataObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.dateObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.decimalObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.objectIdObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.uuidObj containsObject:NSNull.null]);\n}\n\n- (void)testAddObjects {\n    RLMAssertThrowsWithReason([unmanaged.boolObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj addObjects:@[@2]], \n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj addObjects:@[@2]], \n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([managed.boolObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.intObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.floatObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.doubleObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.stringObj addObjects:@[@2]], \n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.dataObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dateObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.decimalObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.uuidObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([optManaged.intObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([optManaged.floatObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj addObjects:@[@2]], \n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj addObjects:@[@\"a\"]], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([unmanaged.boolObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([managed.boolObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.intObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.floatObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.doubleObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.stringObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.dataObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dateObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.decimalObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.uuidObj addObjects:@[NSNull.null]], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n\n    [self addObjects];\n    uncheckedAssertTrue([unmanaged.boolObj containsObject:@NO]);\n    uncheckedAssertTrue([unmanaged.intObj containsObject:@2]);\n    uncheckedAssertTrue([unmanaged.floatObj containsObject:@2.2f]);\n    uncheckedAssertTrue([unmanaged.doubleObj containsObject:@2.2]);\n    uncheckedAssertTrue([unmanaged.stringObj containsObject:@\"a\"]);\n    uncheckedAssertTrue([unmanaged.dataObj containsObject:data(1)]);\n    uncheckedAssertTrue([unmanaged.dateObj containsObject:date(1)]);\n    uncheckedAssertTrue([unmanaged.decimalObj containsObject:decimal128(1)]);\n    uncheckedAssertTrue([unmanaged.objectIdObj containsObject:objectId(1)]);\n    uncheckedAssertTrue([unmanaged.uuidObj containsObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertTrue([unmanaged.anyBoolObj containsObject:@NO]);\n    uncheckedAssertTrue([unmanaged.anyIntObj containsObject:@2]);\n    uncheckedAssertTrue([unmanaged.anyFloatObj containsObject:@2.2f]);\n    uncheckedAssertTrue([unmanaged.anyDoubleObj containsObject:@2.2]);\n    uncheckedAssertTrue([unmanaged.anyStringObj containsObject:@\"a\"]);\n    uncheckedAssertTrue([unmanaged.anyDataObj containsObject:data(1)]);\n    uncheckedAssertTrue([unmanaged.anyDateObj containsObject:date(1)]);\n    uncheckedAssertTrue([unmanaged.anyDecimalObj containsObject:decimal128(1)]);\n    uncheckedAssertTrue([unmanaged.anyObjectIdObj containsObject:objectId(1)]);\n    uncheckedAssertTrue([unmanaged.anyUUIDObj containsObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertTrue([optUnmanaged.boolObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.intObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.floatObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.doubleObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.stringObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.dataObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.dateObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.decimalObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.objectIdObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optUnmanaged.uuidObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([managed.boolObj containsObject:@NO]);\n    uncheckedAssertTrue([managed.intObj containsObject:@2]);\n    uncheckedAssertTrue([managed.floatObj containsObject:@2.2f]);\n    uncheckedAssertTrue([managed.doubleObj containsObject:@2.2]);\n    uncheckedAssertTrue([managed.stringObj containsObject:@\"a\"]);\n    uncheckedAssertTrue([managed.dataObj containsObject:data(1)]);\n    uncheckedAssertTrue([managed.dateObj containsObject:date(1)]);\n    uncheckedAssertTrue([managed.decimalObj containsObject:decimal128(1)]);\n    uncheckedAssertTrue([managed.objectIdObj containsObject:objectId(1)]);\n    uncheckedAssertTrue([managed.uuidObj containsObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    uncheckedAssertTrue([managed.anyBoolObj containsObject:@NO]);\n    uncheckedAssertTrue([managed.anyIntObj containsObject:@2]);\n    uncheckedAssertTrue([managed.anyFloatObj containsObject:@2.2f]);\n    uncheckedAssertTrue([managed.anyDoubleObj containsObject:@2.2]);\n    uncheckedAssertTrue([managed.anyStringObj containsObject:@\"a\"]);\n    uncheckedAssertTrue([managed.anyDataObj containsObject:data(1)]);\n    uncheckedAssertTrue([managed.anyDateObj containsObject:date(1)]);\n    uncheckedAssertTrue([managed.anyDecimalObj containsObject:decimal128(1)]);\n    uncheckedAssertTrue([managed.anyObjectIdObj containsObject:objectId(1)]);\n    uncheckedAssertTrue([managed.anyUUIDObj containsObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertTrue([optManaged.boolObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.intObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.floatObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.doubleObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.stringObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.dataObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.dateObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.decimalObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.objectIdObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([optManaged.uuidObj containsObject:NSNull.null]);\n    uncheckedAssertTrue([unmanaged.boolObj containsObject:@YES]);\n    uncheckedAssertTrue([unmanaged.intObj containsObject:@3]);\n    uncheckedAssertTrue([unmanaged.floatObj containsObject:@3.3f]);\n    uncheckedAssertTrue([unmanaged.doubleObj containsObject:@3.3]);\n    uncheckedAssertTrue([unmanaged.stringObj containsObject:@\"bc\"]);\n    uncheckedAssertTrue([unmanaged.dataObj containsObject:data(2)]);\n    uncheckedAssertTrue([unmanaged.dateObj containsObject:date(2)]);\n    uncheckedAssertTrue([unmanaged.decimalObj containsObject:decimal128(2)]);\n    uncheckedAssertTrue([unmanaged.objectIdObj containsObject:objectId(2)]);\n    uncheckedAssertTrue([unmanaged.uuidObj containsObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    uncheckedAssertTrue([unmanaged.anyBoolObj containsObject:@YES]);\n    uncheckedAssertTrue([unmanaged.anyIntObj containsObject:@3]);\n    uncheckedAssertTrue([unmanaged.anyFloatObj containsObject:@3.3f]);\n    uncheckedAssertTrue([unmanaged.anyDoubleObj containsObject:@3.3]);\n    uncheckedAssertTrue([unmanaged.anyStringObj containsObject:@\"b\"]);\n    uncheckedAssertTrue([unmanaged.anyDataObj containsObject:data(2)]);\n    uncheckedAssertTrue([unmanaged.anyDateObj containsObject:date(2)]);\n    uncheckedAssertTrue([unmanaged.anyDecimalObj containsObject:decimal128(2)]);\n    uncheckedAssertTrue([unmanaged.anyObjectIdObj containsObject:objectId(2)]);\n    uncheckedAssertTrue([unmanaged.anyUUIDObj containsObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    uncheckedAssertTrue([optUnmanaged.boolObj containsObject:@NO]);\n    uncheckedAssertTrue([optUnmanaged.intObj containsObject:@2]);\n    uncheckedAssertTrue([optUnmanaged.floatObj containsObject:@2.2f]);\n    uncheckedAssertTrue([optUnmanaged.doubleObj containsObject:@2.2]);\n    uncheckedAssertTrue([optUnmanaged.stringObj containsObject:@\"a\"]);\n    uncheckedAssertTrue([optUnmanaged.dataObj containsObject:data(1)]);\n    uncheckedAssertTrue([optUnmanaged.dateObj containsObject:date(1)]);\n    uncheckedAssertTrue([optUnmanaged.decimalObj containsObject:decimal128(1)]);\n    uncheckedAssertTrue([optUnmanaged.objectIdObj containsObject:objectId(1)]);\n    uncheckedAssertTrue([optUnmanaged.uuidObj containsObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    uncheckedAssertTrue([managed.boolObj containsObject:@YES]);\n    uncheckedAssertTrue([managed.intObj containsObject:@3]);\n    uncheckedAssertTrue([managed.floatObj containsObject:@3.3f]);\n    uncheckedAssertTrue([managed.doubleObj containsObject:@3.3]);\n    uncheckedAssertTrue([managed.stringObj containsObject:@\"bc\"]);\n    uncheckedAssertTrue([managed.dataObj containsObject:data(2)]);\n    uncheckedAssertTrue([managed.dateObj containsObject:date(2)]);\n    uncheckedAssertTrue([managed.decimalObj containsObject:decimal128(2)]);\n    uncheckedAssertTrue([managed.objectIdObj containsObject:objectId(2)]);\n    uncheckedAssertTrue([managed.uuidObj containsObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertTrue([managed.anyBoolObj containsObject:@YES]);\n    uncheckedAssertTrue([managed.anyIntObj containsObject:@3]);\n    uncheckedAssertTrue([managed.anyFloatObj containsObject:@3.3f]);\n    uncheckedAssertTrue([managed.anyDoubleObj containsObject:@3.3]);\n    uncheckedAssertTrue([managed.anyStringObj containsObject:@\"b\"]);\n    uncheckedAssertTrue([managed.anyDataObj containsObject:data(2)]);\n    uncheckedAssertTrue([managed.anyDateObj containsObject:date(2)]);\n    uncheckedAssertTrue([managed.anyDecimalObj containsObject:decimal128(2)]);\n    uncheckedAssertTrue([managed.anyObjectIdObj containsObject:objectId(2)]);\n    uncheckedAssertTrue([managed.anyUUIDObj containsObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    uncheckedAssertTrue([optManaged.boolObj containsObject:@NO]);\n    uncheckedAssertTrue([optManaged.intObj containsObject:@2]);\n    uncheckedAssertTrue([optManaged.floatObj containsObject:@2.2f]);\n    uncheckedAssertTrue([optManaged.doubleObj containsObject:@2.2]);\n    uncheckedAssertTrue([optManaged.stringObj containsObject:@\"a\"]);\n    uncheckedAssertTrue([optManaged.dataObj containsObject:data(1)]);\n    uncheckedAssertTrue([optManaged.dateObj containsObject:date(1)]);\n    uncheckedAssertTrue([optManaged.decimalObj containsObject:decimal128(1)]);\n    uncheckedAssertTrue([optManaged.objectIdObj containsObject:objectId(1)]);\n    uncheckedAssertTrue([optManaged.uuidObj containsObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    uncheckedAssertTrue([optUnmanaged.intObj containsObject:@3]);\n    uncheckedAssertTrue([optUnmanaged.floatObj containsObject:@3.3f]);\n    uncheckedAssertTrue([optUnmanaged.doubleObj containsObject:@3.3]);\n    uncheckedAssertTrue([optUnmanaged.stringObj containsObject:@\"bc\"]);\n    uncheckedAssertTrue([optUnmanaged.dataObj containsObject:data(2)]);\n    uncheckedAssertTrue([optUnmanaged.dateObj containsObject:date(2)]);\n    uncheckedAssertTrue([optUnmanaged.decimalObj containsObject:decimal128(2)]);\n    uncheckedAssertTrue([optUnmanaged.objectIdObj containsObject:objectId(2)]);\n    uncheckedAssertTrue([optUnmanaged.uuidObj containsObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    uncheckedAssertTrue([optManaged.boolObj containsObject:@YES]);\n    uncheckedAssertTrue([optManaged.intObj containsObject:@3]);\n    uncheckedAssertTrue([optManaged.floatObj containsObject:@3.3f]);\n    uncheckedAssertTrue([optManaged.doubleObj containsObject:@3.3]);\n    uncheckedAssertTrue([optManaged.stringObj containsObject:@\"bc\"]);\n    uncheckedAssertTrue([optManaged.dataObj containsObject:data(2)]);\n    uncheckedAssertTrue([optManaged.dateObj containsObject:date(2)]);\n    uncheckedAssertTrue([optManaged.decimalObj containsObject:decimal128(2)]);\n    uncheckedAssertTrue([optManaged.objectIdObj containsObject:objectId(2)]);\n    uncheckedAssertTrue([optManaged.uuidObj containsObject:uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n}\n\n- (void)testRemoveObject {\n    [self addObjects];\n    uncheckedAssertEqual(unmanaged.boolObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.intObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.floatObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.doubleObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.stringObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.dataObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.dateObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.decimalObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.objectIdObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.uuidObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyBoolObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyIntObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyFloatObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyDoubleObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyStringObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyDataObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyDateObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyDecimalObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyObjectIdObj.count, 2U);\n    uncheckedAssertEqual(unmanaged.anyUUIDObj.count, 2U);\n    uncheckedAssertEqual(managed.boolObj.count, 2U);\n    uncheckedAssertEqual(managed.intObj.count, 2U);\n    uncheckedAssertEqual(managed.floatObj.count, 2U);\n    uncheckedAssertEqual(managed.doubleObj.count, 2U);\n    uncheckedAssertEqual(managed.stringObj.count, 2U);\n    uncheckedAssertEqual(managed.dataObj.count, 2U);\n    uncheckedAssertEqual(managed.dateObj.count, 2U);\n    uncheckedAssertEqual(managed.decimalObj.count, 2U);\n    uncheckedAssertEqual(managed.objectIdObj.count, 2U);\n    uncheckedAssertEqual(managed.uuidObj.count, 2U);\n    uncheckedAssertEqual(managed.anyBoolObj.count, 2U);\n    uncheckedAssertEqual(managed.anyIntObj.count, 2U);\n    uncheckedAssertEqual(managed.anyFloatObj.count, 2U);\n    uncheckedAssertEqual(managed.anyDoubleObj.count, 2U);\n    uncheckedAssertEqual(managed.anyStringObj.count, 2U);\n    uncheckedAssertEqual(managed.anyDataObj.count, 2U);\n    uncheckedAssertEqual(managed.anyDateObj.count, 2U);\n    uncheckedAssertEqual(managed.anyDecimalObj.count, 2U);\n    uncheckedAssertEqual(managed.anyObjectIdObj.count, 2U);\n    uncheckedAssertEqual(managed.anyUUIDObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.intObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.floatObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.doubleObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.stringObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.dataObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.dateObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.decimalObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.objectIdObj.count, 3U);\n    uncheckedAssertEqual(optUnmanaged.uuidObj.count, 3U);\n    uncheckedAssertEqual(optManaged.boolObj.count, 3U);\n    uncheckedAssertEqual(optManaged.intObj.count, 3U);\n    uncheckedAssertEqual(optManaged.floatObj.count, 3U);\n    uncheckedAssertEqual(optManaged.doubleObj.count, 3U);\n    uncheckedAssertEqual(optManaged.stringObj.count, 3U);\n    uncheckedAssertEqual(optManaged.dataObj.count, 3U);\n    uncheckedAssertEqual(optManaged.dateObj.count, 3U);\n    uncheckedAssertEqual(optManaged.decimalObj.count, 3U);\n    uncheckedAssertEqual(optManaged.objectIdObj.count, 3U);\n    uncheckedAssertEqual(optManaged.uuidObj.count, 3U);\n\n    for (RLMSet *set in allSets) {\n        [set removeObject:set.allObjects[0]];\n    }\n    uncheckedAssertEqual(unmanaged.boolObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.intObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.floatObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.doubleObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.stringObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.dataObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.dateObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.decimalObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.objectIdObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.uuidObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyBoolObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyIntObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyFloatObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyDoubleObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyStringObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyDataObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyDateObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyDecimalObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyObjectIdObj.count, 1U);\n    uncheckedAssertEqual(unmanaged.anyUUIDObj.count, 1U);\n    uncheckedAssertEqual(managed.boolObj.count, 1U);\n    uncheckedAssertEqual(managed.intObj.count, 1U);\n    uncheckedAssertEqual(managed.floatObj.count, 1U);\n    uncheckedAssertEqual(managed.doubleObj.count, 1U);\n    uncheckedAssertEqual(managed.stringObj.count, 1U);\n    uncheckedAssertEqual(managed.dataObj.count, 1U);\n    uncheckedAssertEqual(managed.dateObj.count, 1U);\n    uncheckedAssertEqual(managed.decimalObj.count, 1U);\n    uncheckedAssertEqual(managed.objectIdObj.count, 1U);\n    uncheckedAssertEqual(managed.uuidObj.count, 1U);\n    uncheckedAssertEqual(managed.anyBoolObj.count, 1U);\n    uncheckedAssertEqual(managed.anyIntObj.count, 1U);\n    uncheckedAssertEqual(managed.anyFloatObj.count, 1U);\n    uncheckedAssertEqual(managed.anyDoubleObj.count, 1U);\n    uncheckedAssertEqual(managed.anyStringObj.count, 1U);\n    uncheckedAssertEqual(managed.anyDataObj.count, 1U);\n    uncheckedAssertEqual(managed.anyDateObj.count, 1U);\n    uncheckedAssertEqual(managed.anyDecimalObj.count, 1U);\n    uncheckedAssertEqual(managed.anyObjectIdObj.count, 1U);\n    uncheckedAssertEqual(managed.anyUUIDObj.count, 1U);\n    uncheckedAssertEqual(optUnmanaged.intObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.floatObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.doubleObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.stringObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.dataObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.dateObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.decimalObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.objectIdObj.count, 2U);\n    uncheckedAssertEqual(optUnmanaged.uuidObj.count, 2U);\n    uncheckedAssertEqual(optManaged.boolObj.count, 2U);\n    uncheckedAssertEqual(optManaged.intObj.count, 2U);\n    uncheckedAssertEqual(optManaged.floatObj.count, 2U);\n    uncheckedAssertEqual(optManaged.doubleObj.count, 2U);\n    uncheckedAssertEqual(optManaged.stringObj.count, 2U);\n    uncheckedAssertEqual(optManaged.dataObj.count, 2U);\n    uncheckedAssertEqual(optManaged.dateObj.count, 2U);\n    uncheckedAssertEqual(optManaged.decimalObj.count, 2U);\n    uncheckedAssertEqual(optManaged.objectIdObj.count, 2U);\n    uncheckedAssertEqual(optManaged.uuidObj.count, 2U);\n}\n\n- (void)testIndexOfObjectSorted {\n    [managed.boolObj addObjects:@[@NO, @YES, @NO, @YES]];\n    [managed.intObj addObjects:@[@2, @3, @2, @3]];\n    [managed.floatObj addObjects:@[@2.2f, @3.3f, @2.2f, @3.3f]];\n    [managed.doubleObj addObjects:@[@2.2, @3.3, @2.2, @3.3]];\n    [managed.stringObj addObjects:@[@\"a\", @\"bc\", @\"a\", @\"bc\"]];\n    [managed.dataObj addObjects:@[data(1), data(2), data(1), data(2)]];\n    [managed.dateObj addObjects:@[date(1), date(2), date(1), date(2)]];\n    [managed.decimalObj addObjects:@[decimal128(1), decimal128(2), decimal128(1), decimal128(2)]];\n    [managed.objectIdObj addObjects:@[objectId(1), objectId(2), objectId(1), objectId(2)]];\n    [managed.uuidObj addObjects:@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]];\n    [managed.anyBoolObj addObjects:@[@NO, @YES, @NO, @YES]];\n    [managed.anyIntObj addObjects:@[@2, @3, @2, @3]];\n    [managed.anyFloatObj addObjects:@[@2.2f, @3.3f, @2.2f, @3.3f]];\n    [managed.anyDoubleObj addObjects:@[@2.2, @3.3, @2.2, @3.3]];\n    [managed.anyStringObj addObjects:@[@\"a\", @\"b\", @\"a\", @\"b\"]];\n    [managed.anyDataObj addObjects:@[data(1), data(2), data(1), data(2)]];\n    [managed.anyDateObj addObjects:@[date(1), date(2), date(1), date(2)]];\n    [managed.anyDecimalObj addObjects:@[decimal128(1), decimal128(2), decimal128(1), decimal128(2)]];\n    [managed.anyObjectIdObj addObjects:@[objectId(1), objectId(2), objectId(1), objectId(2)]];\n    [managed.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optManaged.boolObj addObjects:@[NSNull.null, @NO, NSNull.null, @NO, NSNull.null]];\n    [optManaged.intObj addObjects:@[NSNull.null, @2, NSNull.null, @2, NSNull.null]];\n    [optManaged.floatObj addObjects:@[NSNull.null, @2.2f, NSNull.null, @2.2f, NSNull.null]];\n    [optManaged.doubleObj addObjects:@[NSNull.null, @2.2, NSNull.null, @2.2, NSNull.null]];\n    [optManaged.stringObj addObjects:@[NSNull.null, @\"a\", NSNull.null, @\"a\", NSNull.null]];\n    [optManaged.dataObj addObjects:@[NSNull.null, data(1), NSNull.null, data(1), NSNull.null]];\n    [optManaged.dateObj addObjects:@[NSNull.null, date(1), NSNull.null, date(1), NSNull.null]];\n    [optManaged.decimalObj addObjects:@[NSNull.null, decimal128(1), NSNull.null, decimal128(1), NSNull.null]];\n    [optManaged.objectIdObj addObjects:@[NSNull.null, objectId(1), NSNull.null, objectId(1), NSNull.null]];\n    [optManaged.uuidObj addObjects:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n    // ordering can't be guaranteed in set, so just verify the indexes are between 0 and 1\n    uncheckedAssertTrue([[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@YES] == 0U || \n                        [[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@YES] == 1U);\n    uncheckedAssertTrue([[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3] == 0U || \n                        [[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3] == 1U);\n    uncheckedAssertTrue([[managed.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3.3f] == 0U || \n                        [[managed.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3.3f] == 1U);\n    uncheckedAssertTrue([[managed.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3.3] == 0U || \n                        [[managed.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3.3] == 1U);\n    uncheckedAssertTrue([[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@\"bc\"] == 0U || \n                        [[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@\"bc\"] == 1U);\n    uncheckedAssertTrue([[managed.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:data(2)] == 0U || \n                        [[managed.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:data(2)] == 1U);\n    uncheckedAssertTrue([[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:date(2)] == 0U || \n                        [[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:date(2)] == 1U);\n    uncheckedAssertTrue([[managed.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:decimal128(2)] == 0U || \n                        [[managed.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:decimal128(2)] == 1U);\n    uncheckedAssertTrue([[managed.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:objectId(2)] == 0U || \n                        [[managed.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:objectId(2)] == 1U);\n    uncheckedAssertTrue([[managed.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")] == 0U || \n                        [[managed.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")] == 1U);\n    uncheckedAssertTrue([[managed.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@YES] == 0U || \n                        [[managed.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@YES] == 1U);\n    uncheckedAssertTrue([[managed.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3] == 0U || \n                        [[managed.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3] == 1U);\n    uncheckedAssertTrue([[managed.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3.3f] == 0U || \n                        [[managed.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3.3f] == 1U);\n    uncheckedAssertTrue([[managed.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3.3] == 0U || \n                        [[managed.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@3.3] == 1U);\n    uncheckedAssertTrue([[managed.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@\"b\"] == 0U || \n                        [[managed.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@\"b\"] == 1U);\n    uncheckedAssertTrue([[managed.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:data(2)] == 0U || \n                        [[managed.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:data(2)] == 1U);\n    uncheckedAssertTrue([[managed.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:date(2)] == 0U || \n                        [[managed.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:date(2)] == 1U);\n    uncheckedAssertTrue([[managed.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:decimal128(2)] == 0U || \n                        [[managed.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:decimal128(2)] == 1U);\n    uncheckedAssertTrue([[managed.anyObjectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:objectId(2)] == 0U || \n                        [[managed.anyObjectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:objectId(2)] == 1U);\n    uncheckedAssertTrue([[managed.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")] == 0U || \n                        [[managed.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")] == 1U);\n    uncheckedAssertTrue([[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@NO] == 0U || \n                        [[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@NO] == 1U);\n    uncheckedAssertTrue([[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2] == 0U || \n                        [[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2] == 1U);\n    uncheckedAssertTrue([[managed.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2.2f] == 0U || \n                        [[managed.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2.2f] == 1U);\n    uncheckedAssertTrue([[managed.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2.2] == 0U || \n                        [[managed.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2.2] == 1U);\n    uncheckedAssertTrue([[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@\"a\"] == 0U || \n                        [[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@\"a\"] == 1U);\n    uncheckedAssertTrue([[managed.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:data(1)] == 0U || \n                        [[managed.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:data(1)] == 1U);\n    uncheckedAssertTrue([[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:date(1)] == 0U || \n                        [[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:date(1)] == 1U);\n    uncheckedAssertTrue([[managed.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:decimal128(1)] == 0U || \n                        [[managed.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:decimal128(1)] == 1U);\n    uncheckedAssertTrue([[managed.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:objectId(1)] == 0U || \n                        [[managed.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:objectId(1)] == 1U);\n    uncheckedAssertTrue([[managed.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")] == 0U || \n                        [[managed.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")] == 1U);\n    uncheckedAssertTrue([[managed.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@NO] == 0U || \n                        [[managed.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@NO] == 1U);\n    uncheckedAssertTrue([[managed.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2] == 0U || \n                        [[managed.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2] == 1U);\n    uncheckedAssertTrue([[managed.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2.2f] == 0U || \n                        [[managed.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2.2f] == 1U);\n    uncheckedAssertTrue([[managed.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2.2] == 0U || \n                        [[managed.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2.2] == 1U);\n    uncheckedAssertTrue([[managed.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@\"a\"] == 0U || \n                        [[managed.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@\"a\"] == 1U);\n    uncheckedAssertTrue([[managed.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:data(1)] == 0U || \n                        [[managed.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:data(1)] == 1U);\n    uncheckedAssertTrue([[managed.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:date(1)] == 0U || \n                        [[managed.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:date(1)] == 1U);\n    uncheckedAssertTrue([[managed.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:decimal128(1)] == 0U || \n                        [[managed.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:decimal128(1)] == 1U);\n    uncheckedAssertTrue([[managed.anyObjectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:objectId(1)] == 0U || \n                        [[managed.anyObjectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:objectId(1)] == 1U);\n    uncheckedAssertTrue([[managed.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")] == 0U || \n                        [[managed.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")] == 1U);\n\n    uncheckedAssertTrue([[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@NO] == 0U || \n                        [[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@NO] == 1U);\n    uncheckedAssertTrue([[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2] == 0U || \n                        [[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2] == 1U);\n    uncheckedAssertTrue([[optManaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2.2f] == 0U || \n                        [[optManaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2.2f] == 1U);\n    uncheckedAssertTrue([[optManaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2.2] == 0U || \n                        [[optManaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@2.2] == 1U);\n    uncheckedAssertTrue([[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@\"a\"] == 0U || \n                        [[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:@\"a\"] == 1U);\n    uncheckedAssertTrue([[optManaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:data(1)] == 0U || \n                        [[optManaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:data(1)] == 1U);\n    uncheckedAssertTrue([[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:date(1)] == 0U || \n                        [[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:date(1)] == 1U);\n    uncheckedAssertTrue([[optManaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:decimal128(1)] == 0U || \n                        [[optManaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:decimal128(1)] == 1U);\n    uncheckedAssertTrue([[optManaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:objectId(1)] == 0U || \n                        [[optManaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:objectId(1)] == 1U);\n    uncheckedAssertTrue([[optManaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")] == 0U || \n                        [[optManaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")] == 1U);\n    uncheckedAssertTrue([[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:NSNull.null] == 1U);\n}\n\n- (void)testIndexOfObjectDistinct {\n    [managed.boolObj addObjects:@[@NO, @NO, @YES]];\n    [managed.intObj addObjects:@[@2, @2, @3]];\n    [managed.floatObj addObjects:@[@2.2f, @2.2f, @3.3f]];\n    [managed.doubleObj addObjects:@[@2.2, @2.2, @3.3]];\n    [managed.stringObj addObjects:@[@\"a\", @\"a\", @\"bc\"]];\n    [managed.dataObj addObjects:@[data(1), data(1), data(2)]];\n    [managed.dateObj addObjects:@[date(1), date(1), date(2)]];\n    [managed.decimalObj addObjects:@[decimal128(1), decimal128(1), decimal128(2)]];\n    [managed.objectIdObj addObjects:@[objectId(1), objectId(1), objectId(2)]];\n    [managed.uuidObj addObjects:@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]];\n    [managed.anyBoolObj addObjects:@[@NO, @NO, @YES]];\n    [managed.anyIntObj addObjects:@[@2, @2, @3]];\n    [managed.anyFloatObj addObjects:@[@2.2f, @2.2f, @3.3f]];\n    [managed.anyDoubleObj addObjects:@[@2.2, @2.2, @3.3]];\n    [managed.anyStringObj addObjects:@[@\"a\", @\"a\", @\"b\"]];\n    [managed.anyDataObj addObjects:@[data(1), data(1), data(2)]];\n    [managed.anyDateObj addObjects:@[date(1), date(1), date(2)]];\n    [managed.anyDecimalObj addObjects:@[decimal128(1), decimal128(1), decimal128(2)]];\n    [managed.anyObjectIdObj addObjects:@[objectId(1), objectId(1), objectId(2)]];\n    [managed.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optManaged.boolObj addObjects:@[NSNull.null, NSNull.null, NSNull.null, @NO, NSNull.null]];\n    [optManaged.intObj addObjects:@[NSNull.null, NSNull.null, NSNull.null, @2, NSNull.null]];\n    [optManaged.floatObj addObjects:@[NSNull.null, NSNull.null, NSNull.null, @2.2f, NSNull.null]];\n    [optManaged.doubleObj addObjects:@[NSNull.null, NSNull.null, NSNull.null, @2.2, NSNull.null]];\n    [optManaged.stringObj addObjects:@[NSNull.null, NSNull.null, NSNull.null, @\"a\", NSNull.null]];\n    [optManaged.dataObj addObjects:@[NSNull.null, NSNull.null, NSNull.null, data(1), NSNull.null]];\n    [optManaged.dateObj addObjects:@[NSNull.null, NSNull.null, NSNull.null, date(1), NSNull.null]];\n    [optManaged.decimalObj addObjects:@[NSNull.null, NSNull.null, NSNull.null, decimal128(1), NSNull.null]];\n    [optManaged.objectIdObj addObjects:@[NSNull.null, NSNull.null, NSNull.null, objectId(1), NSNull.null]];\n    [optManaged.uuidObj addObjects:@[NSNull.null, NSNull.null, NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n    // ordering can't be guaranteed in set, so just verify the indexes are between 0 and 1\n    uncheckedAssertTrue([[managed.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@NO] == 0U || \n                        [[managed.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@NO] == 1U);\n    uncheckedAssertTrue([[managed.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2] == 0U || \n                        [[managed.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2] == 1U);\n    uncheckedAssertTrue([[managed.floatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2.2f] == 0U || \n                        [[managed.floatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2.2f] == 1U);\n    uncheckedAssertTrue([[managed.doubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2.2] == 0U || \n                        [[managed.doubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2.2] == 1U);\n    uncheckedAssertTrue([[managed.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@\"a\"] == 0U || \n                        [[managed.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@\"a\"] == 1U);\n    uncheckedAssertTrue([[managed.dataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:data(1)] == 0U || \n                        [[managed.dataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:data(1)] == 1U);\n    uncheckedAssertTrue([[managed.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:date(1)] == 0U || \n                        [[managed.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:date(1)] == 1U);\n    uncheckedAssertTrue([[managed.decimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:decimal128(1)] == 0U || \n                        [[managed.decimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:decimal128(1)] == 1U);\n    uncheckedAssertTrue([[managed.objectIdObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:objectId(1)] == 0U || \n                        [[managed.objectIdObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:objectId(1)] == 1U);\n    uncheckedAssertTrue([[managed.uuidObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")] == 0U || \n                        [[managed.uuidObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")] == 1U);\n    uncheckedAssertTrue([[managed.anyBoolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@NO] == 0U || \n                        [[managed.anyBoolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@NO] == 1U);\n    uncheckedAssertTrue([[managed.anyIntObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2] == 0U || \n                        [[managed.anyIntObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2] == 1U);\n    uncheckedAssertTrue([[managed.anyFloatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2.2f] == 0U || \n                        [[managed.anyFloatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2.2f] == 1U);\n    uncheckedAssertTrue([[managed.anyDoubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2.2] == 0U || \n                        [[managed.anyDoubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2.2] == 1U);\n    uncheckedAssertTrue([[managed.anyStringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@\"a\"] == 0U || \n                        [[managed.anyStringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@\"a\"] == 1U);\n    uncheckedAssertTrue([[managed.anyDataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:data(1)] == 0U || \n                        [[managed.anyDataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:data(1)] == 1U);\n    uncheckedAssertTrue([[managed.anyDateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:date(1)] == 0U || \n                        [[managed.anyDateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:date(1)] == 1U);\n    uncheckedAssertTrue([[managed.anyDecimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:decimal128(1)] == 0U || \n                        [[managed.anyDecimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:decimal128(1)] == 1U);\n    uncheckedAssertTrue([[managed.anyObjectIdObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:objectId(1)] == 0U || \n                        [[managed.anyObjectIdObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:objectId(1)] == 1U);\n    uncheckedAssertTrue([[managed.anyUUIDObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")] == 0U || \n                        [[managed.anyUUIDObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")] == 1U);\n    uncheckedAssertTrue([[managed.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@YES] == 0U || \n                        [[managed.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@YES] == 1U);\n    uncheckedAssertTrue([[managed.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3] == 0U || \n                        [[managed.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3] == 1U);\n    uncheckedAssertTrue([[managed.floatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3.3f] == 0U || \n                        [[managed.floatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3.3f] == 1U);\n    uncheckedAssertTrue([[managed.doubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3.3] == 0U || \n                        [[managed.doubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3.3] == 1U);\n    uncheckedAssertTrue([[managed.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@\"bc\"] == 0U || \n                        [[managed.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@\"bc\"] == 1U);\n    uncheckedAssertTrue([[managed.dataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:data(2)] == 0U || \n                        [[managed.dataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:data(2)] == 1U);\n    uncheckedAssertTrue([[managed.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:date(2)] == 0U || \n                        [[managed.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:date(2)] == 1U);\n    uncheckedAssertTrue([[managed.decimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:decimal128(2)] == 0U || \n                        [[managed.decimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:decimal128(2)] == 1U);\n    uncheckedAssertTrue([[managed.objectIdObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:objectId(2)] == 0U || \n                        [[managed.objectIdObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:objectId(2)] == 1U);\n    uncheckedAssertTrue([[managed.uuidObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")] == 0U || \n                        [[managed.uuidObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:uuid(@\"00000000-0000-0000-0000-000000000000\")] == 1U);\n    uncheckedAssertTrue([[managed.anyBoolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@YES] == 0U || \n                        [[managed.anyBoolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@YES] == 1U);\n    uncheckedAssertTrue([[managed.anyIntObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3] == 0U || \n                        [[managed.anyIntObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3] == 1U);\n    uncheckedAssertTrue([[managed.anyFloatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3.3f] == 0U || \n                        [[managed.anyFloatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3.3f] == 1U);\n    uncheckedAssertTrue([[managed.anyDoubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3.3] == 0U || \n                        [[managed.anyDoubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@3.3] == 1U);\n    uncheckedAssertTrue([[managed.anyStringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@\"b\"] == 0U || \n                        [[managed.anyStringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@\"b\"] == 1U);\n    uncheckedAssertTrue([[managed.anyDataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:data(2)] == 0U || \n                        [[managed.anyDataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:data(2)] == 1U);\n    uncheckedAssertTrue([[managed.anyDateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:date(2)] == 0U || \n                        [[managed.anyDateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:date(2)] == 1U);\n    uncheckedAssertTrue([[managed.anyDecimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:decimal128(2)] == 0U || \n                        [[managed.anyDecimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:decimal128(2)] == 1U);\n    uncheckedAssertTrue([[managed.anyObjectIdObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:objectId(2)] == 0U || \n                        [[managed.anyObjectIdObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:objectId(2)] == 1U);\n    uncheckedAssertTrue([[managed.anyUUIDObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")] == 0U || \n                        [[managed.anyUUIDObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")] == 1U);\n\n    uncheckedAssertTrue([[optManaged.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.floatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.floatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.doubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.doubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.dataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.dataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.decimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.decimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.objectIdObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.objectIdObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.uuidObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.uuidObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@NO] == 0U || \n                        [[optManaged.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@NO] == 1U);\n    uncheckedAssertTrue([[optManaged.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2] == 0U || \n                        [[optManaged.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2] == 1U);\n    uncheckedAssertTrue([[optManaged.floatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2.2f] == 0U || \n                        [[optManaged.floatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2.2f] == 1U);\n    uncheckedAssertTrue([[optManaged.doubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2.2] == 0U || \n                        [[optManaged.doubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@2.2] == 1U);\n    uncheckedAssertTrue([[optManaged.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@\"a\"] == 0U || \n                        [[optManaged.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:@\"a\"] == 1U);\n    uncheckedAssertTrue([[optManaged.dataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:data(1)] == 0U || \n                        [[optManaged.dataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:data(1)] == 1U);\n    uncheckedAssertTrue([[optManaged.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:date(1)] == 0U || \n                        [[optManaged.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:date(1)] == 1U);\n    uncheckedAssertTrue([[optManaged.decimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:decimal128(1)] == 0U || \n                        [[optManaged.decimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:decimal128(1)] == 1U);\n    uncheckedAssertTrue([[optManaged.objectIdObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:objectId(1)] == 0U || \n                        [[optManaged.objectIdObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:objectId(1)] == 1U);\n    uncheckedAssertTrue([[optManaged.uuidObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")] == 0U || \n                        [[optManaged.uuidObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")] == 1U);\n    uncheckedAssertTrue([[optManaged.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.boolObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.intObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.floatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.floatObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.doubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.doubleObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.stringObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.dataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.dataObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.dateObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.decimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.decimalObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.objectIdObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.objectIdObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n    uncheckedAssertTrue([[optManaged.uuidObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || \n                        [[optManaged.uuidObj distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n}\n\n- (void)testSort {\n    RLMAssertThrowsWithReason([unmanaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyObjectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.boolObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.intObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyBoolObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyIntObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyFloatObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDoubleObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyStringObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDataObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDateObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDecimalObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyObjectIdObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyUUIDObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj sortedResultsUsingDescriptors:@[]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([managed.boolObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.intObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.floatObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.doubleObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.stringObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.dataObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.dateObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.decimalObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.uuidObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyBoolObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyIntObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyFloatObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyDoubleObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyStringObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyDataObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyDateObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyDecimalObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyObjectIdObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([managed.anyUUIDObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.intObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.floatObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj sortedResultsUsingKeyPath:@\"not self\" ascending:NO], \n                              @\"can only be sorted on 'self'\");\n\n    [managed.boolObj addObjects:@[@NO, @YES, @NO]];\n    [managed.intObj addObjects:@[@2, @3, @2]];\n    [managed.floatObj addObjects:@[@2.2f, @3.3f, @2.2f]];\n    [managed.doubleObj addObjects:@[@2.2, @3.3, @2.2]];\n    [managed.stringObj addObjects:@[@\"a\", @\"bc\", @\"a\"]];\n    [managed.dataObj addObjects:@[data(1), data(2), data(1)]];\n    [managed.dateObj addObjects:@[date(1), date(2), date(1)]];\n    [managed.decimalObj addObjects:@[decimal128(1), decimal128(2), decimal128(1)]];\n    [managed.objectIdObj addObjects:@[objectId(1), objectId(2), objectId(1)]];\n    [managed.uuidObj addObjects:@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [managed.anyBoolObj addObjects:@[@NO, @YES, @NO]];\n    [managed.anyIntObj addObjects:@[@2, @3, @2]];\n    [managed.anyFloatObj addObjects:@[@2.2f, @3.3f, @2.2f]];\n    [managed.anyDoubleObj addObjects:@[@2.2, @3.3, @2.2]];\n    [managed.anyStringObj addObjects:@[@\"a\", @\"b\", @\"a\"]];\n    [managed.anyDataObj addObjects:@[data(1), data(2), data(1)]];\n    [managed.anyDateObj addObjects:@[date(1), date(2), date(1)]];\n    [managed.anyDecimalObj addObjects:@[decimal128(1), decimal128(2), decimal128(1)]];\n    [managed.anyObjectIdObj addObjects:@[objectId(1), objectId(2), objectId(1)]];\n    [managed.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]];\n    [optManaged.boolObj addObjects:@[NSNull.null, @NO, NSNull.null, @NO, NSNull.null]];\n    [optManaged.intObj addObjects:@[NSNull.null, @2, NSNull.null, @2, NSNull.null]];\n    [optManaged.floatObj addObjects:@[NSNull.null, @2.2f, NSNull.null, @2.2f, NSNull.null]];\n    [optManaged.doubleObj addObjects:@[NSNull.null, @2.2, NSNull.null, @2.2, NSNull.null]];\n    [optManaged.stringObj addObjects:@[NSNull.null, @\"a\", NSNull.null, @\"a\", NSNull.null]];\n    [optManaged.dataObj addObjects:@[NSNull.null, data(1), NSNull.null, data(1), NSNull.null]];\n    [optManaged.dateObj addObjects:@[NSNull.null, date(1), NSNull.null, date(1), NSNull.null]];\n    [optManaged.decimalObj addObjects:@[NSNull.null, decimal128(1), NSNull.null, decimal128(1), NSNull.null]];\n    [optManaged.objectIdObj addObjects:@[NSNull.null, objectId(1), NSNull.null, objectId(1), NSNull.null]];\n    [optManaged.uuidObj addObjects:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.boolObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@NO, @YES]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.intObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@2, @3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.floatObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@2.2f, @3.3f]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.doubleObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@2.2, @3.3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.stringObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@\"a\", @\"bc\"]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.dataObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[data(1), data(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.dateObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[date(1), date(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.decimalObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[decimal128(1), decimal128(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.objectIdObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[objectId(1), objectId(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.uuidObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyBoolObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@NO, @YES]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyIntObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@2, @3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyFloatObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@2.2f, @3.3f]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyDoubleObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@2.2, @3.3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyStringObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@\"a\", @\"b\"]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyDataObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[data(1), data(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyDateObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[date(1), date(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyDecimalObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[decimal128(1), decimal128(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyObjectIdObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[objectId(1), objectId(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyUUIDObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.boolObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, @NO]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.intObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, @2]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.floatObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, @2.2f]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.doubleObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, @2.2]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.stringObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, @\"a\"]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.dataObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, data(1)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.dateObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, date(1)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.decimalObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, decimal128(1)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.objectIdObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, objectId(1)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.uuidObj sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]]));\n\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@YES, @NO]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@3, @2]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@3.3f, @2.2f]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@3.3, @2.2]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@\"bc\", @\"a\"]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[data(2), data(1)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[date(2), date(1)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[decimal128(2), decimal128(1)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[objectId(2), objectId(1)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@YES, @NO]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@3, @2]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@3.3f, @2.2f]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@3.3, @2.2]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@\"b\", @\"a\"]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[data(2), data(1)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[date(2), date(1)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[decimal128(2), decimal128(1)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyObjectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[objectId(2), objectId(1)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@NO, NSNull.null]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@2, NSNull.null]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@2.2f, NSNull.null]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@2.2, NSNull.null]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@\"a\", NSNull.null]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[data(1), NSNull.null]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[date(1), NSNull.null]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[decimal128(1), NSNull.null]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[objectId(1), NSNull.null]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]]));\n\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@NO, @YES]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@2, @3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@2.2f, @3.3f]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@2.2, @3.3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@\"a\", @\"bc\"]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[data(1), data(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[date(1), date(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[decimal128(1), decimal128(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[objectId(1), objectId(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@NO, @YES]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@2, @3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@2.2f, @3.3f]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@2.2, @3.3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[@\"a\", @\"b\"]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[data(1), data(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[date(1), date(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[decimal128(1), decimal128(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyObjectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[objectId(1), objectId(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[managed.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, @NO]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, @2]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, @2.2f]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, @2.2]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, @\"a\"]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, data(1)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, date(1)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, decimal128(1)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, objectId(1)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[[optManaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], \n                                ([NSSet setWithArray:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]]));\n}\n\n- (void)testFilter {\n    RLMAssertThrowsWithReason([unmanaged.boolObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.intObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyBoolObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyIntObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyFloatObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDoubleObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyStringObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDataObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDateObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDecimalObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyObjectIdObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyUUIDObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.boolObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.intObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyBoolObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyIntObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyFloatObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDoubleObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyStringObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDataObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDateObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyDecimalObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyObjectIdObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([unmanaged.anyUUIDObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n\n    RLMAssertThrowsWithReason([managed.boolObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.intObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.floatObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.doubleObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.stringObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.dataObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.dateObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.decimalObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.objectIdObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.uuidObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyBoolObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyIntObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyFloatObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDoubleObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyStringObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDataObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDateObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDecimalObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyObjectIdObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyUUIDObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.boolObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.intObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.floatObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.stringObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.dataObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.dateObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj objectsWhere:@\"TRUEPREDICATE\"], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.boolObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.intObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.floatObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.doubleObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.stringObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.dataObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.dateObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.decimalObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.objectIdObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.uuidObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyBoolObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyIntObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyFloatObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDoubleObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyStringObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDataObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDateObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyDecimalObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyObjectIdObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([managed.anyUUIDObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.boolObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.intObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.floatObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.stringObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.dataObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.dateObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj objectsWithPredicate:[NSPredicate predicateWithValue:YES]], \n                              @\"implemented\");\n\n    RLMAssertThrowsWithReason([[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyObjectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyBoolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyIntObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyFloatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDoubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyStringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyDecimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyObjectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[managed.anyUUIDObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.boolObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.intObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.floatObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.doubleObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.stringObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.dataObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.dateObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.decimalObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.objectIdObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n    RLMAssertThrowsWithReason([[optManaged.uuidObj sortedResultsUsingKeyPath:@\"self\" ascending:NO] \n                               objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n}\n\n- (void)testNotifications {\n    RLMAssertThrowsWithReason([unmanaged.boolObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.intObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyBoolObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyIntObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyFloatObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyDoubleObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyStringObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyDataObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyDateObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyDecimalObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyObjectIdObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([unmanaged.anyUUIDObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], \n                              @\"Change notifications are only supported on managed collections.\");\n}\n\n- (void)testSetSet {\n    [managed.boolObj addObjects:@[@NO, @YES]];\n    [managed.intObj addObjects:@[@2, @3]];\n    [managed.floatObj addObjects:@[@2.2f, @3.3f]];\n    [managed.doubleObj addObjects:@[@2.2, @3.3]];\n    [managed.stringObj addObjects:@[@\"a\", @\"bc\"]];\n    [managed.dataObj addObjects:@[data(1), data(2)]];\n    [managed.dateObj addObjects:@[date(1), date(2)]];\n    [managed.decimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [managed.objectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [managed.uuidObj addObjects:@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]];\n    [managed.anyBoolObj addObjects:@[@NO, @YES]];\n    [managed.anyIntObj addObjects:@[@2, @3]];\n    [managed.anyFloatObj addObjects:@[@2.2f, @3.3f]];\n    [managed.anyDoubleObj addObjects:@[@2.2, @3.3]];\n    [managed.anyStringObj addObjects:@[@\"a\", @\"b\"]];\n    [managed.anyDataObj addObjects:@[data(1), data(2)]];\n    [managed.anyDateObj addObjects:@[date(1), date(2)]];\n    [managed.anyDecimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [managed.anyObjectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [managed.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optManaged.boolObj addObjects:@[NSNull.null, @NO, NSNull.null]];\n    [optManaged.intObj addObjects:@[NSNull.null, @2, NSNull.null]];\n    [optManaged.floatObj addObjects:@[NSNull.null, @2.2f, NSNull.null]];\n    [optManaged.doubleObj addObjects:@[NSNull.null, @2.2, NSNull.null]];\n    [optManaged.stringObj addObjects:@[NSNull.null, @\"a\", NSNull.null]];\n    [optManaged.dataObj addObjects:@[NSNull.null, data(1), NSNull.null]];\n    [optManaged.dateObj addObjects:@[NSNull.null, date(1), NSNull.null]];\n    [optManaged.decimalObj addObjects:@[NSNull.null, decimal128(1), NSNull.null]];\n    [optManaged.objectIdObj addObjects:@[NSNull.null, objectId(1), NSNull.null]];\n    [optManaged.uuidObj addObjects:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n    [managed.boolObj2 addObjects:@[@YES, @NO]];\n    [managed.intObj2 addObjects:@[@3, @4]];\n    [managed.floatObj2 addObjects:@[@3.3f, @4.4f]];\n    [managed.doubleObj2 addObjects:@[@3.3, @4.4]];\n    [managed.stringObj2 addObjects:@[@\"bc\", @\"de\"]];\n    [managed.dataObj2 addObjects:@[data(2), data(3)]];\n    [managed.dateObj2 addObjects:@[date(2), date(3)]];\n    [managed.decimalObj2 addObjects:@[decimal128(2), decimal128(3)]];\n    [managed.objectIdObj2 addObjects:@[objectId(2), objectId(3)]];\n    [managed.uuidObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [managed.anyBoolObj2 addObjects:@[@NO, @YES]];\n    [managed.anyIntObj2 addObjects:@[@2, @4]];\n    [managed.anyFloatObj2 addObjects:@[@2.2f, @4.4f]];\n    [managed.anyDoubleObj2 addObjects:@[@2.2, @4.4]];\n    [managed.anyStringObj2 addObjects:@[@\"a\", @\"d\"]];\n    [managed.anyDataObj2 addObjects:@[data(1), data(3)]];\n    [managed.anyDateObj2 addObjects:@[date(1), date(3)]];\n    [managed.anyDecimalObj2 addObjects:@[decimal128(1), decimal128(3)]];\n    [managed.anyObjectIdObj2 addObjects:@[objectId(1), objectId(3)]];\n    [managed.anyUUIDObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optManaged.boolObj2 addObjects:@[@YES, @NO, NSNull.null]];\n    [optManaged.intObj2 addObjects:@[@3, @4, NSNull.null]];\n    [optManaged.floatObj2 addObjects:@[@3.3f, @4.4f, NSNull.null]];\n    [optManaged.doubleObj2 addObjects:@[@3.3, @4.4, NSNull.null]];\n    [optManaged.stringObj2 addObjects:@[@\"bc\", @\"de\", NSNull.null]];\n    [optManaged.dataObj2 addObjects:@[data(2), data(3), NSNull.null]];\n    [optManaged.dateObj2 addObjects:@[date(2), date(3), NSNull.null]];\n    [optManaged.decimalObj2 addObjects:@[decimal128(2), decimal128(3), NSNull.null]];\n    [optManaged.objectIdObj2 addObjects:@[objectId(2), objectId(3), NSNull.null]];\n    [optManaged.uuidObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n    [realm commitWriteTransaction];\n\n    [unmanaged.boolObj addObjects:@[@NO, @YES]];\n    [unmanaged.intObj addObjects:@[@2, @3]];\n    [unmanaged.floatObj addObjects:@[@2.2f, @3.3f]];\n    [unmanaged.doubleObj addObjects:@[@2.2, @3.3]];\n    [unmanaged.stringObj addObjects:@[@\"a\", @\"bc\"]];\n    [unmanaged.dataObj addObjects:@[data(1), data(2)]];\n    [unmanaged.dateObj addObjects:@[date(1), date(2)]];\n    [unmanaged.decimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [unmanaged.objectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [unmanaged.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [unmanaged.anyBoolObj addObjects:@[@NO, @YES]];\n    [unmanaged.anyIntObj addObjects:@[@2, @3]];\n    [unmanaged.anyFloatObj addObjects:@[@2.2f, @3.3f]];\n    [unmanaged.anyDoubleObj addObjects:@[@2.2, @3.3]];\n    [unmanaged.anyStringObj addObjects:@[@\"a\", @\"b\"]];\n    [unmanaged.anyDataObj addObjects:@[data(1), data(2)]];\n    [unmanaged.anyDateObj addObjects:@[date(1), date(2)]];\n    [unmanaged.anyDecimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [unmanaged.anyObjectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [unmanaged.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optUnmanaged.intObj addObjects:@[NSNull.null, @2, NSNull.null]];\n    [optUnmanaged.floatObj addObjects:@[NSNull.null, @2.2f, NSNull.null]];\n    [optUnmanaged.doubleObj addObjects:@[NSNull.null, @2.2, NSNull.null]];\n    [optUnmanaged.stringObj addObjects:@[NSNull.null, @\"a\", NSNull.null]];\n    [optUnmanaged.dataObj addObjects:@[NSNull.null, data(1), NSNull.null]];\n    [optUnmanaged.dateObj addObjects:@[NSNull.null, date(1), NSNull.null]];\n    [optUnmanaged.decimalObj addObjects:@[NSNull.null, decimal128(1), NSNull.null]];\n    [optUnmanaged.objectIdObj addObjects:@[NSNull.null, objectId(1), NSNull.null]];\n    [optUnmanaged.uuidObj addObjects:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n    [unmanaged.boolObj2 addObjects:@[@NO, @YES]];\n    [unmanaged.intObj2 addObjects:@[@2, @4]];\n    [unmanaged.floatObj2 addObjects:@[@2.2f, @4.4f]];\n    [unmanaged.doubleObj2 addObjects:@[@2.2, @4.4]];\n    [unmanaged.stringObj2 addObjects:@[@\"a\", @\"de\"]];\n    [unmanaged.dataObj2 addObjects:@[data(1), data(3)]];\n    [unmanaged.dateObj2 addObjects:@[date(1), date(3)]];\n    [unmanaged.decimalObj2 addObjects:@[decimal128(1), decimal128(3)]];\n    [unmanaged.objectIdObj2 addObjects:@[objectId(1), objectId(3)]];\n    [unmanaged.uuidObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [unmanaged.anyBoolObj2 addObjects:@[@NO, @YES]];\n    [unmanaged.anyIntObj2 addObjects:@[@2, @4]];\n    [unmanaged.anyFloatObj2 addObjects:@[@4.4f, @3.3f]];\n    [unmanaged.anyDoubleObj2 addObjects:@[@2.2, @4.4]];\n    [unmanaged.anyStringObj2 addObjects:@[@\"a\", @\"d\"]];\n    [unmanaged.anyDataObj2 addObjects:@[data(1), data(3)]];\n    [unmanaged.anyDateObj2 addObjects:@[date(1), date(4)]];\n    [unmanaged.anyDecimalObj2 addObjects:@[decimal128(1), decimal128(3)]];\n    [unmanaged.anyObjectIdObj2 addObjects:@[objectId(1), objectId(3)]];\n    [unmanaged.anyUUIDObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optUnmanaged.intObj2 addObjects:@[@3, @4, NSNull.null]];\n    [optUnmanaged.floatObj2 addObjects:@[@3.3f, @4.4f, NSNull.null]];\n    [optUnmanaged.doubleObj2 addObjects:@[@3.3, @4.4, NSNull.null]];\n    [optUnmanaged.stringObj2 addObjects:@[@\"bc\", @\"de\", NSNull.null]];\n    [optUnmanaged.dataObj2 addObjects:@[data(2), data(3), NSNull.null]];\n    [optUnmanaged.dateObj2 addObjects:@[date(2), date(3), NSNull.null]];\n    [optUnmanaged.decimalObj2 addObjects:@[decimal128(2), decimal128(4), NSNull.null]];\n    [optUnmanaged.objectIdObj2 addObjects:@[objectId(2), objectId(4), NSNull.null]];\n    [optUnmanaged.uuidObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n\n    [unmanaged.boolObj setSet:unmanaged.boolObj2];\n    [unmanaged.intObj setSet:unmanaged.intObj2];\n    [unmanaged.floatObj setSet:unmanaged.floatObj2];\n    [unmanaged.doubleObj setSet:unmanaged.doubleObj2];\n    [unmanaged.stringObj setSet:unmanaged.stringObj2];\n    [unmanaged.dataObj setSet:unmanaged.dataObj2];\n    [unmanaged.dateObj setSet:unmanaged.dateObj2];\n    [unmanaged.decimalObj setSet:unmanaged.decimalObj2];\n    [unmanaged.objectIdObj setSet:unmanaged.objectIdObj2];\n    [unmanaged.uuidObj setSet:unmanaged.uuidObj2];\n    [unmanaged.anyBoolObj setSet:unmanaged.anyBoolObj2];\n    [unmanaged.anyIntObj setSet:unmanaged.anyIntObj2];\n    [unmanaged.anyFloatObj setSet:unmanaged.anyFloatObj2];\n    [unmanaged.anyDoubleObj setSet:unmanaged.anyDoubleObj2];\n    [unmanaged.anyStringObj setSet:unmanaged.anyStringObj2];\n    [unmanaged.anyDataObj setSet:unmanaged.anyDataObj2];\n    [unmanaged.anyDateObj setSet:unmanaged.anyDateObj2];\n    [unmanaged.anyDecimalObj setSet:unmanaged.anyDecimalObj2];\n    [unmanaged.anyObjectIdObj setSet:unmanaged.anyObjectIdObj2];\n    [unmanaged.anyUUIDObj setSet:unmanaged.anyUUIDObj2];\n    [optUnmanaged.intObj setSet:optUnmanaged.intObj2];\n    [optUnmanaged.floatObj setSet:optUnmanaged.floatObj2];\n    [optUnmanaged.doubleObj setSet:optUnmanaged.doubleObj2];\n    [optUnmanaged.stringObj setSet:optUnmanaged.stringObj2];\n    [optUnmanaged.dataObj setSet:optUnmanaged.dataObj2];\n    [optUnmanaged.dateObj setSet:optUnmanaged.dateObj2];\n    [optUnmanaged.decimalObj setSet:optUnmanaged.decimalObj2];\n    [optUnmanaged.objectIdObj setSet:optUnmanaged.objectIdObj2];\n    [optUnmanaged.uuidObj setSet:optUnmanaged.uuidObj2];\n\n    [realm beginWriteTransaction];\n    [managed.boolObj setSet:managed.boolObj2];\n    [managed.intObj setSet:managed.intObj2];\n    [managed.floatObj setSet:managed.floatObj2];\n    [managed.doubleObj setSet:managed.doubleObj2];\n    [managed.stringObj setSet:managed.stringObj2];\n    [managed.dataObj setSet:managed.dataObj2];\n    [managed.dateObj setSet:managed.dateObj2];\n    [managed.decimalObj setSet:managed.decimalObj2];\n    [managed.objectIdObj setSet:managed.objectIdObj2];\n    [managed.uuidObj setSet:managed.uuidObj2];\n    [managed.anyBoolObj setSet:managed.anyBoolObj2];\n    [managed.anyIntObj setSet:managed.anyIntObj2];\n    [managed.anyFloatObj setSet:managed.anyFloatObj2];\n    [managed.anyDoubleObj setSet:managed.anyDoubleObj2];\n    [managed.anyStringObj setSet:managed.anyStringObj2];\n    [managed.anyDataObj setSet:managed.anyDataObj2];\n    [managed.anyDateObj setSet:managed.anyDateObj2];\n    [managed.anyDecimalObj setSet:managed.anyDecimalObj2];\n    [managed.anyObjectIdObj setSet:managed.anyObjectIdObj2];\n    [managed.anyUUIDObj setSet:managed.anyUUIDObj2];\n    [optManaged.boolObj setSet:optManaged.boolObj2];\n    [optManaged.intObj setSet:optManaged.intObj2];\n    [optManaged.floatObj setSet:optManaged.floatObj2];\n    [optManaged.doubleObj setSet:optManaged.doubleObj2];\n    [optManaged.stringObj setSet:optManaged.stringObj2];\n    [optManaged.dataObj setSet:optManaged.dataObj2];\n    [optManaged.dateObj setSet:optManaged.dateObj2];\n    [optManaged.decimalObj setSet:optManaged.decimalObj2];\n    [optManaged.objectIdObj setSet:optManaged.objectIdObj2];\n    [optManaged.uuidObj setSet:optManaged.uuidObj2];\n    [realm commitWriteTransaction];\n\n    uncheckedAssertEqual(unmanaged.boolObj.count, 2U);\n    uncheckedAssertEqualObjects(unmanaged.boolObj.allObjects, (@[@NO, @YES]));\n    uncheckedAssertEqual(managed.boolObj.count, 2U);\n    uncheckedAssertEqualObjects([NSSet setWithArray:managed.boolObj.allObjects], ([NSSet setWithArray:@[@NO, @YES]]));\n    uncheckedAssertEqual(optManaged.boolObj.count, 3U);\n}\n\n- (void)testUnion {\n    [managed.boolObj addObjects:@[@NO, @YES]];\n    [managed.intObj addObjects:@[@2, @3]];\n    [managed.floatObj addObjects:@[@2.2f, @3.3f]];\n    [managed.doubleObj addObjects:@[@2.2, @3.3]];\n    [managed.stringObj addObjects:@[@\"a\", @\"bc\"]];\n    [managed.dataObj addObjects:@[data(1), data(2)]];\n    [managed.dateObj addObjects:@[date(1), date(2)]];\n    [managed.decimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [managed.objectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [managed.uuidObj addObjects:@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]];\n    [managed.anyBoolObj addObjects:@[@NO, @YES]];\n    [managed.anyIntObj addObjects:@[@2, @3]];\n    [managed.anyFloatObj addObjects:@[@2.2f, @3.3f]];\n    [managed.anyDoubleObj addObjects:@[@2.2, @3.3]];\n    [managed.anyStringObj addObjects:@[@\"a\", @\"b\"]];\n    [managed.anyDataObj addObjects:@[data(1), data(2)]];\n    [managed.anyDateObj addObjects:@[date(1), date(2)]];\n    [managed.anyDecimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [managed.anyObjectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [managed.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optManaged.boolObj addObjects:@[NSNull.null, @NO, NSNull.null]];\n    [optManaged.intObj addObjects:@[NSNull.null, @2, NSNull.null]];\n    [optManaged.floatObj addObjects:@[NSNull.null, @2.2f, NSNull.null]];\n    [optManaged.doubleObj addObjects:@[NSNull.null, @2.2, NSNull.null]];\n    [optManaged.stringObj addObjects:@[NSNull.null, @\"a\", NSNull.null]];\n    [optManaged.dataObj addObjects:@[NSNull.null, data(1), NSNull.null]];\n    [optManaged.dateObj addObjects:@[NSNull.null, date(1), NSNull.null]];\n    [optManaged.decimalObj addObjects:@[NSNull.null, decimal128(1), NSNull.null]];\n    [optManaged.objectIdObj addObjects:@[NSNull.null, objectId(1), NSNull.null]];\n    [optManaged.uuidObj addObjects:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n    [managed.boolObj2 addObjects:@[@YES, @NO]];\n    [managed.intObj2 addObjects:@[@3, @4]];\n    [managed.floatObj2 addObjects:@[@3.3f, @4.4f]];\n    [managed.doubleObj2 addObjects:@[@3.3, @4.4]];\n    [managed.stringObj2 addObjects:@[@\"bc\", @\"de\"]];\n    [managed.dataObj2 addObjects:@[data(2), data(3)]];\n    [managed.dateObj2 addObjects:@[date(2), date(3)]];\n    [managed.decimalObj2 addObjects:@[decimal128(2), decimal128(3)]];\n    [managed.objectIdObj2 addObjects:@[objectId(2), objectId(3)]];\n    [managed.uuidObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [managed.anyBoolObj2 addObjects:@[@NO, @YES]];\n    [managed.anyIntObj2 addObjects:@[@2, @4]];\n    [managed.anyFloatObj2 addObjects:@[@2.2f, @4.4f]];\n    [managed.anyDoubleObj2 addObjects:@[@2.2, @4.4]];\n    [managed.anyStringObj2 addObjects:@[@\"a\", @\"d\"]];\n    [managed.anyDataObj2 addObjects:@[data(1), data(3)]];\n    [managed.anyDateObj2 addObjects:@[date(1), date(3)]];\n    [managed.anyDecimalObj2 addObjects:@[decimal128(1), decimal128(3)]];\n    [managed.anyObjectIdObj2 addObjects:@[objectId(1), objectId(3)]];\n    [managed.anyUUIDObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optManaged.boolObj2 addObjects:@[@YES, @NO, NSNull.null]];\n    [optManaged.intObj2 addObjects:@[@3, @4, NSNull.null]];\n    [optManaged.floatObj2 addObjects:@[@3.3f, @4.4f, NSNull.null]];\n    [optManaged.doubleObj2 addObjects:@[@3.3, @4.4, NSNull.null]];\n    [optManaged.stringObj2 addObjects:@[@\"bc\", @\"de\", NSNull.null]];\n    [optManaged.dataObj2 addObjects:@[data(2), data(3), NSNull.null]];\n    [optManaged.dateObj2 addObjects:@[date(2), date(3), NSNull.null]];\n    [optManaged.decimalObj2 addObjects:@[decimal128(2), decimal128(3), NSNull.null]];\n    [optManaged.objectIdObj2 addObjects:@[objectId(2), objectId(3), NSNull.null]];\n    [optManaged.uuidObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n    [realm commitWriteTransaction];\n\n    [unmanaged.boolObj addObjects:@[@NO, @YES]];\n    [unmanaged.intObj addObjects:@[@2, @3]];\n    [unmanaged.floatObj addObjects:@[@2.2f, @3.3f]];\n    [unmanaged.doubleObj addObjects:@[@2.2, @3.3]];\n    [unmanaged.stringObj addObjects:@[@\"a\", @\"bc\"]];\n    [unmanaged.dataObj addObjects:@[data(1), data(2)]];\n    [unmanaged.dateObj addObjects:@[date(1), date(2)]];\n    [unmanaged.decimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [unmanaged.objectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [unmanaged.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [unmanaged.anyBoolObj addObjects:@[@NO, @YES]];\n    [unmanaged.anyIntObj addObjects:@[@2, @3]];\n    [unmanaged.anyFloatObj addObjects:@[@2.2f, @3.3f]];\n    [unmanaged.anyDoubleObj addObjects:@[@2.2, @3.3]];\n    [unmanaged.anyStringObj addObjects:@[@\"a\", @\"b\"]];\n    [unmanaged.anyDataObj addObjects:@[data(1), data(2)]];\n    [unmanaged.anyDateObj addObjects:@[date(1), date(2)]];\n    [unmanaged.anyDecimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [unmanaged.anyObjectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [unmanaged.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optUnmanaged.intObj addObjects:@[NSNull.null, @2, NSNull.null]];\n    [optUnmanaged.floatObj addObjects:@[NSNull.null, @2.2f, NSNull.null]];\n    [optUnmanaged.doubleObj addObjects:@[NSNull.null, @2.2, NSNull.null]];\n    [optUnmanaged.stringObj addObjects:@[NSNull.null, @\"a\", NSNull.null]];\n    [optUnmanaged.dataObj addObjects:@[NSNull.null, data(1), NSNull.null]];\n    [optUnmanaged.dateObj addObjects:@[NSNull.null, date(1), NSNull.null]];\n    [optUnmanaged.decimalObj addObjects:@[NSNull.null, decimal128(1), NSNull.null]];\n    [optUnmanaged.objectIdObj addObjects:@[NSNull.null, objectId(1), NSNull.null]];\n    [optUnmanaged.uuidObj addObjects:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n    [unmanaged.boolObj2 addObjects:@[@NO, @YES]];\n    [unmanaged.intObj2 addObjects:@[@2, @4]];\n    [unmanaged.floatObj2 addObjects:@[@2.2f, @4.4f]];\n    [unmanaged.doubleObj2 addObjects:@[@2.2, @4.4]];\n    [unmanaged.stringObj2 addObjects:@[@\"a\", @\"de\"]];\n    [unmanaged.dataObj2 addObjects:@[data(1), data(3)]];\n    [unmanaged.dateObj2 addObjects:@[date(1), date(3)]];\n    [unmanaged.decimalObj2 addObjects:@[decimal128(1), decimal128(3)]];\n    [unmanaged.objectIdObj2 addObjects:@[objectId(1), objectId(3)]];\n    [unmanaged.uuidObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [unmanaged.anyBoolObj2 addObjects:@[@NO, @YES]];\n    [unmanaged.anyIntObj2 addObjects:@[@2, @4]];\n    [unmanaged.anyFloatObj2 addObjects:@[@4.4f, @3.3f]];\n    [unmanaged.anyDoubleObj2 addObjects:@[@2.2, @4.4]];\n    [unmanaged.anyStringObj2 addObjects:@[@\"a\", @\"d\"]];\n    [unmanaged.anyDataObj2 addObjects:@[data(1), data(3)]];\n    [unmanaged.anyDateObj2 addObjects:@[date(1), date(4)]];\n    [unmanaged.anyDecimalObj2 addObjects:@[decimal128(1), decimal128(3)]];\n    [unmanaged.anyObjectIdObj2 addObjects:@[objectId(1), objectId(3)]];\n    [unmanaged.anyUUIDObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optUnmanaged.intObj2 addObjects:@[@3, @4, NSNull.null]];\n    [optUnmanaged.floatObj2 addObjects:@[@3.3f, @4.4f, NSNull.null]];\n    [optUnmanaged.doubleObj2 addObjects:@[@3.3, @4.4, NSNull.null]];\n    [optUnmanaged.stringObj2 addObjects:@[@\"bc\", @\"de\", NSNull.null]];\n    [optUnmanaged.dataObj2 addObjects:@[data(2), data(3), NSNull.null]];\n    [optUnmanaged.dateObj2 addObjects:@[date(2), date(3), NSNull.null]];\n    [optUnmanaged.decimalObj2 addObjects:@[decimal128(2), decimal128(4), NSNull.null]];\n    [optUnmanaged.objectIdObj2 addObjects:@[objectId(2), objectId(4), NSNull.null]];\n    [optUnmanaged.uuidObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n\n    XCTAssertThrows([managed.boolObj unionSet:managed.boolObj2]);\n    XCTAssertThrows([managed.intObj unionSet:managed.intObj2]);\n    XCTAssertThrows([managed.floatObj unionSet:managed.floatObj2]);\n    XCTAssertThrows([managed.doubleObj unionSet:managed.doubleObj2]);\n    XCTAssertThrows([managed.stringObj unionSet:managed.stringObj2]);\n    XCTAssertThrows([managed.dataObj unionSet:managed.dataObj2]);\n    XCTAssertThrows([managed.dateObj unionSet:managed.dateObj2]);\n    XCTAssertThrows([managed.decimalObj unionSet:managed.decimalObj2]);\n    XCTAssertThrows([managed.objectIdObj unionSet:managed.objectIdObj2]);\n    XCTAssertThrows([managed.uuidObj unionSet:managed.uuidObj2]);\n    XCTAssertThrows([managed.anyBoolObj unionSet:managed.anyBoolObj2]);\n    XCTAssertThrows([managed.anyIntObj unionSet:managed.anyIntObj2]);\n    XCTAssertThrows([managed.anyFloatObj unionSet:managed.anyFloatObj2]);\n    XCTAssertThrows([managed.anyDoubleObj unionSet:managed.anyDoubleObj2]);\n    XCTAssertThrows([managed.anyStringObj unionSet:managed.anyStringObj2]);\n    XCTAssertThrows([managed.anyDataObj unionSet:managed.anyDataObj2]);\n    XCTAssertThrows([managed.anyDateObj unionSet:managed.anyDateObj2]);\n    XCTAssertThrows([managed.anyDecimalObj unionSet:managed.anyDecimalObj2]);\n    XCTAssertThrows([managed.anyObjectIdObj unionSet:managed.anyObjectIdObj2]);\n    XCTAssertThrows([managed.anyUUIDObj unionSet:managed.anyUUIDObj2]);\n    XCTAssertThrows([optManaged.boolObj unionSet:optManaged.boolObj2]);\n    XCTAssertThrows([optManaged.intObj unionSet:optManaged.intObj2]);\n    XCTAssertThrows([optManaged.floatObj unionSet:optManaged.floatObj2]);\n    XCTAssertThrows([optManaged.doubleObj unionSet:optManaged.doubleObj2]);\n    XCTAssertThrows([optManaged.stringObj unionSet:optManaged.stringObj2]);\n    XCTAssertThrows([optManaged.dataObj unionSet:optManaged.dataObj2]);\n    XCTAssertThrows([optManaged.dateObj unionSet:optManaged.dateObj2]);\n    XCTAssertThrows([optManaged.decimalObj unionSet:optManaged.decimalObj2]);\n    XCTAssertThrows([optManaged.objectIdObj unionSet:optManaged.objectIdObj2]);\n    XCTAssertThrows([optManaged.uuidObj unionSet:optManaged.uuidObj2]);\n    [unmanaged.boolObj unionSet:unmanaged.boolObj2];\n    [unmanaged.intObj unionSet:unmanaged.intObj2];\n    [unmanaged.floatObj unionSet:unmanaged.floatObj2];\n    [unmanaged.doubleObj unionSet:unmanaged.doubleObj2];\n    [unmanaged.stringObj unionSet:unmanaged.stringObj2];\n    [unmanaged.dataObj unionSet:unmanaged.dataObj2];\n    [unmanaged.dateObj unionSet:unmanaged.dateObj2];\n    [unmanaged.decimalObj unionSet:unmanaged.decimalObj2];\n    [unmanaged.objectIdObj unionSet:unmanaged.objectIdObj2];\n    [unmanaged.uuidObj unionSet:unmanaged.uuidObj2];\n    [unmanaged.anyBoolObj unionSet:unmanaged.anyBoolObj2];\n    [unmanaged.anyIntObj unionSet:unmanaged.anyIntObj2];\n    [unmanaged.anyFloatObj unionSet:unmanaged.anyFloatObj2];\n    [unmanaged.anyDoubleObj unionSet:unmanaged.anyDoubleObj2];\n    [unmanaged.anyStringObj unionSet:unmanaged.anyStringObj2];\n    [unmanaged.anyDataObj unionSet:unmanaged.anyDataObj2];\n    [unmanaged.anyDateObj unionSet:unmanaged.anyDateObj2];\n    [unmanaged.anyDecimalObj unionSet:unmanaged.anyDecimalObj2];\n    [unmanaged.anyObjectIdObj unionSet:unmanaged.anyObjectIdObj2];\n    [unmanaged.anyUUIDObj unionSet:unmanaged.anyUUIDObj2];\n    [optUnmanaged.intObj unionSet:optUnmanaged.intObj2];\n    [optUnmanaged.floatObj unionSet:optUnmanaged.floatObj2];\n    [optUnmanaged.doubleObj unionSet:optUnmanaged.doubleObj2];\n    [optUnmanaged.stringObj unionSet:optUnmanaged.stringObj2];\n    [optUnmanaged.dataObj unionSet:optUnmanaged.dataObj2];\n    [optUnmanaged.dateObj unionSet:optUnmanaged.dateObj2];\n    [optUnmanaged.decimalObj unionSet:optUnmanaged.decimalObj2];\n    [optUnmanaged.objectIdObj unionSet:optUnmanaged.objectIdObj2];\n    [optUnmanaged.uuidObj unionSet:optUnmanaged.uuidObj2];\n\n    [realm beginWriteTransaction];\n    [managed.boolObj unionSet:managed.boolObj2];\n    [managed.intObj unionSet:managed.intObj2];\n    [managed.floatObj unionSet:managed.floatObj2];\n    [managed.doubleObj unionSet:managed.doubleObj2];\n    [managed.stringObj unionSet:managed.stringObj2];\n    [managed.dataObj unionSet:managed.dataObj2];\n    [managed.dateObj unionSet:managed.dateObj2];\n    [managed.decimalObj unionSet:managed.decimalObj2];\n    [managed.objectIdObj unionSet:managed.objectIdObj2];\n    [managed.uuidObj unionSet:managed.uuidObj2];\n    [managed.anyBoolObj unionSet:managed.anyBoolObj2];\n    [managed.anyIntObj unionSet:managed.anyIntObj2];\n    [managed.anyFloatObj unionSet:managed.anyFloatObj2];\n    [managed.anyDoubleObj unionSet:managed.anyDoubleObj2];\n    [managed.anyStringObj unionSet:managed.anyStringObj2];\n    [managed.anyDataObj unionSet:managed.anyDataObj2];\n    [managed.anyDateObj unionSet:managed.anyDateObj2];\n    [managed.anyDecimalObj unionSet:managed.anyDecimalObj2];\n    [managed.anyObjectIdObj unionSet:managed.anyObjectIdObj2];\n    [managed.anyUUIDObj unionSet:managed.anyUUIDObj2];\n    [optManaged.boolObj unionSet:optManaged.boolObj2];\n    [optManaged.intObj unionSet:optManaged.intObj2];\n    [optManaged.floatObj unionSet:optManaged.floatObj2];\n    [optManaged.doubleObj unionSet:optManaged.doubleObj2];\n    [optManaged.stringObj unionSet:optManaged.stringObj2];\n    [optManaged.dataObj unionSet:optManaged.dataObj2];\n    [optManaged.dateObj unionSet:optManaged.dateObj2];\n    [optManaged.decimalObj unionSet:optManaged.decimalObj2];\n    [optManaged.objectIdObj unionSet:optManaged.objectIdObj2];\n    [optManaged.uuidObj unionSet:optManaged.uuidObj2];\n    [realm commitWriteTransaction];\n\n    uncheckedAssertEqual(unmanaged.boolObj.count, 2U);\n    uncheckedAssertEqualObjects([NSSet setWithArray:unmanaged.boolObj.allObjects], ([NSSet setWithArray:@[@NO, @YES]]));\n    uncheckedAssertEqual(managed.boolObj.count, 2U);\n    uncheckedAssertEqualObjects([NSSet setWithArray:managed.boolObj.allObjects], ([NSSet setWithArray:@[@NO, @YES]]));\n    uncheckedAssertEqual(optManaged.boolObj.count, 3U);\n}\n\n- (void)testIntersect {\n    [managed.boolObj addObjects:@[@NO, @YES]];\n    [managed.intObj addObjects:@[@2, @3]];\n    [managed.floatObj addObjects:@[@2.2f, @3.3f]];\n    [managed.doubleObj addObjects:@[@2.2, @3.3]];\n    [managed.stringObj addObjects:@[@\"a\", @\"bc\"]];\n    [managed.dataObj addObjects:@[data(1), data(2)]];\n    [managed.dateObj addObjects:@[date(1), date(2)]];\n    [managed.decimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [managed.objectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [managed.uuidObj addObjects:@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]];\n    [managed.anyBoolObj addObjects:@[@NO, @YES]];\n    [managed.anyIntObj addObjects:@[@2, @3]];\n    [managed.anyFloatObj addObjects:@[@2.2f, @3.3f]];\n    [managed.anyDoubleObj addObjects:@[@2.2, @3.3]];\n    [managed.anyStringObj addObjects:@[@\"a\", @\"b\"]];\n    [managed.anyDataObj addObjects:@[data(1), data(2)]];\n    [managed.anyDateObj addObjects:@[date(1), date(2)]];\n    [managed.anyDecimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [managed.anyObjectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [managed.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optManaged.boolObj addObjects:@[NSNull.null, @NO, NSNull.null]];\n    [optManaged.intObj addObjects:@[NSNull.null, @2, NSNull.null]];\n    [optManaged.floatObj addObjects:@[NSNull.null, @2.2f, NSNull.null]];\n    [optManaged.doubleObj addObjects:@[NSNull.null, @2.2, NSNull.null]];\n    [optManaged.stringObj addObjects:@[NSNull.null, @\"a\", NSNull.null]];\n    [optManaged.dataObj addObjects:@[NSNull.null, data(1), NSNull.null]];\n    [optManaged.dateObj addObjects:@[NSNull.null, date(1), NSNull.null]];\n    [optManaged.decimalObj addObjects:@[NSNull.null, decimal128(1), NSNull.null]];\n    [optManaged.objectIdObj addObjects:@[NSNull.null, objectId(1), NSNull.null]];\n    [optManaged.uuidObj addObjects:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n    [managed.boolObj2 addObjects:@[@YES, @NO]];\n    [managed.intObj2 addObjects:@[@3, @4]];\n    [managed.floatObj2 addObjects:@[@3.3f, @4.4f]];\n    [managed.doubleObj2 addObjects:@[@3.3, @4.4]];\n    [managed.stringObj2 addObjects:@[@\"bc\", @\"de\"]];\n    [managed.dataObj2 addObjects:@[data(2), data(3)]];\n    [managed.dateObj2 addObjects:@[date(2), date(3)]];\n    [managed.decimalObj2 addObjects:@[decimal128(2), decimal128(3)]];\n    [managed.objectIdObj2 addObjects:@[objectId(2), objectId(3)]];\n    [managed.uuidObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [managed.anyBoolObj2 addObjects:@[@NO, @YES]];\n    [managed.anyIntObj2 addObjects:@[@2, @4]];\n    [managed.anyFloatObj2 addObjects:@[@2.2f, @4.4f]];\n    [managed.anyDoubleObj2 addObjects:@[@2.2, @4.4]];\n    [managed.anyStringObj2 addObjects:@[@\"a\", @\"d\"]];\n    [managed.anyDataObj2 addObjects:@[data(1), data(3)]];\n    [managed.anyDateObj2 addObjects:@[date(1), date(3)]];\n    [managed.anyDecimalObj2 addObjects:@[decimal128(1), decimal128(3)]];\n    [managed.anyObjectIdObj2 addObjects:@[objectId(1), objectId(3)]];\n    [managed.anyUUIDObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optManaged.boolObj2 addObjects:@[@YES, @NO, NSNull.null]];\n    [optManaged.intObj2 addObjects:@[@3, @4, NSNull.null]];\n    [optManaged.floatObj2 addObjects:@[@3.3f, @4.4f, NSNull.null]];\n    [optManaged.doubleObj2 addObjects:@[@3.3, @4.4, NSNull.null]];\n    [optManaged.stringObj2 addObjects:@[@\"bc\", @\"de\", NSNull.null]];\n    [optManaged.dataObj2 addObjects:@[data(2), data(3), NSNull.null]];\n    [optManaged.dateObj2 addObjects:@[date(2), date(3), NSNull.null]];\n    [optManaged.decimalObj2 addObjects:@[decimal128(2), decimal128(3), NSNull.null]];\n    [optManaged.objectIdObj2 addObjects:@[objectId(2), objectId(3), NSNull.null]];\n    [optManaged.uuidObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n    [realm commitWriteTransaction];\n\n    [unmanaged.boolObj addObjects:@[@NO, @YES]];\n    [unmanaged.intObj addObjects:@[@2, @3]];\n    [unmanaged.floatObj addObjects:@[@2.2f, @3.3f]];\n    [unmanaged.doubleObj addObjects:@[@2.2, @3.3]];\n    [unmanaged.stringObj addObjects:@[@\"a\", @\"bc\"]];\n    [unmanaged.dataObj addObjects:@[data(1), data(2)]];\n    [unmanaged.dateObj addObjects:@[date(1), date(2)]];\n    [unmanaged.decimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [unmanaged.objectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [unmanaged.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [unmanaged.anyBoolObj addObjects:@[@NO, @YES]];\n    [unmanaged.anyIntObj addObjects:@[@2, @3]];\n    [unmanaged.anyFloatObj addObjects:@[@2.2f, @3.3f]];\n    [unmanaged.anyDoubleObj addObjects:@[@2.2, @3.3]];\n    [unmanaged.anyStringObj addObjects:@[@\"a\", @\"b\"]];\n    [unmanaged.anyDataObj addObjects:@[data(1), data(2)]];\n    [unmanaged.anyDateObj addObjects:@[date(1), date(2)]];\n    [unmanaged.anyDecimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [unmanaged.anyObjectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [unmanaged.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optUnmanaged.intObj addObjects:@[NSNull.null, @2, NSNull.null]];\n    [optUnmanaged.floatObj addObjects:@[NSNull.null, @2.2f, NSNull.null]];\n    [optUnmanaged.doubleObj addObjects:@[NSNull.null, @2.2, NSNull.null]];\n    [optUnmanaged.stringObj addObjects:@[NSNull.null, @\"a\", NSNull.null]];\n    [optUnmanaged.dataObj addObjects:@[NSNull.null, data(1), NSNull.null]];\n    [optUnmanaged.dateObj addObjects:@[NSNull.null, date(1), NSNull.null]];\n    [optUnmanaged.decimalObj addObjects:@[NSNull.null, decimal128(1), NSNull.null]];\n    [optUnmanaged.objectIdObj addObjects:@[NSNull.null, objectId(1), NSNull.null]];\n    [optUnmanaged.uuidObj addObjects:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n    [unmanaged.boolObj2 addObjects:@[@NO, @YES]];\n    [unmanaged.intObj2 addObjects:@[@2, @4]];\n    [unmanaged.floatObj2 addObjects:@[@2.2f, @4.4f]];\n    [unmanaged.doubleObj2 addObjects:@[@2.2, @4.4]];\n    [unmanaged.stringObj2 addObjects:@[@\"a\", @\"de\"]];\n    [unmanaged.dataObj2 addObjects:@[data(1), data(3)]];\n    [unmanaged.dateObj2 addObjects:@[date(1), date(3)]];\n    [unmanaged.decimalObj2 addObjects:@[decimal128(1), decimal128(3)]];\n    [unmanaged.objectIdObj2 addObjects:@[objectId(1), objectId(3)]];\n    [unmanaged.uuidObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [unmanaged.anyBoolObj2 addObjects:@[@NO, @YES]];\n    [unmanaged.anyIntObj2 addObjects:@[@2, @4]];\n    [unmanaged.anyFloatObj2 addObjects:@[@4.4f, @3.3f]];\n    [unmanaged.anyDoubleObj2 addObjects:@[@2.2, @4.4]];\n    [unmanaged.anyStringObj2 addObjects:@[@\"a\", @\"d\"]];\n    [unmanaged.anyDataObj2 addObjects:@[data(1), data(3)]];\n    [unmanaged.anyDateObj2 addObjects:@[date(1), date(4)]];\n    [unmanaged.anyDecimalObj2 addObjects:@[decimal128(1), decimal128(3)]];\n    [unmanaged.anyObjectIdObj2 addObjects:@[objectId(1), objectId(3)]];\n    [unmanaged.anyUUIDObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optUnmanaged.intObj2 addObjects:@[@3, @4, NSNull.null]];\n    [optUnmanaged.floatObj2 addObjects:@[@3.3f, @4.4f, NSNull.null]];\n    [optUnmanaged.doubleObj2 addObjects:@[@3.3, @4.4, NSNull.null]];\n    [optUnmanaged.stringObj2 addObjects:@[@\"bc\", @\"de\", NSNull.null]];\n    [optUnmanaged.dataObj2 addObjects:@[data(2), data(3), NSNull.null]];\n    [optUnmanaged.dateObj2 addObjects:@[date(2), date(3), NSNull.null]];\n    [optUnmanaged.decimalObj2 addObjects:@[decimal128(2), decimal128(4), NSNull.null]];\n    [optUnmanaged.objectIdObj2 addObjects:@[objectId(2), objectId(4), NSNull.null]];\n    [optUnmanaged.uuidObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n\n    XCTAssertThrows([managed.boolObj intersectSet:managed.boolObj2]);\n    XCTAssertThrows([managed.intObj intersectSet:managed.intObj2]);\n    XCTAssertThrows([managed.floatObj intersectSet:managed.floatObj2]);\n    XCTAssertThrows([managed.doubleObj intersectSet:managed.doubleObj2]);\n    XCTAssertThrows([managed.stringObj intersectSet:managed.stringObj2]);\n    XCTAssertThrows([managed.dataObj intersectSet:managed.dataObj2]);\n    XCTAssertThrows([managed.dateObj intersectSet:managed.dateObj2]);\n    XCTAssertThrows([managed.decimalObj intersectSet:managed.decimalObj2]);\n    XCTAssertThrows([managed.objectIdObj intersectSet:managed.objectIdObj2]);\n    XCTAssertThrows([managed.uuidObj intersectSet:managed.uuidObj2]);\n    XCTAssertThrows([managed.anyBoolObj intersectSet:managed.anyBoolObj2]);\n    XCTAssertThrows([managed.anyIntObj intersectSet:managed.anyIntObj2]);\n    XCTAssertThrows([managed.anyFloatObj intersectSet:managed.anyFloatObj2]);\n    XCTAssertThrows([managed.anyDoubleObj intersectSet:managed.anyDoubleObj2]);\n    XCTAssertThrows([managed.anyStringObj intersectSet:managed.anyStringObj2]);\n    XCTAssertThrows([managed.anyDataObj intersectSet:managed.anyDataObj2]);\n    XCTAssertThrows([managed.anyDateObj intersectSet:managed.anyDateObj2]);\n    XCTAssertThrows([managed.anyDecimalObj intersectSet:managed.anyDecimalObj2]);\n    XCTAssertThrows([managed.anyObjectIdObj intersectSet:managed.anyObjectIdObj2]);\n    XCTAssertThrows([managed.anyUUIDObj intersectSet:managed.anyUUIDObj2]);\n    XCTAssertThrows([optManaged.boolObj intersectSet:optManaged.boolObj2]);\n    XCTAssertThrows([optManaged.intObj intersectSet:optManaged.intObj2]);\n    XCTAssertThrows([optManaged.floatObj intersectSet:optManaged.floatObj2]);\n    XCTAssertThrows([optManaged.doubleObj intersectSet:optManaged.doubleObj2]);\n    XCTAssertThrows([optManaged.stringObj intersectSet:optManaged.stringObj2]);\n    XCTAssertThrows([optManaged.dataObj intersectSet:optManaged.dataObj2]);\n    XCTAssertThrows([optManaged.dateObj intersectSet:optManaged.dateObj2]);\n    XCTAssertThrows([optManaged.decimalObj intersectSet:optManaged.decimalObj2]);\n    XCTAssertThrows([optManaged.objectIdObj intersectSet:optManaged.objectIdObj2]);\n    XCTAssertThrows([optManaged.uuidObj intersectSet:optManaged.uuidObj2]);\n    uncheckedAssertTrue([managed.boolObj intersectsSet:managed.boolObj2]);\n    uncheckedAssertTrue([managed.intObj intersectsSet:managed.intObj2]);\n    uncheckedAssertTrue([managed.floatObj intersectsSet:managed.floatObj2]);\n    uncheckedAssertTrue([managed.doubleObj intersectsSet:managed.doubleObj2]);\n    uncheckedAssertTrue([managed.stringObj intersectsSet:managed.stringObj2]);\n    uncheckedAssertTrue([managed.dataObj intersectsSet:managed.dataObj2]);\n    uncheckedAssertTrue([managed.dateObj intersectsSet:managed.dateObj2]);\n    uncheckedAssertTrue([managed.decimalObj intersectsSet:managed.decimalObj2]);\n    uncheckedAssertTrue([managed.objectIdObj intersectsSet:managed.objectIdObj2]);\n    uncheckedAssertTrue([managed.uuidObj intersectsSet:managed.uuidObj2]);\n    uncheckedAssertTrue([managed.anyBoolObj intersectsSet:managed.anyBoolObj2]);\n    uncheckedAssertTrue([managed.anyIntObj intersectsSet:managed.anyIntObj2]);\n    uncheckedAssertTrue([managed.anyFloatObj intersectsSet:managed.anyFloatObj2]);\n    uncheckedAssertTrue([managed.anyDoubleObj intersectsSet:managed.anyDoubleObj2]);\n    uncheckedAssertTrue([managed.anyStringObj intersectsSet:managed.anyStringObj2]);\n    uncheckedAssertTrue([managed.anyDataObj intersectsSet:managed.anyDataObj2]);\n    uncheckedAssertTrue([managed.anyDateObj intersectsSet:managed.anyDateObj2]);\n    uncheckedAssertTrue([managed.anyDecimalObj intersectsSet:managed.anyDecimalObj2]);\n    uncheckedAssertTrue([managed.anyObjectIdObj intersectsSet:managed.anyObjectIdObj2]);\n    uncheckedAssertTrue([managed.anyUUIDObj intersectsSet:managed.anyUUIDObj2]);\n    uncheckedAssertTrue([optManaged.boolObj intersectsSet:optManaged.boolObj2]);\n    uncheckedAssertTrue([optManaged.intObj intersectsSet:optManaged.intObj2]);\n    uncheckedAssertTrue([optManaged.floatObj intersectsSet:optManaged.floatObj2]);\n    uncheckedAssertTrue([optManaged.doubleObj intersectsSet:optManaged.doubleObj2]);\n    uncheckedAssertTrue([optManaged.stringObj intersectsSet:optManaged.stringObj2]);\n    uncheckedAssertTrue([optManaged.dataObj intersectsSet:optManaged.dataObj2]);\n    uncheckedAssertTrue([optManaged.dateObj intersectsSet:optManaged.dateObj2]);\n    uncheckedAssertTrue([optManaged.decimalObj intersectsSet:optManaged.decimalObj2]);\n    uncheckedAssertTrue([optManaged.objectIdObj intersectsSet:optManaged.objectIdObj2]);\n    uncheckedAssertTrue([optManaged.uuidObj intersectsSet:optManaged.uuidObj2]);\n    uncheckedAssertTrue([unmanaged.boolObj intersectsSet:unmanaged.boolObj2]);\n    uncheckedAssertTrue([unmanaged.intObj intersectsSet:unmanaged.intObj2]);\n    uncheckedAssertTrue([unmanaged.floatObj intersectsSet:unmanaged.floatObj2]);\n    uncheckedAssertTrue([unmanaged.doubleObj intersectsSet:unmanaged.doubleObj2]);\n    uncheckedAssertTrue([unmanaged.stringObj intersectsSet:unmanaged.stringObj2]);\n    uncheckedAssertTrue([unmanaged.dataObj intersectsSet:unmanaged.dataObj2]);\n    uncheckedAssertTrue([unmanaged.dateObj intersectsSet:unmanaged.dateObj2]);\n    uncheckedAssertTrue([unmanaged.decimalObj intersectsSet:unmanaged.decimalObj2]);\n    uncheckedAssertTrue([unmanaged.objectIdObj intersectsSet:unmanaged.objectIdObj2]);\n    uncheckedAssertTrue([unmanaged.uuidObj intersectsSet:unmanaged.uuidObj2]);\n    uncheckedAssertTrue([unmanaged.anyBoolObj intersectsSet:unmanaged.anyBoolObj2]);\n    uncheckedAssertTrue([unmanaged.anyIntObj intersectsSet:unmanaged.anyIntObj2]);\n    uncheckedAssertTrue([unmanaged.anyFloatObj intersectsSet:unmanaged.anyFloatObj2]);\n    uncheckedAssertTrue([unmanaged.anyDoubleObj intersectsSet:unmanaged.anyDoubleObj2]);\n    uncheckedAssertTrue([unmanaged.anyStringObj intersectsSet:unmanaged.anyStringObj2]);\n    uncheckedAssertTrue([unmanaged.anyDataObj intersectsSet:unmanaged.anyDataObj2]);\n    uncheckedAssertTrue([unmanaged.anyDateObj intersectsSet:unmanaged.anyDateObj2]);\n    uncheckedAssertTrue([unmanaged.anyDecimalObj intersectsSet:unmanaged.anyDecimalObj2]);\n    uncheckedAssertTrue([unmanaged.anyObjectIdObj intersectsSet:unmanaged.anyObjectIdObj2]);\n    uncheckedAssertTrue([unmanaged.anyUUIDObj intersectsSet:unmanaged.anyUUIDObj2]);\n    uncheckedAssertTrue([optUnmanaged.intObj intersectsSet:optUnmanaged.intObj2]);\n    uncheckedAssertTrue([optUnmanaged.floatObj intersectsSet:optUnmanaged.floatObj2]);\n    uncheckedAssertTrue([optUnmanaged.doubleObj intersectsSet:optUnmanaged.doubleObj2]);\n    uncheckedAssertTrue([optUnmanaged.stringObj intersectsSet:optUnmanaged.stringObj2]);\n    uncheckedAssertTrue([optUnmanaged.dataObj intersectsSet:optUnmanaged.dataObj2]);\n    uncheckedAssertTrue([optUnmanaged.dateObj intersectsSet:optUnmanaged.dateObj2]);\n    uncheckedAssertTrue([optUnmanaged.decimalObj intersectsSet:optUnmanaged.decimalObj2]);\n    uncheckedAssertTrue([optUnmanaged.objectIdObj intersectsSet:optUnmanaged.objectIdObj2]);\n    uncheckedAssertTrue([optUnmanaged.uuidObj intersectsSet:optUnmanaged.uuidObj2]);\n\n    [unmanaged.boolObj intersectSet:unmanaged.boolObj2];\n    [unmanaged.intObj intersectSet:unmanaged.intObj2];\n    [unmanaged.floatObj intersectSet:unmanaged.floatObj2];\n    [unmanaged.doubleObj intersectSet:unmanaged.doubleObj2];\n    [unmanaged.stringObj intersectSet:unmanaged.stringObj2];\n    [unmanaged.dataObj intersectSet:unmanaged.dataObj2];\n    [unmanaged.dateObj intersectSet:unmanaged.dateObj2];\n    [unmanaged.decimalObj intersectSet:unmanaged.decimalObj2];\n    [unmanaged.objectIdObj intersectSet:unmanaged.objectIdObj2];\n    [unmanaged.uuidObj intersectSet:unmanaged.uuidObj2];\n    [unmanaged.anyBoolObj intersectSet:unmanaged.anyBoolObj2];\n    [unmanaged.anyIntObj intersectSet:unmanaged.anyIntObj2];\n    [unmanaged.anyFloatObj intersectSet:unmanaged.anyFloatObj2];\n    [unmanaged.anyDoubleObj intersectSet:unmanaged.anyDoubleObj2];\n    [unmanaged.anyStringObj intersectSet:unmanaged.anyStringObj2];\n    [unmanaged.anyDataObj intersectSet:unmanaged.anyDataObj2];\n    [unmanaged.anyDateObj intersectSet:unmanaged.anyDateObj2];\n    [unmanaged.anyDecimalObj intersectSet:unmanaged.anyDecimalObj2];\n    [unmanaged.anyObjectIdObj intersectSet:unmanaged.anyObjectIdObj2];\n    [unmanaged.anyUUIDObj intersectSet:unmanaged.anyUUIDObj2];\n    [optUnmanaged.intObj intersectSet:optUnmanaged.intObj2];\n    [optUnmanaged.floatObj intersectSet:optUnmanaged.floatObj2];\n    [optUnmanaged.doubleObj intersectSet:optUnmanaged.doubleObj2];\n    [optUnmanaged.stringObj intersectSet:optUnmanaged.stringObj2];\n    [optUnmanaged.dataObj intersectSet:optUnmanaged.dataObj2];\n    [optUnmanaged.dateObj intersectSet:optUnmanaged.dateObj2];\n    [optUnmanaged.decimalObj intersectSet:optUnmanaged.decimalObj2];\n    [optUnmanaged.objectIdObj intersectSet:optUnmanaged.objectIdObj2];\n    [optUnmanaged.uuidObj intersectSet:optUnmanaged.uuidObj2];\n\n    [realm beginWriteTransaction];\n    [managed.boolObj intersectSet:managed.boolObj2];\n    [managed.intObj intersectSet:managed.intObj2];\n    [managed.floatObj intersectSet:managed.floatObj2];\n    [managed.doubleObj intersectSet:managed.doubleObj2];\n    [managed.stringObj intersectSet:managed.stringObj2];\n    [managed.dataObj intersectSet:managed.dataObj2];\n    [managed.dateObj intersectSet:managed.dateObj2];\n    [managed.decimalObj intersectSet:managed.decimalObj2];\n    [managed.objectIdObj intersectSet:managed.objectIdObj2];\n    [managed.uuidObj intersectSet:managed.uuidObj2];\n    [managed.anyBoolObj intersectSet:managed.anyBoolObj2];\n    [managed.anyIntObj intersectSet:managed.anyIntObj2];\n    [managed.anyFloatObj intersectSet:managed.anyFloatObj2];\n    [managed.anyDoubleObj intersectSet:managed.anyDoubleObj2];\n    [managed.anyStringObj intersectSet:managed.anyStringObj2];\n    [managed.anyDataObj intersectSet:managed.anyDataObj2];\n    [managed.anyDateObj intersectSet:managed.anyDateObj2];\n    [managed.anyDecimalObj intersectSet:managed.anyDecimalObj2];\n    [managed.anyObjectIdObj intersectSet:managed.anyObjectIdObj2];\n    [managed.anyUUIDObj intersectSet:managed.anyUUIDObj2];\n    [optManaged.boolObj intersectSet:optManaged.boolObj2];\n    [optManaged.intObj intersectSet:optManaged.intObj2];\n    [optManaged.floatObj intersectSet:optManaged.floatObj2];\n    [optManaged.doubleObj intersectSet:optManaged.doubleObj2];\n    [optManaged.stringObj intersectSet:optManaged.stringObj2];\n    [optManaged.dataObj intersectSet:optManaged.dataObj2];\n    [optManaged.dateObj intersectSet:optManaged.dateObj2];\n    [optManaged.decimalObj intersectSet:optManaged.decimalObj2];\n    [optManaged.objectIdObj intersectSet:optManaged.objectIdObj2];\n    [optManaged.uuidObj intersectSet:optManaged.uuidObj2];\n    [realm commitWriteTransaction];\n\n    uncheckedAssertEqual(unmanaged.boolObj.count, 2U);\n    uncheckedAssertEqualObjects([NSSet setWithArray:unmanaged.boolObj.allObjects], ([NSSet setWithArray:@[@NO, @YES]]));\n    uncheckedAssertEqual(managed.boolObj.count, 2U);\n    uncheckedAssertEqualObjects([NSSet setWithArray:managed.boolObj.allObjects], ([NSSet setWithArray:@[@NO, @YES]]));\n    uncheckedAssertEqual(optManaged.boolObj.count, 2U);\n    uncheckedAssertEqualObjects([NSSet setWithArray:optManaged.boolObj.allObjects], ([NSSet setWithArray:@[NSNull.null, @NO]]));\n}\n\n- (void)testMinus {\n    [managed.boolObj addObjects:@[@NO, @YES]];\n    [managed.intObj addObjects:@[@2, @3]];\n    [managed.floatObj addObjects:@[@2.2f, @3.3f]];\n    [managed.doubleObj addObjects:@[@2.2, @3.3]];\n    [managed.stringObj addObjects:@[@\"a\", @\"bc\"]];\n    [managed.dataObj addObjects:@[data(1), data(2)]];\n    [managed.dateObj addObjects:@[date(1), date(2)]];\n    [managed.decimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [managed.objectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [managed.uuidObj addObjects:@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]];\n    [managed.anyBoolObj addObjects:@[@NO, @YES]];\n    [managed.anyIntObj addObjects:@[@2, @3]];\n    [managed.anyFloatObj addObjects:@[@2.2f, @3.3f]];\n    [managed.anyDoubleObj addObjects:@[@2.2, @3.3]];\n    [managed.anyStringObj addObjects:@[@\"a\", @\"b\"]];\n    [managed.anyDataObj addObjects:@[data(1), data(2)]];\n    [managed.anyDateObj addObjects:@[date(1), date(2)]];\n    [managed.anyDecimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [managed.anyObjectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [managed.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optManaged.boolObj addObjects:@[NSNull.null, @NO, NSNull.null]];\n    [optManaged.intObj addObjects:@[NSNull.null, @2, NSNull.null]];\n    [optManaged.floatObj addObjects:@[NSNull.null, @2.2f, NSNull.null]];\n    [optManaged.doubleObj addObjects:@[NSNull.null, @2.2, NSNull.null]];\n    [optManaged.stringObj addObjects:@[NSNull.null, @\"a\", NSNull.null]];\n    [optManaged.dataObj addObjects:@[NSNull.null, data(1), NSNull.null]];\n    [optManaged.dateObj addObjects:@[NSNull.null, date(1), NSNull.null]];\n    [optManaged.decimalObj addObjects:@[NSNull.null, decimal128(1), NSNull.null]];\n    [optManaged.objectIdObj addObjects:@[NSNull.null, objectId(1), NSNull.null]];\n    [optManaged.uuidObj addObjects:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n    [managed.boolObj2 addObjects:@[@YES, @NO]];\n    [managed.intObj2 addObjects:@[@3, @4]];\n    [managed.floatObj2 addObjects:@[@3.3f, @4.4f]];\n    [managed.doubleObj2 addObjects:@[@3.3, @4.4]];\n    [managed.stringObj2 addObjects:@[@\"bc\", @\"de\"]];\n    [managed.dataObj2 addObjects:@[data(2), data(3)]];\n    [managed.dateObj2 addObjects:@[date(2), date(3)]];\n    [managed.decimalObj2 addObjects:@[decimal128(2), decimal128(3)]];\n    [managed.objectIdObj2 addObjects:@[objectId(2), objectId(3)]];\n    [managed.uuidObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [managed.anyBoolObj2 addObjects:@[@NO, @YES]];\n    [managed.anyIntObj2 addObjects:@[@2, @4]];\n    [managed.anyFloatObj2 addObjects:@[@2.2f, @4.4f]];\n    [managed.anyDoubleObj2 addObjects:@[@2.2, @4.4]];\n    [managed.anyStringObj2 addObjects:@[@\"a\", @\"d\"]];\n    [managed.anyDataObj2 addObjects:@[data(1), data(3)]];\n    [managed.anyDateObj2 addObjects:@[date(1), date(3)]];\n    [managed.anyDecimalObj2 addObjects:@[decimal128(1), decimal128(3)]];\n    [managed.anyObjectIdObj2 addObjects:@[objectId(1), objectId(3)]];\n    [managed.anyUUIDObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optManaged.boolObj2 addObjects:@[@YES, @NO, NSNull.null]];\n    [optManaged.intObj2 addObjects:@[@3, @4, NSNull.null]];\n    [optManaged.floatObj2 addObjects:@[@3.3f, @4.4f, NSNull.null]];\n    [optManaged.doubleObj2 addObjects:@[@3.3, @4.4, NSNull.null]];\n    [optManaged.stringObj2 addObjects:@[@\"bc\", @\"de\", NSNull.null]];\n    [optManaged.dataObj2 addObjects:@[data(2), data(3), NSNull.null]];\n    [optManaged.dateObj2 addObjects:@[date(2), date(3), NSNull.null]];\n    [optManaged.decimalObj2 addObjects:@[decimal128(2), decimal128(3), NSNull.null]];\n    [optManaged.objectIdObj2 addObjects:@[objectId(2), objectId(3), NSNull.null]];\n    [optManaged.uuidObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n    [realm commitWriteTransaction];\n\n    [unmanaged.boolObj addObjects:@[@NO, @YES]];\n    [unmanaged.intObj addObjects:@[@2, @3]];\n    [unmanaged.floatObj addObjects:@[@2.2f, @3.3f]];\n    [unmanaged.doubleObj addObjects:@[@2.2, @3.3]];\n    [unmanaged.stringObj addObjects:@[@\"a\", @\"bc\"]];\n    [unmanaged.dataObj addObjects:@[data(1), data(2)]];\n    [unmanaged.dateObj addObjects:@[date(1), date(2)]];\n    [unmanaged.decimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [unmanaged.objectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [unmanaged.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [unmanaged.anyBoolObj addObjects:@[@NO, @YES]];\n    [unmanaged.anyIntObj addObjects:@[@2, @3]];\n    [unmanaged.anyFloatObj addObjects:@[@2.2f, @3.3f]];\n    [unmanaged.anyDoubleObj addObjects:@[@2.2, @3.3]];\n    [unmanaged.anyStringObj addObjects:@[@\"a\", @\"b\"]];\n    [unmanaged.anyDataObj addObjects:@[data(1), data(2)]];\n    [unmanaged.anyDateObj addObjects:@[date(1), date(2)]];\n    [unmanaged.anyDecimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [unmanaged.anyObjectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [unmanaged.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optUnmanaged.intObj addObjects:@[NSNull.null, @2, NSNull.null]];\n    [optUnmanaged.floatObj addObjects:@[NSNull.null, @2.2f, NSNull.null]];\n    [optUnmanaged.doubleObj addObjects:@[NSNull.null, @2.2, NSNull.null]];\n    [optUnmanaged.stringObj addObjects:@[NSNull.null, @\"a\", NSNull.null]];\n    [optUnmanaged.dataObj addObjects:@[NSNull.null, data(1), NSNull.null]];\n    [optUnmanaged.dateObj addObjects:@[NSNull.null, date(1), NSNull.null]];\n    [optUnmanaged.decimalObj addObjects:@[NSNull.null, decimal128(1), NSNull.null]];\n    [optUnmanaged.objectIdObj addObjects:@[NSNull.null, objectId(1), NSNull.null]];\n    [optUnmanaged.uuidObj addObjects:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n    [unmanaged.boolObj2 addObjects:@[@NO, @YES]];\n    [unmanaged.intObj2 addObjects:@[@2, @4]];\n    [unmanaged.floatObj2 addObjects:@[@2.2f, @4.4f]];\n    [unmanaged.doubleObj2 addObjects:@[@2.2, @4.4]];\n    [unmanaged.stringObj2 addObjects:@[@\"a\", @\"de\"]];\n    [unmanaged.dataObj2 addObjects:@[data(1), data(3)]];\n    [unmanaged.dateObj2 addObjects:@[date(1), date(3)]];\n    [unmanaged.decimalObj2 addObjects:@[decimal128(1), decimal128(3)]];\n    [unmanaged.objectIdObj2 addObjects:@[objectId(1), objectId(3)]];\n    [unmanaged.uuidObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [unmanaged.anyBoolObj2 addObjects:@[@NO, @YES]];\n    [unmanaged.anyIntObj2 addObjects:@[@2, @4]];\n    [unmanaged.anyFloatObj2 addObjects:@[@4.4f, @3.3f]];\n    [unmanaged.anyDoubleObj2 addObjects:@[@2.2, @4.4]];\n    [unmanaged.anyStringObj2 addObjects:@[@\"a\", @\"d\"]];\n    [unmanaged.anyDataObj2 addObjects:@[data(1), data(3)]];\n    [unmanaged.anyDateObj2 addObjects:@[date(1), date(4)]];\n    [unmanaged.anyDecimalObj2 addObjects:@[decimal128(1), decimal128(3)]];\n    [unmanaged.anyObjectIdObj2 addObjects:@[objectId(1), objectId(3)]];\n    [unmanaged.anyUUIDObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optUnmanaged.intObj2 addObjects:@[@3, @4, NSNull.null]];\n    [optUnmanaged.floatObj2 addObjects:@[@3.3f, @4.4f, NSNull.null]];\n    [optUnmanaged.doubleObj2 addObjects:@[@3.3, @4.4, NSNull.null]];\n    [optUnmanaged.stringObj2 addObjects:@[@\"bc\", @\"de\", NSNull.null]];\n    [optUnmanaged.dataObj2 addObjects:@[data(2), data(3), NSNull.null]];\n    [optUnmanaged.dateObj2 addObjects:@[date(2), date(3), NSNull.null]];\n    [optUnmanaged.decimalObj2 addObjects:@[decimal128(2), decimal128(4), NSNull.null]];\n    [optUnmanaged.objectIdObj2 addObjects:@[objectId(2), objectId(4), NSNull.null]];\n    [optUnmanaged.uuidObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n\n    XCTAssertThrows([managed.boolObj minusSet:managed.boolObj2]);\n    XCTAssertThrows([managed.intObj minusSet:managed.intObj2]);\n    XCTAssertThrows([managed.floatObj minusSet:managed.floatObj2]);\n    XCTAssertThrows([managed.doubleObj minusSet:managed.doubleObj2]);\n    XCTAssertThrows([managed.stringObj minusSet:managed.stringObj2]);\n    XCTAssertThrows([managed.dataObj minusSet:managed.dataObj2]);\n    XCTAssertThrows([managed.dateObj minusSet:managed.dateObj2]);\n    XCTAssertThrows([managed.decimalObj minusSet:managed.decimalObj2]);\n    XCTAssertThrows([managed.objectIdObj minusSet:managed.objectIdObj2]);\n    XCTAssertThrows([managed.uuidObj minusSet:managed.uuidObj2]);\n    XCTAssertThrows([managed.anyBoolObj minusSet:managed.anyBoolObj2]);\n    XCTAssertThrows([managed.anyIntObj minusSet:managed.anyIntObj2]);\n    XCTAssertThrows([managed.anyFloatObj minusSet:managed.anyFloatObj2]);\n    XCTAssertThrows([managed.anyDoubleObj minusSet:managed.anyDoubleObj2]);\n    XCTAssertThrows([managed.anyStringObj minusSet:managed.anyStringObj2]);\n    XCTAssertThrows([managed.anyDataObj minusSet:managed.anyDataObj2]);\n    XCTAssertThrows([managed.anyDateObj minusSet:managed.anyDateObj2]);\n    XCTAssertThrows([managed.anyDecimalObj minusSet:managed.anyDecimalObj2]);\n    XCTAssertThrows([managed.anyObjectIdObj minusSet:managed.anyObjectIdObj2]);\n    XCTAssertThrows([managed.anyUUIDObj minusSet:managed.anyUUIDObj2]);\n    XCTAssertThrows([optManaged.boolObj minusSet:optManaged.boolObj2]);\n    XCTAssertThrows([optManaged.intObj minusSet:optManaged.intObj2]);\n    XCTAssertThrows([optManaged.floatObj minusSet:optManaged.floatObj2]);\n    XCTAssertThrows([optManaged.doubleObj minusSet:optManaged.doubleObj2]);\n    XCTAssertThrows([optManaged.stringObj minusSet:optManaged.stringObj2]);\n    XCTAssertThrows([optManaged.dataObj minusSet:optManaged.dataObj2]);\n    XCTAssertThrows([optManaged.dateObj minusSet:optManaged.dateObj2]);\n    XCTAssertThrows([optManaged.decimalObj minusSet:optManaged.decimalObj2]);\n    XCTAssertThrows([optManaged.objectIdObj minusSet:optManaged.objectIdObj2]);\n    XCTAssertThrows([optManaged.uuidObj minusSet:optManaged.uuidObj2]);\n\n    [unmanaged.boolObj minusSet:unmanaged.boolObj2];\n    [unmanaged.intObj minusSet:unmanaged.intObj2];\n    [unmanaged.floatObj minusSet:unmanaged.floatObj2];\n    [unmanaged.doubleObj minusSet:unmanaged.doubleObj2];\n    [unmanaged.stringObj minusSet:unmanaged.stringObj2];\n    [unmanaged.dataObj minusSet:unmanaged.dataObj2];\n    [unmanaged.dateObj minusSet:unmanaged.dateObj2];\n    [unmanaged.decimalObj minusSet:unmanaged.decimalObj2];\n    [unmanaged.objectIdObj minusSet:unmanaged.objectIdObj2];\n    [unmanaged.uuidObj minusSet:unmanaged.uuidObj2];\n    [unmanaged.anyBoolObj minusSet:unmanaged.anyBoolObj2];\n    [unmanaged.anyIntObj minusSet:unmanaged.anyIntObj2];\n    [unmanaged.anyFloatObj minusSet:unmanaged.anyFloatObj2];\n    [unmanaged.anyDoubleObj minusSet:unmanaged.anyDoubleObj2];\n    [unmanaged.anyStringObj minusSet:unmanaged.anyStringObj2];\n    [unmanaged.anyDataObj minusSet:unmanaged.anyDataObj2];\n    [unmanaged.anyDateObj minusSet:unmanaged.anyDateObj2];\n    [unmanaged.anyDecimalObj minusSet:unmanaged.anyDecimalObj2];\n    [unmanaged.anyObjectIdObj minusSet:unmanaged.anyObjectIdObj2];\n    [unmanaged.anyUUIDObj minusSet:unmanaged.anyUUIDObj2];\n    [optUnmanaged.intObj minusSet:optUnmanaged.intObj2];\n    [optUnmanaged.floatObj minusSet:optUnmanaged.floatObj2];\n    [optUnmanaged.doubleObj minusSet:optUnmanaged.doubleObj2];\n    [optUnmanaged.stringObj minusSet:optUnmanaged.stringObj2];\n    [optUnmanaged.dataObj minusSet:optUnmanaged.dataObj2];\n    [optUnmanaged.dateObj minusSet:optUnmanaged.dateObj2];\n    [optUnmanaged.decimalObj minusSet:optUnmanaged.decimalObj2];\n    [optUnmanaged.objectIdObj minusSet:optUnmanaged.objectIdObj2];\n    [optUnmanaged.uuidObj minusSet:optUnmanaged.uuidObj2];\n\n    [realm beginWriteTransaction];\n    [managed.boolObj minusSet:managed.boolObj2];\n    [managed.intObj minusSet:managed.intObj2];\n    [managed.floatObj minusSet:managed.floatObj2];\n    [managed.doubleObj minusSet:managed.doubleObj2];\n    [managed.stringObj minusSet:managed.stringObj2];\n    [managed.dataObj minusSet:managed.dataObj2];\n    [managed.dateObj minusSet:managed.dateObj2];\n    [managed.decimalObj minusSet:managed.decimalObj2];\n    [managed.objectIdObj minusSet:managed.objectIdObj2];\n    [managed.uuidObj minusSet:managed.uuidObj2];\n    [managed.anyBoolObj minusSet:managed.anyBoolObj2];\n    [managed.anyIntObj minusSet:managed.anyIntObj2];\n    [managed.anyFloatObj minusSet:managed.anyFloatObj2];\n    [managed.anyDoubleObj minusSet:managed.anyDoubleObj2];\n    [managed.anyStringObj minusSet:managed.anyStringObj2];\n    [managed.anyDataObj minusSet:managed.anyDataObj2];\n    [managed.anyDateObj minusSet:managed.anyDateObj2];\n    [managed.anyDecimalObj minusSet:managed.anyDecimalObj2];\n    [managed.anyObjectIdObj minusSet:managed.anyObjectIdObj2];\n    [managed.anyUUIDObj minusSet:managed.anyUUIDObj2];\n    [optManaged.boolObj minusSet:optManaged.boolObj2];\n    [optManaged.intObj minusSet:optManaged.intObj2];\n    [optManaged.floatObj minusSet:optManaged.floatObj2];\n    [optManaged.doubleObj minusSet:optManaged.doubleObj2];\n    [optManaged.stringObj minusSet:optManaged.stringObj2];\n    [optManaged.dataObj minusSet:optManaged.dataObj2];\n    [optManaged.dateObj minusSet:optManaged.dateObj2];\n    [optManaged.decimalObj minusSet:optManaged.decimalObj2];\n    [optManaged.objectIdObj minusSet:optManaged.objectIdObj2];\n    [optManaged.uuidObj minusSet:optManaged.uuidObj2];\n    [realm commitWriteTransaction];\n\n    uncheckedAssertEqual(unmanaged.boolObj.count, 0U);\n    uncheckedAssertEqualObjects(unmanaged.boolObj.allObjects, (@[]));\n    uncheckedAssertEqual(managed.boolObj.count, 0U);\n    uncheckedAssertEqualObjects(managed.boolObj.allObjects, (@[]));\n    uncheckedAssertEqual(optManaged.boolObj.count, 0U);\n    uncheckedAssertEqualObjects(optManaged.boolObj.allObjects, (@[]));\n}\n\n- (void)testIsSubsetOfSet {\n    [managed.boolObj addObjects:@[@NO, @YES]];\n    [managed.intObj addObjects:@[@2, @3]];\n    [managed.floatObj addObjects:@[@2.2f, @3.3f]];\n    [managed.doubleObj addObjects:@[@2.2, @3.3]];\n    [managed.stringObj addObjects:@[@\"a\", @\"bc\"]];\n    [managed.dataObj addObjects:@[data(1), data(2)]];\n    [managed.dateObj addObjects:@[date(1), date(2)]];\n    [managed.decimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [managed.objectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [managed.uuidObj addObjects:@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]];\n    [managed.anyBoolObj addObjects:@[@NO, @YES]];\n    [managed.anyIntObj addObjects:@[@2, @3]];\n    [managed.anyFloatObj addObjects:@[@2.2f, @3.3f]];\n    [managed.anyDoubleObj addObjects:@[@2.2, @3.3]];\n    [managed.anyStringObj addObjects:@[@\"a\", @\"b\"]];\n    [managed.anyDataObj addObjects:@[data(1), data(2)]];\n    [managed.anyDateObj addObjects:@[date(1), date(2)]];\n    [managed.anyDecimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [managed.anyObjectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [managed.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optManaged.boolObj addObjects:@[NSNull.null, @NO, NSNull.null]];\n    [optManaged.intObj addObjects:@[NSNull.null, @2, NSNull.null]];\n    [optManaged.floatObj addObjects:@[NSNull.null, @2.2f, NSNull.null]];\n    [optManaged.doubleObj addObjects:@[NSNull.null, @2.2, NSNull.null]];\n    [optManaged.stringObj addObjects:@[NSNull.null, @\"a\", NSNull.null]];\n    [optManaged.dataObj addObjects:@[NSNull.null, data(1), NSNull.null]];\n    [optManaged.dateObj addObjects:@[NSNull.null, date(1), NSNull.null]];\n    [optManaged.decimalObj addObjects:@[NSNull.null, decimal128(1), NSNull.null]];\n    [optManaged.objectIdObj addObjects:@[NSNull.null, objectId(1), NSNull.null]];\n    [optManaged.uuidObj addObjects:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n    [managed.boolObj2 addObjects:@[@NO, @YES, @YES, @NO]];\n    [managed.intObj2 addObjects:@[@2, @3, @3, @4]];\n    [managed.floatObj2 addObjects:@[@2.2f, @3.3f, @3.3f, @4.4f]];\n    [managed.doubleObj2 addObjects:@[@2.2, @3.3, @3.3, @4.4]];\n    [managed.stringObj2 addObjects:@[@\"a\", @\"bc\", @\"bc\", @\"de\"]];\n    [managed.dataObj2 addObjects:@[data(1), data(2), data(2), data(3)]];\n    [managed.dateObj2 addObjects:@[date(1), date(2), date(2), date(3)]];\n    [managed.decimalObj2 addObjects:@[decimal128(1), decimal128(2), decimal128(2), decimal128(3)]];\n    [managed.objectIdObj2 addObjects:@[objectId(1), objectId(2), objectId(2), objectId(3)]];\n    [managed.uuidObj2 addObjects:@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [managed.anyBoolObj2 addObjects:@[@NO, @YES, @NO, @YES]];\n    [managed.anyIntObj2 addObjects:@[@2, @3, @2, @4]];\n    [managed.anyFloatObj2 addObjects:@[@2.2f, @3.3f, @2.2f, @4.4f]];\n    [managed.anyDoubleObj2 addObjects:@[@2.2, @3.3, @2.2, @4.4]];\n    [managed.anyStringObj2 addObjects:@[@\"a\", @\"b\", @\"a\", @\"d\"]];\n    [managed.anyDataObj2 addObjects:@[data(1), data(2), data(1), data(3)]];\n    [managed.anyDateObj2 addObjects:@[date(1), date(2), date(1), date(3)]];\n    [managed.anyDecimalObj2 addObjects:@[decimal128(1), decimal128(2), decimal128(1), decimal128(3)]];\n    [managed.anyObjectIdObj2 addObjects:@[objectId(1), objectId(2), objectId(1), objectId(3)]];\n    [managed.anyUUIDObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optManaged.boolObj2 addObjects:@[NSNull.null, @NO, @YES, @NO, NSNull.null]];\n    [optManaged.intObj2 addObjects:@[NSNull.null, @2, @3, @4, NSNull.null]];\n    [optManaged.floatObj2 addObjects:@[NSNull.null, @2.2f, @3.3f, @4.4f, NSNull.null]];\n    [optManaged.doubleObj2 addObjects:@[NSNull.null, @2.2, @3.3, @4.4, NSNull.null]];\n    [optManaged.stringObj2 addObjects:@[NSNull.null, @\"a\", @\"bc\", @\"de\", NSNull.null]];\n    [optManaged.dataObj2 addObjects:@[NSNull.null, data(1), data(2), data(3), NSNull.null]];\n    [optManaged.dateObj2 addObjects:@[NSNull.null, date(1), date(2), date(3), NSNull.null]];\n    [optManaged.decimalObj2 addObjects:@[NSNull.null, decimal128(1), decimal128(2), decimal128(3), NSNull.null]];\n    [optManaged.objectIdObj2 addObjects:@[NSNull.null, objectId(1), objectId(2), objectId(3), NSNull.null]];\n    [optManaged.uuidObj2 addObjects:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n    [realm commitWriteTransaction];\n\n    [unmanaged.boolObj addObjects:@[@NO, @YES]];\n    [unmanaged.intObj addObjects:@[@2, @3]];\n    [unmanaged.floatObj addObjects:@[@2.2f, @3.3f]];\n    [unmanaged.doubleObj addObjects:@[@2.2, @3.3]];\n    [unmanaged.stringObj addObjects:@[@\"a\", @\"bc\"]];\n    [unmanaged.dataObj addObjects:@[data(1), data(2)]];\n    [unmanaged.dateObj addObjects:@[date(1), date(2)]];\n    [unmanaged.decimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [unmanaged.objectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [unmanaged.uuidObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [unmanaged.anyBoolObj addObjects:@[@NO, @YES]];\n    [unmanaged.anyIntObj addObjects:@[@2, @3]];\n    [unmanaged.anyFloatObj addObjects:@[@2.2f, @3.3f]];\n    [unmanaged.anyDoubleObj addObjects:@[@2.2, @3.3]];\n    [unmanaged.anyStringObj addObjects:@[@\"a\", @\"b\"]];\n    [unmanaged.anyDataObj addObjects:@[data(1), data(2)]];\n    [unmanaged.anyDateObj addObjects:@[date(1), date(2)]];\n    [unmanaged.anyDecimalObj addObjects:@[decimal128(1), decimal128(2)]];\n    [unmanaged.anyObjectIdObj addObjects:@[objectId(1), objectId(2)]];\n    [unmanaged.anyUUIDObj addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optUnmanaged.intObj addObjects:@[NSNull.null, @2, NSNull.null]];\n    [optUnmanaged.floatObj addObjects:@[NSNull.null, @2.2f, NSNull.null]];\n    [optUnmanaged.doubleObj addObjects:@[NSNull.null, @2.2, NSNull.null]];\n    [optUnmanaged.stringObj addObjects:@[NSNull.null, @\"a\", NSNull.null]];\n    [optUnmanaged.dataObj addObjects:@[NSNull.null, data(1), NSNull.null]];\n    [optUnmanaged.dateObj addObjects:@[NSNull.null, date(1), NSNull.null]];\n    [optUnmanaged.decimalObj addObjects:@[NSNull.null, decimal128(1), NSNull.null]];\n    [optUnmanaged.objectIdObj addObjects:@[NSNull.null, objectId(1), NSNull.null]];\n    [optUnmanaged.uuidObj addObjects:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n    [unmanaged.boolObj2 addObjects:@[@NO, @YES, @NO, @YES]];\n    [unmanaged.intObj2 addObjects:@[@2, @3, @2, @4]];\n    [unmanaged.floatObj2 addObjects:@[@2.2f, @3.3f, @2.2f, @4.4f]];\n    [unmanaged.doubleObj2 addObjects:@[@2.2, @3.3, @2.2, @4.4]];\n    [unmanaged.stringObj2 addObjects:@[@\"a\", @\"bc\", @\"a\", @\"de\"]];\n    [unmanaged.dataObj2 addObjects:@[data(1), data(2), data(1), data(3)]];\n    [unmanaged.dateObj2 addObjects:@[date(1), date(2), date(1), date(3)]];\n    [unmanaged.decimalObj2 addObjects:@[decimal128(1), decimal128(2), decimal128(1), decimal128(3)]];\n    [unmanaged.objectIdObj2 addObjects:@[objectId(1), objectId(2), objectId(1), objectId(3)]];\n    [unmanaged.uuidObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [unmanaged.anyBoolObj2 addObjects:@[@NO, @YES, @NO, @YES]];\n    [unmanaged.anyIntObj2 addObjects:@[@2, @3, @2, @4]];\n    [unmanaged.anyFloatObj2 addObjects:@[@2.2f, @3.3f, @4.4f, @3.3f]];\n    [unmanaged.anyDoubleObj2 addObjects:@[@2.2, @3.3, @2.2, @4.4]];\n    [unmanaged.anyStringObj2 addObjects:@[@\"a\", @\"b\", @\"a\", @\"d\"]];\n    [unmanaged.anyDataObj2 addObjects:@[data(1), data(2), data(1), data(3)]];\n    [unmanaged.anyDateObj2 addObjects:@[date(1), date(2), date(1), date(4)]];\n    [unmanaged.anyDecimalObj2 addObjects:@[decimal128(1), decimal128(2), decimal128(1), decimal128(3)]];\n    [unmanaged.anyObjectIdObj2 addObjects:@[objectId(1), objectId(2), objectId(1), objectId(3)]];\n    [unmanaged.anyUUIDObj2 addObjects:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")]];\n    [optUnmanaged.intObj2 addObjects:@[NSNull.null, @2, @3, @4, NSNull.null]];\n    [optUnmanaged.floatObj2 addObjects:@[NSNull.null, @2.2f, @3.3f, @4.4f, NSNull.null]];\n    [optUnmanaged.doubleObj2 addObjects:@[NSNull.null, @2.2, @3.3, @4.4, NSNull.null]];\n    [optUnmanaged.stringObj2 addObjects:@[NSNull.null, @\"a\", @\"bc\", @\"de\", NSNull.null]];\n    [optUnmanaged.dataObj2 addObjects:@[NSNull.null, data(1), data(2), data(3), NSNull.null]];\n    [optUnmanaged.dateObj2 addObjects:@[NSNull.null, date(1), date(2), date(3), NSNull.null]];\n    [optUnmanaged.decimalObj2 addObjects:@[NSNull.null, decimal128(1), decimal128(2), decimal128(4), NSNull.null]];\n    [optUnmanaged.objectIdObj2 addObjects:@[NSNull.null, objectId(1), objectId(2), objectId(4), NSNull.null]];\n    [optUnmanaged.uuidObj2 addObjects:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\"), NSNull.null]];\n\n    uncheckedAssertTrue([managed.boolObj2 isSubsetOfSet:managed.boolObj]);\n    uncheckedAssertTrue([unmanaged.boolObj2 isSubsetOfSet:unmanaged.boolObj]);\n    uncheckedAssertFalse([optManaged.boolObj2 isSubsetOfSet:optManaged.boolObj]);\n\n    uncheckedAssertTrue([managed.boolObj isSubsetOfSet:managed.boolObj2]);\n    uncheckedAssertTrue([unmanaged.boolObj isSubsetOfSet:unmanaged.boolObj2]);\n    uncheckedAssertTrue([optManaged.boolObj isSubsetOfSet:optManaged.boolObj2]);\n\n}\n\n- (void)testMin {\n    RLMAssertThrowsWithReason([unmanaged.boolObj minOfProperty:@\"self\"], \n                              @\"minOfProperty: is not supported for bool set\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj minOfProperty:@\"self\"], \n                              @\"minOfProperty: is not supported for string set\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj minOfProperty:@\"self\"], \n                              @\"minOfProperty: is not supported for data set\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj minOfProperty:@\"self\"], \n                              @\"minOfProperty: is not supported for object id set\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj minOfProperty:@\"self\"], \n                              @\"minOfProperty: is not supported for uuid set\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj minOfProperty:@\"self\"], \n                              @\"minOfProperty: is not supported for string? set\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj minOfProperty:@\"self\"], \n                              @\"minOfProperty: is not supported for data? set\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj minOfProperty:@\"self\"], \n                              @\"minOfProperty: is not supported for object id? set\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj minOfProperty:@\"self\"], \n                              @\"minOfProperty: is not supported for uuid? set\");\n    RLMAssertThrowsWithReason([managed.boolObj minOfProperty:@\"self\"], \n                              @\"Operation 'min' not supported for bool set 'AllPrimitiveSets.boolObj'\");\n    RLMAssertThrowsWithReason([managed.stringObj minOfProperty:@\"self\"], \n                              @\"Operation 'min' not supported for string set 'AllPrimitiveSets.stringObj'\");\n    RLMAssertThrowsWithReason([managed.dataObj minOfProperty:@\"self\"], \n                              @\"Operation 'min' not supported for data set 'AllPrimitiveSets.dataObj'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj minOfProperty:@\"self\"], \n                              @\"Operation 'min' not supported for object id set 'AllPrimitiveSets.objectIdObj'\");\n    RLMAssertThrowsWithReason([managed.uuidObj minOfProperty:@\"self\"], \n                              @\"Operation 'min' not supported for uuid set 'AllPrimitiveSets.uuidObj'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj minOfProperty:@\"self\"], \n                              @\"Operation 'min' not supported for bool? set 'AllOptionalPrimitiveSets.boolObj'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj minOfProperty:@\"self\"], \n                              @\"Operation 'min' not supported for string? set 'AllOptionalPrimitiveSets.stringObj'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj minOfProperty:@\"self\"], \n                              @\"Operation 'min' not supported for data? set 'AllOptionalPrimitiveSets.dataObj'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj minOfProperty:@\"self\"], \n                              @\"Operation 'min' not supported for object id? set 'AllOptionalPrimitiveSets.objectIdObj'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj minOfProperty:@\"self\"], \n                              @\"Operation 'min' not supported for uuid? set 'AllOptionalPrimitiveSets.uuidObj'\");\n\n    uncheckedAssertNil([unmanaged.intObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.floatObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.doubleObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.dateObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.decimalObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyFloatObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDoubleObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDateObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDecimalObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.intObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.floatObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.doubleObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.dateObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.decimalObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.intObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.floatObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.doubleObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.dateObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.decimalObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyIntObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyFloatObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDoubleObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDateObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDecimalObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.intObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.floatObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.doubleObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.dateObj minOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.decimalObj minOfProperty:@\"self\"]);\n\n    [self addObjects];\n\n    uncheckedAssertEqualObjects([unmanaged.intObj minOfProperty:@\"self\"], @2);\n    uncheckedAssertEqualObjects([unmanaged.floatObj minOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([unmanaged.doubleObj minOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([unmanaged.dateObj minOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([unmanaged.decimalObj minOfProperty:@\"self\"], decimal128(1));\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj minOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj minOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([unmanaged.anyDateObj minOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj minOfProperty:@\"self\"], decimal128(1));\n    uncheckedAssertEqualObjects([optUnmanaged.intObj minOfProperty:@\"self\"], @2);\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj minOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj minOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([optUnmanaged.dateObj minOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj minOfProperty:@\"self\"], decimal128(1));\n\n    uncheckedAssertEqualObjects([managed.intObj minOfProperty:@\"self\"], @2);\n    uncheckedAssertEqualObjects([managed.floatObj minOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([managed.doubleObj minOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([managed.dateObj minOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([managed.decimalObj minOfProperty:@\"self\"], decimal128(1));\n    uncheckedAssertEqualObjects([managed.anyIntObj minOfProperty:@\"self\"], @2);\n    uncheckedAssertEqualObjects([managed.anyFloatObj minOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([managed.anyDoubleObj minOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([managed.anyDateObj minOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([managed.anyDecimalObj minOfProperty:@\"self\"], decimal128(1));\n    uncheckedAssertEqualObjects([optManaged.intObj minOfProperty:@\"self\"], @2);\n    uncheckedAssertEqualObjects([optManaged.floatObj minOfProperty:@\"self\"], @2.2f);\n    uncheckedAssertEqualObjects([optManaged.doubleObj minOfProperty:@\"self\"], @2.2);\n    uncheckedAssertEqualObjects([optManaged.dateObj minOfProperty:@\"self\"], date(1));\n    uncheckedAssertEqualObjects([optManaged.decimalObj minOfProperty:@\"self\"], decimal128(1));\n}\n\n- (void)testMax {\n    RLMAssertThrowsWithReason([unmanaged.boolObj maxOfProperty:@\"self\"], \n                              @\"maxOfProperty: is not supported for bool set\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj maxOfProperty:@\"self\"], \n                              @\"maxOfProperty: is not supported for string set\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj maxOfProperty:@\"self\"], \n                              @\"maxOfProperty: is not supported for data set\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj maxOfProperty:@\"self\"], \n                              @\"maxOfProperty: is not supported for object id set\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj maxOfProperty:@\"self\"], \n                              @\"maxOfProperty: is not supported for uuid set\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj maxOfProperty:@\"self\"], \n                              @\"maxOfProperty: is not supported for string? set\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj maxOfProperty:@\"self\"], \n                              @\"maxOfProperty: is not supported for data? set\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj maxOfProperty:@\"self\"], \n                              @\"maxOfProperty: is not supported for object id? set\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj maxOfProperty:@\"self\"], \n                              @\"maxOfProperty: is not supported for uuid? set\");\n    RLMAssertThrowsWithReason([managed.boolObj maxOfProperty:@\"self\"], \n                              @\"Operation 'max' not supported for bool set 'AllPrimitiveSets.boolObj'\");\n    RLMAssertThrowsWithReason([managed.stringObj maxOfProperty:@\"self\"], \n                              @\"Operation 'max' not supported for string set 'AllPrimitiveSets.stringObj'\");\n    RLMAssertThrowsWithReason([managed.dataObj maxOfProperty:@\"self\"], \n                              @\"Operation 'max' not supported for data set 'AllPrimitiveSets.dataObj'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj maxOfProperty:@\"self\"], \n                              @\"Operation 'max' not supported for object id set 'AllPrimitiveSets.objectIdObj'\");\n    RLMAssertThrowsWithReason([managed.uuidObj maxOfProperty:@\"self\"], \n                              @\"Operation 'max' not supported for uuid set 'AllPrimitiveSets.uuidObj'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj maxOfProperty:@\"self\"], \n                              @\"Operation 'max' not supported for bool? set 'AllOptionalPrimitiveSets.boolObj'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj maxOfProperty:@\"self\"], \n                              @\"Operation 'max' not supported for string? set 'AllOptionalPrimitiveSets.stringObj'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj maxOfProperty:@\"self\"], \n                              @\"Operation 'max' not supported for data? set 'AllOptionalPrimitiveSets.dataObj'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj maxOfProperty:@\"self\"], \n                              @\"Operation 'max' not supported for object id? set 'AllOptionalPrimitiveSets.objectIdObj'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj maxOfProperty:@\"self\"], \n                              @\"Operation 'max' not supported for uuid? set 'AllOptionalPrimitiveSets.uuidObj'\");\n\n    uncheckedAssertNil([unmanaged.intObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.floatObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.doubleObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.dateObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.decimalObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyFloatObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDoubleObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDateObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDecimalObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.intObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.floatObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.doubleObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.dateObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.decimalObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.intObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.floatObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.doubleObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.dateObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.decimalObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyIntObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyFloatObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDoubleObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDateObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDecimalObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.intObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.floatObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.doubleObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.dateObj maxOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.decimalObj maxOfProperty:@\"self\"]);\n\n    [self addObjects];\n\n    uncheckedAssertEqualObjects([unmanaged.intObj maxOfProperty:@\"self\"], @3);\n    uncheckedAssertEqualObjects([unmanaged.floatObj maxOfProperty:@\"self\"], @3.3f);\n    uncheckedAssertEqualObjects([unmanaged.doubleObj maxOfProperty:@\"self\"], @3.3);\n    uncheckedAssertEqualObjects([unmanaged.dateObj maxOfProperty:@\"self\"], date(2));\n    uncheckedAssertEqualObjects([unmanaged.decimalObj maxOfProperty:@\"self\"], decimal128(2));\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj maxOfProperty:@\"self\"], @3.3f);\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj maxOfProperty:@\"self\"], @3.3);\n    uncheckedAssertEqualObjects([unmanaged.anyDateObj maxOfProperty:@\"self\"], date(2));\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj maxOfProperty:@\"self\"], decimal128(2));\n    uncheckedAssertEqualObjects([optUnmanaged.intObj maxOfProperty:@\"self\"], @3);\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj maxOfProperty:@\"self\"], @3.3f);\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj maxOfProperty:@\"self\"], @3.3);\n    uncheckedAssertEqualObjects([optUnmanaged.dateObj maxOfProperty:@\"self\"], date(2));\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj maxOfProperty:@\"self\"], decimal128(2));\n\n    uncheckedAssertEqualObjects([managed.intObj maxOfProperty:@\"self\"], @3);\n    uncheckedAssertEqualObjects([managed.floatObj maxOfProperty:@\"self\"], @3.3f);\n    uncheckedAssertEqualObjects([managed.doubleObj maxOfProperty:@\"self\"], @3.3);\n    uncheckedAssertEqualObjects([managed.dateObj maxOfProperty:@\"self\"], date(2));\n    uncheckedAssertEqualObjects([managed.decimalObj maxOfProperty:@\"self\"], decimal128(2));\n    uncheckedAssertEqualObjects([managed.anyIntObj maxOfProperty:@\"self\"], @3);\n    uncheckedAssertEqualObjects([managed.anyFloatObj maxOfProperty:@\"self\"], @3.3f);\n    uncheckedAssertEqualObjects([managed.anyDoubleObj maxOfProperty:@\"self\"], @3.3);\n    uncheckedAssertEqualObjects([managed.anyDateObj maxOfProperty:@\"self\"], date(2));\n    uncheckedAssertEqualObjects([managed.anyDecimalObj maxOfProperty:@\"self\"], decimal128(2));\n    uncheckedAssertEqualObjects([optManaged.intObj maxOfProperty:@\"self\"], @3);\n    uncheckedAssertEqualObjects([optManaged.floatObj maxOfProperty:@\"self\"], @3.3f);\n    uncheckedAssertEqualObjects([optManaged.doubleObj maxOfProperty:@\"self\"], @3.3);\n    uncheckedAssertEqualObjects([optManaged.dateObj maxOfProperty:@\"self\"], date(2));\n    uncheckedAssertEqualObjects([optManaged.decimalObj maxOfProperty:@\"self\"], decimal128(2));\n}\n\n- (void)testSum {\n    RLMAssertThrowsWithReason([unmanaged.boolObj sumOfProperty:@\"self\"], \n                              @\"sumOfProperty: is not supported for bool set\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj sumOfProperty:@\"self\"], \n                              @\"sumOfProperty: is not supported for string set\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj sumOfProperty:@\"self\"], \n                              @\"sumOfProperty: is not supported for data set\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj sumOfProperty:@\"self\"], \n                              @\"sumOfProperty: is not supported for date set\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj sumOfProperty:@\"self\"], \n                              @\"sumOfProperty: is not supported for object id set\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj sumOfProperty:@\"self\"], \n                              @\"sumOfProperty: is not supported for uuid set\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj sumOfProperty:@\"self\"], \n                              @\"sumOfProperty: is not supported for string? set\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj sumOfProperty:@\"self\"], \n                              @\"sumOfProperty: is not supported for data? set\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj sumOfProperty:@\"self\"], \n                              @\"sumOfProperty: is not supported for date? set\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj sumOfProperty:@\"self\"], \n                              @\"sumOfProperty: is not supported for object id? set\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj sumOfProperty:@\"self\"], \n                              @\"sumOfProperty: is not supported for uuid? set\");\n    RLMAssertThrowsWithReason([managed.boolObj sumOfProperty:@\"self\"], \n                              @\"Operation 'sum' not supported for bool set 'AllPrimitiveSets.boolObj'\");\n    RLMAssertThrowsWithReason([managed.stringObj sumOfProperty:@\"self\"], \n                              @\"Operation 'sum' not supported for string set 'AllPrimitiveSets.stringObj'\");\n    RLMAssertThrowsWithReason([managed.dataObj sumOfProperty:@\"self\"], \n                              @\"Operation 'sum' not supported for data set 'AllPrimitiveSets.dataObj'\");\n    RLMAssertThrowsWithReason([managed.dateObj sumOfProperty:@\"self\"], \n                              @\"Operation 'sum' not supported for date set 'AllPrimitiveSets.dateObj'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj sumOfProperty:@\"self\"], \n                              @\"Operation 'sum' not supported for object id set 'AllPrimitiveSets.objectIdObj'\");\n    RLMAssertThrowsWithReason([managed.uuidObj sumOfProperty:@\"self\"], \n                              @\"Operation 'sum' not supported for uuid set 'AllPrimitiveSets.uuidObj'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj sumOfProperty:@\"self\"], \n                              @\"Operation 'sum' not supported for bool? set 'AllOptionalPrimitiveSets.boolObj'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj sumOfProperty:@\"self\"], \n                              @\"Operation 'sum' not supported for string? set 'AllOptionalPrimitiveSets.stringObj'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj sumOfProperty:@\"self\"], \n                              @\"Operation 'sum' not supported for data? set 'AllOptionalPrimitiveSets.dataObj'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj sumOfProperty:@\"self\"], \n                              @\"Operation 'sum' not supported for date? set 'AllOptionalPrimitiveSets.dateObj'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj sumOfProperty:@\"self\"], \n                              @\"Operation 'sum' not supported for object id? set 'AllOptionalPrimitiveSets.objectIdObj'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj sumOfProperty:@\"self\"], \n                              @\"Operation 'sum' not supported for uuid? set 'AllOptionalPrimitiveSets.uuidObj'\");\n\n    uncheckedAssertEqualObjects([unmanaged.intObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.floatObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.doubleObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.decimalObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyIntObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.intObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.intObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.floatObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.doubleObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.decimalObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyIntObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyFloatObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyDoubleObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyDecimalObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.intObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.floatObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.doubleObj sumOfProperty:@\"self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.decimalObj sumOfProperty:@\"self\"], @0);\n\n    [self addObjects];\n\n    XCTAssertEqualWithAccuracy([unmanaged.intObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.floatObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.doubleObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.decimalObj sumOfProperty:@\"self\"].doubleValue, sum(@[decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyIntObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyFloatObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyDoubleObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyDecimalObj sumOfProperty:@\"self\"].doubleValue, sum(@[decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.intObj sumOfProperty:@\"self\"].doubleValue, sum(@[NSNull.null, @2, @3]), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.floatObj sumOfProperty:@\"self\"].doubleValue, sum(@[NSNull.null, @2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.doubleObj sumOfProperty:@\"self\"].doubleValue, sum(@[NSNull.null, @2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.decimalObj sumOfProperty:@\"self\"].doubleValue, sum(@[NSNull.null, decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([managed.intObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([managed.floatObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([managed.doubleObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([managed.decimalObj sumOfProperty:@\"self\"].doubleValue, sum(@[decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([managed.anyIntObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([managed.anyFloatObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([managed.anyDoubleObj sumOfProperty:@\"self\"].doubleValue, sum(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([managed.anyDecimalObj sumOfProperty:@\"self\"].doubleValue, sum(@[decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([optManaged.intObj sumOfProperty:@\"self\"].doubleValue, sum(@[NSNull.null, @2, @3]), .001);\n    XCTAssertEqualWithAccuracy([optManaged.floatObj sumOfProperty:@\"self\"].doubleValue, sum(@[NSNull.null, @2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([optManaged.doubleObj sumOfProperty:@\"self\"].doubleValue, sum(@[NSNull.null, @2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([optManaged.decimalObj sumOfProperty:@\"self\"].doubleValue, sum(@[NSNull.null, decimal128(1), decimal128(2)]), .001);\n}\n\n- (void)testAverage {\n    RLMAssertThrowsWithReason([unmanaged.boolObj averageOfProperty:@\"self\"], \n                              @\"averageOfProperty: is not supported for bool set\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj averageOfProperty:@\"self\"], \n                              @\"averageOfProperty: is not supported for string set\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj averageOfProperty:@\"self\"], \n                              @\"averageOfProperty: is not supported for data set\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj averageOfProperty:@\"self\"], \n                              @\"averageOfProperty: is not supported for date set\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj averageOfProperty:@\"self\"], \n                              @\"averageOfProperty: is not supported for object id set\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj averageOfProperty:@\"self\"], \n                              @\"averageOfProperty: is not supported for uuid set\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj averageOfProperty:@\"self\"], \n                              @\"averageOfProperty: is not supported for string? set\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj averageOfProperty:@\"self\"], \n                              @\"averageOfProperty: is not supported for data? set\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj averageOfProperty:@\"self\"], \n                              @\"averageOfProperty: is not supported for date? set\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj averageOfProperty:@\"self\"], \n                              @\"averageOfProperty: is not supported for object id? set\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj averageOfProperty:@\"self\"], \n                              @\"averageOfProperty: is not supported for uuid? set\");\n    RLMAssertThrowsWithReason([managed.boolObj averageOfProperty:@\"self\"], \n                              @\"Operation 'average' not supported for bool set 'AllPrimitiveSets.boolObj'\");\n    RLMAssertThrowsWithReason([managed.stringObj averageOfProperty:@\"self\"], \n                              @\"Operation 'average' not supported for string set 'AllPrimitiveSets.stringObj'\");\n    RLMAssertThrowsWithReason([managed.dataObj averageOfProperty:@\"self\"], \n                              @\"Operation 'average' not supported for data set 'AllPrimitiveSets.dataObj'\");\n    RLMAssertThrowsWithReason([managed.dateObj averageOfProperty:@\"self\"], \n                              @\"Operation 'average' not supported for date set 'AllPrimitiveSets.dateObj'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj averageOfProperty:@\"self\"], \n                              @\"Operation 'average' not supported for object id set 'AllPrimitiveSets.objectIdObj'\");\n    RLMAssertThrowsWithReason([managed.uuidObj averageOfProperty:@\"self\"], \n                              @\"Operation 'average' not supported for uuid set 'AllPrimitiveSets.uuidObj'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj averageOfProperty:@\"self\"], \n                              @\"Operation 'average' not supported for bool? set 'AllOptionalPrimitiveSets.boolObj'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj averageOfProperty:@\"self\"], \n                              @\"Operation 'average' not supported for string? set 'AllOptionalPrimitiveSets.stringObj'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj averageOfProperty:@\"self\"], \n                              @\"Operation 'average' not supported for data? set 'AllOptionalPrimitiveSets.dataObj'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj averageOfProperty:@\"self\"], \n                              @\"Operation 'average' not supported for date? set 'AllOptionalPrimitiveSets.dateObj'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj averageOfProperty:@\"self\"], \n                              @\"Operation 'average' not supported for object id? set 'AllOptionalPrimitiveSets.objectIdObj'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj averageOfProperty:@\"self\"], \n                              @\"Operation 'average' not supported for uuid? set 'AllOptionalPrimitiveSets.uuidObj'\");\n\n    uncheckedAssertNil([unmanaged.intObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.floatObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.doubleObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.decimalObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyIntObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyFloatObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDoubleObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([unmanaged.anyDecimalObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.intObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.floatObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.doubleObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optUnmanaged.decimalObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.intObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.floatObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.doubleObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.decimalObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyIntObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyFloatObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDoubleObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([managed.anyDecimalObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.intObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.floatObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.doubleObj averageOfProperty:@\"self\"]);\n    uncheckedAssertNil([optManaged.decimalObj averageOfProperty:@\"self\"]);\n\n    [self addObjects];\n\n    XCTAssertEqualWithAccuracy([unmanaged.intObj averageOfProperty:@\"self\"].doubleValue, average(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.floatObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.doubleObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.decimalObj averageOfProperty:@\"self\"].doubleValue, average(@[decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyIntObj averageOfProperty:@\"self\"].doubleValue, average(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyFloatObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyDoubleObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([unmanaged.anyDecimalObj averageOfProperty:@\"self\"].doubleValue, average(@[decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.intObj averageOfProperty:@\"self\"].doubleValue, average(@[NSNull.null, @2, @3]), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.floatObj averageOfProperty:@\"self\"].doubleValue, average(@[NSNull.null, @2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.doubleObj averageOfProperty:@\"self\"].doubleValue, average(@[NSNull.null, @2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([optUnmanaged.decimalObj averageOfProperty:@\"self\"].doubleValue, average(@[NSNull.null, decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([managed.intObj averageOfProperty:@\"self\"].doubleValue, average(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([managed.floatObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([managed.doubleObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([managed.decimalObj averageOfProperty:@\"self\"].doubleValue, average(@[decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([managed.anyIntObj averageOfProperty:@\"self\"].doubleValue, average(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([managed.anyFloatObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([managed.anyDoubleObj averageOfProperty:@\"self\"].doubleValue, average(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([managed.anyDecimalObj averageOfProperty:@\"self\"].doubleValue, average(@[decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([optManaged.intObj averageOfProperty:@\"self\"].doubleValue, average(@[NSNull.null, @2, @3]), .001);\n    XCTAssertEqualWithAccuracy([optManaged.floatObj averageOfProperty:@\"self\"].doubleValue, average(@[NSNull.null, @2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([optManaged.doubleObj averageOfProperty:@\"self\"].doubleValue, average(@[NSNull.null, @2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([optManaged.decimalObj averageOfProperty:@\"self\"].doubleValue, average(@[NSNull.null, decimal128(1), decimal128(2)]), .001);\n}\n\n- (void)testFastEnumeration {\n    for (int i = 0; i < 10; ++i) {\n        [self addObjects];\n    }\n\n    // This is wrapped in a block to work around a compiler bug in Xcode 12.5:\n    // in release builds, reads on `values` will read the wrong local variable,\n    // resulting in a crash when it tries to send a message to some unitialized\n    // stack space. Putting them in separate obj-c blocks prevents this\n    // incorrect optimization.\n    ^{ \n     NSArray *values = @[@NO, @YES]; \n     for (id value in unmanaged.boolObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[@2, @3]; \n     for (id value in unmanaged.intObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[@2.2f, @3.3f]; \n     for (id value in unmanaged.floatObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[@2.2, @3.3]; \n     for (id value in unmanaged.doubleObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[@\"a\", @\"bc\"]; \n     for (id value in unmanaged.stringObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[data(1), data(2)]; \n     for (id value in unmanaged.dataObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[date(1), date(2)]; \n     for (id value in unmanaged.dateObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[decimal128(1), decimal128(2)]; \n     for (id value in unmanaged.decimalObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[objectId(1), objectId(2)]; \n     for (id value in unmanaged.objectIdObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]; \n     for (id value in unmanaged.uuidObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[@NO, @YES]; \n     for (id value in unmanaged.anyBoolObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[@2, @3]; \n     for (id value in unmanaged.anyIntObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[@2.2f, @3.3f]; \n     for (id value in unmanaged.anyFloatObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[@2.2, @3.3]; \n     for (id value in unmanaged.anyDoubleObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[@\"a\", @\"b\"]; \n     for (id value in unmanaged.anyStringObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[data(1), data(2)]; \n     for (id value in unmanaged.anyDataObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[date(1), date(2)]; \n     for (id value in unmanaged.anyDateObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[decimal128(1), decimal128(2)]; \n     for (id value in unmanaged.anyDecimalObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[objectId(1), objectId(2)]; \n     for (id value in unmanaged.anyObjectIdObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]; \n     for (id value in unmanaged.anyUUIDObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, @NO, @YES]; \n     for (id value in optUnmanaged.boolObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, @2, @3]; \n     for (id value in optUnmanaged.intObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, @2.2f, @3.3f]; \n     for (id value in optUnmanaged.floatObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, @2.2, @3.3]; \n     for (id value in optUnmanaged.doubleObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, @\"a\", @\"bc\"]; \n     for (id value in optUnmanaged.stringObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, data(1), data(2)]; \n     for (id value in optUnmanaged.dataObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, date(1), date(2)]; \n     for (id value in optUnmanaged.dateObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, decimal128(1), decimal128(2)]; \n     for (id value in optUnmanaged.decimalObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, objectId(1), objectId(2)]; \n     for (id value in optUnmanaged.objectIdObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]; \n     for (id value in optUnmanaged.uuidObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[@NO, @YES]; \n     for (id value in managed.boolObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[@2, @3]; \n     for (id value in managed.intObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[@2.2f, @3.3f]; \n     for (id value in managed.floatObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[@2.2, @3.3]; \n     for (id value in managed.doubleObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[@\"a\", @\"bc\"]; \n     for (id value in managed.stringObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[data(1), data(2)]; \n     for (id value in managed.dataObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[date(1), date(2)]; \n     for (id value in managed.dateObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[decimal128(1), decimal128(2)]; \n     for (id value in managed.decimalObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[objectId(1), objectId(2)]; \n     for (id value in managed.objectIdObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]; \n     for (id value in managed.uuidObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[@NO, @YES]; \n     for (id value in managed.anyBoolObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[@2, @3]; \n     for (id value in managed.anyIntObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[@2.2f, @3.3f]; \n     for (id value in managed.anyFloatObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[@2.2, @3.3]; \n     for (id value in managed.anyDoubleObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[@\"a\", @\"b\"]; \n     for (id value in managed.anyStringObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[data(1), data(2)]; \n     for (id value in managed.anyDataObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[date(1), date(2)]; \n     for (id value in managed.anyDateObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[decimal128(1), decimal128(2)]; \n     for (id value in managed.anyDecimalObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[objectId(1), objectId(2)]; \n     for (id value in managed.anyObjectIdObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]; \n     for (id value in managed.anyUUIDObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, @NO, @YES]; \n     for (id value in optManaged.boolObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, @2, @3]; \n     for (id value in optManaged.intObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, @2.2f, @3.3f]; \n     for (id value in optManaged.floatObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, @2.2, @3.3]; \n     for (id value in optManaged.doubleObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, @\"a\", @\"bc\"]; \n     for (id value in optManaged.stringObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, data(1), data(2)]; \n     for (id value in optManaged.dataObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, date(1), date(2)]; \n     for (id value in optManaged.dateObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, decimal128(1), decimal128(2)]; \n     for (id value in optManaged.decimalObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, objectId(1), objectId(2)]; \n     for (id value in optManaged.objectIdObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n    ^{ \n     NSArray *values = @[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]; \n     for (id value in optManaged.uuidObj) { \n     uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); \n     } \n     }(); \n    \n}\n\n- (void)testValueForKeySelf {\n    for (RLMSet *set in allSets) {\n        uncheckedAssertEqualObjects([[set valueForKey:@\"self\"] allObjects], @[]);\n    }\n\n    [self addObjects];\n\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.boolObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.intObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.floatObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.doubleObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.stringObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"bc\"]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.dataObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.dateObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.decimalObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.objectIdObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.uuidObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyBoolObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyIntObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyFloatObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyDoubleObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyStringObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"b\"]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyDataObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyDateObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyDecimalObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyObjectIdObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyUUIDObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.boolObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @NO, @YES]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.intObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2, @3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.floatObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2f, @3.3f]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.doubleObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2, @3.3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.stringObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @\"a\", @\"bc\"]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.dataObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, data(1), data(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.dateObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, date(1), date(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.decimalObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, decimal128(1), decimal128(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.objectIdObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, objectId(1), objectId(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.uuidObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.boolObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.intObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.floatObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.doubleObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.stringObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"bc\"]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.dataObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.dateObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.decimalObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.objectIdObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.uuidObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyBoolObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyIntObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyFloatObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyDoubleObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyStringObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"b\"]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyDataObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyDateObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyDecimalObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyObjectIdObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyUUIDObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.boolObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @NO, @YES]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.intObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2, @3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.floatObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2f, @3.3f]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.doubleObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2, @3.3]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.stringObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @\"a\", @\"bc\"]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.dataObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, data(1), data(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.dateObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, date(1), date(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.decimalObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, decimal128(1), decimal128(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.objectIdObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, objectId(1), objectId(2)]]));\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.uuidObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]]));\n}\n\n- (void)testValueForKeyNumericAggregates {\n    uncheckedAssertNil([unmanaged.intObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.floatObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.doubleObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.dateObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.decimalObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.anyFloatObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.anyDoubleObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.anyDateObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.anyDecimalObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optUnmanaged.intObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optUnmanaged.floatObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optUnmanaged.doubleObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optUnmanaged.dateObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optUnmanaged.decimalObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.intObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.floatObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.doubleObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.dateObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.decimalObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.anyIntObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.anyFloatObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.anyDoubleObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.anyDateObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([managed.anyDecimalObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optManaged.intObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optManaged.floatObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optManaged.doubleObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optManaged.dateObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([optManaged.decimalObj valueForKeyPath:@\"@min.self\"]);\n    uncheckedAssertNil([unmanaged.intObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.floatObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.doubleObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.dateObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.decimalObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.anyFloatObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.anyDoubleObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.anyDateObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([unmanaged.anyDecimalObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optUnmanaged.intObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optUnmanaged.floatObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optUnmanaged.doubleObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optUnmanaged.dateObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optUnmanaged.decimalObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.intObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.floatObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.doubleObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.dateObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.decimalObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.anyIntObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.anyFloatObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.anyDoubleObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.anyDateObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([managed.anyDecimalObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optManaged.intObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optManaged.floatObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optManaged.doubleObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optManaged.dateObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertNil([optManaged.decimalObj valueForKeyPath:@\"@max.self\"]);\n    uncheckedAssertEqualObjects([unmanaged.intObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.floatObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.doubleObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.decimalObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyIntObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.intObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.intObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.floatObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.doubleObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.decimalObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyIntObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyFloatObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyDoubleObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([managed.anyDecimalObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.intObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.floatObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.doubleObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertEqualObjects([optManaged.decimalObj valueForKeyPath:@\"@sum.self\"], @0);\n    uncheckedAssertNil([unmanaged.intObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([unmanaged.floatObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([unmanaged.doubleObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([unmanaged.decimalObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([unmanaged.anyIntObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([unmanaged.anyFloatObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([unmanaged.anyDoubleObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([unmanaged.anyDecimalObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optUnmanaged.intObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optUnmanaged.floatObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optUnmanaged.doubleObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optUnmanaged.decimalObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.intObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.floatObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.doubleObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.decimalObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.anyIntObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.anyFloatObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.anyDoubleObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([managed.anyDecimalObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optManaged.intObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optManaged.floatObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optManaged.doubleObj valueForKeyPath:@\"@avg.self\"]);\n    uncheckedAssertNil([optManaged.decimalObj valueForKeyPath:@\"@avg.self\"]);\n\n    [self addObjects];\n\n    uncheckedAssertEqualObjects([unmanaged.intObj valueForKeyPath:@\"@min.self\"], @2);\n    uncheckedAssertEqualObjects([unmanaged.floatObj valueForKeyPath:@\"@min.self\"], @2.2f);\n    uncheckedAssertEqualObjects([unmanaged.doubleObj valueForKeyPath:@\"@min.self\"], @2.2);\n    uncheckedAssertEqualObjects([unmanaged.dateObj valueForKeyPath:@\"@min.self\"], date(1));\n    uncheckedAssertEqualObjects([unmanaged.decimalObj valueForKeyPath:@\"@min.self\"], decimal128(1));\n    uncheckedAssertEqualObjects([unmanaged.anyFloatObj valueForKeyPath:@\"@min.self\"], @2.2f);\n    uncheckedAssertEqualObjects([unmanaged.anyDoubleObj valueForKeyPath:@\"@min.self\"], @2.2);\n    uncheckedAssertEqualObjects([unmanaged.anyDateObj valueForKeyPath:@\"@min.self\"], date(1));\n    uncheckedAssertEqualObjects([unmanaged.anyDecimalObj valueForKeyPath:@\"@min.self\"], decimal128(1));\n    uncheckedAssertEqualObjects([optUnmanaged.intObj valueForKeyPath:@\"@max.self\"], @3);\n    uncheckedAssertEqualObjects([optUnmanaged.floatObj valueForKeyPath:@\"@max.self\"], @3.3f);\n    uncheckedAssertEqualObjects([optUnmanaged.doubleObj valueForKeyPath:@\"@max.self\"], @3.3);\n    uncheckedAssertEqualObjects([optUnmanaged.dateObj valueForKeyPath:@\"@max.self\"], date(2));\n    uncheckedAssertEqualObjects([optUnmanaged.decimalObj valueForKeyPath:@\"@max.self\"], decimal128(2));\n\n    uncheckedAssertEqualObjects([managed.intObj valueForKeyPath:@\"@min.self\"], @2);\n    uncheckedAssertEqualObjects([managed.floatObj valueForKeyPath:@\"@min.self\"], @2.2f);\n    uncheckedAssertEqualObjects([managed.doubleObj valueForKeyPath:@\"@min.self\"], @2.2);\n    uncheckedAssertEqualObjects([managed.dateObj valueForKeyPath:@\"@min.self\"], date(1));\n    uncheckedAssertEqualObjects([managed.decimalObj valueForKeyPath:@\"@min.self\"], decimal128(1));\n    uncheckedAssertEqualObjects([managed.anyIntObj valueForKeyPath:@\"@min.self\"], @2);\n    uncheckedAssertEqualObjects([managed.anyFloatObj valueForKeyPath:@\"@min.self\"], @2.2f);\n    uncheckedAssertEqualObjects([managed.anyDoubleObj valueForKeyPath:@\"@min.self\"], @2.2);\n    uncheckedAssertEqualObjects([managed.anyDateObj valueForKeyPath:@\"@min.self\"], date(1));\n    uncheckedAssertEqualObjects([managed.anyDecimalObj valueForKeyPath:@\"@min.self\"], decimal128(1));\n    uncheckedAssertEqualObjects([optManaged.intObj valueForKeyPath:@\"@max.self\"], @3);\n    uncheckedAssertEqualObjects([optManaged.floatObj valueForKeyPath:@\"@max.self\"], @3.3f);\n    uncheckedAssertEqualObjects([optManaged.doubleObj valueForKeyPath:@\"@max.self\"], @3.3);\n    uncheckedAssertEqualObjects([optManaged.dateObj valueForKeyPath:@\"@max.self\"], date(2));\n    uncheckedAssertEqualObjects([optManaged.decimalObj valueForKeyPath:@\"@max.self\"], decimal128(2));\n\n    XCTAssertEqualWithAccuracy([[unmanaged.intObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.floatObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.doubleObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.decimalObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.anyIntObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.anyFloatObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.anyDoubleObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.anyDecimalObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.intObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[NSNull.null, @2, @3]), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.floatObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[NSNull.null, @2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.doubleObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[NSNull.null, @2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.decimalObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[NSNull.null, decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([[managed.intObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([[managed.floatObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([[managed.doubleObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([[managed.decimalObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([[managed.anyIntObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([[managed.anyFloatObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([[managed.anyDoubleObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([[managed.anyDecimalObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.intObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[NSNull.null, @2, @3]), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.floatObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[NSNull.null, @2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.doubleObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[NSNull.null, @2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.decimalObj valueForKeyPath:@\"@sum.self\"] doubleValue], sum(@[NSNull.null, decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.intObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.floatObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.doubleObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.decimalObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.anyIntObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.anyFloatObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.anyDoubleObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([[unmanaged.anyDecimalObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.intObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[NSNull.null, @2, @3]), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.floatObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[NSNull.null, @2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.doubleObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[NSNull.null, @2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([[optUnmanaged.decimalObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[NSNull.null, decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([[managed.intObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([[managed.floatObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([[managed.doubleObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([[managed.decimalObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([[managed.anyIntObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2, @3]), .001);\n    XCTAssertEqualWithAccuracy([[managed.anyFloatObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([[managed.anyDoubleObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[@2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([[managed.anyDecimalObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[decimal128(1), decimal128(2)]), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.intObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[NSNull.null, @2, @3]), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.floatObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[NSNull.null, @2.2f, @3.3f]), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.doubleObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[NSNull.null, @2.2, @3.3]), .001);\n    XCTAssertEqualWithAccuracy([[optManaged.decimalObj valueForKeyPath:@\"@avg.self\"] doubleValue], average(@[NSNull.null, decimal128(1), decimal128(2)]), .001);\n}\n\n- (void)testValueForKeyLength {\n    for (RLMSet *set in allSets) {\n        uncheckedAssertEqualObjects([[set valueForKey:@\"length\"] allObjects], @[]);\n    }\n\n    [self addObjects];\n    uncheckedAssertEqualObjects([unmanaged.stringObj valueForKey:@\"length\"], ([[NSSet setWithArray:@[@\"a\", @\"bc\"]] valueForKey:@\"length\"]));\n    uncheckedAssertEqualObjects([unmanaged.anyStringObj valueForKey:@\"length\"], ([[NSSet setWithArray:@[@\"a\", @\"b\"]] valueForKey:@\"length\"]));\n    uncheckedAssertEqualObjects([optUnmanaged.stringObj valueForKey:@\"length\"], ([[NSSet setWithArray:@[NSNull.null, @\"a\", @\"bc\"]] valueForKey:@\"length\"]));\n    uncheckedAssertEqualObjects([managed.stringObj valueForKey:@\"length\"], ([[NSSet setWithArray:@[@\"a\", @\"bc\"]] valueForKey:@\"length\"]));\n    uncheckedAssertEqualObjects([managed.anyStringObj valueForKey:@\"length\"], ([[NSSet setWithArray:@[@\"a\", @\"b\"]] valueForKey:@\"length\"]));\n    uncheckedAssertEqualObjects([optManaged.stringObj valueForKey:@\"length\"], ([[NSSet setWithArray:@[NSNull.null, @\"a\", @\"bc\"]] valueForKey:@\"length\"]));\n}\n\n- (void)testSetValueForKey {\n    for (RLMSet *set in allSets) {\n        RLMAssertThrowsWithReason([set setValue:@0 forKey:@\"not self\"],\n                                  @\"this class is not key value coding-compliant for the key not self.\");\n    }\n    RLMAssertThrowsWithReason([unmanaged.boolObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj setValue:@2 forKey:@\"self\"], \n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optUnmanaged.boolObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.intObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.floatObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.doubleObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.stringObj setValue:@2 forKey:@\"self\"], \n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dataObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.dateObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.decimalObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.objectIdObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([optUnmanaged.uuidObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([managed.boolObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.intObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.floatObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.doubleObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.stringObj setValue:@2 forKey:@\"self\"], \n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.dataObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dateObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.decimalObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.uuidObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([optManaged.boolObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'bool?'\");\n    RLMAssertThrowsWithReason([optManaged.intObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'int?'\");\n    RLMAssertThrowsWithReason([optManaged.floatObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'float?'\");\n    RLMAssertThrowsWithReason([optManaged.doubleObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'double?'\");\n    RLMAssertThrowsWithReason([optManaged.stringObj setValue:@2 forKey:@\"self\"], \n                              @\"Invalid value '2' of type '\" RLMConstantInt \"' for expected type 'string?'\");\n    RLMAssertThrowsWithReason([optManaged.dataObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'data?'\");\n    RLMAssertThrowsWithReason([optManaged.dateObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'date?'\");\n    RLMAssertThrowsWithReason([optManaged.decimalObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'decimal128?'\");\n    RLMAssertThrowsWithReason([optManaged.objectIdObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'object id?'\");\n    RLMAssertThrowsWithReason([optManaged.uuidObj setValue:@\"a\" forKey:@\"self\"], \n                              @\"Invalid value 'a' of type '\" RLMConstantString \"' for expected type 'uuid?'\");\n    RLMAssertThrowsWithReason([unmanaged.boolObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([unmanaged.intObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([unmanaged.floatObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([unmanaged.doubleObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([unmanaged.stringObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([unmanaged.dataObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([unmanaged.dateObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([unmanaged.decimalObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([unmanaged.objectIdObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([unmanaged.uuidObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n    RLMAssertThrowsWithReason([managed.boolObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'bool'\");\n    RLMAssertThrowsWithReason([managed.intObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'int'\");\n    RLMAssertThrowsWithReason([managed.floatObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'float'\");\n    RLMAssertThrowsWithReason([managed.doubleObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'double'\");\n    RLMAssertThrowsWithReason([managed.stringObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'string'\");\n    RLMAssertThrowsWithReason([managed.dataObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'data'\");\n    RLMAssertThrowsWithReason([managed.dateObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'date'\");\n    RLMAssertThrowsWithReason([managed.decimalObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'decimal128'\");\n    RLMAssertThrowsWithReason([managed.objectIdObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'object id'\");\n    RLMAssertThrowsWithReason([managed.uuidObj setValue:NSNull.null forKey:@\"self\"], \n                              @\"Invalid value '<null>' of type 'NSNull' for expected type 'uuid'\");\n\n    [self addObjects];\n\n    // setValue overrides all existing values\n    [unmanaged.boolObj setValue:@NO forKey:@\"self\"];\n    [unmanaged.intObj setValue:@2 forKey:@\"self\"];\n    [unmanaged.floatObj setValue:@2.2f forKey:@\"self\"];\n    [unmanaged.doubleObj setValue:@2.2 forKey:@\"self\"];\n    [unmanaged.stringObj setValue:@\"a\" forKey:@\"self\"];\n    [unmanaged.dataObj setValue:data(1) forKey:@\"self\"];\n    [unmanaged.dateObj setValue:date(1) forKey:@\"self\"];\n    [unmanaged.decimalObj setValue:decimal128(1) forKey:@\"self\"];\n    [unmanaged.objectIdObj setValue:objectId(1) forKey:@\"self\"];\n    [unmanaged.uuidObj setValue:uuid(@\"00000000-0000-0000-0000-000000000000\") forKey:@\"self\"];\n    [unmanaged.anyBoolObj setValue:@NO forKey:@\"self\"];\n    [unmanaged.anyIntObj setValue:@2 forKey:@\"self\"];\n    [unmanaged.anyFloatObj setValue:@2.2f forKey:@\"self\"];\n    [unmanaged.anyDoubleObj setValue:@2.2 forKey:@\"self\"];\n    [unmanaged.anyStringObj setValue:@\"a\" forKey:@\"self\"];\n    [unmanaged.anyDataObj setValue:data(1) forKey:@\"self\"];\n    [unmanaged.anyDateObj setValue:date(1) forKey:@\"self\"];\n    [unmanaged.anyDecimalObj setValue:decimal128(1) forKey:@\"self\"];\n    [unmanaged.anyObjectIdObj setValue:objectId(1) forKey:@\"self\"];\n    [unmanaged.anyUUIDObj setValue:uuid(@\"00000000-0000-0000-0000-000000000000\") forKey:@\"self\"];\n    [optUnmanaged.boolObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.intObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.floatObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.doubleObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.stringObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.dataObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.dateObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.decimalObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.objectIdObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.uuidObj setValue:NSNull.null forKey:@\"self\"];\n    [managed.boolObj setValue:@NO forKey:@\"self\"];\n    [managed.intObj setValue:@2 forKey:@\"self\"];\n    [managed.floatObj setValue:@2.2f forKey:@\"self\"];\n    [managed.doubleObj setValue:@2.2 forKey:@\"self\"];\n    [managed.stringObj setValue:@\"a\" forKey:@\"self\"];\n    [managed.dataObj setValue:data(1) forKey:@\"self\"];\n    [managed.dateObj setValue:date(1) forKey:@\"self\"];\n    [managed.decimalObj setValue:decimal128(1) forKey:@\"self\"];\n    [managed.objectIdObj setValue:objectId(1) forKey:@\"self\"];\n    [managed.uuidObj setValue:uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\") forKey:@\"self\"];\n    [managed.anyBoolObj setValue:@NO forKey:@\"self\"];\n    [managed.anyIntObj setValue:@2 forKey:@\"self\"];\n    [managed.anyFloatObj setValue:@2.2f forKey:@\"self\"];\n    [managed.anyDoubleObj setValue:@2.2 forKey:@\"self\"];\n    [managed.anyStringObj setValue:@\"a\" forKey:@\"self\"];\n    [managed.anyDataObj setValue:data(1) forKey:@\"self\"];\n    [managed.anyDateObj setValue:date(1) forKey:@\"self\"];\n    [managed.anyDecimalObj setValue:decimal128(1) forKey:@\"self\"];\n    [managed.anyObjectIdObj setValue:objectId(1) forKey:@\"self\"];\n    [managed.anyUUIDObj setValue:uuid(@\"00000000-0000-0000-0000-000000000000\") forKey:@\"self\"];\n    [optManaged.boolObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.intObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.floatObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.doubleObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.stringObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.dataObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.dateObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.decimalObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.objectIdObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.uuidObj setValue:NSNull.null forKey:@\"self\"];\n\n    RLMAssertThrowsWithReason(unmanaged.boolObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(unmanaged.intObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(unmanaged.floatObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(unmanaged.doubleObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(unmanaged.stringObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(unmanaged.dataObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(unmanaged.dateObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(unmanaged.decimalObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(unmanaged.objectIdObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(unmanaged.uuidObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(unmanaged.anyBoolObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(unmanaged.anyIntObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(unmanaged.anyFloatObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(unmanaged.anyDoubleObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(unmanaged.anyStringObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(unmanaged.anyDataObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(unmanaged.anyDateObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(unmanaged.anyDecimalObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(unmanaged.anyObjectIdObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(unmanaged.anyUUIDObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optUnmanaged.boolObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optUnmanaged.intObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optUnmanaged.floatObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optUnmanaged.doubleObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optUnmanaged.stringObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optUnmanaged.dataObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optUnmanaged.dateObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optUnmanaged.decimalObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optUnmanaged.objectIdObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optUnmanaged.uuidObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.boolObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.intObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.floatObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.doubleObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.stringObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.dataObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.dateObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.decimalObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.objectIdObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.uuidObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.anyBoolObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.anyIntObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.anyFloatObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.anyDoubleObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.anyStringObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.anyDataObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.anyDateObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.anyDecimalObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.anyObjectIdObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(managed.anyUUIDObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optManaged.boolObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optManaged.intObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optManaged.floatObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optManaged.doubleObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optManaged.stringObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optManaged.dataObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optManaged.dateObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optManaged.decimalObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optManaged.objectIdObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n    RLMAssertThrowsWithReason(optManaged.uuidObj.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n\n    uncheckedAssertEqualObjects(unmanaged.boolObj.allObjects[0], @NO);\n    uncheckedAssertEqualObjects(unmanaged.intObj.allObjects[0], @2);\n    uncheckedAssertEqualObjects(unmanaged.floatObj.allObjects[0], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.doubleObj.allObjects[0], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.stringObj.allObjects[0], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.dataObj.allObjects[0], data(1));\n    uncheckedAssertEqualObjects(unmanaged.dateObj.allObjects[0], date(1));\n    uncheckedAssertEqualObjects(unmanaged.decimalObj.allObjects[0], decimal128(1));\n    uncheckedAssertEqualObjects(unmanaged.objectIdObj.allObjects[0], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.uuidObj.allObjects[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(unmanaged.anyBoolObj.allObjects[0], @NO);\n    uncheckedAssertEqualObjects(unmanaged.anyIntObj.allObjects[0], @2);\n    uncheckedAssertEqualObjects(unmanaged.anyFloatObj.allObjects[0], @2.2f);\n    uncheckedAssertEqualObjects(unmanaged.anyDoubleObj.allObjects[0], @2.2);\n    uncheckedAssertEqualObjects(unmanaged.anyStringObj.allObjects[0], @\"a\");\n    uncheckedAssertEqualObjects(unmanaged.anyDataObj.allObjects[0], data(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDateObj.allObjects[0], date(1));\n    uncheckedAssertEqualObjects(unmanaged.anyDecimalObj.allObjects[0], decimal128(1));\n    uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj.allObjects[0], objectId(1));\n    uncheckedAssertEqualObjects(unmanaged.anyUUIDObj.allObjects[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optUnmanaged.boolObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(managed.boolObj.allObjects[0], @NO);\n    uncheckedAssertEqualObjects(managed.intObj.allObjects[0], @2);\n    uncheckedAssertEqualObjects(managed.floatObj.allObjects[0], @2.2f);\n    uncheckedAssertEqualObjects(managed.doubleObj.allObjects[0], @2.2);\n    uncheckedAssertEqualObjects(managed.stringObj.allObjects[0], @\"a\");\n    uncheckedAssertEqualObjects(managed.dataObj.allObjects[0], data(1));\n    uncheckedAssertEqualObjects(managed.dateObj.allObjects[0], date(1));\n    uncheckedAssertEqualObjects(managed.decimalObj.allObjects[0], decimal128(1));\n    uncheckedAssertEqualObjects(managed.objectIdObj.allObjects[0], objectId(1));\n    uncheckedAssertEqualObjects(managed.uuidObj.allObjects[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    uncheckedAssertEqualObjects(managed.anyBoolObj.allObjects[0], @NO);\n    uncheckedAssertEqualObjects(managed.anyIntObj.allObjects[0], @2);\n    uncheckedAssertEqualObjects(managed.anyFloatObj.allObjects[0], @2.2f);\n    uncheckedAssertEqualObjects(managed.anyDoubleObj.allObjects[0], @2.2);\n    uncheckedAssertEqualObjects(managed.anyStringObj.allObjects[0], @\"a\");\n    uncheckedAssertEqualObjects(managed.anyDataObj.allObjects[0], data(1));\n    uncheckedAssertEqualObjects(managed.anyDateObj.allObjects[0], date(1));\n    uncheckedAssertEqualObjects(managed.anyDecimalObj.allObjects[0], decimal128(1));\n    uncheckedAssertEqualObjects(managed.anyObjectIdObj.allObjects[0], objectId(1));\n    uncheckedAssertEqualObjects(managed.anyUUIDObj.allObjects[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    uncheckedAssertEqualObjects(optManaged.boolObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.intObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.floatObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.doubleObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.stringObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dataObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dateObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.decimalObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.objectIdObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.uuidObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.intObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.boolObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.intObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.floatObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.doubleObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.stringObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dataObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dateObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.decimalObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.objectIdObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.uuidObj.allObjects[0], NSNull.null);\n\n    [optUnmanaged.intObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.floatObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.doubleObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.stringObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.dataObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.dateObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.decimalObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.objectIdObj setValue:NSNull.null forKey:@\"self\"];\n    [optUnmanaged.uuidObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.boolObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.intObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.floatObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.doubleObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.stringObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.dataObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.dateObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.decimalObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.objectIdObj setValue:NSNull.null forKey:@\"self\"];\n    [optManaged.uuidObj setValue:NSNull.null forKey:@\"self\"];\n    uncheckedAssertEqualObjects(optUnmanaged.intObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.floatObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.doubleObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.stringObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dataObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.dateObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.decimalObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.objectIdObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optUnmanaged.uuidObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.boolObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.intObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.floatObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.doubleObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.stringObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dataObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.dateObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.decimalObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.objectIdObj.allObjects[0], NSNull.null);\n    uncheckedAssertEqualObjects(optManaged.uuidObj.allObjects[0], NSNull.null);\n}\n\n- (void)testAssignment {\n    unmanaged.boolObj = (id)@[@YES]; \n     uncheckedAssertEqualObjects(unmanaged.boolObj.allObjects[0], @YES);\n    unmanaged.intObj = (id)@[@3]; \n     uncheckedAssertEqualObjects(unmanaged.intObj.allObjects[0], @3);\n    unmanaged.floatObj = (id)@[@3.3f]; \n     uncheckedAssertEqualObjects(unmanaged.floatObj.allObjects[0], @3.3f);\n    unmanaged.doubleObj = (id)@[@3.3]; \n     uncheckedAssertEqualObjects(unmanaged.doubleObj.allObjects[0], @3.3);\n    unmanaged.stringObj = (id)@[@\"bc\"]; \n     uncheckedAssertEqualObjects(unmanaged.stringObj.allObjects[0], @\"bc\");\n    unmanaged.dataObj = (id)@[data(2)]; \n     uncheckedAssertEqualObjects(unmanaged.dataObj.allObjects[0], data(2));\n    unmanaged.dateObj = (id)@[date(2)]; \n     uncheckedAssertEqualObjects(unmanaged.dateObj.allObjects[0], date(2));\n    unmanaged.decimalObj = (id)@[decimal128(2)]; \n     uncheckedAssertEqualObjects(unmanaged.decimalObj.allObjects[0], decimal128(2));\n    unmanaged.objectIdObj = (id)@[objectId(2)]; \n     uncheckedAssertEqualObjects(unmanaged.objectIdObj.allObjects[0], objectId(2));\n    unmanaged.uuidObj = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]; \n     uncheckedAssertEqualObjects(unmanaged.uuidObj.allObjects[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    unmanaged.anyBoolObj = (id)@[@YES]; \n     uncheckedAssertEqualObjects(unmanaged.anyBoolObj.allObjects[0], @YES);\n    unmanaged.anyIntObj = (id)@[@3]; \n     uncheckedAssertEqualObjects(unmanaged.anyIntObj.allObjects[0], @3);\n    unmanaged.anyFloatObj = (id)@[@3.3f]; \n     uncheckedAssertEqualObjects(unmanaged.anyFloatObj.allObjects[0], @3.3f);\n    unmanaged.anyDoubleObj = (id)@[@3.3]; \n     uncheckedAssertEqualObjects(unmanaged.anyDoubleObj.allObjects[0], @3.3);\n    unmanaged.anyStringObj = (id)@[@\"b\"]; \n     uncheckedAssertEqualObjects(unmanaged.anyStringObj.allObjects[0], @\"b\");\n    unmanaged.anyDataObj = (id)@[data(2)]; \n     uncheckedAssertEqualObjects(unmanaged.anyDataObj.allObjects[0], data(2));\n    unmanaged.anyDateObj = (id)@[date(2)]; \n     uncheckedAssertEqualObjects(unmanaged.anyDateObj.allObjects[0], date(2));\n    unmanaged.anyDecimalObj = (id)@[decimal128(2)]; \n     uncheckedAssertEqualObjects(unmanaged.anyDecimalObj.allObjects[0], decimal128(2));\n    unmanaged.anyObjectIdObj = (id)@[objectId(2)]; \n     uncheckedAssertEqualObjects(unmanaged.anyObjectIdObj.allObjects[0], objectId(2));\n    unmanaged.anyUUIDObj = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]; \n     uncheckedAssertEqualObjects(unmanaged.anyUUIDObj.allObjects[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    optUnmanaged.boolObj = (id)@[@NO]; \n     uncheckedAssertEqualObjects(optUnmanaged.boolObj.allObjects[0], @NO);\n    optUnmanaged.intObj = (id)@[@2]; \n     uncheckedAssertEqualObjects(optUnmanaged.intObj.allObjects[0], @2);\n    optUnmanaged.floatObj = (id)@[@2.2f]; \n     uncheckedAssertEqualObjects(optUnmanaged.floatObj.allObjects[0], @2.2f);\n    optUnmanaged.doubleObj = (id)@[@2.2]; \n     uncheckedAssertEqualObjects(optUnmanaged.doubleObj.allObjects[0], @2.2);\n    optUnmanaged.stringObj = (id)@[@\"a\"]; \n     uncheckedAssertEqualObjects(optUnmanaged.stringObj.allObjects[0], @\"a\");\n    optUnmanaged.dataObj = (id)@[data(1)]; \n     uncheckedAssertEqualObjects(optUnmanaged.dataObj.allObjects[0], data(1));\n    optUnmanaged.dateObj = (id)@[date(1)]; \n     uncheckedAssertEqualObjects(optUnmanaged.dateObj.allObjects[0], date(1));\n    optUnmanaged.decimalObj = (id)@[decimal128(1)]; \n     uncheckedAssertEqualObjects(optUnmanaged.decimalObj.allObjects[0], decimal128(1));\n    optUnmanaged.objectIdObj = (id)@[objectId(1)]; \n     uncheckedAssertEqualObjects(optUnmanaged.objectIdObj.allObjects[0], objectId(1));\n    optUnmanaged.uuidObj = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]; \n     uncheckedAssertEqualObjects(optUnmanaged.uuidObj.allObjects[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    managed.boolObj = (id)@[@YES]; \n     uncheckedAssertEqualObjects(managed.boolObj.allObjects[0], @YES);\n    managed.intObj = (id)@[@3]; \n     uncheckedAssertEqualObjects(managed.intObj.allObjects[0], @3);\n    managed.floatObj = (id)@[@3.3f]; \n     uncheckedAssertEqualObjects(managed.floatObj.allObjects[0], @3.3f);\n    managed.doubleObj = (id)@[@3.3]; \n     uncheckedAssertEqualObjects(managed.doubleObj.allObjects[0], @3.3);\n    managed.stringObj = (id)@[@\"bc\"]; \n     uncheckedAssertEqualObjects(managed.stringObj.allObjects[0], @\"bc\");\n    managed.dataObj = (id)@[data(2)]; \n     uncheckedAssertEqualObjects(managed.dataObj.allObjects[0], data(2));\n    managed.dateObj = (id)@[date(2)]; \n     uncheckedAssertEqualObjects(managed.dateObj.allObjects[0], date(2));\n    managed.decimalObj = (id)@[decimal128(2)]; \n     uncheckedAssertEqualObjects(managed.decimalObj.allObjects[0], decimal128(2));\n    managed.objectIdObj = (id)@[objectId(2)]; \n     uncheckedAssertEqualObjects(managed.objectIdObj.allObjects[0], objectId(2));\n    managed.uuidObj = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\")]; \n     uncheckedAssertEqualObjects(managed.uuidObj.allObjects[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    managed.anyBoolObj = (id)@[@YES]; \n     uncheckedAssertEqualObjects(managed.anyBoolObj.allObjects[0], @YES);\n    managed.anyIntObj = (id)@[@3]; \n     uncheckedAssertEqualObjects(managed.anyIntObj.allObjects[0], @3);\n    managed.anyFloatObj = (id)@[@3.3f]; \n     uncheckedAssertEqualObjects(managed.anyFloatObj.allObjects[0], @3.3f);\n    managed.anyDoubleObj = (id)@[@3.3]; \n     uncheckedAssertEqualObjects(managed.anyDoubleObj.allObjects[0], @3.3);\n    managed.anyStringObj = (id)@[@\"b\"]; \n     uncheckedAssertEqualObjects(managed.anyStringObj.allObjects[0], @\"b\");\n    managed.anyDataObj = (id)@[data(2)]; \n     uncheckedAssertEqualObjects(managed.anyDataObj.allObjects[0], data(2));\n    managed.anyDateObj = (id)@[date(2)]; \n     uncheckedAssertEqualObjects(managed.anyDateObj.allObjects[0], date(2));\n    managed.anyDecimalObj = (id)@[decimal128(2)]; \n     uncheckedAssertEqualObjects(managed.anyDecimalObj.allObjects[0], decimal128(2));\n    managed.anyObjectIdObj = (id)@[objectId(2)]; \n     uncheckedAssertEqualObjects(managed.anyObjectIdObj.allObjects[0], objectId(2));\n    managed.anyUUIDObj = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]; \n     uncheckedAssertEqualObjects(managed.anyUUIDObj.allObjects[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    optManaged.boolObj = (id)@[@NO]; \n     uncheckedAssertEqualObjects(optManaged.boolObj.allObjects[0], @NO);\n    optManaged.intObj = (id)@[@2]; \n     uncheckedAssertEqualObjects(optManaged.intObj.allObjects[0], @2);\n    optManaged.floatObj = (id)@[@2.2f]; \n     uncheckedAssertEqualObjects(optManaged.floatObj.allObjects[0], @2.2f);\n    optManaged.doubleObj = (id)@[@2.2]; \n     uncheckedAssertEqualObjects(optManaged.doubleObj.allObjects[0], @2.2);\n    optManaged.stringObj = (id)@[@\"a\"]; \n     uncheckedAssertEqualObjects(optManaged.stringObj.allObjects[0], @\"a\");\n    optManaged.dataObj = (id)@[data(1)]; \n     uncheckedAssertEqualObjects(optManaged.dataObj.allObjects[0], data(1));\n    optManaged.dateObj = (id)@[date(1)]; \n     uncheckedAssertEqualObjects(optManaged.dateObj.allObjects[0], date(1));\n    optManaged.decimalObj = (id)@[decimal128(1)]; \n     uncheckedAssertEqualObjects(optManaged.decimalObj.allObjects[0], decimal128(1));\n    optManaged.objectIdObj = (id)@[objectId(1)]; \n     uncheckedAssertEqualObjects(optManaged.objectIdObj.allObjects[0], objectId(1));\n    optManaged.uuidObj = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]; \n     uncheckedAssertEqualObjects(optManaged.uuidObj.allObjects[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n\n    // Should replace and not append\n    unmanaged.boolObj = (id)@[@NO, @YES]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.boolObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]])); \n    \n    unmanaged.intObj = (id)@[@2, @3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.intObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]])); \n    \n    unmanaged.floatObj = (id)@[@2.2f, @3.3f]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.floatObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]])); \n    \n    unmanaged.doubleObj = (id)@[@2.2, @3.3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.doubleObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]])); \n    \n    unmanaged.stringObj = (id)@[@\"a\", @\"bc\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.stringObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"bc\"]])); \n    \n    unmanaged.dataObj = (id)@[data(1), data(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.dataObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]])); \n    \n    unmanaged.dateObj = (id)@[date(1), date(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.dateObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]])); \n    \n    unmanaged.decimalObj = (id)@[decimal128(1), decimal128(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.decimalObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]])); \n    \n    unmanaged.objectIdObj = (id)@[objectId(1), objectId(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.objectIdObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]])); \n    \n    unmanaged.uuidObj = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.uuidObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]])); \n    \n    unmanaged.anyBoolObj = (id)@[@NO, @YES]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyBoolObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]])); \n    \n    unmanaged.anyIntObj = (id)@[@2, @3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyIntObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]])); \n    \n    unmanaged.anyFloatObj = (id)@[@2.2f, @3.3f]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyFloatObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]])); \n    \n    unmanaged.anyDoubleObj = (id)@[@2.2, @3.3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyDoubleObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]])); \n    \n    unmanaged.anyStringObj = (id)@[@\"a\", @\"b\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyStringObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"b\"]])); \n    \n    unmanaged.anyDataObj = (id)@[data(1), data(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyDataObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]])); \n    \n    unmanaged.anyDateObj = (id)@[date(1), date(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyDateObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]])); \n    \n    unmanaged.anyDecimalObj = (id)@[decimal128(1), decimal128(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyDecimalObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]])); \n    \n    unmanaged.anyObjectIdObj = (id)@[objectId(1), objectId(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyObjectIdObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]])); \n    \n    unmanaged.anyUUIDObj = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyUUIDObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]])); \n    \n    optUnmanaged.boolObj = (id)@[NSNull.null, @NO, @YES]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.boolObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @NO, @YES]])); \n    \n    optUnmanaged.intObj = (id)@[NSNull.null, @2, @3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.intObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2, @3]])); \n    \n    optUnmanaged.floatObj = (id)@[NSNull.null, @2.2f, @3.3f]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.floatObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2f, @3.3f]])); \n    \n    optUnmanaged.doubleObj = (id)@[NSNull.null, @2.2, @3.3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.doubleObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2, @3.3]])); \n    \n    optUnmanaged.stringObj = (id)@[NSNull.null, @\"a\", @\"bc\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.stringObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @\"a\", @\"bc\"]])); \n    \n    optUnmanaged.dataObj = (id)@[NSNull.null, data(1), data(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.dataObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, data(1), data(2)]])); \n    \n    optUnmanaged.dateObj = (id)@[NSNull.null, date(1), date(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.dateObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, date(1), date(2)]])); \n    \n    optUnmanaged.decimalObj = (id)@[NSNull.null, decimal128(1), decimal128(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.decimalObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, decimal128(1), decimal128(2)]])); \n    \n    optUnmanaged.objectIdObj = (id)@[NSNull.null, objectId(1), objectId(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.objectIdObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, objectId(1), objectId(2)]])); \n    \n    optUnmanaged.uuidObj = (id)@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.uuidObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]])); \n    \n    managed.boolObj = (id)@[@NO, @YES]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.boolObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]])); \n    \n    managed.intObj = (id)@[@2, @3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.intObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]])); \n    \n    managed.floatObj = (id)@[@2.2f, @3.3f]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.floatObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]])); \n    \n    managed.doubleObj = (id)@[@2.2, @3.3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.doubleObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]])); \n    \n    managed.stringObj = (id)@[@\"a\", @\"bc\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.stringObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"bc\"]])); \n    \n    managed.dataObj = (id)@[data(1), data(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.dataObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]])); \n    \n    managed.dateObj = (id)@[date(1), date(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.dateObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]])); \n    \n    managed.decimalObj = (id)@[decimal128(1), decimal128(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.decimalObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]])); \n    \n    managed.objectIdObj = (id)@[objectId(1), objectId(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.objectIdObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]])); \n    \n    managed.uuidObj = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.uuidObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]])); \n    \n    managed.anyBoolObj = (id)@[@NO, @YES]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyBoolObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]])); \n    \n    managed.anyIntObj = (id)@[@2, @3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyIntObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]])); \n    \n    managed.anyFloatObj = (id)@[@2.2f, @3.3f]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyFloatObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]])); \n    \n    managed.anyDoubleObj = (id)@[@2.2, @3.3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyDoubleObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]])); \n    \n    managed.anyStringObj = (id)@[@\"a\", @\"b\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyStringObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"b\"]])); \n    \n    managed.anyDataObj = (id)@[data(1), data(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyDataObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]])); \n    \n    managed.anyDateObj = (id)@[date(1), date(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyDateObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]])); \n    \n    managed.anyDecimalObj = (id)@[decimal128(1), decimal128(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyDecimalObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]])); \n    \n    managed.anyObjectIdObj = (id)@[objectId(1), objectId(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyObjectIdObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]])); \n    \n    managed.anyUUIDObj = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyUUIDObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]])); \n    \n    optManaged.boolObj = (id)@[NSNull.null, @NO, @YES]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.boolObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @NO, @YES]])); \n    \n    optManaged.intObj = (id)@[NSNull.null, @2, @3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.intObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2, @3]])); \n    \n    optManaged.floatObj = (id)@[NSNull.null, @2.2f, @3.3f]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.floatObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2f, @3.3f]])); \n    \n    optManaged.doubleObj = (id)@[NSNull.null, @2.2, @3.3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.doubleObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2, @3.3]])); \n    \n    optManaged.stringObj = (id)@[NSNull.null, @\"a\", @\"bc\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.stringObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @\"a\", @\"bc\"]])); \n    \n    optManaged.dataObj = (id)@[NSNull.null, data(1), data(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.dataObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, data(1), data(2)]])); \n    \n    optManaged.dateObj = (id)@[NSNull.null, date(1), date(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.dateObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, date(1), date(2)]])); \n    \n    optManaged.decimalObj = (id)@[NSNull.null, decimal128(1), decimal128(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.decimalObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, decimal128(1), decimal128(2)]])); \n    \n    optManaged.objectIdObj = (id)@[NSNull.null, objectId(1), objectId(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.objectIdObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, objectId(1), objectId(2)]])); \n    \n    optManaged.uuidObj = (id)@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.uuidObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]])); \n    \n\n    // Should not clear the set\n    unmanaged.boolObj = unmanaged.boolObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.boolObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]])); \n    \n    unmanaged.intObj = unmanaged.intObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.intObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]])); \n    \n    unmanaged.floatObj = unmanaged.floatObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.floatObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]])); \n    \n    unmanaged.doubleObj = unmanaged.doubleObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.doubleObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]])); \n    \n    unmanaged.stringObj = unmanaged.stringObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.stringObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"bc\"]])); \n    \n    unmanaged.dataObj = unmanaged.dataObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.dataObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]])); \n    \n    unmanaged.dateObj = unmanaged.dateObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.dateObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]])); \n    \n    unmanaged.decimalObj = unmanaged.decimalObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.decimalObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]])); \n    \n    unmanaged.objectIdObj = unmanaged.objectIdObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.objectIdObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]])); \n    \n    unmanaged.uuidObj = unmanaged.uuidObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.uuidObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]])); \n    \n    unmanaged.anyBoolObj = unmanaged.anyBoolObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyBoolObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]])); \n    \n    unmanaged.anyIntObj = unmanaged.anyIntObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyIntObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]])); \n    \n    unmanaged.anyFloatObj = unmanaged.anyFloatObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyFloatObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]])); \n    \n    unmanaged.anyDoubleObj = unmanaged.anyDoubleObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyDoubleObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]])); \n    \n    unmanaged.anyStringObj = unmanaged.anyStringObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyStringObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"b\"]])); \n    \n    unmanaged.anyDataObj = unmanaged.anyDataObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyDataObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]])); \n    \n    unmanaged.anyDateObj = unmanaged.anyDateObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyDateObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]])); \n    \n    unmanaged.anyDecimalObj = unmanaged.anyDecimalObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyDecimalObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]])); \n    \n    unmanaged.anyObjectIdObj = unmanaged.anyObjectIdObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyObjectIdObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]])); \n    \n    unmanaged.anyUUIDObj = unmanaged.anyUUIDObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.anyUUIDObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]])); \n    \n    optUnmanaged.boolObj = optUnmanaged.boolObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.boolObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @NO, @YES]])); \n    \n    optUnmanaged.intObj = optUnmanaged.intObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.intObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2, @3]])); \n    \n    optUnmanaged.floatObj = optUnmanaged.floatObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.floatObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2f, @3.3f]])); \n    \n    optUnmanaged.doubleObj = optUnmanaged.doubleObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.doubleObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2, @3.3]])); \n    \n    optUnmanaged.stringObj = optUnmanaged.stringObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.stringObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @\"a\", @\"bc\"]])); \n    \n    optUnmanaged.dataObj = optUnmanaged.dataObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.dataObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, data(1), data(2)]])); \n    \n    optUnmanaged.dateObj = optUnmanaged.dateObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.dateObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, date(1), date(2)]])); \n    \n    optUnmanaged.decimalObj = optUnmanaged.decimalObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.decimalObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, decimal128(1), decimal128(2)]])); \n    \n    optUnmanaged.objectIdObj = optUnmanaged.objectIdObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.objectIdObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, objectId(1), objectId(2)]])); \n    \n    optUnmanaged.uuidObj = optUnmanaged.uuidObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged.uuidObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]])); \n    \n    managed.boolObj = managed.boolObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.boolObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]])); \n    \n    managed.intObj = managed.intObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.intObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]])); \n    \n    managed.floatObj = managed.floatObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.floatObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]])); \n    \n    managed.doubleObj = managed.doubleObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.doubleObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]])); \n    \n    managed.stringObj = managed.stringObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.stringObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"bc\"]])); \n    \n    managed.dataObj = managed.dataObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.dataObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]])); \n    \n    managed.dateObj = managed.dateObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.dateObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]])); \n    \n    managed.decimalObj = managed.decimalObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.decimalObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]])); \n    \n    managed.objectIdObj = managed.objectIdObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.objectIdObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]])); \n    \n    managed.uuidObj = managed.uuidObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.uuidObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]])); \n    \n    managed.anyBoolObj = managed.anyBoolObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyBoolObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]])); \n    \n    managed.anyIntObj = managed.anyIntObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyIntObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]])); \n    \n    managed.anyFloatObj = managed.anyFloatObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyFloatObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]])); \n    \n    managed.anyDoubleObj = managed.anyDoubleObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyDoubleObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]])); \n    \n    managed.anyStringObj = managed.anyStringObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyStringObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"b\"]])); \n    \n    managed.anyDataObj = managed.anyDataObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyDataObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]])); \n    \n    managed.anyDateObj = managed.anyDateObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyDateObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]])); \n    \n    managed.anyDecimalObj = managed.anyDecimalObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyDecimalObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]])); \n    \n    managed.anyObjectIdObj = managed.anyObjectIdObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyObjectIdObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]])); \n    \n    managed.anyUUIDObj = managed.anyUUIDObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.anyUUIDObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]])); \n    \n    optManaged.boolObj = optManaged.boolObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.boolObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @NO, @YES]])); \n    \n    optManaged.intObj = optManaged.intObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.intObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2, @3]])); \n    \n    optManaged.floatObj = optManaged.floatObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.floatObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2f, @3.3f]])); \n    \n    optManaged.doubleObj = optManaged.doubleObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.doubleObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2, @3.3]])); \n    \n    optManaged.stringObj = optManaged.stringObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.stringObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @\"a\", @\"bc\"]])); \n    \n    optManaged.dataObj = optManaged.dataObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.dataObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, data(1), data(2)]])); \n    \n    optManaged.dateObj = optManaged.dateObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.dateObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, date(1), date(2)]])); \n    \n    optManaged.decimalObj = optManaged.decimalObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.decimalObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, decimal128(1), decimal128(2)]])); \n    \n    optManaged.objectIdObj = optManaged.objectIdObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.objectIdObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, objectId(1), objectId(2)]])); \n    \n    optManaged.uuidObj = optManaged.uuidObj; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged.uuidObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]])); \n    \n\n    [unmanaged.intObj removeAllObjects];\n    unmanaged.intObj = managed.intObj;\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.intObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]]));\n\n    [managed.intObj removeAllObjects];\n    managed.intObj = unmanaged.intObj;\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.intObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]]));\n}\n\n- (void)testDynamicAssignment {\n    unmanaged[@\"boolObj\"] = (id)@[@YES]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"boolObj\"]).allObjects[0], @YES);\n    unmanaged[@\"intObj\"] = (id)@[@3]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"intObj\"]).allObjects[0], @3);\n    unmanaged[@\"floatObj\"] = (id)@[@3.3f]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"floatObj\"]).allObjects[0], @3.3f);\n    unmanaged[@\"doubleObj\"] = (id)@[@3.3]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"doubleObj\"]).allObjects[0], @3.3);\n    unmanaged[@\"stringObj\"] = (id)@[@\"bc\"]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"stringObj\"]).allObjects[0], @\"bc\");\n    unmanaged[@\"dataObj\"] = (id)@[data(2)]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"dataObj\"]).allObjects[0], data(2));\n    unmanaged[@\"dateObj\"] = (id)@[date(2)]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"dateObj\"]).allObjects[0], date(2));\n    unmanaged[@\"decimalObj\"] = (id)@[decimal128(2)]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"decimalObj\"]).allObjects[0], decimal128(2));\n    unmanaged[@\"objectIdObj\"] = (id)@[objectId(2)]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"objectIdObj\"]).allObjects[0], objectId(2));\n    unmanaged[@\"uuidObj\"] = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"uuidObj\"]).allObjects[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    unmanaged[@\"anyBoolObj\"] = (id)@[@YES]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"anyBoolObj\"]).allObjects[0], @YES);\n    unmanaged[@\"anyIntObj\"] = (id)@[@3]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"anyIntObj\"]).allObjects[0], @3);\n    unmanaged[@\"anyFloatObj\"] = (id)@[@3.3f]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"anyFloatObj\"]).allObjects[0], @3.3f);\n    unmanaged[@\"anyDoubleObj\"] = (id)@[@3.3]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"anyDoubleObj\"]).allObjects[0], @3.3);\n    unmanaged[@\"anyStringObj\"] = (id)@[@\"b\"]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"anyStringObj\"]).allObjects[0], @\"b\");\n    unmanaged[@\"anyDataObj\"] = (id)@[data(2)]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"anyDataObj\"]).allObjects[0], data(2));\n    unmanaged[@\"anyDateObj\"] = (id)@[date(2)]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"anyDateObj\"]).allObjects[0], date(2));\n    unmanaged[@\"anyDecimalObj\"] = (id)@[decimal128(2)]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"anyDecimalObj\"]).allObjects[0], decimal128(2));\n    unmanaged[@\"anyObjectIdObj\"] = (id)@[objectId(2)]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"anyObjectIdObj\"]).allObjects[0], objectId(2));\n    unmanaged[@\"anyUUIDObj\"] = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]; \n     uncheckedAssertEqualObjects(((RLMSet *)unmanaged[@\"anyUUIDObj\"]).allObjects[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    optUnmanaged[@\"boolObj\"] = (id)@[@NO]; \n     uncheckedAssertEqualObjects(((RLMSet *)optUnmanaged[@\"boolObj\"]).allObjects[0], @NO);\n    optUnmanaged[@\"intObj\"] = (id)@[@2]; \n     uncheckedAssertEqualObjects(((RLMSet *)optUnmanaged[@\"intObj\"]).allObjects[0], @2);\n    optUnmanaged[@\"floatObj\"] = (id)@[@2.2f]; \n     uncheckedAssertEqualObjects(((RLMSet *)optUnmanaged[@\"floatObj\"]).allObjects[0], @2.2f);\n    optUnmanaged[@\"doubleObj\"] = (id)@[@2.2]; \n     uncheckedAssertEqualObjects(((RLMSet *)optUnmanaged[@\"doubleObj\"]).allObjects[0], @2.2);\n    optUnmanaged[@\"stringObj\"] = (id)@[@\"a\"]; \n     uncheckedAssertEqualObjects(((RLMSet *)optUnmanaged[@\"stringObj\"]).allObjects[0], @\"a\");\n    optUnmanaged[@\"dataObj\"] = (id)@[data(1)]; \n     uncheckedAssertEqualObjects(((RLMSet *)optUnmanaged[@\"dataObj\"]).allObjects[0], data(1));\n    optUnmanaged[@\"dateObj\"] = (id)@[date(1)]; \n     uncheckedAssertEqualObjects(((RLMSet *)optUnmanaged[@\"dateObj\"]).allObjects[0], date(1));\n    optUnmanaged[@\"decimalObj\"] = (id)@[decimal128(1)]; \n     uncheckedAssertEqualObjects(((RLMSet *)optUnmanaged[@\"decimalObj\"]).allObjects[0], decimal128(1));\n    optUnmanaged[@\"objectIdObj\"] = (id)@[objectId(1)]; \n     uncheckedAssertEqualObjects(((RLMSet *)optUnmanaged[@\"objectIdObj\"]).allObjects[0], objectId(1));\n    optUnmanaged[@\"uuidObj\"] = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]; \n     uncheckedAssertEqualObjects(((RLMSet *)optUnmanaged[@\"uuidObj\"]).allObjects[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    managed[@\"boolObj\"] = (id)@[@YES]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"boolObj\"]).allObjects[0], @YES);\n    managed[@\"intObj\"] = (id)@[@3]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"intObj\"]).allObjects[0], @3);\n    managed[@\"floatObj\"] = (id)@[@3.3f]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"floatObj\"]).allObjects[0], @3.3f);\n    managed[@\"doubleObj\"] = (id)@[@3.3]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"doubleObj\"]).allObjects[0], @3.3);\n    managed[@\"stringObj\"] = (id)@[@\"bc\"]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"stringObj\"]).allObjects[0], @\"bc\");\n    managed[@\"dataObj\"] = (id)@[data(2)]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"dataObj\"]).allObjects[0], data(2));\n    managed[@\"dateObj\"] = (id)@[date(2)]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"dateObj\"]).allObjects[0], date(2));\n    managed[@\"decimalObj\"] = (id)@[decimal128(2)]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"decimalObj\"]).allObjects[0], decimal128(2));\n    managed[@\"objectIdObj\"] = (id)@[objectId(2)]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"objectIdObj\"]).allObjects[0], objectId(2));\n    managed[@\"uuidObj\"] = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\")]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"uuidObj\"]).allObjects[0], uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    managed[@\"anyBoolObj\"] = (id)@[@YES]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"anyBoolObj\"]).allObjects[0], @YES);\n    managed[@\"anyIntObj\"] = (id)@[@3]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"anyIntObj\"]).allObjects[0], @3);\n    managed[@\"anyFloatObj\"] = (id)@[@3.3f]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"anyFloatObj\"]).allObjects[0], @3.3f);\n    managed[@\"anyDoubleObj\"] = (id)@[@3.3]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"anyDoubleObj\"]).allObjects[0], @3.3);\n    managed[@\"anyStringObj\"] = (id)@[@\"b\"]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"anyStringObj\"]).allObjects[0], @\"b\");\n    managed[@\"anyDataObj\"] = (id)@[data(2)]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"anyDataObj\"]).allObjects[0], data(2));\n    managed[@\"anyDateObj\"] = (id)@[date(2)]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"anyDateObj\"]).allObjects[0], date(2));\n    managed[@\"anyDecimalObj\"] = (id)@[decimal128(2)]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"anyDecimalObj\"]).allObjects[0], decimal128(2));\n    managed[@\"anyObjectIdObj\"] = (id)@[objectId(2)]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"anyObjectIdObj\"]).allObjects[0], objectId(2));\n    managed[@\"anyUUIDObj\"] = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]; \n     uncheckedAssertEqualObjects(((RLMSet *)managed[@\"anyUUIDObj\"]).allObjects[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    optManaged[@\"boolObj\"] = (id)@[@NO]; \n     uncheckedAssertEqualObjects(((RLMSet *)optManaged[@\"boolObj\"]).allObjects[0], @NO);\n    optManaged[@\"intObj\"] = (id)@[@2]; \n     uncheckedAssertEqualObjects(((RLMSet *)optManaged[@\"intObj\"]).allObjects[0], @2);\n    optManaged[@\"floatObj\"] = (id)@[@2.2f]; \n     uncheckedAssertEqualObjects(((RLMSet *)optManaged[@\"floatObj\"]).allObjects[0], @2.2f);\n    optManaged[@\"doubleObj\"] = (id)@[@2.2]; \n     uncheckedAssertEqualObjects(((RLMSet *)optManaged[@\"doubleObj\"]).allObjects[0], @2.2);\n    optManaged[@\"stringObj\"] = (id)@[@\"a\"]; \n     uncheckedAssertEqualObjects(((RLMSet *)optManaged[@\"stringObj\"]).allObjects[0], @\"a\");\n    optManaged[@\"dataObj\"] = (id)@[data(1)]; \n     uncheckedAssertEqualObjects(((RLMSet *)optManaged[@\"dataObj\"]).allObjects[0], data(1));\n    optManaged[@\"dateObj\"] = (id)@[date(1)]; \n     uncheckedAssertEqualObjects(((RLMSet *)optManaged[@\"dateObj\"]).allObjects[0], date(1));\n    optManaged[@\"decimalObj\"] = (id)@[decimal128(1)]; \n     uncheckedAssertEqualObjects(((RLMSet *)optManaged[@\"decimalObj\"]).allObjects[0], decimal128(1));\n    optManaged[@\"objectIdObj\"] = (id)@[objectId(1)]; \n     uncheckedAssertEqualObjects(((RLMSet *)optManaged[@\"objectIdObj\"]).allObjects[0], objectId(1));\n    optManaged[@\"uuidObj\"] = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]; \n     uncheckedAssertEqualObjects(((RLMSet *)optManaged[@\"uuidObj\"]).allObjects[0], uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n\n    // Should replace and not append\n    unmanaged[@\"boolObj\"] = (id)@[@NO, @YES]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"boolObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]])); \n    \n    unmanaged[@\"intObj\"] = (id)@[@2, @3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"intObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]])); \n    \n    unmanaged[@\"floatObj\"] = (id)@[@2.2f, @3.3f]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"floatObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]])); \n    \n    unmanaged[@\"doubleObj\"] = (id)@[@2.2, @3.3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"doubleObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]])); \n    \n    unmanaged[@\"stringObj\"] = (id)@[@\"a\", @\"bc\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"stringObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"bc\"]])); \n    \n    unmanaged[@\"dataObj\"] = (id)@[data(1), data(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"dataObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]])); \n    \n    unmanaged[@\"dateObj\"] = (id)@[date(1), date(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"dateObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]])); \n    \n    unmanaged[@\"decimalObj\"] = (id)@[decimal128(1), decimal128(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"decimalObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]])); \n    \n    unmanaged[@\"objectIdObj\"] = (id)@[objectId(1), objectId(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"objectIdObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]])); \n    \n    unmanaged[@\"uuidObj\"] = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"uuidObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]])); \n    \n    unmanaged[@\"anyBoolObj\"] = (id)@[@NO, @YES]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyBoolObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]])); \n    \n    unmanaged[@\"anyIntObj\"] = (id)@[@2, @3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyIntObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]])); \n    \n    unmanaged[@\"anyFloatObj\"] = (id)@[@2.2f, @3.3f]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyFloatObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]])); \n    \n    unmanaged[@\"anyDoubleObj\"] = (id)@[@2.2, @3.3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyDoubleObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]])); \n    \n    unmanaged[@\"anyStringObj\"] = (id)@[@\"a\", @\"b\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyStringObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"b\"]])); \n    \n    unmanaged[@\"anyDataObj\"] = (id)@[data(1), data(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyDataObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]])); \n    \n    unmanaged[@\"anyDateObj\"] = (id)@[date(1), date(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyDateObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]])); \n    \n    unmanaged[@\"anyDecimalObj\"] = (id)@[decimal128(1), decimal128(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyDecimalObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]])); \n    \n    unmanaged[@\"anyObjectIdObj\"] = (id)@[objectId(1), objectId(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyObjectIdObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]])); \n    \n    unmanaged[@\"anyUUIDObj\"] = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyUUIDObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]])); \n    \n    optUnmanaged[@\"boolObj\"] = (id)@[NSNull.null, @NO, @YES]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"boolObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @NO, @YES]])); \n    \n    optUnmanaged[@\"intObj\"] = (id)@[NSNull.null, @2, @3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"intObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2, @3]])); \n    \n    optUnmanaged[@\"floatObj\"] = (id)@[NSNull.null, @2.2f, @3.3f]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"floatObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2f, @3.3f]])); \n    \n    optUnmanaged[@\"doubleObj\"] = (id)@[NSNull.null, @2.2, @3.3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"doubleObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2, @3.3]])); \n    \n    optUnmanaged[@\"stringObj\"] = (id)@[NSNull.null, @\"a\", @\"bc\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"stringObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @\"a\", @\"bc\"]])); \n    \n    optUnmanaged[@\"dataObj\"] = (id)@[NSNull.null, data(1), data(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"dataObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, data(1), data(2)]])); \n    \n    optUnmanaged[@\"dateObj\"] = (id)@[NSNull.null, date(1), date(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"dateObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, date(1), date(2)]])); \n    \n    optUnmanaged[@\"decimalObj\"] = (id)@[NSNull.null, decimal128(1), decimal128(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"decimalObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, decimal128(1), decimal128(2)]])); \n    \n    optUnmanaged[@\"objectIdObj\"] = (id)@[NSNull.null, objectId(1), objectId(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"objectIdObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, objectId(1), objectId(2)]])); \n    \n    optUnmanaged[@\"uuidObj\"] = (id)@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"uuidObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]])); \n    \n    managed[@\"boolObj\"] = (id)@[@NO, @YES]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"boolObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]])); \n    \n    managed[@\"intObj\"] = (id)@[@2, @3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"intObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]])); \n    \n    managed[@\"floatObj\"] = (id)@[@2.2f, @3.3f]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"floatObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]])); \n    \n    managed[@\"doubleObj\"] = (id)@[@2.2, @3.3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"doubleObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]])); \n    \n    managed[@\"stringObj\"] = (id)@[@\"a\", @\"bc\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"stringObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"bc\"]])); \n    \n    managed[@\"dataObj\"] = (id)@[data(1), data(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"dataObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]])); \n    \n    managed[@\"dateObj\"] = (id)@[date(1), date(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"dateObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]])); \n    \n    managed[@\"decimalObj\"] = (id)@[decimal128(1), decimal128(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"decimalObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]])); \n    \n    managed[@\"objectIdObj\"] = (id)@[objectId(1), objectId(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"objectIdObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]])); \n    \n    managed[@\"uuidObj\"] = (id)@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"uuidObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]])); \n    \n    managed[@\"anyBoolObj\"] = (id)@[@NO, @YES]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyBoolObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]])); \n    \n    managed[@\"anyIntObj\"] = (id)@[@2, @3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyIntObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]])); \n    \n    managed[@\"anyFloatObj\"] = (id)@[@2.2f, @3.3f]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyFloatObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]])); \n    \n    managed[@\"anyDoubleObj\"] = (id)@[@2.2, @3.3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyDoubleObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]])); \n    \n    managed[@\"anyStringObj\"] = (id)@[@\"a\", @\"b\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyStringObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"b\"]])); \n    \n    managed[@\"anyDataObj\"] = (id)@[data(1), data(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyDataObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]])); \n    \n    managed[@\"anyDateObj\"] = (id)@[date(1), date(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyDateObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]])); \n    \n    managed[@\"anyDecimalObj\"] = (id)@[decimal128(1), decimal128(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyDecimalObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]])); \n    \n    managed[@\"anyObjectIdObj\"] = (id)@[objectId(1), objectId(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyObjectIdObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]])); \n    \n    managed[@\"anyUUIDObj\"] = (id)@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyUUIDObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]])); \n    \n    optManaged[@\"boolObj\"] = (id)@[NSNull.null, @NO, @YES]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"boolObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @NO, @YES]])); \n    \n    optManaged[@\"intObj\"] = (id)@[NSNull.null, @2, @3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"intObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2, @3]])); \n    \n    optManaged[@\"floatObj\"] = (id)@[NSNull.null, @2.2f, @3.3f]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"floatObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2f, @3.3f]])); \n    \n    optManaged[@\"doubleObj\"] = (id)@[NSNull.null, @2.2, @3.3]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"doubleObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2, @3.3]])); \n    \n    optManaged[@\"stringObj\"] = (id)@[NSNull.null, @\"a\", @\"bc\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"stringObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @\"a\", @\"bc\"]])); \n    \n    optManaged[@\"dataObj\"] = (id)@[NSNull.null, data(1), data(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"dataObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, data(1), data(2)]])); \n    \n    optManaged[@\"dateObj\"] = (id)@[NSNull.null, date(1), date(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"dateObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, date(1), date(2)]])); \n    \n    optManaged[@\"decimalObj\"] = (id)@[NSNull.null, decimal128(1), decimal128(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"decimalObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, decimal128(1), decimal128(2)]])); \n    \n    optManaged[@\"objectIdObj\"] = (id)@[NSNull.null, objectId(1), objectId(2)]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"objectIdObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, objectId(1), objectId(2)]])); \n    \n    optManaged[@\"uuidObj\"] = (id)@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"uuidObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]])); \n    \n\n    // Should not clear the set\n    unmanaged[@\"boolObj\"] = unmanaged[@\"boolObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"boolObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]])); \n    \n    unmanaged[@\"intObj\"] = unmanaged[@\"intObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"intObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]])); \n    \n    unmanaged[@\"floatObj\"] = unmanaged[@\"floatObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"floatObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]])); \n    \n    unmanaged[@\"doubleObj\"] = unmanaged[@\"doubleObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"doubleObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]])); \n    \n    unmanaged[@\"stringObj\"] = unmanaged[@\"stringObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"stringObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"bc\"]])); \n    \n    unmanaged[@\"dataObj\"] = unmanaged[@\"dataObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"dataObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]])); \n    \n    unmanaged[@\"dateObj\"] = unmanaged[@\"dateObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"dateObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]])); \n    \n    unmanaged[@\"decimalObj\"] = unmanaged[@\"decimalObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"decimalObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]])); \n    \n    unmanaged[@\"objectIdObj\"] = unmanaged[@\"objectIdObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"objectIdObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]])); \n    \n    unmanaged[@\"uuidObj\"] = unmanaged[@\"uuidObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"uuidObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]])); \n    \n    unmanaged[@\"anyBoolObj\"] = unmanaged[@\"anyBoolObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyBoolObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]])); \n    \n    unmanaged[@\"anyIntObj\"] = unmanaged[@\"anyIntObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyIntObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]])); \n    \n    unmanaged[@\"anyFloatObj\"] = unmanaged[@\"anyFloatObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyFloatObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]])); \n    \n    unmanaged[@\"anyDoubleObj\"] = unmanaged[@\"anyDoubleObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyDoubleObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]])); \n    \n    unmanaged[@\"anyStringObj\"] = unmanaged[@\"anyStringObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyStringObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"b\"]])); \n    \n    unmanaged[@\"anyDataObj\"] = unmanaged[@\"anyDataObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyDataObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]])); \n    \n    unmanaged[@\"anyDateObj\"] = unmanaged[@\"anyDateObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyDateObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]])); \n    \n    unmanaged[@\"anyDecimalObj\"] = unmanaged[@\"anyDecimalObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyDecimalObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]])); \n    \n    unmanaged[@\"anyObjectIdObj\"] = unmanaged[@\"anyObjectIdObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyObjectIdObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]])); \n    \n    unmanaged[@\"anyUUIDObj\"] = unmanaged[@\"anyUUIDObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"anyUUIDObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]])); \n    \n    optUnmanaged[@\"boolObj\"] = optUnmanaged[@\"boolObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"boolObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @NO, @YES]])); \n    \n    optUnmanaged[@\"intObj\"] = optUnmanaged[@\"intObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"intObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2, @3]])); \n    \n    optUnmanaged[@\"floatObj\"] = optUnmanaged[@\"floatObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"floatObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2f, @3.3f]])); \n    \n    optUnmanaged[@\"doubleObj\"] = optUnmanaged[@\"doubleObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"doubleObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2, @3.3]])); \n    \n    optUnmanaged[@\"stringObj\"] = optUnmanaged[@\"stringObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"stringObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @\"a\", @\"bc\"]])); \n    \n    optUnmanaged[@\"dataObj\"] = optUnmanaged[@\"dataObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"dataObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, data(1), data(2)]])); \n    \n    optUnmanaged[@\"dateObj\"] = optUnmanaged[@\"dateObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"dateObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, date(1), date(2)]])); \n    \n    optUnmanaged[@\"decimalObj\"] = optUnmanaged[@\"decimalObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"decimalObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, decimal128(1), decimal128(2)]])); \n    \n    optUnmanaged[@\"objectIdObj\"] = optUnmanaged[@\"objectIdObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"objectIdObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, objectId(1), objectId(2)]])); \n    \n    optUnmanaged[@\"uuidObj\"] = optUnmanaged[@\"uuidObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optUnmanaged[@\"uuidObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]])); \n    \n    managed[@\"boolObj\"] = managed[@\"boolObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"boolObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]])); \n    \n    managed[@\"intObj\"] = managed[@\"intObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"intObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]])); \n    \n    managed[@\"floatObj\"] = managed[@\"floatObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"floatObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]])); \n    \n    managed[@\"doubleObj\"] = managed[@\"doubleObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"doubleObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]])); \n    \n    managed[@\"stringObj\"] = managed[@\"stringObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"stringObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"bc\"]])); \n    \n    managed[@\"dataObj\"] = managed[@\"dataObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"dataObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]])); \n    \n    managed[@\"dateObj\"] = managed[@\"dateObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"dateObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]])); \n    \n    managed[@\"decimalObj\"] = managed[@\"decimalObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"decimalObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]])); \n    \n    managed[@\"objectIdObj\"] = managed[@\"objectIdObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"objectIdObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]])); \n    \n    managed[@\"uuidObj\"] = managed[@\"uuidObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"uuidObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]])); \n    \n    managed[@\"anyBoolObj\"] = managed[@\"anyBoolObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyBoolObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@NO, @YES]])); \n    \n    managed[@\"anyIntObj\"] = managed[@\"anyIntObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyIntObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]])); \n    \n    managed[@\"anyFloatObj\"] = managed[@\"anyFloatObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyFloatObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2f, @3.3f]])); \n    \n    managed[@\"anyDoubleObj\"] = managed[@\"anyDoubleObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyDoubleObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2.2, @3.3]])); \n    \n    managed[@\"anyStringObj\"] = managed[@\"anyStringObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyStringObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@\"a\", @\"b\"]])); \n    \n    managed[@\"anyDataObj\"] = managed[@\"anyDataObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyDataObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[data(1), data(2)]])); \n    \n    managed[@\"anyDateObj\"] = managed[@\"anyDateObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyDateObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[date(1), date(2)]])); \n    \n    managed[@\"anyDecimalObj\"] = managed[@\"anyDecimalObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyDecimalObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[decimal128(1), decimal128(2)]])); \n    \n    managed[@\"anyObjectIdObj\"] = managed[@\"anyObjectIdObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyObjectIdObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[objectId(1), objectId(2)]])); \n    \n    managed[@\"anyUUIDObj\"] = managed[@\"anyUUIDObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"anyUUIDObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]])); \n    \n    optManaged[@\"boolObj\"] = optManaged[@\"boolObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"boolObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @NO, @YES]])); \n    \n    optManaged[@\"intObj\"] = optManaged[@\"intObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"intObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2, @3]])); \n    \n    optManaged[@\"floatObj\"] = optManaged[@\"floatObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"floatObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2f, @3.3f]])); \n    \n    optManaged[@\"doubleObj\"] = optManaged[@\"doubleObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"doubleObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @2.2, @3.3]])); \n    \n    optManaged[@\"stringObj\"] = optManaged[@\"stringObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"stringObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, @\"a\", @\"bc\"]])); \n    \n    optManaged[@\"dataObj\"] = optManaged[@\"dataObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"dataObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, data(1), data(2)]])); \n    \n    optManaged[@\"dateObj\"] = optManaged[@\"dateObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"dateObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, date(1), date(2)]])); \n    \n    optManaged[@\"decimalObj\"] = optManaged[@\"decimalObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"decimalObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, decimal128(1), decimal128(2)]])); \n    \n    optManaged[@\"objectIdObj\"] = optManaged[@\"objectIdObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"objectIdObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, objectId(1), objectId(2)]])); \n    \n    optManaged[@\"uuidObj\"] = optManaged[@\"uuidObj\"]; \n     uncheckedAssertEqualObjects([NSSet setWithArray:[[optManaged[@\"uuidObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]])); \n    \n\n    [unmanaged[@\"intObj\"] removeAllObjects];\n    unmanaged[@\"intObj\"] = managed.intObj;\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"intObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]]));\n\n    [managed[@\"intObj\"] removeAllObjects];\n    managed[@\"intObj\"] = unmanaged.intObj;\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"intObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]]));\n}\n\n- (void)testInvalidAssignment {\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)@[NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for 'int' set property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)@[@\"a\"],\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' set property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)(@[@1, @\"a\"]),\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' set property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)unmanaged.floatObj,\n                              @\"RLMSet<float> does not match expected type 'int' for property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)optUnmanaged.intObj,\n                              @\"RLMSet<int?> does not match expected type 'int' for property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged[@\"intObj\"] = unmanaged[@\"floatObj\"],\n                              @\"RLMSet<float> does not match expected type 'int' for property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged[@\"intObj\"] = optUnmanaged[@\"intObj\"],\n                              @\"RLMSet<int?> does not match expected type 'int' for property 'AllPrimitiveSets.intObj'.\");\n\n    RLMAssertThrowsWithReason(managed.intObj = (id)@[NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for 'int' set property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)@[@\"a\"],\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' set property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)(@[@1, @\"a\"]),\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' set property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)managed.floatObj,\n                              @\"RLMSet<float> does not match expected type 'int' for property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)optManaged.intObj,\n                              @\"RLMSet<int?> does not match expected type 'int' for property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(managed[@\"intObj\"] = (id)managed[@\"floatObj\"],\n                              @\"RLMSet<float> does not match expected type 'int' for property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(managed[@\"intObj\"] = (id)optManaged[@\"intObj\"],\n                              @\"RLMSet<int?> does not match expected type 'int' for property 'AllPrimitiveSets.intObj'.\");\n}\n\n- (void)testAllMethodsCheckThread {\n    RLMSet *set = managed.intObj;\n    [self dispatchAsyncAndWait:^{\n        RLMAssertThrowsWithReason([set count], @\"thread\");\n\n        RLMAssertThrowsWithReason([set addObject:@0], @\"thread\");\n        RLMAssertThrowsWithReason([set addObjects:@[@0]], @\"thread\");\n        RLMAssertThrowsWithReason([set removeAllObjects], @\"thread\");\n        RLMAssertThrowsWithReason([set sortedResultsUsingKeyPath:@\"self\" ascending:YES], @\"thread\");\n        RLMAssertThrowsWithReason([set sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"self\" ascending:YES]]], @\"thread\");\n        RLMAssertThrowsWithReason(set.allObjects[0], @\"thread\");\n        RLMAssertThrowsWithReason([set valueForKey:@\"self\"], @\"thread\");\n        RLMAssertThrowsWithReason([set setValue:@1 forKey:@\"self\"], @\"thread\");\n        RLMAssertThrowsWithReason(({for (__unused id obj in set);}), @\"thread\");\n    }];\n}\n\n- (void)testAllMethodsCheckForInvalidation {\n    RLMSet *set = managed.intObj;\n    [realm cancelWriteTransaction];\n    [realm invalidate];\n\n    XCTAssertNoThrow([set objectClassName]);\n    XCTAssertNoThrow([set realm]);\n    XCTAssertNoThrow([set isInvalidated]);\n\n    RLMAssertThrowsWithReason([set count], @\"invalidated\");\n\n    RLMAssertThrowsWithReason([set addObject:@0], @\"invalidated\");\n    RLMAssertThrowsWithReason([set addObjects:@[@0]], @\"invalidated\");\n    RLMAssertThrowsWithReason([set removeAllObjects], @\"invalidated\");\n\n    RLMAssertThrowsWithReason([set sortedResultsUsingKeyPath:@\"self\" ascending:YES], @\"invalidated\");\n    RLMAssertThrowsWithReason([set sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"self\" ascending:YES]]], @\"invalidated\");\n    RLMAssertThrowsWithReason(set.allObjects[0], @\"invalidated\");\n    RLMAssertThrowsWithReason([set valueForKey:@\"self\"], @\"invalidated\");\n    RLMAssertThrowsWithReason([set setValue:@1 forKey:@\"self\"], @\"invalidated\");\n    RLMAssertThrowsWithReason(({for (__unused id obj in set);}), @\"invalidated\");\n\n    [realm beginWriteTransaction];\n}\n\n- (void)testMutatingMethodsCheckForWriteTransaction {\n    RLMSet *set = managed.intObj;\n    [set addObject:@0];\n    [realm commitWriteTransaction];\n\n    XCTAssertNoThrow([set objectClassName]);\n    XCTAssertNoThrow([set realm]);\n    XCTAssertNoThrow([set isInvalidated]);\n\n    XCTAssertNoThrow([set count]);\n    XCTAssertNoThrow([set sortedResultsUsingKeyPath:@\"self\" ascending:YES]);\n    XCTAssertNoThrow([set sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"self\" ascending:YES]]]);\n    XCTAssertNoThrow(set.allObjects[0]);\n    XCTAssertNoThrow([set valueForKey:@\"self\"]);\n    XCTAssertNoThrow(({for (__unused id obj in set);}));\n\n\n    RLMAssertThrowsWithReason([set addObject:@0], @\"write transaction\");\n    RLMAssertThrowsWithReason([set addObjects:@[@0]], @\"write transaction\");\n    RLMAssertThrowsWithReason([set removeAllObjects], @\"write transaction\");\n\n    RLMAssertThrowsWithReason([set setValue:@1 forKey:@\"self\"], @\"write transaction\");\n}\n\n- (void)testDeleteOwningObject {\n    RLMSet *set = managed.intObj;\n    uncheckedAssertFalse(set.isInvalidated);\n    [realm deleteObject:managed];\n    uncheckedAssertTrue(set.isInvalidated);\n}\n\n#pragma mark - Queries\n\n#define RLMAssertCount(cls, expectedCount, ...) \\\n    uncheckedAssertEqual(expectedCount, ([cls objectsInRealm:realm where:__VA_ARGS__].count))\n\n- (void)createObjectWithValueIndex:(NSUInteger)index {\n    NSRange range = {index, 1};\n    id obj = [AllPrimitiveSets createInRealm:realm withValue:@{\n        @\"boolObj\": [@[@NO, @YES] subarrayWithRange:range],\n        @\"intObj\": [@[@2, @3] subarrayWithRange:range],\n        @\"floatObj\": [@[@2.2f, @3.3f] subarrayWithRange:range],\n        @\"doubleObj\": [@[@2.2, @3.3] subarrayWithRange:range],\n        @\"stringObj\": [@[@\"a\", @\"bc\"] subarrayWithRange:range],\n        @\"dataObj\": [@[data(1), data(2)] subarrayWithRange:range],\n        @\"dateObj\": [@[date(1), date(2)] subarrayWithRange:range],\n        @\"decimalObj\": [@[decimal128(1), decimal128(2)] subarrayWithRange:range],\n        @\"objectIdObj\": [@[objectId(1), objectId(2)] subarrayWithRange:range],\n        @\"uuidObj\": [@[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")] subarrayWithRange:range],\n        @\"anyBoolObj\": [@[@NO, @YES] subarrayWithRange:range],\n        @\"anyIntObj\": [@[@2, @3] subarrayWithRange:range],\n        @\"anyFloatObj\": [@[@2.2f, @3.3f] subarrayWithRange:range],\n        @\"anyDoubleObj\": [@[@2.2, @3.3] subarrayWithRange:range],\n        @\"anyStringObj\": [@[@\"a\", @\"b\"] subarrayWithRange:range],\n        @\"anyDataObj\": [@[data(1), data(2)] subarrayWithRange:range],\n        @\"anyDateObj\": [@[date(1), date(2)] subarrayWithRange:range],\n        @\"anyDecimalObj\": [@[decimal128(1), decimal128(2)] subarrayWithRange:range],\n        @\"anyObjectIdObj\": [@[objectId(1), objectId(2)] subarrayWithRange:range],\n        @\"anyUUIDObj\": [@[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")] subarrayWithRange:range],\n    }];\n    [LinkToAllPrimitiveSets createInRealm:realm withValue:@[obj]];\n    obj = [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        @\"boolObj\": [@[NSNull.null, @NO, @YES] subarrayWithRange:range],\n        @\"intObj\": [@[NSNull.null, @2, @3] subarrayWithRange:range],\n        @\"floatObj\": [@[NSNull.null, @2.2f, @3.3f] subarrayWithRange:range],\n        @\"doubleObj\": [@[NSNull.null, @2.2, @3.3] subarrayWithRange:range],\n        @\"stringObj\": [@[NSNull.null, @\"a\", @\"bc\"] subarrayWithRange:range],\n        @\"dataObj\": [@[NSNull.null, data(1), data(2)] subarrayWithRange:range],\n        @\"dateObj\": [@[NSNull.null, date(1), date(2)] subarrayWithRange:range],\n        @\"decimalObj\": [@[NSNull.null, decimal128(1), decimal128(2)] subarrayWithRange:range],\n        @\"objectIdObj\": [@[NSNull.null, objectId(1), objectId(2)] subarrayWithRange:range],\n        @\"uuidObj\": [@[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")] subarrayWithRange:range],\n    }];\n    [LinkToAllOptionalPrimitiveSets createInRealm:realm withValue:@[obj]];\n}\n\n- (void)testQueryBasicOperators {\n    [realm deleteAllObjects];\n\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY boolObj = %@\", @NO);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY intObj = %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY floatObj = %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY doubleObj = %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY stringObj = %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dataObj = %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dateObj = %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY decimalObj = %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY objectIdObj = %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY uuidObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyBoolObj = %@\", @NO);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyIntObj = %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyFloatObj = %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDoubleObj = %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyStringObj = %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDataObj = %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDateObj = %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDecimalObj = %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyObjectIdObj = %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyUUIDObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY boolObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY intObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY floatObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY doubleObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY stringObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dataObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dateObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY decimalObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY objectIdObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY uuidObj = %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY boolObj != %@\", @NO);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY intObj != %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY floatObj != %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY doubleObj != %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY stringObj != %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dataObj != %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dateObj != %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY decimalObj != %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY objectIdObj != %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY uuidObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyBoolObj != %@\", @NO);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyIntObj != %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyFloatObj != %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDoubleObj != %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyStringObj != %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDataObj != %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDateObj != %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDecimalObj != %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyObjectIdObj != %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyUUIDObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY boolObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY intObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY floatObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY doubleObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY stringObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dataObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dateObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY decimalObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY objectIdObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY uuidObj != %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY intObj > %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY floatObj > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY doubleObj > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY stringObj > %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dataObj > %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dateObj > %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY decimalObj > %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyIntObj > %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyFloatObj > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDoubleObj > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyStringObj > %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDateObj > %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDecimalObj > %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY intObj > %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY floatObj > %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY doubleObj > %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY stringObj > %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dataObj > %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dateObj > %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY decimalObj > %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY intObj >= %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY floatObj >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY doubleObj >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY stringObj >= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dataObj >= %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dateObj >= %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY decimalObj >= %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyIntObj >= %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyFloatObj >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDoubleObj >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyStringObj >= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDateObj >= %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDecimalObj >= %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY intObj >= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY floatObj >= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY doubleObj >= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY stringObj >= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dataObj >= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dateObj >= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY decimalObj >= %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY intObj < %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY floatObj < %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY doubleObj < %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY stringObj < %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dataObj < %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dateObj < %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY decimalObj < %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyIntObj < %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyFloatObj < %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDoubleObj < %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyStringObj < %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDateObj < %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDecimalObj < %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY intObj < %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY floatObj < %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY doubleObj < %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY stringObj < %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dataObj < %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dateObj < %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY decimalObj < %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY intObj <= %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY floatObj <= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY doubleObj <= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY stringObj <= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dataObj <= %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dateObj <= %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY decimalObj <= %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyIntObj <= %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyFloatObj <= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDoubleObj <= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyStringObj <= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDateObj <= %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDecimalObj <= %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY intObj <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY floatObj <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY doubleObj <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY stringObj <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dataObj <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dateObj <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY decimalObj <= %@\", NSNull.null);\n\n    [self createObjectWithValueIndex:0];\n\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY boolObj = %@\", @YES);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY intObj = %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY floatObj = %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY doubleObj = %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY stringObj = %@\", @\"bc\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dataObj = %@\", data(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dateObj = %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY decimalObj = %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY objectIdObj = %@\", objectId(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY uuidObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyBoolObj = %@\", @YES);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyIntObj = %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyFloatObj = %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDoubleObj = %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyStringObj = %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDataObj = %@\", data(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDateObj = %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDecimalObj = %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyObjectIdObj = %@\", objectId(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyUUIDObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY boolObj = %@\", @NO);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY intObj = %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY floatObj = %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY doubleObj = %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY stringObj = %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dataObj = %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dateObj = %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY decimalObj = %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY objectIdObj = %@\", objectId(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY uuidObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY boolObj = %@\", @NO);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY intObj = %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY floatObj = %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY doubleObj = %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY stringObj = %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dataObj = %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dateObj = %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY decimalObj = %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY objectIdObj = %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY uuidObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyBoolObj = %@\", @NO);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyIntObj = %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyFloatObj = %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDoubleObj = %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyStringObj = %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDataObj = %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDateObj = %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDecimalObj = %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyObjectIdObj = %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyUUIDObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY boolObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY intObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY floatObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY doubleObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY stringObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dataObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dateObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY decimalObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY objectIdObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY uuidObj = %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY boolObj != %@\", @NO);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY intObj != %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY floatObj != %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY doubleObj != %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY stringObj != %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dataObj != %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dateObj != %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY decimalObj != %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY objectIdObj != %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY uuidObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyBoolObj != %@\", @NO);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyIntObj != %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyFloatObj != %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDoubleObj != %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyStringObj != %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDataObj != %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDateObj != %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDecimalObj != %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyObjectIdObj != %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyUUIDObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY boolObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY intObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY floatObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY doubleObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY stringObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dataObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dateObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY decimalObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY objectIdObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY uuidObj != %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY boolObj != %@\", @YES);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY intObj != %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY floatObj != %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY doubleObj != %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY stringObj != %@\", @\"bc\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dataObj != %@\", data(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dateObj != %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY decimalObj != %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY objectIdObj != %@\", objectId(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY uuidObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyBoolObj != %@\", @YES);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyIntObj != %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyFloatObj != %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDoubleObj != %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyStringObj != %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDataObj != %@\", data(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDateObj != %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDecimalObj != %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyObjectIdObj != %@\", objectId(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyUUIDObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY boolObj != %@\", @NO);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY intObj != %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY floatObj != %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY doubleObj != %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY stringObj != %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dataObj != %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dateObj != %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY decimalObj != %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY objectIdObj != %@\", objectId(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY uuidObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY intObj > %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY floatObj > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY doubleObj > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY stringObj > %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dataObj > %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dateObj > %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY decimalObj > %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyIntObj > %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyFloatObj > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDoubleObj > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyStringObj > %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDateObj > %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDecimalObj > %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY intObj > %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY floatObj > %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY doubleObj > %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY stringObj > %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dataObj > %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dateObj > %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY decimalObj > %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY intObj >= %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY floatObj >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY doubleObj >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY stringObj >= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dataObj >= %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dateObj >= %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY decimalObj >= %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyIntObj >= %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyFloatObj >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDoubleObj >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyStringObj >= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDateObj >= %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDecimalObj >= %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY intObj >= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY floatObj >= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY doubleObj >= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY stringObj >= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dataObj >= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dateObj >= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY decimalObj >= %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY intObj < %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY floatObj < %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY doubleObj < %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY stringObj < %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dataObj < %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dateObj < %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY decimalObj < %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyIntObj < %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyFloatObj < %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDoubleObj < %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyStringObj < %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDateObj < %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDecimalObj < %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY intObj < %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY floatObj < %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY doubleObj < %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY stringObj < %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dataObj < %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dateObj < %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY decimalObj < %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY intObj < %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY floatObj < %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY doubleObj < %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY stringObj < %@\", @\"bc\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dataObj < %@\", data(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dateObj < %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY decimalObj < %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyIntObj < %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyFloatObj < %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDoubleObj < %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyStringObj < %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDateObj < %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDecimalObj < %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY intObj < %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY floatObj < %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY doubleObj < %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY stringObj < %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dataObj < %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dateObj < %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY decimalObj < %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY intObj <= %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY floatObj <= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY doubleObj <= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY stringObj <= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dataObj <= %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dateObj <= %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY decimalObj <= %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyIntObj <= %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyFloatObj <= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDoubleObj <= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyStringObj <= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDateObj <= %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDecimalObj <= %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY intObj <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY floatObj <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY doubleObj <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY stringObj <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dataObj <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dateObj <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY decimalObj <= %@\", NSNull.null);\n\n    [self createObjectWithValueIndex:1];\n\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY boolObj = %@\", @NO);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY intObj = %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY floatObj = %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY doubleObj = %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY stringObj = %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dataObj = %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dateObj = %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY decimalObj = %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY objectIdObj = %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY uuidObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyBoolObj = %@\", @NO);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyIntObj = %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyFloatObj = %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDoubleObj = %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyStringObj = %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDataObj = %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDateObj = %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDecimalObj = %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyObjectIdObj = %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyUUIDObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY boolObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY intObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY floatObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY doubleObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY stringObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dataObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dateObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY decimalObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY objectIdObj = %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY uuidObj = %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY boolObj = %@\", @YES);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY intObj = %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY floatObj = %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY doubleObj = %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY stringObj = %@\", @\"bc\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dataObj = %@\", data(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dateObj = %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY decimalObj = %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY objectIdObj = %@\", objectId(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY uuidObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyBoolObj = %@\", @YES);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyIntObj = %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyFloatObj = %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDoubleObj = %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyStringObj = %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDataObj = %@\", data(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDateObj = %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDecimalObj = %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyObjectIdObj = %@\", objectId(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyUUIDObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY boolObj = %@\", @NO);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY intObj = %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY floatObj = %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY doubleObj = %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY stringObj = %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dataObj = %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dateObj = %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY decimalObj = %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY objectIdObj = %@\", objectId(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY uuidObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY boolObj != %@\", @NO);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY intObj != %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY floatObj != %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY doubleObj != %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY stringObj != %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dataObj != %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dateObj != %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY decimalObj != %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY objectIdObj != %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY uuidObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyBoolObj != %@\", @NO);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyIntObj != %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyFloatObj != %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDoubleObj != %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyStringObj != %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDataObj != %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDateObj != %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDecimalObj != %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyObjectIdObj != %@\", objectId(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyUUIDObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY boolObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY intObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY floatObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY doubleObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY stringObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dataObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dateObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY decimalObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY objectIdObj != %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY uuidObj != %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY boolObj != %@\", @YES);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY intObj != %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY floatObj != %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY doubleObj != %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY stringObj != %@\", @\"bc\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dataObj != %@\", data(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dateObj != %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY decimalObj != %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY objectIdObj != %@\", objectId(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY uuidObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyBoolObj != %@\", @YES);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyIntObj != %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyFloatObj != %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDoubleObj != %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyStringObj != %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDataObj != %@\", data(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDateObj != %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDecimalObj != %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyObjectIdObj != %@\", objectId(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyUUIDObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY boolObj != %@\", @NO);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY intObj != %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY floatObj != %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY doubleObj != %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY stringObj != %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dataObj != %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dateObj != %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY decimalObj != %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY objectIdObj != %@\", objectId(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY uuidObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY intObj > %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY floatObj > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY doubleObj > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY stringObj > %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dataObj > %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dateObj > %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY decimalObj > %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyIntObj > %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyFloatObj > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDoubleObj > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyStringObj > %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDateObj > %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDecimalObj > %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY intObj >= %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY floatObj >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY doubleObj >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY stringObj >= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY dataObj >= %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY dateObj >= %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY decimalObj >= %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY anyIntObj >= %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY anyFloatObj >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY anyDoubleObj >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY anyStringObj >= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY anyDateObj >= %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY anyDecimalObj >= %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY intObj < %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY floatObj < %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY doubleObj < %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY stringObj < %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dataObj < %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dateObj < %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY decimalObj < %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyIntObj < %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyFloatObj < %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDoubleObj < %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyStringObj < %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDateObj < %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDecimalObj < %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY intObj < %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY floatObj < %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY doubleObj < %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY stringObj < %@\", @\"bc\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dataObj < %@\", data(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dateObj < %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY decimalObj < %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyIntObj < %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyFloatObj < %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDoubleObj < %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyStringObj < %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDateObj < %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDecimalObj < %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY intObj <= %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY floatObj <= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY doubleObj <= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY stringObj <= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dataObj <= %@\", data(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dateObj <= %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY decimalObj <= %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyIntObj <= %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyFloatObj <= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDoubleObj <= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyStringObj <= %@\", @\"a\");\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDateObj <= %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDecimalObj <= %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY intObj <= %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY floatObj <= %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY doubleObj <= %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY stringObj <= %@\", @\"bc\");\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY dataObj <= %@\", data(2));\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY dateObj <= %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY decimalObj <= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY anyIntObj <= %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY anyFloatObj <= %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY anyDoubleObj <= %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY anyStringObj <= %@\", @\"b\");\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY anyDateObj <= %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 2, @\"ANY anyDecimalObj <= %@\", decimal128(2));\n\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY intObj > %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY floatObj > %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY doubleObj > %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY stringObj > %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dataObj > %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dateObj > %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY decimalObj > %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY intObj >= %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY floatObj >= %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY doubleObj >= %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY stringObj >= %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dataObj >= %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dateObj >= %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY decimalObj >= %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY intObj < %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY floatObj < %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY doubleObj < %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY stringObj < %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dataObj < %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dateObj < %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY decimalObj < %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY intObj < %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY floatObj < %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY doubleObj < %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY stringObj < %@\", @\"bc\");\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dataObj < %@\", data(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dateObj < %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY decimalObj < %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY intObj <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY floatObj <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY doubleObj <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY stringObj <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dataObj <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dateObj <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY decimalObj <= %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY intObj <= %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY floatObj <= %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY doubleObj <= %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY stringObj <= %@\", @\"a\");\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dataObj <= %@\", data(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dateObj <= %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY decimalObj <= %@\", decimal128(1));\n\n    RLMAssertThrows(([AllPrimitiveSets objectsInRealm:realm where:@\"ANY boolObj > %@\", @NO]));\n    RLMAssertThrows(([AllPrimitiveSets objectsInRealm:realm where:@\"ANY objectIdObj > %@\", objectId(1)]));\n    RLMAssertThrows(([AllPrimitiveSets objectsInRealm:realm where:@\"ANY uuidObj > %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]));\n    RLMAssertThrows(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"ANY boolObj > %@\", NSNull.null]));\n    RLMAssertThrows(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"ANY objectIdObj > %@\", NSNull.null]));\n    RLMAssertThrows(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"ANY uuidObj > %@\", NSNull.null]));\n}\n\n- (void)testQueryBetween {\n    [realm deleteAllObjects];\n\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"ANY boolObj BETWEEN %@\", @[@NO, @YES]]), \n                              @\"Operator 'BETWEEN' not supported for type 'bool'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"ANY stringObj BETWEEN %@\", @[@\"a\", @\"bc\"]]), \n                              @\"Operator 'BETWEEN' not supported for type 'string'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"ANY dataObj BETWEEN %@\", @[data(1), data(2)]]), \n                              @\"Operator 'BETWEEN' not supported for type 'data'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"ANY objectIdObj BETWEEN %@\", @[objectId(1), objectId(2)]]), \n                              @\"Operator 'BETWEEN' not supported for type 'object id'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"ANY uuidObj BETWEEN %@\", @[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]]), \n                              @\"Operator 'BETWEEN' not supported for type 'uuid'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"ANY boolObj BETWEEN %@\", @[NSNull.null, @NO]]), \n                              @\"Operator 'BETWEEN' not supported for type 'bool'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"ANY stringObj BETWEEN %@\", @[NSNull.null, @\"a\"]]), \n                              @\"Operator 'BETWEEN' not supported for type 'string'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"ANY dataObj BETWEEN %@\", @[NSNull.null, data(1)]]), \n                              @\"Operator 'BETWEEN' not supported for type 'data'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"ANY objectIdObj BETWEEN %@\", @[NSNull.null, objectId(1)]]), \n                              @\"Operator 'BETWEEN' not supported for type 'object id'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"ANY uuidObj BETWEEN %@\", @[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]]), \n                              @\"Operator 'BETWEEN' not supported for type 'uuid'\");\n\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY intObj BETWEEN %@\", @[@2, @3]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY floatObj BETWEEN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY doubleObj BETWEEN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dateObj BETWEEN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY decimalObj BETWEEN %@\", @[decimal128(1), decimal128(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyIntObj BETWEEN %@\", @[@2, @3]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyFloatObj BETWEEN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDoubleObj BETWEEN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDateObj BETWEEN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDecimalObj BETWEEN %@\", @[decimal128(1), decimal128(2)]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY intObj BETWEEN %@\", @[NSNull.null, @2]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY floatObj BETWEEN %@\", @[NSNull.null, @2.2f]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY doubleObj BETWEEN %@\", @[NSNull.null, @2.2]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dateObj BETWEEN %@\", @[NSNull.null, date(1)]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY decimalObj BETWEEN %@\", @[NSNull.null, decimal128(1)]);\n\n    [self createObjectWithValueIndex:1];\n\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY intObj BETWEEN %@\", @[@3, @3]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY floatObj BETWEEN %@\", @[@3.3f, @3.3f]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY doubleObj BETWEEN %@\", @[@3.3, @3.3]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dateObj BETWEEN %@\", @[date(2), date(2)]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY decimalObj BETWEEN %@\", @[decimal128(2), decimal128(2)]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyIntObj BETWEEN %@\", @[@3, @3]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyFloatObj BETWEEN %@\", @[@3.3f, @3.3f]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDoubleObj BETWEEN %@\", @[@3.3, @3.3]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDateObj BETWEEN %@\", @[date(2), date(2)]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDecimalObj BETWEEN %@\", @[decimal128(2), decimal128(2)]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY intObj BETWEEN %@\", @[@2, @3]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY floatObj BETWEEN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY doubleObj BETWEEN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dateObj BETWEEN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY decimalObj BETWEEN %@\", @[decimal128(1), decimal128(2)]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyIntObj BETWEEN %@\", @[@2, @3]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyFloatObj BETWEEN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDoubleObj BETWEEN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDateObj BETWEEN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDecimalObj BETWEEN %@\", @[decimal128(1), decimal128(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY intObj BETWEEN %@\", @[@2, @2]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY floatObj BETWEEN %@\", @[@2.2f, @2.2f]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY doubleObj BETWEEN %@\", @[@2.2, @2.2]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dateObj BETWEEN %@\", @[date(1), date(1)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY decimalObj BETWEEN %@\", @[decimal128(1), decimal128(1)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyIntObj BETWEEN %@\", @[@2, @2]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyFloatObj BETWEEN %@\", @[@2.2f, @2.2f]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDoubleObj BETWEEN %@\", @[@2.2, @2.2]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDateObj BETWEEN %@\", @[date(1), date(1)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDecimalObj BETWEEN %@\", @[decimal128(1), decimal128(1)]);\n\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY intObj BETWEEN %@\", @[@2, @2]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY floatObj BETWEEN %@\", @[@2.2f, @2.2f]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY doubleObj BETWEEN %@\", @[@2.2, @2.2]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dateObj BETWEEN %@\", @[date(1), date(1)]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY decimalObj BETWEEN %@\", @[decimal128(1), decimal128(1)]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY intObj BETWEEN %@\", @[@2, @3]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY floatObj BETWEEN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY doubleObj BETWEEN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dateObj BETWEEN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY decimalObj BETWEEN %@\", @[decimal128(1), decimal128(2)]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY intObj BETWEEN %@\", @[@3, @3]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY floatObj BETWEEN %@\", @[@3.3f, @3.3f]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY doubleObj BETWEEN %@\", @[@3.3, @3.3]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dateObj BETWEEN %@\", @[date(2), date(2)]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY decimalObj BETWEEN %@\", @[decimal128(2), decimal128(2)]);\n}\n\n- (void)testQueryIn {\n    [realm deleteAllObjects];\n\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY boolObj IN %@\", @[@NO, @YES]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY intObj IN %@\", @[@2, @3]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY floatObj IN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY doubleObj IN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY stringObj IN %@\", @[@\"a\", @\"bc\"]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dataObj IN %@\", @[data(1), data(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dateObj IN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY decimalObj IN %@\", @[decimal128(1), decimal128(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY objectIdObj IN %@\", @[objectId(1), objectId(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY uuidObj IN %@\", @[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyBoolObj IN %@\", @[@NO, @YES]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyIntObj IN %@\", @[@2, @3]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyFloatObj IN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDoubleObj IN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyStringObj IN %@\", @[@\"a\", @\"b\"]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDataObj IN %@\", @[data(1), data(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDateObj IN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDecimalObj IN %@\", @[decimal128(1), decimal128(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyObjectIdObj IN %@\", @[objectId(1), objectId(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyUUIDObj IN %@\", @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY boolObj IN %@\", @[NSNull.null, @NO]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY intObj IN %@\", @[NSNull.null, @2]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY floatObj IN %@\", @[NSNull.null, @2.2f]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY doubleObj IN %@\", @[NSNull.null, @2.2]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY stringObj IN %@\", @[NSNull.null, @\"a\"]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dataObj IN %@\", @[NSNull.null, data(1)]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dateObj IN %@\", @[NSNull.null, date(1)]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY decimalObj IN %@\", @[NSNull.null, decimal128(1)]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY objectIdObj IN %@\", @[NSNull.null, objectId(1)]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY uuidObj IN %@\", @[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n\n    [self createObjectWithValueIndex:0];\n\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY boolObj IN %@\", @[@YES]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY intObj IN %@\", @[@3]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY floatObj IN %@\", @[@3.3f]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY doubleObj IN %@\", @[@3.3]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY stringObj IN %@\", @[@\"bc\"]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dataObj IN %@\", @[data(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY dateObj IN %@\", @[date(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY decimalObj IN %@\", @[decimal128(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY objectIdObj IN %@\", @[objectId(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY uuidObj IN %@\", @[uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyBoolObj IN %@\", @[@YES]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyIntObj IN %@\", @[@3]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyFloatObj IN %@\", @[@3.3f]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDoubleObj IN %@\", @[@3.3]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyStringObj IN %@\", @[@\"b\"]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDataObj IN %@\", @[data(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDateObj IN %@\", @[date(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyDecimalObj IN %@\", @[decimal128(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyObjectIdObj IN %@\", @[objectId(2)]);\n    RLMAssertCount(AllPrimitiveSets, 0, @\"ANY anyUUIDObj IN %@\", @[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY boolObj IN %@\", @[@NO]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY intObj IN %@\", @[@2]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY floatObj IN %@\", @[@2.2f]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY doubleObj IN %@\", @[@2.2]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY stringObj IN %@\", @[@\"a\"]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dataObj IN %@\", @[data(1)]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY dateObj IN %@\", @[date(1)]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY decimalObj IN %@\", @[decimal128(1)]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY objectIdObj IN %@\", @[objectId(1)]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"ANY uuidObj IN %@\", @[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY boolObj IN %@\", @[@NO, @YES]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY intObj IN %@\", @[@2, @3]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY floatObj IN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY doubleObj IN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY stringObj IN %@\", @[@\"a\", @\"bc\"]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dataObj IN %@\", @[data(1), data(2)]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY dateObj IN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY decimalObj IN %@\", @[decimal128(1), decimal128(2)]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY objectIdObj IN %@\", @[objectId(1), objectId(2)]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY uuidObj IN %@\", @[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyBoolObj IN %@\", @[@NO, @YES]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyIntObj IN %@\", @[@2, @3]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyFloatObj IN %@\", @[@2.2f, @3.3f]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDoubleObj IN %@\", @[@2.2, @3.3]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyStringObj IN %@\", @[@\"a\", @\"b\"]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDataObj IN %@\", @[data(1), data(2)]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDateObj IN %@\", @[date(1), date(2)]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyDecimalObj IN %@\", @[decimal128(1), decimal128(2)]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyObjectIdObj IN %@\", @[objectId(1), objectId(2)]);\n    RLMAssertCount(AllPrimitiveSets, 1, @\"ANY anyUUIDObj IN %@\", @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY boolObj IN %@\", @[NSNull.null, @NO]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY intObj IN %@\", @[NSNull.null, @2]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY floatObj IN %@\", @[NSNull.null, @2.2f]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY doubleObj IN %@\", @[NSNull.null, @2.2]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY stringObj IN %@\", @[NSNull.null, @\"a\"]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dataObj IN %@\", @[NSNull.null, data(1)]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY dateObj IN %@\", @[NSNull.null, date(1)]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY decimalObj IN %@\", @[NSNull.null, decimal128(1)]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY objectIdObj IN %@\", @[NSNull.null, objectId(1)]);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"ANY uuidObj IN %@\", @[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]);\n}\n\n- (void)testQueryCount {\n    [realm deleteAllObjects];\n\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        @\"boolObj\": @[@NO, @YES],\n        @\"intObj\": @[@2, @3],\n        @\"floatObj\": @[@2.2f, @3.3f],\n        @\"doubleObj\": @[@2.2, @3.3],\n        @\"stringObj\": @[@\"a\", @\"bc\"],\n        @\"dataObj\": @[data(1), data(2)],\n        @\"dateObj\": @[date(1), date(2)],\n        @\"decimalObj\": @[decimal128(1), decimal128(2)],\n        @\"objectIdObj\": @[objectId(1), objectId(2)],\n        @\"uuidObj\": @[uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"), uuid(@\"00000000-0000-0000-0000-000000000000\")],\n        @\"anyBoolObj\": @[@NO, @YES],\n        @\"anyIntObj\": @[@2, @3],\n        @\"anyFloatObj\": @[@2.2f, @3.3f],\n        @\"anyDoubleObj\": @[@2.2, @3.3],\n        @\"anyStringObj\": @[@\"a\", @\"b\"],\n        @\"anyDataObj\": @[data(1), data(2)],\n        @\"anyDateObj\": @[date(1), date(2)],\n        @\"anyDecimalObj\": @[decimal128(1), decimal128(2)],\n        @\"anyObjectIdObj\": @[objectId(1), objectId(2)],\n        @\"anyUUIDObj\": @[uuid(@\"00000000-0000-0000-0000-000000000000\"), uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        @\"boolObj\": @[NSNull.null, @NO],\n        @\"intObj\": @[NSNull.null, @2],\n        @\"floatObj\": @[NSNull.null, @2.2f],\n        @\"doubleObj\": @[NSNull.null, @2.2],\n        @\"stringObj\": @[NSNull.null, @\"a\"],\n        @\"dataObj\": @[NSNull.null, data(1)],\n        @\"dateObj\": @[NSNull.null, date(1)],\n        @\"decimalObj\": @[NSNull.null, decimal128(1)],\n        @\"objectIdObj\": @[NSNull.null, objectId(1)],\n        @\"uuidObj\": @[NSNull.null, uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")],\n    }];\n\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"boolObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"intObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"floatObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"doubleObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"stringObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"dataObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"dateObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"decimalObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"objectIdObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"uuidObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyBoolObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyIntObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyFloatObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDoubleObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyStringObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDataObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDateObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDecimalObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyObjectIdObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyUUIDObj.@count == %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"boolObj.@count == %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"intObj.@count == %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"floatObj.@count == %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"doubleObj.@count == %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"stringObj.@count == %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"dataObj.@count == %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"dateObj.@count == %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"decimalObj.@count == %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"objectIdObj.@count == %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"uuidObj.@count == %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"boolObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"intObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"floatObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"doubleObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"stringObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"dataObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"dateObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"decimalObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"objectIdObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"uuidObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyBoolObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyIntObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyFloatObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDoubleObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyStringObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDataObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDateObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDecimalObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyObjectIdObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyUUIDObj.@count != %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"boolObj.@count != %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"intObj.@count != %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"floatObj.@count != %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"doubleObj.@count != %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"stringObj.@count != %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"dataObj.@count != %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"dateObj.@count != %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"decimalObj.@count != %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"objectIdObj.@count != %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"uuidObj.@count != %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"boolObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"intObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"floatObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"doubleObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"stringObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"dataObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"dateObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"decimalObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"objectIdObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"uuidObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyBoolObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyIntObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyFloatObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyDoubleObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyStringObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyDataObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyDateObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyDecimalObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyObjectIdObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyUUIDObj.@count > %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"boolObj.@count > %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"intObj.@count > %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"floatObj.@count > %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"doubleObj.@count > %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"stringObj.@count > %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"dataObj.@count > %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"dateObj.@count > %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"decimalObj.@count > %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"objectIdObj.@count > %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"uuidObj.@count > %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"boolObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"intObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"floatObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"doubleObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"stringObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"dataObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"dateObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"decimalObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"objectIdObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"uuidObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyBoolObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyIntObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyFloatObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyDoubleObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyStringObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyDataObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyDateObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyDecimalObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyObjectIdObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyUUIDObj.@count >= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"boolObj.@count >= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"intObj.@count >= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"floatObj.@count >= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"doubleObj.@count >= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"stringObj.@count >= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"dataObj.@count >= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"dateObj.@count >= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"decimalObj.@count >= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"objectIdObj.@count >= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"uuidObj.@count >= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"boolObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"intObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"floatObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"doubleObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"stringObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"dataObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"dateObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"decimalObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"objectIdObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"uuidObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyBoolObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyIntObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyFloatObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyDoubleObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyStringObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyDataObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyDateObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyDecimalObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyObjectIdObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 0, @\"anyUUIDObj.@count < %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"boolObj.@count < %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"intObj.@count < %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"floatObj.@count < %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"doubleObj.@count < %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"stringObj.@count < %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"dataObj.@count < %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"dateObj.@count < %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"decimalObj.@count < %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"objectIdObj.@count < %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0, @\"uuidObj.@count < %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"boolObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"intObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"floatObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"doubleObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"stringObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"dataObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"dateObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"decimalObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"objectIdObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"uuidObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyBoolObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyIntObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyFloatObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyDoubleObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyStringObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyDataObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyDateObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyDecimalObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyObjectIdObj.@count <= %@\", @(2));\n    RLMAssertCount(AllPrimitiveSets, 1, @\"anyUUIDObj.@count <= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"boolObj.@count <= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"intObj.@count <= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"floatObj.@count <= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"doubleObj.@count <= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"stringObj.@count <= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"dataObj.@count <= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"dateObj.@count <= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"decimalObj.@count <= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"objectIdObj.@count <= %@\", @(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1, @\"uuidObj.@count <= %@\", @(2));\n}\n\n- (void)testQuerySum {\n    [realm deleteAllObjects];\n\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"boolObj.@sum = %@\", @NO]), \n                              @\"Invalid keypath 'boolObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"stringObj.@sum = %@\", @\"a\"]), \n                              @\"Invalid keypath 'stringObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"dataObj.@sum = %@\", data(1)]), \n                              @\"Invalid keypath 'dataObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"objectIdObj.@sum = %@\", objectId(1)]), \n                              @\"Invalid keypath 'objectIdObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"uuidObj.@sum = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]), \n                              @\"Invalid keypath 'uuidObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"boolObj.@sum = %@\", NSNull.null]), \n                              @\"Invalid keypath 'boolObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"stringObj.@sum = %@\", NSNull.null]), \n                              @\"Invalid keypath 'stringObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"dataObj.@sum = %@\", NSNull.null]), \n                              @\"Invalid keypath 'dataObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"objectIdObj.@sum = %@\", NSNull.null]), \n                              @\"Invalid keypath 'objectIdObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"uuidObj.@sum = %@\", NSNull.null]), \n                              @\"Invalid keypath 'uuidObj.@sum': @sum can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"dateObj.@sum = %@\", date(1)]), \n                              @\"Cannot sum or average date properties\");\n\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"intObj.@sum = %@\", @\"a\"]), \n                              @\"@sum on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"floatObj.@sum = %@\", @\"a\"]), \n                              @\"@sum on a property of type float cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"doubleObj.@sum = %@\", @\"a\"]), \n                              @\"@sum on a property of type double cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"decimalObj.@sum = %@\", @\"a\"]), \n                              @\"@sum on a property of type decimal128 cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"intObj.@sum = %@\", @\"a\"]), \n                              @\"@sum on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"floatObj.@sum = %@\", @\"a\"]), \n                              @\"@sum on a property of type float cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"doubleObj.@sum = %@\", @\"a\"]), \n                              @\"@sum on a property of type double cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"decimalObj.@sum = %@\", @\"a\"]), \n                              @\"@sum on a property of type decimal128 cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"intObj.@sum.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'intObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"floatObj.@sum.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'floatObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"doubleObj.@sum.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'doubleObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"decimalObj.@sum.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'decimalObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"intObj.@sum.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'intObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"floatObj.@sum.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'floatObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"doubleObj.@sum.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'doubleObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"decimalObj.@sum.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'decimalObj.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"intObj.@sum = %@\", NSNull.null]), \n                              @\"@sum on a property of type int cannot be compared with '<null>'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"floatObj.@sum = %@\", NSNull.null]), \n                              @\"@sum on a property of type float cannot be compared with '<null>'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"doubleObj.@sum = %@\", NSNull.null]), \n                              @\"@sum on a property of type double cannot be compared with '<null>'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"decimalObj.@sum = %@\", NSNull.null]), \n                              @\"@sum on a property of type decimal128 cannot be compared with '<null>'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"intObj.@sum = %@\", NSNull.null]), \n                              @\"@sum on a property of type int cannot be compared with '<null>'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"floatObj.@sum = %@\", NSNull.null]), \n                              @\"@sum on a property of type float cannot be compared with '<null>'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"doubleObj.@sum = %@\", NSNull.null]), \n                              @\"@sum on a property of type double cannot be compared with '<null>'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"decimalObj.@sum = %@\", NSNull.null]), \n                              @\"@sum on a property of type decimal128 cannot be compared with '<null>'\");\n\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[],\n        @\"floatObj\": @[],\n        @\"doubleObj\": @[],\n        @\"decimalObj\": @[],\n        @\"anyIntObj\": @[],\n        @\"anyFloatObj\": @[],\n        @\"anyDoubleObj\": @[],\n        @\"anyDecimalObj\": @[],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[],\n        @\"floatObj\": @[],\n        @\"doubleObj\": @[],\n        @\"decimalObj\": @[],\n    }];\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[@2],\n        @\"floatObj\": @[@2.2f],\n        @\"doubleObj\": @[@2.2],\n        @\"decimalObj\": @[decimal128(1)],\n        @\"anyIntObj\": @[@2],\n        @\"anyFloatObj\": @[@2.2f],\n        @\"anyDoubleObj\": @[@2.2],\n        @\"anyDecimalObj\": @[decimal128(1)],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[@2],\n        @\"floatObj\": @[@2.2f],\n        @\"doubleObj\": @[@2.2],\n        @\"decimalObj\": @[decimal128(1)],\n    }];\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[@2, @2],\n        @\"floatObj\": @[@2.2f, @2.2f],\n        @\"doubleObj\": @[@2.2, @2.2],\n        @\"decimalObj\": @[decimal128(1), decimal128(1)],\n        @\"anyIntObj\": @[@2, @2],\n        @\"anyFloatObj\": @[@2.2f, @2.2f],\n        @\"anyDoubleObj\": @[@2.2, @2.2],\n        @\"anyDecimalObj\": @[decimal128(1), decimal128(1)],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[@2, @3],\n        @\"floatObj\": @[@2.2f, @3.3f],\n        @\"doubleObj\": @[@2.2, @3.3],\n        @\"decimalObj\": @[decimal128(1), decimal128(2)],\n    }];\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[@3, @3, @3],\n        @\"floatObj\": @[@3.3f, @3.3f, @3.3f],\n        @\"doubleObj\": @[@3.3, @3.3, @3.3],\n        @\"decimalObj\": @[decimal128(2), decimal128(2), decimal128(2)],\n        @\"anyIntObj\": @[@3, @3, @3],\n        @\"anyFloatObj\": @[@3.3f, @3.3f, @3.3f],\n        @\"anyDoubleObj\": @[@3.3, @3.3, @3.3],\n        @\"anyDecimalObj\": @[decimal128(2), decimal128(2), decimal128(2)],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[@2, @2, @2],\n        @\"floatObj\": @[@2.2f, @2.2f, @2.2f],\n        @\"doubleObj\": @[@2.2, @2.2, @2.2],\n        @\"decimalObj\": @[decimal128(1), decimal128(1), decimal128(1)],\n    }];\n\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"intObj.@sum == %@\", @0);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"floatObj.@sum == %@\", @0);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"doubleObj.@sum == %@\", @0);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"decimalObj.@sum == %@\", @0);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyIntObj.@sum == %@\", @0);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyFloatObj.@sum == %@\", @0);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDoubleObj.@sum == %@\", @0);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDecimalObj.@sum == %@\", @0);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"intObj.@sum == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"floatObj.@sum == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"doubleObj.@sum == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"decimalObj.@sum == %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyIntObj.@sum == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyFloatObj.@sum == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyDoubleObj.@sum == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyDecimalObj.@sum == %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"intObj.@sum != %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"floatObj.@sum != %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"doubleObj.@sum != %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"decimalObj.@sum != %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyIntObj.@sum != %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyFloatObj.@sum != %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyDoubleObj.@sum != %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyDecimalObj.@sum != %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"intObj.@sum >= %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"floatObj.@sum >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"doubleObj.@sum >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"decimalObj.@sum >= %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyIntObj.@sum >= %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyFloatObj.@sum >= %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyDoubleObj.@sum >= %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyDecimalObj.@sum >= %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"intObj.@sum > %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"floatObj.@sum > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"doubleObj.@sum > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"decimalObj.@sum > %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyIntObj.@sum > %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyFloatObj.@sum > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDoubleObj.@sum > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDecimalObj.@sum > %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"intObj.@sum < %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"floatObj.@sum < %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"doubleObj.@sum < %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"decimalObj.@sum < %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyIntObj.@sum < %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyFloatObj.@sum < %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyDoubleObj.@sum < %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyDecimalObj.@sum < %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 4U, @\"intObj.@sum <= %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 4U, @\"floatObj.@sum <= %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 4U, @\"doubleObj.@sum <= %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 4U, @\"decimalObj.@sum <= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 4U, @\"anyIntObj.@sum <= %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 4U, @\"anyFloatObj.@sum <= %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 4U, @\"anyDoubleObj.@sum <= %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 4U, @\"anyDecimalObj.@sum <= %@\", decimal128(2));\n\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"intObj.@sum == %@\", @0);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"floatObj.@sum == %@\", @0);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"doubleObj.@sum == %@\", @0);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"decimalObj.@sum == %@\", @0);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"intObj.@sum == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"floatObj.@sum == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"doubleObj.@sum == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"decimalObj.@sum == %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"intObj.@sum != %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"floatObj.@sum != %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"doubleObj.@sum != %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"decimalObj.@sum != %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"intObj.@sum >= %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"floatObj.@sum >= %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"doubleObj.@sum >= %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"decimalObj.@sum >= %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"intObj.@sum > %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"floatObj.@sum > %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"doubleObj.@sum > %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"decimalObj.@sum > %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"intObj.@sum < %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"floatObj.@sum < %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"doubleObj.@sum < %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"decimalObj.@sum < %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"intObj.@sum <= %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"floatObj.@sum <= %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"doubleObj.@sum <= %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"decimalObj.@sum <= %@\", decimal128(1));\n}\n\n- (void)testQueryAverage {\n    [realm deleteAllObjects];\n\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"boolObj.@avg = %@\", @NO]), \n                              @\"Invalid keypath 'boolObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"stringObj.@avg = %@\", @\"a\"]), \n                              @\"Invalid keypath 'stringObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"dataObj.@avg = %@\", data(1)]), \n                              @\"Invalid keypath 'dataObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"objectIdObj.@avg = %@\", objectId(1)]), \n                              @\"Invalid keypath 'objectIdObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"uuidObj.@avg = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]), \n                              @\"Invalid keypath 'uuidObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"boolObj.@avg = %@\", NSNull.null]), \n                              @\"Invalid keypath 'boolObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"stringObj.@avg = %@\", NSNull.null]), \n                              @\"Invalid keypath 'stringObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"dataObj.@avg = %@\", NSNull.null]), \n                              @\"Invalid keypath 'dataObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"objectIdObj.@avg = %@\", NSNull.null]), \n                              @\"Invalid keypath 'objectIdObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"uuidObj.@avg = %@\", NSNull.null]), \n                              @\"Invalid keypath 'uuidObj.@avg': @avg can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"dateObj.@avg = %@\", date(1)]), \n                              @\"Cannot sum or average date properties\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"dateObj.@avg = %@\", NSNull.null]), \n                              @\"Cannot sum or average date properties\");\n\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"intObj.@avg = %@\", @\"a\"]), \n                              @\"@avg on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"floatObj.@avg = %@\", @\"a\"]), \n                              @\"@avg on a property of type float cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"doubleObj.@avg = %@\", @\"a\"]), \n                              @\"@avg on a property of type double cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"decimalObj.@avg = %@\", @\"a\"]), \n                              @\"@avg on a property of type decimal128 cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"intObj.@avg = %@\", @\"a\"]), \n                              @\"@avg on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"floatObj.@avg = %@\", @\"a\"]), \n                              @\"@avg on a property of type float cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"doubleObj.@avg = %@\", @\"a\"]), \n                              @\"@avg on a property of type double cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"decimalObj.@avg = %@\", @\"a\"]), \n                              @\"@avg on a property of type decimal128 cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"intObj.@avg.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'intObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"floatObj.@avg.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'floatObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"doubleObj.@avg.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'doubleObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"decimalObj.@avg.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'decimalObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"intObj.@avg.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'intObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"floatObj.@avg.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'floatObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"doubleObj.@avg.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'doubleObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"decimalObj.@avg.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'decimalObj.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[],\n        @\"floatObj\": @[],\n        @\"doubleObj\": @[],\n        @\"decimalObj\": @[],\n        @\"anyIntObj\": @[],\n        @\"anyFloatObj\": @[],\n        @\"anyDoubleObj\": @[],\n        @\"anyDecimalObj\": @[],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[],\n        @\"floatObj\": @[],\n        @\"doubleObj\": @[],\n        @\"decimalObj\": @[],\n    }];\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[@3],\n        @\"floatObj\": @[@3.3f],\n        @\"doubleObj\": @[@3.3],\n        @\"decimalObj\": @[decimal128(2)],\n        @\"anyIntObj\": @[@3],\n        @\"anyFloatObj\": @[@3.3f],\n        @\"anyDoubleObj\": @[@3.3],\n        @\"anyDecimalObj\": @[decimal128(2)],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[@3],\n        @\"floatObj\": @[@3.3f],\n        @\"doubleObj\": @[@3.3],\n        @\"decimalObj\": @[decimal128(2)],\n    }];\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[@2, @3],\n        @\"floatObj\": @[@2.2f, @3.3f],\n        @\"doubleObj\": @[@2.2, @3.3],\n        @\"decimalObj\": @[decimal128(1), decimal128(2)],\n        @\"anyIntObj\": @[@2, @3],\n        @\"anyFloatObj\": @[@2.2f, @3.3f],\n        @\"anyDoubleObj\": @[@2.2, @3.3],\n        @\"anyDecimalObj\": @[decimal128(1), decimal128(2)],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[@2, @3],\n        @\"floatObj\": @[@2.2f, @3.3f],\n        @\"doubleObj\": @[@2.2, @3.3],\n        @\"decimalObj\": @[decimal128(1), decimal128(2)],\n    }];\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[@3],\n        @\"floatObj\": @[@3.3f],\n        @\"doubleObj\": @[@3.3],\n        @\"decimalObj\": @[decimal128(2)],\n        @\"anyIntObj\": @[@3],\n        @\"anyFloatObj\": @[@3.3f],\n        @\"anyDoubleObj\": @[@3.3],\n        @\"anyDecimalObj\": @[decimal128(2)],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[@3],\n        @\"floatObj\": @[@3.3f],\n        @\"doubleObj\": @[@3.3],\n        @\"decimalObj\": @[decimal128(2)],\n    }];\n\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"intObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"floatObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"doubleObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"decimalObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyIntObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyFloatObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDoubleObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDecimalObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"intObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"floatObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"doubleObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"decimalObj.@avg == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"intObj.@avg == %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"floatObj.@avg == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"doubleObj.@avg == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"decimalObj.@avg == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyIntObj.@avg == %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyFloatObj.@avg == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyDoubleObj.@avg == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyDecimalObj.@avg == %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"intObj.@avg == %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"floatObj.@avg == %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"doubleObj.@avg == %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"decimalObj.@avg == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"intObj.@avg != %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"floatObj.@avg != %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"doubleObj.@avg != %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"decimalObj.@avg != %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyIntObj.@avg != %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyFloatObj.@avg != %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyDoubleObj.@avg != %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyDecimalObj.@avg != %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"intObj.@avg != %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"floatObj.@avg != %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"doubleObj.@avg != %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"decimalObj.@avg != %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"intObj.@avg >= %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"floatObj.@avg >= %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"doubleObj.@avg >= %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"decimalObj.@avg >= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyIntObj.@avg >= %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyFloatObj.@avg >= %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyDoubleObj.@avg >= %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyDecimalObj.@avg >= %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"intObj.@avg >= %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"floatObj.@avg >= %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"doubleObj.@avg >= %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"decimalObj.@avg >= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"intObj.@avg > %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"floatObj.@avg > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"doubleObj.@avg > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"decimalObj.@avg > %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyIntObj.@avg > %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyFloatObj.@avg > %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyDoubleObj.@avg > %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyDecimalObj.@avg > %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"intObj.@avg > %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"floatObj.@avg > %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"doubleObj.@avg > %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"decimalObj.@avg > %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"intObj.@avg < %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"floatObj.@avg < %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"doubleObj.@avg < %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"decimalObj.@avg < %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyIntObj.@avg < %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyFloatObj.@avg < %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDoubleObj.@avg < %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDecimalObj.@avg < %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"intObj.@avg < %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"floatObj.@avg < %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"doubleObj.@avg < %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"decimalObj.@avg < %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"intObj.@avg <= %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"floatObj.@avg <= %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"doubleObj.@avg <= %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"decimalObj.@avg <= %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyIntObj.@avg <= %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyFloatObj.@avg <= %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyDoubleObj.@avg <= %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 3U, @\"anyDecimalObj.@avg <= %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"intObj.@avg <= %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"floatObj.@avg <= %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"doubleObj.@avg <= %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 3U, @\"decimalObj.@avg <= %@\", decimal128(2));\n}\n\n- (void)testQueryMin {\n    [realm deleteAllObjects];\n\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"boolObj.@min = %@\", @NO]), \n                              @\"Invalid keypath 'boolObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"stringObj.@min = %@\", @\"a\"]), \n                              @\"Invalid keypath 'stringObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"dataObj.@min = %@\", data(1)]), \n                              @\"Invalid keypath 'dataObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"objectIdObj.@min = %@\", objectId(1)]), \n                              @\"Invalid keypath 'objectIdObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"uuidObj.@min = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]), \n                              @\"Invalid keypath 'uuidObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"boolObj.@min = %@\", NSNull.null]), \n                              @\"Invalid keypath 'boolObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"stringObj.@min = %@\", NSNull.null]), \n                              @\"Invalid keypath 'stringObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"dataObj.@min = %@\", NSNull.null]), \n                              @\"Invalid keypath 'dataObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"objectIdObj.@min = %@\", NSNull.null]), \n                              @\"Invalid keypath 'objectIdObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"uuidObj.@min = %@\", NSNull.null]), \n                              @\"Invalid keypath 'uuidObj.@min': @min can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"intObj.@min = %@\", @\"a\"]), \n                              @\"@min on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"floatObj.@min = %@\", @\"a\"]), \n                              @\"@min on a property of type float cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"doubleObj.@min = %@\", @\"a\"]), \n                              @\"@min on a property of type double cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"dateObj.@min = %@\", @\"a\"]), \n                              @\"@min on a property of type date cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"decimalObj.@min = %@\", @\"a\"]), \n                              @\"@min on a property of type decimal128 cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"intObj.@min = %@\", @\"a\"]), \n                              @\"@min on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"floatObj.@min = %@\", @\"a\"]), \n                              @\"@min on a property of type float cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"doubleObj.@min = %@\", @\"a\"]), \n                              @\"@min on a property of type double cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"dateObj.@min = %@\", @\"a\"]), \n                              @\"@min on a property of type date cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"decimalObj.@min = %@\", @\"a\"]), \n                              @\"@min on a property of type decimal128 cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"intObj.@min.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'intObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"floatObj.@min.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'floatObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"doubleObj.@min.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'doubleObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"dateObj.@min.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'dateObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"decimalObj.@min.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'decimalObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"anyIntObj.@min.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'anyIntObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"anyFloatObj.@min.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'anyFloatObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"anyDoubleObj.@min.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'anyDoubleObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"anyDateObj.@min.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'anyDateObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"anyDecimalObj.@min.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'anyDecimalObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"intObj.@min.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'intObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"floatObj.@min.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'floatObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"doubleObj.@min.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'doubleObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"dateObj.@min.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'dateObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"decimalObj.@min.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'decimalObj.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n\n    // No objects, so count is zero\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"floatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"doubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"decimalObj.@min == %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyIntObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyFloatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDoubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDecimalObj.@min == %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"intObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"floatObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"doubleObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"dateObj.@min == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"decimalObj.@min == %@\", NSNull.null);\n\n    [AllPrimitiveSets createInRealm:realm withValue:@{}];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{}];\n\n    // Only empty arrays, so count is zero\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"floatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"doubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"decimalObj.@min == %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyIntObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyFloatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDoubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDecimalObj.@min == %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"intObj.@min == %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"floatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"doubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"dateObj.@min == %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"decimalObj.@min == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyIntObj.@min == %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyFloatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDoubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDateObj.@min == %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDecimalObj.@min == %@\", decimal128(2));\n\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"floatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"doubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"decimalObj.@min == %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"intObj.@min == %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"floatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"doubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"dateObj.@min == %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"decimalObj.@min == %@\", decimal128(2));\n\n    [self createObjectWithValueIndex:1];\n\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"intObj.@min == %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"floatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"doubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"dateObj.@min == %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"decimalObj.@min == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyIntObj.@min == %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyFloatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDoubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDateObj.@min == %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDecimalObj.@min == %@\", decimal128(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"floatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"doubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"decimalObj.@min == %@\", decimal128(1));\n\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"floatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"doubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"decimalObj.@min == %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyIntObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyFloatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDoubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDecimalObj.@min == %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"intObj.@min == %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"floatObj.@min == %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"doubleObj.@min == %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"dateObj.@min == %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"decimalObj.@min == %@\", decimal128(2));\n\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[@3, @2],\n        @\"floatObj\": @[@3.3f, @2.2f],\n        @\"doubleObj\": @[@3.3, @2.2],\n        @\"dateObj\": @[date(2), date(1)],\n        @\"decimalObj\": @[decimal128(2), decimal128(1)],\n        @\"anyIntObj\": @[@3, @2],\n        @\"anyFloatObj\": @[@3.3f, @2.2f],\n        @\"anyDoubleObj\": @[@3.3, @2.2],\n        @\"anyDateObj\": @[date(2), date(1)],\n        @\"anyDecimalObj\": @[decimal128(2), decimal128(1)],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[@3, @2],\n        @\"floatObj\": @[@3.3f, @2.2f],\n        @\"doubleObj\": @[@3.3, @2.2],\n        @\"dateObj\": @[date(2), date(1)],\n        @\"decimalObj\": @[decimal128(2), decimal128(1)],\n    }];\n\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"floatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"doubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"decimalObj.@min == %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyIntObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyFloatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDoubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDecimalObj.@min == %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"floatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"doubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"decimalObj.@min == %@\", decimal128(1));\n\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"floatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"doubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"decimalObj.@min == %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyIntObj.@min == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyFloatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDoubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDateObj.@min == %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDecimalObj.@min == %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"intObj.@min == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"floatObj.@min == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"doubleObj.@min == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"dateObj.@min == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"decimalObj.@min == %@\", decimal128(1));\n}\n\n- (void)testQueryMax {\n    [realm deleteAllObjects];\n\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"boolObj.@max = %@\", @NO]), \n                              @\"Invalid keypath 'boolObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"stringObj.@max = %@\", @\"a\"]), \n                              @\"Invalid keypath 'stringObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"dataObj.@max = %@\", data(1)]), \n                              @\"Invalid keypath 'dataObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"objectIdObj.@max = %@\", objectId(1)]), \n                              @\"Invalid keypath 'objectIdObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"uuidObj.@max = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]), \n                              @\"Invalid keypath 'uuidObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"boolObj.@max = %@\", NSNull.null]), \n                              @\"Invalid keypath 'boolObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"stringObj.@max = %@\", NSNull.null]), \n                              @\"Invalid keypath 'stringObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"dataObj.@max = %@\", NSNull.null]), \n                              @\"Invalid keypath 'dataObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"objectIdObj.@max = %@\", NSNull.null]), \n                              @\"Invalid keypath 'objectIdObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"uuidObj.@max = %@\", NSNull.null]), \n                              @\"Invalid keypath 'uuidObj.@max': @max can only be applied to a collection of numeric values.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"intObj.@max = %@\", @\"a\"]), \n                              @\"@max on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"floatObj.@max = %@\", @\"a\"]), \n                              @\"@max on a property of type float cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"doubleObj.@max = %@\", @\"a\"]), \n                              @\"@max on a property of type double cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"dateObj.@max = %@\", @\"a\"]), \n                              @\"@max on a property of type date cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"decimalObj.@max = %@\", @\"a\"]), \n                              @\"@max on a property of type decimal128 cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"intObj.@max = %@\", @\"a\"]), \n                              @\"@max on a property of type int cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"floatObj.@max = %@\", @\"a\"]), \n                              @\"@max on a property of type float cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"doubleObj.@max = %@\", @\"a\"]), \n                              @\"@max on a property of type double cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"dateObj.@max = %@\", @\"a\"]), \n                              @\"@max on a property of type date cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"decimalObj.@max = %@\", @\"a\"]), \n                              @\"@max on a property of type decimal128 cannot be compared with 'a'\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"intObj.@max.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'intObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"floatObj.@max.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'floatObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"doubleObj.@max.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'doubleObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"dateObj.@max.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'dateObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"decimalObj.@max.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'decimalObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"anyIntObj.@max.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'anyIntObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"anyFloatObj.@max.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'anyFloatObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"anyDoubleObj.@max.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'anyDoubleObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"anyDateObj.@max.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'anyDateObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllPrimitiveSets objectsInRealm:realm where:@\"anyDecimalObj.@max.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'anyDecimalObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"intObj.@max.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'intObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"floatObj.@max.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'floatObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"doubleObj.@max.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'doubleObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"dateObj.@max.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'dateObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([AllOptionalPrimitiveSets objectsInRealm:realm where:@\"decimalObj.@max.prop = %@\", @\"a\"]), \n                              @\"Invalid keypath 'decimalObj.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n\n    // No objects, so count is zero\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"floatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"doubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"decimalObj.@max == %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyIntObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyFloatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDoubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDecimalObj.@max == %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"intObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"floatObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"doubleObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"dateObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"decimalObj.@max == %@\", NSNull.null);\n\n    [AllPrimitiveSets createInRealm:realm withValue:@{}];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{}];\n\n    // Only empty arrays, so count is zero\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"floatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"doubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"decimalObj.@max == %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyIntObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyFloatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDoubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDecimalObj.@max == %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"intObj.@max == %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"floatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"doubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"dateObj.@max == %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"decimalObj.@max == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyIntObj.@max == %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyFloatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDoubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDateObj.@max == %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDecimalObj.@max == %@\", decimal128(2));\n\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"floatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"doubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"decimalObj.@max == %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"intObj.@max == %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"floatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"doubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"dateObj.@max == %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"decimalObj.@max == %@\", decimal128(2));\n\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"intObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"floatObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"doubleObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"dateObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"decimalObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyIntObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyFloatObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDoubleObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDateObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDecimalObj.@max == nil\");\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"intObj.@max == nil\");\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"floatObj.@max == nil\");\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"doubleObj.@max == nil\");\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"dateObj.@max == nil\");\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"decimalObj.@max == nil\");\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"intObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"floatObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"doubleObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"dateObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"decimalObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyIntObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyFloatObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDoubleObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDateObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDecimalObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"intObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"floatObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"doubleObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"dateObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"decimalObj.@max == %@\", NSNull.null);\n\n    [self createObjectWithValueIndex:1];\n\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"intObj.@max == %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"floatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"doubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"dateObj.@max == %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"decimalObj.@max == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyIntObj.@max == %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyFloatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDoubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDateObj.@max == %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDecimalObj.@max == %@\", decimal128(2));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"floatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"doubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"decimalObj.@max == %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyIntObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyFloatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDoubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 0U, @\"anyDecimalObj.@max == %@\", decimal128(1));\n\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"floatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"doubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"decimalObj.@max == %@\", decimal128(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"intObj.@max == %@\", @3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"floatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"doubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"dateObj.@max == %@\", date(2));\n    RLMAssertCount(AllOptionalPrimitiveSets, 0U, @\"decimalObj.@max == %@\", decimal128(2));\n\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[@2],\n        @\"floatObj\": @[@2.2f],\n        @\"doubleObj\": @[@2.2],\n        @\"dateObj\": @[date(1)],\n        @\"decimalObj\": @[decimal128(1)],\n        @\"anyIntObj\": @[@2],\n        @\"anyFloatObj\": @[@2.2f],\n        @\"anyDoubleObj\": @[@2.2],\n        @\"anyDateObj\": @[date(1)],\n        @\"anyDecimalObj\": @[decimal128(1)],\n    }];\n\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[@3, @2],\n        @\"floatObj\": @[@3.3f, @2.2f],\n        @\"doubleObj\": @[@3.3, @2.2],\n        @\"dateObj\": @[date(2), date(1)],\n        @\"decimalObj\": @[decimal128(2), decimal128(1)],\n        @\"anyIntObj\": @[@3, @2],\n        @\"anyFloatObj\": @[@3.3f, @2.2f],\n        @\"anyDoubleObj\": @[@3.3, @2.2],\n        @\"anyDateObj\": @[date(2), date(1)],\n        @\"anyDecimalObj\": @[decimal128(2), decimal128(1)],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        @\"intObj\": @[@2, NSNull.null],\n        @\"floatObj\": @[@2.2f, NSNull.null],\n        @\"doubleObj\": @[@2.2, NSNull.null],\n        @\"dateObj\": @[date(1), NSNull.null],\n        @\"decimalObj\": @[decimal128(1), NSNull.null],\n    }];\n\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"floatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"doubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"decimalObj.@max == %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"intObj.@max == %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"floatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"doubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"dateObj.@max == %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"decimalObj.@max == %@\", decimal128(2));\n\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"intObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"floatObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"doubleObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"dateObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 1U, @\"decimalObj.@max == %@\", NSNull.null);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"intObj.@max == %@\", @2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"floatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"doubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"dateObj.@max == %@\", date(1));\n    RLMAssertCount(AllOptionalPrimitiveSets, 2U, @\"decimalObj.@max == %@\", decimal128(1));\n\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyIntObj.@max == %@\", @2);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyFloatObj.@max == %@\", @2.2f);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDoubleObj.@max == %@\", @2.2);\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDateObj.@max == %@\", date(1));\n    RLMAssertCount(AllPrimitiveSets, 1U, @\"anyDecimalObj.@max == %@\", decimal128(1));\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyIntObj.@max == %@\", @3);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyFloatObj.@max == %@\", @3.3f);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyDoubleObj.@max == %@\", @3.3);\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyDateObj.@max == %@\", date(2));\n    RLMAssertCount(AllPrimitiveSets, 2U, @\"anyDecimalObj.@max == %@\", decimal128(2));\n}\n\n- (void)testQueryBasicOperatorsOverLink {\n    [realm deleteAllObjects];\n\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.boolObj = %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.intObj = %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.floatObj = %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.doubleObj = %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.stringObj = %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.dataObj = %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.dateObj = %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.decimalObj = %@\", decimal128(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.objectIdObj = %@\", objectId(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.uuidObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyBoolObj = %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyIntObj = %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyFloatObj = %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDoubleObj = %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyStringObj = %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDataObj = %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDateObj = %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDecimalObj = %@\", decimal128(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyObjectIdObj = %@\", objectId(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyUUIDObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.boolObj = %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.intObj = %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.floatObj = %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.doubleObj = %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.stringObj = %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.dataObj = %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.dateObj = %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.decimalObj = %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.objectIdObj = %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.uuidObj = %@\", NSNull.null);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.boolObj != %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.intObj != %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.floatObj != %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.doubleObj != %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.stringObj != %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.dataObj != %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.dateObj != %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.decimalObj != %@\", decimal128(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.objectIdObj != %@\", objectId(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.uuidObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyBoolObj != %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyIntObj != %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyFloatObj != %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDoubleObj != %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyStringObj != %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDataObj != %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDateObj != %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDecimalObj != %@\", decimal128(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyObjectIdObj != %@\", objectId(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyUUIDObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.boolObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.intObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.floatObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.doubleObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.stringObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.dataObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.dateObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.decimalObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.objectIdObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.uuidObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.intObj > %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.floatObj > %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.doubleObj > %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.stringObj > %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.dataObj > %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.dateObj > %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.decimalObj > %@\", decimal128(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyIntObj > %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyFloatObj > %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDoubleObj > %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyStringObj > %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDateObj > %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDecimalObj > %@\", decimal128(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.intObj > %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.floatObj > %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.doubleObj > %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.stringObj > %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.dataObj > %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.dateObj > %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.decimalObj > %@\", NSNull.null);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.intObj >= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.floatObj >= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.doubleObj >= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.stringObj >= %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.dataObj >= %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.dateObj >= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.decimalObj >= %@\", decimal128(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyIntObj >= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyFloatObj >= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDoubleObj >= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyStringObj >= %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDateObj >= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDecimalObj >= %@\", decimal128(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.intObj >= %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.floatObj >= %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.doubleObj >= %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.stringObj >= %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.dataObj >= %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.dateObj >= %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.decimalObj >= %@\", NSNull.null);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.intObj < %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.floatObj < %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.doubleObj < %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.stringObj < %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.dataObj < %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.dateObj < %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.decimalObj < %@\", decimal128(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyIntObj < %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyFloatObj < %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDoubleObj < %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyStringObj < %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDateObj < %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDecimalObj < %@\", decimal128(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.intObj < %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.floatObj < %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.doubleObj < %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.stringObj < %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.dataObj < %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.dateObj < %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.decimalObj < %@\", NSNull.null);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.intObj <= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.floatObj <= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.doubleObj <= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.stringObj <= %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.dataObj <= %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.dateObj <= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.decimalObj <= %@\", decimal128(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyIntObj <= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyFloatObj <= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDoubleObj <= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyStringObj <= %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDateObj <= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDecimalObj <= %@\", decimal128(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.intObj <= %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.floatObj <= %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.doubleObj <= %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.stringObj <= %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.dataObj <= %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.dateObj <= %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.decimalObj <= %@\", NSNull.null);\n\n    [self createObjectWithValueIndex:1];\n\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.boolObj = %@\", @YES);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.intObj = %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.floatObj = %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.doubleObj = %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.stringObj = %@\", @\"bc\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.dataObj = %@\", data(2));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.dateObj = %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.decimalObj = %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.objectIdObj = %@\", objectId(2));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.uuidObj = %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyBoolObj = %@\", @YES);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyIntObj = %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyFloatObj = %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDoubleObj = %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyStringObj = %@\", @\"b\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDataObj = %@\", data(2));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDateObj = %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDecimalObj = %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyObjectIdObj = %@\", objectId(2));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyUUIDObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.boolObj = %@\", @NO);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.intObj = %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.floatObj = %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.doubleObj = %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.stringObj = %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.dataObj = %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.dateObj = %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.decimalObj = %@\", decimal128(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.objectIdObj = %@\", objectId(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.uuidObj = %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.boolObj != %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.intObj != %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.floatObj != %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.doubleObj != %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.stringObj != %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.dataObj != %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.dateObj != %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.decimalObj != %@\", decimal128(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.objectIdObj != %@\", objectId(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.uuidObj != %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\"));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyBoolObj != %@\", @NO);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyIntObj != %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyFloatObj != %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDoubleObj != %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyStringObj != %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDataObj != %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDateObj != %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDecimalObj != %@\", decimal128(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyObjectIdObj != %@\", objectId(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyUUIDObj != %@\", uuid(@\"00000000-0000-0000-0000-000000000000\"));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.boolObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.intObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.floatObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.doubleObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.stringObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.dataObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.dateObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.decimalObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.objectIdObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.uuidObj != %@\", NSNull.null);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.intObj > %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.floatObj > %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.doubleObj > %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.stringObj > %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.dataObj > %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.dateObj > %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.decimalObj > %@\", decimal128(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyIntObj > %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyFloatObj > %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDoubleObj > %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyStringObj > %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDateObj > %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDecimalObj > %@\", decimal128(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.intObj > %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.floatObj > %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.doubleObj > %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.stringObj > %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.dataObj > %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.dateObj > %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.decimalObj > %@\", decimal128(1));\n\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.intObj >= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.floatObj >= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.doubleObj >= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.stringObj >= %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.dataObj >= %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.dateObj >= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.decimalObj >= %@\", decimal128(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyIntObj >= %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyFloatObj >= %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDoubleObj >= %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyStringObj >= %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDateObj >= %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDecimalObj >= %@\", decimal128(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.intObj >= %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.floatObj >= %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.doubleObj >= %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.stringObj >= %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.dataObj >= %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.dateObj >= %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.decimalObj >= %@\", decimal128(1));\n\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.intObj < %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.floatObj < %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.doubleObj < %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.stringObj < %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.dataObj < %@\", data(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.dateObj < %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.decimalObj < %@\", decimal128(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyIntObj < %@\", @2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyFloatObj < %@\", @2.2f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDoubleObj < %@\", @2.2);\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyStringObj < %@\", @\"a\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDateObj < %@\", date(1));\n    RLMAssertCount(LinkToAllPrimitiveSets, 0, @\"ANY link.anyDecimalObj < %@\", decimal128(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.intObj < %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.floatObj < %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.doubleObj < %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.stringObj < %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.dataObj < %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.dateObj < %@\", NSNull.null);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 0, @\"ANY link.decimalObj < %@\", NSNull.null);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.intObj < %@\", @4);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.floatObj < %@\", @4.4f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.doubleObj < %@\", @4.4);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.stringObj < %@\", @\"de\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.dataObj < %@\", data(3));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.dateObj < %@\", date(3));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.decimalObj < %@\", decimal128(3));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyIntObj < %@\", @4);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyFloatObj < %@\", @4.4f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDoubleObj < %@\", @4.4);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyStringObj < %@\", @\"d\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDateObj < %@\", date(3));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDecimalObj < %@\", decimal128(3));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.intObj < %@\", @3);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.floatObj < %@\", @3.3f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.doubleObj < %@\", @3.3);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.stringObj < %@\", @\"bc\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.dataObj < %@\", data(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.dateObj < %@\", date(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.decimalObj < %@\", decimal128(2));\n\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.intObj <= %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.floatObj <= %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.doubleObj <= %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.stringObj <= %@\", @\"bc\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.dataObj <= %@\", data(2));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.dateObj <= %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.decimalObj <= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyIntObj <= %@\", @3);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyFloatObj <= %@\", @3.3f);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDoubleObj <= %@\", @3.3);\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyStringObj <= %@\", @\"b\");\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDateObj <= %@\", date(2));\n    RLMAssertCount(LinkToAllPrimitiveSets, 1, @\"ANY link.anyDecimalObj <= %@\", decimal128(2));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.intObj <= %@\", @2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.floatObj <= %@\", @2.2f);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.doubleObj <= %@\", @2.2);\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.stringObj <= %@\", @\"a\");\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.dataObj <= %@\", data(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.dateObj <= %@\", date(1));\n    RLMAssertCount(LinkToAllOptionalPrimitiveSets, 1, @\"ANY link.decimalObj <= %@\", decimal128(1));\n\n    RLMAssertThrowsWithReason(([LinkToAllPrimitiveSets objectsInRealm:realm where:@\"ANY link.boolObj > %@\", @NO]), \n                              @\"Operator '>' not supported for type 'bool'\");\n    RLMAssertThrowsWithReason(([LinkToAllPrimitiveSets objectsInRealm:realm where:@\"ANY link.objectIdObj > %@\", objectId(1)]), \n                              @\"Operator '>' not supported for type 'object id'\");\n    RLMAssertThrowsWithReason(([LinkToAllPrimitiveSets objectsInRealm:realm where:@\"ANY link.uuidObj > %@\", uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")]), \n                              @\"Operator '>' not supported for type 'uuid'\");\n    RLMAssertThrowsWithReason(([LinkToAllOptionalPrimitiveSets objectsInRealm:realm where:@\"ANY link.boolObj > %@\", NSNull.null]), \n                              @\"Operator '>' not supported for type 'bool'\");\n    RLMAssertThrowsWithReason(([LinkToAllOptionalPrimitiveSets objectsInRealm:realm where:@\"ANY link.objectIdObj > %@\", NSNull.null]), \n                              @\"Operator '>' not supported for type 'object id'\");\n    RLMAssertThrowsWithReason(([LinkToAllOptionalPrimitiveSets objectsInRealm:realm where:@\"ANY link.uuidObj > %@\", NSNull.null]), \n                              @\"Operator '>' not supported for type 'uuid'\");\n}\n\n- (void)testSubstringQueries {\n    NSArray *values = @[\n        @\"\",\n\n        @\"á\", @\"ó\", @\"ú\",\n\n        @\"áá\", @\"áó\", @\"áú\",\n        @\"óá\", @\"óó\", @\"óú\",\n        @\"úá\", @\"úó\", @\"úú\",\n\n        @\"ááá\", @\"ááó\", @\"ááú\", @\"áóá\", @\"áóó\", @\"áóú\", @\"áúá\", @\"áúó\", @\"áúú\",\n        @\"óáá\", @\"óáó\", @\"óáú\", @\"óóá\", @\"óóó\", @\"óóú\", @\"óúá\", @\"óúó\", @\"óúú\",\n        @\"úáá\", @\"úáó\", @\"úáú\", @\"úóá\", @\"úóó\", @\"úóú\", @\"úúá\", @\"úúó\", @\"úúú\",\n    ];\n\n    void (^create)(NSString *) = ^(NSString *value) {\n        id obj = [AllPrimitiveSets createInRealm:realm withValue:@{\n            @\"stringObj\": @[value],\n            @\"dataObj\": @[[value dataUsingEncoding:NSUTF8StringEncoding]]\n        }];\n        [LinkToAllPrimitiveSets createInRealm:realm withValue:@[obj]];\n        obj = [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n            @\"stringObj\": @[value],\n            @\"dataObj\": @[[value dataUsingEncoding:NSUTF8StringEncoding]]\n        }];\n        [LinkToAllOptionalPrimitiveSets createInRealm:realm withValue:@[obj]];\n    };\n\n    for (NSString *value in values) {\n        create(value);\n        create(value.uppercaseString);\n        create([value stringByApplyingTransform:NSStringTransformStripDiacritics reverse:NO]);\n        create([value.uppercaseString stringByApplyingTransform:NSStringTransformStripDiacritics reverse:NO]);\n    }\n\n    void (^test)(NSString *, id, NSUInteger) = ^(NSString *operator, NSString *value, NSUInteger count) {\n        NSData *data = [value dataUsingEncoding:NSUTF8StringEncoding];\n\n        NSString *query = [NSString stringWithFormat:@\"ANY stringObj %@ %%@\", operator];\n        RLMAssertCount(AllPrimitiveSets, count, query, value);\n        RLMAssertCount(AllPrimitiveSets, count, query, value);\n        RLMAssertCount(AllOptionalPrimitiveSets, count, query, value);\n        query = [NSString stringWithFormat:@\"ANY link.stringObj %@ %%@\", operator];\n        RLMAssertCount(LinkToAllPrimitiveSets, count, query, value);\n        RLMAssertCount(LinkToAllPrimitiveSets, count, query, value);\n        RLMAssertCount(LinkToAllOptionalPrimitiveSets, count, query, value);\n\n        query = [NSString stringWithFormat:@\"ANY dataObj %@ %%@\", operator];\n        RLMAssertCount(AllPrimitiveSets, count, query, data);\n        RLMAssertCount(AllPrimitiveSets, count, query, data);\n        RLMAssertCount(AllOptionalPrimitiveSets, count, query, data);\n        query = [NSString stringWithFormat:@\"ANY link.dataObj %@ %%@\", operator];\n        RLMAssertCount(LinkToAllPrimitiveSets, count, query, data);\n        RLMAssertCount(LinkToAllPrimitiveSets, count, query, data);\n        RLMAssertCount(LinkToAllOptionalPrimitiveSets, count, query, data);\n    };\n    void (^testNull)(NSString *, NSUInteger) = ^(NSString *operator, NSUInteger count) {\n        NSString *query = [NSString stringWithFormat:@\"ANY stringObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([AllPrimitiveSets objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'stringObj' of type 'string'\");\n        RLMAssertCount(AllOptionalPrimitiveSets, count, query, NSNull.null);\n        query = [NSString stringWithFormat:@\"ANY link.stringObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([LinkToAllPrimitiveSets objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'stringObj' of type 'string'\");\n        RLMAssertCount(LinkToAllOptionalPrimitiveSets, count, query, NSNull.null);\n\n        query = [NSString stringWithFormat:@\"ANY dataObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([AllPrimitiveSets objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'dataObj' of type 'data'\");\n        RLMAssertCount(AllOptionalPrimitiveSets, count, query, NSNull.null);\n\n        query = [NSString stringWithFormat:@\"ANY link.dataObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([LinkToAllPrimitiveSets objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'dataObj' of type 'data'\");\n        RLMAssertCount(LinkToAllOptionalPrimitiveSets, count, query, NSNull.null);\n    };\n\n    testNull(@\"==\", 0);\n    test(@\"==\", @\"\", 4);\n    test(@\"==\", @\"a\", 1);\n    test(@\"==\", @\"á\", 1);\n    test(@\"==[c]\", @\"a\", 2);\n    test(@\"==[c]\", @\"á\", 2);\n    test(@\"==\", @\"A\", 1);\n    test(@\"==\", @\"Á\", 1);\n    test(@\"==[c]\", @\"A\", 2);\n    test(@\"==[c]\", @\"Á\", 2);\n    test(@\"==[d]\", @\"a\", 2);\n    test(@\"==[d]\", @\"á\", 2);\n    test(@\"==[cd]\", @\"a\", 4);\n    test(@\"==[cd]\", @\"á\", 4);\n    test(@\"==[d]\", @\"A\", 2);\n    test(@\"==[d]\", @\"Á\", 2);\n    test(@\"==[cd]\", @\"A\", 4);\n    test(@\"==[cd]\", @\"Á\", 4);\n\n    testNull(@\"!=\", 160);\n    test(@\"!=\", @\"\", 156);\n    test(@\"!=\", @\"a\", 159);\n    test(@\"!=\", @\"á\", 159);\n    test(@\"!=[c]\", @\"a\", 158);\n    test(@\"!=[c]\", @\"á\", 158);\n    test(@\"!=\", @\"A\", 159);\n    test(@\"!=\", @\"Á\", 159);\n    test(@\"!=[c]\", @\"A\", 158);\n    test(@\"!=[c]\", @\"Á\", 158);\n    test(@\"!=[d]\", @\"a\", 158);\n    test(@\"!=[d]\", @\"á\", 158);\n    test(@\"!=[cd]\", @\"a\", 156);\n    test(@\"!=[cd]\", @\"á\", 156);\n    test(@\"!=[d]\", @\"A\", 158);\n    test(@\"!=[d]\", @\"Á\", 158);\n    test(@\"!=[cd]\", @\"A\", 156);\n    test(@\"!=[cd]\", @\"Á\", 156);\n\n    testNull(@\"CONTAINS\", 0);\n    testNull(@\"CONTAINS[c]\", 0);\n    testNull(@\"CONTAINS[d]\", 0);\n    testNull(@\"CONTAINS[cd]\", 0);\n    test(@\"CONTAINS\", @\"a\", 25);\n    test(@\"CONTAINS\", @\"á\", 25);\n    test(@\"CONTAINS[c]\", @\"a\", 50);\n    test(@\"CONTAINS[c]\", @\"á\", 50);\n    test(@\"CONTAINS\", @\"A\", 25);\n    test(@\"CONTAINS\", @\"Á\", 25);\n    test(@\"CONTAINS[c]\", @\"A\", 50);\n    test(@\"CONTAINS[c]\", @\"Á\", 50);\n    test(@\"CONTAINS[d]\", @\"a\", 50);\n    test(@\"CONTAINS[d]\", @\"á\", 50);\n    test(@\"CONTAINS[cd]\", @\"a\", 100);\n    test(@\"CONTAINS[cd]\", @\"á\", 100);\n    test(@\"CONTAINS[d]\", @\"A\", 50);\n    test(@\"CONTAINS[d]\", @\"Á\", 50);\n    test(@\"CONTAINS[cd]\", @\"A\", 100);\n    test(@\"CONTAINS[cd]\", @\"Á\", 100);\n\n    test(@\"BEGINSWITH\", @\"a\", 13);\n    test(@\"BEGINSWITH\", @\"á\", 13);\n    test(@\"BEGINSWITH[c]\", @\"a\", 26);\n    test(@\"BEGINSWITH[c]\", @\"á\", 26);\n    test(@\"BEGINSWITH\", @\"A\", 13);\n    test(@\"BEGINSWITH\", @\"Á\", 13);\n    test(@\"BEGINSWITH[c]\", @\"A\", 26);\n    test(@\"BEGINSWITH[c]\", @\"Á\", 26);\n    test(@\"BEGINSWITH[d]\", @\"a\", 26);\n    test(@\"BEGINSWITH[d]\", @\"á\", 26);\n    test(@\"BEGINSWITH[cd]\", @\"a\", 52);\n    test(@\"BEGINSWITH[cd]\", @\"á\", 52);\n    test(@\"BEGINSWITH[d]\", @\"A\", 26);\n    test(@\"BEGINSWITH[d]\", @\"Á\", 26);\n    test(@\"BEGINSWITH[cd]\", @\"A\", 52);\n    test(@\"BEGINSWITH[cd]\", @\"Á\", 52);\n\n    test(@\"ENDSWITH\", @\"a\", 13);\n    test(@\"ENDSWITH\", @\"á\", 13);\n    test(@\"ENDSWITH[c]\", @\"a\", 26);\n    test(@\"ENDSWITH[c]\", @\"á\", 26);\n    test(@\"ENDSWITH\", @\"A\", 13);\n    test(@\"ENDSWITH\", @\"Á\", 13);\n    test(@\"ENDSWITH[c]\", @\"A\", 26);\n    test(@\"ENDSWITH[c]\", @\"Á\", 26);\n    test(@\"ENDSWITH[d]\", @\"a\", 26);\n    test(@\"ENDSWITH[d]\", @\"á\", 26);\n    test(@\"ENDSWITH[cd]\", @\"a\", 52);\n    test(@\"ENDSWITH[cd]\", @\"á\", 52);\n    test(@\"ENDSWITH[d]\", @\"A\", 26);\n    test(@\"ENDSWITH[d]\", @\"Á\", 26);\n    test(@\"ENDSWITH[cd]\", @\"A\", 52);\n    test(@\"ENDSWITH[cd]\", @\"Á\", 52);\n}\n\n\n#pragma clang diagnostic ignored \"-Warc-retain-cycles\"\n\n- (void)testNotificationSentInitially {\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMSet *set, RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(set);\n        uncheckedAssertNil(change);\n        uncheckedAssertNil(error);\n        [expectation fulfill];\n    }];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationSentAfterCommit {\n    [realm commitWriteTransaction];\n\n    __block bool first = true;\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMSet *set, RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(set);\n        uncheckedAssertNil(error);\n        if (first) {\n            uncheckedAssertNil(change);\n        }\n        else {\n            uncheckedAssertEqualObjects(change.insertions, @[@0]);\n        }\n\n        first = false;\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *r = [RLMRealm defaultRealm];\n        [r transactionWithBlock:^{\n            RLMSet *set = [(AllPrimitiveSets *)[AllPrimitiveSets allObjectsInRealm:r].firstObject intObj];\n            [set addObject:@0];\n        }];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationNotSentForUnrelatedChange {\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(__unused RLMSet *set, __unused RLMCollectionChange *change, __unused NSError *error) {\n        // will throw if it's incorrectly called a second time due to the\n        // unrelated write transaction\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmDidChangeNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *r = [RLMRealm defaultRealm];\n            [r transactionWithBlock:^{\n                [AllPrimitiveSets createInRealm:r withValue:@[]];\n            }];\n        }];\n    }];\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationSentOnlyForActualRefresh {\n    [realm commitWriteTransaction];\n\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMSet *set, __unused RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(set);\n        uncheckedAssertNil(error);\n        // will throw if it's called a second time before we create the new\n        // expectation object immediately before manually refreshing\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // Turn off autorefresh, so the background commit should not result in a notification\n    realm.autorefresh = NO;\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmRefreshRequiredNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *r = [RLMRealm defaultRealm];\n            [r transactionWithBlock:^{\n                RLMSet *set = [(AllPrimitiveSets *)[AllPrimitiveSets allObjectsInRealm:r].firstObject intObj];\n                [set addObject:@0];\n            }];\n        }];\n    }];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [realm refresh];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testDeletingObjectWithNotificationsRegistered {\n    [managed.intObj addObjects:@[@10, @20]];\n    [realm commitWriteTransaction];\n\n    __block bool first = true;\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMSet *set, RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(set);\n        uncheckedAssertNil(error);\n        if (first) {\n            uncheckedAssertNil(change);\n            first = false;\n        }\n        else {\n            uncheckedAssertEqualObjects(change.deletions, (@[@0, @1]));\n        }\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [realm beginWriteTransaction];\n    [realm deleteObject:managed];\n    [realm commitWriteTransaction];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/PrimitiveSetPropertyTests.tpl.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\nstatic NSDate *date(int i) {\n    return [NSDate dateWithTimeIntervalSince1970:i];\n}\nstatic NSData *data(int i) {\n    return [NSData dataWithBytesNoCopy:calloc(i, 1) length:i freeWhenDone:YES];\n}\nstatic RLMDecimal128 *decimal128(int i) {\n    return [RLMDecimal128 decimalWithNumber:@(i)];\n}\nstatic NSMutableArray *objectIds;\nstatic RLMObjectId *objectId(NSUInteger i) {\n    if (!objectIds) {\n        objectIds = [NSMutableArray new];\n    }\n    while (i >= objectIds.count) {\n        [objectIds addObject:RLMObjectId.objectId];\n    }\n    return objectIds[i];\n}\nstatic NSUUID *uuid(NSString *uuidString) {\n    return [[NSUUID alloc] initWithUUIDString:uuidString];\n}\nstatic void count(NSArray *values, double *sum, NSUInteger *count) {\n    for (id value in values) {\n        if (value != NSNull.null) {\n            ++*count;\n            *sum += [value doubleValue];\n        }\n    }\n}\nstatic double sum(NSArray *values) {\n    double sum = 0;\n    NSUInteger c = 0;\n    count(values, &sum, &c);\n    return sum;\n}\nstatic double average(NSArray *values) {\n    double sum = 0;\n    NSUInteger c = 0;\n    count(values, &sum, &c);\n    return sum / c;\n}\n\n@interface LinkToAllPrimitiveSets : RLMObject\n@property (nonatomic) AllPrimitiveSets *link;\n@end\n@implementation LinkToAllPrimitiveSets\n@end\n\n@interface LinkToAllOptionalPrimitiveSets : RLMObject\n@property (nonatomic) AllOptionalPrimitiveSets *link;\n@end\n@implementation LinkToAllOptionalPrimitiveSets\n@end\n\n@interface PrimitiveSetPropertyTests : RLMTestCase\n@end\n\n@implementation PrimitiveSetPropertyTests {\n    AllPrimitiveSets *unmanaged;\n    AllPrimitiveSets *managed;\n    AllOptionalPrimitiveSets *optUnmanaged;\n    AllOptionalPrimitiveSets *optManaged;\n    RLMRealm *realm;\n    NSArray<RLMSet *> *allSets;\n}\n\n- (void)setUp {\n    unmanaged = [[AllPrimitiveSets alloc] init];\n    optUnmanaged = [[AllOptionalPrimitiveSets alloc] init];\n    realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    managed = [AllPrimitiveSets createInRealm:realm withValue:@[]];\n    optManaged = [AllOptionalPrimitiveSets createInRealm:realm withValue:@[]];\n    allSets = @[\n        $set,\n    ];\n}\n\n- (void)tearDown {\n    if (realm.inWriteTransaction) {\n        [realm cancelWriteTransaction];\n    }\n}\n\n- (void)addObjects {\n    [$set addObjects:$values];\n}\n\n- (void)testCount {\n    uncheckedAssertEqual(unmanaged.intObj.count, 0U);\n    [unmanaged.intObj addObject:@1];\n    uncheckedAssertEqual(unmanaged.intObj.count, 1U);\n}\n\n- (void)testType {\n    uncheckedAssertEqual(unmanaged.boolObj.type, RLMPropertyTypeBool);\n    uncheckedAssertEqual(unmanaged.intObj.type, RLMPropertyTypeInt);\n    uncheckedAssertEqual(unmanaged.floatObj.type, RLMPropertyTypeFloat);\n    uncheckedAssertEqual(unmanaged.doubleObj.type, RLMPropertyTypeDouble);\n    uncheckedAssertEqual(unmanaged.stringObj.type, RLMPropertyTypeString);\n    uncheckedAssertEqual(unmanaged.dataObj.type, RLMPropertyTypeData);\n    uncheckedAssertEqual(unmanaged.dateObj.type, RLMPropertyTypeDate);\n    uncheckedAssertEqual(optUnmanaged.boolObj.type, RLMPropertyTypeBool);\n    uncheckedAssertEqual(optUnmanaged.intObj.type, RLMPropertyTypeInt);\n    uncheckedAssertEqual(optUnmanaged.floatObj.type, RLMPropertyTypeFloat);\n    uncheckedAssertEqual(optUnmanaged.doubleObj.type, RLMPropertyTypeDouble);\n    uncheckedAssertEqual(optUnmanaged.stringObj.type, RLMPropertyTypeString);\n    uncheckedAssertEqual(optUnmanaged.dataObj.type, RLMPropertyTypeData);\n    uncheckedAssertEqual(optUnmanaged.dateObj.type, RLMPropertyTypeDate);\n}\n\n- (void)testOptional {\n    uncheckedAssertFalse(unmanaged.boolObj.optional);\n    uncheckedAssertFalse(unmanaged.intObj.optional);\n    uncheckedAssertFalse(unmanaged.floatObj.optional);\n    uncheckedAssertFalse(unmanaged.doubleObj.optional);\n    uncheckedAssertFalse(unmanaged.stringObj.optional);\n    uncheckedAssertFalse(unmanaged.dataObj.optional);\n    uncheckedAssertFalse(unmanaged.dateObj.optional);\n    uncheckedAssertTrue(optUnmanaged.boolObj.optional);\n    uncheckedAssertTrue(optUnmanaged.intObj.optional);\n    uncheckedAssertTrue(optUnmanaged.floatObj.optional);\n    uncheckedAssertTrue(optUnmanaged.doubleObj.optional);\n    uncheckedAssertTrue(optUnmanaged.stringObj.optional);\n    uncheckedAssertTrue(optUnmanaged.dataObj.optional);\n    uncheckedAssertTrue(optUnmanaged.dateObj.optional);\n}\n\n- (void)testObjectClassName {\n    uncheckedAssertNil(unmanaged.boolObj.objectClassName);\n    uncheckedAssertNil(unmanaged.intObj.objectClassName);\n    uncheckedAssertNil(unmanaged.floatObj.objectClassName);\n    uncheckedAssertNil(unmanaged.doubleObj.objectClassName);\n    uncheckedAssertNil(unmanaged.stringObj.objectClassName);\n    uncheckedAssertNil(unmanaged.dataObj.objectClassName);\n    uncheckedAssertNil(unmanaged.dateObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.boolObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.intObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.floatObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.doubleObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.stringObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.dataObj.objectClassName);\n    uncheckedAssertNil(optUnmanaged.dateObj.objectClassName);\n}\n\n- (void)testRealm {\n    uncheckedAssertNil(unmanaged.boolObj.realm);\n    uncheckedAssertNil(unmanaged.intObj.realm);\n    uncheckedAssertNil(unmanaged.floatObj.realm);\n    uncheckedAssertNil(unmanaged.doubleObj.realm);\n    uncheckedAssertNil(unmanaged.stringObj.realm);\n    uncheckedAssertNil(unmanaged.dataObj.realm);\n    uncheckedAssertNil(unmanaged.dateObj.realm);\n    uncheckedAssertNil(optUnmanaged.boolObj.realm);\n    uncheckedAssertNil(optUnmanaged.intObj.realm);\n    uncheckedAssertNil(optUnmanaged.floatObj.realm);\n    uncheckedAssertNil(optUnmanaged.doubleObj.realm);\n    uncheckedAssertNil(optUnmanaged.stringObj.realm);\n    uncheckedAssertNil(optUnmanaged.dataObj.realm);\n    uncheckedAssertNil(optUnmanaged.dateObj.realm);\n}\n\n- (void)testInvalidated {\n    RLMSet *set;\n    @autoreleasepool {\n        AllPrimitiveSets *obj = [[AllPrimitiveSets alloc] init];\n        set = obj.intObj;\n        uncheckedAssertFalse(set.invalidated);\n    }\n    uncheckedAssertFalse(set.invalidated);\n}\n\n- (void)testDeleteObjectsInRealm {\n    RLMAssertThrowsWithReason([realm deleteObjects:$allSets], @\"Cannot delete objects from RLMSet\");\n}\n\n- (void)testObjectAtIndex {\n    RLMAssertThrowsWithReason([unmanaged.intObj objectAtIndex:0],\n                              @\"Index 0 is out of bounds (must be less than 0).\");\n\n    [unmanaged.intObj addObject:@1];\n    uncheckedAssertEqualObjects([unmanaged.intObj objectAtIndex:0], @1);\n}\n\n- (void)testContainsObject {\n    uncheckedAssertFalse([$set containsObject:$v0]);\n    [$set addObject:$v0];\n    uncheckedAssertTrue([$set containsObject:$v0]);\n}\n\n- (void)testAddObject {\n    %noany RLMAssertThrowsWithReason([$set addObject:$wrong], ^n @\"Invalid value '$wdesc' of type '\" $wtype \"' for expected type '$type'\");\n    %noany %r RLMAssertThrowsWithReason([$set addObject:NSNull.null], ^n @\"Invalid value '<null>' of type 'NSNull' for expected type '$type'\");\n\n    [$set addObject:$v0];\n    uncheckedAssertTrue([$set containsObject:$v0]);\n\n    %o [$set addObject:NSNull.null];\n    %o uncheckedAssertTrue([$set containsObject:NSNull.null]);\n}\n\n- (void)testAddObjects {\n    %noany RLMAssertThrowsWithReason([$set addObjects:@[$wrong]], ^n @\"Invalid value '$wdesc' of type '\" $wtype \"' for expected type '$type'\");\n    %noany %r RLMAssertThrowsWithReason([$set addObjects:@[NSNull.null]], ^n @\"Invalid value '<null>' of type 'NSNull' for expected type '$type'\");\n\n    [self addObjects];\n    uncheckedAssertTrue([$set containsObject:$v0]);\n    uncheckedAssertTrue([$set containsObject:$v1]);\n    %o uncheckedAssertTrue([$set containsObject:$v2]);\n}\n\n- (void)testRemoveObject {\n    [self addObjects];\n    %r uncheckedAssertEqual($set.count, 2U);\n    %o uncheckedAssertEqual($set.count, 3U);\n\n    [$allSets removeObject:$allSets.allObjects[0]];\n    %r uncheckedAssertEqual($set.count, 1U);\n    %o uncheckedAssertEqual($set.count, 2U);\n}\n\n- (void)testIndexOfObjectSorted {\n    %man %r [$set addObjects:@[$v0, $v1, $v0, $v1]];\n    %man %o [$set addObjects:@[$v0, $v1, NSNull.null, $v1, $v0]];\n    // ordering can't be guaranteed in set, so just verify the indexes are between 0 and 1\n    %man %r uncheckedAssertTrue([[$set sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:$v1] == 0U || ^n [[$set sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:$v1] == 1U);\n    %man %r uncheckedAssertTrue([[$set sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:$v0] == 0U || ^n [[$set sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:$v0] == 1U);\n\n    %man %o uncheckedAssertTrue([[$set sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:$v1] == 0U || ^n [[$set sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:$v1] == 1U);\n    %man %o uncheckedAssertTrue([[$set sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:$v0] == 0U || ^n [[$set sortedResultsUsingKeyPath:@\"self\" ascending:NO] indexOfObject:$v0] == 1U);\n}\n\n- (void)testIndexOfObjectDistinct {\n    %man %r [$set addObjects:@[$v0, $v0, $v1]];\n    %man %o [$set addObjects:@[$v0, $v0, NSNull.null, $v1, $v0]];\n    // ordering can't be guaranteed in set, so just verify the indexes are between 0 and 1\n    %man %r uncheckedAssertTrue([[$set distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:$v0] == 0U || ^n [[$set distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:$v0] == 1U);\n    %man %r uncheckedAssertTrue([[$set distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:$v1] == 0U || ^n [[$set distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:$v1] == 1U);\n\n    %man %o uncheckedAssertTrue([[$set distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:$v0] == 0U || ^n [[$set distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:$v0] == 1U);\n    %man %o uncheckedAssertTrue([[$set distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:$v1] == 0U || ^n [[$set distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:$v1] == 1U);\n    %man %o uncheckedAssertTrue([[$set distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 0U || ^n [[$set distinctResultsUsingKeyPaths:@[@\"self\"]] indexOfObject:NSNull.null] == 1U);\n}\n\n- (void)testSort {\n    %unman RLMAssertThrowsWithReason([$set sortedResultsUsingKeyPath:@\"self\" ascending:NO], ^n @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    %unman RLMAssertThrowsWithReason([$set sortedResultsUsingDescriptors:@[]], ^n @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    %man RLMAssertThrowsWithReason([$set sortedResultsUsingKeyPath:@\"not self\" ascending:NO], ^n @\"can only be sorted on 'self'\");\n\n    %man %r [$set addObjects:@[$v0, $v1, $v0]];\n    %man %o [$set addObjects:@[$v0, $v1, NSNull.null, $v1, $v0]];\n\n    %man %r uncheckedAssertEqualObjects([NSSet setWithArray:[[[$set sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], ^n ([NSSet setWithArray:@[$v0, $v1]]));\n    %man %o uncheckedAssertEqualObjects([NSSet setWithArray:[[[$set sortedResultsUsingDescriptors:@[]] valueForKey:@\"self\"] allObjects]], ^n ([NSSet setWithArray:@[$v0, $v1]]));\n\n    %man %r uncheckedAssertEqualObjects([NSSet setWithArray:[[[$set sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], ^n ([NSSet setWithArray:@[$v1, $v0]]));\n    %man %o uncheckedAssertEqualObjects([NSSet setWithArray:[[[$set sortedResultsUsingKeyPath:@\"self\" ascending:NO] valueForKey:@\"self\"] allObjects]], ^n ([NSSet setWithArray:@[$v1, $v0]]));\n\n    %man %r uncheckedAssertEqualObjects([NSSet setWithArray:[[[$set sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], ^n ([NSSet setWithArray:@[$v0, $v1]]));\n    %man %o uncheckedAssertEqualObjects([NSSet setWithArray:[[[$set sortedResultsUsingKeyPath:@\"self\" ascending:YES] valueForKey:@\"self\"] allObjects]], ^n ([NSSet setWithArray:@[NSNull.null, $v1]]));\n}\n\n- (void)testFilter {\n    %unman RLMAssertThrowsWithReason([$set objectsWhere:@\"TRUEPREDICATE\"], ^n @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n    %unman RLMAssertThrowsWithReason([$set objectsWithPredicate:[NSPredicate predicateWithValue:YES]], ^n @\"This method may only be called on RLMSet instances retrieved from an RLMRealm\");\n\n    %man RLMAssertThrowsWithReason([$set objectsWhere:@\"TRUEPREDICATE\"], ^n @\"implemented\");\n    %man RLMAssertThrowsWithReason([$set objectsWithPredicate:[NSPredicate predicateWithValue:YES]], ^n @\"implemented\");\n\n    %man RLMAssertThrowsWithReason([[$set sortedResultsUsingKeyPath:@\"self\" ascending:NO] ^n  objectsWhere:@\"TRUEPREDICATE\"], @\"implemented\");\n    %man RLMAssertThrowsWithReason([[$set sortedResultsUsingKeyPath:@\"self\" ascending:NO] ^n  objectsWithPredicate:[NSPredicate predicateWithValue:YES]], @\"implemented\");\n}\n\n- (void)testNotifications {\n    %unman RLMAssertThrowsWithReason([$set addNotificationBlock:^(__unused id a, __unused id c, __unused id e) { }], ^n @\"Change notifications are only supported on managed collections.\");\n}\n\n- (void)testSetSet {\n    %man %r [$set addObjects:@[$v0, $v1]];\n    %man %o [$set addObjects:@[$v0, $v1, NSNull.null]];\n    %man %r [$set2 addObjects:@[$v3, $v4]];\n    %man %o [$set2 addObjects:@[$v3, $v4, NSNull.null]];\n    [realm commitWriteTransaction];\n\n    %unman %r [$set addObjects:@[$v0, $v1]];\n    %unman %o [$set addObjects:@[$v0, $v1, NSNull.null]];\n    %unman %r [$set2 addObjects:@[$v3, $v4]];\n    %unman %o [$set2 addObjects:@[$v3, $v4, NSNull.null]];\n\n    %unman [$set setSet:$set2];\n\n    [realm beginWriteTransaction];\n    %man [$set setSet:$set2];\n    [realm commitWriteTransaction];\n\n    %unman %r %maxtwovalues uncheckedAssertEqual($set.count, 2U);\n    %unman %r %maxtwovalues uncheckedAssertEqualObjects($set.allObjects, (@[$v0, $v1]));\n    %unman %r %nomaxvalues uncheckedAssertEqual($set.count, 2U);\n    %unman %r %nomaxvalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v0, $v4]]));\n    %unman %o %maxtwovalues uncheckedAssertEqual($set.count, 3U);\n    %unman %o %maxtwovalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v0, $v1, $v2]]));\n    %unman %o %nomaxvalues uncheckedAssertEqual($set.count, 3U);\n    %unman %o %nomaxvalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v0, $v3, $v4]]));\n    %man %r %maxtwovalues uncheckedAssertEqual($set.count, 2U);\n    %man %r %maxtwovalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v0, $v1]]));\n    %man %r %nomaxvalues uncheckedAssertEqual($set.count, 2U);\n    %man %r %nomaxvalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v1, $v4]]));\n    %man %o %maxtwovalues uncheckedAssertEqual($set.count, 3U);\n    %man %o %maxtwovalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v0, $v1, %v2]]));\n    %man %o %nomaxvalues uncheckedAssertEqual($set.count, 3U);\n    %man %o %nomaxvalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v0, $v1, %v3, %v4]]));\n}\n\n- (void)testUnion {\n    %man %r [$set addObjects:@[$v0, $v1]];\n    %man %o [$set addObjects:@[$v0, $v1, NSNull.null]];\n    %man %r [$set2 addObjects:@[$v3, $v4]];\n    %man %o [$set2 addObjects:@[$v3, $v4, NSNull.null]];\n    [realm commitWriteTransaction];\n\n    %unman %r [$set addObjects:@[$v0, $v1]];\n    %unman %o [$set addObjects:@[$v0, $v1, NSNull.null]];\n    %unman %r [$set2 addObjects:@[$v3, $v4]];\n    %unman %o [$set2 addObjects:@[$v3, $v4, NSNull.null]];\n\n    %man XCTAssertThrows([$set unionSet:$set2]);\n    %unman [$set unionSet:$set2];\n\n    [realm beginWriteTransaction];\n    %man [$set unionSet:$set2];\n    [realm commitWriteTransaction];\n\n    %unman %r %maxtwovalues uncheckedAssertEqual($set.count, 2U);\n    %unman %r %maxtwovalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v0, $v1]]));\n    %unman %r %nomaxvalues uncheckedAssertEqual($set.count, 3U);\n    %unman %r %nomaxvalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v0, $v1, $v4]]));\n    %unman %o %maxtwovalues uncheckedAssertEqual($set.count, 3U);\n    %unman %o %maxtwovalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v0, $v1, $v2]]));\n    %unman %o %nomaxvalues uncheckedAssertEqual($set.count, 4U);\n    %unman %o %nomaxvalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v0, $v1, $v3, $v4]]));\n    %man %r %maxtwovalues uncheckedAssertEqual($set.count, 2U);\n    %man %r %maxtwovalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v0, $v1]]));\n    %man %r %nomaxvalues uncheckedAssertEqual($set.count, 3U);\n    %man %r %nomaxvalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v0, $v1, $v4]]));\n    %man %o %maxtwovalues uncheckedAssertEqual($set.count, 3U);\n    %man %o %maxtwovalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v0, $v1, %v2]]));\n    %man %o %nomaxvalues uncheckedAssertEqual($set.count, 4U);\n    %man %o %nomaxvalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v0, $v1, %v3, %v4]]));\n}\n\n- (void)testIntersect {\n    %man %r [$set addObjects:@[$v0, $v1]];\n    %man %o [$set addObjects:@[$v0, $v1, NSNull.null]];\n    %man %r [$set2 addObjects:@[$v3, $v4]];\n    %man %o [$set2 addObjects:@[$v3, $v4, NSNull.null]];\n    [realm commitWriteTransaction];\n\n    %unman %r [$set addObjects:@[$v0, $v1]];\n    %unman %o [$set addObjects:@[$v0, $v1, NSNull.null]];\n    %unman %r [$set2 addObjects:@[$v3, $v4]];\n    %unman %o [$set2 addObjects:@[$v3, $v4, NSNull.null]];\n\n    %man XCTAssertThrows([$set intersectSet:$set2]);\n    %man uncheckedAssertTrue([$set intersectsSet:$set2]);\n    %unman uncheckedAssertTrue([$set intersectsSet:$set2]);\n\n    %unman [$set intersectSet:$set2];\n\n    [realm beginWriteTransaction];\n    %man [$set intersectSet:$set2];\n    [realm commitWriteTransaction];\n\n    %unman %r %maxtwovalues uncheckedAssertEqual($set.count, 2U);\n    %unman %r %maxtwovalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v0, $v1]]));\n    %unman %r %nomaxvalues uncheckedAssertEqual($set.count, 1U);\n    %unman %r %nomaxvalues uncheckedAssertEqualObjects($set.allObjects, (@[$v0]));\n    %unman %o %maxtwovalues uncheckedAssertEqual($set.count, 2U);\n    %unman %o %maxtwovalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v0, $v1]]));\n    %unman %o %nomaxvalues uncheckedAssertEqual($set.count, 1U);\n    %unman %o %nomaxvalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v0]]));\n    %man %r %maxtwovalues uncheckedAssertEqual($set.count, 2U);\n    %man %r %maxtwovalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v0, $v1]]));\n    %man %r %nomaxvalues uncheckedAssertEqual($set.count, 1U);\n    %man %r %nomaxvalues uncheckedAssertEqualObjects($set.allObjects, (@[$v1]));\n    %man %o %maxtwovalues uncheckedAssertEqual($set.count, 2U);\n    %man %o %maxtwovalues uncheckedAssertEqualObjects([NSSet setWithArray:$set.allObjects], ([NSSet setWithArray:@[$v0, $v1]]));\n    %man %o %nomaxvalues uncheckedAssertEqual($set.count, 1U);\n    %man %o %nomaxvalues uncheckedAssertEqualObjects($set.allObjects, (@[$v0]));\n}\n\n- (void)testMinus {\n    %man %r [$set addObjects:@[$v0, $v1]];\n    %man %o [$set addObjects:@[$v0, $v1, NSNull.null]];\n    %man %r [$set2 addObjects:@[$v3, $v4]];\n    %man %o [$set2 addObjects:@[$v3, $v4, NSNull.null]];\n    [realm commitWriteTransaction];\n\n    %unman %r [$set addObjects:@[$v0, $v1]];\n    %unman %o [$set addObjects:@[$v0, $v1, NSNull.null]];\n    %unman %r [$set2 addObjects:@[$v3, $v4]];\n    %unman %o [$set2 addObjects:@[$v3, $v4, NSNull.null]];\n\n    %man XCTAssertThrows([$set minusSet:$set2]);\n\n    %unman [$set minusSet:$set2];\n\n    [realm beginWriteTransaction];\n    %man [$set minusSet:$set2];\n    [realm commitWriteTransaction];\n\n    %unman %r %maxtwovalues uncheckedAssertEqual($set.count, 0U);\n    %unman %r %maxtwovalues uncheckedAssertEqualObjects($set.allObjects, (@[]));\n    %unman %r %nomaxvalues uncheckedAssertEqual($set.count, 1U);\n    %unman %r %nomaxvalues uncheckedAssertEqualObjects($set.allObjects, (@[$v1]));\n    %unman %o %maxtwovalues uncheckedAssertEqual($set.count, 0U);\n    %unman %o %maxtwovalues uncheckedAssertEqualObjects($set.allObjects, (@[]));\n    %unman %o %nomaxvalues uncheckedAssertEqual($set.count, 1U);\n    %unman %o %nomaxvalues uncheckedAssertEqualObjects($set.allObjects, (@[$v1]));\n    %man %r %maxtwovalues uncheckedAssertEqual($set.count, 0U);\n    %man %r %maxtwovalues uncheckedAssertEqualObjects($set.allObjects, (@[]));\n    %man %r %nomaxvalues uncheckedAssertEqual($set.count, 1U);\n    %man %r %nomaxvalues uncheckedAssertEqualObjects($set.allObjects, (@[$v0]));\n    %man %o %maxtwovalues uncheckedAssertEqual($set.count, 0U);\n    %man %o %maxtwovalues uncheckedAssertEqualObjects($set.allObjects, (@[]));\n    %man %o %nomaxvalues uncheckedAssertEqual($set.count, 1U);\n    %man %o %nomaxvalues uncheckedAssertEqualObjects($set.allObjects, (@[$v1]));\n}\n\n- (void)testIsSubsetOfSet {\n    %man %r [$set addObjects:@[$v0, $v1]];\n    %man %o [$set addObjects:@[$v0, $v1, NSNull.null]];\n    %man %r [$set2 addObjects:@[$v0, $v1, $v3, $v4]];\n    %man %o [$set2 addObjects:@[$v0, $v1, $v3, $v4, NSNull.null]];\n    [realm commitWriteTransaction];\n\n    %unman %r [$set addObjects:@[$v0, $v1]];\n    %unman %o [$set addObjects:@[$v0, $v1, NSNull.null]];\n    %unman %r [$set2 addObjects:@[$v0, $v1, $v3, $v4]];\n    %unman %o [$set2 addObjects:@[$v0, $v1, $v3, $v4, NSNull.null]];\n\n    %maxtwovalues %r %man uncheckedAssertTrue([$set2 isSubsetOfSet:$set]);\n    %maxtwovalues %r %unman uncheckedAssertTrue([$set2 isSubsetOfSet:$set]);\n    %maxtwovalues %o %man uncheckedAssertFalse([$set2 isSubsetOfSet:$set]);\n    %maxtwovalues %o %unman uncheckedAssertFalse([$set2 isSubsetOfSet:$set]);\n\n    %maxtwovalues %r %man uncheckedAssertTrue([$set isSubsetOfSet:$set2]);\n    %maxtwovalues %r %unman uncheckedAssertTrue([$set isSubsetOfSet:$set2]);\n    %maxtwovalues %o %man uncheckedAssertTrue([$set isSubsetOfSet:$set2]);\n    %maxtwovalues %o %unman uncheckedAssertTrue([$set isSubsetOfSet:$set2]);\n\n    %nomaxvalues %man uncheckedAssertTrue([$set isSubsetOfSet:$set2]);\n    %nomaxvalues %unman uncheckedAssertTrue([$set isSubsetOfSet:$set2]);\n    %nomaxvalues %man uncheckedAssertFalse([$set2 isSubsetOfSet:$set]);\n    %nomaxvalues %unman uncheckedAssertFalse([$set2 isSubsetOfSet:$set]);\n}\n\n- (void)testMin {\n    %noany %nominmax %unman RLMAssertThrowsWithReason([$set minOfProperty:@\"self\"], ^n @\"minOfProperty: is not supported for $type set\");\n    %noany %nominmax %man RLMAssertThrowsWithReason([$set minOfProperty:@\"self\"], ^n @\"Operation 'min' not supported for $type set '$class.$prop'\");\n\n    %minmax uncheckedAssertNil([$set minOfProperty:@\"self\"]);\n\n    [self addObjects];\n\n    %minmax %unman %r uncheckedAssertEqualObjects([$set minOfProperty:@\"self\"], $v0);\n    %minmax %unman %o uncheckedAssertEqualObjects([$set minOfProperty:@\"self\"], $v1);\n\n    %minmax %man %r uncheckedAssertEqualObjects([$set minOfProperty:@\"self\"], $v0);\n    %minmax %man %o uncheckedAssertEqualObjects([$set minOfProperty:@\"self\"], $v1);\n}\n\n- (void)testMax {\n    %noany %nominmax %unman RLMAssertThrowsWithReason([$set maxOfProperty:@\"self\"], ^n @\"maxOfProperty: is not supported for $type set\");\n    %noany %nominmax %man RLMAssertThrowsWithReason([$set maxOfProperty:@\"self\"], ^n @\"Operation 'max' not supported for $type set '$class.$prop'\");\n\n    %minmax uncheckedAssertNil([$set maxOfProperty:@\"self\"]);\n\n    [self addObjects];\n\n    %minmax %unman %r uncheckedAssertEqualObjects([$set maxOfProperty:@\"self\"], $v1);\n    %minmax %unman %o uncheckedAssertEqualObjects([$set maxOfProperty:@\"self\"], $v2);\n\n    %minmax %man %r uncheckedAssertEqualObjects([$set maxOfProperty:@\"self\"], $v1);\n    %minmax %man %o uncheckedAssertEqualObjects([$set maxOfProperty:@\"self\"], $v2);\n}\n\n- (void)testSum {\n    %noany %nosum %unman RLMAssertThrowsWithReason([$set sumOfProperty:@\"self\"], ^n @\"sumOfProperty: is not supported for $type set\");\n    %noany %nosum %man RLMAssertThrowsWithReason([$set sumOfProperty:@\"self\"], ^n @\"Operation 'sum' not supported for $type set '$class.$prop'\");\n\n    %sum uncheckedAssertEqualObjects([$set sumOfProperty:@\"self\"], @0);\n\n    [self addObjects];\n\n    %sum XCTAssertEqualWithAccuracy([$set sumOfProperty:@\"self\"].doubleValue, sum($values), .001);\n}\n\n- (void)testAverage {\n    %noany %noavg %unman RLMAssertThrowsWithReason([$set averageOfProperty:@\"self\"], ^n @\"averageOfProperty: is not supported for $type set\");\n    %noany %noavg %man RLMAssertThrowsWithReason([$set averageOfProperty:@\"self\"], ^n @\"Operation 'average' not supported for $type set '$class.$prop'\");\n\n    %avg uncheckedAssertNil([$set averageOfProperty:@\"self\"]);\n\n    [self addObjects];\n\n    %avg XCTAssertEqualWithAccuracy([$set averageOfProperty:@\"self\"].doubleValue, average($values), .001);\n}\n\n- (void)testFastEnumeration {\n    for (int i = 0; i < 10; ++i) {\n        [self addObjects];\n    }\n\n    // This is wrapped in a block to work around a compiler bug in Xcode 12.5:\n    // in release builds, reads on `values` will read the wrong local variable,\n    // resulting in a crash when it tries to send a message to some unitialized\n    // stack space. Putting them in separate obj-c blocks prevents this\n    // incorrect optimization.\n    ^{ ^nl NSArray *values = $values; ^nl for (id value in $set) { ^nl uncheckedAssertTrue([[NSSet setWithArray:values] containsObject:value]); ^nl } ^nl }(); ^nl\n}\n\n- (void)testValueForKeySelf {\n    uncheckedAssertEqualObjects([[$allSets valueForKey:@\"self\"] allObjects], @[]);\n\n    [self addObjects];\n\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[$set valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:$values]));\n}\n\n- (void)testValueForKeyNumericAggregates {\n    %minmax uncheckedAssertNil([$set valueForKeyPath:@\"@min.self\"]);\n    %minmax uncheckedAssertNil([$set valueForKeyPath:@\"@max.self\"]);\n    %sum uncheckedAssertEqualObjects([$set valueForKeyPath:@\"@sum.self\"], @0);\n    %avg uncheckedAssertNil([$set valueForKeyPath:@\"@avg.self\"]);\n\n    [self addObjects];\n\n    %minmax %unman %r uncheckedAssertEqualObjects([$set valueForKeyPath:@\"@min.self\"], $v0);\n    %minmax %unman %o uncheckedAssertEqualObjects([$set valueForKeyPath:@\"@max.self\"], $v2);\n\n    %minmax %man %r uncheckedAssertEqualObjects([$set valueForKeyPath:@\"@min.self\"], $v0);\n    %minmax %man %o uncheckedAssertEqualObjects([$set valueForKeyPath:@\"@max.self\"], $v2);\n\n    %sum XCTAssertEqualWithAccuracy([[$set valueForKeyPath:@\"@sum.self\"] doubleValue], sum($values), .001);\n    %avg XCTAssertEqualWithAccuracy([[$set valueForKeyPath:@\"@avg.self\"] doubleValue], average($values), .001);\n}\n\n- (void)testValueForKeyLength {\n    uncheckedAssertEqualObjects([[$allSets valueForKey:@\"length\"] allObjects], @[]);\n\n    [self addObjects];\n    %string uncheckedAssertEqualObjects([$set valueForKey:@\"length\"], ([[NSSet setWithArray:$values] valueForKey:@\"length\"]));\n}\n\n- (void)testSetValueForKey {\n    RLMAssertThrowsWithReason([$allSets setValue:@0 forKey:@\"not self\"], ^n @\"this class is not key value coding-compliant for the key not self.\");\n    %noany RLMAssertThrowsWithReason([$set setValue:$wrong forKey:@\"self\"], ^n @\"Invalid value '$wdesc' of type '\" $wtype \"' for expected type '$type'\");\n    %noany %r RLMAssertThrowsWithReason([$set setValue:NSNull.null forKey:@\"self\"], ^n @\"Invalid value '<null>' of type 'NSNull' for expected type '$type'\");\n\n    [self addObjects];\n\n    // setValue overrides all existing values\n    [$set setValue:$v0 forKey:@\"self\"];\n\n    RLMAssertThrowsWithReason($set.allObjects[1], @\"index 1 beyond bounds [0 .. 0]\");\n\n    uncheckedAssertEqualObjects($set.allObjects[0], $v0);\n    %o uncheckedAssertEqualObjects($set.allObjects[0], $v0);\n\n    %o [$set setValue:NSNull.null forKey:@\"self\"];\n    %o uncheckedAssertEqualObjects($set.allObjects[0], NSNull.null);\n}\n\n- (void)testAssignment {\n    $set = (id)@[$v1]; ^nl uncheckedAssertEqualObjects($set.allObjects[0], $v1);\n\n    // Should replace and not append\n    $set = (id)$values; ^nl uncheckedAssertEqualObjects([NSSet setWithArray:[[$set valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:$values])); ^nl\n\n    // Should not clear the set\n    $set = $set; ^nl uncheckedAssertEqualObjects([NSSet setWithArray:[[$set valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:$values])); ^nl\n\n    [unmanaged.intObj removeAllObjects];\n    unmanaged.intObj = managed.intObj;\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged.intObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]]));\n\n    [managed.intObj removeAllObjects];\n    managed.intObj = unmanaged.intObj;\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed.intObj valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]]));\n}\n\n- (void)testDynamicAssignment {\n    $obj[@\"$prop\"] = (id)@[$v1]; ^nl uncheckedAssertEqualObjects(((RLMSet *)$obj[@\"$prop\"]).allObjects[0], $v1);\n\n    // Should replace and not append\n    $obj[@\"$prop\"] = (id)$values; ^nl uncheckedAssertEqualObjects([NSSet setWithArray:[[$obj[@\"$prop\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:$values])); ^nl\n\n    // Should not clear the set\n    $obj[@\"$prop\"] = $obj[@\"$prop\"]; ^nl uncheckedAssertEqualObjects([NSSet setWithArray:[[$obj[@\"$prop\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:$values])); ^nl\n\n    [unmanaged[@\"intObj\"] removeAllObjects];\n    unmanaged[@\"intObj\"] = managed.intObj;\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[unmanaged[@\"intObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]]));\n\n    [managed[@\"intObj\"] removeAllObjects];\n    managed[@\"intObj\"] = unmanaged.intObj;\n    uncheckedAssertEqualObjects([NSSet setWithArray:[[managed[@\"intObj\"] valueForKey:@\"self\"] allObjects]], ([NSSet setWithArray:@[@2, @3]]));\n}\n\n- (void)testInvalidAssignment {\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)@[NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for 'int' set property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)@[@\"a\"],\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' set property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)(@[@1, @\"a\"]),\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' set property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)unmanaged.floatObj,\n                              @\"RLMSet<float> does not match expected type 'int' for property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged.intObj = (id)optUnmanaged.intObj,\n                              @\"RLMSet<int?> does not match expected type 'int' for property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged[@\"intObj\"] = unmanaged[@\"floatObj\"],\n                              @\"RLMSet<float> does not match expected type 'int' for property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(unmanaged[@\"intObj\"] = optUnmanaged[@\"intObj\"],\n                              @\"RLMSet<int?> does not match expected type 'int' for property 'AllPrimitiveSets.intObj'.\");\n\n    RLMAssertThrowsWithReason(managed.intObj = (id)@[NSNull.null],\n                              @\"Invalid value '<null>' of type 'NSNull' for 'int' set property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)@[@\"a\"],\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' set property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)(@[@1, @\"a\"]),\n                              @\"Invalid value 'a' of type '__NSCFConstantString' for 'int' set property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)managed.floatObj,\n                              @\"RLMSet<float> does not match expected type 'int' for property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(managed.intObj = (id)optManaged.intObj,\n                              @\"RLMSet<int?> does not match expected type 'int' for property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(managed[@\"intObj\"] = (id)managed[@\"floatObj\"],\n                              @\"RLMSet<float> does not match expected type 'int' for property 'AllPrimitiveSets.intObj'.\");\n    RLMAssertThrowsWithReason(managed[@\"intObj\"] = (id)optManaged[@\"intObj\"],\n                              @\"RLMSet<int?> does not match expected type 'int' for property 'AllPrimitiveSets.intObj'.\");\n}\n\n- (void)testAllMethodsCheckThread {\n    RLMSet *set = managed.intObj;\n    [self dispatchAsyncAndWait:^{\n        RLMAssertThrowsWithReason([set count], @\"thread\");\n\n        RLMAssertThrowsWithReason([set addObject:@0], @\"thread\");\n        RLMAssertThrowsWithReason([set addObjects:@[@0]], @\"thread\");\n        RLMAssertThrowsWithReason([set removeAllObjects], @\"thread\");\n        RLMAssertThrowsWithReason([set sortedResultsUsingKeyPath:@\"self\" ascending:YES], @\"thread\");\n        RLMAssertThrowsWithReason([set sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"self\" ascending:YES]]], @\"thread\");\n        RLMAssertThrowsWithReason(set.allObjects[0], @\"thread\");\n        RLMAssertThrowsWithReason([set valueForKey:@\"self\"], @\"thread\");\n        RLMAssertThrowsWithReason([set setValue:@1 forKey:@\"self\"], @\"thread\");\n        RLMAssertThrowsWithReason(({for (__unused id obj in set);}), @\"thread\");\n    }];\n}\n\n- (void)testAllMethodsCheckForInvalidation {\n    RLMSet *set = managed.intObj;\n    [realm cancelWriteTransaction];\n    [realm invalidate];\n\n    XCTAssertNoThrow([set objectClassName]);\n    XCTAssertNoThrow([set realm]);\n    XCTAssertNoThrow([set isInvalidated]);\n\n    RLMAssertThrowsWithReason([set count], @\"invalidated\");\n\n    RLMAssertThrowsWithReason([set addObject:@0], @\"invalidated\");\n    RLMAssertThrowsWithReason([set addObjects:@[@0]], @\"invalidated\");\n    RLMAssertThrowsWithReason([set removeAllObjects], @\"invalidated\");\n\n    RLMAssertThrowsWithReason([set sortedResultsUsingKeyPath:@\"self\" ascending:YES], @\"invalidated\");\n    RLMAssertThrowsWithReason([set sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"self\" ascending:YES]]], @\"invalidated\");\n    RLMAssertThrowsWithReason(set.allObjects[0], @\"invalidated\");\n    RLMAssertThrowsWithReason([set valueForKey:@\"self\"], @\"invalidated\");\n    RLMAssertThrowsWithReason([set setValue:@1 forKey:@\"self\"], @\"invalidated\");\n    RLMAssertThrowsWithReason(({for (__unused id obj in set);}), @\"invalidated\");\n\n    [realm beginWriteTransaction];\n}\n\n- (void)testMutatingMethodsCheckForWriteTransaction {\n    RLMSet *set = managed.intObj;\n    [set addObject:@0];\n    [realm commitWriteTransaction];\n\n    XCTAssertNoThrow([set objectClassName]);\n    XCTAssertNoThrow([set realm]);\n    XCTAssertNoThrow([set isInvalidated]);\n\n    XCTAssertNoThrow([set count]);\n    XCTAssertNoThrow([set sortedResultsUsingKeyPath:@\"self\" ascending:YES]);\n    XCTAssertNoThrow([set sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"self\" ascending:YES]]]);\n    XCTAssertNoThrow(set.allObjects[0]);\n    XCTAssertNoThrow([set valueForKey:@\"self\"]);\n    XCTAssertNoThrow(({for (__unused id obj in set);}));\n\n\n    RLMAssertThrowsWithReason([set addObject:@0], @\"write transaction\");\n    RLMAssertThrowsWithReason([set addObjects:@[@0]], @\"write transaction\");\n    RLMAssertThrowsWithReason([set removeAllObjects], @\"write transaction\");\n\n    RLMAssertThrowsWithReason([set setValue:@1 forKey:@\"self\"], @\"write transaction\");\n}\n\n- (void)testDeleteOwningObject {\n    RLMSet *set = managed.intObj;\n    uncheckedAssertFalse(set.isInvalidated);\n    [realm deleteObject:managed];\n    uncheckedAssertTrue(set.isInvalidated);\n}\n\n#pragma mark - Queries\n\n#define RLMAssertCount(cls, expectedCount, ...) \\\n    uncheckedAssertEqual(expectedCount, ([cls objectsInRealm:realm where:__VA_ARGS__].count))\n\n- (void)createObjectWithValueIndex:(NSUInteger)index {\n    NSRange range = {index, 1};\n    id obj = [AllPrimitiveSets createInRealm:realm withValue:@{\n        %r %man @\"$prop\": [$values subarrayWithRange:range],\n    }];\n    [LinkToAllPrimitiveSets createInRealm:realm withValue:@[obj]];\n    obj = [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        %o %man @\"$prop\": [$values subarrayWithRange:range],\n    }];\n    [LinkToAllOptionalPrimitiveSets createInRealm:realm withValue:@[obj]];\n}\n\n- (void)testQueryBasicOperators {\n    [realm deleteAllObjects];\n\n    %man RLMAssertCount($class, 0, @\"ANY $prop = %@\", $v0);\n    %man RLMAssertCount($class, 0, @\"ANY $prop != %@\", $v0);\n    %man %comp RLMAssertCount($class, 0, @\"ANY $prop > %@\", $v0);\n    %man %comp RLMAssertCount($class, 0, @\"ANY $prop >= %@\", $v0);\n    %man %comp RLMAssertCount($class, 0, @\"ANY $prop < %@\", $v0);\n    %man %comp RLMAssertCount($class, 0, @\"ANY $prop <= %@\", $v0);\n\n    [self createObjectWithValueIndex:0];\n\n    %man RLMAssertCount($class, 0, @\"ANY $prop = %@\", $v1);\n    %man RLMAssertCount($class, 1, @\"ANY $prop = %@\", $v0);\n    %man RLMAssertCount($class, 0, @\"ANY $prop != %@\", $v0);\n    %man RLMAssertCount($class, 1, @\"ANY $prop != %@\", $v1);\n    %man %comp RLMAssertCount($class, 0, @\"ANY $prop > %@\", $v0);\n    %man %comp RLMAssertCount($class, 1, @\"ANY $prop >= %@\", $v0);\n    %man %comp RLMAssertCount($class, 0, @\"ANY $prop < %@\", $v0);\n    %r %man %comp RLMAssertCount($class, 1, @\"ANY $prop < %@\", $v1);\n    %o %man %comp RLMAssertCount($class, 0, @\"ANY $prop < %@\", $v1);\n    %man %comp RLMAssertCount($class, 1, @\"ANY $prop <= %@\", $v0);\n\n    [self createObjectWithValueIndex:1];\n\n    %man RLMAssertCount($class, 1, @\"ANY $prop = %@\", $v0);\n    %man RLMAssertCount($class, 1, @\"ANY $prop = %@\", $v1);\n    %man RLMAssertCount($class, 1, @\"ANY $prop != %@\", $v0);\n    %man RLMAssertCount($class, 1, @\"ANY $prop != %@\", $v1);\n    %r %man %comp RLMAssertCount($class, 1, @\"ANY $prop > %@\", $v0);\n    %r %man %comp RLMAssertCount($class, 2, @\"ANY $prop >= %@\", $v0);\n    %r %man %comp RLMAssertCount($class, 0, @\"ANY $prop < %@\", $v0);\n    %r %man %comp RLMAssertCount($class, 1, @\"ANY $prop < %@\", $v1);\n    %r %man %comp RLMAssertCount($class, 1, @\"ANY $prop <= %@\", $v0);\n    %r %man %comp RLMAssertCount($class, 2, @\"ANY $prop <= %@\", $v1);\n\n    %o %man %comp RLMAssertCount($class, 0, @\"ANY $prop > %@\", $v0);\n    %o %man %comp RLMAssertCount($class, 1, @\"ANY $prop >= %@\", $v1);\n    %o %man %comp RLMAssertCount($class, 0, @\"ANY $prop < %@\", $v1);\n    %o %man %comp RLMAssertCount($class, 1, @\"ANY $prop < %@\", $v2);\n    %o %man %comp RLMAssertCount($class, 1, @\"ANY $prop <= %@\", $v0);\n    %o %man %comp RLMAssertCount($class, 1, @\"ANY $prop <= %@\", $v1);\n\n    %noany %man %nocomp RLMAssertThrows(([$class objectsInRealm:realm where:@\"ANY $prop > %@\", $v0]));\n}\n\n- (void)testQueryBetween {\n    [realm deleteAllObjects];\n\n    %noany %man %nominmax RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"ANY $prop BETWEEN %@\", @[$v0, $v1]]), ^n @\"Operator 'BETWEEN' not supported for type '$basetype'\");\n\n    %man %minmax RLMAssertCount($class, 0, @\"ANY $prop BETWEEN %@\", @[$v0, $v1]);\n\n    [self createObjectWithValueIndex:1];\n\n    %r %man %minmax RLMAssertCount($class, 1, @\"ANY $prop BETWEEN %@\", @[$v1, $v1]);\n    %r %man %minmax RLMAssertCount($class, 1, @\"ANY $prop BETWEEN %@\", @[$v0, $v1]);\n    %r %man %minmax RLMAssertCount($class, 0, @\"ANY $prop BETWEEN %@\", @[$v0, $v0]);\n\n    %o %man %minmax RLMAssertCount($class, 1, @\"ANY $prop BETWEEN %@\", @[$v1, $v1]);\n    %o %man %minmax RLMAssertCount($class, 1, @\"ANY $prop BETWEEN %@\", @[$v1, $v2]);\n    %o %man %minmax RLMAssertCount($class, 0, @\"ANY $prop BETWEEN %@\", @[$v3, $v3]);\n}\n\n- (void)testQueryIn {\n    [realm deleteAllObjects];\n\n    %man RLMAssertCount($class, 0, @\"ANY $prop IN %@\", @[$v0, $v1]);\n\n    [self createObjectWithValueIndex:0];\n\n    %man RLMAssertCount($class, 0, @\"ANY $prop IN %@\", @[$v1]);\n    %man RLMAssertCount($class, 1, @\"ANY $prop IN %@\", @[$v0, $v1]);\n}\n\n- (void)testQueryCount {\n    [realm deleteAllObjects];\n\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        %r %man @\"$prop\": @[$v0, $v1],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        %o %man @\"$prop\": @[$v0, $v1],\n    }];\n\n    %man RLMAssertCount($class, 1U, @\"$prop.@count == %@\", @(2));\n    %man RLMAssertCount($class, 0U, @\"$prop.@count != %@\", @(2));\n    %man RLMAssertCount($class, 0, @\"$prop.@count > %@\", @(2));\n    %man RLMAssertCount($class, 1, @\"$prop.@count >= %@\", @(2));\n    %man RLMAssertCount($class, 0, @\"$prop.@count < %@\", @(2));\n    %man RLMAssertCount($class, 1, @\"$prop.@count <= %@\", @(2));\n}\n\n- (void)testQuerySum {\n    [realm deleteAllObjects];\n\n    %noany %nodate %nosum %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@sum = %@\", $v0]), ^n @\"Invalid keypath '$prop.@sum': @sum can only be applied to a collection of numeric values.\");\n    %r %noany %date %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@sum = %@\", $v0]), ^n @\"Cannot sum or average date properties\");\n\n    %noany %sum %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@sum = %@\", $wrong]), ^n @\"@sum on a property of type $basetype cannot be compared with '$wdesc'\");\n    %noany %sum %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@sum.prop = %@\", $wrong]), ^n @\"Invalid keypath '$prop.@sum.prop': @sum on a collection of values must appear at the end of a keypath.\");\n    %noany %sum %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@sum = %@\", NSNull.null]), ^n @\"@sum on a property of type $basetype cannot be compared with '<null>'\");\n\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        %man %r %sum @\"$prop\": @[],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        %man %o %sum @\"$prop\": @[],\n    }];\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        %man %r %sum @\"$prop\": @[$v0],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        %man %o %sum @\"$prop\": @[$v1],\n    }];\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        %man %r %sum @\"$prop\": @[$v0, $v0],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        %man %o %sum @\"$prop\": @[$v1, $v2],\n    }];\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        %man %r %sum @\"$prop\": @[$v1, $v1, $v1],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        %man %o %sum @\"$prop\": @[$v1, $v1, $v1],\n    }];\n\n    %r %sum %man RLMAssertCount($class, 1U, @\"$prop.@sum == %@\", @0);\n    %r %sum %man RLMAssertCount($class, 2U, @\"$prop.@sum == %@\", $v0);\n    %r %sum %man RLMAssertCount($class, 3U, @\"$prop.@sum != %@\", $v1);\n    %r %sum %man RLMAssertCount($class, 3U, @\"$prop.@sum >= %@\", $v0);\n    %r %sum %man RLMAssertCount($class, 1U, @\"$prop.@sum > %@\", $v0);\n    %r %sum %man RLMAssertCount($class, 3U, @\"$prop.@sum < %@\", $v1);\n    %r %sum %man RLMAssertCount($class, 4U, @\"$prop.@sum <= %@\", $v1);\n\n    %o %sum %man RLMAssertCount($class, 1U, @\"$prop.@sum == %@\", @0);\n    %o %sum %man RLMAssertCount($class, 2U, @\"$prop.@sum == %@\", $v1);\n    %o %sum %man RLMAssertCount($class, 2U, @\"$prop.@sum != %@\", $v1);\n    %o %sum %man RLMAssertCount($class, 3U, @\"$prop.@sum >= %@\", $v1);\n    %o %sum %man RLMAssertCount($class, 1U, @\"$prop.@sum > %@\", $v1);\n    %o %sum %man RLMAssertCount($class, 3U, @\"$prop.@sum < %@\", $v2);\n    %o %sum %man RLMAssertCount($class, 3U, @\"$prop.@sum <= %@\", $v1);\n}\n\n- (void)testQueryAverage {\n    [realm deleteAllObjects];\n\n    %noany %nodate %noavg %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@avg = %@\", $v0]), ^n @\"Invalid keypath '$prop.@avg': @avg can only be applied to a collection of numeric values.\");\n    %noany %date %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@avg = %@\", $v0]), ^n @\"Cannot sum or average date properties\");\n    %noany %any %date %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@avg = %@\", $v0]), ^n @\"Cannot sum or average date properties\");\n\n    %noany %avg %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@avg = %@\", $wrong]), ^n @\"@avg on a property of type $basetype cannot be compared with '$wdesc'\");\n    %noany %avg %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@avg.prop = %@\", $wrong]), ^n @\"Invalid keypath '$prop.@avg.prop': @avg on a collection of values must appear at the end of a keypath.\");\n\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        %man %r %avg @\"$prop\": @[],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        %man %o %avg @\"$prop\": @[],\n    }];\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        %man %r %avg @\"$prop\": @[$v1],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        %man %o %avg @\"$prop\": @[$v2],\n    }];\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        %man %r %avg @\"$prop\": @[$v0, $v1],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        %man %o %avg @\"$prop\": @[$v1, $v2],\n    }];\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        %man %r %avg @\"$prop\": @[$v1],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        %man %o %avg @\"$prop\": @[$v2],\n    }];\n\n    %avg %man RLMAssertCount($class, 1U, @\"$prop.@avg == %@\", NSNull.null);\n    %r %avg %man RLMAssertCount($class, 2U, @\"$prop.@avg == %@\", $v1);\n    %o %avg %man RLMAssertCount($class, 2U, @\"$prop.@avg == %@\", $v2);\n    %r %avg %man RLMAssertCount($class, 2U, @\"$prop.@avg != %@\", $v1);\n    %o %avg %man RLMAssertCount($class, 2U, @\"$prop.@avg != %@\", $v2);\n    %r %avg %man RLMAssertCount($class, 2U, @\"$prop.@avg >= %@\", $v1);\n    %o %avg %man RLMAssertCount($class, 2U, @\"$prop.@avg >= %@\", $v2);\n    %r %avg %man RLMAssertCount($class, 3U, @\"$prop.@avg > %@\", $v0);\n    %o %avg %man RLMAssertCount($class, 3U, @\"$prop.@avg > %@\", $v1);\n    %r %avg %man RLMAssertCount($class, 1U, @\"$prop.@avg < %@\", $v1);\n    %o %avg %man RLMAssertCount($class, 1U, @\"$prop.@avg < %@\", $v2);\n    %r %avg %man RLMAssertCount($class, 3U, @\"$prop.@avg <= %@\", $v1);\n    %o %avg %man RLMAssertCount($class, 3U, @\"$prop.@avg <= %@\", $v2);\n}\n\n- (void)testQueryMin {\n    [realm deleteAllObjects];\n\n    %noany %nominmax %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@min = %@\", $v0]), ^n @\"Invalid keypath '$prop.@min': @min can only be applied to a collection of numeric values.\");\n    %noany %minmax %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@min = %@\", $wrong]), ^n @\"@min on a property of type $basetype cannot be compared with '$wdesc'\");\n    %minmax %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@min.prop = %@\", $wrong]), ^n @\"Invalid keypath '$prop.@min.prop': @min on a collection of values must appear at the end of a keypath.\");\n\n    // No objects, so count is zero\n    %minmax %man RLMAssertCount($class, 0U, @\"$prop.@min == %@\", $v0);\n\n    [AllPrimitiveSets createInRealm:realm withValue:@{}];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{}];\n\n    // Only empty arrays, so count is zero\n    %r %minmax %man RLMAssertCount($class, 0U, @\"$prop.@min == %@\", $v0);\n    %r %minmax %man RLMAssertCount($class, 0U, @\"$prop.@min == %@\", $v1);\n\n    %o %minmax %man RLMAssertCount($class, 0U, @\"$prop.@min == %@\", $v1);\n    %o %minmax %man RLMAssertCount($class, 0U, @\"$prop.@min == %@\", $v2);\n\n    [self createObjectWithValueIndex:1];\n\n    %r %minmax %man RLMAssertCount($class, 1U, @\"$prop.@min == %@\", $v1);\n    %o %minmax %man RLMAssertCount($class, 1U, @\"$prop.@min == %@\", $v1);\n\n    %r %minmax %man RLMAssertCount($class, 0U, @\"$prop.@min == %@\", $v0);\n    %o %minmax %man RLMAssertCount($class, 0U, @\"$prop.@min == %@\", $v2);\n\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        %minmax %r %man @\"$prop\": @[$v1, $v0],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        %minmax %o %man @\"$prop\": @[$v2, $v1],\n    }];\n\n    %r %minmax %man RLMAssertCount($class, 1U, @\"$prop.@min == %@\", $v0);\n    %o %minmax %man RLMAssertCount($class, 2U, @\"$prop.@min == %@\", $v1);\n\n    %r %minmax %man RLMAssertCount($class, 1U, @\"$prop.@min == %@\", $v0);\n    %o %minmax %man RLMAssertCount($class, 2U, @\"$prop.@min == %@\", $v1);\n}\n\n- (void)testQueryMax {\n    [realm deleteAllObjects];\n\n    %noany %nominmax %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@max = %@\", $v0]), ^n @\"Invalid keypath '$prop.@max': @max can only be applied to a collection of numeric values.\");\n    %noany %minmax %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@max = %@\", $wrong]), ^n @\"@max on a property of type $basetype cannot be compared with '$wdesc'\");\n    %minmax %man RLMAssertThrowsWithReason(([$class objectsInRealm:realm where:@\"$prop.@max.prop = %@\", $wrong]), ^n @\"Invalid keypath '$prop.@max.prop': @max on a collection of values must appear at the end of a keypath.\");\n\n    // No objects, so count is zero\n    %minmax %man RLMAssertCount($class, 0U, @\"$prop.@max == %@\", $v0);\n\n    [AllPrimitiveSets createInRealm:realm withValue:@{}];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{}];\n\n    // Only empty arrays, so count is zero\n    %r %minmax %man RLMAssertCount($class, 0U, @\"$prop.@max == %@\", $v0);\n    %r %minmax %man RLMAssertCount($class, 0U, @\"$prop.@max == %@\", $v1);\n\n    %o %minmax %man RLMAssertCount($class, 0U, @\"$prop.@max == %@\", $v1);\n    %o %minmax %man RLMAssertCount($class, 0U, @\"$prop.@max == %@\", $v2);\n\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@max == nil\");\n    %minmax %man RLMAssertCount($class, 1U, @\"$prop.@max == %@\", NSNull.null);\n\n    [self createObjectWithValueIndex:1];\n\n    %r %minmax %man RLMAssertCount($class, 1U, @\"$prop.@max == %@\", $v1);\n    %r %minmax %man RLMAssertCount($class, 0U, @\"$prop.@max == %@\", $v0);\n\n    %o %minmax %man RLMAssertCount($class, 1U, @\"$prop.@max == %@\", $v1);\n    %o %minmax %man RLMAssertCount($class, 0U, @\"$prop.@max == %@\", $v2);\n\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        %minmax %r %man @\"$prop\": @[$v0],\n    }];\n\n    [AllPrimitiveSets createInRealm:realm withValue:@{\n        %minmax %r %man @\"$prop\": @[$v1, $v0],\n    }];\n    [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n        %minmax %o %man @\"$prop\": @[$v1, $v0],\n    }];\n\n    %noany %r %minmax %man RLMAssertCount($class, 1U, @\"$prop.@max == %@\", $v0);\n    %noany %r %minmax %man RLMAssertCount($class, 2U, @\"$prop.@max == %@\", $v1);\n\n    %o %minmax %man RLMAssertCount($class, 1U, @\"$prop.@max == %@\", $v0);\n    %o %minmax %man RLMAssertCount($class, 2U, @\"$prop.@max == %@\", $v1);\n\n    %any %minmax %man RLMAssertCount($class, 1U, @\"$prop.@max == %@\", $v0);\n    %any %minmax %man RLMAssertCount($class, 2U, @\"$prop.@max == %@\", $v1);\n}\n\n- (void)testQueryBasicOperatorsOverLink {\n    [realm deleteAllObjects];\n\n    %man RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop = %@\", $v0);\n    %man RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop != %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop > %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop >= %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop < %@\", $v0);\n    %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop <= %@\", $v0);\n\n    [self createObjectWithValueIndex:1];\n\n    %man RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop = %@\", $v1);\n    %man RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop != %@\", $v0);\n    %r %man %comp RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop > %@\", $v0);\n    %o %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop > %@\", $v1);\n\n    %r %man %comp RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop >= %@\", $v0);\n    %o %man %comp RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop >= %@\", $v1);\n\n    %man %comp RLMAssertCount(LinkTo$class, 0, @\"ANY link.$prop < %@\", $v0);\n    %r %man %comp RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop < %@\", $v4);\n    %o %man %comp RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop < %@\", $v2);\n\n    %man %comp RLMAssertCount(LinkTo$class, 1, @\"ANY link.$prop <= %@\", $v1);\n\n    %man %nocomp %noany RLMAssertThrowsWithReason(([LinkTo$class objectsInRealm:realm where:@\"ANY link.$prop > %@\", $v0]), ^n @\"Operator '>' not supported for type '$basetype'\");\n}\n\n- (void)testSubstringQueries {\n    NSArray *values = @[\n        @\"\",\n\n        @\"á\", @\"ó\", @\"ú\",\n\n        @\"áá\", @\"áó\", @\"áú\",\n        @\"óá\", @\"óó\", @\"óú\",\n        @\"úá\", @\"úó\", @\"úú\",\n\n        @\"ááá\", @\"ááó\", @\"ááú\", @\"áóá\", @\"áóó\", @\"áóú\", @\"áúá\", @\"áúó\", @\"áúú\",\n        @\"óáá\", @\"óáó\", @\"óáú\", @\"óóá\", @\"óóó\", @\"óóú\", @\"óúá\", @\"óúó\", @\"óúú\",\n        @\"úáá\", @\"úáó\", @\"úáú\", @\"úóá\", @\"úóó\", @\"úóú\", @\"úúá\", @\"úúó\", @\"úúú\",\n    ];\n\n    void (^create)(NSString *) = ^(NSString *value) {\n        id obj = [AllPrimitiveSets createInRealm:realm withValue:@{\n            @\"stringObj\": @[value],\n            @\"dataObj\": @[[value dataUsingEncoding:NSUTF8StringEncoding]]\n        }];\n        [LinkToAllPrimitiveSets createInRealm:realm withValue:@[obj]];\n        obj = [AllOptionalPrimitiveSets createInRealm:realm withValue:@{\n            @\"stringObj\": @[value],\n            @\"dataObj\": @[[value dataUsingEncoding:NSUTF8StringEncoding]]\n        }];\n        [LinkToAllOptionalPrimitiveSets createInRealm:realm withValue:@[obj]];\n    };\n\n    for (NSString *value in values) {\n        create(value);\n        create(value.uppercaseString);\n        create([value stringByApplyingTransform:NSStringTransformStripDiacritics reverse:NO]);\n        create([value.uppercaseString stringByApplyingTransform:NSStringTransformStripDiacritics reverse:NO]);\n    }\n\n    void (^test)(NSString *, id, NSUInteger) = ^(NSString *operator, NSString *value, NSUInteger count) {\n        NSData *data = [value dataUsingEncoding:NSUTF8StringEncoding];\n\n        NSString *query = [NSString stringWithFormat:@\"ANY stringObj %@ %%@\", operator];\n        %man %string RLMAssertCount($class, count, query, value);\n        query = [NSString stringWithFormat:@\"ANY link.stringObj %@ %%@\", operator];\n        %man %string RLMAssertCount(LinkTo$class, count, query, value);\n\n        query = [NSString stringWithFormat:@\"ANY dataObj %@ %%@\", operator];\n        %man %string RLMAssertCount($class, count, query, data);\n        query = [NSString stringWithFormat:@\"ANY link.dataObj %@ %%@\", operator];\n        %man %string RLMAssertCount(LinkTo$class, count, query, data);\n    };\n    void (^testNull)(NSString *, NSUInteger) = ^(NSString *operator, NSUInteger count) {\n        NSString *query = [NSString stringWithFormat:@\"ANY stringObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([AllPrimitiveSets objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'stringObj' of type 'string'\");\n        RLMAssertCount(AllOptionalPrimitiveSets, count, query, NSNull.null);\n        query = [NSString stringWithFormat:@\"ANY link.stringObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([LinkToAllPrimitiveSets objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'stringObj' of type 'string'\");\n        RLMAssertCount(LinkToAllOptionalPrimitiveSets, count, query, NSNull.null);\n\n        query = [NSString stringWithFormat:@\"ANY dataObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([AllPrimitiveSets objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'dataObj' of type 'data'\");\n        RLMAssertCount(AllOptionalPrimitiveSets, count, query, NSNull.null);\n\n        query = [NSString stringWithFormat:@\"ANY link.dataObj %@ nil\", operator];\n        RLMAssertThrowsWithReason([LinkToAllPrimitiveSets objectsInRealm:realm where:query],\n                                  @\"Cannot compare value '(null)' of type '(null)' to property 'dataObj' of type 'data'\");\n        RLMAssertCount(LinkToAllOptionalPrimitiveSets, count, query, NSNull.null);\n    };\n\n    testNull(@\"==\", 0);\n    test(@\"==\", @\"\", 4);\n    test(@\"==\", @\"a\", 1);\n    test(@\"==\", @\"á\", 1);\n    test(@\"==[c]\", @\"a\", 2);\n    test(@\"==[c]\", @\"á\", 2);\n    test(@\"==\", @\"A\", 1);\n    test(@\"==\", @\"Á\", 1);\n    test(@\"==[c]\", @\"A\", 2);\n    test(@\"==[c]\", @\"Á\", 2);\n    test(@\"==[d]\", @\"a\", 2);\n    test(@\"==[d]\", @\"á\", 2);\n    test(@\"==[cd]\", @\"a\", 4);\n    test(@\"==[cd]\", @\"á\", 4);\n    test(@\"==[d]\", @\"A\", 2);\n    test(@\"==[d]\", @\"Á\", 2);\n    test(@\"==[cd]\", @\"A\", 4);\n    test(@\"==[cd]\", @\"Á\", 4);\n\n    testNull(@\"!=\", 160);\n    test(@\"!=\", @\"\", 156);\n    test(@\"!=\", @\"a\", 159);\n    test(@\"!=\", @\"á\", 159);\n    test(@\"!=[c]\", @\"a\", 158);\n    test(@\"!=[c]\", @\"á\", 158);\n    test(@\"!=\", @\"A\", 159);\n    test(@\"!=\", @\"Á\", 159);\n    test(@\"!=[c]\", @\"A\", 158);\n    test(@\"!=[c]\", @\"Á\", 158);\n    test(@\"!=[d]\", @\"a\", 158);\n    test(@\"!=[d]\", @\"á\", 158);\n    test(@\"!=[cd]\", @\"a\", 156);\n    test(@\"!=[cd]\", @\"á\", 156);\n    test(@\"!=[d]\", @\"A\", 158);\n    test(@\"!=[d]\", @\"Á\", 158);\n    test(@\"!=[cd]\", @\"A\", 156);\n    test(@\"!=[cd]\", @\"Á\", 156);\n\n    testNull(@\"CONTAINS\", 0);\n    testNull(@\"CONTAINS[c]\", 0);\n    testNull(@\"CONTAINS[d]\", 0);\n    testNull(@\"CONTAINS[cd]\", 0);\n    test(@\"CONTAINS\", @\"a\", 25);\n    test(@\"CONTAINS\", @\"á\", 25);\n    test(@\"CONTAINS[c]\", @\"a\", 50);\n    test(@\"CONTAINS[c]\", @\"á\", 50);\n    test(@\"CONTAINS\", @\"A\", 25);\n    test(@\"CONTAINS\", @\"Á\", 25);\n    test(@\"CONTAINS[c]\", @\"A\", 50);\n    test(@\"CONTAINS[c]\", @\"Á\", 50);\n    test(@\"CONTAINS[d]\", @\"a\", 50);\n    test(@\"CONTAINS[d]\", @\"á\", 50);\n    test(@\"CONTAINS[cd]\", @\"a\", 100);\n    test(@\"CONTAINS[cd]\", @\"á\", 100);\n    test(@\"CONTAINS[d]\", @\"A\", 50);\n    test(@\"CONTAINS[d]\", @\"Á\", 50);\n    test(@\"CONTAINS[cd]\", @\"A\", 100);\n    test(@\"CONTAINS[cd]\", @\"Á\", 100);\n\n    test(@\"BEGINSWITH\", @\"a\", 13);\n    test(@\"BEGINSWITH\", @\"á\", 13);\n    test(@\"BEGINSWITH[c]\", @\"a\", 26);\n    test(@\"BEGINSWITH[c]\", @\"á\", 26);\n    test(@\"BEGINSWITH\", @\"A\", 13);\n    test(@\"BEGINSWITH\", @\"Á\", 13);\n    test(@\"BEGINSWITH[c]\", @\"A\", 26);\n    test(@\"BEGINSWITH[c]\", @\"Á\", 26);\n    test(@\"BEGINSWITH[d]\", @\"a\", 26);\n    test(@\"BEGINSWITH[d]\", @\"á\", 26);\n    test(@\"BEGINSWITH[cd]\", @\"a\", 52);\n    test(@\"BEGINSWITH[cd]\", @\"á\", 52);\n    test(@\"BEGINSWITH[d]\", @\"A\", 26);\n    test(@\"BEGINSWITH[d]\", @\"Á\", 26);\n    test(@\"BEGINSWITH[cd]\", @\"A\", 52);\n    test(@\"BEGINSWITH[cd]\", @\"Á\", 52);\n\n    test(@\"ENDSWITH\", @\"a\", 13);\n    test(@\"ENDSWITH\", @\"á\", 13);\n    test(@\"ENDSWITH[c]\", @\"a\", 26);\n    test(@\"ENDSWITH[c]\", @\"á\", 26);\n    test(@\"ENDSWITH\", @\"A\", 13);\n    test(@\"ENDSWITH\", @\"Á\", 13);\n    test(@\"ENDSWITH[c]\", @\"A\", 26);\n    test(@\"ENDSWITH[c]\", @\"Á\", 26);\n    test(@\"ENDSWITH[d]\", @\"a\", 26);\n    test(@\"ENDSWITH[d]\", @\"á\", 26);\n    test(@\"ENDSWITH[cd]\", @\"a\", 52);\n    test(@\"ENDSWITH[cd]\", @\"á\", 52);\n    test(@\"ENDSWITH[d]\", @\"A\", 26);\n    test(@\"ENDSWITH[d]\", @\"Á\", 26);\n    test(@\"ENDSWITH[cd]\", @\"A\", 52);\n    test(@\"ENDSWITH[cd]\", @\"Á\", 52);\n}\n\n\n#pragma clang diagnostic ignored \"-Warc-retain-cycles\"\n\n- (void)testNotificationSentInitially {\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMSet *set, RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(set);\n        uncheckedAssertNil(change);\n        uncheckedAssertNil(error);\n        [expectation fulfill];\n    }];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationSentAfterCommit {\n    [realm commitWriteTransaction];\n\n    __block bool first = true;\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMSet *set, RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(set);\n        uncheckedAssertNil(error);\n        if (first) {\n            uncheckedAssertNil(change);\n        }\n        else {\n            uncheckedAssertEqualObjects(change.insertions, @[@0]);\n        }\n\n        first = false;\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *r = [RLMRealm defaultRealm];\n        [r transactionWithBlock:^{\n            RLMSet *set = [(AllPrimitiveSets *)[AllPrimitiveSets allObjectsInRealm:r].firstObject intObj];\n            [set addObject:@0];\n        }];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationNotSentForUnrelatedChange {\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(__unused RLMSet *set, __unused RLMCollectionChange *change, __unused NSError *error) {\n        // will throw if it's incorrectly called a second time due to the\n        // unrelated write transaction\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmDidChangeNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *r = [RLMRealm defaultRealm];\n            [r transactionWithBlock:^{\n                [AllPrimitiveSets createInRealm:r withValue:@[]];\n            }];\n        }];\n    }];\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationSentOnlyForActualRefresh {\n    [realm commitWriteTransaction];\n\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMSet *set, __unused RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(set);\n        uncheckedAssertNil(error);\n        // will throw if it's called a second time before we create the new\n        // expectation object immediately before manually refreshing\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // Turn off autorefresh, so the background commit should not result in a notification\n    realm.autorefresh = NO;\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmRefreshRequiredNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *r = [RLMRealm defaultRealm];\n            [r transactionWithBlock:^{\n                RLMSet *set = [(AllPrimitiveSets *)[AllPrimitiveSets allObjectsInRealm:r].firstObject intObj];\n                [set addObject:@0];\n            }];\n        }];\n    }];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [realm refresh];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testDeletingObjectWithNotificationsRegistered {\n    [managed.intObj addObjects:@[@10, @20]];\n    [realm commitWriteTransaction];\n\n    __block bool first = true;\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [managed.intObj addNotificationBlock:^(RLMSet *set, RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(set);\n        uncheckedAssertNil(error);\n        if (first) {\n            uncheckedAssertNil(change);\n            first = false;\n        }\n        else {\n            uncheckedAssertEqualObjects(change.deletions, (@[@0, @1]));\n        }\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [realm beginWriteTransaction];\n    [realm deleteObject:managed];\n    [realm commitWriteTransaction];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/PropertyTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#import \"RLMObjectSchema_Private.h\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMRealm_Dynamic.h\"\n\n#import <objc/runtime.h>\n\n@interface PropertyTests : RLMTestCase\n@end\n\n@implementation PropertyTests\n\n- (void)testDescription {\n    AllTypesObject *object = [[AllTypesObject alloc] init];\n    RLMProperty *property = object.objectSchema[@\"objectCol\"];\n\n    XCTAssertEqualObjects(property.description, @\"objectCol {\\n\"\n                                                @\"\\ttype = object;\\n\"\n                                                @\"\\tobjectClassName = StringObject;\\n\"\n                                                @\"\\tlinkOriginPropertyName = (null);\\n\"\n                                                @\"\\tcolumnName = objectCol;\\n\"\n                                                @\"\\tindexed = NO;\\n\"\n                                                @\"\\tisPrimary = NO;\\n\"\n                                                @\"\\tarray = NO;\\n\"\n                                                @\"\\tset = NO;\\n\"\n                                                @\"\\tdictionary = NO;\\n\"\n                                                @\"\\toptional = YES;\\n\"\n                                                @\"}\");\n}\n\nstatic RLMProperty *makeProperty(NSString *name, RLMPropertyType type, NSString *objectClassName, BOOL optional) {\n    return [[RLMProperty alloc] initWithName:name type:type objectClassName:objectClassName\n                      linkOriginPropertyName:nil indexed:NO optional:optional];\n}\n\n- (void)testEqualityFromObjectSchema {\n    { // Test non-optional property types\n        RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:[AllTypesObject class]];\n        NSDictionary *expectedProperties = @{\n            @\"boolCol\":     makeProperty(@\"boolCol\", RLMPropertyTypeBool, nil, NO),\n            @\"intCol\":      makeProperty(@\"intCol\", RLMPropertyTypeInt, nil, NO),\n            @\"floatCol\":    makeProperty(@\"floatCol\", RLMPropertyTypeFloat, nil, NO),\n            @\"doubleCol\":   makeProperty(@\"doubleCol\", RLMPropertyTypeDouble, nil, NO),\n            @\"stringCol\":   makeProperty(@\"stringCol\", RLMPropertyTypeString, nil, NO),\n            @\"binaryCol\":   makeProperty(@\"binaryCol\", RLMPropertyTypeData, nil, NO),\n            @\"dateCol\":     makeProperty(@\"dateCol\", RLMPropertyTypeDate, nil, NO),\n            @\"cBoolCol\":    makeProperty(@\"cBoolCol\", RLMPropertyTypeBool, nil, NO),\n            @\"longCol\":     makeProperty(@\"longCol\", RLMPropertyTypeInt, nil, NO),\n            @\"objectIdCol\": makeProperty(@\"objectIdCol\", RLMPropertyTypeObjectId, nil, NO),\n            @\"decimalCol\":  makeProperty(@\"decimalCol\", RLMPropertyTypeDecimal128, nil, NO),\n            @\"objectCol\":   makeProperty(@\"objectCol\", RLMPropertyTypeObject, @\"StringObject\", YES),\n            @\"uuidCol\":     makeProperty(@\"uuidCol\", RLMPropertyTypeUUID, nil, NO),\n            @\"anyCol\":      makeProperty(@\"anyCol\", RLMPropertyTypeAny, nil, NO),\n            @\"mixedObjectCol\": makeProperty(@\"mixedObjectCol\", RLMPropertyTypeObject, @\"MixedObject\", YES),\n        };\n        XCTAssertEqual(objectSchema.properties.count, expectedProperties.allKeys.count);\n        for (NSString *propertyName in expectedProperties) {\n            XCTAssertEqualObjects(objectSchema[propertyName], expectedProperties[propertyName]);\n        }\n    }\n    { // Test optional property types\n        RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:[AllOptionalTypes class]];\n        NSDictionary *expectedProperties = @{\n            @\"intObj\":    makeProperty(@\"intObj\", RLMPropertyTypeInt, nil, YES),\n            @\"floatObj\":  makeProperty(@\"floatObj\", RLMPropertyTypeFloat, nil, YES),\n            @\"doubleObj\": makeProperty(@\"doubleObj\", RLMPropertyTypeDouble, nil, YES),\n            @\"boolObj\":   makeProperty(@\"boolObj\", RLMPropertyTypeBool, nil, YES),\n            @\"string\":    makeProperty(@\"string\", RLMPropertyTypeString, nil, YES),\n            @\"data\":      makeProperty(@\"data\", RLMPropertyTypeData, nil, YES),\n            @\"date\":      makeProperty(@\"date\", RLMPropertyTypeDate, nil, YES),\n            @\"objectId\":  makeProperty(@\"objectId\", RLMPropertyTypeObjectId, nil, YES),\n            @\"decimal\":   makeProperty(@\"decimal\", RLMPropertyTypeDecimal128, nil, YES),\n            @\"uuidCol\":   makeProperty(@\"uuidCol\", RLMPropertyTypeUUID, nil, YES),\n        };\n        XCTAssertEqual(objectSchema.properties.count, expectedProperties.allKeys.count);\n        for (NSString *propertyName in expectedProperties) {\n            XCTAssertEqualObjects(objectSchema[propertyName], expectedProperties[propertyName]);\n        }\n    }\n    { // Test indexed property\n        RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:[IndexedStringObject class]];\n        RLMProperty *stringProperty = objectSchema[@\"stringCol\"];\n        RLMProperty *expectedProperty = [[RLMProperty alloc] initWithName:@\"stringCol\" type:RLMPropertyTypeString objectClassName:nil linkOriginPropertyName:nil indexed:YES optional:YES];\n        XCTAssertEqualObjects(stringProperty, expectedProperty);\n    }\n    { // Test primary key property\n        RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:[PrimaryStringObject class]];\n        RLMProperty *stringProperty = objectSchema[@\"stringCol\"];\n        RLMProperty *expectedProperty = [[RLMProperty alloc] initWithName:@\"stringCol\"\n                                                                     type:RLMPropertyTypeString\n                                                          objectClassName:nil\n                                                   linkOriginPropertyName:nil\n                                                                  indexed:YES\n                                                                 optional:NO];\n        expectedProperty.isPrimary = YES;\n        XCTAssertEqualObjects(stringProperty, expectedProperty);\n    }\n}\n\n- (void)testTwoPropertiesAreEqual {\n    const char *name = \"intCol\";\n    objc_property_t objcProperty1 = class_getProperty(AllTypesObject.class, name);\n    RLMProperty *property1 = [[RLMProperty alloc] initWithName:@(name) indexed:YES linkPropertyDescriptor:nil property:objcProperty1];\n\n    objc_property_t objcProperty2 = class_getProperty(IntObject.class, name);\n    RLMProperty *property2 = [[RLMProperty alloc] initWithName:@(name) indexed:YES linkPropertyDescriptor:nil property:objcProperty2];\n\n    XCTAssertEqualObjects(property1, property2);\n}\n\n- (void)testTwoPropertiesAreUnequal {\n    const char *name = \"stringCol\";\n    objc_property_t objcProperty1 = class_getProperty(AllTypesObject.class, name);\n    RLMProperty *property1 = [[RLMProperty alloc] initWithName:@(name) indexed:YES linkPropertyDescriptor:nil property:objcProperty1];\n\n    name = \"intCol\";\n    objc_property_t objcProperty2 = class_getProperty(IntObject.class, name);\n    RLMProperty *property2 = [[RLMProperty alloc] initWithName:@(name) indexed:YES linkPropertyDescriptor:nil property:objcProperty2];\n\n    XCTAssertNotEqualObjects(property1, property2);\n}\n\n- (void)testSwiftPropertyNameValidation {\n    RLMAssertThrows(RLMValidateSwiftPropertyName(@\"alloc\"));\n    RLMAssertThrows(RLMValidateSwiftPropertyName(@\"_alloc\"));\n    RLMAssertThrows(RLMValidateSwiftPropertyName(@\"allocOject\"));\n    RLMAssertThrows(RLMValidateSwiftPropertyName(@\"_allocOject\"));\n    RLMAssertThrows(RLMValidateSwiftPropertyName(@\"alloc_object\"));\n    RLMAssertThrows(RLMValidateSwiftPropertyName(@\"_alloc_object\"));\n    RLMAssertThrows(RLMValidateSwiftPropertyName(@\"new\"));\n    RLMAssertThrows(RLMValidateSwiftPropertyName(@\"copy\"));\n    RLMAssertThrows(RLMValidateSwiftPropertyName(@\"mutableCopy\"));\n\n    // Swift doesn't infer family from `init`\n    XCTAssertNoThrow(RLMValidateSwiftPropertyName(@\"init\"));\n    XCTAssertNoThrow(RLMValidateSwiftPropertyName(@\"_init\"));\n    XCTAssertNoThrow(RLMValidateSwiftPropertyName(@\"initWithValue\"));\n\n    // Lowercase letter after family name\n    XCTAssertNoThrow(RLMValidateSwiftPropertyName(@\"allocate\"));\n\n    XCTAssertNoThrow(RLMValidateSwiftPropertyName(@\"__alloc\"));\n}\n\n- (void)testTypeToString {\n    XCTAssertEqualObjects(RLMTypeToString(RLMPropertyTypeString),   @\"string\");\n    XCTAssertEqualObjects(RLMTypeToString(RLMPropertyTypeInt),      @\"int\");\n    XCTAssertEqualObjects(RLMTypeToString(RLMPropertyTypeBool),     @\"bool\");\n    XCTAssertEqualObjects(RLMTypeToString(RLMPropertyTypeDate),     @\"date\");\n    XCTAssertEqualObjects(RLMTypeToString(RLMPropertyTypeData),     @\"data\");\n    XCTAssertEqualObjects(RLMTypeToString(RLMPropertyTypeDouble),   @\"double\");\n    XCTAssertEqualObjects(RLMTypeToString(RLMPropertyTypeFloat),    @\"float\");\n    XCTAssertEqualObjects(RLMTypeToString(RLMPropertyTypeObject),   @\"object\");\n    XCTAssertEqualObjects(RLMTypeToString(RLMPropertyTypeLinkingObjects), @\"linking objects\");\n\n    XCTAssertEqualObjects(RLMTypeToString((RLMPropertyType)-1),     @\"Unknown\");\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/QueryTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#import \"RLMObjectSchema_Private.h\"\n#import \"RLMRealmConfiguration_Private.h\"\n#import \"RLMRealm_Dynamic.h\"\n#import \"RLMSchema_Private.h\"\n\n#pragma mark - Test Objects\n\n@class LinkChain2, LinkChain3;\n\n@interface LinkChain1 : RLMObject\n@property int value;\n@property LinkChain2 *next;\n@end\n\n@interface LinkChain2 : RLMObject\n@property LinkChain3 *next;\n@property (readonly) RLMLinkingObjects *prev;\n@end\n\n@interface LinkChain3 : RLMObject\n@property (readonly) RLMLinkingObjects *prev;\n@end\n\n@implementation LinkChain1\n@end\n\n@implementation LinkChain2\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{@\"prev\": [RLMPropertyDescriptor descriptorWithClass:LinkChain1.class propertyName:@\"next\"]};\n}\n@end\n\n@implementation LinkChain3\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{@\"prev\": [RLMPropertyDescriptor descriptorWithClass:LinkChain2.class propertyName:@\"next\"]};\n}\n@end\n\n#pragma mark NonRealmEmployeeObject\n\n@interface NonRealmEmployeeObject : NSObject\n@property NSString *name;\n@property NSInteger age;\n@end\n\n@implementation NonRealmEmployeeObject\n@end\n\n@interface PersonLinkObject : RLMObject\n@property PersonObject *person;\n@end\n\n@implementation PersonLinkObject\n@end\n\n#pragma mark QueryObject\n\n@interface QueryObject : RLMObject\n@property (nonatomic, assign) BOOL         bool1;\n@property (nonatomic, assign) BOOL         bool2;\n@property (nonatomic, assign) NSInteger    int1;\n@property (nonatomic, assign) NSInteger    int2;\n@property (nonatomic, assign) float        float1;\n@property (nonatomic, assign) float        float2;\n@property (nonatomic, assign) double       double1;\n@property (nonatomic, assign) double       double2;\n@property (nonatomic, copy) NSString      *string1;\n@property (nonatomic, copy) NSString      *string2;\n@property (nonatomic, copy) NSData        *data1;\n@property (nonatomic, copy) NSData        *data2;\n@property (nonatomic, copy) RLMDecimal128 *decimal1;\n@property (nonatomic, copy) RLMDecimal128 *decimal2;\n@property (nonatomic, copy) RLMObjectId   *objectId1;\n@property (nonatomic, copy) RLMObjectId   *objectId2;\n@property (nonatomic, copy) id<RLMValue>   any1;\n@property (nonatomic, copy) id<RLMValue>   any2;\n@property (nonatomic, copy) QueryObject   *object1;\n@property (nonatomic, copy) QueryObject   *object2;\n@end\n\n@implementation QueryObject\n+ (NSArray *)requiredProperties {\n    return @[@\"string1\", @\"string2\", @\"data1\", @\"data2\", @\"objectId1\", @\"objectId2\", @\"decimal1\", @\"decimal2\"];\n}\n@end\n\n@interface NullQueryObject : RLMObject\n@property (nonatomic, copy) NSNumber<RLMBool>   *bool1;\n@property (nonatomic, copy) NSNumber<RLMBool>   *bool2;\n@property (nonatomic, copy) NSNumber<RLMInt>    *int1;\n@property (nonatomic, copy) NSNumber<RLMInt>    *int2;\n@property (nonatomic, copy) NSNumber<RLMFloat>  *float1;\n@property (nonatomic, copy) NSNumber<RLMFloat>  *float2;\n@property (nonatomic, copy) NSNumber<RLMDouble> *double1;\n@property (nonatomic, copy) NSNumber<RLMDouble> *double2;\n@property (nonatomic, copy) NSString            *string1;\n@property (nonatomic, copy) NSString            *string2;\n@property (nonatomic, copy) NSData              *data1;\n@property (nonatomic, copy) NSData              *data2;\n@property (nonatomic, copy) RLMDecimal128       *decimal1;\n@property (nonatomic, copy) RLMDecimal128       *decimal2;\n@property (nonatomic, copy) RLMObjectId         *objectId1;\n@property (nonatomic, copy) RLMObjectId         *objectId2;\n@property (nonatomic, copy) id<RLMValue>        any1;\n@property (nonatomic, copy) id<RLMValue>        any2;\n@property (nonatomic, copy) NullQueryObject     *object1;\n@property (nonatomic, copy) NullQueryObject     *object2;\n@end\n\n@implementation NullQueryObject\n@end\n\n@interface DictionaryParentObject : RLMObject\n@property (nonatomic, copy) AllDictionariesObject *objectCol;\n@end\n\n@implementation DictionaryParentObject\n@end\n\n#pragma mark - Tests\n\n#define RLMAssertCount(cls, expectedCount, ...) \\\n    XCTAssertEqual(expectedCount, ([self evaluate:[cls objectsWhere:__VA_ARGS__]].count))\n\n@interface QueryConstructionTests : RLMTestCase\n@end\n\n@implementation QueryConstructionTests\n- (RLMResults *)evaluate:(RLMResults *)results {\n    return results;\n}\n\n- (void)testQueryingNilRealmThrows {\n    XCTAssertThrows([PersonObject allObjectsInRealm:self.nonLiteralNil]);\n}\n\n- (void)testDynamicQueryInvalidClass\n{\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    // class not derived from RLMObject\n    XCTAssertThrows([realm objects:@\"NonRealmPersonObject\" where:@\"age > 25\"], @\"invalid object type\");\n    XCTAssertThrows([[realm objects:@\"NonRealmPersonObject\" where:@\"age > 25\"] sortedResultsUsingKeyPath:@\"age\" ascending:YES], @\"invalid object type\");\n\n    // empty string for class name\n    XCTAssertThrows([realm objects:@\"\" where:@\"age > 25\"], @\"missing class name\");\n    XCTAssertThrows([[realm objects:@\"\" where:@\"age > 25\"] sortedResultsUsingKeyPath:@\"age\" ascending:YES], @\"missing class name\");\n\n    // nil class name\n    XCTAssertThrows([realm objects:self.nonLiteralNil where:@\"age > 25\"], @\"nil class name\");\n    XCTAssertThrows([[realm objects:self.nonLiteralNil where:@\"age > 25\"] sortedResultsUsingKeyPath:@\"age\" ascending:YES], @\"nil class name\");\n}\n\n- (void)testPredicateValidUse\n{\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    // boolean false\n    XCTAssertNoThrow([AllTypesObject objectsInRealm:realm where:@\"boolCol == no\"], @\"== no\");\n    XCTAssertNoThrow([AllTypesObject objectsInRealm:realm where:@\"boolCol == No\"], @\"== No\");\n    XCTAssertNoThrow([AllTypesObject objectsInRealm:realm where:@\"boolCol == NO\"], @\"== NO\");\n    XCTAssertNoThrow([AllTypesObject objectsInRealm:realm where:@\"boolCol == false\"], @\"== false\");\n    XCTAssertNoThrow([AllTypesObject objectsInRealm:realm where:@\"boolCol == False\"], @\"== False\");\n    XCTAssertNoThrow([AllTypesObject objectsInRealm:realm where:@\"boolCol == FALSE\"], @\"== FALSE\");\n    XCTAssertNoThrow([AllTypesObject objectsInRealm:realm where:@\"boolCol == 0\"], @\"== 0\");\n\n    // boolean true\n    XCTAssertNoThrow([AllTypesObject objectsInRealm:realm where:@\"boolCol == yes\"], @\"== yes\");\n    XCTAssertNoThrow([AllTypesObject objectsInRealm:realm where:@\"boolCol == Yes\"], @\"== Yes\");\n    XCTAssertNoThrow([AllTypesObject objectsInRealm:realm where:@\"boolCol == YES\"], @\"== YES\");\n    XCTAssertNoThrow([AllTypesObject objectsInRealm:realm where:@\"boolCol == true\"], @\"== true\");\n    XCTAssertNoThrow([AllTypesObject objectsInRealm:realm where:@\"boolCol == True\"], @\"== True\");\n    XCTAssertNoThrow([AllTypesObject objectsInRealm:realm where:@\"boolCol == TRUE\"], @\"== TRUE\");\n    XCTAssertNoThrow([AllTypesObject objectsInRealm:realm where:@\"boolCol == 1\"], @\"== 1\");\n\n    // inequality\n    XCTAssertNoThrow([AllTypesObject objectsInRealm:realm where:@\"boolCol != YES\"], @\"!= YES\");\n    XCTAssertNoThrow([AllTypesObject objectsInRealm:realm where:@\"boolCol <> YES\"], @\"<> YES\");\n}\n\n- (void)testPredicateNotSupported\n{\n    // These are things which are valid predicates, but which we do not support\n\n    // Aggregate operators on non-arrays\n    RLMAssertThrowsWithReasonMatching([PersonObject objectsWhere:@\"ANY age > 5\"], @\"Aggregate operations can only.*collection property\");\n    RLMAssertThrowsWithReasonMatching([PersonObject objectsWhere:@\"ALL age > 5\"], @\"ALL modifier not supported\");\n    RLMAssertThrowsWithReasonMatching([PersonObject objectsWhere:@\"SOME age > 5\"], @\"Aggregate operations can only.*collection property\");\n    RLMAssertThrowsWithReasonMatching([PersonObject objectsWhere:@\"NONE age > 5\"], @\"Aggregate operations can only.*collection property\");\n    RLMAssertThrowsWithReasonMatching([PersonLinkObject objectsWhere:@\"ANY person.age > 5\"], @\"Aggregate operations can only.*collection property\");\n    RLMAssertThrowsWithReasonMatching([PersonLinkObject objectsWhere:@\"ALL person.age > 5\"], @\"ALL modifier not supported\");\n    RLMAssertThrowsWithReasonMatching([PersonLinkObject objectsWhere:@\"SOME person.age > 5\"], @\"Aggregate operations can only.*collection property\");\n    RLMAssertThrowsWithReasonMatching([PersonLinkObject objectsWhere:@\"NONE person.age > 5\"], @\"Aggregate operations can only.*collection property\");\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"age.@count > 5\"],\n                              @\"Invalid keypath 'age.@count': Property 'PersonObject.age' is not a link or collection and can only appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"age.@sum > 5\"],\n                              @\"Invalid keypath 'age.@sum': Property 'PersonObject.age' is not a link or collection and can only appear at the end of a keypath.\");\n\n    // comparing two constants\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"5 = 5\"],\n                              @\"Predicate expressions must compare a keypath and another keypath or a constant value\");\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"nil = nil\"],\n                              @\"Predicate expressions must compare a keypath and another keypath or a constant value\");\n\n    // substring operations with constant on LHS\n    RLMAssertThrowsWithReason(([AllOptionalTypes objectsWhere:@\"%@ CONTAINS data\", [NSData data]]),\n                              @\"Operator 'CONTAINS' requires a keypath on the left side\");\n\n    // LinkList equality is unsupport since the semantics are unclear\n    XCTAssertThrows(([ArrayOfAllTypesObject objectsWhere:@\"ANY array = array\"]));\n\n    // Unsupported variants of subqueries.\n    RLMAssertThrowsWithReasonMatching(([ArrayOfAllTypesObject objectsWhere:@\"SUBQUERY(array, $obj, $obj.intCol = 5).@count == array.@count\"]), @\"SUBQUERY.*compared with a constant number\");\n    RLMAssertThrowsWithReasonMatching(([ArrayOfAllTypesObject objectsWhere:@\"SUBQUERY(array, $obj, $obj.intCol = 5) == 0\"]), @\"SUBQUERY.*immediately followed by .@count\");\n    RLMAssertThrowsWithReasonMatching(([ArrayOfAllTypesObject objectsWhere:@\"SELF IN SUBQUERY(array, $obj, $obj.intCol = 5)\"]), @\"Predicate with IN operator must compare.*aggregate$\");\n\n    // Nonexistent aggregate operators\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"children.@average.age == 5\"],\n                              @\"Unsupported collection operation '@average'\");\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"name <[c] 'name'\"],\n                              @\"Lexicographical comparisons must be case-sensitive\");\n\n    // block-based predicate\n    NSPredicate *pred = [NSPredicate predicateWithBlock:^BOOL (__unused id obj, __unused NSDictionary *bindings) {\n        return true;\n    }];\n    XCTAssertThrows([IntObject objectsWithPredicate:pred]);\n}\n\n- (void)testPredicateMisuse\n{\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    // invalid column/property name\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"height > 72\"],\n                              @\"Property 'height' not found in object of type 'PersonObject'\");\n\n    // wrong/invalid data types\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"age != xyz\"],\n                                      @\"Invalid keypath 'xyz': Property 'xyz' not found in object of type 'PersonObject'\");\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"name == 3\"],\n                              @\"Cannot compare value '3' of type '__NSCFNumber' to property 'name' of type 'string'\");\n    RLMAssertThrowsWithReasonMatching([PersonObject objectsWhere:@\"age IN {'xyz'}\"],\n                                      @\"Cannot compare value 'xyz' of type '.*String.*' to property 'age' of type 'int'\");\n    XCTAssertThrows([PersonObject objectsWhere:@\"name IN {3}\"], @\"asdf\");\n\n    // compare columns to incorrect type of constant value\n    RLMAssertThrowsWithReasonMatching([AllTypesObject objectsWhere:@\"boolCol == 'Foo'\"],\n                                      @\"Cannot compare value 'Foo' of type '.*String.*' to property 'boolCol' of type 'bool'\");\n    RLMAssertThrowsWithReason([AllTypesObject objectsWhere:@\"boolCol == 2\"],\n                              @\"Cannot compare value '2' of type '__NSCFNumber' to property 'boolCol' of type 'bool'\");\n    RLMAssertThrowsWithReason([AllTypesObject objectsWhere:@\"dateCol == 7\"],\n                              @\"Cannot compare value '7' of type '__NSCFNumber' to property 'dateCol' of type 'date'\");\n    RLMAssertThrowsWithReasonMatching([AllTypesObject objectsWhere:@\"doubleCol == 'The'\"],\n                                      @\"Cannot compare value 'The' of type '.*String.*' to property 'doubleCol' of type 'double'\");\n    RLMAssertThrowsWithReasonMatching([AllTypesObject objectsWhere:@\"floatCol == 'Bar'\"],\n                                      @\"Cannot compare value 'Bar' of type '.*String.*' to property 'floatCol' of type 'float'\");\n    RLMAssertThrowsWithReasonMatching([AllTypesObject objectsWhere:@\"intCol == 'Baz'\"],\n                                      @\"Cannot compare value 'Baz' of type '.*String.*' to property 'intCol' of type 'int'\");\n\n    // compare two constants\n    XCTAssertThrows([PersonObject objectsWhere:@\"3 == 3\"], @\"comparing 2 constants\");\n\n    // invalid strings\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"\"],\n                              @\"Unable to parse the format string\");\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"age\"],\n                              @\"Unable to parse the format string\");\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"sdlfjasdflj\"],\n                              @\"Unable to parse the format string\");\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"age * 25\"],\n                              @\"Unable to parse the format string\");\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"age === 25\"],\n                              @\"Unable to parse the format string\");\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\",\"],\n                              @\"Unable to parse the format string\");\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"()\"],\n                              @\"Unable to parse the format string\");\n\n    // Misspelled keypath (should be %K)\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"@K == YES\"], @\"Unsupported collection operation '@K'\");\n\n    NSPredicate *(^predicateWithKeyPath)(NSString *) = ^(NSString *keyPath) {\n        return  [NSComparisonPredicate predicateWithLeftExpression:[NSExpression expressionForKeyPath:keyPath]\n                                                   rightExpression:[NSExpression expressionForConstantValue:@0]\n                                                          modifier:0\n                                                              type:NSEqualToPredicateOperatorType\n                                                           options:0];\n    };\n\n    // malformed keypath operators\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"@count == 0\"],\n                              @\"Invalid keypath '@count': collection operation '@count' must be applied to a collection\");\n    [NSComparisonPredicate predicateWithLeftExpression:[NSExpression expressionForKeyPath:@\"name.@\"] rightExpression:[NSExpression expressionForConstantValue:@0] modifier:0 type:NSEqualToPredicateOperatorType options:0];\n    RLMAssertThrowsWithReason([PersonObject objectsWithPredicate:predicateWithKeyPath(@\"children.@\")],\n                              @\"Unsupported collection operation '@'\");\n    RLMAssertThrowsWithReason([PersonObject objectsWithPredicate:predicateWithKeyPath(@\"children@\")],\n                              @\"Invalid keypath 'children@': Property 'children@' not found in object of type 'PersonObject'\");\n    RLMAssertThrowsWithReason([PersonObject objectsWithPredicate:predicateWithKeyPath(@\"name@length\")],\n                              @\"Invalid keypath 'name@length': Property 'name@length' not found in object of type 'PersonObject'\");\n    RLMAssertThrowsWithReason([PersonObject objectsWithPredicate:predicateWithKeyPath(@\".name\")],\n                              @\"Invalid keypath '.name': no key name before '.'\");\n    RLMAssertThrowsWithReason([PersonObject objectsWithPredicate:predicateWithKeyPath(@\"children.\")],\n                              @\"Invalid keypath 'children.': no key name after last '.'\");\n\n    // not a link column\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"age.age == 25\"],\n                              @\"Invalid keypath 'age.age': Property 'PersonObject.age' is not a link or collection and can only appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"age.age.age == 25\"],\n                              @\"Invalid keypath 'age.age.age': Property 'PersonObject.age' is not a link or collection and can only appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason([AllPrimitiveArrays objectsWhere:@\"intObj.foo == 25\"],\n                              @\"Invalid keypath 'intObj.foo': RLMArray<int> property intObj can only be followed by a collection operation\");\n    RLMAssertThrowsWithReason([AllPrimitiveSets objectsWhere:@\"intObj.foo == 25\"],\n                              @\"Invalid keypath 'intObj.foo': RLMSet<int> property intObj can only be followed by a collection operation\");\n    RLMAssertThrowsWithReason([AllPrimitiveDictionaries objectsWhere:@\"intObj.foo == 25\"],\n                              @\"Invalid keypath 'intObj.foo': RLMDictionary<int> property intObj can only be followed by a collection operation\");\n\n    // abuse of BETWEEN\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"age BETWEEN 25\"], @\"type NSArray for BETWEEN\");\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"age BETWEEN Foo\"], @\"BETWEEN operator must compare a KeyPath with an aggregate\");\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"age BETWEEN {age, age}\"], @\"must be constant values\");\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"age BETWEEN {age, 0}\"], @\"must be constant values\");\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"age BETWEEN {0, age}\"], @\"must be constant values\");\n    RLMAssertThrowsWithReason([PersonObject objectsWhere:@\"age BETWEEN {0, {1, 10}}\"], @\"must be constant values\");\n\n    NSPredicate *pred;\n    pred = [NSPredicate predicateWithFormat:@\"age BETWEEN %@\", @[@1]];\n    RLMAssertThrowsWithReason([PersonObject objectsWithPredicate:pred], @\"exactly two objects\");\n\n    pred = [NSPredicate predicateWithFormat:@\"age BETWEEN %@\", @[@1, @2, @3]];\n    RLMAssertThrowsWithReason([PersonObject objectsWithPredicate:pred], @\"exactly two objects\");\n\n    pred = [NSPredicate predicateWithFormat:@\"age BETWEEN %@\", @[@\"Foo\", @\"Bar\"]];\n    RLMAssertThrowsWithReason([PersonObject objectsWithPredicate:pred], @\"type int for BETWEEN\");\n\n    pred = [NSPredicate predicateWithFormat:@\"age BETWEEN %@\", @[@1.5, @2.5]];\n    RLMAssertThrowsWithReason([PersonObject objectsWithPredicate:pred], @\"type int for BETWEEN\");\n\n    pred = [NSPredicate predicateWithFormat:@\"age BETWEEN %@\", @[@1, @[@2, @3]]];\n    RLMAssertThrowsWithReason([PersonObject objectsWithPredicate:pred], @\"type int for BETWEEN\");\n\n    pred = [NSPredicate predicateWithFormat:@\"age BETWEEN %@\", @{@25: @35}];\n    RLMAssertThrowsWithReason([PersonObject objectsWithPredicate:pred], @\"type NSArray for BETWEEN\");\n\n    pred = [NSPredicate predicateWithFormat:@\"height BETWEEN %@\", @[@25, @35]];\n    RLMAssertThrowsWithReason([PersonObject objectsWithPredicate:pred],\n                              @\"Property 'height' not found in object of type 'PersonObject'\");\n\n    // bad type in link IN\n    RLMAssertThrowsWithReasonMatching([PersonLinkObject objectsInRealm:realm where:@\"person.age IN {'Tim'}\"],\n                                      @\"Cannot compare value 'Tim' of type '.*String.*' to property 'age' of type 'int'\");\n}\n\n- (void)testStringUnsupportedOperations\n{\n    XCTAssertThrows([StringObject objectsWhere:@\"stringCol MATCHES 'abc'\"]);\n    XCTAssertThrows([StringObject objectsWhere:@\"stringCol BETWEEN {'a', 'b'}\"]);\n\n    XCTAssertThrows([AllTypesObject objectsWhere:@\"objectCol.stringCol MATCHES 'abc'\"]);\n    XCTAssertThrows([AllTypesObject objectsWhere:@\"objectCol.stringCol BETWEEN {'a', 'b'}\"]);\n}\n\n- (void)testBinaryComparisonInPredicate {\n    NSData *data = [NSData data];\n    RLMAssertCount(BinaryObject, 0U, @\"binaryCol BEGINSWITH %@\", data);\n    RLMAssertCount(BinaryObject, 0U, @\"binaryCol ENDSWITH %@\", data);\n    RLMAssertCount(BinaryObject, 0U, @\"binaryCol CONTAINS %@\", data);\n\n    RLMAssertCount(BinaryObject, 0U, @\"binaryCol BEGINSWITH NULL\");\n    RLMAssertCount(BinaryObject, 0U, @\"binaryCol ENDSWITH NULL\");\n    RLMAssertCount(BinaryObject, 0U, @\"binaryCol CONTAINS NULL\");\n\n    RLMAssertCount(BinaryObject, 0U, @\"binaryCol = %@\", data);\n    RLMAssertCount(BinaryObject, 0U, @\"binaryCol != %@\", data);\n    RLMAssertCount(BinaryObject, 0U, @\"binaryCol > %@\", data);\n    RLMAssertCount(BinaryObject, 0U, @\"binaryCol >= %@\", data);\n    RLMAssertCount(BinaryObject, 0U, @\"binaryCol < %@\", data);\n    RLMAssertCount(BinaryObject, 0U, @\"binaryCol <= %@\", data);\n\n    XCTAssertThrows(([BinaryObject objectsWhere:@\"binaryCol MATCHES %@\", data]));\n}\n\n- (void)testLinkQueryInvalid {\n    XCTAssertThrows([LinkToAllTypesObject objectsWhere:@\"allTypesCol.binaryCol = 'a'\"], @\"Binary data not supported\");\n    XCTAssertThrows([LinkToAllTypesObject objectsWhere:@\"allTypesCol.invalidCol = 'a'\"], @\"Invalid column name should throw\");\n\n    XCTAssertThrows([LinkToAllTypesObject objectsWhere:@\"allTypesCol.longCol = 'a'\"], @\"Wrong data type should throw\");\n\n    RLMAssertThrowsWithReasonMatching([ArrayPropertyObject objectsWhere:@\"intArray.intCol > 5\"], @\"Key paths that include a collection property must use aggregate operations\");\n    RLMAssertThrowsWithReasonMatching([SetPropertyObject objectsWhere:@\"intSet.intCol > 5\"], @\"Key paths that include a collection property must use aggregate operations\");\n    RLMAssertThrowsWithReasonMatching([LinkToCompanyObject objectsWhere:@\"company.employees.age > 5\"], @\"Key paths that include a collection property must use aggregate operations\");\n\n    RLMAssertThrowsWithReasonMatching([LinkToAllTypesObject objectsWhere:@\"allTypesCol.intCol = allTypesCol.doubleCol\"], @\"Property type mismatch\");\n}\n\n- (void)testNumericOperatorsOnClass:(Class)class property:(NSString *)property value:(id)value {\n    NSArray *operators = @[@\"<\", @\"<=\", @\">\", @\">=\", @\"==\", @\"!=\"];\n    for (NSString *operator in operators) {\n        NSString *fmt = [@[property, operator, @\"%@\"] componentsJoinedByString:@\" \"];\n        RLMAssertCount(class, 0U, fmt, value);\n    }\n}\n\n- (void)testValidOperatorsInNumericComparison {\n    [self testNumericOperatorsOnClass:[IntObject class] property:@\"intCol\" value:@0];\n    [self testNumericOperatorsOnClass:[FloatObject class] property:@\"floatCol\" value:@0];\n    [self testNumericOperatorsOnClass:[DoubleObject class] property:@\"doubleCol\" value:@0];\n    [self testNumericOperatorsOnClass:[DateObject class] property:@\"dateCol\" value:NSDate.date];\n    [self testNumericOperatorsOnClass:[DecimalObject class] property:@\"decimalCol\" value:[RLMDecimal128 decimalWithNumber:@0]];\n    [self testNumericOperatorsOnClass:[MixedObject class] property:@\"anyCol\" value:@0];\n}\n\n- (void)testStringOperatorsOnClass:(Class)class property:(NSString *)property value:(id)value {\n    NSArray *operators = @[@\"BEGINSWITH\", @\"ENDSWITH\", @\"CONTAINS\", @\"LIKE\", @\"MATCHES\"];\n    for (NSString *operator in operators) {\n        NSString *fmt = [@[property, operator, @\"%@\"] componentsJoinedByString:@\" \"];\n        RLMAssertThrowsWithReasonMatching(([class objectsWhere:fmt, value]),\n                                          @\"not supported for type\");\n    }\n}\n\n- (void)testInvalidOperatorsInNumericComparison {\n    [self testStringOperatorsOnClass:[IntObject class] property:@\"intCol\" value:@0];\n    [self testStringOperatorsOnClass:[FloatObject class] property:@\"floatCol\" value:@0];\n    [self testStringOperatorsOnClass:[DoubleObject class] property:@\"doubleCol\" value:@0];\n    [self testStringOperatorsOnClass:[DateObject class] property:@\"dateCol\" value:NSDate.date];\n    [self testStringOperatorsOnClass:[DecimalObject class] property:@\"decimalCol\" value:[RLMDecimal128 decimalWithNumber:@0]];\n}\n@end\n\n@interface QueryTests : RLMTestCase\n- (Class)queryObjectClass;\n@end\n\n@implementation QueryTests\n\n- (Class)queryObjectClass {\n    return [QueryObject class];\n}\n\n- (RLMResults *)evaluate:(RLMResults *)results {\n    return results;\n}\n\n- (RLMRealm *)realm {\n    return [RLMRealm defaultRealm];\n}\n\n- (void)testBasicQuery {\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    [PersonObject createInRealm:realm withValue:@[@\"Fiel\", @27]];\n    [PersonObject createInRealm:realm withValue:@[@\"Ari\", @33]];\n    [PersonObject createInRealm:realm withValue:@[@\"Tim\", @29]];\n    [realm commitWriteTransaction];\n\n    // query on realm\n    RLMAssertCount(PersonObject, 2U, @\"age > 28\");\n\n    // query on realm with order\n    RLMResults *results = [[PersonObject objectsInRealm:realm where:@\"age > 28\"] sortedResultsUsingKeyPath:@\"age\" ascending:YES];\n    XCTAssertEqualObjects([results[0] name], @\"Tim\", @\"Tim should be first results\");\n\n    // query on sorted results\n    results = [[[PersonObject allObjectsInRealm:realm] sortedResultsUsingKeyPath:@\"age\" ascending:YES] objectsWhere:@\"age > 28\"];\n    XCTAssertEqualObjects([results[0] name], @\"Tim\", @\"Tim should be first results\");\n}\n\n- (void)testQueryBetween {\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    AllTypesObject *a = [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:1 stringObject:nil]];\n    AllTypesObject *b = [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:2 stringObject:nil]];\n    AllTypesObject *c = [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:3 stringObject:nil]];\n    AllTypesObject *d = [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:4 stringObject:nil]];\n\n    [ArrayOfAllTypesObject createInRealm:realm withValue:@[@[a, c]]];\n    [ArrayOfAllTypesObject createInRealm:realm withValue:@[@[b, d]]];\n    [DictionaryOfAllTypesObject createInRealm:realm withValue:@[@{@\"1\": a, @\"3\": c}]];\n    [DictionaryOfAllTypesObject createInRealm:realm withValue:@[@{@\"2\": b, @\"4\": d}]];\n    [SetOfAllTypesObject createInRealm:realm withValue:@[@[a, c]]];\n    [SetOfAllTypesObject createInRealm:realm withValue:@[@[b, d]]];\n\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(AllTypesObject, 4U, @\"intCol BETWEEN %@\", @[@0, @5]);\n    RLMAssertCount(AllTypesObject, 2U, @\"intCol BETWEEN %@\", @[@2, @3]);\n    RLMAssertCount(AllTypesObject, 2U, @\"intCol BETWEEN {2, 3}\");\n    RLMAssertCount(ArrayOfAllTypesObject, 1U, @\"ANY array.intCol BETWEEN %@\", @[@4, @5]);\n    RLMAssertCount(SetOfAllTypesObject, 1U, @\"ANY set.intCol BETWEEN %@\", @[@4, @5]);\n    RLMAssertCount(DictionaryOfAllTypesObject, 1U, @\"ANY dictionary.intCol BETWEEN %@\", @[@4, @5]);\n\n    RLMAssertCount(AllTypesObject, 4U, @\"floatCol BETWEEN %@\", @[@1.0f, @5.0f]);\n    RLMAssertCount(AllTypesObject, 2U, @\"floatCol BETWEEN %@\", @[@2.0f, @4.0f]);\n    RLMAssertCount(AllTypesObject, 2U, @\"floatCol BETWEEN {2, 4}\");\n    RLMAssertCount(ArrayOfAllTypesObject, 0U, @\"ANY array.floatCol BETWEEN %@\", @[@3.1, @3.2]);\n    RLMAssertCount(SetOfAllTypesObject, 0U, @\"ANY set.floatCol BETWEEN %@\", @[@3.1, @3.2]);\n    RLMAssertCount(DictionaryOfAllTypesObject, 0U, @\"ANY dictionary.floatCol BETWEEN %@\", @[@3.1, @3.2]);\n\n    RLMAssertCount(AllTypesObject, 4U, @\"doubleCol BETWEEN %@\", @[@1.0, @5.0]);\n    RLMAssertCount(AllTypesObject, 2U, @\"doubleCol BETWEEN %@\", @[@2.0, @4.0]);\n    RLMAssertCount(AllTypesObject, 2U, @\"doubleCol BETWEEN {3.0, 7.0}\");\n    RLMAssertCount(ArrayOfAllTypesObject, 0U, @\"ANY array.doubleCol BETWEEN %@\", @[@3.1, @3.2]);\n    RLMAssertCount(SetOfAllTypesObject, 0U, @\"ANY set.doubleCol BETWEEN %@\", @[@3.1, @3.2]);\n    RLMAssertCount(DictionaryOfAllTypesObject, 0U, @\"ANY dictionary.doubleCol BETWEEN %@\", @[@3.1, @3.2]);\n\n    RLMAssertCount(AllTypesObject, 2U, @\"dateCol BETWEEN %@\", @[[b dateCol], [c dateCol]]);\n    RLMAssertCount(ArrayOfAllTypesObject, 2U, @\"ANY array.dateCol BETWEEN %@\", @[[b dateCol], [c dateCol]]);\n    RLMAssertCount(SetOfAllTypesObject, 2U, @\"ANY set.dateCol BETWEEN %@\", @[[b dateCol], [c dateCol]]);\n    RLMAssertCount(DictionaryOfAllTypesObject, 2U, @\"ANY dictionary.dateCol BETWEEN %@\", @[[b dateCol], [c dateCol]]);\n\n    RLMAssertCount(AllTypesObject, 1U, @\"longCol BETWEEN %@\", @[@5000000000LL, @7000000000LL]);\n    RLMAssertCount(AllTypesObject, 1U, @\"longCol BETWEEN {5000000000, 7000000000}\");\n    RLMAssertCount(ArrayOfAllTypesObject, 1U, @\"ANY array.longCol BETWEEN %@\", @[@5000000000LL, @7000000000LL]);\n    RLMAssertCount(SetOfAllTypesObject, 1U, @\"ANY set.longCol BETWEEN %@\", @[@5000000000LL, @7000000000LL]);\n    RLMAssertCount(DictionaryOfAllTypesObject, 1U, @\"ANY dictionary.longCol BETWEEN %@\", @[@5000000000LL, @7000000000LL]);\n\n    RLMAssertCount(AllTypesObject, 4U, @\"decimalCol BETWEEN %@\", @[@0, @5]);\n    RLMAssertCount(AllTypesObject, 4U, @\"decimalCol BETWEEN %@\", @[[[RLMDecimal128 alloc] initWithNumber:@0],\n                                                                   [[RLMDecimal128 alloc] initWithNumber:@5]]);\n    RLMAssertCount(AllTypesObject, 4U, @\"decimalCol BETWEEN {0, 5}\");\n    RLMAssertCount(AllTypesObject, 3U, @\"decimalCol BETWEEN {'0e1', '30e-1'}\");\n\n    RLMAssertCount(AllTypesObject, 4U, @\"anyCol BETWEEN %@\", @[@0, @5]);\n    RLMAssertCount(AllTypesObject, 2U, @\"anyCol BETWEEN %@\", @[@2, @3]);\n    RLMAssertCount(AllTypesObject, 2U, @\"anyCol BETWEEN {2, 3}\");\n    RLMAssertCount(ArrayOfAllTypesObject, 2U, @\"ANY array.anyCol BETWEEN %@\", @[@4, @5]);\n    RLMAssertCount(SetOfAllTypesObject, 2U, @\"ANY set.anyCol BETWEEN %@\", @[@4, @5]);\n    RLMAssertCount(DictionaryOfAllTypesObject, 2U, @\"ANY dictionary.anyCol BETWEEN %@\", @[@4, @5]);\n\n    RLMResults *allObjects = [AllTypesObject allObjectsInRealm:realm];\n    RLMAssertThrowsWithReason([allObjects objectsWhere:@\"boolCol BETWEEN {true, false}\"],\n                              @\"Operator 'BETWEEN' not supported for type 'bool'\");\n    RLMAssertThrowsWithReason([allObjects objectsWhere:@\"stringCol BETWEEN {'', ''}\"],\n                              @\"Operator 'BETWEEN' not supported for type 'string'\");\n    RLMAssertThrowsWithReason(([allObjects objectsWhere:@\"binaryCol BETWEEN %@\", @[NSData.data, NSData.data]]),\n                              @\"Operator 'BETWEEN' not supported for type 'data'\");\n    RLMAssertThrowsWithReason([allObjects objectsWhere:@\"cBoolCol BETWEEN {true, false}\"],\n                              @\"Operator 'BETWEEN' not supported for type 'bool'\");\n    RLMAssertThrowsWithReason(([allObjects objectsWhere:@\"objectIdCol BETWEEN %@\",\n                                @[[RLMObjectId objectId], [RLMObjectId objectId]]]),\n                              @\"Operator 'BETWEEN' not supported for type 'object id'\");\n}\n\n- (void)testQueryWithDates {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n    AllTypesObject *all0 = [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:1 stringObject:nil]];\n    AllTypesObject *all1 = [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:2 stringObject:nil]];\n    AllTypesObject *all2 = [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:3 stringObject:nil]];\n    all0.anyCol = all0.dateCol;\n    all1.anyCol = all1.dateCol;\n    all2.anyCol = all2.dateCol;\n\n    [realm commitWriteTransaction];\n\n    NSArray<NSDate *> *dates = [[AllTypesObject allObjectsInRealm:realm] valueForKey:@\"dateCol\"];\n\n    RLMAssertCount(AllTypesObject, 2U, @\"dateCol < %@\", dates[2]);\n    RLMAssertCount(AllTypesObject, 3U, @\"dateCol <= %@\", dates[2]);\n    RLMAssertCount(AllTypesObject, 2U, @\"dateCol > %@\", dates[0]);\n    RLMAssertCount(AllTypesObject, 3U, @\"dateCol >= %@\", dates[0]);\n    RLMAssertCount(AllTypesObject, 1U, @\"dateCol == %@\", dates[0]);\n    RLMAssertCount(AllTypesObject, 2U, @\"dateCol != %@\", dates[0]);\n\n    RLMAssertCount(AllTypesObject, 2U, @\"%@ < dateCol\", dates[0]);\n    RLMAssertCount(AllTypesObject, 3U, @\"%@ <= dateCol\", dates[0]);\n    RLMAssertCount(AllTypesObject, 2U, @\"%@ > dateCol\", dates[2]);\n    RLMAssertCount(AllTypesObject, 3U, @\"%@ >= dateCol\", dates[2]);\n    RLMAssertCount(AllTypesObject, 1U, @\"%@ == dateCol\", dates[0]);\n    RLMAssertCount(AllTypesObject, 2U, @\"%@ != dateCol\", dates[0]);\n\n    RLMAssertCount(AllTypesObject, 2U, @\"anyCol < %@\", dates[2]);\n    RLMAssertCount(AllTypesObject, 3U, @\"anyCol <= %@\", dates[2]);\n    RLMAssertCount(AllTypesObject, 2U, @\"anyCol > %@\", dates[0]);\n    RLMAssertCount(AllTypesObject, 3U, @\"anyCol >= %@\", dates[0]);\n    RLMAssertCount(AllTypesObject, 1U, @\"anyCol == %@\", dates[0]);\n    RLMAssertCount(AllTypesObject, 2U, @\"anyCol != %@\", dates[0]);\n\n    RLMAssertCount(AllTypesObject, 2U, @\"%@ < anyCol\", dates[0]);\n    RLMAssertCount(AllTypesObject, 3U, @\"%@ <= anyCol\", dates[0]);\n    RLMAssertCount(AllTypesObject, 2U, @\"%@ > anyCol\", dates[2]);\n    RLMAssertCount(AllTypesObject, 3U, @\"%@ >= anyCol\", dates[2]);\n    RLMAssertCount(AllTypesObject, 1U, @\"%@ == anyCol\", dates[0]);\n    RLMAssertCount(AllTypesObject, 2U, @\"%@ != anyCol\", dates[0]);\n}\n\n- (void)testDefaultRealmQuery {\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    [PersonObject createInRealm:realm withValue:@[@\"Fiel\", @27]];\n    [PersonObject createInRealm:realm withValue:@[@\"Tim\", @29]];\n    [PersonObject createInRealm:realm withValue:@[@\"Ari\", @33]];\n    [realm commitWriteTransaction];\n\n    // query on class\n    XCTAssertEqual([PersonObject allObjects].count, 3U);\n    RLMAssertCount(PersonObject, 1U, @\"age == 27\");\n\n    // with order\n    RLMResults *results = [[PersonObject objectsWhere:@\"age > 28\"] sortedResultsUsingKeyPath:@\"age\" ascending:YES];\n    PersonObject *tim = results[0];\n    XCTAssertEqualObjects(tim.name, @\"Tim\", @\"Tim should be first results\");\n}\n\n- (void)testUuidRealmQuery {\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    [UuidObject createInRealm:realm withValue:@[[[NSUUID alloc] initWithUUIDString:@\"00000000-0000-0000-0000-000000000000\"]]];\n    [UuidObject createInRealm:realm withValue:@[[[NSUUID alloc] initWithUUIDString:@\"137DECC8-B300-4954-A233-F89909F4FD89\"]]];\n\n    [MixedObject createInRealm:realm withValue:@[[[NSUUID alloc] initWithUUIDString:@\"00000000-0000-0000-0000-000000000000\"]]];\n    [MixedObject createInRealm:realm withValue:@[[[NSUUID alloc] initWithUUIDString:@\"137DECC8-B300-4954-A233-F89909F4FD89\"]]];\n    [realm commitWriteTransaction];\n\n    // query on class\n    XCTAssertEqual([UuidObject allObjects].count, 2U);\n    RLMAssertCount(UuidObject, 1U, @\"uuidCol == %@\", [[NSUUID alloc] initWithUUIDString:@\"137DECC8-B300-4954-A233-F89909F4FD89\"]);\n    XCTAssertEqual([MixedObject allObjects].count, 2U);\n    RLMAssertCount(MixedObject, 1U, @\"anyCol == %@\", [[NSUUID alloc] initWithUUIDString:@\"137DECC8-B300-4954-A233-F89909F4FD89\"]);\n}\n\n- (void)testRLMValueQuery {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n\n    NSArray *allValues = @[@YES,\n                           @NO,\n                           @true,\n                           @false,\n                           @TRUE,\n                           @FALSE,\n                           @\"0\",\n                           @\"1\",\n                           @0,\n                           @1,\n                           @0.0,\n                           @1.0,\n                           @0.0f,\n                           @1.0f,\n                           [[RLMDecimal128 alloc] initWithNumber:@(0)],\n                           [[RLMDecimal128 alloc] initWithNumber:@(1)],\n                           [NSData dataWithBytes:\"0\" length:1],\n                           [NSData dataWithBytes:\"1\" length:1],\n                           [NSDate dateWithTimeIntervalSince1970:0],\n                           [NSDate dateWithTimeIntervalSince1970:1],\n                           [RLMObjectId objectId],\n                           [[NSUUID alloc] initWithUUIDString:@\"85d4fbee-6ec6-47df-bfa1-615931903d7e\"],\n                           NSNull.null,\n    ];\n\n    StringObject *stringObj = [StringObject new];\n    stringObj.stringCol = @\"required-string\";\n    ArrayOfAllTypesObject *arrayOfAll = [ArrayOfAllTypesObject createInRealm:realm withValue:@{}];\n\n    for (int i = 0; i < (int)allValues.count; i++) {\n        AllTypesObject *obj = [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:i stringObject:stringObj]];\n        obj.anyCol = allValues[i];\n        [arrayOfAll.array addObject:obj];\n    }\n    [realm commitWriteTransaction];\n\n    // Numeric based comparability\n    RLMAssertCount(AllTypesObject, 6U, @\"anyCol BETWEEN %@\", @[@1, @2]);\n    RLMAssertCount(AllTypesObject, 6U, @\"anyCol BETWEEN {1, 2}\");\n    RLMAssertCount(AllTypesObject, 1U, @\"anyCol == FALSE\");\n    RLMAssertCount(AllTypesObject, 6U, @\"anyCol == 0\");\n    RLMAssertCount(AllTypesObject, 22, @\"anyCol != false\");\n    RLMAssertCount(AllTypesObject, 22, @\"anyCol != FALSE\");\n    RLMAssertCount(AllTypesObject, 22, @\"anyCol != NO\");\n    RLMAssertCount(AllTypesObject, 17, @\"anyCol != 0\");\n    RLMAssertCount(AllTypesObject, 6U, @\"anyCol < 1\");\n    RLMAssertCount(AllTypesObject, 0U, @\"anyCol > 1\");\n    RLMAssertCount(AllTypesObject, 6U, @\"anyCol >= 1\");\n    RLMAssertCount(AllTypesObject, 12U, @\"anyCol <= 1\");\n\n    XCTAssertThrowsSpecificNamed([AllTypesObject objectsWhere:@\"anyCol BETWEEN TRUE\"],\n                                 NSException,\n                                 @\"Invalid value\",\n                                 @\"object must be of type NSArray for BETWEEN operations\");\n\n    // Binary based comparability\n    RLMAssertCount(AllTypesObject, 1U, @\"anyCol == '0'\");\n    RLMAssertCount(AllTypesObject, allValues.count-1, @\"anyCol != '0'\");\n    RLMAssertCount(AllTypesObject, 1U, @\"anyCol BEGINSWITH '1'\");\n    RLMAssertCount(AllTypesObject, 0U, @\"anyCol BEGINSWITH 'a'\");\n    RLMAssertCount(AllTypesObject, 1U, @\"anyCol ENDSWITH '1'\");\n    RLMAssertCount(AllTypesObject, 0U, @\"anyCol ENDSWITH 'a'\");\n    RLMAssertCount(AllTypesObject, 1U, @\"anyCol CONTAINS '1'\");\n    RLMAssertCount(AllTypesObject, 0U, @\"anyCol CONTAINS 'a'\");\n\n    RLMAssertCount(AllTypesObject, 1U, @\"anyCol == %@\", [@\"0\" dataUsingEncoding:NSUTF8StringEncoding]);\n    RLMAssertCount(AllTypesObject, allValues.count-1, @\"anyCol != %@\", [@\"0\" dataUsingEncoding:NSUTF8StringEncoding]);\n    RLMAssertCount(AllTypesObject, 1U, @\"anyCol BEGINSWITH %@\", [@\"1\" dataUsingEncoding:NSUTF8StringEncoding]);\n    RLMAssertCount(AllTypesObject, 0U, @\"anyCol BEGINSWITH %@\", [@\"a\" dataUsingEncoding:NSUTF8StringEncoding]);\n    RLMAssertCount(AllTypesObject, 1U, @\"anyCol ENDSWITH %@\", [@\"1\" dataUsingEncoding:NSUTF8StringEncoding]);\n    RLMAssertCount(AllTypesObject, 0U, @\"anyCol ENDSWITH %@\", [@\"a\" dataUsingEncoding:NSUTF8StringEncoding]);\n    RLMAssertCount(AllTypesObject, 1U, @\"anyCol CONTAINS %@\", [@\"1\" dataUsingEncoding:NSUTF8StringEncoding]);\n    RLMAssertCount(AllTypesObject, 0U, @\"anyCol CONTAINS %@\", [@\"a\" dataUsingEncoding:NSUTF8StringEncoding]);\n\n    XCTAssertThrowsSpecificNamed([AllTypesObject objectsWhere:@\"anyCol CONATINS 0\"],\n                                 NSException,\n                                 NSInvalidArgumentException,\n                                 @\"Unable to parse the format string \\\"anyCol CONATINS 0\\\"\");\n\n    RLMAssertCount(AllTypesObject, 0U, @\"anyCol BEGINSWITH '%@'\", @0);\n    RLMAssertCount(AllTypesObject, 0U, @\"anyCol ENDSWITH '%@'\", @0);\n\n    RLMAssertCount(AllTypesObject, 1U, @\"anyCol == %@\", [NSDate dateWithTimeIntervalSince1970:0]);\n    RLMAssertCount(AllTypesObject, allValues.count, @\"anyCol != %@\", [NSDate dateWithTimeIntervalSince1970:123]);\n\n    RLMAssertCount(AllTypesObject, 1U, @\"anyCol == %@\", [[NSUUID alloc] initWithUUIDString:@\"85d4fbee-6ec6-47df-bfa1-615931903d7e\"]);\n    RLMAssertCount(AllTypesObject, allValues.count-1, @\"anyCol != %@\", [[NSUUID alloc] initWithUUIDString:@\"85d4fbee-6ec6-47df-bfa1-615931903d7e\"]);\n\n    XCTAssertThrowsSpecificNamed([AllTypesObject objectsWhere:@\"anyCol BETWEEN '85d4fbee-6ec6-47df-bfa1-615931903d7e'\"],\n                                 NSException,\n                                 @\"Invalid value\",\n                                 @\"object must be of type NSArray for BETWEEN operations\");\n\n    RLMAssertCount(AllTypesObject, 1U, @\"anyCol == NULL\");\n    RLMAssertCount(AllTypesObject, allValues.count-1, @\"anyCol != NULL\");\n}\n\n- (void)testArrayQuery\n{\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    [PersonObject createInRealm:realm withValue:@[@\"Fiel\", @27]];\n    [PersonObject createInRealm:realm withValue:@[@\"Tim\", @29]];\n    [PersonObject createInRealm:realm withValue:@[@\"Ari\", @33]];\n    [realm commitWriteTransaction];\n\n    // query on class\n    RLMResults *all = [PersonObject allObjects];\n    XCTAssertEqual(all.count, 3U, @\"Expecting 3 results\");\n\n    RLMResults *some = [[PersonObject objectsWhere:@\"age > 28\"] sortedResultsUsingKeyPath:@\"age\" ascending:YES];\n\n    // query/order on array\n    RLMAssertCount(all, 1U, @\"age == 27\");\n    RLMAssertCount(all, 0U, @\"age == 28\");\n    some = [some sortedResultsUsingKeyPath:@\"age\" ascending:NO];\n    XCTAssertEqualObjects([some[0] name], @\"Ari\", @\"Ari should be first results\");\n}\n\n- (void)verifySort:(RLMRealm *)realm column:(NSString *)column ascending:(BOOL)ascending expected:(id)val {\n    RLMResults *results = [[AllTypesObject allObjectsInRealm:realm] sortedResultsUsingKeyPath:column ascending:ascending];\n    AllTypesObject *obj = results[0];\n    XCTAssertEqualObjects(obj[column], val, @\"%@\", column);\n\n    RLMArray *ar = [(ArrayPropertyObject *)[[ArrayOfAllTypesObject allObjectsInRealm:realm] firstObject] array];\n    results = [ar sortedResultsUsingKeyPath:column ascending:ascending];\n    obj = results[0];\n    XCTAssertEqualObjects(obj[column], val, @\"%@\", column);\n}\n\n- (void)testEmbeddedObjectQuery {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n    EmbeddedIntParentObject *obj0 = [EmbeddedIntParentObject createInRealm:realm withValue:@[@1, @[@2], @[@[@3]]]];\n    EmbeddedIntParentObject *obj1 = [EmbeddedIntParentObject createInRealm:realm withValue:@[@4, @[@5], @[@[@6]]]];\n    EmbeddedIntParentObject *obj2 = [EmbeddedIntParentObject createInRealm:realm withValue:@[@7, @[@8], @[@[@9]]]];\n    [realm commitWriteTransaction];\n\n    // Query parent objects based on property of embedded object\n    RLMResults *r0 = [EmbeddedIntParentObject objectsWhere:@\"object.intCol = 2\"];\n    XCTAssertEqualObjects(r0[0], obj0);\n    XCTAssert(r0.count == 1);\n\n    // Query parent objects based on array of embedded objects\n    RLMResults *r1 = [EmbeddedIntParentObject objectsWhere:@\"ANY array.intCol > 4\"];\n    XCTAssertEqualObjects(r1[0], obj1);\n    XCTAssertEqualObjects(r1[1], obj2);\n    XCTAssert(r1.count == 2);\n\n    // Compound query using two different embedded object properties\n    RLMResults *r2 = [EmbeddedIntParentObject objectsWhere:@\"ANY array.intCol > 4 and object.intCol = 5\"];\n    XCTAssertEqualObjects(r2[0], obj1);\n    XCTAssert(r2.count == 1);\n\n    // Aggregate query on embedded object array, sort using embedded object key path\n    RLMResults *r3 = [[EmbeddedIntParentObject objectsWhere:@\"array.@max.intCol < 9\"]\n                      sortedResultsUsingKeyPath:@\"object.intCol\" ascending:NO];\n    XCTAssertEqualObjects(r3[0], obj1);\n    XCTAssertEqualObjects(r3[1], obj0);\n    XCTAssert(r3.count == 2);\n}\n\n- (void)testQuerySorting\n{\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    StringObject *stringObj = [StringObject new];\n    stringObj.stringCol = @\"string\";\n\n    ArrayOfAllTypesObject *arrayOfAll = [ArrayOfAllTypesObject createInRealm:realm withValue:@{}];\n    DictionaryOfAllTypesObject *dictionaryOfAll = [DictionaryOfAllTypesObject createInRealm:realm withValue:\n                                                   @{@\"dictionary\": @{\n                                                             @\"1\": [AllTypesObject values:1 stringObject:stringObj],\n                                                             @\"2\": [AllTypesObject values:2 stringObject:stringObj],\n                                                             @\"3\": [AllTypesObject values:3 stringObject:stringObj],\n                                                             @\"4\": [AllTypesObject values:4 stringObject:stringObj],\n                                                   }}];\n    SetOfAllTypesObject *setOfAll = [SetOfAllTypesObject createInRealm:realm withValue:@{}];\n\n    [arrayOfAll.array addObjects:@[\n        [AllTypesObject values:1 stringObject:stringObj],\n        [AllTypesObject values:2 stringObject:stringObj],\n        [AllTypesObject values:3 stringObject:stringObj],\n        [AllTypesObject values:4 stringObject:stringObj],\n    ]];\n    [setOfAll.set addObjects:@[\n        [AllTypesObject values:1 stringObject:stringObj],\n        [AllTypesObject values:2 stringObject:stringObj],\n        [AllTypesObject values:3 stringObject:stringObj],\n        [AllTypesObject values:4 stringObject:stringObj],\n    ]];\n    arrayOfAll.array[0].anyCol = @NO;\n    arrayOfAll.array[1].anyCol = [NSNull null];\n    arrayOfAll.array[2].anyCol = @1;\n    arrayOfAll.array[3].anyCol = [[NSUUID alloc] initWithUUIDString:@\"B9D325B0-3058-4838-8473-8F1AAAE410DB\"];\n    [realm commitWriteTransaction];\n\n    //////////// sort by boolCol\n    [self verifySort:realm column:@\"boolCol\" ascending:YES expected:@NO];\n    [self verifySort:realm column:@\"boolCol\" ascending:NO expected:@YES];\n\n    //////////// sort by intCol\n    [self verifySort:realm column:@\"intCol\" ascending:YES expected:@1];\n    [self verifySort:realm column:@\"intCol\" ascending:NO expected:@4];\n\n    //////////// sort by dateCol\n    [self verifySort:realm column:@\"dateCol\" ascending:YES expected:arrayOfAll.array[0].dateCol];\n    [self verifySort:realm column:@\"dateCol\" ascending:NO expected:arrayOfAll.array[3].dateCol];\n\n    //////////// sort by doubleCol\n    [self verifySort:realm column:@\"doubleCol\" ascending:YES expected:@1.11];\n    [self verifySort:realm column:@\"doubleCol\" ascending:NO expected:@4.44];\n\n    //////////// sort by floatCol\n    [self verifySort:realm column:@\"floatCol\" ascending:YES expected:@1.1f];\n    [self verifySort:realm column:@\"floatCol\" ascending:NO expected:@4.4f];\n\n    //////////// sort by stringCol\n    [self verifySort:realm column:@\"stringCol\" ascending:YES expected:@\"a\"];\n    [self verifySort:realm column:@\"stringCol\" ascending:NO expected:@\"d\"];\n\n    //////////// sort by decimalCol\n    [self verifySort:realm column:@\"decimalCol\" ascending:YES expected:[RLMDecimal128 decimalWithNumber:@1]];\n    [self verifySort:realm column:@\"decimalCol\" ascending:NO expected:[RLMDecimal128 decimalWithNumber:@4]];\n\n    //////////// sort by uuidCol\n    [self verifySort:realm column:@\"uuidCol\" ascending:YES expected:[[NSUUID alloc] initWithUUIDString:@\"00000000-0000-0000-0000-000000000000\"]];\n    [self verifySort:realm column:@\"uuidCol\" ascending:NO expected:[[NSUUID alloc] initWithUUIDString:@\"B9D325B0-3058-4838-8473-8F1AAAE410DB\"]];\n\n    //////////// sort by anyCol\n    //////////// nulls < strings, binaries < numerics < timestamps < objectId < uuid.\n    [self verifySort:realm column:@\"anyCol\" ascending:YES expected:nil];\n    [self verifySort:realm column:@\"anyCol\" ascending:NO expected:[[NSUUID alloc] initWithUUIDString:@\"B9D325B0-3058-4838-8473-8F1AAAE410DB\"]];\n\n    // sort invalid name\n    RLMAssertThrowsWithReason([[AllTypesObject allObjects] sortedResultsUsingKeyPath:@\"invalidCol\" ascending:YES],\n                              @\"Cannot sort on key path 'invalidCol': property 'AllTypesObject.invalidCol' does not exist.\");\n    RLMAssertThrowsWithReason([arrayOfAll.array sortedResultsUsingKeyPath:@\"invalidCol\" ascending:NO],\n                              @\"Cannot sort on key path 'invalidCol': property 'AllTypesObject.invalidCol' does not exist.\");\n    RLMAssertThrowsWithReason([setOfAll.set sortedResultsUsingKeyPath:@\"invalidCol\" ascending:NO],\n                              @\"Cannot sort on key path 'invalidCol': property 'AllTypesObject.invalidCol' does not exist.\");\n    RLMAssertThrowsWithReason([dictionaryOfAll.dictionary sortedResultsUsingKeyPath:@\"invalidCol\" ascending:NO],\n                              @\"Cannot sort on key path 'invalidCol': property 'AllTypesObject.invalidCol' does not exist.\");\n}\n\n- (void)testSortByNoColumns {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    DogObject *a2 = [DogObject createInDefaultRealmWithValue:@[@\"a\", @2]];\n    DogObject *b1 = [DogObject createInDefaultRealmWithValue:@[@\"b\", @1]];\n    DogObject *a1 = [DogObject createInDefaultRealmWithValue:@[@\"a\", @1]];\n    DogObject *b2 = [DogObject createInDefaultRealmWithValue:@[@\"b\", @2]];\n    [realm commitWriteTransaction];\n\n    RLMResults *notActuallySorted = [DogObject.allObjects sortedResultsUsingDescriptors:@[]];\n    XCTAssertTrue([a2 isEqualToObject:notActuallySorted[0]]);\n    XCTAssertTrue([b1 isEqualToObject:notActuallySorted[1]]);\n    XCTAssertTrue([a1 isEqualToObject:notActuallySorted[2]]);\n    XCTAssertTrue([b2 isEqualToObject:notActuallySorted[3]]);\n}\n\n- (void)testSortByMultipleColumns {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n    DogObject *a1 = [DogObject createInDefaultRealmWithValue:@[@\"a\", @1]];\n    DogObject *a2 = [DogObject createInDefaultRealmWithValue:@[@\"a\", @2]];\n    DogObject *b1 = [DogObject createInDefaultRealmWithValue:@[@\"b\", @1]];\n    DogObject *b2 = [DogObject createInDefaultRealmWithValue:@[@\"b\", @2]];\n    [realm commitWriteTransaction];\n\n    bool (^checkOrder)(NSArray *, NSArray *, NSArray *) = ^bool(NSArray *properties, NSArray *ascending, NSArray *dogs) {\n        NSArray *sort = @[[RLMSortDescriptor sortDescriptorWithKeyPath:properties[0] ascending:[ascending[0] boolValue]],\n                          [RLMSortDescriptor sortDescriptorWithKeyPath:properties[1] ascending:[ascending[1] boolValue]]];\n        RLMResults *actual = [DogObject.allObjects sortedResultsUsingDescriptors:sort];\n        return [actual[0] isEqualToObject:dogs[0]]\n            && [actual[1] isEqualToObject:dogs[1]]\n            && [actual[2] isEqualToObject:dogs[2]]\n            && [actual[3] isEqualToObject:dogs[3]];\n    };\n\n    // Check each valid sort\n    XCTAssertTrue(checkOrder(@[@\"dogName\", @\"age\"], @[@YES, @YES], @[a1, a2, b1, b2]));\n    XCTAssertTrue(checkOrder(@[@\"dogName\", @\"age\"], @[@YES, @NO], @[a2, a1, b2, b1]));\n    XCTAssertTrue(checkOrder(@[@\"dogName\", @\"age\"], @[@NO, @YES], @[b1, b2, a1, a2]));\n    XCTAssertTrue(checkOrder(@[@\"dogName\", @\"age\"], @[@NO, @NO], @[b2, b1, a2, a1]));\n    XCTAssertTrue(checkOrder(@[@\"age\", @\"dogName\"], @[@YES, @YES], @[a1, b1, a2, b2]));\n    XCTAssertTrue(checkOrder(@[@\"age\", @\"dogName\"], @[@YES, @NO], @[b1, a1, b2, a2]));\n    XCTAssertTrue(checkOrder(@[@\"age\", @\"dogName\"], @[@NO, @YES], @[a2, b2, a1, b1]));\n    XCTAssertTrue(checkOrder(@[@\"age\", @\"dogName\"], @[@NO, @NO], @[b2, a2, b1, a1]));\n}\n\n- (void)testSortByKeyPath {\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    DogObject *lucy = [DogObject createInDefaultRealmWithValue:@[@\"Lucy\", @7]];\n    DogObject *freyja = [DogObject createInDefaultRealmWithValue:@[@\"Freyja\", @6]];\n    DogObject *ziggy = [DogObject createInDefaultRealmWithValue:@[@\"Ziggy\", @9]];\n\n    OwnerObject *mark = [OwnerObject createInDefaultRealmWithValue:@[@\"Mark\", freyja]];\n    OwnerObject *diane = [OwnerObject createInDefaultRealmWithValue:@[@\"Diane\", lucy]];\n    OwnerObject *hannah = [OwnerObject createInDefaultRealmWithValue:@[@\"Hannah\"]];\n    OwnerObject *don = [OwnerObject createInDefaultRealmWithValue:@[@\"Don\", ziggy]];\n    OwnerObject *diane_sr = [OwnerObject createInDefaultRealmWithValue:@[@\"Diane Sr\", ziggy]];\n\n    [realm commitWriteTransaction];\n\n    NSArray *(^asArray)(RLMResults *) = ^(RLMResults *results) {\n        return [[self evaluate:results] valueForKeyPath:@\"self\"];\n    };\n\n    RLMResults *r1 = [OwnerObject.allObjects sortedResultsUsingKeyPath:@\"dog.age\" ascending:YES];\n    XCTAssertEqualObjects(asArray(r1), (@[ mark, diane, don, diane_sr, hannah ]));\n\n    RLMResults *r2 = [OwnerObject.allObjects sortedResultsUsingKeyPath:@\"dog.age\" ascending:NO];\n    XCTAssertEqualObjects(asArray(r2), (@[ hannah, don, diane_sr, diane, mark ]));\n\n    RLMResults *r3 = [OwnerObject.allObjects sortedResultsUsingDescriptors:@[\n                         [RLMSortDescriptor sortDescriptorWithKeyPath:@\"dog.age\" ascending:YES],\n                         [RLMSortDescriptor sortDescriptorWithKeyPath:@\"name\" ascending:YES]\n    ]];\n    XCTAssertEqualObjects(asArray(r3), (@[ mark, diane, diane_sr, don, hannah ]));\n\n    RLMResults *r4 = [OwnerObject.allObjects sortedResultsUsingDescriptors:@[\n                         [RLMSortDescriptor sortDescriptorWithKeyPath:@\"dog.age\" ascending:NO],\n                         [RLMSortDescriptor sortDescriptorWithKeyPath:@\"name\" ascending:YES]\n    ]];\n    XCTAssertEqualObjects(asArray(r4), (@[ hannah, diane_sr, don, diane, mark ]));\n}\n\n- (void)testSortByUnspportedKeyPath {\n    // Array property\n    RLMAssertThrowsWithReason([DogArrayObject.allObjects sortedResultsUsingKeyPath:@\"dogs.age\" ascending:YES],\n                              @\"Cannot sort on key path 'dogs.age': property 'DogArrayObject.dogs' is of unsupported type 'array'.\");\n\n    // Backlinks property\n    RLMAssertThrowsWithReason([DogObject.allObjects sortedResultsUsingKeyPath:@\"owners.name\" ascending:YES],\n                              @\"Cannot sort on key path 'owners.name': property 'DogObject.owners' is of unsupported type 'linking objects'.\");\n\n    // Collection operator\n    RLMAssertThrowsWithReason([DogArrayObject.allObjects sortedResultsUsingKeyPath:@\"dogs.@count\" ascending:YES],\n                              @\"Cannot sort on key path 'dogs.@count': KVC collection operators are not supported.\");\n}\n\n- (void)testSortedLinkViewWithDeletion {\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n\n    StringObject *stringObj = [StringObject new];\n    stringObj.stringCol = @\"string\";\n\n    ArrayOfAllTypesObject *arrayOfAll = [ArrayOfAllTypesObject createInRealm:realm withValue:@{}];\n    SetOfAllTypesObject *setOfAll = [SetOfAllTypesObject createInRealm:realm withValue:@{}];\n    DictionaryOfAllTypesObject *dictOfAll = [DictionaryOfAllTypesObject createInRealm:realm withValue:\n                                             @{@\"dictionary\": @{\n                                                       @\"1\": [AllTypesObject values:1 stringObject:stringObj],\n                                                       @\"2\": [AllTypesObject values:2 stringObject:stringObj],\n                                                       @\"3\": [AllTypesObject values:3 stringObject:stringObj],\n                                                       @\"4\": [AllTypesObject values:4 stringObject:stringObj],\n                                             }}];\n    [arrayOfAll.array addObjects:@[\n        [AllTypesObject values:1 stringObject:stringObj],\n        [AllTypesObject values:2 stringObject:stringObj],\n        [AllTypesObject values:3 stringObject:stringObj],\n        [AllTypesObject values:4 stringObject:stringObj],\n    ]];\n\n    [setOfAll.set addObjects:@[\n        [AllTypesObject values:1 stringObject:stringObj],\n        [AllTypesObject values:2 stringObject:stringObj],\n        [AllTypesObject values:3 stringObject:stringObj],\n        [AllTypesObject values:4 stringObject:stringObj],\n    ]];\n\n    [realm commitWriteTransaction];\n\n    RLMResults *results = [arrayOfAll.array sortedResultsUsingKeyPath:@\"stringCol\" ascending:NO];\n    XCTAssertEqualObjects([results[0] stringCol], @\"d\");\n\n    RLMResults *results2 = [setOfAll.set sortedResultsUsingKeyPath:@\"stringCol\" ascending:NO];\n    XCTAssertEqualObjects([results2[0] stringCol], @\"d\");\n\n    RLMResults *results3 = [dictOfAll.dictionary sortedResultsUsingKeyPath:@\"stringCol\" ascending:NO];\n    XCTAssertEqualObjects([results3[0] stringCol], @\"d\");\n\n    // delete d, add e results should update\n    [realm transactionWithBlock:^{\n        [arrayOfAll.array removeObjectAtIndex:3];\n        [setOfAll.set removeObject:setOfAll.set.allObjects[3]];\n        [dictOfAll.dictionary removeObjectForKey:@\"4\"];\n        [arrayOfAll.array addObject:(id)[AllTypesObject values:5 stringObject:stringObj]];\n        [setOfAll.set addObject:(id)[AllTypesObject values:5 stringObject:stringObj]];\n        dictOfAll.dictionary[@\"5\"] = [[AllTypesObject alloc] initWithValue:[AllTypesObject values:5 stringObject:stringObj]];\n    }];\n    XCTAssertEqualObjects([results[0] stringCol], @\"e\");\n    XCTAssertEqualObjects([results[1] stringCol], @\"c\");\n    XCTAssertEqualObjects([results2[0] stringCol], @\"e\");\n    XCTAssertEqualObjects([results2[1] stringCol], @\"c\");\n    XCTAssertEqualObjects([results3[0] stringCol], @\"e\");\n    XCTAssertEqualObjects([results3[1] stringCol], @\"c\");\n\n    // delete from realm should be removed from results\n    [realm transactionWithBlock:^{\n        [realm deleteObject:arrayOfAll.array.lastObject];\n        [realm deleteObject:setOfAll.set.allObjects.lastObject];\n    }];\n    XCTAssertEqualObjects([results[0] stringCol], @\"c\");\n    XCTAssertEqualObjects([results2[0] stringCol], @\"c\");\n}\n\n- (void)testQueryingSortedQueryPreservesOrder {\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    for (int i = 0; i < 5; ++i) {\n        [IntObject createInRealm:realm withValue:@[@(i)]];\n    }\n\n    ArrayPropertyObject *array = [ArrayPropertyObject createInRealm:realm withValue:@[@\"name\", @[], [IntObject allObjects]]];\n    SetPropertyObject *set = [SetPropertyObject createInRealm:realm withValue:@[@\"name\", @[], [IntObject allObjects]]];\n    DictionaryPropertyObject *dict = [DictionaryPropertyObject createInRealm:realm withValue:@{}];\n    for (IntObject *io in [IntObject allObjects]) {\n        dict.intObjDictionary[[NSUUID UUID].UUIDString] = io;\n    }\n    [realm commitWriteTransaction];\n\n    RLMResults *asc = [IntObject.allObjects sortedResultsUsingKeyPath:@\"intCol\" ascending:YES];\n    RLMResults *desc = [IntObject.allObjects sortedResultsUsingKeyPath:@\"intCol\" ascending:NO];\n\n    // sanity check; would work even without sort order being preserved\n    XCTAssertEqual(2, [[[asc objectsWhere:@\"intCol >= 2\"] firstObject] intCol]);\n\n    // check query on allObjects and query on query\n    XCTAssertEqual(4, [[[desc objectsWhere:@\"intCol >= 2\"] firstObject] intCol]);\n    XCTAssertEqual(3, [[[[desc objectsWhere:@\"intCol >= 2\"] objectsWhere:@\"intCol < 4\"] firstObject] intCol]);\n\n    // same thing but on an linkview\n    asc = [array.intArray sortedResultsUsingKeyPath:@\"intCol\" ascending:YES];\n    desc = [array.intArray sortedResultsUsingKeyPath:@\"intCol\" ascending:NO];\n\n    XCTAssertEqual(2, [[[asc objectsWhere:@\"intCol >= 2\"] firstObject] intCol]);\n    XCTAssertEqual(4, [[[desc objectsWhere:@\"intCol >= 2\"] firstObject] intCol]);\n    XCTAssertEqual(3, [[[[desc objectsWhere:@\"intCol >= 2\"] objectsWhere:@\"intCol < 4\"] firstObject] intCol]);\n\n    asc = [set.intSet sortedResultsUsingKeyPath:@\"intCol\" ascending:YES];\n    desc = [set.intSet sortedResultsUsingKeyPath:@\"intCol\" ascending:NO];\n\n    XCTAssertEqual(2, [[[asc objectsWhere:@\"intCol >= 2\"] firstObject] intCol]);\n    XCTAssertEqual(4, [[[desc objectsWhere:@\"intCol >= 2\"] firstObject] intCol]);\n    XCTAssertEqual(3, [[[[desc objectsWhere:@\"intCol >= 2\"] objectsWhere:@\"intCol < 4\"] firstObject] intCol]);\n\n    asc = [dict.intObjDictionary sortedResultsUsingKeyPath:@\"intCol\" ascending:YES];\n    desc = [dict.intObjDictionary sortedResultsUsingKeyPath:@\"intCol\" ascending:NO];\n\n    XCTAssertEqual(2, [[[asc objectsWhere:@\"intCol >= 2\"] firstObject] intCol]);\n    XCTAssertEqual(4, [[[desc objectsWhere:@\"intCol >= 2\"] firstObject] intCol]);\n    XCTAssertEqual(3, [[[[desc objectsWhere:@\"intCol >= 2\"] objectsWhere:@\"intCol < 4\"] firstObject] intCol]);\n}\n\n- (void)testTwoColumnComparison\n{\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n\n    NSArray<NSArray *> *values = [self queryObjectClassValues];\n    for (id value in values) {\n        [self.queryObjectClass createInRealm:realm withValue:value];\n    }\n    QueryObject *first = [[self.queryObjectClass allObjectsInRealm:realm] firstObject];\n    first.object1 = first;\n\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(self.queryObjectClass, 7U, @\"bool1 == bool1\");\n    RLMAssertCount(self.queryObjectClass, 3U, @\"bool1 == bool2\");\n    RLMAssertCount(self.queryObjectClass, 4U, @\"bool1 != bool2\");\n\n    RLMAssertCount(self.queryObjectClass, 7U, @\"int1 == int1\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"int1 == int2\");\n    RLMAssertCount(self.queryObjectClass, 5U, @\"int1 != int2\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"int1 > int2\");\n    RLMAssertCount(self.queryObjectClass, 4U, @\"int1 < int2\");\n    RLMAssertCount(self.queryObjectClass, 3U, @\"int1 >= int2\");\n    RLMAssertCount(self.queryObjectClass, 6U, @\"int1 <= int2\");\n\n    RLMAssertCount(self.queryObjectClass, 7U, @\"float1 == float1\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"float1 == float2\");\n    RLMAssertCount(self.queryObjectClass, 6U, @\"float1 != float2\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"float1 > float2\");\n    RLMAssertCount(self.queryObjectClass, 4U, @\"float1 < float2\");\n    RLMAssertCount(self.queryObjectClass, 3U, @\"float1 >= float2\");\n    RLMAssertCount(self.queryObjectClass, 5U, @\"float1 <= float2\");\n\n    RLMAssertCount(self.queryObjectClass, 7U, @\"double1 == double1\");\n    RLMAssertCount(self.queryObjectClass, 0U, @\"double1 == double2\");\n    RLMAssertCount(self.queryObjectClass, 7U, @\"double1 != double2\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"double1 > double2\");\n    RLMAssertCount(self.queryObjectClass, 6U, @\"double1 < double2\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"double1 >= double2\");\n    RLMAssertCount(self.queryObjectClass, 6U, @\"double1 <= double2\");\n\n    RLMAssertCount(self.queryObjectClass, 7U, @\"string1 == string1\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"string1 == string2\");\n    RLMAssertCount(self.queryObjectClass, 6U, @\"string1 != string2\");\n    RLMAssertCount(self.queryObjectClass, 7U, @\"string1 CONTAINS string1\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"string1 CONTAINS string2\");\n    RLMAssertCount(self.queryObjectClass, 3U, @\"string2 CONTAINS string1\");\n    RLMAssertCount(self.queryObjectClass, 7U, @\"string1 BEGINSWITH string1\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"string1 BEGINSWITH string2\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"string2 BEGINSWITH string1\");\n    RLMAssertCount(self.queryObjectClass, 7U, @\"string1 ENDSWITH string1\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"string1 ENDSWITH string2\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"string2 ENDSWITH string1\");\n    RLMAssertCount(self.queryObjectClass, 7U, @\"string1 LIKE string1\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"string1 LIKE string2\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"string2 LIKE string1\");\n\n    RLMAssertCount(self.queryObjectClass, 7U, @\"string1 ==[c] string1\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"string1 ==[c] string2\");\n    RLMAssertCount(self.queryObjectClass, 5U, @\"string1 !=[c] string2\");\n    RLMAssertCount(self.queryObjectClass, 7U, @\"string1 CONTAINS[c] string1\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"string1 CONTAINS[c] string2\");\n    RLMAssertCount(self.queryObjectClass, 6U, @\"string2 CONTAINS[c] string1\");\n    RLMAssertCount(self.queryObjectClass, 7U, @\"string1 BEGINSWITH[c] string1\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"string1 BEGINSWITH[c] string2\");\n    RLMAssertCount(self.queryObjectClass, 4U, @\"string2 BEGINSWITH[c] string1\");\n    RLMAssertCount(self.queryObjectClass, 7U, @\"string1 ENDSWITH[c] string1\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"string1 ENDSWITH[c] string2\");\n    RLMAssertCount(self.queryObjectClass, 4U, @\"string2 ENDSWITH[c] string1\");\n    RLMAssertCount(self.queryObjectClass, 7U, @\"string1 LIKE[c] string1\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"string1 LIKE[c] string2\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"string2 LIKE[c] string1\");\n\n    RLMAssertCount(self.queryObjectClass, 7U, @\"data1 == data1\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"data1 == data2\");\n    RLMAssertCount(self.queryObjectClass, 6U, @\"data1 != data2\");\n    RLMAssertCount(self.queryObjectClass, 7U, @\"data1 CONTAINS data1\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"data1 CONTAINS data2\");\n    RLMAssertCount(self.queryObjectClass, 3U, @\"data2 CONTAINS data1\");\n    RLMAssertCount(self.queryObjectClass, 7U, @\"data1 BEGINSWITH data1\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"data1 BEGINSWITH data2\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"data2 BEGINSWITH data1\");\n    RLMAssertCount(self.queryObjectClass, 7U, @\"data1 ENDSWITH data1\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"data1 ENDSWITH data2\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"data2 ENDSWITH data1\");\n    RLMAssertCount(self.queryObjectClass, 7U, @\"data1 LIKE data1\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"data1 LIKE data2\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"data2 LIKE data1\");\n\n    RLMAssertCount(self.queryObjectClass, 7U, @\"data1 ==[c] data1\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"data1 ==[c] data2\");\n    RLMAssertCount(self.queryObjectClass, 5U, @\"data1 !=[c] data2\");\n    RLMAssertCount(self.queryObjectClass, 7U, @\"data1 CONTAINS[c] data1\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"data1 CONTAINS[c] data2\");\n    RLMAssertCount(self.queryObjectClass, 6U, @\"data2 CONTAINS[c] data1\");\n    RLMAssertCount(self.queryObjectClass, 7U, @\"data1 BEGINSWITH[c] data1\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"data1 BEGINSWITH[c] data2\");\n    RLMAssertCount(self.queryObjectClass, 4U, @\"data2 BEGINSWITH[c] data1\");\n    RLMAssertCount(self.queryObjectClass, 7U, @\"data1 ENDSWITH[c] data1\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"data1 ENDSWITH[c] data2\");\n    RLMAssertCount(self.queryObjectClass, 4U, @\"data2 ENDSWITH[c] data1\");\n    RLMAssertCount(self.queryObjectClass, 7U, @\"data1 LIKE[c] data1\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"data1 LIKE[c] data2\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"data2 LIKE[c] data1\");\n\n    RLMAssertCount(self.queryObjectClass, 7U, @\"decimal1 == decimal1\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"decimal1 == decimal2\");\n    RLMAssertCount(self.queryObjectClass, 5U, @\"decimal1 != decimal2\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"decimal1 > decimal2\");\n    RLMAssertCount(self.queryObjectClass, 4U, @\"decimal1 < decimal2\");\n    RLMAssertCount(self.queryObjectClass, 3U, @\"decimal1 >= decimal2\");\n    RLMAssertCount(self.queryObjectClass, 6U, @\"decimal1 <= decimal2\");\n\n    RLMAssertCount(self.queryObjectClass, 7U, @\"objectId1 == objectId1\");\n    RLMAssertCount(self.queryObjectClass, 3U, @\"objectId1 == objectId2\");\n    RLMAssertCount(self.queryObjectClass, 4U, @\"objectId1 != objectId2\");\n\n    RLMAssertCount(self.queryObjectClass, 7U, @\"object1 == object1\");\n    RLMAssertCount(self.queryObjectClass, 6U, @\"object1 == object2\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"object1 != object2\");\n\n    RLMAssertCount(self.queryObjectClass, 7U, @\"any1 == any1\");\n    RLMAssertCount(self.queryObjectClass, 0U, @\"any1 == any2\");\n    RLMAssertCount(self.queryObjectClass, 7U, @\"any1 != any2\");\n\n    RLMAssertCount(self.queryObjectClass, 7U, @\"any1 ==[c] any1\");\n    RLMAssertCount(self.queryObjectClass, 0U, @\"any1 ==[c] any2\");\n    RLMAssertCount(self.queryObjectClass, 0U, @\"any1 !=[c] any1\");\n\n    RLMAssertThrowsWithReasonMatching([self.queryObjectClass objectsWhere:@\"int1 == float1\"],\n                                      @\"Property type mismatch between int and float\");\n    RLMAssertThrowsWithReasonMatching([self.queryObjectClass objectsWhere:@\"float2 >= double1\"],\n                                      @\"Property type mismatch between float and double\");\n    RLMAssertThrowsWithReasonMatching([self.queryObjectClass objectsWhere:@\"double2 <= int2\"],\n                                      @\"Property type mismatch between double and int\");\n    RLMAssertThrowsWithReasonMatching([self.queryObjectClass objectsWhere:@\"int2 != string1\"],\n                                      @\"Property type mismatch between int and string\");\n    RLMAssertThrowsWithReasonMatching([self.queryObjectClass objectsWhere:@\"float1 > string1\"],\n                                      @\"Property type mismatch between float and string\");\n    RLMAssertThrowsWithReasonMatching([self.queryObjectClass objectsWhere:@\"double1 < string1\"],\n                                      @\"Property type mismatch between double and string\");\n    RLMAssertThrowsWithReasonMatching([self.queryObjectClass objectsWhere:@\"double1 LIKE string1\"],\n                                      @\"Property type mismatch between double and string\");\n    RLMAssertThrowsWithReasonMatching([self.queryObjectClass objectsWhere:@\"string1 LIKE double1\"],\n                                      @\"Property type mismatch between string and double\");\n}\n\n- (void)testBooleanPredicate\n{\n    RLMAssertCount(BoolObject, 0U, @\"boolCol == TRUE\");\n    RLMAssertCount(BoolObject, 0U, @\"boolCol != TRUE\");\n\n    XCTAssertThrows([BoolObject objectsWhere:@\"boolCol == NULL\"]);\n    XCTAssertThrows([BoolObject objectsWhere:@\"boolCol != NULL\"]);\n\n    XCTAssertThrowsSpecificNamed([BoolObject objectsWhere:@\"boolCol >= TRUE\"],\n                                 NSException,\n                                 @\"Invalid operator type\",\n                                 @\"Invalid operator in bool predicate.\");\n}\n\n- (void)testStringBeginsWith\n{\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    StringObject *so = [StringObject createInRealm:realm withValue:@[@\"abc\"]];\n    [StringObject createInRealm:realm withValue:@[@\"üvw\"]];\n    [StringObject createInRealm:realm withValue:@[@\"ûvw\"]];\n    [StringObject createInRealm:realm withValue:@[@\"uvw\"]];\n    [StringObject createInRealm:realm withValue:@[@\"stü\"]];\n    AllTypesObject *ato = [AllTypesObject createInRealm:realm\n                                              withValue:[AllTypesObject values:1 stringObject:so]];\n    ato.anyCol = @\"abc\"; // overwrite int\n    ato.mixedObjectCol = [MixedObject createInRealm:realm withValue:@[@\"abc\"]];\n    [MixedObject createInRealm:realm withValue:@[@\"üvw\"]];\n    [MixedObject createInRealm:realm withValue:@[@\"ûvw\"]];\n    [MixedObject createInRealm:realm withValue:@[@\"uvw\"]];\n    [MixedObject createInRealm:realm withValue:@[@\"stü\"]];\n    [realm commitWriteTransaction];\n\n    void (^testBlock)(NSString *, NSString *, Class) = ^(NSString * objectCol, NSString *colName, Class cls) {\n        RLMAssertCount(cls, 1U, @\"%K BEGINSWITH 'a'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K BEGINSWITH 'ab'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K BEGINSWITH 'abc'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K BEGINSWITH 'abcd'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K BEGINSWITH 'abd'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K BEGINSWITH 'c'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K BEGINSWITH 'A'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K BEGINSWITH ''\", colName);\n        RLMAssertCount(cls, 1U, @\"%K BEGINSWITH[c] 'a'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K BEGINSWITH[c] 'A'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K BEGINSWITH[c] ''\", colName);\n        RLMAssertCount(cls, 0U, @\"%K BEGINSWITH[d] ''\", colName);\n        RLMAssertCount(cls, 0U, @\"%K BEGINSWITH[cd] ''\", colName);\n\n        RLMAssertCount(cls, 1U, @\"%K BEGINSWITH 'u'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K BEGINSWITH[c] 'U'\", colName);\n        RLMAssertCount(cls, 3U, @\"%K BEGINSWITH[d] 'u'\", colName);\n        RLMAssertCount(cls, 3U, @\"%K BEGINSWITH[cd] 'U'\", colName);\n\n        RLMAssertCount(cls, 1U, @\"%K BEGINSWITH 'ü'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K BEGINSWITH[c] 'Ü'\", colName);\n        RLMAssertCount(cls, 3U, @\"%K BEGINSWITH[d] 'ü'\", colName);\n        RLMAssertCount(cls, 3U, @\"%K BEGINSWITH[cd] 'Ü'\", colName);\n\n        RLMAssertCount(cls, 0U, @\"%K BEGINSWITH NULL\", colName);\n        RLMAssertCount(cls, 0U, @\"%K BEGINSWITH[c] NULL\", colName);\n        RLMAssertCount(cls, 0U, @\"%K BEGINSWITH[d] NULL\", colName);\n        RLMAssertCount(cls, 0U, @\"%K BEGINSWITH[cd] NULL\", colName);\n\n        RLMAssertCount(AllTypesObject, 1U, @\"%K.%K BEGINSWITH 'a'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K BEGINSWITH 'c'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K BEGINSWITH 'A'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K BEGINSWITH ''\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 1U, @\"%K.%K BEGINSWITH[c] 'a'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 1U, @\"%K.%K BEGINSWITH[c] 'A'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K BEGINSWITH[c] ''\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K BEGINSWITH[d] ''\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K BEGINSWITH[cd] ''\", objectCol, colName);\n\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K BEGINSWITH NULL\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K BEGINSWITH[c] NULL\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K BEGINSWITH[d] NULL\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K BEGINSWITH[cd] NULL\", objectCol, colName);\n    };\n\n    testBlock(@\"objectCol\", @\"stringCol\", [StringObject class]);\n    testBlock(@\"mixedObjectCol\", @\"anyCol\", [MixedObject class]);\n}\n\n- (void)testStringEndsWith\n{\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    StringObject *so = [StringObject createInRealm:realm withValue:@[@\"abc\"]];\n    [StringObject createInRealm:realm withValue:@[@\"üvw\"]];\n    [StringObject createInRealm:realm withValue:@[@\"ûvw\"]];\n    [StringObject createInRealm:realm withValue:@[@\"uvü\"]];\n    [StringObject createInRealm:realm withValue:@[@\"stu\"]];\n    AllTypesObject *ato = [AllTypesObject createInRealm:realm\n                                              withValue:[AllTypesObject values:1 stringObject:so]];\n    ato.anyCol = @\"abc\"; // overwrite int\n    ato.mixedObjectCol = [MixedObject createInRealm:realm withValue:@[@\"abc\"]];\n    [MixedObject createInRealm:realm withValue:@[@\"üvw\"]];\n    [MixedObject createInRealm:realm withValue:@[@\"ûvw\"]];\n    [MixedObject createInRealm:realm withValue:@[@\"uvü\"]];\n    [MixedObject createInRealm:realm withValue:@[@\"stu\"]];\n    [realm commitWriteTransaction];\n\n    void (^testBlock)(NSString *, NSString *, Class) = ^(NSString *objectCol, NSString *colName, Class cls) {\n        RLMAssertCount(cls, 1U, @\"%K ENDSWITH 'c'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K ENDSWITH 'bc'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K ENDSWITH 'abc'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K ENDSWITH 'aabc'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K ENDSWITH 'bbc'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K ENDSWITH 'a'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K ENDSWITH 'C'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K ENDSWITH ''\", colName);\n        RLMAssertCount(cls, 1U, @\"%K ENDSWITH[c] 'c'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K ENDSWITH[c] 'C'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K ENDSWITH[c] ''\", colName);\n        RLMAssertCount(cls, 0U, @\"%K ENDSWITH[d] ''\", colName);\n        RLMAssertCount(cls, 0U, @\"%K ENDSWITH[cd] ''\", colName);\n\n        RLMAssertCount(cls, 1U, @\"%K ENDSWITH 'u'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K ENDSWITH[c] 'U'\", colName);\n        RLMAssertCount(cls, 2U, @\"%K ENDSWITH[d] 'u'\", colName);\n        RLMAssertCount(cls, 2U, @\"%K ENDSWITH[cd] 'U'\", colName);\n\n        RLMAssertCount(cls, 1U, @\"%K ENDSWITH 'ü'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K ENDSWITH[c] 'Ü'\", colName);\n        RLMAssertCount(cls, 2U, @\"%K ENDSWITH[d] 'ü'\", colName);\n        RLMAssertCount(cls, 2U, @\"%K ENDSWITH[cd] 'Ü'\", colName);\n\n        RLMAssertCount(cls, 0U, @\"%K ENDSWITH NULL\", colName);\n        RLMAssertCount(cls, 0U, @\"%K ENDSWITH[c] NULL\", colName);\n        RLMAssertCount(cls, 0U, @\"%K ENDSWITH[d] NULL\", colName);\n        RLMAssertCount(cls, 0U, @\"%K ENDSWITH[cd] NULL\", colName);\n\n        RLMAssertCount(AllTypesObject, 1U, @\"%K.%K ENDSWITH 'c'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K ENDSWITH 'a'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K ENDSWITH 'C'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K ENDSWITH ''\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 1U, @\"%K.%K ENDSWITH[c] 'c'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 1U, @\"%K.%K ENDSWITH[c] 'C'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K ENDSWITH[c] ''\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K ENDSWITH[d] ''\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K ENDSWITH[cd] ''\", objectCol, colName);\n\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K ENDSWITH NULL\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K ENDSWITH[c] NULL\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K ENDSWITH[d] NULL\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K ENDSWITH[cd] NULL\", objectCol, colName);\n    };\n    testBlock(@\"objectCol\", @\"stringCol\", [StringObject class]);\n    testBlock(@\"mixedObjectCol\", @\"anyCol\", [MixedObject class]);\n}\n\n- (void)testStringContains\n{\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    StringObject *so = [StringObject createInRealm:realm withValue:@[@\"abc\"]];\n    [StringObject createInRealm:realm withValue:@[@\"tüv\"]];\n    [StringObject createInRealm:realm withValue:@[@\"tûv\"]];\n    [StringObject createInRealm:realm withValue:@[@\"tuv\"]];\n    AllTypesObject *ato = [AllTypesObject createInRealm:realm\n                                              withValue:[AllTypesObject values:1 stringObject:so]];\n    ato.anyCol = @\"abc\"; // overwrite int\n    ato.mixedObjectCol = [MixedObject createInRealm:realm withValue:@[@\"abc\"]];\n    [MixedObject createInRealm:realm withValue:@[@\"tüv\"]];\n    [MixedObject createInRealm:realm withValue:@[@\"tûv\"]];\n    [MixedObject createInRealm:realm withValue:@[@\"tuv\"]];\n    [realm commitWriteTransaction];\n\n    void (^testBlock)(NSString *, NSString *, Class) = ^(NSString *objectCol, NSString *colName, Class cls) {\n        RLMAssertCount(cls, 1U, @\"%K CONTAINS 'a'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K CONTAINS 'b'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K CONTAINS 'c'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K CONTAINS 'ab'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K CONTAINS 'bc'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K CONTAINS 'abc'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K CONTAINS 'd'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K CONTAINS 'aabc'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K CONTAINS 'bbc'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K CONTAINS ''\", colName);\n\n        RLMAssertCount(cls, 0U, @\"%K CONTAINS 'C'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K CONTAINS[c] 'c'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K CONTAINS[c] 'C'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K CONTAINS[c] ''\", colName);\n\n        RLMAssertCount(cls, 1U, @\"%K CONTAINS 'u'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K CONTAINS[c] 'U'\", colName);\n        RLMAssertCount(cls, 3U, @\"%K CONTAINS[d] 'u'\", colName);\n        RLMAssertCount(cls, 3U, @\"%K CONTAINS[cd] 'U'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K CONTAINS[d] ''\", colName);\n        RLMAssertCount(cls, 0U, @\"%K CONTAINS[cd] ''\", colName);\n\n        RLMAssertCount(cls, 1U, @\"%K CONTAINS 'ü'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K CONTAINS[c] 'Ü'\", colName);\n        RLMAssertCount(cls, 3U, @\"%K CONTAINS[d] 'ü'\", colName);\n        RLMAssertCount(cls, 3U, @\"%K CONTAINS[cd] 'Ü'\", colName);\n\n        RLMAssertCount(cls, 0U, @\"%K CONTAINS NULL\", colName);\n        RLMAssertCount(cls, 0U, @\"%K CONTAINS[c] NULL\", colName);\n        RLMAssertCount(cls, 0U, @\"%K CONTAINS[d] NULL\", colName);\n        RLMAssertCount(cls, 0U, @\"%K CONTAINS[cd] NULL\", colName);\n\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K CONTAINS 'd'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 1U, @\"%K.%K CONTAINS 'c'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K CONTAINS 'C'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K CONTAINS ''\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 1U, @\"%K.%K CONTAINS[c] 'c'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 1U, @\"%K.%K CONTAINS[c] 'C'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K CONTAINS[c] ''\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K CONTAINS[d] ''\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K CONTAINS[cd] ''\", objectCol, colName);\n\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K CONTAINS NULL\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K CONTAINS[c] NULL\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K CONTAINS[d] NULL\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K CONTAINS[cd] NULL\", objectCol, colName);\n    };\n\n    testBlock(@\"objectCol\", @\"stringCol\", [StringObject class]);\n    testBlock(@\"mixedObjectCol\", @\"anyCol\", [MixedObject class]);\n}\n\n- (void)testStringLike\n{\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    StringObject *so = [StringObject createInRealm:realm withValue:(@[@\"abc\"])];\n    AllTypesObject *ato = [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:1 stringObject:so]];\n    ato.mixedObjectCol = [MixedObject createInRealm:realm withValue:@[@\"abc\"]];\n    [realm commitWriteTransaction];\n\n    void (^testBlock)(NSString *, NSString *, Class) = ^(NSString *objectCol, NSString *colName, Class cls) {\n        RLMAssertCount(cls, 1U, @\"%K LIKE '*a*'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K LIKE '*b*'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K LIKE '*c'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K LIKE 'ab*'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K LIKE '*bc'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K LIKE 'a*bc'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K LIKE '*abc*'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K LIKE '*d*'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K LIKE 'aabc'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K LIKE 'b*bc'\", colName);\n\n        RLMAssertCount(cls, 1U, @\"%K LIKE 'a?\" \"?'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K LIKE '?b?'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K LIKE '*?c'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K LIKE 'ab?'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K LIKE '?bc'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K LIKE '?d?'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K LIKE '?abc'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K LIKE 'b?bc'\", colName);\n\n        RLMAssertCount(cls, 0U, @\"%K LIKE '*C*'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K LIKE[c] '*c*'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K LIKE[c] '*C*'\", colName);\n\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K LIKE '*d*'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 1U, @\"%K.%K LIKE '*c*'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K LIKE '*C*'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 1U, @\"%K.%K LIKE[c] '*c*'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 1U, @\"%K.%K LIKE[c] '*C*'\", objectCol, colName);\n\n        RLMAssertThrowsWithReasonMatching(([cls objectsWhere:@\"%K LIKE[d] '*'\", colName]),\n                                          @\"'LIKE' not supported .* diacritic-insensitive\");\n        RLMAssertThrowsWithReasonMatching(([cls objectsWhere:@\"%K LIKE[cd] '*'\", colName]),\n                                          @\"'LIKE' not supported .* diacritic-insensitive\");\n    };\n\n    testBlock(@\"objectCol\", @\"stringCol\", [StringObject class]);\n    testBlock(@\"mixedObjectCol\", @\"anyCol\", [MixedObject class]);\n}\n\n- (void)testStringEquality\n{\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    StringObject *so = [StringObject createInRealm:realm withValue:@[@\"abc\"]];\n    [StringObject createInRealm:realm withValue:@[@\"tüv\"]];\n    [StringObject createInRealm:realm withValue:@[@\"tûv\"]];\n    [StringObject createInRealm:realm withValue:@[@\"tuv\"]];\n    AllTypesObject *ato = [AllTypesObject createInRealm:realm\n                                              withValue:[AllTypesObject values:1 stringObject:so]];\n    ato.anyCol = @\"abc\"; // overwrite int\n    ato.mixedObjectCol = [MixedObject createInRealm:realm withValue:@[@\"abc\"]];\n    [MixedObject createInRealm:realm withValue:@[@\"tüv\"]];\n    [MixedObject createInRealm:realm withValue:@[@\"tûv\"]];\n    [MixedObject createInRealm:realm withValue:@[@\"tuv\"]];\n    [realm commitWriteTransaction];\n\n    void (^testBlock)(NSString *, NSString *, Class) = ^(NSString *objectCol, NSString *colName, Class cls) {\n        RLMAssertCount(cls, 1U, @\"%K == 'abc'\", colName);\n        RLMAssertCount(cls, 4U, @\"%K != 'def'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K ==[c] 'abc'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K ==[c] 'ABC'\", colName);\n\n        RLMAssertCount(cls, 3U, @\"%K != 'abc'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K == 'def'\", colName);\n        RLMAssertCount(cls, 0U, @\"%K == 'ABC'\", colName);\n\n        RLMAssertCount(cls, 1U, @\"%K == 'tuv'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K ==[c] 'TUV'\", colName);\n        RLMAssertCount(cls, 3U, @\"%K ==[d] 'tuv'\", colName);\n        RLMAssertCount(cls, 3U, @\"%K ==[cd] 'TUV'\", colName);\n\n        RLMAssertCount(cls, 3U, @\"%K != 'tuv'\", colName);\n        RLMAssertCount(cls, 3U, @\"%K !=[c] 'TUV'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K !=[d] 'tuv'\", colName);\n        RLMAssertCount(cls, 1U, @\"%K !=[cd] 'TUV'\", colName);\n\n        RLMAssertCount(AllTypesObject, 1U, @\"%K.%K == 'abc'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 1U, @\"%K.%K != 'def'\", objectCol, colName);\n\n        RLMAssertCount(AllTypesObject, 1U, @\"%K.%K ==[c] 'abc'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 1U, @\"%K.%K ==[c] 'ABC'\", objectCol, colName);\n\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K != 'abc'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K == 'def'\", objectCol, colName);\n        RLMAssertCount(AllTypesObject, 0U, @\"%K.%K == 'ABC'\", objectCol, colName);\n    };\n\n    testBlock(@\"objectCol\", @\"stringCol\", [StringObject class]);\n    testBlock(@\"mixedObjectCol\", @\"anyCol\", [MixedObject class]);\n}\n\n- (void)testFloatQuery\n{\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    [FloatObject createInRealm:realm withValue:@[@1.7f]];\n    [MixedObject createInRealm:realm withValue:@[@1.7f]];\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(FloatObject, 1U, @\"floatCol > 1\");\n    RLMAssertCount(FloatObject, 1U, @\"floatCol > %d\", 1);\n    RLMAssertCount(FloatObject, 1U, @\"floatCol = 1.7\");\n    RLMAssertCount(FloatObject, 1U, @\"floatCol = %f\", 1.7f);\n    RLMAssertCount(FloatObject, 1U, @\"floatCol > 1.0\");\n    RLMAssertCount(FloatObject, 1U, @\"floatCol >= 1.0\");\n    RLMAssertCount(FloatObject, 0U, @\"floatCol < 1.0\");\n    RLMAssertCount(FloatObject, 0U, @\"floatCol <= 1.0\");\n    RLMAssertCount(FloatObject, 1U, @\"floatCol = %e\", 1.7);\n    RLMAssertCount(FloatObject, 0U, @\"floatCol == %f\", FLT_MAX);\n    RLMAssertCount(FloatObject, 1U, @\"floatCol BETWEEN %@\", @[@1.0, @2.0]);\n\n    // Mixed requires you to specify floats explicitly.\n    RLMAssertCount(MixedObject, 1U, @\"anyCol > 1\");\n    RLMAssertCount(MixedObject, 1U, @\"anyCol > %lf\", 1.0f);\n    RLMAssertCount(MixedObject, 1U, @\"anyCol = %@\", @1.7f);\n    RLMAssertCount(MixedObject, 1U, @\"anyCol = %f\", 1.7f);\n    RLMAssertCount(MixedObject, 1U, @\"anyCol > 1.0\");\n    RLMAssertCount(MixedObject, 1U, @\"anyCol >= 1.0\");\n    RLMAssertCount(MixedObject, 0U, @\"anyCol < 1.0\");\n    RLMAssertCount(MixedObject, 0U, @\"anyCol <= 1.0\");\n    RLMAssertCount(MixedObject, 1U, @\"anyCol = %e\", 1.7f);\n    RLMAssertCount(MixedObject, 0U, @\"anyCol == %f\", FLT_MAX);\n    RLMAssertCount(MixedObject, 1U, @\"anyCol BETWEEN %@\", @[@1.0, @2.0]);\n\n    XCTAssertThrows([FloatObject objectsInRealm:realm where:@\"floatCol = 3.5e+38\"],\n                    @\"Too large to be a float\");\n    XCTAssertThrows([FloatObject objectsInRealm:realm where:@\"floatCol = -3.5e+38\"],\n                    @\"Too small to be a float\");\n}\n\n- (void)testDecimalQuery {\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    [DecimalObject createInRealm:realm withValue:@[@\"-Inf\"]];\n    [DecimalObject createInRealm:realm withValue:@[@\"Inf\"]];\n    [DecimalObject createInRealm:realm withValue:@[@\"123456789.123456789e1234\"]];\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(DecimalObject, 0U, @\"decimalCol >  'Inf'\");\n    RLMAssertCount(DecimalObject, 1U, @\"decimalCol >= 'Inf'\");\n    RLMAssertCount(DecimalObject, 1U, @\"decimalCol == 'Inf'\");\n    RLMAssertCount(DecimalObject, 3U, @\"decimalCol <= 'Inf'\");\n    RLMAssertCount(DecimalObject, 2U, @\"decimalCol <  'Inf'\");\n\n    RLMAssertCount(DecimalObject, 2U, @\"decimalCol >  '-Inf'\");\n    RLMAssertCount(DecimalObject, 3U, @\"decimalCol >= '-Inf'\");\n    RLMAssertCount(DecimalObject, 1U, @\"decimalCol == '-Inf'\");\n    RLMAssertCount(DecimalObject, 1U, @\"decimalCol <= '-Inf'\");\n    RLMAssertCount(DecimalObject, 0U, @\"decimalCol <  '-Inf'\");\n\n    RLMAssertCount(DecimalObject, 1U, @\"decimalCol >  '123456789.123456789e1234'\");\n    RLMAssertCount(DecimalObject, 2U, @\"decimalCol >= '123456789.123456789e1234'\");\n    RLMAssertCount(DecimalObject, 1U, @\"decimalCol == '123456789.123456789e1234'\");\n    RLMAssertCount(DecimalObject, 2U, @\"decimalCol <= '123456789.123456789e1234'\");\n    RLMAssertCount(DecimalObject, 1U, @\"decimalCol <  '123456789.123456789e1234'\");\n}\n\n- (void)testLiveQueriesInsideTransaction\n{\n    RLMRealm *realm = [self realm];\n\n    NSMutableArray *values = [@[@YES, @YES, @1, @2, @23.0f, @1.7f,  @0.0,  @5.55, @\"\", @\"\", data(\"\"), data(\"\")] mutableCopy];\n\n    [realm beginWriteTransaction];\n    [self.queryObjectClass createInRealm:realm withValue:values];\n\n    RLMResults *resultsQuery = [self.queryObjectClass objectsWhere:@\"bool1 = YES\"];\n    RLMResults *resultsTableView = [self.queryObjectClass objectsWhere:@\"bool1 = YES\"];\n\n    // Force resultsTableView to form the TableView to verify that it syncs\n    // correctly, and don't call anything but count on resultsQuery so that\n    // it always reruns the query count method\n    (void)[resultsTableView firstObject];\n\n    XCTAssertEqual(resultsQuery.count, 1U);\n    XCTAssertEqual(resultsTableView.count, 1U);\n\n    // Delete the (only) object in result set\n    [realm deleteObject:[resultsTableView lastObject]];\n    XCTAssertEqual(resultsQuery.count, 0U);\n    XCTAssertEqual(resultsTableView.count, 0U);\n\n    // Add an object that does not match query\n    values[0] = @NO;\n    QueryObject *q1 = [self.queryObjectClass createInRealm:realm withValue:values];\n    XCTAssertEqual(resultsQuery.count, 0U);\n    XCTAssertEqual(resultsTableView.count, 0U);\n\n    // Change object to match query\n    q1[@\"bool1\"] = @YES;\n    XCTAssertEqual(resultsQuery.count, 1U);\n    XCTAssertEqual(resultsTableView.count, 1U);\n\n    // Add another object that matches\n    values[0] = @YES;\n    [self.queryObjectClass createInRealm:realm withValue:values];\n    XCTAssertEqual(resultsQuery.count, 2U);\n    XCTAssertEqual(resultsTableView.count, 2U);\n    [realm commitWriteTransaction];\n}\n\n- (void)testLiveQueriesBetweenTransactions\n{\n    RLMRealm *realm = [self realm];\n\n    NSMutableArray *values = [@[@YES, @YES, @1, @2, @23.0f, @1.7f,  @0.0,  @5.55, @\"\", @\"\", data(\"\"), data(\"\")] mutableCopy];\n\n    [realm beginWriteTransaction];\n    [self.queryObjectClass createInRealm:realm withValue:values];\n    [realm commitWriteTransaction];\n\n    RLMResults *resultsQuery = [self.queryObjectClass objectsWhere:@\"bool1 = YES\"];\n    RLMResults *resultsTableView = [self.queryObjectClass objectsWhere:@\"bool1 = YES\"];\n\n    // Force resultsTableView to form the TableView to verify that it syncs\n    // correctly, and don't call anything but count on resultsQuery so that\n    // it always reruns the query count method\n    (void)[resultsTableView firstObject];\n\n    XCTAssertEqual(resultsQuery.count, 1U);\n    XCTAssertEqual(resultsTableView.count, 1U);\n\n    // Delete the (only) object in result set\n    [realm beginWriteTransaction];\n    [realm deleteObject:[resultsTableView lastObject]];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(resultsQuery.count, 0U);\n    XCTAssertEqual(resultsTableView.count, 0U);\n\n    // Add an object that does not match query\n    [realm beginWriteTransaction];\n    values[0] = @NO;\n    QueryObject *q1 = [self.queryObjectClass createInRealm:realm withValue:values];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(resultsQuery.count, 0U);\n    XCTAssertEqual(resultsTableView.count, 0U);\n\n    // Change object to match query\n    [realm beginWriteTransaction];\n    q1[@\"bool1\"] = @YES;\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(resultsQuery.count, 1U);\n    XCTAssertEqual(resultsTableView.count, 1U);\n\n    // Add another object that matches\n    [realm beginWriteTransaction];\n    values[0] = @YES;\n    [self.queryObjectClass createInRealm:realm withValue:values];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(resultsQuery.count, 2U);\n    XCTAssertEqual(resultsTableView.count, 2U);\n}\n\n- (void)makeDogWithName:(NSString *)name owner:(NSString *)ownerName {\n    RLMRealm *realm = [self realm];\n\n    OwnerObject *owner = [[OwnerObject alloc] init];\n    owner.name = ownerName;\n    owner.dog = [[DogObject alloc] init];\n    owner.dog.dogName = name;\n\n    [realm beginWriteTransaction];\n    [realm addObject:owner];\n    [realm commitWriteTransaction];\n}\n\n- (void)makeDogWithAge:(int)age owner:(NSString *)ownerName {\n    RLMRealm *realm = [self realm];\n\n    OwnerObject *owner = [[OwnerObject alloc] init];\n    owner.name = ownerName;\n    owner.dog = [[DogObject alloc] init];\n    owner.dog.dogName = @\"\";\n    owner.dog.age = age;\n\n    [realm beginWriteTransaction];\n    [realm addObject:owner];\n    [realm commitWriteTransaction];\n}\n\n- (void)testLinkQueryNewObjectCausesEmptyResults\n{\n    [self makeDogWithName:@\"Harvie\" owner:@\"Tim\"];\n    DogObject *newDogObject = [[DogObject alloc] init];\n    RLMAssertCount(OwnerObject, 0U, @\"dog = %@\", newDogObject);\n    RLMAssertCount(OwnerObject, 1U, @\"dog != %@\", newDogObject);\n}\n\n- (void)testLinkQueryDifferentRealmsThrows\n{\n    RLMRealm *testRealm = [self realmWithTestPath];\n    [self makeDogWithName:@\"Harvie\" owner:@\"Tim\"];\n\n    RLMRealm *defaultRealm = [self realm];\n    DogObject *dog = [[DogObject alloc] init];\n    dog.dogName = @\"Fido\";\n    [defaultRealm beginWriteTransaction];\n    [defaultRealm addObject:dog];\n    [defaultRealm commitWriteTransaction];\n\n    XCTAssertThrows(([OwnerObject objectsInRealm:testRealm where:@\"dog = %@\", dog]));\n}\n\n- (void)testLinkQueryString\n{\n    [self makeDogWithName:@\"Harvie\" owner:@\"Tim\"];\n    RLMAssertCount(OwnerObject, 1U, @\"dog.dogName  = 'Harvie'\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.dogName != 'Harvie'\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.dogName  = 'eivraH'\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.dogName  = 'Fido'\");\n    RLMAssertCount(OwnerObject, 1U, @\"dog.dogName IN {'Fido', 'Harvie'}\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.dogName IN {'Fido', 'eivraH'}\");\n\n    [self makeDogWithName:@\"Harvie\" owner:@\"Joe\"];\n    RLMAssertCount(OwnerObject, 2U, @\"dog.dogName  = 'Harvie'\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.dogName != 'Harvie'\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.dogName  = 'eivraH'\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.dogName  = 'Fido'\");\n    RLMAssertCount(OwnerObject, 2U, @\"dog.dogName IN {'Fido', 'Harvie'}\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.dogName IN {'Fido', 'eivraH'}\");\n\n    [self makeDogWithName:@\"Fido\" owner:@\"Jim\"];\n    RLMAssertCount(OwnerObject, 2U, @\"dog.dogName  = 'Harvie'\");\n    RLMAssertCount(OwnerObject, 1U, @\"dog.dogName != 'Harvie'\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.dogName  = 'eivraH'\");\n    RLMAssertCount(OwnerObject, 1U, @\"dog.dogName  = 'Fido'\");\n    RLMAssertCount(OwnerObject, 3U, @\"dog.dogName IN {'Fido', 'Harvie'}\");\n    RLMAssertCount(OwnerObject, 1U, @\"dog.dogName IN {'Fido', 'eivraH'}\");\n\n    RLMAssertCount(OwnerObject, 1U, @\"dog.dogName = 'Harvie' and name = 'Tim'\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.dogName = 'Harvie' and name = 'Jim'\");\n\n    [self makeDogWithName:@\"Rex\" owner:@\"Rex\"];\n    RLMAssertCount(OwnerObject, 1U, @\"dog.dogName = name\");\n    RLMAssertCount(OwnerObject, 1U, @\"name = dog.dogName\");\n    RLMAssertCount(OwnerObject, 3U, @\"dog.dogName != name\");\n    RLMAssertCount(OwnerObject, 3U, @\"name != dog.dogName\");\n    RLMAssertCount(OwnerObject, 4U, @\"dog.dogName == dog.dogName\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.dogName != dog.dogName\");\n\n    RLMAssertCount(OwnerObject, 1U, @\"dog.dogName > 'Harvie'\");\n    RLMAssertCount(OwnerObject, 3U, @\"dog.dogName >= 'Harvie'\");\n    RLMAssertCount(OwnerObject, 1U, @\"dog.dogName < 'Harvie'\");\n    RLMAssertCount(OwnerObject, 3U, @\"dog.dogName <= 'Harvie'\");\n}\n\n- (void)testLinkQueryInt\n{\n    [self makeDogWithAge:5 owner:@\"Tim\"];\n    RLMAssertCount(OwnerObject, 1U, @\"dog.age  = 5\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.age != 5\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.age  = 10\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.age  = 8\");\n    RLMAssertCount(OwnerObject, 1U, @\"dog.age IN {5, 8}\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.age IN {8, 10}\");\n    RLMAssertCount(OwnerObject, 1U, @\"dog.age BETWEEN {0, 10}\");\n    RLMAssertCount(OwnerObject, 1U, @\"dog.age BETWEEN {0, 7}\");\n\n    [self makeDogWithAge:5 owner:@\"Joe\"];\n    RLMAssertCount(OwnerObject, 2U, @\"dog.age  = 5\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.age != 5\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.age  = 10\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.age  = 8\");\n    RLMAssertCount(OwnerObject, 2U, @\"dog.age IN {5, 8}\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.age IN {8, 10}\");\n    RLMAssertCount(OwnerObject, 2U, @\"dog.age BETWEEN {0, 10}\");\n    RLMAssertCount(OwnerObject, 2U, @\"dog.age BETWEEN {0, 7}\");\n\n    [self makeDogWithAge:8 owner:@\"Jim\"];\n    RLMAssertCount(OwnerObject, 2U, @\"dog.age  = 5\");\n    RLMAssertCount(OwnerObject, 1U, @\"dog.age != 5\");\n    RLMAssertCount(OwnerObject, 0U, @\"dog.age  = 10\");\n    RLMAssertCount(OwnerObject, 1U, @\"dog.age  = 8\");\n    RLMAssertCount(OwnerObject, 3U, @\"dog.age IN {5, 8}\");\n    RLMAssertCount(OwnerObject, 1U, @\"dog.age IN {8, 10}\");\n    RLMAssertCount(OwnerObject, 3U, @\"dog.age BETWEEN {0, 10}\");\n    RLMAssertCount(OwnerObject, 2U, @\"dog.age BETWEEN {0, 7}\");\n}\n\n- (void)testLinkQueryAllTypes {\n    RLMRealm *realm = [self realm];\n\n    LinkToAllTypesObject *linkToAllTypes = [[LinkToAllTypesObject alloc] init];\n    linkToAllTypes.allTypesCol = [[AllTypesObject alloc] initWithValue:[AllTypesObject values:1 stringObject:nil]];\n    StringObject *obj = [[StringObject alloc] initWithValue:@[@\"string\"]];\n    linkToAllTypes.allTypesCol.objectCol = obj;\n\n    [realm beginWriteTransaction];\n    [realm addObject:linkToAllTypes];\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(LinkToAllTypesObject, 1U, @\"allTypesCol.boolCol = YES\");\n    RLMAssertCount(LinkToAllTypesObject, 0U, @\"allTypesCol.boolCol = NO\");\n\n    RLMAssertCount(LinkToAllTypesObject, 1U, @\"allTypesCol.intCol = 1\");\n    RLMAssertCount(LinkToAllTypesObject, 0U, @\"allTypesCol.intCol != 1\");\n    RLMAssertCount(LinkToAllTypesObject, 1U, @\"allTypesCol.intCol > 0\");\n    RLMAssertCount(LinkToAllTypesObject, 0U, @\"allTypesCol.intCol > 1\");\n\n    RLMAssertCount(LinkToAllTypesObject, 1U, @\"allTypesCol.floatCol = %f\", 1.1);\n    RLMAssertCount(LinkToAllTypesObject, 1U, @\"allTypesCol.floatCol <= %f\", 1.1);\n    RLMAssertCount(LinkToAllTypesObject, 0U, @\"allTypesCol.floatCol < %f\", 1.1);\n\n    RLMAssertCount(LinkToAllTypesObject, 1U, @\"allTypesCol.doubleCol = 1.11\");\n    RLMAssertCount(LinkToAllTypesObject, 1U, @\"allTypesCol.doubleCol >= 1.11\");\n    RLMAssertCount(LinkToAllTypesObject, 0U, @\"allTypesCol.doubleCol > 1.11\");\n\n    RLMAssertCount(LinkToAllTypesObject, 1U, @\"allTypesCol.longCol = 2147483648\");\n    RLMAssertCount(LinkToAllTypesObject, 0U, @\"allTypesCol.longCol != 2147483648\");\n\n    RLMAssertCount(LinkToAllTypesObject, 1U, @\"allTypesCol.dateCol = %@\", linkToAllTypes.allTypesCol.dateCol);\n    RLMAssertCount(LinkToAllTypesObject, 0U, @\"allTypesCol.dateCol != %@\", linkToAllTypes.allTypesCol.dateCol);\n}\n\n- (void)testLinkQueryManyArray\n{\n    RLMRealm *realm = [self realm];\n\n    ArrayPropertyObject *arrPropObj1 = [[ArrayPropertyObject alloc] init];\n    arrPropObj1.name = @\"Test\";\n    for (NSUInteger i=0; i<10; i++) {\n        StringObject *sobj = [[StringObject alloc] init];\n        sobj.stringCol = @(i).stringValue;\n        [arrPropObj1.array addObject:sobj];\n        IntObject *iobj = [[IntObject alloc] init];\n        iobj.intCol = (int)i;\n        [arrPropObj1.intArray addObject:iobj];\n    }\n    [realm beginWriteTransaction];\n    [realm addObject:arrPropObj1];\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(ArrayPropertyObject, 0U, @\"ANY intArray.intCol > 10\");\n    RLMAssertCount(ArrayPropertyObject, 1U, @\"ANY intArray.intCol > 5\");\n    RLMAssertCount(ArrayPropertyObject, 1U, @\"ANY array.stringCol = '1'\");\n    RLMAssertCount(ArrayPropertyObject, 0U, @\"NONE intArray.intCol == 5\");\n    RLMAssertCount(ArrayPropertyObject, 1U, @\"NONE intArray.intCol > 10\");\n\n    ArrayPropertyObject *arrPropObj2 = [[ArrayPropertyObject alloc] init];\n    arrPropObj2.name = @\"Test\";\n    for (NSUInteger i=0; i<4; i++) {\n        StringObject *sobj = [[StringObject alloc] init];\n        sobj.stringCol = @(i).stringValue;\n        [arrPropObj2.array addObject:sobj];\n        IntObject *iobj = [[IntObject alloc] init];\n        iobj.intCol = (int)i;\n        [arrPropObj2.intArray addObject:iobj];\n    }\n    [realm beginWriteTransaction];\n    [realm addObject:arrPropObj2];\n    [realm commitWriteTransaction];\n    RLMAssertCount(ArrayPropertyObject, 0U, @\"ANY intArray.intCol > 10\");\n    RLMAssertCount(ArrayPropertyObject, 1U, @\"ANY intArray.intCol > 5\");\n    RLMAssertCount(ArrayPropertyObject, 2U, @\"ANY intArray.intCol > 2\");\n    RLMAssertCount(ArrayPropertyObject, 1U, @\"NONE intArray.intCol == 5\");\n    RLMAssertCount(ArrayPropertyObject, 2U, @\"NONE intArray.intCol > 10\");\n}\n\n- (void)testLinkQueryManySet\n{\n    RLMRealm *realm = [self realm];\n\n    SetPropertyObject *setPropObj1 = [[SetPropertyObject alloc] init];\n    setPropObj1.name = @\"Test\";\n    for (NSUInteger i=0; i<10; i++) {\n        StringObject *sobj = [[StringObject alloc] init];\n        sobj.stringCol = @(i).stringValue;\n        [setPropObj1.set addObject:sobj];\n        IntObject *iobj = [[IntObject alloc] init];\n        iobj.intCol = (int)i;\n        [setPropObj1.intSet addObject:iobj];\n    }\n    [realm beginWriteTransaction];\n    [realm addObject:setPropObj1];\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(SetPropertyObject, 0U, @\"ANY intSet.intCol > 10\");\n    RLMAssertCount(SetPropertyObject, 0U, @\"ANY intSet.intCol > 10\");\n    RLMAssertCount(SetPropertyObject, 1U, @\"ANY intSet.intCol > 5\");\n    RLMAssertCount(SetPropertyObject, 1U, @\"ANY set.stringCol = '1'\");\n    RLMAssertCount(SetPropertyObject, 0U, @\"NONE intSet.intCol == 5\");\n    RLMAssertCount(SetPropertyObject, 1U, @\"NONE intSet.intCol > 10\");\n\n    SetPropertyObject *setPropObj2 = [[SetPropertyObject alloc] init];\n    setPropObj2.name = @\"Test\";\n    for (NSUInteger i=0; i<4; i++) {\n        StringObject *sobj = [[StringObject alloc] init];\n        sobj.stringCol = @(i).stringValue;\n        [setPropObj2.set addObject:sobj];\n        IntObject *iobj = [[IntObject alloc] init];\n        iobj.intCol = (int)i;\n        [setPropObj2.intSet addObject:iobj];\n    }\n    [realm beginWriteTransaction];\n    [realm addObject:setPropObj2];\n    [realm commitWriteTransaction];\n    RLMAssertCount(SetPropertyObject, 0U, @\"ANY intSet.intCol > 10\");\n    RLMAssertCount(SetPropertyObject, 1U, @\"ANY intSet.intCol > 5\");\n    RLMAssertCount(SetPropertyObject, 2U, @\"ANY intSet.intCol > 2\");\n    RLMAssertCount(SetPropertyObject, 1U, @\"NONE intSet.intCol == 5\");\n    RLMAssertCount(SetPropertyObject, 2U, @\"NONE intSet.intCol > 10\");\n}\n\n- (void)testLinkQueryManyDictionaries {\n    RLMRealm *realm = [self realm];\n\n    DictionaryPropertyObject *dpo1 = [[DictionaryPropertyObject alloc] init];\n    for (NSUInteger i=0; i<10; i++) {\n        StringObject *sobj = [[StringObject alloc] init];\n        sobj.stringCol = @(i).stringValue;\n        dpo1.stringDictionary[sobj.stringCol] = sobj;\n        IntObject *iobj = [[IntObject alloc] init];\n        iobj.intCol = (int)i;\n        dpo1.intObjDictionary[sobj.stringCol] = iobj;\n    }\n    [realm beginWriteTransaction];\n    [realm addObject:dpo1];\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(DictionaryPropertyObject, 0U, @\"ANY intObjDictionary.intCol > 10\");\n    RLMAssertCount(DictionaryPropertyObject, 1U, @\"ANY intObjDictionary.intCol > 5\");\n    RLMAssertCount(DictionaryPropertyObject, 1U, @\"ANY stringDictionary.stringCol = '1'\");\n    RLMAssertCount(DictionaryPropertyObject, 0U, @\"NONE intObjDictionary.intCol == 5\");\n    RLMAssertCount(DictionaryPropertyObject, 1U, @\"NONE intObjDictionary.intCol > 10\");\n\n    DictionaryPropertyObject *dpo2 = [[DictionaryPropertyObject alloc] init];\n    for (NSUInteger i=0; i<4; i++) {\n        StringObject *sobj = [[StringObject alloc] init];\n        sobj.stringCol = @(i).stringValue;\n        dpo2.stringDictionary[sobj.stringCol] = sobj;\n        IntObject *iobj = [[IntObject alloc] init];\n        iobj.intCol = (int)i;\n        dpo2.intObjDictionary[sobj.stringCol] = iobj;\n    }\n    [realm beginWriteTransaction];\n    [realm addObject:dpo2];\n    [realm commitWriteTransaction];\n    RLMAssertCount(DictionaryPropertyObject, 0U, @\"ANY intObjDictionary.intCol > 10\");\n    RLMAssertCount(DictionaryPropertyObject, 1U, @\"ANY intObjDictionary.intCol > 5\");\n    RLMAssertCount(DictionaryPropertyObject, 2U, @\"ANY intObjDictionary.intCol > 2\");\n    RLMAssertCount(DictionaryPropertyObject, 1U, @\"NONE intObjDictionary.intCol == 5\");\n    RLMAssertCount(DictionaryPropertyObject, 2U, @\"NONE intObjDictionary.intCol > 10\");\n}\n\n- (void)testMultiLevelLinkQuery\n{\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    CircleObject *circle = nil;\n    for (int i = 0; i < 5; ++i) {\n        circle = [CircleObject createInRealm:realm withValue:@{@\"data\": @(i).stringValue,\n                                                                @\"next\": circle ?: NSNull.null}];\n    }\n    [realm commitWriteTransaction];\n\n    XCTAssertTrue([circle isEqualToObject:[CircleObject objectsInRealm:realm where:@\"data = '4'\"].firstObject]);\n    XCTAssertTrue([circle isEqualToObject:[CircleObject objectsInRealm:realm where:@\"next.data = '3'\"].firstObject]);\n    XCTAssertTrue([circle isEqualToObject:[CircleObject objectsInRealm:realm where:@\"next.next.data = '2'\"].firstObject]);\n    XCTAssertTrue([circle isEqualToObject:[CircleObject objectsInRealm:realm where:@\"next.next.next.data = '1'\"].firstObject]);\n    XCTAssertTrue([circle isEqualToObject:[CircleObject objectsInRealm:realm where:@\"next.next.next.next.data = '0'\"].firstObject]);\n    XCTAssertTrue([circle.next isEqualToObject:[CircleObject objectsInRealm:realm where:@\"next.next.next.data = '0'\"].firstObject]);\n    XCTAssertTrue([circle.next.next isEqualToObject:[CircleObject objectsInRealm:realm where:@\"next.next.data = '0'\"].firstObject]);\n\n    XCTAssertNoThrow(([CircleObject objectsInRealm:realm where:@\"next = %@\", circle]));\n    XCTAssertNoThrow(([CircleObject objectsInRealm:realm where:@\"next.next = %@\", circle]));\n    XCTAssertTrue([circle.next.next.next.next isEqualToObject:[CircleObject objectsInRealm:realm where:@\"next = nil\"].firstObject]);\n    XCTAssertTrue([circle.next.next.next isEqualToObject:[CircleObject objectsInRealm:realm where:@\"next != nil AND next.next = nil\"].firstObject]);\n    XCTAssertTrue([circle.next.next isEqualToObject:[CircleObject objectsInRealm:realm where:@\"next.next != nil AND next.next.next = nil\"].firstObject]);\n}\n\n- (void)testArrayMultiLevelLinkQuery\n{\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    CircleObject *circle = nil;\n    for (int i = 0; i < 5; ++i) {\n        circle = [CircleObject createInRealm:realm withValue:@{@\"data\": @(i).stringValue,\n                                                                @\"next\": circle ?: NSNull.null}];\n    }\n    [CircleArrayObject createInRealm:realm withValue:@[[CircleObject allObjectsInRealm:realm]]];\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(CircleArrayObject, 1U, @\"ANY circles.data = '4'\");\n    RLMAssertCount(CircleArrayObject, 0U, @\"ANY circles.next.data = '4'\");\n    RLMAssertCount(CircleArrayObject, 1U, @\"ANY circles.next.data = '3'\");\n    RLMAssertCount(CircleArrayObject, 1U, @\"ANY circles.data = '3'\");\n    RLMAssertCount(CircleArrayObject, 1U, @\"NONE circles.next.data = '4'\");\n\n    RLMAssertCount(CircleArrayObject, 0U, @\"ANY circles.next.next.data = '3'\");\n    RLMAssertCount(CircleArrayObject, 1U, @\"ANY circles.next.next.data = '2'\");\n    RLMAssertCount(CircleArrayObject, 1U, @\"ANY circles.next.data = '2'\");\n    RLMAssertCount(CircleArrayObject, 1U, @\"ANY circles.data = '2'\");\n    RLMAssertCount(CircleArrayObject, 1U, @\"NONE circles.next.next.data = '3'\");\n\n    XCTAssertThrows([CircleArrayObject objectsInRealm:realm where:@\"ANY data = '2'\"]);\n    XCTAssertThrows([CircleArrayObject objectsInRealm:realm where:@\"ANY circles.next = '2'\"]);\n    XCTAssertThrows([CircleArrayObject objectsInRealm:realm where:@\"ANY data.circles = '2'\"]);\n    XCTAssertThrows([CircleArrayObject objectsInRealm:realm where:@\"circles.data = '2'\"]);\n    XCTAssertThrows([CircleArrayObject objectsInRealm:realm where:@\"NONE data.circles = '2'\"]);\n}\n\n- (void)testSetMultiLevelLinkQuery\n{\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    CircleObject *circle = nil;\n    for (int i = 0; i < 5; ++i) {\n        circle = [CircleObject createInRealm:realm withValue:@{@\"data\": @(i).stringValue,\n                                                                @\"next\": circle ?: NSNull.null}];\n    }\n    [CircleSetObject createInRealm:realm withValue:@[[CircleObject allObjectsInRealm:realm]]];\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(CircleSetObject, 1U, @\"ANY circles.data = '4'\");\n    RLMAssertCount(CircleSetObject, 0U, @\"ANY circles.next.data = '4'\");\n    RLMAssertCount(CircleSetObject, 1U, @\"ANY circles.next.data = '3'\");\n    RLMAssertCount(CircleSetObject, 1U, @\"ANY circles.data = '3'\");\n    RLMAssertCount(CircleSetObject, 1U, @\"NONE circles.next.data = '4'\");\n\n    RLMAssertCount(CircleSetObject, 0U, @\"ANY circles.next.next.data = '3'\");\n    RLMAssertCount(CircleSetObject, 1U, @\"ANY circles.next.next.data = '2'\");\n    RLMAssertCount(CircleSetObject, 1U, @\"ANY circles.next.data = '2'\");\n    RLMAssertCount(CircleSetObject, 1U, @\"ANY circles.data = '2'\");\n    RLMAssertCount(CircleSetObject, 1U, @\"NONE circles.next.next.data = '3'\");\n\n    XCTAssertThrows([CircleSetObject objectsInRealm:realm where:@\"ANY data = '2'\"]);\n    XCTAssertThrows([CircleSetObject objectsInRealm:realm where:@\"ANY circles.next = '2'\"]);\n    XCTAssertThrows([CircleSetObject objectsInRealm:realm where:@\"ANY data.circles = '2'\"]);\n    XCTAssertThrows([CircleSetObject objectsInRealm:realm where:@\"circles.data = '2'\"]);\n    XCTAssertThrows([CircleSetObject objectsInRealm:realm where:@\"NONE data.circles = '2'\"]);\n}\n\n- (void)testDictionaryMultiLevelLinkQuery {\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    CircleObject *circle = nil;\n    for (int i = 0; i < 5; ++i) {\n        circle = [CircleObject createInRealm:realm withValue:@{@\"data\": @(i).stringValue,\n                                                                @\"next\": circle ?: NSNull.null}];\n    }\n    CircleDictionaryObject *cdo = [CircleDictionaryObject createInRealm:realm withValue:@{}];\n    for (CircleObject *co in [CircleObject allObjectsInRealm:realm]) {\n        cdo.circles[co.data] = co;\n    }\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(CircleDictionaryObject, 1U, @\"ANY circles.data = '4'\");\n    RLMAssertCount(CircleDictionaryObject, 0U, @\"ANY circles.next.data = '4'\");\n    RLMAssertCount(CircleDictionaryObject, 1U, @\"ANY circles.next.data = '3'\");\n    RLMAssertCount(CircleDictionaryObject, 1U, @\"ANY circles.data = '3'\");\n    RLMAssertCount(CircleDictionaryObject, 1U, @\"NONE circles.next.data = '4'\");\n\n    RLMAssertCount(CircleDictionaryObject, 0U, @\"ANY circles.next.next.data = '3'\");\n    RLMAssertCount(CircleDictionaryObject, 1U, @\"ANY circles.next.next.data = '2'\");\n    RLMAssertCount(CircleDictionaryObject, 1U, @\"ANY circles.next.data = '2'\");\n    RLMAssertCount(CircleDictionaryObject, 1U, @\"ANY circles.data = '2'\");\n    RLMAssertCount(CircleDictionaryObject, 1U, @\"NONE circles.next.next.data = '3'\");\n\n    XCTAssertThrows([CircleDictionaryObject objectsInRealm:realm where:@\"ANY data = '2'\"]);\n    XCTAssertThrows([CircleDictionaryObject objectsInRealm:realm where:@\"ANY circles.next = '2'\"]);\n    XCTAssertThrows([CircleDictionaryObject objectsInRealm:realm where:@\"ANY data.circles = '2'\"]);\n    XCTAssertThrows([CircleDictionaryObject objectsInRealm:realm where:@\"NONE data.circles = '2'\"]);\n    XCTAssertThrows([CircleDictionaryObject objectsInRealm:realm where:@\"circles.data = '2'\"]);\n}\n\n- (void)testMultiLevelBackLinkQuery\n{\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    LinkChain1 *root1 = [LinkChain1 createInRealm:realm withValue:@{@\"value\": @1, @\"next\": @[@[]]}];\n    LinkChain1 *root2 = [LinkChain1 createInRealm:realm withValue:@{@\"value\": @2, @\"next\": @[@[]]}];\n    [realm commitWriteTransaction];\n\n    RLMResults *results = [LinkChain3 objectsInRealm:realm where:@\"ANY prev.prev.value = 1\"];\n    XCTAssertEqual(1U, results.count);\n    XCTAssertTrue([root1.next.next isEqualToObject:results.firstObject]);\n\n    results = [LinkChain3 objectsInRealm:realm where:@\"ANY prev.prev.value = 2\"];\n    XCTAssertEqual(1U, results.count);\n    XCTAssertTrue([root2.next.next isEqualToObject:results.firstObject]);\n\n    results = [LinkChain3 objectsInRealm:realm where:@\"ANY prev.prev.value = 3\"];\n    XCTAssertEqual(0U, results.count);\n}\n\n- (void)testQueryWithObjects {\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n\n    StringObject *stringObj0 = [StringObject createInRealm:realm withValue:@[@\"string0\"]];\n    StringObject *stringObj1 = [StringObject createInRealm:realm withValue:@[@\"string1\"]];\n    StringObject *stringObj2 = [StringObject createInRealm:realm withValue:@[@\"string2\"]];\n\n    AllTypesObject *obj0 = [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:1 stringObject:stringObj0]];\n    AllTypesObject *obj1 = [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:2 stringObject:stringObj1]];\n    AllTypesObject *obj2 = [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:3 stringObject:stringObj0]];\n    AllTypesObject *obj3 = [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:4 stringObject:stringObj2]];\n    AllTypesObject *obj4 = [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:5 stringObject:nil]];\n\n    [ArrayOfAllTypesObject createInDefaultRealmWithValue:@[@[obj0, obj1]]];\n    [ArrayOfAllTypesObject createInDefaultRealmWithValue:@[@[obj1]]];\n    [ArrayOfAllTypesObject createInDefaultRealmWithValue:@[@[obj0, obj2, obj3]]];\n    [ArrayOfAllTypesObject createInDefaultRealmWithValue:@[@[obj4]]];\n\n    [SetOfAllTypesObject createInDefaultRealmWithValue:@[@[obj0, obj1]]];\n    [SetOfAllTypesObject createInDefaultRealmWithValue:@[@[obj1]]];\n    [SetOfAllTypesObject createInDefaultRealmWithValue:@[@[obj0, obj2, obj3]]];\n    [SetOfAllTypesObject createInDefaultRealmWithValue:@[@[obj4]]];\n\n    [DictionaryOfAllTypesObject createInDefaultRealmWithValue:@[@{@\"0\": obj0, @\"1\": obj1}]];\n    [DictionaryOfAllTypesObject createInDefaultRealmWithValue:@[@{@\"1\": obj1}]];\n    [DictionaryOfAllTypesObject createInDefaultRealmWithValue:@[@{@\"0\": obj0, @\"2\": obj2, @\"3\": obj3}]];\n    [DictionaryOfAllTypesObject createInDefaultRealmWithValue:@[@{@\"4\": obj4}]];\n\n    [realm commitWriteTransaction];\n\n    // simple queries\n    RLMAssertCount(AllTypesObject, 2U, @\"objectCol = %@\", stringObj0);\n    RLMAssertCount(AllTypesObject, 1U, @\"objectCol = %@\", stringObj1);\n    RLMAssertCount(AllTypesObject, 1U, @\"objectCol = nil\");\n    RLMAssertCount(AllTypesObject, 4U, @\"objectCol != nil\");\n    RLMAssertCount(AllTypesObject, 3U, @\"objectCol != %@\", stringObj0);\n\n    // check for ANY object in array\n    RLMAssertCount(ArrayOfAllTypesObject, 2U, @\"ANY array = %@\", obj0);\n    RLMAssertCount(ArrayOfAllTypesObject, 3U, @\"ANY array != %@\", obj1);\n    RLMAssertCount(ArrayOfAllTypesObject, 2U, @\"NONE array = %@\", obj0);\n    RLMAssertCount(ArrayOfAllTypesObject, 1U, @\"NONE array != %@\", obj1);\n    XCTAssertThrows(([ArrayOfAllTypesObject objectsWhere:@\"array = %@\", obj0].count));\n    XCTAssertThrows(([ArrayOfAllTypesObject objectsWhere:@\"array != %@\", obj0].count));\n\n    // check for ANY object in set\n    RLMAssertCount(SetOfAllTypesObject, 2U, @\"ANY set = %@\", obj0);\n    RLMAssertCount(SetOfAllTypesObject, 3U, @\"ANY set != %@\", obj1);\n    RLMAssertCount(SetOfAllTypesObject, 2U, @\"NONE set = %@\", obj0);\n    RLMAssertCount(SetOfAllTypesObject, 1U, @\"NONE set != %@\", obj1);\n    XCTAssertThrows(([SetOfAllTypesObject objectsWhere:@\"set = %@\", obj0].count));\n    XCTAssertThrows(([SetOfAllTypesObject objectsWhere:@\"set != %@\", obj0].count));\n\n    // check for ANY object in dictionary\n    RLMAssertCount(DictionaryOfAllTypesObject, 2U, @\"ANY dictionary = %@\", obj0);\n    RLMAssertCount(DictionaryOfAllTypesObject, 3U, @\"ANY dictionary != %@\", obj1);\n    RLMAssertCount(DictionaryOfAllTypesObject, 2U, @\"NONE dictionary = %@\", obj0);\n    RLMAssertCount(DictionaryOfAllTypesObject, 1U, @\"NONE dictionary != %@\", obj1);\n    XCTAssertThrows(([DictionaryOfAllTypesObject objectsWhere:@\"dictionary = %@\", obj0].count));\n    XCTAssertThrows(([DictionaryOfAllTypesObject objectsWhere:@\"dictionary != %@\", obj0].count));\n}\n\n- (void)testCompoundOrQuery {\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    [PersonObject createInRealm:realm withValue:@[@\"Tim\", @29]];\n    [PersonObject createInRealm:realm withValue:@[@\"Ari\", @33]];\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(PersonObject, 2U, @\"name == 'Ari' or age < 30\");\n    RLMAssertCount(PersonObject, 1U, @\"name == 'Ari' or age > 40\");\n}\n\n- (void)testCompoundAndQuery {\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    [PersonObject createInRealm:realm withValue:@[@\"Tim\", @29]];\n    [PersonObject createInRealm:realm withValue:@[@\"Ari\", @33]];\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(PersonObject, 1U, @\"name == 'Ari' and age > 30\");\n    RLMAssertCount(PersonObject, 0U, @\"name == 'Ari' and age > 40\");\n}\n\n- (void)testClass:(Class)class\n  withNormalCount:(NSUInteger)normalCount\n         notCount:(NSUInteger)notCount\n            where:(NSString *)predicateFormat, ...\n{\n    va_list args;\n    va_start(args, predicateFormat);\n    NSPredicate *predicate = [NSPredicate predicateWithFormat:predicateFormat arguments:args];\n    va_end(args);\n\n    XCTAssertEqual(normalCount, [[self evaluate:[class objectsWithPredicate:predicate]] count],\n                   @\"%@\", predicateFormat);\n\n    predicate = [NSCompoundPredicate notPredicateWithSubpredicate:predicate];\n    XCTAssertEqual(notCount, [[self evaluate:[class objectsWithPredicate:predicate]] count],\n                   @\"%@\", predicateFormat);\n\n}\n\n- (void)testINPredicate {\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    StringObject *so = [StringObject createInRealm:realm withValue:(@[@\"abc\"])];\n    AllTypesObject *obj = [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:1 stringObject:so]];\n    [realm commitWriteTransaction];\n\n    // Tests for each type always follow: none, some, more\n\n    ////////////////////////\n    // Literal Predicates\n    ////////////////////////\n\n    // BOOL\n    [self testClass:[AllTypesObject class] withNormalCount:0 notCount:1 where:@\"boolCol IN {NO}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"boolCol IN {YES}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"boolCol IN {NO, YES}\"];\n\n    // int\n    [self testClass:[AllTypesObject class] withNormalCount:0 notCount:1 where:@\"intCol IN {0, 2, 3}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"intCol IN {1}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"intCol IN {1, 2}\"];\n\n    // float\n    [self testClass:[AllTypesObject class] withNormalCount:0 notCount:1 where:@\"floatCol IN {0, 2, 3}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"floatCol IN {1.1}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"floatCol IN {1.1, 2.2}\"];\n\n    // double\n    [self testClass:[AllTypesObject class] withNormalCount:0 notCount:1 where:@\"doubleCol IN {0, 2, 3}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"doubleCol IN {1.11}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"doubleCol IN {1.11, 2.22}\"];\n\n    // NSString\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"stringCol IN {'a'}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:0 notCount:1 where:@\"stringCol IN {'b'}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:0 notCount:1 where:@\"stringCol IN {'A'}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"stringCol IN[c] {'a'}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"stringCol IN[c] {'A'}\"];\n\n    // NSData\n    // Can't represent NSData with NSPredicate literal. See format predicates below\n\n    // NSDate\n    // Can't represent NSDate with NSPredicate literal. See format predicates below\n\n    // bool\n    [self testClass:[AllTypesObject class] withNormalCount:0 notCount:1 where:@\"cBoolCol IN {NO}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"cBoolCol IN {YES}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"cBoolCol IN {NO, YES}\"];\n\n    // int64_t\n    [self testClass:[AllTypesObject class] withNormalCount:0 notCount:1 where:@\"longCol IN {0, 2, 3}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"longCol IN {2147483648}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"longCol IN {100, 2147483648}\"];\n\n    // string subobject\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"objectCol.stringCol IN {'abc'}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:0 notCount:1 where:@\"objectCol.stringCol IN {'def'}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:0 notCount:1 where:@\"objectCol.stringCol IN {'ABC'}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"objectCol.stringCol IN[c] {'abc'}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"objectCol.stringCol IN[c] {'ABC'}\"];\n\n    // RLMDecimal128\n    [self testClass:[AllTypesObject class] withNormalCount:0 notCount:1 where:@\"decimalCol IN {0, 2, 3}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"decimalCol IN {1}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"decimalCol IN {1, 2}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"decimalCol IN {'1', '2'}\"];\n\n    // RLMValue\n    [self testClass:[AllTypesObject class] withNormalCount:0 notCount:1 where:@\"anyCol IN {0, 1, 3}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"anyCol IN {2}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"anyCol IN {1, 2}\"];\n    [self testClass:[AllTypesObject class] withNormalCount:0 notCount:1 where:@\"anyCol IN {'1', '2'}\"];\n\n    // RLMObjectId\n    // Can't represent RLMObjectId with NSPredicate literal. See format predicates below\n\n    ////////////////////////\n    // Format Predicates\n    ////////////////////////\n\n    // BOOL\n    [self testClass:[AllTypesObject class] withNormalCount:0U notCount:1U where:@\"boolCol IN %@\", @[@NO]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"boolCol IN %@\", @[@YES]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"boolCol IN %@\", @[@NO, @YES]];\n\n    // int\n    [self testClass:[AllTypesObject class] withNormalCount:0U notCount:1U where:@\"intCol IN %@\", @[@0, @2, @3]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"intCol IN %@\", @[@1]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"intCol IN %@\", @[@1, @2]];\n\n    // float\n    [self testClass:[AllTypesObject class] withNormalCount:0U notCount:1U where:@\"floatCol IN %@\", @[@0, @2, @3]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"floatCol IN %@\", @[@1.1f]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"floatCol IN %@\", @[@1.1f, @2]];\n\n    // double\n    [self testClass:[AllTypesObject class] withNormalCount:0U notCount:1U where:@\"doubleCol IN %@\", @[@0, @2, @3]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"doubleCol IN %@\", @[@1.11]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"doubleCol IN %@\", @[@1.11, @2]];\n\n    // NSString\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"stringCol IN %@\", @[@\"a\"]];\n    [self testClass:[AllTypesObject class] withNormalCount:0U notCount:1U where:@\"stringCol IN %@\", @[@\"b\"]];\n    [self testClass:[AllTypesObject class] withNormalCount:0U notCount:1U where:@\"stringCol IN %@\", @[@\"A\"]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"stringCol IN[c] %@\", @[@\"a\"]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"stringCol IN[c] %@\", @[@\"A\"]];\n\n    // NSData\n    [self testClass:[AllTypesObject class] withNormalCount:0U notCount:1U where:@\"binaryCol IN %@\", @[[@\"\" dataUsingEncoding:NSUTF8StringEncoding]]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"binaryCol IN %@\", @[[@\"a\" dataUsingEncoding:NSUTF8StringEncoding]]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"binaryCol IN %@\", @[[@\"a\" dataUsingEncoding:NSUTF8StringEncoding], [@\"b\" dataUsingEncoding:NSUTF8StringEncoding]]];\n\n    // NSDate\n    [self testClass:[AllTypesObject class] withNormalCount:0U notCount:1U where:@\"dateCol IN %@\", @[[NSDate dateWithTimeIntervalSince1970:0]]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"dateCol IN %@\", @[[NSDate dateWithTimeIntervalSince1970:1]]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"dateCol IN %@\", @[[NSDate dateWithTimeIntervalSince1970:0], [NSDate dateWithTimeIntervalSince1970:1]]];\n\n    // bool\n    [self testClass:[AllTypesObject class] withNormalCount:0U notCount:1U where:@\"cBoolCol IN %@\", @[@NO]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"cBoolCol IN %@\", @[@YES]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"cBoolCol IN %@\", @[@NO, @YES]];\n\n    // int64_t\n    [self testClass:[AllTypesObject class] withNormalCount:0U notCount:1U where:@\"longCol IN %@\", @[@0, @2, @3]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"longCol IN %@\", @[@(INT_MAX + 1LL)]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"longCol IN %@\", @[@(INT_MAX + 1LL), @2]];\n\n    // string subobject\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"objectCol.stringCol IN %@\", @[@\"abc\"]];\n    [self testClass:[AllTypesObject class] withNormalCount:0U notCount:1U where:@\"objectCol.stringCol IN %@\", @[@\"def\"]];\n    [self testClass:[AllTypesObject class] withNormalCount:0U notCount:1U where:@\"objectCol.stringCol IN %@\", @[@\"ABC\"]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"objectCol.stringCol IN[c] %@\", @[@\"abc\"]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"objectCol.stringCol IN[c] %@\", @[@\"ABC\"]];\n\n    // RLMDecimal128\n    [self testClass:[AllTypesObject class] withNormalCount:0 notCount:1 where:@\"decimalCol IN %@\", @[@0, @2, @3]];\n    [self testClass:[AllTypesObject class] withNormalCount:0 notCount:1 where:@\"decimalCol IN %@\", @[@\"0\", @\"2\", @\"3\"]];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"decimalCol IN %@\", @[@1]];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"decimalCol IN %@\", @[@1, @2]];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"decimalCol IN %@\", @[@\"1\", @\"2\"]];\n\n    // RLMObjectId\n    RLMObjectId *objectId = obj.objectIdCol;\n    RLMObjectId *otherId = [RLMObjectId objectId];\n    [self testClass:[AllTypesObject class] withNormalCount:0 notCount:1 where:@\"objectIdCol IN %@\", @[otherId]];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"objectIdCol IN %@\", @[objectId]];\n    [self testClass:[AllTypesObject class] withNormalCount:1 notCount:0 where:@\"objectIdCol IN %@\", @[objectId, otherId]];\n\n    // RLMValue\n    [self testClass:[AllTypesObject class] withNormalCount:0U notCount:1U where:@\"anyCol IN %@\", @[@0, @1, @3]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"anyCol IN %@\", @[@2]];\n    [self testClass:[AllTypesObject class] withNormalCount:1U notCount:0U where:@\"anyCol IN %@\", @[@1, @2]];\n}\n\n- (void)testArrayIn {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n\n    ArrayPropertyObject *arr = [ArrayPropertyObject createInRealm:realm withValue:@[@\"name\", @[], @[]]];\n    [arr.array addObject:[StringObject createInRealm:realm withValue:@[@\"value\"]]];\n    StringObject *otherStringObject = [StringObject createInRealm:realm withValue:@[@\"some other value\"]];\n    [realm commitWriteTransaction];\n\n\n    RLMAssertCount(ArrayPropertyObject, 0U, @\"ANY array.stringCol IN %@\", @[@\"missing\"]);\n    RLMAssertCount(ArrayPropertyObject, 1U, @\"ANY array.stringCol IN %@\", @[@\"value\"]);\n    RLMAssertCount(ArrayPropertyObject, 1U, @\"NONE array.stringCol IN %@\", @[@\"missing\"]);\n    RLMAssertCount(ArrayPropertyObject, 0U, @\"NONE array.stringCol IN %@\", @[@\"value\"]);\n\n    RLMAssertCount(ArrayPropertyObject, 0U, @\"ANY array IN %@\", [StringObject objectsWhere:@\"stringCol = 'missing'\"]);\n    RLMAssertCount(ArrayPropertyObject, 1U, @\"ANY array IN %@\", [StringObject objectsWhere:@\"stringCol = 'value'\"]);\n    RLMAssertCount(ArrayPropertyObject, 1U, @\"NONE array IN %@\", [StringObject objectsWhere:@\"stringCol = 'missing'\"]);\n    RLMAssertCount(ArrayPropertyObject, 0U, @\"NONE array IN %@\", [StringObject objectsWhere:@\"stringCol = 'value'\"]);\n\n    StringObject *stringObject = [[StringObject allObjectsInRealm:realm] firstObject];\n    RLMAssertCount(ArrayPropertyObject, 1U, @\"%@ IN array\", stringObject);\n    RLMAssertCount(ArrayPropertyObject, 0U, @\"%@ IN array\", otherStringObject);\n}\n\n- (void)testSetIn {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n\n    SetPropertyObject *s = [SetPropertyObject createInRealm:realm withValue:@[@\"name\", @[], @[]]];\n    [s.set addObject:[StringObject createInRealm:realm withValue:@[@\"value\"]]];\n    StringObject *otherStringObject = [StringObject createInRealm:realm withValue:@[@\"some other value\"]];\n    [realm commitWriteTransaction];\n\n\n    RLMAssertCount(SetPropertyObject, 0U, @\"ANY set.stringCol IN %@\", @[@\"missing\"]);\n    RLMAssertCount(SetPropertyObject, 1U, @\"ANY set.stringCol IN %@\", @[@\"value\"]);\n    RLMAssertCount(SetPropertyObject, 1U, @\"NONE set.stringCol IN %@\", @[@\"missing\"]);\n    RLMAssertCount(SetPropertyObject, 0U, @\"NONE set.stringCol IN %@\", @[@\"value\"]);\n\n    RLMAssertCount(SetPropertyObject, 0U, @\"ANY set IN %@\", [StringObject objectsWhere:@\"stringCol = 'missing'\"]);\n    RLMAssertCount(SetPropertyObject, 1U, @\"ANY set IN %@\", [StringObject objectsWhere:@\"stringCol = 'value'\"]);\n    RLMAssertCount(SetPropertyObject, 1U, @\"NONE set IN %@\", [StringObject objectsWhere:@\"stringCol = 'missing'\"]);\n    RLMAssertCount(SetPropertyObject, 0U, @\"NONE set IN %@\", [StringObject objectsWhere:@\"stringCol = 'value'\"]);\n\n    StringObject *stringObject = [[StringObject allObjectsInRealm:realm] firstObject];\n    RLMAssertCount(SetPropertyObject, 1U, @\"%@ IN set\", stringObject);\n    RLMAssertCount(SetPropertyObject, 0U, @\"%@ IN set\", otherStringObject);\n}\n\n- (void)testDictionaryIn {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n\n    DictionaryPropertyObject *dict = [DictionaryPropertyObject createInRealm:realm withValue:@[]];\n    dict.stringDictionary[@\"value\"] = [StringObject createInRealm:realm withValue:@[@\"value\"]];\n    StringObject *otherStringObject = [StringObject createInRealm:realm withValue:@[@\"some other value\"]];\n    [realm commitWriteTransaction];\n\n\n    RLMAssertCount(DictionaryPropertyObject, 0U, @\"ANY stringDictionary.stringCol IN %@\", @[@\"missing\"]);\n    RLMAssertCount(DictionaryPropertyObject, 1U, @\"ANY stringDictionary.stringCol IN %@\", @[@\"value\"]);\n    RLMAssertCount(DictionaryPropertyObject, 1U, @\"NONE stringDictionary.stringCol IN %@\", @[@\"missing\"]);\n    RLMAssertCount(DictionaryPropertyObject, 0U, @\"NONE stringDictionary.stringCol IN %@\", @[@\"value\"]);\n\n    RLMAssertCount(DictionaryPropertyObject, 0U, @\"ANY stringDictionary IN %@\", [StringObject objectsWhere:@\"stringCol = 'missing'\"]);\n    RLMAssertCount(DictionaryPropertyObject, 1U, @\"ANY stringDictionary IN %@\", [StringObject objectsWhere:@\"stringCol = 'value'\"]);\n    RLMAssertCount(DictionaryPropertyObject, 1U, @\"NONE stringDictionary IN %@\", [StringObject objectsWhere:@\"stringCol = 'missing'\"]);\n    RLMAssertCount(DictionaryPropertyObject, 0U, @\"NONE stringDictionary IN %@\", [StringObject objectsWhere:@\"stringCol = 'value'\"]);\n\n    StringObject *stringObject = [[StringObject allObjectsInRealm:realm] firstObject];\n    RLMAssertCount(DictionaryPropertyObject, 1U, @\"%@ IN stringDictionary\", stringObject);\n    RLMAssertCount(DictionaryPropertyObject, 0U, @\"%@ IN stringDictionary\", otherStringObject);\n}\n\n- (void)testQueryChaining {\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    [PersonObject createInRealm:realm withValue:@[@\"Tim\", @29]];\n    [PersonObject createInRealm:realm withValue:@[@\"Ari\", @33]];\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(PersonObject, 1U, @\"name == 'Ari'\");\n    RLMAssertCount(PersonObject, 0U, @\"name == 'Ari' and age == 29\");\n    XCTAssertEqual(0U, [[[PersonObject objectsWhere:@\"name == 'Ari'\"] objectsWhere:@\"age == 29\"] count]);\n}\n\n- (void)testLinkViewQuery {\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    NSArray *employees = @[@{@\"name\": @\"John\", @\"age\": @30, @\"hired\": @NO},\n                           @{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES},\n                           @{@\"name\": @\"Jill\",  @\"age\": @50, @\"hired\": @YES}];\n    CompanyObject *company = [CompanyObject createInRealm:realm\n                                                withValue:@[@\"company name\", employees, employees, @{}]];\n    for (NSDictionary *eData in employees) {\n        company.employeeDict[eData[@\"name\"]] = [[EmployeeObject alloc] initWithValue:eData];\n    }\n    [realm commitWriteTransaction];\n\n    CompanyObject *co = [CompanyObject allObjects][0];\n    RLMAssertCount(co.employees, 1U, @\"hired = NO\");\n    RLMAssertCount(co.employees, 2U, @\"hired = YES\");\n    RLMAssertCount(co.employees, 1U, @\"hired = YES AND age = 40\");\n    RLMAssertCount(co.employees, 0U, @\"hired = YES AND age = 30\");\n    RLMAssertCount(co.employees, 3U, @\"hired = YES OR age = 30\");\n    RLMAssertCount([co.employees, 1U, @\"hired = YES\"] objectsWhere:@\"name = 'Joe'\");\n    RLMAssertCount(co.employeeSet, 1U, @\"hired = NO\");\n    RLMAssertCount(co.employeeSet, 2U, @\"hired = YES\");\n    RLMAssertCount(co.employeeSet, 1U, @\"hired = YES AND age = 40\");\n    RLMAssertCount(co.employeeSet, 0U, @\"hired = YES AND age = 30\");\n    RLMAssertCount(co.employeeSet, 3U, @\"hired = YES OR age = 30\");\n    RLMAssertCount([co.employeeSet, 1U, @\"hired = YES\"] objectsWhere:@\"name = 'Joe'\");\n    RLMAssertCount(co.employeeDict, 1U, @\"hired = NO\");\n    RLMAssertCount(co.employeeDict, 2U, @\"hired = YES\");\n    RLMAssertCount(co.employeeDict, 1U, @\"hired = YES AND age = 40\");\n    RLMAssertCount(co.employeeDict, 0U, @\"hired = YES AND age = 30\");\n    RLMAssertCount(co.employeeDict, 3U, @\"hired = YES OR age = 30\");\n    RLMAssertCount([co.employeeDict, 1U, @\"hired = YES\"] objectsWhere:@\"name = 'Joe'\");\n}\n\n- (void)testLinkViewQueryLifetime {\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    NSArray *employees = @[@{@\"name\": @\"John\", @\"age\": @30, @\"hired\": @NO},\n                           @{@\"name\": @\"Jill\",  @\"age\": @50, @\"hired\": @YES}];\n    CompanyObject *company = [CompanyObject createInRealm:realm\n                                                withValue:@[@\"company name\", employees, employees]];\n    for (NSDictionary *eData in employees) {\n        company.employeeDict[eData[@\"name\"]] = [[EmployeeObject alloc] initWithValue:eData];\n    }\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES}];\n    [realm commitWriteTransaction];\n\n    RLMResults<EmployeeObject *> *subarray = nil;\n    RLMResults<EmployeeObject *> *subarray2 = nil;\n    RLMResults<EmployeeObject *> *subarray3 = nil;\n    @autoreleasepool {\n        __attribute((objc_precise_lifetime)) CompanyObject *co = [CompanyObject allObjects][0];\n        subarray = [co.employees objectsWhere:@\"age = 40\"];\n        subarray2 = [co.employeeSet objectsWhere:@\"age = 40\"];\n        subarray3 = [co.employeeDict objectsWhere:@\"age = 40\"];\n        XCTAssertEqual(0U, subarray.count);\n        XCTAssertEqual(0U, subarray2.count);\n        XCTAssertEqual(0U, subarray3.count);\n    }\n\n    [realm beginWriteTransaction];\n    @autoreleasepool {\n        __attribute((objc_precise_lifetime)) CompanyObject *co = [CompanyObject allObjects][0];\n        [co.employees addObject:[EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES}]];\n        [co.employeeSet addObject:[EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES}]];\n        co.employeeDict[@\"Joe\"] = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES}];\n    }\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(1U, subarray.count);\n    XCTAssertEqualObjects(@\"Joe\", subarray[0][@\"name\"]);\n    XCTAssertEqual(1U, subarray2.count);\n    XCTAssertEqualObjects(@\"Joe\", subarray2[0][@\"name\"]);\n    XCTAssertEqual(1U, subarray3.count);\n    XCTAssertEqualObjects(@\"Joe\", subarray3[0][@\"name\"]);\n}\n\n- (void)testLinkViewQueryLiveUpdate {\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    NSArray *employees = @[@{@\"name\": @\"John\", @\"age\": @30, @\"hired\": @NO},\n                           @{@\"name\": @\"Jill\",  @\"age\": @40, @\"hired\": @YES}];\n    CompanyObject *company = [CompanyObject createInRealm:realm\n                                                withValue:@[@\"company name\", employees, employees]];\n    for (NSDictionary *eData in employees) {\n        company.employeeDict[eData[@\"name\"]] = [[EmployeeObject alloc] initWithValue:eData];\n    }\n    EmployeeObject *eo = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES}];\n    [realm commitWriteTransaction];\n\n    CompanyObject *co = CompanyObject.allObjects.firstObject;\n    RLMResults *basic = [co.employees objectsWhere:@\"age = 40\"];\n    RLMResults *sort = [co.employees sortedResultsUsingKeyPath:@\"name\" ascending:YES];\n    RLMResults *sortQuery = [[co.employees sortedResultsUsingKeyPath:@\"name\" ascending:YES] objectsWhere:@\"age = 40\"];\n    RLMResults *querySort = [[co.employees objectsWhere:@\"age = 40\"] sortedResultsUsingKeyPath:@\"name\" ascending:YES];\n    RLMResults *basic2 = [co.employeeSet objectsWhere:@\"age = 40\"];\n    RLMResults *sort2 = [co.employeeSet sortedResultsUsingKeyPath:@\"name\" ascending:YES];\n    RLMResults *sortQuery2 = [[co.employeeSet sortedResultsUsingKeyPath:@\"name\" ascending:YES] objectsWhere:@\"age = 40\"];\n    RLMResults *querySort2 = [[co.employeeSet objectsWhere:@\"age = 40\"] sortedResultsUsingKeyPath:@\"name\" ascending:YES];\n    RLMResults *basic3 = [co.employeeDict objectsWhere:@\"age = 40\"];\n    RLMResults *sort3 = [co.employeeDict sortedResultsUsingKeyPath:@\"name\" ascending:YES];\n    RLMResults *sortQuery3 = [[co.employeeDict sortedResultsUsingKeyPath:@\"name\" ascending:YES] objectsWhere:@\"age = 40\"];\n    RLMResults *querySort3 = [[co.employeeDict objectsWhere:@\"age = 40\"] sortedResultsUsingKeyPath:@\"name\" ascending:YES];\n\n    XCTAssertEqual(1U, basic.count);\n    XCTAssertEqual(2U, sort.count);\n    XCTAssertEqual(1U, sortQuery.count);\n    XCTAssertEqual(1U, querySort.count);\n\n    XCTAssertEqual(1U, basic2.count);\n    XCTAssertEqual(2U, sort2.count);\n    XCTAssertEqual(1U, sortQuery2.count);\n    XCTAssertEqual(1U, querySort2.count);\n\n    XCTAssertEqual(1U, basic3.count);\n    XCTAssertEqual(2U, sort3.count);\n    XCTAssertEqual(1U, sortQuery3.count);\n    XCTAssertEqual(1U, querySort3.count);\n\n    XCTAssertEqualObjects(@\"Jill\", [[basic lastObject] name]);\n    XCTAssertEqualObjects(@\"Jill\", [[sortQuery lastObject] name]);\n    XCTAssertEqualObjects(@\"Jill\", [[querySort lastObject] name]);\n\n    XCTAssertEqualObjects(@\"Jill\", [[basic2 lastObject] name]);\n    XCTAssertEqualObjects(@\"Jill\", [[sortQuery2 lastObject] name]);\n    XCTAssertEqualObjects(@\"Jill\", [[querySort2 lastObject] name]);\n\n    XCTAssertEqualObjects(@\"Jill\", [[basic3 lastObject] name]);\n    XCTAssertEqualObjects(@\"Jill\", [[sortQuery3 lastObject] name]);\n    XCTAssertEqualObjects(@\"Jill\", [[querySort3 lastObject] name]);\n\n    [realm beginWriteTransaction];\n    [co.employees addObject:eo];\n    [co.employeeSet addObject:eo];\n    co.employeeDict[eo.name] = eo;\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(2U, basic.count);\n    XCTAssertEqual(3U, sort.count);\n    XCTAssertEqual(2U, sortQuery.count);\n    XCTAssertEqual(2U, querySort.count);\n\n    XCTAssertEqual(2U, basic2.count);\n    XCTAssertEqual(3U, sort2.count);\n    XCTAssertEqual(2U, sortQuery2.count);\n    XCTAssertEqual(2U, querySort2.count);\n\n    XCTAssertEqual(2U, basic3.count);\n    XCTAssertEqual(3U, sort3.count);\n    XCTAssertEqual(2U, sortQuery3.count);\n    XCTAssertEqual(2U, querySort3.count);\n\n    XCTAssertEqualObjects(@\"Joe\", [[basic lastObject] name]);\n    XCTAssertEqualObjects(@\"Joe\", [[sortQuery lastObject] name]);\n    XCTAssertEqualObjects(@\"Joe\", [[querySort lastObject] name]);\n\n    XCTAssertEqualObjects(@\"Joe\", [[basic2 lastObject] name]);\n    XCTAssertEqualObjects(@\"Joe\", [[sortQuery2 lastObject] name]);\n    XCTAssertEqualObjects(@\"Joe\", [[querySort2 lastObject] name]);\n\n    XCTAssertEqualObjects(@\"Joe\", [[basic3 lastObject] name]);\n    XCTAssertEqualObjects(@\"Joe\", [[sortQuery3 lastObject] name]);\n    XCTAssertEqualObjects(@\"Joe\", [[querySort3 lastObject] name]);\n}\n\n- (void)testConstantPredicates\n{\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    [PersonObject createInRealm:realm withValue:@[@\"Fiel\", @27]];\n    [PersonObject createInRealm:realm withValue:@[@\"Tim\", @29]];\n    [PersonObject createInRealm:realm withValue:@[@\"Ari\", @33]];\n    [realm commitWriteTransaction];\n\n    RLMResults *all = [PersonObject objectsWithPredicate:[NSPredicate predicateWithValue:YES]];\n    XCTAssertEqual(all.count, 3U, @\"Expecting 3 results\");\n\n    RLMResults *none = [PersonObject objectsWithPredicate:[NSPredicate predicateWithValue:NO]];\n    XCTAssertEqual(none.count, 0U, @\"Expecting 0 results\");\n}\n\n- (void)testEmptyCompoundPredicates\n{\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    [PersonObject createInRealm:realm withValue:@[@\"Fiel\", @27]];\n    [PersonObject createInRealm:realm withValue:@[@\"Tim\", @29]];\n    [PersonObject createInRealm:realm withValue:@[@\"Ari\", @33]];\n    [realm commitWriteTransaction];\n\n    RLMResults *all = [PersonObject objectsWithPredicate:[NSCompoundPredicate andPredicateWithSubpredicates:@[]]];\n    XCTAssertEqual(all.count, 3U, @\"Expecting 3 results\");\n\n    RLMResults *none = [PersonObject objectsWithPredicate:[NSCompoundPredicate orPredicateWithSubpredicates:@[]]];\n    XCTAssertEqual(none.count, 0U, @\"Expecting 0 results\");\n}\n\nstatic NSData *data(const char *str) {\n    return [NSData dataWithBytes:str length:strlen(str)];\n}\n\n- (NSArray<NSArray *> *)queryObjectClassValues {\n    RLMObjectId *oid1 = [RLMObjectId objectId];\n    RLMObjectId *oid2 = [RLMObjectId objectId];\n    return @[\n        @[@YES, @YES, @1, @2, @23.0f, @1.7f,  @0.0,  @5.55, @\"a\", @\"a\", data(\"a\"), data(\"a\"), @1, @2, oid1, oid1, @YES, @NO],\n        @[@YES, @NO,  @1, @3, @-5.3f, @4.21f, @1.0,  @4.44, @\"a\", @\"A\", data(\"a\"), data(\"A\"), @1, @3, oid1, oid2, @1, @2],\n        @[@NO,  @NO,  @2, @2, @1.0f,  @3.55f, @99.9, @6.66, @\"a\", @\"ab\", data(\"a\"), data(\"ab\"), @2, @2, oid2, oid2, @1.0f, @2.0f],\n        @[@NO,  @YES, @3, @6, @4.21f, @1.0f,  @1.0,  @7.77, @\"a\", @\"AB\", data(\"a\"), data(\"AB\"), @3, @6, oid2, oid1, @\"one\", @\"two\"],\n        @[@YES, @YES, @4, @5, @23.0f, @23.0f, @7.4,  @8.88, @\"a\", @\"b\", data(\"a\"), data(\"b\"), @4, @5, oid1, oid1, @\"two\", @\"three\"],\n        @[@YES, @NO,  @15, @8, @1.0f,  @66.0f, @1.01, @9.99, @\"a\", @\"ba\", data(\"a\"), data(\"ba\"), @15, @8, oid1, oid2, data(\"a\"), data(\"b\")],\n        @[@NO,  @YES, @15, @15, @1.0f,  @66.0f, @1.01, @9.99, @\"a\", @\"BA\", data(\"a\"), data(\"BA\"), @15, @15, oid2, oid1, oid1, oid2],\n    ];\n}\n\n- (void)testComparisonsWithKeyPathOnRHS\n{\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    NSArray<NSArray *> *values = [self queryObjectClassValues];\n    RLMObjectId *oid1 = values[0][14];\n    for (id value in values) {\n        [self.queryObjectClass createInRealm:realm withValue:value];\n    }\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(self.queryObjectClass, 4U, @\"TRUE == bool1\");\n    RLMAssertCount(self.queryObjectClass, 3U, @\"TRUE != bool2\");\n\n    RLMAssertCount(self.queryObjectClass, 2U, @\"1 == int1\");\n    RLMAssertCount(self.queryObjectClass, 5U, @\"2 != int2\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"2 > int1\");\n    RLMAssertCount(self.queryObjectClass, 4U, @\"2 < int1\");\n    RLMAssertCount(self.queryObjectClass, 3U, @\"2 >= int1\");\n    RLMAssertCount(self.queryObjectClass, 5U, @\"2 <= int1\");\n\n    RLMAssertCount(self.queryObjectClass, 3U, @\"1.0 == float1\");\n    RLMAssertCount(self.queryObjectClass, 6U, @\"1.0 != float2\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"1.0 > float1\");\n    RLMAssertCount(self.queryObjectClass, 6U, @\"1.0 < float2\");\n    RLMAssertCount(self.queryObjectClass, 4U, @\"1.0 >= float1\");\n    RLMAssertCount(self.queryObjectClass, 7U, @\"1.0 <= float2\");\n\n    RLMAssertCount(self.queryObjectClass, 2U, @\"1.0 == double1\");\n    RLMAssertCount(self.queryObjectClass, 5U, @\"1.0 != double1\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"5.0 > double2\");\n    RLMAssertCount(self.queryObjectClass, 6U, @\"5.0 < double2\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"5.55 >= double2\");\n    RLMAssertCount(self.queryObjectClass, 6U, @\"5.55 <= double2\");\n\n    RLMAssertCount(self.queryObjectClass, 1U, @\"'a' == string2\");\n    RLMAssertCount(self.queryObjectClass, 6U, @\"'a' != string2\");\n\n    RLMAssertCount(self.queryObjectClass, 1U, @\"%@ == data2\", data(\"a\"));\n    RLMAssertCount(self.queryObjectClass, 6U, @\"%@ != data2\", data(\"a\"));\n\n    RLMAssertCount(self.queryObjectClass, 2U, @\"1 == decimal1\");\n    RLMAssertCount(self.queryObjectClass, 5U, @\"2 != decimal2\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"2 > decimal1\");\n    RLMAssertCount(self.queryObjectClass, 4U, @\"2 < decimal1\");\n    RLMAssertCount(self.queryObjectClass, 3U, @\"2 >= decimal1\");\n    RLMAssertCount(self.queryObjectClass, 5U, @\"2 <= decimal1\");\n\n    RLMAssertCount(self.queryObjectClass, 2U, @\"1 == any1\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"1.0 == any1\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"'one' == any1\");\n    RLMAssertCount(self.queryObjectClass, 6U, @\"'one' != any1\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"TRUE == any1\");\n    RLMAssertCount(self.queryObjectClass, 6U, @\"TRUE != any1\");\n    RLMAssertCount(self.queryObjectClass, 1U, @\"%@ == any1\", oid1);\n    RLMAssertCount(self.queryObjectClass, 6U, @\"%@ != any1\", oid1);\n    RLMAssertCount(self.queryObjectClass, 5U, @\"2 != any2\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"2 > any1\");\n    RLMAssertCount(self.queryObjectClass, 0U, @\"2 < any1\");\n    RLMAssertCount(self.queryObjectClass, 2U, @\"2 >= any1\");\n    RLMAssertCount(self.queryObjectClass, 0U, @\"2 <= any1\");\n\n    RLMAssertCount(self.queryObjectClass, 4U, @\"%@ == objectId1\", oid1);\n    RLMAssertCount(self.queryObjectClass, 3U, @\"%@ != objectId2\", oid1);\n\n    RLMAssertThrowsWithReasonMatching([self.queryObjectClass objectsWhere:@\"'Realm' CONTAINS string1\"].count,\n                                      @\"Operator 'CONTAINS' requires a keypath on the left side.\");\n    RLMAssertThrowsWithReasonMatching([self.queryObjectClass objectsWhere:@\"'Amazon' BEGINSWITH string2\"].count,\n                                      @\"Operator 'BEGINSWITH' requires a keypath on the left side.\");\n    RLMAssertThrowsWithReasonMatching([self.queryObjectClass objectsWhere:@\"'Tuba' ENDSWITH string1\"].count,\n                                      @\"Operator 'ENDSWITH' requires a keypath on the left side.\");\n    RLMAssertThrowsWithReasonMatching([self.queryObjectClass objectsWhere:@\"'Tuba' LIKE string1\"].count,\n                                      @\"Operator 'LIKE' requires a keypath on the left side.\");\n}\n\n- (void)testLinksToDeletedOrMovedObject\n{\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n\n    DogObject *fido = [DogObject createInRealm:realm withValue:@[ @\"Fido\", @3 ]];\n    [OwnerObject createInRealm:realm withValue:@[ @\"Fido's owner\", fido ]];\n\n    DogObject *rex = [DogObject createInRealm:realm withValue:@[ @\"Rex\", @2 ]];\n    [OwnerObject createInRealm:realm withValue:@[ @\"Rex's owner\", rex ]];\n\n    DogObject *spot = [DogObject createInRealm:realm withValue:@[ @\"Spot\", @2 ]];\n    [OwnerObject createInRealm:realm withValue:@[ @\"Spot's owner\", spot ]];\n\n    [realm commitWriteTransaction];\n\n    RLMResults *fidoQuery = [OwnerObject objectsInRealm:realm where:@\"dog == %@\", fido];\n    RLMResults *rexQuery = [OwnerObject objectsInRealm:realm where:@\"dog == %@\", rex];\n    RLMResults *spotQuery = [OwnerObject objectsInRealm:realm where:@\"dog == %@\", spot];\n\n    [realm beginWriteTransaction];\n    [realm deleteObject:fido];\n    [realm commitWriteTransaction];\n\n    // Fido was removed, so we should not find his owner.\n    XCTAssertEqual(0u, fidoQuery.count);\n\n    // Rex's owner should be found as the row was not touched.\n    XCTAssertEqual(1u, rexQuery.count);\n    XCTAssertEqualObjects(@\"Rex's owner\", [rexQuery.firstObject name]);\n\n    // Spot's owner should be found, despite Spot's row having moved.\n    XCTAssertEqual(1u, spotQuery.count);\n    XCTAssertEqualObjects(@\"Spot's owner\", [spotQuery.firstObject name]);\n}\n\n- (void)testQueryOnDeletedArrayProperty\n{\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n    IntObject *io = [IntObject createInRealm:realm withValue:@[@0]];\n    ArrayPropertyObject *array = [ArrayPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[io]]];\n    [realm commitWriteTransaction];\n\n    RLMResults *results = [array.intArray objectsWhere:@\"TRUEPREDICATE\"];\n    XCTAssertEqual(1U, results.count);\n\n    [realm beginWriteTransaction];\n    [realm deleteObject:array];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(0U, results.count);\n    XCTAssertNil(results.firstObject);\n}\n\n- (void)testQueryOnDeletedSetProperty\n{\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n    IntObject *io = [IntObject createInRealm:realm withValue:@[@0]];\n    SetPropertyObject *set = [SetPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[io]]];\n    [realm commitWriteTransaction];\n\n    RLMResults *results = [set.intSet objectsWhere:@\"TRUEPREDICATE\"];\n    XCTAssertEqual(1U, results.count);\n\n    [realm beginWriteTransaction];\n    [realm deleteObject:set];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(0U, results.count);\n    XCTAssertNil(results.firstObject);\n}\n\n- (void)testQueryOnDeletedDictionaryProperty\n{\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n    IntObject *io = [IntObject createInRealm:realm withValue:@[@0]];\n    DictionaryPropertyObject *dpo = [DictionaryPropertyObject createInRealm:realm withValue:@{@\"intObjDictionary\": @{@\"0\": io}}];\n    [realm commitWriteTransaction];\n\n    RLMResults *results = [dpo.intObjDictionary objectsWhere:@\"TRUEPREDICATE\"];\n    XCTAssertEqual(1U, results.count);\n\n    [realm beginWriteTransaction];\n    [realm deleteObject:dpo];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(0U, results.count);\n    XCTAssertNil(results.firstObject);\n}\n\n- (void)testSubqueries\n{\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n\n    NSArray *employees = @[@{@\"name\": @\"John\", @\"age\": @30, @\"hired\": @NO},\n                           @{@\"name\": @\"Jill\",  @\"age\": @40, @\"hired\": @YES},\n                           @{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES}];\n\n    NSArray *employees2 = @[@{@\"name\": @\"Bill\", @\"age\": @35, @\"hired\": @YES},\n                            @{@\"name\": @\"Don\",  @\"age\": @45, @\"hired\": @NO},\n                            @{@\"name\": @\"Tim\",  @\"age\": @60, @\"hired\": @NO}];\n    CompanyObject *first = [CompanyObject createInRealm:realm\n                                              withValue:@[@\"first company\", employees, employees]];\n    for (NSDictionary *eData in employees) {\n        first.employeeDict[eData[@\"name\"]] = [[EmployeeObject alloc] initWithValue:eData];\n    }\n    CompanyObject *second = [CompanyObject createInRealm:realm\n                                               withValue:@[@\"second company\", employees2, employees2]];\n    for (NSDictionary *eData in employees2) {\n        second.employeeDict[eData[@\"name\"]] = [[EmployeeObject alloc] initWithValue:eData];\n    }\n\n    [LinkToCompanyObject createInRealm:realm withValue:@[ first ]];\n    [LinkToCompanyObject createInRealm:realm withValue:@[ second ]];\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(CompanyObject, 1U, @\"SUBQUERY(employees, $employee, $employee.age > 30 AND $employee.hired = FALSE).@count > 0\");\n    RLMAssertCount(CompanyObject, 2U, @\"SUBQUERY(employees, $employee, $employee.age < 30 AND $employee.hired = TRUE).@count == 0\");\n    RLMAssertCount(CompanyObject, 1U, @\"SUBQUERY(employeeSet, $employee, $employee.age > 30 AND $employee.hired = FALSE).@count > 0\");\n    RLMAssertCount(CompanyObject, 2U, @\"SUBQUERY(employeeSet, $employee, $employee.age < 30 AND $employee.hired = TRUE).@count == 0\");\n\n    RLMAssertCount(LinkToCompanyObject, 1U, @\"SUBQUERY(company.employees, $employee, $employee.age > 30 AND $employee.hired = FALSE).@count > 0\");\n    RLMAssertCount(LinkToCompanyObject, 2U, @\"SUBQUERY(company.employees, $employee, $employee.age < 30 AND $employee.hired = TRUE).@count == 0\");\n\n    RLMAssertCount(LinkToCompanyObject, 1U, @\"SUBQUERY(company.employeeSet, $employee, $employee.age > 30 AND $employee.hired = FALSE).@count > 0\");\n    RLMAssertCount(LinkToCompanyObject, 2U, @\"SUBQUERY(company.employeeSet, $employee, $employee.age < 30 AND $employee.hired = TRUE).@count == 0\");\n\n    RLMAssertCount(LinkToCompanyObject, 1U, @\"SUBQUERY(company.employeeDict, $employee, $employee.age > 30 AND $employee.hired = FALSE).@count > 0\");\n    RLMAssertCount(LinkToCompanyObject, 2U, @\"SUBQUERY(company.employeeDict, $employee, $employee.age < 30 AND $employee.hired = TRUE).@count == 0\");\n}\n\n- (void)testLinkingObjects {\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n\n    PersonObject *hannah   = [PersonObject createInRealm:realm withValue:@[ @\"Hannah\",   @0 ]];\n    PersonObject *elijah   = [PersonObject createInRealm:realm withValue:@[ @\"Elijah\",   @3 ]];\n\n    PersonObject *mark     = [PersonObject createInRealm:realm withValue:@[ @\"Mark\",     @30, @[ hannah ]]];\n    PersonObject *jason    = [PersonObject createInRealm:realm withValue:@[ @\"Jason\",    @31, @[ elijah ]]];\n\n    PersonObject *diane    = [PersonObject createInRealm:realm withValue:@[ @\"Diane\",    @29, @[ hannah ]]];\n    PersonObject *carol    = [PersonObject createInRealm:realm withValue:@[ @\"Carol\",    @31 ]];\n\n    PersonObject *michael  = [PersonObject createInRealm:realm withValue:@[ @\"Michael\",  @57, @[ jason, mark ]]];\n    PersonObject *raewynne = [PersonObject createInRealm:realm withValue:@[ @\"Raewynne\", @57, @[ jason, mark ]]];\n\n    PersonObject *don      = [PersonObject createInRealm:realm withValue:@[ @\"Don\",      @64, @[ carol, diane ]]];\n    PersonObject *diane_sr = [PersonObject createInRealm:realm withValue:@[ @\"Diane\",    @60, @[ carol, diane ]]];\n\n    [realm commitWriteTransaction];\n\n    NSArray *(^asArray)(RLMResults *) = ^(RLMResults *results) {\n        return [[self evaluate:results] valueForKeyPath:@\"self\"];\n    };\n\n    // People that have a parent with a name that starts with 'M'.\n    RLMResults *r1 = [PersonObject objectsWhere:@\"ANY parents.name BEGINSWITH 'M'\"];\n    XCTAssertEqualObjects(asArray(r1), (@[ hannah, mark, jason ]));\n\n    // People that have a grandparent with a name that starts with 'M'.\n    RLMResults *r2 = [PersonObject objectsWhere:@\"ANY parents.parents.name BEGINSWITH 'M'\"];\n    XCTAssertEqualObjects(asArray(r2), (@[ hannah, elijah ]));\n\n    // People that have children that have a parent named Diane.\n    RLMResults *r3 = [PersonObject objectsWhere:@\"ANY children.parents.name == 'Diane'\"];\n    XCTAssertEqualObjects(asArray(r3), (@[ mark, diane, don, diane_sr ]));\n\n    // People that have children that have a grandparent named Don.\n    RLMResults *r4 = [PersonObject objectsWhere:@\"ANY children.parents.parents.name == 'Don'\"];\n    XCTAssertEqualObjects(asArray(r4), (@[ mark, diane ]));\n\n    // People whose parents have an average age of < 60.\n    RLMResults *r5 = [PersonObject objectsWhere:@\"parents.@avg.age < 60\"];\n    XCTAssertEqualObjects(asArray(r5), (@[ hannah, elijah, mark, jason ]));\n\n    // People that have at least one sibling.\n    RLMResults *r6 = [PersonObject objectsWhere:@\"SUBQUERY(parents, $parent, $parent.children.@count > 1).@count > 0\"];\n    XCTAssertEqualObjects(asArray(r6), (@[ mark, jason, diane, carol ]));\n\n    // People that have Raewynne as a parent.\n    RLMResults *r7 = [PersonObject objectsWhere:@\"ANY parents == %@\", raewynne];\n    XCTAssertEqualObjects(asArray(r7), (@[ mark, jason ]));\n\n    // People that have Mark as a child.\n    RLMResults *r8 = [PersonObject objectsWhere:@\"ANY children == %@\", mark];\n    XCTAssertEqualObjects(asArray(r8), (@[ michael, raewynne ]));\n\n    // People that have Michael as a grandparent.\n    RLMResults *r9 = [PersonObject objectsWhere:@\"ANY parents.parents == %@\", michael];\n    XCTAssertEqualObjects(asArray(r9), (@[ hannah, elijah ]));\n\n    // People that have Hannah as a grandchild.\n    RLMResults *r10 = [PersonObject objectsWhere:@\"ANY children.children == %@\", hannah];\n    XCTAssertEqualObjects(asArray(r10), (@[ michael, raewynne, don, diane_sr ]));\n\n    // People that have no listed parents.\n    RLMResults *r11 = [PersonObject objectsWhere:@\"parents.@count == 0\"];\n    XCTAssertEqualObjects(asArray(r11), (@[ michael, raewynne, don, diane_sr ]));\n\n    // No links are equal to a detached row accessor.\n    RLMResults *r12 = [PersonObject objectsWhere:@\"ANY parents == %@\", [PersonObject new]];\n    XCTAssertEqualObjects(asArray(r12), (@[ ]));\n\n    // All links are not equal to a detached row accessor so this will match all rows that are linked to.\n    RLMResults *r13 = [PersonObject objectsWhere:@\"ANY parents != %@\", [PersonObject new]];\n    XCTAssertEqualObjects(asArray(r13), (@[ hannah, elijah, mark, jason, diane, carol ]));\n\n    // Linking objects cannot contain null so their members cannot be compared with null.\n    XCTAssertThrows([PersonObject objectsWhere:@\"ANY parents == NULL\"]);\n\n    // People that have a parent under the age of 31 where that parent has a parent over the age of 35 whose name is Michael.\n    RLMResults *r14 = [PersonObject objectsWhere:@\"SUBQUERY(parents, $p1, $p1.age < 31 AND SUBQUERY($p1.parents, $p2, $p2.age > 35 AND $p2.name == 'Michael').@count > 0).@count > 0\"];\n    XCTAssertEqualObjects(asArray(r14), (@[ hannah ]));\n\n\n    // Add a new link and verify that the existing results update as expected.\n    __block PersonObject *mackenzie;\n    [realm transactionWithBlock:^{\n        mackenzie = [PersonObject createInRealm:realm withValue:@[ @\"Mackenzie\", @0 ]];\n        [jason.children addObject:mackenzie];\n    }];\n\n\n    // People that have a parent with a name that starts with 'M'.\n    XCTAssertEqualObjects(asArray(r1), (@[ hannah, mark, jason ]));\n\n    // People that have a grandparent with a name that starts with 'M'.\n    XCTAssertEqualObjects(asArray(r2), (@[ hannah, elijah, mackenzie ]));\n\n    // People that have children that have a parent named Diane.\n    XCTAssertEqualObjects(asArray(r3), (@[ mark, diane, don, diane_sr ]));\n\n    // People that have children that have a grandparent named Don.\n    XCTAssertEqualObjects(asArray(r4), (@[ mark, diane ]));\n\n    // People whose parents have an average age of < 60.\n    XCTAssertEqualObjects(asArray(r5), (@[ hannah, elijah, mark, jason, mackenzie ]));\n\n    // People that have at least one sibling.\n    XCTAssertEqualObjects(asArray(r6), (@[ elijah, mark, jason, diane, carol, mackenzie ]));\n\n    // People that have Raewynne as a parent.\n    XCTAssertEqualObjects(asArray(r7), (@[ mark, jason ]));\n\n    // People that have Mark as a child.\n    XCTAssertEqualObjects(asArray(r8), (@[ michael, raewynne ]));\n\n    // People that have Michael as a grandparent.\n    XCTAssertEqualObjects(asArray(r9), (@[ hannah, elijah, mackenzie ]));\n\n    // People that have Hannah as a grandchild.\n    XCTAssertEqualObjects(asArray(r10), (@[ michael, raewynne, don, diane_sr ]));\n\n    // People that have no listed parents.\n    XCTAssertEqualObjects(asArray(r11), (@[ michael, raewynne, don, diane_sr ]));\n\n    // No links are equal to a detached row accessor.\n    XCTAssertEqualObjects(asArray(r12), (@[ ]));\n\n    // All links are not equal to a detached row accessor so this will match all rows that are linked to.\n    XCTAssertEqualObjects(asArray(r13), (@[ hannah, elijah, mark, jason, diane, carol, mackenzie ]));\n\n    // People that have a parent under the age of 31 where that parent has a parent over the age of 35 whose name is Michael.\n    XCTAssertEqualObjects(asArray(r14), (@[ hannah ]));\n}\n\n- (void)testCountOnArrayCollection {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n\n    IntegerArrayPropertyObject *arr = [IntegerArrayPropertyObject createInRealm:realm withValue:@[ @1, @[]]];\n    [arr.array addObject:[IntObject createInRealm:realm withValue:@[ @456 ]]];\n\n    arr = [IntegerArrayPropertyObject createInRealm:realm withValue:@[ @2, @[]]];\n    [arr.array addObject:[IntObject createInRealm:realm withValue:@[ @1 ]]];\n    [arr.array addObject:[IntObject createInRealm:realm withValue:@[ @2 ]]];\n    [arr.array addObject:[IntObject createInRealm:realm withValue:@[ @3 ]]];\n\n    [IntegerArrayPropertyObject createInRealm:realm withValue:@[ @0, @[]]];\n\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(IntegerArrayPropertyObject, 2U, @\"array.@count > 0\");\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"array.@count == 3\");\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"array.@count < 1\");\n    RLMAssertCount(IntegerArrayPropertyObject, 2U, @\"0 < array.@count\");\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"3 == array.@count\");\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"1 >  array.@count\");\n\n    RLMAssertCount(IntegerArrayPropertyObject, 2U, @\"array.@count == number\");\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"array.@count > number\");\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"number < array.@count\");\n\n    // We do not yet handle collection operations on both sides of the comparison.\n    RLMAssertThrowsWithReasonMatching(([IntegerArrayPropertyObject objectsWhere:@\"array.@count == array.@count\"]),\n                                      @\"aggregate operations cannot be compared with other aggregate operations\");\n\n    RLMAssertThrowsWithReason(([IntegerArrayPropertyObject objectsWhere:@\"array.@count.foo.bar != 0\"]),\n                              @\"Invalid keypath 'array.@count.foo.bar': @count must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([IntegerArrayPropertyObject objectsWhere:@\"array.@count.intCol > 0\"]),\n                              @\"Invalid keypath 'array.@count.intCol': @count must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([IntegerArrayPropertyObject objectsWhere:@\"array.@count != 'Hello'\"]),\n                              @\"@count can only be compared with a numeric value\");\n}\n\n- (void)testCountOnSetCollection {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n\n    IntegerSetPropertyObject *set = [IntegerSetPropertyObject createInRealm:realm withValue:@[ @1, @[]]];\n    [set.set addObject:[IntObject createInRealm:realm withValue:@[ @456 ]]];\n\n    set = [IntegerSetPropertyObject createInRealm:realm withValue:@[ @2, @[]]];\n    [set.set addObject:[IntObject createInRealm:realm withValue:@[ @1 ]]];\n    [set.set addObject:[IntObject createInRealm:realm withValue:@[ @2 ]]];\n    [set.set addObject:[IntObject createInRealm:realm withValue:@[ @3 ]]];\n\n    [IntegerSetPropertyObject createInRealm:realm withValue:@[ @0, @[]]];\n\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(IntegerSetPropertyObject, 2U, @\"set.@count > 0\");\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"set.@count == 3\");\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"set.@count < 1\");\n    RLMAssertCount(IntegerSetPropertyObject, 2U, @\"0 < set.@count\");\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"3 == set.@count\");\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"1 >  set.@count\");\n\n    RLMAssertCount(IntegerSetPropertyObject, 2U, @\"set.@count == number\");\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"set.@count > number\");\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"number < set.@count\");\n\n    // We do not yet handle collection operations on both sides of the comparison.\n    RLMAssertThrowsWithReason(([IntegerSetPropertyObject objectsWhere:@\"set.@count == set.@count\"]),\n                              @\"aggregate operations cannot be compared with other aggregate operations\");\n\n    RLMAssertThrowsWithReason(([IntegerSetPropertyObject objectsWhere:@\"set.@count.foo.bar != 0\"]),\n                              @\"Invalid keypath 'set.@count.foo.bar': @count must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([IntegerSetPropertyObject objectsWhere:@\"set.@count.intCol > 0\"]),\n                              @\"Invalid keypath 'set.@count.intCol': @count must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([IntegerSetPropertyObject objectsWhere:@\"set.@count != 'Hello'\"]),\n                              @\"@count can only be compared with a numeric value\");\n}\n\n- (void)testCountOnDictionaryCollection {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n\n    IntegerDictionaryPropertyObject *idpo = [IntegerDictionaryPropertyObject createInRealm:realm withValue:@[ @1, @[]]];\n    idpo.dictionary[@\"456\"] = [IntObject createInRealm:realm withValue:@[ @456 ]];\n\n    idpo = [IntegerDictionaryPropertyObject createInRealm:realm withValue:@[ @2, @[]]];\n    idpo.dictionary[@\"1\"] = [IntObject createInRealm:realm withValue:@[ @1 ]];\n    idpo.dictionary[@\"2\"] = [IntObject createInRealm:realm withValue:@[ @2 ]];\n    idpo.dictionary[@\"3\"] = [IntObject createInRealm:realm withValue:@[ @3 ]];\n\n    [IntegerDictionaryPropertyObject createInRealm:realm withValue:@[ @0, @[]]];\n\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(IntegerDictionaryPropertyObject, 2U, @\"dictionary.@count > 0\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"dictionary.@count == 3\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"dictionary.@count < 1\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 2U, @\"0 < dictionary.@count\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"3 == dictionary.@count\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"1 >  dictionary.@count\");\n\n    RLMAssertCount(IntegerDictionaryPropertyObject, 2U, @\"dictionary.@count == number\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"dictionary.@count > number\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"number < dictionary.@count\");\n\n    // We do not yet handle collection operations on both sides of the comparison.\n    RLMAssertThrowsWithReason(([IntegerDictionaryPropertyObject objectsWhere:@\"dictionary.@count == dictionary.@count\"]),\n                              @\"aggregate operations cannot be compared with other aggregate operations\");\n\n    RLMAssertThrowsWithReason(([IntegerDictionaryPropertyObject objectsWhere:@\"dictionary.@count.foo.bar != 0\"]),\n                              @\"Invalid keypath 'dictionary.@count.foo.bar': @count must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([IntegerDictionaryPropertyObject objectsWhere:@\"dictionary.@count.intCol > 0\"]),\n                              @\"Invalid keypath 'dictionary.@count.intCol': @count must appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([IntegerDictionaryPropertyObject objectsWhere:@\"dictionary.@count != 'Hello'\"]),\n                              @\"@count can only be compared with a numeric value\");\n}\n\n- (void)testAggregateArrayCollectionOperators {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n\n    IntegerArrayPropertyObject *arr = [IntegerArrayPropertyObject createInRealm:realm withValue:@[ @1111, @[] ]];\n    [arr.array addObject:[IntObject createInRealm:realm withValue:@[ @1234 ]]];\n    [arr.array addObject:[IntObject createInRealm:realm withValue:@[ @2 ]]];\n    [arr.array addObject:[IntObject createInRealm:realm withValue:@[ @-12345 ]]];\n\n    arr = [IntegerArrayPropertyObject createInRealm:realm withValue:@[ @2222, @[] ]];\n    [arr.array addObject:[IntObject createInRealm:realm withValue:@[ @100 ]]];\n\n    [IntegerArrayPropertyObject createInRealm:realm withValue:@[ @3333, @[] ]];\n\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"array.@min.intCol == -12345\");\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"array.@min.intCol == 100\");\n    RLMAssertCount(IntegerArrayPropertyObject, 2U, @\"array.@min.intCol < 1000\");\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"array.@min.intCol > -1000\");\n\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"array.@max.intCol == 1234\");\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"array.@max.intCol == 100\");\n    RLMAssertCount(IntegerArrayPropertyObject, 2U, @\"array.@max.intCol > -1000\");\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"array.@max.intCol > 1000\");\n\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"array.@sum.intCol == 100\");\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"array.@sum.intCol == -11109\");\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"array.@sum.intCol == 0\");\n    RLMAssertCount(IntegerArrayPropertyObject, 2U, @\"array.@sum.intCol > -50\");\n    RLMAssertCount(IntegerArrayPropertyObject, 2U, @\"array.@sum.intCol < 50\");\n\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"array.@avg.intCol == 100\");\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"array.@avg.intCol == -3703\");\n    RLMAssertCount(IntegerArrayPropertyObject, 0U, @\"array.@avg.intCol == 0\");\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"array.@avg.intCol < -50\");\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"array.@avg.intCol > 50\");\n\n    RLMAssertCount(IntegerArrayPropertyObject, 2U, @\"array.@min.intCol < number\");\n    RLMAssertCount(IntegerArrayPropertyObject, 2U, @\"number > array.@min.intCol\");\n\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"array.@max.intCol < number\");\n    RLMAssertCount(IntegerArrayPropertyObject, 1U, @\"number > array.@max.intCol\");\n\n    RLMAssertCount(IntegerArrayPropertyObject, 2U, @\"array.@avg.intCol < number\");\n    RLMAssertCount(IntegerArrayPropertyObject, 2U, @\"number > array.@avg.intCol\");\n\n    // We do not yet handle collection operations on both sides of the comparison.\n    RLMAssertThrowsWithReason(([IntegerArrayPropertyObject objectsWhere:@\"array.@min.intCol == array.@min.intCol\"]),\n                              @\"aggregate operations cannot be compared with other aggregate operations\");\n\n    RLMAssertThrowsWithReason(([IntegerArrayPropertyObject objectsWhere:@\"array.@min.intCol.foo.bar == 1.23\"]),\n                              @\"Invalid keypath 'array.@min.intCol.foo.bar': Property 'IntObject.intCol' is not a link or collection and can only appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([IntegerArrayPropertyObject objectsWhere:@\"array.@max.intCol.foo.bar == 1.23\"]),\n                              @\"Invalid keypath 'array.@max.intCol.foo.bar': Property 'IntObject.intCol' is not a link or collection and can only appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([IntegerArrayPropertyObject objectsWhere:@\"array.@sum.intCol.foo.bar == 1.23\"]),\n                              @\"Invalid keypath 'array.@sum.intCol.foo.bar': Property 'IntObject.intCol' is not a link or collection and can only appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([IntegerArrayPropertyObject objectsWhere:@\"array.@avg.intCol.foo.bar == 1.23\"]),\n                              @\"Invalid keypath 'array.@avg.intCol.foo.bar': Property 'IntObject.intCol' is not a link or collection and can only appear at the end of a keypath.\");\n\n    // Average is omitted from this test as its result is always a double.\n    RLMAssertThrowsWithReasonMatching(([IntegerArrayPropertyObject objectsWhere:@\"array.@min.intCol == 1.23\"]),\n                                      @\"@min.*type int cannot be compared\");\n    RLMAssertThrowsWithReasonMatching(([IntegerArrayPropertyObject objectsWhere:@\"array.@max.intCol == 1.23\"]),\n                                      @\"@max.*type int cannot be compared\");\n    RLMAssertThrowsWithReasonMatching(([IntegerArrayPropertyObject objectsWhere:@\"array.@sum.intCol == 1.23\"]),\n                                      @\"@sum.*type int cannot be compared\");\n}\n\n- (void)testAggregateSetCollectionOperators {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n\n    IntegerSetPropertyObject *set = [IntegerSetPropertyObject createInRealm:realm withValue:@[ @1111, @[] ]];\n    [set.set addObject:[IntObject createInRealm:realm withValue:@[ @1234 ]]];\n    [set.set addObject:[IntObject createInRealm:realm withValue:@[ @2 ]]];\n    [set.set addObject:[IntObject createInRealm:realm withValue:@[ @-12345 ]]];\n\n    set = [IntegerSetPropertyObject createInRealm:realm withValue:@[ @2222, @[] ]];\n    [set.set addObject:[IntObject createInRealm:realm withValue:@[ @100 ]]];\n\n    [IntegerSetPropertyObject createInRealm:realm withValue:@[ @3333, @[] ]];\n\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"set.@min.intCol == -12345\");\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"set.@min.intCol == 100\");\n    RLMAssertCount(IntegerSetPropertyObject, 2U, @\"set.@min.intCol < 1000\");\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"set.@min.intCol > -1000\");\n\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"set.@max.intCol == 1234\");\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"set.@max.intCol == 100\");\n    RLMAssertCount(IntegerSetPropertyObject, 2U, @\"set.@max.intCol > -1000\");\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"set.@max.intCol > 1000\");\n\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"set.@sum.intCol == 100\");\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"set.@sum.intCol == -11109\");\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"set.@sum.intCol == 0\");\n    RLMAssertCount(IntegerSetPropertyObject, 2U, @\"set.@sum.intCol > -50\");\n    RLMAssertCount(IntegerSetPropertyObject, 2U, @\"set.@sum.intCol < 50\");\n\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"set.@avg.intCol == 100\");\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"set.@avg.intCol == -3703\");\n    RLMAssertCount(IntegerSetPropertyObject, 0U, @\"set.@avg.intCol == 0\");\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"set.@avg.intCol < -50\");\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"set.@avg.intCol > 50\");\n\n    RLMAssertCount(IntegerSetPropertyObject, 2U, @\"set.@min.intCol < number\");\n    RLMAssertCount(IntegerSetPropertyObject, 2U, @\"number > set.@min.intCol\");\n\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"set.@max.intCol < number\");\n    RLMAssertCount(IntegerSetPropertyObject, 1U, @\"number > set.@max.intCol\");\n\n    RLMAssertCount(IntegerSetPropertyObject, 2U, @\"set.@avg.intCol < number\");\n    RLMAssertCount(IntegerSetPropertyObject, 2U, @\"number > set.@avg.intCol\");\n\n    // We do not yet handle collection operations on both sides of the comparison.\n    RLMAssertThrowsWithReason(([IntegerSetPropertyObject objectsWhere:@\"set.@min.intCol == set.@min.intCol\"]),\n                              @\"aggregate operations cannot be compared with other aggregate operations\");\n\n    RLMAssertThrowsWithReason(([IntegerSetPropertyObject objectsWhere:@\"set.@min.intCol.foo.bar == 1.23\"]),\n                              @\"Invalid keypath 'set.@min.intCol.foo.bar': Property 'IntObject.intCol' is not a link or collection and can only appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([IntegerSetPropertyObject objectsWhere:@\"set.@max.intCol.foo.bar == 1.23\"]),\n                              @\"Invalid keypath 'set.@max.intCol.foo.bar': Property 'IntObject.intCol' is not a link or collection and can only appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([IntegerSetPropertyObject objectsWhere:@\"set.@sum.intCol.foo.bar == 1.23\"]),\n                              @\"Invalid keypath 'set.@sum.intCol.foo.bar': Property 'IntObject.intCol' is not a link or collection and can only appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([IntegerSetPropertyObject objectsWhere:@\"set.@avg.intCol.foo.bar == 1.23\"]),\n                              @\"Invalid keypath 'set.@avg.intCol.foo.bar': Property 'IntObject.intCol' is not a link or collection and can only appear at the end of a keypath.\");\n\n    // Average is omitted from this test as its result is always a double.\n    RLMAssertThrowsWithReasonMatching(([IntegerSetPropertyObject objectsWhere:@\"set.@min.intCol == 1.23\"]),\n                                      @\"@min.*type int cannot be compared\");\n    RLMAssertThrowsWithReasonMatching(([IntegerSetPropertyObject objectsWhere:@\"set.@max.intCol == 1.23\"]),\n                                      @\"@max.*type int cannot be compared\");\n    RLMAssertThrowsWithReasonMatching(([IntegerSetPropertyObject objectsWhere:@\"set.@sum.intCol == 1.23\"]),\n                                      @\"@sum.*type int cannot be compared\");\n}\n\n- (void)testAggregateDictionaryCollectionOperators {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n\n    IntegerDictionaryPropertyObject *idpo = [IntegerDictionaryPropertyObject createInRealm:realm withValue:@[ @1111, @[] ]];\n    idpo.dictionary[@\"0\"] = [IntObject createInRealm:realm withValue:@[ @1234 ]];\n    idpo.dictionary[@\"1\"] = [IntObject createInRealm:realm withValue:@[ @2 ]];\n    idpo.dictionary[@\"2\"] = [IntObject createInRealm:realm withValue:@[ @-12345 ]];\n\n    idpo = [IntegerDictionaryPropertyObject createInRealm:realm withValue:@[ @2222, @[] ]];\n    idpo.dictionary[@\"3\"] = [IntObject createInRealm:realm withValue:@[ @100 ]];\n\n    [IntegerDictionaryPropertyObject createInRealm:realm withValue:@[ @3333, @[] ]];\n\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"dictionary.@min.intCol == -12345\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"dictionary.@min.intCol == 100\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 2U, @\"dictionary.@min.intCol < 1000\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"dictionary.@min.intCol > -1000\");\n\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"dictionary.@max.intCol == 1234\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"dictionary.@max.intCol == 100\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 2U, @\"dictionary.@max.intCol > -1000\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"dictionary.@max.intCol > 1000\");\n\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"dictionary.@sum.intCol == 100\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"dictionary.@sum.intCol == -11109\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"dictionary.@sum.intCol == 0\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 2U, @\"dictionary.@sum.intCol > -50\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 2U, @\"dictionary.@sum.intCol < 50\");\n\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"dictionary.@avg.intCol == 100\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"dictionary.@avg.intCol == -3703\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 0U, @\"dictionary.@avg.intCol == 0\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"dictionary.@avg.intCol < -50\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"dictionary.@avg.intCol > 50\");\n\n    RLMAssertCount(IntegerDictionaryPropertyObject, 2U, @\"dictionary.@min.intCol < number\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 2U, @\"number > dictionary.@min.intCol\");\n\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"dictionary.@max.intCol < number\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 1U, @\"number > dictionary.@max.intCol\");\n\n    RLMAssertCount(IntegerDictionaryPropertyObject, 2U, @\"dictionary.@avg.intCol < number\");\n    RLMAssertCount(IntegerDictionaryPropertyObject, 2U, @\"number > dictionary.@avg.intCol\");\n\n    // We do not yet handle collection operations on both sides of the comparison.\n    RLMAssertThrowsWithReason(([IntegerDictionaryPropertyObject objectsWhere:@\"dictionary.@min.intCol == dictionary.@min.intCol\"]),\n                              @\"aggregate operations cannot be compared with other aggregate operations\");\n\n    RLMAssertThrowsWithReason(([IntegerDictionaryPropertyObject objectsWhere:@\"dictionary.@min.intCol.foo.bar == 1.23\"]),\n                              @\"Invalid keypath 'dictionary.@min.intCol.foo.bar': Property 'IntObject.intCol' is not a link or collection and can only appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([IntegerDictionaryPropertyObject objectsWhere:@\"dictionary.@max.intCol.foo.bar == 1.23\"]),\n                              @\"Invalid keypath 'dictionary.@max.intCol.foo.bar': Property 'IntObject.intCol' is not a link or collection and can only appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([IntegerDictionaryPropertyObject objectsWhere:@\"dictionary.@sum.intCol.foo.bar == 1.23\"]),\n                              @\"Invalid keypath 'dictionary.@sum.intCol.foo.bar': Property 'IntObject.intCol' is not a link or collection and can only appear at the end of a keypath.\");\n    RLMAssertThrowsWithReason(([IntegerDictionaryPropertyObject objectsWhere:@\"dictionary.@avg.intCol.foo.bar == 1.23\"]),\n                              @\"Invalid keypath 'dictionary.@avg.intCol.foo.bar': Property 'IntObject.intCol' is not a link or collection and can only appear at the end of a keypath.\");\n\n    // Average is omitted from this test as its result is always a double.\n    RLMAssertThrowsWithReasonMatching(([IntegerDictionaryPropertyObject objectsWhere:@\"dictionary.@min.intCol == 1.23\"]), @\"@min.*type int cannot be compared\");\n    RLMAssertThrowsWithReasonMatching(([IntegerDictionaryPropertyObject objectsWhere:@\"dictionary.@max.intCol == 1.23\"]), @\"@max.*type int cannot be compared\");\n    RLMAssertThrowsWithReasonMatching(([IntegerDictionaryPropertyObject objectsWhere:@\"dictionary.@sum.intCol == 1.23\"]), @\"@sum.*type int cannot be compared\");\n}\n\n- (void)testDictionaryQueryAllKeys {\n    void (^test)(NSString *, id) = ^(NSString *property, id value) {\n        RLMRealm *realm = [self realm];\n        [realm beginWriteTransaction];\n        [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"key1\": value}}];\n        [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"key2\": value}}];\n        [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"key3\": value}}];\n        [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"key1\": value}}];\n        [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"KEY3\": value}}];\n        [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"kêÿ2\": value}}];\n        [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"KEY2\": value}}];\n        [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"lock1\": value}}];\n        [realm commitWriteTransaction];\n\n        RLMAssertCount(AllDictionariesObject, 0U, @\"ANY %K.@allKeys = 'key'\", property);\n        RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allKeys = 'key1'\", property);\n        RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allKeys = 'key3'\", property);\n        RLMAssertCount(AllDictionariesObject, 7U, @\"ANY %K.@allKeys != 'key3'\", property);\n        RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allKeys =[c] 'key3'\", property);\n        RLMAssertCount(AllDictionariesObject, 6U, @\"ANY %K.@allKeys !=[c] 'key3'\", property);\n        RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allKeys =[cd] 'key3'\", property);\n        RLMAssertCount(AllDictionariesObject, 6U, @\"ANY %K.@allKeys !=[cd] 'key3'\", property);\n        RLMAssertCount(AllDictionariesObject, 2U, @\"NOT ANY %K.@allKeys !=[cd] 'key3'\", property);\n        // BEGINSWITH\n        RLMAssertCount(AllDictionariesObject, 4U, @\"ANY %K.@allKeys BEGINSWITH 'ke'\", property);\n        RLMAssertCount(AllDictionariesObject, 4U, @\"NOT ANY %K.@allKeys BEGINSWITH 'ke'\", property);\n        RLMAssertCount(AllDictionariesObject, 6U, @\"ANY %K.@allKeys BEGINSWITH[c] 'ke'\", property);\n        RLMAssertCount(AllDictionariesObject, 7U, @\"ANY %K.@allKeys BEGINSWITH[cd] 'ke'\", property);\n        RLMAssertCount(AllDictionariesObject, 0U, @\"ANY %K.@allKeys BEGINSWITH NULL\", property);\n        // CONTAINS\n        RLMAssertCount(AllDictionariesObject, 4U, @\"ANY %K.@allKeys CONTAINS 'ey'\", property);\n        RLMAssertCount(AllDictionariesObject, 6U, @\"ANY %K.@allKeys CONTAINS[c] 'ey'\", property);\n        RLMAssertCount(AllDictionariesObject, 7U, @\"ANY %K.@allKeys CONTAINS[cd] 'ey'\", property);\n        RLMAssertCount(AllDictionariesObject, 0U, @\"ANY %K.@allKeys CONTAINS NULL\", property);\n        // ENDSWITH\n        RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allKeys ENDSWITH 'y2'\", property);\n        RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allKeys ENDSWITH[c] 'y2'\", property);\n        RLMAssertCount(AllDictionariesObject, 3U, @\"ANY %K.@allKeys ENDSWITH[cd] 'y2'\", property);\n        RLMAssertCount(AllDictionariesObject, 0U, @\"ANY %K.@allKeys ENDSWITH NULL\", property);\n        // LIKE\n        RLMAssertCount(AllDictionariesObject, 4U, @\"ANY %K.@allKeys LIKE 'key*'\", property);\n        RLMAssertCount(AllDictionariesObject, 6U, @\"ANY %K.@allKeys LIKE[c] 'key*'\", property);\n        RLMAssertCount(AllDictionariesObject, 0U, @\"ANY %K.@allKeys LIKE NULL\", property);\n        RLMAssertCount(AllDictionariesObject, 4U, @\"NOT ANY %K.@allKeys LIKE 'key*'\", property);\n        RLMAssertCount(AllDictionariesObject, 2U, @\"NOT ANY %K.@allKeys LIKE[c] 'key*'\", property);\n        RLMAssertCount(AllDictionariesObject, 8U, @\"NOT ANY %K.@allKeys LIKE NULL\", property);\n        RLMAssertThrowsWithReason(([AllDictionariesObject objectsInRealm:realm where:@\"ANY %K.@allKeys LIKE[cd] 'key*'\", property]),\n                                          @\"Operator 'LIKE' not supported with diacritic-insensitive modifier.\");\n\n        [realm beginWriteTransaction];\n        [realm deleteAllObjects];\n        [realm commitWriteTransaction];\n    };\n    test(@\"intDict\", @123);\n    test(@\"floatDict\", @789.123);\n    test(@\"doubleDict\", @789.123);\n    test(@\"boolDict\", @YES);\n    test(@\"stringDict\", @\"Hello\");\n    test(@\"dataDict\", [@\"123\" dataUsingEncoding:NSUTF8StringEncoding]);\n    test(@\"dateDict\", [NSDate dateWithTimeIntervalSince1970:100]);\n    test(@\"decimalDict\", [RLMDecimal128 decimalWithNumber:@123.456]);\n    test(@\"objectIdDict\", [RLMObjectId objectId]);\n    test(@\"uuidDict\", [[NSUUID alloc] initWithUUIDString:@\"00000000-0000-0000-0000-000000000000\"]);\n    test(@\"stringObjDict\", [[StringObject alloc] initWithValue:@[@\"hi\"]]);\n}\n\n- (void)testDictionaryQueryAllValues_RLMObject {\n    NSString *property = @\"stringObjDict\";\n    NSArray *values = @[[[StringObject alloc] initWithValue:@[@\"hello\"]],\n                        [[StringObject alloc] initWithValue:@[@\"Héllo\"]],\n                        [[StringObject alloc] initWithValue:@[@\"HELLO\"]]];\n\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n    [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey\": values[0]}}];\n    [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey2\": values[1]}}];\n    [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey3\": values[2]}}];\n    [realm commitWriteTransaction];\n\n    StringObject *obj = [[StringObject objectsInRealm:realm where:@\"stringCol = %@\", [values[0] stringCol]] firstObject];\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues = %@\", property, obj);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues != %@\", property, obj);\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues IN %@\", property, @[obj]);\n    RLMAssertCount(AllDictionariesObject, 0U, @\"ANY %K.@allValues IN %@\", property, @[]);\n\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.stringCol = %@\", property, obj.stringCol);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.stringCol != %@\", property, obj.stringCol);\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.stringCol BEGINSWITH %@\", property, @\"h\");\n    RLMAssertCount(AllDictionariesObject, 3U, @\"ANY %K.stringCol BEGINSWITH[c] %@\", property, @\"h\");\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.stringCol BEGINSWITH[c] %@\", property, @\"he\");\n    RLMAssertCount(AllDictionariesObject, 3U, @\"ANY %K.stringCol BEGINSWITH[cd] %@\", property, @\"he\");\n\n    RLMAssertThrowsWithReason(([AllDictionariesObject objectsInRealm:realm where:@\"ANY %K.@allValues BETWEEN %@\", property, @[obj, obj]]),\n                              @\"Operator 'BETWEEN' not supported for type 'object'\");\n    RLMAssertThrowsWithReason(([AllDictionariesObject objectsInRealm:realm where:@\"ANY %K.@allValues BEGINSWITH %@\", property, obj]),\n                              @\"Operator 'BEGINSWITH' not supported for type 'object'\");\n    RLMAssertThrowsWithReason(([AllDictionariesObject objectsInRealm:realm where:@\"ANY %K.@allValues CONTAINS %@\", property, obj]),\n                              @\"Operator 'CONTAINS' not supported for type 'object'\");\n    RLMAssertThrowsWithReason(([AllDictionariesObject objectsInRealm:realm where:@\"ANY %K.@allValues ENDSWITH %@\", property, obj]),\n                              @\"Operator 'ENDSWITH' not supported for type 'object'\");\n    RLMAssertThrowsWithReason(([AllDictionariesObject objectsInRealm:realm where:@\"ANY %K.@allValues LIKE %@\", property, obj]),\n                              @\"Operator 'LIKE' not supported for type 'object'\");\n}\n\n- (void)testDictionaryQueryAllValues_NSString {\n    NSString *property = @\"stringDict\";\n    NSArray *values = @[@\"hello\", @\"Héllo\", @\"HELLO\"];\n\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n    [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey\": values[0]}}];\n    [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey2\": values[1]}}];\n    [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey3\": values[2]}}];\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues = %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues != %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues =[c] %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues !=[c] %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 3U, @\"ANY %K.@allValues =[cd] %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 0U, @\"ANY %K.@allValues !=[cd] %@\", property, values[0]);\n    // BEGINSWITH\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues BEGINSWITH 'he'\", property);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"NOT ANY %K.@allValues BEGINSWITH 'he'\", property);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues BEGINSWITH[c] 'he'\", property);\n    RLMAssertCount(AllDictionariesObject, 3U, @\"ANY %K.@allValues BEGINSWITH[cd] 'he'\", property);\n    RLMAssertCount(AllDictionariesObject, 0U, @\"ANY %K.@allValues BEGINSWITH NULL\", property);\n    // CONTAINS\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues CONTAINS 'el'\", property);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues CONTAINS[c] 'el'\", property);\n    RLMAssertCount(AllDictionariesObject, 3U, @\"ANY %K.@allValues CONTAINS[cd] 'el'\", property);\n    RLMAssertCount(AllDictionariesObject, 0U, @\"ANY %K.@allValues CONTAINS NULL\", property);\n    // ENDSWITH\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues ENDSWITH 'lo'\", property);\n    RLMAssertCount(AllDictionariesObject, 3U, @\"ANY %K.@allValues ENDSWITH[c] 'lo'\", property);\n    RLMAssertCount(AllDictionariesObject, 3U, @\"ANY %K.@allValues ENDSWITH[cd] 'lo'\", property);\n    RLMAssertCount(AllDictionariesObject, 0U, @\"ANY %K.@allValues ENDSWITH NULL\", property);\n    // LIKE\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues LIKE 'hel*'\", property);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues LIKE[c] 'hel*'\", property);\n    RLMAssertCount(AllDictionariesObject, 0U, @\"ANY %K.@allValues LIKE NULL\", property);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"NOT ANY %K.@allValues LIKE 'hel*'\", property);\n    RLMAssertCount(AllDictionariesObject, 1U, @\"NOT ANY %K.@allValues LIKE[c] 'hel*'\", property);\n    RLMAssertCount(AllDictionariesObject, 3U, @\"NOT ANY %K.@allValues LIKE NULL\", property);\n    RLMAssertThrowsWithReason(([AllDictionariesObject objectsInRealm:realm where:@\"ANY %K.@allValues LIKE[cd] 'hel*'\", property]),\n                              @\"Operator 'LIKE' not supported with diacritic-insensitive modifier.\");\n}\n\n- (void)testDictionaryQueryAllValues_ObjectId {\n    NSString *property = @\"objectIdDict\";\n    NSArray *values = @[[[RLMObjectId alloc] initWithString:@\"60425fff91d7a195d5ddac1b\" error:nil],\n                        [[RLMObjectId alloc] initWithString:@\"60425fff91d7a195d5ddac1a\" error:nil],\n                        [[RLMObjectId alloc] initWithString:@\"60425fff91d7a195d5ddac1c\" error:nil]];\n\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n    [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey\": values[0]}}];\n    [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey2\": values[1]}}];\n    [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey3\": values[2]}}];\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues = %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues != %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues =[c] %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues =[cd] %@\", property, values[0]);\n\n    // Unsupported\n    RLMAssertThrowsWithReason(([AllDictionariesObject objectsInRealm:realm where:@\"ANY %K.@allValues > %@\", property, values[0]]), @\"Operator '>' not supported for type 'object id'\");\n    RLMAssertThrowsWithReason(([AllDictionariesObject objectsInRealm:realm where:@\"ANY %K.@allValues < %@\", property, values[0]]), @\"Operator '<' not supported for type 'object id'\");\n    RLMAssertThrowsWithReason(([AllDictionariesObject objectsInRealm:realm where:@\"ANY %K.@allValues LIKE %@\", property, values[0]]), @\"Operator 'LIKE' not supported for type 'object id'\");\n    RLMAssertThrowsWithReason(([AllDictionariesObject objectsInRealm:realm where:@\"ANY %K.@allValues BEGINSWITH %@\", property, values[0]]), @\"Operator 'BEGINSWITH' not supported for type 'object id'\");\n    RLMAssertThrowsWithReason(([AllDictionariesObject objectsInRealm:realm where:@\"ANY %K.@allValues CONTAINS %@\", property, values[0]]), @\"Operator 'CONTAINS' not supported for type 'object id'\");\n    RLMAssertThrowsWithReason(([AllDictionariesObject objectsInRealm:realm where:@\"ANY %K.@allValues ENDSWITH %@\", property, values[0]]), @\"Operator 'ENDSWITH' not supported for type 'object id'\");\n}\n\n- (void)testDictionaryQueryAllValues_UUID {\n    NSString *property = @\"uuidDict\";\n    NSArray *values = @[[[NSUUID alloc] initWithUUIDString:@\"137DECC8-B300-4954-A233-F89909F4FD88\"],\n                        [[NSUUID alloc] initWithUUIDString:@\"137DECC8-B300-4954-A233-F89909F4FD87\"],\n                        [[NSUUID alloc] initWithUUIDString:@\"137DECC8-B300-4954-A233-F89909F4FD89\"]];\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n    [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey\": values[0]}}];\n    [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey2\": values[1]}}];\n    [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey3\": values[2]}}];\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues = %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues != %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues =[c] %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues !=[c] %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues =[cd] %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues !=[cd] %@\", property, values[0]);\n\n    // Unsupported\n    RLMAssertThrowsWithReason(([AllDictionariesObject objectsInRealm:realm where:@\"ANY %K.@allValues > %@\", property, values[0]]), @\"Operator '>' not supported for type 'uuid'\");\n    RLMAssertThrowsWithReason(([AllDictionariesObject objectsInRealm:realm where:@\"ANY %K.@allValues < %@\", property, values[0]]), @\"Operator '<' not supported for type 'uuid'\");\n    RLMAssertThrowsWithReason(([AllDictionariesObject objectsInRealm:realm where:@\"ANY %K.@allValues LIKE %@\", property, values[0]]), @\"Operator 'LIKE' not supported for type 'uuid'\");\n    RLMAssertThrowsWithReason(([AllDictionariesObject objectsInRealm:realm where:@\"ANY %K.@allValues BEGINSWITH %@\", property, values[0]]), @\"Operator 'BEGINSWITH' not supported for type 'uuid'\");\n    RLMAssertThrowsWithReason(([AllDictionariesObject objectsInRealm:realm where:@\"ANY %K.@allValues CONTAINS %@\", property, values[0]]), @\"Operator 'CONTAINS' not supported for type 'uuid'\");\n    RLMAssertThrowsWithReason(([AllDictionariesObject objectsInRealm:realm where:@\"ANY %K.@allValues ENDSWITH %@\", property, values[0]]), @\"Operator 'ENDSWITH' not supported for type 'uuid'\");\n}\n\n- (void)testDictionaryQueryAllValues_Data {\n    NSString *property = @\"dataDict\";\n    NSArray *values = @[[NSData dataWithBytes:\"hey\" length:3],\n                        [NSData dataWithBytes:\"hi\" length:2],\n                        [NSData dataWithBytes:\"hello\" length:5]];\n\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n    [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey\": values[0]}}];\n    [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey2\": values[1]}}];\n    [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey3\": values[2]}}];\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues = %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues != %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues =[c] %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues !=[c] %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues =[cd] %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues !=[cd] %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues > %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues >= %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues < %@\", property, values[0]);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues <= %@\", property, values[0]);\n\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues LIKE %@\", property,\n                   [NSData dataWithBytes:\"hello\" length:5]);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues LIKE %@\", property,\n                   [NSData dataWithBytes:\"he*\" length:3]);\n    RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues BEGINSWITH %@\", property,\n                   [NSData dataWithBytes:\"he\" length:2]);\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues CONTAINS %@\", property,\n                   [NSData dataWithBytes:\"ell\" length:3]);\n    RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues ENDSWITH %@\", property,\n                   [NSData dataWithBytes:\"lo\" length:2]);\n\n}\n\n- (void)testDictionaryQueryAllValues {\n    void (^test)(NSString *, NSArray *) = ^(NSString *property, NSArray *values) {\n        RLMRealm *realm = [self realm];\n        [realm beginWriteTransaction];\n        [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey\": values[0]}}];\n        [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey2\": values[1]}}];\n        [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey3\": values[2]}}];\n        [realm commitWriteTransaction];\n\n        if ([property isEqualToString:@\"boolDict\"]) {\n            RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues = %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues != %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues =[c] %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues !=[c] %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues =[cd] %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues !=[cd] %@\", property, values[0]);\n        } else {\n            RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues = %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues != %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues =[c] %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues !=[c] %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues =[cd] %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 2U, @\"ANY %K.@allValues !=[cd] %@\", property, values[0]);\n\n            RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues > %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 2U, @\"NOT ANY %K.@allValues > %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues >[c] %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues >[cd] %@\", property, values[0]);\n\n            RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues < %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 2U, @\"NOT ANY %K.@allValues < %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues <[c] %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 1U, @\"ANY %K.@allValues <[cd] %@\", property, values[0]);\n        }\n        [realm beginWriteTransaction];\n        [realm deleteAllObjects];\n        [realm commitWriteTransaction];\n    };\n    test(@\"intDict\", @[@456, @123, @789]);\n    test(@\"doubleDict\", @[@456.123, @123.123, @789.123]);\n    test(@\"boolDict\", @[@NO, @NO, @YES]);\n    test(@\"decimalDict\", @[[RLMDecimal128 decimalWithNumber:@456.123], [RLMDecimal128 decimalWithNumber:@123.123], [RLMDecimal128 decimalWithNumber:@789.123]]);\n    test(@\"dateDict\", @[[NSDate dateWithTimeIntervalSince1970:4000], [NSDate dateWithTimeIntervalSince1970:2000], [NSDate dateWithTimeIntervalSince1970:8000]]);\n}\n\n- (void)testDictionaryQueryKeySubscript {\n    void (^test)(NSString *, NSArray *, id (^)(NSString *)) = ^(NSString *property, NSArray *values, id (^string)(NSString *)) {\n        RLMRealm *realm = [self realm];\n        [realm beginWriteTransaction];\n        [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey\": values[0]}}];\n        [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey2\": values[1]}}];\n        [AllDictionariesObject createInRealm:realm withValue:@{property: @{@\"aKey3\": values[2]}}];\n        [realm commitWriteTransaction];\n\n        RLMAssertCount(AllDictionariesObject, 1U, @\"%K['aKey'] = %@\", property, values[0]);\n        RLMAssertCount(AllDictionariesObject, 2U, @\"%K['aKey'] != %@\", property, values[0]);\n        RLMAssertCount(AllDictionariesObject, 1U, @\"%K['aKey'] =[c] %@\", property, values[0]);\n        RLMAssertCount(AllDictionariesObject, 2U, @\"%K['aKey'] !=[c] %@\", property, values[0]);\n        RLMAssertCount(AllDictionariesObject, 1U, @\"%K['aKey'] =[cd] %@\", property, values[0]);\n\n        if (!string) {\n            RLMAssertCount(AllDictionariesObject, 0U, @\"%K['aKey'] > %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 3U, @\"NOT %K['aKey'] > %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 0U, @\"%K['aKey'] >[c] %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 0U, @\"%K['aKey'] >[cd] %@\", property, values[0]);\n\n            RLMAssertCount(AllDictionariesObject, 0U, @\"%K['aKey'] < %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 3U, @\"NOT %K['aKey'] < %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 0U, @\"%K['aKey'] <[c] %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 0U, @\"%K['aKey'] <[cd] %@\", property, values[0]);\n        } else {\n            RLMAssertCount(AllDictionariesObject, 1U, @\"%K['aKey'] = %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 2U, @\"%K['aKey'] != %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 1U, @\"%K['aKey'] =[c] %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 2U, @\"%K['aKey'] !=[c] %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 1U, @\"%K['aKey'] =[cd] %@\", property, values[0]);\n            RLMAssertCount(AllDictionariesObject, 2U, @\"%K['aKey'] !=[cd] %@\", property, values[0]);\n            // BEGINSWITH\n            RLMAssertCount(AllDictionariesObject, 1U, @\"%K['aKey'] BEGINSWITH %@\", property, string(@\"he\"));\n            RLMAssertCount(AllDictionariesObject, 2U, @\"NOT %K['aKey'] BEGINSWITH %@\", property, string(@\"he\"));\n            RLMAssertCount(AllDictionariesObject, 1U, @\"%K['aKey'] BEGINSWITH[c] %@\", property, string(@\"he\"));\n            RLMAssertCount(AllDictionariesObject, 1U, @\"%K['aKey'] BEGINSWITH[cd] %@\", property, string(@\"he\"));\n            RLMAssertCount(AllDictionariesObject, 0U, @\"%K['aKey'] BEGINSWITH NULL\", property);\n            // CONTAINS\n            RLMAssertCount(AllDictionariesObject, 1U, @\"%K['aKey'] CONTAINS %@\", property, string(@\"el\"));\n            RLMAssertCount(AllDictionariesObject, 1U, @\"%K['aKey'] CONTAINS[c] %@\", property, string(@\"el\"));\n            RLMAssertCount(AllDictionariesObject, 1U, @\"%K['aKey'] CONTAINS[cd] %@\", property, string(@\"el\"));\n            RLMAssertCount(AllDictionariesObject, 0U, @\"%K['aKey'] CONTAINS NULL\", property);\n            // ENDSWITH\n            RLMAssertCount(AllDictionariesObject, 1U, @\"%K['aKey'] ENDSWITH %@\", property, string(@\"lo\"));\n            RLMAssertCount(AllDictionariesObject, 1U, @\"%K['aKey'] ENDSWITH[c] %@\", property, string(@\"lo\"));\n            RLMAssertCount(AllDictionariesObject, 1U, @\"%K['aKey'] ENDSWITH[cd] %@\", property, string(@\"lo\"));\n            RLMAssertCount(AllDictionariesObject, 0U, @\"%K['aKey'] ENDSWITH NULL\", property);\n            // LIKE\n            RLMAssertCount(AllDictionariesObject, 1U, @\"%K['aKey'] LIKE %@\", property, string(@\"hel*\"));\n            RLMAssertCount(AllDictionariesObject, 1U, @\"%K['aKey'] LIKE[c] %@\", property, string(@\"hel*\"));\n            RLMAssertCount(AllDictionariesObject, 2U, @\"%K['aKey'] LIKE NULL\", property);\n            RLMAssertCount(AllDictionariesObject, 2U, @\"NOT %K['aKey'] LIKE %@\", property, string(@\"hel*\"));\n            RLMAssertCount(AllDictionariesObject, 2U, @\"NOT %K['aKey'] LIKE[c] %@\", property, string(@\"hel*\"));\n            RLMAssertCount(AllDictionariesObject, 1U, @\"NOT %K['aKey'] LIKE NULL\", property);\n            RLMAssertThrowsWithReasonMatching(([AllDictionariesObject objectsInRealm:realm where:@\"%K['aKey'] LIKE[cd] %@\", property, string(@\"hel*\")]), @\"not supported\");\n        }\n\n        [realm beginWriteTransaction];\n        [realm deleteAllObjects];\n        [realm commitWriteTransaction];\n    };\n    test(@\"intDict\", @[@456, @123, @789], nil);\n    test(@\"doubleDict\", @[@456.123, @123.123, @789.123], nil);\n    test(@\"boolDict\", @[@NO, @NO, @YES], nil);\n    test(@\"decimalDict\", @[[RLMDecimal128 decimalWithNumber:@456.123],\n                           [RLMDecimal128 decimalWithNumber:@123.123],\n                           [RLMDecimal128 decimalWithNumber:@789.123]], nil);\n    test(@\"dateDict\", @[[NSDate dateWithTimeIntervalSince1970:4000],\n                        [NSDate dateWithTimeIntervalSince1970:2000],\n                        [NSDate dateWithTimeIntervalSince1970:8000]], nil);\n    test(@\"dataDict\", @[[NSData dataWithBytes:\"hello\" length:5],\n                        [NSData dataWithBytes:\"Héllo\" length:5],\n                        [NSData dataWithBytes:\"HELLO\" length:5]], ^(NSString *str) {\n        return [str dataUsingEncoding:NSUTF8StringEncoding];\n    });\n    test(@\"objectIdDict\", @[[[RLMObjectId alloc] initWithString:@\"60425fff91d7a195d5ddac1b\" error:nil],\n                            [[RLMObjectId alloc] initWithString:@\"60425fff91d7a195d5ddac1a\" error:nil],\n                            [[RLMObjectId alloc] initWithString:@\"60425fff91d7a195d5ddac1c\" error:nil]], nil);\n    test(@\"stringDict\", @[@\"hello\", @\"Héllo\", @\"HELLO\"], ^(NSString *str) { return str; });\n}\n\n- (void)testDictionaryQueryKeySubscriptWithObjectCol {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n    [DictionaryParentObject createInRealm:realm withValue:@{@\"objectCol\": @{@\"stringDict\": @{@\"aKey\": @\"blah\"}}}];\n    [realm commitWriteTransaction];\n    // This test checks that we can use a link col keypath to the dictionary and subscript it.\n    RLMAssertCount(DictionaryParentObject, 1U, @\"%K['aKey'] = %@\", @\"objectCol.stringDict\", @\"blah\");\n}\n\n- (void)testDictionarySubscriptThrowsException {\n    RLMRealm *realm = [self realm];\n    RLMAssertThrowsWithReason(([realm objects:@\"ArrayPropertyObject\" where:@\"array['invalid'] = NULL\"]),\n                              @\"Invalid keypath 'array[\\\"invalid\\\"]': only dictionaries and realm `Any` support subscript predicates.\");\n    RLMAssertThrowsWithReason(([realm objects:@\"SetPropertyObject\" where:@\"set['invalid'] = NULL\"]),\n                              @\"Invalid keypath 'set[\\\"invalid\\\"]': only dictionaries and realm `Any` support subscript predicates.\");\n    RLMAssertThrowsWithReason(([realm objects:@\"OwnerObject\" where:@\"dog['dogName'] = NULL\"]),\n                              @\"Aggregate operations can only be used on key paths that include an collection property\");\n    RLMAssertThrows(([realm objects:@\"DictionaryPropertyObject\" where:@\"stringDictionary[%@] = NULL\", [RLMObjectId objectId]]),\n                    @\"Invalid subscript type 'anyCol[[a-z0-9]+]': Only `Strings` or index are allowed subscripts\");\n    RLMAssertThrowsWithReason(([realm objects:@\"DictionaryPropertyObject\" where:@\"stringDictionary['aKey']['bKey'] = NULL\"]),\n                              @\"Invalid subscript size 'stringDictionary[\\\"aKey\\\"][\\\"bKey\\\"]': nested dictionaries queries are only allowed in mixed properties.\");\n    RLMAssertThrowsWithReason(([realm objects:@\"DictionaryPropertyObject\" where:@\"stringDictionary[0] = NULL\"]),\n                              @\"Invalid subscript type 'stringDictionary[0]'; only string keys are allowed as subscripts in dictionary queries.\");\n}\n\n- (void)testMixedSubscriptsThrowsException {\n    RLMRealm *realm = [self realm];\n    RLMAssertThrows(([realm objects:@\"AllTypesObject\" where:@\"anyCol[%@] = NULL\", [RLMObjectId objectId]]),\n                    @\"Invalid subscript type 'anyCol[[a-z0-9]+]': Only `Strings` or index are allowed subscripts\");\n}\n\n- (void)testCollectionsQueryAllValuesAllKeys {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n    StringObject *so1 = [StringObject createInRealm:realm withValue:@[@\"value1\"]];\n    RLMAssertThrowsWithReason(([realm objects:@\"ArrayPropertyObject\" where:@\"ANY array.@allValues = %@\", so1]),\n                              @\"Invalid keypath 'array.@allValues': @allValues must follow a dictionary property.\");\n    RLMAssertThrowsWithReason(([realm objects:@\"ArrayPropertyObject\" where:@\"ANY array.@allKeys = %@\", so1]),\n                              @\"Invalid keypath 'array.@allKeys': @allKeys must follow a dictionary property.\");\n    RLMAssertThrowsWithReason(([realm objects:@\"SetPropertyObject\" where:@\"ANY set.@allValues = %@\", so1]),\n                              @\"Invalid keypath 'set.@allValues': @allValues must follow a dictionary property.\");\n    RLMAssertThrowsWithReason(([realm objects:@\"SetPropertyObject\" where:@\"ANY set.@allKeys = %@\", so1]),\n                              @\"Invalid keypath 'set.@allKeys': @allKeys must follow a dictionary property.\");\n    [realm cancelWriteTransaction];\n}\n\n- (void)testDictionaryKeyComparedToColumn {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n    EmployeeObject *eo = [[EmployeeObject alloc] init];\n    [CompanyObject createInRealm:realm withValue:@{@\"name\": @\"a\", @\"employeeDict\": @{@\"a\": eo}}];\n    [CompanyObject createInRealm:realm withValue:@{@\"name\": @\"a\", @\"employeeDict\": @{@\"aa\": eo}}];\n    [CompanyObject createInRealm:realm withValue:@{@\"name\": @\"a\", @\"employeeDict\": @{@\"A\": eo}}];\n    [CompanyObject createInRealm:realm withValue:@{@\"name\": @\"a\", @\"employeeDict\": @{@\"AA\": eo}}];\n    [realm commitWriteTransaction];\n\n    RLMAssertCount(CompanyObject, 1U, @\"ANY employeeDict.@allKeys = name\");\n    RLMAssertCount(CompanyObject, 2U, @\"ANY employeeDict.@allKeys =[c] name\");\n    RLMAssertCount(CompanyObject, 3U, @\"ANY employeeDict.@allKeys != name\");\n    RLMAssertCount(CompanyObject, 2U, @\"ANY employeeDict.@allKeys !=[c] name\");\n    RLMAssertCount(CompanyObject, 2U, @\"ANY employeeDict.@allKeys BEGINSWITH name\");\n    RLMAssertCount(CompanyObject, 4U, @\"ANY employeeDict.@allKeys BEGINSWITH[c] name\");\n    RLMAssertCount(CompanyObject, 2U, @\"ANY employeeDict.@allKeys ENDSWITH name\");\n    RLMAssertCount(CompanyObject, 4U, @\"ANY employeeDict.@allKeys ENDSWITH[c] name\");\n    RLMAssertCount(CompanyObject, 2U, @\"ANY employeeDict.@allKeys CONTAINS name\");\n    RLMAssertCount(CompanyObject, 4U, @\"ANY employeeDict.@allKeys CONTAINS[c] name\");\n\n    RLMAssertThrowsWithReason(([CompanyObject objectsInRealm:realm where:@\"ANY employeeDict.@allKeys = 1\"]),\n                              @\"@allKeys can only be compared with a string value.\");\n    RLMAssertThrowsWithReason(([IntegerDictionaryPropertyObject objectsInRealm:realm where:@\"ANY dictionary.@allKeys = number\"]),\n                              @\"@allKeys can only be compared with a string value.\");\n}\n\n@end\n\n@interface NullQueryTests : QueryTests\n@end\n\n@implementation NullQueryTests\n- (Class)queryObjectClass {\n    return [NullQueryObject class];\n}\n\n- (void)testQueryOnNullableStringColumn {\n    void (^testWithStringClass)(Class) = ^(Class stringObjectClass) {\n        RLMRealm *realm = [self realm];\n        [realm transactionWithBlock:^{\n            [stringObjectClass createInRealm:realm withValue:@[@\"a\"]];\n            [stringObjectClass createInRealm:realm withValue:@[NSNull.null]];\n            [stringObjectClass createInRealm:realm withValue:@[@\"b\"]];\n            [stringObjectClass createInRealm:realm withValue:@[NSNull.null]];\n            [stringObjectClass createInRealm:realm withValue:@[@\"\"]];\n        }];\n\n        RLMResults *allObjects = [stringObjectClass allObjectsInRealm:realm];\n        XCTAssertEqual(5U, allObjects.count);\n\n        RLMResults *nilStrings = [stringObjectClass objectsInRealm:realm where:@\"stringCol = NULL\"];\n        XCTAssertEqual(2U, nilStrings.count);\n        XCTAssertEqualObjects((@[NSNull.null, NSNull.null]), [nilStrings valueForKey:@\"stringCol\"]);\n\n        RLMResults *nilLikeStrings = [stringObjectClass objectsInRealm:realm where:@\"stringCol LIKE NULL\"];\n        XCTAssertEqual(2U, nilLikeStrings.count);\n        XCTAssertEqualObjects((@[NSNull.null, NSNull.null]), [nilLikeStrings valueForKey:@\"stringCol\"]);\n\n        RLMResults *nonNilStrings = [stringObjectClass objectsInRealm:realm where:@\"stringCol != NULL\"];\n        XCTAssertEqual(3U, nonNilStrings.count);\n        XCTAssertEqualObjects((@[@\"a\", @\"b\", @\"\"]), [nonNilStrings valueForKey:@\"stringCol\"]);\n\n        RLMResults *nonNilLikeStrings = [stringObjectClass objectsInRealm:realm where:@\"NOT stringCol LIKE NULL\"];\n        XCTAssertEqual(3U, nonNilLikeStrings.count);\n        XCTAssertEqualObjects((@[@\"a\", @\"b\", @\"\"]), [nonNilLikeStrings valueForKey:@\"stringCol\"]);\n\n        RLMAssertCount(stringObjectClass, 3U, @\"stringCol IN {NULL, 'a'}\");\n\n        RLMAssertCount(stringObjectClass, 1U, @\"stringCol CONTAINS 'a'\");\n        RLMAssertCount(stringObjectClass, 1U, @\"stringCol BEGINSWITH 'a'\");\n        RLMAssertCount(stringObjectClass, 1U, @\"stringCol ENDSWITH 'a'\");\n        RLMAssertCount(stringObjectClass, 1U, @\"stringCol LIKE 'a'\");\n\n        RLMAssertCount(stringObjectClass, 0U, @\"stringCol CONTAINS 'z'\");\n        RLMAssertCount(stringObjectClass, 0U, @\"stringCol LIKE 'z'\");\n\n        RLMAssertCount(stringObjectClass, 1U, @\"stringCol = ''\");\n\n        RLMResults *sorted = [[stringObjectClass allObjectsInRealm:realm] sortedResultsUsingKeyPath:@\"stringCol\" ascending:YES];\n        XCTAssertEqualObjects((@[NSNull.null, NSNull.null, @\"\", @\"a\", @\"b\"]), [sorted valueForKey:@\"stringCol\"]);\n        XCTAssertEqualObjects((@[@\"b\", @\"a\", @\"\", NSNull.null, NSNull.null]), [[sorted sortedResultsUsingKeyPath:@\"stringCol\" ascending:NO] valueForKey:@\"stringCol\"]);\n\n        [realm transactionWithBlock:^{\n            [realm deleteObject:[stringObjectClass allObjectsInRealm:realm].firstObject];\n        }];\n\n        XCTAssertEqual(2U, nilStrings.count);\n        XCTAssertEqual(2U, nonNilStrings.count);\n\n        XCTAssertEqualObjects(@[], [[stringObjectClass objectsInRealm:realm where:@\"stringCol CONTAINS ''\"] valueForKey:@\"stringCol\"]);\n        XCTAssertEqualObjects(@[], [[stringObjectClass objectsInRealm:realm where:@\"stringCol BEGINSWITH ''\"] valueForKey:@\"stringCol\"]);\n        XCTAssertEqualObjects(@[], [[stringObjectClass objectsInRealm:realm where:@\"stringCol ENDSWITH ''\"] valueForKey:@\"stringCol\"]);\n        XCTAssertEqualObjects([nonNilStrings valueForKey:@\"stringCol\"],\n                              [[stringObjectClass objectsInRealm:realm where:@\"stringCol LIKE '*'\"] valueForKey:@\"stringCol\"]);\n        XCTAssertEqualObjects(@[], [[stringObjectClass objectsInRealm:realm where:@\"stringCol CONTAINS[c] ''\"] valueForKey:@\"stringCol\"]);\n        XCTAssertEqualObjects(@[], [[stringObjectClass objectsInRealm:realm where:@\"stringCol BEGINSWITH[c] ''\"] valueForKey:@\"stringCol\"]);\n        XCTAssertEqualObjects(@[], [[stringObjectClass objectsInRealm:realm where:@\"stringCol ENDSWITH[c] ''\"] valueForKey:@\"stringCol\"]);\n        XCTAssertEqualObjects([nonNilStrings valueForKey:@\"stringCol\"],\n                              [[stringObjectClass objectsInRealm:realm where:@\"stringCol LIKE[c] '*'\"] valueForKey:@\"stringCol\"]);\n\n        XCTAssertEqualObjects(@[], [[stringObjectClass objectsInRealm:realm where:@\"stringCol CONTAINS[d] ''\"] valueForKey:@\"stringCol\"]);\n        XCTAssertEqualObjects(@[], [[stringObjectClass objectsInRealm:realm where:@\"stringCol BEGINSWITH[d] ''\"] valueForKey:@\"stringCol\"]);\n        XCTAssertEqualObjects(@[], [[stringObjectClass objectsInRealm:realm where:@\"stringCol ENDSWITH[d] ''\"] valueForKey:@\"stringCol\"]);\n        XCTAssertEqualObjects(@[], [[stringObjectClass objectsInRealm:realm where:@\"stringCol CONTAINS[cd] ''\"] valueForKey:@\"stringCol\"]);\n        XCTAssertEqualObjects(@[], [[stringObjectClass objectsInRealm:realm where:@\"stringCol BEGINSWITH[cd] ''\"] valueForKey:@\"stringCol\"]);\n        XCTAssertEqualObjects(@[], [[stringObjectClass objectsInRealm:realm where:@\"stringCol ENDSWITH[cd] ''\"] valueForKey:@\"stringCol\"]);\n\n        XCTAssertEqualObjects(@[], ([[stringObjectClass objectsInRealm:realm where:@\"stringCol CONTAINS %@\", @\"\\0\"] valueForKey:@\"self\"]));\n        XCTAssertEqualObjects(@[], ([[stringObjectClass objectsInRealm:realm where:@\"stringCol CONTAINS NULL\"] valueForKey:@\"stringCol\"]));\n        XCTAssertEqualObjects(@[], ([[stringObjectClass objectsInRealm:realm where:@\"stringCol CONTAINS[c] NULL\"] valueForKey:@\"stringCol\"]));\n        XCTAssertEqualObjects(@[], ([[stringObjectClass objectsInRealm:realm where:@\"stringCol CONTAINS[d] NULL\"] valueForKey:@\"stringCol\"]));\n        XCTAssertEqualObjects(@[], ([[stringObjectClass objectsInRealm:realm where:@\"stringCol CONTAINS[cd] NULL\"] valueForKey:@\"stringCol\"]));\n    };\n    testWithStringClass([StringObject class]);\n    testWithStringClass([IndexedStringObject class]);\n}\n\n- (void)testQueryingOnLinkToNullableStringColumn {\n    void (^testWithStringClass)(Class, Class) = ^(Class stringLinkClass, Class stringObjectClass) {\n        RLMRealm *realm = [self realm];\n        [realm transactionWithBlock:^{\n            [stringLinkClass createInRealm:realm withValue:@[[stringObjectClass createInRealm:realm withValue:@[@\"a\"]]]];\n            [stringLinkClass createInRealm:realm withValue:@[[stringObjectClass createInRealm:realm withValue:@[NSNull.null]]]];\n            [stringLinkClass createInRealm:realm withValue:@[[stringObjectClass createInRealm:realm withValue:@[@\"b\"]]]];\n            [stringLinkClass createInRealm:realm withValue:@[[stringObjectClass createInRealm:realm withValue:@[NSNull.null]]]];\n            [stringLinkClass createInRealm:realm withValue:@[[stringObjectClass createInRealm:realm withValue:@[@\"\"]]]];\n        }];\n\n        RLMResults *nilStrings = [stringLinkClass objectsInRealm:realm where:@\"objectCol.stringCol = NULL\"];\n        XCTAssertEqual(2U, nilStrings.count);\n        XCTAssertEqualObjects((@[NSNull.null, NSNull.null]), [nilStrings valueForKeyPath:@\"objectCol.stringCol\"]);\n\n        RLMResults *nilLikeStrings = [stringLinkClass objectsInRealm:realm where:@\"objectCol.stringCol LIKE NULL\"];\n        XCTAssertEqual(2U, nilLikeStrings.count);\n        XCTAssertEqualObjects((@[NSNull.null, NSNull.null]), [nilLikeStrings valueForKeyPath:@\"objectCol.stringCol\"]);\n\n        RLMResults *nonNilStrings = [stringLinkClass objectsInRealm:realm where:@\"objectCol.stringCol != NULL\"];\n        XCTAssertEqual(3U, nonNilStrings.count);\n        XCTAssertEqualObjects((@[@\"a\", @\"b\", @\"\"]), [nonNilStrings valueForKeyPath:@\"objectCol.stringCol\"]);\n\n        RLMResults *nonNilLikeStrings = [stringLinkClass objectsInRealm:realm where:@\"NOT objectCol.stringCol LIKE NULL\"];\n        XCTAssertEqual(3U, nonNilLikeStrings.count);\n        XCTAssertEqualObjects((@[@\"a\", @\"b\", @\"\"]), [nonNilLikeStrings valueForKeyPath:@\"objectCol.stringCol\"]);\n\n        RLMAssertCount(stringLinkClass, 3U, @\"objectCol.stringCol IN {NULL, 'a'}\");\n\n        RLMAssertCount(stringLinkClass, 1U, @\"objectCol.stringCol CONTAINS 'a'\");\n        RLMAssertCount(stringLinkClass, 1U, @\"objectCol.stringCol BEGINSWITH 'a'\");\n        RLMAssertCount(stringLinkClass, 1U, @\"objectCol.stringCol ENDSWITH 'a'\");\n        RLMAssertCount(stringLinkClass, 1U, @\"objectCol.stringCol LIKE 'a'\");\n        RLMAssertCount(stringLinkClass, 0U, @\"objectCol.stringCol LIKE 'c'\");\n\n        RLMAssertCount(stringLinkClass, 0U, @\"objectCol.stringCol CONTAINS 'z'\");\n\n        RLMAssertCount(stringLinkClass, 1U, @\"objectCol.stringCol = ''\");\n    };\n\n    testWithStringClass([LinkStringObject class], [StringObject class]);\n    testWithStringClass([LinkIndexedStringObject class], [IndexedStringObject class]);\n}\n\n- (void)testSortingColumnsWithNull {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n\n    {\n        NumberObject *no1 = [NumberObject createInRealm:realm withValue:@[@1, @1.1f, @1.1, @YES]];\n        NumberObject *noNull = [NumberObject createInRealm:realm withValue:@[NSNull.null, NSNull.null, NSNull.null, NSNull.null]];\n        NumberObject *no0 = [NumberObject createInRealm:realm withValue:@[@0, @0.0f, @0.0, @NO]];\n        for (RLMProperty *property in [[NumberObject alloc] init].objectSchema.properties) {\n            NSString *name = property.name;\n            RLMResults *ascending = [[NumberObject allObjectsInRealm:realm] sortedResultsUsingKeyPath:name ascending:YES];\n            XCTAssertEqualObjects([ascending valueForKey:name], ([@[noNull, no0, no1] valueForKey:name]));\n\n            RLMResults *descending = [[NumberObject allObjectsInRealm:realm] sortedResultsUsingKeyPath:name ascending:NO];\n            XCTAssertEqualObjects([descending valueForKey:name], ([@[no1, no0, noNull] valueForKey:name]));\n        }\n    }\n\n    {\n        DateObject *doPositive = [DateObject createInRealm:realm withValue:@[[NSDate dateWithTimeIntervalSince1970:100]]];\n        DateObject *doNegative = [DateObject createInRealm:realm withValue:@[[NSDate dateWithTimeIntervalSince1970:-100]]];\n        DateObject *doZero = [DateObject createInRealm:realm withValue:@[[NSDate dateWithTimeIntervalSince1970:0]]];\n        DateObject *doNull = [DateObject createInRealm:realm withValue:@[NSNull.null]];\n\n        RLMResults *ascending = [[DateObject allObjectsInRealm:realm] sortedResultsUsingKeyPath:@\"dateCol\" ascending:YES];\n        XCTAssertEqualObjects([ascending valueForKey:@\"dateCol\"], ([@[doNull, doNegative, doZero, doPositive] valueForKey:@\"dateCol\"]));\n\n        RLMResults *descending = [[DateObject allObjectsInRealm:realm] sortedResultsUsingKeyPath:@\"dateCol\" ascending:NO];\n        XCTAssertEqualObjects([descending valueForKey:@\"dateCol\"], ([@[doPositive, doZero, doNegative, doNull] valueForKey:@\"dateCol\"]));\n    }\n\n    {\n        StringObject *soA = [StringObject createInRealm:realm withValue:@[@\"A\"]];\n        StringObject *soEmpty = [StringObject createInRealm:realm withValue:@[@\"\"]];\n        StringObject *soB = [StringObject createInRealm:realm withValue:@[@\"B\"]];\n        StringObject *soNull = [StringObject createInRealm:realm withValue:@[NSNull.null]];\n        StringObject *soAB = [StringObject createInRealm:realm withValue:@[@\"AB\"]];\n\n        RLMResults *ascending = [[StringObject allObjectsInRealm:realm] sortedResultsUsingKeyPath:@\"stringCol\" ascending:YES];\n        XCTAssertEqualObjects([ascending valueForKey:@\"stringCol\"], ([@[soNull, soEmpty, soA, soAB, soB] valueForKey:@\"stringCol\"]));\n\n        RLMResults *descending = [[StringObject allObjectsInRealm:realm] sortedResultsUsingKeyPath:@\"stringCol\" ascending:NO];\n        XCTAssertEqualObjects([descending valueForKey:@\"stringCol\"], ([@[soB, soAB, soA, soEmpty, soNull] valueForKey:@\"stringCol\"]));\n    }\n\n    [realm cancelWriteTransaction];\n}\n\nstruct NullTestData {\n    __unsafe_unretained NSString *propertyName;\n    __unsafe_unretained NSString *nonMatchingStr;\n    __unsafe_unretained NSString *matchingStr;\n    __unsafe_unretained id nonMatchingValue;\n    __unsafe_unretained id matchingValue;\n    bool orderable;\n    bool substringOperations;\n};\n\n- (void)testPrimitiveOperatorsOnAllNullablePropertyTypes {\n    RLMRealm *realm = [self realm];\n\n    // These need to be stored in variables because the struct does not retain them\n    NSData *matchingData = [@\"\" dataUsingEncoding:NSUTF8StringEncoding];\n    NSData *notMatchingData = [@\"a\" dataUsingEncoding:NSUTF8StringEncoding];\n    NSDate *matchingDate = [NSDate dateWithTimeIntervalSince1970:1];\n    NSDate *notMatchingDate = [NSDate dateWithTimeIntervalSince1970:2];\n    RLMDecimal128 *matchingDecimal = [RLMDecimal128 decimalWithNumber:@1];\n    RLMDecimal128 *notMatchingDecimal = [RLMDecimal128 decimalWithNumber:@2];\n    RLMObjectId *matchingObjectId = [RLMObjectId objectId];\n    RLMObjectId *notMatchingObjectId = [RLMObjectId objectId];\n\n    struct NullTestData data[] = {\n        {@\"boolObj\", @\"YES\", @\"NO\", @YES, @NO},\n        {@\"intObj\", @\"1\", @\"0\", @1, @0, true},\n        {@\"floatObj\", @\"1\", @\"0\", @1, @0, true},\n        {@\"doubleObj\", @\"1\", @\"0\", @1, @0, true},\n        {@\"string\", @\"'a'\", @\"''\", @\"a\", @\"\", false, true},\n        {@\"data\", nil, nil, notMatchingData, matchingData, false, true},\n        {@\"date\", nil, nil, notMatchingDate, matchingDate, true},\n        {@\"decimal\", nil, nil, notMatchingDecimal, matchingDecimal, true},\n        {@\"objectId\", nil, nil, notMatchingObjectId, matchingObjectId, false},\n    };\n\n    // Assert that the query \"prop op value\" gives expectedCount results when\n    // assembled via string formatting\n#define RLMAssertCountWithString(expectedCount, op, prop, value) \\\n    do { \\\n        NSString *queryStr = [NSString stringWithFormat:@\"%@ \" #op \" %@\", prop, value]; \\\n        NSUInteger actual = [AllOptionalTypes objectsWhere:queryStr].count; \\\n        XCTAssertEqual(expectedCount, actual, @\"%@: expected %@, got %@\", queryStr, @(expectedCount), @(actual)); \\\n    } while (0)\n\n    // Assert that the query \"prop op value\" gives expectedCount results when\n    // assembled via predicateWithFormat\n#define RLMAssertCountWithPredicate(expectedCount, op, prop, value) \\\n    do { \\\n        NSPredicate *query = [NSPredicate predicateWithFormat:@\"%K \" #op \" %@\", prop, value]; \\\n        NSUInteger actual = [AllOptionalTypes objectsWithPredicate:query].count; \\\n        XCTAssertEqual(expectedCount, actual, @\"%@ \" #op \" %@: expected %@, got %@\", prop, value, @(expectedCount), @(actual)); \\\n    } while (0)\n\n    // Assert that the given operator gives the expected count for each of the\n    // stored value, a different value, and nil\n#define RLMAssertOperator(op, matchingCount, notMatchingCount, nilCount) \\\n    do { \\\n        if (d.matchingStr) { \\\n            RLMAssertCountWithString(matchingCount, op, d.propertyName, d.matchingStr); \\\n            RLMAssertCountWithString(notMatchingCount, op, d.propertyName, d.nonMatchingStr); \\\n        } \\\n        RLMAssertCountWithString(nilCount, op, d.propertyName, nil); \\\n \\\n        RLMAssertCountWithPredicate(matchingCount, op, d.propertyName, d.matchingValue); \\\n        RLMAssertCountWithPredicate(notMatchingCount, op, d.propertyName, d.nonMatchingValue); \\\n        RLMAssertCountWithPredicate(nilCount, op, d.propertyName, nil); \\\n    } while (0)\n\n    // First test with the `matchingValue` stored in each property\n\n    [realm beginWriteTransaction];\n    [AllOptionalTypes createInRealm:realm withValue:@[@NO, @0, @0, @0, @\"\", matchingData, matchingDate, matchingDecimal, matchingObjectId]];\n    [realm commitWriteTransaction];\n\n    for (size_t i = 0; i < sizeof(data) / sizeof(data[0]); ++i) {\n        struct NullTestData d = data[i];\n        RLMAssertOperator(=,  1U, 0U, 0U);\n        RLMAssertOperator(!=, 0U, 1U, 1U);\n\n        if (d.orderable) {\n            RLMAssertOperator(<,  0U, 1U, 0U);\n            RLMAssertOperator(<=, 1U, 1U, 0U);\n            RLMAssertOperator(>,  0U, 0U, 0U);\n            RLMAssertOperator(>=, 1U, 0U, 0U);\n        }\n        if (d.substringOperations) {\n            RLMAssertOperator(BEGINSWITH, 0U, 0U, 0U);\n            RLMAssertOperator(ENDSWITH, 0U, 0U, 0U);\n            RLMAssertOperator(CONTAINS, 0U, 0U, 0U);\n        }\n    }\n\n    // Retest with all properties nil\n\n    [realm beginWriteTransaction];\n    [realm deleteAllObjects];\n    [AllOptionalTypes createInRealm:realm withValue:@[NSNull.null, NSNull.null,\n                                                      NSNull.null, NSNull.null,\n                                                      NSNull.null, NSNull.null,\n                                                      NSNull.null]];\n    [realm commitWriteTransaction];\n\n    for (size_t i = 0; i < sizeof(data) / sizeof(data[0]); ++i) {\n        struct NullTestData d = data[i];\n        RLMAssertOperator(=, 0U, 0U, 1U);\n        RLMAssertOperator(!=, 1U, 1U, 0U);\n\n        if (d.orderable) {\n            RLMAssertOperator(<,  0U, 0U, 0U);\n            RLMAssertOperator(<=, 0U, 0U, 1U);\n            RLMAssertOperator(>,  0U, 0U, 0U);\n            RLMAssertOperator(>=, 0U, 0U, 1U);\n        }\n        if (d.substringOperations) {\n            RLMAssertOperator(BEGINSWITH, 0U, 0U, 0U);\n            RLMAssertOperator(ENDSWITH, 0U, 0U, 0U);\n            RLMAssertOperator(CONTAINS, 0U, 0U, 0U);\n        }\n    }\n\n#undef RLMAssertCountWithString\n#undef RLMAssertCountWithPredicate\n#undef RLMAssertOperator\n}\n\n- (void)testPrimitiveOperatorsOnAllNullablePropertyTypesKeypathOnRHS {\n    RLMRealm *realm = [self realm];\n\n    // These need to be stored in variables because the struct does not retain them\n    NSData *matchingData = [@\"\" dataUsingEncoding:NSUTF8StringEncoding];\n    NSData *notMatchingData = [@\"a\" dataUsingEncoding:NSUTF8StringEncoding];\n    NSDate *matchingDate = [NSDate dateWithTimeIntervalSince1970:1];\n    NSDate *notMatchingDate = [NSDate dateWithTimeIntervalSince1970:2];\n    RLMDecimal128 *matchingDecimal = [RLMDecimal128 decimalWithNumber:@1];\n    RLMDecimal128 *notMatchingDecimal = [RLMDecimal128 decimalWithNumber:@2];\n    RLMObjectId *matchingObjectId = [RLMObjectId objectId];\n    RLMObjectId *notMatchingObjectId = [RLMObjectId objectId];\n\n    struct NullTestData data[] = {\n        {@\"boolObj\", @\"YES\", @\"NO\", @YES, @NO},\n        {@\"intObj\", @\"1\", @\"0\", @1, @0, true},\n        {@\"floatObj\", @\"1\", @\"0\", @1, @0, true},\n        {@\"doubleObj\", @\"1\", @\"0\", @1, @0, true},\n        {@\"string\", @\"'a'\", @\"''\", @\"a\", @\"\", false, true},\n        {@\"data\", nil, nil, notMatchingData, matchingData, false, true},\n        {@\"date\", nil, nil, notMatchingDate, matchingDate, true},\n        {@\"decimal\", nil, nil, notMatchingDecimal, matchingDecimal, true},\n        {@\"objectId\", nil, nil, notMatchingObjectId, matchingObjectId, false},\n    };\n\n    // Assert that the query \"prop op value\" gives expectedCount results when\n    // assembled via string formatting\n#define RLMAssertCountWithString(expectedCount, op, prop, value) \\\n    do { \\\n        NSString *queryStr = [NSString stringWithFormat:@\"%@ \" #op \" %@\", value, prop]; \\\n        NSUInteger actual = [AllOptionalTypes objectsWhere:queryStr].count; \\\n        XCTAssertEqual(expectedCount, actual, @\"%@: expected %@, got %@\", queryStr, @(expectedCount), @(actual)); \\\n        queryStr = [NSString stringWithFormat:@\"%@ \" #op \" %@\", value, prop]; \\\n        actual = [AllOptionalTypes objectsWhere:queryStr].count; \\\n        XCTAssertEqual(expectedCount, actual, @\"%@: expected %@, got %@\", queryStr, @(expectedCount), @(actual)); \\\n    } while (0)\n\n    // Assert that the query \"prop op value\" gives expectedCount results when\n    // assembled via predicateWithFormat\n#define RLMAssertCountWithPredicate(expectedCount, op, prop, value) \\\n    do { \\\n        NSPredicate *query = [NSPredicate predicateWithFormat:@ \"%@ \" #op \" %K\", value, prop]; \\\n        NSUInteger actual = [AllOptionalTypes objectsWithPredicate:query].count; \\\n        XCTAssertEqual(expectedCount, actual, @\"%@ \" #op \" %@: expected %@, got %@\", prop, value, @(expectedCount), @(actual)); \\\n    } while (0)\n\n    // Assert that the given operator gives the expected count for each of the\n    // stored value, a different value, and nil\n#define RLMAssertOperator(op, matchingCount, notMatchingCount, nilCount) \\\n    do { \\\n        if (d.matchingStr) { \\\n            RLMAssertCountWithString(matchingCount, op, d.propertyName, d.matchingStr); \\\n            RLMAssertCountWithString(notMatchingCount, op, d.propertyName, d.nonMatchingStr); \\\n        } \\\n        RLMAssertCountWithString(nilCount, op, d.propertyName, nil); \\\n \\\n        RLMAssertCountWithPredicate(matchingCount, op, d.propertyName, d.matchingValue); \\\n        RLMAssertCountWithPredicate(notMatchingCount, op, d.propertyName, d.nonMatchingValue); \\\n        RLMAssertCountWithPredicate(nilCount, op, d.propertyName, nil); \\\n    } while (0)\n\n    // First test with the `matchingValue` stored in each property\n\n    [realm beginWriteTransaction];\n    [AllOptionalTypes createInRealm:realm withValue:@[@NO, @0, @0, @0, @\"\", matchingData, matchingDate, matchingDecimal, matchingObjectId]];\n    [realm commitWriteTransaction];\n\n    for (size_t i = 0; i < sizeof(data) / sizeof(data[0]); ++i) {\n        struct NullTestData d = data[i];\n        RLMAssertOperator(=,  1U, 0U, 0U);\n        RLMAssertOperator(!=, 0U, 1U, 1U);\n\n        if (d.orderable) {\n            RLMAssertOperator(>,  0U, 1U, 0U);\n            RLMAssertOperator(>=, 1U, 1U, 0U);\n            RLMAssertOperator(<,  0U, 0U, 0U);\n            RLMAssertOperator(<=, 1U, 0U, 0U);\n        }\n    }\n\n    // Retest with all properties nil\n\n    [realm beginWriteTransaction];\n    [realm deleteAllObjects];\n    [AllOptionalTypes createInRealm:realm withValue:@[NSNull.null, NSNull.null,\n                                                      NSNull.null, NSNull.null,\n                                                      NSNull.null, NSNull.null,\n                                                      NSNull.null]];\n    [realm commitWriteTransaction];\n\n    for (size_t i = 0; i < sizeof(data) / sizeof(data[0]); ++i) {\n        struct NullTestData d = data[i];\n        RLMAssertOperator(=, 0U, 0U, 1U);\n        RLMAssertOperator(!=, 1U, 1U, 0U);\n\n        if (d.orderable) {\n            RLMAssertOperator(>,  0U, 0U, 0U);\n            RLMAssertOperator(>=, 0U, 0U, 1U);\n            RLMAssertOperator(<,  0U, 0U, 0U);\n            RLMAssertOperator(<=, 0U, 0U, 1U);\n        }\n    }\n\n#undef RLMAssertCountWithString\n#undef RLMAssertCountWithPredicate\n#undef RLMAssertOperator\n}\n\n- (void)testINPredicateOnNullWithNonNullValues\n{\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    RLMObjectId *objectId = [RLMObjectId objectId];\n    [AllOptionalTypes createInRealm:realm withValue:@[@YES, @1, @1, @1, @\"abc\",\n                                                      [@\"a\" dataUsingEncoding:NSUTF8StringEncoding],\n                                                      [NSDate dateWithTimeIntervalSince1970:1],\n                                                      @1, objectId]];\n    [realm commitWriteTransaction];\n\n    ////////////////////////\n    // Literal Predicates\n    ////////////////////////\n\n    // BOOL\n    [self testClass:[AllOptionalTypes class] withNormalCount:0 notCount:1 where:@\"boolObj IN {NULL}\"];\n    [self testClass:[AllOptionalTypes class] withNormalCount:1 notCount:0 where:@\"boolObj IN {YES}\"];\n\n    // int\n    [self testClass:[AllOptionalTypes class] withNormalCount:0 notCount:1 where:@\"intObj IN {NULL}\"];\n    [self testClass:[AllOptionalTypes class] withNormalCount:1 notCount:0 where:@\"intObj IN {1}\"];\n\n    // float\n    [self testClass:[AllOptionalTypes class] withNormalCount:0 notCount:1 where:@\"floatObj IN {NULL}\"];\n    [self testClass:[AllOptionalTypes class] withNormalCount:1 notCount:0 where:@\"floatObj IN {1}\"];\n\n    // double\n    [self testClass:[AllOptionalTypes class] withNormalCount:0 notCount:1 where:@\"doubleObj IN {NULL}\"];\n    [self testClass:[AllOptionalTypes class] withNormalCount:1 notCount:0 where:@\"doubleObj IN {1}\"];\n\n    // NSString\n    [self testClass:[AllOptionalTypes class] withNormalCount:0 notCount:1 where:@\"string IN {NULL}\"];\n    [self testClass:[AllOptionalTypes class] withNormalCount:1 notCount:0 where:@\"string IN {'abc'}\"];\n\n    // RLMDecimal128\n    [self testClass:[AllOptionalTypes class] withNormalCount:0 notCount:1 where:@\"decimal IN {NULL}\"];\n    [self testClass:[AllOptionalTypes class] withNormalCount:1 notCount:0 where:@\"decimal IN {'1'}\"];\n\n    // NSData\n    // Can't represent NSData with NSPredicate literal. See format predicates below\n\n    // NSDate\n    // Can't represent NSDate with NSPredicate literal. See format predicates below\n\n    ////////////////////////\n    // Format Predicates\n    ////////////////////////\n\n    // BOOL\n    [self testClass:[AllOptionalTypes class] withNormalCount:0U notCount:1U where:@\"boolObj IN %@\", @[NSNull.null]];\n    [self testClass:[AllOptionalTypes class] withNormalCount:1U notCount:0U where:@\"boolObj IN %@\", @[@YES]];\n\n    // int\n    [self testClass:[AllOptionalTypes class] withNormalCount:0U notCount:1U where:@\"intObj IN %@\", @[NSNull.null]];\n    [self testClass:[AllOptionalTypes class] withNormalCount:1U notCount:0U where:@\"intObj IN %@\", @[@1]];\n\n    // float\n    [self testClass:[AllOptionalTypes class] withNormalCount:0U notCount:1U where:@\"floatObj IN %@\", @[NSNull.null]];\n    [self testClass:[AllOptionalTypes class] withNormalCount:1U notCount:0U where:@\"floatObj IN %@\", @[@1]];\n\n    // double\n    [self testClass:[AllOptionalTypes class] withNormalCount:0U notCount:1U where:@\"doubleObj IN %@\", @[NSNull.null]];\n    [self testClass:[AllOptionalTypes class] withNormalCount:1U notCount:0U where:@\"doubleObj IN %@\", @[@1]];\n\n    // NSString\n    [self testClass:[AllOptionalTypes class] withNormalCount:1U notCount:0U where:@\"string IN %@\", @[@\"abc\"]];\n    [self testClass:[AllOptionalTypes class] withNormalCount:0U notCount:1U where:@\"string IN %@\", @[NSNull.null]];\n\n    // NSData\n    [self testClass:[AllOptionalTypes class] withNormalCount:0U notCount:1U where:@\"data IN %@\", @[NSNull.null]];\n    [self testClass:[AllOptionalTypes class] withNormalCount:1U notCount:0U where:@\"data IN %@\", @[[@\"a\" dataUsingEncoding:NSUTF8StringEncoding]]];\n\n    // NSDate\n    [self testClass:[AllOptionalTypes class] withNormalCount:0U notCount:1U where:@\"date IN %@\", @[NSNull.null]];\n    [self testClass:[AllOptionalTypes class] withNormalCount:1U notCount:0U where:@\"date IN %@\", @[[NSDate dateWithTimeIntervalSince1970:1]]];\n\n    // RLMDecimal128\n    [self testClass:[AllOptionalTypes class] withNormalCount:0 notCount:1 where:@\"decimal IN %@\", @[NSNull.null]];\n    [self testClass:[AllOptionalTypes class] withNormalCount:1 notCount:0 where:@\"decimal IN %@\", @[@1]];\n\n     // RLMObjectId\n     [self testClass:[AllOptionalTypes class] withNormalCount:0 notCount:1 where:@\"objectId IN %@\", @[NSNull.null]];\n     [self testClass:[AllOptionalTypes class] withNormalCount:1 notCount:0 where:@\"objectId IN %@\", @[objectId]];\n}\n\n- (void)testINPredicateOnNullWithNullValues\n{\n    RLMRealm *realm = [self realm];\n\n    [realm beginWriteTransaction];\n    [AllOptionalTypes createInRealm:realm withValue:@[NSNull.null, NSNull.null,\n                                                      NSNull.null, NSNull.null,\n                                                      NSNull.null, NSNull.null,\n                                                      NSNull.null]];\n    [realm commitWriteTransaction];\n\n    ////////////////////////\n    // Literal Predicates\n    ////////////////////////\n\n    // BOOL\n    [self testClass:[AllOptionalTypes class] withNormalCount:1 notCount:0 where:@\"boolObj IN {NULL}\"];\n    [self testClass:[AllOptionalTypes class] withNormalCount:0 notCount:1 where:@\"boolObj IN {YES}\"];\n\n    // int\n    [self testClass:[AllOptionalTypes class] withNormalCount:1 notCount:0 where:@\"intObj IN {NULL}\"];\n    [self testClass:[AllOptionalTypes class] withNormalCount:0 notCount:1 where:@\"intObj IN {1}\"];\n\n    // float\n    [self testClass:[AllOptionalTypes class] withNormalCount:1 notCount:0 where:@\"floatObj IN {NULL}\"];\n    [self testClass:[AllOptionalTypes class] withNormalCount:0 notCount:1 where:@\"floatObj IN {1}\"];\n\n    // double\n    [self testClass:[AllOptionalTypes class] withNormalCount:1 notCount:0 where:@\"doubleObj IN {NULL}\"];\n    [self testClass:[AllOptionalTypes class] withNormalCount:0 notCount:1 where:@\"doubleObj IN {1}\"];\n\n    // NSString\n    [self testClass:[AllOptionalTypes class] withNormalCount:1 notCount:0 where:@\"string IN {NULL}\"];\n    [self testClass:[AllOptionalTypes class] withNormalCount:0 notCount:1 where:@\"string IN {'abc'}\"];\n\n    // RLMDecimal128\n    [self testClass:[AllOptionalTypes class] withNormalCount:1 notCount:0 where:@\"decimal IN {NULL}\"];\n    [self testClass:[AllOptionalTypes class] withNormalCount:0 notCount:1 where:@\"decimal IN {'1'}\"];\n\n    // NSData\n    // Can't represent NSData with NSPredicate literal. See format predicates below\n\n    // NSDate\n    // Can't represent NSDate with NSPredicate literal. See format predicates below\n\n    ////////////////////////\n    // Format Predicates\n    ////////////////////////\n\n    // BOOL\n    [self testClass:[AllOptionalTypes class] withNormalCount:1U notCount:0U where:@\"boolObj IN %@\", @[NSNull.null]];\n    [self testClass:[AllOptionalTypes class] withNormalCount:0U notCount:1U where:@\"boolObj IN %@\", @[@YES]];\n\n    // int\n    [self testClass:[AllOptionalTypes class] withNormalCount:1U notCount:0U where:@\"intObj IN %@\", @[NSNull.null]];\n    [self testClass:[AllOptionalTypes class] withNormalCount:0U notCount:1U where:@\"intObj IN %@\", @[@1]];\n\n    // float\n    [self testClass:[AllOptionalTypes class] withNormalCount:1U notCount:0U where:@\"floatObj IN %@\", @[NSNull.null]];\n    [self testClass:[AllOptionalTypes class] withNormalCount:0U notCount:1U where:@\"floatObj IN %@\", @[@1]];\n\n    // double\n    [self testClass:[AllOptionalTypes class] withNormalCount:1U notCount:0U where:@\"doubleObj IN %@\", @[NSNull.null]];\n    [self testClass:[AllOptionalTypes class] withNormalCount:0U notCount:1U where:@\"doubleObj IN %@\", @[@1]];\n\n    // NSString\n    [self testClass:[AllOptionalTypes class] withNormalCount:0U notCount:1U where:@\"string IN %@\", @[@\"abc\"]];\n    [self testClass:[AllOptionalTypes class] withNormalCount:1U notCount:0U where:@\"string IN %@\", @[NSNull.null]];\n\n    // NSData\n    [self testClass:[AllOptionalTypes class] withNormalCount:1U notCount:0U where:@\"data IN %@\", @[NSNull.null]];\n    [self testClass:[AllOptionalTypes class] withNormalCount:0U notCount:1U where:@\"data IN %@\", @[[@\"a\" dataUsingEncoding:NSUTF8StringEncoding]]];\n\n    // NSDate\n    [self testClass:[AllOptionalTypes class] withNormalCount:1U notCount:0U where:@\"date IN %@\", @[NSNull.null]];\n    [self testClass:[AllOptionalTypes class] withNormalCount:0U notCount:1U where:@\"date IN %@\", @[[NSDate dateWithTimeIntervalSince1970:1]]];\n\n    // RLMDecimal128\n    [self testClass:[AllOptionalTypes class] withNormalCount:1 notCount:0 where:@\"decimal IN %@\", @[NSNull.null]];\n    [self testClass:[AllOptionalTypes class] withNormalCount:0 notCount:1 where:@\"decimal IN %@\", @[@1]];\n\n     // RLMObjectId\n     [self testClass:[AllOptionalTypes class] withNormalCount:1 notCount:0 where:@\"objectId IN %@\", @[NSNull.null]];\n     [self testClass:[AllOptionalTypes class] withNormalCount:0 notCount:1 where:@\"objectId IN %@\", @[RLMObjectId.objectId]];\n}\n\n- (void)testQueryOnRenamedProperties {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n    [RenamedProperties1 createInRealm:realm withValue:@[@1, @\"a\"]];\n    [RenamedProperties2 createInRealm:realm withValue:@[@2, @\"b\"]];\n    [realm commitWriteTransaction];\n\n    [self testClass:[RenamedProperties1 class] withNormalCount:2 notCount:0 where:@\"propA != 0\"];\n    [self testClass:[RenamedProperties1 class] withNormalCount:1 notCount:1 where:@\"propA = 1\"];\n    [self testClass:[RenamedProperties1 class] withNormalCount:1 notCount:1 where:@\"propA = 2\"];\n    [self testClass:[RenamedProperties1 class] withNormalCount:0 notCount:2 where:@\"propA = 3\"];\n\n    [self testClass:[RenamedProperties2 class] withNormalCount:2 notCount:0 where:@\"propC != 0\"];\n    [self testClass:[RenamedProperties2 class] withNormalCount:1 notCount:1 where:@\"propC = 1\"];\n    [self testClass:[RenamedProperties2 class] withNormalCount:1 notCount:1 where:@\"propC = 2\"];\n    [self testClass:[RenamedProperties2 class] withNormalCount:0 notCount:2 where:@\"propC = 3\"];\n}\n\n- (void)testQueryOverRenamedLinks {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n    id obj1 = [RenamedProperties1 createInRealm:realm withValue:@[@1, @\"a\"]];\n    id obj2 = [RenamedProperties2 createInRealm:realm withValue:@[@2, @\"b\"]];\n    [LinkToRenamedProperties1 createInRealm:realm withValue:@[obj1, NSNull.null, @[obj1], @[obj1]]];\n    [LinkToRenamedProperties2 createInRealm:realm withValue:@[obj2, NSNull.null, @[obj2], @[obj2]]];\n    [realm commitWriteTransaction];\n\n    [self testClass:[LinkToRenamedProperties1 class] withNormalCount:2 notCount:0 where:@\"linkA.propA != 0\"];\n    [self testClass:[LinkToRenamedProperties1 class] withNormalCount:1 notCount:1 where:@\"linkA.propA = 1\"];\n    [self testClass:[LinkToRenamedProperties1 class] withNormalCount:1 notCount:1 where:@\"linkA.propA = 2\"];\n    [self testClass:[LinkToRenamedProperties1 class] withNormalCount:0 notCount:2 where:@\"linkA.propA = 3\"];\n\n    [self testClass:[LinkToRenamedProperties2 class] withNormalCount:2 notCount:0 where:@\"linkC.propC != 0\"];\n    [self testClass:[LinkToRenamedProperties2 class] withNormalCount:1 notCount:1 where:@\"linkC.propC = 1\"];\n    [self testClass:[LinkToRenamedProperties2 class] withNormalCount:1 notCount:1 where:@\"linkC.propC = 2\"];\n    [self testClass:[LinkToRenamedProperties2 class] withNormalCount:0 notCount:2 where:@\"linkC.propC = 3\"];\n\n    [self testClass:[LinkToRenamedProperties1 class] withNormalCount:2 notCount:0 where:@\"ANY array.propA != 0\"];\n    [self testClass:[LinkToRenamedProperties1 class] withNormalCount:1 notCount:1 where:@\"ANY array.propA = 1\"];\n    [self testClass:[LinkToRenamedProperties1 class] withNormalCount:1 notCount:1 where:@\"ANY array.propA = 2\"];\n    [self testClass:[LinkToRenamedProperties1 class] withNormalCount:0 notCount:2 where:@\"ANY array.propA = 3\"];\n\n    [self testClass:[LinkToRenamedProperties2 class] withNormalCount:2 notCount:0 where:@\"ANY array.propC != 0\"];\n    [self testClass:[LinkToRenamedProperties2 class] withNormalCount:1 notCount:1 where:@\"ANY array.propC = 1\"];\n    [self testClass:[LinkToRenamedProperties2 class] withNormalCount:1 notCount:1 where:@\"ANY array.propC = 2\"];\n    [self testClass:[LinkToRenamedProperties2 class] withNormalCount:0 notCount:2 where:@\"ANY array.propC = 3\"];\n\n    [self testClass:[LinkToRenamedProperties1 class] withNormalCount:2 notCount:0 where:@\"ANY set.propA != 0\"];\n    [self testClass:[LinkToRenamedProperties1 class] withNormalCount:1 notCount:1 where:@\"ANY set.propA = 1\"];\n    [self testClass:[LinkToRenamedProperties1 class] withNormalCount:1 notCount:1 where:@\"ANY set.propA = 2\"];\n    [self testClass:[LinkToRenamedProperties1 class] withNormalCount:0 notCount:2 where:@\"ANY set.propA = 3\"];\n\n    [self testClass:[LinkToRenamedProperties2 class] withNormalCount:2 notCount:0 where:@\"ANY set.propC != 0\"];\n    [self testClass:[LinkToRenamedProperties2 class] withNormalCount:1 notCount:1 where:@\"ANY set.propC = 1\"];\n    [self testClass:[LinkToRenamedProperties2 class] withNormalCount:1 notCount:1 where:@\"ANY set.propC = 2\"];\n    [self testClass:[LinkToRenamedProperties2 class] withNormalCount:0 notCount:2 where:@\"ANY set.propC = 3\"];\n}\n\n- (void)testQueryOverRenamedBacklinks {\n    RLMRealm *realm = [self realm];\n    [realm beginWriteTransaction];\n    id obj1 = [RenamedProperties1 createInRealm:realm withValue:@[@1, @\"a\"]];\n    id obj2 = [RenamedProperties2 createInRealm:realm withValue:@[@2, @\"b\"]];\n    [LinkToRenamedProperties1 createInRealm:realm withValue:@[obj1, NSNull.null, @[obj1]]];\n    [LinkToRenamedProperties2 createInRealm:realm withValue:@[obj2, NSNull.null, @[obj2]]];\n    [realm commitWriteTransaction];\n\n    [self testClass:[RenamedProperties1 class] withNormalCount:2 notCount:0 where:@\"ANY linking1.linkA.propA != 0\"];\n    [self testClass:[RenamedProperties1 class] withNormalCount:1 notCount:1 where:@\"ANY linking1.linkA.propA = 1\"];\n    [self testClass:[RenamedProperties1 class] withNormalCount:1 notCount:1 where:@\"ANY linking1.linkA.propA = 2\"];\n    [self testClass:[RenamedProperties1 class] withNormalCount:0 notCount:2 where:@\"ANY linking1.linkA.propA = 3\"];\n}\n\n@end\n\n@interface AsyncQueryTests : QueryTests\n@end\n\n@implementation AsyncQueryTests\n- (RLMResults *)evaluate:(RLMResults *)results {\n    id token = [results addNotificationBlock:^(RLMResults *r, __unused RLMCollectionChange *changed, NSError *e) {\n        XCTAssertNil(e);\n        XCTAssertNotNil(r);\n        CFRunLoopStop(CFRunLoopGetCurrent());\n    }];\n    CFRunLoopRun();\n    [(RLMNotificationToken *)token invalidate];\n    return results;\n}\n@end\n\n@interface QueryWithReversedColumnOrderTests : QueryTests\n@end\n\n@implementation QueryWithReversedColumnOrderTests\n- (RLMRealm *)realm {\n    @autoreleasepool {\n        NSSet *classNames = [NSSet setWithArray:@[@\"AllTypesObject\", @\"QueryObject\", @\"PersonObject\", @\"DogObject\",\n                                                  @\"EmployeeObject\", @\"CompanyObject\", @\"OwnerObject\"]];\n        RLMSchema *schema = [RLMSchema.sharedSchema copy];\n        NSMutableArray *objectSchemas = [schema.objectSchema mutableCopy];\n        for (NSUInteger i = 0; i < objectSchemas.count; i++) {\n            RLMObjectSchema *objectSchema = objectSchemas[i];\n            if ([classNames member:objectSchema.className]) {\n                objectSchemas[i] = [self reverseProperties:objectSchema];\n            }\n        }\n        schema.objectSchema = objectSchemas;\n        RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n        config.customSchema = schema;\n        [RLMRealm realmWithConfiguration:config error:nil];\n    }\n\n    return RLMRealm.defaultRealm;\n}\n\n- (RLMObjectSchema *)reverseProperties:(RLMObjectSchema *)source {\n    RLMObjectSchema *objectSchema = [source copy];\n    objectSchema.properties = objectSchema.properties.reverseObjectEnumerator.allObjects;\n    return objectSchema;\n}\n@end\n"
  },
  {
    "path": "Realm/Tests/RLMValueTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n#import <Realm/RLMValue.h>\n\n@interface RLMValueTests : RLMTestCase\n@end\n\n@implementation RLMValueTests\n\n#pragma mark - Type Checking\n\n- (void)testIntType {\n    id<RLMValue> v = @123;\n    XCTAssertEqual(v.rlm_anyValueType, RLMAnyValueTypeInt);\n}\n\n- (void)testFloatType {\n    id<RLMValue> v = @123.456f;\n    XCTAssertEqual(v.rlm_anyValueType, RLMAnyValueTypeFloat);\n}\n\n- (void)testStringType {\n    id<RLMValue> v = @\"hello\";\n    XCTAssertEqual(v.rlm_anyValueType, RLMAnyValueTypeString);\n}\n\n- (void)testDataType {\n    id<RLMValue> v = [NSData dataWithBytes:\"hey\" length:3];\n    XCTAssertEqual(v.rlm_anyValueType, RLMAnyValueTypeData);\n}\n\n- (void)testDateType {\n    id<RLMValue> v = [NSDate date];\n    XCTAssertEqual(v.rlm_anyValueType, RLMAnyValueTypeDate);\n}\n\n- (void)testObjectType {\n    id<RLMValue> v = [[StringObject alloc] init];\n    XCTAssertEqual(v.rlm_anyValueType, RLMAnyValueTypeObject);\n}\n\n- (void)testObjectIdType {\n    id<RLMValue> v = [RLMObjectId objectId];\n    XCTAssertEqual(v.rlm_anyValueType, RLMAnyValueTypeObjectId);\n}\n\n- (void)testDecimal128Type {\n    id<RLMValue> v = [RLMDecimal128 decimalWithNumber:@123.456];\n    XCTAssertEqual(v.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n}\n\n- (void)testDictionaryType {\n    NSDictionary *dictionary = @{ @\"key1\" : @\"hello\" };\n    XCTAssertEqual(dictionary.rlm_anyValueType, RLMAnyValueTypeDictionary);\n}\n\n- (void)testArrayType {\n    NSArray *array = @[ @\"hello\", @123456 ];\n    XCTAssertEqual(array.rlm_anyValueType, RLMAnyValueTypeList);\n}\n\n#pragma mark - Comparison\n\n- (void)testNumberEquals {\n    id<RLMValue> v1 = @123;\n    id<RLMValue> v2 = @123;\n\n    XCTAssertEqualObjects(v1, v2);\n    XCTAssertEqual(v1.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertEqual(v2.rlm_anyValueType, RLMAnyValueTypeInt);\n    XCTAssertNotEqual(v2, @456);\n}\n\n- (void)testStringEquals {\n    id<RLMValue> v1 = @\"hello\";\n    id<RLMValue> v2 = @\"hello\";\n\n    XCTAssertEqual(v1, v2);\n    XCTAssertEqual(v1.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertEqual(v2.rlm_anyValueType, RLMAnyValueTypeString);\n    XCTAssertNotEqual(v2, @\"there\");\n}\n\n- (void)testDataEquals {\n    NSData *d = [NSData dataWithBytes:\"hey\" length:3];\n    id<RLMValue> v1 = [d copy];\n    id<RLMValue> v2 = [d copy];\n    XCTAssertEqual(v1, v2);\n    XCTAssertEqual(v1.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertEqual(v2.rlm_anyValueType, RLMAnyValueTypeData);\n    XCTAssertNotEqual(v1, [NSData dataWithBytes:\"there\" length:5]);\n}\n\n- (void)testDateEquals {\n    NSDate *d = [NSDate date];\n    id<RLMValue> v1 = [d copy];\n    id<RLMValue> v2 = [d copy];\n    XCTAssertEqual(v1, v2);\n    XCTAssertEqual(v1.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertEqual(v2.rlm_anyValueType, RLMAnyValueTypeDate);\n    XCTAssertNotEqual(v1, [NSDate dateWithTimeIntervalSince1970:0]);\n}\n\n- (void)testObjectEquals {\n    StringObject *so = [[StringObject alloc] init];\n    id<RLMValue> v1 = so;\n    id<RLMValue> v2 = so;\n    XCTAssertEqual(v1, so);\n    XCTAssertEqual(v2, so);\n    XCTAssertEqual(v1.rlm_anyValueType, RLMAnyValueTypeObject);\n    XCTAssertEqual(v2.rlm_anyValueType, RLMAnyValueTypeObject);\n    XCTAssertEqual(v1, v2);\n    XCTAssertNotEqual(v1, [[StringObject alloc] init]);\n}\n\n- (void)testObjectIdEquals {\n    RLMObjectId *oid = [RLMObjectId objectId];\n    id<RLMValue> v1 = oid;\n    id<RLMValue> v2 = oid;\n    XCTAssertEqual(v1, oid);\n    XCTAssertEqual(v2, oid);\n    XCTAssertEqual(v1.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(v2.rlm_anyValueType, RLMAnyValueTypeObjectId);\n    XCTAssertEqual(v1, v2);\n    XCTAssertNotEqual(v1, [RLMObjectId objectId]);\n}\n\n- (void)testDecimal128Equals {\n    RLMDecimal128 *d = [RLMDecimal128 decimalWithNumber:@123.456];\n    id<RLMValue> v1 = d;\n    id<RLMValue> v2 = d;\n    XCTAssertEqual(v1, d);\n    XCTAssertEqual(v2, d);\n    XCTAssertEqual(v1.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(v2.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n    XCTAssertEqual(v1, v2);\n    XCTAssertNotEqual(v1, [RLMDecimal128 decimalWithNumber:@456.123]);\n}\n\n- (void)testDictionaryAnyEquals {\n    NSDictionary *dictionary = @{ @\"key2\" : @\"hello2\",\n                                  @\"key3\" : @YES,\n                                  @\"key4\" : @123,\n                                  @\"key5\" : @456.789,\n                                  @\"key6\" : [NSData dataWithBytes:\"hey\" length:3],\n                                  @\"key7\" : [NSDate date],\n                                  @\"key8\" : [[MixedObject alloc] init],\n                                  @\"key9\" : [RLMObjectId objectId],\n                                  @\"key10\" : [RLMDecimal128 decimalWithNumber:@123.456] };\n    id<RLMValue> v1 = dictionary;\n    id<RLMValue> v2 = dictionary;\n    XCTAssertEqual(v1, dictionary);\n    XCTAssertEqual(v2, dictionary);\n    XCTAssertEqual(v1.rlm_anyValueType, RLMAnyValueTypeDictionary);\n    XCTAssertEqual(v2.rlm_anyValueType, RLMAnyValueTypeDictionary);\n    XCTAssertEqual(v1, v2);\n}\n\n- (void)testArrayAnyEquals {\n    NSArray *array = @[ @\"hello2\",\n                        @YES,\n                        @123,\n                        @456.789,\n                        [NSData dataWithBytes:\"hey\" length:3],\n                        [NSDate date],\n                        [[MixedObject alloc] init],\n                        [RLMObjectId objectId],\n                        [RLMDecimal128 decimalWithNumber:@123.456] ];\n    id<RLMValue> v1 = array;\n    id<RLMValue> v2 = array;\n    XCTAssertEqual(v1, array);\n    XCTAssertEqual(v2, array);\n    XCTAssertEqual(v1.rlm_anyValueType, RLMAnyValueTypeList);\n    XCTAssertEqual(v2.rlm_anyValueType, RLMAnyValueTypeList);\n    XCTAssertEqual(v1, v2);\n}\n\n#pragma mark - Managed Values\n\n- (void)testCreateManagedObjectManagedChild {\n    StringObject *so = [[StringObject alloc] init];\n    so.stringCol = @\"hello\";\n    \n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    [r addObject:so];\n    MixedObject *mo0 = [MixedObject createInRealm:r withValue:@[so, @[so]]];\n    \n    MixedObject *mo1 = [[MixedObject alloc] init];\n    mo1.anyCol = so;\n    [mo1.anyArray addObject:so];\n    [r commitWriteTransaction];\n    \n    XCTAssertNotNil(mo0.anyCol);\n    XCTAssertTrue([((StringObject *)mo0.anyCol).stringCol isEqualToString:so.stringCol]);\n    XCTAssertEqual(mo0.anyCol.rlm_anyValueType, RLMAnyValueTypeObject);\n    XCTAssertTrue([((StringObject *)mo0.anyArray.firstObject).stringCol isEqualToString:so.stringCol]);\n\n    XCTAssertNotNil(mo1.anyCol);\n    XCTAssertTrue([((StringObject *)mo1.anyCol).stringCol isEqualToString:so.stringCol]);\n    XCTAssertEqual(mo1.anyCol.rlm_anyValueType, RLMAnyValueTypeObject);\n    XCTAssertTrue([((StringObject *)mo1.anyArray.firstObject).stringCol isEqualToString:so.stringCol]);\n    XCTAssertEqual([StringObject allObjectsInRealm:r].count, 1U);\n}\n\n- (void)testCreateManagedObjectInAnyDictionary {\n    StringObject *so = [[StringObject alloc] init];\n    so.stringCol = @\"hello\";\n    \n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    [r addObject:so];\n    \n    NSDictionary *dictionary = @{ @\"key1\" : so };\n    MixedObject *mo0 = [MixedObject createInRealm:r withValue:@[dictionary, @[dictionary]]];\n    \n    MixedObject *mo1 = [[MixedObject alloc] init];\n    mo1.anyCol = dictionary;\n    [mo1.anyArray addObject:dictionary];\n    [r commitWriteTransaction];\n    \n    XCTAssertNotNil(mo0.anyCol);\n    XCTAssertTrue([((StringObject *)((NSDictionary *)mo0.anyCol)[@\"key1\"]).stringCol isEqualToString:so.stringCol]);\n    XCTAssertTrue([((StringObject *)((NSDictionary *)mo0.anyArray.firstObject)[@\"key1\"]).stringCol isEqualToString:so.stringCol]);\n    \n    XCTAssertNotNil(mo1.anyCol);\n    XCTAssertTrue([((StringObject *)((NSDictionary *)mo1.anyCol)[@\"key1\"]).stringCol isEqualToString:so.stringCol]);\n    XCTAssertTrue([((StringObject *)((NSDictionary *)mo1.anyArray[0])[@\"key1\"]).stringCol isEqualToString:so.stringCol]);\n}\n\n- (void)testCreateManagedObjectInAnyArray {\n    StringObject *so = [[StringObject alloc] init];\n    so.stringCol = @\"hello\";\n    \n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    [r addObject:so];\n    \n    NSArray *array = @[so];\n    MixedObject *mo0 = [MixedObject createInRealm:r withValue:@[array, @[array]]];\n    \n    MixedObject *mo1 = [[MixedObject alloc] init];\n    mo1.anyCol = array;\n    [mo1.anyArray addObject:array];\n    [r commitWriteTransaction];\n    \n    XCTAssertNotNil(mo0.anyCol);\n    XCTAssertTrue([((StringObject *)((NSArray *)mo0.anyCol)[0]).stringCol isEqualToString:so.stringCol]);\n    XCTAssertTrue([((StringObject *)((NSArray *)mo0.anyArray.firstObject)[0]).stringCol isEqualToString:so.stringCol]);\n    \n    XCTAssertNotNil(mo1.anyCol);\n    XCTAssertTrue([((StringObject *)((NSArray *)mo1.anyCol)[0]).stringCol isEqualToString:so.stringCol]);\n    XCTAssertTrue([((StringObject *)((NSArray *)mo1.anyArray[0])[0]).stringCol isEqualToString:so.stringCol]);\n}\n\n\n- (void)testCreateManagedObjectUnmanagedChild {\n    StringObject *so = [[StringObject alloc] init];\n    so.stringCol = @\"hello\";\n    \n    StringObject *so1 = [[StringObject alloc] init];\n    so1.stringCol = @\"hello2\";\n    \n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    MixedObject *mo0 = [MixedObject createInRealm:r withValue:@[so, @[so]]];\n    \n    MixedObject *mo1 = [[MixedObject alloc] init];\n    [mo1.anyArray addObject:so];\n    [r addObject:mo1];\n    [r commitWriteTransaction];\n\n    XCTAssertThrows(mo1.anyCol = so1);\n    [r beginWriteTransaction];\n    mo1.anyCol = so1;\n    \n    XCTAssertNotNil(mo0.anyCol);\n    XCTAssertTrue([((StringObject *)mo0.anyCol).stringCol isEqualToString:so.stringCol]);\n    XCTAssertEqual(mo0.anyCol.rlm_anyValueType, RLMAnyValueTypeObject);\n    XCTAssertTrue([((StringObject *)mo0.anyArray[0]).stringCol isEqualToString:so.stringCol]);\n\n    XCTAssertNotNil(mo1.anyCol);\n    XCTAssertTrue([((StringObject *)mo1.anyCol).stringCol isEqualToString:so1.stringCol]);\n    XCTAssertEqual(mo1.anyCol.rlm_anyValueType, RLMAnyValueTypeObject);\n    XCTAssertTrue([((StringObject *)mo1.anyArray[0]).stringCol isEqualToString:so.stringCol]);\n}\n\n- (void)testCreateManagedObjectUnmanagedChildInAnyDictionary {\n    StringObject *so = [[StringObject alloc] init];\n    so.stringCol = @\"hello\";\n    \n    StringObject *so1 = [[StringObject alloc] init];\n    so1.stringCol = @\"hello2\";\n    \n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    \n    NSDictionary *dictionary = @{ @\"key1\" : so };\n    MixedObject *mo0 = [MixedObject createInRealm:r withValue:@[dictionary, @[dictionary]]];\n    \n    MixedObject *mo1 = [[MixedObject alloc] init];\n    [mo1.anyArray addObject:dictionary];\n    [r addObject:mo1];\n    [r commitWriteTransaction];\n    \n    XCTAssertThrows(mo1.anyCol = so1);\n    [r beginWriteTransaction];\n    mo1.anyCol = @{ @\"key2\" : so1 };\n    \n    XCTAssertNotNil(mo0.anyCol);\n    XCTAssertTrue([((StringObject *)((NSDictionary *)mo0.anyCol)[@\"key1\"]).stringCol isEqualToString:so.stringCol]);\n    XCTAssertTrue([((StringObject *)((NSDictionary *)mo0.anyArray.firstObject)[@\"key1\"]).stringCol isEqualToString:so.stringCol]);\n    \n    XCTAssertNotNil(mo1.anyCol);\n    XCTAssertTrue([((StringObject *)((NSDictionary *)mo1.anyCol)[@\"key2\"]).stringCol isEqualToString:so1.stringCol]);\n    XCTAssertTrue([((StringObject *)((NSDictionary *)mo1.anyArray[0])[@\"key1\"]).stringCol isEqualToString:so.stringCol]);\n}\n\n- (void)testCreateManagedObjectUnmanagedChildInAnyArray {\n    StringObject *so = [[StringObject alloc] init];\n    so.stringCol = @\"hello\";\n    \n    StringObject *so1 = [[StringObject alloc] init];\n    so1.stringCol = @\"hello2\";\n    \n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    \n    NSArray *array = @[so];\n    MixedObject *mo0 = [MixedObject createInRealm:r withValue:@[array, @[array]]];\n    \n    MixedObject *mo1 = [[MixedObject alloc] init];\n    [mo1.anyArray addObject:array];\n    [r addObject:mo1];\n    [r commitWriteTransaction];\n    \n    XCTAssertThrows(mo1.anyCol = so1);\n    [r beginWriteTransaction];\n    mo1.anyCol = @[so1];\n    \n    XCTAssertNotNil(mo0.anyCol);\n    XCTAssertTrue([((StringObject *)((NSArray *)mo0.anyCol)[0]).stringCol isEqualToString:so.stringCol]);\n    XCTAssertTrue([((StringObject *)((NSArray *)mo0.anyArray.firstObject)[0]).stringCol isEqualToString:so.stringCol]);\n    \n    XCTAssertNotNil(mo1.anyCol);\n    XCTAssertTrue([((StringObject *)((NSArray *)mo1.anyCol)[0]).stringCol isEqualToString:so1.stringCol]);\n    XCTAssertTrue([((StringObject *)((NSArray *)mo1.anyArray[0])[0]).stringCol isEqualToString:so.stringCol]);\n}\n\n// difference between adding object and not!\n- (void)testCreateManagedObject {\n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    StringObject *so = [StringObject createInRealm:r withValue:@[@\"hello\"]];\n    MixedObject *mo = [MixedObject createInRealm:r withValue:@[so, @[]]];\n    [r commitWriteTransaction];\n    XCTAssertTrue([((StringObject *)mo.anyCol).stringCol isEqualToString:so.stringCol]);\n    XCTAssertEqual(mo.anyCol.rlm_anyValueType, RLMAnyValueTypeObject);\n}\n\n- (void)testCreateManagedInt {\n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    MixedObject *mo = [MixedObject createInRealm:r withValue:@[@123456789, @[@123456, @67890]]];\n    [r commitWriteTransaction];\n    XCTAssertTrue([(NSNumber *)mo.anyCol isEqualToNumber:@123456789]);\n    XCTAssertTrue([mo.anyArray[0] isEqualToNumber:@123456]);\n    XCTAssertTrue([mo.anyArray[1] isEqualToNumber:@67890]);\n    XCTAssertEqual(mo.anyCol.rlm_anyValueType, RLMAnyValueTypeInt);\n}\n\n- (void)testCreateManagedFloat {\n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    MixedObject *mo = [MixedObject createInRealm:r withValue:@[@1234.5f, @[@12345.6f, @678.9f]]];\n    [r commitWriteTransaction];\n    XCTAssertTrue([(NSNumber *)mo.anyCol isEqualToNumber:@1234.5f]);\n    XCTAssertTrue([mo.anyArray[0] isEqualToNumber:[NSNumber numberWithFloat:12345.6f]]);\n    XCTAssertTrue([mo.anyArray[1] isEqualToNumber:[NSNumber numberWithFloat:678.9f]]);\n    XCTAssertEqual(mo.anyCol.rlm_anyValueType, RLMAnyValueTypeFloat);\n}\n\n- (void)testCreateManagedDouble {\n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    MixedObject *mo = [MixedObject createInRealm:r withValue:@[@1234.5, @[@12345.6, @678.9]]];\n    [r commitWriteTransaction];\n    XCTAssertTrue([(NSNumber *)mo.anyCol isEqualToNumber:@1234.5]);\n    XCTAssertTrue([mo.anyArray[0] isEqualToNumber:[NSNumber numberWithDouble:12345.6]]);\n    XCTAssertTrue([mo.anyArray[1] isEqualToNumber:[NSNumber numberWithDouble:678.9]]);\n    XCTAssertEqual(mo.anyCol.rlm_anyValueType, RLMAnyValueTypeDouble);\n}\n\n- (void)testCreateManagedString {\n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    MixedObject *mo = [MixedObject createInRealm:r withValue:@[@\"hello\", @[@\"over\", @\"there\"]]];\n    [r commitWriteTransaction];\n    XCTAssertTrue([(NSString *)mo.anyCol isEqualToString:@\"hello\"]);\n    XCTAssertTrue([mo.anyArray[0] isEqualToString:@\"over\"]);\n    XCTAssertTrue([mo.anyArray[1] isEqualToString:@\"there\"]);\n    XCTAssertEqual(mo.anyCol.rlm_anyValueType, RLMAnyValueTypeString);\n}\n\n- (void)testCreateManagedData {\n    RLMRealm *r = [self realmWithTestPath];\n    NSData *d1 = [NSData dataWithBytes:\"hey\" length:3];\n    NSData *d2 = [NSData dataWithBytes:\"you\" length:3];\n\n    [r beginWriteTransaction];\n    MixedObject *mo = [MixedObject createInRealm:r withValue:@[d1, @[d1, d2]]];\n    [r commitWriteTransaction];\n\n    XCTAssertTrue([[[NSString alloc] initWithData:(NSData *)mo.anyCol\n                                         encoding:NSUTF8StringEncoding] isEqualToString:@\"hey\"]);\n    XCTAssertTrue([[[NSString alloc] initWithData:mo.anyArray[0]\n                                         encoding:NSUTF8StringEncoding] isEqualToString:@\"hey\"]);\n    XCTAssertTrue([[[NSString alloc] initWithData:mo.anyArray[1]\n                                         encoding:NSUTF8StringEncoding] isEqualToString:@\"you\"]);\n    XCTAssertEqual(mo.anyCol.rlm_anyValueType, RLMAnyValueTypeData);\n}\n\n- (void)testCreateManagedDate {\n    RLMRealm *r = [self realmWithTestPath];\n    NSDate *d1 = [NSDate date];\n    NSDate *d2 = [NSDate date];\n\n    [r beginWriteTransaction];\n    MixedObject *mo = [MixedObject createInRealm:r withValue:@[d1, @[d1, d2]]];\n    [r commitWriteTransaction];\n\n    // handle lossy margin of error.\n    XCTAssertEqualWithAccuracy(d1.timeIntervalSince1970, ((NSDate *)mo.anyCol).timeIntervalSince1970, 1);\n    XCTAssertEqualWithAccuracy(d1.timeIntervalSince1970, ((NSDate *)mo.anyArray[0]).timeIntervalSince1970, 1);\n    XCTAssertEqualWithAccuracy(d2.timeIntervalSince1970, ((NSDate *)mo.anyArray[1]).timeIntervalSince1970, 1);\n    XCTAssertEqual(mo.anyCol.rlm_anyValueType, RLMAnyValueTypeDate);\n}\n\n- (void)testCreateManagedObjectId {\n    RLMRealm *r = [self realmWithTestPath];\n    RLMObjectId *oid1 = [RLMObjectId objectId];\n    RLMObjectId *oid2 = [RLMObjectId objectId];\n\n    [r beginWriteTransaction];\n    MixedObject *mo = [MixedObject createInRealm:r withValue:@[oid1, @[oid1, oid2]]];\n    [r commitWriteTransaction];\n\n    XCTAssertTrue([(RLMObjectId *)mo.anyCol isEqual:oid1]);\n    XCTAssertTrue([(RLMObjectId *)mo.anyArray[0] isEqual:oid1]);\n    XCTAssertTrue([(RLMObjectId *)mo.anyArray[1] isEqual:oid2]);\n    XCTAssertEqual(mo.anyCol.rlm_anyValueType, RLMAnyValueTypeObjectId);\n}\n\n- (void)testCreateManagedDecimal128 {\n    RLMRealm *r = [self realmWithTestPath];\n    RLMDecimal128 *d1 = [RLMDecimal128 decimalWithNumber:@123.456];\n    RLMDecimal128 *d2 = [RLMDecimal128 decimalWithNumber:@890.456];\n\n    [r beginWriteTransaction];\n    MixedObject *mo = [MixedObject createInRealm:r withValue:@[d1, @[d1, d2]]];\n    [r commitWriteTransaction];\n\n    XCTAssertTrue([(RLMDecimal128 *)mo.anyCol isEqual:d1]);\n    XCTAssertTrue([(RLMDecimal128 *)mo.anyArray[0] isEqual:d1]);\n    XCTAssertTrue([(RLMDecimal128 *)mo.anyArray[1] isEqual:d2]);\n    XCTAssertEqual(mo.anyCol.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n}\n\n- (void)testCreateManagedDictionary {\n    RLMRealm *r = [self realmWithTestPath];\n    StringObject *so = [[StringObject alloc] init];\n    so.stringCol = @\"hello\";\n    RLMObjectId *oid = [RLMObjectId objectId];\n    NSDate *d = [NSDate date];\n    NSDictionary *d1 = @{ @\"key2\" : @\"hello2\",\n                          @\"key3\" : @YES,\n                          @\"key4\" : @123,\n                          @\"key5\" : @456.789,\n                          @\"key6\" : [NSData dataWithBytes:\"hey\" length:3],\n                          @\"key7\" : d,\n                          @\"key8\" : so,\n                          @\"key9\" : oid,\n                          @\"key10\" : [RLMDecimal128 decimalWithNumber:@123.456] };\n    NSDictionary *d2 = @{ @\"key1\" : @\"hello\" };\n    [r beginWriteTransaction];\n    [MixedObject createInRealm:r withValue:@[d1, @[d1, d2]]];\n    [r commitWriteTransaction];\n    \n    XCTAssertEqual([MixedObject allObjectsInRealm:r].count, 1U);\n    MixedObject *result = [[MixedObject allObjectsInRealm:r] firstObject];\n    RLMDictionary *dictionary = (RLMDictionary *)result.anyCol;\n    XCTAssertTrue([dictionary[@\"key2\"] isEqual:@\"hello2\"]);\n    XCTAssertTrue([dictionary[@\"key3\"] isEqual:@YES]);\n    XCTAssertTrue([dictionary[@\"key4\"] isEqual:@123]);\n    XCTAssertTrue([dictionary[@\"key5\"] isEqual:@456.789]);\n    XCTAssertTrue([[[NSString alloc] initWithData:(NSData *)dictionary[@\"key6\"] encoding:NSUTF8StringEncoding] isEqual:@\"hey\"]);\n    XCTAssertEqualWithAccuracy(((NSDate *)dictionary[@\"key7\"]).timeIntervalSince1970, d.timeIntervalSince1970, 1.0);\n    XCTAssertTrue([((StringObject *)dictionary[@\"key8\"]).stringCol isEqual:@\"hello\"]);\n    XCTAssertTrue([((RLMObjectId *)dictionary[@\"key9\"]) isEqual:oid]);\n    XCTAssertTrue([dictionary[@\"key10\"] isEqual:[RLMDecimal128 decimalWithNumber:@123.456]]);\n    \n    RLMDictionary *dictionary1 = (RLMDictionary *)result.anyArray.firstObject;\n    XCTAssertTrue([dictionary1[@\"key2\"] isEqual:@\"hello2\"]);\n    XCTAssertTrue([dictionary1[@\"key3\"] isEqual:@YES]);\n    XCTAssertTrue([dictionary1[@\"key4\"] isEqual:@123]);\n    XCTAssertTrue([dictionary1[@\"key5\"] isEqual:@456.789]);\n    XCTAssertTrue([[[NSString alloc] initWithData:(NSData *)dictionary1[@\"key6\"] encoding:NSUTF8StringEncoding] isEqual:@\"hey\"]);\n    XCTAssertEqualWithAccuracy(((NSDate *)dictionary1[@\"key7\"]).timeIntervalSince1970, d.timeIntervalSince1970, 1.0);\n    XCTAssertTrue([((StringObject *)dictionary1[@\"key8\"]).stringCol isEqual:@\"hello\"]);\n    XCTAssertTrue([((RLMObjectId *)dictionary1[@\"key9\"]) isEqual:oid]);\n    XCTAssertTrue([dictionary1[@\"key10\"] isEqual:[RLMDecimal128 decimalWithNumber:@123.456]]);\n    \n    RLMDictionary *dictionary2 = (RLMDictionary *)result.anyArray.lastObject;\n    XCTAssertTrue([dictionary2[@\"key1\"] isEqual:@\"hello\"]);\n}\n\n- (void)testCreateManagedArray {\n    RLMRealm *r = [self realmWithTestPath];\n    StringObject *so = [[StringObject alloc] init];\n    so.stringCol = @\"hello\";\n    RLMObjectId *oid = [RLMObjectId objectId];\n    NSDate *d = [NSDate date];\n    NSArray *d1 = @[ @\"hello2\",\n                     @YES,\n                     @123,\n                     @456.789,\n                     [NSData dataWithBytes:\"hey\" length:3],\n                     d,\n                     so,\n                     oid,\n                     [RLMDecimal128 decimalWithNumber:@123.456] ];\n    NSArray *d2 = @[@\"hello\"];\n    [r beginWriteTransaction];\n    [MixedObject createInRealm:r withValue:@[d1, @[d1, d2]]];\n    [r commitWriteTransaction];\n    \n    XCTAssertEqual([MixedObject allObjectsInRealm:r].count, 1U);\n    MixedObject *result = [[MixedObject allObjectsInRealm:r] firstObject];\n    RLMArray *array = ((RLMArray *)result.anyCol);\n    XCTAssertTrue([array[0] isEqual:@\"hello2\"]);\n    XCTAssertTrue([array[1] isEqual:@YES]);\n    XCTAssertTrue([array[2] isEqual:@123]);\n    XCTAssertTrue([array[3] isEqual:@456.789]);\n    XCTAssertTrue([[[NSString alloc] initWithData:(NSData *)array[4] encoding:NSUTF8StringEncoding] isEqual:@\"hey\"]);\n    XCTAssertEqualWithAccuracy(((NSDate *)array[5]).timeIntervalSince1970, d.timeIntervalSince1970, 1.0);\n    XCTAssertTrue([((StringObject *)array[6]).stringCol isEqual:@\"hello\"]);\n    XCTAssertTrue([((RLMObjectId *)array[7]) isEqual:oid]);\n    XCTAssertTrue([array[8] isEqual:[RLMDecimal128 decimalWithNumber:@123.456]]);\n    \n    RLMArray *array1 = (RLMArray *)result.anyArray.firstObject;\n    XCTAssertTrue([array1[0] isEqual:@\"hello2\"]);\n    XCTAssertTrue([array1[1] isEqual:@YES]);\n    XCTAssertTrue([array1[2] isEqual:@123]);\n    XCTAssertTrue([array1[3] isEqual:@456.789]);\n    XCTAssertTrue([[[NSString alloc] initWithData:(NSData *)array1[4] encoding:NSUTF8StringEncoding] isEqual:@\"hey\"]);\n    XCTAssertEqualWithAccuracy(((NSDate *)array1[5]).timeIntervalSince1970, d.timeIntervalSince1970, 1.0);\n    XCTAssertTrue([((StringObject *)array1[6]).stringCol isEqual:@\"hello\"]);\n    XCTAssertTrue([((RLMObjectId *)array1[7]) isEqual:oid]);\n    XCTAssertTrue([array1[8] isEqual:[RLMDecimal128 decimalWithNumber:@123.456]]);\n    \n    RLMArray *array2 = (RLMArray *)result.anyArray.lastObject;\n    XCTAssertTrue([array2[0] isEqual:@\"hello\"]);\n}\n\n#pragma mark - Add Managed Values\n\n- (void)testAddManagedObject {\n    StringObject *so = [[StringObject alloc] init];\n    so.stringCol = @\"hello\";\n    MixedObject *mo1 = [[MixedObject alloc] init];\n    mo1.anyCol = so;\n    [mo1.anyArray addObject:so];\n    \n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    [r addObject:so];\n    [r addObject:mo1];\n    [r commitWriteTransaction];\n    \n    XCTAssertNotNil(mo1.anyCol);\n    XCTAssertTrue([((StringObject *)mo1.anyCol).stringCol isEqualToString:so.stringCol]);\n    XCTAssertEqual(mo1.anyCol.rlm_anyValueType, RLMAnyValueTypeObject);\n}\n\n- (void)testAddManagedInt {\n    MixedObject *mo = [[MixedObject alloc] init];\n    mo.anyCol = @123456789;\n    [mo.anyArray addObjects:@[@123456, @67890]];\n    \n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    [r addObject:mo];\n    [r commitWriteTransaction];\n    \n    XCTAssertTrue([(NSNumber *)mo.anyCol isEqualToNumber:@123456789]);\n    XCTAssertTrue([mo.anyArray[0] isEqualToNumber:@123456]);\n    XCTAssertTrue([mo.anyArray[1] isEqualToNumber:@67890]);\n    XCTAssertEqual(mo.anyCol.rlm_anyValueType, RLMAnyValueTypeInt);\n}\n\n- (void)testAddManagedFloat {\n    MixedObject *mo = [[MixedObject alloc] init];\n    mo.anyCol = @1234.5f;\n    [mo.anyArray addObjects:@[@12345.6f, @678.9f]];\n    \n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    [r addObject:mo];\n    [r commitWriteTransaction];\n    XCTAssertTrue([(NSNumber *)mo.anyCol isEqualToNumber:@1234.5f]);\n    XCTAssertTrue([mo.anyArray[0] isEqualToNumber:[NSNumber numberWithFloat:12345.6f]]);\n    XCTAssertTrue([mo.anyArray[1] isEqualToNumber:[NSNumber numberWithFloat:678.9f]]);\n    XCTAssertEqual(mo.anyCol.rlm_anyValueType, RLMAnyValueTypeFloat);\n}\n\n- (void)testAddManagedString {\n    MixedObject *mo = [[MixedObject alloc] init];\n    mo.anyCol = @\"hello\";\n    [mo.anyArray addObjects:@[@\"over\", @\"there\"]];\n    \n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    [r addObject:mo];\n    [r commitWriteTransaction];\n    XCTAssertTrue([(NSString *)mo.anyCol isEqualToString:@\"hello\"]);\n    XCTAssertTrue([mo.anyArray[0] isEqualToString:@\"over\"]);\n    XCTAssertTrue([mo.anyArray[1] isEqualToString:@\"there\"]);\n    XCTAssertEqual(mo.anyCol.rlm_anyValueType, RLMAnyValueTypeString);\n}\n\n- (void)testAddManagedData {\n    NSData *d1 = [NSData dataWithBytes:\"hey\" length:3];\n    NSData *d2 = [NSData dataWithBytes:\"you\" length:3];\n    MixedObject *mo = [[MixedObject alloc] init];\n    mo.anyCol = d1;\n    [mo.anyArray addObjects:@[d1, d2]];\n    \n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    [r addObject:mo];\n    [r commitWriteTransaction];\n\n    XCTAssertTrue([[[NSString alloc] initWithData:(NSData *)mo.anyCol\n                                         encoding:NSUTF8StringEncoding] isEqualToString:@\"hey\"]);\n    XCTAssertTrue([[[NSString alloc] initWithData:mo.anyArray[0]\n                                         encoding:NSUTF8StringEncoding] isEqualToString:@\"hey\"]);\n    XCTAssertTrue([[[NSString alloc] initWithData:mo.anyArray[1]\n                                         encoding:NSUTF8StringEncoding] isEqualToString:@\"you\"]);\n    XCTAssertEqual(mo.anyCol.rlm_anyValueType, RLMAnyValueTypeData);\n}\n\n- (void)testAddManagedDate {\n    NSDate *d1 = [NSDate date];\n    NSDate *d2 = [NSDate date];\n    MixedObject *mo = [[MixedObject alloc] init];\n    mo.anyCol = d1;\n    [mo.anyArray addObjects:@[d1, d2]];\n    \n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    [r addObject:mo];\n    [r commitWriteTransaction];\n\n    // handle lossy margin of error.\n    XCTAssertEqualWithAccuracy(d1.timeIntervalSince1970, ((NSDate *)mo.anyCol).timeIntervalSince1970, 1.0);\n    XCTAssertEqualWithAccuracy(d1.timeIntervalSince1970, ((NSDate *)mo.anyArray[0]).timeIntervalSince1970, 1.0);\n    XCTAssertEqualWithAccuracy(d2.timeIntervalSince1970, ((NSDate *)mo.anyArray[1]).timeIntervalSince1970, 1.0);\n    XCTAssertEqual(mo.anyCol.rlm_anyValueType, RLMAnyValueTypeDate);\n}\n\n- (void)testAddManagedObjectId {\n    RLMObjectId *oid1 = [RLMObjectId objectId];\n    RLMObjectId *oid2 = [RLMObjectId objectId];\n    MixedObject *mo = [[MixedObject alloc] init];\n    mo.anyCol = oid1;\n    [mo.anyArray addObjects:@[oid1, oid2]];\n    \n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    [r addObject:mo];\n    [r commitWriteTransaction];\n\n    XCTAssertTrue([(RLMObjectId *)mo.anyCol isEqual:oid1]);\n    XCTAssertTrue([(RLMObjectId *)mo.anyArray[0] isEqual:oid1]);\n    XCTAssertTrue([(RLMObjectId *)mo.anyArray[1] isEqual:oid2]);\n    XCTAssertEqual(mo.anyCol.rlm_anyValueType, RLMAnyValueTypeObjectId);\n}\n\n- (void)testAddManagedDecimal128 {\n    RLMDecimal128 *d1 = [RLMDecimal128 decimalWithNumber:@123.456];\n    RLMDecimal128 *d2 = [RLMDecimal128 decimalWithNumber:@890.456];\n    MixedObject *mo = [[MixedObject alloc] init];\n    mo.anyCol = d1;\n    [mo.anyArray addObjects:@[d1, d2]];\n    \n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    [r addObject:mo];\n    [r commitWriteTransaction];\n\n    XCTAssertTrue([(RLMDecimal128 *)mo.anyCol isEqual:d1]);\n    XCTAssertTrue([(RLMDecimal128 *)mo.anyArray[0] isEqual:d1]);\n    XCTAssertTrue([(RLMDecimal128 *)mo.anyArray[1] isEqual:d2]);\n    XCTAssertEqual(mo.anyCol.rlm_anyValueType, RLMAnyValueTypeDecimal128);\n}\n\n- (void)testAddManagedDictionary {\n    StringObject *so = [[StringObject alloc] init];\n    so.stringCol = @\"hello\";\n    RLMObjectId *oid = [RLMObjectId objectId];\n    NSDate *d = [NSDate date];\n    NSDictionary *d1 = @{ @\"key2\" : @\"hello2\",\n                          @\"key3\" : @YES,\n                          @\"key4\" : @123,\n                          @\"key5\" : @456.789,\n                          @\"key6\" : [NSData dataWithBytes:\"hey\" length:3],\n                          @\"key7\" : d,\n                          @\"key8\" : so,\n                          @\"key9\" : oid,\n                          @\"key10\" : [RLMDecimal128 decimalWithNumber:@123.456] };\n    NSDictionary *d2 = @{ @\"key1\" : @\"hello\" };\n    MixedObject *mo = [[MixedObject alloc] init];\n    mo.anyCol = d1;\n    [mo.anyArray addObjects:@[d1, d2]];\n    \n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    [r addObject:mo];\n    [r commitWriteTransaction];\n    \n    XCTAssertEqual([MixedObject allObjectsInRealm:r].count, 1U);\n    MixedObject *result = [[MixedObject allObjectsInRealm:r] firstObject];\n    RLMDictionary *dictionary = (RLMDictionary *)result.anyCol;\n    XCTAssertTrue([dictionary[@\"key2\"] isEqual:@\"hello2\"]);\n    XCTAssertTrue([dictionary[@\"key3\"] isEqual:@YES]);\n    XCTAssertTrue([dictionary[@\"key4\"] isEqual:@123]);\n    XCTAssertTrue([dictionary[@\"key5\"] isEqual:@456.789]);\n    XCTAssertTrue([[[NSString alloc] initWithData:(NSData *)dictionary[@\"key6\"] encoding:NSUTF8StringEncoding] isEqual:@\"hey\"]);\n    XCTAssertEqualWithAccuracy(((NSDate *)dictionary[@\"key7\"]).timeIntervalSince1970, d.timeIntervalSince1970, 1.0);\n    XCTAssertTrue([((StringObject *)dictionary[@\"key8\"]).stringCol isEqual:@\"hello\"]);\n    XCTAssertTrue([((RLMObjectId *)dictionary[@\"key9\"]) isEqual:oid]);\n    XCTAssertTrue([dictionary[@\"key10\"] isEqual:[RLMDecimal128 decimalWithNumber:@123.456]]);\n    \n    RLMDictionary *dictionary1 = (RLMDictionary *)result.anyArray.firstObject;\n    XCTAssertTrue([dictionary1[@\"key2\"] isEqual:@\"hello2\"]);\n    XCTAssertTrue([dictionary1[@\"key3\"] isEqual:@YES]);\n    XCTAssertTrue([dictionary1[@\"key4\"] isEqual:@123]);\n    XCTAssertTrue([dictionary1[@\"key5\"] isEqual:@456.789]);\n    XCTAssertTrue([[[NSString alloc] initWithData:(NSData *)dictionary1[@\"key6\"] encoding:NSUTF8StringEncoding] isEqual:@\"hey\"]);\n    XCTAssertEqualWithAccuracy(((NSDate *)dictionary1[@\"key7\"]).timeIntervalSince1970, d.timeIntervalSince1970, 1.0);\n    XCTAssertTrue([((StringObject *)dictionary1[@\"key8\"]).stringCol isEqual:@\"hello\"]);\n    XCTAssertTrue([((RLMObjectId *)dictionary1[@\"key9\"]) isEqual:oid]);\n    XCTAssertTrue([dictionary1[@\"key10\"] isEqual:[RLMDecimal128 decimalWithNumber:@123.456]]);\n    \n    RLMDictionary *dictionary2 = (RLMDictionary *)result.anyArray.lastObject;\n    XCTAssertTrue([dictionary2[@\"key1\"] isEqual:@\"hello\"]);\n}\n\n- (void)testAddManagedArray {\n    RLMRealm *r = [self realmWithTestPath];\n    StringObject *so = [[StringObject alloc] init];\n    so.stringCol = @\"hello\";\n    RLMObjectId *oid = [RLMObjectId objectId];\n    NSDate *d = [NSDate date];\n    NSArray *d1 = @[ @\"hello2\",\n                     @YES,\n                     @123,\n                     @456.789,\n                     [NSData dataWithBytes:\"hey\" length:3],\n                     d,\n                     so,\n                     oid,\n                     [RLMDecimal128 decimalWithNumber:@123.456] ];\n    NSArray *d2 = @[@\"hello\"];\n    MixedObject *mo = [[MixedObject alloc] init];\n    mo.anyCol = d1;\n    [mo.anyArray addObjects:@[d1, d2]];\n    \n    [r beginWriteTransaction];\n    [r addObject:mo];\n    [r commitWriteTransaction];\n    \n    XCTAssertEqual([MixedObject allObjectsInRealm:r].count, 1U);\n    MixedObject *result = [[MixedObject allObjectsInRealm:r] firstObject];\n    RLMArray *array = ((RLMArray *)result.anyCol);\n    XCTAssertTrue([array[0] isEqual:@\"hello2\"]);\n    XCTAssertTrue([array[1] isEqual:@YES]);\n    XCTAssertTrue([array[2] isEqual:@123]);\n    XCTAssertTrue([array[3] isEqual:@456.789]);\n    XCTAssertTrue([[[NSString alloc] initWithData:(NSData *)array[4] encoding:NSUTF8StringEncoding] isEqual:@\"hey\"]);\n    XCTAssertEqualWithAccuracy(((NSDate *)array[5]).timeIntervalSince1970, d.timeIntervalSince1970, 1.0);\n    XCTAssertTrue([((StringObject *)array[6]).stringCol isEqual:@\"hello\"]);\n    XCTAssertTrue([((RLMObjectId *)array[7]) isEqual:oid]);\n    XCTAssertTrue([array[8] isEqual:[RLMDecimal128 decimalWithNumber:@123.456]]);\n    \n    RLMArray *array1 = (RLMArray *)result.anyArray.firstObject;\n    XCTAssertTrue([array1[0] isEqual:@\"hello2\"]);\n    XCTAssertTrue([array1[1] isEqual:@YES]);\n    XCTAssertTrue([array1[2] isEqual:@123]);\n    XCTAssertTrue([array1[3] isEqual:@456.789]);\n    XCTAssertTrue([[[NSString alloc] initWithData:(NSData *)array1[4] encoding:NSUTF8StringEncoding] isEqual:@\"hey\"]);\n    XCTAssertEqualWithAccuracy(((NSDate *)array1[5]).timeIntervalSince1970, d.timeIntervalSince1970, 1.0);\n    XCTAssertTrue([((StringObject *)array1[6]).stringCol isEqual:@\"hello\"]);\n    XCTAssertTrue([((RLMObjectId *)array1[7]) isEqual:oid]);\n    XCTAssertTrue([array1[8] isEqual:[RLMDecimal128 decimalWithNumber:@123.456]]);\n    \n    RLMArray *array2 = (RLMArray *)result.anyArray.lastObject;\n    XCTAssertTrue([array2[0] isEqual:@\"hello\"]);\n}\n\n- (void)testDeleteAndUpdateValuesInManagedDictionary {\n    RLMRealm *r = [self realmWithTestPath];\n    StringObject *so = [[StringObject alloc] init];\n    so.stringCol = @\"hello\";\n    NSDictionary *d1 = @{ @\"key2\" : @\"hello2\",\n                          @\"key3\" : @YES};\n    NSDictionary *d2 = @{ @\"key1\" : @\"hello\" };\n    MixedObject *mo = [[MixedObject alloc] init];\n    mo.anyCol = d1;\n    [mo.anyArray addObjects:@[d1, d2]];\n    \n    [r beginWriteTransaction];\n    [r addObject:mo];\n    [r commitWriteTransaction];\n    \n    RLMDictionary *dictionary = (RLMDictionary *)mo.anyCol;\n    XCTAssertTrue([dictionary[@\"key2\"] isEqual:@\"hello2\"]);\n    XCTAssertTrue([dictionary[@\"key3\"] isEqual:@YES]);\n    \n    RLMDictionary *dictionary2 = (RLMDictionary *)mo.anyArray.lastObject;\n    XCTAssertTrue([dictionary2[@\"key1\"] isEqual:@\"hello\"]);\n    \n    [r beginWriteTransaction];\n    dictionary[@\"key2\"] = @1234;\n    dictionary2[@\"key1\"] = @123.456;\n    [r commitWriteTransaction];\n    \n    XCTAssertTrue([dictionary[@\"key2\"] isEqual:@1234]);\n    XCTAssertTrue([dictionary2[@\"key1\"] isEqual:@123.456]);\n    \n    [r beginWriteTransaction];\n    [dictionary removeObjectForKey:@\"key3\"];\n    [dictionary2 removeObjectForKey:@\"key1\"];\n    [r commitWriteTransaction];\n    \n    XCTAssertNil(dictionary[@\"key3\"]);\n    XCTAssertNil(dictionary2[@\"key1\"]);\n}\n\n- (void)testDeleteAndUpdateValuesInArray {\n    NSArray *d1 = @[ @\"hello2\",\n                     @YES];\n    NSArray *d2 = @[@\"hello\"];\n    MixedObject *mo = [[MixedObject alloc] init];\n    mo.anyCol = d1;\n    [mo.anyArray addObjects:@[d1, d2]];\n    \n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    [r addObject:mo];\n    [r commitWriteTransaction];\n    \n    XCTAssertEqual([MixedObject allObjectsInRealm:r].count, 1U);\n    MixedObject *result = [[MixedObject allObjectsInRealm:r] firstObject];\n    RLMArray *array = (RLMArray *)result.anyCol;\n    XCTAssertTrue([array[0] isEqual:@\"hello2\"]);\n    XCTAssertTrue([array[1] isEqual:@YES]);\n    XCTAssertEqual(array.count, 2U);\n    \n    RLMArray *array2 = (RLMArray *)mo.anyArray.lastObject;\n    XCTAssertTrue([array2[0] isEqual:@\"hello\"]);\n    \n    [r beginWriteTransaction];\n    array[0] = @1234;\n    array2[0] = @123.456;\n    [r commitWriteTransaction];\n    \n    XCTAssertTrue([array[0] isEqual:@1234]);\n    XCTAssertTrue([array2[0] isEqual:@123.456]);\n    XCTAssertEqual(array.count, 2U);\n    XCTAssertEqual(array2.count, 1U);\n    \n    [r beginWriteTransaction];\n    [array removeObjectAtIndex:0];\n    [array2 removeObjectAtIndex:0];\n    [r commitWriteTransaction];\n    \n    XCTAssertFalse([array[0] isEqual:@1234]);\n    XCTAssertEqual(array.count, 1U);\n    XCTAssertEqual(array2.count, 0U);\n}\n\n#pragma mark - Dynamic Object Accessor\n\n- (void)testDynamicObjectAccessor {\n    @autoreleasepool {\n        RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n        configuration.objectClasses = @[MixedObject.class, StringObject.class];\n        configuration.fileURL = RLMTestRealmURL();\n        RLMRealm *r = [RLMRealm realmWithConfiguration:configuration error:nil];\n        [r transactionWithBlock:^{\n            StringObject *so = [StringObject new];\n            so.stringCol = @\"some string...\";\n            [MixedObject createInRealm:r withValue:@{@\"anyCol\": so}];\n        }];\n        XCTAssertEqual([StringObject allObjectsInRealm:r].count, 1U);\n    }\n\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.objectClasses = @[MixedObject.class];\n    configuration.fileURL = RLMTestRealmURL();\n    RLMRealm *r = [RLMRealm realmWithConfiguration:configuration error:nil];\n    for (RLMObjectSchema *os in r.schema.objectSchema) {\n        XCTAssertFalse([os.className isEqualToString:@\"StringObject\"]);\n    }\n    XCTAssertEqual([MixedObject allObjectsInRealm:r].count, 1U);\n    MixedObject *o = [MixedObject allObjectsInRealm:r][0];\n    XCTAssertTrue([o[@\"anyCol\"][@\"stringCol\"] isEqualToString:@\"some string...\"]);\n}\n\n// Tests that the `RLMSchemaInfo::clone` and `RLMSchemaInfo::operator[]` correctly\n// skip class names that are not present in the source schema. If such an event were\n// to occur an OOB exception would be thrown.\n- (void)testDynamicSchema {\n    @autoreleasepool {\n        RLMRealmConfiguration *config = [RLMRealmConfiguration new];\n        config.objectClasses = @[MixedObject.class, IntObject.class];\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n        [realm beginWriteTransaction];\n        [MixedObject createInRealm:realm withValue:@[[IntObject new]]];\n        [realm commitWriteTransaction];\n    }\n    RLMRealmConfiguration *config = [RLMRealmConfiguration new];\n    config.objectClasses = @[MixedObject.class];\n    XCTestExpectation *ex = [self expectationWithDescription:@\"\"];\n    __block RLMRealm *realm2;\n    dispatch_async(dispatch_get_global_queue(0, 0), ^{\n        @autoreleasepool {\n            RLMRealm *realm1 = [RLMRealm realmWithConfiguration:config error:nil];\n            (void)[[MixedObject allObjectsInRealm:realm1].firstObject anyCol];\n            dispatch_sync(dispatch_get_main_queue(), ^{\n                realm2 = [RLMRealm realmWithConfiguration:config error:nil];\n            });\n        }\n        [ex fulfill];\n    });\n    [self waitForExpectations:@[ex] timeout:1.0];\n    (void)[[MixedObject allObjectsInRealm:realm2].firstObject anyCol];\n}\n@end\n"
  },
  {
    "path": "Realm/Tests/RealmConfigurationTests.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#import \"TestUtils.h\"\n\n#import \"RLMRealmConfiguration_Private.hpp\"\n#import \"RLMTestObjects.h\"\n#import \"RLMUtil.hpp\"\n\n@interface RealmConfigurationTests : RLMTestCase\n@end\n\n@implementation RealmConfigurationTests\n\n#pragma mark - Setter Validation\n\n- (void)testSetPathAndInMemoryIdentifierAreMutuallyExclusive {\n    RLMRealmConfiguration *configuration = [[RLMRealmConfiguration alloc] init];\n\n    configuration.inMemoryIdentifier = @\"identifier\";\n    XCTAssertNil(configuration.fileURL);\n    XCTAssertEqualObjects(configuration.inMemoryIdentifier, @\"identifier\");\n\n    configuration.fileURL = [NSURL fileURLWithPath:@\"/dev/null\"];\n    XCTAssertNil(configuration.inMemoryIdentifier);\n    XCTAssertEqualObjects(configuration.fileURL.path, @\"/dev/null\");\n}\n\n- (void)testFileURLValidation {\n    RLMRealmConfiguration *configuration = [[RLMRealmConfiguration alloc] init];\n    XCTAssertThrows(configuration.fileURL = nil);\n}\n\n- (void)testEncryptionKeyValidation {\n    RLMRealmConfiguration *configuration = [[RLMRealmConfiguration alloc] init];\n    XCTAssertNoThrow(configuration.encryptionKey = nil);\n\n    RLMAssertThrowsWithReasonMatching(configuration.encryptionKey = [NSData data], @\"Encryption key must be exactly 64 bytes long\");\n\n    NSData *key = RLMGenerateKey();\n    configuration.encryptionKey = key;\n    XCTAssertEqualObjects(configuration.encryptionKey, key);\n}\n\n- (void)testSchemaVersionValidation {\n    RLMRealmConfiguration *configuration = [[RLMRealmConfiguration alloc] init];\n\n    RLMAssertThrowsWithReasonMatching(configuration.schemaVersion = RLMNotVersioned, @\"schema version.*RLMNotVersioned\");\n\n    configuration.schemaVersion = 1;\n    XCTAssertEqual(configuration.schemaVersion, 1U);\n\n    configuration.schemaVersion = std::numeric_limits<uint64_t>::max() - 1;\n    XCTAssertEqual(configuration.schemaVersion, std::numeric_limits<uint64_t>::max() - 1);\n}\n\n- (void)testClassSubsetsValidateLinks {\n    RLMRealmConfiguration *configuration = [[RLMRealmConfiguration alloc] init];\n\n    XCTAssertThrows(configuration.objectClasses = @[LinkStringObject.class]);\n    XCTAssertNoThrow(configuration.objectClasses = (@[LinkStringObject.class, StringObject.class]));\n\n    XCTAssertThrows(configuration.objectClasses = @[CompanyObject.class]);\n    XCTAssertNoThrow(configuration.objectClasses = (@[CompanyObject.class, EmployeeObject.class]));\n}\n\n- (void)testCannotSetMutuallyExclusiveProperties {\n    RLMRealmConfiguration *configuration = [[RLMRealmConfiguration alloc] init];\n    XCTAssertNoThrow(configuration.readOnly = YES);\n    XCTAssertNoThrow(configuration.deleteRealmIfMigrationNeeded = NO);\n    XCTAssertThrows(configuration.deleteRealmIfMigrationNeeded = YES);\n    XCTAssertNoThrow(configuration.readOnly = NO);\n    XCTAssertNoThrow(configuration.deleteRealmIfMigrationNeeded = YES);\n    XCTAssertNoThrow(configuration.readOnly = NO);\n    XCTAssertThrows(configuration.readOnly = YES);\n}\n\n- (void)testSchemaModeTransitions {\n    RLMRealmConfiguration *configuration = [[RLMRealmConfiguration alloc] init];\n    XCTAssertEqual(configuration.schemaMode, realm::SchemaMode::Automatic);\n\n    configuration.readOnly = true;\n    XCTAssertEqual(configuration.schemaMode, realm::SchemaMode::Immutable);\n\n    configuration.readOnly = false;\n    XCTAssertEqual(configuration.schemaMode, realm::SchemaMode::Automatic);\n    configuration.deleteRealmIfMigrationNeeded = true;\n    XCTAssertEqual(configuration.schemaMode, realm::SchemaMode::SoftResetFile);\n\n    configuration.deleteRealmIfMigrationNeeded = false;\n    XCTAssertEqual(configuration.schemaMode, realm::SchemaMode::Automatic);\n}\n\n#pragma mark - Default Configuration\n\n- (void)testDefaultConfiguration {\n    RLMRealmConfiguration *defaultConfiguration = [RLMRealmConfiguration defaultConfiguration];\n    XCTAssertEqualObjects(defaultConfiguration.fileURL, RLMDefaultRealmURL());\n    XCTAssertNil(defaultConfiguration.inMemoryIdentifier);\n    XCTAssertEqual(!!defaultConfiguration.encryptionKey, self.encryptTests);\n    XCTAssertFalse(defaultConfiguration.readOnly);\n    XCTAssertEqual(defaultConfiguration.schemaVersion, 0U);\n    XCTAssertNil(defaultConfiguration.migrationBlock);\n\n    // private properties\n    XCTAssertFalse(defaultConfiguration.dynamic);\n    XCTAssertNil(defaultConfiguration.customSchema);\n}\n\n- (void)testSetDefaultConfiguration {\n    RLMRealmConfiguration *configuration = [[RLMRealmConfiguration alloc] init];\n    configuration.fileURL = [NSURL fileURLWithPath:@\"/dev/null\"];\n    [RLMRealmConfiguration setDefaultConfiguration:configuration];\n    XCTAssertEqualObjects(RLMRealmConfiguration.defaultConfiguration.fileURL.path, @\"/dev/null\");\n}\n\n- (void)testDefaultConfigurationUsesValueSemantics {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.fileURL = [NSURL fileURLWithPath:@\"/dev/null\"];\n    XCTAssertNotEqualObjects(config.fileURL, RLMRealmConfiguration.defaultConfiguration.fileURL);\n\n    [RLMRealmConfiguration setDefaultConfiguration:config];\n    XCTAssertEqualObjects(config.fileURL, RLMRealmConfiguration.defaultConfiguration.fileURL);\n\n    config.fileURL = [NSURL fileURLWithPath:@\"/dev/null/foo\"];\n    XCTAssertNotEqualObjects(config.fileURL, RLMRealmConfiguration.defaultConfiguration.fileURL);\n}\n\n- (void)testDefaultRealmUsesDefaultConfiguration {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    @autoreleasepool { XCTAssertEqualObjects(RLMRealm.defaultRealm.configuration.fileURL, config.fileURL); }\n\n    config.fileURL = RLMTestRealmURL();\n    @autoreleasepool { XCTAssertNotEqualObjects(RLMRealm.defaultRealm.configuration.fileURL, config.fileURL); }\n    RLMRealmConfiguration.defaultConfiguration = config;\n    @autoreleasepool { XCTAssertEqualObjects(RLMRealm.defaultRealm.configuration.fileURL, config.fileURL); }\n\n    config.inMemoryIdentifier = NSUUID.UUID.UUIDString;\n    config.encryptionKey = nil;\n    RLMRealmConfiguration.defaultConfiguration = config;\n    @autoreleasepool {\n        RLMRealm *realm = RLMRealm.defaultRealm;\n        NSString *realmPath = @(realm.configuration.path.c_str());\n        XCTAssertTrue([realmPath hasSuffix:config.inMemoryIdentifier]);\n        XCTAssertTrue([realmPath hasPrefix:NSTemporaryDirectory()]);\n    }\n\n    config.schemaVersion = 1;\n    RLMRealmConfiguration.defaultConfiguration = config;\n    @autoreleasepool {\n        RLMRealm *realm = RLMRealm.defaultRealm;\n        NSString *realmPath = @(realm.configuration.path.c_str());\n        XCTAssertEqual(1U, [RLMRealm schemaVersionAtURL:[NSURL fileURLWithPath:realmPath] encryptionKey:nil error:nil]);\n    }\n\n    config.fileURL = RLMDefaultRealmURL();\n    RLMRealmConfiguration.defaultConfiguration = config;\n\n    config.encryptionKey = RLMGenerateKey();\n    RLMRealmConfiguration.defaultConfiguration = config;\n    @autoreleasepool {\n        // Realm with no encryption key already exists from above\n        XCTAssertThrows([RLMRealm defaultRealm]);\n    }\n\n    [self deleteRealmFileAtURL:config.fileURL];\n    // Create and then re-open with same key\n    @autoreleasepool { XCTAssertNoThrow([RLMRealm defaultRealm]); }\n    @autoreleasepool { XCTAssertNoThrow([RLMRealm defaultRealm]); }\n\n    // Fail to re-open with a different key\n    config.encryptionKey = RLMGenerateKey();\n    RLMRealmConfiguration.defaultConfiguration = config;\n    @autoreleasepool { XCTAssertThrows([RLMRealm defaultRealm]); }\n\n    // Verify that the default realm's migration block is used implicitly\n    // when needed\n    [self deleteRealmFileAtURL:config.fileURL];\n    @autoreleasepool { XCTAssertNoThrow([RLMRealm defaultRealm]); }\n\n    config.schemaVersion = 2;\n    __block bool migrationCalled = false;\n    config.migrationBlock = ^(RLMMigration *, uint64_t) {\n        migrationCalled = true;\n    };\n    RLMRealmConfiguration.defaultConfiguration = config;\n\n    XCTAssertFalse(migrationCalled);\n    @autoreleasepool { XCTAssertNoThrow([RLMRealm defaultRealm]); }\n    XCTAssertTrue(migrationCalled);\n}\n\n-(void)testCopyConfiguration {\n    RLMRealmConfiguration *configuration = [[RLMRealmConfiguration alloc] init];\n    configuration.fileURL = [NSURL fileURLWithPath:@\"/dev/null\"];\n    configuration.seedFilePath = [NSURL fileURLWithPath:@\"/dev/null/seed\"];\n\n    RLMRealmConfiguration *copy = [configuration copy];\n    XCTAssertEqualObjects(copy.fileURL, [NSURL fileURLWithPath:@\"/dev/null\"]);\n    XCTAssertEqualObjects(copy.seedFilePath, [NSURL fileURLWithPath:@\"/dev/null/seed\"]);\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/RealmTests-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundlePackageType</key>\n\t<string>BNDL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Realm/Tests/RealmTests.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMRealmConfiguration_Private.hpp\"\n#import \"RLMRealmUtil.hpp\"\n#import \"RLMRealm_Dynamic.h\"\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMSchema_Private.h\"\n#import \"RLMLogger_Private.h\"\n\n#import <mach/mach_init.h>\n#import <mach/vm_map.h>\n#import <sys/resource.h>\n#import <thread>\n#import <unordered_set>\n\n#import <realm/util/file.hpp>\n#import <realm/db_options.hpp>\n\n#if !defined(REALM_COCOA_VERSION)\n#import \"RLMVersion.h\"\n#endif\n\n@interface RLMObjectSchema (Private)\n+ (instancetype)schemaForObjectClass:(Class)objectClass;\n\n@property (nonatomic, readwrite, assign) Class objectClass;\n@end\n\n@interface RLMSchema (Private)\n@property (nonatomic, readwrite, copy) NSArray *objectSchema;\n@end\n\n@interface RealmTests : RLMTestCase\n@end\n\n@implementation RealmTests\n\n- (void)deleteFiles {\n    [super deleteFiles];\n\n    for (NSString *realmPath in self.pathsFor100Realms) {\n        [self deleteRealmFileAtURL:[NSURL fileURLWithPath:realmPath]];\n    }\n}\n\n#pragma mark - Opening Realms\n\n- (void)testOpeningInvalidPathThrows {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.fileURL = [NSURL fileURLWithPath:@\"/dev/null/foo\"];\n    RLMAssertRealmException([RLMRealm realmWithConfiguration:config error:nil],\n                            RLMErrorFileOperationFailed,\n                            @\"Failed to open file at path '%@': parent path is not a directory\",\n                            [config.fileURL.path stringByAppendingString:@\".lock\"]);\n}\n\n- (void)testPathCannotBeBothInMemoryAndRegularDurability {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.inMemoryIdentifier = @\"identifier\";\n    config.encryptionKey = nil;\n    RLMRealm *inMemoryRealm = [RLMRealm realmWithConfiguration:config error:nil];\n\n    // make sure we can't open disk-realm at same path\n    config.fileURL = [NSURL fileURLWithPath:@(inMemoryRealm.configuration.path.c_str())];\n    NSError *error; // passing in a reference to assert that this error can't be caught!\n    RLMAssertThrowsWithReason([RLMRealm realmWithConfiguration:config error:&error],\n                              ([NSString stringWithFormat:@\"Realm at path '%@' already opened with different inMemory settings\", config.fileURL.path]));\n}\n\n- (void)testRealmWithPathUsesDefaultConfiguration {\n    RLMRealmConfiguration *originalDefaultConfiguration = [RLMRealmConfiguration defaultConfiguration];\n    RLMRealmConfiguration *newDefaultConfiguration = [originalDefaultConfiguration copy];\n    newDefaultConfiguration.objectClasses = @[];\n    [RLMRealmConfiguration setDefaultConfiguration:newDefaultConfiguration];\n    XCTAssertEqual([[[[RLMRealm realmWithURL:RLMTestRealmURL()] configuration] objectClasses] count], 0U);\n    [RLMRealmConfiguration setDefaultConfiguration:originalDefaultConfiguration];\n}\n\n- (void)testReadOnlyFile {\n    @autoreleasepool {\n        RLMRealm *realm = self.realmWithTestPath;\n        [realm beginWriteTransaction];\n        [StringObject createInRealm:realm withValue:@[@\"a\"]];\n        [realm commitWriteTransaction];\n    }\n\n    [NSFileManager.defaultManager setAttributes:@{NSFileImmutable: @YES}\n                                   ofItemAtPath:RLMTestRealmURL().path error:nil];\n\n    // Should not be able to open read-write\n    RLMAssertRealmException([self realmWithTestPath],\n                            RLMErrorFilePermissionDenied,\n                            @\"Failed to open Realm file at path '%@': Operation not permitted. Please use a path where your app has read-write permissions.\",\n                            RLMTestRealmURL().path);\n\n    RLMRealm *realm;\n    XCTAssertNoThrow(realm = [self readOnlyRealmWithURL:RLMTestRealmURL() error:nil]);\n    XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n\n    [NSFileManager.defaultManager setAttributes:@{NSFileImmutable: @NO}\n                                   ofItemAtPath:RLMTestRealmURL().path error:nil];\n}\n\n- (void)testReadOnlyFileInImmutableDirectory {\n    @autoreleasepool {\n        RLMRealm *realm = self.realmWithTestPath;\n        [realm beginWriteTransaction];\n        [StringObject createInRealm:realm withValue:@[@\"a\"]];\n        [realm commitWriteTransaction];\n    }\n\n    // Delete '*.lock' and '.note' files to simulate opening Realm in an app bundle\n    [[NSFileManager defaultManager] removeItemAtURL:[RLMTestRealmURL() URLByAppendingPathExtension:@\"lock\"] error:nil];\n    [[NSFileManager defaultManager] removeItemAtURL:[RLMTestRealmURL() URLByAppendingPathExtension:@\"note\"] error:nil];\n\n    // Make parent directory immutable to simulate opening Realm in an app bundle\n    NSURL *parentDirectoryOfTestRealmURL = [RLMTestRealmURL() URLByDeletingLastPathComponent];\n    [NSFileManager.defaultManager setAttributes:@{NSFileImmutable: @YES}\n                                   ofItemAtPath:parentDirectoryOfTestRealmURL.path error:nil];\n\n    RLMRealm *realm;\n    // Read-only Realm should be opened even in immutable directory\n    XCTAssertNoThrow(realm = [self readOnlyRealmWithURL:RLMTestRealmURL() error:nil]);\n\n    [self dispatchAsyncAndWait:^{ XCTAssertNoThrow([self readOnlyRealmWithURL:RLMTestRealmURL() error:nil]); }];\n\n    [NSFileManager.defaultManager setAttributes:@{NSFileImmutable: @NO}\n                                   ofItemAtPath:parentDirectoryOfTestRealmURL.path error:nil];\n}\n\n- (void)testReadOnlyRealmMustExist {\n    RLMAssertRealmException([self readOnlyRealmWithURL:RLMTestRealmURL() error:nil],\n                            RLMErrorFileNotFound,\n                            @\"Failed to open Realm file at path '%@': No such file or directory\",\n                            RLMTestRealmURL().path);\n}\n\n- (void)testCannotHaveReadOnlyAndReadWriteRealmsAtSamePathAtSameTime {\n    NSString *exceptionReason = @\"Realm at path '.*' already opened with different read permissions\";\n    @autoreleasepool {\n        RLMRealm *realm = self.realmWithTestPath;\n        RLMAssertThrowsWithReasonMatching([self readOnlyRealmWithURL:RLMTestRealmURL() error:nil], exceptionReason);\n    }\n\n    @autoreleasepool {\n        RLMRealm *realm = [self readOnlyRealmWithURL:RLMTestRealmURL() error:nil];\n        RLMAssertThrowsWithReasonMatching([self realmWithTestPath], exceptionReason);\n    }\n\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = [self readOnlyRealmWithURL:RLMTestRealmURL() error:nil];\n        RLMAssertThrowsWithReasonMatching([self realmWithTestPath], exceptionReason);\n    }];\n}\n\n- (void)testCanOpenReadOnlyOnMulitpleThreadsAtOnce {\n    @autoreleasepool {\n        RLMRealm *realm = self.realmWithTestPath;\n        [realm beginWriteTransaction];\n        [StringObject createInRealm:realm withValue:@[@\"a\"]];\n        [realm commitWriteTransaction];\n    }\n\n    RLMRealm *realm = [self readOnlyRealmWithURL:RLMTestRealmURL() error:nil];\n    XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = [self readOnlyRealmWithURL:RLMTestRealmURL() error:nil];\n        XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n    }];\n\n    // Verify that closing the other RLMRealm didn't manage to break anything\n    XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n}\n\n- (void)testFilePermissionDenied {\n    @autoreleasepool {\n        XCTAssertNoThrow([self realmWithTestPath]);\n    }\n\n    // Make Realm at test path temporarily unreadable\n    NSError *error;\n    NSNumber *permissions = [NSFileManager.defaultManager attributesOfItemAtPath:RLMTestRealmURL().path error:&error][NSFilePosixPermissions];\n    assert(!error);\n    [NSFileManager.defaultManager setAttributes:@{NSFilePosixPermissions: @(0000)}\n                                   ofItemAtPath:RLMTestRealmURL().path error:&error];\n    assert(!error);\n\n    RLMAssertRealmException([self realmWithTestPath],\n                            RLMErrorFilePermissionDenied,\n                            @\"Failed to open Realm file at path '%@': Permission denied. Please use a path where your app has read-write permissions.\",\n                            RLMTestRealmURL().path);\n    RLMAssertRealmException([self readOnlyRealmWithURL:RLMTestRealmURL() error:nil],\n                            RLMErrorFilePermissionDenied,\n                            @\"Failed to open Realm file at path '%@': Permission denied. Please use a path where your app has read permissions.\",\n                            RLMTestRealmURL().path);\n\n    [NSFileManager.defaultManager setAttributes:@{NSFilePosixPermissions: permissions}\n                                   ofItemAtPath:RLMTestRealmURL().path error:&error];\n    assert(!error);\n}\n\n#ifndef SWIFT_PACKAGE\n\n// Check that the data for file was left unchanged when opened with upgrading\n// disabled, but allow expanding the file to the page size\n#define AssertFileUnmodified(oldURL, newURL) do { \\\n    NSData *oldData = [NSData dataWithContentsOfURL:oldURL]; \\\n    NSData *newData = [NSData dataWithContentsOfURL:newURL]; \\\n    if (oldData.length != newData.length && oldData.length < realm::util::page_size()) { \\\n        XCTAssertEqual(newData.length, realm::util::page_size()); \\\n        XCTAssertEqualObjects(oldData, ([newData subdataWithRange:{0, oldData.length}])); \\\n    } \\\n    else \\\n        XCTAssertEqualObjects(oldData, newData); \\\n} while (0)\n\n- (void)testFileFormatUpgradeRequiredDeleteRealmIfNeeded {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration new];\n    config.deleteRealmIfMigrationNeeded = YES;\n\n    NSURL *bundledRealmURL = [[NSBundle bundleForClass:[RealmTests class]] URLForResource:@\"file-format-version-21\" withExtension:@\"realm\"];\n    [NSFileManager.defaultManager copyItemAtURL:bundledRealmURL toURL:config.fileURL error:nil];\n\n    @autoreleasepool {\n        XCTAssertTrue([[RLMRealm realmWithConfiguration:config error:nil] isEmpty]);\n    }\n}\n\n- (void)testFileFormatUpgradeRequiredButDisabled {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration new];\n    config.disableFormatUpgrade = true;\n\n    NSURL *bundledRealmURL = [[NSBundle bundleForClass:[RealmTests class]] URLForResource:@\"file-format-version-21\" withExtension:@\"realm\"];\n    [NSFileManager.defaultManager copyItemAtURL:bundledRealmURL toURL:config.fileURL error:nil];\n\n    RLMAssertThrowsWithCodeMatching([RLMRealm realmWithConfiguration:config error:nil],\n                                    RLMErrorFileFormatUpgradeRequired);\n    AssertFileUnmodified(bundledRealmURL, config.fileURL);\n}\n\n- (void)testFileFormatUpgradeRequiredButReadOnly {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration new];\n    config.readOnly = true;\n\n    NSURL *bundledRealmURL = [[NSBundle bundleForClass:[RealmTests class]] URLForResource:@\"file-format-version-10\" withExtension:@\"realm\"];\n    [NSFileManager.defaultManager copyItemAtURL:bundledRealmURL toURL:config.fileURL error:nil];\n\n    RLMAssertRealmException([RLMRealm realmWithConfiguration:config error:nil], RLMErrorFileFormatUpgradeRequired,\n                            @\"Realm file at path '%@' cannot be opened in read-only mode because it has a file format version (10) which requires an upgrade\",\n                            config.fileURL.path);\n    XCTAssertEqualObjects([NSData dataWithContentsOfURL:bundledRealmURL],\n                          [NSData dataWithContentsOfURL:config.fileURL]);\n}\n\n- (void)testUnsupportedFileFormatVersion {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration new];\n    NSURL *bundledRealmURL = [[NSBundle bundleForClass:[RealmTests class]] URLForResource:@\"fileformat-pre-null\" withExtension:@\"realm\"];\n    [NSFileManager.defaultManager copyItemAtURL:bundledRealmURL toURL:config.fileURL error:nil];\n\n    RLMAssertThrowsWithCodeMatching([RLMRealm realmWithConfiguration:config error:nil], RLMErrorUnsupportedFileFormatVersion);\n    AssertFileUnmodified(bundledRealmURL, config.fileURL);\n}\n\n#endif // SWIFT_PACKAGE\n\n#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST && (!TARGET_OS_SIMULATOR || !TARGET_RT_64_BIT)\n- (void)testExceedingVirtualAddressSpace {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n\n    const NSUInteger stringLength = 1024 * 1024;\n    void *mem = calloc(stringLength, '1');\n    NSString *largeString = [[NSString alloc] initWithBytesNoCopy:mem\n                                                           length:stringLength\n                                                         encoding:NSUTF8StringEncoding\n                                                     freeWhenDone:YES];\n\n    @autoreleasepool {\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n        [realm beginWriteTransaction];\n        StringObject *stringObj = [StringObject new];\n        stringObj.stringCol = largeString;\n        [realm addObject:stringObj];\n        [realm commitWriteTransaction];\n    }\n\n    struct VirtualMemoryChunk {\n        vm_address_t address;\n        vm_size_t size;\n    };\n\n    std::vector<VirtualMemoryChunk> allocatedChunks;\n    NSUInteger size = 1024 * 1024 * 1024;\n    while (size >= stringLength) {\n        VirtualMemoryChunk chunk { .size = size };\n        kern_return_t ret = vm_allocate(mach_task_self(), &chunk.address, chunk.size,\n                                        VM_FLAGS_ANYWHERE);\n        if (ret == KERN_NO_SPACE) {\n            size /= 2;\n        } else {\n            allocatedChunks.push_back(chunk);\n        }\n    }\n\n    @autoreleasepool {\n        RLMAssertThrowsWithCodeMatching([RLMRealm realmWithConfiguration:config error:nil], RLMErrorAddressSpaceExhausted);\n    }\n\n    for (auto chunk : allocatedChunks) {\n        kern_return_t ret = vm_deallocate(mach_task_self(), chunk.address, chunk.size);\n        assert(ret == KERN_SUCCESS);\n    }\n\n    @autoreleasepool {\n        XCTAssertNoThrow([RLMRealm realmWithConfiguration:config error:nil]);\n    }\n}\n#endif\n\n- (void)testOpenAsync {\n    // Locals\n    RLMRealmConfiguration *c = [RLMRealmConfiguration defaultConfiguration];\n    XCTestExpectation *ex = [self expectationWithDescription:@\"open-async\"];\n\n    // Helpers\n    auto assertNoCachedRealm = ^{ XCTAssertNil(RLMGetAnyCachedRealmForPath(c.pathOnDisk.UTF8String)); };\n    auto fileExists = ^BOOL() {\n        return [[NSFileManager defaultManager] fileExistsAtPath:c.pathOnDisk isDirectory:nil];\n    };\n\n    // Unsuccessful open\n    c.readOnly = true;\n    [RLMRealm asyncOpenWithConfiguration:c\n                           callbackQueue:dispatch_get_main_queue()\n                                callback:^(RLMRealm * _Nullable realm, NSError * _Nullable error) {\n        XCTAssertEqual(error.code, RLMErrorFileNotFound);\n        XCTAssertNil(realm);\n        [ex fulfill];\n    }];\n    XCTAssertFalse(fileExists());\n    assertNoCachedRealm();\n    [self waitForExpectationsWithTimeout:5 handler:nil];\n    XCTAssertFalse(fileExists());\n    assertNoCachedRealm();\n\n    // Successful open\n    c.readOnly = false;\n    ex = [self expectationWithDescription:@\"open-async\"];\n\n    // Hold exclusive lock on lock file to prevent Realm from being created\n    // if the dispatch_async happens too quickly\n    NSString *lockFilePath = [c.pathOnDisk stringByAppendingString:@\".lock\"];\n    [[NSFileManager defaultManager] createFileAtPath:lockFilePath contents:[NSData data] attributes:nil];\n    int fd = open(lockFilePath.UTF8String, O_RDWR);\n    XCTAssertNotEqual(-1, fd);\n    int ret = flock(fd, LOCK_SH);\n    XCTAssertEqual(0, ret);\n\n    [RLMRealm asyncOpenWithConfiguration:c\n                           callbackQueue:dispatch_get_main_queue()\n                                callback:^(RLMRealm * _Nullable realm, NSError * _Nullable error) {\n        XCTAssertNil(error);\n        XCTAssertNotNil(realm);\n        [ex fulfill];\n    }];\n    XCTAssertFalse(fileExists());\n    flock(fd, LOCK_UN);\n    close(fd);\n    assertNoCachedRealm();\n    [self waitForExpectationsWithTimeout:1 handler:nil];\n    XCTAssertTrue(fileExists());\n    assertNoCachedRealm();\n}\n\n#pragma mark - Adding and Removing Objects\n\n- (void)testRealmAddAndRemoveObjects {\n    RLMRealm *realm = [self realmWithTestPath];\n    [realm beginWriteTransaction];\n    [StringObject createInRealm:realm withValue:@[@\"a\"]];\n    [StringObject createInRealm:realm withValue:@[@\"b\"]];\n    [StringObject createInRealm:realm withValue:@[@\"c\"]];\n    XCTAssertEqual([StringObject objectsInRealm:realm withPredicate:nil].count, 3U, @\"Expecting 3 objects\");\n    [realm commitWriteTransaction];\n\n    // test again after write transaction\n    RLMResults *objects = [StringObject allObjectsInRealm:realm];\n    XCTAssertEqual(objects.count, 3U, @\"Expecting 3 objects\");\n    XCTAssertEqualObjects([objects.firstObject stringCol], @\"a\", @\"Expecting column to be 'a'\");\n\n    [realm beginWriteTransaction];\n    [realm deleteObject:objects[2]];\n    [realm deleteObject:objects[0]];\n    XCTAssertEqual([StringObject objectsInRealm:realm withPredicate:nil].count, 1U, @\"Expecting 1 object\");\n    [realm commitWriteTransaction];\n\n    objects = [StringObject allObjectsInRealm:realm];\n    XCTAssertEqual(objects.count, 1U, @\"Expecting 1 object\");\n    XCTAssertEqualObjects([objects.firstObject stringCol], @\"b\", @\"Expecting column to be 'b'\");\n}\n\n- (void)testRemoveUnmanagedObject {\n    RLMRealm *realm = [self realmWithTestPath];\n    StringObject *obj = [[StringObject alloc] initWithValue:@[@\"a\"]];\n\n    [realm beginWriteTransaction];\n    XCTAssertThrows([realm deleteObject:obj]);\n    obj = [StringObject createInRealm:realm withValue:@[@\"b\"]];\n    [realm commitWriteTransaction];\n\n    [self waitForNotification:RLMRealmDidChangeNotification realm:realm block:^{\n        RLMRealm *realm = [self realmWithTestPath];\n        RLMObject *obj = [[StringObject allObjectsInRealm:realm] firstObject];\n        [realm beginWriteTransaction];\n        [realm deleteObject:obj];\n        XCTAssertThrows([realm deleteObject:obj]);\n        [realm commitWriteTransaction];\n    }];\n\n    [realm beginWriteTransaction];\n    [realm deleteObject:obj];\n    [realm commitWriteTransaction];\n}\n\n- (void)testRealmBatchRemoveObjects {\n    RLMRealm *realm = [self realmWithTestPath];\n    [realm beginWriteTransaction];\n    StringObject *strObj = [StringObject createInRealm:realm withValue:@[@\"a\"]];\n    [StringObject createInRealm:realm withValue:@[@\"b\"]];\n    [StringObject createInRealm:realm withValue:@[@\"c\"]];\n    [realm commitWriteTransaction];\n\n    // delete objects\n    RLMResults *objects = [StringObject allObjectsInRealm:realm];\n    XCTAssertEqual(objects.count, 3U);\n    [realm beginWriteTransaction];\n    [realm deleteObjects:[StringObject objectsInRealm:realm where:@\"stringCol != 'a'\"]];\n    XCTAssertEqual([[StringObject allObjectsInRealm:realm] count], 1U);\n    [realm deleteObjects:objects];\n    XCTAssertEqual([[StringObject allObjectsInRealm:realm] count], 0U);\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual([[StringObject allObjectsInRealm:realm] count], 0U);\n    RLMAssertThrowsWithReason(strObj.stringCol, @\"invalidated\");\n\n    // add objects to collections\n    [realm beginWriteTransaction];\n    ArrayPropertyObject *arrayObj = [ArrayPropertyObject createInRealm:realm withValue:@[@\"name\", @[@[@\"a\"], @[@\"b\"], @[@\"c\"]], @[]]];\n    SetPropertyObject *setObj = [SetPropertyObject createInRealm:realm withValue:@[@\"name\", @[@[@\"d\"], @[@\"e\"], @[@\"f\"]], @[]]];\n    DictionaryPropertyObject *dictObj = [DictionaryPropertyObject createInRealm:realm withValue:@{@\"stringDictionary\": @{@\"a\": @[@\"b\"]}}];\n    [StringObject createInRealm:realm withValue:@[@\"g\"]];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual([[StringObject allObjectsInRealm:realm] count], 8U);\n\n    // delete via collections\n    [realm beginWriteTransaction];\n    [realm deleteObjects:arrayObj.array];\n    [realm deleteObjects:setObj.set];\n    [realm deleteObjects:dictObj.stringDictionary];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual([[StringObject allObjectsInRealm:realm] count], 1U);\n    XCTAssertEqual(arrayObj.array.count, 0U);\n    XCTAssertEqual(setObj.set.count, 0U);\n    XCTAssertEqual(dictObj.stringDictionary.count, 0U);\n\n    // remove NSArray\n    NSArray *arrayOfLastObject = @[[[StringObject allObjectsInRealm:realm] lastObject]];\n    [realm beginWriteTransaction];\n    [realm deleteObjects:arrayOfLastObject];\n    [realm commitWriteTransaction];\n    XCTAssertEqual(objects.count, 0U);\n\n    // add objects to collections\n    [realm beginWriteTransaction];\n    [arrayObj.array addObject:[StringObject createInRealm:realm withValue:@[@\"a\"]]];\n    [arrayObj.array addObject:[[StringObject alloc] initWithValue:@[@\"b\"]]];\n    [setObj.set addObject:[StringObject createInRealm:realm withValue:@[@\"c\"]]];\n    [setObj.set addObject:[[StringObject alloc] initWithValue:@[@\"d\"]]];\n    dictObj.stringDictionary[@\"b\"] = [[StringObject alloc] initWithValue:@[@\"e\"]];\n    [realm commitWriteTransaction];\n\n    // remove objects from realm\n    XCTAssertEqual(arrayObj.array.count, 2U);\n    XCTAssertEqual(setObj.set.count, 2U);\n    XCTAssertEqual(dictObj.stringDictionary.count, 1U);\n    [realm beginWriteTransaction];\n    [realm deleteObjects:[StringObject allObjectsInRealm:realm]];\n    [realm commitWriteTransaction];\n    XCTAssertEqual(arrayObj.array.count, 0U);\n    XCTAssertEqual(setObj.set.count, 0U);\n    // deleting the target objects in a dictionary sets them to null rather than\n    // removing the entries\n    XCTAssertEqual(dictObj.stringDictionary.count, 1U);\n    XCTAssertEqual((id)dictObj.stringDictionary[@\"b\"], NSNull.null);\n}\n\n- (void)testAddManagedObjectToOtherRealm {\n    RLMRealm *realm1 = [self realmWithTestPath];\n    RLMRealm *realm2 = [RLMRealm defaultRealm];\n\n    CircleObject *co1 = [[CircleObject alloc] init];\n    co1.data = @\"1\";\n\n    CircleObject *co2 = [[CircleObject alloc] init];\n    co2.data = @\"2\";\n    co2.next = co1;\n\n    CircleArrayObject *cao = [[CircleArrayObject alloc] init];\n    [cao.circles addObject:co1];\n\n    [realm1 transactionWithBlock:^{ [realm1 addObject:co1]; }];\n\n    [realm2 beginWriteTransaction];\n    XCTAssertThrows([realm2 addObject:co1], @\"should reject already-managed object\");\n    XCTAssertThrows([realm2 addObject:co2], @\"should reject linked managed object\");\n    XCTAssertThrows([realm2 addObject:cao], @\"should reject array containing managed object\");\n    [realm2 commitWriteTransaction];\n\n    // The objects are left in an odd state if validation fails (since the\n    // exception isn't supposed to be recoverable), so make new objects\n    co2 = [[CircleObject alloc] init];\n    co2.data = @\"2\";\n    co2.next = co1;\n\n    cao = [[CircleArrayObject alloc] init];\n    [cao.circles addObject:co1];\n\n    [realm1 beginWriteTransaction];\n    XCTAssertNoThrow([realm1 addObject:co2],\n                     @\"should be able to add object which links to object managed by target Realm\");\n    XCTAssertNoThrow([realm1 addObject:cao],\n                     @\"should be able to add object with an array containing an object managed by target Realm\");\n    [realm1 commitWriteTransaction];\n}\n\n- (void)testCopyObjectsBetweenRealms {\n    RLMRealm *realm1 = [self realmWithTestPath];\n    RLMRealm *realm2 = [RLMRealm defaultRealm];\n\n    StringObject *so = [[StringObject alloc] init];\n    so.stringCol = @\"value\";\n\n    [realm1 beginWriteTransaction];\n    [realm1 addObject:so];\n    [realm1 commitWriteTransaction];\n\n    XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm1].count);\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm2].count);\n    XCTAssertEqualObjects(so.stringCol, @\"value\");\n\n    [realm2 beginWriteTransaction];\n    StringObject *so2 = [StringObject createInRealm:realm2 withValue:so];\n    [realm2 commitWriteTransaction];\n\n    XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm1].count);\n    XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm2].count);\n    XCTAssertEqualObjects(so2.stringCol, @\"value\");\n}\n\n- (void)testCopyArrayPropertyBetweenRealms {\n    RLMRealm *realm1 = [self realmWithTestPath];\n    RLMRealm *realm2 = [RLMRealm defaultRealm];\n\n    EmployeeObject *eo = [[EmployeeObject alloc] init];\n    eo.name = @\"name\";\n    eo.age = 50;\n    eo.hired = YES;\n\n    CompanyObject *co = [[CompanyObject alloc] init];\n    co.name = @\"company name\";\n    [co.employees addObject:eo];\n\n    [realm1 beginWriteTransaction];\n    [realm1 addObject:co];\n    [realm1 commitWriteTransaction];\n\n    XCTAssertEqual(1U, [EmployeeObject allObjectsInRealm:realm1].count);\n    XCTAssertEqual(1U, [CompanyObject allObjectsInRealm:realm1].count);\n\n    [realm2 beginWriteTransaction];\n    CompanyObject *co2 = [CompanyObject createInRealm:realm2 withValue:co];\n    [realm2 commitWriteTransaction];\n\n    XCTAssertEqual(1U, [EmployeeObject allObjectsInRealm:realm1].count);\n    XCTAssertEqual(1U, [CompanyObject allObjectsInRealm:realm1].count);\n    XCTAssertEqual(1U, [EmployeeObject allObjectsInRealm:realm2].count);\n    XCTAssertEqual(1U, [CompanyObject allObjectsInRealm:realm2].count);\n\n    XCTAssertEqualObjects(@\"name\", [co2.employees.firstObject name]);\n}\n\n- (void)testCopyLinksBetweenRealms {\n    RLMRealm *realm1 = [self realmWithTestPath];\n    RLMRealm *realm2 = [RLMRealm defaultRealm];\n\n    CircleObject *c = [[CircleObject alloc] init];\n    c.data = @\"1\";\n    c.next = [[CircleObject alloc] init];\n    c.next.data = @\"2\";\n\n    [realm1 beginWriteTransaction];\n    [realm1 addObject:c];\n    [realm1 commitWriteTransaction];\n\n    XCTAssertEqual(realm1, c.realm);\n    XCTAssertEqual(realm1, c.next.realm);\n    XCTAssertEqual(2U, [CircleObject allObjectsInRealm:realm1].count);\n\n    [realm2 beginWriteTransaction];\n    CircleObject *c2 = [CircleObject createInRealm:realm2 withValue:c];\n    [realm2 commitWriteTransaction];\n\n    XCTAssertEqualObjects(c2.data, @\"1\");\n    XCTAssertEqualObjects(c2.next.data, @\"2\");\n\n    XCTAssertEqual(2U, [CircleObject allObjectsInRealm:realm1].count);\n    XCTAssertEqual(2U, [CircleObject allObjectsInRealm:realm2].count);\n}\n\n- (void)testCopyObjectsInArrayLiteral {\n    RLMRealm *realm1 = [self realmWithTestPath];\n    RLMRealm *realm2 = [RLMRealm defaultRealm];\n\n    CircleObject *c = [[CircleObject alloc] init];\n    c.data = @\"1\";\n\n    [realm1 beginWriteTransaction];\n    [realm1 addObject:c];\n    [realm1 commitWriteTransaction];\n\n    [realm2 beginWriteTransaction];\n    CircleObject *c2 = [CircleObject createInRealm:realm2 withValue:@[@\"3\", @[@\"2\", c]]];\n    [realm2 commitWriteTransaction];\n\n    XCTAssertEqual(1U, [CircleObject allObjectsInRealm:realm1].count);\n    XCTAssertEqual(3U, [CircleObject allObjectsInRealm:realm2].count);\n    XCTAssertEqual(realm1, c.realm);\n    XCTAssertEqual(realm2, c2.realm);\n\n    XCTAssertEqualObjects(@\"1\", c.data);\n    XCTAssertEqualObjects(@\"3\", c2.data);\n    XCTAssertEqualObjects(@\"2\", c2.next.data);\n    XCTAssertEqualObjects(@\"1\", c2.next.next.data);\n}\n\n- (void)testAddOrUpdate {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    PrimaryStringObject *obj = [[PrimaryStringObject alloc] initWithValue:@[@\"string\", @1]];\n    [realm addOrUpdateObject:obj];\n    RLMResults *objects = [PrimaryStringObject allObjects];\n    XCTAssertEqual([objects count], 1U, @\"Should have 1 object\");\n    XCTAssertEqual([(PrimaryStringObject *)objects[0] intCol], 1, @\"Value should be 1\");\n\n    PrimaryStringObject *obj2 = [[PrimaryStringObject alloc] initWithValue:@[@\"string2\", @2]];\n    [realm addOrUpdateObject:obj2];\n    XCTAssertEqual([objects count], 2U, @\"Should have 2 objects\");\n\n    // upsert with new secondary property\n    PrimaryStringObject *obj3 = [[PrimaryStringObject alloc] initWithValue:@[@\"string\", @3]];\n    [realm addOrUpdateObject:obj3];\n    XCTAssertEqual([objects count], 2U, @\"Should have 2 objects\");\n    XCTAssertEqual([(PrimaryStringObject *)objects[0] intCol], 3, @\"Value should be 3\");\n\n    // upsert on non-primary key object should throw\n    XCTAssertThrows([realm addOrUpdateObject:[[StringObject alloc] initWithValue:@[@\"string\"]]]);\n\n    [realm commitWriteTransaction];\n}\n\n- (void)testAddOrUpdateObjectsFromArray {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n\n    PrimaryStringObject *obj = [[PrimaryStringObject alloc] initWithValue:@[@\"string1\", @1]];\n    [realm addObject:obj];\n\n    PrimaryStringObject *obj2 = [[PrimaryStringObject alloc] initWithValue:@[@\"string2\", @2]];\n    [realm addObject:obj2];\n\n    PrimaryStringObject *obj3 = [[PrimaryStringObject alloc] initWithValue:@[@\"string3\", @3]];\n    [realm addObject:obj3];\n\n    RLMResults *objects = [PrimaryStringObject allObjects];\n    XCTAssertEqual([objects count], 3U);\n    XCTAssertEqual(obj.intCol, 1);\n    XCTAssertEqual(obj2.intCol, 2);\n    XCTAssertEqual(obj3.intCol, 3);\n\n    // upsert with array of 2 objects. One is to update the existing value, another is added\n    NSArray *array = @[[[PrimaryStringObject alloc] initWithValue:@[@\"string2\", @4]],\n                       [[PrimaryStringObject alloc] initWithValue:@[@\"string4\", @5]]];\n    [realm addOrUpdateObjects:array];\n    XCTAssertEqual([objects count], 4U, @\"Should have 4 objects\");\n    XCTAssertEqual(obj.intCol, 1);\n    XCTAssertEqual(obj2.intCol, 4);\n    XCTAssertEqual(obj3.intCol, 3);\n    XCTAssertEqual([array[1] intCol], 5);\n\n    [realm commitWriteTransaction];\n}\n\n- (void)testDelete {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    OwnerObject *obj = [OwnerObject createInDefaultRealmWithValue:@[@\"deeter\", @[@\"barney\", @2]]];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(1U, OwnerObject.allObjects.count);\n    XCTAssertEqual(NO, obj.invalidated);\n\n    XCTAssertThrows([realm deleteObject:obj]);\n\n    RLMRealm *testRealm = [self realmWithTestPath];\n    [testRealm transactionWithBlock:^{\n        XCTAssertThrows([testRealm deleteObject:[[OwnerObject alloc] init]]);\n        [realm transactionWithBlock:^{\n            XCTAssertThrows([testRealm deleteObject:obj]);\n        }];\n    }];\n\n    [realm transactionWithBlock:^{\n        [realm deleteObject:obj];\n        XCTAssertEqual(YES, obj.invalidated);\n    }];\n\n    XCTAssertEqual(0U, OwnerObject.allObjects.count);\n}\n\n- (void)testDeleteObjects {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    CompanyObject *obj = [CompanyObject createInDefaultRealmWithValue:@[@\"deeter\", @[@[@\"barney\", @2, @YES]]]];\n    NSArray *objects = @[obj];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(1U, CompanyObject.allObjects.count);\n\n    XCTAssertThrows([realm deleteObjects:objects]);\n    XCTAssertThrows([realm deleteObjects:[CompanyObject allObjectsInRealm:realm]]);\n    XCTAssertThrows([realm deleteObjects:obj.employees]);\n\n    RLMRealm *testRealm = [self realmWithTestPath];\n    [testRealm transactionWithBlock:^{\n        [realm transactionWithBlock:^{\n            XCTAssertThrows([testRealm deleteObjects:objects]);\n            XCTAssertThrows([testRealm deleteObjects:[CompanyObject allObjectsInRealm:realm]]);\n            XCTAssertThrows([testRealm deleteObjects:obj.employees]);\n        }];\n    }];\n\n    XCTAssertEqual(1U, CompanyObject.allObjects.count);\n}\n\n- (void)testDeleteAllObjects {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    OwnerObject *obj = [OwnerObject createInDefaultRealmWithValue:@[@\"deeter\", @[@\"barney\", @2]]];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(1U, OwnerObject.allObjects.count);\n    XCTAssertEqual(1U, DogObject.allObjects.count);\n    XCTAssertEqual(NO, obj.invalidated);\n\n    XCTAssertThrows([realm deleteAllObjects]);\n\n    [realm transactionWithBlock:^{\n        [realm deleteAllObjects];\n        XCTAssertEqual(YES, obj.invalidated);\n    }];\n\n    XCTAssertEqual(0U, OwnerObject.allObjects.count);\n    XCTAssertEqual(0U, DogObject.allObjects.count);\n}\n\n- (void)testAddObjectsFromArray {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    XCTAssertThrows(([realm addObjects:@[@[@\"Rex\", @10]]]),\n                    @\"should reject non-RLMObject in array\");\n\n    DogObject *dog = [DogObject new];\n    dog.dogName = @\"Rex\";\n    dog.age = 10;\n    XCTAssertNoThrow([realm addObjects:@[dog]], @\"should allow RLMObject in array\");\n    XCTAssertEqual(1U, [[DogObject allObjectsInRealm:realm] count]);\n    [realm cancelWriteTransaction];\n}\n\n#pragma mark - Transactions\n\n- (void)testRealmTransactionBlock {\n    RLMRealm *realm = [self realmWithTestPath];\n    [realm transactionWithBlock:^{\n        [StringObject createInRealm:realm withValue:@[@\"b\"]];\n    }];\n    RLMResults *objects = [StringObject allObjectsInRealm:realm];\n    XCTAssertEqual(objects.count, 1U, @\"Expecting 1 object\");\n    XCTAssertEqualObjects([objects.firstObject stringCol], @\"b\", @\"Expecting column to be 'b'\");\n}\n\n- (void)testInWriteTransaction {\n    RLMRealm *realm = [self realmWithTestPath];\n    XCTAssertFalse(realm.inWriteTransaction);\n    [realm beginWriteTransaction];\n    XCTAssertTrue(realm.inWriteTransaction);\n    [realm cancelWriteTransaction];\n    [realm transactionWithBlock:^{\n        XCTAssertTrue(realm.inWriteTransaction);\n        [realm cancelWriteTransaction];\n        XCTAssertFalse(realm.inWriteTransaction);\n    }];\n\n    [realm beginWriteTransaction];\n    [realm invalidate];\n    XCTAssertFalse(realm.inWriteTransaction);\n}\n\n- (void)testAutorefreshAfterBackgroundUpdate {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm].count);\n\n    [self waitForNotification:RLMRealmDidChangeNotification realm:realm block:^{\n        RLMRealm *realm = [self realmWithTestPath];\n        [realm beginWriteTransaction];\n        [StringObject createInRealm:realm withValue:@[@\"string\"]];\n        [realm commitWriteTransaction];\n    }];\n\n    XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n}\n\n- (void)testBackgroundUpdateWithoutAutorefresh {\n    RLMRealm *realm = [self realmWithTestPath];\n    realm.autorefresh = NO;\n\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm].count);\n\n    [self waitForNotification:RLMRealmRefreshRequiredNotification realm:realm block:^{\n        RLMRealm *realm = [self realmWithTestPath];\n        [realm beginWriteTransaction];\n        [StringObject createInRealm:realm withValue:@[@\"string\"]];\n        [realm commitWriteTransaction];\n\n        XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n    }];\n\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm].count);\n\n    [realm refresh];\n    XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n}\n\n- (void)testBeginWriteTransactionsNotifiesWithUpdatedObjects {\n    RLMRealm *realm = [self realmWithTestPath];\n    realm.autorefresh = NO;\n\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm].count);\n\n    // Create an object in a background thread and wait for that to complete,\n    // without refreshing the main thread realm\n    [self waitForNotification:RLMRealmRefreshRequiredNotification realm:realm block:^{\n        RLMRealm *realm = [self realmWithTestPath];\n        [realm beginWriteTransaction];\n        [StringObject createInRealm:realm withValue:@[@\"string\"]];\n        [realm commitWriteTransaction];\n\n        XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n    }];\n\n    // Verify that the main thread realm still doesn't have any objects\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm].count);\n\n    // Verify that the local notification sent by the beginWriteTransaction\n    // below when it advances the realm to the latest version occurs *after*\n    // the advance\n    __block bool notificationFired = false;\n    RLMNotificationToken *token = [realm addNotificationBlock:^(__unused NSString *note, RLMRealm *realm) {\n        XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n        notificationFired = true;\n    }];\n\n    [realm beginWriteTransaction];\n    [realm commitWriteTransaction];\n\n    [token invalidate];\n    XCTAssertTrue(notificationFired);\n}\n\n- (void)testBeginWriteTransactionsRefreshesRealm {\n    // auto refresh on by default\n    RLMRealm *realm = [self realmWithTestPath];\n\n    // Set up notification which will be triggered when calling beginWriteTransaction\n    __block bool notificationFired = false;\n    RLMNotificationToken *token = [realm addNotificationBlock:^(__unused NSString *note, RLMRealm *realm) {\n        XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n        XCTAssertThrows([realm beginWriteTransaction], @\"We should already be in a write transaction\");\n        notificationFired = true;\n    }];\n\n    // dispatch to background syncronously\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = [self realmWithTestPath];\n        [realm beginWriteTransaction];\n        [StringObject createInRealm:realm withValue:@[@\"string\"]];\n        [realm commitWriteTransaction];\n    }];\n\n    // notification shouldnt have fired\n    XCTAssertFalse(notificationFired);\n\n    [realm beginWriteTransaction];\n\n    // notification should have fired\n    XCTAssertTrue(notificationFired);\n\n    [realm cancelWriteTransaction];\n    [token invalidate];\n}\n\n- (void)testBeginWriteTransactionFromWithinRefreshRequiredNotification {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    realm.autorefresh = NO;\n\n    auto expectation = [self expectationWithDescription:@\"\"];\n    RLMNotificationToken *token = [realm addNotificationBlock:^(NSString *note, RLMRealm *realm) {\n        XCTAssertEqual(RLMRealmRefreshRequiredNotification, note);\n        XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm].count);\n        [realm beginWriteTransaction];\n        XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n        [realm cancelWriteTransaction];\n        [expectation fulfill]; // note that this will throw if the notification is incorrectly called twice\n    }];\n\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm beginWriteTransaction];\n        [StringObject createInRealm:realm withValue:@[@\"string\"]];\n        [realm commitWriteTransaction];\n    }];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [token invalidate];\n}\n\n- (void)testBeginWriteTransactionFromWithinRealmChangedNotification {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    auto createObject = ^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *realm = [RLMRealm defaultRealm];\n            [realm beginWriteTransaction];\n            [StringObject createInRealm:realm withValue:@[@\"string\"]];\n            [realm commitWriteTransaction];\n        }];\n    };\n\n    // Test with the triggering transaction on a different thread\n    auto expectation = [self expectationWithDescription:@\"\"];\n    RLMNotificationToken *token = [realm addNotificationBlock:^(NSString *note, RLMRealm *realm) {\n        XCTAssertEqual(RLMRealmDidChangeNotification, note);\n\n        // We're in DidChange, so the first object is already present\n        XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n        createObject();\n\n        // Haven't refreshed yet, so still one\n        XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n\n        // Refreshes without sending notifications since we're within a notification\n        [realm beginWriteTransaction];\n        XCTAssertEqual(2U, [StringObject allObjectsInRealm:realm].count);\n        [realm cancelWriteTransaction];\n        [expectation fulfill]; // note that this will throw if the notification is incorrectly called twice\n    }];\n\n    createObject();\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [token invalidate];\n\n    // Test with the triggering transaction on the same thread\n    __block bool first = true;\n    token = [realm addNotificationBlock:^(NSString *note, RLMRealm *realm) {\n        XCTAssertTrue(first);\n        XCTAssertEqual(RLMRealmDidChangeNotification, note);\n        XCTAssertEqual(3U, [StringObject allObjectsInRealm:realm].count);\n        first = false;\n\n        [realm beginWriteTransaction]; // should not trigger a notification\n        [StringObject createInRealm:realm withValue:@[@\"string\"]];\n        [realm commitWriteTransaction]; // also should not trigger a notification\n    }];\n\n    [realm beginWriteTransaction];\n    [StringObject createInRealm:realm withValue:@[@\"string\"]];\n    [realm commitWriteTransaction];\n\n    XCTAssertFalse(first);\n    [token invalidate];\n}\n\n- (void)testBeginWriteTransactionFromWithinCollectionChangedNotification {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    auto createObject = ^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *realm = [RLMRealm defaultRealm];\n            [realm beginWriteTransaction];\n            [StringObject createInRealm:realm withValue:@[@\"string\"]];\n            [realm commitWriteTransaction];\n        }];\n    };\n\n    __block auto expectation = [self expectationWithDescription:@\"\"];\n    __block RLMNotificationToken *token;\n    auto block = ^(RLMResults *results, RLMCollectionChange *changes, NSError *) {\n        if (!changes) {\n            [expectation fulfill];\n            return;\n        }\n        [token invalidate];\n\n        XCTAssertEqual(1U, results.count);\n        createObject();\n        XCTAssertEqual(1U, results.count);\n        [realm beginWriteTransaction];\n        XCTAssertEqual(2U, results.count);\n        [realm cancelWriteTransaction];\n        [expectation fulfill];\n    };\n    token = [StringObject.allObjects addNotificationBlock:block];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    createObject();\n    expectation = [self expectationWithDescription:@\"\"];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n}\n\n- (void)testReadOnlyRealmIsImmutable {\n    @autoreleasepool { [self realmWithTestPath]; }\n\n    RLMRealm *realm = [self readOnlyRealmWithURL:RLMTestRealmURL() error:nil];\n    XCTAssertThrows([realm beginWriteTransaction]);\n    XCTAssertThrows([realm refresh]);\n}\n\n- (void)testRollbackInsert {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    IntObject *createdObject = [IntObject createInRealm:realm withValue:@[@0]];\n    [realm cancelWriteTransaction];\n\n    XCTAssertTrue(createdObject.isInvalidated);\n    XCTAssertEqual(0U, [IntObject allObjectsInRealm:realm].count);\n}\n\n- (void)testRollbackDelete {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    IntObject *objectToDelete = [IntObject createInRealm:realm withValue:@[@5]];\n    [realm commitWriteTransaction];\n\n    [realm beginWriteTransaction];\n    [realm deleteObject:objectToDelete];\n    [realm cancelWriteTransaction];\n\n    XCTAssertFalse(objectToDelete.isInvalidated);\n    XCTAssertEqual(1U, [IntObject allObjectsInRealm:realm].count);\n    XCTAssertEqual(5, objectToDelete.intCol);\n}\n\n- (void)testRollbackModify {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    IntObject *objectToModify = [IntObject createInRealm:realm withValue:@[@0]];\n    [realm commitWriteTransaction];\n\n    [realm beginWriteTransaction];\n    objectToModify.intCol = 1;\n    [realm cancelWriteTransaction];\n\n    XCTAssertEqual(0, objectToModify.intCol);\n}\n\n- (void)testRollbackLink {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    CircleObject *obj1 = [CircleObject createInRealm:realm withValue:@[@\"1\", NSNull.null]];\n    CircleObject *obj2 = [CircleObject createInRealm:realm withValue:@[@\"2\", NSNull.null]];\n    [realm commitWriteTransaction];\n\n    // Link to existing managed\n    [realm beginWriteTransaction];\n    obj1.next = obj2;\n    [realm cancelWriteTransaction];\n\n    XCTAssertNil(obj1.next);\n\n    // Link to unmanaged\n    [realm beginWriteTransaction];\n    CircleObject *obj3 = [[CircleObject alloc] init];\n    obj3.data = @\"3\";\n    obj1.next = obj3;\n    [realm cancelWriteTransaction];\n\n    XCTAssertNil(obj1.next);\n    XCTAssertEqual(2U, [CircleObject allObjectsInRealm:realm].count);\n\n    // Remove link\n    [realm beginWriteTransaction];\n    obj1.next = obj2;\n    [realm commitWriteTransaction];\n\n    [realm beginWriteTransaction];\n    obj1.next = nil;\n    [realm cancelWriteTransaction];\n\n    XCTAssertTrue([obj1.next isEqualToObject:obj2]);\n\n    // Modify link\n    [realm beginWriteTransaction];\n    CircleObject *obj4 = [CircleObject createInRealm:realm withValue:@[@\"4\", NSNull.null]];\n    [realm commitWriteTransaction];\n\n    [realm beginWriteTransaction];\n    obj1.next = obj4;\n    [realm cancelWriteTransaction];\n\n    XCTAssertTrue([obj1.next isEqualToObject:obj2]);\n}\n\n- (void)testRollbackLinkList {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    IntObject *obj1 = [IntObject createInRealm:realm withValue:@[@0]];\n    IntObject *obj2 = [IntObject createInRealm:realm withValue:@[@1]];\n    ArrayPropertyObject *array = [ArrayPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[obj1]]];\n    [realm commitWriteTransaction];\n\n    // Add existing managed object\n    [realm beginWriteTransaction];\n    [array.intArray addObject:obj2];\n    [realm cancelWriteTransaction];\n\n    XCTAssertEqual(1U, array.intArray.count);\n\n    // Add unmanaged object\n    [realm beginWriteTransaction];\n    [array.intArray addObject:[[IntObject alloc] init]];\n    [realm cancelWriteTransaction];\n\n    XCTAssertEqual(1U, array.intArray.count);\n    XCTAssertEqual(2U, [IntObject allObjectsInRealm:realm].count);\n\n    // Remove\n    [realm beginWriteTransaction];\n    [array.intArray removeObjectAtIndex:0];\n    [realm cancelWriteTransaction];\n\n    XCTAssertEqual(1U, array.intArray.count);\n\n    // Modify\n    [realm beginWriteTransaction];\n    array.intArray[0] = obj2;\n    [realm cancelWriteTransaction];\n\n    XCTAssertEqual(1U, array.intArray.count);\n    XCTAssertTrue([array.intArray[0] isEqualToObject:obj1]);\n}\n\n- (void)testRollbackTransactionWithBlock {\n    RLMRealm *realm = [self realmWithTestPath];\n    [realm transactionWithBlock:^{\n        [IntObject createInRealm:realm withValue:@[@0]];\n        [realm cancelWriteTransaction];\n    }];\n\n    XCTAssertEqual(0U, [IntObject allObjectsInRealm:realm].count);\n}\n\n- (void)testRollbackTransactionWithoutExplicitCommitOrCancel {\n    @autoreleasepool {\n        RLMRealm *realm = [self realmWithTestPath];\n        [realm beginWriteTransaction];\n        [IntObject createInRealm:realm withValue:@[@0]];\n    }\n\n    XCTAssertEqual(0U, [IntObject allObjectsInRealm:[self realmWithTestPath]].count);\n}\n\n- (void)testCanRestartReadTransactionAfterInvalidate {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm transactionWithBlock:^{\n        [IntObject createInRealm:realm withValue:@[@1]];\n    }];\n\n    [realm invalidate];\n    IntObject *obj = [IntObject allObjectsInRealm:realm].firstObject;\n    XCTAssertEqual(obj.intCol, 1);\n}\n\n- (void)testInvalidateDetachesAccessors {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    __block IntObject *obj;\n    [realm transactionWithBlock:^{\n        obj = [IntObject createInRealm:realm withValue:@[@0]];\n    }];\n\n    [realm invalidate];\n    XCTAssertTrue(obj.isInvalidated);\n    XCTAssertThrows([obj intCol]);\n}\n\n- (void)testInvalidateInvalidatesResults {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm transactionWithBlock:^{\n        [IntObject createInRealm:realm withValue:@[@1]];\n    }];\n\n    RLMResults *results = [IntObject objectsInRealm:realm where:@\"intCol = 1\"];\n    XCTAssertEqual([results.firstObject intCol], 1);\n\n    [realm invalidate];\n    XCTAssertThrows([results count]);\n    XCTAssertThrows([results firstObject]);\n}\n\n- (void)testInvalidateInvalidatesArrays {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    __block ArrayPropertyObject *arrayObject;\n    [realm transactionWithBlock:^{\n        arrayObject = [ArrayPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[@[@1]]]];\n    }];\n\n    RLMArray *array = arrayObject.intArray;\n    XCTAssertEqual(1U, array.count);\n\n    [realm invalidate];\n    XCTAssertThrows([array count]);\n}\n\n- (void)testInvalidateOnReadOnlyRealm {\n    @autoreleasepool {\n        RLMRealm *realm = [self realmWithTestPath];\n        [realm transactionWithBlock:^{\n            [IntObject createInRealm:realm withValue:@[@0]];\n        }];\n    }\n    RLMRealm *realm = [self readOnlyRealmWithURL:RLMTestRealmURL() error:nil];\n    IntObject *io = [[IntObject allObjectsInRealm:realm] firstObject];\n    [realm invalidate];\n    XCTAssertTrue(io.isInvalidated);\n    // Starts a new read transaction\n    XCTAssertFalse([[[IntObject allObjectsInRealm:realm] firstObject] isInvalidated]);\n}\n\n- (void)testInvalidateBeforeReadDoesNotAssert {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm invalidate];\n}\n\n- (void)testInvalidateDuringWriteRollsBack {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    @autoreleasepool {\n        [IntObject createInRealm:realm withValue:@[@1]];\n    }\n    [realm invalidate];\n\n    XCTAssertEqual(0U, [IntObject allObjectsInRealm:realm].count);\n}\n\n- (void)testRefreshCreatesAReadTransaction {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [self dispatchAsyncAndWait:^{\n        [RLMRealm.defaultRealm transactionWithBlock:^{\n            [IntObject createInDefaultRealmWithValue:@[@1]];\n        }];\n    }];\n\n    XCTAssertTrue([realm refresh]);\n\n    [self dispatchAsyncAndWait:^{\n        [RLMRealm.defaultRealm transactionWithBlock:^{\n            [IntObject createInDefaultRealmWithValue:@[@1]];\n        }];\n    }];\n\n    // refresh above should have created a read transaction, so realm should\n    // still only see one object\n    XCTAssertEqual(1U, [IntObject allObjects].count);\n\n    // Just a sanity check\n    XCTAssertTrue([realm refresh]);\n    XCTAssertEqual(2U, [IntObject allObjects].count);\n}\n\n- (void)testInWriteTransactionInNotificationFromBeginWrite {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    realm.autorefresh = NO;\n\n    __block bool called = false;\n    RLMNotificationToken *token = [realm addNotificationBlock:^(NSString *note, RLMRealm *realm) {\n        if (note == RLMRealmDidChangeNotification) {\n            called = true;\n            XCTAssertTrue(realm.inWriteTransaction);\n        }\n    }];\n\n    [self waitForNotification:RLMRealmRefreshRequiredNotification realm:realm block:^{\n        [RLMRealm.defaultRealm transactionWithBlock:^{ }];\n    }];\n\n    [realm beginWriteTransaction];\n    XCTAssertTrue(called);\n    [realm cancelWriteTransaction];\n    [token invalidate];\n}\n\n- (void)testThrowingFromDidChangeNotificationFromBeginWriteCancelsTransaction {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    realm.autorefresh = NO;\n\n    RLMNotificationToken *token = [realm addNotificationBlock:^(NSString *note, RLMRealm *) {\n        if (note == RLMRealmDidChangeNotification) {\n            throw 0;\n        }\n    }];\n\n    [self waitForNotification:RLMRealmRefreshRequiredNotification realm:realm block:^{\n        [RLMRealm.defaultRealm transactionWithBlock:^{ }];\n    }];\n\n    try {\n        [realm beginWriteTransaction];\n        XCTFail(@\"should have thrown\");\n    }\n    catch (int) { }\n    [token invalidate];\n\n    XCTAssertFalse(realm.inWriteTransaction);\n    XCTAssertNoThrow([realm beginWriteTransaction]);\n    [realm cancelWriteTransaction];\n}\n\n- (void)testThrowingFromDidChangeNotificationAfterLocalCommit {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    realm.autorefresh = NO;\n\n    RLMNotificationToken *token = [realm addNotificationBlock:^(NSString *note, RLMRealm *) {\n        if (note == RLMRealmDidChangeNotification) {\n            throw 0;\n        }\n    }];\n\n    [realm beginWriteTransaction];\n    try {\n        [realm commitWriteTransaction];\n        XCTFail(@\"should have thrown\");\n    }\n    catch (int) { }\n    [token invalidate];\n\n    XCTAssertFalse(realm.inWriteTransaction);\n    XCTAssertNoThrow([realm beginWriteTransaction]);\n    [realm cancelWriteTransaction];\n}\n\n- (void)testNotificationsFireEvenWithoutReadTransaction {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n\n    XCTestExpectation *notificationFired = [self expectationWithDescription:@\"notification fired\"];\n    __block RLMNotificationToken *token = [realm addNotificationBlock:^(NSString *note, RLMRealm *) {\n        if (note == RLMRealmDidChangeNotification) {\n            [notificationFired fulfill];\n            [token invalidate];\n        }\n    }];\n\n    [realm invalidate];\n    [self dispatchAsync:^{\n        [RLMRealm.defaultRealm transactionWithBlock:^{ }];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n}\n\n- (void)testNotificationBlockMustNotBeNil {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    XCTAssertThrows([realm addNotificationBlock:self.nonLiteralNil]);\n}\n\n- (void)testRefreshInWriteTransactionReturnsFalse {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n    [IntObject createInRealm:realm withValue:@[@0]];\n    XCTAssertFalse([realm refresh]);\n    [realm cancelWriteTransaction];\n}\n\n- (void)testCancelWriteWhenNotInWrite {\n    XCTAssertThrows([RLMRealm.defaultRealm cancelWriteTransaction]);\n}\n\n- (void)testActiveVersionLimit {\n    RLMRealmConfiguration *config = RLMRealmConfiguration.defaultConfiguration;\n    config.maximumNumberOfActiveVersions = 3;\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n\n    // Create frozen Realms at four different versions so that we have too many\n    // active versions. It's four rather than three as the implementation has\n    // an off-by-one error and checks if we're already over the limit rather than\n    // if a write would put us over the limit.\n    __attribute__((objc_precise_lifetime)) NSMutableArray *pinnedVersions = [NSMutableArray new];\n    [pinnedVersions addObject:realm.freeze];\n    for (int i = 0; i < 3; ++i) {\n        [realm transactionWithBlock:^{ }];\n        [pinnedVersions addObject:realm.freeze];\n    }\n\n    XCTAssertThrows([realm beginWriteTransaction]);\n    XCTAssertThrows([realm transactionWithBlock:^{ }]);\n    NSError *error;\n    [realm transactionWithBlock:^{} error:&error];\n    RLMValidateError(error, RLMErrorDomain, RLMErrorFail,\n                     @\"Number of active versions (4) in the Realm exceeded the limit of 3\");\n}\n\n#pragma mark - Async Transactions\n\n- (void)testAsyncTransactionShouldWrite {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    XCTestExpectation *asyncComplete = [self expectationWithDescription:@\"async transaction complete\"];\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm].count);\n\n    [realm asyncTransactionWithBlock:^{\n        [realm createObject:StringObject.className withValue:@[@\"string\"]];\n    } onComplete:^(NSError *error) {\n        StringObject *stringObject = [StringObject allObjectsInRealm:realm].firstObject;\n        XCTAssertEqualObjects(stringObject.stringCol, @\"string\");\n        [asyncComplete fulfill];\n        XCTAssertNil(error);\n    }];\n\n    [self waitForExpectationsWithTimeout:1.0 handler:nil];\n}\n\n- (void)testAsyncTransactionShouldWriteOnCommit {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    XCTestExpectation *writeComplete = [self expectationWithDescription:@\"async transaction complete\"];\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm].count);\n\n    [self dispatchAsync:^{\n        RLMRealm *realmBg = [RLMRealm defaultRealmForQueue:self.bgQueue];\n        [realmBg beginAsyncWriteTransaction:^{\n            [realmBg createObject:StringObject.className withValue:@[@\"string\"]];\n            [realmBg commitAsyncWriteTransaction:^(NSError *error) {\n                StringObject *stringObject = [StringObject allObjectsInRealm:realmBg].firstObject;\n                XCTAssertEqualObjects(stringObject.stringCol, @\"string\");\n                [writeComplete fulfill];\n                XCTAssertNil(error);\n            }];\n        }];\n    }];\n    [self waitForExpectationsWithTimeout:1.0 handler:nil];\n    [realm refresh];\n    XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n}\n\n- (void)testAsyncTransactionShouldCancel {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    XCTestExpectation *waitComplete = [self expectationWithDescription:@\"async wait complete\"];\n\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm].count);\n\n    RLMAsyncTransactionId asyncTransactionId = [realm beginAsyncWriteTransaction:^{\n        XCTFail(@\"should have been cancelled\");\n    }];\n    [realm beginAsyncWriteTransaction:^{\n        [realm cancelWriteTransaction];\n        [waitComplete fulfill];\n    }];\n    [realm cancelAsyncTransaction:asyncTransactionId];\n\n    [self waitForExpectationsWithTimeout:1.0 handler:nil];\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm].count);\n}\n\n- (void)testAsyncTransactionShouldNotRunTransactionOnClosedRealm {\n    XCTestExpectation *writeComplete = [self expectationWithDescription:@\"async transaction complete\"];\n    writeComplete.inverted = YES;\n    [self dispatchAsync:^{\n        RLMRealm *realm = [RLMRealm defaultRealmForQueue:self.bgQueue];\n        [realm beginAsyncWriteTransaction:^{\n            [writeComplete fulfill];\n        }];\n        [realm invalidate];\n    }];\n    [self waitForExpectationsWithTimeout:1.0 handler:nil];\n}\n\n- (void)testAsyncTransactionShouldNotAutoCommitOnCanceledTransaction {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    XCTestExpectation *waitComplete = [self expectationWithDescription:@\"async wait complete\"];\n    XCTestExpectation *writeComplete = [self expectationWithDescription:@\"async transaction complete\"];\n    writeComplete.inverted = YES;\n\n    [self dispatchAsync:^{\n        RLMRealm *realm = [RLMRealm defaultRealmForQueue:self.bgQueue];\n        RLMAsyncTransactionId asyncTransactionId = [realm asyncTransactionWithBlock:^{\n            [realm createObject:StringObject.className withValue:@[@\"string 1\"]];\n        } onComplete:^(NSError *) {\n            [writeComplete fulfill];\n        }];\n        [realm cancelAsyncTransaction:asyncTransactionId];\n        [waitComplete fulfill];\n    }];\n\n    [self waitForExpectationsWithTimeout:1.0 handler:nil];\n    [realm refresh];\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm].count);\n}\n\n- (void)testAsyncTransactionShouldAutorefresh {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm].count);\n\n    XCTestExpectation *notificationFired = [self expectationWithDescription:@\"notification fired\"];\n    __block RLMNotificationToken *token = [realm addNotificationBlock:^(NSString *note, RLMRealm *realm) {\n        XCTAssertNotNil(note, @\"Note should not be nil\");\n        XCTAssertNotNil(realm, @\"Realm should not be nil\");\n        if (note == RLMRealmDidChangeNotification) { // Check pointer equality to ensure we're using the interned string constant\n            [notificationFired fulfill];\n            [token invalidate];\n        }\n    }];\n\n    [realm asyncTransactionWithBlock:^{\n        [StringObject createInRealm:realm withValue:@[@\"string\"]];\n    }];\n\n    [self waitForExpectationsWithTimeout:30.0 handler:nil];\n\n    XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n}\n\n- (void)testAsyncTransactionSyncCommit {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    XCTestExpectation *asyncComplete = [self expectationWithDescription:@\"async transaction complete\"];\n    asyncComplete.expectedFulfillmentCount = 2;\n\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm].count);\n\n    [realm beginAsyncWriteTransaction:^{\n        [realm createObject:StringObject.className withValue:@[@\"string\"]];\n        [realm commitAsyncWriteTransaction:^(NSError *) {\n            [asyncComplete fulfill];\n        } allowGrouping:true];\n    }];\n\n    [realm beginAsyncWriteTransaction:^{\n        [realm createObject:StringObject.className withValue:@[@\"string\"]];\n        [realm commitAsyncWriteTransaction:^(NSError *) {\n            [asyncComplete fulfill];\n        }];\n    }];\n\n    [realm beginAsyncWriteTransaction:^{\n        [realm createObject:StringObject.className withValue:@[@\"string\"]];\n        [realm commitAsyncWriteTransaction];\n    }];\n\n    [realm beginAsyncWriteTransaction:^{\n        [realm createObject:StringObject.className withValue:@[@\"string\"]];\n        [realm commitWriteTransaction];\n    }];\n\n    [self waitForExpectationsWithTimeout:1.0 handler:nil];\n\n    XCTAssertEqual(2U, [StringObject allObjectsInRealm:realm].count);\n}\n\n- (void)testAsyncTransactionSyncAfterAsyncWithoutCommit {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm].count);\n\n    [realm beginAsyncWriteTransaction:^{\n        [realm createObject:StringObject.className withValue:@[@\"string\"]];\n    }];\n\n    [realm beginWriteTransaction];\n    [realm createObject:StringObject.className withValue:@[@\"string 2\"]];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqualObjects([[StringObject allObjectsInRealm:realm].firstObject stringCol], @\"string 2\");\n}\n\n- (void)testAsyncTransactionWriteWithSync {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    XCTestExpectation *asyncComplete = [self expectationWithDescription:@\"async transaction complete\"];\n\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm].count);\n\n    [realm beginWriteTransaction];\n    [realm createObject:StringObject.className withValue:@[@\"string\"]];\n    [realm commitAsyncWriteTransaction];\n\n    [realm beginWriteTransaction];\n    [realm createObject:StringObject.className withValue:@[@\"string 2\"]];\n    [realm commitAsyncWriteTransaction:^(NSError *) {\n        [asyncComplete fulfill];\n    }];\n\n    [self waitForExpectationsWithTimeout:1.0 handler:nil];\n\n    XCTAssertEqual(2U, [StringObject allObjectsInRealm:realm].count);\n}\n\n- (void)testAsyncTransactionMixedWithSync {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    XCTestExpectation *asyncComplete = [self expectationWithDescription:@\"async transaction complete\"];\n\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm].count);\n\n    [realm beginAsyncWriteTransaction:^{\n        [realm createObject:StringObject.className withValue:@[@\"string\"]];\n        [realm commitAsyncWriteTransaction];\n    }];\n\n    [realm beginAsyncWriteTransaction:^{\n        [realm createObject:StringObject.className withValue:@[@\"string 2\"]];\n        [realm commitAsyncWriteTransaction:^(NSError *) {\n            [asyncComplete fulfill];\n        }];\n    }];\n\n    [realm beginWriteTransaction];\n    [realm createObject:StringObject.className withValue:@[@\"string 3\"]];\n    [realm commitWriteTransaction];\n\n    [self waitForExpectationsWithTimeout:1.0 handler:nil];\n\n    XCTAssertEqual(3U, [StringObject allObjectsInRealm:realm].count);\n}\n\n- (void)testAsyncTransactionMixedWithCancelledSync {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    XCTestExpectation *asyncComplete = [self expectationWithDescription:@\"async transaction complete\"];\n\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm].count);\n\n    [realm beginAsyncWriteTransaction:^{\n        [realm createObject:StringObject.className withValue:@[@\"string\"]];\n        [realm commitAsyncWriteTransaction];\n    }];\n\n    [realm beginAsyncWriteTransaction:^{\n        [realm createObject:StringObject.className withValue:@[@\"string 2\"]];\n        [realm commitAsyncWriteTransaction:^(NSError *) {\n            [asyncComplete fulfill];\n        }];\n    }];\n\n    [realm beginWriteTransaction];\n    [realm createObject:StringObject.className withValue:@[@\"string 3\"]];\n    [realm cancelWriteTransaction];\n\n    [self waitForExpectationsWithTimeout:1.0 handler:nil];\n\n    XCTAssertEqual(2U, [StringObject allObjectsInRealm:realm].count);\n}\n\n- (void)testAsyncTransactionChangeNotification {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    __block XCTestExpectation *asyncComplete = [self expectationWithDescription:@\"async transaction complete\"];\n    auto expectInitial = [self expectationWithDescription:@\"initial\"];\n    asyncComplete.expectedFulfillmentCount = 4;\n\n    RLMResults<RLMObject *> *resultsUnderTest = [StringObject allObjects];\n    RLMNotificationToken *token = [resultsUnderTest addNotificationBlock:^(RLMResults<RLMObject *> *, RLMCollectionChange * _Nullable change, NSError *) {\n        if (!change) { // ignore initial\n            [expectInitial fulfill];\n            return;\n        }\n        XCTAssertNotNil(change);\n        [asyncComplete fulfill];\n    }];\n\n    [self waitForExpectations:@[expectInitial] timeout:1.0];\n\n    [realm asyncTransactionWithBlock:^{\n        [realm createObject:StringObject.className withValue:@[@\"string 1\"]];\n    } onComplete:^(NSError *) {\n        [asyncComplete fulfill];\n    }];\n\n    [realm asyncTransactionWithBlock:^{\n        [realm createObject:StringObject.className withValue:@[@\"string 1\"]];\n    } onComplete:^(NSError *) {\n        [asyncComplete fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [token invalidate];\n    XCTAssertEqual(2U, [StringObject allObjectsInRealm:realm].count);\n}\n\n- (void)testAsyncTransactionsRefreshesRealm {\n    // auto refresh on by default, so turn it off\n    RLMRealm *realm = [self realmWithTestPath];\n    realm.autorefresh = NO;\n    XCTestExpectation *asyncComplete = [self expectationWithDescription:@\"async transaction complete\"];\n\n    __block bool notificationFired = false;\n    RLMNotificationToken *token = [realm addNotificationBlock:^(__unused NSString *note, RLMRealm *realm) {\n        XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n        notificationFired = true;\n    }];\n\n    [realm asyncTransactionWithBlock:^{\n        [StringObject createInRealm:realm withValue:@[@\"string\"]];\n    } onComplete:^(NSError *) {\n        [asyncComplete fulfill];\n    }];\n\n    [self waitForExpectationsWithTimeout:3.0 handler:nil];\n    // notification shouldnt have fired\n    XCTAssertTrue(notificationFired);\n    [token invalidate];\n}\n\n- (void)testAsyncBeginTransactionInAsyncTransaction {\n    RLMRealm *realm = [self realmWithTestPath];\n    XCTestExpectation *transaction1 = [self expectationWithDescription:@\"async transaction 1 complete\"];\n    XCTestExpectation *transaction2 = [self expectationWithDescription:@\"async transaction 2 complete\"];\n\n    [realm beginAsyncWriteTransaction:^{\n        [StringObject createInRealm:realm withValue:@[@\"string\"]];\n\n        [realm beginAsyncWriteTransaction:^{\n            [StringObject createInRealm:realm withValue:@[@\"string\"]];\n\n            [realm commitAsyncWriteTransaction:^(NSError *error) {\n                XCTAssertEqual(0U, [StringObject allObjects].count);\n                [transaction1 fulfill];\n                XCTAssertNil(error);\n            }];\n        }];\n\n        [realm commitAsyncWriteTransaction:^(NSError *error) {\n            XCTAssertEqual(0U, [StringObject allObjects].count);\n            [transaction2 fulfill];\n            XCTAssertNil(error);\n        }];\n    }];\n\n    [self waitForExpectationsWithTimeout:3.0 handler:nil];\n    XCTAssertEqual(0U, [StringObject allObjects].count);\n}\n\n- (void)testAsyncTransactionFromSyncTransaction {\n    XCTestExpectation *transaction1 = [self expectationWithDescription:@\"async transaction 1 complete\"];\n\n    [self dispatchAsync:^{\n        RLMRealm *realm = [RLMRealm defaultRealmForQueue:self.bgQueue];\n\n        [realm beginWriteTransaction];\n        [StringObject createInRealm:realm withValue:@[@\"string\"]];\n\n        [realm beginAsyncWriteTransaction:^{\n            [StringObject createInRealm:realm withValue:@[@\"string\"]];\n\n            [realm commitAsyncWriteTransaction:^(NSError *error) {\n                [transaction1 fulfill];\n                XCTAssertNil(error);\n            }];\n        }];\n        [realm commitWriteTransaction];\n    }];\n\n    [self waitForExpectationsWithTimeout:3.0 handler:nil];\n    XCTAssertEqual(2U, [StringObject allObjects].count);\n}\n\n- (void)testAsyncNestedWrites {\n    XCTestExpectation *transactionsComplete = [self expectationWithDescription:@\"async transaction 1 complete\"];\n    transactionsComplete.expectedFulfillmentCount = 2;\n\n    [self dispatchAsync:^{\n        RLMRealm *realm = [RLMRealm defaultRealmForQueue:self.bgQueue];\n\n        [realm beginAsyncWriteTransaction:^{\n            [StringObject createInRealm:realm withValue:@[@\"string 1\"]];\n\n            // nested in async block\n            [realm beginAsyncWriteTransaction:^{\n                [StringObject createInRealm:realm withValue:@[@\"string 2\"]];\n\n                [realm commitAsyncWriteTransaction:^(NSError *) {\n                    // nested in completion block\n                    XCTAssertThrows([realm beginAsyncWriteTransaction:^{ }]);\n                    [transactionsComplete fulfill];\n                }];\n            }];\n\n            [realm commitAsyncWriteTransaction:^(NSError *) {\n                [transactionsComplete fulfill];\n            }];\n        }];\n    }];\n\n    [self waitForExpectationsWithTimeout:3.0 handler:nil];\n    XCTAssertEqual(2U, [StringObject allObjects].count);\n}\n\n- (void)testAsyncTransactionCancel {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    auto expectation = [self expectationWithDescription:@\"\"];\n    expectation.expectedFulfillmentCount = 3;\n    XCTestExpectation *unexpectation = [self expectationWithDescription:@\"\"];\n    unexpectation.inverted = YES;\n\n    [realm beginAsyncWriteTransaction:^{\n        [StringObject createInRealm:realm withValue:@[@\"string\"]];\n        [expectation fulfill];\n    }];\n\n    [realm beginAsyncWriteTransaction:^{\n        [StringObject createInRealm:realm withValue:@[@\"string\"]];\n        [realm commitAsyncWriteTransaction];\n        [expectation fulfill];\n    }];\n\n    [realm beginAsyncWriteTransaction:^{\n        [StringObject createInRealm:realm withValue:@[@\"string\"]];\n        [realm commitAsyncWriteTransaction];\n        [expectation fulfill];\n    }];\n\n    RLMAsyncTransactionId asyncTransactionIdB = [realm beginAsyncWriteTransaction:^{\n        [unexpectation fulfill];\n    }];\n    [realm cancelAsyncTransaction:asyncTransactionIdB];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    XCTAssertEqual(2U, [StringObject allObjectsInRealm:realm].count);\n}\n\n- (void)testAsyncTransactionCommit {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    auto expectation = [self expectationWithDescription:@\"\"];\n    expectation.expectedFulfillmentCount = 3;\n\n    [realm beginAsyncWriteTransaction:^{\n        [StringObject createInRealm:realm withValue:@[@\"with commit should commit\"]];\n        [expectation fulfill];\n        [realm commitAsyncWriteTransaction];\n    }];\n\n    [realm beginAsyncWriteTransaction:^{\n        [StringObject createInRealm:realm withValue:@[@\"without commit/cancel should not commit\"]];\n        [expectation fulfill];\n    }];\n\n    [realm beginAsyncWriteTransaction:^{\n        [StringObject createInRealm:realm withValue:@[@\"cancel after commit should commit\"]];\n        [expectation fulfill];\n        RLMAsyncTransactionId asyncTransactionId = [realm commitAsyncWriteTransaction:^(NSError * _Nonnull) {\n            // no op\n        }];\n        [realm cancelAsyncTransaction:asyncTransactionId];\n    }];\n\n    RLMAsyncTransactionId asyncTransactionIdA = [realm beginAsyncWriteTransaction:^{\n        [StringObject createInRealm:realm withValue:@[@\"commit after cancel should not commit\"]];\n        [expectation fulfill];\n        [realm cancelAsyncTransaction:asyncTransactionIdA];\n        [realm commitAsyncWriteTransaction];\n    }];\n\n    RLMAsyncTransactionId asyncTransactionIdB = [realm beginAsyncWriteTransaction:^{\n        [StringObject createInRealm:realm withValue:@[@\"cancel should not commit\"]];\n        [expectation fulfill];\n        [realm commitAsyncWriteTransaction];\n    }];\n    [realm cancelAsyncTransaction:asyncTransactionIdB];\n\n    [self waitForExpectationsWithTimeout:5.0 handler:nil];\n    XCTAssertEqual(2U, [StringObject allObjectsInRealm:realm].count);\n}\n\n- (void)testAsyncWriteOnQueueConfinedRealm {\n    __block RLMRealm *qRealm;\n    auto q = dispatch_queue_create(\"queue 1\", DISPATCH_QUEUE_SERIAL);\n    auto expectationWrite = [self expectationWithDescription:@\"\"];\n    auto expectationCommit = [self expectationWithDescription:@\"\"];\n\n    dispatch_sync(q, ^{ qRealm = [RLMRealm defaultRealmForQueue:q]; });\n\n    dispatch_sync(q, ^{\n        [qRealm beginAsyncWriteTransaction:^{\n            [StringObject createInRealm:qRealm withValue:@[@\"in queue\"]];\n            [expectationWrite fulfill];\n            [qRealm commitAsyncWriteTransaction:^(NSError * _Nonnull) {\n                [expectationCommit fulfill];\n            }];\n        }];\n    });\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    XCTAssertEqual(1U, [StringObject allObjectsInRealm:[RLMRealm defaultRealm]].count);\n}\n\n- (void)testAsyncWriteOnReadonlyRealm {\n    @autoreleasepool {  // ensure the Realm exists\n        __unused RLMRealm *discard = self.realmWithTestPath;\n    }\n    RLMRealm *realm = [self readOnlyRealmWithURL:RLMTestRealmURL() error:nil];\n    XCTAssertThrows([realm beginAsyncWriteTransaction:^{ }]);\n}\n\n- (void)testAsyncCommitAfterTransaction {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    XCTAssertThrows([realm commitWriteTransaction]);\n    [realm beginAsyncWriteTransaction:^{ }];\n    XCTAssertThrows([realm commitAsyncWriteTransaction]);\n}\n\n- (void)testAsyncCommitWithoutTransaction {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    XCTAssertThrows([realm commitAsyncWriteTransaction]);\n}\n\n- (void)testAsyncCancelWtongTransaction {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    auto expectation = [self expectationWithDescription:@\"\"];\n\n    RLMAsyncTransactionId transId = [realm beginAsyncWriteTransaction:^{\n        [StringObject createInRealm:realm withValue:@[@\"prim\"]];\n        [realm commitAsyncWriteTransaction];\n        [expectation fulfill];\n    }];\n\n    [realm cancelAsyncTransaction:transId+1];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    XCTAssertEqual(1U, [StringObject allObjectsInRealm:[RLMRealm defaultRealm]].count);\n}\n\n- (void)testAsyncCrossSync {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    auto expectation = [self expectationWithDescription:@\"\"];\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:[RLMRealm defaultRealm]].count);\n\n    [realm beginWriteTransaction];\n    [StringObject createInRealm:realm withValue:@[@\"prim\"]];\n    [realm commitAsyncWriteTransaction];\n    XCTAssertEqual(1U, [StringObject allObjectsInRealm:[RLMRealm defaultRealm]].count);\n\n    [realm beginAsyncWriteTransaction:^{\n        [StringObject createInRealm:realm withValue:@[@\"sec\"]];\n        [realm commitWriteTransaction];\n        [expectation fulfill];\n    }];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    XCTAssertEqual(2U, [StringObject allObjectsInRealm:[RLMRealm defaultRealm]].count);\n}\n\n- (void)testAsyncIsInTransaction {\n    auto realm = [RLMRealm defaultRealm];\n    auto expectation = [self expectationWithDescription:@\"\"];\n\n    XCTAssertFalse(realm.isPerformingAsynchronousWriteOperations);\n    XCTAssertFalse(realm.inWriteTransaction);\n\n    [realm beginWriteTransaction];\n    XCTAssertFalse(realm.isPerformingAsynchronousWriteOperations);\n    XCTAssertTrue(realm.inWriteTransaction);\n    [realm cancelWriteTransaction];\n\n    [realm beginAsyncWriteTransaction:^{\n        XCTAssertTrue(realm.isPerformingAsynchronousWriteOperations);\n        XCTAssertTrue(realm.inWriteTransaction);\n        [expectation fulfill];\n    }];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n}\n\n#pragma mark - Threads\n\n- (void)testCrossThreadAccess {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n\n    [self dispatchAsyncAndWait:^{\n        XCTAssertThrows([realm beginWriteTransaction]);\n        XCTAssertThrows([IntObject allObjectsInRealm:realm]);\n        XCTAssertThrows([IntObject objectsInRealm:realm where:@\"intCol = 0\"]);\n    }];\n}\n\n- (void)testHoldRealmAfterSourceThreadIsDestroyed {\n    RLMRealm *realm;\n\n    // Explicitly create a thread so that we can ensure the thread (and thus\n    // runloop) is actually destroyed\n    std::thread([&] { realm = [RLMRealm defaultRealm]; }).join();\n\n    [realm.configuration fileURL]; // ensure ARC releases the object after the thread has finished\n}\n\n- (void)testBackgroundRealmIsNotified {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    XCTestExpectation *bgReady = [self expectationWithDescription:@\"background queue waiting for commit\"];\n    __block XCTestExpectation *bgDone = nil;\n\n    [self dispatchAsync:^{\n        RLMRealm *realm = [self realmWithTestPath];\n        __block bool fulfilled = false;\n\n        CFRunLoopPerformBlock(CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, ^{\n            __block RLMNotificationToken *token = [realm addNotificationBlock:^(NSString *note, RLMRealm *realm) {\n                XCTAssertNotNil(realm, @\"Realm should not be nil\");\n                XCTAssertEqual(note, RLMRealmDidChangeNotification);\n                XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n                fulfilled = true;\n                [token invalidate];\n            }];\n\n            // notify main thread that we're ready for it to commit\n            [bgReady fulfill];\n        });\n\n        // run for two seconds or until we receive notification\n        NSDate *end = [NSDate dateWithTimeIntervalSinceNow:5.0];\n        while (!fulfilled) {\n            [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:end];\n        }\n        XCTAssertTrue(fulfilled, @\"Notification should have been received\");\n\n        [bgDone fulfill];\n    }];\n\n    // wait for background realm to be created\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    bgDone = [self expectationWithDescription:@\"background queue done\"];\n\n    [realm beginWriteTransaction];\n    [StringObject createInRealm:realm withValue:@[@\"string\"]];\n    [realm commitWriteTransaction];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n}\n\n- (void)testAddingNotificationOutsideOfRunLoopIsAnError {\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = RLMRealm.defaultRealm;\n        XCTAssertThrows([realm addNotificationBlock:^(NSString *, RLMRealm *) { }]);\n\n        CFRunLoopPerformBlock(CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, ^{\n            RLMNotificationToken *token;\n            XCTAssertNoThrow(token = [realm addNotificationBlock:^(NSString *, RLMRealm *) { }]);\n            [token invalidate];\n            CFRunLoopStop(CFRunLoopGetCurrent());\n        });\n\n        CFRunLoopRun();\n    }];\n}\n\n- (void)testAddingNotificationToQueueBoundThreadOutsideOfRunLoop {\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = [RLMRealm defaultRealmForQueue:self.bgQueue];\n        XCTAssertNoThrow([realm addNotificationBlock:^(NSString *, RLMRealm *) { }]);\n    }];\n}\n\n- (void)testQueueBoundRealmCaching {\n    auto q1 = dispatch_queue_create(\"queue 1\", DISPATCH_QUEUE_SERIAL);\n    auto q2 = dispatch_queue_create(\"queue 2\", DISPATCH_QUEUE_SERIAL);\n\n    RLMRealm *mainThreadRealm1 = [RLMRealm defaultRealm];\n    RLMRealm *mainQueueRealm1 = [RLMRealm defaultRealmForQueue:dispatch_get_main_queue()];\n    __block RLMRealm *q1Realm1;\n    __block RLMRealm *q2Realm1;\n    dispatch_sync(q1, ^{ q1Realm1 = [RLMRealm defaultRealmForQueue:q1]; });\n    dispatch_sync(q2, ^{ q2Realm1 = [RLMRealm defaultRealmForQueue:q2]; });\n\n    XCTAssertEqual(mainQueueRealm1, mainThreadRealm1);\n\n    XCTAssertNotEqual(mainThreadRealm1, q1Realm1);\n    XCTAssertNotEqual(mainThreadRealm1, q2Realm1);\n    XCTAssertNotEqual(mainQueueRealm1, q1Realm1);\n    XCTAssertNotEqual(mainQueueRealm1, q2Realm1);\n    XCTAssertNotEqual(q1Realm1, q2Realm1);\n\n    RLMRealm *mainThreadRealm2 = [RLMRealm defaultRealm];\n    RLMRealm *mainQueueRealm2 = [RLMRealm defaultRealmForQueue:dispatch_get_main_queue()];\n    __block RLMRealm *q1Realm2;\n    __block RLMRealm *q2Realm2;\n    dispatch_sync(q1, ^{ q1Realm2 = [RLMRealm defaultRealmForQueue:q1]; });\n    dispatch_sync(q2, ^{ q2Realm2 = [RLMRealm defaultRealmForQueue:q2]; });\n\n    XCTAssertEqual(mainThreadRealm1, mainThreadRealm2);\n    XCTAssertEqual(mainQueueRealm1, mainQueueRealm2);\n    XCTAssertEqual(q1Realm1, q1Realm2);\n    XCTAssertEqual(q2Realm2, q2Realm2);\n\n    dispatch_async(q1, ^{\n        @autoreleasepool {\n            RLMRealm *backgroundThreadRealm = [RLMRealm defaultRealm];\n            RLMRealm *q1Realm3 = [RLMRealm defaultRealmForQueue:q1];\n            XCTAssertThrows([RLMRealm defaultRealmForQueue:q2]);\n\n            XCTAssertNotEqual(backgroundThreadRealm, mainThreadRealm1);\n            XCTAssertNotEqual(backgroundThreadRealm, mainQueueRealm1);\n            XCTAssertNotEqual(backgroundThreadRealm, q1Realm1);\n            XCTAssertNotEqual(backgroundThreadRealm, q1Realm2);\n            XCTAssertEqual(q1Realm1, q1Realm3);\n        }\n    });\n    dispatch_sync(q1, ^{});\n\n    dispatch_async(q2, ^{\n        @autoreleasepool {\n            RLMRealm *backgroundThreadRealm = [RLMRealm defaultRealm];\n            XCTAssertThrows([RLMRealm defaultRealmForQueue:q1]);\n            RLMRealm *q2Realm3 = [RLMRealm defaultRealmForQueue:q2];\n\n            XCTAssertNotEqual(backgroundThreadRealm, mainThreadRealm1);\n            XCTAssertNotEqual(backgroundThreadRealm, mainQueueRealm1);\n            XCTAssertNotEqual(backgroundThreadRealm, q1Realm1);\n            XCTAssertNotEqual(backgroundThreadRealm, q1Realm2);\n            XCTAssertEqual(q2Realm2, q2Realm3);\n        }\n    });\n    dispatch_sync(q2, ^{});\n}\n\n- (void)testQueueValidation {\n    XCTAssertNoThrow([RLMRealm defaultRealmForQueue:dispatch_get_main_queue()]);\n    RLMAssertThrowsWithReason([RLMRealm defaultRealmForQueue:self.bgQueue],\n                              @\"Realm opened from incorrect dispatch queue.\");\n    RLMAssertThrowsWithReasonMatching([RLMRealm defaultRealmForQueue:dispatch_get_global_queue(0, 0)],\n                              @\"Invalid queue '.*' \\\\(.*\\\\): Realms can only be confined to serial queues or the main queue.\");\n    RLMAssertThrowsWithReason([RLMRealm defaultRealmForQueue:dispatch_queue_create(\"concurrent queue\", DISPATCH_QUEUE_CONCURRENT)],\n                              @\"Invalid queue 'concurrent queue' (OS_dispatch_queue_concurrent): Realms can only be confined to serial queues or the main queue.\");\n    dispatch_sync(self.bgQueue, ^{\n        XCTAssertNoThrow([RLMRealm defaultRealmForQueue:self.bgQueue]);\n    });\n}\n\n- (void)testQueueChecking {\n    auto q1 = dispatch_queue_create(\"queue 1\", DISPATCH_QUEUE_SERIAL);\n    auto q2 = dispatch_queue_create(\"queue 2\", DISPATCH_QUEUE_SERIAL);\n\n    RLMRealm *mainRealm = [RLMRealm defaultRealmForQueue:dispatch_get_main_queue()];\n    __block RLMRealm *q1Realm;\n    __block RLMRealm *q2Realm;\n    dispatch_sync(q1, ^{ q1Realm = [RLMRealm defaultRealmForQueue:q1]; });\n    dispatch_sync(q2, ^{ q2Realm = [RLMRealm defaultRealmForQueue:q2]; });\n\n    XCTAssertNoThrow([mainRealm refresh]);\n    RLMAssertThrowsWithReason([q1Realm refresh], @\"thread\");\n    RLMAssertThrowsWithReason([q2Realm refresh], @\"thread\");\n\n    dispatch_sync(q1, ^{\n        // dispatch_sync() doesn't change the thread and mainRealm is actually\n        // bound to the main thread and not the main queue\n        XCTAssertNoThrow([mainRealm refresh]);\n\n        XCTAssertNoThrow([q1Realm refresh]);\n        RLMAssertThrowsWithReason([q2Realm refresh], @\"thread\");\n        dispatch_sync(q2, ^{\n            XCTAssertNoThrow([mainRealm refresh]);\n            XCTAssertNoThrow([q2Realm refresh]);\n            RLMAssertThrowsWithReason([q1Realm refresh], @\"thread\");\n        });\n        [self dispatchAsyncAndWait:^{\n            RLMAssertThrowsWithReason([mainRealm refresh], @\"thread\");\n            RLMAssertThrowsWithReason([q1Realm refresh], @\"thread\");\n            RLMAssertThrowsWithReason([q2Realm refresh], @\"thread\");\n        }];\n    });\n}\n\n- (void)testReusingConfigOnMultipleQueues {\n    auto config = [RLMRealmConfiguration defaultConfiguration];\n    auto q1 = dispatch_queue_create(\"queue 1\", DISPATCH_QUEUE_SERIAL);\n    auto q2 = dispatch_queue_create(\"queue 2\", DISPATCH_QUEUE_SERIAL);\n\n    dispatch_sync(q1, ^{\n        XCTAssertNoThrow([RLMRealm realmWithConfiguration:config queue:q1 error:nil]);\n    });\n    dispatch_sync(q2, ^{\n        XCTAssertNoThrow([RLMRealm realmWithConfiguration:config queue:q2 error:nil]);\n    });\n}\n\n- (void)testConfigurationFromExistingRealmOnNewThread {\n    auto r1 = [RLMRealm defaultRealm];\n    [self dispatchAsyncAndWait:^{\n        auto r2 = [RLMRealm realmWithConfiguration:r1.configuration error:nil];\n        XCTAssertNoThrow([r2 refresh]);\n    }];\n}\n\n#pragma mark - In-memory Realms\n\n- (void)testInMemoryRealm {\n    @autoreleasepool {\n        RLMRealm *inMemoryRealm = [self inMemoryRealmWithIdentifier:@\"identifier\"];\n\n        [self waitForNotification:RLMRealmDidChangeNotification realm:inMemoryRealm block:^{\n            RLMRealm *inMemoryRealm = [self inMemoryRealmWithIdentifier:@\"identifier\"];\n            [inMemoryRealm beginWriteTransaction];\n            [StringObject createInRealm:inMemoryRealm withValue:@[@\"a\"]];\n            [StringObject createInRealm:inMemoryRealm withValue:@[@\"b\"]];\n            [StringObject createInRealm:inMemoryRealm withValue:@[@\"c\"]];\n            XCTAssertEqual(3U, [StringObject allObjectsInRealm:inMemoryRealm].count);\n            [inMemoryRealm commitWriteTransaction];\n        }];\n\n        XCTAssertEqual(3U, [StringObject allObjectsInRealm:inMemoryRealm].count);\n\n        // make sure we can have another\n        RLMRealm *anotherInMemoryRealm = [self inMemoryRealmWithIdentifier:@\"identifier2\"];\n        XCTAssertEqual(0U, [StringObject allObjectsInRealm:anotherInMemoryRealm].count);\n    }\n\n    // Should now be empty\n    RLMRealm *inMemoryRealm = [self inMemoryRealmWithIdentifier:@\"identifier\"];\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:inMemoryRealm].count);\n}\n\n#pragma mark - Read-only Realms\n\n- (void)testReadOnlyRealmWithMissingTables {\n    // create a realm with only a StringObject table\n    @autoreleasepool {\n        RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:StringObject.class];\n        objectSchema.objectClass = RLMObject.class;\n\n        RLMSchema *schema = [[RLMSchema alloc] init];\n        schema.objectSchema = @[objectSchema];\n        RLMRealm *realm = [self realmWithTestPathAndSchema:schema];\n\n        [realm beginWriteTransaction];\n        [realm createObject:StringObject.className withValue:@[@\"a\"]];\n        [realm commitWriteTransaction];\n    }\n\n    RLMRealm *realm = [self readOnlyRealmWithURL:RLMTestRealmURL() error:nil];\n    XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n    XCTAssertNil([PrimaryIntObject objectInRealm:realm forPrimaryKey:@0]);\n\n    // verify that reading a missing table gives an empty array rather than\n    // crashing\n    RLMResults *results = [IntObject allObjectsInRealm:realm];\n    XCTAssertEqual(0U, results.count);\n    XCTAssertEqual(results, [results objectsWhere:@\"intCol = 5\"]);\n    XCTAssertEqual(results, [results sortedResultsUsingKeyPath:@\"intCol\" ascending:YES]);\n    XCTAssertThrows([results objectAtIndex:0]);\n    XCTAssertEqual(NSNotFound, [results indexOfObject:self.nonLiteralNil]);\n    XCTAssertEqual(NSNotFound, [results indexOfObjectWhere:@\"intCol = 5\"]);\n    RLMAssertThrowsWithReason([realm deleteObjects:results],\n                              @\"Cannot modify Results outside of a write transaction.\");\n    XCTAssertNil([results maxOfProperty:@\"intCol\"]);\n    XCTAssertNil([results minOfProperty:@\"intCol\"]);\n    XCTAssertNil([results averageOfProperty:@\"intCol\"]);\n    XCTAssertEqualObjects(@0, [results sumOfProperty:@\"intCol\"]);\n    XCTAssertNil([results firstObject]);\n    XCTAssertNil([results lastObject]);\n    for (__unused id obj in results) {\n        XCTFail(@\"Got an item in empty results\");\n    }\n}\n\n- (void)testReadOnlyRealmWithMissingColumns {\n    // create a realm with only a zero-column StringObject table\n    @autoreleasepool {\n        RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:StringObject.class];\n        objectSchema.objectClass = RLMObject.class;\n        objectSchema.properties = @[];\n\n        RLMSchema *schema = [[RLMSchema alloc] init];\n        schema.objectSchema = @[objectSchema];\n        [self realmWithTestPathAndSchema:schema];\n    }\n\n    XCTAssertThrows([self readOnlyRealmWithURL:RLMTestRealmURL() error:nil],\n                    @\"should reject table missing column\");\n}\n#pragma mark - Write Copy to Path\n\n- (void)testWriteCopyOfRealm {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm transactionWithBlock:^{\n        [IntObject createInRealm:realm withValue:@[@0]];\n    }];\n\n    NSError *writeError;\n    XCTAssertTrue([realm writeCopyToURL:RLMTestRealmURL() encryptionKey:realm.configuration.encryptionKey error:&writeError]);\n    XCTAssertNil(writeError);\n    RLMRealm *copy = [self realmWithTestPath];\n    XCTAssertEqual(1U, [IntObject allObjectsInRealm:copy].count);\n\n    RLMRealm *frozenCopy = [copy freeze];\n    XCTAssertTrue(frozenCopy.isFrozen);\n    XCTAssertTrue([IntObject allObjectsInRealm:frozenCopy].isFrozen);\n}\n\n- (void)testCannotOverwriteWithWriteCopy {\n    RLMRealm *realm = [self realmWithTestPath];\n    [realm transactionWithBlock:^{\n        [IntObject createInRealm:realm withValue:@[@0]];\n    }];\n\n    NSError *writeError;\n    // Does not throw when given a nil error out param\n    XCTAssertFalse([realm writeCopyToURL:RLMTestRealmURL() encryptionKey:nil error:nil]);\n\n    NSString *expectedError = @\"Failed to open file at path '%@': File exists\";\n    XCTAssertFalse([realm writeCopyToURL:RLMTestRealmURL() encryptionKey:nil error:&writeError]);\n    RLMValidateRealmError(writeError, RLMErrorFileExists,\n                          expectedError, RLMTestRealmURL().path);\n\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = RLMTestRealmURL();\n    writeError = nil;\n    XCTAssertFalse([realm writeCopyForConfiguration:configuration error:&writeError]);\n    RLMValidateRealmError(writeError, RLMErrorFileExists,\n                          expectedError, RLMTestRealmURL().path);\n}\n\n- (void)testCannotWriteInNonExistentDirectory {\n    RLMRealm *realm = [self realmWithTestPath];\n    [realm transactionWithBlock:^{\n        [IntObject createInRealm:realm withValue:@[@0]];\n    }];\n\n    NSString *badPath = @\"/tmp/RLMTestDirMayNotExist/foo\";\n\n    NSString *expectedError = @\"Failed to open file at path '%@': parent directory does not exist\";\n    NSError *writeError;\n    XCTAssertFalse([realm writeCopyToURL:[NSURL fileURLWithPath:badPath] encryptionKey:nil error:&writeError]);\n    RLMValidateRealmError(writeError, RLMErrorFileNotFound, expectedError, badPath);\n\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = [NSURL fileURLWithPath:badPath];\n    writeError = nil;\n    XCTAssertFalse([realm writeCopyForConfiguration:configuration error:&writeError]);\n    RLMValidateRealmError(writeError, RLMErrorFileNotFound, expectedError, badPath);\n}\n\n- (void)testWriteToReadOnlyDirectory {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    // Make the parent directory temporarily read-only\n    NSString *directory = RLMTestRealmURL().URLByDeletingLastPathComponent.path;\n    NSFileManager *fm = NSFileManager.defaultManager;\n    NSNumber *oldPermissions = [fm attributesOfItemAtPath:directory error:nil][NSFilePosixPermissions];\n    [fm setAttributes:@{NSFilePosixPermissions: @(0100)} ofItemAtPath:directory error:nil];\n\n    NSError *writeError;\n    XCTAssertFalse([realm writeCopyToURL:RLMTestRealmURL() encryptionKey:nil error:&writeError]);\n    RLMValidateRealmError(writeError, RLMErrorFilePermissionDenied,\n                          @\"Failed to open file at path '%@': Permission denied\", RLMTestRealmURL().path);\n\n    // Test writeCopyForConfiguration\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = RLMTestRealmURL();\n    writeError = nil;\n    XCTAssertFalse([realm writeCopyForConfiguration:configuration error:&writeError]);\n    RLMValidateRealmError(writeError, RLMErrorFilePermissionDenied,\n                          @\"Failed to open file at path '%@': Permission denied\", RLMTestRealmURL().path);\n\n    // Restore old permissions\n    [fm setAttributes:@{NSFilePosixPermissions: oldPermissions} ofItemAtPath:directory error:nil];\n}\n\n- (void)testWriteWithNonSpecialCasedError {\n    // Testing an open() error which doesn't have its own exception type and\n    // just uses the generic \"something failed\" error\n    RLMRealm *realm = [RLMRealm defaultRealm];\n#ifdef REALM_FILELOCK_EMULATION\n    // Beginning a read transaction involves opening a file when using filelock\n    // emulation, so do that before setting the open file limit.\n    [realm refresh];\n#endif\n\n    // Set the max open files to zero so that opening new files will fail\n    rlimit oldrl;\n    getrlimit(RLIMIT_NOFILE, &oldrl);\n    rlimit rl = oldrl;\n    rl.rlim_cur = 0;\n    setrlimit(RLIMIT_NOFILE, &rl);\n\n    NSError *writeError;\n    XCTAssertFalse([realm writeCopyToURL:RLMTestRealmURL() encryptionKey:nil error:&writeError]);\n    RLMValidateRealmError(writeError, RLMErrorFileOperationFailed,\n                          @\"Failed to open file at path '%@': Too many open files\", RLMTestRealmURL().path);\n\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = RLMTestRealmURL();\n    writeError = nil;\n    XCTAssertFalse([realm writeCopyForConfiguration:configuration error:&writeError]);\n    RLMValidateRealmError(writeError, RLMErrorFileOperationFailed,\n                          @\"Failed to open file at path '%@': Too many open files\", RLMTestRealmURL().path);\n\n    // Restore the old open file limit\n    setrlimit(RLIMIT_NOFILE, &oldrl);\n}\n\n- (void)testWritingCopyUsesWriteTransactionInProgress {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm transactionWithBlock:^{\n        [IntObject createInRealm:realm withValue:@[@0]];\n\n        NSError *writeError;\n        XCTAssertTrue([realm writeCopyToURL:RLMTestRealmURL()\n                              encryptionKey:realm.configuration.encryptionKey\n                                      error:&writeError]);\n        XCTAssertNil(writeError);\n        RLMRealm *copy = [self realmWithTestPath];\n        XCTAssertEqual(1U, [IntObject allObjectsInRealm:copy].count);\n    }];\n}\n\n#pragma mark - Write Copy For Configuration\n\n- (void)testWriteCopyForConfiguration {\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = RLMTestRealmURL();\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm transactionWithBlock:^{\n        [IntObject createInRealm:realm withValue:@[@0]];\n    }];\n\n    NSError *writeError;\n    XCTAssertTrue([realm writeCopyForConfiguration:configuration error:&writeError]);\n    XCTAssertNil(writeError);\n    RLMRealm *copy = [RLMRealm realmWithConfiguration:configuration error:nil];\n    XCTAssertEqual(1U, [IntObject allObjectsInRealm:copy].count);\n\n    RLMRealm *frozenCopy = [copy freeze];\n    XCTAssertTrue(frozenCopy.isFrozen);\n    XCTAssertTrue([IntObject allObjectsInRealm:frozenCopy].isFrozen);\n}\n\n- (void)testWritingCopyWithConfigurationUsesWriteTransactionInProgress {\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = RLMTestRealmURL();\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm transactionWithBlock:^{\n        [IntObject createInRealm:realm withValue:@[@0]];\n\n        NSError *writeError;\n        XCTAssertTrue([realm writeCopyForConfiguration:configuration\n                                                  error:&writeError]);\n        XCTAssertNil(writeError);\n        RLMRealm *copy = [RLMRealm realmWithConfiguration:configuration error:nil];\n        XCTAssertEqual(1U, [IntObject allObjectsInRealm:copy].count);\n    }];\n}\n\n#pragma mark - Frozen Realms\n\n- (void)testIsFrozen {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    XCTAssertFalse(realm.frozen);\n    RLMRealm *frozenRealm = [realm freeze];\n    RLMRealm *thawedRealm = [frozenRealm thaw];\n    XCTAssertFalse(realm.frozen);\n    XCTAssertFalse(thawedRealm.frozen);\n    XCTAssertTrue(frozenRealm.frozen);\n}\n\n- (void)testRefreshFrozen {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    RLMRealm *frozenRealm = realm.freeze;\n    XCTAssertFalse([realm refresh]);\n    XCTAssertFalse([frozenRealm refresh]);\n    [realm transactionWithBlock:^{\n        [IntObject createInRealm:realm withValue:@[@0]];\n    }];\n    XCTAssertFalse([frozenRealm refresh]);\n    XCTAssertEqual(0U, [IntObject allObjectsInRealm:frozenRealm].count);\n}\n\n- (void)testForbiddenMethodsOnFrozenRealm {\n    RLMRealm *realm = [RLMRealm defaultRealm].freeze;\n    RLMAssertThrowsWithReason([realm setAutorefresh:YES],\n                              @\"Auto-refresh cannot be enabled for frozen Realms.\");\n    RLMAssertThrowsWithReason([realm beginWriteTransaction],\n                              @\"Can't perform transactions on a frozen Realm\");\n    RLMAssertThrowsWithReason([realm addNotificationBlock:^(RLMNotification, RLMRealm *) { }],\n                              @\"Frozen Realms do not change and do not have change notifications.\");\n    RLMAssertThrowsWithReason(([[IntObject allObjectsInRealm:realm]\n                                addNotificationBlock:^(RLMResults *, RLMCollectionChange *, NSError *) { }]),\n                              @\"Frozen Realms do not change and do not have change notifications.\");\n}\n\n- (void)testFrozenRealmCaching {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    RLMRealm *fr1 = realm.freeze;\n    RLMRealm *fr2 = realm.freeze;\n    XCTAssertEqual(fr1, fr2); // note: pointer equality as it should return the same instance\n\n    [realm transactionWithBlock:^{ }];\n    RLMRealm *fr3 = realm.freeze;\n    RLMRealm *fr4 = realm.freeze;\n    XCTAssertEqual(fr3, fr4);\n    XCTAssertNotEqual(fr1, fr3);\n}\n\n- (void)testReadAfterInvalidateFrozen {\n    RLMRealm *realm = [RLMRealm defaultRealm].freeze;\n    [realm invalidate];\n    RLMAssertThrowsWithReason([IntObject allObjectsInRealm:realm],\n                              @\"Cannot read from a frozen Realm which has been invalidated.\");\n}\n\n- (void)testThaw {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    XCTAssertFalse(realm.frozen);\n\n    [realm beginWriteTransaction];\n    [IntObject createInRealm: realm withValue:@[@1]];\n    [realm commitWriteTransaction];\n\n    RLMRealm *frozenRealm = [realm freeze];\n    XCTAssertTrue(frozenRealm.frozen);\n    IntObject *frozenObj = [[IntObject objectsInRealm:frozenRealm where:@\"intCol = 1\"] firstObject];\n    XCTAssertTrue(frozenObj.frozen);\n\n    RLMRealm *thawedRealm = [realm thaw];\n    XCTAssertFalse(thawedRealm.frozen);\n    IntObject *thawedObj = [[IntObject objectsInRealm:thawedRealm where:@\"intCol = 1\"] firstObject];\n\n    [realm beginWriteTransaction];\n    thawedObj.intCol = 2;\n    [realm commitWriteTransaction];\n    XCTAssertNotEqual(thawedObj.intCol, frozenObj.intCol);\n\n    IntObject *nilObj = [[IntObject objectsInRealm:thawedRealm where:@\"intCol = 1\"] firstObject];\n    XCTAssertNil(nilObj);\n}\n\n- (void)testThawDifferentThread {\n    RLMRealm *frozenRealm = [[RLMRealm defaultRealm] freeze];\n    XCTAssertTrue(frozenRealm.frozen);\n\n    // Thaw on a thread which already has a Realm should use existing reference.\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        RLMRealm *thawed = [frozenRealm thaw];\n        XCTAssertFalse(thawed.frozen);\n        XCTAssertEqual(thawed, realm);\n    }];\n\n    // Thaw on thread without existing reference.\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *thawed = [frozenRealm thaw];\n        XCTAssertFalse(thawed.frozen);\n    }];\n}\n\n- (void)testThawPreviousVersion {\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    RLMRealm *frozenRealm = [realm freeze];\n    XCTAssertTrue(frozenRealm.frozen);\n    XCTAssertEqual(frozenRealm.isEmpty, [[RLMRealm defaultRealm] isEmpty]);\n\n    [realm beginWriteTransaction];\n    [IntObject createInDefaultRealmWithValue:@[@1]];\n    [realm commitWriteTransaction];\n    XCTAssertNotEqual(frozenRealm.isEmpty, realm.isEmpty, \"Contents of frozen Realm should not mutate\");\n\n\n    RLMRealm *thawed = [frozenRealm thaw];\n    XCTAssertFalse(thawed.isFrozen);\n    XCTAssertEqual(thawed.isEmpty, realm.isEmpty, \"Thawed realm should reflect transactions since the original reference was frozen\");\n    XCTAssertNotEqual(thawed.isEmpty, frozenRealm.isEmpty);\n}\n\n#pragma mark - Assorted tests\n\n- (void)testIsEmpty {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    XCTAssertTrue(realm.isEmpty, @\"Realm should be empty on creation.\");\n\n    [realm beginWriteTransaction];\n    [StringObject createInRealm:realm withValue:@[@\"a\"]];\n    XCTAssertFalse(realm.isEmpty, @\"Realm should not be empty within a write transaction after adding an object.\");\n    [realm cancelWriteTransaction];\n\n    XCTAssertTrue(realm.isEmpty, @\"Realm should be empty after canceling a write transaction that added an object.\");\n\n    [realm beginWriteTransaction];\n    [StringObject createInRealm:realm withValue:@[@\"a\"]];\n    [realm commitWriteTransaction];\n    XCTAssertFalse(realm.isEmpty, @\"Realm should not be empty after committing a write transaction that added an object.\");\n}\n\n- (void)testRealmFileAccessNilPath {\n    RLMAssertThrowsWithReasonMatching([RLMRealm realmWithURL:self.nonLiteralNil],\n                                      @\"Realm path must not be empty\", @\"nil path\");\n}\n\n- (void)testRealmFileAccessNoExistingFile {\n    NSURL *fileURL = [NSURL fileURLWithPath:RLMRealmPathForFile(@\"filename.realm\")];\n    [[NSFileManager defaultManager] removeItemAtPath:fileURL.path error:nil];\n    XCTAssertFalse([[NSFileManager defaultManager] fileExistsAtPath:fileURL.path]);\n\n    NSError *error;\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = fileURL;\n    XCTAssertNotNil([RLMRealm realmWithConfiguration:configuration error:&error],\n                    @\"Database should have been created\");\n    XCTAssertNil(error);\n}\n\n- (void)testRealmFileAccessInvalidFile {\n    NSString *content = @\"Some content\";\n    NSData *fileContents = [content dataUsingEncoding:NSUTF8StringEncoding];\n    NSURL *fileURL = [NSURL fileURLWithPath:RLMRealmPathForFile(@\"filename.realm\")];\n    [[NSFileManager defaultManager] removeItemAtPath:fileURL.path error:nil];\n    assert(![[NSFileManager defaultManager] fileExistsAtPath:fileURL.path]);\n    [[NSFileManager defaultManager] createFileAtPath:fileURL.path contents:fileContents attributes:nil];\n\n    NSError *error;\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration new];\n    configuration.fileURL = fileURL;\n    XCTAssertNil([RLMRealm realmWithConfiguration:configuration error:&error]);\n    RLMValidateRealmError(error, RLMErrorInvalidDatabase,\n                          @\"Failed to open Realm file at path '%@': file is non-empty but too small (12 bytes) to be a valid Realm.\", fileURL.path);\n}\n\n- (void)testRealmFileAccessFileIsDirectory {\n    NSURL *testURL = RLMTestRealmURL();\n    [[NSFileManager defaultManager] createDirectoryAtPath:testURL.path\n                              withIntermediateDirectories:NO\n                                               attributes:nil\n                                                    error:nil];\n    NSError *error;\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = testURL;\n    XCTAssertNil([RLMRealm realmWithConfiguration:configuration error:&error]);\n    RLMValidateRealmError(error, RLMErrorFileOperationFailed,\n                          @\"Failed to open Realm file at path '%@': Is a directory\", testURL.path);\n}\n\n#if !TARGET_OS_TV\n- (void)testRealmFifoError {\n    NSFileManager *manager = [NSFileManager defaultManager];\n    NSURL *testURL = RLMTestRealmURL();\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = testURL;\n\n    // Create the expected fifo URL and create a directory.\n    // Note that creating a file when a directory with the same name exists produces a different errno, which is good.\n    NSURL *fifoURL = [[testURL URLByDeletingPathExtension] URLByAppendingPathExtension:@\"realm.note\"];\n    assert(![manager fileExistsAtPath:fifoURL.path]);\n    [manager createDirectoryAtPath:fifoURL.path withIntermediateDirectories:YES attributes:nil error:nil];\n\n    // Ensure that it doesn't try to fall back to putting it in the temp directory\n    auto oldTempDir = realm::DBOptions::get_sys_tmp_dir();\n    realm::DBOptions::set_sys_tmp_dir(\"\");\n\n    NSError *error;\n    XCTAssertNil([RLMRealm realmWithConfiguration:configuration error:&error],\n                 @\"Should not have been able to open FIFO\");\n    RLMValidateRealmError(error, RLMErrorFileExists,\n                          @\"Cannot create fifo at path '%@': a non-fifo entry already exists at that path.\",\n                          [testURL.path stringByAppendingString:@\".note\"]);\n\n    realm::DBOptions::set_sys_tmp_dir(std::move(oldTempDir));\n}\n#endif\n\n- (void)testMultipleRealms {\n    // Create one StringObject in two different realms\n    RLMRealm *defaultRealm = [RLMRealm defaultRealm];\n    RLMRealm *testRealm = self.realmWithTestPath;\n    [defaultRealm beginWriteTransaction];\n    [testRealm beginWriteTransaction];\n    [StringObject createInRealm:defaultRealm withValue:@[@\"a\"]];\n    [StringObject createInRealm:testRealm withValue:@[@\"b\"]];\n    [testRealm commitWriteTransaction];\n    [defaultRealm commitWriteTransaction];\n\n    // Confirm that objects were added to the correct realms\n    RLMResults *defaultObjects = [StringObject allObjectsInRealm:defaultRealm];\n    RLMResults *testObjects = [StringObject allObjectsInRealm:testRealm];\n    XCTAssertEqual(defaultObjects.count, 1U, @\"Expecting 1 object\");\n    XCTAssertEqual(testObjects.count, 1U, @\"Expecting 1 object\");\n    XCTAssertEqualObjects([defaultObjects.firstObject stringCol], @\"a\", @\"Expecting column to be 'a'\");\n    XCTAssertEqualObjects([testObjects.firstObject stringCol], @\"b\", @\"Expecting column to be 'b'\");\n}\n\n// iOS uses a different locking scheme which breaks how we stop core from reinitializing the lock file\n#ifndef REALM_FILELOCK_EMULATION\n- (void)testInvalidLockFile {\n    // Create the realm file and lock file\n    @autoreleasepool { [RLMRealm defaultRealm]; }\n\n    NSString *path = RLMRealmConfiguration.defaultConfiguration.fileURL.path;\n    int fd = open([path stringByAppendingString:@\".lock\"].UTF8String, O_RDWR);\n    XCTAssertNotEqual(-1, fd);\n\n    // Change the value of the mutex size field in the shared info header\n    uint8_t value = 255;\n    pwrite(fd, &value, 1, 1);\n\n    // Ensure that SharedGroup can't get an exclusive lock on the lock file so\n    // that it can't just recreate it\n    int ret = flock(fd, LOCK_SH);\n    XCTAssertEqual(0, ret);\n\n    NSError *error;\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:RLMRealmConfiguration.defaultConfiguration error:&error];\n    XCTAssertNil(realm);\n    RLMValidateRealmError(error, RLMErrorIncompatibleLockFile, @\"Realm file '%@' is currently open in another process which cannot share access with this process. This could either be due to the existing process being a different architecture or due to the existing process using an incompatible version of Realm. If the other process is Realm Studio, you may need to update it (or update Realm if your Studio version is too new), and if using an iOS simulator, make sure that you are using a 64-bit simulator. Underlying problem: Architecture mismatch: Mutex size is 255 but should be 1.\", path);\n\n    flock(fd, LOCK_UN);\n    close(fd);\n}\n#endif\n\n- (void)testCannotMigrateRealmWhenRealmIsOpen {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = realm.configuration.fileURL;\n    XCTAssertThrows([RLMRealm performMigrationForConfiguration:configuration error:nil]);\n}\n\n- (void)testNotificationPipeBufferOverfull {\n    RLMRealm *realm = [self inMemoryRealmWithIdentifier:@\"test\"];\n    // pipes have a 8 KB buffer on OS X, so verify we don't block after 8192 commits\n    for (int i = 0; i < 9000; ++i) {\n        [realm transactionWithBlock:^{}];\n    }\n}\n\n- (NSArray *)pathsFor100Realms {\n    NSMutableArray *paths = [NSMutableArray array];\n    for (int i = 0; i < 100; ++i) {\n        NSString *realmFileName = [NSString stringWithFormat:@\"test.%d.realm\", i];\n        [paths addObject:RLMRealmPathForFile(realmFileName)];\n    }\n    return paths;\n}\n\n- (void)testCanCreate100RealmsWithoutBreakingGCD {\n    NSMutableArray *realms = [NSMutableArray array];\n    for (NSString *realmPath in self.pathsFor100Realms) {\n        [realms addObject:[RLMRealm realmWithURL:[NSURL fileURLWithPath:realmPath]]];\n    }\n\n    XCTestExpectation *expectation = [self expectationWithDescription:@\"Block dispatched to concurrent queue should be executed\"];\n    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{\n        [expectation fulfill];\n    });\n    [self waitForExpectationsWithTimeout:1 handler:nil];\n}\n\n- (void)testThreadIDReuse {\n    // Open Realms on new threads until we get repeated thread IDs, while\n    // retaining each Realm opened. This verifies that we don't get a Realm from\n    // an old thread that no longer exists from the cache.\n    NSMutableArray *realms = [NSMutableArray array];\n    std::unordered_set<pthread_t> threadIds;\n    bool done = false;\n    while (!done) {\n        std::thread([&] {\n            RLMRealm *realm = [RLMRealm defaultRealm];\n            [realms addObject:realm];\n            (void)[IntObject allObjectsInRealm:realm].count;\n            [realm refresh];\n            if (!threadIds.insert(pthread_self()).second) {\n                done = true;\n            }\n        }).join();\n    }\n}\n\n- (void)testAuxiliaryFilesAreExcludedFromBackup {\n    RLMSetSkipBackupAttribute(true);\n    @autoreleasepool { [RLMRealm defaultRealm]; }\n\n#if TARGET_OS_TV\n    NSArray *auxiliaryFileExtensions = @[@\"management\", @\"lock\"]; // tvOS does not support named pipes\n#else\n    NSArray *auxiliaryFileExtensions = @[@\"management\", @\"lock\", @\"note\"];\n#endif\n    NSURL *fileURL = RLMRealmConfiguration.defaultConfiguration.fileURL;\n    for (NSString *pathExtension in auxiliaryFileExtensions) {\n        NSNumber *attribute = nil;\n        NSError *error = nil;\n        BOOL success = [[fileURL URLByAppendingPathExtension:pathExtension] getResourceValue:&attribute forKey:NSURLIsExcludedFromBackupKey error:&error];\n        XCTAssertTrue(success);\n        XCTAssertNil(error);\n        XCTAssertTrue(attribute.boolValue);\n    }\n    RLMSetSkipBackupAttribute(false);\n}\n\n- (void)testAuxiliaryFilesAreExcludedFromBackupPerformance {\n    RLMSetSkipBackupAttribute(true);\n    [self measureBlock:^{\n        @autoreleasepool {\n            [RLMRealm defaultRealm];\n            [RLMRealm defaultRealm];\n            [RLMRealm defaultRealm];\n            [RLMRealm defaultRealm];\n            [RLMRealm defaultRealm];\n            [RLMRealm defaultRealm];\n            [RLMRealm defaultRealm];\n            [RLMRealm defaultRealm];\n            [RLMRealm defaultRealm];\n            [RLMRealm defaultRealm];\n            [RLMRealm defaultRealm];\n            [RLMRealm defaultRealm];\n            [RLMRealm defaultRealm];\n            [RLMRealm defaultRealm];\n        }\n        @autoreleasepool { [RLMRealm defaultRealm]; }\n    }];\n\n    NSURL *fileURL = RLMRealmConfiguration.defaultConfiguration.fileURL;\n#if !TARGET_OS_TV\n    for (NSString *pathExtension in @[@\"management\", @\"lock\", @\"note\"]) {\n#else\n    for (NSString *pathExtension in @[@\"management\", @\"lock\"]) {\n#endif\n        NSNumber *attribute = nil;\n        NSError *error = nil;\n        BOOL success = [[fileURL URLByAppendingPathExtension:pathExtension] getResourceValue:&attribute forKey:NSURLIsExcludedFromBackupKey error:&error];\n        XCTAssertTrue(success);\n        XCTAssertNil(error);\n        XCTAssertTrue(attribute.boolValue);\n    }\n}\n\n- (void)testRealmExists {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    XCTAssertFalse([RLMRealm fileExistsForConfiguration:config]);\n    @autoreleasepool { [RLMRealm realmWithConfiguration:config error:nil]; }\n    XCTAssertTrue([RLMRealm fileExistsForConfiguration:config]);\n    [RLMRealm deleteFilesForConfiguration:config error:nil];\n    XCTAssertFalse([RLMRealm fileExistsForConfiguration:config]);\n}\n\n- (void)testDeleteNonexistentRealmFile {\n    NSError *error;\n    XCTAssertFalse([RLMRealm deleteFilesForConfiguration:RLMRealmConfiguration.defaultConfiguration error:&error]);\n    XCTAssertNil(error);\n}\n\n- (void)testDeleteClosedRealmFile {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    @autoreleasepool { [RLMRealm realmWithConfiguration:config error:nil]; }\n\n    NSError *error;\n    XCTAssertTrue([RLMRealm deleteFilesForConfiguration:config error:&error]);\n    XCTAssertNil(error);\n\n    NSFileManager *fm = NSFileManager.defaultManager;\n    XCTAssertTrue([fm fileExistsAtPath:[config.fileURL.path stringByAppendingPathExtension:@\"lock\"]]);\n    XCTAssertFalse([fm fileExistsAtPath:[config.fileURL.path stringByAppendingPathExtension:@\"management\"]]);\n#if !TARGET_OS_TV\n    XCTAssertFalse([fm fileExistsAtPath:[config.fileURL.path stringByAppendingPathExtension:@\"note\"]]);\n#endif\n}\n\n- (void)testDeleteRealmFileWithMissingManagementFiles {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    [NSFileManager.defaultManager createFileAtPath:config.fileURL.path contents:nil attributes:nil];\n\n    NSError *error;\n    XCTAssertTrue([RLMRealm deleteFilesForConfiguration:config error:&error]);\n    XCTAssertNil(error);\n}\n\n- (void)testDeleteRealmFileWithReadOnlyManagementFiles {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    NSFileManager *fm = NSFileManager.defaultManager;\n    [fm createFileAtPath:config.fileURL.path contents:nil attributes:nil];\n    NSString *notificationPipe = [config.fileURL.path stringByAppendingPathExtension:@\"note\"];\n    [fm createFileAtPath:notificationPipe contents:nil attributes:@{NSFileImmutable: @YES}];\n\n    NSError *error;\n    XCTAssertTrue([RLMRealm deleteFilesForConfiguration:config error:&error]);\n    XCTAssertEqual(error.domain, NSCocoaErrorDomain);\n    XCTAssertEqual(error.code, NSFileWriteNoPermissionError);\n    [fm setAttributes:@{NSFileImmutable: @NO} ofItemAtPath:notificationPipe error:nil];\n}\n\n- (void)testDeleteOpenRealmFile {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    __attribute__((objc_precise_lifetime)) RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n\n    NSError *error;\n    XCTAssertFalse([RLMRealm deleteFilesForConfiguration:config error:&error]);\n    XCTAssertEqual(error.code, RLMErrorAlreadyOpen);\n    XCTAssertTrue([NSFileManager.defaultManager fileExistsAtPath:config.fileURL.path]);\n}\n@end\n\n@interface RLMLoggerTests : RLMTestCase\n@property (nonatomic, strong) RLMLogger *logger;\n@end\n\n@implementation RLMLoggerTests\n- (void)setUp {\n    _logger = RLMLogger.defaultLogger;\n}\n- (void)tearDown {\n    RLMLogger.defaultLogger = _logger;\n}\n- (void)testSetDefaultLogLevel {\n    __block NSMutableString *logs = [[NSMutableString alloc] init];\n    RLMLogger *logger = [[RLMLogger alloc] initWithLevel:RLMLogLevelAll logFunction:^(RLMLogLevel level, NSString *message) {\n        [logs appendFormat:@\" %@ %lu %@\", [NSDate date], level, message];\n    }];\n    RLMLogger.defaultLogger = logger;\n\n    @autoreleasepool { [RLMRealm defaultRealm]; }\n    XCTAssertEqual([RLMLogger defaultLogger].level, RLMLogLevelAll);\n    XCTAssertTrue([logs containsString:@\"5 DB:\"]); // Detail\n    XCTAssertTrue([logs containsString:@\"7 DB:\"]); // Trace\n\n    [logs setString: @\"\"];\n    logger.level = RLMLogLevelDetail;\n    @autoreleasepool { [RLMRealm defaultRealm]; }\n    XCTAssertEqual([RLMLogger defaultLogger].level, RLMLogLevelDetail);\n    XCTAssertTrue([logs containsString:@\"5 DB:\"]); // Detail\n    XCTAssertFalse([logs containsString:@\"7 DB:\"]); // Trace\n}\n\n- (void)testDefaultLogger {\n    __block NSMutableString *logs = [[NSMutableString alloc] init];\n    RLMLogger *logger = [[RLMLogger alloc] initWithLevel:RLMLogLevelOff\n                                             logFunction:^(RLMLogLevel level, NSString *message) {\n        [logs appendFormat:@\" %@ %lu %@\", [NSDate date], level, message];\n    }];\n    RLMLogger.defaultLogger = logger;\n    XCTAssertEqual(RLMLogger.defaultLogger.level, RLMLogLevelOff);\n\n    @autoreleasepool { [RLMRealm defaultRealm]; }\n    XCTAssertTrue([logs length] == 0);\n\n    // Test LogLevel Detail\n    logger.level = RLMLogLevelDetail;\n    @autoreleasepool { [RLMRealm defaultRealm]; }\n    XCTAssertTrue([logs length] > 0);\n    XCTAssertTrue([logs containsString:@\"5 DB:\"]); // Detail\n    XCTAssertFalse([logs containsString:@\"7 DB:\"]); // Trace\n\n    // Test LogLevel All\n    logger.level = RLMLogLevelAll;\n    @autoreleasepool { [RLMRealm defaultRealm]; }\n    XCTAssertTrue([logs length] > 0);\n    XCTAssertTrue([logs containsString:@\"5 DB:\"]); // Detail\n    XCTAssertTrue([logs containsString:@\"7 DB:\"]); // Trace\n\n    [logs setString: @\"\"];\n    // Init Custom Logger\n    RLMLogger.defaultLogger = [[RLMLogger alloc] initWithLevel:RLMLogLevelDebug\n                                                   logFunction:^(RLMLogLevel level, NSString * message) {\n        [logs appendFormat:@\" %@ %lu %@\", [NSDate date], level, message];\n    }];\n\n    XCTAssertEqual(RLMLogger.defaultLogger.level, RLMLogLevelDebug);\n    @autoreleasepool { [RLMRealm defaultRealm]; }\n    XCTAssertTrue([logs containsString:@\"5 DB:\"]); // Detail\n    XCTAssertFalse([logs containsString:@\"7 DB:\"]); // Trace\n}\n\n- (void)testCustomLoggerLogMessage {\n    __block NSMutableString *logs = [[NSMutableString alloc] init];\n    RLMLogger *logger = [[RLMLogger alloc] initWithLevel:RLMLogLevelInfo\n                                             logFunction:^(RLMLogLevel level, NSString * message) {\n        [logs appendFormat:@\" %@ %lu %@.\", [NSDate date], level, message];\n    }];\n    RLMLogger.defaultLogger = logger;\n\n    [logger logWithLevel:RLMLogLevelInfo message:@\"%@ IMPORTANT INFO %i\", @\"TEST:\", 0];\n    [logger logWithLevel:RLMLogLevelTrace message:@\"IMPORTANT TRACE\"];\n    XCTAssertTrue([logs containsString:@\"TEST: IMPORTANT INFO 0\"]); // Detail\n    XCTAssertFalse([logs containsString:@\"IMPORTANT TRACE\"]); // Trace\n}\n@end\n"
  },
  {
    "path": "Realm/Tests/ResultsTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#import <mach/mach.h>\n#import <objc/runtime.h>\n\n@interface ResultsTests : RLMTestCase\n@end\n\n@implementation ResultsTests\n\n- (void)testFastEnumeration\n{\n    RLMRealm *realm = self.realmWithTestPath;\n\n    // enumerate empty array\n    for (__unused id obj in [AggregateObject allObjectsInRealm:realm]) {\n        XCTFail(@\"Should be empty\");\n    }\n\n    [realm beginWriteTransaction];\n    for (int i = 0; i < 18; ++i) {\n        [AggregateObject createInRealm:realm withValue:@[@10, @1.2f, @0.0, @YES, NSDate.date]];\n    }\n    [realm commitWriteTransaction];\n\n    RLMResults *result = [AggregateObject objectsInRealm:realm where:@\"intCol < %i\", 100];\n    XCTAssertEqual(result.count, 18U);\n\n    __weak id objects[18];\n    NSInteger count = 0;\n    for (AggregateObject *ao in result) {\n        XCTAssertNotNil(ao, @\"Object is not nil and accessible\");\n        if (count > 16) {\n            // 16 is the size of blocks fast enumeration happens to ask for at\n            // the moment, but of course that's just an implementation detail\n            // that may change\n            XCTAssertNil(objects[count - 16]);\n        }\n        objects[count++] = ao;\n    }\n\n    XCTAssertEqual(count, 18, @\"should have enumerated 18 objects\");\n\n    for (int i = 0; i < count; i++) {\n        XCTAssertNil(objects[i], @\"Object should have been released\");\n    }\n\n    @autoreleasepool {\n        for (AggregateObject *ao in result) {\n            objects[0] = ao;\n            break;\n        }\n    }\n    XCTAssertNil(objects[0], @\"Object should have been released\");\n}\n\n- (void)testFirst {\n    XCTAssertNil(IntObject.allObjects.firstObject);\n    XCTAssertNil([IntObject objectsWhere:@\"intCol > 5\"].firstObject);\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    [IntObject createInDefaultRealmWithValue:@[@10]];\n    [IntObject createInDefaultRealmWithValue:@[@20]];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(10, [IntObject.allObjects.firstObject intCol]);\n    XCTAssertEqual(10, [[IntObject objectsWhere:@\"intCol > 5\"].firstObject intCol]);\n    XCTAssertEqual(20, [[IntObject objectsWhere:@\"intCol > 10\"].firstObject intCol]);\n}\n\n- (void)testLast {\n    XCTAssertNil(IntObject.allObjects.lastObject);\n    XCTAssertNil([IntObject objectsWhere:@\"intCol > 5\"].lastObject);\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    [IntObject createInDefaultRealmWithValue:@[@20]];\n    [IntObject createInDefaultRealmWithValue:@[@10]];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(10, [IntObject.allObjects.lastObject intCol]);\n    XCTAssertEqual(10, [[IntObject objectsWhere:@\"intCol > 5\"].lastObject intCol]);\n    XCTAssertEqual(20, [[IntObject objectsWhere:@\"intCol > 10\"].lastObject intCol]);\n}\n\n- (void)testSubscript {\n    RLMAssertThrowsWithReasonMatching([IntObject allObjects][0], @\"0.*less than 0\");\n    RLMAssertThrowsWithReasonMatching([IntObject objectsWhere:@\"intCol > 5\"][0], @\"0.*less than 0\");\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    [IntObject createInDefaultRealmWithValue:@[@10]];\n    [IntObject createInDefaultRealmWithValue:@[@20]];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(10, [IntObject.allObjects[0] intCol]);\n    XCTAssertEqual(10, [[IntObject objectsWhere:@\"intCol > 5\"][0] intCol]);\n    XCTAssertEqual(20, [[IntObject objectsWhere:@\"intCol > 10\"][0] intCol]);\n\n    RLMAssertThrowsWithReasonMatching([IntObject allObjects][2], @\"2.*less than 2\");\n    RLMAssertThrowsWithReasonMatching([IntObject objectsWhere:@\"intCol > 5\"][2], @\"2.*less than 2\");\n}\n\n- (void)testObjectsAtIndexes {\n    NSMutableIndexSet *indexSet = [NSMutableIndexSet new];\n    [indexSet addIndex:0];\n    [indexSet addIndex:1];\n\n    XCTAssertNil([[IntObject allObjects] objectsAtIndexes:indexSet]);\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    [IntObject createInDefaultRealmWithValue:@[@10]];\n    [IntObject createInDefaultRealmWithValue:@[@20]];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual([[[IntObject allObjects] objectsAtIndexes:indexSet][0] intCol], 10);\n    XCTAssertEqual([[[IntObject allObjects] objectsAtIndexes:indexSet][1] intCol], 20);\n\n    [indexSet addIndex:3];\n    XCTAssertNil([[IntObject allObjects] objectsAtIndexes:indexSet]);\n    XCTAssertNil([[IntObject allObjects] objectsAtIndexes:indexSet]);\n}\n\n- (void)testValueForKey {\n    RLMRealm *realm = self.realmWithTestPath;\n\n    [realm beginWriteTransaction];\n\n    XCTAssertEqualObjects([[AggregateObject allObjectsInRealm:realm] valueForKey:@\"intCol\"], @[]);\n\n    NSDate *dateMinInput = [NSDate date];\n    NSDate *dateMaxInput = [dateMinInput dateByAddingTimeInterval:1000];\n\n    [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n    [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n    [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n    [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n    [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n    [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n    [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n    [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n    [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n    [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n\n    XCTAssertEqualObjects([[AggregateObject allObjectsInRealm:realm] valueForKey:@\"intCol\"],\n                          (@[@0, @1, @0, @1, @0, @1, @0, @1, @0, @0]));\n    XCTAssertTrue([[[[AggregateObject allObjectsInRealm:realm] valueForKey:@\"self\"] firstObject]\n                   isEqualToObject:[AggregateObject allObjectsInRealm:realm].firstObject]);\n    XCTAssertTrue([[[[AggregateObject allObjectsInRealm:realm] valueForKey:@\"self\"] lastObject]\n                   isEqualToObject:[AggregateObject allObjectsInRealm:realm].lastObject]);\n\n    XCTAssertEqualObjects([[AggregateObject objectsInRealm:realm where:@\"intCol != 1\"] valueForKey:@\"intCol\"],\n                          (@[@0, @0, @0, @0, @0, @0]));\n    XCTAssertTrue([[[[AggregateObject objectsInRealm:realm where:@\"intCol != 1\"] valueForKey:@\"self\"] firstObject]\n                   isEqualToObject:[AggregateObject objectsInRealm:realm where:@\"intCol != 1\"].firstObject]);\n    XCTAssertTrue([[[[AggregateObject objectsInRealm:realm where:@\"intCol != 1\"] valueForKey:@\"self\"] lastObject]\n                   isEqualToObject:[AggregateObject objectsInRealm:realm where:@\"intCol != 1\"].lastObject]);\n\n    [realm commitWriteTransaction];\n\n    XCTAssertEqualObjects([[AggregateObject allObjectsInRealm:realm] valueForKey:@\"intCol\"],\n                          (@[@0, @1, @0, @1, @0, @1, @0, @1, @0, @0]));\n    XCTAssertEqualObjects([[AggregateObject objectsInRealm:realm where:@\"intCol != 1\"] valueForKey:@\"intCol\"],\n                          (@[@0, @0, @0, @0, @0, @0]));\n\n    XCTAssertThrows([[AggregateObject allObjectsInRealm:realm] valueForKey:@\"invalid\"]);\n}\n\n- (void)testSetValueForKey {\n    RLMRealm *realm = self.realmWithTestPath;\n\n    [realm beginWriteTransaction];\n\n    NSDate *dateMinInput = [NSDate date];\n    NSDate *dateMaxInput = [dateMinInput dateByAddingTimeInterval:1000];\n\n    [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n    [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n    [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n    [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n    [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n    [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n    [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n    [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n    [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n    [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n\n    [[AggregateObject allObjectsInRealm:realm] setValue:@25 forKey:@\"intCol\"];\n    XCTAssertEqualObjects([[AggregateObject allObjectsInRealm:realm] valueForKey:@\"intCol\"],\n                          (@[@25, @25, @25, @25, @25, @25, @25, @25, @25, @25]));\n\n    [[AggregateObject objectsInRealm:realm where:@\"floatCol > 1\"] setValue:@10 forKey:@\"intCol\"];\n    XCTAssertEqualObjects([[AggregateObject objectsInRealm:realm where:@\"floatCol > 1\"] valueForKey:@\"intCol\"],\n                          (@[@10, @10, @10, @10, @10, @10]));\n\n    XCTAssertThrows([[AggregateObject allObjectsInRealm:realm] valueForKey:@\"invalid\"]);\n\n    [[AggregateObject objectsInRealm:realm where:@\"intCol != 5\"] setValue:@5 forKey:@\"intCol\"];\n    XCTAssertEqualObjects([[AggregateObject allObjectsInRealm:realm] valueForKey:@\"intCol\"],\n                          (@[@5, @5, @5, @5, @5, @5, @5, @5, @5, @5]));\n\n    [realm commitWriteTransaction];\n\n    RLMAssertThrowsWithReasonMatching([[AggregateObject allObjectsInRealm:realm] setValue:@25 forKey:@\"intCol\"],\n                                      @\"write transaction\");\n    RLMAssertThrowsWithReasonMatching([[AggregateObject objectsInRealm:realm where:@\"floatCol > 1\"] setValue:@10 forKey:@\"intCol\"],\n                                      @\"write transaction\");\n}\n\n- (void)testObjectAggregate\n{\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    RLMResults *noArray = [AggregateObject objectsWhere:@\"boolCol == NO\"];\n    RLMResults *yesArray = [AggregateObject objectsWhere:@\"boolCol == YES\"];\n    RLMResults *allArray = [AggregateObject allObjects];\n\n    XCTAssertEqual(0, [noArray sumOfProperty:@\"intCol\"].intValue);\n    XCTAssertEqual(0, [allArray sumOfProperty:@\"intCol\"].intValue);\n\n    XCTAssertNil([noArray averageOfProperty:@\"intCol\"]);\n    XCTAssertNil([allArray averageOfProperty:@\"intCol\"]);\n    XCTAssertNil([noArray minOfProperty:@\"intCol\"]);\n    XCTAssertNil([allArray minOfProperty:@\"intCol\"]);\n    XCTAssertNil([noArray maxOfProperty:@\"intCol\"]);\n    XCTAssertNil([allArray maxOfProperty:@\"intCol\"]);\n\n    [realm beginWriteTransaction];\n\n    NSDate *dateMinInput = [NSDate date];\n    NSDate *dateMaxInput = [dateMinInput dateByAddingTimeInterval:1000];\n\n    [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput, @0.0]];\n    [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput, @2.5]];\n    [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput, @0.0]];\n    [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput, @2.5]];\n    [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput, @0.0]];\n    [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput, @2.5]];\n    [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput, @0.0]];\n    [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput, @2.5]];\n    [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput, @0.0]];\n    [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput, @0.0]];\n\n    [realm commitWriteTransaction];\n\n    // SUM ::::::::::::::::::::::::::::::::::::::::::::::\n    // Test int sum\n    XCTAssertEqual([noArray sumOfProperty:@\"intCol\"].integerValue, 4);\n    XCTAssertEqual([yesArray sumOfProperty:@\"intCol\"].integerValue, 0);\n    XCTAssertEqual([allArray sumOfProperty:@\"intCol\"].integerValue, 4);\n\n    // Test float sum\n    XCTAssertEqualWithAccuracy([noArray sumOfProperty:@\"floatCol\"].floatValue, 0.0f, 0.1f);\n    XCTAssertEqualWithAccuracy([yesArray sumOfProperty:@\"floatCol\"].floatValue, 7.2f, 0.1f);\n    XCTAssertEqualWithAccuracy([allArray sumOfProperty:@\"floatCol\"].floatValue, 7.2f, 0.1f);\n\n    // Test double sum\n    XCTAssertEqualWithAccuracy([noArray sumOfProperty:@\"doubleCol\"].doubleValue, 10.0, 0.1f);\n    XCTAssertEqualWithAccuracy([yesArray sumOfProperty:@\"doubleCol\"].doubleValue, 0.0, 0.1f);\n    XCTAssertEqualWithAccuracy([allArray sumOfProperty:@\"doubleCol\"].doubleValue, 10.0, 0.1f);\n\n    // Test RLMValue sum\n    XCTAssertEqualWithAccuracy([noArray sumOfProperty:@\"anyCol\"].doubleValue, 10.0, 0.1f);\n    XCTAssertEqualWithAccuracy([yesArray sumOfProperty:@\"anyCol\"].doubleValue, 0.0, 0.1f);\n    XCTAssertEqualWithAccuracy([allArray sumOfProperty:@\"anyCol\"].doubleValue, 10.0, 0.1f);\n\n    // Test invalid column name\n    RLMAssertThrowsWithReasonMatching([yesArray sumOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n    RLMAssertThrowsWithReasonMatching([allArray sumOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n\n    // Test operation not supported\n    RLMAssertThrowsWithReasonMatching([yesArray sumOfProperty:@\"boolCol\"], @\"sum.*bool\");\n    RLMAssertThrowsWithReasonMatching([allArray sumOfProperty:@\"boolCol\"], @\"sum.*bool\");\n\n\n    // Average ::::::::::::::::::::::::::::::::::::::::::::::\n    // Test int average\n    XCTAssertEqualWithAccuracy([noArray averageOfProperty:@\"intCol\"].doubleValue, 1.0, 0.1f);\n    XCTAssertEqualWithAccuracy([yesArray averageOfProperty:@\"intCol\"].doubleValue, 0.0, 0.1f);\n    XCTAssertEqualWithAccuracy([allArray averageOfProperty:@\"intCol\"].doubleValue, 0.4, 0.1f);\n\n    // Test float average\n    XCTAssertEqualWithAccuracy([noArray averageOfProperty:@\"floatCol\"].doubleValue, 0.0, 0.1f);\n    XCTAssertEqualWithAccuracy([yesArray averageOfProperty:@\"floatCol\"].doubleValue, 1.2, 0.1f);\n    XCTAssertEqualWithAccuracy([allArray averageOfProperty:@\"floatCol\"].doubleValue, 0.72, 0.1f);\n\n    // Test double average\n    XCTAssertEqualWithAccuracy([noArray averageOfProperty:@\"doubleCol\"].doubleValue, 2.5, 0.1f);\n    XCTAssertEqualWithAccuracy([yesArray averageOfProperty:@\"doubleCol\"].doubleValue, 0.0, 0.1f);\n    XCTAssertEqualWithAccuracy([allArray averageOfProperty:@\"doubleCol\"].doubleValue, 1.0, 0.1f);\n\n    // Test RLMValue average\n    XCTAssertEqualWithAccuracy([noArray averageOfProperty:@\"anyCol\"].doubleValue, 2.5, 0.1f);\n    XCTAssertEqualWithAccuracy([yesArray averageOfProperty:@\"anyCol\"].doubleValue, 0.0, 0.1f);\n    XCTAssertEqualWithAccuracy([allArray averageOfProperty:@\"anyCol\"].doubleValue, 1.0, 0.1f);\n\n    // Test invalid column name\n    RLMAssertThrowsWithReasonMatching([yesArray averageOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n    RLMAssertThrowsWithReasonMatching([allArray averageOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n\n    // Test operation not supported\n    RLMAssertThrowsWithReasonMatching([yesArray averageOfProperty:@\"boolCol\"], @\"average.*bool\");\n    RLMAssertThrowsWithReasonMatching([allArray averageOfProperty:@\"boolCol\"], @\"average.*bool\");\n\n    // MIN ::::::::::::::::::::::::::::::::::::::::::::::\n    // Test int min\n    XCTAssertEqual(1, [[noArray minOfProperty:@\"intCol\"] intValue]);\n    XCTAssertEqual(0, [[yesArray minOfProperty:@\"intCol\"] intValue]);\n    XCTAssertEqual(0, [[allArray minOfProperty:@\"intCol\"] intValue]);\n\n    // Test float min\n    XCTAssertEqual(0.0f, [[noArray minOfProperty:@\"floatCol\"] floatValue]);\n    XCTAssertEqual(1.2f, [[yesArray minOfProperty:@\"floatCol\"] floatValue]);\n    XCTAssertEqual(0.0f, [[allArray minOfProperty:@\"floatCol\"] floatValue]);\n\n    // Test double min\n    XCTAssertEqual(2.5, [[noArray minOfProperty:@\"doubleCol\"] doubleValue]);\n    XCTAssertEqual(0.0, [[yesArray minOfProperty:@\"doubleCol\"] doubleValue]);\n    XCTAssertEqual(0.0, [[allArray minOfProperty:@\"doubleCol\"] doubleValue]);\n\n    // Test RLMValue min\n    XCTAssertEqual(2.5, [[noArray minOfProperty:@\"anyCol\"] doubleValue]);\n    XCTAssertEqual(0.0, [[yesArray minOfProperty:@\"anyCol\"] doubleValue]);\n    XCTAssertEqual(0.0, [[allArray minOfProperty:@\"anyCol\"] doubleValue]);\n\n    // Test date min\n    XCTAssertEqualObjects(dateMaxInput, [noArray minOfProperty:@\"dateCol\"]);\n    XCTAssertEqualObjects(dateMinInput, [yesArray minOfProperty:@\"dateCol\"]);\n    XCTAssertEqualObjects(dateMinInput, [allArray minOfProperty:@\"dateCol\"]);\n\n    // Test invalid column name\n    RLMAssertThrowsWithReasonMatching([yesArray minOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n    RLMAssertThrowsWithReasonMatching([allArray minOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n\n    // Test operation not supported\n    RLMAssertThrowsWithReasonMatching([yesArray minOfProperty:@\"boolCol\"], @\"min.*bool\");\n    RLMAssertThrowsWithReasonMatching([allArray minOfProperty:@\"boolCol\"], @\"min.*bool\");\n\n    // MAX ::::::::::::::::::::::::::::::::::::::::::::::\n    // Test int max\n    XCTAssertEqual(1, [[noArray maxOfProperty:@\"intCol\"] intValue]);\n    XCTAssertEqual(0, [[yesArray maxOfProperty:@\"intCol\"] intValue]);\n    XCTAssertEqual(1, [[allArray maxOfProperty:@\"intCol\"] intValue]);\n\n    // Test float max\n    XCTAssertEqual(0.0f, [[noArray maxOfProperty:@\"floatCol\"] floatValue]);\n    XCTAssertEqual(1.2f, [[yesArray maxOfProperty:@\"floatCol\"] floatValue]);\n    XCTAssertEqual(1.2f, [[allArray maxOfProperty:@\"floatCol\"] floatValue]);\n\n    // Test double max\n    XCTAssertEqual(2.5, [[noArray maxOfProperty:@\"doubleCol\"] doubleValue]);\n    XCTAssertEqual(0.0, [[yesArray maxOfProperty:@\"doubleCol\"] doubleValue]);\n    XCTAssertEqual(2.5, [[allArray maxOfProperty:@\"doubleCol\"] doubleValue]);\n\n    // Test RLMValue max\n    XCTAssertEqual(2.5, [[noArray maxOfProperty:@\"anyCol\"] doubleValue]);\n    XCTAssertEqual(0.0, [[yesArray maxOfProperty:@\"anyCol\"] doubleValue]);\n    XCTAssertEqual(2.5, [[allArray maxOfProperty:@\"anyCol\"] doubleValue]);\n\n    // Test date max\n    XCTAssertEqualObjects(dateMaxInput, [noArray maxOfProperty:@\"dateCol\"]);\n    XCTAssertEqualObjects(dateMinInput, [yesArray maxOfProperty:@\"dateCol\"]);\n    XCTAssertEqualObjects(dateMaxInput, [allArray maxOfProperty:@\"dateCol\"]);\n\n    // Test invalid column name\n    RLMAssertThrowsWithReasonMatching([yesArray maxOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n    RLMAssertThrowsWithReasonMatching([allArray maxOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n\n    // Test operation not supported\n    RLMAssertThrowsWithReasonMatching([yesArray maxOfProperty:@\"boolCol\"], @\"max.*bool\");\n    RLMAssertThrowsWithReasonMatching([allArray maxOfProperty:@\"boolCol\"], @\"max.*bool\");\n}\n\n- (void)testRenamedPropertyAggregate {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    RLMResults *results = [RenamedProperties1 allObjectsInRealm:realm];\n    XCTAssertEqual(0, [results sumOfProperty:@\"propA\"].intValue);\n    XCTAssertNil([results averageOfProperty:@\"propA\"]);\n    XCTAssertNil([results minOfProperty:@\"propA\"]);\n    XCTAssertNil([results maxOfProperty:@\"propA\"]);\n    XCTAssertThrows([results sumOfProperty:@\"prop 1\"]);\n\n    [realm transactionWithBlock:^{\n        [RenamedProperties1 createInRealm:realm withValue:@[@1, @\"\"]];\n        [RenamedProperties1 createInRealm:realm withValue:@[@2, @\"\"]];\n        [RenamedProperties1 createInRealm:realm withValue:@[@3, @\"\"]];\n    }];\n\n    XCTAssertEqual(6, [results sumOfProperty:@\"propA\"].intValue);\n    XCTAssertEqual(2.0, [results averageOfProperty:@\"propA\"].doubleValue);\n    XCTAssertEqual(1, [[results minOfProperty:@\"propA\"] intValue]);\n    XCTAssertEqual(3, [[results maxOfProperty:@\"propA\"] intValue]);\n}\n\n-(void)testRenamedPropertyObservation {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm transactionWithBlock:^{\n        [LinkToRenamedProperties createInRealm:realm withValue:@[]];\n    }];\n\n    __block bool first = true;\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    RLMResults<LinkToRenamedProperties *> *allObjects = [LinkToRenamedProperties allObjectsInRealm:realm];\n    id token = [allObjects addNotificationBlock:^(__unused RLMResults *results, RLMCollectionChange *change, __unused NSError *error) {\n        XCTAssertNotNil(results);\n        XCTAssert(first ? !change : !!change);\n        XCTAssertNil(error);\n        first = false;\n        [expectation fulfill];\n    } keyPaths:@[@\"link\"]];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = self.realmWithTestPath;\n        [realm transactionWithBlock:^{\n            LinkToRenamedProperties *object = (LinkToRenamedProperties *)[LinkToRenamedProperties allObjectsInRealm:realm].firstObject;\n            RenamedProperties *linkedObject = [RenamedProperties createInRealm:realm withValue:@[@1, @\"\"]];\n            object.link = linkedObject;\n        }];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testValueForCollectionOperationKeyPath {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    EmployeeObject *c1e1 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES}];\n    EmployeeObject *c1e2 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"John\", @\"age\": @30, @\"hired\": @NO}];\n    EmployeeObject *c1e3 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Jill\", @\"age\": @25, @\"hired\": @YES}];\n    [CompanyObject createInRealm:realm withValue:@{@\"name\": @\"InspiringNames LLC\", @\"employees\": @[c1e1, c1e2, c1e3], @\"employeeSet\": @[c1e1, c1e2, c1e3]}];\n\n    EmployeeObject *c2e1 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"A\", @\"age\": @20, @\"hired\": @YES}];\n    EmployeeObject *c2e2 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"B\", @\"age\": @30, @\"hired\": @NO}];\n    EmployeeObject *c2e3 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"C\", @\"age\": @40, @\"hired\": @YES}];\n    [CompanyObject createInRealm:realm withValue:@{@\"name\": @\"ABC AG\", @\"employees\": @[c2e1, c2e2, c2e3], @\"employeeSet\": @[c2e1, c2e2, c2e3]}];\n\n    EmployeeObject *c3e1 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"A\", @\"age\": @21, @\"hired\": @YES}];\n    [CompanyObject createInRealm:realm withValue:@{@\"name\": @\"ABC AG\", @\"employees\": @[c3e1], @\"employeeSet\": @[c3e1]}];\n    [realm commitWriteTransaction];\n\n    RLMResults *allCompanies = [CompanyObject allObjects];\n    RLMResults *allEmployees = [EmployeeObject allObjects];\n\n    // count operator\n    XCTAssertEqual([[allCompanies valueForKeyPath:@\"@count\"] integerValue], 3);\n\n    // numeric operators\n    XCTAssertEqual([[allEmployees valueForKeyPath:@\"@min.age\"] intValue], 20);\n    XCTAssertEqual([[allEmployees valueForKeyPath:@\"@max.age\"] intValue], 40);\n    XCTAssertEqual([[allEmployees valueForKeyPath:@\"@sum.age\"] integerValue], 206);\n    XCTAssertEqualWithAccuracy([[allEmployees valueForKeyPath:@\"@avg.age\"] doubleValue], 29.43, 0.1f);\n\n    // collection\n    XCTAssertEqualObjects([allCompanies valueForKeyPath:@\"@unionOfObjects.name\"],\n                          (@[@\"InspiringNames LLC\", @\"ABC AG\", @\"ABC AG\"]));\n    XCTAssertEqualObjects([allCompanies valueForKeyPath:@\"@distinctUnionOfObjects.name\"],\n                          (@[@\"ABC AG\", @\"InspiringNames LLC\"]));\n    XCTAssertEqualObjects([allCompanies valueForKeyPath:@\"employees.@unionOfArrays.name\"],\n                          (@[@\"Joe\", @\"John\", @\"Jill\", @\"A\", @\"B\", @\"C\", @\"A\"]));\n    XCTAssertEqualObjects([[allCompanies valueForKeyPath:@\"employees.@distinctUnionOfArrays.name\"]\n                           sortedArrayUsingSelector:@selector(compare:)],\n                          (@[@\"A\", @\"B\", @\"C\", @\"Jill\", @\"Joe\", @\"John\"]));\n\n    // invalid key paths\n    RLMAssertThrowsWithReasonMatching([allCompanies valueForKeyPath:@\"@invalid.name\"],\n                                      @\"Unsupported KVC collection operator found in key path '@invalid.name'\");\n    RLMAssertThrowsWithReasonMatching([allCompanies valueForKeyPath:@\"@sum\"],\n                                      @\"Missing key path for KVC collection operator sum in key path '@sum'\");\n    RLMAssertThrowsWithReasonMatching([allCompanies valueForKeyPath:@\"@sum.\"],\n                                      @\"Missing key path for KVC collection operator sum in key path '@sum.'\");\n    RLMAssertThrowsWithReasonMatching([allCompanies valueForKeyPath:@\"@sum.employees.@sum.age\"],\n                                      @\"Nested key paths.*not supported\");\n}\n\n- (void)testArrayDescription\n{\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    for (NSInteger i = 0; i < 1012; ++i) {\n        EmployeeObject *person = [[EmployeeObject alloc] init];\n        person.name = @\"Mary\";\n        person.age = 24;\n        person.hired = YES;\n        [realm addObject:person];\n    }\n    [realm commitWriteTransaction];\n\n    NSString *description = [[EmployeeObject allObjects] description];\n\n    XCTAssertTrue([description rangeOfString:@\"name\"].location != NSNotFound);\n    XCTAssertTrue([description rangeOfString:@\"Mary\"].location != NSNotFound);\n\n    XCTAssertTrue([description rangeOfString:@\"age\"].location != NSNotFound);\n    XCTAssertTrue([description rangeOfString:@\"24\"].location != NSNotFound);\n\n    XCTAssertTrue([description rangeOfString:@\"912 objects skipped\"].location != NSNotFound);\n}\n\n- (void)testIndexOfObject\n{\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    EmployeeObject *po1 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES}];\n    EmployeeObject *po2 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"John\", @\"age\": @30, @\"hired\": @NO}];\n    EmployeeObject *po3 = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Jill\", @\"age\": @25, @\"hired\": @YES}];\n    StringObject *so = [StringObject createInRealm:realm withValue:@[@\"\"]];\n    StringObject *deletedObject = [StringObject createInRealm:realm withValue:@[@\"\"]];\n    [realm deleteObject:deletedObject];\n    [realm commitWriteTransaction];\n\n    EmployeeObject *unmanaged = [[EmployeeObject alloc] init];\n\n    RLMResults *results = [EmployeeObject objectsWhere:@\"hired = YES\"];\n    XCTAssertEqual(0U, [results indexOfObject:po1]);\n    XCTAssertEqual(1U, [results indexOfObject:po3]);\n    XCTAssertEqual((NSUInteger)NSNotFound, [results indexOfObject:po2]);\n    XCTAssertEqual((NSUInteger)NSNotFound, [results indexOfObject:unmanaged]);\n    RLMAssertThrowsWithReasonMatching([results indexOfObject:so], @\"StringObject.*EmployeeObject\");\n    RLMAssertThrowsWithReasonMatching([results indexOfObject:deletedObject], @\"Object has been deleted or invalidated\");\n\n    [results lastObject]; // Force to tableview mode\n    XCTAssertEqual(0U, [results indexOfObject:po1]);\n    XCTAssertEqual(1U, [results indexOfObject:po3]);\n    XCTAssertEqual((NSUInteger)NSNotFound, [results indexOfObject:po2]);\n    XCTAssertEqual((NSUInteger)NSNotFound, [results indexOfObject:unmanaged]);\n    RLMAssertThrowsWithReasonMatching([results indexOfObject:so], @\"StringObject.*EmployeeObject\");\n    RLMAssertThrowsWithReasonMatching([results indexOfObject:deletedObject], @\"Object has been deleted or invalidated\");\n\n    // reverse order from sort\n    results = [[EmployeeObject objectsWhere:@\"hired = YES\"] sortedResultsUsingKeyPath:@\"age\" ascending:YES];\n    XCTAssertEqual(1U, [results indexOfObject:po1]);\n    XCTAssertEqual(0U, [results indexOfObject:po3]);\n    XCTAssertEqual((NSUInteger)NSNotFound, [results indexOfObject:po2]);\n    XCTAssertEqual((NSUInteger)NSNotFound, [results indexOfObject:unmanaged]);\n    RLMAssertThrowsWithReasonMatching([results indexOfObject:so], @\"StringObject.*EmployeeObject\");\n    RLMAssertThrowsWithReasonMatching([results indexOfObject:deletedObject], @\"Object has been deleted or invalidated\");\n\n    results = [EmployeeObject allObjects];\n    XCTAssertEqual(0U, [results indexOfObject:po1]);\n    XCTAssertEqual(1U, [results indexOfObject:po2]);\n    XCTAssertEqual(2U, [results indexOfObject:po3]);\n    XCTAssertEqual((NSUInteger)NSNotFound, [results indexOfObject:unmanaged]);\n    RLMAssertThrowsWithReasonMatching([results indexOfObject:so], @\"StringObject.*EmployeeObject\");\n    RLMAssertThrowsWithReasonMatching([results indexOfObject:deletedObject], @\"Object has been deleted or invalidated\");\n}\n\n- (void)testIndexOfObjectWhere\n{\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES}];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"John\", @\"age\": @30, @\"hired\": @NO}];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Jill\", @\"age\": @25, @\"hired\": @YES}];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Phil\", @\"age\": @38, @\"hired\": @NO}];\n    [realm commitWriteTransaction];\n\n    RLMResults *results = [EmployeeObject objectsWhere:@\"hired = YES\"];\n    XCTAssertEqual(0U, ([results indexOfObjectWhere:@\"age = %d\", 40]));\n    XCTAssertEqual(1U, ([results indexOfObjectWhere:@\"age = %d\", 25]));\n    XCTAssertEqual((NSUInteger)NSNotFound, ([results indexOfObjectWhere:@\"age = %d\", 30]));\n\n    results = [EmployeeObject allObjects];\n    XCTAssertEqual(0U, ([results indexOfObjectWhere:@\"age = %d\", 40]));\n    XCTAssertEqual(1U, ([results indexOfObjectWhere:@\"age = %d\", 30]));\n    XCTAssertEqual(2U, ([results indexOfObjectWhere:@\"age = %d\", 25]));\n    XCTAssertEqual((NSUInteger)NSNotFound, ([results indexOfObjectWhere:@\"age = %d\", 35]));\n\n    results = [[EmployeeObject allObjects] sortedResultsUsingKeyPath:@\"age\" ascending:YES];\n    NSUInteger youngestHired = [results indexOfObjectWhere:@\"hired = YES\"];\n    XCTAssertEqual(0U, youngestHired);\n    XCTAssertEqualObjects(@\"Jill\", [results[youngestHired] name]);\n    NSUInteger youngestNotHired = [results indexOfObjectWhere:@\"hired = NO\"];\n    XCTAssertEqual(1U, youngestNotHired);\n    XCTAssertEqualObjects(@\"John\", [results[youngestNotHired] name]);\n}\n\n- (void)testSubqueryLifetime\n{\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"John\", @\"age\": @30, @\"hired\": @NO}];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Jill\",  @\"age\": @50, @\"hired\": @YES}];\n    [realm commitWriteTransaction];\n\n    RLMResults<EmployeeObject *> *subarray = nil;\n    {\n        __attribute((objc_precise_lifetime)) RLMResults *results = [EmployeeObject objectsWhere:@\"hired = YES\"];\n        subarray = [results objectsWhere:@\"age = 40\"];\n    }\n\n    [realm beginWriteTransaction];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES}];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqualObjects(@\"Joe\", subarray[0][@\"name\"]);\n}\n\n- (void)testMultiSortLifetime\n{\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"John\", @\"age\": @30, @\"hired\": @NO}];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Jill\",  @\"age\": @50, @\"hired\": @YES}];\n    [realm commitWriteTransaction];\n\n    RLMResults<EmployeeObject *> *subarray = nil;\n    {\n        __attribute((objc_precise_lifetime)) RLMResults *results = [[EmployeeObject allObjects] sortedResultsUsingKeyPath:@\"age\" ascending:YES];\n        subarray = [results sortedResultsUsingKeyPath:@\"age\" ascending:NO];\n    }\n\n    [realm beginWriteTransaction];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES}];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(3U, subarray.count);\n    XCTAssertEqualObjects(@\"Jill\", subarray[0][@\"name\"]);\n    XCTAssertEqualObjects(@\"Joe\", subarray[1][@\"name\"]);\n    XCTAssertEqualObjects(@\"John\", subarray[2][@\"name\"]);\n}\n\n- (void)testSortingExistingQuery\n{\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"A\",  @\"age\": @20, @\"hired\": @YES}];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"B\", @\"age\": @30, @\"hired\": @NO}];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"C\", @\"age\": @40, @\"hired\": @YES}];\n    [realm commitWriteTransaction];\n\n    RLMResults *sortedAge = [[EmployeeObject allObjects] sortedResultsUsingKeyPath:@\"age\" ascending:YES];\n    RLMResults *sortedName = [sortedAge sortedResultsUsingKeyPath:@\"name\" ascending:NO];\n\n    XCTAssertEqual(20, [(EmployeeObject *)sortedAge[0] age]);\n    XCTAssertEqual(40, [(EmployeeObject *)sortedName[0] age]);\n}\n\n- (void)testRerunningSortedQuery {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    RLMResults *sortedAge = [[EmployeeObject allObjects] sortedResultsUsingKeyPath:@\"age\" ascending:YES];\n    [sortedAge lastObject]; // Force creation of the TableView\n    RLMResults *sortedName = [sortedAge sortedResultsUsingKeyPath:@\"name\" ascending:NO];\n    [sortedName lastObject]; // Force creation of the TableView\n    RLMResults *filtered = [sortedName objectsWhere:@\"age > 20\"];\n    [filtered lastObject]; // Force creation of the TableView\n\n    [realm beginWriteTransaction];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"A\",  @\"age\": @20, @\"hired\": @YES}];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"B\", @\"age\": @30, @\"hired\": @NO}];\n    [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"C\", @\"age\": @40, @\"hired\": @YES}];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(3U, sortedAge.count);\n    XCTAssertEqual(3U, sortedName.count);\n    XCTAssertEqual(2U, filtered.count);\n\n    XCTAssertEqual(20, [(EmployeeObject *)sortedAge[0] age]);\n    XCTAssertEqual(30, [(EmployeeObject *)sortedAge[1] age]);\n    XCTAssertEqual(40, [(EmployeeObject *)sortedAge[2] age]);\n\n    XCTAssertEqual(40, [(EmployeeObject *)sortedName[0] age]);\n    XCTAssertEqual(30, [(EmployeeObject *)sortedName[1] age]);\n    XCTAssertEqual(20, [(EmployeeObject *)sortedName[2] age]);\n\n    XCTAssertEqual(40, [(EmployeeObject *)filtered[0] age]);\n    XCTAssertEqual(30, [(EmployeeObject *)filtered[1] age]);\n}\n\n- (void)testLiveUpdateFirst {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    [IntObject createInRealm:realm withValue:@[@0]];\n\n    RLMResults *objects = [IntObject objectsInRealm:realm where:@\"intCol = 0\"];\n    XCTAssertNotNil([objects firstObject]);\n    [objects.firstObject setIntCol:1];\n    XCTAssertNil([objects firstObject]);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testLiveUpdateLast {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    [IntObject createInRealm:realm withValue:@[@0]];\n\n    RLMResults *objects = [IntObject objectsInRealm:realm where:@\"intCol = 0\"];\n    XCTAssertNotNil([objects lastObject]);\n    [objects.lastObject setIntCol:1];\n    XCTAssertNil([objects lastObject]);\n\n    [realm cancelWriteTransaction];\n}\n\nstatic vm_size_t get_resident_size(void) {\n    struct task_basic_info info;\n    mach_msg_type_number_t size = sizeof(info);\n    task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&info, &size);\n    return info.resident_size;\n}\n\n- (void)testQueryMemoryUsage {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    StringObject *obj = [[StringObject alloc] init];\n    obj.stringCol = @\"a\";\n    [realm addObject:obj];\n    [realm commitWriteTransaction];\n\n    NSPredicate *pred = [NSPredicate predicateWithFormat:@\"stringCol = 'a'\"];\n\n    // Check for memory leaks when creating queries by comparing the memory usage\n    // before and after creating a very large number of queries. Anything less\n    // than doubling is allowed as there's going to be some natural fluctuation,\n    // and failing to clean up 10k queries resulted in far more than doubling.\n    vm_size_t size = get_resident_size();\n    for (int i = 0; i < 10000; ++i) {\n        @autoreleasepool {\n            RLMResults *matches = [StringObject objectsInRealm:realm withPredicate:pred];\n            XCTAssertEqualObjects([matches[0] stringCol], @\"a\");\n        }\n    }\n    XCTAssertLessThan(get_resident_size(), size * 2);\n}\n\n- (void)testDeleteAllObjects\n{\n    RLMRealm *realm = self.realmWithTestPath;\n\n    [realm beginWriteTransaction];\n    [StringObject createInRealm:realm withValue:@[@\"name1\"]];\n    [StringObject createInRealm:realm withValue:@[@\"name2\"]];\n    [realm commitWriteTransaction];\n\n    RLMResults *results = [StringObject objectsInRealm:realm where:@\"stringCol = 'name1'\"];\n    RLMAssertThrowsWithReasonMatching([realm deleteObjects:results], @\"write transaction\");\n    [realm beginWriteTransaction];\n    [realm deleteObjects:results];\n    [realm commitWriteTransaction];\n    XCTAssertEqual(0U, results.count);\n    XCTAssertEqual(1U, [StringObject allObjectsInRealm:realm].count);\n\n    results = [StringObject allObjectsInRealm:realm];\n    RLMAssertThrowsWithReasonMatching([realm deleteObjects:results], @\"write transaction\");\n    [realm beginWriteTransaction];\n    [realm deleteObjects:results];\n    [realm commitWriteTransaction];\n    XCTAssertEqual(0U, results.count);\n    XCTAssertEqual(0U, [StringObject allObjectsInRealm:realm].count);\n}\n\n- (void)testEnumerateAndDeleteTableResults {\n    RLMRealm *realm = self.realmWithTestPath;\n    const int count = 40;\n\n    [realm beginWriteTransaction];\n    for (int i = 0; i < count; ++i) {\n        [IntObject createInRealm:realm withValue:@[@(i)]];\n    }\n\n    int enumeratedCount = 0;\n    for (IntObject *io in [IntObject allObjectsInRealm:realm]) {\n        ++enumeratedCount;\n        [realm deleteObject:io];\n    }\n\n    XCTAssertEqual(0U, [IntObject allObjectsInRealm:realm].count);\n    XCTAssertEqual(count, enumeratedCount);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testEnumerateAndMutateQueryCondition {\n    RLMRealm *realm = self.realmWithTestPath;\n    const int count = 40;\n\n    [realm beginWriteTransaction];\n    for (int i = 0; i < count; ++i) {\n        [IntObject createInRealm:realm withValue:@[@(0)]];\n    }\n\n    int enumeratedCount = 0;\n    for (IntObject *io in [IntObject objectsInRealm:realm where:@\"intCol = 0\"]) {\n        ++enumeratedCount;\n        io.intCol = enumeratedCount;\n    }\n\n    XCTAssertEqual(0U, [IntObject objectsInRealm:realm where:@\"intCol = 0\"].count);\n    XCTAssertEqual(count, enumeratedCount);\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testManualRefreshDuringEnumeration {\n    RLMRealm *realm = self.realmWithTestPath;\n    const int count = 40;\n\n    [realm beginWriteTransaction];\n    for (int i = 0; i < count; ++i) {\n        [IntObject createInRealm:realm withValue:@[@(0)]];\n    }\n    [realm commitWriteTransaction];\n\n    realm.autorefresh = NO;\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = self.realmWithTestPath;\n        [realm beginWriteTransaction];\n        [realm deleteObjects:[IntObject allObjectsInRealm:realm]];\n        [realm commitWriteTransaction];\n    }];\n\n    int enumeratedCount = 0;\n    for (IntObject *io in [IntObject allObjectsInRealm:realm]) {\n        [realm refresh];\n        XCTAssertTrue(io.invalidated);\n        ++enumeratedCount;\n    }\n\n    XCTAssertEqual(enumeratedCount, count);\n}\n\n- (void)testCallInvalidateDuringEnumeration {\n    RLMRealm *realm = self.realmWithTestPath;\n    const int count = 40;\n\n    [realm beginWriteTransaction];\n    for (int i = 0; i < count; ++i) {\n        [IntObject createInRealm:realm withValue:@[@(0)]];\n    }\n    [realm commitWriteTransaction];\n\n    int enumeratedCount = 0;\n    @try {\n        for (__unused IntObject *io in [IntObject objectsInRealm:realm where:@\"intCol = 0\"]) {\n            ++enumeratedCount;\n            [realm invalidate];\n        }\n        XCTFail(@\"Should have thrown an exception\");\n    }\n    @catch (NSException *e) {\n        XCTAssertEqualObjects(e.reason, @\"Collection is no longer valid\");\n    }\n    XCTAssertEqual(16, enumeratedCount);\n\n    // Also test with the enumeration done within a write transaction\n    [realm beginWriteTransaction];\n    enumeratedCount = 0;\n    @try {\n        for (__unused IntObject *io in [IntObject objectsInRealm:realm where:@\"intCol = 0\"]) {\n            ++enumeratedCount;\n            [realm invalidate];\n        }\n        XCTFail(@\"Should have thrown an exception\");\n    }\n    @catch (NSException *e) {\n        XCTAssertEqualObjects(e.reason, @\"Collection is no longer valid\");\n    }\n    XCTAssertEqual(16, enumeratedCount);\n}\n\n- (void)testBeginWriteTransactionDuringEnumeration {\n    RLMRealm *realm = self.realmWithTestPath;\n    const int count = 40;\n\n    [realm beginWriteTransaction];\n    for (int i = 0; i < count; ++i) {\n        [IntObject createInRealm:realm withValue:@[@(0)]];\n    }\n    [realm commitWriteTransaction];\n\n    for (IntObject *io in [IntObject objectsInRealm:realm where:@\"intCol = 0\"]) {\n        [realm beginWriteTransaction];\n        io.intCol = 1;\n        [realm commitWriteTransaction];\n    }\n\n    XCTAssertEqual(40U, [IntObject objectsInRealm:realm where:@\"intCol = 1\"].count);\n}\n\n- (void)testAllMethodsCheckThread {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm transactionWithBlock:^{\n        [IntObject createInDefaultRealmWithValue:@[@0]];\n    }];\n\n    RLMResults *results = [IntObject allObjects];\n    XCTAssertNoThrow([results isInvalidated]);\n    XCTAssertNoThrow([results objectAtIndex:0]);\n    XCTAssertNoThrow([results firstObject]);\n    XCTAssertNoThrow([results lastObject]);\n    XCTAssertNoThrow([results indexOfObject:[IntObject allObjects].firstObject]);\n    XCTAssertNoThrow([results indexOfObjectWhere:@\"intCol = 0\"]);\n    XCTAssertNoThrow([results indexOfObjectWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]]);\n    XCTAssertNoThrow([results objectsWhere:@\"intCol = 0\"]);\n    XCTAssertNoThrow([results objectsWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]]);\n    XCTAssertNoThrow([results sortedResultsUsingKeyPath:@\"intCol\" ascending:YES]);\n    XCTAssertNoThrow([results sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"intCol\" ascending:YES]]]);\n    XCTAssertNoThrow([results minOfProperty:@\"intCol\"]);\n    XCTAssertNoThrow([results maxOfProperty:@\"intCol\"]);\n    XCTAssertNoThrow([results sumOfProperty:@\"intCol\"]);\n    XCTAssertNoThrow([results averageOfProperty:@\"intCol\"]);\n    XCTAssertNoThrow(results[0]);\n    XCTAssertNoThrow([results valueForKey:@\"intCol\"]);\n\n    [self dispatchAsyncAndWait:^{\n        XCTAssertThrows([results isInvalidated]);\n        XCTAssertThrows([results objectAtIndex:0]);\n        XCTAssertThrows([results firstObject]);\n        XCTAssertThrows([results lastObject]);\n        XCTAssertThrows([results indexOfObject:[IntObject allObjects].firstObject]);\n        XCTAssertThrows([results indexOfObjectWhere:@\"intCol = 0\"]);\n        XCTAssertThrows([results indexOfObjectWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]]);\n        XCTAssertThrows([results objectsWhere:@\"intCol = 0\"]);\n        XCTAssertThrows([results objectsWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]]);\n        XCTAssertThrows([results sortedResultsUsingKeyPath:@\"intCol\" ascending:YES]);\n        XCTAssertThrows([results sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"intCol\" ascending:YES]]]);\n        XCTAssertThrows([results minOfProperty:@\"intCol\"]);\n        XCTAssertThrows([results maxOfProperty:@\"intCol\"]);\n        XCTAssertThrows([results sumOfProperty:@\"intCol\"]);\n        XCTAssertThrows([results averageOfProperty:@\"intCol\"]);\n        XCTAssertThrows(results[0]);\n        XCTAssertThrows([results valueForKey:@\"intCol\"]);\n    }];\n}\n\n- (void)testAllMethodsCheckForInvalidation {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm transactionWithBlock:^{\n        [IntObject createInDefaultRealmWithValue:@[@0]];\n    }];\n\n    RLMResults *results = [IntObject allObjects];\n    XCTAssertFalse(results.isInvalidated);\n    XCTAssertNoThrow([results objectAtIndex:0]);\n    XCTAssertNoThrow([results firstObject]);\n    XCTAssertNoThrow([results lastObject]);\n    XCTAssertNoThrow([results indexOfObject:[IntObject allObjects].firstObject]);\n    XCTAssertNoThrow([results indexOfObjectWhere:@\"intCol = 0\"]);\n    XCTAssertNoThrow([results indexOfObjectWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]]);\n    XCTAssertNoThrow([results objectsWhere:@\"intCol = 0\"]);\n    XCTAssertNoThrow([results objectsWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]]);\n    XCTAssertNoThrow([results sortedResultsUsingKeyPath:@\"intCol\" ascending:YES]);\n    XCTAssertNoThrow([results sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"intCol\" ascending:YES]]]);\n    XCTAssertNoThrow([results minOfProperty:@\"intCol\"]);\n    XCTAssertNoThrow([results maxOfProperty:@\"intCol\"]);\n    XCTAssertNoThrow([results sumOfProperty:@\"intCol\"]);\n    XCTAssertNoThrow([results averageOfProperty:@\"intCol\"]);\n    XCTAssertNoThrow(results[0]);\n    XCTAssertNoThrow([results valueForKey:@\"intCol\"]);\n    XCTAssertNoThrow(({for (__unused id obj in results);}));\n\n    [realm invalidate];\n\n    XCTAssertTrue(results.isInvalidated);\n    XCTAssertThrows([results objectAtIndex:0]);\n    XCTAssertThrows([results firstObject]);\n    XCTAssertThrows([results lastObject]);\n    XCTAssertThrows([results indexOfObject:[IntObject allObjects].firstObject]);\n    XCTAssertThrows([results indexOfObjectWhere:@\"intCol = 0\"]);\n    XCTAssertThrows([results indexOfObjectWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]]);\n    XCTAssertThrows([results objectsWhere:@\"intCol = 0\"]);\n    XCTAssertThrows([results objectsWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]]);\n    XCTAssertThrows([results sortedResultsUsingKeyPath:@\"intCol\" ascending:YES]);\n    XCTAssertThrows([results sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"intCol\" ascending:YES]]]);\n    XCTAssertThrows([results minOfProperty:@\"intCol\"]);\n    XCTAssertThrows([results maxOfProperty:@\"intCol\"]);\n    XCTAssertThrows([results sumOfProperty:@\"intCol\"]);\n    XCTAssertThrows([results averageOfProperty:@\"intCol\"]);\n    XCTAssertThrows(results[0]);\n    XCTAssertThrows([results valueForKey:@\"intCol\"]);\n    XCTAssertThrows(({for (__unused id obj in results);}));\n}\n\n- (void)testResultsDependingOnDeletedLinkView {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    __block IntegerArrayPropertyObject *arrayObject;\n    __block IntegerSetPropertyObject *setObject;\n    [realm transactionWithBlock:^{\n        IntObject* intObject = [IntObject createInDefaultRealmWithValue:@[@0]];\n        arrayObject = [IntegerArrayPropertyObject createInDefaultRealmWithValue:@[ @0, @[ intObject ] ]];\n        setObject = [IntegerSetPropertyObject createInDefaultRealmWithValue:@[ @0, @[ intObject ] ]];\n    }];\n\n    RLMResults *arrayResults = [arrayObject.array sortedResultsUsingKeyPath:@\"intCol\" ascending:YES];\n    [arrayResults firstObject];\n\n    RLMResults *unevaluatedResults = [arrayObject.array sortedResultsUsingKeyPath:@\"intCol\" ascending:YES];\n\n    [realm transactionWithBlock:^{\n        [realm deleteObject:arrayObject];\n    }];\n\n    XCTAssertFalse(arrayResults.isInvalidated);\n    XCTAssertFalse(unevaluatedResults.isInvalidated);\n\n    XCTAssertEqual(0u, arrayResults.count);\n    XCTAssertEqual(0u, unevaluatedResults.count);\n\n    XCTAssertEqualObjects(nil, arrayResults.firstObject);\n    XCTAssertEqualObjects(nil, unevaluatedResults.firstObject);\n\n    RLMResults *setResults = [setObject.set sortedResultsUsingKeyPath:@\"intCol\" ascending:YES];\n    [setResults firstObject];\n\n    RLMResults *unevaluatedResults2 = [setObject.set sortedResultsUsingKeyPath:@\"intCol\" ascending:YES];\n\n    [realm transactionWithBlock:^{\n        [realm deleteObject:setObject];\n    }];\n\n    XCTAssertFalse(setResults.isInvalidated);\n    XCTAssertFalse(unevaluatedResults2.isInvalidated);\n\n    XCTAssertEqual(0u, setResults.count);\n    XCTAssertEqual(0u, unevaluatedResults2.count);\n\n    XCTAssertEqualObjects(nil, setResults.firstObject);\n    XCTAssertEqualObjects(nil, unevaluatedResults2.firstObject);\n}\n\n- (void)testResultsDependingOnDeletedTableView {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    __block DogObject *dog;\n    [realm transactionWithBlock:^{\n        dog = [DogObject createInDefaultRealmWithValue:@[ @\"Fido\", @3 ]];\n        [OwnerObject createInDefaultRealmWithValue:@[ @\"John\", dog ]];\n    }];\n\n    RLMResults *results = [dog.owners objectsWhere:@\"name != 'Not a real name'\"];\n    [results firstObject];\n\n    RLMResults *unevaluatedResults = [dog.owners objectsWhere:@\"name != 'Not a real name'\"];\n\n    [realm transactionWithBlock:^{\n        [realm deleteObject:dog];\n    }];\n\n    XCTAssertFalse(results.isInvalidated);\n    XCTAssertFalse(unevaluatedResults.isInvalidated);\n\n    XCTAssertEqual(0u, results.count);\n    XCTAssertEqual(0u, unevaluatedResults.count);\n\n    XCTAssertEqualObjects(nil, results.firstObject);\n    XCTAssertEqualObjects(nil, unevaluatedResults.firstObject);\n}\n\n- (void)testResultsDependingOnLinkingObjects {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    __block DogObject *dog;\n    __block OwnerObject *owner;\n    [realm transactionWithBlock:^{\n        dog = [DogObject createInDefaultRealmWithValue:@[ @\"Fido\", @3 ]];\n        owner = [OwnerObject createInDefaultRealmWithValue:@[ @\"John\", dog ]];\n    }];\n\n    XCTestExpectation *expectation = [self expectationWithDescription:@\"\"];\n    RLMResults *results = [DogObject objectsWhere:@\"ANY owners.name == 'James'\"];\n    RLMNotificationToken *token = [results addNotificationBlock:^(__unused RLMResults *results, RLMCollectionChange *change, __unused NSError *error) {\n        if (change != nil) {\n            [expectation fulfill];\n        }\n        CFRunLoopStop(CFRunLoopGetCurrent());\n    }];\n    // Consume the initial notification.\n    CFRunLoopRun();\n\n    XCTAssertEqual(0u, results.count);\n    XCTAssertNil(results.firstObject);\n\n    [realm transactionWithBlock:^{\n        owner.name = @\"James\";\n    }];\n\n    XCTAssertEqual(1u, results.count);\n    XCTAssertEqualObjects(dog.dogName, [results.firstObject dogName]);\n\n    [self waitForExpectationsWithTimeout:1.0 handler:nil];\n    [token invalidate];\n}\n\n- (void)testDistinctQuery {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    __block DogObject *fido;\n    __block DogObject *cujo;\n    __block DogObject *buster;\n    [realm transactionWithBlock:^{\n        fido = [DogObject createInDefaultRealmWithValue:@[ @\"Fido\", @3 ]];\n        cujo = [DogObject createInDefaultRealmWithValue:@[ @\"Cujo\", @3 ]];\n        buster = [DogObject createInDefaultRealmWithValue:@[ @\"Buster\", @5 ]];\n    }];\n    \n    RLMResults *results = [[DogObject allObjects] distinctResultsUsingKeyPaths:@[@\"age\"]];\n    NSMutableArray *ages = NSMutableArray.new;\n    for (id result in results) {\n        [ages addObject: result];\n    }\n    XCTAssertEqual(2u, results.count);\n    XCTAssertEqualObjects([ages valueForKey:@\"age\"], (@[@3, @5]));\n}\n- (void)testDistinctQueryWithMultipleKeyPaths {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    __block DogObject *fido;\n    __block DogObject *fido2;\n    __block DogObject *fido3;\n    __block DogObject *cujo;\n    __block DogObject *buster;\n    __block DogObject *buster2;\n    __block DogObject *rotunda;\n    \n    [realm transactionWithBlock:^{\n        fido = [DogObject createInDefaultRealmWithValue:@[ @\"Fido\", @3 ]];\n        fido2 = [DogObject createInDefaultRealmWithValue:@[ @\"Fido\", @3 ]];\n        fido3 = [DogObject createInDefaultRealmWithValue:@[ @\"Fido\", @4 ]];\n        cujo = [DogObject createInDefaultRealmWithValue:@[ @\"Cujo\", @3 ]];\n        buster = [DogObject createInDefaultRealmWithValue:@[ @\"Buster\", @3 ]];\n        buster2 = [DogObject createInDefaultRealmWithValue:@[ @\"Buster\", @3 ]];\n        rotunda = [DogObject createInDefaultRealmWithValue:@[ @\"Rotunda\", @7 ]];\n    }];\n    \n    RLMResults *results = [[DogObject allObjects] distinctResultsUsingKeyPaths:@[@\"dogName\", @\"age\"]];\n    NSMutableArray *resultsArr = NSMutableArray.new;\n    for (DogObject *result in results) {\n        [resultsArr addObject:[NSString stringWithFormat:@\"%@/%@\", result.dogName, @(result.age)]];\n    }\n    \n    XCTAssertEqualObjects(resultsArr, (@[@\"Fido/3\", @\"Fido/4\", @\"Cujo/3\", @\"Buster/3\", @\"Rotunda/7\"]));\n}\n- (void)testDistinctQueryWithMultilevelKeyPath {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    __block OwnerObject *owner1;\n    __block OwnerObject *owner2;\n    __block OwnerObject *owner3;\n    __block DogObject *dog1;\n    __block DogObject *dog2;\n    __block DogObject *dog3;\n    \n    [realm transactionWithBlock:^{\n        dog1 = [DogObject createInDefaultRealmWithValue:@[ @\"Fido\", @3 ]];\n        dog2 = [DogObject createInDefaultRealmWithValue:@[ @\"Cujo\", @3 ]];\n        dog3 = [DogObject createInDefaultRealmWithValue:@[ @\"Rotunda\", @7 ]];\n        \n        owner1 = [OwnerObject createInDefaultRealmWithValue:@[ @\"Joe\", dog1 ]];\n        owner2 = [OwnerObject createInDefaultRealmWithValue:@[ @\"Marie\", dog2 ]];\n        owner3 = [OwnerObject createInDefaultRealmWithValue:@[ @\"Marie\", dog3 ]];\n    }];\n    \n    RLMResults *results = [[OwnerObject allObjects] distinctResultsUsingKeyPaths:@[@\"dog.age\"]];\n    NSMutableArray *resultsArr = NSMutableArray.new;\n    for (OwnerObject *result in results) {\n        [resultsArr addObject:@(result.dog.age)];\n    }\n    XCTAssertEqualObjects(resultsArr, (@[@3, @7]));\n}\n\n- (void)testDistinctQueryThrowsInvalidKeyPathsSpecified {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm transactionWithBlock:^{\n        [DogObject createInDefaultRealmWithValue:@[ @\"Fido\", @3 ]];\n        [DogObject createInDefaultRealmWithValue:@[ @\"Fido\", @3 ]];\n        [DogObject createInDefaultRealmWithValue:@[ @\"Fido\", @5 ]];\n        AggregateObject *ao1 = [AggregateObject createInDefaultRealmWithValue:@[ @0 ]];\n        AggregateObject *ao2 = [AggregateObject createInDefaultRealmWithValue:@[ @0 ]];\n        [AggregateArrayObject createInDefaultRealmWithValue:@[@[ao1, ao2]]];\n        [AggregateSetObject createInDefaultRealmWithValue:@[@[ao1, ao2]]];\n        [AllTypesObject createInDefaultRealmWithValue:@[]];\n    }];\n    \n    XCTAssertThrows([[DogObject allObjects] distinctResultsUsingKeyPaths:@[@\"\"]]);\n    XCTAssertThrows([[DogObject allObjects] distinctResultsUsingKeyPaths:@[@\" \"]]);\n    XCTAssertThrows([[DogObject allObjects] distinctResultsUsingKeyPaths:@[@\"\\n\"]]);\n    XCTAssertThrows(([[DogObject allObjects] distinctResultsUsingKeyPaths:@[@\"dogName\", @\"\"]]));\n    XCTAssertThrows(([[DogObject allObjects] distinctResultsUsingKeyPaths:@[@\"dogName\", @\" \"]]));\n    XCTAssertThrows(([[DogObject allObjects] distinctResultsUsingKeyPaths:@[@\"dogName\", @\"\\n\"]]));\n    XCTAssertThrows(([[DogObject allObjects] distinctResultsUsingKeyPaths:@[@\"@max.age\"]]));\n    XCTAssertThrows([[AllTypesObject allObjects] distinctResultsUsingKeyPaths:@[@\"linkingObjectsCol\"]]);\n    XCTAssertThrows([[AllTypesObject allObjects] distinctResultsUsingKeyPaths:@[@\"objectCol\"]]);\n    XCTAssertThrows([[AggregateArrayObject allObjects] distinctResultsUsingKeyPaths:@[@\"array\"]]);\n    XCTAssertThrows([[AggregateSetObject allObjects] distinctResultsUsingKeyPaths:@[@\"set\"]]);\n}\n\n#pragma mark - Frozen Results\n\nstatic RLMResults<IntObject *> *testResults(void) {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm transactionWithBlock:^{\n        [IntObject createInDefaultRealmWithValue:@[@0]];\n        [IntObject createInDefaultRealmWithValue:@[@1]];\n        [IntObject createInDefaultRealmWithValue:@[@2]];\n    }];\n\n    return [IntObject allObjects];\n}\n\n- (void)testIsFrozen {\n    RLMResults *unfrozen = testResults();\n    RLMResults *frozen = [unfrozen freeze];\n    XCTAssertFalse(unfrozen.isFrozen);\n    XCTAssertTrue(frozen.isFrozen);\n}\n\n- (void)testFreezingFrozenObjectReturnsSelf {\n    RLMResults *results = testResults();\n    RLMResults *frozen = [results freeze];\n    XCTAssertNotEqual(results, frozen);\n    XCTAssertNotEqual(results.freeze, frozen);\n    XCTAssertEqual(frozen, frozen.freeze);\n}\n\n- (void)testFreezeFromWrongThread {\n    RLMResults *results = testResults();\n    [self dispatchAsyncAndWait:^{\n        RLMAssertThrowsWithReason([results freeze],\n                                  @\"Realm accessed from incorrect thread\");\n    }];\n}\n\n- (void)testAccessFrozenResultsFromDifferentThread {\n    RLMResults *frozen = [testResults() freeze];\n    [self dispatchAsyncAndWait:^{\n        XCTAssertEqualObjects([frozen valueForKey:@\"intCol\"], (@[@0, @1, @2]));\n    }];\n}\n\n- (void)testObserveFrozenResults {\n    RLMResults *frozen = [testResults() freeze];\n    id block = ^(__unused BOOL deleted, __unused NSArray *changes, __unused NSError *error) {};\n    RLMAssertThrowsWithReason([frozen addNotificationBlock:block],\n                              @\"Frozen Realms do not change and do not have change notifications.\");\n}\n\n- (void)testQueryFrozenResults {\n    RLMResults *frozen = [testResults() freeze];\n    XCTAssertEqualObjects([[frozen objectsWhere:@\"intCol > 0\"] valueForKey:@\"intCol\"], (@[@1, @2]));\n}\n\n- (void)testFrozenResultsDoNotUpdate {\n    RLMResults *frozen = [testResults() freeze];\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm transactionWithBlock:^{\n        [IntObject createInDefaultRealmWithValue:@[@3]];\n    }];\n    XCTAssertEqual(frozen.count, 3);\n    XCTAssertEqual([frozen objectsWhere:@\"intCol = 3\"].count, 0);\n}\n\n- (void)testMultithreadedFrozenResultsEnumeration {\n    RLMResults *frozen = [testResults() freeze];\n    dispatch_apply(100, DISPATCH_APPLY_AUTO, ^(__unused size_t i) {\n        for (__unused id obj in frozen);\n    });\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/SchemaTests.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <XCTest/XCTest.h>\n\n#import \"RLMMultiProcessTestCase.h\"\n#import \"TestUtils.h\"\n\n#import \"RLMAccessor.h\"\n#import \"RLMObjectSchema_Private.hpp\"\n#import \"RLMObject_Private.h\"\n#import \"RLMProperty_Private.h\"\n#import \"RLMRealmConfiguration_Private.hpp\"\n#import \"RLMRealm_Dynamic.h\"\n#import \"RLMRealm_Private.hpp\"\n#import \"RLMSchema_Private.hpp\"\n#import \"RLMUtil.hpp\"\n\n#import <realm/object-store/schema.hpp>\n#import <realm/table.hpp>\n\n#import <algorithm>\n#import <objc/runtime.h>\n\n@interface SchemaTestClassBase : RLMObject\n@property IntObject *baseCol;\n@end\n@implementation SchemaTestClassBase\n@end\n\n@interface SchemaTestClassFirstChild : SchemaTestClassBase\n@property IntObject *firstChildCol;\n@end\n@implementation SchemaTestClassFirstChild\n@end\n\n@interface SchemaTestClassSecondChild : SchemaTestClassBase\n@property IntObject *secondChildCol;\n@end\n@implementation SchemaTestClassSecondChild\n@end\n\nRLM_COLLECTION_TYPE(SchemaTestClassBase)\nRLM_COLLECTION_TYPE(SchemaTestClassFirstChild)\nRLM_COLLECTION_TYPE(SchemaTestClassSecondChild)\n\n@interface SchemaTestClassLink : RLMObject\n@property SchemaTestClassBase *base;\n@property SchemaTestClassFirstChild *child;\n@property SchemaTestClassSecondChild *secondChild;\n\n@property RLM_GENERIC_ARRAY(SchemaTestClassBase) *baseArray;\n@property RLM_GENERIC_ARRAY(SchemaTestClassFirstChild) *childArray;\n@property RLM_GENERIC_ARRAY(SchemaTestClassSecondChild) *secondChildArray;\n\n@property RLM_GENERIC_SET(SchemaTestClassBase) *baseSet;\n@property RLM_GENERIC_SET(SchemaTestClassFirstChild) *childSet;\n@property RLM_GENERIC_SET(SchemaTestClassSecondChild) *secondChildSet;\n\n@end\n@implementation SchemaTestClassLink\n@end\n\n@interface NonDefaultObject : RLMObject\n@property int intCol;\n@end\n\n@implementation NonDefaultObject\n+ (BOOL)shouldIncludeInDefaultSchema {\n    return NO;\n}\n@end\n\nRLM_COLLECTION_TYPE(NonDefaultObject);\n\n@interface NonDefaultArrayObject : RLMObject\n@property RLM_GENERIC_ARRAY(NonDefaultObject) *array;\n@end\n\n@implementation NonDefaultArrayObject\n+ (BOOL)shouldIncludeInDefaultSchema {\n    return NO;\n}\n@end\n\n@class MutualLink2Object;\n\n@interface MutualLink1Object : RLMObject\n@property (nullable) MutualLink2Object *object;\n@end\n@implementation MutualLink1Object\n+ (BOOL)shouldIncludeInDefaultSchema {\n    return NO;\n}\n@end\n\n@interface MutualLink2Object : RLMObject\n@property (nullable) MutualLink1Object *object;\n@end\n@implementation MutualLink2Object\n+ (BOOL)shouldIncludeInDefaultSchema {\n    return NO;\n}\n@end\n\n@interface SchemaTestClassWithSingleDuplicatePropertyBase : FakeObject\n@property NSString *string;\n@end\n\n@implementation SchemaTestClassWithSingleDuplicatePropertyBase\n@end\n\n@interface SchemaTestClassWithSingleDuplicateProperty : SchemaTestClassWithSingleDuplicatePropertyBase\n@property NSString *string;\n@end\n\n@implementation SchemaTestClassWithSingleDuplicateProperty\n@synthesize string;\n@end\n\n@interface SchemaTestClassWithMultipleDuplicatePropertiesBase : FakeObject\n@property NSString *string;\n@property int integer;\n@end\n\n@implementation SchemaTestClassWithMultipleDuplicatePropertiesBase\n@end\n\n@interface SchemaTestClassWithMultipleDuplicateProperties : SchemaTestClassWithMultipleDuplicatePropertiesBase\n@property NSString *string;\n@property int integer;\n@end\n\n@implementation SchemaTestClassWithMultipleDuplicateProperties\n@synthesize string;\n@synthesize integer;\n@end\n\n@interface UnindexableProperty : FakeObject\n@property double unindexable;\n@end\n@implementation UnindexableProperty\n+ (NSArray *)indexedProperties {\n    return @[@\"unindexable\"];\n}\n@end\n\n@interface InvalidPrimaryKeyType : FakeObject\n@property double primaryKey;\n@end\n@implementation InvalidPrimaryKeyType\n+ (NSString *)primaryKey {\n    return @\"primaryKey\";\n}\n@end\n\n@interface MissingPrimaryKey : FakeObject\n@property int pk;\n@end\n@implementation MissingPrimaryKey\n+ (NSString *)primaryKey {\n    return @\"primaryKey\";\n}\n@end\n\n@interface RequiredLinkProperty : FakeObject\n@property BoolObject *object;\n@end\n@implementation RequiredLinkProperty\n+ (NSArray *)requiredProperties {\n    return @[@\"object\"];\n}\n@end\n\n@interface InvalidNSNumberProtocolObject : FakeObject\n@property NSNumber<NSFastEnumeration> *number;\n@end\n@implementation InvalidNSNumberProtocolObject\n@end\n\n@interface InvalidNSNumberNoProtocolObject : FakeObject\n@property NSNumber *number;\n@end\n@implementation InvalidNSNumberNoProtocolObject\n@end\n\n@class InvalidReadWriteLinkingObjectsProperty;\n@class InvalidLinkingObjectsPropertiesMethod;\n@class ValidLinkingObjectsPropertyWithProtocol;\n@class InvalidLinkingObjectsPropertyProtocol;\n\n@interface SchemaTestsLinkSource : FakeObject\n@property InvalidReadWriteLinkingObjectsProperty *irwlop;\n@property InvalidLinkingObjectsPropertiesMethod *iloprm;\n@property ValidLinkingObjectsPropertyWithProtocol *vlopwp;\n@property InvalidLinkingObjectsPropertyProtocol *ilopp;\n@end\n@implementation SchemaTestsLinkSource\n@end\n\n@interface MixedProperty : FakeObject\n@property id mixed;\n@end\n@implementation MixedProperty\n@end\n\n@interface LinkFromEmbeddedToTopLevel : FakeEmbeddedObject\n@property IntObject *link;\n@end\n@implementation LinkFromEmbeddedToTopLevel\n@end\n\n@interface ArrayFromEmbeddedToTopLevel : FakeEmbeddedObject\n@property RLMArray<IntObject> *array;\n@end\n@implementation ArrayFromEmbeddedToTopLevel\n@end\n\n@interface EmbeddedObjectWithPrimaryKey : FakeEmbeddedObject\n@property int pk;\n@end\n@implementation EmbeddedObjectWithPrimaryKey\n+ (NSString *)primaryKey {\n    return @\"pk\";\n}\n@end\n\nRLM_COLLECTION_TYPE(SchemaTestsLinkSource)\n\n@interface InvalidReadWriteLinkingObjectsProperty : FakeObject\n@property RLMLinkingObjects *linkingObjects;\n@end\n\n@implementation InvalidReadWriteLinkingObjectsProperty\n\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{ @\"linkingObjects\": [RLMPropertyDescriptor descriptorWithClass:SchemaTestsLinkSource.class propertyName:@\"irwlop\"] };\n}\n\n@end\n\n@interface InvalidLinkingObjectsPropertiesMethod : FakeObject\n@property (readonly) RLMLinkingObjects *linkingObjects;\n@end\n\n@implementation InvalidLinkingObjectsPropertiesMethod\n@end\n\n\n@interface ValidLinkingObjectsPropertyWithProtocol : FakeObject\n@property (readonly) RLMLinkingObjects<SchemaTestsLinkSource> *linkingObjects;\n@end\n\n@implementation ValidLinkingObjectsPropertyWithProtocol\n\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{ @\"linkingObjects\": [RLMPropertyDescriptor descriptorWithClass:SchemaTestsLinkSource.class propertyName:@\"vlopwp\"] };\n}\n\n@end\n\nRLM_COLLECTION_TYPE(NotARealClass)\n\n@interface InvalidLinkingObjectsPropertyProtocol : FakeObject\n@property (readonly) RLMLinkingObjects<NotARealClass> *linkingObjects;\n@end\n\n@implementation InvalidLinkingObjectsPropertyProtocol\n\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{ @\"linkingObjects\": [RLMPropertyDescriptor descriptorWithClass:SchemaTestsLinkSource.class propertyName:@\"ilopp\"] };\n}\n\n@end\n\n\n@interface InvalidLinkingObjectsPropertyMissingSourcePropertyOfLink : FakeObject\n@property (readonly) RLMLinkingObjects *linkingObjects;\n@property InvalidLinkingObjectsPropertyMissingSourcePropertyOfLink *link;\n@end\n\n@implementation InvalidLinkingObjectsPropertyMissingSourcePropertyOfLink\n\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{ @\"linkingObjects\": [RLMPropertyDescriptor descriptorWithClass:InvalidLinkingObjectsPropertyMissingSourcePropertyOfLink.class\n                                                               propertyName:@\"nosuchproperty\"] };\n}\n\n@end\n\n\n@interface InvalidLinkingObjectsPropertySourcePropertyNotALink : FakeObject\n@property (readonly) RLMLinkingObjects *linkingObjects;\n@property int64_t integer;\n@end\n\n@implementation InvalidLinkingObjectsPropertySourcePropertyNotALink\n\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{ @\"linkingObjects\": [RLMPropertyDescriptor descriptorWithClass:InvalidLinkingObjectsPropertySourcePropertyNotALink.class\n                                                               propertyName:@\"integer\"] };\n}\n\n@end\n\n\n@interface InvalidLinkingObjectsPropertySourcePropertyLinksElsewhere : FakeObject\n@property (readonly) RLMLinkingObjects *linkingObjects;\n@property IntObject *link;\n@end\n\n@implementation InvalidLinkingObjectsPropertySourcePropertyLinksElsewhere\n\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{ @\"linkingObjects\": [RLMPropertyDescriptor descriptorWithClass:InvalidLinkingObjectsPropertySourcePropertyLinksElsewhere.class\n                                                               propertyName:@\"link\"] };\n}\n\n@end\n\n@interface OrphanObject : RLMEmbeddedObject\n@property int value;\n@end\n@implementation OrphanObject\n@end\n\n@interface SchemaTests : RLMMultiProcessTestCase\n@end\n\n@implementation SchemaTests\n\n- (void)testNoSchemaForUnmanagedObjectClasses {\n    RLMSchema *schema = [RLMSchema sharedSchema];\n    XCTAssertNil([schema schemaForClassName:@\"RLMObject\"]);\n    XCTAssertNil([schema schemaForClassName:@\"RLMObjectBase\"]);\n    XCTAssertNil([schema schemaForClassName:@\"RLMDynamicObject\"]);\n}\n\n- (void)testSchemaWithObjectClasses {\n    RLMSchema *schema = [RLMSchema schemaWithObjectClasses:@[RLMDynamicObject.class, StringObject.class]];\n    XCTAssertEqualObjects((@[@\"RLMDynamicObject\", @\"StringObject\"]),\n                          [[schema.objectSchema valueForKey:@\"className\"] sortedArrayUsingSelector:@selector(compare:)]);\n    XCTAssertNil([RLMSchema.sharedSchema schemaForClassName:@\"RLMDynamicObject\"]);\n}\n\n- (void)testInheritanceInitialization\n{\n    Class testClasses[] = {\n        [SchemaTestClassBase class],\n        [SchemaTestClassFirstChild class],\n        [SchemaTestClassSecondChild class],\n        [SchemaTestClassLink class],\n        [IntObject class]\n    };\n\n    auto pred = ^(Class lft, Class rgt) {\n        return (uintptr_t)lft < (uintptr_t)rgt;\n    };\n\n    auto checkSchema = ^(RLMSchema *schema, NSString *className, NSDictionary *properties) {\n        RLMObjectSchema *objectSchema = schema[className];\n        XCTAssertEqualObjects(className, objectSchema.className);\n        XCTAssertEqualObjects(className, [objectSchema.unmanagedClass className]);\n        XCTAssertEqualObjects(className, [objectSchema.accessorClass className]);\n\n        XCTAssertEqual(objectSchema.properties.count, properties.count);\n        for (NSString *propName in properties) {\n            XCTAssertEqualObjects(properties[propName], [objectSchema[propName] objectClassName]);\n        }\n    };\n\n    // Test each permutation of loading orders and verify that all properties\n    // are initialized correctly\n    std::sort(testClasses, std::end(testClasses), pred);\n    unsigned long iteration = 0;\n    do @autoreleasepool {\n        // Clean up any existing overridden things\n        for (Class cls : testClasses) {\n            // Ensure that the className method isn't used during schema init\n            // as it may not be overriden yet\n            Class metaClass = object_getClass(cls);\n            IMP imp = imp_implementationWithBlock(^{ return nil; });\n            class_replaceMethod(metaClass, @selector(className), imp, \"@:\");\n        }\n\n        NSMutableArray *objectSchemas = [NSMutableArray arrayWithCapacity:4U];\n        for (Class cls : testClasses) {\n            [objectSchemas addObject:[RLMObjectSchema schemaForObjectClass:cls]];\n        }\n\n        RLMSchema *schema = [[RLMSchema alloc] init];\n        schema.objectSchema = objectSchemas;\n\n        for (RLMObjectSchema *objectSchema in objectSchemas) {\n            NSString *name = [NSString stringWithFormat:@\"RLMTestAccessor_%lu_%@\", iteration, objectSchema.className];\n            objectSchema.accessorClass = RLMManagedAccessorClassForObjectClass(objectSchema.objectClass, objectSchema, name.UTF8String);\n            objectSchema.unmanagedClass = RLMUnmanagedAccessorClassForObjectClass(objectSchema.objectClass, objectSchema);\n        }\n        ++iteration;\n\n        for (Class cls : testClasses) {\n            NSString *className = NSStringFromClass(cls);\n\n            // Restore the className method\n            Class metaClass = object_getClass(cls);\n            IMP imp = imp_implementationWithBlock(^{ return className; });\n            class_replaceMethod(metaClass, @selector(className), imp, \"@:\");\n        }\n\n        // Verify that each class has the correct properties and className\n        // for generated subclasses\n        checkSchema(schema, @\"SchemaTestClassBase\", @{@\"baseCol\": @\"IntObject\"});\n        checkSchema(schema, @\"SchemaTestClassFirstChild\", @{@\"baseCol\": @\"IntObject\",\n                                                            @\"firstChildCol\": @\"IntObject\"});\n        checkSchema(schema, @\"SchemaTestClassSecondChild\", @{@\"baseCol\": @\"IntObject\",\n                                                            @\"secondChildCol\": @\"IntObject\"});\n        checkSchema(schema, @\"SchemaTestClassLink\", @{@\"base\": @\"SchemaTestClassBase\",\n                                                      @\"baseArray\": @\"SchemaTestClassBase\",\n                                                      @\"baseSet\": @\"SchemaTestClassBase\",\n                                                      @\"child\": @\"SchemaTestClassFirstChild\",\n                                                      @\"childArray\": @\"SchemaTestClassFirstChild\",\n                                                      @\"childSet\": @\"SchemaTestClassFirstChild\",\n                                                      @\"secondChild\": @\"SchemaTestClassSecondChild\",\n                                                      @\"secondChildArray\": @\"SchemaTestClassSecondChild\",\n                                                      @\"secondChildSet\": @\"SchemaTestClassSecondChild\"});\n\n        // Test creating objects of each class\n        [self deleteFiles];\n        RLMRealm *realm = [self realmWithTestPathAndSchema:schema];\n        [realm beginWriteTransaction];\n        [realm createObject:@\"SchemaTestClassBase\" withValue:@{@\"baseCol\": @[@0]}];\n        [realm createObject:@\"SchemaTestClassFirstChild\" withValue:@{@\"baseCol\": @[@0], @\"firstChildCol\": @[@0]}];\n        [realm createObject:@\"SchemaTestClassSecondChild\" withValue:@{@\"baseCol\": @[@0], @\"secondChildCol\": @[@0]}];\n        [realm commitWriteTransaction];\n    } while (std::next_permutation(testClasses, std::end(testClasses), pred));\n}\n\n- (void)testObjectSchema\n{\n    // Setting up some test data\n\n    // Due to the automatic initialization of a new realm with all visible classes inheriting from\n    // RLMObject, it's difficult to define test cases that verify the absolute correctness of a\n    // realm's current type catalogue unless its expected configuration is known at compile time\n    // (requires that the set of expected types is always up-to-date). Instead, only a partial\n    // verification is performed, which only requires the availability of a well-defined subset of\n    // types and ignores any other types that may be included in the realm's type catalogue.\n    // If a more fine-grained control with the realm's type inclusion mechanism is introduced later\n    // on, these tests should be altered to verify all types.\n\n    NSArray *expectedTypes = @[@\"AllTypesObject\",\n                               @\"LinkToAllTypesObject\",\n                               @\"StringObject\",\n                               @\"MixedObject\",\n                               @\"IntObject\"];\n\n    NSString *unexpectedType = @\"__$ThisTypeShouldNotOccur$__\";\n\n    // Getting the test realm\n    NSMutableArray *objectSchema = [NSMutableArray array];\n    for (NSString *className in expectedTypes) {\n        [objectSchema addObject:[RLMObjectSchema schemaForObjectClass:NSClassFromString(className)]];\n    }\n\n    RLMSchema *schema = [[RLMSchema alloc] init];\n    schema.objectSchema = objectSchema;\n\n    // create realm with schema\n    @autoreleasepool { [self realmWithTestPathAndSchema:schema]; }\n\n    // get dynamic realm and extract schema\n    RLMRealm *realm = [self realmWithTestPathAndSchema:nil];\n    schema = realm.schema;\n\n    // Test 1: Does the objectSchema return the right number of object schemas?\n    NSArray *objectSchemas = schema.objectSchema;\n\n    XCTAssertTrue(objectSchemas.count >= expectedTypes.count, @\"Expecting %lu object schemas in database found %lu\", (unsigned long)expectedTypes.count, (unsigned long)objectSchemas.count);\n\n    // Test 2: Does the object schema array contain the expected schemas?\n    NSUInteger identifiedTypesCount = 0;\n    for (NSString *expectedType in expectedTypes) {\n        NSUInteger occurrenceCount = 0;\n\n        for (RLMObjectSchema *objectSchema in objectSchemas) {\n            if ([objectSchema.className isEqualToString:expectedType]) {\n                occurrenceCount++;\n            }\n        }\n\n        XCTAssertEqual(occurrenceCount, (NSUInteger)1, @\"Expecting single occurrence of object schema for type %@ found %lu\", expectedType, (unsigned long)occurrenceCount);\n\n        if (occurrenceCount > 0) {\n            identifiedTypesCount++;\n        }\n    }\n\n    // Test 3: Does the object schema array contains at least the expected classes\n    XCTAssertTrue(identifiedTypesCount >= expectedTypes.count, @\"Unexpected object schemas in database. Found %lu out of %lu expected\", (unsigned long)identifiedTypesCount, (unsigned long)expectedTypes.count);\n\n    // Test 4: Test querying object schemas using schemaForClassName: for expected types\n    for (NSString *expectedType in expectedTypes) {\n        XCTAssertNotNil([schema schemaForClassName:expectedType], @\"Expecting to find object schema for type %@ in realm using query, found none\", expectedType);\n    }\n\n    // Test 5: Test querying object schemas using schemaForClassName: for unexpected types\n    XCTAssertNil([schema schemaForClassName:unexpectedType], @\"Expecting not to find object schema for type %@ in realm using query, did find\", unexpectedType);\n\n    // Test 6: Test querying object schemas using subscription for unexpected types\n    for (NSString *expectedType in expectedTypes) {\n        XCTAssertNotNil(schema[expectedType], @\"Expecting to find object schema for type %@ in realm using subscription, found none\", expectedType);\n    }\n\n    // Test 7: Test querying object schemas using subscription for unexpected types\n    XCTAssertThrows(schema[unexpectedType], @\"Expecting asking schema for type %@ in realm using subscription to throw\", unexpectedType);\n\n    // Test 8: RLMObject should not appear in the shared object schema\n    XCTAssertThrows(RLMSchema.sharedSchema[@\"RLMObject\"]);\n}\n\n- (void)testDescription {\n    NSArray *expectedTypes = @[@\"AllTypesObject\",\n                               @\"StringObject\",\n                               @\"IntObject\"];\n\n    NSMutableArray *objectSchema = [NSMutableArray array];\n    for (NSString *className in expectedTypes) {\n        [objectSchema addObject:[RLMObjectSchema schemaForObjectClass:NSClassFromString(className)]];\n    }\n\n    RLMSchema *schema = [[RLMSchema alloc] init];\n    schema.objectSchema = objectSchema;\n\n    XCTAssertEqualObjects(schema.description, @\"Schema {\\n\"\n                                              @\"\\tAllTypesObject {\\n\"\n                                              @\"\\t\\tboolCol {\\n\"\n                                              @\"\\t\\t\\ttype = bool;\\n\"\n                                              @\"\\t\\t\\tcolumnName = boolCol;\\n\"\n                                              @\"\\t\\t\\tindexed = NO;\\n\"\n                                              @\"\\t\\t\\tisPrimary = NO;\\n\"\n                                              @\"\\t\\t\\tarray = NO;\\n\"\n                                              @\"\\t\\t\\tset = NO;\\n\"\n                                              @\"\\t\\t\\tdictionary = NO;\\n\"\n                                              @\"\\t\\t\\toptional = NO;\\n\"\n                                              @\"\\t\\t}\\n\"\n                                              @\"\\t\\tintCol {\\n\"\n                                              @\"\\t\\t\\ttype = int;\\n\"\n                                              @\"\\t\\t\\tcolumnName = intCol;\\n\"\n                                              @\"\\t\\t\\tindexed = NO;\\n\"\n                                              @\"\\t\\t\\tisPrimary = NO;\\n\"\n                                              @\"\\t\\t\\tarray = NO;\\n\"\n                                              @\"\\t\\t\\tset = NO;\\n\"\n                                              @\"\\t\\t\\tdictionary = NO;\\n\"\n                                              @\"\\t\\t\\toptional = NO;\\n\"\n                                              @\"\\t\\t}\\n\"\n                                              @\"\\t\\tfloatCol {\\n\"\n                                              @\"\\t\\t\\ttype = float;\\n\"\n                                              @\"\\t\\t\\tcolumnName = floatCol;\\n\"\n                                              @\"\\t\\t\\tindexed = NO;\\n\"\n                                              @\"\\t\\t\\tisPrimary = NO;\\n\"\n                                              @\"\\t\\t\\tarray = NO;\\n\"\n                                              @\"\\t\\t\\tset = NO;\\n\"\n                                              @\"\\t\\t\\tdictionary = NO;\\n\"\n                                              @\"\\t\\t\\toptional = NO;\\n\"\n                                              @\"\\t\\t}\\n\"\n                                              @\"\\t\\tdoubleCol {\\n\"\n                                              @\"\\t\\t\\ttype = double;\\n\"\n                                              @\"\\t\\t\\tcolumnName = doubleCol;\\n\"\n                                              @\"\\t\\t\\tindexed = NO;\\n\"\n                                              @\"\\t\\t\\tisPrimary = NO;\\n\"\n                                              @\"\\t\\t\\tarray = NO;\\n\"\n                                              @\"\\t\\t\\tset = NO;\\n\"\n                                              @\"\\t\\t\\tdictionary = NO;\\n\"\n                                              @\"\\t\\t\\toptional = NO;\\n\"\n                                              @\"\\t\\t}\\n\"\n                                              @\"\\t\\tstringCol {\\n\"\n                                              @\"\\t\\t\\ttype = string;\\n\"\n                                              @\"\\t\\t\\tcolumnName = stringCol;\\n\"\n                                              @\"\\t\\t\\tindexed = NO;\\n\"\n                                              @\"\\t\\t\\tisPrimary = NO;\\n\"\n                                              @\"\\t\\t\\tarray = NO;\\n\"\n                                              @\"\\t\\t\\tset = NO;\\n\"\n                                              @\"\\t\\t\\tdictionary = NO;\\n\"\n                                              @\"\\t\\t\\toptional = NO;\\n\"\n                                              @\"\\t\\t}\\n\"\n                                              @\"\\t\\tbinaryCol {\\n\"\n                                              @\"\\t\\t\\ttype = data;\\n\"\n                                              @\"\\t\\t\\tcolumnName = binaryCol;\\n\"\n                                              @\"\\t\\t\\tindexed = NO;\\n\"\n                                              @\"\\t\\t\\tisPrimary = NO;\\n\"\n                                              @\"\\t\\t\\tarray = NO;\\n\"\n                                              @\"\\t\\t\\tset = NO;\\n\"\n                                              @\"\\t\\t\\tdictionary = NO;\\n\"\n                                              @\"\\t\\t\\toptional = NO;\\n\"\n                                              @\"\\t\\t}\\n\"\n                                              @\"\\t\\tdateCol {\\n\"\n                                              @\"\\t\\t\\ttype = date;\\n\"\n                                              @\"\\t\\t\\tcolumnName = dateCol;\\n\"\n                                              @\"\\t\\t\\tindexed = NO;\\n\"\n                                              @\"\\t\\t\\tisPrimary = NO;\\n\"\n                                              @\"\\t\\t\\tarray = NO;\\n\"\n                                              @\"\\t\\t\\tset = NO;\\n\"\n                                              @\"\\t\\t\\tdictionary = NO;\\n\"\n                                              @\"\\t\\t\\toptional = NO;\\n\"\n                                              @\"\\t\\t}\\n\"\n                                              @\"\\t\\tcBoolCol {\\n\"\n                                              @\"\\t\\t\\ttype = bool;\\n\"\n                                              @\"\\t\\t\\tcolumnName = cBoolCol;\\n\"\n                                              @\"\\t\\t\\tindexed = NO;\\n\"\n                                              @\"\\t\\t\\tisPrimary = NO;\\n\"\n                                              @\"\\t\\t\\tarray = NO;\\n\"\n                                              @\"\\t\\t\\tset = NO;\\n\"\n                                              @\"\\t\\t\\tdictionary = NO;\\n\"\n                                              @\"\\t\\t\\toptional = NO;\\n\"\n                                              @\"\\t\\t}\\n\"\n                                              @\"\\t\\tlongCol {\\n\"\n                                              @\"\\t\\t\\ttype = int;\\n\"\n                                              @\"\\t\\t\\tcolumnName = longCol;\\n\"\n                                              @\"\\t\\t\\tindexed = NO;\\n\"\n                                              @\"\\t\\t\\tisPrimary = NO;\\n\"\n                                              @\"\\t\\t\\tarray = NO;\\n\"\n                                              @\"\\t\\t\\tset = NO;\\n\"\n                                              @\"\\t\\t\\tdictionary = NO;\\n\"\n                                              @\"\\t\\t\\toptional = NO;\\n\"\n                                              @\"\\t\\t}\\n\"\n                                              @\"\\t\\tdecimalCol {\\n\"\n                                              @\"\\t\\t\\ttype = decimal128;\\n\"\n                                              @\"\\t\\t\\tcolumnName = decimalCol;\\n\"\n                                              @\"\\t\\t\\tindexed = NO;\\n\"\n                                              @\"\\t\\t\\tisPrimary = NO;\\n\"\n                                              @\"\\t\\t\\tarray = NO;\\n\"\n                                              @\"\\t\\t\\tset = NO;\\n\"\n                                              @\"\\t\\t\\tdictionary = NO;\\n\"\n                                              @\"\\t\\t\\toptional = NO;\\n\"\n                                              @\"\\t\\t}\\n\"\n                                              @\"\\t\\tobjectIdCol {\\n\"\n                                              @\"\\t\\t\\ttype = object id;\\n\"\n                                              @\"\\t\\t\\tcolumnName = objectIdCol;\\n\"\n                                              @\"\\t\\t\\tindexed = NO;\\n\"\n                                              @\"\\t\\t\\tisPrimary = NO;\\n\"\n                                              @\"\\t\\t\\tarray = NO;\\n\"\n                                              @\"\\t\\t\\tset = NO;\\n\"\n                                              @\"\\t\\t\\tdictionary = NO;\\n\"\n                                              @\"\\t\\t\\toptional = NO;\\n\"\n                                              @\"\\t\\t}\\n\"\n                                              @\"\\t\\tuuidCol {\\n\"\n                                              @\"\\t\\t\\ttype = uuid;\\n\"\n                                              @\"\\t\\t\\tcolumnName = uuidCol;\\n\"\n                                              @\"\\t\\t\\tindexed = NO;\\n\"\n                                              @\"\\t\\t\\tisPrimary = NO;\\n\"\n                                              @\"\\t\\t\\tarray = NO;\\n\"\n                                              @\"\\t\\t\\tset = NO;\\n\"\n                                              @\"\\t\\t\\tdictionary = NO;\\n\"\n                                              @\"\\t\\t\\toptional = NO;\\n\"\n                                              @\"\\t\\t}\\n\"\n                                              @\"\\t\\tobjectCol {\\n\"\n                                              @\"\\t\\t\\ttype = object;\\n\"\n                                              @\"\\t\\t\\tobjectClassName = StringObject;\\n\"\n                                              @\"\\t\\t\\tlinkOriginPropertyName = (null);\\n\"\n                                              @\"\\t\\t\\tcolumnName = objectCol;\\n\"\n                                              @\"\\t\\t\\tindexed = NO;\\n\"\n                                              @\"\\t\\t\\tisPrimary = NO;\\n\"\n                                              @\"\\t\\t\\tarray = NO;\\n\"\n                                              @\"\\t\\t\\tset = NO;\\n\"\n                                              @\"\\t\\t\\tdictionary = NO;\\n\"\n                                              @\"\\t\\t\\toptional = YES;\\n\"\n                                              @\"\\t\\t}\\n\"\n                                              @\"\\t\\tmixedObjectCol {\\n\"\n                                              @\"\\t\\t\\ttype = object;\\n\"\n                                              @\"\\t\\t\\tobjectClassName = MixedObject;\\n\"\n                                              @\"\\t\\t\\tlinkOriginPropertyName = (null);\\n\"\n                                              @\"\\t\\t\\tcolumnName = mixedObjectCol;\\n\"\n                                              @\"\\t\\t\\tindexed = NO;\\n\"\n                                              @\"\\t\\t\\tisPrimary = NO;\\n\"\n                                              @\"\\t\\t\\tarray = NO;\\n\"\n                                              @\"\\t\\t\\tset = NO;\\n\"\n                                              @\"\\t\\t\\tdictionary = NO;\\n\"\n                                              @\"\\t\\t\\toptional = YES;\\n\"\n                                              @\"\\t\\t}\\n\"\n                                              @\"\\t\\tanyCol {\\n\"\n                                              @\"\\t\\t\\ttype = mixed;\\n\"\n                                              @\"\\t\\t\\tcolumnName = anyCol;\\n\"\n                                              @\"\\t\\t\\tindexed = NO;\\n\"\n                                              @\"\\t\\t\\tisPrimary = NO;\\n\"\n                                              @\"\\t\\t\\tarray = NO;\\n\"\n                                              @\"\\t\\t\\tset = NO;\\n\"\n                                              @\"\\t\\t\\tdictionary = NO;\\n\"\n                                              @\"\\t\\t\\toptional = NO;\\n\"\n                                              @\"\\t\\t}\\n\"\n                                              @\"\\t\\tlinkingObjectsCol {\\n\"\n                                              @\"\\t\\t\\ttype = linking objects;\\n\"\n                                              @\"\\t\\t\\tobjectClassName = LinkToAllTypesObject;\\n\"\n                                              @\"\\t\\t\\tlinkOriginPropertyName = allTypesCol;\\n\"\n                                              @\"\\t\\t\\tcolumnName = linkingObjectsCol;\\n\"\n                                              @\"\\t\\t\\tindexed = NO;\\n\"\n                                              @\"\\t\\t\\tisPrimary = NO;\\n\"\n                                              @\"\\t\\t\\tarray = YES;\\n\"\n                                              @\"\\t\\t\\tset = NO;\\n\"\n                                              @\"\\t\\t\\tdictionary = NO;\\n\"\n                                              @\"\\t\\t\\toptional = NO;\\n\"\n                                              @\"\\t\\t}\\n\"\n                                              @\"\\t}\\n\"\n                                              @\"\\tIntObject {\\n\"\n                                              @\"\\t\\tintCol {\\n\"\n                                              @\"\\t\\t\\ttype = int;\\n\"\n                                              @\"\\t\\t\\tcolumnName = intCol;\\n\"\n                                              @\"\\t\\t\\tindexed = NO;\\n\"\n                                              @\"\\t\\t\\tisPrimary = NO;\\n\"\n                                              @\"\\t\\t\\tarray = NO;\\n\"\n                                              @\"\\t\\t\\tset = NO;\\n\"\n                                              @\"\\t\\t\\tdictionary = NO;\\n\"\n                                              @\"\\t\\t\\toptional = NO;\\n\"\n                                              @\"\\t\\t}\\n\"\n                                              @\"\\t}\\n\"\n                                              @\"\\tStringObject {\\n\"\n                                              @\"\\t\\tstringCol {\\n\"\n                                              @\"\\t\\t\\ttype = string;\\n\"\n                                              @\"\\t\\t\\tcolumnName = stringCol;\\n\"\n                                              @\"\\t\\t\\tindexed = NO;\\n\"\n                                              @\"\\t\\t\\tisPrimary = NO;\\n\"\n                                              @\"\\t\\t\\tarray = NO;\\n\"\n                                              @\"\\t\\t\\tset = NO;\\n\"\n                                              @\"\\t\\t\\tdictionary = NO;\\n\"\n                                              @\"\\t\\t\\toptional = YES;\\n\"\n                                              @\"\\t\\t}\\n\"\n                                              @\"\\t}\\n\"\n                                              @\"}\");\n\n}\n\n- (void)testClassWithDuplicateProperties\n{\n    RLMAssertThrowsWithReasonMatching([RLMObjectSchema schemaForObjectClass:SchemaTestClassWithSingleDuplicateProperty.class],\n                                      @\"'string' .* multiple times .* 'SchemaTestClassWithSingleDuplicateProperty'\");\n    RLMAssertThrowsWithReasonMatching([RLMObjectSchema schemaForObjectClass:SchemaTestClassWithMultipleDuplicateProperties.class],\n                                      @\"'SchemaTestClassWithMultipleDuplicateProperties' .* declared multiple times\");\n}\n\n- (void)testClassWithInvalidPrimaryKey {\n    XCTAssertThrows([RLMObjectSchema schemaForObjectClass:InvalidPrimaryKeyType.class]);\n}\n\n- (void)testClassWithMissingPrimaryKey {\n    RLMAssertThrowsWithReason([RLMObjectSchema schemaForObjectClass:MissingPrimaryKey.class],\n                              @\"Primary key property 'primaryKey' does not exist on object 'MissingPrimaryKey'\");\n}\n\n- (void)testClassWithUnindexableProperty {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:UnindexableProperty.class];\n    RLMSchema *schema = [[RLMSchema alloc] init];\n    schema.objectSchema = @[objectSchema];\n    RLMAssertThrowsWithReasonMatching([self realmWithTestPathAndSchema:schema],\n                                      @\"Property 'UnindexableProperty.unindexable' of type 'double' cannot be indexed\");\n}\n\n- (void)testClassWithRequiredNullableProperties {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:RequiredPropertiesObject.class];\n    XCTAssertFalse([objectSchema[@\"stringCol\"] optional]);\n    XCTAssertFalse([objectSchema[@\"binaryCol\"] optional]);\n}\n\n- (void)testClassWithRequiredPrimitiveArrayProperties {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:AllPrimitiveArrays.class];\n    XCTAssertFalse(objectSchema[@\"intObj\"].optional);\n    XCTAssertFalse(objectSchema[@\"boolObj\"].optional);\n    XCTAssertFalse(objectSchema[@\"floatObj\"].optional);\n    XCTAssertFalse(objectSchema[@\"doubleObj\"].optional);\n    XCTAssertFalse(objectSchema[@\"stringObj\"].optional);\n    XCTAssertFalse(objectSchema[@\"dateObj\"].optional);\n    XCTAssertFalse(objectSchema[@\"dataObj\"].optional);\n}\n\n- (void)testClassWithOptionalPrimitiveArrayProperties {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:AllOptionalPrimitiveArrays.class];\n    XCTAssertTrue(objectSchema[@\"intObj\"].optional);\n    XCTAssertTrue(objectSchema[@\"boolObj\"].optional);\n    XCTAssertTrue(objectSchema[@\"floatObj\"].optional);\n    XCTAssertTrue(objectSchema[@\"doubleObj\"].optional);\n    XCTAssertTrue(objectSchema[@\"stringObj\"].optional);\n    XCTAssertTrue(objectSchema[@\"dateObj\"].optional);\n    XCTAssertTrue(objectSchema[@\"dataObj\"].optional);\n}\n\n- (void)testClassWithRequiredLinkProperty {\n    RLMAssertThrowsWithReasonMatching([RLMObjectSchema schemaForObjectClass:RequiredLinkProperty.class], @\"cannot be made required.*'object'\");\n}\n\n- (void)testClassWithInvalidNSNumberProtocolProperty {\n    RLMAssertThrowsWithReasonMatching([RLMObjectSchema schemaForObjectClass:InvalidNSNumberProtocolObject.class],\n                                      @\"Property 'number' is of type \\\"NSNumber<NSFastEnumeration>\\\" which is not a supported NSNumber object type.\");\n}\n\n- (void)testClassWithInvalidNSNumberNoProtocolProperty {\n    RLMAssertThrowsWithReasonMatching([RLMObjectSchema schemaForObjectClass:InvalidNSNumberNoProtocolObject.class], @\"Property 'number' requires a protocol defining the contained type\");\n}\n\n- (void)testClassWithReadWriteLinkingObjectsProperty {\n    RLMAssertThrowsWithReasonMatching([RLMObjectSchema schemaForObjectClass:InvalidReadWriteLinkingObjectsProperty.class],\n                                      @\"Property 'linkingObjects' must be declared as readonly .* linking objects\");\n}\n\n- (void)testClassWithInvalidLinkingObjectsPropertiesMethod {\n    RLMAssertThrowsWithReasonMatching([RLMObjectSchema schemaForObjectClass:InvalidLinkingObjectsPropertiesMethod.class],\n                                      @\"Property 'linkingObjects' .* but \\\\+linkingObjectsProperties .* class or property\");\n}\n\n- (void)testClassWithLinkingObjectsPropertyWithProtocol {\n    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:ValidLinkingObjectsPropertyWithProtocol.class];\n    XCTAssertEqual(objectSchema[@\"linkingObjects\"].type, RLMPropertyTypeLinkingObjects);\n}\n\n- (void)testClassWithInvalidLinkingObjectsPropertyProtocol {\n    RLMAssertThrowsWithReasonMatching([RLMObjectSchema schemaForObjectClass:InvalidLinkingObjectsPropertyProtocol.class],\n                                      @\"Property 'linkingObjects' .* type RLMLinkingObjects<NotARealClass>.*conflicting class name.*'SchemaTestsLinkSource'\");\n}\n\n- (void)testClassWithInvalidLinkingObjectsPropertyMissingSourcePropertyOfLink {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.customSchema = [RLMSchema schemaWithObjectClasses:@[ InvalidLinkingObjectsPropertyMissingSourcePropertyOfLink.class ]];\n    RLMAssertThrowsWithReasonMatching([RLMRealm realmWithConfiguration:config error:nil],\n                                      @\"Property 'InvalidLinkingObjectsPropertyMissingSourcePropertyOfLink.nosuchproperty' declared as origin of linking objects property 'InvalidLinkingObjectsPropertyMissingSourcePropertyOfLink.linkingObjects' does not exist\");\n}\n\n- (void)testClassWithInvalidLinkingObjectsPropertySourcePropertyNotALink {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.customSchema = [RLMSchema schemaWithObjectClasses:@[ InvalidLinkingObjectsPropertySourcePropertyNotALink.class ]];\n    RLMAssertThrowsWithReasonMatching([RLMRealm realmWithConfiguration:config error:nil],\n                                      @\"Property 'InvalidLinkingObjectsPropertySourcePropertyNotALink.integer' declared as origin of linking objects property 'InvalidLinkingObjectsPropertySourcePropertyNotALink.linkingObjects' is not a link\");\n}\n\n- (void)testClassWithInvalidLinkingObjectsPropertySourcePropertysLinkElsewhere {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.customSchema = [RLMSchema schemaWithObjectClasses:@[ InvalidLinkingObjectsPropertySourcePropertyLinksElsewhere.class, IntObject.class ]];\n    RLMAssertThrowsWithReasonMatching([RLMRealm realmWithConfiguration:config error:nil],\n                                      @\"Property 'InvalidLinkingObjectsPropertySourcePropertyLinksElsewhere.link' declared as origin of linking objects property 'InvalidLinkingObjectsPropertySourcePropertyLinksElsewhere.linkingObjects' links to type 'IntObject'\");\n}\n\n- (void)testMixedIsRejected {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    RLMAssertThrowsWithReasonMatching(config.objectClasses = @[[MixedProperty class]],\n                                      @\"Property 'mixed' is declared as 'id'.*\");\n}\n\n- (void)testEmebeddedLinkingToNonEmbedded {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.objectClasses = @[[LinkFromEmbeddedToTopLevel class], [IntObject class]];\n    XCTAssertNoThrow([RLMRealm realmWithConfiguration:config error:nil]);\n    config.objectClasses = @[[ArrayFromEmbeddedToTopLevel class], [IntObject class]];\n    XCTAssertNoThrow([RLMRealm realmWithConfiguration:config error:nil]);\n}\n\n- (void)testEmbeddedWithPrimaryKey {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.objectClasses = @[[EmbeddedObjectWithPrimaryKey class]];\n    RLMAssertThrowsWithReason([RLMRealm realmWithConfiguration:config error:nil],\n                              @\"Embedded object type 'EmbeddedObjectWithPrimaryKey' cannot have a primary key.\");\n\n}\n\n// Can't spawn child processes on iOS\n#if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR && !TARGET_OS_MACCATALYST\n- (void)testPartialSharedSchemaInit {\n    if (self.isParent) {\n        RLMRunChildAndWait();\n        return;\n    }\n\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n\n    // Verify that opening with class subsets without the shared schema being\n    // initialized works\n    config.objectClasses = @[IntObject.class];\n    @autoreleasepool {\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n        XCTAssertEqual(1U, realm.schema.objectSchema.count);\n        XCTAssertNoThrow(realm.schema[@\"IntObject\"]);\n    }\n\n    config.objectClasses = @[IntObject.class, StringObject.class];\n    @autoreleasepool {\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n        XCTAssertEqual(2U, realm.schema.objectSchema.count);\n        XCTAssertNoThrow(realm.schema[@\"IntObject\"]);\n        XCTAssertNoThrow(realm.schema[@\"StringObject\"]);\n    }\n\n    // Verify that the shared schema generated afterwards is valid\n    config.objectClasses = nil;\n    @autoreleasepool {\n        RLMRealm *realm = [RLMRealm defaultRealm];\n\n        // Shared schema shouldn't have accessor classes\n        for (RLMObjectSchema *objectSchema in realm.schema.objectSchema) {\n            const char *actualClassName = class_getName(objectSchema.objectClass);\n            XCTAssertEqual(nullptr, strstr(actualClassName, \"RLMAccessor\"));\n            XCTAssertEqual(nullptr, strstr(actualClassName, \"RLMUnmanaged\"));\n        }\n\n        // Shared schema shouldn't have duplicate entries\n        XCTAssertEqual(realm.schema.objectSchema.count,\n                       [NSSet setWithArray:[realm.schema.objectSchema valueForKey:@\"className\"]].count);\n\n        // Shared schema should have the ones that were used in the subsets\n        XCTAssertNoThrow(realm.schema[@\"IntObject\"]);\n        XCTAssertNoThrow(realm.schema[@\"StringObject\"]);\n    }\n}\n\n- (void)testPartialSharedSchemaInitInheritance {\n    if (self.isParent) {\n        RLMRunChildAndWait();\n        return;\n    }\n\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.objectClasses = @[NumberObject.class];\n\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n    XCTAssertEqual(1U, realm.schema.objectSchema.count);\n    XCTAssertEqualObjects(@\"NumberObject\", [[[[NumberObject alloc] init] objectSchema] className]);\n    // Verify that child class doesn't use the parent class's schema\n    XCTAssertEqualObjects(@\"NumberDefaultsObject\", [[[[NumberDefaultsObject alloc] init] objectSchema] className]);\n}\n\n- (void)testCreateUnmanagedObjectWithUninitializedSchema {\n    if (self.isParent) {\n        RLMRunChildAndWait();\n        return;\n    }\n    XCTAssertTrue(RLMSchema.partialSharedSchema.objectSchema.count == 0);\n    XCTAssertNoThrow([[IntObject alloc] initWithValue:@[@0]]);\n    XCTAssertNoThrow([[NonDefaultObject alloc] initWithValue:@[@0]]);\n}\n\n- (void)testCreateUnmanagedObjectWithNestedObjectWithUninitializedSchema {\n    if (self.isParent) {\n        RLMRunChildAndWait();\n        return;\n    }\n    XCTAssertTrue(RLMSchema.partialSharedSchema.objectSchema.count == 0);\n    XCTAssertNoThrow([[IntegerArrayPropertyObject alloc] initWithValue:(@[@0, @[@[@0]]])]);\n    XCTAssertNoThrow([[NonDefaultArrayObject alloc] initWithValue:@[@[@[@0]]]]);\n    XCTAssertNoThrow([[MutualLink1Object alloc] initWithValue:@[@[@{}]]]);\n}\n\n- (void)testKVOSubclassesDoNotAppearInSchema {\n    if (self.isParent) {\n        RLMRunChildAndWait();\n        return;\n    }\n\n    auto obj = [IntObject new];\n    [obj addObserver:self forKeyPath:@\"intCol\" options:0 context:0];\n    for (RLMObjectSchema *objectSchema in RLMRealm.defaultRealm.schema.objectSchema) {\n        XCTAssertEqual([objectSchema.className rangeOfString:@\"RLM:\"].location, NSNotFound);\n    }\n    [obj removeObserver:self forKeyPath:@\"intCol\" context:0];\n}\n\n#if !DEBUG\n- (void)testMultipleProcessesTryingToInitializeSchema {\n    RLMRealm *syncRealm = [self realmWithTestPath];\n\n    if (!self.isParent) {\n        RLMSchema *schema = [RLMSchema schemaWithObjectClasses:@[IntObject.class]];\n        RLMProperty *prop = ((NSArray *)[schema.objectSchema[0] properties])[0];\n        prop.type = RLMPropertyTypeFloat;\n\n        RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n        config.customSchema = schema;\n        config.schemaVersion = 1;\n\n        [syncRealm transactionWithBlock:^{\n            [StringObject createInRealm:syncRealm withValue:@[@\"\"]];\n        }];\n\n        [RLMRealm realmWithConfiguration:config error:nil];\n        return;\n    }\n\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.objectClasses = @[IntObject.class];\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n\n    // Hold a write transaction to prevent the child processes from performing\n    // the migration immediately\n    [realm beginWriteTransaction];\n\n    // Spawn a bunch of child processes which will all try to perform the migration\n    dispatch_group_t group = dispatch_group_create();\n    for (int i = 0; i < 5; ++i) {\n        dispatch_group_async(group, dispatch_get_global_queue(0, 0), ^{\n            RLMRunChildAndWait();\n        });\n    }\n\n    // Wait for all five to be immediately before the point where they will try\n    // to perform the migration. There's inherently a race condition here in\n    // as in theory all but one process could be suspended immediately after\n    // committing the signalling commit and then not get woken up until after\n    // the migration is complete, but in practice it won't happen and we can't\n    // wait for someone to be waiting on a mutex.\n    XCTestExpectation *notificationFired = [self expectationWithDescription:@\"notification fired\"];\n    RLMNotificationToken *token = [syncRealm addNotificationBlock:^(NSString *, RLMRealm *) {\n        if ([StringObject allObjectsInRealm:syncRealm].count == 5) {\n            [notificationFired fulfill];\n        }\n    }];\n    [self waitForExpectationsWithTimeout:30.0 handler:nil];\n    [token invalidate];\n\n    // Release the write transaction and let them run\n    [realm cancelWriteTransaction];\n    dispatch_group_wait(group, DISPATCH_TIME_FOREVER);\n}\n#endif\n\n- (void)testOpeningFileWithDifferentClassSubsetsInDifferentProcesses {\n    if (!self.isParent) {\n        RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n        config.objectClasses = @[StringObject.class];\n\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n        XCTAssertEqual(1U, realm.schema.objectSchema.count);\n\n        // Verify that the StringObject table actually exists\n        [realm beginWriteTransaction];\n        [StringObject createInRealm:realm withValue:@[@\"\"]];\n        [realm commitWriteTransaction];\n        return;\n    }\n\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.objectClasses = @[IntObject.class];\n\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n    realm.autorefresh = false;\n    XCTAssertEqual(1U, realm.schema.objectSchema.count);\n\n    [realm beginWriteTransaction];\n    [IntObject createInRealm:realm withValue:@[@1]];\n    [realm commitWriteTransaction];\n\n    RLMRunChildAndWait();\n\n    // Should be able to advance over the transaction creating a new table and\n    // inserting a row into it\n    XCTAssertNoThrow([realm refresh]);\n\n    // Verify that the IntObject table didn't break\n    XCTAssertEqual(1, [[IntObject allObjectsInRealm:realm].firstObject intCol]);\n    [realm beginWriteTransaction];\n    [IntObject createInRealm:realm withValue:@[@2]];\n\n    // StringObject still isn't usable in this process since it isn't in the\n    // class subset\n    XCTAssertThrows([StringObject createInRealm:realm withValue:@[@\"\"]]);\n    [realm commitWriteTransaction];\n}\n\n- (void)testAddingIndexToExistingColumnInBackgroundProcess {\n    if (!self.isParent) {\n        RLMSchema *schema = [RLMSchema schemaWithObjectClasses:@[IntObject.class]];\n        RLMObjectSchema *objectSchema = schema.objectSchema[0];\n        RLMProperty *prop = objectSchema.properties[0];\n        prop.indexed = YES;\n\n        RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n        config.customSchema = schema;\n        [RLMRealm realmWithConfiguration:config error:nil];\n        return;\n    }\n\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.objectClasses = @[IntObject.class];\n\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n    realm.autorefresh = false;\n    XCTAssertEqual(1U, realm.schema.objectSchema.count);\n\n    // Insert a value to ensure stuff actually happens when the index is added/removed\n    [realm beginWriteTransaction];\n    [IntObject createInRealm:realm withValue:@[@1]];\n    [realm commitWriteTransaction];\n\n    RLMRunChildAndWait();\n\n    // Should accept the index change\n    XCTAssertNoThrow([realm refresh]);\n}\n\n- (void)testRemovingIndexFromExistingColumnInBackgroundProcess {\n    if (!self.isParent) {\n        RLMSchema *schema = [RLMSchema schemaWithObjectClasses:@[IndexedStringObject.class]];\n        RLMObjectSchema *objectSchema = schema.objectSchema[0];\n        RLMProperty *prop = objectSchema.properties[0];\n        prop.indexed = NO;\n\n        RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n        config.customSchema = schema;\n        [RLMRealm realmWithConfiguration:config error:nil];\n        return;\n    }\n\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.objectClasses = @[IndexedStringObject.class];\n\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n    realm.autorefresh = false;\n    XCTAssertEqual(1U, realm.schema.objectSchema.count);\n\n    // Insert a value to ensure stuff actually happens when the index is added/removed\n    [realm beginWriteTransaction];\n    [IndexedStringObject createInRealm:realm withValue:@[@\"1\"]];\n    [realm commitWriteTransaction];\n\n    RLMRunChildAndWait();\n\n    // Should accept the index change\n    XCTAssertNoThrow([realm refresh]);\n}\n\n- (void)testMigratingToLaterVersionInBackgroundProcess {\n    if (!self.isParent) {\n        RLMSchema *schema = [RLMSchema schemaWithObjectClasses:@[IntObject.class]];\n        RLMObjectSchema *objectSchema = schema.objectSchema[0];\n        RLMProperty *prop = objectSchema.properties[0];\n        prop.type = RLMPropertyTypeFloat;\n\n        RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n        config.customSchema = schema;\n        config.schemaVersion = 1;\n        [RLMRealm realmWithConfiguration:config error:nil];\n        return;\n    }\n\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.objectClasses = @[IntObject.class];\n\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n    realm.autorefresh = false;\n    [realm beginWriteTransaction];\n    [IntObject createInRealm:realm withValue:@[@1]];\n    [realm commitWriteTransaction];\n\n    RLMRunChildAndWait();\n\n    // Should fail to refresh since we can't use later versions of the file due\n    // to the schema change\n    XCTAssertThrows([realm refresh]);\n    XCTAssertThrows([realm beginWriteTransaction]);\n\n    // Should have been left in a sensible state after the errors\n    XCTAssertEqual(1, [[IntObject allObjectsInRealm:realm].firstObject intCol]);\n}\n\n- (void)testInsertingColumnsInBackgroundProcess {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.schemaMode = realm::SchemaMode::AdditiveDiscovered;\n    if (!self.isParent) {\n        config.dynamic = true;\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n        [realm beginWriteTransaction];\n        auto table = realm->_info[@\"IntObject\"].table();\n        table->add_column(realm::type_String, realm::util::format(\"col%1\", table->get_column_count()).c_str());\n        [realm commitWriteTransaction];\n        return;\n    }\n\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n    [realm transactionWithBlock:^{\n        [IntObject createInRealm:realm withValue:@[@5]];\n    }];\n\n    RLMRunChildAndWait();\n    XCTAssertEqual(5, [[IntObject allObjectsInRealm:realm].firstObject intCol]);\n    XCTAssertEqual(1U, [IntObject objectsInRealm:realm where:@\"intCol = 5\"].count);\n\n    __block IntObject *io = [IntObject new];\n    io.intCol = 6;\n    [realm transactionWithBlock:^{ [realm addObject:io]; }];\n    XCTAssertEqual(io.intCol, 6);\n    XCTAssertEqualObjects(io[@\"intCol\"], @6);\n\n    [realm transactionWithBlock:^{ io = [IntObject createInRealm:realm withValue:@[@7]]; }];\n    XCTAssertEqual(io.intCol, 7);\n\n    [realm transactionWithBlock:^{ io = [IntObject createInRealm:realm withValue:@{@\"intCol\": @8}]; }];\n    XCTAssertEqual(io.intCol, 8);\n\n    [realm transactionWithBlock:^{ io.intCol = 9; }];\n    XCTAssertEqual(io.intCol, 9);\n\n    [realm transactionWithBlock:^{ io[@\"intCol\"] = @10; }];\n    XCTAssertEqual(io.intCol, 10);\n\n    // Create query, add column, run query\n    RLMResults *query = [IntObject objectsInRealm:realm where:@\"intCol > 5\"];\n    RLMRunChildAndWait();\n    XCTAssertEqual(query.count, 3U);\n\n    // Create query, create TV, add column, reevaluate query\n    query = [IntObject objectsInRealm:realm where:@\"intCol > 5\"];\n    (void)[query lastObject];\n    RLMRunChildAndWait();\n    XCTAssertEqual(query.count, 3U);\n}\n\n- (void)testExplicitlyIncludedEmbeddedOrphanIsAllowedForLocalRealm {\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.objectClasses = @[OrphanObject.class];\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];\n    XCTAssertNotNil([realm.schema schemaForClassName:@\"OrphanObject\"]);\n}\n\n- (void)testDynamicUnmanagedAccessorsBeforeSharedSchemaInit {\n    if (self.isParent) {\n        RLMRunChildAndWait();\n        return;\n    }\n\n    IntObject *io = [IntObject new];\n    io[@\"intCol\"] = @10;\n    XCTAssertEqualObjects(io[@\"intCol\"], @10);\n}\n#endif\n\n@end\n"
  },
  {
    "path": "Realm/Tests/SectionedResultsTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2022 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#import <Realm/RLMSectionedResults.h>\n\n@interface SectionedResultsTests : RLMTestCase\n@end\n\n@implementation SectionedResultsTests\n\n- (void)createObjects {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm transactionWithBlock:^{\n        StringObject *strObj1 = [[StringObject alloc] initWithValue:@[@\"foo\"]];\n        StringObject *strObj2 = [[StringObject alloc] initWithValue:@[@\"bar\"]];\n        StringObject *strObj3 = [[StringObject alloc] initWithValue:@[@\"apple\"]];\n        StringObject *strObj4 = [[StringObject alloc] initWithValue:@[@\"apples\"]];\n        StringObject *strObj5 = [[StringObject alloc] initWithValue:@[@\"zebra\"]];\n\n        [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:1 stringObject:strObj5]];\n        [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:1 stringObject:strObj5]];\n        [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:1 stringObject:strObj5]];\n        [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:2 stringObject:strObj4]];\n        [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:2 stringObject:strObj4]];\n        [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:2 stringObject:strObj3]];\n        [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:3 stringObject:strObj2]];\n        [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:3 stringObject:strObj1]];\n        [AllTypesObject createInRealm:realm withValue:[AllTypesObject values:3 stringObject:strObj1]];\n    }];\n}\n\n- (void)createPrimitiveObject {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm transactionWithBlock:^{\n        AllPrimitiveArrays *arrObj = [AllPrimitiveArrays new];\n        [arrObj.stringObj addObject:@\"foo\"];\n        [arrObj.stringObj addObject:@\"fab\"];\n        [arrObj.stringObj addObject:@\"bar\"];\n        [arrObj.stringObj addObject:@\"baz\"];\n        [realm addObject:arrObj];\n    }];\n}\n\n- (void)testCreationFromResults {\n    [self createObjects];\n    RLMRealm *realm = self.realmWithTestPath;\n\n    RLMResults<AllTypesObject *> *results = [AllTypesObject allObjectsInRealm:realm];\n    RLMSectionedResults<NSString *, AllTypesObject *> *sr = [results sectionedResultsSortedUsingKeyPath:@\"objectCol.stringCol\"\n                                                                                              ascending:YES\n                                                                                               keyBlock:^id<RLMValue>(AllTypesObject *value) {\n        return [value.objectCol.stringCol substringToIndex:1];\n    }];\n\n    XCTAssertNotNil(sr);\n    XCTAssertEqual(sr.count, 4);\n    XCTAssertEqual(sr[0].count, 3);\n    XCTAssertEqual(sr[1].count, 1);\n    XCTAssertEqual(sr[2].count, 2);\n    XCTAssertEqual(sr[3].count, 3);\n}\n\n- (void)testCreationFromPrimitiveResults {\n    [self createPrimitiveObject];\n    RLMRealm *realm = self.realmWithTestPath;\n\n    AllPrimitiveArrays *obj = [AllPrimitiveArrays allObjectsInRealm:realm][0];\n    RLMSectionedResults *sr = [obj.stringObj sectionedResultsSortedUsingKeyPath:@\"self\"\n                                                                      ascending:YES\n                                                                       keyBlock:^id<RLMValue> (NSString* value) {\n        return [value substringToIndex:1];\n    }];\n    XCTAssertEqual(sr.count, 2);\n\n    [realm transactionWithBlock:^{\n        [obj.stringObj addObject:@\"hello\"];\n\n    }];\n    XCTAssertEqual(sr.count, 3);\n\n    [realm transactionWithBlock:^{\n        [obj.stringObj addObject:@\"zebra\"];\n    }];\n    XCTAssertEqual(sr.count, 4);\n}\n\n- (NSDictionary *)keyPathsAndValues {\n    return @{\n        @\"intCol\": @{\n            @1: @[@1, @1, @1, @3, @3, @3],\n            @0: @[@2, @2, @2]\n        },\n        @\"longCol\": @{\n            @0: @[@((long long)1 * INT_MAX + 1), @((long long)1 * INT_MAX + 1), @((long long)1 * INT_MAX + 1),\n                  @((long long)3 * INT_MAX + 1), @((long long)3 * INT_MAX + 1), @((long long)3 * INT_MAX + 1)],\n            @-1: @[@((long long)2 * INT_MAX + 1), @((long long)2 * INT_MAX + 1), @((long long)2 * INT_MAX + 1)]\n        },\n        @\"boolCol\": @{\n            @NO: @[@NO, @NO, @NO],\n            @YES: @[@YES, @YES, @YES, @YES, @YES, @YES]\n        },\n        @\"cBoolCol\": @{\n            @NO: @[@NO, @NO, @NO],\n            @YES: @[@YES, @YES, @YES, @YES, @YES, @YES]\n        },\n        @\"floatCol\": @{\n            @(1.1f): @[@(1.1f * 1), @(1.1f * 1), @(1.1f * 1)],\n            @(2.2f): @[@(1.1f * 2), @(1.1f * 2), @(1.1f * 2), @(1.1f * 3), @(1.1f * 3), @(1.1f * 3)]\n        },\n        @\"doubleCol\": @{\n            @(1.11): @[@(1.11 * 1), @(1.11 * 1), @(1.11 * 1)],\n            @(2.2): @[@(1.11 * 2), @(1.11 * 2), @(1.11 * 2), @(1.11 * 3), @(1.11 * 3), @(1.11 * 3)]\n        },\n        @\"stringCol\": @{\n            @\"a\": @[@\"a\", @\"a\", @\"a\"],\n            @\"b\": @[@\"b\", @\"b\", @\"b\"],\n            @\"c\": @[@\"c\", @\"c\", @\"c\"]\n        },\n        @\"objectCol.stringCol\": @{\n            @\"a\": @[@\"apple\", @\"apples\", @\"apples\"],\n            @\"b\": @[@\"bar\"],\n            @\"f\": @[@\"foo\", @\"foo\"],\n            @\"z\": @[@\"zebra\", @\"zebra\", @\"zebra\"]\n        },\n        @\"dateCol\": @{\n            @5: @[[NSDate dateWithTimeIntervalSince1970:1], [NSDate dateWithTimeIntervalSince1970:1], [NSDate dateWithTimeIntervalSince1970:1],\n                  [NSDate dateWithTimeIntervalSince1970:2], [NSDate dateWithTimeIntervalSince1970:2], [NSDate dateWithTimeIntervalSince1970:2],\n                  [NSDate dateWithTimeIntervalSince1970:3], [NSDate dateWithTimeIntervalSince1970:3], [NSDate dateWithTimeIntervalSince1970:3]]\n        },\n        @\"decimalCol\": @{\n            @\"one\": @[[[RLMDecimal128 alloc] initWithNumber:@(1)], [[RLMDecimal128 alloc] initWithNumber:@(1)], [[RLMDecimal128 alloc] initWithNumber:@(1)]],\n            @\"two\": @[[[RLMDecimal128 alloc] initWithNumber:@(2)], [[RLMDecimal128 alloc] initWithNumber:@(2)], [[RLMDecimal128 alloc] initWithNumber:@(2)]],\n            @\"three\": @[[[RLMDecimal128 alloc] initWithNumber:@(3)], [[RLMDecimal128 alloc] initWithNumber:@(3)], [[RLMDecimal128 alloc] initWithNumber:@(3)]]\n        },\n        @\"uuidCol\": @{\n            @\"a\": @[[[NSUUID alloc] initWithUUIDString:@\"00000000-0000-0000-0000-000000000000\"],\n                    [[NSUUID alloc] initWithUUIDString:@\"00000000-0000-0000-0000-000000000000\"],\n                    [[NSUUID alloc] initWithUUIDString:@\"00000000-0000-0000-0000-000000000000\"]],\n            @\"b\": @[[[NSUUID alloc] initWithUUIDString:@\"137DECC8-B300-4954-A233-F89909F4FD89\"],\n                    [[NSUUID alloc] initWithUUIDString:@\"137DECC8-B300-4954-A233-F89909F4FD89\"],\n                    [[NSUUID alloc] initWithUUIDString:@\"137DECC8-B300-4954-A233-F89909F4FD89\"]],\n            @\"c\": @[[[NSUUID alloc] initWithUUIDString:@\"b84e8912-a7c2-41cd-8385-86d200d7b31e\"],\n                    [[NSUUID alloc] initWithUUIDString:@\"b84e8912-a7c2-41cd-8385-86d200d7b31e\"],\n                    [[NSUUID alloc] initWithUUIDString:@\"b84e8912-a7c2-41cd-8385-86d200d7b31e\"]]\n        },\n        @\"anyCol\": @{\n            @1: @[@3, @3, @3],\n            @0: @[@2, @2, @2, @4, @4, @4]\n        }\n    };\n}\n\n- (id<RLMValue>)sectionKeyForValue:(id<RLMValue>)value {\n    switch (value.rlm_anyValueType) {\n        case RLMAnyValueTypeInt:\n            return [NSNumber numberWithInt:(((NSNumber *)value).intValue % 2)];\n        case RLMAnyValueTypeBool:\n            return value;\n        case RLMAnyValueTypeFloat:\n            return [(NSNumber *)value isEqualToNumber:@(1.1f * 1)] ? @(1.1f) : @(2.2f);\n        case RLMAnyValueTypeDouble:\n            return [(NSNumber *)value isEqualToNumber:@(1.11 * 1)] ? @(1.11) : @(2.2);\n        case RLMAnyValueTypeString:\n            return [(NSString *)value substringToIndex:1];\n        case RLMAnyValueTypeDate: {\n            NSCalendar *calendar = [NSCalendar currentCalendar];\n            [calendar setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];\n            NSDateComponents *comp = [calendar components:NSCalendarUnitWeekday fromDate:(NSDate *)value];\n            return [NSNumber numberWithInteger:(NSInteger)comp.weekday];\n        }\n        case RLMAnyValueTypeDecimal128:\n            switch ((int)((RLMDecimal128 *)value).doubleValue) {\n                case 1:\n                    return @\"one\";\n                case 2:\n                    return @\"two\";\n                case 3:\n                    return @\"three\";\n                default:\n                    XCTFail();\n            }\n        case RLMAnyValueTypeUUID:\n            if ([(NSUUID *)value isEqual:[[NSUUID alloc] initWithUUIDString:@\"00000000-0000-0000-0000-000000000000\"]]) {\n                return @\"a\";\n            } else if ([(NSUUID *)value isEqual:[[NSUUID alloc] initWithUUIDString:@\"137DECC8-B300-4954-A233-F89909F4FD89\"]]) {\n                return @\"b\";\n            } else if ([(NSUUID *)value isEqual:[[NSUUID alloc] initWithUUIDString:@\"b84e8912-a7c2-41cd-8385-86d200d7b31e\"]]) {\n                return @\"c\";\n            }\n        case RLMAnyValueTypeAny:\n            return [NSNumber numberWithInt:(((NSNumber *)value).intValue % 2)];;\n        default:\n            XCTFail();\n            return nil;\n    }\n}\n\n- (void)testAllSupportedTypes {\n    [self createObjects];\n    RLMRealm *realm = self.realmWithTestPath;\n    RLMResults<AllTypesObject *> *results = [AllTypesObject allObjectsInRealm:realm];\n\n    void(^testBlock)(NSString *) = ^(NSString *keyPath) {\n        __block int algoRunCount = 0;\n        RLMSectionedResults<id<RLMValue>, AllTypesObject *> *sr = [results sectionedResultsSortedUsingKeyPath:keyPath\n                                                                                                    ascending:YES\n                                                                                                     keyBlock:^id<RLMValue>(id value) {\n            algoRunCount++;\n            return [self sectionKeyForValue:[value valueForKeyPath:keyPath]];\n        }];\n\n        NSDictionary *values = [self keyPathsAndValues][keyPath];\n        for (RLMSection *section in sr) {\n            NSArray *a = values[section.key];\n            for (NSUInteger i = 0; i < section.count; i++) {\n                XCTAssertEqualObjects(a[i], [section[i] valueForKeyPath:keyPath]);\n            }\n        }\n        XCTAssertEqual(algoRunCount, 9);\n    };\n\n    testBlock(@\"intCol\");\n    testBlock(@\"boolCol\");\n    testBlock(@\"floatCol\");\n    testBlock(@\"doubleCol\");\n    testBlock(@\"stringCol\");\n    testBlock(@\"objectCol.stringCol\");\n    testBlock(@\"dateCol\");\n    testBlock(@\"cBoolCol\");\n    testBlock(@\"longCol\");\n    testBlock(@\"decimalCol\");\n    testBlock(@\"uuidCol\");\n    testBlock(@\"anyCol\");\n}\n\n- (void)testAllSupportedOptionalTypes {\n    NSDictionary *values = @{\n        @\"intObj\": @1,\n        @\"floatObj\": @1.0f,\n        @\"doubleObj\": @1.0,\n        @\"boolObj\": @YES,\n        @\"string\": @\"foo\",\n        @\"date\": [NSDate dateWithTimeIntervalSince1970:1],\n        @\"decimal\": [[RLMDecimal128 alloc] initWithNumber:@1],\n        @\"uuidCol\": [[NSUUID alloc] initWithUUIDString:@\"85d4fbee-6ec6-47df-bfa1-615931903d7e\"]\n    };\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm transactionWithBlock:^{\n        [AllOptionalTypes createInRealm:realm withValue:values];\n        [realm addObject:[AllOptionalTypes new]];\n    }];\n\n    RLMResults<AllOptionalTypes *> *results = [AllOptionalTypes allObjectsInRealm:realm];\n\n    void(^testBlock)(NSString *) = ^(NSString *keyPath) {\n        __block int algoRunCount = 0;\n        RLMSectionedResults<id<RLMValue>, AllOptionalTypes *> *sr = [results sectionedResultsSortedUsingKeyPath:keyPath\n                                                                                                      ascending:YES\n                                                                                                       keyBlock:^id<RLMValue>(AllOptionalTypes *value) {\n            algoRunCount++;\n            if ([value valueForKeyPath:keyPath]) {\n                return @\"Not null\";\n            } else {\n                return nil;\n            }\n        }];\n\n        RLMSection *nullSection = sr[0];\n        XCTAssertEqualObjects(nullSection.key, NSNull.null);\n        XCTAssertNil([nullSection[0] valueForKeyPath:keyPath]);\n\n        RLMSection *nonNullSection = sr[1];\n        XCTAssertEqualObjects(nonNullSection.key, @\"Not null\");\n        XCTAssertEqualObjects([nonNullSection[0] valueForKeyPath:keyPath], values[keyPath]);\n\n        XCTAssertEqual(algoRunCount, 2);\n    };\n\n    testBlock(@\"intObj\");\n    testBlock(@\"floatObj\");\n    testBlock(@\"doubleObj\");\n    testBlock(@\"boolObj\");\n    testBlock(@\"string\");\n    testBlock(@\"date\");\n    testBlock(@\"decimal\");\n    testBlock(@\"uuidCol\");\n}\n\n- (void)testObjectIdCol {\n    RLMRealm *realm = self.realmWithTestPath;\n    __block RLMObjectId *oid1;\n    __block RLMObjectId *oid2;\n\n    [realm transactionWithBlock:^{\n        NSDictionary *ato1Values = [AllTypesObject values:0 stringObject:nil];\n        oid1 = ato1Values[@\"objectIdCol\"];\n        [AllTypesObject createInRealm:realm withValue:ato1Values];\n        NSDictionary *ato2Values = [AllTypesObject values:0 stringObject:nil];\n        oid2 = ato2Values[@\"objectIdCol\"];\n        [AllTypesObject createInRealm:realm withValue:ato2Values];\n\n        AllOptionalTypes *ot1 = [AllOptionalTypes new];\n        ot1.objectId = oid1;\n        AllOptionalTypes *ot2 = [AllOptionalTypes new];\n        [realm addObjects:@[ot1, ot2]];\n    }];\n\n    RLMResults<AllTypesObject *> *results = [AllTypesObject allObjectsInRealm:realm];\n    RLMResults<AllOptionalTypes *> *resultsOpt = [AllOptionalTypes allObjectsInRealm:realm];\n    __block int sectionAlgoCount = 0;\n\n    RLMSectionedResults<NSString *, AllTypesObject *> *sr = [results sectionedResultsSortedUsingKeyPath:@\"objectIdCol\"\n                                                                                              ascending:YES\n                                                                                               keyBlock:^id<RLMValue>(id value) {\n        id v = [value valueForKeyPath:@\"objectIdCol\"];\n        sectionAlgoCount++;\n        return [((RLMObjectId *)v) isEqual:oid1] ? @\"a\" : @\"b\";\n    }];\n\n    NSDictionary *values = @{@\"a\": oid1, @\"b\": oid2};\n    for (RLMSection *section in sr) {\n        RLMObjectId *oid = values[section.key];\n        for (NSUInteger i = 0; i < section.count; i++) {\n            XCTAssertEqualObjects(oid, [section[i] valueForKeyPath:@\"objectIdCol\"]);\n        }\n    }\n    XCTAssertEqual(sectionAlgoCount, 2);\n\n    sectionAlgoCount = 0;\n    RLMSectionedResults<NSString  *, AllOptionalTypes *> *srOpt = [resultsOpt sectionedResultsSortedUsingKeyPath:@\"objectId\"\n                                                                                                       ascending:YES\n                                                                                                        keyBlock:^id<RLMValue>(id value) {\n        sectionAlgoCount++;\n        id v = [value valueForKeyPath:@\"objectId\"];\n        return !v ? @\"b\" : @\"a\";\n    }];\n\n    values = @{@\"a\": oid1, @\"b\": NSNull.null};\n    for (RLMSection *section in srOpt) {\n        RLMObjectId *oid = values[section.key];\n        for (NSUInteger i = 0; i < section.count; i++) {\n            id v = [section[i] valueForKeyPath:@\"objectId\"];\n            if ([((NSString *)section.key) isEqualToString:@\"b\"]) {\n                XCTAssertNil(v);\n            } else {\n                XCTAssertEqualObjects(oid, v);\n            }\n        }\n    }\n    XCTAssertEqual(sectionAlgoCount, 2);\n}\n\n- (void)testBinaryCol {\n    RLMRealm *realm = self.realmWithTestPath;\n    __block NSData *d1;\n    __block NSData *d2;\n\n    [realm transactionWithBlock:^{\n        NSDictionary *ato1Values = [AllTypesObject values:0 stringObject:nil];\n        d1 = ato1Values[@\"binaryCol\"];\n        [AllTypesObject createInRealm:realm withValue:ato1Values];\n        NSDictionary *ato2Values = [AllTypesObject values:0 stringObject:nil];\n        d2 = ato2Values[@\"binaryCol\"];\n        [AllTypesObject createInRealm:realm withValue:ato2Values];\n\n        AllOptionalTypes *ot1 = [AllOptionalTypes new];\n        ot1.data = d1;\n        AllOptionalTypes *ot2 = [AllOptionalTypes new];\n        [realm addObjects:@[ot1, ot2]];\n    }];\n\n    RLMResults<AllTypesObject *> *results = [AllTypesObject allObjectsInRealm:realm];\n    RLMResults<AllOptionalTypes *> *resultsOpt = [AllOptionalTypes allObjectsInRealm:realm];\n    __block int sectionAlgoCount = 0;\n\n    // Sorting on binary col is unsupported\n    RLMSectionedResults<NSString *, AllTypesObject *> *sr = [results sectionedResultsSortedUsingKeyPath:@\"intCol\"\n                                                                                              ascending:YES\n                                                                                               keyBlock:^id<RLMValue>(id value) {\n        id v = [value valueForKeyPath:@\"binaryCol\"];\n        sectionAlgoCount++;\n        return [((NSData *)v) isEqual:d1] ? @\"a\" : @\"b\";\n    }];\n\n    NSDictionary *values = @{@\"a\": d1, @\"b\": d2};\n    for (RLMSection *section in sr) {\n        RLMObjectId *oid = values[section.key];\n        for (NSUInteger i = 0; i < section.count; i++) {\n            XCTAssertEqualObjects(oid, [section[i] valueForKeyPath:@\"binaryCol\"]);\n        }\n    }\n    XCTAssertEqual(sectionAlgoCount, 2);\n\n    sectionAlgoCount = 0;\n    RLMSectionedResults<NSString *, AllOptionalTypes *> *srOpt = [resultsOpt sectionedResultsSortedUsingKeyPath:@\"intObj\"\n                                                                                                      ascending:YES\n                                                                                                       keyBlock:^id<RLMValue>(id value) {\n        sectionAlgoCount++;\n        id v = [value valueForKeyPath:@\"data\"];\n        return !v ? @\"b\" : @\"a\";\n    }];\n\n    values = @{@\"a\": d1, @\"b\": NSNull.null};\n    for (RLMSection *section in srOpt) {\n        NSData *d = values[section.key];\n        for (NSUInteger i = 0; i < section.count; i++) {\n            id v = [section[i] valueForKeyPath:@\"data\"];\n            if ([((NSString *)section.key) isEqualToString:@\"b\"]) {\n                XCTAssertNil(v);\n            } else {\n                XCTAssertEqualObjects(d, v);\n            }\n        }\n    }\n    XCTAssertEqual(sectionAlgoCount, 2);\n}\n\n- (void)testAllKeys {\n    RLMRealm *realm = self.realmWithTestPath;\n\n    [realm transactionWithBlock:^{\n        [StringObject createInRealm:realm withValue:@[@\"apple\"]];\n        [StringObject createInRealm:realm withValue:@[@\"any\"]];\n        [StringObject createInRealm:realm withValue:@[@\"banana\"]];\n    }];\n\n    RLMResults<StringObject *> *results = [StringObject allObjectsInRealm:realm];\n    RLMSectionedResults<NSString *, AllTypesObject *> *sr = [results sectionedResultsSortedUsingKeyPath:@\"stringCol\"\n                                                                                              ascending:YES\n                                                                                               keyBlock:^id<RLMValue>(StringObject *value) {\n        return value.firstLetter;\n    }];\n\n    XCTAssertEqualObjects(sr.allKeys, (@[@\"a\", @\"b\"]));\n}\n\n- (void)testDescription {\n    RLMRealm *realm = self.realmWithTestPath;\n\n    [realm transactionWithBlock:^{\n        [StringObject createInRealm:realm withValue:@[@\"apple\"]];\n        [StringObject createInRealm:realm withValue:@[@\"any\"]];\n        [StringObject createInRealm:realm withValue:@[@\"banana\"]];\n    }];\n\n    RLMResults<StringObject *> *results = [StringObject allObjectsInRealm:realm];\n    RLMSectionedResults<NSString *, AllTypesObject *> *sr = [results sectionedResultsSortedUsingKeyPath:@\"stringCol\"\n                                                                                              ascending:YES\n                                                                                               keyBlock:^id<RLMValue>(StringObject *value) {\n        return value.firstLetter;\n    }];\n\n    NSString *expDesc =\n    @\"(?s)RLMSectionedResults\\\\<StringObject\\\\> \\\\<0x[a-z0-9]+\\\\> \\\\(\\n\"\n    @\"\\t\\\\[a\\\\] RLMSection \\\\<0x[a-z0-9]+\\\\> \\\\(\\n\"\n    @\"\\t\\t\\\\[0\\\\] StringObject \\\\{\\n\"\n    @\"\\t\\t\\tstringCol = any;\\n\"\n    @\"\\t\\t\\\\},\\n\"\n    @\"\\t\\t\\\\[1\\\\] StringObject \\\\{\\n\"\n    @\"\\t\\t\\tstringCol = apple;\\n\"\n    @\"\\t\\t\\\\}\\n\"\n    @\"\\t\\\\),\\n\"\n    @\"\\t\\\\[b\\\\] RLMSection \\\\<0x[a-z0-9]+\\\\> \\\\(\\n\"\n    @\"\\t\\t\\\\[0\\\\] StringObject \\\\{\\n\"\n    @\"\\t\\t\\tstringCol = banana;\\n\"\n    @\"\\t\\t\\\\}\\n\"\n    @\"\\t\\\\)\\n\"\n    @\"\\\\)\";\n    RLMAssertMatches(sr.description, expDesc);\n\n    expDesc =\n    @\"RLMSection \\\\<0x[a-z0-9]+\\\\> \\\\(\\n\"\n    @\"\\t\\\\[0\\\\] StringObject \\\\{\\n\"\n    @\"\\t\\tstringCol = any;\\n\"\n    @\"\\t\\\\},\\n\"\n    @\"\\t\\\\[1\\\\] StringObject \\\\{\\n\"\n    @\"\\t\\tstringCol = apple;\\n\"\n    @\"\\t\\\\}\\n\"\n    @\"\\\\)\";\n    RLMAssertMatches(sr[0].description, expDesc);\n}\n\n- (void)testFastEnumeration {\n    for (int i = 0; i < 10; i++) {\n        [self createObjects];\n    }\n    RLMRealm *realm = self.realmWithTestPath;\n\n    __block NSUInteger algoRunCount = 0;\n    __block NSUInteger forLoopCount = 0;\n\n    RLMResults<AllTypesObject *> *results = [AllTypesObject allObjectsInRealm:realm];\n    RLMSectionedResults<NSString *, AllTypesObject *> *sr = [results sectionedResultsSortedUsingKeyPath:@\"objectCol.stringCol\"\n                                                                                              ascending:YES\n                                                                                               keyBlock:^id<RLMValue>(AllTypesObject *value) {\n        algoRunCount++;\n        return value.stringCol;\n    }];\n\n    for (RLMSection *section in sr) {\n        for (AllTypesObject *o __unused in section) {\n            forLoopCount++;\n        }\n    }\n    XCTAssertEqual(algoRunCount, results.count);\n    XCTAssertEqual(forLoopCount, results.count);\n    forLoopCount = 0;\n    [self createObjects];\n    algoRunCount = 0;\n\n    for (RLMSection *section in sr) {\n        for (AllTypesObject *o __unused in section) {\n            forLoopCount++;\n        }\n    }\n    XCTAssertEqual(algoRunCount, results.count);\n    XCTAssertEqual(forLoopCount, results.count);\n    forLoopCount = 0;\n    algoRunCount = 0;\n    NSUInteger originalCount = results.count;\n\n    for (RLMSection *section in sr) {\n        for (AllTypesObject *o __unused in section) {\n            forLoopCount++;\n        }\n        [self createObjects];\n    }\n    // transaction inside the 'for in' should not invoke the section key\n    // callback until the next access of the SectionedResults collection.\n    XCTAssertEqual(algoRunCount, 0);\n    XCTAssertEqual(forLoopCount, originalCount);\n}\n\nstatic RLMSectionedResultsChange *getChange(SectionedResultsTests *self, void (^block)(RLMRealm *)) {\n    __block RLMSectionedResultsChange *changes;\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    RLMResults<StringObject *> *results = [StringObject allObjectsInRealm:realm];\n    RLMSectionedResults<NSString *, StringObject *> *sr = [results sectionedResultsSortedUsingKeyPath:@\"stringCol\"\n                                                                                            ascending:YES\n                                                                                             keyBlock:^id<RLMValue>(StringObject *value) {\n        return value.firstLetter;\n    }];\n\n    id token = [sr addNotificationBlock:^(RLMSectionedResults *sr,\n                                          RLMSectionedResultsChange *c) {\n        changes = c;\n        XCTAssertNotNil(sr);\n        CFRunLoopStop(CFRunLoopGetCurrent());\n    }];\n    \n    CFRunLoopRun();\n\n    [self waitForNotification:RLMRealmDidChangeNotification realm:RLMRealm.defaultRealm block:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            block(realm);\n        }];\n    }];\n\n    [(RLMNotificationToken *)token invalidate];\n    token = nil;\n\n    return changes;\n}\n\nstatic void ExpectChange(id self,\n                         NSArray<NSIndexPath *> *insertions,\n                         NSArray<NSIndexPath *> *deletions,\n                         NSArray<NSIndexPath *> *modifications,\n                         NSArray<NSNumber *> *sectionsToInsert,\n                         NSArray<NSNumber *> *sectionsToRemove,\n                         void (^block)(RLMRealm *)) {\n    RLMSectionedResultsChange *changes = getChange(self, block);\n    XCTAssertNotNil(changes);\n    if (!changes) {\n        return;\n    }\n\n    XCTAssertEqualObjects(insertions, changes.insertions);\n    XCTAssertEqualObjects(deletions, changes.deletions);\n    XCTAssertEqualObjects(modifications, changes.modifications);\n    XCTAssertEqual(sectionsToInsert.count, changes.sectionsToInsert.count);\n    XCTAssertEqual(sectionsToRemove.count, changes.sectionsToRemove.count);\n\n    for (NSIndexPath *insertion in insertions) {\n        NSArray *filtered = [insertions filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@\"section == %d\", insertion.section]];\n        XCTAssertEqualObjects(filtered, [changes insertionsInSection:insertion.section]);\n    }\n\n    for (NSIndexPath *deletion in deletions) {\n        NSArray *filtered = [deletions filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@\"section == %d\", deletion.section]];\n        XCTAssertEqualObjects(filtered, [changes deletionsInSection:deletion.section]);\n    }\n\n    for (NSIndexPath *modification in modifications) {\n        NSArray *filtered = [modifications filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@\"section == %d\", modification.section]];\n        XCTAssertEqualObjects(filtered, [changes modificationsInSection:modification.section]);\n    }\n\n    for (NSNumber *i in sectionsToInsert) {\n        XCTAssertTrue([changes.sectionsToInsert containsIndex:i.unsignedIntegerValue]);\n    }\n    for (NSNumber *i in sectionsToRemove) {\n        XCTAssertTrue([changes.sectionsToRemove containsIndex:i.unsignedIntegerValue]);\n    }\n}\n\n- (void)testNotifications {\n    StringObject *o1 = [[StringObject alloc] initWithValue:@[@\"any\"]];\n    StringObject *o2 = [[StringObject alloc] initWithValue:@[@\"zebra\"]];\n    StringObject *o3 = [[StringObject alloc] initWithValue:@[@\"apple\"]];\n    StringObject *o4 = [[StringObject alloc] initWithValue:@[@\"zulu\"]];\n    StringObject *o5 = [[StringObject alloc] initWithValue:@[@\"banana\"]];\n    StringObject *o6 = [[StringObject alloc] initWithValue:@[@\"beans\"]];\n\n    // Insertions\n    ExpectChange(self,\n                 @[[NSIndexPath indexPathForItem:0 inSection:0],\n                   [NSIndexPath indexPathForItem:1 inSection:0],\n                   [NSIndexPath indexPathForItem:0 inSection:1],\n                   [NSIndexPath indexPathForItem:0 inSection:2],\n                   [NSIndexPath indexPathForItem:1 inSection:2]],\n                 @[], @[], @[@0, @1, @2], @[], ^(RLMRealm *realm) {\n        [realm addObjects:@[o1, o2, o3, o4, o5]];\n    });\n\n    ExpectChange(self,\n                 @[[NSIndexPath indexPathForItem:1 inSection:1]],\n                 @[], @[], @[], @[], ^(RLMRealm *realm) {\n        [realm addObject:o6];\n    });\n\n    // Deletions\n    ExpectChange(self,\n                 @[], @[[NSIndexPath indexPathForItem:0 inSection:1]],\n                 @[], @[], @[], ^(RLMRealm *realm) {\n        StringObject *o = [[[StringObject allObjectsInRealm:realm] objectsWhere:@\"stringCol = 'banana'\"] firstObject];\n        [realm deleteObject:o]; // o5 will now be invalidated.\n    });\n\n    // Modifications\n    ExpectChange(self,\n                 @[], @[],\n                 @[[NSIndexPath indexPathForItem:0 inSection:1]],\n                 @[], @[], ^(RLMRealm *realm) {\n        StringObject *o = [[[StringObject allObjectsInRealm:realm] objectsWhere:@\"stringCol = 'beans'\"] firstObject];\n        o.stringCol = @\"breakfast\";\n    });\n\n    // Move object from one section to another\n    ExpectChange(self,\n                 @[[NSIndexPath indexPathForItem:0 inSection:0]],\n                 @[],\n                 @[],\n                 @[], @[@1], ^(RLMRealm *realm) {\n        StringObject *o = [[[StringObject allObjectsInRealm:realm] objectsWhere:@\"stringCol = 'breakfast'\"] firstObject];\n        o.stringCol = @\"all\";\n    });\n\n    // Move object from one section to a new section\n    ExpectChange(self,\n                 @[[NSIndexPath indexPathForItem:0 inSection:0],\n                   [NSIndexPath indexPathForItem:1 inSection:0],\n                   [NSIndexPath indexPathForItem:2 inSection:0]],\n                 @[],\n                 @[],\n                 @[@0], @[@0], ^(RLMRealm *realm) {\n        RLMResults<StringObject *> *objs = [[StringObject allObjectsInRealm:realm] objectsWhere:@\"stringCol BEGINSWITH 'a'\"];\n        for(StringObject *o in objs) {\n            o.stringCol = @\"max\";\n        }\n    });\n}\n\n- (void)testNotificationsOnSection {\n    __block RLMSectionedResultsChange *changes;\n    RLMRealm *realm = self.realmWithTestPath;\n    [self createObjects];\n    RLMResults<StringObject *> *results = [StringObject allObjectsInRealm:realm];\n    RLMSectionedResults<NSString *, StringObject *> *sr = [results sectionedResultsSortedUsingKeyPath:@\"stringCol\"\n                                                                                            ascending:YES\n                                                                                             keyBlock:^id<RLMValue>(StringObject *value) {\n        return value.firstLetter;\n    }];\n\n    RLMSection<NSString *, StringObject *> *section = sr[0];\n\n    RLMNotificationToken *token = [section addNotificationBlock:^(RLMSection *r, RLMSectionedResultsChange *c) {\n        changes = c;\n        XCTAssertNotNil(r);\n        CFRunLoopStop(CFRunLoopGetCurrent());\n    }\n                                    keyPaths:@[@\"stringCol\"]];\n\n    CFRunLoopRun();\n    [self waitForNotification:RLMRealmDidChangeNotification realm:self.realmWithTestPath block:^{\n        RLMRealm *r = self.realmWithTestPath;\n        [r transactionWithBlock:^{\n            StringObject *o = [StringObject allObjectsInRealm:r][0];\n            o.stringCol = @\"app\";\n        }];\n    }];\n\n    XCTAssertEqualObjects(changes.insertions, @[[NSIndexPath indexPathForItem:0 inSection:0]]);\n    XCTAssertEqualObjects(changes.modifications, @[]);\n    XCTAssertEqualObjects(changes.deletions, @[]);\n    XCTAssertEqual(changes.sectionsToInsert.count, 0);\n    XCTAssertEqual(changes.sectionsToRemove.count, 0);\n    [token invalidate];\n}\n\nstatic RLMSectionedResultsChange *getChangePrimitive(SectionedResultsTests *self, void (^block)(RLMRealm *)) {\n    __block RLMSectionedResultsChange *changes;\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    AllPrimitiveArrays *obj = [AllPrimitiveArrays allObjectsInRealm:realm][0];\n    RLMSectionedResults *sr = [obj.stringObj sectionedResultsSortedUsingKeyPath:@\"self\"\n                                                                      ascending:YES\n                                                                       keyBlock:^id<RLMValue> (id value) {\n        return [value substringToIndex:1];\n    }];\n\n    id token = [sr addNotificationBlock:^(RLMSectionedResults *sr,\n                                          RLMSectionedResultsChange *c) {\n        changes = c;\n        XCTAssertNotNil(sr);\n        CFRunLoopStop(CFRunLoopGetCurrent());\n    }];\n\n    CFRunLoopRun();\n\n    [self waitForNotification:RLMRealmDidChangeNotification realm:RLMRealm.defaultRealm block:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            block(realm);\n        }];\n    }];\n\n    [(RLMNotificationToken *)token invalidate];\n    token = nil;\n\n    return changes;\n}\n\nstatic void ExpectChangePrimitive(id self,\n                                  NSArray<NSIndexPath *> *insertions,\n                                  NSArray<NSIndexPath *> *deletions,\n                                  NSArray<NSIndexPath *> *modifications,\n                                  NSArray<NSNumber *> *sectionsToInsert,\n                                  NSArray<NSNumber *> *sectionsToRemove,\n                                  void (^block)(RLMRealm *)) {\n    RLMSectionedResultsChange *changes = getChangePrimitive(self, block);\n    XCTAssertNotNil(changes);\n    if (!changes) {\n        return;\n    }\n\n    XCTAssertEqualObjects(insertions, changes.insertions);\n    XCTAssertEqualObjects(deletions, changes.deletions);\n    XCTAssertEqualObjects(modifications, changes.modifications);\n    XCTAssertEqual(sectionsToInsert.count, changes.sectionsToInsert.count);\n    XCTAssertEqual(sectionsToRemove.count, changes.sectionsToRemove.count);\n\n    for (NSNumber *i in sectionsToInsert) {\n        XCTAssertTrue([changes.sectionsToInsert containsIndex:i.unsignedIntegerValue]);\n    }\n    for (NSNumber *i in sectionsToRemove) {\n        XCTAssertTrue([changes.sectionsToRemove containsIndex:i.unsignedIntegerValue]);\n    }\n}\n\n- (void)testNotificationsPrimitive {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm transactionWithBlock:^{\n        AllPrimitiveArrays *arrObj = [AllPrimitiveArrays new];\n        [realm addObject:arrObj];\n    }];\n\n    // Insertions\n    ExpectChangePrimitive(self,\n                          @[[NSIndexPath indexPathForItem:0 inSection:0],\n                            [NSIndexPath indexPathForItem:0 inSection:1],\n                            [NSIndexPath indexPathForItem:0 inSection:2]],\n                          @[], @[], @[@0, @1, @2], @[], ^(RLMRealm *r) {\n        AllPrimitiveArrays *o = [AllPrimitiveArrays allObjectsInRealm:r][0];\n        [o.stringObj addObjects:@[@\"apple\", @\"banana\", @\"orange\"]];\n    });\n\n    // Deletions\n    ExpectChangePrimitive(self,\n                          @[], @[],\n                          @[], @[], @[@0], ^(RLMRealm *r) {\n        AllPrimitiveArrays *o = [AllPrimitiveArrays allObjectsInRealm:r][0];\n        [o.stringObj removeObjectAtIndex:0];\n    });\n\n    // Modifications\n    ExpectChangePrimitive(self,\n                          @[], @[],\n                          @[[NSIndexPath indexPathForItem:0 inSection:0]], @[], @[], ^(RLMRealm *r) {\n        AllPrimitiveArrays *o = [AllPrimitiveArrays allObjectsInRealm:r][0];\n        o.stringObj[0] = @\"box\"; // banana -> box\n    });\n\n    // Remove elements from one section, insert into another.\n    ExpectChangePrimitive(self,\n                          @[[NSIndexPath indexPathForItem:0 inSection:1]],\n                          @[],\n                          @[], @[@1], @[@0], ^(RLMRealm *r) {\n        AllPrimitiveArrays *o = [AllPrimitiveArrays allObjectsInRealm:r][0];\n        o.stringObj[0] = @\"zebra\"; // open -> zebra\n    });\n}\n\n- (void)testSortDescriptors {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm transactionWithBlock:^{\n        AggregateArrayObject *o1 = [AggregateArrayObject new];\n        AggregateSetObject *o2 = [AggregateSetObject new];\n        AggregateObject *aggObj1 = [AggregateObject new];\n        aggObj1.intCol = 1;\n        aggObj1.anyCol = @9;\n\n        AggregateObject *aggObj2 = [AggregateObject new];\n        aggObj2.intCol = 1;\n        aggObj2.anyCol = @10;\n\n        AggregateObject *aggObj3 = [AggregateObject new];\n        aggObj3.intCol = 1;\n        aggObj3.anyCol = @2;\n\n        AggregateObject *aggObj4 = [AggregateObject new];\n        aggObj4.intCol = 2;\n        aggObj4.anyCol = @1;\n\n        [o1.array addObjects:@[aggObj1, aggObj2, aggObj3, aggObj4]];\n        [o2.set addObjects:@[aggObj1, aggObj2, aggObj3, aggObj4]];\n\n        [realm addObjects:@[o1, o2]];\n    }];\n\n    NSMutableArray *sortDescriptors = [NSMutableArray new];\n    [sortDescriptors addObject:[RLMSortDescriptor sortDescriptorWithKeyPath:@\"intCol\" ascending:YES]];\n    [sortDescriptors addObject:[RLMSortDescriptor sortDescriptorWithKeyPath:@\"anyCol\" ascending:NO]];\n\n    AggregateArrayObject *arrayObj = [AggregateArrayObject allObjectsInRealm:realm][0];\n    AggregateSetObject *setObj = [AggregateSetObject allObjectsInRealm:realm][0];\n\n    void(^run)(id<RLMCollection> collection) = ^(id<RLMCollection> collection) {\n        RLMSectionedResults<NSNumber *, AggregateObject *> *sr = [collection sectionedResultsUsingSortDescriptors:sortDescriptors\n                                                                                                         keyBlock:^id<RLMValue>(AggregateObject *value) {\n            return @(value.intCol);\n        }];\n\n        XCTAssertNotNil(sr);\n        XCTAssertEqual(sr.count, 2);\n        XCTAssertEqual(sr[0].count, 3);\n        XCTAssertEqual(sr[1].count, 1);\n        XCTAssertEqualObjects(sr[0].key, @1);\n        XCTAssertEqual(sr[0][0].intCol, 1);\n        XCTAssertEqualObjects(sr[0][0].anyCol, @10);\n        XCTAssertEqual(sr[0][1].intCol, 1);\n        XCTAssertEqualObjects(sr[0][1].anyCol, @9);\n        XCTAssertEqualObjects(sr[1].key, @2);\n        XCTAssertEqual(sr[1][0].intCol, 2);\n        XCTAssertEqualObjects(sr[1][0].anyCol, @1);\n    };\n\n    run(arrayObj.array);\n    run(setObj.set);\n    run([AggregateObject allObjectsInRealm:realm]);\n}\n\n- (void)testFrozenFromResults {\n    [self createObjects];\n    RLMRealm *realm = self.realmWithTestPath;\n    // Test creation from frozen RLMResults\n    RLMResults<AllTypesObject *> *results = [[AllTypesObject allObjectsInRealm:realm] freeze];\n    RLMSectionedResults<NSString *, AllTypesObject *> *sr = [results sectionedResultsSortedUsingKeyPath:@\"objectCol.stringCol\"\n                                                                                              ascending:YES\n                                                                                               keyBlock:^id<RLMValue>(AllTypesObject *value) {\n        return [value.objectCol.stringCol substringToIndex:1];\n    }];\n\n    [self createObjects];\n\n    XCTAssertNotNil(sr);\n    XCTAssertEqual(sr.count, 4);\n    XCTAssertEqual(sr[0].count, 3);\n    XCTAssertEqual(sr[1].count, 1);\n    XCTAssertEqual(sr[2].count, 2);\n    XCTAssertEqual(sr[3].count, 3);\n\n    XCTAssertTrue(sr[0][0].isFrozen);\n    XCTAssertTrue(sr.isFrozen);\n\n    RLMSectionedResults<NSString *, AllTypesObject *> *thawed = [sr thaw];\n    XCTAssertNotNil(thawed);\n    XCTAssertEqual(thawed.count, 4);\n    XCTAssertEqual(thawed[0].count, 6);\n    XCTAssertEqual(thawed[1].count, 2);\n    XCTAssertEqual(thawed[2].count, 4);\n    XCTAssertEqual(thawed[3].count, 6);\n\n    XCTAssertFalse(thawed[0][0].isFrozen);\n    XCTAssertFalse(thawed.isFrozen);\n}\n\n- (void)testFrozenSectionedResults {\n    [self createObjects];\n    RLMRealm *realm = self.realmWithTestPath;\n    // Test creation from frozen RLMResults\n    RLMResults<AllTypesObject *> *results = [AllTypesObject allObjectsInRealm:realm];\n    RLMSectionedResults<NSString *, AllTypesObject *> *sr = [results sectionedResultsSortedUsingKeyPath:@\"objectCol.stringCol\"\n                                                                                              ascending:YES\n                                                                                               keyBlock:^id<RLMValue>(AllTypesObject *value) {\n        return [value.objectCol.stringCol substringToIndex:1];\n    }];\n\n    RLMSectionedResults<NSString *, AllTypesObject *> *frozen = [sr freeze];\n    XCTAssertEqual(frozen, [frozen freeze]); // should return self\n    [self createObjects];\n\n    XCTAssertNotNil(frozen);\n    XCTAssertEqual(frozen.count, 4);\n    XCTAssertEqual(frozen[0].count, 3);\n    XCTAssertEqual(frozen[1].count, 1);\n    XCTAssertEqual(frozen[2].count, 2);\n    XCTAssertEqual(frozen[3].count, 3);\n\n    XCTAssertTrue(frozen[0][0].isFrozen);\n    XCTAssertTrue(frozen.isFrozen);\n\n    RLMSectionedResults<NSString *, AllTypesObject *> *thawed = [frozen thaw];\n    XCTAssertEqual(thawed, [thawed thaw]); // should return self\n    XCTAssertNotNil(thawed);\n    XCTAssertEqual(thawed.count, 4);\n    XCTAssertEqual(thawed[0].count, 6);\n    XCTAssertEqual(thawed[1].count, 2);\n    XCTAssertEqual(thawed[2].count, 4);\n    XCTAssertEqual(thawed[3].count, 6);\n\n    XCTAssertFalse(thawed[0][0].isFrozen);\n    XCTAssertFalse(thawed.isFrozen);\n}\n\n- (void)testFrozenSection {\n    [self createObjects];\n    RLMRealm *realm = self.realmWithTestPath;\n    // Test creation from frozen RLMResults\n    RLMResults<AllTypesObject *> *results = [AllTypesObject allObjectsInRealm:realm];\n    RLMSectionedResults<NSString *, AllTypesObject *> *sr = [results sectionedResultsSortedUsingKeyPath:@\"objectCol.stringCol\"\n                                                                                              ascending:YES\n                                                                                               keyBlock:^id<RLMValue>(AllTypesObject *value) {\n        return [value.objectCol.stringCol substringToIndex:1];\n    }];\n\n    RLMSection<NSString *, AllTypesObject *> *frozen = [sr[0] freeze];\n    XCTAssertEqual(frozen, [frozen freeze]); // should return self\n    [self createObjects];\n\n    XCTAssertNotNil(frozen);\n    XCTAssertEqual(frozen.count, 3);\n    XCTAssertTrue(frozen[0].isFrozen);\n    XCTAssertTrue(frozen.isFrozen);\n\n    RLMSection<NSString *, AllTypesObject *> *thawed = [frozen thaw];\n    XCTAssertEqual(thawed, [thawed thaw]); // should return self\n    XCTAssertNotNil(thawed);\n    XCTAssertEqual(thawed.count, 6);\n\n    XCTAssertFalse(thawed[0].isFrozen);\n    XCTAssertFalse(thawed.isFrozen);\n}\n\n- (void)testInitFromRLMArray {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm transactionWithBlock:^{\n        [MixedObject createInRealm:realm withValue:@[NSNull.null, @[@5, @3, @2, @4]]];\n    }];\n\n    MixedObject *obj = [MixedObject allObjectsInRealm:realm][0];\n    RLMSectionedResults<NSNumber *, MixedObject *> *sr = [obj.anyArray sectionedResultsSortedUsingKeyPath:@\"self\"\n                                                                                                ascending:YES\n                                                                                                 keyBlock:^id<RLMValue>(id<RLMValue> value) {\n        return @(((NSNumber *)value).intValue % 2);\n    }];\n\n    XCTAssertNotNil(sr);\n    XCTAssertEqual(sr.count, 2);\n    XCTAssertEqual(sr[0].count, 2);\n    XCTAssertEqual(sr[1].count, 2);\n    XCTAssertEqualObjects(sr[0].key, @0);\n    XCTAssertEqualObjects(sr[0][0], @2);\n    XCTAssertEqualObjects(sr[0][1], @4);\n    XCTAssertEqualObjects(sr[1].key, @1);\n    XCTAssertEqualObjects(sr[1][0], @3);\n    XCTAssertEqualObjects(sr[1][1], @5);\n\n    // Descending\n    sr = [obj.anyArray sectionedResultsSortedUsingKeyPath:@\"self\"\n                                                ascending:NO\n                                                 keyBlock:^id<RLMValue>(id<RLMValue> value) {\n        return @(((NSNumber *)value).intValue % 2);\n    }];\n\n    XCTAssertNotNil(sr);\n    XCTAssertEqual(sr.count, 2);\n    XCTAssertEqual(sr[0].count, 2);\n    XCTAssertEqual(sr[1].count, 2);\n    XCTAssertEqualObjects(sr[0].key, @1);\n    XCTAssertEqualObjects(sr[0][0], @5);\n    XCTAssertEqualObjects(sr[0][1], @3);\n    XCTAssertEqualObjects(sr[1].key, @0);\n    XCTAssertEqualObjects(sr[1][0], @4);\n    XCTAssertEqualObjects(sr[1][1], @2);\n}\n\n- (void)testInitFromRLMSet {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm transactionWithBlock:^{\n        AllPrimitiveSets *o = [AllPrimitiveSets new];\n        [o.intObj addObject:@5];\n        [o.intObj addObject:@4];\n        [o.intObj addObject:@1];\n        [o.intObj addObject:@2];\n        [realm addObject:o];\n    }];\n\n    AllPrimitiveSets *obj = [AllPrimitiveSets allObjectsInRealm:realm][0];\n    RLMSectionedResults<NSNumber *, AllPrimitiveSets *> *sr = [obj.intObj sectionedResultsSortedUsingKeyPath:@\"self\"\n                                                                                                   ascending:YES\n                                                                                                    keyBlock:^id<RLMValue>(id<RLMValue> value) {\n        return @(((NSNumber *)value).intValue % 2);\n    }];\n\n    XCTAssertNotNil(sr);\n    XCTAssertEqual(sr.count, 2);\n    XCTAssertEqual(sr[0].count, 2);\n    XCTAssertEqual(sr[1].count, 2);\n    XCTAssertEqualObjects(sr[0].key, @1);\n    XCTAssertEqualObjects(sr[0][0], @1);\n    XCTAssertEqualObjects(sr[0][1], @5);\n    XCTAssertEqualObjects(sr[1].key, @0);\n    XCTAssertEqualObjects(sr[1][0], @2);\n    XCTAssertEqualObjects(sr[1][1], @4);\n\n    // Descending\n    sr = [obj.intObj sectionedResultsSortedUsingKeyPath:@\"self\"\n                                              ascending:NO\n                                               keyBlock:^id<RLMValue>(id<RLMValue> value) {\n        return @(((NSNumber *)value).intValue % 2);\n    }];\n\n    XCTAssertNotNil(sr);\n    XCTAssertEqual(sr.count, 2);\n    XCTAssertEqual(sr[0].count, 2);\n    XCTAssertEqual(sr[1].count, 2);\n    XCTAssertEqualObjects(sr[0].key, @1);\n    XCTAssertEqualObjects(sr[0][0], @5);\n    XCTAssertEqualObjects(sr[0][1], @1);\n    XCTAssertEqualObjects(sr[1].key, @0);\n    XCTAssertEqualObjects(sr[1][0], @4);\n    XCTAssertEqualObjects(sr[1][1], @2);\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/SetPropertyTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n@implementation DogSetObject\n@end\n\n@interface SetPropertyTests : RLMTestCase\n@end\n\n@implementation SetPropertyTests\n\n- (void)testUnmanagedUnion {\n    AllPrimitiveSets *setObj1 = [AllPrimitiveSets new];\n    AllPrimitiveSets *setObj2 = [AllPrimitiveSets new];\n    AllPrimitiveSets *setObj3 = [AllPrimitiveSets new];\n\n    [setObj1.stringObj addObjects:@[@\"one\", @\"two\", @\"three\", @\"four\", @\"five\"]];\n    [setObj2.stringObj addObjects:@[@\"one\", @\"two\", @\"three\"]];\n    [setObj3.stringObj addObjects:@[@\"one\", @\"two\", @\"three\", @\"four\", @\"five\"]];\n\n    [setObj1.stringObj unionSet:setObj2.stringObj];\n\n    XCTAssertEqual(setObj1.stringObj.count, 5U);\n    XCTAssertTrue([setObj1.stringObj isEqual:setObj3.stringObj]);\n}\n\n- (void)testUnmanagedIntersect {\n    AllPrimitiveSets *setObj1 = [AllPrimitiveSets new];\n    AllPrimitiveSets *setObj2 = [AllPrimitiveSets new];\n    AllPrimitiveSets *setObj3 = [AllPrimitiveSets new];\n\n    [setObj1.stringObj addObjects:@[@\"ten\", @\"one\", @\"nine\", @\"two\", @\"eight\"]];\n    [setObj2.stringObj addObjects:@[@\"five\", @\"six\", @\"seven\", @\"eight\", @\"nine\"]];\n    [setObj3.stringObj addObjects:@[@\"nine\", @\"eight\"]];\n\n    [setObj1.stringObj intersectSet:setObj2.stringObj];\n    XCTAssertTrue([setObj1.stringObj intersectsSet:setObj2.stringObj]);\n\n    XCTAssertEqual(setObj1.stringObj.count, 2U);\n    XCTAssertTrue([setObj1.stringObj isEqual:setObj3.stringObj]);\n}\n\n- (void)testUnmanagedMinus {\n    AllPrimitiveSets *setObj1 = [AllPrimitiveSets new];\n    AllPrimitiveSets *setObj2 = [AllPrimitiveSets new];\n    AllPrimitiveSets *setObj3 = [AllPrimitiveSets new];\n\n    [setObj1.stringObj addObjects:@[@\"ten\", @\"one\", @\"nine\", @\"two\", @\"eight\"]];\n    [setObj2.stringObj addObjects:@[@\"five\", @\"six\", @\"seven\", @\"eight\", @\"nine\"]];\n    [setObj3.stringObj addObjects:@[@\"ten\", @\"one\", @\"two\"]];\n\n    [setObj1.stringObj minusSet:setObj2.stringObj];\n\n    XCTAssertEqual(setObj1.stringObj.count, 3U);\n    XCTAssertTrue([setObj1.stringObj isEqual:setObj3.stringObj]);\n}\n\n- (void)testUnmanagedIsSubsetOfSet {\n    AllPrimitiveSets *setObj1 = [AllPrimitiveSets new];\n    AllPrimitiveSets *setObj2 = [AllPrimitiveSets new];\n    AllPrimitiveSets *setObj3 = [AllPrimitiveSets new];\n\n    [setObj1.stringObj addObjects:@[@\"ten\", @\"one\", @\"nine\", @\"two\", @\"eight\"]];\n    [setObj2.stringObj addObjects:@[@\"five\", @\"six\", @\"seven\", @\"eight\", @\"nine\"]];\n    [setObj3.stringObj addObjects:@[@\"two\", @\"one\", @\"ten\"]];\n\n    XCTAssertFalse([setObj1.stringObj isSubsetOfSet:setObj2.stringObj]);\n    XCTAssertTrue([setObj3.stringObj isSubsetOfSet:setObj1.stringObj]);\n}\n\n- (void)testManagedIsSubsetOfSet {\n    RLMRealm *realm = [self realmWithTestPath];\n    [realm beginWriteTransaction];\n    AllPrimitiveSets *setObj1 = [AllPrimitiveSets createInRealm:realm withValue:@[]];\n    AllPrimitiveSets *setObj2 = [AllPrimitiveSets createInRealm:realm withValue:@[]];\n    AllPrimitiveSets *setObj3 = [AllPrimitiveSets createInRealm:realm withValue:@[]];\n    [setObj1.stringObj addObjects:@[@\"ten\", @\"one\", @\"nine\", @\"two\", @\"eight\"]];\n    [setObj2.stringObj addObjects:@[@\"five\", @\"six\", @\"seven\", @\"eight\", @\"nine\"]];\n    [setObj3.stringObj addObjects:@[@\"two\", @\"one\", @\"ten\"]];\n    [realm commitWriteTransaction];\n    AllPrimitiveSets *unman = [AllPrimitiveSets new];\n\n    XCTAssertThrows([setObj1.stringObj isSubsetOfSet:unman.stringObj]);\n    XCTAssertThrows([setObj1.stringObj isSubsetOfSet:setObj2.intObj]);\n    XCTAssertFalse([setObj1.stringObj isSubsetOfSet:setObj2.stringObj]);\n    XCTAssertTrue([setObj3.stringObj isSubsetOfSet:setObj1.stringObj]);\n}\n\n- (void)testManagedIntersect {\n    RLMRealm *realm = [self realmWithTestPath];\n    [realm beginWriteTransaction];\n    AllPrimitiveSets *setObj1 = [AllPrimitiveSets createInRealm:realm withValue:@[]];\n    AllPrimitiveSets *setObj2 = [AllPrimitiveSets createInRealm:realm withValue:@[]];\n    AllPrimitiveSets *setObj3 = [AllPrimitiveSets createInRealm:realm withValue:@[]];\n\n    [setObj1.stringObj addObjects:@[@\"ten\", @\"one\", @\"nine\", @\"two\", @\"eight\"]];\n    [setObj2.stringObj addObjects:@[@\"five\", @\"six\", @\"seven\", @\"eight\", @\"nine\"]];\n    [setObj3.stringObj addObjects:@[@\"nine\", @\"eight\"]];\n    [realm commitWriteTransaction];\n    AllPrimitiveSets *unman = [AllPrimitiveSets new];\n\n    XCTAssertThrows([setObj1.stringObj intersectSet:setObj2.stringObj]);\n    XCTAssertTrue([setObj1.stringObj intersectsSet:setObj2.stringObj]);\n\n    [realm beginWriteTransaction];\n    XCTAssertThrows([setObj1.stringObj intersectSet:unman.stringObj]);\n    [setObj1.stringObj intersectSet:setObj2.stringObj];\n    [realm commitWriteTransaction];\n\n    XCTAssertTrue([setObj1.stringObj intersectsSet:setObj2.stringObj]);\n    XCTAssertEqual(setObj1.stringObj.count, 2U);\n}\n\n- (void)testManagedUnion {\n    RLMRealm *realm = [self realmWithTestPath];\n    [realm beginWriteTransaction];\n    AllPrimitiveSets *setObj1 = [AllPrimitiveSets createInRealm:realm withValue:@[]];\n    AllPrimitiveSets *setObj2 = [AllPrimitiveSets createInRealm:realm withValue:@[]];\n    AllPrimitiveSets *setObj3 = [AllPrimitiveSets createInRealm:realm withValue:@[]];\n\n    [setObj1.stringObj addObjects:@[@\"one\", @\"two\", @\"three\", @\"four\", @\"five\"]];\n    [setObj2.stringObj addObjects:@[@\"one\", @\"two\", @\"three\"]];\n    [setObj3.stringObj addObjects:@[@\"one\", @\"two\", @\"three\", @\"four\", @\"five\"]];\n    [realm commitWriteTransaction];\n\n    XCTAssertThrows([setObj1.stringObj unionSet:setObj2.stringObj]);\n    XCTAssertThrows([setObj2.stringObj unionSet:setObj1.stringObj]);\n\n    [realm beginWriteTransaction];\n    [setObj1.stringObj unionSet:setObj2.stringObj];\n    [setObj2.stringObj unionSet:setObj3.stringObj];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(setObj1.stringObj.count, 5U);\n    XCTAssertEqual(setObj2.stringObj.count, 5U);\n}\n\n- (void)testManagedMinus {\n    RLMRealm *realm = [self realmWithTestPath];\n    [realm beginWriteTransaction];\n    AllPrimitiveSets *setObj1 = [AllPrimitiveSets createInRealm:realm withValue:@[]];\n    AllPrimitiveSets *setObj2 = [AllPrimitiveSets createInRealm:realm withValue:@[]];\n    AllPrimitiveSets *setObj3 = [AllPrimitiveSets createInRealm:realm withValue:@[]];\n\n    [setObj1.stringObj addObjects:@[@\"one\", @\"two\", @\"three\", @\"four\", @\"five\"]];\n    [setObj2.stringObj addObjects:@[@\"one\", @\"two\", @\"three\"]];\n    [setObj3.stringObj addObjects:@[@\"one\", @\"two\", @\"three\", @\"four\", @\"five\"]];\n    [realm commitWriteTransaction];\n\n    XCTAssertThrows([setObj1.stringObj minusSet:setObj2.stringObj]);\n    XCTAssertThrows([setObj2.stringObj minusSet:setObj1.stringObj]);\n\n    [realm beginWriteTransaction];\n    [setObj1.stringObj minusSet:setObj2.stringObj];\n    [setObj2.stringObj minusSet:setObj3.stringObj];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(setObj1.stringObj.count, 2U);\n    XCTAssertTrue([setObj1.stringObj.allObjects[0] isEqualToString:@\"five\"]);\n    XCTAssertTrue([setObj1.stringObj.allObjects[1] isEqualToString:@\"four\"]);\n    XCTAssertEqual(setObj1.stringObj.count, 2U);\n\n    XCTAssertEqual(setObj2.stringObj.count, 0U);\n}\n\n- (void)testDeleteObjectInUnmanagedSet {\n    SetPropertyObject *set = [[SetPropertyObject alloc] init];\n    set.name = @\"name\";\n\n    StringObject *stringObj1 = [[StringObject alloc] init];\n    stringObj1.stringCol = @\"a\";\n    StringObject *stringObj2 = [[StringObject alloc] init];\n    stringObj2.stringCol = @\"b\";\n    StringObject *stringObj3 = [[StringObject alloc] init];\n    stringObj3.stringCol = @\"c\";\n    [set.set addObject:stringObj1];\n    [set.set addObject:stringObj2];\n    [set.set addObject:stringObj3];\n\n    IntObject *intObj1 = [[IntObject alloc] init];\n    intObj1.intCol = 0;\n    IntObject *intObj2 = [[IntObject alloc] init];\n    intObj2.intCol = 1;\n    IntObject *intObj3 = [[IntObject alloc] init];\n    intObj3.intCol = 2;\n    [set.intSet addObject:intObj1];\n    [set.intSet addObject:intObj2];\n    [set.intSet addObject:intObj3];\n\n    XCTAssertTrue([set.set containsObject:stringObj1]);\n    XCTAssertTrue([set.set containsObject:stringObj2]);\n    XCTAssertTrue([set.set containsObject:stringObj3]);\n    XCTAssertEqual(set.set.count, 3U, @\"Should have 3 elements in string set\");\n\n    XCTAssertTrue([set.intSet containsObject:intObj1]);\n    XCTAssertTrue([set.intSet containsObject:intObj2]);\n    XCTAssertTrue([set.intSet containsObject:intObj3]);\n    XCTAssertEqual(set.intSet.count, 3U, @\"Should have 3 elements in int set\");\n\n    [set.set removeObject:stringObj3];\n\n    XCTAssertTrue([set.set containsObject:stringObj1]);\n    XCTAssertTrue([set.set containsObject:stringObj1]);\n    XCTAssertEqual(set.set.count, 2U, @\"Should have 2 elements in string set\");\n\n    [set.set removeObject:stringObj2];\n\n    XCTAssertEqualObjects(set.set.allObjects[0], stringObj1, @\"Objects should be equal\");\n    XCTAssertEqual(set.set.count, 1U, @\"Should have 1 elements in string set\");\n\n    [set.set removeObject:stringObj1];\n\n    XCTAssertEqual(set.set.count, 0U, @\"Should have 0 elements in string set\");\n\n    [set.intSet removeAllObjects];\n    XCTAssertEqual(set.intSet.count, 0U, @\"Should have 0 elements in int set\");\n}\n\n- (void)testUnmanagedSetSort {\n    AllPrimitiveSets *setObj1 = [AllPrimitiveSets new];\n    XCTAssertThrows([setObj1.stringObj sortedResultsUsingKeyPath:@\"age\" ascending:YES]);\n    XCTAssertThrows([setObj1.stringObj sortedResultsUsingDescriptors:@[]]);\n}\n\n- (void)testPopulateEmptySet {\n    RLMRealm *r = [self realmWithTestPath];\n    [r beginWriteTransaction];\n    SetPropertyObject *setObj1 = [SetPropertyObject new];\n    XCTAssertNotNil(setObj1.set, @\"Should be able to get an empty set\");\n    XCTAssertEqual(setObj1.set.count, 0U, @\"Should start with no set elements\");\n\n    StringObject *str1 = [StringObject createInRealm:r withValue:@[@\"a\"]];\n    StringObject *str2 = [StringObject createInRealm:r withValue:@[@\"b\"]];\n    StringObject *str3 = [StringObject createInRealm:r withValue:@[@\"c\"]];\n    IntObject *int1 = [IntObject createInRealm:r withValue:@[@1]];\n    IntObject *int2 = [IntObject createInRealm:r withValue:@[@2]];\n    IntObject *int3 = [IntObject createInRealm:r withValue:@[@3]];\n\n    [setObj1.set addObjects:@[str1, str2, str3, str1, str2, str3]];\n    [setObj1.intSet addObjects:@[int1, int2, int3, int1, int2, int3]];\n\n    [r addObject:setObj1];\n    [r commitWriteTransaction];\n\n    RLMResults<SetPropertyObject *> *results = [SetPropertyObject allObjectsInRealm:r];\n\n    XCTAssertFalse(setObj1.isInvalidated);\n    XCTAssertEqual(results.count, 1U);\n\n    XCTAssertEqual(results[0].set.count, 3U);\n    XCTAssertEqualObjects(results[0].set, setObj1.set);\n\n    XCTAssertEqual(results[0].intSet.count, 3U);\n    XCTAssertEqualObjects(results[0].intSet, setObj1.intSet);\n\n    RLMSet *setProp = setObj1.set;\n    RLMAssertThrowsWithReasonMatching([setProp addObject:(id)@\"another one\"], @\"write transaction\");\n\n    // make sure we can fast enumerate\n    for (RLMObject *obj in setObj1.set) {\n        XCTAssertTrue(obj.description.length, @\"Object should have description\");\n    }\n}\n\n-(void)testModifyDetatchedSet {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    SetPropertyObject *setObj = [SetPropertyObject createInRealm:realm withValue:@[@\"setObject\", @[], @[]]];\n    XCTAssertNotNil(setObj.set, @\"Should be able to get an empty set\");\n    XCTAssertEqual(setObj.set.count, 0U, @\"Should start with no set elements\");\n\n    StringObject *obj = [[StringObject alloc] init];\n    obj.stringCol = @\"a\";\n    RLMSet *set = setObj.set;\n    [set addObject:obj];\n    [set addObject:[StringObject createInRealm:realm withValue:@[@\"b\"]]];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(set.count, 2U, @\"Should have two elements in set\");\n    XCTAssertEqualObjects([set.allObjects[0] stringCol], @\"a\", @\"First element should have property value 'a'\");\n    XCTAssertEqualObjects([setObj.set.allObjects[1] stringCol], @\"b\", @\"Second element should have property value 'b'\");\n\n    RLMAssertThrowsWithReasonMatching([set addObject:obj], @\"write transaction\");\n}\n\n- (void)testDeleteUnmanagedObjectWithSetProperty {\n    AllPrimitiveSets *setObj = [AllPrimitiveSets new];\n    [setObj.stringObj addObject:@\"a\"];\n    RLMSet *stringSet = setObj.stringObj;\n    XCTAssertFalse(stringSet.isInvalidated, @\"stringObj should be valid after creation.\");\n    setObj = nil;\n    XCTAssertFalse(stringSet.isInvalidated, @\"stringObj should still be valid after parent deletion.\");\n}\n\n- (void)testDeleteObjectWithSetProperty {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    SetPropertyObject *setObj = [SetPropertyObject createInRealm:realm withValue:@[@\"setObject\", @[@[@\"a\"]], @[]]];\n    RLMSet *stringSet = setObj.set;\n    XCTAssertFalse(stringSet.isInvalidated, @\"stringSet should be valid after creation.\");\n    [realm deleteObject:setObj];\n    XCTAssertTrue(stringSet.isInvalidated, @\"stringSet should be invalid after parent deletion.\");\n    [realm commitWriteTransaction];\n}\n\n- (void)testDeleteObjectInSetProperty {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    SetPropertyObject *setObj = [SetPropertyObject createInRealm:realm withValue:@[@\"setObject\", @[@[@\"a\"]], @[]]];\n    RLMSet *stringSet = setObj.set;\n    StringObject *firstObject = stringSet.allObjects[0];\n    [realm deleteObjects:[StringObject allObjectsInRealm:realm]];\n    XCTAssertFalse(stringSet.isInvalidated, @\"stringSet should be valid after member object deletion.\");\n    XCTAssertTrue(firstObject.isInvalidated, @\"firstObject should be invalid after deletion.\");\n    XCTAssertEqual(stringSet.count, 0U, @\"stringSet.count should be zero after deleting its only member.\");\n    [realm commitWriteTransaction];\n}\n\n-(void)testInsertMultiple {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    [realm beginWriteTransaction];\n    SetPropertyObject *obj = [SetPropertyObject createInRealm:realm withValue:@[@\"setObject\", @[], @[]]];\n    StringObject *child1 = [StringObject createInRealm:realm withValue:@[@\"a\"]];\n    StringObject *child2 = [[StringObject alloc] init];\n    child2.stringCol = @\"b\";\n    [obj.set addObjects:@[child2, child1]];\n    [realm commitWriteTransaction];\n\n    RLMResults *children = [StringObject allObjectsInRealm:realm];\n    XCTAssertEqualObjects([children[0] stringCol], @\"a\", @\"First child should be 'a'\");\n    XCTAssertEqualObjects([children[1] stringCol], @\"b\", @\"Second child should be 'b'\");\n}\n\n- (void)testAddInvalidated {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    CompanyObject *company = [CompanyObject createInDefaultRealmWithValue:@[@\"company\", @[]]];\n\n    EmployeeObject *person = [[EmployeeObject alloc] init];\n    person.name = @\"Mary\";\n    [realm addObject:person];\n    [realm deleteObjects:[EmployeeObject allObjects]];\n\n    RLMAssertThrowsWithReasonMatching([company.employeeSet addObject:person], @\"invalidated\");\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAddNil {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    CompanyObject *company = [CompanyObject createInDefaultRealmWithValue:@[@\"company\", @[]]];\n\n    RLMAssertThrowsWithReason([company.employeeSet addObject:self.nonLiteralNil],\n                              @\"Invalid nil value for set of 'EmployeeObject'.\");\n    [realm cancelWriteTransaction];\n}\n\n- (void)testUnmanaged {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    SetPropertyObject *setObj = [[SetPropertyObject alloc] init];\n    setObj.name = @\"name\";\n    XCTAssertNotNil(setObj.set, @\"RLMSet property should get created on access\");\n\n    XCTAssertEqual(setObj.set.count, 0U, @\"No objects added yet\");\n\n    StringObject *obj1 = [[StringObject alloc] init];\n    obj1.stringCol = @\"a\";\n    StringObject *obj2 = [[StringObject alloc] init];\n    obj2.stringCol = @\"b\";\n    StringObject *obj3 = [[StringObject alloc] init];\n    obj3.stringCol = @\"c\";\n    [setObj.set addObject:obj1];\n    [setObj.set addObject:obj2];\n    [setObj.set addObject:obj3];\n\n    XCTAssertTrue([setObj.set containsObject:obj1]);\n    XCTAssertTrue([setObj.set containsObject:obj2]);\n    XCTAssertTrue([setObj.set containsObject:obj3]);\n\n    [realm beginWriteTransaction];\n    [realm addObject:setObj];\n    [realm commitWriteTransaction];\n\n    [realm beginWriteTransaction];\n\n    [setObj.set removeObject:obj3];\n    XCTAssertEqual(setObj.set.count, 2U, @\"2 objects left\");\n    [setObj.set addObject:obj1];\n    [setObj.set removeAllObjects];\n    XCTAssertEqual(setObj.set.count, 0U, @\"All objects removed\");\n    [realm commitWriteTransaction];\n\n    SetPropertyObject *setObj2 = [[SetPropertyObject alloc] init];\n    IntObject *intObj = [[IntObject alloc] init];\n    intObj.intCol = 1;\n    RLMAssertThrowsWithReasonMatching([setObj2.set addObject:(id)intObj], @\"IntObject.*StringObject\");\n    [setObj2.intSet addObject:intObj];\n\n    XCTAssertThrows([setObj2.intSet objectsWhere:@\"intCol == 1\"], @\"Should throw on unmanaged RLMSet\");\n    XCTAssertThrows(([setObj2.intSet objectsWithPredicate:[NSPredicate predicateWithFormat:@\"intCol == %i\", 1]]), @\"Should throw on unmanaged RLMSet\");\n    XCTAssertThrows([setObj2.intSet sortedResultsUsingKeyPath:@\"intCol\" ascending:YES], @\"Should throw on unmanaged RLMSet\");\n\n    // test unmanaged with literals\n    __unused SetPropertyObject *obj = [[SetPropertyObject alloc] initWithValue:@[@\"n\", @[], @[[[IntObject alloc] initWithValue: @[@1]]]]];\n}\n\n- (void)testComparision {\n    RLMRealm *realm = [self realmWithTestPath];\n\n    SetPropertyObject *set = [[SetPropertyObject alloc] init];\n    SetPropertyObject *set2 = [[SetPropertyObject alloc] init];\n\n    set.name = @\"name\";\n    set.name = @\"name2\";\n    XCTAssertNotNil(set.set, @\"RLMSet property should get created on access\");\n    XCTAssertNotNil(set2.set, @\"RLMSet property should get created on access\");\n    XCTAssertTrue([set.set isEqual:set2.set], @\"Empty sets should be equal\");\n\n    XCTAssertEqual(set.set.count, 0U);\n    XCTAssertEqual(set2.set.count, 0U);\n\n    StringObject *obj1 = [[StringObject alloc] init];\n    obj1.stringCol = @\"a\";\n    StringObject *obj2 = [[StringObject alloc] init];\n    obj2.stringCol = @\"b\";\n    StringObject *obj3 = [[StringObject alloc] init];\n    obj3.stringCol = @\"c\";\n    [set.set addObject:obj1];\n    [set.set addObject:obj2];\n    [set.set addObject:obj3];\n\n    [set2.set addObject:obj1];\n    [set2.set addObject:obj2];\n    [set2.set addObject:obj3];\n\n    XCTAssertTrue([set.set isEqual:set2.set], @\"Sets should be equal\");\n    XCTAssertTrue([set.set isEqualToSet:set2.set], @\"Sets should be equal\");\n    [set2.set removeObject:obj3];\n    XCTAssertFalse([set.set isEqual:set2.set], @\"Sets should not be equal\");\n    XCTAssertFalse([set.set isEqualToSet:set2.set], @\"Sets should not be equal\");\n    [set2.set addObject:obj3];\n    XCTAssertTrue([set.set isEqual:set2.set], @\"Sets should be equal\");\n    XCTAssertTrue([set.set isEqualToSet:set2.set], @\"Sets should be equal\");\n\n    [realm beginWriteTransaction];\n    [realm addObject:set];\n    [realm commitWriteTransaction];\n\n    XCTAssertFalse([set.set isEqual:set2.set], @\"Comparing a managed set to an unmanaged one should fail\");\n    XCTAssertThrows([set.set isEqualToSet:set2.set], @\"Right hand side value must be a managed Set.\");\n    XCTAssertFalse([set2.set isEqual:set.set], @\"Comparing a managed set to an unmanaged one should fail\");\n    XCTAssertFalse([set2.set isEqualToSet:set.set], @\"Comparing a managed set to an unmanaged one should fail\");\n}\n\n- (void)testUnmanagedPrimitive {\n    AllPrimitiveSets *obj = [[AllPrimitiveSets alloc] init];\n    XCTAssertTrue([obj.intObj isKindOfClass:[RLMSet class]]);\n    XCTAssertTrue([obj.floatObj isKindOfClass:[RLMSet class]]);\n    XCTAssertTrue([obj.doubleObj isKindOfClass:[RLMSet class]]);\n    XCTAssertTrue([obj.boolObj isKindOfClass:[RLMSet class]]);\n    XCTAssertTrue([obj.stringObj isKindOfClass:[RLMSet class]]);\n    XCTAssertTrue([obj.dataObj isKindOfClass:[RLMSet class]]);\n    XCTAssertTrue([obj.dateObj isKindOfClass:[RLMSet class]]);\n\n    [obj.intObj addObject:@1];\n    XCTAssertEqualObjects(obj.intObj.allObjects[0], @1);\n    XCTAssertThrows([obj.intObj addObject:@\"\"]);\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    obj = [AllPrimitiveSets createInRealm:realm withValue:@[@[],@[],@[],@[],@[],@[],@[]]];\n\n    XCTAssertTrue([obj.intObj isKindOfClass:[RLMSet class]]);\n    XCTAssertTrue([obj.floatObj isKindOfClass:[RLMSet class]]);\n    XCTAssertTrue([obj.doubleObj isKindOfClass:[RLMSet class]]);\n    XCTAssertTrue([obj.boolObj isKindOfClass:[RLMSet class]]);\n    XCTAssertTrue([obj.stringObj isKindOfClass:[RLMSet class]]);\n    XCTAssertTrue([obj.dataObj isKindOfClass:[RLMSet class]]);\n    XCTAssertTrue([obj.dateObj isKindOfClass:[RLMSet class]]);\n\n    [obj.intObj addObject:@5];\n    XCTAssertTrue([obj.intObj containsObject:@5]);\n    [realm cancelWriteTransaction];\n}\n\n- (void)testFastEnumeration\n{\n    RLMRealm *realm = self.realmWithTestPath;\n\n    [realm beginWriteTransaction];\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n    [realm addObject:company];\n    [realm commitWriteTransaction];\n\n    // enumerate empty set\n    for (__unused id obj in company.employeeSet) {\n        XCTFail(@\"Should be empty\");\n    }\n\n    [realm beginWriteTransaction];\n    for (int i = 0; i < 30; ++i) {\n        EmployeeObject *eo = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @40, @\"hired\": @YES}];\n        [company.employeeSet addObject:eo];\n    }\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(company.employeeSet.count, 30U);\n\n    __weak id objects[30];\n    NSInteger count = 0;\n    for (EmployeeObject *e in company.employeeSet) {\n        XCTAssertNotNil(e, @\"Object is not nil and accessible\");\n        if (count > 16) {\n            // 16 is the size of blocks fast enumeration happens to ask for at\n            // the moment, but of course that's just an implementation detail\n            // that may change\n            XCTAssertNil(objects[count - 16]);\n        }\n        objects[count++] = e;\n    }\n\n    XCTAssertEqual(count, 30, @\"should have enumerated 30 objects\");\n\n    for (int i = 0; i < count; i++) {\n        XCTAssertNil(objects[i], @\"Object should have been released\");\n    }\n\n    @autoreleasepool {\n        for (EmployeeObject *e in company.employeeSet) {\n            objects[0] = e;\n            break;\n        }\n    }\n    XCTAssertNil(objects[0], @\"Object should have been released\");\n}\n\n- (void)testModifyDuringEnumeration {\n    RLMRealm *realm = self.realmWithTestPath;\n\n    [realm beginWriteTransaction];\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n    [realm addObject:company];\n\n    const size_t totalCount = 40;\n    for (size_t i = 0; i < totalCount; ++i) {\n        [company.employeeSet addObject:[EmployeeObject createInRealm:realm withValue:@[@\"name\", @(i), @NO]]];\n    }\n\n    size_t count = 0;\n    for (EmployeeObject *eo in company.employeeSet) {\n        ++count;\n        [company.employeeSet removeObject:eo];\n    }\n    XCTAssertEqual(totalCount, count);\n    XCTAssertEqual(0U, company.employeeSet.count);\n\n    [realm cancelWriteTransaction];\n\n    // Unmanaged set\n    company = [[CompanyObject alloc] init];\n    for (size_t i = 0; i < totalCount; ++i) {\n        [company.employeeSet addObject:[[EmployeeObject alloc] initWithValue:@[@\"name\", @(i), @NO]]];\n    }\n\n    count = 0;\n    for (EmployeeObject *eo in company.employeeSet) {\n        ++count;\n        [company.employeeSet addObject:eo];\n    }\n    XCTAssertEqual(totalCount, count);\n    XCTAssertEqual(totalCount, company.employeeSet.count);\n}\n\n- (void)testDeleteDuringEnumeration {\n    RLMRealm *realm = self.realmWithTestPath;\n\n    [realm beginWriteTransaction];\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n    [realm addObject:company];\n\n    const size_t totalCount = 40;\n    for (size_t i = 0; i < totalCount; ++i) {\n        [company.employeeSet addObject:[EmployeeObject createInRealm:realm withValue:@[@\"name\", @(i), @NO]]];\n    }\n\n    [realm commitWriteTransaction];\n\n    [realm beginWriteTransaction];\n    for (__unused EmployeeObject *eo in company.employeeSet) {\n        [realm deleteObjects:company.employeeSet];\n    }\n    [realm commitWriteTransaction];\n}\n\n- (void)testValueForKey {\n    RLMRealm *realm = self.realmWithTestPath;\n\n    [realm beginWriteTransaction];\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n    XCTAssertEqual(((NSSet *)[company.employeeSet valueForKey:@\"name\"]).count, 0U);\n    [realm addObject:company];\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(((NSSet *)[company.employeeSet valueForKey:@\"name\"]).count, 0U);\n\n    // managed\n    NSMutableSet *ages = [NSMutableSet set];\n    [realm beginWriteTransaction];\n    for (int i = 0; i < 30; ++i) {\n        [ages addObject:@(i)];\n        EmployeeObject *eo = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @(i), @\"hired\": @YES}];\n        [company.employeeSet addObject:eo];\n    }\n    [realm commitWriteTransaction];\n\n    RLM_GENERIC_SET(EmployeeObject) *employeeObjects = [company valueForKey:@\"employeeSet\"];\n    NSMutableSet *kvcAgeProperties = [NSMutableSet set];\n    for (EmployeeObject *employee in employeeObjects) {\n        [kvcAgeProperties addObject:@(employee.age)];\n    }\n    XCTAssertEqualObjects(kvcAgeProperties, ages);\n\n    XCTAssertEqualObjects([NSSet setWithSet:[company.employeeSet valueForKey:@\"age\"]], ages);\n\n    XCTAssertEqual([[company.employeeSet valueForKeyPath:@\"@count\"] integerValue], 30);\n    XCTAssertEqual([[company.employeeSet valueForKeyPath:@\"@min.age\"] integerValue], 0);\n    XCTAssertEqual([[company.employeeSet valueForKeyPath:@\"@max.age\"] integerValue], 29);\n    XCTAssertEqualWithAccuracy([[company.employeeSet valueForKeyPath:@\"@avg.age\"] doubleValue], 14.5, 0.1f);\n\n    XCTAssertEqualObjects([company.employeeSet valueForKeyPath:@\"@unionOfObjects.age\"],\n                          (@[@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14, @15, @16, @17, @18, @19, @20, @21, @22, @23, @24, @25, @26, @27, @28, @29]));\n    XCTAssertEqualObjects([company.employeeSet valueForKeyPath:@\"@distinctUnionOfObjects.name\"], (@[@\"Joe\"]));\n\n    RLMAssertThrowsWithReasonMatching([company.employeeSet valueForKeyPath:@\"@sum.dogs.@sum.age\"], @\"Nested key paths.*not supported\");\n\n    // unmanaged object\n    company = [[CompanyObject alloc] init];\n    [ages removeAllObjects];\n    for (int i = 0; i < 30; ++i) {\n        [ages addObject:@(i)];\n        EmployeeObject *eo = [[EmployeeObject alloc] initWithValue:@{@\"name\": @\"Joe\",  @\"age\": @(i), @\"hired\": @YES}];\n        [company.employeeSet addObject:eo];\n    }\n\n    for (EmployeeObject *e in [[company.employeeSet valueForKey:@\"self\"] allObjects]) {\n        XCTAssertTrue([company.employeeSet containsObject:e]);\n    }\n\n    XCTAssertEqual([[company.employeeSet valueForKeyPath:@\"@count\"] integerValue], 30);\n    XCTAssertEqual([[company.employeeSet valueForKeyPath:@\"@min.age\"] integerValue], 0);\n    XCTAssertEqual([[company.employeeSet valueForKeyPath:@\"@max.age\"] integerValue], 29);\n    XCTAssertEqualWithAccuracy([[company.employeeSet valueForKeyPath:@\"@avg.age\"] doubleValue], 14.5, 0.1f);\n\n    RLMAssertThrowsWithReasonMatching([company.employeeSet valueForKeyPath:@\"@unionOfObjects.age\"], @\"this class does not implement the unionOfObjects\");\n    RLMAssertThrowsWithReasonMatching([company.employeeSet valueForKeyPath:@\"@distinctUnionOfObjects.name\"], @\"this class does not implement the distinctUnionOfObjects\");\n\n    RLMAssertThrowsWithReasonMatching([company.employeeSet valueForKeyPath:@\"@sum.dogs.@sum.age\"], @\"Nested key paths.*not supported\");\n}\n\n- (void)testSetValueForKey {\n    RLMRealm *realm = self.realmWithTestPath;\n\n    [realm beginWriteTransaction];\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n\n    [company.employeeSet setValue:@\"name\" forKey:@\"name\"];\n    XCTAssertEqual(((NSSet *)[company.employeeSet valueForKey:@\"name\"]).count, 0U);\n\n    [realm addObject:company];\n    [realm commitWriteTransaction];\n\n    XCTAssertThrows([company.employeeSet setValue:@10 forKey:@\"age\"]);\n    XCTAssertEqual(((NSSet *)[company.employeeSet valueForKey:@\"name\"]).count, 0U);\n\n    // managed\n    NSMutableSet *ages = [NSMutableSet set];\n    [realm beginWriteTransaction];\n    for (int i = 0; i < 30; ++i) {\n        [ages addObject:@(20)];\n        EmployeeObject *eo = [EmployeeObject createInRealm:realm withValue:@{@\"name\": @\"Joe\",  @\"age\": @(i), @\"hired\": @YES}];\n        [company.employeeSet addObject:eo];\n    }\n\n    [company.employeeSet setValue:@20 forKey:@\"age\"];\n    [realm commitWriteTransaction];\n\n    XCTAssertTrue([[company.employeeSet valueForKey:@\"age\"] isSubsetOfSet:ages]);\n\n    // unmanaged object\n    company = [[CompanyObject alloc] init];\n    ages = [NSMutableSet set];\n    for (int i = 0; i < 30; ++i) {\n        [ages addObject:@(20)];\n        EmployeeObject *eo = [[EmployeeObject alloc] initWithValue:@{@\"name\": @\"Joe\",  @\"age\": @(i), @\"hired\": @YES}];\n        [company.employeeSet addObject:eo];\n    }\n\n    [company.employeeSet setValue:@20 forKey:@\"age\"];\n\n    XCTAssertTrue([[company.employeeSet valueForKey:@\"age\"] isSubsetOfSet:ages]);\n}\n\n- (void)testObjectAggregate {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    AggregateSetObject *obj = [AggregateSetObject new];\n    XCTAssertEqual(0, [obj.set sumOfProperty:@\"intCol\"].intValue);\n    XCTAssertNil([obj.set averageOfProperty:@\"intCol\"]);\n    XCTAssertNil([obj.set minOfProperty:@\"intCol\"]);\n    XCTAssertNil([obj.set maxOfProperty:@\"intCol\"]);\n\n    NSDate *dateMinInput = [NSDate date];\n    NSDate *dateMaxInput = [dateMinInput dateByAddingTimeInterval:1000];\n\n    [realm transactionWithBlock:^{\n        [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n        [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n        [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n        [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n        [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n        [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n        [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n        [AggregateObject createInRealm:realm withValue:@[@1, @0.0f, @2.5, @NO, dateMaxInput]];\n        [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n        [AggregateObject createInRealm:realm withValue:@[@0, @1.2f, @0.0, @YES, dateMinInput]];\n\n        [obj.set addObjects:[AggregateObject allObjectsInRealm:realm]];\n    }];\n\n    void (^test)(void) = ^{\n        RLMSet *set = obj.set;\n        // SUM\n        XCTAssertEqual([set sumOfProperty:@\"intCol\"].integerValue, 4);\n        XCTAssertEqualWithAccuracy([set sumOfProperty:@\"floatCol\"].floatValue, 7.2f, 0.1f);\n        XCTAssertEqualWithAccuracy([set sumOfProperty:@\"doubleCol\"].doubleValue, 10.0, 0.1f);\n        RLMAssertThrowsWithReasonMatching([set sumOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n        RLMAssertThrowsWithReasonMatching([set sumOfProperty:@\"boolCol\"], @\"sum.*bool\");\n        RLMAssertThrowsWithReasonMatching([set sumOfProperty:@\"dateCol\"], @\"sum.*date\");\n\n        // Average\n        XCTAssertEqualWithAccuracy([set averageOfProperty:@\"intCol\"].doubleValue, 0.4, 0.1f);\n        XCTAssertEqualWithAccuracy([set averageOfProperty:@\"floatCol\"].doubleValue, 0.72, 0.1f);\n        XCTAssertEqualWithAccuracy([set averageOfProperty:@\"doubleCol\"].doubleValue, 1.0, 0.1f);\n        RLMAssertThrowsWithReasonMatching([set averageOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n        RLMAssertThrowsWithReasonMatching([set averageOfProperty:@\"boolCol\"], @\"average.*bool\");\n        RLMAssertThrowsWithReasonMatching([set averageOfProperty:@\"dateCol\"], @\"average.*date\");\n\n        // MIN\n        XCTAssertEqual(0, [[set minOfProperty:@\"intCol\"] intValue]);\n        XCTAssertEqual(0.0f, [[set minOfProperty:@\"floatCol\"] floatValue]);\n        XCTAssertEqual(0.0, [[set minOfProperty:@\"doubleCol\"] doubleValue]);\n        XCTAssertEqualObjects(dateMinInput, [set minOfProperty:@\"dateCol\"]);\n        RLMAssertThrowsWithReasonMatching([set minOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n        RLMAssertThrowsWithReasonMatching([set minOfProperty:@\"boolCol\"], @\"min.*bool\");\n\n        // MAX\n        XCTAssertEqual(1, [[set maxOfProperty:@\"intCol\"] intValue]);\n        XCTAssertEqual(1.2f, [[set maxOfProperty:@\"floatCol\"] floatValue]);\n        XCTAssertEqual(2.5, [[set maxOfProperty:@\"doubleCol\"] doubleValue]);\n        XCTAssertEqualObjects(dateMaxInput, [set maxOfProperty:@\"dateCol\"]);\n        RLMAssertThrowsWithReasonMatching([set maxOfProperty:@\"foo\"], @\"foo.*AggregateObject\");\n        RLMAssertThrowsWithReasonMatching([set maxOfProperty:@\"boolCol\"], @\"max.*bool\");\n    };\n\n    test();\n    [realm transactionWithBlock:^{ [realm addObject:obj]; }];\n    test();\n}\n\n- (void)testRenamedPropertyAggregate {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    LinkToRenamedProperties1 *obj = [LinkToRenamedProperties1 new];\n    XCTAssertEqual(0, [obj.set sumOfProperty:@\"propA\"].intValue);\n    XCTAssertNil([obj.set averageOfProperty:@\"propA\"]);\n    XCTAssertNil([obj.set minOfProperty:@\"propA\"]);\n    XCTAssertNil([obj.set maxOfProperty:@\"propA\"]);\n    XCTAssertThrows([obj.set sumOfProperty:@\"prop 1\"]);\n\n    [realm transactionWithBlock:^{\n        [RenamedProperties1 createInRealm:realm withValue:@[@1, @\"\"]];\n        [RenamedProperties1 createInRealm:realm withValue:@[@2, @\"\"]];\n        [RenamedProperties1 createInRealm:realm withValue:@[@3, @\"\"]];\n\n        [obj.set addObjects:[RenamedProperties1 allObjectsInRealm:realm]];\n    }];\n\n    XCTAssertEqual(6, [obj.set sumOfProperty:@\"propA\"].intValue);\n    XCTAssertEqual(2.0, [obj.set averageOfProperty:@\"propA\"].doubleValue);\n    XCTAssertEqual(1, [[obj.set minOfProperty:@\"propA\"] intValue]);\n    XCTAssertEqual(3, [[obj.set maxOfProperty:@\"propA\"] intValue]);\n\n    [realm transactionWithBlock:^{ [realm addObject:obj]; }];\n\n    XCTAssertEqual(6, [obj.set sumOfProperty:@\"propA\"].intValue);\n    XCTAssertEqual(2.0, [obj.set averageOfProperty:@\"propA\"].doubleValue);\n    XCTAssertEqual(1, [[obj.set minOfProperty:@\"propA\"] intValue]);\n    XCTAssertEqual(3, [[obj.set maxOfProperty:@\"propA\"] intValue]);\n}\n\n-(void)testRenamedPropertyObservation {\n    RLMRealm *realm = self.realmWithTestPath;\n    __block LinkToRenamedProperties *obj;\n    [realm transactionWithBlock:^{\n        obj = [LinkToRenamedProperties createInRealm:realm withValue:@[]];\n        RenamedProperties *linkedObject = [RenamedProperties createInRealm:realm withValue:@[@1, @\"\"]];\n        [obj.set addObjects:@[linkedObject]];\n    }];\n\n    __block bool first = true;\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [obj.set addNotificationBlock:^(RLMSet *set, RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(set);\n        XCTAssert(first ? !change : !!change);\n        XCTAssertNil(error);\n        first = false;\n        [expectation fulfill];\n    } keyPaths:@[@\"stringCol\"]];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = self.realmWithTestPath;\n        [realm transactionWithBlock:^{\n            RLMSet<RenamedProperties> *set = [(LinkToRenamedProperties *)[LinkToRenamedProperties allObjectsInRealm:realm].firstObject set];\n            [set setValue:@\"newValue\" forKey:@\"stringCol\"];\n        }];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testValueForCollectionOperationKeyPath\n{\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    EmployeeObject *e1 = [PrimaryEmployeeObject createInRealm:realm withValue:@{@\"name\": @\"A\", @\"age\": @20, @\"hired\": @YES}];\n    EmployeeObject *e2 = [PrimaryEmployeeObject createInRealm:realm withValue:@{@\"name\": @\"B\", @\"age\": @30, @\"hired\": @NO}];\n    EmployeeObject *e3 = [PrimaryEmployeeObject createInRealm:realm withValue:@{@\"name\": @\"C\", @\"age\": @40, @\"hired\": @YES}];\n    EmployeeObject *e4 = [PrimaryEmployeeObject createInRealm:realm withValue:@{@\"name\": @\"D\", @\"age\": @50, @\"hired\": @YES}];\n    PrimaryCompanyObject *c1 = [PrimaryCompanyObject createInRealm:realm withValue:@{@\"name\": @\"ABC AG\", @\"employeeSet\": @[e1, e2, e3, e2]}];\n    PrimaryCompanyObject *c2 = [PrimaryCompanyObject createInRealm:realm withValue:@{@\"name\": @\"ABC AG 2\", @\"employeeSet\": @[e1, e4]}];\n\n    SetOfPrimaryCompanies *companies = [SetOfPrimaryCompanies createInRealm:realm withValue:@[@[c1, c2]]];\n    [realm commitWriteTransaction];\n\n    // count operator\n    XCTAssertEqual([[c1.employeeSet valueForKeyPath:@\"@count\"] integerValue], 3);\n\n    // numeric operators\n    XCTAssertEqual([[c1.employeeSet valueForKeyPath:@\"@min.age\"] intValue], 20);\n    XCTAssertEqual([[c1.employeeSet valueForKeyPath:@\"@max.age\"] intValue], 40);\n    XCTAssertEqual([[c1.employeeSet valueForKeyPath:@\"@sum.age\"] integerValue], 90);\n    XCTAssertEqualWithAccuracy([[c1.employeeSet valueForKeyPath:@\"@avg.age\"] doubleValue], 30, 0.1f);\n\n    // collection\n    XCTAssertEqualObjects([c1.employeeSet valueForKeyPath:@\"@unionOfObjects.name\"],\n                          (@[@\"A\", @\"B\", @\"C\"]));\n\n    XCTAssertEqualObjects([[c1.employeeSet valueForKeyPath:@\"@distinctUnionOfObjects.name\"] sortedArrayUsingSelector:@selector(compare:)],\n                          (@[@\"A\", @\"B\", @\"C\"]));\n    XCTAssertEqualObjects([NSSet setWithArray:[companies.companies valueForKeyPath:@\"@unionOfArrays.employeeSet\"]],\n                          ([NSSet setWithArray:@[e1, e2, e3, e4]]));\n    NSComparator cmp = ^NSComparisonResult(id obj1, id obj2) { return [[obj1 name] compare:[obj2 name]]; };\n    XCTAssertThrows([[companies.companies valueForKeyPath:@\"@distinctUnionOfSets.employees\"] sortedArrayUsingComparator:cmp]);\n\n    // invalid key paths\n    RLMAssertThrowsWithReasonMatching([c1.employeeSet valueForKeyPath:@\"@invalid.name\"],\n                                      @\"Unsupported KVC collection operator found in key path '@invalid.name'\");\n    RLMAssertThrowsWithReasonMatching([c1.employeeSet valueForKeyPath:@\"@sum\"],\n                                      @\"Missing key path for KVC collection operator sum in key path '@sum'\");\n    RLMAssertThrowsWithReasonMatching([c1.employeeSet valueForKeyPath:@\"@sum.\"],\n                                      @\"Missing key path for KVC collection operator sum in key path '@sum.'\");\n    RLMAssertThrowsWithReasonMatching([c1.employeeSet valueForKeyPath:@\"@sum.employees.@sum.age\"],\n                                      @\"Nested key paths.*not supported\");\n}\n\n- (void)testCrossThreadAccess\n{\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n\n    EmployeeObject *eo = [[EmployeeObject alloc] init];\n    eo.name = @\"Joe\";\n    eo.age = 40;\n    eo.hired = YES;\n    [company.employeeSet addObject:eo];\n    RLMSet *employees = company.employeeSet;\n\n    // Unmanaged object can be accessed from other threads\n    [self dispatchAsyncAndWait:^{\n        XCTAssertNoThrow(company.employeeSet);\n        XCTAssertNoThrow([employees allObjects]);\n    }];\n\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n    [realm addObject:company];\n    [realm commitWriteTransaction];\n\n    employees = company.employeeSet;\n    XCTAssertNoThrow(company.employeeSet);\n    XCTAssertNoThrow([employees allObjects]);\n    [self dispatchAsyncAndWait:^{\n        XCTAssertThrows(company.employeeSet);\n        XCTAssertThrows([employees allObjects]);\n    }];\n}\n\n- (void)testSortByNoColumns {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    DogObject *a2 = [DogObject createInDefaultRealmWithValue:@[@\"a\", @2]];\n    DogObject *b1 = [DogObject createInDefaultRealmWithValue:@[@\"b\", @1]];\n    DogObject *a1 = [DogObject createInDefaultRealmWithValue:@[@\"a\", @1]];\n    DogObject *b2 = [DogObject createInDefaultRealmWithValue:@[@\"b\", @2]];\n\n    RLMSet<DogObject *> *set = [DogSetObject createInDefaultRealmWithValue:@[@[a2, b1, a1, b2]]].dogs;\n    [realm commitWriteTransaction];\n\n    RLMResults *notActuallySorted = [set sortedResultsUsingDescriptors:@[]];\n    XCTAssertTrue([set.allObjects[0] isEqualToObject:notActuallySorted[0]]);\n    XCTAssertTrue([set.allObjects[1] isEqualToObject:notActuallySorted[1]]);\n    XCTAssertTrue([set.allObjects[2] isEqualToObject:notActuallySorted[2]]);\n    XCTAssertTrue([set.allObjects[3] isEqualToObject:notActuallySorted[3]]);\n}\n\n- (void)testSortByMultipleColumns {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    DogObject *a1 = [DogObject createInDefaultRealmWithValue:@[@\"a\", @1]];\n    DogObject *a2 = [DogObject createInDefaultRealmWithValue:@[@\"a\", @2]];\n    DogObject *b1 = [DogObject createInDefaultRealmWithValue:@[@\"b\", @1]];\n    DogObject *b2 = [DogObject createInDefaultRealmWithValue:@[@\"b\", @2]];\n\n    DogSetObject *set = [DogSetObject createInDefaultRealmWithValue:@[@[a1, a2, b1, b2]]];\n    [realm commitWriteTransaction];\n\n    bool (^checkOrder)(NSArray *, NSArray *, NSArray *) = ^bool(NSArray *properties, NSArray *ascending, NSArray *dogs) {\n        NSArray *sort = @[[RLMSortDescriptor sortDescriptorWithKeyPath:properties[0] ascending:[ascending[0] boolValue]],\n                          [RLMSortDescriptor sortDescriptorWithKeyPath:properties[1] ascending:[ascending[1] boolValue]]];\n        RLMResults *actual = [set.dogs sortedResultsUsingDescriptors:sort];\n\n        return [actual[0] isEqualToObject:dogs[0]]\n            && [actual[1] isEqualToObject:dogs[1]]\n            && [actual[2] isEqualToObject:dogs[2]]\n            && [actual[3] isEqualToObject:dogs[3]];\n    };\n\n    // Check each valid sort\n    XCTAssertTrue(checkOrder(@[@\"dogName\", @\"age\"], @[@YES, @YES], @[a1, a2, b1, b2]));\n    XCTAssertTrue(checkOrder(@[@\"dogName\", @\"age\"], @[@YES, @NO], @[a2, a1, b2, b1]));\n    XCTAssertTrue(checkOrder(@[@\"dogName\", @\"age\"], @[@NO, @YES], @[b1, b2, a1, a2]));\n    XCTAssertTrue(checkOrder(@[@\"dogName\", @\"age\"], @[@NO, @NO], @[b2, b1, a2, a1]));\n    XCTAssertTrue(checkOrder(@[@\"age\", @\"dogName\"], @[@YES, @YES], @[a1, b1, a2, b2]));\n    XCTAssertTrue(checkOrder(@[@\"age\", @\"dogName\"], @[@YES, @NO], @[b1, a1, b2, a2]));\n    XCTAssertTrue(checkOrder(@[@\"age\", @\"dogName\"], @[@NO, @YES], @[a2, b2, a1, b1]));\n    XCTAssertTrue(checkOrder(@[@\"age\", @\"dogName\"], @[@NO, @NO], @[b2, a2, b1, a1]));\n}\n\n- (void)testSortByRenamedColumns {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    id value = @{@\"set\": @[@[@1, @\"c\"], @[@2, @\"b\"], @[@3, @\"a\"]]};\n    LinkToRenamedProperties *obj = [LinkToRenamedProperties createInRealm:realm withValue:value];\n\n    XCTAssertEqualObjects([[obj.set sortedResultsUsingKeyPath:@\"intCol\" ascending:YES] valueForKeyPath:@\"intCol\"],\n                          (@[@1, @2, @3]));\n    XCTAssertEqualObjects([[obj.set sortedResultsUsingKeyPath:@\"intCol\" ascending:NO] valueForKeyPath:@\"intCol\"],\n                          (@[@3, @2, @1]));\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testDeleteLinksAndObjectsInSet\n{\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    EmployeeObject *po1 = [EmployeeObject createInRealm:realm withValue:@[@\"Joe\", @40, @YES]];\n    EmployeeObject *po2 = [EmployeeObject createInRealm:realm withValue:@[@\"John\", @30, @NO]];\n    EmployeeObject *po3 = [EmployeeObject createInRealm:realm withValue:@[@\"Jill\", @25, @YES]];\n\n    CompanyObject *company = [[CompanyObject alloc] init];\n    company.name = @\"name\";\n    [company.employeeSet addObjects:[EmployeeObject allObjects]];\n    [realm addObject:company];\n\n    [realm commitWriteTransaction];\n\n    RLMSet *peopleInCompany = company.employeeSet;\n\n    // Delete link to employee\n    XCTAssertThrowsSpecificNamed([peopleInCompany removeObject:po2], NSException, @\"RLMException\", @\"Not allowed in read transaction\");\n    XCTAssertEqual(peopleInCompany.count, 3U, @\"No links should have been deleted\");\n\n    [realm beginWriteTransaction];\n    XCTAssertNoThrow([peopleInCompany removeObject:po3], @\"Should delete link to employee\");\n    [realm commitWriteTransaction];\n\n    XCTAssertEqual(peopleInCompany.count, 2U, @\"link deleted when accessing via links\");\n    EmployeeObject *test = peopleInCompany.allObjects[0];\n    XCTAssertEqual(test.age, po1.age, @\"Should be equal\");\n    XCTAssertEqualObjects(test.name, po1.name, @\"Should be equal\");\n    XCTAssertEqual(test.hired, po1.hired, @\"Should be equal\");\n    XCTAssertTrue([test isEqualToObject:po1], @\"Should be equal\");\n\n    test = peopleInCompany.allObjects[1];\n    XCTAssertEqual(test.age, po2.age, @\"Should be equal\");\n    XCTAssertEqualObjects(test.name, po2.name, @\"Should be equal\");\n    XCTAssertEqual(test.hired, po2.hired, @\"Should be equal\");\n    XCTAssertTrue([test isEqualToObject:po2], @\"Should be equal\");\n\n    XCTAssertThrowsSpecificNamed([peopleInCompany removeObject:po3], NSException, @\"RLMException\", @\"Not allowed in read transaction\");\n    XCTAssertThrowsSpecificNamed([peopleInCompany removeAllObjects], NSException, @\"RLMException\", @\"Not allowed in read transaction\");\n    XCTAssertThrowsSpecificNamed([peopleInCompany addObject:po2], NSException, @\"RLMException\", @\"Not allowed in read transaction\");\n\n    [realm beginWriteTransaction];\n    XCTAssertNoThrow([peopleInCompany removeObject:po3], @\"Should delete last link\");\n    XCTAssertEqual(peopleInCompany.count, 2U, @\"2 remaining links\");\n\n    [peopleInCompany removeObject:po2];\n    XCTAssertEqual(peopleInCompany.count, 1U, @\"1 link replaced\");\n    [peopleInCompany addObject:po1];\n    XCTAssertEqual(peopleInCompany.count, 1U, @\"1 link\");\n    XCTAssertNoThrow([peopleInCompany removeAllObjects], @\"Should delete all links\");\n    XCTAssertEqual(peopleInCompany.count, 0U, @\"0 remaining links\");\n    [realm commitWriteTransaction];\n\n    RLMResults *allPeople = [EmployeeObject allObjects];\n    XCTAssertEqual(allPeople.count, 3U, @\"Only links should have been deleted, not the employees\");\n}\n\n- (void)testSetDescription {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    [realm beginWriteTransaction];\n    RLMSet<EmployeeObject *> *employees = [CompanyObject createInDefaultRealmWithValue:@[@\"company\"]].employeeSet;\n    RLMSet<NSNumber *> *ints = [AllPrimitiveSets createInDefaultRealmWithValue:@[]].intObj;\n    for (NSInteger i = 0; i < 1012; ++i) {\n        EmployeeObject *person = [[EmployeeObject alloc] init];\n        person.name = @\"Mary\";\n        person.age = 24;\n        person.hired = YES;\n        [employees addObject:person];\n        [ints addObject:@(i + 100)];\n    }\n    [realm commitWriteTransaction];\n\n    RLMAssertMatches(employees.description,\n                     @\"(?s)RLMSet\\\\<EmployeeObject\\\\> \\\\<0x[a-z0-9]+\\\\> \\\\(\\n\"\n                     @\"\\t\\\\[0\\\\] EmployeeObject \\\\{\\n\"\n                     @\"\\t\\tname = Mary;\\n\"\n                     @\"\\t\\tage = 24;\\n\"\n                     @\"\\t\\thired = 1;\\n\"\n                     @\"\\t\\\\},\\n\"\n                     @\".*\\n\"\n                     @\"\\t... 912 objects skipped.\\n\"\n                     @\"\\\\)\");\n    RLMAssertMatches(ints.description,\n                     @\"(?s)RLMSet\\\\<int\\\\> \\\\<0x[a-z0-9]+\\\\> \\\\(\\n\"\n                     @\"\\t\\\\[0\\\\] 100,\\n\"\n                     @\"\\t\\\\[1\\\\] 101,\\n\"\n                     @\"\\t\\\\[2\\\\] 102,\\n\"\n                     @\".*\\n\"\n                     @\"\\t... 912 objects skipped.\\n\"\n                     @\"\\\\)\");\n}\n\n- (void)testUnmanagedAssignment {\n    IntObject *io1 = [[IntObject alloc] init];\n    IntObject *io2 = [[IntObject alloc] init];\n    IntObject *io3 = [[IntObject alloc] init];\n\n    SetPropertyObject *set1 = [[SetPropertyObject alloc] init];\n    SetPropertyObject *set2 = [[SetPropertyObject alloc] init];\n\n    set1.intSet = (id)@[io1, io2];\n    set2.intSet = (id)@[io1, io2];\n\n    XCTAssertEqualObjects([set1.intSet valueForKey:@\"self\"], [set2.intSet valueForKey:@\"self\"]);\n\n    [set1 setValue:@[io3, io1] forKey:@\"intSet\"];\n    [set2 setValue:@[io3, io1] forKey:@\"intSet\"];\n    XCTAssertEqualObjects([set1.intSet valueForKey:@\"self\"], [set2.intSet valueForKey:@\"self\"]);\n\n    set1[@\"intSet\"] = @[io2, io3];\n    set2[@\"intSet\"] = @[io2, io3];\n    XCTAssertEqualObjects([set1.intSet valueForKey:@\"self\"], [set2.intSet valueForKey:@\"self\"]);\n\n    // Assigning RLMSet shallow copies\n    set2.intSet = set1.intSet;\n    XCTAssertEqualObjects([set2.intSet valueForKey:@\"self\"], [set1.intSet valueForKey:@\"self\"]);\n\n    [set1.intSet removeAllObjects];\n    [set2.intSet removeAllObjects];\n    XCTAssertEqualObjects([set2.intSet valueForKey:@\"self\"], [set1.intSet valueForKey:@\"self\"]);\n}\n\n- (void)testManagedAssignment {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n\n    IntObject *io1 = [IntObject createInRealm:realm withValue:@[@1]];\n    IntObject *io2 = [IntObject createInRealm:realm withValue:@[@2]];\n    IntObject *io3 = [IntObject createInRealm:realm withValue:@[@3]];\n\n    SetPropertyObject *set1 = [SetPropertyObject createInRealm:realm withValue:@[@\"\"]];\n    SetPropertyObject *set2 = [SetPropertyObject createInRealm:realm withValue:@[@\"\"]];\n\n    set1.intSet = (id)@[io1, io2];\n    XCTAssertEqualObjects([set1.intSet valueForKey:@\"intCol\"], ([NSSet setWithArray:@[@1, @2]]));\n\n    [set1 setValue:@[io3, io1] forKey:@\"intSet\"];\n    XCTAssertEqualObjects([set1.intSet valueForKey:@\"intCol\"], ([NSSet setWithArray:@[@1, @3]]));\n\n    set1[@\"intSet\"] = (id)@[io2, io3];\n    XCTAssertEqualObjects([set1.intSet valueForKey:@\"intCol\"], ([NSSet setWithArray:@[@2, @3]]));\n\n    // Assigning RLMSet shallow copies\n    set2.intSet = set1.intSet;\n    XCTAssertEqualObjects([set2.intSet valueForKey:@\"intCol\"], ([NSSet setWithArray:@[@3, @2]]));\n\n    [set1.intSet removeAllObjects];\n    XCTAssertEqualObjects([set2.intSet valueForKey:@\"intCol\"], ([NSSet setWithArray:@[@3, @2]]));\n\n    // Self-assignment is a no-op\n    set2.intSet = set2.intSet;\n    XCTAssertEqualObjects([set2.intSet valueForKey:@\"intCol\"], ([NSSet setWithArray:@[@3, @2]]));\n    set2[@\"intSet\"] = set2[@\"intSet\"];\n    XCTAssertEqualObjects([set2[@\"intSet\"] valueForKey:@\"intCol\"], ([NSSet setWithArray:@[@3, @2]]));\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAssignIncorrectType {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    SetPropertyObject *set = [SetPropertyObject createInRealm:realm\n                                                    withValue:@[@\"\", @[@[@\"a\"]], @[@[@0]]]];\n    RLMAssertThrowsWithReason(set.intSet = (id)set.set,\n                              @\"RLMSet<StringObject> does not match expected type 'IntObject' for property 'SetPropertyObject.intSet'.\");\n    RLMAssertThrowsWithReason(set[@\"intSet\"] = set[@\"set\"],\n                              @\"RLMSet<StringObject> does not match expected type 'IntObject' for property 'SetPropertyObject.intSet'.\");\n    [realm cancelWriteTransaction];\n}\n\n- (void)testNotificationSentInitially {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    SetPropertyObject *set = [SetPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[]]];\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    id token = [set.intSet addNotificationBlock:^(RLMSet *set, RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(set);\n        XCTAssertNil(change);\n        XCTAssertNil(error);\n        [expectation fulfill];\n    }];\n\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationSentAfterCommit {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    SetPropertyObject *set = [SetPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[]]];\n    [realm commitWriteTransaction];\n\n    __block bool first = true;\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [set.set addNotificationBlock:^(RLMSet *set, RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(set);\n        XCTAssert(first ? !change : !!change);\n        XCTAssertNil(error);\n        first = false;\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = self.realmWithTestPath;\n        [realm transactionWithBlock:^{\n            RLMSet *set = ((SetPropertyObject *)[SetPropertyObject allObjectsInRealm:realm].firstObject).set;\n            [set addObject:[[StringObject alloc] init]];\n        }];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationNotSentForUnrelatedChange {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    SetPropertyObject *set = [SetPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[]]];\n    [realm commitWriteTransaction];\n\n    id expectation = [self expectationWithDescription:@\"\"];\n    id token = [set.intSet addNotificationBlock:^(__unused RLMSet *set, __unused RLMCollectionChange *change, __unused NSError *error) {\n        // will throw if it's incorrectly called a second time due to the\n        // unrelated write transaction\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmDidChangeNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *realm = self.realmWithTestPath;\n            [realm transactionWithBlock:^{\n                [SetPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[]]];\n            }];\n        }];\n    }];\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testNotificationSentOnlyForActualRefresh {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    SetPropertyObject *set = [SetPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[]]];\n    [realm commitWriteTransaction];\n\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [set.set addNotificationBlock:^(RLMSet *set, __unused RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(set);\n        XCTAssertNil(error);\n        // will throw if it's called a second time before we create the new\n        // expectation object immediately before manually refreshing\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    // Turn off autorefresh, so the background commit should not result in a notification\n    realm.autorefresh = NO;\n\n    // All notification blocks are called as part of a single runloop event, so\n    // waiting for this one also waits for the above one to get a chance to run\n    [self waitForNotification:RLMRealmRefreshRequiredNotification realm:realm block:^{\n        [self dispatchAsyncAndWait:^{\n            RLMRealm *realm = self.realmWithTestPath;\n            [realm transactionWithBlock:^{\n                RLMSet *set = ((SetPropertyObject *)[SetPropertyObject allObjectsInRealm:realm].firstObject).set;\n                [set addObject:[[StringObject alloc] init]];\n            }];\n        }];\n    }];\n\n    expectation = [self expectationWithDescription:@\"\"];\n    [realm refresh];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\n- (void)testDeletingObjectWithNotificationsRegistered {\n    RLMRealm *realm = self.realmWithTestPath;\n    [realm beginWriteTransaction];\n    SetPropertyObject *set = [SetPropertyObject createInRealm:realm withValue:@[@\"\", @[], @[]]];\n    [realm commitWriteTransaction];\n\n    __block id expectation = [self expectationWithDescription:@\"\"];\n    id token = [set.set addNotificationBlock:^(RLMSet *set, __unused RLMCollectionChange *change, NSError *error) {\n        XCTAssertNotNil(set);\n        XCTAssertNil(error);\n        [expectation fulfill];\n    }];\n    [self waitForExpectationsWithTimeout:2.0 handler:nil];\n\n    [realm beginWriteTransaction];\n    [realm deleteObject:set];\n    [realm commitWriteTransaction];\n\n    [(RLMNotificationToken *)token invalidate];\n}\n\nstatic RLMSet<IntObject *> *managedTestSet(void) {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    __block RLMSet *set;\n    [realm transactionWithBlock:^{\n        SetPropertyObject *obj = [SetPropertyObject createInDefaultRealmWithValue:@[@\"\", @[], @[@[@0], @[@1]]]];\n        set = obj.intSet;\n    }];\n    return set;\n}\n\n- (void)testAllMethodsCheckThread {\n    RLMSet<IntObject *> *set = managedTestSet();\n    IntObject *io = set.allObjects[0];\n    RLMRealm *realm = set.realm;\n    [realm beginWriteTransaction];\n\n    [self dispatchAsyncAndWait:^{\n        RLMAssertThrowsWithReasonMatching([set count], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([set allObjects], @\"thread\");\n\n        RLMAssertThrowsWithReasonMatching([set addObject:io], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([set addObjects:@[io]], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([set removeAllObjects], @\"thread\");\n\n        RLMAssertThrowsWithReasonMatching([set objectsWhere:@\"intCol = 0\"], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([set objectsWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([set sortedResultsUsingKeyPath:@\"intCol\" ascending:YES], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([set sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"intCol\" ascending:YES]]], @\"thread\");\n        RLMAssertThrowsWithReasonMatching(set.allObjects[0], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([set valueForKey:@\"intCol\"], @\"thread\");\n        RLMAssertThrowsWithReasonMatching([set setValue:@1 forKey:@\"intCol\"], @\"thread\");\n        RLMAssertThrowsWithReasonMatching(({for (__unused id obj in set);}), @\"thread\");\n    }];\n    [realm cancelWriteTransaction];\n}\n\n- (void)testAllMethodsCheckForInvalidation {\n    RLMSet<IntObject *> *set = managedTestSet();\n    IntObject *io = set.allObjects[0];\n    RLMRealm *realm = set.realm;\n\n    [realm beginWriteTransaction];\n\n    XCTAssertNoThrow([set objectClassName]);\n    XCTAssertNoThrow([set realm]);\n    XCTAssertNoThrow([set isInvalidated]);\n\n    XCTAssertNoThrow([set count]);\n    XCTAssertNoThrow([set allObjects]);\n\n    XCTAssertNoThrow([set addObject:io]);\n    XCTAssertNoThrow([set addObjects:@[io]]);\n    XCTAssertNoThrow([set removeObject:io]);\n    XCTAssertNoThrow([set removeAllObjects]);\n    [set addObjects:@[io, io, io]];\n\n    XCTAssertNoThrow([set objectsWhere:@\"intCol = 0\"]);\n    XCTAssertNoThrow([set objectsWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]]);\n    XCTAssertNoThrow([set sortedResultsUsingKeyPath:@\"intCol\" ascending:YES]);\n    XCTAssertNoThrow([set sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"intCol\" ascending:YES]]]);\n    XCTAssertNoThrow(set.allObjects[0]);\n    XCTAssertNoThrow([set valueForKey:@\"intCol\"]);\n    XCTAssertNoThrow([set setValue:@1 forKey:@\"intCol\"]);\n    XCTAssertNoThrow(({for (__unused id obj in set);}));\n\n    [realm cancelWriteTransaction];\n    [realm invalidate];\n    [realm beginWriteTransaction];\n    io = [IntObject createInDefaultRealmWithValue:@[@0]];\n\n    XCTAssertNoThrow([set objectClassName]);\n    XCTAssertNoThrow([set realm]);\n    XCTAssertNoThrow([set isInvalidated]);\n\n    RLMAssertThrowsWithReasonMatching([set count], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([set allObjects], @\"invalidated\");\n\n    RLMAssertThrowsWithReasonMatching([set addObject:io], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([set addObjects:@[io]], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([set removeObject:io], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([set removeAllObjects], @\"invalidated\");\n\n    RLMAssertThrowsWithReasonMatching([set objectsWhere:@\"intCol = 0\"], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([set objectsWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([set sortedResultsUsingKeyPath:@\"intCol\" ascending:YES], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([set sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"intCol\" ascending:YES]]], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching(set.allObjects[0], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([set valueForKey:@\"intCol\"], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching([set setValue:@1 forKey:@\"intCol\"], @\"invalidated\");\n    RLMAssertThrowsWithReasonMatching(({for (__unused id obj in set);}), @\"invalidated\");\n\n    [realm cancelWriteTransaction];\n}\n\n- (void)testMutatingMethodsCheckForWriteTransaction {\n    RLMSet<IntObject *> *set = managedTestSet();\n    IntObject *io = set.allObjects[0];\n\n    XCTAssertNoThrow([set objectClassName]);\n    XCTAssertNoThrow([set realm]);\n    XCTAssertNoThrow([set isInvalidated]);\n\n    XCTAssertNoThrow([set count]);\n    XCTAssertNoThrow([set allObjects]);\n\n    XCTAssertNoThrow([set objectsWhere:@\"intCol = 0\"]);\n    XCTAssertNoThrow([set objectsWithPredicate:[NSPredicate predicateWithFormat:@\"intCol = 0\"]]);\n    XCTAssertNoThrow([set sortedResultsUsingKeyPath:@\"intCol\" ascending:YES]);\n    XCTAssertNoThrow([set sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:@\"intCol\" ascending:YES]]]);\n    XCTAssertNoThrow([set valueForKey:@\"intCol\"]);\n    XCTAssertNoThrow(({for (__unused id obj in set);}));\n\n\n    RLMAssertThrowsWithReasonMatching([set addObject:io], @\"write transaction\");\n    RLMAssertThrowsWithReasonMatching([set addObjects:@[io]], @\"write transaction\");\n    RLMAssertThrowsWithReasonMatching([set removeAllObjects], @\"write transaction\");\n\n    RLMAssertThrowsWithReasonMatching([set setValue:@1 forKey:@\"intCol\"], @\"write transaction\");\n}\n\n- (void)testIsFrozen {\n    RLMSet *unfrozen = managedTestSet();\n    RLMSet *frozen = [unfrozen freeze];\n    XCTAssertFalse(unfrozen.isFrozen);\n    XCTAssertTrue(frozen.isFrozen);\n}\n\n- (void)testFreezingFrozenObjectReturnsSelf {\n    RLMSet *set = managedTestSet();\n    RLMSet *frozen = [set freeze];\n    XCTAssertNotEqual(set, frozen);\n    XCTAssertNotEqual(set.freeze, frozen);\n    XCTAssertEqual(frozen, frozen.freeze);\n}\n\n- (void)testFreezeFromWrongThread {\n    RLMSet *set = managedTestSet();\n    [self dispatchAsyncAndWait:^{\n        RLMAssertThrowsWithReason([set freeze],\n                                  @\"Realm accessed from incorrect thread\");\n    }];\n}\n\n- (void)testAccessFrozenFromDifferentThread {\n    RLMSet *frozen = [managedTestSet() freeze];\n    [self dispatchAsyncAndWait:^{\n        XCTAssertEqualObjects([(NSSet *)[frozen valueForKey:@\"intCol\"] allObjects], (@[@0, @1]));\n    }];\n}\n\n- (void)testObserveFrozenSet {\n    RLMSet *frozen = [managedTestSet() freeze];\n    id block = ^(__unused BOOL deleted, __unused NSArray *changes, __unused NSError *error) {};\n    RLMAssertThrowsWithReason([frozen addNotificationBlock:block],\n                              @\"Frozen Realms do not change and do not have change notifications.\");\n}\n\n- (void)testQueryFrozenSet {\n    RLMSet *frozen = [managedTestSet() freeze];\n    XCTAssertEqualObjects([[frozen objectsWhere:@\"intCol > 0\"] valueForKey:@\"intCol\"], (@[@1]));\n}\n\n- (void)testFrozenSetsDoNotUpdate {\n    RLMSet *set = managedTestSet();\n    RLMSet *frozen = [set freeze];\n    XCTAssertEqual(frozen.count, 2);\n    [set.realm transactionWithBlock:^{\n        [set removeObject:set.allObjects[0]];\n    }];\n    XCTAssertEqual(frozen.count, 2);\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/Swift/RLMTestCaseUtils.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\n#endif\n\nextension RLMTestCase {\n    func assertThrowsWithReasonMatching<T>(_ block: @autoclosure @escaping () -> T, _ regexString: String,\n        _ message: String? = nil, fileName: String = #file, lineNumber: UInt = #line) {\n            RLMAssertThrowsWithReasonMatchingSwift(self, { _ = block() }, regexString, message, fileName, lineNumber)\n    }\n}\n"
  },
  {
    "path": "Realm/Tests/Swift/RealmObjcSwiftTests-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundlePackageType</key>\n\t<string>BNDL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Realm/Tests/Swift/Swift-Tests-Bridging-Header.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestObjects.h\"\n#import \"RLMMultiProcessTestCase.h\"\n#import \"TestUtils.h\"\n"
  },
  {
    "path": "Realm/Tests/Swift/SwiftArrayPropertyTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport Realm\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\n#endif\n\nextension RLMObject {\n    @discardableResult\n    class func create(in realm: RLMRealm, withValue value: [Any]) -> Self {\n        create(in: realm, withValue: value as Any)\n    }\n\n    @discardableResult\n    class func createInDefaultRealm(withValue value: [Any]) -> Self {\n        createInDefaultRealm(withValue: value as Any)\n    }\n\n    @discardableResult\n    class func createOrUpdate(in realm: RLMRealm, withValue value: [Any]) -> Self {\n        create(in: realm, withValue: value as Any)\n    }\n\n    @discardableResult\n    class func createOrUpdateInDefaultRealm(withValue value: [Any]) -> Self {\n        createOrUpdateInDefaultRealm(withValue: value as Any)\n    }\n}\n\nclass SwiftRLMArrayPropertyTests: RLMTestCase {\n\n    // Swift models\n\n    func testBasicArray() {\n        let string = SwiftRLMStringObject()\n        string.stringCol = \"string\"\n\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        realm.add(string)\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(SwiftRLMStringObject.allObjects(in: realm).count, UInt(1), \"There should be a single SwiftRLMStringObject in the realm\")\n\n        let array = SwiftRLMArrayPropertyObject()\n        array.name = \"arrayObject\"\n        array.array.add(string)\n        XCTAssertEqual(array.array.count, UInt(1))\n        XCTAssertEqual(array.array.firstObject()!.stringCol, \"string\")\n\n        realm.beginWriteTransaction()\n        realm.add(array)\n        array.array.add(string)\n        try! realm.commitWriteTransaction()\n\n        let arrayObjects = SwiftRLMArrayPropertyObject.allObjects(in: realm) as! RLMResults<SwiftRLMArrayPropertyObject>\n\n        XCTAssertEqual(arrayObjects.count, UInt(1), \"There should be a single SwiftRLMStringObject in the realm\")\n        let cmp = arrayObjects.firstObject()!.array.firstObject()!\n        XCTAssertTrue(string.isEqual(to: cmp), \"First array object should be the string object we added\")\n    }\n\n    func testPopulateEmptyArray() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n        let array = SwiftRLMArrayPropertyObject.create(in: realm, withValue: [\"arrayObject\"])\n        XCTAssertNotNil(array.array, \"Should be able to get an empty array\")\n        XCTAssertEqual(array.array.count, UInt(0), \"Should start with no array elements\")\n\n        let obj = SwiftRLMStringObject()\n        obj.stringCol = \"a\"\n        array.array.add(obj)\n        array.array.add(SwiftRLMStringObject.create(in: realm, withValue: [\"b\"]))\n        array.array.add(obj)\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(array.array.count, UInt(3), \"Should have three elements in array\")\n        XCTAssertEqual(array.array[0].stringCol, \"a\", \"First element should have property value 'a'\")\n        XCTAssertEqual(array.array[1].stringCol, \"b\", \"Second element should have property value 'b'\")\n        XCTAssertEqual(array.array[2].stringCol, \"a\", \"Third element should have property value 'a'\")\n\n        for obj in array.array {\n            XCTAssertFalse(obj.description.isEmpty, \"Object should have description\")\n        }\n    }\n\n    func testModifyDetatchedArray() {\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        let arObj = SwiftRLMArrayPropertyObject.create(in: realm, withValue: [\"arrayObject\"])\n        XCTAssertNotNil(arObj.array, \"Should be able to get an empty array\")\n        XCTAssertEqual(arObj.array.count, UInt(0), \"Should start with no array elements\")\n\n        let obj = SwiftRLMStringObject()\n        obj.stringCol = \"a\"\n        let array = arObj.array\n        array.add(obj)\n        array.add(SwiftRLMStringObject.create(in: realm, withValue: [\"b\"]))\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(array.count, UInt(2), \"Should have two elements in array\")\n        XCTAssertEqual(array[0].stringCol, \"a\", \"First element should have property value 'a'\")\n        XCTAssertEqual(array[1].stringCol, \"b\", \"Second element should have property value 'b'\")\n    }\n\n    func testInsertMultiple() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n\n        let obj = SwiftRLMArrayPropertyObject.create(in: realm, withValue: [\"arrayObject\"])\n        let child1 = SwiftRLMStringObject.create(in: realm, withValue: [\"a\"])\n        let child2 = SwiftRLMStringObject()\n        child2.stringCol = \"b\"\n        obj.array.addObjects([child2, child1] as NSArray)\n        try! realm.commitWriteTransaction()\n\n        let children = SwiftRLMStringObject.allObjects(in: realm)\n        XCTAssertEqual((children[0] as! SwiftRLMStringObject).stringCol, \"a\", \"First child should be 'a'\")\n        XCTAssertEqual((children[1] as! SwiftRLMStringObject).stringCol, \"b\", \"Second child should be 'b'\")\n    }\n\n    // FIXME: Support unmanaged RLMArray's in Swift-defined models\n    //    func testUnmanaged() {\n    //        let realm = realmWithTestPath()\n    //\n    //        let array = SwiftRLMArrayPropertyObject()\n    //        array.name = \"name\"\n    //        XCTAssertNotNil(array.array, \"RLMArray property should get created on access\")\n    //\n    //        let obj = SwiftRLMStringObject()\n    //        obj.stringCol = \"a\"\n    //        array.array.addObject(obj)\n    //        array.array.addObject(obj)\n    //\n    //        realm.beginWriteTransaction()\n    //        realm.addObject(array)\n    //        try! realm.commitWriteTransaction()\n    //\n    //        XCTAssertEqual(array.array.count, UInt(2), \"Should have two elements in array\")\n    //        XCTAssertEqual((array.array[0] as SwiftRLMStringObject).stringCol, \"a\", \"First element should have property value 'a'\")\n    //        XCTAssertEqual((array.array[1] as SwiftRLMStringObject).stringCol, \"a\", \"Second element should have property value 'a'\")\n    //    }\n\n    // Objective-C models\n\n    func testBasicArray_objc() {\n        let string = StringObject()\n        string.stringCol = \"string\"\n\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        realm.add(string)\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(StringObject.allObjects(in: realm).count, UInt(1), \"There should be a single StringObject in the realm\")\n\n        let array = ArrayPropertyObject()\n        array.name = \"arrayObject\"\n        array.array.add(string)\n\n        realm.beginWriteTransaction()\n        realm.add(array)\n        try! realm.commitWriteTransaction()\n\n        let arrayObjects = ArrayPropertyObject.allObjects(in: realm)\n\n        XCTAssertEqual(arrayObjects.count, UInt(1), \"There should be a single StringObject in the realm\")\n        let cmp = (arrayObjects.firstObject() as! ArrayPropertyObject).array.firstObject()!\n        XCTAssertTrue(string.isEqual(to: cmp), \"First array object should be the string object we added\")\n    }\n\n    func testPopulateEmptyArray_objc() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n        let array = ArrayPropertyObject.create(in: realm, withValue: [\"arrayObject\"])\n        XCTAssertNotNil(array.array, \"Should be able to get an empty array\")\n        XCTAssertEqual(array.array.count, UInt(0), \"Should start with no array elements\")\n\n        let obj = StringObject()\n        obj.stringCol = \"a\"\n        array.array.add(obj)\n        array.array.add(StringObject.create(in: realm, withValue: [\"b\"]))\n        array.array.add(obj)\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(array.array.count, UInt(3), \"Should have three elements in array\")\n        XCTAssertEqual((array.array[0]).stringCol!, \"a\", \"First element should have property value 'a'\")\n        XCTAssertEqual((array.array[1]).stringCol!, \"b\", \"Second element should have property value 'b'\")\n        XCTAssertEqual((array.array[2]).stringCol!, \"a\", \"Third element should have property value 'a'\")\n\n        for idx in 0..<array.array.count {\n            XCTAssertFalse(array.array[idx].description.isEmpty, \"Object should have description\")\n        }\n    }\n\n    func testModifyDetatchedArray_objc() {\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        let arObj = ArrayPropertyObject.create(in: realm, withValue: [\"arrayObject\"])\n        XCTAssertNotNil(arObj.array, \"Should be able to get an empty array\")\n        XCTAssertEqual(arObj.array.count, UInt(0), \"Should start with no array elements\")\n\n        let obj = StringObject()\n        obj.stringCol = \"a\"\n        let array = arObj.array!\n        array.add(obj)\n        array.add(StringObject.create(in: realm, withValue: [\"b\"]))\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(array.count, UInt(2), \"Should have two elements in array\")\n        XCTAssertEqual(array[0].stringCol!, \"a\", \"First element should have property value 'a'\")\n        XCTAssertEqual(array[1].stringCol!, \"b\", \"Second element should have property value 'b'\")\n    }\n\n    func testInsertMultiple_objc() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n\n        let obj = ArrayPropertyObject.create(in: realm, withValue: [\"arrayObject\"])\n        let child1 = StringObject.create(in: realm, withValue: [\"a\"])\n        let child2 = StringObject()\n        child2.stringCol = \"b\"\n        obj.array.addObjects([child2, child1] as NSArray)\n        try! realm.commitWriteTransaction()\n\n        let children = StringObject.allObjects(in: realm)\n        XCTAssertEqual((children[0] as! StringObject).stringCol!, \"a\", \"First child should be 'a'\")\n        XCTAssertEqual((children[1] as! StringObject).stringCol!, \"b\", \"Second child should be 'b'\")\n    }\n\n    func testUnmanaged_objc() {\n        let realm = realmWithTestPath()\n\n        let array = ArrayPropertyObject()\n        array.name = \"name\"\n        XCTAssertNotNil(array.array, \"RLMArray property should get created on access\")\n\n        let obj = StringObject()\n        obj.stringCol = \"a\"\n        array.array.add(obj)\n        array.array.add(obj)\n\n        realm.beginWriteTransaction()\n        realm.add(array)\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(array.array.count, UInt(2), \"Should have two elements in array\")\n        XCTAssertEqual(array.array[0].stringCol!, \"a\", \"First element should have property value 'a'\")\n        XCTAssertEqual(array.array[1].stringCol!, \"a\", \"Second element should have property value 'a'\")\n    }\n}\n"
  },
  {
    "path": "Realm/Tests/Swift/SwiftArrayTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\nimport XCTest\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\n#endif\n\nclass SwiftRLMArrayTests: RLMTestCase {\n\n    // Swift models\n\n    func testFastEnumeration() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n\n        let dateMinInput = Date()\n        let dateMaxInput = dateMinInput.addingTimeInterval(1000)\n\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput])\n\n        try! realm.commitWriteTransaction()\n\n        let result = SwiftRLMAggregateObject.objects(in: realm, where: \"intCol < %d\", 100)\n        XCTAssertEqual(result.count, UInt(10), \"10 objects added\")\n\n        var totalSum = 0\n\n        for obj in result {\n            if let ao = obj as? SwiftRLMAggregateObject {\n                totalSum += ao.intCol\n            }\n        }\n\n        XCTAssertEqual(totalSum, 100, \"total sum should be 100\")\n    }\n\n    func testObjectAggregate() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n\n        let dateMinInput = Date()\n        let dateMaxInput = dateMinInput.addingTimeInterval(1000)\n\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [0, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [1, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [0, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [1, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [0, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [1, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [0, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [1, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [0, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = SwiftRLMAggregateObject.create(in: realm, withValue: [0, 1.2 as Float, 0 as Double, true, dateMinInput])\n\n        try! realm.commitWriteTransaction()\n\n        let noArray = SwiftRLMAggregateObject.objects(in: realm, where: \"boolCol == NO\")\n        let yesArray = SwiftRLMAggregateObject.objects(in: realm, where: \"boolCol == YES\")\n\n        // SUM ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int sum\n        XCTAssertEqual(noArray.sum(ofProperty: \"intCol\").intValue, 4, \"Sum should be 4\")\n        XCTAssertEqual(yesArray.sum(ofProperty: \"intCol\").intValue, 0, \"Sum should be 0\")\n\n        // Test float sum\n        XCTAssertEqual(noArray.sum(ofProperty: \"floatCol\").floatValue, Float(0), accuracy: 0.1, \"Sum should be 0.0\")\n        XCTAssertEqual(yesArray.sum(ofProperty: \"floatCol\").floatValue, Float(7.2), accuracy: 0.1, \"Sum should be 7.2\")\n\n        // Test double sum\n        XCTAssertEqual(noArray.sum(ofProperty: \"doubleCol\").doubleValue, Double(10), accuracy: 0.1, \"Sum should be 10.0\")\n        XCTAssertEqual(yesArray.sum(ofProperty: \"doubleCol\").doubleValue, Double(0), accuracy: 0.1, \"Sum should be 0.0\")\n\n        // Average ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int average\n        XCTAssertEqual(noArray.average(ofProperty: \"intCol\")!.doubleValue, Double(1), accuracy: 0.1, \"Average should be 1.0\")\n        XCTAssertEqual(yesArray.average(ofProperty: \"intCol\")!.doubleValue, Double(0), accuracy: 0.1, \"Average should be 0.0\")\n\n        // Test float average\n        XCTAssertEqual(noArray.average(ofProperty: \"floatCol\")!.doubleValue, Double(0), accuracy: 0.1, \"Average should be 0.0\")\n        XCTAssertEqual(yesArray.average(ofProperty: \"floatCol\")!.doubleValue, Double(1.2), accuracy: 0.1, \"Average should be 1.2\")\n\n        // Test double average\n        XCTAssertEqual(noArray.average(ofProperty: \"doubleCol\")!.doubleValue, Double(2.5), accuracy: 0.1, \"Average should be 2.5\")\n        XCTAssertEqual(yesArray.average(ofProperty: \"doubleCol\")!.doubleValue, Double(0), accuracy: 0.1, \"Average should be 0.0\")\n\n        // MIN ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int min\n        var min = noArray.min(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(min.int32Value, Int32(1), \"Minimum should be 1\")\n        min = yesArray.min(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(min.int32Value, Int32(0), \"Minimum should be 0\")\n\n        // Test float min\n        min = noArray.min(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(min.floatValue, Float(0), accuracy: 0.1, \"Minimum should be 0.0f\")\n        min = yesArray.min(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(min.floatValue, Float(1.2), accuracy: 0.1, \"Minimum should be 1.2f\")\n\n        // Test double min\n        min = noArray.min(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(min.doubleValue, Double(2.5), accuracy: 0.1, \"Minimum should be 2.5\")\n        min = yesArray.min(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(min.doubleValue, Double(0), accuracy: 0.1, \"Minimum should be 0.0\")\n\n        // Test date min\n        var dateMinOutput = noArray.min(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMinOutput, dateMaxInput, \"Minimum should be dateMaxInput\")\n        dateMinOutput = yesArray.min(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMinOutput, dateMinInput, \"Minimum should be dateMinInput\")\n\n        // MAX ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int max\n        var max = noArray.max(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(max.intValue, 1, \"Maximum should be 8\")\n        max = yesArray.max(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(max.intValue, 0, \"Maximum should be 10\")\n\n        // Test float max\n        max = noArray.max(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(max.floatValue, Float(0), accuracy: 0.1, \"Maximum should be 0.0f\")\n        max = yesArray.max(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(max.floatValue, Float(1.2), accuracy: 0.1, \"Maximum should be 1.2f\")\n\n        // Test double max\n        max = noArray.max(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(max.doubleValue, Double(2.5), accuracy: 0.1, \"Maximum should be 2.5\")\n        max = yesArray.max(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(max.doubleValue, Double(0), accuracy: 0.1, \"Maximum should be 0.0\")\n\n        // Test date max\n        var dateMaxOutput = noArray.max(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMaxOutput, dateMaxInput, \"Maximum should be dateMaxInput\")\n        dateMaxOutput = yesArray.max(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMaxOutput, dateMinInput, \"Maximum should be dateMinInput\")\n    }\n\n    func testArrayDescription() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n\n        for _ in 0..<1012 {\n            let person = SwiftRLMEmployeeObject()\n            person.name = \"Mary\"\n            person.age = 24\n            person.hired = true\n            realm.add(person)\n        }\n\n        try! realm.commitWriteTransaction()\n\n        let description = SwiftRLMEmployeeObject.allObjects(in: realm).description\n\n        XCTAssertTrue((description as NSString).range(of: \"name\").location != Foundation.NSNotFound, \"property names should be displayed when calling \\\"description\\\" on RLMArray\")\n        XCTAssertTrue((description as NSString).range(of: \"Mary\").location != Foundation.NSNotFound, \"property values should be displayed when calling \\\"description\\\" on RLMArray\")\n\n        XCTAssertTrue((description as NSString).range(of: \"age\").location != Foundation.NSNotFound, \"property names should be displayed when calling \\\"description\\\" on RLMArray\")\n        XCTAssertTrue((description as NSString).range(of: \"24\").location != Foundation.NSNotFound, \"property values should be displayed when calling \\\"description\\\" on RLMArray\")\n\n        XCTAssertTrue((description as NSString).range(of: \"12 objects skipped\").location != Foundation.NSNotFound, \"'12 objects skipped' should be displayed when calling \\\"description\\\" on RLMArray\")\n    }\n\n    func testDeleteLinksAndObjectsInArray() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n\n        let po1 = SwiftRLMEmployeeObject()\n        po1.age = 40\n        po1.name = \"Joe\"\n        po1.hired = true\n\n        let po2 = SwiftRLMEmployeeObject()\n        po2.age = 30\n        po2.name = \"John\"\n        po2.hired = false\n\n        let po3 = SwiftRLMEmployeeObject()\n        po3.age = 25\n        po3.name = \"Jill\"\n        po3.hired = true\n\n        realm.add(po1)\n        realm.add(po2)\n        realm.add(po3)\n\n        let company = SwiftRLMCompanyObject()\n        realm.add(company)\n        company.employees.addObjects(SwiftRLMEmployeeObject.allObjects(in: realm))\n\n        try! realm.commitWriteTransaction()\n\n        let peopleInCompany = company.employees\n        XCTAssertEqual(peopleInCompany.count, UInt(3), \"No links should have been deleted\")\n\n        realm.beginWriteTransaction()\n        peopleInCompany.removeObject(at: 1) // Should delete link to employee\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(peopleInCompany.count, UInt(2), \"link deleted when accessing via links\")\n\n        var test = peopleInCompany[0]\n        XCTAssertEqual(test.age, po1.age, \"Should be equal\")\n        XCTAssertEqual(test.name, po1.name, \"Should be equal\")\n        XCTAssertEqual(test.hired, po1.hired, \"Should be equal\")\n        // XCTAssertEqual(test, po1, \"Should be equal\") //FIXME, should work. Asana : https://app.asana.com/0/861870036984/13123030433568\n\n        test = peopleInCompany[1]\n        XCTAssertEqual(test.age, po3.age, \"Should be equal\")\n        XCTAssertEqual(test.name, po3.name, \"Should be equal\")\n        XCTAssertEqual(test.hired, po3.hired, \"Should be equal\")\n        // XCTAssertEqual(test, po3, \"Should be equal\") //FIXME, should work. Asana : https://app.asana.com/0/861870036984/13123030433568\n\n        realm.beginWriteTransaction()\n        peopleInCompany.removeLastObject()\n        XCTAssertEqual(peopleInCompany.count, UInt(1), \"1 remaining link\")\n        peopleInCompany.replaceObject(at: 0, with: po2)\n        XCTAssertEqual(peopleInCompany.count, UInt(1), \"1 link replaced\")\n        peopleInCompany.insert(po1, at: 0)\n        XCTAssertEqual(peopleInCompany.count, UInt(2), \"2 links\")\n        peopleInCompany.removeAllObjects()\n        XCTAssertEqual(peopleInCompany.count, UInt(0), \"0 remaining links\")\n        try! realm.commitWriteTransaction()\n    }\n\n    // Objective-C models\n\n    func testFastEnumeration_objc() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n\n        let dateMinInput = Date()\n        let dateMaxInput = dateMinInput.addingTimeInterval(1000)\n\n        _ = AggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = AggregateObject.create(in: realm, withValue: [10, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        _ = AggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = AggregateObject.create(in: realm, withValue: [10, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        _ = AggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = AggregateObject.create(in: realm, withValue: [10, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        _ = AggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = AggregateObject.create(in: realm, withValue: [10, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        _ = AggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = AggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput])\n\n        try! realm.commitWriteTransaction()\n\n        let result = AggregateObject.objects(in: realm, where: \"intCol < %d\", 100)\n        XCTAssertEqual(result.count, UInt(10), \"10 objects added\")\n\n        var totalSum: CInt = 0\n\n        for obj in result {\n            if let ao = obj as? AggregateObject {\n                totalSum += ao.intCol\n            }\n        }\n\n        XCTAssertEqual(totalSum, CInt(100), \"total sum should be 100\")\n    }\n\n    func testObjectAggregate_objc() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n\n        let dateMinInput = Date()\n        let dateMaxInput = dateMinInput.addingTimeInterval(1000)\n\n        _ = AggregateObject.create(in: realm, withValue: [0, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = AggregateObject.create(in: realm, withValue: [1, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        _ = AggregateObject.create(in: realm, withValue: [0, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = AggregateObject.create(in: realm, withValue: [1, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        _ = AggregateObject.create(in: realm, withValue: [0, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = AggregateObject.create(in: realm, withValue: [1, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        _ = AggregateObject.create(in: realm, withValue: [0, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = AggregateObject.create(in: realm, withValue: [1, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        _ = AggregateObject.create(in: realm, withValue: [0, 1.2 as Float, 0 as Double, true, dateMinInput])\n        _ = AggregateObject.create(in: realm, withValue: [0, 1.2 as Float, 0 as Double, true, dateMinInput])\n\n        try! realm.commitWriteTransaction()\n\n        let noArray = AggregateObject.objects(in: realm, where: \"boolCol == NO\")\n        let yesArray = AggregateObject.objects(in: realm, where: \"boolCol == YES\")\n\n        // SUM ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int sum\n        XCTAssertEqual(noArray.sum(ofProperty: \"intCol\").intValue, 4, \"Sum should be 4\")\n        XCTAssertEqual(yesArray.sum(ofProperty: \"intCol\").intValue, 0, \"Sum should be 0\")\n\n        // Test float sum\n        XCTAssertEqual(noArray.sum(ofProperty: \"floatCol\").floatValue, Float(0), accuracy: 0.1, \"Sum should be 0.0\")\n        XCTAssertEqual(yesArray.sum(ofProperty: \"floatCol\").floatValue, Float(7.2), accuracy: 0.1, \"Sum should be 7.2\")\n\n        // Test double sum\n        XCTAssertEqual(noArray.sum(ofProperty: \"doubleCol\").doubleValue, Double(10), accuracy: 0.1, \"Sum should be 10.0\")\n        XCTAssertEqual(yesArray.sum(ofProperty: \"doubleCol\").doubleValue, Double(0), accuracy: 0.1, \"Sum should be 0.0\")\n\n        // Average ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int average\n        XCTAssertEqual(noArray.average(ofProperty: \"intCol\")!.doubleValue, Double(1), accuracy: 0.1, \"Average should be 1.0\")\n        XCTAssertEqual(yesArray.average(ofProperty: \"intCol\")!.doubleValue, Double(0), accuracy: 0.1, \"Average should be 0.0\")\n\n        // Test float average\n        XCTAssertEqual(noArray.average(ofProperty: \"floatCol\")!.doubleValue, Double(0), accuracy: 0.1, \"Average should be 0.0\")\n        XCTAssertEqual(yesArray.average(ofProperty: \"floatCol\")!.doubleValue, Double(1.2), accuracy: 0.1, \"Average should be 1.2\")\n\n        // Test double average\n        XCTAssertEqual(noArray.average(ofProperty: \"doubleCol\")!.doubleValue, Double(2.5), accuracy: 0.1, \"Average should be 2.5\")\n        XCTAssertEqual(yesArray.average(ofProperty: \"doubleCol\")!.doubleValue, Double(0), accuracy: 0.1, \"Average should be 0.0\")\n\n        // MIN ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int min\n        var min = noArray.min(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(min.int32Value, Int32(1), \"Minimum should be 1\")\n        min = yesArray.min(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(min.int32Value, Int32(0), \"Minimum should be 0\")\n\n        // Test float min\n        min = noArray.min(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(min.floatValue, Float(0), accuracy: 0.1, \"Minimum should be 0.0f\")\n        min = yesArray.min(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(min.floatValue, Float(1.2), accuracy: 0.1, \"Minimum should be 1.2f\")\n\n        // Test double min\n        min = noArray.min(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(min.doubleValue, Double(2.5), accuracy: 0.1, \"Minimum should be 2.5\")\n        min = yesArray.min(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(min.doubleValue, Double(0), accuracy: 0.1, \"Minimum should be 0.0\")\n\n        // Test date min\n        var dateMinOutput = noArray.min(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMinOutput, dateMaxInput, \"Minimum should be dateMaxInput\")\n        dateMinOutput = yesArray.min(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMinOutput, dateMinInput, \"Minimum should be dateMinInput\")\n\n        // MAX ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int max\n        var max = noArray.max(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(max.intValue, 1, \"Maximum should be 1\")\n        max = yesArray.max(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(max.intValue, 0, \"Maximum should be 0\")\n\n        // Test float max\n        max = noArray.max(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(max.floatValue, Float(0), accuracy: 0.1, \"Maximum should be 0.0f\")\n        max = yesArray.max(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(max.floatValue, Float(1.2), accuracy: 0.1, \"Maximum should be 1.2f\")\n\n        // Test double max\n        max = noArray.max(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(max.doubleValue, Double(2.5), accuracy: 0.1, \"Maximum should be 2.5\")\n        max = yesArray.max(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(max.doubleValue, Double(0), accuracy: 0.1, \"Maximum should be 0.0\")\n\n        // Test date max\n        var dateMaxOutput = noArray.max(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMaxOutput, dateMaxInput, \"Maximum should be dateMaxInput\")\n        dateMaxOutput = yesArray.max(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMaxOutput, dateMinInput, \"Maximum should be dateMinInput\")\n    }\n\n    func testArrayDescription_objc() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n\n        for _ in 0..<1012 {\n            let person = EmployeeObject()\n            person.name = \"Mary\"\n            person.age = 24\n            person.hired = true\n            realm.add(person)\n        }\n\n        try! realm.commitWriteTransaction()\n\n        let description = EmployeeObject.allObjects(in: realm).description\n        XCTAssertTrue((description as NSString).range(of: \"name\").location != Foundation.NSNotFound, \"property names should be displayed when calling \\\"description\\\" on RLMArray\")\n        XCTAssertTrue((description as NSString).range(of: \"Mary\").location != Foundation.NSNotFound, \"property values should be displayed when calling \\\"description\\\" on RLMArray\")\n\n        XCTAssertTrue((description as NSString).range(of: \"age\").location != Foundation.NSNotFound, \"property names should be displayed when calling \\\"description\\\" on RLMArray\")\n        XCTAssertTrue((description as NSString).range(of: \"24\").location != Foundation.NSNotFound, \"property values should be displayed when calling \\\"description\\\" on RLMArray\")\n\n        XCTAssertTrue((description as NSString).range(of: \"912 objects skipped\").location != Foundation.NSNotFound, \"'912 objects skipped' should be displayed when calling \\\"description\\\" on RLMArray\")\n    }\n\n    func makeEmployee(_ realm: RLMRealm, _ age: Int32, _ name: String, _ hired: Bool) -> EmployeeObject {\n        let employee = EmployeeObject()\n        employee.age = age\n        employee.name = name\n        employee.hired = hired\n        realm.add(employee)\n        return employee\n    }\n\n    func testDeleteLinksAndObjectsInArray_objc() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n\n        let po1 = makeEmployee(realm, 40, \"Joe\", true)\n        _ = makeEmployee(realm, 30, \"John\", false)\n        let po3 = makeEmployee(realm, 25, \"Jill\", true)\n\n        let company = CompanyObject()\n        company.name = \"name\"\n        realm.add(company)\n        company.employees.addObjects(EmployeeObject.allObjects(in: realm))\n\n        try! realm.commitWriteTransaction()\n\n        let peopleInCompany: RLMArray<EmployeeObject> = company.employees!\n        XCTAssertEqual(peopleInCompany.count, UInt(3), \"No links should have been deleted\")\n\n        realm.beginWriteTransaction()\n        peopleInCompany.removeObject(at: 1) // Should delete link to employee\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(peopleInCompany.count, UInt(2), \"link deleted when accessing via links\")\n\n        var test = peopleInCompany[0]\n        XCTAssertEqual(test.age, po1.age, \"Should be equal\")\n        XCTAssertEqual(test.name!, po1.name!, \"Should be equal\")\n        XCTAssertEqual(test.hired, po1.hired, \"Should be equal\")\n        // XCTAssertEqual(test, po1, \"Should be equal\") //FIXME, should work. Asana : https://app.asana.com/0/861870036984/13123030433568\n\n        test = peopleInCompany[1]\n        XCTAssertEqual(test.age, po3.age, \"Should be equal\")\n        XCTAssertEqual(test.name!, po3.name!, \"Should be equal\")\n        XCTAssertEqual(test.hired, po3.hired, \"Should be equal\")\n        // XCTAssertEqual(test, po3, \"Should be equal\") //FIXME, should work. Asana : https://app.asana.com/0/861870036984/13123030433568\n\n        let allPeople = EmployeeObject.allObjects(in: realm)\n        XCTAssertEqual(allPeople.count, UInt(3), \"Only links should have been deleted, not the employees\")\n    }\n\n    func testIndexOfObject_objc() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n        let po1 = makeEmployee(realm, 40, \"Joe\", true)\n        let po2 = makeEmployee(realm, 30, \"John\", false)\n        let po3 = makeEmployee(realm, 25, \"Jill\", true)\n        try! realm.commitWriteTransaction()\n\n        let results = EmployeeObject.objects(in: realm, where: \"hired = YES\")\n        XCTAssertEqual(UInt(2), results.count)\n        XCTAssertEqual(UInt(0), results.index(of: po1));\n        XCTAssertEqual(UInt(1), results.index(of: po3));\n        XCTAssertEqual(NSNotFound, Int(results.index(of: po2)));\n    }\n\n    func testIndexOfObjectWhere_objc() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n        _ = makeEmployee(realm, 40, \"Joe\", true)\n        _ = makeEmployee(realm, 30, \"John\", false)\n        _ = makeEmployee(realm, 25, \"Jill\", true)\n        try! realm.commitWriteTransaction()\n\n        let results = EmployeeObject.objects(in: realm, where: \"hired = YES\")\n        XCTAssertEqual(UInt(2), results.count)\n        XCTAssertEqual(UInt(0), results.indexOfObject(where: \"age = %d\", 40))\n        XCTAssertEqual(UInt(1), results.indexOfObject(where: \"age = %d\", 25))\n        XCTAssertEqual(NSNotFound, Int(results.indexOfObject(where: \"age = %d\", 30)))\n    }\n\n    func testSortingExistingQuery_objc() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n        _ = makeEmployee(realm, 20, \"A\", true)\n        _ = makeEmployee(realm, 30, \"B\", false)\n        _ = makeEmployee(realm, 40, \"C\", true)\n        try! realm.commitWriteTransaction()\n\n        let sortedByAge = EmployeeObject.allObjects(in: realm).sortedResults(usingKeyPath: \"age\", ascending: true)\n        let sortedByName = sortedByAge.sortedResults(usingKeyPath: \"name\", ascending: false)\n\n        XCTAssertEqual(Int32(20), (sortedByAge[0] as! EmployeeObject).age)\n        XCTAssertEqual(Int32(40), (sortedByName[0] as! EmployeeObject).age)\n    }\n}\n"
  },
  {
    "path": "Realm/Tests/Swift/SwiftDynamicTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm.Dynamic\nimport Realm.Private\nimport XCTest\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\n#endif\n\nclass SwiftRLMDynamicTests: RLMTestCase {\n\n    // Swift models\n\n    func testDynamicRealmExists() {\n        autoreleasepool {\n            // open realm in autoreleasepool to create tables and then dispose\n            let realm = RLMRealm(url: RLMTestRealmURL())\n            realm.beginWriteTransaction()\n            _ = SwiftRLMDynamicObject.create(in: realm, withValue: [\"column1\", 1])\n            _ = SwiftRLMDynamicObject.create(in: realm, withValue: [\"column2\", 2])\n            try! realm.commitWriteTransaction()\n        }\n        let dyrealm = realm(withTestPathAndSchema: nil)\n        XCTAssertNotNil(dyrealm, \"realm should not be nil\")\n\n        // verify schema\n        let dynSchema = dyrealm.schema[SwiftRLMDynamicObject.className()]\n        XCTAssertNotNil(dynSchema, \"Should be able to get object schema dynamically\")\n        XCTAssertEqual(dynSchema.properties.count, Int(2))\n        XCTAssertEqual(dynSchema.properties[0].name, \"stringCol\")\n        XCTAssertEqual(dynSchema.properties[1].type, RLMPropertyType.int)\n\n        // verify object type\n        let array = SwiftRLMDynamicObject.allObjects(in: dyrealm)\n        XCTAssertEqual(array.count, UInt(2))\n        XCTAssertEqual(array.objectClassName, SwiftRLMDynamicObject.className())\n    }\n\n    func testDynamicProperties() {\n        autoreleasepool {\n            // open realm in autoreleasepool to create tables and then dispose\n            let realm = RLMRealm(url: RLMTestRealmURL())\n            realm.beginWriteTransaction()\n            _ = SwiftRLMDynamicObject.create(in: realm, withValue: [\"column1\", 1])\n            _ = SwiftRLMDynamicObject.create(in: realm, withValue: [\"column2\", 2])\n            try! realm.commitWriteTransaction()\n        }\n\n        // verify properties\n        let dyrealm = realm(withTestPathAndSchema: nil)\n        let array = dyrealm.allObjects(\"SwiftRLMDynamicObject\")\n\n        XCTAssertTrue(array[0][\"intCol\"] as! NSNumber == 1)\n        XCTAssertTrue(array[1][\"stringCol\"] as! String == \"column2\")\n    }\n\n    // Objective-C models\n\n    func testDynamicRealmExists_objc() {\n        autoreleasepool {\n            // open realm in autoreleasepool to create tables and then dispose\n            let realm = RLMRealm(url: RLMTestRealmURL())\n            realm.beginWriteTransaction()\n            _ = DynamicTestObject.create(in: realm, withValue: [\"column1\", 1])\n            _ = DynamicTestObject.create(in: realm, withValue: [\"column2\", 2])\n            try! realm.commitWriteTransaction()\n        }\n        let dyrealm = realm(withTestPathAndSchema: nil)\n        XCTAssertNotNil(dyrealm, \"realm should not be nil\")\n\n        // verify schema\n        let dynSchema = dyrealm.schema[DynamicTestObject.className()]\n        XCTAssertNotNil(dynSchema, \"Should be able to get object schema dynamically\")\n        XCTAssertTrue(dynSchema.properties.count == 2)\n        XCTAssertTrue(dynSchema.properties[0].name == \"stringCol\")\n        XCTAssertTrue(dynSchema.properties[1].type == RLMPropertyType.int)\n\n        // verify object type\n        let array = DynamicTestObject.allObjects(in: dyrealm)\n        XCTAssertEqual(array.count, UInt(2))\n        XCTAssertEqual(array.objectClassName, DynamicTestObject.className())\n    }\n\n    func testDynamicProperties_objc() {\n        autoreleasepool {\n            // open realm in autoreleasepool to create tables and then dispose\n            let realm = RLMRealm(url: RLMTestRealmURL())\n            realm.beginWriteTransaction()\n            _ = DynamicTestObject.create(in: realm, withValue: [\"column1\", 1])\n            _ = DynamicTestObject.create(in: realm, withValue: [\"column2\", 2])\n            try! realm.commitWriteTransaction()\n        }\n\n        // verify properties\n        let dyrealm = realm(withTestPathAndSchema: nil)\n        let array = dyrealm.allObjects(\"DynamicTestObject\")\n\n        XCTAssertTrue(array[0][\"intCol\"] as! NSNumber == 1)\n        XCTAssertTrue(array[1][\"stringCol\"] as! String == \"column2\")\n    }\n\n    func testDynamicTypes_objc() {\n        let obj1 = AllTypesObject.values(1, stringObject: nil, mixedObject: nil)!\n        let obj2 = AllTypesObject.values(2,\n                                         stringObject: StringObject(value: [\"string\"]),\n                                         mixedObject: MixedObject(value: [\"string\"]))!\n\n        autoreleasepool {\n            // open realm in autoreleasepool to create tables and then dispose\n            let realm = self.realmWithTestPath()\n            realm.beginWriteTransaction()\n            _ = AllTypesObject.create(in: realm, withValue: obj1)\n            _ = AllTypesObject.create(in: realm, withValue: obj2)\n            try! realm.commitWriteTransaction()\n        }\n\n        // verify properties\n        let dyrealm = realm(withTestPathAndSchema: nil)\n        let results = dyrealm.allObjects(AllTypesObject.className())\n        XCTAssertEqual(results.count, UInt(2))\n        let robj1 = results[0]\n        let robj2 = results[1]\n\n        let schema = dyrealm.schema[AllTypesObject.className()]\n        let props = schema.properties.filter { $0.type != .object }\n        for prop in props {\n            XCTAssertTrue((obj1[prop.name] as AnyObject).isEqual(robj1[prop.name]))\n            XCTAssertTrue((obj2[prop.name] as AnyObject).isEqual(robj2[prop.name]))\n        }\n\n        // check sub object type\n        XCTAssertTrue(schema.properties[12].objectClassName! == \"StringObject\")\n        XCTAssertTrue(schema.properties[13].objectClassName! == \"MixedObject\")\n\n        // check object equality\n        XCTAssertNil(robj1[\"objectCol\"], \"object should be nil\")\n        XCTAssertNil(robj1[\"mixedObjectCol\"], \"object should be nil\")\n        XCTAssertTrue((robj2[\"objectCol\"] as! RLMObject)[\"stringCol\"] as! String == \"string\")\n        XCTAssertTrue((robj2[\"mixedObjectCol\"] as! RLMObject)[\"anyCol\"] as! String == \"string\")\n    }\n\n    func testDynamicTypesMixedCollection_objc() {\n        let obj1 = AllTypesObject.values(5,\n                                         stringObject: StringObject(value: [\"newString\"]),\n                                         mixedObject: MixedObject(value: [[\"string\", 45, false]]))!\n\n        autoreleasepool {\n            // open realm in autoreleasepool to create tables and then dispose\n            let realm = self.realmWithTestPath()\n            realm.beginWriteTransaction()\n            _ = AllTypesObject.create(in: realm, withValue: obj1)\n            try! realm.commitWriteTransaction()\n        }\n\n        let dyrealm = realm(withTestPathAndSchema: nil)\n        let results = dyrealm.allObjects(AllTypesObject.className())\n        XCTAssertEqual(results.count, UInt(1))\n        let robj1 = results[0]\n\n        // Mixed List\n        XCTAssertTrue(((robj1[\"mixedObjectCol\"] as! RLMObject)[\"anyCol\"] as! RLMManagedArray)[0] as! String == \"string\")\n        XCTAssertTrue(((robj1[\"mixedObjectCol\"] as! RLMObject)[\"anyCol\"] as! RLMManagedArray)[1] as! Int == 45)\n        XCTAssertTrue(((robj1[\"mixedObjectCol\"] as! RLMObject)[\"anyCol\"] as! RLMManagedArray)[2] as! Bool == false)\n    }\n}\n"
  },
  {
    "path": "Realm/Tests/Swift/SwiftLinkTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport Realm\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\n#endif\n\nclass SwiftRLMLinkTests: RLMTestCase {\n\n    // Swift models\n\n    func testBasicLink() {\n        let realm = realmWithTestPath()\n\n        let owner = SwiftRLMOwnerObject()\n        owner.name = \"Tim\"\n        owner.dog = SwiftRLMDogObject()\n        owner.dog!.dogName = \"Harvie\"\n\n        realm.beginWriteTransaction()\n        realm.add(owner)\n        try! realm.commitWriteTransaction()\n\n        let owners = SwiftRLMOwnerObject.allObjects(in: realm)\n        let dogs = SwiftRLMDogObject.allObjects(in: realm)\n        XCTAssertEqual(owners.count, UInt(1), \"Expecting 1 owner\")\n        XCTAssertEqual(dogs.count, UInt(1), \"Expecting 1 dog\")\n        XCTAssertEqual((owners[0] as! SwiftRLMOwnerObject).name, \"Tim\", \"Tim is named Tim\")\n        XCTAssertEqual((dogs[0] as! SwiftRLMDogObject).dogName, \"Harvie\", \"Harvie is named Harvie\")\n\n        let tim = owners[0] as! SwiftRLMOwnerObject\n        XCTAssertEqual(tim.dog!.dogName, \"Harvie\", \"Tim's dog should be Harvie\")\n    }\n\n    func testMultipleOwnerLink() {\n        let realm = realmWithTestPath()\n\n        let owner = SwiftRLMOwnerObject()\n        owner.name = \"Tim\"\n        owner.dog = SwiftRLMDogObject()\n        owner.dog!.dogName = \"Harvie\"\n\n        realm.beginWriteTransaction()\n        realm.add(owner)\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(SwiftRLMOwnerObject.allObjects(in: realm).count, UInt(1), \"Expecting 1 owner\")\n        XCTAssertEqual(SwiftRLMDogObject.allObjects(in: realm).count, UInt(1), \"Expecting 1 dog\")\n\n        realm.beginWriteTransaction()\n        let fiel = SwiftRLMOwnerObject.create(in: realm, withValue: [\"Fiel\", NSNull()])\n        fiel.dog = owner.dog\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(SwiftRLMOwnerObject.allObjects(in: realm).count, UInt(2), \"Expecting 2 owners\")\n        XCTAssertEqual(SwiftRLMDogObject.allObjects(in: realm).count, UInt(1), \"Expecting 1 dog\")\n    }\n\n    func testLinkRemoval() {\n        let realm = realmWithTestPath()\n\n        let owner = SwiftRLMOwnerObject()\n        owner.name = \"Tim\"\n        owner.dog = SwiftRLMDogObject()\n        owner.dog!.dogName = \"Harvie\"\n\n        realm.beginWriteTransaction()\n        realm.add(owner)\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(SwiftRLMOwnerObject.allObjects(in: realm).count, UInt(1), \"Expecting 1 owner\")\n        XCTAssertEqual(SwiftRLMDogObject.allObjects(in: realm).count, UInt(1), \"Expecting 1 dog\")\n\n        realm.beginWriteTransaction()\n        realm.delete(owner.dog!)\n        try! realm.commitWriteTransaction()\n\n        XCTAssertNil(owner.dog, \"Dog should be nullified when deleted\")\n\n        // refresh owner and check\n        let owner2 = SwiftRLMOwnerObject.allObjects(in: realm).firstObject() as! SwiftRLMOwnerObject\n        XCTAssertNotNil(owner2, \"Should have 1 owner\")\n        XCTAssertNil(owner2.dog, \"Dog should be nullified when deleted\")\n        XCTAssertEqual(SwiftRLMDogObject.allObjects(in: realm).count, UInt(0), \"Expecting 0 dogs\")\n    }\n\n    func testLinkingObjects() {\n        let realm = realmWithTestPath()\n\n        let target = SwiftRLMLinkTargetObject()\n        target.id = 0\n\n        let source = SwiftRLMLinkSourceObject()\n        source.id = 1234\n        source.link = target\n\n        XCTAssertEqual(0, target.backlinks!.count)\n\n        realm.beginWriteTransaction()\n        realm.add(source)\n        try! realm.commitWriteTransaction()\n\n        XCTAssertNotNil(target.realm)\n        XCTAssertEqual(1, target.backlinks!.count)\n        XCTAssertEqual(1234, (target.backlinks!.firstObject() as! SwiftRLMLinkSourceObject).id)\n    }\n\n//    FIXME - disabled until we fix commit log issue which break transacions when leaking realm objects\n//    func testCircularLinks() {\n//        let realm = realmWithTestPath()\n//\n//        let obj = SwiftRLMCircleObject()\n//        obj.data = \"a\"\n//        obj.next = obj\n//\n//        realm.beginWriteTransaction()\n//        realm.addObject(obj)\n//        obj.next.data = \"b\"\n//        try! realm.commitWriteTransaction()\n//\n//        let obj2 = SwiftRLMCircleObject.allObjectsInRealm(realm).firstObject() as SwiftRLMCircleObject\n//        XCTAssertEqual(obj2.data, \"b\", \"data should be 'b'\")\n//        XCTAssertEqual(obj2.data, obj2.next.data, \"objects should be equal\")\n//    }\n\n    // Objective-C models\n\n    func testBasicLink_objc() {\n        let realm = realmWithTestPath()\n\n        let owner = OwnerObject()\n        owner.name = \"Tim\"\n        owner.dog = DogObject()\n        owner.dog.dogName = \"Harvie\"\n\n        realm.beginWriteTransaction()\n        realm.add(owner)\n        try! realm.commitWriteTransaction()\n\n        let owners = OwnerObject.allObjects(in: realm)\n        let dogs = DogObject.allObjects(in: realm)\n        XCTAssertEqual(owners.count, UInt(1), \"Expecting 1 owner\")\n        XCTAssertEqual(dogs.count, UInt(1), \"Expecting 1 dog\")\n        XCTAssertEqual((owners[0] as! OwnerObject).name!, \"Tim\", \"Tim is named Tim\")\n        XCTAssertEqual((dogs[0] as! DogObject).dogName!, \"Harvie\", \"Harvie is named Harvie\")\n\n        let tim = owners[0] as! OwnerObject\n        XCTAssertEqual(tim.dog.dogName!, \"Harvie\", \"Tim's dog should be Harvie\")\n    }\n\n    func testMultipleOwnerLink_objc() {\n        let realm = realmWithTestPath()\n\n        let owner = OwnerObject()\n        owner.name = \"Tim\"\n        owner.dog = DogObject()\n        owner.dog.dogName = \"Harvie\"\n\n        realm.beginWriteTransaction()\n        realm.add(owner)\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(OwnerObject.allObjects(in: realm).count, UInt(1), \"Expecting 1 owner\")\n        XCTAssertEqual(DogObject.allObjects(in: realm).count, UInt(1), \"Expecting 1 dog\")\n\n        realm.beginWriteTransaction()\n        let fiel = OwnerObject.create(in: realm, withValue: [\"Fiel\", NSNull()])\n        fiel.dog = owner.dog\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(OwnerObject.allObjects(in: realm).count, UInt(2), \"Expecting 2 owners\")\n        XCTAssertEqual(DogObject.allObjects(in: realm).count, UInt(1), \"Expecting 1 dog\")\n    }\n\n    func testLinkRemoval_objc() {\n        let realm = realmWithTestPath()\n\n        let owner = OwnerObject()\n        owner.name = \"Tim\"\n        owner.dog = DogObject()\n        owner.dog.dogName = \"Harvie\"\n\n        realm.beginWriteTransaction()\n        realm.add(owner)\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(OwnerObject.allObjects(in: realm).count, UInt(1), \"Expecting 1 owner\")\n        XCTAssertEqual(DogObject.allObjects(in: realm).count, UInt(1), \"Expecting 1 dog\")\n\n        realm.beginWriteTransaction()\n        realm.delete(owner.dog)\n        try! realm.commitWriteTransaction()\n\n        XCTAssertNil(owner.dog, \"Dog should be nullified when deleted\")\n\n        // refresh owner and check\n        let owner2 = OwnerObject.allObjects(in: realm).firstObject() as! OwnerObject\n        XCTAssertNotNil(owner2, \"Should have 1 owner\")\n        XCTAssertNil(owner2.dog, \"Dog should be nullified when deleted\")\n        XCTAssertEqual(DogObject.allObjects(in: realm).count, UInt(0), \"Expecting 0 dogs\")\n    }\n\n//    FIXME - disabled until we fix commit log issue which break transacions when leaking realm objects\n//    func testCircularLinks_objc() {\n//        let realm = realmWithTestPath()\n//\n//        let obj = CircleObject()\n//        obj.data = \"a\"\n//        obj.next = obj\n//\n//        realm.beginWriteTransaction()\n//        realm.addObject(obj)\n//        obj.next.data = \"b\"\n//        try! realm.commitWriteTransaction()\n//\n//        let obj2 = CircleObject.allObjectsInRealm(realm).firstObject() as CircleObject\n//        XCTAssertEqual(obj2.data, \"b\", \"data should be 'b'\")\n//        XCTAssertEqual(obj2.data, obj2.next.data, \"objects should be equal\")\n//    }\n}\n"
  },
  {
    "path": "Realm/Tests/Swift/SwiftObjectInterfaceTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\nimport XCTest\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\n#endif\n\nclass OuterClass {\n    class InnerClass {\n\n    }\n}\n\nclass SwiftRLMStringObjectSubclass: SwiftRLMStringObject {\n    @objc dynamic var stringCol2 = \"\"\n}\n\nclass SwiftRLMSelfRefrencingSubclass: SwiftRLMStringObject {\n    @objc dynamic var objects = RLMArray<SwiftRLMSelfRefrencingSubclass>(objectClassName: SwiftRLMSelfRefrencingSubclass.className())\n    @objc dynamic var objectSet = RLMSet<SwiftRLMSelfRefrencingSubclass>(objectClassName: SwiftRLMSelfRefrencingSubclass.className())\n}\n\n\nclass SwiftRLMDefaultObject: RLMObject {\n    @objc dynamic var intCol = 1\n    @objc dynamic var boolCol = true\n\n    override class func defaultPropertyValues() -> [AnyHashable : Any]? {\n        return [\"intCol\": 2]\n    }\n}\n\nclass SwiftRLMOptionalNumberObject: RLMObject {\n    @objc dynamic var intCol: NSNumber? = 1\n    @objc dynamic var floatCol: NSNumber? = 2.2 as Float as NSNumber\n    @objc dynamic var doubleCol: NSNumber? = 3.3\n    @objc dynamic var boolCol: NSNumber? = true\n}\n\nclass SwiftRLMObjectInterfaceTests: RLMTestCase {\n\n    // Swift models\n\n    func testSwiftRLMObject() {\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n\n        let obj = SwiftRLMObject()\n        realm.add(obj)\n\n        obj.boolCol = true\n        obj.intCol = 1234\n        obj.floatCol = 1.1\n        obj.doubleCol = 2.2\n        obj.stringCol = \"abcd\"\n        obj.binaryCol = \"abcd\".data(using: String.Encoding.utf8)\n        obj.dateCol = Date(timeIntervalSince1970: 123)\n        obj.objectCol = SwiftRLMBoolObject()\n        obj.objectCol.boolCol = true\n        obj.arrayCol.add(obj.objectCol)\n        obj.setCol.add(obj.objectCol)\n        obj.uuidCol = UUID(uuidString: \"00000000-0000-0000-0000-000000000000\")\n        obj.rlmValue = NSString(\"I am a mixed value\")\n        try! realm.commitWriteTransaction()\n\n        let data = \"abcd\".data(using: String.Encoding.utf8)\n\n        let firstObj = SwiftRLMObject.allObjects(in: realm).firstObject() as! SwiftRLMObject\n        XCTAssertEqual(firstObj.boolCol, true, \"should be true\")\n        XCTAssertEqual(firstObj.intCol, 1234, \"should be 1234\")\n        XCTAssertEqual(firstObj.floatCol, Float(1.1), \"should be 1.1\")\n        XCTAssertEqual(firstObj.doubleCol, 2.2, \"should be 2.2\")\n        XCTAssertEqual(firstObj.stringCol, \"abcd\", \"should be abcd\")\n        XCTAssertEqual(firstObj.binaryCol!, data!)\n        XCTAssertEqual(firstObj.dateCol, Date(timeIntervalSince1970: 123), \"should be epoch + 123\")\n        XCTAssertEqual(firstObj.objectCol.boolCol, true, \"should be true\")\n        XCTAssertEqual(firstObj.uuidCol?.uuidString, \"00000000-0000-0000-0000-000000000000\")\n        XCTAssertEqual(firstObj.rlmValue as! NSString, NSString(\"I am a mixed value\"))\n        XCTAssertEqual(obj.arrayCol.count, UInt(1), \"array count should be 1\")\n        XCTAssertEqual(obj.arrayCol.firstObject()!.boolCol, true, \"should be true\")\n        XCTAssertEqual(obj.setCol.count, UInt(1), \"set count should be 1\")\n        XCTAssertEqual(obj.setCol.allObjects[0].boolCol, true, \"should be true\")\n    }\n\n    func testDefaultValueSwiftRLMObject() {\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        realm.add(SwiftRLMObject())\n        try! realm.commitWriteTransaction()\n\n        let data = \"a\".data(using: String.Encoding.utf8)\n\n        let firstObj = SwiftRLMObject.allObjects(in: realm).firstObject() as! SwiftRLMObject\n        XCTAssertEqual(firstObj.boolCol, false, \"should be false\")\n        XCTAssertEqual(firstObj.intCol, 123, \"should be 123\")\n        XCTAssertEqual(firstObj.floatCol, Float(1.23), \"should be 1.23\")\n        XCTAssertEqual(firstObj.doubleCol, 12.3, \"should be 12.3\")\n        XCTAssertEqual(firstObj.stringCol, \"a\", \"should be a\")\n        XCTAssertEqual(firstObj.binaryCol!, data!)\n        XCTAssertEqual(firstObj.dateCol, Date(timeIntervalSince1970: 1), \"should be epoch + 1\")\n        XCTAssertEqual(firstObj.objectCol.boolCol, false, \"should be false\")\n        XCTAssertEqual(firstObj.arrayCol.count, UInt(0), \"array count should be zero\")\n        XCTAssertEqual(firstObj.setCol.count, UInt(0), \"set count should be zero\")\n        XCTAssertEqual(firstObj.uuidCol!.uuidString, \"00000000-0000-0000-0000-000000000000\")\n        XCTAssertEqual(firstObj.uuidCol!.uuidString, \"00000000-0000-0000-0000-000000000000\")\n        XCTAssertEqual(firstObj.rlmValue as! NSString, NSString(\"A Mixed Object\"))\n    }\n\n    func testMergedDefaultValuesSwiftRLMObject() {\n        let realm = self.realmWithTestPath()\n        realm.beginWriteTransaction()\n        _ = SwiftRLMDefaultObject.create(in: realm, withValue: NSDictionary())\n        try! realm.commitWriteTransaction()\n\n        let object = SwiftRLMDefaultObject.allObjects(in: realm).firstObject() as! SwiftRLMDefaultObject\n        XCTAssertEqual(object.intCol, 2, \"defaultPropertyValues should override native property default value\")\n        XCTAssertEqual(object.boolCol, true, \"native property default value should be used if defaultPropertyValues doesn't contain that key\")\n    }\n\n    func testSubclass() {\n        // test className methods\n        XCTAssertEqual(\"SwiftRLMStringObject\", SwiftRLMStringObject.className())\n        XCTAssertEqual(\"SwiftRLMStringObjectSubclass\", SwiftRLMStringObjectSubclass.className())\n\n        let realm = RLMRealm.default()\n        realm.beginWriteTransaction()\n        _ = SwiftRLMStringObject.createInDefaultRealm(withValue: [\"string\"])\n\n        _ = SwiftRLMStringObjectSubclass.createInDefaultRealm(withValue: [\"string\", \"string2\"])\n        try! realm.commitWriteTransaction()\n\n        // ensure creation in proper table\n        XCTAssertEqual(UInt(1), SwiftRLMStringObjectSubclass.allObjects().count)\n        XCTAssertEqual(UInt(1), SwiftRLMStringObject.allObjects().count)\n\n        try! realm.transaction {\n            // create self referencing subclass\n            let sub = SwiftRLMSelfRefrencingSubclass.createInDefaultRealm(withValue: [\"string\"])\n            let sub2 = SwiftRLMSelfRefrencingSubclass()\n            sub.objects.add(sub2)\n            sub.objectSet.add(sub2)\n        }\n    }\n\n    func testOptionalNSNumberProperties() {\n        let realm = realmWithTestPath()\n        let no = SwiftRLMOptionalNumberObject()\n        XCTAssertEqual([.int, .float, .double, .bool], no.objectSchema.properties.map { $0.type })\n\n        XCTAssertEqual(1, no.intCol!)\n        XCTAssertEqual(2.2 as Float as NSNumber, no.floatCol!)\n        XCTAssertEqual(3.3, no.doubleCol!)\n        XCTAssertEqual(true, no.boolCol!)\n\n        try! realm.transaction {\n            realm.add(no)\n            no.intCol = nil\n            no.floatCol = nil\n            no.doubleCol = nil\n            no.boolCol = nil\n        }\n\n        XCTAssertNil(no.intCol)\n        XCTAssertNil(no.floatCol)\n        XCTAssertNil(no.doubleCol)\n        XCTAssertNil(no.boolCol)\n\n        try! realm.transaction {\n            no.intCol = 1.1\n            no.floatCol = 2.2 as Float as NSNumber\n            no.doubleCol = 3.3\n            no.boolCol = false\n        }\n\n        XCTAssertEqual(1, no.intCol!)\n        XCTAssertEqual(2.2 as Float as NSNumber, no.floatCol!)\n        XCTAssertEqual(3.3, no.doubleCol!)\n        XCTAssertEqual(false, no.boolCol!)\n    }\n\n    func testOptionalSwiftRLMProperties() {\n        let realm = realmWithTestPath()\n        try! realm.transaction { realm.add(SwiftRLMOptionalObject()) }\n\n        let firstObj = SwiftRLMOptionalObject.allObjects(in: realm).firstObject() as! SwiftRLMOptionalObject\n        XCTAssertNil(firstObj.optObjectCol)\n        XCTAssertNil(firstObj.optStringCol)\n        XCTAssertNil(firstObj.optNSStringCol)\n        XCTAssertNil(firstObj.optBinaryCol)\n        XCTAssertNil(firstObj.optDateCol)\n        XCTAssertNil(firstObj.uuidCol)\n\n        try! realm.transaction {\n            firstObj.optObjectCol = SwiftRLMBoolObject()\n            firstObj.optObjectCol!.boolCol = true\n\n            firstObj.optStringCol = \"Hi!\"\n            firstObj.optNSStringCol = \"Hi!\"\n            firstObj.optBinaryCol = Data(bytes: \"hi\", count: 2)\n            firstObj.optDateCol = Date(timeIntervalSinceReferenceDate: 10)\n            firstObj.uuidCol = UUID(uuidString: \"00000000-0000-0000-0000-000000000000\")\n        }\n        XCTAssertTrue(firstObj.optObjectCol!.boolCol)\n        XCTAssertEqual(firstObj.optStringCol!, \"Hi!\")\n        XCTAssertEqual(firstObj.optNSStringCol!, \"Hi!\")\n        XCTAssertEqual(firstObj.optBinaryCol!, Data(bytes: \"hi\", count: 2))\n        XCTAssertEqual(firstObj.optDateCol!, Date(timeIntervalSinceReferenceDate: 10))\n        XCTAssertEqual(firstObj.uuidCol!.uuidString, \"00000000-0000-0000-0000-000000000000\")\n\n        try! realm.transaction {\n            firstObj.optObjectCol = nil\n            firstObj.optStringCol = nil\n            firstObj.optNSStringCol = nil\n            firstObj.optBinaryCol = nil\n            firstObj.optDateCol = nil\n            firstObj.uuidCol = nil\n        }\n        XCTAssertNil(firstObj.optObjectCol)\n        XCTAssertNil(firstObj.optStringCol)\n        XCTAssertNil(firstObj.optNSStringCol)\n        XCTAssertNil(firstObj.optBinaryCol)\n        XCTAssertNil(firstObj.optDateCol)\n        XCTAssertNil(firstObj.uuidCol)\n    }\n\n    func testSwiftRLMClassNameIsDemangled() {\n        XCTAssertEqual(SwiftRLMObject.className(), \"SwiftRLMObject\",\n                       \"Calling className() on Swift class should return demangled name\")\n    }\n\n    func testPrimitiveArray() {\n        let obj = SwiftRLMPrimitiveArrayObject()\n        let str = \"str\" as NSString\n        let data = Data(\"str\".utf8) as NSData\n        let date = NSDate()\n        let str2 = \"str2\" as NSString\n        let data2 = Data(\"str2\".utf8) as NSData\n        let date2 = NSDate(timeIntervalSince1970: 0)\n\n        obj.stringCol.add(str)\n        XCTAssertEqual(obj.stringCol[0], str)\n        XCTAssertEqual(obj.stringCol.index(of: str), 0)\n        XCTAssertEqual(obj.stringCol.index(of: str2), UInt(NSNotFound))\n\n        obj.dataCol.add(data)\n        XCTAssertEqual(obj.dataCol[0], data)\n        XCTAssertEqual(obj.dataCol.index(of: data), 0)\n        XCTAssertEqual(obj.dataCol.index(of: data2), UInt(NSNotFound))\n\n        obj.dateCol.add(date)\n        XCTAssertEqual(obj.dateCol[0], date)\n        XCTAssertEqual(obj.dateCol.index(of: date), 0)\n        XCTAssertEqual(obj.dateCol.index(of: date2), UInt(NSNotFound))\n\n        obj.optStringCol.add(str)\n        XCTAssertEqual(obj.optStringCol[0], str)\n        obj.optDataCol.add(data)\n        XCTAssertEqual(obj.optDataCol[0], data)\n        obj.optDateCol.add(date)\n        XCTAssertEqual(obj.optDateCol[0], date)\n\n        obj.optStringCol.add(NSNull())\n        XCTAssertEqual(obj.optStringCol[1], NSNull())\n        obj.optDataCol.add(NSNull())\n        XCTAssertEqual(obj.optDataCol[1], NSNull())\n        obj.optDateCol.add(NSNull())\n        XCTAssertEqual(obj.optDateCol[1], NSNull())\n\n        assertThrowsWithReasonMatching(obj.optDataCol.add(str), \".*\")\n    }\n\n    func testPrimitiveSet() {\n        let obj = SwiftRLMPrimitiveSetObject()\n        let str = \"str\" as NSString\n        let data = Data(\"str\".utf8) as NSData\n        let date = NSDate()\n        obj.stringCol.add(str)\n        XCTAssertTrue(obj.stringCol.contains(str))\n\n        obj.dataCol.add(data)\n        XCTAssertTrue(obj.dataCol.contains(data))\n\n        obj.dateCol.add(date)\n        XCTAssertTrue(obj.dateCol.contains(date))\n\n        obj.optStringCol.add(str)\n        XCTAssertTrue(obj.optStringCol.contains(str))\n        obj.optDataCol.add(data)\n        XCTAssertTrue(obj.optDataCol.contains(data))\n        obj.optDateCol.add(date)\n        XCTAssertTrue(obj.optDateCol.contains(date))\n\n        obj.optStringCol.add(NSNull())\n        XCTAssertTrue(obj.optStringCol.contains(NSNull()))\n        obj.optDataCol.add(NSNull())\n        XCTAssertTrue(obj.optDataCol.contains(NSNull()))\n        obj.optDateCol.add(NSNull())\n        XCTAssertTrue(obj.optDateCol.contains(NSNull()))\n\n        assertThrowsWithReasonMatching(obj.optDataCol.add(str), \".*\")\n    }\n\n    func testUuidPrimitiveArray() {\n        let obj = SwiftRLMPrimitiveArrayObject()\n        let uuidA = NSUUID(uuidString: \"00000000-0000-0000-0000-000000000000\")!\n        let uuidB = NSUUID(uuidString: \"137DECC8-B300-4954-A233-F89909F4FD89\")!\n\n        obj.uuidCol.add(uuidA)\n        XCTAssertEqual(obj.uuidCol[0], uuidA)\n        XCTAssertEqual(obj.uuidCol.index(of: uuidA), 0)\n        XCTAssertEqual(obj.uuidCol.index(of: uuidB), UInt(NSNotFound))\n\n        obj.optUuidCol.add(NSNull())\n        XCTAssertEqual(obj.optUuidCol[0], NSNull())\n        obj.optUuidCol.add(uuidA)\n        XCTAssertEqual(obj.optUuidCol[1], uuidA)\n        obj.optUuidCol.add(NSNull())\n        XCTAssertEqual(obj.optUuidCol[2], NSNull())\n    }\n\n    func testUuidPrimitiveSet() {\n        let obj = SwiftRLMPrimitiveSetObject()\n        let uuidA = NSUUID(uuidString: \"00000000-0000-0000-0000-000000000000\")!\n\n        obj.uuidCol.add(uuidA)\n        XCTAssertTrue(obj.uuidCol.contains(uuidA))\n\n        obj.optUuidCol.add(NSNull())\n        XCTAssertTrue(obj.optUuidCol.contains(NSNull()))\n        obj.optUuidCol.add(uuidA)\n        XCTAssertTrue(obj.optUuidCol.contains(uuidA))\n        obj.optUuidCol.add(NSNull())\n        XCTAssertTrue(obj.optUuidCol.contains(NSNull()))\n    }\n\n    // Objective-C models\n\n    // Note: Swift doesn't support custom accessor names\n    // so we test to make sure models with custom accessors can still be accessed\n    func testCustomAccessors() {\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        let ca = CustomAccessorsObject.create(in: realm, withValue: [\"name\", 2])\n        XCTAssertEqual(ca.name!, \"name\", \"name property should be name.\")\n        ca.age = 99\n        XCTAssertEqual(ca.age, Int32(99), \"age property should be 99\")\n        try! realm.commitWriteTransaction()\n    }\n\n    func testClassExtension() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n        let bObject = BaseClassStringObject()\n        bObject.intCol = 1\n        bObject.stringCol = \"stringVal\"\n        realm.add(bObject)\n        try! realm.commitWriteTransaction()\n\n        let objectFromRealm = BaseClassStringObject.allObjects(in: realm)[0] as! BaseClassStringObject\n        XCTAssertEqual(objectFromRealm.intCol, Int32(1), \"Should be 1\")\n        XCTAssertEqual(objectFromRealm.stringCol!, \"stringVal\", \"Should be stringVal\")\n    }\n\n    func testCreateOrUpdate() {\n        let realm = RLMRealm.default()\n        realm.beginWriteTransaction()\n        SwiftRLMPrimaryStringObject.createOrUpdateInDefaultRealm(withValue: [\"string\", 1])\n        let objects = SwiftRLMPrimaryStringObject.allObjects() as! RLMResults<SwiftRLMPrimaryStringObject>\n        XCTAssertEqual(objects.count, UInt(1), \"Should have 1 object\")\n        XCTAssertEqual(objects[0].intCol, 1, \"Value should be 1\")\n\n        SwiftRLMPrimaryStringObject.createOrUpdateInDefaultRealm(withValue: [\"string2\", 2])\n        XCTAssertEqual(objects.count, UInt(2), \"Should have 2 objects\")\n\n        SwiftRLMPrimaryStringObject.createOrUpdateInDefaultRealm(withValue: [\"string\", 3])\n        XCTAssertEqual(objects.count, UInt(2), \"Should have 2 objects\")\n        XCTAssertEqual(objects[0].intCol, 3, \"Value should be 3\")\n\n        try! realm.commitWriteTransaction()\n    }\n\n    func testObjectForPrimaryKey() {\n        let realm = RLMRealm.default()\n        realm.beginWriteTransaction()\n        SwiftRLMPrimaryStringObject.createOrUpdateInDefaultRealm(withValue: [\"string\", 1])\n\n        let obj = SwiftRLMPrimaryStringObject.object(forPrimaryKey: \"string\")\n        XCTAssertNotNil(obj!)\n        XCTAssertEqual(obj!.intCol, 1)\n\n        realm.cancelWriteTransaction()\n    }\n\n    // if this fails (and you haven't changed the test module name), the checks\n    // for swift class names and the demangling logic need to be updated\n    func testNSStringFromClassDemangledTopLevelClassNames() {\n#if SWIFT_PACKAGE\n        XCTAssertEqual(NSStringFromClass(OuterClass.self), \"RealmObjcSwiftTests.OuterClass\")\n#else\n        XCTAssertEqual(NSStringFromClass(OuterClass.self), \"Tests.OuterClass\")\n#endif\n    }\n\n    // if this fails (and you haven't changed the test module name), the prefix\n    // check in RLMSchema initialization needs to be updated\n    func testNestedClassNameMangling() {\n#if SWIFT_PACKAGE\n        XCTAssertEqual(NSStringFromClass(OuterClass.InnerClass.self), \"_TtCC19RealmObjcSwiftTests10OuterClass10InnerClass\")\n#else\n        XCTAssertEqual(NSStringFromClass(OuterClass.InnerClass.self), \"_TtCC5Tests10OuterClass10InnerClass\")\n#endif\n    }\n\n}\n"
  },
  {
    "path": "Realm/Tests/Swift/SwiftPropertyTypeTest.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport Realm\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\n#endif\n\nclass SwiftRLMPropertyTypeTest: RLMTestCase {\n\n    func testLongType() {\n        let longNumber: Int64 = 17179869184\n        let intNumber: Int64 = 2147483647\n        let negativeLongNumber: Int64 = -17179869184\n        let updatedLongNumber: Int64 = 8589934592\n\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n        _ = SwiftRLMLongObject.create(in: realm, withValue: [NSNumber(value: longNumber)])\n        _ = SwiftRLMLongObject.create(in: realm, withValue: [NSNumber(value: intNumber)])\n        _ = SwiftRLMLongObject.create(in: realm, withValue: [NSNumber(value: negativeLongNumber)])\n        try! realm.commitWriteTransaction()\n\n        let objects = SwiftRLMLongObject.allObjects(in: realm)\n        XCTAssertEqual(objects.count, UInt(3), \"3 rows expected\")\n        XCTAssertEqual((objects[0] as! SwiftRLMLongObject).longCol, longNumber, \"2 ^ 34 expected\")\n        XCTAssertEqual((objects[1] as! SwiftRLMLongObject).longCol, intNumber, \"2 ^ 31 - 1 expected\")\n        XCTAssertEqual((objects[2] as! SwiftRLMLongObject).longCol, negativeLongNumber, \"-2 ^ 34 expected\")\n\n        realm.beginWriteTransaction()\n        (objects[0] as! SwiftRLMLongObject).longCol = updatedLongNumber\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual((objects[0] as! SwiftRLMLongObject).longCol, updatedLongNumber, \"After update: 2 ^ 33 expected\")\n    }\n\n    func testIntSizes() {\n        let realm = realmWithTestPath()\n\n        let v8  = Int8(1)  << 5\n        let v16 = Int16(1) << 12\n        let v32 = Int32(1) << 30\n        // 1 << 40 doesn't auto-promote to Int64 on 32-bit platforms\n        let v64 = Int64(1) << 40\n        try! realm.transaction {\n            let obj = SwiftRLMAllIntSizesObject()\n\n            obj.int8  = v8\n            XCTAssertEqual(obj.int8, v8)\n            obj.int16 = v16\n            XCTAssertEqual(obj.int16, v16)\n            obj.int32 = v32\n            XCTAssertEqual(obj.int32, v32)\n            obj.int64 = v64\n            XCTAssertEqual(obj.int64, v64)\n\n            realm.add(obj)\n        }\n\n        let obj = SwiftRLMAllIntSizesObject.allObjects(in: realm)[0] as! SwiftRLMAllIntSizesObject\n        XCTAssertEqual(obj.int8, v8)\n        XCTAssertEqual(obj.int16, v16)\n        XCTAssertEqual(obj.int32, v32)\n        XCTAssertEqual(obj.int64, v64)\n    }\n\n    func testIntSizes_objc() {\n        let realm = realmWithTestPath()\n\n        let v16 = Int16(1) << 12\n        let v32 = Int32(1) << 30\n        // 1 << 40 doesn't auto-promote to Int64 on 32-bit platforms\n        let v64 = Int64(1) << 40\n        try! realm.transaction {\n            let obj = AllIntSizesObject()\n\n            obj.int16 = v16\n            XCTAssertEqual(obj.int16, v16)\n            obj.int32 = v32\n            XCTAssertEqual(obj.int32, v32)\n            obj.int64 = v64\n            XCTAssertEqual(obj.int64, v64)\n\n            realm.add(obj)\n        }\n\n        let obj = AllIntSizesObject.allObjects(in: realm)[0] as! AllIntSizesObject\n        XCTAssertEqual(obj.int16, v16)\n        XCTAssertEqual(obj.int32, v32)\n        XCTAssertEqual(obj.int64, v64)\n    }\n\n    func testLazyVarProperties() {\n        let realm = realmWithTestPath()\n        let succeeded : Void? = try? realm.transaction {\n            realm.add(SwiftRLMLazyVarObject())\n        }\n        XCTAssertNotNil(succeeded, \"Writing an NSObject-based object with an lazy property should work.\")\n    }\n\n    func testIgnoredLazyVarProperties() {\n        let realm = realmWithTestPath()\n        let succeeded : Void? = try? realm.transaction {\n            realm.add(SwiftRLMIgnoredLazyVarObject())\n        }\n        XCTAssertNotNil(succeeded, \"Writing an object with an ignored lazy property should work.\")\n    }\n\n    func testObjectiveCTypeProperties() {\n        let realm = realmWithTestPath()\n        var object: SwiftRLMObjectiveCTypesObject!\n        let now = NSDate()\n        let data = Data(\"fizzbuzz\".utf8) as NSData\n        try! realm.transaction {\n            object = SwiftRLMObjectiveCTypesObject()\n            realm.add(object)\n            object.stringCol = \"Hello world!\"\n            object.dateCol = now\n            object.dataCol = data\n            object.numCol = 42\n        }\n        XCTAssertEqual(\"Hello world!\", object.stringCol)\n        XCTAssertEqual(now, object.dateCol)\n        XCTAssertEqual(data, object.dataCol)\n        XCTAssertEqual(42, object.numCol)\n    }\n}\n"
  },
  {
    "path": "Realm/Tests/Swift/SwiftRLMDictionaryTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\nimport XCTest\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\n#endif\n\nclass SwiftRLMDictionaryTests: RLMTestCase {\n\n    // Swift models\n\n    func testFastEnumeration() {\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n\n        let dObj = SwiftRLMDictionaryPropertyObject.create(in: realm, withValue: [])\n        let dict = dObj.dict\n        let dateMinInput = Date()\n        let dateMaxInput = dateMinInput.addingTimeInterval(1000)\n\n        dict[\"0\"] = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput])\n        dict[\"1\"] = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        dict[\"2\"] = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput])\n        dict[\"3\"] = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        dict[\"4\"] = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput])\n        dict[\"5\"] = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        dict[\"6\"] = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput])\n        dict[\"7\"] = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 0 as Float, 2.5 as Double, false, dateMaxInput])\n        dict[\"8\"] = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput])\n        dict[\"9\"] = SwiftRLMAggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput])\n\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(dict.count, UInt(10), \"10 objects added\")\n\n        var totalSum = 0\n\n        for (key, value) in dict {\n            let obj = dict[key] as! SwiftRLMAggregateObject\n            if let ao = value as? SwiftRLMAggregateObject {\n                XCTAssertEqual(obj.doubleCol, ao.doubleCol)\n                totalSum += ao.intCol\n            }\n        }\n\n        XCTAssertEqual(totalSum, 100, \"total sum should be 100\")\n    }\n\n    func testKeyType() {\n        let unmanaged = SwiftRLMDictionaryPropertyObject()\n        XCTAssertEqual(unmanaged.dict.keyType, .string)\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        let managed = SwiftRLMDictionaryPropertyObject.create(in: realm, withValue: [])\n        try! realm.commitWriteTransaction()\n        XCTAssertEqual(managed.dict.keyType, .string)\n    }\n\n    func testObjectAggregate() {\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        let dateMinInput = Date()\n        let dateMaxInput = dateMinInput.addingTimeInterval(1000)\n        let dObj = SwiftRLMDictionaryPropertyObject.create(in: realm, withValue: [\"dict\" : [\n            \"0\": [0, 1.2 as Float, 0 as Double, true, dateMinInput],\n            \"1\": [1, 0 as Float, 2.5 as Double, false, dateMaxInput],\n            \"2\": [0, 1.2 as Float, 0 as Double, true, dateMinInput],\n            \"3\": [1, 0 as Float, 2.5 as Double, false, dateMaxInput],\n            \"4\": [0, 1.2 as Float, 0 as Double, true, dateMinInput],\n            \"5\": [1, 0 as Float, 2.5 as Double, false, dateMaxInput],\n            \"6\": [0, 1.2 as Float, 0 as Double, true, dateMinInput],\n            \"7\": [1, 0 as Float, 2.5 as Double, false, dateMaxInput],\n            \"8\": [0, 1.2 as Float, 0 as Double, true, dateMinInput],\n            \"9\": [0, 1.2 as Float, 0 as Double, true, dateMinInput]\n        ] as [String: [Any]]])\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(dObj.dict.count, UInt(10), \"10 objects added\")\n\n        let noArray = dObj.dict.objects(where: \"boolCol == NO\")\n        let yesArray = dObj.dict.objects(where: \"boolCol == YES\")\n\n        // SUM ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int sum\n        XCTAssertEqual(noArray.sum(ofProperty: \"intCol\").intValue, 4, \"Sum should be 4\")\n        XCTAssertEqual(yesArray.sum(ofProperty: \"intCol\").intValue, 0, \"Sum should be 0\")\n\n        // Test float sum\n        XCTAssertEqual(noArray.sum(ofProperty: \"floatCol\").floatValue, Float(0), accuracy: 0.1, \"Sum should be 0.0\")\n        XCTAssertEqual(yesArray.sum(ofProperty: \"floatCol\").floatValue, Float(7.2), accuracy: 0.1, \"Sum should be 7.2\")\n\n        // Test double sum\n        XCTAssertEqual(noArray.sum(ofProperty: \"doubleCol\").doubleValue, Double(10), accuracy: 0.1, \"Sum should be 10.0\")\n        XCTAssertEqual(yesArray.sum(ofProperty: \"doubleCol\").doubleValue, Double(0), accuracy: 0.1, \"Sum should be 0.0\")\n\n        // Average ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int average\n        XCTAssertEqual(noArray.average(ofProperty: \"intCol\")!.doubleValue, Double(1), accuracy: 0.1, \"Average should be 1.0\")\n        XCTAssertEqual(yesArray.average(ofProperty: \"intCol\")!.doubleValue, Double(0), accuracy: 0.1, \"Average should be 0.0\")\n\n        // Test float average\n        XCTAssertEqual(noArray.average(ofProperty: \"floatCol\")!.doubleValue, Double(0), accuracy: 0.1, \"Average should be 0.0\")\n        XCTAssertEqual(yesArray.average(ofProperty: \"floatCol\")!.doubleValue, Double(1.2), accuracy: 0.1, \"Average should be 1.2\")\n\n        // Test double average\n        XCTAssertEqual(noArray.average(ofProperty: \"doubleCol\")!.doubleValue, Double(2.5), accuracy: 0.1, \"Average should be 2.5\")\n        XCTAssertEqual(yesArray.average(ofProperty: \"doubleCol\")!.doubleValue, Double(0), accuracy: 0.1, \"Average should be 0.0\")\n\n        // MIN ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int min\n        var min = noArray.min(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(min.int32Value, Int32(1), \"Minimum should be 1\")\n        min = yesArray.min(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(min.int32Value, Int32(0), \"Minimum should be 0\")\n\n        // Test float min\n        min = noArray.min(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(min.floatValue, Float(0), accuracy: 0.1, \"Minimum should be 0.0f\")\n        min = yesArray.min(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(min.floatValue, Float(1.2), accuracy: 0.1, \"Minimum should be 1.2f\")\n\n        // Test double min\n        min = noArray.min(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(min.doubleValue, Double(2.5), accuracy: 0.1, \"Minimum should be 1.5\")\n        min = yesArray.min(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(min.doubleValue, Double(0), accuracy: 0.1, \"Minimum should be 0.0\")\n\n        // Test date min\n        var dateMinOutput = noArray.min(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMinOutput, dateMaxInput, \"Minimum should be dateMaxInput\")\n        dateMinOutput = yesArray.min(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMinOutput, dateMinInput, \"Minimum should be dateMinInput\")\n\n        // MAX ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int max\n        var max = noArray.max(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(max.intValue, 1, \"Maximum should be 8\")\n        max = yesArray.max(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(max.intValue, 0, \"Maximum should be 10\")\n\n        // Test float max\n        max = noArray.max(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(max.floatValue, Float(0), accuracy: 0.1, \"Maximum should be 0.0f\")\n        max = yesArray.max(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(max.floatValue, Float(1.2), accuracy: 0.1, \"Maximum should be 1.2f\")\n\n        // Test double max\n        max = noArray.max(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(max.doubleValue, Double(2.5), accuracy: 0.1, \"Maximum should be 3.5\")\n        max = yesArray.max(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(max.doubleValue, Double(0), accuracy: 0.1, \"Maximum should be 0.0\")\n\n        // Test date max\n        var dateMaxOutput = noArray.max(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMaxOutput, dateMaxInput, \"Maximum should be dateMaxInput\")\n        dateMaxOutput = yesArray.max(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMaxOutput, dateMinInput, \"Maximum should be dateMinInput\")\n    }\n\n    func testDictionaryDescription() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n        let dObj = SwiftRLMDictionaryEmployeeObject.create(in: realm, withValue: [])\n        let dict = dObj.dict\n\n        for i in 0..<1012 {\n            dict[String(i) as NSString] = makeRlmEmployee(realm, 24, \"Mary\", true)\n        }\n\n        try! realm.commitWriteTransaction()\n\n        let description = dict.description\n\n        XCTAssertTrue((description as NSString).range(of: \"name\").location != Foundation.NSNotFound, \"property names should be displayed when calling \\\"description\\\" on RLMDictionary\")\n        XCTAssertTrue((description as NSString).range(of: \"Mary\").location != Foundation.NSNotFound, \"property values should be displayed when calling \\\"description\\\" on RLMDictionary\")\n\n        XCTAssertTrue((description as NSString).range(of: \"age\").location != Foundation.NSNotFound, \"property names should be displayed when calling \\\"description\\\" on RLMDictionary\")\n        XCTAssertTrue((description as NSString).range(of: \"24\").location != Foundation.NSNotFound, \"property values should be displayed when calling \\\"description\\\" on RLMDictionary\")\n    }\n\n    func testDeleteLinksAndObjectsInDictionary() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n\n        let po1 = makeRlmEmployee(realm, 40, \"Joe\", true)\n        let po2 = makeRlmEmployee(realm, 30, \"John\", false)\n        let po3 = makeRlmEmployee(realm, 25, \"Jill\", true)\n\n        let company = SwiftRLMCompanyObject()\n        realm.add(company)\n\n        company.employeeMap[\"Joe\" as NSString] = po1\n        company.employeeMap[\"John\" as NSString] = po2\n        company.employeeMap[\"Jill\" as NSString] = po3\n\n        try! realm.commitWriteTransaction()\n\n        let peopleInCompany = company.employeeMap\n        XCTAssertEqual(peopleInCompany.count, UInt(3), \"No links should have been deleted\")\n\n        realm.beginWriteTransaction()\n        peopleInCompany.removeObject(forKey: \"John\" as NSString) // Should delete link to employee\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(peopleInCompany.count, UInt(2), \"link deleted when accessing via links\")\n\n        var test = peopleInCompany[\"Joe\" as NSString]!\n        XCTAssertEqual(test.age, po1.age, \"Should be equal\")\n        XCTAssertEqual(test.name, po1.name, \"Should be equal\")\n        XCTAssertEqual(test.hired, po1.hired, \"Should be equal\")\n\n        test = peopleInCompany[\"Jill\" as NSString]!\n        XCTAssertEqual(test.age, po3.age, \"Should be equal\")\n        XCTAssertEqual(test.name, po3.name, \"Should be equal\")\n        XCTAssertEqual(test.hired, po3.hired, \"Should be equal\")\n\n        realm.beginWriteTransaction()\n        peopleInCompany[\"Jill\" as NSString] = nil\n        XCTAssertEqual(peopleInCompany.count, UInt(1), \"1 remaining link\")\n        peopleInCompany[\"Joe\" as NSString] = po2\n        XCTAssertEqual(peopleInCompany.count, UInt(1), \"1 link replaced\")\n        peopleInCompany.removeAllObjects()\n        XCTAssertEqual(peopleInCompany.count, UInt(0), \"0 remaining links\")\n        try! realm.commitWriteTransaction()\n\n        let allPeople = SwiftRLMEmployeeObject.allObjects(in: realm)\n        XCTAssertEqual(allPeople.count, UInt(3), \"Only links should have been deleted, not the employees\")\n    }\n\n    // Objective-C models\n\n    func testFastEnumeration_objc() {\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        let dateMinInput = Date()\n        let dateMaxInput = dateMinInput.addingTimeInterval(1000)\n        let dObj = AggregateDictionaryObject.create(in: realm, withValue: [\"dictionary\" : [\n            \"0\": [10, 1.2 as Float, 0 as Double, true, dateMinInput],\n            \"1\": [10, 0 as Float, 2.5 as Double, false, dateMaxInput],\n            \"2\": [10, 1.2 as Float, 0 as Double, true, dateMinInput],\n            \"3\": [10, 0 as Float, 2.5 as Double, false, dateMaxInput],\n            \"4\": [10, 1.2 as Float, 0 as Double, true, dateMinInput],\n            \"5\": [10, 0 as Float, 2.5 as Double, false, dateMaxInput],\n            \"6\": [10, 1.2 as Float, 0 as Double, true, dateMinInput],\n            \"7\": [10, 0 as Float, 2.5 as Double, false, dateMaxInput],\n            \"8\": [10, 1.2 as Float, 0 as Double, true, dateMinInput],\n            \"9\": [10, 1.2 as Float, 0 as Double, true, dateMinInput]\n        ] as [String: [Any]]])\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(dObj.dictionary!.count, UInt(10), \"10 objects added\")\n\n        var totalSum: CInt = 0\n        for key in dObj.dictionary!.allKeys {\n            if let ao = dObj.dictionary[key] {\n                totalSum += ao.intCol\n            }\n        }\n\n        XCTAssertEqual(totalSum, CInt(100), \"total sum should be 100\")\n    }\n\n    func testObjectAggregate_objc() {\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        let dateMinInput = Date()\n        let dateMaxInput = dateMinInput.addingTimeInterval(1000)\n        let dObj = AggregateDictionaryObject.create(in: realm, withValue: [\"dictionary\" : [\n            \"0\": [0, 1.2 as Float, 0 as Double, true, dateMinInput],\n            \"1\": [1, 0 as Float, 2.5 as Double, false, dateMaxInput],\n            \"2\": [0, 1.2 as Float, 0 as Double, true, dateMinInput],\n            \"3\": [1, 0 as Float, 2.5 as Double, false, dateMaxInput],\n            \"4\": [0, 1.2 as Float, 0 as Double, true, dateMinInput],\n            \"5\": [1, 0 as Float, 2.5 as Double, false, dateMaxInput],\n            \"6\": [0, 1.2 as Float, 0 as Double, true, dateMinInput],\n            \"7\": [1, 0 as Float, 2.5 as Double, false, dateMaxInput],\n            \"8\": [0, 1.2 as Float, 0 as Double, true, dateMinInput],\n            \"9\": [0, 1.2 as Float, 0 as Double, true, dateMinInput]\n        ] as [String: [Any]]])\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(dObj.dictionary!.count, UInt(10), \"10 objects added\")\n\n        let noArray = dObj.dictionary!.objects(where: \"boolCol == NO\")\n        let yesArray = dObj.dictionary!.objects(where: \"boolCol == YES\")\n\n        // SUM ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int sum\n        XCTAssertEqual(noArray.sum(ofProperty: \"intCol\").intValue, 4, \"Sum should be 4\")\n        XCTAssertEqual(yesArray.sum(ofProperty: \"intCol\").intValue, 0, \"Sum should be 0\")\n\n        // Test float sum\n        XCTAssertEqual(noArray.sum(ofProperty: \"floatCol\").floatValue, Float(0), accuracy: 0.1, \"Sum should be 0.0\")\n        XCTAssertEqual(yesArray.sum(ofProperty: \"floatCol\").floatValue, Float(7.2), accuracy: 0.1, \"Sum should be 7.2\")\n\n        // Test double sum\n        XCTAssertEqual(noArray.sum(ofProperty: \"doubleCol\").doubleValue, Double(10), accuracy: 0.1, \"Sum should be 10.0\")\n        XCTAssertEqual(yesArray.sum(ofProperty: \"doubleCol\").doubleValue, Double(0), accuracy: 0.1, \"Sum should be 0.0\")\n\n        // Average ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int average\n        XCTAssertEqual(noArray.average(ofProperty: \"intCol\")!.doubleValue, Double(1), accuracy: 0.1, \"Average should be 1.0\")\n        XCTAssertEqual(yesArray.average(ofProperty: \"intCol\")!.doubleValue, Double(0), accuracy: 0.1, \"Average should be 0.0\")\n\n        // Test float average\n        XCTAssertEqual(noArray.average(ofProperty: \"floatCol\")!.doubleValue, Double(0), accuracy: 0.1, \"Average should be 0.0\")\n        XCTAssertEqual(yesArray.average(ofProperty: \"floatCol\")!.doubleValue, Double(1.2), accuracy: 0.1, \"Average should be 1.2\")\n\n        // Test double average\n        XCTAssertEqual(noArray.average(ofProperty: \"doubleCol\")!.doubleValue, Double(2.5), accuracy: 0.1, \"Average should be 2.5\")\n        XCTAssertEqual(yesArray.average(ofProperty: \"doubleCol\")!.doubleValue, Double(0), accuracy: 0.1, \"Average should be 0.0\")\n\n        // MIN ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int min\n        var min = noArray.min(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(min.int32Value, Int32(1), \"Minimum should be 1\")\n        min = yesArray.min(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(min.int32Value, Int32(0), \"Minimum should be 0\")\n\n        // Test float min\n        min = noArray.min(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(min.floatValue, Float(0), accuracy: 0.1, \"Minimum should be 0.0f\")\n        min = yesArray.min(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(min.floatValue, Float(1.2), accuracy: 0.1, \"Minimum should be 1.2f\")\n\n        // Test double min\n        min = noArray.min(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(min.doubleValue, Double(2.5), accuracy: 0.1, \"Minimum should be 1.5\")\n        min = yesArray.min(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(min.doubleValue, Double(0), accuracy: 0.1, \"Minimum should be 0.0\")\n\n        // Test date min\n        var dateMinOutput = noArray.min(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMinOutput, dateMaxInput, \"Minimum should be dateMaxInput\")\n        dateMinOutput = yesArray.min(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMinOutput, dateMinInput, \"Minimum should be dateMinInput\")\n\n        // MAX ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int max\n        var max = noArray.max(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(max.intValue, 1, \"Maximum should be 8\")\n        max = yesArray.max(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(max.intValue, 0, \"Maximum should be 10\")\n\n        // Test float max\n        max = noArray.max(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(max.floatValue, Float(0), accuracy: 0.1, \"Maximum should be 0.0f\")\n        max = yesArray.max(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(max.floatValue, Float(1.2), accuracy: 0.1, \"Maximum should be 1.2f\")\n\n        // Test double max\n        max = noArray.max(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(max.doubleValue, Double(2.5), accuracy: 0.1, \"Maximum should be 3.5\")\n        max = yesArray.max(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(max.doubleValue, Double(0), accuracy: 0.1, \"Maximum should be 0.0\")\n\n        // Test date max\n        var dateMaxOutput = noArray.max(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMaxOutput, dateMaxInput, \"Maximum should be dateMaxInput\")\n        dateMaxOutput = yesArray.max(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMaxOutput, dateMinInput, \"Maximum should be dateMinInput\")\n    }\n\n    func testDictionaryDescription_objc() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n        let dObj = CompanyObject.create(in: realm, withValue: [])\n\n        for i in 0..<1012 {\n            dObj.employeeDict![String(i) as NSString] = makeEmployee(realm, 24, \"Mary\", true)\n        }\n\n        try! realm.commitWriteTransaction()\n\n        let description = dObj.employeeDict!.description\n        XCTAssertTrue((description as NSString).range(of: \"name\").location != Foundation.NSNotFound, \"property names should be displayed when calling \\\"description\\\" on RLMDictionary\")\n        XCTAssertTrue((description as NSString).range(of: \"Mary\").location != Foundation.NSNotFound, \"property values should be displayed when calling \\\"description\\\" on RLMDictionary\")\n\n        XCTAssertTrue((description as NSString).range(of: \"age\").location != Foundation.NSNotFound, \"property names should be displayed when calling \\\"description\\\" on RLMDictionary\")\n        XCTAssertTrue((description as NSString).range(of: \"24\").location != Foundation.NSNotFound, \"property values should be displayed when calling \\\"description\\\" on RLMDictionary\")\n    }\n\n    func makeRlmEmployee(_ realm: RLMRealm, _ age: Int32, _ name: String, _ hired: Bool) -> SwiftRLMEmployeeObject {\n        return SwiftRLMEmployeeObject.create(in: realm, withValue: [name, age, hired])\n    }\n\n    func makeEmployee(_ realm: RLMRealm, _ age: Int32, _ name: String, _ hired: Bool) -> EmployeeObject {\n        return EmployeeObject.create(in: realm,\n                                     withValue: [\"age\": age, \"name\": name, \"hired\": hired] as [String: Any])\n    }\n\n    func testDeleteLinksAndObjectsInDictionary_objc() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n        let po1 = makeEmployee(realm, 40, \"Joe\", true)\n        let po2 = makeEmployee(realm, 30, \"John\", false)\n        let po3 = makeEmployee(realm, 25, \"Jill\", true)\n        let company = CompanyObject.create(in: realm, withValue: [\"employeeDict\": [\n            \"Joe\": po1,\n            \"John\": po2,\n            \"Jill\": po3]])\n        try! realm.commitWriteTransaction()\n\n        let peopleInCompany = company.employeeDict!\n        XCTAssertEqual(peopleInCompany.count, UInt(3), \"No links should have been deleted\")\n\n        realm.beginWriteTransaction()\n        peopleInCompany[\"John\" as NSString] = nil // Should delete link to employee\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(peopleInCompany.count, UInt(2), \"link deleted when accessing via links\")\n\n        var test = peopleInCompany[\"Joe\" as NSString]!\n        XCTAssertEqual(test.age, po1.age, \"Should be equal\")\n        XCTAssertEqual(test.name!, po1.name!, \"Should be equal\")\n        XCTAssertEqual(test.hired, po1.hired, \"Should be equal\")\n\n        test = peopleInCompany[\"Jill\" as NSString]!\n        XCTAssertEqual(test.age, po3.age, \"Should be equal\")\n        XCTAssertEqual(test.name!, po3.name!, \"Should be equal\")\n        XCTAssertEqual(test.hired, po3.hired, \"Should be equal\")\n\n        let allPeople = EmployeeObject.allObjects(in: realm)\n        XCTAssertEqual(allPeople.count, UInt(3), \"Only links should have been deleted, not the employees\")\n    }\n\n    func testIndexOfObject_objc() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n        let po1 = makeEmployee(realm, 40, \"Joe\", true)\n        let po2 = makeEmployee(realm, 30, \"John\", false)\n        let po3 = makeEmployee(realm, 25, \"Jill\", true)\n        let company = CompanyObject.create(in: realm, withValue: [\"employeeDict\":\n                                                                    [\"Joe\": po1,\n                                                                     \"John\": po2,\n                                                                     \"Jill\": po3]])\n        try! realm.commitWriteTransaction()\n\n        let results = company.employeeDict.objects(where: \"hired = YES\").sortedResults(usingKeyPath: \"name\", ascending: false)\n        XCTAssertEqual(UInt(2), results.count)\n        XCTAssertEqual(UInt(0), results.index(of: po1));\n        XCTAssertEqual(UInt(1), results.index(of: po3));\n        XCTAssertEqual(NSNotFound, Int(results.index(of: po2)));\n    }\n\n    func testSortingExistingQuery_objc() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n\n        let company = CompanyObject()\n        company.employeeDict[\"Joe\" as NSString] = makeEmployee(realm, 20, \"A\", true)\n        company.employeeDict[\"John\" as NSString] = makeEmployee(realm, 30, \"B\", false)\n        company.employeeDict[\"Jill\" as NSString] = makeEmployee(realm, 40, \"C\", true)\n        realm.add(company)\n        try! realm.commitWriteTransaction()\n\n        let sortedByAge = company.employeeDict.sortedResults(usingKeyPath: \"age\", ascending: true)\n        let sortedByName = sortedByAge.sortedResults(usingKeyPath: \"name\", ascending: false)\n\n        XCTAssertEqual(Int32(20), sortedByAge[0].age)\n        XCTAssertEqual(Int32(40), sortedByName[0].age)\n    }\n}\n"
  },
  {
    "path": "Realm/Tests/Swift/SwiftRealmTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport Realm\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\n#endif\n\n@available(iOS 13.0, *) // For @MainActor\nclass SwiftRLMRealmTests: RLMTestCase {\n\n    // No models\n\n    func testRealmExists() {\n        let realm = realmWithTestPath()\n        XCTAssertNotNil(realm, \"realm should not be nil\");\n        XCTAssertTrue((realm as AnyObject) is RLMRealm, \"realm should be of class RLMRealm\")\n    }\n\n    func testEmptyWriteTransaction() {\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        try! realm.commitWriteTransaction()\n    }\n\n    // Swift models\n\n    func testRealmAddAndRemoveObjects() {\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        _ = SwiftRLMStringObject.create(in: realm, withValue: [\"a\"])\n        _ = SwiftRLMStringObject.create(in: realm, withValue: [\"b\"])\n        _ = SwiftRLMStringObject.create(in: realm, withValue: [\"c\"])\n        XCTAssertEqual(SwiftRLMStringObject.allObjects(in: realm).count, UInt(3), \"Expecting 3 objects\")\n        try! realm.commitWriteTransaction()\n\n        // test again after write transaction\n        var objects = SwiftRLMStringObject.allObjects(in: realm)\n        XCTAssertEqual(objects.count, UInt(3), \"Expecting 3 objects\")\n        XCTAssertEqual((objects[0] as! SwiftRLMStringObject).stringCol, \"a\", \"Expecting column to be 'a'\")\n\n        realm.beginWriteTransaction()\n        realm.delete(objects[2] as! SwiftRLMStringObject)\n        realm.delete(objects[0] as! SwiftRLMStringObject)\n        XCTAssertEqual(SwiftRLMStringObject.allObjects(in: realm).count, UInt(1), \"Expecting 1 object\")\n        try! realm.commitWriteTransaction()\n\n        objects = SwiftRLMStringObject.allObjects(in: realm)\n        XCTAssertEqual(objects.count, UInt(1), \"Expecting 1 object\")\n        XCTAssertEqual((objects[0] as! SwiftRLMStringObject).stringCol, \"b\", \"Expecting column to be 'b'\")\n    }\n\n    @MainActor\n    func testRealmIsUpdatedAfterBackgroundUpdate() {\n        let realm = realmWithTestPath()\n\n        // we have two notifications, one for opening the realm, and a second when performing our transaction\n        let notificationFired = expectation(description: \"notification fired\")\n        let token = realm.addNotificationBlock { note, realm in\n            XCTAssertNotNil(realm, \"Realm should not be nil\")\n            notificationFired.fulfill()\n        }\n\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchAsync {\n            let realm = unsafeSelf.realmWithTestPath()\n            realm.beginWriteTransaction()\n            _ = SwiftRLMStringObject.create(in: realm, withValue: [\"string\"])\n            try! realm.commitWriteTransaction()\n        }\n        waitForExpectations(timeout: 2.0, handler: nil)\n        token.invalidate()\n\n        // get object\n        let objects = SwiftRLMStringObject.allObjects(in: realm)\n        XCTAssertEqual(objects.count, UInt(1), \"There should be 1 object of type StringObject\")\n        XCTAssertEqual((objects[0] as! SwiftRLMStringObject).stringCol, \"string\", \"Value of first column should be 'string'\")\n    }\n\n    func testRealmIgnoresProperties() {\n        let realm = realmWithTestPath()\n\n        let object = SwiftRLMIgnoredPropertiesObject()\n        realm.beginWriteTransaction()\n        object.name = \"@fz\"\n        object.age = 31\n        realm.add(object)\n        try! realm.commitWriteTransaction()\n\n        // This shouldn't do anything.\n        realm.beginWriteTransaction()\n        object.runtimeProperty = NSObject()\n        try! realm.commitWriteTransaction()\n\n        let objects = SwiftRLMIgnoredPropertiesObject.allObjects(in: realm)\n        XCTAssertEqual(objects.count, UInt(1), \"There should be 1 object of type SwiftRLMIgnoredPropertiesObject\")\n        let retrievedObject = objects[0] as! SwiftRLMIgnoredPropertiesObject\n        XCTAssertNil(retrievedObject.runtimeProperty, \"Ignored property should be nil\")\n        XCTAssertEqual(retrievedObject.name, \"@fz\", \"Value of the name column doesn't match the assigned one.\")\n        XCTAssertEqual(retrievedObject.objectSchema.properties.count, 2, \"Only 'name' and 'age' properties should be detected by Realm\")\n    }\n\n    @MainActor\n    func testUpdatingSortedArrayAfterBackgroundUpdate() {\n        let realm = realmWithTestPath()\n        let objs = SwiftRLMIntObject.allObjects(in: realm)\n        let objects = SwiftRLMIntObject.allObjects(in: realm).sortedResults(usingKeyPath: \"intCol\", ascending: true)\n        let updateComplete = expectation(description: \"background update complete\")\n\n        let token = realm.addNotificationBlock() { (_, _) in\n            XCTAssertEqual(objs.count, UInt(2))\n            XCTAssertEqual(objs.sortedResults(usingKeyPath: \"intCol\", ascending: true).count, UInt(2))\n            XCTAssertEqual(objects.count, UInt(2))\n            updateComplete.fulfill()\n        }\n\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchAsync {\n            let realm = unsafeSelf.realmWithTestPath()\n            try! realm.transaction {\n                var obj = SwiftRLMIntObject()\n                obj.intCol = 2;\n                realm.add(obj)\n\n                obj = SwiftRLMIntObject()\n                obj.intCol = 1;\n                realm.add(obj)\n            }\n        }\n\n        waitForExpectations(timeout: 2.0, handler: nil)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testRealmIsUpdatedImmediatelyAfterBackgroundUpdate() {\n        let realm = realmWithTestPath()\n\n        let notificationFired = expectation(description: \"notification fired\")\n        let token = realm.addNotificationBlock { note, realm in\n            XCTAssertNotNil(realm, \"Realm should not be nil\")\n            notificationFired.fulfill()\n        }\n\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchAsync {\n            let realm = unsafeSelf.realmWithTestPath()\n            let obj = SwiftRLMStringObject(value: [\"string\"])\n            realm.beginWriteTransaction()\n            realm.add(obj)\n            try! realm.commitWriteTransaction()\n\n            let objects = SwiftRLMStringObject.allObjects(in: realm)\n            XCTAssertEqual(objects.count, UInt(1))\n            XCTAssertEqual((objects[0] as! SwiftRLMStringObject).stringCol, \"string\")\n        }\n\n        waitForExpectations(timeout: 2.0, handler: nil)\n        token.invalidate()\n\n        // get object\n        let objects = SwiftRLMStringObject.allObjects(in: realm)\n        XCTAssertEqual(objects.count, UInt(1))\n        XCTAssertEqual((objects[0] as! SwiftRLMStringObject).stringCol, \"string\")\n    }\n\n    // Objective-C models\n\n    func testRealmAddAndRemoveObjects_objc() {\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        _ = StringObject.create(in: realm, withValue: [\"a\"])\n        _ = StringObject.create(in: realm, withValue: [\"b\"])\n        _ = StringObject.create(in: realm, withValue: [\"c\"])\n        XCTAssertEqual(StringObject.allObjects(in: realm).count, UInt(3), \"Expecting 3 objects\")\n        try! realm.commitWriteTransaction()\n\n        // test again after write transaction\n        var objects = StringObject.allObjects(in: realm)\n        XCTAssertEqual(objects.count, UInt(3), \"Expecting 3 objects\")\n        XCTAssertEqual((objects[0] as! StringObject).stringCol!, \"a\", \"Expecting column to be 'a'\")\n\n        realm.beginWriteTransaction()\n        realm.delete(objects[2] as! StringObject)\n        realm.delete(objects[0] as! StringObject)\n        XCTAssertEqual(StringObject.allObjects(in: realm).count, UInt(1), \"Expecting 1 object\")\n        try! realm.commitWriteTransaction()\n\n        objects = StringObject.allObjects(in: realm)\n        XCTAssertEqual(objects.count, UInt(1), \"Expecting 1 object\")\n        XCTAssertEqual((objects[0] as! StringObject).stringCol!, \"b\", \"Expecting column to be 'b'\")\n    }\n\n    @MainActor\n    func testRealmIsUpdatedAfterBackgroundUpdate_objc() {\n        let realm = realmWithTestPath()\n\n        // we have two notifications, one for opening the realm, and a second when performing our transaction\n        let notificationFired = expectation(description: \"notification fired\")\n        let token = realm.addNotificationBlock { note, realm in\n            XCTAssertNotNil(realm, \"Realm should not be nil\")\n            if note == RLMNotification.DidChange {\n                notificationFired.fulfill()\n            }\n        }\n\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchAsync {\n            let realm = unsafeSelf.realmWithTestPath()\n            realm.beginWriteTransaction()\n            _ = StringObject.create(in: realm, withValue: [\"string\"])\n            try! realm.commitWriteTransaction()\n        }\n        waitForExpectations(timeout: 2.0, handler: nil)\n        token.invalidate()\n\n        // get object\n        let objects = StringObject.allObjects(in: realm)\n        XCTAssertEqual(objects.count, UInt(1), \"There should be 1 object of type StringObject\")\n        XCTAssertEqual((objects[0] as! StringObject).stringCol!, \"string\", \"Value of first column should be 'string'\")\n    }\n\n    @MainActor\n    func testRealmIsUpdatedImmediatelyAfterBackgroundUpdate_objc() {\n        let realm = realmWithTestPath()\n\n        // we have two notifications, one for opening the realm, and a second when performing our transaction\n        let notificationFired = expectation(description: \"notification fired\")\n        let token = realm.addNotificationBlock { note, realm in\n            XCTAssertNotNil(realm, \"Realm should not be nil\")\n            notificationFired.fulfill()\n        }\n\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchAsync {\n            let realm = unsafeSelf.realmWithTestPath()\n            let obj = StringObject(value: [\"string\"])\n            try! realm.transaction {\n                realm.add(obj)\n            }\n\n            let objects = StringObject.allObjects(in: realm)\n            XCTAssertEqual(objects.count, UInt(1), \"There should be 1 object of type StringObject\")\n            XCTAssertEqual((objects[0] as! StringObject).stringCol!, \"string\", \"Value of first column should be 'string'\")\n        }\n\n        waitForExpectations(timeout: 2.0, handler: nil)\n        token.invalidate()\n\n        // get object\n        let objects = StringObject.allObjects(in: realm)\n        XCTAssertEqual(objects.count, UInt(1), \"There should be 1 object of type RLMTestObject\")\n        XCTAssertEqual((objects[0] as! StringObject).stringCol!, \"string\", \"Value of first column should be 'string'\")\n    }\n}\n"
  },
  {
    "path": "Realm/Tests/Swift/SwiftSchemaTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport Realm\nimport Realm.Private\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\n#endif\n\n#if os(macOS)\n\nclass InitLinkedToClass: RLMObject {\n    @objc dynamic var value: SwiftRLMIntObject! = SwiftRLMIntObject(value: [0])\n}\n\nclass SwiftRLMNonDefaultObject: RLMObject {\n    @objc dynamic var value = 0\n    public override class func shouldIncludeInDefaultSchema() -> Bool {\n        return false\n    }\n}\n\nclass SwiftRLMLinkedNonDefaultObject: RLMObject {\n    @objc dynamic var obj: SwiftRLMNonDefaultObject?\n    public override class func shouldIncludeInDefaultSchema() -> Bool {\n        return false\n    }\n}\n\nclass SwiftRLMNonDefaultArrayObject: RLMObject {\n    @objc dynamic var array = RLMArray<SwiftRLMNonDefaultObject>(objectClassName: SwiftRLMNonDefaultObject.className())\n    public override class func shouldIncludeInDefaultSchema() -> Bool {\n        return false\n    }\n}\n\nclass SwiftRLMNonDefaultSetObject: RLMObject {\n    @objc dynamic var set = RLMSet<SwiftRLMNonDefaultObject>(objectClassName: SwiftRLMNonDefaultObject.className())\n    public override class func shouldIncludeInDefaultSchema() -> Bool {\n        return false\n    }\n}\n\nclass SwiftRLMNonDefaultDictionaryObject: RLMObject {\n    @objc dynamic var dictionary = RLMDictionary<NSString, SwiftRLMNonDefaultObject>(objectClassName: SwiftRLMNonDefaultObject.className(), keyType: .string)\n    public override class func shouldIncludeInDefaultSchema() -> Bool {\n        return false\n    }\n}\n\nclass SwiftRLMMutualLink1Object: RLMObject {\n    @objc dynamic var object: SwiftRLMMutualLink2Object?\n    public override class func shouldIncludeInDefaultSchema() -> Bool {\n        return false\n    }\n}\n\nclass SwiftRLMMutualLink2Object: RLMObject {\n    @objc dynamic var object: SwiftRLMMutualLink1Object?\n    public override class func shouldIncludeInDefaultSchema() -> Bool {\n        return false\n    }\n}\n\nclass IgnoredLinkPropertyObject : RLMObject {\n    @objc dynamic var value = 0\n    var obj = SwiftRLMIntObject()\n\n    override class func ignoredProperties() -> [String] {\n        return [\"obj\"]\n    }\n}\n\n@MainActor\nclass SwiftRLMRecursingSchemaTestObject : RLMObject {\n    @objc dynamic var propertyWithIllegalDefaultValue: SwiftRLMIntObject? = {\n        if mayAccessSchema {\n            let realm = RLMRealm.default()\n            return SwiftRLMIntObject.allObjects().firstObject() as! SwiftRLMIntObject?\n        }\n        return nil\n    }()\n\n    static var mayAccessSchema = false\n}\n\nclass InvalidArrayType: FakeObject {\n    @objc dynamic var array = RLMArray<SwiftRLMIntObject>(objectClassName: \"invalid class\")\n}\n\nclass InvalidSetType: FakeObject {\n    @objc dynamic var set = RLMSet<SwiftRLMIntObject>(objectClassName: \"invalid class\")\n}\n\nclass InvalidDictionaryType: FakeObject {\n    @objc dynamic var dictionary = RLMDictionary<NSString, SwiftRLMIntObject>(objectClassName: \"invalid class\", keyType: .string)\n}\n\n@MainActor\nclass InitAppendsToArrayProperty : RLMObject {\n    @objc dynamic var propertyWithIllegalDefaultValue: RLMArray<InitAppendsToArrayProperty> = {\n        if mayAppend {\n            mayAppend = false\n            let array = RLMArray<InitAppendsToArrayProperty>(objectClassName: InitAppendsToArrayProperty.className())\n            array.add(InitAppendsToArrayProperty())\n            return array\n        }\n        return RLMArray<InitAppendsToArrayProperty>(objectClassName: InitAppendsToArrayProperty.className())\n    }()\n\n    static var mayAppend = false\n}\n\nclass NoProps: FakeObject {\n    // no @objc properties\n}\n\nclass OnlyComputedSource: RLMObject {\n    @objc dynamic var link: OnlyComputedTarget?\n}\n\nclass OnlyComputedTarget: RLMObject {\n    @objc dynamic var backlinks: RLMLinkingObjects<OnlyComputedSource>?\n\n    override class func linkingObjectsProperties() -> [String : RLMPropertyDescriptor] {\n        return [\"backlinks\": RLMPropertyDescriptor(with: OnlyComputedSource.self, propertyName: \"link\")]\n    }\n}\n\nclass OnlyComputedNoBacklinksProps: FakeObject {\n    var computedProperty: String {\n        return \"Test_String\"\n    }\n}\n\nclass RequiresObjcName: RLMObject {\n#if compiler(>=5.10)\n    nonisolated(unsafe) static var enable = false\n#else\n    static var enable = false\n#endif\n    override class func _realmIgnoreClass() -> Bool {\n        return !enable\n    }\n}\n\nclass ClassWrappingObjectSubclass {\n    class Inner: RequiresObjcName {\n        @objc dynamic var value = 0\n    }\n}\nstruct StructWrappingObjectSubclass {\n    class Inner: RequiresObjcName {\n        @objc dynamic var value = 0\n    }\n}\nenum EnumWrappingObjectSubclass {\n    class Inner: RequiresObjcName {\n        @objc dynamic var value = 0\n    }\n}\n\nprivate class PrivateClassWithoutExplicitObjcName: RequiresObjcName {\n    @objc dynamic var value = 0\n}\n\nclass SwiftRLMSchemaTests: RLMMultiProcessTestCase {\n    func testWorksAtAll() {\n        if isParent {\n            XCTAssertEqual(0, runChildAndWait(), \"Tests in child process failed\")\n        }\n    }\n\n    func testShouldRaiseObjectWithoutProperties() {\n        assertThrowsWithReasonMatching(RLMObjectSchema(forObjectClass: NoProps.self),\n                                       \"No properties are defined for 'NoProps'. Did you remember to mark them with '@objc' or '@Persisted' in your model?\")\n    }\n    \n    func testShouldNotThrowForObjectWithOnlyBacklinksProps() {\n        let config = RLMRealmConfiguration.default()\n        config.objectClasses = [OnlyComputedTarget.self, OnlyComputedSource.self]\n        config.inMemoryIdentifier = #function\n        let r = try! RLMRealm(configuration: config)\n        try! r.transaction {\n            _ = OnlyComputedTarget.create(in: r, withValue: [])\n        }\n\n        let schema = OnlyComputedTarget().objectSchema\n        XCTAssertEqual(schema.computedProperties.count, 1)\n        XCTAssertEqual(schema.properties.count, 0)\n    }\n\n    func testShouldThrowForObjectWithOnlyComputedNoBacklinksProps() {\n        assertThrowsWithReasonMatching(RLMObjectSchema(forObjectClass: OnlyComputedNoBacklinksProps.self),\n                                       \"No properties are defined for 'OnlyComputedNoBacklinksProps'. Did you remember to mark them with '@objc' or '@Persisted' in your model?\")\n    }\n\n    func testSchemaInitWithLinkedToObjectUsingInitWithValue() {\n        if isParent {\n            XCTAssertEqual(0, runChildAndWait(), \"Tests in child process failed\")\n            return\n        }\n\n        let config = RLMRealmConfiguration.default()\n        config.objectClasses = [IgnoredLinkPropertyObject.self]\n        config.inMemoryIdentifier = #function\n        let r = try! RLMRealm(configuration: config)\n        try! r.transaction {\n            _ = IgnoredLinkPropertyObject.create(in: r, withValue: [1])\n        }\n    }\n\n    func testCreateUnmanagedObjectWithUninitializedSchema() {\n        if isParent {\n            XCTAssertEqual(0, runChildAndWait(), \"Tests in child process failed\")\n            return\n        }\n\n        // Object in default schema\n        _ = SwiftRLMIntObject()\n        // Object not in default schema\n        _ = SwiftRLMNonDefaultObject()\n    }\n\n    func testCreateUnmanagedObjectWithNestedObjectWithUninitializedSchema() {\n        if isParent {\n            XCTAssertEqual(0, runChildAndWait(), \"Tests in child process failed\")\n            return\n        }\n\n        // Objects in default schema\n\n        // Should not throw (or crash) despite creating an object with an\n        // uninitialized schema during schema init\n        _ = InitLinkedToClass()\n        // Again with an object that links to an uninitialized type\n        // rather than creating one\n        _ = SwiftRLMCompanyObject()\n\n        // Objects not in default schema\n        _ = SwiftRLMLinkedNonDefaultObject(value: [[1]])\n        _ = SwiftRLMNonDefaultArrayObject(value: [[[1]]])\n        _ = SwiftRLMNonDefaultSetObject(value: [[[1]]])\n        _ = SwiftRLMMutualLink1Object()\n    }\n\n    func testCreateUnmanagedObjectWhichCreatesAnotherClassViaInitWithValueDuringSchemaInit() {\n        if isParent {\n            XCTAssertEqual(0, runChildAndWait(), \"Tests in child process failed\")\n            return\n        }\n\n        _ = InitLinkedToClass(value: [[0]])\n        _ = SwiftRLMCompanyObject(value: [[[\"Jaden\", 20, false] as [Any]]])\n    }\n\n    func testInitUnmanagedObjectNotInClassSubsetDuringSchemaInit() {\n        if isParent {\n            XCTAssertEqual(0, runChildAndWait(), \"Tests in child process failed\")\n            return\n        }\n\n        let config = RLMRealmConfiguration.default()\n        config.objectClasses = [IgnoredLinkPropertyObject.self]\n        config.inMemoryIdentifier = #function\n        _ = try! RLMRealm(configuration: config)\n        let r = try! RLMRealm(configuration: RLMRealmConfiguration.default())\n        try! r.transaction {\n            _ = IgnoredLinkPropertyObject.create(in: r, withValue: [1])\n        }\n    }\n\n    @MainActor\n    func testPreventsDeadLocks() {\n        if isParent {\n            XCTAssertEqual(0, runChildAndWait(), \"Tests in child process failed\")\n            return\n        }\n\n        SwiftRLMRecursingSchemaTestObject.mayAccessSchema = true\n        assertThrowsWithReasonMatching(RLMSchema.shared(), \".*recursive.*\")\n    }\n\n    @MainActor\n    func testAccessSchemaCreatesObjectWhichAttempsInsertionsToArrayProperty() {\n        if isParent {\n            XCTAssertEqual(0, runChildAndWait(), \"Tests in child process failed\")\n            return\n        }\n\n        // This is different from the above tests in that it is a to-many link\n        // and it only occurs while the schema is initializing\n        InitAppendsToArrayProperty.mayAppend = true\n        assertThrowsWithReasonMatching(RLMSchema.shared(),\n                                       \".*Object cannot be inserted unless the schema is initialized.*\")\n    }\n\n    func testInvalidObjectTypeForRLMArray() {\n        assertThrowsWithReasonMatching(RLMObjectSchema(forObjectClass: InvalidArrayType.self),\n                                       \"RLMArray\\\\<invalid class\\\\>\")\n    }\n\n    @MainActor\n    func testInvalidNestedClass() {\n        if isParent {\n            XCTAssertEqual(0, runChildAndWait(), \"Tests in child process failed\")\n            return\n        }\n\n        RequiresObjcName.enable = true\n        assertThrowsWithReasonMatching(RLMSchema.sharedSchema(for: ClassWrappingObjectSubclass.Inner.self),\n                                       \"Object subclass '.*' must explicitly set the class's objective-c name with @objc\\\\(ClassName\\\\) because it is not a top-level public class.\")\n        assertThrowsWithReasonMatching(RLMSchema.sharedSchema(for: StructWrappingObjectSubclass.Inner.self),\n                                       \"Object subclass '.*' must explicitly set the class's objective-c name with @objc\\\\(ClassName\\\\) because it is not a top-level public class.\")\n        assertThrowsWithReasonMatching(RLMSchema.sharedSchema(for: EnumWrappingObjectSubclass.Inner.self),\n                                       \"Object subclass '.*' must explicitly set the class's objective-c name with @objc\\\\(ClassName\\\\) because it is not a top-level public class.\")\n        assertThrowsWithReasonMatching(RLMSchema.sharedSchema(for: PrivateClassWithoutExplicitObjcName.self),\n                                               \"Object subclass '.*' must explicitly set the class's objective-c name with @objc\\\\(ClassName\\\\) because it is not a top-level public class.\")\n    }\n}\n\n#endif\n"
  },
  {
    "path": "Realm/Tests/Swift/SwiftSetPropertyTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport Realm\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\n#endif\n\nclass SwiftRLMSetPropertyTests: RLMTestCase {\n\n    // Swift models\n\n    func testBasicSet() {\n        let string = SwiftRLMStringObject()\n        string.stringCol = \"string\"\n\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        realm.add(string)\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(SwiftRLMStringObject.allObjects(in: realm).count, UInt(1), \"There should be a single SwiftRLMStringObject in the realm\")\n\n        let set = SwiftRLMSetPropertyObject()\n        set.name = \"setObject\"\n        set.set.add(string)\n        XCTAssertEqual(set.set.count, UInt(1))\n        XCTAssertEqual(set.set.allObjects[0].stringCol, \"string\")\n\n        realm.beginWriteTransaction()\n        realm.add(set)\n        set.set.add(string)\n        try! realm.commitWriteTransaction()\n\n        let setObjects = SwiftRLMSetPropertyObject.allObjects(in: realm) as! RLMResults<SwiftRLMSetPropertyObject>\n\n        XCTAssertEqual(setObjects.count, UInt(1), \"There should be a single SwiftRLMStringObject in the realm\")\n        let cmp = setObjects[0].set.allObjects[0]\n        XCTAssertTrue(string.isEqual(to: cmp), \"First array object should be the string object we added\")\n    }\n\n    func testPopulateEmptySet() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n        let set = SwiftRLMSetPropertyObject.create(in: realm, withValue: [\"setObject\"])\n        XCTAssertNotNil(set.set, \"Should be able to get an empty set\")\n        XCTAssertEqual(set.set.count, UInt(0), \"Should start with no set elements\")\n\n        let obj = SwiftRLMStringObject()\n        obj.stringCol = \"a\"\n        set.set.add(obj)\n        set.set.add(SwiftRLMStringObject.create(in: realm, withValue: [\"b\"]))\n        set.set.add(obj)\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(set.set.count, UInt(2), \"Should have two elements in array\")\n        var count = 0\n        set.set.forEach {\n            guard let o = $0 as? SwiftRLMStringObject else {\n                return XCTFail(\"expected SwiftRLMStringObject\")\n            }\n            XCTAssertTrue((o.stringCol.contains(\"a\") || o.stringCol.contains(\"b\")))\n            count+=1\n        }\n        XCTAssertEqual(count, 2, \"Loop should run 3 times\")\n\n        for obj in set.set {\n            XCTAssertFalse(obj.description.isEmpty, \"Object should have description\")\n        }\n    }\n\n    func testModifyDetatchedSet() {\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        let setObj = SwiftRLMSetPropertyObject.create(in: realm, withValue: [\"setObject\"])\n        XCTAssertNotNil(setObj.set, \"Should be able to get an empty set\")\n        XCTAssertEqual(setObj.set.count, UInt(0), \"Should start with no set elements\")\n\n        let obj = SwiftRLMStringObject()\n        obj.stringCol = \"a\"\n        let set = setObj.set\n        set.add(obj)\n        set.add(SwiftRLMStringObject.create(in: realm, withValue: [\"b\"]))\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(set.count, UInt(2), \"Should have two elements in set\")\n        var count = 0\n        set.forEach {\n            guard let o = $0 as? SwiftRLMStringObject else {\n                return XCTFail(\"expected SwiftRLMStringObject\")\n            }\n            XCTAssertTrue((o.stringCol.contains(\"a\") || o.stringCol.contains(\"b\")))\n            count+=1\n        }\n        XCTAssertEqual(count, 2, \"Loop should run twice\")\n    }\n\n    func testInsertMultiple() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n\n        let obj = SwiftRLMSetPropertyObject.create(in: realm, withValue: [\"setObject\"])\n        let child1 = SwiftRLMStringObject.create(in: realm, withValue: [\"a\"])\n        let child2 = SwiftRLMStringObject()\n        child2.stringCol = \"b\"\n        obj.set.addObjects([child2, child1] as NSArray)\n        try! realm.commitWriteTransaction()\n\n        let children = SwiftRLMStringObject.allObjects(in: realm)\n        XCTAssertEqual((children[0] as! SwiftRLMStringObject).stringCol, \"a\", \"First child should be 'a'\")\n        XCTAssertEqual((children[1] as! SwiftRLMStringObject).stringCol, \"b\", \"Second child should be 'b'\")\n    }\n\n    func testUnmanaged() {\n        let realm = realmWithTestPath()\n\n        let set = SwiftRLMSetPropertyObject()\n        set.name = \"name\"\n        XCTAssertNotNil(set.set, \"RLMSet property should get created on access\")\n\n        let obj = SwiftRLMStringObject()\n        obj.stringCol = \"a\"\n        set.set.add(obj)\n        set.set.add(obj)\n\n        realm.beginWriteTransaction()\n        realm.add(set)\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(set.set.count, UInt(1), \"Should have one element in set\")\n        var count = 0\n        set.set.forEach {\n            guard let o = $0 as? SwiftRLMStringObject else {\n                return XCTFail(\"expected SwiftRLMStringObject\")\n            }\n            XCTAssertTrue((o.stringCol.contains(\"a\") || o.stringCol.contains(\"b\")))\n            count+=1\n        }\n        XCTAssertEqual(count, 1, \"Loop should run once\")\n    }\n\n    // Objective-C models\n\n    func testBasicSet_objc() {\n        let string = StringObject()\n        string.stringCol = \"string\"\n\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        realm.add(string)\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(StringObject.allObjects(in: realm).count, UInt(1), \"There should be a single StringObject in the realm\")\n\n        let set = SetPropertyObject()\n        set.name = \"arrayObject\"\n        set.set.add(string)\n\n        realm.beginWriteTransaction()\n        realm.add(set)\n        try! realm.commitWriteTransaction()\n\n        let setObjects = SetPropertyObject.allObjects(in: realm)\n\n        XCTAssertEqual(setObjects.count, UInt(1), \"There should be a single StringObject in the realm\")\n        let cmp = (setObjects.firstObject() as! SetPropertyObject).set.allObjects[0]\n        XCTAssertTrue(string.isEqual(to: cmp), \"First set object should be the string object we added\")\n    }\n\n    func testPopulateEmptySet_objc() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n        let set = SetPropertyObject.create(in: realm, withValue: [\"setObject\"])\n        XCTAssertNotNil(set.set, \"Should be able to get an empty set\")\n        XCTAssertEqual(set.set.count, UInt(0), \"Should start with no set elements\")\n\n        let obj = StringObject()\n        obj.stringCol = \"a\"\n        set.set.add(obj)\n        set.set.add(StringObject.create(in: realm, withValue: [\"b\"]))\n        set.set.add(obj)\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(set.set.count, UInt(2), \"Should have two elements in set\")\n        var count = 0\n        (set.set as RLMSet<StringObject>).forEach {\n            guard let o = $0 as? StringObject else {\n                return XCTFail(\"expected StringObject\")\n            }\n            XCTAssertTrue((o.stringCol.contains(\"a\") || o.stringCol.contains(\"b\")))\n            count+=1\n        }\n        XCTAssertEqual(count, 2, \"Loop should run 2 times\")\n        set.set.allObjects.forEach { (o) in\n            XCTAssertFalse(o.description.isEmpty, \"Object should have description\")\n        }\n    }\n\n    func testModifyDetatchedSet_objc() {\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        let setObj = SetPropertyObject.create(in: realm, withValue: [\"setObject\"])\n        XCTAssertNotNil(setObj.set, \"Should be able to get an empty set\")\n        XCTAssertEqual(setObj.set.count, UInt(0), \"Should start with no set elements\")\n\n        let obj = StringObject()\n        obj.stringCol = \"a\"\n        let set = setObj.set!\n        set.add(obj)\n        set.add(StringObject.create(in: realm, withValue: [\"b\"]))\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(set.count, UInt(2), \"Should have two elements in set\")\n        var count = 0\n        (set as RLMSet<StringObject>).forEach {\n            guard let o = $0 as? StringObject else {\n                return XCTFail(\"expected StringObject\")\n            }\n            XCTAssertTrue((o.stringCol.contains(\"a\") || o.stringCol.contains(\"b\")))\n            count+=1\n        }\n        XCTAssertEqual(count, 2, \"Loop should run twice\")\n    }\n\n    func testInsertMultiple_objc() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n\n        let obj = SetPropertyObject.create(in: realm, withValue: [\"setObject\"])\n        let child1 = StringObject.create(in: realm, withValue: [\"a\"])\n        let child2 = StringObject()\n        child2.stringCol = \"b\"\n        obj.set.addObjects([child2, child1] as NSArray)\n        try! realm.commitWriteTransaction()\n\n        let children = StringObject.allObjects(in: realm)\n        XCTAssertEqual((children[0] as! StringObject).stringCol!, \"a\", \"First child should be 'a'\")\n        XCTAssertEqual((children[1] as! StringObject).stringCol!, \"b\", \"Second child should be 'b'\")\n    }\n\n    func testUnmanaged_objc() {\n        let realm = realmWithTestPath()\n\n        let set = SetPropertyObject()\n        set.name = \"name\"\n        XCTAssertNotNil(set.set, \"RLMSet property should get created on access\")\n\n        let obj = StringObject()\n        obj.stringCol = \"a\"\n        set.set.add(obj)\n        set.set.add(obj)\n\n        realm.beginWriteTransaction()\n        realm.add(set)\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(set.set.count, UInt(1), \"Should have one element in set\")\n        var count = 0\n        (set.set as RLMSet<StringObject>).forEach {\n            guard let o = $0 as? StringObject else {\n                return XCTFail(\"expected SwiftRLMStringObject\")\n            }\n            XCTAssertTrue(o.stringCol.contains(\"a\"))\n            count+=1\n        }\n        XCTAssertEqual(count, 1, \"Loop should run once\")\n    }\n}\n"
  },
  {
    "path": "Realm/Tests/Swift/SwiftSetTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\nimport XCTest\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\n#endif\n\nclass SwiftRLMSetTests: RLMTestCase {\n\n    // Swift models\n\n    func testDeleteLinksAndObjectsInSet() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n\n        let po1 = SwiftRLMEmployeeObject()\n        po1.age = 40\n        po1.name = \"Joe\"\n        po1.hired = true\n\n        let po2 = SwiftRLMEmployeeObject()\n        po2.age = 30\n        po2.name = \"John\"\n        po2.hired = false\n\n        let po3 = SwiftRLMEmployeeObject()\n        po3.age = 25\n        po3.name = \"Jill\"\n        po3.hired = true\n\n        realm.add(po1)\n        realm.add(po2)\n        realm.add(po3)\n\n        let company = SwiftRLMCompanyObject()\n        realm.add(company)\n        company.employeeSet.addObjects(SwiftRLMEmployeeObject.allObjects(in: realm))\n\n        try! realm.commitWriteTransaction()\n\n        let peopleInCompany = company.employeeSet\n        XCTAssertEqual(peopleInCompany.count, UInt(3), \"No links should have been deleted\")\n\n        realm.beginWriteTransaction()\n        peopleInCompany.remove(po2) // Should delete link to employee\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(peopleInCompany.count, UInt(2), \"link deleted when accessing via links\")\n\n        let test = peopleInCompany.allObjects[0]\n        XCTAssertTrue(((test.age == po1.age) || (test.age == po3.age)), \"Should be equal\")\n        XCTAssertEqual(test.name, po1.name, \"Should be equal\")\n        XCTAssertEqual(test.hired, po1.hired, \"Should be equal\")\n\n        realm.beginWriteTransaction()\n        peopleInCompany.remove(po1)\n        XCTAssertEqual(peopleInCompany.count, UInt(1), \"1 remaining link\")\n        peopleInCompany.add(po1)\n        XCTAssertEqual(peopleInCompany.count, UInt(2), \"2 links\")\n        peopleInCompany.removeAllObjects()\n        XCTAssertEqual(peopleInCompany.count, UInt(0), \"0 remaining links\")\n        try! realm.commitWriteTransaction()\n    }\n\n    // Objective-C models\n\n    func testFastEnumeration_objc() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n\n        let po1 = SwiftRLMEmployeeObject()\n        po1.age = 40\n        po1.name = \"Joe\"\n        po1.hired = true\n\n        let po2 = SwiftRLMEmployeeObject()\n        po2.age = 30\n        po2.name = \"John\"\n        po2.hired = false\n\n        let po3 = SwiftRLMEmployeeObject()\n        po3.age = 25\n        po3.name = \"Jill\"\n        po3.hired = true\n\n        realm.add(po1)\n        realm.add(po2)\n        realm.add(po3)\n\n        let company = SwiftRLMCompanyObject()\n        realm.add(company)\n        company.employeeSet.addObjects(SwiftRLMEmployeeObject.allObjects(in: realm))\n\n        try! realm.commitWriteTransaction()\n        XCTAssertEqual(company.employeeSet.count, UInt(3), \"3 objects added\")\n\n        var totalSum: Int = 0\n\n        for obj in company.employeeSet {\n            if let ao = obj as? SwiftRLMEmployeeObject {\n                totalSum += ao.age\n            }\n        }\n\n        XCTAssertEqual(totalSum, 95, \"total sum should be 95\")\n    }\n\n    func testObjectAggregate_objc() {\n        let dateMinInput = Date()\n        let dateMaxInput = dateMinInput.addingTimeInterval(1000)\n\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n        let aggSet = SwiftRLMAggregateSet()\n\n        aggSet.set.add(SwiftRLMAggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput]))\n        aggSet.set.add(SwiftRLMAggregateObject.create(in: realm, withValue: [10, 0 as Float, 2.5 as Double, false, dateMaxInput]))\n        aggSet.set.add(SwiftRLMAggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput]))\n        aggSet.set.add(SwiftRLMAggregateObject.create(in: realm, withValue: [10, 0 as Float, 2.5 as Double, false, dateMaxInput]))\n        aggSet.set.add(SwiftRLMAggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput]))\n        aggSet.set.add(SwiftRLMAggregateObject.create(in: realm, withValue: [10, 0 as Float, 2.5 as Double, false, dateMaxInput]))\n        aggSet.set.add(SwiftRLMAggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput]))\n        aggSet.set.add(SwiftRLMAggregateObject.create(in: realm, withValue: [10, 0 as Float, 2.5 as Double, false, dateMaxInput]))\n        aggSet.set.add(SwiftRLMAggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput]))\n        aggSet.set.add(SwiftRLMAggregateObject.create(in: realm, withValue: [10, 1.2 as Float, 0 as Double, true, dateMinInput]))\n\n        realm.add(aggSet)\n\n        try! realm.commitWriteTransaction()\n\n        let noArray = SwiftRLMAggregateObject.objects(in: realm, where: \"boolCol == NO\")\n        let yesArray = SwiftRLMAggregateObject.objects(in: realm, where: \"boolCol == YES\")\n\n        // SUM ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int sum\n        XCTAssertEqual(noArray.sum(ofProperty: \"intCol\").intValue, 40, \"Sum should be 40\")\n        XCTAssertEqual(yesArray.sum(ofProperty: \"intCol\").intValue, 60, \"Sum should be 60\")\n\n        // Test float sum\n        XCTAssertEqual(noArray.sum(ofProperty: \"floatCol\").floatValue, Float(0.0), accuracy: 0.1, \"Sum should be 0.0\")\n        XCTAssertEqual(yesArray.sum(ofProperty: \"floatCol\").floatValue, Float(7.2), accuracy: 0.1, \"Sum should be 7.2\")\n\n        // Test double sum\n        XCTAssertEqual(noArray.sum(ofProperty: \"doubleCol\").doubleValue, Double(10.0), accuracy: 0.1, \"Sum should be 10.0\")\n        XCTAssertEqual(yesArray.sum(ofProperty: \"doubleCol\").doubleValue, Double(0.0), accuracy: 0.1, \"Sum should be 0.0\")\n\n        // Average ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int average\n        XCTAssertEqual(noArray.average(ofProperty: \"intCol\")!.doubleValue, Double(10.0), accuracy: 0.1, \"Average should be 10.0\")\n        XCTAssertEqual(yesArray.average(ofProperty: \"intCol\")!.doubleValue, Double(10.0), accuracy: 0.1, \"Average should be 10.0\")\n\n        // Test float average\n        XCTAssertEqual(noArray.average(ofProperty: \"floatCol\")!.doubleValue, Double(0.0), accuracy: 0.1, \"Average should be 0.0\")\n        XCTAssertEqual(yesArray.average(ofProperty: \"floatCol\")!.doubleValue, Double(1.2), accuracy: 0.1, \"Average should be 1.2\")\n\n        // Test double average\n        XCTAssertEqual(noArray.average(ofProperty: \"doubleCol\")!.doubleValue, Double(2.5), accuracy: 0.1, \"Average should be 2.5\")\n        XCTAssertEqual(yesArray.average(ofProperty: \"doubleCol\")!.doubleValue, Double(0.0), accuracy: 0.1, \"Average should be 2.5\")\n\n        // MIN ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int min\n        var min = noArray.min(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(min.int32Value, Int32(10), \"Minimum should be 10\")\n        min = yesArray.min(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(min.int32Value, Int32(10), \"Minimum should be 10\")\n\n        // Test float min\n        min = noArray.min(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(min.floatValue, Float(0), accuracy: 0.1, \"Minimum should be 0.0f\")\n        min = yesArray.min(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(min.floatValue, Float(1.2), accuracy: 0.1, \"Minimum should be 1.2f\")\n\n        // Test double min\n        min = noArray.min(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(min.doubleValue, Double(2.5), accuracy: 0.1, \"Minimum should be 2.5\")\n        min = yesArray.min(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(min.doubleValue, Double(0.0), accuracy: 0.1, \"Minimum should be 0.0\")\n\n        // Test date min\n        var dateMinOutput = noArray.min(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMinOutput, dateMaxInput, \"Minimum should be dateMaxInput\")\n        dateMinOutput = yesArray.min(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMinOutput, dateMinInput, \"Minimum should be dateMinInput\")\n\n        // MAX ::::::::::::::::::::::::::::::::::::::::::::::\n        // Test int max\n        var max = noArray.max(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(max.intValue, 10, \"Maximum should be 10\")\n        max = yesArray.max(ofProperty: \"intCol\") as! NSNumber\n        XCTAssertEqual(max.intValue, 10, \"Maximum should be 10\")\n\n        // Test float max\n        max = noArray.max(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(max.floatValue, Float(0.0), accuracy: 0.1, \"Maximum should be 0.0f\")\n        max = yesArray.max(ofProperty: \"floatCol\") as! NSNumber\n        XCTAssertEqual(max.floatValue, Float(1.2), accuracy: 0.1, \"Maximum should be 1.2f\")\n\n        // Test double max\n        max = noArray.max(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(max.doubleValue, Double(2.5), accuracy: 0.1, \"Maximum should be 2.5\")\n        max = yesArray.max(ofProperty: \"doubleCol\") as! NSNumber\n        XCTAssertEqual(max.doubleValue, Double(0.0), accuracy: 0.1, \"Maximum should be 0.0\")\n\n        // Test date max\n        var dateMaxOutput = noArray.max(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMaxOutput, dateMaxInput, \"Maximum should be dateMaxInput\")\n        dateMaxOutput = yesArray.max(ofProperty: \"dateCol\") as! Date\n        XCTAssertEqual(dateMaxOutput, dateMinInput, \"Maximum should be dateMinInput\")\n    }\n\n    func testSetDescription_objc() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n\n        for _ in 0..<300 {\n            let po1 = SwiftRLMEmployeeObject()\n            po1.age = 40\n            po1.name = \"Joe\"\n            po1.hired = true\n\n            let po2 = SwiftRLMEmployeeObject()\n            po2.age = 30\n            po2.name = \"Mary\"\n            po2.hired = false\n\n            let po3 = SwiftRLMEmployeeObject()\n            po3.age = 24\n            po3.name = \"Jill\"\n            po3.hired = true\n\n            realm.add(po1)\n            realm.add(po2)\n            realm.add(po3)\n        }\n\n        let company = SwiftRLMCompanyObject()\n        realm.add(company)\n        company.employeeSet.addObjects(SwiftRLMEmployeeObject.allObjects(in: realm))\n\n        try! realm.commitWriteTransaction()\n\n        let description = company.employeeSet.description\n        XCTAssertTrue((description as NSString).range(of: \"name\").location != Foundation.NSNotFound, \"property names should be displayed when calling \\\"description\\\" on RLMSet\")\n        XCTAssertTrue((description as NSString).range(of: \"Mary\").location != Foundation.NSNotFound, \"property values should be displayed when calling \\\"description\\\" on RLMSet\")\n\n        XCTAssertTrue((description as NSString).range(of: \"age\").location != Foundation.NSNotFound, \"property names should be displayed when calling \\\"description\\\" on RLMSet\")\n        XCTAssertTrue((description as NSString).range(of: \"24\").location != Foundation.NSNotFound, \"property values should be displayed when calling \\\"description\\\" on RLMSet\")\n\n        XCTAssertTrue((description as NSString).range(of: \"800 objects skipped\").location != Foundation.NSNotFound, \"'800 objects skipped' should be displayed when calling \\\"description\\\" on RLMSet\")\n    }\n\n    func makeEmployee(_ realm: RLMRealm, _ age: Int32, _ name: String, _ hired: Bool) -> EmployeeObject {\n        let employee = EmployeeObject()\n        employee.age = age\n        employee.name = name\n        employee.hired = hired\n        realm.add(employee)\n        return employee\n    }\n\n    func testDeleteLinksAndObjectsInSet_objc() {\n        let realm = realmWithTestPath()\n\n        realm.beginWriteTransaction()\n\n        let po1 = makeEmployee(realm, 40, \"Joe\", true)\n        _ = makeEmployee(realm, 30, \"John\", false)\n        let po3 = makeEmployee(realm, 25, \"Jill\", true)\n\n        let company = CompanyObject()\n        company.name = \"name\"\n        realm.add(company)\n        company.employeeSet.addObjects(EmployeeObject.allObjects(in: realm))\n\n        try! realm.commitWriteTransaction()\n\n        let peopleInCompany: RLMSet<EmployeeObject> = company.employeeSet!\n        XCTAssertEqual(peopleInCompany.count, UInt(3), \"No links should have been deleted\")\n\n        realm.beginWriteTransaction()\n        peopleInCompany.remove(po3) // Should delete link to employee\n        try! realm.commitWriteTransaction()\n\n        XCTAssertEqual(peopleInCompany.count, UInt(2), \"link deleted when accessing via links\")\n\n        let test = peopleInCompany.allObjects[0]\n        XCTAssertEqual(test.age, po1.age, \"Should be equal\")\n        XCTAssertEqual(test.name!, po1.name!, \"Should be equal\")\n        XCTAssertEqual(test.hired, po1.hired, \"Should be equal\")\n\n        let allPeople = EmployeeObject.allObjects(in: realm)\n        XCTAssertEqual(allPeople.count, UInt(3), \"Only links should have been deleted, not the employees\")\n    }\n\n}\n"
  },
  {
    "path": "Realm/Tests/Swift/SwiftTestObjects.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Realm\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\n#endif\n\nclass SwiftRLMStringObject: RLMObject {\n    @objc dynamic var stringCol = \"\"\n}\n\nclass SwiftRLMBoolObject: RLMObject {\n    @objc dynamic var boolCol = false\n}\n\nclass SwiftRLMIntObject: RLMObject {\n    @objc dynamic var intCol = 0\n}\n\nclass SwiftRLMLongObject: RLMObject {\n    @objc dynamic var longCol: Int64 = 0\n}\n\nclass SwiftRLMObject: RLMObject {\n    @objc dynamic var boolCol = false\n    @objc dynamic var intCol = 123\n    @objc dynamic var floatCol = 1.23 as Float\n    @objc dynamic var doubleCol = 12.3\n    @objc dynamic var stringCol = \"a\"\n    @objc dynamic var binaryCol = \"a\".data(using: String.Encoding.utf8)\n    @objc dynamic var dateCol = Date(timeIntervalSince1970: 1)\n    @objc dynamic var objectCol = SwiftRLMBoolObject()\n    @objc dynamic var arrayCol = RLMArray<SwiftRLMBoolObject>(objectClassName: SwiftRLMBoolObject.className())\n    @objc dynamic var setCol = RLMSet<SwiftRLMBoolObject>(objectClassName: SwiftRLMBoolObject.className())\n    @objc dynamic var uuidCol = UUID(uuidString: \"00000000-0000-0000-0000-000000000000\")\n    @objc dynamic var rlmValue: RLMValue = \"A Mixed Object\" as NSString\n}\n\nclass SwiftRLMOptionalObject: RLMObject {\n    @objc dynamic var optStringCol: String?\n    @objc dynamic var optNSStringCol: NSString?\n    @objc dynamic var optBinaryCol: Data?\n    @objc dynamic var optDateCol: Date?\n    @objc dynamic var optObjectCol: SwiftRLMBoolObject?\n    @objc dynamic var uuidCol: UUID?\n}\n\nclass SwiftRLMPrimitiveArrayObject: RLMObject {\n    @objc dynamic var stringCol = RLMArray<NSString>(objectType: .string, optional: false)\n    @objc dynamic var optStringCol = RLMArray<NSObject>(objectType: .string, optional: true)\n    @objc dynamic var dataCol = RLMArray<NSData>(objectType: .data, optional: false)\n    @objc dynamic var optDataCol = RLMArray<NSObject>(objectType: .data, optional: true)\n    @objc dynamic var dateCol = RLMArray<NSDate>(objectType: .date, optional: false)\n    @objc dynamic var optDateCol = RLMArray<NSObject>(objectType: .date, optional: true)\n    @objc dynamic var uuidCol = RLMArray<NSUUID>(objectType: .UUID, optional: false)\n    @objc dynamic var optUuidCol = RLMArray<NSObject>(objectType: .UUID, optional: true)\n}\n\nclass SwiftRLMPrimitiveSetObject: RLMObject {\n    @objc dynamic var stringCol = RLMSet<NSString>(objectType: .string, optional: false)\n    @objc dynamic var optStringCol = RLMSet<NSObject>(objectType: .string, optional: true)\n    @objc dynamic var dataCol = RLMSet<NSData>(objectType: .data, optional: false)\n    @objc dynamic var optDataCol = RLMSet<NSObject>(objectType: .data, optional: true)\n    @objc dynamic var dateCol = RLMSet<NSDate>(objectType: .date, optional: false)\n    @objc dynamic var optDateCol = RLMSet<NSObject>(objectType: .date, optional: true)\n    @objc dynamic var uuidCol = RLMSet<NSUUID>(objectType: .UUID, optional: false)\n    @objc dynamic var optUuidCol = RLMSet<NSObject>(objectType: .UUID, optional: true)\n}\n\nclass SwiftRLMDogObject: RLMObject {\n    @objc dynamic var dogName = \"\"\n}\n\nclass SwiftRLMOwnerObject: RLMObject {\n    @objc dynamic var name = \"\"\n    @objc dynamic var dog: SwiftRLMDogObject? = SwiftRLMDogObject()\n}\n\nclass SwiftRLMAggregateObject: RLMObject {\n    @objc dynamic var intCol = 0\n    @objc dynamic var floatCol = 0 as Float\n    @objc dynamic var doubleCol = 0.0\n    @objc dynamic var boolCol = false\n    @objc dynamic var dateCol = Date()\n}\n\nclass SwiftRLMAllIntSizesObject: RLMObject {\n    @objc dynamic var int8: Int8  = 0\n    @objc dynamic var int16: Int16 = 0\n    @objc dynamic var int32: Int32 = 0\n    @objc dynamic var int64: Int64 = 0\n}\n\nclass SwiftRLMEmployeeObject: RLMObject {\n    @objc dynamic var name = \"\"\n    @objc dynamic var age = 0\n    @objc dynamic var hired = false\n}\n\nclass SwiftRLMCompanyObject: RLMObject {\n    @objc dynamic var employees = RLMArray<SwiftRLMEmployeeObject>(objectClassName: SwiftRLMEmployeeObject.className())\n    @objc dynamic var employeeSet = RLMSet<SwiftRLMEmployeeObject>(objectClassName: SwiftRLMEmployeeObject.className())\n    @objc dynamic var employeeMap = RLMDictionary<NSString, SwiftRLMEmployeeObject>(objectClassName: SwiftRLMEmployeeObject.className(), keyType: .string)\n}\n\nclass SwiftRLMAggregateSet: RLMObject {\n    @objc dynamic var set = RLMSet<SwiftRLMAggregateObject>(objectClassName: SwiftRLMAggregateObject.className())\n}\n\nclass SwiftRLMArrayPropertyObject: RLMObject {\n    @objc dynamic var name = \"\"\n    @objc dynamic var array = RLMArray<SwiftRLMStringObject>(objectClassName: SwiftRLMStringObject.className())\n    @objc dynamic var intArray = RLMArray<SwiftRLMIntObject>(objectClassName: SwiftRLMIntObject.className())\n}\n\nclass SwiftRLMSetPropertyObject: RLMObject {\n    @objc dynamic var name = \"\"\n    @objc dynamic var set = RLMSet<SwiftRLMStringObject>(objectClassName: SwiftRLMStringObject.className())\n    @objc dynamic var intSet = RLMSet<SwiftRLMIntObject>(objectClassName: SwiftRLMIntObject.className())\n}\n\nclass SwiftRLMDictionaryPropertyObject: RLMObject {\n    @objc dynamic var dict = RLMDictionary<NSString, SwiftRLMAggregateObject>(objectClassName: SwiftRLMAggregateObject.className(), keyType: .string)\n}\n\nclass SwiftRLMDictionaryEmployeeObject: RLMObject {\n    @objc dynamic var dict = RLMDictionary<NSString, SwiftRLMEmployeeObject>(objectClassName: SwiftRLMEmployeeObject.className(), keyType: .string)\n}\n\nclass SwiftRLMDynamicObject: RLMObject {\n    @objc dynamic var stringCol = \"a\"\n    @objc dynamic var intCol = 0\n}\n\nclass SwiftRLMUTF8Object: RLMObject {\n    @objc dynamic var 柱колоéнǢкƱаم👍 = \"值значен™👍☞⎠‱௹♣︎☐▼❒∑⨌⧭иеمرحبا\"\n}\n\nclass SwiftRLMIgnoredPropertiesObject: RLMObject {\n    @objc dynamic var name = \"\"\n    @objc dynamic var age = 0\n    @objc dynamic var runtimeProperty: AnyObject?\n    @objc dynamic var readOnlyProperty: Int { return 0 }\n\n    override class func ignoredProperties() -> [String]? {\n        return [\"runtimeProperty\"]\n    }\n}\n\nclass SwiftRLMPrimaryStringObject: RLMObject {\n    @objc dynamic var stringCol = \"\"\n    @objc dynamic var intCol = 0\n\n    override class func primaryKey() -> String {\n        return \"stringCol\"\n    }\n}\n\nclass SwiftRLMLinkSourceObject: RLMObject {\n    @objc dynamic var id = 0\n    @objc dynamic var link: SwiftRLMLinkTargetObject?\n}\n\nclass SwiftRLMLinkTargetObject: RLMObject {\n    @objc dynamic var id = 0\n    @objc dynamic var backlinks: RLMLinkingObjects<SwiftRLMLinkSourceObject>?\n\n    override class func linkingObjectsProperties() -> [String : RLMPropertyDescriptor] {\n        return [\"backlinks\": RLMPropertyDescriptor(with: SwiftRLMLinkSourceObject.self, propertyName: \"link\")]\n    }\n}\n\nclass SwiftRLMLazyVarObject: RLMObject {\n    @objc dynamic lazy var lazyProperty: String = \"hello world\"\n}\n\nclass SwiftRLMIgnoredLazyVarObject: RLMObject {\n    @objc dynamic var id = 0\n    @objc dynamic lazy var ignoredVar: String = \"hello world\"\n    override class func ignoredProperties() -> [String] { return [\"ignoredVar\"] }\n}\n\nclass SwiftRLMObjectiveCTypesObject: RLMObject {\n    @objc dynamic var stringCol: NSString?\n    @objc dynamic var dateCol: NSDate?\n    @objc dynamic var dataCol: NSData?\n    @objc dynamic var numCol: NSNumber? = 0\n}\n"
  },
  {
    "path": "Realm/Tests/Swift/SwiftUnicodeTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport Realm\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\n#endif\n\nlet utf8TestString = \"值значен™👍☞⎠‱௹♣︎☐▼❒∑⨌⧭иеمرحبا\"\n\nclass SwiftRLMUnicodeTests: RLMTestCase {\n\n    // Swift models\n\n    func testUTF8StringContents() {\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        _ = SwiftRLMStringObject.create(in: realm, withValue: [utf8TestString])\n        try! realm.commitWriteTransaction()\n\n        let obj1 = SwiftRLMStringObject.allObjects(in: realm).firstObject() as! SwiftRLMStringObject\n        XCTAssertEqual(obj1.stringCol, utf8TestString, \"Storing and retrieving a string with UTF8 content should work\")\n\n        let obj2 = SwiftRLMStringObject.objects(in: realm, where: \"stringCol == %@\", utf8TestString).firstObject() as! SwiftRLMStringObject\n        XCTAssertTrue(obj1.isEqual(to: obj2), \"Querying a realm searching for a string with UTF8 content should work\")\n    }\n\n    func testUTF8PropertyWithUTF8StringContents() {\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        _ = SwiftRLMUTF8Object.create(in: realm, withValue: [utf8TestString])\n        try! realm.commitWriteTransaction()\n\n        let obj1 = SwiftRLMUTF8Object.allObjects(in: realm).firstObject() as! SwiftRLMUTF8Object\n        XCTAssertEqual(obj1.柱колоéнǢкƱаم👍, utf8TestString, \"Storing and retrieving a string with UTF8 content should work\")\n\n        // Test fails because of rdar://17735684\n//        let obj2 = SwiftRLMUTF8Object.objectsInRealm(realm, \"柱колоéнǢкƱаم👍 == %@\", utf8TestString).firstObject() as SwiftRLMUTF8Object\n//        XCTAssertEqual(obj1, obj2, \"Querying a realm searching for a string with UTF8 content should work\")\n    }\n\n    // Objective-C models\n\n    func testUTF8StringContents_objc() {\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        _ = StringObject.create(in: realm, withValue: [utf8TestString])\n        try! realm.commitWriteTransaction()\n\n        let obj1 = StringObject.allObjects(in: realm).firstObject() as! StringObject\n        XCTAssertEqual(obj1.stringCol, utf8TestString, \"Storing and retrieving a string with UTF8 content should work\")\n\n        // Temporarily commented out because variadic import seems broken\n        let obj2 = StringObject.objects(in: realm, where: \"stringCol == %@\", utf8TestString).firstObject() as! StringObject\n        XCTAssertTrue(obj1.isEqual(to: obj2), \"Querying a realm searching for a string with UTF8 content should work\")\n    }\n\n    func testUTF8PropertyWithUTF8StringContents_objc() {\n        let realm = realmWithTestPath()\n        realm.beginWriteTransaction()\n        _ = UTF8Object.create(in: realm, withValue: [utf8TestString])\n        try! realm.commitWriteTransaction()\n\n        let obj1 = UTF8Object.allObjects(in: realm).firstObject() as! UTF8Object\n        XCTAssertEqual(obj1.柱колоéнǢкƱаم, utf8TestString, \"Storing and retrieving a string with UTF8 content should work\")\n\n        // Test fails because of rdar://17735684\n//        let obj2 = UTF8Object.objectsInRealm(realm, \"柱колоéнǢкƱаم == %@\", utf8TestString).firstObject() as UTF8Object\n//        XCTAssertEqual(obj1, obj2, \"Querying a realm searching for a string with UTF8 content should work\")\n    }\n}\n"
  },
  {
    "path": "Realm/Tests/SwiftUITestHost/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>UIAppFonts</key>\n\t<array>\n\t\t<string>Effra_Rg.ttf</string>\n\t\t<string>Effra_Bd.ttf</string>\n\t\t<string>Effra_Lt.ttf</string>\n\t</array>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>$(DEVELOPMENT_LANGUAGE)</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSMinimumSystemVersion</key>\n\t<string>$(MACOSX_DEPLOYMENT_TARGET)</string>\n\t<key>NSHumanReadableCopyright</key>\n\t<string>Copyright © 2021 Realm. All rights reserved.</string>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Realm/Tests/SwiftUITestHost/LaunchScreen.storyboard",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\" version=\"3.0\" toolsVersion=\"13142\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" useTraitCollections=\"YES\" useSafeAreas=\"YES\" colorMatched=\"YES\">\n    <dependencies>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"12042\"/>\n    </dependencies>\n    <scenes/>\n</document>\n"
  },
  {
    "path": "Realm/Tests/SwiftUITestHost/Objects.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport RealmSwift\nimport Foundation\n\nclass Reminder: EmbeddedObject, ObjectKeyIdentifiable {\n     enum Priority: Int, PersistableEnum, CaseIterable, Identifiable, CustomStringConvertible {\n        var id: Int { self.rawValue }\n\n        case low, medium, high\n\n        var description: String {\n            switch self {\n            case .low: return \"low\"\n            case .medium: return \"medium\"\n            case .high: return \"high\"\n            }\n        }\n    }\n    @Persisted var title = \"\"\n    @Persisted var notes = \"\"\n    @Persisted var isFlagged = false\n    @Persisted var date = Date()\n    @Persisted var isComplete = false\n    @Persisted var priority: Priority = .low\n}\n\nclass ReminderList: Object, ObjectKeyIdentifiable {\n    @Persisted var name = \"New List\"\n    @Persisted var icon = \"list.bullet\"\n    @Persisted var reminders = RealmSwift.List<Reminder>()\n    var firstLetter: String {\n        guard let char = name.first else {\n            return \"\"\n        }\n        return String(char)\n    }\n}\n"
  },
  {
    "path": "Realm/Tests/SwiftUITestHost/SwiftUITestHostApp.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport RealmSwift\nimport SwiftUI\n\nstruct ReminderFormView: View {\n    @ObservedRealmObject var reminder: Reminder\n\n    var body: some View {\n        Form {\n            TextField(\"title\", text: $reminder.title).accessibility(identifier: \"formTitle\")\n            DatePicker(\"date\", selection: $reminder.date)\n            Picker(\"priority\", selection: $reminder.priority, content: {\n                ForEach(Reminder.Priority.allCases) { priority in\n                    Text(priority.description)\n                        .tag(priority)\n                        .accessibilityIdentifier(priority.description)\n                }\n            }).accessibilityIdentifier(\"priority_picker\")\n        }\n        .navigationTitle(reminder.title)\n    }\n}\n\n\nstruct ReminderListView: View {\n    @ObservedRealmObject var list: ReminderList\n    @State var activeReminder: Reminder.ID?\n\n    var body: some View {\n        VStack {\n            List {\n                ForEach(list.reminders) { reminder in\n                    NavigationLink(destination: ReminderFormView(reminder: reminder),\n                                   tag: reminder.id, selection: $activeReminder) {\n                        Text(reminder.title)\n                    }\n                }\n                .onMove(perform: $list.reminders.move)\n                .onDelete(perform: $list.reminders.remove)\n            }\n        }.navigationTitle(list.name)\n        .navigationBarItems(trailing: HStack {\n            EditButton()\n            Button(\"add\") {\n                let reminder = Reminder()\n                $list.reminders.append(reminder)\n                activeReminder = reminder.id\n            }.accessibility(identifier: \"addReminder\")\n        })\n    }\n}\n\nstruct ReminderListResultsView: View {\n    // Only receive notifications on \"name\" to work around what appears to be\n    // a SwiftUI bug introduced in iOS 14.5: when we're two levels deep in\n    // NagivationLinks, refreshing this view makes the second NavigationLink pop\n    @ObservedResults(ReminderList.self, keyPaths: [\"name\", \"icon\"]) var reminders\n    @Binding var searchFilter: String\n    @State var activeList: ReminderList.ID?\n\n    struct Row: View {\n        @ObservedRealmObject var list: ReminderList\n\n        var body: some View {\n            HStack {\n                Image(systemName: list.icon)\n                TextField(\"List Name\", text: $list.name)\n                Spacer()\n                Text(\"\\(list.reminders.count)\")\n            }.accessibility(identifier: \"hstack\")\n        }\n    }\n\n    var body: some View {\n        List {\n            ForEach(reminders) { list in\n                NavigationLink(destination: ReminderListView(list: list), tag: list.id, selection: $activeList) {\n                    Row(list: list)\n                }.accessibilityIdentifier(list.name).accessibilityActivationPoint(CGPoint(x: 0, y: 0))\n            }.onDelete(perform: $reminders.remove)\n        }.onChange(of: searchFilter) { value in\n            if ProcessInfo.processInfo.environment[\"query_type\"] == \"type_safe_query\" {\n                $reminders.where = value.isEmpty ? nil : { $0.name.contains(value, options: .caseInsensitive) }\n            } else {\n                $reminders.filter = value.isEmpty ? nil : NSPredicate(format: \"name CONTAINS[c] %@\", value)\n            }\n        }\n    }\n}\n\npublic extension Color {\n    static let lightText = Color(UIColor.lightText)\n    static let darkText = Color(UIColor.darkText)\n\n    static let label = Color(UIColor.label)\n    static let secondaryLabel = Color(UIColor.secondaryLabel)\n    static let tertiaryLabel = Color(UIColor.tertiaryLabel)\n    static let quaternaryLabel = Color(UIColor.quaternaryLabel)\n\n    static let systemBackground = Color(UIColor.systemBackground)\n    static let secondarySystemBackground = Color(UIColor.secondarySystemBackground)\n    static let tertiarySystemBackground = Color(UIColor.tertiarySystemBackground)\n}\n\nstruct SearchView: View {\n    @Binding var searchFilter: String\n\n    var body: some View {\n        VStack {\n            Spacer()\n            HStack {\n                Image(systemName: \"magnifyingglass\").foregroundColor(.gray)\n                    .padding(.leading, 7)\n                    .padding(.top, 7)\n                    .padding(.bottom, 7)\n                TextField(\"search\", text: $searchFilter)\n                    .padding(.top, 7)\n                    .padding(.bottom, 7)\n                    .accessibility(identifier: \"searchField\")\n            }.background(RoundedRectangle(cornerRadius: 15)\n                            .fill(Color.secondarySystemBackground))\n            Spacer()\n        }.frame(maxHeight: 40).padding()\n    }\n}\n\nstruct Footer: View {\n    let realm = try! Realm()\n\n    var body: some View {\n        HStack {\n            Button(action: {\n                try! realm.write {\n                    realm.add(ReminderList())\n                }\n            }, label: {\n                HStack {\n                    Image(systemName: \"plus.circle\")\n                    Text(\"Add list\")\n                }\n            }).buttonStyle(BorderlessButtonStyle())\n            .padding()\n            .accessibility(identifier: \"addList\")\n            Spacer()\n        }\n    }\n}\n\n@MainActor\nstruct ContentView: View {\n    @State var searchFilter: String = \"\"\n\n    var content: some View {\n        VStack {\n            SearchView(searchFilter: $searchFilter)\n            ReminderListResultsView(searchFilter: $searchFilter)\n            Spacer()\n            Footer()\n        }\n        .navigationBarItems(trailing: EditButton())\n        .navigationTitle(\"reminders\")\n    }\n\n    var body: some View {\n        if #available(iOS 16.0, *) {\n            NavigationStack {\n                content\n            }\n        } else {\n            NavigationView {\n                content\n            }\n        }\n    }\n}\n\nstruct MultiRealmContentView: View {\n    struct RealmView: View {\n        @Environment(\\.realm) var realm\n        var body: some View {\n            Text(realm.configuration.inMemoryIdentifier ?? \"no memory identifier\")\n                .accessibilityIdentifier(\"test_text_view\")\n        }\n    }\n\n    @State var showSheet = false\n\n    var body: some View {\n        NavigationView {\n            VStack {\n                NavigationLink(\"Realm A\", destination: RealmView().environment(\\.realmConfiguration, Realm.Configuration(inMemoryIdentifier: \"realm_a\")))\n                NavigationLink(\"Realm B\", destination: RealmView().environment(\\.realmConfiguration, Realm.Configuration(inMemoryIdentifier: \"realm_b\")))\n                Button(\"Realm C\") {\n                    showSheet = true\n                }\n            }.sheet(isPresented: $showSheet, content: {\n                RealmView().environment(\\.realmConfiguration, Realm.Configuration(inMemoryIdentifier: \"realm_c\"))\n            })\n        }\n    }\n}\n\nstruct UnmanagedObjectTestView: View {\n    struct NestedViewOne: View {\n        struct NestedViewTwo: View {\n            @Environment(\\.realm) var realm\n            @Environment(\\.presentationMode) var presentationMode\n            @ObservedRealmObject var reminderList: ReminderList\n\n            var body: some View {\n                Button(\"Delete\") {\n                    $reminderList.delete()\n                    presentationMode.wrappedValue.dismiss()\n                }\n            }\n        }\n        @ObservedRealmObject var reminderList: ReminderList\n        @Environment(\\.presentationMode) var presentationMode\n        @State var shown = false\n        var body: some View {\n            NavigationLink(\"Next\", destination: NestedViewTwo(reminderList: reminderList))\n                .isDetailLink(false)\n                .onAppear {\n                    if shown {\n                        presentationMode.wrappedValue.dismiss()\n                    }\n                    shown = true\n                }\n        }\n    }\n    @ObservedRealmObject var reminderList = ReminderList()\n    @Environment(\\.realm) var realm\n    @State var passToNestedView = false\n\n    var body: some View {\n        NavigationView {\n            Form {\n                TextField(\"name\", text: $reminderList.name).accessibilityIdentifier(\"name\")\n                NavigationLink(\"test\", destination: NestedViewOne(reminderList: reminderList), isActive: $passToNestedView)\n                    .isDetailLink(false)\n            }.navigationBarItems(trailing: Button(\"Add\", action: {\n                try! realm.write { realm.add(reminderList) }\n                passToNestedView = true\n            }).accessibility(identifier: \"addReminder\"))\n        }.onAppear {\n            print(\"ReminderList: \\(reminderList)\")\n        }\n    }\n}\n\nstruct ObservedResultsKeyPathTestView: View {\n    @ObservedResults(ReminderList.self, keyPaths: [\"reminders.isFlagged\"]) var reminders\n\n    var body: some View {\n        VStack {\n            List {\n                ForEach(reminders) { list in\n                    ObservedResultsKeyPathTestRow(list: list)\n                }.onDelete(perform: $reminders.remove)\n            }\n            .navigationBarItems(trailing: EditButton())\n            .navigationTitle(\"reminders\")\n            Footer()\n        }\n    }\n}\n\nstruct ObservedResultsKeyPathTestRow: View {\n    var list: ReminderList\n\n    var body: some View {\n        HStack {\n            Image(systemName: list.icon)\n            Text(list.name)\n        }.frame(minWidth: 100).accessibility(identifier: \"hstack\")\n    }\n}\n\n@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)\nstruct ObservedResultsSearchableTestView: View {\n    @ObservedResults(ReminderList.self, where: { $0.name.starts(with: \"reminder\") }) var reminders\n    @State var searchFilter: String = \"\"\n\n    var body: some View {\n        NavigationView {\n            List {\n                ForEach(reminders) { reminder in\n                    Text(reminder.name)\n                }\n            }\n            .searchable(text: $searchFilter,\n                        collection: $reminders,\n                        keyPath: \\.name) {\n                ForEach(reminders) { remindersFiltered in\n                    Text(remindersFiltered.name).searchCompletion(remindersFiltered.name)\n                }\n            }\n            .navigationTitle(\"Reminders\")\n            .navigationBarItems(trailing:\n                Button(\"add\") {\n                    let reminder = ReminderList()\n                    $reminders.append(reminder)\n                }.accessibility(identifier: \"addList\"))\n        }\n    }\n}\n\nstruct ObservedResultsConfiguration: View {\n    @ObservedResults(ReminderList.self) var remindersA // config from `.environment`\n    @ObservedResults(ReminderList.self,\n                     configuration: Realm.Configuration(inMemoryIdentifier: \"realm_b\")) var remindersB\n\n    var body: some View {\n        NavigationView {\n            VStack {\n                Text(remindersA.realm?.configuration.inMemoryIdentifier ?? \"no memory identifier\")\n                    .accessibility(identifier: \"realm_a_label\")\n                Text(remindersB.realm?.configuration.inMemoryIdentifier ?? \"no memory identifier\")\n                    .accessibility(identifier: \"realm_b_label\")\n                List {\n                    ForEach(remindersA) { reminder in\n                        Text(reminder.name)\n                    }\n                }.accessibility(identifier: \"ListA\")\n                List {\n                    ForEach(remindersB) { reminder in\n                        Text(reminder.name)\n                    }\n                }.accessibility(identifier: \"ListB\")\n            }\n            .navigationTitle(\"Reminders\")\n            .navigationBarItems(leading:\n                Button(\"add A\") {\n                    let reminder = ReminderList()\n                    $remindersA.append(reminder)\n                }.accessibility(identifier: \"addListA\")\n            )\n            .navigationBarItems(trailing:\n                Button(\"add B\") {\n                    let reminder = ReminderList()\n                    $remindersB.append(reminder)\n                }.accessibility(identifier: \"addListB\")\n            )\n        }\n    }\n}\n\nstruct ObservedSectionedResultsKeyPathTestView: View {\n    @ObservedSectionedResults(ReminderList.self,\n                              sectionKeyPath: \\.firstLetter,\n                              keyPaths: [\"reminders.isFlagged\"]) var reminders\n\n    var body: some View {\n        VStack {\n            List {\n                ForEach(reminders) { section in\n                    Section(header: Text(section.key)) {\n                        ForEach(section) { object in\n                            ObservedResultsKeyPathTestRow(list: object)\n                        }.onDelete {\n                            $reminders.remove(atOffsets: $0, section: section)\n                        }\n                    }\n                }\n            }\n            .navigationBarItems(trailing: EditButton())\n            .navigationTitle(\"reminders\")\n            Footer()\n        }\n    }\n}\n\n// swiftlint:disable:next type_name\nstruct ObservedSectionedResultsWithSortDescriptorsView: View {\n    @ObservedSectionedResults(ReminderList.self,\n                              sectionBlock: { $0.name.first.map(String.init(_:)) ?? \"\" },\n                              sortDescriptors: [SortDescriptor(keyPath: \\ReminderList.name)],\n                              keyPaths: [\"reminders.isFlagged\"]) var reminders\n\n    var body: some View {\n        VStack {\n            List {\n                ForEach(reminders) { section in\n                    Section(header: Text(section.key)) {\n                        ForEach(section) { object in\n                            ObservedResultsKeyPathTestRow(list: object)\n                        }\n                    }\n                }\n            }\n            .navigationBarItems(trailing: EditButton())\n            .navigationTitle(\"reminders\")\n            Footer()\n        }\n    }\n}\n\n@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)\n// swiftlint:disable:next type_name\nstruct ObservedSectionedResultsSearchableTestView: View {\n    @ObservedSectionedResults(ReminderList.self,\n                              sectionKeyPath: \\.firstLetter,\n                              where: { $0.name.starts(with: \"reminder\") }) var reminders\n    @State var searchFilter: String = \"\"\n\n    var body: some View {\n        NavigationView {\n            List {\n                ForEach(reminders) { section in\n                    Section(section.key) {\n                        ForEach(section) { object in\n                            Text(object.name)\n                        }\n                    }\n                }\n            }\n            .searchable(text: $searchFilter,\n                        collection: $reminders,\n                        keyPath: \\.name) {\n                ForEach(reminders) { section in\n                    Section(section.key) {\n                        ForEach(section) { objectsFiltered in\n                            Text(objectsFiltered.name).searchCompletion(objectsFiltered.name)\n                        }\n                    }\n                }\n            }\n            .navigationTitle(\"Reminders\")\n            .navigationBarItems(trailing:\n                Button(\"add\") {\n                    let realm = $reminders.wrappedValue.realm?.thaw()\n                    try! realm?.write {\n                        realm?.add(ReminderList())\n                    }\n                }.accessibility(identifier: \"addList\"))\n        }\n    }\n}\n\n@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)\nstruct ObservedSectionedResultsConfiguration: View {\n    @ObservedSectionedResults(ReminderList.self, sectionKeyPath: \\.firstLetter) var remindersA // config from `.environment`\n    @ObservedSectionedResults(ReminderList.self,\n                              sectionKeyPath: \\.firstLetter,\n                              configuration: Realm.Configuration(inMemoryIdentifier: \"realm_b\")) var remindersB\n\n    var body: some View {\n        NavigationView {\n            VStack {\n                Text(remindersA.realm?.configuration.inMemoryIdentifier ?? \"no memory identifier\")\n                    .accessibility(identifier: \"realm_a_label\")\n                Text(remindersB.realm?.configuration.inMemoryIdentifier ?? \"no memory identifier\")\n                    .accessibility(identifier: \"realm_b_label\")\n                List {\n                    ForEach(remindersA) { reminderSection in\n                        Section(reminderSection.key) {\n                            ForEach(reminderSection) { object in\n                                Text(object.name)\n                            }\n                        }\n                    }\n                }.accessibility(identifier: \"ListA\")\n                List {\n                    ForEach(remindersB) { reminderSection in\n                        Section(reminderSection.key) {\n                            ForEach(reminderSection) { object in\n                                Text(object.name)\n                            }\n                        }\n                    }\n                }.accessibility(identifier: \"ListB\")\n            }\n            .navigationTitle(\"Reminders\")\n            .navigationBarItems(leading:\n                Button(\"add A\") {\n                    let realm = $remindersA.wrappedValue.realm?.thaw()\n                    try! realm?.write {\n                        realm?.add(ReminderList())\n                    }\n                }.accessibility(identifier: \"addListA\")\n            )\n            .navigationBarItems(trailing:\n                Button(\"add B\") {\n                    let realm = $remindersB.wrappedValue.realm?.thaw()\n                    try! realm?.write {\n                        realm?.add(ReminderList())\n                    }\n                }.accessibility(identifier: \"addListB\")\n            )\n        }\n    }\n}\n\n\n@main\nstruct App: SwiftUI.App {\n    var body: some Scene {\n        if let realmPath = ProcessInfo.processInfo.environment[\"REALM_PATH\"] {\n            Realm.Configuration.defaultConfiguration =\n                Realm.Configuration(fileURL: URL(string: realmPath)!, deleteRealmIfMigrationNeeded: true)\n        } else {\n            Realm.Configuration.defaultConfiguration =\n                Realm.Configuration(deleteRealmIfMigrationNeeded: true)\n        }\n        let view: AnyView = {\n            switch ProcessInfo.processInfo.environment[\"test_type\"] {\n            case \"multi_realm_test\":\n                return AnyView(MultiRealmContentView())\n            case \"unmanaged_object_test\":\n                return AnyView(UnmanagedObjectTestView())\n            case \"observed_results_key_path\":\n                return AnyView(ObservedResultsKeyPathTestView())\n            case \"observed_results_searchable\":\n                if #available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *) {\n                    return AnyView(ObservedResultsSearchableTestView())\n                } else {\n                    return AnyView(EmptyView())\n                }\n            case \"observed_results_configuration\":\n                return AnyView(ObservedResultsConfiguration()\n                                .environment(\\.realmConfiguration, Realm.Configuration(inMemoryIdentifier: \"realm_a\")))\n            case \"observed_sectioned_results_key_path\":\n                return AnyView(ObservedSectionedResultsKeyPathTestView())\n            case \"observed_sectioned_results_sort_descriptors\":\n                return AnyView(ObservedSectionedResultsWithSortDescriptorsView())\n            case \"observed_sectioned_results_searchable\":\n                if #available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *) {\n                    return AnyView(ObservedSectionedResultsSearchableTestView())\n                } else {\n                    return AnyView(EmptyView())\n                }\n            case \"observed_sectioned_results_configuration\":\n                if #available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *) {\n                    return AnyView(ObservedSectionedResultsConfiguration()\n                                    .environment(\\.realmConfiguration, Realm.Configuration(inMemoryIdentifier: \"realm_a\")))\n                } else {\n                    return AnyView(EmptyView())\n                }\n            default:\n                return AnyView(ContentView())\n            }\n        }()\n        return WindowGroup {\n            view\n        }\n    }\n}\n"
  },
  {
    "path": "Realm/Tests/SwiftUITestHostUITests/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>$(DEVELOPMENT_LANGUAGE)</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Realm/Tests/SwiftUITestHostUITests/SwiftUITestHostUITests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\nclass SwiftUITests: XCTestCase {\n    var realm: Realm!\n    @MainActor\n    let app = XCUIApplication()\n\n    @MainActor\n    override func setUpWithError() throws {\n        continueAfterFailure = false\n\n        // the realm must be created before app launch otherwise we will not have\n        // write permissions\n        let realmPath = URL(string: \"\\(FileManager.default.temporaryDirectory)\\(UUID())\")!\n        let configuration = Realm.Configuration(fileURL: realmPath)\n        _ = try Realm.deleteFiles(for: configuration)\n        self.realm = try! Realm(configuration: configuration)\n\n        app.launchEnvironment = [\n            \"REALM_PATH\": realmPath.absoluteString\n        ]\n    }\n\n    @MainActor\n    override func tearDownWithError() throws {\n        app.terminate()\n        self.realm.invalidate()\n        let config = realm.configuration\n        self.realm = nil\n        XCTAssertTrue(try Realm.deleteFiles(for: config))\n    }\n\n    private func deleteString(for string: String) -> String {\n        String(repeating: XCUIKeyboardKey.delete.rawValue, count: string.count)\n    }\n\n    @MainActor\n    private var tables: XCUIElementQuery {\n        if #available(iOS 16.0, *) {\n            return app.collectionViews\n        } else {\n            return app.tables\n        }\n    }\n\n    @MainActor\n    func testSampleApp() throws {\n        app.launch()\n        // assert realm is empty\n        XCTAssertEqual(realm.objects(ReminderList.self).count, 0)\n\n        // add 3 lists, and assert that they have been added to\n        // the UI and Realm\n        let addButton = app.buttons[\"addList\"]\n        addButton.tap()\n        addButton.tap()\n        addButton.tap()\n        XCTAssertEqual(realm.objects(ReminderList.self).count, 3)\n        XCTAssertEqual(tables.firstMatch.cells.count, 3)\n\n        // delete each person, operating from the zeroeth index\n        for _ in 0..<tables.firstMatch.cells.count {\n            let row = tables.firstMatch.cells.element(boundBy: 0)\n            row.swipeLeft()\n            app.buttons[\"Delete\"].tap()\n        }\n\n        XCTAssertEqual(realm.objects(ReminderList.self).count, 0)\n        XCTAssertEqual(tables.firstMatch.cells.count, 0)\n\n        // add another list, and tap into the ReminderView\n        addButton.tap()\n        app.buttons[\"New List\"].tap()\n        XCTAssertTrue(app.navigationBars.staticTexts[\"New List\"].waitForExistence(timeout: 1.0))\n        app.buttons[\"addReminder\"].tap()\n        if #available(iOS 18, *) {\n            // Work around what appears to be a bug in SwiftUI in iOS 18 beta 1\n            // where tapping the list entry doesn't navigate to ReminderView\n            // if there's only one list entry\n            app.buttons[\"addReminder\"].tap()\n        }\n        // type in a name\n        if #available(iOS 16, *) {\n            app.cells.element(boundBy: 0).tap()\n        } else {\n            app.textFields[\"title\"].tap()\n        }\n        app.textFields[\"title\"].tap()\n        app.textFields[\"title\"].typeText(\"My Reminder\")\n        // check to see if it is reflected live in the title view\n        XCTAssertTrue(app.navigationBars.staticTexts[\"My Reminder\"].waitForExistence(timeout: 1.0))\n        let myReminder = realm.objects(ReminderList.self).first!.reminders.first!\n        XCTAssertEqual(myReminder.priority, .low)\n        if #available(iOS 16, *) {\n            app.buttons[\"priority_picker\"].tap()\n            app.buttons[\"medium\"].tap()\n            XCTAssertEqual(myReminder.priority, .medium)\n        } else {\n            app.buttons[\"priority_picker\"].tap()\n            tables.switches[\"medium\"].tap()\n            XCTAssertEqual(myReminder.priority, .medium)\n        }\n\n        app.navigationBars.buttons.element(boundBy: 0).tap()\n\n        // MARK: Test Move\n        app.buttons[\"addReminder\"].tap()\n        XCTAssertEqual(realm.objects(ReminderList.self).first!.reminders.first!.title, \"My Reminder\")\n        XCTAssertEqual(realm.objects(ReminderList.self).first!.reminders[1].title, \"\")\n\n        app.buttons[\"Edit\"].tap()\n        app.buttons.matching(identifier: \"Reorder\").firstMatch.press(forDuration: 1, thenDragTo: tables.cells.element(boundBy: 1))\n\n        XCTAssertEqual(realm.objects(ReminderList.self).first!.reminders.first!.title, \"\")\n        XCTAssertEqual(realm.objects(ReminderList.self).first!.reminders[1].title, \"My Reminder\")\n\n        // MARK: Test Delete\n        // potentially brittle, but these are the hooks swiftUI gives us. when editing a list,\n        // a cancel button appears on the left and a drag icon appears on the right. the label\n        // for the cancel button is \"Delete \", which when tapped, reveals the actual delete button\n        // labeled \"Delete\"\n        func delete() {\n            if #available(iOS 16.0, *) {\n                let collectionViewsQuery = app.collectionViews\n                collectionViewsQuery.cells.otherElements.containing(.image, identifier: \"remove\").element.firstMatch.tap()\n                collectionViewsQuery.buttons[\"Delete\"].firstMatch.tap()\n            } else {\n                app.buttons.matching(identifier: \"Delete \").firstMatch.tap()\n                app.buttons.matching(identifier: \"Delete\").firstMatch.tap()\n            }\n        }\n        if #available(iOS 18, *) {\n            XCTAssertEqual(realm.objects(ReminderList.self).first!.reminders.count, 3)\n            delete()\n        }\n        XCTAssertEqual(realm.objects(ReminderList.self).first!.reminders.count, 2)\n        delete()\n        XCTAssertEqual(realm.objects(ReminderList.self).first!.reminders.count, 1)\n        delete()\n        XCTAssertEqual(realm.objects(ReminderList.self).first!.reminders.count, 0)\n\n        app.navigationBars.buttons.firstMatch.tap()\n\n        tables.cells.firstMatch.swipeLeft()\n        app.buttons.matching(identifier: \"Delete\").firstMatch.tap()\n        XCTAssertEqual(realm.objects(ReminderList.self).count, 0)\n    }\n\n    @MainActor\n    func testNSPredicateObservedResults() throws {\n        app.launch()\n        try observedResultsQueryTest()\n    }\n\n    @MainActor\n    func testSwiftQueryObservedResults() throws {\n        app.launchEnvironment[\"query_type\"] = \"type_safe_query\"\n        app.launch()\n        try observedResultsQueryTest()\n    }\n\n    @MainActor\n    private func observedResultsQueryTest() throws {\n        let addButton = app.buttons[\"addList\"]\n        (1...5).forEach { _ in\n            addButton.tap()\n        }\n\n        // Name every reminders list for search\n        try realm.write {\n            for (index, obj) in (realm.objects(ReminderList.self)).enumerated() {\n                obj.name = \"reminder list \\((index % 2) == 0 ? \"even\" : \"odd\")\"\n            }\n        }\n\n        let searchBar = app.textFields[\"searchField\"]\n        let table = tables.firstMatch\n\n        searchBar.tap()\n\n        searchBar.typeText(\"even\")\n        searchBar.typeText(\"\\n\") // \\n to dismiss keyboard\n        XCTAssertEqual(table.cells.count, 3)\n    }\n\n    @MainActor\n    func testMultipleEnvironmentRealms() {\n        app.launchEnvironment[\"test_type\"] = \"multi_realm_test\"\n        app.launch()\n\n        app.buttons[\"Realm A\"].tap()\n        XCTAssertEqual(app.staticTexts[\"test_text_view\"].label, \"realm_a\")\n        app.buttons[\"Back\"].tap()\n\n        app.buttons[\"Realm B\"].tap()\n        XCTAssertEqual(app.staticTexts[\"test_text_view\"].label, \"realm_b\")\n        app.buttons[\"Back\"].tap()\n\n        app.buttons[\"Realm C\"].tap()\n        XCTAssertEqual(app.staticTexts[\"test_text_view\"].label, \"realm_c\")\n    }\n\n    @MainActor\n    func testUnmanagedObjectState() {\n        app.launchEnvironment[\"test_type\"] = \"unmanaged_object_test\"\n        app.launch()\n\n        app.textFields[\"name\"].tap()\n        app.textFields[\"name\"].typeText(deleteString(for: \"New List\"))\n        app.textFields[\"name\"].typeText(\"test name\")\n        app.navigationBars.firstMatch.tap()\n        app.buttons[\"addReminder\"].tap()\n        XCTAssertEqual(realm.objects(ReminderList.self).first!.name, \"test name\")\n\n        app.buttons[\"Next\"].tap()\n        app.buttons[\"Delete\"].tap()\n\n        XCTAssertEqual(app.textFields[\"name\"].value as? String, \"test name\")\n    }\n\n    @MainActor\n    func testKeyPathResults() {\n        app.launchEnvironment[\"test_type\"] = \"observed_results_key_path\"\n        app.launch()\n\n        let addButton = app.buttons[\"addList\"]\n        addButton.tap()\n        addButton.tap()\n\n        // Populate reminders to reminder list.\n        try! realm.write {\n            for obj in realm.objects(ReminderList.self) {\n                obj.reminders.append(Reminder())\n            }\n        }\n        // Change the name of two ReminderList objects.\n        // This is a separate write block because it's testing a change outside\n        // the keypath input.\n        try! realm.write {\n            for obj in realm.objects(ReminderList.self) {\n                obj.name = \"changed\"\n            }\n        }\n\n        // Expect the ui to still show two cells labelled New List.\n        // The view should've not updated because the name change was\n        // outside keypath input.\n        let cell0 = tables.firstMatch.cells.element(boundBy: 0)\n        let cell1 = tables.firstMatch.cells.element(boundBy: 1)\n        XCTAssert(cell0.staticTexts[\"New List\"].exists)\n        XCTAssert(cell1.staticTexts[\"New List\"].exists)\n        XCTAssertEqual(realm.objects(ReminderList.self).count, 2)\n        XCTAssertEqual(tables.firstMatch.cells.count, 2)\n\n        // Change isFlagged status of a linked reminder.\n        try! realm.write {\n            let first = realm.objects(ReminderList.self).first!\n            first.reminders[0].isFlagged = true\n        }\n\n        // Expect ui to refresh because the \"reminders.isFlagged\" keypath\n        // has been changed.\n        // Expect 2 cells now displaying \"changed\".\n        XCTAssert(cell0.staticTexts[\"changed\"].exists)\n        XCTAssert(cell1.staticTexts[\"changed\"].exists)\n        XCTAssertEqual(realm.objects(ReminderList.self).count, 2)\n        XCTAssertEqual(tables.firstMatch.cells.count, 2)\n    }\n\n    @MainActor\n    func testUpdateResultsWithSearchable() {\n        app.launchEnvironment[\"test_type\"] = \"observed_results_searchable\"\n        app.launch()\n        let addButton = app.buttons[\"addList\"]\n        // iOS 16 lazily-loads only the required number of cells. 13 happens to\n        // fit on-screen.\n        (1...7).forEach { _ in\n            addButton.tap()\n        }\n\n        // Name every reminders list for search\n        try! realm.write {\n            for (index, obj) in (realm.objects(ReminderList.self)).enumerated() {\n                obj.name = \"reminder list \\(index)\"\n            }\n        }\n\n        (1...5).forEach { _ in\n            addButton.tap()\n        }\n\n        func clearSearchBar() {\n            let searchBar = app.searchFields.firstMatch\n            let deleteString = String(repeating: XCUIKeyboardKey.delete.rawValue, count: (searchBar.value as? String)!.count)\n            searchBar.typeText(deleteString)\n        }\n\n        let table = tables.firstMatch\n\n        // Observed Results filter, should filter reminders without name.\n        XCTAssertEqual(table.cells.count, 7)\n\n        let searchBar = app.searchFields.firstMatch\n        searchBar.tap()\n\n        searchBar.typeText(\"reminder\")\n        XCTAssertEqual(table.cells.count, 7)\n\n        searchBar.typeText(\" list 1\")\n        XCTAssertEqual(table.cells.count, 1)\n\n        searchBar.typeText(\"2\")\n        XCTAssertEqual(table.cells.count, 0)\n\n        clearSearchBar()\n        app.navigationBars[\"Reminders\"].buttons[\"Cancel\"].tap()\n        XCTAssertEqual(table.cells.count, 7)\n\n        searchBar.tap()\n        searchBar.typeText(\"2\")\n        XCTAssertEqual(table.cells.count, 1)\n\n        clearSearchBar()\n        searchBar.typeText(\"11\")\n        XCTAssertEqual(table.cells.count, 0)\n    }\n\n    @MainActor\n    func testObservedResultsConfiguration() {\n        app.launchEnvironment[\"test_type\"] = \"observed_results_configuration\"\n        app.launch()\n\n        // Check that both @ObservedResults contain the correct configuration.\n        // `remindersA` will get it's config from .environment, while `remindersA`\n        // will get it's Realm config passed in the @ObservedResults initializer.\n        XCTAssertEqual(app.staticTexts[\"realm_a_label\"].label, \"realm_a\")\n        XCTAssertEqual(app.staticTexts[\"realm_b_label\"].label, \"realm_b\")\n\n        let addButtonA = app.buttons[\"addListA\"]\n        let addButtonB = app.buttons[\"addListB\"]\n        (1...5).forEach { _ in\n            addButtonA.tap()\n            addButtonB.tap()\n        }\n\n        let tableA = tables[\"ListA\"]\n        XCTAssertEqual(tableA.cells.count, 5)\n\n        let tableB = tables[\"ListB\"]\n        XCTAssertEqual(tableB.cells.count, 5)\n    }\n\n    @MainActor\n    func testKeyPathObservedSectionedResults() {\n        app.launchEnvironment[\"test_type\"] = \"observed_sectioned_results_key_path\"\n        app.launch()\n\n        let addButton = app.buttons[\"addList\"]\n        addButton.tap()\n        addButton.tap()\n\n        // Populate reminders to reminder list.\n        try! realm.write {\n            for obj in realm.objects(ReminderList.self) {\n                obj.reminders.append(Reminder())\n            }\n        }\n        // Change the name of two ReminderList objects.\n        // This is a separate write block because it's testing a change outside\n        // the keypath input.\n        try! realm.write {\n            for obj in realm.objects(ReminderList.self) {\n                obj.name = \"changed\"\n            }\n        }\n        // Expect the ui to still show two cells labelled New List.\n        // The view should've not updated because the name change was\n        // outside keypath input.\n        if #available(iOS 16, *) {\n            let sectionHeader = app.collectionViews.children(matching: .cell).element(boundBy: 0)\n            XCTAssert(sectionHeader.staticTexts[\"N\"].exists)\n            let cell0 = app.collectionViews.children(matching: .cell).element(boundBy: 1)\n            let cell1 = app.collectionViews.children(matching: .cell).element(boundBy: 2)\n            XCTAssert(cell0.staticTexts[\"New List\"].exists)\n            XCTAssert(cell1.staticTexts[\"New List\"].exists)\n        } else {\n            XCTAssert(app.tables.firstMatch.otherElements.staticTexts[\"N\"].exists)\n            let cell0 = app.tables.firstMatch.cells.element(boundBy: 0)\n            let cell1 = app.tables.firstMatch.cells.element(boundBy: 1)\n            XCTAssert(cell0.staticTexts[\"New List\"].exists)\n            XCTAssert(cell1.staticTexts[\"New List\"].exists)\n            XCTAssertEqual(app.tables.firstMatch.cells.count, 2)\n        }\n        XCTAssertEqual(realm.objects(ReminderList.self).count, 2)\n\n        // Change isFlagged status of a linked reminder.\n        try! realm.write {\n            let first = realm.objects(ReminderList.self).first!\n            first.reminders[0].isFlagged = true\n            let list = ReminderList()\n            list.name = \"Another List\"\n            realm.add(list)\n        }\n\n        // Expect ui to refresh because the \"reminders.isFlagged\" keypath\n        // has been changed.\n        // Expect 2 cells now displaying \"changed\".\n        // Expect two sections as another `ReminderList` has\n        // been inserted into the Realm.\n        if #available(iOS 16, *) {\n            let sectionHeader1 = app.collectionViews.children(matching: .cell).element(boundBy: 0)\n            XCTAssert(sectionHeader1.staticTexts[\"A\"].waitForExistence(timeout: 1.0))\n            let cell0 = app.collectionViews.children(matching: .cell).element(boundBy: 1)\n            XCTAssert(cell0.staticTexts[\"Another List\"].exists)\n            let sectionHeader2 = app.collectionViews.children(matching: .cell).element(boundBy: 2)\n            XCTAssert(sectionHeader2.staticTexts[\"c\"].exists)\n            let cell1 = app.collectionViews.children(matching: .cell).element(boundBy: 3)\n            let cell2 = app.collectionViews.children(matching: .cell).element(boundBy: 4)\n            XCTAssert(cell1.staticTexts[\"changed\"].exists)\n            XCTAssert(cell2.staticTexts[\"changed\"].exists)\n        } else {\n            XCTAssert(app.tables.otherElements.staticTexts[\"A\"].exists)\n            XCTAssert(app.tables.otherElements.staticTexts[\"c\"].exists)\n            let cell0 = app.tables.firstMatch.cells.element(boundBy: 0)\n            XCTAssert(cell0.staticTexts[\"Another List\"].exists)\n            let cell2 = app.tables.cells.element(boundBy: 1)\n            let cell3 = app.tables.cells.element(boundBy: 2)\n            XCTAssert(cell2.staticTexts[\"changed\"].exists)\n            XCTAssert(cell3.staticTexts[\"changed\"].exists)\n            XCTAssertEqual(app.tables.firstMatch.cells.count, 3)\n        }\n        XCTAssertEqual(realm.objects(ReminderList.self).count, 3)\n\n        let collectionViewsQuery = XCUIApplication().collectionViews\n        collectionViewsQuery.children(matching: .other).element(boundBy: 1).tap()\n        collectionViewsQuery.children(matching: .cell).element(boundBy: 1).children(matching: .other).element(boundBy: 1).children(matching: .other).element.swipeLeft()\n        collectionViewsQuery.buttons[\"Delete\"].tap()\n        XCTAssertEqual(realm.objects(ReminderList.self).count, 2)\n\n        collectionViewsQuery.children(matching: .other).element(boundBy: 2).tap()\n        collectionViewsQuery.children(matching: .cell).element(boundBy: 2).children(matching: .other).element(boundBy: 1).children(matching: .other).element.swipeLeft()\n        collectionViewsQuery.buttons[\"Delete\"].tap()\n        XCTAssertEqual(realm.objects(ReminderList.self).count, 1)\n\n        collectionViewsQuery.children(matching: .other).element(boundBy: 1).tap()\n        collectionViewsQuery.children(matching: .cell).element(boundBy: 1).children(matching: .other).element(boundBy: 1).children(matching: .other).element.swipeLeft()\n        collectionViewsQuery.buttons[\"Delete\"].tap()\n        XCTAssertEqual(realm.objects(ReminderList.self).count, 0)\n    }\n\n    @MainActor\n    func testKeyPathObservedSectionedResults2() {\n        // Tests ObservedSectionedResults ctor that uses the `sectionBlock` param.\n        app.launchEnvironment[\"test_type\"] = \"observed_sectioned_results_sort_descriptors\"\n        app.launch()\n\n        let addButton = app.buttons[\"addList\"]\n        addButton.tap()\n        addButton.tap()\n\n        // Populate reminders to reminder list.\n        try! realm.write {\n            for obj in realm.objects(ReminderList.self) {\n                obj.reminders.append(Reminder())\n            }\n        }\n        // Change the name of two ReminderList objects.\n        // This is a separate write block because it's testing a change outside\n        // the keypath input.\n        try! realm.write {\n            for obj in realm.objects(ReminderList.self) {\n                obj.name = \"changed\"\n            }\n        }\n\n        // Expect the ui to still show two cells labelled New List.\n        // The view should've not updated because the name change was\n        // outside keypath input.\n        if #available(iOS 16, *) {\n            let sectionHeader = app.collectionViews.children(matching: .cell).element(boundBy: 0)\n            XCTAssert(sectionHeader.staticTexts[\"N\"].exists)\n            let cell0 = app.collectionViews.children(matching: .cell).element(boundBy: 1)\n            let cell1 = app.collectionViews.children(matching: .cell).element(boundBy: 2)\n            XCTAssert(cell0.staticTexts[\"New List\"].exists)\n            XCTAssert(cell1.staticTexts[\"New List\"].exists)\n            XCTAssertEqual(realm.objects(ReminderList.self).count, 2)\n        } else {\n            XCTAssert(app.tables.firstMatch.otherElements.staticTexts[\"N\"].exists)\n            let cell0 = app.tables.firstMatch.cells.element(boundBy: 0)\n            let cell1 = app.tables.firstMatch.cells.element(boundBy: 1)\n            XCTAssert(cell0.staticTexts[\"New List\"].exists)\n            XCTAssert(cell1.staticTexts[\"New List\"].exists)\n            XCTAssertEqual(realm.objects(ReminderList.self).count, 2)\n            XCTAssertEqual(app.tables.firstMatch.cells.count, 2)\n        }\n\n        // Change isFlagged status of a linked reminder.\n        try! realm.write {\n            let first = realm.objects(ReminderList.self).first!\n            first.reminders[0].isFlagged = true\n            let list = ReminderList()\n            list.name = \"Another List\"\n            realm.add(list)\n        }\n\n        // Expect ui to refresh because the \"reminders.isFlagged\" keypath\n        // has been changed.\n        // Expect 2 cells now displaying \"changed\".\n        // Expect two sections as another `ReminderList` has\n        // been inserted into the Realm.\n        if #available(iOS 16, *) {\n            let sectionHeader1 = app.collectionViews.children(matching: .cell).element(boundBy: 0)\n            XCTAssert(sectionHeader1.staticTexts[\"A\"].waitForExistence(timeout: 1.0))\n            let cell0 = app.collectionViews.children(matching: .cell).element(boundBy: 1)\n            XCTAssert(cell0.staticTexts[\"Another List\"].exists)\n            let sectionHeader2 = app.collectionViews.children(matching: .cell).element(boundBy: 2)\n            XCTAssert(sectionHeader2.staticTexts[\"c\"].exists)\n            let cell1 = app.collectionViews.children(matching: .cell).element(boundBy: 3)\n            let cell2 = app.collectionViews.children(matching: .cell).element(boundBy: 4)\n            XCTAssert(cell1.staticTexts[\"changed\"].exists)\n            XCTAssert(cell2.staticTexts[\"changed\"].exists)\n        } else {\n            XCTAssert(app.tables.otherElements.staticTexts[\"A\"].exists)\n            XCTAssert(app.tables.otherElements.staticTexts[\"c\"].exists)\n            let cell0 = app.tables.firstMatch.cells.element(boundBy: 0)\n            XCTAssert(cell0.staticTexts[\"Another List\"].exists)\n            let cell2 = app.tables.cells.element(boundBy: 1)\n            let cell3 = app.tables.cells.element(boundBy: 2)\n            XCTAssert(cell2.staticTexts[\"changed\"].exists)\n            XCTAssert(cell3.staticTexts[\"changed\"].exists)\n            XCTAssertEqual(app.tables.firstMatch.cells.count, 3)\n        }\n        XCTAssertEqual(realm.objects(ReminderList.self).count, 3)\n    }\n\n    @MainActor\n    func testUpdateObservedSectionedResultsWithSearchable() {\n        app.launchEnvironment[\"test_type\"] = \"observed_sectioned_results_searchable\"\n        app.launch()\n\n        let addButton = app.buttons[\"addList\"]\n        (1...7).forEach { _ in\n            addButton.tap()\n        }\n\n        // Name every reminders list for search\n        try! realm.write {\n            for (index, obj) in (realm.objects(ReminderList.self)).enumerated() {\n                obj.name = \"reminder list \\(index)\"\n            }\n        }\n\n        (1...5).forEach { _ in\n            addButton.tap()\n        }\n\n        func clearSearchBar() {\n            let searchBar = app.searchFields.firstMatch\n            let deleteString = String(repeating: XCUIKeyboardKey.delete.rawValue, count: (searchBar.value as? String)!.count)\n            searchBar.typeText(deleteString)\n        }\n\n        if #available(iOS 16, *) {\n            let table = app.collectionViews.firstMatch\n\n            // iOS 16 will only report the visible cells.\n            let searchBar = app.searchFields.firstMatch\n            searchBar.tap()\n            XCTAssertEqual(table.cells.count, 8)\n\n            searchBar.typeText(\"5\")\n            XCTAssertEqual(table.cells.count, 2) // includes section header\n            XCTAssert(table.staticTexts[\"r\"].exists)\n        } else {\n            let table = app.tables.firstMatch\n\n            // Observed Results filter, should filter reminders without name.\n            XCTAssertEqual(table.cells.count, 7)\n\n            let searchBar = app.searchFields.firstMatch\n            searchBar.tap()\n\n            searchBar.typeText(\"reminder\")\n            XCTAssertEqual(table.cells.count, 7)\n            XCTAssert(app.tables.otherElements.staticTexts[\"r\"].exists)\n\n            searchBar.typeText(\" list 1\")\n            XCTAssertEqual(table.cells.count, 1)\n\n            searchBar.typeText(\"2\")\n            XCTAssertEqual(table.cells.count, 0)\n\n            clearSearchBar()\n            XCTAssertEqual(table.cells.count, 7)\n\n            searchBar.typeText(\"5\")\n            XCTAssertEqual(table.cells.count, 1)\n\n            clearSearchBar()\n            searchBar.typeText(\"12\")\n            XCTAssertEqual(table.cells.count, 0)\n        }\n    }\n\n    @MainActor\n    func testObservedSectionedResultsConfiguration() {\n        app.launchEnvironment[\"test_type\"] = \"observed_sectioned_results_configuration\"\n        app.launch()\n\n        // Check that both @ObservedResults contain the correct configuration.\n        // `remindersA` will get it's config from .environment, while `remindersA`\n        // will get it's Realm config passed in the @ObservedResults initializer.\n        XCTAssertEqual(app.staticTexts[\"realm_a_label\"].label, \"realm_a\")\n        XCTAssertEqual(app.staticTexts[\"realm_b_label\"].label, \"realm_b\")\n\n        let addButtonA = app.buttons[\"addListA\"]\n        let addButtonB = app.buttons[\"addListB\"]\n        (1...5).forEach { _ in\n            addButtonA.tap()\n            addButtonB.tap()\n        }\n\n        if #available(iOS 16, *) {\n            let tableA = app.collectionViews.element(boundBy: 0)\n            XCTAssert(tableA.otherElements.staticTexts[\"N\"].exists)\n            XCTAssertEqual(tableA.cells.count, 6) // includes section header\n\n            let tableB = app.collectionViews.element(boundBy: 1)\n            XCTAssert(tableB.otherElements.staticTexts[\"N\"].exists)\n            XCTAssertEqual(tableB.cells.count, 6)\n        } else {\n            let tableA = app.tables[\"ListA\"]\n            XCTAssert(tableA.otherElements.staticTexts[\"N\"].exists)\n            XCTAssertEqual(tableA.cells.count, 5)\n\n            let tableB = app.tables[\"ListB\"]\n            XCTAssert(tableB.otherElements.staticTexts[\"N\"].exists)\n            XCTAssertEqual(tableB.cells.count, 5)\n        }\n    }\n}\n"
  },
  {
    "path": "Realm/Tests/TestHost/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>NSPrincipalClass</key>\n\t<string>$(PRINCIPAL_CLASS)</string>\n\t<key>LSUIElement</key>\n\t<true/>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n\t<key>NSAppTransportSecurity</key>\n\t<dict>\n\t\t<key>NSAllowsArbitraryLoads</key>\n\t\t<true/>\n\t</dict>\n</dict>\n</plist>\n"
  },
  {
    "path": "Realm/Tests/TestHost/main.m",
    "content": "//\n//  main.m\n//  TestHost\n//\n//  Created by Thomas Goyne on 8/6/14.\n//  Copyright (c) 2014 Realm. All rights reserved.\n//\n\n#import <TargetConditionals.h>\n\n#if TARGET_OS_WATCH\n\n// watchOS doesn't support testing at this time.\nint main(int argc, const char *argv[]) {\n}\n\n#elif TARGET_OS_IPHONE || TARGET_OS_TV || TARGET_OS_MACCATALYST\n\n#import <UIKit/UIKit.h>\n\n@interface RLMAppDelegate : UIResponder <UIApplicationDelegate>\n@property (strong, nonatomic) UIWindow *window;\n@end\n\n@implementation RLMAppDelegate\n@end\n\nint main(int argc, char *argv[]) {\n    @autoreleasepool {\n        return UIApplicationMain(argc, argv, NSStringFromClass([UIApplication class]), NSStringFromClass([RLMAppDelegate class]));\n    }\n}\n\n#else\n\n#import <Cocoa/Cocoa.h>\n\nint main(int argc, const char *argv[]) {\n    @autoreleasepool {\n        return NSApplicationMain(argc, argv);\n    }\n}\n\n#endif\n"
  },
  {
    "path": "Realm/Tests/ThreadSafeReferenceTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2016 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#import \"RLMRealmConfiguration_Private.h\"\n#import \"RLMThreadSafeReference.h\"\n\n@interface ThreadSafeReferenceTests : RLMTestCase\n\n@end\n\n@implementation ThreadSafeReferenceTests\n\n/// Resolve a thread-safe reference confirming that you can't resolve it a second time.\n- (id)assertResolve:(RLMRealm *)realm reference:(RLMThreadSafeReference *)reference {\n    XCTAssertFalse(reference.isInvalidated);\n    id object = [realm resolveThreadSafeReference:reference];\n    XCTAssertTrue(reference.isInvalidated);\n    RLMAssertThrowsWithReasonMatching([realm resolveThreadSafeReference:reference],\n                                      @\"Can only resolve a thread safe reference once\");\n    return object;\n}\n\n- (void)testInvalidThreadSafeReferenceConstruction {\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.cache = false;\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:configuration error:nil];\n\n    StringObject *stringObject = [[StringObject alloc] init];\n    ArrayPropertyObject *arrayParent = [[ArrayPropertyObject alloc] initWithValue:@[@\"arrayObject\", @[@[@\"a\"]], @[]]];\n    RLMArray *arrayObject = arrayParent.array;\n\n    RLMAssertThrowsWithReasonMatching([RLMThreadSafeReference referenceWithThreadConfined:stringObject],\n                                      @\"Cannot construct reference to unmanaged object\");\n    RLMAssertThrowsWithReasonMatching([RLMThreadSafeReference referenceWithThreadConfined:arrayObject],\n                                      @\"Cannot construct reference to unmanaged object\");\n\n    [realm beginWriteTransaction];\n    [realm addObject:stringObject];\n    [realm addObject:arrayParent];\n    arrayObject = arrayParent.array;\n    [realm deleteAllObjects];\n    [realm commitWriteTransaction];\n\n    RLMAssertThrowsWithReasonMatching([RLMThreadSafeReference referenceWithThreadConfined:stringObject],\n                                      @\"Cannot construct reference to invalidated object\");\n    RLMAssertThrowsWithReasonMatching([RLMThreadSafeReference referenceWithThreadConfined:arrayObject],\n                                      @\"Cannot construct reference to invalidated object\");\n}\n\n- (void)testInvalidThreadSafeReferenceUsage {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm beginWriteTransaction];\n    StringObject *stringObject = [StringObject createInDefaultRealmWithValue:@{@\"stringCol\": @\"hello\"}];\n    RLMThreadSafeReference *ref1 = [RLMThreadSafeReference referenceWithThreadConfined:stringObject];\n    [realm commitWriteTransaction];\n\n    RLMThreadSafeReference *ref2 = [RLMThreadSafeReference referenceWithThreadConfined:stringObject];\n    RLMThreadSafeReference *ref3 = [RLMThreadSafeReference referenceWithThreadConfined:stringObject];\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        XCTAssertNil([[self realmWithTestPath] resolveThreadSafeReference:ref1]);\n        XCTAssertNoThrow([realm resolveThreadSafeReference:ref2]);\n        RLMAssertThrowsWithReasonMatching([realm resolveThreadSafeReference:ref2],\n                                          @\"Can only resolve a thread safe reference once\");\n        // Assert that we can resolve a different reference to the same object.\n        XCTAssertEqualObjects([self assertResolve:realm reference:ref3][@\"stringCol\"], @\"hello\");\n    }];\n}\n\n- (void)testPassThreadSafeReferenceToDeletedObject {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    IntObject *intObject = [[IntObject alloc] init];\n    [realm transactionWithBlock:^{\n        [realm addObject:intObject];\n    }];\n\n    RLMThreadSafeReference *ref1 = [RLMThreadSafeReference referenceWithThreadConfined:intObject];\n    RLMThreadSafeReference *ref2 = [RLMThreadSafeReference referenceWithThreadConfined:intObject];\n    XCTAssertEqual(0, intObject.intCol);\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm transactionWithBlock:^{\n            [realm deleteAllObjects];\n        }];\n    }];\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        XCTAssertEqualObjects([self assertResolve:realm reference:ref1][@\"intCol\"], @0);\n        [realm refresh];\n        XCTAssertNil([self assertResolve:realm reference:ref2]);\n    }];\n}\n\n- (void)testPassThreadSafeReferencesToMultipleObjects {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    StringObject *stringObject = [[StringObject alloc] init];\n    IntObject *intObject = [[IntObject alloc] init];\n    [realm transactionWithBlock:^{\n        [realm addObject:stringObject];\n        [realm addObject:intObject];\n    }];\n\n    RLMThreadSafeReference *stringObjectRef = [RLMThreadSafeReference referenceWithThreadConfined:stringObject];\n    RLMThreadSafeReference *intObjectRef = [RLMThreadSafeReference referenceWithThreadConfined:intObject];\n    XCTAssertEqualObjects(nil, stringObject.stringCol);\n    XCTAssertEqual(0, intObject.intCol);\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        StringObject *stringObject = [self assertResolve:realm reference:stringObjectRef];\n        IntObject *intObject = [self assertResolve:realm reference:intObjectRef];\n\n        [realm transactionWithBlock:^{\n            stringObject.stringCol = @\"the meaning of life\";\n            intObject.intCol = 42;\n        }];\n    }];\n    XCTAssertEqualObjects(nil, stringObject.stringCol);\n    XCTAssertEqual(0, intObject.intCol);\n    [realm refresh];\n    XCTAssertEqualObjects(@\"the meaning of life\", stringObject.stringCol);\n    XCTAssertEqual(42, intObject.intCol);\n}\n\n- (void)testPassThreadSafeReferenceToArray {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    DogArrayObject *object = [[DogArrayObject alloc] init];\n    [realm transactionWithBlock:^{\n        [realm addObject:object];\n        DogObject *friday = [DogObject createInDefaultRealmWithValue:@{@\"dogName\": @\"Friday\", @\"age\": @15}];\n        [object.dogs addObject:friday];\n    }];\n    RLMThreadSafeReference *dogsArrayRef = [RLMThreadSafeReference referenceWithThreadConfined:object.dogs];\n    XCTAssertEqual(1ul, object.dogs.count);\n    XCTAssertEqualObjects(@\"Friday\", object.dogs[0].dogName);\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        RLMArray<DogObject *> *dogs = [self assertResolve:realm reference:dogsArrayRef];\n        XCTAssertEqual(1ul, dogs.count);\n        XCTAssertEqualObjects(@\"Friday\", dogs[0].dogName);\n\n        [realm transactionWithBlock:^{\n            [dogs removeAllObjects];\n            DogObject *cookie = [DogObject createInDefaultRealmWithValue:@{@\"dogName\": @\"Cookie\", @\"age\": @8}];\n            DogObject *breezy = [DogObject createInDefaultRealmWithValue:@{@\"dogName\": @\"Breezy\", @\"age\": @6}];\n            [dogs addObjects:@[cookie, breezy]];\n        }];\n        XCTAssertEqual(2ul, dogs.count);\n        XCTAssertEqualObjects(@\"Cookie\", dogs[0].dogName);\n        XCTAssertEqualObjects(@\"Breezy\", dogs[1].dogName);\n    }];\n    XCTAssertEqual(1ul, object.dogs.count);\n    XCTAssertEqualObjects(@\"Friday\", object.dogs[0].dogName);\n    [realm refresh];\n    XCTAssertEqual(2ul, object.dogs.count);\n    XCTAssertEqualObjects(@\"Cookie\", object.dogs[0].dogName);\n    XCTAssertEqualObjects(@\"Breezy\", object.dogs[1].dogName);\n}\n\n- (void)testPassThreadSafeReferenceToResults {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    RLMResults<StringObject *> *allObjects = [StringObject allObjects];\n    RLMResults<StringObject *> *results = [[StringObject objectsWhere:@\"stringCol != 'C'\"]\n                                           sortedResultsUsingKeyPath:@\"stringCol\" ascending:NO];\n    RLMThreadSafeReference *resultsRef = [RLMThreadSafeReference referenceWithThreadConfined:results];\n    [realm transactionWithBlock:^{\n        [StringObject createInDefaultRealmWithValue:@[@\"A\"]];\n        [StringObject createInDefaultRealmWithValue:@[@\"B\"]];\n        [StringObject createInDefaultRealmWithValue:@[@\"C\"]];\n        [StringObject createInDefaultRealmWithValue:@[@\"D\"]];\n    }];\n    XCTAssertEqual(4ul, allObjects.count);\n    XCTAssertEqual(3ul, results.count);\n    XCTAssertEqualObjects(@\"D\", results[0].stringCol);\n    XCTAssertEqualObjects(@\"B\", results[1].stringCol);\n    XCTAssertEqualObjects(@\"A\", results[2].stringCol);\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        RLMResults<StringObject *> *results = [self assertResolve:realm reference:resultsRef];\n        RLMResults<StringObject *> *allObjects = [StringObject allObjects];\n        XCTAssertEqual(0ul, [StringObject allObjects].count);\n        XCTAssertEqual(0ul, results.count);\n        [realm refresh];\n        XCTAssertEqual(4ul, allObjects.count);\n        XCTAssertEqual(3ul, results.count);\n        XCTAssertEqualObjects(@\"D\", results[0].stringCol);\n        XCTAssertEqualObjects(@\"B\", results[1].stringCol);\n        XCTAssertEqualObjects(@\"A\", results[2].stringCol);\n        [realm transactionWithBlock:^{\n            [realm deleteObject:results[2]];\n            [realm deleteObject:results[0]];\n            [StringObject createInDefaultRealmWithValue:@[@\"E\"]];\n        }];\n        XCTAssertEqual(3ul, allObjects.count);\n        XCTAssertEqual(2ul, results.count);\n        XCTAssertEqualObjects(@\"E\", results[0].stringCol);\n        XCTAssertEqualObjects(@\"B\", results[1].stringCol);\n    }];\n    XCTAssertEqual(4ul, allObjects.count);\n    XCTAssertEqual(3ul, results.count);\n    XCTAssertEqualObjects(@\"D\", results[0].stringCol);\n    XCTAssertEqualObjects(@\"B\", results[1].stringCol);\n    XCTAssertEqualObjects(@\"A\", results[2].stringCol);\n    [realm refresh];\n    XCTAssertEqual(3ul, allObjects.count);\n    XCTAssertEqual(2ul, results.count);\n    XCTAssertEqualObjects(@\"E\", results[0].stringCol);\n    XCTAssertEqualObjects(@\"B\", results[1].stringCol);\n}\n\n- (void)testPassThreadSafeReferenceToLinkingObjects {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    DogObject *dogA = [[DogObject alloc] initWithValue:@{@\"dogName\": @\"Cookie\", @\"age\": @10}];\n    DogObject *unaccessedDogB = [[DogObject alloc] initWithValue:@{@\"dogName\": @\"Skipper\", @\"age\": @7}];\n    // Ensures that an `RLMLinkingObjects` without cached results can be handed over\n\n    [realm transactionWithBlock:^{\n        [realm addObject:[[OwnerObject alloc] initWithValue:@{@\"name\": @\"Andrea\", @\"dog\": dogA}]];\n        [realm addObject:[[OwnerObject alloc] initWithValue:@{@\"name\": @\"Mike\", @\"dog\": unaccessedDogB}]];\n    }];\n    XCTAssertEqual(1ul, dogA.owners.count);\n    XCTAssertEqualObjects(@\"Andrea\", ((OwnerObject *)dogA.owners[0]).name);\n    RLMThreadSafeReference *ownersARef = [RLMThreadSafeReference referenceWithThreadConfined:dogA.owners];\n    RLMThreadSafeReference *ownersBRef = [RLMThreadSafeReference referenceWithThreadConfined:unaccessedDogB.owners];\n    [self dispatchAsyncAndWait:^{\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        RLMLinkingObjects<OwnerObject *> *ownersA = [self assertResolve:realm reference:ownersARef];\n        RLMLinkingObjects<OwnerObject *> *ownersB = [self assertResolve:realm reference:ownersBRef];\n\n        XCTAssertEqual(1ul, ownersA.count);\n        XCTAssertEqualObjects(@\"Andrea\", ((OwnerObject *)ownersA[0]).name);\n        XCTAssertEqual(1ul, ownersB.count);\n        XCTAssertEqualObjects(@\"Mike\", ((OwnerObject *)ownersB[0]).name);\n\n        [realm transactionWithBlock:^{\n            // Swap dogs\n            OwnerObject *ownerA = ownersA[0];\n            OwnerObject *ownerB = ownersB[0];\n            DogObject *dogA = ownerA.dog;\n            DogObject *dogB = ownerB.dog;\n            ownerA.dog = dogB;\n            ownerB.dog = dogA;\n        }];\n        XCTAssertEqual(1ul, ownersA.count);\n        XCTAssertEqualObjects(@\"Mike\", ((OwnerObject *)ownersA[0]).name);\n        XCTAssertEqual(1ul, ownersB.count);\n        XCTAssertEqualObjects(@\"Andrea\", ((OwnerObject *)ownersB[0]).name);\n    }];\n    XCTAssertEqual(1ul, dogA.owners.count);\n    XCTAssertEqualObjects(@\"Andrea\", ((OwnerObject *)dogA.owners[0]).name);\n    XCTAssertEqual(1ul, unaccessedDogB.owners.count);\n    XCTAssertEqualObjects(@\"Mike\", ((OwnerObject *)unaccessedDogB.owners[0]).name);\n    [realm refresh];\n    XCTAssertEqual(1ul, dogA.owners.count);\n    XCTAssertEqualObjects(@\"Mike\", ((OwnerObject *)dogA.owners[0]).name);\n    XCTAssertEqual(1ul, unaccessedDogB.owners.count);\n    XCTAssertEqualObjects(@\"Andrea\", ((OwnerObject *)unaccessedDogB.owners[0]).name);\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/TransactionTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n@interface TransactionTests : RLMTestCase\n@end\n\n@implementation TransactionTests\n\n- (void)testRealmModifyObjectsOutsideOfWriteTransaction\n{\n    RLMRealm *realm = [self realmWithTestPath];\n    [realm beginWriteTransaction];\n    StringObject *obj = [StringObject createInRealm:realm withValue:@[@\"a\"]];\n    [realm commitWriteTransaction];\n\n    XCTAssertThrows([obj setStringCol:@\"throw\"], @\"Setter should throw when called outside of transaction.\");\n}\n\n- (void)testTransactionMisuse\n{\n    RLMRealm *realm = [RLMRealm defaultRealm];\n\n    // Insert an object\n    [realm beginWriteTransaction];\n    StringObject *obj = [StringObject createInRealm:realm withValue:@[@\"a\"]];\n    [realm commitWriteTransaction];\n\n    XCTAssertThrows([StringObject createInRealm:realm withValue:@[@\"a\"]], @\"Outside write transaction\");\n    XCTAssertThrows([realm commitWriteTransaction], @\"No write transaction to close\");\n\n    [realm beginWriteTransaction];\n    XCTAssertThrows([realm beginWriteTransaction], @\"Write transaction already in place\");\n    [realm commitWriteTransaction];\n\n    XCTAssertThrows([realm deleteObject:obj], @\"Outside writetransaction\");\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/UnicodeTests.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\nNSString * const kUTF8TestString = @\"值значен™👍☞⎠‱௹♣︎☐▼❒∑⨌⧭иеمرحبا\";\n\n@interface UnicodeTests : RLMTestCase\n@end\n\n@implementation UnicodeTests\n\n- (void)testUTF8StringContents\n{\n    RLMRealm *realm = self.realmWithTestPath;\n\n    [realm beginWriteTransaction];\n    [StringObject createInRealm:realm withValue:@[kUTF8TestString]];\n    [realm commitWriteTransaction];\n\n    StringObject *obj1 = [[StringObject allObjectsInRealm:realm] firstObject];\n    XCTAssertEqualObjects(obj1.stringCol, kUTF8TestString, @\"Storing and retrieving a string with UTF8 content should work\");\n\n    StringObject *obj2 = [[StringObject objectsInRealm:realm where:@\"stringCol == %@\", kUTF8TestString] firstObject];\n    XCTAssertTrue([obj1 isEqualToObject:obj2], @\"Querying a realm searching for a string with UTF8 content should work\");\n}\n\n- (void)testUTF8PropertyWithUTF8StringContents\n{\n    RLMRealm *realm = self.realmWithTestPath;\n\n    [realm beginWriteTransaction];\n    [UTF8Object createInRealm:realm withValue:@[kUTF8TestString]];\n    [realm commitWriteTransaction];\n\n    UTF8Object *obj1 = [[UTF8Object allObjectsInRealm:realm] firstObject];\n    XCTAssertEqualObjects(obj1.柱колоéнǢкƱаم, kUTF8TestString, @\"Storing and retrieving a string with UTF8 content should work\");\n\n    // Test fails because of rdar://17735684\n    // NSPredicate does not support UTF8 keypaths\n//    UTF8Object *obj2 = [[StringObject objectsInRealm:realm where:@\"柱колоéнǢкƱаم == %@\", kUTF8TestString] firstObject];\n//    XCTAssertEqualObjects(obj1, obj2, @\"Querying a realm searching for a string with UTF8 content should work\");\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/UtilTests.mm",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMTestCase.h\"\n\n#import \"RLMConstants.h\"\n#import \"RLMUtil.hpp\"\n\n#ifndef REALM_COCOA_VERSION\n#import \"RLMVersion.h\"\n#endif\n\n@interface UtilTests : RLMTestCase\n@end\n\nstatic BOOL RLMEqualExceptions(NSException *actual, NSException *expected) {\n    return [actual.name isEqualToString:expected.name]\n        && [actual.reason isEqualToString:expected.reason]\n        && [actual.userInfo isEqual:expected.userInfo];\n}\n\n@implementation UtilTests\n\n- (void)testRLMExceptionWithReasonAndUserInfo {\n    NSString *const reason = @\"Reason\";\n    NSDictionary *expectedUserInfo = @{RLMRealmVersionKey: REALM_COCOA_VERSION,\n                                       RLMRealmCoreVersionKey: @REALM_VERSION};\n\n    XCTAssertTrue(RLMEqualExceptions(RLMException(reason),\n                                     [NSException exceptionWithName:RLMExceptionName reason:reason userInfo:expectedUserInfo]));\n}\n\n- (void)testRLMExceptionWithCPlusPlusException {\n    std::runtime_error exception(\"Reason\");\n    NSDictionary *expectedUserInfo = @{RLMRealmVersionKey: REALM_COCOA_VERSION,\n                                       RLMRealmCoreVersionKey: @REALM_VERSION};\n\n    XCTAssertTrue(RLMEqualExceptions(RLMException(exception),\n                                     [NSException exceptionWithName:RLMExceptionName reason:@\"Reason\" userInfo:expectedUserInfo]));\n}\n\n- (void)testRLMSetErrorOrThrowWithNilErrorPointer {\n    NSError *error = [NSError errorWithDomain:RLMErrorDomain code:RLMErrorFail userInfo:nil];\n\n    XCTAssertThrows(RLMSetErrorOrThrow(error, nil));\n}\n\n- (void)testRLMSetErrorOrThrowWithErrorPointer {\n    NSError *error = [NSError errorWithDomain:RLMErrorDomain code:RLMErrorFail userInfo:nil];\n    NSError *outError = nil;\n\n    XCTAssertNoThrow(RLMSetErrorOrThrow(error, &outError));\n    XCTAssertEqualObjects(error, outError);\n}\n\n@end\n"
  },
  {
    "path": "Realm/Tests/array_tests.py",
    "content": "import os, re\n\n# Tags:\n# (no)minmax: Type supports min() and max()\n# (no)comp: Type supports comparison operators\n# (no)sum: Type supports sum()\n# (no)avg: Type supports average()\n# r/o: Type is Required or Optional\n# (un)man: Type is Managed or Unmanaged\n# (no)any: Can accept any type\n\ntypes = [\n  # Class, Object, Property, Values, Tags\n  ['AllPrimitiveArrays', 'unmanaged', 'boolObj', ['@NO', '@YES'], {'r', 'unman'}],\n  ['AllPrimitiveArrays', 'unmanaged', 'intObj', ['@2', '@3'], {'r', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveArrays', 'unmanaged', 'floatObj', ['@2.2f', '@3.3f'], {'r', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveArrays', 'unmanaged', 'doubleObj', ['@2.2', '@3.3'], {'r', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveArrays', 'unmanaged', 'stringObj', ['@\"a\"', '@\"b\"'], {'r', 'unman', 'string', 'comp'}],\n  ['AllPrimitiveArrays', 'unmanaged', 'dataObj', ['data(1)', 'data(2)'], {'r', 'unman', 'comp'}],\n  ['AllPrimitiveArrays', 'unmanaged', 'dateObj', ['date(1)', 'date(2)'], {'r', 'minmax', 'comp', 'unman', 'date'}],\n  ['AllPrimitiveArrays', 'unmanaged', 'decimalObj', ['decimal128(2)', 'decimal128(3)'], {'r', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveArrays', 'unmanaged', 'objectIdObj', ['objectId(1)', 'objectId(2)'], {'r', 'unman'}],\n  ['AllPrimitiveArrays', 'unmanaged', 'uuidObj', ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")'], ['r','unman']],\n  ['AllPrimitiveArrays', 'unmanaged', 'anyBoolObj', ['@NO', '@YES'], {'any', 'unman'}],\n  ['AllPrimitiveArrays', 'unmanaged', 'anyIntObj', ['@2', '@3'], {'any', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveArrays', 'unmanaged', 'anyFloatObj', ['@2.2f', '@3.3f'], {'any', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveArrays', 'unmanaged', 'anyDoubleObj', ['@2.2', '@3.3'], {'any', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveArrays', 'unmanaged', 'anyStringObj', ['@\"a\"', '@\"b\"'], {'any', 'unman', 'string', 'comp'}],\n  ['AllPrimitiveArrays', 'unmanaged', 'anyDataObj', ['data(1)', 'data(2)'], {'any', 'unman', 'comp'}],\n  ['AllPrimitiveArrays', 'unmanaged', 'anyDateObj', ['date(1)', 'date(2)'], {'any', 'minmax', 'comp', 'unman', 'date'}],\n  ['AllPrimitiveArrays', 'unmanaged', 'anyDecimalObj', ['decimal128(2)', 'decimal128(3)'], {'any', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveArrays', 'unmanaged', 'anyObjectIdObj', ['objectId(1)', 'objectId(2)'], {'any', 'unman'}],\n  ['AllPrimitiveArrays', 'unmanaged', 'anyUUIDObj', ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")'], ['any','unman']],\n\n  ['AllOptionalPrimitiveArrays', 'optUnmanaged', 'boolObj', ['@NO', '@YES', 'NSNull.null'], {'o', 'unman'}],\n  ['AllOptionalPrimitiveArrays', 'optUnmanaged', 'intObj', ['@2', '@3', 'NSNull.null'], {'o', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllOptionalPrimitiveArrays', 'optUnmanaged', 'floatObj', ['@2.2f', '@3.3f', 'NSNull.null'], {'o', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllOptionalPrimitiveArrays', 'optUnmanaged', 'doubleObj', ['@2.2', '@3.3', 'NSNull.null'], {'o', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllOptionalPrimitiveArrays', 'optUnmanaged', 'stringObj', ['@\"a\"', '@\"b\"', 'NSNull.null'], {'o', 'unman', 'string', 'comp'}],\n  ['AllOptionalPrimitiveArrays', 'optUnmanaged', 'dataObj', ['data(1)', 'data(2)', 'NSNull.null'], {'o', 'unman', 'comp'}],\n  ['AllOptionalPrimitiveArrays', 'optUnmanaged', 'dateObj', ['date(1)', 'date(2)', 'NSNull.null'], {'o', 'minmax', 'comp', 'unman', 'date'}],\n  ['AllOptionalPrimitiveArrays', 'optUnmanaged', 'decimalObj', ['decimal128(2)', 'decimal128(3)', 'NSNull.null'], {'o', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllOptionalPrimitiveArrays', 'optUnmanaged', 'objectIdObj', ['objectId(1)', 'objectId(2)', 'NSNull.null'], {'o', 'unman'}],\n  ['AllOptionalPrimitiveArrays', 'optUnmanaged', 'uuidObj', ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")', 'NSNull.null'], ['o', 'unman']],\n  ['AllPrimitiveArrays', 'managed', 'boolObj', ['@NO', '@YES'], {'r', 'man'}],\n  ['AllPrimitiveArrays', 'managed', 'intObj', ['@2', '@3'], {'r', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllPrimitiveArrays', 'managed', 'floatObj', ['@2.2f', '@3.3f'], {'r', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllPrimitiveArrays', 'managed', 'doubleObj', ['@2.2', '@3.3'], {'r', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllPrimitiveArrays', 'managed', 'stringObj', ['@\"a\"', '@\"b\"'], {'r', 'man', 'string', 'comp'}],\n  ['AllPrimitiveArrays', 'managed', 'dataObj', ['data(1)', 'data(2)'], {'r', 'man', 'comp'}],\n  ['AllPrimitiveArrays', 'managed', 'dateObj', ['date(1)', 'date(2)'], {'r', 'minmax', 'comp', 'man', 'date'}],\n  ['AllPrimitiveArrays', 'managed', 'decimalObj', ['decimal128(2)', 'decimal128(3)'], {'r', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllPrimitiveArrays', 'managed', 'objectIdObj', ['objectId(1)', 'objectId(2)'], {'r', 'man'}],\n  ['AllPrimitiveArrays', 'managed', 'uuidObj', ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")'], ['r', 'man']],\n  ['AllPrimitiveArrays', 'managed', 'anyBoolObj', ['@NO', '@YES'], {'any', 'man'}],\n  ['AllPrimitiveArrays', 'managed', 'anyIntObj', ['@2', '@3'], {'any', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllPrimitiveArrays', 'managed', 'anyFloatObj', ['@2.2f', '@3.3f'], {'any', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllPrimitiveArrays', 'managed', 'anyDoubleObj', ['@2.2', '@3.3'], {'any', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllPrimitiveArrays', 'managed', 'anyStringObj', ['@\"a\"', '@\"b\"'], {'any', 'man', 'string', 'comp'}],\n  ['AllPrimitiveArrays', 'managed', 'anyDataObj', ['data(1)', 'data(2)'], {'any', 'man', 'comp'}],\n  ['AllPrimitiveArrays', 'managed', 'anyDateObj', ['date(1)', 'date(2)'], {'any', 'minmax', 'comp', 'man', 'date'}],\n  ['AllPrimitiveArrays', 'managed', 'anyDecimalObj', ['decimal128(2)', 'decimal128(3)'], {'any', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllPrimitiveArrays', 'managed', 'anyObjectIdObj', ['objectId(1)', 'objectId(2)'], {'any', 'man'}],\n  ['AllPrimitiveArrays', 'managed', 'anyUUIDObj', ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")'], ['any', 'man']],\n\n  ['AllOptionalPrimitiveArrays', 'optManaged', 'boolObj', ['@NO', '@YES', 'NSNull.null'], {'o', 'man'}],\n  ['AllOptionalPrimitiveArrays', 'optManaged', 'intObj', ['@2', '@3', 'NSNull.null'], {'o', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllOptionalPrimitiveArrays', 'optManaged', 'floatObj', ['@2.2f', '@3.3f', 'NSNull.null'], {'o', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllOptionalPrimitiveArrays', 'optManaged', 'doubleObj', ['@2.2', '@3.3', 'NSNull.null'], {'o', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllOptionalPrimitiveArrays', 'optManaged', 'stringObj', ['@\"a\"', '@\"b\"', 'NSNull.null'], {'o', 'man', 'string', 'comp'}],\n  ['AllOptionalPrimitiveArrays', 'optManaged', 'dataObj', ['data(1)', 'data(2)', 'NSNull.null'], {'o', 'man', 'comp'}],\n  ['AllOptionalPrimitiveArrays', 'optManaged', 'dateObj', ['date(1)', 'date(2)', 'NSNull.null'], {'o', 'minmax', 'comp', 'man', 'date'}],\n  ['AllOptionalPrimitiveArrays', 'optManaged', 'decimalObj', ['decimal128(2)', 'decimal128(3)', 'NSNull.null'], {'o', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllOptionalPrimitiveArrays', 'optManaged', 'objectIdObj', ['objectId(1)', 'objectId(2)', 'NSNull.null'], {'o', 'man'}],\n  ['AllOptionalPrimitiveArrays', 'optManaged', 'uuidObj', ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")', 'NSNull.null'], ['o', 'man']]\n]\n\ndef type_name(propertyName, optional):\n    if 'any' in propertyName:\n        return 'mixed'\n    return propertyName.replace('Obj', '') + ('?' if 'opt' in optional else '')\n\ntypes = [{'class': t[0], 'obj': t[1], 'prop': t[2], 'v0': t[3][0], 'v1': t[3][1],\n          'array': t[1] + '.' + t[2],\n          'values2': '@[' + ', '.join(t[3] * 2) + ']',\n          'values': '@[' + ', '.join(t[3]) + ']',\n          'first': t[3][0], 'last': t[3][2] if len(t[3]) == 3 else t[3][1],\n          'wrong': '@\"a\"', 'wdesc': 'a', 'wtype': 'RLMConstantString',\n          'type': type_name(t[2], t[1]),\n          'tags': set(t[4]),\n          }\n         for t in types]\n\n# Add negative tags to all types\nall_tags = set()\nfor t in types:\n    all_tags |= t['tags']\nfor t in types:\n    for missing in all_tags - t['tags']:\n        t['tags'].add('no' + missing)\n\n# For testing error handling we need a value of the wrong type. By default this\n# is a string, so for string types we need to set it to a number instead\nfor string_type in (t for t in types if 'string' in t['tags']):\n    string_type['wrong'] = '@2'\n    string_type['wdesc'] = '2'\n    string_type['wtype'] = 'RLMConstantInt'\n\n# We extract the type name from the property name, but object id and decimal128\n# don't have names that work for this\nfor type in types:\n    type['type'] = type['type'].replace('objectId', 'object id').replace('decimal', 'decimal128')\n    type['basetype'] = type['type'].replace('?', '')\n\nfile = open(os.path.dirname(__file__) + '/PrimitiveArrayPropertyTests.tpl.m', 'rt')\nfor line in file:\n    # Lines without anything to expand just appear as-is\n    if not '$' in line:\n        print(line, end='')\n        continue\n\n    if '$allArrays' in line:\n        line = line.replace(' ^n', '\\n' + ' ' * (line.find('(') + 4))\n        print('    for (RLMArray *array in allArrays) {\\n    ' + line.replace('$allArrays', 'array') + '    }')\n        continue\n\n    filtered_types = types\n    start = 0\n    end = len(types)\n    # Limit the types to the ones which match all of the tags present in the\n    # line, then remove the tags from the line\n    for tag in re.findall(r'\\%([a-z]+)', line):\n        filtered_types = [t for t in filtered_types if tag in t['tags']]\n        line = line.replace('%' + tag + ' ', '')\n\n    # Places where we want multiple output lines from one input line use ^nl\n    # for subsequent statements and ^n for things which should be indented within\n    # parentheses. This is a pretty half-hearted attempt at producing properly\n    # indented output.\n    line = line.replace(' ^nl ', '\\n    ')\n    line = line.replace(' ^n', '\\n' + ' ' * line.find('('))\n\n    # Repeat each line for each type, replacing variables with values from the dictionary\n    for t in filtered_types:\n        l = line\n        for k, v in t.items():\n            if k in l:\n                l = l.replace('$' + k, v)\n        print(l, end='')\n"
  },
  {
    "path": "Realm/Tests/dictionary_tests.py",
    "content": "import os, re\n\n# Tags:\n# (no)minmax: Type supports min() and max()\n# (no)comp: Type supports comparison operators\n# (no)sum: Type supports sum()\n# (no)avg: Type supports average()\n# r/o: Type is Required or Optional\n# (un)man: Type is Managed or Unmanaged\n\ntypes = [\n  # Class, Object, Property, Keys, Values, Tags\n  # Bool\n  ['AllPrimitiveDictionaries', 'unmanaged', 'boolObj', ['@\"key1\"', '@\"key2\"'], ['@NO', '@YES'], {'r', 'unman'}],\n  ['AllOptionalPrimitiveDictionaries', 'optUnmanaged', 'boolObj', ['@\"key1\"', '@\"key2\"'], ['@NO', 'NSNull.null'], {'o', 'unman'}],\n  ['AllPrimitiveDictionaries', 'managed', 'boolObj', ['@\"key1\"', '@\"key2\"'], ['@NO', '@YES'], {'r', 'man'}],\n  ['AllOptionalPrimitiveDictionaries', 'optManaged', 'boolObj', ['@\"key1\"', '@\"key2\"'], ['@NO', 'NSNull.null'], {'o', 'man'}],\n  # Int\n  ['AllPrimitiveDictionaries', 'unmanaged', 'intObj', ['@\"key1\"', '@\"key2\"'], ['@2', '@3'], {'r', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllOptionalPrimitiveDictionaries', 'optUnmanaged', 'intObj', ['@\"key1\"', '@\"key2\"'], ['@2', 'NSNull.null'], {'o', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveDictionaries', 'managed', 'intObj', ['@\"key1\"', '@\"key2\"'], ['@2', '@3'], {'r', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllOptionalPrimitiveDictionaries', 'optManaged', 'intObj', ['@\"key1\"', '@\"key2\"'], ['@2', 'NSNull.null'], {'o', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  # String\n  ['AllPrimitiveDictionaries', 'unmanaged', 'stringObj', ['@\"key1\"', '@\"key2\"'], ['@\"bar\"', '@\"foo\"'], {'r', 'unman', 'string', 'comp'}],\n  ['AllOptionalPrimitiveDictionaries', 'optUnmanaged', 'stringObj', ['@\"key1\"', '@\"key2\"'], ['@\"bar\"', 'NSNull.null'], {'o', 'unman', 'string', 'comp'}],\n  ['AllPrimitiveDictionaries', 'managed', 'stringObj', ['@\"key1\"', '@\"key2\"'], ['@\"bar\"', '@\"foo\"'], {'r', 'man', 'string', 'comp'}],\n  ['AllOptionalPrimitiveDictionaries', 'optManaged', 'stringObj', ['@\"key1\"', '@\"key2\"'], ['@\"bar\"', 'NSNull.null'], {'o', 'man', 'string', 'comp'}],\n  # Date\n  ['AllPrimitiveDictionaries', 'unmanaged', 'dateObj', ['@\"key1\"', '@\"key2\"'], ['date(1)', 'date(2)'], {'r', 'minmax', 'comp', 'unman', 'date'}],\n  ['AllOptionalPrimitiveDictionaries', 'optUnmanaged', 'dateObj', ['@\"key1\"', '@\"key2\"'], ['date(1)', 'NSNull.null'], {'o', 'minmax', 'comp', 'unman', 'date'}],\n  ['AllPrimitiveDictionaries', 'managed', 'dateObj', ['@\"key1\"', '@\"key2\"'], ['date(1)', 'date(2)'], {'r', 'minmax', 'comp', 'man', 'date'}],\n  ['AllOptionalPrimitiveDictionaries', 'optManaged', 'dateObj', ['@\"key1\"', '@\"key2\"'], ['date(1)', 'NSNull.null'], {'o', 'minmax', 'comp', 'man', 'date'}],\n  # Float\n  ['AllPrimitiveDictionaries', 'unmanaged', 'floatObj', ['@\"key1\"', '@\"key2\"'], ['@2.2f', '@3.3f'], {'r', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllOptionalPrimitiveDictionaries', 'optUnmanaged', 'floatObj', ['@\"key1\"', '@\"key2\"'], ['@2.2f', 'NSNull.null'], {'o', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveDictionaries', 'managed', 'floatObj', ['@\"key1\"', '@\"key2\"'], ['@2.2f', '@3.3f'], {'r', 'minmax', 'comp', 'sum', 'avg'}],\n  ['AllOptionalPrimitiveDictionaries', 'optManaged', 'floatObj', ['@\"key1\"', '@\"key2\"'], ['@2.2f', 'NSNull.null'], {'o', 'minmax', 'comp', 'sum', 'avg'}],\n  # Double\n  ['AllPrimitiveDictionaries', 'unmanaged', 'doubleObj', ['@\"key1\"', '@\"key2\"'], ['@2.2', '@3.3'], {'r', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllOptionalPrimitiveDictionaries', 'optUnmanaged', 'doubleObj', ['@\"key1\"', '@\"key2\"'], ['@2.2', 'NSNull.null'], {'o', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveDictionaries', 'managed', 'doubleObj', ['@\"key1\"', '@\"key2\"'], ['@2.2', '@3.3'], {'r', 'minmax', 'comp', 'sum', 'avg'}],\n  ['AllOptionalPrimitiveDictionaries', 'optManaged', 'doubleObj', ['@\"key1\"', '@\"key2\"'], ['@2.2', 'NSNull.null'], {'o', 'minmax', 'comp', 'sum', 'avg'}],\n  # Data\n  ['AllPrimitiveDictionaries', 'unmanaged', 'dataObj', ['@\"key1\"', '@\"key2\"'], ['data(1)', 'data(2)'], {'r', 'unman', 'comp'}],\n  ['AllOptionalPrimitiveDictionaries', 'optUnmanaged', 'dataObj', ['@\"key1\"', '@\"key2\"'], ['data(1)', 'NSNull.null'], {'o', 'unman', 'comp'}],\n  ['AllPrimitiveDictionaries', 'managed', 'dataObj', ['@\"key1\"', '@\"key2\"'], ['data(1)', 'data(2)'], {'r', 'comp'}],\n  ['AllOptionalPrimitiveDictionaries', 'optManaged', 'dataObj', ['@\"key1\"', '@\"key2\"'], ['data(1)', 'NSNull.null'], {'o', 'comp'}],\n  # Double\n  ['AllPrimitiveDictionaries', 'unmanaged', 'decimalObj', ['@\"key1\"', '@\"key2\"'], ['decimal128(2)', 'decimal128(3)'], {'r', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllOptionalPrimitiveDictionaries', 'optUnmanaged', 'decimalObj', ['@\"key1\"', '@\"key2\"'], ['decimal128(2)', 'NSNull.null'], {'o', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveDictionaries', 'managed', 'decimalObj', ['@\"key1\"', '@\"key2\"'], ['decimal128(2)', 'decimal128(3)'], {'r', 'minmax', 'comp', 'sum', 'avg'}],\n  ['AllOptionalPrimitiveDictionaries', 'optManaged', 'decimalObj', ['@\"key1\"', '@\"key2\"'], ['decimal128(2)', 'NSNull.null'], {'o', 'minmax', 'comp', 'sum', 'avg'}],\n  # ObjectId\n  ['AllPrimitiveDictionaries', 'unmanaged', 'objectIdObj', ['@\"key1\"', '@\"key2\"'], ['objectId(1)', 'objectId(2)'], {'r', 'unman'}],\n  ['AllOptionalPrimitiveDictionaries', 'optUnmanaged', 'objectIdObj', ['@\"key1\"', '@\"key2\"'], ['objectId(1)', 'NSNull.null'], {'o', 'unman'}],\n  ['AllPrimitiveDictionaries', 'managed', 'objectIdObj', ['@\"key1\"', '@\"key2\"'], ['objectId(1)', 'objectId(2)'], {'r'}],\n  ['AllOptionalPrimitiveDictionaries', 'optManaged', 'objectIdObj', ['@\"key1\"', '@\"key2\"'], ['objectId(1)', 'NSNull.null'], {'o'}],\n  # UUID\n  ['AllPrimitiveDictionaries', 'unmanaged', 'uuidObj', ['@\"key1\"', '@\"key2\"'], ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")'], {'r', 'unman'}],\n  ['AllOptionalPrimitiveDictionaries', 'optUnmanaged', 'uuidObj', ['@\"key1\"', '@\"key2\"'], ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'NSNull.null'], {'o', 'unman'}],\n  ['AllPrimitiveDictionaries', 'managed', 'uuidObj', ['@\"key1\"', '@\"key2\"'], ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")'], {'r'}],\n  ['AllOptionalPrimitiveDictionaries', 'optManaged', 'uuidObj', ['@\"key1\"', '@\"key2\"'], ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'NSNull.null'], {'o'}],\n  # Mixed\n  ['AllPrimitiveDictionaries', 'unmanaged', 'anyBoolObj', ['@\"key1\"', '@\"key2\"'], ['@NO', '@YES'], {'r', 'any', 'unman'}],\n  ['AllPrimitiveDictionaries', 'unmanaged', 'anyIntObj', ['@\"key1\"', '@\"key2\"'], ['@2', '@3'], {'r', 'any', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveDictionaries', 'unmanaged', 'anyFloatObj', ['@\"key1\"', '@\"key2\"'], ['@2.2f', '@3.3f'], {'r', 'any', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveDictionaries', 'unmanaged', 'anyDoubleObj', ['@\"key1\"', '@\"key2\"'], ['@2.2', '@3.3'], {'r', 'any', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveDictionaries', 'unmanaged', 'anyStringObj', ['@\"key1\"', '@\"key2\"'], ['@\"a\"', '@\"b\"'], {'r', 'any', 'unman', 'string'}],\n  ['AllPrimitiveDictionaries', 'unmanaged', 'anyDataObj', ['@\"key1\"', '@\"key2\"'], ['data(1)', 'data(2)'], {'r', 'any', 'unman'}],\n  ['AllPrimitiveDictionaries', 'unmanaged', 'anyDateObj', ['@\"key1\"', '@\"key2\"'], ['date(1)', 'date(2)'], {'r', 'any', 'minmax', 'comp', 'unman', 'date'}],\n  ['AllPrimitiveDictionaries', 'unmanaged', 'anyDecimalObj', ['@\"key1\"', '@\"key2\"'], ['decimal128(2)', 'decimal128(3)'], {'r', 'any', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveDictionaries', 'unmanaged', 'anyObjectIdObj', ['@\"key1\"', '@\"key2\"'], ['objectId(1)', 'objectId(2)'], {'r', 'any', 'unman'}],\n  ['AllPrimitiveDictionaries', 'unmanaged', 'anyUUIDObj', ['@\"key1\"', '@\"key2\"'], ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")'], {'r', 'any','unman'}],\n\n  ['AllPrimitiveDictionaries', 'managed', 'anyBoolObj', ['@\"key1\"', '@\"key2\"'], ['@NO', '@YES'], {'r', 'any', 'man'}],\n  ['AllPrimitiveDictionaries', 'managed', 'anyIntObj', ['@\"key1\"', '@\"key2\"'], ['@2', '@3'], {'r', 'any', 'sum', 'avg', 'man'}],\n  ['AllPrimitiveDictionaries', 'managed', 'anyFloatObj', ['@\"key1\"', '@\"key2\"'], ['@2.2f', '@3.3f'], {'r', 'any', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllPrimitiveDictionaries', 'managed', 'anyDoubleObj', ['@\"key1\"', '@\"key2\"'], ['@2.2', '@3.3'], {'r', 'any', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllPrimitiveDictionaries', 'managed', 'anyStringObj', ['@\"key1\"', '@\"key2\"'], ['@\"a\"', '@\"b\"'], {'r', 'any', 'string', 'man'}],\n  ['AllPrimitiveDictionaries', 'managed', 'anyDataObj', ['@\"key1\"', '@\"key2\"'], ['data(1)', 'data(2)'], {'r', 'any', 'man'}],\n  ['AllPrimitiveDictionaries', 'managed', 'anyDateObj', ['@\"key1\"', '@\"key2\"'], ['date(1)', 'date(2)'], {'r', 'any', 'minmax', 'comp' 'date', 'man'}],\n  ['AllPrimitiveDictionaries', 'managed', 'anyDecimalObj', ['@\"key1\"', '@\"key2\"'], ['decimal128(2)', 'decimal128(3)'], {'r', 'any', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllPrimitiveDictionaries', 'managed', 'anyObjectIdObj', ['@\"key1\"', '@\"key2\"'], ['objectId(1)', 'objectId(2)'], {'r', 'any'}],\n  ['AllPrimitiveDictionaries', 'managed', 'anyUUIDObj', ['@\"key1\"', '@\"key2\"'], ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")'], {'r', 'any', 'man'}],\n]\n\ndef type_name(propertyName, optional):\n    if 'any' in propertyName:\n        return 'mixed'\n    return propertyName.replace('Obj', '') + ('?' if 'opt' in optional else '')\n\ntypes = [{'class': t[0],\n          'obj': t[1],\n          'prop': t[2],\n          'k0': t[3][0],\n          'k1': t[3][1],\n          'v0': t[4][0],\n          'v1': t[4][1],\n          'dictionary': t[1] + '.' + t[2],\n          'values': '@{ ' + ', '.join('{}: {}'.format(pair[0], pair[1]) for pair in zip(t[3], t[4])) + ' }',\n          'firstKey': t[3][0],\n          'firstValue': t[4][0],\n          'last': t[4][2] if len(t[4]) == 3 else t[4][1],\n          'wrong': '@\"a\"', 'wdesc': 'a', 'wtype': 'RLMConstantString',\n          'type': type_name(t[2], t[1]),\n          'tags': set(t[5]),\n         }\n         for t in types]\n\n# Add negative tags to all types\nall_tags = set()\nfor t in types:\n    all_tags |= t['tags']\nfor t in types:\n    for missing in all_tags - t['tags']:\n        t['tags'].add('no' + missing)\n\n# For testing error handling we need a value of the wrong type. By default this\n# is a string, so for string types we need to set it to a number instead\nfor string_type in (t for t in types if 'string' in t['tags']):\n    string_type['wrong'] = '@2'\n    string_type['wdesc'] = '2'\n    string_type['wtype'] = 'RLMConstantInt'\n\n# We extract the type name from the property name, but object id and decimal128\n# don't have names that work for this\nfor type in types:\n    type['type'] = type['type'].replace('objectId', 'object id').replace('decimal', 'decimal128')\n    type['basetype'] = type['type'].replace('?', '')\n\nfile = open(os.path.dirname(__file__) + '/PrimitiveDictionaryPropertyTests.tpl.m', 'rt')\nfor line in file:\n    # Lines without anything to expand just appear as-is\n    if not '$' in line:\n        print(line, end='')\n        continue\n\n    if '$allDictionaries' in line:\n        line = line.replace(' ^n', '\\n' + ' ' * (line.find('(') + 4))\n        line = line.replace('$allDictionaries', 'dictionary')\n        print('    for (RLMDictionary *dictionary in allDictionaries) {\\n    ' + line + '    }')\n        continue\n\n    filtered_types = types\n    start = 0\n    end = len(types)\n    # Limit the types to the ones which match all of the tags present in the\n    # line, then remove the tags from the line\n    for tag in re.findall(r'\\%([a-z]+)', line):\n        filtered_types = [t for t in filtered_types if tag in t['tags']]\n        line = line.replace('%' + tag + ' ', '')\n\n    # Places where we want multiple output lines from one input line use ^nl\n    # for subsequent statements and ^n for things which should be indented within\n    # parentheses. This is a pretty half-hearted attempt at producing properly\n    # indented output.\n    line = line.replace(' ^nl ', '\\n    ')\n    line = line.replace(' ^n', '\\n' + ' ' * line.find('('))\n\n    # Repeat each line for each type, replacing variables with values from the dictionary\n    for t in filtered_types:\n        l = line\n        for k, v in t.items():\n            if k in l:\n                l = l.replace('$' + k, v)\n        print(l, end='')\n"
  },
  {
    "path": "Realm/Tests/mixed_tests.py",
    "content": "import os, re\n\n# Tags:\n# (no)minmax: Type supports min() and max()\n# (no)sum: Type supports sum()\n# (no)avg: Type supports average()\n# r/o: Type is Required or Optional\n# (un)man: Type is Managed or Unmanaged\n\ntypes = [\n  # Class, Object, Property, Values, Tags\n  ['AllPrimitiveRLMValues', 'unmanaged', 'boolVal', ['@NO', '@YES', 'NSNull.null'], {'o', 'unman'}, '(NSNumber *)', 'RLMPropertyTypeBool'],\n  ['AllPrimitiveRLMValues', 'unmanaged', 'intVal', ['@2', '@3', 'NSNull.null'], {'n', 'o', 'minmax', 'sum', 'avg', 'unman'}, '(NSNumber *)', 'RLMPropertyTypeInt'],\n  ['AllPrimitiveRLMValues', 'unmanaged', 'floatVal', ['@2.2f', '@3.3f', 'NSNull.null'], {'o', 'minmax', 'sum', 'avg', 'unman'}, '(NSNumber *)', 'RLMPropertyTypeFloat'],\n  ['AllPrimitiveRLMValues', 'unmanaged', 'doubleVal', ['@2.2', '@3.3', 'NSNull.null'], {'o', 'minmax', 'sum', 'avg', 'unman'}, '(NSNumber *)', 'RLMPropertyTypeDouble'],\n  ['AllPrimitiveRLMValues', 'unmanaged', 'stringVal', ['@\"a\"', '@\"b\"', 'NSNull.null'], {'o', 'unman', 'string'}, '(NSString *)', 'RLMPropertyTypeString'],\n  ['AllPrimitiveRLMValues', 'unmanaged', 'dataVal', ['data(1)', 'data(2)', 'NSNull.null'], {'o', 'unman'}, '(NSData *)', 'RLMPropertyTypeData'],\n  ['AllPrimitiveRLMValues', 'unmanaged', 'dateVal', ['date(1)', 'date(2)', 'NSNull.null'], {'o', 'minmax', 'unman', 'date'}, '(NSDate *)', 'RLMPropertyTypeDate'],\n  ['AllPrimitiveRLMValues', 'unmanaged', 'decimalVal', ['decimal128(2)', 'decimal128(3)', 'NSNull.null'], {'o', 'minmax', 'sum', 'avg', 'unman'}, '(RLMDecimal128 *)', 'RLMPropertyTypeDecimal128'],\n  ['AllPrimitiveRLMValues', 'unmanaged', 'objectIdVal', ['objectId(1)', 'objectId(2)', 'NSNull.null'], {'o', 'unman'}, '(RLMObjectId *)', 'RLMPropertyTypeObjectId'],\n  ['AllPrimitiveRLMValues', 'unmanaged', 'uuidVal', ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")', 'NSNull.null'], {'o', 'unman'}, '(NSUUID *)', 'RLMPropertyTypeUUID'],\n  ['AllPrimitiveRLMValues', 'managed', 'boolVal', ['@NO', '@YES'], { 'r', 'man'}, '(NSNumber *)', 'RLMPropertyTypeBool'],\n  ['AllPrimitiveRLMValues', 'managed', 'intVal', ['@2', '@3'], {'r', 'minmax', 'sum', 'avg', 'man'}, '(NSNumber *)', 'RLMPropertyTypeBool'],\n  ['AllPrimitiveRLMValues', 'managed', 'floatVal', ['@2.2f', '@3.3f'], {'r', 'minmax', 'sum', 'avg', 'man'}, '(NSNumber *)', 'RLMPropertyTypeInt'],\n  ['AllPrimitiveRLMValues', 'managed', 'doubleVal', ['@2.2', '@3.3'], {'r', 'minmax', 'sum', 'avg', 'man'}, '(NSNumber *)', 'RLMPropertyTypeFloat'],\n  ['AllPrimitiveRLMValues', 'managed', 'stringVal', ['@\"a\"', '@\"b\"'], {'r', 'man', 'string'}, '(NSString *)', 'RLMPropertyTypeDouble'],\n  ['AllPrimitiveRLMValues', 'managed', 'dataVal', ['data(1)', 'data(2)'], {'r', 'man'}, '(NSData *)', 'RLMPropertyTypeData'],\n  ['AllPrimitiveRLMValues', 'managed', 'dateVal', ['date(1)', 'date(2)'], {'r', 'minmax', 'man', 'date'}, '(NSDate *)', 'RLMPropertyTypeDate'],\n  ['AllPrimitiveRLMValues', 'managed', 'decimalVal', ['decimal128(2)', 'decimal128(3)'], {'r', 'minmax', 'sum', 'avg', 'man'}, '(RLMDecimal128 *)', 'RLMPropertyTypeDecimal128'],\n  ['AllPrimitiveRLMValues', 'managed', 'objectIdVal', ['objectId(1)', 'objectId(2)', 'NSNull.null'], {'o', 'man'}, '(RLMObjectId *)', 'RLMPropertyTypeObjectId'],\n  ['AllPrimitiveRLMValues', 'managed', 'uuidVal', ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")', 'NSNull.null'], {'o', 'man'}, '(NSUUID *)', 'RLMPropertyTypeUUID'],\n\n]\ntypes = [{'class': t[0], 'obj': t[1], 'prop': t[2], 'v0': t[3][0], 'v1': t[3][1],\n          'member': t[2],\n          'rlmValue': t[1] + '.' + t[2],\n          'value0': t[3][0],\n          'value1': t[3][1],\n          'values': '@[' + ', '.join(t[3]) + ']',\n          'cast': t[5],\n          'valueType': t[6],\n          'first': t[3][0], 'last': t[3][2] if len(t[3]) == 3 else t[3][1],\n          'wrong': '@\"a\"', 'wdesc': 'a', 'wtype': '__NSCFConstantString',\n          'type': t[2].replace('Obj', '') + ('?' if 'opt' in t[1] else ''),\n          'tags': t[4],\n          }\n         for t in types]\n         \nall_tags = set()\nfor t in types:\n    all_tags |= t['tags']\nfor t in types:\n    for missing in all_tags - t['tags']:\n        t['tags'].add('no' + missing)\n        \nfor string_type in (t for t in types if 'string' in t['tags']):\n    string_type['wrong'] = '@2'\n    string_type['wdesc'] = '2'\n    string_type['wtype'] = '__NSCFNumber'\n    \nfor type in types:\n    type['type'] = type['type'].replace('objectId', 'object id').replace('decimal', 'decimal128')\n    type['basetype'] = type['type'].replace('?', '')\n    \nfile = open(os.path.dirname(__file__) + '/PrimitiveRLMValuePropertyTests.tpl.m', 'rt')\nfor line in file:\n    # Lines without anything to expand just appear as-is\n    if not '$' in line:\n        print line,\n        continue\n\n    if '$allValues' in line:\n        line = line.replace(' ^n', '\\n' + ' ' * (line.find('(') + 4))\n        print '    for (RLMValue *value in allValues) {\\n    ' + line.replace('$allValues', 'value') + '    }'\n        continue\n\n    filtered_types = types\n    start = 0\n    end = len(types)\n    # Limit the types to the ones which match all of the tags present in the\n    # line, then remove the tags from the line\n    for tag in re.findall(r'\\%([a-z]+)', line):\n        filtered_types = [t for t in filtered_types if tag in t['tags']]\n        line = line.replace('%' + tag + ' ', '')\n\n    # Places where we want multiple output lines from one input line use ^nl\n    # for subsequent statements and ^n for things which should be indented within\n    # parentheses. This is a pretty half-hearted attempt at producing properly\n    # indented output.\n    line = line.replace(' ^nl ', '\\n    ')\n    line = line.replace(' ^n', '\\n' + ' ' * line.find('('))\n\n    # Repeat each line for each type, replacing variables with values from the dictionary\n    for t in filtered_types:\n        l = line\n        for k, v in t.iteritems():\n            if k in l:\n                l = l.replace('$' + k, v)\n        print l,\n"
  },
  {
    "path": "Realm/Tests/set_tests.py",
    "content": "import os, re\n\n# Tags:\n# (un)minmax: Type supports min() and max()\n# (no)comp: Type supports comparison operators\n# (un)sum: Type supports sum()\n# (un)avg: Type supports average()\n# r/o: Type is Required or Optional\n# (un)man: Type is Managed or Unmanaged\n# maxtwovalues: Type that can contain only 2 values, e.g non-optional bool\n# nomaxvalues: Type that can contain any amount of values\n# (no)any: Can accept any type\n# (no)date: Stores dates\n\ntypes = [\n  # Class, Object, Property, Values, Values2, Tags\n  ['AllPrimitiveSets', 'unmanaged', 'boolObj', ['@NO', '@YES'], ['@NO', '@YES'], ['r', 'unman', 'maxtwovalues']],\n  ['AllPrimitiveSets', 'unmanaged', 'intObj', ['@2', '@3'], ['@2', '@4'], ['r', 'minmax', 'comp', 'sum', 'avg', 'unman']],\n  ['AllPrimitiveSets', 'unmanaged', 'floatObj', ['@2.2f', '@3.3f'], ['@2.2f', '@4.4f'], ['r', 'minmax', 'comp', 'sum', 'avg', 'unman']],\n  ['AllPrimitiveSets', 'unmanaged', 'doubleObj', ['@2.2', '@3.3'], ['@2.2', '@4.4'], ['r', 'minmax', 'comp', 'sum', 'avg', 'unman']],\n  ['AllPrimitiveSets', 'unmanaged', 'stringObj', ['@\"a\"', '@\"bc\"'], ['@\"a\"', '@\"de\"'], ['r', 'unman', 'string', 'comp']],\n  ['AllPrimitiveSets', 'unmanaged', 'dataObj', ['data(1)', 'data(2)'], ['data(1)', 'data(3)'], ['r', 'unman', 'comp']],\n  ['AllPrimitiveSets', 'unmanaged', 'dateObj', ['date(1)', 'date(2)'], ['date(1)', 'date(3)'], ['r', 'minmax', 'comp', 'unman', 'date']],\n  ['AllPrimitiveSets', 'unmanaged', 'decimalObj', ['decimal128(1)', 'decimal128(2)'], ['decimal128(1)', 'decimal128(3)'], ['r', 'minmax', 'comp', 'sum', 'avg', 'unman']],\n  ['AllPrimitiveSets', 'unmanaged', 'objectIdObj', ['objectId(1)', 'objectId(2)'], ['objectId(1)', 'objectId(3)'], ['r', 'unman']],\n  ['AllPrimitiveSets', 'unmanaged', 'uuidObj', ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")'], ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")'], ['r', 'unman']],\n\n  ['AllPrimitiveSets', 'unmanaged', 'anyBoolObj', ['@NO', '@YES'], ['@NO', '@YES'], {'r', 'any', 'unman'}],\n  ['AllPrimitiveSets', 'unmanaged', 'anyIntObj', ['@2', '@3'], ['@2', '@4'], {'r', 'any', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveSets', 'unmanaged', 'anyFloatObj', ['@2.2f', '@3.3f'], ['@4.4f', '@3.3f'], {'r', 'any', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveSets', 'unmanaged', 'anyDoubleObj', ['@2.2', '@3.3'], ['@2.2', '@4.4'], {'r', 'any', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveSets', 'unmanaged', 'anyStringObj', ['@\"a\"', '@\"b\"'], ['@\"a\"', '@\"d\"'], {'r', 'any', 'unman', 'string', 'comp'}],\n  ['AllPrimitiveSets', 'unmanaged', 'anyDataObj', ['data(1)', 'data(2)'], ['data(1)', 'data(3)'], {'r', 'any', 'unman', 'comp'}],\n  ['AllPrimitiveSets', 'unmanaged', 'anyDateObj', ['date(1)', 'date(2)'], ['date(1)', 'date(4)'], {'r', 'any', 'minmax', 'comp', 'unman', 'date'}],\n  ['AllPrimitiveSets', 'unmanaged', 'anyDecimalObj', ['decimal128(1)', 'decimal128(2)'], ['decimal128(1)', 'decimal128(3)'], {'r', 'any', 'minmax', 'comp', 'sum', 'avg', 'unman'}],\n  ['AllPrimitiveSets', 'unmanaged', 'anyObjectIdObj', ['objectId(1)', 'objectId(2)'], ['objectId(1)', 'objectId(3)'], {'r', 'any', 'unman'}],\n  ['AllPrimitiveSets', 'unmanaged', 'anyUUIDObj', ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")'], ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")'], ['r', 'any','unman']],\n\n  ['AllOptionalPrimitiveSets', 'optUnmanaged', 'boolObj', ['NSNull.null', '@NO', '@YES'], ['@YES', '@NO'], ['o' 'unman', 'maxtwovalues']],\n  ['AllOptionalPrimitiveSets', 'optUnmanaged', 'intObj', ['NSNull.null', '@2', '@3'], ['@3', '@4'], ['o', 'minmax', 'comp', 'sum', 'avg', 'unman']],\n  ['AllOptionalPrimitiveSets', 'optUnmanaged', 'floatObj', ['NSNull.null', '@2.2f', '@3.3f'], ['@3.3f', '@4.4f'], ['o', 'minmax', 'comp', 'sum', 'avg', 'unman']],\n  ['AllOptionalPrimitiveSets', 'optUnmanaged', 'doubleObj', ['NSNull.null', '@2.2', '@3.3'], ['@3.3', '@4.4'], ['o', 'minmax', 'comp', 'sum', 'avg', 'unman']],\n  ['AllOptionalPrimitiveSets', 'optUnmanaged', 'stringObj', ['NSNull.null', '@\"a\"', '@\"bc\"'], ['@\"bc\"', '@\"de\"'], ['o', 'unman', 'string', 'comp']],\n  ['AllOptionalPrimitiveSets', 'optUnmanaged', 'dataObj', ['NSNull.null', 'data(1)', 'data(2)'], ['data(2)', 'data(3)'], ['o', 'unman', 'comp']],\n  ['AllOptionalPrimitiveSets', 'optUnmanaged', 'dateObj', ['NSNull.null', 'date(1)', 'date(2)'], ['date(2)', 'date(3)'], ['o', 'minmax', 'comp', 'unman', 'date']],\n  ['AllOptionalPrimitiveSets', 'optUnmanaged', 'decimalObj', ['NSNull.null', 'decimal128(1)', 'decimal128(2)'], ['decimal128(2)', 'decimal128(4)'], ['o', 'minmax', 'comp', 'sum', 'avg', 'unman']],\n  ['AllOptionalPrimitiveSets', 'optUnmanaged', 'objectIdObj', ['NSNull.null', 'objectId(1)', 'objectId(2)'], ['objectId(2)', 'objectId(4)'], ['o', 'unman']],\n  ['AllOptionalPrimitiveSets', 'optUnmanaged', 'uuidObj', ['NSNull.null','uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")', 'uuid(@\"00000000-0000-0000-0000-000000000000\")'], ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")'], ['o', 'unman']],\n\n  ['AllPrimitiveSets', 'managed', 'boolObj', ['@NO', '@YES'], ['@YES', '@NO'], ['r', 'man', 'maxtwovalues']],\n  ['AllPrimitiveSets', 'managed', 'intObj', ['@2', '@3'], ['@3', '@4'], ['r', 'minmax', 'comp', 'sum', 'avg', 'man']],\n  ['AllPrimitiveSets', 'managed', 'floatObj', ['@2.2f', '@3.3f'], ['@3.3f', '@4.4f'], ['r', 'minmax', 'comp', 'sum', 'avg', 'man']],\n  ['AllPrimitiveSets', 'managed', 'doubleObj', ['@2.2', '@3.3'], ['@3.3', '@4.4'], ['r', 'minmax', 'comp', 'sum', 'avg', 'man']],\n  ['AllPrimitiveSets', 'managed', 'stringObj', ['@\"a\"', '@\"bc\"'], ['@\"bc\"', '@\"de\"'], ['r', 'nominmax', 'man', 'string', 'comp']],\n  ['AllPrimitiveSets', 'managed', 'dataObj', ['data(1)', 'data(2)'], ['data(2)', 'data(3)'], ['r', 'man', 'comp']],\n  ['AllPrimitiveSets', 'managed', 'dateObj', ['date(1)', 'date(2)'], ['date(2)', 'date(3)'], ['r', 'minmax', 'comp', 'man', 'date']],\n  ['AllPrimitiveSets', 'managed', 'decimalObj', ['decimal128(1)', 'decimal128(2)'], ['decimal128(2)', 'decimal128(3)'], ['r', 'minmax', 'comp', 'sum', 'avg', 'man']],\n  ['AllPrimitiveSets', 'managed', 'objectIdObj', ['objectId(1)', 'objectId(2)'], ['objectId(2)', 'objectId(3)'], ['r', 'nominmax', 'man']],\n  ['AllPrimitiveSets', 'managed', 'uuidObj', ['uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")', 'uuid(@\"00000000-0000-0000-0000-000000000000\")'], ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")'], ['r', 'man']],\n\n  ['AllPrimitiveSets', 'managed', 'anyBoolObj', ['@NO', '@YES'], ['@NO', '@YES'], {'r', 'any', 'man'}],\n  ['AllPrimitiveSets', 'managed', 'anyIntObj', ['@2', '@3'], ['@2', '@4'], {'r', 'any', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllPrimitiveSets', 'managed', 'anyFloatObj', ['@2.2f', '@3.3f'], ['@2.2f', '@4.4f'], {'r', 'any', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllPrimitiveSets', 'managed', 'anyDoubleObj', ['@2.2', '@3.3'], ['@2.2', '@4.4'], {'r', 'any', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllPrimitiveSets', 'managed', 'anyStringObj', ['@\"a\"', '@\"b\"'], ['@\"a\"', '@\"d\"'], {'r', 'any', 'man', 'string', 'comp'}],\n  ['AllPrimitiveSets', 'managed', 'anyDataObj', ['data(1)', 'data(2)'], ['data(1)', 'data(3)'], {'r', 'any', 'man'}],\n  ['AllPrimitiveSets', 'managed', 'anyDateObj', ['date(1)', 'date(2)'], ['date(1)', 'date(3)'], {'r', 'any', 'minmax', 'comp', 'man', 'date'}],\n  ['AllPrimitiveSets', 'managed', 'anyDecimalObj', ['decimal128(1)', 'decimal128(2)'], ['decimal128(1)', 'decimal128(3)'], {'r', 'any', 'minmax', 'comp', 'sum', 'avg', 'man'}],\n  ['AllPrimitiveSets', 'managed', 'anyObjectIdObj', ['objectId(1)', 'objectId(2)'], ['objectId(1)', 'objectId(3)'], {'r', 'any', 'man'}],\n  ['AllPrimitiveSets', 'managed', 'anyUUIDObj', ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")'], ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")'], ['r', 'any', 'man']],\n\n  ['AllOptionalPrimitiveSets', 'optManaged', 'boolObj', ['NSNull.null', '@NO', '@YES'], ['@YES', '@NO'], ['o', 'nominmax', 'nosum', 'noavg', 'man', 'maxtwovalues']],\n  ['AllOptionalPrimitiveSets', 'optManaged', 'intObj', ['NSNull.null', '@2', '@3'], ['@3', '@4'], ['o', 'minmax', 'comp', 'sum', 'avg', 'man']],\n  ['AllOptionalPrimitiveSets', 'optManaged', 'floatObj', ['NSNull.null', '@2.2f', '@3.3f'], ['@3.3f', '@4.4f'], ['o', 'minmax', 'comp', 'sum', 'avg', 'man']],\n  ['AllOptionalPrimitiveSets', 'optManaged', 'doubleObj', ['NSNull.null', '@2.2', '@3.3'], ['@3.3', '@4.4'], ['o', 'minmax', 'comp', 'sum', 'avg', 'man']],\n  ['AllOptionalPrimitiveSets', 'optManaged', 'stringObj', ['NSNull.null', '@\"a\"', '@\"bc\"'], ['@\"bc\"', '@\"de\"'], ['o', 'man', 'string', 'comp']],\n  ['AllOptionalPrimitiveSets', 'optManaged', 'dataObj', ['NSNull.null', 'data(1)', 'data(2)'], ['data(2)', 'data(3)'], ['o', 'man', 'comp']],\n  ['AllOptionalPrimitiveSets', 'optManaged', 'dateObj', ['NSNull.null', 'date(1)', 'date(2)'], ['date(2)', 'date(3)'], ['o', 'minmax', 'comp', 'man', 'date']],\n  ['AllOptionalPrimitiveSets', 'optManaged', 'decimalObj', ['NSNull.null', 'decimal128(1)', 'decimal128(2)'], ['decimal128(2)', 'decimal128(3)'], ['o', 'minmax', 'comp', 'sum', 'avg', 'man']],\n  ['AllOptionalPrimitiveSets', 'optManaged', 'objectIdObj', ['NSNull.null', 'objectId(1)', 'objectId(2)'], ['objectId(2)', 'objectId(3)'], ['o', 'man']],\n  ['AllOptionalPrimitiveSets', 'optManaged', 'uuidObj', ['NSNull.null', 'uuid(@\"137DECC8-B300-4954-A233-F89909F4FD89\")', 'uuid(@\"00000000-0000-0000-0000-000000000000\")'], ['uuid(@\"00000000-0000-0000-0000-000000000000\")', 'uuid(@\"123DECC8-B300-4954-A233-F89909F4FD89\")'], ['o', 'man']],\n]\n\ndef type_name(propertyName, optional):\n    if 'any' in propertyName:\n        return 'mixed'\n    else:\n        return propertyName.replace('Obj', '') + ('?' if 'opt' in optional else '')\n\ntypes = [{'class': t[0],\n          'obj': t[1],\n          'prop': t[2],\n          'v0': t[3][0],\n          'v1': t[3][1],\n          'v2': len(t[3])>2 and t[3][2] or 'NSNull.null',\n          'v3': t[4][0],\n          'v4': t[4][1],\n          'set': t[1] + '.' + t[2],\n          'set2': t[1] + '.' + t[2],\n          'values': '@[' + ', '.join(t[3]) + ']',\n          'values2': '@[' + ', '.join(t[4]) + ']',\n          'first': t[3][0], 'last': t[3][2] if len(t[3]) == 3 else t[3][1],\n          'wrong': '@\"a\"', 'wdesc': 'a', 'wtype': 'RLMConstantString',\n          'type': type_name(t[2], t[1]),\n          'tags': set(t[5])\n          }\n         for t in types]\n\n# Add negative tags to all types\nall_tags = set()\nfor t in types:\n    all_tags |= t['tags']\nfor t in types:\n    for missing in all_tags - t['tags']:\n        t['tags'].add('no' + missing)\n\n# For testing error handling we need a value of the wrong type. By default this\n# is a string, so for string types we need to set it to a number instead\nfor string_type in (t for t in types if 'string' in t['tags']):\n    string_type['wrong'] = '@2'\n    string_type['wdesc'] = '2'\n    string_type['wtype'] = 'RLMConstantInt'\n\n# We extract the type name from the property name, but object id and decimal128\n# don't have names that work for this\nfor type in types:\n    type['type'] = type['type'].replace('objectId', 'object id').replace('decimal', 'decimal128')\n    type['basetype'] = type['type'].replace('?', '')\n\nfile = open(os.path.dirname(__file__) + '/PrimitiveSetPropertyTests.tpl.m', 'rt')\nfor line in file:\n    if not '$' in line:\n        print(line, end='')\n        continue\n    if '$allSets' in line:\n        line = line.replace(' ^n', '\\n' + ' ' * (line.find('(') + 4))\n        print('    for (RLMSet *set in allSets) {\\n    ' + line.replace('$allSets', 'set') + '    }')\n        continue\n\n    filtered_types = types\n\n    start = 0\n    end = len(types)\n    for tag in re.findall(r'\\%([a-z]+)', line):\n        filtered_types = [t for t in filtered_types if tag in t['tags']]\n        line = line.replace('%' + tag + ' ', '')\n\n\n    line = line.replace('^nl', '\\n    ')\n    line = line.replace('^n', '\\n' + ' ' * line.find('('))\n\n    for t in filtered_types:\n        l = line\n        for k, v in t.items():\n            if k in l:\n                l = l.replace('$' + k, v)\n        print(l, end='')\n"
  },
  {
    "path": "Realm.podspec",
    "content": "# coding: utf-8\nPod::Spec.new do |s|\n  s.name                    = 'Realm'\n  version                   = `sh build.sh get-version`\n  s.version                 = version\n  s.cocoapods_version       = '>= 1.10'\n  s.summary                 = 'Realm is a modern data framework & database for iOS, macOS, tvOS & watchOS.'\n  s.description             = <<-DESC\n                              The Realm Database, for Objective-C. (If you want to use Realm from Swift, see the “RealmSwift” pod.)\n\n                              Realm is a fast, easy-to-use replacement for Core Data & SQLite. Works on iOS, macOS, tvOS & watchOS. Learn more and get help at https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/.\n                              DESC\n  s.homepage                = \"https://realm.io\"\n  s.source                  = { :git => 'https://github.com/realm/realm-swift.git', :tag => \"v#{s.version}\" }\n  s.author                  = { 'Realm' => 'realm-help@mongodb.com' }\n  s.library                 = 'c++', 'z', 'compression'\n  s.requires_arc            = true\n  s.license                 = { :type => 'Apache 2.0', :file => 'LICENSE' }\n\n  public_header_files       = 'include/Realm.h',\n\n                              # Realm module\n                              'include/RLMArray.h',\n                              'include/RLMAsymmetricObject.h',\n                              'include/RLMAsyncTask.h',\n                              'include/RLMCollection.h',\n                              'include/RLMConstants.h',\n                              'include/RLMDecimal128.h',\n                              'include/RLMDictionary.h',\n                              'include/RLMEmbeddedObject.h',\n                              'include/RLMGeospatial.h',\n                              'include/RLMError.h',\n                              'include/RLMLogger.h',\n                              'include/RLMMigration.h',\n                              'include/RLMObject.h',\n                              'include/RLMObjectBase.h',\n                              'include/RLMObjectId.h',\n                              'include/RLMObjectSchema.h',\n                              'include/RLMProperty.h',\n                              'include/RLMRealm.h',\n                              'include/RLMRealmConfiguration.h',\n                              'include/RLMResults.h',\n                              'include/RLMSchema.h',\n                              'include/RLMSectionedResults.h',\n                              'include/RLMSet.h',\n                              'include/RLMSwiftCollectionBase.h',\n                              'include/RLMSwiftValueStorage.h',\n                              'include/RLMThreadSafeReference.h',\n                              'include/RLMValue.h',\n\n                              # Realm.Dynamic module\n                              'include/RLMRealm_Dynamic.h',\n                              'include/RLMObjectBase_Dynamic.h',\n\n                              # Realm.Swift module\n                              'include/RLMSwiftObject.h'\n\n                              # Realm.Private module\n  private_header_files      = 'include/RLMAccessor.h',\n                              'include/RLMArray_Private.h',\n                              'include/RLMAsyncTask_Private.h',\n                              'include/RLMCollection_Private.h',\n                              'include/RLMDictionary_Private.h',\n                              'include/RLMEvent.h',\n                              'include/RLMLogger_Private.h',\n                              'include/RLMObjectBase_Private.h',\n                              'include/RLMObjectSchema_Private.h',\n                              'include/RLMObjectStore.h',\n                              'include/RLMObject_Private.h',\n                              'include/RLMOptionalBase.h',\n                              'include/RLMPropertyBase.h',\n                              'include/RLMProperty_Private.h',\n                              'include/RLMRealmConfiguration_Private.h',\n                              'include/RLMRealm_Private.h',\n                              'include/RLMResults_Private.h',\n                              'include/RLMScheduler.h',\n                              'include/RLMSchema_Private.h',\n                              'include/RLMSet_Private.h',\n                              'include/RLMSwiftProperty.h',\n\n  s.ios.frameworks          = 'Security'\n  s.ios.weak_framework      = 'UIKit'\n  s.tvos.weak_framework     = 'UIKit'\n  s.watchos.weak_framework  = 'UIKit'\n  s.module_map              = 'Realm/Realm.modulemap'\n  s.compiler_flags          = \"-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\\\"#{s.version}\\\"' -D__ASSERTMACROS__\"\n  s.prepare_command         = 'sh scripts/setup-cocoapods.sh'\n  s.source_files            = private_header_files + ['Realm/*.{m,mm}']\n  s.private_header_files    = private_header_files\n  s.header_mappings_dir     = 'include'\n  s.pod_target_xcconfig     = { 'APPLICATION_EXTENSION_API_ONLY' => 'YES',\n                                'CLANG_CXX_LANGUAGE_STANDARD' => 'c++20',\n                                'CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF' => 'NO',\n                                'OTHER_CPLUSPLUSFLAGS' => '-isystem \"${PODS_ROOT}/Realm/include/core\" -fvisibility-inlines-hidden',\n                                'USER_HEADER_SEARCH_PATHS' => '\"${PODS_ROOT}/Realm/include\" \"${PODS_ROOT}/Realm/include/Realm\"',\n\n                                'IPHONEOS_DEPLOYMENT_TARGET_1500' => '12.0',\n                                'IPHONEOS_DEPLOYMENT_TARGET_1600' => '12.0',\n                                'IPHONEOS_DEPLOYMENT_TARGET_2600' => '12.0',\n                                'IPHONEOS_DEPLOYMENT_TARGET' => '$(IPHONEOS_DEPLOYMENT_TARGET_$(XCODE_VERSION_MAJOR))',\n                                'MACOSX_DEPLOYMENT_TARGET_1500' => '10.13',\n                                'MACOSX_DEPLOYMENT_TARGET_1600' => '10.13',\n                                'MACOSX_DEPLOYMENT_TARGET_2600' => '10.13',\n                                'MACOSX_DEPLOYMENT_TARGET' => '$(MACOSX_DEPLOYMENT_TARGET_$(XCODE_VERSION_MAJOR))',\n                                'WATCHOS_DEPLOYMENT_TARGET_1500' => '4.0',\n                                'WATCHOS_DEPLOYMENT_TARGET_1600' => '4.0',\n                                'WATCHOS_DEPLOYMENT_TARGET_2600' => '4.0',\n                                'WATCHOS_DEPLOYMENT_TARGET' => '$(WATCHOS_DEPLOYMENT_TARGET_$(XCODE_VERSION_MAJOR))',\n                                'TVOS_DEPLOYMENT_TARGET_1500' => '12.0',\n                                'TVOS_DEPLOYMENT_TARGET_1600' => '12.0',\n                                'TVOS_DEPLOYMENT_TARGET_2600' => '12.0',\n                                'TVOS_DEPLOYMENT_TARGET' => '$(TVOS_DEPLOYMENT_TARGET_$(XCODE_VERSION_MAJOR))',\n\n                                'OTHER_LDFLAGS' => '\"-Wl,-unexported_symbols_list,${PODS_ROOT}/Realm/Configuration/Realm/PrivateSymbols.txt\"',\n                              }\n  s.preserve_paths          = %w(include scripts Configuration/Realm/PrivateSymbols.txt)\n  s.resource_bundles        = {'realm_objc_privacy' => ['Realm/PrivacyInfo.xcprivacy']}\n\n  s.ios.deployment_target   = '12.0'\n  s.osx.deployment_target   = '10.13'\n  s.watchos.deployment_target = '4.0'\n  s.tvos.deployment_target = '12.0'\n\n  s.vendored_frameworks  = 'core/realm-monorepo.xcframework'\n\n  s.subspec 'Headers' do |s|\n    s.source_files          = public_header_files\n    s.public_header_files   = public_header_files\n  end\nend\n"
  },
  {
    "path": "Realm.xcodeproj/Realm.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>IDEDidComputeMac32BitWarning</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "Realm.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 54;\n\tobjects = {\n\n/* Begin PBXAggregateTarget section */\n\t\tACB76B772AA9D9A600C59983 /* CI */ = {\n\t\t\tisa = PBXAggregateTarget;\n\t\t\tbuildConfigurationList = ACB76B7B2AA9D9A600C59983 /* Build configuration list for PBXAggregateTarget \"CI\" */;\n\t\t\tbuildPhases = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = CI;\n\t\t\tproductName = CI;\n\t\t};\n\t\tE83EAC791BED3D880085CCD2 /* SwiftLint */ = {\n\t\t\tisa = PBXAggregateTarget;\n\t\t\tbuildConfigurationList = E83EAC7C1BED3D880085CCD2 /* Build configuration list for PBXAggregateTarget \"SwiftLint\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE83EAC7D1BED3D8F0085CCD2 /* Run SwiftLint */,\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = SwiftLint;\n\t\t\tproductName = SwiftLint;\n\t\t};\n/* End PBXAggregateTarget section */\n\n/* Begin PBXBuildFile section */\n\t\t0207AB87195DFA15007EFB12 /* MigrationTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0207AB85195DFA15007EFB12 /* MigrationTests.mm */; };\n\t\t0207AB89195DFA15007EFB12 /* SchemaTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0207AB86195DFA15007EFB12 /* SchemaTests.mm */; };\n\t\t021A88321AAFB5C800EEAC84 /* EncryptionTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 021A882F1AAFB5BE00EEAC84 /* EncryptionTests.mm */; };\n\t\t021A88361AAFB5CD00EEAC84 /* ObjectSchemaTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 021A88301AAFB5BE00EEAC84 /* ObjectSchemaTests.m */; };\n\t\t027A4D2C1AB1012500AA46F9 /* InterprocessTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 027A4D291AB1012500AA46F9 /* InterprocessTests.m */; };\n\t\t02AFB4631A80343600E11938 /* PropertyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 02AFB4611A80343600E11938 /* PropertyTests.m */; };\n\t\t02AFB4671A80343600E11938 /* ResultsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 02AFB4621A80343600E11938 /* ResultsTests.m */; };\n\t\t02E334C31A5F41C7009F8810 /* DynamicTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E81A1FBA1955FE0100FDED82 /* DynamicTests.m */; };\n\t\t0C3BD4B325C1BDF1007CFDD3 /* RLMDictionary.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0C3BD4B125C1BDF1007CFDD3 /* RLMDictionary.mm */; };\n\t\t0C3BD4D325C1C5AB007CFDD3 /* Map.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C3BD4D225C1C5AB007CFDD3 /* Map.swift */; };\n\t\t0C5796A225643D7500744CAE /* RLMUUID.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0C57969F25643D7500744CAE /* RLMUUID.mm */; };\n\t\t0C86B33925E15B6000775FED /* PrimitiveDictionaryPropertyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0C86B33825E15B6000775FED /* PrimitiveDictionaryPropertyTests.m */; };\n\t\t0C9758BF264974660097B48D /* SwiftRLMDictionaryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C9758BE264974660097B48D /* SwiftRLMDictionaryTests.swift */; };\n\t\t0CBF2DB927286FFD00635902 /* ProjectedCollectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CBF2DB827286FFD00635902 /* ProjectedCollectTests.swift */; };\n\t\t0CD1632826D3DF1D0027C49B /* ProjectionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CD1632726D3DF1C0027C49B /* ProjectionTests.swift */; };\n\t\t0CED6DB82655087200B80277 /* RLMDictionary_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 0C3BD50125C1DE6F007CFDD3 /* RLMDictionary_Private.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t1A7B823A1D51259F00750296 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7B82391D51259F00750296 /* libz.tbd */; };\n\t\t1AB605D31D495927007F53DE /* RealmCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AB605D21D495927007F53DE /* RealmCollection.swift */; };\n\t\t2973CCF91C175AB400FEA0FA /* fileformat-pre-null.realm in Resources */ = {isa = PBXBuildFile; fileRef = 29B7FDF71C0DE76B0023224E /* fileformat-pre-null.realm */; };\n\t\t297FBEFB1C19F696009D1118 /* RLMTestCaseUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 297FBEFA1C19F696009D1118 /* RLMTestCaseUtils.swift */; };\n\t\t29B7FDF61C0DA6560023224E /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29B7FDF51C0DA6560023224E /* Error.swift */; };\n\t\t29B7FDFB1C0DE8100023224E /* fileformat-pre-null.realm in Resources */ = {isa = PBXBuildFile; fileRef = 29B7FDF71C0DE76B0023224E /* fileformat-pre-null.realm */; };\n\t\t29EDB8E41A7708E700458D80 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E8839B2D19E31FD90047B1A8 /* main.m */; };\n\t\t3F08725527F3B5E0007A1175 /* libcompression.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F08725427F3B5E0007A1175 /* libcompression.tbd */; };\n\t\t3F0BBB9729AFDA6600FEA7A7 /* RLMScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F0BBB9529AFDA6600FEA7A7 /* RLMScheduler.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t3F0BBB9929AFDA6600FEA7A7 /* RLMScheduler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3F0BBB9629AFDA6600FEA7A7 /* RLMScheduler.mm */; };\n\t\t3F102CBD23DBC68300108FD2 /* Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F102CBC23DBC68300108FD2 /* Combine.swift */; };\n\t\t3F149CCB2668112A00111D65 /* PersistedProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F149CCA2668112A00111D65 /* PersistedProperty.swift */; };\n\t\t3F1D8D33265B071000593ABA /* RLMValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F1D8D30265B071000593ABA /* RLMValue.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3F1D8D35265B071000593ABA /* RLMValue.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3F1D8D31265B071000593ABA /* RLMValue.mm */; };\n\t\t3F1D8D77265B075100593ABA /* MapTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F1D8D75265B075000593ABA /* MapTests.swift */; };\n\t\t3F1D8DCB265B077800593ABA /* PrimitiveRLMValuePropertyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F1D8D8E265B076C00593ABA /* PrimitiveRLMValuePropertyTests.m */; };\n\t\t3F1D8DFF265B078200593ABA /* RLMValueTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F1D8D8D265B076C00593ABA /* RLMValueTests.m */; };\n\t\t3F1D9068265C077C00593ABA /* RLMDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 0C3BD4B225C1BDF1007CFDD3 /* RLMDictionary.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3F1D9092265C07A600593ABA /* RLMSwiftValueStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = CF44460626121B2A00BAFDB4 /* RLMSwiftValueStorage.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t3F1D90BC265C08F800593ABA /* RLMSwiftValueStorage.mm in Sources */ = {isa = PBXBuildFile; fileRef = CF44460526121B2A00BAFDB4 /* RLMSwiftValueStorage.mm */; };\n\t\t3F1F47821B9612B300CD99A3 /* KVOTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3F0F029D1B6FFE610046A4D5 /* KVOTests.mm */; };\n\t\t3F222C4E1E26F51300CA0713 /* ThreadSafeReference.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F222C4D1E26F51300CA0713 /* ThreadSafeReference.swift */; };\n\t\t3F2633C31E9D630000B32D30 /* PrimitiveListTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F2633C21E9D630000B32D30 /* PrimitiveListTests.swift */; };\n\t\t3F2E66641CA0BA11004761D5 /* NotificationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F2E66611CA0B9D5004761D5 /* NotificationTests.m */; };\n\t\t3F3411A6273433B300EC9D25 /* ObjcBridgeable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F3411A5273433B300EC9D25 /* ObjcBridgeable.swift */; };\n\t\t3F40C613276D1B05007FEF1A /* CustomObjectCreationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F40C612276D1B05007FEF1A /* CustomObjectCreationTests.swift */; };\n\t\t3F4E0FF92654765C008B8C0B /* ModernKVOTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F4E0FF82654765C008B8C0B /* ModernKVOTests.swift */; };\n\t\t3F4E10102655CA33008B8C0B /* ModernObjectAccessorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F4E100E2655CA33008B8C0B /* ModernObjectAccessorTests.swift */; };\n\t\t3F4E10112655CA33008B8C0B /* RealmPropertyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F4E100F2655CA33008B8C0B /* RealmPropertyTests.swift */; };\n\t\t3F4F3AD523F71C790048DB43 /* RLMDecimal128.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3F4F3ACF23F71C790048DB43 /* RLMDecimal128.mm */; };\n\t\t3F4F3AD723F71C790048DB43 /* RLMObjectId.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F4F3AD023F71C790048DB43 /* RLMObjectId.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3F4F3ADB23F71C790048DB43 /* RLMObjectId.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3F4F3AD223F71C790048DB43 /* RLMObjectId.mm */; };\n\t\t3F4F3ADD23F71C790048DB43 /* RLMDecimal128.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F4F3AD323F71C790048DB43 /* RLMDecimal128.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3F558C8722C29A03002F0F30 /* TestUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3F558C7E22C29A02002F0F30 /* TestUtils.mm */; };\n\t\t3F558C8A22C29A03002F0F30 /* TestUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3F558C7E22C29A02002F0F30 /* TestUtils.mm */; };\n\t\t3F558C8B22C29A03002F0F30 /* RLMTestObjects.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F558C8222C29A02002F0F30 /* RLMTestObjects.m */; };\n\t\t3F558C8E22C29A03002F0F30 /* RLMTestObjects.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F558C8222C29A02002F0F30 /* RLMTestObjects.m */; };\n\t\t3F558C8F22C29A03002F0F30 /* RLMTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F558C8322C29A02002F0F30 /* RLMTestCase.m */; };\n\t\t3F558C9222C29A03002F0F30 /* RLMTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F558C8322C29A02002F0F30 /* RLMTestCase.m */; };\n\t\t3F558C9322C29A03002F0F30 /* RLMMultiProcessTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F558C8522C29A03002F0F30 /* RLMMultiProcessTestCase.m */; };\n\t\t3F558C9622C29A03002F0F30 /* RLMMultiProcessTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F558C8522C29A03002F0F30 /* RLMMultiProcessTestCase.m */; };\n\t\t3F572C941F2BDAAB00F6C9AB /* ThreadSafeReferenceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F572C911F2BDA9F00F6C9AB /* ThreadSafeReferenceTests.m */; };\n\t\t3F572C971F2BDAB100F6C9AB /* PrimitiveArrayPropertyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F572C901F2BDA9F00F6C9AB /* PrimitiveArrayPropertyTests.m */; };\n\t\t3F67DB3C1E26D69C0024533D /* RLMThreadSafeReference.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F67DB391E26D69C0024533D /* RLMThreadSafeReference.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3F67DB3E1E26D69C0024533D /* RLMThreadSafeReference.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3F67DB3B1E26D69C0024533D /* RLMThreadSafeReference.mm */; };\n\t\t3F7556751BE95A0C0058BC7E /* AsyncTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3F7556731BE95A050058BC7E /* AsyncTests.mm */; };\n\t\t3F83E9A42630A14800FC9623 /* RLMSwiftProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F83E9A22630A14800FC9623 /* RLMSwiftProperty.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3F857A482769291800F9B9B1 /* KeyPathStrings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F857A472769291800F9B9B1 /* KeyPathStrings.swift */; };\n\t\t3F857A49276A507200F9B9B1 /* Projection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CD1632526D3DD7B0027C49B /* Projection.swift */; };\n\t\t3F8824FD1E5E335000586B35 /* MigrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D6610011BE98D880021E04F /* MigrationTests.swift */; };\n\t\t3F8824FE1E5E335000586B35 /* ObjectAccessorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D6610021BE98D880021E04F /* ObjectAccessorTests.swift */; };\n\t\t3F8824FF1E5E335000586B35 /* ObjectCreationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D6610031BE98D880021E04F /* ObjectCreationTests.swift */; };\n\t\t3F8825001E5E335000586B35 /* ObjectiveCSupportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BC537151DD5B8D70055C524 /* ObjectiveCSupportTests.swift */; };\n\t\t3F8825011E5E335000586B35 /* ObjectSchemaInitializationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D6610041BE98D880021E04F /* ObjectSchemaInitializationTests.swift */; };\n\t\t3F8825021E5E335000586B35 /* ObjectSchemaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D6610051BE98D880021E04F /* ObjectSchemaTests.swift */; };\n\t\t3F8825031E5E335000586B35 /* ObjectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D6610061BE98D880021E04F /* ObjectTests.swift */; };\n\t\t3F8825041E5E335000586B35 /* PerformanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D6610071BE98D880021E04F /* PerformanceTests.swift */; };\n\t\t3F8825051E5E335000586B35 /* PropertyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D6610081BE98D880021E04F /* PropertyTests.swift */; };\n\t\t3F8825061E5E335000586B35 /* RealmCollectionTypeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D6610091BE98D880021E04F /* RealmCollectionTypeTests.swift */; };\n\t\t3F8825071E5E335000586B35 /* RealmConfigurationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D66100A1BE98D880021E04F /* RealmConfigurationTests.swift */; };\n\t\t3F8825081E5E335000586B35 /* RealmTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D66100C1BE98D880021E04F /* RealmTests.swift */; };\n\t\t3F8825091E5E335000586B35 /* SchemaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D66100D1BE98D880021E04F /* SchemaTests.swift */; };\n\t\t3F88250A1E5E335000586B35 /* SortDescriptorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D66100E1BE98D880021E04F /* SortDescriptorTests.swift */; };\n\t\t3F88250B1E5E335000586B35 /* SwiftLinkTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D66100F1BE98D880021E04F /* SwiftLinkTests.swift */; };\n\t\t3F88250C1E5E335000586B35 /* SwiftUnicodeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D6610111BE98D880021E04F /* SwiftUnicodeTests.swift */; };\n\t\t3F88250D1E5E335000586B35 /* ThreadSafeReferenceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F73BC841E3A870F00FE80B6 /* ThreadSafeReferenceTests.swift */; };\n\t\t3F90C1B22716169C0029000E /* TestValueFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F90C1B12716169C0029000E /* TestValueFactory.swift */; };\n\t\t3F98162A2317763000C3543D /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F9816292317763000C3543D /* libc++.tbd */; };\n\t\t3F98162B2317763600C3543D /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7B82391D51259F00750296 /* libz.tbd */; };\n\t\t3F9863BB1D36876B00641C98 /* RLMClassInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3F9863B91D36876B00641C98 /* RLMClassInfo.mm */; };\n\t\t3F997773273E23D300AA9E13 /* RealmCollectionImpl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F997772273E23D300AA9E13 /* RealmCollectionImpl.swift */; };\n\t\t3F9F53D32718B5DA000EEB4A /* CustomPersistable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F9F53D22718B5DA000EEB4A /* CustomPersistable.swift */; };\n\t\t3F9F53D52718E8E6000EEB4A /* CustomPersistableTestObjects.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F9F53D42718E8E6000EEB4A /* CustomPersistableTestObjects.swift */; };\n\t\t3FA5E94D266064C4008F1345 /* ModernObjectCreationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FA5E94C266064C4008F1345 /* ModernObjectCreationTests.swift */; };\n\t\t3FAF2D4129577100002EAC93 /* TestUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FAF2D4029577100002EAC93 /* TestUtils.swift */; };\n\t\t3FB19069265ECF0C00DA7C76 /* ModernObjectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FB19068265ECF0C00DA7C76 /* ModernObjectTests.swift */; };\n\t\t3FB1906B265ED23300DA7C76 /* ModernTestObjects.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FB1906A265ED23300DA7C76 /* ModernTestObjects.swift */; };\n\t\t3FB4FA1719F5D2740020D53B /* SwiftTestObjects.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8F8D90B196CB8DD00475368 /* SwiftTestObjects.swift */; };\n\t\t3FB4FA1819F5D2740020D53B /* SwiftArrayPropertyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E82FA60A195632F20043A3C3 /* SwiftArrayPropertyTests.swift */; };\n\t\t3FB4FA1919F5D2740020D53B /* SwiftArrayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E82FA60B195632F20043A3C3 /* SwiftArrayTests.swift */; };\n\t\t3FB4FA1A19F5D2740020D53B /* SwiftDynamicTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E83AF538196DDE58002275B2 /* SwiftDynamicTests.swift */; };\n\t\t3FB4FA1B19F5D2740020D53B /* SwiftLinkTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E82FA60D195632F20043A3C3 /* SwiftLinkTests.swift */; };\n\t\t3FB4FA1D19F5D2740020D53B /* SwiftObjectInterfaceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E82FA60F195632F20043A3C3 /* SwiftObjectInterfaceTests.swift */; };\n\t\t3FB4FA1E19F5D2740020D53B /* SwiftPropertyTypeTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26F3CA681986CC86004623E1 /* SwiftPropertyTypeTest.swift */; };\n\t\t3FB4FA1F19F5D2740020D53B /* SwiftRealmTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E81A1FD01955FE0100FDED82 /* SwiftRealmTests.swift */; };\n\t\t3FB4FA2019F5D2740020D53B /* SwiftUnicodeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E891759A197A1B600068ACC6 /* SwiftUnicodeTests.swift */; };\n\t\t3FB6ABD72416A26100E318C2 /* ObjectId.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FB6ABD62416A26100E318C2 /* ObjectId.swift */; };\n\t\t3FB6ABD92416A27000E318C2 /* Decimal128.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FB6ABD82416A27000E318C2 /* Decimal128.swift */; };\n\t\t3FBEF67B1C63D66100F6935B /* RLMCollection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3FBEF6791C63D66100F6935B /* RLMCollection.mm */; };\n\t\t3FC3F912241808B400E27322 /* RLMEmbeddedObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FC3F910241808B300E27322 /* RLMEmbeddedObject.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3FC3F914241808B400E27322 /* RLMEmbeddedObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3FC3F911241808B300E27322 /* RLMEmbeddedObject.mm */; };\n\t\t3FC3F9172419B63200E27322 /* EmbeddedObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FC3F9162419B63100E27322 /* EmbeddedObject.swift */; };\n\t\t3FCB1A7522A9B0A2003807FB /* CodableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FCB1A7422A9B0A2003807FB /* CodableTests.swift */; };\n\t\t3FCC56E429A55607004C5057 /* RLMSwiftObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FCC56E329A55607004C5057 /* RLMSwiftObject.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3FD0D7C729675A2E0031C196 /* RLMAsyncTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FD0D7C529675A2E0031C196 /* RLMAsyncTask.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3FD0D7C929675A2E0031C196 /* RLMAsyncTask.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3FD0D7C629675A2E0031C196 /* RLMAsyncTask.mm */; };\n\t\t3FD6D1A92B4C9EFB00A4FEBE /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 3FD6D1A82B4C9EFB00A4FEBE /* PrivacyInfo.xcprivacy */; };\n\t\t3FD6D1AC2B4CA56D00A4FEBE /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 3FD6D1AB2B4CA56C00A4FEBE /* PrivacyInfo.xcprivacy */; };\n\t\t3FDAB841290B4CCB00168F24 /* RLMError.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FDAB83E290B4CCB00168F24 /* RLMError.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3FDAB845290B4CCB00168F24 /* RLMError.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3FDAB840290B4CCB00168F24 /* RLMError.mm */; };\n\t\t3FDAB848290B658300168F24 /* file-format-version-21.realm in Resources */ = {isa = PBXBuildFile; fileRef = 3FDAB847290B658300168F24 /* file-format-version-21.realm */; };\n\t\t3FDAB849290B659300168F24 /* file-format-version-21.realm in Resources */ = {isa = PBXBuildFile; fileRef = 3FDAB847290B658300168F24 /* file-format-version-21.realm */; };\n\t\t3FDAB84C290B7A0200168F24 /* file-format-version-10.realm in Resources */ = {isa = PBXBuildFile; fileRef = 3FDAB84B290B7A0200168F24 /* file-format-version-10.realm */; };\n\t\t3FDAB84D290B7A0200168F24 /* file-format-version-10.realm in Resources */ = {isa = PBXBuildFile; fileRef = 3FDAB84B290B7A0200168F24 /* file-format-version-10.realm */; };\n\t\t3FDB67152970720E0052233B /* RLMAsyncTask_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FD0D7CB29675AE10031C196 /* RLMAsyncTask_Private.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t3FDCFEB619F6A8D3005E414A /* RLMSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = E88C36FF19745E5500C9963D /* RLMSupport.swift */; };\n\t\t3FE267D5264308680030F83C /* CollectionAccess.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FE267CF264308670030F83C /* CollectionAccess.swift */; };\n\t\t3FE267D6264308680030F83C /* ComplexTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FE267D0264308680030F83C /* ComplexTypes.swift */; };\n\t\t3FE267D7264308680030F83C /* BasicTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FE267D1264308680030F83C /* BasicTypes.swift */; };\n\t\t3FE267D8264308680030F83C /* Persistable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FE267D2264308680030F83C /* Persistable.swift */; };\n\t\t3FE267D9264308680030F83C /* PropertyAccessors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FE267D3264308680030F83C /* PropertyAccessors.swift */; };\n\t\t3FE267DA264308680030F83C /* SchemaDiscovery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FE267D4264308680030F83C /* SchemaDiscovery.swift */; };\n\t\t3FE2BE0323D8CAD1002860E9 /* CombineTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FE2BE0223D8CAD1002860E9 /* CombineTests.swift */; };\n\t\t3FE5B4D724CF6909004D4EF3 /* realm-monorepo.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3FE5B4D424CF3F06004D4EF3 /* realm-monorepo.xcframework */; };\n\t\t3FEB383F1E70AC8800F22712 /* ObjectCreationTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3FEB383C1E70AC6900F22712 /* ObjectCreationTests.mm */; };\n\t\t3FEC4A3F1BBB18D400F009C3 /* SwiftSchemaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FEC4A3D1BBB188B00F009C3 /* SwiftSchemaTests.swift */; };\n\t\t3FEC91562A4B5D520044BFF5 /* libcompression.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3FEC91552A4B5D520044BFF5 /* libcompression.tbd */; };\n\t\t3FEC91582A4B5D600044BFF5 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3FEC91572A4B5D600044BFF5 /* libz.tbd */; };\n\t\t3FEC91592A4B5DE90044BFF5 /* libcompression.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3FEC91552A4B5D520044BFF5 /* libcompression.tbd */; };\n\t\t3FEC915A2A4B5DEF0044BFF5 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3FEC91572A4B5D600044BFF5 /* libz.tbd */; };\n\t\t3FEC915B2A4B65B30044BFF5 /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D659ED91BE04556006515A0 /* Realm.framework */; };\n\t\t3FF3FFAF1F0D6D6400B84599 /* KVOTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D660FFF1BE98D880021E04F /* KVOTests.swift */; };\n\t\t3FFC68702B8EDB69002AE840 /* ObjectCustomPropertiesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FFC686F2B8EDB69002AE840 /* ObjectCustomPropertiesTests.swift */; };\n\t\t530BA61426DFA1CB008FC550 /* RLMChildProcessEnvironment.m in Sources */ = {isa = PBXBuildFile; fileRef = 530BA61326DFA1CB008FC550 /* RLMChildProcessEnvironment.m */; };\n\t\t530BA61526DFA1CB008FC550 /* RLMChildProcessEnvironment.m in Sources */ = {isa = PBXBuildFile; fileRef = 530BA61326DFA1CB008FC550 /* RLMChildProcessEnvironment.m */; };\n\t\t53124AD925B71AF700771CE4 /* SwiftUITestHostUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53124AD825B71AF700771CE4 /* SwiftUITestHostUITests.swift */; };\n\t\t535EA9E225B0919800DBF3CD /* SwiftUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 535EA9E125B0919800DBF3CD /* SwiftUI.swift */; };\n\t\t535EAA7525B0B02B00DBF3CD /* SwiftUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 535EAA7425B0B02B00DBF3CD /* SwiftUITests.swift */; };\n\t\t53626AAF25D31CAC00D9515D /* Objects.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53626AAE25D31CAC00D9515D /* Objects.swift */; };\n\t\t53626AB025D31CAC00D9515D /* Objects.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53626AAE25D31CAC00D9515D /* Objects.swift */; };\n\t\t53A34E3625CDA0AC00698930 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 53A34E3325CDA0AC00698930 /* LaunchScreen.storyboard */; };\n\t\t53A34E3725CDA0AC00698930 /* SwiftUITestHostApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53A34E3425CDA0AC00698930 /* SwiftUITestHostApp.swift */; };\n\t\t5B77EACE1DCC5614006AB51D /* ObjectiveCSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B77EACD1DCC5614006AB51D /* ObjectiveCSupport.swift */; };\n\t\t5D03FB1F1E0DAFBA007D53EA /* PredicateUtilTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5D03FB1E1E0DAFBA007D53EA /* PredicateUtilTests.mm */; };\n\t\t5D128F2A1BE984E5001F4FBF /* Realm.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5D659ED91BE04556006515A0 /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t5D1534B81CCFF545008976D7 /* LinkingObjects.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D1534B71CCFF545008976D7 /* LinkingObjects.swift */; };\n\t\t5D1BF1FF1EF987AD00B7DC87 /* RLMCollection_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D1BF1FE1EF9875300B7DC87 /* RLMCollection_Private.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t5D3E1A2F1C1FC6D5002913BA /* RLMPredicateUtil.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5D3E1A2D1C1FC6D5002913BA /* RLMPredicateUtil.mm */; };\n\t\t5D432B8D1CC0713F00A610A9 /* LinkingObjectsTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5D432B8C1CC0713F00A610A9 /* LinkingObjectsTests.mm */; };\n\t\t5D6156EE1BE0689200A4BD3F /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D659ED91BE04556006515A0 /* Realm.framework */; };\n\t\t5D659E851BE04556006515A0 /* RLMAccessor.mm in Sources */ = {isa = PBXBuildFile; fileRef = E81A1F641955FC9300FDED82 /* RLMAccessor.mm */; };\n\t\t5D659E871BE04556006515A0 /* RLMArray.mm in Sources */ = {isa = PBXBuildFile; fileRef = E81A1F671955FC9300FDED82 /* RLMArray.mm */; };\n\t\t5D659E881BE04556006515A0 /* RLMManagedArray.mm in Sources */ = {isa = PBXBuildFile; fileRef = E81A1F691955FC9300FDED82 /* RLMManagedArray.mm */; };\n\t\t5D659E891BE04556006515A0 /* RLMConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = E81A1F6C1955FC9300FDED82 /* RLMConstants.m */; };\n\t\t5D659E8A1BE04556006515A0 /* RLMSwiftCollectionBase.mm in Sources */ = {isa = PBXBuildFile; fileRef = 023B19561A3BA90D0067FB81 /* RLMSwiftCollectionBase.mm */; };\n\t\t5D659E8B1BE04556006515A0 /* RLMMigration.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0207AB7E195DF9FB007EFB12 /* RLMMigration.mm */; };\n\t\t5D659E8C1BE04556006515A0 /* RLMObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = E81A1F6F1955FC9300FDED82 /* RLMObject.mm */; };\n\t\t5D659E8D1BE04556006515A0 /* RLMObjectBase.mm in Sources */ = {isa = PBXBuildFile; fileRef = 023B19581A3BA90D0067FB81 /* RLMObjectBase.mm */; };\n\t\t5D659E8E1BE04556006515A0 /* RLMObjectSchema.mm in Sources */ = {isa = PBXBuildFile; fileRef = E81A1F721955FC9300FDED82 /* RLMObjectSchema.mm */; };\n\t\t5D659E8F1BE04556006515A0 /* RLMObjectStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = E81A1F741955FC9300FDED82 /* RLMObjectStore.mm */; };\n\t\t5D659E901BE04556006515A0 /* RLMObservation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3F0F02AD1B6FFF3D0046A4D5 /* RLMObservation.mm */; };\n\t\t5D659E921BE04556006515A0 /* RLMProperty.mm in Sources */ = {isa = PBXBuildFile; fileRef = E81A1F771955FC9300FDED82 /* RLMProperty.mm */; };\n\t\t5D659E931BE04556006515A0 /* RLMQueryUtil.mm in Sources */ = {isa = PBXBuildFile; fileRef = E81A1F791955FC9300FDED82 /* RLMQueryUtil.mm */; };\n\t\t5D659E941BE04556006515A0 /* RLMRealm.mm in Sources */ = {isa = PBXBuildFile; fileRef = E81A1F7C1955FC9300FDED82 /* RLMRealm.mm */; };\n\t\t5D659E951BE04556006515A0 /* RLMRealmConfiguration.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0D2DD061B6BDEA1004E8919 /* RLMRealmConfiguration.mm */; };\n\t\t5D659E961BE04556006515A0 /* RLMRealmUtil.mm in Sources */ = {isa = PBXBuildFile; fileRef = 027A4D221AB100E000AA46F9 /* RLMRealmUtil.mm */; };\n\t\t5D659E971BE04556006515A0 /* RLMResults.mm in Sources */ = {isa = PBXBuildFile; fileRef = E81A1F6A1955FC9300FDED82 /* RLMResults.mm */; };\n\t\t5D659E981BE04556006515A0 /* RLMSchema.mm in Sources */ = {isa = PBXBuildFile; fileRef = E81A1F7F1955FC9300FDED82 /* RLMSchema.mm */; };\n\t\t5D659E991BE04556006515A0 /* RLMSwiftSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F452EC519C2279800AFC154 /* RLMSwiftSupport.m */; };\n\t\t5D659E9B1BE04556006515A0 /* RLMUtil.mm in Sources */ = {isa = PBXBuildFile; fileRef = E81A1F821955FC9300FDED82 /* RLMUtil.mm */; };\n\t\t5D659EA51BE04556006515A0 /* Realm.h in Headers */ = {isa = PBXBuildFile; fileRef = E8D89B9D1955FC6D00CF2B9A /* Realm.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5D659EA71BE04556006515A0 /* RLMAccessor.h in Headers */ = {isa = PBXBuildFile; fileRef = E81A1F631955FC9300FDED82 /* RLMAccessor.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t5D659EA91BE04556006515A0 /* RLMArray.h in Headers */ = {isa = PBXBuildFile; fileRef = E81A1F661955FC9300FDED82 /* RLMArray.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5D659EAA1BE04556006515A0 /* RLMArray_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 0237B5421A856F06004ACD57 /* RLMArray_Private.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t5D659EAB1BE04556006515A0 /* RLMCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 02B8EF5B19E7048D0045A93D /* RLMCollection.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5D659EAC1BE04556006515A0 /* RLMConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = E81A1F6B1955FC9300FDED82 /* RLMConstants.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5D659EAE1BE04556006515A0 /* RLMSwiftCollectionBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 023B19551A3BA90D0067FB81 /* RLMSwiftCollectionBase.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t5D659EAF1BE04556006515A0 /* RLMMigration.h in Headers */ = {isa = PBXBuildFile; fileRef = 0207AB7D195DF9FB007EFB12 /* RLMMigration.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5D659EB01BE04556006515A0 /* RLMMigration_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 0207AB7C195DF9FB007EFB12 /* RLMMigration_Private.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t5D659EB11BE04556006515A0 /* RLMObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E81A1F6E1955FC9300FDED82 /* RLMObject.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5D659EB21BE04556006515A0 /* RLMObject_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = E81A1F6D1955FC9300FDED82 /* RLMObject_Private.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t5D659EB31BE04556006515A0 /* RLMObjectBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 023B19571A3BA90D0067FB81 /* RLMObjectBase.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5D659EB41BE04556006515A0 /* RLMObjectBase_Dynamic.h in Headers */ = {isa = PBXBuildFile; fileRef = A05FA61E1B62C3900000C9B2 /* RLMObjectBase_Dynamic.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5D659EB51BE04556006515A0 /* RLMObjectSchema.h in Headers */ = {isa = PBXBuildFile; fileRef = E81A1F711955FC9300FDED82 /* RLMObjectSchema.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5D659EB61BE04556006515A0 /* RLMObjectSchema_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 29EDB8E91A7712E500458D80 /* RLMObjectSchema_Private.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t5D659EB81BE04556006515A0 /* RLMObjectStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 29EDB8D71A7703C500458D80 /* RLMObjectStore.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t5D659EBC1BE04556006515A0 /* RLMProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = E81A1F761955FC9300FDED82 /* RLMProperty.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5D659EBD1BE04556006515A0 /* RLMProperty_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = E81A1F751955FC9300FDED82 /* RLMProperty_Private.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t5D659EBF1BE04556006515A0 /* RLMRealm.h in Headers */ = {isa = PBXBuildFile; fileRef = E81A1F7B1955FC9300FDED82 /* RLMRealm.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5D659EC01BE04556006515A0 /* RLMRealm_Dynamic.h in Headers */ = {isa = PBXBuildFile; fileRef = E8951F01196C96DE00D6461C /* RLMRealm_Dynamic.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5D659EC11BE04556006515A0 /* RLMRealm_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 29EDB8E01A77070200458D80 /* RLMRealm_Private.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t5D659EC21BE04556006515A0 /* RLMRealmConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = C0D2DD051B6BDEA1004E8919 /* RLMRealmConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5D659EC31BE04556006515A0 /* RLMRealmConfiguration_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = C0D2DD0F1B6BE0DD004E8919 /* RLMRealmConfiguration_Private.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t5D659EC51BE04556006515A0 /* RLMResults.h in Headers */ = {isa = PBXBuildFile; fileRef = 02B8EF5819E601D80045A93D /* RLMResults.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5D659EC61BE04556006515A0 /* RLMResults_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 29EDB8E51A7710B700458D80 /* RLMResults_Private.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t5D659EC71BE04556006515A0 /* RLMSchema.h in Headers */ = {isa = PBXBuildFile; fileRef = E81A1F7E1955FC9300FDED82 /* RLMSchema.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5D659EC81BE04556006515A0 /* RLMSchema_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = E81A1F7D1955FC9300FDED82 /* RLMSchema_Private.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t5D659EC91BE04556006515A0 /* RLMSwiftSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FE79FF719BA6A5900780C9A /* RLMSwiftSupport.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t5D659ED21BE04556006515A0 /* CHANGELOG.md in Resources */ = {isa = PBXBuildFile; fileRef = E81A1FB31955FCE000FDED82 /* CHANGELOG.md */; };\n\t\t5D659ED51BE04556006515A0 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = E81A1FB41955FCE000FDED82 /* LICENSE */; };\n\t\t5D660FDD1BE98C7C0021E04F /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D660FCC1BE98C560021E04F /* RealmSwift.framework */; };\n\t\t5D660FF11BE98D670021E04F /* Aliases.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D660FE31BE98D670021E04F /* Aliases.swift */; };\n\t\t5D660FF21BE98D670021E04F /* List.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D660FE41BE98D670021E04F /* List.swift */; };\n\t\t5D660FF31BE98D670021E04F /* Migration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D660FE51BE98D670021E04F /* Migration.swift */; };\n\t\t5D660FF41BE98D670021E04F /* Object.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D660FE61BE98D670021E04F /* Object.swift */; };\n\t\t5D660FF51BE98D670021E04F /* ObjectSchema.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D660FE71BE98D670021E04F /* ObjectSchema.swift */; };\n\t\t5D660FF61BE98D670021E04F /* Optional.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D660FE81BE98D670021E04F /* Optional.swift */; };\n\t\t5D660FF71BE98D670021E04F /* Property.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D660FE91BE98D670021E04F /* Property.swift */; };\n\t\t5D660FF81BE98D670021E04F /* Realm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D660FEA1BE98D670021E04F /* Realm.swift */; };\n\t\t5D660FFA1BE98D670021E04F /* RealmConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D660FEC1BE98D670021E04F /* RealmConfiguration.swift */; };\n\t\t5D660FFB1BE98D670021E04F /* Results.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D660FED1BE98D670021E04F /* Results.swift */; };\n\t\t5D660FFC1BE98D670021E04F /* Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D660FEE1BE98D670021E04F /* Schema.swift */; };\n\t\t5D660FFD1BE98D670021E04F /* SortDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D660FEF1BE98D670021E04F /* SortDescriptor.swift */; };\n\t\t5D660FFE1BE98D670021E04F /* Util.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D660FF01BE98D670021E04F /* Util.swift */; };\n\t\t5D6610161BE98D880021E04F /* ListTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D6610001BE98D880021E04F /* ListTests.swift */; };\n\t\t5D6610251BE98D880021E04F /* SwiftTestObjects.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D6610101BE98D880021E04F /* SwiftTestObjects.swift */; };\n\t\t5D6610271BE98D880021E04F /* TestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D6610121BE98D880021E04F /* TestCase.swift */; };\n\t\t5D66102A1BE98DD00021E04F /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D659ED91BE04556006515A0 /* Realm.framework */; };\n\t\t5D66102E1BE98E500021E04F /* Realm.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5D659ED91BE04556006515A0 /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t5D66102F1BE98E540021E04F /* RealmSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5D660FCC1BE98C560021E04F /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t5DBEC9B11F719A9D001233EC /* Util.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D660FF01BE98D670021E04F /* Util.swift */; };\n\t\t681EE33B25EE8E1400A9DEC5 /* AnyRealmValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 681EE33A25EE8E1400A9DEC5 /* AnyRealmValue.swift */; };\n\t\t681EE34725EE8E5600A9DEC5 /* ObjectiveCSupport+AnyRealmValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 681EE34625EE8E5600A9DEC5 /* ObjectiveCSupport+AnyRealmValue.swift */; };\n\t\t68A7B91D2543538B00C703BC /* RLMSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = E88C36FF19745E5500C9963D /* RLMSupport.swift */; };\n\t\tAC3B33AE29DC6CEE0042F3A0 /* RLMLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = AC3B33AB29DC6CEE0042F3A0 /* RLMLogger.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tAC3B33AF29DC6CEE0042F3A0 /* RLMLogger.mm in Sources */ = {isa = PBXBuildFile; fileRef = AC3B33AC29DC6CEE0042F3A0 /* RLMLogger.mm */; };\n\t\tAC3B33B029DC6CEE0042F3A0 /* RLMLogger_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = AC3B33AD29DC6CEE0042F3A0 /* RLMLogger_Private.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tAC5300722BD03D4A00BF5950 /* MixedCollectionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC5300712BD03D4900BF5950 /* MixedCollectionTest.swift */; };\n\t\tAC7825B92ACD90BE007ABA4B /* Geospatial.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC7825B82ACD90BE007ABA4B /* Geospatial.swift */; };\n\t\tAC7825BD2ACD90DA007ABA4B /* RLMGeospatial.mm in Sources */ = {isa = PBXBuildFile; fileRef = AC7825BA2ACD90DA007ABA4B /* RLMGeospatial.mm */; };\n\t\tAC7825BF2ACD90DA007ABA4B /* RLMGeospatial.h in Headers */ = {isa = PBXBuildFile; fileRef = AC7825BC2ACD90DA007ABA4B /* RLMGeospatial.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tAC7825C22ACD917B007ABA4B /* GeospatialTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC7825C02ACD916C007ABA4B /* GeospatialTests.swift */; };\n\t\tACF08B6726DD936200686CBC /* Query.swift in Sources */ = {isa = PBXBuildFile; fileRef = ACF08B6626DD936200686CBC /* Query.swift */; };\n\t\tACFF0EC728EC5ADB0097AEE0 /* CustomColumnNameTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ACFF0EC628EC5ADB0097AEE0 /* CustomColumnNameTests.swift */; };\n\t\tC042A48D1B7522A900771ED2 /* RealmConfigurationTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = C042A48C1B7522A900771ED2 /* RealmConfigurationTests.mm */; };\n\t\tC0CDC0821B38DABA00C5716D /* UtilTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 021A88311AAFB5BE00EEAC84 /* UtilTests.mm */; };\n\t\tCF040494263DF0AA00F9AEE0 /* PrimitiveMapTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF040493263DF0A900F9AEE0 /* PrimitiveMapTests.swift */; };\n\t\tCF052EFB25DEB671008EEF86 /* DictionaryPropertyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CF052EFA25DEB671008EEF86 /* DictionaryPropertyTests.m */; };\n\t\tCF0D04F1269365300038A058 /* KeyPathTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF0D04F02693652E0038A058 /* KeyPathTests.swift */; };\n\t\tCF25080E283B90F8007D66FE /* SectionedResultsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CF25080D283B90F8007D66FE /* SectionedResultsTests.m */; };\n\t\tCF44461E26121C6800BAFDB4 /* RealmProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF44461D26121C6800BAFDB4 /* RealmProperty.swift */; };\n\t\tCF46CC0226D931BA00DE450C /* QueryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF46CC0026D931BA00DE450C /* QueryTests.swift */; };\n\t\tCF84D4F0281823B300005E27 /* SectionedResults.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF84D4EF281823B300005E27 /* SectionedResults.swift */; };\n\t\tCF986D1E25AE3B090039D287 /* RLMSet_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = CF986D1A25AE3B080039D287 /* RLMSet_Private.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tCF986D2025AE3B090039D287 /* RLMSet.mm in Sources */ = {isa = PBXBuildFile; fileRef = CF986D1B25AE3B080039D287 /* RLMSet.mm */; };\n\t\tCF986D2425AE3B090039D287 /* RLMSet.h in Headers */ = {isa = PBXBuildFile; fileRef = CF986D1D25AE3B090039D287 /* RLMSet.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tCF986D3125AE3BD40039D287 /* PrimitiveSetPropertyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CF986D2F25AE3BD40039D287 /* PrimitiveSetPropertyTests.m */; };\n\t\tCF986D3325AE3BD40039D287 /* SetPropertyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CF986D3025AE3BD40039D287 /* SetPropertyTests.m */; };\n\t\tCF986D7025AE3C550039D287 /* SwiftSetPropertyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF986D4725AE3C420039D287 /* SwiftSetPropertyTests.swift */; };\n\t\tCF986D8425AE3C5A0039D287 /* SwiftSetTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF986D4825AE3C420039D287 /* SwiftSetTests.swift */; };\n\t\tCF986DE225AE3EC70039D287 /* MutableSetTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF986DE125AE3EC70039D287 /* MutableSetTests.swift */; };\n\t\tCF986DF625AE3EDF0039D287 /* PrimitiveMutableSetTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF986DF525AE3EDF0039D287 /* PrimitiveMutableSetTests.swift */; };\n\t\tCF9881C125DABC6500BD7E4F /* RLMManagedDictionary.mm in Sources */ = {isa = PBXBuildFile; fileRef = CF9881C025DABC6500BD7E4F /* RLMManagedDictionary.mm */; };\n\t\tCFD8D12025BB0B8B0037FE4D /* RLMManagedSet.mm in Sources */ = {isa = PBXBuildFile; fileRef = CFD8D11F25BB0B8B0037FE4D /* RLMManagedSet.mm */; };\n\t\tCFDBC4B628803C7200EE80E6 /* RLMSectionedResults.mm in Sources */ = {isa = PBXBuildFile; fileRef = CFDBC4B328803C7200EE80E6 /* RLMSectionedResults.mm */; };\n\t\tCFDBC4B728803C7200EE80E6 /* RLMSectionedResults.h in Headers */ = {isa = PBXBuildFile; fileRef = CFDBC4B428803C7200EE80E6 /* RLMSectionedResults.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tCFDBC4C0288040E700EE80E6 /* SectionedResultsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFDBC4BE288040CD00EE80E6 /* SectionedResultsTests.swift */; };\n\t\tCFE9CE31265554FB00BF96D6 /* MutableSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF986D8E25AE3C980039D287 /* MutableSet.swift */; };\n\t\tCFE9CE3326555BBD00BF96D6 /* RealmKeyedCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFE9CE3226555BBD00BF96D6 /* RealmKeyedCollection.swift */; };\n\t\tCFFC8CC8262310C800929608 /* AnyRealmValueTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFFC8CC7262310C800929608 /* AnyRealmValueTests.swift */; };\n\t\tCFFECBAA250646820010F585 /* Decimal128Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFFECBA8250646750010F585 /* Decimal128Tests.swift */; };\n\t\tCFFECBAD250667B20010F585 /* Decimal128Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = CFFECBAB250667A90010F585 /* Decimal128Tests.m */; };\n\t\tCFFECBB0250690EA0010F585 /* ObjectIdTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CFFECBAF250690EA0010F585 /* ObjectIdTests.m */; };\n\t\tCFFECBB525078EC40010F585 /* ObjectIdTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFFECBB225078D100010F585 /* ObjectIdTests.swift */; };\n\t\tE81A1FD51955FE0100FDED82 /* ArrayPropertyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E81A1FB81955FE0100FDED82 /* ArrayPropertyTests.m */; settings = {COMPILER_FLAGS = \"-fobjc-arc-exceptions\"; }; };\n\t\tE81A1FDB1955FE0100FDED82 /* EnumeratorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E81A1FBB1955FE0100FDED82 /* EnumeratorTests.m */; settings = {COMPILER_FLAGS = \"-fobjc-arc-exceptions\"; }; };\n\t\tE81A1FDD1955FE0100FDED82 /* LinkTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E81A1FBC1955FE0100FDED82 /* LinkTests.m */; settings = {COMPILER_FLAGS = \"-fobjc-arc-exceptions\"; }; };\n\t\tE81A1FE11955FE0100FDED82 /* ObjectInterfaceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E81A1FBE1955FE0100FDED82 /* ObjectInterfaceTests.m */; settings = {COMPILER_FLAGS = \"-fobjc-arc-exceptions\"; }; };\n\t\tE81A1FE31955FE0100FDED82 /* ObjectTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E81A1FBF1955FE0100FDED82 /* ObjectTests.m */; settings = {COMPILER_FLAGS = \"-fobjc-arc-exceptions\"; }; };\n\t\tE81A1FE71955FE0100FDED82 /* QueryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E81A1FC11955FE0100FDED82 /* QueryTests.m */; };\n\t\tE81A1FEB1955FE0100FDED82 /* RealmTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = E81A1FC31955FE0100FDED82 /* RealmTests.mm */; };\n\t\tE81A20021955FE0100FDED82 /* TransactionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E81A1FD11955FE0100FDED82 /* TransactionTests.m */; };\n\t\tE8917598197A1B350068ACC6 /* UnicodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E8917597197A1B350068ACC6 /* UnicodeTests.m */; };\n\t\tE8AE7C261EA436F800CDFF9A /* CompactionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8AE7C251EA436F800CDFF9A /* CompactionTests.swift */; };\n\t\tE8DA16F81E81210D0055141C /* CompactionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DA16F71E81210D0055141C /* CompactionTests.m */; };\n\t\tE8F992BE1F1401C100F634B5 /* RLMObjectBase_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = E8F992BD1F1401C100F634B5 /* RLMObjectBase_Private.h */; settings = {ATTRIBUTES = (Private, ); }; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t3FC8BF34212B79F4001C2025 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = E8D89B8F1955FC6D00CF2B9A /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 3F1A5E711992EB7400F45F4C;\n\t\t\tremoteInfo = TestHost;\n\t\t};\n\t\t3FF5165126E96D2B00618280 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = E8D89B8F1955FC6D00CF2B9A /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 5D660FCB1BE98C560021E04F;\n\t\t\tremoteInfo = RealmSwift;\n\t\t};\n\t\t534DF4CF25B86F3A00655AE2 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = E8D89B8F1955FC6D00CF2B9A /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 53124AB725B71AF600771CE4;\n\t\t\tremoteInfo = SwiftUITestHost;\n\t\t};\n\t\t53BBF08C25B7436F00D225AD /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = E8D89B8F1955FC6D00CF2B9A /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 5D660FCB1BE98C560021E04F;\n\t\t\tremoteInfo = RealmSwift;\n\t\t};\n\t\t5D6157011BE0A3A100A4BD3F /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = E8D89B8F1955FC6D00CF2B9A /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 3F1A5E711992EB7400F45F4C;\n\t\t\tremoteInfo = TestHost;\n\t\t};\n\t\t5D660FDE1BE98C7C0021E04F /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = E8D89B8F1955FC6D00CF2B9A /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 5D660FCB1BE98C560021E04F;\n\t\t\tremoteInfo = RealmSwift;\n\t\t};\n\t\t5D66102B1BE98DF60021E04F /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = E8D89B8F1955FC6D00CF2B9A /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 5D659E7D1BE04556006515A0;\n\t\t\tremoteInfo = Realm;\n\t\t};\n\t\t5DD755D11BE05828002800DA /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = E8D89B8F1955FC6D00CF2B9A /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 5D659E7D1BE04556006515A0;\n\t\t\tremoteInfo = Realm;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXCopyFilesBuildPhase section */\n\t\t5D128F291BE984D4001F4FBF /* Embed Frameworks */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\t5D128F2A1BE984E5001F4FBF /* Realm.framework in Embed Frameworks */,\n\t\t\t);\n\t\t\tname = \"Embed Frameworks\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t5D66102D1BE98E360021E04F /* Embed Frameworks */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\t5D66102E1BE98E500021E04F /* Realm.framework in Embed Frameworks */,\n\t\t\t\t5D66102F1BE98E540021E04F /* RealmSwift.framework in Embed Frameworks */,\n\t\t\t);\n\t\t\tname = \"Embed Frameworks\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXCopyFilesBuildPhase section */\n\n/* Begin PBXFileReference section */\n\t\t0207AB7C195DF9FB007EFB12 /* RLMMigration_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMMigration_Private.h; sourceTree = \"<group>\"; };\n\t\t0207AB7D195DF9FB007EFB12 /* RLMMigration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMMigration.h; sourceTree = \"<group>\"; };\n\t\t0207AB7E195DF9FB007EFB12 /* RLMMigration.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMMigration.mm; sourceTree = \"<group>\"; };\n\t\t0207AB85195DFA15007EFB12 /* MigrationTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MigrationTests.mm; sourceTree = \"<group>\"; };\n\t\t0207AB86195DFA15007EFB12 /* SchemaTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SchemaTests.mm; sourceTree = \"<group>\"; };\n\t\t0217D7B819CD0ACD00DE5C32 /* Swift-Tests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = \"Swift-Tests-Bridging-Header.h\"; sourceTree = \"<group>\"; };\n\t\t021A882F1AAFB5BE00EEAC84 /* EncryptionTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = EncryptionTests.mm; sourceTree = \"<group>\"; };\n\t\t021A88301AAFB5BE00EEAC84 /* ObjectSchemaTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ObjectSchemaTests.m; sourceTree = \"<group>\"; };\n\t\t021A88311AAFB5BE00EEAC84 /* UtilTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = UtilTests.mm; sourceTree = \"<group>\"; };\n\t\t0237B5421A856F06004ACD57 /* RLMArray_Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RLMArray_Private.h; sourceTree = \"<group>\"; };\n\t\t023B19551A3BA90D0067FB81 /* RLMSwiftCollectionBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMSwiftCollectionBase.h; sourceTree = \"<group>\"; };\n\t\t023B19561A3BA90D0067FB81 /* RLMSwiftCollectionBase.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMSwiftCollectionBase.mm; sourceTree = \"<group>\"; };\n\t\t023B19571A3BA90D0067FB81 /* RLMObjectBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMObjectBase.h; sourceTree = \"<group>\"; };\n\t\t023B19581A3BA90D0067FB81 /* RLMObjectBase.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMObjectBase.mm; sourceTree = \"<group>\"; };\n\t\t023B19F71A423BD20067FB81 /* libc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = \"compiled.mach-o.dylib\"; name = \"libc++.dylib\"; path = \"usr/lib/libc++.dylib\"; sourceTree = SDKROOT; };\n\t\t027A4D211AB100E000AA46F9 /* RLMRealmUtil.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMRealmUtil.hpp; sourceTree = \"<group>\"; };\n\t\t027A4D221AB100E000AA46F9 /* RLMRealmUtil.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMRealmUtil.mm; sourceTree = \"<group>\"; };\n\t\t027A4D291AB1012500AA46F9 /* InterprocessTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InterprocessTests.m; sourceTree = \"<group>\"; };\n\t\t02AFB4611A80343600E11938 /* PropertyTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PropertyTests.m; sourceTree = \"<group>\"; };\n\t\t02AFB4621A80343600E11938 /* ResultsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResultsTests.m; sourceTree = \"<group>\"; };\n\t\t02B8EF5819E601D80045A93D /* RLMResults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMResults.h; sourceTree = \"<group>\"; };\n\t\t02B8EF5B19E7048D0045A93D /* RLMCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMCollection.h; sourceTree = \"<group>\"; };\n\t\t02E334C21A5F3C45009F8810 /* Realm.modulemap */ = {isa = PBXFileReference; lastKnownFileType = \"sourcecode.module-map\"; path = Realm.modulemap; sourceTree = \"<group>\"; };\n\t\t02E334C41A5F4923009F8810 /* RLMRealm_Private.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = RLMRealm_Private.hpp; sourceTree = \"<group>\"; };\n\t\t0C3BD4B125C1BDF1007CFDD3 /* RLMDictionary.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMDictionary.mm; sourceTree = \"<group>\"; };\n\t\t0C3BD4B225C1BDF1007CFDD3 /* RLMDictionary.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RLMDictionary.h; sourceTree = \"<group>\"; };\n\t\t0C3BD4D225C1C5AB007CFDD3 /* Map.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Map.swift; sourceTree = \"<group>\"; };\n\t\t0C3BD50125C1DE6F007CFDD3 /* RLMDictionary_Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RLMDictionary_Private.h; sourceTree = \"<group>\"; };\n\t\t0C57969F25643D7500744CAE /* RLMUUID.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMUUID.mm; sourceTree = \"<group>\"; };\n\t\t0C7CA7C225C311DA0098A636 /* RLMManagedDictionary.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMManagedDictionary.mm; sourceTree = \"<group>\"; };\n\t\t0C86B33825E15B6000775FED /* PrimitiveDictionaryPropertyTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PrimitiveDictionaryPropertyTests.m; sourceTree = \"<group>\"; };\n\t\t0C9758BE264974660097B48D /* SwiftRLMDictionaryTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftRLMDictionaryTests.swift; sourceTree = \"<group>\"; };\n\t\t0CBF2DB827286FFD00635902 /* ProjectedCollectTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectedCollectTests.swift; sourceTree = \"<group>\"; };\n\t\t0CD1632526D3DD7B0027C49B /* Projection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Projection.swift; sourceTree = \"<group>\"; };\n\t\t0CD1632726D3DF1C0027C49B /* ProjectionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProjectionTests.swift; sourceTree = \"<group>\"; };\n\t\t1A1EBF861F269E8E00F47698 /* RLMResults_Private.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = RLMResults_Private.hpp; sourceTree = \"<group>\"; };\n\t\t1A7B82391D51259F00750296 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = \"sourcecode.text-based-dylib-definition\"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };\n\t\t1AB605D21D495927007F53DE /* RealmCollection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmCollection.swift; sourceTree = \"<group>\"; };\n\t\t26F3CA681986CC86004623E1 /* SwiftPropertyTypeTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftPropertyTypeTest.swift; sourceTree = \"<group>\"; };\n\t\t297FBEFA1C19F696009D1118 /* RLMTestCaseUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RLMTestCaseUtils.swift; sourceTree = \"<group>\"; };\n\t\t29B7FDF51C0DA6560023224E /* Error.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Error.swift; sourceTree = \"<group>\"; };\n\t\t29B7FDF71C0DE76B0023224E /* fileformat-pre-null.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"fileformat-pre-null.realm\"; sourceTree = \"<group>\"; };\n\t\t29EDB8D71A7703C500458D80 /* RLMObjectStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMObjectStore.h; sourceTree = \"<group>\"; };\n\t\t29EDB8E01A77070200458D80 /* RLMRealm_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMRealm_Private.h; sourceTree = \"<group>\"; };\n\t\t29EDB8E51A7710B700458D80 /* RLMResults_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMResults_Private.h; sourceTree = \"<group>\"; };\n\t\t29EDB8E91A7712E500458D80 /* RLMObjectSchema_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMObjectSchema_Private.h; sourceTree = \"<group>\"; };\n\t\t3F0338491E6F466D00F9E288 /* RLMAccessor.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = RLMAccessor.hpp; sourceTree = \"<group>\"; };\n\t\t3F04EA2D1992BEE400C2CE2E /* PerformanceTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PerformanceTests.m; sourceTree = \"<group>\"; };\n\t\t3F08725427F3B5E0007A1175 /* libcompression.tbd */ = {isa = PBXFileReference; lastKnownFileType = \"sourcecode.text-based-dylib-definition\"; name = libcompression.tbd; path = usr/lib/libcompression.tbd; sourceTree = SDKROOT; };\n\t\t3F0BBB9529AFDA6600FEA7A7 /* RLMScheduler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RLMScheduler.h; sourceTree = \"<group>\"; };\n\t\t3F0BBB9629AFDA6600FEA7A7 /* RLMScheduler.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMScheduler.mm; sourceTree = \"<group>\"; };\n\t\t3F0F029D1B6FFE610046A4D5 /* KVOTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KVOTests.mm; sourceTree = \"<group>\"; };\n\t\t3F0F02AC1B6FFF3D0046A4D5 /* RLMObservation.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMObservation.hpp; sourceTree = \"<group>\"; };\n\t\t3F0F02AD1B6FFF3D0046A4D5 /* RLMObservation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMObservation.mm; sourceTree = \"<group>\"; };\n\t\t3F102CBC23DBC68300108FD2 /* Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Combine.swift; sourceTree = \"<group>\"; };\n\t\t3F149CCA2668112A00111D65 /* PersistedProperty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PersistedProperty.swift; sourceTree = \"<group>\"; };\n\t\t3F1A5E721992EB7400F45F4C /* TestHost.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestHost.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t3F1D8D30265B071000593ABA /* RLMValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMValue.h; sourceTree = \"<group>\"; };\n\t\t3F1D8D31265B071000593ABA /* RLMValue.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMValue.mm; sourceTree = \"<group>\"; };\n\t\t3F1D8D32265B071000593ABA /* RLMUUID_Private.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMUUID_Private.hpp; sourceTree = \"<group>\"; };\n\t\t3F1D8D75265B075000593ABA /* MapTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapTests.swift; sourceTree = \"<group>\"; };\n\t\t3F1D8D8D265B076C00593ABA /* RLMValueTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RLMValueTests.m; sourceTree = \"<group>\"; };\n\t\t3F1D8D8E265B076C00593ABA /* PrimitiveRLMValuePropertyTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PrimitiveRLMValuePropertyTests.m; sourceTree = \"<group>\"; };\n\t\t3F1D8D8F265B076C00593ABA /* PrimitiveDictionaryPropertyTests.tpl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PrimitiveDictionaryPropertyTests.tpl.m; sourceTree = \"<group>\"; };\n\t\t3F1D8D90265B076C00593ABA /* PrimitiveSetPropertyTests.tpl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PrimitiveSetPropertyTests.tpl.m; sourceTree = \"<group>\"; };\n\t\t3F1D8D91265B076C00593ABA /* PrimitiveRLMValuePropertyTests.tpl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PrimitiveRLMValuePropertyTests.tpl.m; sourceTree = \"<group>\"; };\n\t\t3F1D8D92265B076C00593ABA /* PrimitiveArrayPropertyTests.tpl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PrimitiveArrayPropertyTests.tpl.m; sourceTree = \"<group>\"; };\n\t\t3F222C4D1E26F51300CA0713 /* ThreadSafeReference.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThreadSafeReference.swift; sourceTree = \"<group>\"; };\n\t\t3F2633C21E9D630000B32D30 /* PrimitiveListTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrimitiveListTests.swift; sourceTree = \"<group>\"; };\n\t\t3F2E66611CA0B9D5004761D5 /* NotificationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NotificationTests.m; sourceTree = \"<group>\"; };\n\t\t3F3411A5273433B300EC9D25 /* ObjcBridgeable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObjcBridgeable.swift; sourceTree = \"<group>\"; };\n\t\t3F4071342A57472F00D9C4A3 /* PrivateSymbols.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = PrivateSymbols.txt; sourceTree = \"<group>\"; };\n\t\t3F40C612276D1B05007FEF1A /* CustomObjectCreationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomObjectCreationTests.swift; sourceTree = \"<group>\"; };\n\t\t3F452EC519C2279800AFC154 /* RLMSwiftSupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RLMSwiftSupport.m; path = Realm/RLMSwiftSupport.m; sourceTree = SOURCE_ROOT; };\n\t\t3F4E0FF82654765C008B8C0B /* ModernKVOTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModernKVOTests.swift; sourceTree = \"<group>\"; };\n\t\t3F4E100E2655CA33008B8C0B /* ModernObjectAccessorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModernObjectAccessorTests.swift; sourceTree = \"<group>\"; };\n\t\t3F4E100F2655CA33008B8C0B /* RealmPropertyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmPropertyTests.swift; sourceTree = \"<group>\"; };\n\t\t3F4E324B1B98C6C700183A69 /* RLMSchema_Private.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = RLMSchema_Private.hpp; sourceTree = \"<group>\"; };\n\t\t3F4F3ACF23F71C790048DB43 /* RLMDecimal128.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMDecimal128.mm; sourceTree = \"<group>\"; };\n\t\t3F4F3AD023F71C790048DB43 /* RLMObjectId.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMObjectId.h; sourceTree = \"<group>\"; };\n\t\t3F4F3AD123F71C790048DB43 /* RLMDecimal128_Private.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMDecimal128_Private.hpp; sourceTree = \"<group>\"; };\n\t\t3F4F3AD223F71C790048DB43 /* RLMObjectId.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMObjectId.mm; sourceTree = \"<group>\"; };\n\t\t3F4F3AD323F71C790048DB43 /* RLMDecimal128.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMDecimal128.h; sourceTree = \"<group>\"; };\n\t\t3F4F3AD423F71C790048DB43 /* RLMObjectId_Private.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMObjectId_Private.hpp; sourceTree = \"<group>\"; };\n\t\t3F558C7E22C29A02002F0F30 /* TestUtils.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TestUtils.mm; path = Realm/TestUtils/TestUtils.mm; sourceTree = \"<group>\"; };\n\t\t3F558C7F22C29A02002F0F30 /* RLMTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RLMTestCase.h; path = Realm/TestUtils/include/RLMTestCase.h; sourceTree = \"<group>\"; };\n\t\t3F558C8022C29A02002F0F30 /* RLMMultiProcessTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RLMMultiProcessTestCase.h; path = Realm/TestUtils/include/RLMMultiProcessTestCase.h; sourceTree = \"<group>\"; };\n\t\t3F558C8122C29A02002F0F30 /* RLMTestObjects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RLMTestObjects.h; path = Realm/TestUtils/include/RLMTestObjects.h; sourceTree = \"<group>\"; };\n\t\t3F558C8222C29A02002F0F30 /* RLMTestObjects.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RLMTestObjects.m; path = Realm/TestUtils/RLMTestObjects.m; sourceTree = \"<group>\"; };\n\t\t3F558C8322C29A02002F0F30 /* RLMTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RLMTestCase.m; path = Realm/TestUtils/RLMTestCase.m; sourceTree = \"<group>\"; };\n\t\t3F558C8422C29A03002F0F30 /* RLMAssertions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RLMAssertions.h; path = Realm/TestUtils/include/RLMAssertions.h; sourceTree = \"<group>\"; };\n\t\t3F558C8522C29A03002F0F30 /* RLMMultiProcessTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RLMMultiProcessTestCase.m; path = Realm/TestUtils/RLMMultiProcessTestCase.m; sourceTree = \"<group>\"; };\n\t\t3F558C8622C29A03002F0F30 /* TestUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestUtils.h; path = Realm/TestUtils/include/TestUtils.h; sourceTree = \"<group>\"; };\n\t\t3F572C901F2BDA9F00F6C9AB /* PrimitiveArrayPropertyTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PrimitiveArrayPropertyTests.m; sourceTree = \"<group>\"; };\n\t\t3F572C911F2BDA9F00F6C9AB /* ThreadSafeReferenceTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ThreadSafeReferenceTests.m; sourceTree = \"<group>\"; };\n\t\t3F67DB391E26D69C0024533D /* RLMThreadSafeReference.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMThreadSafeReference.h; sourceTree = \"<group>\"; };\n\t\t3F67DB3A1E26D69C0024533D /* RLMThreadSafeReference_Private.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMThreadSafeReference_Private.hpp; sourceTree = \"<group>\"; };\n\t\t3F67DB3B1E26D69C0024533D /* RLMThreadSafeReference.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMThreadSafeReference.mm; sourceTree = \"<group>\"; };\n\t\t3F68BFCD1B558CA800D50FBD /* RLMPrefix.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RLMPrefix.h; sourceTree = \"<group>\"; };\n\t\t3F73BC841E3A870F00FE80B6 /* ThreadSafeReferenceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThreadSafeReferenceTests.swift; sourceTree = \"<group>\"; };\n\t\t3F7556731BE95A050058BC7E /* AsyncTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AsyncTests.mm; sourceTree = \"<group>\"; };\n\t\t3F83E9A22630A14800FC9623 /* RLMSwiftProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMSwiftProperty.h; sourceTree = \"<group>\"; };\n\t\t3F852BE9278E1F000009DF74 /* TestBase.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = TestBase.xcconfig; sourceTree = \"<group>\"; };\n\t\t3F857A472769291800F9B9B1 /* KeyPathStrings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyPathStrings.swift; sourceTree = \"<group>\"; };\n\t\t3F90C1B12716169C0029000E /* TestValueFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestValueFactory.swift; sourceTree = \"<group>\"; };\n\t\t3F9816292317763000C3543D /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = \"sourcecode.text-based-dylib-definition\"; name = \"libc++.tbd\"; path = \"usr/lib/libc++.tbd\"; sourceTree = SDKROOT; };\n\t\t3F9863B91D36876B00641C98 /* RLMClassInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMClassInfo.mm; sourceTree = \"<group>\"; };\n\t\t3F9863BA1D36876B00641C98 /* RLMClassInfo.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMClassInfo.hpp; sourceTree = \"<group>\"; };\n\t\t3F997772273E23D300AA9E13 /* RealmCollectionImpl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RealmCollectionImpl.swift; sourceTree = \"<group>\"; };\n\t\t3F9F53D22718B5DA000EEB4A /* CustomPersistable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomPersistable.swift; sourceTree = \"<group>\"; };\n\t\t3F9F53D42718E8E6000EEB4A /* CustomPersistableTestObjects.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomPersistableTestObjects.swift; sourceTree = \"<group>\"; };\n\t\t3FA5E94C266064C4008F1345 /* ModernObjectCreationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModernObjectCreationTests.swift; sourceTree = \"<group>\"; };\n\t\t3FAF2D4029577100002EAC93 /* TestUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestUtils.swift; sourceTree = \"<group>\"; };\n\t\t3FB19068265ECF0C00DA7C76 /* ModernObjectTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModernObjectTests.swift; sourceTree = \"<group>\"; };\n\t\t3FB1906A265ED23300DA7C76 /* ModernTestObjects.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModernTestObjects.swift; sourceTree = \"<group>\"; };\n\t\t3FB6ABD62416A26100E318C2 /* ObjectId.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObjectId.swift; sourceTree = \"<group>\"; };\n\t\t3FB6ABD82416A27000E318C2 /* Decimal128.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Decimal128.swift; sourceTree = \"<group>\"; };\n\t\t3FBEF6781C63D66100F6935B /* RLMCollection_Private.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMCollection_Private.hpp; sourceTree = \"<group>\"; };\n\t\t3FBEF6791C63D66100F6935B /* RLMCollection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMCollection.mm; sourceTree = \"<group>\"; };\n\t\t3FC3F910241808B300E27322 /* RLMEmbeddedObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMEmbeddedObject.h; sourceTree = \"<group>\"; };\n\t\t3FC3F911241808B300E27322 /* RLMEmbeddedObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMEmbeddedObject.mm; sourceTree = \"<group>\"; };\n\t\t3FC3F9162419B63100E27322 /* EmbeddedObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EmbeddedObject.swift; sourceTree = \"<group>\"; };\n\t\t3FCB1A7422A9B0A2003807FB /* CodableTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodableTests.swift; sourceTree = \"<group>\"; };\n\t\t3FCC56E329A55607004C5057 /* RLMSwiftObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMSwiftObject.h; sourceTree = \"<group>\"; };\n\t\t3FD0D7C529675A2E0031C196 /* RLMAsyncTask.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RLMAsyncTask.h; sourceTree = \"<group>\"; };\n\t\t3FD0D7C629675A2E0031C196 /* RLMAsyncTask.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMAsyncTask.mm; sourceTree = \"<group>\"; };\n\t\t3FD0D7CB29675AE10031C196 /* RLMAsyncTask_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMAsyncTask_Private.h; sourceTree = \"<group>\"; };\n\t\t3FD6D1A82B4C9EFB00A4FEBE /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = \"<group>\"; };\n\t\t3FD6D1AB2B4CA56C00A4FEBE /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = \"<group>\"; };\n\t\t3FDAB83E290B4CCB00168F24 /* RLMError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMError.h; sourceTree = \"<group>\"; };\n\t\t3FDAB83F290B4CCB00168F24 /* RLMError_Private.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMError_Private.hpp; sourceTree = \"<group>\"; };\n\t\t3FDAB840290B4CCB00168F24 /* RLMError.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMError.mm; sourceTree = \"<group>\"; };\n\t\t3FDAB847290B658300168F24 /* file-format-version-21.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"file-format-version-21.realm\"; sourceTree = \"<group>\"; };\n\t\t3FDAB84B290B7A0200168F24 /* file-format-version-10.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"file-format-version-10.realm\"; sourceTree = \"<group>\"; };\n\t\t3FE267CF264308670030F83C /* CollectionAccess.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionAccess.swift; sourceTree = \"<group>\"; };\n\t\t3FE267D0264308680030F83C /* ComplexTypes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ComplexTypes.swift; sourceTree = \"<group>\"; };\n\t\t3FE267D1264308680030F83C /* BasicTypes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicTypes.swift; sourceTree = \"<group>\"; };\n\t\t3FE267D2264308680030F83C /* Persistable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Persistable.swift; sourceTree = \"<group>\"; };\n\t\t3FE267D3264308680030F83C /* PropertyAccessors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PropertyAccessors.swift; sourceTree = \"<group>\"; };\n\t\t3FE267D4264308680030F83C /* SchemaDiscovery.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaDiscovery.swift; sourceTree = \"<group>\"; };\n\t\t3FE2BE0223D8CAD1002860E9 /* CombineTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CombineTests.swift; sourceTree = \"<group>\"; };\n\t\t3FE5B4D424CF3F06004D4EF3 /* realm-monorepo.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = \"realm-monorepo.xcframework\"; path = \"core/realm-monorepo.xcframework\"; sourceTree = \"<group>\"; };\n\t\t3FE79FF719BA6A5900780C9A /* RLMSwiftSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMSwiftSupport.h; sourceTree = \"<group>\"; };\n\t\t3FEB383C1E70AC6900F22712 /* ObjectCreationTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ObjectCreationTests.mm; sourceTree = \"<group>\"; };\n\t\t3FEC4A3D1BBB188B00F009C3 /* SwiftSchemaTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftSchemaTests.swift; sourceTree = \"<group>\"; };\n\t\t3FEC91542A4B59A40044BFF5 /* Static.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Static.xcconfig; sourceTree = \"<group>\"; };\n\t\t3FEC91552A4B5D520044BFF5 /* libcompression.tbd */ = {isa = PBXFileReference; lastKnownFileType = \"sourcecode.text-based-dylib-definition\"; name = libcompression.tbd; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS17.0.sdk/usr/lib/libcompression.tbd; sourceTree = DEVELOPER_DIR; };\n\t\t3FEC91572A4B5D600044BFF5 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = \"sourcecode.text-based-dylib-definition\"; name = libz.tbd; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS17.0.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; };\n\t\t3FFC686F2B8EDB69002AE840 /* ObjectCustomPropertiesTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObjectCustomPropertiesTests.swift; sourceTree = \"<group>\"; };\n\t\t530BA61326DFA1CB008FC550 /* RLMChildProcessEnvironment.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = RLMChildProcessEnvironment.m; path = Realm/TestUtils/RLMChildProcessEnvironment.m; sourceTree = \"<group>\"; };\n\t\t53124A4F25B714EC00771CE4 /* SwiftUITestHost.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = SwiftUITestHost.xcconfig; sourceTree = \"<group>\"; };\n\t\t53124AB825B71AF600771CE4 /* SwiftUITestHost.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftUITestHost.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t53124AD425B71AF700771CE4 /* SwiftUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t53124AD825B71AF700771CE4 /* SwiftUITestHostUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUITestHostUITests.swift; sourceTree = \"<group>\"; };\n\t\t53124ADA25B71AF700771CE4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\t533489DD26E0F9510085EEE1 /* RLMChildProcessEnvironment.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RLMChildProcessEnvironment.h; path = Realm/TestUtils/include/RLMChildProcessEnvironment.h; sourceTree = \"<group>\"; };\n\t\t535EA9E125B0919800DBF3CD /* SwiftUI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftUI.swift; sourceTree = \"<group>\"; };\n\t\t535EAA7425B0B02B00DBF3CD /* SwiftUITests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftUITests.swift; sourceTree = \"<group>\"; };\n\t\t53626A8C25D3172000D9515D /* SwiftUITests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = SwiftUITests.xcconfig; sourceTree = \"<group>\"; };\n\t\t53626AAE25D31CAC00D9515D /* Objects.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Objects.swift; sourceTree = \"<group>\"; };\n\t\t53A34E3325CDA0AC00698930 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = \"<group>\"; };\n\t\t53A34E3425CDA0AC00698930 /* SwiftUITestHostApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftUITestHostApp.swift; sourceTree = \"<group>\"; };\n\t\t53A34E3525CDA0AC00698930 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\t5B77EACD1DCC5614006AB51D /* ObjectiveCSupport.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectiveCSupport.swift; sourceTree = \"<group>\"; };\n\t\t5BC537151DD5B8D70055C524 /* ObjectiveCSupportTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectiveCSupportTests.swift; sourceTree = \"<group>\"; };\n\t\t5D03FB1E1E0DAFBA007D53EA /* PredicateUtilTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PredicateUtilTests.mm; sourceTree = \"<group>\"; };\n\t\t5D1534B71CCFF545008976D7 /* LinkingObjects.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LinkingObjects.swift; sourceTree = \"<group>\"; };\n\t\t5D1BF1FE1EF9875300B7DC87 /* RLMCollection_Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RLMCollection_Private.h; sourceTree = \"<group>\"; };\n\t\t5D2E8F651C98DC0D00187B09 /* RLMProperty_Private.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMProperty_Private.hpp; sourceTree = \"<group>\"; };\n\t\t5D3E1A2C1C1FC6D5002913BA /* RLMPredicateUtil.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMPredicateUtil.hpp; sourceTree = \"<group>\"; };\n\t\t5D3E1A2D1C1FC6D5002913BA /* RLMPredicateUtil.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMPredicateUtil.mm; sourceTree = \"<group>\"; };\n\t\t5D432B8C1CC0713F00A610A9 /* LinkingObjectsTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LinkingObjectsTests.mm; sourceTree = \"<group>\"; };\n\t\t5D6156F71BE07B6B00A4BD3F /* TestHost.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = TestHost.xcconfig; sourceTree = \"<group>\"; };\n\t\t5D659E6D1BE0398E006515A0 /* Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = \"<group>\"; };\n\t\t5D659E6E1BE0398E006515A0 /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = \"<group>\"; };\n\t\t5D659E6F1BE0398E006515A0 /* Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = \"<group>\"; };\n\t\t5D659E761BE03E0D006515A0 /* Realm.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Realm.xcconfig; sourceTree = \"<group>\"; };\n\t\t5D659ED91BE04556006515A0 /* Realm.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Realm.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t5D660FBD1BE98BEF0021E04F /* RealmSwift.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = RealmSwift.xcconfig; sourceTree = \"<group>\"; };\n\t\t5D660FC01BE98BEF0021E04F /* Tests.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Tests.xcconfig; sourceTree = \"<group>\"; };\n\t\t5D660FCC1BE98C560021E04F /* RealmSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RealmSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t5D660FD81BE98C7C0021E04F /* RealmSwift Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = \"RealmSwift Tests.xctest\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t5D660FE31BE98D670021E04F /* Aliases.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Aliases.swift; sourceTree = \"<group>\"; };\n\t\t5D660FE41BE98D670021E04F /* List.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = List.swift; sourceTree = \"<group>\"; };\n\t\t5D660FE51BE98D670021E04F /* Migration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Migration.swift; sourceTree = \"<group>\"; };\n\t\t5D660FE61BE98D670021E04F /* Object.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Object.swift; sourceTree = \"<group>\"; };\n\t\t5D660FE71BE98D670021E04F /* ObjectSchema.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectSchema.swift; sourceTree = \"<group>\"; };\n\t\t5D660FE81BE98D670021E04F /* Optional.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Optional.swift; sourceTree = \"<group>\"; };\n\t\t5D660FE91BE98D670021E04F /* Property.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Property.swift; sourceTree = \"<group>\"; };\n\t\t5D660FEA1BE98D670021E04F /* Realm.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Realm.swift; sourceTree = \"<group>\"; };\n\t\t5D660FEC1BE98D670021E04F /* RealmConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmConfiguration.swift; sourceTree = \"<group>\"; };\n\t\t5D660FED1BE98D670021E04F /* Results.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Results.swift; sourceTree = \"<group>\"; };\n\t\t5D660FEE1BE98D670021E04F /* Schema.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Schema.swift; sourceTree = \"<group>\"; };\n\t\t5D660FEF1BE98D670021E04F /* SortDescriptor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SortDescriptor.swift; sourceTree = \"<group>\"; };\n\t\t5D660FF01BE98D670021E04F /* Util.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Util.swift; sourceTree = \"<group>\"; };\n\t\t5D660FFF1BE98D880021E04F /* KVOTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KVOTests.swift; sourceTree = \"<group>\"; };\n\t\t5D6610001BE98D880021E04F /* ListTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListTests.swift; sourceTree = \"<group>\"; };\n\t\t5D6610011BE98D880021E04F /* MigrationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MigrationTests.swift; sourceTree = \"<group>\"; };\n\t\t5D6610021BE98D880021E04F /* ObjectAccessorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectAccessorTests.swift; sourceTree = \"<group>\"; };\n\t\t5D6610031BE98D880021E04F /* ObjectCreationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectCreationTests.swift; sourceTree = \"<group>\"; };\n\t\t5D6610041BE98D880021E04F /* ObjectSchemaInitializationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectSchemaInitializationTests.swift; sourceTree = \"<group>\"; };\n\t\t5D6610051BE98D880021E04F /* ObjectSchemaTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectSchemaTests.swift; sourceTree = \"<group>\"; };\n\t\t5D6610061BE98D880021E04F /* ObjectTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectTests.swift; sourceTree = \"<group>\"; };\n\t\t5D6610071BE98D880021E04F /* PerformanceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PerformanceTests.swift; sourceTree = \"<group>\"; };\n\t\t5D6610081BE98D880021E04F /* PropertyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PropertyTests.swift; sourceTree = \"<group>\"; };\n\t\t5D6610091BE98D880021E04F /* RealmCollectionTypeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmCollectionTypeTests.swift; sourceTree = \"<group>\"; };\n\t\t5D66100A1BE98D880021E04F /* RealmConfigurationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmConfigurationTests.swift; sourceTree = \"<group>\"; };\n\t\t5D66100B1BE98D880021E04F /* RealmSwiftTests-BridgingHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"RealmSwiftTests-BridgingHeader.h\"; sourceTree = \"<group>\"; };\n\t\t5D66100C1BE98D880021E04F /* RealmTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmTests.swift; sourceTree = \"<group>\"; };\n\t\t5D66100D1BE98D880021E04F /* SchemaTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaTests.swift; sourceTree = \"<group>\"; };\n\t\t5D66100E1BE98D880021E04F /* SortDescriptorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SortDescriptorTests.swift; sourceTree = \"<group>\"; };\n\t\t5D66100F1BE98D880021E04F /* SwiftLinkTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftLinkTests.swift; sourceTree = \"<group>\"; };\n\t\t5D6610101BE98D880021E04F /* SwiftTestObjects.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftTestObjects.swift; sourceTree = \"<group>\"; };\n\t\t5D6610111BE98D880021E04F /* SwiftUnicodeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftUnicodeTests.swift; sourceTree = \"<group>\"; };\n\t\t5D6610121BE98D880021E04F /* TestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestCase.swift; sourceTree = \"<group>\"; };\n\t\t5DD755E01BE05C19002800DA /* Tests.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Tests.xcconfig; sourceTree = \"<group>\"; };\n\t\t681EE33A25EE8E1400A9DEC5 /* AnyRealmValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnyRealmValue.swift; sourceTree = \"<group>\"; };\n\t\t681EE34625EE8E5600A9DEC5 /* ObjectiveCSupport+AnyRealmValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"ObjectiveCSupport+AnyRealmValue.swift\"; sourceTree = \"<group>\"; };\n\t\tA05FA61E1B62C3900000C9B2 /* RLMObjectBase_Dynamic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RLMObjectBase_Dynamic.h; sourceTree = \"<group>\"; };\n\t\tAC3B33AB29DC6CEE0042F3A0 /* RLMLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMLogger.h; sourceTree = \"<group>\"; };\n\t\tAC3B33AC29DC6CEE0042F3A0 /* RLMLogger.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMLogger.mm; sourceTree = \"<group>\"; };\n\t\tAC3B33AD29DC6CEE0042F3A0 /* RLMLogger_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMLogger_Private.h; sourceTree = \"<group>\"; };\n\t\tAC5300712BD03D4900BF5950 /* MixedCollectionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MixedCollectionTest.swift; sourceTree = \"<group>\"; };\n\t\tAC7825B82ACD90BE007ABA4B /* Geospatial.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Geospatial.swift; sourceTree = \"<group>\"; };\n\t\tAC7825BA2ACD90DA007ABA4B /* RLMGeospatial.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMGeospatial.mm; sourceTree = \"<group>\"; };\n\t\tAC7825BB2ACD90DA007ABA4B /* RLMGeospatial_Private.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMGeospatial_Private.hpp; sourceTree = \"<group>\"; };\n\t\tAC7825BC2ACD90DA007ABA4B /* RLMGeospatial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMGeospatial.h; sourceTree = \"<group>\"; };\n\t\tAC7825C02ACD916C007ABA4B /* GeospatialTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeospatialTests.swift; sourceTree = \"<group>\"; };\n\t\tACF08B6626DD936200686CBC /* Query.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Query.swift; sourceTree = \"<group>\"; };\n\t\tACFF0EC628EC5ADB0097AEE0 /* CustomColumnNameTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomColumnNameTests.swift; sourceTree = \"<group>\"; };\n\t\tC042A48C1B7522A900771ED2 /* RealmConfigurationTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RealmConfigurationTests.mm; sourceTree = \"<group>\"; };\n\t\tC073E1201AE9B705002C0A30 /* RLMObject_Private.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = RLMObject_Private.hpp; sourceTree = \"<group>\"; };\n\t\tC0D2DD051B6BDEA1004E8919 /* RLMRealmConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMRealmConfiguration.h; sourceTree = \"<group>\"; };\n\t\tC0D2DD061B6BDEA1004E8919 /* RLMRealmConfiguration.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMRealmConfiguration.mm; sourceTree = \"<group>\"; };\n\t\tC0D2DD0F1B6BE0DD004E8919 /* RLMRealmConfiguration_Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RLMRealmConfiguration_Private.h; sourceTree = \"<group>\"; };\n\t\tCF040493263DF0A900F9AEE0 /* PrimitiveMapTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrimitiveMapTests.swift; sourceTree = \"<group>\"; };\n\t\tCF052EFA25DEB671008EEF86 /* DictionaryPropertyTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DictionaryPropertyTests.m; sourceTree = \"<group>\"; };\n\t\tCF0D04F02693652E0038A058 /* KeyPathTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyPathTests.swift; sourceTree = \"<group>\"; };\n\t\tCF25080D283B90F8007D66FE /* SectionedResultsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SectionedResultsTests.m; sourceTree = \"<group>\"; };\n\t\tCF44460526121B2A00BAFDB4 /* RLMSwiftValueStorage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMSwiftValueStorage.mm; sourceTree = \"<group>\"; };\n\t\tCF44460626121B2A00BAFDB4 /* RLMSwiftValueStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMSwiftValueStorage.h; sourceTree = \"<group>\"; };\n\t\tCF44461D26121C6800BAFDB4 /* RealmProperty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmProperty.swift; sourceTree = \"<group>\"; };\n\t\tCF46CBFF26D931BA00DE450C /* QueryTests.swift.gyb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = QueryTests.swift.gyb; sourceTree = \"<group>\"; };\n\t\tCF46CC0026D931BA00DE450C /* QueryTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QueryTests.swift; sourceTree = \"<group>\"; };\n\t\tCF84D4EF281823B300005E27 /* SectionedResults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SectionedResults.swift; sourceTree = \"<group>\"; };\n\t\tCF986D1A25AE3B080039D287 /* RLMSet_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMSet_Private.h; sourceTree = \"<group>\"; };\n\t\tCF986D1B25AE3B080039D287 /* RLMSet.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMSet.mm; sourceTree = \"<group>\"; };\n\t\tCF986D1C25AE3B090039D287 /* RLMSet_Private.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMSet_Private.hpp; sourceTree = \"<group>\"; };\n\t\tCF986D1D25AE3B090039D287 /* RLMSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMSet.h; sourceTree = \"<group>\"; };\n\t\tCF986D2F25AE3BD40039D287 /* PrimitiveSetPropertyTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PrimitiveSetPropertyTests.m; sourceTree = \"<group>\"; };\n\t\tCF986D3025AE3BD40039D287 /* SetPropertyTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SetPropertyTests.m; sourceTree = \"<group>\"; };\n\t\tCF986D4725AE3C420039D287 /* SwiftSetPropertyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftSetPropertyTests.swift; sourceTree = \"<group>\"; };\n\t\tCF986D4825AE3C420039D287 /* SwiftSetTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftSetTests.swift; sourceTree = \"<group>\"; };\n\t\tCF986D8E25AE3C980039D287 /* MutableSet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutableSet.swift; sourceTree = \"<group>\"; };\n\t\tCF986DE125AE3EC70039D287 /* MutableSetTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutableSetTests.swift; sourceTree = \"<group>\"; };\n\t\tCF986DF525AE3EDF0039D287 /* PrimitiveMutableSetTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrimitiveMutableSetTests.swift; sourceTree = \"<group>\"; };\n\t\tCF9881C025DABC6500BD7E4F /* RLMManagedDictionary.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMManagedDictionary.mm; sourceTree = \"<group>\"; };\n\t\tCF9881CB25DABDE900BD7E4F /* RLMDictionary_Private.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = RLMDictionary_Private.hpp; sourceTree = \"<group>\"; };\n\t\tCFAE926A24A0A7F40033CB31 /* AuthenticationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AuthenticationServices.framework; path = System/Library/Frameworks/AuthenticationServices.framework; sourceTree = SDKROOT; };\n\t\tCFD8D11F25BB0B8B0037FE4D /* RLMManagedSet.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMManagedSet.mm; sourceTree = \"<group>\"; };\n\t\tCFDBC4B228803C7200EE80E6 /* RLMSectionedResults_Private.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMSectionedResults_Private.hpp; sourceTree = \"<group>\"; };\n\t\tCFDBC4B328803C7200EE80E6 /* RLMSectionedResults.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMSectionedResults.mm; sourceTree = \"<group>\"; };\n\t\tCFDBC4B428803C7200EE80E6 /* RLMSectionedResults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMSectionedResults.h; sourceTree = \"<group>\"; };\n\t\tCFDBC4BB28803DD400EE80E6 /* SectionedResultsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SectionedResultsTests.m; sourceTree = \"<group>\"; };\n\t\tCFDBC4BE288040CD00EE80E6 /* SectionedResultsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SectionedResultsTests.swift; sourceTree = \"<group>\"; };\n\t\tCFE9CE3226555BBD00BF96D6 /* RealmKeyedCollection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmKeyedCollection.swift; sourceTree = \"<group>\"; };\n\t\tCFFC8CC7262310C800929608 /* AnyRealmValueTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnyRealmValueTests.swift; sourceTree = \"<group>\"; };\n\t\tCFFECBA8250646750010F585 /* Decimal128Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Decimal128Tests.swift; sourceTree = \"<group>\"; };\n\t\tCFFECBAB250667A90010F585 /* Decimal128Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Decimal128Tests.m; sourceTree = \"<group>\"; };\n\t\tCFFECBAF250690EA0010F585 /* ObjectIdTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ObjectIdTests.m; sourceTree = \"<group>\"; };\n\t\tCFFECBB225078D100010F585 /* ObjectIdTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObjectIdTests.swift; sourceTree = \"<group>\"; };\n\t\tE81A1F621955FC9300FDED82 /* Realm-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = \"Realm-Info.plist\"; sourceTree = \"<group>\"; };\n\t\tE81A1F631955FC9300FDED82 /* RLMAccessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMAccessor.h; sourceTree = \"<group>\"; };\n\t\tE81A1F641955FC9300FDED82 /* RLMAccessor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMAccessor.mm; sourceTree = \"<group>\"; };\n\t\tE81A1F651955FC9300FDED82 /* RLMArray_Private.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMArray_Private.hpp; sourceTree = \"<group>\"; };\n\t\tE81A1F661955FC9300FDED82 /* RLMArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMArray.h; sourceTree = \"<group>\"; };\n\t\tE81A1F671955FC9300FDED82 /* RLMArray.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMArray.mm; sourceTree = \"<group>\"; };\n\t\tE81A1F691955FC9300FDED82 /* RLMManagedArray.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = RLMManagedArray.mm; sourceTree = \"<group>\"; };\n\t\tE81A1F6A1955FC9300FDED82 /* RLMResults.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = RLMResults.mm; sourceTree = \"<group>\"; };\n\t\tE81A1F6B1955FC9300FDED82 /* RLMConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMConstants.h; sourceTree = \"<group>\"; };\n\t\tE81A1F6C1955FC9300FDED82 /* RLMConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RLMConstants.m; sourceTree = \"<group>\"; };\n\t\tE81A1F6D1955FC9300FDED82 /* RLMObject_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMObject_Private.h; sourceTree = \"<group>\"; };\n\t\tE81A1F6E1955FC9300FDED82 /* RLMObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMObject.h; sourceTree = \"<group>\"; };\n\t\tE81A1F6F1955FC9300FDED82 /* RLMObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMObject.mm; sourceTree = \"<group>\"; };\n\t\tE81A1F701955FC9300FDED82 /* RLMObjectSchema_Private.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMObjectSchema_Private.hpp; sourceTree = \"<group>\"; };\n\t\tE81A1F711955FC9300FDED82 /* RLMObjectSchema.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMObjectSchema.h; sourceTree = \"<group>\"; };\n\t\tE81A1F721955FC9300FDED82 /* RLMObjectSchema.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMObjectSchema.mm; sourceTree = \"<group>\"; };\n\t\tE81A1F741955FC9300FDED82 /* RLMObjectStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = RLMObjectStore.mm; sourceTree = \"<group>\"; };\n\t\tE81A1F751955FC9300FDED82 /* RLMProperty_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMProperty_Private.h; sourceTree = \"<group>\"; };\n\t\tE81A1F761955FC9300FDED82 /* RLMProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMProperty.h; sourceTree = \"<group>\"; };\n\t\tE81A1F771955FC9300FDED82 /* RLMProperty.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMProperty.mm; sourceTree = \"<group>\"; };\n\t\tE81A1F781955FC9300FDED82 /* RLMQueryUtil.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMQueryUtil.hpp; sourceTree = \"<group>\"; };\n\t\tE81A1F791955FC9300FDED82 /* RLMQueryUtil.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMQueryUtil.mm; sourceTree = \"<group>\"; };\n\t\tE81A1F7B1955FC9300FDED82 /* RLMRealm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMRealm.h; sourceTree = \"<group>\"; };\n\t\tE81A1F7C1955FC9300FDED82 /* RLMRealm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMRealm.mm; sourceTree = \"<group>\"; };\n\t\tE81A1F7D1955FC9300FDED82 /* RLMSchema_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMSchema_Private.h; sourceTree = \"<group>\"; };\n\t\tE81A1F7E1955FC9300FDED82 /* RLMSchema.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMSchema.h; sourceTree = \"<group>\"; };\n\t\tE81A1F7F1955FC9300FDED82 /* RLMSchema.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMSchema.mm; sourceTree = \"<group>\"; };\n\t\tE81A1F811955FC9300FDED82 /* RLMUtil.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMUtil.hpp; sourceTree = \"<group>\"; };\n\t\tE81A1F821955FC9300FDED82 /* RLMUtil.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMUtil.mm; sourceTree = \"<group>\"; };\n\t\tE81A1FB31955FCE000FDED82 /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; lineEnding = 0; path = CHANGELOG.md; sourceTree = \"<group>\"; };\n\t\tE81A1FB41955FCE000FDED82 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = \"<group>\"; };\n\t\tE81A1FB81955FE0100FDED82 /* ArrayPropertyTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ArrayPropertyTests.m; sourceTree = \"<group>\"; };\n\t\tE81A1FBA1955FE0100FDED82 /* DynamicTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DynamicTests.m; sourceTree = \"<group>\"; };\n\t\tE81A1FBB1955FE0100FDED82 /* EnumeratorTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EnumeratorTests.m; sourceTree = \"<group>\"; };\n\t\tE81A1FBC1955FE0100FDED82 /* LinkTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LinkTests.m; sourceTree = \"<group>\"; };\n\t\tE81A1FBE1955FE0100FDED82 /* ObjectInterfaceTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ObjectInterfaceTests.m; sourceTree = \"<group>\"; };\n\t\tE81A1FBF1955FE0100FDED82 /* ObjectTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ObjectTests.m; sourceTree = \"<group>\"; };\n\t\tE81A1FC11955FE0100FDED82 /* QueryTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QueryTests.m; sourceTree = \"<group>\"; };\n\t\tE81A1FC21955FE0100FDED82 /* RealmTests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = \"RealmTests-Info.plist\"; sourceTree = \"<group>\"; };\n\t\tE81A1FC31955FE0100FDED82 /* RealmTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RealmTests.mm; sourceTree = \"<group>\"; };\n\t\tE81A1FD01955FE0100FDED82 /* SwiftRealmTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftRealmTests.swift; sourceTree = \"<group>\"; };\n\t\tE81A1FD11955FE0100FDED82 /* TransactionTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TransactionTests.m; sourceTree = \"<group>\"; };\n\t\tE82FA60A195632F20043A3C3 /* SwiftArrayPropertyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = SwiftArrayPropertyTests.swift; sourceTree = \"<group>\"; };\n\t\tE82FA60B195632F20043A3C3 /* SwiftArrayTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = SwiftArrayTests.swift; sourceTree = \"<group>\"; };\n\t\tE82FA60D195632F20043A3C3 /* SwiftLinkTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = SwiftLinkTests.swift; sourceTree = \"<group>\"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };\n\t\tE82FA60F195632F20043A3C3 /* SwiftObjectInterfaceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = SwiftObjectInterfaceTests.swift; sourceTree = \"<group>\"; };\n\t\tE83AF538196DDE58002275B2 /* SwiftDynamicTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftDynamicTests.swift; sourceTree = \"<group>\"; };\n\t\tE86900E11CC04F5B0008A8B6 /* RLMRealmConfiguration_Private.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RLMRealmConfiguration_Private.hpp; sourceTree = \"<group>\"; };\n\t\tE8839B2C19E31FD90047B1A8 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Realm/Tests/TestHost/Info.plist; sourceTree = SOURCE_ROOT; };\n\t\tE8839B2D19E31FD90047B1A8 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Realm/Tests/TestHost/main.m; sourceTree = SOURCE_ROOT; };\n\t\tE88C36FF19745E5500C9963D /* RLMSupport.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RLMSupport.swift; sourceTree = \"<group>\"; };\n\t\tE8917597197A1B350068ACC6 /* UnicodeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UnicodeTests.m; sourceTree = \"<group>\"; };\n\t\tE891759A197A1B600068ACC6 /* SwiftUnicodeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftUnicodeTests.swift; sourceTree = \"<group>\"; };\n\t\tE8951F01196C96DE00D6461C /* RLMRealm_Dynamic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMRealm_Dynamic.h; sourceTree = \"<group>\"; };\n\t\tE8AE7C251EA436F800CDFF9A /* CompactionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CompactionTests.swift; sourceTree = \"<group>\"; };\n\t\tE8D89B9D1955FC6D00CF2B9A /* Realm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Realm.h; sourceTree = \"<group>\"; };\n\t\tE8D89BA31955FC6D00CF2B9A /* Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE8DA16F71E81210D0055141C /* CompactionTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CompactionTests.m; sourceTree = \"<group>\"; };\n\t\tE8F8D90B196CB8DD00475368 /* SwiftTestObjects.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftTestObjects.swift; sourceTree = \"<group>\"; };\n\t\tE8F992BD1F1401C100F634B5 /* RLMObjectBase_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMObjectBase_Private.h; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t1A7B82351D51235600750296 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3F08725527F3B5E0007A1175 /* libcompression.tbd in Frameworks */,\n\t\t\t\t1A7B823A1D51259F00750296 /* libz.tbd in Frameworks */,\n\t\t\t\t3FE5B4D724CF6909004D4EF3 /* realm-monorepo.xcframework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t3F1A5E6F1992EB7400F45F4C /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t53124AB525B71AF600771CE4 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t53124AD125B71AF700771CE4 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t5D660FC81BE98C560021E04F /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3F98162A2317763000C3543D /* libc++.tbd in Frameworks */,\n\t\t\t\t3F98162B2317763600C3543D /* libz.tbd in Frameworks */,\n\t\t\t\t5D66102A1BE98DD00021E04F /* Realm.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t5D660FD51BE98C7C0021E04F /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FEC91562A4B5D520044BFF5 /* libcompression.tbd in Frameworks */,\n\t\t\t\t3FEC91582A4B5D600044BFF5 /* libz.tbd in Frameworks */,\n\t\t\t\t3FEC915B2A4B65B30044BFF5 /* Realm.framework in Frameworks */,\n\t\t\t\t5D660FDD1BE98C7C0021E04F /* RealmSwift.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8D89BA01955FC6D00CF2B9A /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FEC91592A4B5DE90044BFF5 /* libcompression.tbd in Frameworks */,\n\t\t\t\t3FEC915A2A4B5DEF0044BFF5 /* libz.tbd in Frameworks */,\n\t\t\t\t5D6156EE1BE0689200A4BD3F /* Realm.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t1A7B82361D51254600750296 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tCFAE926A24A0A7F40033CB31 /* AuthenticationServices.framework */,\n\t\t\t\t3F9816292317763000C3543D /* libc++.tbd */,\n\t\t\t\t3FEC91552A4B5D520044BFF5 /* libcompression.tbd */,\n\t\t\t\t3F08725427F3B5E0007A1175 /* libcompression.tbd */,\n\t\t\t\t3FEC91572A4B5D600044BFF5 /* libz.tbd */,\n\t\t\t\t1A7B82391D51259F00750296 /* libz.tbd */,\n\t\t\t\t3FE5B4D424CF3F06004D4EF3 /* realm-monorepo.xcframework */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3F1A5E731992EB7400F45F4C /* TestHost */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE8839B2C19E31FD90047B1A8 /* Info.plist */,\n\t\t\t\tE8839B2D19E31FD90047B1A8 /* main.m */,\n\t\t\t);\n\t\t\tname = TestHost;\n\t\t\tpath = ../../TestHost;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3F48201C26307CE2005B40E8 /* Impl */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FE267D1264308680030F83C /* BasicTypes.swift */,\n\t\t\t\t3FE267CF264308670030F83C /* CollectionAccess.swift */,\n\t\t\t\t3FE267D0264308680030F83C /* ComplexTypes.swift */,\n\t\t\t\t3F857A472769291800F9B9B1 /* KeyPathStrings.swift */,\n\t\t\t\t3F3411A5273433B300EC9D25 /* ObjcBridgeable.swift */,\n\t\t\t\t3FE267D2264308680030F83C /* Persistable.swift */,\n\t\t\t\t3FE267D3264308680030F83C /* PropertyAccessors.swift */,\n\t\t\t\t3F997772273E23D300AA9E13 /* RealmCollectionImpl.swift */,\n\t\t\t\t3FE267D4264308680030F83C /* SchemaDiscovery.swift */,\n\t\t\t);\n\t\t\tpath = Impl;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3F558C7D22C299DB002F0F30 /* Test Utils */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3F558C8422C29A03002F0F30 /* RLMAssertions.h */,\n\t\t\t\t533489DD26E0F9510085EEE1 /* RLMChildProcessEnvironment.h */,\n\t\t\t\t530BA61326DFA1CB008FC550 /* RLMChildProcessEnvironment.m */,\n\t\t\t\t3F558C8022C29A02002F0F30 /* RLMMultiProcessTestCase.h */,\n\t\t\t\t3F558C8522C29A03002F0F30 /* RLMMultiProcessTestCase.m */,\n\t\t\t\t3F558C7F22C29A02002F0F30 /* RLMTestCase.h */,\n\t\t\t\t3F558C8322C29A02002F0F30 /* RLMTestCase.m */,\n\t\t\t\t3F558C8122C29A02002F0F30 /* RLMTestObjects.h */,\n\t\t\t\t3F558C8222C29A02002F0F30 /* RLMTestObjects.m */,\n\t\t\t\t3F558C8622C29A03002F0F30 /* TestUtils.h */,\n\t\t\t\t3F558C7E22C29A02002F0F30 /* TestUtils.mm */,\n\t\t\t);\n\t\t\tname = \"Test Utils\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t53124AD725B71AF700771CE4 /* SwiftUITestHostUITests */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t53124ADA25B71AF700771CE4 /* Info.plist */,\n\t\t\t\t53124AD825B71AF700771CE4 /* SwiftUITestHostUITests.swift */,\n\t\t\t);\n\t\t\tpath = SwiftUITestHostUITests;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t53A34E3225CDA0AC00698930 /* SwiftUITestHost */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t53A34E3525CDA0AC00698930 /* Info.plist */,\n\t\t\t\t53A34E3325CDA0AC00698930 /* LaunchScreen.storyboard */,\n\t\t\t\t53626AAE25D31CAC00D9515D /* Objects.swift */,\n\t\t\t\t53A34E3425CDA0AC00698930 /* SwiftUITestHostApp.swift */,\n\t\t\t);\n\t\t\tpath = SwiftUITestHost;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t5D659E6C1BE03981006515A0 /* Realm */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3F4071342A57472F00D9C4A3 /* PrivateSymbols.txt */,\n\t\t\t\t5D659E761BE03E0D006515A0 /* Realm.xcconfig */,\n\t\t\t\t5DD755E01BE05C19002800DA /* Tests.xcconfig */,\n\t\t\t);\n\t\t\tpath = Realm;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t5D660FB71BE98B770021E04F /* Configuration */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t5D659E6C1BE03981006515A0 /* Realm */,\n\t\t\t\t5D660FBA1BE98BD80021E04F /* RealmSwift */,\n\t\t\t\t5D659E6D1BE0398E006515A0 /* Base.xcconfig */,\n\t\t\t\t5D659E6E1BE0398E006515A0 /* Debug.xcconfig */,\n\t\t\t\t5D659E6F1BE0398E006515A0 /* Release.xcconfig */,\n\t\t\t\t3FEC91542A4B59A40044BFF5 /* Static.xcconfig */,\n\t\t\t\t53124A4F25B714EC00771CE4 /* SwiftUITestHost.xcconfig */,\n\t\t\t\t53626A8C25D3172000D9515D /* SwiftUITests.xcconfig */,\n\t\t\t\t3F852BE9278E1F000009DF74 /* TestBase.xcconfig */,\n\t\t\t\t5D6156F71BE07B6B00A4BD3F /* TestHost.xcconfig */,\n\t\t\t);\n\t\t\tpath = Configuration;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t5D660FBA1BE98BD80021E04F /* RealmSwift */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t5D660FBD1BE98BEF0021E04F /* RealmSwift.xcconfig */,\n\t\t\t\t5D660FC01BE98BEF0021E04F /* Tests.xcconfig */,\n\t\t\t);\n\t\t\tpath = RealmSwift;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t5D660FCD1BE98C560021E04F /* RealmSwift */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3F48201C26307CE2005B40E8 /* Impl */,\n\t\t\t\t5D660FE31BE98D670021E04F /* Aliases.swift */,\n\t\t\t\t681EE33A25EE8E1400A9DEC5 /* AnyRealmValue.swift */,\n\t\t\t\t3F102CBC23DBC68300108FD2 /* Combine.swift */,\n\t\t\t\t3F9F53D22718B5DA000EEB4A /* CustomPersistable.swift */,\n\t\t\t\t3FB6ABD82416A27000E318C2 /* Decimal128.swift */,\n\t\t\t\t3FC3F9162419B63100E27322 /* EmbeddedObject.swift */,\n\t\t\t\t29B7FDF51C0DA6560023224E /* Error.swift */,\n\t\t\t\tAC7825B82ACD90BE007ABA4B /* Geospatial.swift */,\n\t\t\t\t5D1534B71CCFF545008976D7 /* LinkingObjects.swift */,\n\t\t\t\t5D660FE41BE98D670021E04F /* List.swift */,\n\t\t\t\t0C3BD4D225C1C5AB007CFDD3 /* Map.swift */,\n\t\t\t\t5D660FE51BE98D670021E04F /* Migration.swift */,\n\t\t\t\tCF986D8E25AE3C980039D287 /* MutableSet.swift */,\n\t\t\t\t5D660FE61BE98D670021E04F /* Object.swift */,\n\t\t\t\t3FB6ABD62416A26100E318C2 /* ObjectId.swift */,\n\t\t\t\t681EE34625EE8E5600A9DEC5 /* ObjectiveCSupport+AnyRealmValue.swift */,\n\t\t\t\t5B77EACD1DCC5614006AB51D /* ObjectiveCSupport.swift */,\n\t\t\t\t5D660FE71BE98D670021E04F /* ObjectSchema.swift */,\n\t\t\t\t5D660FE81BE98D670021E04F /* Optional.swift */,\n\t\t\t\t3F149CCA2668112A00111D65 /* PersistedProperty.swift */,\n\t\t\t\t3FD6D1AB2B4CA56C00A4FEBE /* PrivacyInfo.xcprivacy */,\n\t\t\t\t0CD1632526D3DD7B0027C49B /* Projection.swift */,\n\t\t\t\t5D660FE91BE98D670021E04F /* Property.swift */,\n\t\t\t\tACF08B6626DD936200686CBC /* Query.swift */,\n\t\t\t\t5D660FEA1BE98D670021E04F /* Realm.swift */,\n\t\t\t\t1AB605D21D495927007F53DE /* RealmCollection.swift */,\n\t\t\t\t5D660FEC1BE98D670021E04F /* RealmConfiguration.swift */,\n\t\t\t\tCFE9CE3226555BBD00BF96D6 /* RealmKeyedCollection.swift */,\n\t\t\t\tCF44461D26121C6800BAFDB4 /* RealmProperty.swift */,\n\t\t\t\t5D660FED1BE98D670021E04F /* Results.swift */,\n\t\t\t\t5D660FEE1BE98D670021E04F /* Schema.swift */,\n\t\t\t\tCF84D4EF281823B300005E27 /* SectionedResults.swift */,\n\t\t\t\t5D660FEF1BE98D670021E04F /* SortDescriptor.swift */,\n\t\t\t\t535EA9E125B0919800DBF3CD /* SwiftUI.swift */,\n\t\t\t\t3F222C4D1E26F51300CA0713 /* ThreadSafeReference.swift */,\n\t\t\t\t5D660FF01BE98D670021E04F /* Util.swift */,\n\t\t\t);\n\t\t\tpath = RealmSwift;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t5D660FD91BE98C7C0021E04F /* RealmSwift Tests */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t5D6610291BE98DAA0021E04F /* Supporting Files */,\n\t\t\t\tCFFC8CC7262310C800929608 /* AnyRealmValueTests.swift */,\n\t\t\t\t3FCB1A7422A9B0A2003807FB /* CodableTests.swift */,\n\t\t\t\t3FE2BE0223D8CAD1002860E9 /* CombineTests.swift */,\n\t\t\t\tE8AE7C251EA436F800CDFF9A /* CompactionTests.swift */,\n\t\t\t\tACFF0EC628EC5ADB0097AEE0 /* CustomColumnNameTests.swift */,\n\t\t\t\t3F40C612276D1B05007FEF1A /* CustomObjectCreationTests.swift */,\n\t\t\t\t3F9F53D42718E8E6000EEB4A /* CustomPersistableTestObjects.swift */,\n\t\t\t\tCFFECBA8250646750010F585 /* Decimal128Tests.swift */,\n\t\t\t\tAC7825C02ACD916C007ABA4B /* GeospatialTests.swift */,\n\t\t\t\tCF0D04F02693652E0038A058 /* KeyPathTests.swift */,\n\t\t\t\t5D660FFF1BE98D880021E04F /* KVOTests.swift */,\n\t\t\t\t5D6610001BE98D880021E04F /* ListTests.swift */,\n\t\t\t\t3F1D8D75265B075000593ABA /* MapTests.swift */,\n\t\t\t\t5D6610011BE98D880021E04F /* MigrationTests.swift */,\n\t\t\t\tAC5300712BD03D4900BF5950 /* MixedCollectionTest.swift */,\n\t\t\t\t3F4E0FF82654765C008B8C0B /* ModernKVOTests.swift */,\n\t\t\t\t3F4E100E2655CA33008B8C0B /* ModernObjectAccessorTests.swift */,\n\t\t\t\t3FA5E94C266064C4008F1345 /* ModernObjectCreationTests.swift */,\n\t\t\t\t3FB19068265ECF0C00DA7C76 /* ModernObjectTests.swift */,\n\t\t\t\t3FB1906A265ED23300DA7C76 /* ModernTestObjects.swift */,\n\t\t\t\tCF986DE125AE3EC70039D287 /* MutableSetTests.swift */,\n\t\t\t\t5D6610021BE98D880021E04F /* ObjectAccessorTests.swift */,\n\t\t\t\t5D6610031BE98D880021E04F /* ObjectCreationTests.swift */,\n\t\t\t\t3FFC686F2B8EDB69002AE840 /* ObjectCustomPropertiesTests.swift */,\n\t\t\t\tCFFECBB225078D100010F585 /* ObjectIdTests.swift */,\n\t\t\t\t5BC537151DD5B8D70055C524 /* ObjectiveCSupportTests.swift */,\n\t\t\t\t5D6610041BE98D880021E04F /* ObjectSchemaInitializationTests.swift */,\n\t\t\t\t5D6610051BE98D880021E04F /* ObjectSchemaTests.swift */,\n\t\t\t\t5D6610061BE98D880021E04F /* ObjectTests.swift */,\n\t\t\t\t5D6610071BE98D880021E04F /* PerformanceTests.swift */,\n\t\t\t\t3F2633C21E9D630000B32D30 /* PrimitiveListTests.swift */,\n\t\t\t\tCF040493263DF0A900F9AEE0 /* PrimitiveMapTests.swift */,\n\t\t\t\tCF986DF525AE3EDF0039D287 /* PrimitiveMutableSetTests.swift */,\n\t\t\t\t0CBF2DB827286FFD00635902 /* ProjectedCollectTests.swift */,\n\t\t\t\t0CD1632726D3DF1C0027C49B /* ProjectionTests.swift */,\n\t\t\t\t5D6610081BE98D880021E04F /* PropertyTests.swift */,\n\t\t\t\tCF46CC0026D931BA00DE450C /* QueryTests.swift */,\n\t\t\t\tCF46CBFF26D931BA00DE450C /* QueryTests.swift.gyb */,\n\t\t\t\t5D6610091BE98D880021E04F /* RealmCollectionTypeTests.swift */,\n\t\t\t\t5D66100A1BE98D880021E04F /* RealmConfigurationTests.swift */,\n\t\t\t\t3F4E100F2655CA33008B8C0B /* RealmPropertyTests.swift */,\n\t\t\t\t5D66100C1BE98D880021E04F /* RealmTests.swift */,\n\t\t\t\t5D66100D1BE98D880021E04F /* SchemaTests.swift */,\n\t\t\t\tCFDBC4BE288040CD00EE80E6 /* SectionedResultsTests.swift */,\n\t\t\t\t5D66100E1BE98D880021E04F /* SortDescriptorTests.swift */,\n\t\t\t\t5D66100F1BE98D880021E04F /* SwiftLinkTests.swift */,\n\t\t\t\t5D6610101BE98D880021E04F /* SwiftTestObjects.swift */,\n\t\t\t\t535EAA7425B0B02B00DBF3CD /* SwiftUITests.swift */,\n\t\t\t\t5D6610111BE98D880021E04F /* SwiftUnicodeTests.swift */,\n\t\t\t\t5D6610121BE98D880021E04F /* TestCase.swift */,\n\t\t\t\t3FAF2D4029577100002EAC93 /* TestUtils.swift */,\n\t\t\t\t3F90C1B12716169C0029000E /* TestValueFactory.swift */,\n\t\t\t\t3F73BC841E3A870F00FE80B6 /* ThreadSafeReferenceTests.swift */,\n\t\t\t);\n\t\t\tname = \"RealmSwift Tests\";\n\t\t\tpath = RealmSwift/Tests;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t5D6610291BE98DAA0021E04F /* Supporting Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t5D66100B1BE98D880021E04F /* RealmSwiftTests-BridgingHeader.h */,\n\t\t\t);\n\t\t\tname = \"Supporting Files\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE81A1FC81955FE0100FDED82 /* Swift */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t297FBEFA1C19F696009D1118 /* RLMTestCaseUtils.swift */,\n\t\t\t\t0217D7B819CD0ACD00DE5C32 /* Swift-Tests-Bridging-Header.h */,\n\t\t\t\tE82FA60A195632F20043A3C3 /* SwiftArrayPropertyTests.swift */,\n\t\t\t\tE82FA60B195632F20043A3C3 /* SwiftArrayTests.swift */,\n\t\t\t\tE83AF538196DDE58002275B2 /* SwiftDynamicTests.swift */,\n\t\t\t\tE82FA60D195632F20043A3C3 /* SwiftLinkTests.swift */,\n\t\t\t\tE82FA60F195632F20043A3C3 /* SwiftObjectInterfaceTests.swift */,\n\t\t\t\t26F3CA681986CC86004623E1 /* SwiftPropertyTypeTest.swift */,\n\t\t\t\tE81A1FD01955FE0100FDED82 /* SwiftRealmTests.swift */,\n\t\t\t\t0C9758BE264974660097B48D /* SwiftRLMDictionaryTests.swift */,\n\t\t\t\t3FEC4A3D1BBB188B00F009C3 /* SwiftSchemaTests.swift */,\n\t\t\t\tCF986D4725AE3C420039D287 /* SwiftSetPropertyTests.swift */,\n\t\t\t\tCF986D4825AE3C420039D287 /* SwiftSetTests.swift */,\n\t\t\t\tE8F8D90B196CB8DD00475368 /* SwiftTestObjects.swift */,\n\t\t\t\tE891759A197A1B600068ACC6 /* SwiftUnicodeTests.swift */,\n\t\t\t);\n\t\t\tpath = Swift;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE81A20061955FE1600FDED82 /* Objective-C */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE81A1FB81955FE0100FDED82 /* ArrayPropertyTests.m */,\n\t\t\t\t3F7556731BE95A050058BC7E /* AsyncTests.mm */,\n\t\t\t\tE8DA16F71E81210D0055141C /* CompactionTests.m */,\n\t\t\t\tCFFECBAB250667A90010F585 /* Decimal128Tests.m */,\n\t\t\t\tCF052EFA25DEB671008EEF86 /* DictionaryPropertyTests.m */,\n\t\t\t\tE81A1FBA1955FE0100FDED82 /* DynamicTests.m */,\n\t\t\t\t021A882F1AAFB5BE00EEAC84 /* EncryptionTests.mm */,\n\t\t\t\tE81A1FBB1955FE0100FDED82 /* EnumeratorTests.m */,\n\t\t\t\t027A4D291AB1012500AA46F9 /* InterprocessTests.m */,\n\t\t\t\t3F0F029D1B6FFE610046A4D5 /* KVOTests.mm */,\n\t\t\t\t5D432B8C1CC0713F00A610A9 /* LinkingObjectsTests.mm */,\n\t\t\t\tE81A1FBC1955FE0100FDED82 /* LinkTests.m */,\n\t\t\t\t0207AB85195DFA15007EFB12 /* MigrationTests.mm */,\n\t\t\t\t3F2E66611CA0B9D5004761D5 /* NotificationTests.m */,\n\t\t\t\t3FEB383C1E70AC6900F22712 /* ObjectCreationTests.mm */,\n\t\t\t\tCFFECBAF250690EA0010F585 /* ObjectIdTests.m */,\n\t\t\t\tE81A1FBE1955FE0100FDED82 /* ObjectInterfaceTests.m */,\n\t\t\t\t021A88301AAFB5BE00EEAC84 /* ObjectSchemaTests.m */,\n\t\t\t\tE81A1FBF1955FE0100FDED82 /* ObjectTests.m */,\n\t\t\t\t3F04EA2D1992BEE400C2CE2E /* PerformanceTests.m */,\n\t\t\t\t5D03FB1E1E0DAFBA007D53EA /* PredicateUtilTests.mm */,\n\t\t\t\t3F572C901F2BDA9F00F6C9AB /* PrimitiveArrayPropertyTests.m */,\n\t\t\t\t3F1D8D92265B076C00593ABA /* PrimitiveArrayPropertyTests.tpl.m */,\n\t\t\t\t0C86B33825E15B6000775FED /* PrimitiveDictionaryPropertyTests.m */,\n\t\t\t\t3F1D8D8F265B076C00593ABA /* PrimitiveDictionaryPropertyTests.tpl.m */,\n\t\t\t\t3F1D8D8E265B076C00593ABA /* PrimitiveRLMValuePropertyTests.m */,\n\t\t\t\t3F1D8D91265B076C00593ABA /* PrimitiveRLMValuePropertyTests.tpl.m */,\n\t\t\t\tCF986D2F25AE3BD40039D287 /* PrimitiveSetPropertyTests.m */,\n\t\t\t\t3F1D8D90265B076C00593ABA /* PrimitiveSetPropertyTests.tpl.m */,\n\t\t\t\t02AFB4611A80343600E11938 /* PropertyTests.m */,\n\t\t\t\tE81A1FC11955FE0100FDED82 /* QueryTests.m */,\n\t\t\t\tC042A48C1B7522A900771ED2 /* RealmConfigurationTests.mm */,\n\t\t\t\tE81A1FC31955FE0100FDED82 /* RealmTests.mm */,\n\t\t\t\t02AFB4621A80343600E11938 /* ResultsTests.m */,\n\t\t\t\t3F1D8D8D265B076C00593ABA /* RLMValueTests.m */,\n\t\t\t\t0207AB86195DFA15007EFB12 /* SchemaTests.mm */,\n\t\t\t\tCFDBC4BB28803DD400EE80E6 /* SectionedResultsTests.m */,\n\t\t\t\tCF25080D283B90F8007D66FE /* SectionedResultsTests.m */,\n\t\t\t\tCF986D3025AE3BD40039D287 /* SetPropertyTests.m */,\n\t\t\t\t3F572C911F2BDA9F00F6C9AB /* ThreadSafeReferenceTests.m */,\n\t\t\t\tE81A1FD11955FE0100FDED82 /* TransactionTests.m */,\n\t\t\t\tE8917597197A1B350068ACC6 /* UnicodeTests.m */,\n\t\t\t\t021A88311AAFB5BE00EEAC84 /* UtilTests.mm */,\n\t\t\t);\n\t\t\tname = \"Objective-C\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE88C36FE19745E3200C9963D /* Swift */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE88C36FF19745E5500C9963D /* RLMSupport.swift */,\n\t\t\t);\n\t\t\tpath = Swift;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8D89B8E1955FC6D00CF2B9A = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t5D660FB71BE98B770021E04F /* Configuration */,\n\t\t\t\t1A7B82361D51254600750296 /* Frameworks */,\n\t\t\t\tE81A1FB41955FCE000FDED82 /* LICENSE */,\n\t\t\t\tE8D89B991955FC6D00CF2B9A /* Products */,\n\t\t\t\tE8D89B9A1955FC6D00CF2B9A /* Realm */,\n\t\t\t\tE8D89BA71955FC6D00CF2B9A /* Realm Tests */,\n\t\t\t\t5D660FCD1BE98C560021E04F /* RealmSwift */,\n\t\t\t\t5D660FD91BE98C7C0021E04F /* RealmSwift Tests */,\n\t\t\t\t3F558C7D22C299DB002F0F30 /* Test Utils */,\n\t\t\t\tE81A1FB31955FCE000FDED82 /* CHANGELOG.md */,\n\t\t\t);\n\t\t\tindentWidth = 4;\n\t\t\tsourceTree = \"<group>\";\n\t\t\ttabWidth = 4;\n\t\t};\n\t\tE8D89B991955FC6D00CF2B9A /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t5D659ED91BE04556006515A0 /* Realm.framework */,\n\t\t\t\t5D660FD81BE98C7C0021E04F /* RealmSwift Tests.xctest */,\n\t\t\t\t5D660FCC1BE98C560021E04F /* RealmSwift.framework */,\n\t\t\t\t53124AB825B71AF600771CE4 /* SwiftUITestHost.app */,\n\t\t\t\t53124AD425B71AF700771CE4 /* SwiftUITests.xctest */,\n\t\t\t\t3F1A5E721992EB7400F45F4C /* TestHost.app */,\n\t\t\t\tE8D89BA31955FC6D00CF2B9A /* Tests.xctest */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8D89B9A1955FC6D00CF2B9A /* Realm */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE8D89B9B1955FC6D00CF2B9A /* Supporting Files */,\n\t\t\t\tE88C36FE19745E3200C9963D /* Swift */,\n\t\t\t\tE8D89B9D1955FC6D00CF2B9A /* Realm.h */,\n\t\t\t\tE81A1F631955FC9300FDED82 /* RLMAccessor.h */,\n\t\t\t\t3F0338491E6F466D00F9E288 /* RLMAccessor.hpp */,\n\t\t\t\tE81A1F641955FC9300FDED82 /* RLMAccessor.mm */,\n\t\t\t\tE81A1F661955FC9300FDED82 /* RLMArray.h */,\n\t\t\t\tE81A1F671955FC9300FDED82 /* RLMArray.mm */,\n\t\t\t\t0237B5421A856F06004ACD57 /* RLMArray_Private.h */,\n\t\t\t\tE81A1F651955FC9300FDED82 /* RLMArray_Private.hpp */,\n\t\t\t\t3FD0D7C529675A2E0031C196 /* RLMAsyncTask.h */,\n\t\t\t\t3FD0D7C629675A2E0031C196 /* RLMAsyncTask.mm */,\n\t\t\t\t3FD0D7CB29675AE10031C196 /* RLMAsyncTask_Private.h */,\n\t\t\t\t3F9863BA1D36876B00641C98 /* RLMClassInfo.hpp */,\n\t\t\t\t3F9863B91D36876B00641C98 /* RLMClassInfo.mm */,\n\t\t\t\t02B8EF5B19E7048D0045A93D /* RLMCollection.h */,\n\t\t\t\t3FBEF6791C63D66100F6935B /* RLMCollection.mm */,\n\t\t\t\t5D1BF1FE1EF9875300B7DC87 /* RLMCollection_Private.h */,\n\t\t\t\t3FBEF6781C63D66100F6935B /* RLMCollection_Private.hpp */,\n\t\t\t\tE81A1F6B1955FC9300FDED82 /* RLMConstants.h */,\n\t\t\t\tE81A1F6C1955FC9300FDED82 /* RLMConstants.m */,\n\t\t\t\t3F4F3AD323F71C790048DB43 /* RLMDecimal128.h */,\n\t\t\t\t3F4F3ACF23F71C790048DB43 /* RLMDecimal128.mm */,\n\t\t\t\t3F4F3AD123F71C790048DB43 /* RLMDecimal128_Private.hpp */,\n\t\t\t\t0C3BD4B225C1BDF1007CFDD3 /* RLMDictionary.h */,\n\t\t\t\t0C3BD4B125C1BDF1007CFDD3 /* RLMDictionary.mm */,\n\t\t\t\t0C3BD50125C1DE6F007CFDD3 /* RLMDictionary_Private.h */,\n\t\t\t\tCF9881CB25DABDE900BD7E4F /* RLMDictionary_Private.hpp */,\n\t\t\t\t3FC3F910241808B300E27322 /* RLMEmbeddedObject.h */,\n\t\t\t\t3FC3F911241808B300E27322 /* RLMEmbeddedObject.mm */,\n\t\t\t\t3FDAB83E290B4CCB00168F24 /* RLMError.h */,\n\t\t\t\t3FDAB840290B4CCB00168F24 /* RLMError.mm */,\n\t\t\t\t3FDAB83F290B4CCB00168F24 /* RLMError_Private.hpp */,\n\t\t\t\tAC7825BC2ACD90DA007ABA4B /* RLMGeospatial.h */,\n\t\t\t\tAC7825BA2ACD90DA007ABA4B /* RLMGeospatial.mm */,\n\t\t\t\tAC7825BB2ACD90DA007ABA4B /* RLMGeospatial_Private.hpp */,\n\t\t\t\tAC3B33AB29DC6CEE0042F3A0 /* RLMLogger.h */,\n\t\t\t\tAC3B33AC29DC6CEE0042F3A0 /* RLMLogger.mm */,\n\t\t\t\tAC3B33AD29DC6CEE0042F3A0 /* RLMLogger_Private.h */,\n\t\t\t\tE81A1F691955FC9300FDED82 /* RLMManagedArray.mm */,\n\t\t\t\tCF9881C025DABC6500BD7E4F /* RLMManagedDictionary.mm */,\n\t\t\t\t0C7CA7C225C311DA0098A636 /* RLMManagedDictionary.mm */,\n\t\t\t\tCFD8D11F25BB0B8B0037FE4D /* RLMManagedSet.mm */,\n\t\t\t\t0207AB7D195DF9FB007EFB12 /* RLMMigration.h */,\n\t\t\t\t0207AB7E195DF9FB007EFB12 /* RLMMigration.mm */,\n\t\t\t\t0207AB7C195DF9FB007EFB12 /* RLMMigration_Private.h */,\n\t\t\t\tE81A1F6E1955FC9300FDED82 /* RLMObject.h */,\n\t\t\t\tE81A1F6F1955FC9300FDED82 /* RLMObject.mm */,\n\t\t\t\tE81A1F6D1955FC9300FDED82 /* RLMObject_Private.h */,\n\t\t\t\tC073E1201AE9B705002C0A30 /* RLMObject_Private.hpp */,\n\t\t\t\t023B19571A3BA90D0067FB81 /* RLMObjectBase.h */,\n\t\t\t\t023B19581A3BA90D0067FB81 /* RLMObjectBase.mm */,\n\t\t\t\tA05FA61E1B62C3900000C9B2 /* RLMObjectBase_Dynamic.h */,\n\t\t\t\tE8F992BD1F1401C100F634B5 /* RLMObjectBase_Private.h */,\n\t\t\t\t3F4F3AD023F71C790048DB43 /* RLMObjectId.h */,\n\t\t\t\t3F4F3AD223F71C790048DB43 /* RLMObjectId.mm */,\n\t\t\t\t3F4F3AD423F71C790048DB43 /* RLMObjectId_Private.hpp */,\n\t\t\t\tE81A1F711955FC9300FDED82 /* RLMObjectSchema.h */,\n\t\t\t\tE81A1F721955FC9300FDED82 /* RLMObjectSchema.mm */,\n\t\t\t\t29EDB8E91A7712E500458D80 /* RLMObjectSchema_Private.h */,\n\t\t\t\tE81A1F701955FC9300FDED82 /* RLMObjectSchema_Private.hpp */,\n\t\t\t\t29EDB8D71A7703C500458D80 /* RLMObjectStore.h */,\n\t\t\t\tE81A1F741955FC9300FDED82 /* RLMObjectStore.mm */,\n\t\t\t\t3F0F02AC1B6FFF3D0046A4D5 /* RLMObservation.hpp */,\n\t\t\t\t3F0F02AD1B6FFF3D0046A4D5 /* RLMObservation.mm */,\n\t\t\t\t5D3E1A2C1C1FC6D5002913BA /* RLMPredicateUtil.hpp */,\n\t\t\t\t5D3E1A2D1C1FC6D5002913BA /* RLMPredicateUtil.mm */,\n\t\t\t\t3F68BFCD1B558CA800D50FBD /* RLMPrefix.h */,\n\t\t\t\tE81A1F761955FC9300FDED82 /* RLMProperty.h */,\n\t\t\t\tE81A1F771955FC9300FDED82 /* RLMProperty.mm */,\n\t\t\t\tE81A1F751955FC9300FDED82 /* RLMProperty_Private.h */,\n\t\t\t\t5D2E8F651C98DC0D00187B09 /* RLMProperty_Private.hpp */,\n\t\t\t\tE81A1F781955FC9300FDED82 /* RLMQueryUtil.hpp */,\n\t\t\t\tE81A1F791955FC9300FDED82 /* RLMQueryUtil.mm */,\n\t\t\t\tE81A1F7B1955FC9300FDED82 /* RLMRealm.h */,\n\t\t\t\tE81A1F7C1955FC9300FDED82 /* RLMRealm.mm */,\n\t\t\t\tE8951F01196C96DE00D6461C /* RLMRealm_Dynamic.h */,\n\t\t\t\t29EDB8E01A77070200458D80 /* RLMRealm_Private.h */,\n\t\t\t\t02E334C41A5F4923009F8810 /* RLMRealm_Private.hpp */,\n\t\t\t\tC0D2DD051B6BDEA1004E8919 /* RLMRealmConfiguration.h */,\n\t\t\t\tC0D2DD061B6BDEA1004E8919 /* RLMRealmConfiguration.mm */,\n\t\t\t\tC0D2DD0F1B6BE0DD004E8919 /* RLMRealmConfiguration_Private.h */,\n\t\t\t\tE86900E11CC04F5B0008A8B6 /* RLMRealmConfiguration_Private.hpp */,\n\t\t\t\t027A4D211AB100E000AA46F9 /* RLMRealmUtil.hpp */,\n\t\t\t\t027A4D221AB100E000AA46F9 /* RLMRealmUtil.mm */,\n\t\t\t\t02B8EF5819E601D80045A93D /* RLMResults.h */,\n\t\t\t\tE81A1F6A1955FC9300FDED82 /* RLMResults.mm */,\n\t\t\t\t29EDB8E51A7710B700458D80 /* RLMResults_Private.h */,\n\t\t\t\t1A1EBF861F269E8E00F47698 /* RLMResults_Private.hpp */,\n\t\t\t\t3F0BBB9529AFDA6600FEA7A7 /* RLMScheduler.h */,\n\t\t\t\t3F0BBB9629AFDA6600FEA7A7 /* RLMScheduler.mm */,\n\t\t\t\tE81A1F7E1955FC9300FDED82 /* RLMSchema.h */,\n\t\t\t\tE81A1F7F1955FC9300FDED82 /* RLMSchema.mm */,\n\t\t\t\tE81A1F7D1955FC9300FDED82 /* RLMSchema_Private.h */,\n\t\t\t\t3F4E324B1B98C6C700183A69 /* RLMSchema_Private.hpp */,\n\t\t\t\tCFDBC4B428803C7200EE80E6 /* RLMSectionedResults.h */,\n\t\t\t\tCFDBC4B328803C7200EE80E6 /* RLMSectionedResults.mm */,\n\t\t\t\tCFDBC4B228803C7200EE80E6 /* RLMSectionedResults_Private.hpp */,\n\t\t\t\tCF986D1D25AE3B090039D287 /* RLMSet.h */,\n\t\t\t\tCF986D1B25AE3B080039D287 /* RLMSet.mm */,\n\t\t\t\tCF986D1A25AE3B080039D287 /* RLMSet_Private.h */,\n\t\t\t\tCF986D1C25AE3B090039D287 /* RLMSet_Private.hpp */,\n\t\t\t\t023B19551A3BA90D0067FB81 /* RLMSwiftCollectionBase.h */,\n\t\t\t\t023B19561A3BA90D0067FB81 /* RLMSwiftCollectionBase.mm */,\n\t\t\t\t3FCC56E329A55607004C5057 /* RLMSwiftObject.h */,\n\t\t\t\t3F83E9A22630A14800FC9623 /* RLMSwiftProperty.h */,\n\t\t\t\t3FE79FF719BA6A5900780C9A /* RLMSwiftSupport.h */,\n\t\t\t\t3F452EC519C2279800AFC154 /* RLMSwiftSupport.m */,\n\t\t\t\tCF44460626121B2A00BAFDB4 /* RLMSwiftValueStorage.h */,\n\t\t\t\tCF44460526121B2A00BAFDB4 /* RLMSwiftValueStorage.mm */,\n\t\t\t\t3F67DB391E26D69C0024533D /* RLMThreadSafeReference.h */,\n\t\t\t\t3F67DB3B1E26D69C0024533D /* RLMThreadSafeReference.mm */,\n\t\t\t\t3F67DB3A1E26D69C0024533D /* RLMThreadSafeReference_Private.hpp */,\n\t\t\t\tE81A1F811955FC9300FDED82 /* RLMUtil.hpp */,\n\t\t\t\tE81A1F821955FC9300FDED82 /* RLMUtil.mm */,\n\t\t\t\t0C57969F25643D7500744CAE /* RLMUUID.mm */,\n\t\t\t\t3F1D8D32265B071000593ABA /* RLMUUID_Private.hpp */,\n\t\t\t\t3F1D8D30265B071000593ABA /* RLMValue.h */,\n\t\t\t\t3F1D8D31265B071000593ABA /* RLMValue.mm */,\n\t\t\t);\n\t\t\tpath = Realm;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8D89B9B1955FC6D00CF2B9A /* Supporting Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t023B19F71A423BD20067FB81 /* libc++.dylib */,\n\t\t\t\t3FD6D1A82B4C9EFB00A4FEBE /* PrivacyInfo.xcprivacy */,\n\t\t\t\tE81A1F621955FC9300FDED82 /* Realm-Info.plist */,\n\t\t\t\t02E334C21A5F3C45009F8810 /* Realm.modulemap */,\n\t\t\t);\n\t\t\tname = \"Supporting Files\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8D89BA71955FC6D00CF2B9A /* Realm Tests */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE81A20061955FE1600FDED82 /* Objective-C */,\n\t\t\t\tE8D89BA81955FC6D00CF2B9A /* Supporting Files */,\n\t\t\t\tE81A1FC81955FE0100FDED82 /* Swift */,\n\t\t\t\t53A34E3225CDA0AC00698930 /* SwiftUITestHost */,\n\t\t\t\t53124AD725B71AF700771CE4 /* SwiftUITestHostUITests */,\n\t\t\t\t3F1A5E731992EB7400F45F4C /* TestHost */,\n\t\t\t);\n\t\t\tname = \"Realm Tests\";\n\t\t\tpath = Realm/Tests;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8D89BA81955FC6D00CF2B9A /* Supporting Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FDAB84B290B7A0200168F24 /* file-format-version-10.realm */,\n\t\t\t\t3FDAB847290B658300168F24 /* file-format-version-21.realm */,\n\t\t\t\t29B7FDF71C0DE76B0023224E /* fileformat-pre-null.realm */,\n\t\t\t\tE81A1FC21955FE0100FDED82 /* RealmTests-Info.plist */,\n\t\t\t);\n\t\t\tname = \"Supporting Files\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t5D659E9F1BE04556006515A0 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t5D659EA51BE04556006515A0 /* Realm.h in Headers */,\n\t\t\t\t5D659EA71BE04556006515A0 /* RLMAccessor.h in Headers */,\n\t\t\t\t5D659EA91BE04556006515A0 /* RLMArray.h in Headers */,\n\t\t\t\t5D659EAA1BE04556006515A0 /* RLMArray_Private.h in Headers */,\n\t\t\t\t3FD0D7C729675A2E0031C196 /* RLMAsyncTask.h in Headers */,\n\t\t\t\t3FDB67152970720E0052233B /* RLMAsyncTask_Private.h in Headers */,\n\t\t\t\t5D659EAB1BE04556006515A0 /* RLMCollection.h in Headers */,\n\t\t\t\t5D1BF1FF1EF987AD00B7DC87 /* RLMCollection_Private.h in Headers */,\n\t\t\t\t5D659EAC1BE04556006515A0 /* RLMConstants.h in Headers */,\n\t\t\t\t3F4F3ADD23F71C790048DB43 /* RLMDecimal128.h in Headers */,\n\t\t\t\t3F1D9068265C077C00593ABA /* RLMDictionary.h in Headers */,\n\t\t\t\t0CED6DB82655087200B80277 /* RLMDictionary_Private.h in Headers */,\n\t\t\t\t3FC3F912241808B400E27322 /* RLMEmbeddedObject.h in Headers */,\n\t\t\t\t3FDAB841290B4CCB00168F24 /* RLMError.h in Headers */,\n\t\t\t\tAC7825BF2ACD90DA007ABA4B /* RLMGeospatial.h in Headers */,\n\t\t\t\tAC3B33AE29DC6CEE0042F3A0 /* RLMLogger.h in Headers */,\n\t\t\t\tAC3B33B029DC6CEE0042F3A0 /* RLMLogger_Private.h in Headers */,\n\t\t\t\t5D659EAF1BE04556006515A0 /* RLMMigration.h in Headers */,\n\t\t\t\t5D659EB01BE04556006515A0 /* RLMMigration_Private.h in Headers */,\n\t\t\t\t5D659EB11BE04556006515A0 /* RLMObject.h in Headers */,\n\t\t\t\t5D659EB21BE04556006515A0 /* RLMObject_Private.h in Headers */,\n\t\t\t\t5D659EB31BE04556006515A0 /* RLMObjectBase.h in Headers */,\n\t\t\t\t5D659EB41BE04556006515A0 /* RLMObjectBase_Dynamic.h in Headers */,\n\t\t\t\tE8F992BE1F1401C100F634B5 /* RLMObjectBase_Private.h in Headers */,\n\t\t\t\t3F4F3AD723F71C790048DB43 /* RLMObjectId.h in Headers */,\n\t\t\t\t5D659EB51BE04556006515A0 /* RLMObjectSchema.h in Headers */,\n\t\t\t\t5D659EB61BE04556006515A0 /* RLMObjectSchema_Private.h in Headers */,\n\t\t\t\t5D659EB81BE04556006515A0 /* RLMObjectStore.h in Headers */,\n\t\t\t\t5D659EBC1BE04556006515A0 /* RLMProperty.h in Headers */,\n\t\t\t\t5D659EBD1BE04556006515A0 /* RLMProperty_Private.h in Headers */,\n\t\t\t\t5D659EBF1BE04556006515A0 /* RLMRealm.h in Headers */,\n\t\t\t\t5D659EC01BE04556006515A0 /* RLMRealm_Dynamic.h in Headers */,\n\t\t\t\t5D659EC11BE04556006515A0 /* RLMRealm_Private.h in Headers */,\n\t\t\t\t5D659EC21BE04556006515A0 /* RLMRealmConfiguration.h in Headers */,\n\t\t\t\t5D659EC31BE04556006515A0 /* RLMRealmConfiguration_Private.h in Headers */,\n\t\t\t\t5D659EC51BE04556006515A0 /* RLMResults.h in Headers */,\n\t\t\t\t5D659EC61BE04556006515A0 /* RLMResults_Private.h in Headers */,\n\t\t\t\t3F0BBB9729AFDA6600FEA7A7 /* RLMScheduler.h in Headers */,\n\t\t\t\t5D659EC71BE04556006515A0 /* RLMSchema.h in Headers */,\n\t\t\t\t5D659EC81BE04556006515A0 /* RLMSchema_Private.h in Headers */,\n\t\t\t\tCFDBC4B728803C7200EE80E6 /* RLMSectionedResults.h in Headers */,\n\t\t\t\tCF986D2425AE3B090039D287 /* RLMSet.h in Headers */,\n\t\t\t\tCF986D1E25AE3B090039D287 /* RLMSet_Private.h in Headers */,\n\t\t\t\t5D659EAE1BE04556006515A0 /* RLMSwiftCollectionBase.h in Headers */,\n\t\t\t\t3FCC56E429A55607004C5057 /* RLMSwiftObject.h in Headers */,\n\t\t\t\t3F83E9A42630A14800FC9623 /* RLMSwiftProperty.h in Headers */,\n\t\t\t\t5D659EC91BE04556006515A0 /* RLMSwiftSupport.h in Headers */,\n\t\t\t\t3F1D9092265C07A600593ABA /* RLMSwiftValueStorage.h in Headers */,\n\t\t\t\t3F67DB3C1E26D69C0024533D /* RLMThreadSafeReference.h in Headers */,\n\t\t\t\t3F1D8D33265B071000593ABA /* RLMValue.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t5D660FC91BE98C560021E04F /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t3F1A5E711992EB7400F45F4C /* TestHost */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 3F1A5E931992EB7400F45F4C /* Build configuration list for PBXNativeTarget \"TestHost\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t3F1A5E6E1992EB7400F45F4C /* Sources */,\n\t\t\t\t3F1A5E6F1992EB7400F45F4C /* Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = TestHost;\n\t\t\tproductName = TestHost;\n\t\t\tproductReference = 3F1A5E721992EB7400F45F4C /* TestHost.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\t53124AB725B71AF600771CE4 /* SwiftUITestHost */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 53124ADB25B71AF700771CE4 /* Build configuration list for PBXNativeTarget \"SwiftUITestHost\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t53124AB425B71AF600771CE4 /* Sources */,\n\t\t\t\t53124AB525B71AF600771CE4 /* Frameworks */,\n\t\t\t\t53124AB625B71AF600771CE4 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t53BBF08D25B7436F00D225AD /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = SwiftUITestHost;\n\t\t\tproductName = SwiftUITestHost;\n\t\t\tproductReference = 53124AB825B71AF600771CE4 /* SwiftUITestHost.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\t53124AD325B71AF700771CE4 /* SwiftUITests */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 53124AE125B71AF700771CE4 /* Build configuration list for PBXNativeTarget \"SwiftUITests\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t53124AD025B71AF700771CE4 /* Sources */,\n\t\t\t\t53124AD125B71AF700771CE4 /* Frameworks */,\n\t\t\t\t53124AD225B71AF700771CE4 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t3FF5165226E96D2B00618280 /* PBXTargetDependency */,\n\t\t\t\t534DF4D025B86F3A00655AE2 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = SwiftUITests;\n\t\t\tproductName = SwiftUITestHostUITests;\n\t\t\tproductReference = 53124AD425B71AF700771CE4 /* SwiftUITests.xctest */;\n\t\t\tproductType = \"com.apple.product-type.bundle.ui-testing\";\n\t\t};\n\t\t5D659E7D1BE04556006515A0 /* Realm */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 5D659ED61BE04556006515A0 /* Build configuration list for PBXNativeTarget \"Realm\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t5D659E7E1BE04556006515A0 /* Get Version Number */,\n\t\t\t\t5D659E801BE04556006515A0 /* Sources */,\n\t\t\t\t5D659E9F1BE04556006515A0 /* Headers */,\n\t\t\t\t1A7B82351D51235600750296 /* Frameworks */,\n\t\t\t\t5D659ECE1BE04556006515A0 /* Resources */,\n\t\t\t\t3F1DDB5825155E33007A9630 /* Carthage post-build workaround */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = Realm;\n\t\t\tproductName = Realm;\n\t\t\tproductReference = 5D659ED91BE04556006515A0 /* Realm.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n\t\t5D660FCB1BE98C560021E04F /* RealmSwift */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 5D660FD11BE98C560021E04F /* Build configuration list for PBXNativeTarget \"RealmSwift\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t5D660FC71BE98C560021E04F /* Sources */,\n\t\t\t\t5D660FC81BE98C560021E04F /* Frameworks */,\n\t\t\t\t5D660FC91BE98C560021E04F /* Headers */,\n\t\t\t\t5D660FCA1BE98C560021E04F /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t5D66102C1BE98DF60021E04F /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = RealmSwift;\n\t\t\tproductName = RealmSwift;\n\t\t\tproductReference = 5D660FCC1BE98C560021E04F /* RealmSwift.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n\t\t5D660FD71BE98C7C0021E04F /* RealmSwift Tests */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 5D660FE01BE98C7C0021E04F /* Build configuration list for PBXNativeTarget \"RealmSwift Tests\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t5D660FD41BE98C7C0021E04F /* Sources */,\n\t\t\t\t5D660FD51BE98C7C0021E04F /* Frameworks */,\n\t\t\t\t5D66102D1BE98E360021E04F /* Embed Frameworks */,\n\t\t\t\t2973CCF81C175AAA00FEA0FA /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t3FC8BF35212B79F4001C2025 /* PBXTargetDependency */,\n\t\t\t\t5D660FDF1BE98C7C0021E04F /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"RealmSwift Tests\";\n\t\t\tproductName = \"RealmSwift Tests\";\n\t\t\tproductReference = 5D660FD81BE98C7C0021E04F /* RealmSwift Tests.xctest */;\n\t\t\tproductType = \"com.apple.product-type.bundle.unit-test\";\n\t\t};\n\t\tE8D89BA21955FC6D00CF2B9A /* Tests */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = E8D89BB11955FC6D00CF2B9A /* Build configuration list for PBXNativeTarget \"Tests\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t5D304A2E1BE9AEFB0082C1A6 /* Get Version Number */,\n\t\t\t\tE8D89B9F1955FC6D00CF2B9A /* Sources */,\n\t\t\t\tE8D89BA01955FC6D00CF2B9A /* Frameworks */,\n\t\t\t\t5D128F291BE984D4001F4FBF /* Embed Frameworks */,\n\t\t\t\t29B7FDFA1C0DE80A0023224E /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t5DD755D21BE05828002800DA /* PBXTargetDependency */,\n\t\t\t\t5D6157021BE0A3A100A4BD3F /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = Tests;\n\t\t\tproductName = RealmTests;\n\t\t\tproductReference = E8D89BA31955FC6D00CF2B9A /* Tests.xctest */;\n\t\t\tproductType = \"com.apple.product-type.bundle.unit-test\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tE8D89B8F1955FC6D00CF2B9A /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tBuildIndependentTargetsInParallel = YES;\n\t\t\t\tCLASSPREFIX = RLM;\n\t\t\t\tLastSwiftUpdateCheck = 1230;\n\t\t\t\tLastTestingUpgradeCheck = 0510;\n\t\t\t\tLastUpgradeCheck = 1430;\n\t\t\t\tORGANIZATIONNAME = Realm;\n\t\t\t\tTargetAttributes = {\n\t\t\t\t\t3F1A5E711992EB7400F45F4C = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 6.0;\n\t\t\t\t\t\tLastSwiftMigration = 0900;\n\t\t\t\t\t\tProvisioningStyle = Automatic;\n\t\t\t\t\t};\n\t\t\t\t\t53124AB725B71AF600771CE4 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 12.3;\n\t\t\t\t\t\tLastSwiftMigration = 1240;\n\t\t\t\t\t};\n\t\t\t\t\t53124AD325B71AF700771CE4 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 12.3;\n\t\t\t\t\t\tTestTargetID = 53124AB725B71AF600771CE4;\n\t\t\t\t\t};\n\t\t\t\t\t5D659E7D1BE04556006515A0 = {\n\t\t\t\t\t\tLastSwiftMigration = 1320;\n\t\t\t\t\t\tProvisioningStyle = Automatic;\n\t\t\t\t\t};\n\t\t\t\t\t5D660FCB1BE98C560021E04F = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.1;\n\t\t\t\t\t\tLastSwiftMigration = 1020;\n\t\t\t\t\t\tProvisioningStyle = Automatic;\n\t\t\t\t\t};\n\t\t\t\t\t5D660FD71BE98C7C0021E04F = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.1;\n\t\t\t\t\t\tLastSwiftMigration = 1020;\n\t\t\t\t\t\tProvisioningStyle = Automatic;\n\t\t\t\t\t};\n\t\t\t\t\tACB76B772AA9D9A600C59983 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 15.0;\n\t\t\t\t\t};\n\t\t\t\t\tE83EAC791BED3D880085CCD2 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.1;\n\t\t\t\t\t};\n\t\t\t\t\tE8D89BA21955FC6D00CF2B9A = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 6.0;\n\t\t\t\t\t\tLastSwiftMigration = 1020;\n\t\t\t\t\t\tProvisioningStyle = Automatic;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tbuildConfigurationList = E8D89B921955FC6D00CF2B9A /* Build configuration list for PBXProject \"Realm\" */;\n\t\t\tcompatibilityVersion = \"Xcode 3.2\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t\tBase,\n\t\t\t);\n\t\t\tmainGroup = E8D89B8E1955FC6D00CF2B9A;\n\t\t\tproductRefGroup = E8D89B991955FC6D00CF2B9A /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t5D659E7D1BE04556006515A0 /* Realm */,\n\t\t\t\t5D660FCB1BE98C560021E04F /* RealmSwift */,\n\t\t\t\tE8D89BA21955FC6D00CF2B9A /* Tests */,\n\t\t\t\t5D660FD71BE98C7C0021E04F /* RealmSwift Tests */,\n\t\t\t\tE83EAC791BED3D880085CCD2 /* SwiftLint */,\n\t\t\t\t3F1A5E711992EB7400F45F4C /* TestHost */,\n\t\t\t\t53124AB725B71AF600771CE4 /* SwiftUITestHost */,\n\t\t\t\t53124AD325B71AF700771CE4 /* SwiftUITests */,\n\t\t\t\tACB76B772AA9D9A600C59983 /* CI */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t2973CCF81C175AAA00FEA0FA /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FDAB84D290B7A0200168F24 /* file-format-version-10.realm in Resources */,\n\t\t\t\t3FDAB849290B659300168F24 /* file-format-version-21.realm in Resources */,\n\t\t\t\t2973CCF91C175AB400FEA0FA /* fileformat-pre-null.realm in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t29B7FDFA1C0DE80A0023224E /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FDAB84C290B7A0200168F24 /* file-format-version-10.realm in Resources */,\n\t\t\t\t3FDAB848290B658300168F24 /* file-format-version-21.realm in Resources */,\n\t\t\t\t29B7FDFB1C0DE8100023224E /* fileformat-pre-null.realm in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t53124AB625B71AF600771CE4 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t53A34E3625CDA0AC00698930 /* LaunchScreen.storyboard in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t53124AD225B71AF700771CE4 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t5D659ECE1BE04556006515A0 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t5D659ED21BE04556006515A0 /* CHANGELOG.md in Resources */,\n\t\t\t\t5D659ED51BE04556006515A0 /* LICENSE in Resources */,\n\t\t\t\t3FD6D1A92B4C9EFB00A4FEBE /* PrivacyInfo.xcprivacy in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t5D660FCA1BE98C560021E04F /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FD6D1AC2B4CA56D00A4FEBE /* PrivacyInfo.xcprivacy in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXShellScriptBuildPhase section */\n\t\t3F1DDB5825155E33007A9630 /* Carthage post-build workaround */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\talwaysOutOfDate = 1;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputFileListPaths = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t);\n\t\t\tname = \"Carthage post-build workaround\";\n\t\t\toutputFileListPaths = (\n\t\t\t);\n\t\t\toutputPaths = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"# Something that Carthage does results in Xcode skipping the ProcessXCFramework build step in some cases, which results in compilation failing. To work around this, ensure that the modified date on the XCFramework files are always newer than the built files, so that it happens on every build. This breaks incremental compilation, so we only want to do it when building for Carthage.\\nif [ -n \\\"$CARTHAGE\\\" ]; then\\n    find \\\"${SRCROOT}/core\\\" -type f -exec touch {} \\\\;\\nfi\\n\";\n\t\t\tshowEnvVarsInLog = 0;\n\t\t};\n\t\t5D304A2E1BE9AEFB0082C1A6 /* Get Version Number */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t\t\"$(SRCROOT)/Realm/Realm-Info.plist\",\n\t\t\t);\n\t\t\tname = \"Get Version Number\";\n\t\t\toutputPaths = (\n\t\t\t\t\"$(DERIVED_FILE_DIR)/RLMVersion.h\",\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"exec \\\"${SRCROOT}/scripts/generate-rlmversion.sh\\\"\\n\";\n\t\t};\n\t\t5D659E7E1BE04556006515A0 /* Get Version Number */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t\t\"$(SRCROOT)/Realm/Realm-Info.plist\",\n\t\t\t);\n\t\t\tname = \"Get Version Number\";\n\t\t\toutputPaths = (\n\t\t\t\t\"$(DERIVED_FILE_DIR)/RLMVersion.h\",\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"exec \\\"${SRCROOT}/scripts/generate-rlmversion.sh\\\"\\n\";\n\t\t\tshowEnvVarsInLog = 0;\n\t\t};\n\t\tE83EAC7D1BED3D8F0085CCD2 /* Run SwiftLint */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t);\n\t\t\tname = \"Run SwiftLint\";\n\t\t\toutputPaths = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"if which swiftlint >/dev/null; then\\n  swiftlint\\nelse\\n  echo \\\"SwiftLint does not exist, download from https://github.com/realm/SwiftLint\\\"\\nfi\\n\";\n\t\t};\n/* End PBXShellScriptBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t3F1A5E6E1992EB7400F45F4C /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t29EDB8E41A7708E700458D80 /* main.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t53124AB425B71AF600771CE4 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t53626AAF25D31CAC00D9515D /* Objects.swift in Sources */,\n\t\t\t\t53A34E3725CDA0AC00698930 /* SwiftUITestHostApp.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t53124AD025B71AF700771CE4 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t53626AB025D31CAC00D9515D /* Objects.swift in Sources */,\n\t\t\t\t53124AD925B71AF700771CE4 /* SwiftUITestHostUITests.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t5D659E801BE04556006515A0 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t5D659E851BE04556006515A0 /* RLMAccessor.mm in Sources */,\n\t\t\t\t5D659E871BE04556006515A0 /* RLMArray.mm in Sources */,\n\t\t\t\t3FD0D7C929675A2E0031C196 /* RLMAsyncTask.mm in Sources */,\n\t\t\t\t3F9863BB1D36876B00641C98 /* RLMClassInfo.mm in Sources */,\n\t\t\t\t3FBEF67B1C63D66100F6935B /* RLMCollection.mm in Sources */,\n\t\t\t\t5D659E891BE04556006515A0 /* RLMConstants.m in Sources */,\n\t\t\t\t3F4F3AD523F71C790048DB43 /* RLMDecimal128.mm in Sources */,\n\t\t\t\t0C3BD4B325C1BDF1007CFDD3 /* RLMDictionary.mm in Sources */,\n\t\t\t\t3FC3F914241808B400E27322 /* RLMEmbeddedObject.mm in Sources */,\n\t\t\t\t3FDAB845290B4CCB00168F24 /* RLMError.mm in Sources */,\n\t\t\t\tAC7825BD2ACD90DA007ABA4B /* RLMGeospatial.mm in Sources */,\n\t\t\t\tAC3B33AF29DC6CEE0042F3A0 /* RLMLogger.mm in Sources */,\n\t\t\t\t5D659E881BE04556006515A0 /* RLMManagedArray.mm in Sources */,\n\t\t\t\tCF9881C125DABC6500BD7E4F /* RLMManagedDictionary.mm in Sources */,\n\t\t\t\tCFD8D12025BB0B8B0037FE4D /* RLMManagedSet.mm in Sources */,\n\t\t\t\t5D659E8B1BE04556006515A0 /* RLMMigration.mm in Sources */,\n\t\t\t\t5D659E8C1BE04556006515A0 /* RLMObject.mm in Sources */,\n\t\t\t\t5D659E8D1BE04556006515A0 /* RLMObjectBase.mm in Sources */,\n\t\t\t\t3F4F3ADB23F71C790048DB43 /* RLMObjectId.mm in Sources */,\n\t\t\t\t5D659E8E1BE04556006515A0 /* RLMObjectSchema.mm in Sources */,\n\t\t\t\t5D659E8F1BE04556006515A0 /* RLMObjectStore.mm in Sources */,\n\t\t\t\t5D659E901BE04556006515A0 /* RLMObservation.mm in Sources */,\n\t\t\t\t5D3E1A2F1C1FC6D5002913BA /* RLMPredicateUtil.mm in Sources */,\n\t\t\t\t5D659E921BE04556006515A0 /* RLMProperty.mm in Sources */,\n\t\t\t\t5D659E931BE04556006515A0 /* RLMQueryUtil.mm in Sources */,\n\t\t\t\t5D659E941BE04556006515A0 /* RLMRealm.mm in Sources */,\n\t\t\t\t5D659E951BE04556006515A0 /* RLMRealmConfiguration.mm in Sources */,\n\t\t\t\t5D659E961BE04556006515A0 /* RLMRealmUtil.mm in Sources */,\n\t\t\t\t5D659E971BE04556006515A0 /* RLMResults.mm in Sources */,\n\t\t\t\t3F0BBB9929AFDA6600FEA7A7 /* RLMScheduler.mm in Sources */,\n\t\t\t\t5D659E981BE04556006515A0 /* RLMSchema.mm in Sources */,\n\t\t\t\tCFDBC4B628803C7200EE80E6 /* RLMSectionedResults.mm in Sources */,\n\t\t\t\tCF986D2025AE3B090039D287 /* RLMSet.mm in Sources */,\n\t\t\t\t5D659E8A1BE04556006515A0 /* RLMSwiftCollectionBase.mm in Sources */,\n\t\t\t\t5D659E991BE04556006515A0 /* RLMSwiftSupport.m in Sources */,\n\t\t\t\t3F1D90BC265C08F800593ABA /* RLMSwiftValueStorage.mm in Sources */,\n\t\t\t\t3F67DB3E1E26D69C0024533D /* RLMThreadSafeReference.mm in Sources */,\n\t\t\t\t5D659E9B1BE04556006515A0 /* RLMUtil.mm in Sources */,\n\t\t\t\t0C5796A225643D7500744CAE /* RLMUUID.mm in Sources */,\n\t\t\t\t3F1D8D35265B071000593ABA /* RLMValue.mm in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t5D660FC71BE98C560021E04F /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t5D660FF11BE98D670021E04F /* Aliases.swift in Sources */,\n\t\t\t\t681EE33B25EE8E1400A9DEC5 /* AnyRealmValue.swift in Sources */,\n\t\t\t\t3FE267D7264308680030F83C /* BasicTypes.swift in Sources */,\n\t\t\t\t3FE267D5264308680030F83C /* CollectionAccess.swift in Sources */,\n\t\t\t\t3F102CBD23DBC68300108FD2 /* Combine.swift in Sources */,\n\t\t\t\t3FE267D6264308680030F83C /* ComplexTypes.swift in Sources */,\n\t\t\t\t3F9F53D32718B5DA000EEB4A /* CustomPersistable.swift in Sources */,\n\t\t\t\t3FB6ABD92416A27000E318C2 /* Decimal128.swift in Sources */,\n\t\t\t\t3FC3F9172419B63200E27322 /* EmbeddedObject.swift in Sources */,\n\t\t\t\t29B7FDF61C0DA6560023224E /* Error.swift in Sources */,\n\t\t\t\tAC7825B92ACD90BE007ABA4B /* Geospatial.swift in Sources */,\n\t\t\t\t3F857A482769291800F9B9B1 /* KeyPathStrings.swift in Sources */,\n\t\t\t\t5D1534B81CCFF545008976D7 /* LinkingObjects.swift in Sources */,\n\t\t\t\t5D660FF21BE98D670021E04F /* List.swift in Sources */,\n\t\t\t\t0C3BD4D325C1C5AB007CFDD3 /* Map.swift in Sources */,\n\t\t\t\t5D660FF31BE98D670021E04F /* Migration.swift in Sources */,\n\t\t\t\tCFE9CE31265554FB00BF96D6 /* MutableSet.swift in Sources */,\n\t\t\t\t3F3411A6273433B300EC9D25 /* ObjcBridgeable.swift in Sources */,\n\t\t\t\t5D660FF41BE98D670021E04F /* Object.swift in Sources */,\n\t\t\t\t3FB6ABD72416A26100E318C2 /* ObjectId.swift in Sources */,\n\t\t\t\t681EE34725EE8E5600A9DEC5 /* ObjectiveCSupport+AnyRealmValue.swift in Sources */,\n\t\t\t\t5B77EACE1DCC5614006AB51D /* ObjectiveCSupport.swift in Sources */,\n\t\t\t\t5D660FF51BE98D670021E04F /* ObjectSchema.swift in Sources */,\n\t\t\t\t5D660FF61BE98D670021E04F /* Optional.swift in Sources */,\n\t\t\t\t3FE267D8264308680030F83C /* Persistable.swift in Sources */,\n\t\t\t\t3F149CCB2668112A00111D65 /* PersistedProperty.swift in Sources */,\n\t\t\t\t3F857A49276A507200F9B9B1 /* Projection.swift in Sources */,\n\t\t\t\t5D660FF71BE98D670021E04F /* Property.swift in Sources */,\n\t\t\t\t3FE267D9264308680030F83C /* PropertyAccessors.swift in Sources */,\n\t\t\t\tACF08B6726DD936200686CBC /* Query.swift in Sources */,\n\t\t\t\t5D660FF81BE98D670021E04F /* Realm.swift in Sources */,\n\t\t\t\t1AB605D31D495927007F53DE /* RealmCollection.swift in Sources */,\n\t\t\t\t3F997773273E23D300AA9E13 /* RealmCollectionImpl.swift in Sources */,\n\t\t\t\t5D660FFA1BE98D670021E04F /* RealmConfiguration.swift in Sources */,\n\t\t\t\tCFE9CE3326555BBD00BF96D6 /* RealmKeyedCollection.swift in Sources */,\n\t\t\t\tCF44461E26121C6800BAFDB4 /* RealmProperty.swift in Sources */,\n\t\t\t\t5D660FFB1BE98D670021E04F /* Results.swift in Sources */,\n\t\t\t\t68A7B91D2543538B00C703BC /* RLMSupport.swift in Sources */,\n\t\t\t\t5D660FFC1BE98D670021E04F /* Schema.swift in Sources */,\n\t\t\t\t3FE267DA264308680030F83C /* SchemaDiscovery.swift in Sources */,\n\t\t\t\tCF84D4F0281823B300005E27 /* SectionedResults.swift in Sources */,\n\t\t\t\t5D660FFD1BE98D670021E04F /* SortDescriptor.swift in Sources */,\n\t\t\t\t535EA9E225B0919800DBF3CD /* SwiftUI.swift in Sources */,\n\t\t\t\t3F222C4E1E26F51300CA0713 /* ThreadSafeReference.swift in Sources */,\n\t\t\t\t5D660FFE1BE98D670021E04F /* Util.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t5D660FD41BE98C7C0021E04F /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tCFFC8CC8262310C800929608 /* AnyRealmValueTests.swift in Sources */,\n\t\t\t\t3FCB1A7522A9B0A2003807FB /* CodableTests.swift in Sources */,\n\t\t\t\t3FE2BE0323D8CAD1002860E9 /* CombineTests.swift in Sources */,\n\t\t\t\tE8AE7C261EA436F800CDFF9A /* CompactionTests.swift in Sources */,\n\t\t\t\tACFF0EC728EC5ADB0097AEE0 /* CustomColumnNameTests.swift in Sources */,\n\t\t\t\t3F40C613276D1B05007FEF1A /* CustomObjectCreationTests.swift in Sources */,\n\t\t\t\t3F9F53D52718E8E6000EEB4A /* CustomPersistableTestObjects.swift in Sources */,\n\t\t\t\tCFFECBAA250646820010F585 /* Decimal128Tests.swift in Sources */,\n\t\t\t\tAC7825C22ACD917B007ABA4B /* GeospatialTests.swift in Sources */,\n\t\t\t\tCF0D04F1269365300038A058 /* KeyPathTests.swift in Sources */,\n\t\t\t\t3FF3FFAF1F0D6D6400B84599 /* KVOTests.swift in Sources */,\n\t\t\t\t5D6610161BE98D880021E04F /* ListTests.swift in Sources */,\n\t\t\t\t3F1D8D77265B075100593ABA /* MapTests.swift in Sources */,\n\t\t\t\t3F8824FD1E5E335000586B35 /* MigrationTests.swift in Sources */,\n\t\t\t\tAC5300722BD03D4A00BF5950 /* MixedCollectionTest.swift in Sources */,\n\t\t\t\t3F4E0FF92654765C008B8C0B /* ModernKVOTests.swift in Sources */,\n\t\t\t\t3F4E10102655CA33008B8C0B /* ModernObjectAccessorTests.swift in Sources */,\n\t\t\t\t3FA5E94D266064C4008F1345 /* ModernObjectCreationTests.swift in Sources */,\n\t\t\t\t3FB19069265ECF0C00DA7C76 /* ModernObjectTests.swift in Sources */,\n\t\t\t\t3FB1906B265ED23300DA7C76 /* ModernTestObjects.swift in Sources */,\n\t\t\t\tCF986DE225AE3EC70039D287 /* MutableSetTests.swift in Sources */,\n\t\t\t\t3F8824FE1E5E335000586B35 /* ObjectAccessorTests.swift in Sources */,\n\t\t\t\t3F8824FF1E5E335000586B35 /* ObjectCreationTests.swift in Sources */,\n\t\t\t\t3FFC68702B8EDB69002AE840 /* ObjectCustomPropertiesTests.swift in Sources */,\n\t\t\t\tCFFECBB525078EC40010F585 /* ObjectIdTests.swift in Sources */,\n\t\t\t\t3F8825001E5E335000586B35 /* ObjectiveCSupportTests.swift in Sources */,\n\t\t\t\t3F8825011E5E335000586B35 /* ObjectSchemaInitializationTests.swift in Sources */,\n\t\t\t\t3F8825021E5E335000586B35 /* ObjectSchemaTests.swift in Sources */,\n\t\t\t\t3F8825031E5E335000586B35 /* ObjectTests.swift in Sources */,\n\t\t\t\t3F8825041E5E335000586B35 /* PerformanceTests.swift in Sources */,\n\t\t\t\t3F2633C31E9D630000B32D30 /* PrimitiveListTests.swift in Sources */,\n\t\t\t\tCF040494263DF0AA00F9AEE0 /* PrimitiveMapTests.swift in Sources */,\n\t\t\t\tCF986DF625AE3EDF0039D287 /* PrimitiveMutableSetTests.swift in Sources */,\n\t\t\t\t0CBF2DB927286FFD00635902 /* ProjectedCollectTests.swift in Sources */,\n\t\t\t\t0CD1632826D3DF1D0027C49B /* ProjectionTests.swift in Sources */,\n\t\t\t\t3F8825051E5E335000586B35 /* PropertyTests.swift in Sources */,\n\t\t\t\tCF46CC0226D931BA00DE450C /* QueryTests.swift in Sources */,\n\t\t\t\t3F8825061E5E335000586B35 /* RealmCollectionTypeTests.swift in Sources */,\n\t\t\t\t3F8825071E5E335000586B35 /* RealmConfigurationTests.swift in Sources */,\n\t\t\t\t3F4E10112655CA33008B8C0B /* RealmPropertyTests.swift in Sources */,\n\t\t\t\t3F8825081E5E335000586B35 /* RealmTests.swift in Sources */,\n\t\t\t\t530BA61526DFA1CB008FC550 /* RLMChildProcessEnvironment.m in Sources */,\n\t\t\t\t3F558C9622C29A03002F0F30 /* RLMMultiProcessTestCase.m in Sources */,\n\t\t\t\t3F558C9222C29A03002F0F30 /* RLMTestCase.m in Sources */,\n\t\t\t\t3F558C8E22C29A03002F0F30 /* RLMTestObjects.m in Sources */,\n\t\t\t\t3F8825091E5E335000586B35 /* SchemaTests.swift in Sources */,\n\t\t\t\tCFDBC4C0288040E700EE80E6 /* SectionedResultsTests.swift in Sources */,\n\t\t\t\t3F88250A1E5E335000586B35 /* SortDescriptorTests.swift in Sources */,\n\t\t\t\t3F88250B1E5E335000586B35 /* SwiftLinkTests.swift in Sources */,\n\t\t\t\t5D6610251BE98D880021E04F /* SwiftTestObjects.swift in Sources */,\n\t\t\t\t535EAA7525B0B02B00DBF3CD /* SwiftUITests.swift in Sources */,\n\t\t\t\t3F88250C1E5E335000586B35 /* SwiftUnicodeTests.swift in Sources */,\n\t\t\t\t5D6610271BE98D880021E04F /* TestCase.swift in Sources */,\n\t\t\t\t3F558C8A22C29A03002F0F30 /* TestUtils.mm in Sources */,\n\t\t\t\t3FAF2D4129577100002EAC93 /* TestUtils.swift in Sources */,\n\t\t\t\t3F90C1B22716169C0029000E /* TestValueFactory.swift in Sources */,\n\t\t\t\t3F88250D1E5E335000586B35 /* ThreadSafeReferenceTests.swift in Sources */,\n\t\t\t\t5DBEC9B11F719A9D001233EC /* Util.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8D89B9F1955FC6D00CF2B9A /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE81A1FD51955FE0100FDED82 /* ArrayPropertyTests.m in Sources */,\n\t\t\t\t3F7556751BE95A0C0058BC7E /* AsyncTests.mm in Sources */,\n\t\t\t\tE8DA16F81E81210D0055141C /* CompactionTests.m in Sources */,\n\t\t\t\tCFFECBAD250667B20010F585 /* Decimal128Tests.m in Sources */,\n\t\t\t\tCF052EFB25DEB671008EEF86 /* DictionaryPropertyTests.m in Sources */,\n\t\t\t\t02E334C31A5F41C7009F8810 /* DynamicTests.m in Sources */,\n\t\t\t\t021A88321AAFB5C800EEAC84 /* EncryptionTests.mm in Sources */,\n\t\t\t\tE81A1FDB1955FE0100FDED82 /* EnumeratorTests.m in Sources */,\n\t\t\t\t027A4D2C1AB1012500AA46F9 /* InterprocessTests.m in Sources */,\n\t\t\t\t3F1F47821B9612B300CD99A3 /* KVOTests.mm in Sources */,\n\t\t\t\t5D432B8D1CC0713F00A610A9 /* LinkingObjectsTests.mm in Sources */,\n\t\t\t\tE81A1FDD1955FE0100FDED82 /* LinkTests.m in Sources */,\n\t\t\t\t0207AB87195DFA15007EFB12 /* MigrationTests.mm in Sources */,\n\t\t\t\t3F2E66641CA0BA11004761D5 /* NotificationTests.m in Sources */,\n\t\t\t\t3FEB383F1E70AC8800F22712 /* ObjectCreationTests.mm in Sources */,\n\t\t\t\tCFFECBB0250690EA0010F585 /* ObjectIdTests.m in Sources */,\n\t\t\t\tE81A1FE11955FE0100FDED82 /* ObjectInterfaceTests.m in Sources */,\n\t\t\t\t021A88361AAFB5CD00EEAC84 /* ObjectSchemaTests.m in Sources */,\n\t\t\t\tE81A1FE31955FE0100FDED82 /* ObjectTests.m in Sources */,\n\t\t\t\t5D03FB1F1E0DAFBA007D53EA /* PredicateUtilTests.mm in Sources */,\n\t\t\t\t3F572C971F2BDAB100F6C9AB /* PrimitiveArrayPropertyTests.m in Sources */,\n\t\t\t\t0C86B33925E15B6000775FED /* PrimitiveDictionaryPropertyTests.m in Sources */,\n\t\t\t\t3F1D8DCB265B077800593ABA /* PrimitiveRLMValuePropertyTests.m in Sources */,\n\t\t\t\tCF986D3125AE3BD40039D287 /* PrimitiveSetPropertyTests.m in Sources */,\n\t\t\t\t02AFB4631A80343600E11938 /* PropertyTests.m in Sources */,\n\t\t\t\tE81A1FE71955FE0100FDED82 /* QueryTests.m in Sources */,\n\t\t\t\tC042A48D1B7522A900771ED2 /* RealmConfigurationTests.mm in Sources */,\n\t\t\t\tE81A1FEB1955FE0100FDED82 /* RealmTests.mm in Sources */,\n\t\t\t\t02AFB4671A80343600E11938 /* ResultsTests.m in Sources */,\n\t\t\t\t530BA61426DFA1CB008FC550 /* RLMChildProcessEnvironment.m in Sources */,\n\t\t\t\t3F558C9322C29A03002F0F30 /* RLMMultiProcessTestCase.m in Sources */,\n\t\t\t\t3FDCFEB619F6A8D3005E414A /* RLMSupport.swift in Sources */,\n\t\t\t\t3F558C8F22C29A03002F0F30 /* RLMTestCase.m in Sources */,\n\t\t\t\t297FBEFB1C19F696009D1118 /* RLMTestCaseUtils.swift in Sources */,\n\t\t\t\t3F558C8B22C29A03002F0F30 /* RLMTestObjects.m in Sources */,\n\t\t\t\t3F1D8DFF265B078200593ABA /* RLMValueTests.m in Sources */,\n\t\t\t\t0207AB89195DFA15007EFB12 /* SchemaTests.mm in Sources */,\n\t\t\t\tCF25080E283B90F8007D66FE /* SectionedResultsTests.m in Sources */,\n\t\t\t\tCF986D3325AE3BD40039D287 /* SetPropertyTests.m in Sources */,\n\t\t\t\t3FB4FA1819F5D2740020D53B /* SwiftArrayPropertyTests.swift in Sources */,\n\t\t\t\t3FB4FA1919F5D2740020D53B /* SwiftArrayTests.swift in Sources */,\n\t\t\t\t3FB4FA1A19F5D2740020D53B /* SwiftDynamicTests.swift in Sources */,\n\t\t\t\t3FB4FA1B19F5D2740020D53B /* SwiftLinkTests.swift in Sources */,\n\t\t\t\t3FB4FA1D19F5D2740020D53B /* SwiftObjectInterfaceTests.swift in Sources */,\n\t\t\t\t3FB4FA1E19F5D2740020D53B /* SwiftPropertyTypeTest.swift in Sources */,\n\t\t\t\t3FB4FA1F19F5D2740020D53B /* SwiftRealmTests.swift in Sources */,\n\t\t\t\t0C9758BF264974660097B48D /* SwiftRLMDictionaryTests.swift in Sources */,\n\t\t\t\t3FEC4A3F1BBB18D400F009C3 /* SwiftSchemaTests.swift in Sources */,\n\t\t\t\tCF986D7025AE3C550039D287 /* SwiftSetPropertyTests.swift in Sources */,\n\t\t\t\tCF986D8425AE3C5A0039D287 /* SwiftSetTests.swift in Sources */,\n\t\t\t\t3FB4FA1719F5D2740020D53B /* SwiftTestObjects.swift in Sources */,\n\t\t\t\t3FB4FA2019F5D2740020D53B /* SwiftUnicodeTests.swift in Sources */,\n\t\t\t\t3F558C8722C29A03002F0F30 /* TestUtils.mm in Sources */,\n\t\t\t\t3F572C941F2BDAAB00F6C9AB /* ThreadSafeReferenceTests.m in Sources */,\n\t\t\t\tE81A20021955FE0100FDED82 /* TransactionTests.m in Sources */,\n\t\t\t\tE8917598197A1B350068ACC6 /* UnicodeTests.m in Sources */,\n\t\t\t\tC0CDC0821B38DABA00C5716D /* UtilTests.mm in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\t3FC8BF35212B79F4001C2025 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 3F1A5E711992EB7400F45F4C /* TestHost */;\n\t\t\ttargetProxy = 3FC8BF34212B79F4001C2025 /* PBXContainerItemProxy */;\n\t\t};\n\t\t3FF5165226E96D2B00618280 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 5D660FCB1BE98C560021E04F /* RealmSwift */;\n\t\t\ttargetProxy = 3FF5165126E96D2B00618280 /* PBXContainerItemProxy */;\n\t\t};\n\t\t534DF4D025B86F3A00655AE2 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 53124AB725B71AF600771CE4 /* SwiftUITestHost */;\n\t\t\ttargetProxy = 534DF4CF25B86F3A00655AE2 /* PBXContainerItemProxy */;\n\t\t};\n\t\t53BBF08D25B7436F00D225AD /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 5D660FCB1BE98C560021E04F /* RealmSwift */;\n\t\t\ttargetProxy = 53BBF08C25B7436F00D225AD /* PBXContainerItemProxy */;\n\t\t};\n\t\t5D6157021BE0A3A100A4BD3F /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 3F1A5E711992EB7400F45F4C /* TestHost */;\n\t\t\ttargetProxy = 5D6157011BE0A3A100A4BD3F /* PBXContainerItemProxy */;\n\t\t};\n\t\t5D660FDF1BE98C7C0021E04F /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 5D660FCB1BE98C560021E04F /* RealmSwift */;\n\t\t\ttargetProxy = 5D660FDE1BE98C7C0021E04F /* PBXContainerItemProxy */;\n\t\t};\n\t\t5D66102C1BE98DF60021E04F /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 5D659E7D1BE04556006515A0 /* Realm */;\n\t\t\ttargetProxy = 5D66102B1BE98DF60021E04F /* PBXContainerItemProxy */;\n\t\t};\n\t\t5DD755D21BE05828002800DA /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 5D659E7D1BE04556006515A0 /* Realm */;\n\t\t\ttargetProxy = 5DD755D11BE05828002800DA /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t3F1A5E8F1992EB7400F45F4C /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5D6156F71BE07B6B00A4BD3F /* TestHost.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_IDENTITY = \"\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t3F1A5E901992EB7400F45F4C /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5D6156F71BE07B6B00A4BD3F /* TestHost.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_IDENTITY = \"\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t3FEC91472A4B58BD0044BFF5 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 3FEC91542A4B59A40044BFF5 /* Static.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\t3FEC91482A4B58BD0044BFF5 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5D659E761BE03E0D006515A0 /* Realm.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\t3FEC91492A4B58BD0044BFF5 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5D660FBD1BE98BEF0021E04F /* RealmSwift.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\t3FEC914A2A4B58BD0044BFF5 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5DD755E01BE05C19002800DA /* Tests.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\t3FEC914B2A4B58BD0044BFF5 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5D660FC01BE98BEF0021E04F /* Tests.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tOTHER_SWIFT_FLAGS = \"$(inherited) -D BUILDING_REALM_SWIFT_TESTS\";\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\t3FEC914D2A4B58BD0044BFF5 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\t3FEC914E2A4B58BD0044BFF5 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5D6156F71BE07B6B00A4BD3F /* TestHost.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_IDENTITY = \"\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\t3FEC91502A4B58BD0044BFF5 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 53124A4F25B714EC00771CE4 /* SwiftUITestHost.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_IDENTITY = \"\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\t3FEC91512A4B58BD0044BFF5 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 53626A8C25D3172000D9515D /* SwiftUITests.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_IDENTITY = \"\\\"-\\\"\";\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tTEST_TARGET_NAME = SwiftUITestHost;\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\t53124ADC25B71AF700771CE4 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 53124A4F25B714EC00771CE4 /* SwiftUITestHost.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_IDENTITY = \"\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t53124ADD25B71AF700771CE4 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 53124A4F25B714EC00771CE4 /* SwiftUITestHost.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_IDENTITY = \"\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t53124AE225B71AF700771CE4 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 53626A8C25D3172000D9515D /* SwiftUITests.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_IDENTITY = \"\\\"-\\\"\";\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tPROVISIONING_PROFILE_SPECIFIER = \"\";\n\t\t\t\tTEST_TARGET_NAME = SwiftUITestHost;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t53124AE325B71AF700771CE4 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 53626A8C25D3172000D9515D /* SwiftUITests.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_IDENTITY = \"\\\"-\\\"\";\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tTEST_TARGET_NAME = SwiftUITestHost;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t5D659ED71BE04556006515A0 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5D659E761BE03E0D006515A0 /* Realm.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t5D659ED81BE04556006515A0 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5D659E761BE03E0D006515A0 /* Realm.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t5D660FD21BE98C560021E04F /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5D660FBD1BE98BEF0021E04F /* RealmSwift.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t5D660FD31BE98C560021E04F /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5D660FBD1BE98BEF0021E04F /* RealmSwift.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t5D660FE11BE98C7C0021E04F /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5D660FC01BE98BEF0021E04F /* Tests.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tOTHER_SWIFT_FLAGS = \"$(inherited) -D BUILDING_REALM_SWIFT_TESTS -D DEBUG\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t5D660FE21BE98C7C0021E04F /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5D660FC01BE98BEF0021E04F /* Tests.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tOTHER_SWIFT_FLAGS = \"$(inherited) -D BUILDING_REALM_SWIFT_TESTS\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tACB76B782AA9D9A600C59983 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tACB76B792AA9D9A600C59983 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tACB76B7A2AA9D9A600C59983 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\tE83EAC7A1BED3D880085CCD2 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE83EAC7B1BED3D880085CCD2 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE8D89BAC1955FC6D00CF2B9A /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5D659E6E1BE0398E006515A0 /* Debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE8D89BAD1955FC6D00CF2B9A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5D659E6F1BE0398E006515A0 /* Release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE8D89BB21955FC6D00CF2B9A /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5DD755E01BE05C19002800DA /* Tests.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE8D89BB31955FC6D00CF2B9A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5DD755E01BE05C19002800DA /* Tests.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t3F1A5E931992EB7400F45F4C /* Build configuration list for PBXNativeTarget \"TestHost\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t3F1A5E8F1992EB7400F45F4C /* Debug */,\n\t\t\t\t3F1A5E901992EB7400F45F4C /* Release */,\n\t\t\t\t3FEC914E2A4B58BD0044BFF5 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t53124ADB25B71AF700771CE4 /* Build configuration list for PBXNativeTarget \"SwiftUITestHost\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t53124ADC25B71AF700771CE4 /* Debug */,\n\t\t\t\t53124ADD25B71AF700771CE4 /* Release */,\n\t\t\t\t3FEC91502A4B58BD0044BFF5 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t53124AE125B71AF700771CE4 /* Build configuration list for PBXNativeTarget \"SwiftUITests\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t53124AE225B71AF700771CE4 /* Debug */,\n\t\t\t\t53124AE325B71AF700771CE4 /* Release */,\n\t\t\t\t3FEC91512A4B58BD0044BFF5 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t5D659ED61BE04556006515A0 /* Build configuration list for PBXNativeTarget \"Realm\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t5D659ED71BE04556006515A0 /* Debug */,\n\t\t\t\t5D659ED81BE04556006515A0 /* Release */,\n\t\t\t\t3FEC91482A4B58BD0044BFF5 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t5D660FD11BE98C560021E04F /* Build configuration list for PBXNativeTarget \"RealmSwift\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t5D660FD21BE98C560021E04F /* Debug */,\n\t\t\t\t5D660FD31BE98C560021E04F /* Release */,\n\t\t\t\t3FEC91492A4B58BD0044BFF5 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t5D660FE01BE98C7C0021E04F /* Build configuration list for PBXNativeTarget \"RealmSwift Tests\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t5D660FE11BE98C7C0021E04F /* Debug */,\n\t\t\t\t5D660FE21BE98C7C0021E04F /* Release */,\n\t\t\t\t3FEC914B2A4B58BD0044BFF5 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tACB76B7B2AA9D9A600C59983 /* Build configuration list for PBXAggregateTarget \"CI\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tACB76B782AA9D9A600C59983 /* Debug */,\n\t\t\t\tACB76B792AA9D9A600C59983 /* Release */,\n\t\t\t\tACB76B7A2AA9D9A600C59983 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE83EAC7C1BED3D880085CCD2 /* Build configuration list for PBXAggregateTarget \"SwiftLint\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE83EAC7A1BED3D880085CCD2 /* Debug */,\n\t\t\t\tE83EAC7B1BED3D880085CCD2 /* Release */,\n\t\t\t\t3FEC914D2A4B58BD0044BFF5 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE8D89B921955FC6D00CF2B9A /* Build configuration list for PBXProject \"Realm\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE8D89BAC1955FC6D00CF2B9A /* Debug */,\n\t\t\t\tE8D89BAD1955FC6D00CF2B9A /* Release */,\n\t\t\t\t3FEC91472A4B58BD0044BFF5 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE8D89BB11955FC6D00CF2B9A /* Build configuration list for PBXNativeTarget \"Tests\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE8D89BB21955FC6D00CF2B9A /* Debug */,\n\t\t\t\tE8D89BB31955FC6D00CF2B9A /* Release */,\n\t\t\t\t3FEC914A2A4B58BD0044BFF5 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = E8D89B8F1955FC6D00CF2B9A /* Project object */;\n}\n"
  },
  {
    "path": "Realm.xcodeproj/xcshareddata/xcbaselines/5D660FD71BE98C7C0021E04F.xcbaseline/6890B8D9-CE81-403E-8EF6-B95A367D65B5.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>classNames</key>\n\t<dict>\n\t\t<key>SwiftPerformanceTests</key>\n\t\t<dict>\n\t\t\t<key>testCommitWriteTransaction()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.075572</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 2:03:24 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testCommitWriteTransactionWithCrossThreadNotification()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.10352</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 2:03:24 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testCommitWriteTransactionWithLocalNotification()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.077464</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 2:03:24 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testCountWhereQuery()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.3073</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 2:03:24 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testCountWhereTableView()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.13184</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 2:03:24 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testCrossThreadSyncLatency()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.44978</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 2:43:11 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testDeleteAll()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.053093</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 2:03:24 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndAccessAll()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>1.3791</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 2:43:11 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndAccessAllSlow()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>1.4184</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 2:43:11 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndAccessArrayProperty()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>1.3905</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 2:43:11 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndAccessArrayPropertySlow()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>1.537</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 2:43:11 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndAccessQuery()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.76781</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 2:43:11 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndMutateAll()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>1.9894</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 2:43:11 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndMutateQuery()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>1.049</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 2:43:11 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testIndexedStringLookup()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.21403</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 2:03:24 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testInsertMultiple()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.24181</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 2:03:24 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testInsertMultipleLiteral()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.32753</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 2:03:24 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testInsertSingleLiteral()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.14083</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 2:03:24 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testLargeINQuery()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.43999</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 2:43:11 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testManualDeletion()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.48855</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 2:03:24 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testQueryConstruction()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.1752</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 2:03:24 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testQueryDeletion()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.11546</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 2:03:24 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testRealmCreationCached()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.58361</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 2:03:24 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testRealmCreationUncached()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict/>\n\t\t\t</dict>\n\t\t\t<key>testSortingAllObjects()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.20726</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 2:43:11 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testUnindexedStringLookup()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.20652</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 2:03:24 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t</dict>\n\t</dict>\n</dict>\n</plist>\n"
  },
  {
    "path": "Realm.xcodeproj/xcshareddata/xcbaselines/5D660FD71BE98C7C0021E04F.xcbaseline/B87A7896-8B70-4814-B20D-7CD723D62868.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>classNames</key>\n\t<dict>\n\t\t<key>SwiftPerformanceTests</key>\n\t\t<dict>\n\t\t\t<key>testCommitWriteTransaction()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.26241</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:22:28 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testCommitWriteTransactionWithCrossThreadNotification()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.27074</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:22:28 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testCommitWriteTransactionWithLocalNotification()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.2707</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:22:28 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testCountWhereQuery()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.069046</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:22:28 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testCountWhereTableView()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.05102</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:22:28 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testCrossThreadSyncLatency()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>1.4981</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:55:16 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testDeleteAll()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.034125</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:22:28 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndAccessAll()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.43683</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:55:16 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndAccessAllSlow()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.47066</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:55:16 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndAccessArrayProperty()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.44294</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:55:16 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndAccessArrayPropertySlow()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.52273</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:55:16 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndAccessQuery()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.2415</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:55:16 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndMutateAll()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.74033</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:55:16 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndMutateQuery()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.4148</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:55:16 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testIndexedStringLookup()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.099493</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:22:28 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testInsertMultiple()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.25401</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:22:28 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testInsertMultipleLiteral()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.29001</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:22:28 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testInsertSingleLiteral()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.49099</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:22:28 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testLargeINQuery()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.22316</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:55:16 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testManualDeletion()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.91235</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:22:28 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testQueryConstruction()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.076228</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:22:28 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testQueryDeletion()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.072784</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:22:28 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testRealmCreationCached()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.23321</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:22:28 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testRealmCreationUncached()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>5.2582</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:22:28 PM</string>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testSortingAllObjects()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.06945</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:55:16 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testUnindexedStringLookup()</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.078901</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 1:22:28 PM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t</dict>\n\t</dict>\n</dict>\n</plist>\n"
  },
  {
    "path": "Realm.xcodeproj/xcshareddata/xcbaselines/5D660FD71BE98C7C0021E04F.xcbaseline/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>runDestinationsByUUID</key>\n\t<dict>\n\t\t<key>6890B8D9-CE81-403E-8EF6-B95A367D65B5</key>\n\t\t<dict>\n\t\t\t<key>targetArchitecture</key>\n\t\t\t<string>armv7s</string>\n\t\t\t<key>targetDevice</key>\n\t\t\t<dict>\n\t\t\t\t<key>modelCode</key>\n\t\t\t\t<string>iPhone5,1</string>\n\t\t\t\t<key>platformIdentifier</key>\n\t\t\t\t<string>com.apple.platform.iphoneos</string>\n\t\t\t</dict>\n\t\t</dict>\n\t\t<key>B87A7896-8B70-4814-B20D-7CD723D62868</key>\n\t\t<dict>\n\t\t\t<key>targetArchitecture</key>\n\t\t\t<string>arm64</string>\n\t\t\t<key>targetDevice</key>\n\t\t\t<dict>\n\t\t\t\t<key>modelCode</key>\n\t\t\t\t<string>iPad4,4</string>\n\t\t\t\t<key>platformIdentifier</key>\n\t\t\t\t<string>com.apple.platform.iphoneos</string>\n\t\t\t</dict>\n\t\t</dict>\n\t</dict>\n</dict>\n</plist>\n"
  },
  {
    "path": "Realm.xcodeproj/xcshareddata/xcbaselines/E856D1DE195614A400FB2FCF.xcbaseline/2EB6396F-9FD1-4243-AA83-2D9F9D4DD919.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>classNames</key>\n\t<dict>\n\t\t<key>PerformanceTests</key>\n\t\t<dict>\n\t\t\t<key>testArrayKVOIndexHandlingInsertCompact</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.44623</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 11:11:55 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testArrayKVOIndexHandlingInsertSparse</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.46951</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 11:11:55 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testArrayKVOIndexHandlingRemoveBackwards</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.25049</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 11:47:05 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testArrayKVOIndexHandlingRemoveForward</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.28008</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 11:47:05 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testCommitWriteTransaction</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.25529</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 11:39:35 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testCommitWriteTransactionWithCrossThreadNotification</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>1.3805</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 11:39:35 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testCommitWriteTransactionWithListNotification</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.014152</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 11:39:35 AM</string>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testCommitWriteTransactionWithLocalNotification</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>1.3356</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 11:39:35 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testCommitWriteTransactionWithResultsNotification</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.024311</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 11:39:35 AM</string>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testCountWhereQuery</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.068142</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 11:11:55 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testCountWhereTableView</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.079563</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 11:39:35 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testCrossThreadSyncLatency</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>1.5036</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 11:39:35 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testDeleteAll</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.057373</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 11:11:55 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndAccessAll</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.021611</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 11:39:35 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndAccessAllSlow</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.032911</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 11:39:35 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndAccessArrayProperty</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.024657</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 11:39:35 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndAccessArrayPropertySlow</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.029516</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 11:39:35 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndAccessQuery</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.013916</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 11:39:35 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndMutateAll</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.085535</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 11:47:05 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testEnumerateAndMutateQuery</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.022362</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 11:47:05 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testIndexedStringLookup</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.064675</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 11:11:55 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testInsertMultiple</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.11286</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 11:11:55 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testInsertMultipleLiteral</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.22709</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 11:47:05 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testInsertSingleLiteral</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.62334</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 11:39:35 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testLargeINQuery</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.020886</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 11:39:35 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testManualDeletion</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.54088</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 11:11:55 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testQueryConstruction</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.061729</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 11:11:55 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testQueryDeletion</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.099315</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 11:11:55 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testRealmCreationCached</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.30414</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 11:39:35 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testRealmCreationUncached</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>5.6515</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 11:39:35 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testRealmFileCreation</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>1.8914</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 11:11:55 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testSortingAllObjects</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.017391</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 12, 2016, 11:39:35 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t\t<key>testUnIndexedStringLookup</key>\n\t\t\t<dict>\n\t\t\t\t<key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>baselineAverage</key>\n\t\t\t\t\t<real>0.060121</real>\n\t\t\t\t\t<key>baselineIntegrationDisplayName</key>\n\t\t\t\t\t<string>May 11, 2016, 11:11:55 AM</string>\n\t\t\t\t\t<key>maxRegression</key>\n\t\t\t\t\t<real>0.001</real>\n\t\t\t\t</dict>\n\t\t\t</dict>\n\t\t</dict>\n\t</dict>\n</dict>\n</plist>\n"
  },
  {
    "path": "Realm.xcodeproj/xcshareddata/xcbaselines/E856D1DE195614A400FB2FCF.xcbaseline/3AE81604-3FF9-49E2-A414-9B18BEEAE28F.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n <key>classNames</key>\n <dict>\n   <key>PerformanceTests</key>\n   <dict>\n     <key>testArrayKVOIndexHandlingInsertCompact</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.32691</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testArrayKVOIndexHandlingInsertSparse</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.27606</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testArrayKVOIndexHandlingRemoveBackwards</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.24281</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testArrayKVOIndexHandlingRemoveForward</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.26714</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testCommitWriteTransaction</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.23385</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testCommitWriteTransactionWithCrossThreadNotification</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>1.1877</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testCommitWriteTransactionWithListNotification</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.014699</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testCommitWriteTransactionWithLocalNotification</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>1.1827</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testCommitWriteTransactionWithResultsNotification</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.025275</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testCountWhereQuery</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.069509</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testCountWhereTableView</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.072526</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testCrossThreadSyncLatency</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>1.3507</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testDeleteAll</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.065435</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testEnumerateAndAccessAll</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.022628</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testEnumerateAndAccessAllSlow</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.025589</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testEnumerateAndAccessArrayProperty</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.022196</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testEnumerateAndAccessArrayPropertySlow</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.02866</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testEnumerateAndAccessQuery</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.012512</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testEnumerateAndMutateAll</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.095107</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testEnumerateAndMutateQuery</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.024364</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testIndexedStringLookup</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.061875</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testInsertMultiple</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.114</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testInsertMultipleLiteral</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.22307</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testInsertSingleLiteral</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.54683</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testLargeINQuery</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.021874</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testManualDeletion</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.47608</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testQueryConstruction</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.050903</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testQueryDeletion</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.085817</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testRealmCreationCached</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.29618</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testRealmCreationUncached</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>5.2568</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testRealmFileCreation</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>1.8215</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testSortingAllObjects</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.014483</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testUnIndexedStringLookup</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.061645</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:36:54 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n   </dict>\n </dict>\n</dict>\n</plist>\n"
  },
  {
    "path": "Realm.xcodeproj/xcshareddata/xcbaselines/E856D1DE195614A400FB2FCF.xcbaseline/AAC6BA1A-785D-4850-B3EC-68BC9F1D3EEF.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n <key>classNames</key>\n <dict>\n   <key>PerformanceTests</key>\n   <dict>\n     <key>testArrayKVOIndexHandlingInsertCompact</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.33455</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testArrayKVOIndexHandlingInsertSparse</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.35906</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testArrayKVOIndexHandlingRemoveBackwards</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.57923</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testArrayKVOIndexHandlingRemoveForward</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.64841</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testCommitWriteTransaction</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.069065</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testCommitWriteTransactionWithCrossThreadNotification</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.36435</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testCommitWriteTransactionWithListNotification</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.056905</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testCommitWriteTransactionWithLocalNotification</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.35081</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testCommitWriteTransactionWithResultsNotification</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.061962</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testCountWhereQuery</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.29435</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testCountWhereTableView</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.27236</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testCrossThreadSyncLatency</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.47796</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testDeleteAll</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.11475</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testEnumerateAndAccessAll</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.077348</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testEnumerateAndAccessAllSlow</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.10176</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testEnumerateAndAccessArrayProperty</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.079459</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testEnumerateAndAccessArrayPropertySlow</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.10685</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testEnumerateAndAccessQuery</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.04714</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testEnumerateAndMutateAll</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.11792</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testEnumerateAndMutateQuery</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.017438</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testIndexedStringLookup</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.15732</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testInsertMultiple</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.19128</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testInsertMultipleLiteral</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.28787</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testInsertSingleLiteral</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.23866</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testLargeINQuery</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.053538</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testManualDeletion</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.54791</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testQueryConstruction</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.15085</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testQueryDeletion</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.16626</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testRealmCreationCached</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.80076</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testRealmCreationUncached</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>3.2179</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testRealmFileCreation</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>1.7743</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testSortingAllObjects</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.039965</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n     <key>testUnIndexedStringLookup</key>\n     <dict>\n       <key>com.apple.XCTPerformanceMetric_WallClockTime</key>\n       <dict>\n         <key>baselineAverage</key>\n         <real>0.15588</real>\n         <key>baselineIntegrationDisplayName</key>\n         <string>May 11, 2016, 2:16:48 PM</string>\n         <key>maxRegression</key>\n         <real>0.001</real>\n       </dict>\n     </dict>\n   </dict>\n </dict>\n</dict>\n</plist>\n"
  },
  {
    "path": "Realm.xcodeproj/xcshareddata/xcbaselines/E856D1DE195614A400FB2FCF.xcbaseline/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>runDestinationsByUUID</key>\n\t<dict>\n\t\t<key>2EB6396F-9FD1-4243-AA83-2D9F9D4DD919</key>\n\t\t<dict>\n\t\t\t<key>targetArchitecture</key>\n\t\t\t<string>arm64</string>\n\t\t\t<key>targetDevice</key>\n\t\t\t<dict>\n\t\t\t\t<key>modelCode</key>\n\t\t\t\t<string>iPad4,4</string>\n\t\t\t\t<key>platformIdentifier</key>\n\t\t\t\t<string>com.apple.platform.iphoneos</string>\n\t\t\t</dict>\n\t\t</dict>\n\t\t<key>AAC6BA1A-785D-4850-B3EC-68BC9F1D3EEF</key>\n\t\t<dict>\n\t\t\t<key>targetArchitecture</key>\n\t\t\t<string>armv7s</string>\n\t\t\t<key>targetDevice</key>\n\t\t\t<dict>\n\t\t\t\t<key>modelCode</key>\n\t\t\t\t<string>iPhone5,1</string>\n\t\t\t\t<key>platformIdentifier</key>\n\t\t\t\t<string>com.apple.platform.iphoneos</string>\n\t\t\t</dict>\n\t\t</dict>\n\t\t<key>3AE81604-3FF9-49E2-A414-9B18BEEAE28F</key>\n\t\t<dict>\n\t\t\t<key>targetArchitecture</key>\n\t\t\t<string>arm64</string>\n\t\t\t<key>targetDevice</key>\n\t\t\t<dict>\n\t\t\t\t<key>modelCode</key>\n\t\t\t\t<string>iPhone6,2</string>\n\t\t\t\t<key>platformIdentifier</key>\n\t\t\t\t<string>com.apple.platform.iphoneos</string>\n\t\t\t</dict>\n\t\t</dict>\n\t</dict>\n</dict>\n</plist>\n"
  },
  {
    "path": "Realm.xcodeproj/xcshareddata/xcschemes/CI.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.7\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"ACB76B772AA9D9A600C59983\"\n               BuildableName = \"CI\"\n               BlueprintName = \"CI\"\n               ReferencedContainer = \"container:Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      shouldAutocreateTestPlan = \"YES\">\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <EnvironmentVariables>\n         <EnvironmentVariable\n            key = \"REALM_DISABLE_UPDATE_CHECKER\"\n            value = \"1\"\n            isEnabled = \"YES\">\n         </EnvironmentVariable>\n         <EnvironmentVariable\n            key = \"REALM_DISABLE_ANALYTICS\"\n            value = \"1\"\n            isEnabled = \"YES\">\n         </EnvironmentVariable>\n      </EnvironmentVariables>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"ACB76B772AA9D9A600C59983\"\n            BuildableName = \"CI\"\n            BlueprintName = \"CI\"\n            ReferencedContainer = \"container:Realm.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "Realm.xcodeproj/xcshareddata/xcschemes/Realm.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.7\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"NO\">\n      <PreActions>\n         <ExecutionAction\n            ActionType = \"Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction\">\n            <ActionContent\n               title = \"Run Script\"\n               scriptText = \"cd &quot;${PROJECT_DIR}&quot;&#10;sh build.sh download-core&#10;\"\n               shellToInvoke = \"/bin/sh\">\n               <EnvironmentBuildable>\n                  <BuildableReference\n                     BuildableIdentifier = \"primary\"\n                     BlueprintIdentifier = \"5D659E7D1BE04556006515A0\"\n                     BuildableName = \"Realm.framework\"\n                     BlueprintName = \"Realm\"\n                     ReferencedContainer = \"container:Realm.xcodeproj\">\n                  </BuildableReference>\n               </EnvironmentBuildable>\n            </ActionContent>\n         </ExecutionAction>\n      </PreActions>\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5D659E7D1BE04556006515A0\"\n               BuildableName = \"Realm.framework\"\n               BlueprintName = \"Realm\"\n               ReferencedContainer = \"container:Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"NO\"\n            buildForProfiling = \"NO\"\n            buildForArchiving = \"NO\"\n            buildForAnalyzing = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E8D89BA21955FC6D00CF2B9A\"\n               BuildableName = \"Tests.xctest\"\n               BlueprintName = \"Tests\"\n               ReferencedContainer = \"container:Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"5D659E7D1BE04556006515A0\"\n            BuildableName = \"Realm.framework\"\n            BlueprintName = \"Realm\"\n            ReferencedContainer = \"container:Realm.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E8D89BA21955FC6D00CF2B9A\"\n               BuildableName = \"Tests.xctest\"\n               BlueprintName = \"Tests\"\n               ReferencedContainer = \"container:Realm.xcodeproj\">\n            </BuildableReference>\n            <SkippedTests>\n               <Test\n                  Identifier = \"InterprocessTest/testChangeInChildTriggersNotificationInParent\">\n               </Test>\n            </SkippedTests>\n         </TestableReference>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"5D659E7D1BE04556006515A0\"\n            BuildableName = \"Realm.framework\"\n            BlueprintName = \"Realm\"\n            ReferencedContainer = \"container:Realm.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <EnvironmentVariables>\n         <EnvironmentVariable\n            key = \"REALM_DISABLE_UPDATE_CHECKER\"\n            value = \"1\"\n            isEnabled = \"YES\">\n         </EnvironmentVariable>\n         <EnvironmentVariable\n            key = \"REALM_DISABLE_ANALYTICS\"\n            value = \"1\"\n            isEnabled = \"YES\">\n         </EnvironmentVariable>\n         <EnvironmentVariable\n            key = \"REALM_ENCRYPT_ALL\"\n            value = \"1\"\n            isEnabled = \"NO\">\n         </EnvironmentVariable>\n      </EnvironmentVariables>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"5D659E7D1BE04556006515A0\"\n            BuildableName = \"Realm.framework\"\n            BlueprintName = \"Realm\"\n            ReferencedContainer = \"container:Realm.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "Realm.xcodeproj/xcshareddata/xcschemes/RealmSwift.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.7\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"NO\">\n      <PreActions>\n         <ExecutionAction\n            ActionType = \"Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction\">\n            <ActionContent\n               title = \"Run Script\"\n               scriptText = \"cd &quot;${PROJECT_DIR}&quot;&#10;sh build.sh download-core&#10;\">\n               <EnvironmentBuildable>\n                  <BuildableReference\n                     BuildableIdentifier = \"primary\"\n                     BlueprintIdentifier = \"5D660FCB1BE98C560021E04F\"\n                     BuildableName = \"RealmSwift.framework\"\n                     BlueprintName = \"RealmSwift\"\n                     ReferencedContainer = \"container:Realm.xcodeproj\">\n                  </BuildableReference>\n               </EnvironmentBuildable>\n            </ActionContent>\n         </ExecutionAction>\n      </PreActions>\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5D660FCB1BE98C560021E04F\"\n               BuildableName = \"RealmSwift.framework\"\n               BlueprintName = \"RealmSwift\"\n               ReferencedContainer = \"container:Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"5D660FCB1BE98C560021E04F\"\n            BuildableName = \"RealmSwift.framework\"\n            BlueprintName = \"RealmSwift\"\n            ReferencedContainer = \"container:Realm.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5D660FD71BE98C7C0021E04F\"\n               BuildableName = \"RealmSwift Tests.xctest\"\n               BlueprintName = \"RealmSwift Tests\"\n               ReferencedContainer = \"container:Realm.xcodeproj\">\n            </BuildableReference>\n         </TestableReference>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"5D660FCB1BE98C560021E04F\"\n            BuildableName = \"RealmSwift.framework\"\n            BlueprintName = \"RealmSwift\"\n            ReferencedContainer = \"container:Realm.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <EnvironmentVariables>\n         <EnvironmentVariable\n            key = \"SWIFT_UNEXPECTED_EXECUTOR_LOG_LEVEL\"\n            value = \"2\"\n            isEnabled = \"YES\">\n         </EnvironmentVariable>\n         <EnvironmentVariable\n            key = \"REALM_DISABLE_UPDATE_CHECKER\"\n            value = \"1\"\n            isEnabled = \"YES\">\n         </EnvironmentVariable>\n         <EnvironmentVariable\n            key = \"REALM_DISABLE_ANALYTICS\"\n            value = \"1\"\n            isEnabled = \"YES\">\n         </EnvironmentVariable>\n      </EnvironmentVariables>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"5D660FCB1BE98C560021E04F\"\n            BuildableName = \"RealmSwift.framework\"\n            BlueprintName = \"RealmSwift\"\n            ReferencedContainer = \"container:Realm.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "Realm.xcodeproj/xcshareddata/xcschemes/SwiftLint.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"NO\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E83EAC791BED3D880085CCD2\"\n               BuildableName = \"SwiftLint\"\n               BlueprintName = \"SwiftLint\"\n               ReferencedContainer = \"container:Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <Testables>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E83EAC791BED3D880085CCD2\"\n            BuildableName = \"SwiftLint\"\n            BlueprintName = \"SwiftLint\"\n            ReferencedContainer = \"container:Realm.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "Realm.xcodeproj/xcshareddata/xcschemes/SwiftUITestHost.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.7\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"NO\">\n      <PreActions>\n         <ExecutionAction\n            ActionType = \"Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction\">\n            <ActionContent\n               title = \"Run Script\"\n               scriptText = \"cd &quot;${PROJECT_DIR}&quot;&#10;sh build.sh download-core&#10;\"\n               shellToInvoke = \"/bin/sh\">\n               <EnvironmentBuildable>\n                  <BuildableReference\n                     BuildableIdentifier = \"primary\"\n                     BlueprintIdentifier = \"53124AB725B71AF600771CE4\"\n                     BuildableName = \"SwiftUITestHost.app\"\n                     BlueprintName = \"SwiftUITestHost\"\n                     ReferencedContainer = \"container:Realm.xcodeproj\">\n                  </BuildableReference>\n               </EnvironmentBuildable>\n            </ActionContent>\n         </ExecutionAction>\n      </PreActions>\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"53124AB725B71AF600771CE4\"\n               BuildableName = \"SwiftUITestHost.app\"\n               BlueprintName = \"SwiftUITestHost\"\n               ReferencedContainer = \"container:Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <Testables>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"53124AD325B71AF700771CE4\"\n               BuildableName = \"SwiftUITests.xctest\"\n               BlueprintName = \"SwiftUITests\"\n               ReferencedContainer = \"container:Realm.xcodeproj\">\n            </BuildableReference>\n         </TestableReference>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <PreActions>\n         <ExecutionAction\n            ActionType = \"Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction\">\n            <ActionContent\n               title = \"Run Script\"\n               scriptText = \"killall Simulator&#10;defaults write com.apple.iphonesimulator ConnectHardwareKeyboard -bool false&#10;\">\n            </ActionContent>\n         </ExecutionAction>\n      </PreActions>\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"53124AB725B71AF600771CE4\"\n            BuildableName = \"SwiftUITestHost.app\"\n            BlueprintName = \"SwiftUITestHost\"\n            ReferencedContainer = \"container:Realm.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"53124AB725B71AF600771CE4\"\n            BuildableName = \"SwiftUITestHost.app\"\n            BlueprintName = \"SwiftUITestHost\"\n            ReferencedContainer = \"container:Realm.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "Realm.xcodeproj/xcshareddata/xcschemes/SwiftUITests.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1330\"\n   version = \"1.7\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <PreActions>\n         <ExecutionAction\n            ActionType = \"Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction\">\n            <ActionContent\n               title = \"Run Script\"\n               scriptText = \"cd &quot;${PROJECT_DIR}&quot;&#10;sh build.sh download-core&#10;\">\n               <EnvironmentBuildable>\n                  <BuildableReference\n                     BuildableIdentifier = \"primary\"\n                     BlueprintIdentifier = \"53124AD325B71AF700771CE4\"\n                     BuildableName = \"SwiftUITests.xctest\"\n                     BlueprintName = \"SwiftUITests\"\n                     ReferencedContainer = \"container:Realm.xcodeproj\">\n                  </BuildableReference>\n               </EnvironmentBuildable>\n            </ActionContent>\n         </ExecutionAction>\n      </PreActions>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <Testables>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"53124AD325B71AF700771CE4\"\n               BuildableName = \"SwiftUITests.xctest\"\n               BlueprintName = \"SwiftUITests\"\n               ReferencedContainer = \"container:Realm.xcodeproj\">\n            </BuildableReference>\n         </TestableReference>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"53124AB725B71AF600771CE4\"\n            BuildableName = \"SwiftUITestHost.app\"\n            BlueprintName = \"SwiftUITestHost\"\n            ReferencedContainer = \"container:Realm.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n      <EnvironmentVariables>\n         <EnvironmentVariable\n            key = \"REALM_DISABLE_UPDATE_CHECKER\"\n            value = \"1\"\n            isEnabled = \"YES\">\n         </EnvironmentVariable>\n         <EnvironmentVariable\n            key = \"REALM_DISABLE_ANALYTICS\"\n            value = \"1\"\n            isEnabled = \"YES\">\n         </EnvironmentVariable>\n      </EnvironmentVariables>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"53124AB725B71AF600771CE4\"\n            BuildableName = \"SwiftUITestHost.app\"\n            BlueprintName = \"SwiftUITestHost\"\n            ReferencedContainer = \"container:Realm.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "Realm.xcodeproj/xcshareddata/xcschemes/TestHost.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"NO\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"3F1A5E711992EB7400F45F4C\"\n               BuildableName = \"TestHost.app\"\n               BlueprintName = \"TestHost\"\n               ReferencedContainer = \"container:Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"3F1A5E711992EB7400F45F4C\"\n            BuildableName = \"TestHost.app\"\n            BlueprintName = \"TestHost\"\n            ReferencedContainer = \"container:Realm.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E8D89BA21955FC6D00CF2B9A\"\n               BuildableName = \"Tests.xctest\"\n               BlueprintName = \"Tests\"\n               ReferencedContainer = \"container:Realm.xcodeproj\">\n            </BuildableReference>\n         </TestableReference>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5D660FD71BE98C7C0021E04F\"\n               BuildableName = \"RealmSwift Tests.xctest\"\n               BlueprintName = \"RealmSwift Tests\"\n               ReferencedContainer = \"container:Realm.xcodeproj\">\n            </BuildableReference>\n         </TestableReference>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"3F1A5E711992EB7400F45F4C\"\n            BuildableName = \"TestHost.app\"\n            BlueprintName = \"TestHost\"\n            ReferencedContainer = \"container:Realm.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"3F1A5E711992EB7400F45F4C\"\n            BuildableName = \"TestHost.app\"\n            BlueprintName = \"TestHost\"\n            ReferencedContainer = \"container:Realm.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "RealmSwift/Aliases.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm.Swift\n\n// These types don't change when wrapping in Swift\n// so we just typealias them to remove the 'RLM' prefix\n\n// MARK: Aliases\n\n/**\n `PropertyType` is an enum describing all property types supported in Realm models.\n\n For more information, see [Object Models and Schemas](https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/model-data/object-models/).\n\n ### Primitive types\n\n * `Int`\n * `Bool`\n * `Float`\n * `Double`\n\n ### Object types\n\n * `String`\n * `Data`\n * `Date`\n * `Decimal128`\n * `ObjectId`\n\n ### Relationships: Array (in Swift, `List`) and `Object` types\n\n * `Object`\n * `Array`\n*/\npublic typealias PropertyType = RLMPropertyType\n\n/**\n An opaque token which is returned from methods which subscribe to changes to a Realm.\n\n - see: `Realm.observe(_:)`\n */\npublic typealias NotificationToken = RLMNotificationToken\n\n/// :nodoc:\npublic typealias ObjectBase = RLMObjectBase\nextension ObjectBase {\n    internal func _observe<T: ObjectBase>(keyPaths: [String]? = nil,\n                                          on queue: DispatchQueue? = nil,\n                                          _ block: @escaping (ObjectChange<T>) -> Void) -> NotificationToken {\n        return RLMObjectBaseAddNotificationBlock(self, keyPaths, queue) { object, names, oldValues, newValues, error in\n            assert(error == nil)\n            block(.init(object: object as? T, names: names, oldValues: oldValues, newValues: newValues))\n        }\n    }\n\n    internal func _observe<T: ObjectBase>(keyPaths: [String]? = nil,\n                                          on queue: DispatchQueue? = nil,\n                                          _ block: @escaping (T?) -> Void) -> NotificationToken {\n        return RLMObjectBaseAddNotificationBlock(self, keyPaths, queue) { object, _, _, _, _ in\n            block(object as? T)\n        }\n    }\n\n    internal func _observe(keyPaths: [String]? = nil,\n                           on queue: DispatchQueue? = nil,\n                           _ block: @escaping () -> Void) -> NotificationToken {\n        return RLMObjectBaseAddNotificationBlock(self, keyPaths, queue) { _, _, _, _, _ in\n            block()\n        }\n    }\n\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    internal func _observe<A: Actor, T: ObjectBase>(\n        keyPaths: [String]? = nil, on actor: isolated A,\n        _ block: @Sendable @escaping (isolated A, ObjectChange<T>) -> Void\n    ) async -> NotificationToken {\n        let token = RLMObjectNotificationToken()\n        token.observe(self, keyPaths: keyPaths) { object, names, oldValues, newValues, error in\n            assert(error == nil)\n            actor.invokeIsolated(block, .init(object: object as? T, names: names,\n                        oldValues: oldValues, newValues: newValues))\n        }\n        await withTaskCancellationHandler(operation: token.registrationComplete,\n                                          onCancel: { token.invalidate() })\n        return token\n    }\n}\n"
  },
  {
    "path": "RealmSwift/AnyRealmValue.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n\nimport Foundation\nimport Realm\n\n/// A enum for storing and retrieving values associated with an `AnyRealmValue` property.\n/// `AnyRealmValue` can also store a collection (List, Dictionary) of `AnyRealmValue`, meaning that you can have\n/// nested collections inside a `AnyRealmValue`.\npublic enum AnyRealmValue: Hashable {\n    /// Represents `nil`\n    case none\n    /// An integer type.\n    case int(Int)\n    /// A boolean type.\n    case bool(Bool)\n    /// A floating point numeric type.\n    case float(Float)\n    /// A double numeric type.\n    case double(Double)\n    /// A string type.\n    case string(String)\n    /// A binary data type.\n    case data(Data)\n    /// A date type.\n    case date(Date)\n    /// A Realm Object type.\n    case object(Object)\n    /// An ObjectId type.\n    case objectId(ObjectId)\n    /// A Decimal128 type.\n    case decimal128(Decimal128)\n    /// A UUID type.\n    case uuid(UUID)\n    /// Dictionary type.\n    case dictionary(Map<String, AnyRealmValue>)\n    /// List type.\n    case list(List<AnyRealmValue>)\n\n    /// Returns an `Int` if that is what the stored value is, otherwise `nil`.\n    public var intValue: Int? {\n        guard case let .int(i) = self else {\n            return nil\n        }\n        return i\n    }\n\n    /// Returns a `Bool` if that is what the stored value is, otherwise `nil`.\n    public var boolValue: Bool? {\n        guard case let .bool(b) = self else {\n            return nil\n        }\n        return b\n    }\n\n    /// Returns a `Float` if that is what the stored value is, otherwise `nil`.\n    public var floatValue: Float? {\n        guard case let .float(f) = self else {\n            return nil\n        }\n        return f\n    }\n\n    /// Returns a `Double` if that is what the stored value is, otherwise `nil`.\n    public var doubleValue: Double? {\n        guard case let .double(d) = self else {\n            return nil\n        }\n        return d\n    }\n\n    /// Returns a `String` if that is what the stored value is, otherwise `nil`.\n    public var stringValue: String? {\n        guard case let .string(s) = self else {\n            return nil\n        }\n        return s\n    }\n\n    /// Returns `Data` if that is what the stored value is, otherwise `nil`.\n    public var dataValue: Data? {\n        guard case let .data(d) = self else {\n            return nil\n        }\n        return d\n    }\n\n    /// Returns a `Date` if that is what the stored value is, otherwise `nil`.\n    public var dateValue: Date? {\n        guard case let .date(d) = self else {\n            return nil\n        }\n        return d\n    }\n\n    /// Returns an `ObjectId` if that is what the stored value is, otherwise `nil`.\n    public var objectIdValue: ObjectId? {\n        guard case let .objectId(o) = self else {\n            return nil\n        }\n        return o\n    }\n\n    /// Returns a `Decimal128` if that is what the stored value is, otherwise `nil`.\n    public var decimal128Value: Decimal128? {\n        guard case let .decimal128(d) = self else {\n            return nil\n        }\n        return d\n    }\n\n    /// Returns a `UUID` if that is what the stored value is, otherwise `nil`.\n    public var uuidValue: UUID? {\n        guard case let .uuid(u) = self else {\n            return nil\n        }\n        return u\n    }\n\n    /// Returns the stored value as a Realm Object of a specific type.\n    ///\n    /// - Parameter objectType: The type of the Object to return.\n    /// - Returns: A Realm Object of the supplied type if that is what the underlying value is,\n    /// otherwise `nil` is returned.\n    public func object<T: Object>(_ objectType: T.Type) -> T? {\n        guard case let .object(o) = self else {\n            return nil\n        }\n        return o as? T\n    }\n\n    /// Returns a `Map<String, AnyRealmValue>` if that is what the stored value is, otherwise `nil`.\n    public var dictionaryValue: Map<String, AnyRealmValue>? {\n        guard case let .dictionary(d) = self else {\n            return nil\n        }\n        return d\n    }\n\n    /// Returns a `List<AnyRealmValue>` if that is what the stored value is, otherwise `nil`.\n    public var listValue: List<AnyRealmValue>? {\n        guard case let .list(l) = self else {\n            return nil\n        }\n        return l\n    }\n\n    /// Returns a `DynamicObject` if the stored value is an `Object`, otherwise `nil`.\n    ///\n    /// Note: This allows access to an object stored in `AnyRealmValue` where you may not have\n    /// the class information associated for it. For example if you are using Realm Sync and version 2\n    /// of your app sets an object into `AnyRealmValue` and that class does not exist in version 1\n    /// use this accessor to gain access to the object in the Realm.\n    public var dynamicObject: DynamicObject? {\n        guard case let .object(o) = self else {\n            return nil\n        }\n        return unsafeBitCast(o, to: DynamicObject?.self)\n    }\n\n    /// Required for conformance to `AddableType`\n    public init() {\n        self = .none\n    }\n\n    /// Returns a `AnyRealmValue` storing a `Map`.\n    ///\n    /// - Parameter dictionary: A Swift's dictionary of `AnyRealmValue` values.\n    /// - Returns: Returns an `AnyRealmValue` storing a `Map`.\n    public static func fromDictionary(_ dictionary: Dictionary<String, AnyRealmValue>) -> AnyRealmValue {\n        let map = Map<String, AnyRealmValue>()\n        map.merge(dictionary, uniquingKeysWith: { $1 })\n        return AnyRealmValue.dictionary(map)\n    }\n\n    /// Returns a `AnyRealmValue` storing a `List`.\n    ///\n    /// - Parameter array: A Swift's array of `AnyRealmValue`.\n    /// - Returns: Returns a `AnyRealmValue` storing a `List`.\n    public static func fromArray(_ array: Array<AnyRealmValue>) -> AnyRealmValue {\n        let list = List<AnyRealmValue>()\n        list.append(objectsIn: array)\n        return AnyRealmValue.list(list)\n    }\n\n    // MARK: - Hashable\n\n    public func hash(into hasher: inout Hasher) {\n        switch self {\n        case let .int(i):\n            hasher.combine(i)\n        case let .bool(b):\n            hasher.combine(b)\n        case let .float(f):\n            hasher.combine(f)\n        case let .double(d):\n            hasher.combine(d)\n        case let .string(s):\n            hasher.combine(s)\n        case let .data(d):\n            hasher.combine(d)\n        case let .date(d):\n            hasher.combine(d)\n        case let .objectId(o):\n            hasher.combine(o)\n        case let .decimal128(d):\n            hasher.combine(d)\n        case let .uuid(u):\n            hasher.combine(u)\n        case let .object(o):\n            hasher.combine(o)\n        case .dictionary:\n            hasher.combine(12)\n        case .list:\n            hasher.combine(13)\n        case .none:\n            hasher.combine(14)\n        }\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Combine.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Combine\nimport Realm\nimport Realm.Private\n\n// MARK: - Identifiable\n\n/// A protocol which defines a default identity for Realm Objects\n///\n/// Declaring your Object subclass as conforming to this protocol will supply\n/// a default implementation for `Identifiable`'s `id` which works for Realm\n/// Objects:\n///\n///     // Automatically conforms to `Identifiable`\n///     class MyObjectType: Object, ObjectKeyIdentifiable {\n///         // ...\n///     }\n///\n/// You can also manually conform to `Identifiable` if you wish, but note that\n/// using the object's memory address does *not* work for managed objects.\n@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)\npublic protocol ObjectKeyIdentifiable: Identifiable {\n    /// The stable identity of the entity associated with `self`.\n    var id: UInt64 { get }\n}\n\n/// :nodoc:\n@available(*, deprecated, renamed: \"ObjectKeyIdentifiable\")\n@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)\npublic typealias ObjectKeyIdentifable = ObjectKeyIdentifiable\n\n@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)\nextension ObjectKeyIdentifiable where Self: ObjectBase {\n    /// A stable identifier for this object. For managed Realm objects, this\n    /// value will be the same for all object instances which refer to the same\n    /// object (i.e. for which `Object.isSameObject(as:)` returns true).\n    public var id: UInt64 {\n        RLMObjectBaseGetCombineId(self)\n    }\n}\n\n/// :nodoc:\n@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)\nextension ObjectKeyIdentifiable where Self: ProjectionObservable {\n    /// A stable identifier for this projection.\n    public var id: UInt64 {\n        RLMObjectBaseGetCombineId(rootObject)\n    }\n}\n\n// MARK: - Combine\n\n/// A type which can be passed to `valuePublisher()` or `changesetPublisher()`.\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\npublic protocol RealmSubscribable {\n    /// :nodoc:\n    func _observe<S>(_ keyPaths: [String]?, on queue: DispatchQueue?, _ subscriber: S)\n        -> NotificationToken where S: Subscriber, S.Input == Self\n    /// :nodoc:\n    func _observe<S>(_ keyPaths: [String]?, _ subscriber: S)\n        -> NotificationToken where S: Subscriber, S.Input == Void\n}\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension Publisher {\n    /// Freezes all Realm objects and collections emitted by the upstream publisher\n    ///\n    /// Freezing a Realm object makes it no longer live-update when writes are\n    /// made to the Realm and makes it safe to pass freely between threads\n    /// without using `.threadSafeReference()`.\n    ///\n    /// ```\n    /// // Get a publisher for a Results\n    /// let cancellable = myResults.publisher\n    ///    // Convert to frozen Results\n    ///    .freeze()\n    ///    // Unlike live objects, frozen objects can be sent to a concurrent queue\n    ///    .receive(on: DispatchQueue.global())\n    ///    .sink { frozenResults in\n    ///        // Do something with the frozen Results\n    ///    }\n    /// ```\n    ///\n    /// - returns: A publisher that publishes frozen copies of the objects which the upstream publisher publishes.\n    public func freeze<T>() -> Publishers.Map<Self, T> where Output: ThreadConfined, T == Output {\n        return map { $0.freeze() }\n    }\n\n    /// Freezes all Realm object changesets emitted by the upstream publisher.\n    ///\n    /// Freezing a Realm object changeset makes the included object reference\n    /// no longer live-update when writes are made to the Realm and makes it\n    /// safe to pass freely between threads without using\n    /// `.threadSafeReference()`. It also guarantees that the frozen object\n    /// contained in the changeset will always match the property changes, which\n    /// is not always the case when using thread-safe references.\n    ///\n    /// ```\n    /// // Get a changeset publisher for an object\n    /// let cancellable = changesetPublisher(object)\n    ///    // Convert to frozen changesets\n    ///    .freeze()\n    ///    // Unlike live objects, frozen objects can be sent to a concurrent queue\n    ///    .receive(on: DispatchQueue.global())\n    ///    .sink { changeset in\n    ///        // Do something with the frozen changeset\n    ///    }\n    /// ```\n    ///\n    /// - returns: A publisher that publishes frozen copies of the changesets\n    ///            which the upstream publisher publishes.\n    public func freeze<T: Object>() -> Publishers.Map<Self, ObjectChange<T>> where Output == ObjectChange<T> {\n        return map {\n            if case .change(let object, let properties) = $0 {\n                return .change(object.freeze(), properties)\n            }\n            return $0\n        }\n    }\n\n    /// Freezes all Realm collection changesets from the upstream publisher.\n    ///\n    /// Freezing a Realm collection changeset makes the included collection\n    /// reference no longer live-update when writes are made to the Realm and\n    /// makes it safe to pass freely between threads without using\n    /// `.threadSafeReference()`. It also guarantees that the frozen collection\n    /// contained in the changeset will always match the change information,\n    /// which is not always the case when using thread-safe references.\n    ///\n    /// ```\n    /// // Get a changeset publisher for a collection\n    /// let cancellable = myList.changesetPublisher\n    ///    // Convert to frozen changesets\n    ///    .freeze()\n    ///    // Unlike live objects, frozen objects can be sent to a concurrent queue\n    ///    .receive(on: DispatchQueue.global())\n    ///    .sink { changeset in\n    ///        // Do something with the frozen changeset\n    ///    }\n    /// ```\n    ///\n    /// - returns: A publisher that publishes frozen copies of the changesets\n    ///            which the upstream publisher publishes.\n    public func freeze<T: RealmCollection>()\n        -> Publishers.Map<Self, RealmCollectionChange<T>> where Output == RealmCollectionChange<T> {\n            return map {\n                switch $0 {\n                case .initial(let collection):\n                    return .initial(collection.freeze())\n                case .update(let collection, deletions: let deletions, insertions: let insertions, modifications: let modifications):\n                    return .update(collection.freeze(), deletions: deletions, insertions: insertions, modifications: modifications)\n                case .error(let error):\n                    return .error(error)\n                }\n            }\n    }\n\n    /// Freezes all Realm sectioned results changesets from the upstream publisher.\n    ///\n    /// Freezing a Realm sectioned results changeset makes the included  sectioned results\n    /// reference no longer live-update when writes are made to the Realm and\n    /// makes it safe to pass freely between threads without using\n    /// `.threadSafeReference()`. It also guarantees that the frozen sectioned results\n    /// contained in the changeset will always match the change information,\n    /// which is not always the case when using thread-safe references.\n    ///\n    /// ```\n    /// // Get a changeset publisher for the sectioned results\n    /// let cancellable = mySectionedResults.changesetPublisher\n    ///    // Convert to frozen changesets\n    ///    .freeze()\n    ///    // Unlike live objects, frozen objects can be sent to a concurrent queue\n    ///    .receive(on: DispatchQueue.global())\n    ///    .sink { changeset in\n    ///        // Do something with the frozen changeset\n    ///    }\n    /// ```\n    ///\n    /// - returns: A publisher that publishes frozen copies of the changesets\n    ///            which the upstream publisher publishes.\n    public func freeze<T: RealmSectionedResult>()\n        -> Publishers.Map<Self, SectionedResultsChange<T>> where Output == SectionedResultsChange<T> {\n            return map {\n                switch $0 {\n                case .initial(let collection):\n                    return .initial(collection.freeze())\n                case .update(let collection, deletions: let deletions, insertions: let insertions, modifications: let modifications,\n                             sectionsToInsert: let sectionsToInsert, sectionsToDelete: let sectionsToDelete):\n                    return .update(collection.freeze(), deletions: deletions, insertions: insertions, modifications: modifications,\n                                   sectionsToInsert: sectionsToInsert, sectionsToDelete: sectionsToDelete)\n                }\n            }\n    }\n\n    /// Freezes all Realm collection changesets from the upstream publisher.\n    ///\n    /// Freezing a Realm collection changeset makes the included collection\n    /// reference no longer live-update when writes are made to the Realm and\n    /// makes it safe to pass freely between threads without using\n    /// `.threadSafeReference()`. It also guarantees that the frozen collection\n    /// contained in the changeset will always match the change information,\n    /// which is not always the case when using thread-safe references.\n    ///\n    /// ```\n    /// // Get a changeset publisher for a collection\n    /// let cancellable = myMap.changesetPublisher\n    ///    // Convert to frozen changesets\n    ///    .freeze()\n    ///    // Unlike live objects, frozen objects can be sent to a concurrent queue\n    ///    .receive(on: DispatchQueue.global())\n    ///    .sink { changeset in\n    ///        // Do something with the frozen changeset\n    ///    }\n    /// ```\n    ///\n    /// - returns: A publisher that publishes frozen copies of the changesets\n    ///            which the upstream publisher publishes.\n    public func freeze<T: RealmKeyedCollection>()\n        -> Publishers.Map<Self, RealmMapChange<T>> where Output == RealmMapChange<T> {\n            return map {\n                switch $0 {\n                case .initial(let collection):\n                    return .initial(collection.freeze())\n                case .update(let collection, deletions: let deletions, insertions: let insertions, modifications: let modifications):\n                    return .update(collection.freeze(), deletions: deletions, insertions: insertions, modifications: modifications)\n                case .error(let error):\n                    return .error(error)\n                }\n            }\n    }\n\n    /// Freezes all Realm projection changesets emitted by the upstream publisher.\n    ///\n    /// Freezing a Realm projection changeset makes the included projection reference\n    /// no longer live-update when writes are made to the Realm and makes it\n    /// safe to pass freely between threads without using\n    /// `.threadSafeReference()`. It also guarantees that the frozen projection\n    /// contained in the changeset will always match the property changes, which\n    /// is not always the case when using thread-safe references.\n    ///\n    /// ```\n    /// // Get a changeset publisher for an projection\n    /// let cancellable = changesetPublisher(projection)\n    ///    // Convert to frozen changesets\n    ///    .freeze()\n    ///    // Unlike live projections, frozen projections can be sent to a concurrent queue\n    ///    .receive(on: DispatchQueue.global())\n    ///    .sink { changeset in\n    ///        // Do something with the frozen changeset\n    ///    }\n    /// ```\n    ///\n    /// - returns: A publisher that publishes frozen copies of the changesets\n    ///            which the upstream publisher publishes.\n    public func freeze<T: ProjectionObservable>()\n    -> Publishers.Map<Self, ObjectChange<T>> where Output == ObjectChange<T>, T: ThreadConfined {\n        return map {\n            if case .change(let projection, let properties) = $0 {\n                return .change(projection.freeze(), properties)\n            }\n            return $0\n        }\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension Publisher where Output: ThreadConfined {\n    /// Enables passing thread-confined objects to a different dispatch queue.\n    ///\n    /// Each call to `receive(on:)` on a publisher which emits Realm\n    /// thread-confined objects must be proceeded by a call to\n    /// `.threadSafeReference()`.The returned publisher handles the required\n    /// logic to pass the thread-confined object to the new queue. Only serial\n    /// dispatch queues are supported and using other schedulers will result in\n    /// a fatal error.\n    ///\n    /// For example, to subscribe on a background thread, do some work there,\n    /// then pass the object to the main thread you can do:\n    ///\n    ///     let cancellable = publisher(myObject)\n    ///         .subscribe(on: DispatchQueue(label: \"background queue\")\n    ///         .print()\n    ///         .threadSafeReference()\n    ///         .receive(on: DispatchQueue.main)\n    ///         .sink { object in\n    ///             // Do things with the object on the main thread\n    ///         }\n    ///\n    /// Calling this function on a publisher which emits frozen or unmanaged\n    /// objects is unneccesary but is allowed.\n    ///\n    /// - returns: A publisher that supports `receive(on:)` for thread-confined objects.\n    public func threadSafeReference() -> RealmPublishers.MakeThreadSafe<Self> {\n        RealmPublishers.MakeThreadSafe(self)\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension Publisher {\n    /// Enables passing object changesets to a different dispatch queue.\n    ///\n    /// Each call to `receive(on:)` on a publisher which emits Realm\n    /// thread-confined objects must be proceeded by a call to\n    /// `.threadSafeReference()`. The returned publisher handles the required\n    /// logic to pass the thread-confined object to the new queue. Only serial\n    /// dispatch queues are supported and using other schedulers will result in\n    /// a fatal error.\n    ///\n    /// For example, to subscribe on a background thread, do some work there,\n    /// then pass the object changeset to the main thread you can do:\n    ///\n    ///     let cancellable = changesetPublisher(myObject)\n    ///         .subscribe(on: DispatchQueue(label: \"background queue\")\n    ///         .print()\n    ///         .threadSafeReference()\n    ///         .receive(on: DispatchQueue.main)\n    ///         .sink { objectChange in\n    ///             // Do things with the object on the main thread\n    ///         }\n    ///\n    /// - returns: A publisher that supports `receive(on:)` for thread-confined objects.\n    public func threadSafeReference<T: Object>()\n        -> RealmPublishers.MakeThreadSafeObjectChangeset<Self, T> where Output == ObjectChange<T> {\n        RealmPublishers.MakeThreadSafeObjectChangeset(self)\n    }\n\n    /// Enables passing projection changesets to a different dispatch queue.\n    ///\n    /// Each call to `receive(on:)` on a publisher which emits Realm\n    /// thread-confined projection must be proceeded by a call to\n    /// `.threadSafeReference()`. The returned publisher handles the required\n    /// logic to pass the thread-confined projection to the new queue. Only serial\n    /// dispatch queues are supported and using other schedulers will result in\n    /// a fatal error.\n    ///\n    /// For example, to subscribe on a background thread, do some work there,\n    /// then pass the projection changeset to the main thread you can do:\n    ///\n    ///     let cancellable = changesetPublisher(myProjection)\n    ///         .subscribe(on: DispatchQueue(label: \"background queue\")\n    ///         .print()\n    ///         .threadSafeReference()\n    ///         .receive(on: DispatchQueue.main)\n    ///         .sink { projectionChange in\n    ///             // Do things with the projection on the main thread\n    ///         }\n    ///\n    /// - returns: A publisher that supports `receive(on:)` for thread-confined objects.\n    public func threadSafeReference<T: ProjectionObservable>()\n    -> RealmPublishers.MakeThreadSafeObjectChangeset<Self, T> where Output == ObjectChange<T>, T: ThreadConfined {\n        RealmPublishers.MakeThreadSafeObjectChangeset(self)\n    }\n\n    /// Enables passing Realm collection changesets to a different dispatch queue.\n    ///\n    /// Each call to `receive(on:)` on a publisher which emits Realm\n    /// thread-confined objects must be proceeded by a call to\n    /// `.threadSafeReference()`. The returned publisher handles the required\n    /// logic to pass the thread-confined object to the new queue. Only serial\n    /// dispatch queues are supported and using other schedulers will result in\n    /// a fatal error.\n    ///\n    /// For example, to subscribe on a background thread, do some work there,\n    /// then pass the collection changeset to the main thread you can do:\n    ///\n    ///     let cancellable = myCollection.changesetPublisher\n    ///         .subscribe(on: DispatchQueue(label: \"background queue\")\n    ///         .print()\n    ///         .threadSafeReference()\n    ///         .receive(on: DispatchQueue.main)\n    ///         .sink { collectionChange in\n    ///             // Do things with the collection on the main thread\n    ///         }\n    ///\n    /// - returns: A publisher that supports `receive(on:)` for thread-confined objects.\n    public func threadSafeReference<T: RealmCollection>()\n        -> RealmPublishers.MakeThreadSafeCollectionChangeset<Self, T> where Output == RealmCollectionChange<T> {\n        RealmPublishers.MakeThreadSafeCollectionChangeset(self)\n    }\n\n    /// Enables passing Realm collection changesets to a different dispatch queue.\n    ///\n    /// Each call to `receive(on:)` on a publisher which emits Realm\n    /// thread-confined objects must be proceeded by a call to\n    /// `.threadSafeReference()`. The returned publisher handles the required\n    /// logic to pass the thread-confined object to the new queue. Only serial\n    /// dispatch queues are supported and using other schedulers will result in\n    /// a fatal error.\n    ///\n    /// For example, to subscribe on a background thread, do some work there,\n    /// then pass the collection changeset to the main thread you can do:\n    ///\n    ///     let cancellable = myCollection.changesetPublisher\n    ///         .subscribe(on: DispatchQueue(label: \"background queue\")\n    ///         .print()\n    ///         .threadSafeReference()\n    ///         .receive(on: DispatchQueue.main)\n    ///         .sink { collectionChange in\n    ///             // Do things with the collection on the main thread\n    ///         }\n    ///\n    /// - returns: A publisher that supports `receive(on:)` for thread-confined objects.\n    public func threadSafeReference<T: RealmKeyedCollection>()\n        -> RealmPublishers.MakeThreadSafeKeyedCollectionChangeset<Self, T> where Output == RealmMapChange<T> {\n        RealmPublishers.MakeThreadSafeKeyedCollectionChangeset(self)\n    }\n\n    /// Enables passing Realm sectioned results changesets to a different dispatch queue.\n    ///\n    /// Each call to `receive(on:)` on a publisher which emits Realm\n    /// thread-confined objects must be proceeded by a call to\n    /// `.threadSafeReference()`. The returned publisher handles the required\n    /// logic to pass the thread-confined object to the new queue. Only serial\n    /// dispatch queues are supported and using other schedulers will result in\n    /// a fatal error.\n    ///\n    /// For example, to subscribe on a background thread, do some work there,\n    /// then pass the collection changeset to the main thread you can do:\n    ///\n    ///     let cancellable = mySectionedResults.changesetPublisher\n    ///         .subscribe(on: DispatchQueue(label: \"background queue\")\n    ///         .print()\n    ///         .threadSafeReference()\n    ///         .receive(on: DispatchQueue.main)\n    ///         .sink { sectionedResultsChange in\n    ///             // Do things with the sectioned results on the main thread\n    ///         }\n    ///\n    /// - returns: A publisher that supports `receive(on:)` for thread-confined objects.\n    public func threadSafeReference<T: RealmSectionedResult>()\n        -> RealmPublishers.MakeThreadSafeSectionedResultsChangeset<Self, T> where Output == SectionedResultsChange<T> {\n        RealmPublishers.MakeThreadSafeSectionedResultsChangeset(self)\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension RealmCollection where Self: RealmSubscribable {\n    /// A publisher that emits Void each time the collection changes.\n    ///\n    /// Despite the name, this actually emits *after* the collection has changed.\n    public var objectWillChange: RealmPublishers.WillChange<Self> {\n        RealmPublishers.WillChange(self)\n    }\n\n    /// :nodoc:\n    @available(*, deprecated, renamed: \"collectionPublisher\")\n    public var publisher: RealmPublishers.Value<Self> {\n        RealmPublishers.Value(self)\n    }\n\n    /// A publisher that emits the collection each time the collection changes.\n    public var collectionPublisher: RealmPublishers.Value<Self> {\n        RealmPublishers.Value(self)\n    }\n\n    /// A publisher that emits the collection each time the collection changes on the given property keyPaths.\n    public func collectionPublisher(keyPaths: [String]?) -> RealmPublishers.Value<Self> {\n        return RealmPublishers.Value(self, keyPaths: keyPaths)\n    }\n\n    /// A publisher that emits a collection changeset each time the collection changes.\n    public var changesetPublisher: RealmPublishers.CollectionChangeset<Self> {\n        RealmPublishers.CollectionChangeset(self)\n    }\n\n    /// A publisher that emits a collection changeset each time the collection changes on the given property keyPaths.\n    public func changesetPublisher(keyPaths: [String]?) -> RealmPublishers.CollectionChangeset<Self> {\n        return RealmPublishers.CollectionChangeset(self, keyPaths: keyPaths)\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension RealmKeyedCollection where Self: RealmSubscribable {\n    /// A publisher that emits Void each time the collection changes.\n    ///\n    /// Despite the name, this actually emits *after* the collection has changed.\n    public var objectWillChange: RealmPublishers.WillChange<Self> {\n        RealmPublishers.WillChange(self)\n    }\n\n    /// :nodoc:\n    @available(*, deprecated, renamed: \"collectionPublisher\")\n    public var publisher: RealmPublishers.Value<Self> {\n        RealmPublishers.Value(self)\n    }\n\n    /// A publisher that emits the collection each time the collection changes.\n    public var collectionPublisher: RealmPublishers.Value<Self> {\n        RealmPublishers.Value(self)\n    }\n\n    /// A publisher that emits the collection each time the collection changes on the given property keyPaths.\n    public func collectionPublisher(keyPaths: [String]?) -> RealmPublishers.Value<Self> {\n        return RealmPublishers.Value(self, keyPaths: keyPaths)\n    }\n\n    /// A publisher that emits a collection changeset each time the collection changes.\n    public var changesetPublisher: RealmPublishers.MapChangeset<Self> {\n        RealmPublishers.MapChangeset(self)\n    }\n\n    /// A publisher that emits a collection changeset each time the collection changes on the given property keyPaths.\n    public func changesetPublisher(keyPaths: [String]?) -> RealmPublishers.MapChangeset<Self> {\n        return RealmPublishers.MapChangeset(self, keyPaths: keyPaths)\n    }\n}\n\n/// Creates a publisher that emits the object each time the object changes.\n///\n/// - precondition: The object must be a managed object which has not been invalidated.\n/// - parameter object: A managed object to observe.\n/// - parameter keyPaths: The publisher emits changes on these property keyPaths. If `nil` the publisher emits changes for every property.\n/// - returns: A publisher that emits the object each time it changes.\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\npublic func valuePublisher<T: Object>(_ object: T, keyPaths: [String]? = nil) -> RealmPublishers.Value<T> {\n    RealmPublishers.Value<T>(object, keyPaths: keyPaths)\n}\n\n/// Creates a publisher that emits the collection each time the collection changes.\n///\n/// - precondition: The collection must be a managed collection which has not been invalidated.\n/// - parameter object: A managed collection to observe.\n/// - parameter keyPaths: The publisher emits changes on these property keyPaths. If `nil` the publisher emits changes for every property.\n/// - returns: A publisher that emits the collection each time it changes.\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\npublic func valuePublisher<T: RealmCollection>(_ collection: T, keyPaths: [String]? = nil) -> RealmPublishers.Value<T> {\n    RealmPublishers.Value<T>(collection, keyPaths: keyPaths)\n}\n\n/// Creates a publisher that emits the object each time the object changes.\n///\n/// - precondition: The object must be a managed object which has not been invalidated.\n/// - parameter object: A managed object to observe.\n/// - parameter keyPaths: The publisher emits changes on these property keyPaths. If `nil` the publisher emits changes for every property.\n/// - returns: A publisher that emits the object each time it changes.\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\npublic func valuePublisher<T: ProjectionObservable>(_ projection: T, keyPaths: [String]? = nil) -> RealmPublishers.Value<T> {\n    RealmPublishers.Value<T>(projection, keyPaths: keyPaths)\n}\n\n/// Creates a publisher that emits an object changeset each time the object changes.\n///\n/// - precondition: The object must be a managed object which has not been invalidated.\n/// - parameter object: A managed object to observe.\n/// - parameter keyPaths: The publisher emits changes on these property keyPaths. If `nil` the publisher emits changes for every property.\n/// - returns: A publisher that emits an object changeset each time the object changes.\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\npublic func changesetPublisher<T: Object>(_ object: T, keyPaths: [String]? = nil) -> RealmPublishers.ObjectChangeset<T> {\n    precondition(object.realm != nil, \"Only managed objects can be published\")\n    precondition(!object.isInvalidated, \"Object is invalidated or deleted\")\n    return RealmPublishers.ObjectChangeset<T> { queue, fn in\n        object.observe(keyPaths: keyPaths, on: queue, fn)\n    }\n}\n\n\n/// Creates a publisher that emits an object changeset each time the object changes.\n///\n/// - precondition: The object must be a projection.\n/// - parameter projection: A projection of Realm Object to observe.\n/// - parameter keyPaths: The publisher emits changes on these property keyPaths. If `nil` the publisher emits changes for every property.\n/// - returns: A publisher that emits an object changeset each time the projection changes.\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\npublic func changesetPublisher<T: ProjectionObservable>(_ projection: T, keyPaths: [String]? = nil) -> RealmPublishers.ObjectChangeset<T> {\n    precondition(projection.realm != nil, \"Only managed objects can be published\")\n    precondition(!projection.isInvalidated, \"Object is invalidated or deleted\")\n    return RealmPublishers.ObjectChangeset<T> { queue, fn in\n        projection.observe(keyPaths: keyPaths ?? [], on: queue, fn)\n    }\n}\n\n/// Creates a publisher that emits a collection changeset each time the collection changes.\n///\n/// - precondition: The collection must be a managed collection which has not been invalidated.\n/// - parameter object: A managed collection to observe.\n/// - parameter keyPaths: The publisher emits changes on these property keyPaths. If `nil` the publisher emits changes for every property.\n/// - returns: A publisher that emits a collection changeset each time the collection changes.\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\npublic func changesetPublisher<T: RealmCollection>(_ collection: T, keyPaths: [String]? = nil) -> RealmPublishers.CollectionChangeset<T> {\n    RealmPublishers.CollectionChangeset<T>(collection, keyPaths: keyPaths)\n}\n\n// MARK: - Realm\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension Realm {\n    /// A publisher that emits Void each time the object changes.\n    ///\n    /// Despite the name, this actually emits *after* the collection has changed.\n    public var objectWillChange: RealmPublishers.RealmWillChange {\n        return RealmPublishers.RealmWillChange(self)\n    }\n}\n\n// MARK: - Object\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension Object {\n    /// A publisher that emits Void each time the object changes.\n    ///\n    /// Despite the name, this actually emits *after* the object has changed.\n    public var objectWillChange: RealmPublishers.WillChange<Object> {\n        return RealmPublishers.WillChange(self)\n    }\n}\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension EmbeddedObject {\n    /// A publisher that emits Void each time the object changes.\n    ///\n    /// Despite the name, this actually emits *after* the embedded object has changed.\n    public var objectWillChange: RealmPublishers.WillChange<EmbeddedObject> {\n        return RealmPublishers.WillChange(self)\n    }\n}\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension ObjectBase: RealmSubscribable {\n    /// :nodoc:\n    public func _observe<S: Subscriber>(_ keyPaths: [String]?, on queue: DispatchQueue?, _ subscriber: S) -> NotificationToken where S.Input: ObjectBase {\n        return _observe(keyPaths: keyPaths, on: queue) { (object: S.Input?) in\n            if let object = object {\n                _ = subscriber.receive(object)\n            } else {\n                subscriber.receive(completion: .finished)\n            }\n        }\n    }\n    /// :nodoc:\n    public func _observe<S>(_ keyPaths: [String]?, _ subscriber: S) -> NotificationToken where S: Subscriber, S.Input == Void {\n        return _observe(keyPaths: keyPaths, { _ = subscriber.receive() })\n    }\n}\n\n#if compiler(>=6)\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension Object: @retroactive ObservableObject {}\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension EmbeddedObject: @retroactive ObservableObject {}\n#else\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension Object: ObservableObject {}\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension EmbeddedObject: ObservableObject {}\n#endif\n\n// MARK: - List\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension List: ObservableObject, RealmSubscribable {\n    /// A publisher that emits Void each time the collection changes.\n    ///\n    /// Despite the name, this actually emits *after* the collection has changed.\n    public var objectWillChange: RealmPublishers.WillChange<List> {\n        RealmPublishers.WillChange(self)\n    }\n}\n\n// MARK: - MutableSet\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension MutableSet: ObservableObject, RealmSubscribable {\n    /// A publisher that emits Void each time the collection changes.\n    ///\n    /// Despite the name, this actually emits *after* the collection has changed.\n    public var objectWillChange: RealmPublishers.WillChange<MutableSet> {\n        RealmPublishers.WillChange(self)\n    }\n}\n\n// MARK: - Map\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension Map: ObservableObject, RealmSubscribable {\n    /// A publisher that emits Void each time the collection changes.\n    ///\n    /// Despite the name, this actually emits *after* the collection has changed.\n    public var objectWillChange: RealmPublishers.WillChange<Map> {\n        RealmPublishers.WillChange(self)\n    }\n}\n\n// MARK: - LinkingObjects\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension LinkingObjects: RealmSubscribable {\n    /// A publisher that emits Void each time the collection changes.\n    ///\n    /// Despite the name, this actually emits *after* the collection has changed.\n    public var objectWillChange: RealmPublishers.WillChange<LinkingObjects> {\n        RealmPublishers.WillChange(self)\n    }\n}\n\n// MARK: - Results\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension Results: RealmSubscribable {\n    /// A publisher that emits Void each time the collection changes.\n    ///\n    /// Despite the name, this actually emits *after* the collection has changed.\n    public var objectWillChange: RealmPublishers.WillChange<Results> {\n        RealmPublishers.WillChange(self)\n    }\n}\n\n// MARK: - Sectioned Results\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension SectionedResults: RealmSubscribable {\n    /// :nodoc:\n    public func _observe<S>(_ keyPaths: [String]? = nil, on queue: DispatchQueue? = nil, _ subscriber: S)\n        -> NotificationToken where S: Subscriber, S.Input == Self {\n        return observe(keyPaths: keyPaths, on: queue) { change in\n                switch change {\n                case .initial(let collection):\n                    _ = subscriber.receive(collection)\n                case .update(let collection, deletions: _, insertions: _, modifications: _, sectionsToInsert: _, sectionsToDelete: _):\n                    _ = subscriber.receive(collection)\n                }\n            }\n    }\n\n    /// :nodoc:\n    public func _observe<S: Subscriber>(_ keyPaths: [String]? = nil, _ subscriber: S) -> NotificationToken where S.Input == Void {\n        return observe(keyPaths: keyPaths, on: nil) { _ in _ = subscriber.receive() }\n    }\n\n    /// A publisher that emits Void each time the sectioned results collection changes.\n    ///\n    /// Despite the name, this actually emits *after* the sectioned results collection has changed.\n    public var objectWillChange: RealmPublishers.WillChange<SectionedResults> {\n        RealmPublishers.WillChange(self)\n    }\n\n    /// A publisher that emits the sectioned results collection each time the sectioned results collection changes.\n    public var collectionPublisher: RealmPublishers.Value<Self> {\n        RealmPublishers.Value(self)\n    }\n\n    /// A publisher that emits the sectioned results collection each time the sectioned results collection changes on the given property keyPaths.\n    public func collectionPublisher(keyPaths: [String]?) -> RealmPublishers.Value<Self> {\n        return RealmPublishers.Value(self, keyPaths: keyPaths)\n    }\n\n    /// A publisher that emits a sectioned results collection changeset each time the sectioned results collection changes.\n    public var changesetPublisher: RealmPublishers.SectionedResultsChangeset<Self> {\n        RealmPublishers.SectionedResultsChangeset(self)\n    }\n\n    /// A publisher that emits a sectioned results collection changeset each time the sectioned results collection changes on the given property keyPaths.\n    public func changesetPublisher(keyPaths: [String]?) -> RealmPublishers.SectionedResultsChangeset<Self> {\n        return RealmPublishers.SectionedResultsChangeset(self, keyPaths: keyPaths)\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension ResultsSection: RealmSubscribable {\n    /// :nodoc:\n    public func _observe<S>(_ keyPaths: [String]? = nil, on queue: DispatchQueue? = nil, _ subscriber: S)\n    -> NotificationToken where S: Subscriber, S.Input == Self {\n        return observe(keyPaths: keyPaths, on: queue) { change in\n            switch change {\n            case .initial(let collection):\n                _ = subscriber.receive(collection)\n            case .update(let collection, deletions: _, insertions: _, modifications: _, sectionsToInsert: _, sectionsToDelete: _):\n                _ = subscriber.receive(collection)\n            }\n        }\n    }\n\n    /// :nodoc:\n    public func _observe<S: Subscriber>(_ keyPaths: [String]? = nil, _ subscriber: S) -> NotificationToken where S.Input == Void {\n        return observe(keyPaths: keyPaths, on: nil) { _ in _ = subscriber.receive() }\n    }\n\n    /// A publisher that emits Void each time the results section collection changes.\n    ///\n    /// Despite the name, this actually emits *after* the results section collection has changed.\n    public var objectWillChange: RealmPublishers.WillChange<ResultsSection> {\n        RealmPublishers.WillChange(self)\n    }\n\n    /// A publisher that emits the results section collection each time the results section collection changes.\n    public var collectionPublisher: RealmPublishers.Value<Self> {\n        RealmPublishers.Value(self)\n    }\n\n    /// A publisher that emits the results section collection each time the results section collection changes on the given property keyPaths.\n    public func collectionPublisher(keyPaths: [String]?) -> RealmPublishers.Value<Self> {\n        return RealmPublishers.Value(self, keyPaths: keyPaths)\n    }\n\n    /// A publisher that emits a results section collection changeset each time the results section collection changes.\n    public var changesetPublisher: RealmPublishers.SectionChangeset<Self> {\n        RealmPublishers.SectionChangeset(self)\n    }\n\n    /// A publisher that emits a results section collection changeset each time the results section collection changes on the given property keyPaths.\n    public func changesetPublisher(keyPaths: [String]?) -> RealmPublishers.SectionChangeset<Self> {\n        return RealmPublishers.SectionChangeset(self, keyPaths: keyPaths)\n    }\n}\n\n// MARK: RealmCollection\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension RealmCollectionImpl {\n    /// :nodoc:\n    public func _observe<S>(_ keyPaths: [String]? = nil, on queue: DispatchQueue? = nil, _ subscriber: S)\n        -> NotificationToken where S: Subscriber, S.Input == Self {\n        var col: Self?\n        return collection.addNotificationBlock({ collection, _, _ in\n            if col == nil, let collection = collection {\n                col = self.collection === collection ? self : Self(collection: collection)\n            }\n            if let col = col {\n                _ = subscriber.receive(col)\n            }\n        }, keyPaths: keyPaths, queue: queue)\n    }\n\n    /// :nodoc:\n    public func _observe<S: Subscriber>(_ keyPaths: [String]? = nil, _ subscriber: S) -> NotificationToken where S.Input == Void {\n        collection.addNotificationBlock({ _, _, _ in _ = subscriber.receive() },\n                                        keyPaths: keyPaths, queue: nil)\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension AnyRealmCollection: RealmSubscribable {}\n\n// MARK: RealmKeyedCollection\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension RealmKeyedCollection {\n    /// :nodoc:\n    public func _observe<S>(_ keyPaths: [String]?, on queue: DispatchQueue? = nil, _ subscriber: S)\n        -> NotificationToken where S: Subscriber, S.Input == Self {\n            // FIXME: we could skip some pointless work in converting the changeset to the Swift type here\n            return observe(keyPaths: keyPaths, on: queue) { change in\n                switch change {\n                case .initial(let collection):\n                    _ = subscriber.receive(collection)\n                case .update(let collection, deletions: _, insertions: _, modifications: _):\n                    _ = subscriber.receive(collection)\n                case .error(let error):\n                    fatalError(\"Unexpected error \\(error)\")\n                }\n            }\n    }\n    /// :nodoc:\n    public func _observe<S: Subscriber>(_ subscriber: S) -> NotificationToken where S.Input == Void {\n        return observe(keyPaths: nil, on: nil) { _ in _ = subscriber.receive() }\n    }\n    /// :nodoc:\n    public func _observe<S: Subscriber>(_ keyPaths: [String]? = nil, _ subscriber: S) -> NotificationToken where S.Input == Void {\n        return observe(keyPaths: keyPaths, on: nil) { _ in _ = subscriber.receive() }\n    }\n}\n\n// MARK: Subscriptions\n\n/// A subscription which wraps a Realm notification.\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n@frozen public struct ObservationSubscription: Subscription {\n    private var token: NotificationToken\n    internal init(token: NotificationToken) {\n        self.token = token\n    }\n\n    /// A unique identifier for identifying publisher streams.\n    public var combineIdentifier: CombineIdentifier {\n        return CombineIdentifier(token)\n    }\n\n    /// This function is not implemented.\n    ///\n    /// Realm publishers do not support backpressure and so this function does nothing.\n    public func request(_ demand: Subscribers.Demand) {\n    }\n\n    /// Stop emitting values on this subscription.\n    public func cancel() {\n        token.invalidate()\n    }\n}\n\n/// A subscription which wraps a Realm AsyncOpenTask.\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n@frozen public struct AsyncOpenSubscription: Subscription {\n    private let task: Realm.AsyncOpenTask\n\n    internal init(task: Realm.AsyncOpenTask) {\n        self.task = task\n    }\n\n    /// A unique identifier for identifying publisher streams.\n    public var combineIdentifier: CombineIdentifier {\n        return CombineIdentifier(task.rlmTask)\n    }\n\n    /// This function is not implemented.\n    ///\n    /// Realm publishers do not support backpressure and so this function does nothing.\n    public func request(_ demand: Subscribers.Demand) {\n    }\n\n    /// Stop emitting values on this subscription.\n    public func cancel() {\n        task.cancel()\n    }\n}\n\n// MARK: Publishers\n\n/// Combine publishers for Realm types.\n///\n/// You normally should not create any of these types directly, and should\n/// instead use the extension methods which create them.\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\npublic enum RealmPublishers {\n    static private func realm<S: Scheduler>(_ config: RLMRealmConfiguration, _ scheduler: S) -> Realm? {\n        try? Realm(RLMRealm(configuration: config, queue: scheduler as? DispatchQueue))\n    }\n    static private func realm<S: Scheduler>(_ sourceRealm: Realm, _ scheduler: S) -> Realm? {\n        return realm(sourceRealm.rlmRealm.configurationSharingSchema(), scheduler)\n    }\n\n    /// A publisher which emits Void each time the Realm is refreshed.\n    ///\n    /// Despite the name, this actually emits *after* the Realm is refreshed.\n    @frozen public struct RealmWillChange: Publisher {\n        /// This publisher cannot fail.\n        public typealias Failure = Never\n        /// This publisher emits Void.\n        public typealias Output = Void\n\n        private let realm: Realm\n\n        internal init(_ realm: Realm) {\n            self.realm = realm\n        }\n\n        /// Captures the `NotificationToken` produced by observing a Realm Collection.\n        ///\n        /// This allows you to do notification skipping when performing a `Realm.write(withoutNotifying:)`. You should use this call if you\n        /// require to write to the Realm database and ignore this specific observation chain.\n        /// The `NotificationToken` will be saved on the specified `KeyPath`from the observation block set up in `receive(subscriber:)`.\n        ///\n        /// - Parameters:\n        ///   - object: The object which the `NotificationToken` is written to.\n        ///   - keyPath: The KeyPath which the `NotificationToken` is written to.\n        /// - Returns: A `RealmWillChangeWithToken` Publisher.\n        public func saveToken<T>(on object: T, for keyPath: WritableKeyPath<T, NotificationToken?>) -> RealmWillChangeWithToken<T> {\n              return RealmWillChangeWithToken<T>(realm, object, keyPath)\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Never, Output == S.Input {\n            let token = self.realm.observe { _, _ in\n                _ = subscriber.receive()\n            }\n            subscriber.receive(subscription: ObservationSubscription(token: token))\n        }\n    }\n\n    /// :nodoc:\n    public class RealmWillChangeWithToken<T>: Publisher {\n        /// This publisher cannot fail.\n        public typealias Failure = Never\n        /// This publisher emits Void.\n        public typealias Output = Void\n\n        internal typealias TokenParent = T\n        internal typealias TokenKeyPath = WritableKeyPath<T, NotificationToken?>\n\n        private let realm: Realm\n        private var tokenParent: TokenParent\n        private var tokenKeyPath: TokenKeyPath\n\n        internal init(_ realm: Realm,\n                      _ tokenParent: TokenParent,\n                      _ tokenKeyPath: TokenKeyPath) {\n            self.realm = realm\n            self.tokenParent = tokenParent\n            self.tokenKeyPath = tokenKeyPath\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Never, Output == S.Input {\n            let token = self.realm.observe { _, _ in\n                _ = subscriber.receive()\n            }\n            tokenParent[keyPath: tokenKeyPath] = token\n            subscriber.receive(subscription: ObservationSubscription(token: token))\n        }\n    }\n    /// A publisher which emits Void each time the object is mutated.\n    ///\n    /// Despite the name, this actually emits *after* the collection has changed.\n    @frozen public struct WillChange<Collection: RealmSubscribable>: Publisher where Collection: ThreadConfined {\n        /// This publisher cannot fail.\n        public typealias Failure = Never\n        /// This publisher emits Void.\n        public typealias Output = Void\n\n        private let collection: Collection\n\n        internal init(_ collection: Collection) {\n            self.collection = collection\n        }\n\n        /// Captures the `NotificationToken` produced by observing a Realm Collection.\n        ///\n        /// This allows you to do notification skipping when performing a `Realm.write(withoutNotifying:)`. You should use this call if you\n        /// require to write to the Realm database and ignore this specific observation chain.\n        /// The `NotificationToken` will be saved on the specified `KeyPath`from the observation block set up in `receive(subscriber:)`.\n        ///\n        /// - Parameters:\n        ///   - object: The object which the `NotificationToken` is written to.\n        ///   - keyPath: The KeyPath which the `NotificationToken` is written to.\n        /// - Returns: A `WillChangeWithToken` Publisher.\n        public func saveToken<T>(on object: T, at keyPath: WritableKeyPath<T, NotificationToken?>) -> WillChangeWithToken<Collection, T> {\n              return WillChangeWithToken<Collection, T>(collection, object, keyPath)\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Never, Output == S.Input {\n            let token =  self.collection._observe(nil, subscriber)\n            subscriber.receive(subscription: ObservationSubscription(token: token))\n        }\n    }\n\n    /// A publisher which emits Void each time the object is mutated.\n    ///\n    /// Despite the name, this actually emits *after* the collection has changed.\n    public class WillChangeWithToken<Collection: RealmSubscribable, T>: Publisher where Collection: ThreadConfined {\n        /// This publisher cannot fail.\n        public typealias Failure = Never\n        /// This publisher emits Void.\n        public typealias Output = Void\n\n        internal typealias TokenParent = T\n        internal typealias TokenKeyPath = WritableKeyPath<T, NotificationToken?>\n\n        private let object: Collection\n        private var tokenParent: TokenParent\n        private var tokenKeyPath: TokenKeyPath\n\n        internal init(_ object: Collection,\n                      _ tokenParent: TokenParent,\n                      _ tokenKeyPath: TokenKeyPath) {\n            self.object = object\n            self.tokenParent = tokenParent\n            self.tokenKeyPath = tokenKeyPath\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Never, Output == S.Input {\n            let token =  self.object._observe(nil, subscriber)\n            tokenParent[keyPath: tokenKeyPath] = token\n            subscriber.receive(subscription: ObservationSubscription(token: token))\n        }\n    }\n\n    /// A publisher which emits an object or collection each time that object is mutated.\n    @frozen public struct Value<Subscribable: RealmSubscribable>: Publisher where Subscribable: ThreadConfined {\n        /// This publisher cannot actually fail and will change to Never in the future.\n        public typealias Failure = Error\n        /// This publisher emits the object or collection which it is publishing.\n        public typealias Output = Subscribable\n\n        private let subscribable: Subscribable\n        private let keyPaths: [String]?\n        private let queue: DispatchQueue?\n        internal init(_ subscribable: Subscribable, keyPaths: [String]? = nil, queue: DispatchQueue? = nil) {\n            precondition(subscribable.realm != nil, \"Only managed objects can be published\")\n            self.subscribable = subscribable\n            self.keyPaths = keyPaths\n            self.queue = queue\n        }\n\n        /// Captures the `NotificationToken` produced by observing a Realm Collection.\n        ///\n        /// This allows you to do notification skipping when performing a `Realm.write(withoutNotifying:)`. You should use this call if you\n        /// require to write to the Realm database and ignore this specific observation chain.\n        /// The `NotificationToken` will be saved on the specified `KeyPath`from the observation block set up in `receive(subscriber:)`.\n        ///\n        /// - Parameters:\n        ///   - object: The object which the `NotificationToken` is written to.\n        ///   - keyPath: The KeyPath which the `NotificationToken` is written to.\n        /// - Returns: A `ValueWithToken` Publisher.\n        public func saveToken<T>(on object: T, at keyPath: WritableKeyPath<T, NotificationToken?>) -> ValueWithToken<Subscribable, T> {\n              return ValueWithToken<Subscribable, T>(subscribable, queue, object, keyPath)\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Failure, Output == S.Input {\n            subscriber.receive(subscription: ObservationSubscription(token: self.subscribable._observe(keyPaths, on: queue, subscriber)))\n        }\n\n        /// Specifies the scheduler on which to perform subscribe, cancel, and request operations.\n        ///\n        /// For Realm Publishers, this determines which queue the underlying\n        /// change notifications are sent to. If `receive(on:)` is not used\n        /// subsequently, it also will determine which queue elements received\n        /// from the publisher are evaluated on. Currently only serial dispatch\n        /// queues are supported, and the `options:` parameter is not\n        /// supported.\n        ///\n        /// - parameter scheduler: The serial dispatch queue to perform the subscription on.\n        /// - returns: A publisher which subscribes on the given scheduler.\n        public func subscribe<S: Scheduler>(on scheduler: S) -> Value<Subscribable> {\n            guard let queue = scheduler as? DispatchQueue else {\n                fatalError(\"Cannot subscribe on scheduler \\(scheduler): only serial dispatch queues are currently implemented.\")\n            }\n            return Value(subscribable, keyPaths: keyPaths, queue: queue)\n        }\n\n        /// Specifies the scheduler on which to perform downstream operations.\n        ///\n        /// This differs from `subscribe(on:)` in how it is integrated with the\n        /// autorefresh cycle. When using `subscribe(on:)`, the subscription is\n        /// performed on the target scheduler and the publisher will emit the\n        /// collection during the refresh. When using `receive(on:)`, the\n        /// collection is then converted to a `ThreadSafeReference` and\n        /// delivered to the target scheduler with no integration into the\n        /// autorefresh cycle, meaning it may arrive some time after the\n        /// refresh occurs.\n        ///\n        /// When in doubt, you probably want `subscribe(on:)`.\n        ///\n        /// - parameter scheduler: The serial dispatch queue to receive values on.\n        /// - returns: A publisher which delivers values to the given scheduler.\n        public func receive<S: Scheduler>(on scheduler: S) -> RealmPublishers.Handover<Self, S> {\n            return Handover(self, scheduler, self.subscribable.realm!)\n        }\n    }\n\n    /// A publisher which emits an object or collection each time that object is mutated.\n    public class ValueWithToken<Subscribable: RealmSubscribable, T>: Publisher where Subscribable: ThreadConfined {\n        /// This publisher cannot actually fail and will change to Never in the future.\n        public typealias Failure = Error\n        /// This publisher emits the object or collection which it is publishing.\n        public typealias Output = Subscribable\n\n        internal typealias TokenParent = T\n        internal typealias TokenKeyPath = WritableKeyPath<T, NotificationToken?>\n\n        private let object: Subscribable\n        private let queue: DispatchQueue?\n\n        private var tokenParent: TokenParent\n        private var tokenKeyPath: TokenKeyPath\n\n        internal init(_ object: Subscribable,\n                      _ queue: DispatchQueue? = nil,\n                      _ tokenParent: TokenParent,\n                      _ tokenKeyPath: TokenKeyPath) {\n            precondition(object.realm != nil, \"Only managed objects can be published\")\n            self.object = object\n            self.queue = queue\n            self.tokenParent = tokenParent\n            self.tokenKeyPath = tokenKeyPath\n        }\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Failure, Output == S.Input {\n            let token = self.object._observe(nil, on: queue, subscriber)\n            tokenParent[keyPath: tokenKeyPath] = token\n            subscriber.receive(subscription: ObservationSubscription(token: token))\n        }\n\n        /// Specifies the scheduler on which to perform subscribe, cancel, and request operations.\n        ///\n        /// For Realm Publishers, this determines which queue the underlying\n        /// change notifications are sent to. If `receive(on:)` is not used\n        /// subsequently, it also will determine which queue elements received\n        /// from the publisher are evaluated on. Currently only serial dispatch\n        /// queues are supported, and the `options:` parameter is not\n        /// supported.\n        ///\n        /// - parameter scheduler: The serial dispatch queue to perform the subscription on.\n        /// - returns: A publisher which subscribes on the given scheduler.\n        public func subscribe<S: Scheduler>(on scheduler: S) -> ValueWithToken<Subscribable, T> {\n            guard let queue = scheduler as? DispatchQueue else {\n                fatalError(\"Cannot subscribe on scheduler \\(scheduler): only serial dispatch queues are currently implemented.\")\n            }\n            return ValueWithToken(object, queue, tokenParent, tokenKeyPath)\n        }\n\n        /// Specifies the scheduler on which to perform downstream operations.\n        ///\n        /// This differs from `subscribe(on:)` in how it is integrated with the\n        /// autorefresh cycle. When using `subscribe(on:)`, the subscription is\n        /// performed on the target scheduler and the publisher will emit the\n        /// collection during the refresh. When using `receive(on:)`, the\n        /// collection is then converted to a `ThreadSafeReference` and\n        /// delivered to the target scheduler with no integration into the\n        /// autorefresh cycle, meaning it may arrive some time after the\n        /// refresh occurs.\n        ///\n        /// When in doubt, you probably want `subscribe(on:)`.\n        ///\n        /// - parameter scheduler: The serial dispatch queue to receive values on.\n        /// - returns: A publisher which delivers values to the given scheduler.\n        public func receive<S: Scheduler>(on scheduler: S) -> Handover<ValueWithToken, S> {\n            return Handover(self, scheduler, self.object.realm!)\n        }\n    }\n\n    /// A helper publisher used to support `receive(on:)` on Realm publishers.\n    @frozen public struct Handover<Upstream: Publisher, S: Scheduler>: Publisher where Upstream.Output: ThreadConfined {\n        /// :nodoc:\n        public typealias Failure = Upstream.Failure\n        /// :nodoc:\n        public typealias Output = Upstream.Output\n\n        private let config: RLMRealmConfiguration\n        private let upstream: Upstream\n        private let scheduler: S\n\n        internal init(_ upstream: Upstream, _ scheduler: S, _ realm: Realm) {\n            self.config = realm.rlmRealm.configurationSharingSchema()\n            self.upstream = upstream\n            self.scheduler = scheduler\n        }\n\n        /// :nodoc:\n        public func receive<Sub>(subscriber: Sub) where Sub: Subscriber, Sub.Failure == Failure, Output == Sub.Input {\n            let scheduler = self.scheduler\n            let config = self.config\n            self.upstream\n                .map { ThreadSafeReference(to: $0) }\n                .receive(on: scheduler)\n                .compactMap { realm(config, scheduler)?.resolve($0) }\n                .receive(subscriber: subscriber)\n        }\n    }\n\n    /// A publisher which makes `receive(on:)` work for streams of thread-confined objects\n    ///\n    /// Create using .threadSafeReference()\n    @frozen public struct MakeThreadSafe<Upstream: Publisher>: Publisher where Upstream.Output: ThreadConfined {\n        /// :nodoc:\n        public typealias Failure = Upstream.Failure\n        /// :nodoc:\n        public typealias Output = Upstream.Output\n\n        private let upstream: Upstream\n        internal init(_ upstream: Upstream) {\n            self.upstream = upstream\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Failure, Output == S.Input {\n            self.upstream.receive(subscriber: subscriber)\n        }\n\n        /// Specifies the scheduler on which to receive elements from the publisher.\n        ///\n        /// This publisher converts each value emitted by the upstream\n        /// publisher to a `ThreadSafeReference`, passes it to the target\n        /// scheduler, and then converts back to the original type.\n        ///\n        /// - parameter scheduler: The serial dispatch queue to receive values on.\n        /// - returns: A publisher which delivers values to the given scheduler.\n        public func receive<S: Scheduler>(on scheduler: S) -> DeferredHandover<Upstream, S> {\n            DeferredHandover(self.upstream, scheduler)\n        }\n    }\n\n    /// A publisher which delivers thread-confined values to a serial dispatch queue.\n    ///\n    /// Create using `.threadSafeReference().receive(on: queue)` on a publisher\n    /// that emits thread-confined objects.\n    @frozen public struct DeferredHandover<Upstream: Publisher, S: Scheduler>: Publisher where Upstream.Output: ThreadConfined {\n        /// :nodoc:\n        public typealias Failure = Upstream.Failure\n        /// :nodoc:\n        public typealias Output = Upstream.Output\n\n        private let upstream: Upstream\n        private let scheduler: S\n        internal init(_ upstream: Upstream, _ scheduler: S) {\n            self.upstream = upstream\n            self.scheduler = scheduler\n        }\n\n        private enum Handover {\n            case object(_ object: Output)\n            case tsr(_ tsr: ThreadSafeReference<Output>, config: RLMRealmConfiguration)\n        }\n\n        /// :nodoc:\n        public func receive<Sub>(subscriber: Sub) where Sub: Subscriber, Sub.Failure == Failure, Output == Sub.Input {\n            let scheduler = self.scheduler\n            self.upstream\n                .map { (obj: Output) -> Handover in\n                    guard let realm = obj.realm, !realm.isFrozen else { return .object(obj) }\n                    return .tsr(ThreadSafeReference(to: obj), config: realm.rlmRealm.configurationSharingSchema())\n            }\n            .receive(on: scheduler)\n            .compactMap { (handover: Handover) -> Output? in\n                switch handover {\n                case .object(let obj):\n                    return obj\n                case .tsr(let tsr, let config):\n                    return realm(config, scheduler)?.resolve(tsr)\n                }\n            }\n            .receive(subscriber: subscriber)\n        }\n    }\n\n    /// A publisher which emits ObjectChange<T> each time the observed object is modified\n    ///\n    /// `receive(on:)` and `subscribe(on:)` can be called directly on this\n    /// publisher, and calling `.threadSafeReference()` is only required if\n    /// there is an intermediate transform. If `subscribe(on:)` is used, it\n    /// should always be the first operation in the pipeline.\n    ///\n    /// Create this publisher using the `objectChangeset()` function.\n    @frozen public struct ObjectChangeset<O: ThreadConfined>: Publisher {\n        /// This publisher emits a ObjectChange<T> indicating which object and\n        /// which properties of that object have changed each time a Realm is\n        /// refreshed after a write transaction which modifies the observed\n        /// object.\n        public typealias Output = ObjectChange<O>\n        /// This publisher reports error via the `.error` case of ObjectChange.\n        public typealias Failure = Never\n\n        @usableFromInline\n        internal typealias Observe = (_ queue: DispatchQueue?, @escaping (Output) -> Void) -> NotificationToken\n        private let observe: Observe\n        private let queue: DispatchQueue?\n        internal init(_ observe: @escaping Observe, queue: DispatchQueue? = nil) {\n            self.observe = observe\n            self.queue = queue\n        }\n\n        /// Captures the `NotificationToken` produced by observing a Realm Collection.\n        ///\n        /// This allows you to do notification skipping when performing a `Realm.write(withoutNotifying:)`. You should use this call if you\n        /// require to write to the Realm database and ignore this specific observation chain.\n        /// The `NotificationToken` will be saved on the specified `KeyPath`from the observation block set up in `receive(subscriber:)`.\n        ///\n        /// - Parameters:\n        ///   - object: The object which the `NotificationToken` is written to.\n        ///   - keyPath: The KeyPath which the `NotificationToken` is written to.\n        /// - Returns: A `ObjectChangesetWithToken` Publisher.\n        public func saveToken<T>(on tokenParent: T, at keyPath: WritableKeyPath<T, NotificationToken?>) -> ObjectChangesetWithToken<O, T> {\n              return ObjectChangesetWithToken<O, T>(observe, queue, tokenParent, keyPath)\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Never, Output == S.Input {\n            let token = observe(self.queue) { change in\n                switch change {\n                case .change(let o, let properties):\n                    _ = subscriber.receive(.change(o, properties))\n                case .error(let error):\n                    _ = subscriber.receive(.error(error))\n                case .deleted:\n                    subscriber.receive(completion: .finished)\n                }\n            }\n            subscriber.receive(subscription: ObservationSubscription(token: token))\n        }\n\n        /// Specifies the scheduler on which to perform subscribe, cancel, and request operations.\n        ///\n        /// For Realm Publishers, this determines which queue the underlying\n        /// change notifications are sent to. If `receive(on:)` is not used\n        /// subsequently, it also will determine which queue elements received\n        /// from the publisher are evaluated on. Currently only serial dispatch\n        /// queues are supported, and the `options:` parameter is not\n        /// supported.\n        ///\n        /// - parameter scheduler: The serial dispatch queue to perform the subscription on.\n        /// - returns: A publisher which subscribes on the given scheduler.\n        public func subscribe<S: Scheduler>(on scheduler: S) -> ObjectChangeset<O> {\n            guard let queue = scheduler as? DispatchQueue else {\n                fatalError(\"Cannot subscribe on scheduler \\(scheduler): only serial dispatch queues are currently implemented.\")\n            }\n            return ObjectChangeset(observe, queue: queue)\n        }\n\n        /// Specifies the scheduler on which to perform downstream operations.\n        ///\n        /// This differs from `subscribe(on:)` in how it is integrated with the\n        /// autorefresh cycle. When using `subscribe(on:)`, the subscription is\n        /// performed on the target scheduler and the publisher will emit the\n        /// collection during the refresh. When using `receive(on:)`, the\n        /// collection is then converted to a `ThreadSafeReference` and\n        /// delivered to the target scheduler with no integration into the\n        /// autorefresh cycle, meaning it may arrive some time after the\n        /// refresh occurs.\n        ///\n        /// When in doubt, you probably want `subscribe(on:)`\n        ///\n        /// - parameter scheduler: The serial dispatch queue to receive values on.\n        /// - returns: A publisher which delivers values to the given scheduler.\n        public func receive<S: Scheduler>(on scheduler: S) -> DeferredHandoverObjectChangeset<Self, O, S> {\n            DeferredHandoverObjectChangeset(self, scheduler)\n        }\n    }\n\n    /// A publisher which emits ObjectChange<T> each time the observed object is modified\n    ///\n    /// `receive(on:)` and `subscribe(on:)` can be called directly on this\n    /// publisher, and calling `.threadSafeReference()` is only required if\n    /// there is an intermediate transform. If `subscribe(on:)` is used, it\n    /// should always be the first operation in the pipeline.\n    ///\n    /// Create this publisher using the `objectChangeset()` function.\n    public class ObjectChangesetWithToken<O: Object, T>: Publisher {\n        /// This publisher emits a ObjectChange<T> indicating which object and\n        /// which properties of that object have changed each time a Realm is\n        /// refreshed after a write transaction which modifies the observed\n        /// object.\n        public typealias Output = ObjectChange<O>\n        /// This publisher reports error via the `.error` case of ObjectChange.\n        public typealias Failure = Never\n\n        internal typealias TokenParent = T\n        internal typealias TokenKeyPath = WritableKeyPath<T, NotificationToken?>\n\n        private var tokenParent: TokenParent\n        private var tokenKeyPath: TokenKeyPath\n\n        @usableFromInline\n        internal typealias Observe = (_ queue: DispatchQueue?, @escaping (Output) -> Void) -> NotificationToken\n        private let observe: Observe\n        private let queue: DispatchQueue?\n        internal init(_ observe: @escaping Observe,\n                      _ queue: DispatchQueue? = nil,\n                      _ tokenParent: TokenParent,\n                      _ tokenKeyPath: TokenKeyPath) {\n            self.observe = observe\n            self.queue = queue\n            self.tokenParent = tokenParent\n            self.tokenKeyPath = tokenKeyPath\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Never, Output == S.Input {\n            let token = observe(self.queue) { change in\n                switch change {\n                case .change(let o, let properties):\n                    _ = subscriber.receive(.change(o, properties))\n                case .error(let error):\n                    _ = subscriber.receive(.error(error))\n                case .deleted:\n                    subscriber.receive(completion: .finished)\n                }\n            }\n            tokenParent[keyPath: tokenKeyPath] = token\n            subscriber.receive(subscription: ObservationSubscription(token: token))\n        }\n\n        /// Specifies the scheduler on which to perform subscribe, cancel, and request operations.\n        ///\n        /// For Realm Publishers, this determines which queue the underlying\n        /// change notifications are sent to. If `receive(on:)` is not used\n        /// subsequently, it also will determine which queue elements received\n        /// from the publisher are evaluated on. Currently only serial dispatch\n        /// queues are supported, and the `options:` parameter is not\n        /// supported.\n        ///\n        /// - parameter scheduler: The serial dispatch queue to perform the subscription on.\n        /// - returns: A publisher which subscribes on the given scheduler.\n        public func subscribe<S: Scheduler>(on scheduler: S) -> ObjectChangesetWithToken<O, T> {\n            guard let queue = scheduler as? DispatchQueue else {\n                fatalError(\"Cannot subscribe on scheduler \\(scheduler): only serial dispatch queues are currently implemented.\")\n            }\n            return ObjectChangesetWithToken(observe, queue, tokenParent, tokenKeyPath)\n        }\n\n        /// Specifies the scheduler on which to perform downstream operations.\n        ///\n        /// This differs from `subscribe(on:)` in how it is integrated with the\n        /// autorefresh cycle. When using `subscribe(on:)`, the subscription is\n        /// performed on the target scheduler and the publisher will emit the\n        /// collection during the refresh. When using `receive(on:)`, the\n        /// collection is then converted to a `ThreadSafeReference` and\n        /// delivered to the target scheduler with no integration into the\n        /// autorefresh cycle, meaning it may arrive some time after the\n        /// refresh occurs.\n        ///\n        /// When in doubt, you probably want `subscribe(on:)`\n        ///\n        /// - parameter scheduler: The serial dispatch queue to receive values on.\n        /// - returns: A publisher which delivers values to the given scheduler.\n        public func receive<S: Scheduler>(on scheduler: S) -> DeferredHandoverObjectChangeset<ObjectChangesetWithToken, T, S> {\n            DeferredHandoverObjectChangeset(self, scheduler)\n        }\n    }\n\n    /// A helper publisher created by calling `.threadSafeReference()` on a publisher which emits thread-confined values.\n    @frozen public struct MakeThreadSafeObjectChangeset<Upstream: Publisher, T: ThreadConfined>: Publisher where Upstream.Output == ObjectChange<T> {\n        /// :nodoc:\n        public typealias Failure = Upstream.Failure\n        /// :nodoc:\n        public typealias Output = Upstream.Output\n\n        private let upstream: Upstream\n        internal init(_ upstream: Upstream) {\n            self.upstream = upstream\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Failure, Output == S.Input {\n            self.upstream.receive(subscriber: subscriber)\n        }\n\n        /// Specifies the scheduler to deliver object changesets to.\n        ///\n        /// This differs from `subscribe(on:)` in how it is integrated with the\n        /// autorefresh cycle. When using `subscribe(on:)`, the subscription is\n        /// performed on the target scheduler and the publisher will emit the\n        /// collection during the refresh. When using `receive(on:)`, the\n        /// collection is then converted to a `ThreadSafeReference` and\n        /// delivered to the target scheduler with no integration into the\n        /// autorefresh cycle, meaning it may arrive some time after the\n        /// refresh occurs.\n        ///\n        /// When in doubt, you probably want `subscribe(on:)`.\n        ///\n        /// - parameter scheduler: The serial dispatch queue to receive values on.\n        /// - returns: A publisher which delivers values to the given scheduler.\n        public func receive<S: Scheduler>(on scheduler: S) -> DeferredHandoverObjectChangeset<Upstream, T, S> {\n            DeferredHandoverObjectChangeset(self.upstream, scheduler)\n        }\n    }\n\n    /// A publisher which delivers thread-confined object changesets to a serial dispatch queue.\n    ///\n    /// Create using `.threadSafeReference().receive(on: queue)` on a publisher\n    /// that emits `ObjectChange`.\n    @frozen public struct DeferredHandoverObjectChangeset<Upstream: Publisher, T: ThreadConfined, S: Scheduler>: Publisher where Upstream.Output == ObjectChange<T> {\n        /// :nodoc:\n        public typealias Failure = Upstream.Failure\n        /// :nodoc:\n        public typealias Output = Upstream.Output\n\n        private let upstream: Upstream\n        private let scheduler: S\n\n        internal init(_ upstream: Upstream, _ scheduler: S) {\n            self.upstream = upstream\n            self.scheduler = scheduler\n        }\n\n        private enum Handover {\n            // .error and .change containing a frozen object can be delivered\n            // without any handover\n            case passthrough(_ change: ObjectChange<T>)\n            // .change containing a live object need to be wrapped in a TSR.\n            // We also hold a reference to a pinned Realm to ensure that the\n            // source version remains pinned and we can deliver the object at\n            // the same version as the change information.\n            case tsr(_ pin: RLMPinnedRealm, _ tsr: ThreadSafeReference<T>,\n                     _ properties: [PropertyChange])\n        }\n\n        /// :nodoc:\n        public func receive<Sub>(subscriber: Sub) where Sub: Subscriber, Sub.Failure == Failure, Output == Sub.Input {\n            let scheduler = self.scheduler\n            self.upstream\n                .map { (change: Output) -> Handover in\n                    guard case .change(let obj, let properties) = change else { return .passthrough(change) }\n                    guard let realm = obj.realm, !realm.isFrozen else { return .passthrough(change) }\n                    return .tsr(RLMPinnedRealm(realm: realm.rlmRealm),\n                                ThreadSafeReference(to: obj), properties)\n                }\n                .receive(on: scheduler)\n                .compactMap { (handover: Handover) -> Output? in\n                    switch handover {\n                    case .passthrough(let change):\n                        return change\n                    case .tsr(let pin, let tsr, let properties):\n                        defer { pin.unpin() }\n                        if let resolved = realm(pin.configuration, scheduler)?.resolve(tsr) {\n                            return .change(resolved, properties)\n                        }\n                        return nil\n                    }\n                }\n                .receive(subscriber: subscriber)\n        }\n    }\n\n    /// A publisher which emits RealmCollectionChange<T> each time the observed object is modified\n    ///\n    /// `receive(on:)` and `subscribe(on:)` can be called directly on this\n    /// publisher, and calling `.threadSafeReference()` is only required if\n    /// there is an intermediate transform. If `subscribe(on:)` is used, it\n    /// should always be the first operation in the pipeline.\n    ///\n    /// Create this publisher using the `changesetPublisher` property on RealmCollection.\n    @frozen public struct CollectionChangeset<Collection: RealmCollection>: Publisher {\n        public typealias Output = RealmCollectionChange<Collection>\n        /// This publisher reports error via the `.error` case of RealmCollectionChange.\n        public typealias Failure = Never\n\n        private let collection: Collection\n        private let keyPaths: [String]?\n        private let queue: DispatchQueue?\n        internal init(_ collection: Collection, keyPaths: [String]? = nil, queue: DispatchQueue? = nil) {\n            precondition(collection.realm != nil, \"Only managed collections can be published\")\n            self.collection = collection\n            self.keyPaths = keyPaths\n            self.queue = queue\n        }\n\n        /// Captures the `NotificationToken` produced by observing a Realm Collection.\n        ///\n        /// This allows you to do notification skipping when performing a `Realm.write(withoutNotifying:)`. You should use this call if you\n        /// require to write to the Realm database and ignore this specific observation chain.\n        /// The `NotificationToken` will be saved on the specified `KeyPath`from the observation block set up in `receive(subscriber:)`.\n        ///\n        /// - Parameters:\n        ///   - object: The object which the `NotificationToken` is written to.\n        ///   - keyPath: The KeyPath which the `NotificationToken` is written to.\n        /// - Returns: A `CollectionChangesetWithToken` Publisher.\n        public func saveToken<T>(on object: T, at keyPath: WritableKeyPath<T, NotificationToken?>) -> CollectionChangesetWithToken<Collection, T> {\n              return CollectionChangesetWithToken<Collection, T>(collection, queue, object, keyPath)\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Never, Output == S.Input {\n            let token = self.collection.observe(keyPaths: self.keyPaths, on: self.queue) { change in\n                _ = subscriber.receive(change)\n            }\n            subscriber.receive(subscription: ObservationSubscription(token: token))\n        }\n\n        /// Specifies the scheduler on which to perform subscribe, cancel, and request operations.\n        ///\n        /// For Realm Publishers, this determines which queue the underlying\n        /// change notifications are sent to. If `receive(on:)` is not used\n        /// subsequently, it also will determine which queue elements received\n        /// from the publisher are evaluated on. Currently only serial dispatch\n        /// queues are supported, and the `options:` parameter is not\n        /// supported.\n        ///\n        /// - parameter scheduler: The serial dispatch queue to perform the subscription on.\n        /// - returns: A publisher which subscribes on the given scheduler.\n        public func subscribe<S: Scheduler>(on scheduler: S) -> CollectionChangeset<Collection> {\n            guard let queue = scheduler as? DispatchQueue else {\n                fatalError(\"Cannot subscribe on scheduler \\(scheduler): only serial dispatch queues are currently implemented.\")\n            }\n            return CollectionChangeset(collection, keyPaths: self.keyPaths, queue: queue)\n        }\n\n        /// Specifies the scheduler on which to perform downstream operations.\n        ///\n        /// This differs from `subscribe(on:)` in how it is integrated with the\n        /// autorefresh cycle. When using `subscribe(on:)`, the subscription is\n        /// performed on the target scheduler and the publisher will emit the\n        /// collection during the refresh. When using `receive(on:)`, the\n        /// collection is then converted to a `ThreadSafeReference` and\n        /// delivered to the target scheduler with no integration into the\n        /// autorefresh cycle, meaning it may arrive some time after the\n        /// refresh occurs.\n        ///\n        /// When in doubt, you probably want `subscribe(on:)`\n        ///\n        /// - parameter scheduler: The serial dispatch queue to receive values on.\n        /// - returns: A publisher which delivers values to the given scheduler.\n        public func receive<S: Scheduler>(on scheduler: S) -> DeferredHandoverCollectionChangeset<Self, Collection, S> {\n            DeferredHandoverCollectionChangeset(self, scheduler)\n        }\n    }\n\n    /// A publisher which emits RealmMapChange<Key, Value> each time the observed object is modified\n    ///\n    /// `receive(on:)` and `subscribe(on:)` can be called directly on this\n    /// publisher, and calling `.threadSafeReference()` is only required if\n    /// there is an intermediate transform. If `subscribe(on:)` is used, it\n    /// should always be the first operation in the pipeline.\n    ///\n    /// Create this publisher using the `changesetPublisher` property on RealmCollection.\n    @frozen public struct MapChangeset<Collection: RealmKeyedCollection>: Publisher {\n        public typealias Output = RealmMapChange<Collection>\n        /// This publisher reports error via the `.error` case of RealmMapChange.\n        public typealias Failure = Never\n\n        private let collection: Collection\n        private let keyPaths: [String]?\n        private let queue: DispatchQueue?\n        internal init(_ collection: Collection, keyPaths: [String]? = nil, queue: DispatchQueue? = nil) {\n            precondition(collection.realm != nil, \"Only managed collections can be published\")\n            self.collection = collection\n            self.keyPaths = keyPaths\n            self.queue = queue\n        }\n\n        /// Captures the `NotificationToken` produced by observing a Realm Collection.\n        ///\n        /// This allows you to do notification skipping when performing a `Realm.write(withoutNotifying:)`. You should use this call if you\n        /// require to write to the Realm database and ignore this specific observation chain.\n        /// The `NotificationToken` will be saved on the specified `KeyPath`from the observation block set up in `receive(subscriber:)`.\n        ///\n        /// - Parameters:\n        ///   - object: The object which the `NotificationToken` is written to.\n        ///   - keyPath: The KeyPath which the `NotificationToken` is written to.\n        /// - Returns: A `CollectionChangesetWithToken` Publisher.\n        public func saveToken<T>(on object: T, at keyPath: WritableKeyPath<T, NotificationToken?>) -> MapChangesetWithToken<Collection, T> {\n              return MapChangesetWithToken<Collection, T>(collection, queue, object, keyPath)\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Never, Output == S.Input {\n            let token = self.collection.observe(keyPaths: self.keyPaths, on: self.queue) { change in\n                _ = subscriber.receive(change)\n            }\n            subscriber.receive(subscription: ObservationSubscription(token: token))\n        }\n\n        /// Specifies the scheduler on which to perform subscribe, cancel, and request operations.\n        ///\n        /// For Realm Publishers, this determines which queue the underlying\n        /// change notifications are sent to. If `receive(on:)` is not used\n        /// subsequently, it also will determine which queue elements received\n        /// from the publisher are evaluated on. Currently only serial dispatch\n        /// queues are supported, and the `options:` parameter is not\n        /// supported.\n        ///\n        /// - parameter scheduler: The serial dispatch queue to perform the subscription on.\n        /// - returns: A publisher which subscribes on the given scheduler.\n        public func subscribe<S: Scheduler>(on scheduler: S) -> MapChangeset<Collection> {\n            guard let queue = scheduler as? DispatchQueue else {\n                fatalError(\"Cannot subscribe on scheduler \\(scheduler): only serial dispatch queues are currently implemented.\")\n            }\n            return MapChangeset(collection, keyPaths: self.keyPaths, queue: queue)\n        }\n\n        /// Specifies the scheduler on which to perform downstream operations.\n        ///\n        /// This differs from `subscribe(on:)` in how it is integrated with the\n        /// autorefresh cycle. When using `subscribe(on:)`, the subscription is\n        /// performed on the target scheduler and the publisher will emit the\n        /// collection during the refresh. When using `receive(on:)`, the\n        /// collection is then converted to a `ThreadSafeReference` and\n        /// delivered to the target scheduler with no integration into the\n        /// autorefresh cycle, meaning it may arrive some time after the\n        /// refresh occurs.\n        ///\n        /// When in doubt, you probably want `subscribe(on:)`\n        ///\n        /// - parameter scheduler: The serial dispatch queue to receive values on.\n        /// - returns: A publisher which delivers values to the given scheduler.\n        public func receive<S: Scheduler>(on scheduler: S) -> DeferredHandoverKeyedCollectionChangeset<Self, Collection, S> {\n            DeferredHandoverKeyedCollectionChangeset(self, scheduler)\n        }\n    }\n\n    /// A publisher which emits SectionedResultsChange<Collection> each time the observed object is modified\n    ///\n    /// `receive(on:)` and `subscribe(on:)` can be called directly on this\n    /// publisher, and calling `.threadSafeReference()` is only required if\n    /// there is an intermediate transform. If `subscribe(on:)` is used, it\n    /// should always be the first operation in the pipeline.\n    ///\n    /// Create this publisher using the `changesetPublisher` property on RealmSectionedResult.\n    @frozen public struct SectionedResultsChangeset<Collection: RealmSectionedResult>: Publisher {\n        public typealias Output = SectionedResultsChange<Collection>\n        /// This publisher reports error via the `.error` case of SectionedResultsChange.\n        public typealias Failure = Never\n\n        private let collection: Collection\n        private let keyPaths: [String]?\n        private let queue: DispatchQueue?\n        internal init(_ collection: Collection, keyPaths: [String]? = nil, queue: DispatchQueue? = nil) {\n            precondition(collection.realm != nil, \"Only managed collections can be published\")\n            self.collection = collection\n            self.keyPaths = keyPaths\n            self.queue = queue\n        }\n\n        /// Captures the `NotificationToken` produced by observing the collection.\n        ///\n        /// This allows you to do notification skipping when performing a `Realm.write(withoutNotifying:)`. You should use this call if you\n        /// require to write to the Realm database and ignore this specific observation chain.\n        /// The `NotificationToken` will be saved on the specified `KeyPath`from the observation block set up in `receive(subscriber:)`.\n        ///\n        /// - Parameters:\n        ///   - object: The object which the `NotificationToken` is written to.\n        ///   - keyPath: The KeyPath which the `NotificationToken` is written to.\n        /// - Returns: A `SectionedResultsChangesetWithToken` Publisher.\n        public func saveToken<T>(on object: T, at keyPath: WritableKeyPath<T, NotificationToken?>) -> SectionedResultsChangesetWithToken<Collection, T> {\n              return SectionedResultsChangesetWithToken<Collection, T>(collection, queue, object, keyPath)\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Never, Output == S.Input {\n            let token = self.collection.observe(keyPaths: self.keyPaths, on: self.queue) { change in\n                _ = subscriber.receive(change)\n            }\n            subscriber.receive(subscription: ObservationSubscription(token: token))\n        }\n\n        /// Specifies the scheduler on which to perform subscribe, cancel, and request operations.\n        ///\n        /// For Realm Publishers, this determines which queue the underlying\n        /// change notifications are sent to. If `receive(on:)` is not used\n        /// subsequently, it also will determine which queue elements received\n        /// from the publisher are evaluated on. Currently only serial dispatch\n        /// queues are supported, and the `options:` parameter is not\n        /// supported.\n        ///\n        /// - parameter scheduler: The serial dispatch queue to perform the subscription on.\n        /// - returns: A publisher which subscribes on the given scheduler.\n        public func subscribe<S: Scheduler>(on scheduler: S) -> SectionedResultsChangeset<Collection> {\n            guard let queue = scheduler as? DispatchQueue else {\n                fatalError(\"Cannot subscribe on scheduler \\(scheduler): only serial dispatch queues are currently implemented.\")\n            }\n            return SectionedResultsChangeset(collection, keyPaths: self.keyPaths, queue: queue)\n        }\n\n        /// Specifies the scheduler on which to perform downstream operations.\n        ///\n        /// This differs from `subscribe(on:)` in how it is integrated with the\n        /// autorefresh cycle. When using `subscribe(on:)`, the subscription is\n        /// performed on the target scheduler and the publisher will emit the\n        /// collection during the refresh. When using `receive(on:)`, the\n        /// collection is then converted to a `ThreadSafeReference` and\n        /// delivered to the target scheduler with no integration into the\n        /// autorefresh cycle, meaning it may arrive some time after the\n        /// refresh occurs.\n        ///\n        /// When in doubt, you probably want `subscribe(on:)`\n        ///\n        /// - parameter scheduler: The serial dispatch queue to receive values on.\n        /// - returns: A publisher which delivers values to the given scheduler.\n        public func receive<S: Scheduler>(on scheduler: S) -> DeferredHandoverSectionedResultsChangeset<Self, Collection, S> {\n            DeferredHandoverSectionedResultsChangeset(self, scheduler)\n        }\n    }\n\n    /// A publisher which emits SectionedResultsChange<Collection> each time the observed object is modified\n    ///\n    /// `receive(on:)` and `subscribe(on:)` can be called directly on this\n    /// publisher, and calling `.threadSafeReference()` is only required if\n    /// there is an intermediate transform. If `subscribe(on:)` is used, it\n    /// should always be the first operation in the pipeline.\n    ///\n    /// Create this publisher using the `changesetPublisher` property on RealmSectionedResult.\n    @frozen public struct SectionChangeset<Collection: RealmSectionedResult>: Publisher {\n        public typealias Output = SectionedResultsChange<Collection>\n        /// This publisher reports error via the `.error` case of SectionedResultsChange.\n        public typealias Failure = Never\n\n        private let collection: Collection\n        private let keyPaths: [String]?\n        private let queue: DispatchQueue?\n        internal init(_ collection: Collection, keyPaths: [String]? = nil, queue: DispatchQueue? = nil) {\n            precondition(collection.realm != nil, \"Only managed collections can be published\")\n            self.collection = collection\n            self.keyPaths = keyPaths\n            self.queue = queue\n        }\n\n        /// Captures the `NotificationToken` produced by observing a the collection.\n        ///\n        /// This allows you to do notification skipping when performing a `Realm.write(withoutNotifying:)`. You should use this call if you\n        /// require to write to the Realm database and ignore this specific observation chain.\n        /// The `NotificationToken` will be saved on the specified `KeyPath`from the observation block set up in `receive(subscriber:)`.\n        ///\n        /// - Parameters:\n        ///   - object: The object which the `NotificationToken` is written to.\n        ///   - keyPath: The KeyPath which the `NotificationToken` is written to.\n        /// - Returns: A `SectionedResultsChangesetWithToken` Publisher.\n        public func saveToken<T>(on object: T, at keyPath: WritableKeyPath<T, NotificationToken?>) -> SectionedResultsChangesetWithToken<Collection, T> {\n              return SectionedResultsChangesetWithToken<Collection, T>(collection, queue, object, keyPath)\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Never, Output == S.Input {\n            let token = self.collection.observe(keyPaths: self.keyPaths, on: self.queue) { change in\n                _ = subscriber.receive(change)\n            }\n            subscriber.receive(subscription: ObservationSubscription(token: token))\n        }\n\n        /// Specifies the scheduler on which to perform subscribe, cancel, and request operations.\n        ///\n        /// For Realm Publishers, this determines which queue the underlying\n        /// change notifications are sent to. If `receive(on:)` is not used\n        /// subsequently, it also will determine which queue elements received\n        /// from the publisher are evaluated on. Currently only serial dispatch\n        /// queues are supported, and the `options:` parameter is not\n        /// supported.\n        ///\n        /// - parameter scheduler: The serial dispatch queue to perform the subscription on.\n        /// - returns: A publisher which subscribes on the given scheduler.\n        public func subscribe<S: Scheduler>(on scheduler: S) -> SectionedResultsChangeset<Collection> {\n            guard let queue = scheduler as? DispatchQueue else {\n                fatalError(\"Cannot subscribe on scheduler \\(scheduler): only serial dispatch queues are currently implemented.\")\n            }\n            return SectionedResultsChangeset(collection, keyPaths: self.keyPaths, queue: queue)\n        }\n\n        /// Specifies the scheduler on which to perform downstream operations.\n        ///\n        /// This differs from `subscribe(on:)` in how it is integrated with the\n        /// autorefresh cycle. When using `subscribe(on:)`, the subscription is\n        /// performed on the target scheduler and the publisher will emit the\n        /// collection during the refresh. When using `receive(on:)`, the\n        /// collection is then converted to a `ThreadSafeReference` and\n        /// delivered to the target scheduler with no integration into the\n        /// autorefresh cycle, meaning it may arrive some time after the\n        /// refresh occurs.\n        ///\n        /// When in doubt, you probably want `subscribe(on:)`\n        ///\n        /// - parameter scheduler: The serial dispatch queue to receive values on.\n        /// - returns: A publisher which delivers values to the given scheduler.\n        public func receive<S: Scheduler>(on scheduler: S) -> DeferredHandoverSectionedResultsChangeset<Self, Collection, S> {\n            DeferredHandoverSectionedResultsChangeset(self, scheduler)\n        }\n    }\n\n\n    /// A publisher which emits RealmCollectionChange<T> each time the observed object is modified\n    ///\n    /// `receive(on:)` and `subscribe(on:)` can be called directly on this\n    /// publisher, and calling `.threadSafeReference()` is only required if\n    /// there is an intermediate transform. If `subscribe(on:)` is used, it\n    /// should always be the first operation in the pipeline.\n    ///\n    /// Create this publisher using the `changesetPublisher` property on RealmCollection.\n    public class CollectionChangesetWithToken<Collection: RealmCollection, T>: Publisher {\n        public typealias Output = RealmCollectionChange<Collection>\n        /// This publisher reports error via the `.error` case of RealmCollectionChange.\n        public typealias Failure = Never\n\n        internal typealias TokenParent = T\n        internal typealias TokenKeyPath = WritableKeyPath<T, NotificationToken?>\n\n        private var tokenParent: TokenParent\n        private var tokenKeyPath: TokenKeyPath\n\n        private let collection: Collection\n        private let queue: DispatchQueue?\n        internal init(_ collection: Collection,\n                      _ queue: DispatchQueue? = nil,\n                      _ tokenParent: TokenParent,\n                      _ tokenKeyPath: TokenKeyPath) {\n            precondition(collection.realm != nil, \"Only managed collections can be published\")\n            self.collection = collection\n            self.queue = queue\n            self.tokenParent = tokenParent\n            self.tokenKeyPath = tokenKeyPath\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Never, Output == S.Input {\n            let token = self.collection.observe(on: self.queue) { change in\n                _ = subscriber.receive(change)\n            }\n            tokenParent[keyPath: tokenKeyPath] = token\n            subscriber.receive(subscription: ObservationSubscription(token: token))\n        }\n\n        /// Specifies the scheduler on which to perform subscribe, cancel, and request operations.\n        ///\n        /// For Realm Publishers, this determines which queue the underlying\n        /// change notifications are sent to. If `receive(on:)` is not used\n        /// subsequently, it also will determine which queue elements received\n        /// from the publisher are evaluated on. Currently only serial dispatch\n        /// queues are supported, and the `options:` parameter is not\n        /// supported.\n        ///\n        /// - parameter scheduler: The serial dispatch queue to perform the subscription on.\n        /// - returns: A publisher which subscribes on the given scheduler.\n        public func subscribe<S: Scheduler>(on scheduler: S) -> CollectionChangesetWithToken<Collection, T> {\n            guard let queue = scheduler as? DispatchQueue else {\n                fatalError(\"Cannot subscribe on scheduler \\(scheduler): only serial dispatch queues are currently implemented.\")\n            }\n            return CollectionChangesetWithToken(collection, queue, tokenParent, tokenKeyPath)\n        }\n\n        /// Specifies the scheduler on which to perform downstream operations.\n        ///\n        /// This differs from `subscribe(on:)` in how it is integrated with the\n        /// autorefresh cycle. When using `subscribe(on:)`, the subscription is\n        /// performed on the target scheduler and the publisher will emit the\n        /// collection during the refresh. When using `receive(on:)`, the\n        /// collection is then converted to a `ThreadSafeReference` and\n        /// delivered to the target scheduler with no integration into the\n        /// autorefresh cycle, meaning it may arrive some time after the\n        /// refresh occurs.\n        ///\n        /// When in doubt, you probably want `subscribe(on:)`\n        ///\n        /// - parameter scheduler: The serial dispatch queue to receive values on.\n        /// - returns: A publisher which delivers values to the given scheduler.\n        public func receive<S: Scheduler>(on scheduler: S) -> DeferredHandoverCollectionChangeset<CollectionChangesetWithToken, Collection, S> {\n            DeferredHandoverCollectionChangeset(self, scheduler)\n        }\n    }\n\n    /// A publisher which emits SectionedResultsChange<T> each time the observed object is modified\n    ///\n    /// `receive(on:)` and `subscribe(on:)` can be called directly on this\n    /// publisher, and calling `.threadSafeReference()` is only required if\n    /// there is an intermediate transform. If `subscribe(on:)` is used, it\n    /// should always be the first operation in the pipeline.\n    ///\n    /// Create this publisher using the `changesetPublisher` property on RealmSectionedResult.\n    public class SectionedResultsChangesetWithToken<Collection: RealmSectionedResult, T>: Publisher {\n        public typealias Output = SectionedResultsChange<Collection>\n        /// This publisher reports error via the `.error` case of RealmCollectionChange.\n        public typealias Failure = Never\n\n        internal typealias TokenParent = T\n        internal typealias TokenKeyPath = WritableKeyPath<T, NotificationToken?>\n\n        private var tokenParent: TokenParent\n        private var tokenKeyPath: TokenKeyPath\n\n        private let collection: Collection\n        private let queue: DispatchQueue?\n        internal init(_ collection: Collection,\n                      _ queue: DispatchQueue? = nil,\n                      _ tokenParent: TokenParent,\n                      _ tokenKeyPath: TokenKeyPath) {\n            precondition(collection.realm != nil, \"Only managed collections can be published\")\n            self.collection = collection\n            self.queue = queue\n            self.tokenParent = tokenParent\n            self.tokenKeyPath = tokenKeyPath\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Never, Output == S.Input {\n            let token = self.collection.observe(on: self.queue) { change in\n                _ = subscriber.receive(change)\n            }\n            tokenParent[keyPath: tokenKeyPath] = token\n            subscriber.receive(subscription: ObservationSubscription(token: token))\n        }\n\n        /// Specifies the scheduler on which to perform subscribe, cancel, and request operations.\n        ///\n        /// For Realm Publishers, this determines which queue the underlying\n        /// change notifications are sent to. If `receive(on:)` is not used\n        /// subsequently, it also will determine which queue elements received\n        /// from the publisher are evaluated on. Currently only serial dispatch\n        /// queues are supported, and the `options:` parameter is not\n        /// supported.\n        ///\n        /// - parameter scheduler: The serial dispatch queue to perform the subscription on.\n        /// - returns: A publisher which subscribes on the given scheduler.\n        public func subscribe<S: Scheduler>(on scheduler: S) -> SectionedResultsChangesetWithToken<Collection, T> {\n            guard let queue = scheduler as? DispatchQueue else {\n                fatalError(\"Cannot subscribe on scheduler \\(scheduler): only serial dispatch queues are currently implemented.\")\n            }\n            return SectionedResultsChangesetWithToken(collection, queue, tokenParent, tokenKeyPath)\n        }\n\n        /// Specifies the scheduler on which to perform downstream operations.\n        ///\n        /// This differs from `subscribe(on:)` in how it is integrated with the\n        /// autorefresh cycle. When using `subscribe(on:)`, the subscription is\n        /// performed on the target scheduler and the publisher will emit the\n        /// collection during the refresh. When using `receive(on:)`, the\n        /// collection is then converted to a `ThreadSafeReference` and\n        /// delivered to the target scheduler with no integration into the\n        /// autorefresh cycle, meaning it may arrive some time after the\n        /// refresh occurs.\n        ///\n        /// When in doubt, you probably want `subscribe(on:)`\n        ///\n        /// - parameter scheduler: The serial dispatch queue to receive values on.\n        /// - returns: A publisher which delivers values to the given scheduler.\n        public func receive<S: Scheduler>(on scheduler: S) -> DeferredHandoverSectionedResultsChangeset<SectionedResultsChangesetWithToken, Collection, S> {\n            DeferredHandoverSectionedResultsChangeset(self, scheduler)\n        }\n    }\n\n    /// A publisher which emits SectionedResultsChange<T> each time the observed object is modified\n    ///\n    /// `receive(on:)` and `subscribe(on:)` can be called directly on this\n    /// publisher, and calling `.threadSafeReference()` is only required if\n    /// there is an intermediate transform. If `subscribe(on:)` is used, it\n    /// should always be the first operation in the pipeline.\n    ///\n    /// Create this publisher using the `changesetPublisher` property on RealmSectionedResult.\n    public class SectionChangesetWithToken<Collection: RealmSectionedResult, T>: Publisher {\n        public typealias Output = SectionedResultsChange<Collection>\n        /// This publisher reports error via the `.error` case of RealmCollectionChange.\n        public typealias Failure = Never\n\n        internal typealias TokenParent = T\n        internal typealias TokenKeyPath = WritableKeyPath<T, NotificationToken?>\n\n        private var tokenParent: TokenParent\n        private var tokenKeyPath: TokenKeyPath\n\n        private let collection: Collection\n        private let queue: DispatchQueue?\n        internal init(_ collection: Collection,\n                      _ queue: DispatchQueue? = nil,\n                      _ tokenParent: TokenParent,\n                      _ tokenKeyPath: TokenKeyPath) {\n            precondition(collection.realm != nil, \"Only managed collections can be published\")\n            self.collection = collection\n            self.queue = queue\n            self.tokenParent = tokenParent\n            self.tokenKeyPath = tokenKeyPath\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Never, Output == S.Input {\n            let token = self.collection.observe(on: self.queue) { change in\n                _ = subscriber.receive(change)\n            }\n            tokenParent[keyPath: tokenKeyPath] = token\n            subscriber.receive(subscription: ObservationSubscription(token: token))\n        }\n\n        /// Specifies the scheduler on which to perform subscribe, cancel, and request operations.\n        ///\n        /// For Realm Publishers, this determines which queue the underlying\n        /// change notifications are sent to. If `receive(on:)` is not used\n        /// subsequently, it also will determine which queue elements received\n        /// from the publisher are evaluated on. Currently only serial dispatch\n        /// queues are supported, and the `options:` parameter is not\n        /// supported.\n        ///\n        /// - parameter scheduler: The serial dispatch queue to perform the subscription on.\n        /// - returns: A publisher which subscribes on the given scheduler.\n        public func subscribe<S: Scheduler>(on scheduler: S) -> SectionedResultsChangesetWithToken<Collection, T> {\n            guard let queue = scheduler as? DispatchQueue else {\n                fatalError(\"Cannot subscribe on scheduler \\(scheduler): only serial dispatch queues are currently implemented.\")\n            }\n            return SectionedResultsChangesetWithToken(collection, queue, tokenParent, tokenKeyPath)\n        }\n\n        /// Specifies the scheduler on which to perform downstream operations.\n        ///\n        /// This differs from `subscribe(on:)` in how it is integrated with the\n        /// autorefresh cycle. When using `subscribe(on:)`, the subscription is\n        /// performed on the target scheduler and the publisher will emit the\n        /// collection during the refresh. When using `receive(on:)`, the\n        /// collection is then converted to a `ThreadSafeReference` and\n        /// delivered to the target scheduler with no integration into the\n        /// autorefresh cycle, meaning it may arrive some time after the\n        /// refresh occurs.\n        ///\n        /// When in doubt, you probably want `subscribe(on:)`\n        ///\n        /// - parameter scheduler: The serial dispatch queue to receive values on.\n        /// - returns: A publisher which delivers values to the given scheduler.\n        public func receive<S: Scheduler>(on scheduler: S) -> DeferredHandoverSectionChangeset<SectionChangesetWithToken, Collection, S> {\n            DeferredHandoverSectionChangeset(self, scheduler)\n        }\n    }\n\n    /// A publisher which emits RealmMapChange<T> each time the observed object is modified\n    ///\n    /// `receive(on:)` and `subscribe(on:)` can be called directly on this\n    /// publisher, and calling `.threadSafeReference()` is only required if\n    /// there is an intermediate transform. If `subscribe(on:)` is used, it\n    /// should always be the first operation in the pipeline.\n    ///\n    /// Create this publisher using the `changesetPublisher` property on RealmCollection.\n    public class MapChangesetWithToken<Collection: RealmKeyedCollection, T>: Publisher {\n        public typealias Output = RealmMapChange<Collection>\n        /// This publisher reports error via the `.error` case of RealmCollectionChange.\n        public typealias Failure = Never\n\n        internal typealias TokenParent = T\n        internal typealias TokenKeyPath = WritableKeyPath<T, NotificationToken?>\n\n        private var tokenParent: TokenParent\n        private var tokenKeyPath: TokenKeyPath\n\n        private let collection: Collection\n        private let queue: DispatchQueue?\n        internal init(_ collection: Collection,\n                      _ queue: DispatchQueue? = nil,\n                      _ tokenParent: TokenParent,\n                      _ tokenKeyPath: TokenKeyPath) {\n            precondition(collection.realm != nil, \"Only managed collections can be published\")\n            self.collection = collection\n            self.queue = queue\n            self.tokenParent = tokenParent\n            self.tokenKeyPath = tokenKeyPath\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Never, Output == S.Input {\n            let token = self.collection.observe(on: self.queue) { change in\n                _ = subscriber.receive(change)\n            }\n            tokenParent[keyPath: tokenKeyPath] = token\n            subscriber.receive(subscription: ObservationSubscription(token: token))\n        }\n\n        /// Specifies the scheduler on which to perform subscribe, cancel, and request operations.\n        ///\n        /// For Realm Publishers, this determines which queue the underlying\n        /// change notifications are sent to. If `receive(on:)` is not used\n        /// subsequently, it also will determine which queue elements received\n        /// from the publisher are evaluated on. Currently only serial dispatch\n        /// queues are supported, and the `options:` parameter is not\n        /// supported.\n        ///\n        /// - parameter scheduler: The serial dispatch queue to perform the subscription on.\n        /// - returns: A publisher which subscribes on the given scheduler.\n        public func subscribe<S: Scheduler>(on scheduler: S) -> MapChangesetWithToken<Collection, T> {\n            guard let queue = scheduler as? DispatchQueue else {\n                fatalError(\"Cannot subscribe on scheduler \\(scheduler): only serial dispatch queues are currently implemented.\")\n            }\n            return MapChangesetWithToken(collection, queue, tokenParent, tokenKeyPath)\n        }\n\n        /// Specifies the scheduler on which to perform downstream operations.\n        ///\n        /// This differs from `subscribe(on:)` in how it is integrated with the\n        /// autorefresh cycle. When using `subscribe(on:)`, the subscription is\n        /// performed on the target scheduler and the publisher will emit the\n        /// collection during the refresh. When using `receive(on:)`, the\n        /// collection is then converted to a `ThreadSafeReference` and\n        /// delivered to the target scheduler with no integration into the\n        /// autorefresh cycle, meaning it may arrive some time after the\n        /// refresh occurs.\n        ///\n        /// When in doubt, you probably want `subscribe(on:)`\n        ///\n        /// - parameter scheduler: The serial dispatch queue to receive values on.\n        /// - returns: A publisher which delivers values to the given scheduler.\n        public func receive<S: Scheduler>(on scheduler: S) -> DeferredHandoverKeyedCollectionChangeset<MapChangesetWithToken, Collection, S> {\n            DeferredHandoverKeyedCollectionChangeset(self, scheduler)\n        }\n    }\n\n    /// A helper publisher created by calling `.threadSafeReference()` on a\n    /// publisher which emits `RealmCollectionChange`.\n    @frozen public struct MakeThreadSafeCollectionChangeset<Upstream: Publisher, T: RealmCollection>: Publisher where Upstream.Output == RealmCollectionChange<T> {\n        /// :nodoc:\n        public typealias Failure = Upstream.Failure\n        /// :nodoc:\n        public typealias Output = Upstream.Output\n\n        private let upstream: Upstream\n        internal init(_ upstream: Upstream) {\n            self.upstream = upstream\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Failure, Output == S.Input {\n            self.upstream.receive(subscriber: subscriber)\n        }\n\n        /// Specifies the scheduler on which to receive elements from the publisher.\n        ///\n        /// This publisher converts each value emitted by the upstream\n        /// publisher to a `ThreadSafeReference`, passes it to the target\n        /// scheduler, and then converts back to the original type.\n        ///\n        /// - parameter scheduler: The serial dispatch queue to receive values on.\n        /// - returns: A publisher which delivers values to the given scheduler.\n        public func receive<S: Scheduler>(on scheduler: S) -> DeferredHandoverCollectionChangeset<Upstream, T, S> {\n            DeferredHandoverCollectionChangeset(self.upstream, scheduler)\n        }\n    }\n\n    /// A helper publisher created by calling `.threadSafeReference()` on a\n    /// publisher which emits `RealmMapChange`.\n    @frozen public struct MakeThreadSafeKeyedCollectionChangeset<Upstream: Publisher, T: RealmKeyedCollection>: Publisher where Upstream.Output == RealmMapChange<T> {\n        /// :nodoc:\n        public typealias Failure = Upstream.Failure\n        /// :nodoc:\n        public typealias Output = Upstream.Output\n\n        private let upstream: Upstream\n        internal init(_ upstream: Upstream) {\n            self.upstream = upstream\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Failure, Output == S.Input {\n            self.upstream.receive(subscriber: subscriber)\n        }\n\n        /// Specifies the scheduler on which to receive elements from the publisher.\n        ///\n        /// This publisher converts each value emitted by the upstream\n        /// publisher to a `ThreadSafeReference`, passes it to the target\n        /// scheduler, and then converts back to the original type.\n        ///\n        /// - parameter scheduler: The serial dispatch queue to receive values on.\n        /// - returns: A publisher which delivers values to the given scheduler.\n        public func receive<S: Scheduler>(on scheduler: S) -> DeferredHandoverKeyedCollectionChangeset<Upstream, T, S> {\n            DeferredHandoverKeyedCollectionChangeset(self.upstream, scheduler)\n        }\n    }\n\n    /// A helper publisher created by calling `.threadSafeReference()` on a\n    /// publisher which emits `SectionedResultsChange`.\n    @frozen public struct MakeThreadSafeSectionedResultsChangeset<Upstream: Publisher, T: RealmSectionedResult>: Publisher where Upstream.Output == SectionedResultsChange<T> {\n        /// :nodoc:\n        public typealias Failure = Upstream.Failure\n        /// :nodoc:\n        public typealias Output = Upstream.Output\n\n        private let upstream: Upstream\n        internal init(_ upstream: Upstream) {\n            self.upstream = upstream\n        }\n\n        /// :nodoc:\n        public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Failure, Output == S.Input {\n            self.upstream.receive(subscriber: subscriber)\n        }\n\n        /// Specifies the scheduler on which to receive elements from the publisher.\n        ///\n        /// This publisher converts each value emitted by the upstream\n        /// publisher to a `ThreadSafeReference`, passes it to the target\n        /// scheduler, and then converts back to the original type.\n        ///\n        /// - parameter scheduler: The serial dispatch queue to receive values on.\n        /// - returns: A publisher which delivers values to the given scheduler.\n        public func receive<S: Scheduler>(on scheduler: S) -> DeferredHandoverSectionedResultsChangeset<Upstream, T, S> {\n            DeferredHandoverSectionedResultsChangeset(self.upstream, scheduler)\n        }\n    }\n\n    /// A publisher which delivers thread-confined collection changesets to a\n    /// serial dispatch queue.\n    ///\n    /// Create using `.threadSafeReference().receive(on: queue)` on a publisher\n    /// that emits `RealmCollectionChange`.\n    @frozen public struct DeferredHandoverCollectionChangeset<Upstream: Publisher, T: RealmCollection, S: Scheduler>: Publisher where Upstream.Output == RealmCollectionChange<T> {\n        /// :nodoc:\n        public typealias Failure = Upstream.Failure\n        /// :nodoc:\n        public typealias Output = Upstream.Output\n\n        private let upstream: Upstream\n        private let scheduler: S\n        internal init(_ upstream: Upstream, _ scheduler: S) {\n            self.upstream = upstream\n            self.scheduler = scheduler\n        }\n\n        private enum Handover {\n            // A collection change which does not contain a live object and so\n            // can be delivered directly\n            case passthrough(_ change: RealmCollectionChange<T>)\n            // The initial and update notifications for live collections need\n            // to wrap the collection in a thread-safe reference and hold onto\n            // a pinned Realm to ensure that the version which the change\n            // information is for stays pinned until it's delivered.\n            case initial(_ pin: RLMPinnedRealm, _ tsr: ThreadSafeReference<T>)\n            case update(_ pin: RLMPinnedRealm, _ tsr: ThreadSafeReference<T>, deletions: [Int],\n                        insertions: [Int], modifications: [Int])\n        }\n\n        /// :nodoc:\n        public func receive<Sub>(subscriber: Sub) where Sub: Subscriber, Sub.Failure == Failure, Output == Sub.Input {\n            let scheduler = self.scheduler\n            self.upstream\n                .map { (change: Output) -> Handover in\n                    switch change {\n                    case .initial(let collection):\n                        guard let realm = collection.realm, !realm.isFrozen else { return .passthrough(change) }\n                        return .initial(RLMPinnedRealm(realm: realm.rlmRealm),\n                                        ThreadSafeReference(to: collection))\n                    case .update(let collection, deletions: let deletions, insertions: let insertions, modifications: let modifications):\n                        guard let realm = collection.realm, !realm.isFrozen else { return .passthrough(change) }\n                        return .update(RLMPinnedRealm(realm: realm.rlmRealm),\n                                       ThreadSafeReference(to: collection),\n                                       deletions: deletions, insertions: insertions,\n                                       modifications: modifications)\n                    case .error:\n                        return .passthrough(change)\n                    }\n                }\n                .receive(on: scheduler)\n                .compactMap { (handover: Handover) -> Output? in\n                    switch handover {\n                    case .passthrough(let change):\n                        return change\n                    case .initial(let pin, let tsr):\n                        defer { pin.unpin() }\n                        if let resolved = realm(pin.configuration, scheduler)?.resolve(tsr) {\n                            return .initial(resolved)\n                        }\n                        return nil\n                    case .update(let pin, let tsr, deletions: let deletions, insertions: let insertions, modifications: let modifications):\n                        defer { pin.unpin() }\n                        if let resolved = realm(pin.configuration, scheduler)?.resolve(tsr) {\n                            return .update(resolved, deletions: deletions, insertions: insertions, modifications: modifications)\n                        }\n                        return nil\n                    }\n                }\n                .receive(subscriber: subscriber)\n        }\n    }\n\n    /// A publisher which delivers thread-confined `Map` changesets to a\n    /// serial dispatch queue.\n    ///\n    /// Create using `.threadSafeReference().receive(on: queue)` on a publisher\n    /// that emits `RealmMapChange`.\n    @frozen public struct DeferredHandoverKeyedCollectionChangeset<Upstream: Publisher, T: RealmKeyedCollection, S: Scheduler>: Publisher where Upstream.Output == RealmMapChange<T> {\n        /// :nodoc:\n        public typealias Failure = Upstream.Failure\n        /// :nodoc:\n        public typealias Output = Upstream.Output\n\n        private let upstream: Upstream\n        private let scheduler: S\n        internal init(_ upstream: Upstream, _ scheduler: S) {\n            self.upstream = upstream\n            self.scheduler = scheduler\n        }\n\n        private enum Handover {\n            // A collection change which does not contain a live object and so\n            // can be delivered directly\n            case passthrough(_ change: RealmMapChange<T>)\n            // The initial and update notifications for live collections need\n            // to wrap the collection in a thread-safe reference and hold onto\n            // a pinned Realm to ensure that the version which the change\n            // information is for stays pinned until it's delivered.\n            case initial(_ pin: RLMPinnedRealm, _ tsr: ThreadSafeReference<T>)\n            case update(_ pin: RLMPinnedRealm, _ tsr: ThreadSafeReference<T>,\n                        deletions: [T.Key], insertions: [T.Key], modifications: [T.Key])\n        }\n\n        /// :nodoc:\n        public func receive<Sub>(subscriber: Sub) where Sub: Subscriber, Sub.Failure == Failure, Output == Sub.Input {\n            let scheduler = self.scheduler\n            self.upstream\n                .map { (change: Output) -> Handover in\n                    switch change {\n                    case .initial(let collection):\n                        guard let realm = collection.realm, !realm.isFrozen else { return .passthrough(change) }\n                        return .initial(RLMPinnedRealm(realm: realm.rlmRealm),\n                                        ThreadSafeReference(to: collection))\n                    case .update(let collection, deletions: let deletions, insertions: let insertions, modifications: let modifications):\n                        guard let realm = collection.realm, !realm.isFrozen else { return .passthrough(change) }\n                        return .update(RLMPinnedRealm(realm: realm.rlmRealm),\n                                       ThreadSafeReference(to: collection),\n                                       deletions: deletions, insertions: insertions, modifications: modifications)\n                    case .error:\n                        return .passthrough(change)\n                    }\n                }\n                .receive(on: scheduler)\n                .compactMap { (handover: Handover) -> Output? in\n                    switch handover {\n                    case .passthrough(let change):\n                        return change\n                    case .initial(let pin, let tsr):\n                        defer { pin.unpin() }\n                        if let resolved = realm(pin.configuration, scheduler)?.resolve(tsr) {\n                            return .initial(resolved)\n                        }\n                        return nil\n                    case .update(let pin, let tsr, deletions: let deletions,\n                                 insertions: let insertions, modifications: let modifications):\n                        defer { pin.unpin() }\n                        if let resolved = realm(pin.configuration, scheduler)?.resolve(tsr) {\n                            return .update(resolved, deletions: deletions, insertions: insertions,\n                                           modifications: modifications)\n                        }\n                        return nil\n                    }\n                }\n                .receive(subscriber: subscriber)\n        }\n    }\n\n    private enum SectionedHandover<T: RealmSectionedResult, S: Scheduler> {\n        // A collection change which does not contain a live object and so\n        // can be delivered directly\n        case passthrough(_ change: SectionedResultsChange<T>)\n        // The initial and update notifications for live collections need\n        // to wrap the collection in a thread-safe reference and hold onto\n        // a pinned Realm to ensure that the version which the change\n        // information is for stays pinned until it's delivered.\n        case initial(_ pin: RLMPinnedRealm, _ tsr: ThreadSafeReference<T>)\n        case update(_ pin: RLMPinnedRealm, _ tsr: ThreadSafeReference<T>,\n                    deletions: [IndexPath], insertions: [IndexPath], modifications: [IndexPath],\n                    sectionsToInsert: IndexSet, sectionsToDelete: IndexSet)\n\n        init(_ change: SectionedResultsChange<T>) {\n            switch change {\n            case .initial(let collection):\n                guard let realm = collection.realm, !realm.isFrozen else {\n                    self = .passthrough(change)\n                    return\n                }\n                self = .initial(RLMPinnedRealm(realm: realm.rlmRealm),\n                                ThreadSafeReference(to: collection))\n            case .update(let collection, deletions: let deletions, insertions: let insertions,\n                         modifications: let modifications,\n                         sectionsToInsert: let sectionsToInsert, sectionsToDelete: let sectionsToDelete):\n                guard let realm = collection.realm, !realm.isFrozen else {\n                    self = .passthrough(change)\n                    return\n                }\n                self = .update(RLMPinnedRealm(realm: realm.rlmRealm),\n                               ThreadSafeReference(to: collection),\n                               deletions: deletions, insertions: insertions, modifications: modifications,\n                               sectionsToInsert: sectionsToInsert, sectionsToDelete: sectionsToDelete)\n            }\n        }\n\n        func resolve(_ scheduler: S) -> SectionedResultsChange<T>? {\n            switch self {\n            case .passthrough(let change):\n                return change\n            case .initial(let pin, let tsr):\n                defer { pin.unpin() }\n                if let resolved = realm(pin.configuration, scheduler)?.resolve(tsr) {\n                    return .initial(resolved)\n                }\n                return nil\n            case .update(let pin, let tsr, deletions: let deletions, insertions: let insertions, modifications: let modifications,\n                         sectionsToInsert: let sectionsToInsert, sectionsToDelete: let sectionsToDelete):\n                defer { pin.unpin() }\n                if let resolved = realm(pin.configuration, scheduler)?.resolve(tsr) {\n                    return .update(resolved, deletions: deletions, insertions: insertions, modifications: modifications,\n                                   sectionsToInsert: sectionsToInsert, sectionsToDelete: sectionsToDelete)\n                }\n                return nil\n            }\n        }\n    }\n\n    // swiftlint:disable type_name\n    /// A publisher which delivers thread-confined collection changesets to a\n    /// serial dispatch queue.\n    ///\n    /// Create using `.threadSafeReference().receive(on: queue)` on a publisher\n    /// that emits `RealmCollectionChange`.\n    @frozen public struct DeferredHandoverSectionedResultsChangeset<Upstream: Publisher, T: RealmSectionedResult, S: Scheduler>: Publisher where Upstream.Output == SectionedResultsChange<T> {\n        /// :nodoc:\n        public typealias Failure = Upstream.Failure\n        /// :nodoc:\n        public typealias Output = Upstream.Output\n\n        private let upstream: Upstream\n        private let scheduler: S\n        internal init(_ upstream: Upstream, _ scheduler: S) {\n            self.upstream = upstream\n            self.scheduler = scheduler\n        }\n\n        /// :nodoc:\n        public func receive<Sub>(subscriber: Sub) where Sub: Subscriber, Sub.Failure == Failure, Output == Sub.Input {\n            let scheduler = self.scheduler\n            self.upstream\n                .map { SectionedHandover<T, S>($0) }\n                .receive(on: scheduler)\n                .compactMap { $0.resolve(scheduler) }\n                .receive(subscriber: subscriber)\n        }\n    }\n    // swiftlint:enable type_name\n\n    /// A publisher which delivers thread-confined collection changesets to a\n    /// serial dispatch queue.\n    ///\n    /// Create using `.threadSafeReference().receive(on: queue)` on a publisher\n    /// that emits `SectionedResultsChange`.\n    @frozen public struct DeferredHandoverSectionChangeset<Upstream: Publisher, T: RealmSectionedResult, S: Scheduler>: Publisher where Upstream.Output == SectionedResultsChange<T> {\n        /// :nodoc:\n        public typealias Failure = Upstream.Failure\n        /// :nodoc:\n        public typealias Output = Upstream.Output\n\n        private let upstream: Upstream\n        private let scheduler: S\n        internal init(_ upstream: Upstream, _ scheduler: S) {\n            self.upstream = upstream\n            self.scheduler = scheduler\n        }\n\n        /// :nodoc:\n        public func receive<Sub>(subscriber: Sub) where Sub: Subscriber, Sub.Failure == Failure, Output == Sub.Input {\n            let scheduler = self.scheduler\n            self.upstream\n                .map { SectionedHandover<T, S>($0) }\n                .receive(on: scheduler)\n                .compactMap { $0.resolve(scheduler) }\n                .receive(subscriber: subscriber)\n        }\n    }\n}\n"
  },
  {
    "path": "RealmSwift/CustomPersistable.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\n\n// MARK: Public API\n\n/**\nA type which can be mapped to and from a type which Realm supports.\n\nTo store types in a Realm which Realm doesn't natively support, declare the\ntype as conforming to either CustomPersistable or FailableCustomPersistable.\nThis requires defining an associatedtype named `PersistedType` which indicates\nwhat Realm type this type will be mapped to, an initializer taking the\n`PersistedType`, and a property which returns the appropriate `PersistedType`.\nFor example, to make `URL` persistable:\n\n```\n// Not all strings are valid URLs, so this uses\n// FailableCustomPersistable to handle the case when the data\n// in the Realm isn't a valid URL.\nextension URL: FailableCustomPersistable {\n    typealias PersistedType = String\n    init?(persistedValue: String) {\n        self.init(string: persistedValue)\n    }\n    var persistableValue: PersistedType {\n        self.absoluteString\n    }\n}\n```\n\nAfter doing this, you can define properties using URL:\n```\nclass MyModel: Object {\n    @Persisted var url: URL\n    @Persisted var mapOfUrls: Map<String, URL>\n}\n```\n\n`PersistedType` can be any of the primitive types supported by Realm or an\n`EmbeddedObject` subclass. `EmbeddedObject` subclasses can be used if you\nneed to store more than one piece of data for your mapped type. For\nexample, to store `CGPoint`:\n\n```\n// Define the storage object. A type used for custom mappings\n// does not have to be used exclusively for custom mappings,\n// and more than one type can map to a single embedded object\n// type.\nclass CGPointObject: EmbeddedObject {\n    @Persisted var double: x\n    @Persisted var double: y\n}\n\n// Define the mapping. This mapping isn't failable, as the\n// data stored in the Realm can always be interpreted as a\n// CGPoint.\nextension CGPoint: CustomPersistable {\n    typealias PersistedType = CGPointObject\n    init(persistedValue: CGPointObject) {\n        self.init(x: persistedValue.x, y: persistedValue.y)\n    }\n    var persistableValue: PersistedType {\n        CGPointObject(value: [x, y])\n    }\n}\n\nclass PointModel: Object {\n    // Note that types which are mapped to embedded objects do\n    // not have to be optional (but can be).\n    @Persisted var point: CGPoint\n    @Persisted var line: List<CGPoint>\n}\n```\n\nQueries are performed on the persisted type and not the custom persistable\ntype. Values passed into queries can be of either the persisted type or\ncustom persistable type. For custom persistable types which map to embedded\nobjects, memberwise equality will be used. For examples,\n`realm.objects(PointModel.self).where { $0.point == CGPoint(x: 1, y: 2) }`\nis equivalent to `\"point.x == 1 AND point.y == 2\"`.\n */\npublic protocol CustomPersistable: _CustomPersistable {\n    /// Construct an instance of this type from the persisted type.\n    init(persistedValue: PersistedType)\n    /// Construct an instance of the persisted type from this type.\n    var persistableValue: PersistedType { get }\n}\n\n/**\n A type which can be mapped to and from a type which Realm supports.\n\n This protocol is identical to `CustomPersistable`, except with\n `init?(persistedValue:)` instead of `init(persistedValue:)`.\n\n FailableCustomPersistable types are force-unwrapped in\n non-Optional contexts, and collapsed to `nil` in Optional contexts.\n That is, if you have a value that can't be converted to a URL, reading a\n `@Persisted var url: URL` property will throw an unwrapped failed exception, and\n reading from `Persisted var url: URL?` will return `nil`.\n*/\npublic protocol FailableCustomPersistable: _CustomPersistable {\n    /// Construct an instance of the this type from the persisted type,\n    /// returning nil if the conversion is not possible.\n    ///\n    /// This function must not return `nil` when given a default-initalized\n    /// `PersistedType()`.\n    init?(persistedValue: PersistedType)\n    /// Construct an instance of the persisted type from this type.\n    var persistableValue: PersistedType { get }\n}\n\n// MARK: - Implementation\n\n/// :nodoc:\npublic protocol _CustomPersistable: _PersistableInsideOptional, _RealmCollectionValueInsideOptional {}\n\n/// :nodoc:\nextension _CustomPersistable { // _RealmSchemaDiscoverable\n    /// :nodoc:\n    public static var _rlmType: PropertyType { PersistedType._rlmType }\n    /// :nodoc:\n    public static var _rlmOptional: Bool { PersistedType._rlmOptional }\n    /// :nodoc:\n    public static var _rlmRequireObjc: Bool { false }\n    /// :nodoc:\n    public func _rlmPopulateProperty(_ prop: RLMProperty) { }\n    /// :nodoc:\n    public static func _rlmPopulateProperty(_ prop: RLMProperty) {\n        prop.customMappingIsOptional = prop.optional\n        if prop.type == .object && (!prop.collection || prop.dictionary) {\n            prop.optional = true\n        }\n        PersistedType._rlmPopulateProperty(prop)\n    }\n}\n\nextension CustomPersistable { // _Persistable\n    /// :nodoc:\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: PropertyKey) -> Self {\n        return Self(persistedValue: PersistedType._rlmGetProperty(obj, key))\n    }\n    /// :nodoc:\n    public static func _rlmGetPropertyOptional(_ obj: ObjectBase, _ key: PropertyKey) -> Self? {\n        return PersistedType._rlmGetPropertyOptional(obj, key).flatMap(Self.init)\n    }\n    /// :nodoc:\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: PropertyKey, _ value: Self) {\n        PersistedType._rlmSetProperty(obj, key, value.persistableValue)\n    }\n    /// :nodoc:\n    public static func _rlmSetAccessor(_ prop: RLMProperty) {\n        if prop.customMappingIsOptional {\n            prop.swiftAccessor = BridgedPersistedPropertyAccessor<Optional<Self>>.self\n        } else if prop.optional {\n            prop.swiftAccessor = CustomPersistablePropertyAccessor<Self>.self\n        } else {\n            prop.swiftAccessor = BridgedPersistedPropertyAccessor<Self>.self\n        }\n    }\n    /// :nodoc:\n    public static func _rlmDefaultValue() -> Self {\n        Self(persistedValue: PersistedType._rlmDefaultValue())\n    }\n    /// :nodoc:\n    public func hash(into hasher: inout Hasher) {\n        persistableValue.hash(into: &hasher)\n    }\n}\n\nextension FailableCustomPersistable { // _Persistable\n    /// :nodoc:\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: PropertyKey) -> Self {\n        let persistedValue = PersistedType._rlmGetProperty(obj, key)\n        if let value = Self(persistedValue: persistedValue) {\n            return value\n        }\n        throwRealmException(\"Failed to convert persisted value '\\(persistedValue)' to type '\\(Self.self)' in a non-optional context.\")\n    }\n    /// :nodoc:\n    public static func _rlmGetPropertyOptional(_ obj: ObjectBase, _ key: PropertyKey) -> Self? {\n        return PersistedType._rlmGetPropertyOptional(obj, key).flatMap(Self.init)\n    }\n    /// :nodoc:\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: PropertyKey, _ value: Self) {\n        PersistedType._rlmSetProperty(obj, key, value.persistableValue)\n    }\n    /// :nodoc:\n    public static func _rlmSetAccessor(_ prop: RLMProperty) {\n        if prop.customMappingIsOptional {\n            prop.swiftAccessor = BridgedPersistedPropertyAccessor<Optional<Self>>.self\n        } else if prop.optional {\n            prop.swiftAccessor = CustomPersistablePropertyAccessor<Self>.self\n        } else {\n            prop.swiftAccessor = BridgedPersistedPropertyAccessor<Self>.self\n        }\n    }\n\n    /// :nodoc:\n    public static func _rlmDefaultValue() -> Self {\n        if let value = Self(persistedValue: PersistedType._rlmDefaultValue()) {\n            return value\n        }\n        throwRealmException(\"Failed to default construct a \\(Self.self) using the default value for persisted type \\(PersistedType.self). \" +\n                            \"This conversion must either succeed, the property must be optional, or you must explicitly specify a default value for the property.\")\n    }\n    /// :nodoc:\n    public func hash(into hasher: inout Hasher) {\n        persistableValue.hash(into: &hasher)\n    }\n}\n\nextension CustomPersistable { // _ObjcBridgeable\n    /// :nodoc:\n    public static func _rlmFromObjc(_ value: Any, insideOptional: Bool) -> Self? {\n        if let value = PersistedType._rlmFromObjc(value) {\n            return Self(persistedValue: value)\n        }\n        if let value = value as? Self {\n            return value\n        }\n        if !insideOptional && value is NSNull {\n            return Self._rlmDefaultValue()\n        }\n        return nil\n    }\n    /// :nodoc:\n    public var _rlmObjcValue: Any { persistableValue }\n}\n\nextension FailableCustomPersistable { // _ObjcBridgeable\n    /// :nodoc:\n    public static func _rlmFromObjc(_ value: Any, insideOptional: Bool) -> Self? {\n        if let value = PersistedType._rlmFromObjc(value) {\n            return Self(persistedValue: value)\n        }\n        if let value = value as? Self {\n            return value\n        }\n        return nil\n    }\n    /// :nodoc:\n    public var _rlmObjcValue: Any { persistableValue }\n}\n"
  },
  {
    "path": "RealmSwift/Decimal128.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\n\n/**\n A 128-bit IEEE 754-2008 decimal floating point number.\n\n This type is similar to Swift's built-in Decimal type, but allocates bits differently, resulting in a different representable range. (NS)Decimal stores a significand of up to 38 digits long and an exponent from -128 to 127, while this type stores up to 34 digits of significand and an exponent from -6143 to 6144.\n */\n@objc(RealmSwiftDecimal128)\npublic final class Decimal128: RLMDecimal128, Decodable, @unchecked Sendable {\n    /// Creates a new zero-initialized Decimal128.\n    public override required init() {\n        super.init()\n    }\n\n    /// Converts the given value to a Decimal128.\n    ///\n    /// The following types can be converted to Decimal128:\n    /// - Int (of any size)\n    /// - Float\n    /// - Double\n    /// - String\n    /// - NSNumber\n    /// - Decimal\n    ///\n    /// Passing a value with a type not in this list is a fatal error. Passing a string which cannot be parsed as a valid Decimal128 is a fatal error.\n    ///\n    /// - parameter value: The value to convert to a Decimal128.\n    public override required init(value: Any) {\n        super.init(value: value)\n    }\n\n    /// Converts the given number to a Decimal128.\n    ///\n    /// This initializer cannot fail and is never lossy.\n    ///\n    /// - parameter number: The number to convert to a Decimal128.\n    public override required init(number: NSNumber) {\n        super.init(number: number)\n    }\n\n    /// Parse the given string as a Decimal128.\n    ///\n    /// Strings which cannot be parsed as a Decimal128 return a value where `isNaN` is `true`.\n    ///\n    /// - parameter string: The string to parse.\n    public override required init(string: String) {\n        super.init(string: string)\n    }\n\n    /// Creates a new Decimal128 by decoding from the given decoder.\n    ///\n    /// This initializer throws an error if the decoder is invalid or does not decode to a value which can be converted to Decimal128.\n    ///\n    /// - Parameter decoder: The decoder to read data from.\n    public required init(from decoder: Decoder) throws {\n        let container = try decoder.singleValueContainer()\n        if let strValue = try? container.decode(String.self) {\n            super.init(string: strValue)\n        } else if let intValue = try? container.decode(Int64.self) {\n            super.init(number: intValue as NSNumber)\n        } else if let doubleValue = try? container.decode(Double.self) {\n            super.init(number: doubleValue as NSNumber)\n        } else {\n            throw DecodingError.dataCorruptedError(in: container, debugDescription: \"Cannot convert value to Decimal128\")\n        }\n    }\n\n    /// The minimum value for Decimal128\n    public static var min: Decimal128 {\n        unsafeDowncast(__minimumDecimalNumber, to: Self.self)\n    }\n\n    /// The maximum value for Decimal128\n    public static var max: Decimal128 {\n        unsafeDowncast(__maximumDecimalNumber, to: Self.self)\n    }\n}\n\nextension Decimal128: Encodable {\n    /// Encodes this Decimal128 to the given encoder.\n    ///\n    /// This function throws an error if the given encoder is unable to encode a string.\n    ///\n    /// - Parameter encoder: The encoder to write data to.\n    public func encode(to encoder: Encoder) throws {\n        var container = encoder.singleValueContainer()\n        try container.encode(stringValue)\n    }\n}\n\nextension Decimal128: ExpressibleByIntegerLiteral {\n    /// Creates a new Decimal128 from the given integer literal.\n    public convenience init(integerLiteral value: Int64) {\n        self.init(number: value as NSNumber)\n    }\n}\n\nextension Decimal128: ExpressibleByFloatLiteral {\n    /// Creates a new Decimal128 from the given float literal.\n    public convenience init(floatLiteral value: Double) {\n        self.init(number: value as NSNumber)\n    }\n}\n\nextension Decimal128: ExpressibleByStringLiteral {\n    /// Creates a new Decimal128 from the given string literal.\n    public convenience init(stringLiteral value: String) {\n        self.init(string: value)\n    }\n}\n\nextension Decimal128: Comparable {\n    /// Returns a Boolean value indicating whether two decimal128 values are equal.\n    ///\n    /// - Parameters:\n    ///   - lhs: A Decimal128 value to compare.\n    ///   - rhs: Another Decimal128 value to compare.\n    public static func == (lhs: Decimal128, rhs: Decimal128) -> Bool {\n        lhs.isEqual(rhs)\n    }\n\n    /// Returns a Boolean value indicating whether the decimal128 value of the first\n    /// argument is less than that of the second argument.\n    ///\n    /// - Parameters:\n    ///   - lhs: A Decimal128 value to compare.\n    ///   - rhs: Another Decimal128 value to compare.\n    public static func < (lhs: Decimal128, rhs: Decimal128) -> Bool {\n        lhs.isLessThan(rhs)\n    }\n\n    /// Returns a Boolean value indicating whether the decimal128 value of the first\n    /// argument is less than or equal to that of the second argument.\n    ///\n    /// - Parameters:\n    ///   - lhs: A Decimal128 value to compare.\n    ///   - rhs: Another Decimal128 value to compare.\n    public static func <= (lhs: Decimal128, rhs: Decimal128) -> Bool {\n        lhs.isLessThanOrEqual(to: rhs)\n    }\n\n    /// Returns a Boolean value indicating whether the decimal128 value of the first\n    /// argument is greater than or equal to that of the second argument.\n    ///\n    /// - Parameters:\n    ///   - lhs: A Decimal128 value to compare.\n    ///   - rhs: Another Decimal128 value to compare.\n    public static func >= (lhs: Decimal128, rhs: Decimal128) -> Bool {\n        lhs.isGreaterThanOrEqual(to: rhs)\n    }\n\n    /// Returns a Boolean value indicating whether the decimal128 value of the first\n    /// argument is greater than that of the second argument.\n    ///\n    /// - Parameters:\n    ///   - lhs: A Decimal128 value to compare.\n    ///   - rhs: Another Decimal128 value to compare.\n    public static func > (lhs: Decimal128, rhs: Decimal128) -> Bool {\n        lhs.isGreaterThan(rhs)\n    }\n}\n\nextension Decimal128: Numeric {\n    /// Creates a new instance from the given integer, if it can be represented\n    /// exactly.\n    ///\n    /// If the value passed as `source` is not representable exactly, the result\n    /// is `nil`. In the following example, the constant `x` is successfully\n    /// created from a value of `100`, while the attempt to initialize the\n    /// constant `y` from `1_000` fails because the `Int8` type can represent\n    /// `127` at maximum:\n    ///\n    /// - Parameter source: A value to convert to this type of integer.\n    public convenience init?<T>(exactly source: T) where T: BinaryInteger {\n        self.init(value: source)\n    }\n\n    /// A type that can represent the absolute value of Decimal128\n    public typealias Magnitude = Decimal128\n\n    /// The magnitude of this Decimal128.\n    public var magnitude: Magnitude {\n        unsafeDowncast(self.__magnitude, to: Magnitude.self)\n    }\n\n    /// Adds two decimal128 values and produces their sum.\n    ///\n    /// - Parameters:\n    ///   - lhs: The first Decimal128 value to add.\n    ///   - rhs: The second Decimal128 value to add.\n    public static func + (lhs: Decimal128, rhs: Decimal128) -> Decimal128 {\n        unsafeDowncast(lhs.decimalNumber(byAdding: rhs), to: Decimal128.self)\n    }\n\n    /// Subtracts one Decimal128 value from another and produces their difference.\n    ///\n    /// - Parameters:\n    ///   - lhs: A Decimal128 value.\n    ///   - rhs: The Decimal128 value to subtract from `lhs`.\n    public static func - (lhs: Decimal128, rhs: Decimal128) -> Decimal128 {\n        unsafeDowncast(lhs.decimalNumber(bySubtracting: rhs), to: Decimal128.self)\n    }\n\n    /// Multiplies two Decimal128 values and produces their product.\n    ///\n    /// - Parameters:\n    ///   - lhs: The first value to multiply.\n    ///   - rhs: The second value to multiply.\n    public static func * (lhs: Decimal128, rhs: Decimal128) -> Decimal128 {\n        unsafeDowncast(lhs.decimalNumberByMultiplying(by: rhs), to: Decimal128.self)\n    }\n\n    /// Multiplies two values and stores the result in the left-hand-side\n    /// variable.\n    ///\n    /// - Parameters:\n    ///   - lhs: The first value to multiply.\n    ///   - rhs: The second value to multiply.\n    public static func *= (lhs: inout Decimal128, rhs: Decimal128) {\n        lhs = lhs * rhs\n    }\n\n    /// Returns the quotient of dividing the first Decimal128 value by the second.\n    ///\n    /// - Parameters:\n    ///   - lhs: The Decimal128 value to divide.\n    ///   - rhs: The Decimal128 value to divide `lhs` by. `rhs` must not be zero.\n    public static func / (lhs: Decimal128, rhs: Decimal128) -> Decimal128 {\n        unsafeDowncast(lhs.decimalNumberByDividing(by: rhs), to: Decimal128.self)\n    }\n}\n\nextension Decimal128 {\n    /// A type that represents the distance between two values.\n    public typealias Stride = Decimal128\n\n    /// Returns the distance from this Decimal128 to the given value, expressed as a\n    /// stride.\n    ///\n    /// - Parameter other: The Decimal128 value to calculate the distance to.\n    /// - Returns: The distance from this value to `other`.\n    public func distance(to other: Decimal128) -> Decimal128 {\n        unsafeDowncast(other.decimalNumber(bySubtracting: self), to: Decimal128.self)\n    }\n\n    /// Returns a Decimal128 that is offset the specified distance from this value.\n    ///\n    /// Use the `advanced(by:)` method in generic code to offset a value by a\n    /// specified distance. If you're working directly with numeric values, use\n    /// the addition operator (`+`) instead of this method.\n    ///\n    /// - Parameter n: The distance to advance this Decimal128.\n    /// - Returns: A Decimal128 that is offset from this value by `n`.\n    public func advanced(by n: Decimal128) -> Decimal128 {\n        unsafeDowncast(decimalNumber(byAdding: n), to: Decimal128.self)\n    }\n}\n\nextension Decimal128 {\n    /// `true` if `self` is a signaling NaN, `false` otherwise.\n    public var isSignaling: Bool {\n        self.isNaN\n    }\n\n    /// `true` if `self` is a signaling NaN, `false` otherwise.\n    public var isSignalingNaN: Bool {\n        self.isSignaling\n    }\n}\n"
  },
  {
    "path": "RealmSwift/EmbeddedObject.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\nimport Realm.Private\n\n/**\n `EmbeddedObject` is a base class used to define embedded Realm model objects.\n\n Embedded objects work similarly to normal objects, but are owned by a single\n parent Object (which itself may be embedded). Unlike normal top-level objects,\n embedded objects cannot be directly created in or added to a Realm. Instead,\n they can only be created as part of a parent object, or by assigning an\n unmanaged object to a parent object's property. Embedded objects are\n automatically deleted when the parent object is deleted or when the parent is\n modified to no longer point at the embedded object, either by reassigning an\n Object property or by removing the embedded object from the List containing it.\n\n Embedded objects can only ever have a single parent object which links to\n them, and attempting to link to an existing managed embedded object will throw\n an exception.\n\n The property types supported on `EmbeddedObject` are the same as for `Object`,\n except for that embedded objects cannot link to top-level objects, so `Object`\n and `List<Object>` properties are not supported (`EmbeddedObject` and\n `List<EmbeddedObject>` *are*).\n\n Embedded objects cannot have primary keys or indexed properties.\n\n ```swift\n class Owner: Object {\n     @Persisted var name: String\n     @Persisted var dogs: List<Dog>\n }\n class Dog: EmbeddedObject {\n     @Persisted var name: String\n     @Persisted var adopted: Bool\n     @Persisted(originProperty: \"dogs\") var owner: LinkingObjects<Owner>\n }\n ```\n */\npublic typealias EmbeddedObject = RealmSwiftEmbeddedObject\nextension EmbeddedObject: _RealmCollectionValueInsideOptional {\n    /// :nodoc:\n    public static override func isEmbedded() -> Bool {\n        true\n    }\n\n    // MARK: Initializers\n\n    /**\n     Creates an unmanaged instance of a Realm object.\n\n     The `value` argument is used to populate the object. It can be a key-value coding compliant object, an array or\n     dictionary returned from the methods in `NSJSONSerialization`, or an `Array` containing one element for each\n     managed property. An exception will be thrown if any required properties are not present and those properties were\n     not defined with default values.\n\n     When passing in an `Array` as the `value` argument, all properties must be present, valid and in the same order as\n     the properties defined in the model.\n\n     An unmanaged embedded object can be added to a Realm by assigning it to a property of a managed object or by adding it to a managed List.\n\n     - parameter value:  The value used to populate the object.\n     */\n    public convenience init(value: Any) {\n        self.init()\n        RLMInitializeWithValue(self, value, .partialPrivateShared())\n    }\n\n\n    // MARK: Properties\n\n    /// The Realm which manages the object, or `nil` if the object is unmanaged.\n    public var realm: Realm? {\n        if let rlmReam = RLMObjectBaseRealm(self) {\n            return Realm(rlmReam)\n        }\n        return nil\n    }\n\n    /// The object schema which lists the managed properties for the object.\n    public var objectSchema: ObjectSchema {\n        return ObjectSchema(RLMObjectBaseObjectSchema(self)!)\n    }\n\n    /// Indicates if the object can no longer be accessed because it is now invalid.\n    ///\n    /// An object can no longer be accessed if the object has been deleted from the Realm that manages it, or if\n    /// `invalidate()` is called on that Realm.\n    public override final var isInvalidated: Bool { return super.isInvalidated }\n\n    /// A human-readable description of the object.\n    open override var description: String { return super.description }\n\n    /**\n     WARNING: This is an internal helper method not intended for public use.\n     It is not considered part of the public API.\n     :nodoc:\n     */\n    public override static func _getProperties() -> [RLMProperty] {\n        ObjectUtil.getSwiftProperties(self)\n    }\n\n    // MARK: Object Customization\n\n    /**\n     Override this method to specify the names of properties to ignore. These properties will not be managed by\n     the Realm that manages the object.\n\n     - warning: This function is only applicable to legacy property declarations\n                using `@objc`. When using `@Persisted`, any properties not\n                marked with `@Persisted` are automatically ignored.\n     - returns: An array of property names to ignore.\n     */\n    @objc open class func ignoredProperties() -> [String] { return [] }\n\n    /**\n     Override this method to specify a map of public-private property names.\n     This will set a different persisted property name on the Realm, and allows using the public name\n     for any operation with the property. (Ex: Queries, Sorting, ...).\n     This very helpful if you need to map property names from your `Device Sync` JSON schema\n     to local property names.\n\n     ```swift\n     class Person: EmbeddedObject {\n         @Persisted var firstName: String\n         @Persisted var birthDate: Date\n         @Persisted var age: Int\n\n         override class public func propertiesMapping() -> [String : String] {\n             [\"firstName\": \"first_name\",\n              \"birthDate\": \"birth_date\"]\n         }\n     }\n     ```\n\n     - note: Only property that have a different column name have to be added to the properties mapping\n     dictionary.\n\n     - returns: A dictionary of public-private property names.\n     */\n    @objc open override class func propertiesMapping() -> [String: String] { return [:] }\n\n    /// :nodoc:\n    @available(*, unavailable, renamed: \"propertiesMapping\", message: \"`_realmColumnNames` private API is unavailable in our Swift SDK, please use the override `.propertiesMapping()` instead.\")\n    @objc open override class func _realmColumnNames() -> [String: String] { return [:] }\n\n    // MARK: Key-Value Coding & Subscripting\n\n    /// Returns or sets the value of the property with the given name.\n    @objc open subscript(key: String) -> Any? {\n        get {\n            return RLMDynamicGetByName(self, key)\n        }\n        set {\n            dynamicSet(object: self, key: key, value: newValue)\n        }\n    }\n\n    // MARK: Notifications\n\n    /**\n     Registers a block to be called each time the object changes.\n\n     The block will be asynchronously called after each write transaction which\n     deletes the object or modifies any of the managed properties of the object,\n     including self-assignments that set a property to its existing value.\n\n     For write transactions performed on different threads or in different\n     processes, the block will be called when the managing Realm is\n     (auto)refreshed to a version including the changes, while for local write\n     transactions it will be called at some point in the future after the write\n     transaction is committed.\n\n     Notifications are delivered via the standard run loop, and so can't be\n     delivered while the run loop is blocked by other activity. When\n     notifications can't be delivered instantly, multiple notifications may be\n     coalesced into a single notification.\n\n     Unlike with `List` and `Results`, there is no \"initial\" callback made after\n     you add a new notification block.\n\n     Only objects which are managed by a Realm can be observed in this way. You\n     must retain the returned token for as long as you want updates to be sent\n     to the block. To stop receiving updates, call `invalidate()` on the token.\n\n     It is safe to capture a strong reference to the observed object within the\n     callback block. There is no retain cycle due to that the callback is\n     retained by the returned token and not by the object itself.\n\n     - warning: This method cannot be called during a write transaction, or when\n     the containing Realm is read-only.\n     - parameter queue: The serial dispatch queue to receive notification on. If\n     `nil`, notifications are delivered to the current thread.\n     - parameter block: The block to call with information about changes to the object.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    public func observe<T: RLMObjectBase>(on queue: DispatchQueue? = nil,\n                                          _ block: @escaping (ObjectChange<T>) -> Void) -> NotificationToken {\n        return _observe(on: queue, block)\n    }\n\n#if compiler(<6)\n    /**\n    Registers a block to be called each time the object changes.\n\n    The block will be asynchronously called on the given actor's executor after\n    each write transaction which deletes the object or modifies any of the managed\n    properties of the object, including self-assignments that set a property to its\n    existing value. The block is passed a copy of the object isolated to the\n    requested actor which can be safely used on that actor along with information\n    about what changed.\n\n    For write transactions performed on different threads or in different\n    processes, the block will be called when the managing Realm is\n    (auto)refreshed to a version including the changes, while for local write\n    transactions it will be called at some point in the future after the write\n    transaction is committed.\n\n    Only objects which are managed by a Realm can be observed in this way. You\n    must retain the returned token for as long as you want updates to be sent\n    to the block. To stop receiving updates, call `invalidate()` on the token.\n\n    By default, only direct changes to the object's properties will produce\n    notifications, and not changes to linked objects. Note that this is different\n    from collection change notifications. If a non-nil, non-empty keypath array is\n    passed in, only changes to the properties identified by those keypaths will\n    produce change notifications. The keypaths may traverse link properties to\n    receive information about changes to linked objects.\n\n    - warning: This method cannot be called during a write transaction, or when\n    the containing Realm is read-only.\n    - parameter actor: The actor to isolate notifications to.\n    - parameter block: The block to call with information about changes to the object.\n    - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    @_unsafeInheritExecutor\n    public func observe<A: Actor, T: Object>(\n        keyPaths: [String]? = nil, on actor: A,\n        _ block: @Sendable @escaping (isolated A, ObjectChange<T>) -> Void\n    ) async -> NotificationToken {\n        await with(self, on: actor) { actor, obj in\n            await obj._observe(keyPaths: keyPaths, on: actor, block)\n        }\n    }\n\n    /**\n    Registers a block to be called each time the object changes.\n\n    The block will be asynchronously called on the given actor's executor after\n    each write transaction which deletes the object or modifies any of the managed\n    properties of the object, including self-assignments that set a property to its\n    existing value. The block is passed a copy of the object isolated to the\n    requested actor which can be safely used on that actor along with information\n    about what changed.\n\n    For write transactions performed on different threads or in different\n    processes, the block will be called when the managing Realm is\n    (auto)refreshed to a version including the changes, while for local write\n    transactions it will be called at some point in the future after the write\n    transaction is committed.\n\n    Only objects which are managed by a Realm can be observed in this way. You\n    must retain the returned token for as long as you want updates to be sent\n    to the block. To stop receiving updates, call `invalidate()` on the token.\n\n    By default, only direct changes to the object's properties will produce\n    notifications, and not changes to linked objects. Note that this is different\n    from collection change notifications. If a non-nil, non-empty keypath array is\n    passed in, only changes to the properties identified by those keypaths will\n    produce change notifications. The keypaths may traverse link properties to\n    receive information about changes to linked objects.\n\n    - warning: This method cannot be called during a write transaction, or when\n    the containing Realm is read-only.\n    - parameter actor: The actor to isolate notifications to.\n    - parameter block: The block to call with information about changes to the object.\n    - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    @_unsafeInheritExecutor\n    public func observe<A: Actor, T: Object>(\n        keyPaths: [PartialKeyPath<T>], on actor: A,\n        _ block: @Sendable @escaping (isolated A, ObjectChange<T>) -> Void\n    ) async -> NotificationToken {\n        await observe(keyPaths: keyPaths.map(_name(for:)), on: actor, block)\n    }\n#else\n    /**\n    Registers a block to be called each time the object changes.\n\n    The block will be asynchronously called on the given actor's executor after\n    each write transaction which deletes the object or modifies any of the managed\n    properties of the object, including self-assignments that set a property to its\n    existing value. The block is passed a copy of the object isolated to the\n    requested actor which can be safely used on that actor along with information\n    about what changed.\n\n    For write transactions performed on different threads or in different\n    processes, the block will be called when the managing Realm is\n    (auto)refreshed to a version including the changes, while for local write\n    transactions it will be called at some point in the future after the write\n    transaction is committed.\n\n    Only objects which are managed by a Realm can be observed in this way. You\n    must retain the returned token for as long as you want updates to be sent\n    to the block. To stop receiving updates, call `invalidate()` on the token.\n\n    By default, only direct changes to the object's properties will produce\n    notifications, and not changes to linked objects. Note that this is different\n    from collection change notifications. If a non-nil, non-empty keypath array is\n    passed in, only changes to the properties identified by those keypaths will\n    produce change notifications. The keypaths may traverse link properties to\n    receive information about changes to linked objects.\n\n    - warning: This method cannot be called during a write transaction, or when\n    the containing Realm is read-only.\n    - parameter actor: The actor to isolate notifications to.\n    - parameter block: The block to call with information about changes to the object.\n    - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    public func observe<A: Actor, T: Object>(\n        keyPaths: [String]? = nil, on actor: A, _isolation: isolated (any Actor)? = #isolation,\n        _ block: @Sendable @escaping (isolated A, ObjectChange<T>) -> Void\n    ) async -> NotificationToken {\n        await with(self, on: actor) { actor, obj in\n            await obj._observe(keyPaths: keyPaths, on: actor, block)\n        }\n    }\n\n    /**\n    Registers a block to be called each time the object changes.\n\n    The block will be asynchronously called on the given actor's executor after\n    each write transaction which deletes the object or modifies any of the managed\n    properties of the object, including self-assignments that set a property to its\n    existing value. The block is passed a copy of the object isolated to the\n    requested actor which can be safely used on that actor along with information\n    about what changed.\n\n    For write transactions performed on different threads or in different\n    processes, the block will be called when the managing Realm is\n    (auto)refreshed to a version including the changes, while for local write\n    transactions it will be called at some point in the future after the write\n    transaction is committed.\n\n    Only objects which are managed by a Realm can be observed in this way. You\n    must retain the returned token for as long as you want updates to be sent\n    to the block. To stop receiving updates, call `invalidate()` on the token.\n\n    By default, only direct changes to the object's properties will produce\n    notifications, and not changes to linked objects. Note that this is different\n    from collection change notifications. If a non-nil, non-empty keypath array is\n    passed in, only changes to the properties identified by those keypaths will\n    produce change notifications. The keypaths may traverse link properties to\n    receive information about changes to linked objects.\n\n    - warning: This method cannot be called during a write transaction, or when\n    the containing Realm is read-only.\n    - parameter actor: The actor to isolate notifications to.\n    - parameter block: The block to call with information about changes to the object.\n    - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    public func observe<A: Actor, T: Object>(\n        keyPaths: [PartialKeyPath<T>], on actor: A, _isolation: isolated (any Actor)? = #isolation,\n        _ block: @Sendable @escaping (isolated A, ObjectChange<T>) -> Void\n    ) async -> NotificationToken {\n        await observe(keyPaths: keyPaths.map(_name(for:)), on: actor, block)\n    }\n#endif\n\n    // MARK: Dynamic list\n\n    /**\n     Returns a list of `DynamicObject`s for a given property name.\n\n     - warning:  This method is useful only in specialized circumstances, for example, when building\n     components that integrate with Realm. If you are simply building an app on Realm, it is\n     recommended to use instance variables or cast the values returned from key-value coding.\n\n     - parameter propertyName: The name of the property.\n\n     - returns: A list of `DynamicObject`s.\n\n     :nodoc:\n     */\n    public func dynamicList(_ propertyName: String) -> List<DynamicObject> {\n        let list = RLMDynamicGetByName(self, propertyName) as! RLMSwiftCollectionBase\n        return List<DynamicObject>(collection: list._rlmCollection as! RLMArray<AnyObject>)\n    }\n\n    // MARK: Comparison\n    /**\n     Returns whether two Realm objects are the same.\n\n     Objects are considered the same if and only if they are both managed by the same\n     Realm and point to the same underlying object in the database.\n\n     - note: Equality comparison is implemented by `isEqual(_:)`. If the object type\n             is defined with a primary key, `isEqual(_:)` behaves identically to this\n             method. If the object type is not defined with a primary key,\n             `isEqual(_:)` uses the `NSObject` behavior of comparing object identity.\n             This method can be used to compare two objects for database equality\n             whether or not their object type defines a primary key.\n\n     - parameter object: The object to compare the receiver to.\n     */\n    public func isSameObject(as object: EmbeddedObject?) -> Bool {\n        return RLMObjectBaseAreEqual(self, object)\n    }\n}\n\nextension EmbeddedObject: ThreadConfined {\n    /**\n     Indicates if this object is frozen.\n\n     - see: `Object.freeze()`\n     */\n    public var isFrozen: Bool { return realm?.isFrozen ?? false }\n\n    /**\n     Returns a frozen (immutable) snapshot of this object.\n\n     The frozen copy is an immutable object which contains the same data as this\n     object currently contains, but will not update when writes are made to the\n     containing Realm. Unlike live objects, frozen objects can be accessed from any\n     thread.\n\n     - warning: Holding onto a frozen object for an extended period while performing write\n     transaction on the Realm may result in the Realm file growing to large sizes. See\n     `Realm.Configuration.maximumNumberOfActiveVersions` for more information.\n     - warning: This method can only be called on a managed object.\n     */\n    public func freeze() -> Self {\n        return realm!.freeze(self)\n    }\n\n    /**\n     Returns a live (mutable) reference of this object.\n\n     This method creates a managed accessor to a live copy of the same frozen object.\n     Will return self if called on an already live object.\n     */\n    public func thaw() -> Self? {\n        return realm?.thaw(self)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Error.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Realm\n\nextension Realm {\n    /**\n     Struct that describes the error codes within the Realm error domain.\n     The values can be used to catch a variety of _recoverable_ errors, especially those\n     happening when initializing a Realm instance.\n\n     ```swift\n     let realm: Realm?\n     do {\n         realm = try Realm()\n     } catch Realm.Error.incompatibleLockFile {\n         print(\"Realm Browser app may be attached to Realm on device?\")\n     }\n     ```\n    */\n    public typealias Error = RLMError\n}\n\nextension Realm.Error {\n    /// This error could be returned by completion block when no success and no error were produced\n    public static let callFailed = Realm.Error(Realm.Error.fail, userInfo: [NSLocalizedDescriptionKey: \"Call failed\"])\n\n    /// The file URL which produced this error, or `nil` if not applicable\n    public var fileURL: URL? {\n        return (userInfo[NSFilePathErrorKey] as? String).flatMap(URL.init(fileURLWithPath:))\n    }\n}\n\n// MARK: Equatable\n\n#if compiler(>=6)\nextension Realm.Error: @retroactive Equatable {}\n#else\nextension Realm.Error: Equatable {}\n#endif\n"
  },
  {
    "path": "RealmSwift/Geospatial.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2023 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport CoreLocation\nimport Realm\n\n/**\n A struct that represents the coordinates of a point formed by a latitude and a longitude value.\n\n  * Latitude ranges between -90 and 90 degrees, inclusive.\n  * Longitude ranges between -180 and 180 degrees, inclusive.\n \n Values outside this ranges will return nil when trying to create a `GeoPoint`.\n\n - note: There is no dedicated type to store Geospatial points, instead points should be stored as\n [GeoJson-shaped](https://www.mongodb.com/docs/manual/reference/geojson/) embedded\n object, as explained below. Geospatial queries (`geoWithin`) can only be executed in such a type\n of objects and will throw otherwise.\n\n Persisting geo points in Realm is currently done using duck-typing, which means that any model class with a specific **shape**\n can be queried as though it contained a geographical location.\n\n the following is required:\n  * A String property with the value of **Point**: `@Persisted var type: String = \"Point\"`.\n  * A List containing a Longitude/Latitude pair: `@Persisted private var coordinates: List<Double>`.\n\n The recommended approach is using an embedded object.\n ```\n public class Location: EmbeddedObject {\n   @Persisted private var coordinates: List<Double>\n   @Persisted private var type: String = \"Point\"\n\n   public var latitude: Double { return coordinates[1] }\n   public var longitude: Double { return coordinates[0] }\n\n   convenience init(_ latitude: Double, _ longitude: Double) {\n       self.init()\n       // Longitude comes first in the coordinates array of a GeoJson document\n       coordinates.append(objectsIn: [longitude, latitude])\n     }\n   }\n   ```\n\n - warning: This structure cannot be persisted and can only be used to build other geospatial shapes\n   such as (`GeoBox`, `GeoPolygon` and `GeoCircle`).\n */\npublic typealias GeoPoint = RLMGeospatialPoint\n\n/**\n A class that represents a rectangle, that can be used in a geospatial `geoWithin`query.\n\n - warning: This class cannot be persisted and can only be use within a geospatial `geoWithin` query.\n */\npublic typealias GeoBox = RLMGeospatialBox\n\npublic extension GeoBox {\n    /// Initialize a `GeoBox`, with values for bottom left corner and top right corner.\n    ///\n    /// - Parameter bottomLeft: The bottom left corner of the rectangle.\n    /// - Parameter topRight: The top right corner of the rectangle.\n    convenience init?(bottomLeft: (Double, Double), topRight: (Double, Double)) {\n        guard let bottomLeftPoint = GeoPoint(latitude: bottomLeft.0, longitude: bottomLeft.1),\n              let topRightPoint = GeoPoint(latitude: topRight.0, longitude: topRight.1) else {\n            return nil\n        }\n        self.init(bottomLeft: bottomLeftPoint, topRight: topRightPoint)\n    }\n}\n\n/**\n A class that represents a polygon, that can be used in a geospatial `geoWithin`query.\n\n A `GeoPolygon` describes a shape conformed of and outer `Polygon`, called `outerRing`,\n and 0 or more inner `Polygon`s, called `holes`, which represents an unlimited number of internal holes\n inside the outer `Polygon`.\n A `Polygon` describes a shape conformed by at least three segments, where the last and the first `GeoPoint`\n must be the same to indicate a closed polygon (meaning you need at least 4 points to define a polygon).\n Inner holes in a `GeoPolygon` must  be entirely inside the outer ring\n \n A `hole` has the following restrictions:\n - Holes may not cross, i.e. the boundary of a hole may not intersect both the interior and the exterior of any other\n   hole.\n - Holes may not share edges, i.e. if a hole contains and edge AB, the no other hole may contain it.\n - Holes may share vertices, however no vertex may appear twice in a single hole.\n - No hole may be empty.\n - Only one nesting is allowed.\n\n - warning: This class cannot be persisted and can only be use within a geospatial `geoWithin` query.\n\n - warning: Altitude is not used in any of the query calculations.\n */\npublic typealias GeoPolygon = RLMGeospatialPolygon\n\npublic extension GeoPolygon {\n    /// Initialize a `GeoPolygon`, with values for bottom left corner and top right corner.\n    ///\n    /// Returns `nil` if the `GeoPoints` representing a polygon (outer ring or holes), don't have at least 4 points.\n    /// Returns `nil` if the first and the last `GeoPoint` in a polygon are not the same.\n    ///\n    /// - Parameter outerRing: The polygon's external (outer) ring.\n    /// - Parameter holes: The holes (if any) in the polygon.\n    convenience init?(outerRing: [(Double, Double)], holes: [[(Double, Double)]] = []) {\n        let outerRingPoints = outerRing.compactMap(GeoPoint.init)\n        let holesPoints = holes.map { $0.compactMap(GeoPoint.init) }\n        guard outerRing.count == outerRingPoints.count,\n              zip(holes, holesPoints).allSatisfy({ $0.count == $1.count }) else {\n            return nil\n        }\n        self.init(outerRing: outerRingPoints, holes: holesPoints)\n    }\n\n    /// Initialize a `GeoPolygon`, with values for bottom left corner and top right corner.\n    ///\n    /// Returns `nil` if the `GeoPoints` representing a polygon (outer ring or holes), don't have at least 4 points.\n    /// Returns `nil` if the first and the last `GeoPoint` in a polygon are not the same.\n    ///\n    /// - Parameter outerRing: The polygon's external (outer) ring.\n    /// - Parameter holes: The holes (if any) in the polygon.\n    convenience init?(outerRing: [(Double, Double)], holes: [(Double, Double)]...) {\n        self.init(outerRing: outerRing, holes: holes.map { $0 })\n    }\n}\n\n/**\n This structure is a helper to represent/convert a distance. It can be used in geospatial\n queries like those represented by a `GeoCircle`\n\n - warning: This structure cannot be persisted and can only be used to build other geospatial shapes\n */\npublic typealias Distance = RLMDistance\n\n/**\n A class that represents a circle, that can be used in a geospatial `geoWithin`query.\n\n - warning: This class cannot be persisted and can only be use within a geospatial `geoWithin` query.\n */\npublic typealias GeoCircle = RLMGeospatialCircle\n\npublic extension GeoCircle {\n    /// Initialize a `GeoCircle`, from its center and radius in radians.\n    ///\n    /// - Parameter center: Center of the circle.\n    /// - Parameter radiusInRadians: The radius of the circle in radians.\n    convenience init?(center: (Double, Double), radiusInRadians: Double) {\n        guard let centerPoint = GeoPoint(latitude: center.0, longitude: center.1) else {\n            return nil\n        }\n        self.init(center: centerPoint, radiusInRadians: radiusInRadians)\n    }\n\n    /// Initialize a `GeoCircle`, from its center and radius.\n    ///\n    /// - Parameter center: Center of the circle.\n    /// - Parameter radius: Radius of the circle.\n    convenience init?(center: (Double, Double), radius: Distance) {\n        guard let centerPoint = GeoPoint(latitude: center.0, longitude: center.1) else {\n            return nil\n        }\n        self.init(center: centerPoint, radius: radius)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Impl/BasicTypes.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Realm\nimport Realm.Private\n\n// MARK: - Property Types\n\nextension Int: SchemaDiscoverable {\n    public static var _rlmType: PropertyType { .int }\n}\n\nextension Int8: SchemaDiscoverable {\n    public static var _rlmType: PropertyType { .int }\n}\n\nextension Int16: SchemaDiscoverable {\n    public static var _rlmType: PropertyType { .int }\n}\n\nextension Int32: SchemaDiscoverable {\n    public static var _rlmType: PropertyType { .int }\n}\n\nextension Int64: SchemaDiscoverable {\n    public static var _rlmType: PropertyType { .int }\n}\n\nextension Bool: SchemaDiscoverable {\n    public static var _rlmType: PropertyType { .bool }\n}\n\nextension Float: SchemaDiscoverable {\n    public static var _rlmType: PropertyType { .float }\n}\n\nextension Double: SchemaDiscoverable {\n    public static var _rlmType: PropertyType { .double }\n}\n\nextension String: SchemaDiscoverable {\n    public static var _rlmType: PropertyType { .string }\n}\n\nextension Data: SchemaDiscoverable {\n    public static var _rlmType: PropertyType { .data }\n}\n\nextension ObjectId: SchemaDiscoverable {\n    public static var _rlmType: PropertyType { .objectId }\n}\n\nextension Decimal128: SchemaDiscoverable {\n    public static var _rlmType: PropertyType { .decimal128 }\n}\n\nextension Date: SchemaDiscoverable {\n    public static var _rlmType: PropertyType { .date }\n}\n\nextension UUID: SchemaDiscoverable {\n    public static var _rlmType: PropertyType { .UUID }\n}\n\nextension AnyRealmValue: SchemaDiscoverable {\n    public static var _rlmType: PropertyType { .any }\n    public static func _rlmPopulateProperty(_ prop: RLMProperty) {\n        if prop.optional {\n            var type = \"AnyRealmValue\"\n            if prop.array {\n                type = \"List<AnyRealmValue>\"\n            } else if prop.set {\n                type = \"MutableSet<AnyRealmValue>\"\n            } else if prop.dictionary {\n                type = \"Map<String, AnyRealmValue>\"\n            }\n            throwRealmException(\"\\(type) property '\\(prop.name)' must not be marked as optional: nil values are represented as AnyRealmValue.none\")\n        }\n    }\n}\n\nextension NSString: SchemaDiscoverable {\n    public static var _rlmType: PropertyType { .string }\n}\n\nextension NSData: SchemaDiscoverable {\n    public static var _rlmType: PropertyType { .data }\n}\n\nextension NSDate: SchemaDiscoverable {\n    public static var _rlmType: PropertyType { .date }\n}\n\n// MARK: - Modern property getters/setters\n\nprivate protocol _Int: BinaryInteger, _PersistableInsideOptional, _DefaultConstructible, _PrimaryKey, _Indexable {\n}\n\nextension _Int {\n    @inlinable\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: PropertyKey) -> Self {\n        return Self(RLMGetSwiftPropertyInt64(obj, key))\n    }\n\n    @inlinable\n    public static func _rlmGetPropertyOptional(_ obj: ObjectBase, _ key: PropertyKey) -> Self? {\n        var gotValue = false\n        let ret = RLMGetSwiftPropertyInt64Optional(obj, key, &gotValue)\n        return gotValue ? Self(ret) : nil\n    }\n\n    @inlinable\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: PropertyKey, _ value: Self) {\n        RLMSetSwiftPropertyInt64(obj, key, Int64(value))\n    }\n}\n\nextension Int: _Int {\n    public typealias PersistedType = Int\n}\nextension Int8: _Int {\n    public typealias PersistedType = Int8\n}\nextension Int16: _Int {\n    public typealias PersistedType = Int16\n}\nextension Int32: _Int {\n    public typealias PersistedType = Int32\n}\nextension Int64: _Int {\n    public typealias PersistedType = Int64\n}\n\nextension Bool: _PersistableInsideOptional, _DefaultConstructible, _PrimaryKey, _Indexable {\n    public typealias PersistedType = Bool\n\n    @inlinable\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: PropertyKey) -> Bool {\n        return RLMGetSwiftPropertyBool(obj, key)\n    }\n\n    @inlinable\n    public static func _rlmGetPropertyOptional(_ obj: ObjectBase, _ key: PropertyKey) -> Bool? {\n        var gotValue = false\n        let ret = RLMGetSwiftPropertyBoolOptional(obj, key, &gotValue)\n        return gotValue ? ret : nil\n    }\n\n    @inlinable\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: PropertyKey, _ value: Bool) {\n        RLMSetSwiftPropertyBool(obj, key, (value))\n    }\n}\n\nextension Float: _PersistableInsideOptional, _DefaultConstructible {\n    public typealias PersistedType = Float\n\n    @inlinable\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: PropertyKey) -> Float {\n        return RLMGetSwiftPropertyFloat(obj, key)\n    }\n\n    @inlinable\n    public static func _rlmGetPropertyOptional(_ obj: ObjectBase, _ key: PropertyKey) -> Float? {\n        var gotValue = false\n        let ret = RLMGetSwiftPropertyFloatOptional(obj, key, &gotValue)\n        return gotValue ? ret : nil\n    }\n\n    @inlinable\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: PropertyKey, _ value: Float) {\n        RLMSetSwiftPropertyFloat(obj, key, (value))\n    }\n}\n\nextension Double: _PersistableInsideOptional, _DefaultConstructible {\n    public typealias PersistedType = Double\n\n    @inlinable\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: PropertyKey) -> Double {\n        return RLMGetSwiftPropertyDouble(obj, key)\n    }\n\n    @inlinable\n    public static func _rlmGetPropertyOptional(_ obj: ObjectBase, _ key: PropertyKey) -> Double? {\n        var gotValue = false\n        let ret = RLMGetSwiftPropertyDoubleOptional(obj, key, &gotValue)\n        return gotValue ? ret : nil\n    }\n\n    @inlinable\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: PropertyKey, _ value: Double) {\n        RLMSetSwiftPropertyDouble(obj, key, (value))\n    }\n}\n\nextension String: _PersistableInsideOptional, _DefaultConstructible, _PrimaryKey, _Indexable {\n    public typealias PersistedType = String\n\n    @inlinable\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: PropertyKey) -> String {\n        return RLMGetSwiftPropertyString(obj, key)!\n    }\n\n    @inlinable\n    public static func _rlmGetPropertyOptional(_ obj: ObjectBase, _ key: PropertyKey) -> String? {\n        return RLMGetSwiftPropertyString(obj, key)\n    }\n\n    @inlinable\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: PropertyKey, _ value: String) {\n        RLMSetSwiftPropertyString(obj, key, value)\n    }\n}\n\nextension Data: _PersistableInsideOptional, _DefaultConstructible {\n    public typealias PersistedType = Data\n\n    @inlinable\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: PropertyKey) -> Data {\n        return RLMGetSwiftPropertyData(obj, key)!\n    }\n\n    @inlinable\n    public static func _rlmGetPropertyOptional(_ obj: ObjectBase, _ key: PropertyKey) -> Data? {\n        return RLMGetSwiftPropertyData(obj, key)\n    }\n\n    @inlinable\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: PropertyKey, _ value: Data) {\n        RLMSetSwiftPropertyData(obj, key, value)\n    }\n}\n\nextension ObjectId: _PersistableInsideOptional, _DefaultConstructible, _PrimaryKey, _Indexable {\n    public typealias PersistedType = ObjectId\n\n    @inlinable\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: PropertyKey) -> ObjectId {\n        return RLMGetSwiftPropertyObjectId(obj, key) as! ObjectId\n    }\n\n    @inlinable\n    public static func _rlmGetPropertyOptional(_ obj: ObjectBase, _ key: PropertyKey) -> ObjectId? {\n        return RLMGetSwiftPropertyObjectId(obj, key).flatMap(failableStaticBridgeCast)\n    }\n\n    @inlinable\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: PropertyKey, _ value: ObjectId) {\n        RLMSetSwiftPropertyObjectId(obj, key, (value))\n    }\n\n    public static func _rlmDefaultValue() -> ObjectId {\n        return Self.generate()\n    }\n}\n\nextension Decimal128: _PersistableInsideOptional, _DefaultConstructible {\n    public typealias PersistedType = Decimal128\n\n    @inlinable\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: PropertyKey) -> Decimal128 {\n        return RLMGetSwiftPropertyDecimal128(obj, key) as! Decimal128\n    }\n\n    @inlinable\n    public static func _rlmGetPropertyOptional(_ obj: ObjectBase, _ key: PropertyKey) -> Decimal128? {\n        return RLMGetSwiftPropertyDecimal128(obj, key).flatMap(failableStaticBridgeCast)\n    }\n\n    @inlinable\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: PropertyKey, _ value: Decimal128) {\n        RLMSetSwiftPropertyDecimal128(obj, key, value)\n    }\n}\n\nextension Date: _PersistableInsideOptional, _DefaultConstructible, _Indexable {\n    public typealias PersistedType = Date\n\n    @inlinable\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: PropertyKey) -> Date {\n        return RLMGetSwiftPropertyDate(obj, key)!\n    }\n\n    @inlinable\n    public static func _rlmGetPropertyOptional(_ obj: ObjectBase, _ key: PropertyKey) -> Date? {\n        return RLMGetSwiftPropertyDate(obj, key)\n    }\n\n    @inlinable\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: PropertyKey, _ value: Date) {\n        RLMSetSwiftPropertyDate(obj, key, value)\n    }\n}\n\nextension UUID: _PersistableInsideOptional, _DefaultConstructible, _PrimaryKey, _Indexable {\n    public typealias PersistedType = UUID\n\n    @inlinable\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: PropertyKey) -> UUID {\n        return RLMGetSwiftPropertyUUID(obj, key)!\n    }\n\n    @inlinable\n    public static func _rlmGetPropertyOptional(_ obj: ObjectBase, _ key: PropertyKey) -> UUID? {\n        return RLMGetSwiftPropertyUUID(obj, key)\n    }\n\n    @inlinable\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: PropertyKey, _ value: UUID) {\n        RLMSetSwiftPropertyUUID(obj, key, value)\n    }\n}\n\nextension AnyRealmValue: _Persistable, _DefaultConstructible {\n    public typealias PersistedType = AnyRealmValue\n\n    @inlinable\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: PropertyKey) -> AnyRealmValue {\n        return ObjectiveCSupport.convert(value: RLMGetSwiftPropertyAny(obj, key))\n    }\n\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: PropertyKey, _ value: AnyRealmValue) {\n        RLMSetSwiftPropertyAny(obj, key, value._rlmObjcValue as! RLMValue)\n    }\n\n    public static func _rlmSetAccessor(_ prop: RLMProperty) {\n        prop.swiftAccessor = BridgedPersistedPropertyAccessor<Self>.self\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Impl/CollectionAccess.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Realm\n\nprivate func isSameCollection(_ lhs: RLMCollection, _ rhs: Any) -> Bool {\n    // Managed isEqual checks if they're backed by the same core field, so it does exactly what we need\n    if lhs.realm != nil {\n        return lhs.isEqual(rhs)\n    }\n    // For unmanaged we want to check if the backing collection is the same instance\n    if let rhs = rhs as? RLMSwiftCollectionBase {\n        return lhs === rhs._rlmCollection\n    }\n    return lhs === rhs as AnyObject\n}\n\ninternal protocol MutableRealmCollection {\n    func assign(_ value: Any)\n\n    // Unmanaged collection properties need a reference to their parent object for\n    // KVO to work because the mutation is done via the collection object but the\n    // observation is on the parent.\n    func setParent(_ object: RLMObjectBase, _ property: RLMProperty)\n}\n\nextension List: MutableRealmCollection {\n    func assign(_ value: Any) {\n        guard !isSameCollection(_rlmCollection, value) else { return }\n        RLMAssignToCollection(_rlmCollection, value)\n    }\n    func setParent(_ object: RLMObjectBase, _ property: RLMProperty) {\n        rlmArray.setParent(object, property: property)\n    }\n}\n\nextension MutableSet: MutableRealmCollection {\n    func assign(_ value: Any) {\n        guard !isSameCollection(_rlmCollection, value) else { return }\n        RLMAssignToCollection(_rlmCollection, value)\n    }\n    func setParent(_ object: RLMObjectBase, _ property: RLMProperty) {\n        rlmSet.setParent(object, property: property)\n    }\n}\n\nextension Map: MutableRealmCollection {\n    func assign(_ value: Any) {\n        guard !isSameCollection(_rlmCollection, value) else { return }\n        rlmDictionary.setDictionary(value)\n    }\n    func setParent(_ object: RLMObjectBase, _ property: RLMProperty) {\n        rlmDictionary.setParent(object, property: property)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Impl/ComplexTypes.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Realm\nimport Realm.Private\n\nextension Object: SchemaDiscoverable, _PersistableInsideOptional, _DefaultConstructible {\n    public typealias PersistedType = Object\n    public static var _rlmType: PropertyType { .object }\n    public static func _rlmPopulateProperty(_ prop: RLMProperty) {\n        if !prop.optional && !prop.collection {\n            throwRealmException(\"Object property '\\(prop.name)' must be marked as optional.\")\n        }\n        if prop.optional && prop.array {\n            throwRealmException(\"List<\\(className())> property '\\(prop.name)' must not be marked as optional.\")\n        }\n        if prop.optional && prop.set {\n            throwRealmException(\"MutableSet<\\(className())> property '\\(prop.name)' must not be marked as optional.\")\n        }\n        if !prop.optional && prop.dictionary {\n            throwRealmException(\"Map<String, \\(className())> property '\\(prop.name)' must be marked as optional.\")\n        }\n        prop.objectClassName = className()\n    }\n\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: UInt16) -> Self {\n        fatalError(\"Non-optional Object properties are not allowed.\")\n    }\n\n    public static func _rlmGetPropertyOptional(_ obj: ObjectBase, _ key: UInt16) -> Self? {\n//        FIXME: gives Assertion failed: (LocalSelf && \"no local self metadata\"), function getLocalSelfMetadata, file /src/swift-source/swift/lib/IRGen/GenHeap.cpp, line 1686.\n//        return RLMGetSwiftPropertyObject(obj, key).map(dynamicBridgeCast)\n        if let value = RLMGetSwiftPropertyObject(obj, key) {\n            return (value as! Self)\n        }\n        return nil\n    }\n\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: UInt16, _ value: Object) {\n        RLMSetSwiftPropertyObject(obj, key, value)\n    }\n}\n\nextension EmbeddedObject: SchemaDiscoverable, _PersistableInsideOptional, _DefaultConstructible {\n    public typealias PersistedType = EmbeddedObject\n    public static var _rlmType: PropertyType { .object }\n    public static func _rlmPopulateProperty(_ prop: RLMProperty) {\n        Object._rlmPopulateProperty(prop)\n        prop.objectClassName = className()\n    }\n\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: UInt16) -> Self {\n        if let value = RLMGetSwiftPropertyObject(obj, key) {\n            return value as! Self\n        }\n        return Self()\n    }\n\n    public static func _rlmGetPropertyOptional(_ obj: ObjectBase, _ key: UInt16) -> Self? {\n        if let value = RLMGetSwiftPropertyObject(obj, key) {\n            return (value as! Self)\n        }\n        return nil\n    }\n\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: UInt16, _ value: EmbeddedObject) {\n        RLMSetSwiftPropertyObject(obj, key, value)\n    }\n}\n\nextension List: _RealmSchemaDiscoverable, SchemaDiscoverable where Element: _RealmSchemaDiscoverable {\n    public static var _rlmType: PropertyType { Element._rlmType }\n    public static var _rlmOptional: Bool { Element._rlmOptional }\n    public static var _rlmRequireObjc: Bool { false }\n    public static func _rlmPopulateProperty(_ prop: RLMProperty) {\n        prop.array = true\n        prop.swiftAccessor = ListAccessor<Element>.self\n        Element._rlmPopulateProperty(prop)\n    }\n}\n\nextension List: _HasPersistedType, _Persistable, _DefaultConstructible where Element: _Persistable {\n    public typealias PersistedType = List\n    public static var _rlmRequiresCaching: Bool { true }\n\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: UInt16) -> Self {\n        return Self(collection: RLMGetSwiftPropertyArray(obj, key))\n    }\n\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: UInt16, _ value: List) {\n        let array = RLMGetSwiftPropertyArray(obj, key)\n        if array.isEqual(value.rlmArray) { return }\n        array.removeAllObjects()\n        array.addObjects(value.rlmArray)\n    }\n\n    public static func _rlmSetAccessor(_ prop: RLMProperty) {\n        prop.swiftAccessor = PersistedListAccessor<Element>.self\n    }\n}\n\nextension MutableSet: _RealmSchemaDiscoverable, SchemaDiscoverable where Element: _RealmSchemaDiscoverable {\n    public static var _rlmType: PropertyType { Element._rlmType }\n    public static var _rlmOptional: Bool { Element._rlmOptional }\n    public static var _rlmRequireObjc: Bool { false }\n    public static func _rlmPopulateProperty(_ prop: RLMProperty) {\n        prop.set = true\n        prop.swiftAccessor = SetAccessor<Element>.self\n        Element._rlmPopulateProperty(prop)\n    }\n}\n\nextension MutableSet: _HasPersistedType, _Persistable, _DefaultConstructible where Element: _Persistable {\n    public typealias PersistedType = MutableSet\n    public static var _rlmRequiresCaching: Bool { true }\n\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: UInt16) -> Self {\n        return Self(collection: RLMGetSwiftPropertySet(obj, key))\n    }\n\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: UInt16, _ value: MutableSet) {\n        let set = RLMGetSwiftPropertySet(obj, key)\n        if set.isEqual(value.rlmSet) { return }\n        set.removeAllObjects()\n        set.addObjects(value.rlmSet)\n    }\n\n    public static func _rlmSetAccessor(_ prop: RLMProperty) {\n        prop.swiftAccessor = PersistedSetAccessor<Element>.self\n    }\n}\n\nextension Map: _RealmSchemaDiscoverable, SchemaDiscoverable where Value: _RealmSchemaDiscoverable {\n    public static var _rlmType: PropertyType { Value._rlmType }\n    public static var _rlmOptional: Bool { Value._rlmOptional }\n    public static var _rlmRequireObjc: Bool { false }\n    public static func _rlmPopulateProperty(_ prop: RLMProperty) {\n        prop.dictionary = true\n        prop.swiftAccessor = MapAccessor<Key, Value>.self\n        prop.dictionaryKeyType = Key._rlmType\n        Value._rlmPopulateProperty(prop)\n    }\n}\n\nextension Map: _HasPersistedType, _Persistable, _DefaultConstructible where Value: _Persistable {\n    public typealias PersistedType = Map\n    public static var _rlmRequiresCaching: Bool { true }\n\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: UInt16) -> Self {\n        return Self(objc: RLMGetSwiftPropertyMap(obj, key))\n    }\n\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: UInt16, _ value: Map) {\n        let map = RLMGetSwiftPropertyMap(obj, key)\n        if map.isEqual(value.rlmDictionary) { return }\n        map.removeAllObjects()\n        map.addEntries(fromDictionary: value.rlmDictionary)\n    }\n\n    public static func _rlmSetAccessor(_ prop: RLMProperty) {\n        prop.swiftAccessor = PersistedMapAccessor<Key, Value>.self\n    }\n}\n\nextension LinkingObjects: SchemaDiscoverable {\n    public static var _rlmType: PropertyType { .linkingObjects }\n    public static var _rlmRequireObjc: Bool { false }\n    public static func _rlmPopulateProperty(_ prop: RLMProperty) {\n        prop.array = true\n        prop.objectClassName = Element.className()\n        prop.swiftAccessor = LinkingObjectsAccessor<Element>.self\n        if prop.linkOriginPropertyName == nil {\n            throwRealmException(\"LinkingObjects<\\(prop.objectClassName!)> property '\\(prop.name)' must set the origin property name with @Persisted(originProperty: \\\"name\\\").\")\n        }\n    }\n    public func _rlmPopulateProperty(_ prop: RLMProperty) {\n        prop.linkOriginPropertyName = self.propertyName\n    }\n}\n\n@available(*, deprecated)\nextension RealmOptional: SchemaDiscoverable, _RealmSchemaDiscoverable where Value: _RealmSchemaDiscoverable {\n    public static var _rlmType: PropertyType { Value._rlmType }\n    public static var _rlmOptional: Bool { true }\n    public static var _rlmRequireObjc: Bool { false }\n    public static func _rlmPopulateProperty(_ prop: RLMProperty) {\n        Value._rlmPopulateProperty(prop)\n        prop.swiftAccessor = RealmOptionalAccessor<Value>.self\n    }\n}\n\nextension LinkingObjects: _HasPersistedType, _Persistable where Element: _Persistable {\n    public typealias PersistedType = Self\n    public static func _rlmDefaultValue() -> Self {\n        fatalError(\"LinkingObjects properties must set the origin property name\")\n    }\n\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: UInt16) -> LinkingObjects {\n        let prop = RLMObjectBaseObjectSchema(obj)!.computedProperties[Int(key)]\n        return Self(propertyName: prop.name, handle: RLMLinkingObjectsHandle(object: obj, property: prop))\n    }\n\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: UInt16, _ value: LinkingObjects) {\n        fatalError(\"LinkingObjects properties are read-only\")\n    }\n\n    public static func _rlmSetAccessor(_ prop: RLMProperty) {\n        prop.swiftAccessor = PersistedLinkingObjectsAccessor<Element>.self\n    }\n}\n\nextension Optional: SchemaDiscoverable, _RealmSchemaDiscoverable where Wrapped: _RealmSchemaDiscoverable {\n    public static var _rlmType: PropertyType { Wrapped._rlmType }\n    public static var _rlmOptional: Bool { true }\n    public static func _rlmPopulateProperty(_ prop: RLMProperty) {\n        Wrapped._rlmPopulateProperty(prop)\n    }\n}\n\nextension Optional: _HasPersistedType where Wrapped: _HasPersistedType {\n    public typealias PersistedType = Wrapped.PersistedType?\n}\n\nextension Optional: _Persistable where Wrapped: _PersistableInsideOptional {\n    public static func _rlmDefaultValue() -> Self {\n        return .none\n    }\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: UInt16) -> Wrapped? {\n        return Wrapped._rlmGetPropertyOptional(obj, key)\n    }\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: UInt16, _ value: Wrapped?) {\n        if let value = value {\n            Wrapped._rlmSetProperty(obj, key, value)\n        } else {\n            RLMSetSwiftPropertyNil(obj, key)\n        }\n    }\n    public static func _rlmSetAccessor(_ prop: RLMProperty) {\n        Wrapped._rlmSetAccessor(prop)\n    }\n}\n\nextension Optional: _PrimaryKey where Wrapped: _Persistable, Wrapped.PersistedType: _PrimaryKey {}\nextension Optional: _Indexable where Wrapped: _Persistable, Wrapped.PersistedType: _Indexable {}\n\nextension RealmProperty: _RealmSchemaDiscoverable, SchemaDiscoverable {\n    public static var _rlmType: PropertyType { Value._rlmType }\n    public static var _rlmOptional: Bool { Value._rlmOptional }\n    public static var _rlmRequireObjc: Bool { false }\n    public static func _rlmPopulateProperty(_ prop: RLMProperty) {\n        Value._rlmPopulateProperty(prop)\n        prop.swiftAccessor = RealmPropertyAccessor<Value>.self\n    }\n}\n\nextension RawRepresentable where RawValue: _RealmSchemaDiscoverable {\n    public static var _rlmType: PropertyType { RawValue._rlmType }\n    public static var _rlmOptional: Bool { RawValue._rlmOptional }\n    public static var _rlmRequireObjc: Bool { false }\n    public func _rlmPopulateProperty(_ prop: RLMProperty) { }\n    public static func _rlmPopulateProperty(_ prop: RLMProperty) {\n        RawValue._rlmPopulateProperty(prop)\n    }\n}\n\nextension RawRepresentable where Self: _PersistableInsideOptional, RawValue: _PersistableInsideOptional {\n    public typealias PersistedType = RawValue\n    public static func _rlmGetProperty(_ obj: ObjectBase, _ key: PropertyKey) -> Self {\n        return Self(rawValue: RawValue._rlmGetProperty(obj, key))!\n    }\n    public static func _rlmGetPropertyOptional(_ obj: ObjectBase, _ key: PropertyKey) -> Self? {\n        return RawValue._rlmGetPropertyOptional(obj, key).flatMap(Self.init)\n    }\n    public static func _rlmSetProperty(_ obj: ObjectBase, _ key: PropertyKey, _ value: Self) {\n        RawValue._rlmSetProperty(obj, key, value.rawValue)\n    }\n    public static func _rlmSetAccessor(_ prop: RLMProperty) {\n        if prop.optional {\n            prop.swiftAccessor = BridgedPersistedPropertyAccessor<Optional<Self>>.self\n        } else {\n            prop.swiftAccessor = BridgedPersistedPropertyAccessor<Self>.self\n        }\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Impl/KeyPathStrings.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm.Private\n\n/**\n Gets the components of a given key path as a string.\n\n - warning: Objects that declare properties with the old `@objc dynamic` syntax are not fully supported\n by this function, and it is recommended that you use `@Persisted` to declare your properties if you wish to use\n this function to its full benefit.\n\n Example:\n ```\n let name = ObjectBase._name(for: \\Person.dogs[0].name) // \"dogs.name\"\n // Note that the above KeyPath expression is only supported with properties declared\n // with `@Persisted`.\n let nested = ObjectBase._name(for: \\Person.address.city.zip) // \"address.city.zip\"\n ```\n */\npublic func _name<T: ObjectBase>(for keyPath: PartialKeyPath<T>) -> String {\n    return name(for: keyPath)\n}\n\n/**\n Gets the components of a given key path as a string.\n\n - warning: Objects that declare properties with the old `@objc dynamic` syntax are not fully supported\n by this function, and it is recommended that you use `@Persisted` to declare your properties if you wish to use\n this function to its full benefit.\n\n Example:\n ```\n let name = PersonProjection._name(for: \\PersonProjection.dogs[0].name) // \"dogs.name\"\n // Note that the above KeyPath expression is only supported with properties declared\n // with `@Persisted`.\n let nested = ObjectBase._name(for: \\Person.address.city.zip) // \"address.city.zip\"\n ```\n */\npublic func _name<O: ObjectBase, T>(for keyPath: PartialKeyPath<T>) -> String where T: Projection<O> {\n    return name(for: keyPath)\n}\n\nprivate func name<T: KeypathRecorder>(for keyPath: PartialKeyPath<T>) -> String {\n    if let name = keyPath._kvcKeyPathString {\n        return name\n    }\n    let names = NSMutableArray()\n    let value = T.keyPathRecorder(with: names)[keyPath: keyPath]\n    if let collection = value as? PropertyNameConvertible,\n       let propertyInfo = collection.propertyInformation, propertyInfo.isLegacy {\n        names.add(propertyInfo.key)\n    }\n\n    if let storage = value as? RLMSwiftValueStorage {\n        names.add(RLMSwiftValueStorageGetPropertyName(storage))\n    }\n    return names.componentsJoined(by: \".\")\n}\n\n/// Create a valid element for a collection, as a keypath recorder if that type supports it.\ninternal func elementKeyPathRecorder<T: RealmCollectionValue>(\n        for type: T.Type, with lastAccessedNames: NSMutableArray) -> T {\n    if let type = type as? KeypathRecorder.Type {\n        return type.keyPathRecorder(with: lastAccessedNames) as! T\n    }\n    return T._rlmDefaultValue()\n}\n\n// MARK: - Implementation\n\n/// Protocol which allows a collection to produce its property name\ninternal protocol PropertyNameConvertible {\n    /// A mutable array referenced from the enclosing parent that contains the last accessed property names.\n    var lastAccessedNames: NSMutableArray? { get set }\n    /// `key` is the property name for this collection.\n    /// `isLegacy` will be true if the property is declared with old property syntax.\n    var propertyInformation: (key: String, isLegacy: Bool)? { get }\n}\n\ninternal protocol KeypathRecorder {\n    // Return an instance of Self which is initialized for keypath recording\n    // using the given target array.\n    static func keyPathRecorder(with lastAccessedNames: NSMutableArray) -> Self\n}\n\nextension Optional: KeypathRecorder where Wrapped: KeypathRecorder {\n    internal static func keyPathRecorder(with lastAccessedNames: NSMutableArray) -> Self {\n        return Wrapped.keyPathRecorder(with: lastAccessedNames)\n    }\n}\n\nextension ObjectBase: KeypathRecorder {\n    internal static func keyPathRecorder(with lastAccessedNames: NSMutableArray) -> Self {\n        let obj = Self()\n        obj.lastAccessedNames = lastAccessedNames\n        let objectSchema = ObjectSchema(RLMObjectBaseObjectSchema(obj)!)\n        (objectSchema.rlmObjectSchema.properties + objectSchema.rlmObjectSchema.computedProperties)\n            .map { (prop: $0, accessor: $0.swiftAccessor) }\n            .forEach { $0.accessor?.observe($0.prop, on: obj) }\n        return obj\n    }\n}\n\nextension Projection: KeypathRecorder {\n    internal static func keyPathRecorder(with lastAccessedNames: NSMutableArray) -> Self {\n        let obj = Self(projecting: PersistedType())\n        obj.rootObject.lastAccessedNames = lastAccessedNames\n        let objectSchema = ObjectSchema(RLMObjectBaseObjectSchema(obj.rootObject)!)\n        (objectSchema.rlmObjectSchema.properties + objectSchema.rlmObjectSchema.computedProperties)\n            .map { (prop: $0, accessor: $0.swiftAccessor) }\n            .forEach { $0.accessor?.observe($0.prop, on: obj.rootObject) }\n        return obj\n    }\n}\n\nextension _DefaultConstructible {\n    internal static func keyPathRecorder(with lastAccessedNames: NSMutableArray) -> Self {\n        let obj = Self()\n        if var obj = obj as? PropertyNameConvertible {\n            obj.lastAccessedNames = lastAccessedNames\n        }\n        return obj\n    }\n}\n\nextension List: KeypathRecorder where Element: _Persistable {}\nextension List: PropertyNameConvertible {\n    var propertyInformation: (key: String, isLegacy: Bool)? {\n        return (key: rlmArray.propertyKey, isLegacy: rlmArray.isLegacyProperty)\n    }\n}\n\nextension Map: KeypathRecorder where Value: _Persistable {}\nextension Map: PropertyNameConvertible {\n    var propertyInformation: (key: String, isLegacy: Bool)? {\n        return (key: rlmDictionary.propertyKey, isLegacy: rlmDictionary.isLegacyProperty)\n    }\n}\n\nextension MutableSet: KeypathRecorder where Element: _Persistable {}\nextension MutableSet: PropertyNameConvertible {\n    var propertyInformation: (key: String, isLegacy: Bool)? {\n        return (key: rlmSet.propertyKey, isLegacy: rlmSet.isLegacyProperty)\n    }\n}\n\nextension LinkingObjects: KeypathRecorder where Element: _Persistable {\n    static func keyPathRecorder(with lastAccessedNames: NSMutableArray) -> LinkingObjects<Element> {\n        var obj = Self(propertyName: \"\", handle: nil)\n        obj.lastAccessedNames = lastAccessedNames\n        return obj\n    }\n}\nextension LinkingObjects: PropertyNameConvertible {\n    var propertyInformation: (key: String, isLegacy: Bool)? {\n        guard let handle = handle else { return nil }\n        return (key: handle._propertyKey, isLegacy: handle._isLegacyProperty)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Impl/ObjcBridgeable.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\n\n/// A type which can be bridged to and from Objective-C.\n///\n/// Do not use this protocol or the functions it adds directly.\npublic protocol _ObjcBridgeable {\n    static func _rlmFromObjc(_ value: Any, insideOptional: Bool) -> Self?\n    var _rlmObjcValue: Any { get }\n}\n/// A type where the default logic suffices for bridging and we don't need to do anything special.\ninternal protocol DefaultObjcBridgeable: _ObjcBridgeable {}\nextension DefaultObjcBridgeable {\n    public static func _rlmFromObjc(_ value: Any, insideOptional: Bool) -> Self? { value as? Self }\n    public var _rlmObjcValue: Any { self }\n}\n/// A type which needs custom logic, but doesn't care if it's being bridged inside an Optional\ninternal protocol BuiltInObjcBridgeable: _ObjcBridgeable {\n    static func _rlmFromObjc(_ value: Any) -> Self?\n}\nextension BuiltInObjcBridgeable {\n    public static func _rlmFromObjc(_ value: Any, insideOptional: Bool) -> Self? {\n        return _rlmFromObjc(value)\n    }\n}\n\nextension Bool: DefaultObjcBridgeable {}\nextension Int: DefaultObjcBridgeable {}\nextension Double: DefaultObjcBridgeable {}\nextension Date: DefaultObjcBridgeable {}\nextension String: DefaultObjcBridgeable {}\nextension Data: DefaultObjcBridgeable {}\nextension ObjectId: DefaultObjcBridgeable {}\nextension UUID: DefaultObjcBridgeable {}\nextension NSNumber: DefaultObjcBridgeable {}\nextension NSDate: DefaultObjcBridgeable {}\n\nextension ObjectBase: BuiltInObjcBridgeable {\n    public class func _rlmFromObjc(_ value: Any) -> Self? {\n        if let value = value as? Self {\n            return value\n        }\n        if Self.self === DynamicObject.self, let object = value as? ObjectBase {\n            // Without `as AnyObject` this will produce a warning which incorrectly\n            // claims it could be replaced with `unsafeDowncast()`\n            return unsafeBitCast(object as AnyObject, to: Self.self)\n        }\n        return nil\n    }\n    public var _rlmObjcValue: Any { self }\n}\n\n// `NSNumber as? T` coerces values which can't be exact represented for some\n// types and fails for others. We want to always coerce, for backwards\n// compatibility if nothing else.\nextension Float: BuiltInObjcBridgeable {\n    public static func _rlmFromObjc(_ value: Any) -> Self? {\n        return (value as? NSNumber)?.floatValue\n    }\n    public var _rlmObjcValue: Any {\n        return NSNumber(value: self)\n    }\n}\nextension Int8: BuiltInObjcBridgeable {\n    public static func _rlmFromObjc(_ value: Any) -> Self? {\n        return (value as? NSNumber)?.int8Value\n    }\n    public var _rlmObjcValue: Any {\n        // Promote to Int before boxing as otherwise 0 and 1 will get treated\n        // as Bool instead.\n        return NSNumber(value: Int16(self))\n    }\n}\nextension Int16: BuiltInObjcBridgeable {\n    public static func _rlmFromObjc(_ value: Any) -> Self? {\n        return (value as? NSNumber)?.int16Value\n    }\n    public var _rlmObjcValue: Any {\n        return NSNumber(value: self)\n    }\n}\nextension Int32: BuiltInObjcBridgeable {\n    public static func _rlmFromObjc(_ value: Any) -> Self? {\n        return (value as? NSNumber)?.int32Value\n    }\n    public var _rlmObjcValue: Any {\n        return NSNumber(value: self)\n    }\n}\nextension Int64: BuiltInObjcBridgeable {\n    public static func _rlmFromObjc(_ value: Any) -> Self? {\n        return (value as? NSNumber)?.int64Value\n    }\n    public var _rlmObjcValue: Any {\n        return NSNumber(value: self)\n    }\n}\n\nextension Optional: BuiltInObjcBridgeable, _ObjcBridgeable where Wrapped: _ObjcBridgeable {\n    public static func _rlmFromObjc(_ value: Any) -> Self? {\n        // ?? here gives the nonsensical error \"Left side of nil coalescing operator '??' has non-optional type 'Wrapped?', so the right side is never used\"\n        if let value = Wrapped._rlmFromObjc(value, insideOptional: true) {\n            return .some(value)\n        }\n        // We have a double-optional here and need to explicitly specify that we\n        // successfully converted to `nil`, as opposed to failing to bridge.\n        return .some(Self.none)\n    }\n    public var _rlmObjcValue: Any {\n        if let value = self {\n            return value._rlmObjcValue\n        }\n        return NSNull()\n    }\n}\nextension Decimal128: BuiltInObjcBridgeable {\n    public static func _rlmFromObjc(_ value: Any) -> Decimal128? {\n        if let value = value as? Decimal128 {\n            return .some(value)\n        }\n        if let number = value as? NSNumber {\n            return Decimal128(number: number)\n        }\n        if let str = value as? String {\n            return Decimal128(string: str)\n        }\n        return .none\n    }\n    public var _rlmObjcValue: Any {\n        return self\n    }\n}\nextension AnyRealmValue: BuiltInObjcBridgeable {\n    public static func _rlmFromObjc(_ value: Any) -> Self? {\n        if let any = value as? Self {\n            return any\n        }\n        if let any = value as? RLMValue {\n            return ObjectiveCSupport.convert(value: any)\n        }\n        return Self?.none // We need to explicitly say which .none we want here\n    }\n    public var _rlmObjcValue: Any {\n        return ObjectiveCSupport.convert(value: self) ?? NSNull()\n    }\n}\n\n// MARK: - Collections\n\nextension Map: BuiltInObjcBridgeable {\n    public var _rlmObjcValue: Any { _rlmCollection }\n    public static func _rlmFromObjc(_ value: Any) -> Self? {\n        (value as? RLMCollection).map(Self.init(collection:))\n    }\n}\nextension RealmCollectionImpl {\n    public var _rlmObjcValue: Any { self.collection }\n    public static func _rlmFromObjc(_ value: Any, insideOptional: Bool) -> Self? {\n        (value as? RLMCollection).map(Self.init(collection:))\n    }\n}\n\nextension LinkingObjects: _ObjcBridgeable {}\nextension Results: _ObjcBridgeable {}\nextension AnyRealmCollection: _ObjcBridgeable {}\nextension List: _ObjcBridgeable {}\nextension MutableSet: _ObjcBridgeable {}\n\nextension SectionedResults: BuiltInObjcBridgeable {\n    public static func _rlmFromObjc(_ value: Any, insideOptional: Bool) -> Self? {\n        (value as? RLMSectionedResults<RLMValue, RLMValue>).map(Self.init(rlmSectionedResult:))\n    }\n    public var _rlmObjcValue: Any {\n        self.collection\n    }\n}\n\nextension ResultsSection: BuiltInObjcBridgeable {\n    public static func _rlmFromObjc(_ value: Any, insideOptional: Bool) -> Self? {\n        (value as? RLMSection<RLMValue, RLMValue>).map(Self.init(rlmSectionedResult:))\n    }\n    public var _rlmObjcValue: Any {\n        self.collection\n    }\n}\n\nextension RLMSwiftCollectionBase {\n    public static func == (lhs: RLMSwiftCollectionBase, rhs: RLMSwiftCollectionBase) -> Bool {\n        return lhs.isEqual(rhs)\n    }\n}\n#if compiler(>=6)\nextension RLMSwiftCollectionBase: @retroactive Equatable {}\n#else\nextension RLMSwiftCollectionBase: Equatable {}\n#endif\n\nextension Projection: BuiltInObjcBridgeable {\n    public static func _rlmFromObjc(_ value: Any) -> Self? {\n        return (value as? Root).map(Self.init(projecting:))\n    }\n\n    public var _rlmObjcValue: Any {\n        self.rootObject\n    }\n}\n\npublic protocol _PossiblyAggregateable: _ObjcBridgeable {\n    associatedtype PersistedType\n}\nextension NSDate: _PossiblyAggregateable {}\nextension NSNumber: _PossiblyAggregateable {}\n"
  },
  {
    "path": "RealmSwift/Impl/Persistable.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Realm\nimport Realm.Private\n\n// An opaque identifier for each property on a class. Happens to currently be\n// the property's index in the object schema, but that's not something that any\n// of the Swift code should rely on. In the future it may make sense to change\n// this to the ColKey.\npublic typealias PropertyKey = UInt16\n\n// A tag protocol used in schema discovery to find @Persisted properties\ninternal protocol DiscoverablePersistedProperty: _RealmSchemaDiscoverable {}\n\npublic protocol _HasPersistedType: _ObjcBridgeable {\n    // The type which is actually stored in the Realm. This is Self for types\n    // we support directly, but may be a different type for enums and mapped types.\n    associatedtype PersistedType: _ObjcBridgeable\n}\n\n// These two types need PersistedType for collection aggregate functions but\n// aren't persistable or valid collection types\nextension NSNumber: _HasPersistedType {\n    public typealias PersistedType = NSNumber\n}\nextension NSDate: _HasPersistedType {\n    public typealias PersistedType = NSDate\n}\n\n// A type which can be stored by the @Persisted property wrapper\npublic protocol _Persistable: _RealmSchemaDiscoverable, _HasPersistedType where PersistedType: _Persistable, PersistedType.PersistedType.PersistedType == PersistedType.PersistedType {\n    // Read a value of this type from the target object\n    static func _rlmGetProperty(_ obj: ObjectBase, _ key: PropertyKey) -> Self\n    // Set a value of this type on the target object\n    static func _rlmSetProperty(_ obj: ObjectBase, _ key: PropertyKey, _ value: Self)\n    // Set the swiftAccessor for this type if the default PersistedPropertyAccessor\n    // is not suitable.\n    static func _rlmSetAccessor(_ prop: RLMProperty)\n    // Do the values of this type need to be cached on the Persisted?\n    static var _rlmRequiresCaching: Bool { get }\n    // Get the zero/empty/nil value for this type. Used to supply a default\n    // when the user does not declare one in their model.\n    static func _rlmDefaultValue() -> Self\n}\n\nextension _Persistable {\n    public static var _rlmRequiresCaching: Bool {\n        false\n    }\n}\n\n// A type which can appear inside Optional<T> in a @Persisted property\npublic protocol _PersistableInsideOptional: _Persistable where PersistedType: _PersistableInsideOptional {\n    // Read an optional value of this type from the target object\n    static func _rlmGetPropertyOptional(_ obj: ObjectBase, _ key: PropertyKey) -> Self?\n}\n\nextension _PersistableInsideOptional {\n    public static func _rlmSetAccessor(_ prop: RLMProperty) {\n        if prop.optional {\n            prop.swiftAccessor = PersistedPropertyAccessor<Optional<Self>>.self\n        } else {\n            prop.swiftAccessor = PersistedPropertyAccessor<Self>.self\n        }\n    }\n}\n\n// Default definition of _rlmDefaultValue used by everything exception for\n// Optional, which requires doing Optional<T>.none rather than Optional<T>().\npublic protocol _DefaultConstructible {\n    init()\n}\nextension _Persistable where Self: _DefaultConstructible {\n    public static func _rlmDefaultValue() -> Self {\n        .init()\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Impl/PropertyAccessors.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Realm\nimport Realm.Private\n\n// Get a pointer to the given property's ivar on the object. This is similar to\n// object_getIvar() but returns a pointer to the value rather than the value.\n@_transparent\nprivate func ptr(_ property: RLMProperty, _ obj: RLMObjectBase) -> UnsafeMutableRawPointer {\n    return Unmanaged.passUnretained(obj).toOpaque().advanced(by: property.swiftIvar)\n}\n\n// MARK: - Legacy Property Accessors\n\ninternal class ListAccessor<Element: RealmCollectionValue>: RLMManagedPropertyAccessor {\n    private static func bound(_ property: RLMProperty, _ obj: RLMObjectBase) -> List<Element> {\n        return ptr(property, obj).assumingMemoryBound(to: List<Element>.self).pointee\n    }\n\n    @objc override class func initialize(_ property: RLMProperty, on parent: RLMObjectBase) {\n        bound(property, parent)._rlmCollection = RLMManagedArray(parent: parent, property: property)\n    }\n\n    @objc override class func observe(_ property: RLMProperty, on parent: RLMObjectBase) {\n        bound(property, parent).rlmArray.setParent(parent, property: property)\n    }\n\n    @objc override class func get(_ property: RLMProperty, on parent: RLMObjectBase) -> Any {\n        return bound(property, parent)\n    }\n\n    @objc override class func set(_ property: RLMProperty, on parent: RLMObjectBase, to value: Any) {\n        bound(property, parent).assign(value)\n    }\n}\n\ninternal class SetAccessor<Element: RealmCollectionValue>: RLMManagedPropertyAccessor {\n    private static func bound(_ property: RLMProperty, _ obj: RLMObjectBase) -> MutableSet<Element> {\n        return ptr(property, obj).assumingMemoryBound(to: MutableSet<Element>.self).pointee\n    }\n\n    @objc override class func initialize(_ property: RLMProperty, on parent: RLMObjectBase) {\n        bound(property, parent)._rlmCollection = RLMManagedSet(parent: parent, property: property)\n    }\n\n    @objc override class func observe(_ property: RLMProperty, on parent: RLMObjectBase) {\n        bound(property, parent).rlmSet.setParent(parent, property: property)\n    }\n\n    @objc override class func get(_ property: RLMProperty, on parent: RLMObjectBase) -> Any {\n        return bound(property, parent)\n    }\n\n    @objc override class func set(_ property: RLMProperty, on parent: RLMObjectBase, to value: Any) {\n        bound(property, parent).assign(value)\n    }\n}\n\ninternal class MapAccessor<Key: _MapKey, Value: RealmCollectionValue>: RLMManagedPropertyAccessor {\n    private static func bound(_ property: RLMProperty, _ obj: RLMObjectBase) -> Map<Key, Value> {\n        return ptr(property, obj).assumingMemoryBound(to: Map<Key, Value>.self).pointee\n    }\n\n    @objc override class func initialize(_ property: RLMProperty, on parent: RLMObjectBase) {\n        bound(property, parent)._rlmCollection = RLMManagedDictionary(parent: parent, property: property)\n    }\n\n    @objc override class func observe(_ property: RLMProperty, on parent: RLMObjectBase) {\n        bound(property, parent).rlmDictionary.setParent(parent, property: property)\n    }\n\n    @objc override class func get(_ property: RLMProperty, on parent: RLMObjectBase) -> Any {\n        return bound(property, parent)\n    }\n\n    @objc override class func set(_ property: RLMProperty, on parent: RLMObjectBase, to value: Any) {\n        bound(property, parent).assign(value)\n    }\n}\n\ninternal class LinkingObjectsAccessor<Element: ObjectBase>: RLMManagedPropertyAccessor\n        where Element: RealmCollectionValue {\n    private static func bound(_ property: RLMProperty, _ obj: RLMObjectBase) -> UnsafeMutablePointer<LinkingObjects<Element>> {\n        return ptr(property, obj).assumingMemoryBound(to: LinkingObjects<Element>.self)\n    }\n\n    @objc override class func initialize(_ property: RLMProperty, on parent: RLMObjectBase) {\n        bound(property, parent).pointee.handle =\n            RLMLinkingObjectsHandle(object: parent, property: property)\n    }\n    @objc override class func observe(_ property: RLMProperty, on parent: RLMObjectBase) {\n        if parent.lastAccessedNames != nil {\n            bound(property, parent).pointee.handle = RLMLinkingObjectsHandle(object: parent, property: property)\n        }\n    }\n    @objc override class func get(_ property: RLMProperty, on parent: RLMObjectBase) -> Any {\n        return bound(property, parent).pointee\n    }\n}\n\n@available(*, deprecated)\ninternal class RealmOptionalAccessor<Value: RealmOptionalType>: RLMManagedPropertyAccessor {\n    private static func bound(_ property: RLMProperty, _ obj: RLMObjectBase) -> RealmOptional<Value> {\n        return ptr(property, obj).assumingMemoryBound(to: RealmOptional<Value>.self).pointee\n    }\n\n    @objc override class func initialize(_ property: RLMProperty, on parent: RLMObjectBase) {\n        RLMInitializeManagedSwiftValueStorage(bound(property, parent), parent, property)\n    }\n\n    @objc override class func observe(_ property: RLMProperty, on parent: RLMObjectBase) {\n        RLMInitializeUnmanagedSwiftValueStorage(bound(property, parent), parent, property)\n    }\n\n    @objc override class func get(_ property: RLMProperty, on parent: RLMObjectBase) -> Any {\n        let value = bound(property, parent).value\n        return value._rlmObjcValue\n    }\n\n    @objc override class func set(_ property: RLMProperty, on parent: RLMObjectBase, to value: Any) {\n        bound(property, parent).value = Value._rlmFromObjc(value)\n    }\n}\n\ninternal class RealmPropertyAccessor<Value: RealmPropertyType>: RLMManagedPropertyAccessor {\n    private static func bound(_ property: RLMProperty, _ obj: RLMObjectBase) -> RealmProperty<Value> {\n        return ptr(property, obj).assumingMemoryBound(to: RealmProperty<Value>.self).pointee\n    }\n\n    @objc override class func initialize(_ property: RLMProperty, on parent: RLMObjectBase) {\n        RLMInitializeManagedSwiftValueStorage(bound(property, parent), parent, property)\n    }\n\n    @objc override class func observe(_ property: RLMProperty, on parent: RLMObjectBase) {\n        RLMInitializeUnmanagedSwiftValueStorage(bound(property, parent), parent, property)\n    }\n\n    @objc override class func get(_ property: RLMProperty, on parent: RLMObjectBase) -> Any {\n        return bound(property, parent).value._rlmObjcValue\n    }\n\n    @objc override class func set(_ property: RLMProperty, on parent: RLMObjectBase, to value: Any) {\n        bound(property, parent).value = Value._rlmFromObjc(value)!\n    }\n}\n\n// MARK: - Modern Property Accessors\n\ninternal class PersistedPropertyAccessor<T: _Persistable>: RLMManagedPropertyAccessor {\n    fileprivate static func bound(_ property: RLMProperty, _ obj: RLMObjectBase) -> UnsafeMutablePointer<Persisted<T>> {\n        return ptr(property, obj).assumingMemoryBound(to: Persisted<T>.self)\n    }\n\n    @objc override class func initialize(_ property: RLMProperty, on parent: RLMObjectBase) {\n        bound(property, parent).pointee.initialize(parent, key: PropertyKey(property.index))\n    }\n\n    @objc override class func observe(_ property: RLMProperty, on parent: RLMObjectBase) {\n        bound(property, parent).pointee.observe(parent, property: property)\n    }\n\n    @objc override class func get(_ property: RLMProperty, on parent: RLMObjectBase) -> Any {\n        return bound(property, parent).pointee.get(parent)\n    }\n\n    @objc override class func set(_ property: RLMProperty, on parent: RLMObjectBase, to value: Any) {\n        guard let v = T._rlmFromObjc(value) else {\n            throwRealmException(\"Could not convert value '\\(value)' to type '\\(T.self)'.\")\n        }\n        bound(property, parent).pointee.set(parent, value: v)\n    }\n}\n\ninternal class PersistedListAccessor<Element: RealmCollectionValue & _Persistable>: PersistedPropertyAccessor<List<Element>> {\n    @objc override class func set(_ property: RLMProperty, on parent: RLMObjectBase, to value: Any) {\n        bound(property, parent).pointee.get(parent).assign(value)\n    }\n\n    // When promoting an existing object to managed we want to promote the existing\n    // Swift collection object if it exists\n    @objc override class func promote(_ property: RLMProperty, on parent: RLMObjectBase) {\n        let key = PropertyKey(property.index)\n        if let existing = bound(property, parent).pointee.initializeCollection(parent, key: key) {\n            existing._rlmCollection = RLMGetSwiftPropertyArray(parent, key)\n        }\n    }\n}\n\ninternal class PersistedSetAccessor<Element: RealmCollectionValue & _Persistable>: PersistedPropertyAccessor<MutableSet<Element>> {\n    @objc override class func set(_ property: RLMProperty, on parent: RLMObjectBase, to value: Any) {\n        bound(property, parent).pointee.get(parent).assign(value)\n    }\n    @objc override class func promote(_ property: RLMProperty, on parent: RLMObjectBase) {\n        let key = PropertyKey(property.index)\n        if let existing = bound(property, parent).pointee.initializeCollection(parent, key: key) {\n            existing._rlmCollection = RLMGetSwiftPropertyArray(parent, key)\n        }\n    }\n}\n\ninternal class PersistedMapAccessor<Key: _MapKey, Value: RealmCollectionValue & _Persistable>: PersistedPropertyAccessor<Map<Key, Value>> {\n    @objc override class func set(_ property: RLMProperty, on parent: RLMObjectBase, to value: Any) {\n        bound(property, parent).pointee.get(parent).assign(value)\n    }\n    @objc override class func promote(_ property: RLMProperty, on parent: RLMObjectBase) {\n        let key = PropertyKey(property.index)\n        if let existing = bound(property, parent).pointee.initializeCollection(parent, key: key) {\n            existing._rlmCollection = RLMGetSwiftPropertyMap(parent, PropertyKey(property.index))\n        }\n    }\n}\n\ninternal class PersistedLinkingObjectsAccessor<Element: ObjectBase & RealmCollectionValue & _Persistable>: RLMManagedPropertyAccessor {\n    private static func bound(_ property: RLMProperty, _ obj: RLMObjectBase) -> UnsafeMutablePointer<Persisted<LinkingObjects<Element>>> {\n        return ptr(property, obj).assumingMemoryBound(to: Persisted<LinkingObjects<Element>>.self)\n    }\n\n    @objc override class func initialize(_ property: RLMProperty, on parent: RLMObjectBase) {\n        bound(property, parent).pointee.initialize(parent, key: PropertyKey(property.index))\n    }\n    @objc override class func observe(_ property: RLMProperty, on parent: RLMObjectBase) {\n        if parent.lastAccessedNames != nil {\n            bound(property, parent).pointee.observe(parent, property: property)\n        }\n    }\n    @objc override class func get(_ property: RLMProperty, on parent: RLMObjectBase) -> Any {\n        return bound(property, parent).pointee.get(parent)\n    }\n}\n\n// Dynamic getters return the Swift type for Collections, and the obj-c type\n// for enums and AnyRealmValue. This difference is probably a mistake but it's\n// a breaking change to adjust.\ninternal class BridgedPersistedPropertyAccessor<T: _Persistable>: PersistedPropertyAccessor<T> {\n    @objc override class func get(_ property: RLMProperty, on parent: RLMObjectBase) -> Any {\n        return bound(property, parent).pointee.get(parent)._rlmObjcValue\n    }\n}\n\ninternal class CustomPersistablePropertyAccessor<T: _Persistable>: BridgedPersistedPropertyAccessor<T> {\n    @objc override class func set(_ property: RLMProperty, on parent: RLMObjectBase, to value: Any) {\n        if coerceToNil(value) == nil {\n            super.set(property, on: parent, to: T._rlmDefaultValue())\n        } else {\n            super.set(property, on: parent, to: value)\n        }\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Impl/RealmCollectionImpl.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\n\n// RealmCollectionImpl implements all of the RealmCollection protocol except for\n// description and single-element subscript. description actually varies between\n// the collection wrappers, and Sequence infers its associated types from subscript,\n// so moving that here requires defining those explicitly in each collection.\n//\n// The functions don't need to be documented here because Xcode/DocC inherit\n// the documentation from the RealmCollection protocol definition, and jazzy\n// excludes this file entirely.\ninternal protocol RealmCollectionImpl: RealmCollection where Index == Int, SubSequence == Slice<Self>, Iterator == RLMIterator<Element> {\n    var collection: RLMCollection { get }\n    init(collection: RLMCollection)\n}\nextension RealmCollectionImpl {\n    public var realm: Realm? { collection.realm.map(Realm.init) }\n    public var isInvalidated: Bool { collection.isInvalidated }\n    public var count: Int { Int(collection.count) }\n\n    public subscript(bounds: Range<Self.Index>) -> SubSequence {\n        return SubSequence(base: self, bounds: bounds)\n    }\n    public var first: Element? {\n        return collection.firstObject!().map(staticBridgeCast)\n    }\n    public var last: Element? {\n        return collection.lastObject!().map(staticBridgeCast)\n    }\n    public func objects(at indexes: IndexSet) -> [Element] {\n        guard let r = collection.objects!(at: indexes) else {\n            throwRealmException(\"Indexes for collection are out of bounds.\")\n        }\n        return r.map(staticBridgeCast)\n    }\n\n    public func index(of object: Element) -> Int? {\n        if let indexOf = collection.index(of:) {\n            return notFoundToNil(index: indexOf(staticBridgeCast(fromSwift: object) as AnyObject))\n        }\n        fatalError(\"Collection does not support index(of:)\")\n    }\n    public func index(matching predicate: NSPredicate) -> Int? {\n        if let indexMatching = collection.indexOfObject(with:) {\n            return notFoundToNil(index: indexMatching(predicate))\n        }\n        fatalError(\"Collection does not support index(matching:)\")\n    }\n\n    public func filter(_ predicate: NSPredicate) -> Results<Element> {\n        return Results<Element>(collection.objects(with: predicate))\n    }\n\n    public func sorted<S: Sequence>(by sortDescriptors: S) -> Results<Element>\n        where S.Iterator.Element == SortDescriptor {\n            return Results<Element>(collection.sortedResults(using: sortDescriptors.map { $0.rlmSortDescriptorValue }))\n    }\n\n    public func distinct<S: Sequence>(by keyPaths: S) -> Results<Element>\n        where S.Iterator.Element == String {\n            return Results<Element>(collection.distinctResults(usingKeyPaths: Array(keyPaths)))\n    }\n\n    public func min<T: _HasPersistedType>(ofProperty property: String) -> T? where T.PersistedType: MinMaxType {\n        return collection.min(ofProperty: property).map(staticBridgeCast)\n    }\n    public func max<T: _HasPersistedType>(ofProperty property: String) -> T? where T.PersistedType: MinMaxType {\n        return collection.max(ofProperty: property).map(staticBridgeCast)\n    }\n    public func sum<T: _HasPersistedType>(ofProperty property: String) -> T where T.PersistedType: AddableType {\n        return staticBridgeCast(fromObjectiveC: collection.sum(ofProperty: property))\n    }\n    public func average<T: _HasPersistedType>(ofProperty property: String) -> T? where T.PersistedType: AddableType {\n        return collection.average(ofProperty: property).map(staticBridgeCast)\n    }\n\n    public func value(forKey key: String) -> Any? {\n        return collection.value(forKey: key)\n    }\n    public func value(forKeyPath keyPath: String) -> Any? {\n        return collection.value(forKeyPath: keyPath)\n    }\n    public func setValue(_ value: Any?, forKey key: String) {\n        return collection.setValue(value, forKey: key)\n    }\n\n    public func observe(keyPaths: [String]?,\n                        on queue: DispatchQueue?,\n                        _ block: @escaping (RealmCollectionChange<Self>) -> Void) -> NotificationToken {\n        // We want to pass the same object instance to the change callback each time.\n        // If the callback is being called on the source thread the instance should\n        // be `self`, but if it's on a different thread it needs to be a new Swift\n        // wrapper for the obj-c type, which we'll construct the first time the\n        // callback is called.\n        var col: Self?\n        func wrapped(collection: RLMCollection?, change: RLMCollectionChange?, error: Error?) {\n            if col == nil, let collection = collection {\n                col = self.collection === collection ? self : Self(collection: collection)\n            }\n            block(.init(value: col, change: change, error: error))\n        }\n        return collection.addNotificationBlock(wrapped, keyPaths: keyPaths, queue: queue)\n    }\n\n#if compiler(<6)\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    @_unsafeInheritExecutor\n    public func observe<A: Actor>(\n        keyPaths: [String]?, on actor: A,\n        _ block: @Sendable @escaping (isolated A, RealmCollectionChange<Self>) -> Void\n    ) async -> NotificationToken {\n        await with(self, on: actor) { actor, collection in\n            collection.observe(keyPaths: keyPaths, on: nil) { change in\n                actor.invokeIsolated(block, change)\n            }\n        }\n    }\n#else\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    public func observe<A: Actor>(\n        keyPaths: [String]?, on actor: A,\n        _isolation: isolated (any Actor)? = #isolation,\n        _ block: @Sendable @escaping (isolated A, RealmCollectionChange<Self>) -> Void\n    ) async -> NotificationToken {\n        await with(self, on: actor) { actor, collection in\n            collection.observe(keyPaths: keyPaths, on: nil) { change in\n                actor.invokeIsolated(block, change)\n            }\n        }\n    }\n#endif\n\n    public var isFrozen: Bool {\n        return collection.isFrozen\n    }\n    public func freeze() -> Self {\n        return Self(collection: collection.freeze())\n    }\n    public func thaw() -> Self? {\n        return Self(collection: collection.thaw())\n    }\n\n    public func sectioned<Key: _Persistable>(sortDescriptors: [SortDescriptor],\n                                             _ keyBlock: @escaping ((Element) -> Key)) -> SectionedResults<Key, Element> {\n        if sortDescriptors.isEmpty {\n            throwRealmException(\"There must be at least one SortDescriptor when using SectionedResults.\")\n        }\n        let sectionedResults = collection.sectionedResults(using: sortDescriptors.map(ObjectiveCSupport.convert)) { value in\n            return keyBlock(Element._rlmFromObjc(value)!)._rlmObjcValue as? RLMValue\n        }\n\n        return SectionedResults(rlmSectionedResult: sectionedResults)\n    }\n}\n\n// A helper protocol which lets us check for Optional in where clauses\npublic protocol OptionalProtocol {\n    associatedtype Wrapped\n    func _rlmInferWrappedType() -> Wrapped\n}\n\nextension Optional: OptionalProtocol {\n    public func _rlmInferWrappedType() -> Wrapped { return self! }\n}\n\n// `with(object, on: actor) { object, actor in ... }` hands the object over\n// to the given actor and then invokes the callback within the actor.\n#if compiler(<6)\n@available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n@_unsafeInheritExecutor\ninternal func with<A: Actor, Value: ThreadConfined>(\n    _ value: Value, on actor: A,\n    _ block: @Sendable @escaping (isolated A, Value) async throws -> NotificationToken\n) async rethrows -> NotificationToken {\n    if value.realm == nil {\n        fatalError(\"Change notifications are only supported for managed objects\")\n    }\n\n    let tsr = ThreadSafeReference(to: value)\n    let config = Unchecked(wrappedValue: value.realm!.rlmRealm.configurationSharingSchema())\n    return try await actor.invoke { actor in\n        if Task.isCancelled {\n            return nil\n        }\n        let scheduler = RLMScheduler.actor(actor, invoke: actor.invoke, verify: actor.verifier())\n        let realm = Realm(try! RLMRealm(configuration: config.wrappedValue, confinedTo: scheduler))\n        guard let value = tsr.resolve(in: realm) else {\n            return nil\n        }\n        // This is safe but 5.10's sendability checking can't prove it\n        // nonisolated(unsafe) can't be applied to a let in guard so we need\n        // a second variable\n        nonisolated(unsafe) let v = value\n        return try await block(actor, v)\n    } ?? NotificationToken()\n}\n#else\n@available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\ninternal func with<A: Actor, Value: ThreadConfined>(\n    _ value: Value,\n    on actor: A,\n    _isolation: isolated (any Actor)? = #isolation,\n    _ block: @Sendable @escaping (isolated A, Value) async throws -> NotificationToken?\n) async rethrows -> NotificationToken {\n    if value.realm == nil {\n        fatalError(\"Change notifications are only supported for managed objects\")\n    }\n\n    let tsr = ThreadSafeReference(to: value)\n    nonisolated(unsafe) let config = value.realm!.rlmRealm.configurationSharingSchema()\n    return try await actor.invoke { actor in\n        if Task.isCancelled {\n            return nil\n        }\n        let scheduler = RLMScheduler.actor(actor, invoke: actor.invoke, verify: actor.verifier())\n        let realm = Realm(try! RLMRealm(configuration: config, confinedTo: scheduler))\n        guard let value = tsr.resolve(in: realm) else {\n            return nil\n        }\n        return try await block(actor, value)\n    } ?? NotificationToken()\n}\n#endif\n"
  },
  {
    "path": "RealmSwift/Impl/SchemaDiscovery.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\nimport Realm.Private\n\n// A type which we can get the runtime schema information from\npublic protocol _RealmSchemaDiscoverable {\n    // The Realm property type associated with this type\n    static var _rlmType: PropertyType { get }\n    static var _rlmOptional: Bool { get }\n    // Does this type require @objc for legacy declarations? Not used for modern\n    // declarations as no types use @objc.\n    static var _rlmRequireObjc: Bool { get }\n\n    // Set any fields of the property applicable to this type other than type/optional.\n    // There are both static and non-static versions of this function because\n    // some times need data from an instance (e.g. LinkingObjects, where the\n    // source property name is runtime data and not part of the type), while\n    // wrappers like Optional need to be able to recur to the wrapped type\n    // without creating an instance of that.\n    func _rlmPopulateProperty(_ prop: RLMProperty)\n    static func _rlmPopulateProperty(_ prop: RLMProperty)\n}\n\nextension RLMObjectBase {\n    /// Allow client code to generate properties (ie. via Swift Macros)\n    @_spi(RealmSwiftPrivate)\n    @objc open class func _customRealmProperties() -> [RLMProperty]? {\n        return nil\n    }\n}\n\ninternal protocol SchemaDiscoverable: _RealmSchemaDiscoverable {}\nextension SchemaDiscoverable {\n    public static var _rlmOptional: Bool { false }\n    public static var _rlmRequireObjc: Bool { true }\n    public func _rlmPopulateProperty(_ prop: RLMProperty) { }\n    public static func _rlmPopulateProperty(_ prop: RLMProperty) { }\n}\n\nextension RLMProperty {\n    internal convenience init(name: String, value: _RealmSchemaDiscoverable) {\n        let valueType = Swift.type(of: value)\n        self.init()\n        self.name = name\n        self.type = valueType._rlmType\n        self.optional = valueType._rlmOptional\n        value._rlmPopulateProperty(self)\n        valueType._rlmPopulateProperty(self)\n        if valueType._rlmRequireObjc {\n            self.updateAccessors()\n        }\n    }\n\n    /// Exposed for Macros.\n    /// Important: Keep args in same order & default value as `@Persisted` property wrapper\n    @_spi(RealmSwiftPrivate)\n    public convenience init<O: ObjectBase, V: _Persistable>(\n        name: String,\n        objectType _: O.Type,\n        valueType _: V.Type,\n        indexed: Bool = false,\n        primaryKey: Bool = false,\n        originProperty: String? = nil\n    ) {\n        self.init()\n        self.name = name\n        self.type = V._rlmType\n        self.optional = V._rlmOptional\n        self.indexed = primaryKey || indexed\n        self.isPrimary = primaryKey\n        self.linkOriginPropertyName = originProperty\n        V._rlmPopulateProperty(self)\n        V._rlmSetAccessor(self)\n        self.swiftIvar = ivar_getOffset(class_getInstanceVariable(O.self, \"_\" + name)!)\n    }\n}\n\nprivate func getModernProperties(_ object: ObjectBase) -> [RLMProperty] {\n    let columnNames: [String: String] = type(of: object).propertiesMapping()\n    return Mirror(reflecting: object).children.compactMap { prop in\n        guard let label = prop.label else { return nil }\n        guard let value = prop.value as? DiscoverablePersistedProperty else {\n            return nil\n        }\n        let property = RLMProperty(name: label, value: value)\n        property.swiftIvar = ivar_getOffset(class_getInstanceVariable(type(of: object), label)!)\n        property.columnName = columnNames[property.name]\n        return property\n    }\n}\n\n// If the property is a storage property for a lazy Swift property, return\n// the base property name (e.g. `foo.storage` becomes `foo`). Otherwise, nil.\nprivate func baseName(forLazySwiftProperty name: String) -> String? {\n    // A Swift lazy var shows up as two separate children on the reflection tree:\n    // one named 'x', and another that is optional and is named \"$__lazy_storage_$_propName\"\n    if let storageRange = name.range(of: \"$__lazy_storage_$_\", options: [.anchored]) {\n        return String(name[storageRange.upperBound...])\n    }\n    return nil\n}\n\nprivate func getLegacyProperties(_ object: ObjectBase, _ cls: ObjectBase.Type) -> [RLMProperty] {\n    let indexedProperties: Set<String>\n    let ignoredPropNames: Set<String>\n    let columnNames: [String: String] = type(of: object).propertiesMapping()\n    if let realmObject = object as? Object {\n        indexedProperties = Set(type(of: realmObject).indexedProperties())\n        ignoredPropNames = Set(type(of: realmObject).ignoredProperties())\n    } else if let realmEmbeddedObject = object as? EmbeddedObject {\n        indexedProperties = Set()\n        ignoredPropNames = Set(type(of: realmEmbeddedObject).ignoredProperties())\n    } else {\n        indexedProperties = Set()\n        ignoredPropNames = Set()\n    }\n    return Mirror(reflecting: object).children.filter { (prop: Mirror.Child) -> Bool in\n        guard let label = prop.label else { return false }\n        if ignoredPropNames.contains(label) {\n            return false\n        }\n        if let lazyBaseName = baseName(forLazySwiftProperty: label) {\n            if ignoredPropNames.contains(lazyBaseName) {\n                return false\n            }\n            throwRealmException(\"Lazy managed property '\\(lazyBaseName)' is not allowed on a Realm Swift object\"\n                + \" class. Either add the property to the ignored properties list or make it non-lazy.\")\n        }\n        return true\n    }.compactMap { prop in\n        guard let label = prop.label else { return nil }\n        var rawValue = prop.value\n        if let value = rawValue as? RealmEnum {\n            rawValue = value._rlmObjcValue\n        }\n\n        guard let value = rawValue as? _RealmSchemaDiscoverable else {\n            if class_getProperty(cls, label) != nil {\n                throwRealmException(\"Property \\(cls).\\(label) is declared as \\(type(of: prop.value)), which is not a supported managed Object property type. If it is not supposed to be a managed property, either add it to `ignoredProperties()` or do not declare it as `@objc dynamic`. See https://www.mongodb.com/docs/realm-sdks/swift/latest/Classes/Object.html for more information.\")\n            }\n            if prop.value is RealmOptionalProtocol {\n                throwRealmException(\"Property \\(cls).\\(label) has unsupported RealmOptional type \\(type(of: prop.value)). Extending RealmOptionalType with custom types is not currently supported. \")\n            }\n            return nil\n        }\n\n        RLMValidateSwiftPropertyName(label)\n        let valueType = type(of: value)\n\n        let property = RLMProperty(name: label, value: value)\n        property.indexed = indexedProperties.contains(property.name)\n        property.columnName = columnNames[property.name]\n\n        if let objcProp = class_getProperty(cls, label) {\n            var count: UInt32 = 0\n            let attrs = property_copyAttributeList(objcProp, &count)!\n            defer {\n                free(attrs)\n            }\n            var computed = true\n            for i in 0..<Int(count) {\n                let attr = attrs[i]\n                switch attr.name[0] {\n                case Int8(UInt8(ascii: \"R\")): // Read only\n                    return nil\n                case Int8(UInt8(ascii: \"V\")): // Ivar name\n                    computed = false\n                case Int8(UInt8(ascii: \"G\")): // Getter name\n                    property.getterName = String(cString: attr.value)\n                case Int8(UInt8(ascii: \"S\")): // Setter name\n                    property.setterName = String(cString: attr.value)\n                default:\n                    break\n                }\n            }\n\n            // If there's no ivar name and no ivar with the same name as\n            // the property then this is a computed property and we should\n            // implicitly ignore it\n            if computed && class_getInstanceVariable(cls, label) == nil {\n                return nil\n            }\n        } else if valueType._rlmRequireObjc {\n            // Implicitly ignore non-@objc dynamic properties\n            return nil\n        } else {\n            property.swiftIvar = ivar_getOffset(class_getInstanceVariable(cls, label)!)\n        }\n\n        property.isLegacy = true\n        property.updateAccessors()\n        return property\n    }\n}\n\nprivate func getProperties(_ cls: RLMObjectBase.Type) -> [RLMProperty] {\n    if let props = cls._customRealmProperties() {\n        return props\n    }\n    // Check for any modern properties and only scan for legacy properties if\n    // none are found.\n    let object = cls.init()\n    let props = getModernProperties(object)\n    if props.count > 0 {\n        return props\n    }\n    return getLegacyProperties(object, cls)\n}\n\ninternal class ObjectUtil {\n    private static let runOnce: Void = {\n        RLMSetSwiftBridgeCallback { (value: Any) -> Any? in\n            // `as AnyObject` required on iOS <= 13; it will compile but silently\n            // fail to cast otherwise\n            if let value = value as AnyObject as? _ObjcBridgeable {\n                return value._rlmObjcValue\n            }\n            return nil\n        }\n    }()\n\n    internal class func getSwiftProperties(_ cls: RLMObjectBase.Type) -> [RLMProperty] {\n        _ = ObjectUtil.runOnce\n        return getProperties(cls)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/LinkingObjects.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2016 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\n\n/**\n `LinkingObjects` is an auto-updating container type. It represents zero or more objects that are linked to its owning\n model object through a property relationship.\n\n `LinkingObjects` can be queried with the same predicates as `List<Element>` and `Results<Element>`.\n\n `LinkingObjects` always reflects the current state of the Realm on the current thread, including during write\n transactions on the current thread. The one exception to this is when using `for...in` enumeration, which will always\n enumerate over the linking objects that were present when the enumeration is begun, even if some of them are deleted or\n modified to no longer link to the target object during the enumeration.\n\n `LinkingObjects` can only be used as a property on `Object` models.\n */\n@frozen public struct LinkingObjects<Element: ObjectBase & RealmCollectionValue>: RealmCollectionImpl {\n    // MARK: Initializers\n\n    /**\n     Creates an instance of a `LinkingObjects`. This initializer should only be called when declaring a property on a\n     Realm model.\n\n     - parameter type:         The type of the object owning the property the linking objects should refer to.\n     - parameter propertyName: The property name of the property the linking objects should refer to.\n     */\n    public init(fromType _: Element.Type, property propertyName: String) {\n        self.propertyName = propertyName\n    }\n\n    /// A human-readable description of the objects represented by the linking objects.\n    public var description: String {\n        if realm == nil {\n            var this = self\n            return withUnsafePointer(to: &this) {\n                return \"LinkingObjects<\\(Element.className())> <\\($0)> (\\n\\n)\"\n            }\n        }\n        return RLMDescriptionWithMaxDepth(\"LinkingObjects\", collection, RLMDescriptionMaxDepth)\n    }\n\n    // MARK: Object Retrieval\n\n    /**\n     Returns the object at the given `index`.\n\n     - parameter index: The index.\n     */\n    public subscript(index: Int) -> Element {\n        if let lastAccessedNames = lastAccessedNames {\n            return Element.keyPathRecorder(with: lastAccessedNames)\n        }\n        throwForNegativeIndex(index)\n        return collection[UInt(index)] as! Element\n    }\n\n    // MARK: Equatable\n\n    public static func == (lhs: LinkingObjects<Element>, rhs: LinkingObjects<Element>) -> Bool {\n        lhs.collection.isEqual(rhs.collection)\n    }\n\n    // MARK: Implementation\n    internal init(propertyName: String, handle: RLMLinkingObjectsHandle?) {\n        self.propertyName = propertyName\n        self.handle = handle\n    }\n    internal init(collection: RLMCollection) {\n        self.propertyName = \"\"\n        self.handle = RLMLinkingObjectsHandle(linkingObjects: collection as! RLMResults<AnyObject>)\n    }\n\n    internal var collection: RLMCollection {\n        return handle?.results ?? RLMResults<AnyObject>.emptyDetached()\n    }\n\n    internal var propertyName: String\n    internal var handle: RLMLinkingObjectsHandle?\n    internal var lastAccessedNames: NSMutableArray?\n\n    /// :nodoc:\n    public func makeIterator() -> RLMIterator<Element> {\n        return RLMIterator(collection: collection)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/List.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\nimport Realm.Private\n\n/**\n `List` is the container type in Realm used to define to-many relationships.\n\n Like Swift's `Array`, `List` is a generic type that is parameterized on the type it stores. This can be either an `Object`\n subclass or one of the following types: `Bool`, `Int`, `Int8`, `Int16`, `Int32`, `Int64`, `Float`, `Double`,\n `String`, `Data`, `Date`, `Decimal128`, and `ObjectId` (and their optional versions)\n\n Unlike Swift's native collections, `List`s are reference types, and are only immutable if the Realm that manages them\n is opened as read-only.\n\n Lists can be filtered and sorted with the same predicates as `Results<Element>`.\n*/\npublic final class List<Element: RealmCollectionValue>: RLMSwiftCollectionBase, RealmCollectionImpl {\n    internal var lastAccessedNames: NSMutableArray?\n\n    internal var rlmArray: RLMArray<AnyObject> {\n        unsafeDowncast(collection, to: RLMArray<AnyObject>.self)\n    }\n    internal var collection: RLMCollection {\n        _rlmCollection\n    }\n\n    // MARK: Initializers\n\n    /// Creates a `List` that holds Realm model objects of type `Element`.\n    public override init() {\n        super.init()\n    }\n    /// :nodoc:\n    public override init(collection: RLMCollection) {\n        super.init(collection: collection)\n    }\n\n    // MARK: Object Retrieval\n\n    /**\n     Returns the object at the given index (get), or replaces the object at the given index (set).\n\n     - warning: You can only set an object during a write transaction.\n\n     - parameter index: The index of the object to retrieve or replace.\n     */\n    public subscript(position: Int) -> Element {\n        get {\n            if let lastAccessedNames = lastAccessedNames {\n                return elementKeyPathRecorder(for: Element.self, with: lastAccessedNames)\n            }\n            throwForNegativeIndex(position)\n            return staticBridgeCast(fromObjectiveC: _rlmCollection.object(at: UInt(position)))\n        }\n        set {\n            throwForNegativeIndex(position)\n            rlmArray.replaceObject(at: UInt(position), with: staticBridgeCast(fromSwift: newValue) as AnyObject)\n        }\n    }\n\n    // MARK: KVC\n\n    /**\n     Returns an `Array` containing the results of invoking `valueForKey(_:)` using `key` on each of the collection's\n     objects.\n     */\n    @nonobjc public func value(forKey key: String) -> [AnyObject] {\n        return rlmArray.value(forKeyPath: key)! as! [AnyObject]\n    }\n\n    /**\n     Returns an `Array` containing the results of invoking `valueForKeyPath(_:)` using `keyPath` on each of the\n     collection's objects.\n\n     - parameter keyPath: The key path to the property whose values are desired.\n     */\n    @nonobjc public func value(forKeyPath keyPath: String) -> [AnyObject] {\n        return rlmArray.value(forKeyPath: keyPath) as! [AnyObject]\n    }\n\n    // MARK: Mutation\n\n    /**\n     Appends the given object to the end of the list.\n\n     If the object is managed by a different Realm than the receiver, a copy is made and added to the Realm managing\n     the receiver.\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter object: An object.\n     */\n    public func append(_ object: Element) {\n        rlmArray.add(staticBridgeCast(fromSwift: object) as AnyObject)\n    }\n\n    /**\n     Appends the objects in the given sequence to the end of the list.\n\n     - warning: This method may only be called during a write transaction.\n    */\n    public func append<S: Sequence>(objectsIn objects: S) where S.Iterator.Element == Element {\n        for obj in objects {\n            rlmArray.add(staticBridgeCast(fromSwift: obj) as AnyObject)\n        }\n    }\n\n    /**\n     Inserts an object at the given index.\n\n     - warning: This method may only be called during a write transaction.\n\n     - warning: This method will throw an exception if called with an invalid index.\n\n     - parameter object: An object.\n     - parameter index:  The index at which to insert the object.\n     */\n    public func insert(_ object: Element, at index: Int) {\n        throwForNegativeIndex(index)\n        rlmArray.insert(staticBridgeCast(fromSwift: object) as AnyObject, at: UInt(index))\n    }\n\n    /**\n     Removes an object at the given index. The object is not removed from the Realm that manages it.\n\n     - warning: This method may only be called during a write transaction.\n\n     - warning: This method will throw an exception if called with an invalid index.\n\n     - parameter index: The index at which to remove the object.\n     */\n    public func remove(at index: Int) {\n        throwForNegativeIndex(index)\n        rlmArray.removeObject(at: UInt(index))\n    }\n\n    /**\n     Removes all objects from the list. The objects are not removed from the Realm that manages them.\n\n     - warning: This method may only be called during a write transaction.\n     */\n    public func removeAll() {\n        rlmArray.removeAllObjects()\n    }\n\n    /**\n     Replaces an object at the given index with a new object.\n\n     - warning: This method may only be called during a write transaction.\n\n     - warning: This method will throw an exception if called with an invalid index.\n\n     - parameter index:  The index of the object to be replaced.\n     - parameter object: An object.\n     */\n    public func replace(index: Int, object: Element) {\n        throwForNegativeIndex(index)\n        rlmArray.replaceObject(at: UInt(index), with: staticBridgeCast(fromSwift: object) as AnyObject)\n    }\n\n    /**\n     Moves the object at the given source index to the given destination index.\n\n     - warning: This method may only be called during a write transaction.\n\n     - warning: This method will throw an exception if called with invalid indices.\n\n     - parameter from:  The index of the object to be moved.\n     - parameter to:    index to which the object at `from` should be moved.\n     */\n    public func move(from: Int, to: Int) {\n        throwForNegativeIndex(from)\n        throwForNegativeIndex(to)\n        rlmArray.moveObject(at: UInt(from), to: UInt(to))\n    }\n\n    /**\n     Exchanges the objects in the list at given indices.\n\n     - warning: This method may only be called during a write transaction.\n\n     - warning: This method will throw an exception if called with invalid indices.\n\n     - parameter index1: The index of the object which should replace the object at index `index2`.\n     - parameter index2: The index of the object which should replace the object at index `index1`.\n     */\n    public func swapAt(_ index1: Int, _ index2: Int) {\n        throwForNegativeIndex(index1, parameterName: \"index1\")\n        throwForNegativeIndex(index2, parameterName: \"index2\")\n        rlmArray.exchangeObject(at: UInt(index1), withObjectAt: UInt(index2))\n    }\n\n    @objc static func _unmanagedCollection() -> RLMArray<AnyObject> {\n        if let type = Element.self as? ObjectBase.Type {\n            return RLMArray(objectClassName: type.className())\n        }\n        if let type = Element.PersistedType.self as? ObjectBase.Type {\n            return RLMArray(objectClassName: type.className())\n        }\n        if let type = Element.PersistedType.self as? _RealmSchemaDiscoverable.Type {\n            return RLMArray(objectType: type._rlmType, optional: type._rlmOptional)\n        }\n        fatalError(\"Collections of projections must be used with @Projected.\")\n    }\n\n    /// :nodoc:\n    @objc public override static func _backingCollectionType() -> AnyClass {\n        RLMManagedArray.self\n    }\n\n    // Printable requires a description property defined in Swift (and not obj-c),\n    // and it has to be defined as override, which can't be done in a\n    // generic class.\n    /// Returns a human-readable description of the objects contained in the List.\n    @objc public override var description: String {\n        return descriptionWithMaxDepth(RLMDescriptionMaxDepth)\n    }\n\n    @objc private func descriptionWithMaxDepth(_ depth: UInt) -> String {\n        return RLMDescriptionWithMaxDepth(\"List\", _rlmCollection, depth)\n    }\n}\n\nextension List {\n    /**\n     Replace the given `subRange` of elements with `newElements`.\n\n     - parameter subrange:    The range of elements to be replaced.\n     - parameter newElements: The new elements to be inserted into the List.\n     */\n    public func replaceSubrange<C: Collection, R>(_ subrange: R, with newElements: C)\n        where C.Iterator.Element == Element, R: RangeExpression, List<Element>.Index == R.Bound {\n            let subrange = subrange.relative(to: self)\n            for _ in subrange.lowerBound..<subrange.upperBound {\n                remove(at: subrange.lowerBound)\n            }\n            for x in newElements.reversed() {\n                insert(x, at: subrange.lowerBound)\n            }\n    }\n}\n\n// MARK: - MutableCollection conformance, range replaceable collection emulation\nextension List: MutableCollection {\n    public typealias SubSequence = Slice<List>\n\n    /**\n     Returns the objects at the given range (get), or replaces the objects at the\n     given range with new objects (set).\n\n     - warning: Objects may only be set during a write transaction.\n\n     - parameter index: The index of the object to retrieve or replace.\n     */\n    public subscript(bounds: Range<Int>) -> SubSequence {\n        get {\n            return SubSequence(base: self, bounds: bounds)\n        }\n        set {\n            replaceSubrange(bounds.lowerBound..<bounds.upperBound, with: newValue)\n        }\n    }\n\n    /**\n     Removes the specified number of objects from the beginning of the list. The\n     objects are not removed from the Realm that manages them.\n\n     - warning: This method may only be called during a write transaction.\n     */\n    public func removeFirst(_ number: Int = 1) {\n        throwForNegativeIndex(number)\n        let count = Int(_rlmCollection.count)\n        guard number <= count else {\n            throwRealmException(\"It is not possible to remove more objects (\\(number)) from a list\"\n                + \" than it already contains (\\(count)).\")\n        }\n        for _ in 0..<number {\n            rlmArray.removeObject(at: 0)\n        }\n    }\n\n    /**\n     Removes the specified number of objects from the end of the list. The objects\n     are not removed from the Realm that manages them.\n\n     - warning: This method may only be called during a write transaction.\n     */\n    public func removeLast(_ number: Int = 1) {\n        throwForNegativeIndex(number)\n        let count = Int(_rlmCollection.count)\n        guard number <= count else {\n            throwRealmException(\"It is not possible to remove more objects (\\(number)) from a list\"\n                + \" than it already contains (\\(count)).\")\n        }\n        for _ in 0..<number {\n            rlmArray.removeLastObject()\n        }\n    }\n\n    /**\n     Inserts the items in the given collection into the list at the given position.\n\n     - warning: This method may only be called during a write transaction.\n     */\n    public func insert<C: Collection>(contentsOf newElements: C, at i: Int) where C.Iterator.Element == Element {\n        var currentIndex = i\n        for item in newElements {\n            insert(item, at: currentIndex)\n            currentIndex += 1\n        }\n    }\n    /**\n     Removes objects from the list at the given range.\n\n     - warning: This method may only be called during a write transaction.\n     */\n    public func removeSubrange<R>(_ boundsExpression: R) where R: RangeExpression, List<Element>.Index == R.Bound {\n        let bounds = boundsExpression.relative(to: self)\n        for _ in bounds {\n            remove(at: bounds.lowerBound)\n        }\n    }\n    /// :nodoc:\n    public func remove(atOffsets offsets: IndexSet) {\n        for offset in offsets.reversed() {\n            remove(at: offset)\n        }\n    }\n    /// :nodoc:\n    public func move(fromOffsets offsets: IndexSet, toOffset destination: Int) {\n        for offset in offsets {\n            var d = destination\n            if destination > offset {\n                d = destination - 1\n            }\n            move(from: offset, to: d)\n        }\n    }\n\n    /// :nodoc:\n    public func makeIterator() -> RLMIterator<Element> {\n        return RLMIterator(collection: collection)\n    }\n}\n\n// MARK: - Codable\n\nextension List: Decodable where Element: Decodable {\n    public convenience init(from decoder: Decoder) throws {\n        self.init()\n        var container = try decoder.unkeyedContainer()\n        while !container.isAtEnd {\n            append(try container.decode(Element.self))\n        }\n    }\n}\n\nextension List: Encodable where Element: Encodable {}\n"
  },
  {
    "path": "RealmSwift/Map.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\nimport Realm.Private\n\n/// :nodoc:\npublic protocol _MapKey: Hashable, _ObjcBridgeable {\n    static var _rlmType: RLMPropertyType { get }\n}\nextension String: _MapKey { }\n\n/**\n Map is a key-value storage container used to store supported Realm types.\n \n Map is a generic type that is parameterized on the type it stores. This can be either an Object\n subclass or one of the following types: Bool, Int, Int8, Int16, Int32, Int64, Float, Double,\n String, Data, Date, Decimal128, and ObjectId (and their optional versions)\n\n Map only supports `String` as a key.  Realm disallows the use of `.` or `$` characters within a dictionary key.\n\n Unlike Swift's native collections, `Map`s is a reference types, and are only immutable if the Realm that manages them\n is opened as read-only.\n \n A Map can be filtered and sorted with the same predicates as `Results<Value>`.\n*/\npublic final class Map<Key: _MapKey, Value: RealmCollectionValue>: RLMSwiftCollectionBase {\n\n    // MARK: Properties\n\n    /// Contains the last accessed property names when tracing the key path.\n    internal var lastAccessedNames: NSMutableArray?\n\n    /// The Realm which manages the map, or `nil` if the map is unmanaged.\n    public var realm: Realm? {\n        return _rlmCollection.realm.map { Realm($0) }\n    }\n\n    /// Indicates if the map can no longer be accessed.\n    public var isInvalidated: Bool { return _rlmCollection.isInvalidated }\n\n    /// Returns all of the keys in this map.\n    public var keys: [Key] {\n        return rlmDictionary.allKeys.map(staticBridgeCast)\n    }\n\n    /// Returns all of the values in this map.\n    public var values: [Value] {\n        return rlmDictionary.allValues.map(staticBridgeCast)\n    }\n\n    // MARK: Initializers\n\n    /// Creates a `Map` that holds Realm model objects of type `Value`.\n    public override init() {\n        super.init()\n    }\n    /// :nodoc:\n    public override init(collection: RLMCollection) {\n        super.init(collection: collection)\n    }\n    internal init(objc rlmDictionary: RLMDictionary<AnyObject, AnyObject>) {\n        super.init(collection: rlmDictionary)\n    }\n\n    // MARK: Count\n\n    /// Returns the number of key-value pairs in this map.\n    @objc public var count: Int { return Int(_rlmCollection.count) }\n\n    // MARK: Mutation\n\n    /**\n     Updates the value stored in the map for the given key, or adds a new key-value pair if the key does not exist.\n\n     - Note: If the value being added to the map is an unmanaged object and the\n             map is managed then that unmanaged object will be added to the Realm.\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter value: a value's key path predicate.\n     - parameter forKey: The direction to sort in.\n     */\n    public func updateValue(_ value: Value, forKey key: Key) {\n        rlmDictionary[objcKey(from: key)] = staticBridgeCast(fromSwift: value) as AnyObject\n    }\n\n    /**\n     Merges the given dictionary into this map, using a combining closure to\n     determine the value for any duplicate keys.\n\n     If `dictionary` contains a key which is already present in this map,\n     `combine` will be called with the value currently in the map and the value\n     in the dictionary. The value returned by the closure will be stored in the\n     map for that key.\n\n     - Note: If a value being added to the map is an unmanaged object and the\n             map is managed then that unmanaged object will be added to the Realm.\n\n     - warning: This method may only be called on managed Maps during a write transaction.\n\n     - parameter dictionary: The dictionary to merge into this map.\n     - parameter combine: A closure that takes the current and new values for\n                 any duplicate keys. The closure returns the desired value for\n                 the final map.\n     */\n    public func merge<S>(_ sequence: S, uniquingKeysWith combine: (Value, Value) throws -> Value) rethrows\n            where S: Sequence, S.Element == (key: Key, value: Value) {\n        for (key, value) in sequence {\n            let key = objcKey(from: key)\n            var selectedValue: Value\n            if let existing = rlmDictionary[key] {\n                selectedValue = try combine(staticBridgeCast(fromObjectiveC: existing), value)\n            } else {\n                selectedValue = value\n            }\n            rlmDictionary[key] = staticBridgeCast(fromSwift: selectedValue) as AnyObject\n        }\n    }\n\n    /**\n     Removes the given key and its associated object, only if the key exists in the map. If the key does not\n     exist, the map will not be modified.\n\n     - warning: This method may only be called during a write transaction.\n     */\n    public func removeObject(for key: Key) {\n        rlmDictionary.removeObject(forKey: objcKey(from: key))\n    }\n\n    /**\n     Removes all objects from the map. The objects are not removed from the Realm that manages them.\n\n     - warning: This method may only be called during a write transaction.\n     */\n    public func removeAll() {\n        rlmDictionary.removeAllObjects()\n    }\n\n    /**\n     Returns the value for a given key, or sets a value for a key should the subscript be used for an assign.\n\n     - Note:If the value being added to the map is an unmanaged object and the map is managed\n            then that unmanaged object will be added to the Realm.\n\n     - Note:If the value being assigned for a key is `nil` then that key will be removed from the map.\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter key: The key.\n     */\n    public subscript(key: Key) -> Value? {\n        get {\n            if let lastAccessedNames = lastAccessedNames {\n                return ((Value.self as! KeypathRecorder.Type).keyPathRecorder(with: lastAccessedNames) as! Value)\n            }\n            return rlmDictionary[objcKey(from: key)].map(staticBridgeCast)\n        }\n        set {\n            if newValue == nil {\n                rlmDictionary.removeObject(forKey: key as AnyObject)\n            } else {\n                rlmDictionary[objcKey(from: key)] = staticBridgeCast(fromSwift: newValue) as AnyObject\n            }\n        }\n    }\n\n    /**\n     Returns a type of `AnyObject` for a specified key if it exists in the map.\n\n     - parameter key: The key to the property whose values are desired.\n     */\n    @objc public func object(forKey key: AnyObject) -> AnyObject? {\n        return rlmDictionary.object(forKey: key as AnyObject)\n    }\n\n    // MARK: KVC\n\n    /**\n     Returns a type of `Value` for a specified key if it exists in the map.\n\n     Note that when using key-value coding, the key must be a string.\n\n     - parameter key: The key to the property whose values are desired.\n     */\n    @nonobjc public func value(forKey key: String) -> AnyObject? {\n        return rlmDictionary.value(forKey: key as AnyObject)\n            .map(dynamicBridgeCast)\n    }\n\n    /**\n     Returns a type of `Value` for a specified key if it exists in the map.\n\n     - parameter keyPath: The key to the property whose values are desired.\n     */\n    @nonobjc public func value(forKeyPath keyPath: String) -> AnyObject? {\n        return rlmDictionary.value(forKeyPath: keyPath)\n            .map(dynamicBridgeCast)\n    }\n\n    /**\n     Adds a given key-value pair to the map or updates a given key should it already exist.\n\n     - warning: This method can only be called during a write transaction.\n\n     - parameter value: The object value.\n     - parameter key:   The name of the property whose value should be set on each object.\n    */\n    public func setValue(_ value: Any?, forKey key: String) {\n        rlmDictionary.setValue(value, forKey: key)\n    }\n\n    // MARK: Filtering\n\n    /**\n     Returns a `Results` containing all matching values in the map with the given predicate.\n\n     - Note: This will return the values in the map, and not the key-value pairs.\n\n     - parameter predicate: The predicate with which to filter the values.\n     */\n    public func filter(_ predicate: NSPredicate) -> Results<Value> {\n        return Results<Value>(rlmDictionary.objects(with: predicate))\n    }\n\n    /**\n     Returns a `Results` containing all matching values in the map with the given query.\n\n     - Note: This should only be used with classes using the `@Persistable` property declaration.\n\n     - Usage:\n     ```\n     myMap.where {\n        ($0.fooCol > 5) && ($0.barCol == \"foobar\")\n     }\n     ```\n\n     - Note: See ``Query`` for more information on what query operations are available.\n\n     - parameter isIncluded: The query closure with which to filter the objects.\n     */\n    public func `where`(_ isIncluded: ((Query<Value>) -> Query<Bool>)) -> Results<Value> {\n        return filter(isIncluded(Query()).predicate)\n    }\n\n    /**\n     Returns a Boolean value indicating whether the Map contains the key-value pair\n     satisfies the given predicate\n\n     - parameter where: a closure that test if any key-pair of the given map represents the match.\n     */\n    public func contains(where predicate: @escaping (_ key: Key, _ value: Value) -> Bool) -> Bool {\n        var found = false\n        rlmDictionary.enumerateKeysAndObjects { (k, v, shouldStop) in\n            if predicate(staticBridgeCast(fromObjectiveC: k), staticBridgeCast(fromObjectiveC: v)) {\n                found = true\n                shouldStop.pointee = true\n            }\n        }\n        return found\n    }\n\n    // MARK: Sorting\n\n    /**\n     Returns a `Results` containing the objects in the map, but sorted.\n\n     Objects are sorted based on their values. For example, to sort a map of `Date`s from\n     newest to oldest based, you might call `dates.sorted(ascending: true)`.\n\n     - parameter ascending: The direction to sort in.\n     */\n    public func sorted(ascending: Bool = true) -> Results<Value> {\n        return sorted(byKeyPath: \"self\", ascending: ascending)\n    }\n\n    /**\n     Returns a `Results` containing the objects in the map, but sorted.\n\n     Objects are sorted based on the values of the given key path. For example, to sort a map of `Student`s from\n     youngest to oldest based on their `age` property, you might call\n     `students.sorted(byKeyPath: \"age\", ascending: true)`.\n\n     - warning: Dictionaries may only be sorted by properties of boolean, `Date`, `NSDate`, single and double-precision\n                floating point, integer, and string types.\n\n     - parameter keyPath:  The key path to sort by.\n     - parameter ascending: The direction to sort in.\n     */\n    public func sorted(byKeyPath keyPath: String, ascending: Bool = true) -> Results<Value> {\n        return sorted(by: [SortDescriptor(keyPath: keyPath, ascending: ascending)])\n    }\n\n    /**\n     Returns a `Results` containing the objects in the map, but sorted.\n\n     - warning: Map's may only be sorted by properties of boolean, `Date`, `NSDate`, single and double-precision\n                floating point, integer, and string types.\n\n     - see: `sorted(byKeyPath:ascending:)`\n    */\n    public func sorted<S: Sequence>(by sortDescriptors: S) -> Results<Value>\n        where S.Iterator.Element == SortDescriptor {\n            return Results<Value>(_rlmCollection.sortedResults(using: sortDescriptors.map { $0.rlmSortDescriptorValue }))\n    }\n\n    // MARK: Aggregate Operations\n\n    /**\n     Returns the minimum (lowest) value of the given property among all the objects in the collection, or `nil` if the\n     map is empty.\n\n     - warning: Only a property whose type conforms to the `MinMaxType` protocol can be specified.\n\n     - parameter property: The name of a property whose minimum value is desired.\n     */\n    public func min<T: _HasPersistedType>(ofProperty property: String) -> T? where T.PersistedType: MinMaxType {\n        return rlmDictionary.min(ofProperty: property).map(staticBridgeCast)\n    }\n\n    /**\n     Returns the maximum (highest) value of the given property among all the objects in the collection, or `nil` if the\n     map is empty.\n\n     - warning: Only a property whose type conforms to the `MinMaxType` protocol can be specified.\n\n     - parameter property: The name of a property whose minimum value is desired.\n     */\n    public func max<T: _HasPersistedType>(ofProperty property: String) -> T? where T.PersistedType: MinMaxType {\n        return rlmDictionary.max(ofProperty: property).map(staticBridgeCast)\n    }\n\n    /**\n    Returns the sum of the given property for objects in the collection, or `nil` if the map is empty.\n\n    - warning: Only names of properties of a type conforming to the `AddableType` protocol can be used.\n\n    - parameter property: The name of a property conforming to `AddableType` to calculate sum on.\n    */\n    public func sum<T: _HasPersistedType>(ofProperty property: String) -> T where T.PersistedType: AddableType {\n        return staticBridgeCast(fromObjectiveC: rlmDictionary.sum(ofProperty: property))\n    }\n\n    /**\n     Returns the average value of a given property over all the objects in the collection, or `nil` if\n     the map is empty.\n\n     - warning: Only a property whose type conforms to the `AddableType` protocol can be specified.\n\n     - parameter property: The name of a property whose values should be summed.\n     */\n    public func average<T: _HasPersistedType>(ofProperty property: String) -> T? where T.PersistedType: AddableType {\n        return rlmDictionary.average(ofProperty: property).map(staticBridgeCast)\n    }\n\n    // MARK: Notifications\n\n    /**\n     Registers a block to be called each time the map changes.\n\n     The block will be asynchronously called with the initial map, and then called again after each write\n     transaction which changes either any of the keys or values in the map.\n\n     The `change` parameter that is passed to the block reports, in the form of keys within the map, which of\n     the key-value pairs were added, removed, or modified during each write transaction.\n\n     If no queue is given, notifications are delivered via the standard run loop, and so can't be delivered while the\n     run loop is blocked by other activity. If a queue is given, notifications are delivered to that queue instead. When\n     notifications can't be delivered instantly, multiple notifications may be coalesced into a single notification.\n     This can include the notification with the initial collection.\n\n     For example, the following code performs a write transaction immediately after adding the notification block, so\n     there is no opportunity for the initial notification to be delivered first. As a result, the initial notification\n     will reflect the state of the Realm after the write transaction.\n\n     ```swift\n     let myStringMap = myObject.stringMap\n     print(\"myStringMap.count: \\(myStringMap?.count)\") // => 0\n     let token = myStringMap.observe { changes in\n         switch changes {\n         case .initial(let myStringMap):\n             // Will print \"myStringMap.count: 1\"\n             print(\"myStringMap.count: \\(myStringMap.count)\")\n            print(\"Dog Name: \\(myStringMap[\"nameOfDog\"])\") // => \"Rex\"\n             break\n         case .update:\n             // Will not be hit in this example\n             break\n         case .error:\n             break\n         }\n     }\n     try! realm.write {\n         myStringMap[\"nameOfDog\"] = \"Rex\"\n     }\n     ```\n\n     If no key paths are given, the block will be executed on any insertion,\n     modification, or deletion for all object properties and the properties of\n     any nested, linked objects. If a key path or key paths are provided,\n     then the block will be called for changes which occur only on the\n     provided key paths. For example, if:\n     ```swift\n     class Dog: Object {\n         @Persisted var name: String\n         @Persisted var age: Int\n         @Persisted var toys: List<Toy>\n     }\n     // ...\n     let dogs = myObject.mapOfDogs\n     let token = dogs.observe(keyPaths: [\"name\"]) { changes in\n         switch changes {\n         case .initial(let dogs):\n            // ...\n         case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the\n            // collection is modified\n            // - when an element is inserted or removed\n            //   from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on\n            //   one of the elements.\n         case .error:\n             // ...\n         }\n     }\n     ```\n     - If the observed key path were `[\"toys.brand\"]`, then any insertion or\n     deletion to the `toys` list on any of the collection's elements would trigger the block.\n     Changes to the `brand` value on any `Toy` that is linked to a `Dog` in this\n     collection will trigger the block. Changes to a value other than `brand` on any `Toy` that\n     is linked to a `Dog` in this collection would not trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would also trigger a notification.\n     - If the above example observed the `[\"toys\"]` key path, then any insertion,\n     deletion, or modification to the `toys` list for any element in the collection\n     would trigger the block.\n     Changes to any value on any `Toy` that is linked to a `Dog` in this collection\n     would *not* trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would still trigger a notification.\n\n     - note: Multiple notification tokens on the same object which filter for\n     separate key paths *do not* filter exclusively. If one key path\n     change is satisfied for one notification token, then all notification\n     token blocks for that object will execute.\n\n     You must retain the returned token for as long as you want updates to be sent to the block. To stop receiving\n     updates, call `invalidate()` on the token.\n\n     - warning: This method cannot be called during a write transaction, or when the containing Realm is read-only.\n\n     - parameter keyPaths: Only properties contained in the key paths array will trigger\n                           the block when they are modified. If `nil`, notifications\n                           will be delivered for any property change on the object.\n                           String key paths which do not correspond to a valid a property\n                           will throw an exception.\n                           See description above for more detail on linked properties.\n     - note: The keyPaths parameter refers to object properties of the collection type and\n             *does not* refer to particular key/value pairs within the Map.\n     - parameter queue: The serial dispatch queue to receive notification on. If\n                        `nil`, notifications are delivered to the current thread.\n     - parameter block: The block to be called whenever a change occurs.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    public func observe(keyPaths: [String]? = nil,\n                        on queue: DispatchQueue? = nil,\n                        _ block: @escaping (RealmMapChange<Map>) -> Void)\n    -> NotificationToken {\n        var col: Map?\n        let wrapped = { (collection: RLMDictionary<AnyObject, AnyObject>?, change: RLMDictionaryChange?, error: Error?) in\n            if col == nil, let collection = collection {\n                col = collection === self._rlmCollection ? self : Self(objc: collection)\n            }\n            block(.fromObjc(value: col, change: change, error: error))\n        }\n        return rlmDictionary.addNotificationBlock(wrapped, keyPaths: keyPaths, queue: queue)\n    }\n\n#if compiler(<6)\n    /**\n    Registers a block to be called each time the map changes.\n\n    The block will be asynchronously called on the actor with the initial map, and\n    then called again after each write transaction which changes either which keys\n    are present in the map or the values of any of the objects.\n\n    The `change` parameter that is passed to the block reports, in the form of keys\n    within the map, which of the key-value pairs were added, removed, or modified\n    during each write transaction.\n\n    Notifications are delivered to a function isolated to the given actor, on that\n    actors executor. If the actor is performing blocking work, multiple\n    notifications may be coalesced into a single notification. This can include the\n    notification with the initial collection, and changes are only reported for\n    writes which occur after the initial notification is delivered.\n\n    If no key paths are given, the block will be executed on any insertion,\n    modification, or deletion for all object properties and the properties of any\n    nested, linked objects. If a key path or key paths are provided, then the block\n    will be called for changes which occur only on the provided key paths. For\n    example, if:\n    ```swift\n    class Dog: Object {\n        @Persisted var name: String\n        @Persisted var age: Int\n        @Persisted var toys: List<Toy>\n    }\n    // ...\n    let dogs = myObject.mapOfDogs\n    let token = dogs.observe(keyPaths: [\"name\"], on: actor) { actor, changes in\n        switch changes {\n        case .initial(let dogs):\n            // ...\n        case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the collection is modified\n            // - when an element is inserted or removed from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on one of the elements.\n        case .error:\n            // No longer possible and left for backwards compatibility\n        }\n    }\n    ```\n    - If the observed key path were `[\"toys.brand\"]`, then any insertion or\n      deletion to the `toys` list on any of the collection's elements would trigger\n      the block. Changes to the `brand` value on any `Toy` that is linked to a `Dog`\n      in this collection will trigger the block. Changes to a value other than\n      `brand` on any `Toy` that is linked to a `Dog` in this collection would not\n      trigger the block. Any insertion or removal to the `Dog` type collection being\n      observed would also trigger a notification.\n    - If the above example observed the `[\"toys\"]` key path, then any insertion,\n      deletion, or modification to the `toys` list for any element in the collection\n      would trigger the block. Changes to any value on any `Toy` that is linked to a\n      `Dog` in this collection would *not* trigger the block. Any insertion or\n      removal to the `Dog` type collection being observed would still trigger a\n      notification.\n\n    You must retain the returned token for as long as you want updates to be sent\n    to the block. To stop receiving updates, call `invalidate()` on the token.\n\n    - warning: This method cannot be called during a write transaction, or when\n      the containing Realm is read-only.\n\n    - parameter keyPaths: Only properties contained in the key paths array will\n      trigger the block when they are modified. If `nil`, notifications will be\n      delivered for any property change on the object. String key paths which do not\n      correspond to a valid a property will throw an exception. See description above\n      for more detail on linked properties.\n    - note: The keyPaths parameter refers to object properties of the collection\n      type and *does not* refer to particular key/value pairs within the Map.\n    - parameter actor: The actor which notifications should be delivered on. The\n      block is passed this actor as an isolated parameter, allowing you to access the\n      actor synchronously from within the callback.\n    - parameter block: The block to be called whenever a change occurs.\n    - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    @_unsafeInheritExecutor\n    public func observe<A: Actor>(\n        keyPaths: [String]? = nil, on actor: A,\n        _ block: @Sendable @escaping (isolated A, RealmMapChange<Map>) -> Void\n    ) async -> NotificationToken {\n        await with(self, on: actor) { actor, collection in\n            collection.observe(keyPaths: keyPaths, on: nil) { change in\n                actor.invokeIsolated(block, change)\n            }\n        }\n    }\n\n    /**\n    Registers a block to be called each time the map changes.\n\n    The block will be asynchronously called on the actor with the initial map, and\n    then called again after each write transaction which changes either which keys\n    are present in the map or the values of any of the objects.\n\n    The `change` parameter that is passed to the block reports, in the form of keys\n    within the map, which of the key-value pairs were added, removed, or modified\n    during each write transaction.\n\n    Notifications are delivered to a function isolated to the given actor, on that\n    actors executor. If the actor is performing blocking work, multiple\n    notifications may be coalesced into a single notification. This can include the\n    notification with the initial collection, and changes are only reported for\n    writes which occur after the initial notification is delivered.\n\n    The block will be called for changes which occur only on the provided key\n    paths. For example, if:\n    ```swift\n    class Dog: Object {\n        @Persisted var name: String\n        @Persisted var age: Int\n        @Persisted var toys: List<Toy>\n    }\n    // ...\n    let dogs = myObject.mapOfDogs\n    let token = dogs.observe(keyPaths: [\\.name], on: actor) { actor, changes in\n        switch changes {\n        case .initial(let dogs):\n            // ...\n        case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the collection is modified\n            // - when an element is inserted or removed from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on one of the elements.\n        case .error:\n            // No longer possible and left for backwards compatibility\n        }\n    }\n    ```\n    - If the observed key path were `[\\.toys.brand]`, then any insertion or\n      deletion to the `toys` list on any of the collection's elements would trigger\n      the block. Changes to the `brand` value on any `Toy` that is linked to a `Dog`\n      in this collection will trigger the block. Changes to a value other than\n      `brand` on any `Toy` that is linked to a `Dog` in this collection would not\n      trigger the block. Any insertion or removal to the `Dog` type collection being\n      observed would also trigger a notification.\n    - If the above example observed the `[\\.toys]` key path, then any insertion,\n      deletion, or modification to the `toys` list for any element in the collection\n      would trigger the block. Changes to any value on any `Toy` that is linked to a\n      `Dog` in this collection would *not* trigger the block. Any insertion or\n      removal to the `Dog` type collection being observed would still trigger a\n      notification.\n\n    You must retain the returned token for as long as you want updates to be sent\n    to the block. To stop receiving updates, call `invalidate()` on the token.\n\n    - warning: This method cannot be called during a write transaction, or when\n      the containing Realm is read-only.\n\n    - parameter keyPaths: Only properties contained in the key paths array will\n      trigger the block when they are modified. If `nil`, notifications will be\n      delivered for any property change on the object. String key paths which do not\n      correspond to a valid a property will throw an exception. See description above\n      for more detail on linked properties.\n    - note: The keyPaths parameter refers to object properties of the collection\n      type and *does not* refer to particular key/value pairs within the Map.\n    - parameter actor: The actor which notifications should be delivered on. The\n      block is passed this actor as an isolated parameter, allowing you to access the\n      actor synchronously from within the callback.\n    - parameter block: The block to be called whenever a change occurs.\n    - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    @_unsafeInheritExecutor\n    public func observe<A: Actor>(\n        keyPaths: [PartialKeyPath<Value.Wrapped>], on actor: A,\n        _ block: @Sendable @escaping (isolated A, RealmMapChange<Map>) -> Void\n    ) async -> NotificationToken where Value: OptionalProtocol, Value.Wrapped: ObjectBase {\n        await observe(keyPaths: keyPaths.map(_name(for:)), on: actor, block)\n    }\n#else\n    /**\n    Registers a block to be called each time the map changes.\n\n    The block will be asynchronously called on the actor with the initial map, and\n    then called again after each write transaction which changes either which keys\n    are present in the map or the values of any of the objects.\n\n    The `change` parameter that is passed to the block reports, in the form of keys\n    within the map, which of the key-value pairs were added, removed, or modified\n    during each write transaction.\n\n    Notifications are delivered to a function isolated to the given actor, on that\n    actors executor. If the actor is performing blocking work, multiple\n    notifications may be coalesced into a single notification. This can include the\n    notification with the initial collection, and changes are only reported for\n    writes which occur after the initial notification is delivered.\n\n    If no key paths are given, the block will be executed on any insertion,\n    modification, or deletion for all object properties and the properties of any\n    nested, linked objects. If a key path or key paths are provided, then the block\n    will be called for changes which occur only on the provided key paths. For\n    example, if:\n    ```swift\n    class Dog: Object {\n        @Persisted var name: String\n        @Persisted var age: Int\n        @Persisted var toys: List<Toy>\n    }\n    // ...\n    let dogs = myObject.mapOfDogs\n    let token = dogs.observe(keyPaths: [\"name\"], on: actor) { actor, changes in\n        switch changes {\n        case .initial(let dogs):\n            // ...\n        case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the collection is modified\n            // - when an element is inserted or removed from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on one of the elements.\n        case .error:\n            // No longer possible and left for backwards compatibility\n        }\n    }\n    ```\n    - If the observed key path were `[\"toys.brand\"]`, then any insertion or\n      deletion to the `toys` list on any of the collection's elements would trigger\n      the block. Changes to the `brand` value on any `Toy` that is linked to a `Dog`\n      in this collection will trigger the block. Changes to a value other than\n      `brand` on any `Toy` that is linked to a `Dog` in this collection would not\n      trigger the block. Any insertion or removal to the `Dog` type collection being\n      observed would also trigger a notification.\n    - If the above example observed the `[\"toys\"]` key path, then any insertion,\n      deletion, or modification to the `toys` list for any element in the collection\n      would trigger the block. Changes to any value on any `Toy` that is linked to a\n      `Dog` in this collection would *not* trigger the block. Any insertion or\n      removal to the `Dog` type collection being observed would still trigger a\n      notification.\n\n    You must retain the returned token for as long as you want updates to be sent\n    to the block. To stop receiving updates, call `invalidate()` on the token.\n\n    - warning: This method cannot be called during a write transaction, or when\n      the containing Realm is read-only.\n\n    - parameter keyPaths: Only properties contained in the key paths array will\n      trigger the block when they are modified. If `nil`, notifications will be\n      delivered for any property change on the object. String key paths which do not\n      correspond to a valid a property will throw an exception. See description above\n      for more detail on linked properties.\n    - note: The keyPaths parameter refers to object properties of the collection\n      type and *does not* refer to particular key/value pairs within the Map.\n    - parameter actor: The actor which notifications should be delivered on. The\n      block is passed this actor as an isolated parameter, allowing you to access the\n      actor synchronously from within the callback.\n    - parameter block: The block to be called whenever a change occurs.\n    - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    public func observe<A: Actor>(\n        keyPaths: [String]? = nil, on actor: A,\n        _isolation: isolated (any Actor)? = #isolation,\n        _ block: @Sendable @escaping (isolated A, RealmMapChange<Map>) -> Void\n    ) async -> NotificationToken {\n        nonisolated(unsafe) let collection = self\n        return await with(collection, on: actor) { actor, collection in\n            collection.observe(keyPaths: keyPaths, on: nil) { change in\n                actor.invokeIsolated(block, change)\n            }\n        }\n    }\n\n    /**\n    Registers a block to be called each time the map changes.\n\n    The block will be asynchronously called on the actor with the initial map, and\n    then called again after each write transaction which changes either which keys\n    are present in the map or the values of any of the objects.\n\n    The `change` parameter that is passed to the block reports, in the form of keys\n    within the map, which of the key-value pairs were added, removed, or modified\n    during each write transaction.\n\n    Notifications are delivered to a function isolated to the given actor, on that\n    actors executor. If the actor is performing blocking work, multiple\n    notifications may be coalesced into a single notification. This can include the\n    notification with the initial collection, and changes are only reported for\n    writes which occur after the initial notification is delivered.\n\n    The block will be called for changes which occur only on the provided key\n    paths. For example, if:\n    ```swift\n    class Dog: Object {\n        @Persisted var name: String\n        @Persisted var age: Int\n        @Persisted var toys: List<Toy>\n    }\n    // ...\n    let dogs = myObject.mapOfDogs\n    let token = dogs.observe(keyPaths: [\\.name], on: actor) { actor, changes in\n        switch changes {\n        case .initial(let dogs):\n            // ...\n        case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the collection is modified\n            // - when an element is inserted or removed from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on one of the elements.\n        case .error:\n            // No longer possible and left for backwards compatibility\n        }\n    }\n    ```\n    - If the observed key path were `[\\.toys.brand]`, then any insertion or\n      deletion to the `toys` list on any of the collection's elements would trigger\n      the block. Changes to the `brand` value on any `Toy` that is linked to a `Dog`\n      in this collection will trigger the block. Changes to a value other than\n      `brand` on any `Toy` that is linked to a `Dog` in this collection would not\n      trigger the block. Any insertion or removal to the `Dog` type collection being\n      observed would also trigger a notification.\n    - If the above example observed the `[\\.toys]` key path, then any insertion,\n      deletion, or modification to the `toys` list for any element in the collection\n      would trigger the block. Changes to any value on any `Toy` that is linked to a\n      `Dog` in this collection would *not* trigger the block. Any insertion or\n      removal to the `Dog` type collection being observed would still trigger a\n      notification.\n\n    You must retain the returned token for as long as you want updates to be sent\n    to the block. To stop receiving updates, call `invalidate()` on the token.\n\n    - warning: This method cannot be called during a write transaction, or when\n      the containing Realm is read-only.\n\n    - parameter keyPaths: Only properties contained in the key paths array will\n      trigger the block when they are modified. If `nil`, notifications will be\n      delivered for any property change on the object. String key paths which do not\n      correspond to a valid a property will throw an exception. See description above\n      for more detail on linked properties.\n    - note: The keyPaths parameter refers to object properties of the collection\n      type and *does not* refer to particular key/value pairs within the Map.\n    - parameter actor: The actor which notifications should be delivered on. The\n      block is passed this actor as an isolated parameter, allowing you to access the\n      actor synchronously from within the callback.\n    - parameter block: The block to be called whenever a change occurs.\n    - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    public func observe<A: Actor>(\n        keyPaths: [PartialKeyPath<Value.Wrapped>], on actor: A,\n        _isolation: isolated (any Actor)? = #isolation,\n        _ block: @Sendable @escaping (isolated A, RealmMapChange<Map>) -> Void\n    ) async -> NotificationToken where Value: OptionalProtocol, Value.Wrapped: ObjectBase {\n        await observe(keyPaths: keyPaths.map(_name(for:)), on: actor, block)\n    }\n#endif\n\n    // MARK: Frozen Objects\n\n    /**\n     Indicates if the `Map` is frozen.\n\n     Frozen `Map`s are immutable and can be accessed from any thread. Frozen `Map`s\n     are created by calling `-freeze` on a managed live `Map`. Unmanaged `Map`s are\n     never frozen.\n     */\n    public var isFrozen: Bool {\n        return _rlmCollection.isFrozen\n    }\n\n    /**\n     Returns a frozen (immutable) snapshot of a `Map`.\n\n     The frozen copy is an immutable `Map` which contains the same data as this\n     `Map` currently contains, but will not update when writes are made to the\n     containing Realm. Unlike live `Map`s, frozen `Map`s can be accessed from any\n     thread.\n\n     - warning: This method cannot be called during a write transaction, or when the\n                containing Realm is read-only.\n     - warning: This method may only be called on a managed `Map`.\n     - warning: Holding onto a frozen `Map` for an extended period while performing\n                write transaction on the Realm may result in the Realm file growing\n                to large sizes. See `RLMRealmConfiguration.maximumNumberOfActiveVersions`\n                for more information.\n     */\n    public func freeze() -> Map {\n        Map(objc: rlmDictionary.freeze())\n    }\n\n    /**\n     Returns a live version of this frozen `Map`.\n\n     This method resolves a reference to a live copy of the same frozen `Map`.\n     If called on a live `Map`, will return itself.\n    */\n    public func thaw() -> Map? {\n        Map(objc: rlmDictionary.thaw())\n    }\n\n    @objc static func _unmanagedCollection() -> RLMDictionary<AnyObject, AnyObject> {\n        if let type = Value.self as? HasClassName.Type ?? Value.PersistedType.self as? HasClassName.Type {\n            return RLMDictionary(objectClassName: type.className(), keyType: Key._rlmType)\n        }\n        if let type = Value.self as? _RealmSchemaDiscoverable.Type {\n            return RLMDictionary(objectType: type._rlmType, optional: type._rlmOptional, keyType: Key._rlmType)\n        }\n        fatalError(\"Collections of projections must be used with @Projected.\")\n    }\n\n    /// :nodoc:\n    @objc public override static func _backingCollectionType() -> AnyClass {\n        RLMManagedDictionary.self\n    }\n\n    /**\n     Returns a human-readable description of the objects contained in the Map.\n     */\n    @objc public override var description: String {\n        return descriptionWithMaxDepth(RLMDescriptionMaxDepth)\n    }\n\n    @objc private func descriptionWithMaxDepth(_ depth: UInt) -> String {\n        return RLMDictionaryDescriptionWithMaxDepth(\"Map\", rlmDictionary, depth)\n    }\n\n    internal var rlmDictionary: RLMDictionary<AnyObject, AnyObject> {\n        _rlmCollection as! RLMDictionary\n    }\n\n    private func objcKey(from swiftKey: Key) -> AnyObject {\n        return swiftKey as AnyObject\n    }\n}\n\n// MARK: - Codable\n\nextension Map: Decodable where Key: Decodable, Value: Decodable {\n    public convenience init(from decoder: Decoder) throws {\n        self.init()\n        let container = try decoder.singleValueContainer()\n        for (key, value) in try container.decode([Key: Value].self) {\n            self[key] = value\n        }\n    }\n}\n\nextension Map: Encodable where Key: Encodable, Value: Encodable {\n    public func encode(to encoder: Encoder) throws {\n        var container = encoder.singleValueContainer()\n        try container.encode(self.reduce(into: [Key: Value]()) { map, element in\n            map[element.key] = element.value\n        })\n    }\n}\n\n// MARK: Sequence Support\n\nextension Map: Sequence {\n    /// Returns a `RLMMapIterator` that yields successive elements in the `Map`.\n    public func makeIterator() -> RLMKeyValueIterator<Key, Value> {\n        return RLMKeyValueIterator<Key, Value>(collection: rlmDictionary)\n    }\n}\n\n// MARK: - Notifications\n\n// NEXT-MAJOR: remove this and make RealmCollectionChange get the key type from the collection\n/**\n A `RealmMapChange` value encapsulates information about changes to dictionaries\n that are reported by Realm notifications.\n */\n@frozen public enum RealmMapChange<Collection: RealmKeyedCollection> {\n\n    /**\n     `.initial` indicates that the initial run of the query has completed (if\n     applicable), and the collection can now be used without performing any\n     blocking work.\n     */\n    case initial(Collection)\n\n    /**\n     `.update` indicates that a write transaction has been committed which\n     either changed which keys are in the collection, or the values of the objects for those keys in the collection, and/or modified one\n     or more of the objects in the collection.\n\n     - parameter deletions:     The keys in the previous version of the collection which were removed from this one.\n     - parameter insertions:    The keys in the new collection which were added in this version.\n     - parameter modifications: The keys of the objects in the new collection which were modified in this version.\n     */\n    case update(Collection, deletions: [Collection.Key], insertions: [Collection.Key], modifications: [Collection.Key])\n\n    /**\n     Errors can no longer occur. This case is unused and will be removed in the\n     next major version.\n     */\n    case error(Error)\n\n    static func fromObjc(value: Collection?, change: RLMDictionaryChange?, error: Error?) -> RealmMapChange {\n        if let error = error {\n            return .error(error)\n        }\n        if let change = change {\n            return .update(value!,\n                           deletions: change.deletions as! [Collection.Key],\n                           insertions: change.insertions as! [Collection.Key],\n                           modifications: change.modifications as! [Collection.Key])\n        }\n        return .initial(value!)\n    }\n}\n\n// MARK: - RealmKeyedCollection Conformance\n\nextension Map: RealmKeyedCollection { }\n\n// MARK: - MapIndex\n\n/// Container type which holds the offset of the element in the Map.\npublic struct MapIndex {\n    /// The position of the element in the Map.\n    public var offset: UInt\n}\n\n// MARK: - SingleMapEntry\n\n/// Container for holding a single key-value entry in a Map. This is used where a tuple cannot be expressed as a generic argument.\npublic struct SingleMapEntry<Key: _MapKey, Value: RealmCollectionValue>: _RealmMapValue, Hashable {\n    /// :nodoc:\n    public static func == (lhs: SingleMapEntry, rhs: SingleMapEntry) -> Bool {\n        return lhs.value == rhs.value\n    }\n    /// :nodoc:\n    public func hash(into hasher: inout Hasher) {\n        hasher.combine(key)\n    }\n    /// The key for this Map entry.\n    public var key: Self.Key\n    /// The value for this Map entry.\n    public var value: Self.Value\n}\n\nprivate protocol HasClassName {\n    static func className() -> String\n}\nextension ObjectBase: HasClassName {}\nextension Optional: HasClassName where Wrapped: ObjectBase {\n    static func className() -> String {\n        Wrapped.className()\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Migration.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\nimport Realm.Private\n\n/**\n The type of a migration block used to migrate a Realm.\n\n - parameter migration:  A `Migration` object used to perform the migration. The migration object allows you to\n                         enumerate and alter any existing objects which require migration.\n\n - parameter oldSchemaVersion: The schema version of the Realm being migrated.\n */\npublic typealias MigrationBlock = @Sendable (_ migration: Migration, _ oldSchemaVersion: UInt64) -> Void\n\n/// An object class used during migrations.\npublic typealias MigrationObject = DynamicObject\n\n/**\n A block type which provides both the old and new versions of an object in the Realm. Object\n properties can only be accessed using subscripting.\n\n - parameter oldObject: The object from the original Realm (read-only).\n - parameter newObject: The object from the migrated Realm (read-write).\n */\npublic typealias MigrationObjectEnumerateBlock = (_ oldObject: MigrationObject?, _ newObject: MigrationObject?) -> Void\n\n/**\n Returns the schema version for a Realm at a given local URL.\n\n - parameter fileURL:       Local URL to a Realm file.\n - parameter encryptionKey: 64-byte key used to encrypt the file, or `nil` if it is unencrypted.\n\n - throws: An `NSError` that describes the problem.\n */\npublic func schemaVersionAtURL(_ fileURL: URL, encryptionKey: Data? = nil) throws -> UInt64 {\n    var error: NSError?\n    let version = RLMRealm.__schemaVersion(at: fileURL, encryptionKey: encryptionKey, error: &error)\n    guard version != RLMNotVersioned else {\n        throw error!\n    }\n    return version\n}\n\nextension Realm {\n    /**\n     Performs the given Realm configuration's migration block on a Realm at the given path.\n\n     This method is called automatically when opening a Realm for the first time and does not need to be called\n     explicitly. You can choose to call this method to control exactly when and how migrations are performed.\n\n     - parameter configuration: The Realm configuration used to open and migrate the Realm.\n     */\n    public static func performMigration(for configuration: Realm.Configuration = Realm.Configuration.defaultConfiguration) throws {\n        try RLMRealm.performMigration(for: configuration.rlmConfiguration)\n    }\n}\n\n/**\n `Migration` instances encapsulate information intended to facilitate a schema migration.\n\n A `Migration` instance is passed into a user-defined `MigrationBlock` block when updating the version of a Realm. This\n instance provides access to the old and new database schemas, the objects in the Realm, and provides functionality for\n modifying the Realm during the migration.\n */\npublic typealias Migration = RLMMigration\nextension Migration {\n    // MARK: Properties\n\n    /// The old schema, describing the Realm before applying a migration.\n    public var oldSchema: Schema { return Schema(__oldSchema) }\n\n    /// The new schema, describing the Realm after applying a migration.\n    public var newSchema: Schema { return Schema(__newSchema) }\n\n    // MARK: Altering Objects During a Migration\n\n    /**\n     Enumerates all the objects of a given type in this Realm, providing both the old and new versions of each object.\n     Properties on an object can be accessed using subscripting.\n\n     - parameter objectClassName: The name of the `Object` class to enumerate.\n     - parameter block:           The block providing both the old and new versions of an object in this Realm.\n     */\n    public func enumerateObjects(ofType typeName: String, _ block: MigrationObjectEnumerateBlock) {\n        __enumerateObjects(typeName) { oldObject, newObject in\n            block(unsafeBitCast(oldObject, to: MigrationObject.self),\n                  unsafeBitCast(newObject, to: MigrationObject.self))\n        }\n    }\n\n    /**\n     Creates and returns an `Object` of type `className` in the Realm being migrated.\n\n     The `value` argument is used to populate the object. It can be a key-value coding compliant object, an array or\n     dictionary returned from the methods in `NSJSONSerialization`, or an `Array` containing one element for each\n     managed property. An exception will be thrown if any required properties are not present and those properties were\n     not defined with default values.\n\n     When passing in an `Array` as the `value` argument, all properties must be present, valid and in the same order as\n     the properties defined in the model.\n\n     - parameter className: The name of the `Object` class to create.\n     - parameter value:     The value used to populate the created object.\n\n     - returns: The newly created object.\n     */\n    @discardableResult\n    public func create(_ typeName: String, value: Any = [Any]()) -> MigrationObject {\n        return unsafeBitCast(__createObject(typeName, withValue: value), to: MigrationObject.self)\n    }\n\n    /**\n     Deletes an object from a Realm during a migration.\n\n     It is permitted to call this method from within the block passed to `enumerate(_:block:)`.\n\n     - parameter object: An object to be deleted from the Realm being migrated.\n     */\n    public func delete(_ object: MigrationObject) {\n        __delete(object.unsafeCastToRLMObject())\n    }\n\n    /**\n     Deletes the data for the class with the given name.\n\n     All objects of the given class will be deleted. If the `Object` subclass no longer exists in your program, any\n     remaining metadata for the class will be removed from the Realm file.\n\n     - parameter objectClassName: The name of the `Object` class to delete.\n\n     - returns: A Boolean value indicating whether there was any data to delete.\n     */\n    @discardableResult\n    public func deleteData(forType typeName: String) -> Bool {\n        return __deleteData(forClassName: typeName)\n    }\n\n    /**\n     Renames a property of the given class from `oldName` to `newName`.\n\n     - parameter className:  The name of the class whose property should be renamed. This class must be present\n                             in both the old and new Realm schemas.\n     - parameter oldName:    The old column name for the property to be renamed. There must not be a property with this name in\n                             the class as defined by the new Realm schema.\n     - parameter newName:    The new column name for the property to be renamed. There must not be a property with this name in\n                             the class as defined by the old Realm schema.\n     */\n    public func renameProperty(onType typeName: String, from oldName: String, to newName: String) {\n        __renameProperty(forClass: typeName, oldName: oldName, newName: newName)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/MutableSet.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\nimport Realm.Private\n\n/**\n `MutableSet` is the container type in Realm used to define to-many relationships with distinct values as objects.\n\n Like Swift's `Set`, `MutableSet` is a generic type that is parameterized on the type it stores. This can be either an `Object`\n subclass or one of the following types: `Bool`, `Int`, `Int8`, `Int16`, `Int32`, `Int64`, `Float`, `Double`,\n `String`, `Data`, `Date`, `Decimal128`, and `ObjectId` (and their optional versions)\n\n Unlike Swift's native collections, `MutableSet`s are reference types, and are only immutable if the Realm that manages them\n is opened as read-only.\n\n MutableSet's can be filtered and sorted with the same predicates as `Results<Element>`.\n*/\npublic final class MutableSet<Element: RealmCollectionValue>: RLMSwiftCollectionBase, RealmCollectionImpl {\n    internal var lastAccessedNames: NSMutableArray?\n\n    internal var rlmSet: RLMSet<AnyObject> {\n        unsafeDowncast(_rlmCollection, to: RLMSet.self)\n    }\n    internal var collection: RLMCollection {\n        _rlmCollection\n    }\n\n    // MARK: Initializers\n\n    /// Creates a `MutableSet` that holds Realm model objects of type `Element`.\n    public override init() {\n        super.init()\n    }\n    /// :nodoc:\n    public override init(collection: RLMCollection) {\n        super.init(collection: collection)\n    }\n\n    // MARK: KVC\n\n    /**\n     Returns an `Array` containing the results of invoking `valueForKey(_:)` using `key` on each of the collection's\n     objects.\n     */\n    @nonobjc public func value(forKey key: String) -> [AnyObject] {\n        return (rlmSet.value(forKeyPath: key)! as! NSSet).allObjects as [AnyObject]\n    }\n\n    // MARK: Object Retrieval\n    /**\n     - warning: Ordering is not guaranteed on a MutableSet. Subscripting is implement\n                convenience should not be relied on.\n     */\n    public subscript(position: Int) -> Element {\n        if let lastAccessedNames = lastAccessedNames {\n            return elementKeyPathRecorder(for: Element.self, with: lastAccessedNames)\n        }\n\n        throwForNegativeIndex(position)\n        return staticBridgeCast(fromObjectiveC: rlmSet.object(at: UInt(position)))\n    }\n\n    // MARK: Filtering\n\n    /**\n     Returns a Boolean value indicating whether the Set contains the\n     given object.\n\n     - parameter object: The element to find in the MutableSet.\n     */\n    public func contains(_ object: Element) -> Bool {\n        return rlmSet.contains(staticBridgeCast(fromSwift: object) as AnyObject)\n    }\n\n    /**\n     Returns a Boolean value that indicates whether this set is a subset\n     of the given set.\n\n     - Parameter object: Another MutableSet to compare.\n     */\n    public func isSubset(of possibleSuperset: MutableSet<Element>) -> Bool {\n        return rlmSet.isSubset(of: possibleSuperset.rlmSet)\n    }\n\n    /**\n     Returns a Boolean value that indicates whether this set intersects\n     with another given set.\n\n     - Parameter object: Another MutableSet to compare.\n     */\n    public func intersects(_ otherSet: MutableSet<Element>) -> Bool {\n        return rlmSet.intersects(otherSet.rlmSet)\n    }\n\n    // MARK: Mutation\n\n    /**\n     Inserts an object to the set if not already present.\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter object: An object.\n     */\n    public func insert(_ object: Element) {\n        rlmSet.add(staticBridgeCast(fromSwift: object) as AnyObject)\n    }\n\n    /**\n     Inserts the given sequence of objects into the set if not already present.\n\n     - warning: This method may only be called during a write transaction.\n    */\n    public func insert<S: Sequence>(objectsIn objects: S) where S.Iterator.Element == Element {\n        for obj in objects {\n            rlmSet.add(staticBridgeCast(fromSwift: obj) as AnyObject)\n        }\n    }\n\n    /**\n     Removes an object in the set if present. The object is not removed from the Realm that manages it.\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter object: The object to remove.\n     */\n    public func remove(_ object: Element) {\n        rlmSet.remove(staticBridgeCast(fromSwift: object) as AnyObject)\n    }\n\n    /**\n     Removes all objects from the set. The objects are not removed from the Realm that manages them.\n\n     - warning: This method may only be called during a write transaction.\n     */\n    public func removeAll() {\n        rlmSet.removeAllObjects()\n    }\n\n    /**\n     Mutates the set in place with the elements that are common to both this set and the given sequence.\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter other: Another set.\n     */\n    public func formIntersection(_ other: MutableSet<Element>) {\n        rlmSet.intersect(other.rlmSet)\n    }\n\n    /**\n     Mutates the set in place and removes the elements of the given set from this set.\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter other: Another set.\n     */\n    public func subtract(_ other: MutableSet<Element>) {\n        rlmSet.minus(other.rlmSet)\n    }\n\n    /**\n     Inserts the elements of the given sequence into the set.\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter other: Another set.\n     */\n    public func formUnion(_ other: MutableSet<Element>) {\n        rlmSet.union(other.rlmSet)\n    }\n\n    @objc static func _unmanagedCollection() -> RLMSet<AnyObject> {\n        if let type = Element.self as? ObjectBase.Type {\n            return RLMSet(objectClassName: type.className())\n        }\n        if let type = Element.self as? _RealmSchemaDiscoverable.Type {\n            return RLMSet(objectType: type._rlmType, optional: type._rlmOptional)\n        }\n        fatalError(\"Collections of projections must be used with @Projected.\")\n    }\n\n    /// :nodoc:\n    @objc public override static func _backingCollectionType() -> AnyClass {\n        RLMManagedSet.self\n    }\n\n    // Printable requires a description property defined in Swift (and not obj-c),\n    // and it has to be defined as override, which can't be done in a\n    // generic class.\n    /// Returns a human-readable description of the objects contained in the MutableSet.\n    @objc public override var description: String {\n        return descriptionWithMaxDepth(RLMDescriptionMaxDepth)\n    }\n\n    @objc private func descriptionWithMaxDepth(_ depth: UInt) -> String {\n        return RLMDescriptionWithMaxDepth(\"MutableSet\", rlmSet, depth)\n    }\n\n    /// :nodoc:\n    public func makeIterator() -> RLMIterator<Element> {\n        return RLMIterator(collection: collection)\n    }\n\n    /// :nodoc:\n    public func index(of object: Element) -> Int? {\n        fatalError(\"index(of:) is not available on MutableSet\")\n    }\n\n    /// :nodoc:\n    public func index(matching predicate: NSPredicate) -> Int? {\n        fatalError(\"index(matching:) is not available on MutableSet\")\n    }\n\n    /// :nodoc:\n    public func index(matching isIncluded: ((Query<Element>) -> Query<Bool>)) -> Int? {\n        fatalError(\"index(matching:) is not available on MutableSet\")\n    }\n}\n\n// MARK: - Codable\n\nextension MutableSet: Decodable where Element: Decodable {\n    public convenience init(from decoder: Decoder) throws {\n        self.init()\n        var container = try decoder.unkeyedContainer()\n        while !container.isAtEnd {\n            insert(try container.decode(Element.self))\n        }\n    }\n}\n\nextension MutableSet: Encodable where Element: Encodable {}\n"
  },
  {
    "path": "RealmSwift/Object.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\nimport Realm.Private\n\n/**\n `Object` is a class used to define Realm model objects.\n\n In Realm you define your model classes by subclassing `Object` and adding properties to be managed.\n You then instantiate and use your custom subclasses instead of using the `Object` class directly.\n\n ```swift\n class Dog: Object {\n     @Persisted var name: String\n     @Persisted var adopted: Bool\n     @Persisted var siblings: List<Dog>\n }\n ```\n\n ### Supported property types\n\n - `String`\n - `Int`, `Int8`, `Int16`, `Int32`, `Int64`\n - `Float`\n - `Double`\n - `Bool`\n - `Date`\n - `Data`\n - `Decimal128`\n - `ObjectId`\n - `UUID`\n - `AnyRealmValue`\n - Any RawRepresentable enum whose raw type is a legal property type. Enums\n   must explicitly be marked as conforming to `PersistableEnum`.\n - `Object` subclasses, to model many-to-one relationships\n - `EmbeddedObject` subclasses, to model owning one-to-one relationships\n\n All of the types above may also be `Optional`, with the exception of\n `AnyRealmValue`. `Object` and `EmbeddedObject` subclasses *must* be Optional.\n\n In addition to individual values, three different collection types are supported:\n - `List<Element>`: an ordered mutable collection similar to `Array`.\n - `MutableSet<Element>`: an unordered uniquing collection similar to `Set`.\n - `Map<String, Element>`: an unordered key-value collection similar to `Dictionary`.\n\n The Element type of collections may be any of the supported non-collection\n property types listed above. Collections themselves may not be Optional, but\n the values inside them may be, except for lists and sets of `Object` or\n `EmbeddedObject` subclasses.\n\n Finally, `LinkingObjects` properties can be used to track which objects link\n to this one.\n\n All properties which should be stored by Realm must be explicitly marked with\n `@Persisted`. Any properties not marked with `@Persisted` will be ignored\n entirely by Realm, and may be of any type.\n\n ### Querying\n\n You can retrieve all objects of a given type from a Realm by calling the `objects(_:)` instance method.\n\n ### Relationships\n\n See our [Swift guide](https://docs.mongodb.com/realm/sdk/swift/fundamentals/relationships/) for more details.\n */\npublic typealias Object = RealmSwiftObject\nextension Object: _RealmCollectionValueInsideOptional {\n    // MARK: Initializers\n\n    /**\n     Creates an unmanaged instance of a Realm object.\n\n     The `value` argument is used to populate the object. It can be a key-value coding compliant object, an array or\n     dictionary returned from the methods in `NSJSONSerialization`, or an `Array` containing one element for each\n     managed property. An exception will be thrown if any required properties are not present and those properties were\n     not defined with default values.\n\n     When passing in an `Array` as the `value` argument, all properties must be present, valid and in the same order as\n     the properties defined in the model.\n\n     Call `add(_:)` on a `Realm` instance to add an unmanaged object into that Realm.\n\n     - parameter value:  The value used to populate the object.\n     */\n    public convenience init(value: Any) {\n        self.init()\n        RLMInitializeWithValue(self, value, .partialPrivateShared())\n    }\n\n    // MARK: Properties\n\n    /// The Realm which manages the object, or `nil` if the object is unmanaged.\n    public var realm: Realm? {\n        if let rlmReam = RLMObjectBaseRealm(self) {\n            return Realm(rlmReam)\n        }\n        return nil\n    }\n\n    /// The object schema which lists the managed properties for the object.\n    public var objectSchema: ObjectSchema {\n        return ObjectSchema(RLMObjectBaseObjectSchema(self)!)\n    }\n\n    /// Indicates if the object can no longer be accessed because it is now invalid.\n    ///\n    /// An object can no longer be accessed if the object has been deleted from the Realm that manages it, or if\n    /// `invalidate()` is called on that Realm. This property is key-value observable.\n    @objc dynamic open override var isInvalidated: Bool { return super.isInvalidated }\n\n    /// A human-readable description of the object.\n    open override var description: String { return super.description }\n\n    /**\n     WARNING: This is an internal helper method not intended for public use.\n     It is not considered part of the public API.\n     :nodoc:\n     */\n    public override static func _getProperties() -> [RLMProperty] {\n        ObjectUtil.getSwiftProperties(self)\n    }\n\n    // MARK: Object Customization\n\n    /**\n     Override this method to specify the name of a property to be used as the primary key.\n\n     Only properties of types `String`, `Int`, `ObjectId` and `UUID` can be\n     designated as the primary key. Primary key properties enforce uniqueness\n     for each value whenever the property is set, which incurs minor overhead.\n     Indexes are created automatically for primary key properties.\n\n     - warning: This function is only applicable to legacy property declarations\n                using `@objc`. When using `@Persisted`, use\n                `@Persisted(primaryKey: true)` instead.\n     - returns: The name of the property designated as the primary key, or\n                `nil` if the model has no primary key.\n     */\n    @objc open class func primaryKey() -> String? { return nil }\n\n    /**\n     Override this method to specify the names of properties to ignore. These\n     properties will not be managed by the Realm that manages the object.\n\n     - warning: This function is only applicable to legacy property declarations\n                using `@objc`. When using `@Persisted`, any properties not\n                marked with `@Persisted` are automatically ignored.\n     - returns: An array of property names to ignore.\n     */\n    @objc open class func ignoredProperties() -> [String] { return [] }\n\n    /**\n     Returns an array of property names for properties which should be indexed.\n\n     Only string, integer, boolean, `Date`, and `NSDate` properties are supported.\n\n     - warning: This function is only applicable to legacy property declarations\n                using `@objc`. When using `@Persisted`, use\n                `@Persisted(indexed: true)` instead.\n     - returns: An array of property names.\n     */\n    @objc open class func indexedProperties() -> [String] { return [] }\n\n    /**\n     Override this method to specify a map of public-private property names.\n     This will set a different persisted property name on the Realm, and allows using the public name\n     for any operation with the property. (Ex: Queries, Sorting, ...).\n     This very helpful if you need to map property names from your `Device Sync` JSON schema\n     to local property names.\n\n     ```swift\n     class Person: Object {\n         @Persisted var firstName: String\n         @Persisted var birthDate: Date\n         @Persisted var age: Int\n\n         override class public func propertiesMapping() -> [String : String] {\n             [\"firstName\": \"first_name\",\n              \"birthDate\": \"birth_date\"]\n         }\n     }\n     ```\n\n     - note: Only property that have a different column name have to be added to the properties mapping\n     dictionary.\n     - note: In a migration block, when enumerating an old property with a public/private name, you will have to use\n     the old column name instead of the public one to retrieve the property value.\n\n     ```swift\n     let migrationBlock = { migration, oldSchemaVersion in\n         migration.enumerateObjects(ofType: \"Person\", { oldObj, newObj in\n            let oldPropertyValue = oldObj![\"first_name\"] as! String\n            // Use this value in migration\n         })\n     }\n     ```\n     This has to be done as well when renaming a property.\n     ```swift\n     let migrationBlock = { migration, oldSchemaVersion in\n         migration.renameProperty(onType: \"Person\", from: \"first_name\", to: \"complete_name\")\n     }\n     ```\n\n\n\n     - returns: A dictionary of public-private property names.\n     */\n    @objc open override class func propertiesMapping() -> [String: String] { return [:] }\n\n    /// :nodoc:\n    @available(*, unavailable, renamed: \"propertiesMapping\", message: \"`_realmColumnNames` private API is unavailable in our Swift SDK, please use the override `.propertiesMapping()` instead.\")\n    @objc open override class func _realmColumnNames() -> [String: String] { return [:] }\n\n    // MARK: Key-Value Coding & Subscripting\n\n    /// Returns or sets the value of the property with the given name.\n    @objc open subscript(key: String) -> Any? {\n        get {\n            RLMDynamicGetByName(self, key)\n        }\n        set {\n            dynamicSet(object: self, key: key, value: newValue)\n        }\n    }\n\n    // MARK: Notifications\n\n    /**\n     Registers a block to be called each time the object changes.\n\n     The block will be asynchronously called after each write transaction which\n     deletes the object or modifies any of the managed properties of the object,\n     including self-assignments that set a property to its existing value.\n\n     For write transactions performed on different threads or in different\n     processes, the block will be called when the managing Realm is\n     (auto)refreshed to a version including the changes, while for local write\n     transactions it will be called at some point in the future after the write\n     transaction is committed.\n\n     If no key paths are given, the block will be executed on any insertion,\n     modification, or deletion for all object first-level properties of the object.\n     `Object` notifications are shallow by default, any nested property modification\n     will not trigger a notification, unless the key path to that property is specified.\n     If a key path or key paths are provided, then the block will be called for\n     changes which occur only on the provided key paths. For example, if:\n     ```swift\n     class Dog: Object {\n         @Persisted var name: String\n         @Persisted var adopted: Bool\n         @Persisted var siblings: List<Dog>\n     }\n\n     // ... where `dog` is a managed Dog object.\n     dog.observe(keyPaths: [\"adopted\"], { changes in\n        // ...\n     })\n     ```\n     - The above notification block fires for changes to the\n     `adopted` property, but not for any changes made to `name`.\n     - If the observed key path were `[\"siblings\"]`, then any insertion,\n     deletion, or modification to the `siblings` list will trigger the block. A change to\n     `someSibling.name` would not trigger the block (where `someSibling`\n     is an element contained in `siblings`)\n     - If the observed key path were `[\"siblings.name\"]`, then any insertion or\n     deletion to the `siblings` list would trigger the block. For objects\n     contained in the `siblings` list, only modifications to their `name` property\n     will trigger the block.\n\n     - note: Multiple notification tokens on the same object which filter for\n     separate key paths *do not* filter exclusively. If one key path\n     change is satisfied for one notification token, then all notification\n     token blocks for that object will execute.\n\n     If no queue is given, notifications are delivered via the standard run\n     loop, and so can't be delivered while the run loop is blocked by other\n     activity. If a queue is given, notifications are delivered to that queue\n     instead. When notifications can't be delivered instantly, multiple\n     notifications may be coalesced into a single notification.\n\n     Unlike with `List` and `Results`, there is no \"initial\" callback made after\n     you add a new notification block.\n\n     Only objects which are managed by a Realm can be observed in this way. You\n     must retain the returned token for as long as you want updates to be sent\n     to the block. To stop receiving updates, call `invalidate()` on the token.\n\n     It is safe to capture a strong reference to the observed object within the\n     callback block. There is no retain cycle due to that the callback is\n     retained by the returned token and not by the object itself.\n\n     - warning: This method cannot be called during a write transaction, or when\n                the containing Realm is read-only.\n     - parameter keyPaths: Only properties contained in the key paths array will trigger\n                           the block when they are modified. If `nil`, notifications\n                           will be delivered for any property change on the object.\n                           String key paths which do not correspond to a valid a property\n                           will throw an exception.\n                           See description above for more detail on linked properties.\n     - parameter queue: The serial dispatch queue to receive notification on. If\n                        `nil`, notifications are delivered to the current thread.\n     - parameter block: The block to call with information about changes to the object.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    public func observe<T: RLMObjectBase>(keyPaths: [String]? = nil,\n                                          on queue: DispatchQueue? = nil,\n                                          _ block: @escaping (ObjectChange<T>) -> Void) -> NotificationToken {\n        _observe(keyPaths: keyPaths, on: queue, block)\n    }\n\n    /**\n     Registers a block to be called each time the object changes.\n\n     The block will be asynchronously called after each write transaction which\n     deletes the object or modifies any of the managed properties of the object,\n     including self-assignments that set a property to its existing value.\n\n     For write transactions performed on different threads or in different\n     processes, the block will be called when the managing Realm is\n     (auto)refreshed to a version including the changes, while for local write\n     transactions it will be called at some point in the future after the write\n     transaction is committed.\n\n     If no key paths are given, the block will be executed on any insertion,\n     modification, or deletion for all object first-level properties of the object.\n     `Object` notifications are shallow by default, any nested property modification\n     will not trigger a notification, unless the key path to that property is specified.\n     If a key path or key paths are provided, then the block will be called for\n     changes which occur only on the provided key paths. For example, i\n     ```swift\n     class Dog: Object {\n         @Persisted var name: String\n         @Persisted var adopted: Bool\n         @Persisted var siblings: List<Dog>\n     }\n\n     // ... where `dog` is a managed Dog object.\n     dog.observe(keyPaths: [\\Dog.adopted], { changes in\n        // ...\n     })\n     ```\n     - The above notification block fires for changes to the\n     `adopted` property, but not for any changes made to `name`.\n     - If the observed key path were `[\\Dog.siblings]`, then any insertion,\n     deletion, or modification to the `siblings` list will trigger the block. A change to\n     `someSibling.name` would not trigger the block (where `someSibling`\n     is an element contained in `siblings`)\n     - If the observed key path were `[\\Dog.siblings.name]`, then any insertion or\n     deletion to the `siblings` list would trigger the block. For objects\n     contained in the `siblings` list, only modifications to their `name` property\n     will trigger the block.\n\n     - note: Multiple notification tokens on the same object which filter for\n     separate key paths *do not* filter exclusively. If one key path\n     change is satisfied for one notification token, then all notification\n     token blocks for that object will execute.\n\n     If no queue is given, notifications are delivered via the standard run\n     loop, and so can't be delivered while the run loop is blocked by other\n     activity. If a queue is given, notifications are delivered to that queue\n     instead. When notifications can't be delivered instantly, multiple\n     notifications may be coalesced into a single notification.\n\n     Unlike with `List` and `Results`, there is no \"initial\" callback made after\n     you add a new notification block.\n\n     Only objects which are managed by a Realm can be observed in this way. You\n     must retain the returned token for as long as you want updates to be sent\n     to the block. To stop receiving updates, call `invalidate()` on the token.\n\n     It is safe to capture a strong reference to the observed object within the\n     callback block. There is no retain cycle due to that the callback is\n     retained by the returned token and not by the object itself.\n\n     - warning: This method cannot be called during a write transaction, or when\n                the containing Realm is read-only.\n     - parameter keyPaths: Only properties contained in the key paths array will trigger\n                           the block when they are modified. If `nil`, notifications\n                           will be delivered for any property change on the object.\n                           See description above for more detail on linked properties.\n     - parameter queue: The serial dispatch queue to receive notification on. If\n                        `nil`, notifications are delivered to the current thread.\n     - parameter block: The block to call with information about changes to the object.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    public func observe<T: ObjectBase>(keyPaths: [PartialKeyPath<T>],\n                                       on queue: DispatchQueue? = nil,\n                                       _ block: @escaping (ObjectChange<T>) -> Void) -> NotificationToken {\n        _observe(keyPaths: keyPaths.map(_name(for:)), on: queue, block)\n    }\n\n#if compiler(<6)\n    /**\n    Registers a block to be called each time the object changes.\n\n    The block will be asynchronously called on the given actor's executor after\n    each write transaction which deletes the object or modifies any of the managed\n    properties of the object, including self-assignments that set a property to its\n    existing value. The block is passed a copy of the object isolated to the\n    requested actor which can be safely used on that actor along with information\n    about what changed.\n\n    For write transactions performed on different threads or in different\n    processes, the block will be called when the managing Realm is\n    (auto)refreshed to a version including the changes, while for local write\n    transactions it will be called at some point in the future after the write\n    transaction is committed.\n\n    Only objects which are managed by a Realm can be observed in this way. You\n    must retain the returned token for as long as you want updates to be sent\n    to the block. To stop receiving updates, call `invalidate()` on the token.\n\n    By default, only direct changes to the object's properties will produce\n    notifications, and not changes to linked objects. Note that this is different\n    from collection change notifications. If a non-nil, non-empty keypath array is\n    passed in, only changes to the properties identified by those keypaths will\n    produce change notifications. The keypaths may traverse link properties to\n    receive information about changes to linked objects.\n\n    - warning: This method cannot be called during a write transaction, or when\n    the containing Realm is read-only.\n    - parameter actor: The actor to isolate notifications to.\n    - parameter block: The block to call with information about changes to the object.\n    - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    @_unsafeInheritExecutor\n    public func observe<A: Actor, T: Object>(\n        keyPaths: [String]? = nil, on actor: A,\n        _ block: @Sendable @escaping (isolated A, ObjectChange<T>) -> Void\n    ) async -> NotificationToken {\n        await with(self, on: actor) { actor, obj in\n            await obj._observe(keyPaths: keyPaths, on: actor, block)\n        }\n    }\n\n    /**\n    Registers a block to be called each time the object changes.\n\n    The block will be asynchronously called on the given actor's executor after\n    each write transaction which deletes the object or modifies any of the managed\n    properties of the object, including self-assignments that set a property to its\n    existing value. The block is passed a copy of the object isolated to the\n    requested actor which can be safely used on that actor along with information\n    about what changed.\n\n    For write transactions performed on different threads or in different\n    processes, the block will be called when the managing Realm is\n    (auto)refreshed to a version including the changes, while for local write\n    transactions it will be called at some point in the future after the write\n    transaction is committed.\n\n    Only objects which are managed by a Realm can be observed in this way. You\n    must retain the returned token for as long as you want updates to be sent\n    to the block. To stop receiving updates, call `invalidate()` on the token.\n\n    By default, only direct changes to the object's properties will produce\n    notifications, and not changes to linked objects. Note that this is different\n    from collection change notifications. If a non-nil, non-empty keypath array is\n    passed in, only changes to the properties identified by those keypaths will\n    produce change notifications. The keypaths may traverse link properties to\n    receive information about changes to linked objects.\n\n    - warning: This method cannot be called during a write transaction, or when\n    the containing Realm is read-only.\n    - parameter actor: The actor to isolate notifications to.\n    - parameter block: The block to call with information about changes to the object.\n    - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    @_unsafeInheritExecutor\n    public func observe<A: Actor, T: Object>(\n        keyPaths: [PartialKeyPath<T>], on actor: A,\n        _ block: @Sendable @escaping (isolated A, ObjectChange<T>) -> Void\n    ) async -> NotificationToken {\n        await observe(keyPaths: keyPaths.map(_name(for:)), on: actor, block)\n    }\n#else\n    /**\n    Registers a block to be called each time the object changes.\n\n    The block will be asynchronously called on the given actor's executor after\n    each write transaction which deletes the object or modifies any of the managed\n    properties of the object, including self-assignments that set a property to its\n    existing value. The block is passed a copy of the object isolated to the\n    requested actor which can be safely used on that actor along with information\n    about what changed.\n\n    For write transactions performed on different threads or in different\n    processes, the block will be called when the managing Realm is\n    (auto)refreshed to a version including the changes, while for local write\n    transactions it will be called at some point in the future after the write\n    transaction is committed.\n\n    Only objects which are managed by a Realm can be observed in this way. You\n    must retain the returned token for as long as you want updates to be sent\n    to the block. To stop receiving updates, call `invalidate()` on the token.\n\n    By default, only direct changes to the object's properties will produce\n    notifications, and not changes to linked objects. Note that this is different\n    from collection change notifications. If a non-nil, non-empty keypath array is\n    passed in, only changes to the properties identified by those keypaths will\n    produce change notifications. The keypaths may traverse link properties to\n    receive information about changes to linked objects.\n\n    - warning: This method cannot be called during a write transaction, or when\n    the containing Realm is read-only.\n    - parameter actor: The actor to isolate notifications to.\n    - parameter block: The block to call with information about changes to the object.\n    - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    public func observe<A: Actor, T: Object>(\n        keyPaths: [String]? = nil, on actor: A,\n        _isolation: isolated (any Actor)? = #isolation,\n        _ block: @Sendable @escaping (isolated A, ObjectChange<T>) -> Void\n    ) async -> NotificationToken {\n        await with(self, on: actor) { actor, obj in\n            await obj._observe(keyPaths: keyPaths, on: actor, block)\n        }\n    }\n\n    /**\n    Registers a block to be called each time the object changes.\n\n    The block will be asynchronously called on the given actor's executor after\n    each write transaction which deletes the object or modifies any of the managed\n    properties of the object, including self-assignments that set a property to its\n    existing value. The block is passed a copy of the object isolated to the\n    requested actor which can be safely used on that actor along with information\n    about what changed.\n\n    For write transactions performed on different threads or in different\n    processes, the block will be called when the managing Realm is\n    (auto)refreshed to a version including the changes, while for local write\n    transactions it will be called at some point in the future after the write\n    transaction is committed.\n\n    Only objects which are managed by a Realm can be observed in this way. You\n    must retain the returned token for as long as you want updates to be sent\n    to the block. To stop receiving updates, call `invalidate()` on the token.\n\n    By default, only direct changes to the object's properties will produce\n    notifications, and not changes to linked objects. Note that this is different\n    from collection change notifications. If a non-nil, non-empty keypath array is\n    passed in, only changes to the properties identified by those keypaths will\n    produce change notifications. The keypaths may traverse link properties to\n    receive information about changes to linked objects.\n\n    - warning: This method cannot be called during a write transaction, or when\n    the containing Realm is read-only.\n    - parameter actor: The actor to isolate notifications to.\n    - parameter block: The block to call with information about changes to the object.\n    - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    public func observe<A: Actor, T: Object>(\n        keyPaths: [PartialKeyPath<T>], on actor: A,\n        _isolation: isolated (any Actor)? = #isolation,\n        _ block: @Sendable @escaping (isolated A, ObjectChange<T>) -> Void\n    ) async -> NotificationToken {\n        await observe(keyPaths: keyPaths.map(_name(for:)), on: actor, block)\n    }\n#endif\n\n    // MARK: Dynamic list\n\n    /**\n     Returns a list of `DynamicObject`s for a given property name.\n\n     - warning:  This method is useful only in specialized circumstances, for example, when building\n     components that integrate with Realm. If you are simply building an app on Realm, it is\n     recommended to use instance variables or cast the values returned from key-value coding.\n\n     - parameter propertyName: The name of the property.\n\n     - returns: A list of `DynamicObject`s.\n\n     :nodoc:\n     */\n    public func dynamicList(_ propertyName: String) -> List<DynamicObject> {\n        if let dynamic = self as? DynamicObject {\n            return dynamic[propertyName] as! List<DynamicObject>\n        }\n        let list = RLMDynamicGetByName(self, propertyName) as! RLMSwiftCollectionBase\n        return List<DynamicObject>(collection: list._rlmCollection as! RLMArray<AnyObject>)\n    }\n\n    // MARK: Dynamic set\n\n    /**\n     Returns a set of `DynamicObject`s for a given property name.\n\n     - warning:  This method is useful only in specialized circumstances, for example, when building\n     components that integrate with Realm. If you are simply building an app on Realm, it is\n     recommended to use instance variables or cast the values returned from key-value coding.\n\n     - parameter propertyName: The name of the property.\n\n     - returns: A set of `DynamicObject`s.\n\n     :nodoc:\n     */\n    public func dynamicMutableSet(_ propertyName: String) -> MutableSet<DynamicObject> {\n        if let dynamic = self as? DynamicObject {\n            return dynamic[propertyName] as! MutableSet<DynamicObject>\n        }\n        let set = RLMDynamicGetByName(self, propertyName) as! RLMSwiftCollectionBase\n        return MutableSet<DynamicObject>(collection: set._rlmCollection as! RLMSet<AnyObject>)\n    }\n\n    // MARK: Dynamic map\n\n    /**\n     Returns a map of `DynamicObject`s for a given property name.\n\n     - warning:  This method is useful only in specialized circumstances, for example, when building\n     components that integrate with Realm. If you are simply building an app on Realm, it is\n     recommended to use instance variables or cast the values returned from key-value coding.\n\n     - parameter propertyName: The name of the property.\n\n     - returns: A map with a given key type with `DynamicObject` as the value.\n\n     :nodoc:\n     */\n    public func dynamicMap<Key: _MapKey>(_ propertyName: String) -> Map<Key, DynamicObject?> {\n        if let dynamic = self as? DynamicObject {\n            return dynamic[propertyName] as! Map<Key, DynamicObject?>\n        }\n        let base = RLMDynamicGetByName(self, propertyName) as! RLMSwiftCollectionBase\n        return Map<Key, DynamicObject?>(objc: base._rlmCollection as! RLMDictionary<AnyObject, AnyObject>)\n    }\n\n    // MARK: Comparison\n    /**\n     Returns whether two Realm objects are the same.\n\n     Objects are considered the same if and only if they are both managed by the same\n     Realm and point to the same underlying object in the database.\n\n     - note: Equality comparison is implemented by `isEqual(_:)`. If the object type\n             is defined with a primary key, `isEqual(_:)` behaves identically to this\n             method. If the object type is not defined with a primary key,\n             `isEqual(_:)` uses the `NSObject` behavior of comparing object identity.\n             This method can be used to compare two objects for database equality\n             whether or not their object type defines a primary key.\n\n     - parameter object: The object to compare the receiver to.\n     */\n    public func isSameObject(as object: Object?) -> Bool {\n        return RLMObjectBaseAreEqual(self, object)\n    }\n}\n\nextension Object: ThreadConfined {\n    /**\n     Indicates if this object is frozen.\n\n     - see: `Object.freeze()`\n     */\n    public var isFrozen: Bool { return realm?.isFrozen ?? false }\n\n    /**\n     Returns a frozen (immutable) snapshot of this object.\n\n     The frozen copy is an immutable object which contains the same data as this\n     object currently contains, but will not update when writes are made to the\n     containing Realm. Unlike live objects, frozen objects can be accessed from any\n     thread.\n\n     - warning: Holding onto a frozen object for an extended period while performing write\n     transaction on the Realm may result in the Realm file growing to large sizes. See\n     `Realm.Configuration.maximumNumberOfActiveVersions` for more information.\n     - warning: This method can only be called on a managed object.\n     */\n    public func freeze() -> Self {\n        guard let realm = realm else { throwRealmException(\"Unmanaged objects cannot be frozen.\") }\n        return realm.freeze(self)\n    }\n\n    /**\n     Returns a live (mutable) reference of this object.\n\n     This method creates a managed accessor to a live copy of the same frozen object.\n     Will return self if called on an already live object.\n     */\n    public func thaw() -> Self? {\n        guard let realm = realm else { throwRealmException(\"Unmanaged objects cannot be thawed.\") }\n        return realm.thaw(self)\n    }\n}\n\n/**\n Information about a specific property which changed in an `Object` change notification.\n */\n@frozen public struct PropertyChange {\n    /**\n     The name of the property which changed.\n    */\n    public let name: String\n\n    /**\n     Value of the property before the change occurred. This is not supplied if\n     the change happened on the same thread as the notification and for `List`\n     properties.\n\n     For object properties this will give the object which was previously\n     linked to, but that object will have its new values and not the values it\n     had before the changes. This means that `previousValue` may be a deleted\n     object, and you will need to check `isInvalidated` before accessing any\n     of its properties.\n    */\n    public let oldValue: Any?\n\n    /**\n     The value of the property after the change occurred. This is not supplied\n     for `List` properties and will always be nil.\n    */\n    public let newValue: Any?\n}\n\n/**\n Information about the changes made to an object which is passed to `Object`'s\n notification blocks.\n */\n@frozen public enum ObjectChange<T> {\n    /**\n     Errors can no longer occur. This case is unused and will be removed in the\n     next major version.\n     */\n    case error(_ error: NSError)\n    /**\n     One or more of the properties of the object have been changed.\n     */\n    case change(_: T, _: [PropertyChange])\n    /// The object has been deleted from the Realm.\n    case deleted\n\n    internal init(object: T?, names: [String]?, oldValues: [Any]?, newValues: [Any]?) {\n        guard let names = names, let newValues = newValues, let object = object else {\n            self = .deleted\n            return\n        }\n\n        self = .change(object, (0..<newValues.count).map { i in\n            PropertyChange(name: names[i], oldValue: oldValues?[i], newValue: newValues[i])\n        })\n    }\n}\n\n/// Object interface which allows untyped getters and setters for Objects.\n/// :nodoc:\n@objc(RealmSwiftDynamicObject)\n@dynamicMemberLookup\npublic final class DynamicObject: Object {\n    public override subscript(key: String) -> Any? {\n        get {\n            let value = RLMDynamicGetByName(self, key).flatMap(coerceToNil)\n            if let array = value as? RLMArray<AnyObject> {\n                return list(from: array)\n            }\n            if let set = value as? RLMSet<AnyObject> {\n                return mutableSet(from: set)\n            }\n            if let dictionary = value as? RLMDictionary<AnyObject, AnyObject> {\n                return map(from: dictionary)\n            }\n            return value\n        }\n        set(value) {\n            RLMDynamicValidatedSet(self, key, value)\n        }\n    }\n\n    public subscript(dynamicMember member: String) -> Any? {\n        get {\n            self[member]\n        }\n        set(value) {\n            self[member] = value\n        }\n    }\n\n    /// :nodoc:\n    public override func value(forUndefinedKey key: String) -> Any? {\n        self[key]\n    }\n\n    /// :nodoc:\n    public override func setValue(_ value: Any?, forUndefinedKey key: String) {\n        self[key] = value\n    }\n\n    /// :nodoc:\n    public override static func shouldIncludeInDefaultSchema() -> Bool {\n        false\n    }\n\n    override public static func sharedSchema() -> RLMObjectSchema? {\n        nil\n    }\n\n    private func list(from array: RLMArray<AnyObject>) -> Any {\n        switch array.type {\n        case .int:\n            return array.isOptional ? List<Int?>(collection: array) : List<Int>(collection: array)\n        case .double:\n            return array.isOptional ? List<Double?>(collection: array) : List<Double>(collection: array)\n        case .float:\n            return array.isOptional ? List<Float?>(collection: array) : List<Float>(collection: array)\n        case .decimal128:\n            return array.isOptional ? List<Decimal128?>(collection: array) : List<Decimal128>(collection: array)\n        case .bool:\n            return array.isOptional ? List<Bool?>(collection: array) : List<Bool>(collection: array)\n        case .UUID:\n            return array.isOptional ? List<UUID?>(collection: array) : List<UUID>(collection: array)\n        case .string:\n            return array.isOptional ? List<String?>(collection: array) : List<String>(collection: array)\n        case .data:\n            return array.isOptional ? List<Data?>(collection: array) : List<Data>(collection: array)\n        case .date:\n            return array.isOptional ? List<Date?>(collection: array) : List<Date>(collection: array)\n        case .any:\n            return List<AnyRealmValue>(collection: array)\n        case .linkingObjects:\n            throwRealmException(\"Unsupported migration type of 'LinkingObjects' for type 'List'.\")\n        case .objectId:\n            return array.isOptional ? List<ObjectId?>(collection: array) : List<ObjectId>(collection: array)\n        case .object:\n            return List<DynamicObject>(collection: array)\n        }\n    }\n\n    private func mutableSet(from set: RLMSet<AnyObject>) -> Any {\n        switch set.type {\n        case .int:\n            return set.isOptional ? MutableSet<Int?>(collection: set) : MutableSet<Int>(collection: set)\n        case .double:\n            return set.isOptional ? MutableSet<Double?>(collection: set) : MutableSet<Double>(collection: set)\n        case .float:\n            return set.isOptional ? MutableSet<Float?>(collection: set) : MutableSet<Float>(collection: set)\n        case .decimal128:\n            return set.isOptional ? MutableSet<Decimal128?>(collection: set) : MutableSet<Decimal128>(collection: set)\n        case .bool:\n            return set.isOptional ? MutableSet<Bool?>(collection: set) : MutableSet<Bool>(collection: set)\n        case .UUID:\n            return set.isOptional ? MutableSet<UUID?>(collection: set) : MutableSet<UUID>(collection: set)\n        case .string:\n            return set.isOptional ? MutableSet<String?>(collection: set) : MutableSet<String>(collection: set)\n        case .data:\n            return set.isOptional ? MutableSet<Data?>(collection: set) : MutableSet<Data>(collection: set)\n        case .date:\n            return set.isOptional ? MutableSet<Date?>(collection: set) : MutableSet<Date>(collection: set)\n        case .any:\n            return MutableSet<AnyRealmValue>(collection: set)\n        case .linkingObjects:\n            throwRealmException(\"Unsupported migration type of 'LinkingObjects' for type 'MutableSet'.\")\n        case .objectId:\n            return set.isOptional ? MutableSet<ObjectId?>(collection: set) : MutableSet<ObjectId>(collection: set)\n        case .object:\n            return MutableSet<DynamicObject>(collection: set)\n        }\n    }\n\n    private func map(from dictionary: RLMDictionary<AnyObject, AnyObject>) -> Any {\n        switch dictionary.type {\n        case .int:\n            return dictionary.isOptional ? Map<String, Int?>(objc: dictionary) : Map<String, Int>(objc: dictionary)\n        case .double:\n            return dictionary.isOptional ? Map<String, Double?>(objc: dictionary) : Map<String, Double>(objc: dictionary)\n        case .float:\n            return dictionary.isOptional ? Map<String, Float?>(objc: dictionary) : Map<String, Float>(objc: dictionary)\n        case .decimal128:\n            return dictionary.isOptional ? Map<String, Decimal128?>(objc: dictionary) : Map<String, Decimal128>(objc: dictionary)\n        case .bool:\n            return dictionary.isOptional ? Map<String, Bool?>(objc: dictionary) : Map<String, Bool>(objc: dictionary)\n        case .UUID:\n            return dictionary.isOptional ? Map<String, UUID?>(objc: dictionary) : Map<String, UUID>(objc: dictionary)\n        case .string:\n            return dictionary.isOptional ? Map<String, String?>(objc: dictionary) : Map<String, String>(objc: dictionary)\n        case .data:\n            return dictionary.isOptional ? Map<String, Data?>(objc: dictionary) : Map<String, Data>(objc: dictionary)\n        case .date:\n            return dictionary.isOptional ? Map<String, Date?>(objc: dictionary) : Map<String, Date>(objc: dictionary)\n        case .any:\n            return Map<String, AnyRealmValue>(objc: dictionary)\n        case .linkingObjects:\n            throwRealmException(\"Unsupported migration type of 'LinkingObjects' for type 'Map'.\")\n        case .objectId:\n            return dictionary.isOptional ? Map<String, ObjectId?>(objc: dictionary) : Map<String, ObjectId>(objc: dictionary)\n        case .object:\n            return Map<String, DynamicObject?>(objc: dictionary)\n        }\n    }\n}\n\n/**\n An enum type which can be stored on a Realm Object.\n\n Only `@objc` enums backed by an Int can be stored on a Realm object, and the\n enum type must explicitly conform to this protocol. For example:\n\n ```\n @objc enum MyEnum: Int, RealmEnum {\n    case first = 1\n    case second = 2\n    case third = 7\n }\n\n class MyModel: Object {\n    @objc dynamic enumProperty = MyEnum.first\n    let optionalEnumProperty = RealmOptional<MyEnum>()\n }\n ```\n */\npublic protocol RealmEnum: RealmOptionalType, _RealmSchemaDiscoverable {\n}\n\n// MARK: - Implementation\n\n/// :nodoc:\npublic extension RealmEnum where Self: RawRepresentable, Self.RawValue: _RealmSchemaDiscoverable & _ObjcBridgeable {\n    var _rlmObjcValue: Any { rawValue._rlmObjcValue }\n    static func _rlmFromObjc(_ value: Any, insideOptional: Bool) -> Self? {\n        if let value = value as? Self {\n            return value\n        }\n        if let value = value as? RawValue {\n            return Self(rawValue: value)\n        }\n        return nil\n    }\n    static func _rlmPopulateProperty(_ prop: RLMProperty) {\n        RawValue._rlmPopulateProperty(prop)\n    }\n    static var _rlmType: PropertyType { RawValue._rlmType }\n}\n\ninternal func dynamicSet(object: ObjectBase, key: String, value: Any?) {\n    let bridgedValue: Any?\n    if let v1 = value, let v2 = v1 as AnyObject as? _ObjcBridgeable {\n        bridgedValue = v2._rlmObjcValue\n    } else {\n        bridgedValue = value\n    }\n    if RLMObjectBaseRealm(object) == nil {\n        object.setValue(bridgedValue, forKey: key)\n    } else {\n        RLMDynamicValidatedSet(object, key, bridgedValue)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/ObjectId.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\n\n/**\n A 12-byte (probably) unique object identifier.\n\n ObjectIds are similar to a GUID or a UUID, and can be used to uniquely identify objects without a centralized ID generator. An ObjectID consists of:\n\n 1. A 4 byte timestamp measuring the creation time of the ObjectId in seconds since the Unix epoch.\n 2. A 5 byte random value\n 3. A 3 byte counter, initialized to a random value.\n\n ObjectIds are intended to be fast to generate. Sorting by an ObjectId field will typically result in the objects being sorted in creation order.\n */\n@objc(RealmSwiftObjectId)\npublic final class ObjectId: RLMObjectId, Decodable, @unchecked Sendable {\n    // MARK: Initializers\n\n    /// Creates a new zero-initialized ObjectId.\n    public override required init() {\n        super.init()\n    }\n\n    // swiftlint:disable unneeded_override\n    /// Creates a new randomly-initialized ObjectId.\n    public override static func generate() -> ObjectId {\n        super.generate()\n    }\n    // swiftlint:enable unneeded_override\n\n    /// Creates a new ObjectId from the given 24-byte hexadecimal string.\n    ///\n    /// Throws if the string is not 24 characters or contains any characters other than 0-9a-fA-F.\n    /// - Parameter string: The string to parse.\n    public override required init(string: String) throws {\n        try super.init(string: string)\n    }\n\n    /// Creates a new ObjectId using the given date, machine identifier, process identifier.\n    ///\n    /// - Parameters:\n    ///   - timestamp: A timestamp as NSDate.\n    ///   - machineId: The machine identifier.\n    ///   - processId: The process identifier.\n    public required init(timestamp: Date, machineId: Int, processId: Int) {\n        super.init(timestamp: timestamp,\n                   machineIdentifier: Int32(machineId),\n                   processIdentifier: Int32(processId))\n    }\n\n    /// Creates a new ObjectId from the given 24-byte hexadecimal static string.\n    ///\n    /// Aborts if the string is not 24 characters or contains any characters other than 0-9a-fA-F. Use the initializer which takes a String to handle invalid strings at runtime.\n    public required init(_ str: StaticString) {\n        // swiftlint:disable:next optional_data_string_conversion\n        try! super.init(string: str.withUTF8Buffer { String(decoding: $0, as: UTF8.self) })\n    }\n\n    /// Creates a new ObjectId by decoding from the given decoder.\n    ///\n    /// This initializer throws an error if reading from the decoder fails, or\n    /// if the data read is corrupted or otherwise invalid.\n    ///\n    /// - Parameter decoder: The decoder to read data from.\n    public required init(from decoder: Decoder) throws {\n        let container = try decoder.singleValueContainer()\n        try super.init(string: container.decode(String.self))\n    }\n}\n\nextension ObjectId: Encodable {\n    /// Encodes this ObjectId into the given encoder.\n    ///\n    /// This function throws an error if the given encoder is unable to encode a string.\n    ///\n    /// - Parameter encoder: The encoder to write data to.\n    public func encode(to encoder: Encoder) throws {\n        var container = encoder.singleValueContainer()\n        try container.encode(stringValue)\n    }\n}\n\nextension ObjectId: Comparable {\n    /// Returns a Boolean value indicating whether the value of the first\n    /// argument is less than that of the second argument.\n    ///\n    /// - Parameters:\n    ///   - lhs: An ObjectId value to compare.\n    ///   - rhs: Another ObjectId value to compare.\n    public static func < (lhs: ObjectId, rhs: ObjectId) -> Bool {\n        lhs.isLessThan(rhs)\n    }\n\n    /// Returns a Boolean value indicating whether the ObjectId of the first\n    /// argument is less than or equal to that of the second argument.\n    ///\n    /// - Parameters:\n    ///   - lhs: An ObjectId value to compare.\n    ///   - rhs: Another ObjectId value to compare.\n    public static func <= (lhs: ObjectId, rhs: ObjectId) -> Bool {\n        lhs.isLessThanOrEqual(to: rhs)\n    }\n\n    /// Returns a Boolean value indicating whether the ObjectId of the first\n    /// argument is greater than or equal to that of the second argument.\n    ///\n    /// - Parameters:\n    ///   - lhs: An ObjectId value to compare.\n    ///   - rhs: Another ObjectId value to compare.\n    public static func >= (lhs: ObjectId, rhs: ObjectId) -> Bool {\n        lhs.isGreaterThanOrEqual(to: rhs)\n    }\n\n    /// Returns a Boolean value indicating whether the ObjectId of the first\n    /// argument is greater than that of the second argument.\n    ///\n    /// - Parameters:\n    ///   - lhs: An ObjectId value to compare.\n    ///   - rhs: Another ObjectId value to compare.\n    public static func > (lhs: ObjectId, rhs: ObjectId) -> Bool {\n        lhs.isGreaterThan(rhs)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/ObjectSchema.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\nimport Realm.Private\n\n/**\n This class represents Realm model object schemas.\n\n When using Realm, `ObjectSchema` instances allow performing migrations and introspecting the database's schema.\n\n Object schemas map to tables in the core database.\n */\n@frozen public struct ObjectSchema: CustomStringConvertible {\n\n    // MARK: Properties\n\n    internal let rlmObjectSchema: RLMObjectSchema\n\n    /**\n     An array of `Property` instances representing the managed properties of a class described by the schema.\n\n     - see: `Property`\n     */\n    public var properties: [Property] {\n        return rlmObjectSchema.properties.map { Property($0) }\n    }\n\n    /// The name of the class the schema describes.\n    public var className: String { return rlmObjectSchema.className }\n\n    /// The object class the schema describes.\n    public var objectClass: AnyClass { return rlmObjectSchema.objectClass }\n\n    /// Whether this object is embedded.\n    public var isEmbedded: Bool { return rlmObjectSchema.isEmbedded }\n\n    /// Whether this object is asymmetric.\n    public var isAsymmetric: Bool { return rlmObjectSchema.isAsymmetric }\n\n    /// The property which serves as the primary key for the class the schema describes, if any.\n    public var primaryKeyProperty: Property? {\n        if let rlmProperty = rlmObjectSchema.primaryKeyProperty {\n            return Property(rlmProperty)\n        }\n        return nil\n    }\n\n    /// A human-readable description of the properties contained in the object schema.\n    public var description: String { return rlmObjectSchema.description }\n\n    // MARK: Initializers\n\n    internal init(_ rlmObjectSchema: RLMObjectSchema) {\n        self.rlmObjectSchema = rlmObjectSchema\n    }\n\n    // MARK: Property Retrieval\n\n    /// Returns the property with the given name, if it exists.\n    public subscript(propertyName: String) -> Property? {\n        if let rlmProperty = rlmObjectSchema[propertyName] {\n            return Property(rlmProperty)\n        }\n        return nil\n    }\n}\n\n// MARK: Equatable\n\nextension ObjectSchema: Equatable {\n    /// Returns whether the two object schemas are equal.\n    public static func == (lhs: ObjectSchema, rhs: ObjectSchema) -> Bool {\n        return lhs.rlmObjectSchema.isEqual(to: rhs.rlmObjectSchema)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/ObjectiveCSupport+AnyRealmValue.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n\nimport Foundation\nimport Realm\n\npublic extension ObjectiveCSupport {\n\n    /// Convert an object boxed in `AnyRealmValue` to its\n    /// Objective-C representation.\n    /// - Parameter value: The AnyRealmValue with the object.\n    /// - Returns: Conversion of `value` to its Objective-C representation.\n    static func convert(value: AnyRealmValue?) -> RLMValue? {\n        switch value {\n        case let .int(i):\n            return i as NSNumber\n        case let .bool(b):\n            return b as NSNumber\n        case let .float(f):\n            return f as NSNumber\n        case let .double(d):\n            return d as NSNumber\n        case let .string(s):\n            return s as NSString\n        case let .data(d):\n            return d as NSData\n        case let .date(d):\n            return d as NSDate\n        case let .objectId(o):\n            return o as RLMObjectId\n        case let .decimal128(o):\n            return o as RLMDecimal128\n        case let .uuid(u):\n            return u as NSUUID\n        case let .object(o):\n            return o\n        case let .dictionary(d):\n            return d.rlmDictionary\n        case let .list(l):\n            return l.rlmArray\n        default:\n            return nil\n        }\n    }\n\n    /// Takes an RLMValue, converts it to its Swift type and\n    /// stores it in `AnyRealmValue`.\n    /// - Parameter value: The RLMValue.\n    /// - Returns: The converted RLMValue type as an AnyRealmValue enum.\n    static func convert(value: RLMValue?) -> AnyRealmValue {\n        guard let value = value else {\n            return .none\n        }\n\n        switch value.rlm_anyValueType {\n        case RLMAnyValueType.int:\n            guard let val = value as? NSNumber else {\n                return .none\n            }\n            return .int(val.intValue)\n        case RLMAnyValueType.bool:\n            guard let val = value as? NSNumber else {\n                return .none\n            }\n            return .bool(val.boolValue)\n        case RLMAnyValueType.float:\n            guard let val = value as? NSNumber else {\n                return .none\n            }\n            return .float(val.floatValue)\n        case RLMAnyValueType.double:\n            guard let val = value as? NSNumber else {\n                return .none\n            }\n            return .double(val.doubleValue)\n        case RLMAnyValueType.string:\n            guard let val = value as? String else {\n                return .none\n            }\n            return .string(val)\n        case RLMAnyValueType.data:\n            guard let val = value as? Data else {\n                return .none\n            }\n            return .data(val)\n        case RLMAnyValueType.date:\n            guard let val = value as? Date else {\n                return .none\n            }\n            return .date(val)\n        case RLMAnyValueType.objectId:\n            guard let val = value as? ObjectId else {\n                return .none\n            }\n            return .objectId(val)\n        case RLMAnyValueType.decimal128:\n            guard let val = value as? Decimal128 else {\n                return .none\n            }\n            return .decimal128(val)\n        case RLMAnyValueType.UUID:\n            guard let val = value as? UUID else {\n                return .none\n            }\n            return .uuid(val)\n        case RLMAnyValueType.object:\n            guard let val = value as? Object else {\n                return .none\n            }\n            return .object(val)\n        case RLMAnyValueType.dictionary:\n            guard let val = value as? RLMDictionary<AnyObject, AnyObject> else {\n                return .none\n            }\n            let d = Map<String, AnyRealmValue>(objc: val)\n            return AnyRealmValue.dictionary(d)\n        case RLMAnyValueType.list:\n            guard let val = value as? RLMArray<RLMValue> else {\n                return .none\n            }\n            return AnyRealmValue.list(List<AnyRealmValue>(collection: val))\n        default:\n            return .none\n        }\n    }\n}\n"
  },
  {
    "path": "RealmSwift/ObjectiveCSupport.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Realm\n\n/**\n `ObjectiveCSupport` is a class providing methods for Swift/Objective-C interoperability.\n\n With `ObjectiveCSupport` you can either retrieve the internal ObjC representations of the Realm objects,\n or wrap ObjC Realm objects with their Swift equivalents.\n\n Use this to provide public APIs that support both platforms.\n\n :nodoc:\n **/\n@frozen public struct ObjectiveCSupport {\n\n    /// Convert a `Results` to a `RLMResults`.\n    public static func convert<T>(object: Results<T>) -> RLMResults<AnyObject> {\n        return object.collection as! RLMResults<AnyObject>\n    }\n\n    /// Convert a `RLMResults` to a `Results`.\n    public static func convert(object: RLMResults<AnyObject>) -> Results<Object> {\n        return Results(object)\n    }\n\n    /// Convert a `List` to a `RLMArray`.\n    public static func convert<T>(object: List<T>) -> RLMArray<AnyObject> {\n        return object.rlmArray\n    }\n\n    /// Convert a `MutableSet` to a `RLMSet`.\n    public static func convert<T>(object: MutableSet<T>) -> RLMSet<AnyObject> {\n        return object.rlmSet\n    }\n\n    /// Convert a `RLMArray` to a `List`.\n    public static func convert(object: RLMArray<AnyObject>) -> List<Object> {\n        return List(collection: object)\n    }\n\n    /// Convert a `RLMSet` to a `MutableSet`.\n    public static func convert(object: RLMSet<AnyObject>) -> MutableSet<Object> {\n        return MutableSet(collection: object)\n    }\n\n    /// Convert a `Map` to a `RLMDictionary`.\n    public static func convert<Key, Value>(object: Map<Key, Value>) -> RLMDictionary<AnyObject, AnyObject> {\n        return object.rlmDictionary\n    }\n\n    /// Convert a `RLMDictionary` to a `Map`.\n    public static func convert<Key>(object: RLMDictionary<AnyObject, AnyObject>) -> Map<Key, Object> {\n        return Map(objc: object)\n    }\n\n    /// Convert a `LinkingObjects` to a `RLMResults`.\n    public static func convert<T>(object: LinkingObjects<T>) -> RLMResults<AnyObject> {\n        return object.collection as! RLMResults<AnyObject>\n    }\n\n    /// Convert a `RLMLinkingObjects` to a `Results`.\n    public static func convert(object: RLMLinkingObjects<RLMObject>) -> Results<Object> {\n        return Results(object)\n    }\n\n    /// Convert a `Realm` to a `RLMRealm`.\n    public static func convert(object: Realm) -> RLMRealm {\n        return object.rlmRealm\n    }\n\n    /// Convert a `RLMRealm` to a `Realm`.\n    public static func convert(object: RLMRealm) -> Realm {\n        return Realm(object)\n    }\n\n    /// Convert a `Migration` to a `RLMMigration`.\n    @available(*, deprecated, message: \"This function is now redundant\")\n    public static func convert(object: Migration) -> RLMMigration {\n        return object\n    }\n\n    /// Convert a `ObjectSchema` to a `RLMObjectSchema`.\n    public static func convert(object: ObjectSchema) -> RLMObjectSchema {\n        return object.rlmObjectSchema\n    }\n\n    /// Convert a `RLMObjectSchema` to a `ObjectSchema`.\n    public static func convert(object: RLMObjectSchema) -> ObjectSchema {\n        return ObjectSchema(object)\n    }\n\n    /// Convert a `Property` to a `RLMProperty`.\n    public static func convert(object: Property) -> RLMProperty {\n        return object.rlmProperty\n    }\n\n    /// Convert a `RLMProperty` to a `Property`.\n    public static func convert(object: RLMProperty) -> Property {\n        return Property(object)\n    }\n\n    /// Convert a `Realm.Configuration` to a `RLMRealmConfiguration`.\n    public static func convert(object: Realm.Configuration) -> RLMRealmConfiguration {\n        return object.rlmConfiguration\n    }\n\n    /// Convert a `RLMRealmConfiguration` to a `Realm.Configuration`.\n    public static func convert(object: RLMRealmConfiguration) -> Realm.Configuration {\n        return .fromRLMRealmConfiguration(object)\n    }\n\n    /// Convert a `Schema` to a `RLMSchema`.\n    public static func convert(object: Schema) -> RLMSchema {\n        return object.rlmSchema\n    }\n\n    /// Convert a `RLMSchema` to a `Schema`.\n    public static func convert(object: RLMSchema) -> Schema {\n        return Schema(object)\n    }\n\n    /// Convert a `SortDescriptor` to a `RLMSortDescriptor`.\n    public static func convert(object: SortDescriptor) -> RLMSortDescriptor {\n        return object.rlmSortDescriptorValue\n    }\n\n    /// Convert a `RLMSortDescriptor` to a `SortDescriptor`.\n    public static func convert(object: RLMSortDescriptor) -> SortDescriptor {\n        return SortDescriptor(keyPath: object.keyPath, ascending: object.ascending)\n    }\n\n    /// Convert a `RLMShouldCompactOnLaunchBlock` to a Realm Swift compact block.\n    @preconcurrency\n    public static func convert(object: @escaping RLMShouldCompactOnLaunchBlock) -> @Sendable (Int, Int) -> Bool {\n        return { totalBytes, usedBytes in\n            return object(UInt(totalBytes), UInt(usedBytes))\n        }\n    }\n\n    /// Convert a Realm Swift compact block to a `RLMShouldCompactOnLaunchBlock`.\n    @preconcurrency\n    public static func convert(object: @Sendable @escaping (Int, Int) -> Bool) -> RLMShouldCompactOnLaunchBlock {\n        return { totalBytes, usedBytes in\n            return object(Int(totalBytes), Int(usedBytes))\n        }\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Optional.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Realm\n\n/// A protocol describing types that can parameterize a `RealmOptional`.\npublic protocol RealmOptionalType: _ObjcBridgeable {\n}\n\npublic extension RealmOptionalType {\n    /// :nodoc:\n    static func className() -> String {\n        return \"\"\n    }\n}\nextension Int: RealmOptionalType {}\nextension Int8: RealmOptionalType {}\nextension Int16: RealmOptionalType {}\nextension Int32: RealmOptionalType {}\nextension Int64: RealmOptionalType {}\nextension Float: RealmOptionalType {}\nextension Double: RealmOptionalType {}\nextension Bool: RealmOptionalType {}\n\n/**\n A `RealmOptional` instance represents an optional value for types that can't be\n directly declared as `@objc` in Swift, such as `Int`, `Float`, `Double`, and `Bool`.\n\n To change the underlying value stored by a `RealmOptional` instance, mutate the instance's `value` property.\n */\n@available(*, deprecated, renamed: \"RealmProperty\", message: \"RealmOptional<T> has been deprecated, use RealmProperty<T?> instead.\")\npublic final class RealmOptional<Value: RealmOptionalType>: RLMSwiftValueStorage {\n    /// The value the optional represents.\n    public var value: Value? {\n        get {\n            return RLMGetSwiftValueStorage(self).map(staticBridgeCast)\n        }\n        set {\n            RLMSetSwiftValueStorage(self, newValue.map(staticBridgeCast))\n        }\n    }\n\n    /**\n     Creates a `RealmOptional` instance encapsulating the given default value.\n\n     - parameter value: The value to store in the optional, or `nil` if not specified.\n     */\n    public init(_ value: Value? = nil) {\n        super.init()\n        self.value = value\n    }\n}\n\n@available(*, deprecated, message: \"RealmOptional has been deprecated, use RealmProperty<T?> instead.\")\nextension RealmOptional: Equatable where Value: Equatable {\n    public static func == (lhs: RealmOptional<Value>, rhs: RealmOptional<Value>) -> Bool {\n        return lhs.value == rhs.value\n    }\n}\n\n@available(*, deprecated, message: \"RealmOptional has been deprecated, use RealmProperty<T?> instead.\")\nextension RealmOptional: Codable where Value: Codable, Value: _RealmSchemaDiscoverable {\n    public convenience init(from decoder: Decoder) throws {\n        self.init()\n        // `try decoder.singleValueContainer().decode(Value?.self)` incorrectly\n        // rejects null values: https://bugs.swift.org/browse/SR-7404\n        self.value = try decoder.decodeOptional(Value?.self)\n    }\n\n    public func encode(to encoder: Encoder) throws {\n        var container = encoder.singleValueContainer()\n        try container.encode(value)\n    }\n}\n\ninternal protocol RealmOptionalProtocol { }\n@available(*, deprecated, message: \"RealmOptional has been deprecated, use RealmProperty<T?> instead.\")\nextension RealmOptional: RealmOptionalProtocol { }\n\ninternal extension Decoder {\n    func decodeOptional<T: _RealmSchemaDiscoverable>(_ type: T.Type) throws -> T where T: Decodable {\n        let container = try singleValueContainer()\n        if container.decodeNil() {\n            if let type = T.self as? _ObjcBridgeable.Type, let value = type._rlmFromObjc(NSNull()) {\n                return value as! T\n            }\n            throw DecodingError.typeMismatch(T.self, .init(codingPath: self.codingPath, debugDescription: \"Cannot convert nil to \\(T.self)\"))\n        }\n        return try container.decode(T.self)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/PersistedProperty.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Realm\nimport Realm.Private\n\n/// @Persisted is used to declare properties on Object subclasses which should be\n/// managed by Realm.\n///\n/// Example of usage:\n/// ```\n/// class MyModel: Object {\n///     // A basic property declaration. A property with no\n///     // default value supplied will default to `nil` for\n///     // Optional types, zero for numeric types, false for Bool,\n///     // an empty string/data, and a new random value for UUID\n///     // and ObjectID.\n///     @Persisted var basicIntProperty: Int\n///\n///     // Custom default values can be specified with the\n///     // standard Swift syntax\n///     @Persisted var intWithCustomDefault: Int = 5\n///\n///     // Properties can be indexed by passing `indexed: true`\n///     // to the initializer.\n///     @Persisted(indexed: true) var indexedString: String\n///\n///     // Properties can set as the class's primary key by\n///     // passing `primaryKey: true` to the initializer\n///     @Persisted(primaryKey: true) var _id: ObjectId\n///\n///     // List and set properties should always be declared\n///     // with `: List` rather than `= List()`\n///     @Persisted var listProperty: List<Int>\n///     @Persisted var setProperty: MutableSet<MyObject>\n///\n///     // LinkingObjects properties require setting the source\n///     // object link property name in the initializer\n///     @Persisted(originProperty: \"outgoingLink\")\n///     var incomingLinks: LinkingObjects<OtherModel>\n///\n///     // Properties which are not marked with @Persisted will\n///     // be ignored entirely by Realm.\n///     var ignoredProperty = true\n/// }\n/// ```\n///\n///  Int, Bool, String, ObjectId and Date properties can be indexed by passing\n///  `indexed: true` to the initializer. Indexing a property improves the\n///  performance of equality queries on that property, at the cost of slightly\n///  worse write performance. No other operations currently use the index.\n///\n///  A property can be set as the class's primary key by passing `primaryKey: true`\n///  to the initializer. Compound primary keys are not supported, and setting\n///  more than one property as the primary key will throw an exception at\n///  runtime. Only Int, String, UUID and ObjectID properties can be made the\n///  primary key. The primary key property can only be mutated on unmanaged objects,\n///  and mutating it on an object which has been added to a Realm will throw an\n///  exception.\n///\n///  Properties can optionally be given a default value using the standard Swift\n///  syntax. If no default value is given, a value will be generated on first\n///  access: `nil` for all Optional types, zero for numeric types, false for\n///  Bool, an empty string/data, and a new random value for UUID and ObjectID.\n///  List and MutableSet properties *should not* be defined by setting them to a\n///  default value of an empty List/MutableSet. Doing so will work, but will\n///  result in worse performance when accessing objects managed by a Realm.\n///  Similarly, ObjectID properties *should not* be initialized to\n///  `ObjectID.generate()`, as doing so will result in extra ObjectIDs being\n///  generated and then discarded when reading from a Realm.\n///\n///  If a class has at least one @Persisted property, all other properties will be\n///  ignored by Realm. This means that they will not be persisted and will not\n///  be usable in queries and other operations such as sorting and aggregates\n///  which require a managed property.\n///\n///  @Persisted cannot be used anywhere other than as a property on an Object or\n///  EmbeddedObject subclass and trying to use it in other places will result in\n///  runtime errors.\n@propertyWrapper\npublic struct Persisted<Value: _Persistable> {\n    private var storage: PropertyStorage<Value>\n\n    /// :nodoc:\n    @available(*, unavailable, message: \"@Persisted can only be used as a property on a Realm object\")\n    public var wrappedValue: Value {\n        // The static subscript below is called instead of this when the property\n        // wrapper is used on an ObjectBase subclass, which is the only thing we support.\n        get { fatalError(\"called wrappedValue getter\") }\n        // swiftlint:disable:next unused_setter_value\n        set { fatalError(\"called wrappedValue setter\") }\n    }\n\n    /// Declares a property which is lazily initialized to the type's default value.\n    public init() {\n        storage = .unmanagedNoDefault(indexed: false, primary: false)\n    }\n    /// Declares a property which defaults to the given value.\n    public init(wrappedValue value: Value) {\n        storage = .unmanaged(value: value, indexed: false, primary: false)\n    }\n\n    /// :nodoc:\n    public static subscript<EnclosingSelf: ObjectBase>(\n        _enclosingInstance observed: EnclosingSelf,\n        wrapped wrappedKeyPath: ReferenceWritableKeyPath<EnclosingSelf, Value>,\n        storage storageKeyPath: ReferenceWritableKeyPath<EnclosingSelf, Self>\n        ) -> Value {\n        get {\n            return observed[keyPath: storageKeyPath].get(observed)\n        }\n        set {\n            observed[keyPath: storageKeyPath].set(observed, value: newValue)\n        }\n    }\n\n    // Called via RLMInitializeSwiftAccessor() to initialize the wrapper on a\n    // newly created managed accessor object.\n    internal mutating func initialize(_ object: ObjectBase, key: PropertyKey) {\n        storage = .managed(key: key)\n    }\n\n    // Collection types use this instead of the above because when promoting a\n    // unmanaged object to a managed object we want to reuse the existing collection\n    // object if it exists. Currently it always will exist because we read the\n    // value of the property first, but there's a potential optimization to\n    // skip initializing it on that read.\n    internal mutating func initializeCollection(_ object: ObjectBase, key: PropertyKey) -> Value? {\n        if case let .unmanaged(value, _, _) = storage {\n            storage = .managedCached(value: value, key: key)\n            return value\n        }\n        if case let .unmanagedObserved(value, _) = storage {\n            storage = .managedCached(value: value, key: key)\n            return value\n        }\n        storage = .managed(key: key)\n        return nil\n    }\n\n    internal mutating func get(_ object: ObjectBase) -> Value {\n        switch storage {\n        case let .unmanaged(value, _, _):\n            return value\n        case .unmanagedNoDefault:\n            let value = Value._rlmDefaultValue()\n            storage = .unmanaged(value: value)\n            return value\n        case let .unmanagedObserved(value, key):\n            if let lastAccessedNames = object.lastAccessedNames {\n                let name: String\n                if Value._rlmType == .linkingObjects {\n                    name = RLMObjectBaseObjectSchema(object)!.computedProperties[Int(key)].name\n                } else {\n                    name = RLMObjectBaseObjectSchema(object)!.properties[Int(key)].name\n                }\n                lastAccessedNames.add(name)\n                if let type = Value.self as? KeypathRecorder.Type {\n                    return type.keyPathRecorder(with: lastAccessedNames) as! Value\n                }\n                return Value._rlmDefaultValue()\n            }\n            return value\n        case let .managed(key):\n            let v = Value._rlmGetProperty(object, key)\n            if Value._rlmRequiresCaching {\n                // Collection types are initialized once and stored on the\n                // object rather than on every access. Non-collection types\n                // cannot be cached without some mechanism for knowing when to\n                // reread them which we don't currently have.\n                storage = .managedCached(value: v, key: key)\n            }\n            return v\n        case let .managedCached(value, _):\n            return value\n        }\n    }\n\n    internal mutating func set(_ object: ObjectBase, value: Value) {\n        if value is MutableRealmCollection {\n            (get(object) as! MutableRealmCollection).assign(value)\n            return\n        }\n        switch storage {\n        case let .unmanagedObserved(_, key):\n            let name = RLMObjectBaseObjectSchema(object)!.properties[Int(key)].name\n            object.willChangeValue(forKey: name)\n            storage = .unmanagedObserved(value: value, key: key)\n            object.didChangeValue(forKey: name)\n        case .managed(let key), .managedCached(_, let key):\n            Value._rlmSetProperty(object, key, value)\n        case .unmanaged, .unmanagedNoDefault:\n            storage = .unmanaged(value: value, indexed: false, primary: false)\n        }\n    }\n\n    // Initialize an unmanaged property for observation\n    internal mutating func observe(_ object: ObjectBase, property: RLMProperty) {\n        let value: Value\n        switch storage {\n        case let .unmanaged(v, _, _):\n            value = v\n        case .unmanagedNoDefault:\n            value = Value._rlmDefaultValue()\n        case .unmanagedObserved, .managed, .managedCached:\n            return\n        }\n        // Mutating a collection triggers a KVO notification on the parent, so\n        // we need to ensure that the collection has a pointer to its parent.\n        if let value = value as? MutableRealmCollection {\n            value.setParent(object, property)\n        }\n        storage = .unmanagedObserved(value: value, key: PropertyKey(property.index))\n    }\n}\n\nextension Persisted: Decodable where Value: Decodable {\n    public init(from decoder: Decoder) throws {\n        storage = .unmanaged(value: try decoder.decodeOptional(Value.self), indexed: false, primary: false)\n    }\n}\n\nextension Persisted: Encodable where Value: Encodable {\n    public func encode(to encoder: Encoder) throws {\n        var container = encoder.singleValueContainer()\n        switch storage {\n        case .unmanaged(let value, _, _):\n            try container.encode(value)\n        case .unmanagedObserved(let value, _):\n            try container.encode(value)\n        case .unmanagedNoDefault:\n            try container.encode(Value._rlmDefaultValue())\n        default:\n            // We need a reference to the parent object to be able to read from\n            // a managed property. There's probably a way to do this with some\n            // sort of custom adapter that keeps track of the current parent\n            // at each level of recursion, but it's not trivial.\n            throw EncodingError.invalidValue(self, .init(codingPath: encoder.codingPath, debugDescription: \"Only unmanaged Realm objects can be encoded using automatic Codable synthesis. You must explicitly define encode(to:) on your model class to support managed Realm objects.\"))\n        }\n    }\n}\n\n/// :nodoc:\n/// Protocol for a PropertyWrapper to properly handle Coding when the wrappedValue is Optional\npublic protocol OptionalCodingWrapper {\n    associatedtype WrappedType: ExpressibleByNilLiteral\n    init(wrappedValue: WrappedType)\n}\n\n/// :nodoc:\nextension KeyedDecodingContainer {\n    // This is used to override the default decoding behaviour for OptionalCodingWrapper to allow a value to avoid a missing key Error\n    public func decode<T>(_ type: T.Type, forKey key: KeyedDecodingContainer<K>.Key) throws -> T where T: Decodable, T: OptionalCodingWrapper {\n        return try decodeIfPresent(T.self, forKey: key) ?? T(wrappedValue: nil)\n    }\n}\n\nextension Persisted: OptionalCodingWrapper where Value: ExpressibleByNilLiteral {\n}\n\n/**\n An enum type which can be used with @Persisted and Realm Collections.\n\n Persisting an enum in Realm requires that it have a raw value and that the raw value by a type which Realm can store.\n The enum also has to be explicitly marked as conforming to this protocol as Swift does not let us do so implicitly.\n\n ```\n enum IntEnum: Int, PersistableEnum {\n    case first = 1\n    case second = 2\n    case third = 7\n }\n enum StringEnum: String, PersistableEnum {\n    case first = \"a\"\n    case second = \"b\"\n    case third = \"g\"\n }\n ```\n\n If the Realm contains a value which is not a valid member of the enum (such as\n if it was written by a different sync client which disagrees on which values\n are valid), optional enum properties will return `nil`, and non-optional\n properties will abort the process.\n */\npublic protocol PersistableEnum: _PersistableInsideOptional, RawRepresentable, CaseIterable, RealmEnum, _RealmCollectionValueInsideOptional, MinMaxType, Comparable where RawValue: Comparable {\n}\n\nextension PersistableEnum {\n    /// :nodoc:\n    public init() { self = Self.allCases.first! }\n    /// :nodoc:\n    public static func < (lhs: Self, rhs: Self) -> Bool {\n        return lhs.rawValue < rhs.rawValue\n    }\n    /// :nodoc:\n    public static func _rlmDefaultValue() -> Self {\n        Self.allCases.first!\n    }\n}\n\n/// A type which can be indexed.\n///\n/// This protocol is merely a tag and declaring additional types as conforming\n/// to it will simply result in runtime errors rather than compile-time errors.\n@_marker public protocol _Indexable {}\n\nextension Persisted where Value.PersistedType: _Indexable {\n    /// Declares an indexed property which is lazily initialized to the type's default value.\n    public init(indexed: Bool) {\n        storage = .unmanagedNoDefault(indexed: indexed)\n    }\n    /// Declares an indexed property which defaults to the given value.\n    public init(wrappedValue value: Value, indexed: Bool) {\n        storage = .unmanaged(value: value, indexed: indexed)\n    }\n}\n\n/// A type which can be made the primary key of an object.\n///\n/// This protocol is merely a tag and declaring additional types as conforming\n/// to it will simply result in runtime errors rather than compile-time errors.\n@_marker public protocol _PrimaryKey {}\n\nextension Persisted where Value.PersistedType: _PrimaryKey {\n    /// Declares the primary key property which is lazily initialized to the type's default value.\n    public init(primaryKey: Bool) {\n        storage = .unmanagedNoDefault(primary: primaryKey)\n    }\n    /// Declares the primary key property which defaults to the given value.\n    public init(wrappedValue value: Value, primaryKey: Bool) {\n        storage = .unmanaged(value: value, primary: primaryKey)\n    }\n}\n\n// Constraining the LinkingObjects initializer to only LinkingObjects require\n// doing so via a protocol which only that type conforms to.\n/// :nodoc:\npublic protocol LinkingObjectsProtocol {\n    init(fromType: Element.Type, property: String)\n    associatedtype Element\n}\nextension Persisted where Value: LinkingObjectsProtocol {\n    /// Declares a LinkingObjects property with the given origin property name.\n    ///\n    /// - param originProperty: The name of the property on the linking object type which links to this object.\n    public init(originProperty: String) {\n        self.init(wrappedValue: Value(fromType: Value.Element.self, property: originProperty))\n    }\n}\nextension LinkingObjects: LinkingObjectsProtocol {}\n\n// MARK: - Implementation\n\n/// :nodoc:\nextension Persisted: DiscoverablePersistedProperty where Value: _Persistable {\n    public static var _rlmType: PropertyType { Value._rlmType }\n    public static var _rlmOptional: Bool { Value._rlmOptional }\n    public static var _rlmRequireObjc: Bool { false }\n    public static func _rlmPopulateProperty(_ prop: RLMProperty) {\n        // The label reported by Mirror has an underscore prefix added to it\n        // as it's the actual storage rather than the compiler-magic getter/setter\n        prop.name = String(prop.name.dropFirst())\n        Value._rlmPopulateProperty(prop)\n        Value._rlmSetAccessor(prop)\n    }\n    public func _rlmPopulateProperty(_ prop: RLMProperty) {\n        switch storage {\n        case let .unmanaged(value, indexed, primary):\n            value._rlmPopulateProperty(prop)\n            prop.indexed = indexed || primary\n            prop.isPrimary = primary\n        case let .unmanagedNoDefault(indexed, primary):\n            prop.indexed = indexed || primary\n            prop.isPrimary = primary\n        default:\n            fatalError()\n        }\n    }\n}\n\n// The actual storage for modern properties on objects.\n//\n// A newly created @Persisted will be either .unmanaged or .unmanagedNoDefault\n// depending on whether the user supplied a default value with `= value` when\n// defining the property. .unmanagedNoDefault turns into .unmanaged the first\n// time the property is read from, using a default value generated for the type.\n// If an unmanaged object is observed, that specific property is switched to\n// .unmanagedObserved so that the property can look up its name in the setter.\n//\n// When a new managed accessor is created, all properties are set to .managed.\n// When an existing unmanaged object is added to a Realm, existing non-collection\n// properties are set to .unmanaged, and collections are set to .managedCached,\n// reusing the existing instance of the collection (which are themselves promoted\n// to managed).\n//\n// The indexed and primary members of the unmanaged cases are used only for\n// schema discovery and are not always preserved once the Persisted is actually\n// used for anything.\nprivate enum PropertyStorage<T> {\n    // An unmanaged value. This is used as the initial state if the user did\n    // supply a default value, or if an unmanaged property is read or written\n    // (but not observed).\n    case unmanaged(value: T, indexed: Bool = false, primary: Bool = false)\n\n    // The property is unmanaged and does not yet have a value. This state is\n    // used if the user does not supply a default value in their model definition\n    // and will be converted to the zero/empty value for the type when this\n    // property is first used.\n    case unmanagedNoDefault(indexed: Bool = false, primary: Bool = false)\n\n    // The property is unmanaged and the parent object has (or previously had)\n    // KVO observers, so we performed the additional initialization to set the\n    // property key on each property. We do not track indexed/primary in this\n    // state because those are needed only for schema discovery. An unmanaged\n    // property never transitions from this state back to .unmanaged.\n    case unmanagedObserved(value: T, key: PropertyKey)\n\n    // The property is managed and so only needs to store the key to get/set\n    // the value on the parent object.\n    case managed(key: PropertyKey)\n\n    // The property is managed and is storing a value which will be returned each\n    // time. This is used only for collection properties, which are themselves\n    // live objects and so only need to be created once. Caching them is both a\n    // performance optimization (creating them involves a few memory allocations)\n    // and is required for KVO to work correctly.\n    case managedCached(value: T, key: PropertyKey)\n}\n"
  },
  {
    "path": "RealmSwift/PrivacyInfo.xcprivacy",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>NSPrivacyTrackingDomains</key>\n\t<array/>\n\t<key>NSPrivacyCollectedDataTypes</key>\n\t<array/>\n\t<key>NSPrivacyAccessedAPITypes</key>\n\t<array>\n\t\t<dict>\n\t\t\t<key>NSPrivacyAccessedAPITypeReasons</key>\n\t\t\t<array>\n\t\t\t\t<string>C617.1</string>\n\t\t\t</array>\n\t\t\t<key>NSPrivacyAccessedAPIType</key>\n\t\t\t<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>NSPrivacyAccessedAPITypeReasons</key>\n\t\t\t<array>\n\t\t\t\t<string>E174.1</string>\n\t\t\t</array>\n\t\t\t<key>NSPrivacyAccessedAPIType</key>\n\t\t\t<string>NSPrivacyAccessedAPICategoryDiskSpace</string>\n\t\t</dict>\n\t</array>\n\t<key>NSPrivacyTracking</key>\n\t<false/>\n</dict>\n</plist>\n"
  },
  {
    "path": "RealmSwift/Projection.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Realm\nimport Realm.Private\nimport Combine\n\nprivate protocol AnyProjected {\n    var projectedKeyPath: AnyKeyPath { get }\n}\n\n// MARK: Projection\n\n/// ``@Projected`` is used to declare properties on ``Projection`` protocols which should be\n/// managed by Realm.\n///\n/// Example of usage:\n/// ```swift\n/// public class Person: Object {\n///     @Persisted var firstName = \"\"\n///     @Persisted var lastName = \"\"\n///     @Persisted var address: Address?\n///     @Persisted var friends: List<Person>\n///     @Persisted var reviews: List<String>\n/// }\n///\n/// class PersonProjection: Projection<Person> {\n///     @Projected(\\Person.firstName) var firstName\n///     @Projected(\\Person.lastName.localizedUppercase) var lastNameCaps\n///     @Projected(\\Person.address.city) var homeCity\n///     @Projected(\\Person.friends.projectTo.firstName) var firstFriendsName: ProjectedCollection<String>\n/// }\n///\n/// let people: Results<PersonProjection> = realm.objects(PersonProjection.self)\n/// ```\n@propertyWrapper\npublic struct Projected<T: ObjectBase, Value>: AnyProjected {\n    fileprivate var _projectedKeyPath: KeyPath<T, Value>\n    var projectedKeyPath: AnyKeyPath {\n        _projectedKeyPath\n    }\n\n    /// :nodoc:\n    @available(*, unavailable, message: \"@Persisted can only be used as a property on a Realm object\")\n    public var wrappedValue: Value {\n        // The static subscript below is called instead of this when the property\n        // wrapper is used on an ObjectBase subclass, which is the only thing we support.\n        get { fatalError(\"called wrappedValue getter\") }\n        // swiftlint:disable:next unused_setter_value\n        set { fatalError(\"called wrappedValue setter\") }\n    }\n\n    /// :nodoc:\n    public static subscript<EnclosingSelf: Projection<T>>(\n        _enclosingInstance observed: EnclosingSelf,\n        wrapped wrappedKeyPath: ReferenceWritableKeyPath<EnclosingSelf, Value>,\n        storage storageKeyPath: ReferenceWritableKeyPath<EnclosingSelf, Self>\n        ) -> Value {\n        get {\n            let storage = observed[keyPath: storageKeyPath]\n            return observed.rootObject[keyPath: storage._projectedKeyPath]\n        }\n        set {\n            guard let keyPath = observed[keyPath: storageKeyPath].projectedKeyPath as? WritableKeyPath<T, Value> else {\n                preconditionFailure(\"KeyPath is not writable\")\n            }\n            var obj = observed.rootObject\n            obj[keyPath: keyPath] = newValue\n        }\n    }\n\n    /// Declares a property which is lazily initialized to the type's default value.\n    public init(_ projectedKeyPath: KeyPath<T, Value>) {\n        self._projectedKeyPath = projectedKeyPath\n    }\n}\n// MARK: ProjectionObservable\n/**\n  A type erased Projection.\n \n ProjectionObservable is a Combine publisher\n */\npublic protocol ProjectionObservable: AnyObject, ThreadConfined {\n    /// The Projection's underlying type - a child of Realm `Object` or `EmbeddedObject`.\n    associatedtype Root: ObjectBase\n    /// The object being projected\n    var rootObject: Root { get }\n    /// :nodoc:\n    init(projecting object: Root)\n}\n\n/// ``Projection`` is a light weight model of the original Realm ``Object`` or ``EmbeddedObject``.\n/// You can use `Projection` as a view model to minimize boilerplate.\n///\n/// Example of usage:\n/// ```swift\n/// public class Person: Object {\n///     @Persisted var firstName = \"\"\n///     @Persisted var lastName = \"\"\n///     @Persisted var address: Address?\n///     @Persisted var friends: List<Person>\n///     @Persisted var reviews: List<String>\n/// }\n///\n/// public class Address: EmbeddedObject {\n///     @Persisted var city: String = \"\"\n///     @Persisted var country = \"\"\n/// }\n///\n/// class PersonProjection: Projection<Person> {\n///     @Projected(\\Person.firstName) var firstName\n///     @Projected(\\Person.lastName.localizedUppercase)\n///     var lastNameCaps\n///     @Projected(\\Person.address.city) var homeCity\n///     @Projected(\\Person.friends.projectTo.firstName)\n///     var friendsFirstName: ProjectedCollection<String>\n/// }\n/// ```\n///\n///  ### Supported property types\n///\n/// Projection can transform the original `@Persisted` properties in several ways:\n/// - `Passthrough` - `Projection`'s property will have same name and type as original object. See `PersonProjection.firstName`.\n/// - `Rename` - Projection's property will have same type as original object just with the new name.\n/// - `Keypath resolution` - you can access the certain properties of the projected `Object`. See `PersonProjection.lastNameCaps` and `PersonProjection.homeCity`.\n/// - `Collection mapping` - `List` and `MutableSet`of `Object`s or `EmbeddedObject`s  can be projected as a collection of primitive values.\n///     See `PersonProjection.friendsFirstName`.\n/// - `Exclusion` - all properties of the original Realm object that were not defined in the projection model will be excluded from projection.\n///     Any changes happened on those properties will not trigger a change notification for the `Projection`.\n///     You still can access the original `Object` or `EmbeddedObject` and observe notifications directly on it.\n/// - note: each `@Persisted` property can be `@Projected` in different ways in the same Projection class.\n/// Each `Object` or `EmbeddedObject` can have sevaral projections of same or different classes at once.\n///\n/// ### Querying\n///\n/// You can retrieve all Projections of a given type from a Realm by calling the `objects(_:)` of Realm or `init(projecting:)`\n/// of Projection's class:\n///\n/// ```swift\n/// let projections = realm.object(PersonProjection.self)\n/// let personObject = realm.create(Person.self)\n/// let singleProjection = PersonProjection(projecting: personObject)\n/// ```\nopen class Projection<Root: ObjectBase & RealmCollectionValue & ThreadConfined>: RealmCollectionValue, ProjectionObservable {\n    /// :nodoc:\n    public typealias PersistedType = Root\n\n    /// The object being projected\n    public let rootObject: Root\n\n    /**\n     Create a new projection.\n     - parameter object: The object to project.\n     */\n    public required init(projecting object: Root) {\n        self.rootObject = object\n\n        // Eagerly initialize the schema to ensure we report errors at a sensible time\n        _ = schema\n    }\n    /// :nodoc:\n    public static func == (lhs: Projection, rhs: Projection) -> Bool {\n        RLMObjectBaseAreEqual(lhs.rootObject, rhs.rootObject)\n    }\n    /// :nodoc:\n    public func hash(into hasher: inout Hasher) {\n        let hashVal = rootObject.hashValue\n        hasher.combine(hashVal)\n    }\n    /// :nodoc:\n    open var description: String {\n        return \"\"\"\n\\(type(of: self))<\\(type(of: rootObject))> <\\(Unmanaged.passUnretained(rootObject).toOpaque())> {\n\\t\\(schema.map {\n    \"\\t\\(String($0.label))(\\\\.\\($0.originPropertyKeyPathString)) = \\(rootObject[keyPath: $0.projectedKeyPath]!);\"\n}.joined(separator: \"\\n\"))\n}\n\"\"\"\n    }\n\n    /// :nodoc:\n    public static func _rlmDefaultValue() -> Self {\n        fatalError()\n    }\n}\n\nextension ProjectionObservable {\n    /**\n     Registers a block to be called each time the projection's underlying object changes.\n\n     The block will be asynchronously called after each write transaction which\n     deletes the underlying object or modifies any of the projected properties of the object,\n     including self-assignments that set a property to its existing value.\n\n     For write transactions performed on different threads or in different\n     processes, the block will be called when the managing Realm is\n     (auto)refreshed to a version including the changes, while for local write\n     transactions it will be called at some point in the future after the write\n     transaction is committed.\n\n     If no key paths are given, the block will be executed on any insertion,\n     modification, or deletion for all projected  properties, including projected properties of\n     any nested, linked objects. If a key path or key paths are provided,\n     then the block will be called for changes which occur only on the\n     provided key paths. For example, if:\n\n     ```swift\n     class Person: Object {\n         @Persisted var firstName: String\n         @Persisted var lastName = \"\"\n         @Persisted public var friends: List<Person>\n     }\n\n     class PersonProjection: Projection<Person> {\n         @Projected(\\Person.firstName) var name\n         @Projected(\\Person.lastName.localizedUppercase) var lastNameCaps\n         @Projected(\\Person.friends.projectTo.firstName) var firstFriendsName: ProjectedCollection<String>\n     }\n\n     let token = projectedPerson.observe(keyPaths: [\"name\"], { changes in\n        // ...\n     })\n     ```\n     - The above notification block fires for changes to the\n     `Person.firstName` property of the the projection's underlying `Person` Object,\n     but not for any changes made to `Person.lastName` or `Person.friends` list.\n     - The notification block fires for changes of `PersonProjection.name` property, but not  for\n     another projection's property change.\n     - If the observed key path were `[\"firstFriendsName\"]`, then any insertion,\n     deletion, or modification of the `firstName` of the `friends` list will trigger the block. A change to\n     `someFriend.lastName` would not trigger the block (where `someFriend`\n     is an element contained in `friends`)\n\n     - note: Multiple notification tokens on the same object which filter for\n     separate key paths *do not* filter exclusively. If one key path\n     change is satisfied for one notification token, then all notification\n     token blocks for that object will execute.\n\n     If no queue is given, notifications are delivered via the standard run\n     loop, and so can't be delivered while the run loop is blocked by other\n     activity. If a queue is given, notifications are delivered to that queue\n     instead. When notifications can't be delivered instantly, multiple\n     notifications may be coalesced into a single notification.\n\n     Unlike with `List` and `Results`, there is no \"initial\" callback made after\n     you add a new notification block.\n\n     You must retain the returned token for as long as you want updates to be sent\n     to the block. To stop receiving updates, call `invalidate()` on the token.\n\n     It is safe to capture a strong reference to the observed object within the\n     callback block. There is no retain cycle due to that the callback is\n     retained by the returned token and not by the object itself.\n\n     - warning: This method cannot be called during a write transaction, or when\n                the containing Realm is read-only.\n     - warning: For projected properties where the original property has the same root property name,\n                this will trigger a `PropertyChange` for each of the Projected properties even though\n                the change only corresponds to one of them.\n                For the following `Projection` object\n                ```swift\n                class PersonProjection: Projection<Person> {\n                    @Projected(\\Person.firstName) var name\n                    @Projected(\\Person.address.country) originCountry\n                    @Projected(\\Person.address.phone.number) mobile\n                }\n\n                let token = projectedPerson.observe { changes in\n                    if case .change(_, let propertyChanges) = changes {\n                        propertyChanges[0].newValue as? String, \"Winterfell\" // Will notify the new value\n                        propertyChanges[1].newValue as? String, \"555-555-555\" // Will notify with the current value, which hasn't change.\n                    }\n                })\n\n                try realm.write {\n                    person.address.country = \"Winterfell\"\n                }\n                ```\n\n     - parameter keyPaths: Only properties contained in the key paths array will trigger\n                           the block when they are modified. If `nil`, notifications\n                           will be delivered for any projected property change on the object.\n                           String key paths which do not correspond to a valid projected property\n                           will throw an exception.\n     - parameter queue: The serial dispatch queue to receive notification on. If\n                        `nil`, notifications are delivered to the current thread.\n     - parameter block: The block to call with information about changes to the object.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    public func observe(keyPaths: [String]? = nil,\n                        on queue: DispatchQueue? = nil,\n                        _ block: @escaping (ObjectChange<Self>) -> Void) -> NotificationToken {\n        let kps: [String] = schema.map(\\.originPropertyKeyPathString)\n\n        // If we're observing on a different queue, we need a projection which\n        // wraps an object confined to that queue. We'll lazily create it the\n        // first time the observation block is called. We can't create it now\n        // as we're probably not on the queue. If we aren't observing on a queue,\n        // we can just use ourself rather than allocating a new object\n        var projection: Self?\n        if queue == nil {\n            projection = self\n        }\n        let schema = self.schema\n        return RLMObjectBaseAddNotificationBlock(rootObject, kps, queue) { object, names, oldValues, newValues, error in\n            assert(error == nil) // error is no longer used\n            guard let names = names, let newValues = newValues else {\n                block(.deleted)\n                return\n            }\n            if projection == nil {\n                projection = Self(projecting: object as! Self.Root)\n            }\n\n            // Mapping the old values to the projected values requires assigning\n            // them to an object and then reading from the projected key path\n            var unmanagedRoot: Self.Root?\n            if let oldValues = oldValues {\n                unmanagedRoot = Self.Root()\n                for i in 0..<oldValues.count {\n                    unmanagedRoot!.setValue(oldValues[i], forKey: names[i])\n                }\n            }\n\n            var projectedChanges = [PropertyChange]()\n            for i in 0..<newValues.count {\n                let filter: (ProjectionProperty) -> Bool = { prop in\n                    if prop.originPropertyKeyPathString.components(separatedBy: \".\").first != names[i] {\n                        return false\n                    }\n                    guard let keyPaths, !keyPaths.isEmpty else {\n                        return true\n                    }\n\n                    // This will allow us to notify `PropertyChange`s associated only to the keyPaths passed by the user, instead of any Property which has the same root as the notified one.\n                    return keyPaths.contains(prop.originPropertyKeyPathString)\n                }\n                for property in schema.filter(filter) {\n                    // If the root is marked as modified this will build a `PropertyChange` for each of the Projection properties with the same original root, even if there is no change on their value.\n                    var changeOldValue: Any?\n                    if oldValues != nil {\n                        changeOldValue = unmanagedRoot![keyPath: property.projectedKeyPath]\n                    }\n                    let changedNewValue = object[keyPath: property.projectedKeyPath]\n                    projectedChanges.append(.init(name: property.label,\n                                                  oldValue: changeOldValue,\n                                                  newValue: changedNewValue))\n                }\n            }\n\n            // keypath filtering means this should never actually be empty\n            if !projectedChanges.isEmpty {\n                block(.change(projection!, projectedChanges))\n            }\n        }\n    }\n\n    /**\n     Registers a block to be called each time the projection's underlying object changes.\n\n     The block will be asynchronously called after each write transaction which\n     deletes the underlying object or modifies any of the projected properties of the object,\n     including self-assignments that set a property to its existing value.\n\n     For write transactions performed on different threads or in different\n     processes, the block will be called when the managing Realm is\n     (auto)refreshed to a version including the changes, while for local write\n     transactions it will be called at some point in the future after the write\n     transaction is committed.\n\n     If no key paths are given, the block will be executed on any insertion,\n     modification, or deletion for all projected  properties, including projected properties of\n     any nested, linked objects. If a key path or key paths are provided,\n     then the block will be called for changes which occur only on the\n     provided key paths. For example, if:\n     \n     ```swift\n     class Person: Object {\n         @Persisted var firstName: String\n         @Persisted var lastName = \"\"\n         @Persisted public var friends: List<Person>\n     }\n\n     class PersonProjection: Projection<Person> {\n         @Projected(\\Person.firstName) var name\n         @Projected(\\Person.lastName.localizedUppercase) var lastNameCaps\n         @Projected(\\Person.friends.projectTo.firstName) var firstFriendsName: ProjectedCollection<String>\n     }\n\n     let token = projectedPerson.observe(keyPaths: [\\PersonProjection.name], { changes in\n        // ...\n     })\n     ```\n     - The above notification block fires for changes to the\n     `firstName` property of the Object, but not for any changes\n     made to `lastName` or `friends` list.\n     - If the observed key path were `[\\PersonProjection.firstFriendsName]`, then any insertion,\n     deletion, or modification of the `firstName` of the `friends` list will trigger the block. A change to\n     `someFriend.lastName` would not trigger the block (where `someFriend`\n     is an element contained in `friends`)\n\n     - note: Multiple notification tokens on the same object which filter for\n     separate key paths *do not* filter exclusively. If one key path\n     change is satisfied for one notification token, then all notification\n     token blocks for that object will execute.\n\n     If no queue is given, notifications are delivered via the standard run\n     loop, and so can't be delivered while the run loop is blocked by other\n     activity. If a queue is given, notifications are delivered to that queue\n     instead. When notifications can't be delivered instantly, multiple\n     notifications may be coalesced into a single notification.\n\n     Unlike with `List` and `Results`, there is no \"initial\" callback made after\n     you add a new notification block.\n\n     You must retain the returned token for as long as you want updates to be sent\n     to the block. To stop receiving updates, call `invalidate()` on the token.\n\n     It is safe to capture a strong reference to the observed object within the\n     callback block. There is no retain cycle due to that the callback is\n     retained by the returned token and not by the object itself.\n\n     - warning: This method cannot be called during a write transaction, or when\n                the containing Realm is read-only.\n     - parameter keyPaths: Only properties contained in the key paths array will trigger\n                           the block when they are modified. If `nil`, notifications\n                           will be delivered for any projected property change on the object.\n                           String key paths which do not correspond to a valid projected property\n                           will throw an exception.\n     - parameter queue: The serial dispatch queue to receive notification on. If\n                        `nil`, notifications are delivered to the current thread.\n     - parameter block: The block to call with information about changes to the object.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    public func observe(keyPaths: [PartialKeyPath<Self>],\n                        on queue: DispatchQueue? = nil,\n                        _ block: @escaping (ObjectChange<Self>) -> Void) -> NotificationToken {\n        observe(keyPaths: map(keyPaths: keyPaths), on: queue, block)\n    }\n\n#if compiler(<6)\n    /**\n     Registers a block to be called each time the projection's underlying object changes.\n\n     The block will be asynchronously called on the actor after each write transaction which\n     deletes the underlying object or modifies any of the projected properties of the object,\n     including self-assignments that set a property to its existing value.\n\n     For write transactions performed on different threads or in different\n     processes, the block will be called when the managing Realm is\n     (auto)refreshed to a version including the changes, while for local write\n     transactions it will be called at some point in the future after the write\n     transaction is committed.\n\n     If no key paths are given, the block will be executed on any insertion,\n     modification, or deletion for all projected  properties, including projected properties of\n     any nested, linked objects. If a key path or key paths are provided,\n     then the block will be called for changes which occur only on the\n     provided key paths. For example, if:\n\n     ```swift\n     class Person: Object {\n         @Persisted var firstName: String\n         @Persisted var lastName = \"\"\n         @Persisted public var friends: List<Person>\n     }\n\n     class PersonProjection: Projection<Person> {\n         @Projected(\\Person.firstName) var name\n         @Projected(\\Person.lastName.localizedUppercase) var lastNameCaps\n         @Projected(\\Person.friends.projectTo.firstName) var firstFriendsName: ProjectedCollection<String>\n     }\n\n     let token = projectedPerson.observe(keyPaths: [\"name\"], { changes in\n        // ...\n     })\n     ```\n     - The above notification block fires for changes to the\n     `Person.firstName` property of the the projection's underlying `Person` Object,\n     but not for any changes made to `Person.lastName` or `Person.friends` list.\n     - The notification block fires for changes of `PersonProjection.name` property, but not  for\n     another projection's property change.\n     - If the observed key path were `[\"firstFriendsName\"]`, then any insertion,\n     deletion, or modification of the `firstName` of the `friends` list will trigger the block. A change to\n     `someFriend.lastName` would not trigger the block (where `someFriend`\n     is an element contained in `friends`)\n\n     Notifications are delivered to a function isolated to the given actor, on that\n     actors executor. If the actor is performing blocking work, multiple\n     notifications may be coalesced into a single notification.\n\n     Unlike with Collection notifications, there is no \"Initial\" notification\n     and there is no gap between when this function returns and when changes\n     will first be captured.\n\n     You must retain the returned token for as long as you want updates to be sent\n     to the block. To stop receiving updates, call `invalidate()` on the token.\n\n     - warning: This method cannot be called during a write transaction, or when\n                the containing Realm is read-only.\n     - parameter keyPaths: Only properties contained in the key paths array will trigger\n                           the block when they are modified. If `nil`, notifications\n                           will be delivered for any projected property change on the object.\n                           String key paths which do not correspond to a valid projected property\n                           will throw an exception.\n     - parameter actor: The actor which notifications should be delivered on. The\n                        block is passed this actor as an isolated parameter,\n                        allowing you to access the actor synchronously from within the callback.\n     - parameter block: The block to call with information about changes to the object.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    @_unsafeInheritExecutor\n    public func observe<A: Actor>(\n        keyPaths: [String]? = nil, on actor: A,\n        _ block: @Sendable @escaping (isolated A, ObjectChange<Self>) -> Void\n    ) async -> NotificationToken {\n        await with(self, on: actor) { actor, obj in\n            obj.observe(keyPaths: keyPaths, on: nil) { (change: ObjectChange<Self>) in\n                actor.invokeIsolated(block, change)\n            }\n        }\n    }\n\n    /**\n     Registers a block to be called each time the projection's underlying object changes.\n\n     The block will be asynchronously called on the actor after each write transaction which\n     deletes the underlying object or modifies any of the projected properties of the object,\n     including self-assignments that set a property to its existing value.\n\n     For write transactions performed on different threads or in different\n     processes, the block will be called when the managing Realm is\n     (auto)refreshed to a version including the changes, while for local write\n     transactions it will be called at some point in the future after the write\n     transaction is committed.\n\n     If no key paths are given, the block will be executed on any insertion,\n     modification, or deletion for all projected  properties, including projected properties of\n     any nested, linked objects. If a key path or key paths are provided,\n     then the block will be called for changes which occur only on the\n     provided key paths. For example, if:\n\n     ```swift\n     class Person: Object {\n         @Persisted var firstName: String\n         @Persisted var lastName = \"\"\n         @Persisted public var friends: List<Person>\n     }\n\n     class PersonProjection: Projection<Person> {\n         @Projected(\\Person.firstName) var name\n         @Projected(\\Person.lastName.localizedUppercase) var lastNameCaps\n         @Projected(\\Person.friends.projectTo.firstName) var firstFriendsName: ProjectedCollection<String>\n     }\n\n     let token = projectedPerson.observe(keyPaths: [\\PersonProjection.name], { changes in\n        // ...\n     })\n     ```\n     - The above notification block fires for changes to the\n     `Person.firstName` property of the the projection's underlying `Person` Object,\n     but not for any changes made to `Person.lastName` or `Person.friends` list.\n     - The notification block fires for changes of `PersonProjection.name` property, but not  for\n     another projection's property change.\n     - If the observed key path were `[\\.firstFriendsName]`, then any insertion,\n     deletion, or modification of the `firstName` of the `friends` list will trigger the block. A change to\n     `someFriend.lastName` would not trigger the block (where `someFriend`\n     is an element contained in `friends`)\n\n     Notifications are delivered to a function isolated to the given actor, on that\n     actors executor. If the actor is performing blocking work, multiple\n     notifications may be coalesced into a single notification.\n\n     Unlike with Collection notifications, there is no \"Initial\" notification\n     and there is no gap between when this function returns and when changes\n     will first be captured.\n\n     You must retain the returned token for as long as you want updates to be sent\n     to the block. To stop receiving updates, call `invalidate()` on the token.\n\n     - warning: This method cannot be called during a write transaction, or when\n                the containing Realm is read-only.\n     - parameter keyPaths: Only properties contained in the key paths array will trigger\n                           the block when they are modified. If `nil`, notifications\n                           will be delivered for any projected property change on the object.\n                           String key paths which do not correspond to a valid projected property\n                           will throw an exception.\n     - parameter actor: The actor which notifications should be delivered on. The\n                        block is passed this actor as an isolated parameter,\n                        allowing you to access the actor synchronously from within the callback.\n     - parameter block: The block to call with information about changes to the object.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    @_unsafeInheritExecutor\n    public func observe<A: Actor>(\n        keyPaths: [PartialKeyPath<Self>], on actor: A,\n        _ block: @Sendable @escaping (isolated A, ObjectChange<Self>) -> Void\n    ) async -> NotificationToken {\n        await observe(keyPaths: map(keyPaths: keyPaths), on: actor, block)\n    }\n\n    fileprivate var schema: [ProjectionProperty] {\n        projectionSchemaCache.schema(for: self)\n    }\n\n    private func map(keyPaths: [PartialKeyPath<Self>]) -> [String]? {\n        if keyPaths.isEmpty {\n            return nil\n        }\n\n        let names = NSMutableArray()\n        let root = Root.keyPathRecorder(with: names)\n        let projection = Self(projecting: root)\n        return keyPaths.map {\n            names.removeAllObjects()\n            _ = projection[keyPath: $0]\n            return names.componentsJoined(by: \".\")\n        }\n    }\n#else\n    /**\n     Registers a block to be called each time the projection's underlying object changes.\n\n     The block will be asynchronously called on the actor after each write transaction which\n     deletes the underlying object or modifies any of the projected properties of the object,\n     including self-assignments that set a property to its existing value.\n\n     For write transactions performed on different threads or in different\n     processes, the block will be called when the managing Realm is\n     (auto)refreshed to a version including the changes, while for local write\n     transactions it will be called at some point in the future after the write\n     transaction is committed.\n\n     If no key paths are given, the block will be executed on any insertion,\n     modification, or deletion for all projected  properties, including projected properties of\n     any nested, linked objects. If a key path or key paths are provided,\n     then the block will be called for changes which occur only on the\n     provided key paths. For example, if:\n\n     ```swift\n     class Person: Object {\n         @Persisted var firstName: String\n         @Persisted var lastName = \"\"\n         @Persisted public var friends: List<Person>\n     }\n\n     class PersonProjection: Projection<Person> {\n         @Projected(\\Person.firstName) var name\n         @Projected(\\Person.lastName.localizedUppercase) var lastNameCaps\n         @Projected(\\Person.friends.projectTo.firstName) var firstFriendsName: ProjectedCollection<String>\n     }\n\n     let token = projectedPerson.observe(keyPaths: [\"name\"], { changes in\n        // ...\n     })\n     ```\n     - The above notification block fires for changes to the\n     `Person.firstName` property of the the projection's underlying `Person` Object,\n     but not for any changes made to `Person.lastName` or `Person.friends` list.\n     - The notification block fires for changes of `PersonProjection.name` property, but not  for\n     another projection's property change.\n     - If the observed key path were `[\"firstFriendsName\"]`, then any insertion,\n     deletion, or modification of the `firstName` of the `friends` list will trigger the block. A change to\n     `someFriend.lastName` would not trigger the block (where `someFriend`\n     is an element contained in `friends`)\n\n     Notifications are delivered to a function isolated to the given actor, on that\n     actors executor. If the actor is performing blocking work, multiple\n     notifications may be coalesced into a single notification.\n\n     Unlike with Collection notifications, there is no \"Initial\" notification\n     and there is no gap between when this function returns and when changes\n     will first be captured.\n\n     You must retain the returned token for as long as you want updates to be sent\n     to the block. To stop receiving updates, call `invalidate()` on the token.\n\n     - warning: This method cannot be called during a write transaction, or when\n                the containing Realm is read-only.\n     - parameter keyPaths: Only properties contained in the key paths array will trigger\n                           the block when they are modified. If `nil`, notifications\n                           will be delivered for any projected property change on the object.\n                           String key paths which do not correspond to a valid projected property\n                           will throw an exception.\n     - parameter actor: The actor which notifications should be delivered on. The\n                        block is passed this actor as an isolated parameter,\n                        allowing you to access the actor synchronously from within the callback.\n     - parameter block: The block to call with information about changes to the object.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    public func observe<A: Actor>(\n        keyPaths: [String]? = nil, on actor: A,\n        _isolation: isolated (any Actor)? = #isolation,\n        _ block: @Sendable @escaping (isolated A, ObjectChange<Self>) -> Void\n    ) async -> NotificationToken {\n        await with(self, on: actor) { actor, obj in\n            obj.observe(keyPaths: keyPaths, on: nil) { (change: ObjectChange<Self>) in\n                actor.invokeIsolated(block, change)\n            }\n        }\n    }\n\n    /**\n     Registers a block to be called each time the projection's underlying object changes.\n\n     The block will be asynchronously called on the actor after each write transaction which\n     deletes the underlying object or modifies any of the projected properties of the object,\n     including self-assignments that set a property to its existing value.\n\n     For write transactions performed on different threads or in different\n     processes, the block will be called when the managing Realm is\n     (auto)refreshed to a version including the changes, while for local write\n     transactions it will be called at some point in the future after the write\n     transaction is committed.\n\n     If no key paths are given, the block will be executed on any insertion,\n     modification, or deletion for all projected  properties, including projected properties of\n     any nested, linked objects. If a key path or key paths are provided,\n     then the block will be called for changes which occur only on the\n     provided key paths. For example, if:\n\n     ```swift\n     class Person: Object {\n         @Persisted var firstName: String\n         @Persisted var lastName = \"\"\n         @Persisted public var friends: List<Person>\n     }\n\n     class PersonProjection: Projection<Person> {\n         @Projected(\\Person.firstName) var name\n         @Projected(\\Person.lastName.localizedUppercase) var lastNameCaps\n         @Projected(\\Person.friends.projectTo.firstName) var firstFriendsName: ProjectedCollection<String>\n     }\n\n     let token = projectedPerson.observe(keyPaths: [\\PersonProjection.name], { changes in\n        // ...\n     })\n     ```\n     - The above notification block fires for changes to the\n     `Person.firstName` property of the the projection's underlying `Person` Object,\n     but not for any changes made to `Person.lastName` or `Person.friends` list.\n     - The notification block fires for changes of `PersonProjection.name` property, but not  for\n     another projection's property change.\n     - If the observed key path were `[\\.firstFriendsName]`, then any insertion,\n     deletion, or modification of the `firstName` of the `friends` list will trigger the block. A change to\n     `someFriend.lastName` would not trigger the block (where `someFriend`\n     is an element contained in `friends`)\n\n     Notifications are delivered to a function isolated to the given actor, on that\n     actors executor. If the actor is performing blocking work, multiple\n     notifications may be coalesced into a single notification.\n\n     Unlike with Collection notifications, there is no \"Initial\" notification\n     and there is no gap between when this function returns and when changes\n     will first be captured.\n\n     You must retain the returned token for as long as you want updates to be sent\n     to the block. To stop receiving updates, call `invalidate()` on the token.\n\n     - warning: This method cannot be called during a write transaction, or when\n                the containing Realm is read-only.\n     - parameter keyPaths: Only properties contained in the key paths array will trigger\n                           the block when they are modified. If `nil`, notifications\n                           will be delivered for any projected property change on the object.\n                           String key paths which do not correspond to a valid projected property\n                           will throw an exception.\n     - parameter actor: The actor which notifications should be delivered on. The\n                        block is passed this actor as an isolated parameter,\n                        allowing you to access the actor synchronously from within the callback.\n     - parameter block: The block to call with information about changes to the object.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    public func observe<A: Actor>(\n        keyPaths: [PartialKeyPath<Self>], on actor: A,\n        _isolation: isolated (any Actor)? = #isolation,\n        _ block: @Sendable @escaping (isolated A, ObjectChange<Self>) -> Void\n    ) async -> NotificationToken {\n        await observe(keyPaths: map(keyPaths: keyPaths), on: actor, block)\n    }\n\n    fileprivate var schema: [ProjectionProperty] {\n        projectionSchemaCache.schema(for: self)\n    }\n\n    private func map(keyPaths: [PartialKeyPath<Self>]) -> [String]? {\n        if keyPaths.isEmpty {\n            return nil\n        }\n\n        let names = NSMutableArray()\n        let root = Root.keyPathRecorder(with: names)\n        let projection = Self(projecting: root)\n        return keyPaths.map {\n            names.removeAllObjects()\n            _ = projection[keyPath: $0]\n            return names.componentsJoined(by: \".\")\n        }\n    }\n#endif\n}\n/**\n Information about a specific property which changed in an `Object` change notification.\n */\n@frozen public struct ProjectedPropertyChange {\n    /**\n     The name of the property which changed.\n    */\n    public let name: String\n\n    /**\n     Value of the property before the change occurred. This is not supplied if\n     the change happened on the same thread as the notification and for `List`\n     properties.\n\n     For object properties this will give the object which was previously\n     linked to, but that object will have its new values and not the values it\n     had before the changes. This means that `previousValue` may be a deleted\n     object, and you will need to check `isInvalidated` before accessing any\n     of its properties.\n    */\n    public let oldValue: Any?\n\n    /**\n     The value of the property after the change occurred. This is not supplied\n     for `List` properties and will always be nil.\n    */\n    public let newValue: Any?\n}\n\n// MARK: Notifications\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\npublic extension Projection {\n    /// :nodoc:\n    func addObserver(_ observer: NSObject,\n                     forKeyPath keyPath: String,\n                     options: NSKeyValueObservingOptions = [],\n                     context: UnsafeMutableRawPointer?) {\n        rootObject.addObserver(observer, forKeyPath: keyPath, options: options, context: context)\n    }\n\n    /// :nodoc:\n    func removeObserver(_ observer: NSObject,\n                        forKeyPath keyPath: String,\n                        context: UnsafeMutableRawPointer?) {\n        rootObject.removeObserver(observer, forKeyPath: keyPath, context: context)\n    }\n\n    /// :nodoc:\n    func removeObserver(_ observer: NSObject, forKeyPath keyPath: String) {\n        rootObject.removeObserver(observer, forKeyPath: keyPath)\n    }\n}\n\n// MARK: ThreadConfined\nextension Projection: ThreadConfined where Root: ThreadConfined {\n    /**\n     The Realm which manages the object, or `nil` if the object is unmanaged.\n     Note: Projection can be instantiated for the managed objects only therefore realm will never be nil.\n     Unmanaged objects are not confined to a thread and cannot be passed to methods expecting a\n     `ThreadConfined` object.\n     */\n    public var realm: Realm? {\n        rootObject.realm\n    }\n\n    /// Indicates if the object can no longer be accessed because it is now invalid.\n    public var isInvalidated: Bool {\n        return rootObject.isInvalidated\n    }\n    /**\n     Indicates if the object is frozen.\n     Frozen objects are not confined to their source thread. Forming a `ThreadSafeReference` to a\n     frozen object is allowed, but is unlikely to be useful.\n     */\n    public var isFrozen: Bool {\n        return realm?.isFrozen ?? false\n    }\n    /**\n     Returns a frozen snapshot of this object.\n     Unlike normal Realm live objects, the frozen copy can be read from any thread, and the values\n     read will never update to reflect new writes to the Realm. Frozen collections can be queried\n     like any other Realm collection. Frozen objects cannot be mutated, and cannot be observed for\n     change notifications.\n     Unmanaged Realm objects cannot be frozen.\n     - warning: Holding onto a frozen object for an extended period while performing write\n     transaction on the Realm may result in the Realm file growing to large sizes. See\n     `Realm.Configuration.maximumNumberOfActiveVersions` for more information.\n     */\n    public func freeze() -> Self {\n        let frozenObject = rootObject.freeze()\n        return Self(projecting: frozenObject)\n    }\n    /**\n     Returns a live (mutable) reference of this object.\n     Will return self if called on an already live object.\n     */\n    public func thaw() -> Self? {\n        if let thawedObject = rootObject.thaw() {\n            return Self(projecting: thawedObject)\n        }\n        return nil\n    }\n}\n\n// MARK: - RealmSubscribable\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension ProjectionObservable {\n    /// :nodoc:\n    public func _observe<S>(_ keyPaths: [String]?, on queue: DispatchQueue?, _ subscriber: S) -> NotificationToken where S: Subscriber, S.Input == Self {\n        return observe(keyPaths: keyPaths ?? [], on: queue) { (change: ObjectChange<S.Input>) in\n            switch change {\n            case .change(let projection, _):\n                _ = subscriber.receive(projection)\n            case .deleted:\n                subscriber.receive(completion: .finished)\n            case .error(let error):\n                fatalError(\"Unexpected error \\(error)\")\n            }\n        }\n    }\n\n    /// :nodoc:\n    public func _observe<S>(_ keyPaths: [String]?, _ subscriber: S) -> NotificationToken where S: Subscriber, S.Input == Void {\n        return observe(keyPaths: [PartialKeyPath<Self>](), { _ in _ = subscriber.receive() })\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension Projection: ObservableObject, RealmSubscribable where Root: ThreadConfined {\n    /// A publisher that emits Void each time the projection changes.\n    ///\n    /// Despite the name, this actually emits *after* the projection has changed.\n    public var objectWillChange: RealmPublishers.WillChange<Projection> {\n        RealmPublishers.WillChange(self)\n    }\n}\n\n// MARK: Implementation\n\nprivate struct ProjectionProperty: @unchecked Sendable {\n    let projectedKeyPath: AnyKeyPath\n    let originPropertyKeyPathString: String\n    let label: String\n}\n\n// A subset of OSAllocatedUnfairLock, which requires iOS 16\ninternal final class AllocatedUnfairLock<Value>: @unchecked Sendable {\n    private var value: Value\n    private let impl: os_unfair_lock_t = .allocate(capacity: 1)\n\n    init(_ value: Value) {\n        impl.initialize(to: os_unfair_lock())\n        self.value = value\n    }\n\n    func withLock<R>(_ body: (inout Value) -> R) -> R {\n        os_unfair_lock_lock(impl)\n        let ret = body(&value)\n        os_unfair_lock_unlock(impl)\n        return ret\n    }\n}\n\n// A property wrapper which unsafely disables concurrency checking for a property\n// This is required when a property is guarded by something which concurrency\n// checking doesn't understand (i.e. a lock instead of an actor)\n@usableFromInline\n@propertyWrapper\ninternal struct Unchecked<Wrapped>: @unchecked Sendable {\n    public var wrappedValue: Wrapped\n    public init(wrappedValue: Wrapped) {\n        self.wrappedValue = wrappedValue\n    }\n    public init(_ wrappedValue: Wrapped) {\n        self.wrappedValue = wrappedValue\n    }\n}\n\nprivate final class ProjectionSchemaCache: @unchecked Sendable {\n    private static let schema = AllocatedUnfairLock([ObjectIdentifier: [ProjectionProperty]]())\n\n    fileprivate func schema<T: ProjectionObservable>(for obj: T) -> [ProjectionProperty] {\n        let identifier = ObjectIdentifier(type(of: obj))\n        if let schema = Self.schema.withLock({ $0[identifier] }) {\n            return schema\n        }\n\n        var properties = [ProjectionProperty]()\n        for child in Mirror(reflecting: obj).children {\n            guard let label = child.label?.dropFirst() else { continue }\n            guard let projected = child.value as? AnyProjected else { continue }\n\n            let originPropertyLabel = _name(for: projected.projectedKeyPath as! PartialKeyPath<T.Root>)\n            guard !originPropertyLabel.isEmpty else {\n                throwRealmException(\"@Projected property '\\(label)' must be a part of Realm object\")\n            }\n            properties.append(.init(projectedKeyPath: projected.projectedKeyPath,\n                                    originPropertyKeyPathString: originPropertyLabel,\n                                    label: String(label)))\n        }\n        let p = properties\n        Self.schema.withLock {\n            // This might overwrite a schema generated by a different thread\n            // if we happened to do the initialization on multiple threads at\n            // once, but if so that's fine.\n            $0[identifier] = p\n        }\n        return properties\n    }\n}\n\nprivate let projectionSchemaCache = ProjectionSchemaCache()\n"
  },
  {
    "path": "RealmSwift/Property.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\n\n/**\n `Property` instances represent properties managed by a Realm in the context of an object schema. Such properties may be\n persisted to a Realm file or computed from other data in the Realm.\n\n When using Realm, property instances allow performing migrations and introspecting the database's schema.\n\n Property instances map to columns in the core database.\n */\n@frozen public struct Property: CustomStringConvertible {\n    // MARK: Properties\n\n    internal let rlmProperty: RLMProperty\n\n    /// The name of the property.\n    public var name: String { return rlmProperty.name }\n\n    /// The column name of the property in the database. This will be the same as the property name when no\n    /// private name is provided on the property mapping.\n    public var columnName: String { return rlmProperty.columnName ?? name }\n\n    /// The type of the property.\n    public var type: PropertyType { return rlmProperty.type }\n\n    /// Indicates whether this property is an array of the property type.\n    public var isArray: Bool { return rlmProperty.array }\n\n    /// Indicates whether this property is a set of the property type.\n    public var isSet: Bool { return rlmProperty.set }\n\n    /// Indicates whether this property is a dictionary of the property type.\n    public var isMap: Bool { return rlmProperty.dictionary }\n\n    /// Indicates whether this property is indexed.\n    public var isIndexed: Bool { return rlmProperty.indexed }\n\n    /// Indicates whether this property is optional. (Note that certain numeric types must be wrapped in a\n    /// `RealmOptional` instance in order to be declared as optional.)\n    public var isOptional: Bool { return rlmProperty.optional }\n\n    /// For `Object` and `List` properties, the name of the class of object stored in the property.\n    public var objectClassName: String? { return rlmProperty.objectClassName }\n\n    /// A human-readable description of the property object.\n    public var description: String { return rlmProperty.description }\n\n    // MARK: Initializers\n\n    internal init(_ rlmProperty: RLMProperty) {\n        self.rlmProperty = rlmProperty\n    }\n}\n\n// MARK: Equatable\n\nextension Property: Equatable {\n    /// Returns whether the two properties are equal.\n    public static func == (lhs: Property, rhs: Property) -> Bool {\n        return lhs.rlmProperty.isEqual(to: rhs.rlmProperty)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Query.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\nimport Realm.Private\n\n/// Enum representing an option for `String` queries.\npublic struct StringOptions: OptionSet, Sendable {\n    /// :doc:\n    public let rawValue: Int8\n    /// :doc:\n    public init(rawValue: Int8) {\n        self.rawValue = rawValue\n    }\n    /// A case-insensitive search.\n    public static let caseInsensitive = StringOptions(rawValue: 1)\n    /// Query ignores diacritic marks.\n    public static let diacriticInsensitive = StringOptions(rawValue: 2)\n}\n\n/**\n `Query` is a class used to create type-safe query predicates.\n\n With `Query` you are given the ability to create Swift style query expression that will then\n be constructed into an `NSPredicate`. The `Query` class should not be instantiated directly\n and should be only used as a parameter within a closure that takes a query expression as an argument.\n Example:\n ```swift\n public func where(_ query: ((Query<Element>) -> Query<Element>)) -> Results<Element>\n ```\n\n You would then use the above function like so:\n ```swift\n let results = realm.objects(Person.self).query {\n    $0.name == \"Foo\" || $0.name == \"Bar\" && $0.age >= 21\n }\n ```\n\n ## Supported predicate types\n\n ### Prefix\n - NOT `!`\n ```swift\n let results = realm.objects(Person.self).query {\n    !$0.dogsName.contains(\"Fido\") || !$0.name.contains(\"Foo\")\n }\n ```\n\n ### Comparisions\n - Equals `==`\n - Not Equals `!=`\n - Greater Than `>`\n - Less Than `<`\n - Greater Than or Equal `>=`\n - Less Than or Equal `<=`\n - Between `.contains(_ range:)`\n\n ### Collections\n - IN `.contains(_ element:)`\n - Between `.contains(_ range:)`\n\n ### Map\n - @allKeys `.keys`\n - @allValues `.values`\n\n ### Compound\n - AND `&&`\n - OR `||`\n\n ### Collection Aggregation\n - @avg `.avg`\n - @min `.min`\n - @max `.max`\n - @sum `.sum`\n - @count `.count`\n ```swift\n let results = realm.objects(Person.self).query {\n    !$0.dogs.age.avg >= 0 || !$0.dogsAgesArray.avg >= 0\n }\n ```\n\n ### Other\n - NOT `!`\n - Subquery `($0.fooList.intCol >= 5).count > n`\n\n */\n@dynamicMemberLookup\npublic struct Query<T> {\n    /// This initaliser should be used from callers who require queries on primitive collections.\n    /// - Parameter isPrimitive: True if performing a query on a primitive collection.\n    internal init(isPrimitive: Bool = false) {\n        if isPrimitive {\n            node = .keyPath([\"self\"], options: [.isCollection])\n        } else {\n            node = .keyPath([], options: [])\n        }\n    }\n\n    private let node: QueryNode\n\n    /**\n     The `Query` struct works by compounding `QueryNode`s together in a tree structure.\n     Each part of a query expression will be represented by one of the below static methods.\n     For example in the simple expression `stringCol == 'Foo'`:\n\n     The first static method that will be called from inside the query\n     closure is `subscript<V>(dynamicMember member: KeyPath<T, V>)`\n     this will extract the `stringCol` keypath. The last static method to be called in this expression is\n     `func == <V>(_ lhs: Query<V>, _ rhs: V)` where the lhs is a `Query` which holds the `QueryNode`\n     keyPath for `stringCol`. The rhs will be expressed as a constant in `QueryNode` and a tree will be built\n     to represent an equals comparison.\n\n     To build the tree we will do:\n     ```\n     Query<Bool>(.comparison(operator: .equal, lhs.node, .constant(rhs), options: []))\n     ```\n     This sets the comparison node as the root node for the expression and the new `Query` struct will be returned.\n\n     When it comes time to build the predicate string with its arguments call `_constructPredicate()`. This will\n     recursively traverse the tree and build the NSPredicate compatible string.\n     */\n    private init(_ node: QueryNode) {\n        self.node = node\n    }\n\n    private func appendKeyPath(_ keyPath: String, options: KeyPathOptions) -> QueryNode {\n        if case let .keyPath(kp, ops) = node {\n            return .keyPath(kp + [keyPath], options: ops.union(options))\n        } else if case .mapSubscript = node {\n            throwRealmException(\"Cannot apply key path to Map subscripts.\")\n        }\n        throwRealmException(\"Cannot apply a keypath to \\(buildPredicate(node))\")\n    }\n\n    private func buildCollectionAggregateKeyPath(_ aggregate: String) -> QueryNode {\n        if case let .keyPath(kp, options) = node {\n            var keyPaths = kp\n            if keyPaths.count > 1 {\n                keyPaths.insert(aggregate, at: 1)\n            } else {\n                keyPaths.append(aggregate)\n            }\n            return .keyPath(keyPaths, options: [options.subtracting(.requiresAny)])\n        }\n        throwRealmException(\"Cannot apply a keypath to \\(buildPredicate(node))\")\n    }\n\n    private func keyPathErasingAnyPrefix(appending keyPath: String? = nil) -> QueryNode {\n        if case let .keyPath(kp, o) = node {\n            if let keyPath = keyPath {\n                return .keyPath(kp + [keyPath], options: [o.subtracting(.requiresAny)])\n            }\n            return .keyPath(kp, options: [o.subtracting(.requiresAny)])\n        }\n        throwRealmException(\"Cannot apply a keypath to \\(buildPredicate(node))\")\n    }\n\n    private func anySubscript(appending key: CollectionSubscript) -> QueryNode {\n        if case .keyPath = node {\n            return .mapAnySubscripts(keyPathErasingAnyPrefix(), keys: [key])\n        } else if case let .mapAnySubscripts(kp, keys) = node {\n            var tmpKeys = keys\n            tmpKeys.append(key)\n            return .mapAnySubscripts(kp, keys: tmpKeys)\n        }\n        throwRealmException(\"Cannot add subscript to \\(buildPredicate(node))\")\n    }\n\n    // MARK: Comparable\n\n    /// :nodoc:\n    public static func == (_ lhs: Query, _ rhs: T) -> Query<Bool> {\n        .init(.comparison(operator: .equal, lhs.node, .constant(rhs), options: []))\n    }\n    /// :nodoc:\n    public static func == (_ lhs: Query, _ rhs: Query) -> Query<Bool> {\n        .init(.comparison(operator: .equal, lhs.node, rhs.node, options: []))\n    }\n    /// :nodoc:\n    public static func != (_ lhs: Query, _ rhs: T) -> Query<Bool> {\n        .init(.comparison(operator: .notEqual, lhs.node, .constant(rhs), options: []))\n    }\n    /// :nodoc:\n    public static func != (_ lhs: Query, _ rhs: Query) -> Query<Bool> {\n        .init(.comparison(operator: .notEqual, lhs.node, rhs.node, options: []))\n    }\n\n    // MARK: In\n\n    /// Checks if the value is present in the collection.\n    public func `in`<U: Sequence>(_ collection: U) -> Query<Bool> where U.Element == T {\n        .init(.comparison(operator: .in, node, .constant(collection), options: []))\n    }\n\n    // MARK: Subscript\n\n    /// :nodoc:\n    public subscript<V>(dynamicMember member: KeyPath<T, V>) -> Query<V> where T: ObjectBase {\n        .init(appendKeyPath(_name(for: member), options: []))\n    }\n    /// :nodoc:\n    public subscript<V: RealmKeyedCollection>(dynamicMember member: KeyPath<T, V>) -> Query<V> where T: ObjectBase {\n        .init(appendKeyPath(_name(for: member), options: [.isCollection, .requiresAny]))\n    }\n    /// :nodoc:\n    public subscript<V: RealmCollectionBase>(dynamicMember member: KeyPath<T, V>) -> Query<V> where T: ObjectBase {\n        .init(appendKeyPath(_name(for: member), options: [.isCollection, .requiresAny]))\n    }\n\n    // MARK: Query Construction\n\n    /// For testing purposes only. Do not use directly.\n    public static func _constructForTesting() -> Query<T> {\n        return Query<T>()\n    }\n\n    /// Constructs an NSPredicate compatible string with its accompanying arguments.\n    /// - Note: This is for internal use only and is exposed for testing purposes.\n    public func _constructPredicate() -> (String, [Any]) {\n        return buildPredicate(node)\n    }\n\n    /// Creates an NSPredicate compatible string.\n    /// - Returns: A tuple containing the predicate string and an array of arguments.\n\n    /// Creates an NSPredicate from the query expression.\n    internal var predicate: NSPredicate {\n        let predicate = _constructPredicate()\n        return NSPredicate(format: predicate.0, argumentArray: predicate.1)\n    }\n}\n\n// MARK: Numerics\nextension Query where T: _HasPersistedType, T.PersistedType: _QueryNumeric {\n    /// :nodoc:\n    public static func > (_ lhs: Query, _ rhs: T) -> Query<Bool> {\n        .init(.comparison(operator: .greaterThan, lhs.node, .constant(rhs), options: []))\n    }\n    /// :nodoc:\n    public static func > (_ lhs: Query, _ rhs: Query) -> Query<Bool> {\n        .init(.comparison(operator: .greaterThan, lhs.node, rhs.node, options: []))\n    }\n    /// :nodoc:\n    public static func >= (_ lhs: Query, _ rhs: T) -> Query<Bool> {\n        .init(.comparison(operator: .greaterThanEqual, lhs.node, .constant(rhs), options: []))\n    }\n    /// :nodoc:\n    public static func >= (_ lhs: Query, _ rhs: Query) -> Query<Bool> {\n        .init(.comparison(operator: .greaterThanEqual, lhs.node, rhs.node, options: []))\n    }\n    /// :nodoc:\n    public static func < (_ lhs: Query, _ rhs: T) -> Query<Bool> {\n        .init(.comparison(operator: .lessThan, lhs.node, .constant(rhs), options: []))\n    }\n    /// :nodoc:\n    public static func < (_ lhs: Query, _ rhs: Query) -> Query<Bool> {\n        .init(.comparison(operator: .lessThan, lhs.node, rhs.node, options: []))\n    }\n    /// :nodoc:\n    public static func <= (_ lhs: Query, _ rhs: T) -> Query<Bool> {\n        .init(.comparison(operator: .lessThanEqual, lhs.node, .constant(rhs), options: []))\n    }\n    /// :nodoc:\n    public static func <= (_ lhs: Query, _ rhs: Query) -> Query<Bool> {\n        .init(.comparison(operator: .lessThanEqual, lhs.node, rhs.node, options: []))\n    }\n}\n\n// MARK: Compound\n\nextension Query where T == Bool {\n    /// :nodoc:\n    public static prefix func ! (_ query: Query) -> Query<Bool> {\n        .init(.not(query.node))\n    }\n\n    /// :nodoc:\n    public static func && (_ lhs: Query, _ rhs: Query) -> Query<Bool> {\n        .init(.comparison(operator: .and, lhs.node, rhs.node, options: []))\n    }\n    /// :nodoc:\n    public static func || (_ lhs: Query, _ rhs: Query) -> Query<Bool> {\n        .init(.comparison(operator: .or, lhs.node, rhs.node, options: []))\n    }\n}\n\n// MARK: Mixed\n\nextension Query where T == AnyRealmValue {\n    /// :nodoc:\n    public subscript(position: Int) -> Query<AnyRealmValue> {\n        .init(anySubscript(appending: .index(position)))\n\n    }\n    /// :nodoc:\n    public subscript(key: String) -> Query<AnyRealmValue> {\n        .init(anySubscript(appending: .key(key)))\n    }\n    /// Query all indexes or keys in a mixed nested collecttion.\n    public var any: Query<AnyRealmValue> {\n        .init(anySubscript(appending: .all))\n    }\n}\n\n// MARK: OptionalProtocol\n\nextension Query where T: OptionalProtocol {\n    /// :nodoc:\n    public subscript<V>(dynamicMember member: KeyPath<T.Wrapped, V>) -> Query<V> where T.Wrapped: ObjectBase {\n        .init(appendKeyPath(_name(for: member), options: []))\n    }\n}\n\n// MARK: RealmCollection\n\nextension Query where T: RealmCollection {\n    /// :nodoc:\n    public subscript<V>(dynamicMember member: KeyPath<T.Element, V>) -> Query<V> where T.Element: ObjectBase {\n        .init(appendKeyPath(_name(for: member), options: []))\n    }\n\n    /// Query the count of the objects in the collection.\n    public var count: Query<Int> {\n        .init(keyPathErasingAnyPrefix(appending: \"@count\"))\n    }\n}\n\nextension Query where T: RealmCollection {\n    /// Checks if an element exists in this collection.\n    public func contains(_ value: T.Element) -> Query<Bool> {\n        .init(.comparison(operator: .in, .constant(value), keyPathErasingAnyPrefix(), options: []))\n    }\n\n    /// Checks if any elements contained in the given array are present in the collection.\n    public func containsAny<U: Sequence>(in collection: U) -> Query<Bool> where U.Element == T.Element {\n        .init(.comparison(operator: .in, node, .constant(collection), options: []))\n    }\n}\n\nextension Query where T: RealmCollection, T.Element: Comparable {\n    /// Checks for all elements in this collection that are within a given range.\n    public func contains(_ range: Range<T.Element>) -> Query<Bool> {\n        .init(.comparison(operator: .and,\n                          .comparison(operator: .greaterThanEqual, keyPathErasingAnyPrefix(appending: \"@min\"), .constant(range.lowerBound), options: []),\n                          .comparison(operator: .lessThan, keyPathErasingAnyPrefix(appending: \"@max\"), .constant(range.upperBound), options: []), options: []))\n    }\n\n    /// Checks for all elements in this collection that are within a given range.\n    public func contains(_ range: ClosedRange<T.Element>) -> Query<Bool> {\n        .init(.comparison(operator: .and,\n                          .comparison(operator: .greaterThanEqual, keyPathErasingAnyPrefix(appending: \"@min\"), .constant(range.lowerBound), options: []),\n                          .comparison(operator: .lessThanEqual, keyPathErasingAnyPrefix(appending: \"@max\"), .constant(range.upperBound), options: []), options: []))\n    }\n}\n\nextension Query where T: RealmCollection, T.Element: OptionalProtocol, T.Element.Wrapped: Comparable {\n    /// Checks for all elements in this collection that are within a given range.\n    public func contains(_ range: Range<T.Element.Wrapped>) -> Query<Bool> {\n        .init(.comparison(operator: .and,\n                          .comparison(operator: .greaterThanEqual, keyPathErasingAnyPrefix(appending: \"@min\"), .constant(range.lowerBound), options: []),\n                          .comparison(operator: .lessThan, keyPathErasingAnyPrefix(appending: \"@max\"), .constant(range.upperBound), options: []), options: []))\n    }\n\n    /// Checks for all elements in this collection that are within a given range.\n    public func contains(_ range: ClosedRange<T.Element.Wrapped>) -> Query<Bool> {\n        .init(.comparison(operator: .and,\n                          .comparison(operator: .greaterThanEqual, keyPathErasingAnyPrefix(appending: \"@min\"), .constant(range.lowerBound), options: []),\n                          .comparison(operator: .lessThanEqual, keyPathErasingAnyPrefix(appending: \"@max\"), .constant(range.upperBound), options: []), options: []))\n    }\n}\n\nextension Query where T: RealmCollection {\n    /// :nodoc:\n    public static func == (_ lhs: Query<T>, _ rhs: T.Element) -> Query<Bool> {\n        .init(.comparison(operator: .equal, lhs.node, .constant(rhs), options: []))\n    }\n\n    /// :nodoc:\n    public static func != (_ lhs: Query<T>, _ rhs: T.Element) -> Query<Bool> {\n        .init(.comparison(operator: .notEqual, lhs.node, .constant(rhs), options: []))\n    }\n}\n\nextension Query where T: RealmCollection, T.Element.PersistedType: _QueryNumeric {\n    /// :nodoc:\n    public static func > (_ lhs: Query<T>, _ rhs: T.Element) -> Query<Bool> {\n        .init(.comparison(operator: .greaterThan, lhs.node, .constant(rhs), options: []))\n    }\n\n    /// :nodoc:\n    public static func >= (_ lhs: Query<T>, _ rhs: T.Element) -> Query<Bool> {\n        .init(.comparison(operator: .greaterThanEqual, lhs.node, .constant(rhs), options: []))\n    }\n\n    /// :nodoc:\n    public static func < (_ lhs: Query<T>, _ rhs: T.Element) -> Query<Bool> {\n        .init(.comparison(operator: .lessThan, lhs.node, .constant(rhs), options: []))\n    }\n\n    /// :nodoc:\n    public static func <= (_ lhs: Query<T>, _ rhs: T.Element) -> Query<Bool> {\n        .init(.comparison(operator: .lessThanEqual, lhs.node, .constant(rhs), options: []))\n    }\n\n    /// Returns the minimum value in the collection.\n    public var min: Query<T.Element> {\n        .init(keyPathErasingAnyPrefix(appending: \"@min\"))\n    }\n\n    /// Returns the maximum value in the collection.\n    public var max: Query<T.Element> {\n        .init(keyPathErasingAnyPrefix(appending: \"@max\"))\n    }\n\n    /// Returns the average in the collection.\n    public var avg: Query<T.Element> {\n        .init(keyPathErasingAnyPrefix(appending: \"@avg\"))\n    }\n\n    /// Returns the sum of all the values in the collection.\n    public var sum: Query<T.Element> {\n        .init(keyPathErasingAnyPrefix(appending: \"@sum\"))\n    }\n}\n\n// MARK: RealmKeyedCollection\n\nextension Query where T: RealmKeyedCollection {\n    /// Checks if any elements contained in the given array are present in the map's values.\n    public func containsAny<U: Sequence>(in collection: U) -> Query<Bool> where U.Element == T.Value {\n        .init(.comparison(operator: .in, node, .constant(collection), options: []))\n    }\n\n    /// Checks if an element exists in this collection.\n    public func contains(_ value: T.Value) -> Query<Bool> {\n        .init(.comparison(operator: .in, .constant(value), keyPathErasingAnyPrefix(), options: []))\n    }\n    /// Allows a query over all values in the Map.\n    public var values: Query<T.Value> {\n        .init(appendKeyPath(\"@allValues\", options: []))\n    }\n    /// :nodoc:\n    public subscript(member: T.Key) -> Query<T.Value> {\n        .init(.mapSubscript(keyPathErasingAnyPrefix(), key: member))\n    }\n}\n\nextension Query where T: RealmKeyedCollection, T.Key == String {\n    /// Allows a query over all keys in the `Map`.\n    public var keys: Query<String> {\n        .init(appendKeyPath(\"@allKeys\", options: []))\n    }\n}\n\nextension Query where T: RealmKeyedCollection, T.Value: Comparable {\n    /// Checks for all elements in this collection that are within a given range.\n    public func contains(_ range: Range<T.Value>) -> Query<Bool> {\n        .init(.comparison(operator: .and,\n                          .comparison(operator: .greaterThanEqual, keyPathErasingAnyPrefix(appending: \"@min\"), .constant(range.lowerBound), options: []),\n                          .comparison(operator: .lessThan, keyPathErasingAnyPrefix(appending: \"@max\"), .constant(range.upperBound), options: []), options: []))\n    }\n\n    /// Checks for all elements in this collection that are within a given range.\n    public func contains(_ range: ClosedRange<T.Value>) -> Query<Bool> {\n        .init(.comparison(operator: .and,\n                          .comparison(operator: .greaterThanEqual, keyPathErasingAnyPrefix(appending: \"@min\"), .constant(range.lowerBound), options: []),\n                          .comparison(operator: .lessThanEqual, keyPathErasingAnyPrefix(appending: \"@max\"), .constant(range.upperBound), options: []), options: []))\n    }\n}\n\nextension Query where T: RealmKeyedCollection, T.Value: OptionalProtocol, T.Value.Wrapped: Comparable {\n    /// Checks for all elements in this collection that are within a given range.\n    public func contains(_ range: Range<T.Value.Wrapped>) -> Query<Bool> {\n        .init(.comparison(operator: .and,\n                          .comparison(operator: .greaterThanEqual, keyPathErasingAnyPrefix(appending: \"@min\"), .constant(range.lowerBound), options: []),\n                          .comparison(operator: .lessThan, keyPathErasingAnyPrefix(appending: \"@max\"), .constant(range.upperBound), options: []), options: []))\n    }\n\n    /// Checks for all elements in this collection that are within a given range.\n    public func contains(_ range: ClosedRange<T.Value.Wrapped>) -> Query<Bool> {\n        .init(.comparison(operator: .and,\n                          .comparison(operator: .greaterThanEqual, keyPathErasingAnyPrefix(appending: \"@min\"), .constant(range.lowerBound), options: []),\n                          .comparison(operator: .lessThanEqual, keyPathErasingAnyPrefix(appending: \"@max\"), .constant(range.upperBound), options: []), options: []))\n    }\n}\n\nextension Query where T: RealmKeyedCollection, T.Value.PersistedType: _QueryNumeric {\n    /// Returns the minimum value in the keyed collection.\n    public var min: Query<T.Value> {\n        .init(keyPathErasingAnyPrefix(appending: \"@min\"))\n    }\n\n    /// Returns the maximum value in the keyed collection.\n    public var max: Query<T.Value> {\n        .init(keyPathErasingAnyPrefix(appending: \"@max\"))\n    }\n\n    /// Returns the average in the keyed collection.\n    public var avg: Query<T.Value> {\n        .init(keyPathErasingAnyPrefix(appending: \"@avg\"))\n    }\n\n    /// Returns the sum of all the values in the keyed collection.\n    public var sum: Query<T.Value> {\n        .init(keyPathErasingAnyPrefix(appending: \"@sum\"))\n    }\n}\n\nextension Query where T: RealmKeyedCollection {\n    /// Returns the count of all the values in the keyed collection.\n    public var count: Query<Int> {\n        .init(keyPathErasingAnyPrefix(appending: \"@count\"))\n    }\n}\n\n// MARK: - PersistableEnum\n\nextension Query where T: PersistableEnum, T.RawValue: _RealmSchemaDiscoverable {\n    /// Query on the rawValue of the Enum rather than the Enum itself.\n    ///\n    /// This can be used to write queries which can be expressed on the\n    /// RawValue but not the enum. For example, this lets you query for\n    /// `.starts(with:)` on a string enum where the prefix is not a member of\n    /// the enum.\n    public var rawValue: Query<T.RawValue> {\n        .init(node)\n    }\n}\nextension Query where T: OptionalProtocol, T.Wrapped: PersistableEnum, T.Wrapped.RawValue: _RealmSchemaDiscoverable {\n    /// Query on the rawValue of the Enum rather than the Enum itself.\n    ///\n    /// This can be used to write queries which can be expressed on the\n    /// RawValue but not the enum. For example, this lets you query for\n    /// `.starts(with:)` on a string enum where the prefix is not a member of\n    /// the enum.\n    public var rawValue: Query<T.Wrapped.RawValue?> {\n        .init(node)\n    }\n}\n\n// The actual collection type returned in these doesn't matter because it's\n// only used to constrain the set of operations available, and the collections\n// all have the same operations.\nextension Query where T: RealmCollection, T.Element: PersistableEnum, T.Element.RawValue: RealmCollectionValue {\n    /// Query on the rawValue of the Enums in the collection rather than the Enums themselves.\n    ///\n    /// This can be used to write queries which can be expressed on the\n    /// RawValue but not the enum. For example, this lets you query for\n    /// `.starts(with:)` on a string enum where the prefix is not a member of\n    /// the enum.\n    public var rawValue: Query<AnyRealmCollection<T.Element.RawValue>> {\n        .init(node)\n    }\n}\nextension Query where T: RealmKeyedCollection, T.Value: PersistableEnum, T.Value.RawValue: RealmCollectionValue {\n    /// Query on the rawValue of the Enums in the collection rather than the Enums themselves.\n    ///\n    /// This can be used to write queries which can be expressed on the\n    /// RawValue but not the enum. For example, this lets you query for\n    /// `.starts(with:)` on a string enum where the prefix is not a member of\n    /// the enum.\n    public var rawValue: Query<Map<T.Key, T.Value.RawValue>> {\n        .init(node)\n    }\n}\nextension Query where T: RealmCollection, T.Element: OptionalProtocol, T.Element.Wrapped: PersistableEnum, T.Element.Wrapped.RawValue: _RealmCollectionValueInsideOptional {\n    /// Query on the rawValue of the Enums in the collection rather than the Enums themselves.\n    ///\n    /// This can be used to write queries which can be expressed on the\n    /// RawValue but not the enum. For example, this lets you query for\n    /// `.starts(with:)` on a string enum where the prefix is not a member of\n    /// the enum.\n    public var rawValue: Query<AnyRealmCollection<T.Element.Wrapped.RawValue?>> {\n        .init(node)\n    }\n}\nextension Query where T: RealmKeyedCollection, T.Value: OptionalProtocol, T.Value.Wrapped: PersistableEnum, T.Value.Wrapped.RawValue: _RealmCollectionValueInsideOptional {\n    /// Query on the rawValue of the Enums in the collection rather than the Enums themselves.\n    ///\n    /// This can be used to write queries which can be expressed on the\n    /// RawValue but not the enum. For example, this lets you query for\n    /// `.starts(with:)` on a string enum where the prefix is not a member of\n    /// the enum.\n    public var rawValue: Query<Map<T.Key, T.Value.Wrapped.RawValue?>> {\n        .init(node)\n    }\n}\n\n// MARK: - CustomPersistable\n\nextension Query where T: _HasPersistedType {\n    /// Query on the persistableValue of the value rather than the value itself.\n    ///\n    /// This can be used to write queries which can be expressed on the\n    /// persisted type but not on the type itself, such as range queries\n    /// on the persistable value or to query for values which can't be\n    /// converted to the mapped type.\n    ///\n    /// For types which don't conform to PersistableEnum, CustomPersistable or\n    /// FailableCustomPersistable this doesn't do anything useful.\n    public var persistableValue: Query<T.PersistedType> {\n        .init(node)\n    }\n}\n\n// The actual collection type returned in these doesn't matter because it's\n// only used to constrain the set of operations available, and the collections\n// all have the same operations.\nextension Query where T: RealmCollection {\n    /// Query on the persistableValue of the values in the collection rather\n    /// than the values themselves.\n    ///\n    /// This can be used to write queries which can be expressed on the\n    /// persisted type but not on the type itself, such as range queries\n    /// on the persistable value or to query for values which can't be\n    /// converted to the mapped type.\n    ///\n    /// For types which don't conform to PersistableEnum, CustomPersistable or\n    /// FailableCustomPersistable this doesn't do anything useful.\n    public var persistableValue: Query<AnyRealmCollection<T.Element.PersistedType>> {\n        .init(node)\n    }\n}\nextension Query where T: RealmKeyedCollection {\n    /// Query on the persistableValue of the values in the collection rather\n    /// than the values themselves.\n    ///\n    /// This can be used to write queries which can be expressed on the\n    /// persisted type but not on the type itself, such as range queries\n    /// on the persistable value or to query for values which can't be\n    /// converted to the mapped type.\n    ///\n    /// For types which don't conform to PersistableEnum, CustomPersistable or\n    /// FailableCustomPersistable this doesn't do anything useful.\n    public var persistableValue: Query<Map<T.Key, T.Value.PersistedType>> {\n        .init(node)\n    }\n}\n\n// MARK: _QueryNumeric\n\nextension Query where T: Comparable {\n    /// Checks for all elements in this collection that are within a given range.\n    public func contains(_ range: Range<T>) -> Query<Bool> {\n        .init(.comparison(operator: .and,\n                          .comparison(operator: .greaterThanEqual, node, .constant(range.lowerBound), options: []),\n                          .comparison(operator: .lessThan, node, .constant(range.upperBound), options: []), options: []))\n    }\n\n    /// Checks for all elements in this collection that are within a given range.\n    public func contains(_ range: ClosedRange<T>) -> Query<Bool> {\n        .init(.between(node,\n                       lowerBound: .constant(range.lowerBound),\n                       upperBound: .constant(range.upperBound)))\n    }\n}\n\n// MARK: _QueryString\n\nextension Query where T: _HasPersistedType, T.PersistedType: _QueryString {\n    /**\n     Checks for all elements in this collection that equal the given value.\n     `?` and `*` are allowed as wildcard characters, where `?` matches 1 character and `*` matches 0 or more characters.\n     - parameter value: value used.\n     - parameter caseInsensitive: `true` if it is a case-insensitive search.\n     */\n    public func like(_ value: T, caseInsensitive: Bool = false) -> Query<Bool> {\n        .init(.comparison(operator: .like, node, .constant(value), options: caseInsensitive ? [.caseInsensitive] : []))\n    }\n\n    /**\n     Checks for all elements in this collection that equal the given value.\n     `?` and `*` are allowed as wildcard characters, where `?` matches 1 character and `*` matches 0 or more characters.\n     - parameter value: value used.\n     - parameter caseInsensitive: `true` if it is a case-insensitive search.\n     */\n    public func like<U>(_ column: Query<U>, caseInsensitive: Bool = false) -> Query<Bool> {\n        .init(.comparison(operator: .like, node, column.node, options: caseInsensitive ? [.caseInsensitive] : []))\n    }\n}\n\n// MARK: _QueryBinary\n\nextension Query where T: _HasPersistedType, T.PersistedType: _QueryBinary {\n    /**\n     Checks for all elements in this collection that contains the given value.\n     - parameter value: value used.\n     - parameter options: A Set of options used to evaluate the search query.\n     */\n    public func contains(_ value: T, options: StringOptions = []) -> Query<Bool> {\n        .init(.comparison(operator: .contains, node, .constant(value), options: options))\n    }\n\n    /**\n     Compares that this column contains a value in another column.\n     - parameter column: The other column.\n     - parameter options: A Set of options used to evaluate the search query.\n     */\n    public func contains<U>(_ column: Query<U>, options: StringOptions = []) -> Query<Bool> where U: _Persistable, U.PersistedType: _QueryBinary {\n        .init(.comparison(operator: .contains, node, column.node, options: options))\n    }\n\n    /**\n     Checks for all elements in this collection that starts with the given value.\n     - parameter value: value used.\n     - parameter options: A Set of options used to evaluate the search query.\n     */\n    public func starts(with value: T, options: StringOptions = []) -> Query<Bool> {\n        .init(.comparison(operator: .beginsWith, node, .constant(value), options: options))\n    }\n\n    /**\n     Compares that this column starts with a value in another column.\n     - parameter column: The other column.\n     - parameter options: A Set of options used to evaluate the search query.\n     */\n    public func starts<U>(with column: Query<U>, options: StringOptions = []) -> Query<Bool> {\n        .init(.comparison(operator: .beginsWith, node, column.node, options: options))\n    }\n\n    /**\n     Checks for all elements in this collection that ends with the given value.\n     - parameter value: value used.\n     - parameter options: A Set of options used to evaluate the search query.\n     */\n    public func ends(with value: T, options: StringOptions = []) -> Query<Bool> {\n        .init(.comparison(operator: .endsWith, node, .constant(value), options: options))\n    }\n\n    /**\n     Compares that this column ends with a value in another column.\n     - parameter column: The other column.\n     - parameter options: A Set of options used to evaluate the search query.\n     */\n    public func ends<U>(with column: Query<U>, options: StringOptions = []) -> Query<Bool> {\n        .init(.comparison(operator: .endsWith, node, column.node, options: options))\n    }\n\n    /**\n     Checks for all elements in this collection that equals the given value.\n     - parameter value: value used.\n     - parameter options: A Set of options used to evaluate the search query.\n     */\n    public func equals(_ value: T, options: StringOptions = []) -> Query<Bool> {\n        .init(.comparison(operator: .equal, node, .constant(value), options: options))\n    }\n\n    /**\n     Compares that this column is equal to the value in another given column.\n     - parameter column: The other column.\n     - parameter options: A Set of options used to evaluate the search query.\n     */\n    public func equals<U>(_ column: Query<U>, options: StringOptions = []) -> Query<Bool> {\n        .init(.comparison(operator: .equal, node, column.node, options: options))\n    }\n\n    /**\n     Checks for all elements in this collection that are not equal to the given value.\n     - parameter value: value used.\n     - parameter options: A Set of options used to evaluate the search query.\n     */\n    public func notEquals(_ value: T, options: StringOptions = []) -> Query<Bool> {\n        .init(.comparison(operator: .notEqual, node, .constant(value), options: options))\n    }\n\n    /**\n     Compares that this column is not equal to the value in another given column.\n     - parameter column: The other column.\n     - parameter options: A Set of options used to evaluate the search query.\n     */\n    public func notEquals<U>(_ column: Query<U>, options: StringOptions = []) -> Query<Bool> {\n        .init(.comparison(operator: .notEqual, node, column.node, options: options))\n    }\n\n    /// :nodoc:\n    public static func > (_ lhs: Query, _ rhs: T) -> Query<Bool> {\n        .init(.comparison(operator: .greaterThan, lhs.node, .constant(rhs), options: []))\n    }\n    /// :nodoc:\n    public static func > (_ lhs: Query, _ rhs: Query) -> Query<Bool> {\n        .init(.comparison(operator: .greaterThan, lhs.node, rhs.node, options: []))\n    }\n    /// :nodoc:\n    public static func >= (_ lhs: Query, _ rhs: T) -> Query<Bool> {\n        .init(.comparison(operator: .greaterThanEqual, lhs.node, .constant(rhs), options: []))\n    }\n    /// :nodoc:\n    public static func >= (_ lhs: Query, _ rhs: Query) -> Query<Bool> {\n        .init(.comparison(operator: .greaterThanEqual, lhs.node, rhs.node, options: []))\n    }\n    /// :nodoc:\n    public static func < (_ lhs: Query, _ rhs: T) -> Query<Bool> {\n        .init(.comparison(operator: .lessThan, lhs.node, .constant(rhs), options: []))\n    }\n    /// :nodoc:\n    public static func < (_ lhs: Query, _ rhs: Query) -> Query<Bool> {\n        .init(.comparison(operator: .lessThan, lhs.node, rhs.node, options: []))\n    }\n    /// :nodoc:\n    public static func <= (_ lhs: Query, _ rhs: T) -> Query<Bool> {\n        .init(.comparison(operator: .lessThanEqual, lhs.node, .constant(rhs), options: []))\n    }\n    /// :nodoc:\n    public static func <= (_ lhs: Query, _ rhs: Query) -> Query<Bool> {\n        .init(.comparison(operator: .lessThanEqual, lhs.node, rhs.node, options: []))\n    }\n}\n\nextension Query where T: OptionalProtocol, T.Wrapped: Comparable {\n    /// Checks for all elements in this collection that are within a given range.\n    public func contains(_ range: Range<T.Wrapped>) -> Query<Bool> {\n        .init(.comparison(operator: .and,\n                          .comparison(operator: .greaterThanEqual, node, .constant(range.lowerBound), options: []),\n                          .comparison(operator: .lessThan, node, .constant(range.upperBound), options: []), options: []))\n    }\n\n    /// Checks for all elements in this collection that are within a given range.\n    public func contains(_ range: ClosedRange<T.Wrapped>) -> Query<Bool> {\n        .init(.between(node,\n                       lowerBound: .constant(range.lowerBound),\n                       upperBound: .constant(range.upperBound)))\n    }\n}\n\n// MARK: Subquery\n\nextension Query where T == Bool {\n    /// Completes a subquery expression.\n    /// - Usage:\n    /// ```\n    /// (($0.myCollection.age >= 21) && ($0.myCollection.siblings == 4))).count >= 5\n    /// ```\n    /// - Note:\n    /// Do not mix collections within a subquery expression. It is\n    /// only permitted to reference a single collection per each subquery.\n    public var count: Query<Int> {\n        .init(.subqueryCount(node))\n    }\n}\n\n// MARK: Keypath Collection Aggregates\n\n/**\n You can use only use aggregates in numeric types where the root keypath is a collection.\n ```swift\n let results = realm.objects(Person.self).query {\n    !$0.dogs.age.avg >= 0\n }\n ```\n Where `dogs` is an array of objects.\n */\nextension Query where T: _HasPersistedType, T.PersistedType: _QueryNumeric {\n    /// Returns the minimum value of the objects in the collection based on the keypath.\n    public var min: Query {\n        Query(buildCollectionAggregateKeyPath(\"@min\"))\n    }\n\n    /// Returns the maximum value of the objects in the collection based on the keypath.\n    public var max: Query {\n        Query(buildCollectionAggregateKeyPath(\"@max\"))\n    }\n\n    /// Returns the average of the objects in the collection based on the keypath.\n    public var avg: Query {\n        Query(buildCollectionAggregateKeyPath(\"@avg\"))\n    }\n\n    /// Returns the sum of the objects in the collection based on the keypath.\n    public var sum: Query {\n        Query(buildCollectionAggregateKeyPath(\"@sum\"))\n    }\n}\n\npublic extension Query where T: OptionalProtocol, T.Wrapped: EmbeddedObject {\n    /**\n    Use `geoWithin` function to filter objects whose location points lie within a certain area,\n    using a Geospatial shape (`GeoBox`, `GeoPolygon` or `GeoCircle`).\n\n     - note: There is no dedicated type to store Geospatial points, instead points should be stored as\n     [GeoJson-shaped](https://www.mongodb.com/docs/manual/reference/geojson/)\n     embedded object. Geospatial queries (`geoWithin`) can only be executed\n     in such a type of objects and will throw otherwise.\n     - see: `GeoPoint`\n    */\n    func geoWithin<U: RLMGeospatial>(_ value: U) -> Query<Bool> {\n        .init(.geoWithin(node, .constant(value)))\n    }\n}\n\n/// Tag protocol for all numeric types.\npublic protocol _QueryNumeric: _RealmSchemaDiscoverable { }\nextension Int: _QueryNumeric { }\nextension Int8: _QueryNumeric { }\nextension Int16: _QueryNumeric { }\nextension Int32: _QueryNumeric { }\nextension Int64: _QueryNumeric { }\nextension Float: _QueryNumeric { }\nextension Double: _QueryNumeric { }\nextension Decimal128: _QueryNumeric { }\nextension Date: _QueryNumeric { }\nextension AnyRealmValue: _QueryNumeric { }\nextension Optional: _QueryNumeric where Wrapped: _Persistable, Wrapped.PersistedType: _QueryNumeric { }\n\n/// Tag protocol for all types that are compatible with `String`.\npublic protocol _QueryString: _QueryBinary { }\nextension String: _QueryString { }\nextension Optional: _QueryString where Wrapped: _Persistable, Wrapped.PersistedType: _QueryString { }\n\n/// Tag protocol for all types that are compatible with `Binary`.\npublic protocol _QueryBinary { }\nextension Data: _QueryBinary { }\nextension Optional: _QueryBinary where Wrapped: _Persistable, Wrapped.PersistedType: _QueryBinary { }\n\n// MARK: QueryNode -\n\nprivate indirect enum QueryNode {\n    enum Operator: String {\n        case or = \"||\"\n        case and = \"&&\"\n        case equal = \"==\"\n        case notEqual = \"!=\"\n        case lessThan = \"<\"\n        case lessThanEqual = \"<=\"\n        case greaterThan = \">\"\n        case greaterThanEqual = \">=\"\n        case `in` = \"IN\"\n        case contains = \"CONTAINS\"\n        case beginsWith = \"BEGINSWITH\"\n        case endsWith = \"ENDSWITH\"\n        case like = \"LIKE\"\n    }\n\n    case not(_ child: QueryNode)\n    case constant(_ value: Any?)\n\n    case keyPath(_ value: [String], options: KeyPathOptions)\n\n    case comparison(operator: Operator, _ lhs: QueryNode, _ rhs: QueryNode, options: StringOptions)\n    case between(_ lhs: QueryNode, lowerBound: QueryNode, upperBound: QueryNode)\n\n    case subqueryCount(_ child: QueryNode)\n    case mapSubscript(_ keyPath: QueryNode, key: Any)\n    case mapAnySubscripts(_ keyPath: QueryNode, keys: [CollectionSubscript])\n    case geoWithin(_ keyPath: QueryNode, _ value: QueryNode)\n}\n\nprivate enum CollectionSubscript {\n    case index(Int)\n    case key(String)\n    case all\n}\n\nprivate func buildPredicate(_ root: QueryNode, subqueryCount: Int = 0) -> (String, [Any]) {\n    let formatStr = NSMutableString()\n    let arguments = NSMutableArray()\n    var subqueryCounter = subqueryCount\n\n    func buildExpression(_ lhs: QueryNode,\n                         _ op: String,\n                         _ rhs: QueryNode,\n                         prefix: String? = nil) {\n\n        if case let .keyPath(_, lhsOptions) = lhs,\n           case let .keyPath(_, rhsOptions) = rhs,\n           lhsOptions.contains(.isCollection), rhsOptions.contains(.isCollection) {\n            throwRealmException(\"Comparing two collection columns is not permitted.\")\n        }\n        formatStr.append(\"(\")\n        if let prefix = prefix {\n            formatStr.append(prefix)\n        }\n        build(lhs)\n        formatStr.append(\" \\(op) \")\n        build(rhs)\n        formatStr.append(\")\")\n    }\n\n    func buildCompoundExpression(_ lhs: QueryNode,\n                                 _ op: String,\n                                 _ rhs: QueryNode,\n                                 prefix: String? = nil) {\n        if let prefix = prefix {\n            formatStr.append(prefix)\n        }\n        formatStr.append(\"(\")\n        build(lhs, isNewNode: true)\n        formatStr.append(\" \\(op) \")\n        build(rhs, isNewNode: true)\n        formatStr.append(\")\")\n    }\n\n    func buildBetween(_ lowerBound: QueryNode, _ upperBound: QueryNode) {\n        formatStr.append(\" BETWEEN {\")\n        build(lowerBound)\n        formatStr.append(\", \")\n        build(upperBound)\n        formatStr.append(\"}\")\n    }\n\n    func buildBool(_ node: QueryNode, isNot: Bool = false) {\n        if case let .keyPath(kp, _) = node {\n            formatStr.append(kp.joined(separator: \".\"))\n            formatStr.append(\" == \\(isNot ? \"false\" : \"true\")\")\n        }\n    }\n\n    func strOptions(_ options: StringOptions) -> String {\n        if options == [] {\n            return \"\"\n        }\n        return \"[\\(options.contains(.caseInsensitive) ? \"c\" : \"\")\\(options.contains(.diacriticInsensitive) ? \"d\" : \"\")]\"\n    }\n\n    func build(_ node: QueryNode, prefix: String? = nil, isNewNode: Bool = false) {\n        switch node {\n        case .constant(let value):\n            formatStr.append(\"%@\")\n            arguments.add(value ?? NSNull())\n        case .keyPath(let kp, let options):\n            if isNewNode {\n                buildBool(node)\n                return\n            }\n            if options.contains(.requiresAny) {\n                formatStr.append(\"ANY \")\n            }\n\n            formatStr.append(kp.joined(separator: \".\"))\n        case .not(let child):\n            if case .keyPath = child,\n               isNewNode {\n                buildBool(child, isNot: true)\n                return\n            }\n            build(child, prefix: \"NOT \")\n        case .comparison(operator: let op, let lhs, let rhs, let options):\n            switch op {\n            case .and, .or:\n                buildCompoundExpression(lhs, op.rawValue, rhs, prefix: prefix)\n            default:\n                buildExpression(lhs, \"\\(op.rawValue)\\(strOptions(options))\", rhs, prefix: prefix)\n            }\n        case .between(let lhs, let lowerBound, let upperBound):\n            formatStr.append(\"(\")\n            build(lhs)\n            buildBetween(lowerBound, upperBound)\n            formatStr.append(\")\")\n        case .subqueryCount(let inner):\n            subqueryCounter += 1\n            let (collectionName, node) = SubqueryRewriter.rewrite(inner, subqueryCounter)\n            formatStr.append(\"SUBQUERY(\\(collectionName), $col\\(subqueryCounter), \")\n            build(node)\n            formatStr.append(\").@count\")\n        case .mapSubscript(let keyPath, let key):\n            build(keyPath)\n            formatStr.append(\"[%@]\")\n            arguments.add(key)\n        case .mapAnySubscripts(let keyPath, let keys):\n            build(keyPath)\n            for key in keys {\n                switch key {\n                case .index(let index):\n                    formatStr.append(\"[%@]\")\n                    arguments.add(index)\n                case .key(let key):\n                    formatStr.append(\"[%@]\")\n                    arguments.add(key)\n                case .all:\n                    formatStr.append(\"[%K]\")\n                    arguments.add(\"#any\")\n                }\n            }\n        case .geoWithin(let keyPath, let value):\n            buildExpression(keyPath, QueryNode.Operator.in.rawValue, value, prefix: nil)\n        }\n    }\n    build(root, isNewNode: true)\n    return (formatStr as String, (arguments as! [Any]))\n}\n\nprivate struct KeyPathOptions: OptionSet {\n    let rawValue: Int8\n    init(rawValue: RawValue) {\n        self.rawValue = rawValue\n    }\n\n    static let isCollection = KeyPathOptions(rawValue: 1)\n    static let requiresAny = KeyPathOptions(rawValue: 2)\n}\n\nprivate struct SubqueryRewriter {\n    private var collectionName: String?\n    private var counter: Int\n    private mutating func rewrite(_ node: QueryNode) -> QueryNode {\n        switch node {\n        case .keyPath(let kp, let options):\n            if options.contains(.isCollection) {\n                precondition(kp.count > 0)\n                collectionName = kp[0]\n                var copy = kp\n                copy[0] = \"$col\\(counter)\"\n                return .keyPath(copy, options: [.isCollection])\n            }\n            return node\n        case .not(let child):\n            return .not(rewrite(child))\n        case .comparison(operator: let op, let lhs, let rhs, options: let options):\n            return .comparison(operator: op, rewrite(lhs), rewrite(rhs), options: options)\n        case .between(let lhs, let lowerBound, let upperBound):\n            return .between(rewrite(lhs), lowerBound: rewrite(lowerBound), upperBound: rewrite(upperBound))\n        case .subqueryCount(let inner):\n            return .subqueryCount(inner)\n        case .constant:\n            return node\n        case .mapSubscript:\n            throwRealmException(\"Subqueries do not support map subscripts.\")\n        case .mapAnySubscripts:\n            throwRealmException(\"Subqueries do not support AnyRealmValue subscripts.\")\n        case .geoWithin(let keyPath, let value):\n            return .geoWithin(keyPath, value)\n        }\n    }\n\n    static fileprivate func rewrite(_ node: QueryNode, _ counter: Int) -> (String, QueryNode) {\n        var rewriter = SubqueryRewriter(counter: counter)\n        let rewritten = rewriter.rewrite(node)\n        guard let collectionName = rewriter.collectionName else {\n            throwRealmException(\"Subqueries must contain a keypath starting with a collection.\")\n        }\n        return (collectionName, rewritten)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Realm.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Realm.Private\n\n/// The Id of the asynchronous transaction.\npublic typealias AsyncTransactionId = RLMAsyncTransactionId\n\n/**\n A `Realm` instance (also referred to as \"a Realm\") represents a Realm database.\n\n Realms can either be stored on disk (see `init(path:)`) or in memory (see `Configuration`).\n\n `Realm` instances are cached internally, and constructing equivalent `Realm` objects (for example,\n by using the same path or identifier) produces limited overhead.\n\n If you specifically want to ensure a `Realm` instance is destroyed (for example, if you wish to\n open a Realm, check some property, and then possibly delete the Realm file and re-open it), place\n the code which uses the Realm within an `autoreleasepool {}` and ensure you have no other strong\n references to it.\n\n - warning: Non-frozen `RLMRealm` instances are thread-confined and cannot be\n shared across threads or dispatch queues. Trying to do so will cause an\n exception to be thrown. You must obtain an instance of `RLMRealm` on each\n thread or queue you want to interact with the Realm on. Realms can be confined\n to a dispatch queue rather than the thread they are opened on by explicitly\n passing in the queue when obtaining the `RLMRealm` instance. If this is not\n done, trying to use the same instance in multiple blocks dispatch to the same\n queue may fail as queues are not always run on the same thread.\n */\n@frozen public struct Realm {\n\n    // MARK: Properties\n\n    /// The `Schema` used by the Realm.\n    public var schema: Schema { return Schema(rlmRealm.schema) }\n\n    /// The `Configuration` value that was used to create the `Realm` instance.\n    public var configuration: Configuration { return Configuration.fromRLMRealmConfiguration(rlmRealm.configuration) }\n\n    /// Indicates if the Realm contains any objects.\n    public var isEmpty: Bool { return rlmRealm.isEmpty }\n\n    // MARK: Initializers\n\n    /**\n     Obtains an instance of the default Realm.\n\n     The default Realm is persisted as *default.realm* under the *Documents* directory of your Application on iOS, and\n     in your application's *Application Support* directory on OS X.\n\n     The default Realm is created using the default `Configuration`, which can be changed by setting the\n     `Realm.Configuration.defaultConfiguration` property to a new value.\n\n     - parameter queue: An optional dispatch queue to confine the Realm to. If\n                        given, this Realm instance can be used from within\n                        blocks dispatched to the given queue rather than on the\n                        current thread.\n     - throws: An `NSError` if the Realm could not be initialized.\n     */\n    public init(queue: DispatchQueue? = nil) throws {\n        _ = Realm.initMainActor\n        let rlmRealm = try RLMRealm(configuration: RLMRealmConfiguration.rawDefault(), queue: queue)\n        self.init(rlmRealm)\n    }\n\n    /**\n     Obtains a `Realm` instance with the given configuration.\n\n     - parameter configuration: A configuration value to use when creating the Realm.\n     - parameter queue: An optional dispatch queue to confine the Realm to. If\n                        given, this Realm instance can be used from within\n                        blocks dispatched to the given queue rather than on the\n                        current thread.\n\n     - throws: An `NSError` if the Realm could not be initialized.\n     */\n    public init(configuration: Configuration, queue: DispatchQueue? = nil) throws {\n        _ = Realm.initMainActor\n        let rlmRealm = try RLMRealm(configuration: configuration.rlmConfiguration, queue: queue)\n        self.init(rlmRealm)\n    }\n\n    /**\n     Obtains a `Realm` instance persisted at a specified file URL.\n\n     - parameter fileURL: The local URL of the file the Realm should be saved at.\n\n     - throws: An `NSError` if the Realm could not be initialized.\n     */\n    public init(fileURL: URL) throws {\n        _ = Realm.initMainActor\n        let configuration = RLMRealmConfiguration.default()\n        configuration.fileURL = fileURL\n        self.init(try RLMRealm(configuration: configuration))\n    }\n\n    private static let initMainActor: Void = {\n        if #available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) {\n            RLMSetMainActor(MainActor.shared)\n        }\n    }()\n\n    // MARK: Async\n\n    /**\n     Asynchronously open a Realm and deliver it to a block on the given queue.\n\n     Opening a Realm asynchronously will perform all work needed to get the Realm to\n     a usable state (such as running potentially time-consuming migrations) on a\n     background thread before dispatching to the given queue. In addition,\n     synchronized Realms wait for all remote content available at the time the\n     operation began to be downloaded and available locally.\n\n     The Realm passed to the callback function is confined to the callback\n     queue as if `Realm(configuration:queue:)` was used.\n\n     - parameter configuration: A configuration object to use when opening the Realm.\n     - parameter callbackQueue: The dispatch queue on which the callback should be run.\n     - parameter callback:      A callback block. If the Realm was successfully opened, an\n                                it will be passed in as an argument.\n                                Otherwise, a `Swift.Error` describing what went wrong will be\n                                passed to the block instead.\n     - returns: A task object which can be used to observe or cancel the async open.\n     */\n    @discardableResult\n    public static func asyncOpen(configuration: Realm.Configuration = .defaultConfiguration,\n                                 callbackQueue: DispatchQueue = .main,\n                                 callback: @escaping (Result<Realm, Swift.Error>) -> Void) -> AsyncOpenTask {\n        return AsyncOpenTask(rlmTask: RLMRealm.asyncOpen(with: configuration.rlmConfiguration, callbackQueue: callbackQueue, callback: { rlmRealm, error in\n            if let realm = rlmRealm.flatMap(Realm.init) {\n                callback(.success(realm))\n            } else {\n                callback(.failure(error ?? Realm.Error.callFailed))\n            }\n        }))\n    }\n\n    /**\n     A task object which can be used to observe or cancel an async open.\n\n     When a synchronized Realm is opened asynchronously, the latest state of the\n     Realm is downloaded from the server before the completion callback is\n     invoked. This task object can be used to observe the state of the download\n     or to cancel it. This should be used instead of trying to observe the\n     download via the sync session as the sync session itself is created\n     asynchronously, and may not exist yet when Realm.asyncOpen() returns.\n     */\n    @frozen public struct AsyncOpenTask {\n        internal let rlmTask: RLMAsyncOpenTask\n\n        /**\n         Cancel the asynchronous open.\n\n         Any download in progress will be cancelled, and the completion block for this\n         async open will never be called. If multiple async opens on the same Realm are\n         happening concurrently, all other opens will fail with the error \"operation cancelled\".\n         */\n        public func cancel() { rlmTask.cancel() }\n\n    }\n\n    // MARK: Transactions\n\n    /**\n     Performs actions contained within the given block inside a write transaction.\n\n     If the block throws an error, the transaction will be canceled and any\n     changes made before the error will be rolled back.\n\n     Only one write transaction can be open at a time for each Realm file. Write\n     transactions cannot be nested, and trying to begin a write transaction on a\n     Realm which is already in a write transaction will throw an exception.\n     Calls to `write` from `Realm` instances for the same Realm file in other\n     threads or other processes will block until the current write transaction\n     completes or is cancelled.\n\n     Before beginning the write transaction, `write` updates the `Realm`\n     instance to the latest Realm version, as if `refresh()` had been called,\n     and generates notifications if applicable. This has no effect if the Realm\n     was already up to date.\n\n     You can skip notifiying specific notification blocks about the changes made\n     in this write transaction by passing in their associated notification\n     tokens. This is primarily useful when the write transaction is saving\n     changes already made in the UI and you do not want to have the notification\n     block attempt to re-apply the same changes.\n\n     The tokens passed to this function must be for notifications for this Realm\n     which were added on the same thread as the write transaction is being\n     performed on. Notifications for different threads cannot be skipped using\n     this method.\n\n     - parameter tokens: An array of notification tokens which were returned\n                         from adding callbacks which you do not want to be\n                         notified for the changes made in this write transaction.\n\n     - parameter block: The block containing actions to perform.\n     - returns: The value returned from the block, if any.\n\n     - warning: This function is not safe to call from async functions, which\n                should use ``asyncWrite`` instead.\n     - throws: An `NSError` if the transaction could not be completed successfully.\n               If `block` throws, the function throws the propagated `ErrorType` instead.\n     */\n    @discardableResult\n    public func write<Result>(withoutNotifying tokens: [NotificationToken] = [], _ block: (() throws -> Result)) throws -> Result {\n        beginWrite()\n        let ret: Result\n        do {\n            ret = try block()\n        } catch let error {\n            if isInWriteTransaction { cancelWrite() }\n            throw error\n        }\n        if isInWriteTransaction { try commitWrite(withoutNotifying: tokens) }\n        return ret\n    }\n\n    /**\n     Begins a write transaction on the Realm.\n\n     Only one write transaction can be open at a time for each Realm file. Write\n     transactions cannot be nested, and trying to begin a write transaction on a\n     Realm which is already in a write transaction will throw an exception.\n     Calls to `beginWrite` from `Realm` instances for the same Realm file in\n     other threads or other processes will block until the current write\n     transaction completes or is cancelled.\n\n     Before beginning the write transaction, `beginWrite` updates the `Realm`\n     instance to the latest Realm version, as if `refresh()` had been called,\n     and generates notifications if applicable. This has no effect if the Realm\n     was already up to date.\n\n     It is rarely a good idea to have write transactions span multiple cycles of\n     the run loop, but if you do wish to do so you will need to ensure that the\n     Realm participating in the write transaction is kept alive until the write\n     transaction is committed.\n\n     - warning: This function is not safe to call from async functions, which\n                should use ``asyncWrite`` instead.\n     */\n    public func beginWrite() {\n        rlmRealm.beginWriteTransaction()\n    }\n\n    /**\n     Commits all write operations in the current write transaction, and ends\n     the transaction.\n\n     After saving the changes and completing the write transaction, all\n     notification blocks registered on this specific `Realm` instance are called\n     synchronously. Notification blocks for `Realm` instances on other threads\n     and blocks registered for any Realm collection (including those on the\n     current thread) are scheduled to be called synchronously.\n\n     You can skip notifiying specific notification blocks about the changes made\n     in this write transaction by passing in their associated notification\n     tokens. This is primarily useful when the write transaction is saving\n     changes already made in the UI and you do not want to have the notification\n     block attempt to re-apply the same changes.\n\n     The tokens passed to this function must be for notifications for this Realm\n     which were added on the same thread as the write transaction is being\n     performed on. Notifications for different threads cannot be skipped using\n     this method.\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter tokens: An array of notification tokens which were returned\n                         from adding callbacks which you do not want to be\n                         notified for the changes made in this write transaction.\n\n     - throws: An `NSError` if the transaction could not be written due to\n               running out of disk space or other i/o errors.\n     */\n    public func commitWrite(withoutNotifying tokens: [NotificationToken] = []) throws {\n        try rlmRealm.commitWriteTransactionWithoutNotifying(tokens)\n    }\n\n    /**\n     Reverts all writes made in the current write transaction and ends the transaction.\n\n     This rolls back all objects in the Realm to the state they were in at the\n     beginning of the write transaction, and then ends the transaction.\n\n     This restores the data for deleted objects, but does not revive invalidated\n     object instances. Any `Object`s which were added to the Realm will be\n     invalidated rather than becoming unmanaged.\n\n     Given the following code:\n\n     ```swift\n     let oldObject = objects(ObjectType).first!\n     let newObject = ObjectType()\n\n     realm.beginWrite()\n     realm.add(newObject)\n     realm.delete(oldObject)\n     realm.cancelWrite()\n     ```\n\n     Both `oldObject` and `newObject` will return `true` for `isInvalidated`,\n     but re-running the query which provided `oldObject` will once again return\n     the valid object.\n\n     KVO observers on any objects which were modified during the transaction\n     will be notified about the change back to their initial values, but no\n     other notifcations are produced by a cancelled write transaction.\n\n     This function is applicable regardless of how a write transaction was\n     started. Notably it can be called from inside a block passed to ``write``\n     or ``writeAsync``.\n\n     - warning: This method may only be called during a write transaction.\n     */\n    public func cancelWrite() {\n        rlmRealm.cancelWriteTransaction()\n    }\n\n    /**\n     Indicates whether the Realm is currently in a write transaction.\n\n     - warning:  Do not simply check this property and then start a write transaction whenever an object needs to be\n                 created, updated, or removed. Doing so might cause a large number of write transactions to be created,\n                 degrading performance. Instead, always prefer performing multiple updates during a single transaction.\n     */\n    public var isInWriteTransaction: Bool {\n        return rlmRealm.inWriteTransaction\n    }\n\n    // MARK: Asynchronous Transactions\n\n    /**\n     Asynchronously performs actions contained within the given block inside a write transaction.\n     The write transaction is begun asynchronously as if calling `beginAsyncWrite`,\n     and by default the transaction is committed asynchronously after the block completes.\n     You can also explicitly call `commitWrite` or `cancelWrite` from\n     within the block to synchronously commit or cancel the write transaction.\n     Returning without one of these calls is equivalent to calling `commitWrite`.\n\n     @param block The block containing actions to perform.\n\n     @param completionBlock A block which will be called on the source thread or queue\n                        once the commit has either completed or failed with an error.\n\n     @return An id identifying the asynchronous transaction which can be passed to\n             `cancelAsyncWrite` prior to the block being called to cancel\n             the pending invocation of the block.\n    */\n    @discardableResult\n    public func writeAsync(_ block: @escaping () -> Void, onComplete: ((Swift.Error?) -> Void)? = nil) -> AsyncTransactionId {\n        return beginAsyncWrite {\n            block()\n            commitAsyncWrite(onComplete)\n        }\n    }\n\n    /**\n     Begins an asynchronous write transaction.\n     This function asynchronously begins a write transaction on a background\n     thread, and then invokes the block on the original thread or queue once the\n     transaction has begun. Unlike `beginWrite`, this does not block the\n     calling thread if another thread is current inside a write transaction, and\n     will always return immediately.\n     Multiple calls to this function (or the other functions which perform\n     asynchronous write transactions) will queue the blocks to be called in the\n     same order as they were queued. This includes calls from inside a write\n     transaction block, which unlike with synchronous transactions are allowed.\n\n     @param asyncWriteBlock The block containing actions to perform inside the write transaction.\n            `asyncWriteBlock` should end by calling `commitAsyncWrite` or `commitWrite`.\n            Returning without one of these calls is equivalent to calling `cancelAsyncWrite`.\n\n     @return An id identifying the asynchronous transaction which can be passed to\n             `cancelAsyncWrite` prior to the block being called to cancel\n             the pending invocation of the block.\n     */\n    @discardableResult\n    public func beginAsyncWrite(_ asyncWriteBlock: @escaping () -> Void) -> AsyncTransactionId {\n        return rlmRealm.beginAsyncWriteTransaction {\n            asyncWriteBlock()\n        }\n    }\n\n    /**\n     Asynchronously commits a write transaction.\n     The call returns immediately allowing the caller to proceed while the I/O is\n     performed on a dedicated background thread. This can be used regardless of if\n     the write transaction was begun with `beginWrite` or `beginAsyncWrite`.\n\n     @param onComplete A block which will be called on the source thread or queue once the commit\n                     has either completed or failed with an error.\n\n     @param allowGrouping If `true`, multiple sequential calls to `commitAsyncWrite` may be\n                          batched together and persisted to stable storage in one group. This\n                          improves write performance, particularly when the individual transactions\n                          being batched are small. In the event of a crash or power failure,\n                          either all of the grouped transactions will be lost or none will, rather\n                          than the usual guarantee that data has been persisted as\n                          soon as a call to commit has returned.\n\n     @return An id identifying the asynchronous transaction commit can be passed to\n             `cancelAsyncWrite` prior to the completion block being called to cancel\n             the pending invocation of the block. Note that this does *not* cancel the commit itself.\n    */\n    @discardableResult\n    public func commitAsyncWrite(allowGrouping: Bool = false, _ onComplete: ((Swift.Error?) -> Void)? = nil) -> AsyncTransactionId {\n        return rlmRealm.commitAsyncWriteTransaction(onComplete, allowGrouping: allowGrouping)\n    }\n\n    /**\n     Cancels a queued block for an asynchronous transaction.\n     This can cancel a block passed to either an asynchronous begin or an asynchronous commit.\n     Canceling a begin cancels that transaction entirely, while canceling a commit merely cancels\n     the invocation of the completion callback, and the commit will still happen.\n     Transactions can only be canceled before the block is invoked, and calling `cancelAsyncWrite`\n     from within the block is a no-op.\n\n     @param AsyncTransactionId A transaction id from either `beginAsyncWrite` or `commitAsyncWrite`.\n    */\n    public func cancelAsyncWrite(_  asyncTransactionId: AsyncTransactionId) throws {\n        rlmRealm.cancelAsyncTransaction(asyncTransactionId)\n    }\n\n    /**\n     Indicates if the Realm is currently performing async write operations.\n     This becomes `true` following a call to `beginAsyncWrite`, `commitAsyncWrite`,\n     or `writeAsync`, and remains so until all scheduled async write work has completed.\n\n     - warning: If this is `true`, closing or invalidating the Realm will block until scheduled work has completed.\n     */\n    public var isPerformingAsynchronousWriteOperations: Bool {\n        return rlmRealm.isPerformingAsynchronousWriteOperations\n    }\n\n    // MARK: Adding and Creating objects\n\n    /**\n     What to do when an object being added to or created in a Realm has a primary key that already exists.\n     */\n    @frozen public enum UpdatePolicy: Int {\n        /**\n         Throw an exception. This is the default when no policy is specified for `add()` or `create()`.\n\n         This behavior is the same as passing `update: false` to `add()` or `create()`.\n         */\n        case error = 1\n        /**\n         Overwrite only properties in the existing object which are different from the new values. This results\n         in change notifications reporting only the properties which changed, and influences the sync merge logic.\n\n         If few or no of the properties are changing this will be faster than .all and reduce how much data has\n         to be written to the Realm file. If all of the properties are changing, it may be slower than .all (but\n         will never result in *more* data being written).\n         */\n        case modified = 3\n        /**\n         Overwrite all properties in the existing object with the new values, even if they have not changed. This\n         results in change notifications reporting all properties as changed, and influences the sync merge logic.\n\n         This behavior is the same as passing `update: true` to `add()` or `create()`.\n         */\n        case all = 2\n    }\n\n    /// :nodoc:\n    @available(*, unavailable, message: \"Pass .error, .modified or .all rather than a boolean. .error is equivalent to false and .all is equivalent to true.\")\n    public func add(_ object: Object, update: Bool) {\n        fatalError()\n    }\n\n    /**\n     Adds an unmanaged object to this Realm.\n\n     If an object with the same primary key already exists in this Realm, it is updated with the property values from\n     this object as specified by the `UpdatePolicy` selected. The update policy must be `.error` for objects with no\n     primary key.\n\n     Adding an object to a Realm will also add all child relationships referenced by that object (via `Object` and\n     `List<Object>` properties). Those objects must also be valid objects to add to this Realm, and the value of\n     the `update:` parameter is propagated to those adds.\n\n     The object to be added must either be an unmanaged object or a valid object which is already managed by this\n     Realm. Adding an object already managed by this Realm is a no-op, while adding an object which is managed by\n     another Realm or which has been deleted from any Realm (i.e. one where `isInvalidated` is `true`) is an error.\n\n     To copy a managed object from one Realm to another, use `create()` instead.\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter object: The object to be added to this Realm.\n     - parameter update: What to do if an object with the same primary key already exists. Must be `.error` for objects\n     without a primary key.\n     */\n    public func add(_ object: Object, update: UpdatePolicy = .error) {\n        if update != .error && object.objectSchema.primaryKeyProperty == nil {\n            throwRealmException(\"'\\(object.objectSchema.className)' does not have a primary key and can not be updated\")\n        }\n        RLMAddObjectToRealm(object, rlmRealm, RLMUpdatePolicy(rawValue: UInt(update.rawValue))!)\n    }\n\n    /// :nodoc:\n    @available(*, unavailable, message: \"Pass .error, .modified or .all rather than a boolean. .error is equivalent to false and .all is equivalent to true.\")\n    public func add<S: Sequence>(_ objects: S, update: Bool) where S.Iterator.Element: Object {\n        fatalError()\n    }\n\n    /**\n     Adds all the objects in a collection into the Realm.\n\n     - see: `add(_:update:)`\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter objects: A sequence which contains objects to be added to the Realm.\n     - parameter update: How to handle\n     without a primary key.\n     - parameter update: How to handle objects in the collection with a primary key that already exists in this\n     Realm. Must be `.error` for object types without a primary key.\n     */\n    public func add<S: Sequence>(_ objects: S, update: UpdatePolicy = .error) where S.Iterator.Element: Object {\n        for obj in objects {\n            add(obj, update: update)\n        }\n    }\n\n    /**\n     Creates a Realm object with a given value, adding it to the Realm and returning it.\n\n     The `value` argument can be a Realm object, a key-value coding compliant object, an array\n     or dictionary returned from the methods in `NSJSONSerialization`, or an `Array` containing\n     one element for each managed property. Do not pass in a `LinkingObjects` instance, either\n     by itself or as a member of a collection. If the `value` argument is an array, all properties\n     must be present, valid and in the same order as the properties defined in the model.\n\n     If the object type does not have a primary key or no object with the specified primary key\n     already exists, a new object is created in the Realm. If an object already exists in the Realm\n     with the specified primary key and the update policy is `.modified` or `.all`, the existing\n     object will be updated and a reference to that object will be returned.\n\n     If the object is being updated, all properties defined in its schema will be set by copying\n     from `value` using key-value coding. If the `value` argument does not respond to `value(forKey:)`\n     for a given property name (or getter name, if defined), that value will remain untouched.\n     Nullable properties on the object can be set to nil by using `NSNull` as the updated value,\n     or (if you are passing in an instance of an `Object` subclass) setting the corresponding\n     property on `value` to nil.\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter type:   The type of the object to create.\n     - parameter value:  The value used to populate the object.\n     - parameter update: What to do if an object with the same primary key already exists. Must be `.error` for object\n     types without a primary key.\n\n     - returns: The newly created object.\n     */\n    @discardableResult\n    public func create<T: Object>(_ type: T.Type, value: Any = [String: Any](), update: UpdatePolicy = .error) -> T {\n        if update != .error {\n            RLMVerifyHasPrimaryKey(type)\n        }\n        let typeName = (type as Object.Type).className()\n        return unsafeDowncast(RLMCreateObjectInRealmWithValue(rlmRealm, typeName, value,\n                                                              RLMUpdatePolicy(rawValue: UInt(update.rawValue))!), to: type)\n    }\n\n    /**\n     This method is useful only in specialized circumstances, for example, when building\n     components that integrate with Realm. If you are simply building an app on Realm, it is\n     recommended to use the typed method `create(_:value:update:)`.\n\n     Creates or updates an object with the given class name and adds it to the `Realm`, populating\n     the object with the given value.\n\n     The `value` argument can be a Realm object, a key-value coding compliant object, an array\n     or dictionary returned from the methods in `NSJSONSerialization`, or an `Array` containing\n     one element for each managed property. Do not pass in a `LinkingObjects` instance, either\n     by itself or as a member of a collection. If the `value` argument is an array, all properties\n     must be present, valid and in the same order as the properties defined in the model.\n\n     If the object type does not have a primary key or no object with the specified primary key\n     already exists, a new object is created in the Realm. If an object already exists in the Realm\n     with the specified primary key and the update policy is `.modified` or `.all`, the existing\n     object will be updated and a reference to that object will be returned.\n\n     If the object is being updated, all properties defined in its schema will be set by copying\n     from `value` using key-value coding. If the `value` argument does not respond to `value(forKey:)`\n     for a given property name (or getter name, if defined), that value will remain untouched.\n     Nullable properties on the object can be set to nil by using `NSNull` as the updated value,\n     or (if you are passing in an instance of an `Object` subclass) setting the corresponding\n     property on `value` to nil.\n\n\n     - warning: This method can only be called during a write transaction.\n\n     - parameter className:  The class name of the object to create.\n     - parameter value:      The value used to populate the object.\n     - parameter update:     What to do if an object with the same primary key already exists.\n     Must be `.error` for object types without a primary key.\n\n     - returns: The created object.\n\n     :nodoc:\n     */\n    @discardableResult\n    public func dynamicCreate(_ typeName: String, value: Any = [String: Any](), update: UpdatePolicy = .error) -> DynamicObject {\n        if update != .error && schema[typeName]?.primaryKeyProperty == nil {\n            throwRealmException(\"'\\(typeName)' does not have a primary key and can not be updated\")\n        }\n        return noWarnUnsafeBitCast(RLMCreateObjectInRealmWithValue(rlmRealm, typeName, value,\n                                                                   RLMUpdatePolicy(rawValue: UInt(update.rawValue))!),\n                                   to: DynamicObject.self)\n    }\n\n    // MARK: Deleting objects\n\n    /**\n     Deletes an object from the Realm. Once the object is deleted it is considered invalidated.\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter object: The object to be deleted.\n     */\n    public func delete(_ object: ObjectBase) {\n        rlmRealm.delete(object.unsafeCastToRLMObject())\n    }\n\n    /**\n     Deletes zero or more objects from the Realm.\n\n     Do not pass in a slice to a `Results` or any other auto-updating Realm collection\n     type (for example, the type returned by the Swift `suffix(_:)` standard library\n     method). Instead, make a copy of the objects to delete using `Array()`, and pass\n     that instead. Directly passing in a view into an auto-updating collection may\n     result in 'index out of bounds' exceptions being thrown.\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter objects:   The objects to be deleted. This can be a `List<Object>`,\n                            `Results<Object>`, or any other Swift `Sequence` whose\n                            elements are `Object`s (subject to the caveats above).\n     */\n    public func delete<S: Sequence>(_ objects: S) where S.Iterator.Element: ObjectBase {\n        for obj in objects {\n            delete(obj)\n        }\n    }\n\n    /**\n     Deletes zero or more objects from the Realm.\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter objects: A list of objects to delete.\n\n     :nodoc:\n     */\n    public func delete<Element: ObjectBase>(_ objects: List<Element>) {\n        rlmRealm.deleteObjects(objects._rlmCollection)\n    }\n\n    /**\n     Deletes zero or more objects from the Realm.\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter objects: A map of objects to delete.\n\n     :nodoc:\n     */\n    public func delete<Key: _MapKey, Value: ObjectBase>(_ map: Map<Key, Value?>) {\n        rlmRealm.deleteObjects(map._rlmCollection)\n    }\n\n    /**\n     Deletes zero or more objects from the Realm.\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter objects: A `Results` containing the objects to be deleted.\n\n     :nodoc:\n     */\n    public func delete<Element: ObjectBase>(_ objects: Results<Element>) {\n        rlmRealm.deleteObjects(objects.collection)\n    }\n\n    /**\n     Deletes all objects from the Realm.\n\n     - warning: This method may only be called during a write transaction.\n     */\n    public func deleteAll() {\n        rlmRealm.deleteAllObjects()\n    }\n\n    // MARK: Object Retrieval\n\n    /**\n     Returns all objects of the given type stored in the Realm.\n\n     - parameter type: The type of the objects to be returned.\n\n     - returns: A `Results` containing the objects.\n     */\n    public func objects<Element: RealmFetchable>(_ type: Element.Type) -> Results<Element> {\n        return Results(RLMGetObjects(rlmRealm, type.className(), nil))\n    }\n\n    /**\n     This method is useful only in specialized circumstances, for example, when building\n     components that integrate with Realm. If you are simply building an app on Realm, it is\n     recommended to use the typed method `objects(type:)`.\n\n     Returns all objects for a given class name in the Realm.\n\n     - parameter typeName: The class name of the objects to be returned.\n     - returns: All objects for the given class name as dynamic objects\n\n     :nodoc:\n     */\n    public func dynamicObjects(_ typeName: String) -> Results<DynamicObject> {\n        return Results<DynamicObject>(RLMGetObjects(rlmRealm, typeName, nil))\n    }\n\n    /**\n     Retrieves the single instance of a given object type with the given primary key from the Realm.\n\n     This method requires that `primaryKey()` be overridden on the given object class.\n\n     - see: `Object.primaryKey()`\n\n     - parameter type: The type of the object to be returned.\n     - parameter key:  The primary key of the desired object.\n\n     - returns: An object of type `type`, or `nil` if no instance with the given primary key exists.\n     */\n    public func object<Element: Object, KeyType>(ofType type: Element.Type, forPrimaryKey key: KeyType) -> Element? {\n        return unsafeBitCast(RLMGetObject(rlmRealm, (type as Object.Type).className(),\n                                          dynamicBridgeCast(fromSwift: key)) as! RLMObjectBase?,\n                             to: Optional<Element>.self)\n    }\n\n    /**\n     This method is useful only in specialized circumstances, for example, when building\n     components that integrate with Realm. If you are simply building an app on Realm, it is\n     recommended to use the typed method `objectForPrimaryKey(_:key:)`.\n\n     Get a dynamic object with the given class name and primary key.\n\n     Returns `nil` if no object exists with the given class name and primary key.\n\n     This method requires that `primaryKey()` be overridden on the given subclass.\n\n     - see: Object.primaryKey()\n\n     - warning: This method is useful only in specialized circumstances.\n\n     - parameter className:  The class name of the object to be returned.\n     - parameter key:        The primary key of the desired object.\n\n     - returns: An object of type `DynamicObject` or `nil` if an object with the given primary key does not exist.\n\n     :nodoc:\n     */\n    public func dynamicObject(ofType typeName: String, forPrimaryKey key: Any) -> DynamicObject? {\n        return unsafeBitCast(RLMGetObject(rlmRealm, typeName, key) as! RLMObjectBase?, to: Optional<DynamicObject>.self)\n    }\n\n    // MARK: Notifications\n\n    /**\n     Adds a notification handler for changes made to this Realm, and returns a notification token.\n\n     Notification handlers are called after each write transaction is committed, independent of the thread or process.\n\n     Handler blocks are called on the same thread that they were added on, and may only be added on threads which are\n     currently within a run loop. Unless you are specifically creating and running a run loop on a background thread,\n     this will normally only be the main thread.\n\n     Notifications can't be delivered as long as the run loop is blocked by other activity. When notifications can't be\n     delivered instantly, multiple notifications may be coalesced.\n\n     You must retain the returned token for as long as you want updates to be sent to the block. To stop receiving\n     updates, call `invalidate()` on the token.\n\n     - parameter block: A block which is called to process Realm notifications. It receives the following parameters:\n                        `notification`: the incoming notification; `realm`: the Realm for which the notification\n                        occurred.\n\n     - returns: A token which must be held for as long as you wish to continue receiving change notifications.\n     */\n    public func observe(_ block: @escaping NotificationBlock) -> NotificationToken {\n        return rlmRealm.addNotificationBlock { rlmNotification, _ in\n            switch rlmNotification {\n            case RLMNotification.DidChange:\n                block(.didChange, self)\n            case RLMNotification.RefreshRequired:\n                block(.refreshRequired, self)\n            default:\n                fatalError(\"Unhandled notification type: \\(rlmNotification)\")\n            }\n        }\n    }\n\n    // MARK: Autorefresh and Refresh\n\n    /**\n     Set this property to `true` to automatically update this Realm when changes happen in other threads.\n\n     If set to `true` (the default), changes made on other threads will be reflected in this Realm on the next cycle of\n     the run loop after the changes are committed.  If set to `false`, you must manually call `refresh()` on the Realm\n     to update it to get the latest data.\n\n     Note that by default, background threads do not have an active run loop and you will need to manually call\n     `refresh()` in order to update to the latest version, even if `autorefresh` is set to `true`.\n\n     Even with this property enabled, you can still call `refresh()` at any time to update the Realm before the\n     automatic refresh would occur.\n\n     Notifications are sent when a write transaction is committed whether or not automatic refreshing is enabled.\n\n     Disabling `autorefresh` on a `Realm` without any strong references to it will not have any effect, and\n     `autorefresh` will revert back to `true` the next time the Realm is created. This is normally irrelevant as it\n     means that there is nothing to refresh (as managed `Object`s, `List`s, and `Results` have strong references to the\n     `Realm` that manages them), but it means that setting `autorefresh = false` in\n     `application(_:didFinishLaunchingWithOptions:)` and only later storing Realm objects will not work.\n\n     Defaults to `true`.\n     */\n    public var autorefresh: Bool {\n        get {\n            return rlmRealm.autorefresh\n        }\n        nonmutating set {\n            rlmRealm.autorefresh = newValue\n        }\n    }\n\n    /**\n     Updates the Realm and outstanding objects managed by the Realm to point to\n     the most recent data and deliver any applicable notifications.\n\n     By default Realms will automatically refresh in a more efficient way than\n     is possible with this function. This function should be avoided when\n     possible.\n\n     - warning: This function is not safe to call from async functions, which\n                should use ``asyncRefresh`` instead.\n     - returns: Whether there were any updates for the Realm. Note that `true`\n                may be returned even if no data actually changed.\n     */\n    @discardableResult\n    public func refresh() -> Bool {\n        return rlmRealm.refresh()\n    }\n\n    // MARK: Frozen Realms\n\n    /// Returns if this Realm is frozen.\n    public var isFrozen: Bool {\n        return rlmRealm.isFrozen\n    }\n\n    /**\n     Returns a frozen (immutable) snapshot of this Realm.\n\n     A frozen Realm is an immutable snapshot view of a particular version of a Realm's data. Unlike\n     normal Realm instances, it does not live-update to reflect writes made to the Realm, and can be\n     accessed from any thread. Writing to a frozen Realm is not allowed, and attempting to begin a\n     write transaction will throw an exception.\n\n     All objects and collections read from a frozen Realm will also be frozen.\n\n     - warning: Holding onto a frozen Realm for an extended period while performing write\n     transaction on the Realm may result in the Realm file growing to large sizes. See\n     `Realm.Configuration.maximumNumberOfActiveVersions` for more information.\n     */\n    public func freeze() -> Realm {\n        return isFrozen ? self : Realm(rlmRealm.freeze())\n    }\n\n    /**\n     Returns a live (mutable) reference of this Realm.\n\n     All objects and collections read from the returned Realm reference will no longer be frozen.\n     Will return self if called on a Realm that is not already frozen.\n     */\n    public func thaw() -> Realm {\n        return isFrozen ? Realm(rlmRealm.thaw()) : self\n    }\n\n    /**\n     Returns a frozen (immutable) snapshot of the given object.\n\n     The frozen copy is an immutable object which contains the same data as the given object\n     currently contains, but will not update when writes are made to the containing Realm. Unlike\n     live objects, frozen objects can be accessed from any thread.\n\n     - warning: Holding onto a frozen object for an extended period while performing write\n     transaction on the Realm may result in the Realm file growing to large sizes. See\n     `Realm.Configuration.maximumNumberOfActiveVersions` for more information.\n     */\n    public func freeze<T: ObjectBase>(_ obj: T) -> T {\n        return RLMObjectFreeze(obj) as! T\n    }\n\n    /**\n     Returns a live (mutable) reference of this object.\n\n     This method creates a managed accessor to a live copy of the same frozen object.\n     Will return self if called on an already live object.\n     */\n    public func thaw<T: ObjectBase>(_ obj: T) -> T? {\n        return RLMObjectThaw(obj) as? T\n    }\n\n    /**\n     Returns a frozen (immutable) snapshot of the given collection.\n\n     The frozen copy is an immutable collection which contains the same data as the given\n     collection currently contains, but will not update when writes are made to the containing\n     Realm. Unlike live collections, frozen collections can be accessed from any thread.\n\n     - warning: This method cannot be called during a write transaction, or when the Realm is read-only.\n     - warning: Holding onto a frozen collection for an extended period while performing write\n     transaction on the Realm may result in the Realm file growing to large sizes. See\n     `Realm.Configuration.maximumNumberOfActiveVersions` for more information.\n    */\n    public func freeze<Collection: RealmCollection>(_ collection: Collection) -> Collection {\n        return collection.freeze()\n    }\n\n    // MARK: Invalidation\n\n    /**\n     Invalidates all `Object`s, `Results`, `LinkingObjects`, and `List`s managed by the Realm.\n\n     A Realm holds a read lock on the version of the data accessed by it, so\n     that changes made to the Realm on different threads do not modify or delete the\n     data seen by this Realm. Calling this method releases the read lock,\n     allowing the space used on disk to be reused by later write transactions rather\n     than growing the file. This method should be called before performing long\n     blocking operations on a background thread on which you previously read data\n     from the Realm which you no longer need.\n\n     All `Object`, `Results` and `List` instances obtained from this `Realm` instance on the current thread are\n     invalidated. `Object`s and `Array`s cannot be used. `Results` will become empty. The Realm itself remains valid,\n     and a new read transaction is implicitly begun the next time data is read from the Realm.\n\n     Calling this method multiple times in a row without reading any data from the\n     Realm, or before ever reading any data from the Realm, is a no-op.\n     */\n    public func invalidate() {\n        rlmRealm.invalidate()\n    }\n\n    // MARK: File Management\n\n    /**\n     Writes a compacted and optionally encrypted copy of the Realm to the given local URL.\n\n     The destination file cannot already exist.\n\n     Note that if this method is called from within a write transaction, the *current* data is written, not the data\n     from the point when the previous write transaction was committed.\n\n     - parameter fileURL:       Local URL to save the Realm to.\n     - parameter encryptionKey: Optional 64-byte encryption key to encrypt the new file with.\n\n     - throws: An `NSError` if the copy could not be written.\n     */\n    public func writeCopy(toFile fileURL: URL, encryptionKey: Data? = nil) throws {\n        try rlmRealm.writeCopy(to: fileURL, encryptionKey: encryptionKey)\n    }\n\n    /**\n     Writes a copy of the Realm to a given location specified by a given configuration.\n\n     If the configuration supplied is derived from a `User` then this Realm will be copied with\n     sync functionality enabled.\n\n     The destination file cannot already exist.\n\n     - parameter configuration: A Realm Configuration.\n\n     - throws: An `NSError` if the copy could not be written.\n     */\n    public func writeCopy(configuration: Realm.Configuration) throws {\n        try rlmRealm.writeCopy(for: configuration.rlmConfiguration)\n    }\n\n    /**\n     Checks if the Realm file for the given configuration exists locally on disk.\n\n     For non-synchronized, non-in-memory Realms, this is equivalent to\n     `FileManager.default.fileExists(atPath:)`. For synchronized Realms, it\n     takes care of computing the actual path on disk based on the server,\n     virtual path, and user as is done when opening the Realm.\n\n     @param config A Realm configuration to check the existence of.\n     @return true if the Realm file for the given configuration exists on disk, false otherwise.\n     */\n    public static func fileExists(for config: Configuration) -> Bool {\n        return RLMRealm.fileExists(for: config.rlmConfiguration)\n    }\n\n    /**\n     Deletes the local Realm file and associated temporary files for the given configuration.\n\n     This deletes the \".realm\", \".note\" and \".management\" files which would be\n     created by opening the Realm with the given configuration. It does not\n     delete the \".lock\" file (which contains no persisted data and is recreated\n     from scratch every time the Realm file is opened).\n\n     The Realm must not be currently open on any thread or in another process.\n     If it is, this will throw the error .alreadyOpen. Attempting to open the\n     Realm on another thread while the deletion is happening will block, and\n     then create a new Realm and open that afterwards.\n\n     If the Realm already does not exist this will return `false`.\n\n     @param config A Realm configuration identifying the Realm to be deleted.\n     @return true if any files were deleted, false otherwise.\n     */\n    public static func deleteFiles(for config: Configuration) throws -> Bool {\n        return try RLMRealm.deleteFiles(for: config.rlmConfiguration)\n    }\n\n    // MARK: Internal\n\n    internal var rlmRealm: RLMRealm\n    internal init(_ rlmRealm: RLMRealm) {\n        self.rlmRealm = rlmRealm\n    }\n}\n\n// MARK: Equatable\n\nextension Realm: Equatable {\n    /// Returns whether two `Realm` instances are equal.\n    public static func == (lhs: Realm, rhs: Realm) -> Bool {\n        return lhs.rlmRealm == rhs.rlmRealm\n    }\n}\n\n// MARK: Notifications\n\nextension Realm {\n    /// A notification indicating that changes were made to a Realm.\n    @frozen public enum Notification: String {\n        /**\n         This notification is posted when the data in a Realm has changed.\n\n         `didChange` is posted after a Realm has been refreshed to reflect a write transaction, This can happen when an\n         autorefresh occurs, `refresh()` is called, after an implicit refresh from `write(_:)`/`beginWrite()`, or after\n         a local write transaction is committed.\n         */\n        case didChange = \"RLMRealmDidChangeNotification\"\n\n        /**\n         This notification is posted when a write transaction has been committed to a Realm on a different thread for\n         the same file.\n\n         It is not posted if `autorefresh` is enabled, or if the Realm is refreshed before the notification has a chance\n         to run.\n\n         Realms with autorefresh disabled should normally install a handler for this notification which calls\n         `refresh()` after doing some work. Refreshing the Realm is optional, but not refreshing the Realm may lead to\n         large Realm files. This is because an extra copy of the data must be kept for the stale Realm.\n         */\n        case refreshRequired = \"RLMRealmRefreshRequiredNotification\"\n    }\n}\n\n/// The type of a block to run for notification purposes when the data in a Realm is modified.\npublic typealias NotificationBlock = (_ notification: Realm.Notification, _ realm: Realm) -> Void\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension Realm {\n    /**\n     Obtains a `Realm` instance with the given configuration, possibly asynchronously.\n     By default this simply returns the Realm instance exactly as if the\n     synchronous initializer was used. It optionally can instead open the Realm\n     asynchronously, performing all work needed to get the Realm to a usable\n     state on a background thread. For local Realms, this means that migrations\n     will be run in the background, and for synchronized Realms all data will\n     be downloaded from the server before the Realm is returned.\n     - parameter configuration: A configuration object to use when opening the Realm.\n     all data from the server.\n     - throws: An `NSError` if the Realm could not be initialized.\n     - returns: An open Realm.\n     */\n    @MainActor\n    public init(configuration: Realm.Configuration = .defaultConfiguration) async throws {\n        let scheduler = RLMScheduler.dispatchQueue(.main)\n        let rlmRealm = try await openRealm(configuration: configuration, scheduler: scheduler,\n                                           actor: MainActor.shared)\n        self = Realm(rlmRealm.wrappedValue)\n    }\n\n    /**\n     Asynchronously obtains a `Realm` instance isolated to the given Actor.\n\n     Opening a Realm with an actor isolates the Realm to that actor. Rather\n     than being confined to the specific thread which the Realm was opened on,\n     the Realm can instead only be used from within that actor or functions\n     isolated to that actor. Isolating a Realm to an actor also enables using\n     ``asyncWrite`` and ``asyncRefresh``.\n\n     All initialization work to prepare the Realm for work, such as creating,\n     migrating, or compacting the file on disk, and waiting for synchronized\n     Realms to download the latest data from the server is done on a background\n     thread and does not block the calling executor.\n\n     When using actor-isolated Realms, enabling struct concurrency checking\n     (`SWIFT_STRICT_CONCURRENCY=complete` in Xcode) and runtime data race\n     detection (by passing `-Xfrontend -enable-actor-data-race-checks` to the\n     compiler) is strongly recommended.\n\n     - parameter configuration: A configuration object to use when opening the Realm.\n     - parameter actor: The actor to confine this Realm to. The actor can be\n     either a local actor or a global actor. The calling function does not need\n     to be isolated to the actor passed in, but if it is not it will not be\n     able to use the returned Realm.\n     - throws: An `NSError` if the Realm could not be initialized.\n               `CancellationError` if the task is cancelled.\n     - returns: An open Realm.\n     */\n    public init<A: Actor>(configuration: Realm.Configuration = .defaultConfiguration,\n                          actor: A) async throws {\n        let scheduler = RLMScheduler.actor(actor, invoke: actor.invoke, verify: await actor.verifier())\n        let rlmRealm = try await openRealm(configuration: configuration, scheduler: scheduler, actor: actor)\n        self = Realm(rlmRealm.wrappedValue)\n    }\n\n#if compiler(>=6)\n    /**\n     Asynchronously obtains a `Realm` instance isolated to the current Actor.\n\n     Opening a Realm with an actor isolates the Realm to that actor. Rather\n     than being confined to the specific thread which the Realm was opened on,\n     the Realm can instead only be used from within that actor or functions\n     isolated to that actor. Isolating a Realm to an actor also enables using\n     ``asyncWrite`` and ``asyncRefresh``.\n\n     All initialization work to prepare the Realm for work, such as creating,\n     migrating, or compacting the file on disk, and waiting for synchronized\n     Realms to download the latest data from the server is done on a background\n     thread and does not block the calling executor.\n\n     - parameter configuration: A configuration object to use when opening the Realm.\n     - parameter downloadBeforeOpen: When opening the Realm should first download\n     all data from the server.\n     - throws: An `NSError` if the Realm could not be initialized.\n               `CancellationError` if the task is cancelled.\n     - returns: An open Realm.\n     */\n    public static func open(configuration: Realm.Configuration = .defaultConfiguration,\n                            _isolation actor: isolated any Actor = #isolation) async throws -> Realm {\n        let scheduler = RLMScheduler.actor(actor, invoke: actor.invoke, verify: actor.verifier())\n        let rlmRealm = try await openRealm(configuration: configuration, scheduler: scheduler, actor: actor)\n        return Realm(rlmRealm.wrappedValue)\n    }\n#endif\n\n#if compiler(<6)\n    /**\n     Performs actions contained within the given block inside a write transaction.\n\n     This function differs from synchronous ``write`` in that it suspends the\n     calling task while waiting for its turn to write rather than blocking the\n     thread. In addition, the actual i/o to write data to disk is done by a\n     background worker thread. For small writes, using this function on the\n     main thread may block the main thread for less time than manually\n     dispatching the write to a background thread.\n\n     If the block throws an error, the transaction will be canceled and any\n     changes made before the error will be rolled back.\n\n     Only one write transaction can be open at a time for each Realm file. Write\n     transactions cannot be nested, and trying to begin a write transaction on a\n     Realm which is already in a write transaction will throw an exception.\n     Calls to `write` from `Realm` instances for the same Realm file in other\n     threads or other processes will block until the current write transaction\n     completes or is cancelled.\n\n     Before beginning the write transaction, `asyncWrite` updates the `Realm`\n     instance to the latest Realm version, as if `asyncRefresh()` had been called,\n     and generates notifications if applicable. This has no effect if the Realm\n     was already up to date.\n\n     You can skip notifying specific notification blocks about the changes made\n     in this write transaction by passing in their associated notification\n     tokens. This is primarily useful when the write transaction is saving\n     changes already made in the UI and you do not want to have the notification\n     block attempt to re-apply the same changes.\n\n     The tokens passed to this function must be for notifications for this Realm\n     which were added on the same actor as the write transaction is being\n     performed on. Notifications for different threads cannot be skipped using\n     this method.\n\n     - parameter tokens: An array of notification tokens which were returned\n                         from adding callbacks which you do not want to be\n                         notified for the changes made in this write transaction.\n\n     - parameter block: The block containing actions to perform.\n     - returns: The value returned from the block, if any.\n\n     - throws: An `NSError` if the transaction could not be completed successfully.\n               `CancellationError` if the task is cancelled.\n               If `block` throws, the function throws the propagated `ErrorType` instead.\n     */\n    @discardableResult\n    @_unsafeInheritExecutor\n    public func asyncWrite<Result>(_ block: (() throws -> Result)) async throws -> Result {\n        guard let actor = rlmRealm.actor as? Actor else {\n            fatalError(\"asyncWrite() can only be called on main thread or actor-isolated Realms\")\n        }\n        return try await withoutActuallyEscaping(block) { block in\n            try await Self.asyncWrite(actor: actor, realm: Unchecked(rlmRealm), Unchecked(block)).wrappedValue\n        }\n    }\n\n    private static func asyncWrite<Result>(actor: isolated any Actor,\n                                           realm: Unchecked<RLMRealm>,\n                                           _ block: Unchecked<(() throws -> Result)>) async throws\n    -> Unchecked<Result> {\n        let realm = realm.wrappedValue\n        let write = realm.beginAsyncWrite()\n        await withTaskCancellationHandler {\n            await write.wait()\n        } onCancel: {\n            actor.invoke { write.complete(true) }\n        }\n\n        let ret: Result\n        do {\n            try Task.checkCancellation()\n            ret = try block.wrappedValue()\n        } catch {\n            if realm.inWriteTransaction { realm.cancelWriteTransaction() }\n            throw error\n        }\n\n        if realm.inWriteTransaction {\n            try await realm.commitAsyncWrite(withGrouping: false)\n        }\n        return Unchecked(ret)\n    }\n\n    /**\n     Updates the Realm and outstanding objects managed by the Realm to point to\n     the most recent data and deliver any applicable notifications.\n\n     This function should be used instead of synchronous ``refresh`` in async\n     functions, as it suspends the calling task (if required) rather than\n     blocking.\n\n     - warning: This function is only supported for main thread and\n                actor-isolated Realms.\n     - returns: Whether there were any updates for the Realm. Note that `true`\n                may be returned even if no data actually changed.\n     */\n    @discardableResult\n    @_unsafeInheritExecutor\n    public func asyncRefresh() async -> Bool {\n        guard rlmRealm.actor is Actor else {\n            fatalError(\"asyncRefresh() can only be called on main thread or actor-isolated Realms\")\n        }\n        guard let task = RLMRealmRefreshAsync(rlmRealm) else {\n            return false\n        }\n        return await withTaskCancellationHandler {\n            await task.wait()\n        } onCancel: {\n            task.complete(false)\n        }\n    }\n\n#else // compiler(<6)\n\n    /**\n     Performs actions contained within the given block inside a write transaction.\n\n     This function differs from synchronous ``write`` in that it suspends the\n     calling task while waiting for its turn to write rather than blocking the\n     thread. In addition, the actual i/o to write data to disk is done by a\n     background worker thread. For small writes, using this function on the\n     main thread may block the main thread for less time than manually\n     dispatching the write to a background thread.\n\n     If the block throws an error, the transaction will be canceled and any\n     changes made before the error will be rolled back.\n\n     Only one write transaction can be open at a time for each Realm file. Write\n     transactions cannot be nested, and trying to begin a write transaction on a\n     Realm which is already in a write transaction will throw an exception.\n     Calls to `write` from `Realm` instances for the same Realm file in other\n     threads or other processes will block until the current write transaction\n     completes or is cancelled.\n\n     Before beginning the write transaction, `asyncWrite` updates the `Realm`\n     instance to the latest Realm version, as if `asyncRefresh()` had been called,\n     and generates notifications if applicable. This has no effect if the Realm\n     was already up to date.\n\n     You can skip notifying specific notification blocks about the changes made\n     in this write transaction by passing in their associated notification\n     tokens. This is primarily useful when the write transaction is saving\n     changes already made in the UI and you do not want to have the notification\n     block attempt to re-apply the same changes.\n\n     The tokens passed to this function must be for notifications for this Realm\n     which were added on the same actor as the write transaction is being\n     performed on. Notifications for different threads cannot be skipped using\n     this method.\n\n     - parameter tokens: An array of notification tokens which were returned\n                         from adding callbacks which you do not want to be\n                         notified for the changes made in this write transaction.\n\n     - parameter block: The block containing actions to perform.\n     - returns: The value returned from the block, if any.\n\n     - throws: An `NSError` if the transaction could not be completed successfully.\n               `CancellationError` if the task is cancelled.\n               If `block` throws, the function throws the propagated `ErrorType` instead.\n     */\n    @discardableResult\n    public func asyncWrite<Result>(_isolation actor: isolated any Actor = #isolation, _ block: (() throws -> Result)) async throws -> Result {\n        guard rlmRealm.actor != nil else {\n            fatalError(\"asyncWrite() can only be called on main thread or actor-isolated Realms\")\n        }\n        let realm = rlmRealm\n        let write = realm.beginAsyncWrite()\n        await withTaskCancellationHandler {\n            await write.wait()\n        } onCancel: {\n            actor.invoke { write.complete(true) }\n        }\n\n        let ret: Result\n        do {\n            try Task.checkCancellation()\n            ret = try block()\n        } catch {\n            if realm.inWriteTransaction { realm.cancelWriteTransaction() }\n            throw error\n        }\n\n        if realm.inWriteTransaction {\n            let error = await withCheckedContinuation { continuation in\n                realm.commitAsyncWrite(withGrouping: false) { error in\n                    continuation.resume(returning: error)\n                }\n            }\n            if let error {\n                throw error\n            }\n        }\n        return ret\n    }\n\n    /**\n     Updates the Realm and outstanding objects managed by the Realm to point to\n     the most recent data and deliver any applicable notifications.\n\n     This function should be used instead of synchronous ``refresh`` in async\n     functions, as it suspends the calling task (if required) rather than\n     blocking.\n\n     - warning: This function is only supported for main thread and\n                actor-isolated Realms.\n     - returns: Whether there were any updates for the Realm. Note that `true`\n                may be returned even if no data actually changed.\n     */\n    @discardableResult\n    public func asyncRefresh(_isolation: isolated any Actor = #isolation) async -> Bool {\n        guard rlmRealm.actor != nil else {\n            fatalError(\"asyncRefresh() can only be called on main thread or actor-isolated Realms\")\n        }\n        guard let task = RLMRealmRefreshAsync(rlmRealm) else {\n            return false\n        }\n        return await withTaskCancellationHandler {\n            await task.wait()\n        } onCancel: {\n            task.complete(false)\n        }\n    }\n#endif // compiler(<6)\n}\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nprivate func openRealm<A: Actor>(configuration: Realm.Configuration,\n                                 scheduler: RLMScheduler,\n                                 actor: isolated A\n) async throws -> Unchecked<RLMRealm> {\n    let scheduler = RLMScheduler.actor(actor, invoke: actor.invoke, verify: actor.verifier())\n    let rlmConfiguration = configuration.rlmConfiguration\n\n    // If we already have a cached Realm for this actor, just reuse it\n    // If this Realm is open but with a different scheduler, open it synchronously.\n    // The overhead of dispatching to a different thread and back is more expensive\n    // than the fast path of obtaining a new instance for an already open Realm.\n    var realm = RLMGetCachedRealm(rlmConfiguration, scheduler)\n    if realm == nil, let cachedRealm = RLMGetAnyCachedRealm(rlmConfiguration) {\n        try withExtendedLifetime(cachedRealm) {\n            realm = try RLMRealm(configuration: rlmConfiguration, confinedTo: scheduler)\n        }\n    }\n    if let realm = realm {\n        return Unchecked(realm)\n    }\n\n    // We're doing the first open and hitting the expensive path, so do an async\n    // open on a background thread\n    let task = RLMAsyncOpenTask(configuration: rlmConfiguration, confinedTo: scheduler)\n    do {\n        try await task.waitWithCancellationHandler()\n        let realm = task.localRealm!\n        task.localRealm = nil\n        return Unchecked(realm)\n    } catch {\n        // Check if the task was cancelled and if so replace the error\n        // with reporting cancellation\n        try Task.checkCancellation()\n        throw error\n    }\n}\n\n@available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\nprivate protocol TaskWithCancellation: Sendable {\n    func waitWithCancellationHandler() async throws\n    func wait() async throws\n    func cancel()\n}\n\n@available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\nextension TaskWithCancellation {\n    func waitWithCancellationHandler() async throws {\n        do {\n            try await withTaskCancellationHandler {\n                try await wait()\n            } onCancel: {\n                cancel()\n            }\n        } catch {\n            // Check if the task was cancelled and if so replace the error\n            // with reporting cancellation\n            try Task.checkCancellation()\n            throw error\n        }\n    }\n}\nextension RLMAsyncOpenTask: TaskWithCancellation {}\n\n@available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\ninternal extension Actor {\n    func verifier() -> (@Sendable () -> Void) {\n#if compiler(>=5.10)\n        // This was made backdeployable in Xcode 15.3\n        return {\n            self.preconditionIsolated()\n        }\n#else\n        // When possible use the official API for actor checking\n        if #available(macOS 14.0, iOS 17.0, tvOS 17.0, watchOS 10.0, *) {\n            return {\n                self.preconditionIsolated()\n            }\n        }\n\n        // This exploits a hole in Swift's type system to construct a function\n        // which is isolated to the current actor, and then casts away that\n        // information. This results in runtime warnings/aborts if it's called\n        // from outside the actor when actor data race checking is enabled.\n        let fn: () -> Void = { _ = self }\n        return unsafeBitCast(fn, to: (@Sendable () -> Void).self)\n#endif\n    }\n\n    // Asynchronously invoke the given block on the actor. This takes a\n    // non-sendable function because the function is invoked on the same actor\n    // it was defined on, and just goes through some hops in between.\n    nonisolated func invoke(_ fn: @escaping () -> Void) {\n        let fn = unsafeBitCast(fn, to: (@Sendable () -> Void).self)\n        Task {\n            await doInvoke(fn)\n        }\n    }\n\n    private func doInvoke(_ fn: @Sendable () -> Void) {\n        fn()\n    }\n\n    // A helper to invoke a regular isolated sendable function with this actor\n    func invoke<T: Sendable>(_ fn: @Sendable (isolated Self) async throws -> T) async rethrows -> T {\n        try await fn(self)\n    }\n}\n\n/**\n Objects which can be fetched from the Realm - Object or Projection\n */\npublic protocol RealmFetchable: RealmCollectionValue {\n    /// :nodoc:\n    static func className() -> String\n}\n/// :nodoc:\nextension Object: RealmFetchable {}\n/// :nodoc:\nextension Projection: RealmFetchable {\n    /// :nodoc:\n    public static func className() -> String {\n        return Root.className()\n    }\n}\n\n/**\n `Logger` is used for creating your own custom logging logic.\n\n You can define your own logger creating an instance of `Logger` and define the log function which will be\n invoked whenever there is a log message.\n\n ```swift\n let logger = Logger(level: .all) { level, message in\n    print(\"Realm Log - \\(level): \\(message)\")\n }\n ```\n\n Set this custom logger as you default logger using `Logger.shared`.\n\n ```swift\n    Logger.shared = inMemoryLogger\n ```\n\n - note: By default default log threshold level is `.info`, and logging strings are output to Apple System Logger.\n*/\npublic typealias Logger = RLMLogger\nextension Logger {\n    /**\n     Log a message to the supplied level.\n\n     ```swift\n     let logger = Logger(level: .info, logFunction: { level, message in\n         print(\"Realm Log - \\(level): \\(message)\")\n     })\n     logger.log(level: .info, message: \"Info DB: Database opened succesfully\")\n     ```\n\n     - parameter level: The log level for the message.\n     - parameter message: The message to log.\n     */\n    internal func log(level: LogLevel, message: String) {\n        self.logLevel(level, message: message)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/RealmCollection.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\n\n/**\n An iterator for a `RealmCollection` instance.\n */\n@frozen public struct RLMIterator<Element: RealmCollectionValue>: IteratorProtocol {\n    private var generatorBase: NSFastEnumerationIterator\n\n    init(collection: RLMCollection) {\n        generatorBase = NSFastEnumerationIterator(collection)\n    }\n\n    /// Advance to the next element and return it, or `nil` if no next element exists.\n    public mutating func next() -> Element? {\n        guard let next = generatorBase.next() else { return nil }\n        return staticBridgeCast(fromObjectiveC: next) as Element\n    }\n}\n\n/// :nodoc:\npublic protocol _RealmMapValue {\n    /// The key of this element.\n    associatedtype Key: _MapKey\n    /// The value of this element.\n    associatedtype Value: RealmCollectionValue\n}\n\n/**\n An iterator for a `RealmKeyedCollection` instance.\n */\n@frozen public struct RLMMapIterator<Element: _RealmMapValue>: IteratorProtocol {\n    private var generatorBase: NSFastEnumerationIterator\n    private var collection: RLMDictionary<AnyObject, AnyObject>\n\n    init(collection: RLMDictionary<AnyObject, AnyObject>) {\n        self.collection = collection\n        generatorBase = NSFastEnumerationIterator(collection)\n    }\n\n    /// Advance to the next element and return it, or `nil` if no next element exists.\n    public mutating func next() -> Element? {\n        let next = generatorBase.next()\n        if let next = next as? Element.Key {\n            let key: Element.Key = next\n            if let val = collection[key as AnyObject].map(Element.Value._rlmFromObjc(_:)), let val {\n                return SingleMapEntry(key: key, value: val) as? Element\n            }\n        }\n        return nil\n    }\n}\n\n/**\n An iterator for `Map<Key, Value>` which produces `(key: Key, value: Value)` pairs for each entry in the map.\n */\n@frozen public struct RLMKeyValueIterator<Key: _MapKey, Value: RealmCollectionValue>: IteratorProtocol {\n    private var generatorBase: NSFastEnumerationIterator\n    private var collection: RLMDictionary<AnyObject, AnyObject>\n    public typealias Element = (key: Key, value: Value)\n\n    init(collection: RLMDictionary<AnyObject, AnyObject>) {\n        self.collection = collection\n        generatorBase = NSFastEnumerationIterator(collection)\n    }\n\n    /// Advance to the next element and return it, or `nil` if no next element exists.\n    public mutating func next() -> Element? {\n        let next = generatorBase.next()\n        if let key = next as? Key,\n           let value = collection[key as AnyObject].map(Value._rlmFromObjc(_:)), let value {\n            return (key: key, value: value)\n        }\n        return nil\n    }\n}\n\n/**\n A `RealmCollectionChange` value encapsulates information about changes to collections\n that are reported by Realm notifications.\n\n The change information is available in two formats: a simple array of row\n indices in the collection for each type of change, and an array of index paths\n in a requested section suitable for passing directly to `UITableView`'s batch\n update methods.\n\n The arrays of indices in the `.update` case follow `UITableView`'s batching\n conventions, and can be passed as-is to a table view's batch update functions after being converted to index paths.\n For example, for a simple one-section table view, you can do the following:\n\n ```swift\n self.notificationToken = results.observe { changes in\n     switch changes {\n     case .initial:\n         // Results are now populated and can be accessed without blocking the UI\n         self.tableView.reloadData()\n         break\n     case .update(_, let deletions, let insertions, let modifications):\n         // Query results have changed, so apply them to the TableView\n         self.tableView.beginUpdates()\n         self.tableView.insertRows(at: insertions.map { IndexPath(row: $0, section: 0) },\n            with: .automatic)\n         self.tableView.deleteRows(at: deletions.map { IndexPath(row: $0, section: 0) },\n            with: .automatic)\n         self.tableView.reloadRows(at: modifications.map { IndexPath(row: $0, section: 0) },\n            with: .automatic)\n         self.tableView.endUpdates()\n         break\n     case .error(let err):\n         // An error occurred while opening the Realm file on the background worker thread\n         fatalError(\"\\(err)\")\n         break\n     }\n }\n ```\n */\n@frozen public enum RealmCollectionChange<CollectionType> {\n    /**\n     `.initial` indicates that the initial run of the query has completed (if\n     applicable), and the collection can now be used without performing any\n     blocking work.\n     */\n    case initial(CollectionType)\n\n    /**\n     `.update` indicates that a write transaction has been committed which\n     either changed which objects are in the collection, and/or modified one\n     or more of the objects in the collection.\n\n     All three of the change arrays are always sorted in ascending order.\n\n     - parameter deletions:     The indices in the previous version of the collection which were removed from this one.\n     - parameter insertions:    The indices in the new collection which were added in this version.\n     - parameter modifications: The indices of the objects which were modified in the previous version of this collection.\n     */\n    case update(CollectionType, deletions: [Int], insertions: [Int], modifications: [Int])\n\n    /**\n     Errors can no longer occur. This case is unused and will be removed in the\n     next major version.\n     */\n    case error(Error)\n\n    init(value: CollectionType?, change: RLMCollectionChange?, error: Error?) {\n        if let error = error {\n            self = .error(error)\n        } else if let change = change {\n            self = .update(value!,\n                deletions: forceCast(change.deletions, to: [Int].self),\n                insertions: forceCast(change.insertions, to: [Int].self),\n                modifications: forceCast(change.modifications, to: [Int].self))\n        } else {\n            self = .initial(value!)\n        }\n    }\n}\n\nprivate func forceCast<A, U>(_ from: A, to type: U.Type) -> U {\n    return from as! U\n}\n\n/// A type which can be stored in a Realm List, MutableSet, Map, or Results.\n///\n/// Declaring additional types as conforming to this protocol will not make them\n/// actually work. Most of the logic for how to store values in Realm is not\n/// implemented in Swift and there is currently no extension mechanism for\n/// supporting more types.\npublic protocol RealmCollectionValue: Hashable, _HasPersistedType where PersistedType: RealmCollectionValue {\n    // Get the zero/empty/nil value for this type. Used to supply a default\n    // when the user does not declare one in their model.\n    /// :nodoc:\n    static func _rlmDefaultValue() -> Self\n}\n\n\n///  A type which can appear in a Realm collection inside an Optional.\n///\n/// :nodoc:\npublic protocol _RealmCollectionValueInsideOptional: RealmCollectionValue where PersistedType: _RealmCollectionValueInsideOptional {}\n\nextension Int: _RealmCollectionValueInsideOptional {}\nextension Int8: _RealmCollectionValueInsideOptional {}\nextension Int16: _RealmCollectionValueInsideOptional {}\nextension Int32: _RealmCollectionValueInsideOptional {}\nextension Int64: _RealmCollectionValueInsideOptional {}\nextension Float: _RealmCollectionValueInsideOptional {}\nextension Double: _RealmCollectionValueInsideOptional {}\nextension Bool: _RealmCollectionValueInsideOptional {}\nextension String: _RealmCollectionValueInsideOptional {}\nextension Date: _RealmCollectionValueInsideOptional {}\nextension Data: _RealmCollectionValueInsideOptional {}\nextension Decimal128: _RealmCollectionValueInsideOptional {}\nextension ObjectId: _RealmCollectionValueInsideOptional {}\nextension UUID: _RealmCollectionValueInsideOptional {}\nextension AnyRealmValue: RealmCollectionValue {}\nextension Optional: RealmCollectionValue where Wrapped: _RealmCollectionValueInsideOptional {\n    public static func _rlmDefaultValue() -> Self {\n        return .none\n    }\n}\n\n/// :nodoc:\npublic protocol RealmCollectionBase: RandomAccessCollection, LazyCollectionProtocol, CustomStringConvertible, ThreadConfined where Element: RealmCollectionValue {\n    // This typealias was needed with Swift 3.1. It no longer is, but remains\n    // just in case someone was depending on it\n    typealias ElementType = Element\n}\n\n// MARK: - RealmCollection protocol\n\n/**\n A homogenous collection of `Object`s which can be retrieved, filtered, sorted, and operated upon.\n*/\npublic protocol RealmCollection: RealmCollectionBase, Equatable where Iterator == RLMIterator<Element> {\n    // MARK: Properties\n\n    /// The Realm which manages the collection, or `nil` for unmanaged collections.\n    var realm: Realm? { get }\n\n    /**\n     Indicates if the collection can no longer be accessed.\n\n     The collection can no longer be accessed if `invalidate()` is called on the `Realm` that manages the collection.\n     */\n    var isInvalidated: Bool { get }\n\n    /// The number of objects in the collection.\n    var count: Int { get }\n\n    /// A human-readable description of the objects contained in the collection.\n    var description: String { get }\n\n    // MARK: Object Retrieval\n\n    /// Returns the first object in the collection, or `nil` if the collection is empty.\n    var first: Element? { get }\n\n    /// Returns the last object in the collection, or `nil` if the collection is empty.\n    var last: Element? { get }\n\n    // MARK: Index Retrieval\n\n    /**\n     Returns the index of an object in the collection, or `nil` if the object is not present.\n\n     - parameter object: An object.\n     */\n    func index(of object: Element) -> Int?\n\n    /**\n     Returns the index of the first object matching the predicate, or `nil` if no objects match.\n\n     This is only applicable to ordered collections, and will abort if the collection is unordered.\n\n     - parameter predicate: The predicate to use to filter the objects.\n     */\n    func index(matching predicate: NSPredicate) -> Int?\n\n    /**\n     Returns the index of the first object matching the predicate, or `nil` if no objects match.\n\n     This is only applicable to ordered collections, and will abort if the collection is unordered.\n\n     - parameter predicateFormat: A predicate format string, optionally followed by a variable number of arguments.\n     */\n    func index(matching predicateFormat: String, _ args: Any...) -> Int?\n\n    // MARK: Object Retrieval\n\n    /**\n     Returns an array containing the objects in the collection at the indexes specified by a given index set.\n\n     - warning: Throws if an index supplied in the IndexSet is out of bounds.\n\n     - parameter indexes: The indexes in the collection to select objects from.\n     */\n    func objects(at indexes: IndexSet) -> [Element]\n\n    // MARK: Filtering\n\n    /**\n     Returns a `Results` containing all objects matching the given predicate in the collection.\n\n     - parameter predicateFormat: A predicate format string, optionally followed by a variable number of arguments.\n     */\n    func filter(_ predicateFormat: String, _ args: Any...) -> Results<Element>\n\n    /**\n     Returns a `Results` containing all objects matching the given predicate in the collection.\n\n     - parameter predicate: The predicate to use to filter the objects.\n     */\n    func filter(_ predicate: NSPredicate) -> Results<Element>\n\n    // MARK: Sorting\n\n    /**\n     Returns a `Results` containing the objects in the collection, but sorted.\n\n     - warning: Collections may only be sorted by properties of boolean, `Date`, `NSDate`, single and double-precision\n                floating point, integer, and string types.\n\n     - see: `sorted(byKeyPath:ascending:)`\n\n     - parameter sortDescriptors: A sequence of `SortDescriptor`s to sort by.\n     */\n    func sorted<S: Sequence>(by sortDescriptors: S) -> Results<Element> where S.Iterator.Element == SortDescriptor\n\n    /**\n     Returns a `Results` containing distinct objects based on the specified key paths.\n\n     - parameter keyPaths:  The key paths to distinct on.\n     */\n    func distinct<S: Sequence>(by keyPaths: S) -> Results<Element> where S.Iterator.Element == String\n\n    // MARK: Aggregate Operations\n\n    /**\n     Returns the minimum (lowest) value of the given property among all the objects in the collection, or `nil` if the\n     collection is empty.\n\n     - warning: Only a property whose type conforms to the `MinMaxType` protocol can be specified.\n\n     - parameter property: The name of a property whose minimum value is desired.\n     */\n    func min<T: _HasPersistedType>(ofProperty property: String) -> T? where T.PersistedType: MinMaxType\n\n    /**\n     Returns the maximum (highest) value of the given property among all the objects in the collection, or `nil` if the\n     collection is empty.\n\n     - warning: Only a property whose type conforms to the `MinMaxType` protocol can be specified.\n\n     - parameter property: The name of a property whose minimum value is desired.\n     */\n    func max<T: _HasPersistedType>(ofProperty property: String) -> T? where T.PersistedType: MinMaxType\n\n    /**\n    Returns the sum of the given property for objects in the collection, or `nil` if the collection is empty.\n\n    - warning: Only names of properties of a type conforming to the `AddableType` protocol can be used.\n\n    - parameter property: The name of a property conforming to `AddableType` to calculate sum on.\n    */\n    func sum<T: _HasPersistedType>(ofProperty property: String) -> T where T.PersistedType: AddableType\n\n    /**\n     Returns the average value of a given property over all the objects in the collection, or `nil` if\n     the collection is empty.\n\n     - warning: Only a property whose type conforms to the `AddableType` protocol can be specified.\n\n     - parameter property: The name of a property whose values should be summed.\n     */\n    func average<T: _HasPersistedType>(ofProperty property: String) -> T? where T.PersistedType: AddableType\n\n    // MARK: Key-Value Coding\n\n    /**\n     Returns an `Array` containing the results of invoking `valueForKey(_:)` with `key` on each of the collection's\n     objects.\n\n     - parameter key: The name of the property whose values are desired.\n     */\n    func value(forKey key: String) -> Any?\n\n    /**\n     Returns an `Array` containing the results of invoking `valueForKeyPath(_:)` with `keyPath` on each of the\n     collection's objects.\n\n     - parameter keyPath: The key path to the property whose values are desired.\n     */\n    func value(forKeyPath keyPath: String) -> Any?\n\n    /**\n     Invokes `setValue(_:forKey:)` on each of the collection's objects using the specified `value` and `key`.\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter value: The object value.\n     - parameter key:   The name of the property whose value should be set on each object.\n     */\n    func setValue(_ value: Any?, forKey key: String)\n\n    // MARK: Notifications\n\n    /**\n     Registers a block to be called each time the collection changes.\n\n     The block will be asynchronously called with the initial results, and then called again after each write\n     transaction which changes either any of the objects in the collection, or which objects are in the collection.\n\n     The `change` parameter that is passed to the block reports, in the form of indices within the collection, which of\n     the objects were added, removed, or modified during each write transaction. See the `RealmCollectionChange`\n     documentation for more information on the change information supplied and an example of how to use it to update a\n     `UITableView`.\n\n     At the time when the block is called, the collection will be fully evaluated and up-to-date, and as long as you do\n     not perform a write transaction on the same thread or explicitly call `realm.refresh()`, accessing it will never\n     perform blocking work.\n\n     If no queue is given, notifications are delivered via the standard run loop, and so can't be delivered while the\n     run loop is blocked by other activity. If a queue is given, notifications are delivered to that queue instead. When\n     notifications can't be delivered instantly, multiple notifications may be coalesced into a single notification.\n     This can include the notification with the initial collection.\n\n     For example, the following code performs a write transaction immediately after adding the notification block, so\n     there is no opportunity for the initial notification to be delivered first. As a result, the initial notification\n     will reflect the state of the Realm after the write transaction.\n\n     ```swift\n     let dogs = realm.objects(Dog.self)\n     print(\"dogs.count: \\(dogs?.count)\") // => 0\n     let token = dogs.observe { changes in\n         switch changes {\n         case .initial(let dogs):\n             // Will print \"dogs.count: 1\"\n             print(\"dogs.count: \\(dogs.count)\")\n             break\n         case .update:\n             // Will not be hit in this example\n             break\n         case .error:\n             break\n         }\n     }\n     try! realm.write {\n         let dog = Dog()\n         dog.name = \"Rex\"\n         person.dogs.append(dog)\n     }\n     // end of run loop execution context\n     ```\n\n     If no key paths are given, the block will be executed on any insertion,\n     modification, or deletion for all object properties and the properties of\n     any nested, linked objects. If a key path or key paths are provided,\n     then the block will be called for changes which occur only on the\n     provided key paths. For example, if:\n     ```swift\n     class Dog: Object {\n         @Persisted var name: String\n         @Persisted var age: Int\n         @Persisted var toys: List<Toy>\n     }\n     // ...\n     let dogs = realm.objects(Dog.self)\n\n     let token = dogs.observe(keyPaths: [\"name\"]) { changes in\n         switch changes {\n         case .initial(let dogs):\n            // ...\n         case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the\n            // collection is modified\n            // - when an element is inserted or removed\n            //   from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on\n            //   one of the elements.\n         case .error:\n             // ...\n         }\n     }\n     // end of run loop execution context\n     ```\n     - If the observed key path were `[\"toys.brand\"]`, then any insertion or\n     deletion to the `toys` list on any of the collection's elements would trigger the block.\n     Changes to the `brand` value on any `Toy` that is linked to a `Dog` in this\n     collection will trigger the block. Changes to a value other than `brand` on any `Toy` that\n     is linked to a `Dog` in this collection would not trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would also trigger a notification.\n     - If the above example observed the `[\"toys\"]` key path, then any insertion,\n     deletion, or modification to the `toys` list for any element in the collection\n     would trigger the block.\n     Changes to any value on any `Toy` that is linked to a `Dog` in this collection\n     would *not* trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would still trigger a notification.\n\n     - note: Multiple notification tokens on the same object which filter for\n     separate key paths *do not* filter exclusively. If one key path\n     change is satisfied for one notification token, then all notification\n     token blocks for that object will execute.\n\n     You must retain the returned token for as long as you want updates to be sent to the block. To stop receiving\n     updates, call `invalidate()` on the token.\n\n     - warning: This method cannot be called during a write transaction, or when the containing Realm is read-only.\n\n     - parameter keyPaths: Only properties contained in the key paths array will trigger\n                           the block when they are modified. If `nil`, notifications\n                           will be delivered for any property change on the object.\n                           String key paths which do not correspond to a valid a property\n                           will throw an exception. See description above for\n                           more detail on linked properties.\n     - parameter queue: The serial dispatch queue to receive notification on. If\n                        `nil`, notifications are delivered to the current thread.\n     - parameter block: The block to be called whenever a change occurs.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    func observe(keyPaths: [String]?,\n                 on queue: DispatchQueue?,\n                 _ block: @escaping (RealmCollectionChange<Self>) -> Void) -> NotificationToken\n\n#if compiler(<6)\n    /**\n    Registers a block to be called each time the collection changes.\n\n    The block will be asynchronously called with an initial version of the\n    collection, and then called again after each write transaction which changes\n    either any of the objects in the collection, or which objects are in the\n    collection.\n\n    The `actor` parameter passed to the block is the actor which you pass to this\n    function. This parameter is required to isolate the callback to the actor.\n\n    The `change` parameter that is passed to the block reports, in the form of\n    indices within the collection, which of the objects were added, removed, or\n    modified after the previous notification. The `collection` field in the change\n    enum will be isolated to the requested actor, and is safe to use within that\n    actor only. See the ``RealmCollectionChange`` documentation for more\n    information on the change information supplied and an example of how to use it\n    to update a `UITableView`.\n\n    Once the initial notification is delivered, the collection will be fully\n    evaluated and up-to-date, and accessing it will never perform any blocking\n    work. This guarantee holds only as long as you do not perform a write\n    transaction on the same actor as notifications are being delivered to. If you\n    do, accessing the collection before the next notification is delivered may need\n    to rerun the query.\n\n    Notifications are delivered to the given actor's executor. When notifications\n    can't be delivered instantly, multiple notifications may be coalesced into a\n    single notification. This can include the notification with the initial\n    collection: any writes which occur before the initial notification is delivered\n    may not produce change notifications.\n\n    Adding, removing or assigning objects in the collection always produces a\n    notification. By default, modifying the objects which a collection links to\n    (and the objects which those objects link to, if applicable) will also report\n    that index in the collection as being modified. If a non-empty array of\n    keypaths is provided, then only modifications to those keypaths will mark the\n    object as modified. For example:\n\n    ```swift\n    class Dog: Object {\n        @Persisted var name: String\n        @Persisted var age: Int\n        @Persisted var toys: List<Toy>\n    }\n\n    let dogs = realm.objects(Dog.self)\n    let token = await dogs.observe(keyPaths: [\"name\"], on: myActor) { actor, changes in\n        switch changes {\n        case .initial(let dogs):\n            // Query has finished running and dogs can not be used without blocking\n        case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the collection is modified\n            // - when an element is inserted or removed from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on one of the elements.\n        case .error:\n            // Can no longer happen but is left for backwards compatiblity\n        }\n    }\n    ```\n    - If the observed key path were `[\"toys.brand\"]`, then any insertion or\n      deletion to the `toys` list on any of the collection's elements would trigger\n      the block. Changes to the `brand` value on any `Toy` that is linked to a `Dog`\n      in this collection will trigger the block. Changes to a value other than\n      `brand` on any `Toy` that is linked to a `Dog` in this collection would not\n      trigger the block. Any insertion or removal to the `Dog` type collection being\n      observed would also trigger a notification.\n    - If the above example observed the `[\"toys\"]` key path, then any insertion,\n      deletion, or modification to the `toys` list for any element in the collection\n      would trigger the block. Changes to any value on any `Toy` that is linked to a\n      `Dog` in this collection would *not* trigger the block. Any insertion or\n      removal to the `Dog` type collection being observed would still trigger a\n      notification.\n\n    You must retain the returned token for as long as you want updates to be sent\n    to the block. To stop receiving updates, call `invalidate()` on the token.\n\n    - warning: This method cannot be called during a write transaction, or when the containing Realm is read-only.\n\n    - parameter keyPaths: Only properties contained in the key paths array will trigger\n                       the block when they are modified. If `nil` or empty, notifications\n                       will be delivered for any property change on the object.\n                       String key paths which do not correspond to a valid a property\n                       will throw an exception. See description above for\n                       more detail on linked properties.\n    - parameter actor: The actor to isolate the notifications to.\n    - parameter block: The block to be called whenever a change occurs.\n    - returns: A token which must be held for as long as you want updates to be delivered.\n    */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    @_unsafeInheritExecutor\n    func observe<A: Actor>(keyPaths: [String]?,\n                           on actor: A,\n                           _ block: @Sendable @escaping (isolated A, RealmCollectionChange<Self>) -> Void) async -> NotificationToken\n#else\n    /**\n    Registers a block to be called each time the collection changes.\n\n    The block will be asynchronously called with an initial version of the\n    collection, and then called again after each write transaction which changes\n    either any of the objects in the collection, or which objects are in the\n    collection.\n\n    The `actor` parameter passed to the block is the actor which you pass to this\n    function. This parameter is required to isolate the callback to the actor.\n\n    The `change` parameter that is passed to the block reports, in the form of\n    indices within the collection, which of the objects were added, removed, or\n    modified after the previous notification. The `collection` field in the change\n    enum will be isolated to the requested actor, and is safe to use within that\n    actor only. See the ``RealmCollectionChange`` documentation for more\n    information on the change information supplied and an example of how to use it\n    to update a `UITableView`.\n\n    Once the initial notification is delivered, the collection will be fully\n    evaluated and up-to-date, and accessing it will never perform any blocking\n    work. This guarantee holds only as long as you do not perform a write\n    transaction on the same actor as notifications are being delivered to. If you\n    do, accessing the collection before the next notification is delivered may need\n    to rerun the query.\n\n    Notifications are delivered to the given actor's executor. When notifications\n    can't be delivered instantly, multiple notifications may be coalesced into a\n    single notification. This can include the notification with the initial\n    collection: any writes which occur before the initial notification is delivered\n    may not produce change notifications.\n\n    Adding, removing or assigning objects in the collection always produces a\n    notification. By default, modifying the objects which a collection links to\n    (and the objects which those objects link to, if applicable) will also report\n    that index in the collection as being modified. If a non-empty array of\n    keypaths is provided, then only modifications to those keypaths will mark the\n    object as modified. For example:\n\n    ```swift\n    class Dog: Object {\n        @Persisted var name: String\n        @Persisted var age: Int\n        @Persisted var toys: List<Toy>\n    }\n\n    let dogs = realm.objects(Dog.self)\n    let token = await dogs.observe(keyPaths: [\"name\"], on: myActor) { actor, changes in\n        switch changes {\n        case .initial(let dogs):\n            // Query has finished running and dogs can not be used without blocking\n        case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the collection is modified\n            // - when an element is inserted or removed from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on one of the elements.\n        case .error:\n            // Can no longer happen but is left for backwards compatiblity\n        }\n    }\n    ```\n    - If the observed key path were `[\"toys.brand\"]`, then any insertion or\n      deletion to the `toys` list on any of the collection's elements would trigger\n      the block. Changes to the `brand` value on any `Toy` that is linked to a `Dog`\n      in this collection will trigger the block. Changes to a value other than\n      `brand` on any `Toy` that is linked to a `Dog` in this collection would not\n      trigger the block. Any insertion or removal to the `Dog` type collection being\n      observed would also trigger a notification.\n    - If the above example observed the `[\"toys\"]` key path, then any insertion,\n      deletion, or modification to the `toys` list for any element in the collection\n      would trigger the block. Changes to any value on any `Toy` that is linked to a\n      `Dog` in this collection would *not* trigger the block. Any insertion or\n      removal to the `Dog` type collection being observed would still trigger a\n      notification.\n\n    You must retain the returned token for as long as you want updates to be sent\n    to the block. To stop receiving updates, call `invalidate()` on the token.\n\n    - warning: This method cannot be called during a write transaction, or when the containing Realm is read-only.\n\n    - parameter keyPaths: Only properties contained in the key paths array will trigger\n                       the block when they are modified. If `nil` or empty, notifications\n                       will be delivered for any property change on the object.\n                       String key paths which do not correspond to a valid a property\n                       will throw an exception. See description above for\n                       more detail on linked properties.\n    - parameter actor: The actor to isolate the notifications to.\n    - parameter block: The block to be called whenever a change occurs.\n    - returns: A token which must be held for as long as you want updates to be delivered.\n    */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    func observe<A: Actor>(keyPaths: [String]?,\n                           on actor: A,\n                           _isolation: isolated (any Actor)?,\n                           _ block: @Sendable @escaping (isolated A, RealmCollectionChange<Self>) -> Void) async -> NotificationToken\n#endif\n\n    // MARK: Frozen Objects\n\n    /// Returns true if this collection is frozen\n    var isFrozen: Bool { get }\n\n    /**\n     Returns a frozen (immutable) snapshot of this collection.\n\n     The frozen copy is an immutable collection which contains the same data as this collection\n    currently contains, but will not update when writes are made to the containing Realm. Unlike\n    live collections, frozen collections can be accessed from any thread.\n\n     - warning: This method cannot be called during a write transaction, or when the containing\n    Realm is read-only.\n     - warning: Holding onto a frozen collection for an extended period while performing write\n     transaction on the Realm may result in the Realm file growing to large sizes. See\n     `Realm.Configuration.maximumNumberOfActiveVersions` for more information.\n    */\n    func freeze() -> Self\n\n    /**\n     Returns a live (mutable) version of this frozen collection.\n\n     This method resolves a reference to a live copy of the same frozen collection.\n     If called on a live collection, will return itself.\n    */\n    func thaw() -> Self?\n\n    /**\n     Sorts this collection from a given array of sort descriptors and performs sectioning via a\n     user defined callback, returning the result as an instance of `SectionedResults`.\n\n     - parameter sortDescriptors: An array of `SortDescriptor`s to sort by.\n     - parameter keyBlock: A callback which is invoked on each element in the Results collection.\n                           This callback is to return the section key for the element in the collection.\n\n     - note: The primary sort descriptor must be responsible for determining the section key.\n\n     - returns: An instance of `SectionedResults`.\n     */\n    func sectioned<Key: _Persistable>(sortDescriptors: [SortDescriptor],\n                                      _ keyBlock: @escaping ((Element) -> Key)) -> SectionedResults<Key, Element>\n}\n\n// MARK: - Codable\n\nextension RealmCollection where Element: Encodable {\n    /// Encodes the contents of this collection into the given encoder.\n    /// - parameter encoder The encoder to write data to.\n    public func encode(to encoder: Encoder) throws {\n        var container = encoder.unkeyedContainer()\n        for value in self {\n            try container.encode(value)\n        }\n    }\n}\n\n// MARK: - Type-safe queries\n\npublic extension RealmCollection {\n    /**\n     Returns the index of the first object matching the query, or `nil` if no objects match.\n\n     This is only applicable to ordered collections, and will abort if the collection is unordered.\n\n     - Note: This should only be used with classes using the `@Persistable` property declaration.\n\n     - Usage:\n     ```\n     obj.index(matching: { $0.fooCol < 456 })\n     ```\n\n     - Note: See ``Query`` for more information on what query operations are available.\n\n     - parameter isIncluded: The query closure to use to filter the objects.\n     */\n    func index(matching isIncluded: ((Query<Element>) -> Query<Bool>)) -> Int? where Element: _RealmSchemaDiscoverable {\n        let isPrimitive = Element._rlmType != .object\n        return index(matching: isIncluded(Query<Element>(isPrimitive: isPrimitive)).predicate)\n    }\n\n    /**\n     Returns a `Results` containing all objects matching the given query in the collection.\n\n     - Note: This should only be used with classes using the `@Persistable` property declaration.\n\n     - Usage:\n     ```\n     myCol.where {\n        ($0.fooCol > 5) && ($0.barCol == \"foobar\")\n     }\n     ```\n\n     - Note: See ``Query`` for more information on what query operations are available.\n\n     - parameter isIncluded: The query closure to use to filter the objects.\n     */\n    func `where`(_ isIncluded: ((Query<Element>) -> Query<Bool>)) -> Results<Element> {\n        return filter(isIncluded(Query()).predicate)\n    }\n}\n\n// MARK: Collection protocol\n\npublic extension RealmCollection {\n    /// The position of the first element in a non-empty collection.\n    /// Identical to endIndex in an empty collection.\n    var startIndex: Int { 0 }\n\n    /// The collection's \"past the end\" position.\n    /// endIndex is not a valid argument to subscript, and is always reachable from startIndex by\n    /// zero or more applications of successor().\n    var endIndex: Int { count }\n\n    /// Returns the position immediately after the given index.\n    /// - parameter i: A valid index of the collection. `i` must be less than `endIndex`.\n    func index(after i: Int) -> Int { return i + 1 }\n    /// Returns the position immediately before the given index.\n    /// - parameter i: A valid index of the collection. `i` must be greater than `startIndex`.\n    func index(before i: Int) -> Int { return i - 1 }\n}\n\n// MARK: - Aggregation\n\n/**\n Extension for RealmCollections where the Value is of an Object type that\n enables aggregatable operations.\n */\npublic extension RealmCollection where Element: ObjectBase {\n    /**\n     Returns the minimum (lowest) value of the given property among all the objects in the collection, or `nil` if the\n     collection is empty.\n\n     - warning: Only a property whose type conforms to the `MinMaxType` protocol can be specified.\n\n     - parameter keyPath: The keyPath of a property whose minimum value is desired.\n     */\n    func min<T: _HasPersistedType>(of keyPath: KeyPath<Element, T>) -> T? where T.PersistedType: MinMaxType {\n        min(ofProperty: _name(for: keyPath))\n    }\n\n    /**\n     Returns the maximum (highest) value of the given property among all the objects in the collection, or `nil` if the\n     collection is empty.\n\n     - warning: Only a property whose type conforms to the `MinMaxType` protocol can be specified.\n\n     - parameter keyPath: The keyPath of a property whose minimum value is desired.\n     */\n    func max<T: _HasPersistedType>(of keyPath: KeyPath<Element, T>) -> T? where T.PersistedType: MinMaxType {\n        max(ofProperty: _name(for: keyPath))\n    }\n\n    /**\n    Returns the sum of the given property for objects in the collection, or `nil` if the collection is empty.\n\n    - warning: Only names of properties of a type conforming to the `AddableType` protocol can be used.\n\n    - parameter keyPath: The keyPath of a property conforming to `AddableType` to calculate sum on.\n    */\n    func sum<T: _HasPersistedType>(of keyPath: KeyPath<Element, T>) -> T where T.PersistedType: AddableType {\n        sum(ofProperty: _name(for: keyPath))\n    }\n\n    /**\n     Returns the average value of a given property over all the objects in the collection, or `nil` if\n     the collection is empty.\n\n     - warning: Only a property whose type conforms to the `AddableType` protocol can be specified.\n\n     - parameter keyPath: The keyPath of a property whose values should be summed.\n     */\n    func average<T: _HasPersistedType>(of keyPath: KeyPath<Element, T>) -> T? where T.PersistedType: AddableType {\n        average(ofProperty: _name(for: keyPath))\n    }\n\n    /**\n     Sorts and sections this collection from a given property key path, returning the result\n     as an instance of `SectionedResults`. For every unique value retrieved from the\n     keyPath a section key will be generated.\n\n     - parameter keyPath: The property key path to sort & section on.\n     - parameter ascending: The direction to sort in.\n\n     - returns: An instance of `SectionedResults`.\n     */\n    func sectioned<Key: _Persistable>(by keyPath: KeyPath<Element, Key>,\n                                      ascending: Bool = true) -> SectionedResults<Key, Element> where Element: ObjectBase {\n        return sectioned(sortDescriptors: [.init(keyPath: _name(for: keyPath), ascending: ascending)], {\n            return $0[keyPath: keyPath]\n        })\n    }\n\n    /**\n     Sorts and sections this collection from a given property key path, returning the result\n     as an instance of `SectionedResults`. For every unique value retrieved from the\n     keyPath a section key will be generated.\n\n     - parameter keyPath: The property key path to sort & section on.\n     - parameter sortDescriptors: An array of `SortDescriptor`s to sort by.\n\n     - note: The primary sort descriptor must be responsible for determining the section key.\n\n     - returns: An instance of `SectionedResults`.\n     */\n    func sectioned<Key: _Persistable>(by keyPath: KeyPath<Element, Key>,\n                                      sortDescriptors: [SortDescriptor]) -> SectionedResults<Key, Element> where Element: ObjectBase {\n        guard let sortDescriptor = sortDescriptors.first else {\n            throwRealmException(\"Can not section Results with empty sortDescriptor parameter.\")\n        }\n        let keyPathString = _name(for: keyPath)\n        if keyPathString != sortDescriptor.keyPath {\n            throwRealmException(\"The section key path must match the primary sort descriptor.\")\n        }\n        return sectioned(sortDescriptors: sortDescriptors, { $0[keyPath: keyPath] })\n    }\n\n    /**\n     Sorts this collection from a given array of `SortDescriptor`'s and performs sectioning\n     via a user defined callback function.\n\n     - parameter block: A callback which is invoked on each element in the collection.\n                        This callback is to return the section key for the element in the collection.\n     - parameter sortDescriptors: An array of `SortDescriptor`s to sort by.\n\n     - note: The primary sort descriptor must be responsible for determining the section key.\n\n     - returns: An instance of `SectionedResults`.\n     */\n    func sectioned<Key: _Persistable>(by block: @escaping ((Element) -> Key),\n                                      sortDescriptors: [SortDescriptor]) -> SectionedResults<Key, Element> where Element: ObjectBase {\n        return sectioned(sortDescriptors: sortDescriptors, block)\n    }\n}\n\npublic extension RealmCollection where Element.PersistedType: MinMaxType {\n    /**\n     Returns the minimum (lowest) value of the collection, or `nil` if the collection is empty.\n     */\n    func min() -> Element? {\n        return min(ofProperty: \"self\")\n    }\n    /**\n     Returns the maximum (highest) value of the collection, or `nil` if the collection is empty.\n     */\n    func max() -> Element? {\n        return max(ofProperty: \"self\")\n    }\n}\n\npublic extension RealmCollection where Element.PersistedType: AddableType {\n    /**\n     Returns the sum of the values in the collection, or `nil` if the collection is empty.\n     */\n    func sum() -> Element {\n        return sum(ofProperty: \"self\")\n    }\n    /**\n     Returns the average of all of the values in the collection.\n     */\n    func average<T: _HasPersistedType>() -> T? where T.PersistedType: AddableType {\n        return average(ofProperty: \"self\")\n    }\n}\n\n// MARK: Sort and distinct\n\n/**\n Extension for RealmCollections where the Value is of an Object type that\n enables sortable operations.\n */\npublic extension RealmCollection where Element: KeypathSortable {\n    /**\n     Returns a `Results` containing the objects in the collection, but sorted.\n\n     Objects are sorted based on the values of the given key path. For example, to sort a collection of `Student`s from\n     youngest to oldest based on their `age` property, you might call\n     `students.sorted(byKeyPath: \"age\", ascending: true)`.\n\n     - warning: Collections may only be sorted by properties of boolean, `Date`, `NSDate`, single and double-precision\n                floating point, integer, and string types.\n\n     - parameter keyPath:   The key path to sort by.\n     - parameter ascending: The direction to sort in.\n     */\n    func sorted(byKeyPath keyPath: String, ascending: Bool = true) -> Results<Element> {\n        sorted(by: [SortDescriptor(keyPath: keyPath, ascending: ascending)])\n    }\n\n    /**\n     Returns a `Results` containing the objects in the collection, but sorted.\n\n     Objects are sorted based on the values of the given key path. For example, to sort a collection of `Student`s from\n     youngest to oldest based on their `age` property, you might call\n     `students.sorted(byKeyPath: \"age\", ascending: true)`.\n\n     - warning: Collections may only be sorted by properties of boolean, `Date`, `NSDate`, single and double-precision\n                floating point, integer, and string types.\n\n     - parameter keyPath:   The key path to sort by.\n     - parameter ascending: The direction to sort in.\n     */\n    func sorted<T: _HasPersistedType>(by keyPath: KeyPath<Element, T>, ascending: Bool = true) -> Results<Element> where T.PersistedType: SortableType, Element: ObjectBase {\n        sorted(by: [SortDescriptor(keyPath: keyPath, ascending: ascending)])\n    }\n\n    /**\n     Returns a `Results` containing distinct objects based on the specified key paths\n\n     - parameter keyPaths: The key paths used produce distinct results\n     */\n    func distinct<S: Sequence>(by keyPaths: S) -> Results<Element>\n        where S.Iterator.Element == PartialKeyPath<Element>, Element: ObjectBase {\n            return distinct(by: keyPaths.map(_name(for:)))\n    }\n\n}\n\npublic extension RealmCollection where Element.PersistedType: SortableType {\n    /**\n     Returns a `Results` containing the objects in the collection, but sorted.\n\n     Objects are sorted based on their values. For example, to sort a collection of `Date`s from\n     neweset to oldest based, you might call `dates.sorted(ascending: true)`.\n\n     - parameter ascending: The direction to sort in.\n     */\n    func sorted(ascending: Bool = true) -> Results<Element> {\n        sorted(by: [SortDescriptor(keyPath: \"self\", ascending: ascending)])\n    }\n\n    /**\n     Returns a `Results` containing the distinct values in the collection.\n     */\n    func distinct() -> Results<Element> {\n        return distinct(by: [\"self\"])\n    }\n}\n\n// MARK: - Sectioned Results on primitives\n\npublic extension RealmCollection {\n    /**\n     Sorts this collection in ascending or descending order and performs sectioning\n     via a user defined callback function.\n\n     - parameter block: A callback which is invoked on each element in the collection.\n                        This callback is to return the section key for the element in the collection.\n     - parameter ascending: The direction to sort in.\n\n     - returns: An instance of `SectionedResults`.\n     */\n    func sectioned<Key: _Persistable>(by block: @escaping ((Element) -> Key),\n                                      ascending: Bool = true) -> SectionedResults<Key, Element> {\n        sectioned(sortDescriptors: [.init(keyPath: \"self\", ascending: ascending)], block)\n    }\n}\n\n// MARK: - NSPredicate builders\n\npublic extension RealmCollection {\n    /**\n     Returns the index of the first object matching the given predicate, or `nil` if no objects match.\n\n     - parameter predicateFormat: A predicate format string, optionally followed by a variable number of arguments.\n     */\n    func index(matching predicateFormat: String, _ args: Any...) -> Int? {\n        return index(matching: NSPredicate(format: predicateFormat, argumentArray: unwrapOptionals(in: args)))\n    }\n\n    /**\n     Returns a `Results` containing all objects matching the given predicate in the collection.\n\n     - parameter predicateFormat: A predicate format string, optionally followed by a variable number of arguments.\n     */\n    func filter(_ predicateFormat: String, _ args: Any...) -> Results<Element> {\n        return filter(NSPredicate(format: predicateFormat, argumentArray: unwrapOptionals(in: args)))\n    }\n}\n\n// MARK: - Observation\n\npublic extension RealmCollection {\n    /**\n     Registers a block to be called each time the collection changes.\n\n     The block will be asynchronously called with the initial results, and then called again after each write\n     transaction which changes either any of the objects in the collection, or which objects are in the collection.\n\n     The `change` parameter that is passed to the block reports, in the form of indices within the collection, which of\n     the objects were added, removed, or modified during each write transaction. See the `RealmCollectionChange`\n     documentation for more information on the change information supplied and an example of how to use it to update a\n     `UITableView`.\n\n     At the time when the block is called, the collection will be fully evaluated and up-to-date, and as long as you do\n     not perform a write transaction on the same thread or explicitly call `realm.refresh()`, accessing it will never\n     perform blocking work.\n\n     If no queue is given, notifications are delivered via the standard run loop, and so can't be delivered while the\n     run loop is blocked by other activity. If a queue is given, notifications are delivered to that queue instead. When\n     notifications can't be delivered instantly, multiple notifications may be coalesced into a single notification.\n     This can include the notification with the initial collection.\n\n     For example, the following code performs a write transaction immediately after adding the notification block, so\n     there is no opportunity for the initial notification to be delivered first. As a result, the initial notification\n     will reflect the state of the Realm after the write transaction.\n\n     ```swift\n     let dogs = realm.objects(Dog.self)\n     print(\"dogs.count: \\(dogs?.count)\") // => 0\n     let token = dogs.observe { changes in\n         switch changes {\n         case .initial(let dogs):\n             // Will print \"dogs.count: 1\"\n             print(\"dogs.count: \\(dogs.count)\")\n             break\n         case .update:\n             // Will not be hit in this example\n             break\n         case .error:\n             break\n         }\n     }\n     try! realm.write {\n         let dog = Dog()\n         dog.name = \"Rex\"\n         person.dogs.append(dog)\n     }\n     // end of run loop execution context\n     ```\n\n     If no key paths are given, the block will be executed on any insertion,\n     modification, or deletion for all object properties and the properties of\n     any nested, linked objects. If a key path or key paths are provided,\n     then the block will be called for changes which occur only on the\n     provided key paths. For example, if:\n     ```swift\n     class Dog: Object {\n         @Persisted var name: String\n         @Persisted var age: Int\n         @Persisted var toys: List<Toy>\n     }\n     // ...\n     let dogs = realm.objects(Dog.self)\n\n     let token = dogs.observe(keyPaths: [\\Dog.name]) { changes in\n         switch changes {\n         case .initial(let dogs):\n            // ...\n         case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the\n            // collection is modified\n            // - when an element is inserted or removed\n            //   from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on\n            //   one of the elements.\n         case .error:\n             // ...\n         }\n     }\n     // end of run loop execution context\n     ```\n     - If the observed key path were `[\\Dog.toys.brand]`, then any insertion or\n     deletion to the `toys` list on any of the collection's elements would trigger the block.\n     Changes to the `brand` value on any `Toy` that is linked to a `Dog` in this\n     collection will trigger the block. Changes to a value other than `brand` on any `Toy` that\n     is linked to a `Dog` in this collection would not trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would also trigger a notification.\n     - If the above example observed the `[\\Dog.toys]` key path, then any insertion,\n     deletion, or modification to the `toys` list for any element in the collection\n     would trigger the block.\n     Changes to any value on any `Toy` that is linked to a `Dog` in this collection\n     would *not* trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would still trigger a notification.\n\n     - note: Multiple notification tokens on the same object which filter for\n     separate key paths *do not* filter exclusively. If one key path\n     change is satisfied for one notification token, then all notification\n     token blocks for that object will execute.\n\n     You must retain the returned token for as long as you want updates to be sent to the block. To stop receiving\n     updates, call `invalidate()` on the token.\n\n     - warning: This method cannot be called during a write transaction, or when the containing Realm is read-only.\n\n     - parameter keyPaths: Only properties contained in the key paths array will trigger\n                           the block when they are modified. If `nil`, notifications\n                           will be delivered for any property change on the object.\n                           See description above for more detail on linked properties.\n     - parameter queue: The serial dispatch queue to receive notification on. If\n                        `nil`, notifications are delivered to the current thread.\n     - parameter block: The block to be called whenever a change occurs.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    func observe(keyPaths: [String]? = nil,\n                 on queue: DispatchQueue? = nil,\n                 _ block: @escaping (RealmCollectionChange<Self>) -> Void) -> NotificationToken {\n        return self.observe(keyPaths: keyPaths, on: queue, block)\n    }\n\n#if compiler(<6)\n    /**\n    Registers a block to be called each time the collection changes.\n\n    The block will be asynchronously called with an initial version of the\n    collection, and then called again after each write transaction which changes\n    either any of the objects in the collection, or which objects are in the\n    collection.\n\n    The `actor` parameter passed to the block is the actor which you pass to this\n    function. This parameter is required to isolate the callback to the actor.\n\n    The `change` parameter that is passed to the block reports, in the form of\n    indices within the collection, which of the objects were added, removed, or\n    modified after the previous notification. The `collection` field in the change\n    enum will be isolated to the requested actor, and is safe to use within that\n    actor only. See the ``RealmCollectionChange`` documentation for more\n    information on the change information supplied and an example of how to use it\n    to update a `UITableView`.\n\n    Once the initial notification is delivered, the collection will be fully\n    evaluated and up-to-date, and accessing it will never perform any blocking\n    work. This guarantee holds only as long as you do not perform a write\n    transaction on the same actor as notifications are being delivered to. If you\n    do, accessing the collection before the next notification is delivered may need\n    to rerun the query.\n\n    Notifications are delivered to the given actor's executor. When notifications\n    can't be delivered instantly, multiple notifications may be coalesced into a\n    single notification. This can include the notification with the initial\n    collection: any writes which occur before the initial notification is delivered\n    may not produce change notifications.\n\n    Adding, removing or assigning objects in the collection always produces a\n    notification. By default, modifying the objects which a collection links to\n    (and the objects which those objects link to, if applicable) will also report\n    that index in the collection as being modified. If a non-empty array of\n    keypaths is provided, then only modifications to those keypaths will mark the\n    object as modified. For example:\n\n    ```swift\n    class Dog: Object {\n        @Persisted var name: String\n        @Persisted var age: Int\n        @Persisted var toys: List<Toy>\n    }\n\n    let dogs = realm.objects(Dog.self)\n    let token = await dogs.observe(keyPaths: [\"name\"], on: myActor) { actor, changes in\n        switch changes {\n        case .initial(let dogs):\n            // Query has finished running and dogs can not be used without blocking\n        case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the collection is modified\n            // - when an element is inserted or removed from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on one of the elements.\n        case .error:\n            // Can no longer happen but is left for backwards compatiblity\n        }\n    }\n    ```\n    - If the observed key path were `[\"toys.brand\"]`, then any insertion or\n      deletion to the `toys` list on any of the collection's elements would trigger\n      the block. Changes to the `brand` value on any `Toy` that is linked to a `Dog`\n      in this collection will trigger the block. Changes to a value other than\n      `brand` on any `Toy` that is linked to a `Dog` in this collection would not\n      trigger the block. Any insertion or removal to the `Dog` type collection being\n      observed would also trigger a notification.\n    - If the above example observed the `[\"toys\"]` key path, then any insertion,\n      deletion, or modification to the `toys` list for any element in the collection\n      would trigger the block. Changes to any value on any `Toy` that is linked to a\n      `Dog` in this collection would *not* trigger the block. Any insertion or\n      removal to the `Dog` type collection being observed would still trigger a\n      notification.\n\n    You must retain the returned token for as long as you want updates to be sent\n    to the block. To stop receiving updates, call `invalidate()` on the token.\n\n    - warning: This method cannot be called during a write transaction, or when the containing Realm is read-only.\n\n    - parameter keyPaths: Only properties contained in the key paths array will trigger\n                       the block when they are modified. If `nil` or empty, notifications\n                       will be delivered for any property change on the object.\n                       String key paths which do not correspond to a valid a property\n                       will throw an exception. See description above for\n                       more detail on linked properties.\n    - parameter actor: The actor to isolate the notifications to.\n    - parameter block: The block to be called whenever a change occurs.\n    - returns: A token which must be held for as long as you want updates to be delivered.\n    */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    @_unsafeInheritExecutor\n    func observe<A: Actor>(keyPaths: [String]? = nil,\n                           on actor: A,\n                           _ block: @Sendable @escaping (isolated A, RealmCollectionChange<Self>) -> Void) async -> NotificationToken {\n        await self.observe(keyPaths: keyPaths, on: actor, block)\n    }\n#else\n    /**\n    Registers a block to be called each time the collection changes.\n\n    The block will be asynchronously called with an initial version of the\n    collection, and then called again after each write transaction which changes\n    either any of the objects in the collection, or which objects are in the\n    collection.\n\n    The `actor` parameter passed to the block is the actor which you pass to this\n    function. This parameter is required to isolate the callback to the actor.\n\n    The `change` parameter that is passed to the block reports, in the form of\n    indices within the collection, which of the objects were added, removed, or\n    modified after the previous notification. The `collection` field in the change\n    enum will be isolated to the requested actor, and is safe to use within that\n    actor only. See the ``RealmCollectionChange`` documentation for more\n    information on the change information supplied and an example of how to use it\n    to update a `UITableView`.\n\n    Once the initial notification is delivered, the collection will be fully\n    evaluated and up-to-date, and accessing it will never perform any blocking\n    work. This guarantee holds only as long as you do not perform a write\n    transaction on the same actor as notifications are being delivered to. If you\n    do, accessing the collection before the next notification is delivered may need\n    to rerun the query.\n\n    Notifications are delivered to the given actor's executor. When notifications\n    can't be delivered instantly, multiple notifications may be coalesced into a\n    single notification. This can include the notification with the initial\n    collection: any writes which occur before the initial notification is delivered\n    may not produce change notifications.\n\n    Adding, removing or assigning objects in the collection always produces a\n    notification. By default, modifying the objects which a collection links to\n    (and the objects which those objects link to, if applicable) will also report\n    that index in the collection as being modified. If a non-empty array of\n    keypaths is provided, then only modifications to those keypaths will mark the\n    object as modified. For example:\n\n    ```swift\n    class Dog: Object {\n        @Persisted var name: String\n        @Persisted var age: Int\n        @Persisted var toys: List<Toy>\n    }\n\n    let dogs = realm.objects(Dog.self)\n    let token = await dogs.observe(keyPaths: [\"name\"], on: myActor) { actor, changes in\n        switch changes {\n        case .initial(let dogs):\n            // Query has finished running and dogs can not be used without blocking\n        case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the collection is modified\n            // - when an element is inserted or removed from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on one of the elements.\n        case .error:\n            // Can no longer happen but is left for backwards compatiblity\n        }\n    }\n    ```\n    - If the observed key path were `[\"toys.brand\"]`, then any insertion or\n      deletion to the `toys` list on any of the collection's elements would trigger\n      the block. Changes to the `brand` value on any `Toy` that is linked to a `Dog`\n      in this collection will trigger the block. Changes to a value other than\n      `brand` on any `Toy` that is linked to a `Dog` in this collection would not\n      trigger the block. Any insertion or removal to the `Dog` type collection being\n      observed would also trigger a notification.\n    - If the above example observed the `[\"toys\"]` key path, then any insertion,\n      deletion, or modification to the `toys` list for any element in the collection\n      would trigger the block. Changes to any value on any `Toy` that is linked to a\n      `Dog` in this collection would *not* trigger the block. Any insertion or\n      removal to the `Dog` type collection being observed would still trigger a\n      notification.\n\n    You must retain the returned token for as long as you want updates to be sent\n    to the block. To stop receiving updates, call `invalidate()` on the token.\n\n    - warning: This method cannot be called during a write transaction, or when the containing Realm is read-only.\n\n    - parameter keyPaths: Only properties contained in the key paths array will trigger\n                       the block when they are modified. If `nil` or empty, notifications\n                       will be delivered for any property change on the object.\n                       String key paths which do not correspond to a valid a property\n                       will throw an exception. See description above for\n                       more detail on linked properties.\n    - parameter actor: The actor to isolate the notifications to.\n    - parameter block: The block to be called whenever a change occurs.\n    - returns: A token which must be held for as long as you want updates to be delivered.\n    */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    func observe<A: Actor>(keyPaths: [String]? = nil,\n                           on actor: A,\n                           _isolation: isolated (any Actor)? = #isolation,\n                           _ block: @Sendable @escaping (isolated A, RealmCollectionChange<Self>) -> Void) async -> NotificationToken {\n        await self.observe(keyPaths: keyPaths, on: actor, _isolation: _isolation, block)\n    }\n#endif\n}\n\npublic extension RealmCollection where Element: ObjectBase {\n    /**\n     Registers a block to be called each time the collection changes.\n\n     The block will be asynchronously called with the initial results, and then called again after each write\n     transaction which changes either any of the objects in the collection, or which objects are in the collection.\n\n     The `change` parameter that is passed to the block reports, in the form of indices within the collection, which of\n     the objects were added, removed, or modified during each write transaction. See the `RealmCollectionChange`\n     documentation for more information on the change information supplied and an example of how to use it to update a\n     `UITableView`.\n\n     At the time when the block is called, the collection will be fully evaluated and up-to-date, and as long as you do\n     not perform a write transaction on the same thread or explicitly call `realm.refresh()`, accessing it will never\n     perform blocking work.\n\n     If no queue is given, notifications are delivered via the standard run loop, and so can't be delivered while the\n     run loop is blocked by other activity. If a queue is given, notifications are delivered to that queue instead. When\n     notifications can't be delivered instantly, multiple notifications may be coalesced into a single notification.\n     This can include the notification with the initial collection.\n\n     For example, the following code performs a write transaction immediately after adding the notification block, so\n     there is no opportunity for the initial notification to be delivered first. As a result, the initial notification\n     will reflect the state of the Realm after the write transaction.\n\n     ```swift\n     let dogs = realm.objects(Dog.self)\n     print(\"dogs.count: \\(dogs?.count)\") // => 0\n     let token = dogs.observe { changes in\n         switch changes {\n         case .initial(let dogs):\n             // Will print \"dogs.count: 1\"\n             print(\"dogs.count: \\(dogs.count)\")\n             break\n         case .update:\n             // Will not be hit in this example\n             break\n         case .error:\n             break\n         }\n     }\n     try! realm.write {\n         let dog = Dog()\n         dog.name = \"Rex\"\n         person.dogs.append(dog)\n     }\n     // end of run loop execution context\n     ```\n\n     If no key paths are given, the block will be executed on any insertion,\n     modification, or deletion for all object properties and the properties of\n     any nested, linked objects. If a key path or key paths are provided,\n     then the block will be called for changes which occur only on the\n     provided key paths. For example, if:\n     ```swift\n     class Dog: Object {\n         @Persisted var name: String\n         @Persisted var age: Int\n         @Persisted var toys: List<Toy>\n     }\n     // ...\n     let dogs = realm.objects(Dog.self)\n\n     let token = dogs.observe(keyPaths: [\\Dog.name]) { changes in\n         switch changes {\n         case .initial(let dogs):\n            // ...\n         case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the\n            // collection is modified\n            // - when an element is inserted or removed\n            //   from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on\n            //   one of the elements.\n         case .error:\n             // ...\n         }\n     }\n     // end of run loop execution context\n     ```\n     - If the observed key path were `[\\Dog.toys.brand]`, then any insertion or\n     deletion to the `toys` list on any of the collection's elements would trigger the block.\n     Changes to the `brand` value on any `Toy` that is linked to a `Dog` in this\n     collection will trigger the block. Changes to a value other than `brand` on any `Toy` that\n     is linked to a `Dog` in this collection would not trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would also trigger a notification.\n     - If the above example observed the `[\\Dog.toys]` key path, then any insertion,\n     deletion, or modification to the `toys` list for any element in the collection\n     would trigger the block.\n     Changes to any value on any `Toy` that is linked to a `Dog` in this collection\n     would *not* trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would still trigger a notification.\n\n     - note: Multiple notification tokens on the same object which filter for\n     separate key paths *do not* filter exclusively. If one key path\n     change is satisfied for one notification token, then all notification\n     token blocks for that object will execute.\n\n     You must retain the returned token for as long as you want updates to be sent to the block. To stop receiving\n     updates, call `invalidate()` on the token.\n\n     - warning: This method cannot be called during a write transaction, or when the containing Realm is read-only.\n\n     - parameter keyPaths: Only properties contained in the key paths array will trigger\n                           the block when they are modified. See description above for more detail on linked properties.\n     - parameter queue: The serial dispatch queue to receive notification on. If\n                        `nil`, notifications are delivered to the current thread.\n     - parameter block: The block to be called whenever a change occurs.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    func observe(keyPaths: [PartialKeyPath<Element>],\n                 on queue: DispatchQueue? = nil,\n                 _ block: @escaping (RealmCollectionChange<Self>) -> Void) -> NotificationToken {\n        return self.observe(keyPaths: keyPaths.map(_name(for:)), on: queue, block)\n    }\n\n#if compiler(<6)\n    /**\n    Registers a block to be called each time the collection changes.\n\n    The block will be asynchronously called with an initial version of the\n    collection, and then called again after each write transaction which changes\n    either any of the objects in the collection, or which objects are in the\n    collection.\n\n    The `actor` parameter passed to the block is the actor which you pass to this\n    function. This parameter is required to isolate the callback to the actor.\n\n    The `change` parameter that is passed to the block reports, in the form of\n    indices within the collection, which of the objects were added, removed, or\n    modified after the previous notification. The `collection` field in the change\n    enum will be isolated to the requested actor, and is safe to use within that\n    actor only. See the ``RealmCollectionChange`` documentation for more\n    information on the change information supplied and an example of how to use it\n    to update a `UITableView`.\n\n    Once the initial notification is delivered, the collection will be fully\n    evaluated and up-to-date, and accessing it will never perform any blocking\n    work. This guarantee holds only as long as you do not perform a write\n    transaction on the same actor as notifications are being delivered to. If you\n    do, accessing the collection before the next notification is delivered may need\n    to rerun the query.\n\n    Notifications are delivered to the given actor's executor. When notifications\n    can't be delivered instantly, multiple notifications may be coalesced into a\n    single notification. This can include the notification with the initial\n    collection: any writes which occur before the initial notification is delivered\n    may not produce change notifications.\n\n    Adding, removing or assigning objects in the collection always produces a\n    notification. By default, modifying the objects which a collection links to\n    (and the objects which those objects link to, if applicable) will also report\n    that index in the collection as being modified. If a non-empty array of\n    keypaths is provided, then only modifications to those keypaths will mark the\n    object as modified. For example:\n\n    ```swift\n    class Dog: Object {\n        @Persisted var name: String\n        @Persisted var age: Int\n        @Persisted var toys: List<Toy>\n    }\n\n    let dogs = realm.objects(Dog.self)\n    let token = await dogs.observe(keyPaths: [\\.name], on: myActor) { actor, changes in\n        switch changes {\n        case .initial(let dogs):\n            // Query has finished running and dogs can not be used without blocking\n        case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the collection is modified\n            // - when an element is inserted or removed from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on one of the elements.\n        case .error:\n            // Can no longer happen but is left for backwards compatiblity\n        }\n    }\n    ```\n    - If the observed key path were `[\\.toys.brand]`, then any insertion or\n      deletion to the `toys` list on any of the collection's elements would trigger\n      the block. Changes to the `brand` value on any `Toy` that is linked to a `Dog`\n      in this collection will trigger the block. Changes to a value other than\n      `brand` on any `Toy` that is linked to a `Dog` in this collection would not\n      trigger the block. Any insertion or removal to the `Dog` type collection being\n      observed would also trigger a notification.\n    - If the above example observed the `[\\.toys]` key path, then any insertion,\n      deletion, or modification to the `toys` list for any element in the collection\n      would trigger the block. Changes to any value on any `Toy` that is linked to a\n      `Dog` in this collection would *not* trigger the block. Any insertion or\n      removal to the `Dog` type collection being observed would still trigger a\n      notification.\n\n    You must retain the returned token for as long as you want updates to be sent\n    to the block. To stop receiving updates, call `invalidate()` on the token.\n\n    - warning: This method cannot be called during a write transaction, or when the containing Realm is read-only.\n\n    - parameter keyPaths: Only properties contained in the key paths array will trigger\n                       the block when they are modified. If empty, notifications\n                       will be delivered for any property change on the object.\n                       String key paths which do not correspond to a valid a property\n                       will throw an exception. See description above for\n                       more detail on linked properties.\n    - parameter actor: The actor to isolate the notifications to.\n    - parameter block: The block to be called whenever a change occurs.\n    - returns: A token which must be held for as long as you want updates to be delivered.\n    */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    @_unsafeInheritExecutor\n    func observe<A: Actor>(keyPaths: [PartialKeyPath<Element>], on actor: A,\n                           _ block: @Sendable @escaping (isolated A, RealmCollectionChange<Self>) -> Void) async -> NotificationToken {\n        await observe(keyPaths: keyPaths.map(_name(for:)), on: actor, block)\n    }\n#else\n    /**\n    Registers a block to be called each time the collection changes.\n\n    The block will be asynchronously called with an initial version of the\n    collection, and then called again after each write transaction which changes\n    either any of the objects in the collection, or which objects are in the\n    collection.\n\n    The `actor` parameter passed to the block is the actor which you pass to this\n    function. This parameter is required to isolate the callback to the actor.\n\n    The `change` parameter that is passed to the block reports, in the form of\n    indices within the collection, which of the objects were added, removed, or\n    modified after the previous notification. The `collection` field in the change\n    enum will be isolated to the requested actor, and is safe to use within that\n    actor only. See the ``RealmCollectionChange`` documentation for more\n    information on the change information supplied and an example of how to use it\n    to update a `UITableView`.\n\n    Once the initial notification is delivered, the collection will be fully\n    evaluated and up-to-date, and accessing it will never perform any blocking\n    work. This guarantee holds only as long as you do not perform a write\n    transaction on the same actor as notifications are being delivered to. If you\n    do, accessing the collection before the next notification is delivered may need\n    to rerun the query.\n\n    Notifications are delivered to the given actor's executor. When notifications\n    can't be delivered instantly, multiple notifications may be coalesced into a\n    single notification. This can include the notification with the initial\n    collection: any writes which occur before the initial notification is delivered\n    may not produce change notifications.\n\n    Adding, removing or assigning objects in the collection always produces a\n    notification. By default, modifying the objects which a collection links to\n    (and the objects which those objects link to, if applicable) will also report\n    that index in the collection as being modified. If a non-empty array of\n    keypaths is provided, then only modifications to those keypaths will mark the\n    object as modified. For example:\n\n    ```swift\n    class Dog: Object {\n        @Persisted var name: String\n        @Persisted var age: Int\n        @Persisted var toys: List<Toy>\n    }\n\n    let dogs = realm.objects(Dog.self)\n    let token = await dogs.observe(keyPaths: [\\.name], on: myActor) { actor, changes in\n        switch changes {\n        case .initial(let dogs):\n            // Query has finished running and dogs can not be used without blocking\n        case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the collection is modified\n            // - when an element is inserted or removed from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on one of the elements.\n        case .error:\n            // Can no longer happen but is left for backwards compatiblity\n        }\n    }\n    ```\n    - If the observed key path were `[\\.toys.brand]`, then any insertion or\n      deletion to the `toys` list on any of the collection's elements would trigger\n      the block. Changes to the `brand` value on any `Toy` that is linked to a `Dog`\n      in this collection will trigger the block. Changes to a value other than\n      `brand` on any `Toy` that is linked to a `Dog` in this collection would not\n      trigger the block. Any insertion or removal to the `Dog` type collection being\n      observed would also trigger a notification.\n    - If the above example observed the `[\\.toys]` key path, then any insertion,\n      deletion, or modification to the `toys` list for any element in the collection\n      would trigger the block. Changes to any value on any `Toy` that is linked to a\n      `Dog` in this collection would *not* trigger the block. Any insertion or\n      removal to the `Dog` type collection being observed would still trigger a\n      notification.\n\n    You must retain the returned token for as long as you want updates to be sent\n    to the block. To stop receiving updates, call `invalidate()` on the token.\n\n    - warning: This method cannot be called during a write transaction, or when the containing Realm is read-only.\n\n    - parameter keyPaths: Only properties contained in the key paths array will trigger\n                       the block when they are modified. If empty, notifications\n                       will be delivered for any property change on the object.\n                       String key paths which do not correspond to a valid a property\n                       will throw an exception. See description above for\n                       more detail on linked properties.\n    - parameter actor: The actor to isolate the notifications to.\n    - parameter block: The block to be called whenever a change occurs.\n    - returns: A token which must be held for as long as you want updates to be delivered.\n    */\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    func observe<A: Actor>(keyPaths: [PartialKeyPath<Element>], on actor: A,\n                           _isolation: isolated (any Actor)? = #isolation,\n                           _ block: @Sendable @escaping (isolated A, RealmCollectionChange<Self>) -> Void) async -> NotificationToken {\n        await observe(keyPaths: keyPaths.map(_name(for:)), on: actor, block)\n    }\n#endif\n}\n\nextension RealmCollection {\n    /**\n     Sorts and sections this collection from a given property key path, returning the result\n     as an instance of `SectionedResults`. For every unique value retrieved from the\n     keyPath a section key will be generated.\n\n     - parameter keyPath: The property key path to sort on.\n     - parameter ascending: The direction to sort in.\n\n     - returns: An instance of `SectionedResults`.\n     */\n    public func sectioned<Key: _Persistable, O: ObjectBase>(by keyPath: KeyPath<Element, Key>,\n                                                            ascending: Bool = true) -> SectionedResults<Key, Element> where Element: Projection<O> {\n        let keyPathString = _name(for: keyPath)\n        return sectioned(sortDescriptors: [.init(keyPath: keyPathString, ascending: ascending)], {\n            return $0[keyPath: keyPath]\n        })\n    }\n\n    /**\n     Sorts and sections this collection from a given property key path, returning the result\n     as an instance of `SectionedResults`. For every unique value retrieved from the\n     keyPath a section key will be generated.\n\n     - parameter keyPath: The property key path to sort on.\n     - parameter sortDescriptors: An array of `SortDescriptor`s to sort by.\n\n     - note: The primary sort descriptor must be responsible for determining the section key.\n\n     - returns: An instance of `SectionedResults`.\n     */\n    public func sectioned<Key: _Persistable, O: ObjectBase>(by keyPath: KeyPath<Element, Key>,\n                                                            sortDescriptors: [SortDescriptor]) -> SectionedResults<Key, Element> where Element: Projection<O> {\n        guard let sortDescriptor = sortDescriptors.first else {\n            throwRealmException(\"Can not section Results with empty sortDescriptor parameter.\")\n        }\n        let keyPathString = _name(for: keyPath)\n        if keyPathString != sortDescriptor.keyPath {\n            throwRealmException(\"The section key path must match the primary sort descriptor.\")\n        }\n        return sectioned(sortDescriptors: sortDescriptors, { $0[keyPath: keyPath] })\n    }\n\n    /**\n     Sorts this collection from a given array of sort descriptors and performs sectioning from\n     a user defined callback, returning the result as an instance of `SectionedResults`.\n\n     - parameter block: A callback which is invoked on each element in the Results collection.\n                        This callback is to return the section key for the element in the collection.\n     - parameter sortDescriptors: An array of `SortDescriptor`s to sort by.\n\n     - note: The primary sort descriptor must be responsible for determining the section key.\n\n     - returns: An instance of `SectionedResults`.\n     */\n    public func sectioned<Key: _Persistable, O: ObjectBase>(by block: @escaping ((Element) -> Key),\n                                                            sortDescriptors: [SortDescriptor]) -> SectionedResults<Key, Element> where Element: Projection<O> {\n        return sectioned(sortDescriptors: sortDescriptors, block)\n    }\n}\n\n/**\n A type-erased `RealmCollection`.\n\n Instances of `RealmCollection` forward operations to an opaque underlying\n collection having the same `Element` type. This type can be used to write\n non-generic code which can operate on or store multiple types of Realm\n collections. It does not have any runtime overhead over using the original\n collection directly.\n */\n@frozen public struct AnyRealmCollection<Element: RealmCollectionValue>: RealmCollectionImpl {\n    internal let collection: RLMCollection\n    internal var lastAccessedNames: NSMutableArray?\n    internal init(collection: RLMCollection) {\n        self.collection = collection\n    }\n\n    /// Creates an `AnyRealmCollection` wrapping `base`.\n    public init<C: RealmCollection & _ObjcBridgeable>(_ base: C) where C.Element == Element {\n        self.collection = base._rlmObjcValue as! RLMCollection\n    }\n\n    /**\n     Returns the object at the given `index`.\n     - parameter index: The index.\n     */\n    public subscript(position: Int) -> Element {\n        throwForNegativeIndex(position)\n        return staticBridgeCast(fromObjectiveC: collection.object(at: UInt(position)))\n    }\n\n    /// A human-readable description of the objects represented by the linking objects.\n    public var description: String {\n        return RLMDescriptionWithMaxDepth(\"AnyRealmCollection\", collection, RLMDescriptionMaxDepth)\n    }\n\n    public static func == (lhs: AnyRealmCollection<Element>, rhs: AnyRealmCollection<Element>) -> Bool {\n        lhs.collection.isEqual(rhs.collection)\n    }\n\n    /// :nodoc:\n    public func makeIterator() -> RLMIterator<Element> {\n        return RLMIterator(collection: collection)\n    }\n\n}\n\nextension AnyRealmCollection: Encodable where Element: Encodable {}\n\n/**\n ProjectedCollection is a special type of collection for Projection's properties which\n should be used when you want to project a `List` of Realm Objects to a list of values.\n You don't need to instantiate this type manually. Use it by calling `projectTo` on a `List` property:\n ```swift\n class PersistedListObject: Object {\n     @Persisted public var people: List<CommonPerson>\n }\n\n class ListProjection: Projection<PersistedListObject> {\n     @Projected(\\PersistedListObject.people.projectTo.firstName) var strings: ProjectedCollection<String>\n }\n ```\n*/\npublic struct ProjectedCollection<Element>: RandomAccessCollection, CustomStringConvertible, ThreadConfined where Element: RealmCollectionValue {\n    public typealias Index = Int\n    /**\n     Returns the index of the first object in the list matching the predicate, or `nil` if no objects match.\n\n     - parameter predicate: The predicate with which to filter the objects.\n     */\n    public func index(matching predicate: NSPredicate) -> Int? {\n        backingCollection.index(matching: predicate)\n    }\n\n    /**\n     Registers a block to be called each time the collection changes.\n\n     The block will be asynchronously called with the initial results, and then called again after each write\n     transaction which changes either any of the objects in the collection, or which objects are in the collection.\n\n     The `change` parameter that is passed to the block reports, in the form of indices within the collection, which of\n     the objects were added, removed, or modified during each write transaction. See the `RealmCollectionChange`\n     documentation for more information on the change information supplied and an example of how to use it to update a\n     `UITableView`.\n\n     At the time when the block is called, the collection will be fully evaluated and up-to-date, and as long as you do\n     not perform a write transaction on the same thread or explicitly call `realm.refresh()`, accessing it will never\n     perform blocking work.\n\n     If no queue is given, notifications are delivered via the standard run loop, and so can't be delivered while the\n     run loop is blocked by other activity. If a queue is given, notifications are delivered to that queue instead. When\n     notifications can't be delivered instantly, multiple notifications may be coalesced into a single notification.\n     This can include the notification with the initial collection.\n\n     For example, the following code performs a write transaction immediately after adding the notification block, so\n     there is no opportunity for the initial notification to be delivered first. As a result, the initial notification\n     will reflect the state of the Realm after the write transaction.\n\n     ```swift\n     class Person: Object {\n         @Persisted var dogs: List<Dog>\n     }\n     class PersonProjection: Projection<Person> {\n         @Projected(\\Person.dogs.projectTo.name) var dogsNames: ProjectedCollection<String>\n     }\n     // ...\n     let dogsNames = personProjection.dogsNames\n     print(\"dogsNames.count: \\(dogsNames?.count)\") // => 0\n     let token = dogsNames.observe { changes in\n         switch changes {\n         case .initial(let dogsNames):\n             // Will print \"dogsNames.count: 1\"\n             print(\"dogsNames.count: \\(dogsNames.count)\")\n             break\n         case .update:\n             // Will not be hit in this example\n             break\n         case .error:\n             break\n         }\n     }\n     try! realm.write {\n         let dog = Dog()\n         dog.name = \"Rex\"\n         person.dogs.append(dog)\n     }\n     // end of run loop execution context\n     ```\n\n     You must retain the returned token for as long as you want updates to be sent to the block. To stop receiving\n     updates, call `invalidate()` on the token.\n\n     - warning: This method cannot be called during a write transaction, or when the containing Realm is read-only.\n\n     - parameter queue: The serial dispatch queue to receive notification on. If\n                        `nil`, notifications are delivered to the current thread.\n     - parameter block: The block to be called whenever a change occurs.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    public func observe(on queue: DispatchQueue?,\n                        _ block: @escaping (RealmCollectionChange<ProjectedCollection<Element>>) -> Void) -> NotificationToken {\n        backingCollection.observe(on: queue, {\n            switch $0 {\n            case .initial(let collection):\n                block(.initial(Self(collection.collection, keyPath: keyPath, propertyName: propertyName)))\n            case .update(let collection,\n                         deletions: let deletions,\n                         insertions: let insertions,\n                         modifications: let modifications):\n                block(.update(Self(collection.collection, keyPath: keyPath, propertyName: propertyName),\n                              deletions: deletions,\n                              insertions: insertions,\n                              modifications: modifications))\n            case .error(let error):\n                block(.error(error))\n            }\n        })\n    }\n    /**\n     Registers a block to be called each time the collection changes.\n\n     The block will be asynchronously called with the initial results, and then called again after each write\n     transaction which changes either any of the objects in the collection, or which objects are in the collection.\n\n     The `change` parameter that is passed to the block reports, in the form of indices within the collection, which of\n     the objects were added, removed, or modified during each write transaction. See the `RealmCollectionChange`\n     documentation for more information on the change information supplied and an example of how to use it to update a\n     `UITableView`.\n\n     At the time when the block is called, the collection will be fully evaluated and up-to-date, and as long as you do\n     not perform a write transaction on the same thread or explicitly call `realm.refresh()`, accessing it will never\n     perform blocking work.\n\n     If no queue is given, notifications are delivered via the standard run loop, and so can't be delivered while the\n     run loop is blocked by other activity. If a queue is given, notifications are delivered to that queue instead. When\n     notifications can't be delivered instantly, multiple notifications may be coalesced into a single notification.\n     This can include the notification with the initial collection.\n\n     For example, the following code performs a write transaction immediately after adding the notification block, so\n     there is no opportunity for the initial notification to be delivered first. As a result, the initial notification\n     will reflect the state of the Realm after the write transaction.\n\n     ```swift\n     class Person: Object {\n         @Persisted var dogs: List<Dog>\n     }\n     class PersonProjection: Projection<Person> {\n         @Projected(\\Person.dogs.projectTo.name) var dogNames: ProjectedCollection<String>\n     }\n     // ...\n     let dogNames = personProjection.dogNames\n     print(\"dogNames.count: \\(dogNames?.count)\") // => 0\n     let token = dogs.observe { changes in\n         switch changes {\n         case .initial(let dogNames):\n             // Will print \"dogNames.count: 1\"\n             print(\"dogNames.count: \\(dogNames.count)\")\n             break\n         case .update:\n             // Will not be hit in this example\n             break\n         case .error:\n             break\n         }\n     }\n     try! realm.write {\n         let dog = Dog()\n         dog.name = \"Rex\"\n         person.dogs.append(dog)\n     }\n     // end of run loop execution context\n     ```\n\n     If no key paths are given, the block will be executed on any insertion,\n     modification, or deletion for all object properties and the properties of\n     any nested, linked objects. If a key path or key paths are provided,\n     then the block will be called for changes which occur only on the\n     provided key paths. For example, if:\n     ```swift\n     class Person: Object {\n         @Persisted var dogs: List<Dog>\n     }\n     class PersonProjection: Projection<Person> {\n         @Projected(\\Person.dogs.projectTo.name) var dogNames: ProjectedCollection<String>\n     }\n     // ...\n     let dogNames = personProjection.dogNames\n     let token = dogNames.observe(keyPaths: [\"name\"]) { changes in\n         switch changes {\n         case .initial(let dogNames):\n            // ...\n         case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the\n            // collection is modified\n            // - when an element is inserted or removed\n            //   from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on\n            //   one of the elements.\n         case .error:\n             // ...\n         }\n     }\n     // end of run loop execution context\n     ```\n     Changes to any other value that is linked to a `Dog` in this collection\n     would *not* trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would still trigger a notification.\n\n     - note: Multiple notification tokens on the same object which filter for\n     separate key paths *do not* filter exclusively. If one key path\n     change is satisfied for one notification token, then all notification\n     token blocks for that object will execute.\n\n     You must retain the returned token for as long as you want updates to be sent to the block. To stop receiving\n     updates, call `invalidate()` on the token.\n\n     - warning: This method cannot be called during a write transaction, or when the containing Realm is read-only.\n\n     - parameter keyPaths: Only properties contained in the key paths array will trigger\n                           the block when they are modified. If `nil`, notifications\n                           will be delivered for any property change on the object.\n                           String key paths which do not correspond to a valid a property\n                           will throw an exception.\n                           See description above for more detail on linked properties.\n     - parameter queue: The serial dispatch queue to receive notification on. If\n                        `nil`, notifications are delivered to the current thread.\n     - parameter block: The block to be called whenever a change occurs.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    public func observe(keyPaths: [String]? = nil, on queue: DispatchQueue? = nil,\n                        _ block: @escaping (RealmCollectionChange<ProjectedCollection<Element>>) -> Void)\n        -> NotificationToken {\n            backingCollection.observe(keyPaths: keyPaths, on: queue) {\n                switch $0 {\n                case .initial(let collection):\n                    block(.initial(Self(collection.collection, keyPath: keyPath, propertyName: propertyName)))\n                case .update(let collection,\n                             deletions: let deletions,\n                             insertions: let insertions,\n                             modifications: let modifications):\n                    block(.update(Self(collection.collection, keyPath: keyPath, propertyName: propertyName),\n                                  deletions: deletions,\n                                  insertions: insertions,\n                                  modifications: modifications))\n                case .error(let error):\n                    block(.error(error))\n                }\n            }\n        }\n\n    /**\n     Returns the object at the given index (get), or replaces the object at the given index (set).\n\n     - warning: You can only set an object during a write transaction.\n\n     - parameter index: The index of the object to retrieve or replace.\n     */\n    public subscript(position: Int) -> Element {\n        get {\n            backingCollection[position][keyPath: keyPath] as! Element\n        }\n        set {\n            backingCollection[position].setValue(newValue, forKeyPath: propertyName)\n        }\n    }\n\n    /// The position of the first element in a non-empty collection.\n    /// Identical to endIndex in an empty collection.\n    public var startIndex: Int {\n        backingCollection.startIndex\n    }\n    /// The collection's \"past the end\" position.\n    /// endIndex is not a valid argument to subscript, and is always reachable from startIndex by\n    /// zero or more applications of successor().\n    public var endIndex: Int {\n        backingCollection.endIndex\n    }\n    /// The Realm which manages the object.\n    public var realm: Realm? {\n        backingCollection.realm\n    }\n    /// Indicates if the collection can no longer be accessed.\n    public var isInvalidated: Bool {\n        backingCollection.isInvalidated\n    }\n    /// A human-readable description of the object.\n    public var description: String {\n        var description = \"ProjectedCollection<\\(Element.self)> {\\n\"\n        for (i, v) in self.enumerated() {\n            description += \"\\t[\\(i)] \\(v)\\n\"\n        }\n        return description + \"}\"\n    }\n    /**\n     Returns the index of an object in the linking objects, or `nil` if the object is not present.\n\n     - parameter object: The object whose index is being queried.\n     */\n    public func index(of object: Element) -> Int? {\n        return backingCollection.map { $0[keyPath: self.keyPath] as! Element }.firstIndex(of: object)\n    }\n    public var isFrozen: Bool {\n        backingCollection.isFrozen\n    }\n    public func freeze() -> Self {\n        Self(backingCollection.freeze().collection, keyPath: keyPath, propertyName: propertyName)\n    }\n    public func thaw() -> Self? {\n        guard let backingCollection = backingCollection.thaw() else {\n            return nil\n        }\n        return Self(backingCollection.collection, keyPath: keyPath, propertyName: propertyName)\n    }\n\n    private let backingCollection: AnyRealmCollection<Object>\n    private let keyPath: AnyKeyPath\n    private let propertyName: String\n\n    init(_ collection: RLMCollection, keyPath: AnyKeyPath, propertyName: String) {\n        self.backingCollection = AnyRealmCollection(collection: collection)\n        self.keyPath = keyPath\n        self.propertyName = propertyName\n    }\n}\n\n/**\n `CollectionElementMapper` transforms the actual collection objects into a `ProjectedCollection`.\n\n For example:\n ```swift\n class Person: Object {\n     @Persisted var dogs: List<Dog>\n }\n class PersonProjection: Projection<Person> {\n     @Projected(\\Person.dogs.projectTo.name) var dogNames: ProjectedCollection<String>\n }\n```\n In this code the `Person`'s dogs list will be prijected to the list of dogs names via `projectTo`\n */\n@dynamicMemberLookup\npublic struct CollectionElementMapper<Element> where Element: ObjectBase & RealmCollectionValue {\n    let collection: RLMCollection\n    /// :nodoc:\n    public subscript<V>(dynamicMember member: KeyPath<Element, V>) -> ProjectedCollection<V> {\n        ProjectedCollection(collection, keyPath: member, propertyName: _name(for: member))\n    }\n}\n\nextension List where Element: ObjectBase & RealmCollectionValue {\n    /**\n     `projectTo` will map the original `List` of `Objects` or `List` of `EmbeddedObjects` in to `ProjectedCollection`.\n\n     For example:\n     ```swift\n     class Person: Object {\n         @Persisted var dogs: List<Dog>\n     }\n     class PersonProjection: Projection<Person> {\n         @Projected(\\Person.dogs.projectTo.name) var dogNames: ProjectedCollection<String>\n     }\n    ```\n     In this code the `Person`'s dogs list will be prijected to the list of dogs names via `projectTo`\n     */\n    public var projectTo: CollectionElementMapper<Element> {\n        CollectionElementMapper(collection: collection)\n    }\n}\n\nextension MutableSet where Element: ObjectBase & RealmCollectionValue {\n    /**\n     `MutableSetElementMapper` transforms the actual `MutableSet` of `Objects` or `MutableSet` of `EmbeddedObjects` in to `ProjectedCollection`.\n\n     For example:\n     ```swift\n     class Person: Object {\n         @Persisted var dogs: MutableSet<Dog>\n     }\n     class PersonProjection: Projection<Person> {\n         @Projected(\\Person.dogs.projectTo.name) var dogNames: ProjectedCollection<String>\n     }\n    ```\n     In this code the `Person`'s dogs set will be prijected to the projected set of dogs names via `projectTo`\n     Note: This is not the actual *set* data type therefore projected elements can contain duplicates.\n     */\n    public var projectTo: CollectionElementMapper<Element> {\n        CollectionElementMapper(collection: collection)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/RealmConfiguration.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Realm.Private\n\nextension Realm {\n    /**\n     A `Configuration` instance describes the different options used to create an instance of a Realm.\n\n     `Configuration` instances are just plain Swift structs. Unlike `Realm`s and `Object`s, they can be freely shared\n     between threads as long as you do not mutate them.\n\n     Creating configuration values for class subsets (by setting the `objectClasses` property) can be expensive. Because\n     of this, you will normally want to cache and reuse a single configuration value for each distinct configuration\n     rather than creating a new value each time you open a Realm.\n     */\n    @frozen public struct Configuration: Sendable {\n\n        // MARK: Default Configuration\n\n        /**\n         The default `Configuration` used to create Realms when no configuration is explicitly specified (i.e.\n         `Realm()`)\n         */\n        public static var defaultConfiguration: Configuration {\n            get {\n                return fromRLMRealmConfiguration(RLMRealmConfiguration.default())\n            }\n            set {\n                RLMRealmConfiguration.setDefault(newValue.rlmConfiguration)\n            }\n        }\n\n        // MARK: Initialization\n\n        /**\n         Creates a `Configuration` which can be used to create new `Realm` instances.\n\n         - note: The `fileURL`, and `inMemoryIdentifier`, parameters are mutually exclusive. Only\n                 set one of them, or none if you wish to use the default file URL.\n\n         - parameter fileURL:            The local URL to the Realm file.\n         - parameter inMemoryIdentifier: A string used to identify a particular in-memory Realm.\n         - parameter encryptionKey:      An optional 64-byte key to use to encrypt the data.\n         - parameter readOnly:           Whether the Realm is read-only (must be true for read-only files).\n         - parameter schemaVersion:      The current schema version.\n         - parameter migrationBlock:     The block which migrates the Realm to the current version.\n         - parameter deleteRealmIfMigrationNeeded: If `true`, recreate the Realm file with the provided\n                                                   schema if a migration is required.\n         - parameter shouldCompactOnLaunch: A block called when opening a Realm for the first time during the\n                                            life of a process to determine if it should be compacted before being\n                                            returned to the user. It is passed the total file size (data + free space)\n                                            and the total bytes used by data in the file.\n\n                                            Return `true ` to indicate that an attempt to compact the file should be made.\n                                            The compaction will be skipped if another process is accessing it.\n         - parameter objectTypes:        The subset of `Object` and `EmbeddedObject` subclasses persisted in the Realm.\n         - parameter seedFilePath:       The path to the realm file that will be copied to the fileURL when opened\n                                         for the first time.\n        */\n        @preconcurrency\n        public init(fileURL: URL? = URL(fileURLWithPath: RLMRealmPathForFile(\"default.realm\"), isDirectory: false),\n                    inMemoryIdentifier: String? = nil,\n                    encryptionKey: Data? = nil,\n                    readOnly: Bool = false,\n                    schemaVersion: UInt64 = 0,\n                    migrationBlock: MigrationBlock? = nil,\n                    deleteRealmIfMigrationNeeded: Bool = false,\n                    shouldCompactOnLaunch: (@Sendable (Int, Int) -> Bool)? = nil,\n                    objectTypes: [ObjectBase.Type]? = nil,\n                    seedFilePath: URL? = nil) {\n                self.fileURL = fileURL\n                if let inMemoryIdentifier = inMemoryIdentifier {\n                    self.inMemoryIdentifier = inMemoryIdentifier\n                }\n                self.encryptionKey = encryptionKey\n                self.readOnly = readOnly\n                self.schemaVersion = schemaVersion\n                self.migrationBlock = migrationBlock\n                self.deleteRealmIfMigrationNeeded = deleteRealmIfMigrationNeeded\n                self.shouldCompactOnLaunch = shouldCompactOnLaunch\n                self.objectTypes = objectTypes\n                self.seedFilePath = seedFilePath\n        }\n\n        // MARK: Configuration Properties\n\n        /// The local URL of the Realm file. Mutually exclusive with `inMemoryIdentifier`.\n        public var fileURL: URL? {\n            didSet {\n                _inMemoryIdentifier = nil\n            }\n        }\n\n        /// A string used to identify a particular in-memory Realm. Mutually exclusive with `fileURL`.\n        public var inMemoryIdentifier: String? {\n            get {\n                return _inMemoryIdentifier\n            }\n            set {\n                fileURL = nil\n                _inMemoryIdentifier = newValue\n            }\n        }\n\n        private var _inMemoryIdentifier: String?\n\n        /// A 64-byte key to use to encrypt the data, or `nil` if encryption is not enabled.\n        public var encryptionKey: Data?\n\n        /**\n         Whether to open the Realm in read-only mode.\n\n         This is required to be able to open Realm files which are not\n         writeable or are in a directory which is not writeable.  This should only be used on files\n         which will not be modified by anyone while they are open, and not just to get a read-only\n         view of a file which may be written to by another thread or process. Opening in read-only\n         mode requires disabling Realm's reader/writer coordination, so committing a write\n         transaction from another process will result in crashes.\n         */\n        public var readOnly: Bool = false\n\n        /// The current schema version.\n        public var schemaVersion: UInt64 = 0\n\n        /// The block which migrates the Realm to the current version.\n        @preconcurrency\n        public var migrationBlock: MigrationBlock?\n\n        /**\n         Whether to recreate the Realm file with the provided schema if a migration is required. This is the case when\n         the stored schema differs from the provided schema or the stored schema version differs from the version on\n         this configuration. Setting this property to `true` deletes the file if a migration would otherwise be required\n         or executed.\n\n         - note: Setting this property to `true` doesn't disable file format migrations.\n         */\n        public var deleteRealmIfMigrationNeeded: Bool = false\n\n        /**\n         A block called when opening a Realm for the first time during the\n         life of a process to determine if it should be compacted before being\n         returned to the user. It is passed the total file size (data + free space)\n         and the total bytes used by data in the file.\n\n         Return `true ` to indicate that an attempt to compact the file should be made.\n         The compaction will be skipped if another process is accessing it.\n         */\n        @preconcurrency\n        public var shouldCompactOnLaunch: (@Sendable (Int, Int) -> Bool)?\n\n        /// The classes managed by the Realm.\n        public var objectTypes: [ObjectBase.Type]? {\n            get {\n                return self.customSchema.map { $0.objectSchema.compactMap { $0.objectClass as? ObjectBase.Type } }\n            }\n            set {\n                self.customSchema = newValue.map { RLMSchema(objectClasses: $0) }\n            }\n        }\n        /**\n         The maximum number of live versions in the Realm file before an exception will\n         be thrown when attempting to start a write transaction.\n\n         Realm provides MVCC snapshot isolation, meaning that writes on one thread do\n         not overwrite data being read on another thread, and instead write a new copy\n         of that data. When a Realm refreshes it updates to the latest version of the\n         data and releases the old versions, allowing them to be overwritten by\n         subsequent write transactions.\n\n         Under normal circumstances this is not a problem, but if the number of active\n         versions grow too large, it will have a negative effect on the filesize on\n         disk. This can happen when performing writes on many different threads at\n         once, when holding on to frozen objects for an extended time, or when\n         performing long operations on background threads which do not allow the Realm\n         to refresh.\n\n         Setting this property to a non-zero value makes it so that exceeding the set\n         number of versions will instead throw an exception. This can be used with a\n         low value during development to help identify places that may be problematic,\n         or in production use to cause the app to crash rather than produce a Realm\n         file which is too large to be opened.\n         */\n        public var maximumNumberOfActiveVersions: UInt?\n\n        /**\n         When opening the Realm for the first time, instead of creating an empty file,\n         the Realm file will be copied from the provided seed file path and used instead.\n         This can be used to open a Realm file with pre-populated data.\n\n         If a realm file already exists at the configurations's destination path, the seed file\n         will not be copied and the already existing realm will be opened instead.\n\n         This option is mutually exclusive with `inMemoryIdentifier`. Setting a `seedFilePath`\n         will nil out the `inMemoryIdentifier`.\n         */\n        public var seedFilePath: URL?\n\n        /// A custom schema to use for the Realm.\n        private var customSchema: RLMSchema?\n\n        /// If `true`, disables automatic format upgrades when accessing the Realm.\n        internal var disableFormatUpgrade: Bool = false\n\n        // MARK: Private Methods\n\n        internal var rlmConfiguration: RLMRealmConfiguration {\n            let configuration = RLMRealmConfiguration()\n            if let fileURL = fileURL {\n                configuration.fileURL = fileURL\n            } else if let inMemoryIdentifier = inMemoryIdentifier {\n                configuration.inMemoryIdentifier = inMemoryIdentifier\n            } else {\n                fatalError(\"A Realm Configuration must specify a path or an in-memory identifier.\")\n            }\n            configuration.seedFilePath = self.seedFilePath\n            configuration.encryptionKey = self.encryptionKey\n            configuration.readOnly = self.readOnly\n            configuration.schemaVersion = self.schemaVersion\n            configuration.migrationBlock = self.migrationBlock\n            configuration.migrationObjectClass = MigrationObject.self\n            configuration.deleteRealmIfMigrationNeeded = self.deleteRealmIfMigrationNeeded\n            configuration.shouldCompactOnLaunch = self.shouldCompactOnLaunch.map(ObjectiveCSupport.convert(object:))\n            configuration.setCustomSchemaWithoutCopying(self.customSchema)\n            configuration.disableFormatUpgrade = self.disableFormatUpgrade\n            configuration.maximumNumberOfActiveVersions = self.maximumNumberOfActiveVersions ?? 0\n            return configuration\n        }\n\n        internal static func fromRLMRealmConfiguration(_ rlmConfiguration: RLMRealmConfiguration) -> Configuration {\n            var configuration = Configuration()\n            configuration.fileURL = rlmConfiguration.fileURL\n            configuration._inMemoryIdentifier = rlmConfiguration.inMemoryIdentifier\n            configuration.encryptionKey = rlmConfiguration.encryptionKey\n            configuration.readOnly = rlmConfiguration.readOnly\n            configuration.schemaVersion = rlmConfiguration.schemaVersion\n            configuration.migrationBlock = rlmConfiguration.migrationBlock\n            configuration.deleteRealmIfMigrationNeeded = rlmConfiguration.deleteRealmIfMigrationNeeded\n            configuration.shouldCompactOnLaunch = rlmConfiguration.shouldCompactOnLaunch.map(ObjectiveCSupport.convert)\n            configuration.customSchema = rlmConfiguration.customSchema\n            configuration.disableFormatUpgrade = rlmConfiguration.disableFormatUpgrade\n            configuration.maximumNumberOfActiveVersions = rlmConfiguration.maximumNumberOfActiveVersions\n            configuration.seedFilePath = rlmConfiguration.seedFilePath\n            return configuration\n        }\n    }\n}\n\n// MARK: CustomStringConvertible\n\nextension Realm.Configuration: CustomStringConvertible {\n    /// A human-readable description of the configuration value.\n    public var description: String {\n        return gsub(pattern: \"\\\\ARLMRealmConfiguration\",\n                    template: \"Realm.Configuration\",\n                    string: rlmConfiguration.description) ?? \"\"\n    }\n}\n\n// MARK: Equatable\n\nextension Realm.Configuration: Equatable {\n    public static func == (lhs: Realm.Configuration, rhs: Realm.Configuration) -> Bool {\n        lhs.encryptionKey == rhs.encryptionKey &&\n            lhs.fileURL == rhs.fileURL &&\n            lhs.inMemoryIdentifier == rhs.inMemoryIdentifier &&\n            lhs.readOnly == rhs.readOnly &&\n            lhs.schemaVersion == rhs.schemaVersion\n    }\n}\n"
  },
  {
    "path": "RealmSwift/RealmKeyedCollection.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\n\n/**\n A homogenous key-value collection of `Object`s which can be retrieved, filtered, sorted, and operated upon.\n*/\npublic protocol RealmKeyedCollection: Sequence, ThreadConfined, CustomStringConvertible {\n    /// The type of key associated with this collection\n    associatedtype Key: _MapKey\n    /// The type of value associated with this collection.\n    associatedtype Value: RealmCollectionValue\n\n    // MARK: Properties\n\n    /// The Realm which manages the map, or `nil` if the map is unmanaged.\n    var realm: Realm? { get }\n\n    /// Indicates if the map can no longer be accessed.\n    var isInvalidated: Bool { get }\n\n    /// Returns the number of key-value pairs in this map.\n    var count: Int { get }\n\n     /// A human-readable description of the objects contained in the Map.\n    var description: String { get }\n\n    // MARK: Mutation\n\n    /**\n     Updates the value stored in the dictionary for the given key, or adds a new key-value pair if the key does not exist.\n\n     - Note:If the value being added to the dictionary is an unmanaged object and the dictionary is managed\n            then that unmanaged object will be added to the Realm.\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter value: a value's key path predicate.\n     - parameter forKey: The direction to sort in.\n     */\n    func updateValue(_ value: Value, forKey key: Key)\n\n    /**\n     Removes the given key and its associated object, only if the key exists in the dictionary. If the key does not\n     exist, the dictionary will not be modified.\n\n     - warning: This method may only be called during a write transaction.\n     */\n    func removeObject(for key: Key)\n\n    /**\n     Removes all objects from the dictionary. The objects are not removed from the Realm that manages them.\n\n     - warning: This method may only be called during a write transaction.\n     */\n    func removeAll()\n\n    /**\n     Returns the value for a given key, or sets a value for a key should the subscript be used for an assign.\n\n     - Note:If the value being added to the dictionary is an unmanaged object and the dictionary is managed\n            then that unmanaged object will be added to the Realm.\n\n     - Note:If the value being assigned for a key is `nil` then that key will be removed from the dictionary.\n\n     - warning: This method may only be called during a write transaction.\n\n     - parameter key: The key.\n     */\n    subscript(key: Key) -> Value? { get set }\n\n    // MARK: KVC\n\n    /**\n     Returns a type of `Value` for a specified key if it exists in the map.\n\n     Note that when using key-value coding, the key must be a string.\n\n     - parameter key: The key to the property whose values are desired.\n     */\n    func value(forKey key: String) -> AnyObject?\n\n    /**\n     Returns a type of `Value` for a specified key if it exists in the map.\n\n     - parameter keyPath: The key to the property whose values are desired.\n     */\n    func value(forKeyPath keyPath: String) -> AnyObject?\n\n    /**\n     Adds a given key-value pair to the dictionary or updates a given key should it already exist.\n\n     - warning: This method can only be called during a write transaction.\n\n     - parameter value: The object value.\n     - parameter key:   The name of the property whose value should be set on each object.\n    */\n    func setValue(_ value: Any?, forKey key: String)\n\n    // MARK: Filtering\n\n    /**\n     Returns a `Results` containing all matching values in the dictionary with the given predicate.\n\n     - Note: This will return the values in the dictionary, and not the key-value pairs.\n\n     - parameter predicate: The predicate with which to filter the values.\n     */\n    func filter(_ predicate: NSPredicate) -> Results<Value>\n\n    /**\n     Returns a Boolean value indicating whether the Map contains the key-value pair\n     satisfies the given predicate\n\n     - parameter where: a closure that test if any key-pair of the given map represents the match.\n     */\n    func contains(where predicate: @escaping (_ key: Key, _ value: Value) -> Bool) -> Bool\n\n    // MARK: Sorting\n\n    /**\n     Returns a `Results` containing the objects in the dictionary, but sorted.\n\n     Objects are sorted based on their values. For example, to sort a dictionary of `Date`s from\n     neweset to oldest based, you might call `dates.sorted(ascending: true)`.\n\n     - parameter ascending: The direction to sort in.\n     */\n    func sorted(ascending: Bool) -> Results<Value>\n\n    /**\n     Returns a `Results` containing the objects in the dictionary, but sorted.\n\n     Objects are sorted based on the values of the given key path. For example, to sort a dictionary of `Student`s from\n     youngest to oldest based on their `age` property, you might call\n     `students.sorted(byKeyPath: \"age\", ascending: true)`.\n\n     - warning: Dictionaries may only be sorted by properties of boolean, `Date`, `NSDate`, single and double-precision\n                floating point, integer, and string types.\n\n     - parameter keyPath:  The key path to sort by.\n     - parameter ascending: The direction to sort in.\n     */\n    func sorted(byKeyPath keyPath: String, ascending: Bool) -> Results<Value>\n\n    /**\n     Returns a `Results` containing the objects in the dictionary, but sorted.\n\n     - warning: Dictionaries may only be sorted by properties of boolean, `Date`, `NSDate`, single and double-precision\n                floating point, integer, and string types.\n\n     - see: `sorted(byKeyPath:ascending:)`\n    */\n    func sorted<S: Sequence>(by sortDescriptors: S) -> Results<Value>\n        where S.Iterator.Element == SortDescriptor\n\n    /// Returns all of the keys in this dictionary.\n    var keys: [Key] { get }\n\n    /// Returns all of the values in the dictionary.\n    var values: [Value] { get }\n\n    // MARK: Aggregate Operations\n\n    /**\n     Returns the minimum (lowest) value of the given property among all the objects in the collection, or `nil` if the\n     dictionary is empty.\n\n     - warning: Only a property whose type conforms to the `MinMaxType` protocol can be specified.\n\n     - parameter property: The name of a property whose minimum value is desired.\n     */\n    func min<T: _HasPersistedType>(ofProperty property: String) -> T? where T.PersistedType: MinMaxType\n\n    /**\n     Returns the maximum (highest) value of the given property among all the objects in the dictionary, or `nil` if the\n     dictionary is empty.\n\n     - warning: Only a property whose type conforms to the `MinMaxType` protocol can be specified.\n\n     - parameter property: The name of a property whose minimum value is desired.\n     */\n    func max<T: _HasPersistedType>(ofProperty property: String) -> T? where T.PersistedType: MinMaxType\n\n    /**\n    Returns the sum of the given property for objects in the dictionary, or `nil` if the dictionary is empty.\n\n    - warning: Only names of properties of a type conforming to the `AddableType` protocol can be used.\n\n    - parameter property: The name of a property conforming to `AddableType` to calculate sum on.\n    */\n    func sum<T: _HasPersistedType>(ofProperty property: String) -> T where T.PersistedType: AddableType\n\n    /**\n     Returns the average value of a given property over all the objects in the dictionary, or `nil` if\n     the dictionary is empty.\n\n     - warning: Only a property whose type conforms to the `AddableType` protocol can be specified.\n\n     - parameter property: The name of a property whose values should be summed.\n     */\n    func average<T: _HasPersistedType>(ofProperty property: String) -> T? where T.PersistedType: AddableType\n\n    // MARK: Notifications\n\n    /**\n     Registers a block to be called each time the dictionary changes.\n\n     The block will be asynchronously called with the initial dictionary, and then called again after each write\n     transaction which changes either any of the keys or values in the dictionary.\n\n     The `change` parameter that is passed to the block reports, in the form of keys within the dictionary, which of\n     the key-value pairs were added, removed, or modified during each write transaction.\n\n     At the time when the block is called, the dictionary will be fully evaluated and up-to-date, and as long as you do\n     not perform a write transaction on the same thread or explicitly call `realm.refresh()`, accessing it will never\n     perform blocking work.\n\n     If no queue is given, notifications are delivered via the standard run loop, and so can't be delivered while the\n     run loop is blocked by other activity. If a queue is given, notifications are delivered to that queue instead. When\n     notifications can't be delivered instantly, multiple notifications may be coalesced into a single notification.\n     This can include the notification with the initial collection.\n\n     For example, the following code performs a write transaction immediately after adding the notification block, so\n     there is no opportunity for the initial notification to be delivered first. As a result, the initial notification\n     will reflect the state of the Realm after the write transaction.\n\n     ```swift\n     let myStringMap = myObject.stringMap\n     print(\"myStringMap.count: \\(myStringMap?.count)\") // => 0\n     let token = myStringMap.observe { changes in\n         switch changes {\n         case .initial(let myStringMap):\n             // Will print \"myStringMap.count: 1\"\n             print(\"myStringMap.count: \\(myStringMap.count)\")\n            print(\"Dog Name: \\(myStringMap[\"nameOfDog\"])\") // => \"Rex\"\n             break\n         case .update:\n             // Will not be hit in this example\n             break\n         case .error:\n             break\n         }\n     }\n     try! realm.write {\n         myStringMap[\"nameOfDog\"] = \"Rex\"\n     }\n     // end of run loop execution context\n     ```\n\n     If no key paths are given, the block will be executed on any insertion,\n     modification, or deletion for all object properties and the properties of\n     any nested, linked objects. If a key path or key paths are provided,\n     then the block will be called for changes which occur only on the\n     provided key paths. For example, if:\n     ```swift\n     class Dog: Object {\n         @Persisted var name: String\n         @Persisted var age: Int\n         @Persisted var toys: List<Toy>\n     }\n     // ...\n     let dogs = myObject.mapOfDogs\n     let token = dogs.observe(keyPaths: [\"name\"]) { changes in\n         switch changes {\n         case .initial(let dogs):\n            // ...\n         case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the\n            // collection is modified\n            // - when an element is inserted or removed\n            //   from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on\n            //   one of the elements.\n         case .error:\n             // ...\n         }\n     }\n     // end of run loop execution context\n     ```\n     - If the observed key path were `[\"toys.brand\"]`, then any insertion or\n     deletion to the `toys` list on any of the collection's elements would trigger the block.\n     Changes to the `brand` value on any `Toy` that is linked to a `Dog` in this\n     collection will trigger the block. Changes to a value other than `brand` on any `Toy` that\n     is linked to a `Dog` in this collection would not trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would also trigger a notification.\n     - If the above example observed the `[\"toys\"]` key path, then any insertion,\n     deletion, or modification to the `toys` list for any element in the collection\n     would trigger the block.\n     Changes to any value on any `Toy` that is linked to a `Dog` in this collection\n     would *not* trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would still trigger a notification.\n\n     - note: Multiple notification tokens on the same object which filter for\n     separate key paths *do not* filter exclusively. If one key path\n     change is satisfied for one notification token, then all notification\n     token blocks for that object will execute.\n\n     You must retain the returned token for as long as you want updates to be sent to the block. To stop receiving\n     updates, call `invalidate()` on the token.\n\n     - warning: This method cannot be called during a write transaction, or when the containing Realm is read-only.\n\n     - parameter keyPaths: Only properties contained in the key paths array will trigger\n                           the block when they are modified. If `nil`, notifications\n                           will be delivered for any property change on the object.\n                           String key paths which do not correspond to a valid a property\n                           will throw an exception.\n                           See description above for more detail on linked properties.\n     - note: The keyPaths parameter refers to object properties of the collection type and\n             *does not* refer to particular key/value pairs within the collection.\n     - parameter queue: The serial dispatch queue to receive notification on. If\n                        `nil`, notifications are delivered to the current thread.\n     - parameter block: The block to be called whenever a change occurs.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    func observe(keyPaths: [String]?,\n                 on queue: DispatchQueue?,\n                 _ block: @escaping (RealmMapChange<Self>) -> Void) -> NotificationToken\n\n    // MARK: Frozen Objects\n\n    /// Returns if this collection is frozen\n    var isFrozen: Bool { get }\n\n    /**\n     Returns a frozen (immutable) snapshot of this collection.\n\n     The frozen copy is an immutable collection which contains the same data as this collection\n    currently contains, but will not update when writes are made to the containing Realm. Unlike\n    live collections, frozen collections can be accessed from any thread.\n\n     - warning: This method cannot be called during a write transaction, or when the containing\n    Realm is read-only.\n     - warning: Holding onto a frozen collection for an extended period while performing write\n     transaction on the Realm may result in the Realm file growing to large sizes. See\n     `Realm.Configuration.maximumNumberOfActiveVersions` for more information.\n    */\n    func freeze() -> Self\n\n    /**\n     Returns a live (mutable) version of this frozen collection.\n\n     This method resolves a reference to a live copy of the same frozen collection.\n     If called on a live collection, will return itself.\n    */\n    func thaw() -> Self?\n}\n\npublic extension RealmKeyedCollection {\n    func observe(keyPaths: [String]? = nil,\n                 on queue: DispatchQueue? = nil,\n                 _ block: @escaping (RealmMapChange<Self>) -> Void) -> NotificationToken {\n        observe(keyPaths: keyPaths, on: queue, block)\n    }\n}\n\n/**\n Protocol for RealmKeyedCollections where the Value is of an Object type that\n enables aggregatable operations.\n */\npublic extension RealmKeyedCollection where Value: OptionalProtocol, Value.Wrapped: ObjectBase {\n    /**\n     Returns the minimum (lowest) value of the given property among all the objects in the collection, or `nil` if the\n     collection is empty.\n\n     - warning: Only a property whose type conforms to the `MinMaxType` protocol can be specified.\n\n     - parameter keyPath: The keyPath of a property whose minimum value is desired.\n     */\n    func min<T: _HasPersistedType>(of keyPath: KeyPath<Value.Wrapped, T>) -> T? where T.PersistedType: MinMaxType {\n        min(ofProperty: _name(for: keyPath))\n    }\n\n    /**\n     Returns the maximum (highest) value of the given property among all the objects in the collection, or `nil` if the\n     collection is empty.\n\n     - warning: Only a property whose type conforms to the `MinMaxType` protocol can be specified.\n\n     - parameter keyPath: The keyPath of a property whose minimum value is desired.\n     */\n    func max<T: _HasPersistedType>(of keyPath: KeyPath<Value.Wrapped, T>) -> T? where T.PersistedType: MinMaxType {\n        max(ofProperty: _name(for: keyPath))\n    }\n\n    /**\n    Returns the sum of the given property for objects in the collection, or `nil` if the collection is empty.\n\n    - warning: Only names of properties of a type conforming to the `AddableType` protocol can be used.\n\n    - parameter keyPath: The keyPath of a property conforming to `AddableType` to calculate sum on.\n    */\n    func sum<T: _HasPersistedType>(of keyPath: KeyPath<Value.Wrapped, T>) -> T where T.PersistedType: AddableType {\n        sum(ofProperty: _name(for: keyPath))\n    }\n\n    /**\n     Returns the average value of a given property over all the objects in the collection, or `nil` if\n     the collection is empty.\n\n     - warning: Only a property whose type conforms to the `AddableType` protocol can be specified.\n\n     - parameter keyPath: The keyPath of a property whose values should be summed.\n     */\n    func average<T: _HasPersistedType>(of keyPath: KeyPath<Value.Wrapped, T>) -> T? where T.PersistedType: AddableType {\n        average(ofProperty: _name(for: keyPath))\n    }\n}\n\n// MARK: Sortable\n\n/**\n Protocol for RealmKeyedCollections where the Value is of an Object type that\n enables sortable operations.\n */\npublic extension RealmKeyedCollection where Value: OptionalProtocol, Value.Wrapped: ObjectBase, Value.Wrapped: RealmCollectionValue {\n    /**\n     Returns a `Results` containing the objects in the collection, but sorted.\n\n     Objects are sorted based on the values of the given key path. For example, to sort a collection of `Student`s from\n     youngest to oldest based on their `age` property, you might call\n     `students.sorted(byKeyPath: \"age\", ascending: true)`.\n\n     - warning: Collections may only be sorted by properties of boolean, `Date`, `NSDate`, single and double-precision\n                floating point, integer, and string types.\n\n     - parameter keyPath:   The key path to sort by.\n     - parameter ascending: The direction to sort in.\n     */\n    func sorted<T: _HasPersistedType>(by keyPath: KeyPath<Value.Wrapped, T>, ascending: Bool) -> Results<Value> where T.PersistedType: SortableType {\n        sorted(byKeyPath: _name(for: keyPath), ascending: ascending)\n    }\n}\n\npublic extension RealmKeyedCollection where Value.PersistedType: MinMaxType {\n    /**\n     Returns the minimum (lowest) value of the collection, or `nil` if the collection is empty.\n     */\n    func min() -> Value? {\n        return min(ofProperty: \"self\")\n    }\n    /**\n     Returns the maximum (highest) value of the collection, or `nil` if the collection is empty.\n     */\n    func max() -> Value? {\n        return max(ofProperty: \"self\")\n    }\n}\n\npublic extension RealmKeyedCollection where Value.PersistedType: AddableType {\n    /**\n     Returns the sum of the values in the collection, or `nil` if the collection is empty.\n     */\n    func sum() -> Value {\n        return sum(ofProperty: \"self\")\n    }\n    /**\n     Returns the average of all of the values in the collection.\n     */\n    func average<T: _HasPersistedType>() -> T? where T.PersistedType: AddableType {\n        return average(ofProperty: \"self\")\n    }\n}\n\npublic extension RealmKeyedCollection where Value.PersistedType: SortableType {\n    /**\n     Returns a `Results` containing the objects in the collection, but sorted.\n\n     Objects are sorted based on their values. For example, to sort a collection of `Date`s from\n     neweset to oldest based, you might call `dates.sorted(ascending: true)`.\n\n     - parameter ascending: The direction to sort in.\n     */\n    func sorted(ascending: Bool = true) -> Results<Value> {\n        return sorted(byKeyPath: \"self\", ascending: ascending)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/RealmProperty.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n\nimport Foundation\nimport Realm\n\n/**\n A `RealmProperty` instance represents an polymorphic value for supported types.\n\n To change the underlying value stored by a `RealmProperty` instance, mutate the instance's `value` property.\n\n - Note:\n An `RealmProperty` should not be declared as `@objc dynamic` on a Realm Object. Use `let` instead.\n */\npublic final class RealmProperty<Value: RealmPropertyType>: RLMSwiftValueStorage {\n    /**\n     Used for getting / setting the underlying value.\n\n      - Usage:\n     ```\n        class MyObject: Object {\n            let myAnyValue = RealmProperty<AnyRealmValue>()\n        }\n        // Setting\n        myObject.myAnyValue.value = .string(\"hello\")\n        // Getting\n        if case let .string(s) = myObject.myAnyValue.value {\n            print(s) // Prints 'Hello'\n        }\n     ```\n     */\n    public var value: Value {\n        get {\n            staticBridgeCast(fromObjectiveC: RLMGetSwiftValueStorage(self) ?? NSNull())\n        }\n        set {\n            RLMSetSwiftValueStorage(self, staticBridgeCast(fromSwift: newValue))\n        }\n    }\n\n    /// :nodoc:\n    @objc public override var description: String {\n        String(describing: value)\n    }\n}\n\nextension RealmProperty: Equatable where Value: Equatable {\n    public static func == (lhs: RealmProperty<Value>, rhs: RealmProperty<Value>) -> Bool {\n        return lhs.value == rhs.value\n    }\n}\n\nextension RealmProperty: Codable where Value: Codable {\n    public convenience init(from decoder: Decoder) throws {\n        self.init()\n        self.value = try decoder.decodeOptional(Value.self)\n    }\n\n    public func encode(to encoder: Encoder) throws {\n        var container = encoder.singleValueContainer()\n        try container.encode(value)\n    }\n}\n\n/// A protocol describing types that can parameterize a `RealmPropertyType`.\npublic protocol RealmPropertyType: _ObjcBridgeable, _RealmSchemaDiscoverable { }\n\nextension AnyRealmValue: RealmPropertyType { }\nextension Optional: RealmPropertyType where Wrapped: RealmOptionalType & _RealmSchemaDiscoverable { }\n"
  },
  {
    "path": "RealmSwift/Results.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm.Private\n\n// MARK: MinMaxType\n\n/**\n Types of properties which can be used with the minimum and maximum value APIs.\n\n - see: `min(ofProperty:)`, `max(ofProperty:)`\n */\n@_marker public protocol MinMaxType {}\nextension NSNumber: MinMaxType {}\nextension Double: MinMaxType {}\nextension Float: MinMaxType {}\nextension Int: MinMaxType {}\nextension Int8: MinMaxType {}\nextension Int16: MinMaxType {}\nextension Int32: MinMaxType {}\nextension Int64: MinMaxType {}\nextension Date: MinMaxType {}\nextension NSDate: MinMaxType {}\nextension Decimal128: MinMaxType {}\nextension AnyRealmValue: MinMaxType {}\nextension Optional: MinMaxType where Wrapped: MinMaxType {}\n\n// MARK: AddableType\n\n/**\n Types of properties which can be used with the sum and average value APIs.\n\n - see: `sum(ofProperty:)`, `average(ofProperty:)`\n */\n@_marker public protocol AddableType {}\nextension NSNumber: AddableType {}\nextension Double: AddableType {}\nextension Float: AddableType {}\nextension Int: AddableType {}\nextension Int8: AddableType {}\nextension Int16: AddableType {}\nextension Int32: AddableType {}\nextension Int64: AddableType {}\nextension Decimal128: AddableType {}\nextension AnyRealmValue: AddableType {}\nextension Optional: AddableType where Wrapped: AddableType {}\n\n/**\n Types of properties which can be directly sorted or distincted.\n\n - see: `sum(ascending:)`, `distinct()`\n */\n@_marker public protocol SortableType {}\nextension AnyRealmValue: SortableType {}\nextension Data: SortableType {}\nextension Date: SortableType {}\nextension Decimal128: SortableType {}\nextension Double: SortableType {}\nextension Float: SortableType {}\nextension Int16: SortableType {}\nextension Int32: SortableType {}\nextension Int64: SortableType {}\nextension Int8: SortableType {}\nextension Int: SortableType {}\nextension String: SortableType {}\nextension Optional: SortableType where Wrapped: SortableType {}\n\n\n/**\n Types which have properties that can be sorted or distincted on.\n */\n@_marker public protocol KeypathSortable {}\nextension ObjectBase: KeypathSortable {}\nextension Projection: KeypathSortable {}\n\n/**\n `Results` is an auto-updating container type in Realm returned from object queries.\n\n `Results` can be queried with the same predicates as `List<Element>`, and you can\n chain queries to further filter query results.\n\n `Results` always reflect the current state of the Realm on the current thread, including during write transactions on\n the current thread. The one exception to this is when using `for...in` enumeration, which will always enumerate over\n the objects which matched the query when the enumeration is begun, even if some of them are deleted or modified to be\n excluded by the filter during the enumeration.\n\n `Results` are lazily evaluated the first time they are accessed; they only run queries when the result of the query is\n requested. This means that chaining several temporary `Results` to sort and filter your data does not perform any\n unnecessary work processing the intermediate state.\n\n Once the results have been evaluated or a notification block has been added, the results are eagerly kept up-to-date,\n with the work done to keep them up-to-date done on a background thread whenever possible.\n\n Results instances cannot be directly instantiated.\n */\n@frozen public struct Results<Element: RealmCollectionValue>: Equatable, RealmCollectionImpl {\n    internal let collection: RLMCollection\n\n    /// A human-readable description of the objects represented by the results.\n    public var description: String {\n        return RLMDescriptionWithMaxDepth(\"Results\", collection, RLMDescriptionMaxDepth)\n    }\n\n    // MARK: Initializers\n\n    internal init(collection: RLMCollection) {\n        self.collection = collection\n    }\n    internal init(_ collection: RLMCollection) {\n        self.collection = collection\n    }\n\n    // MARK: Object Retrieval\n    /**\n     Returns the object at the given `index`.\n     - parameter index: The index.\n     */\n    public subscript(position: Int) -> Element {\n        throwForNegativeIndex(position)\n        return staticBridgeCast(fromObjectiveC: collection.object(at: UInt(position)))\n    }\n\n    // MARK: Equatable\n\n    public static func == (lhs: Results<Element>, rhs: Results<Element>) -> Bool {\n        lhs.collection.isEqual(rhs.collection)\n    }\n\n    /// :nodoc:\n    public func makeIterator() -> RLMIterator<Element> {\n        return RLMIterator(collection: collection)\n    }\n}\n\nextension Results: Encodable where Element: Encodable {}\n"
  },
  {
    "path": "RealmSwift/Schema.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\n\n/**\n `Schema` instances represent collections of model object schemas managed by a Realm.\n\n When using Realm, `Schema` instances allow performing migrations and introspecting the database's schema.\n\n Schemas map to collections of tables in the core database.\n */\n@frozen public struct Schema: CustomStringConvertible {\n\n    // MARK: Properties\n\n    internal let rlmSchema: RLMSchema\n\n    /**\n     An array of `ObjectSchema`s for all object types in the Realm.\n\n     This property is intended to be used during migrations for dynamic introspection.\n     */\n    public var objectSchema: [ObjectSchema] {\n        return rlmSchema.objectSchema.map(ObjectSchema.init)\n    }\n\n    /// A human-readable description of the object schemas contained within.\n    public var description: String { return rlmSchema.description }\n\n    // MARK: Initializers\n\n    internal init(_ rlmSchema: RLMSchema) {\n        self.rlmSchema = rlmSchema\n    }\n\n    // MARK: ObjectSchema Retrieval\n\n    /// Looks up and returns an `ObjectSchema` for the given class name in the Realm, if it exists.\n    public subscript(className: String) -> ObjectSchema? {\n        if let rlmObjectSchema = rlmSchema.schema(forClassName: className) {\n            return ObjectSchema(rlmObjectSchema)\n        }\n        return nil\n    }\n}\n\n// MARK: Equatable\n\nextension Schema: Equatable {\n    /// Returns whether the two schemas are equal.\n    public static func == (lhs: Schema, rhs: Schema) -> Bool {\n        return lhs.rlmSchema.isEqual(to: rhs.rlmSchema)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/SectionedResults.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2022 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\n\n/**\n `RealmSectionedResult` defines properties and methods which are common between\n `SectionedResults` and `ResultSection`.\n */\npublic protocol RealmSectionedResult: RandomAccessCollection, Equatable, ThreadConfined {\n    // MARK: Properties\n\n    /// The Realm which manages the collection, or `nil` if the collection is invalidated.\n    var realm: Realm? { get }\n\n    /**\n     Indicates if the collection can no longer be accessed.\n\n     The collection can no longer be accessed if `invalidate()` is called on the `Realm` that manages the collection.\n     */\n    var isInvalidated: Bool { get }\n\n    /// The number of objects in the collection.\n    var count: Int { get }\n\n    /// Returns true if this collection is frozen\n    var isFrozen: Bool { get }\n\n    /**\n     Returns a frozen (immutable) snapshot of this collection.\n\n     The frozen copy is an immutable collection which contains the same data as this collection\n    currently contains, but will not update when writes are made to the containing Realm. Unlike\n    live collections, frozen collections can be accessed from any thread.\n\n     - warning: This method cannot be called during a write transaction, or when the containing\n    Realm is read-only.\n     - warning: Holding onto a frozen collection for an extended period while performing write\n     transaction on the Realm may result in the Realm file growing to large sizes. See\n     `Realm.Configuration.maximumNumberOfActiveVersions` for more information.\n    */\n    func freeze() -> Self\n\n    /**\n     Returns a live (mutable) version of this frozen collection.\n\n     This method resolves a reference to a live copy of the same frozen collection.\n     If called on a live collection, will return itself.\n    */\n    func thaw() -> Self?\n\n    /**\n     Registers a block to be called each time the sectioned results collection changes.\n\n     The block will be asynchronously called with the initial sectioned results collection, and then called again after each write\n     transaction which changes either any of the objects in the sectioned results collection, or which objects are in the sectioned results collection.\n\n     The `change` parameter that is passed to the block reports, in the form of indices within the collection, which of\n     the objects were added, removed, or modified during each write transaction. See the `SectionedResultsChange`\n     documentation for more information on the change information supplied and an example of how to use it to update a\n     `UITableView`.\n\n     At the time when the block is called, the collection will be fully evaluated and up-to-date, and as long as you do\n     not perform a write transaction on the same thread or explicitly call `realm.refresh()`, accessing it will never\n     perform blocking work.\n\n     If no queue is given, notifications are delivered via the standard run loop, and so can't be delivered while the\n     run loop is blocked by other activity. If a queue is given, notifications are delivered to that queue instead. When\n     notifications can't be delivered instantly, multiple notifications may be coalesced into a single notification.\n     This can include the notification with the initial sectioned results collection.\n\n     For example, the following code performs a write transaction immediately after adding the notification block, so\n     there is no opportunity for the initial notification to be delivered first. As a result, the initial notification\n     will reflect the state of the Realm after the write transaction.\n\n     ```swift\n     let dogs = realm.objects(Dog.self)\n     let sectionedResults = dogs.sectioned(by: \\.age, ascending: true)\n     print(\"sectionedResults.count: \\(sectionedResults?.count)\") // => 0\n     let token = sectionedResults.observe { changes in\n         switch changes {\n         case .initial(let sectionedResults):\n             // Will print \"sectionedResults.count: 1\"\n             print(\"sectionedResults.count: \\(sectionedResults.count)\")\n             break\n         case .update:\n             // Will not be hit in this example\n             break\n         case .error:\n             break\n         }\n     }\n     try! realm.write {\n         let dog = Dog()\n         dog.name = \"Rex\"\n         person.dogs.append(dog)\n     }\n     // end of run loop execution context\n     ```\n\n     If no key paths are given, the block will be executed on any insertion,\n     modification, or deletion for all object properties and the properties of\n     any nested, linked objects. If a key path or key paths are provided,\n     then the block will be called for changes which occur only on the\n     provided key paths. For example, if:\n     ```swift\n     class Dog: Object {\n         @Persisted var name: String\n         @Persisted var age: Int\n         @Persisted var toys: List<Toy>\n     }\n     // ...\n     let dogs = realm.objects(Dog.self)\n     let sectionedResults = dogs.sectioned(by: \\.age, ascending: true)\n     let token = sectionedResults.observe(keyPaths: [\"name\"]) { changes in\n         switch changes {\n         case .initial(let sectionedResults):\n            // ...\n         case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the\n            // collection is modified\n            // - when an element is inserted or removed\n            //   from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on\n            //   one of the elements.\n         case .error:\n             // ...\n         }\n     }\n     // end of run loop execution context\n     ```\n     - If the observed key path were `[\"toys.brand\"]`, then any insertion or\n     deletion to the `toys` list on any of the collection's elements would trigger the block.\n     Changes to the `brand` value on any `Toy` that is linked to a `Dog` in this\n     collection will trigger the block. Changes to a value other than `brand` on any `Toy` that\n     is linked to a `Dog` in this collection would not trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would also trigger a notification.\n     - If the above example observed the `[\"toys\"]` key path, then any insertion,\n     deletion, or modification to the `toys` list for any element in the collection\n     would trigger the block.\n     Changes to any value on any `Toy` that is linked to a `Dog` in this collection\n     would *not* trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would still trigger a notification.\n     - Any modification to the section key path property which results in the object changing\n     position in the section, or changing section entirely will trigger a notification.\n\n     - note: Multiple notification tokens on the same object which filter for\n     separate key paths *do not* filter exclusively. If one key path\n     change is satisfied for one notification token, then all notification\n     token blocks for that object will execute.\n\n     You must retain the returned token for as long as you want updates to be sent to the block. To stop receiving\n     updates, call `invalidate()` on the token.\n\n     - warning: This method cannot be called during a write transaction, or when the containing Realm is read-only.\n\n     - parameter keyPaths: Only properties contained in the key paths array will trigger\n                           the block when they are modified. If `nil`, notifications\n                           will be delivered for any property change on the object.\n                           String key paths which do not correspond to a valid a property\n                           will throw an exception. See description above for\n                           more detail on linked properties.\n     - parameter queue: The serial dispatch queue to receive notification on. If\n                        `nil`, notifications are delivered to the current thread.\n     - parameter block: The block to be called whenever a change occurs.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    func observe(keyPaths: [String]?,\n                 on queue: DispatchQueue?,\n                 _ block: @escaping (SectionedResultsChange<Self>) -> Void) -> NotificationToken\n}\n\n#if compiler(<6)\npublic extension RealmSectionedResult {\n    func observe(keyPaths: [String]? = nil,\n                 on queue: DispatchQueue? = nil,\n                 _ block: @escaping (SectionedResultsChange<Self>) -> Void) -> NotificationToken {\n        observe(keyPaths: keyPaths, on: queue, block)\n    }\n\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    @_unsafeInheritExecutor\n    func observe<A: Actor>(\n        keyPaths: [String]? = nil, on actor: A,\n        _ block: @Sendable @escaping (isolated A, SectionedResultsChange<Self>) -> Void\n    ) async -> NotificationToken {\n        await with(self, on: actor) { actor, collection in\n            collection.observe(keyPaths: keyPaths, on: nil) { change in\n                actor.invokeIsolated(block, change)\n            }\n        }\n    }\n}\n#else\npublic extension RealmSectionedResult {\n    func observe(keyPaths: [String]? = nil,\n                 on queue: DispatchQueue? = nil,\n                 _ block: @escaping (SectionedResultsChange<Self>) -> Void) -> NotificationToken {\n        observe(keyPaths: keyPaths, on: queue, block)\n    }\n\n    /// :nodoc:\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    func observe<A: Actor>(\n        keyPaths: [String]? = nil, on actor: A,\n        _isolation: isolated (any Actor)? = #isolation,\n        _ block: @Sendable @escaping (isolated A, SectionedResultsChange<Self>) -> Void\n    ) async -> NotificationToken {\n        await with(self, on: actor) { actor, collection in\n            collection.observe(keyPaths: keyPaths, on: nil) { change in\n                actor.invokeIsolated(block, change)\n            }\n        }\n    }\n}\n#endif\n\n#if compiler(<6)\npublic extension RealmSectionedResult where Element: RealmSectionedResult, Element.Element: ObjectBase {\n    /**\n     Registers a block to be called each time the sectioned results collection changes.\n\n     The block will be asynchronously called with the initial sectioned results collection, and then called again after each write\n     transaction which changes either any of the objects in the sectioned results collection, or which objects are in the sectioned results collection.\n\n     The `change` parameter that is passed to the block reports, in the form of indices within the collection, which of\n     the objects were added, removed, or modified during each write transaction. See the `SectionedResultsChange`\n     documentation for more information on the change information supplied and an example of how to use it to update a\n     `UITableView`.\n\n     At the time when the block is called, the collection will be fully evaluated and up-to-date, and as long as you do\n     not perform a write transaction on the same thread or explicitly call `realm.refresh()`, accessing it will never\n     perform blocking work.\n\n     If no queue is given, notifications are delivered via the standard run loop, and so can't be delivered while the\n     run loop is blocked by other activity. If a queue is given, notifications are delivered to that queue instead. When\n     notifications can't be delivered instantly, multiple notifications may be coalesced into a single notification.\n     This can include the notification with the initial sectioned results collection.\n\n     For example, the following code performs a write transaction immediately after adding the notification block, so\n     there is no opportunity for the initial notification to be delivered first. As a result, the initial notification\n     will reflect the state of the Realm after the write transaction.\n\n     ```swift\n     let dogs = realm.objects(Dog.self)\n     let sectionedResults = dogs.sectioned(by: \\.age, ascending: true)\n     print(\"sectionedResults.count: \\(sectionedResults?.count)\") // => 0\n     let token = sectionedResults.observe { changes in\n         switch changes {\n         case .initial(let sectionedResults):\n             // Will print \"sectionedResults.count: 1\"\n             print(\"sectionedResults.count: \\(sectionedResults.count)\")\n             break\n         case .update:\n             // Will not be hit in this example\n             break\n         case .error:\n             break\n         }\n     }\n     try! realm.write {\n         let dog = Dog()\n         dog.name = \"Rex\"\n         person.dogs.append(dog)\n     }\n     // end of run loop execution context\n     ```\n\n     If no key paths are given, the block will be executed on any insertion,\n     modification, or deletion for all object properties and the properties of\n     any nested, linked objects. If a key path or key paths are provided,\n     then the block will be called for changes which occur only on the\n     provided key paths. For example, if:\n     ```swift\n     class Dog: Object {\n         @Persisted var name: String\n         @Persisted var age: Int\n         @Persisted var toys: List<Toy>\n     }\n     // ...\n     let dogs = realm.objects(Dog.self)\n     let sectionedResults = dogs.sectioned(by: \\.age, ascending: true)\n     let token = sectionedResults.observe(keyPaths: [\"name\"]) { changes in\n         switch changes {\n         case .initial(let sectionedResults):\n            // ...\n         case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the\n            // collection is modified\n            // - when an element is inserted or removed\n            //   from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on\n            //   one of the elements.\n         case .error:\n             // ...\n         }\n     }\n     // end of run loop execution context\n     ```\n     - If the observed key path were `[\"toys.brand\"]`, then any insertion or\n     deletion to the `toys` list on any of the collection's elements would trigger the block.\n     Changes to the `brand` value on any `Toy` that is linked to a `Dog` in this\n     collection will trigger the block. Changes to a value other than `brand` on any `Toy` that\n     is linked to a `Dog` in this collection would not trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would also trigger a notification.\n     - If the above example observed the `[\"toys\"]` key path, then any insertion,\n     deletion, or modification to the `toys` list for any element in the collection\n     would trigger the block.\n     Changes to any value on any `Toy` that is linked to a `Dog` in this collection\n     would *not* trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would still trigger a notification.\n     - Any modification to the section key path property which results in the object changing\n     position in the section, or changing section entirely will trigger a notification.\n\n     - note: Multiple notification tokens on the same object which filter for\n     separate key paths *do not* filter exclusively. If one key path\n     change is satisfied for one notification token, then all notification\n     token blocks for that object will execute.\n\n     You must retain the returned token for as long as you want updates to be sent to the block. To stop receiving\n     updates, call `invalidate()` on the token.\n\n     - warning: This method cannot be called during a write transaction, or when the containing Realm is read-only.\n\n     - parameter keyPaths: Only properties contained in the key paths array will trigger\n                           the block when they are modified. If `nil`, notifications\n                           will be delivered for any property change on the object.\n     - parameter queue: The serial dispatch queue to receive notification on. If\n                        `nil`, notifications are delivered to the current thread.\n     - parameter block: The block to be called whenever a change occurs.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    func observe(keyPaths: [PartialKeyPath<Element.Element>],\n                 on queue: DispatchQueue? = nil,\n                 _ block: @escaping (SectionedResultsChange<Self>) -> Void) -> NotificationToken {\n        observe(keyPaths: keyPaths.map(_name(for:)), on: queue, block)\n    }\n\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    @_unsafeInheritExecutor\n    func observe<A: Actor>(\n        keyPaths: [PartialKeyPath<Element.Element>], on actor: A,\n        _ block: @Sendable @escaping (isolated A, SectionedResultsChange<Self>) -> Void\n    ) async -> NotificationToken {\n        await observe(keyPaths: keyPaths.map(_name(for:)), on: actor, block)\n    }\n}\n\npublic extension RealmSectionedResult where Element: ObjectBase {\n    /**\n     Registers a block to be called each time the sectioned results collection changes.\n\n     The block will be asynchronously called with the initial sectioned results collection, and then called again after each write\n     transaction which changes either any of the objects in the sectioned results collection, or which objects are in the sectioned results collection.\n\n     The `change` parameter that is passed to the block reports, in the form of indices within the collection, which of\n     the objects were added, removed, or modified during each write transaction. See the `SectionedResultsChange`\n     documentation for more information on the change information supplied and an example of how to use it to update a\n     `UITableView`.\n\n     At the time when the block is called, the collection will be fully evaluated and up-to-date, and as long as you do\n     not perform a write transaction on the same thread or explicitly call `realm.refresh()`, accessing it will never\n     perform blocking work.\n\n     If no queue is given, notifications are delivered via the standard run loop, and so can't be delivered while the\n     run loop is blocked by other activity. If a queue is given, notifications are delivered to that queue instead. When\n     notifications can't be delivered instantly, multiple notifications may be coalesced into a single notification.\n     This can include the notification with the initial sectioned results collection.\n\n     For example, the following code performs a write transaction immediately after adding the notification block, so\n     there is no opportunity for the initial notification to be delivered first. As a result, the initial notification\n     will reflect the state of the Realm after the write transaction.\n\n     ```swift\n     let dogs = realm.objects(Dog.self)\n     let sectionedResults = dogs.sectioned(by: \\.age, ascending: true)\n     print(\"sectionedResults.count: \\(sectionedResults?.count)\") // => 0\n     let token = sectionedResults.observe { changes in\n         switch changes {\n         case .initial(let sectionedResults):\n             // Will print \"sectionedResults.count: 1\"\n             print(\"sectionedResults.count: \\(sectionedResults.count)\")\n             break\n         case .update:\n             // Will not be hit in this example\n             break\n         case .error:\n             break\n         }\n     }\n     try! realm.write {\n         let dog = Dog()\n         dog.name = \"Rex\"\n         person.dogs.append(dog)\n     }\n     // end of run loop execution context\n     ```\n\n     If no key paths are given, the block will be executed on any insertion,\n     modification, or deletion for all object properties and the properties of\n     any nested, linked objects. If a key path or key paths are provided,\n     then the block will be called for changes which occur only on the\n     provided key paths. For example, if:\n     ```swift\n     class Dog: Object {\n         @Persisted var name: String\n         @Persisted var age: Int\n         @Persisted var toys: List<Toy>\n     }\n     // ...\n     let dogs = realm.objects(Dog.self)\n     let sectionedResults = dogs.sectioned(by: \\.age, ascending: true)\n     let token = sectionedResults.observe(keyPaths: [\"name\"]) { changes in\n         switch changes {\n         case .initial(let sectionedResults):\n            // ...\n         case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the\n            // collection is modified\n            // - when an element is inserted or removed\n            //   from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on\n            //   one of the elements.\n         case .error:\n             // ...\n         }\n     }\n     // end of run loop execution context\n     ```\n     - If the observed key path were `[\"toys.brand\"]`, then any insertion or\n     deletion to the `toys` list on any of the collection's elements would trigger the block.\n     Changes to the `brand` value on any `Toy` that is linked to a `Dog` in this\n     collection will trigger the block. Changes to a value other than `brand` on any `Toy` that\n     is linked to a `Dog` in this collection would not trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would also trigger a notification.\n     - If the above example observed the `[\"toys\"]` key path, then any insertion,\n     deletion, or modification to the `toys` list for any element in the collection\n     would trigger the block.\n     Changes to any value on any `Toy` that is linked to a `Dog` in this collection\n     would *not* trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would still trigger a notification.\n     - Any modification to the section key path property which results in the object changing\n     position in the section, or changing section entirely will trigger a notification.\n\n     - note: Multiple notification tokens on the same object which filter for\n     separate key paths *do not* filter exclusively. If one key path\n     change is satisfied for one notification token, then all notification\n     token blocks for that object will execute.\n\n     You must retain the returned token for as long as you want updates to be sent to the block. To stop receiving\n     updates, call `invalidate()` on the token.\n\n     - warning: This method cannot be called during a write transaction, or when the containing Realm is read-only.\n\n     - parameter keyPaths: Only properties contained in the key paths array will trigger\n                           the block when they are modified. If `nil`, notifications\n                           will be delivered for any property change on the object.\n     - parameter queue: The serial dispatch queue to receive notification on. If\n                        `nil`, notifications are delivered to the current thread.\n     - parameter block: The block to be called whenever a change occurs.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    func observe(keyPaths: [PartialKeyPath<Element>],\n                 on queue: DispatchQueue? = nil,\n                 _ block: @escaping (SectionedResultsChange<Self>) -> Void) -> NotificationToken {\n        observe(keyPaths: keyPaths.map(_name(for:)), on: queue, block)\n    }\n\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    @_unsafeInheritExecutor\n    func observe<A: Actor>(\n        keyPaths: [PartialKeyPath<Element>], on actor: A,\n        _ block: @Sendable @escaping (isolated A, SectionedResultsChange<Self>) -> Void\n    ) async -> NotificationToken {\n        await observe(keyPaths: keyPaths.map(_name(for:)), on: actor, block)\n    }\n}\n#else\npublic extension RealmSectionedResult where Element: RealmSectionedResult, Element.Element: ObjectBase {\n    /**\n     Registers a block to be called each time the sectioned results collection changes.\n\n     The block will be asynchronously called with the initial sectioned results collection, and then called again after each write\n     transaction which changes either any of the objects in the sectioned results collection, or which objects are in the sectioned results collection.\n\n     The `change` parameter that is passed to the block reports, in the form of indices within the collection, which of\n     the objects were added, removed, or modified during each write transaction. See the `SectionedResultsChange`\n     documentation for more information on the change information supplied and an example of how to use it to update a\n     `UITableView`.\n\n     At the time when the block is called, the collection will be fully evaluated and up-to-date, and as long as you do\n     not perform a write transaction on the same thread or explicitly call `realm.refresh()`, accessing it will never\n     perform blocking work.\n\n     If no queue is given, notifications are delivered via the standard run loop, and so can't be delivered while the\n     run loop is blocked by other activity. If a queue is given, notifications are delivered to that queue instead. When\n     notifications can't be delivered instantly, multiple notifications may be coalesced into a single notification.\n     This can include the notification with the initial sectioned results collection.\n\n     For example, the following code performs a write transaction immediately after adding the notification block, so\n     there is no opportunity for the initial notification to be delivered first. As a result, the initial notification\n     will reflect the state of the Realm after the write transaction.\n\n     ```swift\n     let dogs = realm.objects(Dog.self)\n     let sectionedResults = dogs.sectioned(by: \\.age, ascending: true)\n     print(\"sectionedResults.count: \\(sectionedResults?.count)\") // => 0\n     let token = sectionedResults.observe { changes in\n         switch changes {\n         case .initial(let sectionedResults):\n             // Will print \"sectionedResults.count: 1\"\n             print(\"sectionedResults.count: \\(sectionedResults.count)\")\n             break\n         case .update:\n             // Will not be hit in this example\n             break\n         case .error:\n             break\n         }\n     }\n     try! realm.write {\n         let dog = Dog()\n         dog.name = \"Rex\"\n         person.dogs.append(dog)\n     }\n     // end of run loop execution context\n     ```\n\n     If no key paths are given, the block will be executed on any insertion,\n     modification, or deletion for all object properties and the properties of\n     any nested, linked objects. If a key path or key paths are provided,\n     then the block will be called for changes which occur only on the\n     provided key paths. For example, if:\n     ```swift\n     class Dog: Object {\n         @Persisted var name: String\n         @Persisted var age: Int\n         @Persisted var toys: List<Toy>\n     }\n     // ...\n     let dogs = realm.objects(Dog.self)\n     let sectionedResults = dogs.sectioned(by: \\.age, ascending: true)\n     let token = sectionedResults.observe(keyPaths: [\"name\"]) { changes in\n         switch changes {\n         case .initial(let sectionedResults):\n            // ...\n         case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the\n            // collection is modified\n            // - when an element is inserted or removed\n            //   from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on\n            //   one of the elements.\n         case .error:\n             // ...\n         }\n     }\n     // end of run loop execution context\n     ```\n     - If the observed key path were `[\"toys.brand\"]`, then any insertion or\n     deletion to the `toys` list on any of the collection's elements would trigger the block.\n     Changes to the `brand` value on any `Toy` that is linked to a `Dog` in this\n     collection will trigger the block. Changes to a value other than `brand` on any `Toy` that\n     is linked to a `Dog` in this collection would not trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would also trigger a notification.\n     - If the above example observed the `[\"toys\"]` key path, then any insertion,\n     deletion, or modification to the `toys` list for any element in the collection\n     would trigger the block.\n     Changes to any value on any `Toy` that is linked to a `Dog` in this collection\n     would *not* trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would still trigger a notification.\n     - Any modification to the section key path property which results in the object changing\n     position in the section, or changing section entirely will trigger a notification.\n\n     - note: Multiple notification tokens on the same object which filter for\n     separate key paths *do not* filter exclusively. If one key path\n     change is satisfied for one notification token, then all notification\n     token blocks for that object will execute.\n\n     You must retain the returned token for as long as you want updates to be sent to the block. To stop receiving\n     updates, call `invalidate()` on the token.\n\n     - warning: This method cannot be called during a write transaction, or when the containing Realm is read-only.\n\n     - parameter keyPaths: Only properties contained in the key paths array will trigger\n                           the block when they are modified. If `nil`, notifications\n                           will be delivered for any property change on the object.\n     - parameter queue: The serial dispatch queue to receive notification on. If\n                        `nil`, notifications are delivered to the current thread.\n     - parameter block: The block to be called whenever a change occurs.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    func observe(keyPaths: [PartialKeyPath<Element.Element>],\n                 on queue: DispatchQueue? = nil,\n                 _ block: @escaping (SectionedResultsChange<Self>) -> Void) -> NotificationToken {\n        observe(keyPaths: keyPaths.map(_name(for:)), on: queue, block)\n    }\n\n    /// :nodoc:\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    func observe<A: Actor>(\n        keyPaths: [PartialKeyPath<Element.Element>], on actor: A,\n        _isolation: isolated (any Actor)? = #isolation,\n        _ block: @Sendable @escaping (isolated A, SectionedResultsChange<Self>) -> Void\n    ) async -> NotificationToken {\n        await observe(keyPaths: keyPaths.map(_name(for:)), on: actor, block)\n    }\n}\n\npublic extension RealmSectionedResult where Element: ObjectBase {\n    /**\n     Registers a block to be called each time the sectioned results collection changes.\n\n     The block will be asynchronously called with the initial sectioned results collection, and then called again after each write\n     transaction which changes either any of the objects in the sectioned results collection, or which objects are in the sectioned results collection.\n\n     The `change` parameter that is passed to the block reports, in the form of indices within the collection, which of\n     the objects were added, removed, or modified during each write transaction. See the `SectionedResultsChange`\n     documentation for more information on the change information supplied and an example of how to use it to update a\n     `UITableView`.\n\n     At the time when the block is called, the collection will be fully evaluated and up-to-date, and as long as you do\n     not perform a write transaction on the same thread or explicitly call `realm.refresh()`, accessing it will never\n     perform blocking work.\n\n     If no queue is given, notifications are delivered via the standard run loop, and so can't be delivered while the\n     run loop is blocked by other activity. If a queue is given, notifications are delivered to that queue instead. When\n     notifications can't be delivered instantly, multiple notifications may be coalesced into a single notification.\n     This can include the notification with the initial sectioned results collection.\n\n     For example, the following code performs a write transaction immediately after adding the notification block, so\n     there is no opportunity for the initial notification to be delivered first. As a result, the initial notification\n     will reflect the state of the Realm after the write transaction.\n\n     ```swift\n     let dogs = realm.objects(Dog.self)\n     let sectionedResults = dogs.sectioned(by: \\.age, ascending: true)\n     print(\"sectionedResults.count: \\(sectionedResults?.count)\") // => 0\n     let token = sectionedResults.observe { changes in\n         switch changes {\n         case .initial(let sectionedResults):\n             // Will print \"sectionedResults.count: 1\"\n             print(\"sectionedResults.count: \\(sectionedResults.count)\")\n             break\n         case .update:\n             // Will not be hit in this example\n             break\n         case .error:\n             break\n         }\n     }\n     try! realm.write {\n         let dog = Dog()\n         dog.name = \"Rex\"\n         person.dogs.append(dog)\n     }\n     // end of run loop execution context\n     ```\n\n     If no key paths are given, the block will be executed on any insertion,\n     modification, or deletion for all object properties and the properties of\n     any nested, linked objects. If a key path or key paths are provided,\n     then the block will be called for changes which occur only on the\n     provided key paths. For example, if:\n     ```swift\n     class Dog: Object {\n         @Persisted var name: String\n         @Persisted var age: Int\n         @Persisted var toys: List<Toy>\n     }\n     // ...\n     let dogs = realm.objects(Dog.self)\n     let sectionedResults = dogs.sectioned(by: \\.age, ascending: true)\n     let token = sectionedResults.observe(keyPaths: [\"name\"]) { changes in\n         switch changes {\n         case .initial(let sectionedResults):\n            // ...\n         case .update:\n            // This case is hit:\n            // - after the token is initialized\n            // - when the name property of an object in the\n            // collection is modified\n            // - when an element is inserted or removed\n            //   from the collection.\n            // This block is not triggered:\n            // - when a value other than name is modified on\n            //   one of the elements.\n         case .error:\n             // ...\n         }\n     }\n     // end of run loop execution context\n     ```\n     - If the observed key path were `[\"toys.brand\"]`, then any insertion or\n     deletion to the `toys` list on any of the collection's elements would trigger the block.\n     Changes to the `brand` value on any `Toy` that is linked to a `Dog` in this\n     collection will trigger the block. Changes to a value other than `brand` on any `Toy` that\n     is linked to a `Dog` in this collection would not trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would also trigger a notification.\n     - If the above example observed the `[\"toys\"]` key path, then any insertion,\n     deletion, or modification to the `toys` list for any element in the collection\n     would trigger the block.\n     Changes to any value on any `Toy` that is linked to a `Dog` in this collection\n     would *not* trigger the block.\n     Any insertion or removal to the `Dog` type collection being observed\n     would still trigger a notification.\n     - Any modification to the section key path property which results in the object changing\n     position in the section, or changing section entirely will trigger a notification.\n\n     - note: Multiple notification tokens on the same object which filter for\n     separate key paths *do not* filter exclusively. If one key path\n     change is satisfied for one notification token, then all notification\n     token blocks for that object will execute.\n\n     You must retain the returned token for as long as you want updates to be sent to the block. To stop receiving\n     updates, call `invalidate()` on the token.\n\n     - warning: This method cannot be called during a write transaction, or when the containing Realm is read-only.\n\n     - parameter keyPaths: Only properties contained in the key paths array will trigger\n                           the block when they are modified. If `nil`, notifications\n                           will be delivered for any property change on the object.\n     - parameter queue: The serial dispatch queue to receive notification on. If\n                        `nil`, notifications are delivered to the current thread.\n     - parameter block: The block to be called whenever a change occurs.\n     - returns: A token which must be held for as long as you want updates to be delivered.\n     */\n    func observe(keyPaths: [PartialKeyPath<Element>],\n                 on queue: DispatchQueue? = nil,\n                 _ block: @escaping (SectionedResultsChange<Self>) -> Void) -> NotificationToken {\n        observe(keyPaths: keyPaths.map(_name(for:)), on: queue, block)\n    }\n\n    /// :nodoc:\n    @available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\n    func observe<A: Actor>(\n        keyPaths: [PartialKeyPath<Element>], on actor: A,\n        _isolation: isolated (any Actor)? = #isolation,\n        _ block: @Sendable @escaping (isolated A, SectionedResultsChange<Self>) -> Void\n    ) async -> NotificationToken {\n        await observe(keyPaths: keyPaths.map(_name(for:)), on: actor, block)\n    }\n}\n#endif\n\n// Shared implementation of SectionedResults and ResultsSection\nprivate protocol SectionedResultImpl: RealmSectionedResult {\n    associatedtype Collection: RLMSectionedResult\n    var collection: Collection { get set }\n    init(rlmSectionedResult: Collection)\n}\n/// :nodoc:\nextension SectionedResultImpl {\n    public var startIndex: Int { 0 }\n    public var endIndex: Int { Int(collection.count) }\n\n    public var realm: Realm? {\n        collection.realm.map(Realm.init)\n    }\n    public var isInvalidated: Bool {\n        collection.isInvalidated\n    }\n    public var isFrozen: Bool {\n        collection.isFrozen\n    }\n    public func freeze() -> Self {\n        Self(rlmSectionedResult: collection.freeze())\n    }\n    public func thaw() -> Self? {\n        Self(rlmSectionedResult: collection.thaw())\n    }\n\n    public func observe(keyPaths: [String]?,\n                        on queue: DispatchQueue?,\n                        _ block: @escaping (SectionedResultsChange<Self>) -> Void) -> NotificationToken {\n        let wrapped = { (collection: RLMSectionedResult, change: RLMSectionedResultsChange) in\n            block(SectionedResultsChange.fromObjc(value: Self(rlmSectionedResult: collection as! Self.Collection),\n                                                  change: change))\n        }\n        return collection.addNotificationBlock(wrapped, keyPaths: keyPaths, queue: queue)\n    }\n}\n\n/// `SectionedResults` is a type safe collection which holds individual `ResultsSection`s as its elements.\n/// The container is lazily evaluated, meaning that if the underlying collection has changed a full recalculation of the section keys will take place.\n/// A `SectionedResults` instance can be observed and it also conforms to `ThreadConfined`.\npublic struct SectionedResults<Key: _Persistable & Hashable, SectionElement: RealmCollectionValue>: SectionedResultImpl {\n    internal var collection: RLMSectionedResults<RLMValue, RLMValue>\n    internal init(rlmSectionedResult: RLMSectionedResults<RLMValue, RLMValue>) {\n        self.collection = rlmSectionedResult\n    }\n    public typealias Element = ResultsSection<Key, SectionElement>\n\n    /// An array of all keys in the sectioned results collection.\n    public var allKeys: [Key] {\n        collection.allKeys.map { Key._rlmFromObjc($0)! }\n    }\n\n    /**\n     Returns the section at the given `index`.\n     - parameter index: The index.\n     */\n    public subscript(_ index: Int) -> Element {\n        return Element(rlmSectionedResult: collection[UInt(index)])\n    }\n\n    /**\n     Returns the object at the given `IndexPath`.\n     - parameter indexPath: The IndexPath.\n     */\n    public subscript(_ indexPath: IndexPath) -> SectionElement {\n        return self[indexPath.section][indexPath.item]\n    }\n\n    /// :nodoc:\n    public func makeIterator() -> SectionedResultsIterator<Key, SectionElement> {\n        return SectionedResultsIterator(collection: collection)\n    }\n\n    /// :nodoc:\n    public static func == (lhs: Self, rhs: Self) -> Bool {\n        return lhs.collection == rhs.collection\n    }\n}\n\n/// `ResultsSection` is a collection which allows access  to objects that belong to a given section key.\n/// The collection is lazily evaluated, meaning that if the underlying collection has changed a full recalculation of the section keys will take place.\n/// A `ResultsSection` instance can be observed and it also conforms to `ThreadConfined`.\npublic struct ResultsSection<Key: _Persistable & Hashable, T: RealmCollectionValue>: SectionedResultImpl {\n    public typealias Element = T\n    internal var collection: RLMSection<RLMValue, RLMValue>\n    internal init(rlmSectionedResult: RLMSection<RLMValue, RLMValue>) {\n        self.collection = rlmSectionedResult\n    }\n\n    /// The key which represents this section.\n    public var key: Key {\n        return Key._rlmFromObjc(collection.key)!\n    }\n    /// :nodoc:\n    public var id: Key {\n        key\n    }\n\n    /**\n     Returns the object at the given `index`.\n     - parameter index: The index.\n     */\n    public subscript(_ index: Int) -> T {\n        return T._rlmFromObjc(collection[UInt(index)])!\n    }\n\n    /// :nodoc:\n    public func makeIterator() -> SectionIterator<Element> {\n        return SectionIterator(collection: collection)\n    }\n\n    /// :nodoc:\n    public static func == (lhs: ResultsSection<Key, Element>, rhs: ResultsSection<Key, Element>) -> Bool {\n        return lhs.collection == rhs.collection\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\nextension ResultsSection: Identifiable { }\n\n/**\n A `SectionedResultsChange` value encapsulates information about changes to\n sectioned results that are reported by Realm notifications.\n\n The first time a notification is delivered it will be `.initial`, and all\n subsequent notifications will be `.change()` with information about what has\n changed since the last time the callback was invoked.\n }\n */\n@frozen public enum SectionedResultsChange<Collection> {\n    /**\n     `.initial` indicates that the initial run of the query has completed (if\n     applicable), and the collection can now be used without performing any\n     blocking work.\n     */\n    case initial(Collection)\n\n    /**\n     `.update` indicates that a write transaction has been committed which\n     either changed which objects are in the collection, and/or modified one\n     or more of the objects in the collection.\n\n     All three of the change arrays are always sorted in ascending order.\n\n     - parameter deletions:     The indexPaths in the previous version of the collection which were removed from this one.\n     - parameter insertions:    The indexPaths in the new collection which were added in this version.\n     - parameter modifications: The indexPaths of the objects which were modified in the previous version of this collection.\n     - parameter sectionsToInsert: The indexSet of the sections which were newly inserted into the sectioned results collection.\n     - parameter sectionsToDelete: The indexSet of the sections which were recently deleted from the previous sectioned results collection.\n     */\n    case update(Collection, deletions: [IndexPath], insertions: [IndexPath], modifications: [IndexPath],\n                sectionsToInsert: IndexSet, sectionsToDelete: IndexSet)\n\n    /// :nodoc:\n    static func fromObjc(value: Collection, change: RLMSectionedResultsChange?) -> SectionedResultsChange {\n        if let change = change {\n            return .update(value,\n                           deletions: change.deletions as [IndexPath],\n                           insertions: change.insertions as [IndexPath],\n                           modifications: change.modifications as [IndexPath],\n                           sectionsToInsert: change.sectionsToInsert,\n                           sectionsToDelete: change.sectionsToRemove)\n        }\n        return .initial(value)\n    }\n}\n\n/// :nodoc:\n@available(*, deprecated, renamed: \"SectionedResultsChange\")\npublic typealias RealmSectionedResultsChange = SectionedResultsChange\n\n/**\n An iterator for a `SectionedResults` instance.\n */\n@frozen public struct SectionedResultsIterator<Key: _Persistable & Hashable, Element: RealmCollectionValue>: IteratorProtocol {\n    private var generatorBase: NSFastEnumerationIterator\n\n    init(collection: RLMSectionedResults<RLMValue, RLMValue>) {\n        generatorBase = NSFastEnumerationIterator(collection)\n    }\n\n    /// Advance to the next element and return it, or `nil` if no next element exists.\n    public mutating func next() -> ResultsSection<Key, Element>? {\n        guard let next = generatorBase.next() else { return nil }\n        return ResultsSection<Key, Element>(rlmSectionedResult: next as! RLMSection<RLMValue, RLMValue>)\n    }\n}\n\n/// :nodoc:\n@available(*, deprecated, renamed: \"SectionedResultsIterator\")\npublic typealias RLMSectionedResultsIterator = SectionedResultsIterator\n\n/**\n An iterator for a `Section` instance.\n */\n@frozen public struct SectionIterator<Element: RealmCollectionValue>: IteratorProtocol {\n    private var generatorBase: NSFastEnumerationIterator\n\n    init(collection: RLMSection<RLMValue, RLMValue>) {\n        generatorBase = NSFastEnumerationIterator(collection)\n    }\n\n    /// Advance to the next element and return it, or `nil` if no next element exists.\n    public mutating func next() -> Element? {\n        guard let next = generatorBase.next() else { return nil }\n        return next as? Element\n    }\n}\n\n/// :nodoc:\n@available(*, deprecated, renamed: \"SectionIterator\")\npublic typealias RLMSectionIterator = SectionIterator\n"
  },
  {
    "path": "RealmSwift/SortDescriptor.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\n\n/**\n A `SortDescriptor` stores a key path and a sort order for use with `sorted(sortDescriptors:)`. It is similar to\n `NSSortDescriptor`, but supports only the subset of functionality which can be efficiently run by Realm's query engine.\n */\n@frozen public struct SortDescriptor {\n\n    // MARK: Properties\n\n    /// The key path which the sort descriptor orders results by.\n    public let keyPath: String\n\n    /// Whether this descriptor sorts in ascending or descending order.\n    public let ascending: Bool\n\n    /// Converts the receiver to an `RLMSortDescriptor`.\n    internal var rlmSortDescriptorValue: RLMSortDescriptor {\n        return RLMSortDescriptor(keyPath: keyPath, ascending: ascending)\n    }\n\n    // MARK: Initializers\n\n    /**\n     Creates a sort descriptor with the given key path and sort order values.\n\n     - parameter keyPath:   The key path which the sort descriptor orders results by.\n     - parameter ascending: Whether the descriptor sorts in ascending or descending order.\n     */\n    public init(keyPath: String, ascending: Bool = true) {\n        self.keyPath = keyPath\n        self.ascending = ascending\n    }\n\n    /**\n     Creates a sort descriptor with the given key path and sort order values.\n\n     - parameter keyPath:   The key path which the sort descriptor orders results by.\n     - parameter ascending: Whether the descriptor sorts in ascending or descending order.\n     */\n    public init<Element: ObjectBase>(keyPath: PartialKeyPath<Element>, ascending: Bool = true) {\n        self.keyPath = _name(for: keyPath)\n        self.ascending = ascending\n    }\n\n    // MARK: Functions\n\n    /// Returns a copy of the sort descriptor with the sort order reversed.\n    public func reversed() -> SortDescriptor {\n        return SortDescriptor(keyPath: keyPath, ascending: !ascending)\n    }\n}\n\n// MARK: CustomStringConvertible\n\nextension SortDescriptor: CustomStringConvertible {\n    /// A human-readable description of the sort descriptor.\n    public var description: String {\n        let direction = ascending ? \"ascending\" : \"descending\"\n        return \"SortDescriptor(keyPath: \\(keyPath), direction: \\(direction))\"\n    }\n}\n\n// MARK: Equatable\n\nextension SortDescriptor: Equatable {\n    /// Returns whether the two sort descriptors are equal.\n    public static func == (lhs: SortDescriptor, rhs: SortDescriptor) -> Bool {\n        return lhs.keyPath == rhs.keyPath &&\n            lhs.ascending == rhs.ascending\n    }\n}\n\n// MARK: StringLiteralConvertible\n\nextension SortDescriptor: ExpressibleByStringLiteral {\n\n    public typealias UnicodeScalarLiteralType = StringLiteralType\n    public typealias ExtendedGraphemeClusterLiteralType = StringLiteralType\n\n    /**\n     Creates a `SortDescriptor` out of a string literal.\n\n     - parameter stringLiteral: Property name literal.\n     */\n    public init(stringLiteral value: StringLiteralType) {\n        self.init(keyPath: value)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/SwiftUI.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n //\n // Copyright 2021 Realm Inc.\n //\n // Licensed under the Apache License, Version 2.0 (the \"License\");\n // you may not use this file except in compliance with the License.\n // You may obtain a copy of the License at\n //\n // http://www.apache.org/licenses/LICENSE-2.0\n //\n // Unless required by applicable law or agreed to in writing, software\n // distributed under the License is distributed on an \"AS IS\" BASIS,\n // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n // See the License for the specific language governing permissions and\n // limitations under the License.\n //\n ////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\n\nimport SwiftUI\nimport Combine\nimport Realm\nimport Realm.Private\n\nprivate func write<Value>(_ value: Value, _ block: (Value) -> Void) where Value: ThreadConfined {\n    let thawed = value.realm == nil ? value : value.thaw() ?? value\n    if let realm = thawed.realm, !realm.isInWriteTransaction {\n        try! realm.write {\n            block(thawed)\n        }\n    } else {\n        block(thawed)\n    }\n}\n\nprivate func thawObjectIfFrozen<Value>(_ value: Value) -> Value where Value: ObjectBase & ThreadConfined {\n    return value.realm == nil ? value : value.thaw() ?? value\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\n@MainActor\nprivate func createBinding<T: ThreadConfined, V>(\n    _ value: T,\n    forKeyPath keyPath: ReferenceWritableKeyPath<T, V>) -> Binding<V> {\n\n    guard let value = value.isFrozen ? value.thaw() : value else {\n        throwRealmException(\"Could not bind value\")\n    }\n\n    // store last known value outside of the binding so that we can reference it if the parent\n    // is invalidated\n    var lastValue = value[keyPath: keyPath]\n    return Binding(get: {\n        guard !value.isInvalidated else { return lastValue }\n        lastValue = value[keyPath: keyPath]\n        return lastValue\n    }, set: { newValue in\n        guard !value.isInvalidated else { return }\n        write(value) { value in\n            value[keyPath: keyPath] = newValue\n        }\n    })\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\n@MainActor\nprivate func createCollectionBinding<T: ThreadConfined, V: RLMSwiftCollectionBase & ThreadConfined>(\n    _ value: T,\n    forKeyPath keyPath: ReferenceWritableKeyPath<T, V>) -> Binding<V> {\n\n    guard let value = value.isFrozen ? value.thaw() : value else {\n        throwRealmException(\"Could not bind value\")\n    }\n\n    var lastValue = value[keyPath: keyPath]\n    return Binding(get: {\n        guard !value.isInvalidated else { return lastValue }\n        lastValue = value[keyPath: keyPath]\n        if lastValue.realm != nil {\n            lastValue = lastValue.freeze()\n        }\n        return lastValue\n    }, set: { newValue in\n        guard !value.isInvalidated else { return }\n        write(value) { value in\n            value[keyPath: keyPath] = newValue\n        }\n    })\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\n@MainActor\nprivate func createEquatableBinding<T: ThreadConfined, V: Equatable>(\n    _ value: T,\n    forKeyPath keyPath: ReferenceWritableKeyPath<T, V>) -> Binding<V> {\n\n    guard let value = value.isFrozen ? value.thaw() : value else {\n        throwRealmException(\"Could not bind value\")\n    }\n\n    var lastValue = value[keyPath: keyPath]\n    return Binding(get: {\n        guard !value.isInvalidated else { return lastValue }\n        lastValue = value[keyPath: keyPath]\n        return lastValue\n    }, set: { newValue in\n        guard !value.isInvalidated else { return }\n        guard value[keyPath: keyPath] != newValue else { return }\n        write(value) { value in\n            value[keyPath: keyPath] = newValue\n        }\n    })\n}\n\n// MARK: SwiftUIKVO\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\n@objc(RLMSwiftUIKVO) internal final class SwiftUIKVO: NSObject {\n    /// Objects must have observers removed before being added to a realm.\n    /// They are stored here so that if they are appended through the Bound Property\n    /// system, they can be de-observed before hand.\n    private static let observedObjects = AllocatedUnfairLock([NSObject: Subscription]())\n\n    static func store(_ obj: NSObject, _ subscription: Subscription) {\n        SwiftUIKVO.observedObjects.withLock {\n            $0[obj] = subscription\n        }\n    }\n\n    static func cancel(_ obj: NSObject) {\n        SwiftUIKVO.observedObjects.withLock {\n            if let subscription: Subscription = $0.removeValue(forKey: obj) {\n                subscription.removeObservers()\n            }\n        }\n    }\n\n    struct Subscription: Combine.Subscription {\n        let observer: NSObject\n        let value: NSObject\n        let keyPaths: [String]\n\n        var combineIdentifier: CombineIdentifier {\n            CombineIdentifier(value)\n        }\n\n        func request(_ demand: Subscribers.Demand) {\n        }\n\n        func cancel() {\n            SwiftUIKVO.cancel(value)\n        }\n\n        fileprivate func removeObservers() {\n            keyPaths.forEach {\n                value.removeObserver(observer, forKeyPath: $0)\n            }\n        }\n\n        fileprivate func addObservers() {\n            keyPaths.forEach {\n                value.addObserver(observer, forKeyPath: $0, options: .init(), context: nil)\n            }\n        }\n    }\n    private let receive: () -> Void\n\n    override func observeValue(forKeyPath keyPath: String?,\n                               of object: Any?,\n                               change: [NSKeyValueChangeKey: Any]?,\n                               context: UnsafeMutableRawPointer?) {\n        receive()\n    }\n\n    init<S>(subscriber: S) where S: Subscriber, S.Input == Void {\n        receive = { _ = subscriber.receive() }\n        super.init()\n    }\n}\n\n// MARK: - ObservableStorage\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\nprivate final class ObservableStoragePublisher<ObjectType>: Publisher where ObjectType: ThreadConfined & RealmSubscribable {\n    public typealias Output = Void\n    public typealias Failure = Never\n\n    var subscribers = [AnySubscriber<Void, Never>]()\n    private var value: ObjectType\n    private let keyPaths: [String]?\n    private let unwrappedValue: ObjectBase?\n\n    init(_ value: ObjectType, _ keyPaths: [String]? = nil) {\n        self.value = value\n        self.keyPaths = keyPaths\n        self.unwrappedValue = nil\n    }\n\n    init(_ value: ObjectType, _ keyPaths: [String]? = nil) where ObjectType: ObjectBase {\n        self.value = value\n        self.keyPaths = keyPaths\n        self.unwrappedValue = value\n    }\n\n    init(_ value: ObjectType, _ keyPaths: [String]? = nil) where ObjectType: ProjectionObservable {\n        self.value = value\n        self.keyPaths = keyPaths\n        self.unwrappedValue = value.rootObject\n    }\n\n    // Refresh the publisher with a managed object.\n    func update(value: ObjectType) {\n        self.value = value\n    }\n\n    func send() {\n        subscribers.forEach {\n            _ = $0.receive()\n        }\n    }\n\n    public func receive<S>(subscriber: S) where S: Subscriber, Failure == S.Failure, Output == S.Input {\n        subscribers.append(AnySubscriber(subscriber))\n        if value.realm != nil && !value.isInvalidated, let value = value.thaw() {\n            // This path is for cases where the object is already managed. If an\n            // unmanaged object becomes managed it will continue to use KVO.\n            let token =  value._observe(keyPaths, subscriber)\n            subscriber.receive(subscription: ObservationSubscription(token: token))\n        } else if let value = unwrappedValue, !value.isInvalidated {\n            // else if the value is unmanaged\n            let schema = ObjectSchema(RLMObjectBaseObjectSchema(value)!)\n            let kvo = SwiftUIKVO(subscriber: subscriber)\n\n            var keyPaths = [String]()\n            for property in schema.properties {\n                keyPaths.append(property.name)\n                value.addObserver(kvo, forKeyPath: property.name, options: .init(), context: nil)\n            }\n            let subscription = SwiftUIKVO.Subscription(observer: kvo, value: value, keyPaths: keyPaths)\n            subscriber.receive(subscription: subscription)\n            SwiftUIKVO.store(value, subscription)\n        }\n    }\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\nprivate class ObservableStorage<ObservedType>: ObservableObject where ObservedType: RealmSubscribable & ThreadConfined & Equatable {\n    @Published var value: ObservedType {\n        willSet {\n            if newValue != value {\n                objectWillChange.send()\n                objectWillChange.update(value: newValue)\n                objectWillChange.subscribers.forEach {\n                    $0.receive(subscription: ObservationSubscription(token: newValue._observe(keyPaths, $0)))\n                }\n            }\n        }\n    }\n\n    let objectWillChange: ObservableStoragePublisher<ObservedType>\n    let keyPaths: [String]?\n\n    init(_ value: ObservedType, _ keyPaths: [String]? = nil) {\n        self.value = value.realm != nil && !value.isInvalidated ? value.thaw() ?? value : value\n        self.objectWillChange = ObservableStoragePublisher(value, keyPaths)\n        self.keyPaths = keyPaths\n    }\n\n    init(_ value: ObservedType, _ keyPaths: [String]? = nil) where ObservedType: ObjectBase {\n        self.value = value.realm != nil && !value.isInvalidated ? value.thaw() ?? value : value\n        self.objectWillChange = ObservableStoragePublisher(value, keyPaths)\n        self.keyPaths = keyPaths\n    }\n\n    init(_ value: ObservedType, _ keyPaths: [String]? = nil) where ObservedType: ProjectionObservable {\n        self.value = value.realm != nil && !value.isInvalidated ? value.thaw() ?? value : value\n        self.objectWillChange = ObservableStoragePublisher(value, keyPaths)\n        self.keyPaths = keyPaths\n    }\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\nprivate class ObservableResultsStorage<T>: ObservableStorage<T> where T: RealmSubscribable & ThreadConfined & Equatable {\n    private var setupHasRun = false\n    func didSet() {\n        if setupHasRun {\n            updateValue()\n        }\n    }\n\n    func updateValue() {\n        // Implemented in subclasses\n        fatalError()\n    }\n\n    func setupValue() {\n        guard !setupHasRun else { return }\n        updateValue()\n        setupHasRun = true\n    }\n\n    var sortDescriptor: SortDescriptor? {\n        didSet {\n            didSet()\n        }\n    }\n\n    var filter: NSPredicate? {\n        didSet {\n            didSet()\n        }\n    }\n    var configuration: Realm.Configuration? {\n        didSet {\n            didSet()\n        }\n    }\n\n    var searchFilter: NSPredicate? {\n        didSet {\n            didSet()\n        }\n    }\n\n    private var searchString: String = \"\"\n    fileprivate func searchText<U: ObjectBase>(_ text: String, on keyPath: KeyPath<U, String>) {\n        guard text != searchString else { return }\n        if text.isEmpty {\n            searchFilter = nil\n        } else {\n            searchFilter = Query<U>()[dynamicMember: keyPath].contains(text).predicate\n        }\n        searchString = text\n    }\n}\n\n// MARK: - StateRealmObject\n\n/// A property wrapper type that instantiates an observable object.\n///\n/// Create a state realm object in a ``SwiftUI/View``, ``SwiftUI/App``, or\n/// ``SwiftUI/Scene`` by applying the `@StateRealmObject` attribute to a property\n/// declaration and providing an initial value that conforms to the\n/// <doc://com.apple.documentation/documentation/Combine/ObservableObject>\n/// protocol:\n///\n///     @StateRealmObject var model = DataModel()\n///\n/// SwiftUI creates a new instance of the object only once for each instance of\n/// the structure that declares the object. When published properties of the\n/// observable realm object change, SwiftUI updates the parts of any view that depend\n/// on those properties. If unmanaged, the property will be read from the object itself,\n/// otherwise, it will be read from the underlying Realm. Changes to the value will update\n/// the view asynchronously:\n///\n///     Text(model.title) // Updates the view any time `title` changes.\n///\n/// You can pass the state object into a property that has the\n/// ``SwiftUI/ObservedRealmObject`` attribute.\n///\n/// Get a ``SwiftUI/Binding`` to one of the state object's properties using the\n/// `$` operator. Use a binding when you want to create a two-way connection to\n/// one of the object's properties. For example, you can let a\n/// ``SwiftUI/Toggle`` control a Boolean value called `isEnabled` stored in the\n/// model:\n///\n///     Toggle(\"Enabled\", isOn: $model.isEnabled)\n///\n/// This will write the modified `isEnabled` property to the `model` object's Realm.\n@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)\n@MainActor\n@propertyWrapper public struct StateRealmObject<T: RealmSubscribable & ThreadConfined & Equatable>: DynamicProperty {\n    @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)\n    @StateObject private var storage: ObservableStorage<T>\n    private let defaultValue: T\n\n    /// :nodoc:\n    public var wrappedValue: T {\n        get {\n            let value = storage.value\n            if value.realm == nil {\n                // if unmanaged return the unmanaged value\n                return value\n            } else if value.isInvalidated {\n                // if invalidated, return the default value\n                return defaultValue\n            }\n            // else return the frozen value. the frozen value\n            // will be consumed by SwiftUI, which requires\n            // the ability to cache and diff objects and collections\n            // during some timeframe. The ObjectType is frozen so that\n            // SwiftUI can cache state. other access points will thaw\n            // the ObjectType\n            return value.freeze()\n        }\n        nonmutating set {\n            storage.value = newValue\n        }\n    }\n    /// :nodoc:\n    public var projectedValue: Binding<T> {\n        Binding(get: {\n            let value = self.storage.value\n            if value.isInvalidated {\n                return self.defaultValue\n            }\n            return value\n        }, set: { newValue in\n            self.storage.value = newValue\n        })\n    }\n    /**\n     Initialize a RealmState struct for a given thread confined type.\n     - parameter wrappedValue The List reference to wrap and observe.\n     */\n    @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)\n    public init<Value>(wrappedValue: T) where T == List<Value> {\n        self._storage = StateObject(wrappedValue: ObservableStorage(wrappedValue))\n        defaultValue = T()\n    }\n    /**\n     Initialize a RealmState struct for a given thread confined type.\n     - parameter wrappedValue The MutableSet reference to wrap and observe.\n     */\n    @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)\n    public init<Value>(wrappedValue: T) where T == MutableSet<Value> {\n        self._storage = StateObject(wrappedValue: ObservableStorage(wrappedValue))\n        defaultValue = T()\n    }\n    /**\n     Initialize a RealmState struct for a given thread confined type.\n     - parameter wrappedValue The Map reference to wrap and observe.\n     */\n    @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)\n    public init<Key, Value>(wrappedValue: T) where T == Map<Key, Value> {\n        self._storage = StateObject(wrappedValue: ObservableStorage(wrappedValue))\n        defaultValue = T()\n    }\n    /**\n     Initialize a RealmState struct for a given thread confined type.\n     - parameter wrappedValue The ObjectBase reference to wrap and observe.\n     */\n    @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)\n    public init(wrappedValue: T) where T: ObjectBase & Identifiable {\n        self._storage = StateObject(wrappedValue: ObservableStorage(wrappedValue))\n        defaultValue = T()\n    }\n    /**\n     Initialize a RealmState struct for a given Projection type.\n     - parameter wrappedValue The Projection reference to wrap and observe.\n     */\n    @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)\n    public init(wrappedValue: T) where T: ProjectionObservable {\n        self._storage = StateObject(wrappedValue: ObservableStorage(wrappedValue))\n        defaultValue = T(projecting: T.Root())\n    }\n\n    /// :nodoc:\n    public var _publisher: some Publisher {\n        self.storage.objectWillChange\n    }\n}\n\n// MARK: ObservedResults\n/**\n A type which can be used with @ObservedResults propperty wrapper. Children class of Realm Object or Projection.\n It's made to specialize the init methods of ObservedResults.\n */\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\npublic protocol _ObservedResultsValue: RealmCollectionValue { }\n\n/// :nodoc:\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\nextension Object: _ObservedResultsValue { }\n\n/// :nodoc:\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\nextension Projection: _ObservedResultsValue { }\n\n/// A property wrapper type that represents the results of a query on a realm.\n///\n/// The results use the realm configuration provided by\n/// the environment value `EnvironmentValues/realmConfiguration`.\n///\n/// Unlike non-SwiftUI results collections, the ObservedResults is mutable. Writes to an ObservedResults collection implicitly\n/// perform a write transaction. If you add an object to the ObservedResults that the associated query would filter out, the object\n/// is added to the realm but not included in the ObservedResults.\n///\n/// Given `@ObservedResults var v` in SwiftUI, `$v` refers to a `BoundCollection`.\n///\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\n@propertyWrapper public struct ObservedResults<ResultType>: DynamicProperty, BoundCollection where ResultType: _ObservedResultsValue & RealmFetchable & KeypathSortable & Identifiable {\n    public typealias Element = ResultType\n    private class Storage: ObservableResultsStorage<Results<ResultType>> {\n        override func updateValue() {\n            let realm = try! Realm(configuration: configuration ?? Realm.Configuration.defaultConfiguration)\n            var value = realm.objects(ResultType.self)\n            if let sortDescriptor = sortDescriptor {\n                value = value.sorted(byKeyPath: sortDescriptor.keyPath, ascending: sortDescriptor.ascending)\n            }\n\n            let filters = [searchFilter, filter].compactMap { $0 }\n            if !filters.isEmpty {\n                let compoundFilter = NSCompoundPredicate(andPredicateWithSubpredicates: filters)\n                value = value.filter(compoundFilter)\n            }\n            self.value = value\n        }\n    }\n\n    @Environment(\\.realmConfiguration) var configuration\n    @ObservedObject private var storage: Storage\n    fileprivate func searchText<T: ObjectBase>(_ text: String, on keyPath: KeyPath<T, String>) {\n        storage.searchText(text, on: keyPath)\n    }\n\n    /// Stores an NSPredicate used for filtering the Results. This is mutually exclusive\n    /// to the `where` parameter.\n    @State public var filter: NSPredicate? {\n        willSet {\n            storage.filter = newValue\n        }\n    }\n    /// Stores a type safe query used for filtering the Results. This is mutually exclusive\n    /// to the `filter` parameter.\n    @State public var `where`: ((Query<ResultType>) -> Query<Bool>)? {\n        willSet {\n            storage.filter = newValue?(Query()).predicate\n        }\n    }\n    /// :nodoc:\n    @State public var sortDescriptor: SortDescriptor? {\n        willSet {\n            storage.sortDescriptor = newValue\n        }\n    }\n    /// :nodoc:\n    public var wrappedValue: Results<ResultType> {\n        storage.setupValue()\n        return storage.configuration != nil ? storage.value.freeze() : storage.value\n    }\n    /// :nodoc:\n    public var projectedValue: Self {\n        return self\n    }\n\n    /**\n     Initialize a `ObservedResults` struct for a given `Projection` type.\n     - parameter type: Observed type\n     - parameter configuration: The `Realm.Configuration` used when creating the Realm,\n     user's sync configuration for the given partition value will be set as the `syncConfiguration`,\n     if empty the configuration is set to the `defaultConfiguration`\n     - parameter filter: Observations will be made only for passing objects.\n     If no filter given - all objects will be observed\n     - parameter keyPaths: Only properties contained in the key paths array will be observed.\n     If `nil`, notifications will be delivered for any property change on the object.\n     String key paths which do not correspond to a valid a property will throw an exception.\n     - parameter sortDescriptor: A sequence of `SortDescriptor`s to sort by\n     */\n    public init<ObjectType: ObjectBase>(_ type: ResultType.Type,\n                                        configuration: Realm.Configuration? = nil,\n                                        filter: NSPredicate? = nil,\n                                        keyPaths: [String]? = nil,\n                                        sortDescriptor: SortDescriptor? = nil) where ResultType: Projection<ObjectType>, ObjectType: ThreadConfined {\n        let results = Results<ResultType>(RLMResults<ResultType>.emptyDetached())\n        self.storage = Storage(results, keyPaths)\n        self.storage.configuration = configuration\n        self.filter = filter\n        self.sortDescriptor = sortDescriptor\n    }\n    /**\n     Initialize a `ObservedResults` struct for a given `Object` or `EmbeddedObject` type.\n     - parameter type: Observed type\n     - parameter configuration: The `Realm.Configuration` used when creating the Realm,\n     user's sync configuration for the given partition value will be set as the `syncConfiguration`,\n     if empty the configuration is set to the `defaultConfiguration`\n     - parameter filter: Observations will be made only for passing objects.\n     If no filter given - all objects will be observed\n     - parameter keyPaths: Only properties contained in the key paths array will be observed.\n     If `nil`, notifications will be delivered for any property change on the object.\n     String key paths which do not correspond to a valid a property will throw an exception.\n     - parameter sortDescriptor: A sequence of `SortDescriptor`s to sort by\n     */\n    public init(_ type: ResultType.Type,\n                configuration: Realm.Configuration? = nil,\n                filter: NSPredicate? = nil,\n                keyPaths: [String]? = nil,\n                sortDescriptor: SortDescriptor? = nil) where ResultType: Object {\n        self.storage = Storage(Results(RLMResults<ResultType>.emptyDetached()), keyPaths)\n        self.storage.configuration = configuration\n        self.filter = filter\n        self.sortDescriptor = sortDescriptor\n    }\n    /**\n     Initialize a `ObservedResults` struct for a given `Object` or `EmbeddedObject` type.\n     - parameter type: Observed type\n     - parameter configuration: The `Realm.Configuration` used when creating the Realm,\n     user's sync configuration for the given partition value will be set as the `syncConfiguration`,\n     if empty the configuration is set to the `defaultConfiguration`\n     - parameter where: Observations will be made only for passing objects.\n     If no type safe query is given - all objects will be observed\n     - parameter keyPaths: Only properties contained in the key paths array will be observed.\n     If `nil`, notifications will be delivered for any property change on the object.\n     String key paths which do not correspond to a valid a property will throw an exception.\n     - parameter sortDescriptor: A sequence of `SortDescriptor`s to sort by\n     */\n    public init(_ type: ResultType.Type,\n                configuration: Realm.Configuration? = nil,\n                where: ((Query<ResultType>) -> Query<Bool>)? = nil,\n                keyPaths: [String]? = nil,\n                sortDescriptor: SortDescriptor? = nil) where ResultType: Object {\n        self.storage = Storage(Results(RLMResults<ResultType>.emptyDetached()), keyPaths)\n        self.storage.configuration = configuration\n        self.where = `where`\n        self.sortDescriptor = sortDescriptor\n    }\n    /// :nodoc:\n    public init(_ type: ResultType.Type,\n                keyPaths: [String]? = nil,\n                configuration: Realm.Configuration? = nil,\n                sortDescriptor: SortDescriptor? = nil) where ResultType: Object {\n        self.storage = Storage(Results(RLMResults<ResultType>.emptyDetached()), keyPaths)\n        self.storage.configuration = configuration\n        self.sortDescriptor = sortDescriptor\n    }\n\n    nonisolated public func update() {\n        MainActor.assumeIsolated {\n            // When the view updates, it will inject the @Environment\n            // into the propertyWrapper\n            if storage.configuration == nil {\n                storage.configuration = configuration\n            }\n        }\n    }\n}\n\n/// A property wrapper type that represents a sectioned results collection.\n///\n/// The sectioned results use the realm configuration provided by\n/// the environment value `EnvironmentValues/realmConfiguration`\n/// if `configuration` is not set in the initializer.\n///\n///\n/// Given `@ObservedSectionedResults var v` in SwiftUI, `$v` refers to a `BoundCollection`.\n///\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\n@propertyWrapper public struct ObservedSectionedResults<Key: _Persistable & Hashable, ResultType>: DynamicProperty, BoundCollection where ResultType: _ObservedResultsValue & RealmFetchable & KeypathSortable & Identifiable {\n    public typealias Element = ResultType\n\n    private class Storage: ObservableResultsStorage<Results<ResultType>> {\n        var sectionedResults: SectionedResults<Key, ResultType>!\n        var token: AnyCancellable?\n\n        override func updateValue() {\n            let realm = try! Realm(configuration: configuration ?? Realm.Configuration.defaultConfiguration)\n            var results = realm.objects(ResultType.self)\n\n            let filters = [searchFilter, filter].compactMap { $0 }\n            if !filters.isEmpty {\n                let compoundFilter = NSCompoundPredicate(andPredicateWithSubpredicates: filters)\n                results = results.filter(compoundFilter)\n            }\n\n            if let keyPathString = keyPathString, sortDescriptors.isEmpty {\n                sortDescriptors.append(.init(keyPath: keyPathString, ascending: true))\n            }\n\n            value = results\n\n            /*\n             Observing the sectioned results directly doesn't allow the SwiftUI diff to work\n             correctly as the previous state of the sectioned results will have the new values.\n\n             An example of when this is an issue is when an item is deleted in a List containing sectioned results,\n             the diff needs a stable state of the previous transaction but due to\n             the observation callback calling calculate_sections the collection will be brought up to date.\n\n             The solution around this is to store a frozen copy of the sectioned results and observe the parent `Results` instead.\n             Each time the results observation callback is invoked and the SwiftUI View is redrawn the sectioned results will be updated.\n             */\n            sectionedResults = value.sectioned(sortDescriptors: sortDescriptors, sectionBlock).freeze()\n            token = self.objectWillChange.sink { [weak self] _ in\n                guard let self = self else { return }\n                self.sectionedResults = self.value.sectioned(sortDescriptors: self.sortDescriptors, self.sectionBlock).freeze()\n            }\n        }\n\n        var sortDescriptors: [SortDescriptor] = [] {\n            didSet {\n                didSet()\n            }\n        }\n        var sectionBlock: ((ResultType) -> Key)\n        var keyPathString: String?\n\n        init(_ value: Results<ResultType>,\n             sectionBlock: @escaping ((ResultType) -> Key),\n             sortDescriptors: [SortDescriptor],\n             keyPathString: String? = nil,\n             keyPaths: [String]? = nil) {\n            self.sectionBlock = sectionBlock\n            self.sortDescriptors = sortDescriptors\n            if let keyPathString = keyPathString {\n                self.keyPathString = keyPathString\n                self.sortDescriptors.append(.init(keyPath: keyPathString, ascending: true))\n            }\n            if self.sortDescriptors.isEmpty {\n                throwRealmException(\"sortDescriptors must not be empty when sectioning ObservedSectionedResults with `sectionBlock`\")\n            }\n            super.init(value, keyPaths)\n        }\n    }\n\n    @Environment(\\.realmConfiguration) var configuration\n    @ObservedObject private var storage: Storage\n    /// :nodoc:\n    fileprivate func searchText<T: ObjectBase>(_ text: String, on keyPath: KeyPath<T, String>) {\n        storage.searchText(text, on: keyPath)\n    }\n    /// Stores an NSPredicate used for filtering the SectionedResults. This is mutually exclusive\n    /// to the `where` parameter.\n    @State public var filter: NSPredicate? {\n        willSet {\n            storage.filter = newValue\n        }\n    }\n    /// Stores a type safe query used for filtering the SectionedResults. This is mutually exclusive\n    /// to the `filter` parameter.\n    @State public var `where`: ((Query<ResultType>) -> Query<Bool>)? {\n        willSet {\n            storage.filter = newValue?(Query()).predicate\n        }\n    }\n    /// :nodoc:\n    @State public var sortDescriptors: [SortDescriptor] = [] {\n        willSet {\n            storage.sortDescriptors = newValue\n        }\n    }\n    /// :nodoc:\n    public var wrappedValue: SectionedResults<Key, ResultType> {\n        storage.setupValue()\n        return storage.sectionedResults\n    }\n    /// :nodoc:\n    public var projectedValue: Self {\n        return self\n    }\n\n    /// Removes items from an `@ObservedSectionedResults` collection\n    /// with a given `IndexSet` and `ResultsSection`.\n    /// - Parameters:\n    ///   - offsets: Index offsets in the section.\n    ///   - section: The section containing the items to remove.\n    public func remove(atOffsets offsets: IndexSet,\n                       section: ResultsSection<Key, ResultType>) where ResultType: ObjectBase & ThreadConfined {\n        write(wrappedValue) { collection in\n            collection.realm?.delete(offsets.compactMap { section[$0].thaw() ?? nil })\n        }\n    }\n\n    private init(type: ResultType.Type,\n                 sectionBlock: @escaping ((ResultType) -> Key),\n                 sortDescriptors: [SortDescriptor] = [],\n                 filter: NSPredicate? = nil,\n                 where: ((Query<ResultType>) -> Query<Bool>)? = nil,\n                 keyPaths: [String]? = nil,\n                 keyPathString: String? = nil,\n                 configuration: Realm.Configuration? = nil) where ResultType: AnyObject {\n        let results = Results<ResultType>(RLMResults<ResultType>.emptyDetached())\n        self.storage = Storage(results,\n                               sectionBlock: sectionBlock,\n                               sortDescriptors: sortDescriptors,\n                               keyPathString: keyPathString,\n                               keyPaths: keyPaths)\n        self.storage.configuration = configuration\n        if let filter = filter {\n            self.filter = filter\n        } else if let `where` = `where` {\n            self.where = `where`\n        }\n        self.sortDescriptors = sortDescriptors\n    }\n\n    /**\n     Initialize a `ObservedSectionedResults` struct for a given `Projection` type.\n     - parameter type: Observed type\n     - parameter sectionKeyPath: The keyPath that will produce the key for each section.\n     For every unique value retrieved from the keyPath a section key will be generated.\n     - parameter sortDescriptors: A sequence of `SortDescriptor`s to sort by.\n     - parameter filter: Observations will be made only for passing objects.\n     If no filter given - all objects will be observed\n     - parameter keyPaths: Only properties contained in the key paths array will be observed.\n     If `nil`, notifications will be delivered for any property change on the object.\n     String key paths which do not correspond to a valid a property will throw an exception.\n     - parameter configuration: The `Realm.Configuration` used when creating the Realm.\n     If empty the configuration is set to the `defaultConfiguration`\n\n     - note: The primary sort descriptor must be responsible for determining the section key.\n     */\n    public init<ObjectType: ObjectBase>(_ type: ResultType.Type,\n                                        sectionKeyPath: KeyPath<ResultType, Key>,\n                                        sortDescriptors: [SortDescriptor] = [],\n                                        filter: NSPredicate? = nil,\n                                        keyPaths: [String]? = nil,\n                                        configuration: Realm.Configuration? = nil) where ResultType: Projection<ObjectType>, ObjectType: ThreadConfined {\n        self.init(type: type,\n                  sectionBlock: { (obj: ResultType) in obj[keyPath: sectionKeyPath] },\n                  sortDescriptors: sortDescriptors,\n                  filter: filter,\n                  keyPaths: keyPaths,\n                  keyPathString: _name(for: sectionKeyPath),\n                  configuration: configuration)\n    }\n\n    /**\n     Initialize a `ObservedSectionedResults` struct for a given `Projection` type.\n     - parameter type: Observed type\n     - parameter sectionBlock: A callback which returns the section key for each object in the collection.\n     - parameter sortDescriptors: A sequence of `SortDescriptor`s to sort by.\n     - parameter filter: Observations will be made only for passing objects.\n     If no filter given - all objects will be observed\n     - parameter keyPaths: Only properties contained in the key paths array will be observed.\n     If `nil`, notifications will be delivered for any property change on the object.\n     String key paths which do not correspond to a valid a property will throw an exception.\n     - parameter configuration: The `Realm.Configuration` used when creating the Realm.\n     If empty the configuration is set to the `defaultConfiguration`\n\n     - note: The primary sort descriptor must be responsible for determining the section key.\n     */\n    public init<ObjectType: ObjectBase>(_ type: ResultType.Type,\n                                        sectionBlock: @escaping ((ResultType) -> Key),\n                                        sortDescriptors: [SortDescriptor] = [],\n                                        filter: NSPredicate? = nil,\n                                        keyPaths: [String]? = nil,\n                                        configuration: Realm.Configuration? = nil) where ResultType: Projection<ObjectType>, ObjectType: ThreadConfined {\n        self.init(type: type,\n                  sectionBlock: sectionBlock,\n                  sortDescriptors: sortDescriptors,\n                  filter: filter,\n                  keyPaths: keyPaths,\n                  configuration: configuration)\n    }\n\n    /**\n     Initialize a `ObservedSectionedResults` struct for a given `Object` or `EmbeddedObject` type.\n     - parameter type: Observed type\n     - parameter sectionKeyPath: The keyPath that will produce the key for each section.\n     For every unique value retrieved from the keyPath a section key will be generated.\n     - parameter sortDescriptors: A sequence of `SortDescriptor`s to sort by.\n     - parameter filter: Observations will be made only for passing objects.\n     If no filter given - all objects will be observed\n     - parameter keyPaths: Only properties contained in the key paths array will be observed.\n     If `nil`, notifications will be delivered for any property change on the object.\n     String key paths which do not correspond to a valid a property will throw an exception.\n     - parameter configuration: The `Realm.Configuration` used when creating the Realm.\n     If empty the configuration is set to the `defaultConfiguration`\n\n     - note: The primary sort descriptor must be responsible for determining the section key.\n     */\n    public init(_ type: ResultType.Type,\n                sectionKeyPath: KeyPath<ResultType, Key>,\n                sortDescriptors: [SortDescriptor] = [],\n                filter: NSPredicate? = nil,\n                keyPaths: [String]? = nil,\n                configuration: Realm.Configuration? = nil) where ResultType: Object {\n        self.init(type: type,\n                  sectionBlock: { (obj: ResultType) in obj[keyPath: sectionKeyPath] },\n                  sortDescriptors: sortDescriptors,\n                  filter: filter,\n                  keyPaths: keyPaths,\n                  keyPathString: _name(for: sectionKeyPath),\n                  configuration: configuration)\n    }\n\n    /**\n     Initialize a `ObservedSectionedResults` struct for a given `Object` or `EmbeddedObject` type.\n     - parameter type: Observed type\n     - parameter sectionBlock: A callback which returns the section key for each object in the collection.\n     - parameter sortDescriptors: A sequence of `SortDescriptor`s to sort by.\n     - parameter filter: Observations will be made only for passing objects.\n     If no filter given - all objects will be observed\n     - parameter keyPaths: Only properties contained in the key paths array will be observed.\n     If `nil`, notifications will be delivered for any property change on the object.\n     String key paths which do not correspond to a valid a property will throw an exception.\n     - parameter configuration: The `Realm.Configuration` used when creating the Realm.\n     If empty the configuration is set to the `defaultConfiguration`\n\n     - note: The primary sort descriptor must be responsible for determining the section key.\n     */\n    public init(_ type: ResultType.Type,\n                sectionBlock: @escaping ((ResultType) -> Key),\n                sortDescriptors: [SortDescriptor] = [],\n                filter: NSPredicate? = nil,\n                keyPaths: [String]? = nil,\n                configuration: Realm.Configuration? = nil) where ResultType: Object {\n        self.init(type: type,\n                  sectionBlock: sectionBlock,\n                  sortDescriptors: sortDescriptors,\n                  filter: filter,\n                  keyPaths: keyPaths,\n                  configuration: configuration)\n    }\n\n    /**\n     Initialize a `ObservedSectionedResults` struct for a given `Object` or `EmbeddedObject` type.\n     - parameter type: Observed type\n     - parameter sectionBlock: A callback which returns the section key for each object in the collection.\n     - parameter sortDescriptors: A sequence of `SortDescriptor`s to sort by.\n     - parameter where: Observations will be made only for passing objects.\n     If no type safe query is given - all objects will be observed.\n     - parameter keyPaths: Only properties contained in the key paths array will be observed.\n     If `nil`, notifications will be delivered for any property change on the object.\n     String key paths which do not correspond to a valid a property will throw an exception.\n     - parameter configuration: The `Realm.Configuration` used when creating the Realm.\n     If empty the configuration is set to the `defaultConfiguration`\n\n     - note: The primary sort descriptor must be responsible for determining the section key.\n     */\n    public init(_ type: ResultType.Type,\n                sectionBlock: @escaping ((ResultType) -> Key),\n                sortDescriptors: [SortDescriptor] = [],\n                where: ((Query<ResultType>) -> Query<Bool>)? = nil,\n                keyPaths: [String]? = nil,\n                configuration: Realm.Configuration? = nil) where ResultType: Object {\n        self.init(type: type,\n                  sectionBlock: sectionBlock,\n                  sortDescriptors: sortDescriptors,\n                  where: `where`,\n                  keyPaths: keyPaths,\n                  configuration: configuration)\n    }\n\n    /**\n     Initialize a `ObservedSectionedResults` struct for a given `Object` or `EmbeddedObject` type.\n     - parameter type: Observed type\n     - parameter sectionKeyPath: The keyPath that will produce the key for each section.\n     For every unique value retrieved from the keyPath a section key will be generated.\n     - parameter sortDescriptors: A sequence of `SortDescriptor`s to sort by.\n     - parameter where: Observations will be made only for passing objects.\n     If no type safe query is given - all objects will be observed.\n     - parameter keyPaths: Only properties contained in the key paths array will be observed.\n     If `nil`, notifications will be delivered for any property change on the object.\n     String key paths which do not correspond to a valid a property will throw an exception.\n     - parameter configuration: The `Realm.Configuration` used when creating the Realm.\n     If empty the configuration is set to the `defaultConfiguration`\n\n     - note: The primary sort descriptor must be responsible for determining the section key.\n     */\n    public init(_ type: ResultType.Type,\n                sectionKeyPath: KeyPath<ResultType, Key>,\n                sortDescriptors: [SortDescriptor] = [],\n                where: ((Query<ResultType>) -> Query<Bool>)? = nil,\n                keyPaths: [String]? = nil,\n                configuration: Realm.Configuration? = nil) where ResultType: Object {\n        self.init(type: type,\n                  sectionBlock: { (obj: ResultType) in obj[keyPath: sectionKeyPath] },\n                  sortDescriptors: sortDescriptors,\n                  where: `where`,\n                  keyPaths: keyPaths,\n                  keyPathString: _name(for: sectionKeyPath),\n                  configuration: configuration)\n    }\n\n    /**\n     Initialize a `ObservedSectionedResults` struct for a given `Object` or `EmbeddedObject` type.\n     - parameter type: Observed type\n     - parameter sectionKeyPath: The keyPath that will produce the key for each section.\n     For every unique value retrieved from the keyPath a section key will be generated.\n     - parameter sortDescriptors: A sequence of `SortDescriptor`s to sort by.\n     - parameter keyPaths: Only properties contained in the key paths array will be observed.\n     If `nil`, notifications will be delivered for any property change on the object.\n     String key paths which do not correspond to a valid a property will throw an exception.\n     - parameter configuration: The `Realm.Configuration` used when creating the Realm.\n     If empty the configuration is set to the `defaultConfiguration`\n\n     - note: The primary sort descriptor must be responsible for determining the section key.\n     */\n    public init(_ type: ResultType.Type,\n                sectionKeyPath: KeyPath<ResultType, Key>,\n                sortDescriptors: [SortDescriptor] = [],\n                keyPaths: [String]? = nil,\n                configuration: Realm.Configuration? = nil) where ResultType: Object {\n        self.init(type: type,\n                  sectionBlock: { (obj: ResultType) in obj[keyPath: sectionKeyPath] },\n                  sortDescriptors: sortDescriptors,\n                  keyPaths: keyPaths,\n                  keyPathString: _name(for: sectionKeyPath),\n                  configuration: configuration)\n    }\n\n    /**\n     Initialize a `ObservedSectionedResults` struct for a given `Object` or `EmbeddedObject` type.\n     - parameter type: Observed type\n     - parameter sectionBlock: A callback which returns the section key for each object in the collection.\n     - parameter sortDescriptors: A sequence of `SortDescriptor`s to sort by.\n     - parameter keyPaths: Only properties contained in the key paths array will be observed.\n     If `nil`, notifications will be delivered for any property change on the object.\n     String key paths which do not correspond to a valid a property will throw an exception.\n     - parameter configuration: The `Realm.Configuration` used when creating the Realm.\n     If empty the configuration is set to the `defaultConfiguration`\n\n     - note: The primary sort descriptor must be responsible for determining the section key.\n     */\n    public init(_ type: ResultType.Type,\n                sectionBlock: @escaping ((ResultType) -> Key),\n                sortDescriptors: [SortDescriptor],\n                keyPaths: [String]? = nil,\n                configuration: Realm.Configuration? = nil) where ResultType: Object {\n        self.init(type: type,\n                  sectionBlock: sectionBlock,\n                  sortDescriptors: sortDescriptors,\n                  keyPaths: keyPaths,\n                  configuration: configuration)\n    }\n\n    nonisolated public func update() {\n        MainActor.assumeIsolated {\n            // When the view updates, it will inject the @Environment\n            // into the propertyWrapper\n            if storage.configuration == nil {\n                storage.configuration = configuration\n            }\n        }\n    }\n}\n\n\n// MARK: ObservedRealmObject\n\n/// A property wrapper type that subscribes to an observable Realm `Object` or `List` and\n/// invalidates a view whenever the observable object changes.\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\n@MainActor\n@propertyWrapper public struct ObservedRealmObject<ObjectType>: DynamicProperty\nwhere ObjectType: RealmSubscribable & ThreadConfined & ObservableObject & Equatable {\n    /// A wrapper of the underlying observable object that can create bindings to\n    /// its properties using dynamic member lookup.\n    @MainActor\n    @dynamicMemberLookup @frozen public struct Wrapper {\n        /// :nodoc:\n        public var wrappedValue: ObjectType\n        /// Returns a binding to the resulting value of a given key path.\n        ///\n        /// - Parameter keyPath  : A key path to a specific resulting value.\n        /// - Returns: A new binding.\n        public subscript<Subject>(dynamicMember keyPath: ReferenceWritableKeyPath<ObjectType, Subject>) -> Binding<Subject> {\n            createBinding(wrappedValue, forKeyPath: keyPath)\n        }\n        /// Returns a binding to the resulting equatable value of a given key path.\n        ///\n        /// This binding's set() will only perform a write if the new value is different from the existing value.\n        ///\n        /// - Parameter keyPath  : A key path to a specific resulting value.\n        /// - Returns: A new binding.\n        public subscript<Subject: Equatable>(dynamicMember keyPath: ReferenceWritableKeyPath<ObjectType, Subject>) -> Binding<Subject> {\n            createEquatableBinding(wrappedValue, forKeyPath: keyPath)\n        }\n        /// Returns a binding to the resulting collection value of a given key path.\n        ///\n        /// - Parameter keyPath  : A key path to a specific resulting value.\n        /// - Returns: A new binding.\n        public subscript<Subject: RLMSwiftCollectionBase & ThreadConfined>(dynamicMember keyPath: ReferenceWritableKeyPath<ObjectType, Subject>) -> Binding<Subject> {\n            createCollectionBinding(wrappedValue, forKeyPath: keyPath)\n        }\n    }\n    /// The object to observe.\n    @ObservedObject private var storage: ObservableStorage<ObjectType>\n    /// A default value to avoid invalidated access.\n    private let defaultValue: ObjectType\n\n    /// :nodoc:\n    public var wrappedValue: ObjectType {\n        get {\n            if storage.value.realm == nil {\n                // if unmanaged return the unmanaged value\n                return storage.value\n            } else if storage.value.isInvalidated {\n                // if invalidated, return the default value\n                return defaultValue\n            }\n            // else return the frozen value. the frozen value\n            // will be consumed by SwiftUI, which requires\n            // the ability to cache and diff objects and collections\n            // during some timeframe. The ObjectType is frozen so that\n            // SwiftUI can cache state. other access points will thaw\n            // the ObjectType\n            return storage.value.freeze()\n        }\n        set {\n            storage.value = newValue\n        }\n    }\n    /// :nodoc:\n    public var projectedValue: Wrapper {\n        return Wrapper(wrappedValue: storage.value.isInvalidated ? defaultValue : storage.value)\n    }\n    /**\n     Initialize a RealmState struct for a given thread confined type.\n     - parameter wrappedValue The RealmSubscribable value to wrap and observe.\n     */\n    public init(wrappedValue: ObjectType) where ObjectType: ObjectBase & Identifiable {\n        _storage = ObservedObject(wrappedValue: ObservableStorage(wrappedValue))\n        defaultValue = ObjectType()\n    }\n    /**\n     Initialize a RealmState struct for a given thread confined type.\n     - parameter wrappedValue The RealmSubscribable value to wrap and observe.\n     */\n    public init<V>(wrappedValue: ObjectType) where ObjectType == List<V> {\n        _storage = ObservedObject(wrappedValue: ObservableStorage(wrappedValue))\n        defaultValue = List()\n    }\n    /**\n     Initialize a RealmState struct for a given thread confined type.\n     - parameter wrappedValue The RealmSubscribable value to wrap and observe.\n     */\n    public init(wrappedValue: ObjectType) where ObjectType: ProjectionObservable {\n        _storage = ObservedObject(wrappedValue: ObservableStorage(wrappedValue))\n        defaultValue = ObjectType(projecting: ObjectType.Root())\n    }\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\nextension Binding where Value: ObjectBase & ThreadConfined {\n    /// :nodoc:\n    @MainActor\n    public subscript<V>(dynamicMember member: ReferenceWritableKeyPath<Value, V>) -> Binding<V> where V: _Persistable {\n        createBinding(wrappedValue, forKeyPath: member)\n    }\n    /// :nodoc:\n    @MainActor\n    public subscript<V>(dynamicMember member: ReferenceWritableKeyPath<Value, V>) -> Binding<V> where V: _Persistable & RLMSwiftCollectionBase & ThreadConfined {\n        createCollectionBinding(wrappedValue, forKeyPath: member)\n    }\n    /// :nodoc:\n    @MainActor\n    public subscript<V>(dynamicMember member: ReferenceWritableKeyPath<Value, V>) -> Binding<V> where V: _Persistable & Equatable {\n        createEquatableBinding(wrappedValue, forKeyPath: member)\n    }\n}\n\n// MARK: - BoundCollection\n\n/// :nodoc:\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\n@preconcurrency @MainActor\npublic protocol BoundCollection {\n    /// :nodoc:\n    associatedtype Value\n    /// :nodoc:\n    associatedtype Element: RealmCollectionValue\n\n    /// :nodoc:\n    var wrappedValue: Value { get }\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\nextension BoundCollection {\n    private func write(_ block: (Value) -> Void) where Value: ThreadConfined {\n        RealmSwift.write(wrappedValue, block)\n    }\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\npublic extension BoundCollection where Value: RealmCollection {\n    /// :nodoc:\n    typealias Element = Value.Element\n    /// :nodoc:\n    typealias Index = Value.Index\n    /// :nodoc:\n    typealias Indices = Value.Indices\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\npublic extension BoundCollection where Value == List<Element> {\n    /// :nodoc:\n    func remove(at index: Index) {\n        write { list in\n            list.remove(at: index)\n        }\n    }\n\n    /// :nodoc:\n    func remove(atOffsets offsets: IndexSet) {\n        write { list in\n            list.remove(atOffsets: offsets)\n        }\n    }\n\n    /// :nodoc:\n    func move(fromOffsets offsets: IndexSet, toOffset destination: Int) {\n        write { list in\n            list.move(fromOffsets: offsets, toOffset: destination)\n        }\n    }\n\n    /// :nodoc:\n    func append(_ value: Value.Element) {\n        write { list in\n            list.append(value)\n        }\n    }\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\npublic extension BoundCollection where Value == List<Element>, Element: ObjectBase & ThreadConfined {\n    /// :nodoc:\n    func append(_ value: Value.Element) {\n        write { list in\n            if value.realm == nil && list.realm != nil {\n                SwiftUIKVO.cancel(value)\n            }\n            list.append(thawObjectIfFrozen(value))\n        }\n    }\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\npublic extension BoundCollection where Value == Results<Element>, Element: ObjectBase & ThreadConfined {\n    /// :nodoc:\n    func remove(_ object: Value.Element) {\n        guard let thawed = object.thaw() else { return }\n        write { results in\n            if results.index(of: thawed) != nil {\n                results.realm?.delete(thawed)\n            }\n        }\n    }\n    /// :nodoc:\n    func remove(atOffsets offsets: IndexSet) {\n        write { results in\n            results.realm?.delete(Array(offsets.map { results[$0] }))\n        }\n    }\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\npublic extension BoundCollection where Value == MutableSet<Element> {\n    /// :nodoc:\n    func remove(_ element: Value.Element) {\n        write { mutableSet in\n            mutableSet.remove(element)\n        }\n    }\n    /// :nodoc:\n    func insert(_ value: Value.Element) {\n        write { mutableSet in\n            mutableSet.insert(value)\n        }\n    }\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\npublic extension BoundCollection where Value == MutableSet<Element>, Element: ObjectBase & ThreadConfined {\n    /// :nodoc:\n    func remove(_ object: Value.Element) {\n        write { mutableSet in\n            mutableSet.remove(thawObjectIfFrozen(object))\n        }\n    }\n    /// :nodoc:\n    func insert(_ value: Value.Element) {\n        write { mutableSet in\n            if value.realm == nil && mutableSet.realm != nil {\n                SwiftUIKVO.cancel(value)\n            }\n            mutableSet.insert(thawObjectIfFrozen(value))\n        }\n    }\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\npublic extension BoundCollection where Value == Results<Element>, Element: Object {\n    /// :nodoc:\n    func append(_ value: Value.Element) {\n        write { results in\n            if value.realm == nil && results.realm != nil {\n                SwiftUIKVO.cancel(value)\n            }\n            results.realm?.add(thawObjectIfFrozen(value))\n        }\n    }\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\npublic extension BoundCollection where Value == Results<Element>, Element: ProjectionObservable & ThreadConfined, Element.Root: Object {\n    /// :nodoc:\n    func append(_ value: Value.Element) {\n        write { results in\n            if value.realm == nil && results.realm != nil {\n                SwiftUIKVO.cancel(value.rootObject)\n            }\n            results.realm?.add(thawObjectIfFrozen(value.rootObject))\n        }\n    }\n}\n\n@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)\nextension Binding: BoundCollection where Value: RealmCollection {\n    /// :nodoc:\n    public typealias Element = Value.Element\n    /// :nodoc:\n    public typealias Index = Value.Index\n    /// :nodoc:\n    public typealias Indices = Value.Indices\n}\n\n// MARK: - BoundMap\n\n/// :nodoc:\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\npublic protocol BoundMap {\n    /// :nodoc:\n    associatedtype Value: RealmKeyedCollection\n\n    /// :nodoc:\n    var wrappedValue: Value { get }\n}\n\n/// :nodoc:\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\npublic extension BoundMap {\n    // The compiler will not allow us to assign values by subscript as the binding is a get-only\n    // property. To get around this we need an explicit `set` method.\n    /// :nodoc:\n    subscript( key: Value.Key) -> Value.Value? {\n        self.wrappedValue[key]\n    }\n\n    /// :nodoc:\n    func set(object: Value.Value?, for key: Value.Key) {\n        write(self.wrappedValue) { map in\n            var m = map\n            m[key] = object\n        }\n    }\n}\n\n/// :nodoc:\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\npublic extension BoundMap where Value.Value: ObjectBase & ThreadConfined {\n    /// :nodoc:\n    func set(object: Value.Value?, for key: Value.Key) {\n        // If the value is `nil` remove it from the map.\n        guard let value = object else {\n            write(self.wrappedValue) { map in\n                map.removeObject(for: key)\n            }\n            return\n        }\n        // if the value is unmanaged but the map is managed, we are adding this value to the realm\n        if value.realm == nil && self.wrappedValue.realm != nil {\n            SwiftUIKVO.cancel(value)\n        }\n        write(self.wrappedValue) { map in\n            var m = map\n            m[key] = thawObjectIfFrozen(value)\n        }\n    }\n}\n\n@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)\nextension Binding: BoundMap where Value: RealmKeyedCollection {\n}\n\n@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)\nextension Binding where Value: Object {\n    /// :nodoc:\n    public func delete() {\n        write(wrappedValue) { object in\n            object.realm?.delete(thawObjectIfFrozen(self.wrappedValue))\n        }\n    }\n}\n\n@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)\nextension Binding where Value: ProjectionObservable, Value.Root: ThreadConfined {\n    /// :nodoc:\n    public func delete() {\n        write(wrappedValue.rootObject) { object in\n            object.realm?.delete(thawObjectIfFrozen(object))\n        }\n    }\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\nextension ThreadConfined where Self: ProjectionObservable {\n    /**\n     Create a `Binding` for a given property, allowing for\n     automatically transacted reads and writes behind the scenes.\n\n     This is a convenience method for SwiftUI views (e.g., TextField, DatePicker)\n     that require a `Binding` to be passed in. SwiftUI will automatically read/write\n     from the binding.\n\n     - parameter keyPath The key path to the member property.\n     - returns A `Binding` to the member property.\n     */\n    @MainActor\n    public func bind<V: _Persistable & Equatable>(_ keyPath: ReferenceWritableKeyPath<Self, V>) -> Binding<V> {\n        createEquatableBinding(self, forKeyPath: keyPath)\n    }\n    /// :nodoc:\n    @MainActor\n    public func bind<V: _Persistable & RLMSwiftCollectionBase & ThreadConfined>(_ keyPath: ReferenceWritableKeyPath<Self, V>) -> Binding<V> {\n        createCollectionBinding(self, forKeyPath: keyPath)\n    }\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\nextension ObservedRealmObject.Wrapper where ObjectType: ObjectBase {\n    /// :nodoc:\n    public func delete() {\n        write(wrappedValue) { object in\n            object.realm?.delete(self.wrappedValue)\n        }\n    }\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\nextension ThreadConfined where Self: ObjectBase {\n    /**\n     Create a `Binding` for a given property, allowing for\n     automatically transacted reads and writes behind the scenes.\n\n     This is a convenience method for SwiftUI views (e.g., TextField, DatePicker)\n     that require a `Binding` to be passed in. SwiftUI will automatically read/write\n     from the binding.\n\n     - parameter keyPath The key path to the member property.\n     - returns A `Binding` to the member property.\n     */\n    @MainActor\n    public func bind<V: _Persistable & Equatable>(_ keyPath: ReferenceWritableKeyPath<Self, V>) -> Binding<V> {\n        createEquatableBinding(self, forKeyPath: keyPath)\n    }\n    /// :nodoc:\n    @MainActor\n    public func bind<V: _Persistable & RLMSwiftCollectionBase & ThreadConfined>(_ keyPath: ReferenceWritableKeyPath<Self, V>) -> Binding<V> {\n        createCollectionBinding(self, forKeyPath: keyPath)\n    }\n}\n\nprivate struct RealmEnvironmentKey: EnvironmentKey {\n    static let defaultValue = Realm.Configuration.defaultConfiguration\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\nextension EnvironmentValues {\n    /// The current `Realm.Configuration` that the view should use.\n    public var realmConfiguration: Realm.Configuration {\n        get {\n            return self[RealmEnvironmentKey.self]\n        }\n        set {\n            self[RealmEnvironmentKey.self] = newValue\n        }\n    }\n    /// The current `Realm` that the view should use.\n    public var realm: Realm {\n        get {\n            return try! Realm(configuration: self[RealmEnvironmentKey.self])\n        }\n        set {\n            self[RealmEnvironmentKey.self] = newValue.configuration\n        }\n    }\n}\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\nextension SwiftUIKVO {\n    @objc(removeObserversFromObject:) static func removeObservers(object: NSObject) -> Bool {\n        Self.observedObjects.withLock {\n            if let subscription = $0[object] {\n                subscription.removeObservers()\n                return true\n            }\n            return false\n        }\n    }\n\n    @objc(addObserversToObject:) static func addObservers(object: NSObject) {\n        Self.observedObjects.withLock {\n            $0[object]?.addObservers()\n        }\n    }\n}\n\n@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)\nextension View {\n    /// Marks this view as searchable, which configures the display of a search field.\n    /// You can provide a collection and a key path to be filtered using the search\n    /// field string provided by the searchable component, this will result in the collection\n    /// querying for all items containing the search field string for the given key path.\n    ///\n    ///     @State var searchString: String\n    ///     @ObservedResults(Reminder.self) var reminders\n    ///\n    ///     List {\n    ///         ForEach(reminders) { reminder in\n    ///             ReminderRowView(reminder: reminder)\n    ///         }\n    ///     }\n    ///     .searchable(text: $searchFilter,\n    ///                 collection: $reminders,\n    ///                 keyPath: \\.name) {\n    ///         ForEach(reminders) { remindersFiltered in\n    ///             Text(remindersFiltered.name).searchCompletion(remindersFiltered.name)\n    ///         }\n    ///     }\n    ///\n    /**\n    - Note: See ``SwiftUI/View/searchable(text:placement:prompt)``\n            <https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:)-6royb>\n            for more information on searchable view modifier.\n\n    - parameter text: The text to display and edit in the search field.\n    - parameter collection: The collection to be filtered.\n    - parameter keyPath: The key path to the property which will be used to filter\n                the collection, only key paths with `String` type are allowed.\n    - parameter placement: The preferred placement of the search field within the\n                containing view hierarchy.\n    - parameter prompt: A `Text` representing the prompt of the search field\n                which provides users with guidance on what to search for.\n     */\n    public func searchable<T: ObjectBase>(text: Binding<String>, collection: ObservedResults<T>, keyPath: KeyPath<T, String>,\n                                          placement: SearchFieldPlacement = .automatic, prompt: Text? = nil) -> some View {\n        filterCollection(collection, for: text.wrappedValue, on: keyPath)\n        return searchable(text: text, placement: placement, prompt: prompt)\n    }\n\n    /// Marks this view as searchable, which configures the display of a search field.\n    /// You can provide a collection and a key path to be filtered using the search\n    /// field string provided by the searchable component, this will result in the collection\n    /// querying for all items containing the search field string for the given key path.\n    ///\n    ///     @State var searchString: String\n    ///     @ObservedResults(Reminder.self) var reminders\n    ///\n    ///     List {\n    ///         ForEach(reminders) { reminder in\n    ///             ReminderRowView(reminder: reminder)\n    ///         }\n    ///     }\n    ///     .searchable(text: $searchFilter,\n    ///                 collection: $reminders,\n    ///                 keyPath: \\.name) {\n    ///         ForEach(reminders) { remindersFiltered in\n    ///             Text(remindersFiltered.name).searchCompletion(remindersFiltered.name)\n    ///         }\n    ///     }\n    ///\n    /**\n    - Note: See ``SwiftUI/View/searchable(text:placement:prompt)``\n            <https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:)-2ed8t>\n            for more information on searchable view modifier.\n\n    - parameter text: The text to display and edit in the search field.\n    - parameter collection: The collection to be filtered.\n    - parameter keyPath: The key path to the property which will be used to filter\n                the collection.\n    - parameter placement: The preferred placement of the search field within the\n                containing view hierarchy.\n    - parameter prompt: The key for the localized prompt of the search field\n                which provides users with guidance on what to search for.\n     */\n    public func searchable<T: ObjectBase>(text: Binding<String>, collection: ObservedResults<T>,\n                                          keyPath: KeyPath<T, String>, placement: SearchFieldPlacement = .automatic,\n                                          prompt: LocalizedStringKey) -> some View {\n        filterCollection(collection, for: text.wrappedValue, on: keyPath)\n        return searchable(text: text, placement: placement, prompt: prompt)\n    }\n\n    /// Marks this view as searchable, which configures the display of a search field.\n    /// You can provide a collection and a key path to be filtered using the search\n    /// field string provided by the searchable component, this will result in the collection\n    /// querying for all items containing the search field string for the given key path.\n    ///\n    ///     @State var searchString: String\n    ///     @ObservedResults(Reminder.self) var reminders\n    ///\n    ///     List {\n    ///         ForEach(reminders) { reminder in\n    ///             ReminderRowView(reminder: reminder)\n    ///         }\n    ///     }\n    ///     .searchable(text: $searchFilter,\n    ///                 collection: $reminders,\n    ///                 keyPath: \\.name) {\n    ///         ForEach(reminders) { remindersFiltered in\n    ///             Text(remindersFiltered.name).searchCompletion(remindersFiltered.name)\n    ///         }\n    ///     }\n    ///\n    /**\n    - Note: See ``SwiftUI/View/searchable(text:placement:prompt)``\n            <https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:)-58egp>\n            for more information on searchable view modifier.\n\n    - parameter text: The text to display and edit in the search field.\n    - parameter collection: The collection to be filtered.\n    - parameter keyPath: The key path to the property which will be used to filter\n                the collection.\n    - parameter placement: The preferred placement of the search field within the\n                containing view hierarchy.\n    - parameter prompt: A string representing the prompt of the search field\n                which provides users with guidance on what to search for.\n     */\n    public func searchable<T: ObjectBase, S>(text: Binding<String>, collection: ObservedResults<T>, keyPath: KeyPath<T, String>,\n                                             placement: SearchFieldPlacement = .automatic, prompt: S) -> some View where S: StringProtocol {\n        filterCollection(collection, for: text.wrappedValue, on: keyPath)\n        return searchable(text: text, placement: placement, prompt: prompt)\n    }\n\n    /// Marks this view as searchable, which configures the display of a search field.\n    /// You can provide a collection and a key path to be filtered using the search\n    /// field string provided by the searchable component, this will result in the collection\n    /// querying for all items containing the search field string for the given key path.\n    ///\n    ///     @State var searchString: String\n    ///     @ObservedResults(Reminder.self) var reminders\n    ///\n    ///     List {\n    ///         ForEach(reminders) { reminder in\n    ///             ReminderRowView(reminder: reminder)\n    ///         }\n    ///     }\n    ///     .searchable(text: $searchFilter,\n    ///                 collection: $reminders,\n    ///                 keyPath: \\.name) {\n    ///         ForEach(reminders) { remindersFiltered in\n    ///             Text(remindersFiltered.name).searchCompletion(remindersFiltered.name)\n    ///         }\n    ///     }\n    ///\n    /**\n    - Note: See ``SwiftUI/View/searchable(text:placement:prompt:suggestions)``\n            <https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:suggestions:)-94bdu>\n            for more information on searchable view modifier.\n\n    - parameter text: The text to display and edit in the search field.\n    - parameter collection: The collection to be filtered.\n    - parameter keyPath: The key path to the property which will be used to filter\n                the collection.\n    - parameter placement: The preferred placement of the search field within the\n                containing view hierarchy.\n    - parameter prompt: A `Text` representing the prompt of the search field\n                which provides users with guidance on what to search for.\n    - parameter suggestions: A view builder that produces content that\n                populates a list of suggestions.\n     */\n    public func searchable<T: ObjectBase, S>(text: Binding<String>, collection: ObservedResults<T>, keyPath: KeyPath<T, String>,\n                                             placement: SearchFieldPlacement = .automatic, prompt: Text? = nil, @ViewBuilder suggestions: () -> S)\n            -> some View where S: View {\n        filterCollection(collection, for: text.wrappedValue, on: keyPath)\n        return searchable(text: text,\n                          placement: placement,\n                          prompt: prompt,\n                          suggestions: suggestions)\n    }\n\n    /// Marks this view as searchable, which configures the display of a search field.\n    /// You can provide a collection and a key path to be filtered using the search\n    /// field string provided by the searchable component, this will result in the collection\n    /// querying for all items containing the search field string for the given key path.\n    ///\n    ///     @State var searchString: String\n    ///     @ObservedResults(Reminder.self) var reminders\n    ///\n    ///     List {\n    ///         ForEach(reminders) { reminder in\n    ///             ReminderRowView(reminder: reminder)\n    ///         }\n    ///     }\n    ///     .searchable(text: $searchFilter,\n    ///                 collection: $reminders,\n    ///                 keyPath: \\.name) {\n    ///         ForEach(reminders) { remindersFiltered in\n    ///             Text(remindersFiltered.name).searchCompletion(remindersFiltered.name)\n    ///         }\n    ///     }\n    ///\n    /**\n    - Note: See ``SwiftUI/View/searchable(text:placement:prompt:suggestions)``\n            <https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:suggestions:)-1mw1m>\n            for more information on searchable view modifier.\n\n    - parameter text: The text to display and edit in the search field.\n    - parameter collection: The collection to be filtered.\n    - parameter keyPath: The key path to the property which will be used to filter\n                the collection.\n    - parameter placement: The preferred placement of the search field within the\n                containing view hierarchy.\n    - parameter prompt: The key for the localized prompt of the search field\n                which provides users with guidance on what to search for.\n    - parameter suggestions: A view builder that produces content that\n                populates a list of suggestions.\n     */\n    public func searchable<T: ObjectBase, S>(text: Binding<String>, collection: ObservedResults<T>, keyPath: KeyPath<T, String>,\n                                             placement: SearchFieldPlacement = .automatic, prompt: LocalizedStringKey, @ViewBuilder suggestions: () -> S)\n            -> some View where S: View {\n        filterCollection(collection, for: text.wrappedValue, on: keyPath)\n        return searchable(text: text,\n                          placement: placement,\n                          prompt: prompt,\n                          suggestions: suggestions)\n    }\n\n    /// Marks this view as searchable, which configures the display of a search field.\n    /// You can provide a collection and a key path to be filtered using the search\n    /// field string provided by the searchable component, this will result in the collection\n    /// querying for all items containing the search field string for the given key path.\n    ///\n    ///     @State var searchString: String\n    ///     @ObservedResults(Reminder.self) var reminders\n    ///\n    ///     List {\n    ///         ForEach(reminders) { reminder in\n    ///             ReminderRowView(reminder: reminder)\n    ///         }\n    ///     }\n    ///     .searchable(text: $searchFilter,\n    ///                 collection: $reminders,\n    ///                 keyPath: \\.name) {\n    ///         ForEach(reminders) { remindersFiltered in\n    ///             Text(remindersFiltered.name).searchCompletion(remindersFiltered.name)\n    ///         }\n    ///     }\n    ///\n    /**\n    - Note: See ``SwiftUI/View/searchable(text:placement:prompt:suggestions)``\n            <https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:suggestions:)-6h6qo>\n            for more information on searchable view modifier.\n     \n    - parameter text: The text to display and edit in the search field.\n    - parameter collection: The collection to be filtered.\n    - parameter keyPath: The key path to the property which will be used to filter\n                the collection.\n    - parameter placement: The preferred placement of the search field within the\n                containing view hierarchy.\n    - parameter prompt: A string representing the prompt of the search field\n                which provides users with guidance on what to search for.\n    - parameter suggestions: A view builder that produces content that\n                populates a list of suggestions.\n     */\n    public func searchable<T: ObjectBase, V, S>(text: Binding<String>, collection: ObservedResults<T>, keyPath: KeyPath<T, String>,\n                                                placement: SearchFieldPlacement = .automatic, prompt: S, @ViewBuilder suggestions: () -> V)\n    -> some View where V: View, S: StringProtocol {\n        filterCollection(collection, for: text.wrappedValue, on: keyPath)\n        return searchable(text: text,\n                          placement: placement,\n                          prompt: prompt,\n                          suggestions: suggestions)\n    }\n\n    private func filterCollection<T: ObjectBase>(_ collection: ObservedResults<T>, for text: String, on keyPath: KeyPath<T, String>) {\n        MainActor.assumeIsolated {\n            collection.searchText(text, on: keyPath)\n        }\n    }\n\n    /// Marks this view as searchable, which configures the display of a search field.\n    /// You can provide a collection and a key path to be filtered using the search\n    /// field string provided by the searchable component, this will result in the collection\n    /// querying for all items containing the search field string for the given key path.\n    ///\n    ///     @State var searchString: String\n    ///     @ObservedSectionedResults(Reminder.self) var reminders\n    ///\n    ///     List {\n    ///         ForEach(reminders) { reminderSection in\n    ///             Section(reminderSection.key) {\n    ///                 ForEach(reminderSection) { object in\n    ///                     ReminderRowView(reminder: object)\n    ///                 }\n    ///             }\n    ///         }\n    ///     }\n    ///     .searchable(text: $searchFilter,\n    ///                 collection: $reminders,\n    ///                 keyPath: \\.name) {\n    ///         ForEach(reminders) { remindersFiltered in\n    ///             Text(remindersFiltered.name).searchCompletion(remindersFiltered.name)\n    ///         }\n    ///     }\n    ///\n    /**\n    - Note: See ``SwiftUI/View/searchable(text:placement:prompt)``\n            <https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:)-6royb>\n            for more information on searchable view modifier.\n\n    - parameter text: The text to display and edit in the search field.\n    - parameter collection: The collection to be filtered.\n    - parameter keyPath: The key path to the property which will be used to filter\n                the collection, only key paths with `String` type are allowed.\n    - parameter placement: The preferred placement of the search field within the\n                containing view hierarchy.\n    - parameter prompt: A `Text` representing the prompt of the search field\n                which provides users with guidance on what to search for.\n     */\n    public func searchable<Key, T: ObjectBase>(text: Binding<String>, collection: ObservedSectionedResults<Key, T>, keyPath: KeyPath<T, String>,\n                                               placement: SearchFieldPlacement = .automatic, prompt: Text? = nil) -> some View {\n        filterCollection(collection, for: text.wrappedValue, on: keyPath)\n        return searchable(text: text, placement: placement, prompt: prompt)\n    }\n\n    /// Marks this view as searchable, which configures the display of a search field.\n    /// You can provide a collection and a key path to be filtered using the search\n    /// field string provided by the searchable component, this will result in the collection\n    /// querying for all items containing the search field string for the given key path.\n    ///\n    ///     @State var searchString: String\n    ///     @ObservedResults(Reminder.self) var reminders\n    ///\n    ///     List {\n    ///         ForEach(reminders) { reminderSection in\n    ///             Section(reminderSection.key) {\n    ///                 ForEach(reminderSection) { object in\n    ///                     ReminderRowView(reminder: object)\n    ///                 }\n    ///             }\n    ///         }\n    ///     }\n    ///     .searchable(text: $searchFilter,\n    ///                 collection: $reminders,\n    ///                 keyPath: \\.name) {\n    ///         ForEach(reminders) { remindersFiltered in\n    ///             Text(remindersFiltered.name).searchCompletion(remindersFiltered.name)\n    ///         }\n    ///     }\n    ///\n    /**\n    - Note: See ``SwiftUI/View/searchable(text:placement:prompt)``\n            <https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:)-2ed8t>\n            for more information on searchable view modifier.\n\n    - parameter text: The text to display and edit in the search field.\n    - parameter collection: The collection to be filtered.\n    - parameter keyPath: The key path to the property which will be used to filter\n                the collection.\n    - parameter placement: The preferred placement of the search field within the\n                containing view hierarchy.\n    - parameter prompt: The key for the localized prompt of the search field\n                which provides users with guidance on what to search for.\n     */\n    public func searchable<Key, T: ObjectBase>(text: Binding<String>, collection: ObservedSectionedResults<Key, T>,\n                                               keyPath: KeyPath<T, String>, placement: SearchFieldPlacement = .automatic,\n                                               prompt: LocalizedStringKey) -> some View {\n        filterCollection(collection, for: text.wrappedValue, on: keyPath)\n        return searchable(text: text, placement: placement, prompt: prompt)\n    }\n\n    /// Marks this view as searchable, which configures the display of a search field.\n    /// You can provide a collection and a key path to be filtered using the search\n    /// field string provided by the searchable component, this will result in the collection\n    /// querying for all items containing the search field string for the given key path.\n    ///\n    ///     @State var searchString: String\n    ///     @ObservedResults(Reminder.self) var reminders\n    ///\n    ///     List {\n    ///         ForEach(reminders) { reminderSection in\n    ///             Section(reminderSection.key) {\n    ///                 ForEach(reminderSection) { object in\n    ///                     ReminderRowView(reminder: object)\n    ///                 }\n    ///             }\n    ///         }\n    ///     }\n    ///     .searchable(text: $searchFilter,\n    ///                 collection: $reminders,\n    ///                 keyPath: \\.name) {\n    ///         ForEach(reminders) { remindersFiltered in\n    ///             Text(remindersFiltered.name).searchCompletion(remindersFiltered.name)\n    ///         }\n    ///     }\n    ///\n    /**\n    - Note: See ``SwiftUI/View/searchable(text:placement:prompt)``\n            <https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:)-58egp>\n            for more information on searchable view modifier.\n\n    - parameter text: The text to display and edit in the search field.\n    - parameter collection: The collection to be filtered.\n    - parameter keyPath: The key path to the property which will be used to filter\n                the collection.\n    - parameter placement: The preferred placement of the search field within the\n                containing view hierarchy.\n    - parameter prompt: A string representing the prompt of the search field\n                which provides users with guidance on what to search for.\n     */\n    public func searchable<Key, T: ObjectBase, S>(text: Binding<String>, collection: ObservedSectionedResults<Key, T>, keyPath: KeyPath<T, String>,\n                                                  placement: SearchFieldPlacement = .automatic, prompt: S) -> some View where S: StringProtocol {\n        filterCollection(collection, for: text.wrappedValue, on: keyPath)\n        return searchable(text: text, placement: placement, prompt: prompt)\n    }\n\n    /// Marks this view as searchable, which configures the display of a search field.\n    /// You can provide a collection and a key path to be filtered using the search\n    /// field string provided by the searchable component, this will result in the collection\n    /// querying for all items containing the search field string for the given key path.\n    ///\n    ///     @State var searchString: String\n    ///     @ObservedResults(Reminder.self) var reminders\n    ///\n    ///     List {\n    ///         ForEach(reminders) { reminderSection in\n    ///             Section(reminderSection.key) {\n    ///                 ForEach(reminderSection) { object in\n    ///                     ReminderRowView(reminder: object)\n    ///                 }\n    ///             }\n    ///         }\n    ///     }\n    ///     .searchable(text: $searchFilter,\n    ///                 collection: $reminders,\n    ///                 keyPath: \\.name) {\n    ///         ForEach(reminders) { remindersFiltered in\n    ///             Text(remindersFiltered.name).searchCompletion(remindersFiltered.name)\n    ///         }\n    ///     }\n    ///\n    /**\n    - Note: See ``SwiftUI/View/searchable(text:placement:prompt:suggestions)``\n            <https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:suggestions:)-94bdu>\n            for more information on searchable view modifier.\n\n    - parameter text: The text to display and edit in the search field.\n    - parameter collection: The collection to be filtered.\n    - parameter keyPath: The key path to the property which will be used to filter\n                the collection.\n    - parameter placement: The preferred placement of the search field within the\n                containing view hierarchy.\n    - parameter prompt: A `Text` representing the prompt of the search field\n                which provides users with guidance on what to search for.\n    - parameter suggestions: A view builder that produces content that\n                populates a list of suggestions.\n     */\n    public func searchable<Key, T: ObjectBase, S>(text: Binding<String>, collection: ObservedSectionedResults<Key, T>, keyPath: KeyPath<T, String>,\n                                                  placement: SearchFieldPlacement = .automatic, prompt: Text? = nil, @ViewBuilder suggestions: () -> S)\n    -> some View where S: View {\n        filterCollection(collection, for: text.wrappedValue, on: keyPath)\n        return searchable(text: text,\n                          placement: placement,\n                          prompt: prompt,\n                          suggestions: suggestions)\n    }\n\n    /// Marks this view as searchable, which configures the display of a search field.\n    /// You can provide a collection and a key path to be filtered using the search\n    /// field string provided by the searchable component, this will result in the collection\n    /// querying for all items containing the search field string for the given key path.\n    ///\n    ///     @State var searchString: String\n    ///     @ObservedResults(Reminder.self) var reminders\n    ///\n    ///     List {\n    ///         ForEach(reminders) { reminderSection in\n    ///             Section(reminderSection.key) {\n    ///                 ForEach(reminderSection) { object in\n    ///                     ReminderRowView(reminder: object)\n    ///                 }\n    ///             }\n    ///         }\n    ///     }\n    ///     .searchable(text: $searchFilter,\n    ///                 collection: $reminders,\n    ///                 keyPath: \\.name) {\n    ///         ForEach(reminders) { remindersFiltered in\n    ///             Text(remindersFiltered.name).searchCompletion(remindersFiltered.name)\n    ///         }\n    ///     }\n    ///\n    /**\n    - Note: See ``SwiftUI/View/searchable(text:placement:prompt:suggestions)``\n            <https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:suggestions:)-1mw1m>\n            for more information on searchable view modifier.\n\n    - parameter text: The text to display and edit in the search field.\n    - parameter collection: The collection to be filtered.\n    - parameter keyPath: The key path to the property which will be used to filter\n                the collection.\n    - parameter placement: The preferred placement of the search field within the\n                containing view hierarchy.\n    - parameter prompt: The key for the localized prompt of the search field\n                which provides users with guidance on what to search for.\n    - parameter suggestions: A view builder that produces content that\n                populates a list of suggestions.\n     */\n    public func searchable<Key, T: ObjectBase, S>(text: Binding<String>, collection: ObservedSectionedResults<Key, T>, keyPath: KeyPath<T, String>,\n                                                  placement: SearchFieldPlacement = .automatic, prompt: LocalizedStringKey, @ViewBuilder suggestions: () -> S)\n    -> some View where S: View {\n        filterCollection(collection, for: text.wrappedValue, on: keyPath)\n        return searchable(text: text,\n                          placement: placement,\n                          prompt: prompt,\n                          suggestions: suggestions)\n    }\n\n    /// Marks this view as searchable, which configures the display of a search field.\n    /// You can provide a collection and a key path to be filtered using the search\n    /// field string provided by the searchable component, this will result in the collection\n    /// querying for all items containing the search field string for the given key path.\n    ///\n    ///     @State var searchString: String\n    ///     @ObservedResults(Reminder.self) var reminders\n    ///\n    ///     List {\n    ///         ForEach(reminders) { reminderSection in\n    ///             Section(reminderSection.key) {\n    ///                 ForEach(reminderSection) { object in\n    ///                     ReminderRowView(reminder: object)\n    ///                 }\n    ///             }\n    ///         }\n    ///     }\n    ///     .searchable(text: $searchFilter,\n    ///                 collection: $reminders,\n    ///                 keyPath: \\.name) {\n    ///         ForEach(reminders) { remindersFiltered in\n    ///             Text(remindersFiltered.name).searchCompletion(remindersFiltered.name)\n    ///         }\n    ///     }\n    ///\n    /**\n    - Note: See ``SwiftUI/View/searchable(text:placement:prompt:suggestions)``\n            <https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:suggestions:)-6h6qo>\n            for more information on searchable view modifier.\n\n    - parameter text: The text to display and edit in the search field.\n    - parameter collection: The collection to be filtered.\n    - parameter keyPath: The key path to the property which will be used to filter\n                the collection.\n    - parameter placement: The preferred placement of the search field within the\n                containing view hierarchy.\n    - parameter prompt: A string representing the prompt of the search field\n                which provides users with guidance on what to search for.\n    - parameter suggestions: A view builder that produces content that\n                populates a list of suggestions.\n     */\n    public func searchable<Key, T: ObjectBase, V, S>(text: Binding<String>, collection: ObservedSectionedResults<Key, T>, keyPath: KeyPath<T, String>,\n                                                     placement: SearchFieldPlacement = .automatic, prompt: S, @ViewBuilder suggestions: () -> V)\n    -> some View where V: View, S: StringProtocol {\n        filterCollection(collection, for: text.wrappedValue, on: keyPath)\n        return searchable(text: text,\n                          placement: placement,\n                          prompt: prompt,\n                          suggestions: suggestions)\n    }\n\n    private func filterCollection<Key, T: ObjectBase>(_ collection: ObservedSectionedResults<Key, T>, for text: String, on keyPath: KeyPath<T, String>) {\n        MainActor.assumeIsolated {\n            collection.searchText(text, on: keyPath)\n        }\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/AnyRealmValueTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport Realm\nimport RealmSwift\n\n#if canImport(RealmSwiftTestSupport)\nimport RealmSwiftTestSupport\n#endif\n\nclass AnyRealmTypeObject: Object {\n    let anyValue = RealmProperty<AnyRealmValue>()\n}\n\nprotocol AnyValueFactory: ValueFactory {\n    static var anyInitializer: (Self) -> AnyRealmValue { get }\n    static func anyValues() -> [AnyRealmValue]\n}\nextension AnyValueFactory {\n    static func anyValues() -> [AnyRealmValue] {\n        return values().map(anyInitializer)\n    }\n}\n\nextension Int: AnyValueFactory {\n    static var anyInitializer: (Self) -> AnyRealmValue { AnyRealmValue.int }\n}\nextension Bool: AnyValueFactory {\n    static var anyInitializer: (Self) -> AnyRealmValue { AnyRealmValue.bool }\n    static func anyValues() -> [AnyRealmValue] {\n        return [.bool(false), .bool(true), .none]\n    }\n}\nextension Float: AnyValueFactory {\n    static var anyInitializer: (Self) -> AnyRealmValue { AnyRealmValue.float }\n}\nextension Double: AnyValueFactory {\n    static var anyInitializer: (Self) -> AnyRealmValue { AnyRealmValue.double }\n}\nextension String: AnyValueFactory {\n    static var anyInitializer: (Self) -> AnyRealmValue { AnyRealmValue.string }\n}\nextension Data: AnyValueFactory {\n    static var anyInitializer: (Self) -> AnyRealmValue { AnyRealmValue.data }\n}\nextension Date: AnyValueFactory {\n    static var anyInitializer: (Self) -> AnyRealmValue { AnyRealmValue.date }\n}\nextension ObjectId: AnyValueFactory {\n    static var anyInitializer: (ObjectId) -> AnyRealmValue { AnyRealmValue.objectId }\n}\nextension Decimal128: AnyValueFactory {\n    static var anyInitializer: (Decimal128) -> AnyRealmValue { AnyRealmValue.decimal128 }\n}\nextension UUID: AnyValueFactory {\n    static var anyInitializer: (Self) -> AnyRealmValue { AnyRealmValue.uuid }\n}\n\nextension SwiftStringObject: AnyValueFactory {\n    static func values() -> [SwiftStringObject] {\n        return [SwiftStringObject(value: [\"a\"]), SwiftStringObject(value: [\"b\"]), SwiftStringObject(value: [\"c\"])]\n    }\n    static func doubleValue(_ value: SwiftStringObject) -> Double { fatalError() }\n\n    static var anyInitializer: (SwiftStringObject) -> AnyRealmValue { AnyRealmValue.object }\n}\n\nfunc doubleValue(_ value: AnyRealmValue) -> Double {\n    if case let .double(d) = value {\n        return d\n    } else if case let .decimal128(d) = value {\n        return d.doubleValue\n    } else {\n        fatalError(\"Unexpected mixed value: \\(value)\")\n    }\n}\n\nclass AnyRealmValueTests<T: AnyValueFactory>: TestCase {\n    func testAnyRealmValue() {\n        let values = T.anyValues()\n        let o = AnyRealmTypeObject()\n        o.anyValue.value = values[0]\n        XCTAssertEqual(o.anyValue.value, values[0])\n        o.anyValue.value = values[1]\n        XCTAssertEqual(o.anyValue.value, values[1])\n        let realm = realmWithTestPath()\n        try! realm.write {\n            realm.add(o)\n        }\n        XCTAssertEqual(o.anyValue.value, values[1])\n        try! realm.write {\n            o.anyValue.value = values[2]\n        }\n        XCTAssertEqual(o.anyValue.value, values[2])\n    }\n}\nclass AnyRealmValuePrimitiveTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        let suite = XCTestSuite(name: \"Any Realm Value Tests\")\n        AnyRealmValueTests<Int>.defaultTestSuite.tests.forEach(suite.addTest)\n        AnyRealmValueTests<Bool>.defaultTestSuite.tests.forEach(suite.addTest)\n        AnyRealmValueTests<Float>.defaultTestSuite.tests.forEach(suite.addTest)\n        AnyRealmValueTests<String>.defaultTestSuite.tests.forEach(suite.addTest)\n        AnyRealmValueTests<Data>.defaultTestSuite.tests.forEach(suite.addTest)\n        AnyRealmValueTests<Date>.defaultTestSuite.tests.forEach(suite.addTest)\n        AnyRealmValueTests<ObjectId>.defaultTestSuite.tests.forEach(suite.addTest)\n        AnyRealmValueTests<Decimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n        AnyRealmValueTests<UUID>.defaultTestSuite.tests.forEach(suite.addTest)\n        return suite\n    }\n}\n\nclass AnyRealmValueObjectTests: TestCase {\n    func testObject() {\n        let o = AnyRealmTypeObject()\n        let so = SwiftStringObject()\n        so.stringCol = \"hello\"\n        o.anyValue.value = .object(so)\n        XCTAssertEqual(o.anyValue.value.object(SwiftStringObject.self)!.stringCol, \"hello\")\n        o.anyValue.value.object(SwiftStringObject.self)!.stringCol = \"there\"\n        XCTAssertEqual(o.anyValue.value.object(SwiftStringObject.self)!.stringCol, \"there\")\n        let realm = realmWithTestPath()\n        try! realm.write {\n            realm.add(o)\n        }\n        XCTAssertEqual(o.anyValue.value.object(SwiftStringObject.self)!.stringCol, \"there\")\n        try! realm.write {\n            o.anyValue.value.object(SwiftStringObject.self)!.stringCol = \"bye!\"\n        }\n        XCTAssertEqual(o.anyValue.value.object(SwiftStringObject.self)!.stringCol, \"bye!\")\n    }\n\n    func testAssortment() {\n        // The purpose of this test is to reuse a mixed container\n        // and ensure no issues exist in doing that.\n        let o = AnyRealmTypeObject()\n        let so = SwiftStringObject()\n        so.stringCol = \"hello\"\n        let data = Data(repeating: 1, count: 64)\n        let date = Date()\n        let objectId = ObjectId.generate()\n        let decimal = Decimal128(floatLiteral: 12345.6789)\n\n        let tests: ((Realm?) -> Void) = { (realm: Realm?) in\n            self.testVariation(object: o, value: .int(123), keyPath: \\.intValue, expected: 123, realm: realm)\n            self.testVariation(object: o, value: .float(123.456), keyPath: \\.floatValue, expected: 123.456, realm: realm)\n            self.testVariation(object: o, value: .string(\"hello there\"), keyPath: \\.stringValue, expected: \"hello there\", realm: realm)\n            self.testVariation(object: o, value: .data(data), keyPath: \\.dataValue, expected: data, realm: realm)\n            self.testVariation(object: o, value: .date(date), keyPath: \\.dateValue, expected: date, realm: realm)\n            self.testVariation(object: o, value: .objectId(objectId), keyPath: \\.objectIdValue, expected: objectId, realm: realm)\n            self.testVariation(object: o, value: .decimal128(decimal), keyPath: \\.decimal128Value, expected: decimal, realm: realm)\n        }\n\n        // unmanaged\n        tests(nil)\n        o.anyValue.value = .none\n        let realm = realmWithTestPath()\n        try! realm.write {\n            realm.add(o)\n        }\n        // managed\n        tests(realm)\n\n        try! realm.write {\n            o.anyValue.value = .object(so)\n        }\n        XCTAssertEqual(o.anyValue.value.object(SwiftStringObject.self)!.stringCol, \"hello\")\n    }\n\n    func testDynamicObjectAccessor() {\n        // The first block knows about SwiftStringObject and will add it as a value to\n        // SwiftObject.anyCol\n        autoreleasepool {\n            let realm = realmWithTestPath(configuration: .init(objectTypes: [SwiftObject.self,\n                                                                             SwiftOwnerObject.self,\n                                                                             SwiftBoolObject.self,\n                                                                             SwiftDogObject.self,\n                                                                             SwiftStringObject.self]))\n            try! realm.write {\n                let dog = SwiftStringObject(value: [\"stringCol\": \"some string...\"])\n                let parent = SwiftObject(value: [\"anyCol\": dog])\n                realm.add(parent)\n            }\n            XCTAssertEqual(realm.objects(SwiftStringObject.self).count, 1)\n        }\n\n        // The second block omits SwiftStringObject from objectTypes so test that the\n        // object can be retrieved dynamically.\n        let realm = realmWithTestPath(configuration: .init(objectTypes: [SwiftObject.self,\n                                                                         SwiftOwnerObject.self,\n                                                                         SwiftBoolObject.self,\n                                                                         SwiftDogObject.self]))\n        // Ensure that SwiftStringObject does not exist in the schema\n        XCTAssertFalse(realm.schema.objectSchema.map { $0.className }.contains(\"SwiftStringObject\"))\n        guard let object = realm.objects(SwiftObject.self).first else {\n            return XCTFail(\"SwiftObject does not exist\")\n        }\n        guard let dynamicObject = object.anyCol.value.dynamicObject else {\n            return XCTFail(\"dynamicObject does not exist\")\n        }\n        XCTAssertEqual(dynamicObject.stringCol as! String, \"some string...\")\n    }\n\n    private func testVariation<T: Equatable>(object: AnyRealmTypeObject,\n                                             value: AnyRealmValue,\n                                             keyPath: KeyPath<AnyRealmValue, T?>,\n                                             expected: T,\n                                             realm: Realm?) {\n        realm?.beginWrite()\n        object.anyValue.value = value\n        try! realm?.commitWrite()\n        if let date = expected as? Date {\n            XCTAssertEqual(object.anyValue.value.dateValue!.timeIntervalSince1970,\n                           date.timeIntervalSince1970,\n                           accuracy: 1.0)\n        } else {\n            XCTAssertEqual(object.anyValue.value[keyPath: keyPath], expected)\n        }\n    }\n}\n\n// MARK: - List tests\n\nclass AnyRealmValueListTestsBase<O: ObjectFactory, V: AnyValueFactory>: TestCase {\n    var realm: Realm?\n    var obj: ModernAllTypesObject!\n    var array: List<AnyRealmValue>!\n    var values: [AnyRealmValue]!\n\n    override func setUp() {\n        obj = O.get()\n        realm = obj.realm\n        array = obj.arrayAny\n        values = V.anyValues()\n    }\n\n    override func tearDown() {\n        realm?.cancelWrite()\n        array = nil\n        obj = nil\n    }\n}\n\nclass AnyRealmValueListTests<O: ObjectFactory, V: AnyValueFactory>: AnyRealmValueListTestsBase<O, V> {\n    private func assertEqual(_ obj: AnyRealmValue, _ anotherObj: AnyRealmValue) {\n        if case let .object(a) = obj, case let .object(b) = anotherObj {\n            XCTAssertEqual((a as! SwiftStringObject).stringCol, (b as! SwiftStringObject).stringCol)\n        } else {\n            XCTAssertEqual(obj, anotherObj)\n        }\n    }\n\n    func testInvalidated() {\n        XCTAssertFalse(array.isInvalidated)\n        if let realm = obj.realm {\n            realm.delete(obj)\n            XCTAssertTrue(array.isInvalidated)\n        }\n    }\n\n    func testIndexOf() {\n        XCTAssertNil(array.index(of: values[0]))\n\n        array.append(values[0])\n        XCTAssertEqual(0, array.index(of: values[0]))\n\n        array.append(values[1])\n        XCTAssertEqual(0, array.index(of: values[0]))\n        XCTAssertEqual(1, array.index(of: values[1]))\n    }\n\n    func disabled_testIndexMatching() {\n        XCTAssertNil(array.index(matching: \"self = %@\", values[0]))\n\n        array.append(values[0])\n        XCTAssertEqual(0, array.index(matching: \"self = %@\", values[0]))\n\n        array.append(values[1])\n        XCTAssertEqual(0, array.index(matching: \"self = %@\", values[0]))\n        XCTAssertEqual(1, array.index(matching: \"self = %@\", values[1]))\n    }\n\n    func testSubscript() {\n        array.append(objectsIn: values)\n        for i in 0..<values.count {\n            assertEqual(array[i], values[i])\n        }\n        assertThrows(array[values.count], reason: \"Index 3 is out of bounds\")\n        assertThrows(array[-1], reason: \"negative value\")\n    }\n\n    func testFirst() {\n        array.append(objectsIn: values)\n        assertEqual(array.first!, values.first!)\n        array.removeAll()\n        XCTAssertNil(array.first)\n    }\n\n    func testLast() {\n        array.append(objectsIn: values)\n        assertEqual(array.last!, values.last!)\n        array.removeAll()\n        XCTAssertNil(array.last)\n\n    }\n\n    func testValueForKey() {\n        array.append(objectsIn: values)\n\n        let actual: [AnyRealmValue]  = array.value(forKey: \"self\").map {\n            if $0 is NSNull {\n                return .none\n            }\n            return V.anyInitializer(dynamicBridgeCast(fromObjectiveC: $0) as V)\n        }\n\n        for (expected, actual) in zip(values!, actual) {\n            assertEqual(expected, actual)\n        }\n\n        assertThrows(array.value(forKey: \"not self\"), named: \"NSUnknownKeyException\")\n    }\n\n    func testSetValueForKey() {\n        // does this even make any sense?\n\n    }\n\n    func testFilter() {\n        // not implemented\n    }\n\n    func testInsert() {\n        XCTAssertEqual(Int(0), array.count)\n\n        array.insert(values[0], at: 0)\n        XCTAssertEqual(Int(1), array.count)\n        assertEqual(values[0], array[0])\n\n        array.insert(values[1], at: 0)\n        XCTAssertEqual(Int(2), array.count)\n        assertEqual(values[1], array[0])\n        assertEqual(values[0], array[1])\n\n        array.insert(values[2], at: 2)\n        XCTAssertEqual(Int(3), array.count)\n        assertEqual(values[1], array[0])\n        assertEqual(values[0], array[1])\n        assertEqual(values[2], array[2])\n\n        assertThrows(array.insert(values[0], at: 4))\n        assertThrows(array.insert(values[0], at: -1))\n    }\n\n    func testRemove() {\n        assertThrows(array.remove(at: 0))\n        assertThrows(array.remove(at: -1))\n\n        array.append(objectsIn: values)\n\n        assertThrows(array.remove(at: -1))\n        assertEqual(values[0], array[0])\n        assertEqual(values[1], array[1])\n        assertEqual(values[2], array[2])\n        assertThrows(array[3])\n\n        array.remove(at: 0)\n        assertEqual(values[1], array[0])\n        assertEqual(values[2], array[1])\n        assertThrows(array[2])\n        assertThrows(array.remove(at: 2))\n\n        array.remove(at: 1)\n        assertEqual(values[1], array[0])\n        assertThrows(array[1])\n    }\n\n    func testRemoveLast() {\n        assertThrows(array.removeLast())\n\n        array.append(objectsIn: values)\n        array.removeLast()\n\n        XCTAssertEqual(array.count, 2)\n        assertEqual(values[0], array[0])\n        assertEqual(values[1], array[1])\n\n        array.removeLast(2)\n        XCTAssertEqual(array.count, 0)\n    }\n\n    func testRemoveAll() {\n        array.removeAll()\n        array.append(objectsIn: values)\n        array.removeAll()\n        XCTAssertEqual(array.count, 0)\n    }\n\n    func testReplace() {\n        assertThrows(array.replace(index: 0, object: values[0]),\n                     reason: \"Index 0 is out of bounds\")\n\n        array.append(objectsIn: values)\n        array.replace(index: 1, object: values[0])\n        assertEqual(array[0], values[0])\n        assertEqual(array[1], values[0])\n        assertEqual(array[2], values[2])\n\n        assertThrows(array.replace(index: 3, object: values[0]),\n                     reason: \"Index 3 is out of bounds\")\n        assertThrows(array.replace(index: -1, object: values[0]),\n                     reason: \"Cannot pass a negative value\")\n    }\n\n    func testReplaceRange() {\n        assertSucceeds { array.replaceSubrange(0..<0, with: []) }\n\n        array.replaceSubrange(0..<0, with: [values[0]])\n        XCTAssertEqual(array.count, 1)\n        assertEqual(array[0], values[0])\n\n        array.replaceSubrange(0..<1, with: values)\n        XCTAssertEqual(array.count, 3)\n\n        array.replaceSubrange(1..<2, with: [])\n        XCTAssertEqual(array.count, 2)\n        assertEqual(array[0], values[0])\n        assertEqual(array[1], values[2])\n    }\n\n    func testMove() {\n        assertThrows(array.move(from: 1, to: 0), reason: \"out of bounds\")\n\n        array.append(objectsIn: values)\n        array.move(from: 2, to: 0)\n        assertEqual(array[0], values[2])\n        assertEqual(array[1], values[0])\n        assertEqual(array[2], values[1])\n\n        assertThrows(array.move(from: 3, to: 0), reason: \"Index 3 is out of bounds\")\n        assertThrows(array.move(from: 0, to: 3), reason: \"Index 3 is out of bounds\")\n        assertThrows(array.move(from: -1, to: 0), reason: \"negative value\")\n        assertThrows(array.move(from: 0, to: -1), reason: \"negative value\")\n    }\n\n    func testSwap() {\n        assertThrows(array.swapAt(0, 1), reason: \"out of bounds\")\n\n        array.append(objectsIn: values)\n        array.swapAt(0, 2)\n        assertEqual(array[0], values[2])\n        assertEqual(array[1], values[1])\n        assertEqual(array[2], values[0])\n\n        assertThrows(array.swapAt(3, 0), reason: \"Index 3 is out of bounds\")\n        assertThrows(array.swapAt(0, 3), reason: \"Index 3 is out of bounds\")\n        assertThrows(array.swapAt(-1, 0), reason: \"negative value\")\n        assertThrows(array.swapAt(0, -1), reason: \"negative value\")\n    }\n\n    func testAssign() {\n        XCTAssertEqual(Int(0), array.count)\n\n        array.insert(values[0], at: 0)\n        XCTAssertEqual(Int(1), array.count)\n        assertEqual(values[0], array[0])\n\n        array[0] = values[1]\n        XCTAssertEqual(Int(1), array.count)\n        assertEqual(values[1], array[0])\n    }\n}\n\nclass MinMaxAnyRealmValueListTests<O: ObjectFactory, V: AnyValueFactory>: AnyRealmValueListTestsBase<O, V> {\n    func testMin() {\n        XCTAssertNil(array.min())\n        array.append(objectsIn: values.reversed())\n        XCTAssertEqual(array.min(), values.first)\n    }\n\n    func testMax() {\n        XCTAssertNil(array.max())\n        array.append(objectsIn: values.reversed())\n        XCTAssertEqual(array.max(), values.last)\n    }\n}\n\nclass AddableAnyRealmValueListTests<O: ObjectFactory, V: AnyValueFactory>: AnyRealmValueListTestsBase<O, V> where V: NumericValueFactory {\n    func testSum() {\n        if array.realm != nil {\n            XCTAssertEqual(array.sum().intValue, nil)\n        } else {\n            XCTAssertEqual(array.sum().intValue, 0)\n        }\n        array.append(objectsIn: values)\n\n        XCTAssertEqual(doubleValue(array.sum()), V.sum(), accuracy: 0.1)\n    }\n\n    func testAverage() {\n        XCTAssertNil(array.average() as V.AverageType?)\n        array.append(objectsIn: values)\n\n        let v: AnyRealmValue = array.average()!\n        XCTAssertEqual(doubleValue(v), V.average(), accuracy: 0.1)\n    }\n}\n\nfunc addAnyRealmValueTests<OF: ObjectFactory>(_ suite: XCTestSuite, _ type: OF.Type) {\n    AnyRealmValueListTests<OF, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueListTests<OF, Bool>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueListTests<OF, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueListTests<OF, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueListTests<OF, String>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueListTests<OF, Data>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueListTests<OF, Date>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueListTests<OF, SwiftStringObject>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueListTests<OF, ObjectId>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueListTests<OF, Decimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueListTests<OF, UUID>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    MinMaxAnyRealmValueListTests<OF, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxAnyRealmValueListTests<OF, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxAnyRealmValueListTests<OF, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxAnyRealmValueListTests<OF, Date>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxAnyRealmValueListTests<OF, Decimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    AddableAnyRealmValueListTests<OF, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddableAnyRealmValueListTests<OF, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddableAnyRealmValueListTests<OF, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddableAnyRealmValueListTests<OF, Decimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n}\n\nclass UnmanagedAnyRealmValueListTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        let suite = XCTestSuite(name: \"Unmanaged AnyRealmValue Lists\")\n        addAnyRealmValueTests(suite, UnmanagedObjectFactory.self)\n        return suite\n    }\n}\n\nclass ManagedAnyRealmValueListTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        let suite = XCTestSuite(name: \"Managed AnyRealmValue Lists\")\n        addAnyRealmValueTests(suite, ManagedObjectFactory.self)\n        return suite\n    }\n}\n\n// MARK: - Set tests\n\nclass AnyRealmValueSetTestsBase<O: ObjectFactory, V: AnyValueFactory>: TestCase {\n    var realm: Realm?\n    var obj: ModernAllTypesObject!\n    var obj2: ModernAllTypesObject!\n    var mutableSet: MutableSet<AnyRealmValue>!\n    var otherMutableSet: MutableSet<AnyRealmValue>!\n    var values: [AnyRealmValue]!\n\n    override func setUp() {\n        obj = O.get()\n        obj2 = O.get()\n        realm = obj.realm\n        mutableSet = obj.setAny\n        otherMutableSet = obj2.setAny\n        values = V.anyValues()\n    }\n\n    override func tearDown() {\n        realm?.cancelWrite()\n        mutableSet = nil\n        obj = nil\n        realm = nil\n    }\n}\n\nclass AnyRealmValueMutableSetTests<O: ObjectFactory, V: AnyValueFactory>: AnyRealmValueSetTestsBase<O, V> {\n    private func assertEqual(_ obj: AnyRealmValue, _ anotherObj: AnyRealmValue) {\n        if case let .object(a) = obj,\n           case let .object(b) = anotherObj {\n            XCTAssertEqual((a as! SwiftStringObject).stringCol, (b as! SwiftStringObject).stringCol)\n        } else {\n            XCTAssertEqual(obj, anotherObj)\n        }\n    }\n\n    func testInvalidated() {\n        XCTAssertFalse(mutableSet.isInvalidated)\n        if let realm = obj.realm {\n            realm.delete(obj)\n            XCTAssertTrue(mutableSet.isInvalidated)\n        }\n    }\n\n    func testValueForKey() {\n        XCTAssertEqual(mutableSet.value(forKey: \"self\").count, 0)\n        mutableSet.insert(values[0])\n        let kvc = (mutableSet.value(forKey: \"self\") as [AnyObject]).first!\n        switch values[0] {\n        case let .object(o):\n            if let obj = kvc as? SwiftStringObject {\n                XCTAssertEqual(obj.stringCol, (o as! SwiftStringObject).stringCol)\n            } else {\n                XCTFail(\"not an object\")\n            }\n        case let .bool(b):\n            XCTAssertEqual(kvc as! Bool, b)\n        case let .data(d):\n            XCTAssertEqual(kvc as! Data, d)\n        case let .date(d):\n            XCTAssertEqual(kvc as! Date, d)\n        case let .decimal128(d):\n            XCTAssertEqual(kvc as! Decimal128, d)\n        case let .double(d):\n            XCTAssertEqual(kvc as! Double, d)\n        case let .float(f):\n            XCTAssertEqual(kvc as! Float, f)\n        case let .int(i):\n            XCTAssertEqual(kvc as! Int, i)\n        case .none:\n            XCTAssertNil(kvc)\n        case let .objectId(o):\n            XCTAssertEqual(kvc as! ObjectId, o)\n        case let .string(s):\n            XCTAssertEqual(kvc as! String, s)\n        case let .uuid(u):\n            XCTAssertEqual(kvc as! UUID, u)\n        case let .dictionary(d):\n            XCTAssertEqual(kvc as! Map<String, AnyRealmValue>, d)\n        case let .list(l):\n            XCTAssertEqual(kvc as! List<AnyRealmValue>, l)\n        }\n\n        assertThrows(mutableSet.value(forKey: \"not self\"), named: \"NSUnknownKeyException\")\n    }\n\n    func testInsert() {\n        XCTAssertEqual(Int(0), mutableSet.count)\n\n        mutableSet.insert(values[0])\n        XCTAssertEqual(Int(1), mutableSet.count)\n        XCTAssertTrue(mutableSet.contains(values[0]))\n\n        mutableSet.insert(values[1])\n        XCTAssertEqual(Int(2), mutableSet.count)\n        XCTAssertTrue(mutableSet.contains(values[0]))\n        XCTAssertTrue(mutableSet.contains(values[1]))\n\n        mutableSet.insert(values[2])\n        XCTAssertEqual(Int(3), mutableSet.count)\n        XCTAssertTrue(mutableSet.contains(values[0]))\n        XCTAssertTrue(mutableSet.contains(values[1]))\n\n        mutableSet.insert(values[2])\n        XCTAssertEqual(Int(3), mutableSet.count)\n        XCTAssertTrue(mutableSet.contains(values[0]))\n        XCTAssertTrue(mutableSet.contains(values[1]))\n        XCTAssertTrue(mutableSet.contains(values[2]))\n        // Insert duplicate\n        mutableSet.insert(values[2])\n        XCTAssertEqual(Int(3), mutableSet.count)\n        XCTAssertTrue(mutableSet.contains(values[0]))\n        XCTAssertTrue(mutableSet.contains(values[1]))\n        XCTAssertTrue(mutableSet.contains(values[2]))\n    }\n\n    func testRemove() {\n        mutableSet.removeAll()\n        XCTAssertEqual(mutableSet.count, 0)\n        mutableSet.insert(objectsIn: values)\n        mutableSet.remove(values[0])\n        XCTAssertFalse(mutableSet.contains(values[0]))\n        XCTAssertTrue(mutableSet.contains(values[1]))\n        XCTAssertTrue(mutableSet.contains(values[2]))\n    }\n\n    func testRemoveAll() {\n        mutableSet.removeAll()\n        mutableSet.insert(objectsIn: values)\n        mutableSet.removeAll()\n        XCTAssertEqual(mutableSet.count, 0)\n    }\n\n    func testIsSubset() {\n        XCTAssertEqual(Int(0), mutableSet.count)\n        XCTAssertEqual(Int(0), otherMutableSet.count)\n        mutableSet.insert(objectsIn: values)\n        otherMutableSet.insert(values[0])\n        // Both sets contain values[0]\n        XCTAssertTrue(otherMutableSet.isSubset(of: mutableSet))\n        otherMutableSet.remove(values[0])\n        XCTAssertFalse(mutableSet.isSubset(of: otherMutableSet))\n    }\n\n    func testContains() {\n        XCTAssertEqual(Int(0), mutableSet.count)\n        XCTAssertEqual(Int(0), otherMutableSet.count)\n        mutableSet.insert(objectsIn: values)\n        XCTAssertEqual(values.count, mutableSet.count)\n        values.forEach {\n            XCTAssertTrue(mutableSet.contains($0))\n        }\n    }\n\n    func testIntersects() {\n        XCTAssertEqual(Int(0), mutableSet.count)\n        XCTAssertEqual(Int(0), otherMutableSet.count)\n        mutableSet.insert(objectsIn: values)\n        otherMutableSet.insert(values[0])\n        // Both sets contain values[0]\n        XCTAssertTrue(otherMutableSet.intersects(mutableSet))\n        otherMutableSet.remove(values[0])\n        XCTAssertFalse(mutableSet.intersects(otherMutableSet))\n    }\n\n    func testFormIntersection() {\n        XCTAssertEqual(Int(0), mutableSet.count)\n        XCTAssertEqual(Int(0), otherMutableSet.count)\n        mutableSet.insert(objectsIn: values)\n        otherMutableSet.insert(values[0])\n        // Both sets contain values[0]\n        mutableSet.formIntersection(otherMutableSet)\n        XCTAssertEqual(Int(1), mutableSet.count)\n        assertEqual(mutableSet[0], values[0])\n    }\n\n    func testFormUnion() {\n        XCTAssertEqual(Int(0), mutableSet.count)\n        XCTAssertEqual(Int(0), otherMutableSet.count)\n        mutableSet.insert(values[0])\n        mutableSet.insert(values[1])\n        otherMutableSet.insert(values[0])\n        otherMutableSet.insert(values[2])\n        mutableSet.formUnion(otherMutableSet)\n        XCTAssertEqual(Int(3), mutableSet.count)\n        if values[0].object(SwiftStringObject.self) != nil {\n            XCTAssertTrue(values.map {\n                $0.object(SwiftStringObject.self)?.stringCol\n            }.contains(mutableSet[0].object(SwiftStringObject.self)?.stringCol))\n            XCTAssertTrue(values.map {\n                $0.object(SwiftStringObject.self)?.stringCol\n            }.contains(mutableSet[1].object(SwiftStringObject.self)?.stringCol))\n            XCTAssertTrue(values.map {\n                $0.object(SwiftStringObject.self)?.stringCol\n            }.contains(mutableSet[2].object(SwiftStringObject.self)?.stringCol))\n        } else {\n            XCTAssertTrue(values.map { $0 }.contains(mutableSet[0]))\n            XCTAssertTrue(values.map { $0 }.contains(mutableSet[1]))\n            XCTAssertTrue(values.map { $0 }.contains(mutableSet[2]))\n        }\n    }\n\n    func testSubtract() {\n        XCTAssertEqual(Int(0), mutableSet.count)\n        XCTAssertEqual(Int(0), otherMutableSet.count)\n        mutableSet.insert(values[0])\n        mutableSet.insert(values[1])\n        otherMutableSet.insert(values[0])\n        otherMutableSet.insert(values[2])\n        mutableSet.subtract(otherMutableSet)\n        XCTAssertEqual(Int(1), mutableSet.count)\n        XCTAssertFalse(mutableSet.contains(values[0]))\n        XCTAssertTrue(mutableSet.contains(values[1]))\n    }\n\n    func testSubscript() {\n        mutableSet.insert(objectsIn: values)\n        if values[0].object(SwiftStringObject.self) != nil {\n            XCTAssertTrue(values.map {\n                $0.object(SwiftStringObject.self)?.stringCol\n            }.contains(mutableSet[0].object(SwiftStringObject.self)?.stringCol))\n            XCTAssertTrue(values.map {\n                $0.object(SwiftStringObject.self)?.stringCol\n            }.contains(mutableSet[1].object(SwiftStringObject.self)?.stringCol))\n            XCTAssertTrue(values.map {\n                $0.object(SwiftStringObject.self)?.stringCol\n            }.contains(mutableSet[2].object(SwiftStringObject.self)?.stringCol))\n        } else {\n            XCTAssertTrue(values.map { $0 }.contains(mutableSet[0]))\n            XCTAssertTrue(values.map { $0 }.contains(mutableSet[1]))\n            XCTAssertTrue(values.map { $0 }.contains(mutableSet[2]))\n        }\n    }\n}\n\nclass MinMaxAnyRealmValueMutableSetTests<O: ObjectFactory, V: AnyValueFactory>: AnyRealmValueSetTestsBase<O, V> {\n    func testMin() {\n        XCTAssertNil(mutableSet.min())\n        mutableSet.insert(objectsIn: values)\n        XCTAssertEqual(mutableSet.min(), values.first)\n    }\n\n    func testMax() {\n        XCTAssertNil(mutableSet.max())\n        mutableSet.insert(objectsIn: values)\n        XCTAssertEqual(mutableSet.max(), values.last)\n    }\n}\n\nclass AddableAnyRealmValueMutableSetTests<O: ObjectFactory, V: AnyValueFactory>: AnyRealmValueSetTestsBase<O, V> where V: NumericValueFactory {\n    func testSum() {\n        if mutableSet.realm != nil {\n            XCTAssertEqual(mutableSet.sum().intValue, nil)\n        } else {\n            XCTAssertEqual(mutableSet.sum().intValue, 0)\n        }\n        mutableSet.insert(objectsIn: values)\n        XCTAssertEqual(doubleValue(mutableSet.sum()), V.sum(), accuracy: 0.1)\n    }\n\n    func testAverage() {\n        XCTAssertNil(mutableSet.average() as V.AverageType?)\n        mutableSet.insert(objectsIn: values)\n\n        let v: AnyRealmValue = mutableSet.average()!\n        XCTAssertEqual(doubleValue(v), V.average(), accuracy: 0.1)\n    }\n}\n\nfunc addAnyRealmValueMutableSetTests<OF: ObjectFactory>(_ suite: XCTestSuite, _ type: OF.Type) {\n    AnyRealmValueMutableSetTests<OF, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMutableSetTests<OF, Bool>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMutableSetTests<OF, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMutableSetTests<OF, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMutableSetTests<OF, String>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMutableSetTests<OF, Data>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMutableSetTests<OF, Date>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMutableSetTests<OF, SwiftStringObject>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMutableSetTests<OF, ObjectId>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMutableSetTests<OF, Decimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMutableSetTests<OF, UUID>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    MinMaxAnyRealmValueMutableSetTests<OF, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxAnyRealmValueMutableSetTests<OF, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxAnyRealmValueMutableSetTests<OF, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxAnyRealmValueMutableSetTests<OF, Date>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxAnyRealmValueMutableSetTests<OF, Decimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    AddableAnyRealmValueMutableSetTests<OF, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddableAnyRealmValueMutableSetTests<OF, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddableAnyRealmValueMutableSetTests<OF, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddableAnyRealmValueMutableSetTests<OF, Decimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n}\n\nclass UnmanagedAnyRealmValueMutableSetTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        let suite = XCTestSuite(name: \"Unmanaged Primitive Sets\")\n        addAnyRealmValueMutableSetTests(suite, UnmanagedObjectFactory.self)\n        return suite\n    }\n}\n\nclass ManagedAnyRealmValueMutableSetTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        let suite = XCTestSuite(name: \"Managed Primitive Sets\")\n        addAnyRealmValueMutableSetTests(suite, ManagedObjectFactory.self)\n        return suite\n    }\n}\n\n// MARK: - Map tests\n\nclass AnyRealmValueMapTestsBase<O: ObjectFactory, V: AnyValueFactory>: TestCase {\n    var realm: Realm?\n    var obj: ModernAllTypesObject!\n    var map: Map<String, AnyRealmValue>!\n    var values: [(key: String, value: AnyRealmValue)]!\n\n    override func setUp() {\n        obj = O.get()\n        realm = obj.realm\n        map = obj.mapAny\n        values = V.anyValues().enumerated().map { (key: \"key\\($0)\", value: $1) }\n    }\n\n    override func tearDown() {\n        realm?.cancelWrite()\n        map = nil\n        obj = nil\n        realm = nil\n    }\n}\n\nclass AnyRealmValueMapTests<O: ObjectFactory, V: AnyValueFactory>: AnyRealmValueMapTestsBase<O, V> {\n    func testInvalidated() {\n        XCTAssertFalse(map.isInvalidated)\n        if let realm = obj.realm {\n            realm.delete(obj)\n            XCTAssertTrue(map.isInvalidated)\n        }\n    }\n\n    // KVC requires the key to be a string.\n    func testValueForKey() {\n        let key = values[0].key\n        XCTAssertNil(map.value(forKey: key))\n        map[values[0].key] = values[0].value\n        let kvc: AnyObject? = map.value(forKey: key)\n        switch values[0].value {\n        case let .object(o):\n            if let obj = kvc as? SwiftStringObject {\n                XCTAssertEqual(obj.stringCol, (o as! SwiftStringObject).stringCol)\n            } else {\n                XCTFail(\"not an object\")\n            }\n        case let .bool(b):\n            XCTAssertEqual(kvc as! Bool, b)\n        case let .data(d):\n            XCTAssertEqual(kvc as! Data, d)\n        case let .date(d):\n            XCTAssertEqual(kvc as! Date, d)\n        case let .decimal128(d):\n            XCTAssertEqual(kvc as! Decimal128, d)\n        case let .double(d):\n            XCTAssertEqual(kvc as! Double, d)\n        case let .float(f):\n            XCTAssertEqual(kvc as! Float, f)\n        case let .int(i):\n            XCTAssertEqual(kvc as! Int, i)\n        case .none:\n            XCTAssertNil(kvc)\n        case let .objectId(o):\n            XCTAssertEqual(kvc as! ObjectId, o)\n        case let .string(s):\n            XCTAssertEqual(kvc as! String, s)\n        case let .uuid(u):\n            XCTAssertEqual(kvc as! UUID, u)\n        case let .dictionary(d):\n            XCTAssertEqual(kvc as! Map<String, AnyRealmValue>, d)\n        case let .list(l):\n            XCTAssertEqual(kvc as! List<AnyRealmValue>, l)\n        }\n    }\n\n    func assertValue(_ value: AnyRealmValue, key: String) {\n        if case let .object(o) = map[key] {\n            XCTAssertTrue(map.contains(where: { key, value in\n                return key == key && (value.object(SwiftStringObject.self)!.stringCol == o[\"stringCol\"] as! String)\n            }))\n        } else {\n            XCTAssertTrue(map.contains(where: { k, v in\n                return k == key && v == value\n            }))\n        }\n    }\n\n    func testInsert() {\n        XCTAssertEqual(0, map.count)\n\n        map[values[0].key] = values[0].value\n        XCTAssertEqual(1, map.count)\n        XCTAssertEqual(1, map.keys.count)\n        XCTAssertEqual(1, map.values.count)\n        XCTAssertTrue(Set([values[0].key]).isSubset(of: map.keys))\n        assertValue(values[0].value, key: values[0].key)\n\n        map[values[1].key] = values[1].value\n        XCTAssertEqual(2, map.count)\n        XCTAssertEqual(2, map.keys.count)\n        XCTAssertEqual(2, map.values.count)\n        XCTAssertTrue(Set([values[0].key, values[1].key]).isSubset(of: map.keys))\n        assertValue(values[1].value, key: values[1].key)\n\n        map[values[2].key] = values[2].value\n        XCTAssertEqual(3, map.count)\n        XCTAssertEqual(3, map.keys.count)\n        XCTAssertEqual(3, map.values.count)\n        XCTAssertTrue(Set(values.map { $0.key }).isSubset(of: map.keys))\n        assertValue(values[2].value, key: values[2].key)\n    }\n\n    func testRemove() {\n        XCTAssertEqual(0, map.count)\n        map.merge(values) { $1 }\n        XCTAssertEqual(3, map.count)\n        XCTAssertEqual(3, map.keys.count)\n        XCTAssertEqual(3, map.values.count)\n        XCTAssertTrue(Set(values.map { $0.key }).isSubset(of: map.keys))\n\n        let key = values[0].key\n        map.setValue(nil, forKey: key)\n        XCTAssertNil(map.value(forKey: key))\n        map.removeAll()\n        XCTAssertEqual(0, map.count)\n\n        map.merge(values) { $1 }\n\n        map[values[1].key] = nil\n        XCTAssertNil(map[values[1].key])\n        map.removeObject(for: values[2].key)\n        // make sure the key was deleted\n        XCTAssertTrue(Set([values[0].key]).isSubset(of: map.keys))\n    }\n\n    func testSubscript() {\n        // setter\n        XCTAssertEqual(0, map.count)\n        map[values[0].key] = values[0].value\n        map[values[1].key] = values[1].value\n        map[values[2].key] = values[2].value\n        XCTAssertEqual(3, map.count)\n        XCTAssertEqual(3, map.keys.count)\n        XCTAssertEqual(3, map.values.count)\n        XCTAssertTrue(Set(values.map { $0.key }).isSubset(of: map.keys))\n        map[values[0].key] = values[0].value\n        map[values[1].key] = nil\n        map[values[2].key] = values[2].value\n        XCTAssertEqual(2, map.count)\n        XCTAssertEqual(2, map.keys.count)\n        XCTAssertEqual(2, map.values.count)\n        XCTAssertTrue(Set([values[0].key, values[2].key]).isSubset(of: map.keys))\n        map[values[0].key] = AnyRealmValue.none\n        XCTAssertEqual(2, map.count)\n        XCTAssertEqual(2, map.keys.count)\n        XCTAssertEqual(2, map.values.count)\n        XCTAssertTrue(Set([values[0].key, values[2].key]).isSubset(of: map.keys))\n        // getter\n        map.removeAll()\n        XCTAssertNil(map[values[0].key])\n        map[values[0].key] = values[0].value\n        if case let .object(o) = map[values[0].key] {\n            XCTAssertEqual(values[0].value.object(SwiftStringObject.self)!.stringCol, (o as! SwiftStringObject).stringCol)\n        } else {\n            XCTAssertEqual(values[0].value, map[values[0].key])\n        }\n    }\n}\n\nclass MinMaxAnyRealmValueMapTests<O: ObjectFactory, V: AnyValueFactory>: AnyRealmValueMapTestsBase<O, V> {\n    func testMin() {\n        XCTAssertNil(map.min())\n        map.merge(values) { $1 }\n        XCTAssertEqual(map.min(), values.first?.value)\n    }\n\n    func testMax() {\n        XCTAssertNil(map.max())\n        map.merge(values) { $1 }\n        XCTAssertEqual(map.max(), values.last?.value)\n    }\n}\n\nclass AddableAnyRealmValueMapTests<O: ObjectFactory, V: AnyValueFactory>: AnyRealmValueMapTestsBase<O, V> where V: NumericValueFactory {\n    func testSum() {\n        XCTAssertEqual(map.sum().intValue, 0)\n        map.merge(values) { $1 }\n        XCTAssertEqual(doubleValue(map.sum()), V.sum(), accuracy: 0.1)\n    }\n\n    func testAverage() {\n        XCTAssertNil(map.average() as V.AverageType?)\n        map.merge(values) { $1 }\n        let v: AnyRealmValue = map.average()!\n        XCTAssertEqual(doubleValue(v), V.average(), accuracy: 0.1)\n    }\n}\n\nfunc addAnyRealmValueMapTests<OF: ObjectFactory>(_ suite: XCTestSuite, _ type: OF.Type) {\n    AnyRealmValueMapTests<OF, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMapTests<OF, Bool>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMapTests<OF, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMapTests<OF, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMapTests<OF, String>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMapTests<OF, Data>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMapTests<OF, Date>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMapTests<OF, SwiftStringObject>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMapTests<OF, ObjectId>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMapTests<OF, Decimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n    AnyRealmValueMapTests<OF, UUID>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    MinMaxAnyRealmValueMapTests<OF, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxAnyRealmValueMapTests<OF, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxAnyRealmValueMapTests<OF, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxAnyRealmValueMapTests<OF, Date>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxAnyRealmValueMapTests<OF, Decimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    AddableAnyRealmValueMapTests<OF, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddableAnyRealmValueMapTests<OF, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddableAnyRealmValueMapTests<OF, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddableAnyRealmValueMapTests<OF, Decimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n}\n\nclass UnmanagedAnyRealmValueMapTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        let suite = XCTestSuite(name: \"Unmanaged AnyRealmValue Maps\")\n        addAnyRealmValueMapTests(suite, UnmanagedObjectFactory.self)\n        return suite\n    }\n}\n\nclass ManagedAnyRealmValueMapTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        let suite = XCTestSuite(name: \"Managed AnyRealmValue Maps\")\n        addAnyRealmValueMapTests(suite, ManagedObjectFactory.self)\n        return suite\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/CodableTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2019 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nfinal class CodableObject: Object, Codable {\n    @objc dynamic var string: String = \"\"\n    @objc dynamic var data: Data = Data()\n    @objc dynamic var date: Date = Date()\n    @objc dynamic var int: Int = 0\n    @objc dynamic var int8: Int8 = 0\n    @objc dynamic var int16: Int16 = 0\n    @objc dynamic var int32: Int32 = 0\n    @objc dynamic var int64: Int64 = 0\n    @objc dynamic var float: Float = 0\n    @objc dynamic var double: Double = 0\n    @objc dynamic var bool: Bool = false\n    @objc dynamic var decimal: Decimal128 = 0\n    @objc dynamic var objectId = ObjectId()\n    @objc dynamic var uuid = UUID()\n\n    @objc dynamic var stringOpt: String?\n    @objc dynamic var dataOpt: Data?\n    @objc dynamic var dateOpt: Date?\n    @objc dynamic var decimalOpt: Decimal128?\n    @objc dynamic var objectIdOpt: ObjectId?\n    var intOpt = RealmOptional<Int>()\n    var int8Opt = RealmOptional<Int8>()\n    var int16Opt = RealmOptional<Int16>()\n    var int32Opt = RealmOptional<Int32>()\n    var int64Opt = RealmOptional<Int64>()\n    var floatOpt = RealmOptional<Float>()\n    var doubleOpt = RealmOptional<Double>()\n    var boolOpt = RealmOptional<Bool>()\n\n    var otherInt = RealmProperty<Int?>()\n    var otherInt8 = RealmProperty<Int8?>()\n    var otherInt16 = RealmProperty<Int16?>()\n    var otherInt32 = RealmProperty<Int32?>()\n    var otherInt64 = RealmProperty<Int64?>()\n    var otherFloat = RealmProperty<Float?>()\n    var otherDouble = RealmProperty<Double?>()\n    var otherBool = RealmProperty<Bool?>()\n    var otherEnum = RealmProperty<IntEnum?>()\n\n    @objc dynamic var uuidOpt: UUID?\n\n    var boolList = List<Bool>()\n    var intList = List<Int>()\n    var int8List = List<Int8>()\n    var int16List = List<Int16>()\n    var int32List = List<Int32>()\n    var int64List = List<Int64>()\n    var floatList = List<Float>()\n    var doubleList = List<Double>()\n    var stringList = List<String>()\n    var dataList = List<Data>()\n    var dateList = List<Date>()\n    var decimalList = List<Decimal128>()\n    var objectIdList = List<ObjectId>()\n    var uuidList = List<UUID>()\n\n    var boolOptList = List<Bool?>()\n    var intOptList = List<Int?>()\n    var int8OptList = List<Int8?>()\n    var int16OptList = List<Int16?>()\n    var int32OptList = List<Int32?>()\n    var int64OptList = List<Int64?>()\n    var floatOptList = List<Float?>()\n    var doubleOptList = List<Double?>()\n    var stringOptList = List<String?>()\n    var dataOptList = List<Data?>()\n    var dateOptList = List<Date?>()\n    var decimalOptList = List<Decimal128?>()\n    var objectIdOptList = List<ObjectId?>()\n    var uuidOptList = List<UUID?>()\n\n    var boolSet = MutableSet<Bool>()\n    var intSet = MutableSet<Int>()\n    var int8Set = MutableSet<Int8>()\n    var int16Set = MutableSet<Int16>()\n    var int32Set = MutableSet<Int32>()\n    var int64Set = MutableSet<Int64>()\n    var floatSet = MutableSet<Float>()\n    var doubleSet = MutableSet<Double>()\n    var stringSet = MutableSet<String>()\n    var dataSet = MutableSet<Data>()\n    var dateSet = MutableSet<Date>()\n    var decimalSet = MutableSet<Decimal128>()\n    var objectIdSet = MutableSet<ObjectId>()\n    var uuidSet = MutableSet<UUID>()\n\n    var boolOptSet = MutableSet<Bool?>()\n    var intOptSet = MutableSet<Int?>()\n    var int8OptSet = MutableSet<Int8?>()\n    var int16OptSet = MutableSet<Int16?>()\n    var int32OptSet = MutableSet<Int32?>()\n    var int64OptSet = MutableSet<Int64?>()\n    var floatOptSet = MutableSet<Float?>()\n    var doubleOptSet = MutableSet<Double?>()\n    var stringOptSet = MutableSet<String?>()\n    var dataOptSet = MutableSet<Data?>()\n    var dateOptSet = MutableSet<Date?>()\n    var decimalOptSet = MutableSet<Decimal128?>()\n    var objectIdOptSet = MutableSet<ObjectId?>()\n    var uuidOptSet = MutableSet<UUID?>()\n\n    var boolMap = Map<String, Bool>()\n    var intMap = Map<String, Int>()\n    var int8Map = Map<String, Int8>()\n    var int16Map = Map<String, Int16>()\n    var int32Map = Map<String, Int32>()\n    var int64Map = Map<String, Int64>()\n    var floatMap = Map<String, Float>()\n    var doubleMap = Map<String, Double>()\n    var stringMap = Map<String, String>()\n    var dataMap = Map<String, Data>()\n    var dateMap = Map<String, Date>()\n    var decimalMap = Map<String, Decimal128>()\n    var objectIdMap = Map<String, ObjectId>()\n    var uuidMap = Map<String, UUID>()\n\n    var boolOptMap = Map<String, Bool?>()\n    var intOptMap = Map<String, Int?>()\n    var int8OptMap = Map<String, Int8?>()\n    var int16OptMap = Map<String, Int16?>()\n    var int32OptMap = Map<String, Int32?>()\n    var int64OptMap = Map<String, Int64?>()\n    var floatOptMap = Map<String, Float?>()\n    var doubleOptMap = Map<String, Double?>()\n    var stringOptMap = Map<String, String?>()\n    var dataOptMap = Map<String, Data?>()\n    var dateOptMap = Map<String, Date?>()\n    var decimalOptMap = Map<String, Decimal128?>()\n    var objectIdOptMap = Map<String, ObjectId?>()\n    var uuidOptMap = Map<String, UUID?>()\n}\n\nfinal class ModernCodableObject: Object, Codable {\n    @Persisted var string: String\n    @Persisted var data: Data\n    @Persisted var date: Date\n    @Persisted var int: Int\n    @Persisted var int8: Int8\n    @Persisted var int16: Int16\n    @Persisted var int32: Int32\n    @Persisted var int64: Int64\n    @Persisted var float: Float\n    @Persisted var double: Double\n    @Persisted var bool: Bool\n    @Persisted var decimal: Decimal128\n    @Persisted var objectId: ObjectId\n    @Persisted var uuid: UUID\n\n    @Persisted var stringOpt: String?\n    @Persisted var dataOpt: Data?\n    @Persisted var dateOpt: Date?\n    @Persisted var decimalOpt: Decimal128?\n    @Persisted var objectIdOpt: ObjectId?\n    @Persisted var intOpt: Int?\n    @Persisted var int8Opt: Int8?\n    @Persisted var int16Opt: Int16?\n    @Persisted var int32Opt: Int32?\n    @Persisted var int64Opt: Int64?\n    @Persisted var floatOpt: Float?\n    @Persisted var doubleOpt: Double?\n    @Persisted var boolOpt: Bool?\n    @Persisted var uuidOpt: UUID?\n    @Persisted var objectOpt: CodableTopLevelObject?\n    @Persisted var embeddedObjectOpt: CodableEmbeddedObject?\n\n    @Persisted var boolList: List<Bool>\n    @Persisted var intList: List<Int>\n    @Persisted var int8List: List<Int8>\n    @Persisted var int16List: List<Int16>\n    @Persisted var int32List: List<Int32>\n    @Persisted var int64List: List<Int64>\n    @Persisted var floatList: List<Float>\n    @Persisted var doubleList: List<Double>\n    @Persisted var stringList: List<String>\n    @Persisted var dataList: List<Data>\n    @Persisted var dateList: List<Date>\n    @Persisted var decimalList: List<Decimal128>\n    @Persisted var objectIdList: List<ObjectId>\n    @Persisted var uuidList: List<UUID>\n    @Persisted var objectList: List<CodableTopLevelObject>\n    @Persisted var embeddedObjectList: List<CodableEmbeddedObject>\n\n    @Persisted var boolOptList: List<Bool?>\n    @Persisted var intOptList: List<Int?>\n    @Persisted var int8OptList: List<Int8?>\n    @Persisted var int16OptList: List<Int16?>\n    @Persisted var int32OptList: List<Int32?>\n    @Persisted var int64OptList: List<Int64?>\n    @Persisted var floatOptList: List<Float?>\n    @Persisted var doubleOptList: List<Double?>\n    @Persisted var stringOptList: List<String?>\n    @Persisted var dataOptList: List<Data?>\n    @Persisted var dateOptList: List<Date?>\n    @Persisted var decimalOptList: List<Decimal128?>\n    @Persisted var objectIdOptList: List<ObjectId?>\n    @Persisted var uuidOptList: List<UUID?>\n\n    @Persisted var boolSet: MutableSet<Bool>\n    @Persisted var intSet: MutableSet<Int>\n    @Persisted var int8Set: MutableSet<Int8>\n    @Persisted var int16Set: MutableSet<Int16>\n    @Persisted var int32Set: MutableSet<Int32>\n    @Persisted var int64Set: MutableSet<Int64>\n    @Persisted var floatSet: MutableSet<Float>\n    @Persisted var doubleSet: MutableSet<Double>\n    @Persisted var stringSet: MutableSet<String>\n    @Persisted var dataSet: MutableSet<Data>\n    @Persisted var dateSet: MutableSet<Date>\n    @Persisted var decimalSet: MutableSet<Decimal128>\n    @Persisted var objectIdSet: MutableSet<ObjectId>\n    @Persisted var uuidSet: MutableSet<UUID>\n    @Persisted var objectSet: MutableSet<CodableTopLevelObject>\n\n    @Persisted var boolOptSet: MutableSet<Bool?>\n    @Persisted var intOptSet: MutableSet<Int?>\n    @Persisted var int8OptSet: MutableSet<Int8?>\n    @Persisted var int16OptSet: MutableSet<Int16?>\n    @Persisted var int32OptSet: MutableSet<Int32?>\n    @Persisted var int64OptSet: MutableSet<Int64?>\n    @Persisted var floatOptSet: MutableSet<Float?>\n    @Persisted var doubleOptSet: MutableSet<Double?>\n    @Persisted var stringOptSet: MutableSet<String?>\n    @Persisted var dataOptSet: MutableSet<Data?>\n    @Persisted var dateOptSet: MutableSet<Date?>\n    @Persisted var decimalOptSet: MutableSet<Decimal128?>\n    @Persisted var objectIdOptSet: MutableSet<ObjectId?>\n    @Persisted var uuidOptSet: MutableSet<UUID?>\n\n    @Persisted var boolMap: Map<String, Bool>\n    @Persisted var intMap: Map<String, Int>\n    @Persisted var int8Map: Map<String, Int8>\n    @Persisted var int16Map: Map<String, Int16>\n    @Persisted var int32Map: Map<String, Int32>\n    @Persisted var int64Map: Map<String, Int64>\n    @Persisted var floatMap: Map<String, Float>\n    @Persisted var doubleMap: Map<String, Double>\n    @Persisted var stringMap: Map<String, String>\n    @Persisted var dataMap: Map<String, Data>\n    @Persisted var dateMap: Map<String, Date>\n    @Persisted var decimalMap: Map<String, Decimal128>\n    @Persisted var objectIdMap: Map<String, ObjectId>\n    @Persisted var uuidMap: Map<String, UUID>\n\n    @Persisted var boolOptMap: Map<String, Bool?>\n    @Persisted var intOptMap: Map<String, Int?>\n    @Persisted var int8OptMap: Map<String, Int8?>\n    @Persisted var int16OptMap: Map<String, Int16?>\n    @Persisted var int32OptMap: Map<String, Int32?>\n    @Persisted var int64OptMap: Map<String, Int64?>\n    @Persisted var floatOptMap: Map<String, Float?>\n    @Persisted var doubleOptMap: Map<String, Double?>\n    @Persisted var stringOptMap: Map<String, String?>\n    @Persisted var dataOptMap: Map<String, Data?>\n    @Persisted var dateOptMap: Map<String, Date?>\n    @Persisted var decimalOptMap: Map<String, Decimal128?>\n    @Persisted var objectIdOptMap: Map<String, ObjectId?>\n    @Persisted var uuidOptMap: Map<String, UUID?>\n    @Persisted var objectOptMap: Map<String, CodableTopLevelObject?>\n    @Persisted var embeddedObjectOptMap: Map<String, CodableEmbeddedObject?>\n}\n\nfinal class CodableTopLevelObject: Object, Codable {\n    @Persisted var value: Int\n}\n\nfinal class CodableEmbeddedObject: EmbeddedObject, Codable {\n    @Persisted var value: Int\n}\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass CodableTests: TestCase {\n    let decoder = JSONDecoder()\n    let encoder = JSONEncoder()\n\n    func decode<T: RealmOptionalType & Codable & _RealmSchemaDiscoverable>(_ type: T.Type, _ str: String) -> RealmOptional<T> {\n        return decode(RealmOptional<T>.self, str)\n    }\n    func decode<T: Codable>(_ type: T.Type, _ str: String) -> T {\n        return try! decoder.decode([T].self, from: str.data(using: .utf8)!).first!\n    }\n\n    func encode<T: RealmOptionalType & Codable & _RealmSchemaDiscoverable>(_ value: T?) -> String {\n        let opt = RealmOptional<T>()\n        opt.value = value\n        return try! String(data: encoder.encode([opt]), encoding: .utf8)!\n    }\n    func encode<T: Codable>(_ value: T?) -> String {\n        return try! String(data: encoder.encode([value]), encoding: .utf8)!\n    }\n\n    func legacyObjectString(_ nullRealmProperty: Bool = false) -> String {\n        \"\"\"\n        {\n            \"bool\": true,\n            \"string\": \"abc\",\n            \"int\": 123,\n            \"int8\": 123,\n            \"int16\": 123,\n            \"int32\": 123,\n            \"int64\": 123,\n            \"float\": 2.5,\n            \"double\": 2.5,\n            \"date\": 2.5,\n            \"data\": \"\\(Data(\"def\".utf8).base64EncodedString())\",\n            \"decimal\": \"1.5e2\",\n            \"objectId\": \"1234567890abcdef12345678\",\n            \"uuid\": \"00000000-0000-0000-0000-000000000000\",\n\n            \"boolOpt\": true,\n            \"stringOpt\": \"abc\",\n            \"intOpt\": 123,\n            \"int8Opt\": 123,\n            \"int16Opt\": 123,\n            \"int32Opt\": 123,\n            \"int64Opt\": 123,\n            \"floatOpt\": 2.5,\n            \"doubleOpt\": 2.5,\n            \"dateOpt\": 2.5,\n            \"dataOpt\": \"\\(Data(\"def\".utf8).base64EncodedString())\",\n            \"decimalOpt\": \"1.5e2\",\n            \"objectIdOpt\": \"1234567890abcdef12345678\",\n            \"uuidOpt\": \"00000000-0000-0000-0000-000000000000\",\n\n            \"otherBool\": \\(nullRealmProperty ? \"null\" : \"true\"),\n            \"otherInt\": \\(nullRealmProperty ? \"null\" : \"123\"),\n            \"otherInt8\": \\(nullRealmProperty ? \"null\" : \"123\"),\n            \"otherInt16\": \\(nullRealmProperty ? \"null\" : \"123\"),\n            \"otherInt32\": \\(nullRealmProperty ? \"null\" : \"123\"),\n            \"otherInt64\": \\(nullRealmProperty ? \"null\" : \"123\"),\n            \"otherFloat\": \\(nullRealmProperty ? \"null\" : \"2.5\"),\n            \"otherDouble\": \\(nullRealmProperty ? \"null\" : \"2.5\"),\n            \"otherEnum\": \\(nullRealmProperty ? \"null\" : \"1\"),\n            \"otherAny\": \\(nullRealmProperty ? \"null\" : \"1\"),\n\n            \"boolList\": [true],\n            \"stringList\": [\"abc\"],\n            \"intList\": [123],\n            \"int8List\": [123],\n            \"int16List\": [123],\n            \"int32List\": [123],\n            \"int64List\": [123],\n            \"floatList\": [2.5],\n            \"doubleList\": [2.5],\n            \"dateList\": [2.5],\n            \"dataList\": [\"\\(Data(\"def\".utf8).base64EncodedString())\"],\n            \"decimalList\": [\"1.5e2\"],\n            \"objectIdList\": [\"1234567890abcdef12345678\"],\n            \"uuidList\": [\"00000000-0000-0000-0000-000000000000\"],\n\n            \"boolOptList\": [true],\n            \"stringOptList\": [\"abc\"],\n            \"intOptList\": [123],\n            \"int8OptList\": [123],\n            \"int16OptList\": [123],\n            \"int32OptList\": [123],\n            \"int64OptList\": [123],\n            \"floatOptList\": [2.5],\n            \"doubleOptList\": [2.5],\n            \"dateOptList\": [2.5],\n            \"dataOptList\": [\"\\(Data(\"def\".utf8).base64EncodedString())\"],\n            \"decimalOptList\": [\"1.5e2\"],\n            \"objectIdOptList\": [\"1234567890abcdef12345678\"],\n            \"uuidOptList\": [\"00000000-0000-0000-0000-000000000000\"],\n\n            \"boolSet\": [true],\n            \"stringSet\": [\"abc\"],\n            \"intSet\": [123],\n            \"int8Set\": [123],\n            \"int16Set\": [123],\n            \"int32Set\": [123],\n            \"int64Set\": [123],\n            \"floatSet\": [2.5],\n            \"doubleSet\": [2.5],\n            \"dateSet\": [2.5],\n            \"dataSet\": [\"\\(Data(\"def\".utf8).base64EncodedString())\"],\n            \"decimalSet\": [\"1.5e2\"],\n            \"objectIdSet\": [\"1234567890abcdef12345678\"],\n            \"uuidSet\": [\"00000000-0000-0000-0000-000000000000\"],\n\n            \"boolOptSet\": [true],\n            \"stringOptSet\": [\"abc\"],\n            \"intOptSet\": [123],\n            \"int8OptSet\": [123],\n            \"int16OptSet\": [123],\n            \"int32OptSet\": [123],\n            \"int64OptSet\": [123],\n            \"floatOptSet\": [2.5],\n            \"doubleOptSet\": [2.5],\n            \"dateOptSet\": [2.5],\n            \"dataOptSet\": [\"\\(Data(\"def\".utf8).base64EncodedString())\"],\n            \"decimalOptSet\": [\"1.5e2\"],\n            \"objectIdOptSet\": [\"1234567890abcdef12345678\"],\n            \"uuidOptSet\": [\"00000000-0000-0000-0000-000000000000\"],\n\n            \"boolMap\": {\"foo\": true},\n            \"stringMap\": {\"foo\": \"abc\"},\n            \"intMap\": {\"foo\": 123},\n            \"int8Map\": {\"foo\": 123},\n            \"int16Map\": {\"foo\": 123},\n            \"int32Map\": {\"foo\": 123},\n            \"int64Map\": {\"foo\": 123},\n            \"floatMap\": {\"foo\": 2.5},\n            \"doubleMap\": {\"foo\": 2.5},\n            \"dateMap\": {\"foo\": 2.5},\n            \"dataMap\": {\"foo\": \"\\(Data(\"def\".utf8).base64EncodedString())\"},\n            \"decimalMap\": {\"foo\": \"1.5e2\"},\n            \"objectIdMap\": {\"foo\": \"1234567890abcdef12345678\"},\n            \"uuidMap\": {\"foo\": \"00000000-0000-0000-0000-000000000000\"},\n\n            \"boolOptMap\": {\"foo\": true},\n            \"stringOptMap\": {\"foo\": \"abc\"},\n            \"intOptMap\": {\"foo\": 123},\n            \"int8OptMap\": {\"foo\": 123},\n            \"int16OptMap\": {\"foo\": 123},\n            \"int32OptMap\": {\"foo\": 123},\n            \"int64OptMap\": {\"foo\": 123},\n            \"floatOptMap\": {\"foo\": 2.5},\n            \"doubleOptMap\": {\"foo\": 2.5},\n            \"dateOptMap\": {\"foo\": 2.5},\n            \"dataOptMap\": {\"foo\": \"\\(Data(\"def\".utf8).base64EncodedString())\"},\n            \"decimalOptMap\": {\"foo\": \"1.5e2\"},\n            \"objectIdOptMap\": {\"foo\": \"1234567890abcdef12345678\"},\n            \"uuidOptMap\": {\"foo\": \"00000000-0000-0000-0000-000000000000\"}\n        }\n        \"\"\"\n    }\n\n    func testBool() {\n        XCTAssertEqual(true, decode(Bool.self, \"[true]\").value)\n        XCTAssertNil(decode(Bool.self, \"[null]\").value)\n        XCTAssertEqual(encode(true), \"[true]\")\n        XCTAssertEqual(encode(nil as Bool?), \"[null]\")\n    }\n\n    func testInt() {\n        XCTAssertEqual(1, decode(Int.self, \"[1]\").value)\n        XCTAssertNil(decode(Int.self, \"[null]\").value)\n        XCTAssertEqual(encode(10), \"[10]\")\n        XCTAssertEqual(encode(nil as Int?), \"[null]\")\n    }\n\n    func testFloat() {\n        XCTAssertEqual(2.2, decode(Float.self, \"[2.2]\").value)\n        XCTAssertNil(decode(Float.self, \"[null]\").value)\n        XCTAssertEqual(encode(2.25), \"[2.25]\")\n        XCTAssertEqual(encode(nil as Float?), \"[null]\")\n    }\n\n    func testDouble() {\n        XCTAssertEqual(2.2, decode(Double.self, \"[2.2]\").value)\n        XCTAssertNil(decode(Double.self, \"[null]\").value)\n        XCTAssertEqual(encode(2.25), \"[2.25]\")\n        XCTAssertEqual(encode(nil as Double?), \"[null]\")\n    }\n\n    func testDecimal() {\n        XCTAssertEqual(\"2.2\", decode(Decimal128.self, \"[2.2]\"))\n        XCTAssertEqual(\"1234567890e123\", decode(Decimal128.self, \"[\\\"1234567890e123\\\"]\"))\n        XCTAssertEqual(nil, decode(Decimal128?.self, \"[null]\"))\n        XCTAssertEqual(\"[\\\"1.23456789E132\\\"]\", encode(\"1234567890e123\" as Decimal128))\n    }\n\n    func testNullableRealmProperty() {\n        let decoder = JSONDecoder()\n        let obj = try! decoder.decode(CodableObject.self, from: Data(legacyObjectString(true).utf8))\n\n        XCTAssertEqual(obj.otherBool.value, nil)\n        XCTAssertEqual(obj.otherInt.value, nil)\n        XCTAssertEqual(obj.otherInt8.value, nil)\n        XCTAssertEqual(obj.otherInt16.value, nil)\n        XCTAssertEqual(obj.otherInt32.value, nil)\n        XCTAssertEqual(obj.otherInt64.value, nil)\n        XCTAssertEqual(obj.otherFloat.value, nil)\n        XCTAssertEqual(obj.otherDouble.value, nil)\n        XCTAssertEqual(obj.otherDouble.value, .none)\n    }\n\n    func testObject() throws {\n        let decoder = JSONDecoder()\n        let obj = try decoder.decode(CodableObject.self, from: Data(legacyObjectString().utf8))\n\n        XCTAssertEqual(obj.bool, true)\n        XCTAssertEqual(obj.int, 123)\n        XCTAssertEqual(obj.int8, 123)\n        XCTAssertEqual(obj.int16, 123)\n        XCTAssertEqual(obj.int32, 123)\n        XCTAssertEqual(obj.int64, 123)\n        XCTAssertEqual(obj.float, 2.5)\n        XCTAssertEqual(obj.double, 2.5)\n        XCTAssertEqual(obj.string, \"abc\")\n        XCTAssertEqual(obj.date, Date(timeIntervalSinceReferenceDate: 2.5))\n        XCTAssertEqual(obj.data, Data(\"def\".utf8))\n        XCTAssertEqual(obj.decimal, \"1.5e2\")\n        XCTAssertEqual(obj.objectId, ObjectId(\"1234567890abcdef12345678\"))\n\n        XCTAssertEqual(obj.boolOpt.value, true)\n        XCTAssertEqual(obj.intOpt.value, 123)\n        XCTAssertEqual(obj.int8Opt.value, 123)\n        XCTAssertEqual(obj.int16Opt.value, 123)\n        XCTAssertEqual(obj.int32Opt.value, 123)\n        XCTAssertEqual(obj.int64Opt.value, 123)\n        XCTAssertEqual(obj.floatOpt.value, 2.5)\n        XCTAssertEqual(obj.doubleOpt.value, 2.5)\n        XCTAssertEqual(obj.stringOpt, \"abc\")\n        XCTAssertEqual(obj.dateOpt, Date(timeIntervalSinceReferenceDate: 2.5))\n        XCTAssertEqual(obj.dataOpt, Data(\"def\".utf8))\n        XCTAssertEqual(obj.decimalOpt, \"1.5e2\")\n        XCTAssertEqual(obj.objectIdOpt, ObjectId(\"1234567890abcdef12345678\"))\n\n        XCTAssertEqual(obj.otherBool.value, true)\n        XCTAssertEqual(obj.otherInt.value, 123)\n        XCTAssertEqual(obj.otherInt8.value, 123)\n        XCTAssertEqual(obj.otherInt16.value, 123)\n        XCTAssertEqual(obj.otherInt32.value, 123)\n        XCTAssertEqual(obj.otherInt64.value, 123)\n        XCTAssertEqual(obj.otherFloat.value, 2.5)\n        XCTAssertEqual(obj.otherDouble.value, 2.5)\n        XCTAssertEqual(obj.otherEnum.value, .value1)\n\n        XCTAssertEqual(obj.boolList.first, true)\n        XCTAssertEqual(obj.intList.first, 123)\n        XCTAssertEqual(obj.int8List.first, 123)\n        XCTAssertEqual(obj.int16List.first, 123)\n        XCTAssertEqual(obj.int32List.first, 123)\n        XCTAssertEqual(obj.int64List.first, 123)\n        XCTAssertEqual(obj.floatList.first, 2.5)\n        XCTAssertEqual(obj.doubleList.first, 2.5)\n        XCTAssertEqual(obj.stringList.first, \"abc\")\n        XCTAssertEqual(obj.dateList.first, Date(timeIntervalSinceReferenceDate: 2.5))\n        XCTAssertEqual(obj.dataList.first, Data(\"def\".utf8))\n        XCTAssertEqual(obj.decimalList.first, \"1.5e2\")\n        XCTAssertEqual(obj.objectIdList.first, ObjectId(\"1234567890abcdef12345678\"))\n\n        XCTAssertEqual(obj.boolOptList.first, true)\n        XCTAssertEqual(obj.intOptList.first, 123)\n        XCTAssertEqual(obj.int8OptList.first, 123)\n        XCTAssertEqual(obj.int16OptList.first, 123)\n        XCTAssertEqual(obj.int32OptList.first, 123)\n        XCTAssertEqual(obj.int64OptList.first, 123)\n        XCTAssertEqual(obj.floatOptList.first, 2.5)\n        XCTAssertEqual(obj.doubleOptList.first, 2.5)\n        XCTAssertEqual(obj.stringOptList.first, \"abc\")\n        XCTAssertEqual(obj.dateOptList.first, Date(timeIntervalSinceReferenceDate: 2.5))\n        XCTAssertEqual(obj.dataOptList.first, Data(\"def\".utf8))\n        XCTAssertEqual(obj.decimalOptList.first, \"1.5e2\")\n        XCTAssertEqual(obj.objectIdOptList.first, ObjectId(\"1234567890abcdef12345678\"))\n\n        XCTAssertEqual(obj.boolSet.first, true)\n        XCTAssertEqual(obj.intSet.first, 123)\n        XCTAssertEqual(obj.int8Set.first, 123)\n        XCTAssertEqual(obj.int16Set.first, 123)\n        XCTAssertEqual(obj.int32Set.first, 123)\n        XCTAssertEqual(obj.int64Set.first, 123)\n        XCTAssertEqual(obj.floatSet.first, 2.5)\n        XCTAssertEqual(obj.doubleSet.first, 2.5)\n        XCTAssertEqual(obj.stringSet.first, \"abc\")\n        XCTAssertEqual(obj.dateSet.first, Date(timeIntervalSinceReferenceDate: 2.5))\n        XCTAssertEqual(obj.dataSet.first, Data(\"def\".utf8))\n        XCTAssertEqual(obj.decimalSet.first, \"1.5e2\")\n        XCTAssertEqual(obj.objectIdSet.first, ObjectId(\"1234567890abcdef12345678\"))\n\n        XCTAssertEqual(obj.boolOptSet.first, true)\n        XCTAssertEqual(obj.intOptSet.first, 123)\n        XCTAssertEqual(obj.int8OptSet.first, 123)\n        XCTAssertEqual(obj.int16OptSet.first, 123)\n        XCTAssertEqual(obj.int32OptSet.first, 123)\n        XCTAssertEqual(obj.int64OptSet.first, 123)\n        XCTAssertEqual(obj.floatOptSet.first, 2.5)\n        XCTAssertEqual(obj.doubleOptSet.first, 2.5)\n        XCTAssertEqual(obj.stringOptSet.first, \"abc\")\n        XCTAssertEqual(obj.dateOptSet.first, Date(timeIntervalSinceReferenceDate: 2.5))\n        XCTAssertEqual(obj.dataOptSet.first, Data(\"def\".utf8))\n        XCTAssertEqual(obj.decimalOptSet.first, \"1.5e2\")\n        XCTAssertEqual(obj.objectIdOptSet.first, ObjectId(\"1234567890abcdef12345678\"))\n\n        XCTAssertEqual(obj.boolMap[\"foo\"], true)\n        XCTAssertEqual(obj.intMap[\"foo\"], 123)\n        XCTAssertEqual(obj.int8Map[\"foo\"], 123)\n        XCTAssertEqual(obj.int16Map[\"foo\"], 123)\n        XCTAssertEqual(obj.int32Map[\"foo\"], 123)\n        XCTAssertEqual(obj.int64Map[\"foo\"], 123)\n        XCTAssertEqual(obj.floatMap[\"foo\"], 2.5)\n        XCTAssertEqual(obj.doubleMap[\"foo\"], 2.5)\n        XCTAssertEqual(obj.stringMap[\"foo\"], \"abc\")\n        XCTAssertEqual(obj.dateMap[\"foo\"], Date(timeIntervalSinceReferenceDate: 2.5))\n        XCTAssertEqual(obj.dataMap[\"foo\"], Data(\"def\".utf8))\n        XCTAssertEqual(obj.decimalMap[\"foo\"], \"1.5e2\")\n        XCTAssertEqual(obj.objectIdMap[\"foo\"], ObjectId(\"1234567890abcdef12345678\"))\n\n        XCTAssertEqual(obj.boolOptMap[\"foo\"], true)\n        XCTAssertEqual(obj.intOptMap[\"foo\"], 123)\n        XCTAssertEqual(obj.int8OptMap[\"foo\"], 123)\n        XCTAssertEqual(obj.int16OptMap[\"foo\"], 123)\n        XCTAssertEqual(obj.int32OptMap[\"foo\"], 123)\n        XCTAssertEqual(obj.int64OptMap[\"foo\"], 123)\n        XCTAssertEqual(obj.floatOptMap[\"foo\"], 2.5)\n        XCTAssertEqual(obj.doubleOptMap[\"foo\"], 2.5)\n        XCTAssertEqual(obj.stringOptMap[\"foo\"], \"abc\")\n        XCTAssertEqual(obj.dateOptMap[\"foo\"], Date(timeIntervalSinceReferenceDate: 2.5))\n        XCTAssertEqual(obj.dataOptMap[\"foo\"], Data(\"def\".utf8))\n        XCTAssertEqual(obj.decimalOptMap[\"foo\"], \"1.5e2\")\n        XCTAssertEqual(obj.objectIdOptMap[\"foo\"], ObjectId(\"1234567890abcdef12345678\"))\n\n        let expected = \"{\\\"doubleOptMap\\\":{\\\"foo\\\":2.5},\\\"floatSet\\\":[2.5],\\\"int8\\\":123,\\\"otherInt32\\\":123,\\\"int16Map\\\":{\\\"foo\\\":123},\\\"stringOpt\\\":\\\"abc\\\",\\\"uuidOptSet\\\":[\\\"00000000-0000-0000-0000-000000000000\\\"],\\\"int8OptMap\\\":{\\\"foo\\\":123},\\\"dataOptSet\\\":[\\\"ZGVm\\\"],\\\"stringOptSet\\\":[\\\"abc\\\"],\\\"doubleMap\\\":{\\\"foo\\\":2.5},\\\"int16OptMap\\\":{\\\"foo\\\":123},\\\"decimalOpt\\\":\\\"1.5E2\\\",\\\"decimalOptSet\\\":[\\\"1.5E2\\\"],\\\"uuidList\\\":[\\\"00000000-0000-0000-0000-000000000000\\\"],\\\"otherFloat\\\":2.5,\\\"dateOptSet\\\":[2.5],\\\"uuid\\\":\\\"00000000-0000-0000-0000-000000000000\\\",\\\"floatOpt\\\":2.5,\\\"int32OptSet\\\":[123],\\\"string\\\":\\\"abc\\\",\\\"dataOpt\\\":\\\"ZGVm\\\",\\\"int8Opt\\\":123,\\\"int16\\\":123,\\\"floatMap\\\":{\\\"foo\\\":2.5},\\\"decimalMap\\\":{\\\"foo\\\":\\\"1.5E2\\\"},\\\"dateOpt\\\":2.5,\\\"int64List\\\":[123],\\\"otherBool\\\":true,\\\"floatOptList\\\":[2.5],\\\"boolOptList\\\":[true],\\\"intOptSet\\\":[123],\\\"int32\\\":123,\\\"floatList\\\":[2.5],\\\"date\\\":2.5,\\\"dataSet\\\":[\\\"ZGVm\\\"],\\\"uuidOptList\\\":[\\\"00000000-0000-0000-0000-000000000000\\\"],\\\"int8Set\\\":[123],\\\"intOptList\\\":[123],\\\"int32Set\\\":[123],\\\"int32OptMap\\\":{\\\"foo\\\":123},\\\"dateSet\\\":[2.5],\\\"int32List\\\":[123],\\\"objectId\\\":\\\"1234567890abcdef12345678\\\",\\\"stringOptMap\\\":{\\\"foo\\\":\\\"abc\\\"},\\\"doubleOpt\\\":2.5,\\\"objectIdOptMap\\\":{\\\"foo\\\":\\\"1234567890abcdef12345678\\\"},\\\"boolOptSet\\\":[true],\\\"otherInt16\\\":123,\\\"intOpt\\\":123,\\\"intMap\\\":{\\\"foo\\\":123},\\\"objectIdOptSet\\\":[\\\"1234567890abcdef12345678\\\"],\\\"stringOptList\\\":[\\\"abc\\\"],\\\"int8OptList\\\":[123],\\\"int32Opt\\\":123,\\\"double\\\":2.5,\\\"stringSet\\\":[\\\"abc\\\"],\\\"otherDouble\\\":2.5,\\\"decimal\\\":\\\"1.5E2\\\",\\\"int32Map\\\":{\\\"foo\\\":123},\\\"int8OptSet\\\":[123],\\\"boolMap\\\":{\\\"foo\\\":true},\\\"int64OptList\\\":[123],\\\"dateOptList\\\":[2.5],\\\"intOptMap\\\":{\\\"foo\\\":123},\\\"bool\\\":true,\\\"int32OptList\\\":[123],\\\"intSet\\\":[123],\\\"dataOptList\\\":[\\\"ZGVm\\\"],\\\"float\\\":2.5,\\\"floatOptSet\\\":[2.5],\\\"decimalOptMap\\\":{\\\"foo\\\":\\\"1.5E2\\\"},\\\"uuidMap\\\":{\\\"foo\\\":\\\"00000000-0000-0000-0000-000000000000\\\"},\\\"int\\\":123,\\\"decimalSet\\\":[\\\"1.5E2\\\"],\\\"int16List\\\":[123],\\\"dataList\\\":[\\\"ZGVm\\\"],\\\"uuidOptMap\\\":{\\\"foo\\\":\\\"00000000-0000-0000-0000-000000000000\\\"},\\\"dataOptMap\\\":{\\\"foo\\\":\\\"ZGVm\\\"},\\\"otherEnum\\\":1,\\\"int8List\\\":[123],\\\"objectIdSet\\\":[\\\"1234567890abcdef12345678\\\"],\\\"objectIdOptList\\\":[\\\"1234567890abcdef12345678\\\"],\\\"otherInt64\\\":123,\\\"doubleOptList\\\":[2.5],\\\"floatOptMap\\\":{\\\"foo\\\":2.5},\\\"intList\\\":[123],\\\"int64Set\\\":[123],\\\"dateOptMap\\\":{\\\"foo\\\":2.5},\\\"int16OptList\\\":[123],\\\"boolList\\\":[true],\\\"doubleOptSet\\\":[2.5],\\\"doubleSet\\\":[2.5],\\\"stringMap\\\":{\\\"foo\\\":\\\"abc\\\"},\\\"int64OptSet\\\":[123],\\\"decimalOptList\\\":[\\\"1.5E2\\\"],\\\"otherInt\\\":123,\\\"dateList\\\":[2.5],\\\"objectIdList\\\":[\\\"1234567890abcdef12345678\\\"],\\\"stringList\\\":[\\\"abc\\\"],\\\"boolOpt\\\":true,\\\"objectIdMap\\\":{\\\"foo\\\":\\\"1234567890abcdef12345678\\\"},\\\"doubleList\\\":[2.5],\\\"dataMap\\\":{\\\"foo\\\":\\\"ZGVm\\\"},\\\"int16Set\\\":[123],\\\"int64\\\":123,\\\"int8Map\\\":{\\\"foo\\\":123},\\\"int64Opt\\\":123,\\\"boolSet\\\":[true],\\\"int64Map\\\":{\\\"foo\\\":123},\\\"dateMap\\\":{\\\"foo\\\":2.5},\\\"uuidOpt\\\":\\\"00000000-0000-0000-0000-000000000000\\\",\\\"int64OptMap\\\":{\\\"foo\\\":123},\\\"boolOptMap\\\":{\\\"foo\\\":true},\\\"otherInt8\\\":123,\\\"objectIdOpt\\\":\\\"1234567890abcdef12345678\\\",\\\"data\\\":\\\"ZGVm\\\",\\\"int16OptSet\\\":[123],\\\"decimalList\\\":[\\\"1.5E2\\\"],\\\"int16Opt\\\":123,\\\"uuidSet\\\":[\\\"00000000-0000-0000-0000-000000000000\\\"]}\"\n\n        let expectedData = expected.data(using: .utf8)!\n        let expectedDictionary = try JSONSerialization.jsonObject(with: expectedData, options: []) as? [String: Any]\n        let encodedDictionary  = try JSONSerialization.jsonObject(with: encoder.encode(obj), options: []) as? [String: Any]\n        XCTAssertEqual(expectedDictionary! as NSDictionary, encodedDictionary! as NSDictionary)\n    }\n\n    func testLegacyObjectOptionalNotRequired() {\n        let str = \"\"\"\n        {\n            \"bool\": true,\n            \"string\": \"abc\",\n            \"int\": 123,\n            \"int8\": 123,\n            \"int16\": 123,\n            \"int32\": 123,\n            \"int64\": 123,\n            \"float\": 2.5,\n            \"double\": 2.5,\n            \"date\": 2.5,\n            \"data\": \"\\(Data(\"def\".utf8).base64EncodedString())\",\n            \"decimal\": \"1.5e2\",\n            \"objectId\": \"1234567890abcdef12345678\",\n            \"uuid\": \"00000000-0000-0000-0000-000000000000\",\n\n            \"intOpt\": null,\n            \"int8Opt\": null,\n            \"int16Opt\": null,\n            \"int32Opt\": null,\n            \"int64Opt\": null,\n            \"floatOpt\": null,\n            \"doubleOpt\": null,\n            \"boolOpt\": null,\n\n            \"otherBool\": true,\n            \"otherInt\": 123,\n            \"otherInt8\": 123,\n            \"otherInt16\": 123,\n            \"otherInt32\": 123,\n            \"otherInt64\": 123,\n            \"otherFloat\": 2.5,\n            \"otherDouble\": 2.5,\n            \"otherEnum\": 1,\n            \"otherAny\": 1,\n\n            \"boolList\": [true],\n            \"stringList\": [\"abc\"],\n            \"intList\": [123],\n            \"int8List\": [123],\n            \"int16List\": [123],\n            \"int32List\": [123],\n            \"int64List\": [123],\n            \"floatList\": [2.5],\n            \"doubleList\": [2.5],\n            \"dateList\": [2.5],\n            \"dataList\": [\"\\(Data(\"def\".utf8).base64EncodedString())\"],\n            \"decimalList\": [\"1.5e2\"],\n            \"objectIdList\": [\"1234567890abcdef12345678\"],\n            \"uuidList\": [\"00000000-0000-0000-0000-000000000000\"],\n\n            \"boolOptList\": [true],\n            \"stringOptList\": [\"abc\"],\n            \"intOptList\": [123],\n            \"int8OptList\": [123],\n            \"int16OptList\": [123],\n            \"int32OptList\": [123],\n            \"int64OptList\": [123],\n            \"floatOptList\": [2.5],\n            \"doubleOptList\": [2.5],\n            \"dateOptList\": [2.5],\n            \"dataOptList\": [\"\\(Data(\"def\".utf8).base64EncodedString())\"],\n            \"decimalOptList\": [\"1.5e2\"],\n            \"objectIdOptList\": [\"1234567890abcdef12345678\"],\n            \"uuidOptList\": [\"00000000-0000-0000-0000-000000000000\"],\n\n            \"boolSet\": [true],\n            \"stringSet\": [\"abc\"],\n            \"intSet\": [123],\n            \"int8Set\": [123],\n            \"int16Set\": [123],\n            \"int32Set\": [123],\n            \"int64Set\": [123],\n            \"floatSet\": [2.5],\n            \"doubleSet\": [2.5],\n            \"dateSet\": [2.5],\n            \"dataSet\": [\"\\(Data(\"def\".utf8).base64EncodedString())\"],\n            \"decimalSet\": [\"1.5e2\"],\n            \"objectIdSet\": [\"1234567890abcdef12345678\"],\n            \"uuidSet\": [\"00000000-0000-0000-0000-000000000000\"],\n\n            \"boolOptSet\": [true],\n            \"stringOptSet\": [\"abc\"],\n            \"intOptSet\": [123],\n            \"int8OptSet\": [123],\n            \"int16OptSet\": [123],\n            \"int32OptSet\": [123],\n            \"int64OptSet\": [123],\n            \"floatOptSet\": [2.5],\n            \"doubleOptSet\": [2.5],\n            \"dateOptSet\": [2.5],\n            \"dataOptSet\": [\"\\(Data(\"def\".utf8).base64EncodedString())\"],\n            \"decimalOptSet\": [\"1.5e2\"],\n            \"objectIdOptSet\": [\"1234567890abcdef12345678\"],\n            \"uuidOptSet\": [\"00000000-0000-0000-0000-000000000000\"],\n\n            \"boolMap\": {\"foo\": true},\n            \"stringMap\": {\"foo\": \"abc\"},\n            \"intMap\": {\"foo\": 123},\n            \"int8Map\": {\"foo\": 123},\n            \"int16Map\": {\"foo\": 123},\n            \"int32Map\": {\"foo\": 123},\n            \"int64Map\": {\"foo\": 123},\n            \"floatMap\": {\"foo\": 2.5},\n            \"doubleMap\": {\"foo\": 2.5},\n            \"dateMap\": {\"foo\": 2.5},\n            \"dataMap\": {\"foo\": \"\\(Data(\"def\".utf8).base64EncodedString())\"},\n            \"decimalMap\": {\"foo\": \"1.5e2\"},\n            \"objectIdMap\": {\"foo\": \"1234567890abcdef12345678\"},\n            \"uuidMap\": {\"foo\": \"00000000-0000-0000-0000-000000000000\"},\n\n            \"boolOptMap\": {\"foo\": true},\n            \"stringOptMap\": {\"foo\": \"abc\"},\n            \"intOptMap\": {\"foo\": 123},\n            \"int8OptMap\": {\"foo\": 123},\n            \"int16OptMap\": {\"foo\": 123},\n            \"int32OptMap\": {\"foo\": 123},\n            \"int64OptMap\": {\"foo\": 123},\n            \"floatOptMap\": {\"foo\": 2.5},\n            \"doubleOptMap\": {\"foo\": 2.5},\n            \"dateOptMap\": {\"foo\": 2.5},\n            \"dataOptMap\": {\"foo\": \"\\(Data(\"def\".utf8).base64EncodedString())\"},\n            \"decimalOptMap\": {\"foo\": \"1.5e2\"},\n            \"objectIdOptMap\": {\"foo\": \"1234567890abcdef12345678\"},\n            \"uuidOptMap\": {\"foo\": \"00000000-0000-0000-0000-000000000000\"}\n        }\n        \"\"\"\n        let decoder = JSONDecoder()\n        let obj = try! decoder.decode(CodableObject.self, from: Data(str.utf8))\n\n        XCTAssertNil(obj.stringOpt)\n        XCTAssertNil(obj.dateOpt)\n        XCTAssertNil(obj.dataOpt)\n        XCTAssertNil(obj.decimalOpt)\n        XCTAssertNil(obj.objectIdOpt)\n    }\n\n    func testModernObject() throws {\n        // Note: \"ZGVm\" is Data(\"def\".utf8).base64EncodedString()\n        // This string needs to exactly match what JSONEncoder produces so that\n        // we can validate round-tripping\n        let str = if #available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, *) {\n            \"\"\"\n            {\n              \"bool\" : true,\n              \"boolList\" : [\n                true\n              ],\n              \"boolMap\" : {\n                \"foo\" : true\n              },\n              \"boolOpt\" : true,\n              \"boolOptList\" : [\n                true\n              ],\n              \"boolOptMap\" : {\n                \"foo\" : true\n              },\n              \"boolOptSet\" : [\n                true\n              ],\n              \"boolSet\" : [\n                true\n              ],\n              \"data\" : \"ZGVm\",\n              \"dataList\" : [\n                \"ZGVm\"\n              ],\n              \"dataMap\" : {\n                \"foo\" : \"ZGVm\"\n              },\n              \"dataOpt\" : \"ZGVm\",\n              \"dataOptList\" : [\n                \"ZGVm\"\n              ],\n              \"dataOptMap\" : {\n                \"foo\" : \"ZGVm\"\n              },\n              \"dataOptSet\" : [\n                \"ZGVm\"\n              ],\n              \"dataSet\" : [\n                \"ZGVm\"\n              ],\n              \"date\" : 2.5,\n              \"dateList\" : [\n                2.5\n              ],\n              \"dateMap\" : {\n                \"foo\" : 2.5\n              },\n              \"dateOpt\" : 2.5,\n              \"dateOptList\" : [\n                2.5\n              ],\n              \"dateOptMap\" : {\n                \"foo\" : 2.5\n              },\n              \"dateOptSet\" : [\n                2.5\n              ],\n              \"dateSet\" : [\n                2.5\n              ],\n              \"decimal\" : \"1.5E2\",\n              \"decimalList\" : [\n                \"1.5E2\"\n              ],\n              \"decimalMap\" : {\n                \"foo\" : \"1.5E2\"\n              },\n              \"decimalOpt\" : \"1.5E2\",\n              \"decimalOptList\" : [\n                \"1.5E2\"\n              ],\n              \"decimalOptMap\" : {\n                \"foo\" : \"1.5E2\"\n              },\n              \"decimalOptSet\" : [\n                \"1.5E2\"\n              ],\n              \"decimalSet\" : [\n                \"1.5E2\"\n              ],\n              \"double\" : 2.5,\n              \"doubleList\" : [\n                2.5\n              ],\n              \"doubleMap\" : {\n                \"foo\" : 2.5\n              },\n              \"doubleOpt\" : 2.5,\n              \"doubleOptList\" : [\n                2.5\n              ],\n              \"doubleOptMap\" : {\n                \"foo\" : 2.5\n              },\n              \"doubleOptSet\" : [\n                2.5\n              ],\n              \"doubleSet\" : [\n                2.5\n              ],\n              \"embeddedObjectList\" : [\n                {\n                  \"value\" : 8\n                }\n              ],\n              \"embeddedObjectOpt\" : {\n                \"value\" : 6\n              },\n              \"embeddedObjectOptMap\" : {\n                \"b\" : {\n                  \"value\" : 10\n                }\n              },\n              \"float\" : 2.5,\n              \"floatList\" : [\n                2.5\n              ],\n              \"floatMap\" : {\n                \"foo\" : 2.5\n              },\n              \"floatOpt\" : 2.5,\n              \"floatOptList\" : [\n                2.5\n              ],\n              \"floatOptMap\" : {\n                \"foo\" : 2.5\n              },\n              \"floatOptSet\" : [\n                2.5\n              ],\n              \"floatSet\" : [\n                2.5\n              ],\n              \"int\" : 123,\n              \"int16\" : 123,\n              \"int16List\" : [\n                123\n              ],\n              \"int16Map\" : {\n                \"foo\" : 123\n              },\n              \"int16Opt\" : 123,\n              \"int16OptList\" : [\n                123\n              ],\n              \"int16OptMap\" : {\n                \"foo\" : 123\n              },\n              \"int16OptSet\" : [\n                123\n              ],\n              \"int16Set\" : [\n                123\n              ],\n              \"int32\" : 123,\n              \"int32List\" : [\n                123\n              ],\n              \"int32Map\" : {\n                \"foo\" : 123\n              },\n              \"int32Opt\" : 123,\n              \"int32OptList\" : [\n                123\n              ],\n              \"int32OptMap\" : {\n                \"foo\" : 123\n              },\n              \"int32OptSet\" : [\n                123\n              ],\n              \"int32Set\" : [\n                123\n              ],\n              \"int64\" : 123,\n              \"int64List\" : [\n                123\n              ],\n              \"int64Map\" : {\n                \"foo\" : 123\n              },\n              \"int64Opt\" : 123,\n              \"int64OptList\" : [\n                123\n              ],\n              \"int64OptMap\" : {\n                \"foo\" : 123\n              },\n              \"int64OptSet\" : [\n                123\n              ],\n              \"int64Set\" : [\n                123\n              ],\n              \"int8\" : 123,\n              \"int8List\" : [\n                123\n              ],\n              \"int8Map\" : {\n                \"foo\" : 123\n              },\n              \"int8Opt\" : 123,\n              \"int8OptList\" : [\n                123\n              ],\n              \"int8OptMap\" : {\n                \"foo\" : 123\n              },\n              \"int8OptSet\" : [\n                123\n              ],\n              \"int8Set\" : [\n                123\n              ],\n              \"intList\" : [\n                123\n              ],\n              \"intMap\" : {\n                \"foo\" : 123\n              },\n              \"intOpt\" : 123,\n              \"intOptList\" : [\n                123\n              ],\n              \"intOptMap\" : {\n                \"foo\" : 123\n              },\n              \"intOptSet\" : [\n                123\n              ],\n              \"intSet\" : [\n                123\n              ],\n              \"objectId\" : \"1234567890abcdef12345678\",\n              \"objectIdList\" : [\n                \"1234567890abcdef12345678\"\n              ],\n              \"objectIdMap\" : {\n                \"foo\" : \"1234567890abcdef12345678\"\n              },\n              \"objectIdOpt\" : \"1234567890abcdef12345678\",\n              \"objectIdOptList\" : [\n                \"1234567890abcdef12345678\"\n              ],\n              \"objectIdOptMap\" : {\n                \"foo\" : \"1234567890abcdef12345678\"\n              },\n              \"objectIdOptSet\" : [\n                \"1234567890abcdef12345678\"\n              ],\n              \"objectIdSet\" : [\n                \"1234567890abcdef12345678\"\n              ],\n              \"objectList\" : [\n                {\n                  \"value\" : 7\n                }\n              ],\n              \"objectOpt\" : {\n                \"value\" : 5\n              },\n              \"objectOptMap\" : {\n                \"a\" : {\n                  \"value\" : 9\n                }\n              },\n              \"objectSet\" : [\n                {\n                  \"value\" : 9\n                }\n              ],\n              \"string\" : \"abc\",\n              \"stringList\" : [\n                \"abc\"\n              ],\n              \"stringMap\" : {\n                \"foo\" : \"abc\"\n              },\n              \"stringOpt\" : \"abc\",\n              \"stringOptList\" : [\n                \"abc\"\n              ],\n              \"stringOptMap\" : {\n                \"foo\" : \"abc\"\n              },\n              \"stringOptSet\" : [\n                \"abc\"\n              ],\n              \"stringSet\" : [\n                \"abc\"\n              ],\n              \"uuid\" : \"00000000-0000-0000-0000-000000000000\",\n              \"uuidList\" : [\n                \"00000000-0000-0000-0000-000000000000\"\n              ],\n              \"uuidMap\" : {\n                \"foo\" : \"00000000-0000-0000-0000-000000000000\"\n              },\n              \"uuidOpt\" : \"00000000-0000-0000-0000-000000000000\",\n              \"uuidOptList\" : [\n                \"00000000-0000-0000-0000-000000000000\"\n              ],\n              \"uuidOptMap\" : {\n                \"foo\" : \"00000000-0000-0000-0000-000000000000\"\n              },\n              \"uuidOptSet\" : [\n                \"00000000-0000-0000-0000-000000000000\"\n              ],\n              \"uuidSet\" : [\n                \"00000000-0000-0000-0000-000000000000\"\n              ]\n            }\n            \"\"\"\n        } else {\n            \"\"\"\n            {\n              \"bool\" : true,\n              \"boolList\" : [\n                true\n              ],\n              \"boolMap\" : {\n                \"foo\" : true\n              },\n              \"boolOpt\" : true,\n              \"boolOptList\" : [\n                true\n              ],\n              \"boolOptMap\" : {\n                \"foo\" : true\n              },\n              \"boolOptSet\" : [\n                true\n              ],\n              \"boolSet\" : [\n                true\n              ],\n              \"data\" : \"ZGVm\",\n              \"dataList\" : [\n                \"ZGVm\"\n              ],\n              \"dataMap\" : {\n                \"foo\" : \"ZGVm\"\n              },\n              \"dataOpt\" : \"ZGVm\",\n              \"dataOptList\" : [\n                \"ZGVm\"\n              ],\n              \"dataOptMap\" : {\n                \"foo\" : \"ZGVm\"\n              },\n              \"dataOptSet\" : [\n                \"ZGVm\"\n              ],\n              \"dataSet\" : [\n                \"ZGVm\"\n              ],\n              \"date\" : 2.5,\n              \"dateList\" : [\n                2.5\n              ],\n              \"dateMap\" : {\n                \"foo\" : 2.5\n              },\n              \"dateOpt\" : 2.5,\n              \"dateOptList\" : [\n                2.5\n              ],\n              \"dateOptMap\" : {\n                \"foo\" : 2.5\n              },\n              \"dateOptSet\" : [\n                2.5\n              ],\n              \"dateSet\" : [\n                2.5\n              ],\n              \"decimal\" : \"1.5E2\",\n              \"decimalList\" : [\n                \"1.5E2\"\n              ],\n              \"decimalMap\" : {\n                \"foo\" : \"1.5E2\"\n              },\n              \"decimalOpt\" : \"1.5E2\",\n              \"decimalOptList\" : [\n                \"1.5E2\"\n              ],\n              \"decimalOptMap\" : {\n                \"foo\" : \"1.5E2\"\n              },\n              \"decimalOptSet\" : [\n                \"1.5E2\"\n              ],\n              \"decimalSet\" : [\n                \"1.5E2\"\n              ],\n              \"double\" : 2.5,\n              \"doubleList\" : [\n                2.5\n              ],\n              \"doubleMap\" : {\n                \"foo\" : 2.5\n              },\n              \"doubleOpt\" : 2.5,\n              \"doubleOptList\" : [\n                2.5\n              ],\n              \"doubleOptMap\" : {\n                \"foo\" : 2.5\n              },\n              \"doubleOptSet\" : [\n                2.5\n              ],\n              \"doubleSet\" : [\n                2.5\n              ],\n              \"embeddedObjectList\" : [\n                {\n                  \"value\" : 8\n                }\n              ],\n              \"embeddedObjectOpt\" : {\n                \"value\" : 6\n              },\n              \"embeddedObjectOptMap\" : {\n                \"b\" : {\n                  \"value\" : 10\n                }\n              },\n              \"float\" : 2.5,\n              \"floatList\" : [\n                2.5\n              ],\n              \"floatMap\" : {\n                \"foo\" : 2.5\n              },\n              \"floatOpt\" : 2.5,\n              \"floatOptList\" : [\n                2.5\n              ],\n              \"floatOptMap\" : {\n                \"foo\" : 2.5\n              },\n              \"floatOptSet\" : [\n                2.5\n              ],\n              \"floatSet\" : [\n                2.5\n              ],\n              \"int\" : 123,\n              \"int8\" : 123,\n              \"int8List\" : [\n                123\n              ],\n              \"int8Map\" : {\n                \"foo\" : 123\n              },\n              \"int8Opt\" : 123,\n              \"int8OptList\" : [\n                123\n              ],\n              \"int8OptMap\" : {\n                \"foo\" : 123\n              },\n              \"int8OptSet\" : [\n                123\n              ],\n              \"int8Set\" : [\n                123\n              ],\n              \"int16\" : 123,\n              \"int16List\" : [\n                123\n              ],\n              \"int16Map\" : {\n                \"foo\" : 123\n              },\n              \"int16Opt\" : 123,\n              \"int16OptList\" : [\n                123\n              ],\n              \"int16OptMap\" : {\n                \"foo\" : 123\n              },\n              \"int16OptSet\" : [\n                123\n              ],\n              \"int16Set\" : [\n                123\n              ],\n              \"int32\" : 123,\n              \"int32List\" : [\n                123\n              ],\n              \"int32Map\" : {\n                \"foo\" : 123\n              },\n              \"int32Opt\" : 123,\n              \"int32OptList\" : [\n                123\n              ],\n              \"int32OptMap\" : {\n                \"foo\" : 123\n              },\n              \"int32OptSet\" : [\n                123\n              ],\n              \"int32Set\" : [\n                123\n              ],\n              \"int64\" : 123,\n              \"int64List\" : [\n                123\n              ],\n              \"int64Map\" : {\n                \"foo\" : 123\n              },\n              \"int64Opt\" : 123,\n              \"int64OptList\" : [\n                123\n              ],\n              \"int64OptMap\" : {\n                \"foo\" : 123\n              },\n              \"int64OptSet\" : [\n                123\n              ],\n              \"int64Set\" : [\n                123\n              ],\n              \"intList\" : [\n                123\n              ],\n              \"intMap\" : {\n                \"foo\" : 123\n              },\n              \"intOpt\" : 123,\n              \"intOptList\" : [\n                123\n              ],\n              \"intOptMap\" : {\n                \"foo\" : 123\n              },\n              \"intOptSet\" : [\n                123\n              ],\n              \"intSet\" : [\n                123\n              ],\n              \"objectId\" : \"1234567890abcdef12345678\",\n              \"objectIdList\" : [\n                \"1234567890abcdef12345678\"\n              ],\n              \"objectIdMap\" : {\n                \"foo\" : \"1234567890abcdef12345678\"\n              },\n              \"objectIdOpt\" : \"1234567890abcdef12345678\",\n              \"objectIdOptList\" : [\n                \"1234567890abcdef12345678\"\n              ],\n              \"objectIdOptMap\" : {\n                \"foo\" : \"1234567890abcdef12345678\"\n              },\n              \"objectIdOptSet\" : [\n                \"1234567890abcdef12345678\"\n              ],\n              \"objectIdSet\" : [\n                \"1234567890abcdef12345678\"\n              ],\n              \"objectList\" : [\n                {\n                  \"value\" : 7\n                }\n              ],\n              \"objectOpt\" : {\n                \"value\" : 5\n              },\n              \"objectOptMap\" : {\n                \"a\" : {\n                  \"value\" : 9\n                }\n              },\n              \"objectSet\" : [\n                {\n                  \"value\" : 9\n                }\n              ],\n              \"string\" : \"abc\",\n              \"stringList\" : [\n                \"abc\"\n              ],\n              \"stringMap\" : {\n                \"foo\" : \"abc\"\n              },\n              \"stringOpt\" : \"abc\",\n              \"stringOptList\" : [\n                \"abc\"\n              ],\n              \"stringOptMap\" : {\n                \"foo\" : \"abc\"\n              },\n              \"stringOptSet\" : [\n                \"abc\"\n              ],\n              \"stringSet\" : [\n                \"abc\"\n              ],\n              \"uuid\" : \"00000000-0000-0000-0000-000000000000\",\n              \"uuidList\" : [\n                \"00000000-0000-0000-0000-000000000000\"\n              ],\n              \"uuidMap\" : {\n                \"foo\" : \"00000000-0000-0000-0000-000000000000\"\n              },\n              \"uuidOpt\" : \"00000000-0000-0000-0000-000000000000\",\n              \"uuidOptList\" : [\n                \"00000000-0000-0000-0000-000000000000\"\n              ],\n              \"uuidOptMap\" : {\n                \"foo\" : \"00000000-0000-0000-0000-000000000000\"\n              },\n              \"uuidOptSet\" : [\n                \"00000000-0000-0000-0000-000000000000\"\n              ],\n              \"uuidSet\" : [\n                \"00000000-0000-0000-0000-000000000000\"\n              ]\n            }\n            \"\"\"\n        }\n\n        let decoder = JSONDecoder()\n        let obj = try decoder.decode(ModernCodableObject.self, from: Data(str.utf8))\n\n        XCTAssertEqual(obj.bool, true)\n        XCTAssertEqual(obj.int, 123)\n        XCTAssertEqual(obj.int8, 123)\n        XCTAssertEqual(obj.int16, 123)\n        XCTAssertEqual(obj.int32, 123)\n        XCTAssertEqual(obj.int64, 123)\n        XCTAssertEqual(obj.float, 2.5)\n        XCTAssertEqual(obj.double, 2.5)\n        XCTAssertEqual(obj.string, \"abc\")\n        XCTAssertEqual(obj.date, Date(timeIntervalSinceReferenceDate: 2.5))\n        XCTAssertEqual(obj.data, Data(\"def\".utf8))\n        XCTAssertEqual(obj.decimal, \"1.5e2\")\n        XCTAssertEqual(obj.objectId, ObjectId(\"1234567890abcdef12345678\"))\n\n        XCTAssertEqual(obj.boolOpt, true)\n        XCTAssertEqual(obj.intOpt, 123)\n        XCTAssertEqual(obj.int8Opt, 123)\n        XCTAssertEqual(obj.int16Opt, 123)\n        XCTAssertEqual(obj.int32Opt, 123)\n        XCTAssertEqual(obj.int64Opt, 123)\n        XCTAssertEqual(obj.floatOpt, 2.5)\n        XCTAssertEqual(obj.doubleOpt, 2.5)\n        XCTAssertEqual(obj.stringOpt, \"abc\")\n        XCTAssertEqual(obj.dateOpt, Date(timeIntervalSinceReferenceDate: 2.5))\n        XCTAssertEqual(obj.dataOpt, Data(\"def\".utf8))\n        XCTAssertEqual(obj.decimalOpt, \"1.5e2\")\n        XCTAssertEqual(obj.objectIdOpt, ObjectId(\"1234567890abcdef12345678\"))\n\n        XCTAssertEqual(obj.boolList.first, true)\n        XCTAssertEqual(obj.intList.first, 123)\n        XCTAssertEqual(obj.int8List.first, 123)\n        XCTAssertEqual(obj.int16List.first, 123)\n        XCTAssertEqual(obj.int32List.first, 123)\n        XCTAssertEqual(obj.int64List.first, 123)\n        XCTAssertEqual(obj.floatList.first, 2.5)\n        XCTAssertEqual(obj.doubleList.first, 2.5)\n        XCTAssertEqual(obj.stringList.first, \"abc\")\n        XCTAssertEqual(obj.dateList.first, Date(timeIntervalSinceReferenceDate: 2.5))\n        XCTAssertEqual(obj.dataList.first, Data(\"def\".utf8))\n        XCTAssertEqual(obj.decimalList.first, \"1.5e2\")\n        XCTAssertEqual(obj.objectIdList.first, ObjectId(\"1234567890abcdef12345678\"))\n\n        XCTAssertEqual(obj.boolOptList.first, true)\n        XCTAssertEqual(obj.intOptList.first, 123)\n        XCTAssertEqual(obj.int8OptList.first, 123)\n        XCTAssertEqual(obj.int16OptList.first, 123)\n        XCTAssertEqual(obj.int32OptList.first, 123)\n        XCTAssertEqual(obj.int64OptList.first, 123)\n        XCTAssertEqual(obj.floatOptList.first, 2.5)\n        XCTAssertEqual(obj.doubleOptList.first, 2.5)\n        XCTAssertEqual(obj.stringOptList.first, \"abc\")\n        XCTAssertEqual(obj.dateOptList.first, Date(timeIntervalSinceReferenceDate: 2.5))\n        XCTAssertEqual(obj.dataOptList.first, Data(\"def\".utf8))\n        XCTAssertEqual(obj.decimalOptList.first, \"1.5e2\")\n        XCTAssertEqual(obj.objectIdOptList.first, ObjectId(\"1234567890abcdef12345678\"))\n\n        XCTAssertEqual(obj.boolSet.first, true)\n        XCTAssertEqual(obj.intSet.first, 123)\n        XCTAssertEqual(obj.int8Set.first, 123)\n        XCTAssertEqual(obj.int16Set.first, 123)\n        XCTAssertEqual(obj.int32Set.first, 123)\n        XCTAssertEqual(obj.int64Set.first, 123)\n        XCTAssertEqual(obj.floatSet.first, 2.5)\n        XCTAssertEqual(obj.doubleSet.first, 2.5)\n        XCTAssertEqual(obj.stringSet.first, \"abc\")\n        XCTAssertEqual(obj.dateSet.first, Date(timeIntervalSinceReferenceDate: 2.5))\n        XCTAssertEqual(obj.dataSet.first, Data(\"def\".utf8))\n        XCTAssertEqual(obj.decimalSet.first, \"1.5e2\")\n        XCTAssertEqual(obj.objectIdSet.first, ObjectId(\"1234567890abcdef12345678\"))\n\n        XCTAssertEqual(obj.boolOptSet.first, true)\n        XCTAssertEqual(obj.intOptSet.first, 123)\n        XCTAssertEqual(obj.int8OptSet.first, 123)\n        XCTAssertEqual(obj.int16OptSet.first, 123)\n        XCTAssertEqual(obj.int32OptSet.first, 123)\n        XCTAssertEqual(obj.int64OptSet.first, 123)\n        XCTAssertEqual(obj.floatOptSet.first, 2.5)\n        XCTAssertEqual(obj.doubleOptSet.first, 2.5)\n        XCTAssertEqual(obj.stringOptSet.first, \"abc\")\n        XCTAssertEqual(obj.dateOptSet.first, Date(timeIntervalSinceReferenceDate: 2.5))\n        XCTAssertEqual(obj.dataOptSet.first, Data(\"def\".utf8))\n        XCTAssertEqual(obj.decimalOptSet.first, \"1.5e2\")\n        XCTAssertEqual(obj.objectIdOptSet.first, ObjectId(\"1234567890abcdef12345678\"))\n\n        XCTAssertEqual(obj.boolMap[\"foo\"], true)\n        XCTAssertEqual(obj.intMap[\"foo\"], 123)\n        XCTAssertEqual(obj.int8Map[\"foo\"], 123)\n        XCTAssertEqual(obj.int16Map[\"foo\"], 123)\n        XCTAssertEqual(obj.int32Map[\"foo\"], 123)\n        XCTAssertEqual(obj.int64Map[\"foo\"], 123)\n        XCTAssertEqual(obj.floatMap[\"foo\"], 2.5)\n        XCTAssertEqual(obj.doubleMap[\"foo\"], 2.5)\n        XCTAssertEqual(obj.stringMap[\"foo\"], \"abc\")\n        XCTAssertEqual(obj.dateMap[\"foo\"], Date(timeIntervalSinceReferenceDate: 2.5))\n        XCTAssertEqual(obj.dataMap[\"foo\"], Data(\"def\".utf8))\n        XCTAssertEqual(obj.decimalMap[\"foo\"], \"1.5e2\")\n        XCTAssertEqual(obj.objectIdMap[\"foo\"], ObjectId(\"1234567890abcdef12345678\"))\n\n        XCTAssertEqual(obj.boolOptMap[\"foo\"], true)\n        XCTAssertEqual(obj.intOptMap[\"foo\"], 123)\n        XCTAssertEqual(obj.int8OptMap[\"foo\"], 123)\n        XCTAssertEqual(obj.int16OptMap[\"foo\"], 123)\n        XCTAssertEqual(obj.int32OptMap[\"foo\"], 123)\n        XCTAssertEqual(obj.int64OptMap[\"foo\"], 123)\n        XCTAssertEqual(obj.floatOptMap[\"foo\"], 2.5)\n        XCTAssertEqual(obj.doubleOptMap[\"foo\"], 2.5)\n        XCTAssertEqual(obj.stringOptMap[\"foo\"], \"abc\")\n        XCTAssertEqual(obj.dateOptMap[\"foo\"], Date(timeIntervalSinceReferenceDate: 2.5))\n        XCTAssertEqual(obj.dataOptMap[\"foo\"], Data(\"def\".utf8))\n        XCTAssertEqual(obj.decimalOptMap[\"foo\"], \"1.5e2\")\n        XCTAssertEqual(obj.objectIdOptMap[\"foo\"], ObjectId(\"1234567890abcdef12345678\"))\n\n        XCTAssertEqual(obj.objectOpt?.value, 5)\n        XCTAssertEqual(obj.embeddedObjectOpt?.value, 6)\n        XCTAssertEqual(obj.objectList.first?.value, 7)\n        XCTAssertEqual(obj.embeddedObjectList.first?.value, 8)\n        XCTAssertEqual(obj.objectSet.first?.value, 9)\n        XCTAssertEqual(obj.objectOptMap[\"a\"]??.value, 9)\n        XCTAssertEqual(obj.embeddedObjectOptMap[\"b\"]??.value, 10)\n\n        // Verify that it encodes to exactly the original string (which requires\n        // that the original string be formatted how JSONEncoder formats things)\n        encoder.outputFormatting = [.prettyPrinted, .sortedKeys]\n        let actual = try XCTUnwrap(String(data: encoder.encode(obj), encoding: .utf8))\n        XCTAssertEqual(str, actual)\n\n        let realm = try! Realm()\n        try! realm.write {\n            realm.add(obj)\n        }\n\n        XCTAssertThrowsError(try encoder.encode(obj))\n    }\n\n    func testModernObjectNil() throws {\n        // Note: \"ZGVm\" is Data(\"def\".utf8).base64EncodedString()\n        // This string needs to exactly match what JSONEncoder produces so that\n        // we can validate round-tripping\n        let str = if #available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, *) {\n            \"\"\"\n            {\n              \"bool\" : true,\n              \"boolList\" : [\n                true\n              ],\n              \"boolMap\" : {\n                \"foo\" : true\n              },\n              \"boolOpt\" : null,\n              \"boolOptList\" : [\n                null\n              ],\n              \"boolOptMap\" : {\n                \"foo\" : null\n              },\n              \"boolOptSet\" : [\n                null\n              ],\n              \"boolSet\" : [\n                true\n              ],\n              \"data\" : \"ZGVm\",\n              \"dataList\" : [\n                \"ZGVm\"\n              ],\n              \"dataMap\" : {\n                \"foo\" : \"ZGVm\"\n              },\n              \"dataOpt\" : null,\n              \"dataOptList\" : [\n                null\n              ],\n              \"dataOptMap\" : {\n                \"foo\" : null\n              },\n              \"dataOptSet\" : [\n                null\n              ],\n              \"dataSet\" : [\n                \"ZGVm\"\n              ],\n              \"date\" : 2.5,\n              \"dateList\" : [\n                2.5\n              ],\n              \"dateMap\" : {\n                \"foo\" : 2.5\n              },\n              \"dateOpt\" : null,\n              \"dateOptList\" : [\n                null\n              ],\n              \"dateOptMap\" : {\n                \"foo\" : null\n              },\n              \"dateOptSet\" : [\n                null\n              ],\n              \"dateSet\" : [\n                2.5\n              ],\n              \"decimal\" : \"1.5E2\",\n              \"decimalList\" : [\n                \"1.5E2\"\n              ],\n              \"decimalMap\" : {\n                \"foo\" : \"1.5E2\"\n              },\n              \"decimalOpt\" : null,\n              \"decimalOptList\" : [\n                null\n              ],\n              \"decimalOptMap\" : {\n                \"foo\" : null\n              },\n              \"decimalOptSet\" : [\n                null\n              ],\n              \"decimalSet\" : [\n                \"1.5E2\"\n              ],\n              \"double\" : 2.5,\n              \"doubleList\" : [\n                2.5\n              ],\n              \"doubleMap\" : {\n                \"foo\" : 2.5\n              },\n              \"doubleOpt\" : null,\n              \"doubleOptList\" : [\n                null\n              ],\n              \"doubleOptMap\" : {\n                \"foo\" : null\n              },\n              \"doubleOptSet\" : [\n                null\n              ],\n              \"doubleSet\" : [\n                2.5\n              ],\n              \"embeddedObjectList\" : [\n\n              ],\n              \"embeddedObjectOpt\" : null,\n              \"embeddedObjectOptMap\" : {\n                \"foo\" : null\n              },\n              \"float\" : 2.5,\n              \"floatList\" : [\n                2.5\n              ],\n              \"floatMap\" : {\n                \"foo\" : 2.5\n              },\n              \"floatOpt\" : null,\n              \"floatOptList\" : [\n                null\n              ],\n              \"floatOptMap\" : {\n                \"foo\" : null\n              },\n              \"floatOptSet\" : [\n                null\n              ],\n              \"floatSet\" : [\n                2.5\n              ],\n              \"int\" : 123,\n              \"int16\" : 123,\n              \"int16List\" : [\n                123\n              ],\n              \"int16Map\" : {\n                \"foo\" : 123\n              },\n              \"int16Opt\" : null,\n              \"int16OptList\" : [\n                null\n              ],\n              \"int16OptMap\" : {\n                \"foo\" : null\n              },\n              \"int16OptSet\" : [\n                null\n              ],\n              \"int16Set\" : [\n                123\n              ],\n              \"int32\" : 123,\n              \"int32List\" : [\n                123\n              ],\n              \"int32Map\" : {\n                \"foo\" : 123\n              },\n              \"int32Opt\" : null,\n              \"int32OptList\" : [\n                null\n              ],\n              \"int32OptMap\" : {\n                \"foo\" : null\n              },\n              \"int32OptSet\" : [\n                null\n              ],\n              \"int32Set\" : [\n                123\n              ],\n              \"int64\" : 123,\n              \"int64List\" : [\n                123\n              ],\n              \"int64Map\" : {\n                \"foo\" : 123\n              },\n              \"int64Opt\" : null,\n              \"int64OptList\" : [\n                null\n              ],\n              \"int64OptMap\" : {\n                \"foo\" : null\n              },\n              \"int64OptSet\" : [\n                null\n              ],\n              \"int64Set\" : [\n                123\n              ],\n              \"int8\" : 123,\n              \"int8List\" : [\n                123\n              ],\n              \"int8Map\" : {\n                \"foo\" : 123\n              },\n              \"int8Opt\" : null,\n              \"int8OptList\" : [\n                null\n              ],\n              \"int8OptMap\" : {\n                \"foo\" : null\n              },\n              \"int8OptSet\" : [\n                null\n              ],\n              \"int8Set\" : [\n                123\n              ],\n              \"intList\" : [\n                123\n              ],\n              \"intMap\" : {\n                \"foo\" : 123\n              },\n              \"intOpt\" : null,\n              \"intOptList\" : [\n                null\n              ],\n              \"intOptMap\" : {\n                \"foo\" : null\n              },\n              \"intOptSet\" : [\n                null\n              ],\n              \"intSet\" : [\n                123\n              ],\n              \"objectId\" : \"1234567890abcdef12345678\",\n              \"objectIdList\" : [\n                \"1234567890abcdef12345678\"\n              ],\n              \"objectIdMap\" : {\n                \"foo\" : \"1234567890abcdef12345678\"\n              },\n              \"objectIdOpt\" : null,\n              \"objectIdOptList\" : [\n                null\n              ],\n              \"objectIdOptMap\" : {\n                \"foo\" : null\n              },\n              \"objectIdOptSet\" : [\n                null\n              ],\n              \"objectIdSet\" : [\n                \"1234567890abcdef12345678\"\n              ],\n              \"objectList\" : [\n\n              ],\n              \"objectOpt\" : null,\n              \"objectOptMap\" : {\n                \"foo\" : null\n              },\n              \"objectSet\" : [\n\n              ],\n              \"string\" : \"abc\",\n              \"stringList\" : [\n                \"abc\"\n              ],\n              \"stringMap\" : {\n                \"foo\" : \"abc\"\n              },\n              \"stringOpt\" : null,\n              \"stringOptList\" : [\n                null\n              ],\n              \"stringOptMap\" : {\n                \"foo\" : null\n              },\n              \"stringOptSet\" : [\n                null\n              ],\n              \"stringSet\" : [\n                \"abc\"\n              ],\n              \"uuid\" : \"00000000-0000-0000-0000-000000000000\",\n              \"uuidList\" : [\n                \"00000000-0000-0000-0000-000000000000\"\n              ],\n              \"uuidMap\" : {\n                \"foo\" : \"00000000-0000-0000-0000-000000000000\"\n              },\n              \"uuidOpt\" : null,\n              \"uuidOptList\" : [\n                null\n              ],\n              \"uuidOptMap\" : {\n                \"foo\" : null\n              },\n              \"uuidOptSet\" : [\n                null\n              ],\n              \"uuidSet\" : [\n                \"00000000-0000-0000-0000-000000000000\"\n              ]\n            }\n            \"\"\"\n        } else {\n            \"\"\"\n            {\n              \"bool\" : true,\n              \"boolList\" : [\n                true\n              ],\n              \"boolMap\" : {\n                \"foo\" : true\n              },\n              \"boolOpt\" : null,\n              \"boolOptList\" : [\n                null\n              ],\n              \"boolOptMap\" : {\n                \"foo\" : null\n              },\n              \"boolOptSet\" : [\n                null\n              ],\n              \"boolSet\" : [\n                true\n              ],\n              \"data\" : \"ZGVm\",\n              \"dataList\" : [\n                \"ZGVm\"\n              ],\n              \"dataMap\" : {\n                \"foo\" : \"ZGVm\"\n              },\n              \"dataOpt\" : null,\n              \"dataOptList\" : [\n                null\n              ],\n              \"dataOptMap\" : {\n                \"foo\" : null\n              },\n              \"dataOptSet\" : [\n                null\n              ],\n              \"dataSet\" : [\n                \"ZGVm\"\n              ],\n              \"date\" : 2.5,\n              \"dateList\" : [\n                2.5\n              ],\n              \"dateMap\" : {\n                \"foo\" : 2.5\n              },\n              \"dateOpt\" : null,\n              \"dateOptList\" : [\n                null\n              ],\n              \"dateOptMap\" : {\n                \"foo\" : null\n              },\n              \"dateOptSet\" : [\n                null\n              ],\n              \"dateSet\" : [\n                2.5\n              ],\n              \"decimal\" : \"1.5E2\",\n              \"decimalList\" : [\n                \"1.5E2\"\n              ],\n              \"decimalMap\" : {\n                \"foo\" : \"1.5E2\"\n              },\n              \"decimalOpt\" : null,\n              \"decimalOptList\" : [\n                null\n              ],\n              \"decimalOptMap\" : {\n                \"foo\" : null\n              },\n              \"decimalOptSet\" : [\n                null\n              ],\n              \"decimalSet\" : [\n                \"1.5E2\"\n              ],\n              \"double\" : 2.5,\n              \"doubleList\" : [\n                2.5\n              ],\n              \"doubleMap\" : {\n                \"foo\" : 2.5\n              },\n              \"doubleOpt\" : null,\n              \"doubleOptList\" : [\n                null\n              ],\n              \"doubleOptMap\" : {\n                \"foo\" : null\n              },\n              \"doubleOptSet\" : [\n                null\n              ],\n              \"doubleSet\" : [\n                2.5\n              ],\n              \"embeddedObjectList\" : [\n\n              ],\n              \"embeddedObjectOpt\" : null,\n              \"embeddedObjectOptMap\" : {\n                \"foo\" : null\n              },\n              \"float\" : 2.5,\n              \"floatList\" : [\n                2.5\n              ],\n              \"floatMap\" : {\n                \"foo\" : 2.5\n              },\n              \"floatOpt\" : null,\n              \"floatOptList\" : [\n                null\n              ],\n              \"floatOptMap\" : {\n                \"foo\" : null\n              },\n              \"floatOptSet\" : [\n                null\n              ],\n              \"floatSet\" : [\n                2.5\n              ],\n              \"int\" : 123,\n              \"int8\" : 123,\n              \"int8List\" : [\n                123\n              ],\n              \"int8Map\" : {\n                \"foo\" : 123\n              },\n              \"int8Opt\" : null,\n              \"int8OptList\" : [\n                null\n              ],\n              \"int8OptMap\" : {\n                \"foo\" : null\n              },\n              \"int8OptSet\" : [\n                null\n              ],\n              \"int8Set\" : [\n                123\n              ],\n              \"int16\" : 123,\n              \"int16List\" : [\n                123\n              ],\n              \"int16Map\" : {\n                \"foo\" : 123\n              },\n              \"int16Opt\" : null,\n              \"int16OptList\" : [\n                null\n              ],\n              \"int16OptMap\" : {\n                \"foo\" : null\n              },\n              \"int16OptSet\" : [\n                null\n              ],\n              \"int16Set\" : [\n                123\n              ],\n              \"int32\" : 123,\n              \"int32List\" : [\n                123\n              ],\n              \"int32Map\" : {\n                \"foo\" : 123\n              },\n              \"int32Opt\" : null,\n              \"int32OptList\" : [\n                null\n              ],\n              \"int32OptMap\" : {\n                \"foo\" : null\n              },\n              \"int32OptSet\" : [\n                null\n              ],\n              \"int32Set\" : [\n                123\n              ],\n              \"int64\" : 123,\n              \"int64List\" : [\n                123\n              ],\n              \"int64Map\" : {\n                \"foo\" : 123\n              },\n              \"int64Opt\" : null,\n              \"int64OptList\" : [\n                null\n              ],\n              \"int64OptMap\" : {\n                \"foo\" : null\n              },\n              \"int64OptSet\" : [\n                null\n              ],\n              \"int64Set\" : [\n                123\n              ],\n              \"intList\" : [\n                123\n              ],\n              \"intMap\" : {\n                \"foo\" : 123\n              },\n              \"intOpt\" : null,\n              \"intOptList\" : [\n                null\n              ],\n              \"intOptMap\" : {\n                \"foo\" : null\n              },\n              \"intOptSet\" : [\n                null\n              ],\n              \"intSet\" : [\n                123\n              ],\n              \"objectId\" : \"1234567890abcdef12345678\",\n              \"objectIdList\" : [\n                \"1234567890abcdef12345678\"\n              ],\n              \"objectIdMap\" : {\n                \"foo\" : \"1234567890abcdef12345678\"\n              },\n              \"objectIdOpt\" : null,\n              \"objectIdOptList\" : [\n                null\n              ],\n              \"objectIdOptMap\" : {\n                \"foo\" : null\n              },\n              \"objectIdOptSet\" : [\n                null\n              ],\n              \"objectIdSet\" : [\n                \"1234567890abcdef12345678\"\n              ],\n              \"objectList\" : [\n\n              ],\n              \"objectOpt\" : null,\n              \"objectOptMap\" : {\n                \"foo\" : null\n              },\n              \"objectSet\" : [\n\n              ],\n              \"string\" : \"abc\",\n              \"stringList\" : [\n                \"abc\"\n              ],\n              \"stringMap\" : {\n                \"foo\" : \"abc\"\n              },\n              \"stringOpt\" : null,\n              \"stringOptList\" : [\n                null\n              ],\n              \"stringOptMap\" : {\n                \"foo\" : null\n              },\n              \"stringOptSet\" : [\n                null\n              ],\n              \"stringSet\" : [\n                \"abc\"\n              ],\n              \"uuid\" : \"00000000-0000-0000-0000-000000000000\",\n              \"uuidList\" : [\n                \"00000000-0000-0000-0000-000000000000\"\n              ],\n              \"uuidMap\" : {\n                \"foo\" : \"00000000-0000-0000-0000-000000000000\"\n              },\n              \"uuidOpt\" : null,\n              \"uuidOptList\" : [\n                null\n              ],\n              \"uuidOptMap\" : {\n                \"foo\" : null\n              },\n              \"uuidOptSet\" : [\n                null\n              ],\n              \"uuidSet\" : [\n                \"00000000-0000-0000-0000-000000000000\"\n              ]\n            }\n            \"\"\"\n        }\n        let decoder = JSONDecoder()\n        let obj = try decoder.decode(ModernCodableObject.self, from: Data(str.utf8))\n\n        XCTAssertNil(obj.boolOpt)\n        XCTAssertNil(obj.intOpt)\n        XCTAssertNil(obj.int8Opt)\n        XCTAssertNil(obj.int16Opt)\n        XCTAssertNil(obj.int32Opt)\n        XCTAssertNil(obj.int64Opt)\n        XCTAssertNil(obj.floatOpt)\n        XCTAssertNil(obj.doubleOpt)\n        XCTAssertNil(obj.stringOpt)\n        XCTAssertNil(obj.dateOpt)\n        XCTAssertNil(obj.dataOpt)\n        XCTAssertNil(obj.decimalOpt)\n        XCTAssertNil(obj.objectIdOpt)\n\n        XCTAssertNil(obj.boolOptList.first!)\n        XCTAssertNil(obj.intOptList.first!)\n        XCTAssertNil(obj.int8OptList.first!)\n        XCTAssertNil(obj.int16OptList.first!)\n        XCTAssertNil(obj.int32OptList.first!)\n        XCTAssertNil(obj.int64OptList.first!)\n        XCTAssertNil(obj.floatOptList.first!)\n        XCTAssertNil(obj.doubleOptList.first!)\n        XCTAssertNil(obj.stringOptList.first!)\n        XCTAssertNil(obj.dateOptList.first!)\n        XCTAssertNil(obj.dataOptList.first!)\n        XCTAssertNil(obj.decimalOptList.first!)\n        XCTAssertNil(obj.objectIdOptList.first!)\n\n        XCTAssertNil(obj.boolOptSet.first!)\n        XCTAssertNil(obj.intOptSet.first!)\n        XCTAssertNil(obj.int8OptSet.first!)\n        XCTAssertNil(obj.int16OptSet.first!)\n        XCTAssertNil(obj.int32OptSet.first!)\n        XCTAssertNil(obj.int64OptSet.first!)\n        XCTAssertNil(obj.floatOptSet.first!)\n        XCTAssertNil(obj.doubleOptSet.first!)\n        XCTAssertNil(obj.stringOptSet.first!)\n        XCTAssertNil(obj.dateOptSet.first!)\n        XCTAssertNil(obj.dataOptSet.first!)\n        XCTAssertNil(obj.decimalOptSet.first!)\n        XCTAssertNil(obj.objectIdOptSet.first!)\n\n        XCTAssertNil(obj.boolOptMap[\"foo\"]!)\n        XCTAssertNil(obj.intOptMap[\"foo\"]!)\n        XCTAssertNil(obj.int8OptMap[\"foo\"]!)\n        XCTAssertNil(obj.int16OptMap[\"foo\"]!)\n        XCTAssertNil(obj.int32OptMap[\"foo\"]!)\n        XCTAssertNil(obj.int64OptMap[\"foo\"]!)\n        XCTAssertNil(obj.floatOptMap[\"foo\"]!)\n        XCTAssertNil(obj.doubleOptMap[\"foo\"]!)\n        XCTAssertNil(obj.stringOptMap[\"foo\"]!)\n        XCTAssertNil(obj.dateOptMap[\"foo\"]!)\n        XCTAssertNil(obj.dataOptMap[\"foo\"]!)\n        XCTAssertNil(obj.decimalOptMap[\"foo\"]!)\n        XCTAssertNil(obj.objectIdOptMap[\"foo\"]!)\n\n        XCTAssertNil(obj.objectOptMap[\"foo\"]!)\n        XCTAssertNil(obj.embeddedObjectOptMap[\"foo\"]!)\n\n        // Verify that it encodes to exactly the original string (which requires\n        // that the original string be formatted how JSONEncoder formats things)\n        encoder.outputFormatting = [.prettyPrinted, .sortedKeys]\n        let actual = try String(data: encoder.encode(obj), encoding: .utf8)\n        XCTAssertEqual(str, actual)\n    }\n\n    func testModernObjectOptionalNotRequired() throws {\n        let str = \"\"\"\n        {\n            \"bool\": true,\n            \"string\": \"abc\",\n            \"int\": 123,\n            \"int8\": 123,\n            \"int16\": 123,\n            \"int32\": 123,\n            \"int64\": 123,\n            \"float\": 2.5,\n            \"double\": 2.5,\n            \"date\": 2.5,\n            \"data\": \"\\(Data(\"def\".utf8).base64EncodedString())\",\n            \"decimal\": \"1.5e2\",\n            \"objectId\": \"1234567890abcdef12345678\",\n            \"uuid\": \"00000000-0000-0000-0000-000000000000\",\n\n            \"otherBool\": true,\n            \"otherInt\": 123,\n            \"otherInt8\": 123,\n            \"otherInt16\": 123,\n            \"otherInt32\": 123,\n            \"otherInt64\": 123,\n            \"otherFloat\": 2.5,\n            \"otherDouble\": 2.5,\n            \"otherEnum\": 1,\n\n            \"boolList\": [true],\n            \"stringList\": [\"abc\"],\n            \"intList\": [123],\n            \"int8List\": [123],\n            \"int16List\": [123],\n            \"int32List\": [123],\n            \"int64List\": [123],\n            \"floatList\": [2.5],\n            \"doubleList\": [2.5],\n            \"dateList\": [2.5],\n            \"dataList\": [\"\\(Data(\"def\".utf8).base64EncodedString())\"],\n            \"decimalList\": [\"1.5e2\"],\n            \"objectIdList\": [\"1234567890abcdef12345678\"],\n            \"uuidList\": [\"00000000-0000-0000-0000-000000000000\"],\n            \"objectList\": [],\n            \"embeddedObjectList\": [],\n\n            \"boolOptList\": [null],\n            \"stringOptList\": [null],\n            \"intOptList\": [null],\n            \"int8OptList\": [null],\n            \"int16OptList\": [null],\n            \"int32OptList\": [null],\n            \"int64OptList\": [null],\n            \"floatOptList\": [null],\n            \"doubleOptList\": [null],\n            \"dateOptList\": [null],\n            \"dataOptList\": [null],\n            \"decimalOptList\": [null],\n            \"objectIdOptList\": [null],\n            \"uuidOptList\": [null],\n\n            \"boolSet\": [true],\n            \"stringSet\": [\"abc\"],\n            \"intSet\": [123],\n            \"int8Set\": [123],\n            \"int16Set\": [123],\n            \"int32Set\": [123],\n            \"int64Set\": [123],\n            \"floatSet\": [2.5],\n            \"doubleSet\": [2.5],\n            \"dateSet\": [2.5],\n            \"dataSet\": [\"\\(Data(\"def\".utf8).base64EncodedString())\"],\n            \"decimalSet\": [\"1.5e2\"],\n            \"objectIdSet\": [\"1234567890abcdef12345678\"],\n            \"uuidSet\": [\"00000000-0000-0000-0000-000000000000\"],\n            \"objectSet\": [],\n\n            \"boolOptSet\": [null],\n            \"stringOptSet\": [null],\n            \"intOptSet\": [null],\n            \"int8OptSet\": [null],\n            \"int16OptSet\": [null],\n            \"int32OptSet\": [null],\n            \"int64OptSet\": [null],\n            \"floatOptSet\": [null],\n            \"doubleOptSet\": [null],\n            \"dateOptSet\": [null],\n            \"dataOptSet\": [null],\n            \"decimalOptSet\": [null],\n            \"objectIdOptSet\": [null],\n            \"uuidOptSet\": [null],\n\n            \"boolMap\": {\"foo\": true},\n            \"stringMap\": {\"foo\": \"abc\"},\n            \"intMap\": {\"foo\": 123},\n            \"int8Map\": {\"foo\": 123},\n            \"int16Map\": {\"foo\": 123},\n            \"int32Map\": {\"foo\": 123},\n            \"int64Map\": {\"foo\": 123},\n            \"floatMap\": {\"foo\": 2.5},\n            \"doubleMap\": {\"foo\": 2.5},\n            \"dateMap\": {\"foo\": 2.5},\n            \"dataMap\": {\"foo\": \"\\(Data(\"def\".utf8).base64EncodedString())\"},\n            \"decimalMap\": {\"foo\": \"1.5e2\"},\n            \"objectIdMap\": {\"foo\": \"1234567890abcdef12345678\"},\n            \"uuidMap\": {\"foo\": \"00000000-0000-0000-0000-000000000000\"},\n\n            \"boolOptMap\": {\"foo\": null},\n            \"stringOptMap\": {\"foo\": null},\n            \"intOptMap\": {\"foo\": null},\n            \"int8OptMap\": {\"foo\": null},\n            \"int16OptMap\": {\"foo\": null},\n            \"int32OptMap\": {\"foo\": null},\n            \"int64OptMap\": {\"foo\": null},\n            \"floatOptMap\": {\"foo\": null},\n            \"doubleOptMap\": {\"foo\": null},\n            \"dateOptMap\": {\"foo\": null},\n            \"dataOptMap\": {\"foo\": null},\n            \"decimalOptMap\": {\"foo\": null},\n            \"objectIdOptMap\": {\"foo\": null},\n            \"uuidOptMap\": {\"foo\": null},\n            \"objectOptMap\": {\"foo\": null},\n            \"embeddedObjectOptMap\": {\"foo\": null}\n        }\n        \"\"\"\n        let decoder = JSONDecoder()\n        let obj = try decoder.decode(ModernCodableObject.self, from: Data(str.utf8))\n\n        XCTAssertNil(obj.boolOpt)\n        XCTAssertNil(obj.intOpt)\n        XCTAssertNil(obj.int8Opt)\n        XCTAssertNil(obj.int16Opt)\n        XCTAssertNil(obj.int32Opt)\n        XCTAssertNil(obj.int64Opt)\n        XCTAssertNil(obj.floatOpt)\n        XCTAssertNil(obj.doubleOpt)\n        XCTAssertNil(obj.stringOpt)\n        XCTAssertNil(obj.dateOpt)\n        XCTAssertNil(obj.dataOpt)\n        XCTAssertNil(obj.decimalOpt)\n        XCTAssertNil(obj.objectIdOpt)\n    }\n\n    func testCustomDateEncoding() throws {\n        let encoder = JSONEncoder()\n        encoder.dateEncodingStrategy = .custom { date, encoder in\n            try \"custom: \\(date.timeIntervalSince1970)\".encode(to: encoder)\n        }\n\n        let obj = ModernCodableObject()\n        obj.date = Date(timeIntervalSince1970: 1)\n        obj.dateOpt = Date(timeIntervalSince1970: 2)\n        obj.dateList.append(Date(timeIntervalSince1970: 3))\n        obj.dateOptList.append(Date(timeIntervalSince1970: 4))\n        obj.dateSet.insert(Date(timeIntervalSince1970: 5))\n        obj.dateOptSet.insert(Date(timeIntervalSince1970: 6))\n        obj.dateMap[\"a\"] = Date(timeIntervalSince1970: 7)\n        obj.dateOptMap[\"b\"] = Date(timeIntervalSince1970: 8)\n\n        let encoded = try encoder.encode(obj)\n        let dict = try JSONSerialization.jsonObject(with: encoded, options: []) as! [String: Any]\n        XCTAssertEqual(dict[\"date\"] as! String, \"custom: 1.0\")\n        XCTAssertEqual(dict[\"dateOpt\"] as! String, \"custom: 2.0\")\n        XCTAssertEqual(dict[\"dateList\"] as! [String], [\"custom: 3.0\"])\n        XCTAssertEqual(dict[\"dateOptList\"] as! [String], [\"custom: 4.0\"])\n        XCTAssertEqual(dict[\"dateSet\"] as! [String], [\"custom: 5.0\"])\n        XCTAssertEqual(dict[\"dateOptSet\"] as! [String], [\"custom: 6.0\"])\n        XCTAssertEqual(dict[\"dateMap\"] as! [String: String], [\"a\": \"custom: 7.0\"])\n        XCTAssertEqual(dict[\"dateOptMap\"] as! [String: String], [\"b\": \"custom: 8.0\"])\n    }\n\n    func testCustomDataEncoding() throws {\n        let encoder = JSONEncoder()\n        encoder.dataEncodingStrategy = .custom { data, encoder in\n            try \"length: \\(data.count)\".encode(to: encoder)\n        }\n\n        let obj = ModernCodableObject()\n        obj.data = Data(repeating: 0, count: 1)\n        obj.dataOpt = Data(repeating: 0, count: 2)\n        obj.dataList.append(Data(repeating: 0, count: 3))\n        obj.dataOptList.append(Data(repeating: 0, count: 4))\n        obj.dataSet.insert(Data(repeating: 0, count: 5))\n        obj.dataOptSet.insert(Data(repeating: 0, count: 6))\n        obj.dataMap[\"a\"] = Data(repeating: 0, count: 7)\n        obj.dataOptMap[\"b\"] = Data(repeating: 0, count: 8)\n\n        let encoded = try encoder.encode(obj)\n        let dict = try JSONSerialization.jsonObject(with: encoded, options: []) as! [String: Any]\n        XCTAssertEqual(dict[\"data\"] as! String, \"length: 1\")\n        XCTAssertEqual(dict[\"dataOpt\"] as! String, \"length: 2\")\n        XCTAssertEqual(dict[\"dataList\"] as! [String], [\"length: 3\"])\n        XCTAssertEqual(dict[\"dataOptList\"] as! [String], [\"length: 4\"])\n        XCTAssertEqual(dict[\"dataSet\"] as! [String], [\"length: 5\"])\n        XCTAssertEqual(dict[\"dataOptSet\"] as! [String], [\"length: 6\"])\n        XCTAssertEqual(dict[\"dataMap\"] as! [String: String], [\"a\": \"length: 7\"])\n        XCTAssertEqual(dict[\"dataOptMap\"] as! [String: String], [\"b\": \"length: 8\"])\n    }\n\n    func testKeyEncodingStrategy() throws {\n        encoder.keyEncodingStrategy = .convertToSnakeCase\n        encoder.outputFormatting = [.sortedKeys]\n        let obj = ModernCodableObject()\n        obj.objectId = ObjectId(\"1234567890abcdef12345678\")\n        obj.uuid = UUID(uuidString: \"00000000-0000-0000-0000-000000000000\")!\n        obj.date = Date(timeIntervalSince1970: 0)\n        let actual = try XCTUnwrap(String(data: encoder.encode(obj), encoding: .utf8))\n        // Before the 2024 OS versions, int8 was sorted before int16\n        let expected = if #available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, *) {\n            #\"{\"bool\":false,\"bool_list\":[],\"bool_map\":{},\"bool_opt\":null,\"bool_opt_list\":[],\"bool_opt_map\":{},\"bool_opt_set\":[],\"bool_set\":[],\"data\":\"\",\"data_list\":[],\"data_map\":{},\"data_opt\":null,\"data_opt_list\":[],\"data_opt_map\":{},\"data_opt_set\":[],\"data_set\":[],\"date\":-978307200,\"date_list\":[],\"date_map\":{},\"date_opt\":null,\"date_opt_list\":[],\"date_opt_map\":{},\"date_opt_set\":[],\"date_set\":[],\"decimal\":\"0\",\"decimal_list\":[],\"decimal_map\":{},\"decimal_opt\":null,\"decimal_opt_list\":[],\"decimal_opt_map\":{},\"decimal_opt_set\":[],\"decimal_set\":[],\"double\":0,\"double_list\":[],\"double_map\":{},\"double_opt\":null,\"double_opt_list\":[],\"double_opt_map\":{},\"double_opt_set\":[],\"double_set\":[],\"embedded_object_list\":[],\"embedded_object_opt\":null,\"embedded_object_opt_map\":{},\"float\":0,\"float_list\":[],\"float_map\":{},\"float_opt\":null,\"float_opt_list\":[],\"float_opt_map\":{},\"float_opt_set\":[],\"float_set\":[],\"int\":0,\"int16\":0,\"int16_list\":[],\"int16_map\":{},\"int16_opt\":null,\"int16_opt_list\":[],\"int16_opt_map\":{},\"int16_opt_set\":[],\"int16_set\":[],\"int32\":0,\"int32_list\":[],\"int32_map\":{},\"int32_opt\":null,\"int32_opt_list\":[],\"int32_opt_map\":{},\"int32_opt_set\":[],\"int32_set\":[],\"int64\":0,\"int64_list\":[],\"int64_map\":{},\"int64_opt\":null,\"int64_opt_list\":[],\"int64_opt_map\":{},\"int64_opt_set\":[],\"int64_set\":[],\"int8\":0,\"int8_list\":[],\"int8_map\":{},\"int8_opt\":null,\"int8_opt_list\":[],\"int8_opt_map\":{},\"int8_opt_set\":[],\"int8_set\":[],\"int_list\":[],\"int_map\":{},\"int_opt\":null,\"int_opt_list\":[],\"int_opt_map\":{},\"int_opt_set\":[],\"int_set\":[],\"object_id\":\"1234567890abcdef12345678\",\"object_id_list\":[],\"object_id_map\":{},\"object_id_opt\":null,\"object_id_opt_list\":[],\"object_id_opt_map\":{},\"object_id_opt_set\":[],\"object_id_set\":[],\"object_list\":[],\"object_opt\":null,\"object_opt_map\":{},\"object_set\":[],\"string\":\"\",\"string_list\":[],\"string_map\":{},\"string_opt\":null,\"string_opt_list\":[],\"string_opt_map\":{},\"string_opt_set\":[],\"string_set\":[],\"uuid\":\"00000000-0000-0000-0000-000000000000\",\"uuid_list\":[],\"uuid_map\":{},\"uuid_opt\":null,\"uuid_opt_list\":[],\"uuid_opt_map\":{},\"uuid_opt_set\":[],\"uuid_set\":[]}\"#\n        } else {\n            #\"{\"bool\":false,\"bool_list\":[],\"bool_map\":{},\"bool_opt\":null,\"bool_opt_list\":[],\"bool_opt_map\":{},\"bool_opt_set\":[],\"bool_set\":[],\"data\":\"\",\"data_list\":[],\"data_map\":{},\"data_opt\":null,\"data_opt_list\":[],\"data_opt_map\":{},\"data_opt_set\":[],\"data_set\":[],\"date\":-978307200,\"date_list\":[],\"date_map\":{},\"date_opt\":null,\"date_opt_list\":[],\"date_opt_map\":{},\"date_opt_set\":[],\"date_set\":[],\"decimal\":\"0\",\"decimal_list\":[],\"decimal_map\":{},\"decimal_opt\":null,\"decimal_opt_list\":[],\"decimal_opt_map\":{},\"decimal_opt_set\":[],\"decimal_set\":[],\"double\":0,\"double_list\":[],\"double_map\":{},\"double_opt\":null,\"double_opt_list\":[],\"double_opt_map\":{},\"double_opt_set\":[],\"double_set\":[],\"embedded_object_list\":[],\"embedded_object_opt\":null,\"embedded_object_opt_map\":{},\"float\":0,\"float_list\":[],\"float_map\":{},\"float_opt\":null,\"float_opt_list\":[],\"float_opt_map\":{},\"float_opt_set\":[],\"float_set\":[],\"int\":0,\"int_list\":[],\"int_map\":{},\"int_opt\":null,\"int_opt_list\":[],\"int_opt_map\":{},\"int_opt_set\":[],\"int_set\":[],\"int8\":0,\"int8_list\":[],\"int8_map\":{},\"int8_opt\":null,\"int8_opt_list\":[],\"int8_opt_map\":{},\"int8_opt_set\":[],\"int8_set\":[],\"int16\":0,\"int16_list\":[],\"int16_map\":{},\"int16_opt\":null,\"int16_opt_list\":[],\"int16_opt_map\":{},\"int16_opt_set\":[],\"int16_set\":[],\"int32\":0,\"int32_list\":[],\"int32_map\":{},\"int32_opt\":null,\"int32_opt_list\":[],\"int32_opt_map\":{},\"int32_opt_set\":[],\"int32_set\":[],\"int64\":0,\"int64_list\":[],\"int64_map\":{},\"int64_opt\":null,\"int64_opt_list\":[],\"int64_opt_map\":{},\"int64_opt_set\":[],\"int64_set\":[],\"object_id\":\"1234567890abcdef12345678\",\"object_id_list\":[],\"object_id_map\":{},\"object_id_opt\":null,\"object_id_opt_list\":[],\"object_id_opt_map\":{},\"object_id_opt_set\":[],\"object_id_set\":[],\"object_list\":[],\"object_opt\":null,\"object_opt_map\":{},\"object_set\":[],\"string\":\"\",\"string_list\":[],\"string_map\":{},\"string_opt\":null,\"string_opt_list\":[],\"string_opt_map\":{},\"string_opt_set\":[],\"string_set\":[],\"uuid\":\"00000000-0000-0000-0000-000000000000\",\"uuid_list\":[],\"uuid_map\":{},\"uuid_opt\":null,\"uuid_opt_list\":[],\"uuid_opt_map\":{},\"uuid_opt_set\":[],\"uuid_set\":[]}\"#\n        }\n        XCTAssertEqual(expected, actual)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/CombineTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport Combine\nimport Realm.Private\nimport RealmSwift\n\nclass CombineIdentifiableObject: Object, ObjectKeyIdentifiable {\n    @objc dynamic var value = 0\n    @objc dynamic var child: CombineIdentifiableEmbeddedObject?\n}\nclass CombineIdentifiableEmbeddedObject: EmbeddedObject, ObjectKeyIdentifiable {\n    @objc dynamic var value = 0\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\nextension Publisher {\n    public func signal(_ semaphore: DispatchSemaphore) -> Publishers.HandleEvents<Self> {\n        self.handleEvents(receiveOutput: { _ in semaphore.signal() })\n    }\n}\n\n// XCTest doesn't care about the @available on the class and will try to run\n// the tests even on older versions. Putting this check inside `defaultTestSuite`\n// results in a warning about it being redundant due to the enclosing check, so\n// it needs to be out of line.\nfunc hasCombine() -> Bool {\n    if #available(macOS 10.15, watchOS 6.0, iOS 13.0, tvOS 13.0, *) {\n        return true\n    }\n    return false\n}\n\n@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)\nclass ObjectIdentifiableTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        if hasCombine() {\n            return super.defaultTestSuite\n        }\n        return XCTestSuite(name: \"\\(type(of: self))\")\n    }\n\n    func testUnmanaged() {\n        let obj1 = CombineIdentifiableObject(value: [1])\n        let obj2 = CombineIdentifiableObject(value: [1])\n        let obj3 = CombineIdentifiableObject(value: [2])\n        XCTAssertEqual(obj1.id, obj1.id)\n        XCTAssertNotEqual(obj1.id, obj2.id)\n        XCTAssertNotEqual(obj2.id, obj3.id)\n        XCTAssertNotEqual(obj1.id, obj3.id)\n    }\n\n    func testManagedTopLevel() {\n        let realm = try! Realm()\n        let (obj1, obj2) = try! realm.write {\n            return (\n                realm.create(CombineIdentifiableObject.self, value: [1]),\n                realm.create(CombineIdentifiableObject.self, value: [2])\n            )\n        }\n        XCTAssertEqual(obj1.id, obj1.id)\n        XCTAssertNotEqual(obj1.id, obj2.id)\n        XCTAssertEqual(obj1.id, realm.objects(CombineIdentifiableObject.self).first!.id)\n        XCTAssertEqual(obj2.id, realm.objects(CombineIdentifiableObject.self).last!.id)\n    }\n\n    func testManagedEmbedded() {\n        let realm = try! Realm()\n        let (obj1, obj2) = try! realm.write {\n            return (\n                realm.create(CombineIdentifiableObject.self, value: [1, [1]] as [Any]),\n                realm.create(CombineIdentifiableObject.self, value: [2, [2]] as [Any])\n            )\n        }\n        XCTAssertEqual(obj1.child!.id, obj1.child!.id)\n        XCTAssertNotEqual(obj1.child!.id, obj2.child!.id)\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\nclass CombinePublisherTestCase: TestCase {\n    var realm: Realm!\n    var cancellable: AnyCancellable?\n    var notificationToken: NotificationToken?\n    let subscribeOnQueue = DispatchQueue(label: \"subscribe on\", qos: .userInteractive, autoreleaseFrequency: .workItem)\n    let receiveOnQueue = DispatchQueue(label: \"receive on\", qos: .userInteractive, autoreleaseFrequency: .workItem)\n\n    override class var defaultTestSuite: XCTestSuite {\n        if hasCombine() {\n            return super.defaultTestSuite\n        }\n        return XCTestSuite(name: \"\\(type(of: self))\")\n    }\n\n    override func setUp() {\n        super.setUp()\n        realm = try! Realm(configuration: Realm.Configuration(inMemoryIdentifier: \"CombinePublisherTestCase\"))\n        XCTAssertTrue(realm.isEmpty)\n    }\n\n    override func tearDown() {\n        if let cancellable = cancellable {\n            cancellable.cancel()\n        }\n        if let notificationToken = notificationToken {\n            notificationToken.invalidate()\n        }\n        realm.invalidate()\n        realm = nil\n        subscribeOnQueue.sync { }\n        receiveOnQueue.sync { }\n        super.tearDown()\n    }\n\n    func watchForNotifierAdded() -> XCTestExpectation {\n        // .subscribe(on:) is asynchronous, so we need to wait for the notifier\n        // to be ready before we do the thing which should produce notifications\n        let ex = expectation(description: \"added notifier\")\n        subscribeOnQueue.sync {\n            let r = try! Realm(configuration: realm.configuration, queue: subscribeOnQueue)\n            RLMAddBeforeNotifyBlock(ObjectiveCSupport.convert(object: r)) {\n                _ = r // retain the Realm until the block is released\n                ex.fulfill()\n            }\n        }\n        return ex\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\nclass CombineRealmTests: CombinePublisherTestCase {\n    func testWillChangeLocalWrite() {\n        var called = false\n        cancellable = realm\n            .objectWillChange\n            .sink {\n            called = true\n        }\n\n        try! realm.write {\n            realm.create(SwiftIntObject.self)\n        }\n        XCTAssertTrue(called)\n    }\n\n    func testWillChangeLocalWriteWithToken() {\n        var called = false\n\n        cancellable = realm\n            .objectWillChange\n            .saveToken(on: self, for: \\.notificationToken)\n            .sink {\n            called = true\n        }\n\n        try! realm.write {\n            realm.create(SwiftIntObject.self)\n        }\n        XCTAssertNotNil(notificationToken)\n        XCTAssertTrue(called)\n    }\n\n    func testWillChangeLocalWriteWithoutNotifying() {\n        var called = false\n        cancellable = realm\n            .objectWillChange\n            .saveToken(on: self, for: \\.notificationToken)\n            .sink {\n            called = true\n        }\n\n        XCTAssertNotNil(notificationToken)\n        for _ in 0..<10 {\n            try! realm.write(withoutNotifying: [notificationToken!]) {\n                realm.create(SwiftIntObject.self)\n            }\n            XCTAssertFalse(called)\n        }\n    }\n\n    func testWillChangeRemoteWrite() {\n        let exp = XCTestExpectation()\n        cancellable = realm.objectWillChange.sink {\n            exp.fulfill()\n        }\n        let configuration = self.realm.configuration\n        subscribeOnQueue.async {\n            let backgroundRealm = try! Realm(configuration: configuration)\n            try! backgroundRealm.write {\n                backgroundRealm.create(SwiftIntObject.self)\n            }\n        }\n        wait(for: [exp], timeout: 1)\n    }\n}\n\n// MARK: - Object\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\nclass CombineObjectPublisherTests: CombinePublisherTestCase {\n    var obj: SwiftIntObject!\n\n    override func setUp() {\n        super.setUp()\n        obj = try! realm.write { realm.create(SwiftIntObject.self) }\n    }\n\n    func testWillChange() {\n        let exp = XCTestExpectation()\n        cancellable = obj.objectWillChange.sink {\n            exp.fulfill()\n        }\n        try! realm.write { obj.intCol = 1 }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testWillChangeWithToken() {\n        let exp = XCTestExpectation()\n        cancellable = obj\n            .objectWillChange\n            .saveToken(on: self, at: \\.notificationToken)\n            .sink {\n            exp.fulfill()\n        }\n        XCTAssertNotNil(notificationToken)\n        try! realm.write { obj.intCol = 1 }\n    }\n\n    func testChange() {\n        let exp = XCTestExpectation()\n        cancellable = valuePublisher(obj).assertNoFailure().sink { o in\n            XCTAssertEqual(self.obj, o)\n            exp.fulfill()\n        }\n\n        try! realm.write { obj.intCol = 1 }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testChangeSet() {\n        let exp = XCTestExpectation()\n        cancellable = changesetPublisher(obj).assertNoFailure().sink { change in\n            if case .change(let o, let properties) = change {\n                XCTAssertEqual(self.obj, o)\n                XCTAssertEqual(properties.count, 1)\n                XCTAssertEqual(properties[0].name, \"intCol\")\n                XCTAssertNil(properties[0].oldValue)\n                XCTAssertEqual(properties[0].newValue as? Int, 1)\n            } else {\n                XCTFail(\"Expected .change but got \\(change)\")\n            }\n            exp.fulfill()\n        }\n\n        try! realm.write { obj.intCol = 1 }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testDelete() {\n        let exp = XCTestExpectation()\n        cancellable = valuePublisher(obj).sink(receiveCompletion: { _ in exp.fulfill() },\n                                         receiveValue: { _ in })\n        try! realm.write { realm.delete(obj) }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testSubscribeOn() {\n        let ex = watchForNotifierAdded()\n        let sema = DispatchSemaphore(value: 0)\n        var i = 1\n        cancellable = valuePublisher(obj)\n            .subscribe(on: subscribeOnQueue)\n            .map { obj -> SwiftIntObject in\n                sema.signal()\n                XCTAssertEqual(obj.intCol, i)\n                i += 1\n                return obj\n            }\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                XCTAssertEqual(arr.count, 10)\n                sema.signal()\n            }\n\n        wait(for: [ex], timeout: 2.0)\n        for _ in 0..<10 {\n            try! realm.write { obj.intCol += 1 }\n            // wait between each write so that the notifications can't get coalesced\n            // also would deadlock if the subscription was on the main thread\n            sema.wait()\n        }\n        try! realm.write { realm.delete(obj) }\n        sema.wait()\n    }\n\n    func testReceiveOn() {\n        var exp = XCTestExpectation()\n        cancellable = valuePublisher(obj)\n            .receive(on: receiveOnQueue)\n            .map { obj -> Int in\n                exp.fulfill()\n                return obj.intCol\n            }\n            .collect()\n            .assertNoFailure()\n            .sink { arr in\n                XCTAssertEqual(arr.count, 10)\n                for i in 1..<10 {\n                    XCTAssertTrue(arr.contains(i))\n                }\n                exp.fulfill()\n            }\n\n        for _ in 0..<10 {\n            try! realm.write { obj.intCol += 1 }\n            wait(for: [exp], timeout: 10)\n            exp = XCTestExpectation()\n        }\n        try! realm.write { realm.delete(obj) }\n        wait(for: [exp], timeout: 10)\n    }\n\n    func testChangeSetSubscribeOn() {\n        let ex = watchForNotifierAdded()\n        let sema = DispatchSemaphore(value: 0)\n\n        var prev: SwiftIntObject?\n        cancellable = changesetPublisher(obj)\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink(receiveCompletion: { _ in sema.signal() }, receiveValue: { change in\n                if case .change(let o, let properties) = change {\n                    XCTAssertNotEqual(self.obj, o)\n                    XCTAssertEqual(properties.count, 1)\n                    XCTAssertEqual(properties[0].name, \"intCol\")\n                    if let prev = prev {\n                        XCTAssertEqual(properties[0].oldValue as? Int, prev.intCol)\n                    }\n                    XCTAssertEqual(properties[0].newValue as? Int, o.intCol)\n                    prev = o.freeze()\n                    XCTAssertEqual(prev!.intCol, o.intCol)\n\n                    if o.intCol == 100 {\n                        sema.signal()\n                    }\n                } else {\n                    XCTFail(\"Expected .change but got \\(change)\")\n                }\n            })\n\n        wait(for: [ex], timeout: 2.0)\n        for _ in 0..<100 {\n            try! realm.write { obj.intCol += 1 }\n        }\n        sema.wait()\n        try! realm.write { realm.delete(obj) }\n\n        sema.wait()\n        XCTAssertNotNil(prev)\n        XCTAssertEqual(prev!.intCol, 100)\n    }\n\n    func testChangeSetSubscribeOnKeyPath() {\n        let obj = try! realm.write { realm.create(SwiftObject.self, value: [\"intCol\": 0, \"boolCol\": false]) }\n        let sema = DispatchSemaphore(value: 0)\n\n        let ex = watchForNotifierAdded()\n        var prev: SwiftObject?\n        cancellable = changesetPublisher(obj, keyPaths: [\"intCol\"])\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink(receiveCompletion: { _ in sema.signal() }, receiveValue: { change in\n                if case .change(let o, let properties) = change {\n                    XCTAssertNotEqual(self.obj, o)\n                    XCTAssertEqual(properties.count, 1)\n                    XCTAssertEqual(properties[0].name, \"intCol\")\n                    if let prev = prev {\n                        XCTAssertEqual(properties[0].oldValue as? Int, prev.intCol)\n                    }\n                    XCTAssertEqual(properties[0].newValue as? Int, o.intCol)\n                    prev = o.freeze()\n                    XCTAssertEqual(prev!.intCol, o.intCol)\n\n                    if o.intCol >= 100 {\n                        sema.signal()\n                    }\n                } else {\n                    XCTFail(\"Expected .change but got \\(change)\")\n                }\n            })\n        wait(for: [ex], timeout: 2.0)\n\n        for _ in 0..<100 {\n            try! realm.write { obj.intCol += 1 }\n        }\n        sema.wait()\n\n        // The following two lines check if a write outside of\n        // the intended keyPath does *not* publish a\n        // change.\n        // If a changeset is published for boolCol, the test would fail\n        // above when checking for property name \"intCol\".\n        try! realm.write { obj.boolCol = true }\n        try! realm.write { obj.intCol += 1 }\n        sema.wait()\n\n        try! realm.write { realm.delete(obj) }\n        sema.wait()\n\n        XCTAssertNotNil(prev)\n        XCTAssertEqual(prev!.intCol, 101)\n    }\n\n    func testChangeSetReceiveOn() {\n        var exp = XCTestExpectation(description: \"change\")\n\n        cancellable = changesetPublisher(obj)\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink(receiveCompletion: { _ in exp.fulfill() }, receiveValue: { change in\n                if case .change(let o, let properties) = change {\n                    XCTAssertNotEqual(self.obj, o)\n                    XCTAssertEqual(properties.count, 1)\n                    XCTAssertEqual(properties[0].name, \"intCol\")\n                    // oldValue is always nil because we subscribed on the thread doing the writing\n                    XCTAssertNil(properties[0].oldValue)\n                    XCTAssertEqual(properties[0].newValue as? Int, o.intCol)\n                } else {\n                    XCTFail(\"Expected .change but got \\(change)\")\n                }\n                exp.fulfill()\n            })\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { obj.intCol += 1 }\n            wait(for: [exp], timeout: 1)\n        }\n        exp = XCTestExpectation(description: \"completion\")\n        try! realm.write { realm.delete(obj) }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testChangeSetSubscribeOnAndReceiveOn() {\n        let sema = DispatchSemaphore(value: 0)\n\n        let ex = watchForNotifierAdded()\n        var prev: SwiftIntObject?\n        cancellable = changesetPublisher(obj)\n            .subscribe(on: subscribeOnQueue)\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink(receiveCompletion: { _ in sema.signal() }, receiveValue: { change in\n                if case .change(let o, let properties) = change {\n                    XCTAssertNotEqual(self.obj, o)\n                    XCTAssertEqual(properties.count, 1)\n                    XCTAssertEqual(properties[0].name, \"intCol\")\n                    if let prev = prev {\n                        XCTAssertEqual(properties[0].oldValue as? Int, prev.intCol)\n                    }\n                    XCTAssertEqual(properties[0].newValue as? Int, o.intCol)\n                    prev = o.freeze()\n                    XCTAssertEqual(prev!.intCol, o.intCol)\n\n                    if o.intCol == 100 {\n                        sema.signal()\n                    }\n                    o.realm?.invalidate()\n                } else {\n                    XCTFail(\"Expected .change but got \\(change)\")\n                }\n            })\n        wait(for: [ex], timeout: 2.0)\n\n        for _ in 0..<100 {\n            try! realm.write { obj.intCol += 1 }\n        }\n        sema.wait()\n        try! realm.write { realm.delete(obj) }\n\n        sema.wait()\n        XCTAssertNotNil(prev)\n        XCTAssertEqual(prev!.intCol, 100)\n    }\n\n    func testChangeSetMakeThreadSafe() {\n        var exp = XCTestExpectation(description: \"change\")\n\n        cancellable = changesetPublisher(obj)\n            .map { $0 }\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink(receiveCompletion: { _ in exp.fulfill() }, receiveValue: { change in\n                if case .change(let o, let properties) = change {\n                    XCTAssertNotEqual(self.obj, o)\n                    XCTAssertEqual(properties.count, 1)\n                    XCTAssertEqual(properties[0].name, \"intCol\")\n                    XCTAssertNil(properties[0].oldValue)\n                    XCTAssertEqual(properties[0].newValue as? Int, o.intCol)\n                } else {\n                    XCTFail(\"Expected .change but got \\(change)\")\n                }\n                exp.fulfill()\n            })\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { obj.intCol += 1 }\n            wait(for: [exp], timeout: 1)\n        }\n        exp = XCTestExpectation(description: \"completion\")\n        try! realm.write { realm.delete(obj) }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testFrozen() {\n        let exp = XCTestExpectation()\n\n        cancellable = valuePublisher(obj)\n            .freeze()\n            .collect()\n            .assertNoFailure()\n            .sink { arr in\n                XCTAssertEqual(arr.count, 10)\n                for i in 0..<10 {\n                    XCTAssertEqual(arr[i].intCol, i + 1)\n                }\n                exp.fulfill()\n        }\n\n        for _ in 0..<10 {\n            try! realm.write { obj.intCol += 1 }\n        }\n        try! realm.write { realm.delete(obj) }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testFrozenChangeSetSubscribeOn() {\n        let sema = DispatchSemaphore(value: 0)\n        let ex = watchForNotifierAdded()\n        cancellable = changesetPublisher(obj)\n            .subscribe(on: subscribeOnQueue)\n            .freeze()\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                var prev: SwiftIntObject?\n                for change in arr {\n                    guard case .change(let obj, let properties) = change else {\n                        XCTFail(\"Expected .change but got \\(change)\")\n                        sema.signal()\n                        return\n                    }\n\n                    XCTAssertEqual(properties.count, 1)\n                    XCTAssertEqual(properties[0].name, \"intCol\")\n                    XCTAssertEqual(properties[0].newValue as? Int, obj.intCol)\n                    if let prev = prev {\n                        XCTAssertEqual(properties[0].oldValue as? Int, prev.intCol)\n                    }\n                    prev = obj\n                }\n                sema.signal()\n            }\n        wait(for: [ex], timeout: 2.0)\n\n        for _ in 0..<100 {\n            try! realm.write { obj.intCol += 1 }\n        }\n        try! realm.write { realm.delete(obj) }\n        sema.wait()\n    }\n\n    func testFrozenChangeSetReceiveOn() {\n        let exp = XCTestExpectation(description: \"sink complete\")\n        cancellable = changesetPublisher(obj)\n            .freeze()\n            .receive(on: receiveOnQueue)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                for change in arr {\n                    guard case .change(let obj, let properties) = change else {\n                        XCTFail(\"Expected .change but got \\(change)\")\n                        exp.fulfill()\n                        return\n                    }\n\n                    XCTAssertEqual(properties.count, 1)\n                    XCTAssertEqual(properties[0].name, \"intCol\")\n                    XCTAssertEqual(properties[0].newValue as? Int, obj.intCol)\n                    // subscribing on the thread making writes means that oldValue\n                    // is always nil\n                    XCTAssertNil(properties[0].oldValue)\n                }\n                exp.fulfill()\n        }\n\n        for _ in 0..<100 {\n            try! realm.write { obj.intCol += 1 }\n        }\n        try! realm.write { realm.delete(obj) }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testFrozenChangeSetSubscribeOnAndReceiveOn() {\n        let sema = DispatchSemaphore(value: 0)\n        let ex = watchForNotifierAdded()\n        cancellable = changesetPublisher(obj)\n            .subscribe(on: subscribeOnQueue)\n            .freeze()\n            .receive(on: receiveOnQueue)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                var prev: SwiftIntObject?\n                for change in arr {\n                    guard case .change(let obj, let properties) = change else {\n                        XCTFail(\"Expected .change but got \\(change)\")\n                        sema.signal()\n                        return\n                    }\n\n                    XCTAssertEqual(properties.count, 1)\n                    XCTAssertEqual(properties[0].name, \"intCol\")\n                    XCTAssertEqual(properties[0].newValue as? Int, obj.intCol)\n                    if let prev = prev {\n                        XCTAssertEqual(properties[0].oldValue as? Int, prev.intCol)\n                    }\n                    prev = obj\n                }\n                sema.signal()\n            }\n        wait(for: [ex], timeout: 2.0)\n\n        for _ in 0..<100 {\n            try! realm.write { obj.intCol += 1 }\n        }\n        try! realm.write { realm.delete(obj) }\n        sema.wait()\n    }\n\n    func testReceiveOnAfterMap() {\n        var exp = XCTestExpectation()\n        cancellable = valuePublisher(obj)\n            .map { $0 }\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .map { obj -> Int in\n                exp.fulfill()\n                return obj.intCol\n            }\n            .collect()\n            .assertNoFailure()\n            .sink { arr in\n                XCTAssertEqual(arr.count, 10)\n                for i in 1..<10 {\n                    XCTAssertTrue(arr.contains(i))\n                }\n                exp.fulfill()\n            }\n\n        for _ in 0..<10 {\n            try! realm.write { obj.intCol += 1 }\n            wait(for: [exp], timeout: 1)\n            exp = XCTestExpectation()\n        }\n        try! realm.write { realm.delete(obj) }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testUnmanagedMakeThreadSafe() {\n        let objects = [SwiftIntObject(value: [1]), SwiftIntObject(value: [2]), SwiftIntObject(value: [3])]\n\n        let exp = XCTestExpectation()\n        cancellable = objects.publisher\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .map { $0.intCol }\n            .collect()\n            .sink { (arr: [Int]) in\n                XCTAssertEqual(arr, [1, 2, 3])\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testManagedMakeThreadSafe() {\n        let objects = try! realm.write {\n            return [\n                realm.create(SwiftIntObject.self, value: [1]),\n                realm.create(SwiftIntObject.self, value: [2]),\n                realm.create(SwiftIntObject.self, value: [3])\n            ]\n        }\n\n        let exp = XCTestExpectation()\n        cancellable = objects.publisher\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .map { $0.intCol }\n            .collect()\n            .sink { (arr: [Int]) in\n                XCTAssertEqual(arr, [1, 2, 3])\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testFrozenMakeThreadSafe() {\n        var exp = XCTestExpectation()\n        cancellable = valuePublisher(obj)\n            .freeze()\n            .map { $0 }\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink { obj in\n                XCTAssertTrue(obj.isFrozen)\n                exp.fulfill()\n            }\n\n        for _ in 0..<10 {\n            try! realm.write { obj.intCol += 1 }\n            wait(for: [exp], timeout: 1)\n            exp = XCTestExpectation()\n        }\n    }\n\n    func testMixedMakeThreadSafe() {\n        let realm2 = try! Realm(configuration: Realm.Configuration(inMemoryIdentifier: \"test2\"))\n        var objects = try! realm.write {\n            try! realm2.write {\n                return [\n                    realm.create(SwiftIntObject.self, value: [1]),\n                    realm2.create(SwiftIntObject.self, value: [2]),\n                    SwiftIntObject(value: [3]),\n                    realm.create(SwiftIntObject.self, value: [4]),\n                    realm2.create(SwiftIntObject.self, value: [5])\n                ]\n            }\n        }\n        objects[3] = objects[3].freeze()\n        objects[4] = objects[4].freeze()\n        let exp = XCTestExpectation()\n        cancellable = objects.publisher\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .map { $0.intCol }\n            .collect()\n            .sink { (arr: [Int]) in\n                XCTAssertEqual(arr, [1, 2, 3, 4, 5])\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 1)\n    }\n}\n\nprivate protocol CombineTestCollection {\n    static func getCollection(_ realm: Realm) -> Self\n    func appendObject()\n    func modifyObject()\n    // Keypath which is modified by `modifyObject`\n    var includedKeyPath: [String] { get }\n    // Keypath which is not modified by `modifyObject`\n    var excludedKeyPath: [String] { get }\n}\n\n// MARK: - List, MutableSet\n\nprivate func checkChangeset<Collection: RealmCollection>(_ change: RealmCollectionChange<Collection>, calls: Int, frozen: Bool = false) {\n    switch change {\n    case .initial(let collection):\n        XCTAssertEqual(collection.isFrozen, frozen)\n        XCTAssertEqual(calls, 0)\n        XCTAssertEqual(collection.count, 0)\n    case .update(let collection, deletions: let deletions, insertions: let insertions,\n                 modifications: let modifications):\n        XCTAssertEqual(collection.isFrozen, frozen)\n        XCTAssertEqual(collection.count, calls)\n        XCTAssertEqual(insertions, [calls - 1])\n        XCTAssertEqual(deletions, [])\n        XCTAssertEqual(modifications, [])\n    case .error(let error):\n        XCTFail(\"Unexpected error \\(error)\")\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\nprivate class CombineCollectionPublisherTests<Collection: RealmCollection>: CombinePublisherTestCase\n        where Collection: CombineTestCollection, Collection: RealmSubscribable {\n    var collection: Collection!\n\n    class func testSuite(_ name: String) -> XCTestSuite {\n        if hasCombine() {\n            // By default this test suite's name will be the generic type's\n            // mangled name, which is an unreadable mess. It appears that the\n            // way to override it is with a subclass with an explicit name, which\n            // can't be done in pure Swift.\n            let cls: AnyClass = objc_allocateClassPair(CombineCollectionPublisherTests<Collection>.self, \"CombinePublisherTests<\\(name)>\", 0)!\n            objc_registerClassPair(cls)\n            return cls.defaultTestSuite\n        }\n        return XCTestSuite(name: \"CombinePublisherTests<\\(name)>\")\n    }\n\n    override func setUp() {\n        super.setUp()\n        collection = Collection.getCollection(realm)\n    }\n\n    func testWillChange() {\n        let exp = XCTestExpectation()\n        cancellable = collection.objectWillChange.sink {\n            exp.fulfill()\n        }\n        try! realm.write { collection.appendObject() }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testBasic() {\n        var exp = XCTestExpectation()\n        var calls = 0\n        cancellable = collection.collectionPublisher\n            .assertNoFailure()\n            .sink { c in\n                XCTAssertEqual(c.count, calls)\n                calls += 1\n                exp.fulfill()\n            }\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n            exp = XCTestExpectation()\n        }\n    }\n\n    func testBasicWithNotificationToken() {\n        var exp = XCTestExpectation()\n        var calls = 0\n        cancellable = collection.collectionPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .assertNoFailure()\n            .sink { c in\n                XCTAssertEqual(c.count, calls)\n                calls += 1\n                exp.fulfill()\n            }\n        XCTAssertNotNil(notificationToken)\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n            exp = XCTestExpectation()\n        }\n    }\n\n    func testBasicWithoutNotifying() {\n        var calls = 0\n        cancellable = collection\n            .collectionPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .assertNoFailure()\n            .sink { _ in\n                calls += 1\n            }\n        XCTAssertNotNil(notificationToken)\n        for _ in 0..<10 {\n            try! realm.write(withoutNotifying: [notificationToken!]) { collection.appendObject() }\n            XCTAssertEqual(calls, 1) // 1 for the initial notification\n        }\n    }\n\n    func testChangeSet() {\n        var exp = XCTestExpectation(description: \"initial\")\n        var calls = 0\n        cancellable = collection.changesetPublisher\n            .sink { change in\n                checkChangeset(change, calls: calls)\n                calls += 1\n                exp.fulfill()\n            }\n        wait(for: [exp], timeout: 10)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n    }\n\n    func testChangeSetWithToken() {\n        var exp = XCTestExpectation(description: \"initial\")\n        var calls = 0\n        cancellable = collection\n            .changesetPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .sink { change in\n                checkChangeset(change, calls: calls)\n                calls += 1\n                exp.fulfill()\n            }\n        wait(for: [exp], timeout: 10)\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n    }\n\n    func testChangeSetWithoutNotifying() {\n        var calls = 0\n        cancellable = collection\n            .changesetPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .sink { _ in\n                calls += 1\n            }\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            try! realm.write(withoutNotifying: [notificationToken!]) { collection.appendObject() }\n            XCTAssertEqual(calls, 1) // 1 for the initial observation\n        }\n    }\n\n    func testSubscribeOn() {\n        let sema = DispatchSemaphore(value: 0)\n        var calls = 0\n        cancellable = collection\n            .collectionPublisher\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                XCTAssertEqual(r.count, calls)\n                calls += 1\n                sema.signal()\n        }\n        sema.wait()\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            sema.wait()\n        }\n    }\n\n    func testSubscribeOnKeyPath() {\n        var ex = expectation(description: \"initial notification\")\n\n        cancellable = collection.collectionPublisher(keyPaths: collection.includedKeyPath)\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink { _ in ex.fulfill()\n        }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"change notification\")\n        try! realm.write { collection.appendObject() }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"change notification\")\n        try! realm.write { collection.modifyObject() }\n        wait(for: [ex], timeout: 1.0)\n    }\n\n    func testSubscribeOnKeyPathNoChange() {\n        var ex = expectation(description: \"initial notification\")\n\n        cancellable = collection.collectionPublisher(keyPaths: collection.excludedKeyPath)\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink { _ in ex.fulfill()\n        }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"change notification\")\n        try! realm.write { collection.appendObject() }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"no change notification\")\n        ex.isInverted = true\n        try! realm.write { collection.modifyObject() }\n        wait(for: [ex], timeout: 1.0)\n    }\n\n    func testSubscribeOnWithToken() {\n        let sema = DispatchSemaphore(value: 0)\n        var calls = 0\n        cancellable = collection\n            .collectionPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                XCTAssertEqual(r.count, calls)\n                calls += 1\n                sema.signal()\n        }\n        sema.wait()\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            sema.wait()\n        }\n    }\n\n    func testReceiveOn() {\n        var calls = 0\n        var exp = XCTestExpectation(description: \"initial\")\n        cancellable = collection.collectionPublisher\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                XCTAssertEqual(r.count, calls)\n                calls += 1\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 10)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n    }\n\n    func testReceiveOnWithToken() {\n        var calls = 0\n        var exp = XCTestExpectation(description: \"initial\")\n        cancellable = collection\n            .collectionPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                XCTAssertEqual(r.count, calls)\n                calls += 1\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 10)\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n    }\n\n    func testChangeSetSubscribeOn() {\n        var calls = 0\n        let sema = DispatchSemaphore(value: 0)\n        cancellable = collection.changesetPublisher\n            .subscribe(on: subscribeOnQueue)\n            .sink { change in\n                checkChangeset(change, calls: calls)\n                calls += 1\n                sema.signal()\n        }\n        sema.wait()\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            sema.wait()\n        }\n    }\n\n    func testChangeSetSubscribeOnKeyPath() {\n        var ex = expectation(description: \"initial notification\")\n\n        cancellable = collection.changesetPublisher(keyPaths: collection.includedKeyPath)\n            .subscribe(on: subscribeOnQueue)\n            .sink { _ in ex.fulfill() }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"change notification\")\n        try! realm.write { collection.appendObject() }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"change notification\")\n        try! realm.write { collection.modifyObject() }\n        wait(for: [ex], timeout: 1.0)\n    }\n\n    func testChangeSetSubscribeOnKeyPathNoChange() {\n        var ex = expectation(description: \"initial notification\")\n\n        cancellable = collection.changesetPublisher(keyPaths: collection.excludedKeyPath)\n            .subscribe(on: subscribeOnQueue)\n            .sink { _ in ex.fulfill() }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"change notification\")\n        try! realm.write { collection.appendObject() }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"no change notification\")\n        ex.isInverted = true\n        try! realm.write { collection.modifyObject() }\n        wait(for: [ex], timeout: 1.0)\n    }\n\n    func testChangeSetSubscribeOnWithToken() {\n        var calls = 0\n        let sema = DispatchSemaphore(value: 0)\n        cancellable = collection\n            .changesetPublisher\n            .subscribe(on: subscribeOnQueue)\n            .saveToken(on: self, at: \\.notificationToken)\n            .sink { change in\n                checkChangeset(change, calls: calls)\n                calls += 1\n                sema.signal()\n        }\n        sema.wait()\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            sema.wait()\n        }\n    }\n\n    func testChangeSetReceiveOn() {\n        var exp = XCTestExpectation(description: \"initial\")\n        var calls = 0\n        cancellable = collection.changesetPublisher\n            .receive(on: receiveOnQueue)\n            .sink { change in\n                checkChangeset(change, calls: calls)\n                calls += 1\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 10)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n    }\n\n    func testChangeSetReceiveOnWithToken() {\n        var exp = XCTestExpectation(description: \"initial\")\n        var calls = 0\n        cancellable = collection\n            .changesetPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .receive(on: receiveOnQueue)\n            .sink { change in\n                checkChangeset(change, calls: calls)\n                calls += 1\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 10)\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n    }\n\n    func testMakeThreadSafe() {\n        var calls = 0\n        var exp = XCTestExpectation(description: \"initial\")\n        cancellable = collection.collectionPublisher\n            .map { $0 }\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                XCTAssertEqual(r.count, calls)\n                calls += 1\n                exp.fulfill()\n            }\n        wait(for: [exp], timeout: 10)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n    }\n\n    func testMakeThreadSafeChangeset() {\n        var exp = XCTestExpectation(description: \"initial\")\n        var calls = 0\n        cancellable = collection.changesetPublisher\n            .map { $0 }\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .sink { change in\n                checkChangeset(change, calls: calls)\n                calls += 1\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 10)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n    }\n\n    func testMakeThreadSafeWithChangesetToken() {\n        var calls = 0\n        var exp = XCTestExpectation(description: \"initial\")\n        cancellable = collection\n            .changesetPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .map { $0 }\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .sink { change in\n                checkChangeset(change, calls: calls)\n                calls += 1\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 10)\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n    }\n\n    func testFrozen() {\n        let exp = XCTestExpectation()\n        cancellable = collection.collectionPublisher\n            .freeze()\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { arr in\n                XCTAssertEqual(arr.count, 10)\n                for (i, collection) in arr.enumerated() {\n                    XCTAssertTrue(collection.isFrozen)\n                    XCTAssertEqual(collection.count, i)\n                }\n                exp.fulfill()\n        }\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n        }\n        wait(for: [exp], timeout: 10)\n    }\n\n    func testFrozenChangeSetSubscribeOn() {\n        let sema = DispatchSemaphore(value: 0)\n        cancellable = collection.changesetPublisher\n            .subscribe(on: subscribeOnQueue)\n            .freeze()\n            .assertNoFailure()\n            .signal(sema)\n            .prefix(10)\n            .collect()\n            .sink { @Sendable arr in\n                XCTAssertEqual(arr.count, 10)\n                for (i, change) in arr.enumerated() {\n                    checkChangeset(change, calls: i, frozen: true)\n                }\n                sema.signal()\n            }\n\n        for _ in 0..<10 {\n            sema.wait()\n            try! realm.write { collection.appendObject() }\n        }\n        sema.wait()\n    }\n\n    func testFrozenChangeSetReceiveOn() {\n        let exp = XCTestExpectation()\n        cancellable = collection.changesetPublisher\n            .freeze()\n            .receive(on: receiveOnQueue)\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                XCTAssertEqual(arr.count, 10)\n                for (i, change) in arr.enumerated() {\n                    checkChangeset(change, calls: i, frozen: true)\n                }\n                exp.fulfill()\n        }\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n        }\n        wait(for: [exp], timeout: 10)\n    }\n\n    func testFrozenChangeSetSubscribeOnAndReceiveOn() {\n        let sema = DispatchSemaphore(value: 0)\n        cancellable = collection.changesetPublisher\n            .subscribe(on: subscribeOnQueue)\n            .freeze()\n            .receive(on: receiveOnQueue)\n            .signal(sema)\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                for (i, change) in arr.enumerated() {\n                    checkChangeset(change, calls: i, frozen: true)\n                }\n                sema.signal()\n        }\n\n        for _ in 0..<10 {\n            sema.wait()\n            try! realm.write { collection.appendObject() }\n        }\n        sema.wait()\n    }\n\n    func testFrozenMakeThreadSafe() {\n        let sema = DispatchSemaphore(value: 0)\n        cancellable = collection.collectionPublisher\n            .freeze()\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                for (i, collection) in arr.enumerated() {\n                    XCTAssertTrue(collection.isFrozen)\n                    XCTAssertEqual(collection.count, i)\n                }\n                sema.signal()\n            }\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n        }\n        sema.wait()\n    }\n\n    func testFrozenMakeThreadSafeChangeset() {\n        let exp = XCTestExpectation()\n        cancellable = collection.changesetPublisher\n            .freeze()\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                for (i, change) in arr.enumerated() {\n                    checkChangeset(change, calls: i, frozen: true)\n                }\n                exp.fulfill()\n        }\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n        }\n        wait(for: [exp], timeout: 10)\n    }\n}\n\nextension Results: CombineTestCollection where Element == ModernAllTypesObject {\n    static func getCollection(_ realm: Realm) -> Results<Element> {\n        return realm.objects(Element.self)\n    }\n\n    func appendObject() {\n        realm?.create(Element.self)\n    }\n\n    func modifyObject() {\n        self.first!.intCol += 1\n    }\n\n    var includedKeyPath: [String] {\n        return [\"intCol\"]\n    }\n\n    var excludedKeyPath: [String] {\n        return [\"stringCol\"]\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\nclass ResultsPublisherTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        return CombineCollectionPublisherTests<Results<ModernAllTypesObject>>.testSuite(\"Results\")\n    }\n}\n\nextension List: CombineTestCollection where Element == ModernAllTypesObject {\n    static func getCollection(_ realm: Realm) -> List<Element> {\n        return try! realm.write { realm.create(ModernAllTypesObject.self).arrayCol }\n    }\n\n    func appendObject() {\n        append(realm!.create(Element.self))\n    }\n\n    func modifyObject() {\n        self.first!.intCol += 1\n    }\n\n    var includedKeyPath: [String] {\n        return [\"intCol\"]\n    }\n\n    var excludedKeyPath: [String] {\n        return [\"stringCol\"]\n    }\n}\n\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\nclass ManagedListPublisherTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        return CombineCollectionPublisherTests<List<ModernAllTypesObject>>.testSuite(\"List\")\n    }\n}\n\nextension MutableSet: CombineTestCollection where Element == ModernAllTypesObject {\n    static func getCollection(_ realm: Realm) -> MutableSet<Element> {\n        return try! realm.write { realm.create(ModernAllTypesObject.self).setCol }\n    }\n\n    func appendObject() {\n        insert(realm!.create(Element.self))\n    }\n\n    func modifyObject() {\n        self.first!.intCol += 1\n    }\n\n    var includedKeyPath: [String] {\n        return [\"intCol\"]\n    }\n\n    var excludedKeyPath: [String] {\n        return [\"stringCol\"]\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\nclass ManagedMutableSetPublisherTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        return CombineCollectionPublisherTests<MutableSet<ModernAllTypesObject>>.testSuite(\"MutableSet\")\n    }\n}\n\nextension LinkingObjects: CombineTestCollection where Element == ModernAllTypesObject {\n    static func getCollection(_ realm: Realm) -> LinkingObjects<Element> {\n        return try! realm.write { realm.create(ModernAllTypesObject.self).linkingObjects }\n    }\n\n    func appendObject() {\n        let link = realm!.objects(ModernAllTypesObject.self).first!\n        let parent = ModernAllTypesObject()\n        parent.objectCol = link\n        realm!.add(parent)\n    }\n\n    func modifyObject() {\n        self.first!.stringCol += \"concat\"\n    }\n\n    var includedKeyPath: [String] {\n        return [\"stringCol\"]\n    }\n\n    var excludedKeyPath: [String] {\n        return [\"intCol\"]\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\nclass LinkingObjectsPublisherTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        return CombineCollectionPublisherTests<LinkingObjects<ModernAllTypesObject>>.testSuite(\"LinkingObjects\")\n    }\n}\n\nextension AnyRealmCollection: CombineTestCollection where Element == ModernAllTypesObject {\n    static func getCollection(_ realm: Realm) -> AnyRealmCollection<Element> {\n        return AnyRealmCollection(realm.objects(Element.self))\n    }\n\n    func appendObject() {\n        realm?.create(Element.self)\n    }\n\n    func modifyObject() {\n        self.first!.intCol += 1\n    }\n\n    var includedKeyPath: [String] {\n        return [\"intCol\"]\n    }\n\n    var excludedKeyPath: [String] {\n        return [\"stringCol\"]\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\nclass AnyRealmCollectionPublisherTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        return CombineCollectionPublisherTests<AnyRealmCollection<ModernAllTypesObject>>.testSuite(\"AnyRealmCollection\")\n    }\n}\n\n// MARK: - Map\n\nprivate func checkChangeset<Collection: RealmKeyedCollection>(_ change: RealmMapChange<Collection>, calls: Int, frozen: Bool = false) {\n    switch change {\n    case .initial(let collection):\n        XCTAssertEqual(collection.isFrozen, frozen)\n        XCTAssertEqual(calls, 0)\n        XCTAssertEqual(collection.count, 0)\n    case .update(let collection, deletions: let deletions, insertions: let insertions, modifications: let modifications):\n        XCTAssertEqual(collection.isFrozen, frozen)\n        XCTAssertEqual(collection.count, calls)\n        // one insertion at a time\n        XCTAssertEqual(insertions.count, 1)\n        XCTAssertEqual(modifications, [])\n        XCTAssertEqual(deletions, [])\n    case .error(let error):\n        XCTFail(\"Unexpected error \\(error)\")\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\nprivate class CombineMapPublisherTests<Collection: RealmKeyedCollection>: CombinePublisherTestCase\n        where Collection: CombineTestCollection, Collection: RealmSubscribable {\n    var collection: Collection!\n\n    class func testSuite(_ name: String) -> XCTestSuite {\n        if hasCombine() {\n            // By default this test suite's name will be the generic type's\n            // mangled name, which is an unreadable mess. It appears that the\n            // way to override it is with a subclass with an explicit name, which\n            // can't be done in pure Swift.\n            let cls: AnyClass = objc_allocateClassPair(CombineMapPublisherTests<Collection>.self, \"CombinePublisherTests<\\(name)>\", 0)!\n            objc_registerClassPair(cls)\n            return cls.defaultTestSuite\n        }\n        return XCTestSuite(name: \"CombinePublisherTests<\\(name)>\")\n    }\n\n    override func setUp() {\n        super.setUp()\n        collection = Collection.getCollection(realm)\n    }\n\n    func testWillChange() {\n        let exp = XCTestExpectation()\n        cancellable = collection.objectWillChange.sink {\n            exp.fulfill()\n        }\n        try! realm.write { collection.appendObject() }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testBasic() {\n        var exp = XCTestExpectation()\n        var calls = 0\n        cancellable = collection.collectionPublisher\n            .assertNoFailure()\n            .sink { c in\n                XCTAssertEqual(c.count, calls)\n                calls += 1\n                exp.fulfill()\n            }\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n            exp = XCTestExpectation()\n        }\n    }\n\n    func testBasicWithNotificationToken() {\n        var exp = XCTestExpectation()\n        var calls = 0\n        cancellable = collection.collectionPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .assertNoFailure()\n            .sink { c in\n                XCTAssertEqual(c.count, calls)\n                calls += 1\n                exp.fulfill()\n            }\n        XCTAssertNotNil(notificationToken)\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n            exp = XCTestExpectation()\n        }\n    }\n\n    func testBasicWithoutNotifying() {\n        var calls = 0\n        cancellable = collection\n            .collectionPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .assertNoFailure()\n            .sink { _ in\n                calls += 1\n            }\n        XCTAssertNotNil(notificationToken)\n        for _ in 0..<10 {\n            try! realm.write(withoutNotifying: [notificationToken!]) { collection.appendObject() }\n            XCTAssertEqual(calls, 1) // 1 for the initial notification\n        }\n    }\n\n    func testChangeSet() {\n        var exp = XCTestExpectation(description: \"initial\")\n        var calls = 0\n        cancellable = collection.changesetPublisher\n            .sink { change in\n                checkChangeset(change, calls: calls)\n                calls += 1\n                exp.fulfill()\n            }\n        wait(for: [exp], timeout: 10)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n    }\n\n    func testChangeSetWithToken() {\n        var exp = XCTestExpectation(description: \"initial\")\n        var calls = 0\n        cancellable = collection\n            .changesetPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .sink { change in\n                checkChangeset(change, calls: calls)\n                calls += 1\n                exp.fulfill()\n            }\n        wait(for: [exp], timeout: 10)\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n    }\n\n    func testChangeSetWithoutNotifying() {\n        var calls = 0\n        cancellable = collection\n            .changesetPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .sink { _ in\n                calls += 1\n            }\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            try! realm.write(withoutNotifying: [notificationToken!]) { collection.appendObject() }\n            XCTAssertEqual(calls, 1) // 1 for the initial observation\n        }\n    }\n\n    func testSubscribeOn() {\n        let sema = DispatchSemaphore(value: 0)\n        var calls = 0\n        cancellable = collection\n            .collectionPublisher\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                XCTAssertEqual(r.count, calls)\n                calls += 1\n                sema.signal()\n        }\n        sema.wait()\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            sema.wait()\n        }\n    }\n\n    func testSubscribeOnKeyPath() {\n        var ex = expectation(description: \"initial notification\")\n\n        cancellable = collection.collectionPublisher(keyPaths: collection.includedKeyPath)\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink { _ in ex.fulfill()\n        }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"change notification\")\n        try! realm.write { collection.appendObject() }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"change notification\")\n        try! realm.write { collection.modifyObject() }\n        wait(for: [ex], timeout: 1.0)\n    }\n\n    func testSubscribeOnKeyPathNoChange() {\n        var ex = expectation(description: \"initial notification\")\n\n        cancellable = collection.collectionPublisher(keyPaths: collection.excludedKeyPath)\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink { _ in ex.fulfill()\n        }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"change notification\")\n        try! realm.write { collection.appendObject() }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"no change notification\")\n        ex.isInverted = true\n        try! realm.write { collection.modifyObject() }\n        wait(for: [ex], timeout: 1.0)\n    }\n\n    func testSubscribeOnWithToken() {\n        let sema = DispatchSemaphore(value: 0)\n        var calls = 0\n        cancellable = collection\n            .collectionPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                XCTAssertEqual(r.count, calls)\n                calls += 1\n                sema.signal()\n        }\n        sema.wait()\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            sema.wait()\n        }\n    }\n\n    func testReceiveOn() {\n        var calls = 0\n        var exp = XCTestExpectation(description: \"initial\")\n        cancellable = collection.collectionPublisher\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                XCTAssertEqual(r.count, calls)\n                calls += 1\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 10)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n    }\n\n    func testReceiveOnWithToken() {\n        var calls = 0\n        var exp = XCTestExpectation(description: \"initial\")\n        cancellable = collection\n            .collectionPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                XCTAssertEqual(r.count, calls)\n                calls += 1\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 10)\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n    }\n\n    func testChangeSetSubscribeOn() {\n        var calls = 0\n        let sema = DispatchSemaphore(value: 0)\n        cancellable = collection.changesetPublisher\n            .subscribe(on: subscribeOnQueue)\n            .sink { change in\n                checkChangeset(change, calls: calls)\n                calls += 1\n                sema.signal()\n        }\n        sema.wait()\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            sema.wait()\n        }\n    }\n\n    func testChangeSetSubscribeOnKeyPath() {\n        var ex = expectation(description: \"initial notification\")\n\n        cancellable = collection.changesetPublisher(keyPaths: collection.includedKeyPath)\n            .subscribe(on: subscribeOnQueue)\n            .sink { _ in ex.fulfill()\n        }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"change notification\")\n        try! realm.write { collection.appendObject() }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"change notification\")\n        try! realm.write { collection.modifyObject() }\n        wait(for: [ex], timeout: 1.0)\n    }\n\n    func testChangeSetSubscribeOnKeyPathNoChange() {\n        var ex = expectation(description: \"initial notification\")\n\n        cancellable = collection.changesetPublisher(keyPaths: collection.excludedKeyPath)\n            .subscribe(on: subscribeOnQueue)\n            .sink { _ in ex.fulfill()\n        }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"change notification\")\n        try! realm.write { collection.appendObject() }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"no change notification\")\n        ex.isInverted = true\n        try! realm.write { collection.modifyObject() }\n        wait(for: [ex], timeout: 1.0)\n    }\n\n    func testChangeSetSubscribeOnWithToken() {\n        var calls = 0\n        let sema = DispatchSemaphore(value: 0)\n        cancellable = collection\n            .changesetPublisher\n            .subscribe(on: subscribeOnQueue)\n            .saveToken(on: self, at: \\.notificationToken)\n            .sink { change in\n                checkChangeset(change, calls: calls)\n                calls += 1\n                sema.signal()\n        }\n        sema.wait()\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            sema.wait()\n        }\n    }\n\n    func testChangeSetReceiveOn() {\n        var exp = XCTestExpectation(description: \"initial\")\n        var calls = 0\n        cancellable = collection.changesetPublisher\n            .receive(on: receiveOnQueue)\n            .sink { change in\n                checkChangeset(change, calls: calls)\n                calls += 1\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 10)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n    }\n\n    func testChangeSetReceiveOnWithToken() {\n        var exp = XCTestExpectation(description: \"initial\")\n        var calls = 0\n        cancellable = collection\n            .changesetPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .receive(on: receiveOnQueue)\n            .sink { change in\n                checkChangeset(change, calls: calls)\n                calls += 1\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 10)\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n    }\n\n    func testMakeThreadSafe() {\n        var calls = 0\n        var exp = XCTestExpectation(description: \"initial\")\n        cancellable = collection.collectionPublisher\n            .map { $0 }\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                XCTAssertEqual(r.count, calls)\n                calls += 1\n                exp.fulfill()\n            }\n        wait(for: [exp], timeout: 10)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n    }\n\n    func testMakeThreadSafeChangeset() {\n        var exp = XCTestExpectation(description: \"initial\")\n        var calls = 0\n        cancellable = collection.changesetPublisher\n            .map { $0 }\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .sink { change in\n                checkChangeset(change, calls: calls)\n                calls += 1\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 10)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n    }\n\n    func testMakeThreadSafeWithChangesetToken() {\n        var calls = 0\n        var exp = XCTestExpectation(description: \"initial\")\n        cancellable = collection\n            .changesetPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .map { $0 }\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .sink { change in\n                checkChangeset(change, calls: calls)\n                calls += 1\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 10)\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n    }\n\n    func testFrozen() {\n        let exp = XCTestExpectation()\n        cancellable = collection.collectionPublisher\n            .freeze()\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { arr in\n                for (i, collection) in arr.enumerated() {\n                    XCTAssertTrue(collection.isFrozen)\n                    XCTAssertEqual(collection.count, i)\n                }\n                exp.fulfill()\n        }\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n        }\n        wait(for: [exp], timeout: 10)\n    }\n\n    func testFrozenChangeSetSubscribeOn() {\n        let sema = DispatchSemaphore(value: 0)\n        cancellable = collection.changesetPublisher\n            .subscribe(on: subscribeOnQueue)\n            .freeze()\n            .assertNoFailure()\n            .signal(sema)\n            .prefix(10)\n            .collect()\n            .sink { @Sendable arr in\n                for (i, change) in arr.enumerated() {\n                    checkChangeset(change, calls: i, frozen: true)\n                }\n                sema.signal()\n            }\n\n        for _ in 0..<10 {\n            sema.wait()\n            try! realm.write { collection.appendObject() }\n        }\n        sema.wait()\n    }\n\n    func testFrozenChangeSetReceiveOn() {\n        let exp = XCTestExpectation()\n        cancellable = collection.changesetPublisher\n            .freeze()\n            .receive(on: receiveOnQueue)\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                for (i, change) in arr.enumerated() {\n                    checkChangeset(change, calls: i, frozen: true)\n                }\n                exp.fulfill()\n        }\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n        }\n        wait(for: [exp], timeout: 10)\n    }\n\n    func testFrozenChangeSetSubscribeOnAndReceiveOn() {\n        let sema = DispatchSemaphore(value: 0)\n        cancellable = collection.changesetPublisher\n            .subscribe(on: subscribeOnQueue)\n            .freeze()\n            .receive(on: receiveOnQueue)\n            .signal(sema)\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                for (i, change) in arr.enumerated() {\n                    checkChangeset(change, calls: i, frozen: true)\n                }\n                sema.signal()\n        }\n\n        for _ in 0..<10 {\n            sema.wait()\n            try! realm.write { collection.appendObject() }\n        }\n        sema.wait()\n    }\n\n    func testFrozenMakeThreadSafe() {\n        let sema = DispatchSemaphore(value: 0)\n        cancellable = collection.collectionPublisher\n            .freeze()\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                for (i, collection) in arr.enumerated() {\n                    XCTAssertTrue(collection.isFrozen)\n                    XCTAssertEqual(collection.count, i)\n                }\n                sema.signal()\n            }\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n        }\n        sema.wait()\n    }\n\n    func testFrozenMakeThreadSafeChangeset() {\n        let exp = XCTestExpectation()\n        cancellable = collection.changesetPublisher\n            .freeze()\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                for (i, change) in arr.enumerated() {\n                    checkChangeset(change, calls: i, frozen: true)\n                }\n                exp.fulfill()\n        }\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n        }\n        wait(for: [exp], timeout: 10)\n    }\n}\n\nextension Map: CombineTestCollection where Key == String, Value == SwiftObject? {\n    static func getCollection(_ realm: Realm) -> Map<Key, Value> {\n        return try! realm.write { realm.create(SwiftMapPropertyObject.self).swiftObjectMap }\n    }\n\n    func appendObject() {\n        let key = UUID().uuidString\n        self[key] = realm!.create(SwiftObject.self)\n    }\n\n    func modifyObject() {\n        self.values.first!!.intCol += 1\n    }\n\n    var includedKeyPath: [String] {\n        return [\"intCol\"]\n    }\n\n    var excludedKeyPath: [String] {\n        return [\"stringCol\"]\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\nclass ManagedMapPublisherTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        return CombineMapPublisherTests<Map<String, SwiftObject?>>.testSuite(\"Map\")\n    }\n}\n\n// MARK: - Sectioned Results\n\nprotocol RealmSectionedObject: ObjectBase {\n    associatedtype Key: _Persistable, Hashable\n    var key: Key { get }\n}\n\nextension ModernAllTypesObject: RealmSectionedObject {\n    var key: Int8 { int8Col } // This property will never change.\n}\n\nprivate func checkChangeset<SectionedResults: RealmSectionedResult>(\n    _ change: SectionedResultsChange<SectionedResults>,\n    insertions: [IndexPath] = [], deletions: [IndexPath] = [], frozen: Bool = false) {\n    switch change {\n    case .initial(let collection):\n        XCTAssertEqual(collection.isFrozen, frozen)\n    case .update(let collection, deletions: let del, insertions: let ins,\n                 modifications: let modifications, _, _):\n        XCTAssertEqual(collection.isFrozen, frozen)\n        XCTAssertEqual(ins, insertions)\n        XCTAssertEqual(del, deletions)\n        XCTAssertEqual(modifications, [])\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\nprivate class CombineSectionedResultsPublisherTests<Collection: RealmCollection>: CombinePublisherTestCase\n    where Collection: CombineTestCollection, Collection: RealmSubscribable, Collection.Element: RealmSectionedObject {\n    var collection: Collection!\n\n    class func testSuite(_ name: String) -> XCTestSuite {\n        if hasCombine() {\n            // By default this test suite's name will be the generic type's\n            // mangled name, which is an unreadable mess. It appears that the\n            // way to override it is with a subclass with an explicit name, which\n            // can't be done in pure Swift.\n            let cls: AnyClass = objc_allocateClassPair(CombineSectionedResultsPublisherTests<Collection>.self, \"CombineSectionedResultsPublisherTests<\\(name)>\", 0)!\n            objc_registerClassPair(cls)\n            return cls.defaultTestSuite\n        }\n        return XCTestSuite(name: \"CombineSectionedResultsPublisherTests<\\(name)>\")\n    }\n\n    override func setUp() {\n        super.setUp()\n        collection = Collection.getCollection(realm)\n    }\n\n    func testWillChange() {\n        let exp = XCTestExpectation()\n        let sectionedResults = collection.sectioned(by: \\.key)\n        cancellable = sectionedResults.objectWillChange.sink {\n            exp.fulfill()\n        }\n        try! realm.write { collection.appendObject() }\n        wait(for: [exp], timeout: 1)\n\n        // Test section\n        let sectionExp = XCTestExpectation()\n        cancellable = sectionedResults[0].objectWillChange.sink {\n            sectionExp.fulfill()\n        }\n        try! realm.write { realm.deleteAll() }\n        wait(for: [sectionExp], timeout: 1)\n    }\n\n    func testBasic() {\n        var exp = XCTestExpectation()\n        var calls = 0\n        let sectionedResults = collection.sectioned(by: \\.key)\n        cancellable = sectionedResults.collectionPublisher\n            .assertNoFailure()\n            .sink { c in\n                if c.count != 0 {\n                    XCTAssertEqual(c[0].count, calls)\n                }\n                calls += 1\n                exp.fulfill()\n            }\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n            exp = XCTestExpectation()\n        }\n\n        // Test section\n        var sectionExp = XCTestExpectation()\n        var sectionCalls = 10\n        cancellable = sectionedResults[0].collectionPublisher\n            .assertNoFailure()\n            .sink { c in\n                XCTAssertEqual(c.count, sectionCalls)\n                sectionCalls -= 1\n                sectionExp.fulfill()\n            }\n\n        for _ in 0..<sectionCalls {\n            try! realm.write { realm.delete(collection.last!) }\n            wait(for: [sectionExp], timeout: 10)\n            sectionExp = XCTestExpectation()\n        }\n    }\n\n    func testBasicWithNotificationToken() {\n        var exp = XCTestExpectation()\n        var calls = 0\n        let sectionedResults = collection.sectioned(by: \\.key)\n        cancellable = sectionedResults.collectionPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .assertNoFailure()\n            .sink { c in\n                if c.count != 0 {\n                    XCTAssertEqual(c[0].count, calls)\n                }\n                calls += 1\n                exp.fulfill()\n            }\n        XCTAssertNotNil(notificationToken)\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n            exp = XCTestExpectation()\n        }\n\n        var sectionExp = XCTestExpectation()\n        var sectionCalls = 10\n        notificationToken = nil\n        cancellable = sectionedResults[0].collectionPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .assertNoFailure()\n            .sink { c in\n                XCTAssertEqual(c.count, sectionCalls)\n                sectionCalls -= 1\n                sectionExp.fulfill()\n            }\n        XCTAssertNotNil(notificationToken)\n        for _ in 0..<sectionCalls {\n            try! realm.write { realm.delete(collection.last!) }\n            wait(for: [sectionExp], timeout: 10)\n            sectionExp = XCTestExpectation()\n        }\n    }\n\n    func testBasicWithoutNotifying() {\n        var calls = 0\n        let sectionedResults = collection.sectioned(by: \\.key)\n        cancellable = sectionedResults\n            .collectionPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .assertNoFailure()\n            .sink { _ in\n                calls += 1\n            }\n        XCTAssertNotNil(notificationToken)\n        for _ in 0..<10 {\n            try! realm.write(withoutNotifying: [notificationToken!]) { collection.appendObject() }\n            XCTAssertEqual(calls, 1) // 1 for the initial notification\n        }\n\n        var sectionCalls = 0\n        notificationToken = nil\n        cancellable = sectionedResults[0]\n            .collectionPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .assertNoFailure()\n            .sink { _ in\n                sectionCalls -= 1\n            }\n        XCTAssertNotNil(notificationToken)\n        for _ in 0..<9 {\n            try! realm.write(withoutNotifying: [notificationToken!]) { realm.delete(collection.last!) }\n            XCTAssertEqual(calls, 1) // 1 for the initial notification\n        }\n    }\n\n    func testChangeSet() {\n        var exp = XCTestExpectation(description: \"initial\")\n        var calls = 0\n        let sectionedResults = collection.sectioned(by: \\.key)\n        cancellable = sectionedResults.changesetPublisher\n            .sink { change in\n                checkChangeset(change, insertions: [IndexPath(item: calls - 1, section: 0)])\n                calls += 1\n                exp.fulfill()\n            }\n        wait(for: [exp], timeout: 10)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n\n        var sectionExp = XCTestExpectation(description: \"change\")\n        var sectionCalls = 10\n        cancellable = sectionedResults[0].changesetPublisher\n            .sink { change in\n                checkChangeset(change, deletions: [IndexPath(item: sectionCalls, section: 0)])\n                sectionCalls -= 1\n                sectionExp.fulfill()\n            }\n        for _ in 0..<9 {\n            sectionExp = XCTestExpectation(description: \"change\")\n            try! realm.write { realm.delete(collection.last!) }\n            wait(for: [sectionExp], timeout: 10)\n        }\n    }\n\n    func testChangeSetWithToken() {\n        var exp = XCTestExpectation(description: \"initial\")\n        var calls = 0\n        let sectionedResults = collection.sectioned(by: \\.key)\n        cancellable = sectionedResults\n            .changesetPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .sink { change in\n                checkChangeset(change, insertions: [IndexPath(item: calls - 1, section: 0)])\n                calls += 1\n                exp.fulfill()\n            }\n        wait(for: [exp], timeout: 10)\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n\n        var sectionExp = XCTestExpectation(description: \"change\")\n        var sectionCalls = 10\n        notificationToken = nil\n        cancellable = sectionedResults[0]\n            .changesetPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .sink { change in\n                checkChangeset(change, deletions: [IndexPath(item: sectionCalls, section: 0)])\n                sectionCalls -= 1\n                sectionExp.fulfill()\n            }\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<9 {\n            sectionExp = XCTestExpectation(description: \"change\")\n            try! realm.write { realm.delete(collection.last!) }\n            wait(for: [sectionExp], timeout: 10)\n        }\n    }\n\n    func testChangeSetWithoutNotifying() {\n        var calls = 0\n        let sectionedResults = collection.sectioned(by: \\.key)\n        cancellable = sectionedResults\n            .changesetPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .sink { _ in\n                calls += 1\n            }\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            try! realm.write(withoutNotifying: [notificationToken!]) { collection.appendObject() }\n            XCTAssertEqual(calls, 1) // 1 for the initial observation\n        }\n\n        var sectionCalls = 0\n        cancellable = sectionedResults[0]\n            .changesetPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .sink { _ in\n                sectionCalls += 1\n            }\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            try! realm.write(withoutNotifying: [notificationToken!]) { collection.appendObject() }\n            XCTAssertEqual(sectionCalls, 1) // 1 for the initial observation\n        }\n    }\n\n    func testSubscribeOn() {\n        let sema = DispatchSemaphore(value: 0)\n        var calls = 0\n        let sectionedResults = collection.sectioned(by: \\.key)\n        cancellable = sectionedResults\n            .collectionPublisher\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                if r.count != 0 {\n                    XCTAssertEqual(r[0].count, calls)\n                }\n                calls += 1\n                sema.signal()\n        }\n        sema.wait()\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            sema.wait()\n        }\n\n        var sectionCalls = collection.count\n        cancellable = sectionedResults[0]\n            .collectionPublisher\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                XCTAssertEqual(r.count, sectionCalls)\n                sectionCalls += 1\n                sema.signal()\n        }\n        sema.wait()\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            sema.wait()\n        }\n    }\n\n    func testSubscribeOnKeyPath() {\n        var ex = expectation(description: \"initial notification\")\n        let sectionedResults = collection.sectioned(by: \\.key)\n\n        cancellable = sectionedResults.collectionPublisher(keyPaths: collection.includedKeyPath)\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink { _ in ex.fulfill()\n        }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"change notification\")\n        try! realm.write { collection.appendObject() }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"change notification\")\n        try! realm.write { collection.modifyObject() }\n        wait(for: [ex], timeout: 1.0)\n\n        cancellable?.cancel()\n        var sectionEx = expectation(description: \"initial notification\")\n\n        cancellable = sectionedResults[0].collectionPublisher(keyPaths: collection.includedKeyPath)\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink { _ in\n                sectionEx.fulfill()\n        }\n        wait(for: [sectionEx], timeout: 1.0)\n\n        sectionEx = expectation(description: \"change notification\")\n        try! realm.write { collection.appendObject() }\n        wait(for: [sectionEx], timeout: 1.0)\n\n        sectionEx = expectation(description: \"change notification\")\n        try! realm.write { collection.modifyObject() }\n        wait(for: [sectionEx], timeout: 1.0)\n    }\n\n    func testSubscribeOnKeyPathNoChange() {\n        var ex = expectation(description: \"initial notification\")\n        let sectionedResults = collection.sectioned(by: \\.key)\n\n        cancellable = sectionedResults.collectionPublisher(keyPaths: collection.excludedKeyPath)\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink { _ in ex.fulfill()\n        }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"change notification\")\n        try! realm.write { collection.appendObject() }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"no change notification\")\n        ex.isInverted = true\n        try! realm.write { collection.modifyObject() }\n        wait(for: [ex], timeout: 1.0)\n\n        var sectionEx = expectation(description: \"initial notification\")\n        cancellable?.cancel()\n        cancellable = sectionedResults[0].collectionPublisher(keyPaths: collection.excludedKeyPath)\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink { _ in\n                sectionEx.fulfill()\n        }\n        wait(for: [sectionEx], timeout: 1.0)\n\n        sectionEx = expectation(description: \"change notification\")\n        try! realm.write { collection.appendObject() }\n        wait(for: [sectionEx], timeout: 1.0)\n\n        sectionEx = expectation(description: \"no change notification\")\n        sectionEx.isInverted = true\n        try! realm.write { collection.modifyObject() }\n        wait(for: [sectionEx], timeout: 1.0)\n    }\n\n    func testSubscribeOnWithToken() {\n        let sema = DispatchSemaphore(value: 0)\n        var calls = 0\n        let sectionedResults = collection.sectioned(by: \\.key)\n\n        cancellable = sectionedResults\n            .collectionPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                if r.count != 0 {\n                    XCTAssertEqual(r[0].count, calls)\n                }\n                calls += 1\n                sema.signal()\n        }\n        sema.wait()\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            sema.wait()\n        }\n\n        var sectionCalls = collection.count\n        cancellable = sectionedResults[0]\n            .collectionPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                XCTAssertEqual(r.count, sectionCalls)\n                sectionCalls += 1\n                sema.signal()\n        }\n        sema.wait()\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            sema.wait()\n        }\n    }\n\n    func testReceiveOn() {\n        var calls = 0\n        var exp = XCTestExpectation(description: \"initial\")\n\n        cancellable = collection.sectioned(by: \\.key).collectionPublisher\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                if r.count != 0 {\n                    XCTAssertEqual(r[0].count, calls)\n                }\n                calls += 1\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 10)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n\n        var sectionCalls = collection.count\n        var sectionExp = XCTestExpectation(description: \"initial\")\n\n        cancellable = collection.sectioned(by: \\.key)[0].collectionPublisher\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                XCTAssertEqual(r.count, sectionCalls)\n                sectionCalls += 1\n                sectionExp.fulfill()\n        }\n        wait(for: [sectionExp], timeout: 10)\n\n        for _ in 0..<10 {\n            sectionExp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [sectionExp], timeout: 10)\n        }\n    }\n\n    func testReceiveOnWithToken() {\n        var calls = 0\n        var exp = XCTestExpectation(description: \"initial\")\n        cancellable = collection.sectioned(by: \\.key)\n            .collectionPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                if r.count != 0 {\n                    XCTAssertEqual(r[0].count, calls)\n                }\n                calls += 1\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 10)\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n\n        var sectionCalls = collection.count\n        var sectionExp = XCTestExpectation(description: \"initial\")\n        cancellable = collection.sectioned(by: \\.key)[0]\n            .collectionPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                if r.count != 0 {\n                    XCTAssertEqual(r.count, sectionCalls)\n                }\n                sectionCalls += 1\n                sectionExp.fulfill()\n        }\n        wait(for: [sectionExp], timeout: 10)\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            sectionExp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [sectionExp], timeout: 10)\n        }\n    }\n\n    func testChangeSetSubscribeOn() {\n        var calls = 0\n        let sema = DispatchSemaphore(value: 0)\n        cancellable = collection.sectioned(by: \\.key)\n            .changesetPublisher\n            .subscribe(on: subscribeOnQueue)\n            .sink { change in\n                checkChangeset(change, insertions: [IndexPath(item: calls - 1, section: 0)])\n                calls += 1\n                sema.signal()\n        }\n        sema.wait()\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            sema.wait()\n        }\n\n        var sectionCalls = collection.count\n        cancellable = collection.sectioned(by: \\.key)\n            .changesetPublisher\n            .subscribe(on: subscribeOnQueue)\n            .sink { change in\n                checkChangeset(change, insertions: [IndexPath(item: sectionCalls - 1, section: 0)])\n                sectionCalls += 1\n                sema.signal()\n        }\n        sema.wait()\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            sema.wait()\n        }\n    }\n\n    func testChangeSetSubscribeOnKeyPath() {\n        var ex = expectation(description: \"initial notification\")\n\n        cancellable = collection.sectioned(by: \\.key)\n            .changesetPublisher(keyPaths: collection.includedKeyPath)\n            .subscribe(on: subscribeOnQueue)\n            .sink { _ in ex.fulfill()\n        }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"change notification\")\n        try! realm.write {\n            collection.appendObject()\n\n        }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"change notification\")\n        try! realm.write {\n            collection.modifyObject()\n\n        }\n        wait(for: [ex], timeout: 1.0)\n\n        var sectionEx = expectation(description: \"initial notification\")\n\n        cancellable = collection.sectioned(by: \\.key)[0]\n            .changesetPublisher(keyPaths: collection.includedKeyPath)\n            .subscribe(on: subscribeOnQueue)\n            .sink { _ in sectionEx.fulfill()\n        }\n        wait(for: [sectionEx], timeout: 1.0)\n\n        sectionEx = expectation(description: \"change notification\")\n        try! realm.write {\n            collection.appendObject()\n        }\n        wait(for: [sectionEx], timeout: 1.0)\n\n        sectionEx = expectation(description: \"change notification\")\n        try! realm.write {\n            collection.modifyObject()\n        }\n        wait(for: [sectionEx], timeout: 1.0)\n    }\n\n    func testChangeSetSubscribeOnKeyPathNoChange() {\n        var ex = expectation(description: \"initial notification\")\n\n        cancellable = collection.sectioned(by: \\.key)\n            .changesetPublisher(keyPaths: collection.excludedKeyPath)\n            .subscribe(on: subscribeOnQueue)\n            .sink { _ in ex.fulfill()\n        }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"change notification\")\n        try! realm.write { collection.appendObject() }\n        wait(for: [ex], timeout: 1.0)\n\n        ex = expectation(description: \"no change notification\")\n        ex.isInverted = true\n        try! realm.write { collection.modifyObject() }\n        wait(for: [ex], timeout: 1.0)\n\n        var sectionEx = expectation(description: \"initial notification\")\n\n        cancellable = collection.sectioned(by: \\.key)[0]\n            .changesetPublisher(keyPaths: collection.excludedKeyPath)\n            .subscribe(on: subscribeOnQueue)\n            .sink { _ in sectionEx.fulfill()\n        }\n        wait(for: [sectionEx], timeout: 1.0)\n\n        sectionEx = expectation(description: \"change notification\")\n        try! realm.write { collection.appendObject() }\n        wait(for: [sectionEx], timeout: 1.0)\n\n        sectionEx = expectation(description: \"no change notification\")\n        sectionEx.isInverted = true\n        try! realm.write { collection.modifyObject() }\n        wait(for: [sectionEx], timeout: 1.0)\n\n    }\n\n    func testChangeSetSubscribeOnWithToken() {\n        var calls = 0\n        let sema = DispatchSemaphore(value: 0)\n        cancellable = collection\n            .sectioned(by: \\.key)\n            .changesetPublisher\n            .subscribe(on: subscribeOnQueue)\n            .saveToken(on: self, at: \\.notificationToken)\n            .sink { change in\n                checkChangeset(change, insertions: [IndexPath(item: calls - 1, section: 0)])\n                calls += 1\n                sema.signal()\n        }\n        sema.wait()\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            sema.wait()\n        }\n\n        var sectionCalls = collection.count\n        cancellable = collection\n            .sectioned(by: \\.key)[0]\n            .changesetPublisher\n            .subscribe(on: subscribeOnQueue)\n            .saveToken(on: self, at: \\.notificationToken)\n            .sink { change in\n                checkChangeset(change, insertions: [IndexPath(item: sectionCalls - 1, section: 0)])\n                sectionCalls += 1\n                sema.signal()\n        }\n        sema.wait()\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            try! realm.write { collection.appendObject() }\n            sema.wait()\n        }\n    }\n\n    func testChangeSetReceiveOn() {\n        var exp = XCTestExpectation(description: \"initial\")\n        var calls = 0\n        cancellable = collection.sectioned(by: \\.key)\n            .changesetPublisher\n            .receive(on: receiveOnQueue)\n            .sink { change in\n                checkChangeset(change, insertions: [IndexPath(item: calls - 1, section: 0)])\n                calls += 1\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 10)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n\n        var sectionExp = XCTestExpectation(description: \"initial\")\n        var sectionCalls = collection.count\n        cancellable = collection.sectioned(by: \\.key)[0]\n            .changesetPublisher\n            .receive(on: receiveOnQueue)\n            .sink { change in\n                checkChangeset(change, insertions: [IndexPath(item: sectionCalls - 1, section: 0)])\n                sectionCalls += 1\n                sectionExp.fulfill()\n        }\n        wait(for: [sectionExp], timeout: 10)\n\n        for _ in 0..<10 {\n            sectionExp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [sectionExp], timeout: 10)\n        }\n    }\n\n    func testChangeSetReceiveOnWithToken() {\n        var exp = XCTestExpectation(description: \"initial\")\n        var calls = 0\n        cancellable = collection\n            .sectioned(by: \\.key)\n            .changesetPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .receive(on: receiveOnQueue)\n            .sink { change in\n                checkChangeset(change, insertions: [IndexPath(item: calls - 1, section: 0)])\n                calls += 1\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 10)\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n\n        var sectionExp = XCTestExpectation(description: \"initial\")\n        var sectionCalls = collection.count\n        cancellable = collection\n            .sectioned(by: \\.key)[0]\n            .changesetPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .receive(on: receiveOnQueue)\n            .sink { change in\n                checkChangeset(change, insertions: [IndexPath(item: sectionCalls - 1, section: 0)])\n                sectionCalls += 1\n                sectionExp.fulfill()\n        }\n        wait(for: [sectionExp], timeout: 10)\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            sectionExp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [sectionExp], timeout: 10)\n        }\n    }\n\n    func testMakeThreadSafe() {\n        var calls = 0\n        var exp = XCTestExpectation(description: \"initial\")\n        cancellable = collection\n            .sectioned(by: \\.key)\n            .collectionPublisher\n            .map { $0 }\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                if r.count != 0 {\n                    XCTAssertEqual(r[0].count, calls)\n                }\n                calls += 1\n                exp.fulfill()\n            }\n        wait(for: [exp], timeout: 10)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n\n        var sectionCalls = collection.count\n        var sectionExp = XCTestExpectation(description: \"initial\")\n        cancellable = collection\n            .sectioned(by: \\.key)[0]\n            .collectionPublisher\n            .map { $0 }\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink { r in\n                XCTAssertEqual(r.count, sectionCalls)\n                sectionCalls += 1\n                sectionExp.fulfill()\n            }\n        wait(for: [sectionExp], timeout: 10)\n\n        for _ in 0..<10 {\n            sectionExp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [sectionExp], timeout: 10)\n        }\n    }\n\n    func testMakeThreadSafeChangeset() {\n        var exp = XCTestExpectation(description: \"initial\")\n        var calls = 0\n        cancellable = collection.sectioned(by: \\.key)\n            .changesetPublisher\n            .map { $0 }\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .sink { change in\n                checkChangeset(change, insertions: [IndexPath(item: calls - 1, section: 0)])\n                calls += 1\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 10)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n\n        var sectionExp = XCTestExpectation(description: \"initial\")\n        var sectionCalls = collection.count\n        cancellable = collection.sectioned(by: \\.key)[0]\n            .changesetPublisher\n            .map { $0 }\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .sink { change in\n                checkChangeset(change, insertions: [IndexPath(item: sectionCalls - 1, section: 0)])\n                sectionCalls += 1\n                sectionExp.fulfill()\n        }\n        wait(for: [sectionExp], timeout: 10)\n\n        for _ in 0..<10 {\n            sectionExp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [sectionExp], timeout: 10)\n        }\n    }\n\n    func testMakeThreadSafeWithChangesetToken() {\n        var calls = 0\n        var exp = XCTestExpectation(description: \"initial\")\n        cancellable = collection\n            .sectioned(by: \\.key)\n            .changesetPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .map { $0 }\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .sink { change in\n                checkChangeset(change, insertions: [IndexPath(item: calls - 1, section: 0)])\n                calls += 1\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 10)\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [exp], timeout: 10)\n        }\n\n        var sectionCalls = collection.count\n        var sectionExp = XCTestExpectation(description: \"initial\")\n        cancellable = collection\n            .sectioned(by: \\.key)[0]\n            .changesetPublisher\n            .saveToken(on: self, at: \\.notificationToken)\n            .map { $0 }\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .sink { change in\n                checkChangeset(change, insertions: [IndexPath(item: sectionCalls - 1, section: 0)])\n                sectionCalls += 1\n                sectionExp.fulfill()\n        }\n        wait(for: [sectionExp], timeout: 10)\n        XCTAssertNotNil(notificationToken)\n\n        for _ in 0..<10 {\n            sectionExp = XCTestExpectation(description: \"change\")\n            try! realm.write { collection.appendObject() }\n            wait(for: [sectionExp], timeout: 10)\n        }\n    }\n\n    func testFrozen() {\n        let exp = XCTestExpectation()\n        let objectsCount = 10\n\n        cancellable = collection.sectioned(by: \\.key)\n            .collectionPublisher\n            .freeze()\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { sections in\n                XCTAssertEqual(sections.count, 10)\n                for (i, collection) in sections.enumerated() {\n                    XCTAssertTrue(collection.isFrozen)\n                    if collection.count != 0 {\n                        XCTAssertEqual(collection[0].count, i)\n                    }\n                }\n                exp.fulfill()\n        }\n\n        for _ in 0..<objectsCount {\n            try! realm.write { collection.appendObject() }\n        }\n        wait(for: [exp], timeout: 10)\n\n        let sectionExp = XCTestExpectation()\n        cancellable = collection.sectioned(by: \\.key)[0]\n            .collectionPublisher\n            .freeze()\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                XCTAssertEqual(arr.count, 10)\n                for (i, collection) in arr.enumerated() {\n                    XCTAssertTrue(collection.isFrozen)\n                    XCTAssertEqual(collection.count - objectsCount, i)\n                }\n                sectionExp.fulfill()\n        }\n\n        for _ in 0..<objectsCount {\n            try! realm.write { collection.appendObject() }\n        }\n        wait(for: [sectionExp], timeout: 10)\n    }\n\n    func testFrozenChangeSetSubscribeOn() {\n        let sema = DispatchSemaphore(value: 0)\n        let objectsCount = 10\n\n        cancellable = collection.sectioned(by: \\.key)\n            .changesetPublisher\n            .subscribe(on: subscribeOnQueue)\n            .freeze()\n            .assertNoFailure()\n            .signal(sema)\n            .prefix(10)\n            .collect()\n            .sink { @Sendable arr in\n                XCTAssertEqual(arr.count, 10)\n                for (i, change) in arr.enumerated() {\n                    checkChangeset(change, insertions: [IndexPath(item: i - 1, section: 0)], frozen: true)\n                }\n                sema.signal()\n            }\n\n        for _ in 0..<objectsCount {\n            sema.wait()\n            try! realm.write { collection.appendObject() }\n        }\n        sema.wait()\n\n        cancellable = collection.sectioned(by: \\.key)[0]\n            .changesetPublisher\n            .subscribe(on: subscribeOnQueue)\n            .freeze()\n            .assertNoFailure()\n            .signal(sema)\n            .prefix(10)\n            .collect()\n            .sink { @Sendable arr in\n                XCTAssertEqual(arr.count, objectsCount)\n                for (i, change) in arr.enumerated() {\n                    checkChangeset(change, insertions: [IndexPath(item: (i + objectsCount) - 1, section: 0)], frozen: true)\n                }\n                sema.signal()\n            }\n\n        for _ in 0..<objectsCount {\n            sema.wait()\n            try! realm.write { collection.appendObject() }\n        }\n        sema.wait()\n    }\n\n    func testFrozenChangeSetReceiveOn() {\n        let exp = XCTestExpectation()\n        let objectsCount = 10\n\n        cancellable = collection.sectioned(by: \\.key)\n            .changesetPublisher\n            .freeze()\n            .receive(on: receiveOnQueue)\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                XCTAssertEqual(arr.count, 10)\n                for (i, change) in arr.enumerated() {\n                    checkChangeset(change, insertions: [IndexPath(item: i - 1, section: 0)], frozen: true)\n                }\n                exp.fulfill()\n        }\n\n        for _ in 0..<objectsCount {\n            try! realm.write { collection.appendObject() }\n        }\n        wait(for: [exp], timeout: 10)\n\n        let sectionExp = XCTestExpectation()\n        cancellable = collection.sectioned(by: \\.key)[0]\n            .changesetPublisher\n            .freeze()\n            .receive(on: receiveOnQueue)\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                XCTAssertEqual(arr.count, objectsCount)\n                for (i, change) in arr.enumerated() {\n                    checkChangeset(change, insertions: [IndexPath(item: (i + objectsCount) - 1, section: 0)], frozen: true)\n                }\n                sectionExp.fulfill()\n        }\n\n        for _ in 0..<objectsCount {\n            try! realm.write { collection.appendObject() }\n        }\n        wait(for: [sectionExp], timeout: 10)\n    }\n\n    func testFrozenChangeSetSubscribeOnAndReceiveOn() {\n        let sema = DispatchSemaphore(value: 0)\n        let objectsCount = 10\n\n        cancellable = collection.sectioned(by: \\.key)\n            .changesetPublisher\n            .subscribe(on: subscribeOnQueue)\n            .freeze()\n            .receive(on: receiveOnQueue)\n            .signal(sema)\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                for (i, change) in arr.enumerated() {\n                    checkChangeset(change, insertions: [IndexPath(item: i - 1, section: 0)], frozen: true)\n                }\n                sema.signal()\n        }\n\n        for _ in 0..<objectsCount {\n            sema.wait()\n            try! realm.write { collection.appendObject() }\n        }\n        sema.wait()\n\n        cancellable = collection.sectioned(by: \\.key)[0]\n            .changesetPublisher\n            .subscribe(on: subscribeOnQueue)\n            .freeze()\n            .receive(on: receiveOnQueue)\n            .signal(sema)\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                for (i, change) in arr.enumerated() {\n                    checkChangeset(change, insertions: [IndexPath(item: (i + objectsCount) - 1, section: 0)], frozen: true)\n                }\n                sema.signal()\n        }\n\n        for _ in 0..<objectsCount {\n            sema.wait()\n            try! realm.write { collection.appendObject() }\n        }\n        sema.wait()\n    }\n\n    func testFrozenMakeThreadSafe() {\n        let sema = DispatchSemaphore(value: 0)\n        let objectsCount = 10\n\n        cancellable = collection.sectioned(by: \\.key)\n            .collectionPublisher\n            .freeze()\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                for (i, collection) in arr.enumerated() {\n                    XCTAssertTrue(collection.isFrozen)\n                    if collection.count != 0 {\n                        XCTAssertEqual(collection.count, 1)\n                        XCTAssertEqual(collection[0].count, i)\n                    }\n                }\n                sema.signal()\n            }\n\n        for _ in 0..<objectsCount {\n            try! realm.write { collection.appendObject() }\n        }\n        sema.wait()\n\n        cancellable = collection.sectioned(by: \\.key)[0]\n            .collectionPublisher\n            .freeze()\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                for (i, collection) in arr.enumerated() {\n                    XCTAssertTrue(collection.isFrozen)\n                    if collection.count != 0 {\n                        XCTAssertEqual(collection.count, i + objectsCount)\n                    }\n                }\n                sema.signal()\n            }\n\n        for _ in 0..<objectsCount {\n            try! realm.write { collection.appendObject() }\n        }\n        sema.wait()\n    }\n\n    func testFrozenMakeThreadSafeChangeset() {\n        let exp = XCTestExpectation()\n        let objectsCount = 10\n\n        cancellable = collection.sectioned(by: \\.key)\n            .changesetPublisher\n            .freeze()\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                for (i, change) in arr.enumerated() {\n                    checkChangeset(change, insertions: [IndexPath(item: i - 1, section: 0)], frozen: true)\n                }\n                exp.fulfill()\n        }\n\n        for _ in 0..<objectsCount {\n            try! realm.write { collection.appendObject() }\n        }\n        wait(for: [exp], timeout: 10)\n\n        let sectionExp = XCTestExpectation()\n        cancellable = collection.sectioned(by: \\.key)[0]\n            .changesetPublisher\n            .freeze()\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .prefix(10)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                for (i, change) in arr.enumerated() {\n                    checkChangeset(change, insertions: [IndexPath(item: (i + objectsCount) - 1, section: 0)], frozen: true)\n                }\n                sectionExp.fulfill()\n        }\n\n        for _ in 0..<objectsCount {\n            try! realm.write { collection.appendObject() }\n        }\n        wait(for: [sectionExp], timeout: 10)\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\n// swiftlint:disable:next type_name\nclass ResultsWithSectionedResultsPublisherTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        return CombineSectionedResultsPublisherTests<Results<ModernAllTypesObject>>.testSuite(\"Results\")\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\n// swiftlint:disable:next type_name\nclass ManagedListSectionedResultsPublisherTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        return CombineSectionedResultsPublisherTests<List<ModernAllTypesObject>>.testSuite(\"List\")\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\n// swiftlint:disable:next type_name\nclass ManagedMutableSetSectionedResultsPublisherTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        return CombineSectionedResultsPublisherTests<MutableSet<ModernAllTypesObject>>.testSuite(\"MutableSet\")\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\n// swiftlint:disable:next type_name\nclass LinkingObjectsSectionedResultsPublisherTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        return CombineSectionedResultsPublisherTests<LinkingObjects<ModernAllTypesObject>>.testSuite(\"LinkingObjects\")\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\n// swiftlint:disable:next type_name\nclass AnyRealmCollectionSectionedResultsPublisherTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        return CombineSectionedResultsPublisherTests<AnyRealmCollection<ModernAllTypesObject>>.testSuite(\"AnyRealmCollection\")\n    }\n}\n\n// MARK: - Projection\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\nextension SimpleObject: ObjectKeyIdentifiable {\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\nextension SimpleProjection: ObjectKeyIdentifiable {\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\npublic final class AltSimpleProjection: Projection<SimpleObject>, ObjectKeyIdentifiable {\n    @Projected(\\SimpleObject.int) var int\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\nclass CombineProjectionPublisherTests: CombinePublisherTestCase {\n\n    var object: SimpleObject!\n    var projection: SimpleProjection!\n\n    override func setUp() {\n        super.setUp()\n        try! realm.write {\n            object = realm.create(SimpleObject.self)\n        }\n        projection = realm.objects(SimpleProjection.self).first!\n    }\n\n    func testWillChange() {\n        let exp = XCTestExpectation()\n        cancellable = projection.objectWillChange.sink {\n            exp.fulfill()\n        }\n        try! realm.write { object.int = 1 }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testWillChangeWithToken() {\n        let exp = XCTestExpectation()\n        cancellable = projection\n            .objectWillChange\n            .saveToken(on: self, at: \\.notificationToken)\n            .sink {\n            exp.fulfill()\n        }\n        XCTAssertNotNil(notificationToken)\n        try! realm.write { object.int = 1 }\n    }\n\n    func testChange() {\n        let exp = XCTestExpectation()\n        cancellable = valuePublisher(projection)\n            .assertNoFailure()\n            .sink { o in\n            XCTAssertEqual(self.projection, o)\n            exp.fulfill()\n        }\n\n        try! realm.write { object.int = 1 }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testChangeSet() {\n        let exp = XCTestExpectation()\n        cancellable = changesetPublisher(projection)\n            .assertNoFailure()\n            .sink { change in\n                if case .change(let p, let properties) = change {\n                    XCTAssertEqual(self.projection, p)\n                    XCTAssertEqual(properties.count, 1)\n                    XCTAssertEqual(properties[0].name, \"int\")\n                    XCTAssertNil(properties[0].oldValue)\n                    XCTAssertEqual(properties[0].newValue as? Int, 1)\n                } else {\n                    XCTFail(\"Expected .change but got \\(change)\")\n                }\n                exp.fulfill()\n            }\n        try! realm.write { object.int = 1 }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testDelete() {\n        let exp = XCTestExpectation()\n        cancellable = valuePublisher(projection)\n            .sink(receiveCompletion: { _ in exp.fulfill() },\n                  receiveValue: { _ in })\n        try! realm.write { realm.delete(object) }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testSubscribeOn() {\n        let ex = watchForNotifierAdded()\n        let sema = DispatchSemaphore(value: 0)\n        var i = 1\n        cancellable = valuePublisher(projection)\n            .subscribe(on: subscribeOnQueue)\n            .map { projection -> SimpleProjection in\n                sema.signal()\n                XCTAssertEqual(projection.int, i)\n                i += 1\n                return projection\n            }\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                XCTAssertEqual(arr.count, 10)\n                sema.signal()\n            }\n        wait(for: [ex], timeout: 2.0)\n\n        for _ in 0..<10 {\n            try! realm.write { object.int += 1 }\n            // wait between each write so that the notifications can't get coalesced\n            // also would deadlock if the subscription was on the main thread\n            sema.wait()\n        }\n        try! realm.write { realm.delete(object) }\n        sema.wait()\n    }\n\n    func testReceiveOn() {\n        var exp = XCTestExpectation()\n        cancellable = valuePublisher(projection)\n            .receive(on: receiveOnQueue)\n            .map { projection -> Int in\n                exp.fulfill()\n                return projection.int\n            }\n            .collect()\n            .assertNoFailure()\n            .sink { arr in\n                XCTAssertEqual(arr.count, 10)\n                for i in 1..<10 {\n                    XCTAssertTrue(arr.contains(i))\n                }\n                exp.fulfill()\n            }\n\n        for _ in 0..<10 {\n            try! realm.write { object.int += 1 }\n            wait(for: [exp], timeout: 10)\n            exp = XCTestExpectation()\n        }\n        try! realm.write { realm.delete(object) }\n        wait(for: [exp], timeout: 10)\n    }\n\n    func testChangeSetSubscribeOn() {\n        let sema = DispatchSemaphore(value: 0)\n\n        let ex = watchForNotifierAdded()\n        var prevProj: SimpleProjection?\n        cancellable = changesetPublisher(projection)\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink(receiveCompletion: { _ in sema.signal() }, receiveValue: { change in\n                if case .change(let p, let properties) = change {\n                    XCTAssertNotEqual(self.projection, p)\n                    XCTAssertEqual(properties.count, 1)\n                    XCTAssertEqual(properties[0].name, \"int\")\n                    if let prevProj = prevProj {\n                        XCTAssertEqual(properties[0].oldValue as? Int, prevProj.int)\n                    }\n                    XCTAssertEqual(properties[0].newValue as? Int, p.int)\n                    prevProj = p.freeze()\n                    XCTAssertEqual(prevProj!.int, p.int)\n\n                    if p.int == 100 {\n                        sema.signal()\n                    }\n                } else {\n                    XCTFail(\"Expected .change but got \\(change)\")\n                }\n            })\n        wait(for: [ex], timeout: 2.0)\n\n        for _ in 0..<100 {\n            try! realm.write { object.int += 1 }\n        }\n        sema.wait()\n        try! realm.write { realm.delete(object) }\n\n        sema.wait()\n        XCTAssertNotNil(prevProj)\n        XCTAssertEqual(prevProj!.int, 100)\n    }\n\n    func testChangeSetSubscribeOnKeyPath() {\n        let sema = DispatchSemaphore(value: 0)\n\n        let ex = watchForNotifierAdded()\n        var prevProj: SimpleProjection?\n        cancellable = changesetPublisher(projection, keyPaths: [\"int\"])\n            .subscribe(on: subscribeOnQueue)\n            .assertNoFailure()\n            .sink(receiveCompletion: { _ in sema.signal() }, receiveValue: { change in\n                if case .change(let p, let properties) = change {\n                    XCTAssertNotEqual(self.projection, p)\n                    XCTAssertEqual(properties.count, 1)\n                    XCTAssertEqual(properties[0].name, \"int\")\n                    if let prevProj = prevProj {\n                        XCTAssertEqual(properties[0].oldValue as? Int, prevProj.int)\n                    }\n                    XCTAssertEqual(properties[0].newValue as? Int, p.int)\n                    prevProj = p.freeze()\n                    XCTAssertEqual(prevProj!.int, p.int)\n\n                    if p.int >= 100 {\n                        sema.signal()\n                    }\n                } else {\n                    XCTFail(\"Expected .change but got \\(change)\")\n                }\n            })\n        wait(for: [ex], timeout: 2.0)\n\n        for _ in 0..<100 {\n            try! realm.write { object.int += 1 }\n        }\n        sema.wait()\n\n        // The following two lines check if a write outside of\n        // the intended keyPath does *not* publish a\n        // change.\n        // If a changeset is published for boolCol, the test would fail\n        // above when checking for property name \"intCol\".\n        try! realm.write { object.bool = true }\n        try! realm.write { object.int += 1 }\n        sema.wait()\n\n        try! realm.write { realm.delete(object) }\n        sema.wait()\n\n        XCTAssertNotNil(prevProj)\n        XCTAssertEqual(prevProj!.int, 101)\n    }\n\n    func testChangeSetReceiveOn() {\n        var exp = XCTestExpectation(description: \"change\")\n\n        cancellable = changesetPublisher(projection)\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink(receiveCompletion: { _ in exp.fulfill() }, receiveValue: { change in\n                if case .change(let p, let properties) = change {\n                    XCTAssertNotEqual(self.projection, p)\n                    XCTAssertEqual(properties.count, 1)\n                    XCTAssertEqual(properties[0].name, \"int\")\n                    // oldValue is always nil because we subscribed on the thread doing the writing\n                    XCTAssertNil(properties[0].oldValue)\n                    XCTAssertEqual(properties[0].newValue as? Int, p.int)\n                } else {\n                    XCTFail(\"Expected .change but got \\(change)\")\n                }\n                exp.fulfill()\n            })\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { object.int += 1 }\n            wait(for: [exp], timeout: 1)\n        }\n        exp = XCTestExpectation(description: \"completion\")\n        try! realm.write { realm.delete(object) }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testChangeSetSubscribeOnAndReceiveOn() {\n        let sema = DispatchSemaphore(value: 0)\n\n        let ex = watchForNotifierAdded()\n        var prev: SimpleProjection?\n        cancellable = changesetPublisher(projection)\n            .subscribe(on: subscribeOnQueue)\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink(receiveCompletion: { _ in sema.signal() }, receiveValue: { change in\n                if case .change(let p, let properties) = change {\n                    XCTAssertNotEqual(self.projection, p)\n                    XCTAssertEqual(properties.count, 1)\n                    XCTAssertEqual(properties[0].name, \"int\")\n                    if let prev = prev {\n                        XCTAssertEqual(properties[0].oldValue as? Int, prev.int)\n                    }\n                    XCTAssertEqual(properties[0].newValue as? Int, p.int)\n                    prev = p.freeze()\n                    XCTAssertEqual(prev!.int, p.int)\n\n                    if p.int == 100 {\n                        sema.signal()\n                    }\n                    p.realm?.invalidate()\n                } else {\n                    XCTFail(\"Expected .change but got \\(change)\")\n                }\n            })\n        wait(for: [ex], timeout: 2.0)\n\n        for _ in 0..<100 {\n            try! realm.write { object.int += 1 }\n        }\n        sema.wait()\n        try! realm.write { realm.delete(object) }\n\n        sema.wait()\n        XCTAssertNotNil(prev)\n        XCTAssertEqual(prev!.int, 100)\n    }\n\n    func testChangeSetMakeThreadSafe() {\n        var exp = XCTestExpectation(description: \"change\")\n\n        cancellable = changesetPublisher(projection)\n            .map { $0 }\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink(receiveCompletion: { _ in exp.fulfill() }, receiveValue: { change in\n                if case .change(let p, let properties) = change {\n                    XCTAssertNotEqual(self.projection, p)\n                    XCTAssertEqual(properties.count, 1)\n                    XCTAssertEqual(properties[0].name, \"int\")\n                    XCTAssertNil(properties[0].oldValue)\n                    XCTAssertEqual(properties[0].newValue as? Int, p.int)\n                } else {\n                    XCTFail(\"Expected .change but got \\(change)\")\n                }\n                exp.fulfill()\n            })\n\n        for _ in 0..<10 {\n            exp = XCTestExpectation(description: \"change\")\n            try! realm.write { object.int += 1 }\n            wait(for: [exp], timeout: 1)\n        }\n        exp = XCTestExpectation(description: \"completion\")\n        try! realm.write { realm.delete(object) }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testFrozen() {\n        let exp = XCTestExpectation()\n\n        cancellable = valuePublisher(projection)\n            .freeze()\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                XCTAssertEqual(arr.count, 10)\n                for i in 0..<10 {\n                    XCTAssertEqual(arr[i].int, i + 1)\n                }\n                exp.fulfill()\n        }\n\n        for _ in 0..<10 {\n            try! realm.write { object.int += 1 }\n        }\n        try! realm.write { realm.delete(object) }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testFrozenPublisherSubscribeOn() {\n        let setupEx = watchForNotifierAdded()\n        let completeEx = expectation(description: \"pipeline complete\")\n        var gotValueEx: XCTestExpectation!\n        cancellable = valuePublisher(projection)\n            .subscribe(on: subscribeOnQueue)\n            .freeze()\n            .map { (v: SimpleProjection) -> SimpleProjection in\n                gotValueEx.fulfill()\n                return v\n            }\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                XCTAssertEqual(arr.count, 10)\n                for i in 0..<10 {\n                    XCTAssertEqual(arr[i].int, i + 1)\n                }\n                completeEx.fulfill()\n            }\n        wait(for: [setupEx], timeout: 2.0)\n        for _ in 0..<10 {\n            gotValueEx = expectation(description: \"got value\")\n            try! realm.write { object.int += 1 }\n            wait(for: [gotValueEx], timeout: 2.0)\n        }\n        try! realm.write { realm.delete(object) }\n        wait(for: [completeEx], timeout: 1)\n    }\n\n    func testFrozenChangeSetSubscribeOn() {\n        let setupEx = watchForNotifierAdded()\n        let sema = DispatchSemaphore(value: 0)\n        cancellable = changesetPublisher(projection)\n            .subscribe(on: subscribeOnQueue)\n            .freeze()\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                var prev: SimpleProjection?\n                for change in arr {\n                    guard case .change(let p, let properties) = change else {\n                        XCTFail(\"Expected .change but got \\(change)\")\n                        sema.signal()\n                        return\n                    }\n\n                    XCTAssertEqual(properties.count, 1)\n                    XCTAssertEqual(properties[0].name, \"int\")\n                    XCTAssertEqual(properties[0].newValue as? Int, p.int)\n                    if let prev = prev {\n                        XCTAssertEqual(properties[0].oldValue as? Int, prev.int)\n                    }\n                    prev = p\n                }\n                sema.signal()\n            }\n        wait(for: [setupEx], timeout: 2.0)\n\n        for _ in 0..<100 {\n            try! realm.write { object.int += 1 }\n        }\n        try! realm.write { realm.delete(object) }\n        sema.wait()\n    }\n\n    func testFrozenChangeSetReceiveOn() {\n        let exp = XCTestExpectation(description: \"sink complete\")\n        cancellable = changesetPublisher(projection)\n            .freeze()\n            .receive(on: receiveOnQueue)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                for change in arr {\n                    guard case .change(let p, let properties) = change else {\n                        XCTFail(\"Expected .change but got \\(change)\")\n                        exp.fulfill()\n                        return\n                    }\n\n                    XCTAssertEqual(properties.count, 1)\n                    XCTAssertEqual(properties[0].name, \"int\")\n                    XCTAssertEqual(properties[0].newValue as? Int, p.int)\n                    // subscribing on the thread making writes means that oldValue\n                    // is always nil\n                    XCTAssertNil(properties[0].oldValue)\n                }\n                exp.fulfill()\n        }\n\n        for _ in 0..<100 {\n            try! realm.write { object.int += 1 }\n        }\n        try! realm.write { realm.delete(object) }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testFrozenChangeSetSubscribeOnAndReceiveOn() {\n        let setupEx = watchForNotifierAdded()\n        let sema = DispatchSemaphore(value: 0)\n        cancellable = changesetPublisher(projection)\n            .subscribe(on: subscribeOnQueue)\n            .freeze()\n            .receive(on: receiveOnQueue)\n            .collect()\n            .assertNoFailure()\n            .sink { @Sendable arr in\n                var prev: SimpleProjection?\n                for change in arr {\n                    guard case .change(let p, let properties) = change else {\n                        XCTFail(\"Expected .change but got \\(change)\")\n                        sema.signal()\n                        return\n                    }\n\n                    XCTAssertEqual(properties.count, 1)\n                    XCTAssertEqual(properties[0].name, \"int\")\n                    XCTAssertEqual(properties[0].newValue as? Int, p.int)\n                    if let prev = prev {\n                        XCTAssertEqual(properties[0].oldValue as? Int, prev.int)\n                    }\n                    prev = p\n                }\n                sema.signal()\n            }\n        wait(for: [setupEx], timeout: 2.0)\n\n        for _ in 0..<100 {\n            try! realm.write { object.int += 1 }\n        }\n        try! realm.write { realm.delete(object) }\n        sema.wait()\n    }\n\n    func testReceiveOnAfterMap() {\n        var exp = XCTestExpectation()\n        cancellable = valuePublisher(projection)\n            .map { $0 }\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .map { projection -> Int in\n                exp.fulfill()\n                return projection.int\n            }\n            .collect()\n            .assertNoFailure()\n            .sink { arr in\n                XCTAssertEqual(arr.count, 10)\n                for i in 1..<10 {\n                    XCTAssertTrue(arr.contains(i))\n                }\n                exp.fulfill()\n            }\n\n        for _ in 0..<10 {\n            try! realm.write { object.int += 1 }\n            wait(for: [exp], timeout: 1)\n            exp = XCTestExpectation()\n        }\n        try! realm.write { realm.delete(object) }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testUnmanagedMakeThreadSafe() {\n        let projections = try! realm.write {\n            return [\n                SimpleProjection(projecting: realm.create(SimpleObject.self, value: [1])),\n                SimpleProjection(projecting: realm.create(SimpleObject.self, value: [2])),\n                SimpleProjection(projecting: realm.create(SimpleObject.self, value: [3]))\n            ]\n        }\n        let exp = XCTestExpectation()\n        cancellable = projections.publisher\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .map { $0.int }\n            .collect()\n            .sink { (arr: [Int]) in\n                XCTAssertEqual(arr, [1, 2, 3])\n                exp.fulfill()\n            }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testManagedMakeThreadSafe() {\n        let projections = try! realm.write {\n            return [\n                SimpleProjection(projecting: realm.create(SimpleObject.self, value: [1])),\n                SimpleProjection(projecting: realm.create(SimpleObject.self, value: [2])),\n                SimpleProjection(projecting: realm.create(SimpleObject.self, value: [3]))\n            ]\n        }\n\n        let exp = XCTestExpectation()\n        cancellable = projections.publisher\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .map { $0.int }\n            .collect()\n            .sink { (arr: [Int]) in\n                XCTAssertEqual(arr, [1, 2, 3])\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testFrozenMakeThreadSafe() {\n        var exp = XCTestExpectation()\n        cancellable = valuePublisher(projection)\n            .freeze()\n            .map { $0 }\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .assertNoFailure()\n            .sink { projection in\n                XCTAssertTrue(projection.isFrozen)\n                exp.fulfill()\n            }\n\n        for _ in 0..<10 {\n            try! realm.write { object.int += 1 }\n            wait(for: [exp], timeout: 1)\n            exp = XCTestExpectation()\n        }\n    }\n\n    func testMixedMakeThreadSafe() {\n        let realm2 = try! Realm(configuration: Realm.Configuration(inMemoryIdentifier: \"test2\"))\n        var projections = try! realm.write {\n            try! realm2.write {\n                return [\n                    SimpleProjection(projecting: realm.create(SimpleObject.self, value: [1])),\n                    SimpleProjection(projecting: realm2.create(SimpleObject.self, value: [2])),\n                    SimpleProjection(projecting: realm.create(SimpleObject.self, value: [3])),\n                    SimpleProjection(projecting: realm2.create(SimpleObject.self, value: [4]))\n                ]\n            }\n        }\n        projections[2] = projections[2].freeze()\n        projections[3] = projections[3].freeze()\n        let exp = XCTestExpectation()\n        cancellable = projections.publisher\n            .threadSafeReference()\n            .receive(on: receiveOnQueue)\n            .map { $0.int }\n            .collect()\n            .sink { (arr: [Int]) in\n                XCTAssertEqual(arr, [1, 2, 3, 4])\n                exp.fulfill()\n        }\n        wait(for: [exp], timeout: 1)\n    }\n\n    func testIdentifiable() {\n        let realm = realmWithTestPath()\n        try! realm.write {\n            realm.create(SimpleObject.self, value: [1])\n            realm.create(SimpleObject.self, value: [2])\n        }\n        let objects = realm.objects(SimpleObject.self)\n        let projections = realm.objects(SimpleProjection.self)\n\n        XCTAssertEqual(objects[0].id, objects[0].id)\n        XCTAssertEqual(objects[1].id, objects[1].id)\n        XCTAssertNotEqual(objects[0].id, objects[1].id)\n\n        XCTAssertEqual(projections[0].id, projections[0].id)\n        XCTAssertEqual(projections[1].id, projections[1].id)\n        XCTAssertNotEqual(projections[0].id, projections[1].id)\n\n        XCTAssertEqual(objects[0].id, projections[0].id)\n        XCTAssertEqual(objects[1].id, projections[1].id)\n\n        let altProjection = AltSimpleProjection(projecting: objects[0])\n        XCTAssertEqual(altProjection.id, projections[0].id)\n\n        let storedId = altProjection.id\n        try! realm.write {\n            altProjection.int += 1\n        }\n        XCTAssertEqual(storedId, altProjection.id)\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\nclass CombineAsyncRealmTests: CombinePublisherTestCase {\n    @MainActor\n    func testWillChangeLocalWrite() {\n        let asyncWriteExpectation = expectation(description: \"Should complete async write\")\n        cancellable = realm.objectWillChange.sink {\n                asyncWriteExpectation.fulfill()\n            }\n\n        realm.writeAsync {\n            self.realm.create(SwiftIntObject.self)\n        }\n        waitForExpectations(timeout: 1, handler: nil)\n    }\n\n    func testWillChangeRemoteWrite() {\n        let exp = XCTestExpectation()\n        cancellable = realm.objectWillChange.sink {\n            exp.fulfill()\n        }\n        queue.async {\n            let realm = try! Realm(configuration: self.realm.configuration, queue: self.queue)\n            realm.writeAsync {\n                realm.create(SwiftIntObject.self)\n            }\n        }\n        wait(for: [exp], timeout: 3)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/CompactionTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2017 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\nprivate func fileSize(path: String) -> Int {\n    let attributes = try! FileManager.default.attributesOfItem(atPath: path)\n    return attributes[.size] as! Int\n}\n\nclass CompactionTests: TestCase {\n    func testSuccessfulCompactOnLaunch() {\n        let expectedUsedBytesBeforeMin = 50000\n        let count = 1000\n\n        autoreleasepool {\n            // Make compactable Realm\n            let realm = realmWithTestPath()\n            let uuid = UUID().uuidString\n            try! realm.write {\n                realm.create(SwiftStringObject.self, value: [\"A\"])\n                for _ in 0..<count {\n                    realm.create(SwiftStringObject.self, value: [uuid])\n                }\n                realm.create(SwiftStringObject.self, value: [\"B\"])\n            }\n        }\n        let expectedTotalBytesBefore = fileSize(path: testRealmURL().path)\n\n        // Configure the Realm to compact on launch\n        let config = Realm.Configuration(fileURL: testRealmURL(),\n                                         shouldCompactOnLaunch: { totalBytes, usedBytes in\n            // Confirm expected sizes\n            XCTAssertEqual(totalBytes, expectedTotalBytesBefore)\n            XCTAssert((usedBytes < totalBytes) && (usedBytes > expectedUsedBytesBeforeMin))\n            return true\n        })\n\n        // Confirm expected sizes before and after opening the Realm\n        XCTAssertEqual(fileSize(path: config.fileURL!.path), expectedTotalBytesBefore)\n        let realm = try! Realm(configuration: config)\n        XCTAssertLessThan(fileSize(path: config.fileURL!.path), expectedTotalBytesBefore)\n\n        // Validate that the file still contains what it should\n        XCTAssertEqual(realm.objects(SwiftStringObject.self).count, count + 2)\n        XCTAssertEqual(\"A\", realm.objects(SwiftStringObject.self).first?.stringCol)\n        XCTAssertEqual(\"B\", realm.objects(SwiftStringObject.self).last?.stringCol)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/CustomColumnNameTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2022 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\n// MARK: - Custom Column Object Factory\n\nprotocol CustomColumnObjectFactory {\n    associatedtype Root: Object\n\n    static func create(primaryKey: ObjectId, nestedObject: Root?) -> Root\n    static func createValues(primaryKey: ObjectId) -> [String: Any]\n}\n\n// MARK: - Models\n\nlet propertiesModernCustomMapping: [String: String] =  [\"pk\": \"custom_pk\",\n                                                        \"intCol\": \"custom_intCol\",\n                                                        \"anyCol\": \"custom_anyCol\",\n                                                        \"intEnumCol\": \"custom_intEnumCol\",\n                                                        \"objectCol\": \"custom_objectCol\",\n                                                        \"arrayCol\": \"custom_arrayCol\",\n                                                        \"setCol\": \"custom_setCol\",\n                                                        \"mapCol\": \"custom_mapCol\",\n                                                        \"embeddedObject\": \"custom_embeddedObject\",\n                                                        \"arrayIntCol\": \"custom_arrayIntCol\",\n                                                        \"setIntCol\": \"custom_setIntCol\",\n                                                        \"mapIntCol\": \"custom_mapIntCol\"]\nclass ModernCustomObject: Object {\n    @Persisted(primaryKey: true) var pk: ObjectId\n    @Persisted var intCol: Int\n    @Persisted var anyCol: AnyRealmValue\n    @Persisted var intEnumCol: ModernIntEnum\n\n    @Persisted var objectCol: ModernCustomObject?\n    @Persisted var arrayCol = List<ModernCustomObject>()\n    @Persisted var setCol = MutableSet<ModernCustomObject>()\n    @Persisted var mapCol = Map<String, ModernCustomObject?>()\n\n    @Persisted var embeddedObject: EmbeddedModernCustomObject?\n\n    @Persisted var arrayIntCol = List<Int>()\n    @Persisted var setIntCol = MutableSet<Int>()\n    @Persisted var mapIntCol = Map<String, Int>()\n\n    override class func propertiesMapping() -> [String: String] {\n        propertiesModernCustomMapping\n    }\n\n    convenience init(pk: ObjectId) {\n        self.init()\n        self.pk = pk\n    }\n}\n\nlet propertiesModernEmbeddedCustomMapping: [String: String] =  [\"intCol\": \"custom_intCol\"]\nclass EmbeddedModernCustomObject: EmbeddedObject {\n    @Persisted var intCol: Int\n\n    override class func propertiesMapping() -> [String: String] {\n        propertiesModernEmbeddedCustomMapping\n    }\n}\n\nextension ModernCustomObject: CustomColumnObjectFactory {\n    typealias Root = ModernCustomObject\n\n    static func create(primaryKey: ObjectId, nestedObject: ModernCustomObject?) -> ModernCustomObject {\n        let object = ModernCustomObject()\n        object.pk = primaryKey\n\n        let linkedObject = ModernCustomObject()\n        linkedObject.pk = ObjectId.generate()\n        linkedObject.embeddedObject = EmbeddedModernCustomObject()\n\n        object.embeddedObject = EmbeddedModernCustomObject()\n\n        if let nestedObject = nestedObject {\n            object.anyCol = .object(nestedObject)\n            object.objectCol = nestedObject\n            object.arrayCol.append(nestedObject)\n            object.setCol.insert(nestedObject)\n            object.mapCol[\"key\"] = nestedObject\n        }\n        return object\n    }\n\n    static func createValues(primaryKey: ObjectId) -> [String: Any] {\n        return [\n            \"pk\": primaryKey,\n            \"intCol\": 123,\n            \"anyCol\": AnyRealmValue.int(345),\n            \"intEnumCol\": ModernIntEnum.value2,\n            \"objectCol\": ModernCustomObject(),\n            \"arrayCol\": [ModernCustomObject()],\n            \"setCol\": [ModernCustomObject()],\n            \"mapCol\": [\"key\": ModernCustomObject()],\n            \"embeddedObject\": EmbeddedModernCustomObject(),\n            \"arrayIntCol\": [123],\n            \"setIntCol\": [345],\n            \"mapIntCol\": [\"key\": 123]\n        ]\n    }\n}\n\nlet propertiesCustomMapping: [String: String] = {\n    [\"pk\": \"custom_pk\",\n     \"intCol\": \"custom_intCol\",\n     \"objectCol\": \"custom_objectCol\",\n     \"arrayCol\": \"custom_arrayCol\",\n     \"setCol\": \"custom_setCol\",\n     \"mapCol\": \"custom_mapCol\",\n     \"anyCol\": \"custom_anyCol\",\n     \"intEnumCol\": \"custom_intEnumCol\",\n     \"embeddedObject\": \"custom_embeddedObject\",\n     \"arrayIntCol\": \"custom_arrayIntCol\",\n     \"setIntCol\": \"custom_setIntCol\",\n     \"mapIntCol\": \"custom_mapIntCol\"]\n}()\n\nclass OldCustomObject: Object {\n    @objc dynamic var pk = ObjectId.generate()\n    @objc dynamic var intCol = 123\n    var anyCol = RealmProperty<AnyRealmValue>()\n    @objc dynamic var intEnumCol = IntEnum.value1\n\n    @objc dynamic var objectCol: OldCustomObject?\n    let arrayCol = List<OldCustomObject>()\n    let setCol = MutableSet<OldCustomObject>()\n    let mapCol = Map<String, OldCustomObject?>()\n\n    @objc dynamic var embeddedObject: EmbeddedCustomObject?\n\n    let arrayIntCol = List<Int>()\n    let setIntCol = MutableSet<Int>()\n    let mapIntCol = Map<String, Int?>()\n\n    override class func primaryKey() -> String? {\n        return \"pk\"\n    }\n    override class func propertiesMapping() -> [String: String] {\n        propertiesCustomMapping\n    }\n}\n\nextension OldCustomObject: CustomColumnObjectFactory {\n    typealias Root = OldCustomObject\n\n    static func create(primaryKey: ObjectId, nestedObject: OldCustomObject?) -> OldCustomObject {\n        let object = OldCustomObject()\n        object.pk = primaryKey\n        object.embeddedObject = EmbeddedCustomObject()\n\n        let linkedObject = OldCustomObject()\n        linkedObject.pk = ObjectId.generate()\n        linkedObject.embeddedObject = EmbeddedCustomObject()\n\n        if let nestedObject = nestedObject {\n            object.objectCol = nestedObject\n            object.arrayCol.append(nestedObject)\n            object.setCol.insert(nestedObject)\n            object.mapCol[\"key\"] = nestedObject\n        }\n        return object\n    }\n\n    static func createValues(primaryKey: ObjectId) -> [String: Any] {\n        return [\n            \"pk\": primaryKey,\n            \"intCol\": 123,\n            \"anyCol\": AnyRealmValue.int(345),\n            \"intEnumCol\": IntEnum.value2,\n            \"objectCol\": OldCustomObject(),\n            \"arrayCol\": [OldCustomObject()],\n            \"setCol\": [OldCustomObject()],\n            \"mapCol\": [\"key\": OldCustomObject()],\n            \"embeddedObject\": EmbeddedCustomObject(),\n            \"arrayIntCol\": [123],\n            \"setIntCol\": [345],\n            \"mapIntCol\": [\"key\": 123]\n        ]\n    }\n}\n\nlet propertiesEmbeddedCustomMapping: [String: String] = {\n    [\"intCol\": \"custom_intCol\"]\n}()\n\nclass EmbeddedCustomObject: EmbeddedObject {\n    @objc dynamic var intCol = 123\n\n    override class func propertiesMapping() -> [String: String] {\n        propertiesEmbeddedCustomMapping\n    }\n}\n\n// MARK: - Schema Discovery\n\nclass CustomColumnNamesSchemaTest: TestCase {\n    func testCustomColumnNameSchema() {\n        let modernCustomObjectSchema = ModernCustomObject().objectSchema\n        for property in modernCustomObjectSchema.properties {\n            XCTAssertEqual(propertiesModernCustomMapping[property.name], property.columnName)\n        }\n\n        let modernEmbeddedCustomObjectSchema = EmbeddedModernCustomObject().objectSchema\n        for property in modernEmbeddedCustomObjectSchema.properties {\n            XCTAssertEqual(propertiesModernEmbeddedCustomMapping[property.name], property.columnName)\n        }\n\n        let oldCustomObjectSchema = OldCustomObject().objectSchema\n        for property in oldCustomObjectSchema.properties {\n            XCTAssertEqual(propertiesCustomMapping[property.name], property.columnName)\n        }\n\n        let oldEmbeddedCustomObjectSchema = EmbeddedCustomObject().objectSchema\n        for property in oldEmbeddedCustomObjectSchema.properties {\n            XCTAssertEqual(propertiesEmbeddedCustomMapping[property.name], property.columnName)\n        }\n    }\n\n    func testDescriptionWithCustomColumnName() {\n        let modernCustomObjectSchema = ModernCustomObject().objectSchema\n        let modernObjectExpected = \"\"\"\n        ModernCustomObject {\n            pk {\n                type = object id;\n                columnName = custom_pk;\n                indexed = YES;\n                isPrimary = YES;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            intCol {\n                type = int;\n                columnName = custom_intCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            anyCol {\n                type = mixed;\n                columnName = custom_anyCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            intEnumCol {\n                type = int;\n                columnName = custom_intEnumCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            objectCol {\n                type = object;\n                objectClassName = ModernCustomObject;\n                linkOriginPropertyName = (null);\n                columnName = custom_objectCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = YES;\n            }\n            arrayCol {\n                type = object;\n                objectClassName = ModernCustomObject;\n                linkOriginPropertyName = (null);\n                columnName = custom_arrayCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = YES;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            setCol {\n                type = object;\n                objectClassName = ModernCustomObject;\n                linkOriginPropertyName = (null);\n                columnName = custom_setCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = YES;\n                dictionary = NO;\n                optional = NO;\n            }\n            mapCol {\n                type = object;\n                objectClassName = ModernCustomObject;\n                linkOriginPropertyName = (null);\n                columnName = custom_mapCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = YES;\n                optional = YES;\n            }\n            embeddedObject {\n                type = object;\n                objectClassName = EmbeddedModernCustomObject;\n                linkOriginPropertyName = (null);\n                columnName = custom_embeddedObject;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = YES;\n            }\n            arrayIntCol {\n                type = int;\n                columnName = custom_arrayIntCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = YES;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            setIntCol {\n                type = int;\n                columnName = custom_setIntCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = YES;\n                dictionary = NO;\n                optional = NO;\n            }\n            mapIntCol {\n                type = int;\n                columnName = custom_mapIntCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = YES;\n                optional = NO;\n            }\n        }\n        \"\"\"\n        XCTAssertEqual(modernCustomObjectSchema.description, modernObjectExpected.replacingOccurrences(of: \"    \", with: \"\\t\"))\n    }\n}\n\nclass CustomColumnModernDynamicObjectTest: TestCase {\n    var realm: Realm!\n\n    override func setUp() {\n        super.setUp()\n        realm = inMemoryRealm(\"CustomColumnTests\")\n        let object = ModernCustomObject.create(primaryKey: ObjectId(\"6058f12682b2fbb1f334ef1d\"), nestedObject: nil)\n        object.anyCol = .object(ModernCustomObject())\n        try! realm.write {\n            realm.add(object)\n        }\n    }\n\n    override func tearDown() {\n        realm = nil\n        super.tearDown()\n    }\n\n    func testCustomColumnDynamicObjectSubscript() throws {\n        let object = realm.object(ofType: ModernCustomObject.self, forPrimaryKey: ObjectId(\"6058f12682b2fbb1f334ef1d\"))!\n        guard let dynamicObject: DynamicObject = object.anyCol.dynamicObject else {\n            return XCTFail(\"DynamicObject does not exist\")\n        }\n\n        // Set Value / Get Value\n        try realm.write {\n            dynamicObject[_name(for: \\ModernCustomObject.intCol)] = 56789\n        }\n        XCTAssertEqual(dynamicObject[_name(for: \\ModernCustomObject.intCol)] as! Int, 56789)\n    }\n\n    func testCustomColumnDynamicObjectSetValue() throws {\n        let dynamicObjects = realm.dynamicObjects(\"ModernCustomObject\")\n        XCTAssertEqual(dynamicObjects.count, 2)\n        let dynamicObject = dynamicObjects.first!\n        XCTAssertNotNil(dynamicObject)\n\n        try realm.write {\n            dynamicObject.setValue(45678, forUndefinedKey: _name(for: \\ModernCustomObject.intCol))\n        }\n        XCTAssertEqual(dynamicObject.value(forUndefinedKey: _name(for: \\ModernCustomObject.intCol)) as! Int, 45678)\n    }\n\n    func testCustomColumnDynamicObjectMemberLookUp() throws {\n        let dynamicObjects = realm.dynamicObjects(\"ModernCustomObject\")\n        XCTAssertEqual(dynamicObjects.count, 2)\n        let dynamicObject = dynamicObjects.first!\n        XCTAssertNotNil(dynamicObject)\n\n        try realm.write {\n            dynamicObject.intCol = 98765\n        }\n        XCTAssertEqual( dynamicObject.intCol as! Int, 98765)\n    }\n\n    func testCustomColumnDynamicSchema() throws {\n        let dynamicObjects = realm.dynamicObjects(\"ModernCustomObject\")\n        XCTAssertEqual(dynamicObjects.count, 2)\n        let dynamicObject = dynamicObjects.first!\n        XCTAssertNotNil(dynamicObject)\n\n        let schema = dynamicObject.objectSchema\n        for property in schema.properties {\n            XCTAssertEqual(propertiesModernCustomMapping[property.name], property.columnName)\n        }\n    }\n}\n\nclass CustomColumnTestsBase<O: CustomColumnObjectFactory, F: CustomColumnTypeFactoryBase>: TestCase where O.Root == F.Root {\n    var realm: Realm!\n    public var notificationTokens: [NotificationToken] = []\n\n    var object: O.Root!\n    var nestedObject: O.Root!\n    var primaryKey: ObjectId!\n\n    override func setUp() {\n        realm = inMemoryRealm(\"CustomColumnTests\")\n        try! realm.write {\n            primaryKey = ObjectId(\"61184062c1d8f096a3695045\")\n            nestedObject = O.create(primaryKey: ObjectId.generate(), nestedObject: nil)\n            object = O.create(primaryKey: primaryKey, nestedObject: nestedObject)\n            for (keyPath, value) in F.keyPaths {\n                object.setValue(value, forKeyPath: _name(for: keyPath))\n            }\n            realm.add(object)\n        }\n    }\n\n    override func tearDown() {\n        object = nil\n        realm = nil\n        for token in notificationTokens {\n            token.invalidate()\n        }\n        notificationTokens = []\n    }\n\n    func setValue(_ value: F.ValueType, for keyPath: KeyPath<O.Root, F.ValueType>) throws {\n        try realm.write {\n            let keyPathString = _name(for: keyPath)\n            if keyPathString.components(separatedBy: \".\").count > 1 {\n                nestedObject[keyPathString.components(separatedBy: \".\").last!] = value\n            } else {\n                object[keyPathString] = value\n            }\n        }\n    }\n\n    override func invokeTest() {\n        autoreleasepool { super.invokeTest() }\n    }\n}\n\nclass CustomColumnResultsTestBase<O: CustomColumnObjectFactory, F: CustomColumnTypeFactoryBase>: CustomColumnTestsBase<O, F> where O.Root == F.Root, F.ValueType: Equatable {\n    var results: Results<O.Root>!\n\n    override func setUp() {\n        super.setUp()\n        results = realm.objects(O.Root.self)\n    }\n\n    override func tearDown() {\n        results = nil\n        super.tearDown()\n    }\n}\n\nclass CustomColumnResultsTest<O: CustomColumnObjectFactory, F: CustomColumnResultsTypeFactory>: CustomColumnResultsTestBase<O, F> where O.Root == F.Root, F.ValueType: Equatable {\n    // MARK: - Create Object\n\n    func testCustomColumnResultsCreate() throws {\n        let primaryKey = ObjectId.generate()\n        let objectValues = O.createValues(primaryKey: primaryKey)\n        try realm.write {\n            realm.create(O.Root.self, value: objectValues)\n        }\n        XCTAssertNotNil(realm.object(ofType: O.Root.self, forPrimaryKey: primaryKey))\n    }\n\n    // MARK: - Results Queries\n\n    func testCustomColumnResultsByPrimaryKey() throws {\n        XCTAssertEqual(realm.object(ofType: O.Root.self, forPrimaryKey: primaryKey), object)\n    }\n\n    // MARK: - Results Queries\n\n    func testCustomColumnResultsQueries() throws {\n        // Assert Queries\n        for (keyPath, query) in F.query {\n            assertQuery(query, keyPath: keyPath, expectedCount: 1)\n        }\n    }\n\n    func testCustomColumnResultsIndexMatching() throws {\n        // Assert Query Index Matching\n        for (_, query) in F.query {\n            assertIndexMatching(query, expectedIndex: 0)\n        }\n    }\n\n    // MARK: - Results Distinct & Sort\n\n    func testCustomColumnResultsDistinct() throws {\n        // Distinct by KeyPath\n        for (keyPath, count) in F.distincts {\n            assertDistinct(for: keyPath, count: count)\n        }\n    }\n\n    func testCustomColumnResultsSort() throws {\n        let object2 = O.create(primaryKey: ObjectId.generate(), nestedObject: O.create(primaryKey: ObjectId.generate(), nestedObject: nil))\n        try realm.write {\n            realm.add(object2)\n        }\n        // Sort by KeyPath\n        for (keyPath, value) in F.sort {\n            try realm.write {\n                object2.setValue(value, forKeyPath: _name(for: keyPath))\n            }\n            assertSort(for: keyPath, value: value)\n        }\n    }\n\n    // MARK: - Get/Set ValueForKey\n\n    func testCustomColumnResultsSetGetValueForKey() throws {\n        for (keyPath, value) in F.values {\n            try realm.write {\n                results.setValue(value, forKey: _name(for: keyPath))\n\n                let valuesForKey = results.value(forKey: _name(for: keyPath)) as! [F.ValueType]\n                XCTAssertNotNil(valuesForKey)\n            }\n        }\n    }\n\n    func testCustomColumnResultsGetValueForKeyPath() throws {\n        for (keyPath, _) in F.keyPaths {\n            let valuesForKeyPath = results.value(forKeyPath: _name(for: keyPath)) as! [F.ValueType?]\n            XCTAssertNotNil(valuesForKeyPath)\n        }\n    }\n\n    // MARK: - Observation\n\n    func testCustomColumnResultsPropertyObservation() throws {\n        for (keyPath, value) in F.values {\n            let ex = XCTestExpectation(description: \"Notification to be called\")\n            let notificationToken = results.observe(keyPaths: [keyPath]) { changes in\n                switch changes {\n                case .update(_, _, _, let modifications):\n                    XCTAssertGreaterThan(modifications.count, 0)\n                    ex.fulfill()\n                case .initial: break\n                default:\n                    XCTFail(\"No other changes are done to the object\")\n                }\n            }\n            notificationTokens.append(notificationToken)\n            try setValue(value, for: keyPath)\n\n            wait(for: [ex], timeout: 1.0)\n        }\n    }\n\n    // MARK: - Private\n\n    private func assertQuery(_ query: ((Query<O.Root>) -> Query<Bool>),\n                             keyPath: PartialKeyPath<O.Root>,\n                             expectedCount: Int) {\n        // TSQ\n        let tsqResults: Results<O.Root> = results.where(query)\n        XCTAssertEqual(tsqResults.count, expectedCount)\n\n        let (queryStr, constructedValues) = query(Query<O.Root>._constructForTesting())._constructPredicate()\n\n        // NSPredicate\n        let predicate = NSPredicate(format: queryStr, argumentArray: constructedValues)\n        let predicateResults: Results<O.Root> = results.filter(predicate)\n        XCTAssertEqual(predicateResults.count, expectedCount)\n    }\n\n    private func assertIndexMatching(_ query: ((Query<O.Root>) -> Query<Bool>),\n                                     expectedIndex: Int?) {\n        let indexOf = results.index(matching: query)\n        XCTAssertEqual(indexOf, expectedIndex)\n    }\n\n    private func assertDistinct(for keyPath: PartialKeyPath<O.Root>,\n                                count expectedCount: Int) {\n        let distincts = results.distinct(by: [_name(for: keyPath)])\n        XCTAssertEqual(distincts.count, expectedCount)\n    }\n\n    private func assertSort(for keyPath: PartialKeyPath<O.Root>,\n                            value expectedValue: F.ValueType) {\n        let sortDescriptor = SortDescriptor(keyPath: _name(for: keyPath), ascending: true)\n        let results: Results<O.Root> = results.sorted(by: [sortDescriptor])\n        let sortValue = results.first![keyPath: keyPath] as! F.ValueType\n        XCTAssertEqual(sortValue, expectedValue)\n    }\n}\n\nclass CustomColumnResultsAggregatesTest<O: CustomColumnObjectFactory, F: CustomColumnAggregatesTypeFactory>: CustomColumnResultsTestBase<O, F> where O.Root == F.Root, F.ValueType: Equatable {\n    // MARK: - Aggregates\n\n    func testCustomColumnResultsAggregateAvg() throws {\n        // Sort by KeyPath\n        for (keyPath, value) in F.average {\n            assertAverage(for: keyPath, value: value)\n        }\n    }\n\n    func testCustomColumnResultsAggregateSum() throws {\n        // Sum by KeyPath\n        for (keyPath, value) in F.sum {\n            assertSum(for: keyPath, value: value)\n        }\n    }\n\n    func testCustomColumnResultsAggregateMax() throws {\n        // Max by KeyPath\n        for (keyPath, value) in F.max {\n            assertMax(for: keyPath, value: value)\n        }\n    }\n\n    func testCustomColumnResultsAggregateMin() throws {\n        // Min by KeyPath\n        for (keyPath, value) in F.min {\n            assertMin(for: keyPath, value: value)\n        }\n    }\n\n    // MARK: - Private\n\n    private func assertAverage(for keyPath: KeyPath<O.Root, F.ValueType>, value: F.ValueType) {\n        XCTAssertEqual(results.average(of: keyPath), value)\n        let average: F.ValueType? = results.average(ofProperty: _name(for: keyPath))\n        XCTAssertEqual(average, value)\n    }\n\n    private func assertSum(for keyPath: KeyPath<O.Root, F.ValueType>, value: F.ValueType) {\n        XCTAssertEqual(results.sum(of: keyPath), value)\n        let average: F.ValueType? = results.sum(ofProperty: _name(for: keyPath))\n        XCTAssertEqual(average, value)\n    }\n\n    private func assertMax(for keyPath: KeyPath<O.Root, F.ValueType>, value: F.ValueType) {\n        XCTAssertEqual(results.max(of: keyPath), value)\n        let average: F.ValueType? = results.max(ofProperty: _name(for: keyPath))\n        XCTAssertEqual(average, value)\n    }\n\n    private func assertMin(for keyPath: KeyPath<O.Root, F.ValueType>, value: F.ValueType) {\n        XCTAssertEqual(results.min(of: keyPath), value)\n        let average: F.ValueType? = results.min(ofProperty: _name(for: keyPath))\n        XCTAssertEqual(average, value)\n    }\n}\n\nclass CustomColumnResultsSectionedTest<O: CustomColumnObjectFactory, F: CustomColumnResultsSectionedTypeFactory>: CustomColumnResultsTestBase<O, F> where O.Root == F.Root {\n    // MARK: - Sectioned\n\n    func testCustomColumnSectionedResults() throws {\n        for (keyPath, sectionCount) in F.sectioned {\n            let sectioned = results.sectioned(by: keyPath, ascending: true)\n            XCTAssertEqual(sectioned.allKeys.count, sectionCount)\n            for section in sectioned {\n                XCTAssertEqual(section.count, 1)\n            }\n        }\n    }\n}\n\nclass CustomColumnObjectTest<O: CustomColumnObjectFactory, F: ObjectCustomColumnObjectTypeFactory>: CustomColumnTestsBase<O, F> where O: ObjectBase, O.Root == F.Root, F.ValueType: Equatable {\n    // MARK: - Subscript\n\n    func testCustomColumnObjectKVC() throws {\n        for (keyPath, value) in F.propertyValues {\n            try setValue(value, for: keyPath)\n        }\n    }\n\n    // MARK: - Dynamic Listing\n\n    func testCustomColumnObjectDynamicListing() throws {\n        for (keyPath, count) in F.dynamicListProperty {\n            XCTAssertEqual(object.dynamicList(_name(for: keyPath)).count, count)\n        }\n    }\n\n    func testCustomColumnObjectDynamicMutableSet() throws {\n        for (keyPath, count) in F.dynamicMutableSetProperty {\n            XCTAssertEqual(object.dynamicMutableSet(_name(for: keyPath)).count, count)\n        }\n    }\n\n    // MARK: - Observation\n\n    func testCustomColumnObjectPropertyObservation() throws {\n        for (keyPath, value) in F.propertyValues {\n            let ex = XCTestExpectation(description: \"Notification to be called\")\n            let notificationToken = object.observe(keyPaths: [keyPath]) { changes in\n                switch changes {\n                case .change(_, let propertyChanges):\n                    XCTAssertGreaterThan(propertyChanges.count, 0)\n                    ex.fulfill()\n                default:\n                    XCTFail(\"No other changes are done to the object\")\n                }\n            }\n            notificationTokens.append(notificationToken)\n            try setValue(value, for: keyPath)\n\n            wait(for: [ex], timeout: 1.0)\n        }\n    }\n\n    // MARK: - Private\n\n    private func assertObjectGetKVCProperty(for keyPath: KeyPath<O.Root, F.ValueType>) {\n        let value: F.ValueType = object[_name(for: keyPath)] as! F.ValueType\n        XCTAssertNotNil(value)\n    }\n}\n\nclass CustomColumnKeyedObjectTest<O: CustomColumnObjectFactory, F: ObjectCustomColumnObjectTypeFactory>: CustomColumnTestsBase<O, F> where O: ObjectBase, O.Root == F.Root, F.ValueType: RealmKeyedCollection {\n    func testCustomColumnObjectDynamicMap() throws {\n        func testCustomColumnObjectDynamicMap() throws {\n            for (keyPath, count) in F.dynamicMutableSetProperty {\n                let map: Map<String, DynamicObject?> = object.dynamicMap(_name(for: keyPath))\n                XCTAssertEqual(map.count, count)\n            }\n        }\n    }\n}\n\nclass CustomColumnListTest<O: CustomColumnObjectFactory, F: CustomColumnTypeFactoryBase>: CustomColumnTestsBase<O, F> where O.Root == F.Root, F.ValueType: RealmCollectionValue {\n    var list: List<O.Root>!\n\n    override func setUp() {\n        super.setUp()\n\n        var listObjects: [O.Root] = []\n        for _ in 0...2 {\n            let newObject = O.create(primaryKey: ObjectId.generate(), nestedObject: O.create(primaryKey: ObjectId.generate(), nestedObject: nil))\n            for (keyPath, value) in F.keyPaths {\n                newObject[_name(for: keyPath)] = value\n            }\n            listObjects.append(newObject)\n        }\n\n        try! realm.write {\n            object[_name(for: F.listKeyPath)] = listObjects\n        }\n        list = object[_name(for: F.listKeyPath)] as? List<O.Root>\n    }\n\n    override func tearDown() {\n        list = nil\n        super.tearDown()\n    }\n\n    // MARK: - ValueForKey\n\n    func testCustomColumnListGetValueForKey() throws {\n        for (keyPath, value) in F.keyPaths {\n            let valuesArray: [AnyObject] = list.value(forKey: _name(for: keyPath))\n            let expectedArray = valuesArray as! [F.ValueType]\n            XCTAssertEqual(expectedArray.count, 3)\n            XCTAssertEqual(expectedArray.first!, value)\n\n            let valuesArrayKeyPath: [AnyObject] = list.value(forKeyPath: _name(for: keyPath))\n            let expectedArrayKeyPath = valuesArrayKeyPath as! [F.ValueType]\n            XCTAssertEqual(expectedArrayKeyPath.count, 3)\n            XCTAssertEqual(expectedArrayKeyPath.first!, value)\n        }\n    }\n}\n\nclass CustomColumnSetTest<O: CustomColumnObjectFactory, F: CustomColumnTypeFactoryBase>: CustomColumnTestsBase<O, F> where O.Root == F.Root, F.ValueType: RealmCollectionValue {\n    var set: MutableSet<O.Root>!\n\n    override func setUp() {\n        super.setUp()\n\n        let setObjects: MutableSet<O.Root> = MutableSet<O.Root>()\n        for _ in 0...2 {\n            let newObject = O.create(primaryKey: ObjectId.generate(), nestedObject: O.create(primaryKey: ObjectId.generate(), nestedObject: nil))\n            for (keyPath, value) in F.keyPaths {\n                newObject[_name(for: keyPath)] = value\n            }\n            setObjects.insert(newObject)\n        }\n\n        try! realm.write {\n            object[_name(for: F.setKeyPath)] = setObjects\n        }\n        set = object[_name(for: F.setKeyPath)] as? MutableSet<O.Root>\n    }\n\n    override func tearDown() {\n        set = nil\n        super.tearDown()\n    }\n\n    // MARK: - ValueForKey\n\n    func testCustomColumnListGetValueForKey() throws {\n        for (keyPath, value) in F.keyPaths {\n            let valuesSet: [AnyObject]  = set.value(forKey: _name(for: keyPath))\n            let expectedSet = valuesSet as! [F.ValueType]\n            XCTAssertEqual(expectedSet.count, 1)\n            XCTAssertEqual(expectedSet.first!, value)\n        }\n    }\n}\n\nclass CustomColumnMapTestBase<O: CustomColumnObjectFactory, F: CustomColumnMapTypeBaseFactory>: CustomColumnTestsBase<O, F> where O.Root == F.Root {\n    var map: Map<String, O.Root?>!\n\n    override func setUp() {\n        super.setUp()\n\n        let mapObjects: Map<String, O.Root> = Map<String, O.Root>()\n        for (key, (keyPath, value)) in F.keyValues {\n            let newObject = O.create(primaryKey: ObjectId.generate(), nestedObject: O.create(primaryKey: ObjectId.generate(), nestedObject: nil))\n            newObject[_name(for: keyPath)] = value\n            mapObjects[key] = newObject\n        }\n\n        try! realm.write {\n            object[_name(for: F.mapKeyPath)] = mapObjects\n        }\n        map = object[_name(for: F.mapKeyPath)] as? Map<String, O.Root?>\n    }\n\n    override func tearDown() {\n        map = nil\n        super.tearDown()\n    }\n}\n\nclass CustomColumnMapTest<O: CustomColumnObjectFactory, F: CustomColumnMapTypeFactory>: CustomColumnMapTestBase<O, F> where O.Root == F.Root, F.ValueType: Equatable {\n    // MARK: - ValueForKey\n\n    func testCustomColumnMapGetValueForKey() throws {\n        for (keyPath, value) in F.keyPaths {\n            let valuesMap: AnyObject? = map.value(forKey: \"key0\")\n            let expectedValue = valuesMap as! O.Root\n            XCTAssertEqual(expectedValue[_name(for: keyPath)] as! F.ValueType, value)\n        }\n    }\n\n    func testCustomColumnMapSetValueForKey() throws {\n        for (keyPath, value) in F.values {\n            try realm.write {\n                let newObject = O.create(primaryKey: ObjectId.generate(), nestedObject: O.create(primaryKey: ObjectId.generate(), nestedObject: nil))\n                newObject[_name(for: keyPath)] = value\n                map.setValue(newObject, forKey: \"key0\")\n            }\n\n            let valuesMapKeyPath: AnyObject? = map.value(forKeyPath: \"key0\")\n            let expectedKeyPathValue = valuesMapKeyPath as! O.Root\n            XCTAssertEqual(expectedKeyPathValue[_name(for: keyPath)] as! F.ValueType, value)\n        }\n    }\n\n    // MARK: - Observation\n\n    func testCustomColumnMapPropertyObservation() throws {\n        for (keyPath, value) in F.values {\n            let ex = XCTestExpectation(description: \"Notification to be called\")\n            let notificationToken = map.observe(keyPaths: [_name(for: keyPath)]) { changes in\n                switch changes {\n                case .update(_, _, _, let mapChanges):\n                    XCTAssertEqual(mapChanges.count, 1)\n                    ex.fulfill()\n                case .initial: break\n                default:\n                    XCTFail(\"No other changes are done to the object\")\n                }\n            }\n            notificationTokens.append(notificationToken)\n\n            try realm.write {\n                let map = object[_name(for: F.mapKeyPath)] as! Map<String, O.Root?>\n                let mapObject = map[\"key0\"]\n                mapObject!![_name(for: keyPath)] = value\n            }\n            wait(for: [ex], timeout: 1.0)\n        }\n    }\n\n    func testCustomColumnMapSortedObservation() throws {\n        for (keyPath, value) in F.sort {\n            let mapSorted: Results<O.Root?> = map.sorted(byKeyPath: _name(for: keyPath), ascending: true)\n            XCTAssertEqual(mapSorted.first!![_name(for: keyPath)] as! F.ValueType, value)\n        }\n    }\n}\n\nclass CustomColumnAggregatesMapTest<O: CustomColumnObjectFactory, F: CustomColumnMapAggregatesTypeFactory>: CustomColumnMapTestBase<O, F> where O.Root == F.Root, F.ValueType: RealmCollectionValue {\n    // MARK: - Aggregates\n\n    func testCustomColumnResultsAggregateAvg() throws {\n        // Sort by KeyPath\n        for (keyPath, value) in F.average {\n            assertAverage(for: keyPath, value: value)\n        }\n    }\n\n    func testCustomColumnResultsAggregateSum() throws {\n        // Sum by KeyPath\n        for (keyPath, value) in F.sum {\n            assertSum(for: keyPath, value: value)\n        }\n    }\n\n    func testCustomColumnResultsAggregateMax() throws {\n        // Max by KeyPath\n        for (keyPath, value) in F.max {\n            assertMax(for: keyPath, value: value)\n        }\n    }\n\n    func testCustomColumnResultsAggregateMin() throws {\n        // Min by KeyPath\n        for (keyPath, value) in F.min {\n            assertMin(for: keyPath, value: value)\n        }\n    }\n\n    // MARK: - Private\n\n    private func assertAverage(for keyPath: KeyPath<O.Root, F.ValueType>, value: F.ValueType) {\n        XCTAssertEqual(map.average(of: keyPath), value)\n        let average: F.ValueType? = map.average(ofProperty: _name(for: keyPath))\n        XCTAssertEqual(average, value)\n    }\n\n    private func assertSum(for keyPath: KeyPath<O.Root, F.ValueType>, value: F.ValueType) {\n        XCTAssertEqual(map.sum(of: keyPath), value)\n        let average: F.ValueType? = map.sum(ofProperty: _name(for: keyPath))\n        XCTAssertEqual(average, value)\n    }\n\n    private func assertMax(for keyPath: KeyPath<O.Root, F.ValueType>, value: F.ValueType) {\n        XCTAssertEqual(map.max(of: keyPath), value)\n        let average: F.ValueType? = map.max(ofProperty: _name(for: keyPath))\n        XCTAssertEqual(average, value)\n    }\n\n    private func assertMin(for keyPath: KeyPath<O.Root, F.ValueType>, value: F.ValueType) {\n        XCTAssertEqual(map.min(of: keyPath), value)\n        let average: F.ValueType? = map.min(ofProperty: _name(for: keyPath))\n        XCTAssertEqual(average, value)\n    }\n}\n\nclass CustomObjectTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        let suite = XCTestSuite(name: \"CustomColumnNameTests\")\n\n        // MARK: - Results\n        // ModernCustomObject\n        CustomColumnResultsTest<ModernCustomObject, ModernResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n        CustomColumnResultsTest<ModernCustomObject, ModernListResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n        CustomColumnResultsTest<ModernCustomObject, ModernMutableSetResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n        CustomColumnResultsTest<ModernCustomObject, ModernMapResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        // OldCustomObject\n        CustomColumnResultsTest<OldCustomObject, OldResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n        CustomColumnResultsTest<OldCustomObject, OldListResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n        CustomColumnResultsTest<OldCustomObject, OldMutableSetResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n        CustomColumnResultsTest<OldCustomObject, OldMapResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        // MARK: - Results Aggregates\n        // ModernCustomObject\n        CustomColumnResultsAggregatesTest<ModernCustomObject, ModernResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        // OldCustomObject\n        CustomColumnResultsAggregatesTest<OldCustomObject, OldResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        // MARK: - Results Sectioned\n        // ModernCustomObject\n        CustomColumnResultsSectionedTest<ModernCustomObject, ModernResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        // OldCustomObject\n        CustomColumnResultsSectionedTest<OldCustomObject, OldResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        // MARK: - Object\n        // ModernCustomObject\n        CustomColumnObjectTest<ModernCustomObject, ModernResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n        CustomColumnObjectTest<ModernCustomObject, ModernListResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n        CustomColumnObjectTest<ModernCustomObject, ModernMutableSetResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n        CustomColumnObjectTest<ModernCustomObject, ModernMapResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        // OldCustomObject\n        CustomColumnObjectTest<OldCustomObject, OldResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n        CustomColumnObjectTest<OldCustomObject, OldListResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n        CustomColumnObjectTest<OldCustomObject, OldMutableSetResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n        CustomColumnObjectTest<OldCustomObject, OldMapResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        // MARK: - Object Keyed Property\n        // ModernCustomObject\n        CustomColumnKeyedObjectTest<ModernCustomObject, ModernMapResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        // OldCustomObject\n        CustomColumnKeyedObjectTest<OldCustomObject, OldMapResultsIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        // MARK: - List\n        // ModernCustomObject\n        CustomColumnListTest<ModernCustomObject, ModernListIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        // OldCustomObject\n        CustomColumnListTest<OldCustomObject, OldListIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        // MARK: - MutableSet\n        // ModernCustomObject\n        CustomColumnSetTest<ModernCustomObject, ModernSetIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        // OldCustomObject\n        CustomColumnSetTest<OldCustomObject, OldSetIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        // MARK: - Map\n        // ModernCustomObject\n        CustomColumnMapTest<ModernCustomObject, ModernMapIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n        CustomColumnAggregatesMapTest<ModernCustomObject, ModernMapIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        // OldCustomObject\n        CustomColumnMapTest<OldCustomObject, OldMapIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n        CustomColumnAggregatesMapTest<OldCustomObject, OldMapIntType>.defaultTestSuite.tests.forEach(suite.addTest)\n        return suite\n    }\n}\n\n// MARK: - Custom Column Tests Factory\n\nprotocol CustomColumnTypeFactoryBase {\n    associatedtype Root\n    associatedtype ValueType\n\n    static var keyPaths: [KeyPath<Root, ValueType>: ValueType] { get }\n\n    static var listKeyPath: PartialKeyPath<Root> { get }\n    static var setKeyPath: PartialKeyPath<Root> { get }\n    static var mapKeyPath: PartialKeyPath<Root> { get }\n}\n\nprotocol CustomColumnResultsTypeFactory: CustomColumnTypeFactoryBase {\n    static var query: [KeyPath<Root, ValueType>: (Query<Root>) -> Query<Bool>] { get }\n    static var distincts: [KeyPath<Root, ValueType>: Int] { get }\n    static var sort: [KeyPath<Root, ValueType>: ValueType] { get }\n    static var values: [KeyPath<Root, ValueType>: ValueType] { get }\n}\n\nprotocol CustomColumnAggregatesTypeFactory: CustomColumnTypeFactoryBase where ValueType: _HasPersistedType, ValueType.PersistedType: AddableType & MinMaxType {\n    // Nested keyPaths are not available in Aggregates\n    static var average: [KeyPath<Root, ValueType>: ValueType] { get }\n    static var sum: [KeyPath<Root, ValueType>: ValueType] { get }\n    static var max: [KeyPath<Root, ValueType>: ValueType] { get }\n    static var min: [KeyPath<Root, ValueType>: ValueType] { get }\n}\n\nprotocol CustomColumnResultsSectionedTypeFactory: CustomColumnTypeFactoryBase where ValueType: _Persistable & Hashable {\n    static var sectioned: [KeyPath<Root, ValueType>: Int] { get }\n}\n\nprotocol ObjectCustomColumnObjectTypeFactory: CustomColumnTypeFactoryBase {\n    // Nested keyPaths are not available in Object Subscripts/Observation\n    static var propertyValues: [KeyPath<Root, ValueType>: ValueType] { get }\n    static var dynamicListProperty: [KeyPath<Root, ValueType>: Int] { get }\n    static var dynamicMutableSetProperty: [KeyPath<Root, ValueType>: Int] { get }\n}\n\nprotocol CustomColumnMapTypeBaseFactory: CustomColumnTypeFactoryBase {\n    static var keyValues: [String: (KeyPath<Root, ValueType>, ValueType)] { get }\n}\n\nprotocol CustomColumnObjectKeyedTypeFactory: CustomColumnTypeFactoryBase where ValueType: RealmKeyedCollection {\n    static var dynamicMapValue: [KeyPath<Root, ValueType>: Int] { get }\n}\n\nprotocol CustomColumnMapTypeFactory: CustomColumnMapTypeBaseFactory {\n    static var values: [KeyPath<Root, ValueType>: ValueType] { get }\n    static var sort: [KeyPath<Root, ValueType>: ValueType] { get }\n}\n\nprotocol CustomColumnMapAggregatesTypeFactory: CustomColumnMapTypeBaseFactory, CustomColumnAggregatesTypeFactory {}\n\n// MARK: - ModernCustom Object Factory\n\nstruct ModernResultsIntType: CustomColumnResultsTypeFactory {\n    typealias Root = ModernCustomObject\n    typealias ValueType = Int\n\n    static var listKeyPath: PartialKeyPath<ModernCustomObject> { fatalError() } // Not Applicable\n    static var setKeyPath: PartialKeyPath<ModernCustomObject> { fatalError() } // Not Applicable\n    static var mapKeyPath: PartialKeyPath<ModernCustomObject> { fatalError() } // Not Applicable\n\n    static var keyPaths: [KeyPath<ModernCustomObject, Int>: Int] {\n        [\\ModernCustomObject.intCol: 123,\n          \\ModernCustomObject.objectCol!.intCol: 345,\n          \\ModernCustomObject.embeddedObject!.intCol: 567,\n          \\ModernCustomObject.objectCol!.embeddedObject!.intCol: 789]\n    }\n\n    static var query: [KeyPath<ModernCustomObject, Int>: (Query<ModernCustomObject>) -> Query<Bool>] {\n        [\\ModernCustomObject.intCol: { $0.intCol == 123 },\n          \\ModernCustomObject.objectCol!.intCol: { $0.objectCol.intCol == 345 },\n          \\ModernCustomObject.embeddedObject!.intCol: { $0.embeddedObject.intCol == 567 },\n          \\ModernCustomObject.objectCol!.embeddedObject!.intCol: { $0.objectCol.embeddedObject.intCol == 789 }]\n    }\n\n    static var distincts: [KeyPath<ModernCustomObject, Int>: Int] {\n        [\\ModernCustomObject.intCol: 2,\n          \\ModernCustomObject.objectCol!.intCol: 1,\n          \\ModernCustomObject.embeddedObject!.intCol: 2,\n          \\ModernCustomObject.objectCol!.embeddedObject!.intCol: 1]\n    }\n\n    static var sort: [KeyPath<ModernCustomObject, Int>: Int] {\n        [\\ModernCustomObject.intCol: 0,\n          \\ModernCustomObject.objectCol!.intCol: 0,\n          \\ModernCustomObject.embeddedObject!.intCol: 0,\n          \\ModernCustomObject.objectCol!.embeddedObject!.intCol: 0]\n    }\n\n    static var propertyValues: [KeyPath<ModernCustomObject, Int>: Int] {\n        [\\ModernCustomObject.intCol: 111,\n          \\ModernCustomObject.objectCol!.intCol: 999]\n    }\n}\n\nextension ModernResultsIntType: CustomColumnAggregatesTypeFactory {\n    // Nested keyPaths are not available in Aggregates\n    static var average: [KeyPath<ModernCustomObject, Int>: Int] {\n        [\\ModernCustomObject.intCol: 234]\n    }\n\n    static var sum: [KeyPath<ModernCustomObject, Int>: Int] {\n        [\\ModernCustomObject.intCol: 468]\n    }\n\n    static var max: [KeyPath<ModernCustomObject, Int>: Int] {\n        [\\ModernCustomObject.intCol: 345]\n    }\n\n    static var min: [KeyPath<ModernCustomObject, Int>: Int] {\n        [\\ModernCustomObject.intCol: 123]\n    }\n}\n\nextension ModernResultsIntType: CustomColumnResultsSectionedTypeFactory {\n    static var sectioned: [KeyPath<ModernCustomObject, Int>: Int] {\n       [\\ModernCustomObject.intCol: 2]\n    }\n}\n\nextension ModernResultsIntType: ObjectCustomColumnObjectTypeFactory {\n    static var values: [KeyPath<ModernCustomObject, Int>: Int] {\n        [\\ModernCustomObject.intCol: 256]\n    }\n\n    static var dynamicListProperty: [KeyPath<ModernCustomObject, Int>: Int] { [:] } // Not Applicable\n    static var dynamicMutableSetProperty: [KeyPath<ModernCustomObject, Int>: Int] { [:] } // Not Applicable\n}\n\nstruct ModernListResultsIntType: CustomColumnResultsTypeFactory {\n    typealias Root = ModernCustomObject\n    typealias ValueType = List<Int>\n\n    static var listKeyPath: PartialKeyPath<ModernCustomObject> { fatalError() } // Not Applicable\n    static var setKeyPath: PartialKeyPath<ModernCustomObject> { fatalError() } // Not Applicable\n    static var mapKeyPath: PartialKeyPath<ModernCustomObject> { fatalError() } // Not Applicable\n\n    static var keyPaths: [KeyPath<ModernCustomObject, List<Int>>: List<Int>] {\n        let list = List<Int>()\n        list.append(objectsIn: [123, 345, 567, 789, 901])\n        return [\\ModernCustomObject.arrayIntCol: list]\n    }\n\n    static var query: [KeyPath<ModernCustomObject, List<Int>>: (Query<ModernCustomObject>) -> Query<Bool>] {\n        [\\ModernCustomObject.arrayIntCol: { $0.arrayIntCol.contains(123) }]\n    }\n\n    static var distincts: [KeyPath<ModernCustomObject, List<Int>>: Int] { [:] } // Not Applicable\n    static var sort: [KeyPath<ModernCustomObject, List<Int>>: ValueType] { [:] } // Not Applicable\n\n    static var propertyValues: [KeyPath<ModernCustomObject, List<Int>>: List<Int>] {\n        let list = List<Int>()\n        list.append(objectsIn: [111, 222, 333, 444])\n        return [\\ModernCustomObject.arrayIntCol: list]\n    }\n}\n\nextension ModernListResultsIntType: ObjectCustomColumnObjectTypeFactory {\n    static var values: [KeyPath<ModernCustomObject, List<Int>>: List<Int>] {\n        let list = List<Int>()\n        list.append(objectsIn: [987, 765, 543, 321])\n        return [\\ModernCustomObject.arrayIntCol: list]\n    }\n\n    static var dynamicListProperty: [KeyPath<ModernCustomObject, List<Int>>: Int] {\n        [\\ModernCustomObject.arrayIntCol: 5]\n    }\n\n    static var dynamicMutableSetProperty: [KeyPath<ModernCustomObject, List<Int>>: Int] { [:] } // Not Applicable\n}\n\nstruct ModernMutableSetResultsIntType: CustomColumnResultsTypeFactory {\n    typealias Root = ModernCustomObject\n    typealias ValueType = MutableSet<Int>\n\n    static var listKeyPath: PartialKeyPath<ModernCustomObject> { fatalError() } // Not Applicable\n    static var setKeyPath: PartialKeyPath<ModernCustomObject> { fatalError() } // Not Applicable\n    static var mapKeyPath: PartialKeyPath<ModernCustomObject> { fatalError() } // Not Applicable\n\n    static var keyPaths: [KeyPath<ModernCustomObject, MutableSet<Int>>: MutableSet<Int>] {\n        let set = MutableSet<Int>()\n        set.insert(objectsIn: [123, 345, 567, 789, 901])\n        return [\\ModernCustomObject.setIntCol: set]\n    }\n\n    static var query: [KeyPath<ModernCustomObject, MutableSet<Int>>: (Query<ModernCustomObject>) -> Query<Bool>] {\n        [\\ModernCustomObject.setIntCol: { $0.setIntCol.contains(123) }]\n    }\n\n    static var distincts: [KeyPath<ModernCustomObject, ValueType>: Int] { [:] } // Not Applicable\n    static var sort: [KeyPath<ModernCustomObject, ValueType>: ValueType] { [:] } // Not Applicable\n\n    static var propertyValues: [KeyPath<ModernCustomObject, MutableSet<Int>>: MutableSet<Int>] {\n        let set = MutableSet<Int>()\n        set.insert(objectsIn: [111, 222, 333, 444])\n        return [\\ModernCustomObject.setIntCol: set]\n    }\n}\n\nextension ModernMutableSetResultsIntType: ObjectCustomColumnObjectTypeFactory {\n    static var values: [KeyPath<ModernCustomObject, MutableSet<Int>>: MutableSet<Int>] {\n        let set = MutableSet<Int>()\n        set.insert(objectsIn: [987, 765, 543, 321])\n        return [\\ModernCustomObject.setIntCol: set]\n    }\n\n    static var dynamicListProperty: [KeyPath<ModernCustomObject, MutableSet<Int>>: Int] { [:] } // Not Applicable\n\n    static var dynamicMutableSetProperty: [KeyPath<ModernCustomObject, MutableSet<Int>>: Int] {\n        [\\ModernCustomObject.setIntCol: 5]\n    }\n}\n\nstruct ModernMapResultsIntType: CustomColumnResultsTypeFactory {\n    typealias Root = ModernCustomObject\n    typealias ValueType = Map<String, Int>\n\n    static var listKeyPath: PartialKeyPath<ModernCustomObject> { fatalError() } // Not Applicable\n    static var setKeyPath: PartialKeyPath<ModernCustomObject> { fatalError() } // Not Applicable\n    static var mapKeyPath: PartialKeyPath<ModernCustomObject> { fatalError() } // Not Applicable\n\n    static var keyPaths: [KeyPath<ModernCustomObject, Map<String, Int>>: Map<String, Int>] {\n        let map = Map<String, Int>()\n        map[\"key\"] = 123\n        map[\"key1\"] = 345\n        map[\"key3\"] = 567\n        map[\"key3\"] = 879\n        return [\\ModernCustomObject.mapIntCol: map]\n    }\n\n    static var query: [KeyPath<ModernCustomObject, ValueType>: (Query<ModernCustomObject>) -> Query<Bool>] {\n        [\\ModernCustomObject.mapIntCol: { $0.mapIntCol.keys.contains(\"key\") }]\n    }\n\n    static var distincts: [KeyPath<ModernCustomObject, Map<String, Int>>: Int] { [:] } // Not Applicable\n    static var sort: [KeyPath<ModernCustomObject, Map<String, Int>>: Map<String, Int>] { [:] } // Not Applicable\n\n    static var propertyValues: [KeyPath<ModernCustomObject, Map<String, Int>>: Map<String, Int>] {\n        let map = Map<String, Int>()\n        map[\"key\"] = 111\n        map[\"key1\"] = 222\n        map[\"key3\"] = 333\n        map[\"key3\"] = 444\n        return [\\ModernCustomObject.mapIntCol: map]\n    }\n}\n\nextension ModernMapResultsIntType: ObjectCustomColumnObjectTypeFactory {\n    static var values: [KeyPath<ModernCustomObject, Map<String, Int>>: Map<String, Int>] {\n        let map = Map<String, Int>()\n        map[\"key\"] = 123\n        map[\"key1\"] = 345\n        map[\"key3\"] = 567\n        map[\"key3\"] = 879\n        return [\\ModernCustomObject.mapIntCol: map]\n    }\n\n    static var dynamicListProperty: [KeyPath<ModernCustomObject, Map<String, Int>>: Int] { [:] } // Not Applicable\n    static var dynamicMutableSetProperty: [KeyPath<ModernCustomObject, Map<String, Int>>: Int] { [:] } // Not Applicable\n}\n\nextension ModernMapResultsIntType: CustomColumnObjectKeyedTypeFactory {\n    static var dynamicMapValue: [KeyPath<ModernCustomObject, Map<String, Int>>: Int] {\n        [\\ModernCustomObject.mapIntCol: 5]\n    }\n}\n\nstruct ModernListIntType: CustomColumnTypeFactoryBase {\n    typealias Root = ModernCustomObject\n    typealias ValueType = Int\n\n    static var listKeyPath: PartialKeyPath<ModernCustomObject> {\n        \\.arrayCol\n    }\n\n    static var setKeyPath: PartialKeyPath<ModernCustomObject> { fatalError() } // Not Applicable\n    static var mapKeyPath: PartialKeyPath<ModernCustomObject> { fatalError() } // Not Applicable\n\n    static var keyPaths: [KeyPath<ModernCustomObject, Int>: Int] {\n        [\\ModernCustomObject.intCol: 102]\n    }\n}\n\nstruct ModernSetIntType: CustomColumnTypeFactoryBase {\n    typealias Root = ModernCustomObject\n    typealias ValueType = Int\n\n    static var setKeyPath: PartialKeyPath<ModernCustomObject> {\n        \\.setCol\n    }\n\n    static var listKeyPath: PartialKeyPath<ModernCustomObject> { fatalError() } // Not Applicable\n    static var mapKeyPath: PartialKeyPath<ModernCustomObject> { fatalError() } // Not Applicable\n\n    static var keyPaths: [KeyPath<ModernCustomObject, Int>: Int] {\n       [\\ModernCustomObject.intCol: 938]\n    }\n}\n\nstruct ModernMapIntType: CustomColumnMapTypeFactory {\n    typealias Root = ModernCustomObject\n    typealias ValueType = Int\n\n    static var mapKeyPath: PartialKeyPath<ModernCustomObject> {\n        \\.mapCol\n    }\n\n    static var listKeyPath: PartialKeyPath<ModernCustomObject> { fatalError() } // Not Applicable\n    static var setKeyPath: PartialKeyPath<ModernCustomObject> { fatalError() } // Not Applicable\n\n    static var keyValues: [String: (KeyPath<Root, Int>, Int)] {\n        [\"key0\": (\\ModernCustomObject.intCol, 938),\n         \"key1\": (\\ModernCustomObject.intCol, 588),\n         \"key2\": (\\ModernCustomObject.intCol, 610)]\n    }\n\n    static var keyPaths: [KeyPath<ModernCustomObject, Int>: Int] {\n        [\\ModernCustomObject.intCol: 938]\n    }\n\n    static var values: [KeyPath<ModernCustomObject, Int>: Int] {\n        [\\ModernCustomObject.intCol: 1234]\n    }\n\n    static var sort: [KeyPath<Root, Int>: Int] {\n        [\\ModernCustomObject.intCol: 588]\n    }\n}\n\nextension ModernMapIntType: CustomColumnMapAggregatesTypeFactory {\n    static var average: [KeyPath<ModernCustomObject, Int>: Int] {\n        [\\ModernCustomObject.intCol: 712]\n    }\n\n    static var sum: [KeyPath<ModernCustomObject, Int>: Int] {\n        [\\ModernCustomObject.intCol: 2136]\n    }\n\n    static var max: [KeyPath<ModernCustomObject, Int>: Int] {\n        [\\ModernCustomObject.intCol: 938]\n    }\n\n    static var min: [KeyPath<ModernCustomObject, Int>: Int] {\n        [\\ModernCustomObject.intCol: 588]\n    }\n}\n\n// MARK: - Old Object Factory\n\nstruct OldResultsIntType: CustomColumnResultsTypeFactory {\n    typealias Root = OldCustomObject\n    typealias ValueType = Int\n\n    static var listKeyPath: PartialKeyPath<OldCustomObject> { fatalError() } // Not Applicable\n    static var setKeyPath: PartialKeyPath<OldCustomObject> { fatalError() } // Not Applicable\n    static var mapKeyPath: PartialKeyPath<OldCustomObject> { fatalError() } // Not Applicable\n\n    static var keyPaths: [KeyPath<OldCustomObject, Int>: Int] {\n        [\\OldCustomObject.intCol: 12,\n          \\OldCustomObject.objectCol!.intCol: 24,\n          \\OldCustomObject.embeddedObject!.intCol: 36,\n          \\OldCustomObject.objectCol!.embeddedObject!.intCol: 48]\n    }\n\n    static var query: [KeyPath<OldCustomObject, Int>: (Query<OldCustomObject>) -> Query<Bool>] {\n        [\\OldCustomObject.intCol: { $0.intCol == 12 },\n          \\OldCustomObject.objectCol!.intCol: { $0.objectCol.intCol == 24 },\n          \\OldCustomObject.embeddedObject!.intCol: { $0.embeddedObject.intCol == 36 },\n          \\OldCustomObject.objectCol!.embeddedObject!.intCol: { $0.objectCol.embeddedObject.intCol == 48 }]\n    }\n\n    static var distincts: [KeyPath<OldCustomObject, Int>: Int] {\n        [\\OldCustomObject.intCol: 2,\n          \\OldCustomObject.objectCol!.intCol: 1,\n          \\OldCustomObject.embeddedObject!.intCol: 2,\n          \\OldCustomObject.objectCol!.embeddedObject!.intCol: 1]\n    }\n\n    static var sort: [KeyPath<OldCustomObject, Int>: Int] {\n        [\\OldCustomObject.intCol: 0,\n          \\OldCustomObject.objectCol!.intCol: 0,\n          \\OldCustomObject.embeddedObject!.intCol: 0,\n          \\OldCustomObject.objectCol!.embeddedObject!.intCol: 0]\n    }\n\n    static var propertyValues: [KeyPath<OldCustomObject, Int>: Int] {\n        [\\OldCustomObject.intCol: 111]\n    }\n}\n\nextension OldResultsIntType: CustomColumnAggregatesTypeFactory {\n    // Nested keyPaths are not available in Aggregates\n    static var average: [KeyPath<OldCustomObject, Int>: Int] {\n        [\\OldCustomObject.intCol: 18]\n    }\n\n    static var sum: [KeyPath<OldCustomObject, Int>: Int] {\n        [\\OldCustomObject.intCol: 36]\n    }\n\n    static var max: [KeyPath<OldCustomObject, Int>: Int] {\n        [\\OldCustomObject.intCol: 24]\n    }\n\n    static var min: [KeyPath<OldCustomObject, Int>: Int] {\n        [\\OldCustomObject.intCol: 12]\n    }\n}\n\nextension OldResultsIntType: CustomColumnResultsSectionedTypeFactory {\n    static var sectioned: [KeyPath<OldCustomObject, Int>: Int] {\n       [\\OldCustomObject.intCol: 2]\n    }\n}\n\nextension OldResultsIntType: ObjectCustomColumnObjectTypeFactory {\n    static var values: [KeyPath<OldCustomObject, Int>: Int] {\n        [\\OldCustomObject.intCol: 96]\n    }\n\n    static var dynamicListProperty: [KeyPath<OldCustomObject, Int>: Int] { [:] } // Not Applicable\n    static var dynamicMutableSetProperty: [KeyPath<OldCustomObject, Int>: Int] { [:] } // Not Applicable\n}\n\nstruct OldListResultsIntType: CustomColumnResultsTypeFactory {\n    typealias Root = OldCustomObject\n    typealias ValueType = List<Int>\n\n    static var listKeyPath: PartialKeyPath<OldCustomObject> { fatalError() } // Not Applicable\n    static var setKeyPath: PartialKeyPath<OldCustomObject> { fatalError() } // Not Applicable\n    static var mapKeyPath: PartialKeyPath<OldCustomObject> { fatalError() } // Not Applicable\n\n    static var keyPaths: [KeyPath<OldCustomObject, List<Int>>: List<Int>] {\n        let list = List<Int>()\n        list.append(objectsIn: [56, 12, 34, 67])\n        return [\\OldCustomObject.arrayIntCol: list]\n    }\n\n    static var query: [KeyPath<OldCustomObject, List<Int>>: (Query<OldCustomObject>) -> Query<Bool>] {\n        [\\OldCustomObject.arrayIntCol: { $0.arrayIntCol.contains(34) }]\n    }\n\n    static var distincts: [KeyPath<OldCustomObject, List<Int>>: Int] { [:] } // Not Applicable\n    static var sort: [KeyPath<OldCustomObject, List<Int>>: ValueType] { [:] } // Not Applicable\n\n    static var propertyValues: [KeyPath<OldCustomObject, List<Int>>: List<Int>] {\n        let list = List<Int>()\n        list.append(objectsIn: [99, 88, 22, 11])\n        return [\\OldCustomObject.arrayIntCol: list]\n    }\n\n    static var valueKeyPath: [KeyPath<OldCustomObject, List<Int>>: List<Int>] {\n        let list = List<Int>()\n        list.append(objectsIn: [56, 12, 34, 67])\n        return [\\OldCustomObject.arrayIntCol: list]\n    }\n}\n\nextension OldListResultsIntType: ObjectCustomColumnObjectTypeFactory {\n    static var values: [KeyPath<OldCustomObject, List<Int>>: List<Int>] {\n        let list = List<Int>()\n        list.append(objectsIn: [43, 87, 23, 18])\n        return [\\OldCustomObject.arrayIntCol: list]\n    }\n\n    static var dynamicListProperty: [KeyPath<OldCustomObject, List<Int>>: Int] {\n        [\\OldCustomObject.arrayIntCol: 4]\n    }\n\n    static var dynamicMutableSetProperty: [KeyPath<OldCustomObject, List<Int>>: Int] { [:] } // Not Applicable\n}\n\nstruct OldMutableSetResultsIntType: CustomColumnResultsTypeFactory {\n    typealias Root = OldCustomObject\n    typealias ValueType = MutableSet<Int>\n\n    static var listKeyPath: PartialKeyPath<OldCustomObject> { fatalError() } // Not Applicable\n    static var setKeyPath: PartialKeyPath<OldCustomObject> { fatalError() } // Not Applicable\n    static var mapKeyPath: PartialKeyPath<OldCustomObject> { fatalError() } // Not Applicable\n\n    static var keyPaths: [KeyPath<OldCustomObject, MutableSet<Int>>: MutableSet<Int>] {\n        let set = MutableSet<Int>()\n        set.insert(objectsIn: [56, 93, 67, 22])\n        return [\\OldCustomObject.setIntCol: set]\n    }\n\n    static var query: [KeyPath<OldCustomObject, MutableSet<Int>>: (Query<OldCustomObject>) -> Query<Bool>] {\n        [\\OldCustomObject.setIntCol: { $0.setIntCol.contains(22) }]\n    }\n\n    static var distincts: [KeyPath<OldCustomObject, ValueType>: Int] { [:] } // Not Applicable\n    static var sort: [KeyPath<OldCustomObject, ValueType>: ValueType] { [:] } // Not Applicable\n\n    static var propertyValues: [KeyPath<OldCustomObject, MutableSet<Int>>: MutableSet<Int>] {\n        let set = MutableSet<Int>()\n        set.insert(objectsIn: [67, 45, 27, 84])\n        return [\\OldCustomObject.setIntCol: set]\n    }\n}\n\nextension OldMutableSetResultsIntType: ObjectCustomColumnObjectTypeFactory {\n    static var values: [KeyPath<OldCustomObject, RealmSwift.MutableSet<Int>>: RealmSwift.MutableSet<Int>] {\n        let set = MutableSet<Int>()\n        set.insert(objectsIn: [23, 45, 36, 28])\n        return [\\OldCustomObject.setIntCol: set]\n    }\n\n    static var dynamicListProperty: [KeyPath<OldCustomObject, MutableSet<Int>>: Int] { [:] } // Not Applicable\n\n    static var dynamicMutableSetProperty: [KeyPath<OldCustomObject, MutableSet<Int>>: Int] {\n        [\\OldCustomObject.setIntCol: 4]\n    }\n}\n\nstruct OldMapResultsIntType: CustomColumnResultsTypeFactory {\n    typealias Root = OldCustomObject\n    typealias ValueType = Map<String, Int?>\n\n    static var listKeyPath: PartialKeyPath<OldCustomObject> { fatalError() } // Not Applicable\n    static var setKeyPath: PartialKeyPath<OldCustomObject> { fatalError() } // Not Applicable\n    static var mapKeyPath: PartialKeyPath<OldCustomObject> { fatalError() } // Not Applicable\n\n    static var keyPaths: [KeyPath<OldCustomObject, Map<String, Int?>>: Map<String, Int?>] {\n        let map = Map<String, Int?>()\n        map[\"key\"] = 123\n        map[\"key1\"] = 345\n        map[\"key3\"] = 567\n        map[\"key3\"] = 879\n        return [\\OldCustomObject.mapIntCol: map]\n    }\n\n    static var query: [KeyPath<OldCustomObject, ValueType>: (Query<OldCustomObject>) -> Query<Bool>] {\n        [\\OldCustomObject.mapIntCol: { $0.mapIntCol.keys.contains(\"key\") }]\n    }\n\n    static var distincts: [KeyPath<OldCustomObject, Map<String, Int?>>: Int] { [:] } // Not Applicable\n    static var sort: [KeyPath<OldCustomObject, Map<String, Int?>>: Map<String, Int?>] { [:] } // Not Applicable\n\n    static var propertyValues: [KeyPath<OldCustomObject, Map<String, Int?>>: Map<String, Int?>] {\n        let map = Map<String, Int?>()\n        map[\"key\"] = 111\n        map[\"key1\"] = 222\n        map[\"key3\"] = 333\n        map[\"key3\"] = 444\n        return [\\OldCustomObject.mapIntCol: map]\n    }\n}\n\nextension OldMapResultsIntType: ObjectCustomColumnObjectTypeFactory {\n    static var values: [KeyPath<OldCustomObject, Map<String, Int?>>: Map<String, Int?>] {\n        let map = Map<String, Int?>()\n        map[\"key\"] = 123\n        map[\"key1\"] = 345\n        map[\"key3\"] = 567\n        map[\"key3\"] = 879\n        return [\\OldCustomObject.mapIntCol: map]\n    }\n\n    static var dynamicListProperty: [KeyPath<OldCustomObject, Map<String, Int?>>: Int] { [:] } // Not Applicable\n    static var dynamicMutableSetProperty: [KeyPath<OldCustomObject, Map<String, Int?>>: Int] { [:] } // Not Applicable\n}\n\nextension OldMapResultsIntType: CustomColumnObjectKeyedTypeFactory {\n    static var dynamicMapValue: [KeyPath<OldCustomObject, Map<String, Int?>>: Int] {\n        [\\OldCustomObject.mapIntCol: 4]\n    }\n}\n\nstruct OldListIntType: CustomColumnTypeFactoryBase {\n    typealias Root = OldCustomObject\n    typealias ValueType = Int\n\n    static var listKeyPath: PartialKeyPath<OldCustomObject> {\n        \\.arrayCol\n    }\n\n    static var setKeyPath: PartialKeyPath<OldCustomObject> { fatalError() } // Not Applicable\n    static var mapKeyPath: PartialKeyPath<OldCustomObject> { fatalError() } // Not Applicable\n\n    static var keyPaths: [KeyPath<OldCustomObject, Int>: Int] {\n        [\\OldCustomObject.intCol: 102]\n    }\n}\n\nstruct OldSetIntType: CustomColumnTypeFactoryBase {\n    typealias Root = OldCustomObject\n    typealias ValueType = Int\n\n    static var setKeyPath: PartialKeyPath<OldCustomObject> {\n        \\.setCol\n    }\n\n    static var listKeyPath: PartialKeyPath<OldCustomObject> { fatalError() } // Not Applicable\n    static var mapKeyPath: PartialKeyPath<OldCustomObject> { fatalError() } // Not Applicable\n\n    static var keyPaths: [KeyPath<OldCustomObject, Int>: Int] {\n       [\\OldCustomObject.intCol: 938]\n    }\n}\n\nstruct OldMapIntType: CustomColumnMapTypeFactory {\n    typealias Root = OldCustomObject\n    typealias ValueType = Int\n\n    static var mapKeyPath: PartialKeyPath<OldCustomObject> {\n        \\.mapCol\n    }\n\n    static var listKeyPath: PartialKeyPath<OldCustomObject> { fatalError() } // Not Applicable\n    static var setKeyPath: PartialKeyPath<OldCustomObject> { fatalError() } // Not Applicable\n\n    static var keyValues: [String: (KeyPath<Root, Int>, Int)] {\n        [\"key0\": (\\OldCustomObject.intCol, 938),\n         \"key1\": (\\OldCustomObject.intCol, 588),\n         \"key2\": (\\OldCustomObject.intCol, 610)]\n    }\n\n    static var keyPaths: [KeyPath<OldCustomObject, Int>: Int] {\n        [\\OldCustomObject.intCol: 938]\n    }\n\n    static var values: [KeyPath<OldCustomObject, Int>: Int] {\n        [\\OldCustomObject.intCol: 1234]\n    }\n\n    static var sort: [KeyPath<Root, Int>: Int] {\n        [\\OldCustomObject.intCol: 588]\n    }\n}\n\nextension OldMapIntType: CustomColumnMapAggregatesTypeFactory {\n    static var average: [KeyPath<OldCustomObject, Int>: Int] {\n        [\\OldCustomObject.intCol: 712]\n    }\n\n    static var sum: [KeyPath<OldCustomObject, Int>: Int] {\n        [\\OldCustomObject.intCol: 2136]\n    }\n\n    static var max: [KeyPath<OldCustomObject, Int>: Int] {\n        [\\OldCustomObject.intCol: 938]\n    }\n\n    static var min: [KeyPath<OldCustomObject, Int>: Int] {\n        [\\OldCustomObject.intCol: 588]\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/CustomObjectCreationTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\nimport Realm.Private\n\nprivate func mapValues<T>(_ values: [T]) -> [String: T] {\n    var map = [String: T]()\n    for (i, v) in values.enumerated() {\n        map[\"\\(i)\"] = v\n    }\n    return map\n}\n\nprivate func objectValues() -> [ModernEmbeddedObject] {\n    return [.init(value: [1]), .init(value: [2]), .init(value: [3])]\n}\n\nprivate func objectWrapperValues() -> [EmbeddedObjectWrapper] {\n    return objectValues().map(EmbeddedObjectWrapper.init)\n}\n\nclass CustomObjectCreationTests: TestCase {\n    var rawValues: [String: Any]!\n    var wrappedValues: [String: Any]!\n    var nilOptionalValues: [String: Any]!\n    override func setUp() {\n        rawValues = [\n            \"bool\": Bool.values().last!,\n            \"int\": Int.values().last!,\n            \"int8\": Int8.values().last!,\n            \"int16\": Int16.values().last!,\n            \"int32\": Int32.values().last!,\n            \"int64\": Int64.values().last!,\n            \"float\": Float.values().last!,\n            \"double\": Double.values().last!,\n            \"string\": String.values().last!,\n            \"binary\": Data.values().last!,\n            \"date\": Date.values().last!,\n            \"decimal\": Decimal128.values().last!,\n            \"objectId\": ObjectId.values().last!,\n            \"uuid\": UUID.values().last!,\n            \"object\": objectValues().last!,\n\n            \"optBool\": Bool.values().last!,\n            \"optInt\": Int.values().last!,\n            \"optInt8\": Int8.values().last!,\n            \"optInt16\": Int16.values().last!,\n            \"optInt32\": Int32.values().last!,\n            \"optInt64\": Int64.values().last!,\n            \"optFloat\": Float.values().last!,\n            \"optDouble\": Double.values().last!,\n            \"optString\": String.values().last!,\n            \"optBinary\": Data.values().last!,\n            \"optDate\": Date.values().last!,\n            \"optDecimal\": Decimal128.values().last!,\n            \"optObjectId\": ObjectId.values().last!,\n            \"optUuid\": UUID.values().last!,\n            \"optObject\": objectValues().last!,\n\n            \"listBool\": Bool.values(),\n            \"listInt\": Int.values(),\n            \"listInt8\": Int8.values(),\n            \"listInt16\": Int16.values(),\n            \"listInt32\": Int32.values(),\n            \"listInt64\": Int64.values(),\n            \"listFloat\": Float.values(),\n            \"listDouble\": Double.values(),\n            \"listString\": String.values(),\n            \"listBinary\": Data.values(),\n            \"listDate\": Date.values(),\n            \"listDecimal\": Decimal128.values(),\n            \"listUuid\": UUID.values(),\n            \"listObjectId\": ObjectId.values(),\n            \"listObject\": objectValues(),\n\n            \"listOptBool\": Bool?.values(),\n            \"listOptInt\": Int?.values(),\n            \"listOptInt8\": Int8?.values(),\n            \"listOptInt16\": Int16?.values(),\n            \"listOptInt32\": Int32?.values(),\n            \"listOptInt64\": Int64?.values(),\n            \"listOptFloat\": Float?.values(),\n            \"listOptDouble\": Double?.values(),\n            \"listOptString\": String?.values(),\n            \"listOptBinary\": Data?.values(),\n            \"listOptDate\": Date?.values(),\n            \"listOptDecimal\": Decimal128?.values(),\n            \"listOptUuid\": UUID?.values(),\n            \"listOptObjectId\": ObjectId?.values(),\n\n            \"setBool\": Bool.values(),\n            \"setInt\": Int.values(),\n            \"setInt8\": Int8.values(),\n            \"setInt16\": Int16.values(),\n            \"setInt32\": Int32.values(),\n            \"setInt64\": Int64.values(),\n            \"setFloat\": Float.values(),\n            \"setDouble\": Double.values(),\n            \"setString\": String.values(),\n            \"setBinary\": Data.values(),\n            \"setDate\": Date.values(),\n            \"setDecimal\": Decimal128.values(),\n            \"setUuid\": UUID.values(),\n            \"setObjectId\": ObjectId.values(),\n\n            \"setOptBool\": Bool?.values(),\n            \"setOptInt\": Int?.values(),\n            \"setOptInt8\": Int8?.values(),\n            \"setOptInt16\": Int16?.values(),\n            \"setOptInt32\": Int32?.values(),\n            \"setOptInt64\": Int64?.values(),\n            \"setOptFloat\": Float?.values(),\n            \"setOptDouble\": Double?.values(),\n            \"setOptString\": String?.values(),\n            \"setOptBinary\": Data?.values(),\n            \"setOptDate\": Date?.values(),\n            \"setOptDecimal\": Decimal128?.values(),\n            \"setOptUuid\": UUID?.values(),\n            \"setOptObjectId\": ObjectId?.values(),\n\n            \"mapBool\": mapValues(Bool.values()),\n            \"mapInt\": mapValues(Int.values()),\n            \"mapInt8\": mapValues(Int8.values()),\n            \"mapInt16\": mapValues(Int16.values()),\n            \"mapInt32\": mapValues(Int32.values()),\n            \"mapInt64\": mapValues(Int64.values()),\n            \"mapFloat\": mapValues(Float.values()),\n            \"mapDouble\": mapValues(Double.values()),\n            \"mapString\": mapValues(String.values()),\n            \"mapBinary\": mapValues(Data.values()),\n            \"mapDate\": mapValues(Date.values()),\n            \"mapDecimal\": mapValues(Decimal128.values()),\n            \"mapUuid\": mapValues(UUID.values()),\n            \"mapObjectId\": mapValues(ObjectId.values()),\n            \"mapObject\": mapValues(objectValues()),\n\n            \"mapOptBool\": mapValues(Bool?.values()),\n            \"mapOptInt\": mapValues(Int?.values()),\n            \"mapOptInt8\": mapValues(Int8?.values()),\n            \"mapOptInt16\": mapValues(Int16?.values()),\n            \"mapOptInt32\": mapValues(Int32?.values()),\n            \"mapOptInt64\": mapValues(Int64?.values()),\n            \"mapOptFloat\": mapValues(Float?.values()),\n            \"mapOptDouble\": mapValues(Double?.values()),\n            \"mapOptString\": mapValues(String?.values()),\n            \"mapOptBinary\": mapValues(Data?.values()),\n            \"mapOptDate\": mapValues(Date?.values()),\n            \"mapOptDecimal\": mapValues(Decimal128?.values()),\n            \"mapOptUuid\": mapValues(UUID?.values()),\n            \"mapOptObjectId\": mapValues(ObjectId?.values()),\n            \"mapOptObject\": mapValues(objectValues())\n        ]\n        wrappedValues = [\n            \"bool\": BoolWrapper.values().last!,\n            \"int\": IntWrapper.values().last!,\n            \"int8\": Int8Wrapper.values().last!,\n            \"int16\": Int16Wrapper.values().last!,\n            \"int32\": Int32Wrapper.values().last!,\n            \"int64\": Int64Wrapper.values().last!,\n            \"float\": FloatWrapper.values().last!,\n            \"double\": DoubleWrapper.values().last!,\n            \"string\": StringWrapper.values().last!,\n            \"binary\": DataWrapper.values().last!,\n            \"date\": DateWrapper.values().last!,\n            \"decimal\": Decimal128Wrapper.values().last!,\n            \"objectId\": ObjectIdWrapper.values().last!,\n            \"uuid\": UUIDWrapper.values().last!,\n            \"object\": objectWrapperValues().last!,\n\n            \"optBool\": BoolWrapper.values().last!,\n            \"optInt\": IntWrapper.values().last!,\n            \"optInt8\": Int8Wrapper.values().last!,\n            \"optInt16\": Int16Wrapper.values().last!,\n            \"optInt32\": Int32Wrapper.values().last!,\n            \"optInt64\": Int64Wrapper.values().last!,\n            \"optFloat\": FloatWrapper.values().last!,\n            \"optDouble\": DoubleWrapper.values().last!,\n            \"optString\": StringWrapper.values().last!,\n            \"optBinary\": DataWrapper.values().last!,\n            \"optDate\": DateWrapper.values().last!,\n            \"optDecimal\": Decimal128Wrapper.values().last!,\n            \"optObjectId\": ObjectIdWrapper.values().last!,\n            \"optUuid\": UUIDWrapper.values().last!,\n            \"optObject\": objectWrapperValues().last!,\n\n            \"listBool\": BoolWrapper.values(),\n            \"listInt\": IntWrapper.values(),\n            \"listInt8\": Int8Wrapper.values(),\n            \"listInt16\": Int16Wrapper.values(),\n            \"listInt32\": Int32Wrapper.values(),\n            \"listInt64\": Int64Wrapper.values(),\n            \"listFloat\": FloatWrapper.values(),\n            \"listDouble\": DoubleWrapper.values(),\n            \"listString\": StringWrapper.values(),\n            \"listBinary\": DataWrapper.values(),\n            \"listDate\": DateWrapper.values(),\n            \"listDecimal\": Decimal128Wrapper.values(),\n            \"listUuid\": UUIDWrapper.values(),\n            \"listObjectId\": ObjectIdWrapper.values(),\n            \"listObject\": objectWrapperValues(),\n\n            \"listOptBool\": BoolWrapper?.values(),\n            \"listOptInt\": IntWrapper?.values(),\n            \"listOptInt8\": Int8Wrapper?.values(),\n            \"listOptInt16\": Int16Wrapper?.values(),\n            \"listOptInt32\": Int32Wrapper?.values(),\n            \"listOptInt64\": Int64Wrapper?.values(),\n            \"listOptFloat\": FloatWrapper?.values(),\n            \"listOptDouble\": DoubleWrapper?.values(),\n            \"listOptString\": StringWrapper?.values(),\n            \"listOptBinary\": DataWrapper?.values(),\n            \"listOptDate\": DateWrapper?.values(),\n            \"listOptDecimal\": Decimal128Wrapper?.values(),\n            \"listOptUuid\": UUIDWrapper?.values(),\n            \"listOptObjectId\": ObjectIdWrapper?.values(),\n\n            \"setBool\": BoolWrapper.values(),\n            \"setInt\": IntWrapper.values(),\n            \"setInt8\": Int8Wrapper.values(),\n            \"setInt16\": Int16Wrapper.values(),\n            \"setInt32\": Int32Wrapper.values(),\n            \"setInt64\": Int64Wrapper.values(),\n            \"setFloat\": FloatWrapper.values(),\n            \"setDouble\": DoubleWrapper.values(),\n            \"setString\": StringWrapper.values(),\n            \"setBinary\": DataWrapper.values(),\n            \"setDate\": DateWrapper.values(),\n            \"setDecimal\": Decimal128Wrapper.values(),\n            \"setUuid\": UUIDWrapper.values(),\n            \"setObjectId\": ObjectIdWrapper.values(),\n\n            \"setOptBool\": BoolWrapper?.values(),\n            \"setOptInt\": IntWrapper?.values(),\n            \"setOptInt8\": Int8Wrapper?.values(),\n            \"setOptInt16\": Int16Wrapper?.values(),\n            \"setOptInt32\": Int32Wrapper?.values(),\n            \"setOptInt64\": Int64Wrapper?.values(),\n            \"setOptFloat\": FloatWrapper?.values(),\n            \"setOptDouble\": DoubleWrapper?.values(),\n            \"setOptString\": StringWrapper?.values(),\n            \"setOptBinary\": DataWrapper?.values(),\n            \"setOptDate\": DateWrapper?.values(),\n            \"setOptDecimal\": Decimal128Wrapper?.values(),\n            \"setOptUuid\": UUIDWrapper?.values(),\n            \"setOptObjectId\": ObjectIdWrapper?.values(),\n\n            \"mapBool\": mapValues(BoolWrapper.values()),\n            \"mapInt\": mapValues(IntWrapper.values()),\n            \"mapInt8\": mapValues(Int8Wrapper.values()),\n            \"mapInt16\": mapValues(Int16Wrapper.values()),\n            \"mapInt32\": mapValues(Int32Wrapper.values()),\n            \"mapInt64\": mapValues(Int64Wrapper.values()),\n            \"mapFloat\": mapValues(FloatWrapper.values()),\n            \"mapDouble\": mapValues(DoubleWrapper.values()),\n            \"mapString\": mapValues(StringWrapper.values()),\n            \"mapBinary\": mapValues(DataWrapper.values()),\n            \"mapDate\": mapValues(DateWrapper.values()),\n            \"mapDecimal\": mapValues(Decimal128Wrapper.values()),\n            \"mapUuid\": mapValues(UUIDWrapper.values()),\n            \"mapObjectId\": mapValues(ObjectIdWrapper.values()),\n            \"mapObject\": mapValues(objectWrapperValues()),\n\n            \"mapOptBool\": mapValues(BoolWrapper?.values()),\n            \"mapOptInt\": mapValues(IntWrapper?.values()),\n            \"mapOptInt8\": mapValues(Int8Wrapper?.values()),\n            \"mapOptInt16\": mapValues(Int16Wrapper?.values()),\n            \"mapOptInt32\": mapValues(Int32Wrapper?.values()),\n            \"mapOptInt64\": mapValues(Int64Wrapper?.values()),\n            \"mapOptFloat\": mapValues(FloatWrapper?.values()),\n            \"mapOptDouble\": mapValues(DoubleWrapper?.values()),\n            \"mapOptString\": mapValues(StringWrapper?.values()),\n            \"mapOptBinary\": mapValues(DataWrapper?.values()),\n            \"mapOptDate\": mapValues(DateWrapper?.values()),\n            \"mapOptDecimal\": mapValues(Decimal128Wrapper?.values()),\n            \"mapOptUuid\": mapValues(UUIDWrapper?.values()),\n            \"mapOptObjectId\": mapValues(ObjectIdWrapper?.values()),\n            \"mapOptObject\": mapValues(objectWrapperValues())\n        ]\n        nilOptionalValues = [\n            \"bool\": BoolWrapper.values().last!,\n            \"int\": IntWrapper.values().last!,\n            \"int8\": Int8Wrapper.values().last!,\n            \"int16\": Int16Wrapper.values().last!,\n            \"int32\": Int32Wrapper.values().last!,\n            \"int64\": Int64Wrapper.values().last!,\n            \"float\": FloatWrapper.values().last!,\n            \"double\": DoubleWrapper.values().last!,\n            \"string\": StringWrapper.values().last!,\n            \"binary\": DataWrapper.values().last!,\n            \"date\": DateWrapper.values().last!,\n            \"decimal\": Decimal128Wrapper.values().last!,\n            \"objectId\": ObjectIdWrapper.values().last!,\n            \"uuid\": UUIDWrapper.values().last!,\n            \"object\": NSNull(),\n\n            \"optBool\": NSNull(),\n            \"optInt\": NSNull(),\n            \"optInt8\": NSNull(),\n            \"optInt16\": NSNull(),\n            \"optInt32\": NSNull(),\n            \"optInt64\": NSNull(),\n            \"optFloat\": NSNull(),\n            \"optDouble\": NSNull(),\n            \"optString\": NSNull(),\n            \"optBinary\": NSNull(),\n            \"optDate\": NSNull(),\n            \"optDecimal\": NSNull(),\n            \"optObjectId\": NSNull(),\n            \"optUuid\": NSNull(),\n            \"optObject\": NSNull(),\n\n            \"listBool\": BoolWrapper.values(),\n            \"listInt\": IntWrapper.values(),\n            \"listInt8\": Int8Wrapper.values(),\n            \"listInt16\": Int16Wrapper.values(),\n            \"listInt32\": Int32Wrapper.values(),\n            \"listInt64\": Int64Wrapper.values(),\n            \"listFloat\": FloatWrapper.values(),\n            \"listDouble\": DoubleWrapper.values(),\n            \"listString\": StringWrapper.values(),\n            \"listBinary\": DataWrapper.values(),\n            \"listDate\": DateWrapper.values(),\n            \"listDecimal\": Decimal128Wrapper.values(),\n            \"listUuid\": UUIDWrapper.values(),\n            \"listObjectId\": ObjectIdWrapper.values(),\n            \"listObject\": objectWrapperValues(),\n\n            \"listOptBool\": [NSNull()],\n            \"listOptInt\": [NSNull()],\n            \"listOptInt8\": [NSNull()],\n            \"listOptInt16\": [NSNull()],\n            \"listOptInt32\": [NSNull()],\n            \"listOptInt64\": [NSNull()],\n            \"listOptFloat\": [NSNull()],\n            \"listOptDouble\": [NSNull()],\n            \"listOptString\": [NSNull()],\n            \"listOptBinary\": [NSNull()],\n            \"listOptDate\": [NSNull()],\n            \"listOptDecimal\": [NSNull()],\n            \"listOptUuid\": [NSNull()],\n            \"listOptObjectId\": [NSNull()],\n\n            \"setBool\": BoolWrapper.values(),\n            \"setInt\": IntWrapper.values(),\n            \"setInt8\": Int8Wrapper.values(),\n            \"setInt16\": Int16Wrapper.values(),\n            \"setInt32\": Int32Wrapper.values(),\n            \"setInt64\": Int64Wrapper.values(),\n            \"setFloat\": FloatWrapper.values(),\n            \"setDouble\": DoubleWrapper.values(),\n            \"setString\": StringWrapper.values(),\n            \"setBinary\": DataWrapper.values(),\n            \"setDate\": DateWrapper.values(),\n            \"setDecimal\": Decimal128Wrapper.values(),\n            \"setUuid\": UUIDWrapper.values(),\n            \"setObjectId\": ObjectIdWrapper.values(),\n\n            \"setOptBool\": [NSNull()],\n            \"setOptInt\": [NSNull()],\n            \"setOptInt8\": [NSNull()],\n            \"setOptInt16\": [NSNull()],\n            \"setOptInt32\": [NSNull()],\n            \"setOptInt64\": [NSNull()],\n            \"setOptFloat\": [NSNull()],\n            \"setOptDouble\": [NSNull()],\n            \"setOptString\": [NSNull()],\n            \"setOptBinary\": [NSNull()],\n            \"setOptDate\": [NSNull()],\n            \"setOptDecimal\": [NSNull()],\n            \"setOptUuid\": [NSNull()],\n            \"setOptObjectId\": [NSNull()],\n\n            \"mapBool\": mapValues(BoolWrapper.values()),\n            \"mapInt\": mapValues(IntWrapper.values()),\n            \"mapInt8\": mapValues(Int8Wrapper.values()),\n            \"mapInt16\": mapValues(Int16Wrapper.values()),\n            \"mapInt32\": mapValues(Int32Wrapper.values()),\n            \"mapInt64\": mapValues(Int64Wrapper.values()),\n            \"mapFloat\": mapValues(FloatWrapper.values()),\n            \"mapDouble\": mapValues(DoubleWrapper.values()),\n            \"mapString\": mapValues(StringWrapper.values()),\n            \"mapBinary\": mapValues(DataWrapper.values()),\n            \"mapDate\": mapValues(DateWrapper.values()),\n            \"mapDecimal\": mapValues(Decimal128Wrapper.values()),\n            \"mapUuid\": mapValues(UUIDWrapper.values()),\n            \"mapObjectId\": mapValues(ObjectIdWrapper.values()),\n            \"mapObject\": [\"0\": NSNull()],\n\n            \"mapOptBool\": [\"0\": NSNull()],\n            \"mapOptInt\": [\"0\": NSNull()],\n            \"mapOptInt8\": [\"0\": NSNull()],\n            \"mapOptInt16\": [\"0\": NSNull()],\n            \"mapOptInt32\": [\"0\": NSNull()],\n            \"mapOptInt64\": [\"0\": NSNull()],\n            \"mapOptFloat\": [\"0\": NSNull()],\n            \"mapOptDouble\": [\"0\": NSNull()],\n            \"mapOptString\": [\"0\": NSNull()],\n            \"mapOptBinary\": [\"0\": NSNull()],\n            \"mapOptDate\": [\"0\": NSNull()],\n            \"mapOptDecimal\": [\"0\": NSNull()],\n            \"mapOptUuid\": [\"0\": NSNull()],\n            \"mapOptObjectId\": [\"0\": NSNull()],\n            \"mapOptObject\": [\"0\": NSNull()],\n        ]\n        super.setUp()\n    }\n\n    override func tearDown() {\n        rawValues = nil\n        wrappedValues = nil\n        super.tearDown()\n    }\n\n    @nonobjc func verifyDefault(_ obj: AllCustomPersistableTypes) {\n        XCTAssertEqual(obj.bool, BoolWrapper(value: .init()))\n        XCTAssertEqual(obj.int, IntWrapper(value: .init()))\n        XCTAssertEqual(obj.int8, Int8Wrapper(value: .init()))\n        XCTAssertEqual(obj.int16, Int16Wrapper(value: .init()))\n        XCTAssertEqual(obj.int32, Int32Wrapper(value: .init()))\n        XCTAssertEqual(obj.int64, Int64Wrapper(value: .init()))\n        XCTAssertEqual(obj.float, FloatWrapper(value: .init()))\n        XCTAssertEqual(obj.double, DoubleWrapper(value: .init()))\n        XCTAssertEqual(obj.string, StringWrapper(value: .init()))\n        XCTAssertEqual(obj.binary, DataWrapper(value: .init()))\n        XCTAssertEqual(obj.decimal, Decimal128Wrapper(value: .init()))\n        XCTAssertEqual(obj.object, EmbeddedObjectWrapper(value: .init()))\n\n        // Date and UUID default init generate new values each time\n        XCTAssertEqual(obj.date.value.timeIntervalSince1970,\n                       DateWrapper(value: .init()).value.timeIntervalSince1970,\n                       accuracy: 1.0)\n        XCTAssertNotEqual(obj.uuid, UUIDWrapper(value: .init()))\n        XCTAssertNotEqual(obj.objectId, ObjectIdWrapper(value: .init()))\n\n        XCTAssertEqual(obj.optBool, nil)\n        XCTAssertEqual(obj.optInt, nil)\n        XCTAssertEqual(obj.optInt8, nil)\n        XCTAssertEqual(obj.optInt16, nil)\n        XCTAssertEqual(obj.optInt32, nil)\n        XCTAssertEqual(obj.optInt64, nil)\n        XCTAssertEqual(obj.optFloat, nil)\n        XCTAssertEqual(obj.optDouble, nil)\n        XCTAssertEqual(obj.optString, nil)\n        XCTAssertEqual(obj.optBinary, nil)\n        XCTAssertEqual(obj.optDate, nil)\n        XCTAssertEqual(obj.optDecimal, nil)\n        XCTAssertEqual(obj.optObjectId, nil)\n        XCTAssertEqual(obj.optUuid, nil)\n        XCTAssertEqual(obj.optObject, nil)\n    }\n\n    @nonobjc func verifyObject(_ obj: AllCustomPersistableTypes) {\n        XCTAssertEqual(obj.bool, BoolWrapper.values().last!)\n        XCTAssertEqual(obj.int, IntWrapper.values().last!)\n        XCTAssertEqual(obj.int8, Int8Wrapper.values().last!)\n        XCTAssertEqual(obj.int16, Int16Wrapper.values().last!)\n        XCTAssertEqual(obj.int32, Int32Wrapper.values().last!)\n        XCTAssertEqual(obj.int64, Int64Wrapper.values().last!)\n        XCTAssertEqual(obj.float, FloatWrapper.values().last!)\n        XCTAssertEqual(obj.double, DoubleWrapper.values().last!)\n        XCTAssertEqual(obj.string, StringWrapper.values().last!)\n        XCTAssertEqual(obj.binary, DataWrapper.values().last!)\n        XCTAssertEqual(obj.date, DateWrapper.values().last!)\n        XCTAssertEqual(obj.decimal, Decimal128Wrapper.values().last!)\n        XCTAssertEqual(obj.objectId, ObjectIdWrapper.values().last!)\n        XCTAssertEqual(obj.uuid, UUIDWrapper.values().last!)\n        XCTAssertEqual(obj.object, objectWrapperValues().last!)\n\n        XCTAssertEqual(obj.optBool, BoolWrapper.values().last!)\n        XCTAssertEqual(obj.optInt, IntWrapper.values().last!)\n        XCTAssertEqual(obj.optInt8, Int8Wrapper.values().last!)\n        XCTAssertEqual(obj.optInt16, Int16Wrapper.values().last!)\n        XCTAssertEqual(obj.optInt32, Int32Wrapper.values().last!)\n        XCTAssertEqual(obj.optInt64, Int64Wrapper.values().last!)\n        XCTAssertEqual(obj.optFloat, FloatWrapper.values().last!)\n        XCTAssertEqual(obj.optDouble, DoubleWrapper.values().last!)\n        XCTAssertEqual(obj.optString, StringWrapper.values().last!)\n        XCTAssertEqual(obj.optBinary, DataWrapper.values().last!)\n        XCTAssertEqual(obj.optDate, DateWrapper.values().last!)\n        XCTAssertEqual(obj.optDecimal, Decimal128Wrapper.values().last!)\n        XCTAssertEqual(obj.optObjectId, ObjectIdWrapper.values().last!)\n        XCTAssertEqual(obj.optUuid, UUIDWrapper.values().last!)\n        XCTAssertEqual(obj.optObject, objectWrapperValues().last!)\n    }\n\n    @nonobjc func verifyDefault(_ obj: CustomPersistableCollections) {\n        XCTAssertEqual(obj.listBool.count, 0)\n        XCTAssertEqual(obj.listInt.count, 0)\n        XCTAssertEqual(obj.listInt8.count, 0)\n        XCTAssertEqual(obj.listInt16.count, 0)\n        XCTAssertEqual(obj.listInt32.count, 0)\n        XCTAssertEqual(obj.listInt64.count, 0)\n        XCTAssertEqual(obj.listFloat.count, 0)\n        XCTAssertEqual(obj.listDouble.count, 0)\n        XCTAssertEqual(obj.listString.count, 0)\n        XCTAssertEqual(obj.listBinary.count, 0)\n        XCTAssertEqual(obj.listDate.count, 0)\n        XCTAssertEqual(obj.listDecimal.count, 0)\n        XCTAssertEqual(obj.listUuid.count, 0)\n        XCTAssertEqual(obj.listObjectId.count, 0)\n        XCTAssertEqual(obj.listObject.count, 0)\n\n        XCTAssertEqual(obj.listOptBool.count, 0)\n        XCTAssertEqual(obj.listOptInt.count, 0)\n        XCTAssertEqual(obj.listOptInt8.count, 0)\n        XCTAssertEqual(obj.listOptInt16.count, 0)\n        XCTAssertEqual(obj.listOptInt32.count, 0)\n        XCTAssertEqual(obj.listOptInt64.count, 0)\n        XCTAssertEqual(obj.listOptFloat.count, 0)\n        XCTAssertEqual(obj.listOptDouble.count, 0)\n        XCTAssertEqual(obj.listOptString.count, 0)\n        XCTAssertEqual(obj.listOptBinary.count, 0)\n        XCTAssertEqual(obj.listOptDate.count, 0)\n        XCTAssertEqual(obj.listOptDecimal.count, 0)\n        XCTAssertEqual(obj.listOptUuid.count, 0)\n        XCTAssertEqual(obj.listOptObjectId.count, 0)\n\n        XCTAssertEqual(obj.setBool.count, 0)\n        XCTAssertEqual(obj.setInt.count, 0)\n        XCTAssertEqual(obj.setInt8.count, 0)\n        XCTAssertEqual(obj.setInt16.count, 0)\n        XCTAssertEqual(obj.setInt32.count, 0)\n        XCTAssertEqual(obj.setInt64.count, 0)\n        XCTAssertEqual(obj.setFloat.count, 0)\n        XCTAssertEqual(obj.setDouble.count, 0)\n        XCTAssertEqual(obj.setString.count, 0)\n        XCTAssertEqual(obj.setBinary.count, 0)\n        XCTAssertEqual(obj.setDate.count, 0)\n        XCTAssertEqual(obj.setDecimal.count, 0)\n        XCTAssertEqual(obj.setUuid.count, 0)\n        XCTAssertEqual(obj.setObjectId.count, 0)\n\n        XCTAssertEqual(obj.setOptBool.count, 0)\n        XCTAssertEqual(obj.setOptInt.count, 0)\n        XCTAssertEqual(obj.setOptInt8.count, 0)\n        XCTAssertEqual(obj.setOptInt16.count, 0)\n        XCTAssertEqual(obj.setOptInt32.count, 0)\n        XCTAssertEqual(obj.setOptInt64.count, 0)\n        XCTAssertEqual(obj.setOptFloat.count, 0)\n        XCTAssertEqual(obj.setOptDouble.count, 0)\n        XCTAssertEqual(obj.setOptString.count, 0)\n        XCTAssertEqual(obj.setOptBinary.count, 0)\n        XCTAssertEqual(obj.setOptDate.count, 0)\n        XCTAssertEqual(obj.setOptDecimal.count, 0)\n        XCTAssertEqual(obj.setOptUuid.count, 0)\n        XCTAssertEqual(obj.setOptObjectId.count, 0)\n\n        XCTAssertEqual(obj.mapBool.count, 0)\n        XCTAssertEqual(obj.mapInt.count, 0)\n        XCTAssertEqual(obj.mapInt8.count, 0)\n        XCTAssertEqual(obj.mapInt16.count, 0)\n        XCTAssertEqual(obj.mapInt32.count, 0)\n        XCTAssertEqual(obj.mapInt64.count, 0)\n        XCTAssertEqual(obj.mapFloat.count, 0)\n        XCTAssertEqual(obj.mapDouble.count, 0)\n        XCTAssertEqual(obj.mapString.count, 0)\n        XCTAssertEqual(obj.mapBinary.count, 0)\n        XCTAssertEqual(obj.mapDate.count, 0)\n        XCTAssertEqual(obj.mapDecimal.count, 0)\n        XCTAssertEqual(obj.mapUuid.count, 0)\n        XCTAssertEqual(obj.mapObjectId.count, 0)\n        XCTAssertEqual(obj.mapObject.count, 0)\n\n        XCTAssertEqual(obj.mapOptBool.count, 0)\n        XCTAssertEqual(obj.mapOptInt.count, 0)\n        XCTAssertEqual(obj.mapOptInt8.count, 0)\n        XCTAssertEqual(obj.mapOptInt16.count, 0)\n        XCTAssertEqual(obj.mapOptInt32.count, 0)\n        XCTAssertEqual(obj.mapOptInt64.count, 0)\n        XCTAssertEqual(obj.mapOptFloat.count, 0)\n        XCTAssertEqual(obj.mapOptDouble.count, 0)\n        XCTAssertEqual(obj.mapOptString.count, 0)\n        XCTAssertEqual(obj.mapOptBinary.count, 0)\n        XCTAssertEqual(obj.mapOptDate.count, 0)\n        XCTAssertEqual(obj.mapOptDecimal.count, 0)\n        XCTAssertEqual(obj.mapOptUuid.count, 0)\n        XCTAssertEqual(obj.mapOptObjectId.count, 0)\n    }\n\n    @nonobjc func verifyNil(_ obj: AllCustomPersistableTypes) {\n        XCTAssertEqual(obj.object, EmbeddedObjectWrapper(value: 0))\n        XCTAssertNil(obj.optBool)\n        XCTAssertNil(obj.optInt)\n        XCTAssertNil(obj.optInt8)\n        XCTAssertNil(obj.optInt16)\n        XCTAssertNil(obj.optInt32)\n        XCTAssertNil(obj.optInt64)\n        XCTAssertNil(obj.optFloat)\n        XCTAssertNil(obj.optDouble)\n        XCTAssertNil(obj.optString)\n        XCTAssertNil(obj.optBinary)\n        XCTAssertNil(obj.optDate)\n        XCTAssertNil(obj.optDecimal)\n        XCTAssertNil(obj.optObjectId)\n        XCTAssertNil(obj.optUuid)\n        XCTAssertNil(obj.optObject)\n    }\n\n    @nonobjc func verifyNil(_ obj: CustomPersistableCollections) {\n        assertListEqual(obj.listOptBool, [nil])\n        assertListEqual(obj.listOptInt, [nil])\n        assertListEqual(obj.listOptInt8, [nil])\n        assertListEqual(obj.listOptInt16, [nil])\n        assertListEqual(obj.listOptInt32, [nil])\n        assertListEqual(obj.listOptInt64, [nil])\n        assertListEqual(obj.listOptFloat, [nil])\n        assertListEqual(obj.listOptDouble, [nil])\n        assertListEqual(obj.listOptString, [nil])\n        assertListEqual(obj.listOptBinary, [nil])\n        assertListEqual(obj.listOptDate, [nil])\n        assertListEqual(obj.listOptDecimal, [nil])\n        assertListEqual(obj.listOptUuid, [nil])\n        assertListEqual(obj.listOptObjectId, [nil])\n\n        assertSetEqual(obj.setOptBool, [nil])\n        assertSetEqual(obj.setOptInt, [nil])\n        assertSetEqual(obj.setOptInt8, [nil])\n        assertSetEqual(obj.setOptInt16, [nil])\n        assertSetEqual(obj.setOptInt32, [nil])\n        assertSetEqual(obj.setOptInt64, [nil])\n        assertSetEqual(obj.setOptFloat, [nil])\n        assertSetEqual(obj.setOptDouble, [nil])\n        assertSetEqual(obj.setOptString, [nil])\n        assertSetEqual(obj.setOptBinary, [nil])\n        assertSetEqual(obj.setOptDate, [nil])\n        assertSetEqual(obj.setOptDecimal, [nil])\n        assertSetEqual(obj.setOptUuid, [nil])\n        assertSetEqual(obj.setOptObjectId, [nil])\n\n        assertMapEqual(obj.mapObject, [EmbeddedObjectWrapper(value: 0)])\n        assertMapEqual(obj.mapOptBool, [nil])\n        assertMapEqual(obj.mapOptInt, [nil])\n        assertMapEqual(obj.mapOptInt8, [nil])\n        assertMapEqual(obj.mapOptInt16, [nil])\n        assertMapEqual(obj.mapOptInt32, [nil])\n        assertMapEqual(obj.mapOptInt64, [nil])\n        assertMapEqual(obj.mapOptFloat, [nil])\n        assertMapEqual(obj.mapOptDouble, [nil])\n        assertMapEqual(obj.mapOptString, [nil])\n        assertMapEqual(obj.mapOptBinary, [nil])\n        assertMapEqual(obj.mapOptDate, [nil])\n        assertMapEqual(obj.mapOptDecimal, [nil])\n        assertMapEqual(obj.mapOptUuid, [nil])\n        assertMapEqual(obj.mapOptObjectId, [nil])\n        assertMapEqual(obj.mapOptObject, [nil])\n    }\n\n    @nonobjc func assertListEqual<T: RealmCollectionValue>(_ list: List<T>, _ expected: [T]) {\n        XCTAssertEqual(Array(list), Array(expected))\n    }\n\n    @nonobjc func assertSetEqual<T: RealmCollectionValue>(_ set: MutableSet<T>, _ expected: [T]) {\n        XCTAssertEqual(set.count, Set(expected).count)\n        XCTAssertEqual(Set(set), Set(expected))\n    }\n    @nonobjc func assertMapEqual<T: RealmCollectionValue>(_ map: Map<String, T>, _ expected: [T]) {\n        XCTAssertEqual(map.count, expected.count)\n        for (i, value) in expected.enumerated() {\n            XCTAssertEqual(map[\"\\(i)\"], value)\n        }\n    }\n\n    @nonobjc func verifyObject(_ obj: CustomPersistableCollections) {\n        assertListEqual(obj.listBool, BoolWrapper.values())\n        assertListEqual(obj.listInt, IntWrapper.values())\n        assertListEqual(obj.listInt8, Int8Wrapper.values())\n        assertListEqual(obj.listInt16, Int16Wrapper.values())\n        assertListEqual(obj.listInt32, Int32Wrapper.values())\n        assertListEqual(obj.listInt64, Int64Wrapper.values())\n        assertListEqual(obj.listFloat, FloatWrapper.values())\n        assertListEqual(obj.listDouble, DoubleWrapper.values())\n        assertListEqual(obj.listString, StringWrapper.values())\n        assertListEqual(obj.listBinary, DataWrapper.values())\n        assertListEqual(obj.listDate, DateWrapper.values())\n        assertListEqual(obj.listDecimal, Decimal128Wrapper.values())\n        assertListEqual(obj.listUuid, UUIDWrapper.values())\n        assertListEqual(obj.listObjectId, ObjectIdWrapper.values())\n        assertListEqual(obj.listObject, objectWrapperValues())\n\n        assertListEqual(obj.listOptBool, BoolWrapper?.values())\n        assertListEqual(obj.listOptInt, IntWrapper?.values())\n        assertListEqual(obj.listOptInt8, Int8Wrapper?.values())\n        assertListEqual(obj.listOptInt16, Int16Wrapper?.values())\n        assertListEqual(obj.listOptInt32, Int32Wrapper?.values())\n        assertListEqual(obj.listOptInt64, Int64Wrapper?.values())\n        assertListEqual(obj.listOptFloat, FloatWrapper?.values())\n        assertListEqual(obj.listOptDouble, DoubleWrapper?.values())\n        assertListEqual(obj.listOptString, StringWrapper?.values())\n        assertListEqual(obj.listOptBinary, DataWrapper?.values())\n        assertListEqual(obj.listOptDate, DateWrapper?.values())\n        assertListEqual(obj.listOptDecimal, Decimal128Wrapper?.values())\n        assertListEqual(obj.listOptUuid, UUIDWrapper?.values())\n        assertListEqual(obj.listOptObjectId, ObjectIdWrapper?.values())\n\n        assertSetEqual(obj.setBool, BoolWrapper.values())\n        assertSetEqual(obj.setInt, IntWrapper.values())\n        assertSetEqual(obj.setInt8, Int8Wrapper.values())\n        assertSetEqual(obj.setInt16, Int16Wrapper.values())\n        assertSetEqual(obj.setInt32, Int32Wrapper.values())\n        assertSetEqual(obj.setInt64, Int64Wrapper.values())\n        assertSetEqual(obj.setFloat, FloatWrapper.values())\n        assertSetEqual(obj.setDouble, DoubleWrapper.values())\n        assertSetEqual(obj.setString, StringWrapper.values())\n        assertSetEqual(obj.setBinary, DataWrapper.values())\n        assertSetEqual(obj.setDate, DateWrapper.values())\n        assertSetEqual(obj.setDecimal, Decimal128Wrapper.values())\n        assertSetEqual(obj.setUuid, UUIDWrapper.values())\n        assertSetEqual(obj.setObjectId, ObjectIdWrapper.values())\n\n        assertSetEqual(obj.setOptBool, BoolWrapper?.values())\n        assertSetEqual(obj.setOptInt, IntWrapper?.values())\n        assertSetEqual(obj.setOptInt8, Int8Wrapper?.values())\n        assertSetEqual(obj.setOptInt16, Int16Wrapper?.values())\n        assertSetEqual(obj.setOptInt32, Int32Wrapper?.values())\n        assertSetEqual(obj.setOptInt64, Int64Wrapper?.values())\n        assertSetEqual(obj.setOptFloat, FloatWrapper?.values())\n        assertSetEqual(obj.setOptDouble, DoubleWrapper?.values())\n        assertSetEqual(obj.setOptString, StringWrapper?.values())\n        assertSetEqual(obj.setOptBinary, DataWrapper?.values())\n        assertSetEqual(obj.setOptDate, DateWrapper?.values())\n        assertSetEqual(obj.setOptDecimal, Decimal128Wrapper?.values())\n        assertSetEqual(obj.setOptUuid, UUIDWrapper?.values())\n        assertSetEqual(obj.setOptObjectId, ObjectIdWrapper?.values())\n\n        assertMapEqual(obj.mapBool, BoolWrapper.values())\n        assertMapEqual(obj.mapInt, IntWrapper.values())\n        assertMapEqual(obj.mapInt8, Int8Wrapper.values())\n        assertMapEqual(obj.mapInt16, Int16Wrapper.values())\n        assertMapEqual(obj.mapInt32, Int32Wrapper.values())\n        assertMapEqual(obj.mapInt64, Int64Wrapper.values())\n        assertMapEqual(obj.mapFloat, FloatWrapper.values())\n        assertMapEqual(obj.mapDouble, DoubleWrapper.values())\n        assertMapEqual(obj.mapString, StringWrapper.values())\n        assertMapEqual(obj.mapBinary, DataWrapper.values())\n        assertMapEqual(obj.mapDate, DateWrapper.values())\n        assertMapEqual(obj.mapDecimal, Decimal128Wrapper.values())\n        assertMapEqual(obj.mapUuid, UUIDWrapper.values())\n        assertMapEqual(obj.mapObjectId, ObjectIdWrapper.values())\n        assertMapEqual(obj.mapObject, objectWrapperValues())\n\n        assertMapEqual(obj.mapOptBool, BoolWrapper?.values())\n        assertMapEqual(obj.mapOptInt, IntWrapper?.values())\n        assertMapEqual(obj.mapOptInt8, Int8Wrapper?.values())\n        assertMapEqual(obj.mapOptInt16, Int16Wrapper?.values())\n        assertMapEqual(obj.mapOptInt32, Int32Wrapper?.values())\n        assertMapEqual(obj.mapOptInt64, Int64Wrapper?.values())\n        assertMapEqual(obj.mapOptFloat, FloatWrapper?.values())\n        assertMapEqual(obj.mapOptDouble, DoubleWrapper?.values())\n        assertMapEqual(obj.mapOptString, StringWrapper?.values())\n        assertMapEqual(obj.mapOptBinary, DataWrapper?.values())\n        assertMapEqual(obj.mapOptDate, DateWrapper?.values())\n        assertMapEqual(obj.mapOptDecimal, Decimal128Wrapper?.values())\n        assertMapEqual(obj.mapOptUuid, UUIDWrapper?.values())\n        assertMapEqual(obj.mapOptObjectId, ObjectIdWrapper?.values())\n        assertMapEqual(obj.mapOptObject, objectWrapperValues())\n    }\n\n    // MARK: - Tests\n\n    func testInitDefault() {\n        verifyDefault(AllCustomPersistableTypes())\n        verifyDefault(CustomPersistableCollections())\n    }\n\n    private func arrayValues<T: Object>(_ type: T.Type, _ values: [String: Any]) -> [Any] {\n        T.sharedSchema()!.properties.map { values[$0.name] as Any }\n    }\n\n    func testInitWithArray() {\n        verifyObject(AllCustomPersistableTypes(value: arrayValues(AllCustomPersistableTypes.self, wrappedValues!)))\n        verifyObject(AllCustomPersistableTypes(value: arrayValues(AllCustomPersistableTypes.self, rawValues!)))\n        verifyNil(AllCustomPersistableTypes(value: arrayValues(AllCustomPersistableTypes.self, nilOptionalValues!)))\n        verifyObject(CustomPersistableCollections(value: arrayValues(CustomPersistableCollections.self, wrappedValues!)))\n        verifyObject(CustomPersistableCollections(value: arrayValues(CustomPersistableCollections.self, rawValues!)))\n        verifyNil(CustomPersistableCollections(value: arrayValues(CustomPersistableCollections.self, nilOptionalValues!)))\n    }\n\n    func testInitWithDictionary() {\n        verifyObject(AllCustomPersistableTypes(value: rawValues!))\n        verifyObject(AllCustomPersistableTypes(value: wrappedValues!))\n        verifyNil(AllCustomPersistableTypes(value: nilOptionalValues!))\n        verifyObject(CustomPersistableCollections(value: rawValues!))\n        verifyObject(CustomPersistableCollections(value: wrappedValues!))\n        verifyNil(CustomPersistableCollections(value: nilOptionalValues!))\n    }\n\n    func testInitWithObject() {\n        verifyObject(AllCustomPersistableTypes(value: AllCustomPersistableTypes(value: wrappedValues!)))\n        verifyNil(AllCustomPersistableTypes(value: AllCustomPersistableTypes(value: nilOptionalValues!)))\n        verifyObject(CustomPersistableCollections(value: CustomPersistableCollections(value: wrappedValues!)))\n        verifyNil(CustomPersistableCollections(value: CustomPersistableCollections(value: nilOptionalValues!)))\n    }\n\n    func testInitFailable() {\n        _ = FailableCustomObject()\n        assertThrows(FailableCustomObject(value: [\"int\": 1]), reason: \"Could not convert value '1' to type 'IntFailableWrapper'.\")\n\n        let obj = FailableCustomObject(value: [\"optInt\": 1,\n                                               \"listInt\": [1],\n                                               \"optListInt\": [1],\n                                               \"setInt\": [1],\n                                               \"optSetInt\": [1],\n                                               \"mapInt\": [\"1\": 1],\n                                               \"optMapInt\": [\"1\": 1]] as [String: Any])\n        XCTAssertNil(obj.optInt)\n        assertThrows(obj.listInt[0], reason: \"Could not convert value '1' to type 'IntFailableWrapper'.\")\n        assertListEqual(obj.optListInt, [nil])\n        assertThrows(obj.setInt.first, reason: \"Could not convert value '1' to type 'IntFailableWrapper'.\")\n        assertSetEqual(obj.optSetInt, [nil])\n        assertThrows(obj.mapInt[\"1\"], reason: \"Could not convert value '1' to type 'IntFailableWrapper'.\")\n        XCTAssertEqual(obj.optMapInt[\"1\"], .some(nil))\n    }\n\n    func testCreateDefault() {\n        let realm = try! Realm()\n        try! realm.write {\n            verifyDefault(realm.create(AllCustomPersistableTypes.self))\n            verifyDefault(realm.create(CustomPersistableCollections.self))\n        }\n    }\n\n    func testCreateWithArray() {\n        let realm = try! Realm()\n        try! realm.write {\n            verifyObject(realm.create(AllCustomPersistableTypes.self, value: arrayValues(AllCustomPersistableTypes.self, wrappedValues!)))\n            verifyObject(realm.create(AllCustomPersistableTypes.self, value: arrayValues(AllCustomPersistableTypes.self, rawValues!)))\n            verifyObject(realm.create(CustomPersistableCollections.self, value: arrayValues(CustomPersistableCollections.self, wrappedValues!)))\n            verifyObject(realm.create(CustomPersistableCollections.self, value: arrayValues(CustomPersistableCollections.self, rawValues!)))\n        }\n    }\n\n    func testCreateWithDictionary() {\n        let realm = try! Realm()\n        try! realm.write {\n            verifyObject(realm.create(AllCustomPersistableTypes.self, value: wrappedValues!))\n            verifyObject(realm.create(AllCustomPersistableTypes.self, value: rawValues!))\n            verifyObject(realm.create(CustomPersistableCollections.self, value: wrappedValues!))\n            verifyObject(realm.create(CustomPersistableCollections.self, value: rawValues!))\n        }\n    }\n\n    func testCreateWithObject() {\n        let realm = try! Realm()\n        try! realm.write {\n            let obj = AllCustomPersistableTypes(value: wrappedValues!)\n            verifyObject(realm.create(AllCustomPersistableTypes.self, value: obj))\n        }\n    }\n\n    func testCreateFailable() {\n        let realm = try! Realm()\n        realm.beginWrite()\n\n        let obj = realm.create(FailableCustomObject.self,\n                               value: [\"int\": 1,\n                                       \"optInt\": 1,\n                                       \"listInt\": [1],\n                                       \"optListInt\": [1],\n                                       \"setInt\": [1],\n                                       \"optSetInt\": [1],\n                                       \"mapInt\": [\"1\": 1],\n                                       \"optMapInt\": [\"1\": 1]] as [String: Any])\n\n        assertThrows(obj.int, reason: \"Failed to convert persisted value '1' to type 'IntFailableWrapper' in a non-optional context.\")\n        XCTAssertNil(obj.optInt)\n        assertThrows(obj.listInt[0], reason: \"Could not convert value '1' to type 'IntFailableWrapper'.\")\n        assertListEqual(obj.optListInt, [nil])\n        assertThrows(obj.setInt.first, reason: \"Could not convert value '1' to type 'IntFailableWrapper'.\")\n        assertSetEqual(obj.optSetInt, [nil])\n        assertThrows(obj.mapInt[\"1\"], reason: \"Could not convert value '1' to type 'IntFailableWrapper'.\")\n        XCTAssertEqual(obj.optMapInt[\"1\"], .some(nil))\n\n        realm.cancelWrite()\n    }\n\n    func testAddDefault() {\n        let realm = try! Realm()\n        let obj1 = AllCustomPersistableTypes()\n        let obj2 = CustomPersistableCollections()\n        try! realm.write {\n            realm.add(obj1)\n            realm.add(obj2)\n        }\n        verifyDefault(obj1)\n        verifyDefault(obj2)\n    }\n\n    func testAdd() {\n        let realm = try! Realm()\n        let obj1 = AllCustomPersistableTypes(value: wrappedValues!)\n        let obj2 = CustomPersistableCollections(value: wrappedValues!)\n        try! realm.write {\n            realm.add(obj1)\n            realm.add(obj2)\n        }\n        verifyObject(obj1)\n        verifyObject(obj2)\n    }\n\n    func testNullValueForNonOptionalPropertyBackedByOptional() {\n        let realm = try! Realm()\n        realm.beginWrite()\n\n        // Non-optional object col can be null\n        var values = wrappedValues!\n        values[\"object\"] = NSNull()\n        XCTAssertEqual(AllCustomPersistableTypes(value: values).object.value, 0)\n        XCTAssertEqual(realm.create(AllCustomPersistableTypes.self, value: values).object.value, 0)\n\n        // Non-optional map col can contain null\n        values = wrappedValues!\n        values[\"mapObject\"] = [\"1\": NSNull()]\n        XCTAssertEqual(CustomPersistableCollections(value: values).mapObject[\"1\"]!.value, 0)\n        XCTAssertEqual(realm.create(CustomPersistableCollections.self, value: values).mapObject[\"1\"]!.value, 0)\n\n        // List can't, as the backing storage is actually non-optional\n        values = wrappedValues!\n        values[\"listObject\"] = [NSNull()]\n        assertThrows(CustomPersistableCollections(value: values))\n        assertThrows(realm.create(CustomPersistableCollections.self, value: values))\n\n        realm.cancelWrite()\n    }\n\n    func testInvalidDefaultInit() {\n        let expectedError = \"Failed to default construct a InvalidDefaultInit using the default value for persisted type Int. This conversion must either succeed, the property must be optional, or you must explicitly specify a default value for the property.\"\n        let obj = InvalidDefaultInitObject()\n        assertThrows(obj.value, reason: expectedError)\n        let realm = try! Realm()\n        realm.beginWrite()\n        assertThrows(realm.create(InvalidDefaultInitObject.self), reason: expectedError)\n        assertThrows(realm.add(obj), reason: expectedError)\n\n        let obj2 = ValidDefaultInitObject()\n        XCTAssertEqual(obj2.value.persistableValue, 0)\n        _ = realm.create(ValidDefaultInitObject.self)\n        realm.add(obj2)\n\n        realm.cancelWrite()\n    }\n}\n\nprivate struct InvalidDefaultInit: FailableCustomPersistable {\n    typealias PersistedType = Int\n    init?(persistedValue: Int) {\n        if persistedValue == 0 {\n            return nil\n        }\n    }\n    var persistableValue: Int { 0 }\n}\n\n@objc(InvalidDefaultInitObject)\nprivate class InvalidDefaultInitObject: Object {\n    @Persisted var value: InvalidDefaultInit\n}\n\n@objc(ValidDefaultInitObject)\nprivate class ValidDefaultInitObject: Object {\n    @Persisted var value = InvalidDefaultInit(persistedValue: 1)!\n}\n"
  },
  {
    "path": "RealmSwift/Tests/CustomPersistableTestObjects.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n\nimport Foundation\nimport RealmSwift\n\nprotocol TrivialCustomPersistable: CustomPersistable {\n    var value: PersistedType { get set }\n    init(value: PersistedType)\n}\n\nextension TrivialCustomPersistable {\n    init(persistedValue: PersistedType) {\n        self.init(value: persistedValue)\n    }\n    var persistableValue: PersistedType { value }\n}\n\nstruct BoolWrapper: TrivialCustomPersistable {\n    typealias PersistedType = Bool\n    var value: Bool\n}\nstruct IntWrapper: TrivialCustomPersistable {\n    typealias PersistedType = Int\n    var value: Int\n}\nstruct Int8Wrapper: TrivialCustomPersistable {\n    typealias PersistedType = Int8\n    var value: Int8\n}\nstruct Int16Wrapper: TrivialCustomPersistable {\n    typealias PersistedType = Int16\n    var value: Int16\n}\nstruct Int32Wrapper: TrivialCustomPersistable {\n    typealias PersistedType = Int32\n    var value: Int32\n}\nstruct Int64Wrapper: TrivialCustomPersistable {\n    typealias PersistedType = Int64\n    var value: Int64\n}\nstruct FloatWrapper: TrivialCustomPersistable {\n    typealias PersistedType = Float\n    var value: Float\n}\nstruct DoubleWrapper: TrivialCustomPersistable {\n    typealias PersistedType = Double\n    var value: Double\n}\nstruct StringWrapper: TrivialCustomPersistable {\n    typealias PersistedType = String\n    var value: String\n}\nstruct DataWrapper: TrivialCustomPersistable {\n    typealias PersistedType = Data\n    var value: Data\n}\nstruct DateWrapper: TrivialCustomPersistable {\n    typealias PersistedType = Date\n    var value: Date\n}\nstruct Decimal128Wrapper: TrivialCustomPersistable {\n    typealias PersistedType = Decimal128\n    var value: Decimal128\n}\nstruct ObjectIdWrapper: TrivialCustomPersistable {\n    typealias PersistedType = ObjectId\n    var value: ObjectId\n}\nstruct UUIDWrapper: TrivialCustomPersistable {\n    typealias PersistedType = UUID\n    var value: UUID\n}\n\nstruct IntFailableWrapper: FailableCustomPersistable {\n    typealias PersistedType = Int\n    init?(persistedValue: Int) {\n        if persistedValue == 1 {\n            return nil\n        }\n        self.persistableValue = persistedValue\n    }\n    let persistableValue: Int\n}\n\n// MARK: EmbeddedObject custom persistable wrappers\n\nstruct EmbeddedObjectWrapper: CustomPersistable {\n    typealias PersistedType = ModernEmbeddedObject\n    init(persistedValue: PersistedType) {\n        self.value = persistedValue.value\n    }\n    var persistableValue: ModernEmbeddedObject {\n        return ModernEmbeddedObject(value: [value])\n    }\n    init(value: Int = 1) {\n        self.value = value\n    }\n\n    var value: Int\n}\n\nclass TypeWithObjectLink: EmbeddedObject {\n    @Persisted var value: ModernEmbeddedObject?\n}\n\nstruct WrapperForTypeWithObjectLink: CustomPersistable {\n    typealias PersistedType = TypeWithObjectLink\n    var persistableValue: TypeWithObjectLink { return TypeWithObjectLink() }\n    init(persistedValue: TypeWithObjectLink) {}\n    init() {}\n}\n\nclass LinkToWrapperForTypeWithObjectLink: Object {\n    @Persisted var link: WrapperForTypeWithObjectLink?\n}\n\nclass TypeWithCollection: EmbeddedObject {\n    @Persisted var list: List<Int>\n}\n\nstruct WrapperForTypeWithCollection: CustomPersistable {\n    typealias PersistedType = TypeWithCollection\n    var persistableValue: TypeWithCollection { return TypeWithCollection() }\n    init(persistedValue: TypeWithCollection) {}\n    init() {}\n}\n\nclass LinkToWrapperForTypeWithCollection: Object {\n    @Persisted var link: WrapperForTypeWithCollection?\n}\n\nstruct AddressSwiftWrapper: CustomPersistable {\n    typealias PersistedType = AddressSwift\n    var city = \"\"\n    var country = \"\"\n    init(persistedValue: AddressSwift) {\n        city = persistedValue.city\n        country = persistedValue.country\n    }\n    var persistableValue: AddressSwift {\n        AddressSwift(value: [city, country])\n    }\n}\n\nclass LinkToAddressSwiftWrapper: Object {\n    @Persisted var object: AddressSwiftWrapper\n    @Persisted var optObject: AddressSwiftWrapper\n    @Persisted var list: List<AddressSwiftWrapper>\n    @Persisted var map: Map<String, AddressSwiftWrapper>\n    @Persisted var optMap: Map<String, AddressSwiftWrapper?>\n}\n\n// MARK: Objects\n\nclass AllCustomPersistableTypes: Object {\n    @Persisted var bool: BoolWrapper\n    @Persisted var int: IntWrapper\n    @Persisted var int8: Int8Wrapper\n    @Persisted var int16: Int16Wrapper\n    @Persisted var int32: Int32Wrapper\n    @Persisted var int64: Int64Wrapper\n    @Persisted var float: FloatWrapper\n    @Persisted var double: DoubleWrapper\n    @Persisted var string: StringWrapper\n    @Persisted var binary: DataWrapper\n    @Persisted var date: DateWrapper\n    @Persisted var decimal: Decimal128Wrapper\n    @Persisted var objectId: ObjectIdWrapper\n    @Persisted var uuid: UUIDWrapper\n    @Persisted var object: EmbeddedObjectWrapper\n\n    @Persisted var optBool: BoolWrapper?\n    @Persisted var optInt: IntWrapper?\n    @Persisted var optInt8: Int8Wrapper?\n    @Persisted var optInt16: Int16Wrapper?\n    @Persisted var optInt32: Int32Wrapper?\n    @Persisted var optInt64: Int64Wrapper?\n    @Persisted var optFloat: FloatWrapper?\n    @Persisted var optDouble: DoubleWrapper?\n    @Persisted var optString: StringWrapper?\n    @Persisted var optBinary: DataWrapper?\n    @Persisted var optDate: DateWrapper?\n    @Persisted var optDecimal: Decimal128Wrapper?\n    @Persisted var optObjectId: ObjectIdWrapper?\n    @Persisted var optUuid: UUIDWrapper?\n    @Persisted var optObject: EmbeddedObjectWrapper?\n}\n\nclass CustomPersistableCollections: Object {\n    @Persisted var listBool: List<BoolWrapper>\n    @Persisted var listInt: List<IntWrapper>\n    @Persisted var listInt8: List<Int8Wrapper>\n    @Persisted var listInt16: List<Int16Wrapper>\n    @Persisted var listInt32: List<Int32Wrapper>\n    @Persisted var listInt64: List<Int64Wrapper>\n    @Persisted var listFloat: List<FloatWrapper>\n    @Persisted var listDouble: List<DoubleWrapper>\n    @Persisted var listString: List<StringWrapper>\n    @Persisted var listBinary: List<DataWrapper>\n    @Persisted var listDate: List<DateWrapper>\n    @Persisted var listDecimal: List<Decimal128Wrapper>\n    @Persisted var listUuid: List<UUIDWrapper>\n    @Persisted var listObjectId: List<ObjectIdWrapper>\n    @Persisted var listObject: List<EmbeddedObjectWrapper>\n\n    @Persisted var listOptBool: List<BoolWrapper?>\n    @Persisted var listOptInt: List<IntWrapper?>\n    @Persisted var listOptInt8: List<Int8Wrapper?>\n    @Persisted var listOptInt16: List<Int16Wrapper?>\n    @Persisted var listOptInt32: List<Int32Wrapper?>\n    @Persisted var listOptInt64: List<Int64Wrapper?>\n    @Persisted var listOptFloat: List<FloatWrapper?>\n    @Persisted var listOptDouble: List<DoubleWrapper?>\n    @Persisted var listOptString: List<StringWrapper?>\n    @Persisted var listOptBinary: List<DataWrapper?>\n    @Persisted var listOptDate: List<DateWrapper?>\n    @Persisted var listOptDecimal: List<Decimal128Wrapper?>\n    @Persisted var listOptUuid: List<UUIDWrapper?>\n    @Persisted var listOptObjectId: List<ObjectIdWrapper?>\n\n    @Persisted var setBool: MutableSet<BoolWrapper>\n    @Persisted var setInt: MutableSet<IntWrapper>\n    @Persisted var setInt8: MutableSet<Int8Wrapper>\n    @Persisted var setInt16: MutableSet<Int16Wrapper>\n    @Persisted var setInt32: MutableSet<Int32Wrapper>\n    @Persisted var setInt64: MutableSet<Int64Wrapper>\n    @Persisted var setFloat: MutableSet<FloatWrapper>\n    @Persisted var setDouble: MutableSet<DoubleWrapper>\n    @Persisted var setString: MutableSet<StringWrapper>\n    @Persisted var setBinary: MutableSet<DataWrapper>\n    @Persisted var setDate: MutableSet<DateWrapper>\n    @Persisted var setDecimal: MutableSet<Decimal128Wrapper>\n    @Persisted var setUuid: MutableSet<UUIDWrapper>\n    @Persisted var setObjectId: MutableSet<ObjectIdWrapper>\n\n    @Persisted var setOptBool: MutableSet<BoolWrapper?>\n    @Persisted var setOptInt: MutableSet<IntWrapper?>\n    @Persisted var setOptInt8: MutableSet<Int8Wrapper?>\n    @Persisted var setOptInt16: MutableSet<Int16Wrapper?>\n    @Persisted var setOptInt32: MutableSet<Int32Wrapper?>\n    @Persisted var setOptInt64: MutableSet<Int64Wrapper?>\n    @Persisted var setOptFloat: MutableSet<FloatWrapper?>\n    @Persisted var setOptDouble: MutableSet<DoubleWrapper?>\n    @Persisted var setOptString: MutableSet<StringWrapper?>\n    @Persisted var setOptBinary: MutableSet<DataWrapper?>\n    @Persisted var setOptDate: MutableSet<DateWrapper?>\n    @Persisted var setOptDecimal: MutableSet<Decimal128Wrapper?>\n    @Persisted var setOptUuid: MutableSet<UUIDWrapper?>\n    @Persisted var setOptObjectId: MutableSet<ObjectIdWrapper?>\n\n    @Persisted var mapBool: Map<String, BoolWrapper>\n    @Persisted var mapInt: Map<String, IntWrapper>\n    @Persisted var mapInt8: Map<String, Int8Wrapper>\n    @Persisted var mapInt16: Map<String, Int16Wrapper>\n    @Persisted var mapInt32: Map<String, Int32Wrapper>\n    @Persisted var mapInt64: Map<String, Int64Wrapper>\n    @Persisted var mapFloat: Map<String, FloatWrapper>\n    @Persisted var mapDouble: Map<String, DoubleWrapper>\n    @Persisted var mapString: Map<String, StringWrapper>\n    @Persisted var mapBinary: Map<String, DataWrapper>\n    @Persisted var mapDate: Map<String, DateWrapper>\n    @Persisted var mapDecimal: Map<String, Decimal128Wrapper>\n    @Persisted var mapUuid: Map<String, UUIDWrapper>\n    @Persisted var mapObjectId: Map<String, ObjectIdWrapper>\n    @Persisted var mapObject: Map<String, EmbeddedObjectWrapper>\n\n    @Persisted var mapOptBool: Map<String, BoolWrapper?>\n    @Persisted var mapOptInt: Map<String, IntWrapper?>\n    @Persisted var mapOptInt8: Map<String, Int8Wrapper?>\n    @Persisted var mapOptInt16: Map<String, Int16Wrapper?>\n    @Persisted var mapOptInt32: Map<String, Int32Wrapper?>\n    @Persisted var mapOptInt64: Map<String, Int64Wrapper?>\n    @Persisted var mapOptFloat: Map<String, FloatWrapper?>\n    @Persisted var mapOptDouble: Map<String, DoubleWrapper?>\n    @Persisted var mapOptString: Map<String, StringWrapper?>\n    @Persisted var mapOptBinary: Map<String, DataWrapper?>\n    @Persisted var mapOptDate: Map<String, DateWrapper?>\n    @Persisted var mapOptDecimal: Map<String, Decimal128Wrapper?>\n    @Persisted var mapOptUuid: Map<String, UUIDWrapper?>\n    @Persisted var mapOptObjectId: Map<String, ObjectIdWrapper?>\n    @Persisted var mapOptObject: Map<String, EmbeddedObjectWrapper?>\n}\n\nclass LinkToAllCustomPersistableTypes: Object {\n    @Persisted var object: AllCustomPersistableTypes?\n    @Persisted var list: List<AllCustomPersistableTypes>\n    @Persisted var set: MutableSet<AllCustomPersistableTypes>\n    @Persisted var map: Map<String, AllCustomPersistableTypes?>\n}\n\nclass LinkToCustomPersistableCollections: Object {\n    @Persisted var object: CustomPersistableCollections?\n    @Persisted var list: List<CustomPersistableCollections>\n    @Persisted var set: MutableSet<CustomPersistableCollections>\n    @Persisted var map: Map<String, CustomPersistableCollections?>\n}\n\nclass CustomAllIndexableTypesObject: Object {\n    @Persisted(indexed: true) var boolCol: BoolWrapper\n    @Persisted(indexed: true) var intCol: IntWrapper\n    @Persisted(indexed: true) var int8Col: Int8Wrapper\n    @Persisted(indexed: true) var int16Col: Int16Wrapper\n    @Persisted(indexed: true) var int32Col: Int32Wrapper\n    @Persisted(indexed: true) var int64Col: Int64Wrapper\n    @Persisted(indexed: true) var stringCol: StringWrapper\n    @Persisted(indexed: true) var dateCol: DateWrapper\n    @Persisted(indexed: true) var uuidCol: UUIDWrapper\n    @Persisted(indexed: true) var objectIdCol: ObjectIdWrapper\n\n    @Persisted(indexed: true) var optIntCol: IntWrapper?\n    @Persisted(indexed: true) var optInt8Col: Int8Wrapper?\n    @Persisted(indexed: true) var optInt16Col: Int16Wrapper?\n    @Persisted(indexed: true) var optInt32Col: Int32Wrapper?\n    @Persisted(indexed: true) var optInt64Col: Int64Wrapper?\n    @Persisted(indexed: true) var optBoolCol: BoolWrapper?\n    @Persisted(indexed: true) var optStringCol: StringWrapper?\n    @Persisted(indexed: true) var optDateCol: DateWrapper?\n    @Persisted(indexed: true) var optUuidCol: UUIDWrapper?\n    @Persisted(indexed: true) var optObjectIdCol: ObjectIdWrapper?\n}\n\nclass CustomAllIndexableButNotIndexedObject: Object {\n    @Persisted(indexed: false) var boolCol: BoolWrapper\n    @Persisted(indexed: false) var intCol: IntWrapper\n    @Persisted(indexed: false) var int8Col: Int8Wrapper\n    @Persisted(indexed: false) var int16Col: Int16Wrapper\n    @Persisted(indexed: false) var int32Col: Int32Wrapper\n    @Persisted(indexed: false) var int64Col: Int64Wrapper\n    @Persisted(indexed: false) var stringCol: StringWrapper\n    @Persisted(indexed: false) var dateCol: DateWrapper\n    @Persisted(indexed: false) var uuidCol: UUIDWrapper\n    @Persisted(indexed: false) var objectIdCol: ObjectIdWrapper\n\n    @Persisted(indexed: false) var optIntCol: IntWrapper?\n    @Persisted(indexed: false) var optInt8Col: Int8Wrapper?\n    @Persisted(indexed: false) var optInt16Col: Int16Wrapper?\n    @Persisted(indexed: false) var optInt32Col: Int32Wrapper?\n    @Persisted(indexed: false) var optInt64Col: Int64Wrapper?\n    @Persisted(indexed: false) var optBoolCol: BoolWrapper?\n    @Persisted(indexed: false) var optStringCol: StringWrapper?\n    @Persisted(indexed: false) var optDateCol: DateWrapper?\n    @Persisted(indexed: false) var optUuidCol: UUIDWrapper?\n    @Persisted(indexed: false) var optObjectIdCol: ObjectIdWrapper?\n}\n\nclass FailableCustomObject: Object {\n    @Persisted var int: IntFailableWrapper\n    @Persisted var optInt: IntFailableWrapper?\n    @Persisted var listInt: List<IntFailableWrapper>\n    @Persisted var optListInt: List<IntFailableWrapper?>\n    @Persisted var setInt: MutableSet<IntFailableWrapper>\n    @Persisted var optSetInt: MutableSet<IntFailableWrapper?>\n    @Persisted var mapInt: Map<String, IntFailableWrapper>\n    @Persisted var optMapInt: Map<String, IntFailableWrapper?>\n}\n"
  },
  {
    "path": "RealmSwift/Tests/Decimal128Tests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\nclass Decimal128Tests: TestCase {\n\n    // MARK: - Initialization\n    func testDecimal128Initialization() {\n        let d1: Decimal128 = 3.14159\n        let d2: Decimal128 = .init(number: 3.14159)\n        let d3: Decimal128 = 123\n        let d4: Decimal128 = \"9.876543\"\n        let d5 = Decimal128.init(exactly: 0b00000101)\n\n        XCTAssertEqual(d1, 3.14159)\n        XCTAssertEqual(d2, 3.14159)\n        XCTAssertEqual(d3, 123)\n        XCTAssertEqual(d4, \"9.876543\")\n        XCTAssertEqual(d5, 5)\n    }\n\n    // MARK: Arithmetic\n    func testDecimal128Addition() {\n        let d1: Decimal128 = 3.144444\n        let d2: Decimal128 = 3.144444\n        let d3: Decimal128 = \"1.234567\"\n        let d4: Decimal128 = \"9.876543\"\n        let d5 = Decimal128.init(exactly: 0b00000010)\n        let d6 = Decimal128.init(exactly: 0b00000001)\n\n        let addition1 = d1+d2\n        let addition2 = d3+d4\n        let addition3 = d5!+d6!\n\n        XCTAssertEqual(addition1, 6.288888)\n        XCTAssertEqual(addition2.description, \"11.11111\")\n        XCTAssertEqual(d1, 3.144444)\n        XCTAssertEqual(d2, 3.144444)\n        XCTAssertEqual(d3.description, \"1.234567\")\n        XCTAssertEqual(d4.description, \"9.876543\")\n        XCTAssertEqual(addition3, 3.0)\n        XCTAssertEqual(d5, 2.0)\n        XCTAssertEqual(d6, 1.0)\n    }\n\n    func testDecimal128Subtraction() {\n        let d1: Decimal128 = 2.5\n        let d2: Decimal128 = 3.5\n        let d3: Decimal128 = \"2.5\"\n        let d4: Decimal128 = \"3.5\"\n        let d5 = Decimal128.init(exactly: 0b00000010)\n        let d6 = Decimal128.init(exactly: 0b00000001)\n\n        let subtraction1 = d1-d2\n        let subtraction2 = d3-d4\n        let subtraction3 = d5!-d6!\n\n        XCTAssertEqual(subtraction1, -1.0)\n        XCTAssertEqual(subtraction2.description, \"-1\")\n        XCTAssertEqual(d1, 2.5)\n        XCTAssertEqual(d2, 3.5)\n        XCTAssertEqual(d3.description, \"2.5\")\n        XCTAssertEqual(d4.description, \"3.5\")\n        XCTAssertEqual(subtraction3, 1.0)\n        XCTAssertEqual(d5, 2.0)\n        XCTAssertEqual(d6, 1.0)\n    }\n\n    func testDecimal128Division() {\n        let d1: Decimal128 = 7\n        let d2: Decimal128 = 3.5\n        let d3: Decimal128 = \"0.21\"\n        let d4: Decimal128 = \"0.7\"\n        let d5 = Decimal128.init(exactly: 0b00000010)\n        let d6 = Decimal128.init(exactly: 0b00000001)\n\n        let division1 = d1/d2\n        let division2 = d3/d4\n        let division3 = d5!/d6!\n\n        XCTAssertEqual(division1, 2)\n        XCTAssertEqual(division2, 0.3)\n        XCTAssertEqual(division3, 2)\n    }\n\n    func testDecimal128Multiplication() {\n        let d1: Decimal128 = 7\n        let d2: Decimal128 = 3.5\n        let d3: Decimal128 = \"0.21\"\n        let d4: Decimal128 = \"0.7\"\n        let d5 = Decimal128.init(exactly: 0b00000010)\n\n        let multiplication1 = d1*d2\n        let multiplication2 = d3*d4\n        let multiplication3 = d5!*d5!\n\n        XCTAssertEqual(multiplication1, 24.5)\n        XCTAssertEqual(multiplication2, 0.147)\n        XCTAssertEqual(multiplication3, 4)\n    }\n\n    // MARK: Comparison\n    func testDecimal128ComparisionEquals() {\n        let d1: Decimal128 = 3.14159\n        let d2: Decimal128 = .init(number: 3.14159)\n        let d3: Decimal128 = 123\n        let d4: Decimal128 = \"123\"\n        let d5 = Decimal128.init(exactly: 0b00000101)\n        let d6: Decimal128 = 5\n\n        XCTAssertTrue(d1 == d2)\n        XCTAssertTrue(d3 == d4)\n        XCTAssertTrue(d5 == d6)\n    }\n\n    func testDecimal128ComparisionNotEquals() {\n        let d1: Decimal128 = 3.14159\n        let d2: Decimal128 = .init(number: 3.14159)\n        let d3: Decimal128 = 123\n        let d4: Decimal128 = \"123\"\n        let d5 = Decimal128.init(exactly: 0b00000101)\n        let d6: Decimal128 = 5\n\n        XCTAssertFalse(d1 != d2)\n        XCTAssertFalse(d3 != d4)\n        XCTAssertFalse(d5 != d6)\n    }\n\n    func testDecimal128ComparisionGreaterThan() {\n        let d1: Decimal128 = 3.14160\n        let d2: Decimal128 = .init(number: 3.14159)\n        let d3: Decimal128 = 124\n        let d4: Decimal128 = \"123\"\n        let d5 = Decimal128.init(exactly: 0b00000001)\n        let d6: Decimal128 = 5\n\n        XCTAssertTrue(d1 > d2)\n        XCTAssertTrue(d3 > d4)\n        XCTAssertFalse(d5! > d6)\n    }\n\n    func testDecimal128ComparisionGreaterThanEquals() {\n        let d1: Decimal128 = 3.14159\n        let d2: Decimal128 = .init(number: 3.14159)\n        let d3: Decimal128 = 124\n        let d4: Decimal128 = \"123\"\n        let d5 = Decimal128.init(exactly: 0b00000001)\n        let d6: Decimal128 = 5\n\n        XCTAssertTrue(d1 >= d2)\n        XCTAssertTrue(d3 >= d4)\n        XCTAssertFalse(d5! >= d6)\n    }\n\n    func testDecimal128ComparisionLessThan() {\n        let d1: Decimal128 = 3.14159\n        let d2: Decimal128 = .init(number: 3.14160)\n        let d3: Decimal128 = 122\n        let d4: Decimal128 = \"123\"\n        let d5 = Decimal128.init(exactly: 0b00000010)\n        let d6: Decimal128 = 1\n\n        XCTAssertTrue(d1 < d2)\n        XCTAssertTrue(d3 < d4)\n        XCTAssertFalse(d5! < d6)\n    }\n\n    func testDecimal128ComparisionLessThanEqual() {\n        let d1: Decimal128 = 3.14160\n        let d2: Decimal128 = .init(number: 3.14160)\n        let d3: Decimal128 = 123\n        let d4: Decimal128 = \"123\"\n        let d5 = Decimal128.init(exactly: 0b00000010)\n        let d6: Decimal128 = 1\n\n        XCTAssertTrue(d1 <= d2)\n        XCTAssertTrue(d3 <= d4)\n        XCTAssertFalse(d5! <= d6)\n    }\n\n    // MARK: Miscellaneous\n    func testIsNaN() {\n        let d1: Decimal128 = .init(value: NSNull.init())\n        XCTAssertTrue(d1.isNaN)\n        XCTAssertTrue(d1.isSignaling)\n        XCTAssertTrue(d1.isSignalingNaN)\n    }\n\n    func testMinMax() {\n        let min: Decimal128 = .min\n        let max: Decimal128 = .max\n        XCTAssertGreaterThan(max, min)\n        XCTAssertLessThan(min, max)\n    }\n\n    func testMagnitude() {\n        let d1: Decimal128 = -123.321\n        let exp1: Decimal128 = 123.321\n        let d2: Decimal128 = 456.321\n        let exp2: Decimal128 = 456.321\n        XCTAssertEqual(d1.magnitude, exp1)\n        XCTAssertEqual(d2.magnitude, exp2)\n    }\n\n    func testNegate() {\n        let d1: Decimal128 = -123.321\n        let d2: Decimal128 = 456.321\n        let exp1: Decimal128 = 123.321\n        let exp2: Decimal128 = -456.321\n        d1.negate()\n        d2.negate()\n        XCTAssertEqual(d1, exp1)\n        XCTAssertEqual(d2, exp2)\n    }\n\n    func testAdvance() {\n        let d1: Decimal128 = -123.321\n        let result1 = d1.advanced(by: -123.321)\n        let d2: Decimal128 = -150.0\n        let result2 = d2.advanced(by: 300.0)\n        XCTAssertEqual(result1, -246.642)\n        XCTAssertEqual(result2, 150.0)\n    }\n\n    func testDistance() {\n        let d: Decimal128 = 10.0\n        let result1 = d.distance(to: 5.0)\n        let result2 = d.distance(to: 15.0)\n        XCTAssertEqual(result1, -5.0)\n        XCTAssertEqual(result2, 5.0)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/GeospatialTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2023 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\nimport Realm.Private\n\n// Template `EmbeddedObject` for storing GeoPoints in Realm.\npublic class Location: EmbeddedObject {\n    @Persisted private(set) var coordinates: List<Double>\n    @Persisted public var type: String = \"Point\" // public for testing\n\n    public var latitude: Double { return coordinates[1] }\n    public var longitude: Double { return coordinates[0] }\n\n    convenience init(_ latitude: Double, _ longitude: Double) {\n        self.init()\n        coordinates.append(objectsIn: [longitude, latitude])\n    }\n}\n\npublic class PersonWithInvalidTypes: Object {\n    @Persisted public var geoPointCoordinatesEmbedded: CoordinatesGeoPointEmbedded?\n    @Persisted public var geoPointTypeEmbedded: TypeGeoPointEmbedded?\n    @Persisted public var geoPoint: TopLevelGeoPoint?\n}\n\npublic class CoordinatesGeoPointEmbedded: EmbeddedObject {\n    @Persisted public var coordinates: List<Double>\n}\n\npublic class TypeGeoPointEmbedded: EmbeddedObject {\n    @Persisted public var type: String = \"Point\" // public for testing\n}\n\npublic class TopLevelGeoPoint: Object {\n    @Persisted public var coordinates: List<Double>\n    @Persisted public var type: String = \"Point\" // public for testing\n}\n\nclass PersonLocation: Object {\n    @Persisted var name: String\n    @Persisted var location: Location?\n\n    convenience init(_ name: String, _ location: Location?) {\n        self.init()\n        self.name = name\n        self.location = location\n    }\n}\n\nclass GeospatialTests: TestCase {\n    func populatePersonLocationTable() throws {\n        let realm = realmWithTestPath()\n        try realm.write {\n            realm.add(PersonLocation(\"Diana\", Location(40.7128, -74.0060)))\n            realm.add(PersonLocation(\"Maria\", Location(55.6761, 12.5683)))\n            realm.add(PersonLocation(\"Tomas\", Location(55.6280, 12.0826)))\n            realm.add(PersonLocation(\"Alba\", Location(-76, -76)))\n            realm.add(PersonLocation(\"Manuela\", nil))\n        }\n    }\n\n    func testGeoPoints() throws {\n        assertGeoPoint(90, 0)\n        assertGeoPoint(-90, 0)\n        assertGeoPoint(12.3456789, 0)\n        assertGeoPoint(90.000000001, 0, isNull: true)\n        assertGeoPoint(-90.000000001, 0, isNull: true)\n        assertGeoPoint(9999999, 0, isNull: true)\n        assertGeoPoint(-9999999, 0, isNull: true)\n\n        assertGeoPoint(0, 180)\n        assertGeoPoint(0, -180)\n        assertGeoPoint(0, 12.3456789)\n        assertGeoPoint(0, 180.000000001, isNull: true)\n        assertGeoPoint(0, -180.000000001, isNull: true)\n        assertGeoPoint(0, 9999999, isNull: true)\n        assertGeoPoint(0, -9999999, isNull: true)\n\n        assertGeoPoint(90, 0, 0)\n        assertGeoPoint(90, 0, 500)\n        assertGeoPoint(90, 0, -1, isNull: true)\n        assertGeoPoint(90, 0, Double.nan, isNull: true)\n        assertGeoPoint(90, 0, -500, isNull: true)\n\n        assertGeoPoint(Double.nan, 0, isNull: true)\n        assertGeoPoint(0, Double.nan, isNull: true)\n\n        func assertGeoPoint(_ latitude: Double, _ longitude: Double, _ altitude: Double = 0, isNull: Bool = false) {\n            if isNull {\n                XCTAssertNil(GeoPoint(latitude: latitude, longitude: longitude, altitude: altitude))\n            } else {\n                XCTAssertNotNil(GeoPoint(latitude: latitude, longitude: longitude, altitude: altitude))\n            }\n        }\n    }\n\n    func testGeoBox() throws {\n        XCTAssertNotNil(GeoBox(bottomLeft: GeoPoint(latitude: -90, longitude: -180)!, topRight: GeoPoint(latitude: 90, longitude: 180)!))\n        XCTAssertNotNil(GeoBox(bottomLeft: (-90, -180), topRight: (90, 180)))\n        XCTAssertNil(GeoBox(bottomLeft: (-91, -181), topRight: (91, 181)))\n    }\n\n    func testGeoPolygon() throws {\n        // GeoPolygon require outerRing with at least three vertices and 4 points\n        assertGeoPolygon(outerRing: GeoPoint(latitude: 0, longitude: 0)!, isNull: true)\n        assertGeoPolygon(outerRing: GeoPoint(latitude: 0, longitude: 0)!, GeoPoint(latitude: 1, longitude: 1)!, GeoPoint(latitude: 0, longitude: 0)!, isNull: true)\n        assertGeoPolygon(outerRing: GeoPoint(latitude: 0, longitude: 0)!, GeoPoint(latitude: 1, longitude: 1)!, GeoPoint(latitude: 2, longitude: 2)!, isNull: true)\n\n        // GeoPolygon require outerRing first and last point to be equal to close the Polygon\n        assertGeoPolygon(outerRing: GeoPoint(latitude: 0, longitude: 0)!, GeoPoint(latitude: 1, longitude: 1)!, GeoPoint(latitude: 2, longitude: 0)!, GeoPoint(latitude: 0, longitude: 0)!)\n        assertGeoPolygon(outerRing: GeoPoint(latitude: 0, longitude: 0)!, GeoPoint(latitude: 1, longitude: 1)!, GeoPoint(latitude: 2, longitude: 0)!, GeoPoint(latitude: 3, longitude: 3)!, isNull: true)\n\n        // GeoPolygon require holes to have at least three vertices and 4 points, and first and last point to be equal for each hole\n        assertGeoPolygon(outerRing: GeoPoint(latitude: 0, longitude: 0)!, GeoPoint(latitude: 1, longitude: 1)!, GeoPoint(latitude: 2, longitude: 2)!, GeoPoint(latitude: 0, longitude: 0)!, holes: [GeoPoint(latitude: 0, longitude: 0)!, GeoPoint(latitude: 1, longitude: 1)!, GeoPoint(latitude: 2, longitude: 2)!, GeoPoint(latitude: 0, longitude: 0)!])\n        assertGeoPolygon(outerRing: GeoPoint(latitude: 0, longitude: 0)!, GeoPoint(latitude: 1, longitude: 1)!, GeoPoint(latitude: 2, longitude: 2)!, GeoPoint(latitude: 0, longitude: 0)!, holes: [GeoPoint(latitude: 0, longitude: 0)!], isNull: true)\n        assertGeoPolygon(outerRing: GeoPoint(latitude: 0, longitude: 0)!, GeoPoint(latitude: 1, longitude: 1)!, GeoPoint(latitude: 2, longitude: 2)!, GeoPoint(latitude: 0, longitude: 0)!, holes: [GeoPoint(latitude: 0, longitude: 0)!, GeoPoint(latitude: 1, longitude: 1)!, GeoPoint(latitude: 0, longitude: 0)!], isNull: true)\n        assertGeoPolygon(outerRing: GeoPoint(latitude: 0, longitude: 0)!, GeoPoint(latitude: 1, longitude: 1)!, GeoPoint(latitude: 2, longitude: 2)!, GeoPoint(latitude: 0, longitude: 0)!, holes: [GeoPoint(latitude: 0, longitude: 0)!, GeoPoint(latitude: 1, longitude: 1)!, GeoPoint(latitude: 2, longitude: 2)!], isNull: true)\n        assertGeoPolygon(outerRing: GeoPoint(latitude: 0, longitude: 0)!, GeoPoint(latitude: 1, longitude: 1)!, GeoPoint(latitude: 2, longitude: 2)!, GeoPoint(latitude: 0, longitude: 0)!, holes: [GeoPoint(latitude: 0, longitude: 0)!, GeoPoint(latitude: 1, longitude: 1)!, GeoPoint(latitude: 2, longitude: 2)!, GeoPoint(latitude: 3, longitude: 3)!], isNull: true)\n        assertGeoPolygon(outerRing: GeoPoint(latitude: 0, longitude: 0)!, GeoPoint(latitude: 1, longitude: 1)!, GeoPoint(latitude: 2, longitude: 2)!, GeoPoint(latitude: 0, longitude: 0)!, holes: [GeoPoint(latitude: 0, longitude: 0)!, GeoPoint(latitude: 1, longitude: 1)!, GeoPoint(latitude: 2, longitude: 2)!, GeoPoint(latitude: 0, longitude: 0)!], [GeoPoint(latitude: 0, longitude: 0)!], isNull: true)\n        assertGeoPolygon(outerRing: GeoPoint(latitude: 0, longitude: 0)!, GeoPoint(latitude: 1, longitude: 1)!, GeoPoint(latitude: 2, longitude: 2)!, GeoPoint(latitude: 0, longitude: 0)!, holes: [GeoPoint(latitude: 0, longitude: 0)!, GeoPoint(latitude: 1, longitude: 1)!, GeoPoint(latitude: 2, longitude: 2)!, GeoPoint(latitude: 0, longitude: 0)!], [GeoPoint(latitude: 0, longitude: 0)!, GeoPoint(latitude: 1, longitude: 1)!, GeoPoint(latitude: 2, longitude: 2)!, GeoPoint(latitude: 3, longitude: 3)!], isNull: true)\n\n        func assertGeoPolygon(outerRing: GeoPoint..., holes: [GeoPoint]..., isNull: Bool = false) {\n            if isNull {\n                XCTAssertNil(GeoPolygon(outerRing: outerRing.map { $0 }, holes: holes.map { $0 }))\n            } else {\n                XCTAssertNotNil(GeoPolygon(outerRing: outerRing.map { $0 }, holes: holes.map { $0 }))\n            }\n        }\n\n        // Using Simplified initialisers\n        XCTAssertNotNil(GeoPolygon(outerRing: [(40.0096192, -75.5175781), (60, 20), (20, 20), (-75.5175781, -75.5175781), (40.0096192, -75.5175781)]))\n        XCTAssertNil(GeoPolygon(outerRing: [(40.0096192, -75.5175781)]))\n        XCTAssertNotNil(GeoPolygon(outerRing: [(0, 0), (1, 1), (2, 2), (0, 0)], holes: [[(0, 0), (1, 1), (2, 2), (0, 0)]]))\n        XCTAssertNotNil(GeoPolygon(outerRing: [(0, 0), (1, 1), (2, 2), (0, 0)], holes: [(0, 0), (1, 1), (2, 2), (0, 0)], [(0, 0), (1, 1), (2, 2), (0, 0)]))\n        XCTAssertNil(GeoPolygon(outerRing: [(0, 0), (1, 1), (2, 2), (0, 0)], holes: [[(0, 0)]]))\n        XCTAssertNil(GeoPolygon(outerRing: [(0, 0), (1, 1), (2, 2), (0, 0)], holes: [[(0, 0), (1, 1), (2, 2), (3, 3)]]))\n        XCTAssertNil(GeoPolygon(outerRing: [(0, 0), (1, 1), (2, 2), (0, 0)], holes: [(0, 0), (1, 1), (2, 2), (0, 0)], [(0, 0), (1, 1), (2, 2), (3, 3)]))\n    }\n\n    func testGeoDistance() throws {\n        assertGeoDistance(Distance.radians(0))\n        assertGeoDistance(Distance.radians(20))\n        assertGeoDistance(Distance.radians(-20), isNull: true)\n        assertGeoDistance(Distance.radians(.nan), isNull: true)\n\n        assertGeoDistance(Distance.kilometers(0))\n        assertGeoDistance(Distance.kilometers(10))\n        assertGeoDistance(Distance.kilometers(-10), isNull: true)\n        assertGeoDistance(Distance.kilometers(.nan), isNull: true)\n\n        assertGeoDistance(Distance.miles(0))\n        assertGeoDistance(Distance.miles(10))\n        assertGeoDistance(Distance.miles(-10), isNull: true)\n        assertGeoDistance(Distance.miles(.nan), isNull: true)\n\n        assertGeoDistance(Distance.degrees(0))\n        assertGeoDistance(Distance.degrees(90))\n        assertGeoDistance(Distance.degrees(-90), isNull: true)\n        assertGeoDistance(Distance.degrees(.nan), isNull: true)\n\n        func assertGeoDistance(_ radius: Distance?, isNull: Bool = false) {\n            if isNull {\n                XCTAssertNil(radius)\n            } else {\n                XCTAssertNotNil(radius)\n            }\n        }\n    }\n\n    func testGeoCircle() throws {\n        XCTAssertNotNil(GeoCircle(center: GeoPoint(latitude: 0, longitude: 70)!, radius: .radians(0)!))\n        XCTAssertNotNil(GeoCircle(center: GeoPoint(latitude: 0, longitude: 70)!, radiusInRadians: 500))\n        XCTAssertNil(GeoCircle(center: GeoPoint(latitude: 0, longitude: 70)!, radiusInRadians: Double.nan))\n        XCTAssertNil(GeoCircle(center: GeoPoint(latitude: 0, longitude: 70)!, radiusInRadians: -500))\n\n        // Using Simplified initialiser\n        XCTAssertNotNil(GeoCircle(center: (0, 70), radiusInRadians: 0))\n        XCTAssertNil(GeoCircle(center: (0, 70), radiusInRadians: -500))\n    }\n\n    func testDistanceFromKilometers() throws {\n        let earthCircumferenceKM: Double = 40075\n        let distance = Distance.kilometers(earthCircumferenceKM)!\n        XCTAssertEqual(distance.radians, Double.pi * 2, accuracy: distance.radians * 0.0001)\n        XCTAssertEqual(distance.asKilometers(), earthCircumferenceKM, accuracy: distance.asKilometers() * 0.0001)\n    }\n\n    func testDistanceFromMiles() throws {\n        let earthCircumferenceMiles: Double = 24901\n        let distance = Distance.miles(earthCircumferenceMiles)!\n        XCTAssertEqual(distance.radians, Double.pi * 2, accuracy: distance.radians * 0.0001)\n        XCTAssertEqual(distance.asMiles(), earthCircumferenceMiles, accuracy: distance.asMiles() * 0.0001)\n    }\n\n    func testDistanceFromDegrees() throws {\n        let distance = Distance.degrees(180)!\n        XCTAssertEqual(distance.radians, Double.pi, accuracy: distance.radians * 0.0001)\n        XCTAssertEqual(distance.asDegrees(), 180, accuracy: distance.asDegrees() * 0.0001)\n    }\n\n    func testDistanceFromRadians() throws {\n        let distance = Distance.radians(Double.pi)!\n        XCTAssertEqual(distance.radians, Double.pi)\n    }\n\n    func testFilterShapes() throws {\n        try populatePersonLocationTable()\n\n        assertFilterShape(GeoBox(bottomLeft: (55.6281, 12.0826), topRight: (55.6762, 12.5684))!, count: 1, expectedMatches: [\"Maria\"])\n        assertFilterShape(GeoBox(bottomLeft: (55.6279, 12.0825), topRight: (55.6762, 12.5684))!, count: 2, expectedMatches: [\"Maria\", \"Tomas\"])\n        assertFilterShape(GeoBox(bottomLeft: (0, -75), topRight: (60, 15))!, count: 3, expectedMatches: [\"Diana\", \"Maria\", \"Tomas\"])\n        assertFilterShape(GeoBox(bottomLeft: (0, -75), topRight: (60, 15))!, count: 3, expectedMatches: [\"Diana\", \"Maria\", \"Tomas\"])\n\n        assertFilterShape(GeoPolygon(outerRing: [(55.6281, 12.0826), (55.6761, 12.0826), (55.6761, 12.5684), (55.6281, 12.5684), (55.6281, 12.0826)])!, count: 1, expectedMatches: [\"Maria\"])\n        assertFilterShape(GeoPolygon(outerRing: [(55, 12), (55.67, 12.5), ( 55.67, 11.5), (55, 12)])!, count: 1, expectedMatches: [\"Tomas\"])\n        assertFilterShape(GeoPolygon(outerRing: [(40.0096192, -75.5175781), (60, 20), (20, 20), (-75.5175781, -75.5175781), (40.0096192, -75.5175781)])!, count: 3, expectedMatches: [\"Diana\", \"Maria\", \"Tomas\"])\n        assertFilterShape(GeoPolygon(outerRing: [(40.0096192, -75.5175781), (60, 20), (20, 20), (-75.5175781, -75.5175781), (40.0096192, -75.5175781)])!, count: 3, expectedMatches: [\"Diana\", \"Maria\", \"Tomas\"])\n\n        // GeoPolygon with holes\n        assertFilterShape(GeoPolygon(outerRing: [(50, -80), (61, 21), (21, 21), (-80, -80), (50, -80)], holes: [[(40.0096192, -75.5175781), (60, 20), (20, 20), (-75.5175781, -75.5175781), (40.0096192, -75.5175781)]])!, count: 1, expectedMatches: [\"Alba\"])\n        assertFilterShape(GeoPolygon(outerRing: [(50, -80), (62, 22), (22, 22), (-80, -80), (50, -80)], holes: [[(40.7129, -75), (40.7129, -74), (40.7126, -74), (40.7129, -75)]])!, count: 3, expectedMatches: [\"Maria\", \"Tomas\", \"Alba\"])\n        assertFilterShape(GeoPolygon(outerRing: [(50, -80), (62, 22), (22, 22), (-80, -80), (50, -80)], holes: [[(40.7129, -75), (40.7129, -74), (40.7126, -74), (40.7129, -75)], [(-77, -77), (-77, -75), (-75, -75), (-75, -77), (-77, -77)]])!, count: 2, expectedMatches: [\"Maria\", \"Tomas\"])\n        assertFilterShape(GeoPolygon(outerRing: [(50, -80), (62, 22), (22, 22), (-80, -80), (50, -80)], holes: [[(40.7129, -75), (40.7129, -74), (40.7126, -74), (40.7129, -75)], [(-77, -77), (-77, -75), (-75, -75), (-75, -77), (-77, -77)], [(55.6760, 12.5682), (55.6760, 12.5684), (55.6763, 12.5684), (55.6763, 12.5682), (55.6760, 12.5682)]])!, count: 1, expectedMatches: [\"Tomas\"])\n        assertFilterShape(GeoPolygon(outerRing: [(50, -80), (62, 22), (22, 22), (-80, -80), (50, -80)], holes: [[(40.7129, -75), (40.7129, -74), (40.7126, -74), (40.7129, -75)], [(-77, -77), (-77, -75), (-75, -75), (-75, -77), (-77, -77)], [(55.6760, 12.5682), (55.6760, 12.5684), (55.6763, 12.5684), (55.6763, 12.5682), (55.6760, 12.5682)], [(55.6279, 12.0825), (55.6279, 12.0827), (55.6281, 12.0827), (55.6281, 12.0825), (55.6279, 12.0825)]])!, count: 0, expectedMatches: [])\n\n        assertFilterShape(GeoCircle(center: (55.67, 12.56), radiusInRadians: 0.001)!, count: 1, expectedMatches: [\"Maria\"])\n        assertFilterShape(GeoCircle(center: (55.67, 12.56), radiusInRadians: 0.001)!, count: 1, expectedMatches: [\"Maria\"])\n        assertFilterShape(GeoCircle(center: (55.67, 12.56), radius: .kilometers(10)!)!, count: 1, expectedMatches: [\"Maria\"])\n        assertFilterShape(GeoCircle(center: (55.67, 12.56), radius: .kilometers(100)!)!, count: 2, expectedMatches: [\"Maria\", \"Tomas\"])\n        assertFilterShape(GeoCircle(center: (45, -20), radius: .kilometers(5000)!)!, count: 3, expectedMatches: [\"Diana\", \"Maria\", \"Tomas\"])\n        assertFilterShape(GeoCircle(center: (45, -20), radius: .kilometers(5000)!)!, count: 3, expectedMatches: [\"Diana\", \"Maria\", \"Tomas\"])\n\n        func assertFilterShape<U: RLMGeospatial>(_ shape: U, count: Int, expectedMatches: [String]) {\n            let realm = realmWithTestPath()\n            let resultsBox = realm.objects(PersonLocation.self).where { $0.location.geoWithin(shape) }\n            XCTAssertEqual(resultsBox.count, count)\n            expectedMatches.forEach { match in\n                XCTAssertTrue(resultsBox.contains(where: { $0.name == match }))\n            }\n\n            let resultsBoxFilter = realm.objects(PersonLocation.self).filter(\"location IN %@\", shape)\n            XCTAssertEqual(resultsBoxFilter.count, count)\n            expectedMatches.forEach { match in\n                XCTAssertTrue(resultsBoxFilter.contains(where: { $0.name == match }))\n            }\n\n            let resultsBoxNSPredicate = realm.objects(PersonLocation.self).filter(NSPredicate(format: \"location IN %@\", shape as! CVarArg))\n            XCTAssertEqual(resultsBoxNSPredicate.count, count)\n            expectedMatches.forEach { match in\n                XCTAssertTrue(resultsBoxNSPredicate.contains(where: { $0.name == match }))\n            }\n        }\n    }\n\n    func testInvalidTypeValueForObjectGeoPoint() throws {\n        try populatePersonLocationTable()\n\n        let realm = realmWithTestPath()\n        let persons = realm.objects(PersonLocation.self)\n\n        let shape = GeoBox(bottomLeft: (55.6281, 12.0826), topRight: (55.6762, 12.5684))!\n        // Executing the query will return one object which is in the region of the GeoBox\n        XCTAssertEqual(realm.objects(PersonLocation.self).where { $0.location.geoWithin(shape) }.count, 1)\n\n        try realm.write {\n            for person in persons {\n                person.location?.type = \"Polygon\"\n            }\n        }\n\n        // Even though one of the GeoPoints is within the box regions, having the type set as\n        // Polygon will cause a no return.\n        XCTAssertEqual(realm.objects(PersonLocation.self).where { $0.location.geoWithin(shape) }.count, 0)\n    }\n\n    func testInvalidObjectTypesForGeoQuery() throws {\n        let realm = realmWithTestPath()\n\n        // Populate\n        try realm.write {\n            let geoPointCoordinatesEmbedded = CoordinatesGeoPointEmbedded()\n            geoPointCoordinatesEmbedded.coordinates.append(objectsIn: [2, 1])\n\n            let geoPointTypeEmbedded = TypeGeoPointEmbedded()\n            let topLevelGeoPoint = TopLevelGeoPoint()\n\n            let object = PersonWithInvalidTypes()\n            object.geoPointCoordinatesEmbedded = geoPointCoordinatesEmbedded\n            object.geoPointTypeEmbedded = geoPointTypeEmbedded\n            object.geoPoint = topLevelGeoPoint\n            realm.add(object)\n        }\n\n        let shape = GeoCircle(center: (0, 0), radiusInRadians: 10.0)!\n\n        assertThrowsFilter(PersonWithInvalidTypes.self, query: {\n            $0.geoPointCoordinatesEmbedded.geoWithin(shape)\n        }, reason: \"Query 'geoPointCoordinatesEmbedded GEOWITHIN GeoCircle([0, 0, 0], 10)' links to data in the wrong format for a geoWithin query\")\n\n        assertThrowsFilter(PersonWithInvalidTypes.self, query: { $0.geoPointTypeEmbedded.geoWithin(shape) }, reason: \"Query 'geoPointTypeEmbedded GEOWITHIN GeoCircle([0, 0, 0], 10)' links to data in the wrong format for a geoWithin query\")\n\n        // This is only allowed using filter/NSPredicate\n        assertThrows(realm.objects(PersonWithInvalidTypes.self).filter(NSPredicate(format: \"geoPoint IN %@\", shape)), reason: \"A GEOWITHIN query can only operate on a link to an embedded class but 'TopLevelGeoPoint' is at the top level\")\n\n        func assertThrowsFilter<T: Object>(_ object: T.Type, query: ((Query<T>) -> Query<Bool>), reason: String) {\n            let realm = realmWithTestPath()\n            assertThrows(realm.objects(object).where(query), reason: reason)\n\n            let (queryStr, constructedValues) = query(Query<T>._constructForTesting())._constructPredicate()\n            assertThrows(realm.objects(object)\n                .filter(queryStr, constructedValues), reason: reason)\n            assertThrows(realm.objects(object)\n                .filter(NSPredicate(format: queryStr, argumentArray: constructedValues)), reason: reason)\n        }\n    }\n\n    func testGeoPolygonHoleNotContainedInOuterRingThrows() throws {\n        let realm = realmWithTestPath()\n        assertThrows(realm.objects(PersonLocation.self).where { $0.location.geoWithin(GeoPolygon(outerRing: [(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)], holes: [[(2, 2), (2, 3), (3, 3), (3, 2), (2, 2)]])!) }, reason: \"Invalid region in GEOWITHIN query for parameter 'GeoPolygon({[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0], [0, 0, 0]}, {[2, 2, 0], [3, 2, 0], [3, 3, 0], [2, 3, 0], [2, 2, 0]})': 'Secondary ring 1 not contained by first exterior ring - secondary rings must be holes in the first ring\")\n        assertThrows(realm.objects(PersonLocation.self).where { $0.location.geoWithin(GeoPolygon(outerRing: [(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)], holes: [[(0, 0.1), (0.5, 0.1), (0.5, 0.5), (0, 0.5), (0, 0.1)]])!) }, reason: \"Invalid region in GEOWITHIN query for parameter 'GeoPolygon({[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0], [0, 0, 0]}, {[0.1, 0, 0], [0.1, 0.5, 0], [0.5, 0.5, 0], [0.5, 0, 0], [0.1, 0, 0]})': 'Secondary ring 1 not contained by first exterior ring - secondary rings must be holes in the first ring\")\n        assertThrows(realm.objects(PersonLocation.self).where { $0.location.geoWithin(GeoPolygon(outerRing: [(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)], holes: [[(0.25, 0.5), (0.75, 0.5), (0.75, 1.5), (0.25, 1.5), (0.25, 0.5)]])!) }, reason: \"Invalid region in GEOWITHIN query for parameter 'GeoPolygon({[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0], [0, 0, 0]}, {[0.5, 0.25, 0], [0.5, 0.75, 0], [1.5, 0.75, 0], [1.5, 0.25, 0], [0.5, 0.25, 0]})': 'Secondary ring 1 not contained by first exterior ring - secondary rings must be holes in the first ring\")\n    }\n\n    func testGeoPolygonWithEdgesIntersectionThrows() throws {\n        let realm = realmWithTestPath()\n        assertThrows(realm.objects(PersonLocation.self).where { $0.location.geoWithin(GeoPolygon(outerRing: [GeoPoint(latitude: 50, longitude: -50)!, GeoPoint(latitude: 55, longitude: 55)!, GeoPoint(latitude: -50, longitude: 50)!, GeoPoint(latitude: 70, longitude: -25)!, GeoPoint(latitude: 50, longitude: -50)!])!) }, reason: \"Invalid region in GEOWITHIN query for parameter 'GeoPolygon({[-50, 50, 0], [55, 55, 0], [50, -50, 0], [-25, 70, 0], [-50, 50, 0]})': 'Ring 0 is not valid: 'Edges 0 and 2 cross. Edge locations in degrees: [50.0000000, -50.0000000]-[55.0000000, 55.0000000] and [-50.0000000, 50.0000000]-[70.0000000, -25.0000000]''\")\n    }\n\n    func testGeoPolygonDuplicateEdgesThrows() throws {\n        let realm = realmWithTestPath()\n        assertThrows(realm.objects(PersonLocation.self).where { $0.location.geoWithin(GeoPolygon(outerRing: [(50, -80), (60, 20), (20, 20), (-80, -80), (50, -80)], holes: [[(40.0096192, -75.5175781), (60, 20), (20, 20), (-75.5175781, -75.5175781), (40.0096192, -75.5175781)]])!) }, reason: \"Invalid region in GEOWITHIN query for parameter 'GeoPolygon({[-80, 50, 0], [20, 60, 0], [20, 20, 0], [-80, -80, 0], [-80, 50, 0]}, {[-75.5176, 40.0096, 0], [20, 60, 0], [20, 20, 0], [-75.5176, -75.5176, 0], [-75.5176, 40.0096, 0]})': 'Polygon isn't valid: 'Duplicate edge: ring 1, edge 1 and ring 0, edge 1''\")\n    }\n\n    func testGeoPolygonNestedRingsThrows() throws {\n        let realm = realmWithTestPath()\n        assertThrows(realm.objects(PersonLocation.self).where { $0.location.geoWithin(GeoPolygon(outerRing: [(50, -80), (62, 22), (22, 22), (-80, -80), (50, -80)], holes: [[(45, -77), (61, 21), (21, 21), (-77, -77), (45, -77)], [(40.0096192, -75.5175780), (60, 20), (20, 20), (-75.5175781, -75.5175781), (40.0096192, -75.5175780)]])!) }, reason: \"Invalid region in GEOWITHIN query for parameter 'GeoPolygon({[-80, 50, 0], [22, 62, 0], [22, 22, 0], [-80, -80, 0], [-80, 50, 0]}, {[-77, 45, 0], [21, 61, 0], [21, 21, 0], [-77, -77, 0], [-77, 45, 0]}, {[-75.5176, 40.0096, 0], [20, 60, 0], [20, 20, 0], [-75.5176, -75.5176, 0], [-75.5176, 40.0096, 0]})': 'Polygon interior rings cannot be nested: 2\")\n    }\n\n    func testGeoEquality() throws {\n        XCTAssertEqual(GeoPoint(latitude: 1, longitude: 1, altitude: 1), GeoPoint(latitude: 1, longitude: 1, altitude: 1))\n        XCTAssertNotEqual(GeoPoint(latitude: 1, longitude: 1, altitude: 1), GeoPoint(latitude: 2, longitude: 1, altitude: 1))\n        XCTAssertNotEqual(GeoPoint(latitude: 1, longitude: 1, altitude: 1), GeoPoint(latitude: 1, longitude: 2, altitude: 1))\n        XCTAssertNotEqual(GeoPoint(latitude: 1, longitude: 1, altitude: 1), GeoPoint(latitude: 1, longitude: 1, altitude: 2))\n\n        XCTAssertEqual(GeoBox(bottomLeft: (0, 0), topRight: (1, 1)), GeoBox(bottomLeft: (0, 0), topRight: (1, 1)))\n        XCTAssertNotEqual(GeoBox(bottomLeft: (1, 1), topRight: (0, 0)), GeoBox(bottomLeft: (0, 0), topRight: (1, 1)))\n\n        XCTAssertEqual(GeoPolygon(outerRing: [(0, 0), (10, 0), (5, 4), (0, 0)], holes: [[(1, 1), (9, 0), (4, 4), (1, 1)]]), GeoPolygon(outerRing: [(0, 0), (10, 0), (5, 4), (0, 0)], holes: [[(1, 1), (9, 0), (4, 4), (1, 1)]]))\n        XCTAssertNotEqual(GeoPolygon(outerRing: [(0, 0), (15, 0), (5, 4), (0, 0)], holes: [[(1, 1), (9, 0), (4, 4), (1, 1)]]), GeoPolygon(outerRing: [(0, 0), (10, 0), (5, 4), (0, 0)], holes: [[(1, 1), (9, 0), (4, 4), (1, 1)]]))\n        XCTAssertNotEqual(GeoPolygon(outerRing: [(0, 0), (10, 0), (5, 4), (0, 0)], holes: [[(1, 1), (9, 0), (3, 3), (1, 1)]]), GeoPolygon(outerRing: [(0, 0), (10, 0), (5, 4), (0, 0)], holes: [[(1, 1), (9, 0), (4, 4), (1, 1)]]))\n\n        XCTAssertEqual(GeoCircle(center: (55.67, 12.56), radiusInRadians: 0.001), GeoCircle(center: (55.67, 12.56), radiusInRadians: 0.001))\n        XCTAssertNotEqual(GeoCircle(center: (55, 12), radiusInRadians: 1), GeoCircle(center: (55, 13), radiusInRadians: 1))\n        XCTAssertNotEqual(GeoCircle(center: (55, 12), radiusInRadians: 1), GeoCircle(center: (55, 12), radiusInRadians: 5))\n\n        XCTAssertEqual(Distance.kilometers(1), Distance.kilometers(1))\n        XCTAssertEqual(Distance.miles(1), Distance.miles(1))\n        XCTAssertEqual(Distance.radians(50), Distance.radians(50))\n        XCTAssertEqual(Distance.degrees(180), Distance.degrees(180))\n        XCTAssertNotEqual(Distance.kilometers(25.01), Distance.kilometers(25.02))\n        XCTAssertNotEqual(Distance.miles(6.055), Distance.miles(6.054))\n        XCTAssertNotEqual(Distance.degrees(180.04), Distance.degrees(180.05))\n        XCTAssertNotEqual(Distance.radians(20.00007695), Distance.degrees(20.00007694))\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/KVOTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass SwiftKVOObject: Object {\n    @objc dynamic var pk = ObjectId.generate() // primary key for equality\n    @objc dynamic var ignored: Int = 0\n\n    @objc dynamic var boolCol: Bool = false\n    @objc dynamic var int8Col: Int8 = 1\n    @objc dynamic var int16Col: Int16 = 2\n    @objc dynamic var int32Col: Int32 = 3\n    @objc dynamic var int64Col: Int64 = 4\n    @objc dynamic var floatCol: Float = 5\n    @objc dynamic var doubleCol: Double = 6\n    @objc dynamic var stringCol: String = \"\"\n    @objc dynamic var binaryCol: Data = Data()\n    @objc dynamic var dateCol: Date = Date(timeIntervalSince1970: 0)\n    @objc dynamic var decimalCol: Decimal128 = Decimal128(number: 1)\n    @objc dynamic var objectIdCol = ObjectId()\n    @objc dynamic var objectCol: SwiftKVOObject?\n    let arrayCol = List<SwiftKVOObject>()\n    let setCol = MutableSet<SwiftKVOObject>()\n    let optIntCol = RealmOptional<Int>()\n    let optFloatCol = RealmOptional<Float>()\n    let optDoubleCol = RealmOptional<Double>()\n    let optBoolCol = RealmOptional<Bool>()\n    let otherIntCol = RealmProperty<Int?>()\n    let otherFloatCol = RealmProperty<Float?>()\n    let otherDoubleCol = RealmProperty<Double?>()\n    let otherBoolCol = RealmProperty<Bool?>()\n    let otherAnyCol = RealmProperty<AnyRealmValue>()\n    @objc dynamic var optStringCol: String?\n    @objc dynamic var optBinaryCol: Data?\n    @objc dynamic var optDateCol: Date?\n    @objc dynamic var optDecimalCol: Decimal128?\n    @objc dynamic var optObjectIdCol: ObjectId?\n\n    let arrayBool = List<Bool>()\n    let arrayInt8 = List<Int8>()\n    let arrayInt16 = List<Int16>()\n    let arrayInt32 = List<Int32>()\n    let arrayInt64 = List<Int64>()\n    let arrayFloat = List<Float>()\n    let arrayDouble = List<Double>()\n    let arrayString = List<String>()\n    let arrayBinary = List<Data>()\n    let arrayDate = List<Date>()\n    let arrayDecimal = List<Decimal128>()\n    let arrayObjectId = List<ObjectId>()\n    let arrayAny = List<AnyRealmValue>()\n\n    let arrayOptBool = List<Bool?>()\n    let arrayOptInt8 = List<Int8?>()\n    let arrayOptInt16 = List<Int16?>()\n    let arrayOptInt32 = List<Int32?>()\n    let arrayOptInt64 = List<Int64?>()\n    let arrayOptFloat = List<Float?>()\n    let arrayOptDouble = List<Double?>()\n    let arrayOptString = List<String?>()\n    let arrayOptBinary = List<Data?>()\n    let arrayOptDate = List<Date?>()\n    let arrayOptDecimal = List<Decimal128?>()\n    let arrayOptObjectId = List<ObjectId?>()\n\n    let setBool = MutableSet<Bool>()\n    let setInt8 = MutableSet<Int8>()\n    let setInt16 = MutableSet<Int16>()\n    let setInt32 = MutableSet<Int32>()\n    let setInt64 = MutableSet<Int64>()\n    let setFloat = MutableSet<Float>()\n    let setDouble = MutableSet<Double>()\n    let setString = MutableSet<String>()\n    let setBinary = MutableSet<Data>()\n    let setDate = MutableSet<Date>()\n    let setDecimal = MutableSet<Decimal128>()\n    let setObjectId = MutableSet<ObjectId>()\n    let setAny = MutableSet<AnyRealmValue>()\n\n    let setOptBool = MutableSet<Bool?>()\n    let setOptInt8 = MutableSet<Int8?>()\n    let setOptInt16 = MutableSet<Int16?>()\n    let setOptInt32 = MutableSet<Int32?>()\n    let setOptInt64 = MutableSet<Int64?>()\n    let setOptFloat = MutableSet<Float?>()\n    let setOptDouble = MutableSet<Double?>()\n    let setOptString = MutableSet<String?>()\n    let setOptBinary = MutableSet<Data?>()\n    let setOptDate = MutableSet<Date?>()\n    let setOptDecimal = MutableSet<Decimal128?>()\n    let setOptObjectId = MutableSet<ObjectId?>()\n\n    let mapBool = Map<String, Bool>()\n    let mapInt8 = Map<String, Int8>()\n    let mapInt16 = Map<String, Int16>()\n    let mapInt32 = Map<String, Int32>()\n    let mapInt64 = Map<String, Int64>()\n    let mapFloat = Map<String, Float>()\n    let mapDouble = Map<String, Double>()\n    let mapString = Map<String, String>()\n    let mapBinary = Map<String, Data>()\n    let mapDate = Map<String, Date>()\n    let mapDecimal = Map<String, Decimal128>()\n    let mapObjectId = Map<String, ObjectId>()\n    let mapAny = Map<String, AnyRealmValue>()\n\n    let mapOptBool = Map<String, Bool?>()\n    let mapOptInt8 = Map<String, Int8?>()\n    let mapOptInt16 = Map<String, Int16?>()\n    let mapOptInt32 = Map<String, Int32?>()\n    let mapOptInt64 = Map<String, Int64?>()\n    let mapOptFloat = Map<String, Float?>()\n    let mapOptDouble = Map<String, Double?>()\n    let mapOptString = Map<String, String?>()\n    let mapOptBinary = Map<String, Data?>()\n    let mapOptDate = Map<String, Date?>()\n    let mapOptDecimal = Map<String, Decimal128?>()\n    let mapOptObjectId = Map<String, ObjectId?>()\n\n    override class func primaryKey() -> String { return \"pk\" }\n    override class func ignoredProperties() -> [String] { return [\"ignored\"] }\n}\n\n// Most of the testing of KVO functionality is done in the obj-c tests\n// These tests just verify that it also works on Swift types\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass KVOTests: TestCase {\n    var realm: Realm! = nil\n\n    override func setUp() {\n        super.setUp()\n        realm = try! Realm()\n        realm.beginWrite()\n    }\n\n    override func tearDown() {\n        realm.cancelWrite()\n        realm = nil\n        super.tearDown()\n    }\n\n    var changeDictionary: [NSKeyValueChangeKey: Any]?\n\n    override func observeValue(forKeyPath keyPath: String?, of object: Any?,\n                               change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) {\n        changeDictionary = change\n    }\n\n    // swiftlint:disable:next cyclomatic_complexity\n    func observeChange<T: Equatable>(_ obj: SwiftKVOObject, _ key: String, _ old: T?, _ new: T?,\n                                     fileName: StaticString = #file, lineNumber: UInt = #line, _ block: () -> Void) {\n        let kvoOptions: NSKeyValueObservingOptions = [.old, .new]\n        obj.addObserver(self, forKeyPath: key, options: kvoOptions, context: nil)\n        block()\n        obj.removeObserver(self, forKeyPath: key)\n\n        XCTAssert(changeDictionary != nil, \"Did not get a notification\", file: (fileName), line: lineNumber)\n        guard changeDictionary != nil else { return }\n\n        let actualOld = changeDictionary![.oldKey] as? T\n        let actualNew = changeDictionary![.newKey] as? T\n\n        XCTAssert(old == actualOld,\n                  \"Old value: expected \\(String(describing: old)), got \\(String(describing: actualOld))\",\n                  file: (fileName), line: lineNumber)\n        XCTAssert(new == actualNew,\n                  \"New value: expected \\(String(describing: new)), got \\(String(describing: actualNew))\",\n                  file: (fileName), line: lineNumber)\n\n        changeDictionary = nil\n    }\n\n    func observeChange<T: Equatable>(\n        _ obj: SwiftKVOObject, _ keyPath: KeyPath<SwiftKVOObject, T>, _ old: T, _ new: T,\n        fileName: StaticString = #filePath, lineNumber: UInt = #line, _ block: () -> Void\n    ) {\n        // observe()'s callback is marked as Sendable, but we'll only ever call it from the same thread\n        let kvoOptions: NSKeyValueObservingOptions = [.old, .new]\n        nonisolated(unsafe) var gotNotification = false\n        nonisolated(unsafe) let nonisolatedOld = old\n        nonisolated(unsafe) let nonisolatedNew = new\n        let observation = obj.observe(keyPath, options: kvoOptions) { _, change in\n            XCTAssertEqual(change.oldValue, nonisolatedOld, file: fileName, line: lineNumber)\n            XCTAssertEqual(change.newValue, nonisolatedNew, file: fileName, line: lineNumber)\n            gotNotification = true\n        }\n\n        block()\n        observation.invalidate()\n\n        XCTAssertTrue(gotNotification, file: (fileName), line: lineNumber)\n    }\n\n    func observeChange<T: Equatable>(\n        _ obj: SwiftKVOObject, _ keyPath: KeyPath<SwiftKVOObject, T?>, _ old: T?, _ new: T?,\n        fileName: StaticString = #filePath, lineNumber: UInt = #line, _ block: () -> Void\n    ) {\n        let kvoOptions: NSKeyValueObservingOptions = [.old, .new]\n        nonisolated(unsafe) var gotNotification = false\n        nonisolated(unsafe) let nonisolatedOld = old\n        nonisolated(unsafe) let nonisolatedNew = new\n        let observation = obj.observe(keyPath, options: kvoOptions) { _, change in\n            if let oldValue = change.oldValue {\n                XCTAssertEqual(oldValue, nonisolatedOld, file: (fileName), line: lineNumber)\n            } else {\n                XCTAssertNil(nonisolatedOld, file: (fileName), line: lineNumber)\n            }\n            if let newValue = change.newValue {\n                XCTAssertEqual(newValue, nonisolatedNew, file: (fileName), line: lineNumber)\n            } else {\n                XCTAssertNil(nonisolatedNew, file: (fileName), line: lineNumber)\n            }\n            gotNotification = true\n        }\n\n        block()\n        observation.invalidate()\n\n        XCTAssertTrue(gotNotification, file: (fileName), line: lineNumber)\n    }\n\n    func observeListChange(_ obj: NSObject, _ key: String, _ kind: NSKeyValueChange, _ indexes: NSIndexSet = NSIndexSet(index: 0),\n                           fileName: StaticString = #file, lineNumber: UInt = #line, _ block: () -> Void) {\n        obj.addObserver(self, forKeyPath: key, options: [.old, .new], context: nil)\n        block()\n        obj.removeObserver(self, forKeyPath: key)\n        XCTAssert(changeDictionary != nil, \"Did not get a notification\", file: (fileName), line: lineNumber)\n        guard changeDictionary != nil else { return }\n\n        let actualKind = NSKeyValueChange(rawValue: (changeDictionary![NSKeyValueChangeKey.kindKey] as! NSNumber).uintValue)!\n        let actualIndexes = changeDictionary![NSKeyValueChangeKey.indexesKey]! as! NSIndexSet\n        XCTAssert(actualKind == kind, \"Change kind: expected \\(kind), got \\(actualKind)\", file: (fileName),\n            line: lineNumber)\n        XCTAssert(actualIndexes.isEqual(indexes), \"Changed indexes: expected \\(indexes), got \\(actualIndexes)\",\n                  file: (fileName), line: lineNumber)\n\n        changeDictionary = nil\n    }\n\n    func observeSetChange(_ obj: SwiftKVOObject, _ key: String,\n                          fileName: StaticString = #file, lineNumber: UInt = #line, _ block: () -> Void) {\n        obj.addObserver(self, forKeyPath: key, options: [], context: nil)\n        block()\n        obj.removeObserver(self, forKeyPath: key)\n\n        XCTAssert(changeDictionary != nil, \"Did not get a notification\", file: (fileName), line: lineNumber)\n        guard changeDictionary != nil else { return }\n    }\n\n    func getObject(_ obj: SwiftKVOObject) -> (SwiftKVOObject, SwiftKVOObject) {\n        return (obj, obj)\n    }\n\n    // Actual tests follow\n\n    func testAllPropertyTypes() {\n        let (obj, obs) = getObject(SwiftKVOObject())\n\n        observeChange(obs, \"boolCol\", false, true) { obj.boolCol = true }\n        observeChange(obs, \"int8Col\", 1 as Int8, 10) { obj.int8Col = 10 }\n        observeChange(obs, \"int16Col\", 2 as Int16, 10) { obj.int16Col = 10 }\n        observeChange(obs, \"int32Col\", 3 as Int32, 10) { obj.int32Col = 10 }\n        observeChange(obs, \"int64Col\", 4 as Int64, 10) { obj.int64Col = 10 }\n        observeChange(obs, \"floatCol\", 5 as Float, 10) { obj.floatCol = 10 }\n        observeChange(obs, \"doubleCol\", 6 as Double, 10) { obj.doubleCol = 10 }\n        observeChange(obs, \"stringCol\", \"\", \"abc\") { obj.stringCol = \"abc\" }\n        observeChange(obs, \"objectCol\", nil, obj) { obj.objectCol = obj }\n\n        let data = \"abc\".data(using: String.Encoding.utf8, allowLossyConversion: false)!\n        observeChange(obs, \"binaryCol\", Data(), data) { obj.binaryCol = data }\n\n        let date = Date(timeIntervalSince1970: 1)\n        observeChange(obs, \"dateCol\", Date(timeIntervalSince1970: 0), date) { obj.dateCol = date }\n\n        let decimal = Decimal128(number: 2)\n        observeChange(obs, \"decimalCol\", Decimal128(number: 1), decimal) { obj.decimalCol = decimal }\n\n        let oldObjectId = obj.objectIdCol\n        let objectId = ObjectId()\n        observeChange(obs, \"objectIdCol\", oldObjectId, objectId) { obj.objectIdCol = objectId }\n\n        observeListChange(obs, \"arrayCol\", .insertion) { obj.arrayCol.append(obj) }\n        observeListChange(obs, \"arrayCol\", .removal) { obj.arrayCol.removeAll() }\n        observeSetChange(obs, \"setCol\") { obj.setCol.insert(obj) }\n        observeSetChange(obs, \"setCol\") { obj.setCol.remove(obj) }\n\n        observeChange(obs, \"optIntCol\", nil, 10) { obj.optIntCol.value = 10 }\n        observeChange(obs, \"optFloatCol\", nil, 10.0) { obj.optFloatCol.value = 10 }\n        observeChange(obs, \"optDoubleCol\", nil, 10.0) { obj.optDoubleCol.value = 10 }\n        observeChange(obs, \"optBoolCol\", nil, true) { obj.optBoolCol.value = true }\n        observeChange(obs, \"optStringCol\", nil, \"abc\") { obj.optStringCol = \"abc\" }\n        observeChange(obs, \"optBinaryCol\", nil, data) { obj.optBinaryCol = data }\n        observeChange(obs, \"optDateCol\", nil, date) { obj.optDateCol = date }\n        observeChange(obs, \"optDecimalCol\", nil, decimal) { obj.optDecimalCol = decimal }\n        observeChange(obs, \"optObjectIdCol\", nil, objectId) { obj.optObjectIdCol = objectId }\n\n        observeChange(obs, \"otherIntCol\", nil, 10) { obj.otherIntCol.value = 10 }\n        observeChange(obs, \"otherFloatCol\", nil, 10.0) { obj.otherFloatCol.value = 10 }\n        observeChange(obs, \"otherDoubleCol\", nil, 10.0) { obj.otherDoubleCol.value = 10 }\n        observeChange(obs, \"otherBoolCol\", nil, true) { obj.otherBoolCol.value = true }\n\n        observeChange(obs, \"optIntCol\", 10, nil) { obj.optIntCol.value = nil }\n        observeChange(obs, \"optFloatCol\", 10.0, nil) { obj.optFloatCol.value = nil }\n        observeChange(obs, \"optDoubleCol\", 10.0, nil) { obj.optDoubleCol.value = nil }\n        observeChange(obs, \"optBoolCol\", true, nil) { obj.optBoolCol.value = nil }\n        observeChange(obs, \"optStringCol\", \"abc\", nil) { obj.optStringCol = nil }\n        observeChange(obs, \"optBinaryCol\", data, nil) { obj.optBinaryCol = nil }\n        observeChange(obs, \"optDateCol\", date, nil) { obj.optDateCol = nil }\n        observeChange(obs, \"optDecimalCol\", decimal, nil) { obj.optDecimalCol = nil }\n        observeChange(obs, \"optObjectIdCol\", objectId, nil) { obj.optObjectIdCol = nil }\n\n        observeChange(obs, \"otherIntCol\", 10, nil) { obj.otherIntCol.value = nil }\n        observeChange(obs, \"otherFloatCol\", 10.0, nil) { obj.otherFloatCol.value = nil }\n        observeChange(obs, \"otherDoubleCol\", 10.0, nil) { obj.otherDoubleCol.value = nil }\n        observeChange(obs, \"otherBoolCol\", true, nil) { obj.otherBoolCol.value = nil }\n\n        observeListChange(obs, \"arrayBool\", .insertion) { obj.arrayBool.append(true) }\n        observeListChange(obs, \"arrayInt8\", .insertion) { obj.arrayInt8.append(10) }\n        observeListChange(obs, \"arrayInt16\", .insertion) { obj.arrayInt16.append(10) }\n        observeListChange(obs, \"arrayInt32\", .insertion) { obj.arrayInt32.append(10) }\n        observeListChange(obs, \"arrayInt64\", .insertion) { obj.arrayInt64.append(10) }\n        observeListChange(obs, \"arrayFloat\", .insertion) { obj.arrayFloat.append(10) }\n        observeListChange(obs, \"arrayDouble\", .insertion) { obj.arrayDouble.append(10) }\n        observeListChange(obs, \"arrayString\", .insertion) { obj.arrayString.append(\"abc\") }\n        observeListChange(obs, \"arrayDecimal\", .insertion) { obj.arrayDecimal.append(decimal) }\n        observeListChange(obs, \"arrayObjectId\", .insertion) { obj.arrayObjectId.append(objectId) }\n\n        observeListChange(obs, \"arrayOptBool\", .insertion) { obj.arrayOptBool.append(true) }\n        observeListChange(obs, \"arrayOptInt8\", .insertion) { obj.arrayOptInt8.append(10) }\n        observeListChange(obs, \"arrayOptInt16\", .insertion) { obj.arrayOptInt16.append(10) }\n        observeListChange(obs, \"arrayOptInt32\", .insertion) { obj.arrayOptInt32.append(10) }\n        observeListChange(obs, \"arrayOptInt64\", .insertion) { obj.arrayOptInt64.append(10) }\n        observeListChange(obs, \"arrayOptFloat\", .insertion) { obj.arrayOptFloat.append(10) }\n        observeListChange(obs, \"arrayOptDouble\", .insertion) { obj.arrayOptDouble.append(10) }\n        observeListChange(obs, \"arrayOptString\", .insertion) { obj.arrayOptString.append(\"abc\") }\n        observeListChange(obs, \"arrayOptBinary\", .insertion) { obj.arrayOptBinary.append(data) }\n        observeListChange(obs, \"arrayOptDate\", .insertion) { obj.arrayOptDate.append(date) }\n        observeListChange(obs, \"arrayOptDecimal\", .insertion) { obj.arrayOptDecimal.append(decimal) }\n        observeListChange(obs, \"arrayOptObjectId\", .insertion) { obj.arrayOptObjectId.append(objectId) }\n\n        observeListChange(obs, \"arrayOptBool\", .insertion) { obj.arrayOptBool.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptInt8\", .insertion) { obj.arrayOptInt8.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptInt16\", .insertion) { obj.arrayOptInt16.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptInt32\", .insertion) { obj.arrayOptInt32.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptInt64\", .insertion) { obj.arrayOptInt64.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptFloat\", .insertion) { obj.arrayOptFloat.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptDouble\", .insertion) { obj.arrayOptDouble.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptString\", .insertion) { obj.arrayOptString.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptDate\", .insertion) { obj.arrayOptDate.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptBinary\", .insertion) { obj.arrayOptBinary.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptDecimal\", .insertion) { obj.arrayOptDecimal.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptObjectId\", .insertion) { obj.arrayOptObjectId.insert(nil, at: 0) }\n\n        observeSetChange(obs, \"setBool\") { obj.setBool.insert(true) }\n        observeSetChange(obs, \"setInt8\") { obj.setInt8.insert(10) }\n        observeSetChange(obs, \"setInt16\") { obj.setInt16.insert(10) }\n        observeSetChange(obs, \"setInt32\") { obj.setInt32.insert(10) }\n        observeSetChange(obs, \"setInt64\") { obj.setInt64.insert(10) }\n        observeSetChange(obs, \"setFloat\") { obj.setFloat.insert(10) }\n        observeSetChange(obs, \"setDouble\") { obj.setDouble.insert(10) }\n        observeSetChange(obs, \"setString\") { obj.setString.insert(\"abc\") }\n        observeSetChange(obs, \"setDecimal\") { obj.setDecimal.insert(decimal) }\n        observeSetChange(obs, \"setObjectId\") { obj.setObjectId.insert(objectId) }\n\n        observeSetChange(obs, \"setOptBool\") { obj.setOptBool.insert(true) }\n        observeSetChange(obs, \"setOptInt8\") { obj.setOptInt8.insert(10) }\n        observeSetChange(obs, \"setOptInt16\") { obj.setOptInt16.insert(10) }\n        observeSetChange(obs, \"setOptInt32\") { obj.setOptInt32.insert(10) }\n        observeSetChange(obs, \"setOptInt64\") { obj.setOptInt64.insert(10) }\n        observeSetChange(obs, \"setOptFloat\") { obj.setOptFloat.insert(10) }\n        observeSetChange(obs, \"setOptDouble\") { obj.setOptDouble.insert(10) }\n        observeSetChange(obs, \"setOptString\") { obj.setOptString.insert(\"abc\") }\n        observeSetChange(obs, \"setOptBinary\") { obj.setOptBinary.insert(data) }\n        observeSetChange(obs, \"setOptDate\") { obj.setOptDate.insert(date) }\n        observeSetChange(obs, \"setOptDecimal\") { obj.setOptDecimal.insert(decimal) }\n        observeSetChange(obs, \"setOptObjectId\") { obj.setOptObjectId.insert(objectId) }\n\n        observeSetChange(obs, \"setOptBool\") { obj.setOptBool.insert(nil) }\n        observeSetChange(obs, \"setOptInt8\") { obj.setOptInt8.insert(nil) }\n        observeSetChange(obs, \"setOptInt16\") { obj.setOptInt16.insert(nil) }\n        observeSetChange(obs, \"setOptInt32\") { obj.setOptInt32.insert(nil) }\n        observeSetChange(obs, \"setOptInt64\") { obj.setOptInt64.insert(nil) }\n        observeSetChange(obs, \"setOptFloat\") { obj.setOptFloat.insert(nil) }\n        observeSetChange(obs, \"setOptDouble\") { obj.setOptDouble.insert(nil) }\n        observeSetChange(obs, \"setOptString\") { obj.setOptString.insert(nil) }\n        observeSetChange(obs, \"setOptDate\") { obj.setOptDate.insert(nil) }\n        observeSetChange(obs, \"setOptBinary\") { obj.setOptBinary.insert(nil) }\n        observeSetChange(obs, \"setOptDecimal\") { obj.setOptDecimal.insert(nil) }\n        observeSetChange(obs, \"setOptObjectId\") { obj.setOptObjectId.insert(nil) }\n\n        observeSetChange(obs, \"mapBool\") { obj.mapBool[\"key\"] = true }\n        observeSetChange(obs, \"mapInt8\") { obj.mapInt8[\"key\"] = 10 }\n        observeSetChange(obs, \"mapInt16\") { obj.mapInt16[\"key\"] = 10 }\n        observeSetChange(obs, \"mapInt32\") { obj.mapInt32[\"key\"] = 10 }\n        observeSetChange(obs, \"mapInt64\") { obj.mapInt64[\"key\"] = 10 }\n        observeSetChange(obs, \"mapFloat\") { obj.mapFloat[\"key\"] = 10 }\n        observeSetChange(obs, \"mapDouble\") { obj.mapDouble[\"key\"] = 10 }\n        observeSetChange(obs, \"mapString\") { obj.mapString[\"key\"] = \"abc\" }\n        observeSetChange(obs, \"mapDecimal\") { obj.mapDecimal[\"key\"] = decimal }\n        observeSetChange(obs, \"mapObjectId\") { obj.mapObjectId[\"key\"] = objectId }\n\n        observeSetChange(obs, \"mapOptBool\") { obj.mapOptBool[\"key\"] = true }\n        observeSetChange(obs, \"mapOptInt8\") { obj.mapOptInt8[\"key\"] = 10 }\n        observeSetChange(obs, \"mapOptInt16\") { obj.mapOptInt16[\"key\"] = 10 }\n        observeSetChange(obs, \"mapOptInt32\") { obj.mapOptInt32[\"key\"] = 10 }\n        observeSetChange(obs, \"mapOptInt64\") { obj.mapOptInt64[\"key\"] = 10 }\n        observeSetChange(obs, \"mapOptFloat\") { obj.mapOptFloat[\"key\"] = 10 }\n        observeSetChange(obs, \"mapOptDouble\") { obj.mapOptDouble[\"key\"] = 10 }\n        observeSetChange(obs, \"mapOptString\") { obj.mapOptString[\"key\"] = \"abc\" }\n        observeSetChange(obs, \"mapOptDecimal\") { obj.mapOptDecimal[\"key\"] = decimal }\n        observeSetChange(obs, \"mapOptObjectId\") { obj.mapOptObjectId[\"key\"] = objectId }\n\n        observeSetChange(obs, \"mapOptBool\") { obj.mapOptBool[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptInt8\") { obj.mapOptInt8[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptInt16\") { obj.mapOptInt16[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptInt32\") { obj.mapOptInt32[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptInt64\") { obj.mapOptInt64[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptFloat\") { obj.mapOptFloat[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptDouble\") { obj.mapOptDouble[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptString\") { obj.mapOptString[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptDecimal\") { obj.mapOptDecimal[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptObjectId\") { obj.mapOptObjectId[\"key\"] = nil }\n\n        if obs.realm == nil {\n            return\n        }\n\n        observeChange(obs, \"invalidated\", false, true) {\n            self.realm.delete(obj)\n        }\n\n        let (obj2, obs2) = getObject(SwiftKVOObject())\n        observeChange(obs2, \"arrayCol.invalidated\", false, true) {\n            self.realm.delete(obj2)\n        }\n\n        let (obj3, obs3) = getObject(SwiftKVOObject())\n        observeChange(obs3, \"setCol.invalidated\", false, true) {\n            self.realm.delete(obj3)\n        }\n\n        let (obj4, obs4) = getObject(SwiftKVOObject())\n        observeChange(obs4, \"mapBool.invalidated\", false, true) {\n            self.realm.delete(obj4)\n        }\n    }\n\n    func testCollectionInMixedKVO() {\n        let (obj, obs) = getObject(SwiftKVOObject())\n\n        observeSetChange(obs, \"otherAnyCol\") { obj.otherAnyCol.value = AnyRealmValue.fromDictionary([\n            \"key1\": .int(1234)]) }\n        observeSetChange(obs, \"otherAnyCol\") { obj.otherAnyCol.value.dictionaryValue?[\"key1\"] = .string(\"hello\") }\n        observeSetChange(obs, \"otherAnyCol\") { obj.otherAnyCol.value.dictionaryValue?[\"key1\"] = nil }\n\n        observeSetChange(obs, \"otherAnyCol\") { obj.otherAnyCol.value = AnyRealmValue.fromArray([.bool(true)]) }\n        observeSetChange(obs, \"otherAnyCol\") { obj.otherAnyCol.value.listValue?[0] = .float(123.456) }\n        observeSetChange(obs, \"otherAnyCol\") { obj.otherAnyCol.value.listValue?.append(.bool(true)) }\n        observeSetChange(obs, \"otherAnyCol\") { obj.otherAnyCol.value.listValue?.insert(.date(Date()), at: 1) }\n        observeSetChange(obs, \"otherAnyCol\") { obj.otherAnyCol.value.listValue?.remove(at: 0) }\n    }\n\n    func testTypedObservation() {\n        let (obj, obs) = getObject(SwiftKVOObject())\n\n        // Swift 5.2+ warns when a literal keypath to a non-@objc property is\n        // passed to observe(). This only works when it's passed directly and\n        // not via a helper, so make sure we aren't triggering this warning on\n        // any property types.\n        _ = obs.observe(\\.boolCol) { _, _ in }\n        _ = obs.observe(\\.int8Col) { _, _ in }\n        _ = obs.observe(\\.int16Col) { _, _ in }\n        _ = obs.observe(\\.int32Col) { _, _ in }\n        _ = obs.observe(\\.int64Col) { _, _ in }\n        _ = obs.observe(\\.floatCol) { _, _ in }\n        _ = obs.observe(\\.doubleCol) { _, _ in }\n        _ = obs.observe(\\.stringCol) { _, _ in }\n        _ = obs.observe(\\.binaryCol) { _, _ in }\n        _ = obs.observe(\\.dateCol) { _, _ in }\n        _ = obs.observe(\\.objectCol) { _, _ in }\n        _ = obs.observe(\\.optStringCol) { _, _ in }\n        _ = obs.observe(\\.optBinaryCol) { _, _ in }\n        _ = obs.observe(\\.optDateCol) { _, _ in }\n        _ = obs.observe(\\.optStringCol) { _, _ in }\n        _ = obs.observe(\\.optBinaryCol) { _, _ in }\n        _ = obs.observe(\\.optDateCol) { _, _ in }\n        _ = obs.observe(\\.isInvalidated) { _, _ in }\n\n        observeChange(obs, \\.boolCol, false, true) { obj.boolCol = true }\n\n        observeChange(obs, \\.int8Col, 1 as Int8, 10 as Int8) { obj.int8Col = 10 }\n        observeChange(obs, \\.int16Col, 2 as Int16, 10 as Int16) { obj.int16Col = 10 }\n        observeChange(obs, \\.int32Col, 3 as Int32, 10 as Int32) { obj.int32Col = 10 }\n        observeChange(obs, \\.int64Col, 4 as Int64, 10 as Int64) { obj.int64Col = 10 }\n        observeChange(obs, \\.floatCol, 5 as Float, 10 as Float) { obj.floatCol = 10 }\n        observeChange(obs, \\.doubleCol, 6 as Double, 10 as Double) { obj.doubleCol = 10 }\n        observeChange(obs, \\.stringCol, \"\", \"abc\") { obj.stringCol = \"abc\" }\n\n        let data = \"abc\".data(using: String.Encoding.utf8, allowLossyConversion: false)!\n        observeChange(obs, \\.binaryCol, Data(), data) { obj.binaryCol = data }\n\n        let date = Date(timeIntervalSince1970: 1)\n        observeChange(obs, \\.dateCol, Date(timeIntervalSince1970: 0), date) { obj.dateCol = date }\n\n        let decimal = Decimal128(number: 2)\n        observeChange(obs, \\.decimalCol, Decimal128(number: 1), decimal) { obj.decimalCol = decimal }\n\n        let oldObjectId = obj.objectIdCol\n        let objectId = ObjectId()\n        observeChange(obs, \\.objectIdCol, oldObjectId, objectId) { obj.objectIdCol = objectId }\n\n        observeChange(obs, \\.objectCol, nil, obj) { obj.objectCol = obj }\n\n        observeChange(obs, \\.optStringCol, nil, \"abc\") { obj.optStringCol = \"abc\" }\n        observeChange(obs, \\.optBinaryCol, nil, data) { obj.optBinaryCol = data }\n        observeChange(obs, \\.optDateCol, nil, date) { obj.optDateCol = date }\n        observeChange(obs, \\.optDecimalCol, nil, decimal) { obj.optDecimalCol = decimal }\n        observeChange(obs, \\.optObjectIdCol, nil, objectId) { obj.optObjectIdCol = objectId }\n\n        observeChange(obs, \\.optStringCol, \"abc\", nil) { obj.optStringCol = nil }\n        observeChange(obs, \\.optBinaryCol, data, nil) { obj.optBinaryCol = nil }\n        observeChange(obs, \\.optDateCol, date, nil) { obj.optDateCol = nil }\n        observeChange(obs, \\.optDecimalCol, decimal, nil) { obj.optDecimalCol = nil }\n        observeChange(obs, \\.optObjectIdCol, objectId, nil) { obj.optObjectIdCol = nil }\n\n        if obs.realm == nil {\n            return\n        }\n\n        observeChange(obs, \\.isInvalidated, false, true) {\n            self.realm.delete(obj)\n        }\n    }\n\n    func testReadSharedSchemaFromObservedObject() {\n        let obj = SwiftKVOObject()\n        obj.addObserver(self, forKeyPath: \"boolCol\", options: [.old, .new], context: nil)\n        XCTAssertEqual(type(of: obj).sharedSchema(), SwiftKVOObject.sharedSchema())\n        obj.removeObserver(self, forKeyPath: \"boolCol\")\n    }\n}\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass KVOPersistedTests: KVOTests {\n    override func getObject(_ obj: SwiftKVOObject) -> (SwiftKVOObject, SwiftKVOObject) {\n        realm.add(obj)\n        return (obj, obj)\n    }\n}\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass KVOMultipleAccessorsTests: KVOTests {\n    override func getObject(_ obj: SwiftKVOObject) -> (SwiftKVOObject, SwiftKVOObject) {\n        realm.add(obj)\n        return (obj, realm.object(ofType: SwiftKVOObject.self, forPrimaryKey: obj.pk)!)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/KeyPathTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\nimport Foundation\n\nclass KeyPathTests: TestCase {\n    func testModernObjectTopLevel() {\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.pk), \"pk\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.boolCol), \"boolCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.intCol), \"intCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.int8Col), \"int8Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.int16Col), \"int16Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.int32Col), \"int32Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.int64Col), \"int64Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.floatCol), \"floatCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.doubleCol), \"doubleCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.stringCol), \"stringCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.binaryCol), \"binaryCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.dateCol), \"dateCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.decimalCol), \"decimalCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectIdCol), \"objectIdCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol), \"objectCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayCol), \"arrayCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setCol), \"setCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.anyCol), \"anyCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.uuidCol), \"uuidCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.intEnumCol), \"intEnumCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.stringEnumCol), \"stringEnumCol\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.optIntCol), \"optIntCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.optInt8Col), \"optInt8Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.optInt16Col), \"optInt16Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.optInt32Col), \"optInt32Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.optInt64Col), \"optInt64Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.optFloatCol), \"optFloatCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.optDoubleCol), \"optDoubleCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.optStringCol), \"optStringCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.optBinaryCol), \"optBinaryCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.optDateCol), \"optDateCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.optDecimalCol), \"optDecimalCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.optObjectIdCol), \"optObjectIdCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.optUuidCol), \"optUuidCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.optIntEnumCol), \"optIntEnumCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.optStringEnumCol), \"optStringEnumCol\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayBool), \"arrayBool\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayInt), \"arrayInt\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayInt8), \"arrayInt8\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayInt16), \"arrayInt16\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayInt32), \"arrayInt32\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayInt64), \"arrayInt64\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayFloat), \"arrayFloat\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayDouble), \"arrayDouble\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayString), \"arrayString\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayBinary), \"arrayBinary\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayDate), \"arrayDate\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayDecimal), \"arrayDecimal\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayObjectId), \"arrayObjectId\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayAny), \"arrayAny\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayUuid), \"arrayUuid\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayOptBool), \"arrayOptBool\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayOptInt), \"arrayOptInt\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayOptInt8), \"arrayOptInt8\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayOptInt16), \"arrayOptInt16\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayOptInt32), \"arrayOptInt32\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayOptInt64), \"arrayOptInt64\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayOptFloat), \"arrayOptFloat\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayOptDouble), \"arrayOptDouble\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayOptString), \"arrayOptString\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayOptBinary), \"arrayOptBinary\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayOptDate), \"arrayOptDate\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayOptDecimal), \"arrayOptDecimal\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayOptObjectId), \"arrayOptObjectId\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.arrayOptUuid), \"arrayOptUuid\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setBool), \"setBool\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setInt), \"setInt\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setInt8), \"setInt8\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setInt16), \"setInt16\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setInt32), \"setInt32\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setInt64), \"setInt64\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setFloat), \"setFloat\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setDouble), \"setDouble\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setString), \"setString\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setBinary), \"setBinary\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setDate), \"setDate\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setDecimal), \"setDecimal\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setObjectId), \"setObjectId\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setAny), \"setAny\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setUuid), \"setUuid\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setOptBool), \"setOptBool\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setOptInt), \"setOptInt\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setOptInt8), \"setOptInt8\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setOptInt16), \"setOptInt16\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setOptInt32), \"setOptInt32\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setOptInt64), \"setOptInt64\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setOptFloat), \"setOptFloat\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setOptDouble), \"setOptDouble\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setOptString), \"setOptString\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setOptBinary), \"setOptBinary\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setOptDate), \"setOptDate\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setOptDecimal), \"setOptDecimal\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setOptObjectId), \"setOptObjectId\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.setOptUuid), \"setOptUuid\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapBool), \"mapBool\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapInt), \"mapInt\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapInt8), \"mapInt8\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapInt16), \"mapInt16\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapInt32), \"mapInt32\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapInt64), \"mapInt64\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapFloat), \"mapFloat\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapDouble), \"mapDouble\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapString), \"mapString\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapBinary), \"mapBinary\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapDate), \"mapDate\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapDecimal), \"mapDecimal\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapObjectId), \"mapObjectId\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapAny), \"mapAny\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapUuid), \"mapUuid\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapOptBool), \"mapOptBool\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapOptInt), \"mapOptInt\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapOptInt8), \"mapOptInt8\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapOptInt16), \"mapOptInt16\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapOptInt32), \"mapOptInt32\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapOptInt64), \"mapOptInt64\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapOptFloat), \"mapOptFloat\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapOptDouble), \"mapOptDouble\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapOptString), \"mapOptString\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapOptBinary), \"mapOptBinary\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapOptDate), \"mapOptDate\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapOptDecimal), \"mapOptDecimal\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapOptObjectId), \"mapOptObjectId\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.mapOptUuid), \"mapOptUuid\")\n\n        XCTAssertEqual(_name(for: \\ModernKeyPathObject.embeddedCol), \"embeddedCol\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.linkingObjects), \"linkingObjects\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.linkingObjects[0].boolCol), \"linkingObjects.boolCol\")\n\n        XCTAssertEqual(_name(for: \\ModernKeyPathObject.list), \"list\")\n        XCTAssertEqual(_name(for: \\ModernKeyPathObject.list[0].boolCol), \"list.boolCol\")\n        XCTAssertEqual(_name(for: \\ModernKeyPathObject.list[0].objectCol), \"list.objectCol\")\n        XCTAssertEqual(_name(for: \\ModernKeyPathObject.list[0].objectCol?.linkingObjects), \"list.objectCol.linkingObjects\")\n        XCTAssertEqual(_name(for: \\ModernKeyPathObject.list[0].objectCol?.linkingObjects[0].boolCol), \"list.objectCol.linkingObjects.boolCol\")\n\n        XCTAssertEqual(_name(for: \\ModernKeyPathObject.set), \"set\")\n        XCTAssertEqual(_name(for: \\ModernKeyPathObject.set[0].boolCol), \"set.boolCol\")\n        XCTAssertEqual(_name(for: \\ModernKeyPathObject.set[0].objectCol), \"set.objectCol\")\n        XCTAssertEqual(_name(for: \\ModernKeyPathObject.set[0].objectCol?.linkingObjects), \"set.objectCol.linkingObjects\")\n        XCTAssertEqual(_name(for: \\ModernKeyPathObject.set[0].objectCol?.linkingObjects[0].boolCol), \"set.objectCol.linkingObjects.boolCol\")\n\n        XCTAssertEqual(_name(for: \\ModernKeyPathObject.map), \"map\")\n        XCTAssertEqual(_name(for: \\ModernKeyPathObject.map[\"\"]??.boolCol), \"map.boolCol\")\n        XCTAssertEqual(_name(for: \\ModernKeyPathObject.map[\"\"]??.objectCol), \"map.objectCol\")\n        XCTAssertEqual(_name(for: \\ModernKeyPathObject.map[\"\"]??.objectCol?.linkingObjects), \"map.objectCol.linkingObjects\")\n        XCTAssertEqual(_name(for: \\ModernKeyPathObject.map[\"\"]??.objectCol?.linkingObjects[0].boolCol), \"map.objectCol.linkingObjects.boolCol\")\n    }\n\n    func testModernObjectNested() {\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.pk), \"objectCol.pk\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.boolCol), \"objectCol.boolCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.intCol), \"objectCol.intCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.int8Col), \"objectCol.int8Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.int16Col), \"objectCol.int16Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.int32Col), \"objectCol.int32Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.int64Col), \"objectCol.int64Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.floatCol), \"objectCol.floatCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.doubleCol), \"objectCol.doubleCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.stringCol), \"objectCol.stringCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.binaryCol), \"objectCol.binaryCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.dateCol), \"objectCol.dateCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.decimalCol), \"objectCol.decimalCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.objectIdCol), \"objectCol.objectIdCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.objectCol), \"objectCol.objectCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayCol), \"objectCol.arrayCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setCol), \"objectCol.setCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.anyCol), \"objectCol.anyCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.uuidCol), \"objectCol.uuidCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.intEnumCol), \"objectCol.intEnumCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.stringEnumCol), \"objectCol.stringEnumCol\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.optIntCol), \"objectCol.optIntCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.optInt8Col), \"objectCol.optInt8Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.optInt16Col), \"objectCol.optInt16Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.optInt32Col), \"objectCol.optInt32Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.optInt64Col), \"objectCol.optInt64Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.optFloatCol), \"objectCol.optFloatCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.optDoubleCol), \"objectCol.optDoubleCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.optStringCol), \"objectCol.optStringCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.optBinaryCol), \"objectCol.optBinaryCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.optDateCol), \"objectCol.optDateCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.optDecimalCol), \"objectCol.optDecimalCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.optObjectIdCol), \"objectCol.optObjectIdCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.optUuidCol), \"objectCol.optUuidCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.optIntEnumCol), \"objectCol.optIntEnumCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.optStringEnumCol), \"objectCol.optStringEnumCol\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayBool), \"objectCol.arrayBool\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayInt), \"objectCol.arrayInt\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayInt8), \"objectCol.arrayInt8\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayInt16), \"objectCol.arrayInt16\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayInt32), \"objectCol.arrayInt32\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayInt64), \"objectCol.arrayInt64\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayFloat), \"objectCol.arrayFloat\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayDouble), \"objectCol.arrayDouble\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayString), \"objectCol.arrayString\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayBinary), \"objectCol.arrayBinary\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayDate), \"objectCol.arrayDate\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayDecimal), \"objectCol.arrayDecimal\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayObjectId), \"objectCol.arrayObjectId\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayAny), \"objectCol.arrayAny\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayUuid), \"objectCol.arrayUuid\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayOptBool), \"objectCol.arrayOptBool\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayOptInt), \"objectCol.arrayOptInt\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayOptInt8), \"objectCol.arrayOptInt8\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayOptInt16), \"objectCol.arrayOptInt16\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayOptInt32), \"objectCol.arrayOptInt32\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayOptInt64), \"objectCol.arrayOptInt64\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayOptFloat), \"objectCol.arrayOptFloat\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayOptDouble), \"objectCol.arrayOptDouble\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayOptString), \"objectCol.arrayOptString\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayOptBinary), \"objectCol.arrayOptBinary\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayOptDate), \"objectCol.arrayOptDate\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayOptDecimal), \"objectCol.arrayOptDecimal\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayOptObjectId), \"objectCol.arrayOptObjectId\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.arrayOptUuid), \"objectCol.arrayOptUuid\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setBool), \"objectCol.setBool\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setInt), \"objectCol.setInt\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setInt8), \"objectCol.setInt8\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setInt16), \"objectCol.setInt16\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setInt32), \"objectCol.setInt32\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setInt64), \"objectCol.setInt64\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setFloat), \"objectCol.setFloat\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setDouble), \"objectCol.setDouble\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setString), \"objectCol.setString\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setBinary), \"objectCol.setBinary\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setDate), \"objectCol.setDate\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setDecimal), \"objectCol.setDecimal\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setObjectId), \"objectCol.setObjectId\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setAny), \"objectCol.setAny\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setUuid), \"objectCol.setUuid\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setOptBool), \"objectCol.setOptBool\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setOptInt), \"objectCol.setOptInt\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setOptInt8), \"objectCol.setOptInt8\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setOptInt16), \"objectCol.setOptInt16\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setOptInt32), \"objectCol.setOptInt32\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setOptInt64), \"objectCol.setOptInt64\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setOptFloat), \"objectCol.setOptFloat\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setOptDouble), \"objectCol.setOptDouble\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setOptString), \"objectCol.setOptString\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setOptBinary), \"objectCol.setOptBinary\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setOptDate), \"objectCol.setOptDate\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setOptDecimal), \"objectCol.setOptDecimal\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setOptObjectId), \"objectCol.setOptObjectId\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.setOptUuid), \"objectCol.setOptUuid\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapBool), \"objectCol.mapBool\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapInt), \"objectCol.mapInt\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapInt8), \"objectCol.mapInt8\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapInt16), \"objectCol.mapInt16\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapInt32), \"objectCol.mapInt32\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapInt64), \"objectCol.mapInt64\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapFloat), \"objectCol.mapFloat\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapDouble), \"objectCol.mapDouble\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapString), \"objectCol.mapString\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapBinary), \"objectCol.mapBinary\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapDate), \"objectCol.mapDate\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapDecimal), \"objectCol.mapDecimal\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapObjectId), \"objectCol.mapObjectId\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapAny), \"objectCol.mapAny\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapUuid), \"objectCol.mapUuid\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapOptBool), \"objectCol.mapOptBool\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapOptInt), \"objectCol.mapOptInt\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapOptInt8), \"objectCol.mapOptInt8\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapOptInt16), \"objectCol.mapOptInt16\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapOptInt32), \"objectCol.mapOptInt32\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapOptInt64), \"objectCol.mapOptInt64\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapOptFloat), \"objectCol.mapOptFloat\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapOptDouble), \"objectCol.mapOptDouble\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapOptString), \"objectCol.mapOptString\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapOptBinary), \"objectCol.mapOptBinary\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapOptDate), \"objectCol.mapOptDate\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapOptDecimal), \"objectCol.mapOptDecimal\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapOptObjectId), \"objectCol.mapOptObjectId\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.mapOptUuid), \"objectCol.mapOptUuid\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.linkingObjects), \"objectCol.linkingObjects\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.linkingObjects[0].boolCol), \"objectCol.linkingObjects.boolCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesObject.objectCol?.linkingObjects[0].objectCol?.linkingObjects[0].boolCol),\n                       \"objectCol.linkingObjects.objectCol.linkingObjects.boolCol\")\n    }\n\n    func testOldObjectSyntax() {\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.boolCol), \"boolCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.intCol), \"intCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.int8Col), \"int8Col\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.int16Col), \"int16Col\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.int32Col), \"int32Col\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.int64Col), \"int64Col\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.intEnumCol), \"intEnumCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.floatCol), \"floatCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.doubleCol), \"doubleCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.stringCol), \"stringCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.binaryCol), \"binaryCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.dateCol), \"dateCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.decimalCol), \"decimalCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.objectIdCol), \"objectIdCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.objectCol), \"objectCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.objectCol?.boolCol), \"objectCol.boolCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.uuidCol), \"uuidCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.embeddedCol), \"embeddedCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.embeddedCol?.boolCol), \"embeddedCol.boolCol\")\n\n        // Nested objects will work fine once they can utilize _kvcKeyPathString.\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.embeddedCol?.embeddedCol?.child), \"embeddedCol.embeddedCol.child\")\n\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.anyCol), \"anyCol\")\n\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.arrayCol), \"arrayCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.setCol), \"setCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.mapCol), \"mapCol\")\n\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.arrayObjCol), \"arrayObjCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.setObjCol), \"setObjCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.mapObjCol), \"mapObjCol\")\n\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.arrayEmbeddedCol), \"arrayEmbeddedCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesObject.mapEmbeddedCol), \"mapEmbeddedCol\")\n\n        XCTAssertEqual(_name(for: \\SwiftDogObject.owners), \"owners\")\n\n        // Allowing old property syntax objects to do nested key path strings involves an invasive change to `unmanagedGetter` in RLMAccessor.\n        // We would need to prevent the getter function from returning `nil` and instead return a block that appends the property name to the\n        // tracing array in the object. This would break a ton of other stuff and instead it is recommended that a user use @Persisted\n    }\n\n    func testOldSyntaxEmbeddedObject() {\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.boolCol), \"boolCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.intCol), \"intCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.int8Col), \"int8Col\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.int16Col), \"int16Col\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.int32Col), \"int32Col\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.int64Col), \"int64Col\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.intEnumCol), \"intEnumCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.floatCol), \"floatCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.doubleCol), \"doubleCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.stringCol), \"stringCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.binaryCol), \"binaryCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.dateCol), \"dateCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.decimalCol), \"decimalCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.objectIdCol), \"objectIdCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.uuidCol), \"uuidCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.anyCol), \"anyCol\")\n\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.arrayCol), \"arrayCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.setCol), \"setCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.mapCol), \"mapCol\")\n\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.arrayEmbeddedCol), \"arrayEmbeddedCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.mapEmbeddedCol), \"mapEmbeddedCol\")\n\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.embeddedCol), \"embeddedCol\")\n        XCTAssertEqual(_name(for: \\SwiftOldSyntaxAllTypesEmbeddedObject.embeddedCol?.child), \"embeddedCol.child\")\n    }\n\n    func testEmbeddedObject() {\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.boolCol), \"boolCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.intCol), \"intCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.int8Col), \"int8Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.int16Col), \"int16Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.int32Col), \"int32Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.int64Col), \"int64Col\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.intEnumCol), \"intEnumCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.floatCol), \"floatCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.doubleCol), \"doubleCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.stringCol), \"stringCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.binaryCol), \"binaryCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.dateCol), \"dateCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.decimalCol), \"decimalCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.objectIdCol), \"objectIdCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.uuidCol), \"uuidCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.anyCol), \"anyCol\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.arrayCol), \"arrayCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.setCol), \"setCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.mapCol), \"mapCol\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.arrayEmbeddedCol), \"arrayEmbeddedCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.mapEmbeddedCol), \"mapEmbeddedCol\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.embeddedCol), \"embeddedCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.embeddedCol?.child), \"embeddedCol.child\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.embeddedCol?.child?.value), \"embeddedCol.child.value\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.arrayEmbeddedCol[0].value), \"arrayEmbeddedCol.value\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.arrayEmbeddedCol[0].child?.value), \"arrayEmbeddedCol.child.value\")\n\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.mapEmbeddedCol), \"mapEmbeddedCol\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.mapEmbeddedCol[\"\"]??.value), \"mapEmbeddedCol.value\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.mapEmbeddedCol[\"\"]??.child), \"mapEmbeddedCol.child\")\n        XCTAssertEqual(_name(for: \\ModernAllTypesEmbeddedObject.mapEmbeddedCol[\"\"]??.child?.value), \"mapEmbeddedCol.child.value\")\n    }\n\n    func testCustomTypes() {\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.bool), \"bool\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.int), \"int\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.int8), \"int8\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.int16), \"int16\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.int32), \"int32\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.int64), \"int64\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.float), \"float\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.double), \"double\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.string), \"string\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.binary), \"binary\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.date), \"date\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.decimal), \"decimal\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.objectId), \"objectId\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.uuid), \"uuid\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.object), \"object\")\n\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.optBool), \"optBool\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.optInt), \"optInt\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.optInt8), \"optInt8\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.optInt16), \"optInt16\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.optInt32), \"optInt32\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.optInt64), \"optInt64\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.optFloat), \"optFloat\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.optDouble), \"optDouble\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.optString), \"optString\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.optBinary), \"optBinary\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.optDate), \"optDate\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.optDecimal), \"optDecimal\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.optObjectId), \"optObjectId\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.optUuid), \"optUuid\")\n        XCTAssertEqual(_name(for: \\AllCustomPersistableTypes.optObject), \"optObject\")\n\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listBool), \"listBool\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listInt), \"listInt\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listInt8), \"listInt8\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listInt16), \"listInt16\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listInt32), \"listInt32\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listInt64), \"listInt64\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listFloat), \"listFloat\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listDouble), \"listDouble\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listString), \"listString\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listBinary), \"listBinary\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listDate), \"listDate\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listDecimal), \"listDecimal\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listUuid), \"listUuid\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listObjectId), \"listObjectId\")\n\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listOptBool), \"listOptBool\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listOptInt), \"listOptInt\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listOptInt8), \"listOptInt8\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listOptInt16), \"listOptInt16\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listOptInt32), \"listOptInt32\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listOptInt64), \"listOptInt64\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listOptFloat), \"listOptFloat\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listOptDouble), \"listOptDouble\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listOptString), \"listOptString\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listOptBinary), \"listOptBinary\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listOptDate), \"listOptDate\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listOptDecimal), \"listOptDecimal\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listOptUuid), \"listOptUuid\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.listOptObjectId), \"listOptObjectId\")\n\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setBool), \"setBool\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setInt), \"setInt\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setInt8), \"setInt8\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setInt16), \"setInt16\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setInt32), \"setInt32\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setInt64), \"setInt64\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setFloat), \"setFloat\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setDouble), \"setDouble\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setString), \"setString\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setBinary), \"setBinary\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setDate), \"setDate\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setDecimal), \"setDecimal\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setUuid), \"setUuid\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setObjectId), \"setObjectId\")\n\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setOptBool), \"setOptBool\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setOptInt), \"setOptInt\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setOptInt8), \"setOptInt8\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setOptInt16), \"setOptInt16\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setOptInt32), \"setOptInt32\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setOptInt64), \"setOptInt64\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setOptFloat), \"setOptFloat\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setOptDouble), \"setOptDouble\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setOptString), \"setOptString\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setOptBinary), \"setOptBinary\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setOptDate), \"setOptDate\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setOptDecimal), \"setOptDecimal\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setOptUuid), \"setOptUuid\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.setOptObjectId), \"setOptObjectId\")\n\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapBool), \"mapBool\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapInt), \"mapInt\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapInt8), \"mapInt8\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapInt16), \"mapInt16\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapInt32), \"mapInt32\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapInt64), \"mapInt64\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapFloat), \"mapFloat\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapDouble), \"mapDouble\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapString), \"mapString\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapBinary), \"mapBinary\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapDate), \"mapDate\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapDecimal), \"mapDecimal\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapUuid), \"mapUuid\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapObjectId), \"mapObjectId\")\n\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapOptBool), \"mapOptBool\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapOptInt), \"mapOptInt\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapOptInt8), \"mapOptInt8\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapOptInt16), \"mapOptInt16\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapOptInt32), \"mapOptInt32\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapOptInt64), \"mapOptInt64\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapOptFloat), \"mapOptFloat\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapOptDouble), \"mapOptDouble\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapOptString), \"mapOptString\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapOptBinary), \"mapOptBinary\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapOptDate), \"mapOptDate\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapOptDecimal), \"mapOptDecimal\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapOptUuid), \"mapOptUuid\")\n        XCTAssertEqual(_name(for: \\CustomPersistableCollections.mapOptObjectId), \"mapOptObjectId\")\n    }\n}\n\nclass SwiftOldSyntaxAllTypesObject: Object {\n    @objc dynamic var boolCol = false\n    @objc dynamic var intCol = 123\n    @objc dynamic var int8Col: Int8 = 123\n    @objc dynamic var int16Col: Int16 = 123\n    @objc dynamic var int32Col: Int32 = 123\n    @objc dynamic var int64Col: Int64 = 123\n    @objc dynamic var intEnumCol = IntEnum.value1\n    @objc dynamic var floatCol = 1.23 as Float\n    @objc dynamic var doubleCol = 12.3\n    @objc dynamic var stringCol = \"a\"\n    @objc dynamic var binaryCol = Data(\"a\".utf8)\n    @objc dynamic var dateCol = Date(timeIntervalSince1970: 1)\n    @objc dynamic var decimalCol = Decimal128(\"123e4\")\n    @objc dynamic var objectIdCol = ObjectId(\"1234567890ab1234567890ab\")\n    @objc dynamic var objectCol: SwiftBoolObject? = SwiftBoolObject()\n    @objc dynamic var uuidCol: UUID = UUID(uuidString: \"137decc8-b300-4954-a233-f89909f4fd89\")!\n    @objc dynamic var embeddedCol: SwiftOldSyntaxAllTypesEmbeddedObject? = SwiftOldSyntaxAllTypesEmbeddedObject()\n\n    let anyCol = RealmProperty<AnyRealmValue>()\n\n    let arrayCol = List<Int>()\n    let setCol = MutableSet<Int>()\n    let mapCol = Map<String, Int>()\n\n    let arrayObjCol = List<SwiftObject>()\n    let setObjCol = MutableSet<SwiftObject>()\n    let mapObjCol = Map<String, SwiftObject?>()\n\n    let arrayEmbeddedCol = List<EmbeddedTreeObject1>()\n    let mapEmbeddedCol = Map<String, EmbeddedTreeObject1?>()\n}\n\nclass SwiftOldSyntaxAllTypesEmbeddedObject: EmbeddedObject {\n    @objc dynamic var boolCol = false\n    @objc dynamic var intCol = 123\n    @objc dynamic var int8Col: Int8 = 123\n    @objc dynamic var int16Col: Int16 = 123\n    @objc dynamic var int32Col: Int32 = 123\n    @objc dynamic var int64Col: Int64 = 123\n    @objc dynamic var intEnumCol = IntEnum.value1\n    @objc dynamic var floatCol = 1.23 as Float\n    @objc dynamic var doubleCol = 12.3\n    @objc dynamic var stringCol = \"a\"\n    @objc dynamic var binaryCol = Data(\"a\".utf8)\n    @objc dynamic var dateCol = Date(timeIntervalSince1970: 1)\n    @objc dynamic var decimalCol = Decimal128(\"123e4\")\n    @objc dynamic var objectIdCol = ObjectId(\"1234567890ab1234567890ab\")\n    @objc dynamic var uuidCol: UUID = UUID(uuidString: \"137decc8-b300-4954-a233-f89909f4fd89\")!\n\n    let anyCol = RealmProperty<AnyRealmValue>()\n    @objc dynamic var embeddedCol: EmbeddedTreeObject1?\n\n    let arrayCol = List<Int>()\n    let setCol = MutableSet<Int>()\n    let mapCol = Map<String, Int>()\n\n    let arrayEmbeddedCol = List<EmbeddedTreeObject3>()\n    let mapEmbeddedCol = Map<String, EmbeddedTreeObject1?>()\n}\n\nclass ModernKeyPathObject: Object {\n    @Persisted var embeddedCol: ModernAllTypesEmbeddedObject?\n    @Persisted var list: List<ModernAllTypesObject>\n    @Persisted var listEmbedded: List<ModernAllTypesObject>\n    @Persisted var set: MutableSet<ModernAllTypesObject>\n    @Persisted var map: Map<String, ModernAllTypesObject?>\n    @Persisted var mapEmbedded: Map<String, ModernAllTypesObject?>\n}\n\nclass ModernAllTypesEmbeddedObject: EmbeddedObject {\n    @Persisted var boolCol = false\n    @Persisted var intCol = 123\n    @Persisted var int8Col: Int8 = 123\n    @Persisted var int16Col: Int16 = 123\n    @Persisted var int32Col: Int32 = 123\n    @Persisted var int64Col: Int64 = 123\n    @Persisted var intEnumCol: ModernIntEnum\n    @Persisted var floatCol = 1.23 as Float\n    @Persisted var doubleCol = 12.3\n    @Persisted var stringCol = \"a\"\n    @Persisted var binaryCol = Data(\"a\".utf8)\n    @Persisted var dateCol = Date(timeIntervalSince1970: 1)\n    @Persisted var decimalCol = Decimal128(\"123e4\")\n    @Persisted var objectIdCol = ObjectId(\"1234567890ab1234567890ab\")\n    @Persisted var uuidCol: UUID = UUID(uuidString: \"137decc8-b300-4954-a233-f89909f4fd89\")!\n    @Persisted var anyCol: AnyRealmValue\n    @Persisted var embeddedCol: ModernEmbeddedTreeObject2?\n    @Persisted var arrayCol: List<Int>\n    @Persisted var setCol: MutableSet<Int>\n    @Persisted var mapCol: Map<String, Int>\n    @Persisted var arrayEmbeddedCol: List<ModernEmbeddedTreeObject2>\n    @Persisted var mapEmbeddedCol: Map<String, ModernEmbeddedTreeObject2?>\n}\n"
  },
  {
    "path": "RealmSwift/Tests/ListTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\n#if canImport(RealmSwiftTestSupport)\nimport RealmSwiftTestSupport\n#endif\n\nclass ListTests: TestCase {\n    var str1: SwiftStringObject?\n    var str2: SwiftStringObject?\n    var arrayObject: SwiftArrayPropertyObject!\n    var array: List<SwiftStringObject>?\n\n    func createArray() -> SwiftArrayPropertyObject {\n        fatalError(\"abstract\")\n    }\n\n    func createArrayWithLinks() -> SwiftListOfSwiftObject {\n        fatalError(\"abstract\")\n    }\n\n    func createEmbeddedArray() -> List<EmbeddedTreeObject1> {\n        fatalError(\"abstract\")\n    }\n\n    override func setUp() {\n        super.setUp()\n\n        let str1 = SwiftStringObject()\n        str1.stringCol = \"1\"\n        self.str1 = str1\n\n        let str2 = SwiftStringObject()\n        str2.stringCol = \"2\"\n        self.str2 = str2\n\n        arrayObject = createArray()\n        array = arrayObject.array\n\n        let realm = realmWithTestPath()\n        try! realm.write {\n            realm.add(str1)\n            realm.add(str2)\n        }\n\n        realm.beginWrite()\n    }\n\n    override func tearDown() {\n        try! realmWithTestPath().commitWrite()\n\n        str1 = nil\n        str2 = nil\n        arrayObject = nil\n        array = nil\n\n        super.tearDown()\n    }\n\n    override class var defaultTestSuite: XCTestSuite {\n        // Don't run tests for the base class\n        if isEqual(ListTests.self) {\n            return XCTestSuite(name: \"empty\")\n        }\n        return super.defaultTestSuite\n    }\n\n    func testPrimitive() {\n        let obj = SwiftListObject()\n        obj.int.append(5)\n        XCTAssertEqual(obj.int.first!, 5)\n        XCTAssertEqual(obj.int.last!, 5)\n        XCTAssertEqual(obj.int[0], 5)\n        obj.int.append(objectsIn: [6, 7, 8] as [Int])\n        XCTAssertEqual(obj.int.index(of: 6), 1)\n        XCTAssertEqual(2, obj.int.index(matching: NSPredicate(format: \"self == 7\")))\n        XCTAssertNil(obj.int.index(matching: NSPredicate(format: \"self == 9\")))\n        XCTAssertEqual(2, obj.int.index(matching: { $0 == 7 && $0 < 456 }))\n        XCTAssertNil(obj.int.index(matching: { $0 == 9 }))\n        XCTAssertEqual(obj.int.max(), 8)\n        XCTAssertEqual(obj.int.sum(), 26)\n\n        obj.string.append(\"str\")\n        XCTAssertEqual(obj.string.first!, \"str\")\n        XCTAssertEqual(obj.string[0], \"str\")\n    }\n\n    func testPrimitiveIterationAcrossNil() {\n        let obj = SwiftListObject()\n        XCTAssertFalse(obj.int.contains(5))\n        XCTAssertFalse(obj.int8.contains(5))\n        XCTAssertFalse(obj.int16.contains(5))\n        XCTAssertFalse(obj.int32.contains(5))\n        XCTAssertFalse(obj.int64.contains(5))\n        XCTAssertFalse(obj.float.contains(3.141592))\n        XCTAssertFalse(obj.double.contains(3.141592))\n        XCTAssertFalse(obj.string.contains(\"foobar\"))\n        XCTAssertFalse(obj.data.contains(Data()))\n        XCTAssertFalse(obj.date.contains(Date()))\n        XCTAssertFalse(obj.decimal.contains(Decimal128()))\n        XCTAssertFalse(obj.objectId.contains(ObjectId()))\n        XCTAssertFalse(obj.uuidOpt.contains(UUID()))\n\n        XCTAssertFalse(obj.intOpt.contains { $0 == nil })\n        XCTAssertFalse(obj.int8Opt.contains { $0 == nil })\n        XCTAssertFalse(obj.int16Opt.contains { $0 == nil })\n        XCTAssertFalse(obj.int32Opt.contains { $0 == nil })\n        XCTAssertFalse(obj.int64Opt.contains { $0 == nil })\n        XCTAssertFalse(obj.floatOpt.contains { $0 == nil })\n        XCTAssertFalse(obj.doubleOpt.contains { $0 == nil })\n        XCTAssertFalse(obj.stringOpt.contains { $0 == nil })\n        XCTAssertFalse(obj.dataOpt.contains { $0 == nil })\n        XCTAssertFalse(obj.dateOpt.contains { $0 == nil })\n        XCTAssertFalse(obj.decimalOpt.contains { $0 == nil })\n        XCTAssertFalse(obj.objectIdOpt.contains { $0 == nil })\n        XCTAssertFalse(obj.uuidOpt.contains { $0 == nil })\n    }\n\n    func testInvalidated() {\n        guard let array = array else {\n            fatalError(\"Test precondition failure\")\n        }\n        XCTAssertFalse(array.isInvalidated)\n\n        if let realm = arrayObject.realm {\n            realm.delete(arrayObject)\n            XCTAssertTrue(array.isInvalidated)\n        }\n    }\n\n    func testFastEnumerationWithMutation() {\n        guard let array = array, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n\n        array.append(objectsIn: [str1, str2, str1, str2, str1, str2, str1, str2, str1,\n            str2, str1, str2, str1, str2, str1, str2, str1, str2, str1, str2])\n        var str = \"\"\n        for obj in array {\n            str += obj.stringCol\n            array.append(objectsIn: [str1])\n        }\n\n        XCTAssertEqual(str, \"12121212121212121212\")\n    }\n\n    func testAppendObject() {\n        guard let array = array, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n        for str in [str1, str2, str1] {\n            array.append(str)\n        }\n        XCTAssertEqual(Int(3), array.count)\n        assertEqual(str1, array[0])\n        assertEqual(str2, array[1])\n        assertEqual(str1, array[2])\n    }\n\n    func testAppendArray() {\n        guard let array = array, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n        array.append(objectsIn: [str1, str2, str1])\n        XCTAssertEqual(Int(3), array.count)\n        assertEqual(str1, array[0])\n        assertEqual(str2, array[1])\n        assertEqual(str1, array[2])\n    }\n\n    func testAppendResults() {\n        guard let array = array, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n        array.append(objectsIn: realmWithTestPath().objects(SwiftStringObject.self))\n        XCTAssertEqual(Int(2), array.count)\n        assertEqual(str1, array[0])\n        assertEqual(str2, array[1])\n    }\n\n    func testInsert() {\n        guard let array = array, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n\n        XCTAssertEqual(Int(0), array.count)\n\n        array.insert(str1, at: 0)\n        XCTAssertEqual(Int(1), array.count)\n        assertEqual(str1, array[0])\n\n        array.insert(str2, at: 0)\n        XCTAssertEqual(Int(2), array.count)\n        assertEqual(str2, array[0])\n        assertEqual(str1, array[1])\n\n        assertThrows(array.insert(str2, at: 200))\n        assertThrows(array.insert(str2, at: -200))\n    }\n\n    func testRemoveAtIndex() {\n        guard let array = array, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n\n        array.append(objectsIn: [str1, str2, str1])\n\n        array.remove(at: 1)\n        assertEqual(str1, array[0])\n        assertEqual(str1, array[1])\n\n        assertThrows(array.remove(at: 2))\n        assertThrows(array.remove(at: -2))\n    }\n\n    func testRemoveAtOffsets() {\n        guard let array = array, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n\n        array.append(objectsIn: [str1, str2, str1])\n        array.remove(atOffsets: [0, 2])\n\n        XCTAssertEqual(array.count, 1)\n        assertEqual(str2, array[0])\n\n        array.remove(atOffsets: [])\n        XCTAssertEqual(array.count, 1)\n\n        assertThrows(array.remove(atOffsets: [1]))\n    }\n\n    func testRemoveLast() {\n        guard let array = array, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n\n        array.append(objectsIn: [str1, str2])\n\n        array.removeLast()\n        XCTAssertEqual(Int(1), array.count)\n        assertEqual(str1, array[0])\n\n        array.removeLast()\n        XCTAssertEqual(Int(0), array.count)\n\n        assertThrows(array.removeLast())    // Should throw if already empty\n    }\n\n    func testRemoveAll() {\n        guard let array = array, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n\n        array.append(objectsIn: [str1, str2])\n\n        array.removeAll()\n        XCTAssertEqual(Int(0), array.count)\n\n        array.removeAll() // should be a no-op\n        XCTAssertEqual(Int(0), array.count)\n    }\n\n    func testReplace() {\n        guard let array = array, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n\n        array.append(objectsIn: [str1, str1])\n\n        array.replace(index: 0, object: str2)\n        XCTAssertEqual(Int(2), array.count)\n        assertEqual(str2, array[0])\n        assertEqual(str1, array[1])\n\n        array.replace(index: 1, object: str2)\n        XCTAssertEqual(Int(2), array.count)\n        assertEqual(str2, array[0])\n        assertEqual(str2, array[1])\n\n        assertThrows(array.replace(index: 200, object: str2))\n        assertThrows(array.replace(index: -200, object: str2))\n    }\n\n    func testMove() {\n        guard let array = array, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n\n        array.append(objectsIn: [str1, str2])\n\n        array.move(from: 1, to: 0)\n\n        XCTAssertEqual(array[0].stringCol, \"2\")\n        XCTAssertEqual(array[1].stringCol, \"1\")\n\n        array.move(from: 0, to: 1)\n\n        XCTAssertEqual(array[0].stringCol, \"1\")\n        XCTAssertEqual(array[1].stringCol, \"2\")\n\n        array.move(from: 0, to: 0)\n\n        XCTAssertEqual(array[0].stringCol, \"1\")\n        XCTAssertEqual(array[1].stringCol, \"2\")\n\n        assertThrows(array.move(from: 0, to: 2))\n        assertThrows(array.move(from: 2, to: 0))\n    }\n\n    func testMoveFromOffsets() {\n        guard let array = array, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n        let str3 = SwiftStringObject(value: [\"3\"])\n\n        array.append(objectsIn: [str1, str2, str3])\n\n        array.move(fromOffsets: IndexSet([1]), toOffset: 0)\n        // [2, 1, 3]\n        XCTAssertEqual(array[0].stringCol, \"2\")\n        XCTAssertEqual(array[1].stringCol, \"1\")\n        XCTAssertEqual(array[2].stringCol, \"3\")\n\n        array.move(fromOffsets: IndexSet([0]), toOffset: 3)\n        // [1, 3, 2]\n        XCTAssertEqual(array[0].stringCol, \"1\")\n        XCTAssertEqual(array[1].stringCol, \"3\")\n        XCTAssertEqual(array[2].stringCol, \"2\")\n\n        array.move(fromOffsets: IndexSet([0]), toOffset: 1)\n        // [1, 3, 2]\n        XCTAssertEqual(array[0].stringCol, \"1\")\n        XCTAssertEqual(array[1].stringCol, \"3\")\n        XCTAssertEqual(array[2].stringCol, \"2\")\n\n        array.move(fromOffsets: IndexSet([2]), toOffset: 1)\n        // [1, 2, 3]\n        XCTAssertEqual(array[0].stringCol, \"1\")\n        XCTAssertEqual(array[1].stringCol, \"2\")\n        XCTAssertEqual(array[2].stringCol, \"3\")\n\n        assertThrows(array.move(fromOffsets: IndexSet([0]), toOffset: 4))\n        assertThrows(array.move(fromOffsets: IndexSet([4]), toOffset: 0))\n\n        array.move(fromOffsets: IndexSet([]), toOffset: 1)\n        // [1, 2, 3]\n        XCTAssertEqual(array[0].stringCol, \"1\")\n        XCTAssertEqual(array[1].stringCol, \"2\")\n        XCTAssertEqual(array[2].stringCol, \"3\")\n\n        array.move(fromOffsets: IndexSet([0, 2]), toOffset: 1)\n        // [1, 3, 2]\n        XCTAssertEqual(array[0].stringCol, \"1\")\n        XCTAssertEqual(array[1].stringCol, \"3\")\n        XCTAssertEqual(array[2].stringCol, \"2\")\n    }\n\n    func testReplaceRange() {\n        guard let array = array, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n\n        array.append(objectsIn: [str1, str1])\n\n        array.replaceSubrange(0..<1, with: [str2])\n        XCTAssertEqual(Int(2), array.count)\n        assertEqual(str2, array[0])\n        assertEqual(str1, array[1])\n\n        array.replaceSubrange(1..<2, with: [str2])\n        XCTAssertEqual(Int(2), array.count)\n        assertEqual(str2, array[0])\n        assertEqual(str2, array[1])\n\n        array.replaceSubrange(0..<0, with: [str2])\n        XCTAssertEqual(Int(3), array.count)\n        assertEqual(str2, array[0])\n        assertEqual(str2, array[1])\n        assertEqual(str2, array[2])\n\n        array.replaceSubrange(0..<3, with: [])\n        XCTAssertEqual(Int(0), array.count)\n\n        assertThrows(array.replaceSubrange(200..<201, with: [str2]))\n        assertThrows(array.replaceSubrange(-200..<200, with: [str2]))\n        assertThrows(array.replaceSubrange(0..<200, with: [str2]))\n    }\n\n    func testSwapAt() {\n        guard let array = array, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n\n        array.append(objectsIn: [str1, str2])\n\n        array.swapAt(0, 1)\n        XCTAssertEqual(Int(2), array.count)\n        assertEqual(str2, array[0])\n        assertEqual(str1, array[1])\n\n        array.swapAt(1, 1)\n        XCTAssertEqual(Int(2), array.count)\n        assertEqual(str2, array[0])\n        assertEqual(str1, array[1])\n\n        assertThrows(array.swapAt(-1, 0))\n        assertThrows(array.swapAt(0, -1))\n        assertThrows(array.swapAt(1000, 0))\n        assertThrows(array.swapAt(0, 1000))\n    }\n\n    func testChangesArePersisted() {\n        guard let array = array, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n        if let realm = array.realm {\n            array.append(objectsIn: [str1, str2])\n\n            let otherArray = realm.objects(SwiftArrayPropertyObject.self).first!.array\n            XCTAssertEqual(Int(2), otherArray.count)\n        }\n    }\n\n    func testPopulateEmptyArray() {\n        guard let array = array else {\n            fatalError(\"Test precondition failure\")\n        }\n\n        XCTAssertEqual(array.count, 0, \"Should start with no array elements.\")\n\n        let obj = SwiftStringObject()\n        obj.stringCol = \"a\"\n        array.append(obj)\n        array.append(realmWithTestPath().create(SwiftStringObject.self, value: [\"b\"]))\n        array.append(obj)\n\n        XCTAssertEqual(array.count, 3)\n        XCTAssertEqual(array[0].stringCol, \"a\")\n        XCTAssertEqual(array[1].stringCol, \"b\")\n        XCTAssertEqual(array[2].stringCol, \"a\")\n\n        // Make sure we can enumerate\n        for obj in array {\n            XCTAssertTrue(obj.description.utf16.count > 0, \"Object should have description\")\n        }\n    }\n\n    func testEnumeratingListWithListProperties() {\n        let arrayObject = createArrayWithLinks()\n\n        arrayObject.realm?.beginWrite()\n        for _ in 0..<10 {\n            arrayObject.array.append(SwiftObject())\n        }\n        try! arrayObject.realm?.commitWrite()\n\n        XCTAssertEqual(10, arrayObject.array.count)\n\n        for object in arrayObject.array {\n            XCTAssertEqual(123, object.intCol)\n            XCTAssertEqual(false, object.objectCol!.boolCol)\n            XCTAssertEqual(0, object.arrayCol.count)\n        }\n    }\n\n    func testValueForKey() {\n        let realm = try! Realm()\n        try! realm.write {\n            for value in [1, 2] {\n                let listObject = SwiftListOfSwiftObject()\n                let object = SwiftObject()\n                object.intCol = value\n                object.doubleCol = Double(value)\n                object.stringCol = String(value)\n                object.decimalCol = Decimal128(number: value as NSNumber)\n                object.objectIdCol = try! ObjectId(string: String(repeating: String(value), count: 24))\n                listObject.array.append(object)\n                realm.add(listObject)\n            }\n        }\n\n        let listObjects = realm.objects(SwiftListOfSwiftObject.self)\n        let listsOfObjects = listObjects.value(forKeyPath: \"array\") as! [List<SwiftObject>]\n        let objects = realm.objects(SwiftObject.self)\n\n        func testProperty<T: Equatable>(line: UInt = #line, fn: @escaping (SwiftObject) -> T) {\n            let properties: [T] = Array(listObjects.flatMap { $0.array.map(fn) })\n            let kvcProperties: [T] = Array(listsOfObjects.flatMap { $0.map(fn) })\n            XCTAssertEqual(properties, kvcProperties, line: line)\n        }\n        func testProperty<T: Equatable>(_ name: String, line: UInt = #line, fn: @escaping (SwiftObject) -> T) {\n            let properties = Array(objects.compactMap(fn))\n            let listsOfObjects = objects.value(forKeyPath: name) as! [T]\n            let kvcProperties = Array(listsOfObjects.compactMap { $0 })\n\n            XCTAssertEqual(properties, kvcProperties, line: line)\n        }\n\n        testProperty { $0.intCol }\n        testProperty { $0.doubleCol }\n        testProperty { $0.stringCol }\n        testProperty { $0.decimalCol }\n        testProperty { $0.objectIdCol }\n\n        testProperty(\"intCol\") { $0.intCol }\n        testProperty(\"doubleCol\") { $0.doubleCol }\n        testProperty(\"stringCol\") { $0.stringCol }\n        testProperty(\"decimalCol\") { $0.decimalCol }\n        testProperty(\"objectIdCol\") { $0.objectIdCol }\n    }\n\n    @available(*, deprecated) // Silence deprecation warnings for RealmOptional\n    func testValueForKeyOptional() {\n        let realm = try! Realm()\n        try! realm.write {\n            for value in [1, 2] {\n                let listObject = SwiftListOfSwiftOptionalObject()\n                let object = SwiftOptionalObject()\n                object.optIntCol.value = value\n                object.optInt8Col.value = Int8(value)\n                object.optDoubleCol.value = Double(value)\n                object.optStringCol = String(value)\n                object.optNSStringCol = NSString(format: \"%d\", value)\n                object.optDecimalCol = Decimal128(number: value as NSNumber)\n                object.optObjectIdCol = try! ObjectId(string: String(repeating: String(value), count: 24))\n                listObject.array.append(object)\n                realm.add(listObject)\n            }\n        }\n\n        let listObjects = realm.objects(SwiftListOfSwiftOptionalObject.self)\n        let listsOfObjects = listObjects.value(forKeyPath: \"array\") as! [List<SwiftOptionalObject>]\n        let objects = realm.objects(SwiftOptionalObject.self)\n\n        func testProperty<T: Equatable>(line: UInt = #line, fn: @escaping (SwiftOptionalObject) -> T) {\n            let properties: [T] = Array(listObjects.flatMap { $0.array.map(fn) })\n            let kvcProperties: [T] = Array(listsOfObjects.flatMap { $0.map(fn) })\n            XCTAssertEqual(properties, kvcProperties, line: line)\n        }\n        func testProperty<T: Equatable>(_ name: String, line: UInt = #line, fn: @escaping (SwiftOptionalObject) -> T) {\n            let properties = Array(objects.compactMap(fn))\n            let listsOfObjects = objects.value(forKeyPath: name) as! [T]\n            let kvcProperties = Array(listsOfObjects.compactMap { $0 })\n\n            XCTAssertEqual(properties, kvcProperties, line: line)\n        }\n\n        testProperty { $0.optIntCol.value }\n        testProperty { $0.optInt8Col.value }\n        testProperty { $0.optDoubleCol.value }\n        testProperty { $0.optStringCol }\n        testProperty { $0.optNSStringCol }\n        testProperty { $0.optDecimalCol }\n        testProperty { $0.optObjectCol }\n\n        testProperty(\"optIntCol\") { $0.optIntCol.value }\n        testProperty(\"optInt8Col\") { $0.optInt8Col.value }\n        testProperty(\"optDoubleCol\") { $0.optDoubleCol.value }\n        testProperty(\"optStringCol\") { $0.optStringCol }\n        testProperty(\"optNSStringCol\") { $0.optNSStringCol }\n        testProperty(\"optDecimalCol\") { $0.optDecimalCol }\n        testProperty(\"optObjectCol\") { $0.optObjectCol }\n    }\n\n    func testAppendEmbedded() {\n        let list = createEmbeddedArray()\n\n        list.realm?.beginWrite()\n        for i in 0..<10 {\n            list.append(EmbeddedTreeObject1(value: [i]))\n        }\n        XCTAssertEqual(10, list.count)\n\n        for (i, object) in list.enumerated() {\n            XCTAssertEqual(i, object.value)\n            XCTAssertEqual(list.realm, object.realm)\n        }\n\n        if list.realm != nil {\n            assertThrows(list.append(list[0]),\n                         reason: \"Cannot add an existing managed embedded object to a List.\")\n        }\n\n        list.realm?.cancelWrite()\n    }\n\n    func testSetEmbedded() {\n        let list = createEmbeddedArray()\n\n        list.realm?.beginWrite()\n        list.append(EmbeddedTreeObject1(value: [0]))\n\n        let oldObj = list[0]\n        let obj = EmbeddedTreeObject1(value: [1])\n        list[0] = obj\n        XCTAssertTrue(list[0].isSameObject(as: obj))\n        XCTAssertEqual(obj.value, 1)\n        XCTAssertEqual(obj.realm, list.realm)\n\n        if list.realm != nil {\n            XCTAssertTrue(oldObj.isInvalidated)\n            assertThrows(list[0] = obj,\n                         reason: \"Cannot add an existing managed embedded object to a List.\")\n        }\n\n        list.realm?.cancelWrite()\n    }\n\n    func testUnmanagedListComparison() {\n        let obj = SwiftIntObject()\n        obj.intCol = 5\n        let obj2 = SwiftIntObject()\n        obj2.intCol = 6\n        let obj3 = SwiftIntObject()\n        obj3.intCol = 8\n\n        let objects = [obj, obj2, obj3]\n        let objects2 = [obj, obj2]\n\n        let list1 = List<SwiftIntObject>()\n        let list2 = List<SwiftIntObject>()\n        XCTAssertEqual(list1, list2, \"Empty instances should be equal by `==` operator\")\n\n        list1.append(objectsIn: objects)\n        list2.append(objectsIn: objects)\n\n        let list3 = List<SwiftIntObject>()\n        list3.append(objectsIn: objects2)\n\n        XCTAssertTrue(list1 !== list2, \"instances should not be identical\")\n\n        XCTAssertEqual(list1, list2, \"instances should be equal by `==` operator\")\n        XCTAssertNotEqual(list1, list3, \"instances should be equal by `==` operator\")\n\n        XCTAssertTrue(list1.isEqual(list2), \"instances should be equal by `isEqual` method\")\n        XCTAssertTrue(!list1.isEqual(list3), \"instances should be equal by `isEqual` method\")\n\n        XCTAssertEqual(Array(list1), Array(list2), \"instances converted to Swift.Array should be equal\")\n        XCTAssertNotEqual(Array(list1), Array(list3), \"instances converted to Swift.Array should be equal\")\n        list3.append(obj3)\n        XCTAssertEqual(list1, list3, \"instances should be equal by `==` operator\")\n    }\n}\n\nclass ListStandaloneTests: ListTests {\n    override func createArray() -> SwiftArrayPropertyObject {\n        let array = SwiftArrayPropertyObject()\n        XCTAssertNil(array.realm)\n        return array\n    }\n\n    override func createArrayWithLinks() -> SwiftListOfSwiftObject {\n        let array = SwiftListOfSwiftObject()\n        XCTAssertNil(array.realm)\n        return array\n    }\n\n    override func createEmbeddedArray() -> List<EmbeddedTreeObject1> {\n        return List<EmbeddedTreeObject1>()\n    }\n}\n\nclass ListNewlyAddedTests: ListTests {\n    override func createArray() -> SwiftArrayPropertyObject {\n        let array = SwiftArrayPropertyObject()\n        array.name = \"name\"\n        let realm = realmWithTestPath()\n        try! realm.write { realm.add(array) }\n\n        XCTAssertNotNil(array.realm)\n        return array\n    }\n\n    override func createArrayWithLinks() -> SwiftListOfSwiftObject {\n        let array = SwiftListOfSwiftObject()\n        let realm = try! Realm()\n        try! realm.write { realm.add(array) }\n\n        XCTAssertNotNil(array.realm)\n        return array\n    }\n\n    override func createEmbeddedArray() -> List<EmbeddedTreeObject1> {\n        let parent = EmbeddedParentObject()\n        let list = parent.array\n        let realm = try! Realm()\n        try! realm.write { realm.add(parent) }\n        return list\n    }\n}\n\nclass ListNewlyCreatedTests: ListTests {\n    override func createArray() -> SwiftArrayPropertyObject {\n        let realm = realmWithTestPath()\n        realm.beginWrite()\n        let array = realm.create(SwiftArrayPropertyObject.self, value: [\"name\"])\n        try! realm.commitWrite()\n\n        XCTAssertNotNil(array.realm)\n        return array\n    }\n\n    override func createArrayWithLinks() -> SwiftListOfSwiftObject {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let array = realm.create(SwiftListOfSwiftObject.self)\n        try! realm.commitWrite()\n\n        XCTAssertNotNil(array.realm)\n        return array\n    }\n\n    override func createEmbeddedArray() -> List<EmbeddedTreeObject1> {\n        let realm = try! Realm()\n        return try! realm.write {\n            realm.create(EmbeddedParentObject.self).array\n        }\n    }\n}\n\nclass ListRetrievedTests: ListTests {\n    override func createArray() -> SwiftArrayPropertyObject {\n        let realm = realmWithTestPath()\n        realm.beginWrite()\n        realm.create(SwiftArrayPropertyObject.self, value: [\"name\"])\n        try! realm.commitWrite()\n        let array = realm.objects(SwiftArrayPropertyObject.self).first!\n\n        XCTAssertNotNil(array.realm)\n        return array\n    }\n\n    override func createArrayWithLinks() -> SwiftListOfSwiftObject {\n        let realm = try! Realm()\n        realm.beginWrite()\n        realm.create(SwiftListOfSwiftObject.self)\n        try! realm.commitWrite()\n        let array = realm.objects(SwiftListOfSwiftObject.self).first!\n\n        XCTAssertNotNil(array.realm)\n        return array\n    }\n\n    override func createEmbeddedArray() -> List<EmbeddedTreeObject1> {\n        let realm = try! Realm()\n        try! realm.write {\n            realm.create(EmbeddedParentObject.self)\n        }\n        return realm.objects(EmbeddedParentObject.self).first!.array\n    }\n}\n\n/// Ensure the range replaceable collection methods behave correctly when emulated for Swift 4 and later.\nclass ListRRCMethodsTests: TestCase {\n    private func compare(array: [Int], with list: List<SwiftIntObject>) {\n        guard array.count == list.count else {\n            XCTFail(\"Array and list have different sizes (\\(array.count) and \\(list.count), respectively).\")\n            return\n        }\n        for i in 0..<array.count {\n            XCTAssertEqual(array[i], list[i].intCol,\n                           \"Mistmatched array value (\\(array[i])) and list value (\\(list[i].intCol)) at index \\(i)\")\n        }\n    }\n\n    private func makeArray(from list: List<SwiftIntObject>) -> [Int] {\n        return list.map { $0.intCol }\n    }\n\n    private func makeSwiftIntObjects(from array: [Int]) -> [SwiftIntObject] {\n        return array.map { SwiftIntObject(value: [$0]) }\n    }\n\n    private func createListObject(_ values: [Int] = [0, 1, 2, 3, 4, 5, 6]) -> SwiftArrayPropertyObject {\n        let object = SwiftArrayPropertyObject()\n        XCTAssertNil(object.realm)\n        object.intArray.append(objectsIn: makeSwiftIntObjects(from: values))\n        return object\n    }\n\n    private var array: [Int]!\n    private var list: List<SwiftIntObject>!\n\n    override func setUp() {\n        super.setUp()\n        list = createListObject().intArray\n        array = makeArray(from: list)\n    }\n\n    func testSubscript() {\n        list[0] = SwiftIntObject(value: [5])\n        list[1..<4] = createListObject([10, 11, 12]).intArray[0..<2]\n        array[0] = 5\n        array[1..<4] = [10, 11]\n        compare(array: array, with: list)\n    }\n\n    func testReplaceWithCollectionIndices() {\n        let newElements = [1, 2, 3]\n        list.replaceSubrange(list.indices, with: makeSwiftIntObjects(from: newElements))\n        array.replaceSubrange(array.indices, with: newElements)\n        compare(array: array, with: list)\n    }\n\n    func testRemoveWithCollectionIndices() {\n        list.removeSubrange(list.indices)\n        XCTAssertTrue(list.isEmpty)\n    }\n\n    func testRemoveFirst() {\n        list.removeFirst()\n        array.removeFirst()\n        compare(array: array, with: list)\n    }\n\n    func testRemoveFirstFew() {\n        list.removeFirst(3)\n        array.removeFirst(3)\n        compare(array: array, with: list)\n    }\n\n    func testRemoveFirstInvalid() {\n        assertThrows(list.removeFirst(-1))\n        assertThrows(list.removeFirst(100))\n    }\n\n    func testRemoveLastFew() {\n        list.removeLast(3)\n        array.removeLast(3)\n        compare(array: array, with: list)\n    }\n\n    func testInsert() {\n        let newElements = [10, 11, 12, 13]\n        list.insert(contentsOf: makeSwiftIntObjects(from: newElements), at: 2)\n        array.insert(contentsOf: newElements, at: 2)\n        compare(array: array, with: list)\n    }\n\n    func testRemoveClosedSubrange() {\n        let subrange: ClosedRange<Int> = 1...3\n        list.removeSubrange(subrange)\n        array.removeSubrange(subrange)\n        compare(array: array, with: list)\n    }\n\n    func testRemoveOpenSubrange() {\n        let subrange: Range<Int> = 1..<3\n        list.removeSubrange(subrange)\n        array.removeSubrange(subrange)\n        compare(array: array, with: list)\n    }\n\n    func testReplaceClosedSubrange() {\n        let subrange: ClosedRange<Int> = 2...5\n        let newElements = [10, 11, 12, 13, 14, 15, 16]\n        list.replaceSubrange(subrange, with: makeSwiftIntObjects(from: newElements))\n        array.replaceSubrange(subrange, with: newElements)\n        compare(array: array, with: list)\n    }\n\n    func testReplaceOpenSubrange() {\n        let subrange: Range<Int> = 2..<5\n        let newElements = [10, 11, 12, 13, 14, 15, 16]\n        list.replaceSubrange(subrange, with: makeSwiftIntObjects(from: newElements))\n        array.replaceSubrange(subrange, with: newElements)\n        compare(array: array, with: list)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/MapTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\nclass MapTests: TestCase {\n    var str1: SwiftStringObject!\n    var str2: SwiftStringObject!\n    var realm: Realm!\n\n    func createMap() -> Map<String, SwiftStringObject?> {\n        fatalError(\"abstract\")\n    }\n\n    func createMapObject() -> SwiftMapPropertyObject {\n        fatalError(\"abstract\")\n    }\n\n    func createEmbeddedMap() -> Map<String, EmbeddedTreeObject1?> {\n        fatalError(\"abstract\")\n    }\n\n    override func setUp() {\n        super.setUp()\n\n        let str1 = SwiftStringObject()\n        str1.stringCol = \"1\"\n        self.str1 = str1\n\n        let str2 = SwiftStringObject()\n        str2.stringCol = \"2\"\n        self.str2 = str2\n\n        realm = realmWithTestPath()\n        try! realm.write {\n            realm.add(str1)\n            realm.add(str2)\n        }\n        realm.beginWrite()\n    }\n\n    override func tearDown() {\n        if realm.isInWriteTransaction {\n            realm.cancelWrite()\n        }\n        str1 = nil\n        str2 = nil\n        realm = nil\n        super.tearDown()\n    }\n\n    override class var defaultTestSuite: XCTestSuite {\n        // Don't run tests for the base class\n        if isEqual(MapTests.self) {\n            return XCTestSuite(name: \"empty\")\n        }\n        return super.defaultTestSuite\n    }\n\n    func testPrimitive() {\n        let obj = SwiftMapObject()\n        obj.int[\"key\"] = 5\n        XCTAssertEqual(obj.int[\"key\"]!, 5)\n        XCTAssertNil(obj.int[\"doesntExist\"])\n        obj.int[\"keyB\"] = 6\n        obj.int[\"keyC\"] = 7\n        obj.int[\"keyD\"] = 8\n        XCTAssertEqual(obj.int.max(), 8)\n        XCTAssertEqual(obj.int.min(), 5)\n        XCTAssertEqual(obj.int.sum(), 26)\n        XCTAssertEqual(obj.int.average(), 6.5)\n\n        obj.string[\"key\"] = \"str\"\n        XCTAssertEqual(obj.string[\"key\"], \"str\")\n    }\n\n    func testPrimitiveIterationAcrossNil() {\n        let obj = SwiftMapObject()\n\n        XCTAssertFalse(obj.int.contains(where: { $0 == \"0\" || $1 == 5 }))\n        XCTAssertFalse(obj.int8.contains(where: { $0 == \"0\" || $1 == 5 }))\n        XCTAssertFalse(obj.int16.contains(where: { $0 == \"0\" || $1 == 5 }))\n        XCTAssertFalse(obj.int32.contains(where: { $0 == \"0\" || $1 == 5 }))\n        XCTAssertFalse(obj.int64.contains(where: { $0 == \"0\" || $1 == 5 }))\n        XCTAssertFalse(obj.float.contains(where: { $0 == \"0\" || $1 == 3.141592 }))\n        XCTAssertFalse(obj.double.contains(where: { $0 == \"0\" || $1 == 3.141592 }))\n        XCTAssertFalse(obj.string.contains(where: { $0 == \"0\" || $1 == \"foobar\" }))\n        XCTAssertFalse(obj.data.contains(where: { $0 == \"0\" || $1 == Data() }))\n        XCTAssertFalse(obj.date.contains(where: { $0 == \"0\" || $1 == Date() }))\n        XCTAssertFalse(obj.decimal.contains(where: { $0 == \"0\" || $1 == Decimal128() }))\n        XCTAssertFalse(obj.objectId.contains(where: { $0 == \"0\" || $1 == ObjectId() }))\n        XCTAssertFalse(obj.uuid.contains(where: { $0 == \"0\" || $1 == UUID() }))\n        XCTAssertFalse(obj.object.contains(where: { $0 == \"0\" || $1 == SwiftStringObject() }))\n\n        XCTAssertFalse(obj.intOpt.contains { $1 == nil })\n        XCTAssertFalse(obj.int8Opt.contains { $1 == nil })\n        XCTAssertFalse(obj.int16Opt.contains { $1 == nil })\n        XCTAssertFalse(obj.int32Opt.contains { $1 == nil })\n        XCTAssertFalse(obj.int64Opt.contains { $1 == nil })\n        XCTAssertFalse(obj.floatOpt.contains { $1 == nil })\n        XCTAssertFalse(obj.doubleOpt.contains { $1 == nil })\n        XCTAssertFalse(obj.stringOpt.contains { $1 == nil })\n        XCTAssertFalse(obj.dataOpt.contains { $1 == nil })\n        XCTAssertFalse(obj.dateOpt.contains { $1 == nil })\n        XCTAssertFalse(obj.decimalOpt.contains { $1 == nil })\n        XCTAssertFalse(obj.objectIdOpt.contains { $1 == nil })\n        XCTAssertFalse(obj.uuidOpt.contains { $1 == nil })\n    }\n\n    func testInvalidated() {\n        let mapObject = SwiftMapOfSwiftObject()\n        realm.add(mapObject)\n        XCTAssertFalse(mapObject.map.isInvalidated)\n\n        if let realm = mapObject.realm {\n            realm.delete(mapObject)\n            XCTAssertTrue(mapObject.map.isInvalidated)\n        }\n    }\n\n    func testFastEnumerationWithMutation() {\n        let map = createMap()\n        for i in 0...5 {\n            map[\"key\\(i)\"] = str1\n        }\n        var str = \"\"\n\n        for obj in map {\n            str += obj.value!.stringCol\n            map[obj.key] = str2\n        }\n        XCTAssertEqual(str, \"111111\")\n    }\n\n    func testMapDescription() {\n        let map = createMap()\n        for i in 0...5 {\n            map[\"key\\(i)\"] = SwiftStringObject(value: [String(i)])\n        }\n\n        XCTAssertTrue(map.description.hasPrefix(\"Map<string, SwiftStringObject>\"))\n        XCTAssertTrue(map.description.contains(\"[key3]: SwiftStringObject {\\n\\t\\tstringCol = 3;\\n\\t}\"))\n    }\n\n    func testAppendObject() {\n        let map = createMap()\n        map[\"key1\"] = str1\n        map[\"key2\"] = str2\n        XCTAssertEqual(2, map.count)\n        XCTAssertEqual(\"1\", map[\"key1\"]!!.stringCol)\n        XCTAssertEqual(\"2\", map[\"key2\"]!!.stringCol)\n    }\n\n    func testInsert() {\n        let map = createMap()\n        XCTAssertEqual(0, map.count)\n\n        XCTAssertNil(map[str1.stringCol] as Any?)\n        map[str1.stringCol] = str1\n        XCTAssertEqual(1, map.count)\n\n        XCTAssertNil(map[str2.stringCol] as Any?)\n        map[str2.stringCol] = str2\n        XCTAssertEqual(2, map.count)\n    }\n\n    func testRemove() {\n        let map = createMap()\n        map[str1.stringCol] = str1\n        XCTAssertEqual(1, map.count)\n        XCTAssertNotNil(map[str1.stringCol] as Any?)\n\n        map.removeObject(for: str1.stringCol)\n        XCTAssertEqual(0, map.count)\n        XCTAssertNil(map[str1.stringCol] as Any?)\n\n        map[str1.stringCol] = str1\n        XCTAssertEqual(1, map.count)\n        XCTAssertNotNil(map[str1.stringCol] as Any?)\n\n        map[str1.stringCol] = nil\n        XCTAssertEqual(0, map.count)\n        XCTAssertNil(map[str1.stringCol] as Any?)\n    }\n\n    func testRemoveAll() {\n        let map = createMap()\n        for i in 0..<5 {\n            map[String(i)] = str1\n        }\n        XCTAssertEqual(5, map.count)\n        map.removeAll()\n        XCTAssertEqual(0, map.count)\n    }\n\n    func testDeleteObjectFromMap() {\n        let map = createMap()\n        if let realm = map.realm {\n            map[\"key\"] = str1\n            XCTAssertEqual(map[\"key\"]!!.stringCol, str1.stringCol)\n            realm.delete(str1)\n            XCTAssertNil(map[\"key\"] ?? nil)\n        }\n    }\n\n    func testMerge() {\n        let map = createMap()\n        map[\"a\"] = str1\n\n        map.merge([\"b\": str2], uniquingKeysWith: { (old, _) in\n            XCTFail(\"combine called with no duplicates\")\n            return old\n        })\n        XCTAssertEqual(map.count, 2)\n        XCTAssertTrue(str1.isSameObject(as: map[\"a\"]!!))\n        XCTAssertTrue(str2.isSameObject(as: map[\"b\"]!!))\n\n        // Does not actually update because the combine function picks the existing value\n        map.merge([\"b\": str1], uniquingKeysWith: { (old, _) in\n            return old\n        })\n        XCTAssertEqual(map.count, 2)\n        XCTAssertTrue(str1.isSameObject(as: map[\"a\"]!!))\n        XCTAssertTrue(str2.isSameObject(as: map[\"b\"]!!))\n\n        // Does actually update\n        map.merge([\"b\": str1], uniquingKeysWith: { (_, new) in\n            return new\n        })\n        XCTAssertEqual(map.count, 2)\n        XCTAssertTrue(str1.isSameObject(as: map[\"a\"]!!))\n        XCTAssertTrue(str1.isSameObject(as: map[\"b\"]!!))\n\n        // Creating an entirely new value is valid too\n        map.merge([\"a\": str1], uniquingKeysWith: { (_, _) in\n            return SwiftStringObject(value: [\"c\"])\n        })\n        XCTAssertEqual(map.count, 2)\n        XCTAssertEqual(map[\"a\"]!!.stringCol, \"c\")\n        XCTAssertTrue(str1.isSameObject(as: map[\"b\"]!!))\n    }\n\n    func testChangesArePersisted() {\n        let map = createMap()\n        map[\"key\"] = str1\n        map[\"key2\"] = str2\n        if let realm = map.realm {\n            let mapFromResults = realm.objects(SwiftMapPropertyObject.self).first!.map\n            XCTAssertEqual(map[\"key\"]!!.stringCol, mapFromResults[\"key\"]!!.stringCol)\n            XCTAssertEqual(map[\"key2\"]!!.stringCol, mapFromResults[\"key2\"]!!.stringCol)\n        }\n    }\n\n    func testPopulateEmptyMap() {\n        let map = createMap()\n        XCTAssertEqual(map.count, 0, \"Should start with no array elements.\")\n\n        map[\"a\"] = SwiftStringObject(value: [\"a\"])\n        map[\"b\"] = realmWithTestPath().create(SwiftStringObject.self, value: [\"b\"])\n        map[str1.stringCol] = str1\n\n        XCTAssertEqual(map.count, 3)\n        XCTAssertEqual(map[\"a\"]!!.stringCol, \"a\")\n        XCTAssertEqual(map[\"b\"]!!.stringCol, \"b\")\n        XCTAssertEqual(map[str1.stringCol]!!.stringCol, str1.stringCol)\n\n        var count = 0\n        for object in map {\n            XCTAssertTrue(object.key.description.utf16.count > 0, \"Object should have description\")\n            XCTAssertTrue(object.value!.description.utf16.count > 0, \"Object should have description\")\n            count += 1\n        }\n        XCTAssertEqual(count, 3)\n    }\n\n    func testEnumeratingMap() {\n        let map = createMap()\n        for i in 0..<10 {\n            map[\"key\\(i)\"] = SwiftStringObject(value: [\"key\\(i)\"])\n        }\n\n        XCTAssertEqual(10, map.count)\n\n        var expected = Set((0..<10).map { \"key\\($0)\" })\n        for element in map {\n            XCTAssertEqual(element.key, element.value!.stringCol)\n            expected.remove(element.key)\n        }\n        XCTAssertEqual(expected.count, 0)\n\n        expected = Set((0..<10).map { \"key\\($0)\" })\n        for (key, value) in map {\n            XCTAssertEqual(key, value!.stringCol)\n            expected.remove(key)\n        }\n        XCTAssertEqual(expected.count, 0)\n    }\n\n    func testValueForKey() {\n        let realm = try! Realm()\n        try! realm.write {\n            for value in [1, 2] {\n                let mapObject = SwiftMapOfSwiftObject()\n                let object = SwiftObject()\n                object.intCol = value\n                object.doubleCol = Double(value)\n                object.stringCol = String(value)\n                object.decimalCol = Decimal128(number: value as NSNumber)\n                object.objectIdCol = try! ObjectId(string: String(repeating: String(value), count: 24))\n                mapObject.map[\"key\"] = object\n                realm.add(mapObject)\n            }\n        }\n\n        let mapObjects = realm.objects(SwiftMapOfSwiftObject.self)\n        let mapsOfObjects = mapObjects.value(forKeyPath: \"map\") as! [Map<String, SwiftObject?>]\n        let objects = realm.objects(SwiftObject.self)\n\n        func testProperty<T: Equatable>(line: UInt = #line, fn: @escaping (SwiftObject?) -> T) {\n            let properties: [T] = Array(mapObjects.flatMap {\n                $0.map.values.map(fn)\n            })\n            let kvcProperties: [T] = Array(mapsOfObjects.flatMap { $0.values.map(fn) })\n            XCTAssertEqual(properties, kvcProperties, line: line)\n        }\n        func testProperty<T: Equatable>(_ name: String, line: UInt = #line, fn: @escaping (SwiftObject?) -> T) {\n            let properties = Array(objects.compactMap(fn))\n            let mapsOfObjects = objects.value(forKeyPath: name) as! [T]\n            let kvcProperties = Array(mapsOfObjects.compactMap { $0 })\n            XCTAssertEqual(properties, kvcProperties, line: line)\n        }\n\n        testProperty { $0!.intCol }\n        testProperty { $0!.doubleCol }\n        testProperty { $0!.stringCol }\n        testProperty { $0!.decimalCol }\n        testProperty { $0!.objectIdCol }\n\n        testProperty(\"intCol\") { $0!.intCol }\n        testProperty(\"doubleCol\") { $0!.doubleCol }\n        testProperty(\"stringCol\") { $0!.stringCol }\n        testProperty(\"decimalCol\") { $0!.decimalCol }\n        testProperty(\"objectIdCol\") { $0!.objectIdCol }\n    }\n\n    @available(*, deprecated) // Silence deprecation warnings for RealmOptional\n    func testValueForKeyOptional() {\n        let realm = try! Realm()\n        try! realm.write {\n            for value in [1, 2] {\n                let mapObject = SwiftMapOfSwiftOptionalObject()\n                let object = SwiftOptionalObject()\n                object.optIntCol.value = value\n                object.optInt8Col.value = Int8(value)\n                object.optDoubleCol.value = Double(value)\n                object.optStringCol = String(value)\n                object.optNSStringCol = NSString(format: \"%d\", value)\n                object.optDecimalCol = Decimal128(number: value as NSNumber)\n                object.optObjectIdCol = try! ObjectId(string: String(repeating: String(value), count: 24))\n                mapObject.map[\"key\"] = object\n                realm.add(mapObject)\n            }\n        }\n\n        let mapObjects = realm.objects(SwiftMapOfSwiftOptionalObject.self)\n        let mapsOfObjects = mapObjects.value(forKeyPath: \"map\") as! [Map<String, SwiftOptionalObject?>]\n        let objects = realm.objects(SwiftOptionalObject.self)\n\n        func testProperty<T: Equatable>(line: UInt = #line, fn: @escaping (SwiftOptionalObject?) -> T) {\n            let properties: [T] = mapObjects.flatMap { $0.map.values.map(fn) }\n            let kvcProperties: [T] = mapsOfObjects.flatMap { $0.values.map(fn) }\n            XCTAssertEqual(properties, kvcProperties, line: line)\n        }\n        func testProperty<T: Equatable>(_ name: String, line: UInt = #line, fn: @escaping (SwiftOptionalObject?) -> T) {\n            let properties = Array(objects.compactMap(fn))\n            let mapsOfObjects = objects.value(forKeyPath: name) as! [T]\n            let kvcProperties = Array(mapsOfObjects.compactMap { $0 })\n            XCTAssertEqual(properties, kvcProperties, line: line)\n        }\n\n        testProperty { $0!.optIntCol.value }\n        testProperty { $0!.optInt8Col.value }\n        testProperty { $0!.optDoubleCol.value }\n        testProperty { $0!.optStringCol }\n        testProperty { $0!.optNSStringCol }\n        testProperty { $0!.optDecimalCol }\n        testProperty { $0!.optObjectCol }\n\n        testProperty(\"optIntCol\") { $0!.optIntCol.value }\n        testProperty(\"optInt8Col\") { $0!.optInt8Col.value }\n        testProperty(\"optDoubleCol\") { $0!.optDoubleCol.value }\n        testProperty(\"optStringCol\") { $0!.optStringCol }\n        testProperty(\"optNSStringCol\") { $0!.optNSStringCol }\n        testProperty(\"optDecimalCol\") { $0!.optDecimalCol }\n        testProperty(\"optObjectCol\") { $0!.optObjectCol }\n    }\n\n    func testAppendEmbedded() {\n        let map = createEmbeddedMap()\n        for i in 0..<10 {\n            map[\"\\(i)\"] = EmbeddedTreeObject1(value: [i])\n        }\n        XCTAssertEqual(10, map.count)\n\n        for element in map {\n            XCTAssertEqual(Int(element.key), element.value!.value)\n            XCTAssertEqual(map.realm, element.value!.realm)\n        }\n\n        if map.realm != nil {\n            // This message comes from Core and is incorrect for Dictionary.\n            assertThrows((map[\"unassigned\"] = map[\"0\"]),\n                         reason: \"Cannot add an existing managed embedded object to a Dictionary.\")\n        }\n        realm.cancelWrite()\n    }\n\n    func testSetEmbedded() {\n        let map = createEmbeddedMap()\n        map[\"key\"] = EmbeddedTreeObject1(value: [0])\n\n        let oldObj = map[\"key\"]\n        let obj = EmbeddedTreeObject1(value: [1])\n        map[\"key\"] = obj\n        XCTAssertTrue(map[\"key\"]!!.isSameObject(as: obj))\n        XCTAssertEqual(obj.value, 1)\n        XCTAssertEqual(obj.realm, map.realm)\n\n        if map.realm != nil {\n            XCTAssertTrue(oldObj!!.isInvalidated)\n            assertThrows(map[\"key\"] = obj,\n                         reason: \"Cannot add an existing managed embedded object to a Dictionary.\")\n        }\n\n        realm.cancelWrite()\n    }\n\n    func testUnmanagedMapComparison() {\n        let obj = SwiftIntObject()\n        obj.intCol = 5\n        let obj2 = SwiftIntObject()\n        obj2.intCol = 6\n        let obj3 = SwiftIntObject()\n        obj3.intCol = 8\n\n        let objects = [\"obj\": obj, \"obj2\": obj2, \"obj3\": obj3]\n        let objects2 = [\"obj\": obj, \"obj2\": obj2]\n\n        let map1 = Map<String, SwiftIntObject?>()\n        let map2 = Map<String, SwiftIntObject?>()\n        XCTAssertEqual(map1, map2, \"Empty instances should be equal by `==` operator\")\n\n        map1.merge(objects) { (a, _) in a }\n        map2.merge(objects) { (a, _) in a }\n\n        let map3 = Map<String, SwiftIntObject?>()\n        map3.merge(objects2) { (a, _) in a }\n\n        XCTAssertTrue(map1 !== map2, \"instances should not be identical\")\n\n        XCTAssertEqual(map1, map2, \"instances should be equal by `==` operator\")\n        XCTAssertNotEqual(map1, map3, \"instances should be equal by `==` operator\")\n\n        XCTAssertTrue(map1.isEqual(map2), \"instances should be equal by `isEqual` method\")\n        XCTAssertTrue(!map1.isEqual(map3), \"instances should be equal by `isEqual` method\")\n\n        map3[\"obj3\"] = obj3\n        XCTAssertEqual(map1, map3, \"instances should be equal by `==` operator\")\n\n        XCTAssertEqual(Dictionary<String, SwiftIntObject?>(_immutableCocoaDictionary: map1),\n                       Dictionary<String, SwiftIntObject?>(_immutableCocoaDictionary: map2),\n                       \"instances converted to Swift.Dictionary should be equal\")\n        XCTAssertEqual(Dictionary<String, SwiftIntObject?>(_immutableCocoaDictionary: map1),\n                       Dictionary<String, SwiftIntObject?>(_immutableCocoaDictionary: map3),\n                       \"instances converted to Swift.Dictionary should be equal\")\n        map3[\"obj3\"] = nil\n        map1[\"obj3\"] = nil\n        XCTAssertEqual(Dictionary<String, SwiftIntObject?>(_immutableCocoaDictionary: map1),\n                       Dictionary<String, SwiftIntObject?>(_immutableCocoaDictionary: map3),\n                       \"instances should be equal by `==` operator\")\n    }\n\n    func testFilter() {\n        let map = createMap()\n\n        map[\"key\"] = SwiftStringObject(value: [\"apples\"])\n        map[\"key2\"] = SwiftStringObject(value: [\"bananas\"])\n        map[\"key3\"] = SwiftStringObject(value: [\"cockroach\"])\n\n        if map.realm != nil {\n            let results: Results<SwiftStringObject?> = map.filter(NSPredicate(format: \"stringCol = 'apples'\"))\n            XCTAssertEqual(results.count, 1)\n            XCTAssertEqual(results.first!!.stringCol, \"apples\")\n\n            let results2: Results<SwiftStringObject?> = map.sorted(byKeyPath: \"stringCol\", ascending: true)\n            XCTAssertEqual(results2.count, 3)\n            XCTAssertEqual(results2[0]!.stringCol, \"apples\")\n            XCTAssertEqual(results2[1]!.stringCol, \"bananas\")\n            XCTAssertEqual(results2[2]!.stringCol, \"cockroach\")\n        } else {\n            assertThrows(map.filter(NSPredicate(format: \"stringCol = 'apples'\")))\n            assertThrows(map.sorted(byKeyPath: \"stringCol\", ascending: false))\n        }\n    }\n\n    func testKeyedSortable() {\n        let map = createMap()\n\n        map[\"key\"] = SwiftStringObject(value: [\"apples\"])\n        map[\"key2\"] = SwiftStringObject(value: [\"bananas\"])\n        map[\"key3\"] = SwiftStringObject(value: [\"cockroach\"])\n\n        if map.realm != nil {\n            let results2: Results<SwiftStringObject?> = map.sorted(by: \\.stringCol,\n                                                                   ascending: true)\n            XCTAssertEqual(results2.count, 3)\n            XCTAssertEqual(results2[0]?.stringCol, \"apples\")\n            XCTAssertEqual(results2[1]?.stringCol, \"bananas\")\n            XCTAssertEqual(results2[2]?.stringCol, \"cockroach\")\n        } else {\n            assertThrows(map.sorted(by: \\.stringCol, ascending: true))\n        }\n    }\n\n    func testKeyedAggregatable() {\n        let map = SwiftMapPropertyObject()\n        map.intMap[\"key\"] = SwiftIntObject(value: [1])\n        map.intMap[\"key2\"] = SwiftIntObject(value: [2])\n        map.intMap[\"key3\"] = SwiftIntObject(value: [3])\n\n        func assertAggregations() {\n            let min = map.intMap.min(of: \\.intCol)\n            let max = map.intMap.max(of: \\.intCol)\n            let sum = map.intMap.sum(of: \\.intCol)\n            let avg = map.intMap.average(of: \\.intCol)\n            XCTAssertEqual(min, 1)\n            XCTAssertEqual(max, 3)\n            XCTAssertEqual(sum, 6)\n            XCTAssertEqual(avg, 2)\n        }\n        // unmanaged\n        assertAggregations()\n        realm.add(map)\n        try! realm.commitWrite()\n        // managed\n        assertAggregations()\n    }\n\n    func testAllKeysQuery() {\n        let map = createMap()\n        if let realm = map.realm {\n            func test<T: RealmCollectionValue>(on key: String, value: T) {\n                XCTAssertEqual(realm.objects(SwiftMapObject.self).filter(\"ANY \\(key).@allKeys = 'aKey'\").count, 0)\n                let o = SwiftMapObject()\n                (o.value(forKey: key) as! Map<String, T>)[\"aKey\"] = value\n                let o2 = SwiftMapObject()\n                (o2.value(forKey: key) as! Map<String, T>)[\"aKey2\"] = value\n                let o3 = SwiftMapObject()\n                (o3.value(forKey: key) as! Map<String, T>)[\"aKey3\"] = value\n                let o4 = SwiftMapObject()\n                // this object should be visible from `ANY \\(key).@allKeys != 'aKey'`\n                // as the dictionary contains more than one key.\n                (o4.value(forKey: key) as! Map<String, T>)[\"aKey\"] = value\n                (o4.value(forKey: key) as! Map<String, T>)[\"aKey4\"] = value\n                realm.add([o, o2, o3, o4])\n\n                XCTAssertEqual(realm.objects(SwiftMapObject.self).count, 4)\n                XCTAssertEqual(realm.objects(SwiftMapObject.self).filter(\"ANY \\(key).@allKeys = 'aKey'\").count, 2)\n                XCTAssertEqual(realm.objects(SwiftMapObject.self).filter(\"ANY \\(key).@allKeys != 'aKey'\").count, 3)\n\n                XCTAssertEqual(realm.objects(SwiftMapObject.self).filter(\"ANY \\(key).@allKeys =[c] 'akey'\").count, 2)\n                XCTAssertEqual(realm.objects(SwiftMapObject.self).filter(\"ANY \\(key).@allKeys !=[c] 'akey'\").count, 3)\n\n                XCTAssertEqual(realm.objects(SwiftMapObject.self).filter(\"ANY \\(key).@allKeys =[cd] 'akéy'\").count, 2)\n                XCTAssertEqual(realm.objects(SwiftMapObject.self).filter(\"ANY \\(key).@allKeys !=[cd] 'akéy'\").count, 3)\n\n                realm.delete([o, o2, o3, o4])\n            }\n\n            test(on: \"int\", value: Int(123))\n            test(on: \"int8\", value: Int8(127))\n            test(on: \"int16\", value: Int16(789))\n            test(on: \"int32\", value: Int32(789))\n            test(on: \"int64\", value: Int64(789))\n            test(on: \"float\", value: Float(789.123))\n            test(on: \"double\", value: Double(789.123))\n            test(on: \"string\", value: \"Hello\")\n            test(on: \"data\", value: Data(count: 16))\n            test(on: \"date\", value: Date())\n            test(on: \"decimal\", value: Decimal128(floatLiteral: 123.456))\n            test(on: \"objectId\", value: ObjectId())\n            test(on: \"uuid\", value: UUID())\n            test(on: \"object\", value: Optional<SwiftStringObject>(SwiftStringObject(value: [\"hello\"])))\n        }\n    }\n\n    func testAllValuesQuery() {\n        let map = createMap()\n        if let realm = map.realm {\n            func test<T: RealmCollectionValue>(on key: String, values: T...) {\n                XCTAssertEqual(realm.objects(SwiftMapObject.self).filter(\"ANY \\(key).@allValues = %@\", values[0]).count, 0)\n                let o = SwiftMapObject()\n                (o.value(forKey: key) as! Map<String, T>)[\"aKey\"] = values[0]\n                let o2 = SwiftMapObject()\n                (o2.value(forKey: key) as! Map<String, T>)[\"aKey2\"] = values[1]\n                let o3 = SwiftMapObject()\n                (o3.value(forKey: key) as! Map<String, T>)[\"aKey3\"] = values[2]\n                realm.add([o, o2, o3])\n\n                if T.self is Object.Type {\n                    let stringObj = realm.objects(SwiftStringObject.self).filter(\"stringCol == 'hello'\").first!\n                    XCTAssertEqual(realm.objects(SwiftMapObject.self).filter(\"ANY \\(key).@allValues = %@\", stringObj).count, 1)\n                    XCTAssertEqual(realm.objects(SwiftMapObject.self).filter(\"ANY \\(key).@allValues != %@\", stringObj).count, 2)\n                } else {\n                    XCTAssertEqual(realm.objects(SwiftMapObject.self).count, 3)\n                    XCTAssertEqual(realm.objects(SwiftMapObject.self).filter(\"ANY \\(key).@allValues = %@\", values[0]).count, 1)\n                    XCTAssertEqual(realm.objects(SwiftMapObject.self).filter(\"ANY \\(key).@allValues != %@\", values[0]).count, 2)\n                }\n\n                if T.self is String.Type {\n                    XCTAssertEqual(realm.objects(SwiftMapObject.self).filter(\"ANY \\(key).@allValues =[c] %@\", values[0]).count, 2)\n                    XCTAssertEqual(realm.objects(SwiftMapObject.self).filter(\"ANY \\(key).@allValues !=[c] %@\", values[0]).count, 1)\n\n                    XCTAssertEqual(realm.objects(SwiftMapObject.self).filter(\"ANY \\(key).@allValues =[cd] %@\", values[0]).count, 3)\n                    XCTAssertEqual(realm.objects(SwiftMapObject.self).filter(\"ANY \\(key).@allValues !=[cd] %@\", values[0]).count, 0)\n                }\n                realm.delete([o, o2, o3])\n            }\n\n            test(on: \"int\", values: Int(123), Int(456), Int(789))\n            test(on: \"int8\", values: Int8(127), Int8(0), Int8(64))\n            test(on: \"int16\", values: Int16(789), Int16(345), Int16(567))\n            test(on: \"int32\", values: Int32(789), Int32(132), Int32(345))\n            test(on: \"int64\", values: Int64(789), Int64(234), Int64(345))\n            test(on: \"float\", values: Float(789.123), Float(123.123), Float(234.123))\n            test(on: \"double\", values: Double(789.123), Double(123.123), Double(234.123))\n            test(on: \"string\", values: \"Hello\", \"Héllo\", \"hello\")\n            test(on: \"data\", values: Data(count: 16), Data(count: 32), Data(count: 64))\n            test(on: \"date\",\n                 values: Date(timeIntervalSince1970: 2000),\n                 Date(timeIntervalSince1970: 4000),\n                 Date(timeIntervalSince1970: 8000))\n            test(on: \"decimal\", values: Decimal128(floatLiteral: 123.456), Decimal128(floatLiteral: 234.456), Decimal128(floatLiteral: 345.456))\n            test(on: \"objectId\",\n                 values: ObjectId(\"507f1f77bcf86cd799439011\"),\n                 ObjectId(\"507f1f77bcf86cd799439012\"),\n                 ObjectId(\"507f1f77bcf86cd799439013\"))\n            test(on: \"uuid\",\n                 values: UUID(uuidString: \"137DECC8-B300-4954-A233-F89909F4FD89\")!,\n                 UUID(uuidString: \"137DECC8-B300-4954-A233-F89909F4FD88\")!,\n                 UUID(uuidString: \"137DECC8-B300-4954-A233-F89909F4FD87\")!)\n            test(on: \"object\",\n                 values: Optional<SwiftStringObject>(SwiftStringObject(value: [\"hello\"])),\n                 Optional<SwiftStringObject>(SwiftStringObject(value: [\"there\"])),\n                 Optional<SwiftStringObject>(SwiftStringObject(value: [\"bye\"])))\n        }\n    }\n    // MARK: Notification Tests\n\n    func testNotificationSentInitially() {\n        let mapObj = createMap()\n        try! mapObj.realm!.commitWrite()\n\n        let ex = expectation(description: \"does receive notification\")\n        let token = mapObj.observe(on: queue) { change in\n            switch change {\n            case .initial(let map):\n                XCTAssertNotNil(map)\n                ex.fulfill()\n            default:\n                XCTFail(\"should not get here for this test\")\n            }\n        }\n        wait(for: [ex], timeout: 2.0)\n        token.invalidate()\n        queue.sync { }\n    }\n\n    func testNotificationSentAfterCommit() {\n        let mapObj = createMap()\n        try! mapObj.realm!.commitWrite()\n\n        var exp = expectation(description: \"does receive notification\")\n        var didInsert = false\n        var didModify = false\n        var didDelete = false\n        let token = mapObj.observe(on: queue) { change in\n            switch change {\n            case .initial(let map):\n                XCTAssertNotNil(map)\n                exp.fulfill()\n            case let .update(map, deletions: deletions, insertions: insertions, modifications: modifications):\n                XCTAssertNotNil(map)\n                if didModify && !didDelete {\n                    XCTAssertEqual(deletions, [\"myNewKey\"])\n                    didDelete.toggle()\n                } else if didInsert {\n                    XCTAssertEqual(modifications, [\"myNewKey\"])\n                    didModify.toggle()\n                } else {\n                    XCTAssertEqual(insertions, [\"anotherNewKey\", \"myNewKey\"])\n                    didInsert.toggle()\n                }\n                exp.fulfill()\n            case .error:\n                XCTFail(\"should not get here for this test\")\n            }\n        }\n        wait(for: [exp], timeout: 2.0)\n        exp = expectation(description: \"does receive notification\")\n        try! realm.write {\n            mapObj[\"myNewKey\"] = SwiftStringObject(value: [\"one\"])\n            mapObj[\"anotherNewKey\"] = SwiftStringObject(value: [\"two\"])\n        }\n        wait(for: [exp], timeout: 2.0)\n        XCTAssertTrue(didInsert)\n\n        exp = expectation(description: \"does receive notification\")\n        try! realm.write {\n            mapObj[\"myNewKey\"] = SwiftStringObject(value: [\"three\"])\n        }\n        wait(for: [exp], timeout: 2.0)\n\n        exp = expectation(description: \"does receive notification\")\n        XCTAssertTrue(didModify)\n        try! realm.write {\n            mapObj[\"myNewKey\"] = nil\n        }\n        wait(for: [exp], timeout: 2.0)\n        XCTAssertTrue(didDelete)\n\n        token.invalidate()\n        queue.sync { }\n    }\n\n    /* Expect notification on \"intCol\" key path when intCol is changed */\n    func testObserveKeyPath() {\n        let mapObj = createMapObject()\n        mapObj.swiftObjectMap[\"first\"] = SwiftObject(value: [\"intCol\": 1, \"stringCol\": \"one\"])\n        mapObj.swiftObjectMap[\"second\"] = SwiftObject(value: [\"intCol\": 2, \"stringCol\": \"two\"])\n        try! mapObj.realm!.commitWrite()\n\n        var ex = expectation(description: \"initial notification\")\n        let token = mapObj.swiftObjectMap.observe(keyPaths: [\"intCol\"]) { (changes: RealmMapChange) in\n            switch changes {\n            case .initial(let map):\n                XCTAssertEqual(map.count, 2)\n            case .update(_, let deletions, let insertions, let modifications):\n                XCTAssertEqual(deletions, [])\n                XCTAssertEqual(insertions, [])\n                XCTAssertEqual(modifications, [\"first\"])\n            case .error:\n                XCTFail(\"error not expected\")\n            }\n            ex.fulfill()\n        }\n        wait(for: [ex], timeout: 2.0)\n\n        /* Expect notification on \"intCol\" key path when intCol is changed */\n        ex = expectation(description: \"change notification\")\n        dispatchSyncBackground { unsafeSelf in\n            let realm = unsafeSelf.realmWithTestPath()\n            realm.beginWrite()\n            let obj = realm.objects(SwiftMapPropertyObject.self).first!\n            let value = obj.swiftObjectMap[\"first\"]!!\n            value.intCol = 8\n            try! realm.commitWrite()\n        }\n        wait(for: [ex], timeout: 2.0)\n        token.invalidate()\n    }\n\n    /* Expect no notification on \"intCol\" key path when stringCol is changed */\n    func testObserveKeyPathNoChange() {\n        let mapObj = createMapObject()\n        mapObj.swiftObjectMap[\"first\"] = SwiftObject(value: [\"intCol\": 1, \"stringCol\": \"one\"])\n        mapObj.swiftObjectMap[\"second\"] = SwiftObject(value: [\"intCol\": 2, \"stringCol\": \"two\"])\n        try! mapObj.realm!.commitWrite()\n\n        var ex = expectation(description: \"initial notification\")\n        let token = mapObj.swiftObjectMap.observe(keyPaths: [\"intCol\"]) { (changes: RealmMapChange) in\n            switch changes {\n            case .initial(let map):\n                XCTAssertEqual(map.count, 2)\n            case .update:\n                XCTFail(\"update not expected\")\n            case .error:\n                XCTFail(\"error not expected\")\n            }\n            ex.fulfill()\n        }\n        wait(for: [ex], timeout: 0.1)\n\n        /* Expect no notification on \"intCol\" key path when stringCol is changed */\n        ex = expectation(description: \"NO change notification\")\n        ex.isInverted = true\n        dispatchSyncBackground { unsafeSelf in\n            let realm = unsafeSelf.realmWithTestPath()\n            realm.beginWrite()\n            let obj = realm.objects(SwiftMapPropertyObject.self).first!\n            let value = obj.swiftObjectMap[\"first\"]!!\n            value.stringCol = \"new string\"\n            try! realm.commitWrite()\n        }\n        wait(for: [ex], timeout: 0.1)\n        token.invalidate()\n    }\n\n    /* Expect notification delete notification on \"intCol\" key path when object is removed from map. */\n    func testObserveKeyPathRemoved() {\n        let mapObj = createMapObject()\n        mapObj.swiftObjectMap[\"first\"] = SwiftObject(value: [\"intCol\": 1, \"stringCol\": \"one\"])\n        mapObj.swiftObjectMap[\"second\"] = SwiftObject(value: [\"intCol\": 2, \"stringCol\": \"two\"])\n        try! mapObj.realm!.commitWrite()\n\n        var ex = expectation(description: \"initial notification\")\n        let token = mapObj.swiftObjectMap.observe(keyPaths: [\"intCol\"]) { (changes: RealmMapChange) in\n            switch changes {\n            case .initial(let map):\n                XCTAssertEqual(map.count, 2)\n            case .update(let map, let deletions, let insertions, let modifications):\n                XCTAssertEqual(deletions, [\"first\"])\n                XCTAssertEqual(insertions, [])\n                XCTAssertEqual(modifications, [])\n                XCTAssertEqual(map.count, 1)\n            case .error:\n                XCTFail(\"error not expected\")\n            }\n            ex.fulfill()\n        }\n        wait(for: [ex], timeout: 0.1)\n\n        /* Expect notification on \"intCol\" key path when intCol is changed */\n        ex = expectation(description: \"change notification\")\n        dispatchSyncBackground { unsafeSelf in\n            let realm = unsafeSelf.realmWithTestPath()\n            realm.beginWrite()\n            let obj = realm.objects(SwiftMapPropertyObject.self).first!\n            obj.swiftObjectMap.removeObject(for: \"first\")\n            try! realm.commitWrite()\n        }\n        wait(for: [ex], timeout: 0.1)\n        token.invalidate()\n    }\n\n    /* Expect modification notification on \"intCol\" key path when object is deleted from realm. */\n    func testObserveKeyPathDeleted() {\n        let mapObj = createMapObject()\n        mapObj.swiftObjectMap[\"first\"] = SwiftObject(value: [\"intCol\": 1, \"stringCol\": \"one\"])\n        mapObj.swiftObjectMap[\"second\"] = SwiftObject(value: [\"intCol\": 2, \"stringCol\": \"two\"])\n        try! mapObj.realm!.commitWrite()\n\n        var ex = expectation(description: \"initial notification\")\n        let token = mapObj.swiftObjectMap.observe(keyPaths: [\"intCol\"]) { (changes: RealmMapChange) in\n            switch changes {\n            case .initial(let map):\n                XCTAssertEqual(map.count, 2)\n            case .update(let map, let deletions, let insertions, let modifications):\n                XCTAssertEqual(deletions, [])\n                XCTAssertEqual(insertions, [])\n                XCTAssertEqual(modifications, [\"first\"])\n                XCTAssertEqual(map.count, 2)\n            case .error:\n                XCTFail(\"error not expected\")\n            }\n            ex.fulfill()\n        }\n        wait(for: [ex], timeout: 0.1)\n\n        ex = expectation(description: \"change notification\")\n        dispatchSyncBackground { unsafeSelf in\n            let realm = unsafeSelf.realmWithTestPath()\n            realm.beginWrite()\n            let obj = realm.objects(SwiftMapPropertyObject.self).first!\n            let value = obj.swiftObjectMap[\"first\"]!!\n            realm.delete(value)\n            try! realm.commitWrite()\n        }\n        wait(for: [ex], timeout: 0.1)\n        token.invalidate()\n    }\n\n    /* Expect notification on \"owners.name\" (a backlink property) key path when name is modified. */\n    func testObserveKeyPathBacklink() {\n        let mapObj = createMapObject()\n        let person = realm.create(SwiftOwnerObject.self, value: [\"name\": \"Moe\"])\n        let dog = SwiftDogObject()\n        person.dog = dog\n        mapObj.dogMap[\"first\"] = dog\n        try! mapObj.realm!.commitWrite()\n\n        var ex = expectation(description: \"initial notification\")\n        let token = mapObj.dogMap.observe(keyPaths: [\"owners.name\"]) { (changes: RealmMapChange) in\n            switch changes {\n            case .initial(let map):\n                XCTAssertEqual(map.count, 1)\n                XCTAssertEqual(map[\"first\"]!!.owners.first?.name, \"Moe\")\n            case .update(_, let deletions, let insertions, let modifications):\n                XCTAssertEqual(deletions, [])\n                XCTAssertEqual(insertions, [])\n                XCTAssertEqual(modifications, [\"first\"])\n            case .error:\n                XCTFail(\"error not expected\")\n            }\n            ex.fulfill()\n        }\n        wait(for: [ex], timeout: 0.1)\n\n        ex = expectation(description: \"change notification\")\n        dispatchSyncBackground { unsafeSelf in\n            let realm = unsafeSelf.realmWithTestPath()\n            realm.beginWrite()\n            let obj = realm.objects(SwiftOwnerObject.self).first!\n            obj.name = \"Curley\"\n            try! realm.commitWrite()\n        }\n        wait(for: [ex], timeout: 0.1)\n        token.invalidate()\n    }\n\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    @MainActor func testObserveOnActor() async throws {\n        let map = createMapObject().swiftObjectMap\n        map[\"a\"] = SwiftObject()\n        try realm.commitWrite()\n\n        let initialEx = expectation(description: \"initial\")\n        let changeEx = expectation(description: \"change\")\n        let token = await map.observe(keyPaths: [\"intCol\"], on: MainActor.shared) { _, change in\n            switch change {\n            case .initial:\n                initialEx.fulfill()\n            case .update:\n                changeEx.fulfill()\n            case .error(let error):\n                XCTFail(\"Unexpected error \\(error)\")\n            }\n        }\n        await fulfillment(of: [initialEx])\n        // A write which should not produce a notification and will over-fulfill\n        // the expectation if it does\n        try realm.write {\n            map[\"a\"]??.boolCol = true\n        }\n        try realm.write {\n            map[\"a\"]??.intCol += 1\n        }\n        await fulfillment(of: [changeEx])\n        token.invalidate()\n    }\n\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    @MainActor func testObserveOnActorTypedKeyPath() async throws {\n        let map = createMapObject().swiftObjectMap\n        map[\"a\"] = SwiftObject()\n        try realm.commitWrite()\n\n        let initialEx = expectation(description: \"initial\")\n        let changeEx = expectation(description: \"change\")\n        let token = await map.observe(keyPaths: [\\.intCol], on: MainActor.shared) { _, change in\n            switch change {\n            case .initial:\n                initialEx.fulfill()\n            case .update:\n                changeEx.fulfill()\n            case .error(let error):\n                XCTFail(\"Unexpected error \\(error)\")\n            }\n        }\n        await fulfillment(of: [initialEx])\n        // A write which should not produce a notification and will over-fulfill\n        // the expectation if it does\n        try realm.write {\n            map[\"a\"]??.boolCol = true\n        }\n        try realm.write {\n            map[\"a\"]??.intCol += 1\n        }\n        await fulfillment(of: [changeEx])\n        token.invalidate()\n    }\n}\n\nclass MapStandaloneTests: MapTests {\n    override func createMap() -> Map<String, SwiftStringObject?> {\n        return createMapObject().map\n    }\n\n    override func createMapObject() -> SwiftMapPropertyObject {\n        return SwiftMapPropertyObject()\n    }\n\n    override func createEmbeddedMap() -> Map<String, EmbeddedTreeObject1?> {\n        return Map<String, EmbeddedTreeObject1?>()\n    }\n\n    override func testNotificationSentInitially() {\n        let mapObj = createMap()\n        assertThrows(mapObj.observe {_ in })\n    }\n\n    override func testNotificationSentAfterCommit() {\n        let mapObj = createMap()\n        assertThrows(mapObj.observe {_ in })\n    }\n\n    override func testObserveKeyPath() {\n        let mapObj = createMap()\n        assertThrows(mapObj.observe {_ in })\n    }\n\n    override func testObserveKeyPathNoChange() {\n        let mapObj = createMap()\n        assertThrows(mapObj.observe {_ in })\n    }\n\n    override func testObserveKeyPathRemoved() {\n        let mapObj = createMap()\n        assertThrows(mapObj.observe {_ in })\n    }\n\n    override func testObserveKeyPathDeleted() {\n        let mapObj = createMap()\n        assertThrows(mapObj.observe {_ in })\n    }\n\n    override func testObserveKeyPathBacklink() {\n        let mapObj = createMap()\n        assertThrows(mapObj.observe {_ in })\n    }\n\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    @MainActor override func testObserveOnActor() async throws {\n    }\n\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    @MainActor override func testObserveOnActorTypedKeyPath() async throws {\n    }\n}\n\nclass MapNewlyAddedTests: MapTests {\n    override func createMap() -> Map<String, SwiftStringObject?> {\n        let mapObj = SwiftMapPropertyObject()\n        realm.add(mapObj)\n        XCTAssertNotNil(mapObj.realm)\n        return mapObj.map\n    }\n\n    override func createMapObject() -> SwiftMapPropertyObject {\n        let mapObj = SwiftMapPropertyObject()\n        realm.add(mapObj)\n        XCTAssertNotNil(mapObj.realm)\n        return mapObj\n    }\n\n    override func createEmbeddedMap() -> Map<String, EmbeddedTreeObject1?> {\n        let parent = EmbeddedParentObject()\n        let map = parent.map\n        realm.add(parent)\n        return map\n    }\n}\n\nclass MapNewlyCreatedTests: MapTests {\n    override func createMap() -> Map<String, SwiftStringObject?> {\n        let mapObj = realm.create(SwiftMapPropertyObject.self, value: [\"name\"])\n        try! realm.commitWrite()\n        realm.beginWrite()\n        XCTAssertNotNil(mapObj.realm)\n        return mapObj.map\n    }\n\n    override func createMapObject() -> SwiftMapPropertyObject {\n        let mapObj = realm.create(SwiftMapPropertyObject.self)\n        try! realm.commitWrite()\n        realm.beginWrite()\n        XCTAssertNotNil(mapObj.realm)\n        return mapObj\n    }\n\n    override func createEmbeddedMap() -> Map<String, EmbeddedTreeObject1?> {\n        return realm.create(EmbeddedParentObject.self).map\n    }\n}\n\nclass MapRetrievedTests: MapTests {\n    override func createMap() -> Map<String, SwiftStringObject?> {\n        realm.create(SwiftMapPropertyObject.self, value: [\"name\"])\n        try! realm.commitWrite()\n        let mapObj = realm.objects(SwiftMapPropertyObject.self).first!\n\n        XCTAssertNotNil(mapObj.realm)\n        realm.beginWrite()\n        return mapObj.map\n    }\n\n    override func createMapObject() -> SwiftMapPropertyObject {\n        realm.create(SwiftMapPropertyObject.self)\n        try! realm.commitWrite()\n\n        let mapObj = realm.objects(SwiftMapPropertyObject.self).first!\n\n        XCTAssertNotNil(mapObj.realm)\n        realm.beginWrite()\n        return mapObj\n    }\n\n    override func createEmbeddedMap() -> Map<String, EmbeddedTreeObject1?> {\n        realm.create(EmbeddedParentObject.self)\n        return realm.objects(EmbeddedParentObject.self).first!.map\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/MigrationTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\nimport Realm\nimport Realm.Dynamic\nimport Foundation\n\n#if canImport(RealmSwiftTestSupport)\nimport RealmSwiftTestSupport\n#endif\n\n@discardableResult\nprivate func realmWithSingleClassProperties(_ fileURL: URL, className: String, properties: [AnyObject]) -> RLMRealm {\n    let schema = RLMSchema()\n    let objectSchema = RLMObjectSchema(className: className, objectClass: MigrationObject.self, properties: properties)\n    schema.objectSchema = [objectSchema]\n    let config = RLMRealmConfiguration()\n    config.fileURL = fileURL\n    config.customSchema = schema\n    return try! RLMRealm(configuration: config)\n}\n\nprivate func dynamicRealm(_ fileURL: URL) -> RLMRealm {\n    let config = RLMRealmConfiguration()\n    config.fileURL = fileURL\n    config.dynamic = true\n    return try! RLMRealm(configuration: config)\n}\n\nclass MigrationTests: TestCase {\n    private func createDefaultRealm() throws {\n        let config = Realm.Configuration(fileURL: defaultRealmURL())\n        try autoreleasepool {\n            _ = try Realm(configuration: config)\n        }\n        XCTAssertEqual(0, try schemaVersionAtURL(config.fileURL!))\n    }\n\n    private func testMigration(shouldRun: Bool = true, schemaVersion: UInt64 = 1,\n                               block: MigrationBlock? = nil,\n                               validation: ((Realm, RLMSchema) -> Void)? = nil) throws {\n        let didRun = Locked(false)\n        let config = Realm.Configuration(fileURL: testRealmURL(), schemaVersion: schemaVersion,\n            migrationBlock: { migration, oldSchemaVersion in\n                if let block = block {\n                    block(migration, oldSchemaVersion)\n                }\n                didRun.value = true\n        })\n\n        let fm = FileManager.default\n        func withTestFile(_ fn: () throws -> Void) throws {\n            try fm.copyItem(at: defaultRealmURL(), to: testRealmURL())\n            try autoreleasepool {\n                try fn()\n                XCTAssertEqual(didRun.value, shouldRun)\n            }\n            XCTAssertEqual(schemaVersion, try schemaVersionAtURL(testRealmURL()))\n            if let validation = validation {\n                try autoreleasepool {\n                    let schema = autoreleasepool {\n                        dynamicRealm(testRealmURL()).schema\n                    }\n                    validation(try Realm(configuration: .init(fileURL: testRealmURL(), schemaVersion: schemaVersion)), schema)\n                }\n            }\n            XCTAssertTrue(try Realm.deleteFiles(for: config))\n        }\n\n        try withTestFile {\n            _ = try Realm(configuration: config)\n        }\n        try withTestFile {\n            try Realm.performMigration(for: config)\n        }\n        try withTestFile {\n            let old = Realm.Configuration.defaultConfiguration\n            defer {\n                Realm.Configuration.defaultConfiguration = old\n            }\n            Realm.Configuration.defaultConfiguration = config\n            _ = try Realm()\n        }\n        try withTestFile {\n            let ex = expectation(description: \"did async open\")\n            Realm.asyncOpen(configuration: config) { _ in\n                ex.fulfill()\n            }\n            wait(for: [ex], timeout: 2.0)\n        }\n    }\n\n    // MARK: Test cases\n\n    func testSchemaVersionAtURL() {\n        assertFails(.invalidDatabase, defaultRealmURL(),\n                    \"Realm at path '\\(defaultRealmURL().path)' has not been initialized.\") {\n            // Version should throw before Realm creation\n            try schemaVersionAtURL(defaultRealmURL())\n        }\n\n        _ = try! Realm()\n        XCTAssertEqual(0, try! schemaVersionAtURL(defaultRealmURL()),\n                       \"Initial version should be 0\")\n\n        do {\n            _ = try schemaVersionAtURL(URL(fileURLWithPath: \"/dev/null\"))\n            XCTFail(\"Expected .filePermissionDenied or .fileAccess, but no error was raised\")\n        } catch Realm.Error.filePermissionDenied {\n            // Success!\n        } catch Realm.Error.fileAccess {\n            // Success!\n        } catch {\n            XCTFail(\"Expected .filePermissionDenied or .fileAccess, got \\(error)\")\n        }\n    }\n\n    func testBasic() throws {\n        try createDefaultRealm()\n        try testMigration()\n    }\n\n    func testMigrationProperties() throws {\n        let prop = RLMProperty(name: \"stringCol\", type: RLMPropertyType.int, objectClassName: nil,\n                               linkOriginPropertyName: nil, indexed: false, optional: false)\n        _ = autoreleasepool {\n            realmWithSingleClassProperties(defaultRealmURL(), className: \"SwiftStringObject\", properties: [prop])\n        }\n\n        try testMigration { migration, _ in\n            XCTAssertEqual(migration.oldSchema.objectSchema.count, 1)\n            XCTAssertGreaterThan(migration.newSchema.objectSchema.count, 1)\n            XCTAssertEqual(migration.oldSchema.objectSchema[0].properties.count, 1)\n            XCTAssertEqual(migration.newSchema[\"SwiftStringObject\"]!.properties.count, 1)\n            XCTAssertEqual(migration.oldSchema[\"SwiftStringObject\"]!.properties[0].type, PropertyType.int)\n            XCTAssertEqual(migration.newSchema[\"SwiftStringObject\"]![\"stringCol\"]!.type, PropertyType.string)\n        }\n    }\n\n    func testEnumerate() throws {\n        try createDefaultRealm()\n\n        try testMigration { migration, _ in\n            migration.enumerateObjects(ofType: \"SwiftStringObject\", { _, _ in\n                XCTFail(\"No objects to enumerate\")\n            })\n\n            migration.enumerateObjects(ofType: \"NoSuchClass\", { _, _ in }) // shouldn't throw\n        }\n\n        try autoreleasepool {\n            // add object\n            let realm = try Realm()\n            try realm.write {\n                realm.create(SwiftStringObject.self, value: [\"string\"])\n            }\n        }\n\n        nonisolated(unsafe) let unsafeSelf = self\n        try testMigration(schemaVersion: 2) { migration, _ in\n            var count = 0\n            migration.enumerateObjects(ofType: \"SwiftStringObject\", { oldObj, newObj in\n                guard let oldObj = oldObj, let newObj = newObj else {\n                    return XCTFail(\"did not get objects in enumerate\")\n                }\n\n                XCTAssertEqual(newObj.objectSchema.className, \"SwiftStringObject\")\n                XCTAssertEqual(oldObj.objectSchema.className, \"SwiftStringObject\")\n                XCTAssertEqual((newObj[\"stringCol\"] as! String), \"string\")\n                XCTAssertEqual((oldObj[\"stringCol\"] as! String), \"string\")\n                unsafeSelf.assertThrows(oldObj[\"noSuchCol\"] as! String)\n                unsafeSelf.assertThrows(newObj[\"noSuchCol\"] as! String)\n                count += 1\n            })\n            XCTAssertEqual(count, 1)\n        }\n\n        try autoreleasepool {\n            let realm = try Realm()\n            try realm.write {\n                realm.create(SwiftArrayPropertyObject.self, value: [\"string\", [[\"array\"]], [[2]]])\n                realm.create(SwiftMutableSetPropertyObject.self, value: [\"string\", [[\"set\"]], [[2]]])\n                realm.create(SwiftMapPropertyObject.self, value: [\"string\", [\"key\": [\"value\"]]])\n            }\n        }\n\n        try testMigration(schemaVersion: 3) { migration, _ in\n            migration.enumerateObjects(ofType: \"SwiftArrayPropertyObject\") { oldObject, newObject in\n                XCTAssertTrue(oldObject! as AnyObject is MigrationObject)\n                XCTAssertTrue(newObject! as AnyObject is MigrationObject)\n                XCTAssertTrue(oldObject![\"array\"]! is List<MigrationObject>)\n                XCTAssertTrue(newObject![\"array\"]! is List<MigrationObject>)\n            }\n            migration.enumerateObjects(ofType: \"SwiftMutableSetPropertyObject\") { oldObject, newObject in\n                XCTAssertTrue(oldObject! as AnyObject is MigrationObject)\n                XCTAssertTrue(newObject! as AnyObject is MigrationObject)\n                XCTAssertTrue(oldObject![\"set\"]! is MutableSet<MigrationObject>)\n                XCTAssertTrue(newObject![\"set\"]! is MutableSet<MigrationObject>)\n            }\n            migration.enumerateObjects(ofType: \"SwiftMapPropertyObject\") { oldObject, newObject in\n                XCTAssertTrue(oldObject! as AnyObject is MigrationObject)\n                XCTAssertTrue(newObject! as AnyObject is MigrationObject)\n                XCTAssertTrue(oldObject![\"map\"]! is Map<String, MigrationObject?>)\n                XCTAssertTrue(newObject![\"map\"]! is Map<String, MigrationObject?>)\n            }\n        }\n    }\n\n    func testBasicTypesInEnumerate() throws {\n        try autoreleasepool {\n            let realm = try Realm()\n            try realm.write {\n                realm.add(SwiftObject())\n            }\n        }\n\n        try testMigration { migration, _ in\n            migration.enumerateObjects(ofType: \"SwiftObject\") { oldObject, newObject in\n                XCTAssertTrue(oldObject!.boolCol is Bool)\n                XCTAssertTrue(newObject!.boolCol is Bool)\n                XCTAssertTrue(oldObject!.intCol is Int)\n                XCTAssertTrue(newObject!.intCol is Int)\n                XCTAssertTrue(oldObject!.int8Col is Int)\n                XCTAssertTrue(newObject!.int8Col is Int)\n                XCTAssertTrue(oldObject!.int16Col is Int)\n                XCTAssertTrue(newObject!.int16Col is Int)\n                XCTAssertTrue(oldObject!.int32Col is Int)\n                XCTAssertTrue(newObject!.int32Col is Int)\n                XCTAssertTrue(oldObject!.int64Col is Int)\n                XCTAssertTrue(newObject!.int64Col is Int)\n                XCTAssertTrue(oldObject!.intEnumCol is Int)\n                XCTAssertTrue(newObject!.intEnumCol is Int)\n                XCTAssertTrue(oldObject!.floatCol is Float)\n                XCTAssertTrue(newObject!.floatCol is Float)\n                XCTAssertTrue(oldObject!.doubleCol is Double)\n                XCTAssertTrue(newObject!.doubleCol is Double)\n                XCTAssertTrue(oldObject!.stringCol is String)\n                XCTAssertTrue(newObject!.stringCol is String)\n                XCTAssertTrue(oldObject!.binaryCol is Data)\n                XCTAssertTrue(newObject!.binaryCol is Data)\n                XCTAssertTrue(oldObject!.dateCol is Date)\n                XCTAssertTrue(newObject!.dateCol is Date)\n                XCTAssertTrue(oldObject!.decimalCol is Decimal128)\n                XCTAssertTrue(newObject!.decimalCol is Decimal128)\n                XCTAssertTrue(oldObject!.objectIdCol is ObjectId)\n                XCTAssertTrue(newObject!.objectIdCol is ObjectId)\n                XCTAssertTrue(oldObject!.objectCol is DynamicObject)\n                XCTAssertTrue(newObject!.objectCol is DynamicObject)\n                XCTAssertTrue(oldObject!.uuidCol is UUID)\n                XCTAssertTrue(newObject!.uuidCol is UUID)\n                XCTAssertNil(oldObject!.anyCol)\n                XCTAssertNil(newObject!.anyCol)\n            }\n        }\n    }\n\n    func testAnyInEnumerate() throws {\n        try autoreleasepool {\n            let realm = try Realm()\n            try realm.write {\n                realm.add(SwiftObject())\n            }\n        }\n\n        var version = UInt64(1)\n        func write(_ value: @autoclosure () -> AnyRealmValue, test: @escaping @Sendable (Any?, Any?) -> Void) throws {\n            try autoreleasepool {\n                let realm = try Realm()\n                try realm.write {\n                    realm.objects(SwiftObject.self).first!.anyCol.value = value()\n                }\n            }\n            try testMigration(schemaVersion: version) { migration, _ in\n                migration.enumerateObjects(ofType: \"SwiftObject\") { oldObject, newObject in\n                    test(oldObject!.anyCol, newObject!.anyCol)\n                }\n            }\n            version += 1\n        }\n\n        try write(.int(1)) { oldValue, newValue in\n            XCTAssertTrue(oldValue is Int)\n            XCTAssertTrue(newValue is Int)\n        }\n        try write(.float(1)) { oldValue, newValue in\n            XCTAssertTrue(oldValue is Float)\n            XCTAssertTrue(newValue is Float)\n        }\n        try write(.double(1)) { oldValue, newValue in\n            XCTAssertTrue(oldValue is Double)\n            XCTAssertTrue(newValue is Double)\n        }\n        try write(.bool(true)) { oldValue, newValue in\n            XCTAssertTrue(oldValue is Bool)\n            XCTAssertTrue(newValue is Bool)\n        }\n        try write(.string(\"\")) { oldValue, newValue in\n            XCTAssertTrue(oldValue is String)\n            XCTAssertTrue(newValue is String)\n        }\n        try write(.data(Data())) { oldValue, newValue in\n            XCTAssertTrue(oldValue is Data)\n            XCTAssertTrue(newValue is Data)\n        }\n        try write(.date(Date())) { oldValue, newValue in\n            XCTAssertTrue(oldValue is Date)\n            XCTAssertTrue(newValue is Date)\n        }\n        try write(.objectId(ObjectId())) { oldValue, newValue in\n            XCTAssertTrue(oldValue is ObjectId)\n            XCTAssertTrue(newValue is ObjectId)\n        }\n        try write(.decimal128(Decimal128())) { oldValue, newValue in\n            XCTAssertTrue(oldValue is Decimal128)\n            XCTAssertTrue(newValue is Decimal128)\n        }\n        try write(.uuid(UUID())) { oldValue, newValue in\n            XCTAssertTrue(oldValue is UUID)\n            XCTAssertTrue(newValue is UUID)\n        }\n        try write(.object(SwiftIntObject())) { oldValue, newValue in\n            XCTAssertTrue(oldValue! is DynamicObject)\n            XCTAssertTrue(newValue! is DynamicObject)\n        }\n    }\n\n    @available(*, deprecated) // Silence deprecation warnings for RealmOptional\n    func testOptionalsInEnumerate() throws {\n        try autoreleasepool {\n            let realm = try Realm()\n            try realm.write {\n                realm.add(SwiftOptionalObject())\n            }\n        }\n\n        try testMigration { migration, _ in\n            migration.enumerateObjects(ofType: \"SwiftOptionalObject\") { oldObject, newObject in\n                XCTAssertTrue(oldObject! as AnyObject is MigrationObject)\n                XCTAssertTrue(newObject! as AnyObject is MigrationObject)\n                XCTAssertNil(oldObject!.optNSStringCol)\n                XCTAssertNil(newObject!.optNSStringCol)\n                XCTAssertNil(oldObject!.optStringCol)\n                XCTAssertNil(newObject!.optStringCol)\n                XCTAssertNil(oldObject!.optBinaryCol)\n                XCTAssertNil(newObject!.optBinaryCol)\n                XCTAssertNil(oldObject!.optDateCol)\n                XCTAssertNil(newObject!.optDateCol)\n                XCTAssertNil(oldObject!.optIntCol)\n                XCTAssertNil(newObject!.optIntCol)\n                XCTAssertNil(oldObject!.optInt8Col)\n                XCTAssertNil(newObject!.optInt8Col)\n                XCTAssertNil(oldObject!.optInt16Col)\n                XCTAssertNil(newObject!.optInt16Col)\n                XCTAssertNil(oldObject!.optInt32Col)\n                XCTAssertNil(newObject!.optInt32Col)\n                XCTAssertNil(oldObject!.optInt64Col)\n                XCTAssertNil(newObject!.optInt64Col)\n                XCTAssertNil(oldObject!.optFloatCol)\n                XCTAssertNil(newObject!.optFloatCol)\n                XCTAssertNil(oldObject!.optDoubleCol)\n                XCTAssertNil(newObject!.optDoubleCol)\n                XCTAssertNil(oldObject!.optBoolCol)\n                XCTAssertNil(newObject!.optBoolCol)\n                XCTAssertNil(oldObject!.optDecimalCol)\n                XCTAssertNil(newObject!.optDecimalCol)\n                XCTAssertNil(oldObject!.optObjectIdCol)\n                XCTAssertNil(newObject!.optObjectIdCol)\n            }\n        }\n\n        try autoreleasepool {\n            let realm = try Realm()\n            try realm.write {\n                let soo = realm.objects(SwiftOptionalObject.self).first!\n                soo.optNSStringCol = \"NSString\"\n                soo.optStringCol = \"String\"\n                soo.optBinaryCol = Data()\n                soo.optDateCol = Date()\n                soo.optIntCol.value = 1\n                soo.optInt8Col.value = 2\n                soo.optInt16Col.value = 3\n                soo.optInt32Col.value = 4\n                soo.optInt64Col.value = 5\n                soo.optFloatCol.value = 6.1\n                soo.optDoubleCol.value = 7.2\n                soo.optDecimalCol = 8.3\n                soo.optObjectIdCol = ObjectId(\"1234567890bc1234567890bc\")\n                soo.optBoolCol.value = true\n            }\n        }\n\n        try testMigration(schemaVersion: 2) { migration, _ in\n            migration.enumerateObjects(ofType: \"SwiftOptionalObject\") { oldObject, newObject in\n                XCTAssertTrue(oldObject! as AnyObject is MigrationObject)\n                XCTAssertTrue(newObject! as AnyObject is MigrationObject)\n                XCTAssertTrue(oldObject!.optNSStringCol! is NSString)\n                XCTAssertTrue(newObject!.optNSStringCol! is NSString)\n                XCTAssertTrue(oldObject!.optStringCol! is String)\n                XCTAssertTrue(newObject!.optStringCol! is String)\n                XCTAssertTrue(oldObject!.optBinaryCol! is Data)\n                XCTAssertTrue(newObject!.optBinaryCol! is Data)\n                XCTAssertTrue(oldObject!.optDateCol! is Date)\n                XCTAssertTrue(newObject!.optDateCol! is Date)\n                XCTAssertTrue(oldObject!.optIntCol! is Int)\n                XCTAssertTrue(newObject!.optIntCol! is Int)\n                XCTAssertTrue(oldObject!.optInt8Col! is Int)\n                XCTAssertTrue(newObject!.optInt8Col! is Int)\n                XCTAssertTrue(oldObject!.optInt16Col! is Int)\n                XCTAssertTrue(newObject!.optInt16Col! is Int)\n                XCTAssertTrue(oldObject!.optInt32Col! is Int)\n                XCTAssertTrue(newObject!.optInt32Col! is Int)\n                XCTAssertTrue(oldObject!.optInt64Col! is Int)\n                XCTAssertTrue(newObject!.optInt64Col! is Int)\n                XCTAssertTrue(oldObject!.optFloatCol! is Float)\n                XCTAssertTrue(newObject!.optFloatCol! is Float)\n                XCTAssertTrue(oldObject!.optDoubleCol! is Double)\n                XCTAssertTrue(newObject!.optDoubleCol! is Double)\n                XCTAssertTrue(oldObject!.optBoolCol! is Bool)\n                XCTAssertTrue(newObject!.optBoolCol! is Bool)\n                XCTAssertTrue(oldObject!.optDecimalCol! is Decimal128)\n                XCTAssertTrue(newObject!.optDecimalCol! is Decimal128)\n                XCTAssertTrue(oldObject!.optObjectIdCol! is ObjectId)\n                XCTAssertTrue(newObject!.optObjectIdCol! is ObjectId)\n            }\n        }\n    }\n\n    func testEnumerateObjectsAfterDeleteObjects() throws {\n        try autoreleasepool {\n            let realm = try Realm()\n            try realm.write {\n                realm.create(SwiftStringObject.self, value: [\"1\"])\n                realm.create(SwiftStringObject.self, value: [\"2\"])\n                realm.create(SwiftStringObject.self, value: [\"3\"])\n                realm.create(SwiftIntObject.self, value: [1])\n                realm.create(SwiftIntObject.self, value: [2])\n                realm.create(SwiftIntObject.self, value: [3])\n                realm.create(SwiftInt8Object.self, value: [Int8(1)])\n                realm.create(SwiftInt8Object.self, value: [Int8(2)])\n                realm.create(SwiftInt8Object.self, value: [Int8(3)])\n                realm.create(SwiftInt16Object.self, value: [Int16(1)])\n                realm.create(SwiftInt16Object.self, value: [Int16(2)])\n                realm.create(SwiftInt16Object.self, value: [Int16(3)])\n                realm.create(SwiftInt32Object.self, value: [Int32(1)])\n                realm.create(SwiftInt32Object.self, value: [Int32(2)])\n                realm.create(SwiftInt32Object.self, value: [Int32(3)])\n                realm.create(SwiftInt64Object.self, value: [Int64(1)])\n                realm.create(SwiftInt64Object.self, value: [Int64(2)])\n                realm.create(SwiftInt64Object.self, value: [Int64(3)])\n                realm.create(SwiftBoolObject.self, value: [true])\n                realm.create(SwiftBoolObject.self, value: [false])\n                realm.create(SwiftBoolObject.self, value: [true])\n            }\n        }\n\n        try testMigration(schemaVersion: 1) { migration, _ in\n            var count = 0\n            migration.enumerateObjects(ofType: \"SwiftStringObject\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"stringCol\"] as! String, oldObj![\"stringCol\"] as! String)\n                if oldObj![\"stringCol\"] as! String == \"2\" {\n                    migration.delete(newObj!)\n                }\n            }\n            migration.enumerateObjects(ofType: \"SwiftStringObject\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"stringCol\"] as! String, oldObj![\"stringCol\"] as! String)\n                count += 1\n            }\n            XCTAssertEqual(count, 2)\n\n            count = 0\n            migration.enumerateObjects(ofType: \"SwiftIntObject\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"intCol\"] as! Int, oldObj![\"intCol\"] as! Int)\n                if oldObj![\"intCol\"] as! Int == 1 {\n                    migration.delete(newObj!)\n                }\n            }\n            migration.enumerateObjects(ofType: \"SwiftIntObject\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"intCol\"] as! Int, oldObj![\"intCol\"] as! Int)\n                count += 1\n            }\n            XCTAssertEqual(count, 2)\n\n            count = 0\n            migration.enumerateObjects(ofType: \"SwiftInt8Object\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"int8Col\"] as! Int8, oldObj![\"int8Col\"] as! Int8)\n                if oldObj![\"int8Col\"] as! Int8 == 1 {\n                    migration.delete(newObj!)\n                }\n            }\n            migration.enumerateObjects(ofType: \"SwiftInt8Object\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"int8Col\"] as! Int8, oldObj![\"int8Col\"] as! Int8)\n                count += 1\n            }\n            XCTAssertEqual(count, 2)\n\n            count = 0\n            migration.enumerateObjects(ofType: \"SwiftInt16Object\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"int16Col\"] as! Int16, oldObj![\"int16Col\"] as! Int16)\n                if oldObj![\"int16Col\"] as! Int16 == 1 {\n                    migration.delete(newObj!)\n                }\n            }\n            migration.enumerateObjects(ofType: \"SwiftInt16Object\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"int16Col\"] as! Int16, oldObj![\"int16Col\"] as! Int16)\n                count += 1\n            }\n            XCTAssertEqual(count, 2)\n\n            count = 0\n            migration.enumerateObjects(ofType: \"SwiftInt32Object\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"int32Col\"] as! Int32, oldObj![\"int32Col\"] as! Int32)\n                if oldObj![\"int32Col\"] as! Int32 == 1 {\n                    migration.delete(newObj!)\n                }\n            }\n            migration.enumerateObjects(ofType: \"SwiftInt32Object\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"int32Col\"] as! Int32, oldObj![\"int32Col\"] as! Int32)\n                count += 1\n            }\n            XCTAssertEqual(count, 2)\n\n            count = 0\n            migration.enumerateObjects(ofType: \"SwiftInt64Object\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"int64Col\"] as! Int64, oldObj![\"int64Col\"] as! Int64)\n                if oldObj![\"int64Col\"] as! Int64 == 1 {\n                    migration.delete(newObj!)\n                }\n            }\n            migration.enumerateObjects(ofType: \"SwiftInt64Object\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"int64Col\"] as! Int64, oldObj![\"int64Col\"] as! Int64)\n                count += 1\n            }\n            XCTAssertEqual(count, 2)\n\n            migration.enumerateObjects(ofType: \"SwiftBoolObject\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"boolCol\"] as! Bool, oldObj![\"boolCol\"] as! Bool)\n                migration.delete(newObj!)\n            }\n            migration.enumerateObjects(ofType: \"SwiftBoolObject\") { _, _ in\n                XCTFail(\"This line should not executed since all objects have been deleted.\")\n            }\n        }\n    }\n\n    func testEnumerateObjectsAfterDeleteInsertObjects() throws {\n        try autoreleasepool {\n            let realm = try Realm()\n            try realm.write {\n                realm.create(SwiftStringObject.self, value: [\"1\"])\n                realm.create(SwiftStringObject.self, value: [\"2\"])\n                realm.create(SwiftStringObject.self, value: [\"3\"])\n                realm.create(SwiftIntObject.self, value: [1])\n                realm.create(SwiftIntObject.self, value: [2])\n                realm.create(SwiftIntObject.self, value: [3])\n                realm.create(SwiftInt8Object.self, value: [Int8(1)])\n                realm.create(SwiftInt8Object.self, value: [Int8(2)])\n                realm.create(SwiftInt8Object.self, value: [Int8(3)])\n                realm.create(SwiftInt16Object.self, value: [Int16(1)])\n                realm.create(SwiftInt16Object.self, value: [Int16(2)])\n                realm.create(SwiftInt16Object.self, value: [Int16(3)])\n                realm.create(SwiftInt32Object.self, value: [Int32(1)])\n                realm.create(SwiftInt32Object.self, value: [Int32(2)])\n                realm.create(SwiftInt32Object.self, value: [Int32(3)])\n                realm.create(SwiftInt64Object.self, value: [Int64(1)])\n                realm.create(SwiftInt64Object.self, value: [Int64(2)])\n                realm.create(SwiftInt64Object.self, value: [Int64(3)])\n                realm.create(SwiftBoolObject.self, value: [true])\n                realm.create(SwiftBoolObject.self, value: [false])\n                realm.create(SwiftBoolObject.self, value: [true])\n            }\n        }\n\n        try testMigration(schemaVersion: 1) { migration, _ in\n            var count = 0\n            migration.enumerateObjects(ofType: \"SwiftStringObject\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"stringCol\"] as! String, oldObj![\"stringCol\"] as! String)\n                if oldObj![\"stringCol\"] as! String == \"2\" {\n                    migration.delete(newObj!)\n                    migration.create(\"SwiftStringObject\", value: [\"A\"])\n                }\n            }\n            migration.enumerateObjects(ofType: \"SwiftStringObject\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"stringCol\"] as! String, oldObj![\"stringCol\"] as! String)\n                count += 1\n            }\n            XCTAssertEqual(count, 2)\n\n            count = 0\n            migration.enumerateObjects(ofType: \"SwiftIntObject\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"intCol\"] as! Int, oldObj![\"intCol\"] as! Int)\n                if oldObj![\"intCol\"] as! Int == 1 {\n                    migration.delete(newObj!)\n                    migration.create(\"SwiftIntObject\", value: [0])\n                }\n            }\n            migration.enumerateObjects(ofType: \"SwiftIntObject\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"intCol\"] as! Int, oldObj![\"intCol\"] as! Int)\n                count += 1\n            }\n            XCTAssertEqual(count, 2)\n\n            count = 0\n            migration.enumerateObjects(ofType: \"SwiftInt8Object\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"int8Col\"] as! Int8, oldObj![\"int8Col\"] as! Int8)\n                if oldObj![\"int8Col\"] as! Int8 == 1 {\n                    migration.delete(newObj!)\n                    migration.create(\"SwiftInt8Object\", value: [0])\n                }\n            }\n            migration.enumerateObjects(ofType: \"SwiftInt8Object\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"int8Col\"] as! Int8, oldObj![\"int8Col\"] as! Int8)\n                count += 1\n            }\n            XCTAssertEqual(count, 2)\n\n            count = 0\n            migration.enumerateObjects(ofType: \"SwiftInt16Object\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"int16Col\"] as! Int16, oldObj![\"int16Col\"] as! Int16)\n                if oldObj![\"int16Col\"] as! Int16 == 1 {\n                    migration.delete(newObj!)\n                    migration.create(\"SwiftInt16Object\", value: [0])\n                }\n            }\n            migration.enumerateObjects(ofType: \"SwiftInt16Object\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"int16Col\"] as! Int16, oldObj![\"int16Col\"] as! Int16)\n                count += 1\n            }\n            XCTAssertEqual(count, 2)\n\n            count = 0\n            migration.enumerateObjects(ofType: \"SwiftInt32Object\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"int32Col\"] as! Int32, oldObj![\"int32Col\"] as! Int32)\n                if oldObj![\"int32Col\"] as! Int32 == 1 {\n                    migration.delete(newObj!)\n                    migration.create(\"SwiftInt32Object\", value: [0])\n                }\n            }\n            migration.enumerateObjects(ofType: \"SwiftInt32Object\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"int32Col\"] as! Int32, oldObj![\"int32Col\"] as! Int32)\n                count += 1\n            }\n            XCTAssertEqual(count, 2)\n\n            count = 0\n            migration.enumerateObjects(ofType: \"SwiftInt64Object\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"int64Col\"] as! Int64, oldObj![\"int64Col\"] as! Int64)\n                if oldObj![\"int64Col\"] as! Int64 == 1 {\n                    migration.delete(newObj!)\n                    migration.create(\"SwiftInt64Object\", value: [0])\n                }\n            }\n            migration.enumerateObjects(ofType: \"SwiftInt64Object\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"int64Col\"] as! Int64, oldObj![\"int64Col\"] as! Int64)\n                count += 1\n            }\n            XCTAssertEqual(count, 2)\n\n            migration.enumerateObjects(ofType: \"SwiftBoolObject\") { oldObj, newObj in\n                XCTAssertEqual(newObj![\"boolCol\"] as! Bool, oldObj![\"boolCol\"] as! Bool)\n                migration.delete(newObj!)\n                migration.create(\"SwiftBoolObject\", value: [false])\n            }\n            migration.enumerateObjects(ofType: \"SwiftBoolObject\") { _, _ in\n                XCTFail(\"This line should not executed since all objects have been deleted.\")\n            }\n        }\n    }\n\n    func testEnumerateObjectsAfterDeleteData() throws {\n        try autoreleasepool {\n            let realm = try Realm()\n            try realm.write {\n                realm.create(SwiftStringObject.self, value: [\"1\"])\n                realm.create(SwiftStringObject.self, value: [\"2\"])\n                realm.create(SwiftStringObject.self, value: [\"3\"])\n            }\n        }\n\n        try testMigration { migration, _ in\n            var count = 0\n            migration.enumerateObjects(ofType: \"SwiftStringObject\") { _, _ in\n                count += 1\n            }\n            XCTAssertEqual(count, 3)\n\n            migration.deleteData(forType: \"SwiftStringObject\")\n            migration.create(\"SwiftStringObject\", value: [\"A\"])\n\n            count = 0\n            migration.enumerateObjects(ofType: \"SwiftStringObject\") { _, _ in\n                count += 1\n            }\n            XCTAssertEqual(count, 0)\n        }\n    }\n\n    func testCreate() throws {\n        try createDefaultRealm()\n        nonisolated(unsafe) let unsafeSelf = self\n        try testMigration { migration, _ in\n            migration.create(\"SwiftStringObject\", value: [\"string1\"])\n            migration.create(\"SwiftStringObject\", value: [\"stringCol\": \"string2\"])\n            migration.create(\"SwiftStringObject\", value: [\"stringCol\": ModernStringEnum.value1])\n            migration.create(\"SwiftStringObject\", value: [\"stringCol\": StringWrapper(persistedValue: \"string3\")])\n            migration.create(\"SwiftStringObject\")\n\n            unsafeSelf.assertThrows(migration.create(\"NoSuchObject\"))\n        } validation: { realm, _ in\n            let objects = realm.objects(SwiftStringObject.self)\n            XCTAssertEqual(objects.count, 5)\n\n            XCTAssertEqual(objects[0].stringCol, \"string1\")\n            XCTAssertEqual(objects[1].stringCol, \"string2\")\n            XCTAssertEqual(objects[2].stringCol, ModernStringEnum.value1.rawValue)\n            XCTAssertEqual(objects[3].stringCol, \"string3\")\n            XCTAssertEqual(objects[4].stringCol, \"\")\n        }\n    }\n\n    func testDelete() throws {\n        try autoreleasepool {\n            let realm = try Realm()\n            try realm.write {\n                realm.create(SwiftStringObject.self, value: [\"string1\"])\n                realm.create(SwiftStringObject.self, value: [\"string2\"])\n            }\n        }\n\n        try testMigration { migration, _ in\n            var deleted = false\n            migration.enumerateObjects(ofType: \"SwiftStringObject\") { _, newObj in\n                if deleted == false {\n                    migration.delete(newObj!)\n                    deleted = true\n                }\n            }\n        } validation: { realm, _ in\n            XCTAssertEqual(realm.objects(SwiftStringObject.self).count, 1)\n        }\n    }\n\n    func testDeleteData() throws {\n        try autoreleasepool {\n            let prop = RLMProperty(name: \"id\", type: .int, objectClassName: nil,\n                                   linkOriginPropertyName: nil, indexed: false, optional: false)\n            let realm = realmWithSingleClassProperties(defaultRealmURL(),\n                className: \"DeletedClass\", properties: [prop])\n            try realm.transaction {\n                realm.createObject(\"DeletedClass\", withValue: [0])\n            }\n        }\n\n        try testMigration { migration, oldSchemaVersion in\n            XCTAssertEqual(oldSchemaVersion, 0, \"Initial schema version should be 0\")\n\n            XCTAssertTrue(migration.deleteData(forType: \"DeletedClass\"))\n            XCTAssertFalse(migration.deleteData(forType: \"NoSuchClass\"))\n\n            migration.create(SwiftStringObject.className(), value: [\"migration\"])\n            XCTAssertTrue(migration.deleteData(forType: SwiftStringObject.className()))\n        } validation: { realm, schema in\n            XCTAssertNil(schema.schema(forClassName: \"DeletedClass\"))\n            XCTAssertEqual(0, realm.objects(SwiftStringObject.self).count)\n        }\n    }\n\n    func testRenameProperty() throws {\n        try autoreleasepool {\n            let prop = RLMProperty(name: \"before_stringCol\", type: .string, objectClassName: nil,\n                linkOriginPropertyName: nil, indexed: false, optional: false)\n            try autoreleasepool {\n                let realm = realmWithSingleClassProperties(defaultRealmURL(), className: \"SwiftStringObject\",\n                    properties: [prop])\n                try realm.transaction {\n                    realm.createObject(\"SwiftStringObject\", withValue: [\"a\"])\n                }\n            }\n\n            try testMigration { migration, _ in\n                XCTAssertEqual(migration.oldSchema.objectSchema[0].properties.count, 1)\n                migration.renameProperty(onType: \"SwiftStringObject\", from: \"before_stringCol\",\n                                         to: \"stringCol\")\n            } validation: { realm, schema in\n                XCTAssertEqual(schema.schema(forClassName: \"SwiftStringObject\")!.properties.count, 1)\n                XCTAssertEqual(1, realm.objects(SwiftStringObject.self).count)\n                XCTAssertEqual(\"a\", realm.objects(SwiftStringObject.self).first!.stringCol)\n            }\n        }\n    }\n\n    // test getting/setting all property types\n    func testMigrationObject() throws {\n        try autoreleasepool {\n            let realm = try Realm()\n            let nulledMapObj = SwiftBoolObject(value: [false])\n            try realm.write {\n                let object = SwiftObject()\n                object.anyCol.value = .string(\"hello!\")\n                object.boolCol = true\n                object.objectCol = SwiftBoolObject(value: [true])\n                object.arrayCol.append(SwiftBoolObject(value: [false]))\n                object.setCol.insert(SwiftBoolObject(value: [false]))\n                object.mapCol[\"key\"] = SwiftBoolObject(value: [false])\n                object.mapCol[\"nulledObj\"] = nulledMapObj\n\n                realm.add(object)\n                realm.delete(nulledMapObj)\n            }\n        }\n\n        nonisolated(unsafe) let unsafeSelf = self\n        try testMigration { migration, _ in\n            var enumerated = false\n            migration.enumerateObjects(ofType: \"SwiftObject\", { oldObj, newObj in\n                guard let oldObj = oldObj, let newObj = newObj else {\n                    XCTFail(\"did not get objects in enumerate\")\n                    return\n                }\n                XCTAssertEqual((oldObj[\"boolCol\"] as! Bool), true)\n                XCTAssertEqual((newObj[\"boolCol\"] as! Bool), true)\n                XCTAssertEqual((oldObj[\"intCol\"] as! Int), 123)\n                XCTAssertEqual((newObj[\"intCol\"] as! Int), 123)\n                XCTAssertEqual((oldObj[\"int8Col\"] as! Int8), 123)\n                XCTAssertEqual((newObj[\"int8Col\"] as! Int8), 123)\n                XCTAssertEqual((oldObj[\"int16Col\"] as! Int16), 123)\n                XCTAssertEqual((newObj[\"int16Col\"] as! Int16), 123)\n                XCTAssertEqual((oldObj[\"int32Col\"] as! Int32), 123)\n                XCTAssertEqual((newObj[\"int32Col\"] as! Int32), 123)\n                XCTAssertEqual((oldObj[\"int64Col\"] as! Int64), 123)\n                XCTAssertEqual((newObj[\"int64Col\"] as! Int64), 123)\n                XCTAssertEqual((oldObj[\"intEnumCol\"] as! Int), 1)\n                XCTAssertEqual((newObj[\"intEnumCol\"] as! Int), 1)\n                XCTAssertEqual((oldObj[\"floatCol\"] as! Float), 1.23 as Float)\n                XCTAssertEqual((newObj[\"floatCol\"] as! Float), 1.23 as Float)\n                XCTAssertEqual((oldObj[\"doubleCol\"] as! Double), 12.3 as Double)\n                XCTAssertEqual((newObj[\"doubleCol\"] as! Double), 12.3 as Double)\n                XCTAssertEqual((oldObj[\"decimalCol\"] as! Decimal128), 123e4 as Decimal128)\n                XCTAssertEqual((newObj[\"decimalCol\"] as! Decimal128), 123e4 as Decimal128)\n\n                let binaryCol = Data(\"a\".utf8)\n                XCTAssertEqual((oldObj[\"binaryCol\"] as! Data), binaryCol)\n                XCTAssertEqual((newObj[\"binaryCol\"] as! Data), binaryCol)\n\n                let dateCol = Date(timeIntervalSince1970: 1)\n                XCTAssertEqual((oldObj[\"dateCol\"] as! Date), dateCol)\n                XCTAssertEqual((newObj[\"dateCol\"] as! Date), dateCol)\n\n                let objectIdCol = ObjectId(\"1234567890ab1234567890ab\")\n                XCTAssertEqual((oldObj[\"objectIdCol\"] as! ObjectId), objectIdCol)\n                XCTAssertEqual((newObj[\"objectIdCol\"] as! ObjectId), objectIdCol)\n\n                XCTAssertNil(oldObj[\"objectCol\"] as? SwiftBoolObject)\n                XCTAssertNil(newObj[\"objectCol\"] as? SwiftBoolObject)\n                XCTAssertEqual(((oldObj[\"objectCol\"] as! MigrationObject)[\"boolCol\"] as! Bool), true)\n                XCTAssertEqual(((newObj[\"objectCol\"] as! MigrationObject)[\"boolCol\"] as! Bool), true)\n\n                XCTAssertEqual((oldObj[\"arrayCol\"] as! List<MigrationObject>).count, 1)\n                XCTAssertEqual(((oldObj[\"arrayCol\"] as! List<MigrationObject>)[0][\"boolCol\"] as! Bool), false)\n                XCTAssertEqual((newObj[\"arrayCol\"] as! List<MigrationObject>).count, 1)\n                XCTAssertEqual(((newObj[\"arrayCol\"] as! List<MigrationObject>)[0][\"boolCol\"] as! Bool), false)\n\n                XCTAssertEqual((oldObj[\"setCol\"] as! MutableSet<MigrationObject>).count, 1)\n                XCTAssertEqual(((oldObj[\"setCol\"] as! MutableSet<MigrationObject>)[0][\"boolCol\"] as! Bool), false)\n                XCTAssertEqual((newObj[\"setCol\"] as! MutableSet<MigrationObject>).count, 1)\n                XCTAssertEqual(((newObj[\"setCol\"] as! MutableSet<MigrationObject>)[0][\"boolCol\"] as! Bool), false)\n\n                XCTAssertEqual((oldObj[\"mapCol\"] as! Map<String, MigrationObject?>).count, 2)\n                XCTAssertEqual(((oldObj[\"mapCol\"] as! Map<String, MigrationObject?>)[\"key\"]?![\"boolCol\"] as! Bool), false)\n                XCTAssertEqual((newObj[\"mapCol\"] as! Map<String, MigrationObject?>).count, 2)\n                XCTAssertEqual(((newObj[\"mapCol\"] as! Map<String, MigrationObject?>)[\"key\"]?![\"boolCol\"] as! Bool), false)\n\n                let uuidCol: UUID = UUID(uuidString: \"137decc8-b300-4954-a233-f89909f4fd89\")!\n                XCTAssertEqual((newObj[\"uuidCol\"] as! UUID), uuidCol)\n                XCTAssertEqual((oldObj[\"uuidCol\"] as! UUID), uuidCol)\n\n                let anyValue = AnyRealmValue.string(\"hello!\")\n                XCTAssertEqual(((newObj[\"anyCol\"] as! String)), anyValue.stringValue)\n                XCTAssertEqual(((oldObj[\"anyCol\"] as! String)), anyValue.stringValue)\n\n                // edit all values\n                newObj[\"boolCol\"] = false\n                newObj[\"intCol\"] = 1\n                newObj[\"int8Col\"] = Int8(1)\n                newObj[\"int16Col\"] = Int16(1)\n                newObj[\"int32Col\"] = Int32(1)\n                newObj[\"int64Col\"] = Int64(1)\n                newObj[\"intEnumCol\"] = IntEnum.value2.rawValue\n                newObj[\"floatCol\"] = 1.0\n                newObj[\"doubleCol\"] = 10.0\n                newObj[\"binaryCol\"] = Data(bytes: \"b\", count: 1)\n                newObj[\"dateCol\"] = Date(timeIntervalSince1970: 2)\n                newObj[\"decimalCol\"] = Decimal128(number: 567e8)\n                newObj[\"objectIdCol\"] = ObjectId(\"abcdef123456abcdef123456\")\n                newObj[\"anyCol\"] = 12345\n\n                let falseObj = SwiftBoolObject(value: [false])\n                newObj[\"objectCol\"] = falseObj\n\n                var list = newObj[\"arrayCol\"] as! List<MigrationObject>\n                list[0][\"boolCol\"] = true\n                list.append(newObj[\"objectCol\"] as! MigrationObject)\n\n                let trueObj = migration.create(SwiftBoolObject.className(), value: [true])\n                list.append(trueObj)\n\n                var set = newObj[\"setCol\"] as! MutableSet<MigrationObject>\n                set[0][\"boolCol\"] = true\n                set.insert(newObj[\"objectCol\"] as! MigrationObject)\n                set.insert(trueObj)\n\n                // verify list property\n                list = newObj[\"arrayCol\"] as! List<MigrationObject>\n                XCTAssertEqual(list.count, 3)\n                XCTAssertEqual((list[0][\"boolCol\"] as! Bool), true)\n                XCTAssertEqual((list[1][\"boolCol\"] as! Bool), false)\n                XCTAssertEqual((list[2][\"boolCol\"] as! Bool), true)\n\n                list = newObj.dynamicList(\"arrayCol\")\n                XCTAssertEqual(list.count, 3)\n                XCTAssertEqual((list[0][\"boolCol\"] as! Bool), true)\n                XCTAssertEqual((list[1][\"boolCol\"] as! Bool), false)\n                XCTAssertEqual((list[2][\"boolCol\"] as! Bool), true)\n\n                // verify set property\n                set = newObj[\"setCol\"] as! MutableSet<MigrationObject>\n                XCTAssertEqual(set.count, 3)\n                XCTAssertEqual((set[0][\"boolCol\"] as! Bool), true)\n                XCTAssertEqual((set[1][\"boolCol\"] as! Bool), false)\n                XCTAssertEqual((set[2][\"boolCol\"] as! Bool), true)\n\n                set = newObj.dynamicMutableSet(\"setCol\")\n                XCTAssertEqual(set.count, 3)\n                XCTAssertEqual((set[0][\"boolCol\"] as! Bool), true)\n                XCTAssertEqual((set[1][\"boolCol\"] as! Bool), false)\n                XCTAssertEqual((set[2][\"boolCol\"] as! Bool), true)\n\n                // verify map property\n                var map = newObj[\"mapCol\"] as! Map<String, MigrationObject?>\n                XCTAssertEqual(map[\"key\"]?![\"boolCol\"] as! Bool, false)\n                XCTAssertEqual(map.count, 2)\n\n                map[\"key\"]?![\"boolCol\"] = true\n                map = newObj.dynamicMap(\"mapCol\")\n                XCTAssertEqual(map.count, 2)\n                XCTAssertEqual((map[\"key\"]?![\"boolCol\"] as! Bool), true)\n\n                unsafeSelf.assertThrows(newObj.value(forKey: \"noSuchKey\"))\n                unsafeSelf.assertThrows(newObj.setValue(1, forKey: \"noSuchKey\"))\n\n                // set it again\n                newObj[\"arrayCol\"] = [falseObj, trueObj]\n                XCTAssertEqual(list.count, 2)\n\n                newObj[\"arrayCol\"] = [SwiftBoolObject(value: [false])]\n                XCTAssertEqual(list.count, 1)\n                XCTAssertEqual((list[0][\"boolCol\"] as! Bool), false)\n\n                newObj[\"setCol\"] = [falseObj, trueObj]\n                XCTAssertEqual(set.count, 2)\n\n                newObj[\"setCol\"] = [SwiftBoolObject(value: [false])]\n                XCTAssertEqual(set.count, 1)\n                XCTAssertEqual((set[0][\"boolCol\"] as! Bool), false)\n\n                // test null in Map\n                XCTAssertEqual(map.count, 2)\n                XCTAssertEqual(map[\"nulledObj\"], Optional<MigrationObject?>.some(nil))\n\n                newObj[\"mapCol\"] = [\"key\": SwiftBoolObject(value: [false])]\n                XCTAssertEqual(map.count, 1)\n                XCTAssertEqual((map[\"key\"]?![\"boolCol\"] as! Bool), false)\n\n                let expected = \"\"\"\n                SwiftObject \\\\{\n                    boolCol = 0;\n                    intCol = 1;\n                    int8Col = 1;\n                    int16Col = 1;\n                    int32Col = 1;\n                    int64Col = 1;\n                    intEnumCol = 3;\n                    floatCol = 1;\n                    doubleCol = 10;\n                    stringCol = a;\n                    binaryCol = <.*62.*>;\n                    dateCol = 1970-01-01 00:00:02 \\\\+0000;\n                    decimalCol = 56700000000;\n                    objectIdCol = abcdef123456abcdef123456;\n                    objectCol = SwiftBoolObject \\\\{\n                        boolCol = 0;\n                    \\\\};\n                    uuidCol = 137DECC8-B300-4954-A233-F89909F4FD89;\n                    anyCol = 12345;\n                    arrayCol = List<SwiftBoolObject> <0x[0-9a-f]+> \\\\(\n                        \\\\[0\\\\] SwiftBoolObject \\\\{\n                            boolCol = 0;\n                        \\\\}\n                    \\\\);\n                    setCol = MutableSet<SwiftBoolObject> <0x[0-9a-f]+> \\\\(\n                        \\\\[0\\\\] SwiftBoolObject \\\\{\n                            boolCol = 0;\n                        \\\\}\n                    \\\\);\n                    mapCol = Map<string, SwiftBoolObject> <0x[0-9a-f]+> \\\\(\n                    \\\\[key\\\\]: SwiftBoolObject \\\\{\n                            boolCol = 0;\n                        \\\\}\n                    \\\\);\n                \\\\}\n                \"\"\"\n                unsafeSelf.assertMatches(newObj.description, expected.replacingOccurrences(of: \"    \", with: \"\\t\"))\n\n                enumerated = true\n            })\n            XCTAssertEqual(enumerated, true)\n\n            let newObj = migration.create(SwiftObject.className())\n            newObj[\"anyCol\"] = \"Some String\"\n            let expected = \"\"\"\n            SwiftObject \\\\{\n                boolCol = 0;\n                intCol = 123;\n                int8Col = 123;\n                int16Col = 123;\n                int32Col = 123;\n                int64Col = 123;\n                intEnumCol = 1;\n                floatCol = 1.23;\n                doubleCol = 12.3;\n                stringCol = a;\n                binaryCol = <.*61.*>;\n                dateCol = 1970-01-01 00:00:01 \\\\+0000;\n                decimalCol = 1.23E6;\n                objectIdCol = 1234567890ab1234567890ab;\n                objectCol = SwiftBoolObject \\\\{\n                    boolCol = 0;\n                \\\\};\n                uuidCol = 137DECC8-B300-4954-A233-F89909F4FD89;\n                anyCol = Some String;\n                arrayCol = List<SwiftBoolObject> <0x[0-9a-f]+> \\\\(\n                \\\\\n                \\\\);\n                setCol = MutableSet<SwiftBoolObject> <0x[0-9a-f]+> \\\\(\n                \\\\\n                \\\\);\n                mapCol = Map<string, SwiftBoolObject> <0x[0-9a-f]+> \\\\(\n                \\\\\n                \\\\);\n            \\\\}\n            \"\"\"\n            unsafeSelf.assertMatches(newObj.description, expected.replacingOccurrences(of: \"    \", with: \"\\t\"))\n        } validation: { realm, _ in\n            let object = realm.objects(SwiftObject.self).first!\n            XCTAssertEqual(object.boolCol, false)\n            XCTAssertEqual(object.intCol, 1)\n            XCTAssertEqual(object.int8Col, Int8(1))\n            XCTAssertEqual(object.int16Col, Int16(1))\n            XCTAssertEqual(object.int32Col, Int32(1))\n            XCTAssertEqual(object.int64Col, Int64(1))\n            XCTAssertEqual(object.floatCol, 1.0 as Float)\n            XCTAssertEqual(object.doubleCol, 10.0)\n            XCTAssertEqual(object.binaryCol, Data(bytes: \"b\", count: 1))\n            XCTAssertEqual(object.dateCol, Date(timeIntervalSince1970: 2))\n            XCTAssertEqual(object.objectCol!.boolCol, false)\n            XCTAssertEqual(object.arrayCol.count, 1)\n            XCTAssertEqual(object.arrayCol[0].boolCol, false)\n            XCTAssertEqual(object.setCol.count, 1)\n            XCTAssertEqual(object.setCol[0].boolCol, false)\n            XCTAssertEqual(object.mapCol.count, 1)\n            XCTAssertEqual(object.mapCol[\"key\"]!?.boolCol, false)\n\n            // make sure we added new bool objects as object property and in the list\n            XCTAssertEqual(realm.objects(SwiftBoolObject.self).count, 10)\n        }\n    }\n\n    func testCollectionAccess() throws {\n        try autoreleasepool {\n            let realm = try Realm()\n            try realm.write {\n                realm.add(ModernAllTypesObject())\n            }\n        }\n        try testMigration { migration, _ in\n            var enumerated = false\n            migration.enumerateObjects(ofType: \"ModernAllTypesObject\") { oldObj, _ in\n                guard let oldObj = oldObj else {\n                    return XCTFail(\"did not get objects in enumerate\")\n                }\n\n                XCTAssertEqual((oldObj[\"arrayCol\"] as! List<MigrationObject>).count, 0)\n                XCTAssertEqual((oldObj[\"setCol\"] as! MutableSet<MigrationObject>).count, 0)\n                XCTAssertEqual((oldObj[\"mapCol\"] as! Map<String, MigrationObject?>).count, 0)\n\n                XCTAssertEqual((oldObj[\"arrayBool\"] as! List<Bool>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayInt\"] as! List<Int>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayInt8\"] as! List<Int>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayInt16\"] as! List<Int>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayInt32\"] as! List<Int>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayInt64\"] as! List<Int>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayFloat\"] as! List<Float>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayDouble\"] as! List<Double>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayString\"] as! List<String>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayBinary\"] as! List<Data>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayDate\"] as! List<Date>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayDecimal\"] as! List<Decimal128>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayObjectId\"] as! List<ObjectId>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayAny\"] as! List<AnyRealmValue>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayUuid\"] as! List<UUID>).count, 0)\n\n                XCTAssertEqual((oldObj[\"arrayOptBool\"] as! List<Bool?>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayOptInt\"] as! List<Int?>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayOptInt8\"] as! List<Int?>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayOptInt16\"] as! List<Int?>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayOptInt32\"] as! List<Int?>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayOptInt64\"] as! List<Int?>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayOptFloat\"] as! List<Float?>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayOptDouble\"] as! List<Double?>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayOptString\"] as! List<String?>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayOptBinary\"] as! List<Data?>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayOptDate\"] as! List<Date?>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayOptDecimal\"] as! List<Decimal128?>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayOptObjectId\"] as! List<ObjectId?>).count, 0)\n                XCTAssertEqual((oldObj[\"arrayOptUuid\"] as! List<UUID?>).count, 0)\n\n                XCTAssertEqual((oldObj[\"setBool\"] as! MutableSet<Bool>).count, 0)\n                XCTAssertEqual((oldObj[\"setInt\"] as! MutableSet<Int>).count, 0)\n                XCTAssertEqual((oldObj[\"setInt8\"] as! MutableSet<Int>).count, 0)\n                XCTAssertEqual((oldObj[\"setInt16\"] as! MutableSet<Int>).count, 0)\n                XCTAssertEqual((oldObj[\"setInt32\"] as! MutableSet<Int>).count, 0)\n                XCTAssertEqual((oldObj[\"setInt64\"] as! MutableSet<Int>).count, 0)\n                XCTAssertEqual((oldObj[\"setFloat\"] as! MutableSet<Float>).count, 0)\n                XCTAssertEqual((oldObj[\"setDouble\"] as! MutableSet<Double>).count, 0)\n                XCTAssertEqual((oldObj[\"setString\"] as! MutableSet<String>).count, 0)\n                XCTAssertEqual((oldObj[\"setBinary\"] as! MutableSet<Data>).count, 0)\n                XCTAssertEqual((oldObj[\"setDate\"] as! MutableSet<Date>).count, 0)\n                XCTAssertEqual((oldObj[\"setDecimal\"] as! MutableSet<Decimal128>).count, 0)\n                XCTAssertEqual((oldObj[\"setObjectId\"] as! MutableSet<ObjectId>).count, 0)\n                XCTAssertEqual((oldObj[\"setAny\"] as! MutableSet<AnyRealmValue>).count, 0)\n                XCTAssertEqual((oldObj[\"setUuid\"] as! MutableSet<UUID>).count, 0)\n\n                XCTAssertEqual((oldObj[\"setOptBool\"] as! MutableSet<Bool?>).count, 0)\n                XCTAssertEqual((oldObj[\"setOptInt\"] as! MutableSet<Int?>).count, 0)\n                XCTAssertEqual((oldObj[\"setOptInt8\"] as! MutableSet<Int?>).count, 0)\n                XCTAssertEqual((oldObj[\"setOptInt16\"] as! MutableSet<Int?>).count, 0)\n                XCTAssertEqual((oldObj[\"setOptInt32\"] as! MutableSet<Int?>).count, 0)\n                XCTAssertEqual((oldObj[\"setOptInt64\"] as! MutableSet<Int?>).count, 0)\n                XCTAssertEqual((oldObj[\"setOptFloat\"] as! MutableSet<Float?>).count, 0)\n                XCTAssertEqual((oldObj[\"setOptDouble\"] as! MutableSet<Double?>).count, 0)\n                XCTAssertEqual((oldObj[\"setOptString\"] as! MutableSet<String?>).count, 0)\n                XCTAssertEqual((oldObj[\"setOptBinary\"] as! MutableSet<Data?>).count, 0)\n                XCTAssertEqual((oldObj[\"setOptDate\"] as! MutableSet<Date?>).count, 0)\n                XCTAssertEqual((oldObj[\"setOptDecimal\"] as! MutableSet<Decimal128?>).count, 0)\n                XCTAssertEqual((oldObj[\"setOptObjectId\"] as! MutableSet<ObjectId?>).count, 0)\n                XCTAssertEqual((oldObj[\"setOptUuid\"] as! MutableSet<UUID?>).count, 0)\n\n                XCTAssertEqual((oldObj[\"mapBool\"] as! Map<String, Bool>).count, 0)\n                XCTAssertEqual((oldObj[\"mapInt\"] as! Map<String, Int>).count, 0)\n                XCTAssertEqual((oldObj[\"mapInt8\"] as! Map<String, Int>).count, 0)\n                XCTAssertEqual((oldObj[\"mapInt16\"] as! Map<String, Int>).count, 0)\n                XCTAssertEqual((oldObj[\"mapInt32\"] as! Map<String, Int>).count, 0)\n                XCTAssertEqual((oldObj[\"mapInt64\"] as! Map<String, Int>).count, 0)\n                XCTAssertEqual((oldObj[\"mapFloat\"] as! Map<String, Float>).count, 0)\n                XCTAssertEqual((oldObj[\"mapDouble\"] as! Map<String, Double>).count, 0)\n                XCTAssertEqual((oldObj[\"mapString\"] as! Map<String, String>).count, 0)\n                XCTAssertEqual((oldObj[\"mapBinary\"] as! Map<String, Data>).count, 0)\n                XCTAssertEqual((oldObj[\"mapDate\"] as! Map<String, Date>).count, 0)\n                XCTAssertEqual((oldObj[\"mapDecimal\"] as! Map<String, Decimal128>).count, 0)\n                XCTAssertEqual((oldObj[\"mapObjectId\"] as! Map<String, ObjectId>).count, 0)\n                XCTAssertEqual((oldObj[\"mapAny\"] as! Map<String, AnyRealmValue>).count, 0)\n                XCTAssertEqual((oldObj[\"mapUuid\"] as! Map<String, UUID>).count, 0)\n\n                XCTAssertEqual((oldObj[\"mapOptBool\"] as! Map<String, Bool?>).count, 0)\n                XCTAssertEqual((oldObj[\"mapOptInt\"] as! Map<String, Int?>).count, 0)\n                XCTAssertEqual((oldObj[\"mapOptInt8\"] as! Map<String, Int?>).count, 0)\n                XCTAssertEqual((oldObj[\"mapOptInt16\"] as! Map<String, Int?>).count, 0)\n                XCTAssertEqual((oldObj[\"mapOptInt32\"] as! Map<String, Int?>).count, 0)\n                XCTAssertEqual((oldObj[\"mapOptInt64\"] as! Map<String, Int?>).count, 0)\n                XCTAssertEqual((oldObj[\"mapOptFloat\"] as! Map<String, Float?>).count, 0)\n                XCTAssertEqual((oldObj[\"mapOptDouble\"] as! Map<String, Double?>).count, 0)\n                XCTAssertEqual((oldObj[\"mapOptString\"] as! Map<String, String?>).count, 0)\n                XCTAssertEqual((oldObj[\"mapOptBinary\"] as! Map<String, Data?>).count, 0)\n                XCTAssertEqual((oldObj[\"mapOptDate\"] as! Map<String, Date?>).count, 0)\n                XCTAssertEqual((oldObj[\"mapOptDecimal\"] as! Map<String, Decimal128?>).count, 0)\n                XCTAssertEqual((oldObj[\"mapOptObjectId\"] as! Map<String, ObjectId?>).count, 0)\n                XCTAssertEqual((oldObj[\"mapOptUuid\"] as! Map<String, UUID?>).count, 0)\n\n                enumerated = true\n            }\n            XCTAssertTrue(enumerated)\n        }\n    }\n\n    func testMigrationObjectSchema() throws {\n        let properties: [Property] = autoreleasepool {\n            let realm = try! Realm()\n            return try! realm.write {\n                let obj = SwiftObject()\n                realm.add(obj)\n                return obj.objectSchema.properties\n            }\n        }\n\n        try testMigration { migration, _ in\n            XCTAssertEqual(migration.oldSchema[\"SwiftObject\"]!.properties, properties)\n            XCTAssertEqual(migration.newSchema[\"SwiftObject\"]!.properties, properties)\n            var enumerated = false\n            migration.enumerateObjects(ofType: \"SwiftObject\") { oldObj, newObj in\n                guard let oldObj = oldObj, let newObj = newObj else {\n                    XCTFail(\"did not get objects in enumerate\")\n                    return\n                }\n                enumerated = true\n                XCTAssertEqual(oldObj.objectSchema.properties, properties)\n                XCTAssertEqual(newObj.objectSchema.properties, properties)\n            }\n            XCTAssertTrue(enumerated)\n        }\n    }\n\n    func testFailOnSchemaMismatch() {\n        let prop = RLMProperty(name: \"name\", type: RLMPropertyType.string, objectClassName: nil,\n                               linkOriginPropertyName: nil, indexed: false, optional: false)\n        _ = autoreleasepool {\n            realmWithSingleClassProperties(defaultRealmURL(), className: \"SwiftEmployeeObject\", properties: [prop])\n        }\n\n        let config = Realm.Configuration(fileURL: defaultRealmURL(),\n                                         objectTypes: [SwiftEmployeeObject.self])\n        assertFails(.schemaMismatch) {\n            try Realm(configuration: config)\n        }\n    }\n\n    func testDeleteRealmIfMigrationNeededWithSetCustomSchema() {\n        let prop = RLMProperty(name: \"name\", type: RLMPropertyType.string, objectClassName: nil,\n                               linkOriginPropertyName: nil, indexed: false, optional: false)\n        _ = autoreleasepool {\n            realmWithSingleClassProperties(defaultRealmURL(), className: \"SwiftEmployeeObject\", properties: [prop])\n        }\n\n        var config = Realm.Configuration(fileURL: defaultRealmURL(), objectTypes: [SwiftEmployeeObject.self])\n        config.migrationBlock = { _, _ in\n            XCTFail(\"Migration block should not be called\")\n        }\n        config.deleteRealmIfMigrationNeeded = true\n\n        assertSucceeds {\n            _ = try Realm(configuration: config)\n        }\n    }\n\n    func testDeleteRealmIfMigrationNeeded() throws {\n        try autoreleasepool { _ = try Realm(fileURL: defaultRealmURL()) }\n\n        let objectSchema = RLMObjectSchema(forObjectClass: SwiftEmployeeObject.self)\n        objectSchema.properties = Array(objectSchema.properties[0..<1])\n\n        let metaClass: AnyClass = objc_getMetaClass(\"RLMSchema\") as! AnyClass\n        let imp = imp_implementationWithBlock(unsafeBitCast({ () -> RLMSchema in\n            let schema = RLMSchema()\n            schema.objectSchema = [objectSchema]\n            return schema\n        } as @convention(block)() -> (RLMSchema), to: AnyObject.self))\n\n        let originalImp = class_getMethodImplementation(metaClass, #selector(RLMObjectBase.sharedSchema))\n        class_replaceMethod(metaClass, #selector(RLMObjectBase.sharedSchema), imp, \"@@:\")\n\n        assertFails(.schemaMismatch) {\n            try Realm()\n        }\n\n        let migrationBlock: MigrationBlock = { _, _ in\n            XCTFail(\"Migration block should not be called\")\n        }\n        let config = Realm.Configuration(fileURL: defaultRealmURL(),\n                                         migrationBlock: migrationBlock,\n                                         deleteRealmIfMigrationNeeded: true)\n\n        assertSucceeds {\n            _ = try Realm(configuration: config)\n        }\n\n        class_replaceMethod(metaClass, #selector(RLMObjectBase.sharedSchema), originalImp!, \"@@:\")\n    }\n\n    func testObjectWithCustomColumnNames() throws {\n        try autoreleasepool {\n            let realm = try Realm()\n            try realm.write {\n                let object = ModernCustomObject()\n                object.intCol = 123\n                object.anyCol = .int(456)\n                object.intEnumCol = .value3\n                let linkedObject = ModernCustomObject()\n                linkedObject.intCol = 789\n                object.objectCol = linkedObject\n                object.arrayCol.append(linkedObject)\n                object.setCol.insert(linkedObject)\n                object.mapCol[\"key\"] = linkedObject\n                let embeddedObject = EmbeddedModernCustomObject()\n                embeddedObject.intCol = 102\n                object.embeddedObject = embeddedObject\n                realm.add(object)\n            }\n            XCTAssertEqual(realm.objects(ModernCustomObject.self).count, 2)\n        }\n\n        try testMigration { migration, _ in\n            var checkOnce = false\n            migration.enumerateObjects(ofType: \"ModernCustomObject\") { oldObj, newObj in\n                guard !checkOnce else { return }\n                guard let oldObj = oldObj, let newObj = newObj else {\n                    return XCTFail(\"did not get objects in enumerate\")\n                }\n\n                XCTAssertEqual((oldObj[\"custom_intCol\"] as! Int), 123)\n                XCTAssertEqual((newObj[\"intCol\"] as! Int), 123)\n\n                let anyValue = AnyRealmValue.int(456)\n                XCTAssertEqual(((oldObj[\"custom_anyCol\"] as! Int)), anyValue.intValue)\n                XCTAssertEqual(((newObj[\"anyCol\"] as! Int)), anyValue.intValue)\n\n                XCTAssertEqual(((oldObj[\"custom_intEnumCol\"] as! Int)), ModernIntEnum.value3.rawValue)\n                XCTAssertEqual(((newObj[\"intEnumCol\"] as! Int)), ModernIntEnum.value3.rawValue)\n\n                XCTAssertEqual(((oldObj[\"custom_objectCol\"] as! MigrationObject)[\"custom_intCol\"] as! Int), 789)\n                XCTAssertEqual(((newObj[\"objectCol\"] as! MigrationObject)[\"intCol\"] as! Int), 789)\n\n                XCTAssertEqual((oldObj[\"custom_arrayCol\"] as! List<MigrationObject>).count, 1)\n                XCTAssertEqual(((oldObj[\"custom_arrayCol\"] as! List<MigrationObject>)[0][\"custom_intCol\"] as! Int), 789)\n                XCTAssertEqual((newObj[\"arrayCol\"] as! List<MigrationObject>).count, 1)\n                XCTAssertEqual(((newObj[\"arrayCol\"] as! List<MigrationObject>)[0][\"intCol\"] as! Int), 789)\n\n                XCTAssertEqual((oldObj[\"custom_setCol\"] as! MutableSet<MigrationObject>).count, 1)\n                XCTAssertEqual(((oldObj[\"custom_setCol\"] as! MutableSet<MigrationObject>)[0][\"custom_intCol\"] as! Int), 789)\n                XCTAssertEqual((newObj[\"setCol\"] as! MutableSet<MigrationObject>).count, 1)\n                XCTAssertEqual(((newObj[\"setCol\"] as! MutableSet<MigrationObject>)[0][\"intCol\"] as! Int), 789)\n\n                XCTAssertEqual((oldObj[\"custom_mapCol\"] as! Map<String, MigrationObject?>).count, 1)\n                XCTAssertEqual(((oldObj[\"custom_mapCol\"] as! Map<String, MigrationObject?>)[\"key\"]?![\"custom_intCol\"] as! Int), 789)\n                XCTAssertEqual((newObj[\"mapCol\"] as! Map<String, MigrationObject?>).count, 1)\n                XCTAssertEqual(((newObj[\"mapCol\"] as! Map<String, MigrationObject?>)[\"key\"]?![\"intCol\"] as! Int), 789)\n\n                XCTAssertEqual(((oldObj[\"custom_embeddedObject\"] as! MigrationObject)[\"custom_intCol\"] as! Int), 102)\n                XCTAssertEqual(((newObj[\"embeddedObject\"] as! MigrationObject)[\"intCol\"] as! Int), 102)\n                checkOnce = true\n            }\n        } validation: { realm, _ in\n            let object = realm.objects(ModernCustomObject.self).first!\n            XCTAssertEqual(object.intCol, 123)\n            XCTAssertEqual(object.anyCol, .int(456))\n            XCTAssertEqual(object.intEnumCol, .value3)\n            XCTAssertEqual(object.objectCol!.intCol, 789)\n            XCTAssertEqual(object.arrayCol.count, 1)\n            XCTAssertEqual(object.arrayCol[0].intCol, 789)\n            XCTAssertEqual(object.setCol.count, 1)\n            XCTAssertEqual(object.setCol[0].intCol, 789)\n            XCTAssertEqual(object.mapCol.count, 1)\n            XCTAssertEqual(object.mapCol[\"key\"]!?.intCol, 789)\n            XCTAssertEqual(object.embeddedObject?.intCol, 102)\n            XCTAssertEqual(realm.objects(ModernCustomObject.self).count, 2)\n        }\n    }\n\n    func testCustomColumnDataAfterMigrationRealm() throws {\n        try autoreleasepool {\n            let realm = try Realm()\n            try realm.write {\n                let object = ModernCustomObject()\n                object.intCol = 123\n                object.anyCol = .int(456)\n                object.intEnumCol = .value3\n                let linkedObject = ModernCustomObject()\n                linkedObject.intCol = 789\n                object.objectCol = linkedObject\n                object.setCol.insert(linkedObject)\n                object.mapCol[\"key\"] = linkedObject\n                let embeddedObject = EmbeddedModernCustomObject()\n                embeddedObject.intCol = 102\n                object.embeddedObject = embeddedObject\n                realm.add(object)\n            }\n        }\n\n        let config = Realm.Configuration(fileURL: defaultRealmURL(),\n                                         schemaVersion: 1)\n        let realm = try Realm(configuration: config)\n        XCTAssertEqual(realm.objects(ModernCustomObject.self).count, 2)\n    }\n\n    func testCustomColumnRenamePropertyToCustom() throws {\n        let prop = RLMProperty(name: \"before_intCol\", type: .int, objectClassName: nil,\n                               linkOriginPropertyName: nil, indexed: false, optional: false)\n        prop.columnName = \"custom_before_intCol\"\n        try autoreleasepool {\n            let realm = realmWithSingleClassProperties(defaultRealmURL(), className: \"ModernCustomObject\",\n                                                       properties: [prop])\n            try realm.transaction {\n                realm.createObject(\"ModernCustomObject\", withValue: [123])\n            }\n        }\n\n        try testMigration { migration, _ in\n            XCTAssertEqual(migration.oldSchema.objectSchema[0].properties.count, 1)\n            migration.renameProperty(onType: \"ModernCustomObject\", from: \"custom_before_intCol\",\n                                     to: \"custom_intCol\")\n        } validation: { realm, schema in\n            XCTAssertEqual(schema.schema(forClassName: \"ModernCustomObject\")!.properties.count, 12)\n            XCTAssertEqual(1, realm.objects(ModernCustomObject.self).count)\n            let object = realm.objects(ModernCustomObject.self).first!\n            XCTAssertEqual(123, object.intCol)\n        }\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/MixedCollectionTest.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2024 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\nclass MixedCollectionTest: TestCase {\n    func testAnyMixedDictionary() throws {\n        let so = SwiftStringObject()\n        so.stringCol = \"hello\"\n        let d = Date()\n        let oid = ObjectId.generate()\n        let uuid = UUID()\n\n        func assertObject(_ o: AnyRealmTypeObject) {\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key1\"], .string(\"hello\"))\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key2\"], .bool(false))\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key3\"], .int(234))\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key4\"], .float(789.123))\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key5\"], .double(12345.678901))\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key6\"], .data(Data(\"a\".utf8)))\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key7\"], .date(d))\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key9\"], .objectId(oid))\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key10\"], .uuid(uuid))\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key11\"], .decimal128(Decimal128(number: 567)))\n\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key1\"]?.stringValue, \"hello\")\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key2\"]?.boolValue, false)\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key3\"]?.intValue, 234)\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key4\"]?.floatValue, 789.123)\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key5\"]?.doubleValue, 12345.678901)\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key6\"]?.dataValue, Data(\"a\".utf8))\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key7\"]?.dateValue, d)\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key8\"]?.object(SwiftStringObject.self)?.stringCol, so.stringCol)\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key9\"]?.objectIdValue, oid)\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key10\"]?.uuidValue, uuid)\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key11\"]?.decimal128Value, Decimal128(number: 567))\n        }\n\n        let dictionary: Dictionary<String, AnyRealmValue> = [\n            \"key1\": .string(\"hello\"),\n            \"key2\": .bool(false),\n            \"key3\": .int(234),\n            \"key4\": .float(789.123),\n            \"key5\": .double(12345.678901),\n            \"key6\": .data(Data(\"a\".utf8)),\n            \"key7\": .date(d),\n            \"key8\": .object(so),\n            \"key9\": .objectId(oid),\n            \"key10\": .uuid(uuid),\n            \"key11\": .decimal128(Decimal128(number: 567))\n        ]\n\n        let dictionary1: Dictionary<String, AnyRealmValue> = [\n            \"key\": .none\n        ]\n\n        let o = AnyRealmTypeObject()\n        // Unmanaged Set\n        o.anyValue.value = AnyRealmValue.fromDictionary(dictionary)\n        assertObject(o)\n        // Unmanaged update\n        o.anyValue.value = AnyRealmValue.fromDictionary(dictionary1)\n        XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key\"], AnyRealmValue.none)\n\n        // Add mixed collection to object\n        let realm = realmWithTestPath()\n        try realm.write {\n            realm.add(o)\n        }\n        XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key\"], AnyRealmValue.none)\n\n        // Update managed object\n        try realm.write {\n            o.anyValue.value = AnyRealmValue.fromDictionary(dictionary1)\n        }\n        XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key\"], AnyRealmValue.none)\n\n        // Create managed object\n        try realm.write {\n            let object = realm.create(AnyRealmTypeObject.self, value: [ \"anyValue\": dictionary ])\n            assertObject(object)\n        }\n\n        // Results\n        let result = realm.objects(AnyRealmTypeObject.self).last\n        XCTAssertNotNil(result)\n        assertObject(result!)\n    }\n\n    func testAnyMixedDictionaryUpdateAndDelete() throws {\n        let so = SwiftStringObject()\n        so.stringCol = \"hello\"\n\n        let dictionary: Dictionary<String, AnyRealmValue> = [\n            \"key1\": .string(\"hello\"),\n            \"key2\": .bool(false),\n            \"key3\": .int(234),\n        ]\n\n        let o = AnyRealmTypeObject()\n        // Unmanaged Set\n        o.anyValue.value = AnyRealmValue.fromDictionary(dictionary)\n        XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key1\"], .string(\"hello\"))\n\n        // Unmanaged Update\n        o.anyValue.value.dictionaryValue?[\"key1\"] = .object(so)\n        o.anyValue.value.dictionaryValue?[\"key2\"] = .data(Data(\"a\".utf8))\n        XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key1\"]?.object(SwiftStringObject.self)?.stringCol, so.stringCol)\n        XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key2\"], .data(Data(\"a\".utf8)))\n\n        // Add mixed collection to object\n        let realm = realmWithTestPath()\n        try realm.write {\n            realm.add(o)\n        }\n        XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key1\"]?.object(SwiftStringObject.self)?.stringCol, so.stringCol)\n        XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key2\"], .data(Data(\"a\".utf8)))\n\n        // Update managed object\n        try realm.write {\n            o.anyValue.value.dictionaryValue?[\"key1\"] = .double(12345.678901)\n            o.anyValue.value.dictionaryValue?[\"key2\"] = .float(789.123)\n        }\n        XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key1\"], .double(12345.678901))\n        XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key2\"], .float(789.123))\n\n        let result = realm.objects(AnyRealmTypeObject.self).last\n        XCTAssertNotNil(result)\n        // Delete\n        try realm.write {\n            result?.anyValue.value.dictionaryValue?[\"key1\"] = nil\n            result?.anyValue.value.dictionaryValue?[\"key2\"] = nil\n        }\n        XCTAssertNil(result?.anyValue.value.dictionaryValue?[\"key1\"])\n        XCTAssertNil(result?.anyValue.value.dictionaryValue?[\"key2\"])\n    }\n\n    func testAnyMixedNestedDictionary() throws {\n        let so = SwiftStringObject()\n        so.stringCol = \"hello\"\n\n        func assertDictionary1(_ o: AnyRealmTypeObject) {\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key0\"]?.dictionaryValue?[\"key1\"]?.dictionaryValue?[\"key2\"]?.dictionaryValue?[\"key3\"]?.object(SwiftStringObject.self)?.stringCol, \"hello\")\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key4\"]?.boolValue, false)\n        }\n\n        func assertDictionary2(_ o: AnyRealmTypeObject) {\n            XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key10\"]?.dictionaryValue?[\"key11\"]?.dictionaryValue?[\"key12\"]?.dictionaryValue?[\"key1\"]?.dictionaryValue?[\"key2\"]?.dictionaryValue?[\"key3\"]?.object(SwiftStringObject.self)?.stringCol, \"hello\")\n        }\n\n        let subDict2: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key3\": .object(so) ])\n        let subDict3: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key2\": subDict2 ])\n        let subDict4: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key1\": subDict3 ])\n        let dictionary1: Dictionary<String, AnyRealmValue> = [\n            \"key0\": subDict4,\n            \"key4\": .bool(false)\n        ]\n\n        let subDict5: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key12\": subDict4 ])\n        let subDict6: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key11\": subDict5 ])\n        let dictionary2: Dictionary<String, AnyRealmValue> = [\n            \"key10\": subDict6,\n        ]\n\n        let o = AnyRealmTypeObject()\n        // Unmanaged Set\n        o.anyValue.value = AnyRealmValue.fromDictionary(dictionary2)\n        // Unamanged Read\n        assertDictionary2(o)\n\n        // Unmanaged update\n        o.anyValue.value = AnyRealmValue.fromDictionary(dictionary1)\n        // Update assert\n        assertDictionary1(o)\n\n        // Add mixed collection to object\n        let realm = realmWithTestPath()\n        try realm.write {\n            realm.add(o)\n        }\n        // Add assert\n        assertDictionary1(o)\n\n        // Update managed object\n        try realm.write {\n            o.anyValue.value = AnyRealmValue.fromDictionary(dictionary2)\n        }\n        // Update assert\n        assertDictionary2(o)\n\n        try realm.write {\n            let d = [ \"key0\": [ \"key1\": [ \"key2\": [ \"key3\": AnyRealmValue.object(so)]]],\n                      \"key4\": AnyRealmValue.bool(false)]\n            let object = realm.create(AnyRealmTypeObject.self, value: [ \"anyValue\": d])\n            assertDictionary1(object)\n        }\n\n        // Results\n        let result = realm.objects(AnyRealmTypeObject.self).last\n\n        // Results assert\n        XCTAssertNotNil(result)\n        assertDictionary1(result!)\n    }\n\n    func testAnyMixedList() throws {\n        let so = SwiftStringObject()\n        so.stringCol = \"hello\"\n        let d = Date()\n        let oid = ObjectId.generate()\n        let uuid = UUID()\n\n        func assertObject(_ o: AnyRealmTypeObject) {\n            XCTAssertEqual(o.anyValue.value.listValue?[0], .string(\"hello\"))\n            XCTAssertEqual(o.anyValue.value.listValue?[1], .bool(false))\n            XCTAssertEqual(o.anyValue.value.listValue?[2], .int(234))\n            XCTAssertEqual(o.anyValue.value.listValue?[3], .float(789.123))\n            XCTAssertEqual(o.anyValue.value.listValue?[4], .double(12345.678901))\n            XCTAssertEqual(o.anyValue.value.listValue?[5], .data(Data(\"a\".utf8)))\n            XCTAssertEqual(o.anyValue.value.listValue?[6], .date(d))\n            XCTAssertEqual(o.anyValue.value.listValue?[8], .objectId(oid))\n            XCTAssertEqual(o.anyValue.value.listValue?[9], .uuid(uuid))\n            XCTAssertEqual(o.anyValue.value.listValue?[10], .decimal128(Decimal128(number: 567)))\n\n            XCTAssertEqual(o.anyValue.value.listValue?[0].stringValue, \"hello\")\n            XCTAssertEqual(o.anyValue.value.listValue?[1].boolValue, false)\n            XCTAssertEqual(o.anyValue.value.listValue?[2].intValue, 234)\n            XCTAssertEqual(o.anyValue.value.listValue?[3].floatValue, 789.123)\n            XCTAssertEqual(o.anyValue.value.listValue?[4].doubleValue, 12345.678901)\n            XCTAssertEqual(o.anyValue.value.listValue?[5].dataValue, Data(\"a\".utf8))\n            XCTAssertEqual(o.anyValue.value.listValue?[6].dateValue, d)\n            XCTAssertEqual(o.anyValue.value.listValue?[7].object(SwiftStringObject.self)?.stringCol, so.stringCol)\n            XCTAssertEqual(o.anyValue.value.listValue?[8].objectIdValue, oid)\n            XCTAssertEqual(o.anyValue.value.listValue?[9].uuidValue, uuid)\n            XCTAssertEqual(o.anyValue.value.listValue?[10].decimal128Value, Decimal128(number: 567))\n        }\n\n        let list: Array<AnyRealmValue> = [\n            .string(\"hello\"),\n            .bool(false),\n            .int(234),\n            .float(789.123),\n            .double(12345.678901),\n            .data(Data(\"a\".utf8)),\n            .date(d),\n            .object(so),\n            .objectId(oid),\n            .uuid(uuid),\n            .decimal128(Decimal128(number: 567))\n        ]\n\n        let list1: Array<AnyRealmValue> = [\n            .none\n        ]\n\n        let o = AnyRealmTypeObject()\n        // Unmanaged Set\n        let l = AnyRealmValue.fromArray(list)\n        o.anyValue.value = l\n        assertObject(o)\n        // Unmanaged update\n        o.anyValue.value = AnyRealmValue.fromArray(list1)\n        XCTAssertEqual(o.anyValue.value.listValue?[0], AnyRealmValue.none)\n\n        // Add mixed collection to object\n        let realm = realmWithTestPath()\n        try realm.write {\n            realm.add(o)\n        }\n        XCTAssertEqual(o.anyValue.value.listValue?[0], AnyRealmValue.none)\n\n        // Update managed object\n        try realm.write {\n            o.anyValue.value = AnyRealmValue.fromArray(list1)\n        }\n        XCTAssertEqual(o.anyValue.value.listValue?[0], AnyRealmValue.none)\n\n        try realm.write {\n            let object = realm.create(AnyRealmTypeObject.self, value: [ \"anyValue\": list ])\n            assertObject(object)\n        }\n\n        // Results\n        let result = realm.objects(AnyRealmTypeObject.self).last\n        XCTAssertNotNil(result)\n        assertObject(result!)\n    }\n\n    func testAnyMixedListUpdateAndDelete() throws {\n        let so = SwiftStringObject()\n        so.stringCol = \"hello\"\n\n        let list: Array<AnyRealmValue> = [\n            .string(\"hello\"),\n            .bool(false),\n            .int(234),\n        ]\n\n        let o = AnyRealmTypeObject()\n        // Unmanaged Set\n        o.anyValue.value = AnyRealmValue.fromArray(list)\n        XCTAssertEqual(o.anyValue.value.listValue?[0], .string(\"hello\"))\n\n        // Unmanaged Update\n        o.anyValue.value.listValue?[0] = .object(so)\n        o.anyValue.value.listValue?[1] = .data(Data(\"a\".utf8))\n        XCTAssertEqual(o.anyValue.value.listValue?[0].object(SwiftStringObject.self)?.stringCol, so.stringCol)\n        XCTAssertEqual(o.anyValue.value.listValue?[1], .data(Data(\"a\".utf8)))\n\n        // Add mixed collection to object\n        let realm = realmWithTestPath()\n        try realm.write {\n            realm.add(o)\n        }\n        XCTAssertEqual(o.anyValue.value.listValue?[0].object(SwiftStringObject.self)?.stringCol, so.stringCol)\n        XCTAssertEqual(o.anyValue.value.listValue?[1], .data(Data(\"a\".utf8)))\n\n        // Update managed object\n        try realm.write {\n            o.anyValue.value.listValue?[0] = .double(12345.678901)\n            o.anyValue.value.listValue?[1] = .float(789.123)\n        }\n        XCTAssertEqual(o.anyValue.value.listValue?[0], .double(12345.678901))\n        XCTAssertEqual(o.anyValue.value.listValue?[1], .float(789.123))\n\n        let result = realm.objects(AnyRealmTypeObject.self).last\n        XCTAssertNotNil(result)\n        XCTAssertEqual(result?.anyValue.value.listValue?.count, 3)\n\n        // Delete\n        try realm.write {\n            result?.anyValue.value.listValue?.remove(at: 0)\n            result?.anyValue.value.listValue?.remove(at: 0)\n        }\n        XCTAssertNotEqual(result?.anyValue.value.listValue?[0], .double(12345.678901))\n        XCTAssertEqual(result?.anyValue.value.listValue?[0], .int(234))\n        XCTAssertEqual(result?.anyValue.value.listValue?.count, 1)\n    }\n\n    func testAnyMixedNestedArray() throws {\n        let so = SwiftStringObject()\n        so.stringCol = \"hello\"\n\n        func assertArray1(_ o: AnyRealmTypeObject) {\n            XCTAssertEqual(o.anyValue.value.listValue?[0].listValue?[0].listValue?[0].listValue?[0].object(SwiftStringObject.self)?.stringCol, \"hello\")\n            XCTAssertEqual(o.anyValue.value.listValue?[1].boolValue, false)\n        }\n\n        func assertArray2(_ o: AnyRealmTypeObject) {\n            XCTAssertEqual(o.anyValue.value.listValue?[0].listValue?[0].listValue?[0].listValue?[0].listValue?[0].listValue?[0].object(SwiftStringObject.self)?.stringCol, \"hello\")\n        }\n\n        let subArray2: AnyRealmValue = AnyRealmValue.fromArray([ .object(so) ])\n        let subArray3: AnyRealmValue = AnyRealmValue.fromArray([ subArray2 ])\n        let subArray4: AnyRealmValue = AnyRealmValue.fromArray([ subArray3 ])\n        let array1: Array<AnyRealmValue> = [\n            subArray4, .bool(false)\n        ]\n\n        let subArray5: AnyRealmValue = AnyRealmValue.fromArray([ subArray4 ])\n        let subArray6: AnyRealmValue = AnyRealmValue.fromArray([ subArray5 ])\n        let array2: Array<AnyRealmValue> = [\n            subArray6\n        ]\n\n        let o = AnyRealmTypeObject()\n        // Unmanaged Set\n        o.anyValue.value = AnyRealmValue.fromArray(array2)\n        // Unamanged Read\n        assertArray2(o)\n\n        // Unmanaged update\n        o.anyValue.value = AnyRealmValue.fromArray(array1)\n        // Update assert\n        assertArray1(o)\n\n        // Add mixed collection to object\n        let realm = realmWithTestPath()\n        try realm.write {\n            realm.add(o)\n        }\n        // Add assert\n        assertArray1(o)\n\n        // Update managed object\n        try realm.write {\n            o.anyValue.value = AnyRealmValue.fromArray(array2)\n        }\n        // Update assert\n        assertArray2(o)\n\n        try realm.write {\n            let d = [[[[ AnyRealmValue.object(so)]]], AnyRealmValue.bool(false)]\n            let object = realm.create(AnyRealmTypeObject.self, value: [ \"anyValue\": d])\n            assertArray1(object)\n        }\n\n        // Results\n        let result = realm.objects(AnyRealmTypeObject.self).last\n        XCTAssertNotNil(result)\n        assertArray1(result!)\n    }\n\n    func testMixedNestedCollection() throws {\n        let so = SwiftStringObject()\n        so.stringCol = \"hello\"\n\n        let subArray2: AnyRealmValue = AnyRealmValue.fromArray([ .object(so) ])\n        let subDict2: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key1\": subArray2 ])\n        let subArray3: AnyRealmValue = AnyRealmValue.fromArray([ subArray2, subDict2])\n        let subDict3: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key2\": subArray3 ])\n        let subArray4: AnyRealmValue = AnyRealmValue.fromArray([ subDict3 ])\n        let subDict4: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key3\": subArray4 ])\n        let subArray5: AnyRealmValue = AnyRealmValue.fromArray([ subDict4 ])\n        let subDict5: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key4\": subArray5 ])\n        let subArray6: AnyRealmValue = AnyRealmValue.fromArray([ subDict5 ])\n        let subDict6: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key5\": subArray6 ])\n        let dictionary: Dictionary<String, AnyRealmValue> = [\n            \"key0\": subDict6,\n        ]\n\n        func assertMixed(_ o: AnyRealmTypeObject) {\n            let baseNested: List<AnyRealmValue>? = o.anyValue.value.dictionaryValue?[\"key0\"]?.dictionaryValue?[\"key5\"]?.listValue?[0].dictionaryValue?[\"key4\"]?.listValue?[0].dictionaryValue?[\"key3\"]?.listValue\n            let nested1: String? = baseNested?[0].dictionaryValue?[\"key2\"]?.listValue?[0].listValue?[0].object(SwiftStringObject.self)?.stringCol\n            XCTAssertEqual(nested1, \"hello\")\n            let nested2: String? = baseNested?[0].dictionaryValue?[\"key2\"]?.listValue?[1].dictionaryValue?[\"key1\"]?.listValue?[0].object(SwiftStringObject.self)?.stringCol\n            XCTAssertEqual(nested2, \"hello\")\n        }\n\n        let o = AnyRealmTypeObject()\n        // Unmanaged Set\n        o.anyValue.value = AnyRealmValue.fromDictionary(dictionary)\n        // Unamanged Read\n        assertMixed(o)\n\n        // Unmanaged update\n        o.anyValue.value = AnyRealmValue.fromDictionary(dictionary)\n        // Update assert\n        assertMixed(o)\n\n        // Add mixed collection to object\n        let realm = realmWithTestPath()\n        try realm.write {\n            realm.add(o)\n        }\n        // Add assert\n        assertMixed(o)\n\n        // Update managed object\n        try realm.write {\n            o.anyValue.value = AnyRealmValue.fromDictionary(dictionary)\n        }\n        // Update assert\n        assertMixed(o)\n\n        try realm.write {\n            let d = [\"key0\": [\"key5\": [[\"key4\": [[\"key3\": [[\"key2\": [[AnyRealmValue.object(so)], [\"key1\": [AnyRealmValue.object(so)]]]]]]]]]]]\n            let object = realm.create(AnyRealmTypeObject.self, value: [ \"anyValue\": d])\n            assertMixed(object)\n        }\n\n        // Results\n        let result = realm.objects(AnyRealmTypeObject.self).last\n\n        // Results assert\n        XCTAssertNotNil(result)\n        assertMixed(result!)\n    }\n\n    func testMixedCollectionEquality() throws {\n        let so = SwiftStringObject()\n        so.stringCol = \"hello\"\n        let subArray2: AnyRealmValue = AnyRealmValue.fromArray([ .object(so) ])\n        let subDict2: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key1\": subArray2 ])\n        let subArray3: AnyRealmValue = AnyRealmValue.fromArray([ subArray2, subDict2])\n        let subDict3: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key2\": subArray3 ])\n        let subArray4: AnyRealmValue = AnyRealmValue.fromArray([ subDict3 ])\n        let subDict4: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key3\": subArray4 ])\n        let subArray5: AnyRealmValue = AnyRealmValue.fromArray([ subDict4 ])\n        let subDict5: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key4\": subArray5 ])\n        let subArray6: AnyRealmValue = AnyRealmValue.fromArray([ subDict5 ])\n        let subDict6: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key5\": subArray6 ])\n        let dictionary: Dictionary<String, AnyRealmValue> = [\n            \"key0\": subDict6,\n        ]\n\n        XCTAssertEqual(AnyRealmValue.fromDictionary([:]), AnyRealmValue.fromDictionary([:])) // Empty mixed lists should be equal\n        XCTAssertEqual(AnyRealmValue.fromDictionary(dictionary), AnyRealmValue.fromDictionary(dictionary)) // Unamanged mixed list should be equal\n\n        var dictionary2 = dictionary\n        dictionary2[\"newKey\"] = .bool(false)\n        XCTAssertNotEqual(AnyRealmValue.fromDictionary(dictionary), AnyRealmValue.fromDictionary(dictionary2))\n\n        let anyValue = AnyRealmValue.fromDictionary(dictionary)\n        let anyValue2 = AnyRealmValue.fromDictionary(dictionary)\n        anyValue2.dictionaryValue?[\"newKey\"] = .bool(false)\n        XCTAssertNotEqual(anyValue, anyValue2)\n\n        let mixedObject = AnyRealmTypeObject()\n        mixedObject.anyValue.value = anyValue\n        let mixedObject2 = mixedObject\n\n        XCTAssertEqual(mixedObject.anyValue, mixedObject2.anyValue)\n        XCTAssertEqual(mixedObject.anyValue.value, mixedObject2.anyValue.value)\n        XCTAssertEqual(mixedObject.anyValue, mixedObject2.anyValue, \"instances should be equal by `==` operator\")\n        XCTAssertTrue(mixedObject.isEqual(mixedObject2), \"instances should be equal by `isEqual` method\")\n\n        XCTAssertEqual(mixedObject.anyValue.value.dictionaryValue, mixedObject.anyValue.value.dictionaryValue)\n\n        let realm = realmWithTestPath()\n        try realm.write {\n            realm.add(mixedObject)\n            realm.add(mixedObject2)\n        }\n\n        XCTAssertEqual(mixedObject.anyValue.value, mixedObject2.anyValue.value)\n        XCTAssertEqual(mixedObject.anyValue.value.dictionaryValue?[\"key0\"], mixedObject2.anyValue.value.dictionaryValue?[\"key0\"])\n        XCTAssertEqual(mixedObject.anyValue.value.dictionaryValue?[\"key0\"]?.dictionaryValue?[\"key5\"]?.listValue?[0], mixedObject2.anyValue.value.dictionaryValue?[\"key0\"]?.dictionaryValue?[\"key5\"]?.listValue?[0])\n\n        let mixedObject3 = AnyRealmTypeObject()\n        mixedObject3.anyValue.value = AnyRealmValue.fromDictionary(dictionary)\n\n        try realm.write {\n            realm.add(mixedObject3)\n        }\n\n        XCTAssertNotEqual(mixedObject.anyValue.value, mixedObject3.anyValue.value)\n        XCTAssertNotEqual(mixedObject.anyValue.value.dictionaryValue?[\"key0\"], mixedObject3.anyValue.value.dictionaryValue?[\"key0\"])\n        XCTAssertNotEqual(mixedObject.anyValue.value.dictionaryValue?[\"key0\"]?.dictionaryValue?[\"key5\"]?.listValue?[0], mixedObject3.anyValue.value.dictionaryValue?[\"key0\"]?.dictionaryValue?[\"key5\"]?.listValue?[0])\n    }\n\n    func testMixedCollectionModernObjectEquality() throws {\n        let so = SwiftStringObject()\n        so.stringCol = \"hello\"\n        let subArray2: AnyRealmValue = AnyRealmValue.fromArray([ .object(so) ])\n        let subDict2: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key1\": subArray2 ])\n        let subArray3: AnyRealmValue = AnyRealmValue.fromArray([ subArray2, subDict2])\n        let subDict3: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key2\": subArray3 ])\n        let subArray4: AnyRealmValue = AnyRealmValue.fromArray([ subDict3 ])\n        let subDict4: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key3\": subArray4 ])\n        let subArray5: AnyRealmValue = AnyRealmValue.fromArray([ subDict4 ])\n        let subDict5: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key4\": subArray5 ])\n        let subArray6: AnyRealmValue = AnyRealmValue.fromArray([ subDict5 ])\n        let subDict6: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key5\": subArray6 ])\n        let dictionary: Dictionary<String, AnyRealmValue> = [\n            \"key0\": subDict6,\n        ]\n\n        XCTAssertEqual(AnyRealmValue.fromDictionary([:]), AnyRealmValue.fromDictionary([:])) // Empty mixed lists should be equal\n        XCTAssertEqual(AnyRealmValue.fromDictionary(dictionary), AnyRealmValue.fromDictionary(dictionary)) // Unamanged mixed list should be equal\n\n        var dictionary2 = dictionary\n        dictionary2[\"newKey\"] = .bool(false)\n        XCTAssertNotEqual(AnyRealmValue.fromDictionary(dictionary), AnyRealmValue.fromDictionary(dictionary2))\n\n        let anyValue = AnyRealmValue.fromDictionary(dictionary)\n        let anyValue2 = AnyRealmValue.fromDictionary(dictionary)\n        anyValue2.dictionaryValue?[\"newKey\"] = .bool(false)\n        XCTAssertNotEqual(anyValue, anyValue2)\n\n        // Unmanaged equality\n        let mixedObject = ModernAllTypesObject()\n        mixedObject.anyCol = anyValue\n        XCTAssertEqual(mixedObject.anyCol, anyValue)\n        XCTAssertEqual(mixedObject.anyCol, AnyRealmValue.fromDictionary(dictionary))\n        let mixedObject2 = mixedObject\n        XCTAssertEqual(mixedObject2.anyCol, anyValue)\n        XCTAssertEqual(mixedObject2.anyCol, AnyRealmValue.fromDictionary(dictionary))\n\n        XCTAssertEqual(mixedObject.anyCol, mixedObject2.anyCol)\n        XCTAssertTrue(mixedObject.anyCol == mixedObject2.anyCol, \"instances should be equal by `==` operator\")\n        XCTAssertTrue(mixedObject.isEqual(mixedObject2), \"instances should be equal by `isEqual` method\")\n        XCTAssertEqual(mixedObject.anyCol.dictionaryValue, mixedObject.anyCol.dictionaryValue)\n\n        let realm = realmWithTestPath()\n        try realm.write {\n            realm.add(mixedObject)\n            realm.add(mixedObject2)\n        }\n\n        XCTAssertEqual(mixedObject.anyCol, mixedObject2.anyCol)\n        XCTAssertTrue(mixedObject.anyCol == mixedObject2.anyCol, \"instances should be equal by `==` operator\")\n        XCTAssertTrue(mixedObject.isEqual(mixedObject2), \"instances should be equal by `isEqual` method\")\n\n        let mixedObject3 = ModernAllTypesObject()\n        mixedObject3.anyCol = AnyRealmValue.fromDictionary(dictionary)\n\n        try realm.write {\n            realm.add(mixedObject3)\n        }\n\n        XCTAssertNotEqual(mixedObject.anyCol, mixedObject3.anyCol)\n        XCTAssertNotEqual(mixedObject.anyCol.dictionaryValue?[\"key0\"], mixedObject3.anyCol.dictionaryValue?[\"key0\"])\n        XCTAssertNotEqual(mixedObject.anyCol.dictionaryValue?[\"key0\"]?.dictionaryValue?[\"key5\"]?.listValue?[0], mixedObject3.anyCol.dictionaryValue?[\"key0\"]?.dictionaryValue?[\"key5\"]?.listValue?[0])\n    }\n\n    @MainActor\n    func testMixedCollectionObjectNotifications() throws {\n        let subArray3: AnyRealmValue = AnyRealmValue.fromArray([ .int(3) ])\n        let subArray2: AnyRealmValue = AnyRealmValue.fromArray([ subArray3 ])\n        let subDict1: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key1\": subArray2 ])\n        let dictionary: Dictionary<String, AnyRealmValue> = [\n            \"key0\": subDict1,\n        ]\n\n        func expectChange(_ name: String) -> ((ObjectChange<ObjectBase>) -> Void) {\n            let exp = expectation(description: \"Object changes for mixed collections\")\n            return { change in\n                if case .change(_, let properties) = change {\n                    XCTAssertEqual(properties.count, 1)\n                    if let prop = properties.first {\n                        XCTAssertEqual(prop.name, name)\n                    }\n                } else {\n                    XCTFail(\"expected .change, got \\(change)\")\n                }\n                exp.fulfill()\n            }\n        }\n\n        func assertObjectNotification(_ object: Object, block: @escaping () -> Void) {\n            let token = object.observe(expectChange(\"anyValue\"))\n            let realm = realmWithTestPath()\n            try! realm.write {\n                block()\n            }\n\n            waitForExpectations(timeout: 2)\n            token.invalidate()\n        }\n\n        let o = AnyRealmTypeObject()\n        let realm = realmWithTestPath()\n        try realm.write {\n            realm.add(o)\n        }\n\n        assertObjectNotification(o) {\n            o.anyValue.value = AnyRealmValue.fromDictionary(dictionary)\n        }\n\n        assertObjectNotification(o) {\n            o.anyValue.value.dictionaryValue?[\"key0\"]?.dictionaryValue?[\"key1\"]?.listValue?[0].listValue?[0] = .bool(true)\n        }\n\n        assertObjectNotification(o) {\n            o.anyValue.value.dictionaryValue?[\"key0\"]?.dictionaryValue?[\"key1\"]?.listValue?.append(.float(33.33))\n        }\n\n        assertObjectNotification(o) {\n            o.anyValue.value.dictionaryValue?[\"key0\"]?.dictionaryValue?[\"key1\"]?.listValue?.removeLast()\n        }\n\n        assertObjectNotification(o) {\n            o.anyValue.value.dictionaryValue?[\"key0\"]?.dictionaryValue?[\"key1\"]?.listValue?.removeAll()\n        }\n\n        assertObjectNotification(o) {\n            o.anyValue.value.dictionaryValue?[\"key0\"]?.dictionaryValue?[\"key2\"] = .string(\"nowhere\")\n        }\n\n        assertObjectNotification(o) {\n            o.anyValue.value.dictionaryValue?[\"key0\"]?.dictionaryValue?[\"key2\"] = nil\n        }\n\n        assertObjectNotification(o) {\n            o.anyValue.value.dictionaryValue?.removeAll()\n        }\n    }\n\n    @MainActor\n    func testMixedCollectionDictionaryNotifications() throws {\n        let subDict2: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key5\": .float(43) ])\n        let subDict1: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key1\": subDict2 ])\n        let dictionary: Dictionary<String, AnyRealmValue> = [\n            \"key0\": subDict1,\n            \"key3\": .decimal128(Decimal128(1)),\n        ]\n\n        func expectChanges(_ deletions: [String], _ insertions: [String], _ modifications: [String]) -> ((RealmMapChange<Map<String, AnyRealmValue>>) -> Void) {\n            let exp = expectation(description: \"Dictionary changes for mixed collections\")\n            return { change in\n                switch change {\n                case .initial:\n                    break\n                case .update(_, deletions: let d, insertions: let i, modifications: let m):\n                    XCTAssertEqual(d.count, deletions.count)\n                    XCTAssertEqual(d, deletions)\n                    XCTAssertEqual(i.count, insertions.count)\n                    XCTAssertEqual(i, insertions)\n                    XCTAssertEqual(m.count, modifications.count)\n                    XCTAssertEqual(m, modifications)\n                    exp.fulfill()\n                case .error(let error):\n                    XCTFail(\"Unexpected error \\(error)\")\n                }\n            }\n        }\n\n        func assertDictionaryNotification(_ dictionary: Map<String, AnyRealmValue>?, deletions: [String], insertions: [String], modifications: [String], block: @escaping () -> Void) {\n            let token = dictionary?.observe(expectChanges(deletions, insertions, modifications))\n            let realm = realmWithTestPath()\n            try! realm.write {\n                block()\n            }\n\n            waitForExpectations(timeout: 2)\n            token?.invalidate()\n        }\n\n        let o = AnyRealmTypeObject()\n        o.anyValue.value = AnyRealmValue.fromDictionary(dictionary)\n        let realm = realmWithTestPath()\n        try realm.write {\n            realm.add(o)\n        }\n\n        assertDictionaryNotification(o.anyValue.value.dictionaryValue, deletions: [], insertions: [\"key2\"], modifications: []) {\n            o.anyValue.value.dictionaryValue?[\"key2\"] = AnyRealmValue.fromDictionary(dictionary)\n        }\n\n        assertDictionaryNotification(o.anyValue.value.dictionaryValue, deletions: [], insertions: [\"key10\"], modifications: []) {\n            o.anyValue.value.dictionaryValue?[\"key10\"] = AnyRealmValue.fromDictionary(dictionary)\n        }\n\n        assertDictionaryNotification(o.anyValue.value.dictionaryValue?[\"key10\"]?.dictionaryValue, deletions: [], insertions: [], modifications: [\"key0\"]) {\n            o.anyValue.value.dictionaryValue?[\"key10\"]?.dictionaryValue?[\"key0\"] = .string(\"new\")\n        }\n\n        assertDictionaryNotification(o.anyValue.value.dictionaryValue, deletions: [\"key3\"], insertions: [], modifications: []) {\n            o.anyValue.value.dictionaryValue?[\"key3\"] = nil\n        }\n\n        assertDictionaryNotification(o.anyValue.value.dictionaryValue?[\"key0\"]?.dictionaryValue?[\"key1\"]?.dictionaryValue, deletions: [], insertions: [\"key6\"], modifications: []) {\n            o.anyValue.value.dictionaryValue?[\"key0\"]?.dictionaryValue?[\"key1\"]?.dictionaryValue?[\"key6\"] = .date(Date())\n        }\n\n        assertDictionaryNotification(o.anyValue.value.dictionaryValue?[\"key0\"]?.dictionaryValue?[\"key1\"]?.dictionaryValue, deletions: [\"key5\", \"key6\"], insertions: [], modifications: []) {\n            o.anyValue.value.dictionaryValue?[\"key0\"]?.dictionaryValue?[\"key1\"]?.dictionaryValue?.removeAll()\n        }\n    }\n\n    @MainActor\n    func testMixedCollectionArrayNotifications() throws {\n        let subArray2: AnyRealmValue = AnyRealmValue.fromArray([ .float(43), .string(\"lunch\"), .double(12.34) ])\n        let subArray1: AnyRealmValue = AnyRealmValue.fromArray([ subArray2, .bool(false) ])\n        let array: Array<AnyRealmValue> = [\n            subArray1, .decimal128(Decimal128(1)),\n        ]\n\n        func expectChanges(_ deletions: [Int], _ insertions: [Int], _ modifications: [Int]) -> ((RealmCollectionChange<List<AnyRealmValue>>) -> Void) {\n            let exp = expectation(description: \"Dictionary changes for mixed collections\")\n            return { change in\n                switch change {\n                case .initial:\n                    break\n                case .update(_, deletions: let d, insertions: let i, modifications: let m):\n                    XCTAssertEqual(d.count, deletions.count)\n                    XCTAssertEqual(d, deletions)\n                    XCTAssertEqual(i.count, insertions.count)\n                    XCTAssertEqual(i, insertions)\n                    XCTAssertEqual(m.count, modifications.count)\n                    XCTAssertEqual(m, modifications)\n                    exp.fulfill()\n                case .error(let error):\n                    XCTFail(\"Unexpected error \\(error)\")\n                }\n            }\n        }\n\n        func assertDictionaryNotification(_ list: List<AnyRealmValue>?, deletions: [Int], insertions: [Int], modifications: [Int], block: @escaping () -> Void) {\n            let token = list?.observe(expectChanges(deletions, insertions, modifications))\n            let realm = realmWithTestPath()\n            try! realm.write {\n                block()\n            }\n\n            waitForExpectations(timeout: 2)\n            token?.invalidate()\n        }\n\n        let o = AnyRealmTypeObject()\n        o.anyValue.value = AnyRealmValue.fromArray(array)\n        let realm = realmWithTestPath()\n        try realm.write {\n            realm.add(o)\n        }\n\n        assertDictionaryNotification(o.anyValue.value.listValue, deletions: [], insertions: [2], modifications: []) {\n            o.anyValue.value.listValue?.append(AnyRealmValue.fromArray(array))\n        }\n\n        assertDictionaryNotification(o.anyValue.value.listValue?[0].listValue, deletions: [], insertions: [], modifications: [1]) {\n            o.anyValue.value.listValue?[0].listValue?[1] = .objectId(ObjectId.generate())\n        }\n\n        assertDictionaryNotification(o.anyValue.value.listValue?[0].listValue?[0].listValue, deletions: [2], insertions: [], modifications: []) {\n            o.anyValue.value.listValue?[0].listValue?[0].listValue?.removeLast()\n        }\n\n        assertDictionaryNotification(o.anyValue.value.listValue?[0].listValue?[0].listValue, deletions: [0, 1], insertions: [], modifications: []) {\n            o.anyValue.value.listValue?[0].listValue?[0].listValue?.removeAll()\n        }\n    }\n\n    func testReassignToMixedList() throws {\n        let list = AnyRealmValue.fromArray([.bool(true), AnyRealmValue.fromDictionary([\"key\": .int(12)]), .float(13.12)])\n\n        let mixedObject = AnyRealmTypeObject()\n        mixedObject.anyValue.value = list\n\n        let realm = realmWithTestPath()\n        try realm.write {\n            realm.add(mixedObject)\n        }\n        XCTAssertEqual(mixedObject.anyValue.value.listValue?[1].dictionaryValue?[\"key\"], .int(12))\n\n        try realm.write {\n            mixedObject.anyValue.value.listValue?.append(AnyRealmValue.fromArray([.double(20.20), .string(\"hello\")]))\n        }\n        XCTAssertEqual(mixedObject.anyValue.value.listValue?[3].listValue?[0], .double(20.20))\n\n        try realm.write {\n            let listItem = mixedObject.anyValue.value.listValue?[0]\n            mixedObject.anyValue.value.listValue?.append(listItem!)\n        }\n        XCTAssertEqual(mixedObject.anyValue.value.listValue?[4], .bool(true))\n\n        try realm.write {\n            let listItem = mixedObject.anyValue.value.listValue?[3]\n            mixedObject.anyValue.value.listValue?.append(listItem!)\n        }\n        // TODO: Self-assignment - this doesn't work due to https://github.com/realm/realm-core/issues/7422\n//        XCTAssertEqual(mixedObject.anyValue.value.listValue?[4].listValue?[0], .double(20.20))\n\n        try realm.write {\n            let listItem = mixedObject.anyValue.value.listValue?[3]\n            mixedObject.anyValue.value.listValue?[3] = listItem!\n        }\n        // TODO: Self-assignment - this doesn't work due to https://github.com/realm/realm-core/issues/7422\n//        XCTAssertEqual(mixedObject.anyValue.value.listValue?[3].listValue?[0],  .double(20.20))\n\n        try realm.write {\n            mixedObject.anyValue.value.listValue?[1] = AnyRealmValue.fromDictionary([\"new-key\": .int(3)])\n        }\n        XCTAssertEqual(mixedObject.anyValue.value.listValue?[1].dictionaryValue?[\"new-key\"], .int(3))\n\n        try realm.write {\n            let listItem = mixedObject.anyValue.value.listValue?[1]\n            mixedObject.anyValue.value.listValue?.append(listItem!)\n        }\n        // TODO: Self-assignment - this doesn't work due to https://github.com/realm/realm-core/issues/7422\n//        XCTAssertEqual(mixedObject.anyValue.value.listValue?[3].dictionaryValue?[\"new-key\"], .int(3))\n\n        try realm.write {\n            let listItem = mixedObject.anyValue.value.listValue?[1]\n            mixedObject.anyValue.value.listValue?[3] = listItem!\n        }\n        // TODO: Self-assignment - this doesn't work due to https://github.com/realm/realm-core/issues/7422\n//        XCTAssertEqual(mixedObject.anyValue.value.listValue?[3].dictionaryValue?[\"new-key\"], .int(3))\n    }\n\n    func testReassignToMixedDictionary() throws {\n        let dictionary = AnyRealmValue.fromDictionary([\"key1\": .bool(true), \"key2\": AnyRealmValue.fromDictionary([\"key4\": .int(12)]), \"key3\": .float(13.12)])\n\n        let mixedObject = AnyRealmTypeObject()\n        mixedObject.anyValue.value = dictionary\n\n        let realm = realmWithTestPath()\n        try realm.write {\n            realm.add(mixedObject)\n        }\n        XCTAssertEqual(mixedObject.anyValue.value.dictionaryValue?[\"key2\"]?.dictionaryValue?[\"key4\"], .int(12))\n\n        try realm.write {\n            mixedObject.anyValue.value.dictionaryValue?[\"key4\"] = AnyRealmValue.fromDictionary([\"new-key\": .int(3)])\n        }\n        XCTAssertEqual(mixedObject.anyValue.value.dictionaryValue?[\"key4\"]?.dictionaryValue?[\"new-key\"], .int(3))\n\n        try realm.write {\n            let dictItem = mixedObject.anyValue.value.dictionaryValue?[\"key1\"]\n            mixedObject.anyValue.value.dictionaryValue?[\"key5\"] = dictItem\n        }\n        XCTAssertEqual(mixedObject.anyValue.value.dictionaryValue?[\"key5\"], .bool(true))\n\n        try realm.write {\n            let dictItem = mixedObject.anyValue.value.dictionaryValue?[\"key2\"]\n            mixedObject.anyValue.value.dictionaryValue?[\"key6\"] = dictItem\n        }\n        // TODO: Self-assignment - this doesn't work due to https://github.com/realm/realm-core/issues/7422\n//        XCTAssertEqual(mixedObject.anyValue.value.dictionaryValue?[\"key6\"]?.dictionaryValue?[\"key4\"], .int(12))\n\n        try realm.write {\n            mixedObject.anyValue.value.dictionaryValue?[\"key7\"] = AnyRealmValue.fromArray([.string(\"hello\"), .double(20.20)])\n        }\n        XCTAssertEqual(mixedObject.anyValue.value.dictionaryValue?[\"key7\"]?.listValue?[0], .string(\"hello\"))\n\n        try realm.write {\n            let dictItem = mixedObject.anyValue.value.dictionaryValue?[\"key7\"]\n            mixedObject.anyValue.value.dictionaryValue?[\"key2\"] = dictItem\n        }\n        // TODO: Self-assignment - this doesn't work due to https://github.com/realm/realm-core/issues/7422\n//        XCTAssertEqual(mixedObject.anyValue.value.dictionaryValue?[\"key2\"]?.listValue?[0], .string(\"hello\"))\n    }\n\n    func testEnumerationNestedCollection() throws {\n        var count = 0\n        var accessNestedValue = false\n        func iterateNestedCollectionKeyValue(_ value: AnyRealmValue) {\n            count+=1\n            switch value {\n            case .list(let l):\n                for item in l {\n                    iterateNestedCollectionKeyValue(item)\n                }\n            case .dictionary(let d):\n                for (_, val) in d {\n                    iterateNestedCollectionKeyValue(val)\n                }\n            default:\n                accessNestedValue = true\n            }\n        }\n\n        let so = SwiftStringObject()\n        so.stringCol = \"hello\"\n\n        let subArray2: AnyRealmValue = AnyRealmValue.fromArray([ .object(so) ])\n        let subDict2: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key1\": subArray2 ])\n        let subArray3: AnyRealmValue = AnyRealmValue.fromArray([ subDict2 ])\n        let subDict3: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key2\": subArray3 ])\n        let subArray4: AnyRealmValue = AnyRealmValue.fromArray([ subDict3 ])\n        let subDict4: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key3\": subArray4 ])\n        let subArray5: AnyRealmValue = AnyRealmValue.fromArray([ subDict4 ])\n        let subDict5: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key4\": subArray5 ])\n        let subArray6: AnyRealmValue = AnyRealmValue.fromArray([ subDict5 ])\n        let subDict6: AnyRealmValue = AnyRealmValue.fromDictionary([ \"key5\": subArray6 ])\n        let dictionary: Dictionary<String, AnyRealmValue> = [\n            \"key0\": subDict6,\n        ]\n\n        let o = AnyRealmTypeObject()\n        o.anyValue.value = AnyRealmValue.fromDictionary(dictionary)\n\n        let realm = realmWithTestPath()\n        try realm.write {\n            realm.add(o)\n        }\n\n        iterateNestedCollectionKeyValue(o.anyValue.value)\n        XCTAssertEqual(count, 12)\n        XCTAssertTrue(accessNestedValue)\n\n        var countValue = 0\n        var accessNestedValueValue = false\n        func iterateNestedCollectionValue(_ value: AnyRealmValue) {\n            countValue+=1\n            switch value {\n            case .list(let l):\n                for item in l {\n                    iterateNestedCollectionValue(item)\n                }\n            case .dictionary(let d):\n                for (val) in d {\n                    iterateNestedCollectionValue(val.value)\n                }\n            default:\n                accessNestedValueValue = true\n            }\n        }\n\n        iterateNestedCollectionValue(o.anyValue.value)\n        XCTAssertEqual(countValue, 12)\n        XCTAssertTrue(accessNestedValueValue)\n    }\n\n    func testCollectionReassign() throws {\n        let dictionary: Dictionary<String, AnyRealmValue> = [\n            \"key1\": .string(\"hello\"),\n            \"key2\": .bool(false),\n        ]\n\n        let dictionary1: Dictionary<String, AnyRealmValue> = [\n            \"key1\": .string(\"adios\"),\n        ]\n\n        let o = AnyRealmTypeObject()\n        o.anyValue.value = AnyRealmValue.fromDictionary(dictionary)\n\n        let realm = realmWithTestPath()\n        try realm.write {\n            realm.add(o)\n\n        }\n        XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key1\"], .string(\"hello\"))\n        XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key2\"], .bool(false))\n\n        try realm.write {\n            o.anyValue.value = AnyRealmValue.fromDictionary(dictionary1)\n        }\n        XCTAssertEqual(o.anyValue.value.dictionaryValue?[\"key1\"], .string(\"adios\"))\n        XCTAssertNil(o.anyValue.value.dictionaryValue?[\"key2\"])\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/ModernKVOTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\nclass ModernKVOTests: TestCase {\n    var realm: Realm! = nil\n\n    override func setUp() {\n        super.setUp()\n        realm = try! Realm()\n        realm.beginWrite()\n    }\n\n    override func tearDown() {\n        realm.cancelWrite()\n        realm = nil\n        super.tearDown()\n    }\n\n    var changeDictionary: [NSKeyValueChangeKey: Any]?\n\n    override func observeValue(forKeyPath keyPath: String?, of object: Any?,\n                               change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) {\n        changeDictionary = change\n    }\n\n    // swiftlint:disable:next cyclomatic_complexity\n    func observeChange<T: Equatable>(_ obj: ModernAllTypesObject, _ key: String, _ old: T?, _ new: T?,\n                                     fileName: StaticString = #file, lineNumber: UInt = #line, _ block: () -> Void) {\n        let kvoOptions: NSKeyValueObservingOptions = [.old, .new]\n        obj.addObserver(self, forKeyPath: key, options: kvoOptions, context: nil)\n        block()\n        obj.removeObserver(self, forKeyPath: key)\n\n        XCTAssert(changeDictionary != nil, \"Did not get a notification\", file: (fileName), line: lineNumber)\n        guard changeDictionary != nil else { return }\n\n        let actualOld = changeDictionary![.oldKey] as? T\n        let actualNew = changeDictionary![.newKey] as? T\n\n        XCTAssert(old == actualOld,\n                  \"Old value: expected \\(String(describing: old)), got \\(String(describing: actualOld))\",\n                  file: (fileName), line: lineNumber)\n        XCTAssert(new == actualNew,\n                  \"New value: expected \\(String(describing: new)), got \\(String(describing: actualNew))\",\n                  file: (fileName), line: lineNumber)\n\n        changeDictionary = nil\n    }\n\n    func observeListChange(_ obj: NSObject, _ key: String, _ kind: NSKeyValueChange,\n                           _ indexes: NSIndexSet = NSIndexSet(index: 0),\n                           fileName: StaticString = #file, lineNumber: UInt = #line, _ block: () -> Void) {\n        obj.addObserver(self, forKeyPath: key, options: [.old, .new], context: nil)\n        block()\n        obj.removeObserver(self, forKeyPath: key)\n        XCTAssert(changeDictionary != nil, \"Did not get a notification\", file: (fileName), line: lineNumber)\n        guard changeDictionary != nil else { return }\n\n        let actualKind = NSKeyValueChange(rawValue: (changeDictionary![NSKeyValueChangeKey.kindKey] as! NSNumber).uintValue)!\n        let actualIndexes = changeDictionary![NSKeyValueChangeKey.indexesKey]! as! NSIndexSet\n        XCTAssert(actualKind == kind, \"Change kind: expected \\(kind), got \\(actualKind)\", file: (fileName),\n            line: lineNumber)\n        XCTAssert(actualIndexes.isEqual(indexes), \"Changed indexes: expected \\(indexes), got \\(actualIndexes)\",\n                  file: (fileName), line: lineNumber)\n\n        changeDictionary = nil\n    }\n\n    class CompoundListObserver: NSObject {\n        let key: String\n        let deletions: [Int]\n        let insertions: [Int]\n        public var count = 0\n\n        init(_ key: String, _ deletions: [Int], _ insertions: [Int]) {\n            self.key = key\n            self.deletions = deletions\n            self.insertions = insertions\n        }\n\n        override func observeValue(forKeyPath keyPath: String?, of object: Any?,\n                                   change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) {\n            XCTAssertEqual(keyPath, key)\n            XCTAssertNotNil(object)\n            XCTAssertNotNil(change)\n            guard let change = change else { return }\n            XCTAssertNotNil(change[.kindKey])\n            guard let kind = (change[.kindKey] as? UInt).map(NSKeyValueChange.init(rawValue:)) else { return }\n            if count == 0 {\n                XCTAssertEqual(kind, .removal)\n                XCTAssertEqual(Array(change[.indexesKey]! as! NSIndexSet), deletions)\n            } else if count == 1 {\n                XCTAssertEqual(kind, .insertion)\n                XCTAssertEqual(Array(change[.indexesKey]! as! NSIndexSet), insertions)\n            } else {\n                XCTFail(\"too many notifications\")\n            }\n            count += 1\n        }\n    }\n\n    func observeCompoundListChange(_ obs: NSObject, _ obj: NSObject, _ key: String,\n                                   _ values: NSArray, deletions: [Int], insertions: [Int]) {\n        let observer = CompoundListObserver(key, deletions, insertions)\n        if deletions.count == 0 {\n            observer.count = 1\n        }\n\n        obs.addObserver(observer, forKeyPath: key, options: [.old, .new], context: nil)\n        obj.setValue(values, forKey: key)\n        obs.removeObserver(observer, forKeyPath: key)\n\n        if insertions.count > 0 {\n            XCTAssertEqual(observer.count, 2)\n        } else {\n            XCTAssertEqual(observer.count, 1)\n        }\n    }\n\n    func observeSetChange(_ obj: ModernAllTypesObject, _ key: String,\n                          fileName: StaticString = #file, lineNumber: UInt = #line, _ block: () -> Void) {\n        obj.addObserver(self, forKeyPath: key, options: [], context: nil)\n        block()\n        obj.removeObserver(self, forKeyPath: key)\n\n        XCTAssert(changeDictionary != nil, \"Did not get a notification\", file: (fileName), line: lineNumber)\n        guard changeDictionary != nil else { return }\n    }\n\n    func getObject(_ obj: ModernAllTypesObject) -> (ModernAllTypesObject, ModernAllTypesObject) {\n        return (obj, obj)\n    }\n\n    // Actual tests follow\n\n    func testAllPropertyTypes() {\n        let (obj, obs) = getObject(ModernAllTypesObject())\n\n        let oldData = obj.binaryCol\n        let data = \"abc\".data(using: String.Encoding.utf8, allowLossyConversion: false)!\n        let oldDate = obj.dateCol\n        let date = Date(timeIntervalSince1970: 1)\n        let oldDecimal = obj.decimalCol\n        let decimal = Decimal128(number: 2)\n        let oldObjectId = obj.objectIdCol\n        let objectId = ObjectId()\n        let oldUUID = obj.uuidCol\n        let uuid = UUID()\n\n        observeChange(obs, \"boolCol\", false, true) { obj.boolCol = true }\n        observeChange(obs, \"int8Col\", 1 as Int8, 10) { obj.int8Col = 10 }\n        observeChange(obs, \"int16Col\", 2 as Int16, 10) { obj.int16Col = 10 }\n        observeChange(obs, \"int32Col\", 3 as Int32, 10) { obj.int32Col = 10 }\n        observeChange(obs, \"int64Col\", 4 as Int64, 10) { obj.int64Col = 10 }\n        observeChange(obs, \"floatCol\", 5 as Float, 10) { obj.floatCol = 10 }\n        observeChange(obs, \"doubleCol\", 6 as Double, 10) { obj.doubleCol = 10 }\n        observeChange(obs, \"stringCol\", \"\", \"abc\") { obj.stringCol = \"abc\" }\n        observeChange(obs, \"objectCol\", nil, obj) { obj.objectCol = obj }\n        observeChange(obs, \"binaryCol\", oldData, data) { obj.binaryCol = data }\n        observeChange(obs, \"dateCol\", oldDate, date) { obj.dateCol = date }\n        observeChange(obs, \"decimalCol\", oldDecimal, decimal) { obj.decimalCol = decimal }\n        observeChange(obs, \"objectIdCol\", oldObjectId, objectId) { obj.objectIdCol = objectId }\n        observeChange(obs, \"uuidCol\", oldUUID, uuid) { obj.uuidCol = uuid }\n        observeChange(obs, \"anyCol\", nil, 1) { obj.anyCol = .int(1) }\n\n        observeListChange(obs, \"arrayCol\", .insertion) { obj.arrayCol.append(obj) }\n        observeListChange(obs, \"arrayCol\", .removal) { obj.arrayCol.removeAll() }\n        observeSetChange(obs, \"setCol\") { obj.setCol.insert(obj) }\n        observeSetChange(obs, \"setCol\") { obj.setCol.remove(obj) }\n\n        observeChange(obs, \"optIntCol\", nil, 10) { obj.optIntCol = 10 }\n        observeChange(obs, \"optFloatCol\", nil, 10.0) { obj.optFloatCol = 10 }\n        observeChange(obs, \"optDoubleCol\", nil, 10.0) { obj.optDoubleCol = 10 }\n        observeChange(obs, \"optBoolCol\", nil, true) { obj.optBoolCol = true }\n        observeChange(obs, \"optStringCol\", nil, \"abc\") { obj.optStringCol = \"abc\" }\n        observeChange(obs, \"optBinaryCol\", nil, data) { obj.optBinaryCol = data }\n        observeChange(obs, \"optDateCol\", nil, date) { obj.optDateCol = date }\n        observeChange(obs, \"optDecimalCol\", nil, decimal) { obj.optDecimalCol = decimal }\n        observeChange(obs, \"optObjectIdCol\", nil, objectId) { obj.optObjectIdCol = objectId }\n        observeChange(obs, \"optUuidCol\", nil, uuid) { obj.optUuidCol = uuid }\n\n        observeChange(obs, \"optIntCol\", 10, nil) { obj.optIntCol = nil }\n        observeChange(obs, \"optFloatCol\", 10.0, nil) { obj.optFloatCol = nil }\n        observeChange(obs, \"optDoubleCol\", 10.0, nil) { obj.optDoubleCol = nil }\n        observeChange(obs, \"optBoolCol\", true, nil) { obj.optBoolCol = nil }\n        observeChange(obs, \"optStringCol\", \"abc\", nil) { obj.optStringCol = nil }\n        observeChange(obs, \"optBinaryCol\", data, nil) { obj.optBinaryCol = nil }\n        observeChange(obs, \"optDateCol\", date, nil) { obj.optDateCol = nil }\n        observeChange(obs, \"optDecimalCol\", decimal, nil) { obj.optDecimalCol = nil }\n        observeChange(obs, \"optObjectIdCol\", objectId, nil) { obj.optObjectIdCol = nil }\n        observeChange(obs, \"optUuidCol\", uuid, nil) { obj.optUuidCol = nil }\n\n        observeListChange(obs, \"arrayBool\", .insertion) { obj.arrayBool.append(true) }\n        observeListChange(obs, \"arrayInt8\", .insertion) { obj.arrayInt8.append(10) }\n        observeListChange(obs, \"arrayInt16\", .insertion) { obj.arrayInt16.append(10) }\n        observeListChange(obs, \"arrayInt32\", .insertion) { obj.arrayInt32.append(10) }\n        observeListChange(obs, \"arrayInt64\", .insertion) { obj.arrayInt64.append(10) }\n        observeListChange(obs, \"arrayFloat\", .insertion) { obj.arrayFloat.append(10) }\n        observeListChange(obs, \"arrayDouble\", .insertion) { obj.arrayDouble.append(10) }\n        observeListChange(obs, \"arrayString\", .insertion) { obj.arrayString.append(\"abc\") }\n        observeListChange(obs, \"arrayDecimal\", .insertion) { obj.arrayDecimal.append(decimal) }\n        observeListChange(obs, \"arrayObjectId\", .insertion) { obj.arrayObjectId.append(objectId) }\n        observeListChange(obs, \"arrayUuid\", .insertion) { obj.arrayUuid.append(uuid) }\n        observeListChange(obs, \"arrayAny\", .insertion) { obj.arrayAny.append(.string(\"a\")) }\n\n        observeListChange(obs, \"arrayOptBool\", .insertion) { obj.arrayOptBool.append(true) }\n        observeListChange(obs, \"arrayOptInt8\", .insertion) { obj.arrayOptInt8.append(10) }\n        observeListChange(obs, \"arrayOptInt16\", .insertion) { obj.arrayOptInt16.append(10) }\n        observeListChange(obs, \"arrayOptInt32\", .insertion) { obj.arrayOptInt32.append(10) }\n        observeListChange(obs, \"arrayOptInt64\", .insertion) { obj.arrayOptInt64.append(10) }\n        observeListChange(obs, \"arrayOptFloat\", .insertion) { obj.arrayOptFloat.append(10) }\n        observeListChange(obs, \"arrayOptDouble\", .insertion) { obj.arrayOptDouble.append(10) }\n        observeListChange(obs, \"arrayOptString\", .insertion) { obj.arrayOptString.append(\"abc\") }\n        observeListChange(obs, \"arrayOptBinary\", .insertion) { obj.arrayOptBinary.append(data) }\n        observeListChange(obs, \"arrayOptDate\", .insertion) { obj.arrayOptDate.append(date) }\n        observeListChange(obs, \"arrayOptDecimal\", .insertion) { obj.arrayOptDecimal.append(decimal) }\n        observeListChange(obs, \"arrayOptObjectId\", .insertion) { obj.arrayOptObjectId.append(objectId) }\n        observeListChange(obs, \"arrayOptUuid\", .insertion) { obj.arrayOptUuid.append(uuid) }\n\n        observeListChange(obs, \"arrayOptBool\", .insertion) { obj.arrayOptBool.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptInt8\", .insertion) { obj.arrayOptInt8.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptInt16\", .insertion) { obj.arrayOptInt16.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptInt32\", .insertion) { obj.arrayOptInt32.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptInt64\", .insertion) { obj.arrayOptInt64.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptFloat\", .insertion) { obj.arrayOptFloat.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptDouble\", .insertion) { obj.arrayOptDouble.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptString\", .insertion) { obj.arrayOptString.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptDate\", .insertion) { obj.arrayOptDate.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptBinary\", .insertion) { obj.arrayOptBinary.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptDecimal\", .insertion) { obj.arrayOptDecimal.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptObjectId\", .insertion) { obj.arrayOptObjectId.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptUuid\", .insertion) { obj.arrayOptUuid.insert(nil, at: 0) }\n\n        observeSetChange(obs, \"setBool\") { obj.setBool.insert(true) }\n        observeSetChange(obs, \"setInt8\") { obj.setInt8.insert(10) }\n        observeSetChange(obs, \"setInt16\") { obj.setInt16.insert(10) }\n        observeSetChange(obs, \"setInt32\") { obj.setInt32.insert(10) }\n        observeSetChange(obs, \"setInt64\") { obj.setInt64.insert(10) }\n        observeSetChange(obs, \"setFloat\") { obj.setFloat.insert(10) }\n        observeSetChange(obs, \"setDouble\") { obj.setDouble.insert(10) }\n        observeSetChange(obs, \"setString\") { obj.setString.insert(\"abc\") }\n        observeSetChange(obs, \"setDecimal\") { obj.setDecimal.insert(decimal) }\n        observeSetChange(obs, \"setObjectId\") { obj.setObjectId.insert(objectId) }\n        observeSetChange(obs, \"setUuid\") { obj.setUuid.insert(uuid) }\n        observeSetChange(obs, \"setAny\") { obj.setAny.insert(.none) }\n\n        observeSetChange(obs, \"setOptBool\") { obj.setOptBool.insert(true) }\n        observeSetChange(obs, \"setOptInt8\") { obj.setOptInt8.insert(10) }\n        observeSetChange(obs, \"setOptInt16\") { obj.setOptInt16.insert(10) }\n        observeSetChange(obs, \"setOptInt32\") { obj.setOptInt32.insert(10) }\n        observeSetChange(obs, \"setOptInt64\") { obj.setOptInt64.insert(10) }\n        observeSetChange(obs, \"setOptFloat\") { obj.setOptFloat.insert(10) }\n        observeSetChange(obs, \"setOptDouble\") { obj.setOptDouble.insert(10) }\n        observeSetChange(obs, \"setOptString\") { obj.setOptString.insert(\"abc\") }\n        observeSetChange(obs, \"setOptBinary\") { obj.setOptBinary.insert(data) }\n        observeSetChange(obs, \"setOptDate\") { obj.setOptDate.insert(date) }\n        observeSetChange(obs, \"setOptDecimal\") { obj.setOptDecimal.insert(decimal) }\n        observeSetChange(obs, \"setOptObjectId\") { obj.setOptObjectId.insert(objectId) }\n        observeSetChange(obs, \"setOptUuid\") { obj.setOptUuid.insert(uuid) }\n\n        observeSetChange(obs, \"setOptBool\") { obj.setOptBool.insert(nil) }\n        observeSetChange(obs, \"setOptInt8\") { obj.setOptInt8.insert(nil) }\n        observeSetChange(obs, \"setOptInt16\") { obj.setOptInt16.insert(nil) }\n        observeSetChange(obs, \"setOptInt32\") { obj.setOptInt32.insert(nil) }\n        observeSetChange(obs, \"setOptInt64\") { obj.setOptInt64.insert(nil) }\n        observeSetChange(obs, \"setOptFloat\") { obj.setOptFloat.insert(nil) }\n        observeSetChange(obs, \"setOptDouble\") { obj.setOptDouble.insert(nil) }\n        observeSetChange(obs, \"setOptString\") { obj.setOptString.insert(nil) }\n        observeSetChange(obs, \"setOptDate\") { obj.setOptDate.insert(nil) }\n        observeSetChange(obs, \"setOptBinary\") { obj.setOptBinary.insert(nil) }\n        observeSetChange(obs, \"setOptDecimal\") { obj.setOptDecimal.insert(nil) }\n        observeSetChange(obs, \"setOptObjectId\") { obj.setOptObjectId.insert(nil) }\n        observeSetChange(obs, \"setOptUuid\") { obj.setOptUuid.insert(nil) }\n\n        observeSetChange(obs, \"mapBool\") { obj.mapBool[\"\"] = true }\n        observeSetChange(obs, \"mapInt8\") { obj.mapInt8[\"\"] = 10 }\n        observeSetChange(obs, \"mapInt16\") { obj.mapInt16[\"\"] = 10 }\n        observeSetChange(obs, \"mapInt32\") { obj.mapInt32[\"\"] = 10 }\n        observeSetChange(obs, \"mapInt64\") { obj.mapInt64[\"\"] = 10 }\n        observeSetChange(obs, \"mapFloat\") { obj.mapFloat[\"\"] = 10 }\n        observeSetChange(obs, \"mapDouble\") { obj.mapDouble[\"\"] = 10 }\n        observeSetChange(obs, \"mapString\") { obj.mapString[\"\"] = \"abc\" }\n        observeSetChange(obs, \"mapDecimal\") { obj.mapDecimal[\"\"] = decimal }\n        observeSetChange(obs, \"mapObjectId\") { obj.mapObjectId[\"\"] = objectId }\n        observeSetChange(obs, \"mapUuid\") { obj.mapUuid[\"\"] = uuid }\n        observeSetChange(obs, \"mapAny\") { obj.mapAny[\"\"] = AnyRealmValue.none }\n\n        observeSetChange(obs, \"mapOptBool\") { obj.mapOptBool[\"\"] = true }\n        observeSetChange(obs, \"mapOptInt8\") { obj.mapOptInt8[\"\"] = 10 }\n        observeSetChange(obs, \"mapOptInt16\") { obj.mapOptInt16[\"\"] = 10 }\n        observeSetChange(obs, \"mapOptInt32\") { obj.mapOptInt32[\"\"] = 10 }\n        observeSetChange(obs, \"mapOptInt64\") { obj.mapOptInt64[\"\"] = 10 }\n        observeSetChange(obs, \"mapOptFloat\") { obj.mapOptFloat[\"\"] = 10 }\n        observeSetChange(obs, \"mapOptDouble\") { obj.mapOptDouble[\"\"] = 10 }\n        observeSetChange(obs, \"mapOptString\") { obj.mapOptString[\"\"] = \"abc\" }\n        observeSetChange(obs, \"mapOptBinary\") { obj.mapOptBinary[\"\"] = data }\n        observeSetChange(obs, \"mapOptDate\") { obj.mapOptDate[\"\"] = date }\n        observeSetChange(obs, \"mapOptDecimal\") { obj.mapOptDecimal[\"\"] = decimal }\n        observeSetChange(obs, \"mapOptObjectId\") { obj.mapOptObjectId[\"\"] = objectId }\n        observeSetChange(obs, \"mapOptUuid\") { obj.mapOptUuid[\"\"] = uuid }\n\n        observeSetChange(obs, \"mapOptBool\") { obj.mapOptBool[\"\"] = nil }\n        observeSetChange(obs, \"mapOptInt8\") { obj.mapOptInt8[\"\"] = nil }\n        observeSetChange(obs, \"mapOptInt16\") { obj.mapOptInt16[\"\"] = nil }\n        observeSetChange(obs, \"mapOptInt32\") { obj.mapOptInt32[\"\"] = nil }\n        observeSetChange(obs, \"mapOptInt64\") { obj.mapOptInt64[\"\"] = nil }\n        observeSetChange(obs, \"mapOptFloat\") { obj.mapOptFloat[\"\"] = nil }\n        observeSetChange(obs, \"mapOptDouble\") { obj.mapOptDouble[\"\"] = nil }\n        observeSetChange(obs, \"mapOptString\") { obj.mapOptString[\"\"] = nil }\n        observeSetChange(obs, \"mapOptDate\") { obj.mapOptDate[\"\"] = nil }\n        observeSetChange(obs, \"mapOptBinary\") { obj.mapOptBinary[\"\"] = nil }\n        observeSetChange(obs, \"mapOptDecimal\") { obj.mapOptDecimal[\"\"] = nil }\n        observeSetChange(obs, \"mapOptObjectId\") { obj.mapOptObjectId[\"\"] = nil }\n        observeSetChange(obs, \"mapOptUuid\") { obj.mapOptUuid[\"\"] = nil }\n\n        obj.arrayInt32.removeAll()\n        observeCompoundListChange(obj, obs, \"arrayInt32\", [1],\n                                  deletions: [], insertions: [0])\n        observeCompoundListChange(obj, obs, \"arrayInt32\", [1],\n                                  deletions: [0], insertions: [0])\n        observeCompoundListChange(obj, obs, \"arrayInt32\", [1, 2, 3],\n                                  deletions: [0], insertions: [0, 1, 2])\n        observeCompoundListChange(obj, obs, \"arrayInt32\", [],\n                                  deletions: [0, 1, 2], insertions: [])\n        observeCompoundListChange(obj, obs, \"arrayInt32\", [],\n                                  deletions: [], insertions: [])\n\n        if obs.realm == nil {\n            return\n        }\n\n        observeChange(obs, \"invalidated\", false, true) {\n            self.realm.delete(obj)\n        }\n\n        let (obj2, obs2) = getObject(ModernAllTypesObject())\n        observeChange(obs2, \"arrayCol.invalidated\", false, true) {\n            self.realm.delete(obj2)\n        }\n\n        let (obj3, obs3) = getObject(ModernAllTypesObject())\n        observeChange(obs3, \"setCol.invalidated\", false, true) {\n            self.realm.delete(obj3)\n        }\n\n        let (obj4, obs4) = getObject(ModernAllTypesObject())\n        observeChange(obs4, \"mapAny.invalidated\", false, true) {\n            self.realm.delete(obj4)\n        }\n    }\n\n    func testCollectionInMixedKVO() {\n        let (obj, obs) = getObject(ModernAllTypesObject())\n\n        observeSetChange(obs, \"anyCol\") { obj.anyCol = AnyRealmValue.fromDictionary([\n            \"key1\": .int(1234)]) }\n        observeSetChange(obs, \"anyCol\") { obj.anyCol.dictionaryValue?[\"key1\"] = .string(\"hello\") }\n        observeSetChange(obs, \"anyCol\") { obj.anyCol.dictionaryValue?[\"key1\"] = nil }\n\n        observeSetChange(obs, \"anyCol\") { obj.anyCol = AnyRealmValue.fromArray([ .int(1234)]) }\n        observeSetChange(obs, \"anyCol\") { obj.anyCol.listValue?[0] = .float(123.456) }\n        observeSetChange(obs, \"anyCol\") { obj.anyCol.listValue?.append(.bool(true)) }\n        observeSetChange(obs, \"anyCol\") { obj.anyCol.listValue?.insert(.date(Date()), at: 1) }\n        observeSetChange(obs, \"anyCol\") { obj.anyCol.listValue?.remove(at: 0) }\n    }\n\n    func testReadSharedSchemaFromObservedObject() {\n        let obj = ModernAllTypesObject()\n        obj.addObserver(self, forKeyPath: \"boolCol\", options: [.old, .new], context: nil)\n        XCTAssertEqual(type(of: obj).sharedSchema(), ModernAllTypesObject.sharedSchema())\n        obj.removeObserver(self, forKeyPath: \"boolCol\")\n    }\n}\n\nclass ModernKVOPersistedTests: ModernKVOTests {\n    override func getObject(_ obj: ModernAllTypesObject) -> (ModernAllTypesObject, ModernAllTypesObject) {\n        realm.add(obj)\n        return (obj, obj)\n    }\n}\n\nclass ModernKVOMultipleAccessorsTests: ModernKVOTests {\n    override func getObject(_ obj: ModernAllTypesObject) -> (ModernAllTypesObject, ModernAllTypesObject) {\n        realm.add(obj)\n        return (obj, realm.object(ofType: ModernAllTypesObject.self, forPrimaryKey: obj.pk)!)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/ModernObjectAccessorTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport Realm.Private\nimport RealmSwift\nimport Foundation\n\nclass ModernObjectAccessorTests: TestCase {\n    let data = \"b\".data(using: .utf8, allowLossyConversion: false)!\n    let date = Date(timeIntervalSinceReferenceDate: 2)\n    let oid1 = ObjectId(\"1234567890ab1234567890ab\")\n    let oid2 = ObjectId(\"abcdef123456abcdef123456\")\n    let utf8TestString = \"值значен™👍☞⎠‱௹♣︎☐▼❒∑⨌⧭иеمرحبا\"\n    let uuid = UUID()\n\n    func setAndTestAllPropertiesViaNormalAccess(_ object: ModernAllTypesObject) {\n        func test<T: Equatable>(_ keyPath: ReferenceWritableKeyPath<ModernAllTypesObject, T>, _ values: T...) {\n            for value in values {\n                object[keyPath: keyPath] = value\n                XCTAssertEqual(object[keyPath: keyPath], value)\n            }\n        }\n\n        test(\\.boolCol, true, false)\n        test(\\.intCol, -1, 0, 1)\n        test(\\.int8Col, -1, 0, 1)\n        test(\\.int16Col, -1, 0, 1)\n        test(\\.int32Col, -1, 0, 1)\n        test(\\.int64Col, -1, 0, 1)\n        test(\\.floatCol, -Float.greatestFiniteMagnitude, Float.greatestFiniteMagnitude, 20, 20.2)\n        test(\\.doubleCol, -Double.greatestFiniteMagnitude, Double.greatestFiniteMagnitude, 20, 20.2, 16777217)\n        test(\\.stringCol, \"\", utf8TestString)\n        test(\\.binaryCol, data)\n        test(\\.dateCol, date)\n        test(\\.decimalCol, \"inf\", 1, 0, \"0\", -1, \"-inf\")\n        test(\\.objectIdCol, oid1, oid2)\n        test(\\.uuidCol, uuid)\n        test(\\.objectCol, ModernAllTypesObject(), nil)\n        test(\\.intEnumCol, .value1, .value2)\n        test(\\.stringEnumCol, .value1, .value2)\n\n        test(\\.optBoolCol, true, false, nil)\n        test(\\.optIntCol, Int.min, 0, Int.max, nil)\n        test(\\.optInt8Col, Int8.min, 0, Int8.max, nil)\n        test(\\.optInt16Col, Int16.min, 0, Int16.max, nil)\n        test(\\.optInt32Col, Int32.min, 0, Int32.max, nil)\n        test(\\.optInt64Col, Int64.min, 0, Int64.max, nil)\n        test(\\.optFloatCol, -Float.greatestFiniteMagnitude, Float.greatestFiniteMagnitude, 20, 20.2, nil)\n        test(\\.optDoubleCol, -Double.greatestFiniteMagnitude, Double.greatestFiniteMagnitude, 20, 20.2, 16777217, nil)\n        test(\\.optStringCol, \"\", utf8TestString, nil)\n        test(\\.optBinaryCol, data, nil)\n        test(\\.optDateCol, date, nil)\n        test(\\.optDecimalCol, \"inf\", 1, 0, \"0\", -1, \"-inf\", nil)\n        test(\\.optObjectIdCol, oid1, oid2, nil)\n        test(\\.optUuidCol, uuid, nil)\n        test(\\.optIntEnumCol, .value1, .value2, nil)\n        test(\\.optStringEnumCol, .value1, .value2, nil)\n\n        test(\\.anyCol, .none, .int(1), .bool(false), .float(2.2),\n                           .double(3.3), .string(\"str\"), .data(data), .date(date),\n                           .object(ModernAllTypesObject()), .objectId(oid1),\n                           .decimal128(5), .uuid(UUID()))\n\n        object.decimalCol = \"nan\"\n        XCTAssertTrue(object.decimalCol.isNaN)\n        object.optDecimalCol = \"nan\"\n        XCTAssertTrue(object.optDecimalCol!.isNaN)\n\n        object[\"optIntEnumCol\"] = 10\n        XCTAssertNil(object.optIntEnumCol)\n\n        object.objectCol = ModernAllTypesObject()\n        if object.realm == nil {\n            XCTAssertEqual(object.objectCol!.linkingObjects.count, 0)\n        } else {\n            XCTAssertEqual(object.objectCol!.linkingObjects.count, 1)\n            XCTAssertEqual(object.objectCol!.linkingObjects[0], object)\n        }\n    }\n\n    func setAndTestAllPropertiesViaSubscript(_ object: ModernAllTypesObject) {\n        func testNoConversion<T: Equatable>(_ keyPath: String, _ type: T.Type, _ values: T...) {\n            for value in values {\n                object[keyPath] = value\n                XCTAssertEqual(object[keyPath] as! T, value)\n            }\n            for value in values {\n                object.setValue(value, forKey: keyPath)\n                XCTAssertEqual(object.value(forKey: keyPath) as! T, value)\n            }\n        }\n\n        testNoConversion(\"boolCol\", Bool.self, true, false)\n        testNoConversion(\"intCol\", Int.self, -1, 0, 1)\n        testNoConversion(\"int8Col\", Int8.self, -1, 0, 1)\n        testNoConversion(\"int16Col\", Int16.self, -1, 0, 1)\n        testNoConversion(\"int32Col\", Int32.self, -1, 0, 1)\n        testNoConversion(\"int64Col\", Int64.self, -1, 0, 1)\n        testNoConversion(\"floatCol\", Float.self, -Float.greatestFiniteMagnitude, Float.greatestFiniteMagnitude, 20, 20.2)\n        testNoConversion(\"doubleCol\", Double.self, -Double.greatestFiniteMagnitude, Double.greatestFiniteMagnitude, 20, 20.2, 16777217)\n        testNoConversion(\"stringCol\", String.self, \"\", utf8TestString)\n        testNoConversion(\"binaryCol\", Data.self, data)\n        testNoConversion(\"dateCol\", Date.self, date)\n        testNoConversion(\"decimalCol\", Decimal128.self, \"inf\", 1, 0, \"0\", -1, \"-inf\")\n        testNoConversion(\"objectIdCol\", ObjectId.self, oid1, oid2)\n        testNoConversion(\"uuidCol\", UUID.self, uuid)\n        testNoConversion(\"objectCol\", ModernAllTypesObject?.self, ModernAllTypesObject(), nil)\n\n        testNoConversion(\"optBoolCol\", Bool?.self, true, false, nil)\n        testNoConversion(\"optIntCol\", Int?.self, Int.min, 0, Int.max, nil)\n        testNoConversion(\"optInt8Col\", Int8?.self, Int8.min, 0, Int8.max, nil)\n        testNoConversion(\"optInt16Col\", Int16?.self, Int16.min, 0, Int16.max, nil)\n        testNoConversion(\"optInt32Col\", Int32?.self, Int32.min, 0, Int32.max, nil)\n        testNoConversion(\"optInt64Col\", Int64?.self, Int64.min, 0, Int64.max, nil)\n        testNoConversion(\"optFloatCol\", Float?.self, -Float.greatestFiniteMagnitude, Float.greatestFiniteMagnitude, 20, 20.2, nil)\n        testNoConversion(\"optDoubleCol\", Double?.self, -Double.greatestFiniteMagnitude, Double.greatestFiniteMagnitude, 20, 20.2, 16777217, nil)\n        testNoConversion(\"optStringCol\", String?.self, \"\", utf8TestString, nil)\n        testNoConversion(\"optBinaryCol\", Data?.self, data, nil)\n        testNoConversion(\"optDateCol\", Date?.self, date, nil)\n        testNoConversion(\"optDecimalCol\", Decimal128?.self, \"inf\", 1, 0, \"0\", -1, \"-inf\", nil)\n        testNoConversion(\"optObjectIdCol\", ObjectId?.self, oid1, oid2, nil)\n        testNoConversion(\"optUuidCol\", UUID?.self, uuid, nil)\n\n        func testConversion<Expected: Equatable>(_ keyPath: String, _ value: Any, _ expected: Expected) {\n            object[keyPath] = value\n            XCTAssertEqual(object[keyPath] as! Expected, expected)\n            object.setValue(value, forKey: keyPath)\n            XCTAssertEqual(object.value(forKey: keyPath) as! Expected, expected)\n        }\n\n        testConversion(\"decimalCol\", 1, 1 as Decimal128)\n        testConversion(\"decimalCol\", 2.2 as Float, Decimal128(value: 2.2 as Float))\n        testConversion(\"decimalCol\", 3.3 as Double, Decimal128(value: 3.3 as Double))\n        testConversion(\"decimalCol\", \"4.4\", 4.4 as Decimal128)\n        testConversion(\"decimalCol\", Decimal(5.5), 5.5 as Decimal128)\n\n        testConversion(\"intEnumCol\", ModernIntEnum.value1, ModernIntEnum.value1.rawValue)\n        testConversion(\"intEnumCol\", ModernIntEnum.value2, ModernIntEnum.value2.rawValue)\n        testConversion(\"stringEnumCol\", ModernStringEnum.value1, ModernStringEnum.value1.rawValue)\n        testConversion(\"stringEnumCol\", ModernStringEnum.value2, ModernStringEnum.value2.rawValue)\n\n        testConversion(\"optDecimalCol\", 1, 1 as Decimal128)\n        testConversion(\"optDecimalCol\", 2.2 as Float, Decimal128(value: 2.2 as Float))\n        testConversion(\"optDecimalCol\", 3.3 as Double, Decimal128(value: 3.3 as Double))\n        testConversion(\"optDecimalCol\", \"4.4\", 4.4 as Decimal128)\n        testConversion(\"optDecimalCol\", Decimal(5.5), 5.5 as Decimal128)\n        testConversion(\"optDecimalCol\", NSNull(), nil as Decimal128?)\n\n        testConversion(\"optIntEnumCol\", ModernIntEnum.value2, ModernIntEnum.value2.rawValue)\n        testConversion(\"optIntEnumCol\", nil as ModernIntEnum? as Any, nil as ModernIntEnum?)\n        testConversion(\"optStringEnumCol\", ModernStringEnum.value1, ModernStringEnum.value1.rawValue)\n        testConversion(\"optStringEnumCol\", nil as ModernStringEnum? as Any, nil as ModernStringEnum?)\n\n        let obj = ModernAllTypesObject()\n        testConversion(\"anyCol\", AnyRealmValue.int(1), 1)\n        testConversion(\"anyCol\", AnyRealmValue.bool(false), false)\n        testConversion(\"anyCol\", AnyRealmValue.float(2.2), 2.2 as Float)\n        testConversion(\"anyCol\", AnyRealmValue.double(3.3), 3.3)\n        testConversion(\"anyCol\", AnyRealmValue.string(\"str\"), \"str\")\n        testConversion(\"anyCol\", AnyRealmValue.data(data), data)\n        testConversion(\"anyCol\", AnyRealmValue.date(date), date)\n        testConversion(\"anyCol\", AnyRealmValue.object(obj), obj)\n        testConversion(\"anyCol\", AnyRealmValue.objectId(oid1), oid1)\n        testConversion(\"anyCol\", AnyRealmValue.decimal128(5), Decimal128(5))\n        testConversion(\"anyCol\", AnyRealmValue.uuid(uuid), uuid)\n\n        object[\"anyCol\"] = AnyRealmValue.none\n        if case Optional<Any>.none = object[\"anyCol\"] {\n        } else {\n            XCTFail(\"\\(String(describing: object[\"anyCol\"])) should be nil\")\n        }\n        object.setValue(AnyRealmValue.none, forKey: \"anyCol\")\n        if case Optional<Any>.none = object[\"anyCol\"] {\n        } else {\n            XCTFail(\"\\(String(describing: object[\"anyCol\"])) should be nil\")\n        }\n\n        object[\"decimalCol\"] = Decimal128(\"nan\")\n        XCTAssertTrue((object[\"decimalCol\"] as! Decimal128).isNaN)\n        object[\"optDecimalCol\"] = Decimal128(\"nan\")\n        XCTAssertTrue((object[\"optDecimalCol\"] as! Decimal128).isNaN)\n\n        object[\"optIntEnumCol\"] = 10\n        XCTAssertNil(object[\"optIntEnumCol\"])\n\n        object.objectCol = ModernAllTypesObject()\n        let linkingObjects = (object[\"objectCol\"]! as! ModernAllTypesObject)[\"linkingObjects\"] as! LinkingObjects<ModernAllTypesObject>\n        if object.realm == nil {\n            XCTAssertEqual(linkingObjects.count, 0)\n        } else {\n            XCTAssertEqual(linkingObjects.count, 1)\n            XCTAssertEqual(linkingObjects[0], object)\n        }\n    }\n\n    func get(_ object: ObjectBase, _ propertyName: String) -> Any {\n        let prop = RLMObjectBaseObjectSchema(object)!.properties.first { $0.name == propertyName }!\n        return prop.swiftAccessor!.get(prop, on: object)\n    }\n    func set(_ object: ObjectBase, _ propertyName: String, _ value: Any) {\n        let prop = RLMObjectBaseObjectSchema(object)!.properties.first { $0.name == propertyName }!\n        prop.swiftAccessor!.set(prop, on: object, to: value)\n    }\n\n    func assertEqual<T: Equatable>(_ lhs: Any, _ rhs: T) {\n        if rhs is NSNull {\n            XCTAssertTrue(lhs is NSNull)\n        } else if lhs is NSNull {\n            XCTAssertEqual((T.self as! ExpressibleByNilLiteral.Type).init(nilLiteral: ()) as! T, rhs)\n        } else {\n            XCTAssertEqual(lhs as! T, rhs)\n        }\n    }\n\n    func setAndTestAllPropertiesViaAccessor(_ object: ModernAllTypesObject) {\n        func testNoConversion<T: Equatable>(_ keyPath: String, _ type: T.Type, _ values: T...) {\n            for value in values {\n                set(object, keyPath, value)\n                assertEqual(get(object, keyPath), value)\n            }\n        }\n\n        testNoConversion(\"boolCol\", Bool.self, true, false)\n        testNoConversion(\"intCol\", Int.self, -1, 0, 1)\n        testNoConversion(\"int8Col\", Int8.self, -1, 0, 1)\n        testNoConversion(\"int16Col\", Int16.self, -1, 0, 1)\n        testNoConversion(\"int32Col\", Int32.self, -1, 0, 1)\n        testNoConversion(\"int64Col\", Int64.self, -1, 0, 1)\n        testNoConversion(\"floatCol\", Float.self, -Float.greatestFiniteMagnitude, Float.greatestFiniteMagnitude, 20, 20.2)\n        testNoConversion(\"doubleCol\", Double.self, -Double.greatestFiniteMagnitude, Double.greatestFiniteMagnitude, 20, 20.2, 16777217)\n        testNoConversion(\"stringCol\", String.self, \"\", utf8TestString)\n        testNoConversion(\"binaryCol\", Data.self, data)\n        testNoConversion(\"dateCol\", Date.self, date)\n        testNoConversion(\"decimalCol\", Decimal128.self, \"inf\", 1, 0, \"0\", -1, \"-inf\")\n        testNoConversion(\"objectIdCol\", ObjectId.self, oid1, oid2)\n        testNoConversion(\"uuidCol\", UUID.self, uuid)\n        testNoConversion(\"objectCol\", ModernAllTypesObject?.self, ModernAllTypesObject(), nil)\n\n        testNoConversion(\"optBoolCol\", Bool?.self, true, false, nil)\n        testNoConversion(\"optIntCol\", Int?.self, Int.min, 0, Int.max, nil)\n        testNoConversion(\"optInt8Col\", Int8?.self, Int8.min, 0, Int8.max, nil)\n        testNoConversion(\"optInt16Col\", Int16?.self, Int16.min, 0, Int16.max, nil)\n        testNoConversion(\"optInt32Col\", Int32?.self, Int32.min, 0, Int32.max, nil)\n        testNoConversion(\"optInt64Col\", Int64?.self, Int64.min, 0, Int64.max, nil)\n        testNoConversion(\"optFloatCol\", Float?.self, -Float.greatestFiniteMagnitude, Float.greatestFiniteMagnitude, 20, 20.2, nil)\n        testNoConversion(\"optDoubleCol\", Double?.self, -Double.greatestFiniteMagnitude, Double.greatestFiniteMagnitude, 20, 20.2, 16777217, nil)\n        testNoConversion(\"optStringCol\", String?.self, \"\", utf8TestString, nil)\n        testNoConversion(\"optBinaryCol\", Data?.self, data, nil)\n        testNoConversion(\"optDateCol\", Date?.self, date, nil)\n        testNoConversion(\"optDecimalCol\", Decimal128?.self, \"inf\", 1, 0, \"0\", -1, \"-inf\", nil)\n        testNoConversion(\"optObjectIdCol\", ObjectId?.self, oid1, oid2, nil)\n        testNoConversion(\"optUuidCol\", UUID?.self, uuid, nil)\n\n        func testAny<T: Equatable>(_ value: T) {\n            set(object, \"anyCol\", value)\n            XCTAssertEqual(get(object, \"anyCol\") as! T, value)\n        }\n\n        testAny(NSNull())\n        testAny(1)\n        testAny(false)\n        testAny(2.2 as Float)\n        testAny(3.3)\n        testAny(\"str\")\n        testAny(data)\n        testAny(date)\n        testAny(ModernAllTypesObject())\n        testAny(oid1)\n        testAny(Decimal128(5))\n        testAny(uuid)\n\n        func testConversion<Expected: Equatable>(_ keyPath: String, _ value: Any, _ expected: Expected) {\n            set(object, keyPath, value)\n            assertEqual(get(object, keyPath), expected)\n        }\n\n        testConversion(\"decimalCol\", 1, 1 as Decimal128)\n        testConversion(\"decimalCol\", 2.2 as Float, Decimal128(value: 2.2 as Float))\n        testConversion(\"decimalCol\", 3.3 as Double, Decimal128(value: 3.3 as Double))\n        testConversion(\"decimalCol\", \"4.4\", 4.4 as Decimal128)\n        testConversion(\"decimalCol\", Decimal(5.5), 5.5 as Decimal128)\n\n        testConversion(\"intEnumCol\", ModernIntEnum.value1, ModernIntEnum.value1.rawValue)\n        testConversion(\"intEnumCol\", ModernIntEnum.value2, ModernIntEnum.value2.rawValue)\n        testConversion(\"stringEnumCol\", ModernStringEnum.value1, ModernStringEnum.value1.rawValue)\n        testConversion(\"stringEnumCol\", ModernStringEnum.value2, ModernStringEnum.value2.rawValue)\n\n        testConversion(\"optDecimalCol\", 1, 1 as Decimal128)\n        testConversion(\"optDecimalCol\", 2.2 as Float, Decimal128(value: 2.2 as Float))\n        testConversion(\"optDecimalCol\", 3.3 as Double, Decimal128(value: 3.3 as Double))\n        testConversion(\"optDecimalCol\", \"4.4\", 4.4 as Decimal128)\n        testConversion(\"optDecimalCol\", Decimal(5.5), 5.5 as Decimal128)\n        testConversion(\"optDecimalCol\", NSNull(), nil as Decimal128?)\n\n        testConversion(\"optIntEnumCol\", ModernIntEnum.value2, ModernIntEnum.value2.rawValue)\n        testConversion(\"optIntEnumCol\", nil as ModernIntEnum? as Any, nil as ModernIntEnum?)\n        testConversion(\"optStringEnumCol\", ModernStringEnum.value1, ModernStringEnum.value1.rawValue)\n        testConversion(\"optStringEnumCol\", nil as ModernStringEnum? as Any, nil as ModernStringEnum?)\n\n        let obj = ModernAllTypesObject()\n        testConversion(\"anyCol\", AnyRealmValue.none, NSNull())\n        testConversion(\"anyCol\", AnyRealmValue.int(1), 1)\n        testConversion(\"anyCol\", AnyRealmValue.bool(false), false)\n        testConversion(\"anyCol\", AnyRealmValue.float(2.2), 2.2 as Float)\n        testConversion(\"anyCol\", AnyRealmValue.double(3.3), 3.3)\n        testConversion(\"anyCol\", AnyRealmValue.string(\"str\"), \"str\")\n        testConversion(\"anyCol\", AnyRealmValue.data(data), data)\n        testConversion(\"anyCol\", AnyRealmValue.date(date), date)\n        testConversion(\"anyCol\", AnyRealmValue.object(obj), obj)\n        testConversion(\"anyCol\", AnyRealmValue.objectId(oid1), oid1)\n        testConversion(\"anyCol\", AnyRealmValue.decimal128(5), Decimal128(5))\n        testConversion(\"anyCol\", AnyRealmValue.uuid(uuid), uuid)\n\n        object[\"decimalCol\"] = Decimal128(\"nan\")\n        XCTAssertTrue((object[\"decimalCol\"] as! Decimal128).isNaN)\n        object[\"optDecimalCol\"] = Decimal128(\"nan\")\n        XCTAssertTrue((object[\"optDecimalCol\"] as! Decimal128).isNaN)\n    }\n\n    func setAndTestList(_ object: ModernAllTypesObject) {\n        func test<T: RealmCollectionValue>(_ name: String, _ keyPath: ReferenceWritableKeyPath<ModernAllTypesObject, List<T>>, _ values: T...) {\n            // Getter should return correct type\n            XCTAssertTrue(get(object, name) is List<T>)\n            // Getter should return the same object each time\n            XCTAssertTrue(get(object, name) as AnyObject === get(object, name) as AnyObject)\n\n            // Which should be the same object as is obtained from reading the property directly\n            let list = object[keyPath: keyPath]\n            XCTAssertTrue(get(object, name) as! List<T> === list)\n\n            // Assigning a list to the property should copy the contents of the list, and not set\n            // the property pointing to the assigned list\n            let list2 = List<T>()\n            list2.append(objectsIn: values)\n            object[keyPath: keyPath] = list2\n            XCTAssertEqual(Array(list), values)\n            XCTAssertFalse(list2 === get(object, name) as AnyObject)\n\n            // Self-assignment should be a no-op and not clear the list\n            object[keyPath: keyPath] = object[keyPath: keyPath]\n            XCTAssertEqual(Array(list), values)\n            object.setValue(object.value(forKey: name), forKey: name)\n            XCTAssertEqual(Array(list), values)\n\n            // Setting via the accessor directly should do the same thing as assigning to the\n            // property\n            list.removeAll()\n            set(object, name, list2)\n            XCTAssertEqual(Array(list), values)\n            XCTAssertFalse(list2 === get(object, name) as AnyObject)\n\n            set(object, name, get(object, name))\n            XCTAssertEqual(Array(list), values)\n            set(object, name, RLMDynamicGetByName(object, name)!)\n            XCTAssertEqual(Array(list), values)\n\n            // The accessor should accept any enumerable type and not just List, so we should be\n            // able to assign an array directly\n            list.removeAll()\n            set(object, name, values)\n            XCTAssertEqual(Array(list), values)\n            XCTAssertTrue(get(object, name) as! List<T> === list)\n\n            // Assigning null to a List clears it\n            set(object, name, NSNull())\n            XCTAssertEqual(list.count, 0)\n        }\n\n        test(\"arrayBool\", \\.arrayBool, false, true)\n        test(\"arrayInt\", \\.arrayInt, Int.min, 0, Int.max)\n        test(\"arrayInt8\", \\.arrayInt8, Int8.min, 0, Int8.max)\n        test(\"arrayInt16\", \\.arrayInt16, Int16.min, 0, Int16.max)\n        test(\"arrayInt32\", \\.arrayInt32, Int32.min, 0, Int32.max)\n        test(\"arrayInt64\", \\.arrayInt64, Int64.min, 0, Int64.max)\n        test(\"arrayFloat\", \\.arrayFloat, -Float.greatestFiniteMagnitude, 0, Float.greatestFiniteMagnitude)\n        test(\"arrayDouble\", \\.arrayDouble, -Double.greatestFiniteMagnitude, 0, Double.greatestFiniteMagnitude)\n        test(\"arrayString\", \\.arrayString, \"a\", \"b\", \"c\")\n        test(\"arrayBinary\", \\.arrayBinary, data)\n        test(\"arrayDate\", \\.arrayDate, date)\n        test(\"arrayDecimal\", \\.arrayDecimal, Decimal128(1), Decimal128(2))\n        test(\"arrayObjectId\", \\.arrayObjectId, oid1, oid2)\n        test(\"arrayUuid\", \\.arrayUuid, uuid)\n\n        test(\"arrayOptBool\", \\.arrayOptBool, false, true, nil)\n        test(\"arrayOptInt\", \\.arrayOptInt, Int.min, 0, Int.max, nil)\n        test(\"arrayOptInt8\", \\.arrayOptInt8, Int8.min, 0, Int8.max, nil)\n        test(\"arrayOptInt16\", \\.arrayOptInt16, Int16.min, 0, Int16.max, nil)\n        test(\"arrayOptInt32\", \\.arrayOptInt32, Int32.min, 0, Int32.max, nil)\n        test(\"arrayOptInt64\", \\.arrayOptInt64, Int64.min, 0, Int64.max, nil)\n        test(\"arrayOptFloat\", \\.arrayOptFloat, -Float.greatestFiniteMagnitude, 0, Float.greatestFiniteMagnitude, nil)\n        test(\"arrayOptDouble\", \\.arrayOptDouble, -Double.greatestFiniteMagnitude, 0, Double.greatestFiniteMagnitude, nil)\n        test(\"arrayOptString\", \\.arrayOptString, \"a\", \"b\", \"c\", nil)\n        test(\"arrayOptBinary\", \\.arrayOptBinary, data, nil)\n        test(\"arrayOptDate\", \\.arrayOptDate, date, nil)\n        test(\"arrayOptDecimal\", \\.arrayOptDecimal, Decimal128(1), Decimal128(2), nil)\n        test(\"arrayOptObjectId\", \\.arrayOptObjectId, oid1, oid2, nil)\n        test(\"arrayOptUuid\", \\.arrayOptUuid, uuid, nil)\n\n        let obj = ModernAllTypesObject()\n        test(\"arrayAny\", \\.arrayAny, .none, .int(1), .bool(false), .float(2.2), .double(3.3),\n             .string(\"str\"), .data(data), .date(date), .object(obj), .objectId(oid1),\n             .decimal128(5), .uuid(uuid))\n    }\n\n    func assertSetEquals<T: RealmCollectionValue>(_ set: MutableSet<T>, _ expected: Array<T>) {\n        XCTAssertEqual(set.count, expected.count)\n        XCTAssertEqual(Set(set), Set(expected))\n    }\n\n    func setAndTestSet(_ object: ModernAllTypesObject) {\n        func test<T: RealmCollectionValue>(_ name: String, _ keyPath: ReferenceWritableKeyPath<ModernAllTypesObject, MutableSet<T>>, _ values: T...) {\n            // Getter should return correct type\n            XCTAssertTrue(get(object, name) is MutableSet<T>)\n            // Getter should return the same object each time\n            XCTAssertTrue(get(object, name) as AnyObject === get(object, name) as AnyObject)\n\n            // Which should be the same object as is obtained from reading the property directly\n            let collection = object[keyPath: keyPath]\n            XCTAssertTrue(get(object, name) as! MutableSet<T> === collection)\n\n            // Assigning a collection to the property should copy the contents of the list, and not set\n            // the property pointing to the assigned collection\n            let collection2 = MutableSet<T>()\n            collection2.insert(objectsIn: values)\n            object[keyPath: keyPath] = collection2\n            assertSetEquals(collection, values)\n            XCTAssertFalse(collection2 === get(object, name) as AnyObject)\n\n            // Self-assignment should be a no-op and not clear the collection\n            object[keyPath: keyPath] = object[keyPath: keyPath]\n            assertSetEquals(collection, values)\n            object.setValue(object.value(forKey: name), forKey: name)\n            assertSetEquals(collection, values)\n\n            // Setting via the accessor directly should do the same thing as assigning to the\n            // property\n            collection.removeAll()\n            set(object, name, collection2)\n            assertSetEquals(collection, values)\n            XCTAssertFalse(collection2 === get(object, name) as AnyObject)\n            set(object, name, get(object, name))\n            assertSetEquals(collection, values)\n\n            // The accessor should accept any enumerable type and not just Set, so we should be\n            // able to assign an set directly\n            collection.removeAll()\n            set(object, name, values)\n            assertSetEquals(collection, values)\n            XCTAssertTrue(get(object, name) as! MutableSet<T> === collection)\n\n            // Assigning null to a Set clears it\n            set(object, name, NSNull())\n            XCTAssertEqual(collection.count, 0)\n        }\n\n        test(\"setBool\", \\.setBool, false, true)\n        test(\"setInt\", \\.setInt, Int.min, 0, Int.max)\n        test(\"setInt8\", \\.setInt8, Int8.min, 0, Int8.max)\n        test(\"setInt16\", \\.setInt16, Int16.min, 0, Int16.max)\n        test(\"setInt32\", \\.setInt32, Int32.min, 0, Int32.max)\n        test(\"setInt64\", \\.setInt64, Int64.min, 0, Int64.max)\n        test(\"setFloat\", \\.setFloat, -Float.greatestFiniteMagnitude, 0, Float.greatestFiniteMagnitude)\n        test(\"setDouble\", \\.setDouble, -Double.greatestFiniteMagnitude, 0, Double.greatestFiniteMagnitude)\n        test(\"setString\", \\.setString, \"a\", \"b\", \"c\")\n        test(\"setBinary\", \\.setBinary, data)\n        test(\"setDate\", \\.setDate, date)\n        test(\"setDecimal\", \\.setDecimal, Decimal128(1), Decimal128(2))\n        test(\"setObjectId\", \\.setObjectId, oid1, oid2)\n        test(\"setUuid\", \\.setUuid, uuid)\n\n        test(\"setOptBool\", \\.setOptBool, false, true, nil)\n        test(\"setOptInt\", \\.setOptInt, Int.min, 0, Int.max, nil)\n        test(\"setOptInt8\", \\.setOptInt8, Int8.min, 0, Int8.max, nil)\n        test(\"setOptInt16\", \\.setOptInt16, Int16.min, 0, Int16.max, nil)\n        test(\"setOptInt32\", \\.setOptInt32, Int32.min, 0, Int32.max, nil)\n        test(\"setOptInt64\", \\.setOptInt64, Int64.min, 0, Int64.max, nil)\n        test(\"setOptFloat\", \\.setOptFloat, -Float.greatestFiniteMagnitude, 0, Float.greatestFiniteMagnitude, nil)\n        test(\"setOptDouble\", \\.setOptDouble, -Double.greatestFiniteMagnitude, 0, Double.greatestFiniteMagnitude, nil)\n        test(\"setOptString\", \\.setOptString, \"a\", \"b\", \"c\", nil)\n        test(\"setOptBinary\", \\.setOptBinary, data, nil)\n        test(\"setOptDate\", \\.setOptDate, date, nil)\n        test(\"setOptDecimal\", \\.setOptDecimal, Decimal128(1), Decimal128(2), nil)\n        test(\"setOptObjectId\", \\.setOptObjectId, oid1, oid2, nil)\n        test(\"setOptUuid\", \\.setOptUuid, uuid, nil)\n\n        let obj = ModernAllTypesObject()\n        test(\"setAny\", \\.setAny, .none, .int(1), .bool(false), .float(2.2), .double(3.3),\n             .string(\"str\"), .data(data), .date(date), .object(obj), .objectId(oid1),\n             .decimal128(5), .uuid(uuid))\n    }\n\n    func assertMapEquals<T: RealmCollectionValue>(_ map: Map<String, T>, _ expected: Array<T>) {\n        XCTAssertEqual(map.count, expected.count)\n        for (i, value) in expected.enumerated() {\n            XCTAssertEqual(map[\"\\(i)\"], value)\n        }\n    }\n\n    func setAndTestMap(_ object: ModernAllTypesObject) {\n        func test<T: RealmCollectionValue>(_ name: String,\n                                           _ keyPath: ReferenceWritableKeyPath<ModernAllTypesObject, Map<String, T>>,\n                                           _ values: T...) {\n            var dictValues = [String: T]()\n            for (i, value) in values.enumerated() {\n                dictValues[\"\\(i)\"] = value\n            }\n\n            // Getter should return correct type\n            XCTAssertTrue(get(object, name) is Map<String, T>)\n            // Getter should return the same object each time\n            XCTAssertTrue(get(object, name) as AnyObject === get(object, name) as AnyObject)\n\n            // Which should be the same object as is obtained from reading the property directly\n            let collection = object[keyPath: keyPath]\n            XCTAssertTrue(get(object, name) as! Map<String, T> === collection)\n\n            // Assigning a collection to the property should copy the contents of the list, and not set\n            // the property pointing to the assigned collection\n            let collection2 = Map<String, T>()\n            collection2.merge(dictValues) { $1 }\n            object[keyPath: keyPath] = collection2\n            assertMapEquals(collection, values)\n            XCTAssertFalse(collection2 === get(object, name) as AnyObject)\n\n            // Self-assignment should be a no-op and not clear the collection\n            object[keyPath: keyPath] = object[keyPath: keyPath]\n            assertMapEquals(collection, values)\n            object.setValue(object.value(forKey: name), forKey: name)\n            assertMapEquals(collection, values)\n\n            // setting via the accessor directly should do the same thing as assigning to the\n            // property\n            collection.removeAll()\n            set(object, name, collection2)\n            assertMapEquals(collection, values)\n            XCTAssertFalse(collection2 === get(object, name) as AnyObject)\n            set(object, name, get(object, name))\n            assertMapEquals(collection, values)\n\n            // The accessor should accept any enumerable type and not just map, so we should be\n            // able to assign a dictionary directly\n            collection.removeAll()\n            set(object, name, dictValues)\n            assertMapEquals(collection, values)\n            XCTAssertTrue(get(object, name) as! Map<String, T> === collection)\n\n            // Assigning null to a map clears it\n            set(object, name, NSNull())\n            XCTAssertEqual(collection.count, 0)\n        }\n\n        test(\"mapBool\", \\.mapBool, false, true)\n        test(\"mapInt\", \\.mapInt, Int.min, 0, Int.max)\n        test(\"mapInt8\", \\.mapInt8, Int8.min, 0, Int8.max)\n        test(\"mapInt16\", \\.mapInt16, Int16.min, 0, Int16.max)\n        test(\"mapInt32\", \\.mapInt32, Int32.min, 0, Int32.max)\n        test(\"mapInt64\", \\.mapInt64, Int64.min, 0, Int64.max)\n        test(\"mapFloat\", \\.mapFloat, -Float.greatestFiniteMagnitude, 0, Float.greatestFiniteMagnitude)\n        test(\"mapDouble\", \\.mapDouble, -Double.greatestFiniteMagnitude, 0, Double.greatestFiniteMagnitude)\n        test(\"mapString\", \\.mapString, \"a\", \"b\", \"c\")\n        test(\"mapBinary\", \\.mapBinary, data)\n        test(\"mapDate\", \\.mapDate, date)\n        test(\"mapDecimal\", \\.mapDecimal, Decimal128(1), Decimal128(2))\n        test(\"mapObjectId\", \\.mapObjectId, oid1, oid2)\n        test(\"mapUuid\", \\.mapUuid, uuid)\n\n        test(\"mapOptBool\", \\.mapOptBool, false, true, nil)\n        test(\"mapOptInt\", \\.mapOptInt, Int.min, 0, Int.max, nil)\n        test(\"mapOptInt8\", \\.mapOptInt8, Int8.min, 0, Int8.max, nil)\n        test(\"mapOptInt16\", \\.mapOptInt16, Int16.min, 0, Int16.max, nil)\n        test(\"mapOptInt32\", \\.mapOptInt32, Int32.min, 0, Int32.max, nil)\n        test(\"mapOptInt64\", \\.mapOptInt64, Int64.min, 0, Int64.max, nil)\n        test(\"mapOptFloat\", \\.mapOptFloat, -Float.greatestFiniteMagnitude, 0, Float.greatestFiniteMagnitude, nil)\n        test(\"mapOptDouble\", \\.mapOptDouble, -Double.greatestFiniteMagnitude, 0, Double.greatestFiniteMagnitude, nil)\n        test(\"mapOptString\", \\.mapOptString, \"a\", \"b\", \"c\", nil)\n        test(\"mapOptBinary\", \\.mapOptBinary, data, nil)\n        test(\"mapOptDate\", \\.mapOptDate, date, nil)\n        test(\"mapOptDecimal\", \\.mapOptDecimal, Decimal128(1), Decimal128(2), nil)\n        test(\"mapOptObjectId\", \\.mapOptObjectId, oid1, oid2, nil)\n        test(\"mapOptUuid\", \\.mapOptUuid, uuid, nil)\n\n        let obj = ModernAllTypesObject()\n        test(\"mapAny\", \\.mapAny, .none, .int(1), .bool(false), .float(2.2), .double(3.3),\n             .string(\"str\"), .data(data), .date(date), .object(obj), .objectId(oid1),\n             .decimal128(5), .uuid(uuid))\n    }\n\n    func setAndTestFailableCustomMappings(_ obj: FailableCustomObject) {\n        obj[\"int\"] = 2\n        XCTAssertEqual(obj[\"int\"] as! Int, 2)\n        XCTAssertEqual(get(obj, \"int\") as! Int, 2)\n        XCTAssertEqual(obj.int.persistableValue, 2)\n\n        if obj.realm == nil {\n            // Unmanaged objects convert to the mapped type on set as the value\n            // is stored as the wrapped type\n            let reason = \"Could not convert value '1' to type 'IntFailableWrapper'.\"\n            assertThrows(obj[\"int\"] = 1, reason: reason)\n            assertThrows(set(obj, \"int\", 1), reason: reason)\n        } else {\n            // Managed objects convert on read\n            obj[\"int\"] = 1\n            let reason = \"Failed to convert persisted value '1' to type 'IntFailableWrapper' in a non-optional context.\"\n            assertThrows(obj[\"int\"] as! Int, reason: reason)\n            assertThrows(get(obj, \"int\") as! Int, reason: reason)\n            assertThrows(obj.int, reason: reason)\n        }\n\n        obj[\"optInt\"] = 2\n        XCTAssertEqual(obj[\"optInt\"] as! Int, 2)\n        XCTAssertEqual(get(obj, \"optInt\") as! Int, 2)\n        XCTAssertEqual(obj.optInt!.persistableValue, 2)\n\n        obj[\"optInt\"] = 1\n        XCTAssertNil(obj[\"optInt\"])\n        XCTAssertTrue(get(obj, \"optInt\") is NSNull)\n        XCTAssertNil(obj.optInt)\n    }\n\n    func testUnmanagedAccessors() {\n        setAndTestAllPropertiesViaNormalAccess(ModernAllTypesObject())\n        setAndTestAllPropertiesViaSubscript(ModernAllTypesObject())\n        setAndTestAllPropertiesViaAccessor(ModernAllTypesObject())\n        setAndTestList(ModernAllTypesObject())\n        setAndTestSet(ModernAllTypesObject())\n        setAndTestMap(ModernAllTypesObject())\n        setAndTestFailableCustomMappings(FailableCustomObject())\n    }\n\n    func testManagedAccessorsReadFromRealm() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let object = realm.create(ModernAllTypesObject.self)\n        setAndTestAllPropertiesViaNormalAccess(object)\n        setAndTestAllPropertiesViaSubscript(object)\n        setAndTestAllPropertiesViaAccessor(object)\n        setAndTestList(object)\n        setAndTestSet(object)\n        setAndTestMap(object)\n        setAndTestFailableCustomMappings(realm.create(FailableCustomObject.self))\n        realm.cancelWrite()\n    }\n\n    func testManagedAccessorsAddedToRealm() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let object = ModernAllTypesObject()\n        realm.add(object)\n        setAndTestAllPropertiesViaNormalAccess(object)\n        setAndTestAllPropertiesViaSubscript(object)\n        setAndTestAllPropertiesViaAccessor(object)\n        setAndTestList(object)\n        setAndTestSet(object)\n        setAndTestMap(object)\n        realm.cancelWrite()\n    }\n\n    func testThreadChecking() {\n        let realm = try! Realm()\n        nonisolated(unsafe) var obj: ModernAllTypesObject!\n        try! realm.write {\n            obj = realm.create(ModernAllTypesObject.self)\n            // Create the lazily-initialized List to test the cached codepath\n            obj.arrayInt.removeAll()\n            obj.arrayInt8.removeAll()\n        }\n        dispatchSyncBackground { unsafeSelf in\n            unsafeSelf.assertThrows(_ = obj.intCol, reason: \"incorrect thread\")\n            unsafeSelf.assertThrows(obj.arrayInt.removeAll(), reason: \"incorrect thread\")\n            unsafeSelf.assertThrows(obj.int8Col = 5, reason: \"incorrect thread\")\n            unsafeSelf.assertThrows(obj.arrayInt8 = List<Int8>(), reason: \"incorrect thread\")\n        }\n    }\n\n    func testInvalidationChecking() {\n        let realm = try! Realm()\n        var obj: ModernAllTypesObject!\n        try! realm.write {\n            obj = realm.create(ModernAllTypesObject.self)\n            // Create the lazily-initialized List to test the cached codepath\n            obj.arrayInt.removeAll()\n            obj.arrayInt8.removeAll()\n        }\n        realm.invalidate()\n        self.assertThrows(_ = obj.intCol, reason: \"invalidated\")\n        self.assertThrows(obj.arrayInt.removeAll(), reason: \"invalidated\")\n        self.assertThrows(obj.int8Col = 5, reason: \"invalidated\")\n        self.assertThrows(obj.arrayInt8 = List<Int8>(), reason: \"invalidated\")\n    }\n\n    func testObjectWithArcMethodFamilies() {\n        let obj = ObjectWithArcMethodCategoryNames()\n        obj.allocValue = \"a\"\n        obj.initValue = \"b\"\n        obj.copyValue = \"c\"\n        obj.mutableCopyValue = \"d\"\n        obj.newValue = \"e\"\n        XCTAssertEqual(obj.allocValue, \"a\")\n        XCTAssertEqual(obj.initValue, \"b\")\n        XCTAssertEqual(obj.copyValue, \"c\")\n        XCTAssertEqual(obj.mutableCopyValue, \"d\")\n        XCTAssertEqual(obj.newValue, \"e\")\n    }\n\n    func testReadInvalidEnumValue() {\n        let realm = try! Realm()\n        realm.beginWrite()\n\n        let obj = realm.create(ModernAllTypesObject.self)\n        obj[\"optIntEnumCol\"] = 10\n        XCTAssertNil(obj.optIntEnumCol)\n        obj[\"optStringEnumCol\"] = \"10\"\n        XCTAssertNil(obj.optStringEnumCol)\n\n        let collectionsObj = realm.create(ModernCollectionsOfEnums.self)\n        (collectionsObj.listIntOpt._rlmCollection as! RLMArray<AnyObject>).add(NSNumber(value: 10))\n        XCTAssertNil(collectionsObj.listIntOpt[0])\n        (collectionsObj.setStringOpt._rlmCollection as! RLMSet<AnyObject>).add(\"abc\" as AnyObject)\n        XCTAssertNil(collectionsObj.setStringOpt[0])\n        (collectionsObj.mapStringOpt._rlmCollection as! RLMDictionary<NSString, AnyObject>).setObject(\"abc\" as AnyObject, forKey: \"key\")\n        XCTAssertEqual(collectionsObj.mapStringOpt[\"key\"], EnumString??.some(nil))\n\n        realm.cancelWrite()\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/ModernObjectCreationTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\nimport Realm.Private\n\nclass ModernObjectCreationTests: TestCase {\n    var values: [String: Any]!\n    override func setUp() {\n        values = [\n            \"boolCol\": true,\n            \"intCol\": 10,\n            \"int8Col\": 11 as Int8,\n            \"int16Col\": 12 as Int16,\n            \"int32Col\": 13 as Int32,\n            \"int64Col\": 14 as Int64,\n            \"floatCol\": 15 as Float,\n            \"doubleCol\": 16 as Double,\n            \"stringCol\": \"a\",\n            \"binaryCol\": Data(\"b\".utf8),\n            \"dateCol\": Date(timeIntervalSince1970: 17),\n            \"decimalCol\": 18 as Decimal128,\n            \"objectIdCol\": ObjectId.generate(),\n            \"objectCol\": ModernAllTypesObject(value: [\"intCol\": 1]),\n            \"arrayCol\": [\n                ModernAllTypesObject(value: [\"intCol\": 2]),\n                ModernAllTypesObject(value: [\"intCol\": 3])\n            ],\n            \"setCol\": [\n                ModernAllTypesObject(value: [\"intCol\": 4]),\n                ModernAllTypesObject(value: [\"intCol\": 5]),\n                ModernAllTypesObject(value: [\"intCol\": 6])\n            ],\n            \"anyCol\": AnyRealmValue.int(20),\n            \"uuidCol\": UUID(),\n            \"intEnumCol\": ModernIntEnum.value2,\n            \"stringEnumCol\": ModernStringEnum.value3,\n\n            \"optBoolCol\": false,\n            \"optIntCol\": 30,\n            \"optInt8Col\": 31 as Int8,\n            \"optInt16Col\": 32 as Int16,\n            \"optInt32Col\": 33 as Int32,\n            \"optInt64Col\": 34 as Int64,\n            \"optFloatCol\": 35 as Float,\n            \"optDoubleCol\": 36 as Double,\n            \"optStringCol\": \"c\",\n            \"optBinaryCol\": Data(\"d\".utf8),\n            \"optDateCol\": Date(timeIntervalSince1970: 37),\n            \"optDecimalCol\": 38 as Decimal128,\n            \"optObjectIdCol\": ObjectId.generate(),\n            \"optUuidCol\": UUID(),\n            \"optIntEnumCol\": ModernIntEnum.value1,\n            \"optStringEnumCol\": ModernStringEnum.value1,\n\n            \"arrayBool\": [true, false] as [Bool],\n            \"arrayInt\": [1, 1, 2, 3] as [Int],\n            \"arrayInt8\": [1, 2, 3, 1] as [Int8],\n            \"arrayInt16\": [1, 2, 3, 1] as [Int16],\n            \"arrayInt32\": [1, 2, 3, 1] as [Int32],\n            \"arrayInt64\": [1, 2, 3, 1] as [Int64],\n            \"arrayFloat\": [1 as Float, 2 as Float, 3 as Float, 1 as Float],\n            \"arrayDouble\": [1 as Double, 2 as Double, 3 as Double, 1 as Double],\n            \"arrayString\": [\"a\", \"b\", \"c\"] as [String],\n            \"arrayBinary\": [Data(\"a\".utf8)] as [Data],\n            \"arrayDate\": [Date(), Date()] as [Date],\n            \"arrayDecimal\": [1 as Decimal128, 2 as Decimal128],\n            \"arrayObjectId\": [ObjectId.generate(), ObjectId.generate()],\n            \"arrayAny\": [.none, .int(1), .string(\"a\"), .none] as [AnyRealmValue],\n            \"arrayUuid\": [UUID(), UUID(), UUID()],\n\n            \"arrayOptBool\": [true, false, nil] as [Bool?],\n            \"arrayOptInt\": [1, 1, 2, 3, nil] as [Int?],\n            \"arrayOptInt8\": [1, 2, 3, 1, nil] as [Int8?],\n            \"arrayOptInt16\": [1, 2, 3, 1, nil] as [Int16?],\n            \"arrayOptInt32\": [1, 2, 3, 1, nil] as [Int32?],\n            \"arrayOptInt64\": [1, 2, 3, 1, nil] as [Int64?],\n            \"arrayOptFloat\": [1 as Float, 2 as Float, 3 as Float, 1 as Float, nil],\n            \"arrayOptDouble\": [1 as Double, 2 as Double, 3 as Double, 1 as Double, nil],\n            \"arrayOptString\": [\"a\", \"b\", \"c\", nil],\n            \"arrayOptBinary\": [Data(\"a\".utf8), nil],\n            \"arrayOptDate\": [Date(), Date(), nil],\n            \"arrayOptDecimal\": [1 as Decimal128, 2 as Decimal128, nil],\n            \"arrayOptObjectId\": [ObjectId.generate(), ObjectId.generate(), nil],\n            \"arrayOptUuid\": [UUID(), UUID(), UUID(), nil],\n\n            \"setBool\": [true, false] as [Bool],\n            \"setInt\": [1, 1, 2, 3] as [Int],\n            \"setInt8\": [1, 2, 3, 1] as [Int8],\n            \"setInt16\": [1, 2, 3, 1] as [Int16],\n            \"setInt32\": [1, 2, 3, 1] as [Int32],\n            \"setInt64\": [1, 2, 3, 1] as [Int64],\n            \"setFloat\": [1 as Float, 2 as Float, 3 as Float, 1 as Float],\n            \"setDouble\": [1 as Double, 2 as Double, 3 as Double, 1 as Double],\n            \"setString\": [\"a\", \"b\", \"c\"] as [String],\n            \"setBinary\": [Data(\"a\".utf8)] as [Data],\n            \"setDate\": [Date(), Date()] as [Date],\n            \"setDecimal\": [1 as Decimal128, 2 as Decimal128],\n            \"setObjectId\": [ObjectId.generate(), ObjectId.generate()],\n            \"setAny\": [.none, .int(1), .string(\"a\"), .none] as [AnyRealmValue],\n            \"setUuid\": [UUID(), UUID(), UUID()],\n\n            \"setOptBool\": [true, false, nil] as [Bool?],\n            \"setOptInt\": [1, 1, 2, 3, nil] as [Int?],\n            \"setOptInt8\": [1, 2, 3, 1, nil] as [Int8?],\n            \"setOptInt16\": [1, 2, 3, 1, nil] as [Int16?],\n            \"setOptInt32\": [1, 2, 3, 1, nil] as [Int32?],\n            \"setOptInt64\": [1, 2, 3, 1, nil] as [Int64?],\n            \"setOptFloat\": [1 as Float, 2 as Float, 3 as Float, 1 as Float, nil],\n            \"setOptDouble\": [1 as Double, 2 as Double, 3 as Double, 1 as Double, nil],\n            \"setOptString\": [\"a\", \"b\", \"c\", nil],\n            \"setOptBinary\": [Data(\"a\".utf8), nil],\n            \"setOptDate\": [Date(), Date(), nil],\n            \"setOptDecimal\": [1 as Decimal128, 2 as Decimal128, nil],\n            \"setOptObjectId\": [ObjectId.generate(), ObjectId.generate(), nil],\n            \"setOptUuid\": [UUID(), UUID(), UUID(), nil],\n\n            \"mapBool\": [\"1\": true, \"2\": false] as [String: Bool],\n            \"mapInt\": [\"1\": 1, \"2\": 1, \"3\": 2, \"4\": 3] as [String: Int],\n            \"mapInt8\": [\"1\": 1, \"2\": 2, \"3\": 3, \"4\": 1] as [String: Int8],\n            \"mapInt16\": [\"1\": 1, \"2\": 2, \"3\": 3, \"4\": 1] as [String: Int16],\n            \"mapInt32\": [\"1\": 1, \"2\": 2, \"3\": 3, \"4\": 1] as [String: Int32],\n            \"mapInt64\": [\"1\": 1, \"2\": 2, \"3\": 3, \"4\": 1] as [String: Int64],\n            \"mapFloat\": [\"1\": 1 as Float, \"2\": 2 as Float, \"3\": 3 as Float, \"4\": 1 as Float],\n            \"mapDouble\": [\"1\": 1 as Double, \"2\": 2 as Double, \"3\": 3 as Double, \"4\": 1 as Double],\n            \"mapString\": [\"1\": \"a\", \"2\": \"b\", \"3\": \"c\"] as [String: String],\n            \"mapBinary\": [\"1\": Data(\"a\".utf8)] as [String: Data],\n            \"mapDate\": [\"1\": Date(), \"2\": Date()] as [String: Date],\n            \"mapDecimal\": [\"1\": 1 as Decimal128, \"2\": 2 as Decimal128],\n            \"mapObjectId\": [\"1\": ObjectId.generate(), \"2\": ObjectId.generate()],\n            \"mapAny\": [\"1\": .none, \"2\": .int(1), \"3\": .string(\"a\"), \"4\": .none] as [String: AnyRealmValue],\n            \"mapUuid\": [\"1\": UUID(), \"2\": UUID(), \"3\": UUID()],\n\n            \"mapOptBool\": [\"1\": true, \"2\": false, \"3\": nil] as [String: Bool?],\n            \"mapOptInt\": [\"1\": 1, \"2\": 1, \"3\": 2, \"4\": 3, \"5\": nil] as [String: Int?],\n            \"mapOptInt8\": [\"1\": 1, \"2\": 2, \"3\": 3, \"4\": 1, \"5\": nil] as [String: Int8?],\n            \"mapOptInt16\": [\"1\": 1, \"2\": 2, \"3\": 3, \"4\": 1, \"5\": nil] as [String: Int16?],\n            \"mapOptInt32\": [\"1\": 1, \"2\": 2, \"3\": 3, \"4\": 1, \"5\": nil] as [String: Int32?],\n            \"mapOptInt64\": [\"1\": 1, \"2\": 2, \"3\": 3, \"4\": 1, \"5\": nil] as [String: Int64?],\n            \"mapOptFloat\": [\"1\": 1 as Float, \"2\": 2 as Float, \"3\": 3 as Float, \"4\": 1 as Float, \"5\": nil],\n            \"mapOptDouble\": [\"1\": 1 as Double, \"2\": 2 as Double, \"3\": 3 as Double, \"4\": 1 as Double, \"5\": nil],\n            \"mapOptString\": [\"1\": \"a\", \"2\": \"b\", \"3\": \"c\", \"4\": nil],\n            \"mapOptBinary\": [\"1\": Data(\"a\".utf8), \"2\": nil],\n            \"mapOptDate\": [\"1\": Date(), \"2\": Date(), \"3\": nil],\n            \"mapOptDecimal\": [\"1\": 1 as Decimal128, \"2\": 2 as Decimal128, \"3\": nil],\n            \"mapOptObjectId\": [\"1\": ObjectId.generate(), \"2\": ObjectId.generate(), \"3\": nil],\n            \"mapOptUuid\": [\"1\": UUID(), \"2\": UUID(), \"3\": UUID(), \"4\": nil],\n        ]\n        super.setUp()\n    }\n\n    override func tearDown() {\n        values = nil\n        super.tearDown()\n    }\n\n    func nullValues() -> [String: Any] {\n        return values.merging([\n            \"objectCol\": NSNull(),\n            \"anyCol\": AnyRealmValue.none,\n\n            \"optBoolCol\": NSNull(),\n            \"optIntCol\": NSNull(),\n            \"optInt8Col\": NSNull(),\n            \"optInt16Col\": NSNull(),\n            \"optInt32Col\": NSNull(),\n            \"optInt64Col\": NSNull(),\n            \"optFloatCol\": NSNull(),\n            \"optDoubleCol\": NSNull(),\n            \"optStringCol\": NSNull(),\n            \"optBinaryCol\": NSNull(),\n            \"optDateCol\": NSNull(),\n            \"optDecimalCol\": NSNull(),\n            \"optObjectIdCol\": NSNull(),\n            \"optUuidCol\": NSNull(),\n            \"optIntEnumCol\": NSNull(),\n            \"optStringEnumCol\": NSNull(),\n\n            \"arrayAny\": [AnyRealmValue.none],\n            \"arrayOptBool\": [NSNull()],\n            \"arrayOptInt\": [NSNull()],\n            \"arrayOptInt8\": [NSNull()],\n            \"arrayOptInt16\": [NSNull()],\n            \"arrayOptInt32\": [NSNull()],\n            \"arrayOptInt64\": [NSNull()],\n            \"arrayOptFloat\": [NSNull()],\n            \"arrayOptDouble\": [NSNull()],\n            \"arrayOptString\": [NSNull()],\n            \"arrayOptBinary\": [NSNull()],\n            \"arrayOptDate\": [NSNull()],\n            \"arrayOptDecimal\": [NSNull()],\n            \"arrayOptObjectId\": [NSNull()],\n            \"arrayOptUuid\": [NSNull()],\n\n            \"setAny\": [AnyRealmValue.none],\n            \"setOptBool\": [NSNull()],\n            \"setOptInt\": [NSNull()],\n            \"setOptInt8\": [NSNull()],\n            \"setOptInt16\": [NSNull()],\n            \"setOptInt32\": [NSNull()],\n            \"setOptInt64\": [NSNull()],\n            \"setOptFloat\": [NSNull()],\n            \"setOptDouble\": [NSNull()],\n            \"setOptString\": [NSNull()],\n            \"setOptBinary\": [NSNull()],\n            \"setOptDate\": [NSNull()],\n            \"setOptDecimal\": [NSNull()],\n            \"setOptObjectId\": [NSNull()],\n            \"setOptUuid\": [NSNull()],\n\n            \"mapAny\": [\"1\": AnyRealmValue.none],\n            \"mapOptBool\": [\"1\": NSNull()],\n            \"mapOptInt\": [\"1\": NSNull()],\n            \"mapOptInt8\": [\"1\": NSNull()],\n            \"mapOptInt16\": [\"1\": NSNull()],\n            \"mapOptInt32\": [\"1\": NSNull()],\n            \"mapOptInt64\": [\"1\": NSNull()],\n            \"mapOptFloat\": [\"1\": NSNull()],\n            \"mapOptDouble\": [\"1\": NSNull()],\n            \"mapOptString\": [\"1\": NSNull()],\n            \"mapOptBinary\": [\"1\": NSNull()],\n            \"mapOptDate\": [\"1\": NSNull()],\n            \"mapOptDecimal\": [\"1\": NSNull()],\n            \"mapOptObjectId\": [\"1\": NSNull()],\n            \"mapOptUuid\": [\"1\": NSNull()]\n        ] as [String: Any]) { _, null in null }\n    }\n\n    func assertSetEquals<T: RealmCollectionValue>(_ set: MutableSet<T>, _ expected: Array<T>) {\n        XCTAssertEqual(set.count, Set(expected).count)\n        XCTAssertEqual(Set(set), Set(expected))\n    }\n\n    func assertEquivalent(_ actual: AnyRealmCollection<ModernAllTypesObject>,\n                          _ expected: Array<ModernAllTypesObject>,\n                          expectedShouldBeCopy: Bool) {\n        XCTAssertEqual(actual.count, expected.count)\n        for obj in expected {\n            if expectedShouldBeCopy {\n                XCTAssertTrue(actual.contains { $0.pk == obj.pk })\n            } else {\n                XCTAssertTrue(actual.contains(obj))\n            }\n        }\n    }\n\n    func assertMapEquals<T: RealmCollectionValue>(_ actual: Map<String, T>, _ expected: Dictionary<String, T>) {\n        XCTAssertEqual(actual.count, expected.count)\n        for (key, value) in expected {\n            XCTAssertEqual(actual[key], value)\n        }\n    }\n\n    func verifyObject(_ obj: ModernAllTypesObject, expectedShouldBeCopy: Bool = true) {\n        XCTAssertEqual(obj.boolCol, values[\"boolCol\"] as! Bool)\n        XCTAssertEqual(obj.intCol, values[\"intCol\"] as! Int)\n        XCTAssertEqual(obj.int8Col, values[\"int8Col\"] as! Int8)\n        XCTAssertEqual(obj.int16Col, values[\"int16Col\"] as! Int16)\n        XCTAssertEqual(obj.int32Col, values[\"int32Col\"] as! Int32)\n        XCTAssertEqual(obj.int64Col, values[\"int64Col\"] as! Int64)\n        XCTAssertEqual(obj.floatCol, values[\"floatCol\"] as! Float)\n        XCTAssertEqual(obj.doubleCol, values[\"doubleCol\"] as! Double)\n        XCTAssertEqual(obj.stringCol, values[\"stringCol\"] as! String)\n        XCTAssertEqual(obj.binaryCol, values[\"binaryCol\"] as! Data)\n        XCTAssertEqual(obj.dateCol, values[\"dateCol\"] as! Date)\n        XCTAssertEqual(obj.decimalCol, values[\"decimalCol\"] as! Decimal128)\n        XCTAssertEqual(obj.objectIdCol, values[\"objectIdCol\"] as! ObjectId)\n        XCTAssertEqual(obj.objectCol!.pk, (values[\"objectCol\"] as! ModernAllTypesObject?)!.pk)\n        assertEquivalent(AnyRealmCollection(obj.arrayCol),\n                         values[\"arrayCol\"] as! [ModernAllTypesObject],\n                         expectedShouldBeCopy: expectedShouldBeCopy)\n        assertEquivalent(AnyRealmCollection(obj.setCol),\n                         values[\"setCol\"] as! [ModernAllTypesObject],\n                         expectedShouldBeCopy: expectedShouldBeCopy)\n        XCTAssertEqual(obj.anyCol, values[\"anyCol\"] as! AnyRealmValue)\n        XCTAssertEqual(obj.uuidCol, values[\"uuidCol\"] as! UUID)\n        XCTAssertEqual(obj.intEnumCol, values[\"intEnumCol\"] as! ModernIntEnum)\n        XCTAssertEqual(obj.stringEnumCol, values[\"stringEnumCol\"] as! ModernStringEnum)\n\n        XCTAssertEqual(obj.optBoolCol, values[\"optBoolCol\"] as! Bool?)\n        XCTAssertEqual(obj.optIntCol, values[\"optIntCol\"] as! Int?)\n        XCTAssertEqual(obj.optInt8Col, values[\"optInt8Col\"] as! Int8?)\n        XCTAssertEqual(obj.optInt16Col, values[\"optInt16Col\"] as! Int16?)\n        XCTAssertEqual(obj.optInt32Col, values[\"optInt32Col\"] as! Int32?)\n        XCTAssertEqual(obj.optInt64Col, values[\"optInt64Col\"] as! Int64?)\n        XCTAssertEqual(obj.optFloatCol, values[\"optFloatCol\"] as! Float?)\n        XCTAssertEqual(obj.optDoubleCol, values[\"optDoubleCol\"] as! Double?)\n        XCTAssertEqual(obj.optStringCol, values[\"optStringCol\"] as! String?)\n        XCTAssertEqual(obj.optBinaryCol, values[\"optBinaryCol\"] as! Data?)\n        XCTAssertEqual(obj.optDateCol, values[\"optDateCol\"] as! Date?)\n        XCTAssertEqual(obj.optDecimalCol, values[\"optDecimalCol\"] as! Decimal128?)\n        XCTAssertEqual(obj.optObjectIdCol, values[\"optObjectIdCol\"] as! ObjectId?)\n        XCTAssertEqual(obj.optUuidCol, values[\"optUuidCol\"] as! UUID?)\n        XCTAssertEqual(obj.optIntEnumCol, values[\"optIntEnumCol\"] as! ModernIntEnum?)\n        XCTAssertEqual(obj.optStringEnumCol, values[\"optStringEnumCol\"] as! ModernStringEnum?)\n\n        XCTAssertEqual(Array(obj.arrayBool), values[\"arrayBool\"] as! [Bool])\n        XCTAssertEqual(Array(obj.arrayInt), values[\"arrayInt\"] as! [Int])\n        XCTAssertEqual(Array(obj.arrayInt8), values[\"arrayInt8\"] as! [Int8])\n        XCTAssertEqual(Array(obj.arrayInt16), values[\"arrayInt16\"] as! [Int16])\n        XCTAssertEqual(Array(obj.arrayInt32), values[\"arrayInt32\"] as! [Int32])\n        XCTAssertEqual(Array(obj.arrayInt64), values[\"arrayInt64\"] as! [Int64])\n        XCTAssertEqual(Array(obj.arrayFloat), values[\"arrayFloat\"] as! [Float])\n        XCTAssertEqual(Array(obj.arrayDouble), values[\"arrayDouble\"] as! [Double])\n        XCTAssertEqual(Array(obj.arrayString), values[\"arrayString\"] as! [String])\n        XCTAssertEqual(Array(obj.arrayBinary), values[\"arrayBinary\"] as! [Data])\n        XCTAssertEqual(Array(obj.arrayDate), values[\"arrayDate\"] as! [Date])\n        XCTAssertEqual(Array(obj.arrayDecimal), values[\"arrayDecimal\"] as! [Decimal128])\n        XCTAssertEqual(Array(obj.arrayObjectId), values[\"arrayObjectId\"] as! [ObjectId])\n        XCTAssertEqual(Array(obj.arrayAny), values[\"arrayAny\"] as! [AnyRealmValue])\n        XCTAssertEqual(Array(obj.arrayUuid), values[\"arrayUuid\"] as! [UUID])\n\n        XCTAssertEqual(Array(obj.arrayOptBool), values[\"arrayOptBool\"] as! [Bool?])\n        XCTAssertEqual(Array(obj.arrayOptInt), values[\"arrayOptInt\"] as! [Int?])\n        XCTAssertEqual(Array(obj.arrayOptInt8), values[\"arrayOptInt8\"] as! [Int8?])\n        XCTAssertEqual(Array(obj.arrayOptInt16), values[\"arrayOptInt16\"] as! [Int16?])\n        XCTAssertEqual(Array(obj.arrayOptInt32), values[\"arrayOptInt32\"] as! [Int32?])\n        XCTAssertEqual(Array(obj.arrayOptInt64), values[\"arrayOptInt64\"] as! [Int64?])\n        XCTAssertEqual(Array(obj.arrayOptFloat), values[\"arrayOptFloat\"] as! [Float?])\n        XCTAssertEqual(Array(obj.arrayOptDouble), values[\"arrayOptDouble\"] as! [Double?])\n        XCTAssertEqual(Array(obj.arrayOptString), values[\"arrayOptString\"] as! [String?])\n        XCTAssertEqual(Array(obj.arrayOptBinary), values[\"arrayOptBinary\"] as! [Data?])\n        XCTAssertEqual(Array(obj.arrayOptDate), values[\"arrayOptDate\"] as! [Date?])\n        XCTAssertEqual(Array(obj.arrayOptDecimal), values[\"arrayOptDecimal\"] as! [Decimal128?])\n        XCTAssertEqual(Array(obj.arrayOptObjectId), values[\"arrayOptObjectId\"] as! [ObjectId?])\n        XCTAssertEqual(Array(obj.arrayOptUuid), values[\"arrayOptUuid\"] as! [UUID?])\n\n        assertSetEquals(obj.setBool, values[\"setBool\"] as! [Bool])\n        assertSetEquals(obj.setInt, values[\"setInt\"] as! [Int])\n        assertSetEquals(obj.setInt8, values[\"setInt8\"] as! [Int8])\n        assertSetEquals(obj.setInt16, values[\"setInt16\"] as! [Int16])\n        assertSetEquals(obj.setInt32, values[\"setInt32\"] as! [Int32])\n        assertSetEquals(obj.setInt64, values[\"setInt64\"] as! [Int64])\n        assertSetEquals(obj.setFloat, values[\"setFloat\"] as! [Float])\n        assertSetEquals(obj.setDouble, values[\"setDouble\"] as! [Double])\n        assertSetEquals(obj.setString, values[\"setString\"] as! [String])\n        assertSetEquals(obj.setBinary, values[\"setBinary\"] as! [Data])\n        assertSetEquals(obj.setDate, values[\"setDate\"] as! [Date])\n        assertSetEquals(obj.setDecimal, values[\"setDecimal\"] as! [Decimal128])\n        assertSetEquals(obj.setObjectId, values[\"setObjectId\"] as! [ObjectId])\n        assertSetEquals(obj.setAny, values[\"setAny\"] as! [AnyRealmValue])\n        assertSetEquals(obj.setUuid, values[\"setUuid\"] as! [UUID])\n\n        assertSetEquals(obj.setOptBool, values[\"setOptBool\"] as! [Bool?])\n        assertSetEquals(obj.setOptInt, values[\"setOptInt\"] as! [Int?])\n        assertSetEquals(obj.setOptInt8, values[\"setOptInt8\"] as! [Int8?])\n        assertSetEquals(obj.setOptInt16, values[\"setOptInt16\"] as! [Int16?])\n        assertSetEquals(obj.setOptInt32, values[\"setOptInt32\"] as! [Int32?])\n        assertSetEquals(obj.setOptInt64, values[\"setOptInt64\"] as! [Int64?])\n        assertSetEquals(obj.setOptFloat, values[\"setOptFloat\"] as! [Float?])\n        assertSetEquals(obj.setOptDouble, values[\"setOptDouble\"] as! [Double?])\n        assertSetEquals(obj.setOptString, values[\"setOptString\"] as! [String?])\n        assertSetEquals(obj.setOptBinary, values[\"setOptBinary\"] as! [Data?])\n        assertSetEquals(obj.setOptDate, values[\"setOptDate\"] as! [Date?])\n        assertSetEquals(obj.setOptDecimal, values[\"setOptDecimal\"] as! [Decimal128?])\n        assertSetEquals(obj.setOptObjectId, values[\"setOptObjectId\"] as! [ObjectId?])\n        assertSetEquals(obj.setOptUuid, values[\"setOptUuid\"] as! [UUID?])\n\n        assertMapEquals(obj.mapBool, values[\"mapBool\"] as! [String: Bool])\n        assertMapEquals(obj.mapInt, values[\"mapInt\"] as! [String: Int])\n        assertMapEquals(obj.mapInt8, values[\"mapInt8\"] as! [String: Int8])\n        assertMapEquals(obj.mapInt16, values[\"mapInt16\"] as! [String: Int16])\n        assertMapEquals(obj.mapInt32, values[\"mapInt32\"] as! [String: Int32])\n        assertMapEquals(obj.mapInt64, values[\"mapInt64\"] as! [String: Int64])\n        assertMapEquals(obj.mapFloat, values[\"mapFloat\"] as! [String: Float])\n        assertMapEquals(obj.mapDouble, values[\"mapDouble\"] as! [String: Double])\n        assertMapEquals(obj.mapString, values[\"mapString\"] as! [String: String])\n        assertMapEquals(obj.mapBinary, values[\"mapBinary\"] as! [String: Data])\n        assertMapEquals(obj.mapDate, values[\"mapDate\"] as! [String: Date])\n        assertMapEquals(obj.mapDecimal, values[\"mapDecimal\"] as! [String: Decimal128])\n        assertMapEquals(obj.mapObjectId, values[\"mapObjectId\"] as! [String: ObjectId])\n        assertMapEquals(obj.mapAny, values[\"mapAny\"] as! [String: AnyRealmValue])\n        assertMapEquals(obj.mapUuid, values[\"mapUuid\"] as! [String: UUID])\n\n        assertMapEquals(obj.mapOptBool, values[\"mapOptBool\"] as! [String: Bool?])\n        assertMapEquals(obj.mapOptInt, values[\"mapOptInt\"] as! [String: Int?])\n        assertMapEquals(obj.mapOptInt8, values[\"mapOptInt8\"] as! [String: Int8?])\n        assertMapEquals(obj.mapOptInt16, values[\"mapOptInt16\"] as! [String: Int16?])\n        assertMapEquals(obj.mapOptInt32, values[\"mapOptInt32\"] as! [String: Int32?])\n        assertMapEquals(obj.mapOptInt64, values[\"mapOptInt64\"] as! [String: Int64?])\n        assertMapEquals(obj.mapOptFloat, values[\"mapOptFloat\"] as! [String: Float?])\n        assertMapEquals(obj.mapOptDouble, values[\"mapOptDouble\"] as! [String: Double?])\n        assertMapEquals(obj.mapOptString, values[\"mapOptString\"] as! [String: String?])\n        assertMapEquals(obj.mapOptBinary, values[\"mapOptBinary\"] as! [String: Data?])\n        assertMapEquals(obj.mapOptDate, values[\"mapOptDate\"] as! [String: Date?])\n        assertMapEquals(obj.mapOptDecimal, values[\"mapOptDecimal\"] as! [String: Decimal128?])\n        assertMapEquals(obj.mapOptObjectId, values[\"mapOptObjectId\"] as! [String: ObjectId?])\n        assertMapEquals(obj.mapOptUuid, values[\"mapOptUuid\"] as! [String: UUID?])\n    }\n\n    func verifyDefault(_ obj: ModernAllTypesObject) {\n        XCTAssertEqual(obj.boolCol, false)\n        XCTAssertEqual(obj.intCol, 0)\n        XCTAssertEqual(obj.int8Col, 1)\n        XCTAssertEqual(obj.int16Col, 2)\n        XCTAssertEqual(obj.int32Col, 3)\n        XCTAssertEqual(obj.int64Col, 4)\n        XCTAssertEqual(obj.floatCol, 5)\n        XCTAssertEqual(obj.doubleCol, 6)\n        XCTAssertEqual(obj.stringCol, \"\")\n        XCTAssertEqual(obj.binaryCol, Data())\n        XCTAssertEqual(obj.decimalCol, 0)\n        XCTAssertNotEqual(obj.objectIdCol, ObjectId()) // should have generated a random ObjectId\n        XCTAssertEqual(obj.objectCol, nil)\n        XCTAssertEqual(obj.arrayCol.count, 0)\n        XCTAssertEqual(obj.setCol.count, 0)\n        XCTAssertEqual(obj.anyCol, .none)\n        XCTAssertNotEqual(obj.uuidCol, UUID()) // should have generated a random UUID\n        XCTAssertEqual(obj.intEnumCol, .value1)\n        XCTAssertEqual(obj.stringEnumCol, .value1)\n\n        XCTAssertNil(obj.optIntCol)\n        XCTAssertNil(obj.optInt8Col)\n        XCTAssertNil(obj.optInt16Col)\n        XCTAssertNil(obj.optInt32Col)\n        XCTAssertNil(obj.optInt64Col)\n        XCTAssertNil(obj.optFloatCol)\n        XCTAssertNil(obj.optDoubleCol)\n        XCTAssertNil(obj.optBoolCol)\n        XCTAssertNil(obj.optStringCol)\n        XCTAssertNil(obj.optBinaryCol)\n        XCTAssertNil(obj.optDateCol)\n        XCTAssertNil(obj.optDecimalCol)\n        XCTAssertNil(obj.optObjectIdCol)\n        XCTAssertNil(obj.optUuidCol)\n        XCTAssertNil(obj.optIntEnumCol)\n        XCTAssertNil(obj.optStringEnumCol)\n\n        XCTAssertEqual(obj.arrayBool.count, 0)\n        XCTAssertEqual(obj.arrayInt.count, 0)\n        XCTAssertEqual(obj.arrayInt8.count, 0)\n        XCTAssertEqual(obj.arrayInt16.count, 0)\n        XCTAssertEqual(obj.arrayInt32.count, 0)\n        XCTAssertEqual(obj.arrayInt64.count, 0)\n        XCTAssertEqual(obj.arrayFloat.count, 0)\n        XCTAssertEqual(obj.arrayDouble.count, 0)\n        XCTAssertEqual(obj.arrayString.count, 0)\n        XCTAssertEqual(obj.arrayBinary.count, 0)\n        XCTAssertEqual(obj.arrayDate.count, 0)\n        XCTAssertEqual(obj.arrayDecimal.count, 0)\n        XCTAssertEqual(obj.arrayObjectId.count, 0)\n        XCTAssertEqual(obj.arrayAny.count, 0)\n        XCTAssertEqual(obj.arrayUuid.count, 0)\n\n        XCTAssertEqual(obj.arrayOptBool.count, 0)\n        XCTAssertEqual(obj.arrayOptInt.count, 0)\n        XCTAssertEqual(obj.arrayOptInt8.count, 0)\n        XCTAssertEqual(obj.arrayOptInt16.count, 0)\n        XCTAssertEqual(obj.arrayOptInt32.count, 0)\n        XCTAssertEqual(obj.arrayOptInt64.count, 0)\n        XCTAssertEqual(obj.arrayOptFloat.count, 0)\n        XCTAssertEqual(obj.arrayOptDouble.count, 0)\n        XCTAssertEqual(obj.arrayOptString.count, 0)\n        XCTAssertEqual(obj.arrayOptBinary.count, 0)\n        XCTAssertEqual(obj.arrayOptDate.count, 0)\n        XCTAssertEqual(obj.arrayOptDecimal.count, 0)\n        XCTAssertEqual(obj.arrayOptObjectId.count, 0)\n        XCTAssertEqual(obj.arrayOptUuid.count, 0)\n\n        XCTAssertEqual(obj.setBool.count, 0)\n        XCTAssertEqual(obj.setInt.count, 0)\n        XCTAssertEqual(obj.setInt8.count, 0)\n        XCTAssertEqual(obj.setInt16.count, 0)\n        XCTAssertEqual(obj.setInt32.count, 0)\n        XCTAssertEqual(obj.setInt64.count, 0)\n        XCTAssertEqual(obj.setFloat.count, 0)\n        XCTAssertEqual(obj.setDouble.count, 0)\n        XCTAssertEqual(obj.setString.count, 0)\n        XCTAssertEqual(obj.setBinary.count, 0)\n        XCTAssertEqual(obj.setDate.count, 0)\n        XCTAssertEqual(obj.setDecimal.count, 0)\n        XCTAssertEqual(obj.setObjectId.count, 0)\n        XCTAssertEqual(obj.setAny.count, 0)\n        XCTAssertEqual(obj.setUuid.count, 0)\n\n        XCTAssertEqual(obj.setOptBool.count, 0)\n        XCTAssertEqual(obj.setOptInt.count, 0)\n        XCTAssertEqual(obj.setOptInt8.count, 0)\n        XCTAssertEqual(obj.setOptInt16.count, 0)\n        XCTAssertEqual(obj.setOptInt32.count, 0)\n        XCTAssertEqual(obj.setOptInt64.count, 0)\n        XCTAssertEqual(obj.setOptFloat.count, 0)\n        XCTAssertEqual(obj.setOptDouble.count, 0)\n        XCTAssertEqual(obj.setOptString.count, 0)\n        XCTAssertEqual(obj.setOptBinary.count, 0)\n        XCTAssertEqual(obj.setOptDate.count, 0)\n        XCTAssertEqual(obj.setOptDecimal.count, 0)\n        XCTAssertEqual(obj.setOptObjectId.count, 0)\n        XCTAssertEqual(obj.setOptUuid.count, 0)\n    }\n\n    func verifyNil(_ obj: ModernAllTypesObject) {\n        // \"anyCol\": .none,\n\n        XCTAssertNil(obj.objectCol)\n        XCTAssertNil(obj.optBoolCol)\n        XCTAssertNil(obj.optIntCol)\n        XCTAssertNil(obj.optInt8Col)\n        XCTAssertNil(obj.optInt16Col)\n        XCTAssertNil(obj.optInt32Col)\n        XCTAssertNil(obj.optInt64Col)\n        XCTAssertNil(obj.optFloatCol)\n        XCTAssertNil(obj.optDoubleCol)\n        XCTAssertNil(obj.optStringCol)\n        XCTAssertNil(obj.optBinaryCol)\n        XCTAssertNil(obj.optDateCol)\n        XCTAssertNil(obj.optDecimalCol)\n        XCTAssertNil(obj.optObjectIdCol)\n        XCTAssertNil(obj.optUuidCol)\n        XCTAssertNil(obj.optIntEnumCol)\n        XCTAssertNil(obj.optStringEnumCol)\n\n        XCTAssertEqual(obj.arrayAny[0], .none)\n        XCTAssertNil(obj.arrayOptBool[0])\n        XCTAssertNil(obj.arrayOptInt[0])\n        XCTAssertNil(obj.arrayOptInt8[0])\n        XCTAssertNil(obj.arrayOptInt16[0])\n        XCTAssertNil(obj.arrayOptInt32[0])\n        XCTAssertNil(obj.arrayOptInt64[0])\n        XCTAssertNil(obj.arrayOptFloat[0])\n        XCTAssertNil(obj.arrayOptDouble[0])\n        XCTAssertNil(obj.arrayOptString[0])\n        XCTAssertNil(obj.arrayOptBinary[0])\n        XCTAssertNil(obj.arrayOptDate[0])\n        XCTAssertNil(obj.arrayOptDecimal[0])\n        XCTAssertNil(obj.arrayOptObjectId[0])\n        XCTAssertNil(obj.arrayOptUuid[0])\n\n        XCTAssertEqual(obj.setAny.first!, .none)\n        XCTAssertNil(obj.setOptBool.first!)\n        XCTAssertNil(obj.setOptInt.first!)\n        XCTAssertNil(obj.setOptInt8.first!)\n        XCTAssertNil(obj.setOptInt16.first!)\n        XCTAssertNil(obj.setOptInt32.first!)\n        XCTAssertNil(obj.setOptInt64.first!)\n        XCTAssertNil(obj.setOptFloat.first!)\n        XCTAssertNil(obj.setOptDouble.first!)\n        XCTAssertNil(obj.setOptString.first!)\n        XCTAssertNil(obj.setOptBinary.first!)\n        XCTAssertNil(obj.setOptDate.first!)\n        XCTAssertNil(obj.setOptDecimal.first!)\n        XCTAssertNil(obj.setOptObjectId.first!)\n        XCTAssertNil(obj.setOptUuid.first!)\n\n        XCTAssertEqual(obj.mapAny[\"1\"], .some(.none))\n        XCTAssertEqual(obj.mapOptBool[\"1\"], .some(nil))\n        XCTAssertEqual(obj.mapOptInt[\"1\"], .some(nil))\n        XCTAssertEqual(obj.mapOptInt8[\"1\"], .some(nil))\n        XCTAssertEqual(obj.mapOptInt16[\"1\"], .some(nil))\n        XCTAssertEqual(obj.mapOptInt32[\"1\"], .some(nil))\n        XCTAssertEqual(obj.mapOptInt64[\"1\"], .some(nil))\n        XCTAssertEqual(obj.mapOptFloat[\"1\"], .some(nil))\n        XCTAssertEqual(obj.mapOptDouble[\"1\"], .some(nil))\n        XCTAssertEqual(obj.mapOptString[\"1\"], .some(nil))\n        XCTAssertEqual(obj.mapOptBinary[\"1\"], .some(nil))\n        XCTAssertEqual(obj.mapOptDate[\"1\"], .some(nil))\n        XCTAssertEqual(obj.mapOptDecimal[\"1\"], .some(nil))\n        XCTAssertEqual(obj.mapOptObjectId[\"1\"], .some(nil))\n        XCTAssertEqual(obj.mapOptUuid[\"1\"], .some(nil))\n    }\n\n    func testInitDefault() {\n        verifyDefault(ModernAllTypesObject())\n    }\n\n    func testInitWithArray() {\n        var arrayValues = ModernAllTypesObject.sharedSchema()!.properties.map { values[$0.name] }\n        arrayValues[0] = ObjectId.generate()\n        verifyObject(ModernAllTypesObject(value: arrayValues), expectedShouldBeCopy: false)\n    }\n\n    func testInitWithDictionary() {\n        verifyObject(ModernAllTypesObject(value: values!), expectedShouldBeCopy: false)\n    }\n\n    func testInitWithObject() {\n        let obj = ModernAllTypesObject(value: values!)\n        verifyObject(ModernAllTypesObject(value: obj), expectedShouldBeCopy: false)\n    }\n\n    func testInitNil() {\n        verifyNil(ModernAllTypesObject(value: nullValues()))\n    }\n\n    func testCreateDefault() {\n        let realm = try! Realm()\n        let obj = try! realm.write {\n            return realm.create(ModernAllTypesObject.self)\n        }\n        verifyDefault(obj)\n    }\n\n    func testCreateWithArray() {\n        let realm = try! Realm()\n        var arrayValues = ModernAllTypesObject.sharedSchema()!.properties.map { values[$0.name] }\n        arrayValues[0] = ObjectId.generate()\n        let obj = try! realm.write {\n            return realm.create(ModernAllTypesObject.self, value: arrayValues)\n        }\n        verifyObject(obj)\n    }\n\n    func testCreateWithDictionary() {\n        let realm = try! Realm()\n        let obj = try! realm.write {\n            return realm.create(ModernAllTypesObject.self, value: values!)\n        }\n        verifyObject(obj)\n    }\n\n    func testCreateWithObject() {\n        let realm = try! Realm()\n        let obj = try! realm.write {\n            return realm.create(ModernAllTypesObject.self, value: ModernAllTypesObject(value: values!))\n        }\n        verifyObject(obj)\n    }\n\n    func testCreateNil() {\n        let realm = try! Realm()\n        let obj = try! realm.write {\n            return realm.create(ModernAllTypesObject.self, value: nullValues())\n        }\n        verifyNil(obj)\n    }\n\n    func testAddDefault() {\n        let obj = ModernAllTypesObject()\n        let realm = try! Realm()\n        try! realm.write {\n            realm.add(obj)\n        }\n        verifyDefault(obj)\n    }\n\n    func testAdd() {\n        let obj = ModernAllTypesObject(value: values!)\n        let realm = try! Realm()\n        try! realm.write {\n            realm.add(obj)\n        }\n        verifyObject(obj, expectedShouldBeCopy: false)\n    }\n\n    func testAddNil() {\n        let obj = ModernAllTypesObject(value: nullValues())\n        let realm = try! Realm()\n        try! realm.write {\n            realm.add(obj)\n        }\n        verifyNil(obj)\n    }\n\n    func testCreateEmbeddedWithDictionary() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let parent = realm.create(ModernEmbeddedParentObject.self, value: [\n            \"object\": [\"value\": 5, \"child\": [\"value\": 6], \"children\": [[7], [8]]] as [String: Any],\n            \"array\": [[9], [10]]\n        ])\n        XCTAssertEqual(parent.object!.value, 5)\n        XCTAssertEqual(parent.object!.child!.value, 6)\n        XCTAssertEqual(parent.object!.children.count, 2)\n        XCTAssertEqual(parent.object!.children[0].value, 7)\n        XCTAssertEqual(parent.object!.children[1].value, 8)\n        XCTAssertEqual(parent.array.count, 2)\n        XCTAssertEqual(parent.array[0].value, 9)\n        XCTAssertEqual(parent.array[1].value, 10)\n\n        XCTAssertTrue(parent.isSameObject(as: parent.object!.parent1.first!))\n        XCTAssertTrue(parent.isSameObject(as: parent.array[0].parent2.first!))\n        XCTAssertTrue(parent.isSameObject(as: parent.array[1].parent2.first!))\n        XCTAssertTrue(parent.object!.isSameObject(as: parent.object!.child!.parent3.first!))\n        XCTAssertTrue(parent.object!.isSameObject(as: parent.object!.children[0].parent4.first!))\n        XCTAssertTrue(parent.object!.isSameObject(as: parent.object!.children[1].parent4.first!))\n\n        realm.cancelWrite()\n    }\n\n    func testCreateEmbeddedWithUnmanagedObjects() {\n        let sourceObject = ModernEmbeddedParentObject()\n        sourceObject.object = .init(value: [5])\n        sourceObject.object!.child = .init(value: [6])\n        sourceObject.object!.children.append(.init(value: [7]))\n        sourceObject.object!.children.append(.init(value: [8]))\n        sourceObject.array.append(.init(value: [9]))\n        sourceObject.array.append(.init(value: [10]))\n\n        let realm = try! Realm()\n        realm.beginWrite()\n        let parent = realm.create(ModernEmbeddedParentObject.self, value: sourceObject)\n        XCTAssertNil(sourceObject.realm)\n        XCTAssertEqual(parent.object!.value, 5)\n        XCTAssertEqual(parent.object!.child!.value, 6)\n        XCTAssertEqual(parent.object!.children.count, 2)\n        XCTAssertEqual(parent.object!.children[0].value, 7)\n        XCTAssertEqual(parent.object!.children[1].value, 8)\n        XCTAssertEqual(parent.array.count, 2)\n        XCTAssertEqual(parent.array[0].value, 9)\n        XCTAssertEqual(parent.array[1].value, 10)\n        realm.cancelWrite()\n    }\n\n    func testCreateEmbeddedFromManagedObjectInSameRealm() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let parent = realm.create(ModernEmbeddedParentObject.self, value: [\n            \"object\": [\"value\": 5, \"child\": [\"value\": 6], \"children\": [[7], [8]]] as [String: Any],\n            \"array\": [[9], [10]]\n        ])\n        let copy = realm.create(ModernEmbeddedParentObject.self, value: parent)\n        XCTAssertNotEqual(parent, copy)\n        XCTAssertEqual(copy.object!.value, 5)\n        XCTAssertEqual(copy.object!.child!.value, 6)\n        XCTAssertEqual(copy.object!.children.count, 2)\n        XCTAssertEqual(copy.object!.children[0].value, 7)\n        XCTAssertEqual(copy.object!.children[1].value, 8)\n        XCTAssertEqual(copy.array.count, 2)\n        XCTAssertEqual(copy.array[0].value, 9)\n        XCTAssertEqual(copy.array[1].value, 10)\n        realm.cancelWrite()\n    }\n\n    func testCreateEmbeddedFromManagedObjectInDifferentRealm() {\n        let realmA = realmWithTestPath()\n        let realmB = try! Realm()\n        realmA.beginWrite()\n        let parent = realmA.create(ModernEmbeddedParentObject.self, value: [\n            \"object\": [\"value\": 5, \"child\": [\"value\": 6], \"children\": [[7], [8]]] as [String: Any],\n            \"array\": [[9], [10]]\n        ])\n        try! realmA.commitWrite()\n\n        realmB.beginWrite()\n        let copy = realmB.create(ModernEmbeddedParentObject.self, value: parent)\n        XCTAssertNotEqual(parent, copy)\n        XCTAssertEqual(copy.object!.value, 5)\n        XCTAssertEqual(copy.object!.child!.value, 6)\n        XCTAssertEqual(copy.object!.children.count, 2)\n        XCTAssertEqual(copy.object!.children[0].value, 7)\n        XCTAssertEqual(copy.object!.children[1].value, 8)\n        XCTAssertEqual(copy.array.count, 2)\n        XCTAssertEqual(copy.array[0].value, 9)\n        XCTAssertEqual(copy.array[1].value, 10)\n        realmB.cancelWrite()\n    }\n\n    // MARK: - Add tests\n\n    class ModernEmbeddedObjectFactory {\n        private var value = 0\n        var objects = [EmbeddedObject]()\n\n        func create<T: ModernEmbeddedTreeObject>() -> T {\n            let obj = T()\n            obj.value = value\n            value += 1\n            objects.append(obj)\n            return obj\n        }\n    }\n\n    func testAddEmbedded() {\n        let objectFactory = ModernEmbeddedObjectFactory()\n        let parent = ModernEmbeddedParentObject()\n        parent.object = objectFactory.create()\n        parent.object!.child = objectFactory.create()\n        parent.object!.children.append(objectFactory.create())\n        parent.object!.children.append(objectFactory.create())\n        parent.array.append(objectFactory.create())\n        parent.array.append(objectFactory.create())\n\n        let realm = try! Realm()\n        realm.beginWrite()\n        realm.add(parent)\n        for (i, object) in objectFactory.objects.enumerated() {\n            XCTAssertEqual(object.realm, realm)\n            XCTAssertEqual((object as! ModernEmbeddedTreeObject).value, i)\n        }\n        XCTAssertEqual(parent.object!.value, 0)\n        XCTAssertEqual(parent.object!.child!.value, 1)\n        XCTAssertEqual(parent.object!.children.count, 2)\n        XCTAssertEqual(parent.object!.children[0].value, 2)\n        XCTAssertEqual(parent.object!.children[1].value, 3)\n        XCTAssertEqual(parent.array.count, 2)\n        XCTAssertEqual(parent.array[0].value, 4)\n        XCTAssertEqual(parent.array[1].value, 5)\n        realm.cancelWrite()\n    }\n\n    func testAddAndUpdateEmbedded() {\n        let objectFactory = ModernEmbeddedObjectFactory()\n        let parent = ModernEmbeddedPrimaryParentObject()\n        parent.object = objectFactory.create()\n        parent.object!.child = objectFactory.create()\n        parent.object!.children.append(objectFactory.create())\n        parent.object!.children.append(objectFactory.create())\n        parent.array.append(objectFactory.create())\n        parent.array.append(objectFactory.create())\n\n        let parent2 = ModernEmbeddedPrimaryParentObject()\n        parent2.object = objectFactory.create()\n        parent2.object!.child = objectFactory.create()\n        parent2.object!.children.append(objectFactory.create())\n        parent2.object!.children.append(objectFactory.create())\n        parent2.array.append(objectFactory.create())\n        parent2.array.append(objectFactory.create())\n\n        let realm = try! Realm()\n        realm.beginWrite()\n        realm.add(parent)\n        realm.add(parent2, update: .all)\n\n        // update all deletes the old embedded objects and creates new ones\n        for (i, object) in objectFactory.objects.enumerated() {\n            XCTAssertEqual(object.realm, realm)\n            if i < 6 {\n                XCTAssertTrue(object.isInvalidated)\n            } else {\n                XCTAssertEqual((object as! ModernEmbeddedTreeObject).value, i)\n            }\n        }\n        XCTAssertTrue(parent.isSameObject(as: parent2))\n        XCTAssertEqual(parent.object!.value, 6)\n        XCTAssertEqual(parent.object!.child!.value, 7)\n        XCTAssertEqual(parent.object!.children.count, 2)\n        XCTAssertEqual(parent.object!.children[0].value, 8)\n        XCTAssertEqual(parent.object!.children[1].value, 9)\n        XCTAssertEqual(parent.array.count, 2)\n        XCTAssertEqual(parent.array[0].value, 10)\n        XCTAssertEqual(parent.array[1].value, 11)\n        realm.cancelWrite()\n    }\n\n    func testAddAndUpdateChangedWithExisingNestedObjects() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let existingObject = realm.create(SwiftPrimaryStringObject.self, value: [\"primary\", 1])\n        try! realm.commitWrite()\n\n        realm.beginWrite()\n        let object = SwiftLinkToPrimaryStringObject(value: [\"primary\", [\"primary\", 2] as [Any]])\n        realm.add(object, update: .modified)\n        try! realm.commitWrite()\n\n        XCTAssertNotNil(object.realm)\n        XCTAssertEqual(object.object!, existingObject) // the existing object should be updated\n        XCTAssertEqual(existingObject.intCol, 2)\n    }\n\n    func testAddAndUpdateChangedEmbedded() {\n        let objectFactory = ModernEmbeddedObjectFactory()\n        let parent = ModernEmbeddedPrimaryParentObject()\n        parent.object = objectFactory.create()\n        parent.object!.child = objectFactory.create()\n        parent.object!.children.append(objectFactory.create())\n        parent.object!.children.append(objectFactory.create())\n        parent.array.append(objectFactory.create())\n        parent.array.append(objectFactory.create())\n\n        let parent2 = ModernEmbeddedPrimaryParentObject()\n        parent2.object = objectFactory.create()\n        parent2.object!.child = objectFactory.create()\n        parent2.object!.children.append(objectFactory.create())\n        parent2.object!.children.append(objectFactory.create())\n        parent2.array.append(objectFactory.create())\n        parent2.array.append(objectFactory.create())\n\n        let realm = try! Realm()\n        realm.beginWrite()\n        realm.add(parent)\n        realm.add(parent2, update: .modified)\n\n        // update modified modifies the existing embedded objects\n        for (i, object) in objectFactory.objects.enumerated() {\n            XCTAssertEqual(object.realm, realm)\n            XCTAssertEqual((object as! ModernEmbeddedTreeObject).value, i < 6 ? i + 6 : i)\n        }\n        XCTAssertTrue(parent.isSameObject(as: parent2))\n        XCTAssertEqual(parent.object!.value, 6)\n        XCTAssertEqual(parent.object!.child!.value, 7)\n        XCTAssertEqual(parent.object!.children.count, 2)\n        XCTAssertEqual(parent.object!.children[0].value, 8)\n        XCTAssertEqual(parent.object!.children[1].value, 9)\n        XCTAssertEqual(parent.array.count, 2)\n        XCTAssertEqual(parent.array[0].value, 10)\n        XCTAssertEqual(parent.array[1].value, 11)\n        realm.cancelWrite()\n    }\n\n    func testAddObjectCycle() {\n        weak var weakObj1: ModernCircleObject?, weakObj2: ModernCircleObject?\n\n        autoreleasepool {\n            let obj1 = ModernCircleObject()\n            let obj2 = ModernCircleObject(value: [obj1, [obj1]])\n            obj1.obj = obj2\n            obj1.array.append(obj2)\n\n            weakObj1 = obj1\n            weakObj2 = obj2\n\n            let realm = try! Realm()\n            try! realm.write {\n                realm.add(obj1)\n            }\n\n            XCTAssertEqual(obj1.realm, realm)\n            XCTAssertEqual(obj2.realm, realm)\n        }\n\n        XCTAssertNil(weakObj1)\n        XCTAssertNil(weakObj2)\n    }\n}\n\nprivate func mapValues<T>(_ values: [T]) -> [String: T] {\n    var map = [String: T]()\n    for (i, v) in values.enumerated() {\n        map[\"\\(i)\"] = v\n    }\n    return map\n}\n\nclass ModernEnumObjectCreationTests: TestCase {\n    let values: [String: Any] = [\n        \"listInt\": EnumInt.values(),\n        \"listInt8\": EnumInt8.values(),\n        \"listInt16\": EnumInt16.values(),\n        \"listInt32\": EnumInt32.values(),\n        \"listInt64\": EnumInt64.values(),\n        \"listFloat\": EnumFloat.values(),\n        \"listDouble\": EnumDouble.values(),\n        \"listString\": EnumString.values(),\n\n        \"listIntOpt\": EnumInt?.values(),\n        \"listInt8Opt\": EnumInt8?.values(),\n        \"listInt16Opt\": EnumInt16?.values(),\n        \"listInt32Opt\": EnumInt32?.values(),\n        \"listInt64Opt\": EnumInt64?.values(),\n        \"listFloatOpt\": EnumFloat?.values(),\n        \"listDoubleOpt\": EnumDouble?.values(),\n        \"listStringOpt\": EnumString?.values(),\n\n        \"setInt\": EnumInt.values(),\n        \"setInt8\": EnumInt8.values(),\n        \"setInt16\": EnumInt16.values(),\n        \"setInt32\": EnumInt32.values(),\n        \"setInt64\": EnumInt64.values(),\n        \"setFloat\": EnumFloat.values(),\n        \"setDouble\": EnumDouble.values(),\n        \"setString\": EnumString.values(),\n\n        \"setIntOpt\": EnumInt?.values(),\n        \"setInt8Opt\": EnumInt8?.values(),\n        \"setInt16Opt\": EnumInt16?.values(),\n        \"setInt32Opt\": EnumInt32?.values(),\n        \"setInt64Opt\": EnumInt64?.values(),\n        \"setFloatOpt\": EnumFloat?.values(),\n        \"setDoubleOpt\": EnumDouble?.values(),\n        \"setStringOpt\": EnumString?.values(),\n\n        \"mapInt\": mapValues(EnumInt.values()),\n        \"mapInt8\": mapValues(EnumInt8.values()),\n        \"mapInt16\": mapValues(EnumInt16.values()),\n        \"mapInt32\": mapValues(EnumInt32.values()),\n        \"mapInt64\": mapValues(EnumInt64.values()),\n        \"mapFloat\": mapValues(EnumFloat.values()),\n        \"mapDouble\": mapValues(EnumDouble.values()),\n        \"mapString\": mapValues(EnumString.values()),\n\n        \"mapIntOpt\": mapValues(EnumInt?.values()),\n        \"mapInt8Opt\": mapValues(EnumInt8?.values()),\n        \"mapInt16Opt\": mapValues(EnumInt16?.values()),\n        \"mapInt32Opt\": mapValues(EnumInt32?.values()),\n        \"mapInt64Opt\": mapValues(EnumInt64?.values()),\n        \"mapFloatOpt\": mapValues(EnumFloat?.values()),\n        \"mapDoubleOpt\": mapValues(EnumDouble?.values()),\n        \"mapStringOpt\": mapValues(EnumString?.values())\n    ]\n\n    func assertMapEqual<T: RealmCollectionValue>(_ actual: Map<String, T>, _ expected: Dictionary<String, T>) {\n        XCTAssertEqual(actual.count, expected.count)\n        for (key, value) in expected {\n            XCTAssertEqual(actual[key], value)\n        }\n    }\n\n    func verifyObject(_ obj: ModernCollectionsOfEnums) {\n        XCTAssertEqual(Array(obj.listInt), EnumInt.values())\n        XCTAssertEqual(Array(obj.listInt8), EnumInt8.values())\n        XCTAssertEqual(Array(obj.listInt16), EnumInt16.values())\n        XCTAssertEqual(Array(obj.listInt32), EnumInt32.values())\n        XCTAssertEqual(Array(obj.listInt64), EnumInt64.values())\n        XCTAssertEqual(Array(obj.listFloat), EnumFloat.values())\n        XCTAssertEqual(Array(obj.listDouble), EnumDouble.values())\n        XCTAssertEqual(Array(obj.listString), EnumString.values())\n\n        XCTAssertEqual(Array(obj.listIntOpt), EnumInt?.values())\n        XCTAssertEqual(Array(obj.listInt8Opt), EnumInt8?.values())\n        XCTAssertEqual(Array(obj.listInt16Opt), EnumInt16?.values())\n        XCTAssertEqual(Array(obj.listInt32Opt), EnumInt32?.values())\n        XCTAssertEqual(Array(obj.listInt64Opt), EnumInt64?.values())\n        XCTAssertEqual(Array(obj.listFloatOpt), EnumFloat?.values())\n        XCTAssertEqual(Array(obj.listDoubleOpt), EnumDouble?.values())\n        XCTAssertEqual(Array(obj.listStringOpt), EnumString?.values())\n\n        XCTAssertEqual(Set(obj.setInt), Set(EnumInt.values()))\n        XCTAssertEqual(Set(obj.setInt8), Set(EnumInt8.values()))\n        XCTAssertEqual(Set(obj.setInt16), Set(EnumInt16.values()))\n        XCTAssertEqual(Set(obj.setInt32), Set(EnumInt32.values()))\n        XCTAssertEqual(Set(obj.setInt64), Set(EnumInt64.values()))\n        XCTAssertEqual(Set(obj.setFloat), Set(EnumFloat.values()))\n        XCTAssertEqual(Set(obj.setDouble), Set(EnumDouble.values()))\n        XCTAssertEqual(Set(obj.setString), Set(EnumString.values()))\n\n        XCTAssertEqual(Set(obj.setIntOpt), Set(EnumInt?.values()))\n        XCTAssertEqual(Set(obj.setInt8Opt), Set(EnumInt8?.values()))\n        XCTAssertEqual(Set(obj.setInt16Opt), Set(EnumInt16?.values()))\n        XCTAssertEqual(Set(obj.setInt32Opt), Set(EnumInt32?.values()))\n        XCTAssertEqual(Set(obj.setInt64Opt), Set(EnumInt64?.values()))\n        XCTAssertEqual(Set(obj.setFloatOpt), Set(EnumFloat?.values()))\n        XCTAssertEqual(Set(obj.setDoubleOpt), Set(EnumDouble?.values()))\n        XCTAssertEqual(Set(obj.setStringOpt), Set(EnumString?.values()))\n\n        assertMapEqual(obj.mapInt, mapValues(EnumInt.values()))\n        assertMapEqual(obj.mapInt8, mapValues(EnumInt8.values()))\n        assertMapEqual(obj.mapInt16, mapValues(EnumInt16.values()))\n        assertMapEqual(obj.mapInt32, mapValues(EnumInt32.values()))\n        assertMapEqual(obj.mapInt64, mapValues(EnumInt64.values()))\n        assertMapEqual(obj.mapFloat, mapValues(EnumFloat.values()))\n        assertMapEqual(obj.mapDouble, mapValues(EnumDouble.values()))\n        assertMapEqual(obj.mapString, mapValues(EnumString.values()))\n\n        assertMapEqual(obj.mapIntOpt, mapValues(EnumInt?.values()))\n        assertMapEqual(obj.mapInt8Opt, mapValues(EnumInt8?.values()))\n        assertMapEqual(obj.mapInt16Opt, mapValues(EnumInt16?.values()))\n        assertMapEqual(obj.mapInt32Opt, mapValues(EnumInt32?.values()))\n        assertMapEqual(obj.mapInt64Opt, mapValues(EnumInt64?.values()))\n        assertMapEqual(obj.mapFloatOpt, mapValues(EnumFloat?.values()))\n        assertMapEqual(obj.mapDoubleOpt, mapValues(EnumDouble?.values()))\n        assertMapEqual(obj.mapStringOpt, mapValues(EnumString?.values()))\n    }\n\n    func verifyDefault(_ obj: ModernCollectionsOfEnums) {\n        XCTAssertEqual(obj.listInt.count, 0)\n        XCTAssertEqual(obj.listInt8.count, 0)\n        XCTAssertEqual(obj.listInt16.count, 0)\n        XCTAssertEqual(obj.listInt32.count, 0)\n        XCTAssertEqual(obj.listInt64.count, 0)\n        XCTAssertEqual(obj.listFloat.count, 0)\n        XCTAssertEqual(obj.listDouble.count, 0)\n        XCTAssertEqual(obj.listString.count, 0)\n\n        XCTAssertEqual(obj.listIntOpt.count, 0)\n        XCTAssertEqual(obj.listInt8Opt.count, 0)\n        XCTAssertEqual(obj.listInt16Opt.count, 0)\n        XCTAssertEqual(obj.listInt32Opt.count, 0)\n        XCTAssertEqual(obj.listInt64Opt.count, 0)\n        XCTAssertEqual(obj.listFloatOpt.count, 0)\n        XCTAssertEqual(obj.listDoubleOpt.count, 0)\n        XCTAssertEqual(obj.listStringOpt.count, 0)\n\n        XCTAssertEqual(obj.setInt.count, 0)\n        XCTAssertEqual(obj.setInt8.count, 0)\n        XCTAssertEqual(obj.setInt16.count, 0)\n        XCTAssertEqual(obj.setInt32.count, 0)\n        XCTAssertEqual(obj.setInt64.count, 0)\n        XCTAssertEqual(obj.setFloat.count, 0)\n        XCTAssertEqual(obj.setDouble.count, 0)\n        XCTAssertEqual(obj.setString.count, 0)\n\n        XCTAssertEqual(obj.setIntOpt.count, 0)\n        XCTAssertEqual(obj.setInt8Opt.count, 0)\n        XCTAssertEqual(obj.setInt16Opt.count, 0)\n        XCTAssertEqual(obj.setInt32Opt.count, 0)\n        XCTAssertEqual(obj.setInt64Opt.count, 0)\n        XCTAssertEqual(obj.setFloatOpt.count, 0)\n        XCTAssertEqual(obj.setDoubleOpt.count, 0)\n        XCTAssertEqual(obj.setStringOpt.count, 0)\n\n        XCTAssertEqual(obj.mapInt.count, 0)\n        XCTAssertEqual(obj.mapInt8.count, 0)\n        XCTAssertEqual(obj.mapInt16.count, 0)\n        XCTAssertEqual(obj.mapInt32.count, 0)\n        XCTAssertEqual(obj.mapInt64.count, 0)\n        XCTAssertEqual(obj.mapFloat.count, 0)\n        XCTAssertEqual(obj.mapDouble.count, 0)\n        XCTAssertEqual(obj.mapString.count, 0)\n\n        XCTAssertEqual(obj.mapIntOpt.count, 0)\n        XCTAssertEqual(obj.mapInt8Opt.count, 0)\n        XCTAssertEqual(obj.mapInt16Opt.count, 0)\n        XCTAssertEqual(obj.mapInt32Opt.count, 0)\n        XCTAssertEqual(obj.mapInt64Opt.count, 0)\n        XCTAssertEqual(obj.mapFloatOpt.count, 0)\n        XCTAssertEqual(obj.mapDoubleOpt.count, 0)\n        XCTAssertEqual(obj.mapStringOpt.count, 0)\n    }\n\n    func testInitDefault() {\n        verifyDefault(ModernCollectionsOfEnums())\n    }\n\n    func testInitWithArray() {\n        let arrayValues = ModernCollectionsOfEnums.sharedSchema()!.properties.map { values[$0.name] }\n        verifyObject(ModernCollectionsOfEnums(value: arrayValues))\n    }\n\n    func testInitWithDictionary() {\n        verifyObject(ModernCollectionsOfEnums(value: values))\n    }\n\n    func testInitWithObject() {\n        let obj = ModernCollectionsOfEnums(value: values)\n        verifyObject(ModernCollectionsOfEnums(value: obj))\n    }\n\n    func testCreateDefault() {\n        let realm = try! Realm()\n        let obj = try! realm.write {\n            return realm.create(ModernCollectionsOfEnums.self)\n        }\n        verifyDefault(obj)\n    }\n\n    func testCreateWithArray() {\n        let realm = try! Realm()\n        let arrayValues = ModernCollectionsOfEnums.sharedSchema()!.properties.map { values[$0.name] }\n        let obj = try! realm.write {\n            return realm.create(ModernCollectionsOfEnums.self, value: arrayValues)\n        }\n        verifyObject(obj)\n    }\n\n    func testCreateWithDictionary() {\n        let realm = try! Realm()\n        let obj = try! realm.write {\n            return realm.create(ModernCollectionsOfEnums.self, value: values)\n        }\n        verifyObject(obj)\n    }\n\n    func testCreateWithObject() {\n        let realm = try! Realm()\n        let obj = try! realm.write {\n            return realm.create(ModernCollectionsOfEnums.self, value: ModernCollectionsOfEnums(value: values))\n        }\n        verifyObject(obj)\n    }\n\n    func testAddDefault() {\n        let obj = ModernCollectionsOfEnums()\n        let realm = try! Realm()\n        try! realm.write {\n            realm.add(obj)\n        }\n        verifyDefault(obj)\n    }\n\n    func testAdd() {\n        let obj = ModernCollectionsOfEnums(value: values)\n        let realm = try! Realm()\n        try! realm.write {\n            realm.add(obj)\n        }\n        verifyObject(obj)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/ModernObjectTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\nimport Foundation\n\nprivate nonisolated(unsafe) var dynamicDefaultSeed = 0\nprivate func nextDynamicDefaultSeed() -> Int {\n    dynamicDefaultSeed += 1\n    return dynamicDefaultSeed\n}\nclass ModernDynamicDefaultObject: Object {\n    @Persisted(primaryKey: true) var intCol = nextDynamicDefaultSeed()\n    @Persisted var floatCol = Float(nextDynamicDefaultSeed())\n    @Persisted var doubleCol = Double(nextDynamicDefaultSeed())\n    @Persisted var dateCol = Date(timeIntervalSinceReferenceDate: TimeInterval(nextDynamicDefaultSeed()))\n    @Persisted var stringCol = UUID().uuidString\n    @Persisted var binaryCol = UUID().uuidString.data(using: .utf8)\n}\n\nclass ModernObjectTests: TestCase {\n    // init() Tests are in ObjectCreationTests.swift\n    // init(value:) tests are in ObjectCreationTests.swift\n\n    func testObjectSchema() {\n        let object = ModernAllTypesObject()\n        let schema = object.objectSchema\n        XCTAssert(schema as AnyObject is ObjectSchema)\n        XCTAssert(schema.properties as AnyObject is [Property])\n        XCTAssertEqual(schema.className, \"ModernAllTypesObject\")\n        XCTAssertEqual(schema.properties.map { $0.name },\n                       [\"pk\", \"boolCol\", \"intCol\", \"int8Col\", \"int16Col\",\n                        \"int32Col\", \"int64Col\", \"floatCol\", \"doubleCol\",\n                        \"stringCol\", \"binaryCol\", \"dateCol\", \"decimalCol\",\n                        \"objectIdCol\", \"objectCol\", \"arrayCol\", \"setCol\", \"mapCol\",\n                        \"anyCol\", \"uuidCol\", \"intEnumCol\", \"stringEnumCol\",\n                        \"optIntCol\", \"optInt8Col\", \"optInt16Col\",\n                        \"optInt32Col\", \"optInt64Col\", \"optFloatCol\",\n                        \"optDoubleCol\", \"optBoolCol\", \"optStringCol\",\n                        \"optBinaryCol\", \"optDateCol\", \"optDecimalCol\",\n                        \"optObjectIdCol\", \"optUuidCol\", \"optIntEnumCol\",\n                        \"optStringEnumCol\", \"arrayBool\", \"arrayInt\",\n                        \"arrayInt8\", \"arrayInt16\", \"arrayInt32\",\n                        \"arrayInt64\", \"arrayFloat\", \"arrayDouble\",\n                        \"arrayString\", \"arrayBinary\", \"arrayDate\",\n                        \"arrayDecimal\", \"arrayObjectId\", \"arrayAny\",\n                        \"arrayUuid\", \"arrayOptBool\", \"arrayOptInt\",\n                        \"arrayOptInt8\", \"arrayOptInt16\", \"arrayOptInt32\",\n                        \"arrayOptInt64\", \"arrayOptFloat\", \"arrayOptDouble\",\n                        \"arrayOptString\", \"arrayOptBinary\", \"arrayOptDate\",\n                        \"arrayOptDecimal\", \"arrayOptObjectId\",\n                        \"arrayOptUuid\", \"setBool\", \"setInt\", \"setInt8\",\n                        \"setInt16\", \"setInt32\", \"setInt64\", \"setFloat\",\n                        \"setDouble\", \"setString\", \"setBinary\", \"setDate\",\n                        \"setDecimal\", \"setObjectId\", \"setAny\", \"setUuid\",\n                        \"setOptBool\", \"setOptInt\", \"setOptInt8\",\n                        \"setOptInt16\", \"setOptInt32\", \"setOptInt64\",\n                        \"setOptFloat\", \"setOptDouble\", \"setOptString\",\n                        \"setOptBinary\", \"setOptDate\", \"setOptDecimal\",\n                        \"setOptObjectId\", \"setOptUuid\", \"mapBool\", \"mapInt\",\n                        \"mapInt8\", \"mapInt16\", \"mapInt32\", \"mapInt64\",\n                        \"mapFloat\", \"mapDouble\", \"mapString\", \"mapBinary\",\n                        \"mapDate\", \"mapDecimal\", \"mapObjectId\", \"mapAny\",\n                        \"mapUuid\", \"mapOptBool\", \"mapOptInt\", \"mapOptInt8\",\n                        \"mapOptInt16\", \"mapOptInt32\", \"mapOptInt64\",\n                        \"mapOptFloat\", \"mapOptDouble\", \"mapOptString\",\n                        \"mapOptBinary\", \"mapOptDate\", \"mapOptDecimal\",\n                        \"mapOptObjectId\", \"mapOptUuid\"])\n    }\n\n    func testObjectSchemaForObjectWithConvenienceInitializer() {\n        let object = ModernConvenienceInitializerObject(stringCol: \"abc\")\n        let schema = object.objectSchema\n        XCTAssert(schema as AnyObject is ObjectSchema)\n        XCTAssert(schema.properties as AnyObject is [Property])\n        XCTAssertEqual(schema.className, \"ModernConvenienceInitializerObject\")\n        XCTAssertEqual(schema.properties.map { $0.name }, [\"stringCol\"])\n    }\n\n    func testCannotUpdatePrimaryKey() {\n        let primaryKeyReason = \"Primary key can't be changed.* after an object is inserted.\"\n        let realm = self.realmWithTestPath()\n        realm.beginWrite()\n\n        func test<O: ModernPrimaryKeyObject>(_ object: O, _ v1: O.PrimaryKey, _ v2: O.PrimaryKey) {\n            // Unmanaged objects can mutate the primary key\n            object.pk = v1\n            XCTAssertEqual(object.pk, v1)\n            object.pk = v2\n            XCTAssertEqual(object.pk, v2)\n            object[\"pk\"] = v1\n            XCTAssertEqual(object.pk, v1)\n            object.setValue(v2, forKey: \"pk\")\n            XCTAssertEqual(object.pk, v2)\n\n            // Managed objects cannot mutate the pk\n            realm.add(object)\n            assertThrows(object.pk = v2, reasonMatching: primaryKeyReason)\n            assertThrows(object[\"pk\"] = v2, reasonMatching: primaryKeyReason)\n            assertThrows(object.setValue(v2, forKey: \"pk\"), reasonMatching: primaryKeyReason)\n        }\n\n        test(ModernPrimaryIntObject(), 1, 2)\n        test(ModernPrimaryInt8Object(), 1, 2)\n        test(ModernPrimaryInt16Object(), 1, 2)\n        test(ModernPrimaryInt32Object(), 1, 2)\n        test(ModernPrimaryInt64Object(), 1, 2)\n        test(ModernPrimaryOptionalIntObject(), 1, nil)\n        test(ModernPrimaryOptionalInt8Object(), 1, nil)\n        test(ModernPrimaryOptionalInt16Object(), 1, nil)\n        test(ModernPrimaryOptionalInt32Object(), 1, nil)\n        test(ModernPrimaryOptionalInt64Object(), 1, nil)\n\n        test(ModernPrimaryStringObject(), \"a\", \"b\")\n        test(ModernPrimaryOptionalStringObject(), \"a\", nil)\n        test(ModernPrimaryUUIDObject(), UUID(), UUID())\n        test(ModernPrimaryOptionalUUIDObject(), UUID(), nil)\n        test(ModernPrimaryObjectIdObject(), ObjectId.generate(), ObjectId.generate())\n        test(ModernPrimaryOptionalObjectIdObject(), ObjectId.generate(), nil)\n\n        test(ModernPrimaryIntEnumObject(), .value1, .value2)\n        test(ModernPrimaryOptionalIntEnumObject(), .value1, nil)\n\n        realm.cancelWrite()\n    }\n\n    func testDynamicDefaultPropertyValues() {\n        func assertDifferentPropertyValues(_ obj1: ModernDynamicDefaultObject, _ obj2: ModernDynamicDefaultObject) {\n            XCTAssertNotEqual(obj1.intCol, obj2.intCol)\n            XCTAssertNotEqual(obj1.floatCol, obj2.floatCol)\n            XCTAssertNotEqual(obj1.doubleCol, obj2.doubleCol)\n            XCTAssertNotEqual(obj1.dateCol.timeIntervalSinceReferenceDate, obj2.dateCol.timeIntervalSinceReferenceDate,\n                              accuracy: 0.01)\n            XCTAssertNotEqual(obj1.stringCol, obj2.stringCol)\n            XCTAssertNotEqual(obj1.binaryCol, obj2.binaryCol)\n        }\n        assertDifferentPropertyValues(ModernDynamicDefaultObject(), ModernDynamicDefaultObject())\n        let realm = try! Realm()\n        try! realm.write {\n            assertDifferentPropertyValues(realm.create(ModernDynamicDefaultObject.self),\n                                          realm.create(ModernDynamicDefaultObject.self))\n        }\n    }\n\n    func testWillSetDidSet() {\n        let obj = SetterObservers()\n        var calls = 0\n        obj.willSetCallback = {\n            XCTAssertEqual(obj.value, 0)\n            calls += 1\n        }\n        obj.didSetCallback = {\n            XCTAssertEqual(obj.value, 1)\n            calls += 1\n        }\n        obj.value = 1\n        XCTAssertEqual(calls, 2)\n\n        let realm = try! Realm()\n        realm.beginWrite()\n        realm.add(obj)\n\n        obj.willSetCallback = {\n            XCTAssertEqual(obj.value, 1)\n            calls += 1\n        }\n        obj.didSetCallback = {\n            XCTAssertEqual(obj.value, 2)\n            calls += 1\n        }\n        obj.value = 2\n        XCTAssertEqual(calls, 4)\n\n        realm.cancelWrite()\n\n        // The callbacks form a circular reference and so need to be removed\n        obj.willSetCallback = nil\n        obj.didSetCallback = nil\n    }\n\n    func testAddingObjectReusesExistingCollectionObjects() {\n        let obj = ModernAllTypesObject()\n        let list = obj.arrayCol\n        let set = obj.setCol\n        let dictionary = obj.mapAny\n\n        XCTAssertNil(list.realm)\n        XCTAssertNil(set.realm)\n        XCTAssertNil(dictionary.realm)\n        XCTAssertTrue(list === obj.arrayCol)\n        XCTAssertTrue(set === obj.setCol)\n        XCTAssertTrue(dictionary === obj.mapAny)\n\n        let realm = try! Realm()\n        try! realm.write {\n            realm.add(obj)\n        }\n\n        XCTAssertNotNil(list.realm)\n        XCTAssertNotNil(set.realm)\n        XCTAssertNotNil(dictionary.realm)\n        XCTAssertTrue(list === obj.arrayCol)\n        XCTAssertTrue(set === obj.setCol)\n        XCTAssertTrue(dictionary === obj.mapAny)\n    }\n\n    func testAddingPreviouslyObservedObjectReusesExistingCollectionObjects() {\n        let obj = ModernAllTypesObject()\n        let list = obj.arrayCol\n        let set = obj.setCol\n        let dictionary = obj.mapAny\n\n        // We don't allow adding an object with active observers to the Realm\n        // (it causes problems with the subclass KVO creates at runtime), but\n        // once a property has been observed it stays in the observed state forever.\n        obj.addObserver(self, forKeyPath: \"arrayCol\", context: nil)\n        obj.addObserver(self, forKeyPath: \"setCol\", context: nil)\n        obj.addObserver(self, forKeyPath: \"mapAny\", context: nil)\n        obj.removeObserver(self, forKeyPath: \"arrayCol\", context: nil)\n        obj.removeObserver(self, forKeyPath: \"setCol\", context: nil)\n        obj.removeObserver(self, forKeyPath: \"mapAny\", context: nil)\n\n\n        XCTAssertNil(list.realm)\n        XCTAssertNil(set.realm)\n        XCTAssertNil(dictionary.realm)\n        XCTAssertTrue(list === obj.arrayCol)\n        XCTAssertTrue(set === obj.setCol)\n        XCTAssertTrue(dictionary === obj.mapAny)\n\n        let realm = try! Realm()\n        try! realm.write {\n            realm.add(obj)\n        }\n\n        XCTAssertNotNil(list.realm)\n        XCTAssertNotNil(set.realm)\n        XCTAssertNotNil(dictionary.realm)\n        XCTAssertTrue(list === obj.arrayCol)\n        XCTAssertTrue(set === obj.setCol)\n        XCTAssertTrue(dictionary === obj.mapAny)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/ModernTestObjects.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport RealmSwift\nimport Realm\n\nclass ModernAllTypesObject: Object {\n    @Persisted(primaryKey: true) var pk: ObjectId\n    var ignored: Int = 1\n\n    @Persisted var boolCol: Bool\n    @Persisted var intCol: Int\n    @Persisted var int8Col: Int8 = 1\n    @Persisted var int16Col: Int16 = 2\n    @Persisted var int32Col: Int32 = 3\n    @Persisted var int64Col: Int64 = 4\n    @Persisted var floatCol: Float = 5\n    @Persisted var doubleCol: Double = 6\n    @Persisted var stringCol: String\n    @Persisted var binaryCol: Data\n    @Persisted var dateCol: Date\n    @Persisted var decimalCol: Decimal128\n    @Persisted var objectIdCol: ObjectId\n    @Persisted var objectCol: ModernAllTypesObject?\n    @Persisted var arrayCol: List<ModernAllTypesObject>\n    @Persisted var setCol: MutableSet<ModernAllTypesObject>\n    @Persisted var mapCol: Map<String, ModernAllTypesObject?>\n    @Persisted var anyCol: AnyRealmValue\n    @Persisted var uuidCol: UUID\n    @Persisted var intEnumCol: ModernIntEnum\n    @Persisted var stringEnumCol: ModernStringEnum\n\n    @Persisted var optIntCol: Int?\n    @Persisted var optInt8Col: Int8?\n    @Persisted var optInt16Col: Int16?\n    @Persisted var optInt32Col: Int32?\n    @Persisted var optInt64Col: Int64?\n    @Persisted var optFloatCol: Float?\n    @Persisted var optDoubleCol: Double?\n    @Persisted var optBoolCol: Bool?\n    @Persisted var optStringCol: String?\n    @Persisted var optBinaryCol: Data?\n    @Persisted var optDateCol: Date?\n    @Persisted var optDecimalCol: Decimal128?\n    @Persisted var optObjectIdCol: ObjectId?\n    @Persisted var optUuidCol: UUID?\n    @Persisted var optIntEnumCol: ModernIntEnum?\n    @Persisted var optStringEnumCol: ModernStringEnum?\n\n    @Persisted var arrayBool: List<Bool>\n    @Persisted var arrayInt: List<Int>\n    @Persisted var arrayInt8: List<Int8>\n    @Persisted var arrayInt16: List<Int16>\n    @Persisted var arrayInt32: List<Int32>\n    @Persisted var arrayInt64: List<Int64>\n    @Persisted var arrayFloat: List<Float>\n    @Persisted var arrayDouble: List<Double>\n    @Persisted var arrayString: List<String>\n    @Persisted var arrayBinary: List<Data>\n    @Persisted var arrayDate: List<Date>\n    @Persisted var arrayDecimal: List<Decimal128>\n    @Persisted var arrayObjectId: List<ObjectId>\n    @Persisted var arrayAny: List<AnyRealmValue>\n    @Persisted var arrayUuid: List<UUID>\n\n    @Persisted var arrayOptBool: List<Bool?>\n    @Persisted var arrayOptInt: List<Int?>\n    @Persisted var arrayOptInt8: List<Int8?>\n    @Persisted var arrayOptInt16: List<Int16?>\n    @Persisted var arrayOptInt32: List<Int32?>\n    @Persisted var arrayOptInt64: List<Int64?>\n    @Persisted var arrayOptFloat: List<Float?>\n    @Persisted var arrayOptDouble: List<Double?>\n    @Persisted var arrayOptString: List<String?>\n    @Persisted var arrayOptBinary: List<Data?>\n    @Persisted var arrayOptDate: List<Date?>\n    @Persisted var arrayOptDecimal: List<Decimal128?>\n    @Persisted var arrayOptObjectId: List<ObjectId?>\n    @Persisted var arrayOptUuid: List<UUID?>\n\n    @Persisted var setBool: MutableSet<Bool>\n    @Persisted var setInt: MutableSet<Int>\n    @Persisted var setInt8: MutableSet<Int8>\n    @Persisted var setInt16: MutableSet<Int16>\n    @Persisted var setInt32: MutableSet<Int32>\n    @Persisted var setInt64: MutableSet<Int64>\n    @Persisted var setFloat: MutableSet<Float>\n    @Persisted var setDouble: MutableSet<Double>\n    @Persisted var setString: MutableSet<String>\n    @Persisted var setBinary: MutableSet<Data>\n    @Persisted var setDate: MutableSet<Date>\n    @Persisted var setDecimal: MutableSet<Decimal128>\n    @Persisted var setObjectId: MutableSet<ObjectId>\n    @Persisted var setAny: MutableSet<AnyRealmValue>\n    @Persisted var setUuid: MutableSet<UUID>\n\n    @Persisted var setOptBool: MutableSet<Bool?>\n    @Persisted var setOptInt: MutableSet<Int?>\n    @Persisted var setOptInt8: MutableSet<Int8?>\n    @Persisted var setOptInt16: MutableSet<Int16?>\n    @Persisted var setOptInt32: MutableSet<Int32?>\n    @Persisted var setOptInt64: MutableSet<Int64?>\n    @Persisted var setOptFloat: MutableSet<Float?>\n    @Persisted var setOptDouble: MutableSet<Double?>\n    @Persisted var setOptString: MutableSet<String?>\n    @Persisted var setOptBinary: MutableSet<Data?>\n    @Persisted var setOptDate: MutableSet<Date?>\n    @Persisted var setOptDecimal: MutableSet<Decimal128?>\n    @Persisted var setOptObjectId: MutableSet<ObjectId?>\n    @Persisted var setOptUuid: MutableSet<UUID?>\n\n    @Persisted var mapBool: Map<String, Bool>\n    @Persisted var mapInt: Map<String, Int>\n    @Persisted var mapInt8: Map<String, Int8>\n    @Persisted var mapInt16: Map<String, Int16>\n    @Persisted var mapInt32: Map<String, Int32>\n    @Persisted var mapInt64: Map<String, Int64>\n    @Persisted var mapFloat: Map<String, Float>\n    @Persisted var mapDouble: Map<String, Double>\n    @Persisted var mapString: Map<String, String>\n    @Persisted var mapBinary: Map<String, Data>\n    @Persisted var mapDate: Map<String, Date>\n    @Persisted var mapDecimal: Map<String, Decimal128>\n    @Persisted var mapObjectId: Map<String, ObjectId>\n    @Persisted var mapAny: Map<String, AnyRealmValue>\n    @Persisted var mapUuid: Map<String, UUID>\n\n    @Persisted var mapOptBool: Map<String, Bool?>\n    @Persisted var mapOptInt: Map<String, Int?>\n    @Persisted var mapOptInt8: Map<String, Int8?>\n    @Persisted var mapOptInt16: Map<String, Int16?>\n    @Persisted var mapOptInt32: Map<String, Int32?>\n    @Persisted var mapOptInt64: Map<String, Int64?>\n    @Persisted var mapOptFloat: Map<String, Float?>\n    @Persisted var mapOptDouble: Map<String, Double?>\n    @Persisted var mapOptString: Map<String, String?>\n    @Persisted var mapOptBinary: Map<String, Data?>\n    @Persisted var mapOptDate: Map<String, Date?>\n    @Persisted var mapOptDecimal: Map<String, Decimal128?>\n    @Persisted var mapOptObjectId: Map<String, ObjectId?>\n    @Persisted var mapOptUuid: Map<String, UUID?>\n\n    @Persisted(originProperty: \"objectCol\")\n    var linkingObjects: LinkingObjects<ModernAllTypesObject>\n}\n\nclass LinkToModernAllTypesObject: Object {\n    @Persisted var object: ModernAllTypesObject?\n    @Persisted var list: List<ModernAllTypesObject>\n    @Persisted var set: MutableSet<ModernAllTypesObject>\n    @Persisted var map: Map<String, ModernAllTypesObject?>\n}\n\nenum ModernIntEnum: Int, Codable, PersistableEnum {\n    case value1 = 1\n    case value2 = 3\n    case value3 = 5\n}\nenum ModernStringEnum: String, Codable, PersistableEnum {\n    case value1 = \"a\"\n    case value2 = \"c\"\n    case value3 = \"e\"\n    case value4 = \"Foó\"\n}\n\nclass ModernImplicitlyUnwrappedOptionalObject: Object {\n    @Persisted var optStringCol: String!\n    @Persisted var optBinaryCol: Data!\n    @Persisted var optDateCol: Date!\n    @Persisted var optDecimalCol: Decimal128!\n    @Persisted var optObjectIdCol: ObjectId!\n    @Persisted var optObjectCol: ModernImplicitlyUnwrappedOptionalObject!\n    @Persisted var optUuidCol: UUID!\n}\n\nclass ModernLinkToPrimaryStringObject: Object {\n    @Persisted var pk = \"\"\n    @Persisted var object: ModernPrimaryStringObject?\n    @Persisted var objects: List<ModernPrimaryStringObject>\n\n    override class func primaryKey() -> String? {\n        return \"pk\"\n    }\n}\n\nclass ModernUTF8Object: Object {\n    // swiftlint:disable:next identifier_name\n    @Persisted var 柱колоéнǢкƱаم👍 = \"值значен™👍☞⎠‱௹♣︎☐▼❒∑⨌⧭иеمرحبا\"\n}\n\nprotocol ModernPrimaryKeyObject: Object {\n    associatedtype PrimaryKey: Equatable\n    var pk: PrimaryKey { get set }\n}\n\nclass ModernPrimaryStringObject: Object, ModernPrimaryKeyObject {\n    @Persisted(primaryKey: true) var pk: String\n}\n\nclass ModernPrimaryOptionalStringObject: Object, ModernPrimaryKeyObject {\n    @Persisted(primaryKey: true) var pk: String?\n}\n\nclass ModernPrimaryIntObject: Object, ModernPrimaryKeyObject {\n    @Persisted(primaryKey: true) var pk: Int\n}\n\nclass ModernPrimaryOptionalIntObject: Object, ModernPrimaryKeyObject {\n    @Persisted(primaryKey: true) var pk: Int?\n}\n\nclass ModernPrimaryInt8Object: Object, ModernPrimaryKeyObject {\n    @Persisted(primaryKey: true) var pk: Int8\n}\n\nclass ModernPrimaryOptionalInt8Object: Object, ModernPrimaryKeyObject {\n    @Persisted(primaryKey: true) var pk: Int8?\n}\n\nclass ModernPrimaryInt16Object: Object, ModernPrimaryKeyObject {\n    @Persisted(primaryKey: true) var pk: Int16\n}\n\nclass ModernPrimaryOptionalInt16Object: Object, ModernPrimaryKeyObject {\n    @Persisted(primaryKey: true) var pk: Int16?\n}\n\nclass ModernPrimaryInt32Object: Object, ModernPrimaryKeyObject {\n    @Persisted(primaryKey: true) var pk: Int32\n}\n\nclass ModernPrimaryOptionalInt32Object: Object, ModernPrimaryKeyObject {\n    @Persisted(primaryKey: true) var pk: Int32?\n}\n\nclass ModernPrimaryInt64Object: Object, ModernPrimaryKeyObject {\n    @Persisted(primaryKey: true) var pk: Int64\n}\n\nclass ModernPrimaryOptionalInt64Object: Object, ModernPrimaryKeyObject {\n    @Persisted(primaryKey: true) var pk: Int64?\n}\n\nclass ModernPrimaryUUIDObject: Object, ModernPrimaryKeyObject {\n    @Persisted(primaryKey: true) var pk: UUID\n}\n\nclass ModernPrimaryOptionalUUIDObject: Object, ModernPrimaryKeyObject {\n    @Persisted(primaryKey: true) var pk: UUID?\n}\n\nclass ModernPrimaryObjectIdObject: Object, ModernPrimaryKeyObject {\n    @Persisted(primaryKey: true) var pk: ObjectId\n}\n\nclass ModernPrimaryOptionalObjectIdObject: Object, ModernPrimaryKeyObject {\n    @Persisted(primaryKey: true) var pk: ObjectId?\n}\n\nclass ModernPrimaryIntEnumObject: Object, ModernPrimaryKeyObject {\n    @Persisted(primaryKey: true) var pk: ModernIntEnum\n}\n\nclass ModernPrimaryOptionalIntEnumObject: Object, ModernPrimaryKeyObject {\n    @Persisted(primaryKey: true) var pk: ModernIntEnum?\n}\n\nclass ModernIndexedIntEnumObject: Object {\n    @Persisted(indexed: true) var value: ModernIntEnum\n}\n\nclass ModernIndexedOptionalIntEnumObject: Object {\n    @Persisted(indexed: true) var value: ModernIntEnum?\n}\n\nclass ModernCustomInitializerObject: Object {\n    @Persisted var stringCol: String\n\n    init(stringVal: String) {\n        stringCol = stringVal\n        super.init()\n    }\n\n    required override init() {\n        stringCol = \"\"\n        super.init()\n    }\n}\n\nclass ModernConvenienceInitializerObject: Object {\n    @Persisted var stringCol = \"\"\n\n    convenience init(stringCol: String) {\n        self.init()\n        self.stringCol = stringCol\n    }\n}\n\n@objc(ModernObjcRenamedObject)\nclass ModernObjcRenamedObject: Object {\n    @Persisted var stringCol = \"\"\n}\n\n@objc(ModernObjcRenamedObjectWithTotallyDifferentName)\nclass ModernObjcArbitrarilyRenamedObject: Object {\n    @Persisted var boolCol = false\n}\n\nclass ModernIntAndStringObject: Object {\n    @Persisted var intCol: Int\n    @Persisted var optIntCol: Int?\n    @Persisted var stringCol: String\n    @Persisted var optStringCol: String?\n}\n\nclass ModernCollectionObject: Object {\n    @Persisted var list: List<ModernAllTypesObject>\n    @Persisted var set: MutableSet<ModernAllTypesObject>\n    @Persisted var map: Map<String, ModernAllTypesObject?>\n}\n\nclass ModernCircleObject: Object {\n    @Persisted var obj: ModernCircleObject?\n    @Persisted var array: List<ModernCircleObject>\n}\n\nclass ModernEmbeddedParentObject: Object {\n    @Persisted var object: ModernEmbeddedTreeObject1?\n    @Persisted var array: List<ModernEmbeddedTreeObject1>\n}\n\nclass ModernEmbeddedPrimaryParentObject: Object {\n    @Persisted(primaryKey: true) var pk: Int = 0\n    @Persisted var object: ModernEmbeddedTreeObject1?\n    @Persisted var array: List<ModernEmbeddedTreeObject1>\n}\n\nprotocol ModernEmbeddedTreeObject: EmbeddedObject {\n    var value: Int { get set }\n}\n\nclass ModernEmbeddedTreeObject1: EmbeddedObject, ModernEmbeddedTreeObject {\n    @Persisted var value = 0\n    @Persisted var bool = false\n    @Persisted var child: ModernEmbeddedTreeObject2?\n    @Persisted var children: List<ModernEmbeddedTreeObject2>\n\n    @Persisted(originProperty: \"object\")\n    var parent1: LinkingObjects<ModernEmbeddedParentObject>\n    @Persisted(originProperty: \"array\")\n    var parent2: LinkingObjects<ModernEmbeddedParentObject>\n}\n\nclass ModernEmbeddedTreeObject2: EmbeddedObject, ModernEmbeddedTreeObject {\n    @Persisted var value = 0\n    @Persisted var child: ModernEmbeddedTreeObject3?\n    @Persisted var children: List<ModernEmbeddedTreeObject3>\n\n    @Persisted(originProperty: \"child\")\n    var parent3: LinkingObjects<ModernEmbeddedTreeObject1>\n    @Persisted(originProperty: \"children\")\n    var parent4: LinkingObjects<ModernEmbeddedTreeObject1>\n}\n\nclass ModernEmbeddedTreeObject3: EmbeddedObject, ModernEmbeddedTreeObject {\n    @Persisted var value = 0\n\n    @Persisted(originProperty: \"child\")\n    var parent3: LinkingObjects<ModernEmbeddedTreeObject2>\n    @Persisted(originProperty: \"children\")\n    var parent4: LinkingObjects<ModernEmbeddedTreeObject2>\n}\n\nclass ModernEmbeddedObject: EmbeddedObject {\n    @Persisted var value = 0\n}\n\nclass SetterObservers: Object {\n    @Persisted var value: Int {\n        willSet {\n            willSetCallback?()\n        }\n        didSet {\n            didSetCallback?()\n        }\n    }\n\n    var willSetCallback: (() -> Void)?\n    var didSetCallback: (() -> Void)?\n}\n\nclass ObjectWithArcMethodCategoryNames: Object {\n    // @objc properties with these names would crash with asan (and unreliably\n    // without it) because they would not have the correct behavior for the\n    // inferred ARC method family.\n    @Persisted var newValue: String\n    @Persisted var allocValue: String\n    @Persisted var copyValue: String\n    @Persisted var mutableCopyValue: String\n    @Persisted var initValue: String\n}\n\nclass ModernAllIndexableTypesObject: Object {\n    @Persisted(indexed: true) var boolCol: Bool\n    @Persisted(indexed: true) var intCol: Int\n    @Persisted(indexed: true) var int8Col: Int8 = 1\n    @Persisted(indexed: true) var int16Col: Int16 = 2\n    @Persisted(indexed: true) var int32Col: Int32 = 3\n    @Persisted(indexed: true) var int64Col: Int64 = 4\n    @Persisted(indexed: true) var stringCol: String\n    @Persisted(indexed: true) var dateCol: Date\n    @Persisted(indexed: true) var uuidCol: UUID\n    @Persisted(indexed: true) var objectIdCol: ObjectId\n    @Persisted(indexed: true) var intEnumCol: ModernIntEnum\n    @Persisted(indexed: true) var stringEnumCol: ModernStringEnum\n\n    @Persisted(indexed: true) var optIntCol: Int?\n    @Persisted(indexed: true) var optInt8Col: Int8?\n    @Persisted(indexed: true) var optInt16Col: Int16?\n    @Persisted(indexed: true) var optInt32Col: Int32?\n    @Persisted(indexed: true) var optInt64Col: Int64?\n    @Persisted(indexed: true) var optBoolCol: Bool?\n    @Persisted(indexed: true) var optStringCol: String?\n    @Persisted(indexed: true) var optDateCol: Date?\n    @Persisted(indexed: true) var optUuidCol: UUID?\n    @Persisted(indexed: true) var optObjectIdCol: ObjectId?\n    @Persisted(indexed: true) var optIntEnumCol: ModernIntEnum?\n    @Persisted(indexed: true) var optStringEnumCol: ModernStringEnum?\n}\n\nclass ModernAllIndexableButNotIndexedObject: Object {\n    @Persisted(indexed: false) var boolCol: Bool\n    @Persisted(indexed: false) var intCol: Int\n    @Persisted(indexed: false) var int8Col: Int8 = 1\n    @Persisted(indexed: false) var int16Col: Int16 = 2\n    @Persisted(indexed: false) var int32Col: Int32 = 3\n    @Persisted(indexed: false) var int64Col: Int64 = 4\n    @Persisted(indexed: false) var stringCol: String\n    @Persisted(indexed: false) var dateCol: Date\n    @Persisted(indexed: false) var uuidCol: UUID\n    @Persisted(indexed: false) var objectIdCol: ObjectId\n    @Persisted(indexed: false) var intEnumCol: ModernIntEnum\n    @Persisted(indexed: false) var stringEnumCol: ModernStringEnum\n\n    @Persisted(indexed: false) var optIntCol: Int?\n    @Persisted(indexed: false) var optInt8Col: Int8?\n    @Persisted(indexed: false) var optInt16Col: Int16?\n    @Persisted(indexed: false) var optInt32Col: Int32?\n    @Persisted(indexed: false) var optInt64Col: Int64?\n    @Persisted(indexed: false) var optBoolCol: Bool?\n    @Persisted(indexed: false) var optStringCol: String?\n    @Persisted(indexed: false) var optDateCol: Date?\n    @Persisted(indexed: false) var optUuidCol: UUID?\n    @Persisted(indexed: false) var optObjectIdCol: ObjectId?\n    @Persisted(indexed: false) var optIntEnumCol: ModernIntEnum?\n    @Persisted(indexed: false) var optStringEnumCol: ModernStringEnum?\n}\n\nclass ModernCollectionsOfEnums: Object {\n    @Persisted var listInt: List<EnumInt>\n    @Persisted var listInt8: List<EnumInt8>\n    @Persisted var listInt16: List<EnumInt16>\n    @Persisted var listInt32: List<EnumInt32>\n    @Persisted var listInt64: List<EnumInt64>\n    @Persisted var listFloat: List<EnumFloat>\n    @Persisted var listDouble: List<EnumDouble>\n    @Persisted var listString: List<EnumString>\n\n    @Persisted var listIntOpt: List<EnumInt?>\n    @Persisted var listInt8Opt: List<EnumInt8?>\n    @Persisted var listInt16Opt: List<EnumInt16?>\n    @Persisted var listInt32Opt: List<EnumInt32?>\n    @Persisted var listInt64Opt: List<EnumInt64?>\n    @Persisted var listFloatOpt: List<EnumFloat?>\n    @Persisted var listDoubleOpt: List<EnumDouble?>\n    @Persisted var listStringOpt: List<EnumString?>\n\n    @Persisted var setInt: MutableSet<EnumInt>\n    @Persisted var setInt8: MutableSet<EnumInt8>\n    @Persisted var setInt16: MutableSet<EnumInt16>\n    @Persisted var setInt32: MutableSet<EnumInt32>\n    @Persisted var setInt64: MutableSet<EnumInt64>\n    @Persisted var setFloat: MutableSet<EnumFloat>\n    @Persisted var setDouble: MutableSet<EnumDouble>\n    @Persisted var setString: MutableSet<EnumString>\n\n    @Persisted var setIntOpt: MutableSet<EnumInt?>\n    @Persisted var setInt8Opt: MutableSet<EnumInt8?>\n    @Persisted var setInt16Opt: MutableSet<EnumInt16?>\n    @Persisted var setInt32Opt: MutableSet<EnumInt32?>\n    @Persisted var setInt64Opt: MutableSet<EnumInt64?>\n    @Persisted var setFloatOpt: MutableSet<EnumFloat?>\n    @Persisted var setDoubleOpt: MutableSet<EnumDouble?>\n    @Persisted var setStringOpt: MutableSet<EnumString?>\n\n    @Persisted var mapInt: Map<String, EnumInt>\n    @Persisted var mapInt8: Map<String, EnumInt8>\n    @Persisted var mapInt16: Map<String, EnumInt16>\n    @Persisted var mapInt32: Map<String, EnumInt32>\n    @Persisted var mapInt64: Map<String, EnumInt64>\n    @Persisted var mapFloat: Map<String, EnumFloat>\n    @Persisted var mapDouble: Map<String, EnumDouble>\n    @Persisted var mapString: Map<String, EnumString>\n\n    @Persisted var mapIntOpt: Map<String, EnumInt?>\n    @Persisted var mapInt8Opt: Map<String, EnumInt8?>\n    @Persisted var mapInt16Opt: Map<String, EnumInt16?>\n    @Persisted var mapInt32Opt: Map<String, EnumInt32?>\n    @Persisted var mapInt64Opt: Map<String, EnumInt64?>\n    @Persisted var mapFloatOpt: Map<String, EnumFloat?>\n    @Persisted var mapDoubleOpt: Map<String, EnumDouble?>\n    @Persisted var mapStringOpt: Map<String, EnumString?>\n}\n\nclass LinkToModernCollectionsOfEnums: Object {\n    @Persisted var object: ModernCollectionsOfEnums?\n    @Persisted var list: List<ModernCollectionsOfEnums>\n    @Persisted var set: MutableSet<ModernCollectionsOfEnums>\n    @Persisted var map: Map<String, ModernCollectionsOfEnums?>\n}\n\nclass ModernListAnyRealmValueObject: Object {\n    @Persisted var value: List<AnyRealmValue>\n}\n\nclass ModernAllTypesProjection: Projection<ModernAllTypesObject> {\n    @Projected(\\ModernAllTypesObject.boolCol) var boolCol\n    @Projected(\\ModernAllTypesObject.intCol) var intCol: Int\n    @Projected(\\ModernAllTypesObject.floatCol) var floatCol: Float\n    @Projected(\\ModernAllTypesObject.doubleCol) var doubleCol: Double\n    @Projected(\\ModernAllTypesObject.stringCol) var stringCol: String\n    @Projected(\\ModernAllTypesObject.binaryCol) var binaryCol: Data\n    @Projected(\\ModernAllTypesObject.dateCol) var dateCol: Date\n    @Projected(\\ModernAllTypesObject.decimalCol) var decimalCol: Decimal128\n    @Projected(\\ModernAllTypesObject.objectIdCol) var objectIdCol: ObjectId\n    @Projected(\\ModernAllTypesObject.objectCol) var objectCol: ModernAllTypesObject?\n    @Projected(\\ModernAllTypesObject.arrayCol) var arrayCol: List<ModernAllTypesObject>\n    @Projected(\\ModernAllTypesObject.setCol) var setCol: MutableSet<ModernAllTypesObject>\n    @Projected(\\ModernAllTypesObject.mapCol) var mapCol: Map<String, ModernAllTypesObject?>\n    @Projected(\\ModernAllTypesObject.anyCol) var anyCol: AnyRealmValue\n    @Projected(\\ModernAllTypesObject.uuidCol) var uuidCol: UUID\n    @Projected(\\ModernAllTypesObject.intEnumCol) var intEnumCol: ModernIntEnum\n    @Projected(\\ModernAllTypesObject.stringEnumCol) var stringEnumCol: ModernStringEnum\n\n    @Projected(\\ModernAllTypesObject.optIntCol) var optIntCol: Int?\n    @Projected(\\ModernAllTypesObject.optFloatCol) var optFloatCol: Float?\n    @Projected(\\ModernAllTypesObject.optDoubleCol) var optDoubleCol: Double?\n    @Projected(\\ModernAllTypesObject.optBoolCol) var optBoolCol: Bool?\n    @Projected(\\ModernAllTypesObject.optStringCol) var optStringCol: String?\n    @Projected(\\ModernAllTypesObject.optBinaryCol) var optBinaryCol: Data?\n    @Projected(\\ModernAllTypesObject.optDateCol) var optDateCol: Date?\n    @Projected(\\ModernAllTypesObject.optDecimalCol) var optDecimalCol: Decimal128?\n    @Projected(\\ModernAllTypesObject.optObjectIdCol) var optObjectIdCol: ObjectId?\n    @Projected(\\ModernAllTypesObject.optUuidCol) var optUuidCol: UUID?\n    @Projected(\\ModernAllTypesObject.optIntEnumCol) var optIntEnumCol: ModernIntEnum?\n    @Projected(\\ModernAllTypesObject.optStringEnumCol) var optStringEnumCol: ModernStringEnum?\n\n    @Projected(\\ModernAllTypesObject.arrayBool) var arrayBool: List<Bool>\n    @Projected(\\ModernAllTypesObject.arrayInt) var arrayInt: List<Int>\n    @Projected(\\ModernAllTypesObject.arrayFloat) var arrayFloat: List<Float>\n    @Projected(\\ModernAllTypesObject.arrayDouble) var arrayDouble: List<Double>\n    @Projected(\\ModernAllTypesObject.arrayString) var arrayString: List<String>\n    @Projected(\\ModernAllTypesObject.arrayBinary) var arrayBinary: List<Data>\n    @Projected(\\ModernAllTypesObject.arrayDate) var arrayDate: List<Date>\n    @Projected(\\ModernAllTypesObject.arrayDecimal) var arrayDecimal: List<Decimal128>\n    @Projected(\\ModernAllTypesObject.arrayObjectId) var arrayObjectId: List<ObjectId>\n    @Projected(\\ModernAllTypesObject.arrayAny) var arrayAny: List<AnyRealmValue>\n    @Projected(\\ModernAllTypesObject.arrayUuid) var arrayUuid: List<UUID>\n\n    @Projected(\\ModernAllTypesObject.arrayOptBool) var arrayOptBool: List<Bool?>\n    @Projected(\\ModernAllTypesObject.arrayOptInt) var arrayOptInt: List<Int?>\n    @Projected(\\ModernAllTypesObject.arrayOptFloat) var arrayOptFloat: List<Float?>\n    @Projected(\\ModernAllTypesObject.arrayOptDouble) var arrayOptDouble: List<Double?>\n    @Projected(\\ModernAllTypesObject.arrayOptString) var arrayOptString: List<String?>\n    @Projected(\\ModernAllTypesObject.arrayOptBinary) var arrayOptBinary: List<Data?>\n    @Projected(\\ModernAllTypesObject.arrayOptDate) var arrayOptDate: List<Date?>\n    @Projected(\\ModernAllTypesObject.arrayOptDecimal) var arrayOptDecimal: List<Decimal128?>\n    @Projected(\\ModernAllTypesObject.arrayOptObjectId) var arrayOptObjectId: List<ObjectId?>\n    @Projected(\\ModernAllTypesObject.arrayOptUuid) var arrayOptUuid: List<UUID?>\n\n    @Projected(\\ModernAllTypesObject.setBool) var setBool: MutableSet<Bool>\n    @Projected(\\ModernAllTypesObject.setInt) var setInt: MutableSet<Int>\n    @Projected(\\ModernAllTypesObject.setFloat) var setFloat: MutableSet<Float>\n    @Projected(\\ModernAllTypesObject.setDouble) var setDouble: MutableSet<Double>\n    @Projected(\\ModernAllTypesObject.setString) var setString: MutableSet<String>\n    @Projected(\\ModernAllTypesObject.setBinary) var setBinary: MutableSet<Data>\n    @Projected(\\ModernAllTypesObject.setDate) var setDate: MutableSet<Date>\n    @Projected(\\ModernAllTypesObject.setDecimal) var setDecimal: MutableSet<Decimal128>\n    @Projected(\\ModernAllTypesObject.setObjectId) var setObjectId: MutableSet<ObjectId>\n    @Projected(\\ModernAllTypesObject.setAny) var setAny: MutableSet<AnyRealmValue>\n    @Projected(\\ModernAllTypesObject.setUuid) var setUuid: MutableSet<UUID>\n\n    @Projected(\\ModernAllTypesObject.setOptBool) var setOptBool: MutableSet<Bool?>\n    @Projected(\\ModernAllTypesObject.setOptInt) var setOptInt: MutableSet<Int?>\n    @Projected(\\ModernAllTypesObject.setOptFloat) var setOptFloat: MutableSet<Float?>\n    @Projected(\\ModernAllTypesObject.setOptDouble) var setOptDouble: MutableSet<Double?>\n    @Projected(\\ModernAllTypesObject.setOptString) var setOptString: MutableSet<String?>\n    @Projected(\\ModernAllTypesObject.setOptBinary) var setOptBinary: MutableSet<Data?>\n    @Projected(\\ModernAllTypesObject.setOptDate) var setOptDate: MutableSet<Date?>\n    @Projected(\\ModernAllTypesObject.setOptDecimal) var setOptDecimal: MutableSet<Decimal128?>\n    @Projected(\\ModernAllTypesObject.setOptObjectId) var setOptObjectId: MutableSet<ObjectId?>\n    @Projected(\\ModernAllTypesObject.setOptUuid) var setOptUuid: MutableSet<UUID?>\n\n    @Projected(\\ModernAllTypesObject.mapBool) var mapBool: Map<String, Bool>\n    @Projected(\\ModernAllTypesObject.mapInt) var mapInt: Map<String, Int>\n    @Projected(\\ModernAllTypesObject.mapFloat) var mapFloat: Map<String, Float>\n    @Projected(\\ModernAllTypesObject.mapDouble) var mapDouble: Map<String, Double>\n    @Projected(\\ModernAllTypesObject.mapString) var mapString: Map<String, String>\n    @Projected(\\ModernAllTypesObject.mapBinary) var mapBinary: Map<String, Data>\n    @Projected(\\ModernAllTypesObject.mapDate) var mapDate: Map<String, Date>\n    @Projected(\\ModernAllTypesObject.mapDecimal) var mapDecimal: Map<String, Decimal128>\n    @Projected(\\ModernAllTypesObject.mapObjectId) var mapObjectId: Map<String, ObjectId>\n    @Projected(\\ModernAllTypesObject.mapAny) var mapAny: Map<String, AnyRealmValue>\n    @Projected(\\ModernAllTypesObject.mapUuid) var mapUuid: Map<String, UUID>\n\n    @Projected(\\ModernAllTypesObject.mapOptBool) var mapOptBool: Map<String, Bool?>\n    @Projected(\\ModernAllTypesObject.mapOptInt) var mapOptInt: Map<String, Int?>\n    @Projected(\\ModernAllTypesObject.mapOptFloat) var mapOptFloat: Map<String, Float?>\n    @Projected(\\ModernAllTypesObject.mapOptDouble) var mapOptDouble: Map<String, Double?>\n    @Projected(\\ModernAllTypesObject.mapOptString) var mapOptString: Map<String, String?>\n    @Projected(\\ModernAllTypesObject.mapOptBinary) var mapOptBinary: Map<String, Data?>\n    @Projected(\\ModernAllTypesObject.mapOptDate) var mapOptDate: Map<String, Date?>\n    @Projected(\\ModernAllTypesObject.mapOptDecimal) var mapOptDecimal: Map<String, Decimal128?>\n    @Projected(\\ModernAllTypesObject.mapOptObjectId) var mapOptObjectId: Map<String, ObjectId?>\n    @Projected(\\ModernAllTypesObject.mapOptUuid) var mapOptUuid: Map<String, UUID?>\n\n    @Projected(\\ModernAllTypesObject.linkingObjects) var linkingObjects: LinkingObjects<ModernAllTypesObject>\n}\n"
  },
  {
    "path": "RealmSwift/Tests/MutableSetTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\nclass MutableSetTests: TestCase {\n    var str1: SwiftStringObject?\n    var str2: SwiftStringObject?\n    var str3: SwiftStringObject?\n    var setObject: SwiftMutableSetPropertyObject!\n    var setObject2: SwiftMutableSetPropertyObject!\n    var set: MutableSet<SwiftStringObject>?\n    var set2: MutableSet<SwiftStringObject>?\n\n    func createSet() -> SwiftMutableSetPropertyObject {\n        fatalError(\"abstract\")\n    }\n\n    func createSetWithLinks() -> SwiftMutableSetOfSwiftObject {\n        fatalError(\"abstract\")\n    }\n\n    override func setUp() {\n        super.setUp()\n\n        let str1 = SwiftStringObject()\n        str1.stringCol = \"1\"\n        self.str1 = str1\n\n        let str2 = SwiftStringObject()\n        str2.stringCol = \"2\"\n        self.str2 = str2\n\n        let str3 = SwiftStringObject()\n        str3.stringCol = \"3\"\n        self.str3 = str3\n\n        setObject = createSet()\n        setObject2 = createSet()\n        set = setObject.set\n        set2 = setObject2.set\n\n        let realm = realmWithTestPath()\n        try! realm.write {\n            realm.add(str1)\n            realm.add(str2)\n            realm.add(str3)\n        }\n\n        realm.beginWrite()\n    }\n\n    override func tearDown() {\n        try! realmWithTestPath().commitWrite()\n\n        str1 = nil\n        str2 = nil\n        str3 = nil\n        setObject = nil\n        setObject2 = nil\n        set = nil\n        set2 = nil\n\n        super.tearDown()\n    }\n\n    override class var defaultTestSuite: XCTestSuite {\n        // Don't run tests for the base class\n        if isEqual(MutableSetTests.self) {\n            return XCTestSuite(name: \"empty\")\n        }\n        return super.defaultTestSuite\n    }\n\n    func testPrimitive() {\n        let obj = SwiftMutableSetObject()\n        obj.int.insert(5)\n        XCTAssertEqual(obj.int.first!, 5)\n        XCTAssertEqual(obj.int.last!, 5)\n        XCTAssertEqual(obj.int[0], 5)\n        obj.int.insert(objectsIn: [6, 7, 8] as [Int])\n        XCTAssertEqual(obj.int.max(), 8)\n        XCTAssertEqual(obj.int.sum(), 26)\n\n        obj.string.insert(\"str\")\n        XCTAssertEqual(obj.string.first!, \"str\")\n        XCTAssertEqual(obj.string[0], \"str\")\n    }\n\n    func testPrimitiveIterationAcrossNil() {\n        let obj = SwiftMutableSetObject()\n        XCTAssertFalse(obj.int.contains(5))\n        XCTAssertFalse(obj.int8.contains(5))\n        XCTAssertFalse(obj.int16.contains(5))\n        XCTAssertFalse(obj.int32.contains(5))\n        XCTAssertFalse(obj.int64.contains(5))\n        XCTAssertFalse(obj.float.contains(3.141592))\n        XCTAssertFalse(obj.double.contains(3.141592))\n        XCTAssertFalse(obj.string.contains(\"foobar\"))\n        XCTAssertFalse(obj.data.contains(Data()))\n        XCTAssertFalse(obj.date.contains(Date()))\n        XCTAssertFalse(obj.decimal.contains(Decimal128()))\n        XCTAssertFalse(obj.objectId.contains(ObjectId()))\n        XCTAssertFalse(obj.uuidOpt.contains(UUID()))\n\n        XCTAssertFalse(obj.intOpt.contains { $0 == nil })\n        XCTAssertFalse(obj.int8Opt.contains { $0 == nil })\n        XCTAssertFalse(obj.int16Opt.contains { $0 == nil })\n        XCTAssertFalse(obj.int32Opt.contains { $0 == nil })\n        XCTAssertFalse(obj.int64Opt.contains { $0 == nil })\n        XCTAssertFalse(obj.floatOpt.contains { $0 == nil })\n        XCTAssertFalse(obj.doubleOpt.contains { $0 == nil })\n        XCTAssertFalse(obj.stringOpt.contains { $0 == nil })\n        XCTAssertFalse(obj.dataOpt.contains { $0 == nil })\n        XCTAssertFalse(obj.dateOpt.contains { $0 == nil })\n        XCTAssertFalse(obj.decimalOpt.contains { $0 == nil })\n        XCTAssertFalse(obj.objectIdOpt.contains { $0 == nil })\n        XCTAssertFalse(obj.uuidOpt.contains { $0 == nil })\n    }\n\n    func testInvalidated() {\n        guard let set = set else {\n            fatalError(\"Test precondition failure\")\n        }\n        XCTAssertFalse(set.isInvalidated)\n\n        if let realm = setObject.realm {\n            realm.delete(setObject)\n            XCTAssertTrue(set.isInvalidated)\n        }\n    }\n\n    func testFastEnumerationWithMutation() {\n        guard let set = set, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n\n        set.insert(objectsIn: [str1, str2, str1, str2, str1, str2, str1, str2, str1,\n            str2, str1, str2, str1, str2, str1, str2, str1, str2, str1, str2])\n        var str = \"\"\n        for obj in set {\n            str += obj.stringCol\n            set.insert(objectsIn: [str1])\n        }\n\n        XCTAssertTrue(set.contains(str1))\n        XCTAssertTrue(set.contains(str2))\n    }\n\n    func testAppendObject() {\n        guard let set = set, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n        for str in [str1, str2, str1] {\n            set.insert(str)\n        }\n        XCTAssertEqual(Int(2), set.count)\n        XCTAssertTrue(set.contains(str1))\n        XCTAssertTrue(set.contains(str2))\n    }\n\n    func testInsert() {\n        guard let set = set, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n        set.insert(objectsIn: [str1, str2, str1])\n        XCTAssertEqual(Int(2), set.count)\n        XCTAssertTrue(set.contains(str1))\n        XCTAssertTrue(set.contains(str2))\n    }\n\n    func testAppendResults() {\n        guard let set = set, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n        set.insert(objectsIn: realmWithTestPath().objects(SwiftStringObject.self))\n        XCTAssertEqual(Int(3), set.count)\n        // The unmanaged NSSet backing object won't work with MutableSet.contains(:)\n        set.forEach {\n            // Ordering is not guaranteed so we can't subscript\n            XCTAssertTrue($0.isSameObject(as: str1) || $0.isSameObject(as: str2) || $0.isSameObject(as: str3))\n        }\n    }\n\n    func testRemoveAll() {\n        guard let set = set, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n\n        set.insert(objectsIn: [str1, str2])\n\n        set.removeAll()\n        XCTAssertEqual(Int(0), set.count)\n\n        set.removeAll() // should be a no-op\n        XCTAssertEqual(Int(0), set.count)\n    }\n\n    func testRemoveObject() {\n        guard let set = set, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n\n        set.insert(objectsIn: [str1, str2])\n        XCTAssertTrue(set.contains(str1))\n        XCTAssertEqual(Int(2), set.count)\n        set.remove(str1)\n        XCTAssertFalse(set.contains(str1))\n        XCTAssertEqual(Int(1), set.count)\n        set.removeAll()\n        XCTAssertEqual(Int(0), set.count)\n        XCTAssertFalse(set.contains(str1))\n        XCTAssertFalse(set.contains(str2))\n    }\n\n    func testChangesArePersisted() {\n        guard let set = set, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n        if let realm = set.realm {\n            set.insert(objectsIn: [str1, str2])\n\n            let otherSet = realm.objects(SwiftMutableSetPropertyObject.self).first!.set\n            XCTAssertEqual(Int(2), otherSet.count)\n        }\n    }\n\n    func testPopulateEmptySet() {\n        guard let set = set else {\n            fatalError(\"Test precondition failure\")\n        }\n\n        XCTAssertEqual(set.count, 0, \"Should start with no set elements.\")\n\n        let obj = SwiftStringObject()\n        obj.stringCol = \"a\"\n        set.insert(obj)\n        set.insert(realmWithTestPath().create(SwiftStringObject.self, value: [\"b\"]))\n        set.insert(obj)\n\n        XCTAssertEqual(set.count, 2)\n        set.forEach {\n            XCTAssertTrue($0.stringCol == \"a\" || $0.stringCol == \"b\")\n        }\n\n        // Make sure we can enumerate\n        for obj in set {\n            XCTAssertTrue(obj.description.utf16.count > 0, \"Object should have description\")\n        }\n    }\n\n    func testEnumeratingSetWithSetProperties() {\n        let setObject = createSetWithLinks()\n\n        setObject.realm?.beginWrite()\n        for _ in 0..<10 {\n            setObject.set.insert(SwiftObject())\n        }\n        try! setObject.realm?.commitWrite()\n\n        XCTAssertEqual(10, setObject.set.count)\n\n        for object in setObject.set {\n            XCTAssertEqual(123, object.intCol)\n            XCTAssertEqual(false, object.objectCol!.boolCol)\n            XCTAssertEqual(0, object.setCol.count)\n        }\n    }\n\n    func testValueForKey() {\n        let realm = try! Realm()\n        try! realm.write {\n            for value in [1, 2] {\n                let setObject = SwiftMutableSetOfSwiftObject()\n                let object = SwiftObject()\n                object.intCol = value\n                object.doubleCol = Double(value)\n                object.stringCol = String(value)\n                object.decimalCol = Decimal128(number: value as NSNumber)\n                object.objectIdCol = try! ObjectId(string: String(repeating: String(value), count: 24))\n                setObject.set.insert(object)\n                realm.add(setObject)\n            }\n        }\n\n        let setObjects = realm.objects(SwiftMutableSetOfSwiftObject.self)\n        let setsOfObjects = setObjects.value(forKeyPath: \"set\") as! [MutableSet<SwiftObject>]\n        let objects = realm.objects(SwiftObject.self)\n\n        func testProperty<T: Equatable>(line: UInt = #line, fn: @escaping (SwiftObject) -> T) {\n            let properties: [T] = Array(setObjects.flatMap { $0.set.map(fn) })\n            let kvcProperties: [T] = Array(setsOfObjects.flatMap { $0.map(fn) })\n            XCTAssertEqual(properties, kvcProperties, line: line)\n        }\n        func testProperty<T: Equatable>(_ name: String, line: UInt = #line, fn: @escaping (SwiftObject) -> T) {\n            let properties = Array(objects.compactMap(fn))\n            let setsOfObjects = objects.value(forKeyPath: name) as! [T]\n            let kvcProperties = Array(setsOfObjects.compactMap { $0 })\n\n            XCTAssertEqual(properties, kvcProperties, line: line)\n        }\n\n        testProperty { $0.intCol }\n        testProperty { $0.doubleCol }\n        testProperty { $0.stringCol }\n        testProperty { $0.decimalCol }\n        testProperty { $0.objectIdCol }\n\n        testProperty(\"intCol\") { $0.intCol }\n        testProperty(\"doubleCol\") { $0.doubleCol }\n        testProperty(\"stringCol\") { $0.stringCol }\n        testProperty(\"decimalCol\") { $0.decimalCol }\n        testProperty(\"objectIdCol\") { $0.objectIdCol }\n    }\n\n    @available(*, deprecated) // Silence deprecation warnings for RealmOptional\n    func testValueForKeyOptional() {\n        let realm = try! Realm()\n        try! realm.write {\n            for value in [1, 2] {\n                let setObject = SwiftMutableSetOfSwiftOptionalObject()\n                let object = SwiftOptionalObject()\n                object.optIntCol.value = value\n                object.optInt8Col.value = Int8(value)\n                object.optDoubleCol.value = Double(value)\n                object.optStringCol = String(value)\n                object.optNSStringCol = NSString(format: \"%d\", value)\n                object.optDecimalCol = Decimal128(number: value as NSNumber)\n                object.optObjectIdCol = try! ObjectId(string: String(repeating: String(value), count: 24))\n                setObject.set.insert(object)\n                realm.add(setObject)\n            }\n        }\n\n        let setObjects = realm.objects(SwiftMutableSetOfSwiftOptionalObject.self)\n        let setOfObjects = setObjects.value(forKeyPath: \"set\") as! [MutableSet<SwiftOptionalObject>]\n        let objects = realm.objects(SwiftOptionalObject.self)\n\n        func testProperty<T: Equatable>(line: UInt = #line, fn: @escaping (SwiftOptionalObject) -> T) {\n            let properties: [T] = Array(setObjects.flatMap { $0.set.map(fn) })\n            let kvcProperties: [T] = Array(setOfObjects.flatMap { $0.map(fn) })\n            XCTAssertEqual(properties, kvcProperties, line: line)\n        }\n        func testProperty<T: Equatable>(_ name: String, line: UInt = #line, fn: @escaping (SwiftOptionalObject) -> T) {\n            let properties = Array(objects.compactMap(fn))\n            let setsOfObjects = objects.value(forKeyPath: name) as! [T]\n            let kvcProperties = Array(setsOfObjects.compactMap { $0 })\n\n            XCTAssertEqual(properties, kvcProperties, line: line)\n        }\n\n        testProperty { $0.optIntCol.value }\n        testProperty { $0.optInt8Col.value }\n        testProperty { $0.optDoubleCol.value }\n        testProperty { $0.optStringCol }\n        testProperty { $0.optNSStringCol }\n        testProperty { $0.optDecimalCol }\n        testProperty { $0.optObjectCol }\n\n        testProperty(\"optIntCol\") { $0.optIntCol.value }\n        testProperty(\"optInt8Col\") { $0.optInt8Col.value }\n        testProperty(\"optDoubleCol\") { $0.optDoubleCol.value }\n        testProperty(\"optStringCol\") { $0.optStringCol }\n        testProperty(\"optNSStringCol\") { $0.optNSStringCol }\n        testProperty(\"optDecimalCol\") { $0.optDecimalCol }\n        testProperty(\"optObjectCol\") { $0.optObjectCol }\n    }\n\n    func testUnmanagedSetComparison() {\n        let obj = SwiftIntObject()\n        obj.intCol = 5\n        let obj2 = SwiftIntObject()\n        obj2.intCol = 6\n        let obj3 = SwiftIntObject()\n        obj3.intCol = 8\n\n        let objects = [obj, obj2, obj3]\n        let objects2 = [obj, obj2]\n\n        let set1 = MutableSet<SwiftIntObject>()\n        let set2 = MutableSet<SwiftIntObject>()\n        XCTAssertEqual(set1, set2, \"Empty instances should be equal by `==` operator\")\n\n        set1.insert(objectsIn: objects)\n        set2.insert(objectsIn: objects)\n\n        let set3 = MutableSet<SwiftIntObject>()\n        set3.insert(objectsIn: objects2)\n\n        XCTAssertTrue(set1 !== set2, \"instances should not be identical\")\n\n        XCTAssertEqual(set1, set2, \"instances should be equal by `==` operator\")\n        XCTAssertNotEqual(set1, set3, \"instances should be equal by `==` operator\")\n\n        XCTAssertTrue(set1.isEqual(set2), \"instances should be equal by `isEqual` method\")\n        XCTAssertTrue(!set1.isEqual(set3), \"instances should be equal by `isEqual` method\")\n\n        XCTAssertEqual(Array(set1), Array(set2), \"instances converted to Swift.Array should be equal\")\n        XCTAssertNotEqual(Array(set1), Array(set3), \"instances converted to Swift.Array should be equal\")\n        XCTAssertEqual(Set(set1), Set(set2), \"instances converted to Swift.Array should be equal\")\n        XCTAssertNotEqual(Set(set1), Set(set3), \"instances converted to Swift.Array should be equal\")\n        set3.insert(obj3)\n        XCTAssertEqual(set1, set3, \"instances should be equal by `==` operator\")\n    }\n\n    func testSubset() {\n        guard let set = set, let set2 = set2, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n        set.removeAll()\n        set2.removeAll()\n        XCTAssertEqual(Int(0), set.count)\n        XCTAssertEqual(Int(0), set2.count)\n        set.insert(objectsIn: [str1, str2, str1])\n        set2.insert(objectsIn: [str1])\n        XCTAssertEqual(Int(2), set.count)\n        XCTAssertEqual(Int(1), set2.count)\n        XCTAssertTrue(set2.isSubset(of: set))\n        XCTAssertFalse(set.isSubset(of: set2))\n    }\n\n    func testUnion() {\n        guard let set = set, let set2 = set2, let str1 = str1, let str2 = str2 else {\n            fatalError(\"Test precondition failure\")\n        }\n        set.removeAll()\n        set2.removeAll()\n        set.insert(objectsIn: [str1, str2, str1])\n        set2.insert(objectsIn: [str1])\n        XCTAssertEqual(Int(2), set.count)\n        XCTAssertEqual(Int(1), set2.count)\n        XCTAssertTrue(set2.isSubset(of: set))\n        XCTAssertFalse(set.isSubset(of: set2))\n    }\n\n    func testIntersection() {\n        guard let set = set, let set2 = set2, let str1 = str1, let str2 = str2, let str3 = str3 else {\n            fatalError(\"Test precondition failure\")\n        }\n        set.removeAll()\n        set2.removeAll()\n        set.insert(objectsIn: [str1, str2])\n        set2.insert(objectsIn: [str2, str3])\n        XCTAssertEqual(Int(2), set.count)\n        XCTAssertEqual(Int(2), set2.count)\n        XCTAssertTrue(set.intersects(set2))\n        XCTAssertTrue(set2.intersects(set))\n\n        set.formIntersection(set2)\n        XCTAssertTrue(set.intersects(set2))\n        XCTAssertTrue(set2.intersects(set))\n        XCTAssertEqual(Int(1), set.count)\n    }\n\n    func testSubtract() {\n        guard let set = set, let set2 = set2, let str1 = str1, let str2 = str2, let str3 = str3 else {\n            fatalError(\"Test precondition failure\")\n        }\n        set.removeAll()\n        set2.removeAll()\n        set.insert(objectsIn: [str1, str2])\n        set2.insert(objectsIn: [str2, str3])\n        XCTAssertEqual(Int(2), set.count)\n        XCTAssertEqual(Int(2), set2.count)\n\n        set.subtract(set2)\n        XCTAssertEqual(Int(1), set.count)\n        XCTAssertTrue(set.contains(str1))\n    }\n}\n\nclass MutableSetStandaloneTests: MutableSetTests {\n    override func createSet() -> SwiftMutableSetPropertyObject {\n        let set = SwiftMutableSetPropertyObject()\n        XCTAssertNil(set.realm)\n        return set\n    }\n\n    override func createSetWithLinks() -> SwiftMutableSetOfSwiftObject {\n        let set = SwiftMutableSetOfSwiftObject()\n        XCTAssertNil(set.realm)\n        return set\n    }\n}\n\nclass MutableSetNewlyAddedTests: MutableSetTests {\n    override func createSet() -> SwiftMutableSetPropertyObject {\n        let set = SwiftMutableSetPropertyObject()\n        set.name = \"name\"\n        let realm = realmWithTestPath()\n        try! realm.write { realm.add(set) }\n\n        XCTAssertNotNil(set.realm)\n        return set\n    }\n\n    override func createSetWithLinks() -> SwiftMutableSetOfSwiftObject {\n        let set = SwiftMutableSetOfSwiftObject()\n        let realm = try! Realm()\n        try! realm.write { realm.add(set) }\n\n        XCTAssertNotNil(set.realm)\n        return set\n    }\n}\n\nclass MutableSetNewlyCreatedTests: MutableSetTests {\n    override func createSet() -> SwiftMutableSetPropertyObject {\n        let realm = realmWithTestPath()\n        realm.beginWrite()\n        let set = realm.create(SwiftMutableSetPropertyObject.self, value: [\"name\"])\n        try! realm.commitWrite()\n\n        XCTAssertNotNil(set.realm)\n        return set\n    }\n\n    override func createSetWithLinks() -> SwiftMutableSetOfSwiftObject {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let set = realm.create(SwiftMutableSetOfSwiftObject.self)\n        try! realm.commitWrite()\n\n        XCTAssertNotNil(set.realm)\n        return set\n    }\n}\n\nclass MutableSetRetrievedTests: MutableSetTests {\n    override func createSet() -> SwiftMutableSetPropertyObject {\n        let realm = realmWithTestPath()\n        realm.beginWrite()\n        realm.create(SwiftMutableSetPropertyObject.self, value: [\"name\"])\n        try! realm.commitWrite()\n        let set = realm.objects(SwiftMutableSetPropertyObject.self).last!\n\n        XCTAssertNotNil(set.realm)\n        return set\n    }\n\n    override func createSetWithLinks() -> SwiftMutableSetOfSwiftObject {\n        let realm = try! Realm()\n        realm.beginWrite()\n        realm.create(SwiftMutableSetOfSwiftObject.self)\n        try! realm.commitWrite()\n        let set = realm.objects(SwiftMutableSetOfSwiftObject.self).first!\n\n        XCTAssertNotNil(set.realm)\n        return set\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/ObjectAccessorTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport Realm.Private\nimport RealmSwift\nimport Foundation\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass ObjectAccessorTests: TestCase {\n    func setAndTestAllPropertiesViaNormalAccess(_ object: SwiftObject, _ optObject: SwiftOptionalObject) {\n        object.boolCol = true\n        XCTAssertEqual(object.boolCol, true)\n        object.boolCol = false\n        XCTAssertEqual(object.boolCol, false)\n\n        object.intCol = -1\n        XCTAssertEqual(object.intCol, -1)\n        object.intCol = 0\n        XCTAssertEqual(object.intCol, 0)\n        object.intCol = 1\n        XCTAssertEqual(object.intCol, 1)\n\n        object.int8Col = -1\n        XCTAssertEqual(object.int8Col, -1)\n        object.int8Col = 0\n        XCTAssertEqual(object.int8Col, 0)\n        object.int8Col = 1\n        XCTAssertEqual(object.int8Col, 1)\n\n        object.int16Col = -1\n        XCTAssertEqual(object.int16Col, -1)\n        object.int16Col = 0\n        XCTAssertEqual(object.int16Col, 0)\n        object.int16Col = 1\n        XCTAssertEqual(object.int16Col, 1)\n\n        object.int32Col = -1\n        XCTAssertEqual(object.int32Col, -1)\n        object.int32Col = 0\n        XCTAssertEqual(object.int32Col, 0)\n        object.int32Col = 1\n        XCTAssertEqual(object.int32Col, 1)\n\n        object.int64Col = -1\n        XCTAssertEqual(object.int64Col, -1)\n        object.int64Col = 0\n        XCTAssertEqual(object.int64Col, 0)\n        object.int64Col = 1\n        XCTAssertEqual(object.int64Col, 1)\n\n        object.floatCol = 20\n        XCTAssertEqual(object.floatCol, 20 as Float)\n        object.floatCol = 20.2\n        XCTAssertEqual(object.floatCol, 20.2 as Float)\n        object.floatCol = 16777217\n        XCTAssertEqual(Double(object.floatCol), 16777216.0 as Double)\n\n        object.doubleCol = 20\n        XCTAssertEqual(object.doubleCol, 20)\n        object.doubleCol = 20.2\n        XCTAssertEqual(object.doubleCol, 20.2)\n        object.doubleCol = 16777217\n        XCTAssertEqual(object.doubleCol, 16777217)\n\n        object.stringCol = \"\"\n        XCTAssertEqual(object.stringCol, \"\")\n        let utf8TestString = \"值значен™👍☞⎠‱௹♣︎☐▼❒∑⨌⧭иеمرحبا\"\n        object.stringCol = utf8TestString\n        XCTAssertEqual(object.stringCol, utf8TestString)\n\n        let data = \"b\".data(using: String.Encoding.utf8, allowLossyConversion: false)!\n        object.binaryCol = data\n        XCTAssertEqual(object.binaryCol, data)\n\n        let date = Date(timeIntervalSinceReferenceDate: 2)\n        object.dateCol = date\n        XCTAssertEqual(object.dateCol, date)\n\n        object.objectCol = SwiftBoolObject(value: [true])\n        XCTAssertEqual(object.objectCol!.boolCol, true)\n\n        object.intEnumCol = .value1\n        XCTAssertEqual(object.intEnumCol, .value1)\n        object.intEnumCol = .value2\n        XCTAssertEqual(object.intEnumCol, .value2)\n\n        object.decimalCol = \"inf\"\n        XCTAssertEqual(object.decimalCol, \"inf\")\n        object.decimalCol = \"-inf\"\n        XCTAssertEqual(object.decimalCol, \"-inf\")\n        object.decimalCol = \"0\"\n        XCTAssertEqual(object.decimalCol, \"0\")\n        object.decimalCol = \"nan\"\n        XCTAssertTrue(object.decimalCol.isNaN)\n\n        let oid1 = ObjectId(\"1234567890ab1234567890ab\")\n        let oid2 = ObjectId(\"abcdef123456abcdef123456\")\n        object.objectIdCol = oid1\n        XCTAssertEqual(object.objectIdCol, oid1)\n        object.objectIdCol = oid2\n        XCTAssertEqual(object.objectIdCol, oid2)\n\n        object.anyCol.value = .string(\"hello\")\n        XCTAssertEqual(object.anyCol.value.stringValue, \"hello\")\n\n        // Optional properties\n\n        optObject.optNSStringCol = \"\"\n        XCTAssertEqual(optObject.optNSStringCol!, \"\")\n        optObject.optNSStringCol = utf8TestString as NSString?\n        XCTAssertEqual(optObject.optNSStringCol! as String, utf8TestString)\n        optObject.optNSStringCol = nil\n        XCTAssertNil(optObject.optNSStringCol)\n\n        optObject.optStringCol = \"\"\n        XCTAssertEqual(optObject.optStringCol!, \"\")\n        optObject.optStringCol = utf8TestString\n        XCTAssertEqual(optObject.optStringCol!, utf8TestString)\n        optObject.optStringCol = nil\n        XCTAssertNil(optObject.optStringCol)\n\n        optObject.optBinaryCol = data\n        XCTAssertEqual(optObject.optBinaryCol!, data)\n        optObject.optBinaryCol = nil\n        XCTAssertNil(optObject.optBinaryCol)\n\n        optObject.optDateCol = date\n        XCTAssertEqual(optObject.optDateCol!, date)\n        optObject.optDateCol = nil\n        XCTAssertNil(optObject.optDateCol)\n\n        optObject.optIntCol.value = Int.min\n        XCTAssertEqual(optObject.optIntCol.value!, Int.min)\n        optObject.optIntCol.value = 0\n        XCTAssertEqual(optObject.optIntCol.value!, 0)\n        optObject.optIntCol.value = Int.max\n        XCTAssertEqual(optObject.optIntCol.value!, Int.max)\n        optObject.optIntCol.value = nil\n        XCTAssertNil(optObject.optIntCol.value)\n\n        optObject.optInt8Col.value = Int8.min\n        XCTAssertEqual(optObject.optInt8Col.value!, Int8.min)\n        optObject.optInt8Col.value = 0\n        XCTAssertEqual(optObject.optInt8Col.value!, 0)\n        optObject.optInt8Col.value = Int8.max\n        XCTAssertEqual(optObject.optInt8Col.value!, Int8.max)\n        optObject.optInt8Col.value = nil\n        XCTAssertNil(optObject.optInt8Col.value)\n\n        optObject.optInt16Col.value = Int16.min\n        XCTAssertEqual(optObject.optInt16Col.value!, Int16.min)\n        optObject.optInt16Col.value = 0\n        XCTAssertEqual(optObject.optInt16Col.value!, 0)\n        optObject.optInt16Col.value = Int16.max\n        XCTAssertEqual(optObject.optInt16Col.value!, Int16.max)\n        optObject.optInt16Col.value = nil\n        XCTAssertNil(optObject.optInt16Col.value)\n\n        optObject.optInt32Col.value = Int32.min\n        XCTAssertEqual(optObject.optInt32Col.value!, Int32.min)\n        optObject.optInt32Col.value = 0\n        XCTAssertEqual(optObject.optInt32Col.value!, 0)\n        optObject.optInt32Col.value = Int32.max\n        XCTAssertEqual(optObject.optInt32Col.value!, Int32.max)\n        optObject.optInt32Col.value = nil\n        XCTAssertNil(optObject.optInt32Col.value)\n\n        optObject.optInt64Col.value = Int64.min\n        XCTAssertEqual(optObject.optInt64Col.value!, Int64.min)\n        optObject.optInt64Col.value = 0\n        XCTAssertEqual(optObject.optInt64Col.value!, 0)\n        optObject.optInt64Col.value = Int64.max\n        XCTAssertEqual(optObject.optInt64Col.value!, Int64.max)\n        optObject.optInt64Col.value = nil\n        XCTAssertNil(optObject.optInt64Col.value)\n\n        optObject.optFloatCol.value = -Float.greatestFiniteMagnitude\n        XCTAssertEqual(optObject.optFloatCol.value!, -Float.greatestFiniteMagnitude)\n        optObject.optFloatCol.value = 0\n        XCTAssertEqual(optObject.optFloatCol.value!, 0)\n        optObject.optFloatCol.value = Float.greatestFiniteMagnitude\n        XCTAssertEqual(optObject.optFloatCol.value!, Float.greatestFiniteMagnitude)\n        optObject.optFloatCol.value = nil\n        XCTAssertNil(optObject.optFloatCol.value)\n\n        optObject.optDoubleCol.value = -Double.greatestFiniteMagnitude\n        XCTAssertEqual(optObject.optDoubleCol.value!, -Double.greatestFiniteMagnitude)\n        optObject.optDoubleCol.value = 0\n        XCTAssertEqual(optObject.optDoubleCol.value!, 0)\n        optObject.optDoubleCol.value = Double.greatestFiniteMagnitude\n        XCTAssertEqual(optObject.optDoubleCol.value!, Double.greatestFiniteMagnitude)\n        optObject.optDoubleCol.value = nil\n        XCTAssertNil(optObject.optDoubleCol.value)\n\n        optObject.optBoolCol.value = true\n        XCTAssertEqual(optObject.optBoolCol.value!, true)\n        optObject.optBoolCol.value = false\n        XCTAssertEqual(optObject.optBoolCol.value!, false)\n        optObject.optBoolCol.value = nil\n        XCTAssertNil(optObject.optBoolCol.value)\n\n        optObject.optObjectCol = SwiftBoolObject(value: [true])\n        XCTAssertEqual(optObject.optObjectCol!.boolCol, true)\n        optObject.optObjectCol = nil\n        XCTAssertNil(optObject.optObjectCol)\n\n        optObject.optEnumCol.value = .value1\n        XCTAssertEqual(optObject.optEnumCol.value, .value1)\n        optObject.optEnumCol.value = .value2\n        XCTAssertEqual(optObject.optEnumCol.value, .value2)\n        optObject.optEnumCol.value = nil\n        XCTAssertNil(optObject.optEnumCol.value)\n    }\n\n    func setAndTestAllPropertiesViaSubscript(_ object: SwiftObject, _ optObject: SwiftOptionalObject) {\n        object[\"boolCol\"] = true\n        XCTAssertEqual(object[\"boolCol\"] as! Bool, true)\n        object[\"boolCol\"] = false\n        XCTAssertEqual(object[\"boolCol\"] as! Bool, false)\n\n        object[\"intCol\"] = -1\n        XCTAssertEqual(object[\"intCol\"] as! Int, -1)\n        object[\"intCol\"] = 0\n        XCTAssertEqual(object[\"intCol\"] as! Int, 0)\n        object[\"intCol\"] = 1\n        XCTAssertEqual(object[\"intCol\"] as! Int, 1)\n\n        object[\"int8Col\"] = -1\n        XCTAssertEqual(object[\"int8Col\"] as! Int, -1)\n        object[\"int8Col\"] = 0\n        XCTAssertEqual(object[\"int8Col\"] as! Int, 0)\n        object[\"int8Col\"] = 1\n        XCTAssertEqual(object[\"int8Col\"] as! Int, 1)\n\n        object[\"int16Col\"] = -1\n        XCTAssertEqual(object[\"int16Col\"] as! Int, -1)\n        object[\"int16Col\"] = 0\n        XCTAssertEqual(object[\"int16Col\"] as! Int, 0)\n        object[\"int16Col\"] = 1\n        XCTAssertEqual(object[\"int16Col\"] as! Int, 1)\n\n        object[\"int32Col\"] = -1\n        XCTAssertEqual(object[\"int32Col\"] as! Int, -1)\n        object[\"int32Col\"] = 0\n        XCTAssertEqual(object[\"int32Col\"] as! Int, 0)\n        object[\"int32Col\"] = 1\n        XCTAssertEqual(object[\"int32Col\"] as! Int, 1)\n\n        object[\"int64Col\"] = -1\n        XCTAssertEqual(object[\"int64Col\"] as! Int, -1)\n        object[\"int64Col\"] = 0\n        XCTAssertEqual(object[\"int64Col\"] as! Int, 0)\n        object[\"int64Col\"] = 1\n        XCTAssertEqual(object[\"int64Col\"] as! Int, 1)\n\n        object[\"floatCol\"] = 20\n        XCTAssertEqual(object[\"floatCol\"] as! Float, 20 as Float)\n        object[\"floatCol\"] = 20.2\n        XCTAssertEqual(object[\"floatCol\"] as! Float, 20.2 as Float)\n        object[\"floatCol\"] = 16777217\n        XCTAssertEqual(object[\"floatCol\"] as! Float, 16777216 as Float)\n\n        object[\"doubleCol\"] = 20\n        XCTAssertEqual(object[\"doubleCol\"] as! Double, 20)\n        object[\"doubleCol\"] = 20.2\n        XCTAssertEqual(object[\"doubleCol\"] as! Double, 20.2)\n        object[\"doubleCol\"] = 16777217\n        XCTAssertEqual(object[\"doubleCol\"] as! Double, 16777217)\n\n        object[\"stringCol\"] = \"\"\n        XCTAssertEqual(object[\"stringCol\"] as! String, \"\")\n        let utf8TestString = \"值значен™👍☞⎠‱௹♣︎☐▼❒∑⨌⧭иеمرحبا\"\n        object[\"stringCol\"] = utf8TestString\n        XCTAssertEqual(object[\"stringCol\"] as! String, utf8TestString)\n\n        let data = \"b\".data(using: String.Encoding.utf8, allowLossyConversion: false)!\n        object[\"binaryCol\"] = data\n        XCTAssertEqual(object[\"binaryCol\"] as! Data, data)\n\n        let date = Date(timeIntervalSinceReferenceDate: 2)\n        object[\"dateCol\"] = date\n        XCTAssertEqual(object[\"dateCol\"] as! Date, date)\n\n        object[\"objectCol\"] = SwiftBoolObject(value: [true])\n        XCTAssertEqual((object[\"objectCol\"]! as! SwiftBoolObject).boolCol, true)\n\n        object[\"intEnumCol\"] = IntEnum.value1\n        XCTAssertEqual(object[\"intEnumCol\"] as! Int, IntEnum.value1.rawValue)\n        object[\"intEnumCol\"] = IntEnum.value2\n        XCTAssertEqual(object[\"intEnumCol\"] as! Int, IntEnum.value2.rawValue)\n\n        object[\"decimalCol\"] = Decimal128(\"inf\")\n        XCTAssertEqual(object[\"decimalCol\"] as! Decimal128, \"inf\")\n        object[\"decimalCol\"] = Decimal128(\"-inf\")\n        XCTAssertEqual(object[\"decimalCol\"] as! Decimal128, \"-inf\")\n        object[\"decimalCol\"] = Decimal128(\"0\")\n        XCTAssertEqual(object[\"decimalCol\"] as! Decimal128, \"0\")\n        object[\"decimalCol\"] = Decimal128(\"nan\")\n        XCTAssertTrue((object[\"decimalCol\"] as! Decimal128).isNaN)\n\n        let oid1 = ObjectId(\"1234567890ab1234567890ab\")\n        let oid2 = ObjectId(\"abcdef123456abcdef123456\")\n        object[\"objectIdCol\"] = oid1\n        XCTAssertEqual(object[\"objectIdCol\"] as! ObjectId, oid1)\n        object[\"objectIdCol\"] = oid2\n        XCTAssertEqual(object[\"objectIdCol\"] as! ObjectId, oid2)\n\n        object[\"anyCol\"] = AnyRealmValue.string(\"hello\")\n        XCTAssertEqual(object[\"anyCol\"] as! String, \"hello\")\n        object[\"anyCol\"] = \"goodbye\"\n        XCTAssertEqual(object[\"anyCol\"] as! String, \"goodbye\")\n\n        // Optional properties\n\n        optObject[\"optNSStringCol\"] = \"\"\n        XCTAssertEqual(optObject[\"optNSStringCol\"] as! String, \"\")\n        optObject[\"optNSStringCol\"] = utf8TestString as NSString?\n        XCTAssertEqual(optObject[\"optNSStringCol\"] as! String, utf8TestString)\n        optObject[\"optNSStringCol\"] = nil\n        XCTAssertNil(optObject[\"optNSStringCol\"])\n\n        optObject[\"optStringCol\"] = \"\"\n        XCTAssertEqual(optObject[\"optStringCol\"] as! String, \"\")\n        optObject[\"optStringCol\"] = utf8TestString\n        XCTAssertEqual(optObject[\"optStringCol\"] as! String, utf8TestString)\n        optObject[\"optStringCol\"] = nil\n        XCTAssertNil(optObject[\"optStringCol\"])\n\n        optObject[\"optBinaryCol\"] = data\n        XCTAssertEqual(optObject[\"optBinaryCol\"] as! Data, data)\n        optObject[\"optBinaryCol\"] = nil\n        XCTAssertNil(optObject[\"optBinaryCol\"])\n\n        optObject[\"optDateCol\"] = date\n        XCTAssertEqual(optObject[\"optDateCol\"] as! Date, date)\n        optObject[\"optDateCol\"] = nil\n        XCTAssertNil(optObject[\"optDateCol\"])\n\n        optObject[\"optIntCol\"] = Int.min\n        XCTAssertEqual(optObject[\"optIntCol\"] as! Int, Int.min)\n        optObject[\"optIntCol\"] = 0\n        XCTAssertEqual(optObject[\"optIntCol\"] as! Int, 0)\n        optObject[\"optIntCol\"] = Int.max\n        XCTAssertEqual(optObject[\"optIntCol\"] as! Int, Int.max)\n        optObject[\"optIntCol\"] = nil\n        XCTAssertNil(optObject[\"optIntCol\"])\n\n        optObject[\"optInt8Col\"] = Int8.min\n        XCTAssertEqual(optObject[\"optInt8Col\"] as! Int8, Int8.min)\n        optObject[\"optInt8Col\"] = 0\n        XCTAssertEqual(optObject[\"optInt8Col\"] as! Int8, 0)\n        optObject[\"optInt8Col\"] = Int8.max\n        XCTAssertEqual(optObject[\"optInt8Col\"] as! Int8, Int8.max)\n        optObject[\"optInt8Col\"] = nil\n        XCTAssertNil(optObject[\"optInt8Col\"])\n\n        optObject[\"optInt16Col\"] = Int16.min\n        XCTAssertEqual(optObject[\"optInt16Col\"] as! Int16, Int16.min)\n        optObject[\"optInt16Col\"] = 0\n        XCTAssertEqual(optObject[\"optInt16Col\"] as! Int16, 0)\n        optObject[\"optInt16Col\"] = Int16.max\n        XCTAssertEqual(optObject[\"optInt16Col\"] as! Int16, Int16.max)\n        optObject[\"optInt16Col\"] = nil\n        XCTAssertNil(optObject[\"optInt16Col\"])\n\n        optObject[\"optInt32Col\"] = Int32.min\n        XCTAssertEqual(optObject[\"optInt32Col\"] as! Int32, Int32.min)\n        optObject[\"optInt32Col\"] = 0\n        XCTAssertEqual(optObject[\"optInt32Col\"] as! Int32, 0)\n        optObject[\"optInt32Col\"] = Int32.max\n        XCTAssertEqual(optObject[\"optInt32Col\"] as! Int32, Int32.max)\n        optObject[\"optInt32Col\"] = nil\n        XCTAssertNil(optObject[\"optInt32Col\"])\n\n        optObject[\"optInt64Col\"] = Int64.min\n        XCTAssertEqual(optObject[\"optInt64Col\"] as! Int64, Int64.min)\n        optObject[\"optInt64Col\"] = 0\n        XCTAssertEqual(optObject[\"optInt64Col\"] as! Int64, 0)\n        optObject[\"optInt64Col\"] = Int64.max\n        XCTAssertEqual(optObject[\"optInt64Col\"] as! Int64, Int64.max)\n        optObject[\"optInt64Col\"] = nil\n        XCTAssertNil(optObject[\"optInt64Col\"])\n\n        optObject[\"optFloatCol\"] = -Float.greatestFiniteMagnitude\n        XCTAssertEqual(optObject[\"optFloatCol\"] as! Float, -Float.greatestFiniteMagnitude)\n        optObject[\"optFloatCol\"] = 0\n        XCTAssertEqual(optObject[\"optFloatCol\"] as! Float, 0)\n        optObject[\"optFloatCol\"] = Float.greatestFiniteMagnitude\n        XCTAssertEqual(optObject[\"optFloatCol\"] as! Float, Float.greatestFiniteMagnitude)\n        optObject[\"optFloatCol\"] = nil\n        XCTAssertNil(optObject[\"optFloatCol\"])\n\n        optObject[\"optDoubleCol\"] = -Double.greatestFiniteMagnitude\n        XCTAssertEqual(optObject[\"optDoubleCol\"] as! Double, -Double.greatestFiniteMagnitude)\n        optObject[\"optDoubleCol\"] = 0\n        XCTAssertEqual(optObject[\"optDoubleCol\"] as! Double, 0)\n        optObject[\"optDoubleCol\"] = Double.greatestFiniteMagnitude\n        XCTAssertEqual(optObject[\"optDoubleCol\"] as! Double, Double.greatestFiniteMagnitude)\n        optObject[\"optDoubleCol\"] = nil\n        XCTAssertNil(optObject[\"optDoubleCol\"])\n\n        optObject[\"optBoolCol\"] = true\n        XCTAssertEqual(optObject[\"optBoolCol\"] as! Bool, true)\n        optObject[\"optBoolCol\"] = false\n        XCTAssertEqual(optObject[\"optBoolCol\"] as! Bool, false)\n        optObject[\"optBoolCol\"] = nil\n        XCTAssertNil(optObject[\"optBoolCol\"])\n\n        optObject[\"optObjectCol\"] = SwiftBoolObject(value: [true])\n        XCTAssertEqual((optObject[\"optObjectCol\"] as! SwiftBoolObject).boolCol, true)\n        optObject[\"optObjectCol\"] = nil\n        XCTAssertNil(optObject[\"optObjectCol\"])\n\n        optObject[\"optEnumCol\"] = IntEnum.value1\n        XCTAssertEqual(optObject[\"optEnumCol\"] as! Int, IntEnum.value1.rawValue)\n        optObject[\"optEnumCol\"] = IntEnum.value2\n        XCTAssertEqual(optObject[\"optEnumCol\"] as! Int, IntEnum.value2.rawValue)\n        optObject[\"optEnumCol\"] = nil\n        XCTAssertNil(optObject[\"optEnumCol\"])\n    }\n\n    func setAndTestAnyViaAccessorObjectWithCoercion(_ object: ObjectBase) {\n        let anyProp = RLMObjectBaseObjectSchema(object)!.properties.first { $0.name == \"anyCol\" }!\n        func get() -> Any {\n            return anyProp.swiftAccessor!.get(anyProp, on: object)\n        }\n        func set(_ value: Any) {\n            anyProp.swiftAccessor!.set(anyProp, on: object, to: value)\n        }\n        set(true)\n        XCTAssertEqual(get() as! Bool, true)\n        set(false)\n        XCTAssertEqual(get() as! Bool, false)\n\n        set(-1)\n        XCTAssertEqual(get() as! Int, -1)\n        set(0)\n        XCTAssertEqual(get() as! Int, 0)\n        set(1)\n        XCTAssertEqual(get() as! Int, 1)\n\n        set(-1 as Int8)\n        XCTAssertEqual(get() as! Int, -1)\n        set(0 as Int8)\n        XCTAssertEqual(get() as! Int, 0)\n        set(1 as Int8)\n        XCTAssertEqual(get() as! Int, 1)\n\n        set(-1 as Int16)\n        XCTAssertEqual(get() as! Int, -1)\n        set(0 as Int16)\n        XCTAssertEqual(get() as! Int, 0)\n        set(1 as Int16)\n        XCTAssertEqual(get() as! Int, 1)\n\n        set(-1 as Int32)\n        XCTAssertEqual(get() as! Int, -1)\n        set(0 as Int32)\n        XCTAssertEqual(get() as! Int, 0)\n        set(1 as Int32)\n        XCTAssertEqual(get() as! Int, 1)\n\n        set(-1 as Int64)\n        XCTAssertEqual(get() as! Int, -1)\n        set(0 as Int64)\n        XCTAssertEqual(get() as! Int, 0)\n        set(1 as Int64)\n        XCTAssertEqual(get() as! Int, 1)\n\n        set(20 as Float)\n        XCTAssertEqual(get() as! Float, 20 as Float)\n        set(20.2 as Float)\n        XCTAssertEqual(get() as! Float, 20.2 as Float)\n\n        set(20 as Double)\n        XCTAssertEqual(get() as! Double, 20)\n        set(20.2 as Double)\n        XCTAssertEqual(get() as! Double, 20.2)\n        set(16777217 as Double)\n        XCTAssertEqual(get() as! Double, 16777217)\n\n        set(\"\")\n        XCTAssertEqual(get() as! String, \"\")\n        let utf8TestString = \"值значен™👍☞⎠‱௹♣︎☐▼❒∑⨌⧭иеمرحبا\"\n        set(utf8TestString)\n        XCTAssertEqual(get() as! String, utf8TestString)\n\n        let data = \"b\".data(using: String.Encoding.utf8, allowLossyConversion: false)!\n        set(data)\n        XCTAssertEqual(get() as! Data, data)\n\n        let date = Date(timeIntervalSinceReferenceDate: 2)\n        set(date)\n        XCTAssertEqual(get() as! Date, date)\n\n        set(SwiftBoolObject(value: [true]))\n        XCTAssertEqual((get() as! SwiftBoolObject).boolCol, true)\n\n        set(Decimal128(\"inf\"))\n        XCTAssertEqual(get() as! Decimal128, \"inf\")\n        set(Decimal128(\"-inf\"))\n        XCTAssertEqual(get() as! Decimal128, \"-inf\")\n        set(Decimal128(\"0\"))\n        XCTAssertEqual(get() as! Decimal128, \"0\")\n        set(Decimal128(\"nan\"))\n        XCTAssertTrue((get() as! Decimal128).isNaN)\n\n        let oid1 = ObjectId(\"1234567890ab1234567890ab\")\n        let oid2 = ObjectId(\"abcdef123456abcdef123456\")\n        set(oid1)\n        XCTAssertEqual(get() as! ObjectId, oid1)\n        set(oid2)\n        XCTAssertEqual(get() as! ObjectId, oid2)\n\n        set(NSNull())\n        XCTAssertTrue(get() is NSNull)\n    }\n\n    func setAndTestAnyViaAccessorObjectWithExplicitAnyRealmValue(_ object: ObjectBase) {\n        let anyProp = RLMObjectBaseObjectSchema(object)!.properties.first { $0.name == \"anyCol\" }!\n        func get() -> Any {\n            return anyProp.swiftAccessor!.get(anyProp, on: object)\n        }\n        func set(_ value: AnyRealmValue) {\n            anyProp.swiftAccessor!.set(anyProp, on: object, to: value)\n        }\n        set(.bool(true))\n        XCTAssertEqual(get() as! Bool, true)\n        set(.bool(false))\n        XCTAssertEqual(get() as! Bool, false)\n\n        set(.int(-1))\n        XCTAssertEqual(get() as! Int, -1)\n        set(.int(0))\n        XCTAssertEqual(get() as! Int, 0)\n        set(.int(1))\n        XCTAssertEqual(get() as! Int, 1)\n\n        set(.float(20))\n        XCTAssertEqual(get() as! Float, 20 as Float)\n        set(.float(20.2))\n        XCTAssertEqual(get() as! Float, 20.2 as Float)\n\n        set(.double(20))\n        XCTAssertEqual(get() as! Double, 20)\n        set(.double(20.2))\n        XCTAssertEqual(get() as! Double, 20.2)\n        set(.double(16777217))\n        XCTAssertEqual(get() as! Double, 16777217)\n\n        set(.string(\"\"))\n        XCTAssertEqual(get() as! String, \"\")\n        let utf8TestString = \"值значен™👍☞⎠‱௹♣︎☐▼❒∑⨌⧭иеمرحبا\"\n        set(.string(utf8TestString))\n        XCTAssertEqual(get() as! String, utf8TestString)\n\n        let data = \"b\".data(using: String.Encoding.utf8, allowLossyConversion: false)!\n        set(.data(data))\n        XCTAssertEqual(get() as! Data, data)\n\n        let date = Date(timeIntervalSinceReferenceDate: 2)\n        set(.date(date))\n        XCTAssertEqual(get() as! Date, date)\n\n        set(.object(SwiftBoolObject(value: [true])))\n        XCTAssertEqual((get() as! SwiftBoolObject).boolCol, true)\n\n        set(.decimal128(Decimal128(\"inf\")))\n        XCTAssertEqual(get() as! Decimal128, \"inf\")\n        set(.decimal128(Decimal128(\"-inf\")))\n        XCTAssertEqual(get() as! Decimal128, \"-inf\")\n        set(.decimal128(Decimal128(\"0\")))\n        XCTAssertEqual(get() as! Decimal128, \"0\")\n        set(.decimal128(Decimal128(\"nan\")))\n        XCTAssertTrue((get() as! Decimal128).isNaN)\n\n        let oid1 = ObjectId(\"1234567890ab1234567890ab\")\n        let oid2 = ObjectId(\"abcdef123456abcdef123456\")\n        set(.objectId(oid1))\n        XCTAssertEqual(get() as! ObjectId, oid1)\n        set(.objectId(oid2))\n        XCTAssertEqual(get() as! ObjectId, oid2)\n\n        set(.none)\n        XCTAssertTrue(get() is NSNull)\n    }\n\n    func get(_ object: ObjectBase, _ propertyName: String) -> Any {\n        let prop = RLMObjectBaseObjectSchema(object)!.properties.first { $0.name == propertyName }!\n        return prop.swiftAccessor!.get(prop, on: object)\n    }\n    func set(_ object: ObjectBase, _ propertyName: String, _ value: Any) {\n        let prop = RLMObjectBaseObjectSchema(object)!.properties.first { $0.name == propertyName }!\n        prop.swiftAccessor!.set(prop, on: object, to: value)\n    }\n\n    func setAndTestRealmPropertyViaAccessor(_ object: ObjectBase) {\n        set(object, \"otherInt\", -1)\n        XCTAssertEqual(get(object, \"otherInt\") as! Int, -1)\n        set(object, \"otherInt\", 0)\n        XCTAssertEqual(get(object, \"otherInt\") as! Int, 0)\n        set(object, \"otherInt\", 1)\n        XCTAssertEqual(get(object, \"otherInt\") as! Int, 1)\n        set(object, \"otherInt\", NSNull())\n        XCTAssertTrue(get(object, \"otherInt\") is NSNull)\n\n        set(object, \"otherInt8\", -1)\n        XCTAssertEqual(get(object, \"otherInt8\") as! Int, -1)\n        set(object, \"otherInt8\", 0)\n        XCTAssertEqual(get(object, \"otherInt8\") as! Int, 0)\n        set(object, \"otherInt8\", 1)\n        XCTAssertEqual(get(object, \"otherInt8\") as! Int, 1)\n\n        set(object, \"otherInt16\", -1)\n        XCTAssertEqual(get(object, \"otherInt16\") as! Int, -1)\n        set(object, \"otherInt16\", 0)\n        XCTAssertEqual(get(object, \"otherInt16\") as! Int, 0)\n        set(object, \"otherInt16\", 1)\n        XCTAssertEqual(get(object, \"otherInt16\") as! Int, 1)\n\n        set(object, \"otherInt32\", -1)\n        XCTAssertEqual(get(object, \"otherInt32\") as! Int, -1)\n        set(object, \"otherInt32\", 0)\n        XCTAssertEqual(get(object, \"otherInt32\") as! Int, 0)\n        set(object, \"otherInt32\", 1)\n        XCTAssertEqual(get(object, \"otherInt32\") as! Int, 1)\n\n        set(object, \"otherInt64\", -1)\n        XCTAssertEqual(get(object, \"otherInt64\") as! Int, -1)\n        set(object, \"otherInt64\", 0)\n        XCTAssertEqual(get(object, \"otherInt64\") as! Int, 0)\n        set(object, \"otherInt64\", 1)\n        XCTAssertEqual(get(object, \"otherInt64\") as! Int, 1)\n\n        set(object, \"otherFloat\", -20 as Float)\n        XCTAssertEqual(get(object, \"otherFloat\") as! Float, -20)\n        set(object, \"otherFloat\", 20.2 as Float)\n        XCTAssertEqual(get(object, \"otherFloat\") as! Float, 20.2)\n        // 16777217 is not exactly representable as a float\n        set(object, \"otherFloat\", 16777217 as Double)\n        XCTAssertEqual(get(object, \"otherFloat\") as! Float, 16777216)\n\n        set(object, \"otherDouble\", -20 as Double)\n        XCTAssertEqual(get(object, \"otherDouble\") as! Double, -20)\n        set(object, \"otherDouble\", 20.2 as Double)\n        XCTAssertEqual(get(object, \"otherDouble\") as! Double, 20.2)\n        set(object, \"otherDouble\", 16777217 as Double)\n        XCTAssertEqual(get(object, \"otherDouble\") as! Double, 16777217)\n\n        set(object, \"otherBool\", true)\n        XCTAssertEqual(get(object, \"otherBool\") as! Bool, true)\n        set(object, \"otherBool\", false)\n        XCTAssertEqual(get(object, \"otherBool\") as! Bool, false)\n        set(object, \"otherBool\", 1)\n        XCTAssertEqual(get(object, \"otherBool\") as! Bool, true)\n        set(object, \"otherBool\", 0)\n        XCTAssertEqual(get(object, \"otherBool\") as! Bool, false)\n\n        set(object, \"otherEnum\", IntEnum.value1)\n        XCTAssertEqual(get(object, \"otherEnum\") as! Int, IntEnum.value1.rawValue)\n        set(object, \"otherEnum\", IntEnum.value2)\n        XCTAssertEqual(get(object, \"otherEnum\") as! Int, IntEnum.value2.rawValue)\n        set(object, \"otherEnum\", IntEnum.value1.rawValue)\n        XCTAssertEqual(get(object, \"otherEnum\") as! Int, IntEnum.value1.rawValue)\n    }\n\n    func setAndTestRealmOptionalViaAccessor(_ object: ObjectBase) {\n        set(object, \"optIntCol\", -1)\n        XCTAssertEqual(get(object, \"optIntCol\") as! Int, -1)\n        set(object, \"optIntCol\", 0)\n        XCTAssertEqual(get(object, \"optIntCol\") as! Int, 0)\n        set(object, \"optIntCol\", 1)\n        XCTAssertEqual(get(object, \"optIntCol\") as! Int, 1)\n        set(object, \"optIntCol\", NSNull())\n        XCTAssertTrue(get(object, \"optIntCol\") is NSNull)\n\n        set(object, \"optInt8Col\", -1)\n        XCTAssertEqual(get(object, \"optInt8Col\") as! Int, -1)\n        set(object, \"optInt8Col\", 0)\n        XCTAssertEqual(get(object, \"optInt8Col\") as! Int, 0)\n        set(object, \"optInt8Col\", 1)\n        XCTAssertEqual(get(object, \"optInt8Col\") as! Int, 1)\n\n        set(object, \"optInt16Col\", -1)\n        XCTAssertEqual(get(object, \"optInt16Col\") as! Int, -1)\n        set(object, \"optInt16Col\", 0)\n        XCTAssertEqual(get(object, \"optInt16Col\") as! Int, 0)\n        set(object, \"optInt16Col\", 1)\n        XCTAssertEqual(get(object, \"optInt16Col\") as! Int, 1)\n\n        set(object, \"optInt32Col\", -1)\n        XCTAssertEqual(get(object, \"optInt32Col\") as! Int, -1)\n        set(object, \"optInt32Col\", 0)\n        XCTAssertEqual(get(object, \"optInt32Col\") as! Int, 0)\n        set(object, \"optInt32Col\", 1)\n        XCTAssertEqual(get(object, \"optInt32Col\") as! Int, 1)\n\n        set(object, \"optInt64Col\", -1)\n        XCTAssertEqual(get(object, \"optInt64Col\") as! Int, -1)\n        set(object, \"optInt64Col\", 0)\n        XCTAssertEqual(get(object, \"optInt64Col\") as! Int, 0)\n        set(object, \"optInt64Col\", 1)\n        XCTAssertEqual(get(object, \"optInt64Col\") as! Int, 1)\n\n        set(object, \"optFloatCol\", -20 as Float)\n        XCTAssertEqual(get(object, \"optFloatCol\") as! Float, -20)\n        set(object, \"optFloatCol\", 20.2 as Float)\n        XCTAssertEqual(get(object, \"optFloatCol\") as! Float, 20.2)\n        // 16777217 is not exactly representable as a float\n        set(object, \"optFloatCol\", 16777217 as Double)\n        XCTAssertEqual(get(object, \"optFloatCol\") as! Float, 16777216)\n\n        set(object, \"optDoubleCol\", -20 as Double)\n        XCTAssertEqual(get(object, \"optDoubleCol\") as! Double, -20)\n        set(object, \"optDoubleCol\", 20.2 as Double)\n        XCTAssertEqual(get(object, \"optDoubleCol\") as! Double, 20.2)\n        set(object, \"optDoubleCol\", 16777217 as Double)\n        XCTAssertEqual(get(object, \"optDoubleCol\") as! Double, 16777217)\n\n        set(object, \"optBoolCol\", true)\n        XCTAssertEqual(get(object, \"optBoolCol\") as! Bool, true)\n        set(object, \"optBoolCol\", false)\n        XCTAssertEqual(get(object, \"optBoolCol\") as! Bool, false)\n        set(object, \"optBoolCol\", 1)\n        XCTAssertEqual(get(object, \"optBoolCol\") as! Bool, true)\n        set(object, \"optBoolCol\", 0)\n        XCTAssertEqual(get(object, \"optBoolCol\") as! Bool, false)\n\n        set(object, \"optEnumCol\", IntEnum.value1)\n        XCTAssertEqual(get(object, \"optEnumCol\") as! Int, IntEnum.value1.rawValue)\n        set(object, \"optEnumCol\", IntEnum.value2)\n        XCTAssertEqual(get(object, \"optEnumCol\") as! Int, IntEnum.value2.rawValue)\n        set(object, \"optEnumCol\", IntEnum.value1.rawValue)\n        XCTAssertEqual(get(object, \"optEnumCol\") as! Int, IntEnum.value1.rawValue)\n        set(object, \"optEnumCol\", NSNull())\n        XCTAssertTrue(get(object, \"optEnumCol\") is NSNull)\n    }\n\n    func setAndTestListViaAccessor(_ object: ObjectBase) {\n        XCTAssertTrue(get(object, \"int\") is List<Int>)\n        XCTAssertTrue(get(object, \"int8\") is List<Int8>)\n        XCTAssertTrue(get(object, \"int16\") is List<Int16>)\n        XCTAssertTrue(get(object, \"int32\") is List<Int32>)\n        XCTAssertTrue(get(object, \"int64\") is List<Int64>)\n        XCTAssertTrue(get(object, \"float\") is List<Float>)\n        XCTAssertTrue(get(object, \"double\") is List<Double>)\n        XCTAssertTrue(get(object, \"string\") is List<String>)\n        XCTAssertTrue(get(object, \"data\") is List<Data>)\n        XCTAssertTrue(get(object, \"date\") is List<Date>)\n        XCTAssertTrue(get(object, \"decimal\") is List<Decimal128>)\n        XCTAssertTrue(get(object, \"objectId\") is List<ObjectId>)\n        XCTAssertTrue(get(object, \"uuid\") is List<UUID>)\n        XCTAssertTrue(get(object, \"any\") is List<AnyRealmValue>)\n\n        XCTAssertTrue(get(object, \"intOpt\") is List<Int?>)\n        XCTAssertTrue(get(object, \"int8Opt\") is List<Int8?>)\n        XCTAssertTrue(get(object, \"int16Opt\") is List<Int16?>)\n        XCTAssertTrue(get(object, \"int32Opt\") is List<Int32?>)\n        XCTAssertTrue(get(object, \"int64Opt\") is List<Int64?>)\n        XCTAssertTrue(get(object, \"floatOpt\") is List<Float?>)\n        XCTAssertTrue(get(object, \"doubleOpt\") is List<Double?>)\n        XCTAssertTrue(get(object, \"stringOpt\") is List<String?>)\n        XCTAssertTrue(get(object, \"dataOpt\") is List<Data?>)\n        XCTAssertTrue(get(object, \"dateOpt\") is List<Date?>)\n        XCTAssertTrue(get(object, \"decimalOpt\") is List<Decimal128?>)\n        XCTAssertTrue(get(object, \"objectIdOpt\") is List<ObjectId?>)\n        XCTAssertTrue(get(object, \"uuidOpt\") is List<UUID?>)\n\n        set(object, \"int\", [1, 2, 3])\n        XCTAssertEqual(Array(get(object, \"int\") as! List<Int>), [1, 2, 3])\n        set(object, \"int\", [4, 5, 6])\n        XCTAssertEqual(Array(get(object, \"int\") as! List<Int>), [4, 5, 6])\n        set(object, \"int8\", get(object, \"int\"))\n        XCTAssertEqual(Array(get(object, \"int8\") as! List<Int8>), [4, 5, 6])\n        set(object, \"int\", NSNull())\n        XCTAssertEqual((get(object, \"int\") as! List<Int>).count, 0)\n    }\n\n    func setAndTestSetViaAccessor(_ object: ObjectBase) {\n        XCTAssertTrue(get(object, \"int\") is MutableSet<Int>)\n        XCTAssertTrue(get(object, \"int8\") is MutableSet<Int8>)\n        XCTAssertTrue(get(object, \"int16\") is MutableSet<Int16>)\n        XCTAssertTrue(get(object, \"int32\") is MutableSet<Int32>)\n        XCTAssertTrue(get(object, \"int64\") is MutableSet<Int64>)\n        XCTAssertTrue(get(object, \"float\") is MutableSet<Float>)\n        XCTAssertTrue(get(object, \"double\") is MutableSet<Double>)\n        XCTAssertTrue(get(object, \"string\") is MutableSet<String>)\n        XCTAssertTrue(get(object, \"data\") is MutableSet<Data>)\n        XCTAssertTrue(get(object, \"date\") is MutableSet<Date>)\n        XCTAssertTrue(get(object, \"decimal\") is MutableSet<Decimal128>)\n        XCTAssertTrue(get(object, \"objectId\") is MutableSet<ObjectId>)\n        XCTAssertTrue(get(object, \"uuid\") is MutableSet<UUID>)\n        XCTAssertTrue(get(object, \"any\") is MutableSet<AnyRealmValue>)\n\n        XCTAssertTrue(get(object, \"intOpt\") is MutableSet<Int?>)\n        XCTAssertTrue(get(object, \"int8Opt\") is MutableSet<Int8?>)\n        XCTAssertTrue(get(object, \"int16Opt\") is MutableSet<Int16?>)\n        XCTAssertTrue(get(object, \"int32Opt\") is MutableSet<Int32?>)\n        XCTAssertTrue(get(object, \"int64Opt\") is MutableSet<Int64?>)\n        XCTAssertTrue(get(object, \"floatOpt\") is MutableSet<Float?>)\n        XCTAssertTrue(get(object, \"doubleOpt\") is MutableSet<Double?>)\n        XCTAssertTrue(get(object, \"stringOpt\") is MutableSet<String?>)\n        XCTAssertTrue(get(object, \"dataOpt\") is MutableSet<Data?>)\n        XCTAssertTrue(get(object, \"dateOpt\") is MutableSet<Date?>)\n        XCTAssertTrue(get(object, \"decimalOpt\") is MutableSet<Decimal128?>)\n        XCTAssertTrue(get(object, \"objectIdOpt\") is MutableSet<ObjectId?>)\n        XCTAssertTrue(get(object, \"uuidOpt\") is MutableSet<UUID?>)\n\n        set(object, \"int\", [1, 2, 3])\n        XCTAssertEqual(Array(get(object, \"int\") as! MutableSet<Int>).sorted(), [1, 2, 3])\n        set(object, \"int\", [4, 5, 6])\n        XCTAssertEqual(Array(get(object, \"int\") as! MutableSet<Int>).sorted(), [4, 5, 6])\n        set(object, \"int8\", get(object, \"int\"))\n        XCTAssertEqual(Array(get(object, \"int8\") as! MutableSet<Int8>).sorted(), [4, 5, 6])\n        set(object, \"int\", NSNull())\n        XCTAssertEqual((get(object, \"int\") as! MutableSet<Int>).count, 0)\n    }\n\n    func setAndTestMapViaAccessor(_ object: ObjectBase) {\n        XCTAssertTrue(get(object, \"int\") is Map<String, Int>)\n        XCTAssertTrue(get(object, \"int8\") is Map<String, Int8>)\n        XCTAssertTrue(get(object, \"int16\") is Map<String, Int16>)\n        XCTAssertTrue(get(object, \"int32\") is Map<String, Int32>)\n        XCTAssertTrue(get(object, \"int64\") is Map<String, Int64>)\n        XCTAssertTrue(get(object, \"float\") is Map<String, Float>)\n        XCTAssertTrue(get(object, \"double\") is Map<String, Double>)\n        XCTAssertTrue(get(object, \"string\") is Map<String, String>)\n        XCTAssertTrue(get(object, \"data\") is Map<String, Data>)\n        XCTAssertTrue(get(object, \"date\") is Map<String, Date>)\n        XCTAssertTrue(get(object, \"decimal\") is Map<String, Decimal128>)\n        XCTAssertTrue(get(object, \"objectId\") is Map<String, ObjectId>)\n        XCTAssertTrue(get(object, \"uuid\") is Map<String, UUID>)\n        XCTAssertTrue(get(object, \"any\") is Map<String, AnyRealmValue>)\n\n        XCTAssertTrue(get(object, \"intOpt\") is Map<String, Int?>)\n        XCTAssertTrue(get(object, \"int8Opt\") is Map<String, Int8?>)\n        XCTAssertTrue(get(object, \"int16Opt\") is Map<String, Int16?>)\n        XCTAssertTrue(get(object, \"int32Opt\") is Map<String, Int32?>)\n        XCTAssertTrue(get(object, \"int64Opt\") is Map<String, Int64?>)\n        XCTAssertTrue(get(object, \"floatOpt\") is Map<String, Float?>)\n        XCTAssertTrue(get(object, \"doubleOpt\") is Map<String, Double?>)\n        XCTAssertTrue(get(object, \"stringOpt\") is Map<String, String?>)\n        XCTAssertTrue(get(object, \"dataOpt\") is Map<String, Data?>)\n        XCTAssertTrue(get(object, \"dateOpt\") is Map<String, Date?>)\n        XCTAssertTrue(get(object, \"decimalOpt\") is Map<String, Decimal128?>)\n        XCTAssertTrue(get(object, \"objectIdOpt\") is Map<String, ObjectId?>)\n        XCTAssertTrue(get(object, \"uuidOpt\") is Map<String, UUID?>)\n\n        set(object, \"int\", [\"one\": 1, \"two\": 2, \"three\": 3])\n        XCTAssertEqual((get(object, \"int\") as! Map<String, Int>)[\"one\"], 1)\n        XCTAssertEqual((get(object, \"int\") as! Map<String, Int>)[\"two\"], 2)\n        XCTAssertEqual((get(object, \"int\") as! Map<String, Int>)[\"three\"], 3)\n        set(object, \"int\", NSNull())\n        XCTAssertEqual((get(object, \"int\") as! Map<String, Int>).count, 0)\n    }\n\n    func testUnmanagedAccessors() {\n        setAndTestAllPropertiesViaNormalAccess(SwiftObject(), SwiftOptionalObject())\n        setAndTestAllPropertiesViaSubscript(SwiftObject(), SwiftOptionalObject())\n        setAndTestAnyViaAccessorObjectWithCoercion(SwiftObject())\n        setAndTestAnyViaAccessorObjectWithExplicitAnyRealmValue(SwiftObject())\n        setAndTestRealmPropertyViaAccessor(CodableObject())\n        setAndTestRealmOptionalViaAccessor(SwiftOptionalObject())\n        setAndTestListViaAccessor(SwiftListObject())\n        setAndTestSetViaAccessor(SwiftMutableSetObject())\n        setAndTestMapViaAccessor(SwiftMapObject())\n    }\n\n    func testManagedAccessors() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let object = realm.create(SwiftObject.self)\n        let optionalObject = realm.create(SwiftOptionalObject.self)\n        setAndTestAllPropertiesViaNormalAccess(object, optionalObject)\n        setAndTestAllPropertiesViaSubscript(object, optionalObject)\n        setAndTestAnyViaAccessorObjectWithCoercion(object)\n        setAndTestAnyViaAccessorObjectWithExplicitAnyRealmValue(object)\n        setAndTestRealmPropertyViaAccessor(realm.create(CodableObject.self))\n        setAndTestRealmOptionalViaAccessor(optionalObject)\n        setAndTestListViaAccessor(realm.create(SwiftListObject.self))\n        setAndTestSetViaAccessor(realm.create(SwiftMutableSetObject.self))\n        setAndTestMapViaAccessor(realm.create(SwiftMapObject.self))\n        realm.cancelWrite()\n    }\n\n    func testIntSizes() {\n        let realm = realmWithTestPath()\n\n        let v8  = Int8(1)  << 6\n        let v16 = Int16(1) << 12\n        let v32 = Int32(1) << 30\n        // 1 << 40 doesn't auto-promote to Int64 on 32-bit platforms\n        let v64 = Int64(1) << 40\n        try! realm.write {\n            let obj = SwiftAllIntSizesObject()\n\n            let testObject: () -> Void = {\n                obj.objectSchema.properties.map { $0.name }.forEach { obj[$0] = 0 }\n\n                obj[\"int8\"] = NSNumber(value: v8)\n                XCTAssertEqual((obj[\"int8\"]! as! Int), Int(v8))\n                obj[\"int16\"] = NSNumber(value: v16)\n                XCTAssertEqual((obj[\"int16\"]! as! Int), Int(v16))\n                obj[\"int32\"] = NSNumber(value: v32)\n                XCTAssertEqual((obj[\"int32\"]! as! Int), Int(v32))\n                obj[\"int64\"] = NSNumber(value: v64)\n                XCTAssertEqual((obj[\"int64\"]! as! NSNumber), NSNumber(value: v64))\n\n                obj.objectSchema.properties.map { $0.name }.forEach { obj[$0] = 0 }\n\n                obj.setValue(NSNumber(value: v8), forKey: \"int8\")\n                XCTAssertEqual((obj.value(forKey: \"int8\")! as! Int), Int(v8))\n                obj.setValue(NSNumber(value: v16), forKey: \"int16\")\n                XCTAssertEqual((obj.value(forKey: \"int16\")! as! Int), Int(v16))\n                obj.setValue(NSNumber(value: v32), forKey: \"int32\")\n                XCTAssertEqual((obj.value(forKey: \"int32\")! as! Int), Int(v32))\n                obj.setValue(NSNumber(value: v64), forKey: \"int64\")\n                XCTAssertEqual((obj.value(forKey: \"int64\")! as! NSNumber), NSNumber(value: v64))\n\n                obj.objectSchema.properties.map { $0.name }.forEach { obj[$0] = 0 }\n\n                obj.int8 = v8\n                XCTAssertEqual(obj.int8, v8)\n                obj.int16 = v16\n                XCTAssertEqual(obj.int16, v16)\n                obj.int32 = v32\n                XCTAssertEqual(obj.int32, v32)\n                obj.int64 = v64\n                XCTAssertEqual(obj.int64, v64)\n            }\n\n            testObject()\n\n            realm.add(obj)\n\n            testObject()\n        }\n\n        let obj = realm.objects(SwiftAllIntSizesObject.self).first!\n        XCTAssertEqual(obj.int8, v8)\n        XCTAssertEqual(obj.int16, v16)\n        XCTAssertEqual(obj.int32, v32)\n        XCTAssertEqual(obj.int64, v64)\n    }\n\n    func testLongType() {\n        let longNumber: Int64 = 17179869184\n        let intNumber: Int64 = 2147483647\n        let negativeLongNumber: Int64 = -17179869184\n        let updatedLongNumber: Int64 = 8589934592\n\n        let realm = realmWithTestPath()\n\n        realm.beginWrite()\n        realm.create(SwiftLongObject.self, value: [NSNumber(value: longNumber)])\n        realm.create(SwiftLongObject.self, value: [NSNumber(value: intNumber)])\n        realm.create(SwiftLongObject.self, value: [NSNumber(value: negativeLongNumber)])\n        try! realm.commitWrite()\n\n        let objects = realm.objects(SwiftLongObject.self)\n        XCTAssertEqual(objects.count, Int(3), \"3 rows expected\")\n        XCTAssertEqual(objects[0].longCol, longNumber, \"2 ^ 34 expected\")\n        XCTAssertEqual(objects[1].longCol, intNumber, \"2 ^ 31 - 1 expected\")\n        XCTAssertEqual(objects[2].longCol, negativeLongNumber, \"-2 ^ 34 expected\")\n\n        realm.beginWrite()\n        objects[0].longCol = updatedLongNumber\n        try! realm.commitWrite()\n\n        XCTAssertEqual(objects[0].longCol, updatedLongNumber, \"After update: 2 ^ 33 expected\")\n    }\n\n    func testCollectionsDuringResultsFastEnumeration() {\n        let realm = realmWithTestPath()\n\n        let object1 = SwiftObject()\n        let object2 = SwiftObject()\n\n        let trueObject = SwiftBoolObject()\n        trueObject.boolCol = true\n\n        let falseObject = SwiftBoolObject()\n        falseObject.boolCol = false\n\n        object1.arrayCol.append(trueObject)\n        object1.arrayCol.append(falseObject)\n\n        object2.arrayCol.append(trueObject)\n        object2.arrayCol.append(falseObject)\n\n        object1.setCol.insert(trueObject)\n        object1.setCol.insert(falseObject)\n\n        object2.setCol.insert(trueObject)\n        object2.setCol.insert(falseObject)\n\n        try! realm.write {\n            realm.add(object1)\n            realm.add(object2)\n        }\n\n        let objects = realm.objects(SwiftObject.self)\n\n        let firstObject = objects.first\n        XCTAssertEqual(2, firstObject!.arrayCol.count)\n        XCTAssertEqual(2, firstObject!.setCol.count)\n\n        let lastObject = objects.last\n        XCTAssertEqual(2, lastObject!.arrayCol.count)\n        XCTAssertEqual(2, lastObject!.setCol.count)\n\n        var iterator = objects.makeIterator()\n        let next = iterator.next()!\n        XCTAssertEqual(next.arrayCol.count, 2)\n        XCTAssertEqual(next.setCol.count, 2)\n\n        for obj in objects {\n            XCTAssertEqual(2, obj.arrayCol.count)\n            XCTAssertEqual(2, obj.setCol.count)\n        }\n    }\n\n    func testSettingOptionalPropertyOnDeletedObjectsThrows() {\n        let realm = try! Realm()\n        try! realm.write {\n            let obj = realm.create(SwiftOptionalObject.self)\n            let copy = realm.objects(SwiftOptionalObject.self).first!\n            realm.delete(obj)\n\n            self.assertThrows(copy.optIntCol.value = 1)\n            self.assertThrows(copy.optIntCol.value = nil)\n\n            self.assertThrows(obj.optIntCol.value = 1)\n            self.assertThrows(obj.optIntCol.value = nil)\n        }\n    }\n\n    func testLinkingObjectsDynamicGet() {\n        let fido = SwiftDogObject()\n        let owner = SwiftOwnerObject()\n        owner.dog = fido\n        owner.name = \"JP\"\n        let realm = try! Realm()\n        try! realm.write {\n            realm.add([fido, owner])\n        }\n\n        // Get the linking objects property via subscript.\n        let dynamicOwners = fido[\"owners\"]\n        guard let owners = dynamicOwners else {\n            XCTFail(\"Got an unexpected nil for fido[\\\"owners\\\"]\")\n            return\n        }\n        XCTAssertTrue(owners is LinkingObjects<SwiftOwnerObject>)\n        // Make sure the results actually functions.\n        guard let firstOwner = (owners as? LinkingObjects<SwiftOwnerObject>)?.first else {\n            XCTFail(\"Was not able to get first owner\")\n            return\n        }\n        XCTAssertEqual(firstOwner.name, \"JP\")\n    }\n\n    func testRenamedProperties() {\n        let obj = SwiftRenamedProperties1()\n        obj.propA = 5\n        obj.propB = \"a\"\n\n        let link = LinkToSwiftRenamedProperties1()\n        link.linkA = obj\n        link.array1.append(obj)\n        link.set1.insert(obj)\n\n        let realm = try! Realm()\n        try! realm.write {\n            realm.add(link)\n        }\n\n        XCTAssertEqual(obj.propA, 5)\n        XCTAssertEqual(obj.propB, \"a\")\n        XCTAssertTrue(link.linkA!.isSameObject(as: obj))\n        XCTAssertTrue(link.array1[0].isSameObject(as: obj))\n        XCTAssertTrue(link.set1.contains(obj))\n        XCTAssertTrue(obj.linking1[0].isSameObject(as: link))\n\n        XCTAssertEqual(obj[\"propA\"]! as! Int, 5)\n        XCTAssertEqual(obj[\"propB\"]! as! String, \"a\")\n        XCTAssertTrue((link[\"linkA\"]! as! SwiftRenamedProperties1).isSameObject(as: obj))\n        XCTAssertTrue((link[\"array1\"]! as! List<SwiftRenamedProperties1>)[0].isSameObject(as: obj))\n        XCTAssertTrue((link[\"set1\"]! as! MutableSet<SwiftRenamedProperties1>).contains(obj))\n        XCTAssertTrue((obj[\"linking1\"]! as! LinkingObjects<LinkToSwiftRenamedProperties1>)[0].isSameObject(as: link))\n\n        XCTAssertTrue(link.dynamicList(\"array1\")[0].isSameObject(as: obj))\n        XCTAssertTrue(link.dynamicMutableSet(\"set1\")[0].isSameObject(as: obj))\n\n        let obj2 = realm.objects(SwiftRenamedProperties2.self).first!\n        let link2 = realm.objects(LinkToSwiftRenamedProperties2.self).first!\n\n        XCTAssertEqual(obj2.propC, 5)\n        XCTAssertEqual(obj2.propD, \"a\")\n        XCTAssertTrue(link2.linkC!.isSameObject(as: obj))\n        XCTAssertTrue(link2.array2[0].isSameObject(as: obj))\n        XCTAssertTrue(link2.set2[0].isSameObject(as: obj))\n\n        XCTAssertTrue(obj2.linking1[0].isSameObject(as: link))\n\n        XCTAssertEqual(obj2[\"propC\"]! as! Int, 5)\n        XCTAssertEqual(obj2[\"propD\"]! as! String, \"a\")\n        XCTAssertTrue((link2[\"linkC\"]! as! SwiftRenamedProperties1).isSameObject(as: obj))\n        XCTAssertTrue((link2[\"array2\"]! as! List<SwiftRenamedProperties2>)[0].isSameObject(as: obj))\n        XCTAssertTrue((link2[\"set2\"]! as! MutableSet<SwiftRenamedProperties2>)[0].isSameObject(as: obj))\n\n        XCTAssertTrue((obj2[\"linking1\"]! as! LinkingObjects<LinkToSwiftRenamedProperties1>)[0].isSameObject(as: link))\n\n        XCTAssertTrue(link2.dynamicList(\"array2\")[0].isSameObject(as: obj))\n        XCTAssertTrue(link2.dynamicMutableSet(\"set2\")[0].isSameObject(as: obj))\n    }\n\n    func testPropertiesOutlivingParentObject() {\n        var optional: RealmOptional<Int>!\n        var realmProperty: RealmProperty<Int?>!\n        var list: List<Int>!\n        var set: MutableSet<Int>!\n        let realm = try! Realm()\n        try! realm.write {\n            autoreleasepool {\n                let optObject = realm.create(SwiftOptionalObject.self, value: [\"optIntCol\": 1, \"otherIntCol\": 1])\n                optional = optObject.optIntCol\n                realmProperty = optObject.otherIntCol\n                list = realm.create(SwiftListObject.self, value: [\"int\": [1]]).int\n                set = realm.create(SwiftMutableSetObject.self, value: [\"int\": [1]]).int\n            }\n        }\n\n        // Verify that we can still read the correct value\n        XCTAssertEqual(optional.value, 1)\n        XCTAssertEqual(realmProperty.value, 1)\n        XCTAssertEqual(list.count, 1)\n        XCTAssertEqual(list[0], 1)\n        XCTAssertEqual(set.count, 1)\n        XCTAssertEqual(set[0], 1)\n\n        // Verify that we can modify the values via the standalone property objects and\n        // have it properly update the parent\n        try! realm.write {\n            optional.value = 2\n            realmProperty.value = 2\n            list.append(2)\n            set.insert(2)\n        }\n\n        XCTAssertEqual(optional.value, 2)\n        XCTAssertEqual(realmProperty.value, 2)\n        XCTAssertEqual(list.count, 2)\n        XCTAssertEqual(list[0], 1)\n        XCTAssertEqual(list[1], 2)\n        XCTAssertEqual(set.count, 2)\n        XCTAssertEqual(set[0], 1)\n        XCTAssertEqual(set[1], 2)\n\n        autoreleasepool {\n            XCTAssertEqual(realm.objects(SwiftOptionalObject.self).first!.optIntCol.value, 2)\n            XCTAssertEqual(realm.objects(SwiftOptionalObject.self).first!.otherIntCol.value, 2)\n            XCTAssertEqual(Array(realm.objects(SwiftListObject.self).first!.int), [1, 2])\n            XCTAssertEqual(Array(realm.objects(SwiftMutableSetObject.self).first!.int), [1, 2])\n        }\n\n        try! realm.write {\n            optional.value = nil\n            realmProperty.value = nil\n            list.removeAll()\n            set.removeAll()\n        }\n\n        XCTAssertEqual(optional.value, nil)\n        XCTAssertEqual(realmProperty.value, nil)\n        XCTAssertEqual(list.count, 0)\n        XCTAssertEqual(set.count, 0)\n\n        autoreleasepool {\n            XCTAssertEqual(realm.objects(SwiftOptionalObject.self).first!.optIntCol.value, nil)\n            XCTAssertEqual(realm.objects(SwiftOptionalObject.self).first!.otherIntCol.value, nil)\n            XCTAssertEqual(Array(realm.objects(SwiftListObject.self).first!.int), [])\n            XCTAssertEqual(Array(realm.objects(SwiftMutableSetObject.self).first!.int), [])\n        }\n    }\n\n    func testSetEmbeddedLink() {\n        let realm = try! Realm()\n        realm.beginWrite()\n\n        let parent = EmbeddedParentObject()\n        realm.add(parent)\n\n        let child1 = EmbeddedTreeObject1()\n        parent.object = child1\n        XCTAssertEqual(child1.realm, realm)\n        XCTAssertNoThrow(parent.object = child1)\n\n        let child2 = EmbeddedTreeObject1()\n        parent.object = child2\n        XCTAssertEqual(child1.realm, realm)\n        XCTAssertTrue(child1.isInvalidated)\n\n        let child3 = EmbeddedTreeObject1()\n        parent.array.append(child3)\n        assertThrows(parent.object = child3,\n                     reason: \"Can't set link to existing managed embedded object\")\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/ObjectCreationTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\nimport Realm.Private\n\n#if canImport(RealmTestSupport)\nimport RealmSwiftTestSupport\n#endif\n\nclass ObjectWithPrivateOptionals: Object {\n    private var nilInt: Int?\n    private var nilFloat: Float?\n    private var nilString: String?\n    private var int: Int? = 123\n    private var float: Float? = 1.23\n    private var string: String? = \"123\"\n\n    @objc dynamic var value = 5\n}\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass ObjectCreationTests: TestCase {\n    // MARK: - Init tests\n\n    func testInitWithDefaults() {\n        // test all properties are defaults\n        let object = SwiftObject()\n        XCTAssertNil(object.realm)\n\n        // test defaults values\n        verifySwiftObjectWithDictionaryLiteral(object, dictionary: SwiftObject.defaultValues(), boolObjectValue: false,\n            boolObjectListValues: [])\n\n        // test realm properties are nil for standalone\n        XCTAssertNil(object.realm)\n        XCTAssertNil(object.objectCol!.realm)\n        XCTAssertNil(object.arrayCol.realm)\n        XCTAssertNil(object.setCol.realm)\n        XCTAssertNil(object.mapCol.realm)\n    }\n\n    func testInitWithOptionalWithoutDefaults() {\n        let object = SwiftOptionalObject()\n        for prop in object.objectSchema.properties {\n            let value = object[prop.name]\n            if let value = value as? RLMSwiftValueStorage {\n                XCTAssertNil(RLMGetSwiftValueStorage(value))\n            } else {\n                XCTAssertNil(value)\n            }\n        }\n    }\n\n    func testInitWithOptionalDefaults() {\n        let object = SwiftOptionalDefaultValuesObject()\n        verifySwiftOptionalObjectWithDictionaryLiteral(object, dictionary:\n            SwiftOptionalDefaultValuesObject.defaultValues(), boolObjectValue: true)\n    }\n\n    func testInitWithDictionary() {\n        // dictionary with all values specified\n        let baselineValues: [String: Any] =\n           [\"boolCol\": true,\n            \"intCol\": 1,\n            \"int8Col\": 1 as Int8,\n            \"int16Col\": 1 as Int16,\n            \"int32Col\": 1 as Int32,\n            \"int64Col\": 1 as Int64,\n            \"floatCol\": 1.1 as Float,\n            \"doubleCol\": 11.1,\n            \"stringCol\": \"b\",\n            \"binaryCol\": Data(\"b\".utf8),\n            \"dateCol\": Date(timeIntervalSince1970: 2),\n            \"decimalCol\": 3 as Decimal128,\n            \"objectIdCol\": ObjectId.generate(),\n            \"objectCol\": SwiftBoolObject(value: [true]),\n            \"uuidCol\": UUID(uuidString: \"137decc8-b300-4954-a233-f89909f4fd89\")!,\n            \"anyCol\": AnyRealmValue.string(\"hello\"),\n            \"arrayCol\": [SwiftBoolObject(value: [true]), SwiftBoolObject()],\n            \"setCol\": [SwiftBoolObject(value: [true]), SwiftBoolObject()],\n            \"mapCol\": [\"trueVal\": SwiftBoolObject(value: [true]), \"falseVal\": SwiftBoolObject(value: [false])]\n           ]\n\n        // test with valid dictionary literals\n        let props = try! Realm().schema[\"SwiftObject\"]!.properties\n        for propNum in 0..<props.count {\n            for validValue in validValuesForSwiftObjectType(props[propNum].type, (props[propNum].isArray || props[propNum].isSet), props[propNum].isMap) {\n                // update dict with valid value and init\n                var values = baselineValues\n                values[props[propNum].name] = validValue\n                let object = SwiftObject(value: values)\n                verifySwiftObjectWithDictionaryLiteral(object, dictionary: values, boolObjectValue: true,\n                    boolObjectListValues: [true, false])\n            }\n        }\n\n        // test with invalid dictionary literals\n        for propNum in 0..<props.count {\n            for invalidValue in invalidValuesForSwiftObjectType(props[propNum].type, (props[propNum].isArray || props[propNum].isSet), props[propNum].isMap) {\n                // update dict with invalid value and init\n                var values = baselineValues\n                values[props[propNum].name] = invalidValue\n                assertThrows(SwiftObject(value: values), \"Invalid property value\")\n            }\n        }\n    }\n\n    func testInitWithDefaultsAndDictionary() {\n        // test with dictionary with mix of default and one specified value\n        let object = SwiftObject(value: [\"intCol\": 200])\n        let valueDict = defaultSwiftObjectValuesWithReplacements([\"intCol\": 200])\n        verifySwiftObjectWithDictionaryLiteral(object, dictionary: valueDict, boolObjectValue: false,\n            boolObjectListValues: [])\n    }\n\n    func testInitWithArray() {\n        // array with all values specified\n        let baselineValues: [Any] = [true, 1, Int8(1), Int16(1), Int32(1), Int64(1), IntEnum.value1.rawValue, 1.1 as Float,\n                                     11.1, \"b\", Data(\"b\".utf8),\n                                     Date(timeIntervalSince1970: 2), Decimal128(number: 123),\n                                     ObjectId.generate(), [\"boolCol\": true],\n                                     UUID(uuidString: \"137decc8-b300-4954-a233-f89909f4fd89\")!,\n                                     \"anyCol\", [[true], [false]], [[true], [false]],\n                                     [\"trueVal\": [\"boolCol\": true], \"falseVal\": [\"boolCol\": false]]]\n        // test with valid dictionary literals\n        let props = try! Realm().schema[\"SwiftObject\"]!.properties\n        for propNum in 0..<props.count {\n            for validValue in validValuesForSwiftObjectType(props[propNum].type, (props[propNum].isArray || props[propNum].isSet), props[propNum].isMap) {\n                var values = baselineValues\n                values[propNum] = validValue\n                let object = SwiftObject(value: values)\n                verifySwiftObjectWithArrayLiteral(object, array: values, boolObjectValue: true,\n                    boolObjectListValues: [true, false])\n            }\n        }\n\n        // test with invalid dictionary literals\n        for propNum in 0..<props.count {\n            for invalidValue in invalidValuesForSwiftObjectType(props[propNum].type, (props[propNum].isArray || props[propNum].isSet), props[propNum].isMap) {\n                // update dict with invalid value and init\n                var values = baselineValues\n                values[propNum] = invalidValue\n                assertThrows(SwiftObject(value: values), \"Invalid property value\")\n            }\n        }\n    }\n\n    func testInitWithKVCObject() {\n        // test with kvc object\n        let objectWithInt = SwiftObject(value: [\"intCol\": 200])\n        let objectWithKVCObject = SwiftObject(value: objectWithInt)\n        let valueDict = defaultSwiftObjectValuesWithReplacements([\"intCol\": 200])\n        verifySwiftObjectWithDictionaryLiteral(objectWithKVCObject, dictionary: valueDict, boolObjectValue: false,\n            boolObjectListValues: [])\n    }\n\n    func testGenericInit() {\n        func createObject<T: Object>() -> T {\n            return T()\n        }\n        let obj1: SwiftBoolObject = createObject()\n        let obj2 = SwiftBoolObject()\n        XCTAssertEqual(obj1.boolCol, obj2.boolCol,\n            \"object created via generic initializer should equal object created by calling initializer directly\")\n    }\n\n    func testInitWithObjcName() {\n        // Test that init doesn't crash going into non-swift init logic for renamed Swift classes.\n        _ = SwiftObjcRenamedObject()\n        _ = SwiftObjcArbitrarilyRenamedObject()\n    }\n\n    // MARK: - Creation tests\n\n    func testCreateWithDefaults() {\n        let realm = try! Realm()\n        assertThrows(realm.create(SwiftObject.self), \"Must be in write transaction\")\n\n        var object: SwiftObject!\n        let objects = realm.objects(SwiftObject.self)\n        XCTAssertEqual(0, objects.count)\n        try! realm.write {\n            // test create with all defaults\n            object = realm.create(SwiftObject.self)\n            return\n        }\n        verifySwiftObjectWithDictionaryLiteral(object, dictionary: SwiftObject.defaultValues(), boolObjectValue: false,\n                                               boolObjectListValues: [])\n\n        // test realm properties are populated correctly\n        XCTAssertEqual(object.realm!, realm)\n        XCTAssertEqual(object.objectCol!.realm!, realm)\n        XCTAssertEqual(object.arrayCol.realm!, realm)\n    }\n\n    func testCreateWithOptionalWithoutDefaults() {\n        let realm = try! Realm()\n        try! realm.write {\n            let object = realm.create(SwiftOptionalObject.self)\n            for prop in object.objectSchema.properties {\n                XCTAssertNil(object[prop.name])\n            }\n        }\n    }\n\n    func testCreateWithOptionalDefaults() {\n        let realm = try! Realm()\n        try! realm.write {\n            let object = realm.create(SwiftOptionalDefaultValuesObject.self)\n            self.verifySwiftOptionalObjectWithDictionaryLiteral(object,\n                                                                dictionary: SwiftOptionalDefaultValuesObject.defaultValues(), boolObjectValue: true)\n        }\n    }\n\n    func testCreateWithOptionalIgnoredProperties() {\n        let realm = try! Realm()\n        try! realm.write {\n            let object = realm.create(SwiftOptionalIgnoredPropertiesObject.self)\n            let properties = object.objectSchema.properties\n            XCTAssertEqual(properties.count, 1)\n            XCTAssertEqual(properties[0].name, \"id\")\n        }\n    }\n\n    func testCreateWithDictionary() {\n        // dictionary with all values specified\n        let baselineValues: [String: Any] = [\n            \"boolCol\": true,\n            \"intCol\": 1,\n            \"int8Col\": 1 as Int8,\n            \"int16Col\": 1 as Int16,\n            \"int32Col\": 1 as Int32,\n            \"int64Col\": 1 as Int64,\n            \"floatCol\": 1.1 as Float,\n            \"doubleCol\": 11.1,\n            \"stringCol\": \"b\",\n            \"binaryCol\": Data(\"b\".utf8),\n            \"dateCol\": Date(timeIntervalSince1970: 2),\n            \"decimalCol\": 3 as Decimal128,\n            \"objectIdCol\": ObjectId.generate(),\n            \"objectCol\": SwiftBoolObject(value: [true]),\n            \"arrayCol\": [SwiftBoolObject(value: [true]), SwiftBoolObject()],\n            \"setCol\": [SwiftBoolObject(value: [true]), SwiftBoolObject()],\n            \"mapCol\": [\"trueVal\": [\"boolCol\": true], \"falseVal\": [\"boolCol\": false]],\n            \"anyCol\": AnyRealmValue.double(10)\n        ]\n\n        // test with valid dictionary literals\n        let realm = try! Realm()\n        let props = realm.schema[\"SwiftObject\"]!.properties\n        for propNum in 0..<props.count {\n            for validValue in validValuesForSwiftObjectType(props[propNum].type, (props[propNum].isArray || props[propNum].isSet), props[propNum].isMap) {\n                // update dict with valid value and init\n                var values = baselineValues\n                values[props[propNum].name] = validValue\n                realm.beginWrite()\n                let object = realm.create(SwiftObject.self, value: values)\n                verifySwiftObjectWithDictionaryLiteral(object, dictionary: values, boolObjectValue: true,\n                    boolObjectListValues: [true, false])\n                try! realm.commitWrite()\n                verifySwiftObjectWithDictionaryLiteral(object, dictionary: values, boolObjectValue: true,\n                    boolObjectListValues: [true, false])\n            }\n        }\n\n        // test with invalid dictionary literals\n        for propNum in 0..<props.count {\n            for invalidValue in invalidValuesForSwiftObjectType(props[propNum].type, (props[propNum].isArray || props[propNum].isSet), props[propNum].isMap) {\n                // update dict with invalid value and init\n                var values = baselineValues\n                values[props[propNum].name] = invalidValue\n                realm.beginWrite()\n                assertThrows(realm.create(SwiftObject.self, value: values), \"Invalid property value\")\n                realm.cancelWrite()\n            }\n        }\n    }\n\n    func testCreateWithDefaultsAndDictionary() {\n        // test with dictionary with mix of default and one specified value\n        let realm = try! Realm()\n        realm.beginWrite()\n        let objectWithInt = realm.create(SwiftObject.self, value: [\"intCol\": 200])\n        try! realm.commitWrite()\n\n        let valueDict = defaultSwiftObjectValuesWithReplacements([\"intCol\": 200])\n        verifySwiftObjectWithDictionaryLiteral(objectWithInt, dictionary: valueDict, boolObjectValue: false,\n            boolObjectListValues: [])\n    }\n\n    func testCreateWithArray() {\n        // array with all values specified\n        let baselineValues: [Any] = [true, 1, Int8(1), Int16(1), Int32(1), Int64(1), IntEnum.value1.rawValue, 1.1 as Float,\n                                     11.1, \"b\", Data(\"b\".utf8),\n                                     Date(timeIntervalSince1970: 2), Decimal128(number: 123),\n                                     ObjectId.generate(), [\"boolCol\": true],\n                                     UUID(uuidString: \"137decc8-b300-4954-a233-f89909f4fd89\")!,\n                                     \"anyCol\", [[true], [false]], [[true], [false]],\n                                     [\"trueVal\": [\"boolCol\": true], \"falseVal\": [\"boolCol\": false]]]\n\n        // test with valid dictionary literals\n        let realm = try! Realm()\n        let props = realm.schema[\"SwiftObject\"]!.properties\n        for propNum in 0..<props.count {\n            for validValue in validValuesForSwiftObjectType(props[propNum].type, (props[propNum].isArray || props[propNum].isSet), props[propNum].isMap) {\n                var values = baselineValues\n                values[propNum] = validValue\n                realm.beginWrite()\n                let object = realm.create(SwiftObject.self, value: values)\n                verifySwiftObjectWithArrayLiteral(object, array: values, boolObjectValue: true,\n                    boolObjectListValues: [true, false])\n                try! realm.commitWrite()\n                verifySwiftObjectWithArrayLiteral(object, array: values, boolObjectValue: true,\n                    boolObjectListValues: [true, false])\n            }\n        }\n\n        // test with invalid array literals\n        for propNum in 0..<props.count {\n            for invalidValue in invalidValuesForSwiftObjectType(props[propNum].type, (props[propNum].isArray || props[propNum].isSet), props[propNum].isMap) {\n                // update dict with invalid value and init\n                var values = baselineValues\n                values[propNum] = invalidValue\n\n                realm.beginWrite()\n                assertThrows(realm.create(SwiftObject.self, value: values),\n                    \"Invalid property value '\\(invalidValue)' for property number \\(propNum)\")\n                realm.cancelWrite()\n            }\n        }\n    }\n\n    func testCreateWithKVCObject() {\n        // test with kvc object\n        let realm = try! Realm()\n        realm.beginWrite()\n        let objectWithInt = realm.create(SwiftObject.self, value: [\"intCol\": 200])\n        let objectWithKVCObject = realm.create(SwiftObject.self, value: objectWithInt)\n        let valueDict = defaultSwiftObjectValuesWithReplacements([\"intCol\": 200])\n        try! realm.commitWrite()\n\n        verifySwiftObjectWithDictionaryLiteral(objectWithKVCObject, dictionary: valueDict, boolObjectValue: false,\n            boolObjectListValues: [])\n        XCTAssertEqual(realm.objects(SwiftObject.self).count, 2, \"Object should have been copied\")\n    }\n\n    func testCreateWithNestedObjects() throws {\n        let standalone = SwiftPrimaryStringObject(value: [\"p0\", 11])\n        let realm = try Realm()\n        let objectWithNestedObjects = try realm.write {\n            realm.create(SwiftLinkToPrimaryStringObject.self, value: [\"p1\", [\"p1\", 12] as [Any],\n                                                                      [standalone]])\n        }\n\n        let stringObjects = realm.objects(SwiftPrimaryStringObject.self)\n        XCTAssertEqual(stringObjects.count, 2)\n        let p0 = realm.object(ofType: SwiftPrimaryStringObject.self, forPrimaryKey: \"p0\")\n        let p1 = realm.object(ofType: SwiftPrimaryStringObject.self, forPrimaryKey: \"p1\")\n\n        // standalone object should be copied into the realm, not added directly\n        XCTAssertNil(standalone.realm)\n        XCTAssertNotEqual(standalone, p0)\n        XCTAssertEqual(objectWithNestedObjects.object!, p1)\n        XCTAssertEqual(objectWithNestedObjects.objects.first!, p0)\n\n        let standalone1 = SwiftPrimaryStringObject(value: [\"p3\", 11])\n        realm.beginWrite()\n        assertThrows(realm.create(SwiftLinkToPrimaryStringObject.self, value: [\"p3\", [\"p3\", 11] as [Any], [standalone1]]),\n            \"Should throw with duplicate primary key\")\n        realm.cancelWrite()\n    }\n\n    func testUpdateWithNestedObjects() throws {\n        let standalone = SwiftPrimaryStringObject(value: [\"primary\", 11])\n        let realm = try Realm()\n        let object = try realm.write {\n            realm.create(SwiftLinkToPrimaryStringObject.self,\n                         value: [\"otherPrimary\", [\"primary\", 12] as [Any],\n                                 [[\"primary\", 12] as [Any]]], update: .all)\n        }\n\n        let stringObjects = realm.objects(SwiftPrimaryStringObject.self)\n        XCTAssertEqual(stringObjects.count, 1)\n        let persistedObject = object.object!\n\n        XCTAssertEqual(persistedObject.intCol, 12)\n        XCTAssertNil(standalone.realm) // the standalone object should be copied, rather than added, to the realm\n        XCTAssertEqual(object.object!, persistedObject)\n        XCTAssertEqual(object.objects.first!, persistedObject)\n    }\n\n    func testUpdateChangedWithNestedObjects() throws {\n        let standalone = SwiftPrimaryStringObject(value: [\"primary\", 11])\n        let realm = try Realm()\n        let object = try realm.write {\n            realm.create(SwiftLinkToPrimaryStringObject.self,\n                         value: [\"otherPrimary\", [\"primary\", 12] as [Any],\n                                 [[\"primary\", 12] as [Any]]], update: .modified)\n        }\n\n        let stringObjects = realm.objects(SwiftPrimaryStringObject.self)\n        XCTAssertEqual(stringObjects.count, 1)\n        let persistedObject = object.object!\n\n        XCTAssertEqual(persistedObject.intCol, 12)\n        XCTAssertNil(standalone.realm) // the standalone object should be copied, rather than added, to the realm\n        XCTAssertEqual(object.object!, persistedObject)\n        XCTAssertEqual(object.objects.first!, persistedObject)\n    }\n\n    func testCreateWithObjectsFromAnotherRealm() throws {\n        let values: [String: Any] = [\n            \"boolCol\": true,\n            \"intCol\": 1,\n            \"int8Col\": 1 as Int8,\n            \"int16Col\": 1 as Int16,\n            \"int32Col\": 1 as Int32,\n            \"int64Col\": 1 as Int64,\n            \"floatCol\": 1.1 as Float,\n            \"doubleCol\": 11.1,\n            \"stringCol\": \"b\",\n            \"binaryCol\": Data(\"b\".utf8),\n            \"dateCol\": Date(timeIntervalSince1970: 2),\n            \"decimalCol\": 3 as Decimal128,\n            \"objectIdCol\": ObjectId.generate(),\n            \"objectCol\": SwiftBoolObject(value: [true]),\n            \"arrayCol\": [SwiftBoolObject(value: [true]), SwiftBoolObject()],\n            \"setCol\": [SwiftBoolObject(value: [true]), SwiftBoolObject()],\n            \"mapCol\": [\"trueVal\": SwiftBoolObject(value: [true]), \"falseVal\": SwiftBoolObject(value: [false])]\n        ]\n\n        let otherRealm = realmWithTestPath()\n        otherRealm.beginWrite()\n        let otherRealmObject = otherRealm.create(SwiftObject.self, value: values)\n        try! otherRealm.commitWrite()\n\n        let realm = try Realm()\n        let object = try realm.write {\n            realm.create(SwiftObject.self, value: otherRealmObject)\n        }\n\n        XCTAssertNotEqual(otherRealmObject, object)\n        verifySwiftObjectWithDictionaryLiteral(object, dictionary: values, boolObjectValue: true,\n            boolObjectListValues: [true, false])\n    }\n\n    func testCreateWithDeeplyNestedObjectsFromAnotherRealm() {\n        let values: [String: Any] = [\n            \"boolCol\": true,\n            \"intCol\": 1,\n            \"int8Col\": 1 as Int8,\n            \"int16Col\": 1 as Int16,\n            \"int32Col\": 1 as Int32,\n            \"int64Col\": 1 as Int64,\n            \"floatCol\": 1.1 as Float,\n            \"doubleCol\": 11.1,\n            \"stringCol\": \"b\",\n            \"binaryCol\": Data(\"b\".utf8),\n            \"dateCol\": Date(timeIntervalSince1970: 2),\n            \"decimalCol\": 3 as Decimal128,\n            \"objectIdCol\": ObjectId.generate(),\n            \"objectCol\": SwiftBoolObject(value: [true]),\n            \"arrayCol\": [SwiftBoolObject(value: [true]), SwiftBoolObject()],\n            \"setCol\": [SwiftBoolObject(value: [true]), SwiftBoolObject()],\n            \"mapCol\": [\"trueVal\": SwiftBoolObject(value: [true]), \"falseVal\": SwiftBoolObject(value: [false])]\n        ]\n\n        let realmA = realmWithTestPath()\n        let realmB = try! Realm()\n\n        var realmAListObject: SwiftListOfSwiftObject?\n        try! realmA.write {\n            let array = [SwiftObject(value: values), SwiftObject(value: values)]\n            realmAListObject = realmA.create(SwiftListOfSwiftObject.self, value: [\"array\": array])\n        }\n\n        var realmBListObject: SwiftListOfSwiftObject!\n        try! realmB.write {\n            realmBListObject = realmB.create(SwiftListOfSwiftObject.self, value: realmAListObject!)\n        }\n\n        XCTAssertNotEqual(realmAListObject, realmBListObject)\n        XCTAssertEqual(realmBListObject.array.count, 2)\n        for swiftObject in realmBListObject.array {\n            verifySwiftObjectWithDictionaryLiteral(swiftObject, dictionary: values, boolObjectValue: true,\n                boolObjectListValues: [true, false])\n        }\n\n        var realmASetObject: SwiftMutableSetOfSwiftObject?\n        try! realmA.write {\n            let set = [SwiftObject(value: values), SwiftObject(value: values)]\n            realmASetObject = realmA.create(SwiftMutableSetOfSwiftObject.self, value: [\"set\": set])\n        }\n\n        var realmBSetObject: SwiftMutableSetOfSwiftObject!\n        try! realmB.write {\n            realmBSetObject = realmB.create(SwiftMutableSetOfSwiftObject.self, value: realmASetObject!)\n        }\n\n        XCTAssertNotEqual(realmASetObject, realmBSetObject)\n        XCTAssertEqual(realmBSetObject.set.count, 2)\n        for swiftObject in realmBSetObject.set {\n            verifySwiftObjectWithDictionaryLiteral(swiftObject, dictionary: values, boolObjectValue: true,\n                boolObjectListValues: [true, false])\n        }\n    }\n\n    func testUpdateWithObjectsFromAnotherRealm() throws {\n        let testRealm = realmWithTestPath()\n        let otherRealmObject = try testRealm.write {\n            testRealm.create(SwiftLinkToPrimaryStringObject.self,\n                             value: [\"primary\", NSNull(), [[\"2\", 2] as [Any], [\"4\", 4]]])\n        }\n\n        let realm = try Realm()\n        let object = try realm.write { () -> SwiftLinkToPrimaryStringObject in\n            realm.create(SwiftLinkToPrimaryStringObject.self,\n                         value: [\"primary\", [\"10\", 10] as [Any], [[\"11\", 11] as [Any]]])\n            return realm.create(SwiftLinkToPrimaryStringObject.self, value: otherRealmObject, update: .all)\n        }\n\n        XCTAssertNotEqual(otherRealmObject, object) // the object from the other realm should be copied into this realm\n        XCTAssertEqual(realm.objects(SwiftLinkToPrimaryStringObject.self).count, 1)\n        XCTAssertEqual(realm.objects(SwiftPrimaryStringObject.self).count, 4)\n    }\n\n    func testUpdateChangedWithObjectsFromAnotherRealm() throws {\n        let testRealm = realmWithTestPath()\n        let otherRealmObject = try testRealm.write {\n            testRealm.create(SwiftLinkToPrimaryStringObject.self,\n                             value: [\"primary\", NSNull(), [[\"2\", 2] as [Any], [\"4\", 4]]])\n        }\n\n        let realm = try Realm()\n        let object = try realm.write { () -> SwiftLinkToPrimaryStringObject in\n            realm.create(SwiftLinkToPrimaryStringObject.self,\n                         value: [\"primary\", [\"10\", 10] as [Any], [[\"11\", 11] as [Any]]])\n            return realm.create(SwiftLinkToPrimaryStringObject.self, value: otherRealmObject, update: .modified)\n        }\n\n        XCTAssertNotEqual(otherRealmObject, object) // the object from the other realm should be copied into this realm\n        XCTAssertEqual(realm.objects(SwiftLinkToPrimaryStringObject.self).count, 1)\n        XCTAssertEqual(realm.objects(SwiftPrimaryStringObject.self).count, 4)\n    }\n\n    func testCreateWithNSNullLinks() {\n        let values: [String: Any] = [\n            \"boolCol\": true,\n            \"intCol\": 1,\n            \"floatCol\": 1.1,\n            \"doubleCol\": 11.1,\n            \"stringCol\": \"b\",\n            \"binaryCol\": Data(\"b\".utf8),\n            \"dateCol\": Date(timeIntervalSince1970: 2),\n            \"decimalCol\": 3 as Decimal128,\n            \"objectIdCol\": ObjectId.generate(),\n            \"objectCol\": NSNull(),\n            \"arrayCol\": NSNull(),\n            \"setCol\": NSNull()\n        ]\n\n        let realm = realmWithTestPath()\n        realm.beginWrite()\n        let object = realm.create(SwiftObject.self, value: values)\n        try! realm.commitWrite()\n\n        XCTAssertNil(object.objectCol)\n        XCTAssertEqual(object.arrayCol.count, 0)\n        XCTAssertEqual(object.setCol.count, 0)\n    }\n\n    func testCreateWithObjcName() {\n        let realm = try! Realm()\n        try! realm.write {\n            let object = realm.create(SwiftObjcRenamedObject.self)\n            object.stringCol = \"string\"\n        }\n\n        XCTAssertEqual(realm.objects(SwiftObjcRenamedObject.self).count, 1)\n\n        try! realm.write {\n            realm.delete(realm.objects(SwiftObjcRenamedObject.self))\n        }\n    }\n\n    func testCreateWithDifferentObjcName() {\n        let realm = try! Realm()\n        try! realm.write {\n            let object = realm.create(SwiftObjcArbitrarilyRenamedObject.self)\n            object.boolCol = true\n        }\n\n        XCTAssertEqual(realm.objects(SwiftObjcArbitrarilyRenamedObject.self).count, 1)\n\n        try! realm.write {\n            realm.delete(realm.objects(SwiftObjcArbitrarilyRenamedObject.self))\n        }\n    }\n\n    func testCreateOrUpdateNil() {\n        let realm = try! Realm()\n        realm.beginWrite()\n\n        // Create with all fields nil\n        let object = realm.create(SwiftOptionalPrimaryObject.self, value: SwiftOptionalPrimaryObject(), update: .all)\n\n        XCTAssertNil(object.id.value)\n        XCTAssertNil(object.optIntCol.value)\n        XCTAssertNil(object.optInt8Col.value)\n        XCTAssertNil(object.optInt16Col.value)\n        XCTAssertNil(object.optInt32Col.value)\n        XCTAssertNil(object.optInt64Col.value)\n        XCTAssertNil(object.optBoolCol.value)\n        XCTAssertNil(object.optFloatCol.value)\n        XCTAssertNil(object.optDoubleCol.value)\n        XCTAssertNil(object.optDateCol)\n        XCTAssertNil(object.optStringCol)\n        XCTAssertNil(object.optNSStringCol)\n        XCTAssertNil(object.optBinaryCol)\n        XCTAssertNil(object.optObjectCol)\n\n        // Try to switch to non-nil\n        let object2 = SwiftOptionalPrimaryObject()\n        object2.optIntCol.value = 1\n        object2.optInt8Col.value = 1\n        object2.optInt16Col.value = 1\n        object2.optInt32Col.value = 1\n        object2.optInt64Col.value = 1\n        object2.optFloatCol.value = 1\n        object2.optDoubleCol.value = 1\n        object2.optBoolCol.value = true\n        object2.optDateCol = Date()\n        object2.optStringCol = \"\"\n        object2.optNSStringCol = \"\"\n        object2.optBinaryCol = Data()\n        object2.optObjectCol = SwiftBoolObject()\n        realm.create(SwiftOptionalPrimaryObject.self, value: object2, update: .all)\n\n        XCTAssertNil(object.id.value)\n        XCTAssertNotNil(object.optIntCol.value)\n        XCTAssertNotNil(object.optInt8Col.value)\n        XCTAssertNotNil(object.optInt16Col.value)\n        XCTAssertNotNil(object.optInt32Col.value)\n        XCTAssertNotNil(object.optInt64Col.value)\n        XCTAssertNotNil(object.optBoolCol.value)\n        XCTAssertNotNil(object.optFloatCol.value)\n        XCTAssertNotNil(object.optDoubleCol.value)\n        XCTAssertNotNil(object.optDateCol)\n        XCTAssertNotNil(object.optStringCol)\n        XCTAssertNotNil(object.optNSStringCol)\n        XCTAssertNotNil(object.optBinaryCol)\n        XCTAssertNotNil(object.optObjectCol)\n\n        // Try to switch back to nil\n        realm.create(SwiftOptionalPrimaryObject.self, value: SwiftOptionalPrimaryObject(), update: .all)\n\n        XCTAssertNil(object.id.value)\n\n        XCTAssertNil(object.optIntCol.value)\n        XCTAssertNil(object.optInt8Col.value)\n        XCTAssertNil(object.optInt16Col.value)\n        XCTAssertNil(object.optInt32Col.value)\n        XCTAssertNil(object.optInt64Col.value)\n        XCTAssertNil(object.optBoolCol.value)\n        XCTAssertNil(object.optFloatCol.value)\n        XCTAssertNil(object.optDoubleCol.value)\n        XCTAssertNil(object.optDateCol)\n        XCTAssertNil(object.optStringCol)\n        XCTAssertNil(object.optNSStringCol)\n        XCTAssertNil(object.optBinaryCol)\n        XCTAssertNil(object.optObjectCol)\n\n        realm.cancelWrite()\n    }\n\n    func testCreateOrUpdateModifiedNil() {\n        let realm = try! Realm()\n        realm.beginWrite()\n\n        // Create with all fields nil\n        let object = realm.create(SwiftOptionalPrimaryObject.self, value: SwiftOptionalPrimaryObject(), update: .modified)\n\n        XCTAssertNil(object.id.value)\n        XCTAssertNil(object.optIntCol.value)\n        XCTAssertNil(object.optInt8Col.value)\n        XCTAssertNil(object.optInt16Col.value)\n        XCTAssertNil(object.optInt32Col.value)\n        XCTAssertNil(object.optInt64Col.value)\n        XCTAssertNil(object.optBoolCol.value)\n        XCTAssertNil(object.optFloatCol.value)\n        XCTAssertNil(object.optDoubleCol.value)\n        XCTAssertNil(object.optDateCol)\n        XCTAssertNil(object.optStringCol)\n        XCTAssertNil(object.optNSStringCol)\n        XCTAssertNil(object.optBinaryCol)\n        XCTAssertNil(object.optObjectCol)\n\n        // Try to switch to non-nil\n        let object2 = SwiftOptionalPrimaryObject()\n        object2.optIntCol.value = 1\n        object2.optInt8Col.value = 1\n        object2.optInt16Col.value = 1\n        object2.optInt32Col.value = 1\n        object2.optInt64Col.value = 1\n        object2.optFloatCol.value = 1\n        object2.optDoubleCol.value = 1\n        object2.optBoolCol.value = true\n        object2.optDateCol = Date()\n        object2.optStringCol = \"\"\n        object2.optNSStringCol = \"\"\n        object2.optBinaryCol = Data()\n        object2.optObjectCol = SwiftBoolObject()\n        realm.create(SwiftOptionalPrimaryObject.self, value: object2, update: .modified)\n\n        XCTAssertNil(object.id.value)\n        XCTAssertNotNil(object.optIntCol.value)\n        XCTAssertNotNil(object.optInt8Col.value)\n        XCTAssertNotNil(object.optInt16Col.value)\n        XCTAssertNotNil(object.optInt32Col.value)\n        XCTAssertNotNil(object.optInt64Col.value)\n        XCTAssertNotNil(object.optBoolCol.value)\n        XCTAssertNotNil(object.optFloatCol.value)\n        XCTAssertNotNil(object.optDoubleCol.value)\n        XCTAssertNotNil(object.optDateCol)\n        XCTAssertNotNil(object.optStringCol)\n        XCTAssertNotNil(object.optNSStringCol)\n        XCTAssertNotNil(object.optBinaryCol)\n        XCTAssertNotNil(object.optObjectCol)\n\n        // Try to switch back to nil\n        realm.create(SwiftOptionalPrimaryObject.self, value: SwiftOptionalPrimaryObject(), update: .modified)\n\n        XCTAssertNil(object.id.value)\n\n        XCTAssertNil(object.optIntCol.value)\n        XCTAssertNil(object.optInt8Col.value)\n        XCTAssertNil(object.optInt16Col.value)\n        XCTAssertNil(object.optInt32Col.value)\n        XCTAssertNil(object.optInt64Col.value)\n        XCTAssertNil(object.optBoolCol.value)\n        XCTAssertNil(object.optFloatCol.value)\n        XCTAssertNil(object.optDoubleCol.value)\n        XCTAssertNil(object.optDateCol)\n        XCTAssertNil(object.optStringCol)\n        XCTAssertNil(object.optNSStringCol)\n        XCTAssertNil(object.optBinaryCol)\n        XCTAssertNil(object.optObjectCol)\n\n        realm.cancelWrite()\n    }\n\n    func testCreateOrUpdateDynamicUnmanagedType() {\n        let realm = try! Realm()\n        let unmanagedValue = SwiftOptionalPrimaryObject()\n        // Shouldn't throw.\n        realm.beginWrite()\n        _ = realm.create(type(of: unmanagedValue), value: unmanagedValue, update: .modified)\n        realm.cancelWrite()\n    }\n\n    func testCreateOrUpdateDynamicManagedType() {\n        let realm = try! Realm()\n        let managedValue = SwiftOptionalPrimaryObject()\n        try! realm.write {\n            realm.add(managedValue)\n        }\n        // Shouldn't throw.\n        realm.beginWrite()\n        _ = realm.create(type(of: managedValue), value: managedValue, update: .all)\n        realm.cancelWrite()\n    }\n\n    func testCreateOrUpdateModifiedDynamicManagedType() {\n        let realm = try! Realm()\n        let managedValue = SwiftOptionalPrimaryObject()\n        try! realm.write {\n            realm.add(managedValue)\n        }\n        // Shouldn't throw.\n        realm.beginWrite()\n        _ = realm.create(type(of: managedValue), value: managedValue, update: .modified)\n        realm.cancelWrite()\n    }\n\n    func testCreateOrUpdateWithMismatchedStaticAndDynamicTypes() {\n        let realm = try! Realm()\n        let obj: Object = SwiftOptionalPrimaryObject()\n        try! realm.write {\n            let obj2 = realm.create(type(of: obj), value: obj)\n            XCTAssertEqual(obj2.objectSchema.className, \"SwiftOptionalPrimaryObject\")\n            let obj3 = realm.create(type(of: obj), value: obj, update: .all)\n            XCTAssertEqual(obj3.objectSchema.className, \"SwiftOptionalPrimaryObject\")\n        }\n    }\n\n    func testDynamicCreateEmbeddedDirectly() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        assertThrows(realm.dynamicCreate(\"EmbeddedTreeObject1\"),\n                     reasonMatching: \"Embedded objects cannot be created directly\")\n        realm.cancelWrite()\n    }\n\n    func testCreateEmbeddedWithDictionary() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let parent = realm.create(EmbeddedParentObject.self, value: [\n            \"object\": [\"value\": 5, \"child\": [\"value\": 6], \"children\": [[7], [8]]] as [String: Any],\n            \"array\": [[9], [10]]\n        ])\n        XCTAssertEqual(parent.object!.value, 5)\n        XCTAssertEqual(parent.object!.child!.value, 6)\n        XCTAssertEqual(parent.object!.children.count, 2)\n        XCTAssertEqual(parent.object!.children[0].value, 7)\n        XCTAssertEqual(parent.object!.children[1].value, 8)\n        XCTAssertEqual(parent.array.count, 2)\n        XCTAssertEqual(parent.array[0].value, 9)\n        XCTAssertEqual(parent.array[1].value, 10)\n\n        XCTAssertTrue(parent.isSameObject(as: parent.object!.parent1.first!))\n        XCTAssertTrue(parent.isSameObject(as: parent.array[0].parent2.first!))\n        XCTAssertTrue(parent.isSameObject(as: parent.array[1].parent2.first!))\n        XCTAssertTrue(parent.object!.isSameObject(as: parent.object!.child!.parent3.first!))\n        XCTAssertTrue(parent.object!.isSameObject(as: parent.object!.children[0].parent4.first!))\n        XCTAssertTrue(parent.object!.isSameObject(as: parent.object!.children[1].parent4.first!))\n\n        realm.cancelWrite()\n    }\n\n    func testCreateEmbeddedWithUnmanagedObjects() {\n        let sourceObject = EmbeddedParentObject()\n        sourceObject.object = .init(value: [5])\n        sourceObject.object!.child = .init(value: [6])\n        sourceObject.object!.children.append(.init(value: [7]))\n        sourceObject.object!.children.append(.init(value: [8]))\n        sourceObject.array.append(.init(value: [9]))\n        sourceObject.array.append(.init(value: [10]))\n\n        let realm = try! Realm()\n        realm.beginWrite()\n        let parent = realm.create(EmbeddedParentObject.self, value: sourceObject)\n        XCTAssertNil(sourceObject.realm)\n        XCTAssertEqual(parent.object!.value, 5)\n        XCTAssertEqual(parent.object!.child!.value, 6)\n        XCTAssertEqual(parent.object!.children.count, 2)\n        XCTAssertEqual(parent.object!.children[0].value, 7)\n        XCTAssertEqual(parent.object!.children[1].value, 8)\n        XCTAssertEqual(parent.array.count, 2)\n        XCTAssertEqual(parent.array[0].value, 9)\n        XCTAssertEqual(parent.array[1].value, 10)\n        realm.cancelWrite()\n    }\n\n    func testCreateEmbeddedFromManagedObjectInSameRealm() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let parent = realm.create(EmbeddedParentObject.self, value: [\n            \"object\": [\"value\": 5, \"child\": [\"value\": 6], \"children\": [[7], [8]]] as [String: Any],\n            \"array\": [[9], [10]]\n        ])\n        let copy = realm.create(EmbeddedParentObject.self, value: parent)\n        XCTAssertNotEqual(parent, copy)\n        XCTAssertEqual(copy.object!.value, 5)\n        XCTAssertEqual(copy.object!.child!.value, 6)\n        XCTAssertEqual(copy.object!.children.count, 2)\n        XCTAssertEqual(copy.object!.children[0].value, 7)\n        XCTAssertEqual(copy.object!.children[1].value, 8)\n        XCTAssertEqual(copy.array.count, 2)\n        XCTAssertEqual(copy.array[0].value, 9)\n        XCTAssertEqual(copy.array[1].value, 10)\n        realm.cancelWrite()\n    }\n\n    func testCreateEmbeddedFromManagedObjectInDifferentRealm() {\n        let realmA = realmWithTestPath()\n        let realmB = try! Realm()\n        realmA.beginWrite()\n        let parent = realmA.create(EmbeddedParentObject.self, value: [\n            \"object\": [\"value\": 5, \"child\": [\"value\": 6], \"children\": [[7], [8]]] as [String: Any],\n            \"array\": [[9], [10]]\n        ])\n        try! realmA.commitWrite()\n\n        realmB.beginWrite()\n        let copy = realmB.create(EmbeddedParentObject.self, value: parent)\n        XCTAssertNotEqual(parent, copy)\n        XCTAssertEqual(copy.object!.value, 5)\n        XCTAssertEqual(copy.object!.child!.value, 6)\n        XCTAssertEqual(copy.object!.children.count, 2)\n        XCTAssertEqual(copy.object!.children[0].value, 7)\n        XCTAssertEqual(copy.object!.children[1].value, 8)\n        XCTAssertEqual(copy.array.count, 2)\n        XCTAssertEqual(copy.array[0].value, 9)\n        XCTAssertEqual(copy.array[1].value, 10)\n        realmB.cancelWrite()\n    }\n\n    func testCreateObjectWithNestedEmbeddedType() throws {\n        let realm = try Realm()\n        let obj = try realm.write {\n            realm.create(ObjectWithNestedEmbeddedObject.self, value: [1, [2]])\n        }\n        XCTAssertEqual(obj.value, 1)\n        XCTAssertEqual(obj.inner!.value, 2)\n    }\n\n    // test null object\n    // test null list\n\n    // MARK: - Add tests\n    func testAddWithExisingNestedObjects() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let existingObject = realm.create(SwiftBoolObject.self)\n        try! realm.commitWrite()\n\n        realm.beginWrite()\n        let object = SwiftObject(value: [\"objectCol\": existingObject])\n        realm.add(object)\n        try! realm.commitWrite()\n\n        XCTAssertNotNil(object.realm)\n\n        assertEqual(object.objectCol, existingObject)\n    }\n\n    class EmbeddedObjectFactory {\n        private var value = 0\n        var objects = [EmbeddedObject]()\n\n        func create<T: EmbeddedTreeObject>() -> T {\n            let obj = T()\n            obj.value = value\n            value += 1\n            objects.append(obj)\n            return obj\n        }\n    }\n\n    func testAddEmbedded() {\n        let objectFactory = EmbeddedObjectFactory()\n        let parent = EmbeddedParentObject()\n        parent.object = objectFactory.create()\n        parent.object!.child = objectFactory.create()\n        parent.object!.children.append(objectFactory.create())\n        parent.object!.children.append(objectFactory.create())\n        parent.array.append(objectFactory.create())\n        parent.array.append(objectFactory.create())\n\n        let realm = try! Realm()\n        realm.beginWrite()\n        realm.add(parent)\n        for (i, object) in objectFactory.objects.enumerated() {\n            XCTAssertEqual(object.realm, realm)\n            XCTAssertEqual((object as! EmbeddedTreeObject).value, i)\n        }\n        XCTAssertEqual(parent.object!.value, 0)\n        XCTAssertEqual(parent.object!.child!.value, 1)\n        XCTAssertEqual(parent.object!.children.count, 2)\n        XCTAssertEqual(parent.object!.children[0].value, 2)\n        XCTAssertEqual(parent.object!.children[1].value, 3)\n        XCTAssertEqual(parent.array.count, 2)\n        XCTAssertEqual(parent.array[0].value, 4)\n        XCTAssertEqual(parent.array[1].value, 5)\n        realm.cancelWrite()\n    }\n\n    func testAddAndUpdateWithExisingNestedObjects() throws {\n        let realm = try Realm()\n        let existingObject = try realm.write {\n            realm.create(SwiftPrimaryStringObject.self, value: [\"primary\", 1])\n        }\n\n        let object = try realm.write { () -> SwiftLinkToPrimaryStringObject in\n            let object = SwiftLinkToPrimaryStringObject(value: [\"primary\", [\"primary\", 2] as [Any]])\n            realm.add(object, update: .all)\n            return object\n        }\n\n        XCTAssertNotNil(object.realm)\n        XCTAssertEqual(object.object!, existingObject) // the existing object should be updated\n        XCTAssertEqual(existingObject.intCol, 2)\n    }\n\n    func testAddAndUpdateEmbedded() {\n        let objectFactory = EmbeddedObjectFactory()\n        let parent = EmbeddedPrimaryParentObject()\n        parent.object = objectFactory.create()\n        parent.object!.child = objectFactory.create()\n        parent.object!.children.append(objectFactory.create())\n        parent.object!.children.append(objectFactory.create())\n        parent.array.append(objectFactory.create())\n        parent.array.append(objectFactory.create())\n\n        let parent2 = EmbeddedPrimaryParentObject()\n        parent2.object = objectFactory.create()\n        parent2.object!.child = objectFactory.create()\n        parent2.object!.children.append(objectFactory.create())\n        parent2.object!.children.append(objectFactory.create())\n        parent2.array.append(objectFactory.create())\n        parent2.array.append(objectFactory.create())\n\n        let realm = try! Realm()\n        realm.beginWrite()\n        realm.add(parent)\n        realm.add(parent2, update: .all)\n\n        // update all deletes the old embedded objects and creates new ones\n        for (i, object) in objectFactory.objects.enumerated() {\n            XCTAssertEqual(object.realm, realm)\n            if i < 6 {\n                XCTAssertTrue(object.isInvalidated)\n            } else {\n                XCTAssertEqual((object as! EmbeddedTreeObject).value, i)\n            }\n        }\n        XCTAssertTrue(parent.isSameObject(as: parent2))\n        XCTAssertEqual(parent.object!.value, 6)\n        XCTAssertEqual(parent.object!.child!.value, 7)\n        XCTAssertEqual(parent.object!.children.count, 2)\n        XCTAssertEqual(parent.object!.children[0].value, 8)\n        XCTAssertEqual(parent.object!.children[1].value, 9)\n        XCTAssertEqual(parent.array.count, 2)\n        XCTAssertEqual(parent.array[0].value, 10)\n        XCTAssertEqual(parent.array[1].value, 11)\n        realm.cancelWrite()\n    }\n\n    func testAddAndUpdateChangedWithExisingNestedObjects() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let existingObject = realm.create(SwiftPrimaryStringObject.self, value: [\"primary\", 1])\n        try! realm.commitWrite()\n\n        realm.beginWrite()\n        let object = SwiftLinkToPrimaryStringObject(value: [\"primary\", [\"primary\", 2] as [Any]])\n        realm.add(object, update: .modified)\n        try! realm.commitWrite()\n\n        XCTAssertNotNil(object.realm)\n        XCTAssertEqual(object.object!, existingObject) // the existing object should be updated\n        XCTAssertEqual(existingObject.intCol, 2)\n    }\n\n    func testAddAndUpdateChangedEmbedded() {\n        let objectFactory = EmbeddedObjectFactory()\n        let parent = EmbeddedPrimaryParentObject()\n        parent.object = objectFactory.create()\n        parent.object!.child = objectFactory.create()\n        parent.object!.children.append(objectFactory.create())\n        parent.object!.children.append(objectFactory.create())\n        parent.array.append(objectFactory.create())\n        parent.array.append(objectFactory.create())\n\n        let parent2 = EmbeddedPrimaryParentObject()\n        parent2.object = objectFactory.create()\n        parent2.object!.child = objectFactory.create()\n        parent2.object!.children.append(objectFactory.create())\n        parent2.object!.children.append(objectFactory.create())\n        parent2.array.append(objectFactory.create())\n        parent2.array.append(objectFactory.create())\n\n        let realm = try! Realm()\n        realm.beginWrite()\n        realm.add(parent)\n        realm.add(parent2, update: .modified)\n\n        // update modified modifies the existing embedded objects\n        for (i, object) in objectFactory.objects.enumerated() {\n            XCTAssertEqual(object.realm, realm)\n            XCTAssertEqual((object as! EmbeddedTreeObject).value, i < 6 ? i + 6 : i)\n        }\n        XCTAssertTrue(parent.isSameObject(as: parent2))\n        XCTAssertEqual(parent.object!.value, 6)\n        XCTAssertEqual(parent.object!.child!.value, 7)\n        XCTAssertEqual(parent.object!.children.count, 2)\n        XCTAssertEqual(parent.object!.children[0].value, 8)\n        XCTAssertEqual(parent.object!.children[1].value, 9)\n        XCTAssertEqual(parent.array.count, 2)\n        XCTAssertEqual(parent.array[0].value, 10)\n        XCTAssertEqual(parent.array[1].value, 11)\n        realm.cancelWrite()\n    }\n\n    func testAddObjectCycle() {\n        weak var weakObj1: SwiftCircleObject?, weakObj2: SwiftCircleObject?\n\n        autoreleasepool {\n            let obj1 = SwiftCircleObject(value: [])\n            let obj2 = SwiftCircleObject(value: [obj1, [obj1]])\n            obj1.obj = obj2\n            obj1.array.append(obj2)\n\n            weakObj1 = obj1\n            weakObj2 = obj2\n\n            let realm = try! Realm()\n            try! realm.write {\n                realm.add(obj1)\n            }\n\n            XCTAssertEqual(obj1.realm, realm)\n            XCTAssertEqual(obj2.realm, realm)\n        }\n\n        XCTAssertNil(weakObj1)\n        XCTAssertNil(weakObj2)\n    }\n\n    func testAddOrUpdateNil() {\n        let realm = try! Realm()\n        realm.beginWrite()\n\n        // Create with all fields nil\n        let object = SwiftOptionalPrimaryObject()\n        realm.add(object)\n\n        XCTAssertNil(object.id.value)\n        XCTAssertNil(object.optIntCol.value)\n        XCTAssertNil(object.optInt8Col.value)\n        XCTAssertNil(object.optInt16Col.value)\n        XCTAssertNil(object.optInt32Col.value)\n        XCTAssertNil(object.optInt64Col.value)\n        XCTAssertNil(object.optBoolCol.value)\n        XCTAssertNil(object.optFloatCol.value)\n        XCTAssertNil(object.optDoubleCol.value)\n        XCTAssertNil(object.optDateCol)\n        XCTAssertNil(object.optStringCol)\n        XCTAssertNil(object.optNSStringCol)\n        XCTAssertNil(object.optBinaryCol)\n        XCTAssertNil(object.optObjectCol)\n\n        // Try to switch to non-nil\n        let object2 = SwiftOptionalPrimaryObject()\n        object2.optIntCol.value = 1\n        object2.optInt8Col.value = 1\n        object2.optInt16Col.value = 1\n        object2.optInt32Col.value = 1\n        object2.optInt64Col.value = 1\n        object2.optFloatCol.value = 1\n        object2.optDoubleCol.value = 1\n        object2.optBoolCol.value = true\n        object2.optDateCol = Date()\n        object2.optStringCol = \"\"\n        object2.optNSStringCol = \"\"\n        object2.optBinaryCol = Data()\n        object2.optObjectCol = SwiftBoolObject()\n        realm.add(object2, update: .all)\n\n        XCTAssertNil(object.id.value)\n        XCTAssertNotNil(object.optIntCol.value)\n        XCTAssertNotNil(object.optInt8Col.value)\n        XCTAssertNotNil(object.optInt16Col.value)\n        XCTAssertNotNil(object.optInt32Col.value)\n        XCTAssertNotNil(object.optInt64Col.value)\n        XCTAssertNotNil(object.optBoolCol.value)\n        XCTAssertNotNil(object.optFloatCol.value)\n        XCTAssertNotNil(object.optDoubleCol.value)\n        XCTAssertNotNil(object.optDateCol)\n        XCTAssertNotNil(object.optStringCol)\n        XCTAssertNotNil(object.optNSStringCol)\n        XCTAssertNotNil(object.optBinaryCol)\n        XCTAssertNotNil(object.optObjectCol)\n\n        // Try to switch back to nil\n        let object3 = SwiftOptionalPrimaryObject()\n        realm.add(object3, update: .all)\n\n        XCTAssertNil(object.id.value)\n        XCTAssertNil(object.optIntCol.value)\n        XCTAssertNil(object.optInt8Col.value)\n        XCTAssertNil(object.optInt16Col.value)\n        XCTAssertNil(object.optInt32Col.value)\n        XCTAssertNil(object.optInt64Col.value)\n        XCTAssertNil(object.optBoolCol.value)\n        XCTAssertNil(object.optFloatCol.value)\n        XCTAssertNil(object.optDoubleCol.value)\n        XCTAssertNil(object.optDateCol)\n        XCTAssertNil(object.optStringCol)\n        XCTAssertNil(object.optNSStringCol)\n        XCTAssertNil(object.optBinaryCol)\n        XCTAssertNil(object.optObjectCol)\n\n        realm.cancelWrite()\n    }\n\n    func testAddOrUpdateModifiedNil() {\n        let realm = try! Realm()\n        realm.beginWrite()\n\n        // Create with all fields nil\n        let object = SwiftOptionalPrimaryObject()\n        realm.add(object)\n\n        XCTAssertNil(object.id.value)\n        XCTAssertNil(object.optIntCol.value)\n        XCTAssertNil(object.optInt8Col.value)\n        XCTAssertNil(object.optInt16Col.value)\n        XCTAssertNil(object.optInt32Col.value)\n        XCTAssertNil(object.optInt64Col.value)\n        XCTAssertNil(object.optBoolCol.value)\n        XCTAssertNil(object.optFloatCol.value)\n        XCTAssertNil(object.optDoubleCol.value)\n        XCTAssertNil(object.optDateCol)\n        XCTAssertNil(object.optStringCol)\n        XCTAssertNil(object.optNSStringCol)\n        XCTAssertNil(object.optBinaryCol)\n        XCTAssertNil(object.optObjectCol)\n\n        // Try to switch to non-nil\n        let object2 = SwiftOptionalPrimaryObject()\n        object2.optIntCol.value = 1\n        object2.optInt8Col.value = 1\n        object2.optInt16Col.value = 1\n        object2.optInt32Col.value = 1\n        object2.optInt64Col.value = 1\n        object2.optFloatCol.value = 1\n        object2.optDoubleCol.value = 1\n        object2.optBoolCol.value = true\n        object2.optDateCol = Date()\n        object2.optStringCol = \"\"\n        object2.optNSStringCol = \"\"\n        object2.optBinaryCol = Data()\n        object2.optObjectCol = SwiftBoolObject()\n        realm.add(object2, update: .modified)\n\n        XCTAssertNil(object.id.value)\n        XCTAssertNotNil(object.optIntCol.value)\n        XCTAssertNotNil(object.optInt8Col.value)\n        XCTAssertNotNil(object.optInt16Col.value)\n        XCTAssertNotNil(object.optInt32Col.value)\n        XCTAssertNotNil(object.optInt64Col.value)\n        XCTAssertNotNil(object.optBoolCol.value)\n        XCTAssertNotNil(object.optFloatCol.value)\n        XCTAssertNotNil(object.optDoubleCol.value)\n        XCTAssertNotNil(object.optDateCol)\n        XCTAssertNotNil(object.optStringCol)\n        XCTAssertNotNil(object.optNSStringCol)\n        XCTAssertNotNil(object.optBinaryCol)\n        XCTAssertNotNil(object.optObjectCol)\n\n        // Try to switch back to nil\n        let object3 = SwiftOptionalPrimaryObject()\n        realm.add(object3, update: .modified)\n\n        XCTAssertNil(object.id.value)\n        XCTAssertNil(object.optIntCol.value)\n        XCTAssertNil(object.optInt8Col.value)\n        XCTAssertNil(object.optInt16Col.value)\n        XCTAssertNil(object.optInt32Col.value)\n        XCTAssertNil(object.optInt64Col.value)\n        XCTAssertNil(object.optBoolCol.value)\n        XCTAssertNil(object.optFloatCol.value)\n        XCTAssertNil(object.optDoubleCol.value)\n        XCTAssertNil(object.optDateCol)\n        XCTAssertNil(object.optStringCol)\n        XCTAssertNil(object.optNSStringCol)\n        XCTAssertNil(object.optBinaryCol)\n        XCTAssertNil(object.optObjectCol)\n\n        realm.cancelWrite()\n    }\n\n    /// If a Swift class declares generic properties before non-generic ones, the properties\n    /// should be registered in order and creation from an array of values should work.\n    func testProperOrderingOfProperties() {\n        let v: [Any] = [\n            // Superclass's columns\n            [[\"intCol\": 42], [\"intCol\": 9001]],\n            [[\"intCol\": 42], [\"intCol\": 9001]],\n            100,\n            200,\n            // Class's columns\n            1,\n            [[\"stringCol\": \"hello\"], [\"stringCol\": \"world\"]],\n            [[\"stringCol\": \"hello\"], [\"stringCol\": \"world\"]],\n            2,\n            [[\"stringCol\": \"goodbye\"], [\"stringCol\": \"cruel\"], [\"stringCol\": \"world\"]],\n            [[\"stringCol\": \"goodbye\"], [\"stringCol\": \"cruel\"], [\"stringCol\": \"world\"]],\n            NSNull(),\n            3,\n            300]\n        let object = SwiftGenericPropsOrderingObject(value: v)\n        XCTAssertEqual(object.firstNumber, 1)\n        XCTAssertEqual(object.secondNumber, 2)\n        XCTAssertEqual(object.thirdNumber, 3)\n        XCTAssertTrue(object.firstArray.count == 2)\n        XCTAssertEqual(object.firstArray[0].stringCol, \"hello\")\n        XCTAssertEqual(object.firstArray[1].stringCol, \"world\")\n        XCTAssertTrue(object.secondArray.count == 3)\n        XCTAssertEqual(object.secondArray[0].stringCol, \"goodbye\")\n        XCTAssertEqual(object.secondArray[1].stringCol, \"cruel\")\n        XCTAssertEqual(object.secondArray[2].stringCol, \"world\")\n        XCTAssertTrue(object.firstSet.count == 2)\n        assertSetContains(object.firstSet, keyPath: \\.stringCol, items: [\"hello\", \"world\"])\n        XCTAssertTrue(object.secondSet.count == 3)\n        assertSetContains(object.secondSet, keyPath: \\.stringCol, items: [\"goodbye\", \"cruel\", \"world\"])\n        XCTAssertEqual(object.firstOptionalNumber.value, nil)\n        XCTAssertEqual(object.secondOptionalNumber.value, 300)\n        XCTAssertTrue(object.parentFirstList.count == 2)\n        XCTAssertEqual(object.parentFirstList[0].intCol, 42)\n        XCTAssertEqual(object.parentFirstList[1].intCol, 9001)\n        XCTAssertEqual(object.parentFirstNumber, 100)\n        XCTAssertEqual(object.parentSecondNumber, 200)\n        XCTAssertTrue(object.firstLinking.count == 0)\n        XCTAssertTrue(object.secondLinking.count == 0)\n    }\n\n    func testPrivateOptionalNonobjcString() {\n        let realm = try! Realm()\n        try! realm.write {\n            let obj = ObjectWithPrivateOptionals()\n            obj.value = 5\n            realm.add(obj)\n            XCTAssertEqual(realm.objects(ObjectWithPrivateOptionals.self).first!.value, 5)\n        }\n    }\n\n    // MARK: - Private utilities\n    private func verifySwiftObjectWithArrayLiteral(_ object: SwiftObject, array: [Any], boolObjectValue: Bool,\n                                                   boolObjectListValues: [Bool]) {\n        XCTAssertEqual(object.boolCol, (array[0] as! Bool))\n        XCTAssertEqual(object.intCol, (array[1] as! Int))\n        XCTAssertEqual(object.int8Col, (array[2] as! Int8))\n        XCTAssertEqual(object.int16Col, (array[3] as! Int16))\n        XCTAssertEqual(object.int32Col, (array[4] as! Int32))\n        XCTAssertEqual(object.int64Col, (array[5] as! Int64))\n        XCTAssertEqual(object.intEnumCol, IntEnum(rawValue: array[6] as! Int))\n        XCTAssertEqual(object.floatCol, (array[7] as! NSNumber).floatValue)\n        XCTAssertEqual(object.doubleCol, (array[8] as! Double))\n        XCTAssertEqual(object.stringCol, (array[9] as! String))\n        XCTAssertEqual(object.binaryCol, (array[10] as! Data))\n        XCTAssertEqual(object.dateCol, (array[11] as! Date))\n        XCTAssertEqual(object.decimalCol, Decimal128(value: array[12]))\n        XCTAssertEqual(object.objectIdCol, (array[13] as! ObjectId))\n        XCTAssertEqual(object.objectCol!.boolCol, boolObjectValue)\n        XCTAssertEqual(object.arrayCol.count, boolObjectListValues.count)\n        XCTAssertEqual(object.setCol.count, boolObjectListValues.count)\n        for i in 0..<boolObjectListValues.count {\n            XCTAssertEqual(object.arrayCol[i].boolCol, boolObjectListValues[i])\n        }\n        object.setCol.forEach { obj in\n            XCTAssertTrue(boolObjectListValues.contains(obj.boolCol))\n        }\n        for value in object.mapCol.map({ $0.value!.boolCol }) {\n            XCTAssertTrue(boolObjectListValues.contains(value))\n        }\n    }\n\n    private func verifySwiftObjectWithDictionaryLiteral(_ object: SwiftObject, dictionary: [String: Any],\n                                                        boolObjectValue: Bool, boolObjectListValues: [Bool]) {\n        XCTAssertEqual(object.boolCol, (dictionary[\"boolCol\"] as! Bool))\n        XCTAssertEqual(object.intCol, (dictionary[\"intCol\"] as? Int))\n        XCTAssertEqual(object.int8Col, (dictionary[\"int8Col\"] as? Int8))\n        XCTAssertEqual(object.int16Col, (dictionary[\"int16Col\"] as? Int16))\n        XCTAssertEqual(object.int32Col, (dictionary[\"int32Col\"] as? Int32))\n        XCTAssertEqual(object.int64Col, (dictionary[\"int64Col\"] as? Int64))\n        XCTAssertEqual(object.floatCol, (dictionary[\"floatCol\"] as! NSNumber).floatValue)\n        XCTAssertEqual(object.doubleCol, (dictionary[\"doubleCol\"] as! Double))\n        XCTAssertEqual(object.stringCol, (dictionary[\"stringCol\"] as! String))\n        XCTAssertEqual(object.binaryCol, (dictionary[\"binaryCol\"] as! Data))\n        XCTAssertEqual(object.dateCol, (dictionary[\"dateCol\"] as! Date))\n        XCTAssertEqual(object.decimalCol, Decimal128(value: dictionary[\"decimalCol\"]!))\n        XCTAssertEqual(object.objectIdCol, (dictionary[\"objectIdCol\"] as! ObjectId))\n        XCTAssertEqual(object.objectCol!.boolCol, boolObjectValue)\n        XCTAssertEqual(object.arrayCol.count, boolObjectListValues.count)\n        XCTAssertEqual(object.setCol.count, boolObjectListValues.count)\n        XCTAssertEqual(object.mapCol.count, boolObjectListValues.count)\n\n        for i in 0..<boolObjectListValues.count {\n            XCTAssertEqual(object.arrayCol[i].boolCol, boolObjectListValues[i])\n            XCTAssertTrue(boolObjectListValues.contains(object.setCol[i].boolCol))\n        }\n    }\n\n    private func verifySwiftOptionalObjectWithDictionaryLiteral(_ object: SwiftOptionalDefaultValuesObject,\n                                                                dictionary: [String: Any],\n                                                                boolObjectValue: Bool?) {\n        XCTAssertEqual(object.optBoolCol.value, (dictionary[\"optBoolCol\"] as! Bool?))\n        XCTAssertEqual(object.optIntCol.value, (dictionary[\"optIntCol\"] as! Int?))\n        XCTAssertEqual(object.optInt8Col.value,\n                       ((dictionary[\"optInt8Col\"] as! NSNumber?)?.int8Value).map({Int8($0)}))\n        XCTAssertEqual(object.optInt16Col.value,\n                       ((dictionary[\"optInt16Col\"] as! NSNumber?)?.int16Value).map({Int16($0)}))\n        XCTAssertEqual(object.optInt32Col.value,\n            ((dictionary[\"optInt32Col\"] as! NSNumber?)?.int32Value).map({Int32($0)}))\n        XCTAssertEqual(object.optInt64Col.value, (dictionary[\"optInt64Col\"] as! NSNumber?)?.int64Value)\n        XCTAssertEqual(object.optFloatCol.value, (dictionary[\"optFloatCol\"] as! Float?))\n        XCTAssertEqual(object.optDoubleCol.value, (dictionary[\"optDoubleCol\"] as! Double?))\n        XCTAssertEqual(object.optStringCol, (dictionary[\"optStringCol\"] as! String?))\n        XCTAssertEqual(object.optNSStringCol, (dictionary[\"optNSStringCol\"] as! NSString))\n        XCTAssertEqual(object.optBinaryCol, (dictionary[\"optBinaryCol\"] as! Data?))\n        XCTAssertEqual(object.optDateCol, (dictionary[\"optDateCol\"] as! Date?))\n        XCTAssertEqual(object.optDecimalCol, (dictionary[\"optDecimalCol\"] as! Decimal128?))\n        XCTAssertEqual(object.optObjectIdCol, (dictionary[\"optObjectIdCol\"] as! ObjectId?))\n        XCTAssertEqual(object.optObjectCol?.boolCol, boolObjectValue)\n        XCTAssertEqual(object.optUuidCol, (dictionary[\"optUuidCol\"] as! UUID?))\n    }\n\n    private func defaultSwiftObjectValuesWithReplacements(_ replace: [String: Any]) -> [String: Any] {\n        var valueDict = SwiftObject.defaultValues()\n        for (key, value) in replace {\n            valueDict[key] = value\n        }\n        return valueDict\n    }\n\n    // return an array of valid values that can be used to initialize each type\n    private func validValuesForSwiftObjectType(_ type: PropertyType, _ array: Bool, _ map: Bool) -> [Any] {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let persistedObject = realm.create(SwiftBoolObject.self, value: [true])\n        try! realm.commitWrite()\n        if map {\n            return [\n                [\"trueVal\": [\"boolCol\": true], \"falseVal\": [\"boolCol\": false]],\n                [\"trueVal\": SwiftBoolObject(value: [true]), \"falseVal\": SwiftBoolObject(value: [false])],\n                [\"trueVal\": persistedObject, \"falseVal\": [false]] as [String: Any]\n            ]\n        }\n        if array {\n            return [\n                [[true], [false]],\n                [[\"boolCol\": true], [\"boolCol\": false]],\n                [SwiftBoolObject(value: [true]), SwiftBoolObject(value: [false])],\n                [persistedObject, [false]] as [Any]\n            ]\n        }\n        switch type {\n        case .bool:     return [true, NSNumber(value: 0 as Int), NSNumber(value: 1 as Int)]\n        case .int:      return [NSNumber(value: 1 as Int)]\n        case .float:    return [NSNumber(value: 1 as Int), NSNumber(value: 1.1 as Float), NSNumber(value: 11.1 as Double)]\n        case .double:   return [NSNumber(value: 1 as Int), NSNumber(value: 1.1 as Float), NSNumber(value: 11.1 as Double)]\n        case .string:   return [\"b\"]\n        case .data:     return [\"b\".data(using: String.Encoding.utf8, allowLossyConversion: false)!]\n        case .date:     return [Date(timeIntervalSince1970: 2)]\n        case .object:   return [[true], [\"boolCol\": true], SwiftBoolObject(value: [true]), persistedObject]\n        case .objectId: return [ObjectId(\"1234567890ab1234567890ab\")]\n        case .decimal128: return [1, \"2\", Decimal128(number: 3)]\n        case .any:      return [\"hello\"]\n        case .linkingObjects: fatalError(\"not supported\")\n        case .UUID: return [UUID(uuidString: \"137decc8-b300-4954-a233-f89909f4fd89\")!, UUID(uuidString: \"00000000-0000-0000-0000-000000000000\")!]\n        default:\n            fatalError()\n        }\n    }\n\n    private func invalidValuesForSwiftObjectType(_ type: PropertyType, _ array: Bool, _ map: Bool) -> [Any] {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let persistedObject = realm.create(SwiftIntObject.self)\n        try! realm.commitWrite()\n        if map {\n            return [\n                [\"trueVal\": [\"boolCol\": \"invalid\"] as [String: Any], \"falseVal\": [\"boolCol\": false]],\n                [\"trueVal\": \"invalid\", \"falseVal\": SwiftBoolObject(value: [false])] as [String: Any]\n            ]\n        }\n        if array {\n            return [\"invalid\", [[\"a\"]], [[\"boolCol\": \"a\"]], [[SwiftIntObject()]], [[persistedObject]]]\n        }\n        switch type {\n        case .bool:     return [\"invalid\", NSNumber(value: 2 as Int), NSNumber(value: 1.1 as Float), NSNumber(value: 11.1 as Double)]\n        case .int:      return [\"invalid\", NSNumber(value: 1.1 as Float), NSNumber(value: 11.1 as Double)]\n        case .float:    return [\"invalid\", true, false]\n        case .double:   return [\"invalid\", true, false]\n        case .string:   return [0x197A71D, true, false]\n        case .data:     return [\"invalid\"]\n        case .date:     return [\"invalid\"]\n        case .object:   return [\"invalid\", [\"a\"], [\"boolCol\": \"a\"], SwiftIntObject()]\n        case .objectId: return [\"invalid\", 123]\n        case .decimal128: return [\"invalid\"]\n        case .any: return [MutableSet<String>()]\n        case .linkingObjects: fatalError(\"not supported\")\n        case .UUID: return [\"invalid\"]\n        default:\n            fatalError()\n        }\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/ObjectCustomPropertiesTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2024 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport Realm\n@_spi(RealmSwiftPrivate) import RealmSwift\n\nfinal class ObjectCustomPropertiesTests: TestCase {\n    override func tearDown() {\n        super.tearDown()\n        CustomPropertiesObject.injected_customRealmProperties = nil\n    }\n\n    func testCustomProperties() throws {\n        CustomPropertiesObject.injected_customRealmProperties = [CustomPropertiesObject.preMadeRLMProperty]\n\n        let customProperties = try XCTUnwrap(CustomPropertiesObject._customRealmProperties())\n        XCTAssertEqual(customProperties.count, 1)\n        XCTAssert(customProperties.first === CustomPropertiesObject.preMadeRLMProperty)\n\n        // Assert properties are custom properties\n        let properties = CustomPropertiesObject._getProperties()\n        XCTAssertEqual(properties.count, 1)\n        XCTAssert(properties.first === CustomPropertiesObject.preMadeRLMProperty)\n    }\n\n    func testNoCustomProperties() {\n        CustomPropertiesObject.injected_customRealmProperties = nil\n\n        let customProperties = CustomPropertiesObject._customRealmProperties()\n        XCTAssertNil(customProperties)\n\n        // Assert properties are generated despite `nil` custom properties\n        let properties = CustomPropertiesObject._getProperties()\n        XCTAssertEqual(properties.count, 1)\n        XCTAssert(properties.first !== CustomPropertiesObject.preMadeRLMProperty)\n    }\n\n    func testEmptyCustomProperties() throws {\n        CustomPropertiesObject.injected_customRealmProperties = []\n\n        let customProperties = try XCTUnwrap(CustomPropertiesObject._customRealmProperties())\n        XCTAssertEqual(customProperties.count, 0)\n\n        // Assert properties are custom properties (rather incorrectly)\n        let properties = CustomPropertiesObject._getProperties()\n        XCTAssertEqual(properties.count, 0)\n    }\n}\n\n@objc(CustomPropertiesObject)\nprivate final class CustomPropertiesObject: Object {\n    @Persisted var value: String\n\n    static override func _customRealmProperties() -> [RLMProperty]? {\n        return injected_customRealmProperties\n    }\n\n    static nonisolated(unsafe) var injected_customRealmProperties: [RLMProperty]?\n    static let preMadeRLMProperty = RLMProperty(name: \"value\", objectType: CustomPropertiesObject.self, valueType: String.self)\n}\n"
  },
  {
    "path": "RealmSwift/Tests/ObjectIdTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\nclass ObjectIdTests: TestCase {\n\n    func testObjectIdInitialization() {\n        let strValue = \"000123450000ffbeef91906c\"\n        let objectId = try! ObjectId(string: strValue)\n        XCTAssertEqual(objectId.stringValue, strValue)\n        XCTAssertEqual(strValue, objectId.stringValue)\n\n        let now = Date()\n        let objectId2 = ObjectId(timestamp: now, machineId: 10, processId: 20)\n        XCTAssertEqual(Int(now.timeIntervalSince1970), Int(objectId2.timestamp.timeIntervalSince1970))\n    }\n\n    func testObjectIdComparision() {\n        let strValue = \"000123450000ffbeef91906c\"\n        let objectId = try! ObjectId(string: strValue)\n\n        let strValue2 = \"000123450000ffbeef91906d\"\n        let objectId2 = try! ObjectId(string: strValue2)\n\n        let strValue3 = \"000123450000ffbeef91906c\"\n        let objectId3 = try! ObjectId(string: strValue3)\n\n        XCTAssertTrue(objectId != objectId2)\n        XCTAssertTrue(objectId == objectId3)\n    }\n\n    func testObjectIdGreaterThan() {\n        let strValue = \"000123450000ffbeef91906c\"\n        let objectId = try! ObjectId(string: strValue)\n\n        let strValue2 = \"000123450000ffbeef91906d\"\n        let objectId2 = try! ObjectId(string: strValue2)\n\n        let strValue3 = \"000123450000ffbeef91906c\"\n        let objectId3 = try! ObjectId(string: strValue3)\n\n        XCTAssertTrue(objectId2 > objectId)\n        XCTAssertFalse(objectId > objectId3)\n    }\n\n    func testObjectIdGreaterThanOrEqualTo() {\n        let strValue = \"000123450000ffbeef91906c\"\n        let objectId = try! ObjectId(string: strValue)\n\n        let strValue2 = \"000123450000ffbeef91906d\"\n        let objectId2 = try! ObjectId(string: strValue2)\n\n        let strValue3 = \"000123450000ffbeef91906c\"\n        let objectId3 = try! ObjectId(string: strValue3)\n\n        XCTAssertTrue(objectId2 >= objectId)\n        XCTAssertTrue(objectId >= objectId3)\n    }\n\n    func testObjectIdLessThan() {\n        let strValue = \"000123450000ffbeef91906c\"\n        let objectId = try! ObjectId(string: strValue)\n\n        let strValue2 = \"000123450000ffbeef91906d\"\n        let objectId2 = try! ObjectId(string: strValue2)\n\n        let strValue3 = \"000123450000ffbeef91906c\"\n        let objectId3 = try! ObjectId(string: strValue3)\n\n        XCTAssertTrue(objectId < objectId2)\n        XCTAssertFalse(objectId < objectId3)\n    }\n\n    func testObjectIdLessThanOrEqualTo() {\n        let strValue = \"000123450000ffbeef91906c\"\n        let objectId = try! ObjectId(string: strValue)\n\n        let strValue2 = \"000123450000ffbeef91906d\"\n        let objectId2 = try! ObjectId(string: strValue2)\n\n        let strValue3 = \"000123450000ffbeef91906c\"\n        let objectId3 = try! ObjectId(string: strValue3)\n\n        XCTAssertTrue(objectId <= objectId2)\n        XCTAssertTrue(objectId <= objectId3)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/ObjectSchemaInitializationTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport Realm.Private\nimport Realm.Dynamic\nimport Foundation\n\n#if DEBUG\n    @testable import RealmSwift\n#else\n    import RealmSwift\n#endif\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass ObjectSchemaInitializationTests: TestCase {\n    func testAllValidTypes() {\n        let object = SwiftObject()\n        let objectSchema = object.objectSchema\n\n        let noSuchCol = objectSchema[\"noSuchCol\"]\n        XCTAssertNil(noSuchCol)\n\n        let boolCol = objectSchema[\"boolCol\"]\n        XCTAssertNotNil(boolCol)\n        XCTAssertEqual(boolCol!.name, \"boolCol\")\n        XCTAssertEqual(boolCol!.type, PropertyType.bool)\n        XCTAssertFalse(boolCol!.isIndexed)\n        XCTAssertFalse(boolCol!.isOptional)\n        XCTAssertNil(boolCol!.objectClassName)\n\n        let intCol = objectSchema[\"intCol\"]\n        XCTAssertNotNil(intCol)\n        XCTAssertEqual(intCol!.name, \"intCol\")\n        XCTAssertEqual(intCol!.type, PropertyType.int)\n        XCTAssertFalse(intCol!.isIndexed)\n        XCTAssertFalse(intCol!.isOptional)\n        XCTAssertNil(intCol!.objectClassName)\n\n        let floatCol = objectSchema[\"floatCol\"]\n        XCTAssertNotNil(floatCol)\n        XCTAssertEqual(floatCol!.name, \"floatCol\")\n        XCTAssertEqual(floatCol!.type, PropertyType.float)\n        XCTAssertFalse(floatCol!.isIndexed)\n        XCTAssertFalse(floatCol!.isOptional)\n        XCTAssertNil(floatCol!.objectClassName)\n\n        let doubleCol = objectSchema[\"doubleCol\"]\n        XCTAssertNotNil(doubleCol)\n        XCTAssertEqual(doubleCol!.name, \"doubleCol\")\n        XCTAssertEqual(doubleCol!.type, PropertyType.double)\n        XCTAssertFalse(doubleCol!.isIndexed)\n        XCTAssertFalse(doubleCol!.isOptional)\n        XCTAssertNil(doubleCol!.objectClassName)\n\n        let stringCol = objectSchema[\"stringCol\"]\n        XCTAssertNotNil(stringCol)\n        XCTAssertEqual(stringCol!.name, \"stringCol\")\n        XCTAssertEqual(stringCol!.type, PropertyType.string)\n        XCTAssertFalse(stringCol!.isIndexed)\n        XCTAssertFalse(stringCol!.isOptional)\n        XCTAssertNil(stringCol!.objectClassName)\n\n        let binaryCol = objectSchema[\"binaryCol\"]\n        XCTAssertNotNil(binaryCol)\n        XCTAssertEqual(binaryCol!.name, \"binaryCol\")\n        XCTAssertEqual(binaryCol!.type, PropertyType.data)\n        XCTAssertFalse(binaryCol!.isIndexed)\n        XCTAssertFalse(binaryCol!.isOptional)\n        XCTAssertNil(binaryCol!.objectClassName)\n\n        let dateCol = objectSchema[\"dateCol\"]\n        XCTAssertNotNil(dateCol)\n        XCTAssertEqual(dateCol!.name, \"dateCol\")\n        XCTAssertEqual(dateCol!.type, PropertyType.date)\n        XCTAssertFalse(dateCol!.isIndexed)\n        XCTAssertFalse(dateCol!.isOptional)\n        XCTAssertNil(dateCol!.objectClassName)\n\n        let uuidCol = objectSchema[\"uuidCol\"]\n        XCTAssertNotNil(uuidCol)\n        XCTAssertEqual(uuidCol!.name, \"uuidCol\")\n        XCTAssertEqual(uuidCol!.type, PropertyType.UUID)\n        XCTAssertFalse(uuidCol!.isIndexed)\n        XCTAssertFalse(uuidCol!.isOptional)\n        XCTAssertNil(uuidCol!.objectClassName)\n\n        let anyCol = objectSchema[\"anyCol\"]\n        XCTAssertNotNil(anyCol)\n        XCTAssertEqual(anyCol!.name, \"anyCol\")\n        XCTAssertEqual(anyCol!.type, PropertyType.any)\n        XCTAssertFalse(anyCol!.isIndexed)\n        XCTAssertFalse(anyCol!.isOptional)\n        XCTAssertNil(anyCol!.objectClassName)\n\n        let objectCol = objectSchema[\"objectCol\"]\n        XCTAssertNotNil(objectCol)\n        XCTAssertEqual(objectCol!.name, \"objectCol\")\n        XCTAssertEqual(objectCol!.type, PropertyType.object)\n        XCTAssertFalse(objectCol!.isIndexed)\n        XCTAssertTrue(objectCol!.isOptional)\n        XCTAssertEqual(objectCol!.objectClassName!, \"SwiftBoolObject\")\n\n        let arrayCol = objectSchema[\"arrayCol\"]\n        XCTAssertNotNil(arrayCol)\n        XCTAssertEqual(arrayCol!.name, \"arrayCol\")\n        XCTAssertEqual(arrayCol!.type, PropertyType.object)\n        XCTAssertTrue(arrayCol!.isArray)\n        XCTAssertFalse(arrayCol!.isIndexed)\n        XCTAssertFalse(arrayCol!.isOptional)\n        XCTAssertEqual(objectCol!.objectClassName!, \"SwiftBoolObject\")\n\n        let setCol = objectSchema[\"setCol\"]\n        XCTAssertNotNil(setCol)\n        XCTAssertEqual(setCol!.name, \"setCol\")\n        XCTAssertEqual(setCol!.type, PropertyType.object)\n        XCTAssertTrue(setCol!.isSet)\n        XCTAssertFalse(setCol!.isIndexed)\n        XCTAssertFalse(setCol!.isOptional)\n        XCTAssertEqual(setCol!.objectClassName!, \"SwiftBoolObject\")\n\n        let dynamicArrayCol = SwiftCompanyObject().objectSchema[\"employees\"]\n        XCTAssertNotNil(dynamicArrayCol)\n        XCTAssertEqual(dynamicArrayCol!.name, \"employees\")\n        XCTAssertEqual(dynamicArrayCol!.type, PropertyType.object)\n        XCTAssertTrue(dynamicArrayCol!.isArray)\n        XCTAssertFalse(dynamicArrayCol!.isIndexed)\n        XCTAssertFalse(dynamicArrayCol!.isOptional)\n        XCTAssertEqual(dynamicArrayCol!.objectClassName!, \"SwiftEmployeeObject\")\n\n        let dynamicSetCol = SwiftCompanyObject().objectSchema[\"employeeSet\"]\n        XCTAssertNotNil(dynamicSetCol)\n        XCTAssertEqual(dynamicSetCol!.name, \"employeeSet\")\n        XCTAssertEqual(dynamicSetCol!.type, PropertyType.object)\n        XCTAssertTrue(dynamicSetCol!.isSet)\n        XCTAssertFalse(dynamicSetCol!.isIndexed)\n        XCTAssertFalse(dynamicSetCol!.isOptional)\n        XCTAssertEqual(dynamicSetCol!.objectClassName!, \"SwiftEmployeeObject\")\n    }\n\n    func testInvalidObjects() {\n        let schema = SwiftFakeObjectSubclass.sharedSchema()!\n        XCTAssertEqual(schema.properties.count, 2)\n\n        assertThrows(RLMObjectSchema(forObjectClass: SwiftObjectWithAnyObject.self),\n                     reason: \"Property SwiftObjectWithAnyObject.anyObject is declared as NSObject\")\n        assertThrows(RLMObjectSchema(forObjectClass: SwiftObjectWithStringArray.self),\n                     reason: \"Property SwiftObjectWithStringArray.stringArray is declared as Array<String>\")\n        assertThrows(RLMObjectSchema(forObjectClass: SwiftObjectWithOptionalStringArray.self),\n                     reason: \"Property SwiftObjectWithOptionalStringArray.stringArray is declared as Optional<Array<String>>\")\n        assertThrows(RLMObjectSchema(forObjectClass: SwiftObjectWithBadPropertyName.self),\n                     reason: \"Property names beginning with 'new' are not supported.\")\n        assertThrows(RLMObjectSchema(forObjectClass: SwiftObjectWithManagedLazyProperty.self),\n                     reason: \"Lazy managed property 'foobar' is not allowed on a Realm Swift object class.\")\n        assertThrows(RLMObjectSchema(forObjectClass: SwiftObjectWithDynamicManagedLazyProperty.self),\n                     reason: \"Lazy managed property 'foobar' is not allowed on a Realm Swift object class.\")\n\n        // Shouldn't throw when not ignoring a property of a type we can't persist if it's not dynamic\n        _ = RLMObjectSchema(forObjectClass: SwiftObjectWithEnum.self)\n        // Shouldn't throw when not ignoring a property of a type we can't persist if it's not dynamic\n        _ = RLMObjectSchema(forObjectClass: SwiftObjectWithStruct.self)\n\n        assertThrows(RLMObjectSchema(forObjectClass: SwiftObjectWithDatePrimaryKey.self),\n                     reason: \"Property 'date' cannot be made the primary key of 'SwiftObjectWithDatePrimaryKey'\")\n        assertThrows(RLMObjectSchema(forObjectClass: SwiftObjectWithNSURL.self),\n                     reason: \"Property SwiftObjectWithNSURL.url is declared as NSURL\")\n        assertThrows(RLMObjectSchema(forObjectClass: SwiftObjectWithNonOptionalLinkProperty.self),\n                     reason: \"Object property 'objectCol' must be marked as optional.\")\n    }\n\n    func testPrimaryKey() {\n        XCTAssertNil(SwiftObject().objectSchema.primaryKeyProperty,\n            \"Object should default to having no primary key property\")\n        XCTAssertEqual(SwiftPrimaryStringObject().objectSchema.primaryKeyProperty!.name, \"stringCol\")\n    }\n\n    func testIgnoredProperties() {\n        let schema = SwiftIgnoredPropertiesObject().objectSchema\n        XCTAssertNil(schema[\"runtimeProperty\"], \"The object schema shouldn't contain ignored properties\")\n        XCTAssertNil(schema[\"runtimeDefaultProperty\"], \"The object schema shouldn't contain ignored properties\")\n        XCTAssertNil(schema[\"readOnlyProperty\"], \"The object schema shouldn't contain read-only properties\")\n    }\n\n    func testIndexedProperties() {\n        XCTAssertTrue(SwiftIndexedPropertiesObject().objectSchema[\"stringCol\"]!.isIndexed)\n        XCTAssertTrue(SwiftIndexedPropertiesObject().objectSchema[\"intCol\"]!.isIndexed)\n        XCTAssertTrue(SwiftIndexedPropertiesObject().objectSchema[\"int8Col\"]!.isIndexed)\n        XCTAssertTrue(SwiftIndexedPropertiesObject().objectSchema[\"int16Col\"]!.isIndexed)\n        XCTAssertTrue(SwiftIndexedPropertiesObject().objectSchema[\"int32Col\"]!.isIndexed)\n        XCTAssertTrue(SwiftIndexedPropertiesObject().objectSchema[\"int64Col\"]!.isIndexed)\n        XCTAssertTrue(SwiftIndexedPropertiesObject().objectSchema[\"boolCol\"]!.isIndexed)\n        XCTAssertTrue(SwiftIndexedPropertiesObject().objectSchema[\"dateCol\"]!.isIndexed)\n\n        XCTAssertFalse(SwiftIndexedPropertiesObject().objectSchema[\"floatCol\"]!.isIndexed)\n        XCTAssertFalse(SwiftIndexedPropertiesObject().objectSchema[\"doubleCol\"]!.isIndexed)\n        XCTAssertFalse(SwiftIndexedPropertiesObject().objectSchema[\"dataCol\"]!.isIndexed)\n    }\n\n    func testOptionalProperties() {\n        let schema = RLMObjectSchema(forObjectClass: SwiftOptionalObject.self)\n\n        for prop in schema.properties {\n            XCTAssertTrue(prop.optional)\n        }\n\n        let types = Set(schema.properties.map { $0.type })\n        XCTAssertEqual(types, Set([.string, .string, .data, .date, .object, .int,\n                                   .float, .double, .bool, .decimal128, .objectId, .UUID]))\n    }\n\n    func testImplicitlyUnwrappedOptionalsAreParsedAsOptionals() {\n        let schema = SwiftImplicitlyUnwrappedOptionalObject().objectSchema\n        XCTAssertTrue(schema[\"optObjectCol\"]!.isOptional)\n        XCTAssertTrue(schema[\"optNSStringCol\"]!.isOptional)\n        XCTAssertTrue(schema[\"optStringCol\"]!.isOptional)\n        XCTAssertTrue(schema[\"optBinaryCol\"]!.isOptional)\n        XCTAssertTrue(schema[\"optDateCol\"]!.isOptional)\n        XCTAssertTrue(schema[\"optDecimalCol\"]!.isOptional)\n        XCTAssertTrue(schema[\"optObjectIdCol\"]!.isOptional)\n        XCTAssertTrue(schema[\"optUuidCol\"]!.isOptional)\n    }\n\n    func testNonRealmOptionalTypesDeclaredAsRealmOptional() {\n        assertThrows(RLMObjectSchema(forObjectClass: SwiftObjectWithNonRealmOptionalType.self))\n    }\n\n    func testNotExplicitlyIgnoredComputedProperties() {\n        let schema = SwiftComputedPropertyNotIgnoredObject().objectSchema\n        // The two computed properties should not appear on the schema.\n        XCTAssertEqual(schema.properties.count, 1)\n        XCTAssertNotNil(schema[\"_urlBacking\"])\n    }\n\n    func testMultiplePrimaryKeys() {\n        assertThrows(RLMObjectSchema(forObjectClass: SwiftObjectWithMultiplePrimaryKeys.self),\n                     reason: \"Properties 'pk2' and 'pk1' are both marked as the primary key of 'SwiftObjectWithMultiplePrimaryKeys'\")\n    }\n\n    func testModernIndexableTypes() {\n        let indexed = ModernAllIndexableTypesObject().objectSchema\n        for property in indexed.properties {\n            XCTAssertTrue(property.isIndexed)\n        }\n        let notIndexed = ModernAllIndexableButNotIndexedObject().objectSchema\n        for property in notIndexed.properties {\n            XCTAssertFalse(property.isIndexed)\n        }\n    }\n\n    func testCustomIndexableTypes() {\n        let indexed = CustomAllIndexableTypesObject().objectSchema\n        for property in indexed.properties {\n            XCTAssertTrue(property.isIndexed)\n        }\n        let notIndexed = CustomAllIndexableButNotIndexedObject().objectSchema\n        for property in notIndexed.properties {\n            XCTAssertFalse(property.isIndexed)\n        }\n    }\n\n    #if DEBUG // this test depends on @testable import\n    func assertType<T: SchemaDiscoverable>(_ value: T, _ propertyType: PropertyType,\n                                           optional: Bool = false, list: Bool = false,\n                                           set: Bool = false, objectType: String? = nil,\n                                           hasSelectors: Bool = true, line: UInt = #line) {\n        let prop = RLMProperty(name: \"property\", value: value)\n        XCTAssertEqual(prop.type, propertyType, line: line)\n        XCTAssertEqual(prop.optional, optional, line: line)\n        XCTAssertEqual(prop.array, list, line: line)\n        XCTAssertEqual(prop.set, set, line: line)\n        XCTAssertEqual(prop.objectClassName, objectType, line: line)\n\n        if hasSelectors {\n            XCTAssertNotNil(prop.getterSel, line: line)\n            XCTAssertNotNil(prop.setterSel, line: line)\n        } else {\n            XCTAssertNil(prop.getterSel, line: line)\n            XCTAssertNil(prop.setterSel, line: line)\n        }\n    }\n\n    func testPropertyPopulation() {\n        assertType(Int(), .int)\n        assertType(Int8(), .int)\n        assertType(Int16(), .int)\n        assertType(Int32(), .int)\n        assertType(Int64(), .int)\n        assertType(Bool(), .bool)\n        assertType(Float(), .float)\n        assertType(Double(), .double)\n        assertType(String(), .string)\n        assertType(Data(), .data)\n        assertType(Date(), .date)\n        assertType(UUID(), .UUID)\n        assertType(Decimal128(), .decimal128)\n        assertType(ObjectId(), .objectId)\n\n        assertType(Optional<Int>.none, .int, optional: true)\n        assertType(Optional<Int8>.none, .int, optional: true)\n        assertType(Optional<Int16>.none, .int, optional: true)\n        assertType(Optional<Int32>.none, .int, optional: true)\n        assertType(Optional<Int64>.none, .int, optional: true)\n        assertType(Optional<Bool>.none, .bool, optional: true)\n        assertType(Optional<Float>.none, .float, optional: true)\n        assertType(Optional<Double>.none, .double, optional: true)\n        assertType(Optional<String>.none, .string, optional: true)\n        assertType(Optional<Data>.none, .data, optional: true)\n        assertType(Optional<Date>.none, .date, optional: true)\n        assertType(Optional<UUID>.none, .UUID, optional: true)\n        assertType(Optional<Decimal128>.none, .decimal128, optional: true)\n        assertType(Optional<ObjectId>.none, .objectId, optional: true)\n\n        assertType(RealmProperty<Int?>(), .int, optional: true, hasSelectors: false)\n        assertType(RealmProperty<Int8?>(), .int, optional: true, hasSelectors: false)\n        assertType(RealmProperty<Int16?>(), .int, optional: true, hasSelectors: false)\n        assertType(RealmProperty<Int32?>(), .int, optional: true, hasSelectors: false)\n        assertType(RealmProperty<Int64?>(), .int, optional: true, hasSelectors: false)\n        assertType(RealmProperty<Bool?>(), .bool, optional: true, hasSelectors: false)\n        assertType(RealmProperty<Float?>(), .float, optional: true, hasSelectors: false)\n        assertType(RealmProperty<Double?>(), .double, optional: true, hasSelectors: false)\n\n        assertType(List<Int>(), .int, list: true, hasSelectors: false)\n        assertType(List<Int8>(), .int, list: true, hasSelectors: false)\n        assertType(List<Int16>(), .int, list: true, hasSelectors: false)\n        assertType(List<Int32>(), .int, list: true, hasSelectors: false)\n        assertType(List<Int64>(), .int, list: true, hasSelectors: false)\n        assertType(List<Bool>(), .bool, list: true, hasSelectors: false)\n        assertType(List<Float>(), .float, list: true, hasSelectors: false)\n        assertType(List<Double>(), .double, list: true, hasSelectors: false)\n        assertType(List<String>(), .string, list: true, hasSelectors: false)\n        assertType(List<Data>(), .data, list: true, hasSelectors: false)\n        assertType(List<Date>(), .date, list: true, hasSelectors: false)\n        assertType(List<UUID>(), .UUID, list: true, hasSelectors: false)\n        assertType(List<Decimal128>(), .decimal128, list: true, hasSelectors: false)\n        assertType(List<ObjectId>(), .objectId, list: true, hasSelectors: false)\n\n        assertType(List<Int?>(), .int, optional: true, list: true, hasSelectors: false)\n        assertType(List<Int8?>(), .int, optional: true, list: true, hasSelectors: false)\n        assertType(List<Int16?>(), .int, optional: true, list: true, hasSelectors: false)\n        assertType(List<Int32?>(), .int, optional: true, list: true, hasSelectors: false)\n        assertType(List<Int64?>(), .int, optional: true, list: true, hasSelectors: false)\n        assertType(List<Bool?>(), .bool, optional: true, list: true, hasSelectors: false)\n        assertType(List<Float?>(), .float, optional: true, list: true, hasSelectors: false)\n        assertType(List<Double?>(), .double, optional: true, list: true, hasSelectors: false)\n        assertType(List<String?>(), .string, optional: true, list: true, hasSelectors: false)\n        assertType(List<Data?>(), .data, optional: true, list: true, hasSelectors: false)\n        assertType(List<Date?>(), .date, optional: true, list: true, hasSelectors: false)\n        assertType(List<UUID?>(), .UUID, optional: true, list: true, hasSelectors: false)\n        assertType(List<Decimal128?>(), .decimal128, optional: true, list: true, hasSelectors: false)\n        assertType(List<ObjectId?>(), .objectId, optional: true, list: true, hasSelectors: false)\n\n        assertType(MutableSet<Int>(), .int, set: true, hasSelectors: false)\n        assertType(MutableSet<Int8>(), .int, set: true, hasSelectors: false)\n        assertType(MutableSet<Int16>(), .int, set: true, hasSelectors: false)\n        assertType(MutableSet<Int32>(), .int, set: true, hasSelectors: false)\n        assertType(MutableSet<Int64>(), .int, set: true, hasSelectors: false)\n        assertType(MutableSet<Bool>(), .bool, set: true, hasSelectors: false)\n        assertType(MutableSet<Float>(), .float, set: true, hasSelectors: false)\n        assertType(MutableSet<Double>(), .double, set: true, hasSelectors: false)\n        assertType(MutableSet<String>(), .string, set: true, hasSelectors: false)\n        assertType(MutableSet<Data>(), .data, set: true, hasSelectors: false)\n        assertType(MutableSet<Date>(), .date, set: true, hasSelectors: false)\n        assertType(MutableSet<UUID>(), .UUID, set: true, hasSelectors: false)\n        assertType(MutableSet<Decimal128>(), .decimal128, set: true, hasSelectors: false)\n        assertType(MutableSet<ObjectId>(), .objectId, set: true, hasSelectors: false)\n\n        assertType(MutableSet<Int?>(), .int, optional: true, set: true, hasSelectors: false)\n        assertType(MutableSet<Int8?>(), .int, optional: true, set: true, hasSelectors: false)\n        assertType(MutableSet<Int16?>(), .int, optional: true, set: true, hasSelectors: false)\n        assertType(MutableSet<Int32?>(), .int, optional: true, set: true, hasSelectors: false)\n        assertType(MutableSet<Int64?>(), .int, optional: true, set: true, hasSelectors: false)\n        assertType(MutableSet<Bool?>(), .bool, optional: true, set: true, hasSelectors: false)\n        assertType(MutableSet<Float?>(), .float, optional: true, set: true, hasSelectors: false)\n        assertType(MutableSet<Double?>(), .double, optional: true, set: true, hasSelectors: false)\n        assertType(MutableSet<String?>(), .string, optional: true, set: true, hasSelectors: false)\n        assertType(MutableSet<Data?>(), .data, optional: true, set: true, hasSelectors: false)\n        assertType(MutableSet<Date?>(), .date, optional: true, set: true, hasSelectors: false)\n        assertType(MutableSet<UUID?>(), .UUID, optional: true, set: true, hasSelectors: false)\n        assertType(MutableSet<Decimal128?>(), .decimal128, optional: true, set: true, hasSelectors: false)\n        assertType(MutableSet<ObjectId?>(), .objectId, optional: true, set: true, hasSelectors: false)\n\n        assertThrows(RLMProperty(name: \"name\", value: Object()),\n                     reason: \"Object property 'name' must be marked as optional.\")\n        assertThrows(RLMProperty(name: \"name\", value: List<Object?>()),\n                     reason: \"List<RealmSwiftObject> property 'name' must not be marked as optional.\")\n        assertThrows(RLMProperty(name: \"name\", value: MutableSet<Object?>()),\n                     reason: \"MutableSet<RealmSwiftObject> property 'name' must not be marked as optional.\")\n        assertType(Object?.none, .object, optional: true, objectType: \"RealmSwiftObject\")\n        assertType(List<Object>(), .object, list: true, objectType: \"RealmSwiftObject\", hasSelectors: false)\n        assertType(MutableSet<Object>(), .object, set: true, objectType: \"RealmSwiftObject\", hasSelectors: false)\n    }\n\n    func assertType<T: _Persistable>(_ type: T.Type, _ propertyType: PropertyType,\n                                     optional: Bool = false, list: Bool = false,\n                                     set: Bool = false, map: Bool = false,\n                                     objectType: String? = nil, line: UInt = #line) {\n        let prop = RLMProperty(name: \"_property\", value: Persisted<T>())\n        XCTAssertEqual(prop.name, \"property\", line: line)\n        XCTAssertEqual(prop.type, propertyType, line: line)\n        XCTAssertEqual(prop.optional, optional, line: line)\n        XCTAssertEqual(prop.array, list, line: line)\n        XCTAssertEqual(prop.set, set, line: line)\n        XCTAssertEqual(prop.dictionary, map, line: line)\n        XCTAssertEqual(prop.objectClassName, objectType, line: line)\n        XCTAssertNil(prop.getterSel, line: line)\n        XCTAssertNil(prop.setterSel, line: line)\n    }\n\n    func testModernPropertyPopulation() {\n        assertType(Int.self, .int)\n        assertType(Int8.self, .int)\n        assertType(Int16.self, .int)\n        assertType(Int32.self, .int)\n        assertType(Int64.self, .int)\n        assertType(Bool.self, .bool)\n        assertType(Float.self, .float)\n        assertType(Double.self, .double)\n        assertType(String.self, .string)\n        assertType(Data.self, .data)\n        assertType(Date.self, .date)\n        assertType(UUID.self, .UUID)\n        assertType(Decimal128.self, .decimal128)\n        assertType(ObjectId.self, .objectId)\n        assertType(AnyRealmValue.self, .any)\n        assertType(ModernIntEnum.self, .int)\n        assertType(ModernStringEnum.self, .string)\n\n        assertType(Int?.self, .int, optional: true)\n        assertType(Int8?.self, .int, optional: true)\n        assertType(Int16?.self, .int, optional: true)\n        assertType(Int32?.self, .int, optional: true)\n        assertType(Int64?.self, .int, optional: true)\n        assertType(Bool?.self, .bool, optional: true)\n        assertType(Float?.self, .float, optional: true)\n        assertType(Double?.self, .double, optional: true)\n        assertType(String?.self, .string, optional: true)\n        assertType(Data?.self, .data, optional: true)\n        assertType(Date?.self, .date, optional: true)\n        assertType(UUID?.self, .UUID, optional: true)\n        assertType(Decimal128?.self, .decimal128, optional: true)\n        assertType(ObjectId?.self, .objectId, optional: true)\n        assertType(Object?.self, .object, optional: true, objectType: \"RealmSwiftObject\")\n        assertType(EmbeddedObject?.self, .object, optional: true, objectType: \"RealmSwiftEmbeddedObject\")\n        assertType(ModernIntEnum?.self, .int, optional: true)\n        assertType(ModernStringEnum?.self, .string, optional: true)\n\n        assertType(List<Int>.self, .int, list: true)\n        assertType(List<Int8>.self, .int, list: true)\n        assertType(List<Int16>.self, .int, list: true)\n        assertType(List<Int32>.self, .int, list: true)\n        assertType(List<Int64>.self, .int, list: true)\n        assertType(List<Bool>.self, .bool, list: true)\n        assertType(List<Float>.self, .float, list: true)\n        assertType(List<Double>.self, .double, list: true)\n        assertType(List<String>.self, .string, list: true)\n        assertType(List<Data>.self, .data, list: true)\n        assertType(List<Date>.self, .date, list: true)\n        assertType(List<UUID>.self, .UUID, list: true)\n        assertType(List<Decimal128>.self, .decimal128, list: true)\n        assertType(List<ObjectId>.self, .objectId, list: true)\n        assertType(List<AnyRealmValue>.self, .any, list: true)\n        assertType(List<Object>.self, .object, list: true, objectType: \"RealmSwiftObject\")\n        assertType(List<EmbeddedObject>.self, .object, list: true, objectType: \"RealmSwiftEmbeddedObject\")\n\n        assertType(List<Int?>.self, .int, optional: true, list: true)\n        assertType(List<Int8?>.self, .int, optional: true, list: true)\n        assertType(List<Int16?>.self, .int, optional: true, list: true)\n        assertType(List<Int32?>.self, .int, optional: true, list: true)\n        assertType(List<Int64?>.self, .int, optional: true, list: true)\n        assertType(List<Bool?>.self, .bool, optional: true, list: true)\n        assertType(List<Float?>.self, .float, optional: true, list: true)\n        assertType(List<Double?>.self, .double, optional: true, list: true)\n        assertType(List<String?>.self, .string, optional: true, list: true)\n        assertType(List<Data?>.self, .data, optional: true, list: true)\n        assertType(List<Date?>.self, .date, optional: true, list: true)\n        assertType(List<UUID?>.self, .UUID, optional: true, list: true)\n        assertType(List<Decimal128?>.self, .decimal128, optional: true, list: true)\n        assertType(List<ObjectId?>.self, .objectId, optional: true, list: true)\n\n        assertType(MutableSet<Int>.self, .int, set: true)\n        assertType(MutableSet<Int8>.self, .int, set: true)\n        assertType(MutableSet<Int16>.self, .int, set: true)\n        assertType(MutableSet<Int32>.self, .int, set: true)\n        assertType(MutableSet<Int64>.self, .int, set: true)\n        assertType(MutableSet<Bool>.self, .bool, set: true)\n        assertType(MutableSet<Float>.self, .float, set: true)\n        assertType(MutableSet<Double>.self, .double, set: true)\n        assertType(MutableSet<String>.self, .string, set: true)\n        assertType(MutableSet<Data>.self, .data, set: true)\n        assertType(MutableSet<Date>.self, .date, set: true)\n        assertType(MutableSet<UUID>.self, .UUID, set: true)\n        assertType(MutableSet<Decimal128>.self, .decimal128, set: true)\n        assertType(MutableSet<ObjectId>.self, .objectId, set: true)\n        assertType(MutableSet<AnyRealmValue>.self, .any, set: true)\n        assertType(MutableSet<Object>.self, .object, set: true, objectType: \"RealmSwiftObject\")\n        assertType(MutableSet<EmbeddedObject>.self, .object, set: true, objectType: \"RealmSwiftEmbeddedObject\")\n\n        assertType(MutableSet<Int?>.self, .int, optional: true, set: true)\n        assertType(MutableSet<Int8?>.self, .int, optional: true, set: true)\n        assertType(MutableSet<Int16?>.self, .int, optional: true, set: true)\n        assertType(MutableSet<Int32?>.self, .int, optional: true, set: true)\n        assertType(MutableSet<Int64?>.self, .int, optional: true, set: true)\n        assertType(MutableSet<Bool?>.self, .bool, optional: true, set: true)\n        assertType(MutableSet<Float?>.self, .float, optional: true, set: true)\n        assertType(MutableSet<Double?>.self, .double, optional: true, set: true)\n        assertType(MutableSet<String?>.self, .string, optional: true, set: true)\n        assertType(MutableSet<Data?>.self, .data, optional: true, set: true)\n        assertType(MutableSet<Date?>.self, .date, optional: true, set: true)\n        assertType(MutableSet<UUID?>.self, .UUID, optional: true, set: true)\n        assertType(MutableSet<Decimal128?>.self, .decimal128, optional: true, set: true)\n        assertType(MutableSet<ObjectId?>.self, .objectId, optional: true, set: true)\n\n        assertType(Map<String, Int>.self, .int, map: true)\n        assertType(Map<String, Int8>.self, .int, map: true)\n        assertType(Map<String, Int16>.self, .int, map: true)\n        assertType(Map<String, Int32>.self, .int, map: true)\n        assertType(Map<String, Int64>.self, .int, map: true)\n        assertType(Map<String, Bool>.self, .bool, map: true)\n        assertType(Map<String, Float>.self, .float, map: true)\n        assertType(Map<String, Double>.self, .double, map: true)\n        assertType(Map<String, String>.self, .string, map: true)\n        assertType(Map<String, Data>.self, .data, map: true)\n        assertType(Map<String, Date>.self, .date, map: true)\n        assertType(Map<String, UUID>.self, .UUID, map: true)\n        assertType(Map<String, Decimal128>.self, .decimal128, map: true)\n        assertType(Map<String, ObjectId>.self, .objectId, map: true)\n        assertType(Map<String, AnyRealmValue>.self, .any, map: true)\n\n        assertType(Map<String, Int?>.self, .int, optional: true, map: true)\n        assertType(Map<String, Int8?>.self, .int, optional: true, map: true)\n        assertType(Map<String, Int16?>.self, .int, optional: true, map: true)\n        assertType(Map<String, Int32?>.self, .int, optional: true, map: true)\n        assertType(Map<String, Int64?>.self, .int, optional: true, map: true)\n        assertType(Map<String, Bool?>.self, .bool, optional: true, map: true)\n        assertType(Map<String, Float?>.self, .float, optional: true, map: true)\n        assertType(Map<String, Double?>.self, .double, optional: true, map: true)\n        assertType(Map<String, String?>.self, .string, optional: true, map: true)\n        assertType(Map<String, Data?>.self, .data, optional: true, map: true)\n        assertType(Map<String, Date?>.self, .date, optional: true, map: true)\n        assertType(Map<String, UUID?>.self, .UUID, optional: true, map: true)\n        assertType(Map<String, Decimal128?>.self, .decimal128, optional: true, map: true)\n        assertType(Map<String, ObjectId?>.self, .objectId, optional: true, map: true)\n        assertType(Map<String, Object?>.self, .object, optional: true, map: true, objectType: \"RealmSwiftObject\")\n        assertType(Map<String, EmbeddedObject?>.self, .object, optional: true, map: true, objectType: \"RealmSwiftEmbeddedObject\")\n\n        assertThrows(RLMProperty(name: \"_name\", value: Persisted<Object>()),\n                     reason: \"Object property 'name' must be marked as optional.\")\n        assertThrows(RLMProperty(name: \"_name\", value: Persisted<List<Object?>>()),\n                     reason: \"List<RealmSwiftObject> property 'name' must not be marked as optional.\")\n        assertThrows(RLMProperty(name: \"_name\", value: Persisted<MutableSet<Object?>>()),\n                     reason: \"MutableSet<RealmSwiftObject> property 'name' must not be marked as optional.\")\n        assertThrows(RLMProperty(name: \"_name\", value: Persisted<LinkingObjects<Object>>()),\n                     reason: \"LinkingObjects<RealmSwiftObject> property 'name' must set the origin property name with @Persisted(originProperty: \\\"name\\\").\")\n\n        assertThrows(RLMProperty(name: \"_name\", value: Persisted<EmbeddedObject>()),\n                     reason: \"Object property 'name' must be marked as optional.\")\n        assertThrows(RLMProperty(name: \"_name\", value: Persisted<List<EmbeddedObject?>>()),\n                     reason: \"List<RealmSwiftObject> property 'name' must not be marked as optional.\")\n        assertThrows(RLMProperty(name: \"_name\", value: Persisted<MutableSet<EmbeddedObject?>>()),\n                     reason: \"MutableSet<RealmSwiftObject> property 'name' must not be marked as optional.\")\n        assertThrows(RLMProperty(name: \"_name\", value: Persisted<LinkingObjects<EmbeddedObject>>()),\n                     reason: \"LinkingObjects<RealmSwiftEmbeddedObject> property 'name' must set the origin property name with @Persisted(originProperty: \\\"name\\\").\")\n        assertThrows(RLMProperty(name: \"_name\", value: Persisted<Map<String, Object>>()),\n                     reason: \"Map<String, RealmSwiftObject> property 'name' must be marked as optional.\")\n        assertThrows(RLMProperty(name: \"_name\", value: Persisted<Map<String, EmbeddedObject>>()),\n                     reason: \"Map<String, RealmSwiftObject> property 'name' must be marked as optional.\")\n    }\n\n    func testModernIndexed() {\n        XCTAssertFalse(RLMProperty(name: \"_property\", value: Persisted<Int>()).indexed)\n        XCTAssertFalse(RLMProperty(name: \"_property\", value: Persisted<Int>(wrappedValue: 1)).indexed)\n        XCTAssertFalse(RLMProperty(name: \"_property\", value: Persisted<Int>(indexed: false)).indexed)\n        XCTAssertFalse(RLMProperty(name: \"_property\", value: Persisted<Int>(wrappedValue: 1, indexed: false)).indexed)\n        XCTAssertTrue(RLMProperty(name: \"_property\", value: Persisted<Int>(indexed: true)).indexed)\n        XCTAssertTrue(RLMProperty(name: \"_property\", value: Persisted<Int>(wrappedValue: 1, indexed: true)).indexed)\n    }\n\n    func testModernPrimary() {\n        XCTAssertFalse(RLMProperty(name: \"_property\", value: Persisted<Int>()).isPrimary)\n        XCTAssertFalse(RLMProperty(name: \"_property\", value: Persisted<Int>(wrappedValue: 1)).isPrimary)\n        XCTAssertFalse(RLMProperty(name: \"_property\", value: Persisted<Int>(primaryKey: false)).isPrimary)\n        XCTAssertFalse(RLMProperty(name: \"_property\", value: Persisted<Int>(wrappedValue: 1, primaryKey: false)).isPrimary)\n        XCTAssertTrue(RLMProperty(name: \"_property\", value: Persisted<Int>(primaryKey: true)).isPrimary)\n        XCTAssertTrue(RLMProperty(name: \"_property\", value: Persisted<Int>(wrappedValue: 1, primaryKey: true)).isPrimary)\n    }\n\n    func testCustomPropertyPopulation() {\n        assertType(IntWrapper.self, .int)\n        assertType(Int8Wrapper.self, .int)\n        assertType(Int16Wrapper.self, .int)\n        assertType(Int32Wrapper.self, .int)\n        assertType(Int64Wrapper.self, .int)\n        assertType(BoolWrapper.self, .bool)\n        assertType(FloatWrapper.self, .float)\n        assertType(DoubleWrapper.self, .double)\n        assertType(StringWrapper.self, .string)\n        assertType(DataWrapper.self, .data)\n        assertType(DateWrapper.self, .date)\n        assertType(UUIDWrapper.self, .UUID)\n        assertType(Decimal128Wrapper.self, .decimal128)\n        assertType(ObjectIdWrapper.self, .objectId)\n\n        assertType(IntWrapper?.self, .int, optional: true)\n        assertType(Int8Wrapper?.self, .int, optional: true)\n        assertType(Int16Wrapper?.self, .int, optional: true)\n        assertType(Int32Wrapper?.self, .int, optional: true)\n        assertType(Int64Wrapper?.self, .int, optional: true)\n        assertType(BoolWrapper?.self, .bool, optional: true)\n        assertType(FloatWrapper?.self, .float, optional: true)\n        assertType(DoubleWrapper?.self, .double, optional: true)\n        assertType(StringWrapper?.self, .string, optional: true)\n        assertType(DataWrapper?.self, .data, optional: true)\n        assertType(DateWrapper?.self, .date, optional: true)\n        assertType(UUIDWrapper?.self, .UUID, optional: true)\n        assertType(Decimal128Wrapper?.self, .decimal128, optional: true)\n        assertType(ObjectIdWrapper?.self, .objectId, optional: true)\n        assertType(EmbeddedObjectWrapper?.self, .object, optional: true,\n                   objectType: \"ModernEmbeddedObject\")\n\n        assertType(List<IntWrapper>.self, .int, list: true)\n        assertType(List<Int8Wrapper>.self, .int, list: true)\n        assertType(List<Int16Wrapper>.self, .int, list: true)\n        assertType(List<Int32Wrapper>.self, .int, list: true)\n        assertType(List<Int64Wrapper>.self, .int, list: true)\n        assertType(List<BoolWrapper>.self, .bool, list: true)\n        assertType(List<FloatWrapper>.self, .float, list: true)\n        assertType(List<DoubleWrapper>.self, .double, list: true)\n        assertType(List<StringWrapper>.self, .string, list: true)\n        assertType(List<DataWrapper>.self, .data, list: true)\n        assertType(List<DateWrapper>.self, .date, list: true)\n        assertType(List<UUIDWrapper>.self, .UUID, list: true)\n        assertType(List<Decimal128Wrapper>.self, .decimal128, list: true)\n        assertType(List<ObjectIdWrapper>.self, .objectId, list: true)\n        assertType(List<EmbeddedObjectWrapper>.self, .object, list: true,\n                   objectType: \"ModernEmbeddedObject\")\n\n        assertType(List<IntWrapper?>.self, .int, optional: true, list: true)\n        assertType(List<Int8Wrapper?>.self, .int, optional: true, list: true)\n        assertType(List<Int16Wrapper?>.self, .int, optional: true, list: true)\n        assertType(List<Int32Wrapper?>.self, .int, optional: true, list: true)\n        assertType(List<Int64Wrapper?>.self, .int, optional: true, list: true)\n        assertType(List<BoolWrapper?>.self, .bool, optional: true, list: true)\n        assertType(List<FloatWrapper?>.self, .float, optional: true, list: true)\n        assertType(List<DoubleWrapper?>.self, .double, optional: true, list: true)\n        assertType(List<StringWrapper?>.self, .string, optional: true, list: true)\n        assertType(List<DataWrapper?>.self, .data, optional: true, list: true)\n        assertType(List<DateWrapper?>.self, .date, optional: true, list: true)\n        assertType(List<UUIDWrapper?>.self, .UUID, optional: true, list: true)\n        assertType(List<Decimal128Wrapper?>.self, .decimal128, optional: true, list: true)\n        assertType(List<ObjectIdWrapper?>.self, .objectId, optional: true, list: true)\n\n        assertType(MutableSet<IntWrapper>.self, .int, set: true)\n        assertType(MutableSet<Int8Wrapper>.self, .int, set: true)\n        assertType(MutableSet<Int16Wrapper>.self, .int, set: true)\n        assertType(MutableSet<Int32Wrapper>.self, .int, set: true)\n        assertType(MutableSet<Int64Wrapper>.self, .int, set: true)\n        assertType(MutableSet<BoolWrapper>.self, .bool, set: true)\n        assertType(MutableSet<FloatWrapper>.self, .float, set: true)\n        assertType(MutableSet<DoubleWrapper>.self, .double, set: true)\n        assertType(MutableSet<StringWrapper>.self, .string, set: true)\n        assertType(MutableSet<DataWrapper>.self, .data, set: true)\n        assertType(MutableSet<DateWrapper>.self, .date, set: true)\n        assertType(MutableSet<UUIDWrapper>.self, .UUID, set: true)\n        assertType(MutableSet<Decimal128Wrapper>.self, .decimal128, set: true)\n        assertType(MutableSet<ObjectIdWrapper>.self, .objectId, set: true)\n\n        assertType(MutableSet<IntWrapper?>.self, .int, optional: true, set: true)\n        assertType(MutableSet<Int8Wrapper?>.self, .int, optional: true, set: true)\n        assertType(MutableSet<Int16Wrapper?>.self, .int, optional: true, set: true)\n        assertType(MutableSet<Int32Wrapper?>.self, .int, optional: true, set: true)\n        assertType(MutableSet<Int64Wrapper?>.self, .int, optional: true, set: true)\n        assertType(MutableSet<BoolWrapper?>.self, .bool, optional: true, set: true)\n        assertType(MutableSet<FloatWrapper?>.self, .float, optional: true, set: true)\n        assertType(MutableSet<DoubleWrapper?>.self, .double, optional: true, set: true)\n        assertType(MutableSet<StringWrapper?>.self, .string, optional: true, set: true)\n        assertType(MutableSet<DataWrapper?>.self, .data, optional: true, set: true)\n        assertType(MutableSet<DateWrapper?>.self, .date, optional: true, set: true)\n        assertType(MutableSet<UUIDWrapper?>.self, .UUID, optional: true, set: true)\n        assertType(MutableSet<Decimal128Wrapper?>.self, .decimal128, optional: true, set: true)\n        assertType(MutableSet<ObjectIdWrapper?>.self, .objectId, optional: true, set: true)\n\n        assertType(Map<String, IntWrapper>.self, .int, map: true)\n        assertType(Map<String, Int8Wrapper>.self, .int, map: true)\n        assertType(Map<String, Int16Wrapper>.self, .int, map: true)\n        assertType(Map<String, Int32Wrapper>.self, .int, map: true)\n        assertType(Map<String, Int64Wrapper>.self, .int, map: true)\n        assertType(Map<String, BoolWrapper>.self, .bool, map: true)\n        assertType(Map<String, FloatWrapper>.self, .float, map: true)\n        assertType(Map<String, DoubleWrapper>.self, .double, map: true)\n        assertType(Map<String, StringWrapper>.self, .string, map: true)\n        assertType(Map<String, DataWrapper>.self, .data, map: true)\n        assertType(Map<String, DateWrapper>.self, .date, map: true)\n        assertType(Map<String, UUIDWrapper>.self, .UUID, map: true)\n        assertType(Map<String, Decimal128Wrapper>.self, .decimal128, map: true)\n        assertType(Map<String, ObjectIdWrapper>.self, .objectId, map: true)\n        assertType(Map<String, EmbeddedObjectWrapper>.self, .object, optional: true, map: true,\n                   objectType: \"ModernEmbeddedObject\")\n\n        assertType(Map<String, IntWrapper?>.self, .int, optional: true, map: true)\n        assertType(Map<String, Int8Wrapper?>.self, .int, optional: true, map: true)\n        assertType(Map<String, Int16Wrapper?>.self, .int, optional: true, map: true)\n        assertType(Map<String, Int32Wrapper?>.self, .int, optional: true, map: true)\n        assertType(Map<String, Int64Wrapper?>.self, .int, optional: true, map: true)\n        assertType(Map<String, BoolWrapper?>.self, .bool, optional: true, map: true)\n        assertType(Map<String, FloatWrapper?>.self, .float, optional: true, map: true)\n        assertType(Map<String, DoubleWrapper?>.self, .double, optional: true, map: true)\n        assertType(Map<String, StringWrapper?>.self, .string, optional: true, map: true)\n        assertType(Map<String, DataWrapper?>.self, .data, optional: true, map: true)\n        assertType(Map<String, DateWrapper?>.self, .date, optional: true, map: true)\n        assertType(Map<String, UUIDWrapper?>.self, .UUID, optional: true, map: true)\n        assertType(Map<String, Decimal128Wrapper?>.self, .decimal128, optional: true, map: true)\n        assertType(Map<String, ObjectIdWrapper?>.self, .objectId, optional: true, map: true)\n        assertType(Map<String, EmbeddedObjectWrapper?>.self, .object, optional: true, map: true,\n                   objectType: \"ModernEmbeddedObject\")\n    }\n\n    func testCustomIndexed() {\n        let v = IntWrapper(persistedValue: 1)\n        XCTAssertFalse(RLMProperty(name: \"_property\", value: Persisted<IntWrapper>()).indexed)\n        XCTAssertFalse(RLMProperty(name: \"_property\", value: Persisted<IntWrapper>(wrappedValue: v)).indexed)\n        XCTAssertFalse(RLMProperty(name: \"_property\", value: Persisted<IntWrapper>(indexed: false)).indexed)\n        XCTAssertFalse(RLMProperty(name: \"_property\", value: Persisted<IntWrapper>(wrappedValue: v, indexed: false)).indexed)\n        XCTAssertTrue(RLMProperty(name: \"_property\", value: Persisted<IntWrapper>(indexed: true)).indexed)\n        XCTAssertTrue(RLMProperty(name: \"_property\", value: Persisted<IntWrapper>(wrappedValue: v, indexed: true)).indexed)\n    }\n\n    func testCustomPrimary() {\n        let v = IntWrapper(persistedValue: 1)\n        XCTAssertFalse(RLMProperty(name: \"_property\", value: Persisted<IntWrapper>()).isPrimary)\n        XCTAssertFalse(RLMProperty(name: \"_property\", value: Persisted<IntWrapper>(wrappedValue: v)).isPrimary)\n        XCTAssertFalse(RLMProperty(name: \"_property\", value: Persisted<IntWrapper>(primaryKey: false)).isPrimary)\n        XCTAssertFalse(RLMProperty(name: \"_property\", value: Persisted<IntWrapper>(wrappedValue: v, primaryKey: false)).isPrimary)\n        XCTAssertTrue(RLMProperty(name: \"_property\", value: Persisted<IntWrapper>(primaryKey: true)).isPrimary)\n        XCTAssertTrue(RLMProperty(name: \"_property\", value: Persisted<IntWrapper>(wrappedValue: v, primaryKey: true)).isPrimary)\n    }\n    #endif // DEBUG\n}\n\nclass SwiftFakeObject: Object {\n    override class func _realmIgnoreClass() -> Bool { return true }\n    @objc dynamic var requiredProp: String?\n}\n\nclass SwiftObjectWithNSURL: SwiftFakeObject {\n    @objc dynamic var url = NSURL(string: \"http://realm.io\")!\n}\n\nclass SwiftObjectWithAnyObject: SwiftFakeObject {\n    @objc dynamic var anyObject: AnyObject = NSObject()\n}\n\nclass SwiftObjectWithStringArray: SwiftFakeObject {\n    @objc dynamic var stringArray = [String]()\n}\n\nclass SwiftObjectWithOptionalStringArray: SwiftFakeObject {\n    @objc dynamic var stringArray: [String]?\n}\n\nenum SwiftEnum {\n    case case1\n    case case2\n}\n\nclass SwiftObjectWithEnum: SwiftFakeObject {\n    var swiftEnum = SwiftEnum.case1\n}\n\nclass SwiftObjectWithStruct: SwiftFakeObject {\n    var swiftStruct = SortDescriptor(keyPath: \"prop\")\n}\n\nclass SwiftObjectWithDatePrimaryKey: SwiftFakeObject {\n    @objc dynamic var date = Date()\n\n    override class func primaryKey() -> String? {\n        return \"date\"\n    }\n}\n\nclass SwiftFakeObjectSubclass: SwiftFakeObject {\n    @objc dynamic var dateCol = Date()\n}\n\n// swiftlint:disable:next type_name\nclass SwiftObjectWithNonNullableOptionalProperties: SwiftFakeObject {\n    @objc dynamic var optDateCol: Date?\n}\n\nclass SwiftObjectWithNonOptionalLinkProperty: SwiftFakeObject {\n    @objc dynamic var objectCol = SwiftBoolObject()\n}\n\n#if compiler(<6) || SWIFT_PACKAGE\nextension Set: RealmOptionalType {\n    public static func _rlmFromObjc(_ value: Any, insideOptional: Bool) -> Set<Element>? {\n        fatalError()\n    }\n\n    public var _rlmObjcValue: Any {\n        fatalError()\n    }\n}\n#else\nextension Set: @retroactive RealmOptionalType {\n    public static func _rlmFromObjc(_ value: Any, insideOptional: Bool) -> Set<Element>? {\n        fatalError()\n    }\n\n    public var _rlmObjcValue: Any {\n        fatalError()\n    }\n}\n#endif\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass SwiftObjectWithNonRealmOptionalType: SwiftFakeObject {\n    let set = RealmOptional<Set<Int>>()\n}\n\nclass SwiftObjectWithBadPropertyName: SwiftFakeObject {\n    @objc dynamic var newValue = false\n}\n\nclass SwiftObjectWithManagedLazyProperty: SwiftFakeObject {\n    lazy var foobar: String = \"foo\"\n}\n\n// swiftlint:disable:next type_name\nclass SwiftObjectWithDynamicManagedLazyProperty: SwiftFakeObject {\n    @objc dynamic lazy var foobar: String = \"foo\"\n}\n\nclass SwiftObjectWithMultiplePrimaryKeys: SwiftFakeObject {\n    @Persisted(primaryKey: true) var pk1: Int\n    @Persisted(primaryKey: true) var pk2: Int\n}\n"
  },
  {
    "path": "RealmSwift/Tests/ObjectSchemaTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\nclass ObjectSchemaTests: TestCase {\n    var objectSchema: ObjectSchema!\n\n    var swiftObjectSchema: ObjectSchema {\n        return try! Realm().schema[\"SwiftObject\"]!\n    }\n\n    func testProperties() {\n        let objectSchema = swiftObjectSchema\n        let propertyNames = objectSchema.properties.map { $0.name }\n        XCTAssertEqual(propertyNames,\n                       [\"boolCol\", \"intCol\", \"int8Col\", \"int16Col\", \"int32Col\", \"int64Col\", \"intEnumCol\", \"floatCol\", \"doubleCol\",\n                        \"stringCol\", \"binaryCol\", \"dateCol\", \"decimalCol\",\n                        \"objectIdCol\", \"objectCol\", \"uuidCol\", \"anyCol\", \"arrayCol\", \"setCol\", \"mapCol\"]\n        )\n    }\n\n    // Cannot name testClassName() because it interferes with the method on XCTest\n    func testClassNameProperty() {\n        let objectSchema = swiftObjectSchema\n        XCTAssertEqual(objectSchema.className, \"SwiftObject\")\n    }\n\n    func testObjectClass() {\n        let objectSchema = swiftObjectSchema\n        XCTAssertTrue(objectSchema.objectClass === SwiftObject.self)\n    }\n\n    func testPrimaryKeyProperty() {\n        let objectSchema = swiftObjectSchema\n        XCTAssertNil(objectSchema.primaryKeyProperty)\n        XCTAssertEqual(try! Realm().schema[\"SwiftPrimaryStringObject\"]!.primaryKeyProperty!.name, \"stringCol\")\n    }\n\n    func testDescription() {\n        let objectSchema = swiftObjectSchema\n        let expected = \"\"\"\n        SwiftObject {\n            boolCol {\n                type = bool;\n                columnName = boolCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            intCol {\n                type = int;\n                columnName = intCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            int8Col {\n                type = int;\n                columnName = int8Col;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            int16Col {\n                type = int;\n                columnName = int16Col;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            int32Col {\n                type = int;\n                columnName = int32Col;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            int64Col {\n                type = int;\n                columnName = int64Col;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            intEnumCol {\n                type = int;\n                columnName = intEnumCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            floatCol {\n                type = float;\n                columnName = floatCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            doubleCol {\n                type = double;\n                columnName = doubleCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            stringCol {\n                type = string;\n                columnName = stringCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            binaryCol {\n                type = data;\n                columnName = binaryCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            dateCol {\n                type = date;\n                columnName = dateCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            decimalCol {\n                type = decimal128;\n                columnName = decimalCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            objectIdCol {\n                type = object id;\n                columnName = objectIdCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            objectCol {\n                type = object;\n                objectClassName = SwiftBoolObject;\n                linkOriginPropertyName = (null);\n                columnName = objectCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = YES;\n            }\n            uuidCol {\n                type = uuid;\n                columnName = uuidCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            anyCol {\n                type = mixed;\n                columnName = anyCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            arrayCol {\n                type = object;\n                objectClassName = SwiftBoolObject;\n                linkOriginPropertyName = (null);\n                columnName = arrayCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = YES;\n                set = NO;\n                dictionary = NO;\n                optional = NO;\n            }\n            setCol {\n                type = object;\n                objectClassName = SwiftBoolObject;\n                linkOriginPropertyName = (null);\n                columnName = setCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = YES;\n                dictionary = NO;\n                optional = NO;\n            }\n            mapCol {\n                type = object;\n                objectClassName = SwiftBoolObject;\n                linkOriginPropertyName = (null);\n                columnName = mapCol;\n                indexed = NO;\n                isPrimary = NO;\n                array = NO;\n                set = NO;\n                dictionary = YES;\n                optional = YES;\n            }\n        }\n        \"\"\"\n        XCTAssertEqual(objectSchema.description, expected.replacingOccurrences(of: \"    \", with: \"\\t\"))\n    }\n\n    func testSubscript() {\n        let objectSchema = swiftObjectSchema\n        XCTAssertNil(objectSchema[\"noSuchProperty\"])\n        XCTAssertEqual(objectSchema[\"boolCol\"]!.name, \"boolCol\")\n    }\n\n    func testEquals() {\n        let objectSchema = swiftObjectSchema\n        XCTAssert(try! objectSchema == Realm().schema[\"SwiftObject\"]!)\n        XCTAssert(try! objectSchema != Realm().schema[\"SwiftStringObject\"]!)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/ObjectTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport Realm\nimport RealmSwift\nimport Foundation\nimport os.lock\n\n#if canImport(RealmSwiftTestSupport)\nimport RealmSwiftTestSupport\n#endif\n\nprivate nonisolated(unsafe) var dynamicDefaultSeed = 0\nprivate func nextDynamicDefaultSeed() -> Int {\n    dynamicDefaultSeed += 1\n    return dynamicDefaultSeed\n}\nclass SwiftDynamicDefaultObject: Object {\n    @objc dynamic var intCol = nextDynamicDefaultSeed()\n    @objc dynamic var floatCol = Float(nextDynamicDefaultSeed())\n    @objc dynamic var doubleCol = Double(nextDynamicDefaultSeed())\n    @objc dynamic var dateCol = Date(timeIntervalSinceReferenceDate: TimeInterval(nextDynamicDefaultSeed()))\n    @objc dynamic var stringCol = UUID().uuidString\n    @objc dynamic var binaryCol = UUID().uuidString.data(using: .utf8)\n\n    override static func primaryKey() -> String? {\n        return \"intCol\"\n    }\n}\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass ObjectTests: TestCase {\n    // init() Tests are in ObjectCreationTests.swift\n    // init(value:) tests are in ObjectCreationTests.swift\n\n    func testRealm() {\n        let standalone = SwiftStringObject()\n        XCTAssertNil(standalone.realm)\n\n        let realm = try! Realm()\n        nonisolated(unsafe) var persisted: SwiftStringObject!\n        try! realm.write {\n            persisted = realm.create(SwiftStringObject.self)\n            XCTAssertNotNil(persisted.realm)\n            XCTAssertEqual(realm, persisted.realm!)\n        }\n        XCTAssertNotNil(persisted.realm)\n        XCTAssertEqual(realm, persisted.realm!)\n\n        dispatchSyncNewThread {\n            autoreleasepool {\n                XCTAssertNotEqual(try! Realm(), persisted.realm!)\n            }\n        }\n    }\n\n    func testObjectSchema() {\n        let object = SwiftObject()\n        let schema = object.objectSchema\n        XCTAssert(schema as AnyObject is ObjectSchema)\n        XCTAssert(schema.properties as AnyObject is [Property])\n        XCTAssertEqual(schema.className, \"SwiftObject\")\n        XCTAssertEqual(schema.properties.map { $0.name },\n                       [\"boolCol\", \"intCol\", \"int8Col\", \"int16Col\", \"int32Col\", \"int64Col\", \"intEnumCol\", \"floatCol\", \"doubleCol\",\n                        \"stringCol\", \"binaryCol\", \"dateCol\", \"decimalCol\",\n                        \"objectIdCol\", \"objectCol\", \"uuidCol\", \"anyCol\", \"arrayCol\", \"setCol\", \"mapCol\"]\n        )\n    }\n\n    func testObjectSchemaForObjectWithConvenienceInitializer() {\n        let object = SwiftConvenienceInitializerObject(stringCol: \"abc\")\n        let schema = object.objectSchema\n        XCTAssert(schema as AnyObject is ObjectSchema)\n        XCTAssert(schema.properties as AnyObject is [Property])\n        XCTAssertEqual(schema.className, \"SwiftConvenienceInitializerObject\")\n        XCTAssertEqual(schema.properties.map { $0.name }, [\"stringCol\"])\n    }\n\n    func testSharedSchemaUnmanaged() {\n        let object = SwiftObject()\n        XCTAssertEqual(type(of: object).sharedSchema(), SwiftObject.sharedSchema())\n    }\n\n    func testSharedSchemaManaged() {\n        let object = SwiftObject()\n        XCTAssertEqual(type(of: object).sharedSchema(), SwiftObject.sharedSchema())\n    }\n\n    func testBaseClassesDoNotHaveSharedSchema() {\n        XCTAssertNil(ObjectBase.sharedSchema())\n        XCTAssertNil(Object.sharedSchema())\n        XCTAssertNil(EmbeddedObject.sharedSchema())\n        XCTAssertNil(RLMObject.sharedSchema())\n        XCTAssertNil(RLMEmbeddedObject.sharedSchema())\n    }\n\n    func testInvalidated() {\n        let object = SwiftObject()\n        XCTAssertFalse(object.isInvalidated)\n\n        let realm = try! Realm()\n        try! realm.write {\n            realm.add(object)\n            XCTAssertFalse(object.isInvalidated)\n        }\n\n        try! realm.write {\n            realm.deleteAll()\n            XCTAssertTrue(object.isInvalidated)\n        }\n        XCTAssertTrue(object.isInvalidated)\n    }\n\n    func testInvalidatedWithCustomObjectClasses() {\n        var config = Realm.Configuration.defaultConfiguration\n        config.objectTypes = [SwiftObject.self, SwiftBoolObject.self]\n        let realm = try! Realm(configuration: config)\n\n        let object = SwiftObject()\n        XCTAssertFalse(object.isInvalidated)\n\n        try! realm.write {\n            realm.add(object)\n            XCTAssertFalse(object.isInvalidated)\n        }\n\n        try! realm.write {\n            realm.deleteAll()\n            XCTAssertTrue(object.isInvalidated)\n        }\n        XCTAssertTrue(object.isInvalidated)\n    }\n\n    func testDescription() {\n        let object = SwiftObject()\n\n        // swiftlint:disable line_length\n        assertMatches(object.description, \"SwiftObject \\\\{\\n\\tboolCol = 0;\\n\\tintCol = 123;\\n\\tint8Col = 123;\\n\\tint16Col = 123;\\n\\tint32Col = 123;\\n\\tint64Col = 123;\\n\\tintEnumCol = 1;\\n\\tfloatCol = 1\\\\.23;\\n\\tdoubleCol = 12\\\\.3;\\n\\tstringCol = a;\\n\\tbinaryCol = <.*61.*>;\\n\\tdateCol = 1970-01-01 00:00:01 \\\\+0000;\\n\\tdecimalCol = 1.23E6;\\n\\tobjectIdCol = 1234567890ab1234567890ab;\\n\\tobjectCol = SwiftBoolObject \\\\{\\n\\t\\tboolCol = 0;\\n\\t\\\\};\\n\\tuuidCol = 137DECC8-B300-4954-A233-F89909F4FD89;\\n\\tanyCol = \\\\(null\\\\);\\n\\tarrayCol = List<SwiftBoolObject> <0x[0-9a-f]+> \\\\(\\n\\t\\n\\t\\\\);\\n\\tsetCol = MutableSet<SwiftBoolObject> <0x[0-9a-f]+> \\\\(\\n\\t\\n\\t\\\\);\\n\\tmapCol = Map<string, SwiftBoolObject> <0x[0-9a-f]+> \\\\(\\n\\t\\n\\t\\\\);\\n\\\\}\")\n\n        let recursiveObject = SwiftRecursiveObject()\n        recursiveObject.objects.append(recursiveObject)\n        recursiveObject.objectSet.insert(recursiveObject)\n        assertMatches(recursiveObject.description, \"SwiftRecursiveObject \\\\{\\n\\tobjects = List<SwiftRecursiveObject> <0x[0-9a-f]+> \\\\(\\n\\t\\t\\\\[0\\\\] SwiftRecursiveObject \\\\{\\n\\t\\t\\tobjects = List<SwiftRecursiveObject> <0x[0-9a-f]+> \\\\(\\n\\t\\t\\t\\t\\\\[0\\\\] SwiftRecursiveObject \\\\{\\n\\t\\t\\t\\t\\tobjects = <Maximum depth exceeded>;\\n\\t\\t\\t\\t\\tobjectSet = <Maximum depth exceeded>;\\n\\t\\t\\t\\t\\\\}\\n\\t\\t\\t\\\\);\\n\\t\\t\\tobjectSet = MutableSet<SwiftRecursiveObject> <0x[0-9a-f]+> \\\\(\\n\\t\\t\\t\\t\\\\[0\\\\] SwiftRecursiveObject \\\\{\\n\\t\\t\\t\\t\\tobjects = <Maximum depth exceeded>;\\n\\t\\t\\t\\t\\tobjectSet = <Maximum depth exceeded>;\\n\\t\\t\\t\\t\\\\}\\n\\t\\t\\t\\\\);\\n\\t\\t\\\\}\\n\\t\\\\);\\n\\tobjectSet = MutableSet<SwiftRecursiveObject> <0x[0-9a-f]+> \\\\(\\n\\t\\t\\\\[0\\\\] SwiftRecursiveObject \\\\{\\n\\t\\t\\tobjects = List<SwiftRecursiveObject> <0x[0-9a-f]+> \\\\(\\n\\t\\t\\t\\t\\\\[0\\\\] SwiftRecursiveObject \\\\{\\n\\t\\t\\t\\t\\tobjects = <Maximum depth exceeded>;\\n\\t\\t\\t\\t\\tobjectSet = <Maximum depth exceeded>;\\n\\t\\t\\t\\t\\\\}\\n\\t\\t\\t\\\\);\\n\\t\\t\\tobjectSet = MutableSet<SwiftRecursiveObject> <0x[0-9a-f]+> \\\\(\\n\\t\\t\\t\\t\\\\[0\\\\] SwiftRecursiveObject \\\\{\\n\\t\\t\\t\\t\\tobjects = <Maximum depth exceeded>;\\n\\t\\t\\t\\t\\tobjectSet = <Maximum depth exceeded>;\\n\\t\\t\\t\\t\\\\}\\n\\t\\t\\t\\\\);\\n\\t\\t\\\\}\\n\\t\\\\);\\n\\\\}\")\n\n        let renamedObject = LinkToSwiftRenamedProperties1()\n        renamedObject.linkA = SwiftRenamedProperties1()\n        assertMatches(renamedObject.description, \"LinkToSwiftRenamedProperties1 \\\\{\\n\\tlinkA = SwiftRenamedProperties1 \\\\{\\n\\t\\tpropA = 0;\\n\\t\\tpropB = ;\\n\\t\\\\};\\n\\tlinkB = \\\\(null\\\\);\\n\\tarray1 = List<SwiftRenamedProperties1> <0x[0-9a-f]+> \\\\(\\n\\t\\n\\t\\\\);\\n\\tset1 = MutableSet<SwiftRenamedProperties1> <0x[0-9a-f]+> \\\\(\\n\\t\\n\\t\\\\);\\n\\\\}\")\n        assertMatches(renamedObject.linkA!.linking1.description, \"LinkingObjects<LinkToSwiftRenamedProperties1> <0x[0-9a-f]+> \\\\(\\n\\n\\\\)\")\n\n        let realm = try! Realm()\n        try! realm.write { realm.add(renamedObject) }\n        assertMatches(renamedObject.description, \"LinkToSwiftRenamedProperties1 \\\\{\\n\\tlinkA = SwiftRenamedProperties1 \\\\{\\n\\t\\tpropA = 0;\\n\\t\\tpropB = ;\\n\\t\\\\};\\n\\tlinkB = \\\\(null\\\\);\\n\\tarray1 = List<SwiftRenamedProperties1> <0x[0-9a-f]+> \\\\(\\n\\t\\n\\t\\\\);\\n\\tset1 = MutableSet<SwiftRenamedProperties1> <0x[0-9a-f]+> \\\\(\\n\\t\\n\\t\\\\);\\n\\\\}\")\n        assertMatches(renamedObject.linkA!.linking1.description, \"LinkingObjects<LinkToSwiftRenamedProperties1> <0x[0-9a-f]+> \\\\(\\n\\t\\\\[0\\\\] LinkToSwiftRenamedProperties1 \\\\{\\n\\t\\tlinkA = SwiftRenamedProperties1 \\\\{\\n\\t\\t\\tpropA = 0;\\n\\t\\t\\tpropB = ;\\n\\t\\t\\\\};\\n\\t\\tlinkB = \\\\(null\\\\);\\n\\t\\tarray1 = List<SwiftRenamedProperties1> <0x[0-9a-f]+> \\\\(\\n\\t\\t\\n\\t\\t\\\\);\\n\\t\\tset1 = MutableSet<SwiftRenamedProperties1> <0x[0-9a-f]+> \\\\(\\n\\t\\t\\n\\t\\t\\\\);\\n\\t\\\\}\\n\\\\)\")\n        // swiftlint:enable line_length\n    }\n\n    func testSchemaHasPrimaryKey() {\n        XCTAssertNil(Object.primaryKey(), \"primary key should default to nil\")\n        XCTAssertNil(SwiftStringObject.primaryKey())\n        XCTAssertNil(SwiftStringObject().objectSchema.primaryKeyProperty)\n        XCTAssertEqual(SwiftPrimaryStringObject.primaryKey()!, \"stringCol\")\n        XCTAssertEqual(SwiftPrimaryStringObject().objectSchema.primaryKeyProperty!.name, \"stringCol\")\n        XCTAssertEqual(SwiftPrimaryUUIDObject().objectSchema.primaryKeyProperty!.name, \"uuidCol\")\n        XCTAssertEqual(SwiftPrimaryObjectIdObject().objectSchema.primaryKeyProperty!.name, \"objectIdCol\")\n    }\n\n    func testCannotUpdatePrimaryKey() {\n        let realm = self.realmWithTestPath()\n        let primaryKeyReason = \"Primary key can't be changed .*after an object is inserted.\"\n\n        let intObj = SwiftPrimaryIntObject()\n        intObj.intCol = 1\n        intObj.intCol = 0 // can change primary key unattached\n        XCTAssertEqual(0, intObj.intCol)\n\n        let optionalIntObj = SwiftPrimaryOptionalIntObject()\n        optionalIntObj.intCol.value = 1\n        optionalIntObj.intCol.value = 0 // can change primary key unattached\n        XCTAssertEqual(0, optionalIntObj.intCol.value)\n\n        let stringObj = SwiftPrimaryStringObject()\n        stringObj.stringCol = \"a\"\n        stringObj.stringCol = \"b\" // can change primary key unattached\n        XCTAssertEqual(\"b\", stringObj.stringCol)\n\n        let uuidObj = SwiftPrimaryUUIDObject()\n        uuidObj.uuidCol = UUID(uuidString: \"8a12daba-8b23-11eb-8dcd-0242ac130003\")!\n        uuidObj.uuidCol = UUID(uuidString: \"85d4fbee-6ec6-47df-bfa1-615931903d7e\")!\n        XCTAssertEqual(UUID(uuidString: \"85d4fbee-6ec6-47df-bfa1-615931903d7e\")!, uuidObj.uuidCol)\n\n        let objectIdObj = SwiftPrimaryObjectIdObject()\n        objectIdObj.objectIdCol = ObjectId(\"1234567890ab1234567890aa\")\n        objectIdObj.objectIdCol = ObjectId(\"1234567890ab1234567890ab\")\n        XCTAssertEqual(ObjectId(\"1234567890ab1234567890ab\"), objectIdObj.objectIdCol)\n\n        try! realm.write {\n            realm.add(intObj)\n            assertThrows(intObj.intCol = 2, reasonMatching: primaryKeyReason)\n            assertThrows(intObj[\"intCol\"] = 2, reasonMatching: primaryKeyReason)\n            assertThrows(intObj.setValue(2, forKey: \"intCol\"), reasonMatching: primaryKeyReason)\n\n            realm.add(optionalIntObj)\n            assertThrows(optionalIntObj.intCol.value = 2, reasonMatching: \"Cannot modify primary key\")\n            assertThrows(optionalIntObj[\"intCol\"] = 2, reasonMatching: primaryKeyReason)\n            assertThrows(optionalIntObj.setValue(2, forKey: \"intCol\"), reasonMatching: \"Cannot modify primary key\")\n\n            realm.add(stringObj)\n            assertThrows(stringObj.stringCol = \"c\", reasonMatching: primaryKeyReason)\n            assertThrows(stringObj[\"stringCol\"] = \"c\", reasonMatching: primaryKeyReason)\n            assertThrows(stringObj.setValue(\"c\", forKey: \"stringCol\"), reasonMatching: primaryKeyReason)\n\n            realm.add(uuidObj)\n            assertThrows(uuidObj.uuidCol = UUID(uuidString: \"4ee1fa48-8b23-11eb-8dcd-0242ac130003\")!, reasonMatching: primaryKeyReason)\n            assertThrows(uuidObj[\"uuidCol\"] = UUID(uuidString: \"4ee1fa48-8b23-11eb-8dcd-0242ac130003\")!, reasonMatching: primaryKeyReason)\n            assertThrows(uuidObj.setValue(UUID(uuidString: \"4ee1fa48-8b23-11eb-8dcd-0242ac130003\")!, forKey: \"uuidCol\"), reasonMatching: primaryKeyReason)\n\n            realm.add(objectIdObj)\n            assertThrows(objectIdObj.objectIdCol = ObjectId(\"1234567890ab1234567890ac\"), reasonMatching: primaryKeyReason)\n            assertThrows(objectIdObj[\"objectIdCol\"] = ObjectId(\"1234567890ab1234567890ac\"), reasonMatching: primaryKeyReason)\n            assertThrows(objectIdObj.setValue(ObjectId(\"1234567890ab1234567890ac\"), forKey: \"objectIdCol\"), reasonMatching: primaryKeyReason)\n        }\n    }\n\n    func testIgnoredProperties() {\n        XCTAssertEqual(Object.ignoredProperties(), [], \"ignored properties should default to []\")\n        XCTAssertEqual(SwiftIgnoredPropertiesObject.ignoredProperties().count, 2)\n        XCTAssertNil(SwiftIgnoredPropertiesObject().objectSchema[\"runtimeProperty\"])\n    }\n\n    func testIndexedProperties() {\n        XCTAssertEqual(Object.indexedProperties(), [], \"indexed properties should default to []\")\n        XCTAssertEqual(SwiftIndexedPropertiesObject.indexedProperties().count, 10)\n\n        let objectSchema = SwiftIndexedPropertiesObject().objectSchema\n        XCTAssertTrue(objectSchema[\"stringCol\"]!.isIndexed)\n        XCTAssertTrue(objectSchema[\"intCol\"]!.isIndexed)\n        XCTAssertTrue(objectSchema[\"int8Col\"]!.isIndexed)\n        XCTAssertTrue(objectSchema[\"int16Col\"]!.isIndexed)\n        XCTAssertTrue(objectSchema[\"int32Col\"]!.isIndexed)\n        XCTAssertTrue(objectSchema[\"int64Col\"]!.isIndexed)\n        XCTAssertTrue(objectSchema[\"boolCol\"]!.isIndexed)\n        XCTAssertTrue(objectSchema[\"dateCol\"]!.isIndexed)\n        XCTAssertTrue(objectSchema[\"uuidCol\"]!.isIndexed)\n        XCTAssertTrue(objectSchema[\"anyCol\"]!.isIndexed)\n\n        XCTAssertFalse(objectSchema[\"floatCol\"]!.isIndexed)\n        XCTAssertFalse(objectSchema[\"doubleCol\"]!.isIndexed)\n        XCTAssertFalse(objectSchema[\"dataCol\"]!.isIndexed)\n    }\n\n    func testIndexedOptionalProperties() {\n        XCTAssertEqual(Object.indexedProperties(), [], \"indexed properties should default to []\")\n        XCTAssertEqual(SwiftIndexedOptionalPropertiesObject.indexedProperties().count, 9)\n        XCTAssertTrue(SwiftIndexedOptionalPropertiesObject().objectSchema[\"optionalStringCol\"]!.isIndexed)\n        XCTAssertTrue(SwiftIndexedOptionalPropertiesObject().objectSchema[\"optionalDateCol\"]!.isIndexed)\n        XCTAssertTrue(SwiftIndexedOptionalPropertiesObject().objectSchema[\"optionalBoolCol\"]!.isIndexed)\n        XCTAssertTrue(SwiftIndexedOptionalPropertiesObject().objectSchema[\"optionalIntCol\"]!.isIndexed)\n        XCTAssertTrue(SwiftIndexedOptionalPropertiesObject().objectSchema[\"optionalInt8Col\"]!.isIndexed)\n        XCTAssertTrue(SwiftIndexedOptionalPropertiesObject().objectSchema[\"optionalInt16Col\"]!.isIndexed)\n        XCTAssertTrue(SwiftIndexedOptionalPropertiesObject().objectSchema[\"optionalInt32Col\"]!.isIndexed)\n        XCTAssertTrue(SwiftIndexedOptionalPropertiesObject().objectSchema[\"optionalInt64Col\"]!.isIndexed)\n        XCTAssertTrue(SwiftIndexedOptionalPropertiesObject().objectSchema[\"optionalUUIDCol\"]!.isIndexed)\n\n        XCTAssertFalse(SwiftIndexedOptionalPropertiesObject().objectSchema[\"optionalDataCol\"]!.isIndexed)\n        XCTAssertFalse(SwiftIndexedOptionalPropertiesObject().objectSchema[\"optionalFloatCol\"]!.isIndexed)\n        XCTAssertFalse(SwiftIndexedOptionalPropertiesObject().objectSchema[\"optionalDoubleCol\"]!.isIndexed)\n    }\n\n    func testDynamicDefaultPropertyValues() {\n        func assertDifferentPropertyValues(_ obj1: SwiftDynamicDefaultObject, _ obj2: SwiftDynamicDefaultObject) {\n            XCTAssertNotEqual(obj1.intCol, obj2.intCol)\n            XCTAssertNotEqual(obj1.floatCol, obj2.floatCol)\n            XCTAssertNotEqual(obj1.doubleCol, obj2.doubleCol)\n            XCTAssertNotEqual(obj1.dateCol.timeIntervalSinceReferenceDate, obj2.dateCol.timeIntervalSinceReferenceDate,\n                              accuracy: 0.01)\n            XCTAssertNotEqual(obj1.stringCol, obj2.stringCol)\n            XCTAssertNotEqual(obj1.binaryCol, obj2.binaryCol)\n        }\n        assertDifferentPropertyValues(SwiftDynamicDefaultObject(), SwiftDynamicDefaultObject())\n        let realm = try! Realm()\n        try! realm.write {\n            assertDifferentPropertyValues(realm.create(SwiftDynamicDefaultObject.self),\n                                          realm.create(SwiftDynamicDefaultObject.self))\n        }\n    }\n\n    func testValueForKey() {\n        let test: (SwiftObject) -> Void = { object in\n            XCTAssertEqual(object.value(forKey: \"boolCol\") as! Bool?, false)\n            XCTAssertEqual(object.value(forKey: \"intCol\") as! Int?, 123)\n            XCTAssertEqual(object.value(forKey: \"int8Col\") as! Int8?, 123)\n            XCTAssertEqual(object.value(forKey: \"int16Col\") as! Int16?, 123)\n            XCTAssertEqual(object.value(forKey: \"int32Col\") as! Int32?, 123)\n            XCTAssertEqual(object.value(forKey: \"int64Col\") as! Int64?, 123)\n            XCTAssertEqual(object.value(forKey: \"floatCol\") as! Float?, 1.23 as Float)\n            XCTAssertEqual(object.value(forKey: \"doubleCol\") as! Double?, 12.3)\n            XCTAssertEqual(object.value(forKey: \"stringCol\") as! String?, \"a\")\n            XCTAssertEqual(object.value(forKey: \"uuidCol\") as! UUID?, UUID(uuidString: \"137decc8-b300-4954-a233-f89909f4fd89\")!)\n            XCTAssertNil(object.value(forKey: \"anyCol\"))\n\n            let expected = object.value(forKey: \"binaryCol\") as! Data\n            let actual = Data(\"a\".utf8)\n            XCTAssertEqual(expected, actual)\n\n            XCTAssertEqual(object.value(forKey: \"dateCol\") as! Date?, Date(timeIntervalSince1970: 1))\n            XCTAssertEqual((object.value(forKey: \"objectCol\")! as! SwiftBoolObject).boolCol, false)\n            XCTAssert(object.value(forKey: \"arrayCol\")! is List<SwiftBoolObject>)\n            XCTAssert(object.value(forKey: \"setCol\")! is MutableSet<SwiftBoolObject>)\n        }\n\n        test(SwiftObject())\n        let realm = try! Realm()\n        try! realm.write {\n            test(realm.create(SwiftObject.self))\n            let addedObj = SwiftObject()\n            realm.add(addedObj)\n            test(addedObj)\n        }\n    }\n\n    func testValueForKeyOptionals() {\n        let test: (SwiftOptionalObject) -> Void = { object in\n            XCTAssertNil(object.value(forKey: \"optNSStringCol\"))\n            XCTAssertNil(object.value(forKey: \"optStringCol\"))\n            XCTAssertNil(object.value(forKey: \"optBinaryCol\"))\n            XCTAssertNil(object.value(forKey: \"optDateCol\"))\n            XCTAssertNil(object.value(forKey: \"optIntCol\"))\n            XCTAssertNil(object.value(forKey: \"optInt8Col\"))\n            XCTAssertNil(object.value(forKey: \"optInt16Col\"))\n            XCTAssertNil(object.value(forKey: \"optInt32Col\"))\n            XCTAssertNil(object.value(forKey: \"optInt64Col\"))\n            XCTAssertNil(object.value(forKey: \"optFloatCol\"))\n            XCTAssertNil(object.value(forKey: \"optDoubleCol\"))\n            XCTAssertNil(object.value(forKey: \"optBoolCol\"))\n            XCTAssertNil(object.value(forKey: \"optEnumCol\"))\n            XCTAssertNil(object.value(forKey: \"optUuidCol\"))\n        }\n\n        test(SwiftOptionalObject())\n        let realm = try! Realm()\n        try! realm.write {\n            test(realm.create(SwiftOptionalObject.self))\n            let addedObj = SwiftOptionalObject()\n            realm.add(addedObj)\n            test(addedObj)\n        }\n    }\n\n    func testValueForKeyList() {\n        let test: (SwiftListObject) -> Void = { object in\n            XCTAssertNil((object.value(forKey: \"int\") as! List<Int>).first)\n            XCTAssertNil((object.value(forKey: \"int8\") as! List<Int8>).first)\n            XCTAssertNil((object.value(forKey: \"int16\") as! List<Int16>).first)\n            XCTAssertNil((object.value(forKey: \"int32\") as! List<Int32>).first)\n            XCTAssertNil((object.value(forKey: \"int64\") as! List<Int64>).first)\n            XCTAssertNil((object.value(forKey: \"float\") as! List<Float>).first)\n            XCTAssertNil((object.value(forKey: \"double\") as! List<Double>).first)\n            XCTAssertNil((object.value(forKey: \"string\") as! List<String>).first)\n            XCTAssertNil((object.value(forKey: \"data\") as! List<Data>).first)\n            XCTAssertNil((object.value(forKey: \"date\") as! List<Date>).first)\n            XCTAssertNil((object.value(forKey: \"decimal\") as! List<Decimal128>).first)\n            XCTAssertNil((object.value(forKey: \"objectId\") as! List<ObjectId>).first)\n            XCTAssertNil((object.value(forKey: \"uuid\") as! List<UUID>).first)\n            XCTAssertNil((object.value(forKey: \"any\") as! List<AnyRealmValue>).first)\n\n            // The `as Any?` casts below are only to silence the warning about it\n            // happening implicitly and are not functionally required\n            XCTAssertNil((object.value(forKey: \"intOpt\") as! List<Int?>).first as Any?)\n            XCTAssertNil((object.value(forKey: \"int8Opt\") as! List<Int8?>).first as Any?)\n            XCTAssertNil((object.value(forKey: \"int16Opt\") as! List<Int16?>).first as Any?)\n            XCTAssertNil((object.value(forKey: \"int32Opt\") as! List<Int32?>).first as Any?)\n            XCTAssertNil((object.value(forKey: \"int64Opt\") as! List<Int64?>).first as Any?)\n            XCTAssertNil((object.value(forKey: \"floatOpt\") as! List<Float?>).first as Any?)\n            XCTAssertNil((object.value(forKey: \"doubleOpt\") as! List<Double?>).first as Any?)\n            XCTAssertNil((object.value(forKey: \"stringOpt\") as! List<String?>).first as Any?)\n            XCTAssertNil((object.value(forKey: \"dataOpt\") as! List<Data?>).first as Any?)\n            XCTAssertNil((object.value(forKey: \"dateOpt\") as! List<Date?>).first as Any?)\n            XCTAssertNil((object.value(forKey: \"decimalOpt\") as! List<Decimal128?>).first as Any?)\n            XCTAssertNil((object.value(forKey: \"objectIdOpt\") as! List<ObjectId?>).first as Any?)\n            XCTAssertNil((object.value(forKey: \"uuidOpt\") as! List<UUID?>).first as Any?)\n        }\n\n        test(SwiftListObject())\n        let realm = try! Realm()\n        try! realm.write {\n            test(realm.create(SwiftListObject.self))\n            let addedObj = SwiftListObject()\n            realm.add(addedObj)\n            test(addedObj)\n        }\n    }\n\n    func testValueForKeyMutableSet() {\n        let test: (SwiftMutableSetObject) -> Void = { object in\n            XCTAssertEqual((object.value(forKey: \"int\") as! MutableSet<Int>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"int8\") as! MutableSet<Int8>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"int16\") as! MutableSet<Int16>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"int32\") as! MutableSet<Int32>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"int64\") as! MutableSet<Int64>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"float\") as! MutableSet<Float>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"double\") as! MutableSet<Double>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"string\") as! MutableSet<String>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"data\") as! MutableSet<Data>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"date\") as! MutableSet<Date>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"decimal\") as! MutableSet<Decimal128>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"objectId\") as! MutableSet<ObjectId>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"uuid\") as! MutableSet<UUID>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"any\") as! MutableSet<AnyRealmValue>).count, 0)\n\n            XCTAssertEqual((object.value(forKey: \"intOpt\") as! MutableSet<Int?>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"int8Opt\") as! MutableSet<Int8?>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"int16Opt\") as! MutableSet<Int16?>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"int32Opt\") as! MutableSet<Int32?>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"int64Opt\") as! MutableSet<Int64?>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"floatOpt\") as! MutableSet<Float?>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"doubleOpt\") as! MutableSet<Double?>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"stringOpt\") as! MutableSet<String?>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"dataOpt\") as! MutableSet<Data?>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"dateOpt\") as! MutableSet<Date?>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"decimalOpt\") as! MutableSet<Decimal128?>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"objectIdOpt\") as! MutableSet<ObjectId?>).count, 0)\n            XCTAssertEqual((object.value(forKey: \"uuidOpt\") as! MutableSet<UUID?>).count, 0)\n        }\n\n        test(SwiftMutableSetObject())\n        let realm = try! Realm()\n        try! realm.write {\n            test(realm.create(SwiftMutableSetObject.self))\n            let addedObj = SwiftMutableSetObject()\n            realm.add(addedObj)\n            test(addedObj)\n        }\n    }\n\n    func testValueForKeyLinkingObjects() {\n        let test: (SwiftDogObject) -> Void = { object in\n            let owners = object.value(forKey: \"owners\") as! LinkingObjects<SwiftOwnerObject>\n            if object.realm != nil {\n                XCTAssertEqual(owners.first!.name, \"owner name\")\n            }\n        }\n\n        let dog = SwiftDogObject()\n        let owner = SwiftOwnerObject(value: [\"owner name\", dog])\n        test(dog)\n        let realm = try! Realm()\n        try! realm.write {\n            test(realm.create(SwiftOwnerObject.self, value: owner).dog!)\n            realm.add(owner)\n            test(dog)\n        }\n    }\n\n    func testSettingUnmanagedObjectValuesWithSwiftDictionary() {\n        let json: [String: Any] = [\"name\": \"foo\", \"array\": [[\"stringCol\": \"bar\"]], \"intArray\": [[\"intCol\": 50]]]\n        let object = SwiftArrayPropertyObject()\n        json.keys.forEach { key in\n            object.setValue(json[key], forKey: key)\n        }\n        XCTAssertEqual(object.name, \"foo\")\n        XCTAssertEqual(object.array[0].stringCol, \"bar\")\n        XCTAssertEqual(object.intArray[0].intCol, 50)\n\n        let json2: [String: Any] = [\"name\": \"foo\", \"set\": [[\"stringCol\": \"bar\"]], \"intSet\": [[\"intCol\": 50]]]\n        let object2 = SwiftMutableSetPropertyObject()\n        json2.keys.forEach { key in\n            object2.setValue(json2[key], forKey: key)\n        }\n        XCTAssertEqual(object2.name, \"foo\")\n        XCTAssertEqual(object2.set[0].stringCol, \"bar\")\n        XCTAssertEqual(object2.intSet[0].intCol, 50)\n    }\n\n    func testSettingUnmanagedObjectValuesWithBadSwiftDictionary() {\n        let json: [String: Any] = [\"name\": \"foo\", \"array\": [[\"stringCol\": NSObject()]], \"intArray\": [[\"intCol\": 50]]]\n        let object = SwiftArrayPropertyObject()\n        assertThrows({ json.keys.forEach { key in object.setValue(json[key], forKey: key) } }())\n\n        let json2: [String: Any] = [\"name\": \"foo\", \"set\": [[\"stringCol\": NSObject()]], \"intSet\": [[\"intCol\": 50]]]\n        let object2 = SwiftMutableSetPropertyObject()\n        assertThrows({ json2.keys.forEach { key in object2.setValue(json2[key], forKey: key) } }())\n    }\n\n    func setAndTestAllTypes(_ setter: (SwiftObject, Any?, String) -> Void,\n                            getter: (SwiftObject, String) -> (Any?), object: SwiftObject) {\n        setter(object, true, \"boolCol\")\n        XCTAssertEqual(getter(object, \"boolCol\") as! Bool?, true)\n\n        setter(object, 321, \"intCol\")\n        XCTAssertEqual(getter(object, \"intCol\") as! Int?, 321)\n\n        setter(object, Int8(1), \"int8Col\")\n        XCTAssertEqual(getter(object, \"int8Col\") as! Int8?, 1)\n\n        setter(object, Int16(321), \"int16Col\")\n        XCTAssertEqual(getter(object, \"int16Col\") as! Int16?, 321)\n\n        setter(object, Int32(321), \"int32Col\")\n        XCTAssertEqual(getter(object, \"int32Col\") as! Int32?, 321)\n\n        setter(object, Int64(321), \"int64Col\")\n        XCTAssertEqual(getter(object, \"int64Col\") as! Int64?, 321)\n\n        setter(object, NSNumber(value: 32.1 as Float), \"floatCol\")\n        XCTAssertEqual(getter(object, \"floatCol\") as! Float?, 32.1 as Float)\n\n        setter(object, 3.21, \"doubleCol\")\n        XCTAssertEqual(getter(object, \"doubleCol\") as! Double?, 3.21)\n\n        setter(object, \"z\", \"stringCol\")\n        XCTAssertEqual(getter(object, \"stringCol\") as! String?, \"z\")\n\n        setter(object, Data(\"z\".utf8), \"binaryCol\")\n        let gotData = getter(object, \"binaryCol\") as! Data\n        XCTAssertTrue(gotData == Data(\"z\".utf8))\n\n        setter(object, Date(timeIntervalSince1970: 333), \"dateCol\")\n        XCTAssertEqual(getter(object, \"dateCol\") as! Date?, Date(timeIntervalSince1970: 333))\n\n        setter(object, UUID(uuidString: \"137DECC8-B300-4954-A233-F89909F4FD89\"), \"uuidCol\")\n        XCTAssertEqual(getter(object, \"uuidCol\") as! UUID?, UUID(uuidString: \"137DECC8-B300-4954-A233-F89909F4FD89\"))\n\n        setter(object, \"hello\", \"anyCol\")\n        XCTAssertEqual(getter(object, \"anyCol\") as! String, \"hello\")\n\n        let boolObject = SwiftBoolObject(value: [true])\n\n        setter(object, boolObject, \"anyCol\")\n        assertEqual(getter(object, \"anyCol\") as? SwiftBoolObject, boolObject)\n        XCTAssertEqual((getter(object, \"anyCol\") as! SwiftBoolObject).boolCol, true)\n\n        setter(object, boolObject, \"objectCol\")\n        assertEqual(getter(object, \"objectCol\") as? SwiftBoolObject, boolObject)\n        XCTAssertEqual((getter(object, \"objectCol\") as! SwiftBoolObject).boolCol, true)\n\n        let list = List<SwiftBoolObject>()\n        list.append(boolObject)\n        setter(object, list, \"arrayCol\")\n        XCTAssertEqual((getter(object, \"arrayCol\") as! List<SwiftBoolObject>).count, 1)\n        assertEqual((getter(object, \"arrayCol\") as! List<SwiftBoolObject>).first!, boolObject)\n\n        list.removeAll()\n        setter(object, list, \"arrayCol\")\n        XCTAssertEqual((getter(object, \"arrayCol\") as! List<SwiftBoolObject>).count, 0)\n\n        setter(object, [boolObject], \"arrayCol\")\n        XCTAssertEqual((getter(object, \"arrayCol\") as! List<SwiftBoolObject>).count, 1)\n        assertEqual((getter(object, \"arrayCol\") as! List<SwiftBoolObject>).first!, boolObject)\n\n        setter(object, nil, \"arrayCol\")\n        XCTAssertEqual((getter(object, \"arrayCol\") as! List<SwiftBoolObject>).count, 0)\n\n        setter(object, [boolObject], \"arrayCol\")\n        setter(object, NSNull(), \"arrayCol\")\n        XCTAssertEqual((getter(object, \"arrayCol\") as! List<SwiftBoolObject>).count, 0)\n\n        if object.realm != nil {\n            let listRes = object.realm!.objects(SwiftBoolObject.self).filter(\"boolCol == true\")\n            setter(object, listRes, \"arrayCol\")\n            XCTAssertEqual((getter(object, \"arrayCol\") as! List<SwiftBoolObject>).count, listRes.count)\n            assertEqual((getter(object, \"arrayCol\") as! List<SwiftBoolObject>).first!, boolObject)\n        }\n\n        let set = MutableSet<SwiftBoolObject>()\n        set.insert(boolObject)\n        setter(object, set, \"setCol\")\n        XCTAssertEqual((getter(object, \"setCol\") as! MutableSet<SwiftBoolObject>).count, 1)\n        assertEqual((getter(object, \"setCol\") as! MutableSet<SwiftBoolObject>)[0], boolObject)\n\n        set.removeAll()\n        setter(object, set, \"setCol\")\n        XCTAssertEqual((getter(object, \"setCol\") as! MutableSet<SwiftBoolObject>).count, 0)\n\n        setter(object, [boolObject], \"setCol\")\n        XCTAssertEqual((getter(object, \"setCol\") as! MutableSet<SwiftBoolObject>).count, 1)\n        assertEqual((getter(object, \"setCol\") as! MutableSet<SwiftBoolObject>)[0], boolObject)\n\n        setter(object, nil, \"setCol\")\n        XCTAssertEqual((getter(object, \"setCol\") as! MutableSet<SwiftBoolObject>).count, 0)\n\n        setter(object, [boolObject], \"setCol\")\n        setter(object, NSNull(), \"setCol\")\n        XCTAssertEqual((getter(object, \"setCol\") as! MutableSet<SwiftBoolObject>).count, 0)\n    }\n\n    static func dynamicSetAndTestAllTypes(_ setter: (DynamicObject, Any?, String) -> Void,\n                                          getter: (DynamicObject, String) -> (Any?), object: DynamicObject,\n                                          boolObject: DynamicObject) {\n        setter(object, true, \"boolCol\")\n        XCTAssertEqual((getter(object, \"boolCol\") as! Bool), true)\n\n        setter(object, 321, \"intCol\")\n        XCTAssertEqual((getter(object, \"intCol\") as! Int), 321)\n\n        setter(object, Int8(1), \"int8Col\")\n        XCTAssertEqual(getter(object, \"int8Col\") as! Int8?, 1)\n\n        setter(object, Int16(321), \"int16Col\")\n        XCTAssertEqual(getter(object, \"int16Col\") as! Int16?, 321)\n\n        setter(object, Int32(321), \"int32Col\")\n        XCTAssertEqual(getter(object, \"int32Col\") as! Int32?, 321)\n\n        setter(object, Int64(321), \"int64Col\")\n        XCTAssertEqual(getter(object, \"int64Col\") as! Int64?, 321)\n\n        setter(object, NSNumber(value: 32.1 as Float), \"floatCol\")\n        XCTAssertEqual((getter(object, \"floatCol\") as! Float), 32.1 as Float)\n\n        setter(object, 3.21, \"doubleCol\")\n        XCTAssertEqual((getter(object, \"doubleCol\") as! Double), 3.21)\n\n        setter(object, \"z\", \"stringCol\")\n        XCTAssertEqual((getter(object, \"stringCol\") as! String), \"z\")\n\n        setter(object, Data(\"z\".utf8), \"binaryCol\")\n        let gotData = getter(object, \"binaryCol\") as! Data\n        XCTAssertTrue(gotData == Data(\"z\".utf8))\n\n        setter(object, Date(timeIntervalSince1970: 333), \"dateCol\")\n        XCTAssertEqual((getter(object, \"dateCol\") as! Date), Date(timeIntervalSince1970: 333))\n\n        setter(object, UUID(uuidString: \"137DECC8-B300-4954-A233-F89909F4FD89\"), \"uuidCol\")\n        XCTAssertEqual(getter(object, \"uuidCol\") as! UUID?, UUID(uuidString: \"137DECC8-B300-4954-A233-F89909F4FD89\"))\n\n        setter(object, \"hello\", \"anyCol\")\n        XCTAssertEqual((getter(object, \"anyCol\") as! String), \"hello\")\n\n        setter(object, boolObject, \"anyCol\")\n        assertEqual((getter(object, \"anyCol\") as! DynamicObject), boolObject)\n        XCTAssertEqual(((getter(object, \"anyCol\") as! DynamicObject)[\"boolCol\"] as! Bool), true)\n        XCTAssertEqual(((getter(object, \"anyCol\") as! DynamicObject).boolCol as! Bool), true)\n\n        setter(object, boolObject, \"objectCol\")\n        assertEqual((getter(object, \"objectCol\") as! DynamicObject), boolObject)\n        XCTAssertEqual(((getter(object, \"objectCol\") as! DynamicObject)[\"boolCol\"] as! Bool), true)\n        XCTAssertEqual(((getter(object, \"objectCol\") as! DynamicObject).boolCol as! Bool), true)\n\n        setter(object, [boolObject], \"arrayCol\")\n        XCTAssertEqual((getter(object, \"arrayCol\") as! List<DynamicObject>).count, 1)\n        assertEqual((getter(object, \"arrayCol\") as! List<DynamicObject>).first!, boolObject)\n\n        let list = getter(object, \"arrayCol\") as! List<DynamicObject>\n        list.removeAll()\n        setter(object, list, \"arrayCol\")\n        XCTAssertEqual((getter(object, \"arrayCol\") as! List<DynamicObject>).count, 0)\n\n        setter(object, [boolObject], \"arrayCol\")\n        XCTAssertEqual((getter(object, \"arrayCol\") as! List<DynamicObject>).count, 1)\n        assertEqual((getter(object, \"arrayCol\") as! List<DynamicObject>).first!, boolObject)\n\n        setter(object, nil, \"arrayCol\")\n        XCTAssertEqual((getter(object, \"arrayCol\") as! List<DynamicObject>).count, 0)\n\n        setter(object, [boolObject], \"setCol\")\n        XCTAssertEqual((getter(object, \"setCol\") as! MutableSet<DynamicObject>).count, 1)\n        assertEqual((getter(object, \"setCol\") as! MutableSet<DynamicObject>)[0], boolObject)\n\n        let set = getter(object, \"setCol\") as! MutableSet<DynamicObject>\n        set.removeAll()\n        setter(object, set, \"setCol\")\n        XCTAssertEqual((getter(object, \"setCol\") as! MutableSet<DynamicObject>).count, 0)\n\n        setter(object, [boolObject], \"setCol\")\n        XCTAssertEqual((getter(object, \"setCol\") as! MutableSet<DynamicObject>).count, 1)\n        assertEqual((getter(object, \"setCol\") as! MutableSet<DynamicObject>)[0], boolObject)\n\n        setter(object, nil, \"setCol\")\n        XCTAssertEqual((getter(object, \"setCol\") as! MutableSet<DynamicObject>).count, 0)\n    }\n\n    // Yields a read-write migration `SwiftObject` to the given block\n    private func withMigrationObject(block: @escaping @Sendable (MigrationObject, Migration) -> Void) {\n        autoreleasepool {\n            let realm = self.realmWithTestPath()\n            try! realm.write {\n                _ = realm.create(SwiftObject.self)\n            }\n        }\n        let enumerated = Locked(false)\n        autoreleasepool {\n            let configuration = Realm.Configuration(schemaVersion: 1, migrationBlock: { migration, _ in\n                migration.enumerateObjects(ofType: SwiftObject.className()) { _, newObject in\n                    if let newObject = newObject {\n                        block(newObject, migration)\n                        enumerated.value = true\n                    }\n                }\n            })\n            self.realmWithTestPath(configuration: configuration)\n            XCTAssert(enumerated.value)\n        }\n    }\n\n    func testSetValueForKey() {\n        @Sendable func setter(_ object: Object, _ value: Any?, _ key: String) {\n            object.setValue(value, forKey: key)\n        }\n        @Sendable func getter(_ object: Object, _ key: String) -> Any? {\n            object.value(forKey: key)\n        }\n\n        withMigrationObject { migrationObject, migration in\n            let boolObject = migration.create(\"SwiftBoolObject\", value: [true])\n            Self.dynamicSetAndTestAllTypes(setter, getter: getter, object: migrationObject, boolObject: boolObject)\n        }\n\n        setAndTestAllTypes(setter, getter: getter, object: SwiftObject())\n        try! Realm().write {\n            let persistedObject = try! Realm().create(SwiftObject.self)\n            self.setAndTestAllTypes(setter, getter: getter, object: persistedObject)\n        }\n    }\n\n    func testSubscript() {\n        @Sendable func setter(_ object: Object, _ value: Any?, _ key: String) {\n            object[key] = value\n        }\n        @Sendable func getter(_ object: Object, _ key: String) -> Any? {\n            object[key]\n        }\n\n        withMigrationObject { migrationObject, migration in\n            let boolObject = migration.create(\"SwiftBoolObject\", value: [true])\n            Self.dynamicSetAndTestAllTypes(setter, getter: getter, object: migrationObject, boolObject: boolObject)\n        }\n\n        setAndTestAllTypes(setter, getter: getter, object: SwiftObject())\n        try! Realm().write {\n            let persistedObject = try! Realm().create(SwiftObject.self)\n            self.setAndTestAllTypes(setter, getter: getter, object: persistedObject)\n        }\n    }\n\n    func testDynamicMemberSubscript() {\n        withMigrationObject { migrationObject, migration in\n            let boolObject = migration.create(\"SwiftBoolObject\", value: [true])\n            migrationObject.anyCol = boolObject\n            assertEqual(migrationObject.anyCol as? DynamicObject, boolObject)\n            migrationObject.objectCol = boolObject\n            assertEqual(migrationObject.objectCol as? DynamicObject, boolObject)\n            migrationObject.anyCol = 12345\n            XCTAssertEqual(migrationObject.anyCol as! Int, 12345)\n        }\n    }\n\n    func testDynamicList() {\n        let realm = try! Realm()\n        let arrayObject = SwiftArrayPropertyObject()\n        let str1 = SwiftStringObject()\n        let str2 = SwiftStringObject()\n        arrayObject.array.append(objectsIn: [str1, str2])\n        try! realm.write {\n            realm.add(arrayObject)\n        }\n        let dynamicArray = arrayObject.dynamicList(\"array\")\n        XCTAssertEqual(dynamicArray.count, 2)\n        assertEqual(dynamicArray[0], str1)\n        assertEqual(dynamicArray[1], str2)\n        XCTAssertEqual(arrayObject.dynamicList(\"intArray\").count, 0)\n        assertThrows(arrayObject.dynamicList(\"noSuchList\"))\n    }\n\n    func testDynamicMutableSet() {\n        let realm = try! Realm()\n        let setObject = SwiftMutableSetPropertyObject()\n        let str1 = SwiftStringObject()\n        let str2 = SwiftStringObject()\n        setObject.set.insert(objectsIn: [str1, str2])\n        try! realm.write {\n            realm.add(setObject)\n        }\n        let dynamicSet = setObject.dynamicMutableSet(\"set\")\n        XCTAssertEqual(dynamicSet.count, 2)\n\n        XCTAssertTrue(dynamicSet.map { (o) in\n            o.isSameObject(as: str1)\n        }.contains(true))\n        XCTAssertTrue(dynamicSet.map { (o) in\n            o.isSameObject(as: str2)\n        }.contains(true))\n\n        XCTAssertEqual(setObject.dynamicMutableSet(\"intSet\").count, 0)\n        assertThrows(setObject.dynamicMutableSet(\"noSuchSet\"))\n    }\n\n    func testObjectiveCTypeProperties() {\n        let realm = try! Realm()\n        var object: SwiftObjectiveCTypesObject!\n        let now = NSDate()\n        let data = Data(\"fizzbuzz\".utf8) as NSData\n        try! realm.write {\n            object = SwiftObjectiveCTypesObject()\n            realm.add(object)\n            object.stringCol = \"Hello world!\"\n            object.dateCol = now\n            object.dataCol = data\n        }\n        XCTAssertEqual(\"Hello world!\", object.stringCol)\n        XCTAssertEqual(now, object.dateCol)\n        XCTAssertEqual(data, object.dataCol)\n    }\n\n    // MARK: - Observation tests\n\n    func testObserveUnmanagedObject() {\n        assertThrows(SwiftIntObject().observe { _ in }, reason: \"managed\")\n        assertThrows(SwiftIntObject().observe(keyPaths: [\"intCol\"]) { _ in }, reason: \"managed\")\n    }\n\n    @MainActor\n    func testDeleteObservedObject() throws {\n        let realm = try Realm()\n        realm.beginWrite()\n        let object0 = realm.create(SwiftIntObject.self, value: [0])\n        let object1 = realm.create(SwiftIntObject.self, value: [0])\n        try realm.commitWrite()\n\n        let exp0 = expectation(description: \"Delete observed object\")\n        let token0 = object0.observe { change in\n            guard case .deleted = change else {\n                XCTFail(\"expected .deleted, got \\(change)\")\n                return\n            }\n            exp0.fulfill()\n        }\n\n        let exp1 = expectation(description: \"Delete observed object\")\n        let token1 = object1.observe(keyPaths: [\"intCol\"]) { change in\n            guard case .deleted = change else {\n                XCTFail(\"expected .deleted, got \\(change)\")\n                return\n            }\n            exp1.fulfill()\n        }\n\n        realm.beginWrite()\n        realm.delete(object0)\n        realm.delete(object1)\n        try realm.commitWrite()\n\n        waitForExpectations(timeout: 1)\n        token0.invalidate()\n        token1.invalidate()\n    }\n\n    func createObject(_ value: Int = 0) throws -> SwiftObject {\n        let realm = try Realm()\n        return try realm.write {\n            realm.create(SwiftObject.self, value: [\"intCol\": value])\n        }\n    }\n\n    func testObserveInvalidKeyPath() throws {\n        let object = try createObject()\n        assertThrows(object.observe(keyPaths: [\"notAProperty\"], { _ in }),\n                     reason: \"property 'notAProperty' not found in object of type 'SwiftObject'\")\n        assertThrows(object.observe(keyPaths: [\"arrayCol.alsoNotAProperty\"], { _ in }),\n                     reason: \"property 'alsoNotAProperty' not found in object of type 'SwiftBoolObject'\")\n    }\n\n    func checkChange<T: Equatable, U: Equatable>(_ name: String, _ old: T?, _ new: U?, _ change: ObjectChange<ObjectBase>) {\n        if case .change(_, let properties) = change {\n            XCTAssertEqual(properties.count, 1)\n            if let prop = properties.first {\n                XCTAssertEqual(prop.name, name)\n                XCTAssertEqual(prop.oldValue as? T, old)\n                XCTAssertEqual(prop.newValue as? U, new)\n            }\n        } else {\n            XCTFail(\"expected .change, got \\(change)\")\n        }\n    }\n\n    func expectChange<T: Equatable, U: Equatable>(_ name: String, _ old: T?, _ new: U?, _ inverted: Bool = false) -> ((ObjectChange<ObjectBase>) -> Void) {\n        let exp = expectation(description: \"change from \\(String(describing: old)) to \\(String(describing: new))\")\n        exp.isInverted = inverted\n        return { change in\n            self.checkChange(name, old, new, change)\n            exp.fulfill()\n        }\n    }\n\n    @MainActor\n    func testModifyObservedObjectLocally() throws {\n        let object = try createObject()\n        let token = object.observe(expectChange(\"intCol\", Int?.none, 2))\n        try object.realm!.write {\n            object.intCol = 2\n        }\n\n        waitForExpectations(timeout: 2)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testModifyObservedKeyPathLocally() throws {\n        let object = try createObject()\n        let token = object.observe(keyPaths: [\"intCol\"], expectChange(\"intCol\", Int?.none, 2))\n        try object.realm!.write {\n            object.intCol = 2\n        }\n        waitForExpectations(timeout: 0.1)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testModifyUnobservedKeyPathLocally() throws {\n        let object = try createObject()\n\n        // Expect no notification for \"boolCol\" keypath when \"intCol\" is modified\n        let ex = expectation(description: \"no change\")\n        ex.isInverted = true\n        let token = object.observe(keyPaths: [\"boolCol\"]) { _ in\n            ex.fulfill()\n        }\n        try object.realm!.write {\n            object.intCol = 3\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testModifyMultipleObservedPartialKeyPathLocally() throws {\n        let object = try createObject()\n\n        // Expect notification for \"intCol\" keyPath when \"intCol\" is modified\n        var ex = expectation(description: \"expect notification\")\n        var token = object.observe(keyPaths: [\\SwiftObject.intCol, \\SwiftObject.stringCol]) { changes in\n            if case .change(_, let properties) = changes {\n                XCTAssertEqual(properties.count, 1)\n                XCTAssertEqual(properties[0].newValue as! Int, 2)\n                ex.fulfill()\n            }\n        }\n        try object.realm!.write {\n            object.intCol = 2\n        }\n        waitForExpectations(timeout: 0.1)\n        token.invalidate()\n\n        // Expect notification for \"stringCol\" keyPath when \"stringCol\" is modified\n        ex = expectation(description: \"expect notification\")\n        token = object.observe(keyPaths: [\\SwiftObject.intCol, \\SwiftObject.stringCol]) { changes in\n            if case .change(_, let properties) = changes {\n                nonisolated(unsafe) let p = properties // this appears to be an autoclosure bug\n                XCTAssertEqual(p.count, 1)\n                XCTAssertEqual(p[0].newValue as! String, \"new string\")\n                ex.fulfill()\n            }\n        }\n        try object.realm!.write {\n            object.stringCol = \"new string\"\n        }\n        waitForExpectations(timeout: 0.1)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testModifyUnobservedPartialKeyPathLocally() throws {\n        let object = try createObject()\n\n        // Expect no notification for \"boolCol\" keypath when \"intCol\" is modified\n        let ex = expectation(description: \"no change\")\n        ex.isInverted = true\n        let token = object.observe(keyPaths: [\\SwiftObject.boolCol, \\SwiftObject.stringCol]) { _ in\n            ex.fulfill()\n        }\n        try object.realm!.write {\n            object.intCol = 3\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testModifyObservedObjectRemotely() throws {\n        let object = try createObject(1)\n\n        let token = object.observe(expectChange(\"intCol\", 1, 2))\n        dispatchSyncNewThread { @Sendable in\n            let realm = try! Realm()\n            try! realm.write {\n                realm.objects(SwiftObject.self).first!.intCol = 2\n            }\n        }\n\n        object.realm!.refresh()\n        waitForExpectations(timeout: 0)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testModifyObservedKeyPathRemotely() throws {\n        let object = try createObject(123)\n\n        // Expect notification for \"intCol\" keyPath when \"intCol\" is modified\n        let token = object.observe(keyPaths: [\"intCol\"], expectChange(\"intCol\", 123, 2))\n        dispatchSyncNewThread { @Sendable in\n            let realm = try! Realm()\n            try! realm.write {\n                realm.objects(SwiftObject.self).first!.intCol = 2\n            }\n        }\n        object.realm!.refresh()\n        waitForExpectations(timeout: 0.1)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testModifyUnobservedKeyPathRemotely() throws {\n        let object = try createObject()\n\n        // Expect no notification for \"boolCol\" keypath when \"intCol\" is modified\n        let ex = expectation(description: \"no change\")\n        ex.isInverted = true\n        let token = object.observe(keyPaths: [\"boolCol\"]) { _ in\n            ex.fulfill()\n        }\n\n        dispatchSyncNewThread { @Sendable in\n            let realm = try! Realm()\n            try! realm.write {\n                let first = realm.objects(SwiftObject.self).first!\n                first.intCol += 1\n            }\n        }\n        object.realm!.refresh()\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testListPropertyNotifications() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let object = realm.create(SwiftRecursiveObject.self)\n        try! realm.commitWrite()\n\n        let token = object.observe(expectChange(\"objects\", Int?.none, Int?.none))\n        dispatchSyncNewThread { @Sendable in\n            let realm = try! Realm()\n            try! realm.write {\n                let obj = realm.objects(SwiftRecursiveObject.self).first!\n                obj.objects.append(obj)\n            }\n        }\n\n        waitForExpectations(timeout: 2)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testListPropertyKeyPathNotifications() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let employee = realm.create(SwiftEmployeeObject.self)\n        let company = realm.create(SwiftCompanyObject.self)\n        company.employees.append(employee)\n        try! realm.commitWrite()\n\n        // Expect no notification for \"employees\" when \"employee.hired\" is changed\n        var ex = expectation(description: \"no change notification\")\n        ex.isInverted = true\n        var token = company.observe(keyPaths: [\"employees\"], { _ in\n            ex.fulfill()\n        })\n        try! realm.write {\n            employee.hired = true\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n\n        // Expect a notification for \"employees.hired\" when \"employee.hired\" is changed\n        token = company.observe(keyPaths: [\"employees.hired\"], expectChange(\"employees\", Int?.none, Int?.none))\n        try! realm.write {\n            XCTAssertTrue(employee.hired)\n            employee.hired = false\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n\n        // Expect no notification for \"employees.hired\" when \"employee.age\" is changed.\n        ex = expectation(description: \"no change notification\")\n        ex.isInverted = true\n        token = company.observe(keyPaths: [\"employees.hired\"], { _ in\n            ex.fulfill()\n        })\n        try! realm.write {\n            employee.age = 35\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n\n        // Expect notification for \"employees.hired\" when an employee is deleted.\n        token = company.observe(keyPaths: [\"employees.hired\"], expectChange(\"employees\", Int?.none, Int?.none))\n        try! realm.write {\n            realm.delete(employee)\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n\n        // Expect notification for \"employees.hired\" when an employee is added.\n        token = company.observe(keyPaths: [\"employees.hired\"], expectChange(\"employees\", Int?.none, Int?.none))\n        try! realm.write {\n            let employee2 = realm.create(SwiftEmployeeObject.self)\n            company.employees.append(employee2)\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n\n        // Expect notification for \"employees.hired\" when an employee is reassigned.\n        token = company.observe(keyPaths: [\"employees.hired\"], expectChange(\"employees\", Int?.none, Int?.none))\n        try! realm.write {\n            let employee3 = realm.create(SwiftEmployeeObject.self)\n            company.employees[0] = employee3\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n\n        // Expect notification for \"employees\" when an employee is added.\n        token = company.observe(keyPaths: [\"employees\"], expectChange(\"employees\", Int?.none, Int?.none))\n        try! realm.write {\n            let employee4 = realm.create(SwiftEmployeeObject.self)\n            company.employees.append(employee4)\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n\n        // Expect notification for \"employees\" when an employee is reassigned.\n        token = company.observe(keyPaths: [\"employees\"], expectChange(\"employees\", Int?.none, Int?.none))\n        try! realm.write {\n            let employee5 = realm.create(SwiftEmployeeObject.self)\n            company.employees[0] = employee5\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n\n        // Expect no notification for \"employees\" when \"company.name\" is changed\n        ex = expectation(description: \"no change notification\")\n        ex.isInverted = true\n        token = company.observe(keyPaths: [\"employees\"], { _ in\n            ex.fulfill()\n        })\n        try! realm.write {\n            company.name = \"changed\"\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testLinkPropertyKeyPathNotifications1() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let person = realm.create(SwiftOwnerObject.self)\n        let dog = realm.create(SwiftDogObject.self)\n        person.dog = dog\n        try! realm.commitWrite()\n\n        // Expect notification for \"dog.dogName\" when \"dog.dogName\" is changed\n        let token = person.observe(keyPaths: [\"dog.dogName\"], expectChange(\"dog\", Int?.none, Int?.none))\n        try! realm.write {\n            dog.dogName = \"rex\"\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testLinkPropertyKeyPathNotifications2() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let person = realm.create(SwiftOwnerObject.self)\n        let dog = realm.create(SwiftDogObject.self)\n        person.dog = dog\n        try! realm.commitWrite()\n\n        // Expect notification for \"dog.dogName\" when \"dog\" is reassigned.\n        let token = person.observe(keyPaths: [\"dog.dogName\"], expectChange(\"dog\", Int?.none, Int?.none))\n        try! realm.write {\n            let newDog = SwiftDogObject()\n            person.dog = newDog\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testLinkPropertyKeyPathNotifications3() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let person = realm.create(SwiftOwnerObject.self)\n        let dog = realm.create(SwiftDogObject.self)\n        person.dog = dog\n        try! realm.commitWrite()\n\n        // Expect no notification for \"dog\" when \"person.name\" is changed\n        let ex = expectation(description: \"no change notification\")\n        ex.isInverted = true\n        let token = person.observe(keyPaths: [\"dog\"], { _ in\n            ex.fulfill()\n        })\n        try! realm.write {\n            person.name = \"Teddy\"\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testLinkPropertyKeyPathNotifications4() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let person = realm.create(SwiftOwnerObject.self)\n        let dog = realm.create(SwiftDogObject.self)\n        person.dog = dog\n        try! realm.commitWrite()\n\n        // Expect no notification for \"dog\" when \"dog.dogName\" is changed\n        let ex = expectation(description: \"no change notification\")\n        ex.isInverted = true\n        let token = person.observe(keyPaths: [\"dog\"], {_ in\n            ex.fulfill()\n        })\n        try! realm.write {\n            dog.dogName = \"fido\"\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testBacklinkPropertyKeyPathNotifications1() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let person = realm.create(SwiftOwnerObject.self)\n        let dog = realm.create(SwiftDogObject.self)\n        person.dog = dog\n        try! realm.commitWrite()\n\n        // Expect no notification for \"owners\" when \"dog.dogName\" is changed\n        let ex = expectation(description: \"no change notification\")\n        ex.isInverted = true\n        let token = dog.observe(keyPaths: [\"owners\"], { _ in\n            ex.fulfill()\n        })\n        try! realm.write {\n            dog.dogName = \"fido\"\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testBacklinkPropertyKeyPathNotifications2() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let person = realm.create(SwiftOwnerObject.self)\n        let dog = realm.create(SwiftDogObject.self)\n        person.dog = dog\n        try! realm.commitWrite()\n\n        // Expect no notification for \"owners\" when \"owner.name\" is changed\n        let ex = expectation(description: \"no change notification\")\n        ex.isInverted = true\n        let token = dog.observe(keyPaths: [\"owners\"], { _ in\n            ex.fulfill()\n        })\n        try! realm.write {\n            let owner = dog.owners.first!\n            owner.name = \"Tom\"\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testBacklinkPropertyKeyPathNotifications3() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let person = realm.create(SwiftOwnerObject.self)\n        let dog = realm.create(SwiftDogObject.self)\n        person.dog = dog\n        try! realm.commitWrite()\n\n        // Expect notification for \"owners.name\" when \"owner.name\" is changed\n        let token = dog.observe(keyPaths: [\"owners.name\"], expectChange(\"owners\", String?.none, String?.none))\n        try! realm.write {\n            let owner = dog.owners.first!\n            owner.name = \"Abe\"\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testBacklinkPropertyKeyPathNotifications4() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let person = realm.create(SwiftOwnerObject.self)\n        let dog = realm.create(SwiftDogObject.self)\n        person.dog = dog\n        try! realm.commitWrite()\n\n        // Expect notification for \"owners\" when a new owner is added.\n        let token = dog.observe(keyPaths: [\"owners\"], expectChange(\"owners\", Int?.none, Int?.none))\n        try! realm.write {\n            let newPerson = SwiftOwnerObject()\n            realm.add(newPerson)\n            newPerson.dog = dog\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testBacklinkPropertyKeyPathNotifications5() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let person = realm.create(SwiftOwnerObject.self)\n        let dog = realm.create(SwiftDogObject.self)\n        person.dog = dog\n        try! realm.commitWrite()\n\n        // Expect notification for \"owners.name\" when a new owner is added.\n        let token = dog.observe(keyPaths: [\"owners.name\"], expectChange(\"owners\", Int?.none, Int?.none))\n        try! realm.write {\n            let newPerson = SwiftOwnerObject()\n            realm.add(newPerson)\n            newPerson.dog = dog\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n}\n\n    @MainActor\n    func testMutableSetPropertyNotifications() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let object = realm.create(SwiftRecursiveObject.self)\n        try! realm.commitWrite()\n\n        let token = object.observe(expectChange(\"objectSet\", Int?.none, Int?.none))\n        dispatchSyncNewThread { @Sendable in\n            let realm = try! Realm()\n            try! realm.write {\n                let obj = realm.objects(SwiftRecursiveObject.self).first!\n                obj.objectSet.insert(obj)\n            }\n        }\n\n        waitForExpectations(timeout: 2)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testOptionalPropertyNotifications() {\n        let realm = try! Realm()\n        let object = SwiftOptionalDefaultValuesObject()\n        try! realm.write {\n            realm.add(object)\n        }\n\n        var token = object.observe(expectChange(\"optIntCol\", 1, 2))\n        dispatchSyncNewThread { @Sendable in\n            let realm = try! Realm()\n            try! realm.write {\n                realm.objects(SwiftOptionalDefaultValuesObject.self).first!.optIntCol.value = 2\n            }\n        }\n        realm.refresh()\n        waitForExpectations(timeout: 0)\n        token.invalidate()\n\n        token = object.observe(expectChange(\"optIntCol\", 2, Int?.none))\n        dispatchSyncNewThread { @Sendable in\n            let realm = try! Realm()\n            try! realm.write {\n                realm.objects(SwiftOptionalDefaultValuesObject.self).first!.optIntCol.value = nil\n            }\n        }\n        realm.refresh()\n        waitForExpectations(timeout: 0)\n        token.invalidate()\n\n        token = object.observe(expectChange(\"optIntCol\", Int?.none, 3))\n        dispatchSyncNewThread { @Sendable in\n            let realm = try! Realm()\n            try! realm.write {\n                realm.objects(SwiftOptionalDefaultValuesObject.self).first!.optIntCol.value = 3\n            }\n        }\n        realm.refresh()\n        waitForExpectations(timeout: 0)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testOptionalPropertyKeyPathNotifications() {\n        let realm = try! Realm()\n        let object = SwiftOptionalDefaultValuesObject()\n        try! realm.write {\n            realm.add(object)\n        }\n\n        // Expect notification for change on observed path\n        var token = object.observe(keyPaths: [\"optIntCol\"], expectChange(\"optIntCol\", 1, 2))\n        dispatchSyncNewThread { @Sendable in\n            let realm = try! Realm()\n            try! realm.write {\n                realm.objects(SwiftOptionalDefaultValuesObject.self).first!.optIntCol.value = 2\n            }\n        }\n        realm.refresh()\n        waitForExpectations(timeout: 0)\n        token.invalidate()\n\n        // Expect no notification for change outside of observed path\n        token = object.observe(keyPaths: [\"optStringCol\"], expectChange(\"optIntCol\", 2, 3, true)) // Passing true inverts expectation\n        dispatchSyncNewThread { @Sendable in\n            let realm = try! Realm()\n            try! realm.write {\n                realm.objects(SwiftOptionalDefaultValuesObject.self).first!.optIntCol.value = 3\n            }\n        }\n        realm.refresh()\n        waitForExpectations(timeout: 0)\n        token.invalidate()\n\n        // Expect notification for change from value to nil on observed path\n        token = object.observe(keyPaths: [\"optIntCol\"], expectChange(\"optIntCol\", 3, Int?.none))\n        dispatchSyncNewThread { @Sendable in\n            let realm = try! Realm()\n            try! realm.write {\n                realm.objects(SwiftOptionalDefaultValuesObject.self).first!.optIntCol.value = nil\n            }\n        }\n        realm.refresh()\n        waitForExpectations(timeout: 0)\n        token.invalidate()\n\n        // Expect notification for change from nil to value on observed path\n        token = object.observe(keyPaths: [\"optIntCol\"], expectChange(\"optIntCol\", Int?.none, 2))\n        dispatchSyncNewThread { @Sendable in\n            let realm = try! Realm()\n            try! realm.write {\n                realm.objects(SwiftOptionalDefaultValuesObject.self).first!.optIntCol.value = 2\n            }\n        }\n        realm.refresh()\n        waitForExpectations(timeout: 0)\n        token.invalidate()\n    }\n\n    func testObserveOnDifferentQueue() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let object = realm.create(SwiftIntObject.self, value: [1])\n        try! realm.commitWrite()\n\n        let queue = DispatchQueue(label: \"label\")\n        let sema = DispatchSemaphore(value: 0)\n        let token = object.observe(on: queue) { change in\n            self.checkChange(\"intCol\", 1, 2, change)\n            sema.signal()\n        }\n        // wait for the notification to be registered as otherwise it may not\n        // have the old value\n        queue.sync { }\n        try! realm.write {\n            object.intCol = 2\n        }\n\n        sema.wait()\n        token.invalidate()\n        queue.sync { }\n    }\n\n    func testObserveKeyPathOnDifferentQueue() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let object = realm.create(SwiftObject.self)\n        object.intCol = 1\n        try! realm.commitWrite()\n\n        let queue = DispatchQueue(label: \"label\")\n        let sema = DispatchSemaphore(value: 0)\n        let token = object.observe(keyPaths: [\"intCol\"], on: queue) { change in\n            self.checkChange(\"intCol\", 1, 2, change)\n            sema.signal()\n        }\n\n        // wait for the notification to be registered as otherwise it may not\n        // have the old value\n        queue.sync { }\n        try! realm.write {\n            object.intCol = 2\n        }\n\n        sema.wait()\n        token.invalidate()\n        queue.sync { }\n    }\n\n    func testInvalidateObserverOnDifferentQueueBeforeRegistration() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let object = realm.create(SwiftIntObject.self, value: [1])\n        try! realm.commitWrite()\n\n        let queue = DispatchQueue(label: \"label\")\n        let sema = DispatchSemaphore(value: 0)\n\n        // Block the queue for now\n        queue.async { sema.wait() }\n\n        // Add two observers, invalidating one\n        let token1 = object.observe(on: queue) { _ in\n            XCTFail(\"notification should not have fired\")\n        }\n        let token2 = object.observe(on: queue) { _ in\n            sema.signal()\n        }\n        token1.invalidate()\n\n        // Now let token2 registration happen\n        sema.signal()\n        queue.sync { }\n\n        // Perform a write and make sure only token2 notifies\n        try! realm.write {\n            object.intCol = 2\n        }\n        sema.wait()\n        token2.invalidate()\n        queue.sync { }\n    }\n\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    func expectChange<T: Object>(_ obj: T, _ ex: XCTestExpectation, newValue: Int)\n    -> @Sendable (isolated CustomGlobalActor, ObjectChange<T>) -> Void {\n        nonisolated(unsafe) let unchecked = obj\n        return { _, change in\n            XCTAssertFalse(Thread.isMainThread)\n            guard case let .change(object, props) = change else {\n                return XCTFail(\"Expected change event but got \\(change))\")\n            }\n            XCTAssertNotIdentical(unchecked, object)\n            XCTAssertEqual(RLMObjectBaseGetCombineId(unchecked), RLMObjectBaseGetCombineId(object))\n            XCTAssertEqual(props.count, 1)\n            XCTAssertEqual(props[0].name, \"intCol\")\n            XCTAssertEqual(props[0].oldValue! as! Int, 0)\n            XCTAssertEqual(props[0].newValue! as! Int, newValue)\n            ex.fulfill()\n        }\n    }\n\n    @MainActor\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    func testObserveOnActor() async throws {\n        let obj1 = try createObject()\n        let obj2 = try createObject()\n        let ex1 = expectation(description: \"first object\")\n        let ex2 = expectation(description: \"second object\")\n        let tokens = await [\n            obj1.observe(keyPaths: [\"intCol\"], on: CustomGlobalActor.shared,\n                               expectChange(obj1, ex1, newValue: 2)),\n            obj2.observe(keyPaths: [\\SwiftObject.intCol],\n                               on: CustomGlobalActor.shared,\n                               expectChange(obj2, ex2, newValue: 3))\n        ]\n\n        let realm = obj1.realm!\n        try await realm.asyncWrite {\n            obj1.boolCol = true\n            obj2.boolCol = true\n        }\n        try await realm.asyncWrite {\n            obj1.intCol = 2\n            obj2.intCol = 3\n        }\n        await fulfillment(of: [ex1, ex2], timeout: 2.0)\n        tokens.forEach { $0.invalidate() }\n    }\n\n#if swift(<6) // FIXME: need async iterator implementation\n    // This test consistently crashes inside the Swift runtime when building\n    // with SPM.\n    @MainActor\n    @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *)\n    func testAsyncSequenceObserve() async throws {\n        let obj = try createObject()\n        let ex = Locked(expectation(description: \"got value\"))\n        let task = Task { @MainActor in\n            var value = 0\n            for try await object in valuePublisher(obj).values {\n                XCTAssertIdentical(object, obj)\n                value += 1\n                XCTAssertEqual(object.intCol, value)\n                ex.wrappedValue.fulfill()\n            }\n        }\n\n        for i in 1..<10 {\n            try await obj.realm!.asyncWrite {\n                obj.intCol += 1\n            }\n            await fulfillment(of: [ex.wrappedValue])\n            if i < 9 {\n                ex.wrappedValue = expectation(description: \"got value\")\n            }\n        }\n        task.cancel()\n        _ = try await task.value\n    }\n\n    @MainActor\n    @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *)\n    func testAsyncSequenceObserveCustomActor() async throws {\n        let obj = try createObject()\n        let ex = Locked(expectation(description: \"got next\"))\n        let task = Task { @CustomGlobalActor in\n            let realm = try await Realm(actor: CustomGlobalActor.shared)\n            let obj = realm.objects(SwiftObject.self).first!\n            var value = 0\n            for try await change in changesetPublisher(obj).values {\n                guard case let .change(object, props) = change else {\n                    return XCTFail(\"Expected .change, got \\(change)\")\n                }\n                XCTAssertIdentical(object, obj)\n                value += 1\n                XCTAssertEqual(object.intCol, value)\n                XCTAssertEqual(props.count, 1)\n                let prop = props[0]\n                XCTAssertEqual(prop.name, \"intCol\")\n                XCTAssertEqual(prop.oldValue as? Int, value - 1)\n                XCTAssertEqual(prop.newValue as? Int, value)\n                ex.wrappedValue.fulfill()\n            }\n            XCTAssertEqual(value, 9)\n            ex.wrappedValue.fulfill()\n        }\n\n        // Use a dummy observation as synchronization to reduce the chance of\n        // writing before the notifier is ready\n        let token = await obj.observe(on: CustomGlobalActor.shared) { (_, _) in }\n\n        for _ in 1..<10 {\n            try await obj.realm!.asyncWrite {\n                obj.intCol += 1\n            }\n            await fulfillment(of: [ex.wrappedValue])\n            ex.wrappedValue = expectation(description: \"got next\")\n        }\n\n        try await obj.realm!.asyncWrite {\n            obj.realm!.delete(obj)\n        }\n        await fulfillment(of: [ex.wrappedValue])\n        _ = try await task.value\n        token.invalidate()\n    }\n#endif\n\n    @MainActor\n    @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *)\n    func testObserveOnAlreadyCancelledTask() async throws {\n        let obj = try createObject()\n        _ = await Task { @MainActor in\n            withUnsafeCurrentTask { task in\n                task?.cancel()\n            }\n            let token = await obj.observe(on: MainActor.shared) { _, _ in\n                XCTFail(\"should not have been called\")\n            }\n            XCTAssertFalse(token.invalidate())\n        }.value\n    }\n\n    @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *)\n    func testCancelTaskWhileWaitingForInitial() async throws {\n        // This can't be tested deterministically as it's trying to hit specific\n        // timing windows, so instead spawn a bunch of tasks and hope that at\n        // least one is in each of the interesting states. Not handling all of\n        // the cancel timing correctly is likely to make this test either crash\n        // or hang (if there's some scenario where we fail to call the completion\n        // handler).\n        _ = try createObject().realm!\n        let waitingForRealm = Locked(0)\n        let active = Locked(0)\n        let completed = Locked(0)\n        await withTaskGroup(of: NotificationToken.self) { group in\n            while active.value < 10 {\n                group.addTask { @Sendable @CustomGlobalActor in\n                    waitingForRealm.withLock { $0 += 1 }\n                    // can throw due to cancellation\n                    guard let realm = try? await openRealm(actor: CustomGlobalActor.shared) else {\n                        waitingForRealm.withLock { $0 -= 1 }\n                        return NotificationToken()\n                    }\n                    waitingForRealm.withLock { $0 -= 1 }\n                    active.withLock { $0 += 1 }\n                    let token = await realm.objects(SwiftObject.self).first!.observe(on: CustomGlobalActor.shared) { _, _ in }\n                    completed.withLock { $0 += 1 }\n                    return token\n                }\n\n                // Actor executors aren't fifo, so we can sometimes prevent the\n                // async opens from ever completing by continuously spawning new\n                // tasks\n                while waitingForRealm.value >= 10 {\n                    await Task.yield()\n                }\n            }\n            group.cancelAll()\n            await group.waitForAll()\n            XCTAssertEqual(waitingForRealm.value, 0)\n            XCTAssertEqual(active.value, completed.value)\n        }\n    }\n\n    // MARK: Equality Tests\n\n    func testEqualityForObjectTypeWithPrimaryKey() {\n        let realm = try! Realm()\n        let pk = \"123456\"\n\n        let testObject = SwiftPrimaryStringObject()\n        testObject.stringCol = pk\n        testObject.intCol = 12345\n\n        let unmanaged = SwiftPrimaryStringObject()\n        unmanaged.stringCol = pk\n        unmanaged.intCol = 12345\n\n        let otherObject = SwiftPrimaryStringObject()\n        otherObject.stringCol = \"not\" + pk\n        otherObject.intCol = 12345\n\n        try! realm.write {\n            realm.add([testObject, otherObject])\n        }\n\n        // Should not match an object that's not equal.\n        XCTAssertNotEqual(testObject, otherObject)\n\n        // Should not match an object whose fields are equal if it's not the same row in the database.\n        XCTAssertNotEqual(testObject, unmanaged)\n\n        // Should match an object that represents the same row.\n        let retrievedObject = realm.object(ofType: SwiftPrimaryStringObject.self, forPrimaryKey: pk)!\n        XCTAssertEqual(testObject, retrievedObject)\n        XCTAssertEqual(testObject.hash, retrievedObject.hash)\n        XCTAssertTrue(testObject.isSameObject(as: retrievedObject))\n    }\n\n    func testEqualityForObjectTypeWithoutPrimaryKey() {\n        let realm = try! Realm()\n        let pk = \"123456\"\n        XCTAssertNil(SwiftStringObject.primaryKey())\n\n        let testObject = SwiftStringObject()\n        testObject.stringCol = pk\n\n        let alias = testObject\n\n        try! realm.write {\n            realm.add(testObject)\n        }\n\n        XCTAssertEqual(testObject, alias)\n\n        // Should not match an object even if it represents the same row.\n        let retrievedObject = realm.objects(SwiftStringObject.self).first!\n        XCTAssertNotEqual(testObject, retrievedObject)\n\n        // Should be able to use `isSameObject(as:)` to check if same row in the database.\n        XCTAssertTrue(testObject.isSameObject(as: retrievedObject))\n    }\n\n    func testEqualityForFrozenObjectTypeWithoutPrimaryKey() {\n        let realm = try! Realm()\n        let testObject = try! realm.write {\n            realm.create(SwiftStringObject.self)\n        }\n\n        let frozen = testObject.freeze()\n        let retrievedObject = realm.objects(SwiftStringObject.self).first!.freeze()\n        XCTAssertEqual(frozen, retrievedObject)\n    }\n\n    func testRetrievingObjectWithRuntimeType() {\n        let realm = try! Realm()\n\n        let unmanagedStringObject = SwiftPrimaryStringObject()\n        unmanagedStringObject.stringCol = UUID().uuidString\n        let managedStringObject = SwiftPrimaryStringObject()\n        managedStringObject.stringCol = UUID().uuidString\n\n        // Add the object.\n        try! realm.write {\n            realm.add(managedStringObject)\n        }\n\n        // Shouldn't throw when using type(of:).\n        XCTAssertNotNil(realm.object(ofType: type(of: unmanagedStringObject),\n                                     forPrimaryKey: managedStringObject.stringCol))\n\n        // Shouldn't throw when using type(of:).\n        XCTAssertNotNil(realm.object(ofType: type(of: managedStringObject),\n                                     forPrimaryKey: managedStringObject.stringCol))\n    }\n\n    func testRetrievingObjectsWithRuntimeType() {\n        let realm = try! Realm()\n\n        let unmanagedStringObject = SwiftStringObject()\n        unmanagedStringObject.stringCol = \"foo\"\n        let managedStringObject = SwiftStringObject()\n        managedStringObject.stringCol = \"bar\"\n\n        // Add the object.\n        try! realm.write {\n            realm.add(managedStringObject)\n        }\n\n        // Shouldn't throw when using type(of:).\n        XCTAssertEqual(realm.objects(type(of: unmanagedStringObject)).count, 1)\n\n        // Shouldn't throw when using type(of:).\n        XCTAssertEqual(realm.objects(type(of: managedStringObject)).count, 1)\n    }\n\n    // MARK: Frozen Objects Tests\n\n    func testIsFrozen() {\n        let obj = SwiftStringObject()\n        XCTAssertFalse(obj.isFrozen)\n\n        let realm = try! Realm()\n        try! realm.write { realm.add(obj) }\n        XCTAssertFalse(obj.isFrozen)\n\n        let frozen = obj.freeze()\n        XCTAssertFalse(obj.isFrozen)\n        XCTAssertTrue(frozen.isFrozen)\n    }\n\n    func testFreezeUnmanaged() {\n        assertThrows(SwiftStringObject().freeze(), reason: \"Unmanaged objects cannot be frozen.\")\n    }\n\n    func testModifyFrozenObject() {\n        let obj = SwiftStringObject()\n        XCTAssertFalse(obj.isFrozen)\n\n        let realm = try! Realm()\n        try! realm.write {\n            realm.add(obj)\n        }\n\n        let frozenObj = obj.freeze()\n\n        assertThrows(frozenObj.stringCol = \"foo\",\n                     reason: \"Attempting to modify a frozen object - call thaw on the Object instance first.\")\n    }\n\n    func testFreezeDynamicObject() {\n        let realm = try! Realm()\n        try! realm.write {\n            realm.create(SwiftObject.self, value: [\"arrayCol\": [[true]], \"setCol\": [[true]]])\n        }\n        let obj = realm.dynamicObjects(\"SwiftObject\").first!.freeze()\n        XCTAssertTrue(obj.isFrozen)\n        XCTAssertTrue(obj.dynamicList(\"arrayCol\").isFrozen)\n        XCTAssertTrue(obj.dynamicList(\"arrayCol\").first!.isFrozen)\n        XCTAssertTrue(obj.dynamicMutableSet(\"setCol\").isFrozen)\n        XCTAssertTrue(obj.dynamicMutableSet(\"setCol\").first!.isFrozen)\n    }\n\n    func testFreezeAllPropertyTypes() {\n        let realm = try! Realm()\n        let (obj, optObj, listObj) = try! realm.write {\n            return (\n                realm.create(SwiftObject.self, value: [\n                    \"boolCol\": true,\n                    \"intCol\": 456,\n                    \"floatCol\": 4.56 as Float,\n                    \"doubleCol\": 45.6,\n                    \"stringCol\": \"b\",\n                    \"binaryCol\": Data(\"b\".utf8),\n                    \"dateCol\": Date(timeIntervalSince1970: 2),\n                    \"objectCol\": [true],\n                    \"uuidCol\": UUID(),\n                    \"anyCol\": \"hello\"\n                ]),\n                realm.create(SwiftOptionalObject.self, value: [\n                    \"optNSStringCol\": \"NSString\",\n                    \"optStringCol\": \"String\",\n                    \"optBinaryCol\": Data(),\n                    \"optDateCol\": Date(),\n                    \"optIntCol\": 1,\n                    \"optInt8Col\": 2,\n                    \"optInt16Col\": 3,\n                    \"optInt32Col\": 4,\n                    \"optInt64Col\": 5,\n                    \"optFloatCol\": 6.1,\n                    \"optDoubleCol\": 7.2,\n                    \"optBoolCol\": true\n                ]),\n                realm.create(SwiftListObject.self, value: [\n                    \"int\": [1],\n                    \"int8\": [2],\n                    \"int16\": [3],\n                    \"int32\": [4],\n                    \"int64\": [5],\n                    \"float\": [6.6 as Float],\n                    \"double\": [7.7],\n                    \"string\": [\"8\"],\n                    \"data\": [Data(\"9\".utf8)],\n                    \"date\": [Date(timeIntervalSince1970: 10)],\n                    \"intOpt\": [11, nil],\n                    \"int8Opt\": [12, nil],\n                    \"int16Opt\": [13, nil],\n                    \"int32Opt\": [14, nil],\n                    \"int64Opt\": [15, nil],\n                    \"floatOpt\": [16.16, nil],\n                    \"doubleOpt\": [17.17, nil],\n                    \"stringOpt\": [\"18\", nil],\n                    \"dataOpt\": [Data(\"19\".utf8), nil],\n                    \"dateOpt\": [Date(timeIntervalSince1970: 20), nil],\n                    \"uuid\": [UUID()],\n                    \"uuidOpt\": [UUID(), nil],\n                    \"any\": [\"hello\", nil]\n                ])\n            )\n        }\n\n        let frozenObj = obj.freeze()\n        XCTAssertEqual(obj.boolCol, frozenObj.boolCol)\n        XCTAssertEqual(obj.intCol, frozenObj.intCol)\n        XCTAssertEqual(obj.floatCol, frozenObj.floatCol)\n        XCTAssertEqual(obj.doubleCol, frozenObj.doubleCol)\n        XCTAssertEqual(obj.stringCol, frozenObj.stringCol)\n        XCTAssertEqual(obj.binaryCol, frozenObj.binaryCol)\n        XCTAssertEqual(obj.dateCol, frozenObj.dateCol)\n        XCTAssertEqual(obj.objectCol?.boolCol, frozenObj.objectCol?.boolCol)\n        XCTAssertEqual(obj.uuidCol, frozenObj.uuidCol)\n        XCTAssertEqual(obj.anyCol.value, frozenObj.anyCol.value)\n\n        let frozenOptObj = optObj.freeze()\n        XCTAssertEqual(optObj.optNSStringCol, frozenOptObj.optNSStringCol)\n        XCTAssertEqual(optObj.optStringCol, frozenOptObj.optStringCol)\n        XCTAssertEqual(optObj.optBinaryCol, frozenOptObj.optBinaryCol)\n        XCTAssertEqual(optObj.optDateCol, frozenOptObj.optDateCol)\n        XCTAssertEqual(optObj.optIntCol.value, frozenOptObj.optIntCol.value)\n        XCTAssertEqual(optObj.optInt8Col.value, frozenOptObj.optInt8Col.value)\n        XCTAssertEqual(optObj.optInt16Col.value, frozenOptObj.optInt16Col.value)\n        XCTAssertEqual(optObj.optInt32Col.value, frozenOptObj.optInt32Col.value)\n        XCTAssertEqual(optObj.optInt64Col.value, frozenOptObj.optInt64Col.value)\n        XCTAssertEqual(optObj.optFloatCol.value, frozenOptObj.optFloatCol.value)\n        XCTAssertEqual(optObj.optDoubleCol.value, frozenOptObj.optDoubleCol.value)\n        XCTAssertEqual(optObj.optBoolCol.value, frozenOptObj.optBoolCol.value)\n        XCTAssertEqual(optObj.optEnumCol.value, frozenOptObj.optEnumCol.value)\n        XCTAssertEqual(optObj.optUuidCol, frozenOptObj.optUuidCol)\n\n        let frozenListObj = listObj.freeze()\n        XCTAssertEqual(Array(listObj.int), Array(frozenListObj.int))\n        XCTAssertEqual(Array(listObj.int8), Array(frozenListObj.int8))\n        XCTAssertEqual(Array(listObj.int16), Array(frozenListObj.int16))\n        XCTAssertEqual(Array(listObj.int32), Array(frozenListObj.int32))\n        XCTAssertEqual(Array(listObj.int64), Array(frozenListObj.int64))\n        XCTAssertEqual(Array(listObj.float), Array(frozenListObj.float))\n        XCTAssertEqual(Array(listObj.double), Array(frozenListObj.double))\n        XCTAssertEqual(Array(listObj.string), Array(frozenListObj.string))\n        XCTAssertEqual(Array(listObj.data), Array(frozenListObj.data))\n        XCTAssertEqual(Array(listObj.date), Array(frozenListObj.date))\n        XCTAssertEqual(Array(listObj.intOpt), Array(frozenListObj.intOpt))\n        XCTAssertEqual(Array(listObj.int8Opt), Array(frozenListObj.int8Opt))\n        XCTAssertEqual(Array(listObj.int16Opt), Array(frozenListObj.int16Opt))\n        XCTAssertEqual(Array(listObj.int32Opt), Array(frozenListObj.int32Opt))\n        XCTAssertEqual(Array(listObj.int64Opt), Array(frozenListObj.int64Opt))\n        XCTAssertEqual(Array(listObj.floatOpt), Array(frozenListObj.floatOpt))\n        XCTAssertEqual(Array(listObj.doubleOpt), Array(frozenListObj.doubleOpt))\n        XCTAssertEqual(Array(listObj.stringOpt), Array(frozenListObj.stringOpt))\n        XCTAssertEqual(Array(listObj.dataOpt), Array(frozenListObj.dataOpt))\n        XCTAssertEqual(Array(listObj.dateOpt), Array(frozenListObj.dateOpt))\n        XCTAssertEqual(Array(listObj.uuid), Array(frozenListObj.uuid))\n        XCTAssertEqual(Array(listObj.uuidOpt), Array(frozenListObj.uuidOpt))\n        XCTAssertEqual(Array(listObj.any.map { $0 }), Array(frozenListObj.any.map { $0 }))\n    }\n\n    func testThaw() {\n        let realm = try! Realm()\n        let obj = try! realm.write {\n            realm.create(SwiftBoolObject.self, value: [\"boolCol\": true])\n        }\n\n        let frozenObj = obj.freeze()\n        XCTAssertTrue(frozenObj.isFrozen)\n        assertThrows(try! frozenObj.realm!.write {}, reason: \"Can't perform transactions on a frozen Realm\")\n\n        let liveObj = frozenObj.thaw()!\n        XCTAssertFalse(liveObj.isFrozen)\n        XCTAssertEqual(liveObj.boolCol, frozenObj.boolCol)\n\n        try! liveObj.realm!.write({ liveObj.boolCol = false })\n        XCTAssertNotEqual(liveObj.boolCol, frozenObj.boolCol)\n    }\n\n    func testThawUnmanaged() {\n        assertThrows(SwiftBoolObject().thaw(), reason: \"Unmanaged objects cannot be thawed.\")\n    }\n\n    func testThawDeleted() {\n        let realm = try! Realm()\n        let obj = try! realm.write {\n            realm.create(SwiftBoolObject.self, value: [\"boolCol\": true])\n        }\n\n        let frozen = obj.freeze()\n        try! realm.write { realm.delete(obj) }\n        XCTAssertNotNil(frozen)\n\n        let thawed = frozen.thaw()\n        XCTAssertNil(thawed, \"Thaw should return nil when object was deleted\")\n    }\n\n    func testThawPreviousVersion() {\n        let realm = try! Realm()\n        let obj = try! realm.write {\n            realm.create(SwiftBoolObject.self, value: [\"boolCol\": true])\n        }\n\n        let frozen = obj.freeze()\n        XCTAssertTrue(frozen.isFrozen)\n\n        try! obj.realm!.write { obj.boolCol = false }\n        XCTAssert(frozen.boolCol, \"Frozen objects shouldn't mutate\")\n\n        let thawed = frozen.thaw()!\n        XCTAssertFalse(thawed.isFrozen)\n        XCTAssertFalse(thawed.boolCol, \"Thaw should reflect transactions since the original reference was frozen\")\n    }\n\n    func testThawUpdatedOnDifferentThread() {\n        let obj = try! Realm().write {\n            try! Realm().create(SwiftBoolObject.self, value: [\"boolCol\": true])\n        }\n        let frozen = obj.freeze()\n        let thawed = frozen.thaw()!\n        let tsr = ThreadSafeReference(to: thawed)\n\n        dispatchSyncNewThread {\n            let resolved = try! Realm().resolve(tsr)!\n            try! Realm().write({ resolved.boolCol = false })\n        }\n\n        XCTAssert(frozen.thaw()!.boolCol)\n        XCTAssert(thawed.boolCol)\n        try! Realm().refresh()\n        XCTAssertFalse(frozen.thaw()!.boolCol)\n        XCTAssertFalse(thawed.boolCol)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/ObjectiveCSupportTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\nimport RealmSwift\nimport XCTest\n\nclass ObjectiveCSupportTests: TestCase {\n\n    func testSupport() {\n\n        let realm = try! Realm()\n\n        try! realm.write {\n            realm.add(SwiftObject())\n            return\n        }\n\n        let results = realm.objects(SwiftObject.self)\n        let rlmResults = ObjectiveCSupport.convert(object: results)\n        XCTAssert(rlmResults.isKind(of: RLMResults<AnyObject>.self))\n        XCTAssertEqual(rlmResults.count, 1)\n        XCTAssertEqual(unsafeBitCast(rlmResults.firstObject(), to: SwiftObject.self).intCol, 123)\n\n        let list = List<SwiftObject>()\n        list.append(SwiftObject())\n        let rlmArray = ObjectiveCSupport.convert(object: list)\n        XCTAssert(rlmArray.isKind(of: RLMArray<AnyObject>.self))\n        XCTAssertEqual(unsafeBitCast(rlmArray.firstObject(), to: SwiftObject.self).floatCol, 1.23)\n        XCTAssertEqual(rlmArray.count, 1)\n\n        let set = MutableSet<SwiftObject>()\n        set.insert(SwiftObject())\n        let rlmSet = ObjectiveCSupport.convert(object: set)\n        XCTAssert(rlmSet.isKind(of: RLMSet<AnyObject>.self))\n        XCTAssertEqual(unsafeDowncast(rlmSet.allObjects[0], to: SwiftObject.self).floatCol, 1.23)\n        XCTAssertEqual(rlmSet.count, 1)\n\n        let map = Map<String, SwiftObject?>()\n        map[\"0\"] = SwiftObject()\n        let rlmDictionary = ObjectiveCSupport.convert(object: map)\n        XCTAssert(rlmDictionary.isKind(of: RLMDictionary<AnyObject, AnyObject>.self))\n        XCTAssertEqual(unsafeDowncast(rlmDictionary.allValues[0], to: SwiftObject.self).floatCol, 1.23)\n        XCTAssertEqual(rlmDictionary.count, 1)\n\n        let rlmRealm = ObjectiveCSupport.convert(object: realm)\n        XCTAssert(rlmRealm.isKind(of: RLMRealm.self))\n        XCTAssertEqual(rlmRealm.allObjects(\"SwiftObject\").count, 1)\n\n        let sortDescriptor: RealmSwift.SortDescriptor = \"property\"\n        XCTAssertEqual(sortDescriptor.keyPath,\n                       ObjectiveCSupport.convert(object: sortDescriptor).keyPath,\n                       \"SortDescriptor.keyPath must be equal to RLMSortDescriptor.keyPath\")\n        XCTAssertEqual(sortDescriptor.ascending,\n                       ObjectiveCSupport.convert(object: sortDescriptor).ascending,\n                       \"SortDescriptor.ascending must be equal to RLMSortDescriptor.ascending\")\n    }\n\n    func testConfigurationSupport() {\n        let realm = try! Realm()\n\n        try! realm.write {\n            realm.add(SwiftObject())\n        }\n\n        XCTAssertEqual(realm.configuration.fileURL,\n                       ObjectiveCSupport.convert(object: realm.configuration).fileURL,\n                       \"Configuration.fileURL must be equal to RLMConfiguration.fileURL\")\n\n        XCTAssertEqual(realm.configuration.inMemoryIdentifier,\n                       ObjectiveCSupport.convert(object: realm.configuration).inMemoryIdentifier,\n                       \"Configuration.inMemoryIdentifier must be equal to RLMConfiguration.inMemoryIdentifier\")\n\n        XCTAssertEqual(realm.configuration.encryptionKey,\n                       ObjectiveCSupport.convert(object: realm.configuration).encryptionKey,\n                       \"Configuration.encryptionKey must be equal to RLMConfiguration.encryptionKey\")\n\n        XCTAssertEqual(realm.configuration.readOnly,\n                       ObjectiveCSupport.convert(object: realm.configuration).readOnly,\n                       \"Configuration.readOnly must be equal to RLMConfiguration.readOnly\")\n\n        XCTAssertEqual(realm.configuration.schemaVersion,\n                       ObjectiveCSupport.convert(object: realm.configuration).schemaVersion,\n                       \"Configuration.schemaVersion must be equal to RLMConfiguration.schemaVersion\")\n\n        XCTAssertEqual(realm.configuration.deleteRealmIfMigrationNeeded,\n                       ObjectiveCSupport.convert(object: realm.configuration).deleteRealmIfMigrationNeeded,\n                       \"Configuration.deleteRealmIfMigrationNeeded must be equal to RLMConfiguration.deleteRealmIfMigrationNeeded\")\n    }\n\n    func testAnyRealmValueSupport() {\n        let obj = SwiftObject()\n        let expected: [(RLMValue, AnyRealmValue)] = [\n            (NSNumber(1234), .int(1234)),\n            (NSNumber(value: true), .bool(true)),\n            (NSNumber(value: Float(1234.4567)), .float(1234.4567)),\n            (NSNumber(value: Double(1234.4567)), .double(1234.4567)),\n            (NSString(\"hello\"), .string(\"hello\")),\n            (NSData(data: Data.init(repeating: 0, count: 64)), .data(Data.init(repeating: 0, count: 64))),\n            (NSDate.init(timeIntervalSince1970: 1000000), .date(Date.init(timeIntervalSince1970: 1000000))),\n            (try! RLMObjectId(string: \"60425fff91d7a195d5ddac1b\"), .objectId(try! ObjectId(string: \"60425fff91d7a195d5ddac1b\"))),\n            (RLMDecimal128(number: 1234.4567), .decimal128(Decimal128(floatLiteral: 1234.4567))),\n            (NSUUID(uuidString: \"137DECC8-B300-4954-A233-F89909F4FD89\")!, .uuid(UUID(uuidString: \"137DECC8-B300-4954-A233-F89909F4FD89\")!)),\n            (obj, .object(obj))\n        ]\n\n        func testObjCSupport(_ objCValue: RLMValue, value: AnyRealmValue) {\n            XCTAssertEqual(ObjectiveCSupport.convert(value: objCValue), value)\n        }\n        expected.forEach { testObjCSupport($0.0, value: $0.1) }\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/PerformanceTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\n#endif\n\nprivate func createStringObjects(_ factor: Int) -> Realm {\n    let realm = inMemoryRealm(factor.description)\n    try! realm.write {\n        for _ in 0..<(1000 * factor) {\n            realm.create(SwiftStringObject.self, value: [\"a\"])\n            realm.create(SwiftStringObject.self, value: [\"b\"])\n            realm.create(SwiftIntObject.self, value: [1])\n            realm.create(SwiftIntObject.self, value: [2])\n        }\n    }\n    return realm\n}\n\nclass SwiftIntProjection: Projection<SwiftIntObject> {\n    @Projected(\\SwiftIntObject.intCol) var intCol\n}\n\nprivate nonisolated(unsafe) var smallRealm: Realm!\nprivate nonisolated(unsafe) var mediumRealm: Realm!\nprivate nonisolated(unsafe) var largeRealm: Realm!\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass SwiftPerformanceTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n#if !DEBUG && os(iOS) && !targetEnvironment(macCatalyst) && !targetEnvironment(simulator)\n        return super.defaultTestSuite\n#else\n        return XCTestSuite(name: \"SwiftPerformanceTests\")\n#endif\n    }\n\n    override class func setUp() {\n        super.setUp()\n        autoreleasepool {\n            smallRealm = createStringObjects(10)\n            mediumRealm = createStringObjects(50)\n            largeRealm = createStringObjects(500)\n        }\n    }\n\n    override class func tearDown() {\n        smallRealm = nil\n        mediumRealm = nil\n        largeRealm = nil\n        super.tearDown()\n    }\n\n    override func resetRealmState() {\n        // Do nothing, as we need to keep our in-memory realms around between tests\n    }\n\n    func measure(times: Int = 1, _ block: (() -> Void)) {\n        super.measure {\n            for _ in 0..<times {\n                autoreleasepool {\n                    block()\n                }\n            }\n        }\n    }\n\n    override func measureMetrics(_ metrics: [XCTPerformanceMetric], automaticallyStartMeasuring: Bool, for block: () -> Void) {\n        super.measureMetrics(metrics, automaticallyStartMeasuring: automaticallyStartMeasuring) {\n            autoreleasepool {\n                block()\n            }\n        }\n    }\n\n    func inMeasureBlock(block: () -> Void) {\n        measureMetrics(type(of: self).defaultPerformanceMetrics, automaticallyStartMeasuring: false) {\n            _ = block()\n        }\n    }\n\n    private func copyRealmToTestPath(_ realm: Realm) -> Realm {\n        do {\n            try FileManager.default.removeItem(at: testRealmURL())\n        } catch let error as NSError {\n            XCTAssertTrue(error.domain == NSCocoaErrorDomain && error.code == 4)\n        } catch {\n            fatalError(\"Unexpected error: \\(error)\")\n        }\n\n        try! realm.writeCopy(toFile: testRealmURL())\n        return realmWithTestPath()\n    }\n\n    func testInsertMultiple() {\n        inMeasureBlock {\n            let realm = self.realmWithTestPath()\n            self.startMeasuring()\n            try! realm.write {\n                for _ in 0..<100_000 {\n                    let obj = SwiftStringObject()\n                    obj.stringCol = \"a\"\n                    realm.add(obj)\n                }\n            }\n            self.stopMeasuring()\n            self.tearDown()\n        }\n    }\n\n    func testInsertSingleLiteral() {\n        inMeasureBlock {\n            let realm = self.realmWithTestPath()\n            self.startMeasuring()\n            for _ in 0..<5000 {\n                try! realm.write {\n                    _ = realm.create(SwiftStringObject.self, value: [\"a\"])\n                }\n            }\n            self.stopMeasuring()\n            self.tearDown()\n        }\n    }\n\n    func testInsertMultipleLiteral() {\n        inMeasureBlock {\n            let realm = self.realmWithTestPath()\n            self.startMeasuring()\n            try! realm.write {\n                for _ in 0..<100_000 {\n                    realm.create(SwiftStringObject.self, value: [\"a\"])\n                }\n            }\n            self.stopMeasuring()\n            self.tearDown()\n        }\n    }\n\n    func testCountWhereQuery() {\n        let realm = copyRealmToTestPath(largeRealm)\n        measure(times: 50) {\n            let results = realm.objects(SwiftStringObject.self).filter(\"stringCol = 'a'\")\n            _ = results.count\n        }\n    }\n\n    func testCountWhereTableView() {\n        let realm = copyRealmToTestPath(largeRealm)\n        measure(times: 50) {\n            let results = realm.objects(SwiftStringObject.self).filter(\"stringCol = 'a'\")\n            _ = results.first\n            _ = results.count\n        }\n    }\n\n    func testEnumerateAndAccessQuery() {\n        let realm = copyRealmToTestPath(largeRealm)\n        measure {\n            for stringObject in realm.objects(SwiftStringObject.self).filter(\"stringCol = 'a'\") {\n                _ = stringObject.stringCol\n            }\n        }\n    }\n\n    func testEnumerateAndAccessAll() {\n        let realm = copyRealmToTestPath(largeRealm)\n        measure {\n            for stringObject in realm.objects(SwiftStringObject.self) {\n                _ = stringObject.stringCol\n            }\n        }\n    }\n\n    func testEnumerateAndAccessAllSlow() {\n        let realm = copyRealmToTestPath(largeRealm)\n        measure {\n            let results = realm.objects(SwiftStringObject.self)\n            for i in 0..<results.count {\n                _ = results[i].stringCol\n            }\n        }\n    }\n\n\n    func testEnumerateAndAccessAllInts() {\n        let realm = copyRealmToTestPath(largeRealm)\n        measure {\n            for intObject in realm.objects(SwiftIntObject.self) {\n                _ = intObject.intCol\n            }\n        }\n    }\n\n    func testEnumerateAndAccessAllSlowInts() {\n        let realm = copyRealmToTestPath(largeRealm)\n        measure {\n            let results = realm.objects(SwiftIntObject.self)\n            for i in 0..<results.count {\n                _ = results[i].intCol\n            }\n        }\n    }\n\n    func testEnumerateAndAccessArrayProperty() {\n        let realm = copyRealmToTestPath(largeRealm)\n        realm.beginWrite()\n        let arrayPropertyObject = realm.create(SwiftArrayPropertyObject.self,\n                                               value: [\"name\", realm.objects(SwiftStringObject.self)])\n        try! realm.commitWrite()\n\n        measure {\n            for stringObject in arrayPropertyObject.array {\n                _ = stringObject.stringCol\n            }\n        }\n    }\n\n    func testEnumerateAndAccessMutableSetProperty() {\n        let realm = copyRealmToTestPath(largeRealm)\n        realm.beginWrite()\n        let setPropertyObject = realm.create(SwiftMutableSetPropertyObject.self,\n                                             value: [\"name\", realm.objects(SwiftStringObject.self)])\n        try! realm.commitWrite()\n\n        measure {\n            for stringObject in setPropertyObject.set {\n                _ = stringObject.stringCol\n            }\n        }\n    }\n\n    func testEnumerateAndAccessArrayPropertySlow() {\n        let realm = copyRealmToTestPath(largeRealm)\n        realm.beginWrite()\n        let arrayPropertyObject = realm.create(SwiftArrayPropertyObject.self,\n                                               value: [\"name\", realm.objects(SwiftStringObject.self)])\n        try! realm.commitWrite()\n\n        measure {\n            let list = arrayPropertyObject.array\n            for i in 0..<list.count {\n                _ = list[i].stringCol\n            }\n        }\n    }\n\n    func testEnumerateAndAccessMutableSetPropertySlow() {\n        let realm = copyRealmToTestPath(largeRealm)\n        realm.beginWrite()\n        let setPropertyObject = realm.create(SwiftMutableSetPropertyObject.self,\n                                             value: [\"name\", realm.objects(SwiftStringObject.self)])\n        try! realm.commitWrite()\n\n        measure {\n            let set = setPropertyObject.set\n            for i in 0..<set.count {\n                _ = set[i].stringCol\n            }\n        }\n    }\n\n    func testEnumerateAndMutateAll() {\n        let realm = copyRealmToTestPath(largeRealm)\n        measure {\n            try! realm.write {\n                for stringObject in realm.objects(SwiftStringObject.self) {\n                    stringObject.stringCol = \"c\"\n                }\n            }\n        }\n    }\n\n    func testEnumerateAndMutateQuery() {\n        let realm = copyRealmToTestPath(largeRealm)\n        measure {\n            try! realm.write {\n                for stringObject in realm.objects(SwiftStringObject.self).filter(\"stringCol != 'b'\") {\n                    stringObject.stringCol = \"c\"\n                }\n            }\n        }\n    }\n\n    func testEnumerateAndAccessMixed() {\n        let realm = inMemoryRealm(#function)\n        realm.beginWrite()\n        let list = realm.create(ModernListAnyRealmValueObject.self).value\n        for i in 0..<500000 {\n            list.append(.int(i))\n        }\n        try! realm.commitWrite()\n\n        measure {\n            for value in list {\n                _ = value.intValue!\n            }\n        }\n    }\n\n\n    func testDeleteAll() {\n        inMeasureBlock {\n            let realm = self.copyRealmToTestPath(largeRealm)\n            self.startMeasuring()\n            try! realm.write {\n                realm.delete(realm.objects(SwiftStringObject.self))\n            }\n            self.stopMeasuring()\n        }\n    }\n\n    func testQueryDeletion() {\n        inMeasureBlock {\n            let realm = self.copyRealmToTestPath(mediumRealm)\n            self.startMeasuring()\n            try! realm.write {\n                realm.delete(realm.objects(SwiftStringObject.self).filter(\"stringCol = 'a' OR stringCol = 'b'\"))\n            }\n            self.stopMeasuring()\n        }\n    }\n\n    func testManualDeletion() {\n        inMeasureBlock {\n            let realm = self.copyRealmToTestPath(mediumRealm)\n            let objects = Array(realm.objects(SwiftStringObject.self))\n            self.startMeasuring()\n            try! realm.write {\n                realm.delete(objects)\n            }\n            self.stopMeasuring()\n        }\n    }\n\n    func testUnindexedStringLookup() {\n        let realm = realmWithTestPath()\n        try! realm.write {\n            for i in 0..<10000 {\n                realm.create(SwiftStringObject.self, value: [i.description])\n            }\n        }\n        measure {\n            for i in 0..<10000 {\n                _ = realm.objects(SwiftStringObject.self).filter(\"stringCol = %@\", i.description).first\n            }\n        }\n    }\n\n    func testIndexedStringLookup() {\n        let realm = realmWithTestPath()\n        try! realm.write {\n            for i in 0..<50_000 {\n                autoreleasepool {\n                    _ = realm.create(SwiftIndexedPropertiesObject.self, value: [i.description, i])\n                }\n            }\n        }\n        measure {\n            for i in 0..<50_000 {\n                autoreleasepool {\n                    _ = realm.objects(SwiftIndexedPropertiesObject.self).filter(\"stringCol = %@\", i.description).first\n                }\n            }\n        }\n    }\n\n    func testLargeINQuery() {\n        let realm = realmWithTestPath()\n        realm.beginWrite()\n        var ids = [Int]()\n        for i in 0..<100_000 {\n            realm.create(SwiftIntObject.self, value: [i])\n            if i % 2 != 0 {\n                ids.append(i)\n            }\n        }\n        try! realm.commitWrite()\n        measure(times: 10) {\n            autoreleasepool {\n                _ = realm.objects(SwiftIntObject.self).filter(\"intCol IN %@\", ids).first\n            }\n        }\n    }\n\n    func testSortingAllObjects() {\n        let realm = realmWithTestPath()\n        try! realm.write {\n            for _ in 0..<8000 {\n                let randomNumber = Int.random(in: 0...Int.max)\n                realm.create(SwiftIntObject.self, value: [randomNumber])\n            }\n        }\n        measure(times: 50) {\n            _ = realm.objects(SwiftIntObject.self).sorted(byKeyPath: \"intCol\", ascending: true).last\n        }\n    }\n\n    func testRealmCreationCached() {\n        nonisolated(unsafe) var realm: Realm!\n        dispatchSyncNewThread {\n            realm = try! Realm()\n        }\n\n        measure(times: 2500) {\n            _ = try! Realm()\n        }\n        _ = realm.configuration\n    }\n\n    func testRealmCreationUncached() {\n        measure(times: 5000) {\n            _ = try! Realm()\n        }\n    }\n\n    func testCommitWriteTransaction() {\n        inMeasureBlock {\n            let realm = inMemoryRealm(\"test\")\n            realm.beginWrite()\n            let object = realm.create(SwiftIntObject.self)\n            try! realm.commitWrite()\n\n            self.startMeasuring()\n            while object.intCol < 500 {\n                try! realm.write { object.intCol += 1 }\n            }\n            self.stopMeasuring()\n        }\n    }\n\n    func testCommitWriteTransactionWithLocalNotification() {\n        inMeasureBlock {\n            let realm = inMemoryRealm(\"test\")\n            realm.beginWrite()\n            let object = realm.create(SwiftIntObject.self)\n            try! realm.commitWrite()\n\n            let token = realm.observe { _, _ in }\n            self.startMeasuring()\n            while object.intCol < 5000 {\n                try! realm.write { object.intCol += 1 }\n            }\n            self.stopMeasuring()\n            token.invalidate()\n        }\n    }\n\n    func testCommitWriteTransactionWithCrossThreadNotification() {\n        let stopValue = 1000\n        inMeasureBlock {\n            let realm = inMemoryRealm(\"test\")\n            realm.beginWrite()\n            let object = realm.create(SwiftIntObject.self)\n            try! realm.commitWrite()\n\n            let queue = DispatchQueue(label: \"background\")\n            let semaphore = DispatchSemaphore(value: 0)\n            queue.async {\n                autoreleasepool {\n                    let realm = inMemoryRealm(\"test\")\n                    let object = realm.objects(SwiftIntObject.self).first!\n                    var token: NotificationToken! = nil\n                    CFRunLoopPerformBlock(CFRunLoopGetCurrent(), CFRunLoopMode.defaultMode.rawValue) {\n                        token = realm.observe { _, _ in\n                            if object.intCol == stopValue {\n                                CFRunLoopStop(CFRunLoopGetCurrent())\n                            }\n                        }\n                        semaphore.signal()\n                    }\n                    CFRunLoopRun()\n                    token.invalidate()\n                }\n            }\n\n            _ = semaphore.wait(timeout: DispatchTime.distantFuture)\n            self.startMeasuring()\n            while object.intCol < stopValue {\n                try! realm.write { object.intCol += 1 }\n            }\n            queue.sync { }\n            self.stopMeasuring()\n        }\n    }\n\n    func testCrossThreadSyncLatency() {\n        let stopValue = 5000\n        let queue = DispatchQueue(label: \"background\")\n        let semaphore = DispatchSemaphore(value: 0)\n\n        inMeasureBlock {\n            let realm = inMemoryRealm(\"test\")\n            realm.beginWrite()\n            let object = realm.create(SwiftIntObject.self)\n            try! realm.commitWrite()\n\n            queue.async {\n                autoreleasepool {\n                    let realm = inMemoryRealm(\"test\")\n                    let object = realm.objects(SwiftIntObject.self).first!\n                    var token: NotificationToken! = nil\n                    CFRunLoopPerformBlock(CFRunLoopGetCurrent(), CFRunLoopMode.defaultMode.rawValue) {\n                        token = realm.observe { _, _ in\n                            if object.intCol == stopValue {\n                                CFRunLoopStop(CFRunLoopGetCurrent())\n                            } else if object.intCol % 2 == 0 {\n                                try! realm.write { object.intCol += 1 }\n                            }\n                        }\n                        semaphore.signal()\n                    }\n                    CFRunLoopRun()\n                    token.invalidate()\n                }\n            }\n\n            let token = realm.observe { _, _ in\n                if object.intCol % 2 == 1 && object.intCol < stopValue {\n                    try! realm.write { object.intCol += 1 }\n                }\n            }\n\n            _ = semaphore.wait(timeout: DispatchTime.distantFuture)\n\n            self.startMeasuring()\n            try! realm.write { object.intCol += 1 }\n            while object.intCol < stopValue {\n                RunLoop.current.run(mode: RunLoop.Mode.default, before: Date.distantFuture)\n            }\n            queue.sync {}\n            self.stopMeasuring()\n            token.invalidate()\n        }\n    }\n\n    // MARK: - Legacy object creation helpers\n\n    func createObjects<T: Object>(_ type: T.Type, _ create: (T, Int) -> Void) -> Realm {\n        let realm = try! Realm()\n        try! realm.write {\n            for value in 0..<10000 {\n                let obj = T()\n                create(obj, value)\n                realm.add(obj)\n            }\n        }\n        return realm\n    }\n\n    func createSwiftListObjects() -> Realm {\n        return createObjects(SwiftListOfSwiftObject.self) { (listObject, value) in\n            let object = SwiftObject()\n            object.intCol = value\n            object.stringCol = String(value)\n            listObject.array.append(object)\n        }\n    }\n\n    func createSwiftMutableSetObjects() -> Realm {\n        return createObjects(SwiftMutableSetOfSwiftObject.self) { (setObject, value) in\n            let object = SwiftObject()\n            object.intCol = value\n            object.stringCol = String(value)\n            setObject.set.insert(object)\n        }\n    }\n\n    func createIntSwiftObjects() -> Realm {\n        return createObjects(SwiftObject.self) { (object, value) in\n            object.intCol = value\n        }\n    }\n\n    func createStringSwiftObjects() -> Realm {\n        return createObjects(SwiftObject.self) { (object, value) in\n            object.stringCol = String(value)\n        }\n    }\n\n    func createOptionalIntObjects() -> Realm {\n        return createObjects(SwiftOptionalObject.self) { (object, value) in\n            object.optIntCol.value = value\n        }\n    }\n\n    func createOptionalStringObjects() -> Realm {\n        return createObjects(SwiftOptionalObject.self) { (object, value) in\n            object.optStringCol = String(value)\n        }\n    }\n\n\n    // MARK: - Legacy value(forKey:) vs. loop\n\n    func testLegacyListObjectsMap() {\n        let objects = createSwiftListObjects().objects(SwiftListOfSwiftObject.self)\n        measure(times: 100) {\n            _ = Array(objects.map { $0.array })\n        }\n    }\n\n    func testLegacyListObjectsValueForKey() {\n        let objects = createSwiftListObjects().objects(SwiftListOfSwiftObject.self)\n        measure(times: 100) {\n            _ = objects.value(forKeyPath: \"array\") as! [List<SwiftListOfSwiftObject>]\n        }\n    }\n\n    func testLegacyMutableSetObjectsMap() {\n        let objects = createSwiftMutableSetObjects().objects(SwiftMutableSetOfSwiftObject.self)\n        measure(times: 100) {\n            _ = Array(objects.map { $0.set })\n        }\n    }\n\n    func testLegacyMutableSetObjectsValueForKey() {\n        let objects = createSwiftMutableSetObjects().objects(SwiftMutableSetOfSwiftObject.self)\n        measure(times: 100) {\n            _ = objects.value(forKeyPath: \"set\") as! [MutableSet<SwiftMutableSetOfSwiftObject>]\n        }\n    }\n\n    func testLegacyIntObjectsMap() {\n        let objects = createIntSwiftObjects().objects(SwiftObject.self)\n        measure(times: 100) {\n            _ = Array(objects.map { $0.intCol })\n        }\n    }\n\n    func testLegacyIntObjectsValueForKey() {\n        let objects = createIntSwiftObjects().objects(SwiftObject.self)\n        measure(times: 100) {\n            _ = objects.value(forKeyPath: \"intCol\") as! [Int]\n        }\n    }\n\n    func testLegacyStringObjectsMap() {\n        let objects = createStringSwiftObjects().objects(SwiftObject.self)\n        measure(times: 100) {\n            _ = Array(objects.map { $0.stringCol })\n        }\n    }\n\n    func testLegacyStringObjectsValueForKey() {\n        let objects = createStringSwiftObjects().objects(SwiftObject.self)\n        measure(times: 100) {\n            _ = objects.value(forKeyPath: \"stringCol\") as! [String]\n        }\n    }\n\n    func testLegacyOptionalIntObjectsMap() {\n        let objects = createOptionalIntObjects().objects(SwiftOptionalObject.self)\n        measure(times: 10) {\n            _ = Array(objects.map { $0.optIntCol.value })\n        }\n    }\n\n    func testLegacyOptionalIntObjectsValueForKey() {\n        let objects = createOptionalIntObjects().objects(SwiftOptionalObject.self)\n        measure(times: 10) {\n            _ = objects.value(forKeyPath: \"optIntCol\") as! [Int]\n        }\n    }\n\n    func testLegacyOptionalStringObjectsMap() {\n        let objects = createOptionalStringObjects().objects(SwiftOptionalObject.self)\n        measure(times: 10) {\n            _ = Array(objects.map { $0.optStringCol })\n        }\n    }\n\n    func testLegacyOptionalStringObjectsValueForKey() {\n        let objects = createOptionalStringObjects().objects(SwiftOptionalObject.self)\n        measure(times: 10) {\n            _ = objects.value(forKeyPath: \"optStringCol\") as! [String]\n        }\n    }\n\n    // MARK: - Modern object creation helpers\n\n    func createModernCollectionObjects() -> Results<ModernCollectionObject> {\n        return createObjects(ModernCollectionObject.self) { (listObject, value) in\n            let object = ModernAllTypesObject()\n            object.intCol = value\n            object.stringCol = String(value)\n            listObject.list.append(object)\n            listObject.set.insert(object)\n            listObject.map[\"\"] = object\n        }.objects(ModernCollectionObject.self)\n    }\n\n    func createModernObjects() -> Results<ModernIntAndStringObject> {\n        return createObjects(ModernIntAndStringObject.self) { (object, value) in\n            object.intCol = value\n            object.stringCol = String(value)\n            object.optIntCol = value\n            object.optStringCol = String(value)\n        }.objects(ModernIntAndStringObject.self)\n    }\n\n    // MARK: - Modern value(forKey:) vs. loop\n\n    func testModernListObjectsMap() {\n        let objects = createModernCollectionObjects()\n        measure(times: 100) {\n            _ = Array(objects.map { $0.list })\n        }\n    }\n\n    func testModernListObjectsValueForKey() {\n        let objects = createModernCollectionObjects()\n        measure(times: 100) {\n            _ = objects.value(forKeyPath: \"list\") as! [List<ModernAllTypesObject>]\n        }\n    }\n\n    func testModernMutableSetObjectsMap() {\n        let objects = createModernCollectionObjects()\n        measure(times: 100) {\n            _ = Array(objects.map { $0.set })\n        }\n    }\n\n    func testModernMutableSetObjectsValueForKey() {\n        let objects = createModernCollectionObjects()\n        measure(times: 100) {\n            _ = objects.value(forKeyPath: \"set\") as! [MutableSet<ModernAllTypesObject>]\n        }\n    }\n\n    func testModernIntObjectsMap() {\n        let objects = createModernObjects()\n        measure(times: 100) {\n            _ = Array(objects.map { $0.intCol })\n        }\n    }\n\n    func testModernIntObjectsValueForKey() {\n        let objects = createModernObjects()\n        measure(times: 100) {\n            _ = objects.value(forKeyPath: \"intCol\") as! [Int]\n        }\n    }\n\n    func testModernStringObjectsMap() {\n        let objects = createModernObjects()\n        measure(times: 100) {\n            _ = Array(objects.map { $0.stringCol })\n        }\n    }\n\n    func testModernStringObjectsValueForKey() {\n        let objects = createModernObjects()\n        measure(times: 100) {\n            _ = objects.value(forKeyPath: \"stringCol\") as! [String]\n        }\n    }\n\n    func testModernOptionalIntObjectsMap() {\n        let objects = createModernObjects()\n        measure(times: 10) {\n            _ = Array(objects.map { $0.optIntCol })\n        }\n    }\n\n    func testModernOptionalIntObjectsValueForKey() {\n        let objects = createModernObjects()\n        measure(times: 10) {\n            _ = objects.value(forKeyPath: \"optIntCol\") as! [Int]\n        }\n    }\n\n    func testModernOptionalStringObjectsMap() {\n        let objects = createModernObjects()\n        measure(times: 10) {\n            _ = Array(objects.map { $0.optStringCol })\n        }\n    }\n\n    func testModernOptionalStringObjectsValueForKey() {\n        let objects = createModernObjects()\n        measure(times: 10) {\n            _ = objects.value(forKeyPath: \"optStringCol\") as! [String]\n        }\n    }\n\n    // MARK: Test Projections\n\n    func testCastSingleProjection() {\n        let realm = copyRealmToTestPath(mediumRealm)\n        try! realm.write({\n            for obj in realm.objects(SwiftStringObject.self) {\n                realm.create(ModernSwiftStringObject.self, value: [obj.stringCol])\n            }\n        })\n\n        let objects = realm.objects(ModernSwiftStringObject.self)\n        measure(times: 10) {\n            for obj in objects {\n                _ = ModernSwiftStringProjection(projecting: obj)\n            }\n        }\n    }\n\n    func testCastResultsToProjection() {\n        let realm = copyRealmToTestPath(mediumRealm)\n        try! realm.write {\n            for obj in realm.objects(SwiftStringObject.self) {\n                realm.create(ModernSwiftStringObject.self, value: [obj.stringCol])\n            }\n        }\n\n        measure(times: 5) {\n            _ = Array(realm.objects(ModernSwiftStringProjection.self))\n        }\n    }\n\n    func testAccessProjectionProperty() {\n        let realm = copyRealmToTestPath(mediumRealm)\n        try! realm.write {\n            for obj in realm.objects(SwiftStringObject.self) {\n                realm.create(ModernSwiftStringObject.self, value: [obj.stringCol])\n            }\n        }\n\n        let projections = realm.objects(ModernSwiftStringProjection.self)\n        measure(times: 3) {\n            for proj in projections {\n                _ = proj.string\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/PrimitiveListTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2017 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport RealmSwift\nimport XCTest\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\nimport RealmSwiftTestSupport\n#endif\n\nclass PrimitiveListTestsBase<O: ObjectFactory, V: ListValueFactory>: RLMTestCaseBase {\n    var realm: Realm?\n    var obj: V.ListRoot!\n    var array: List<V>!\n    var values: [V]!\n\n    override func setUp() {\n        obj = O.get()\n        realm = obj.realm\n        array = obj[keyPath: V.array]\n        values = V.values()\n    }\n\n    override func tearDown() {\n        realm?.cancelWrite()\n        array = nil\n        obj = nil\n        realm = nil\n    }\n\n    // These test suites run such a large number of very short tests that the\n    // setup/teardown overhead from TestCase ends up being a significant portion\n    // of the runtime, so bypass that and replicate just the bit we need here.\n    override func invokeTest() {\n        autoreleasepool { super.invokeTest() }\n    }\n\n    func assertThrows<T>(_ block: @autoclosure () -> T, named: String? = RLMExceptionName,\n                         _ message: String? = nil, fileName: String = #file, lineNumber: UInt = #line) {\n        RLMAssertThrowsWithName(self, { _ = block() }, named, message, fileName, lineNumber)\n    }\n\n    func assertThrows<T>(_ block: @autoclosure () -> T, reason: String,\n                         _ message: String? = nil, fileName: String = #file, lineNumber: UInt = #line) {\n        RLMAssertThrowsWithReason(self, { _ = block() }, reason, message, fileName, lineNumber)\n    }\n\n    func assertThrows<T>(_ block: @autoclosure () -> T, reasonMatching regexString: String,\n                         _ message: String? = nil, fileName: String = #file, lineNumber: UInt = #line) {\n        RLMAssertThrowsWithReasonMatching(self, { _ = block() }, regexString, message, fileName, lineNumber)\n    }\n}\n\nclass PrimitiveListTests<O: ObjectFactory, V: ListValueFactory & _RealmSchemaDiscoverable>: PrimitiveListTestsBase<O, V> {\n    func testInvalidated() {\n        XCTAssertFalse(array.isInvalidated)\n        if let realm = obj.realm {\n            realm.delete(obj)\n            XCTAssertTrue(array.isInvalidated)\n        }\n    }\n\n    func testIndexOf() {\n        guard V._rlmType != .object else { return }\n\n        XCTAssertNil(array.index(of: values[0]))\n\n        array.append(values[0])\n        XCTAssertEqual(0, array.index(of: values[0]))\n\n        array.append(values[1])\n        XCTAssertEqual(0, array.index(of: values[0]))\n        XCTAssertEqual(1, array.index(of: values[1]))\n    }\n\n    // FIXME: Not yet implemented\n    func disabled_testIndexMatching() {\n        XCTAssertNil(array.index(matching: \"self = %@\", values[0]))\n\n        array.append(values[0])\n        XCTAssertEqual(0, array.index(matching: \"self = %@\", values[0]))\n\n        array.append(values[1])\n        XCTAssertEqual(0, array.index(matching: \"self = %@\", values[0]))\n        XCTAssertEqual(1, array.index(matching: \"self = %@\", values[1]))\n    }\n\n    func testSubscript() {\n        array.append(objectsIn: values)\n        for i in 0..<values.count {\n            XCTAssertEqual(array[i], values[i])\n        }\n        assertThrows(array[values.count], reason: \"Index 3 is out of bounds\")\n        assertThrows(array[-1], reason: \"negative value\")\n    }\n\n    func testFirst() {\n        array.append(objectsIn: values)\n        XCTAssertEqual(array.first, values.first)\n        array.removeAll()\n        XCTAssertNil(array.first)\n    }\n\n    func testLast() {\n        array.append(objectsIn: values)\n        XCTAssertEqual(array.last, values.last)\n        array.removeAll()\n        XCTAssertNil(array.last)\n\n    }\n\n    func testObjectsAtIndexes() {\n        assertThrows(array.objects(at: [1, 2, 3]), reason: \"Indexes for collection are out of bounds.\")\n        array.append(objectsIn: values)\n        let objs = array.objects(at: [2, 1])\n        XCTAssertEqual(values[1], objs.first) // this is broke\n        XCTAssertEqual(values[2], objs.last)\n    }\n\n    func testValueForKey() {\n        XCTAssertEqual(array.value(forKey: \"self\").count, 0)\n        array.append(objectsIn: values)\n        XCTAssertEqual(values!, array.value(forKey: \"self\").map { dynamicBridgeCast(fromObjectiveC: $0) as V })\n\n        assertThrows(array.value(forKey: \"not self\"), named: \"NSUnknownKeyException\")\n    }\n\n    func testInsert() {\n        XCTAssertEqual(Int(0), array.count)\n\n        array.insert(values[0], at: 0)\n        XCTAssertEqual(Int(1), array.count)\n        XCTAssertEqual(values[0], array[0])\n\n        array.insert(values[1], at: 0)\n        XCTAssertEqual(Int(2), array.count)\n        XCTAssertEqual(values[1], array[0])\n        XCTAssertEqual(values[0], array[1])\n\n        array.insert(values[2], at: 2)\n        XCTAssertEqual(Int(3), array.count)\n        XCTAssertEqual(values[1], array[0])\n        XCTAssertEqual(values[0], array[1])\n        XCTAssertEqual(values[2], array[2])\n\n        assertThrows(array.insert(values[0], at: 4))\n        assertThrows(array.insert(values[0], at: -1))\n    }\n\n    func testRemove() {\n        assertThrows(array.remove(at: 0))\n        assertThrows(array.remove(at: -1))\n\n        array.append(objectsIn: values)\n\n        assertThrows(array.remove(at: -1))\n        XCTAssertEqual(values[0], array[0])\n        XCTAssertEqual(values[1], array[1])\n        XCTAssertEqual(values[2], array[2])\n        assertThrows(array[3])\n\n        array.remove(at: 0)\n        XCTAssertEqual(values[1], array[0])\n        XCTAssertEqual(values[2], array[1])\n        assertThrows(array[2])\n        assertThrows(array.remove(at: 2))\n\n        array.remove(at: 1)\n        XCTAssertEqual(values[1], array[0])\n        assertThrows(array[1])\n    }\n\n    func testRemoveLast() {\n        assertThrows(array.removeLast())\n\n        array.append(objectsIn: values)\n        array.removeLast()\n\n        XCTAssertEqual(array.count, 2)\n        XCTAssertEqual(values[0], array[0])\n        XCTAssertEqual(values[1], array[1])\n\n        array.removeLast(2)\n        XCTAssertEqual(array.count, 0)\n    }\n\n    func testRemoveAll() {\n        array.removeAll()\n        array.append(objectsIn: values)\n        array.removeAll()\n        XCTAssertEqual(array.count, 0)\n    }\n\n    func testReplace() {\n        assertThrows(array.replace(index: 0, object: values[0]),\n                     reason: \"Index 0 is out of bounds\")\n\n        array.append(objectsIn: values)\n        array.replace(index: 1, object: values[0])\n        XCTAssertEqual(array[0], values[0])\n        XCTAssertEqual(array[1], values[0])\n        XCTAssertEqual(array[2], values[2])\n\n        assertThrows(array.replace(index: 3, object: values[0]),\n                     reason: \"Index 3 is out of bounds\")\n        assertThrows(array.replace(index: -1, object: values[0]),\n                     reason: \"Cannot pass a negative value\")\n    }\n\n    func testReplaceRange() {\n        assertSucceeds { array.replaceSubrange(0..<0, with: []) }\n\n#if false\n        // FIXME: The exception thrown here runs afoul of Swift's exclusive access checking.\n        assertThrows(array.replaceSubrange(0..<1, with: []),\n                     reason: \"Index 0 is out of bounds\")\n#endif\n\n        array.replaceSubrange(0..<0, with: [values[0]])\n        XCTAssertEqual(array.count, 1)\n        XCTAssertEqual(array[0], values[0])\n\n        array.replaceSubrange(0..<1, with: values)\n        XCTAssertEqual(array.count, 3)\n\n        array.replaceSubrange(1..<2, with: [])\n        XCTAssertEqual(array.count, 2)\n        XCTAssertEqual(array[0], values[0])\n        XCTAssertEqual(array[1], values[2])\n    }\n\n    func testMove() {\n        assertThrows(array.move(from: 1, to: 0), reason: \"out of bounds\")\n\n        array.append(objectsIn: values)\n        array.move(from: 2, to: 0)\n        XCTAssertEqual(array[0], values[2])\n        XCTAssertEqual(array[1], values[0])\n        XCTAssertEqual(array[2], values[1])\n\n        assertThrows(array.move(from: 3, to: 0), reason: \"Index 3 is out of bounds\")\n        assertThrows(array.move(from: 0, to: 3), reason: \"Index 3 is out of bounds\")\n        assertThrows(array.move(from: -1, to: 0), reason: \"negative value\")\n        assertThrows(array.move(from: 0, to: -1), reason: \"negative value\")\n    }\n\n    func testSwap() {\n        assertThrows(array.swapAt(0, 1), reason: \"out of bounds\")\n\n        array.append(objectsIn: values)\n        array.swapAt(0, 2)\n        XCTAssertEqual(array[0], values[2])\n        XCTAssertEqual(array[1], values[1])\n        XCTAssertEqual(array[2], values[0])\n\n        assertThrows(array.swapAt(3, 0), reason: \"Index 3 is out of bounds\")\n        assertThrows(array.swapAt(0, 3), reason: \"Index 3 is out of bounds\")\n        assertThrows(array.swapAt(-1, 0), reason: \"negative value\")\n        assertThrows(array.swapAt(0, -1), reason: \"negative value\")\n    }\n}\n\nclass MinMaxPrimitiveListTests<O: ObjectFactory, V: ListValueFactory>: PrimitiveListTestsBase<O, V> where V.PersistedType: MinMaxType {\n    func testMin() {\n        XCTAssertNil(array.min())\n        array.append(objectsIn: values.reversed())\n        XCTAssertEqual(array.min(), V.min())\n    }\n\n    func testMax() {\n        XCTAssertNil(array.max())\n        array.append(objectsIn: values.reversed())\n        XCTAssertEqual(array.max(), V.max())\n    }\n}\n\nclass AddablePrimitiveListTests<O: ObjectFactory, V: ListValueFactory>: PrimitiveListTestsBase<O, V> where V: NumericValueFactory, V.PersistedType: AddableType {\n    func testSum() {\n        XCTAssertEqual(array.sum(), .zero)\n        array.append(objectsIn: values)\n        XCTAssertEqual(V.doubleValue(array.sum()), V.sum(), accuracy: 0.01)\n    }\n\n    func testAverage() {\n        XCTAssertNil(array.average() as V.AverageType?)\n        array.append(objectsIn: values)\n        XCTAssertEqual(V.doubleValue(array.average()!), V.average(), accuracy: 0.01)\n    }\n}\n\nprivate func rotate<T>(_ values: Array<T>) -> Array<T> {\n    var shuffled = values\n    shuffled.removeFirst()\n    shuffled.append(values.first!)\n    return shuffled\n}\n\nclass SortablePrimitiveListTests<O: ObjectFactory, V: ListValueFactory>: PrimitiveListTestsBase<O, V> where V.PersistedType: SortableType {\n    func testSorted() {\n        array.append(objectsIn: rotate(values!))\n        assertEqual(Array(array.sorted(ascending: true)), values)\n        assertEqual(Array(array.sorted(ascending: false)), values.reversed())\n    }\n\n    func testDistinct() {\n        array.append(objectsIn: values!)\n        array.append(objectsIn: values!)\n        assertEqual(Array(array.distinct()), values!)\n    }\n}\n\nfunc addTests<OF: ObjectFactory>(_ suite: XCTestSuite, _ type: OF.Type) {\n    // Plain types\n    PrimitiveListTests<OF, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Int8>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Int16>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Int32>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Int64>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, String>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Data>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Date>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Decimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, ObjectId>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, UUID>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    MinMaxPrimitiveListTests<OF, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Int8>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Int16>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Int32>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Int64>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Date>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Decimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    AddablePrimitiveListTests<OF, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Int8>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Int16>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Int32>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Int64>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Decimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    // Optional plain types\n    PrimitiveListTests<OF, Int?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Int8?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Int16?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Int32?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Int64?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Float?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Double?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, String?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Data?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Date?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Decimal128?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, ObjectId?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, UUID?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    MinMaxPrimitiveListTests<OF, Int?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Int8?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Int16?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Int32?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Int64?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Float?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Double?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Date?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Decimal128?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    AddablePrimitiveListTests<OF, Int?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Int8?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Int16?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Int32?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Int64?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Float?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Double?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Decimal128?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    // Enum wrappers\n    PrimitiveListTests<OF, EnumInt>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, EnumInt8>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, EnumInt16>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, EnumInt32>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, EnumInt64>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, EnumFloat>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, EnumDouble>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, EnumString>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    MinMaxPrimitiveListTests<OF, EnumInt>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, EnumInt8>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, EnumInt16>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, EnumInt32>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, EnumInt64>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, EnumFloat>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, EnumDouble>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    // Optional Enum wrappers\n    PrimitiveListTests<OF, EnumInt?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, EnumInt8?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, EnumInt16?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, EnumInt32?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, EnumInt64?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, EnumFloat?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, EnumDouble?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, EnumString?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    MinMaxPrimitiveListTests<OF, EnumInt?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, EnumInt8?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, EnumInt16?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, EnumInt32?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, EnumInt64?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, EnumFloat?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, EnumDouble?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    // Custom persistable wrappers\n    PrimitiveListTests<OF, IntWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Int8Wrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Int16Wrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Int32Wrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Int64Wrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, FloatWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, DoubleWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, StringWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, DataWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, DateWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Decimal128Wrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, ObjectIdWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, UUIDWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, EmbeddedObjectWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    MinMaxPrimitiveListTests<OF, IntWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Int8Wrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Int16Wrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Int32Wrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Int64Wrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, FloatWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, DoubleWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, DateWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Decimal128Wrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    AddablePrimitiveListTests<OF, IntWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Int8Wrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Int16Wrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Int32Wrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Int64Wrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, FloatWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, DoubleWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Decimal128Wrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    // Optional custom persistable wrappers\n    PrimitiveListTests<OF, IntWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Int8Wrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Int16Wrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Int32Wrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Int64Wrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, FloatWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, DoubleWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, StringWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, DataWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, DateWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, Decimal128Wrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, ObjectIdWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveListTests<OF, UUIDWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    MinMaxPrimitiveListTests<OF, IntWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Int8Wrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Int16Wrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Int32Wrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Int64Wrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, FloatWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, DoubleWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, DateWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveListTests<OF, Decimal128Wrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    AddablePrimitiveListTests<OF, IntWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Int8Wrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Int16Wrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Int32Wrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Int64Wrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, FloatWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, DoubleWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveListTests<OF, Decimal128Wrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n}\n\nclass UnmanagedPrimitiveListTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        let suite = XCTestSuite(name: \"Unmanaged Primitive Lists\")\n        addTests(suite, UnmanagedObjectFactory.self)\n        return suite\n    }\n}\n\nclass ManagedPrimitiveListTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        let suite = XCTestSuite(name: \"Managed Primitive Lists\")\n        addTests(suite, ManagedObjectFactory.self)\n\n        SortablePrimitiveListTests<ManagedObjectFactory, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Int8>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Int16>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Int32>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Int64>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, String>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Date>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Data>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        SortablePrimitiveListTests<ManagedObjectFactory, Int?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Int8?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Int16?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Int32?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Int64?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Float?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Double?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, String?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Date?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Data?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        SortablePrimitiveListTests<ManagedObjectFactory, EnumInt>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, EnumInt8>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, EnumInt16>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, EnumInt32>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, EnumInt64>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, EnumFloat>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, EnumDouble>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, EnumString>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        SortablePrimitiveListTests<ManagedObjectFactory, EnumInt?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, EnumInt8?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, EnumInt16?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, EnumInt32?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, EnumInt64?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, EnumFloat?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, EnumDouble?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, EnumString?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        SortablePrimitiveListTests<ManagedObjectFactory, IntWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Int8Wrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Int16Wrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Int32Wrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Int64Wrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, FloatWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, DoubleWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, StringWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, DateWrapper>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        SortablePrimitiveListTests<ManagedObjectFactory, IntWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Int8Wrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Int16Wrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Int32Wrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, Int64Wrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, FloatWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, DoubleWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, StringWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveListTests<ManagedObjectFactory, DateWrapper?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        return suite\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/PrimitiveMapTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport Realm\nimport RealmSwift\n\n#if canImport(RealmSwiftTestSupport)\nimport RealmSwiftTestSupport\n#endif\n\n// swiftlint:disable cyclomatic_complexity\n\nclass PrimitiveMapTestsBase<O: ObjectFactory, V: MapValueFactory>: TestCase {\n    var realm: Realm?\n    var obj: V.MapRoot!\n    var obj2: V.MapRoot!\n    var map: Map<String, V>!\n    var otherMap: Map<String, V>!\n    var values: [(key: String, value: V)]!\n\n    override func setUp() {\n        obj = O.get()\n        obj2 = O.get()\n        realm = obj.realm\n        map = obj[keyPath: V.map]\n        otherMap = obj2[keyPath: V.map]\n        values = V.values().enumerated().map { (key: \"key\\($0)\", value: $1) }\n    }\n\n    override func tearDown() {\n        realm?.cancelWrite()\n        realm = nil\n        map = nil\n        otherMap = nil\n        obj = nil\n        obj2 = nil\n    }\n}\n\nclass PrimitiveMapTests<O: ObjectFactory, V: MapValueFactory>: PrimitiveMapTestsBase<O, V> {\n    func testInvalidated() {\n        XCTAssertFalse(map.isInvalidated)\n        if let realm = obj.realm {\n            realm.delete(obj)\n            XCTAssertTrue(map.isInvalidated)\n        }\n    }\n\n    @MainActor\n    func testEnumeration() {\n        XCTAssertEqual(0, map.count)\n        map.merge(values) { $1 }\n        let exp = expectation(description: \"did enumerate all keys and values\")\n        exp.expectedFulfillmentCount = 3\n        for element in map where values.filter({ $0.key == element.key }).first!.value == element.value {\n            exp.fulfill()\n        }\n        waitForExpectations(timeout: 1.0, handler: nil)\n    }\n\n    func testValueForKey() {\n        let key = values[0].key\n        XCTAssertNil(map.value(forKey: key))\n        map.setValue(values[0].value, forKey: key)\n        let kvc: AnyObject = map.value(forKey: key)!\n        XCTAssertEqual(dynamicBridgeCast(fromObjectiveC: kvc) as V, values[0].value)\n    }\n\n    func testInsert() {\n        XCTAssertEqual(0, map.count)\n\n        map[values[0].key] = values[0].value\n        XCTAssertEqual(1, map.count)\n        XCTAssertEqual(1, map.keys.count)\n        XCTAssertEqual(1, map.values.count)\n        XCTAssertTrue(Set([values[0].key]).isSubset(of: map.keys))\n        XCTAssertEqual(map[values[0].key], values[0].value)\n\n        map[values[1].key] = values[1].value\n        XCTAssertEqual(2, map.count)\n        XCTAssertEqual(2, map.keys.count)\n        XCTAssertEqual(2, map.values.count)\n        XCTAssertTrue(Set([values[0].key, values[1].key]).isSubset(of: map.keys))\n        XCTAssertEqual(map[values[1].key], values[1].value)\n\n        map[values[2].key] = values[2].value\n        XCTAssertEqual(3, map.count)\n        XCTAssertEqual(3, map.keys.count)\n        XCTAssertEqual(3, map.values.count)\n        XCTAssertTrue(Set(values.map { $0.key }).isSubset(of: map.keys))\n        XCTAssertEqual(map[values[2].key], values[2].value)\n    }\n\n    func testUpdate() {\n        XCTAssertEqual(0, map.count)\n\n        map[values[0].key] = values[0].value\n        XCTAssertEqual(1, map.count)\n        XCTAssertEqual(1, map.keys.count)\n        XCTAssertEqual(1, map.values.count)\n        XCTAssertTrue(Set([values[0].key]).isSubset(of: map.keys))\n        XCTAssertEqual(map[values[0].key], values[0].value)\n\n        map.updateValue(values[1].value, forKey: values[0].key)\n        XCTAssertEqual(1, map.count)\n        XCTAssertEqual(1, map.keys.count)\n        XCTAssertEqual(1, map.values.count)\n        XCTAssertTrue(Set([values[0].key]).isSubset(of: map.keys))\n        XCTAssertEqual(map[values[0].key], values[1].value)\n    }\n\n    func testRemove() {\n        XCTAssertEqual(0, map.count)\n        map.merge(values) { $1 }\n        XCTAssertEqual(3, map.count)\n        XCTAssertEqual(3, map.keys.count)\n        XCTAssertEqual(3, map.values.count)\n        XCTAssertTrue(Set(values.map { $0.key }).isSubset(of: map.keys))\n\n        let key = values[0].key\n        map.setValue(nil, forKey: key)\n        XCTAssertNil(map.value(forKey: key))\n\n        map.removeAll()\n        XCTAssertEqual(0, map.count)\n\n        map.merge(values) { $1 }\n\n        map[values[1].key] = nil\n        XCTAssertNil(map[values[1].key])\n        map.removeObject(for: values[2].key)\n        // make sure the key was deleted\n        XCTAssertTrue(Set([values[0].key]).isSubset(of: map.keys))\n    }\n\n    func testSubscript() {\n        // setter\n        XCTAssertEqual(0, map.count)\n        map[values[0].key] = values[0].value\n        map[values[1].key] = values[1].value\n        map[values[2].key] = values[2].value\n        XCTAssertEqual(3, map.count)\n        XCTAssertEqual(3, map.keys.count)\n        XCTAssertEqual(3, map.values.count)\n        XCTAssertTrue(Set(values.map { $0.key }).isSubset(of: map.keys))\n        map[values[0].key] = values[0].value\n        map[values[1].key] = nil\n        map[values[2].key] = values[2].value\n        XCTAssertEqual(2, map.count)\n        XCTAssertEqual(2, map.keys.count)\n        XCTAssertEqual(2, map.values.count)\n        XCTAssertTrue(Set([values[0].key, values[2].key]).isSubset(of: map.keys))\n        XCTAssertEqual(2, map.count)\n        XCTAssertEqual(2, map.keys.count)\n        XCTAssertEqual(2, map.values.count)\n        XCTAssertTrue(Set([values[0].key, values[2].key]).isSubset(of: map.keys))\n        // getter\n        map.removeAll()\n        XCTAssertNil(map[values[0].key])\n        map[values[0].key] = values[0].value\n        XCTAssertEqual(values[0].value, map[values[0].key])\n    }\n\n    func testObjectForKey() {\n        XCTAssertEqual(0, map.count)\n        map[values[0].key] = values[0].value\n        XCTAssertEqual(values[0].value, dynamicBridgeCast(fromObjectiveC: map.object(forKey: values[0].key as AnyObject)!) as V)\n    }\n}\n\nclass MinMaxPrimitiveMapTests<O: ObjectFactory, V: MapValueFactory>: PrimitiveMapTestsBase<O, V> where V.PersistedType: MinMaxType {\n    func testMin() {\n        XCTAssertNil(map.min())\n        map.merge(values) { $1 }\n        map.merge(values) { $1 }\n        XCTAssertEqual(map.min(), V.min())\n    }\n\n    func testMax() {\n        XCTAssertNil(map.max())\n        map.merge(values) { $1 }\n        XCTAssertEqual(map.max(), V.max())\n    }\n}\n\nclass AddablePrimitiveMapTests<O: ObjectFactory, V: MapValueFactory>: PrimitiveMapTestsBase<O, V> where V: NumericValueFactory, V.PersistedType: AddableType {\n    func testSum() {\n        XCTAssertEqual(map.sum(), .zero)\n        map.merge(values) { $1 }\n        XCTAssertEqual(V.doubleValue(map.sum()), V.sum(), accuracy: 0.01)\n    }\n\n    func testAverage() {\n        XCTAssertNil(map.average() as V.AverageType?)\n        map.merge(values) { $1 }\n        XCTAssertEqual(V.doubleValue(map.average()!), V.average(), accuracy: 0.1)\n    }\n}\n\nclass SortablePrimitiveMapTests<O: ObjectFactory, V: MapValueFactory>: PrimitiveMapTestsBase<O, V> where V.PersistedType: SortableType {\n    func testSorted() {\n        map.merge(values) { $1 }\n        XCTAssertEqual(map.count, 3)\n        let values2: [V] = values.map { $0.value }\n\n        assertEqual(values2, Array(map.sorted()))\n        assertEqual(values2, Array(map.sorted(ascending: true)))\n        assertEqual(values2.reversed(), Array(map.sorted(ascending: false)))\n    }\n}\n\nfunc addPrimitiveMapTests<OF: ObjectFactory>(_ suite: XCTestSuite, _ type: OF.Type) {\n    PrimitiveMapTests<OF, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Int8>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Int16>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Int32>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Int64>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Bool>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, String>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Data>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Date>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, ObjectId>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Decimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, UUID>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    MinMaxPrimitiveMapTests<OF, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, Int8>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, Int16>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, Int32>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, Int64>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, Date>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, Decimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    AddablePrimitiveMapTests<OF, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMapTests<OF, Int8>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMapTests<OF, Int16>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMapTests<OF, Int32>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMapTests<OF, Int64>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMapTests<OF, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMapTests<OF, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMapTests<OF, Decimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    PrimitiveMapTests<OF, Int?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Int8?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Int16?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Int32?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Int64?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Bool?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Float?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Double?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, String?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Data?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Date?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, ObjectId?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, Decimal128?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, UUID?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    MinMaxPrimitiveMapTests<OF, Int?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, Int8?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, Int16?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, Int32?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, Int64?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, Float?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, Double?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, Date?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, Decimal128?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    AddablePrimitiveMapTests<OF, Int?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMapTests<OF, Int8?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMapTests<OF, Int16?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMapTests<OF, Int32?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMapTests<OF, Int64?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMapTests<OF, Float?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMapTests<OF, Double?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMapTests<OF, Decimal128?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    PrimitiveMapTests<OF, EnumInt>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, EnumInt8>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, EnumInt16>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, EnumInt32>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, EnumInt64>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, EnumFloat>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, EnumDouble>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, EnumString>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    MinMaxPrimitiveMapTests<OF, EnumInt>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, EnumInt8>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, EnumInt16>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, EnumInt32>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, EnumInt64>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, EnumFloat>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, EnumDouble>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    PrimitiveMapTests<OF, EnumInt?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, EnumInt8?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, EnumInt16?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, EnumInt32?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, EnumInt64?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, EnumFloat?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, EnumDouble?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMapTests<OF, EnumString?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    MinMaxPrimitiveMapTests<OF, EnumInt?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, EnumInt8?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, EnumInt16?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, EnumInt32?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, EnumInt64?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, EnumFloat?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMapTests<OF, EnumDouble?>.defaultTestSuite.tests.forEach(suite.addTest)\n}\n\nclass UnmanagedPrimitiveMapTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        let suite = XCTestSuite(name: \"Unmanaged Primitive Maps\")\n        addPrimitiveMapTests(suite, UnmanagedObjectFactory.self)\n        return suite\n    }\n}\n\nclass ManagedPrimitiveMapTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        let suite = XCTestSuite(name: \"Managed Primitive Maps\")\n        addPrimitiveMapTests(suite, ManagedObjectFactory.self)\n\n        SortablePrimitiveMapTests<ManagedObjectFactory, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, Int8>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, Int16>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, Int32>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, Int64>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, String>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, Date>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, Data>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        SortablePrimitiveMapTests<ManagedObjectFactory, Int?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, Int8?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, Int16?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, Int32?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, Int64?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, Float?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, Double?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, String?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, Date?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, Data?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        SortablePrimitiveMapTests<ManagedObjectFactory, EnumInt>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, EnumInt8>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, EnumInt16>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, EnumInt32>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, EnumInt64>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, EnumFloat>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, EnumDouble>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, EnumString>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        SortablePrimitiveMapTests<ManagedObjectFactory, EnumInt?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, EnumInt8?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, EnumInt16?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, EnumInt32?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, EnumInt64?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, EnumFloat?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, EnumDouble?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMapTests<ManagedObjectFactory, EnumString?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        return suite\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/PrimitiveMutableSetTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\n#if canImport(RealmSwiftTestSupport)\nimport RealmSwiftTestSupport\n#endif\n\nclass PrimitiveMutableSetTestsBase<O: ObjectFactory, V: SetValueFactory>: TestCase {\n    var realm: Realm?\n    var obj: V.SetRoot!\n    var obj2: V.SetRoot!\n    var mutableSet: MutableSet<V>!\n    var otherMutableSet: MutableSet<V>!\n    var values: [V]!\n\n    override func setUp() {\n        obj = O.get()\n        obj2 = O.get()\n        realm = obj.realm\n        mutableSet = obj[keyPath: V.mutableSet]\n        otherMutableSet = obj2[keyPath: V.mutableSet]\n        values = V.values()\n    }\n\n    override func tearDown() {\n        realm?.cancelWrite()\n        mutableSet = nil\n        otherMutableSet = nil\n        obj = nil\n        obj2 = nil\n        realm = nil\n    }\n}\n\nclass PrimitiveMutableSetTests<O: ObjectFactory, V: SetValueFactory>: PrimitiveMutableSetTestsBase<O, V> {\n    func testInvalidated() {\n        XCTAssertFalse(mutableSet.isInvalidated)\n        if let realm = obj.realm {\n            realm.delete(obj)\n            XCTAssertTrue(mutableSet.isInvalidated)\n        }\n    }\n\n    func testValueForKey() {\n        XCTAssertEqual(mutableSet.value(forKey: \"self\").count, 0)\n        mutableSet.insert(objectsIn: values)\n        let valuesSet = Set(values!)\n        let kvoSet = Set(mutableSet.value(forKey: \"self\").map { dynamicBridgeCast(fromObjectiveC: $0) as V })\n        XCTAssertEqual(valuesSet, kvoSet)\n        assertThrows(mutableSet.value(forKey: \"not self\"), named: \"NSUnknownKeyException\")\n    }\n\n    func testInsert() {\n        XCTAssertEqual(Int(0), mutableSet.count)\n\n        mutableSet.insert(values[0])\n        XCTAssertEqual(Int(1), mutableSet.count)\n        XCTAssertTrue(mutableSet.contains(values[0]))\n\n        mutableSet.insert(values[1])\n        XCTAssertEqual(Int(2), mutableSet.count)\n        XCTAssertTrue(mutableSet.contains(values[0]))\n        XCTAssertTrue(mutableSet.contains(values[1]))\n\n        mutableSet.insert(values[2])\n        XCTAssertEqual(Int(3), mutableSet.count)\n        XCTAssertTrue(mutableSet.contains(values[0]))\n        XCTAssertTrue(mutableSet.contains(values[1]))\n\n        mutableSet.insert(values[2])\n        XCTAssertEqual(Int(3), mutableSet.count)\n        XCTAssertTrue(mutableSet.contains(values[0]))\n        XCTAssertTrue(mutableSet.contains(values[1]))\n        XCTAssertTrue(mutableSet.contains(values[2]))\n        // Insert duplicate\n        mutableSet.insert(values[2])\n        XCTAssertEqual(Int(3), mutableSet.count)\n        XCTAssertTrue(mutableSet.contains(values[0]))\n        XCTAssertTrue(mutableSet.contains(values[1]))\n        XCTAssertTrue(mutableSet.contains(values[2]))\n    }\n\n    func testRemove() {\n        mutableSet.removeAll()\n        XCTAssertEqual(mutableSet.count, 0)\n        mutableSet.insert(objectsIn: values)\n        mutableSet.remove(values[0])\n        XCTAssertFalse(mutableSet.contains(values[0]))\n        XCTAssertTrue(mutableSet.contains(values[1]))\n        XCTAssertTrue(mutableSet.contains(values[2]))\n    }\n\n    func testRemoveAll() {\n        mutableSet.removeAll()\n        mutableSet.insert(objectsIn: values)\n        mutableSet.removeAll()\n        XCTAssertEqual(mutableSet.count, 0)\n    }\n\n    func testIsSubset() {\n        XCTAssertEqual(Int(0), mutableSet.count)\n        XCTAssertEqual(Int(0), otherMutableSet.count)\n        mutableSet.insert(objectsIn: values)\n        otherMutableSet.insert(values[0])\n        // Both sets contain values[0]\n        XCTAssertTrue(otherMutableSet.isSubset(of: mutableSet))\n        otherMutableSet.remove(values[0])\n        XCTAssertFalse(mutableSet.isSubset(of: otherMutableSet))\n    }\n\n    func testContains() {\n        XCTAssertEqual(Int(0), mutableSet.count)\n        XCTAssertEqual(Int(0), otherMutableSet.count)\n        mutableSet.insert(objectsIn: values)\n        XCTAssertEqual(values.count, mutableSet.count)\n        values.forEach {\n            XCTAssertTrue(mutableSet.contains($0))\n        }\n    }\n\n    func testIntersects() {\n        XCTAssertEqual(Int(0), mutableSet.count)\n        XCTAssertEqual(Int(0), otherMutableSet.count)\n        mutableSet.insert(objectsIn: values)\n        otherMutableSet.insert(values[0])\n        // Both sets contain values[0]\n        XCTAssertTrue(otherMutableSet.intersects(mutableSet))\n        otherMutableSet.remove(values[0])\n        XCTAssertFalse(mutableSet.intersects(otherMutableSet))\n    }\n\n    func testFormIntersection() {\n        XCTAssertEqual(Int(0), mutableSet.count)\n        XCTAssertEqual(Int(0), otherMutableSet.count)\n        mutableSet.insert(objectsIn: values)\n        otherMutableSet.insert(values[0])\n        // Both sets contain values[0]\n        mutableSet.formIntersection(otherMutableSet)\n        XCTAssertEqual(Int(1), mutableSet.count)\n        assertSetContains(mutableSet, keyPath: \\.self, items: [values[0]])\n    }\n\n    func testFormUnion() {\n        XCTAssertEqual(Int(0), mutableSet.count)\n        XCTAssertEqual(Int(0), otherMutableSet.count)\n        mutableSet.insert(values[0])\n        mutableSet.insert(values[1])\n        otherMutableSet.insert(values[0])\n        otherMutableSet.insert(values[2])\n        mutableSet.formUnion(otherMutableSet)\n        XCTAssertEqual(Int(3), mutableSet.count)\n        assertSetContains(mutableSet, keyPath: \\.self, items: [values[0], values[1], values[2]])\n    }\n\n    func testSubtract() {\n        XCTAssertEqual(Int(0), mutableSet.count)\n        XCTAssertEqual(Int(0), otherMutableSet.count)\n        mutableSet.insert(values[0])\n        mutableSet.insert(values[1])\n        otherMutableSet.insert(values[0])\n        otherMutableSet.insert(values[2])\n        mutableSet.subtract(otherMutableSet)\n        XCTAssertEqual(Int(1), mutableSet.count)\n        XCTAssertFalse(mutableSet.contains(values[0]))\n        XCTAssertTrue(mutableSet.contains(values[1]))\n    }\n\n    func testSubscript() {\n        mutableSet.insert(objectsIn: values)\n        XCTAssertTrue(values.contains(mutableSet[0]))\n        XCTAssertTrue(values.contains(mutableSet[1]))\n        XCTAssertTrue(values.contains(mutableSet[2]))\n    }\n}\n\nclass MinMaxPrimitiveMutableSetTests<O: ObjectFactory, V: SetValueFactory>: PrimitiveMutableSetTestsBase<O, V> where V.PersistedType: MinMaxType {\n    func testMin() {\n        XCTAssertNil(mutableSet.min())\n        mutableSet.insert(objectsIn: values)\n        XCTAssertEqual(mutableSet.min(), V.min())\n    }\n\n    func testMax() {\n        XCTAssertNil(mutableSet.max())\n        mutableSet.insert(objectsIn: values)\n        XCTAssertEqual(mutableSet.max(), V.max())\n    }\n}\n\nclass AddablePrimitiveMutableSetTests<O: ObjectFactory, V: SetValueFactory>: PrimitiveMutableSetTestsBase<O, V> where V: NumericValueFactory, V.PersistedType: AddableType {\n    func testSum() {\n        XCTAssertEqual(mutableSet.sum(), .zero)\n        mutableSet.insert(objectsIn: values)\n        XCTAssertEqual(V.doubleValue(mutableSet.sum()), V.sum(), accuracy: 0.01)\n    }\n\n    func testAverage() {\n        XCTAssertNil(mutableSet.average() as V.AverageType?)\n        mutableSet.insert(objectsIn: values)\n        XCTAssertEqual(V.doubleValue(mutableSet.average()!), V.average(), accuracy: 0.01)\n    }\n}\n\nclass SortablePrimitiveMutableSetTests<O: ObjectFactory, V: SetValueFactory>: PrimitiveMutableSetTestsBase<O, V> where V.PersistedType: SortableType {\n    func testSorted() {\n        var shuffled = values!\n        shuffled.removeFirst()\n        shuffled.append(values!.first!)\n        mutableSet.insert(objectsIn: shuffled)\n\n        assertEqual(Array(mutableSet.sorted(ascending: true)), values)\n        assertEqual(Array(mutableSet.sorted(ascending: false)), values.reversed())\n    }\n}\n\nfunc addMutableSetTests<OF: ObjectFactory>(_ suite: XCTestSuite, _ type: OF.Type) {\n    PrimitiveMutableSetTests<OF, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, Int8>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, Int16>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, Int32>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, Int64>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, String>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, Data>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, Date>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, Decimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, ObjectId>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, UUID>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    MinMaxPrimitiveMutableSetTests<OF, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, Int8>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, Int16>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, Int32>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, Int64>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, Date>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, Decimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    AddablePrimitiveMutableSetTests<OF, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMutableSetTests<OF, Int8>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMutableSetTests<OF, Int16>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMutableSetTests<OF, Int32>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMutableSetTests<OF, Int64>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMutableSetTests<OF, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMutableSetTests<OF, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMutableSetTests<OF, Decimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    PrimitiveMutableSetTests<OF, Int?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, Int8?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, Int16?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, Int32?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, Int64?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, Float?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, Double?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, String?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, Data?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, Date?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, Decimal128?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, ObjectId?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, UUID?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    MinMaxPrimitiveMutableSetTests<OF, Int?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, Int8?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, Int16?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, Int32?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, Int64?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, Float?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, Double?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, Date?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, Decimal128?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    AddablePrimitiveMutableSetTests<OF, Int?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMutableSetTests<OF, Int8?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMutableSetTests<OF, Int16?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMutableSetTests<OF, Int32?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMutableSetTests<OF, Int64?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMutableSetTests<OF, Float?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMutableSetTests<OF, Double?>.defaultTestSuite.tests.forEach(suite.addTest)\n    AddablePrimitiveMutableSetTests<OF, Decimal128?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    PrimitiveMutableSetTests<OF, EnumInt>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, EnumInt8>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, EnumInt16>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, EnumInt32>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, EnumInt64>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, EnumFloat>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, EnumDouble>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, EnumString>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    MinMaxPrimitiveMutableSetTests<OF, EnumInt>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, EnumInt8>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, EnumInt16>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, EnumInt32>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, EnumInt64>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, EnumFloat>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, EnumDouble>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    PrimitiveMutableSetTests<OF, EnumInt?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, EnumInt8?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, EnumInt16?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, EnumInt32?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, EnumInt64?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, EnumFloat?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, EnumDouble?>.defaultTestSuite.tests.forEach(suite.addTest)\n    PrimitiveMutableSetTests<OF, EnumString?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n    MinMaxPrimitiveMutableSetTests<OF, EnumInt?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, EnumInt8?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, EnumInt16?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, EnumInt32?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, EnumInt64?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, EnumFloat?>.defaultTestSuite.tests.forEach(suite.addTest)\n    MinMaxPrimitiveMutableSetTests<OF, EnumDouble?>.defaultTestSuite.tests.forEach(suite.addTest)\n}\n\nclass UnmanagedPrimitiveMutableSetTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        let suite = XCTestSuite(name: \"Unmanaged Primitive Sets\")\n        addMutableSetTests(suite, UnmanagedObjectFactory.self)\n        return suite\n    }\n}\n\nclass ManagedPrimitiveMutableSetTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        let suite = XCTestSuite(name: \"Managed Primitive Sets\")\n        addMutableSetTests(suite, ManagedObjectFactory.self)\n\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, Int>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, Int8>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, Int16>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, Int32>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, Int64>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, Float>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, Double>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, String>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, Date>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, Data>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, Int?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, Int8?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, Int16?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, Int32?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, Int64?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, Float?> .defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, Double?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, String?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, Date?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, Data?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, EnumInt>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, EnumInt8>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, EnumInt16>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, EnumInt32>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, EnumInt64>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, EnumFloat>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, EnumDouble>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, EnumString>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, EnumInt?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, EnumInt8?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, EnumInt16?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, EnumInt32?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, EnumInt64?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, EnumFloat?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, EnumDouble?>.defaultTestSuite.tests.forEach(suite.addTest)\n        SortablePrimitiveMutableSetTests<ManagedObjectFactory, EnumString?>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        return suite\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/ProjectedCollectTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport RealmSwift\nimport XCTest\n\nclass PersistedCollections: Object {\n    @Persisted public var list: List<CommonPerson>\n    @Persisted public var set: MutableSet<CommonPerson>\n}\n\nclass ProjectedCollections: Projection<PersistedCollections> {\n    @Projected(\\PersistedCollections.list.projectTo.firstName) var list: ProjectedCollection<String>\n    @Projected(\\PersistedCollections.set.projectTo.firstName) var set: ProjectedCollection<String>\n}\n\nclass ProjectedCollectionsTestsTemplate: TestCase {\n    // To test some of methods there should be a collection of projections instead of collection of strings\n    // set value in subclass\n    var collection: ProjectedCollection<String>!\n\n    override func setUp() {\n        super.setUp()\n        let realm = realmWithTestPath()\n        try! realm.write {\n            let js = realm.create(CommonPerson.self, value: [\"firstName\": \"John\",\n                                                             \"lastName\": \"Snow\",\n                                                             \"birthday\": Date(timeIntervalSince1970: 10),\n                                                             \"address\": [\"Winterfell\", \"Kingdom in the North\"],\n                                                             \"money\": Decimal128(\"2.22\")])\n            let dt = realm.create(CommonPerson.self, value: [\"firstName\": \"Daenerys\",\n                                                             \"lastName\": \"Targaryen\",\n                                                             \"birthday\": Date(timeIntervalSince1970: 0),\n                                                             \"address\": [\"King's Landing\", \"Westeros\"],\n                                                             \"money\": Decimal128(\"2.22\")])\n            let tl = realm.create(CommonPerson.self, value: [\"firstName\": \"Tyrion\",\n                                                             \"lastName\": \"Lannister\",\n                                                             \"birthday\": Date(timeIntervalSince1970: 20),\n                                                             \"address\": [\"Casterly Rock\", \"Westeros\"],\n                                                             \"money\": Decimal128(\"9999.95\")])\n            js.friends.append(dt)\n            js.friends.append(tl)\n            dt.friends.append(js)\n\n            realm.create(PersistedCollections.self, value: [[js, dt, tl], [js, dt, tl]])\n        }\n    }\n\n    override func tearDown() {\n        collection = nil\n        super.tearDown()\n    }\n\n    override class var defaultTestSuite: XCTestSuite {\n        // Don't run tests for the base class\n        if isEqual(ProjectedCollectionsTestsTemplate.self) {\n            return XCTestSuite(name: \"empty\")\n        }\n        return super.defaultTestSuite\n    }\n\n    func testCount() {\n        XCTAssertEqual(collection.count, 3)\n    }\n\n    func testAccess() {\n        XCTAssertEqual(collection[0], collection.first)\n        XCTAssertEqual(collection[2], collection.last)\n        XCTAssertNil(collection.firstIndex(of: \"Not tere\"))\n        XCTAssertNotNil(collection.firstIndex(of: \"Daenerys\"))\n    }\n\n    func testSetValues() {\n        let realm = realmWithTestPath()\n        try! realm.write {\n            collection[0] = \"Overwrite\"\n        }\n        XCTAssertEqual(collection.first, \"Overwrite\")\n        let chandedObject = realm.objects(CommonPerson.self).filter(\"firstName == 'Overwrite'\").first\n        XCTAssertNotNil(chandedObject)\n    }\n\n    func testFreezeThawProjectedCollection() {\n        let realm = realmWithTestPath()\n        let johnSnow = realm.objects(PersonProjection.self).first!\n        let projectedSet = collection.freeze()\n\n        XCTAssertTrue(projectedSet.isFrozen)\n        XCTAssertFalse(johnSnow.isFrozen)\n\n        let frosenJohn = johnSnow.freeze()\n        let frozenProjectedSet = frosenJohn.firstFriendsName\n\n        XCTAssertTrue(frosenJohn.isFrozen)\n        XCTAssertTrue(projectedSet.isFrozen)\n        XCTAssertTrue(frozenProjectedSet.isFrozen)\n    }\n\n    func testRealm() {\n        guard collection.realm != nil else {\n            XCTAssertNotNil(collection.realm)\n            return\n        }\n        XCTAssertEqual(collection.realm!.configuration.fileURL, realmWithTestPath().configuration.fileURL)\n    }\n\n    func testDescription() {\n        XCTAssertEqual(collection.description, \"ProjectedCollection<String> {\\n\\t[0] John\\n\\t[1] Daenerys\\n\\t[2] Tyrion\\n}\")\n    }\n\n    func testFilterFormat() {\n        XCTAssertNotNil(collection.filter { $0 == \"Daenerys\" }.first!)\n        XCTAssertNil(collection.filter { $0 == \"Not There\" }.first)\n    }\n\n    func testSortWithProperty() {\n        XCTAssertEqual(\"Tyrion\", collection.sorted { $0 > $1 }.first!)\n        XCTAssertEqual(\"Daenerys\", collection.sorted { $0 > $1 }.last!)\n    }\n\n    func testFastEnumeration() {\n        XCTAssertGreaterThan(collection.count, 0)\n        for element in collection {\n            _ = element\n        }\n    }\n\n    @MainActor\n    func testObserve() {\n        let ex = expectation(description: \"initial notification\")\n        let token = collection.observe { (changes: RealmCollectionChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 3)\n            case .update:\n                XCTFail(\"Shouldn't happen\")\n            case .error:\n                XCTFail(\"Shouldn't happen\")\n            }\n\n            ex.fulfill()\n        }\n        waitForExpectations(timeout: 1, handler: nil)\n\n        // add a second notification and wait for it\n        var ex2 = expectation(description: \"second initial notification\")\n        let token2 = collection.observe { _ in\n            ex2.fulfill()\n        }\n        waitForExpectations(timeout: 1, handler: nil)\n\n        // make a write and implicitly verify that only the unskipped\n        // notification is called (the first would error on .update)\n        ex2 = expectation(description: \"change notification\")\n        let realm = realmWithTestPath()\n        realm.beginWrite()\n        realm.delete(realm.objects(CommonPerson.self))\n        try! realm.commitWrite(withoutNotifying: [token])\n        waitForExpectations(timeout: 1, handler: nil)\n\n        token.invalidate()\n        token2.invalidate()\n    }\n\n    @MainActor\n    func testObserveKeyPathNoChange() {\n        let ex = expectation(description: \"initial notification\")\n        let token0 = collection.observe(keyPaths: [\"firstName\"]) { (changes: RealmCollectionChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 3)\n            case .update:\n                XCTFail(\"update not expected\")\n            case .error:\n                XCTFail(\"error not expected\")\n            }\n            ex.fulfill()\n        }\n\n        let config = configurationWithTestPath()\n        dispatchSyncNewThread { @Sendable in\n            let realm = try! Realm(configuration: config)\n            realm.beginWrite()\n            let obj = realm.create(CommonPerson.self)\n            obj.firstName = \"Name\"\n            try! realm.commitWrite()\n        }\n        waitForExpectations(timeout: 2, handler: nil)\n        token0.invalidate()\n    }\n\n    func observeOnQueue<Collection: RealmCollection>(_ collection: Collection) where Collection.Element: Object {\n        let sema = DispatchSemaphore(value: 0)\n        let token = collection.observe(keyPaths: nil, on: queue) { (changes: RealmCollectionChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 2)\n            case .update(let collection, let deletions, _, _):\n                XCTAssertEqual(collection.count, 0)\n                XCTAssertEqual(deletions, [0, 1])\n            case .error:\n                XCTFail(\"Shouldn't happen\")\n            }\n\n            sema.signal()\n        }\n        sema.wait()\n\n        let realm = realmWithTestPath()\n        try! realm.write {\n            realm.delete(collection)\n        }\n        sema.wait()\n\n        token.invalidate()\n    }\n\n    func testInvalidate() {\n        XCTAssertFalse(collection.isInvalidated)\n        realmWithTestPath().invalidate()\n        XCTAssertTrue(collection.realm == nil || collection.isInvalidated)\n    }\n\n    func testIsFrozen() {\n        XCTAssertFalse(collection.isFrozen)\n        XCTAssertTrue(collection.freeze().isFrozen)\n    }\n\n    func testThaw() {\n        let frozen = collection.freeze()\n        XCTAssertTrue(frozen.isFrozen)\n\n        let frozenRealm = frozen.realm!\n        assertThrows(try! frozenRealm.write {}, reason: \"Can't perform transactions on a frozen Realm\")\n\n        let live = frozen.thaw()\n        XCTAssertFalse(live!.isFrozen)\n\n        let liveRealm = live!.realm!\n        try! liveRealm.write { liveRealm.delete(liveRealm.objects(PersistedCollections.self)) }\n        XCTAssertTrue(live!.isInvalidated)\n        XCTAssertFalse(frozen.isEmpty)\n        try! liveRealm.write { liveRealm.delete(liveRealm.objects(CommonPerson.self)) }\n        XCTAssertFalse(frozen.isInvalidated)\n    }\n\n    func testThawFromDifferentThread() {\n        nonisolated(unsafe) let frozen = collection.freeze()\n        XCTAssertTrue(frozen.isFrozen)\n\n        dispatchSyncNewThread {\n            let live = frozen.thaw()\n            XCTAssertFalse(live!.isFrozen)\n\n            let liveRealm = live!.realm!\n            try! liveRealm.write { liveRealm.delete(liveRealm.objects(PersistedCollections.self)) }\n            XCTAssertTrue(live!.isInvalidated)\n            XCTAssertFalse(frozen.isEmpty)\n        }\n    }\n\n    func testFreezeFromWrongThread() {\n        nonisolated(unsafe) let collection = realmWithTestPath().objects(PersonProjection.self).first!.firstFriendsName\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            unsafeSelf.assertThrows(collection.freeze(), reason: \"Realm accessed from incorrect thread\")\n        }\n    }\n\n    func testAccessFrozenCollectionFromDifferentThread() {\n        nonisolated(unsafe) let frozen = collection.freeze()\n        dispatchSyncNewThread {\n            XCTAssertTrue(frozen.contains(where: { $0 == \"Daenerys\" }))\n            XCTAssertTrue(frozen.contains(where: { $0 == \"Tyrion\" }))\n        }\n    }\n\n    func testObserveFrozenCollection() {\n        let frozen = collection.freeze()\n        assertThrows(frozen.observe({ _ in }),\n                     reason: \"Frozen Realms do not change and do not have change notifications.\")\n    }\n\n    func testFilterFrozenCollection() {\n        let frozen = collection.freeze()\n        XCTAssertEqual(frozen.filter({ $0 == \"Daenerys\" }).count, 1)\n        XCTAssertNil(frozen.filter({ $0 == \"Nothing\" }).first)\n    }\n}\n\nclass ProjectedListTests: ProjectedCollectionsTestsTemplate {\n    override func setUp() {\n        super.setUp()\n        let realm = realmWithTestPath()\n        try! realm.write {\n            let people = realm.objects(CommonPerson.self)\n            realm.create(PersistedCollections.self, value: [\"list\": people])\n        }\n        collection = realmWithTestPath().objects(ProjectedCollections.self)[0].list\n    }\n}\n\nclass ProjectedSetTests: ProjectedCollectionsTestsTemplate {\n    override func setUp() {\n        super.setUp()\n        let realm = realmWithTestPath()\n        try! realm.write {\n            let people = realm.objects(CommonPerson.self)\n            realm.create(PersistedCollections.self, value: [\"set\": people])\n        }\n        collection = realmWithTestPath().objects(ProjectedCollections.self)[0].set\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/ProjectionTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\nimport RealmSwift\nimport XCTest\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\n#endif\n\n// Keypaths are supposed to be Sendable but that never got implemented\n#if compiler(<6)\nextension KeyPath: @unchecked Sendable {}\n#else\nextension KeyPath: @retroactive @unchecked Sendable {}\n#endif\n\n// MARK: Test objects definitions\n\nenum IntegerEnum: Int, PersistableEnum {\n    case value1 = 1\n    case value2 = 3\n}\n\nclass AllTypesPrimitiveProjection: Projection<ModernAllTypesObject> {\n    @Projected(\\ModernAllTypesObject.pk) var pk\n    @Projected(\\ModernAllTypesObject.boolCol) var boolCol\n    @Projected(\\ModernAllTypesObject.intCol) var intCol\n    @Projected(\\ModernAllTypesObject.int8Col) var int8Col\n    @Projected(\\ModernAllTypesObject.int16Col) var int16Col\n    @Projected(\\ModernAllTypesObject.int32Col) var int32Col\n    @Projected(\\ModernAllTypesObject.int64Col) var int64Col\n    @Projected(\\ModernAllTypesObject.floatCol) var floatCol\n    @Projected(\\ModernAllTypesObject.doubleCol) var doubleCol\n    @Projected(\\ModernAllTypesObject.stringCol) var stringCol\n    @Projected(\\ModernAllTypesObject.binaryCol) var binaryCol\n    @Projected(\\ModernAllTypesObject.dateCol) var dateCol\n    @Projected(\\ModernAllTypesObject.decimalCol) var decimalCol\n    @Projected(\\ModernAllTypesObject.objectIdCol) var objectIdCol\n    @Projected(\\ModernAllTypesObject.objectCol) var objectCol\n    @Projected(\\ModernAllTypesObject.arrayCol) var arrayCol\n    @Projected(\\ModernAllTypesObject.setCol) var setCol\n    @Projected(\\ModernAllTypesObject.anyCol) var anyCol\n    @Projected(\\ModernAllTypesObject.uuidCol) var uuidCol\n    @Projected(\\ModernAllTypesObject.intEnumCol) var intEnumCol\n    @Projected(\\ModernAllTypesObject.stringEnumCol) var stringEnumCol\n\n    @Projected(\\ModernAllTypesObject.optIntCol) var optIntCol\n    @Projected(\\ModernAllTypesObject.optInt8Col) var optInt8Col\n    @Projected(\\ModernAllTypesObject.optInt16Col) var optInt16Col\n    @Projected(\\ModernAllTypesObject.optInt32Col) var optInt32Col\n    @Projected(\\ModernAllTypesObject.optInt64Col) var optInt64Col\n    @Projected(\\ModernAllTypesObject.optFloatCol) var optFloatCol\n    @Projected(\\ModernAllTypesObject.optDoubleCol) var optDoubleCol\n    @Projected(\\ModernAllTypesObject.optBoolCol) var optBoolCol\n    @Projected(\\ModernAllTypesObject.optStringCol) var optStringCol\n    @Projected(\\ModernAllTypesObject.optBinaryCol) var optBinaryCol\n    @Projected(\\ModernAllTypesObject.optDateCol) var optDateCol\n    @Projected(\\ModernAllTypesObject.optDecimalCol) var optDecimalCol\n    @Projected(\\ModernAllTypesObject.optObjectIdCol) var optObjectIdCol\n    @Projected(\\ModernAllTypesObject.optUuidCol) var optUuidCol\n    @Projected(\\ModernAllTypesObject.optIntEnumCol) var optIntEnumCol\n    @Projected(\\ModernAllTypesObject.optStringEnumCol) var optStringEnumCol\n\n    @Projected(\\ModernAllTypesObject.arrayBool) var arrayBool\n    @Projected(\\ModernAllTypesObject.arrayInt) var arrayInt\n    @Projected(\\ModernAllTypesObject.arrayInt8) var arrayInt8\n    @Projected(\\ModernAllTypesObject.arrayInt16) var arrayInt16\n    @Projected(\\ModernAllTypesObject.arrayInt32) var arrayInt32\n    @Projected(\\ModernAllTypesObject.arrayInt64) var arrayInt64\n    @Projected(\\ModernAllTypesObject.arrayFloat) var arrayFloat\n    @Projected(\\ModernAllTypesObject.arrayDouble) var arrayDouble\n    @Projected(\\ModernAllTypesObject.arrayString) var arrayString\n    @Projected(\\ModernAllTypesObject.arrayBinary) var arrayBinary\n    @Projected(\\ModernAllTypesObject.arrayDate) var arrayDate\n    @Projected(\\ModernAllTypesObject.arrayDecimal) var arrayDecimal\n    @Projected(\\ModernAllTypesObject.arrayObjectId) var arrayObjectId\n    @Projected(\\ModernAllTypesObject.arrayAny) var arrayAny\n    @Projected(\\ModernAllTypesObject.arrayUuid) var arrayUuid\n\n    @Projected(\\ModernAllTypesObject.arrayOptBool) var arrayOptBool\n    @Projected(\\ModernAllTypesObject.arrayOptInt) var arrayOptInt\n    @Projected(\\ModernAllTypesObject.arrayOptInt8) var arrayOptInt8\n    @Projected(\\ModernAllTypesObject.arrayOptInt16) var arrayOptInt16\n    @Projected(\\ModernAllTypesObject.arrayOptInt32) var arrayOptInt32\n    @Projected(\\ModernAllTypesObject.arrayOptInt64) var arrayOptInt64\n    @Projected(\\ModernAllTypesObject.arrayOptFloat) var arrayOptFloat\n    @Projected(\\ModernAllTypesObject.arrayOptDouble) var arrayOptDouble\n    @Projected(\\ModernAllTypesObject.arrayOptString) var arrayOptString\n    @Projected(\\ModernAllTypesObject.arrayOptBinary) var arrayOptBinary\n    @Projected(\\ModernAllTypesObject.arrayOptDate) var arrayOptDate\n    @Projected(\\ModernAllTypesObject.arrayOptDecimal) var arrayOptDecimal\n    @Projected(\\ModernAllTypesObject.arrayOptObjectId) var arrayOptObjectId\n    @Projected(\\ModernAllTypesObject.arrayOptUuid) var arrayOptUuid\n\n    @Projected(\\ModernAllTypesObject.setBool) var setBool\n    @Projected(\\ModernAllTypesObject.setInt) var setInt\n    @Projected(\\ModernAllTypesObject.setInt8) var setInt8\n    @Projected(\\ModernAllTypesObject.setInt16) var setInt16\n    @Projected(\\ModernAllTypesObject.setInt32) var setInt32\n    @Projected(\\ModernAllTypesObject.setInt64) var setInt64\n    @Projected(\\ModernAllTypesObject.setFloat) var setFloat\n    @Projected(\\ModernAllTypesObject.setDouble) var setDouble\n    @Projected(\\ModernAllTypesObject.setString) var setString\n    @Projected(\\ModernAllTypesObject.setBinary) var setBinary\n    @Projected(\\ModernAllTypesObject.setDate) var setDate\n    @Projected(\\ModernAllTypesObject.setDecimal) var setDecimal\n    @Projected(\\ModernAllTypesObject.setObjectId) var setObjectId\n    @Projected(\\ModernAllTypesObject.setAny) var setAny\n    @Projected(\\ModernAllTypesObject.setUuid) var setUuid\n\n    @Projected(\\ModernAllTypesObject.setOptBool) var setOptBool\n    @Projected(\\ModernAllTypesObject.setOptInt) var setOptInt\n    @Projected(\\ModernAllTypesObject.setOptInt8) var setOptInt8\n    @Projected(\\ModernAllTypesObject.setOptInt16) var setOptInt16\n    @Projected(\\ModernAllTypesObject.setOptInt32) var setOptInt32\n    @Projected(\\ModernAllTypesObject.setOptInt64) var setOptInt64\n    @Projected(\\ModernAllTypesObject.setOptFloat) var setOptFloat\n    @Projected(\\ModernAllTypesObject.setOptDouble) var setOptDouble\n    @Projected(\\ModernAllTypesObject.setOptString) var setOptString\n    @Projected(\\ModernAllTypesObject.setOptBinary) var setOptBinary\n    @Projected(\\ModernAllTypesObject.setOptDate) var setOptDate\n    @Projected(\\ModernAllTypesObject.setOptDecimal) var setOptDecimal\n    @Projected(\\ModernAllTypesObject.setOptObjectId) var setOptObjectId\n    @Projected(\\ModernAllTypesObject.setOptUuid) var setOptUuid\n\n    @Projected(\\ModernAllTypesObject.mapBool) var mapBool\n    @Projected(\\ModernAllTypesObject.mapInt) var mapInt\n    @Projected(\\ModernAllTypesObject.mapInt8) var mapInt8\n    @Projected(\\ModernAllTypesObject.mapInt16) var mapInt16\n    @Projected(\\ModernAllTypesObject.mapInt32) var mapInt32\n    @Projected(\\ModernAllTypesObject.mapInt64) var mapInt64\n    @Projected(\\ModernAllTypesObject.mapFloat) var mapFloat\n    @Projected(\\ModernAllTypesObject.mapDouble) var mapDouble\n    @Projected(\\ModernAllTypesObject.mapString) var mapString\n    @Projected(\\ModernAllTypesObject.mapBinary) var mapBinary\n    @Projected(\\ModernAllTypesObject.mapDate) var mapDate\n    @Projected(\\ModernAllTypesObject.mapDecimal) var mapDecimal\n    @Projected(\\ModernAllTypesObject.mapObjectId) var mapObjectId\n    @Projected(\\ModernAllTypesObject.mapAny) var mapAny\n    @Projected(\\ModernAllTypesObject.mapUuid) var mapUuid\n\n    @Projected(\\ModernAllTypesObject.mapOptBool) var mapOptBool\n    @Projected(\\ModernAllTypesObject.mapOptInt) var mapOptInt\n    @Projected(\\ModernAllTypesObject.mapOptInt8) var mapOptInt8\n    @Projected(\\ModernAllTypesObject.mapOptInt16) var mapOptInt16\n    @Projected(\\ModernAllTypesObject.mapOptInt32) var mapOptInt32\n    @Projected(\\ModernAllTypesObject.mapOptInt64) var mapOptInt64\n    @Projected(\\ModernAllTypesObject.mapOptFloat) var mapOptFloat\n    @Projected(\\ModernAllTypesObject.mapOptDouble) var mapOptDouble\n    @Projected(\\ModernAllTypesObject.mapOptString) var mapOptString\n    @Projected(\\ModernAllTypesObject.mapOptBinary) var mapOptBinary\n    @Projected(\\ModernAllTypesObject.mapOptDate) var mapOptDate\n    @Projected(\\ModernAllTypesObject.mapOptDecimal) var mapOptDecimal\n    @Projected(\\ModernAllTypesObject.mapOptObjectId) var mapOptObjectId\n    @Projected(\\ModernAllTypesObject.mapOptUuid) var mapOptUuid\n\n    @Projected(\\ModernAllTypesObject.linkingObjects) var linkingObjects\n}\n\nclass AdvancedObject: Object {\n    @Persisted(primaryKey: true) var pk: ObjectId\n    @Persisted var commonArray: List<Int>\n    @Persisted var objectsArray: List<SimpleObject>\n    @Persisted var commonSet: MutableSet<Int>\n    @Persisted var objectsSet: MutableSet<SimpleObject>\n}\n\nextension SimpleObject {\n    var stringify: String {\n        \"\\(int) - \\(bool)\"\n    }\n}\n\nclass AdvancedProjection: Projection<AdvancedObject> {\n    @Projected(\\AdvancedObject.commonArray.count) var arrayLen\n    @Projected(\\AdvancedObject.commonArray) var renamedArray\n    @Projected(\\AdvancedObject.objectsArray.projectTo.stringify) var projectedArray: ProjectedCollection<String>\n    @Projected(\\AdvancedObject.commonSet.first) var firstElement\n    @Projected(\\AdvancedObject.objectsSet.projectTo.bool) var projectedSet: ProjectedCollection<Bool>\n}\n\nclass FailedProjection: Projection<ModernAllTypesObject> {\n    @Projected(\\ModernAllTypesObject.ignored) var ignored\n}\n\npublic class AddressSwift: EmbeddedObject {\n    @Persisted var city: String = \"\"\n    @Persisted var country = \"\"\n}\n\npublic class ExtraInfo: Object {\n    @Persisted var phone: PhoneInfo?\n    @Persisted var email: String?\n}\n\npublic class PhoneInfo: Object {\n    @Persisted var mobile: Mobile?\n}\n\npublic class Mobile: EmbeddedObject {\n    @Persisted var number: String = \"\"\n}\n\npublic class CommonPerson: Object {\n    @Persisted var firstName: String\n    @Persisted var lastName = \"\"\n    @Persisted var birthday: Date\n    @Persisted var address: AddressSwift?\n    @Persisted var extras: ExtraInfo?\n    @Persisted public var friends: List<CommonPerson>\n    @Persisted var reviews: List<String>\n    @Persisted var money: Decimal128\n}\n\npublic final class PersonProjection: Projection<CommonPerson> {\n    @Projected(\\CommonPerson.firstName) var firstName\n    @Projected(\\CommonPerson.lastName.localizedUppercase) var lastNameCaps\n    @Projected(\\CommonPerson.birthday.timeIntervalSince1970) var birthdayAsEpochtime\n    @Projected(\\CommonPerson.address?.city) var homeCity\n    @Projected(\\CommonPerson.extras?.email) var email\n    @Projected(\\CommonPerson.extras?.phone?.mobile?.number) var mobile\n    @Projected(\\CommonPerson.friends.projectTo.firstName) var firstFriendsName: ProjectedCollection<String>\n}\n\npublic class SimpleObject: Object {\n    @Persisted var int: Int\n    @Persisted var bool: Bool\n}\n\npublic final class SimpleProjection: Projection<SimpleObject> {\n    @Projected(\\SimpleObject.int) var int\n}\n\npublic final class MultipleProjectionsFromOneProperty: Projection<SimpleObject> {\n    @Projected(\\SimpleObject.int) var int1\n    @Projected(\\SimpleObject.int) var int2\n    @Projected(\\SimpleObject.int) var int3\n}\n\n// MARK: Tests\n\n@available(iOS 13.0, *)\nclass ProjectionTests: TestCase {\n    func assertSetEquals<T: RealmCollectionValue>(_ set: MutableSet<T>, _ expected: Array<T>) {\n        XCTAssertEqual(set.count, Set(expected).count)\n        XCTAssertEqual(Set(set), Set(expected))\n    }\n\n    func assertEquivalent(_ actual: AnyRealmCollection<ModernAllTypesObject>,\n                          _ expected: Array<ModernAllTypesObject>,\n                          expectedShouldBeCopy: Bool) {\n        XCTAssertEqual(actual.count, expected.count)\n        for obj in expected {\n            if expectedShouldBeCopy {\n                XCTAssertTrue(actual.contains { $0.pk == obj.pk })\n            } else {\n                XCTAssertTrue(actual.contains(obj))\n            }\n        }\n    }\n\n    func assertMapEquals<T: RealmCollectionValue>(_ actual: Map<String, T>, _ expected: Dictionary<String, T>) {\n        XCTAssertEqual(actual.count, expected.count)\n        for (key, value) in expected {\n            XCTAssertEqual(actual[key], value)\n        }\n    }\n\n    var allTypeValues: [String: Any] {\n        return [\n            \"boolCol\": true,\n            \"intCol\": 10,\n            \"int8Col\": 11 as Int8,\n            \"int16Col\": 12 as Int16,\n            \"int32Col\": 13 as Int32,\n            \"int64Col\": 14 as Int64,\n            \"floatCol\": 15 as Float,\n            \"doubleCol\": 16 as Double,\n            \"stringCol\": \"a\",\n            \"binaryCol\": Data(\"b\".utf8),\n            \"dateCol\": Date(timeIntervalSince1970: 17),\n            \"decimalCol\": 18 as Decimal128,\n            \"objectIdCol\": ObjectId(\"6058f12b957ba06156586a7c\"),\n            \"objectCol\": ModernAllTypesObject(value: [\"intCol\": 1]),\n            \"arrayCol\": [\n                ModernAllTypesObject(value: [\"pk\": ObjectId(\"6058f12682b2fbb1f334ef1d\"), \"intCol\": 2]),\n                ModernAllTypesObject(value: [\"pk\": ObjectId(\"6058f12d42e5a393e67538d0\"), \"intCol\": 3])\n            ],\n            \"setCol\": [\n                ModernAllTypesObject(value: [\"pk\": ObjectId(\"6058f12d42e5a393e67538d1\"), \"intCol\": 4]),\n                ModernAllTypesObject(value: [\"pk\": ObjectId(\"6058f12682b2fbb1f334ef1f\"), \"intCol\": 5]),\n                ModernAllTypesObject(value: [\"pk\": ObjectId(\"507f1f77bcf86cd799439011\"), \"intCol\": 6])\n            ],\n            \"anyCol\": AnyRealmValue.int(20),\n            \"uuidCol\": UUID(uuidString: \"6b28ec45-b29a-4b0a-bd6a-343c7f6d90fd\")!,\n            \"intEnumCol\": ModernIntEnum.value2,\n            \"stringEnumCol\": ModernStringEnum.value3,\n            \"optBoolCol\": false,\n            \"optIntCol\": 30,\n            \"optInt8Col\": 31 as Int8,\n            \"optInt16Col\": 32 as Int16,\n            \"optInt32Col\": 33 as Int32,\n            \"optInt64Col\": 34 as Int64,\n            \"optFloatCol\": 35 as Float,\n            \"optDoubleCol\": 36 as Double,\n            \"optStringCol\": \"c\",\n            \"optBinaryCol\": Data(\"d\".utf8),\n            \"optDateCol\": Date(timeIntervalSince1970: 37),\n            \"optDecimalCol\": 38 as Decimal128,\n            \"optObjectIdCol\": ObjectId(\"6058f12b957ba06156586a7c\"),\n            \"optUuidCol\": UUID(uuidString: \"6b28ec45-b29a-4b0a-bd6a-343c7f6d90fd\")!,\n            \"optIntEnumCol\": ModernIntEnum.value1,\n            \"optStringEnumCol\": ModernStringEnum.value1,\n            \"arrayBool\": [true, false] as [Bool],\n            \"arrayInt\": [1, 1, 2, 3] as [Int],\n            \"arrayInt8\": [1, 2, 3, 1] as [Int8],\n            \"arrayInt16\": [1, 2, 3, 1] as [Int16],\n            \"arrayInt32\": [1, 2, 3, 1] as [Int32],\n            \"arrayInt64\": [1, 2, 3, 1] as [Int64],\n            \"arrayFloat\": [1 as Float, 2 as Float, 3 as Float, 1 as Float],\n            \"arrayDouble\": [1 as Double, 2 as Double, 3 as Double, 1 as Double],\n            \"arrayString\": [\"a\", \"b\", \"c\"] as [String],\n            \"arrayBinary\": [Data(\"a\".utf8)] as [Data],\n            \"arrayDate\": [Date(timeIntervalSince1970: 0), Date(timeIntervalSince1970: 1)] as [Date],\n            \"arrayDecimal\": [1 as Decimal128, 2 as Decimal128],\n            \"arrayObjectId\": [ObjectId(\"6058f12b957ba06156586a7c\"), ObjectId(\"6058f12682b2fbb1f334ef1d\")],\n            \"arrayAny\": [.none, .int(1), .string(\"a\"), .none] as [AnyRealmValue],\n            \"arrayUuid\": [UUID(uuidString: \"6b28ec45-b29a-4b0a-bd6a-343c7f6d90fd\")!, UUID(uuidString: \"6b28ec45-b29a-4b0a-bd6a-343c7f6d90fe\")!],\n            \"arrayOptBool\": [true, false, nil] as [Bool?],\n            \"arrayOptInt\": [1, 1, 2, 3, nil] as [Int?],\n            \"arrayOptInt8\": [1, 2, 3, 1, nil] as [Int8?],\n            \"arrayOptInt16\": [1, 2, 3, 1, nil] as [Int16?],\n            \"arrayOptInt32\": [1, 2, 3, 1, nil] as [Int32?],\n            \"arrayOptInt64\": [1, 2, 3, 1, nil] as [Int64?],\n            \"arrayOptFloat\": [1 as Float, 2 as Float, 3 as Float, 1 as Float, nil],\n            \"arrayOptDouble\": [1 as Double, 2 as Double, 3 as Double, 1 as Double, nil],\n            \"arrayOptString\": [\"a\", \"b\", \"c\", nil],\n            \"arrayOptBinary\": [Data(\"a\".utf8), nil],\n            \"arrayOptDate\": [Date(timeIntervalSince1970: 0), Date(timeIntervalSince1970: 1), nil],\n            \"arrayOptDecimal\": [1 as Decimal128, 2 as Decimal128, nil],\n            \"arrayOptObjectId\": [ObjectId(\"6058f12b957ba06156586a7c\"), ObjectId(\"6058f12682b2fbb1f334ef1d\"), nil],\n            \"arrayOptUuid\": [UUID(uuidString: \"6b28ec45-b29a-4b0a-bd6a-343c7f6d90fd\")!, UUID(uuidString: \"6b28ec45-b29a-4b0a-bd6a-343c7f6d90fe\")!, nil],\n            \"setBool\": [true] as [Bool],\n            \"setInt\": [1, 1, 2, 3] as [Int],\n            \"setInt8\": [1, 2, 3, 1] as [Int8],\n            \"setInt16\": [1, 2, 3, 1] as [Int16],\n            \"setInt32\": [1, 2, 3, 1] as [Int32],\n            \"setInt64\": [1, 2, 3, 1] as [Int64],\n            \"setFloat\": [1 as Float, 2 as Float, 3 as Float, 1 as Float],\n            \"setDouble\": [1 as Double, 2 as Double, 3 as Double, 1 as Double],\n            \"setString\": [\"a\", \"b\", \"c\"] as [String],\n            \"setBinary\": [Data(\"a\".utf8)] as [Data],\n            \"setDate\": [Date(timeIntervalSince1970: 1), Date(timeIntervalSince1970: 2)] as [Date],\n            \"setDecimal\": [1 as Decimal128, 2 as Decimal128],\n            \"setObjectId\": [ObjectId(\"6058f12b957ba06156586a7c\"),\n                            ObjectId(\"6058f12682b2fbb1f334ef1d\")],\n            \"setAny\": [.none, .int(1), .string(\"a\"), .none] as [AnyRealmValue],\n            \"setUuid\": [UUID(uuidString: \"6b28ec45-b29a-4b0a-bd6a-343c7f6d90fd\")!,\n                        UUID(uuidString: \"6b28ec45-b29a-4b0a-bd6a-343c7f6d90fe\")!,\n                        UUID(uuidString: \"6b28ec45-b29a-4b0a-bd6a-343c7f6d90ff\")!],\n            \"setOptBool\": [true, false, nil] as [Bool?],\n            \"setOptInt\": [1, 1, 2, 3, nil] as [Int?],\n            \"setOptInt8\": [1, 2, 3, 1, nil] as [Int8?],\n            \"setOptInt16\": [1, 2, 3, 1, nil] as [Int16?],\n            \"setOptInt32\": [1, 2, 3, 1, nil] as [Int32?],\n            \"setOptInt64\": [1, 2, 3, 1, nil] as [Int64?],\n            \"setOptFloat\": [1 as Float, 2 as Float, 3 as Float, 1 as Float, nil],\n            \"setOptDouble\": [1 as Double, 2 as Double, 3 as Double, 1 as Double, nil],\n            \"setOptString\": [\"a\", \"b\", \"c\", nil],\n            \"setOptBinary\": [Data(\"a\".utf8), nil],\n            \"setOptDate\": [Date(timeIntervalSince1970: 1), Date(timeIntervalSince1970: 2), nil],\n            \"setOptDecimal\": [1 as Decimal128, 2 as Decimal128, nil],\n            \"setOptObjectId\": [ObjectId(\"6058f12b957ba06156586a7c\"), ObjectId(\"6058f12682b2fbb1f334ef1d\"), nil],\n            \"setOptUuid\": [UUID(uuidString: \"6b28ec45-b29a-4b0a-bd6a-343c7f6d90fd\")!,\n                           UUID(uuidString: \"6b28ec45-b29a-4b0a-bd6a-343c7f6d90fe\")!,\n                           UUID(uuidString: \"6b28ec45-b29a-4b0a-bd6a-343c7f6d90ff\")!,\n                           nil],\n            \"mapBool\": [\"1\": true, \"2\": false] as [String: Bool],\n            \"mapInt\": [\"1\": 1, \"2\": 1, \"3\": 2, \"4\": 3] as [String: Int],\n            \"mapInt8\": [\"1\": 1, \"2\": 2, \"3\": 3, \"4\": 1] as [String: Int8],\n            \"mapInt16\": [\"1\": 1, \"2\": 2, \"3\": 3, \"4\": 1] as [String: Int16],\n            \"mapInt32\": [\"1\": 1, \"2\": 2, \"3\": 3, \"4\": 1] as [String: Int32],\n            \"mapInt64\": [\"1\": 1, \"2\": 2, \"3\": 3, \"4\": 1] as [String: Int64],\n            \"mapFloat\": [\"1\": 1 as Float, \"2\": 2 as Float, \"3\": 3 as Float, \"4\": 1 as Float],\n            \"mapDouble\": [\"1\": 1 as Double, \"2\": 2 as Double, \"3\": 3 as Double, \"4\": 1 as Double],\n            \"mapString\": [\"1\": \"a\", \"2\": \"b\", \"3\": \"c\"] as [String: String],\n            \"mapBinary\": [\"1\": Data(\"a\".utf8)] as [String: Data],\n            \"mapDate\": [\"1\": Date(timeIntervalSince1970: 1), \"2\": Date(timeIntervalSince1970: 2)] as [String: Date],\n            \"mapDecimal\": [\"1\": 1 as Decimal128, \"2\": 2 as Decimal128],\n            \"mapObjectId\": [\"1\": ObjectId(\"6058f12b957ba06156586a7c\"),\n                            \"2\": ObjectId(\"6058f12682b2fbb1f334ef1d\")],\n            \"mapAny\": [\"1\": .none, \"2\": .int(1), \"3\": .string(\"a\"), \"4\": .none] as [String: AnyRealmValue],\n            \"mapUuid\": [\"1\": UUID(uuidString: \"6b28ec45-b29a-4b0a-bd6a-343c7f6d90fd\")!,\n                        \"2\": UUID(uuidString: \"6b28ec45-b29a-4b0a-bd6a-343c7f6d90fe\")!,\n                        \"3\": UUID(uuidString: \"6b28ec45-b29a-4b0a-bd6a-343c7f6d90ff\")!],\n            \"mapOptBool\": [\"1\": true, \"2\": false, \"3\": nil] as [String: Bool?],\n            \"mapOptInt\": [\"1\": 1, \"2\": 1, \"3\": 2, \"4\": 3, \"5\": nil] as [String: Int?],\n            \"mapOptInt8\": [\"1\": 1, \"2\": 2, \"3\": 3, \"4\": 1, \"5\": nil] as [String: Int8?],\n            \"mapOptInt16\": [\"1\": 1, \"2\": 2, \"3\": 3, \"4\": 1, \"5\": nil] as [String: Int16?],\n            \"mapOptInt32\": [\"1\": 1, \"2\": 2, \"3\": 3, \"4\": 1, \"5\": nil] as [String: Int32?],\n            \"mapOptInt64\": [\"1\": 1, \"2\": 2, \"3\": 3, \"4\": 1, \"5\": nil] as [String: Int64?],\n            \"mapOptFloat\": [\"1\": 1 as Float, \"2\": 2 as Float, \"3\": 3 as Float, \"4\": 1 as Float, \"5\": nil],\n            \"mapOptDouble\": [\"1\": 1 as Double, \"2\": 2 as Double, \"3\": 3 as Double, \"4\": 1 as Double, \"5\": nil],\n            \"mapOptString\": [\"1\": \"a\", \"2\": \"b\", \"3\": \"c\", \"4\": nil],\n            \"mapOptBinary\": [\"1\": Data(\"a\".utf8), \"2\": nil],\n            \"mapOptDate\": [\"1\": Date(timeIntervalSince1970: 1), \"2\": Date(timeIntervalSince1970: 2), \"3\": nil],\n            \"mapOptDecimal\": [\"1\": 1 as Decimal128, \"2\": 2 as Decimal128, \"3\": nil],\n            \"mapOptObjectId\": [\"1\": ObjectId(\"6058f12b957ba06156586a7c\"),\n                               \"2\": ObjectId(\"6058f12682b2fbb1f334ef1d\"),\n                               \"3\": nil],\n            \"mapOptUuid\": [\"1\": UUID(uuidString: \"6b28ec45-b29a-4b0a-bd6a-343c7f6d90fd\")!,\n                           \"2\": UUID(uuidString: \"6b28ec45-b29a-4b0a-bd6a-343c7f6d90fe\")!,\n                           \"3\": UUID(uuidString: \"6b28ec45-b29a-4b0a-bd6a-343c7f6d90ff\")!,\n                           \"4\": nil],\n        ] as [String: Any]\n    }\n\n    func populatedRealm() -> Realm {\n        let realm = realmWithTestPath()\n        try! realm.write {\n            let js = realm.create(CommonPerson.self, value: [\"firstName\": \"John\",\n                                                             \"lastName\": \"Snow\",\n                                                             \"birthday\": Date(timeIntervalSince1970: 10),\n                                                             \"address\": [\n                                                                \"city\": \"Winterfell\",\n                                                                \"country\": \"Kingdom in the North\"],\n                                                             \"extras\": [\"phone\": [\"mobile\": [\"number\": \"555-555-555\"]], \"email\": \"john@doe.com\"],\n                                                             \"money\": Decimal128(\"2.22\")])\n            let dt = realm.create(CommonPerson.self, value: [\"firstName\": \"Daenerys\",\n                                                             \"lastName\": \"Targaryen\",\n                                                             \"birthday\": Date(timeIntervalSince1970: 0),\n                                                             \"address\": [\"King's Landing\", \"Westeros\"],\n                                                             \"money\": Decimal128(\"2.22\")])\n            js.friends.append(dt)\n            dt.friends.append(js)\n\n            realm.create(ModernAllTypesObject.self, value: allTypeValues)\n            realm.create(AdvancedObject.self, value: [\"pk\": ObjectId.generate(),\n                                                      \"commonArray\": [1, 2, 3],\n                                                      \"objectsArray\": [[1, true] as [Any], [2, false]],\n                                                      \"commonSet\": [1, 2, 3],\n                                                      \"objectsSet\": [[1, true] as [Any], [2, false]]])\n        }\n        return realm\n    }\n\n    func testProjectionManualInit() {\n        let realm = populatedRealm()\n        let johnSnow = realm.objects(CommonPerson.self).filter(\"lastName == 'Snow'\").first!\n        // this step will happen under the hood\n        let pp = PersonProjection(projecting: johnSnow)\n        XCTAssertEqual(pp.homeCity, \"Winterfell\")\n        XCTAssertEqual(pp.birthdayAsEpochtime, Date(timeIntervalSince1970: 10).timeIntervalSince1970)\n        XCTAssertEqual(pp.firstFriendsName.first!, \"Daenerys\")\n    }\n\n    func testProjectionFromResult() {\n        let realm = populatedRealm()\n        let johnSnow: PersonProjection = realm.objects(PersonProjection.self).first!\n        XCTAssertEqual(johnSnow.homeCity, \"Winterfell\")\n        XCTAssertEqual(johnSnow.birthdayAsEpochtime, Date(timeIntervalSince1970: 10).timeIntervalSince1970)\n        XCTAssertEqual(johnSnow.firstFriendsName.first!, \"Daenerys\")\n    }\n\n    func testProjectionFromResultFiltered() {\n        let realm = populatedRealm()\n        let johnSnow: PersonProjection = realm.objects(PersonProjection.self).filter(\"lastName == 'Snow'\").first!\n\n        XCTAssertEqual(johnSnow.homeCity, \"Winterfell\")\n        XCTAssertEqual(johnSnow.birthdayAsEpochtime, Date(timeIntervalSince1970: 10).timeIntervalSince1970)\n        XCTAssertEqual(johnSnow.firstFriendsName.first!, \"Daenerys\")\n    }\n\n    func testProjectionFromResultSorted() {\n        let realm = populatedRealm()\n        let dany: PersonProjection = realm.objects(PersonProjection.self).sorted(byKeyPath: \"firstName\").first!\n\n        XCTAssertEqual(dany.homeCity, \"King's Landing\")\n        XCTAssertEqual(dany.birthdayAsEpochtime, Date(timeIntervalSince1970: 0).timeIntervalSince1970)\n        XCTAssertEqual(dany.firstFriendsName.first!, \"John\")\n    }\n\n    func testProjectionEnumeration() {\n        let realm = populatedRealm()\n        XCTAssertGreaterThan(realm.objects(PersonProjection.self).count, 0)\n        for proj in realm.objects(PersonProjection.self) {\n            _ = proj\n        }\n    }\n\n    func testProjectionEquality() {\n        let realm = populatedRealm()\n        let johnObject = realm.objects(CommonPerson.self).filter(\"lastName == 'Snow'\").first!\n        let johnDefaultInit = PersonProjection(projecting: johnObject)\n        let johnMapped = realm.objects(PersonProjection.self).filter(\"lastName == 'Snow'\").first!\n        let notJohn = realm.objects(PersonProjection.self).filter(\"lastName != 'Snow'\").first!\n\n        XCTAssertEqual(johnMapped, johnDefaultInit)\n        XCTAssertNotEqual(johnMapped, notJohn)\n    }\n\n    func testDescription() {\n        let actual = populatedRealm().objects(PersonProjection.self).filter(\"lastName == 'Snow'\").first!.description\n        let expected = \"PersonProjection<CommonPerson> <0x[0-9a-f]+> \\\\{\\n\\t\\tfirstName\\\\(\\\\\\\\.firstName\\\\) = John;\\n\\tlastNameCaps\\\\(\\\\\\\\.lastName\\\\) = SNOW;\\n\\tbirthdayAsEpochtime\\\\(\\\\\\\\.birthday\\\\) = 10.0;\\n\\thomeCity\\\\(\\\\\\\\.address.city\\\\) = Optional\\\\(\\\"Winterfell\\\"\\\\);\\n\\temail\\\\(\\\\\\\\.extras.email\\\\) = Optional\\\\(\\\"john@doe.com\\\"\\\\);\\n\\tmobile\\\\(\\\\\\\\.extras.phone.mobile.number\\\\) = Optional\\\\(\\\"555-555-555\\\"\\\\);\\n\\tfirstFriendsName\\\\(\\\\\\\\.friends\\\\) = ProjectedCollection<String> \\\\{\\n\\t\\\\[0\\\\] Daenerys\\n\\\\};\\n\\\\}\"\n        assertMatches(actual, expected)\n    }\n\n    func testProjectionsRealmShouldNotBeNil() {\n        XCTAssertNotNil(populatedRealm().objects(PersonProjection.self).first!.realm)\n    }\n\n    func testProjectionFromResultSortedBirthday() {\n        let realm = populatedRealm()\n        let dany: PersonProjection = realm.objects(PersonProjection.self).sorted(byKeyPath: \"birthday\").first!\n\n        XCTAssertEqual(dany.homeCity, \"King's Landing\")\n        XCTAssertEqual(dany.birthdayAsEpochtime, Date(timeIntervalSince1970: 0).timeIntervalSince1970)\n        XCTAssertEqual(dany.firstFriendsName.first!, \"John\")\n    }\n\n    func testProjectionForAllRealmTypes() {\n        let allTypesModel = populatedRealm().objects(AllTypesPrimitiveProjection.self).first!\n\n        XCTAssertEqual(allTypesModel.boolCol, allTypeValues[\"boolCol\"] as! Bool)\n        XCTAssertEqual(allTypesModel.intCol, allTypeValues[\"intCol\"] as! Int)\n        XCTAssertEqual(allTypesModel.int8Col, allTypeValues[\"int8Col\"] as! Int8)\n        XCTAssertEqual(allTypesModel.int16Col, allTypeValues[\"int16Col\"] as! Int16)\n        XCTAssertEqual(allTypesModel.int32Col, allTypeValues[\"int32Col\"] as! Int32)\n        XCTAssertEqual(allTypesModel.int64Col, allTypeValues[\"int64Col\"] as! Int64)\n        XCTAssertEqual(allTypesModel.floatCol, allTypeValues[\"floatCol\"] as! Float)\n        XCTAssertEqual(allTypesModel.doubleCol, allTypeValues[\"doubleCol\"] as! Double)\n        XCTAssertEqual(allTypesModel.stringCol, allTypeValues[\"stringCol\"] as! String)\n        XCTAssertEqual(allTypesModel.binaryCol, allTypeValues[\"binaryCol\"] as! Data)\n        XCTAssertEqual(allTypesModel.dateCol, allTypeValues[\"dateCol\"] as! Date)\n        XCTAssertEqual(allTypesModel.decimalCol, allTypeValues[\"decimalCol\"] as! Decimal128)\n        assertEquivalent(AnyRealmCollection(allTypesModel.arrayCol),\n                         allTypeValues[\"arrayCol\"] as! [ModernAllTypesObject],\n                         expectedShouldBeCopy: true)\n        assertEquivalent(AnyRealmCollection(allTypesModel.setCol),\n                         allTypeValues[\"setCol\"] as! [ModernAllTypesObject],\n                         expectedShouldBeCopy: true)\n        XCTAssertEqual(allTypesModel.anyCol, allTypeValues[\"anyCol\"] as! AnyRealmValue)\n        XCTAssertEqual(allTypesModel.uuidCol, allTypeValues[\"uuidCol\"] as! UUID)\n        XCTAssertEqual(allTypesModel.intEnumCol, allTypeValues[\"intEnumCol\"] as! ModernIntEnum)\n        XCTAssertEqual(allTypesModel.stringEnumCol, allTypeValues[\"stringEnumCol\"] as! ModernStringEnum)\n\n        XCTAssertEqual(allTypesModel.optBoolCol, allTypeValues[\"optBoolCol\"] as! Bool?)\n        XCTAssertEqual(allTypesModel.optIntCol, allTypeValues[\"optIntCol\"] as! Int?)\n        XCTAssertEqual(allTypesModel.optInt8Col, allTypeValues[\"optInt8Col\"] as! Int8?)\n        XCTAssertEqual(allTypesModel.optInt16Col, allTypeValues[\"optInt16Col\"] as! Int16?)\n        XCTAssertEqual(allTypesModel.optInt32Col, allTypeValues[\"optInt32Col\"] as! Int32?)\n        XCTAssertEqual(allTypesModel.optInt64Col, allTypeValues[\"optInt64Col\"] as! Int64?)\n        XCTAssertEqual(allTypesModel.optFloatCol, allTypeValues[\"optFloatCol\"] as! Float?)\n        XCTAssertEqual(allTypesModel.optDoubleCol, allTypeValues[\"optDoubleCol\"] as! Double?)\n        XCTAssertEqual(allTypesModel.optStringCol, allTypeValues[\"optStringCol\"] as! String?)\n        XCTAssertEqual(allTypesModel.optBinaryCol, allTypeValues[\"optBinaryCol\"] as! Data?)\n        XCTAssertEqual(allTypesModel.optDateCol, allTypeValues[\"optDateCol\"] as! Date?)\n        XCTAssertEqual(allTypesModel.optDecimalCol, allTypeValues[\"optDecimalCol\"] as! Decimal128?)\n        XCTAssertEqual(allTypesModel.optObjectIdCol, allTypeValues[\"optObjectIdCol\"] as! ObjectId?)\n        XCTAssertEqual(allTypesModel.optUuidCol, allTypeValues[\"optUuidCol\"] as! UUID?)\n        XCTAssertEqual(allTypesModel.optIntEnumCol, allTypeValues[\"optIntEnumCol\"] as! ModernIntEnum?)\n        XCTAssertEqual(allTypesModel.optStringEnumCol, allTypeValues[\"optStringEnumCol\"] as! ModernStringEnum?)\n\n        XCTAssertEqual(Array(allTypesModel.arrayBool), allTypeValues[\"arrayBool\"] as! [Bool])\n        XCTAssertEqual(Array(allTypesModel.arrayInt), allTypeValues[\"arrayInt\"] as! [Int])\n        XCTAssertEqual(Array(allTypesModel.arrayInt8), allTypeValues[\"arrayInt8\"] as! [Int8])\n        XCTAssertEqual(Array(allTypesModel.arrayInt16), allTypeValues[\"arrayInt16\"] as! [Int16])\n        XCTAssertEqual(Array(allTypesModel.arrayInt32), allTypeValues[\"arrayInt32\"] as! [Int32])\n        XCTAssertEqual(Array(allTypesModel.arrayInt64), allTypeValues[\"arrayInt64\"] as! [Int64])\n        XCTAssertEqual(Array(allTypesModel.arrayFloat), allTypeValues[\"arrayFloat\"] as! [Float])\n        XCTAssertEqual(Array(allTypesModel.arrayDouble), allTypeValues[\"arrayDouble\"] as! [Double])\n        XCTAssertEqual(Array(allTypesModel.arrayString), allTypeValues[\"arrayString\"] as! [String])\n        XCTAssertEqual(Array(allTypesModel.arrayBinary), allTypeValues[\"arrayBinary\"] as! [Data])\n        XCTAssertEqual(Array(allTypesModel.arrayDate), allTypeValues[\"arrayDate\"] as! [Date])\n        XCTAssertEqual(Array(allTypesModel.arrayDecimal), allTypeValues[\"arrayDecimal\"] as! [Decimal128])\n        XCTAssertEqual(Array(allTypesModel.arrayObjectId), allTypeValues[\"arrayObjectId\"] as! [ObjectId])\n        XCTAssertEqual(Array(allTypesModel.arrayAny), allTypeValues[\"arrayAny\"] as! [AnyRealmValue])\n        XCTAssertEqual(Array(allTypesModel.arrayUuid), allTypeValues[\"arrayUuid\"] as! [UUID])\n\n        XCTAssertEqual(Array(allTypesModel.arrayOptBool), allTypeValues[\"arrayOptBool\"] as! [Bool?])\n        XCTAssertEqual(Array(allTypesModel.arrayOptInt), allTypeValues[\"arrayOptInt\"] as! [Int?])\n        XCTAssertEqual(Array(allTypesModel.arrayOptInt8), allTypeValues[\"arrayOptInt8\"] as! [Int8?])\n        XCTAssertEqual(Array(allTypesModel.arrayOptInt16), allTypeValues[\"arrayOptInt16\"] as! [Int16?])\n        XCTAssertEqual(Array(allTypesModel.arrayOptInt32), allTypeValues[\"arrayOptInt32\"] as! [Int32?])\n        XCTAssertEqual(Array(allTypesModel.arrayOptInt64), allTypeValues[\"arrayOptInt64\"] as! [Int64?])\n        XCTAssertEqual(Array(allTypesModel.arrayOptFloat), allTypeValues[\"arrayOptFloat\"] as! [Float?])\n        XCTAssertEqual(Array(allTypesModel.arrayOptDouble), allTypeValues[\"arrayOptDouble\"] as! [Double?])\n        XCTAssertEqual(Array(allTypesModel.arrayOptString), allTypeValues[\"arrayOptString\"] as! [String?])\n        XCTAssertEqual(Array(allTypesModel.arrayOptBinary), allTypeValues[\"arrayOptBinary\"] as! [Data?])\n        XCTAssertEqual(Array(allTypesModel.arrayOptDate), allTypeValues[\"arrayOptDate\"] as! [Date?])\n        XCTAssertEqual(Array(allTypesModel.arrayOptDecimal), allTypeValues[\"arrayOptDecimal\"] as! [Decimal128?])\n        XCTAssertEqual(Array(allTypesModel.arrayOptObjectId), allTypeValues[\"arrayOptObjectId\"] as! [ObjectId?])\n        XCTAssertEqual(Array(allTypesModel.arrayOptUuid), allTypeValues[\"arrayOptUuid\"] as! [UUID?])\n\n        assertSetEquals(allTypesModel.setBool, allTypeValues[\"setBool\"] as! [Bool])\n        assertSetEquals(allTypesModel.setInt, allTypeValues[\"setInt\"] as! [Int])\n        assertSetEquals(allTypesModel.setInt8, allTypeValues[\"setInt8\"] as! [Int8])\n        assertSetEquals(allTypesModel.setInt16, allTypeValues[\"setInt16\"] as! [Int16])\n        assertSetEquals(allTypesModel.setInt32, allTypeValues[\"setInt32\"] as! [Int32])\n        assertSetEquals(allTypesModel.setInt64, allTypeValues[\"setInt64\"] as! [Int64])\n        assertSetEquals(allTypesModel.setFloat, allTypeValues[\"setFloat\"] as! [Float])\n        assertSetEquals(allTypesModel.setDouble, allTypeValues[\"setDouble\"] as! [Double])\n        assertSetEquals(allTypesModel.setString, allTypeValues[\"setString\"] as! [String])\n        assertSetEquals(allTypesModel.setBinary, allTypeValues[\"setBinary\"] as! [Data])\n        assertSetEquals(allTypesModel.setDate, allTypeValues[\"setDate\"] as! [Date])\n        assertSetEquals(allTypesModel.setDecimal, allTypeValues[\"setDecimal\"] as! [Decimal128])\n        assertSetEquals(allTypesModel.setObjectId, allTypeValues[\"setObjectId\"] as! [ObjectId])\n        assertSetEquals(allTypesModel.setAny, allTypeValues[\"setAny\"] as! [AnyRealmValue])\n        assertSetEquals(allTypesModel.setUuid, allTypeValues[\"setUuid\"] as! [UUID])\n\n        assertSetEquals(allTypesModel.setOptBool, allTypeValues[\"setOptBool\"] as! [Bool?])\n        assertSetEquals(allTypesModel.setOptInt, allTypeValues[\"setOptInt\"] as! [Int?])\n        assertSetEquals(allTypesModel.setOptInt8, allTypeValues[\"setOptInt8\"] as! [Int8?])\n        assertSetEquals(allTypesModel.setOptInt16, allTypeValues[\"setOptInt16\"] as! [Int16?])\n        assertSetEquals(allTypesModel.setOptInt32, allTypeValues[\"setOptInt32\"] as! [Int32?])\n        assertSetEquals(allTypesModel.setOptInt64, allTypeValues[\"setOptInt64\"] as! [Int64?])\n        assertSetEquals(allTypesModel.setOptFloat, allTypeValues[\"setOptFloat\"] as! [Float?])\n        assertSetEquals(allTypesModel.setOptDouble, allTypeValues[\"setOptDouble\"] as! [Double?])\n        assertSetEquals(allTypesModel.setOptString, allTypeValues[\"setOptString\"] as! [String?])\n        assertSetEquals(allTypesModel.setOptBinary, allTypeValues[\"setOptBinary\"] as! [Data?])\n        assertSetEquals(allTypesModel.setOptDate, allTypeValues[\"setOptDate\"] as! [Date?])\n        assertSetEquals(allTypesModel.setOptDecimal, allTypeValues[\"setOptDecimal\"] as! [Decimal128?])\n        assertSetEquals(allTypesModel.setOptObjectId, allTypeValues[\"setOptObjectId\"] as! [ObjectId?])\n        assertSetEquals(allTypesModel.setOptUuid, allTypeValues[\"setOptUuid\"] as! [UUID?])\n\n        assertMapEquals(allTypesModel.mapBool, allTypeValues[\"mapBool\"] as! [String: Bool])\n        assertMapEquals(allTypesModel.mapInt, allTypeValues[\"mapInt\"] as! [String: Int])\n        assertMapEquals(allTypesModel.mapInt8, allTypeValues[\"mapInt8\"] as! [String: Int8])\n        assertMapEquals(allTypesModel.mapInt16, allTypeValues[\"mapInt16\"] as! [String: Int16])\n        assertMapEquals(allTypesModel.mapInt32, allTypeValues[\"mapInt32\"] as! [String: Int32])\n        assertMapEquals(allTypesModel.mapInt64, allTypeValues[\"mapInt64\"] as! [String: Int64])\n        assertMapEquals(allTypesModel.mapFloat, allTypeValues[\"mapFloat\"] as! [String: Float])\n        assertMapEquals(allTypesModel.mapDouble, allTypeValues[\"mapDouble\"] as! [String: Double])\n        assertMapEquals(allTypesModel.mapString, allTypeValues[\"mapString\"] as! [String: String])\n        assertMapEquals(allTypesModel.mapBinary, allTypeValues[\"mapBinary\"] as! [String: Data])\n        assertMapEquals(allTypesModel.mapDate, allTypeValues[\"mapDate\"] as! [String: Date])\n        assertMapEquals(allTypesModel.mapDecimal, allTypeValues[\"mapDecimal\"] as! [String: Decimal128])\n        assertMapEquals(allTypesModel.mapObjectId, allTypeValues[\"mapObjectId\"] as! [String: ObjectId])\n        assertMapEquals(allTypesModel.mapAny, allTypeValues[\"mapAny\"] as! [String: AnyRealmValue])\n        assertMapEquals(allTypesModel.mapUuid, allTypeValues[\"mapUuid\"] as! [String: UUID])\n\n        assertMapEquals(allTypesModel.mapOptBool, allTypeValues[\"mapOptBool\"] as! [String: Bool?])\n        assertMapEquals(allTypesModel.mapOptInt, allTypeValues[\"mapOptInt\"] as! [String: Int?])\n        assertMapEquals(allTypesModel.mapOptInt8, allTypeValues[\"mapOptInt8\"] as! [String: Int8?])\n        assertMapEquals(allTypesModel.mapOptInt16, allTypeValues[\"mapOptInt16\"] as! [String: Int16?])\n        assertMapEquals(allTypesModel.mapOptInt32, allTypeValues[\"mapOptInt32\"] as! [String: Int32?])\n        assertMapEquals(allTypesModel.mapOptInt64, allTypeValues[\"mapOptInt64\"] as! [String: Int64?])\n        assertMapEquals(allTypesModel.mapOptFloat, allTypeValues[\"mapOptFloat\"] as! [String: Float?])\n        assertMapEquals(allTypesModel.mapOptDouble, allTypeValues[\"mapOptDouble\"] as! [String: Double?])\n        assertMapEquals(allTypesModel.mapOptString, allTypeValues[\"mapOptString\"] as! [String: String?])\n        assertMapEquals(allTypesModel.mapOptBinary, allTypeValues[\"mapOptBinary\"] as! [String: Data?])\n        assertMapEquals(allTypesModel.mapOptDate, allTypeValues[\"mapOptDate\"] as! [String: Date?])\n        assertMapEquals(allTypesModel.mapOptDecimal, allTypeValues[\"mapOptDecimal\"] as! [String: Decimal128?])\n        assertMapEquals(allTypesModel.mapOptObjectId, allTypeValues[\"mapOptObjectId\"] as! [String: ObjectId?])\n        assertMapEquals(allTypesModel.mapOptUuid, allTypeValues[\"mapOptUuid\"] as! [String: UUID?])\n    }\n\n    func expectPropertyChange<T>(_ obj: AllTypesPrimitiveProjection,\n                                 _ keyPath: KeyPath<AllTypesPrimitiveProjection, T>,\n                                 _ expectedName: String,\n                                 _ callback: @escaping (AllTypesPrimitiveProjection, Any?, Any?) -> Void\n    ) -> (XCTestExpectation, NotificationToken) {\n        let ex = expectation(description: \"observeKeyPathChange\")\n        let token = obj.observe(keyPaths: [keyPath]) { changes in\n            ex.fulfill()\n            guard case let .change(object, properties) = changes else {\n                return XCTFail(\"Expected .change but got \\(changes)\")\n            }\n            guard properties.count == 1 else {\n                return XCTFail(\"Expected one property change but got \\(properties)\")\n            }\n\n            let prop = properties[0]\n            XCTAssertEqual(prop.name, expectedName)\n            callback(object, prop.oldValue, prop.newValue)\n        }\n        return (ex, token)\n    }\n\n    func observeKeyPathChange<E: Equatable>(\n        _ obj: AllTypesPrimitiveProjection,\n        _ keyPath: ReferenceWritableKeyPath<AllTypesPrimitiveProjection, E>,\n        _ name: String, _ new: E, fileName: StaticString = #filePath, lineNumber: UInt = #line\n    ) {\n        let old = obj[keyPath: keyPath]\n        let (ex, token) = expectPropertyChange(obj, keyPath, name) { _, oldValue, newValue in\n            let actualOld = oldValue as? E\n            let actualNew = newValue as? E\n\n            if E.self != Optional<ModernAllTypesObject>.self {\n                XCTAssertNotEqual(actualOld, actualNew, file: fileName, line: lineNumber)\n                XCTAssertEqual(new, actualNew, file: fileName, line: lineNumber)\n                XCTAssertEqual(old, actualOld, file: fileName, line: lineNumber)\n            }\n        }\n\n        // Write on a background thread so that oldValue is present\n        let tsr = ThreadSafeReference(to: obj)\n        nonisolated(unsafe) let newValue = new\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            let realm = unsafeSelf.realmWithTestPath()\n            let obj = realm.resolve(tsr)!\n            try! realm.write {\n                obj.int8Col = 5 // Write to another property to verify keypath filtering works\n                obj[keyPath: keyPath] = newValue\n            }\n        }\n        wait(for: [ex], timeout: 2.0)\n        token.invalidate()\n    }\n\n    func observeKeyPathChange<E: RealmCollectionValue>(\n        _ obj: AllTypesPrimitiveProjection,\n        _ keyPath: KeyPath<AllTypesPrimitiveProjection, List<E>>,\n        _ name: String, _ new: E, fileName: StaticString = #file, lineNumber: UInt = #line\n    ) {\n        let old = Array(obj[keyPath: keyPath])\n        let (ex, token) = expectPropertyChange(obj, keyPath, name) { object, oldValue, newValue in\n            // We wrote on the same thread, so oldValue is nil. oldValue doesn't\n            // really work for collections so it's not worth testing.\n            XCTAssertNil(oldValue)\n\n            let observedNew = newValue as? List<E>\n            XCTAssertIdentical(observedNew, object[keyPath: keyPath])\n            if let observedNew = observedNew {\n                XCTAssertEqual(Array(observedNew), old + [new])\n            }\n        }\n\n        try! obj.realm!.write {\n            obj.int8Col = 5 // Write to another property to verify keypath filtering works\n            obj[keyPath: keyPath].append(new)\n        }\n        wait(for: [ex], timeout: 2.0)\n        token.invalidate()\n    }\n\n    func observeKeyPathChange<E: RealmCollectionValue>(\n        _ obj: AllTypesPrimitiveProjection,\n        _ keyPath: KeyPath<AllTypesPrimitiveProjection, MutableSet<E>>,\n        _ name: String, _ new: E, fileName: StaticString = #file, lineNumber: UInt = #line\n    ) {\n        let old = Array(obj[keyPath: keyPath])\n        let (ex, token) = expectPropertyChange(obj, keyPath, name) { object, oldValue, newValue in\n            // We wrote on the same thread, so oldValue is nil. oldValue doesn't\n            // really work for collections so it's not worth testing.\n            XCTAssertNil(oldValue)\n\n            let observedNew = newValue as? MutableSet<E>\n            XCTAssertIdentical(observedNew, object[keyPath: keyPath])\n            if let observedNew = observedNew {\n                self.assertSetEquals(observedNew, old + [new])\n            }\n        }\n\n        try! obj.realm!.write {\n            obj.int8Col = 5 // Write to another property to verify keypath filtering works\n            obj[keyPath: keyPath].insert(new)\n        }\n        wait(for: [ex], timeout: 2.0)\n        token.invalidate()\n    }\n\n    func observeKeyPathChange<E: RealmCollectionValue>(\n        _ obj: AllTypesPrimitiveProjection,\n        _ keyPath: KeyPath<AllTypesPrimitiveProjection, Map<String, E>>,\n        _ name: String, _ new: E, fileName: StaticString = #file, lineNumber: UInt = #line\n    ) {\n        let old = Dictionary(uniqueKeysWithValues: obj[keyPath: keyPath].map { ($0.key, $0.value) })\n        let (ex, token) = expectPropertyChange(obj, keyPath, name) { object, oldValue, newValue in\n            // We wrote on the same thread, so oldValue is nil. oldValue doesn't\n            // really work for collections so it's not worth testing.\n            XCTAssertNil(oldValue)\n\n            let observedNew = newValue as? Map<String, E>\n            XCTAssertIdentical(observedNew, object[keyPath: keyPath])\n            if let observedNew = observedNew {\n                var updated = old\n                updated[\"1\"] = new\n                self.assertMapEquals(observedNew, updated)\n            }\n        }\n\n        try! obj.realm!.write {\n            obj.int8Col = 5 // Write to another property to verify keypath filtering works\n            obj[keyPath: keyPath][\"1\"] = new\n        }\n        wait(for: [ex], timeout: 2.0)\n        token.invalidate()\n    }\n\n    func testAllPropertyTypesNotifications() {\n        let realm = populatedRealm()\n        let obj = realm.objects(ModernAllTypesObject.self).first!\n        let obs = realm.objects(AllTypesPrimitiveProjection.self).first!\n\n        let data = Data(\"c\".utf8)\n        let date = Date(timeIntervalSince1970: 7)\n        let decimal = Decimal128(number: 3)\n        let objectId = ObjectId.generate()\n        let uuid = UUID()\n        let object = ModernAllTypesObject(value: [\"intCol\": 2])\n        let anyValue = AnyRealmValue.int(22)\n\n        observeKeyPathChange(obs, \\.boolCol, \"boolCol\", false)\n        observeKeyPathChange(obs, \\.intCol, \"intCol\", 2)\n        observeKeyPathChange(obs, \\.int8Col, \"int8Col\", 2)\n        observeKeyPathChange(obs, \\.int16Col, \"int16Col\", 2)\n        observeKeyPathChange(obs, \\.int32Col, \"int32Col\", 2)\n        observeKeyPathChange(obs, \\.int64Col, \"int64Col\", 2)\n        observeKeyPathChange(obs, \\.floatCol, \"floatCol\", 2.0)\n        observeKeyPathChange(obs, \\.doubleCol, \"doubleCol\", 2.0)\n        observeKeyPathChange(obs, \\.stringCol, \"stringCol\", \"def\")\n        observeKeyPathChange(obs, \\.binaryCol, \"binaryCol\", data)\n        observeKeyPathChange(obs, \\.dateCol, \"dateCol\", date)\n        observeKeyPathChange(obs, \\.decimalCol, \"decimalCol\", decimal)\n        observeKeyPathChange(obs, \\.objectIdCol, \"objectIdCol\", objectId)\n        observeKeyPathChange(obs, \\.objectCol, \"objectCol\", object)\n        observeKeyPathChange(obs, \\.anyCol, \"anyCol\", anyValue)\n        observeKeyPathChange(obs, \\.uuidCol, \"uuidCol\", uuid)\n        observeKeyPathChange(obs, \\.intEnumCol, \"intEnumCol\", .value3)\n        observeKeyPathChange(obs, \\.stringEnumCol, \"stringEnumCol\", .value2)\n        observeKeyPathChange(obs, \\.optIntCol, \"optIntCol\", 2)\n        observeKeyPathChange(obs, \\.optInt8Col, \"optInt8Col\", 2)\n        observeKeyPathChange(obs, \\.optInt16Col, \"optInt16Col\", 2)\n        observeKeyPathChange(obs, \\.optInt32Col, \"optInt32Col\", 2)\n        observeKeyPathChange(obs, \\.optInt64Col, \"optInt64Col\", 2)\n        observeKeyPathChange(obs, \\.optFloatCol, \"optFloatCol\", 2.0)\n        observeKeyPathChange(obs, \\.optDoubleCol, \"optDoubleCol\", 2.0)\n        observeKeyPathChange(obs, \\.optBoolCol, \"optBoolCol\", true)\n        observeKeyPathChange(obs, \\.optStringCol, \"optStringCol\", \"def\")\n        observeKeyPathChange(obs, \\.optBinaryCol, \"optBinaryCol\", data)\n        observeKeyPathChange(obs, \\.optDateCol, \"optDateCol\", date)\n        observeKeyPathChange(obs, \\.optDecimalCol, \"optDecimalCol\", decimal)\n        observeKeyPathChange(obs, \\.optObjectIdCol, \"optObjectIdCol\", objectId)\n        observeKeyPathChange(obs, \\.optUuidCol, \"optUuidCol\", uuid)\n        observeKeyPathChange(obs, \\.optIntEnumCol, \"optIntEnumCol\", .value2)\n        observeKeyPathChange(obs, \\.optStringEnumCol, \"optStringEnumCol\", .value2)\n\n        observeKeyPathChange(obs, \\.arrayBool, \"arrayBool\", false)\n        observeKeyPathChange(obs, \\.arrayInt, \"arrayInt\", 4)\n        observeKeyPathChange(obs, \\.arrayInt8, \"arrayInt8\", 4)\n        observeKeyPathChange(obs, \\.arrayInt16, \"arrayInt16\", 4)\n        observeKeyPathChange(obs, \\.arrayInt32, \"arrayInt32\", 4)\n        observeKeyPathChange(obs, \\.arrayInt64, \"arrayInt64\", 4)\n        observeKeyPathChange(obs, \\.arrayFloat, \"arrayFloat\", 4)\n        observeKeyPathChange(obs, \\.arrayDouble, \"arrayDouble\", 4)\n        observeKeyPathChange(obs, \\.arrayString, \"arrayString\", \"d\")\n        observeKeyPathChange(obs, \\.arrayBinary, \"arrayBinary\", data)\n        observeKeyPathChange(obs, \\.arrayDate, \"arrayDate\", date)\n        observeKeyPathChange(obs, \\.arrayDecimal, \"arrayDecimal\", decimal)\n        observeKeyPathChange(obs, \\.arrayObjectId, \"arrayObjectId\", objectId)\n        observeKeyPathChange(obs, \\.arrayAny, \"arrayAny\", anyValue)\n        observeKeyPathChange(obs, \\.arrayUuid, \"arrayUuid\", uuid)\n        observeKeyPathChange(obs, \\.arrayOptBool, \"arrayOptBool\", true)\n        observeKeyPathChange(obs, \\.arrayOptInt, \"arrayOptInt\", 4)\n        observeKeyPathChange(obs, \\.arrayOptInt8, \"arrayOptInt8\", 4)\n        observeKeyPathChange(obs, \\.arrayOptInt16, \"arrayOptInt16\", 4)\n        observeKeyPathChange(obs, \\.arrayOptInt32, \"arrayOptInt32\", 4)\n        observeKeyPathChange(obs, \\.arrayOptInt64, \"arrayOptInt64\", 4)\n        observeKeyPathChange(obs, \\.arrayOptFloat, \"arrayOptFloat\", 4)\n        observeKeyPathChange(obs, \\.arrayOptDouble, \"arrayOptDouble\", 4)\n        observeKeyPathChange(obs, \\.arrayOptString, \"arrayOptString\", \"d\")\n        observeKeyPathChange(obs, \\.arrayOptBinary, \"arrayOptBinary\", data)\n        observeKeyPathChange(obs, \\.arrayOptDate, \"arrayOptDate\", date)\n        observeKeyPathChange(obs, \\.arrayOptDecimal, \"arrayOptDecimal\", decimal)\n        observeKeyPathChange(obs, \\.arrayOptObjectId, \"arrayOptObjectId\", objectId)\n        observeKeyPathChange(obs, \\.arrayOptUuid, \"arrayOptUuid\", uuid)\n\n        try! realmWithTestPath().write {\n            obj.setBool.removeAll()\n            obj.setBool.insert(objectsIn: [true])\n            obj.setOptBool.removeAll()\n            obj.setOptBool.insert(objectsIn: [true, nil])\n        }\n\n        observeKeyPathChange(obs, \\.setBool, \"setBool\", false)\n        observeKeyPathChange(obs, \\.setInt, \"setInt\", 4)\n        observeKeyPathChange(obs, \\.setInt8, \"setInt8\", 4)\n        observeKeyPathChange(obs, \\.setInt16, \"setInt16\", 4)\n        observeKeyPathChange(obs, \\.setInt32, \"setInt32\", 4)\n        observeKeyPathChange(obs, \\.setInt64, \"setInt64\", 4)\n        observeKeyPathChange(obs, \\.setFloat, \"setFloat\", 4)\n        observeKeyPathChange(obs, \\.setDouble, \"setDouble\", 4)\n        observeKeyPathChange(obs, \\.setString, \"setString\", \"d\")\n        observeKeyPathChange(obs, \\.setBinary, \"setBinary\", data)\n        observeKeyPathChange(obs, \\.setDate, \"setDate\", date)\n        observeKeyPathChange(obs, \\.setDecimal, \"setDecimal\", decimal)\n        observeKeyPathChange(obs, \\.setObjectId, \"setObjectId\", objectId)\n        observeKeyPathChange(obs, \\.setAny, \"setAny\", anyValue)\n        observeKeyPathChange(obs, \\.setUuid, \"setUuid\", uuid)\n        observeKeyPathChange(obs, \\.setOptBool, \"setOptBool\", false)\n        observeKeyPathChange(obs, \\.setOptInt, \"setOptInt\", 4)\n        observeKeyPathChange(obs, \\.setOptInt8, \"setOptInt8\", 4)\n        observeKeyPathChange(obs, \\.setOptInt16, \"setOptInt16\", 4)\n        observeKeyPathChange(obs, \\.setOptInt32, \"setOptInt32\", 4)\n        observeKeyPathChange(obs, \\.setOptInt64, \"setOptInt64\", 4)\n        observeKeyPathChange(obs, \\.setOptFloat, \"setOptFloat\", 4)\n        observeKeyPathChange(obs, \\.setOptDouble, \"setOptDouble\", 4)\n        observeKeyPathChange(obs, \\.setOptString, \"setOptString\", \"d\")\n        observeKeyPathChange(obs, \\.setOptBinary, \"setOptBinary\", data)\n        observeKeyPathChange(obs, \\.setOptDate, \"setOptDate\", date)\n        observeKeyPathChange(obs, \\.setOptDecimal, \"setOptDecimal\", decimal)\n        observeKeyPathChange(obs, \\.setOptObjectId, \"setOptObjectId\", objectId)\n        observeKeyPathChange(obs, \\.setOptUuid, \"setOptUuid\", uuid)\n\n        observeKeyPathChange(obs, \\.mapBool, \"mapBool\", false)\n        observeKeyPathChange(obs, \\.mapInt, \"mapInt\", 4)\n        observeKeyPathChange(obs, \\.mapInt8, \"mapInt8\", 4)\n        observeKeyPathChange(obs, \\.mapInt16, \"mapInt16\", 4)\n        observeKeyPathChange(obs, \\.mapInt32, \"mapInt32\", 4)\n        observeKeyPathChange(obs, \\.mapInt64, \"mapInt64\", 4)\n        observeKeyPathChange(obs, \\.mapFloat, \"mapFloat\", 4)\n        observeKeyPathChange(obs, \\.mapDouble, \"mapDouble\", 4)\n        observeKeyPathChange(obs, \\.mapString, \"mapString\", \"d\")\n        observeKeyPathChange(obs, \\.mapBinary, \"mapBinary\", data)\n        observeKeyPathChange(obs, \\.mapDate, \"mapDate\", date)\n        observeKeyPathChange(obs, \\.mapDecimal, \"mapDecimal\", decimal)\n        observeKeyPathChange(obs, \\.mapObjectId, \"mapObjectId\", objectId)\n        observeKeyPathChange(obs, \\.mapAny, \"mapAny\", anyValue)\n        observeKeyPathChange(obs, \\.mapUuid, \"mapUuid\", uuid)\n        observeKeyPathChange(obs, \\.mapOptBool, \"mapOptBool\", false)\n        observeKeyPathChange(obs, \\.mapOptInt, \"mapOptInt\", 4)\n        observeKeyPathChange(obs, \\.mapOptInt8, \"mapOptInt8\", 4)\n        observeKeyPathChange(obs, \\.mapOptInt16, \"mapOptInt16\", 4)\n        observeKeyPathChange(obs, \\.mapOptInt32, \"mapOptInt32\", 4)\n        observeKeyPathChange(obs, \\.mapOptInt64, \"mapOptInt64\", 4)\n        observeKeyPathChange(obs, \\.mapOptFloat, \"mapOptFloat\", 4)\n        observeKeyPathChange(obs, \\.mapOptDouble, \"mapOptDouble\", 4)\n        observeKeyPathChange(obs, \\.mapOptString, \"mapOptString\", \"d\")\n        observeKeyPathChange(obs, \\.mapOptBinary, \"mapOptBinary\", data)\n        observeKeyPathChange(obs, \\.mapOptDate, \"mapOptDate\", date)\n        observeKeyPathChange(obs, \\.mapOptDecimal, \"mapOptDecimal\", decimal)\n        observeKeyPathChange(obs, \\.mapOptObjectId, \"mapOptObjectId\", objectId)\n        observeKeyPathChange(obs, \\.mapOptUuid, \"mapOptUuid\", uuid)\n    }\n\n    @MainActor\n    func testObserveKeyPath() {\n        let realm = populatedRealm()\n        let johnProjection = realm.objects(PersonProjection.self).filter(\"lastName == 'Snow'\").first!\n\n        let ex = expectation(description: \"testProjectionNotification\")\n        let token = johnProjection.observe(keyPaths: [\"lastName\"], on: nil) { _ in\n            ex.fulfill()\n        }\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread { @Sendable in\n            let realm = unsafeSelf.realmWithTestPath()\n            try! realm.write {\n                let johnObject = realm.objects(CommonPerson.self).filter(\"lastName == 'Snow'\").first!\n                johnObject.lastName = \"Targaryen\"\n            }\n        }\n        waitForExpectations(timeout: 1, handler: nil)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testObserveNestedProjection() {\n        let realm = populatedRealm()\n        let johnProjection = realm.objects(PersonProjection.self).first!\n\n        var ex = expectation(description: \"testProjectionNotificationNestedWithKeyPath\")\n        let token = johnProjection.observe(keyPaths: [\\PersonProjection.mobile]) { changes in\n            if case .change(_, let propertyChange) = changes {\n                XCTAssertEqual(propertyChange[0].name, \"mobile\")\n                XCTAssertEqual((propertyChange[0].newValue as? String), \"529-345-678\")\n                ex.fulfill()\n            } else {\n                XCTFail(\"expected .change, got \\(changes)\")\n            }\n        }\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread { @Sendable in\n            let realm = unsafeSelf.realmWithTestPath()\n            try! realm.write {\n                let johnObject = realm.objects(CommonPerson.self).filter(\"lastName == 'Snow'\").first!\n                johnObject.extras?.phone?.mobile?.number = \"529-345-678\"\n            }\n        }\n        waitForExpectations(timeout: 2.0, handler: nil)\n        token.invalidate()\n\n        ex = expectation(description: \"testProjectionNotificationNested\")\n        let token2 = johnProjection.observe { changes in\n            if case .change(_, let propertyChange) = changes {\n                XCTAssertEqual(propertyChange[0].name, \"email\")\n                XCTAssertEqual(propertyChange[0].newValue as? String, \"joe@realm.com\")\n                ex.fulfill()\n            } else {\n                XCTFail(\"expected .change, got \\(changes)\")\n            }\n        }\n        dispatchSyncNewThread { @Sendable in\n            let realm = unsafeSelf.realmWithTestPath()\n            try! realm.write {\n                let johnObject = realm.objects(CommonPerson.self).filter(\"lastName == 'Snow'\").first!\n                johnObject.extras?.email = \"joe@realm.com\"\n            }\n        }\n        waitForExpectations(timeout: 2.0, handler: nil)\n        token2.invalidate()\n\n        ex = expectation(description: \"testProjectionNotificationEmbeddedNested\")\n        let token3 = johnProjection.observe { changes in\n            if case .change(_, let propertyChange) = changes {\n                // this appears to be required due to an autoclosure bug\n                nonisolated(unsafe) let change = propertyChange[0]\n                XCTAssertEqual(change.name, \"homeCity\")\n                XCTAssertEqual(change.newValue as? String, \"Barranquilla\")\n                ex.fulfill()\n            } else {\n                XCTFail(\"expected .change, got \\(changes)\")\n            }\n        }\n        dispatchSyncNewThread { @Sendable in\n            let realm = unsafeSelf.realmWithTestPath()\n            try! realm.write {\n                let johnObject = realm.objects(CommonPerson.self).filter(\"lastName == 'Snow'\").first!\n                johnObject.address?.city = \"Barranquilla\"\n            }\n        }\n        waitForExpectations(timeout: 2.0, handler: nil)\n        token3.invalidate()\n    }\n\n    var changeDictionary: [NSKeyValueChangeKey: Any]?\n    override func observeValue(forKeyPath keyPath: String?, of object: Any?,\n                               change: [NSKeyValueChangeKey: Any]?,\n                               context: UnsafeMutableRawPointer?) {\n        changeDictionary = change\n    }\n\n    func observeChange(_ obj: AllTypesPrimitiveProjection, _ key: String,\n                       _ block: () -> Void) -> [NSKeyValueChangeKey: Any]? {\n        obj.addObserver(self, forKeyPath: key, options: [.old, .new], context: nil)\n        try! obj.realm!.write(block)\n        obj.removeObserver(self, forKeyPath: key)\n\n        let change = changeDictionary\n        changeDictionary = nil\n        return change\n    }\n\n    func observeChange<T: Equatable>(_ obj: AllTypesPrimitiveProjection, _ key: String, _ old: T?, _ new: T?,\n                                     fileName: StaticString = #filePath, lineNumber: UInt = #line, _ block: () -> Void) {\n        guard let change = observeChange(obj, key, block) else {\n            return XCTFail(\"did not get a notification\", file: fileName, line: lineNumber)\n        }\n\n        XCTAssertEqual(old, change[.oldKey] as? T, file: fileName, line: lineNumber)\n        XCTAssertEqual(new, change[.newKey] as? T, file: fileName, line: lineNumber)\n    }\n\n    func observeListChange(_ obj: AllTypesPrimitiveProjection, _ key: String, _ kind: NSKeyValueChange,\n                           _ indexes: NSIndexSet = NSIndexSet(index: 0),\n                           fileName: StaticString = #filePath, lineNumber: UInt = #line, _ block: () -> Void) {\n        guard let change = observeChange(obj, key, block) else {\n            return XCTFail(\"did not get a notification\", file: fileName, line: lineNumber)\n        }\n\n        let actualKind = NSKeyValueChange(rawValue: change[.kindKey] as! UInt)\n        let actualIndexes = change[.indexesKey]! as! NSIndexSet\n        XCTAssertEqual(actualKind, kind, file: fileName, line: lineNumber)\n        XCTAssertEqual(actualIndexes, indexes, file: fileName, line: lineNumber)\n    }\n\n    func newObjects(_ defaultValues: [String: Any] = [:]) -> (ModernAllTypesObject, AllTypesPrimitiveProjection) {\n        let realm = realmWithTestPath()\n        realm.beginWrite()\n        realm.delete(realm.objects(ModernAllTypesObject.self))\n        let obj = realm.create(ModernAllTypesObject.self, value: defaultValues)\n        let obs = AllTypesPrimitiveProjection(projecting: obj)\n        try! realm.commitWrite()\n        return (obj, obs)\n    }\n\n    func observeSetChange(_ obj: AllTypesPrimitiveProjection, _ key: String,\n                          fileName: StaticString = #filePath, lineNumber: UInt = #line, _ block: () -> Void) {\n        guard let change = observeChange(obj, key, block) else {\n            return XCTFail(\"did not get a notification\", file: fileName, line: lineNumber)\n        }\n\n        let actualKind = NSKeyValueChange(rawValue: change[.kindKey]! as! UInt)\n        XCTAssertEqual(actualKind, .setting, file: fileName, line: lineNumber)\n    }\n\n    func testAllPropertyTypes() {\n        var (obj, obs) = newObjects(allTypeValues)\n\n        let data = Data(\"b\".utf8)\n        let date = Date(timeIntervalSince1970: 2)\n        let decimal = Decimal128(number: 3)\n        let objectId = ObjectId()\n        let uuid = UUID()\n\n        observeChange(obs, \"boolCol\", true, false) { obj.boolCol = false }\n        observeChange(obs, \"int8Col\", 11 as Int8, 10) { obj.int8Col = 10 }\n        observeChange(obs, \"int16Col\", 12 as Int16, 10) { obj.int16Col = 10 }\n        observeChange(obs, \"int32Col\", 13 as Int32, 10) { obj.int32Col = 10 }\n        observeChange(obs, \"int64Col\", 14 as Int64, 10) { obj.int64Col = 10 }\n        observeChange(obs, \"floatCol\", 15 as Float, 10) { obj.floatCol = 10 }\n        observeChange(obs, \"doubleCol\", 16 as Double, 10) { obj.doubleCol = 10 }\n        observeChange(obs, \"stringCol\", \"a\", \"abc\") { obj.stringCol = \"abc\" }\n        observeChange(obs, \"objectCol\", obj.objectCol, obj) { obj.objectCol = obj }\n        observeChange(obs, \"binaryCol\", obj.binaryCol, data) { obj.binaryCol = data }\n        observeChange(obs, \"dateCol\", obj.dateCol, date) { obj.dateCol = date }\n        observeChange(obs, \"decimalCol\", obj.decimalCol, decimal) { obj.decimalCol = decimal }\n        observeChange(obs, \"objectIdCol\", obj.objectIdCol, objectId) { obj.objectIdCol = objectId }\n        observeChange(obs, \"uuidCol\", obj.uuidCol, uuid) { obj.uuidCol = uuid }\n        observeChange(obs, \"anyCol\", 20, 1) { obj.anyCol = .int(1) }\n\n        (obj, obs) = newObjects()\n\n        observeListChange(obs, \"arrayCol\", .insertion) { obj.arrayCol.append(obj) }\n        observeListChange(obs, \"arrayCol\", .removal) { obj.arrayCol.removeAll() }\n        observeSetChange(obs, \"setCol\") { obj.setCol.insert(obj) }\n        observeSetChange(obs, \"setCol\") { obj.setCol.remove(obj) }\n\n        observeChange(obs, \"optIntCol\", nil, 10) { obj.optIntCol = 10 }\n        observeChange(obs, \"optFloatCol\", nil, 10.0) { obj.optFloatCol = 10 }\n        observeChange(obs, \"optDoubleCol\", nil, 10.0) { obj.optDoubleCol = 10 }\n        observeChange(obs, \"optBoolCol\", nil, true) { obj.optBoolCol = true }\n        observeChange(obs, \"optStringCol\", nil, \"abc\") { obj.optStringCol = \"abc\" }\n        observeChange(obs, \"optBinaryCol\", nil, data) { obj.optBinaryCol = data }\n        observeChange(obs, \"optDateCol\", nil, date) { obj.optDateCol = date }\n        observeChange(obs, \"optDecimalCol\", nil, decimal) { obj.optDecimalCol = decimal }\n        observeChange(obs, \"optObjectIdCol\", nil, objectId) { obj.optObjectIdCol = objectId }\n        observeChange(obs, \"optUuidCol\", nil, uuid) { obj.optUuidCol = uuid }\n\n        observeChange(obs, \"optIntCol\", 10, nil) { obj.optIntCol = nil }\n        observeChange(obs, \"optFloatCol\", 10.0, nil) { obj.optFloatCol = nil }\n        observeChange(obs, \"optDoubleCol\", 10.0, nil) { obj.optDoubleCol = nil }\n        observeChange(obs, \"optBoolCol\", true, nil) { obj.optBoolCol = nil }\n        observeChange(obs, \"optStringCol\", \"abc\", nil) { obj.optStringCol = nil }\n        observeChange(obs, \"optBinaryCol\", data, nil) { obj.optBinaryCol = nil }\n        observeChange(obs, \"optDateCol\", date, nil) { obj.optDateCol = nil }\n        observeChange(obs, \"optDecimalCol\", decimal, nil) { obj.optDecimalCol = nil }\n        observeChange(obs, \"optObjectIdCol\", objectId, nil) { obj.optObjectIdCol = nil }\n        observeChange(obs, \"optUuidCol\", uuid, nil) { obj.optUuidCol = nil }\n\n        // .insertion append\n        observeListChange(obs, \"arrayBool\", .insertion) { obj.arrayBool.append(true) }\n        observeListChange(obs, \"arrayInt\", .insertion) { obj.arrayInt.append(10) }\n        observeListChange(obs, \"arrayInt8\", .insertion) { obj.arrayInt8.append(10) }\n        observeListChange(obs, \"arrayInt16\", .insertion) { obj.arrayInt16.append(10) }\n        observeListChange(obs, \"arrayInt32\", .insertion) { obj.arrayInt32.append(10) }\n        observeListChange(obs, \"arrayInt64\", .insertion) { obj.arrayInt64.append(10) }\n        observeListChange(obs, \"arrayFloat\", .insertion) { obj.arrayFloat.append(10.0) }\n        observeListChange(obs, \"arrayDouble\", .insertion) { obj.arrayDouble.append(10.0) }\n        observeListChange(obs, \"arrayString\", .insertion) { obj.arrayString.append(\"10\") }\n        observeListChange(obs, \"arrayBinary\", .insertion) { obj.arrayBinary.append(data) }\n        observeListChange(obs, \"arrayDate\", .insertion) { obj.arrayDate.append(date) }\n        observeListChange(obs, \"arrayDecimal\", .insertion) { obj.arrayDecimal.append(decimal) }\n        observeListChange(obs, \"arrayObjectId\", .insertion) { obj.arrayObjectId.append(objectId) }\n        observeListChange(obs, \"arrayAny\", .insertion) { obj.arrayAny.append(.int(10)) }\n        observeListChange(obs, \"arrayUuid\", .insertion) { obj.arrayUuid.append(uuid) }\n\n        observeListChange(obs, \"arrayOptBool\", .insertion) { obj.arrayOptBool.append(true) }\n        observeListChange(obs, \"arrayOptInt\", .insertion) { obj.arrayOptInt.append(10) }\n        observeListChange(obs, \"arrayOptInt8\", .insertion) { obj.arrayOptInt8.append(10) }\n        observeListChange(obs, \"arrayOptInt16\", .insertion) { obj.arrayOptInt16.append(10) }\n        observeListChange(obs, \"arrayOptInt32\", .insertion) { obj.arrayOptInt32.append(10) }\n        observeListChange(obs, \"arrayOptInt64\", .insertion) { obj.arrayOptInt64.append(10) }\n        observeListChange(obs, \"arrayOptFloat\", .insertion) { obj.arrayOptFloat.append(10.0) }\n        observeListChange(obs, \"arrayOptDouble\", .insertion) { obj.arrayOptDouble.append(10.0) }\n        observeListChange(obs, \"arrayOptString\", .insertion) { obj.arrayOptString.append(\"10\") }\n        observeListChange(obs, \"arrayOptBinary\", .insertion) { obj.arrayOptBinary.append(data) }\n        observeListChange(obs, \"arrayOptDate\", .insertion) { obj.arrayOptDate.append(date) }\n        observeListChange(obs, \"arrayOptDecimal\", .insertion) { obj.arrayOptDecimal.append(decimal) }\n        observeListChange(obs, \"arrayOptObjectId\", .insertion) { obj.arrayOptObjectId.append(objectId) }\n        observeListChange(obs, \"arrayOptUuid\", .insertion) { obj.arrayOptUuid.append(uuid) }\n\n        (obj, obs) = newObjects()\n        observeListChange(obs, \"arrayOptBool\", .insertion) { obj.arrayOptBool.append(nil) }\n        observeListChange(obs, \"arrayOptInt\", .insertion) { obj.arrayOptInt.append(nil) }\n        observeListChange(obs, \"arrayOptInt8\", .insertion) { obj.arrayOptInt8.append(nil) }\n        observeListChange(obs, \"arrayOptInt16\", .insertion) { obj.arrayOptInt16.append(nil) }\n        observeListChange(obs, \"arrayOptInt32\", .insertion) { obj.arrayOptInt32.append(nil) }\n        observeListChange(obs, \"arrayOptInt64\", .insertion) { obj.arrayOptInt64.append(nil) }\n        observeListChange(obs, \"arrayOptFloat\", .insertion) { obj.arrayOptFloat.append(nil) }\n        observeListChange(obs, \"arrayOptDouble\", .insertion) { obj.arrayOptDouble.append(nil) }\n        observeListChange(obs, \"arrayOptString\", .insertion) { obj.arrayOptString.append(nil) }\n        observeListChange(obs, \"arrayOptBinary\", .insertion) { obj.arrayOptBinary.append(nil) }\n        observeListChange(obs, \"arrayOptDate\", .insertion) { obj.arrayOptDate.append(nil) }\n        observeListChange(obs, \"arrayOptDecimal\", .insertion) { obj.arrayOptDecimal.append(nil) }\n        observeListChange(obs, \"arrayOptObjectId\", .insertion) { obj.arrayOptObjectId.append(nil) }\n        observeListChange(obs, \"arrayOptUuid\", .insertion) { obj.arrayOptUuid.append(nil) }\n\n        // .insertion insert at\n        observeListChange(obs, \"arrayBool\", .insertion) { obj.arrayBool.insert(true, at: 0) }\n        observeListChange(obs, \"arrayInt\", .insertion) { obj.arrayInt.append(10) }\n        observeListChange(obs, \"arrayInt8\", .insertion) { obj.arrayInt8.insert(10, at: 0) }\n        observeListChange(obs, \"arrayInt16\", .insertion) { obj.arrayInt16.insert(10, at: 0) }\n        observeListChange(obs, \"arrayInt32\", .insertion) { obj.arrayInt32.insert(10, at: 0) }\n        observeListChange(obs, \"arrayInt64\", .insertion) { obj.arrayInt64.insert(10, at: 0) }\n        observeListChange(obs, \"arrayFloat\", .insertion) { obj.arrayFloat.insert(10, at: 0) }\n        observeListChange(obs, \"arrayDouble\", .insertion) { obj.arrayDouble.insert(10, at: 0) }\n        observeListChange(obs, \"arrayString\", .insertion) { obj.arrayString.insert(\"abc\", at: 0) }\n        observeListChange(obs, \"arrayBinary\", .insertion) { obj.arrayBinary.append(data) }\n        observeListChange(obs, \"arrayDate\", .insertion) { obj.arrayDate.append(date) }\n        observeListChange(obs, \"arrayDecimal\", .insertion) { obj.arrayDecimal.insert(decimal, at: 0) }\n        observeListChange(obs, \"arrayObjectId\", .insertion) { obj.arrayObjectId.insert(objectId, at: 0) }\n        observeListChange(obs, \"arrayUuid\", .insertion) { obj.arrayUuid.insert(uuid, at: 0) }\n        observeListChange(obs, \"arrayAny\", .insertion) { obj.arrayAny.insert(.string(\"a\"), at: 0) }\n\n        observeListChange(obs, \"arrayOptBool\", .insertion) { obj.arrayOptBool.insert(true, at: 0) }\n        observeListChange(obs, \"arrayOptInt\", .insertion) { obj.arrayOptInt.insert(10, at: 0) }\n        observeListChange(obs, \"arrayOptInt8\", .insertion) { obj.arrayOptInt8.insert(10, at: 0) }\n        observeListChange(obs, \"arrayOptInt16\", .insertion) { obj.arrayOptInt16.insert(10, at: 0) }\n        observeListChange(obs, \"arrayOptInt32\", .insertion) { obj.arrayOptInt32.insert(10, at: 0) }\n        observeListChange(obs, \"arrayOptInt64\", .insertion) { obj.arrayOptInt64.insert(10, at: 0) }\n        observeListChange(obs, \"arrayOptFloat\", .insertion) { obj.arrayOptFloat.insert(10, at: 0) }\n        observeListChange(obs, \"arrayOptDouble\", .insertion) { obj.arrayOptDouble.insert(10, at: 0) }\n        observeListChange(obs, \"arrayOptString\", .insertion) { obj.arrayOptString.insert(\"abc\", at: 0) }\n        observeListChange(obs, \"arrayOptBinary\", .insertion) { obj.arrayOptBinary.insert(data, at: 0) }\n        observeListChange(obs, \"arrayOptDate\", .insertion) { obj.arrayOptDate.insert(date, at: 0) }\n        observeListChange(obs, \"arrayOptDecimal\", .insertion) { obj.arrayOptDecimal.insert(decimal, at: 0) }\n        observeListChange(obs, \"arrayOptObjectId\", .insertion) { obj.arrayOptObjectId.insert(objectId, at: 0) }\n        observeListChange(obs, \"arrayOptUuid\", .insertion) { obj.arrayOptUuid.insert(uuid, at: 0) }\n\n        observeListChange(obs, \"arrayOptBool\", .insertion) { obj.arrayOptBool.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptInt\", .insertion) { obj.arrayOptInt.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptInt8\", .insertion) { obj.arrayOptInt8.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptInt16\", .insertion) { obj.arrayOptInt16.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptInt32\", .insertion) { obj.arrayOptInt32.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptInt64\", .insertion) { obj.arrayOptInt64.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptFloat\", .insertion) { obj.arrayOptFloat.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptDouble\", .insertion) { obj.arrayOptDouble.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptString\", .insertion) { obj.arrayOptString.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptDate\", .insertion) { obj.arrayOptDate.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptBinary\", .insertion) { obj.arrayOptBinary.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptDecimal\", .insertion) { obj.arrayOptDecimal.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptObjectId\", .insertion) { obj.arrayOptObjectId.insert(nil, at: 0) }\n        observeListChange(obs, \"arrayOptUuid\", .insertion) { obj.arrayOptUuid.insert(nil, at: 0) }\n        // .replacement\n        observeListChange(obs, \"arrayBool\", .replacement) { obj.arrayBool[0] = true }\n        observeListChange(obs, \"arrayInt\", .replacement) { obj.arrayInt[0] = 10 }\n        observeListChange(obs, \"arrayInt8\", .replacement) { obj.arrayInt8[0] = 10 }\n        observeListChange(obs, \"arrayInt16\", .replacement) { obj.arrayInt16[0] = 10 }\n        observeListChange(obs, \"arrayInt32\", .replacement) { obj.arrayInt32[0] = 10 }\n        observeListChange(obs, \"arrayInt64\", .replacement) { obj.arrayInt64[0] = 10 }\n        observeListChange(obs, \"arrayFloat\", .replacement) { obj.arrayFloat[0] = 10 }\n        observeListChange(obs, \"arrayDouble\", .replacement) { obj.arrayDouble[0] = 10 }\n        observeListChange(obs, \"arrayString\", .replacement) { obj.arrayString[0] = \"abc\" }\n        observeListChange(obs, \"arrayBinary\", .replacement) { obj.arrayBinary[0] = data }\n        observeListChange(obs, \"arrayDate\", .replacement) { obj.arrayDate[0] = date }\n        observeListChange(obs, \"arrayDecimal\", .replacement) { obj.arrayDecimal[0] = decimal }\n        observeListChange(obs, \"arrayObjectId\", .replacement) { obj.arrayObjectId[0] = objectId }\n        observeListChange(obs, \"arrayUuid\", .replacement) { obj.arrayUuid[0] = uuid }\n        observeListChange(obs, \"arrayAny\", .replacement) { obj.arrayAny[0] = .string(\"a\") }\n\n        observeListChange(obs, \"arrayOptBool\", .replacement) { obj.arrayOptBool[0] = true }\n        observeListChange(obs, \"arrayOptInt\", .replacement) { obj.arrayOptInt[0] = 10 }\n        observeListChange(obs, \"arrayOptInt8\", .replacement) { obj.arrayOptInt8[0] = 10 }\n        observeListChange(obs, \"arrayOptInt16\", .replacement) { obj.arrayOptInt16[0] = 10 }\n        observeListChange(obs, \"arrayOptInt32\", .replacement) { obj.arrayOptInt32[0] = 10 }\n        observeListChange(obs, \"arrayOptInt64\", .replacement) { obj.arrayOptInt64[0] = 10 }\n        observeListChange(obs, \"arrayOptFloat\", .replacement) { obj.arrayOptFloat[0] = 10 }\n        observeListChange(obs, \"arrayOptDouble\", .replacement) { obj.arrayOptDouble[0] = 10 }\n        observeListChange(obs, \"arrayOptString\", .replacement) { obj.arrayOptString[0] = \"abc\" }\n        observeListChange(obs, \"arrayOptBinary\", .replacement) { obj.arrayOptBinary[0] = data }\n        observeListChange(obs, \"arrayOptDate\", .replacement) { obj.arrayOptDate[0] = date }\n        observeListChange(obs, \"arrayOptBinary\", .replacement) { obj.arrayOptBinary[0] = data }\n        observeListChange(obs, \"arrayOptDate\", .replacement) { obj.arrayOptDate[0] = date }\n        observeListChange(obs, \"arrayOptDecimal\", .replacement) { obj.arrayOptDecimal[0] = decimal }\n        observeListChange(obs, \"arrayOptObjectId\", .replacement) { obj.arrayOptObjectId[0] = objectId }\n        observeListChange(obs, \"arrayOptUuid\", .replacement) { obj.arrayOptUuid[0] = uuid }\n\n        observeListChange(obs, \"arrayOptBool\", .replacement) { obj.arrayOptBool[0] = nil }\n        observeListChange(obs, \"arrayOptInt\", .replacement) { obj.arrayOptInt[0] = nil }\n        observeListChange(obs, \"arrayOptInt8\", .replacement) { obj.arrayOptInt8[0] = nil }\n        observeListChange(obs, \"arrayOptInt16\", .replacement) { obj.arrayOptInt16[0] = nil }\n        observeListChange(obs, \"arrayOptInt32\", .replacement) { obj.arrayOptInt32[0] = nil }\n        observeListChange(obs, \"arrayOptInt64\", .replacement) { obj.arrayOptInt64[0] = nil }\n        observeListChange(obs, \"arrayOptFloat\", .replacement) { obj.arrayOptFloat[0] = nil }\n        observeListChange(obs, \"arrayOptDouble\", .replacement) { obj.arrayOptDouble[0] = nil }\n        observeListChange(obs, \"arrayOptString\", .replacement) { obj.arrayOptString[0] = nil }\n        observeListChange(obs, \"arrayOptBinary\", .replacement) { obj.arrayOptBinary[0] = nil }\n        observeListChange(obs, \"arrayOptDate\", .replacement) { obj.arrayOptDate[0] = nil }\n        observeListChange(obs, \"arrayOptDate\", .replacement) { obj.arrayOptDate[0] = nil }\n        observeListChange(obs, \"arrayOptBinary\", .replacement) { obj.arrayOptBinary[0] = nil }\n        observeListChange(obs, \"arrayOptDecimal\", .replacement) { obj.arrayOptDecimal[0] = nil }\n        observeListChange(obs, \"arrayOptObjectId\", .replacement) { obj.arrayOptObjectId[0] = nil }\n        observeListChange(obs, \"arrayOptUuid\", .replacement) { obj.arrayOptUuid[0] = nil }\n\n        // .removal removeAll\n        observeListChange(obs, \"arrayBool\", .removal) { obj.arrayBool.removeAll() }\n        observeListChange(obs, \"arrayInt\", .removal) { obj.arrayInt.removeAll() }\n        observeListChange(obs, \"arrayInt8\", .removal) { obj.arrayInt8.removeAll() }\n        observeListChange(obs, \"arrayInt16\", .removal) { obj.arrayInt16.removeAll() }\n        observeListChange(obs, \"arrayInt32\", .removal) { obj.arrayInt32.removeAll() }\n        observeListChange(obs, \"arrayInt64\", .removal) { obj.arrayInt64.removeAll() }\n        observeListChange(obs, \"arrayFloat\", .removal) { obj.arrayFloat.removeAll() }\n        observeListChange(obs, \"arrayDouble\", .removal) { obj.arrayDouble.removeAll() }\n        observeListChange(obs, \"arrayString\", .removal) { obj.arrayString.removeAll() }\n        observeListChange(obs, \"arrayBinary\", .removal) { obj.arrayBinary.removeAll() }\n        observeListChange(obs, \"arrayDate\", .removal) { obj.arrayDate.removeAll() }\n        observeListChange(obs, \"arrayDecimal\", .removal) { obj.arrayDecimal.removeAll() }\n        observeListChange(obs, \"arrayObjectId\", .removal) { obj.arrayObjectId.removeAll() }\n        observeListChange(obs, \"arrayUuid\", .removal) { obj.arrayUuid.removeAll() }\n        observeListChange(obs, \"arrayAny\", .removal) { obj.arrayAny.removeAll() }\n\n        let indices = NSIndexSet(indexesIn: NSRange(location: 0, length: 3))\n        observeListChange(obs, \"arrayOptBool\", .removal, indices) { obj.arrayOptBool.removeAll() }\n        observeListChange(obs, \"arrayOptInt\", .removal, indices) { obj.arrayOptInt.removeAll() }\n        observeListChange(obs, \"arrayOptInt8\", .removal, indices) { obj.arrayOptInt8.removeAll() }\n        observeListChange(obs, \"arrayOptInt16\", .removal, indices) { obj.arrayOptInt16.removeAll() }\n        observeListChange(obs, \"arrayOptInt32\", .removal, indices) { obj.arrayOptInt32.removeAll() }\n        observeListChange(obs, \"arrayOptInt64\", .removal, indices) { obj.arrayOptInt64.removeAll() }\n        observeListChange(obs, \"arrayOptFloat\", .removal, indices) { obj.arrayOptFloat.removeAll() }\n        observeListChange(obs, \"arrayOptDouble\", .removal, indices) { obj.arrayOptDouble.removeAll() }\n        observeListChange(obs, \"arrayOptString\", .removal, indices) { obj.arrayOptString.removeAll() }\n        observeListChange(obs, \"arrayOptBinary\", .removal, indices) { obj.arrayOptBinary.removeAll() }\n        observeListChange(obs, \"arrayOptDate\", .removal, indices) { obj.arrayOptDate.removeAll() }\n        observeListChange(obs, \"arrayOptDecimal\", .removal, indices) { obj.arrayOptDecimal.removeAll() }\n        observeListChange(obs, \"arrayOptObjectId\", .removal, indices) { obj.arrayOptObjectId.removeAll() }\n        observeListChange(obs, \"arrayOptUuid\", .removal, indices) { obj.arrayOptUuid.removeAll() }\n\n        // .removal remove at\n        (obj, obs) = newObjects(allTypeValues)\n        observeListChange(obs, \"arrayBool\", .removal) { obj.arrayBool.remove(at: 0) }\n        observeListChange(obs, \"arrayInt\", .removal) { obj.arrayInt.remove(at: 0) }\n        observeListChange(obs, \"arrayInt8\", .removal) { obj.arrayInt8.remove(at: 0) }\n        observeListChange(obs, \"arrayInt16\", .removal) { obj.arrayInt16.remove(at: 0) }\n        observeListChange(obs, \"arrayInt32\", .removal) { obj.arrayInt32.remove(at: 0) }\n        observeListChange(obs, \"arrayInt64\", .removal) { obj.arrayInt64.remove(at: 0) }\n        observeListChange(obs, \"arrayFloat\", .removal) { obj.arrayFloat.remove(at: 0) }\n        observeListChange(obs, \"arrayDouble\", .removal) { obj.arrayDouble.remove(at: 0) }\n        observeListChange(obs, \"arrayString\", .removal) { obj.arrayString.remove(at: 0) }\n        observeListChange(obs, \"arrayBinary\", .removal) { obj.arrayBinary.remove(at: 0) }\n        observeListChange(obs, \"arrayDate\", .removal) { obj.arrayDate.remove(at: 0) }\n        observeListChange(obs, \"arrayDecimal\", .removal) { obj.arrayDecimal.remove(at: 0) }\n        observeListChange(obs, \"arrayObjectId\", .removal) { obj.arrayObjectId.remove(at: 0) }\n        observeListChange(obs, \"arrayUuid\", .removal) { obj.arrayUuid.remove(at: 0) }\n        observeListChange(obs, \"arrayAny\", .removal) { obj.arrayAny.remove(at: 0) }\n\n        observeListChange(obs, \"arrayOptBool\", .removal) { obj.arrayOptBool.remove(at: 0) }\n        observeListChange(obs, \"arrayOptInt\", .removal) { obj.arrayOptInt.remove(at: 0) }\n        observeListChange(obs, \"arrayOptInt8\", .removal) { obj.arrayOptInt8.remove(at: 0) }\n        observeListChange(obs, \"arrayOptInt16\", .removal) { obj.arrayOptInt16.remove(at: 0) }\n        observeListChange(obs, \"arrayOptInt32\", .removal) { obj.arrayOptInt32.remove(at: 0) }\n        observeListChange(obs, \"arrayOptInt64\", .removal) { obj.arrayOptInt64.remove(at: 0) }\n        observeListChange(obs, \"arrayOptFloat\", .removal) { obj.arrayOptFloat.remove(at: 0) }\n        observeListChange(obs, \"arrayOptDouble\", .removal) { obj.arrayOptDouble.remove(at: 0) }\n        observeListChange(obs, \"arrayOptString\", .removal) { obj.arrayOptString.remove(at: 0) }\n        observeListChange(obs, \"arrayOptBinary\", .removal) { obj.arrayOptBinary.remove(at: 0) }\n        observeListChange(obs, \"arrayOptDate\", .removal) { obj.arrayOptDate.remove(at: 0) }\n        observeListChange(obs, \"arrayOptDecimal\", .removal) { obj.arrayOptDecimal.remove(at: 0) }\n        observeListChange(obs, \"arrayOptObjectId\", .removal) { obj.arrayOptObjectId.remove(at: 0) }\n        observeListChange(obs, \"arrayOptUuid\", .removal) { obj.arrayOptUuid.remove(at: 0) }\n\n        // insert\n        observeSetChange(obs, \"setBool\") { obj.setBool.insert(true) }\n        observeSetChange(obs, \"setInt\") { obj.setInt.insert(10) }\n        observeSetChange(obs, \"setInt8\") { obj.setInt8.insert(10) }\n        observeSetChange(obs, \"setInt16\") { obj.setInt16.insert(10) }\n        observeSetChange(obs, \"setInt32\") { obj.setInt32.insert(10) }\n        observeSetChange(obs, \"setInt64\") { obj.setInt64.insert(10) }\n        observeSetChange(obs, \"setFloat\") { obj.setFloat.insert(10.0) }\n        observeSetChange(obs, \"setDouble\") { obj.setDouble.insert(10.0) }\n        observeSetChange(obs, \"setString\") { obj.setString.insert(\"10\") }\n        observeSetChange(obs, \"setBinary\") { obj.setBinary.insert(data) }\n        observeSetChange(obs, \"setDate\") { obj.setDate.insert(date) }\n        observeSetChange(obs, \"setDecimal\") { obj.setDecimal.insert(decimal) }\n        observeSetChange(obs, \"setObjectId\") { obj.setObjectId.insert(objectId) }\n        observeSetChange(obs, \"setAny\") { obj.setAny.insert(.string(\"a\")) }\n        observeSetChange(obs, \"setUuid\") { obj.setUuid.insert(uuid) }\n\n        observeSetChange(obs, \"setOptBool\") { obj.setOptBool.insert(true) }\n        observeSetChange(obs, \"setOptInt\") { obj.setOptInt.insert(10) }\n        observeSetChange(obs, \"setOptInt8\") { obj.setOptInt8.insert(10) }\n        observeSetChange(obs, \"setOptInt16\") { obj.setOptInt16.insert(10) }\n        observeSetChange(obs, \"setOptInt32\") { obj.setOptInt32.insert(10) }\n        observeSetChange(obs, \"setOptInt64\") { obj.setOptInt64.insert(10) }\n        observeSetChange(obs, \"setOptFloat\") { obj.setOptFloat.insert(10.0) }\n        observeSetChange(obs, \"setOptDouble\") { obj.setOptDouble.insert(10.0) }\n        observeSetChange(obs, \"setOptString\") { obj.setOptString.insert(\"10\") }\n        observeSetChange(obs, \"setOptBinary\") { obj.setOptBinary.insert(data) }\n        observeSetChange(obs, \"setOptDate\") { obj.setOptDate.insert(date) }\n        observeSetChange(obs, \"setOptDecimal\") { obj.setOptDecimal.insert(decimal) }\n        observeSetChange(obs, \"setOptObjectId\") { obj.setOptObjectId.insert(objectId) }\n        observeSetChange(obs, \"setOptUuid\") { obj.setOptUuid.insert(uuid) }\n\n        observeSetChange(obs, \"setOptBool\") { obj.setOptBool.insert(nil) }\n        observeSetChange(obs, \"setOptInt\") { obj.setOptInt.insert(nil) }\n        observeSetChange(obs, \"setOptInt8\") { obj.setOptInt8.insert(nil) }\n        observeSetChange(obs, \"setOptInt16\") { obj.setOptInt16.insert(nil) }\n        observeSetChange(obs, \"setOptInt32\") { obj.setOptInt32.insert(nil) }\n        observeSetChange(obs, \"setOptInt64\") { obj.setOptInt64.insert(nil) }\n        observeSetChange(obs, \"setOptFloat\") { obj.setOptFloat.insert(nil) }\n        observeSetChange(obs, \"setOptDouble\") { obj.setOptDouble.insert(nil) }\n        observeSetChange(obs, \"setOptString\") { obj.setOptString.insert(nil) }\n        observeSetChange(obs, \"setOptBinary\") { obj.setOptBinary.insert(nil) }\n        observeSetChange(obs, \"setOptDate\") { obj.setOptDate.insert(nil) }\n        observeSetChange(obs, \"setOptDecimal\") { obj.setOptDecimal.insert(nil) }\n        observeSetChange(obs, \"setOptObjectId\") { obj.setOptObjectId.insert(nil) }\n        observeSetChange(obs, \"setOptUuid\") { obj.setOptUuid.insert(nil) }\n\n        // insert objectsIn\n        observeSetChange(obs, \"setBool\") { obj.setBool.insert(objectsIn: [true]) }\n        observeSetChange(obs, \"setInt\") { obj.setInt.insert(objectsIn: [10]) }\n        observeSetChange(obs, \"setInt8\") { obj.setInt8.insert(objectsIn: [10]) }\n        observeSetChange(obs, \"setInt16\") { obj.setInt16.insert(objectsIn: [10]) }\n        observeSetChange(obs, \"setInt32\") { obj.setInt32.insert(objectsIn: [10]) }\n        observeSetChange(obs, \"setInt64\") { obj.setInt64.insert(objectsIn: [10]) }\n        observeSetChange(obs, \"setFloat\") { obj.setFloat.insert(objectsIn: [10.0]) }\n        observeSetChange(obs, \"setDouble\") { obj.setDouble.insert(objectsIn: [10.0]) }\n        observeSetChange(obs, \"setString\") { obj.setString.insert(objectsIn: [\"10\"]) }\n        observeSetChange(obs, \"setBinary\") { obj.setBinary.insert(objectsIn: [data]) }\n        observeSetChange(obs, \"setDate\") { obj.setDate.insert(objectsIn: [date]) }\n        observeSetChange(obs, \"setDecimal\") { obj.setDecimal.insert(objectsIn: [decimal]) }\n        observeSetChange(obs, \"setObjectId\") { obj.setObjectId.insert(objectsIn: [objectId]) }\n        observeSetChange(obs, \"setAny\") { obj.setAny.insert(objectsIn: [.string(\"a\")]) }\n        observeSetChange(obs, \"setUuid\") { obj.setUuid.insert(objectsIn: [uuid]) }\n\n        observeSetChange(obs, \"setOptBool\") { obj.setOptBool.insert(objectsIn: [true, nil]) }\n        observeSetChange(obs, \"setOptInt\") { obj.setOptInt.insert(objectsIn: [10, nil]) }\n        observeSetChange(obs, \"setOptInt8\") { obj.setOptInt8.insert(objectsIn: [10, nil]) }\n        observeSetChange(obs, \"setOptInt16\") { obj.setOptInt16.insert(objectsIn: [10, nil]) }\n        observeSetChange(obs, \"setOptInt32\") { obj.setOptInt32.insert(objectsIn: [10, nil]) }\n        observeSetChange(obs, \"setOptInt64\") { obj.setOptInt64.insert(objectsIn: [10, nil]) }\n        observeSetChange(obs, \"setOptFloat\") { obj.setOptFloat.insert(objectsIn: [10.0, nil]) }\n        observeSetChange(obs, \"setOptDouble\") { obj.setOptDouble.insert(objectsIn: [10.0, nil]) }\n        observeSetChange(obs, \"setOptString\") { obj.setOptString.insert(objectsIn: [\"10\", nil]) }\n        observeSetChange(obs, \"setOptBinary\") { obj.setOptBinary.insert(objectsIn: [data, nil]) }\n        observeSetChange(obs, \"setOptDate\") { obj.setOptDate.insert(objectsIn: [date, nil]) }\n        observeSetChange(obs, \"setOptDecimal\") { obj.setOptDecimal.insert(objectsIn: [decimal, nil]) }\n        observeSetChange(obs, \"setOptObjectId\") { obj.setOptObjectId.insert(objectsIn: [objectId, nil]) }\n        observeSetChange(obs, \"setOptUuid\") { obj.setOptUuid.insert(objectsIn: [uuid, nil]) }\n\n        // delete\n        observeSetChange(obs, \"setBool\") { obj.setBool.remove(true) }\n        observeSetChange(obs, \"setInt\") { obj.setInt.remove(10) }\n        observeSetChange(obs, \"setInt8\") { obj.setInt8.remove(10) }\n        observeSetChange(obs, \"setInt16\") { obj.setInt16.remove(10) }\n        observeSetChange(obs, \"setInt32\") { obj.setInt32.remove(10) }\n        observeSetChange(obs, \"setInt64\") { obj.setInt64.remove(10) }\n        observeSetChange(obs, \"setFloat\") { obj.setFloat.remove(10.0) }\n        observeSetChange(obs, \"setDouble\") { obj.setDouble.remove(10.0) }\n        observeSetChange(obs, \"setString\") { obj.setString.remove(\"10\") }\n        observeSetChange(obs, \"setBinary\") { obj.setBinary.remove(data) }\n        observeSetChange(obs, \"setDate\") { obj.setDate.remove(date) }\n        observeSetChange(obs, \"setDecimal\") { obj.setDecimal.remove(decimal) }\n        observeSetChange(obs, \"setObjectId\") { obj.setObjectId.remove(objectId) }\n        observeSetChange(obs, \"setAny\") { obj.setAny.remove(.string(\"a\")) }\n        observeSetChange(obs, \"setUuid\") { obj.setUuid.remove(uuid) }\n\n        observeSetChange(obs, \"setOptBool\") { obj.setOptBool.remove(true) }\n        observeSetChange(obs, \"setOptInt\") { obj.setOptInt.remove(10) }\n        observeSetChange(obs, \"setOptInt8\") { obj.setOptInt8.remove(10) }\n        observeSetChange(obs, \"setOptInt16\") { obj.setOptInt16.remove(10) }\n        observeSetChange(obs, \"setOptInt32\") { obj.setOptInt32.remove(10) }\n        observeSetChange(obs, \"setOptInt64\") { obj.setOptInt64.remove(10) }\n        observeSetChange(obs, \"setOptFloat\") { obj.setOptFloat.remove(10.0) }\n        observeSetChange(obs, \"setOptDouble\") { obj.setOptDouble.remove(10.0) }\n        observeSetChange(obs, \"setOptString\") { obj.setOptString.remove(\"10\") }\n        observeSetChange(obs, \"setOptBinary\") { obj.setOptBinary.remove(data) }\n        observeSetChange(obs, \"setOptDate\") { obj.setOptDate.remove(date) }\n        observeSetChange(obs, \"setOptDecimal\") { obj.setOptDecimal.remove(decimal) }\n        observeSetChange(obs, \"setOptObjectId\") { obj.setOptObjectId.remove(objectId) }\n        observeSetChange(obs, \"setOptUuid\") { obj.setOptUuid.remove(uuid) }\n\n        observeSetChange(obs, \"setOptBool\") { obj.setOptBool.remove(nil) }\n        observeSetChange(obs, \"setOptInt\") { obj.setOptInt.remove(nil) }\n        observeSetChange(obs, \"setOptInt8\") { obj.setOptInt8.remove(nil) }\n        observeSetChange(obs, \"setOptInt16\") { obj.setOptInt16.remove(nil) }\n        observeSetChange(obs, \"setOptInt32\") { obj.setOptInt32.remove(nil) }\n        observeSetChange(obs, \"setOptInt64\") { obj.setOptInt64.remove(nil) }\n        observeSetChange(obs, \"setOptFloat\") { obj.setOptFloat.remove(nil) }\n        observeSetChange(obs, \"setOptDouble\") { obj.setOptDouble.remove(nil) }\n        observeSetChange(obs, \"setOptString\") { obj.setOptString.remove(nil) }\n        observeSetChange(obs, \"setOptDate\") { obj.setOptDate.remove(nil) }\n        observeSetChange(obs, \"setOptBinary\") { obj.setOptBinary.remove(nil) }\n        observeSetChange(obs, \"setOptDecimal\") { obj.setOptDecimal.remove(nil) }\n        observeSetChange(obs, \"setOptObjectId\") { obj.setOptObjectId.remove(nil) }\n        observeSetChange(obs, \"setOptUuid\") { obj.setOptUuid.remove(nil) }\n        // delete all\n        observeSetChange(obs, \"setBool\") { obj.setBool.removeAll() }\n        observeSetChange(obs, \"setInt\") { obj.setInt.removeAll() }\n        observeSetChange(obs, \"setInt8\") { obj.setInt8.removeAll() }\n        observeSetChange(obs, \"setInt16\") { obj.setInt16.removeAll() }\n        observeSetChange(obs, \"setInt32\") { obj.setInt32.removeAll() }\n        observeSetChange(obs, \"setInt64\") { obj.setInt64.removeAll() }\n        observeSetChange(obs, \"setFloat\") { obj.setFloat.removeAll() }\n        observeSetChange(obs, \"setDouble\") { obj.setDouble.removeAll() }\n        observeSetChange(obs, \"setString\") { obj.setString.removeAll() }\n        observeSetChange(obs, \"setBinary\") { obj.setBinary.removeAll() }\n        observeSetChange(obs, \"setDate\") { obj.setDate.removeAll() }\n        observeSetChange(obs, \"setDecimal\") { obj.setDecimal.removeAll() }\n        observeSetChange(obs, \"setObjectId\") { obj.setObjectId.removeAll() }\n        observeSetChange(obs, \"setAny\") { obj.setAny.removeAll() }\n        observeSetChange(obs, \"setUuid\") { obj.setUuid.removeAll() }\n\n        observeSetChange(obs, \"setOptBool\") { obj.setOptBool.removeAll() }\n        observeSetChange(obs, \"setOptInt\") { obj.setOptInt.removeAll() }\n        observeSetChange(obs, \"setOptInt8\") { obj.setOptInt8.removeAll() }\n        observeSetChange(obs, \"setOptInt16\") { obj.setOptInt16.removeAll() }\n        observeSetChange(obs, \"setOptInt32\") { obj.setOptInt32.removeAll() }\n        observeSetChange(obs, \"setOptInt64\") { obj.setOptInt64.removeAll() }\n        observeSetChange(obs, \"setOptFloat\") { obj.setOptFloat.removeAll() }\n        observeSetChange(obs, \"setOptDouble\") { obj.setOptDouble.removeAll() }\n        observeSetChange(obs, \"setOptString\") { obj.setOptString.removeAll() }\n        observeSetChange(obs, \"setOptBinary\") { obj.setOptBinary.removeAll() }\n        observeSetChange(obs, \"setOptDate\") { obj.setOptDate.removeAll() }\n        observeSetChange(obs, \"setOptDecimal\") { obj.setOptDecimal.removeAll() }\n        observeSetChange(obs, \"setOptObjectId\") { obj.setOptObjectId.removeAll() }\n        observeSetChange(obs, \"setOptUuid\") { obj.setOptUuid.removeAll() }\n\n        observeSetChange(obs, \"mapBool\") { obj.mapBool[\"key\"] = true }\n        observeSetChange(obs, \"mapInt\") { obj.mapInt[\"key\"] = 10 }\n        observeSetChange(obs, \"mapInt8\") { obj.mapInt8[\"key\"] = 10 }\n        observeSetChange(obs, \"mapInt16\") { obj.mapInt16[\"key\"] = 10 }\n        observeSetChange(obs, \"mapInt32\") { obj.mapInt32[\"key\"] = 10 }\n        observeSetChange(obs, \"mapInt64\") { obj.mapInt64[\"key\"] = 10 }\n        observeSetChange(obs, \"mapFloat\") { obj.mapFloat[\"key\"] = 10.0 }\n        observeSetChange(obs, \"mapDouble\") { obj.mapDouble[\"key\"] = 10.0 }\n        observeSetChange(obs, \"mapString\") { obj.mapString[\"key\"] = \"10\" }\n        observeSetChange(obs, \"mapBinary\") { obj.mapBinary[\"key\"] = data }\n        observeSetChange(obs, \"mapDate\") { obj.mapDate[\"key\"] = date }\n        observeSetChange(obs, \"mapDecimal\") { obj.mapDecimal[\"key\"] = decimal }\n        observeSetChange(obs, \"mapObjectId\") { obj.mapObjectId[\"key\"] = objectId }\n        observeSetChange(obs, \"mapAny\") { obj.mapAny[\"key\"] = .string(\"a\") }\n        observeSetChange(obs, \"mapUuid\") { obj.mapUuid[\"key\"] = uuid }\n\n        observeSetChange(obs, \"mapOptBool\") { obj.mapOptBool[\"key\"] = true }\n        observeSetChange(obs, \"mapOptInt\") { obj.mapOptInt[\"key\"] = 10 }\n        observeSetChange(obs, \"mapOptInt8\") { obj.mapOptInt8[\"key\"] = 10 }\n        observeSetChange(obs, \"mapOptInt16\") { obj.mapOptInt16[\"key\"] = 10 }\n        observeSetChange(obs, \"mapOptInt32\") { obj.mapOptInt32[\"key\"] = 10 }\n        observeSetChange(obs, \"mapOptInt64\") { obj.mapOptInt64[\"key\"] = 10 }\n        observeSetChange(obs, \"mapOptFloat\") { obj.mapOptFloat[\"key\"] = 10.0 }\n        observeSetChange(obs, \"mapOptDouble\") { obj.mapOptDouble[\"key\"] = 10.0 }\n        observeSetChange(obs, \"mapOptString\") { obj.mapOptString[\"key\"] = \"10\" }\n        observeSetChange(obs, \"mapOptBinary\") { obj.mapOptBinary[\"key\"] = data }\n        observeSetChange(obs, \"mapOptDate\") { obj.mapOptDate[\"key\"] = date }\n        observeSetChange(obs, \"mapOptDecimal\") { obj.mapOptDecimal[\"key\"] = decimal }\n        observeSetChange(obs, \"mapOptObjectId\") { obj.mapOptObjectId[\"key\"] = objectId }\n        observeSetChange(obs, \"mapOptUuid\") { obj.mapOptUuid[\"key\"] = uuid }\n\n        observeSetChange(obs, \"mapBool\") { obj.mapBool[\"key\"] = nil }\n        observeSetChange(obs, \"mapInt\") { obj.mapInt[\"key\"] = nil }\n        observeSetChange(obs, \"mapInt8\") { obj.mapInt8[\"key\"] = nil }\n        observeSetChange(obs, \"mapInt16\") { obj.mapInt16[\"key\"] = nil }\n        observeSetChange(obs, \"mapInt32\") { obj.mapInt32[\"key\"] = nil }\n        observeSetChange(obs, \"mapInt64\") { obj.mapInt64[\"key\"] = nil }\n        observeSetChange(obs, \"mapFloat\") { obj.mapFloat[\"key\"] = nil }\n        observeSetChange(obs, \"mapDouble\") { obj.mapDouble[\"key\"] = nil }\n        observeSetChange(obs, \"mapString\") { obj.mapString[\"key\"] = nil }\n        observeSetChange(obs, \"mapBinary\") { obj.mapBinary[\"key\"] = nil }\n        observeSetChange(obs, \"mapDate\") { obj.mapDate[\"key\"] = nil }\n        observeSetChange(obs, \"mapDecimal\") { obj.mapDecimal[\"key\"] = nil }\n        observeSetChange(obs, \"mapObjectId\") { obj.mapObjectId[\"key\"] = nil }\n        observeSetChange(obs, \"mapAny\") { obj.mapAny[\"key\"] = nil }\n        observeSetChange(obs, \"mapUuid\") { obj.mapUuid[\"key\"] = nil }\n\n        observeSetChange(obs, \"mapOptBool\") { obj.mapOptBool[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptInt\") { obj.mapOptInt[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptInt8\") { obj.mapOptInt8[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptInt16\") { obj.mapOptInt16[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptInt32\") { obj.mapOptInt32[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptInt64\") { obj.mapOptInt64[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptFloat\") { obj.mapOptFloat[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptDouble\") { obj.mapOptDouble[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptString\") { obj.mapOptString[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptBinary\") { obj.mapOptBinary[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptDate\") { obj.mapOptDate[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptDecimal\") { obj.mapOptDecimal[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptObjectId\") { obj.mapOptObjectId[\"key\"] = nil }\n        observeSetChange(obs, \"mapOptUuid\") { obj.mapOptUuid[\"key\"] = nil }\n\n        observeSetChange(obs, \"mapOptBool\") { obj.mapOptBool.removeObject(for: \"key\") }\n        observeSetChange(obs, \"mapOptInt\") { obj.mapOptInt.removeObject(for: \"key\") }\n        observeSetChange(obs, \"mapOptInt8\") { obj.mapOptInt8.removeObject(for: \"key\") }\n        observeSetChange(obs, \"mapOptInt16\") { obj.mapOptInt16.removeObject(for: \"key\") }\n        observeSetChange(obs, \"mapOptInt32\") { obj.mapOptInt32.removeObject(for: \"key\") }\n        observeSetChange(obs, \"mapOptInt64\") { obj.mapOptInt64.removeObject(for: \"key\") }\n        observeSetChange(obs, \"mapOptFloat\") { obj.mapOptFloat.removeObject(for: \"key\") }\n        observeSetChange(obs, \"mapOptDouble\") { obj.mapOptDouble.removeObject(for: \"key\") }\n        observeSetChange(obs, \"mapOptString\") { obj.mapOptString.removeObject(for: \"key\") }\n        observeSetChange(obs, \"mapOptBinary\") { obj.mapOptBinary.removeObject(for: \"key\") }\n        observeSetChange(obs, \"mapOptDate\") { obj.mapOptDate.removeObject(for: \"key\") }\n        observeSetChange(obs, \"mapOptDecimal\") { obj.mapOptDecimal.removeObject(for: \"key\") }\n        observeSetChange(obs, \"mapOptObjectId\") { obj.mapOptObjectId.removeObject(for: \"key\") }\n        observeSetChange(obs, \"mapOptUuid\") { obj.mapOptUuid.removeObject(for: \"key\") }\n    }\n\n    @MainActor\n    func testObserveOnActor() async throws {\n        let projection = simpleProjection()\n        let ex = expectation(description: \"got change\")\n        ex.expectedFulfillmentCount = 2\n        let block = { @Sendable (_: isolated CustomGlobalActor, change: ObjectChange<SimpleProjection>) in\n            guard case let .change(_, properties) = change else {\n                return XCTFail(\"expected .change but got \\(change)\")\n            }\n            guard properties.count == 1 else {\n                return XCTFail(\"expected one property but got \\(properties)\")\n            }\n            let prop = properties[0]\n            XCTAssertEqual(prop.name, \"int\")\n            XCTAssertEqual(prop.oldValue as? Int, 0)\n            XCTAssertEqual(prop.newValue as? Int, 1)\n            ex.fulfill()\n        }\n        let tokens = await [\n            projection.observe(keyPaths: [\"int\"], on: CustomGlobalActor.shared, block),\n            projection.observe(keyPaths: [\\.int], on: CustomGlobalActor.shared, block)\n        ]\n\n        // should not produce notification\n        try projection.realm!.write {\n            projection.rootObject.bool = true\n        }\n        try projection.realm!.write {\n            projection.int = 1\n        }\n        await fulfillment(of: [ex])\n        tokens.forEach { $0.invalidate() }\n    }\n\n    // MARK: Frozen Objects\n\n    func simpleProjection() -> SimpleProjection {\n        let realm = realmWithTestPath()\n        var obj: SimpleObject!\n        try! realm.write {\n            obj = realm.create(SimpleObject.self)\n        }\n        return SimpleProjection(projecting: obj)\n    }\n\n    func testIsFrozen() {\n        let projection = simpleProjection()\n        let frozen = projection.freeze()\n        XCTAssertFalse(projection.isFrozen)\n        XCTAssertTrue(frozen.isFrozen)\n    }\n\n    func testFreezingFrozenObjectReturnsSelf() {\n        let projection = simpleProjection()\n        let frozen = projection.freeze()\n        XCTAssertNotEqual(projection, frozen)\n        XCTAssertFalse(projection.freeze() === frozen)\n        XCTAssertEqual(frozen, frozen.freeze())\n    }\n\n    func testFreezingDeletedObject() {\n        let projection = simpleProjection()\n        let object = projection.rootObject\n        try! projection.realm!.write({\n            projection.realm!.delete(object)\n        })\n        assertThrows(projection.freeze(), \"Object has been deleted or invalidated.\")\n    }\n\n    func testFreezeFromWrongThread() {\n        nonisolated(unsafe) let projection = simpleProjection()\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            unsafeSelf.assertThrows(projection.freeze(), \"Realm accessed from incorrect thread\")\n        }\n    }\n\n    func testAccessFrozenObjectFromDifferentThread() {\n        let projection = simpleProjection()\n        nonisolated(unsafe) let frozen = projection.freeze()\n        dispatchSyncNewThread {\n            XCTAssertEqual(frozen.int, 0)\n        }\n    }\n\n    func testMutateFrozenObject() {\n        let projection = simpleProjection()\n        let frozen = projection.freeze()\n        XCTAssertTrue(frozen.isFrozen)\n        assertThrows(try! frozen.realm!.write { }, \"Can't perform transactions on a frozen Realm\")\n    }\n\n    func testObserveFrozenObject() {\n        let frozen = simpleProjection().freeze()\n        assertThrows(frozen.observe { _ in }, \"Frozen Realms do not change and do not have change notifications.\")\n    }\n\n    func testFrozenObjectEquality() {\n        let projectionA = simpleProjection()\n        let frozenA1 = projectionA.freeze()\n        let frozenA2 = projectionA.freeze()\n        XCTAssertEqual(frozenA1, frozenA2)\n        let projectionB = simpleProjection()\n        let frozenB = projectionB.freeze()\n        XCTAssertNotEqual(frozenA1, frozenB)\n    }\n\n    func testFreezeInsideWriteTransaction() {\n        let realm = realmWithTestPath()\n        var object: SimpleObject!\n        var projection: SimpleProjection!\n        try! realm.write {\n            object = realm.create(SimpleObject.self)\n            projection = SimpleProjection(projecting: object)\n            self.assertThrows(projection.freeze(), \"Cannot freeze an object in the same write transaction as it was created in.\")\n        }\n        try! realm.write {\n            object.int = 2\n            // Frozen objects have the value of the object at the start of the transaction\n            XCTAssertEqual(projection.freeze().int, 0)\n        }\n    }\n\n    func testThaw() {\n        let frozen = simpleProjection().freeze()\n        XCTAssertTrue(frozen.isFrozen)\n        let live = frozen.thaw()!\n        XCTAssertFalse(live.isFrozen)\n        try! live.realm!.write {\n            live.int = 2\n        }\n        XCTAssertNotEqual(live.int, frozen.int)\n    }\n\n    func testThawDeleted() {\n        let projection = simpleProjection()\n        let frozen = projection.freeze()\n        let realm = realmWithTestPath()\n\n        XCTAssertTrue(frozen.isFrozen)\n        try! realm.write {\n            realm.deleteAll()\n        }\n        let thawed = frozen.thaw()\n        XCTAssertNil(thawed, \"Thaw should return nil when object was deleted\")\n    }\n\n    func testThawPreviousVersion() {\n        let projection = simpleProjection()\n        let frozen = projection.freeze()\n\n        XCTAssertTrue(frozen.isFrozen)\n        XCTAssertEqual(projection.int, frozen.int)\n        try! projection.realm!.write {\n            projection.int = 1\n        }\n        XCTAssertNotEqual(projection.int, frozen.int, \"Frozen object shouldn't mutate\")\n\n        let thawed = frozen.thaw()!\n        XCTAssertFalse(thawed.isFrozen)\n        XCTAssertEqual(thawed.int, projection.int, \"Thawed object should reflect transactions since the original reference was frozen.\")\n    }\n\n    func testThawUpdatedOnDifferentThread() {\n        let realm = realmWithTestPath()\n        let projection = simpleProjection()\n        let tsr = ThreadSafeReference(to: projection)\n        nonisolated(unsafe) var frozen: SimpleProjection!\n\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            let realm = unsafeSelf.realmWithTestPath()\n            let resolvedProjection: SimpleProjection = realm.resolve(tsr)!\n            try! realm.write {\n                resolvedProjection.int = 1\n            }\n            frozen = resolvedProjection.freeze()\n        }\n\n        let thawed = frozen.thaw()!\n        XCTAssertEqual(thawed.int, 0, \"Thaw shouldn't reflect background transactions until main thread realm is refreshed\")\n        realm.refresh()\n        XCTAssertEqual(thawed.int, 1)\n    }\n\n    func testThawCreatedOnDifferentThread() {\n        let realm = realmWithTestPath()\n        XCTAssertEqual(realm.objects(SimpleProjection.self).count, 0)\n        nonisolated(unsafe) var frozen: SimpleProjection!\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            let projection = unsafeSelf.simpleProjection()\n            frozen = projection.freeze()\n        }\n        XCTAssertNil(frozen.thaw())\n        XCTAssertEqual(realm.objects(SimpleProjection.self).count, 0)\n        realm.refresh()\n        XCTAssertEqual(realm.objects(SimpleProjection.self).count, 1)\n    }\n\n    @MainActor\n    func testObserveComputedChange() throws {\n        let realm = populatedRealm()\n        let johnProjection = realm.objects(PersonProjection.self).first!\n\n        XCTAssertEqual(johnProjection.lastNameCaps, \"SNOW\")\n\n        let ex = expectation(description: \"values will be observed\")\n        let token = johnProjection.observe(keyPaths: [\\PersonProjection.lastNameCaps]) { chg in\n            if case let .change(_, change) = chg {\n                ex.fulfill()\n                guard let value = change.first else {\n                    XCTFail(\"Change should contain PropertyChange\")\n                    return\n                }\n                XCTAssertEqual(value.name, \"lastNameCaps\")\n                XCTAssertEqual(value.oldValue as? String, \"SNOW\")\n                XCTAssertEqual(value.newValue as? String, \"ALI\")\n            }\n        }\n\n        // Wait for the notifier to be registered before we do the write\n        realm.refresh()\n\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread { @Sendable in\n            let realm = unsafeSelf.realmWithTestPath()\n            let johnObject = realm.objects(CommonPerson.self).filter(\"lastName == 'Snow'\").first!\n            try! realm.write {\n                johnObject.lastName = \"Ali\"\n            }\n        }\n\n        waitForExpectations(timeout: 2)\n        token.invalidate()\n    }\n\n    func testObserveMultipleProjectionsFromOneProperty() {\n        let realm = realmWithTestPath()\n        try! realm.write {\n            realm.create(SimpleObject.self, value: [1, false])\n        }\n        let projection = realm.objects(MultipleProjectionsFromOneProperty.self).first!\n\n        let ex = expectation(description: \"values will be observed\")\n        let token = projection.observe { c in\n            if case let .change(_, change) = c {\n                ex.fulfill()\n                XCTAssertEqual(change.count, 3)\n                for (i, prop) in change.enumerated() {\n                    XCTAssertEqual(prop.name, \"int\\(i + 1)\")\n                    XCTAssertEqual(prop.oldValue as? Int, 1)\n                    XCTAssertEqual(prop.newValue as? Int, 2)\n                }\n            }\n        }\n\n        try! realm.write {}\n\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            let realm = unsafeSelf.realmWithTestPath()\n            try! realm.write {\n                realm.objects(SimpleObject.self).first!.int = 2\n            }\n        }\n        wait(for: [ex], timeout: 2.0)\n        token.invalidate()\n    }\n\n    func testFailedProjection() {\n        let realm = populatedRealm()\n        XCTAssertGreaterThan(realm.objects(FailedProjection.self).count, 0)\n        assertThrows(realm.objects(FailedProjection.self).first, reason: \"@Projected property\")\n    }\n\n    func testAdvancedProjection() throws {\n        let realm = populatedRealm()\n        let proj = realm.objects(AdvancedProjection.self).first!\n\n        XCTAssertEqual(proj.arrayLen, 3)\n        XCTAssertTrue(proj.projectedArray.elementsEqual([\"1 - true\", \"2 - false\"]), \"'\\(proj.projectedArray)' should be equal to '[\\\"1 - true\\\", \\\"2 - false\\\"]'\")\n        XCTAssertTrue(proj.renamedArray.elementsEqual([1, 2, 3]))\n        XCTAssertEqual(proj.firstElement, 1)\n        XCTAssertTrue(proj.projectedSet.elementsEqual([true, false]), \"'\\(proj.projectedArray)' should be equal to '[true, false]'\")\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/PropertyTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\nclass PropertyTests: TestCase {\n    var primitiveProperty: Property!\n    var linkProperty: Property!\n    var primaryProperty: Property!\n    var optionalProperty: Property!\n\n    override func setUp() {\n        super.setUp()\n        autoreleasepool {\n            let schema = try! Realm().schema\n            self.primitiveProperty = schema[\"SwiftObject\"]![\"intCol\"]!\n            self.linkProperty = schema[\"SwiftOptionalObject\"]![\"optObjectCol\"]!\n            self.primaryProperty = schema[\"SwiftPrimaryStringObject\"]![\"stringCol\"]!\n            self.optionalProperty = schema[\"SwiftOptionalObject\"]![\"optObjectCol\"]!\n        }\n    }\n\n    func testName() {\n        XCTAssertEqual(primitiveProperty.name, \"intCol\")\n        XCTAssertEqual(linkProperty.name, \"optObjectCol\")\n        XCTAssertEqual(primaryProperty.name, \"stringCol\")\n    }\n\n    func testType() {\n        XCTAssertEqual(primitiveProperty.type, PropertyType.int)\n        XCTAssertEqual(linkProperty.type, PropertyType.object)\n        XCTAssertEqual(primaryProperty.type, PropertyType.string)\n    }\n\n    func testIndexed() {\n        XCTAssertFalse(primitiveProperty.isIndexed)\n        XCTAssertFalse(linkProperty.isIndexed)\n        XCTAssertTrue(primaryProperty.isIndexed)\n    }\n\n    func testOptional() {\n        XCTAssertFalse(primitiveProperty.isOptional)\n        XCTAssertTrue(optionalProperty.isOptional)\n    }\n\n    func testObjectClassName() {\n        XCTAssertNil(primitiveProperty.objectClassName)\n        XCTAssertEqual(linkProperty.objectClassName!, \"SwiftBoolObject\")\n        XCTAssertNil(primaryProperty.objectClassName)\n    }\n\n    func testEquals() {\n        XCTAssert(try! primitiveProperty == Realm().schema[\"SwiftObject\"]![\"intCol\"]!)\n        XCTAssert(primitiveProperty != linkProperty)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/QueryTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"(AS IS)\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\n// This file is generated from a template. Do not edit directly.\n// swiftlint:disable large_tuple vertical_parameter_alignment\n\nclass QueryTests: TestCase {\n    private var realm: Realm!\n\n    // MARK: Test data population\n\n    private func objects() -> Results<ModernAllTypesObject> {\n        realm.objects(ModernAllTypesObject.self)\n    }\n\n    private func getOrCreate<T: Object>(_ type: T.Type) -> T {\n        if let object = realm.objects(T.self).first {\n            return object\n        }\n        let object = T()\n        try! realm.write {\n            realm.add(object)\n        }\n        return object\n    }\n\n    private func collectionObject() -> ModernCollectionObject {\n        return getOrCreate(ModernCollectionObject.self)\n    }\n\n    private func setAnyRealmValueCol(with value: AnyRealmValue, object: ModernAllTypesObject) {\n        try! realm.write {\n            object.anyCol = value\n        }\n    }\n\n    private var circleObject: ModernCircleObject {\n        return getOrCreate(ModernCircleObject.self)\n    }\n\n    override func setUp() {\n        realm = inMemoryRealm(\"QueryTests\")\n        try! realm.write {\n            let objCustomPersistableCollections = CustomPersistableCollections()\n            let objModernCollectionsOfEnums = ModernCollectionsOfEnums()\n            let objAllCustomPersistableTypes = AllCustomPersistableTypes()\n            let objModernAllTypesObject = ModernAllTypesObject()\n\n            objModernAllTypesObject.boolCol = false\n            objModernAllTypesObject.intCol = 3\n            objModernAllTypesObject.int8Col = Int8(9)\n            objModernAllTypesObject.int16Col = Int16(17)\n            objModernAllTypesObject.int32Col = Int32(33)\n            objModernAllTypesObject.int64Col = Int64(65)\n            objModernAllTypesObject.floatCol = Float(6.55444333)\n            objModernAllTypesObject.doubleCol = 234.567\n            objModernAllTypesObject.stringCol = \"Foó\"\n            objModernAllTypesObject.binaryCol = Data(count: 128)\n            objModernAllTypesObject.dateCol = Date(timeIntervalSince1970: 2000000)\n            objModernAllTypesObject.decimalCol = Decimal128(234.567)\n            objModernAllTypesObject.objectIdCol = ObjectId(\"61184062c1d8f096a3695045\")\n            objModernAllTypesObject.uuidCol = UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!\n            objModernAllTypesObject.intEnumCol = .value2\n            objModernAllTypesObject.stringEnumCol = .value2\n            objAllCustomPersistableTypes.bool = BoolWrapper(persistedValue: false)\n            objAllCustomPersistableTypes.int = IntWrapper(persistedValue: 3)\n            objAllCustomPersistableTypes.int8 = Int8Wrapper(persistedValue: Int8(9))\n            objAllCustomPersistableTypes.int16 = Int16Wrapper(persistedValue: Int16(17))\n            objAllCustomPersistableTypes.int32 = Int32Wrapper(persistedValue: Int32(33))\n            objAllCustomPersistableTypes.int64 = Int64Wrapper(persistedValue: Int64(65))\n            objAllCustomPersistableTypes.float = FloatWrapper(persistedValue: Float(6.55444333))\n            objAllCustomPersistableTypes.double = DoubleWrapper(persistedValue: 234.567)\n            objAllCustomPersistableTypes.string = StringWrapper(persistedValue: \"Foó\")\n            objAllCustomPersistableTypes.binary = DataWrapper(persistedValue: Data(count: 128))\n            objAllCustomPersistableTypes.date = DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))\n            objAllCustomPersistableTypes.decimal = Decimal128Wrapper(persistedValue: Decimal128(234.567))\n            objAllCustomPersistableTypes.objectId = ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))\n            objAllCustomPersistableTypes.uuid = UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)\n            objModernAllTypesObject.optBoolCol = false\n            objModernAllTypesObject.optIntCol = 3\n            objModernAllTypesObject.optInt8Col = Int8(9)\n            objModernAllTypesObject.optInt16Col = Int16(17)\n            objModernAllTypesObject.optInt32Col = Int32(33)\n            objModernAllTypesObject.optInt64Col = Int64(65)\n            objModernAllTypesObject.optFloatCol = Float(6.55444333)\n            objModernAllTypesObject.optDoubleCol = 234.567\n            objModernAllTypesObject.optStringCol = \"Foó\"\n            objModernAllTypesObject.optBinaryCol = Data(count: 128)\n            objModernAllTypesObject.optDateCol = Date(timeIntervalSince1970: 2000000)\n            objModernAllTypesObject.optDecimalCol = Decimal128(234.567)\n            objModernAllTypesObject.optObjectIdCol = ObjectId(\"61184062c1d8f096a3695045\")\n            objModernAllTypesObject.optUuidCol = UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!\n            objModernAllTypesObject.optIntEnumCol = .value2\n            objModernAllTypesObject.optStringEnumCol = .value2\n            objAllCustomPersistableTypes.optBool = BoolWrapper(persistedValue: false)\n            objAllCustomPersistableTypes.optInt = IntWrapper(persistedValue: 3)\n            objAllCustomPersistableTypes.optInt8 = Int8Wrapper(persistedValue: Int8(9))\n            objAllCustomPersistableTypes.optInt16 = Int16Wrapper(persistedValue: Int16(17))\n            objAllCustomPersistableTypes.optInt32 = Int32Wrapper(persistedValue: Int32(33))\n            objAllCustomPersistableTypes.optInt64 = Int64Wrapper(persistedValue: Int64(65))\n            objAllCustomPersistableTypes.optFloat = FloatWrapper(persistedValue: Float(6.55444333))\n            objAllCustomPersistableTypes.optDouble = DoubleWrapper(persistedValue: 234.567)\n            objAllCustomPersistableTypes.optString = StringWrapper(persistedValue: \"Foó\")\n            objAllCustomPersistableTypes.optBinary = DataWrapper(persistedValue: Data(count: 128))\n            objAllCustomPersistableTypes.optDate = DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))\n            objAllCustomPersistableTypes.optDecimal = Decimal128Wrapper(persistedValue: Decimal128(234.567))\n            objAllCustomPersistableTypes.optObjectId = ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))\n            objAllCustomPersistableTypes.optUuid = UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)\n\n            objModernAllTypesObject.arrayBool.append(objectsIn: [true, true])\n            objModernAllTypesObject.arrayInt.append(objectsIn: [1, 3])\n            objModernAllTypesObject.arrayInt8.append(objectsIn: [Int8(8), Int8(9)])\n            objModernAllTypesObject.arrayInt16.append(objectsIn: [Int16(16), Int16(17)])\n            objModernAllTypesObject.arrayInt32.append(objectsIn: [Int32(32), Int32(33)])\n            objModernAllTypesObject.arrayInt64.append(objectsIn: [Int64(64), Int64(65)])\n            objModernAllTypesObject.arrayFloat.append(objectsIn: [Float(5.55444333), Float(6.55444333)])\n            objModernAllTypesObject.arrayDouble.append(objectsIn: [123.456, 234.567])\n            objModernAllTypesObject.arrayString.append(objectsIn: [\"Foo\", \"Foó\"])\n            objModernAllTypesObject.arrayBinary.append(objectsIn: [Data(count: 64), Data(count: 128)])\n            objModernAllTypesObject.arrayDate.append(objectsIn: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])\n            objModernAllTypesObject.arrayDecimal.append(objectsIn: [Decimal128(123.456), Decimal128(234.567)])\n            objModernAllTypesObject.arrayObjectId.append(objectsIn: [ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])\n            objModernAllTypesObject.arrayUuid.append(objectsIn: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])\n            objModernAllTypesObject.arrayAny.append(objectsIn: [AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\")), AnyRealmValue.string(\"Hello\")])\n            objModernCollectionsOfEnums.listInt.append(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.listInt8.append(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.listInt16.append(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.listInt32.append(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.listInt64.append(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.listFloat.append(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.listDouble.append(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.listString.append(objectsIn: [.value1, .value2])\n            objCustomPersistableCollections.listBool.append(objectsIn: [BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: true)])\n            objCustomPersistableCollections.listInt.append(objectsIn: [IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])\n            objCustomPersistableCollections.listInt8.append(objectsIn: [Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])\n            objCustomPersistableCollections.listInt16.append(objectsIn: [Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])\n            objCustomPersistableCollections.listInt32.append(objectsIn: [Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])\n            objCustomPersistableCollections.listInt64.append(objectsIn: [Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])\n            objCustomPersistableCollections.listFloat.append(objectsIn: [FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])\n            objCustomPersistableCollections.listDouble.append(objectsIn: [DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])\n            objCustomPersistableCollections.listString.append(objectsIn: [StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])\n            objCustomPersistableCollections.listBinary.append(objectsIn: [DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])\n            objCustomPersistableCollections.listDate.append(objectsIn: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])\n            objCustomPersistableCollections.listDecimal.append(objectsIn: [Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])\n            objCustomPersistableCollections.listObjectId.append(objectsIn: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])\n            objCustomPersistableCollections.listUuid.append(objectsIn: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])\n            objModernAllTypesObject.arrayOptBool.append(objectsIn: [true, true])\n            objModernAllTypesObject.arrayOptInt.append(objectsIn: [1, 3])\n            objModernAllTypesObject.arrayOptInt8.append(objectsIn: [Int8(8), Int8(9)])\n            objModernAllTypesObject.arrayOptInt16.append(objectsIn: [Int16(16), Int16(17)])\n            objModernAllTypesObject.arrayOptInt32.append(objectsIn: [Int32(32), Int32(33)])\n            objModernAllTypesObject.arrayOptInt64.append(objectsIn: [Int64(64), Int64(65)])\n            objModernAllTypesObject.arrayOptFloat.append(objectsIn: [Float(5.55444333), Float(6.55444333)])\n            objModernAllTypesObject.arrayOptDouble.append(objectsIn: [123.456, 234.567])\n            objModernAllTypesObject.arrayOptString.append(objectsIn: [\"Foo\", \"Foó\"])\n            objModernAllTypesObject.arrayOptBinary.append(objectsIn: [Data(count: 64), Data(count: 128)])\n            objModernAllTypesObject.arrayOptDate.append(objectsIn: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])\n            objModernAllTypesObject.arrayOptDecimal.append(objectsIn: [Decimal128(123.456), Decimal128(234.567)])\n            objModernAllTypesObject.arrayOptObjectId.append(objectsIn: [ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])\n            objModernAllTypesObject.arrayOptUuid.append(objectsIn: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])\n            objModernCollectionsOfEnums.listIntOpt.append(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.listInt8Opt.append(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.listInt16Opt.append(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.listInt32Opt.append(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.listInt64Opt.append(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.listFloatOpt.append(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.listDoubleOpt.append(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.listStringOpt.append(objectsIn: [.value1, .value2])\n            objCustomPersistableCollections.listOptBool.append(objectsIn: [BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: true)])\n            objCustomPersistableCollections.listOptInt.append(objectsIn: [IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])\n            objCustomPersistableCollections.listOptInt8.append(objectsIn: [Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])\n            objCustomPersistableCollections.listOptInt16.append(objectsIn: [Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])\n            objCustomPersistableCollections.listOptInt32.append(objectsIn: [Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])\n            objCustomPersistableCollections.listOptInt64.append(objectsIn: [Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])\n            objCustomPersistableCollections.listOptFloat.append(objectsIn: [FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])\n            objCustomPersistableCollections.listOptDouble.append(objectsIn: [DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])\n            objCustomPersistableCollections.listOptString.append(objectsIn: [StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])\n            objCustomPersistableCollections.listOptBinary.append(objectsIn: [DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])\n            objCustomPersistableCollections.listOptDate.append(objectsIn: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])\n            objCustomPersistableCollections.listOptDecimal.append(objectsIn: [Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])\n            objCustomPersistableCollections.listOptObjectId.append(objectsIn: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])\n            objCustomPersistableCollections.listOptUuid.append(objectsIn: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])\n\n            objModernAllTypesObject.setBool.insert(objectsIn: [true, true])\n            objModernAllTypesObject.setInt.insert(objectsIn: [1, 3])\n            objModernAllTypesObject.setInt8.insert(objectsIn: [Int8(8), Int8(9)])\n            objModernAllTypesObject.setInt16.insert(objectsIn: [Int16(16), Int16(17)])\n            objModernAllTypesObject.setInt32.insert(objectsIn: [Int32(32), Int32(33)])\n            objModernAllTypesObject.setInt64.insert(objectsIn: [Int64(64), Int64(65)])\n            objModernAllTypesObject.setFloat.insert(objectsIn: [Float(5.55444333), Float(6.55444333)])\n            objModernAllTypesObject.setDouble.insert(objectsIn: [123.456, 234.567])\n            objModernAllTypesObject.setString.insert(objectsIn: [\"Foo\", \"Foó\"])\n            objModernAllTypesObject.setBinary.insert(objectsIn: [Data(count: 64), Data(count: 128)])\n            objModernAllTypesObject.setDate.insert(objectsIn: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])\n            objModernAllTypesObject.setDecimal.insert(objectsIn: [Decimal128(123.456), Decimal128(234.567)])\n            objModernAllTypesObject.setObjectId.insert(objectsIn: [ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])\n            objModernAllTypesObject.setUuid.insert(objectsIn: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])\n            objModernAllTypesObject.setAny.insert(objectsIn: [AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\")), AnyRealmValue.string(\"Hello\")])\n            objModernCollectionsOfEnums.setInt.insert(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.setInt8.insert(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.setInt16.insert(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.setInt32.insert(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.setInt64.insert(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.setFloat.insert(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.setDouble.insert(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.setString.insert(objectsIn: [.value1, .value2])\n            objCustomPersistableCollections.setBool.insert(objectsIn: [BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: true)])\n            objCustomPersistableCollections.setInt.insert(objectsIn: [IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])\n            objCustomPersistableCollections.setInt8.insert(objectsIn: [Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])\n            objCustomPersistableCollections.setInt16.insert(objectsIn: [Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])\n            objCustomPersistableCollections.setInt32.insert(objectsIn: [Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])\n            objCustomPersistableCollections.setInt64.insert(objectsIn: [Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])\n            objCustomPersistableCollections.setFloat.insert(objectsIn: [FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])\n            objCustomPersistableCollections.setDouble.insert(objectsIn: [DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])\n            objCustomPersistableCollections.setString.insert(objectsIn: [StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])\n            objCustomPersistableCollections.setBinary.insert(objectsIn: [DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])\n            objCustomPersistableCollections.setDate.insert(objectsIn: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])\n            objCustomPersistableCollections.setDecimal.insert(objectsIn: [Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])\n            objCustomPersistableCollections.setObjectId.insert(objectsIn: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])\n            objCustomPersistableCollections.setUuid.insert(objectsIn: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])\n            objModernAllTypesObject.setOptBool.insert(objectsIn: [true, true])\n            objModernAllTypesObject.setOptInt.insert(objectsIn: [1, 3])\n            objModernAllTypesObject.setOptInt8.insert(objectsIn: [Int8(8), Int8(9)])\n            objModernAllTypesObject.setOptInt16.insert(objectsIn: [Int16(16), Int16(17)])\n            objModernAllTypesObject.setOptInt32.insert(objectsIn: [Int32(32), Int32(33)])\n            objModernAllTypesObject.setOptInt64.insert(objectsIn: [Int64(64), Int64(65)])\n            objModernAllTypesObject.setOptFloat.insert(objectsIn: [Float(5.55444333), Float(6.55444333)])\n            objModernAllTypesObject.setOptDouble.insert(objectsIn: [123.456, 234.567])\n            objModernAllTypesObject.setOptString.insert(objectsIn: [\"Foo\", \"Foó\"])\n            objModernAllTypesObject.setOptBinary.insert(objectsIn: [Data(count: 64), Data(count: 128)])\n            objModernAllTypesObject.setOptDate.insert(objectsIn: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])\n            objModernAllTypesObject.setOptDecimal.insert(objectsIn: [Decimal128(123.456), Decimal128(234.567)])\n            objModernAllTypesObject.setOptObjectId.insert(objectsIn: [ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])\n            objModernAllTypesObject.setOptUuid.insert(objectsIn: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])\n            objModernCollectionsOfEnums.setIntOpt.insert(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.setInt8Opt.insert(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.setInt16Opt.insert(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.setInt32Opt.insert(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.setInt64Opt.insert(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.setFloatOpt.insert(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.setDoubleOpt.insert(objectsIn: [.value1, .value2])\n            objModernCollectionsOfEnums.setStringOpt.insert(objectsIn: [.value1, .value2])\n            objCustomPersistableCollections.setOptBool.insert(objectsIn: [BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: true)])\n            objCustomPersistableCollections.setOptInt.insert(objectsIn: [IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])\n            objCustomPersistableCollections.setOptInt8.insert(objectsIn: [Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])\n            objCustomPersistableCollections.setOptInt16.insert(objectsIn: [Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])\n            objCustomPersistableCollections.setOptInt32.insert(objectsIn: [Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])\n            objCustomPersistableCollections.setOptInt64.insert(objectsIn: [Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])\n            objCustomPersistableCollections.setOptFloat.insert(objectsIn: [FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])\n            objCustomPersistableCollections.setOptDouble.insert(objectsIn: [DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])\n            objCustomPersistableCollections.setOptString.insert(objectsIn: [StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])\n            objCustomPersistableCollections.setOptBinary.insert(objectsIn: [DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])\n            objCustomPersistableCollections.setOptDate.insert(objectsIn: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])\n            objCustomPersistableCollections.setOptDecimal.insert(objectsIn: [Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])\n            objCustomPersistableCollections.setOptObjectId.insert(objectsIn: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])\n            objCustomPersistableCollections.setOptUuid.insert(objectsIn: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])\n\n            objModernAllTypesObject.mapBool[\"foo\"] = true\n            objModernAllTypesObject.mapBool[\"bar\"] = true\n            objModernAllTypesObject.mapInt[\"foo\"] = 1\n            objModernAllTypesObject.mapInt[\"bar\"] = 3\n            objModernAllTypesObject.mapInt8[\"foo\"] = Int8(8)\n            objModernAllTypesObject.mapInt8[\"bar\"] = Int8(9)\n            objModernAllTypesObject.mapInt16[\"foo\"] = Int16(16)\n            objModernAllTypesObject.mapInt16[\"bar\"] = Int16(17)\n            objModernAllTypesObject.mapInt32[\"foo\"] = Int32(32)\n            objModernAllTypesObject.mapInt32[\"bar\"] = Int32(33)\n            objModernAllTypesObject.mapInt64[\"foo\"] = Int64(64)\n            objModernAllTypesObject.mapInt64[\"bar\"] = Int64(65)\n            objModernAllTypesObject.mapFloat[\"foo\"] = Float(5.55444333)\n            objModernAllTypesObject.mapFloat[\"bar\"] = Float(6.55444333)\n            objModernAllTypesObject.mapDouble[\"foo\"] = 123.456\n            objModernAllTypesObject.mapDouble[\"bar\"] = 234.567\n            objModernAllTypesObject.mapString[\"foo\"] = \"Foo\"\n            objModernAllTypesObject.mapString[\"bar\"] = \"Foó\"\n            objModernAllTypesObject.mapBinary[\"foo\"] = Data(count: 64)\n            objModernAllTypesObject.mapBinary[\"bar\"] = Data(count: 128)\n            objModernAllTypesObject.mapDate[\"foo\"] = Date(timeIntervalSince1970: 1000000)\n            objModernAllTypesObject.mapDate[\"bar\"] = Date(timeIntervalSince1970: 2000000)\n            objModernAllTypesObject.mapDecimal[\"foo\"] = Decimal128(123.456)\n            objModernAllTypesObject.mapDecimal[\"bar\"] = Decimal128(234.567)\n            objModernAllTypesObject.mapObjectId[\"foo\"] = ObjectId(\"61184062c1d8f096a3695046\")\n            objModernAllTypesObject.mapObjectId[\"bar\"] = ObjectId(\"61184062c1d8f096a3695045\")\n            objModernAllTypesObject.mapUuid[\"foo\"] = UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!\n            objModernAllTypesObject.mapUuid[\"bar\"] = UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!\n            objModernAllTypesObject.mapAny[\"foo\"] = AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\"))\n            objModernAllTypesObject.mapAny[\"bar\"] = AnyRealmValue.string(\"Hello\")\n            objModernCollectionsOfEnums.mapInt[\"foo\"] = .value1\n            objModernCollectionsOfEnums.mapInt[\"bar\"] = .value2\n            objModernCollectionsOfEnums.mapInt8[\"foo\"] = .value1\n            objModernCollectionsOfEnums.mapInt8[\"bar\"] = .value2\n            objModernCollectionsOfEnums.mapInt16[\"foo\"] = .value1\n            objModernCollectionsOfEnums.mapInt16[\"bar\"] = .value2\n            objModernCollectionsOfEnums.mapInt32[\"foo\"] = .value1\n            objModernCollectionsOfEnums.mapInt32[\"bar\"] = .value2\n            objModernCollectionsOfEnums.mapInt64[\"foo\"] = .value1\n            objModernCollectionsOfEnums.mapInt64[\"bar\"] = .value2\n            objModernCollectionsOfEnums.mapFloat[\"foo\"] = .value1\n            objModernCollectionsOfEnums.mapFloat[\"bar\"] = .value2\n            objModernCollectionsOfEnums.mapDouble[\"foo\"] = .value1\n            objModernCollectionsOfEnums.mapDouble[\"bar\"] = .value2\n            objModernCollectionsOfEnums.mapString[\"foo\"] = .value1\n            objModernCollectionsOfEnums.mapString[\"bar\"] = .value2\n            objCustomPersistableCollections.mapBool[\"foo\"] = BoolWrapper(persistedValue: true)\n            objCustomPersistableCollections.mapBool[\"bar\"] = BoolWrapper(persistedValue: true)\n            objCustomPersistableCollections.mapInt[\"foo\"] = IntWrapper(persistedValue: 1)\n            objCustomPersistableCollections.mapInt[\"bar\"] = IntWrapper(persistedValue: 3)\n            objCustomPersistableCollections.mapInt8[\"foo\"] = Int8Wrapper(persistedValue: Int8(8))\n            objCustomPersistableCollections.mapInt8[\"bar\"] = Int8Wrapper(persistedValue: Int8(9))\n            objCustomPersistableCollections.mapInt16[\"foo\"] = Int16Wrapper(persistedValue: Int16(16))\n            objCustomPersistableCollections.mapInt16[\"bar\"] = Int16Wrapper(persistedValue: Int16(17))\n            objCustomPersistableCollections.mapInt32[\"foo\"] = Int32Wrapper(persistedValue: Int32(32))\n            objCustomPersistableCollections.mapInt32[\"bar\"] = Int32Wrapper(persistedValue: Int32(33))\n            objCustomPersistableCollections.mapInt64[\"foo\"] = Int64Wrapper(persistedValue: Int64(64))\n            objCustomPersistableCollections.mapInt64[\"bar\"] = Int64Wrapper(persistedValue: Int64(65))\n            objCustomPersistableCollections.mapFloat[\"foo\"] = FloatWrapper(persistedValue: Float(5.55444333))\n            objCustomPersistableCollections.mapFloat[\"bar\"] = FloatWrapper(persistedValue: Float(6.55444333))\n            objCustomPersistableCollections.mapDouble[\"foo\"] = DoubleWrapper(persistedValue: 123.456)\n            objCustomPersistableCollections.mapDouble[\"bar\"] = DoubleWrapper(persistedValue: 234.567)\n            objCustomPersistableCollections.mapString[\"foo\"] = StringWrapper(persistedValue: \"Foo\")\n            objCustomPersistableCollections.mapString[\"bar\"] = StringWrapper(persistedValue: \"Foó\")\n            objCustomPersistableCollections.mapBinary[\"foo\"] = DataWrapper(persistedValue: Data(count: 64))\n            objCustomPersistableCollections.mapBinary[\"bar\"] = DataWrapper(persistedValue: Data(count: 128))\n            objCustomPersistableCollections.mapDate[\"foo\"] = DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000))\n            objCustomPersistableCollections.mapDate[\"bar\"] = DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))\n            objCustomPersistableCollections.mapDecimal[\"foo\"] = Decimal128Wrapper(persistedValue: Decimal128(123.456))\n            objCustomPersistableCollections.mapDecimal[\"bar\"] = Decimal128Wrapper(persistedValue: Decimal128(234.567))\n            objCustomPersistableCollections.mapObjectId[\"foo\"] = ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\"))\n            objCustomPersistableCollections.mapObjectId[\"bar\"] = ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))\n            objCustomPersistableCollections.mapUuid[\"foo\"] = UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!)\n            objCustomPersistableCollections.mapUuid[\"bar\"] = UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)\n            objModernAllTypesObject.mapOptBool[\"foo\"] = true\n            objModernAllTypesObject.mapOptBool[\"bar\"] = true\n            objModernAllTypesObject.mapOptInt[\"foo\"] = 1\n            objModernAllTypesObject.mapOptInt[\"bar\"] = 3\n            objModernAllTypesObject.mapOptInt8[\"foo\"] = Int8(8)\n            objModernAllTypesObject.mapOptInt8[\"bar\"] = Int8(9)\n            objModernAllTypesObject.mapOptInt16[\"foo\"] = Int16(16)\n            objModernAllTypesObject.mapOptInt16[\"bar\"] = Int16(17)\n            objModernAllTypesObject.mapOptInt32[\"foo\"] = Int32(32)\n            objModernAllTypesObject.mapOptInt32[\"bar\"] = Int32(33)\n            objModernAllTypesObject.mapOptInt64[\"foo\"] = Int64(64)\n            objModernAllTypesObject.mapOptInt64[\"bar\"] = Int64(65)\n            objModernAllTypesObject.mapOptFloat[\"foo\"] = Float(5.55444333)\n            objModernAllTypesObject.mapOptFloat[\"bar\"] = Float(6.55444333)\n            objModernAllTypesObject.mapOptDouble[\"foo\"] = 123.456\n            objModernAllTypesObject.mapOptDouble[\"bar\"] = 234.567\n            objModernAllTypesObject.mapOptString[\"foo\"] = \"Foo\"\n            objModernAllTypesObject.mapOptString[\"bar\"] = \"Foó\"\n            objModernAllTypesObject.mapOptBinary[\"foo\"] = Data(count: 64)\n            objModernAllTypesObject.mapOptBinary[\"bar\"] = Data(count: 128)\n            objModernAllTypesObject.mapOptDate[\"foo\"] = Date(timeIntervalSince1970: 1000000)\n            objModernAllTypesObject.mapOptDate[\"bar\"] = Date(timeIntervalSince1970: 2000000)\n            objModernAllTypesObject.mapOptDecimal[\"foo\"] = Decimal128(123.456)\n            objModernAllTypesObject.mapOptDecimal[\"bar\"] = Decimal128(234.567)\n            objModernAllTypesObject.mapOptObjectId[\"foo\"] = ObjectId(\"61184062c1d8f096a3695046\")\n            objModernAllTypesObject.mapOptObjectId[\"bar\"] = ObjectId(\"61184062c1d8f096a3695045\")\n            objModernAllTypesObject.mapOptUuid[\"foo\"] = UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!\n            objModernAllTypesObject.mapOptUuid[\"bar\"] = UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!\n            objModernCollectionsOfEnums.mapIntOpt[\"foo\"] = .value1\n            objModernCollectionsOfEnums.mapIntOpt[\"bar\"] = .value2\n            objModernCollectionsOfEnums.mapInt8Opt[\"foo\"] = .value1\n            objModernCollectionsOfEnums.mapInt8Opt[\"bar\"] = .value2\n            objModernCollectionsOfEnums.mapInt16Opt[\"foo\"] = .value1\n            objModernCollectionsOfEnums.mapInt16Opt[\"bar\"] = .value2\n            objModernCollectionsOfEnums.mapInt32Opt[\"foo\"] = .value1\n            objModernCollectionsOfEnums.mapInt32Opt[\"bar\"] = .value2\n            objModernCollectionsOfEnums.mapInt64Opt[\"foo\"] = .value1\n            objModernCollectionsOfEnums.mapInt64Opt[\"bar\"] = .value2\n            objModernCollectionsOfEnums.mapFloatOpt[\"foo\"] = .value1\n            objModernCollectionsOfEnums.mapFloatOpt[\"bar\"] = .value2\n            objModernCollectionsOfEnums.mapDoubleOpt[\"foo\"] = .value1\n            objModernCollectionsOfEnums.mapDoubleOpt[\"bar\"] = .value2\n            objModernCollectionsOfEnums.mapStringOpt[\"foo\"] = .value1\n            objModernCollectionsOfEnums.mapStringOpt[\"bar\"] = .value2\n            objCustomPersistableCollections.mapOptBool[\"foo\"] = BoolWrapper(persistedValue: true)\n            objCustomPersistableCollections.mapOptBool[\"bar\"] = BoolWrapper(persistedValue: true)\n            objCustomPersistableCollections.mapOptInt[\"foo\"] = IntWrapper(persistedValue: 1)\n            objCustomPersistableCollections.mapOptInt[\"bar\"] = IntWrapper(persistedValue: 3)\n            objCustomPersistableCollections.mapOptInt8[\"foo\"] = Int8Wrapper(persistedValue: Int8(8))\n            objCustomPersistableCollections.mapOptInt8[\"bar\"] = Int8Wrapper(persistedValue: Int8(9))\n            objCustomPersistableCollections.mapOptInt16[\"foo\"] = Int16Wrapper(persistedValue: Int16(16))\n            objCustomPersistableCollections.mapOptInt16[\"bar\"] = Int16Wrapper(persistedValue: Int16(17))\n            objCustomPersistableCollections.mapOptInt32[\"foo\"] = Int32Wrapper(persistedValue: Int32(32))\n            objCustomPersistableCollections.mapOptInt32[\"bar\"] = Int32Wrapper(persistedValue: Int32(33))\n            objCustomPersistableCollections.mapOptInt64[\"foo\"] = Int64Wrapper(persistedValue: Int64(64))\n            objCustomPersistableCollections.mapOptInt64[\"bar\"] = Int64Wrapper(persistedValue: Int64(65))\n            objCustomPersistableCollections.mapOptFloat[\"foo\"] = FloatWrapper(persistedValue: Float(5.55444333))\n            objCustomPersistableCollections.mapOptFloat[\"bar\"] = FloatWrapper(persistedValue: Float(6.55444333))\n            objCustomPersistableCollections.mapOptDouble[\"foo\"] = DoubleWrapper(persistedValue: 123.456)\n            objCustomPersistableCollections.mapOptDouble[\"bar\"] = DoubleWrapper(persistedValue: 234.567)\n            objCustomPersistableCollections.mapOptString[\"foo\"] = StringWrapper(persistedValue: \"Foo\")\n            objCustomPersistableCollections.mapOptString[\"bar\"] = StringWrapper(persistedValue: \"Foó\")\n            objCustomPersistableCollections.mapOptBinary[\"foo\"] = DataWrapper(persistedValue: Data(count: 64))\n            objCustomPersistableCollections.mapOptBinary[\"bar\"] = DataWrapper(persistedValue: Data(count: 128))\n            objCustomPersistableCollections.mapOptDate[\"foo\"] = DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000))\n            objCustomPersistableCollections.mapOptDate[\"bar\"] = DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))\n            objCustomPersistableCollections.mapOptDecimal[\"foo\"] = Decimal128Wrapper(persistedValue: Decimal128(123.456))\n            objCustomPersistableCollections.mapOptDecimal[\"bar\"] = Decimal128Wrapper(persistedValue: Decimal128(234.567))\n            objCustomPersistableCollections.mapOptObjectId[\"foo\"] = ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\"))\n            objCustomPersistableCollections.mapOptObjectId[\"bar\"] = ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))\n            objCustomPersistableCollections.mapOptUuid[\"foo\"] = UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!)\n            objCustomPersistableCollections.mapOptUuid[\"bar\"] = UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)\n\n            realm.add(objAllCustomPersistableTypes)\n            realm.add(objModernCollectionsOfEnums)\n            realm.add(objCustomPersistableCollections)\n            realm.add(objModernAllTypesObject)\n        }\n    }\n\n    override func tearDown() {\n        realm = nil\n    }\n\n    private func createKeypathCollectionAggregatesObject() {\n        realm.beginWrite()\n        realm.deleteAll()\n\n        let parentLinkToCustomPersistableCollections = realm.create(LinkToCustomPersistableCollections.self)\n        let childrenCustomPersistableCollections = [CustomPersistableCollections(), CustomPersistableCollections(), CustomPersistableCollections()]\n        parentLinkToCustomPersistableCollections.list.append(objectsIn: childrenCustomPersistableCollections)\n\n        let parentLinkToModernCollectionsOfEnums = realm.create(LinkToModernCollectionsOfEnums.self)\n        let childrenModernCollectionsOfEnums = [ModernCollectionsOfEnums(), ModernCollectionsOfEnums(), ModernCollectionsOfEnums()]\n        parentLinkToModernCollectionsOfEnums.list.append(objectsIn: childrenModernCollectionsOfEnums)\n\n        let parentLinkToAllCustomPersistableTypes = realm.create(LinkToAllCustomPersistableTypes.self)\n        let childrenAllCustomPersistableTypes = [AllCustomPersistableTypes(), AllCustomPersistableTypes(), AllCustomPersistableTypes()]\n        parentLinkToAllCustomPersistableTypes.list.append(objectsIn: childrenAllCustomPersistableTypes)\n\n        let parentLinkToModernAllTypesObject = realm.create(LinkToModernAllTypesObject.self)\n        let childrenModernAllTypesObject = [ModernAllTypesObject(), ModernAllTypesObject(), ModernAllTypesObject()]\n        parentLinkToModernAllTypesObject.list.append(objectsIn: childrenModernAllTypesObject)\n\n\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.intCol)\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.int8Col)\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.int16Col)\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.int32Col)\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.int64Col)\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.floatCol)\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.doubleCol)\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.dateCol)\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.decimalCol)\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.intEnumCol)\n        initForKeypathCollectionAggregates(childrenAllCustomPersistableTypes, \\.int)\n        initForKeypathCollectionAggregates(childrenAllCustomPersistableTypes, \\.int8)\n        initForKeypathCollectionAggregates(childrenAllCustomPersistableTypes, \\.int16)\n        initForKeypathCollectionAggregates(childrenAllCustomPersistableTypes, \\.int32)\n        initForKeypathCollectionAggregates(childrenAllCustomPersistableTypes, \\.int64)\n        initForKeypathCollectionAggregates(childrenAllCustomPersistableTypes, \\.float)\n        initForKeypathCollectionAggregates(childrenAllCustomPersistableTypes, \\.double)\n        initForKeypathCollectionAggregates(childrenAllCustomPersistableTypes, \\.date)\n        initForKeypathCollectionAggregates(childrenAllCustomPersistableTypes, \\.decimal)\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.optIntCol)\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.optInt8Col)\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.optInt16Col)\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.optInt32Col)\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.optInt64Col)\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.optFloatCol)\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.optDoubleCol)\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.optDateCol)\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.optDecimalCol)\n        initForKeypathCollectionAggregates(childrenModernAllTypesObject, \\.optIntEnumCol)\n        initForKeypathCollectionAggregates(childrenAllCustomPersistableTypes, \\.optInt)\n        initForKeypathCollectionAggregates(childrenAllCustomPersistableTypes, \\.optInt8)\n        initForKeypathCollectionAggregates(childrenAllCustomPersistableTypes, \\.optInt16)\n        initForKeypathCollectionAggregates(childrenAllCustomPersistableTypes, \\.optInt32)\n        initForKeypathCollectionAggregates(childrenAllCustomPersistableTypes, \\.optInt64)\n        initForKeypathCollectionAggregates(childrenAllCustomPersistableTypes, \\.optFloat)\n        initForKeypathCollectionAggregates(childrenAllCustomPersistableTypes, \\.optDouble)\n        initForKeypathCollectionAggregates(childrenAllCustomPersistableTypes, \\.optDate)\n        initForKeypathCollectionAggregates(childrenAllCustomPersistableTypes, \\.optDecimal)\n\n        try! realm.commitWrite()\n    }\n\n    private func initForKeypathCollectionAggregates<O: Object, T: QueryValue>(\n            _ objects: [O],\n            _ keyPath: ReferenceWritableKeyPath<O, T>) {\n        for (obj, value) in zip(objects, T.queryValues()) {\n            obj[keyPath: keyPath] = value\n        }\n    }\n\n    private func initLinkedCollectionAggregatesObject() {\n        realm.beginWrite()\n        realm.deleteAll()\n\n        let parentLinkToCustomPersistableCollections = realm.create(LinkToCustomPersistableCollections.self)\n        let objCustomPersistableCollections = CustomPersistableCollections()\n        parentLinkToCustomPersistableCollections[\"object\"] = objCustomPersistableCollections\n        let parentLinkToModernCollectionsOfEnums = realm.create(LinkToModernCollectionsOfEnums.self)\n        let objModernCollectionsOfEnums = ModernCollectionsOfEnums()\n        parentLinkToModernCollectionsOfEnums[\"object\"] = objModernCollectionsOfEnums\n        let parentLinkToModernAllTypesObject = realm.create(LinkToModernAllTypesObject.self)\n        let objModernAllTypesObject = ModernAllTypesObject()\n        parentLinkToModernAllTypesObject[\"object\"] = objModernAllTypesObject\n\n        objModernAllTypesObject[\"arrayBool\"] = Bool.queryValues()\n        objModernAllTypesObject[\"arrayInt\"] = Int.queryValues()\n        objModernAllTypesObject[\"arrayInt8\"] = Int8.queryValues()\n        objModernAllTypesObject[\"arrayInt16\"] = Int16.queryValues()\n        objModernAllTypesObject[\"arrayInt32\"] = Int32.queryValues()\n        objModernAllTypesObject[\"arrayInt64\"] = Int64.queryValues()\n        objModernAllTypesObject[\"arrayFloat\"] = Float.queryValues()\n        objModernAllTypesObject[\"arrayDouble\"] = Double.queryValues()\n        objModernAllTypesObject[\"arrayString\"] = String.queryValues()\n        objModernAllTypesObject[\"arrayBinary\"] = Data.queryValues()\n        objModernAllTypesObject[\"arrayDate\"] = Date.queryValues()\n        objModernAllTypesObject[\"arrayDecimal\"] = Decimal128.queryValues()\n        objModernAllTypesObject[\"arrayObjectId\"] = ObjectId.queryValues()\n        objModernAllTypesObject[\"arrayUuid\"] = UUID.queryValues()\n        objModernAllTypesObject[\"arrayAny\"] = AnyRealmValue.queryValues()\n        objModernCollectionsOfEnums[\"listInt\"] = EnumInt.queryValues()\n        objModernCollectionsOfEnums[\"listInt8\"] = EnumInt8.queryValues()\n        objModernCollectionsOfEnums[\"listInt16\"] = EnumInt16.queryValues()\n        objModernCollectionsOfEnums[\"listInt32\"] = EnumInt32.queryValues()\n        objModernCollectionsOfEnums[\"listInt64\"] = EnumInt64.queryValues()\n        objModernCollectionsOfEnums[\"listFloat\"] = EnumFloat.queryValues()\n        objModernCollectionsOfEnums[\"listDouble\"] = EnumDouble.queryValues()\n        objModernCollectionsOfEnums[\"listString\"] = EnumString.queryValues()\n        objCustomPersistableCollections[\"listBool\"] = BoolWrapper.queryValues()\n        objCustomPersistableCollections[\"listInt\"] = IntWrapper.queryValues()\n        objCustomPersistableCollections[\"listInt8\"] = Int8Wrapper.queryValues()\n        objCustomPersistableCollections[\"listInt16\"] = Int16Wrapper.queryValues()\n        objCustomPersistableCollections[\"listInt32\"] = Int32Wrapper.queryValues()\n        objCustomPersistableCollections[\"listInt64\"] = Int64Wrapper.queryValues()\n        objCustomPersistableCollections[\"listFloat\"] = FloatWrapper.queryValues()\n        objCustomPersistableCollections[\"listDouble\"] = DoubleWrapper.queryValues()\n        objCustomPersistableCollections[\"listString\"] = StringWrapper.queryValues()\n        objCustomPersistableCollections[\"listBinary\"] = DataWrapper.queryValues()\n        objCustomPersistableCollections[\"listDate\"] = DateWrapper.queryValues()\n        objCustomPersistableCollections[\"listDecimal\"] = Decimal128Wrapper.queryValues()\n        objCustomPersistableCollections[\"listObjectId\"] = ObjectIdWrapper.queryValues()\n        objCustomPersistableCollections[\"listUuid\"] = UUIDWrapper.queryValues()\n        objModernAllTypesObject[\"arrayOptBool\"] = Bool?.queryValues()\n        objModernAllTypesObject[\"arrayOptInt\"] = Int?.queryValues()\n        objModernAllTypesObject[\"arrayOptInt8\"] = Int8?.queryValues()\n        objModernAllTypesObject[\"arrayOptInt16\"] = Int16?.queryValues()\n        objModernAllTypesObject[\"arrayOptInt32\"] = Int32?.queryValues()\n        objModernAllTypesObject[\"arrayOptInt64\"] = Int64?.queryValues()\n        objModernAllTypesObject[\"arrayOptFloat\"] = Float?.queryValues()\n        objModernAllTypesObject[\"arrayOptDouble\"] = Double?.queryValues()\n        objModernAllTypesObject[\"arrayOptString\"] = String?.queryValues()\n        objModernAllTypesObject[\"arrayOptBinary\"] = Data?.queryValues()\n        objModernAllTypesObject[\"arrayOptDate\"] = Date?.queryValues()\n        objModernAllTypesObject[\"arrayOptDecimal\"] = Decimal128?.queryValues()\n        objModernAllTypesObject[\"arrayOptObjectId\"] = ObjectId?.queryValues()\n        objModernAllTypesObject[\"arrayOptUuid\"] = UUID?.queryValues()\n        objModernCollectionsOfEnums[\"listIntOpt\"] = EnumInt?.queryValues()\n        objModernCollectionsOfEnums[\"listInt8Opt\"] = EnumInt8?.queryValues()\n        objModernCollectionsOfEnums[\"listInt16Opt\"] = EnumInt16?.queryValues()\n        objModernCollectionsOfEnums[\"listInt32Opt\"] = EnumInt32?.queryValues()\n        objModernCollectionsOfEnums[\"listInt64Opt\"] = EnumInt64?.queryValues()\n        objModernCollectionsOfEnums[\"listFloatOpt\"] = EnumFloat?.queryValues()\n        objModernCollectionsOfEnums[\"listDoubleOpt\"] = EnumDouble?.queryValues()\n        objModernCollectionsOfEnums[\"listStringOpt\"] = EnumString?.queryValues()\n        objCustomPersistableCollections[\"listOptBool\"] = BoolWrapper?.queryValues()\n        objCustomPersistableCollections[\"listOptInt\"] = IntWrapper?.queryValues()\n        objCustomPersistableCollections[\"listOptInt8\"] = Int8Wrapper?.queryValues()\n        objCustomPersistableCollections[\"listOptInt16\"] = Int16Wrapper?.queryValues()\n        objCustomPersistableCollections[\"listOptInt32\"] = Int32Wrapper?.queryValues()\n        objCustomPersistableCollections[\"listOptInt64\"] = Int64Wrapper?.queryValues()\n        objCustomPersistableCollections[\"listOptFloat\"] = FloatWrapper?.queryValues()\n        objCustomPersistableCollections[\"listOptDouble\"] = DoubleWrapper?.queryValues()\n        objCustomPersistableCollections[\"listOptString\"] = StringWrapper?.queryValues()\n        objCustomPersistableCollections[\"listOptBinary\"] = DataWrapper?.queryValues()\n        objCustomPersistableCollections[\"listOptDate\"] = DateWrapper?.queryValues()\n        objCustomPersistableCollections[\"listOptDecimal\"] = Decimal128Wrapper?.queryValues()\n        objCustomPersistableCollections[\"listOptObjectId\"] = ObjectIdWrapper?.queryValues()\n        objCustomPersistableCollections[\"listOptUuid\"] = UUIDWrapper?.queryValues()\n        objModernAllTypesObject[\"setBool\"] = Bool.queryValues()\n        objModernAllTypesObject[\"setInt\"] = Int.queryValues()\n        objModernAllTypesObject[\"setInt8\"] = Int8.queryValues()\n        objModernAllTypesObject[\"setInt16\"] = Int16.queryValues()\n        objModernAllTypesObject[\"setInt32\"] = Int32.queryValues()\n        objModernAllTypesObject[\"setInt64\"] = Int64.queryValues()\n        objModernAllTypesObject[\"setFloat\"] = Float.queryValues()\n        objModernAllTypesObject[\"setDouble\"] = Double.queryValues()\n        objModernAllTypesObject[\"setString\"] = String.queryValues()\n        objModernAllTypesObject[\"setBinary\"] = Data.queryValues()\n        objModernAllTypesObject[\"setDate\"] = Date.queryValues()\n        objModernAllTypesObject[\"setDecimal\"] = Decimal128.queryValues()\n        objModernAllTypesObject[\"setObjectId\"] = ObjectId.queryValues()\n        objModernAllTypesObject[\"setUuid\"] = UUID.queryValues()\n        objModernAllTypesObject[\"setAny\"] = AnyRealmValue.queryValues()\n        objModernCollectionsOfEnums[\"setInt\"] = EnumInt.queryValues()\n        objModernCollectionsOfEnums[\"setInt8\"] = EnumInt8.queryValues()\n        objModernCollectionsOfEnums[\"setInt16\"] = EnumInt16.queryValues()\n        objModernCollectionsOfEnums[\"setInt32\"] = EnumInt32.queryValues()\n        objModernCollectionsOfEnums[\"setInt64\"] = EnumInt64.queryValues()\n        objModernCollectionsOfEnums[\"setFloat\"] = EnumFloat.queryValues()\n        objModernCollectionsOfEnums[\"setDouble\"] = EnumDouble.queryValues()\n        objModernCollectionsOfEnums[\"setString\"] = EnumString.queryValues()\n        objCustomPersistableCollections[\"setBool\"] = BoolWrapper.queryValues()\n        objCustomPersistableCollections[\"setInt\"] = IntWrapper.queryValues()\n        objCustomPersistableCollections[\"setInt8\"] = Int8Wrapper.queryValues()\n        objCustomPersistableCollections[\"setInt16\"] = Int16Wrapper.queryValues()\n        objCustomPersistableCollections[\"setInt32\"] = Int32Wrapper.queryValues()\n        objCustomPersistableCollections[\"setInt64\"] = Int64Wrapper.queryValues()\n        objCustomPersistableCollections[\"setFloat\"] = FloatWrapper.queryValues()\n        objCustomPersistableCollections[\"setDouble\"] = DoubleWrapper.queryValues()\n        objCustomPersistableCollections[\"setString\"] = StringWrapper.queryValues()\n        objCustomPersistableCollections[\"setBinary\"] = DataWrapper.queryValues()\n        objCustomPersistableCollections[\"setDate\"] = DateWrapper.queryValues()\n        objCustomPersistableCollections[\"setDecimal\"] = Decimal128Wrapper.queryValues()\n        objCustomPersistableCollections[\"setObjectId\"] = ObjectIdWrapper.queryValues()\n        objCustomPersistableCollections[\"setUuid\"] = UUIDWrapper.queryValues()\n        objModernAllTypesObject[\"setOptBool\"] = Bool?.queryValues()\n        objModernAllTypesObject[\"setOptInt\"] = Int?.queryValues()\n        objModernAllTypesObject[\"setOptInt8\"] = Int8?.queryValues()\n        objModernAllTypesObject[\"setOptInt16\"] = Int16?.queryValues()\n        objModernAllTypesObject[\"setOptInt32\"] = Int32?.queryValues()\n        objModernAllTypesObject[\"setOptInt64\"] = Int64?.queryValues()\n        objModernAllTypesObject[\"setOptFloat\"] = Float?.queryValues()\n        objModernAllTypesObject[\"setOptDouble\"] = Double?.queryValues()\n        objModernAllTypesObject[\"setOptString\"] = String?.queryValues()\n        objModernAllTypesObject[\"setOptBinary\"] = Data?.queryValues()\n        objModernAllTypesObject[\"setOptDate\"] = Date?.queryValues()\n        objModernAllTypesObject[\"setOptDecimal\"] = Decimal128?.queryValues()\n        objModernAllTypesObject[\"setOptObjectId\"] = ObjectId?.queryValues()\n        objModernAllTypesObject[\"setOptUuid\"] = UUID?.queryValues()\n        objModernCollectionsOfEnums[\"setIntOpt\"] = EnumInt?.queryValues()\n        objModernCollectionsOfEnums[\"setInt8Opt\"] = EnumInt8?.queryValues()\n        objModernCollectionsOfEnums[\"setInt16Opt\"] = EnumInt16?.queryValues()\n        objModernCollectionsOfEnums[\"setInt32Opt\"] = EnumInt32?.queryValues()\n        objModernCollectionsOfEnums[\"setInt64Opt\"] = EnumInt64?.queryValues()\n        objModernCollectionsOfEnums[\"setFloatOpt\"] = EnumFloat?.queryValues()\n        objModernCollectionsOfEnums[\"setDoubleOpt\"] = EnumDouble?.queryValues()\n        objModernCollectionsOfEnums[\"setStringOpt\"] = EnumString?.queryValues()\n        objCustomPersistableCollections[\"setOptBool\"] = BoolWrapper?.queryValues()\n        objCustomPersistableCollections[\"setOptInt\"] = IntWrapper?.queryValues()\n        objCustomPersistableCollections[\"setOptInt8\"] = Int8Wrapper?.queryValues()\n        objCustomPersistableCollections[\"setOptInt16\"] = Int16Wrapper?.queryValues()\n        objCustomPersistableCollections[\"setOptInt32\"] = Int32Wrapper?.queryValues()\n        objCustomPersistableCollections[\"setOptInt64\"] = Int64Wrapper?.queryValues()\n        objCustomPersistableCollections[\"setOptFloat\"] = FloatWrapper?.queryValues()\n        objCustomPersistableCollections[\"setOptDouble\"] = DoubleWrapper?.queryValues()\n        objCustomPersistableCollections[\"setOptString\"] = StringWrapper?.queryValues()\n        objCustomPersistableCollections[\"setOptBinary\"] = DataWrapper?.queryValues()\n        objCustomPersistableCollections[\"setOptDate\"] = DateWrapper?.queryValues()\n        objCustomPersistableCollections[\"setOptDecimal\"] = Decimal128Wrapper?.queryValues()\n        objCustomPersistableCollections[\"setOptObjectId\"] = ObjectIdWrapper?.queryValues()\n        objCustomPersistableCollections[\"setOptUuid\"] = UUIDWrapper?.queryValues()\n        populateMap(objModernAllTypesObject.mapBool)\n        populateMap(objModernAllTypesObject.mapInt)\n        populateMap(objModernAllTypesObject.mapInt8)\n        populateMap(objModernAllTypesObject.mapInt16)\n        populateMap(objModernAllTypesObject.mapInt32)\n        populateMap(objModernAllTypesObject.mapInt64)\n        populateMap(objModernAllTypesObject.mapFloat)\n        populateMap(objModernAllTypesObject.mapDouble)\n        populateMap(objModernAllTypesObject.mapString)\n        populateMap(objModernAllTypesObject.mapBinary)\n        populateMap(objModernAllTypesObject.mapDate)\n        populateMap(objModernAllTypesObject.mapDecimal)\n        populateMap(objModernAllTypesObject.mapObjectId)\n        populateMap(objModernAllTypesObject.mapUuid)\n        populateMap(objModernAllTypesObject.mapAny)\n        populateMap(objModernCollectionsOfEnums.mapInt)\n        populateMap(objModernCollectionsOfEnums.mapInt8)\n        populateMap(objModernCollectionsOfEnums.mapInt16)\n        populateMap(objModernCollectionsOfEnums.mapInt32)\n        populateMap(objModernCollectionsOfEnums.mapInt64)\n        populateMap(objModernCollectionsOfEnums.mapFloat)\n        populateMap(objModernCollectionsOfEnums.mapDouble)\n        populateMap(objModernCollectionsOfEnums.mapString)\n        populateMap(objCustomPersistableCollections.mapBool)\n        populateMap(objCustomPersistableCollections.mapInt)\n        populateMap(objCustomPersistableCollections.mapInt8)\n        populateMap(objCustomPersistableCollections.mapInt16)\n        populateMap(objCustomPersistableCollections.mapInt32)\n        populateMap(objCustomPersistableCollections.mapInt64)\n        populateMap(objCustomPersistableCollections.mapFloat)\n        populateMap(objCustomPersistableCollections.mapDouble)\n        populateMap(objCustomPersistableCollections.mapString)\n        populateMap(objCustomPersistableCollections.mapBinary)\n        populateMap(objCustomPersistableCollections.mapDate)\n        populateMap(objCustomPersistableCollections.mapDecimal)\n        populateMap(objCustomPersistableCollections.mapObjectId)\n        populateMap(objCustomPersistableCollections.mapUuid)\n        populateMap(objModernAllTypesObject.mapOptBool)\n        populateMap(objModernAllTypesObject.mapOptInt)\n        populateMap(objModernAllTypesObject.mapOptInt8)\n        populateMap(objModernAllTypesObject.mapOptInt16)\n        populateMap(objModernAllTypesObject.mapOptInt32)\n        populateMap(objModernAllTypesObject.mapOptInt64)\n        populateMap(objModernAllTypesObject.mapOptFloat)\n        populateMap(objModernAllTypesObject.mapOptDouble)\n        populateMap(objModernAllTypesObject.mapOptString)\n        populateMap(objModernAllTypesObject.mapOptBinary)\n        populateMap(objModernAllTypesObject.mapOptDate)\n        populateMap(objModernAllTypesObject.mapOptDecimal)\n        populateMap(objModernAllTypesObject.mapOptObjectId)\n        populateMap(objModernAllTypesObject.mapOptUuid)\n        populateMap(objModernCollectionsOfEnums.mapIntOpt)\n        populateMap(objModernCollectionsOfEnums.mapInt8Opt)\n        populateMap(objModernCollectionsOfEnums.mapInt16Opt)\n        populateMap(objModernCollectionsOfEnums.mapInt32Opt)\n        populateMap(objModernCollectionsOfEnums.mapInt64Opt)\n        populateMap(objModernCollectionsOfEnums.mapFloatOpt)\n        populateMap(objModernCollectionsOfEnums.mapDoubleOpt)\n        populateMap(objModernCollectionsOfEnums.mapStringOpt)\n        populateMap(objCustomPersistableCollections.mapOptBool)\n        populateMap(objCustomPersistableCollections.mapOptInt)\n        populateMap(objCustomPersistableCollections.mapOptInt8)\n        populateMap(objCustomPersistableCollections.mapOptInt16)\n        populateMap(objCustomPersistableCollections.mapOptInt32)\n        populateMap(objCustomPersistableCollections.mapOptInt64)\n        populateMap(objCustomPersistableCollections.mapOptFloat)\n        populateMap(objCustomPersistableCollections.mapOptDouble)\n        populateMap(objCustomPersistableCollections.mapOptString)\n        populateMap(objCustomPersistableCollections.mapOptBinary)\n        populateMap(objCustomPersistableCollections.mapOptDate)\n        populateMap(objCustomPersistableCollections.mapOptDecimal)\n        populateMap(objCustomPersistableCollections.mapOptObjectId)\n        populateMap(objCustomPersistableCollections.mapOptUuid)\n\n        try! realm.commitWrite()\n    }\n\n    private func populateMap<T: QueryValue>(_ map: Map<String, T>) {\n        let values = T.queryValues()\n        map[\"foo\"] = values[2]\n        map[\"bar\"] = values[1]\n        map[\"baz\"] = values[0]\n    }\n\n    // MARK: - Assertion Helpers\n\n    private func assertCount<T: Object>(_ expectedCount: Int,\n                                        line: UInt = #line,\n                                        _ query: ((Query<T>) -> Query<Bool>)) {\n        let results = realm.objects(T.self).where(query)\n        XCTAssertEqual(results.count, expectedCount, line: line)\n    }\n\n    private func assertPredicate<T: _RealmSchemaDiscoverable>(\n            _ predicate: String, _ values: [Any],\n            _ query: ((Query<T>) -> Query<Bool>)) {\n        let (queryStr, constructedValues) = query(Query<T>._constructForTesting())._constructPredicate()\n        XCTAssertEqual(queryStr, predicate)\n        XCTAssertEqual(constructedValues.count, values.count)\n        XCTAssertEqual(NSPredicate(format: queryStr, argumentArray: constructedValues),\n                       NSPredicate(format: predicate, argumentArray: values))\n    }\n\n    private func assertQuery(_ predicate: String, _ value: Any,\n                             count expectedCount: Int,\n                             _ query: ((Query<ModernAllTypesObject>) -> Query<Bool>)) {\n        assertCount(expectedCount, query)\n        assertPredicate(predicate, [value], query)\n    }\n\n    private func assertQuery<T: Object>(_ type: T.Type,\n                             _ predicate: String, _ value: Any,\n                             count expectedCount: Int,\n                             line: UInt = #line,\n                             _ query: ((Query<T>) -> Query<Bool>)) {\n        assertCount(expectedCount, line: line, query)\n        assertPredicate(predicate, [value], query)\n    }\n\n    private func assertQuery(_ predicate: String, values: [Any] = [],\n                             count expectedCount: Int,\n                             _ query: ((Query<ModernAllTypesObject>) -> Query<Bool>)) {\n        assertCount(expectedCount, query)\n        assertPredicate(predicate, values, query)\n    }\n\n    private func assertQuery<T: Object>(_ type: T.Type, _ predicate: String,\n                                        values: [Any] = [],\n                                        count expectedCount: Int,\n                                        _ query: ((Query<T>) -> Query<Bool>)) {\n        assertCount(expectedCount, query)\n        assertPredicate(predicate, values, query)\n    }\n\n    // MARK: - Basic Comparison\n\n    func validateEquals<Root: Object, T: _Persistable>(\n            _ name: String, _ lhs: (Query<Root>) -> Query<T>, _ value: T,\n            equalCount: Int = 1, notEqualCount: Int = 0) {\n        assertQuery(Root.self, \"(\\(name) == %@)\", value, count: equalCount) {\n            lhs($0) == value\n        }\n        assertQuery(Root.self, \"(\\(name) != %@)\", value, count: notEqualCount) {\n            lhs($0) != value\n        }\n    }\n    func validateEqualsNil<Root: Object, T: _RealmSchemaDiscoverable & ExpressibleByNilLiteral>(\n            _ name: String, _ lhs: (Query<Root>) -> Query<T>) {\n        assertQuery(Root.self, \"(\\(name) == %@)\", NSNull(), count: 0) {\n            lhs($0) == nil\n        }\n        assertQuery(Root.self, \"(\\(name) != %@)\", NSNull(), count: 1) {\n            lhs($0) != nil\n        }\n    }\n\n    func testEquals() {\n        validateEquals(\"boolCol\", \\Query<ModernAllTypesObject>.boolCol, false)\n        validateEquals(\"intCol\", \\Query<ModernAllTypesObject>.intCol, 3)\n        validateEquals(\"int8Col\", \\Query<ModernAllTypesObject>.int8Col, Int8(9))\n        validateEquals(\"int16Col\", \\Query<ModernAllTypesObject>.int16Col, Int16(17))\n        validateEquals(\"int32Col\", \\Query<ModernAllTypesObject>.int32Col, Int32(33))\n        validateEquals(\"int64Col\", \\Query<ModernAllTypesObject>.int64Col, Int64(65))\n        validateEquals(\"floatCol\", \\Query<ModernAllTypesObject>.floatCol, Float(6.55444333))\n        validateEquals(\"doubleCol\", \\Query<ModernAllTypesObject>.doubleCol, 234.567)\n        validateEquals(\"stringCol\", \\Query<ModernAllTypesObject>.stringCol, \"Foó\")\n        validateEquals(\"binaryCol\", \\Query<ModernAllTypesObject>.binaryCol, Data(count: 128))\n        validateEquals(\"dateCol\", \\Query<ModernAllTypesObject>.dateCol, Date(timeIntervalSince1970: 2000000))\n        validateEquals(\"decimalCol\", \\Query<ModernAllTypesObject>.decimalCol, Decimal128(234.567))\n        validateEquals(\"objectIdCol\", \\Query<ModernAllTypesObject>.objectIdCol, ObjectId(\"61184062c1d8f096a3695045\"))\n        validateEquals(\"uuidCol\", \\Query<ModernAllTypesObject>.uuidCol, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)\n        validateEquals(\"intEnumCol\", \\Query<ModernAllTypesObject>.intEnumCol, ModernIntEnum.value2)\n        validateEquals(\"stringEnumCol\", \\Query<ModernAllTypesObject>.stringEnumCol, ModernStringEnum.value2)\n        validateEquals(\"bool\", \\Query<AllCustomPersistableTypes>.bool, BoolWrapper(persistedValue: false))\n        validateEquals(\"int\", \\Query<AllCustomPersistableTypes>.int, IntWrapper(persistedValue: 3))\n        validateEquals(\"int8\", \\Query<AllCustomPersistableTypes>.int8, Int8Wrapper(persistedValue: Int8(9)))\n        validateEquals(\"int16\", \\Query<AllCustomPersistableTypes>.int16, Int16Wrapper(persistedValue: Int16(17)))\n        validateEquals(\"int32\", \\Query<AllCustomPersistableTypes>.int32, Int32Wrapper(persistedValue: Int32(33)))\n        validateEquals(\"int64\", \\Query<AllCustomPersistableTypes>.int64, Int64Wrapper(persistedValue: Int64(65)))\n        validateEquals(\"float\", \\Query<AllCustomPersistableTypes>.float, FloatWrapper(persistedValue: Float(6.55444333)))\n        validateEquals(\"double\", \\Query<AllCustomPersistableTypes>.double, DoubleWrapper(persistedValue: 234.567))\n        validateEquals(\"string\", \\Query<AllCustomPersistableTypes>.string, StringWrapper(persistedValue: \"Foó\"))\n        validateEquals(\"binary\", \\Query<AllCustomPersistableTypes>.binary, DataWrapper(persistedValue: Data(count: 128)))\n        validateEquals(\"date\", \\Query<AllCustomPersistableTypes>.date, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)))\n        validateEquals(\"decimal\", \\Query<AllCustomPersistableTypes>.decimal, Decimal128Wrapper(persistedValue: Decimal128(234.567)))\n        validateEquals(\"objectId\", \\Query<AllCustomPersistableTypes>.objectId, ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")))\n        validateEquals(\"uuid\", \\Query<AllCustomPersistableTypes>.uuid, UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!))\n        validateEquals(\"optBoolCol\", \\Query<ModernAllTypesObject>.optBoolCol, false)\n        validateEquals(\"optIntCol\", \\Query<ModernAllTypesObject>.optIntCol, 3)\n        validateEquals(\"optInt8Col\", \\Query<ModernAllTypesObject>.optInt8Col, Int8(9))\n        validateEquals(\"optInt16Col\", \\Query<ModernAllTypesObject>.optInt16Col, Int16(17))\n        validateEquals(\"optInt32Col\", \\Query<ModernAllTypesObject>.optInt32Col, Int32(33))\n        validateEquals(\"optInt64Col\", \\Query<ModernAllTypesObject>.optInt64Col, Int64(65))\n        validateEquals(\"optFloatCol\", \\Query<ModernAllTypesObject>.optFloatCol, Float(6.55444333))\n        validateEquals(\"optDoubleCol\", \\Query<ModernAllTypesObject>.optDoubleCol, 234.567)\n        validateEquals(\"optStringCol\", \\Query<ModernAllTypesObject>.optStringCol, \"Foó\")\n        validateEquals(\"optBinaryCol\", \\Query<ModernAllTypesObject>.optBinaryCol, Data(count: 128))\n        validateEquals(\"optDateCol\", \\Query<ModernAllTypesObject>.optDateCol, Date(timeIntervalSince1970: 2000000))\n        validateEquals(\"optDecimalCol\", \\Query<ModernAllTypesObject>.optDecimalCol, Decimal128(234.567))\n        validateEquals(\"optObjectIdCol\", \\Query<ModernAllTypesObject>.optObjectIdCol, ObjectId(\"61184062c1d8f096a3695045\"))\n        validateEquals(\"optUuidCol\", \\Query<ModernAllTypesObject>.optUuidCol, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)\n        validateEquals(\"optIntEnumCol\", \\Query<ModernAllTypesObject>.optIntEnumCol, ModernIntEnum.value2)\n        validateEquals(\"optStringEnumCol\", \\Query<ModernAllTypesObject>.optStringEnumCol, ModernStringEnum.value2)\n        validateEquals(\"optBool\", \\Query<AllCustomPersistableTypes>.optBool, BoolWrapper(persistedValue: false))\n        validateEquals(\"optInt\", \\Query<AllCustomPersistableTypes>.optInt, IntWrapper(persistedValue: 3))\n        validateEquals(\"optInt8\", \\Query<AllCustomPersistableTypes>.optInt8, Int8Wrapper(persistedValue: Int8(9)))\n        validateEquals(\"optInt16\", \\Query<AllCustomPersistableTypes>.optInt16, Int16Wrapper(persistedValue: Int16(17)))\n        validateEquals(\"optInt32\", \\Query<AllCustomPersistableTypes>.optInt32, Int32Wrapper(persistedValue: Int32(33)))\n        validateEquals(\"optInt64\", \\Query<AllCustomPersistableTypes>.optInt64, Int64Wrapper(persistedValue: Int64(65)))\n        validateEquals(\"optFloat\", \\Query<AllCustomPersistableTypes>.optFloat, FloatWrapper(persistedValue: Float(6.55444333)))\n        validateEquals(\"optDouble\", \\Query<AllCustomPersistableTypes>.optDouble, DoubleWrapper(persistedValue: 234.567))\n        validateEquals(\"optString\", \\Query<AllCustomPersistableTypes>.optString, StringWrapper(persistedValue: \"Foó\"))\n        validateEquals(\"optBinary\", \\Query<AllCustomPersistableTypes>.optBinary, DataWrapper(persistedValue: Data(count: 128)))\n        validateEquals(\"optDate\", \\Query<AllCustomPersistableTypes>.optDate, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)))\n        validateEquals(\"optDecimal\", \\Query<AllCustomPersistableTypes>.optDecimal, Decimal128Wrapper(persistedValue: Decimal128(234.567)))\n        validateEquals(\"optObjectId\", \\Query<AllCustomPersistableTypes>.optObjectId, ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")))\n        validateEquals(\"optUuid\", \\Query<AllCustomPersistableTypes>.optUuid, UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!))\n\n        validateEqualsNil(\"optBoolCol\", \\Query<ModernAllTypesObject>.optBoolCol)\n        validateEqualsNil(\"optIntCol\", \\Query<ModernAllTypesObject>.optIntCol)\n        validateEqualsNil(\"optInt8Col\", \\Query<ModernAllTypesObject>.optInt8Col)\n        validateEqualsNil(\"optInt16Col\", \\Query<ModernAllTypesObject>.optInt16Col)\n        validateEqualsNil(\"optInt32Col\", \\Query<ModernAllTypesObject>.optInt32Col)\n        validateEqualsNil(\"optInt64Col\", \\Query<ModernAllTypesObject>.optInt64Col)\n        validateEqualsNil(\"optFloatCol\", \\Query<ModernAllTypesObject>.optFloatCol)\n        validateEqualsNil(\"optDoubleCol\", \\Query<ModernAllTypesObject>.optDoubleCol)\n        validateEqualsNil(\"optStringCol\", \\Query<ModernAllTypesObject>.optStringCol)\n        validateEqualsNil(\"optBinaryCol\", \\Query<ModernAllTypesObject>.optBinaryCol)\n        validateEqualsNil(\"optDateCol\", \\Query<ModernAllTypesObject>.optDateCol)\n        validateEqualsNil(\"optDecimalCol\", \\Query<ModernAllTypesObject>.optDecimalCol)\n        validateEqualsNil(\"optObjectIdCol\", \\Query<ModernAllTypesObject>.optObjectIdCol)\n        validateEqualsNil(\"optUuidCol\", \\Query<ModernAllTypesObject>.optUuidCol)\n        validateEqualsNil(\"optIntEnumCol\", \\Query<ModernAllTypesObject>.optIntEnumCol)\n        validateEqualsNil(\"optStringEnumCol\", \\Query<ModernAllTypesObject>.optStringEnumCol)\n        validateEqualsNil(\"optBool\", \\Query<AllCustomPersistableTypes>.optBool)\n        validateEqualsNil(\"optInt\", \\Query<AllCustomPersistableTypes>.optInt)\n        validateEqualsNil(\"optInt8\", \\Query<AllCustomPersistableTypes>.optInt8)\n        validateEqualsNil(\"optInt16\", \\Query<AllCustomPersistableTypes>.optInt16)\n        validateEqualsNil(\"optInt32\", \\Query<AllCustomPersistableTypes>.optInt32)\n        validateEqualsNil(\"optInt64\", \\Query<AllCustomPersistableTypes>.optInt64)\n        validateEqualsNil(\"optFloat\", \\Query<AllCustomPersistableTypes>.optFloat)\n        validateEqualsNil(\"optDouble\", \\Query<AllCustomPersistableTypes>.optDouble)\n        validateEqualsNil(\"optString\", \\Query<AllCustomPersistableTypes>.optString)\n        validateEqualsNil(\"optBinary\", \\Query<AllCustomPersistableTypes>.optBinary)\n        validateEqualsNil(\"optDate\", \\Query<AllCustomPersistableTypes>.optDate)\n        validateEqualsNil(\"optDecimal\", \\Query<AllCustomPersistableTypes>.optDecimal)\n        validateEqualsNil(\"optObjectId\", \\Query<AllCustomPersistableTypes>.optObjectId)\n        validateEqualsNil(\"optUuid\", \\Query<AllCustomPersistableTypes>.optUuid)\n    }\n\n    func testImplicitBooleanOperation() {\n        assertQuery(ModernAllTypesObject.self, \"boolCol == true\", count: 0, { $0.boolCol })\n        assertQuery(ModernAllTypesObject.self, \"boolCol == false\", count: 1, { !$0.boolCol })\n\n        initLinkedCollectionAggregatesObject()\n        assertQuery(LinkToModernAllTypesObject.self, \"object.boolCol == true\", count: 0, { $0.object.boolCol })\n        assertQuery(LinkToModernAllTypesObject.self, \"object.boolCol == false\", count: 1, { !$0.object.boolCol })\n\n        let object = ModernEmbeddedParentObject()\n        let nestedObject = ModernEmbeddedTreeObject1()\n        object.object = nestedObject\n        try! realm.write {\n            realm.add(object)\n        }\n        assertQuery(ModernEmbeddedParentObject.self, \"object.bool == true\", count: 0, { $0.object.bool })\n        assertQuery(ModernEmbeddedParentObject.self, \"object.bool == false\", count: 1, { !$0.object.bool })\n\n        assertQuery(ModernAllTypesObject.self, \"((intCol == %@) && boolCol == true)\", 0, count: 0, { $0.intCol == 0 && $0.boolCol })\n        assertQuery(ModernAllTypesObject.self, \"(boolCol == true && (intCol == %@))\", 0, count: 0, { $0.boolCol && $0.intCol == 0 })\n        assertQuery(ModernAllTypesObject.self, \"((intCol == %@) || boolCol == false)\", 0, count: 1, { $0.intCol == 0 || !$0.boolCol })\n        assertQuery(ModernAllTypesObject.self, \"(boolCol == false || (intCol == %@))\", 0, count: 1, { !$0.boolCol || $0.intCol == 0 })\n    }\n\n    func testEqualAnyRealmValue() {\n        let circleObject = self.circleObject\n        let object = objects()[0]\n        setAnyRealmValueCol(with: .none, object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.none, count: 1) {\n            $0.anyCol == .none\n        }\n        setAnyRealmValueCol(with: .int(123), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.int(123), count: 1) {\n            $0.anyCol == .int(123)\n        }\n        setAnyRealmValueCol(with: .bool(true), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.bool(true), count: 1) {\n            $0.anyCol == .bool(true)\n        }\n        setAnyRealmValueCol(with: .float(123.456), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.float(123.456), count: 1) {\n            $0.anyCol == .float(123.456)\n        }\n        setAnyRealmValueCol(with: .double(123.456), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.double(123.456), count: 1) {\n            $0.anyCol == .double(123.456)\n        }\n        setAnyRealmValueCol(with: .string(\"FooBar\"), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.string(\"FooBar\"), count: 1) {\n            $0.anyCol == .string(\"FooBar\")\n        }\n        setAnyRealmValueCol(with: .data(Data(count: 64)), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.data(Data(count: 64)), count: 1) {\n            $0.anyCol == .data(Data(count: 64))\n        }\n        setAnyRealmValueCol(with: .date(Date(timeIntervalSince1970: 1000000)), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.date(Date(timeIntervalSince1970: 1000000)), count: 1) {\n            $0.anyCol == .date(Date(timeIntervalSince1970: 1000000))\n        }\n        setAnyRealmValueCol(with: .object(circleObject), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.object(circleObject), count: 1) {\n            $0.anyCol == .object(circleObject)\n        }\n        setAnyRealmValueCol(with: .objectId(ObjectId(\"61184062c1d8f096a3695046\")), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\")), count: 1) {\n            $0.anyCol == .objectId(ObjectId(\"61184062c1d8f096a3695046\"))\n        }\n        setAnyRealmValueCol(with: .decimal128(123.456), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.decimal128(123.456), count: 1) {\n            $0.anyCol == .decimal128(123.456)\n        }\n        setAnyRealmValueCol(with: .uuid(UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.uuid(UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), count: 1) {\n            $0.anyCol == .uuid(UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!)\n        }\n    }\n\n    func testEqualAnyRealmList() {\n        let circleObject = self.circleObject\n        let object = objects()[0]\n        let list = List<AnyRealmValue>()\n        list.removeAll()\n        list.append(.none)\n        setAnyRealmValueCol(with: .list(list), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.list(list), count: 1) {\n            let list = List<AnyRealmValue>()\n            list.append(.none)\n            return $0.anyCol == .list(list)\n        }\n        list.removeAll()\n        list.append(.int(123))\n        setAnyRealmValueCol(with: .list(list), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.list(list), count: 1) {\n            let list = List<AnyRealmValue>()\n            list.append(.int(123))\n            return $0.anyCol == .list(list)\n        }\n        list.removeAll()\n        list.append(.bool(true))\n        setAnyRealmValueCol(with: .list(list), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.list(list), count: 1) {\n            let list = List<AnyRealmValue>()\n            list.append(.bool(true))\n            return $0.anyCol == .list(list)\n        }\n        list.removeAll()\n        list.append(.float(123.456))\n        setAnyRealmValueCol(with: .list(list), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.list(list), count: 1) {\n            let list = List<AnyRealmValue>()\n            list.append(.float(123.456))\n            return $0.anyCol == .list(list)\n        }\n        list.removeAll()\n        list.append(.double(123.456))\n        setAnyRealmValueCol(with: .list(list), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.list(list), count: 1) {\n            let list = List<AnyRealmValue>()\n            list.append(.double(123.456))\n            return $0.anyCol == .list(list)\n        }\n        list.removeAll()\n        list.append(.string(\"FooBar\"))\n        setAnyRealmValueCol(with: .list(list), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.list(list), count: 1) {\n            let list = List<AnyRealmValue>()\n            list.append(.string(\"FooBar\"))\n            return $0.anyCol == .list(list)\n        }\n        list.removeAll()\n        list.append(.data(Data(count: 64)))\n        setAnyRealmValueCol(with: .list(list), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.list(list), count: 1) {\n            let list = List<AnyRealmValue>()\n            list.append(.data(Data(count: 64)))\n            return $0.anyCol == .list(list)\n        }\n        list.removeAll()\n        list.append(.date(Date(timeIntervalSince1970: 1000000)))\n        setAnyRealmValueCol(with: .list(list), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.list(list), count: 1) {\n            let list = List<AnyRealmValue>()\n            list.append(.date(Date(timeIntervalSince1970: 1000000)))\n            return $0.anyCol == .list(list)\n        }\n        list.removeAll()\n        list.append(.object(circleObject))\n        setAnyRealmValueCol(with: .list(list), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.list(list), count: 1) {\n            let list = List<AnyRealmValue>()\n            list.append(.object(circleObject))\n            return $0.anyCol == .list(list)\n        }\n        list.removeAll()\n        list.append(.objectId(ObjectId(\"61184062c1d8f096a3695046\")))\n        setAnyRealmValueCol(with: .list(list), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.list(list), count: 1) {\n            let list = List<AnyRealmValue>()\n            list.append(.objectId(ObjectId(\"61184062c1d8f096a3695046\")))\n            return $0.anyCol == .list(list)\n        }\n        list.removeAll()\n        list.append(.decimal128(123.456))\n        setAnyRealmValueCol(with: .list(list), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.list(list), count: 1) {\n            let list = List<AnyRealmValue>()\n            list.append(.decimal128(123.456))\n            return $0.anyCol == .list(list)\n        }\n        list.removeAll()\n        list.append(.uuid(UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!))\n        setAnyRealmValueCol(with: .list(list), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.list(list), count: 1) {\n            let list = List<AnyRealmValue>()\n            list.append(.uuid(UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!))\n            return $0.anyCol == .list(list)\n        }\n    }\n\n    func testEqualAnyRealmDictionary() {\n        let circleObject = self.circleObject\n        let object = objects()[0]\n        let dictionary = Map<String, AnyRealmValue>()\n        dictionary.removeAll()\n        dictionary[\"key\"] = AnyRealmValue.none\n        setAnyRealmValueCol(with: .dictionary(dictionary), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.dictionary(dictionary), count: 1) {\n            let dictionary = Map<String, AnyRealmValue>()\n            dictionary[\"key\"] = AnyRealmValue.none\n            return $0.anyCol == .dictionary(dictionary)\n        }\n        dictionary.removeAll()\n        dictionary[\"key\"] = AnyRealmValue.int(123)\n        setAnyRealmValueCol(with: .dictionary(dictionary), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.dictionary(dictionary), count: 1) {\n            let dictionary = Map<String, AnyRealmValue>()\n            dictionary[\"key\"] = AnyRealmValue.int(123)\n            return $0.anyCol == .dictionary(dictionary)\n        }\n        dictionary.removeAll()\n        dictionary[\"key\"] = AnyRealmValue.bool(true)\n        setAnyRealmValueCol(with: .dictionary(dictionary), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.dictionary(dictionary), count: 1) {\n            let dictionary = Map<String, AnyRealmValue>()\n            dictionary[\"key\"] = AnyRealmValue.bool(true)\n            return $0.anyCol == .dictionary(dictionary)\n        }\n        dictionary.removeAll()\n        dictionary[\"key\"] = AnyRealmValue.float(123.456)\n        setAnyRealmValueCol(with: .dictionary(dictionary), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.dictionary(dictionary), count: 1) {\n            let dictionary = Map<String, AnyRealmValue>()\n            dictionary[\"key\"] = AnyRealmValue.float(123.456)\n            return $0.anyCol == .dictionary(dictionary)\n        }\n        dictionary.removeAll()\n        dictionary[\"key\"] = AnyRealmValue.double(123.456)\n        setAnyRealmValueCol(with: .dictionary(dictionary), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.dictionary(dictionary), count: 1) {\n            let dictionary = Map<String, AnyRealmValue>()\n            dictionary[\"key\"] = AnyRealmValue.double(123.456)\n            return $0.anyCol == .dictionary(dictionary)\n        }\n        dictionary.removeAll()\n        dictionary[\"key\"] = AnyRealmValue.string(\"FooBar\")\n        setAnyRealmValueCol(with: .dictionary(dictionary), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.dictionary(dictionary), count: 1) {\n            let dictionary = Map<String, AnyRealmValue>()\n            dictionary[\"key\"] = AnyRealmValue.string(\"FooBar\")\n            return $0.anyCol == .dictionary(dictionary)\n        }\n        dictionary.removeAll()\n        dictionary[\"key\"] = AnyRealmValue.data(Data(count: 64))\n        setAnyRealmValueCol(with: .dictionary(dictionary), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.dictionary(dictionary), count: 1) {\n            let dictionary = Map<String, AnyRealmValue>()\n            dictionary[\"key\"] = AnyRealmValue.data(Data(count: 64))\n            return $0.anyCol == .dictionary(dictionary)\n        }\n        dictionary.removeAll()\n        dictionary[\"key\"] = AnyRealmValue.date(Date(timeIntervalSince1970: 1000000))\n        setAnyRealmValueCol(with: .dictionary(dictionary), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.dictionary(dictionary), count: 1) {\n            let dictionary = Map<String, AnyRealmValue>()\n            dictionary[\"key\"] = AnyRealmValue.date(Date(timeIntervalSince1970: 1000000))\n            return $0.anyCol == .dictionary(dictionary)\n        }\n        dictionary.removeAll()\n        dictionary[\"key\"] = AnyRealmValue.object(circleObject)\n        setAnyRealmValueCol(with: .dictionary(dictionary), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.dictionary(dictionary), count: 1) {\n            let dictionary = Map<String, AnyRealmValue>()\n            dictionary[\"key\"] = AnyRealmValue.object(circleObject)\n            return $0.anyCol == .dictionary(dictionary)\n        }\n        dictionary.removeAll()\n        dictionary[\"key\"] = AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\"))\n        setAnyRealmValueCol(with: .dictionary(dictionary), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.dictionary(dictionary), count: 1) {\n            let dictionary = Map<String, AnyRealmValue>()\n            dictionary[\"key\"] = AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\"))\n            return $0.anyCol == .dictionary(dictionary)\n        }\n        dictionary.removeAll()\n        dictionary[\"key\"] = AnyRealmValue.decimal128(123.456)\n        setAnyRealmValueCol(with: .dictionary(dictionary), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.dictionary(dictionary), count: 1) {\n            let dictionary = Map<String, AnyRealmValue>()\n            dictionary[\"key\"] = AnyRealmValue.decimal128(123.456)\n            return $0.anyCol == .dictionary(dictionary)\n        }\n        dictionary.removeAll()\n        dictionary[\"key\"] = AnyRealmValue.uuid(UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!)\n        setAnyRealmValueCol(with: .dictionary(dictionary), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.dictionary(dictionary), count: 1) {\n            let dictionary = Map<String, AnyRealmValue>()\n            dictionary[\"key\"] = AnyRealmValue.uuid(UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!)\n            return $0.anyCol == .dictionary(dictionary)\n        }\n    }\n\n    func testNestedAnyRealmList() {\n        let object = objects()[0]\n        let subArray2: AnyRealmValue = AnyRealmValue.fromArray([ .string(\"john\"), .bool(false) ])\n        let subArray3: AnyRealmValue = AnyRealmValue.fromArray([ subArray2, .double(76.54) ])\n        let subArray4: AnyRealmValue = AnyRealmValue.fromArray([ subArray3, .int(99)])\n        let array: Array<AnyRealmValue> = [\n            subArray4, .float(20.34)\n        ]\n\n        setAnyRealmValueCol(with: AnyRealmValue.fromArray(array), object: object)\n        assertQuery(\"(anyCol[%@] == %@)\", values: [1, AnyRealmValue.float(20.34)], count: 1) {\n            $0.anyCol[1] == .float(20.34)\n        }\n\n        assertQuery(\"(anyCol[%K] == %@)\", values: [\"#any\", AnyRealmValue.float(20.34)], count: 1) {\n            $0.anyCol.any == .float(20.34)\n        }\n\n        assertQuery(\"(anyCol[%@][%@] == %@)\", values: [0, 1, AnyRealmValue.int(99)], count: 1) {\n            $0.anyCol[0][1] == .int(99)\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%@] == %@)\", values: [0, 0, 1, AnyRealmValue.double(76.54)], count: 1) {\n            $0.anyCol[0][0][1] == .double(76.54)\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%K] == %@)\", values: [0, 0, \"#any\", AnyRealmValue.double(76.54)], count: 1) {\n            $0.anyCol[0][0].any == .double(76.54)\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%@][%@] == %@)\", values: [0, 0, 0, 0, AnyRealmValue.string(\"john\")], count: 1) {\n            $0.anyCol[0][0][0][0] == .string(\"john\")\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%@][%@] == %@)\", values: [0, 0, 0, 1, AnyRealmValue.bool(false)], count: 1) {\n            $0.anyCol[0][0][0][1] == .bool(false)\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%@][%K] == %@)\", values: [0, 0, 0, \"#any\", AnyRealmValue.string(\"john\")], count: 1) {\n            $0.anyCol[0][0][0].any == .string(\"john\")\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%@][%K] == %@)\", values: [0, 0, 0, \"#any\", AnyRealmValue.bool(false)], count: 1) {\n            $0.anyCol[0][0][0].any == .bool(false)\n        }\n\n        assertQuery(\"(anyCol[%@][%@] >= %@)\", values: [0, 1, AnyRealmValue.int(99)], count: 1) {\n            $0.anyCol[0][1] >= .int(99)\n        }\n\n        assertQuery(\"(anyCol[%@][%@] <= %@)\", values: [0, 1, AnyRealmValue.int(99)], count: 1) {\n            $0.anyCol[0][1] <= .int(99)\n        }\n\n        assertQuery(\"(anyCol[%@][%@] != %@)\", values: [0, 1, AnyRealmValue.int(99)], count: 0) {\n            $0.anyCol[0][1] != .int(99)\n        }\n\n        assertQuery(\"(anyCol[%@] == %@)\", values: [\"#any\", AnyRealmValue.float(20.34)], count: 0) {\n            $0.anyCol[\"#any\"] == .float(20.34)\n        }\n    }\n\n    func testNestedAnyRealmDictionary() {\n        let object = objects()[0]\n        let subDict2: AnyRealmValue = AnyRealmValue.fromDictionary([\"key6\": .string(\"john\"), \"key7\": .bool(false)])\n        let subDict3: AnyRealmValue = AnyRealmValue.fromDictionary([\"key4\": subDict2, \"key5\": .double(76.54)])\n        let subDict4: AnyRealmValue = AnyRealmValue.fromDictionary([\"key2\": subDict3, \"key3\": .int(99)])\n        let dict: Dictionary<String, AnyRealmValue> = [\n            \"key0\": subDict4, \"key1\": .float(20.34)\n        ]\n\n        setAnyRealmValueCol(with: AnyRealmValue.fromDictionary(dict), object: object)\n        assertQuery(\"(anyCol[%@] == %@)\", values: [\"key1\", AnyRealmValue.float(20.34)], count: 1) {\n            $0.anyCol[\"key1\"] == .float(20.34)\n        }\n\n        assertQuery(\"(anyCol[%K] == %@)\", values: [\"#any\", AnyRealmValue.float(20.34)], count: 1) {\n            $0.anyCol.any == .float(20.34)\n        }\n\n        assertQuery(\"(anyCol[%@][%@] == %@)\", values: [\"key0\", \"key3\", AnyRealmValue.int(99)], count: 1) {\n            $0.anyCol[\"key0\"][\"key3\"] == .int(99)\n        }\n\n        assertQuery(\"(anyCol[%@][%K] == %@)\", values: [\"key0\", \"#any\", AnyRealmValue.int(99)], count: 1) {\n            $0.anyCol[\"key0\"].any == .int(99)\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%@] == %@)\", values: [\"key0\", \"key2\", \"key5\", AnyRealmValue.double(76.54)], count: 1) {\n            $0.anyCol[\"key0\"][\"key2\"][\"key5\"] == .double(76.54)\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%K] == %@)\", values: [\"key0\", \"key2\", \"#any\", AnyRealmValue.double(76.54)], count: 1) {\n            $0.anyCol[\"key0\"][\"key2\"].any == .double(76.54)\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%@][%@] == %@)\", values: [\"key0\", \"key2\", \"key4\", \"key6\", AnyRealmValue.string(\"john\")], count: 1) {\n            $0.anyCol[\"key0\"][\"key2\"][\"key4\"][\"key6\"] == .string(\"john\")\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%@][%@] == %@)\", values: [\"key0\", \"key2\", \"key4\", \"key7\", AnyRealmValue.bool(false)], count: 1) {\n            $0.anyCol[\"key0\"][\"key2\"][\"key4\"][\"key7\"] == .bool(false)\n        }\n\n        assertQuery(\"(anyCol[%@][%K] >= %@)\", values: [\"key0\", \"#any\", AnyRealmValue.int(99)], count: 1) {\n            $0.anyCol[\"key0\"].any >= .int(99)\n        }\n\n        assertQuery(\"(anyCol[%@][%K] <= %@)\", values: [\"key0\", \"#any\", AnyRealmValue.int(99)], count: 1) {\n            $0.anyCol[\"key0\"].any <= .int(99)\n        }\n\n        assertQuery(\"(anyCol[%@][%@] != %@)\", values: [\"key0\", \"key3\", AnyRealmValue.int(99)], count: 0) {\n            $0.anyCol[\"key0\"][\"key3\"] != .int(99)\n        }\n\n        assertQuery(\"(anyCol[%@][%@] == %@)\", values: [\"key0\", \"#any\", AnyRealmValue.int(99)], count: 0) {\n            $0.anyCol[\"key0\"][\"#any\"] == .int(99)\n        }\n    }\n\n    func testEqualObject() {\n        let nestedObject = ModernAllTypesObject()\n        let object = objects().first!\n        try! realm.write {\n            object.objectCol = nestedObject\n        }\n        assertQuery(\"(objectCol == %@)\", nestedObject, count: 1) {\n            $0.objectCol == nestedObject\n        }\n    }\n\n    func testEqualEmbeddedObject() {\n        let object = ModernEmbeddedParentObject()\n        let nestedObject = ModernEmbeddedTreeObject1()\n        nestedObject.value = 123\n        object.object = nestedObject\n        try! realm.write {\n            realm.add(object)\n        }\n\n        let result1 = realm.objects(ModernEmbeddedParentObject.self).where {\n            $0.object == nestedObject\n        }\n        XCTAssertEqual(result1.count, 1)\n\n        let nestedObject2 = ModernEmbeddedTreeObject1()\n        nestedObject2.value = 123\n        let result2 = realm.objects(ModernEmbeddedParentObject.self).where {\n            $0.object == nestedObject2\n        }\n        XCTAssertEqual(result2.count, 0)\n    }\n\n    private func createLinksToMappedEmbeddedObject() {\n        try! realm.write {\n            let obj = realm.objects(AllCustomPersistableTypes.self).first!\n            obj.object = EmbeddedObjectWrapper(value: 2)\n            _ = realm.create(LinkToAllCustomPersistableTypes.self, value: [obj, [obj], [obj], [\"1\": obj]])\n        }\n    }\n\n    func testEqualMappedToEmbeddedObject() {\n        createLinksToMappedEmbeddedObject()\n\n        assertQuery(AllCustomPersistableTypes.self, \"(object.value == %@)\", 2, count: 1) {\n            $0.object.persistableValue.value == 2\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(object == %@)\", EmbeddedObjectWrapper(value: 2), count: 1) {\n            $0.object == EmbeddedObjectWrapper(value: 2)\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(object.value == %@)\", 3, count: 0) {\n            $0.object.persistableValue.value == 3\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(object == %@)\", EmbeddedObjectWrapper(value: 3), count: 0) {\n            $0.object == EmbeddedObjectWrapper(value: 3)\n        }\n\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(object.object.value == %@)\", 2, count: 1) {\n            $0.object.object.persistableValue.value == 2\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(object.object == %@)\", EmbeddedObjectWrapper(value: 2), count: 1) {\n            $0.object.object == EmbeddedObjectWrapper(value: 2)\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(object.object.value == %@)\", 3, count: 0) {\n            $0.object.object.persistableValue.value == 3\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(object.object == %@)\", EmbeddedObjectWrapper(value: 3), count: 0) {\n            $0.object.object == EmbeddedObjectWrapper(value: 3)\n        }\n\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY list.object.value == %@)\", 2, count: 1) {\n            $0.list.object.persistableValue.value == 2\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY list.object == %@)\", EmbeddedObjectWrapper(value: 2), count: 1) {\n            $0.list.object == EmbeddedObjectWrapper(value: 2)\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY list.object.value == %@)\", 3, count: 0) {\n            $0.list.object.persistableValue.value == 3\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY list.object == %@)\", EmbeddedObjectWrapper(value: 3), count: 0) {\n            $0.list.object == EmbeddedObjectWrapper(value: 3)\n        }\n\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY set.object.value == %@)\", 2, count: 1) {\n            $0.set.object.persistableValue.value == 2\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY set.object == %@)\", EmbeddedObjectWrapper(value: 2), count: 1) {\n            $0.set.object == EmbeddedObjectWrapper(value: 2)\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY set.object.value == %@)\", 3, count: 0) {\n            $0.set.object.persistableValue.value == 3\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY set.object == %@)\", EmbeddedObjectWrapper(value: 3), count: 0) {\n            $0.set.object == EmbeddedObjectWrapper(value: 3)\n        }\n\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY map.@allValues.object.value == %@)\", 2, count: 1) {\n            $0.map.values.object.persistableValue.value == 2\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY map.@allValues.object == %@)\", EmbeddedObjectWrapper(value: 2), count: 1) {\n            $0.map.values.object == EmbeddedObjectWrapper(value: 2)\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY map.@allValues.object.value == %@)\", 3, count: 0) {\n            $0.map.values.object.persistableValue.value == 3\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY map.@allValues.object == %@)\", EmbeddedObjectWrapper(value: 3), count: 0) {\n            $0.map.values.object == EmbeddedObjectWrapper(value: 3)\n        }\n    }\n\n    func testMemberwiseEquality() {\n        realm.beginWrite()\n        let obj1 = AddressSwiftWrapper(persistedValue: AddressSwift(value: [\"a\", \"b\"]))\n        let obj2 = AddressSwiftWrapper(persistedValue: AddressSwift(value: [\"a\", \"c\"]))\n        let obj3 = AddressSwiftWrapper(persistedValue: AddressSwift(value: [\"b\", \"b\"]))\n        let linkObj1 = realm.create(LinkToAddressSwiftWrapper.self, value: [obj1, obj1])\n        let linkObj2 = realm.create(LinkToAddressSwiftWrapper.self, value: [obj2, obj2])\n        _ = realm.create(LinkToAddressSwiftWrapper.self, value: [obj3, obj3])\n\n        // Test basic equality\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(object == %@)\", obj1, count: 1) {\n            $0.object == obj1\n        }\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(object != %@)\", obj1, count: 2) {\n            $0.object != obj1\n        }\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(optObject == %@)\", obj1, count: 1) {\n            $0.optObject == obj1\n        }\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(optObject != %@)\", obj1, count: 2) {\n            $0.optObject != obj1\n        }\n\n        // Verify that the expanded comparison nested groups correctly. If it doesn't\n        // start/end a subgroup, it'd end up as ((x or y) and z) instead of (x or (y and z)).\n        assertQuery(LinkToAddressSwiftWrapper.self, \"((object.city != %@) || (object == %@))\", values: [\"c\", obj1], count: 3) {\n            $0.object.persistableValue.city != \"c\" || $0.object == obj1\n        }\n        // Check for ((x and y) or Z) rather than (x and (y or z))\n        assertQuery(LinkToAddressSwiftWrapper.self, \"((object == %@) || (object.city != %@))\", values: [obj1, \"c\"], count: 3) {\n             $0.object == obj1 || $0.object.persistableValue.city != \"c\"\n        }\n\n        // Basic equality in collections\n        linkObj1.list.append(obj1)\n        linkObj1.map[\"foo\"] = obj1\n        linkObj1.optMap[\"foo\"] = obj1\n\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(ANY list == %@)\", obj1, count: 1) {\n            $0.list == obj1\n        }\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(ANY list != %@)\", obj1, count: 0) {\n            $0.list != obj1\n        }\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(ANY map.@allValues == %@)\", obj1, count: 1) {\n            $0.map.values == obj1\n        }\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(ANY map.@allValues != %@)\", obj1, count: 0) {\n            $0.map.values != obj1\n        }\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(ANY optMap.@allValues != %@)\", obj1, count: 0) {\n            $0.optMap.values != obj1\n        }\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(ANY optMap.@allValues == %@)\", obj1, count: 1) {\n            $0.optMap.values == obj1\n        }\n\n        // Verify that collections use a subquery. If they didn't, this object would\n        // now match as it has objects which match each property separately\n        linkObj2.list.append(obj2)\n        linkObj2.list.append(obj3)\n\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(ANY list == %@)\", obj1, count: 1) {\n            $0.list == obj1\n        }\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(ANY list != %@)\", obj1, count: 1) {\n            $0.list != obj1\n        }\n\n        realm.cancelWrite()\n    }\n\n    func testInvalidMemberwiseEquality() {\n        assertThrows(assertQuery(LinkToWrapperForTypeWithObjectLink.self, \"\", count: 0) {\n            $0.link == WrapperForTypeWithObjectLink()\n        }, reason: \"Unsupported property 'TypeWithObjectLink.value' for memberwise equality query: object links are not implemented.\")\n        assertThrows(assertQuery(LinkToWrapperForTypeWithCollection.self, \"\", count: 0) {\n            $0.link == WrapperForTypeWithCollection()\n        }, reason: \"Unsupported property 'TypeWithCollection.list' for memberwise equality query: equality on collections is not implemented.\")\n    }\n\n    func testNotEqualAnyRealmValue() {\n        let circleObject = self.circleObject\n        let object = objects()[0]\n        setAnyRealmValueCol(with: .none, object: object)\n        assertQuery(\"(anyCol != %@)\", AnyRealmValue.none, count: 0) {\n            $0.anyCol != .none\n        }\n        setAnyRealmValueCol(with: .int(123), object: object)\n        assertQuery(\"(anyCol != %@)\", AnyRealmValue.int(123), count: 0) {\n            $0.anyCol != .int(123)\n        }\n        setAnyRealmValueCol(with: .bool(true), object: object)\n        assertQuery(\"(anyCol != %@)\", AnyRealmValue.bool(true), count: 0) {\n            $0.anyCol != .bool(true)\n        }\n        setAnyRealmValueCol(with: .float(123.456), object: object)\n        assertQuery(\"(anyCol != %@)\", AnyRealmValue.float(123.456), count: 0) {\n            $0.anyCol != .float(123.456)\n        }\n        setAnyRealmValueCol(with: .double(123.456), object: object)\n        assertQuery(\"(anyCol != %@)\", AnyRealmValue.double(123.456), count: 0) {\n            $0.anyCol != .double(123.456)\n        }\n        setAnyRealmValueCol(with: .string(\"FooBar\"), object: object)\n        assertQuery(\"(anyCol != %@)\", AnyRealmValue.string(\"FooBar\"), count: 0) {\n            $0.anyCol != .string(\"FooBar\")\n        }\n        setAnyRealmValueCol(with: .data(Data(count: 64)), object: object)\n        assertQuery(\"(anyCol != %@)\", AnyRealmValue.data(Data(count: 64)), count: 0) {\n            $0.anyCol != .data(Data(count: 64))\n        }\n        setAnyRealmValueCol(with: .date(Date(timeIntervalSince1970: 1000000)), object: object)\n        assertQuery(\"(anyCol != %@)\", AnyRealmValue.date(Date(timeIntervalSince1970: 1000000)), count: 0) {\n            $0.anyCol != .date(Date(timeIntervalSince1970: 1000000))\n        }\n        setAnyRealmValueCol(with: .object(circleObject), object: object)\n        assertQuery(\"(anyCol != %@)\", AnyRealmValue.object(circleObject), count: 0) {\n            $0.anyCol != .object(circleObject)\n        }\n        setAnyRealmValueCol(with: .objectId(ObjectId(\"61184062c1d8f096a3695046\")), object: object)\n        assertQuery(\"(anyCol != %@)\", AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\")), count: 0) {\n            $0.anyCol != .objectId(ObjectId(\"61184062c1d8f096a3695046\"))\n        }\n        setAnyRealmValueCol(with: .decimal128(123.456), object: object)\n        assertQuery(\"(anyCol != %@)\", AnyRealmValue.decimal128(123.456), count: 0) {\n            $0.anyCol != .decimal128(123.456)\n        }\n        setAnyRealmValueCol(with: .uuid(UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), object: object)\n        assertQuery(\"(anyCol != %@)\", AnyRealmValue.uuid(UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), count: 0) {\n            $0.anyCol != .uuid(UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!)\n        }\n    }\n\n    func testNotEqualObject() {\n        let nestedObject = ModernAllTypesObject()\n        let object = objects().first!\n        try! realm.write {\n            object.objectCol = nestedObject\n        }\n        // Count will be one because nestedObject.objectCol will be nil\n        assertQuery(\"(objectCol != %@)\", nestedObject, count: 1) {\n            $0.objectCol != nestedObject\n        }\n    }\n\n    func testNotEqualEmbeddedObject() {\n        let object = ModernEmbeddedParentObject()\n        let nestedObject = ModernEmbeddedTreeObject1()\n        nestedObject.value = 123\n        object.object = nestedObject\n        try! realm.write {\n            realm.add(object)\n        }\n\n        let result1 = realm.objects(ModernEmbeddedParentObject.self).where {\n            $0.object != nestedObject\n        }\n        XCTAssertEqual(result1.count, 0)\n\n        let nestedObject2 = ModernEmbeddedTreeObject1()\n        nestedObject2.value = 123\n        let result2 = realm.objects(ModernEmbeddedParentObject.self).where {\n            $0.object != nestedObject2\n        }\n        XCTAssertEqual(result2.count, 1)\n    }\n\n    func testNotEqualMappedToEmbeddedObject() {\n        createLinksToMappedEmbeddedObject()\n\n        assertQuery(AllCustomPersistableTypes.self, \"(object.value != %@)\", 2, count: 0) {\n            $0.object.persistableValue.value != 2\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(object != %@)\", EmbeddedObjectWrapper(value: 2), count: 0) {\n            $0.object != EmbeddedObjectWrapper(value: 2)\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(object.value != %@)\", 3, count: 1) {\n            $0.object.persistableValue.value != 3\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(object != %@)\", EmbeddedObjectWrapper(value: 3), count: 1) {\n            $0.object != EmbeddedObjectWrapper(value: 3)\n        }\n\n\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(object.object.value != %@)\", 2, count: 0) {\n            $0.object.object.persistableValue.value != 2\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(object.object != %@)\", EmbeddedObjectWrapper(value: 2), count: 0) {\n            $0.object.object != EmbeddedObjectWrapper(value: 2)\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(object.object.value != %@)\", 3, count: 1) {\n            $0.object.object.persistableValue.value != 3\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(object.object != %@)\", EmbeddedObjectWrapper(value: 3), count: 1) {\n            $0.object.object != EmbeddedObjectWrapper(value: 3)\n        }\n\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY list.object.value != %@)\", 2, count: 0) {\n            $0.list.object.persistableValue.value != 2\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY list.object != %@)\", EmbeddedObjectWrapper(value: 2), count: 0) {\n            $0.list.object != EmbeddedObjectWrapper(value: 2)\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY list.object.value != %@)\", 3, count: 1) {\n            $0.list.object.persistableValue.value != 3\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY list.object != %@)\", EmbeddedObjectWrapper(value: 3), count: 1) {\n            $0.list.object != EmbeddedObjectWrapper(value: 3)\n        }\n\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY set.object.value != %@)\", 2, count: 0) {\n            $0.set.object.persistableValue.value != 2\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY set.object != %@)\", EmbeddedObjectWrapper(value: 2), count: 0) {\n            $0.set.object != EmbeddedObjectWrapper(value: 2)\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY set.object.value != %@)\", 3, count: 1) {\n            $0.set.object.persistableValue.value != 3\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY set.object != %@)\", EmbeddedObjectWrapper(value: 3), count: 1) {\n            $0.set.object != EmbeddedObjectWrapper(value: 3)\n        }\n\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY map.@allValues.object.value != %@)\", 2, count: 0) {\n            $0.map.values.object.persistableValue.value != 2\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY map.@allValues.object != %@)\", EmbeddedObjectWrapper(value: 2), count: 0) {\n            $0.map.values.object != EmbeddedObjectWrapper(value: 2)\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY map.@allValues.object.value != %@)\", 3, count: 1) {\n            $0.map.values.object.persistableValue.value != 3\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(ANY map.@allValues.object != %@)\", EmbeddedObjectWrapper(value: 3), count: 1) {\n            $0.map.values.object != EmbeddedObjectWrapper(value: 3)\n        }\n    }\n\n    func validateNumericComparisons<Root: Object, T: _Persistable>(\n            _ name: String, _ lhs: (Query<Root>) -> Query<T>,\n            _ value: T, count: Int = 1, ltCount: Int = 0, gtCount: Int = 0) where T.PersistedType: _QueryNumeric {\n        assertQuery(Root.self, \"(\\(name) > %@)\", value, count: gtCount) {\n            lhs($0) > value\n        }\n        assertQuery(Root.self, \"(\\(name) >= %@)\", value, count: count) {\n            lhs($0) >= value\n        }\n        assertQuery(Root.self, \"(\\(name) < %@)\", value, count: ltCount) {\n            lhs($0) < value\n        }\n        assertQuery(Root.self, \"(\\(name) <= %@)\", value, count: count) {\n            lhs($0) <= value\n        }\n    }\n\n    func testNumericComparisons() {\n        validateNumericComparisons(\"intCol\", \\Query<ModernAllTypesObject>.intCol, 3)\n        validateNumericComparisons(\"int8Col\", \\Query<ModernAllTypesObject>.int8Col, Int8(9))\n        validateNumericComparisons(\"int16Col\", \\Query<ModernAllTypesObject>.int16Col, Int16(17))\n        validateNumericComparisons(\"int32Col\", \\Query<ModernAllTypesObject>.int32Col, Int32(33))\n        validateNumericComparisons(\"int64Col\", \\Query<ModernAllTypesObject>.int64Col, Int64(65))\n        validateNumericComparisons(\"floatCol\", \\Query<ModernAllTypesObject>.floatCol, Float(6.55444333))\n        validateNumericComparisons(\"doubleCol\", \\Query<ModernAllTypesObject>.doubleCol, 234.567)\n        validateNumericComparisons(\"dateCol\", \\Query<ModernAllTypesObject>.dateCol, Date(timeIntervalSince1970: 2000000))\n        validateNumericComparisons(\"decimalCol\", \\Query<ModernAllTypesObject>.decimalCol, Decimal128(234.567))\n        validateNumericComparisons(\"intEnumCol\", \\Query<ModernAllTypesObject>.intEnumCol, .value2)\n        validateNumericComparisons(\"int\", \\Query<AllCustomPersistableTypes>.int, IntWrapper(persistedValue: 3))\n        validateNumericComparisons(\"int8\", \\Query<AllCustomPersistableTypes>.int8, Int8Wrapper(persistedValue: Int8(9)))\n        validateNumericComparisons(\"int16\", \\Query<AllCustomPersistableTypes>.int16, Int16Wrapper(persistedValue: Int16(17)))\n        validateNumericComparisons(\"int32\", \\Query<AllCustomPersistableTypes>.int32, Int32Wrapper(persistedValue: Int32(33)))\n        validateNumericComparisons(\"int64\", \\Query<AllCustomPersistableTypes>.int64, Int64Wrapper(persistedValue: Int64(65)))\n        validateNumericComparisons(\"float\", \\Query<AllCustomPersistableTypes>.float, FloatWrapper(persistedValue: Float(6.55444333)))\n        validateNumericComparisons(\"double\", \\Query<AllCustomPersistableTypes>.double, DoubleWrapper(persistedValue: 234.567))\n        validateNumericComparisons(\"date\", \\Query<AllCustomPersistableTypes>.date, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)))\n        validateNumericComparisons(\"decimal\", \\Query<AllCustomPersistableTypes>.decimal, Decimal128Wrapper(persistedValue: Decimal128(234.567)))\n        validateNumericComparisons(\"optIntCol\", \\Query<ModernAllTypesObject>.optIntCol, 3)\n        validateNumericComparisons(\"optInt8Col\", \\Query<ModernAllTypesObject>.optInt8Col, Int8(9))\n        validateNumericComparisons(\"optInt16Col\", \\Query<ModernAllTypesObject>.optInt16Col, Int16(17))\n        validateNumericComparisons(\"optInt32Col\", \\Query<ModernAllTypesObject>.optInt32Col, Int32(33))\n        validateNumericComparisons(\"optInt64Col\", \\Query<ModernAllTypesObject>.optInt64Col, Int64(65))\n        validateNumericComparisons(\"optFloatCol\", \\Query<ModernAllTypesObject>.optFloatCol, Float(6.55444333))\n        validateNumericComparisons(\"optDoubleCol\", \\Query<ModernAllTypesObject>.optDoubleCol, 234.567)\n        validateNumericComparisons(\"optDateCol\", \\Query<ModernAllTypesObject>.optDateCol, Date(timeIntervalSince1970: 2000000))\n        validateNumericComparisons(\"optDecimalCol\", \\Query<ModernAllTypesObject>.optDecimalCol, Decimal128(234.567))\n        validateNumericComparisons(\"optIntEnumCol\", \\Query<ModernAllTypesObject>.optIntEnumCol, .value2)\n        validateNumericComparisons(\"optInt\", \\Query<AllCustomPersistableTypes>.optInt, IntWrapper(persistedValue: 3))\n        validateNumericComparisons(\"optInt8\", \\Query<AllCustomPersistableTypes>.optInt8, Int8Wrapper(persistedValue: Int8(9)))\n        validateNumericComparisons(\"optInt16\", \\Query<AllCustomPersistableTypes>.optInt16, Int16Wrapper(persistedValue: Int16(17)))\n        validateNumericComparisons(\"optInt32\", \\Query<AllCustomPersistableTypes>.optInt32, Int32Wrapper(persistedValue: Int32(33)))\n        validateNumericComparisons(\"optInt64\", \\Query<AllCustomPersistableTypes>.optInt64, Int64Wrapper(persistedValue: Int64(65)))\n        validateNumericComparisons(\"optFloat\", \\Query<AllCustomPersistableTypes>.optFloat, FloatWrapper(persistedValue: Float(6.55444333)))\n        validateNumericComparisons(\"optDouble\", \\Query<AllCustomPersistableTypes>.optDouble, DoubleWrapper(persistedValue: 234.567))\n        validateNumericComparisons(\"optDate\", \\Query<AllCustomPersistableTypes>.optDate, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)))\n        validateNumericComparisons(\"optDecimal\", \\Query<AllCustomPersistableTypes>.optDecimal, Decimal128Wrapper(persistedValue: Decimal128(234.567)))\n\n        validateNumericComparisons(\"optIntCol\", \\Query<ModernAllTypesObject>.optIntCol, nil, count: 0)\n        validateNumericComparisons(\"optInt8Col\", \\Query<ModernAllTypesObject>.optInt8Col, nil, count: 0)\n        validateNumericComparisons(\"optInt16Col\", \\Query<ModernAllTypesObject>.optInt16Col, nil, count: 0)\n        validateNumericComparisons(\"optInt32Col\", \\Query<ModernAllTypesObject>.optInt32Col, nil, count: 0)\n        validateNumericComparisons(\"optInt64Col\", \\Query<ModernAllTypesObject>.optInt64Col, nil, count: 0)\n        validateNumericComparisons(\"optFloatCol\", \\Query<ModernAllTypesObject>.optFloatCol, nil, count: 0)\n        validateNumericComparisons(\"optDoubleCol\", \\Query<ModernAllTypesObject>.optDoubleCol, nil, count: 0)\n        validateNumericComparisons(\"optDateCol\", \\Query<ModernAllTypesObject>.optDateCol, nil, count: 0)\n        validateNumericComparisons(\"optDecimalCol\", \\Query<ModernAllTypesObject>.optDecimalCol, nil, count: 0)\n        validateNumericComparisons(\"optIntEnumCol\", \\Query<ModernAllTypesObject>.optIntEnumCol, nil, count: 0)\n        validateNumericComparisons(\"optInt\", \\Query<AllCustomPersistableTypes>.optInt, nil, count: 0)\n        validateNumericComparisons(\"optInt8\", \\Query<AllCustomPersistableTypes>.optInt8, nil, count: 0)\n        validateNumericComparisons(\"optInt16\", \\Query<AllCustomPersistableTypes>.optInt16, nil, count: 0)\n        validateNumericComparisons(\"optInt32\", \\Query<AllCustomPersistableTypes>.optInt32, nil, count: 0)\n        validateNumericComparisons(\"optInt64\", \\Query<AllCustomPersistableTypes>.optInt64, nil, count: 0)\n        validateNumericComparisons(\"optFloat\", \\Query<AllCustomPersistableTypes>.optFloat, nil, count: 0)\n        validateNumericComparisons(\"optDouble\", \\Query<AllCustomPersistableTypes>.optDouble, nil, count: 0)\n        validateNumericComparisons(\"optDate\", \\Query<AllCustomPersistableTypes>.optDate, nil, count: 0)\n        validateNumericComparisons(\"optDecimal\", \\Query<AllCustomPersistableTypes>.optDecimal, nil, count: 0)\n    }\n\n    func validateStringComparisons<Root: Object, T: _Persistable>(\n            _ name: String, _ lhs: (Query<Root>) -> Query<T>,\n            _ value: T, letCount: Int = 1, getCount: Int = 1, ltCount: Int = 0, gtCount: Int = 0) where T.PersistedType: _QueryString {\n        assertQuery(Root.self, \"(\\(name) > %@)\", value, count: gtCount) {\n            lhs($0) > value\n        }\n        assertQuery(Root.self, \"(\\(name) >= %@)\", value, count: getCount) {\n            lhs($0) >= value\n        }\n        assertQuery(Root.self, \"(\\(name) < %@)\", value, count: ltCount) {\n            lhs($0) < value\n        }\n        assertQuery(Root.self, \"(\\(name) <= %@)\", value, count: letCount) {\n            lhs($0) <= value\n        }\n    }\n\n    func testStringComparisons() {\n        validateStringComparisons(\"stringCol\", \\Query<ModernAllTypesObject>.stringCol, \"Foó\")\n        validateStringComparisons(\"stringEnumCol\", \\Query<ModernAllTypesObject>.stringEnumCol, .value2)\n        validateStringComparisons(\"string\", \\Query<AllCustomPersistableTypes>.string, StringWrapper(persistedValue: \"Foó\"))\n        validateStringComparisons(\"optStringCol\", \\Query<ModernAllTypesObject>.optStringCol, \"Foó\")\n        validateStringComparisons(\"optStringEnumCol\", \\Query<ModernAllTypesObject>.optStringEnumCol, .value2)\n        validateStringComparisons(\"optString\", \\Query<AllCustomPersistableTypes>.optString, StringWrapper(persistedValue: \"Foó\"))\n\n        validateStringComparisons(\"optStringCol\", \\Query<ModernAllTypesObject>.optStringCol, nil, letCount: 0, gtCount: 1)\n        validateStringComparisons(\"optStringEnumCol\", \\Query<ModernAllTypesObject>.optStringEnumCol, nil, letCount: 0, gtCount: 1)\n        validateStringComparisons(\"optString\", \\Query<AllCustomPersistableTypes>.optString, nil, letCount: 0, gtCount: 1)\n    }\n\n    func testGreaterThanNumericAnyRealmValue() {\n        let object = objects()[0]\n        setAnyRealmValueCol(with: .int(123), object: object)\n        assertQuery(\"(anyCol > %@)\", AnyRealmValue.int(123), count: 0) {\n            $0.anyCol > .int(123)\n        }\n        assertQuery(\"(anyCol >= %@)\", AnyRealmValue.int(123), count: 1) {\n            $0.anyCol >= .int(123)\n        }\n        setAnyRealmValueCol(with: .float(123.456), object: object)\n        assertQuery(\"(anyCol > %@)\", AnyRealmValue.float(123.456), count: 0) {\n            $0.anyCol > .float(123.456)\n        }\n        assertQuery(\"(anyCol >= %@)\", AnyRealmValue.float(123.456), count: 1) {\n            $0.anyCol >= .float(123.456)\n        }\n        setAnyRealmValueCol(with: .double(123.456), object: object)\n        assertQuery(\"(anyCol > %@)\", AnyRealmValue.double(123.456), count: 0) {\n            $0.anyCol > .double(123.456)\n        }\n        assertQuery(\"(anyCol >= %@)\", AnyRealmValue.double(123.456), count: 1) {\n            $0.anyCol >= .double(123.456)\n        }\n        setAnyRealmValueCol(with: .date(Date(timeIntervalSince1970: 1000000)), object: object)\n        assertQuery(\"(anyCol > %@)\", AnyRealmValue.date(Date(timeIntervalSince1970: 1000000)), count: 0) {\n            $0.anyCol > .date(Date(timeIntervalSince1970: 1000000))\n        }\n        assertQuery(\"(anyCol >= %@)\", AnyRealmValue.date(Date(timeIntervalSince1970: 1000000)), count: 1) {\n            $0.anyCol >= .date(Date(timeIntervalSince1970: 1000000))\n        }\n        setAnyRealmValueCol(with: .decimal128(123.456), object: object)\n        assertQuery(\"(anyCol > %@)\", AnyRealmValue.decimal128(123.456), count: 0) {\n            $0.anyCol > .decimal128(123.456)\n        }\n        assertQuery(\"(anyCol >= %@)\", AnyRealmValue.decimal128(123.456), count: 1) {\n            $0.anyCol >= .decimal128(123.456)\n        }\n    }\n\n    func testGreaterThanStringAnyRealmValue() {\n        let object = objects()[0]\n        setAnyRealmValueCol(with: .string(\"FooBar\"), object: object)\n        assertQuery(\"(anyCol > %@)\", AnyRealmValue.string(\"FooBar\"), count: 0) {\n            $0.anyCol > .string(\"FooBar\")\n        }\n        assertQuery(\"(anyCol >= %@)\", AnyRealmValue.string(\"FooBar\"), count: 1) {\n            $0.anyCol >= .string(\"FooBar\")\n        }\n    }\n\n    func testLessThanNumericAnyRealmValue() {\n        let object = objects()[0]\n        setAnyRealmValueCol(with: .int(123), object: object)\n        assertQuery(\"(anyCol < %@)\", AnyRealmValue.int(123), count: 0) {\n            $0.anyCol < .int(123)\n        }\n        assertQuery(\"(anyCol <= %@)\", AnyRealmValue.int(123), count: 1) {\n            $0.anyCol <= .int(123)\n        }\n        setAnyRealmValueCol(with: .float(123.456), object: object)\n        assertQuery(\"(anyCol < %@)\", AnyRealmValue.float(123.456), count: 0) {\n            $0.anyCol < .float(123.456)\n        }\n        assertQuery(\"(anyCol <= %@)\", AnyRealmValue.float(123.456), count: 1) {\n            $0.anyCol <= .float(123.456)\n        }\n        setAnyRealmValueCol(with: .double(123.456), object: object)\n        assertQuery(\"(anyCol < %@)\", AnyRealmValue.double(123.456), count: 0) {\n            $0.anyCol < .double(123.456)\n        }\n        assertQuery(\"(anyCol <= %@)\", AnyRealmValue.double(123.456), count: 1) {\n            $0.anyCol <= .double(123.456)\n        }\n        setAnyRealmValueCol(with: .date(Date(timeIntervalSince1970: 1000000)), object: object)\n        assertQuery(\"(anyCol < %@)\", AnyRealmValue.date(Date(timeIntervalSince1970: 1000000)), count: 0) {\n            $0.anyCol < .date(Date(timeIntervalSince1970: 1000000))\n        }\n        assertQuery(\"(anyCol <= %@)\", AnyRealmValue.date(Date(timeIntervalSince1970: 1000000)), count: 1) {\n            $0.anyCol <= .date(Date(timeIntervalSince1970: 1000000))\n        }\n        setAnyRealmValueCol(with: .decimal128(123.456), object: object)\n        assertQuery(\"(anyCol < %@)\", AnyRealmValue.decimal128(123.456), count: 0) {\n            $0.anyCol < .decimal128(123.456)\n        }\n        assertQuery(\"(anyCol <= %@)\", AnyRealmValue.decimal128(123.456), count: 1) {\n            $0.anyCol <= .decimal128(123.456)\n        }\n    }\n\n    func testLessThanStringAnyRealmValue() {\n        let object = objects()[0]\n        setAnyRealmValueCol(with: .string(\"FooBar\"), object: object)\n        assertQuery(\"(anyCol < %@)\", AnyRealmValue.string(\"FooBar\"), count: 0) {\n            $0.anyCol < .string(\"FooBar\")\n        }\n        assertQuery(\"(anyCol <= %@)\", AnyRealmValue.string(\"FooBar\"), count: 1) {\n            $0.anyCol <= .string(\"FooBar\")\n        }\n    }\n\n    private func validateNumericContains<Root: Object, T: _RealmSchemaDiscoverable & QueryValue & Comparable>(\n            _ name: String, _ lhs: (Query<Root>) -> Query<T>) {\n        let values = T.queryValues()\n        assertQuery(Root.self, \"((\\(name) >= %@) && (\\(name) < %@))\", values: [values[0], values[2]], count: 1) {\n            lhs($0).contains(values[0]..<values[2])\n        }\n        assertQuery(Root.self, \"((\\(name) >= %@) && (\\(name) < %@))\", values: [values[0], values[1]], count: 0) {\n            lhs($0).contains(values[0]..<values[1])\n        }\n        assertQuery(Root.self, \"(\\(name) BETWEEN {%@, %@})\", values: [values[0], values[2]], count: 1) {\n            lhs($0).contains(values[0]...values[2])\n        }\n        assertQuery(Root.self, \"(\\(name) BETWEEN {%@, %@})\", values: [values[0], values[1]], count: 1) {\n            lhs($0).contains(values[0]...values[1])\n        }\n    }\n    private func validateNumericContains<Root: Object, T: _RealmSchemaDiscoverable & OptionalProtocol>(\n            _ name: String, _ lhs: (Query<Root>) -> Query<T>) where T.Wrapped: Comparable & QueryValue {\n        let values = T.Wrapped.queryValues()\n        assertQuery(Root.self, \"((\\(name) >= %@) && (\\(name) < %@))\", values: [values[0], values[2]], count: 1) {\n            lhs($0).contains(values[0]..<values[2])\n        }\n        assertQuery(Root.self, \"((\\(name) >= %@) && (\\(name) < %@))\", values: [values[0], values[1]], count: 0) {\n            lhs($0).contains(values[0]..<values[1])\n        }\n        assertQuery(Root.self, \"(\\(name) BETWEEN {%@, %@})\", values: [values[0], values[2]], count: 1) {\n            lhs($0).contains(values[0]...values[2])\n        }\n        assertQuery(Root.self, \"(\\(name) BETWEEN {%@, %@})\", values: [values[0], values[1]], count: 1) {\n            lhs($0).contains(values[0]...values[1])\n        }\n    }\n\n    func testNumericContains() {\n        validateNumericContains(\"intCol\", \\Query<ModernAllTypesObject>.intCol)\n        validateNumericContains(\"int8Col\", \\Query<ModernAllTypesObject>.int8Col)\n        validateNumericContains(\"int16Col\", \\Query<ModernAllTypesObject>.int16Col)\n        validateNumericContains(\"int32Col\", \\Query<ModernAllTypesObject>.int32Col)\n        validateNumericContains(\"int64Col\", \\Query<ModernAllTypesObject>.int64Col)\n        validateNumericContains(\"floatCol\", \\Query<ModernAllTypesObject>.floatCol)\n        validateNumericContains(\"doubleCol\", \\Query<ModernAllTypesObject>.doubleCol)\n        validateNumericContains(\"dateCol\", \\Query<ModernAllTypesObject>.dateCol)\n        validateNumericContains(\"decimalCol\", \\Query<ModernAllTypesObject>.decimalCol)\n        validateNumericContains(\"intEnumCol\", \\Query<ModernAllTypesObject>.intEnumCol.rawValue)\n        validateNumericContains(\"int\", \\Query<AllCustomPersistableTypes>.int.persistableValue)\n        validateNumericContains(\"int8\", \\Query<AllCustomPersistableTypes>.int8.persistableValue)\n        validateNumericContains(\"int16\", \\Query<AllCustomPersistableTypes>.int16.persistableValue)\n        validateNumericContains(\"int32\", \\Query<AllCustomPersistableTypes>.int32.persistableValue)\n        validateNumericContains(\"int64\", \\Query<AllCustomPersistableTypes>.int64.persistableValue)\n        validateNumericContains(\"float\", \\Query<AllCustomPersistableTypes>.float.persistableValue)\n        validateNumericContains(\"double\", \\Query<AllCustomPersistableTypes>.double.persistableValue)\n        validateNumericContains(\"date\", \\Query<AllCustomPersistableTypes>.date.persistableValue)\n        validateNumericContains(\"decimal\", \\Query<AllCustomPersistableTypes>.decimal.persistableValue)\n        validateNumericContains(\"optIntCol\", \\Query<ModernAllTypesObject>.optIntCol)\n        validateNumericContains(\"optInt8Col\", \\Query<ModernAllTypesObject>.optInt8Col)\n        validateNumericContains(\"optInt16Col\", \\Query<ModernAllTypesObject>.optInt16Col)\n        validateNumericContains(\"optInt32Col\", \\Query<ModernAllTypesObject>.optInt32Col)\n        validateNumericContains(\"optInt64Col\", \\Query<ModernAllTypesObject>.optInt64Col)\n        validateNumericContains(\"optFloatCol\", \\Query<ModernAllTypesObject>.optFloatCol)\n        validateNumericContains(\"optDoubleCol\", \\Query<ModernAllTypesObject>.optDoubleCol)\n        validateNumericContains(\"optDateCol\", \\Query<ModernAllTypesObject>.optDateCol)\n        validateNumericContains(\"optDecimalCol\", \\Query<ModernAllTypesObject>.optDecimalCol)\n        validateNumericContains(\"optIntEnumCol\", \\Query<ModernAllTypesObject>.optIntEnumCol.rawValue)\n        validateNumericContains(\"optInt\", \\Query<AllCustomPersistableTypes>.optInt.persistableValue)\n        validateNumericContains(\"optInt8\", \\Query<AllCustomPersistableTypes>.optInt8.persistableValue)\n        validateNumericContains(\"optInt16\", \\Query<AllCustomPersistableTypes>.optInt16.persistableValue)\n        validateNumericContains(\"optInt32\", \\Query<AllCustomPersistableTypes>.optInt32.persistableValue)\n        validateNumericContains(\"optInt64\", \\Query<AllCustomPersistableTypes>.optInt64.persistableValue)\n        validateNumericContains(\"optFloat\", \\Query<AllCustomPersistableTypes>.optFloat.persistableValue)\n        validateNumericContains(\"optDouble\", \\Query<AllCustomPersistableTypes>.optDouble.persistableValue)\n        validateNumericContains(\"optDate\", \\Query<AllCustomPersistableTypes>.optDate.persistableValue)\n        validateNumericContains(\"optDecimal\", \\Query<AllCustomPersistableTypes>.optDecimal.persistableValue)\n    }\n\n    // MARK: - Strings\n\n    let stringModifiers: [(String, StringOptions)] = [\n        (\"\", []),\n        (\"[c]\", [.caseInsensitive]),\n        (\"[d]\", [.diacriticInsensitive]),\n        (\"[cd]\", [.caseInsensitive, .diacriticInsensitive]),\n    ]\n\n    private func validateStringOperations<Root: Object, T: _Persistable>(\n            _ name: String, _ lhs: (Query<Root>) -> Query<T>,\n            _ values: (T, T, T), count: (Bool, StringOptions) -> Int)\n            where T.PersistedType: _QueryString {\n        let (full, prefix, suffix) = values\n        for (modifier, options) in stringModifiers {\n            let matchingCount = count(true, options)\n            let notMatchingCount = count(false, options)\n            assertQuery(Root.self, \"(\\(name) ==\\(modifier) %@)\", full, count: matchingCount) {\n                lhs($0).equals(full, options: [options])\n            }\n            assertQuery(Root.self, \"(NOT \\(name) ==\\(modifier) %@)\", full, count: 1 - matchingCount) {\n                !lhs($0).equals(full, options: [options])\n            }\n            assertQuery(Root.self, \"(\\(name) !=\\(modifier) %@)\", full, count: notMatchingCount) {\n                lhs($0).notEquals(full, options: [options])\n            }\n            assertQuery(Root.self, \"(NOT \\(name) !=\\(modifier) %@)\", full, count: 1 - notMatchingCount) {\n                !lhs($0).notEquals(full, options: [options])\n            }\n\n            assertQuery(Root.self, \"(\\(name) CONTAINS\\(modifier) %@)\", full, count: matchingCount) {\n                lhs($0).contains(full, options: [options])\n            }\n            assertQuery(Root.self, \"(NOT \\(name) CONTAINS\\(modifier) %@)\", full, count: 1 - matchingCount) {\n                !lhs($0).contains(full, options: [options])\n            }\n\n            assertQuery(Root.self, \"(\\(name) BEGINSWITH\\(modifier) %@)\", prefix, count: matchingCount) {\n                lhs($0).starts(with: prefix, options: [options])\n            }\n            assertQuery(Root.self, \"(NOT \\(name) BEGINSWITH\\(modifier) %@)\", prefix, count: 1 - matchingCount) {\n                !lhs($0).starts(with: prefix, options: [options])\n            }\n\n            assertQuery(Root.self, \"(\\(name) ENDSWITH\\(modifier) %@)\", suffix, count: matchingCount) {\n                lhs($0).ends(with: suffix, options: [options])\n            }\n            assertQuery(Root.self, \"(NOT \\(name) ENDSWITH\\(modifier) %@)\", suffix, count: 1 - matchingCount) {\n                !lhs($0).ends(with: suffix, options: [options])\n            }\n        }\n    }\n\n    func testStringOperations() {\n        validateStringOperations(\"stringCol\", \\Query<ModernAllTypesObject>.stringCol,\n                                 (\"Foó\", \"Fo\", \"oó\"),\n                                 count: { (equals, _) in equals ? 1 : 0 })\n        validateStringOperations(\"stringEnumCol\", \\Query<ModernAllTypesObject>.stringEnumCol.rawValue,\n                                 (\"Foó\", \"Fo\", \"oó\"),\n                                 count: { (equals, _) in equals ? 0 : 1 })\n        validateStringOperations(\"string\", \\Query<AllCustomPersistableTypes>.string,\n                                 (StringWrapper(persistedValue: \"Foó\"), StringWrapper(persistedValue: \"Fo\"), StringWrapper(persistedValue: \"oó\")),\n                                 count: { (equals, _) in equals ? 1 : 0 })\n        validateStringOperations(\"optStringCol\", \\Query<ModernAllTypesObject>.optStringCol,\n                                 (String?.some(\"Foó\"), String?.some(\"Fo\"), String?.some(\"oó\")),\n                                 count: { (equals, _) in equals ? 1 : 0 })\n        validateStringOperations(\"optStringEnumCol\", \\Query<ModernAllTypesObject>.optStringEnumCol.rawValue,\n                                 (String?.some(\"Foó\"), String?.some(\"Fo\"), String?.some(\"oó\")),\n                                 count: { (equals, _) in equals ? 0 : 1 })\n        validateStringOperations(\"optString\", \\Query<AllCustomPersistableTypes>.optString,\n                                 (StringWrapper(persistedValue: \"Foó\"), StringWrapper(persistedValue: \"Fo\"), StringWrapper(persistedValue: \"oó\")),\n                                 count: { (equals, _) in equals ? 1 : 0 })\n    }\n\n    private func validateStringLike<Root: Object, T: _Persistable>(\n            _ name: String, _ lhs: (Query<Root>) -> Query<T>, _ strings: [(T, Int, Int)], canMatch: Bool) where T.PersistedType: _QueryString {\n        for (str, sensitiveCount, insensitiveCount) in strings {\n            assertQuery(Root.self, \"(\\(name) LIKE %@)\", str, count: canMatch ? sensitiveCount : 0) {\n                lhs($0).like(str)\n            }\n            assertQuery(Root.self, \"(\\(name) LIKE[c] %@)\", str, count: canMatch ? insensitiveCount : 0) {\n                lhs($0).like(str, caseInsensitive: true)\n            }\n        }\n    }\n\n    func testStringLike() {\n        let likeStrings: [(String, Int, Int)] = [\n            (\"Foó\", 1, 1),\n            (\"f*\", 0, 1),\n            (\"*ó\", 1, 1),\n            (\"f?ó\", 0, 1),\n            (\"f*ó\", 0, 1),\n            (\"f??ó\", 0, 0),\n            (\"*o*\", 1, 1),\n            (\"*O*\", 0, 1),\n            (\"?o?\", 1, 1),\n            (\"?O?\", 0, 1)\n        ]\n        validateStringLike(\"stringCol\", \\Query<ModernAllTypesObject>.stringCol,\n                           likeStrings.map { ($0.0, $0.1, $0.2) }, canMatch: true)\n        validateStringLike(\"stringEnumCol\", \\Query<ModernAllTypesObject>.stringEnumCol.rawValue,\n                           likeStrings.map { ($0.0, $0.1, $0.2) }, canMatch: false)\n        validateStringLike(\"string\", \\Query<AllCustomPersistableTypes>.string,\n                           likeStrings.map { (StringWrapper(persistedValue: $0.0), $0.1, $0.2) }, canMatch: true)\n        validateStringLike(\"optStringCol\", \\Query<ModernAllTypesObject>.optStringCol,\n                           likeStrings.map { (String?.some($0.0), $0.1, $0.2) }, canMatch: true)\n        validateStringLike(\"optStringEnumCol\", \\Query<ModernAllTypesObject>.optStringEnumCol.rawValue,\n                           likeStrings.map { (String?.some($0.0), $0.1, $0.2) }, canMatch: false)\n        validateStringLike(\"optString\", \\Query<AllCustomPersistableTypes>.optString,\n                           likeStrings.map { (StringWrapper(persistedValue: $0.0), $0.1, $0.2) }, canMatch: true)\n    }\n\n    private func validateStringLexicographicalComparison<Root: Object, T: _Persistable>(\n            _ name: String, _ lhs: (Query<Root>) -> Query<T>, _ strings: [(T, (Int, Int, Int, Int))]) where T.PersistedType: _QueryString {\n        for (str, (gtCount, getCount, ltCount, letCount)) in strings {\n            assertQuery(Root.self, \"(\\(name) > %@)\", str, count: gtCount) {\n                lhs($0) > str\n            }\n            assertQuery(Root.self, \"(\\(name) >= %@)\", str, count: getCount) {\n                lhs($0) >= str\n            }\n            assertQuery(Root.self, \"(\\(name) < %@)\", str, count: ltCount) {\n                lhs($0) < str\n            }\n            assertQuery(Root.self, \"(\\(name) <= %@)\", str, count: letCount) {\n                lhs($0) <= str\n            }\n        }\n    }\n\n    func testLexicographicalComparison() throws {\n        let obj = objects().first!\n        try realm.write {\n            obj.stringEnumCol = .value4\n            obj.optStringEnumCol = .value4\n        }\n        let likeStrings: [(String, (Int, Int, Int, Int))] = [\n            (\"Foó\", (0, 1, 0, 1)),\n            (\"Foo\", (1, 1, 0, 0)),\n            (\"f*\", (0, 0, 1, 1)),\n            (\"*ó\", (1, 1, 0, 0)),\n            (\"f?ó\", (0, 0, 1, 1)),\n            (\"f*ó\", (0, 0, 1, 1)),\n            (\"f??ó\", (0, 0, 1, 1)),\n            (\"*o*\", (1, 1, 0, 0)),\n            (\"*O*\", (1, 1, 0, 0)),\n            (\"?o?\", (1, 1, 0, 0)),\n            (\"?O?\", (1, 1, 0, 0)),\n            (\"Foô\", (0, 0, 1, 1)),\n            (\"Fpó\", (0, 0, 1, 1)),\n            (\"Goó\", (0, 0, 1, 1)),\n            (\"Foò\", (1, 1, 0, 0)),\n            (\"Fnó\", (1, 1, 0, 0)),\n             (\"Eoó\", (1, 1, 0, 0)),\n        ]\n        validateStringLexicographicalComparison(\"stringCol\", \\Query<ModernAllTypesObject>.stringCol, likeStrings)\n        validateStringLexicographicalComparison(\"stringEnumCol\", \\Query<ModernAllTypesObject>.stringEnumCol.rawValue, likeStrings)\n        validateStringLexicographicalComparison(\"string\", \\Query<AllCustomPersistableTypes>.string,\n                           likeStrings.map { (StringWrapper(persistedValue: $0.0), $0.1) })\n        validateStringLexicographicalComparison(\"optStringCol\", \\Query<ModernAllTypesObject>.optStringCol,\n                           likeStrings.map { (String?.some($0.0), $0.1) })\n        validateStringLexicographicalComparison(\"optStringEnumCol\", \\Query<ModernAllTypesObject>.optStringEnumCol.rawValue,\n                           likeStrings.map { (String?.some($0.0), $0.1) })\n        validateStringLexicographicalComparison(\"optString\", \\Query<AllCustomPersistableTypes>.optString,\n                           likeStrings.map { (StringWrapper(persistedValue: $0.0), $0.1) })\n    }\n\n    // MARK: - Data\n\n    func validateData<Root: Object, T: _Persistable>(_ name: String, _ lhs: (Query<Root>) -> Query<T>,\n                                                     zeroData: T, oneData: T) where T.PersistedType: _QueryBinary {\n        assertQuery(Root.self, \"(\\(name) BEGINSWITH %@)\", zeroData, count: 1) {\n            lhs($0).starts(with: zeroData)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name) BEGINSWITH %@)\", zeroData, count: 0) {\n            !lhs($0).starts(with: zeroData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) ENDSWITH %@)\", zeroData, count: 1) {\n            lhs($0).ends(with: zeroData)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name) ENDSWITH %@)\", zeroData, count: 0) {\n            !lhs($0).ends(with: zeroData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) CONTAINS %@)\", zeroData, count: 1) {\n            lhs($0).contains(zeroData)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name) CONTAINS %@)\", zeroData, count: 0) {\n            !lhs($0).contains(zeroData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) == %@)\", zeroData, count: 0) {\n            lhs($0).equals(zeroData)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name) == %@)\", zeroData, count: 1) {\n            !lhs($0).equals(zeroData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) != %@)\", zeroData, count: 1) {\n            lhs($0).notEquals(zeroData)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name) != %@)\", zeroData, count: 0) {\n            !lhs($0).notEquals(zeroData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) BEGINSWITH %@)\", oneData, count: 0) {\n            lhs($0).starts(with: oneData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) ENDSWITH %@)\", oneData, count: 0) {\n            lhs($0).ends(with: oneData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) CONTAINS %@)\", oneData, count: 0) {\n            lhs($0).contains(oneData)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name) CONTAINS %@)\", oneData, count: 1) {\n            !lhs($0).contains(oneData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) CONTAINS %@)\", oneData, count: 0) {\n            lhs($0).contains(oneData)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name) CONTAINS %@)\", oneData, count: 1) {\n            !lhs($0).contains(oneData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) == %@)\", oneData, count: 0) {\n            lhs($0).equals(oneData)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name) == %@)\", oneData, count: 1) {\n            !lhs($0).equals(oneData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) != %@)\", oneData, count: 1) {\n            lhs($0).notEquals(oneData)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name) != %@)\", oneData, count: 0) {\n            !lhs($0).notEquals(oneData)\n        }\n    }\n\n    func testBinarySearchQueries() {\n        validateData(\"binaryCol\", \\Query<ModernAllTypesObject>.binaryCol,\n                     zeroData: Data(count: 28), oneData: Data(repeating: 1, count: 28))\n        validateData(\"binary\", \\Query<AllCustomPersistableTypes>.binary,\n                     zeroData: DataWrapper(persistedValue: Data(count: 28)), oneData: DataWrapper(persistedValue: Data(repeating: 1, count: 28)))\n        validateData(\"optBinaryCol\", \\Query<ModernAllTypesObject>.optBinaryCol,\n                     zeroData: Data?.some(Data(count: 28)), oneData: Data?.some(Data(repeating: 1, count: 28)))\n        validateData(\"optBinary\", \\Query<AllCustomPersistableTypes>.optBinary,\n                     zeroData: DataWrapper(persistedValue: Data(count: 28)), oneData: DataWrapper(persistedValue: Data(repeating: 1, count: 28)))\n    }\n\n    // MARK: - Array/Set\n\n    private func validateCollectionContains<Root: Object, T: RealmCollection>(_ name: String, _ lhs: (Query<Root>) -> Query<T>)\n            where T.Element: QueryValue {\n        let values = T.Element.queryValues()\n\n        assertQuery(Root.self, \"(%@ IN \\(name))\", values[0], count: 1) {\n            lhs($0).contains(values[0])\n        }\n        assertQuery(Root.self, \"(%@ IN \\(name))\", values[2], count: 0) {\n            lhs($0).contains(values[2])\n        }\n\n        assertQuery(Root.self, \"(NOT %@ IN \\(name))\", values[0], count: 0) {\n            !lhs($0).contains(values[0])\n        }\n        assertQuery(Root.self, \"(NOT %@ IN \\(name))\", values[2], count: 1) {\n            !lhs($0).contains(values[2])\n        }\n    }\n    private func validateCollectionContainsNil<Root: Object, T: RealmCollection>(_ name: String, _ lhs: (Query<Root>) -> Query<T>)\n            where T.Element: QueryValue & ExpressibleByNilLiteral {\n        assertQuery(Root.self, \"(%@ IN \\(name))\", NSNull(), count: 0) {\n            lhs($0).contains(nil)\n        }\n        assertQuery(Root.self, \"(NOT %@ IN \\(name))\", NSNull(), count: 1) {\n            !lhs($0).contains(nil)\n        }\n    }\n    private func validateCollectionContains<Root: Object, T: RealmKeyedCollection>(_ name: String, _ lhs: (Query<Root>) -> Query<T>)\n            where T.Value: QueryValue {\n        let values = T.Value.queryValues()\n\n        assertQuery(Root.self, \"(%@ IN \\(name))\", values[0], count: 1) {\n            lhs($0).contains(values[0])\n        }\n        assertQuery(Root.self, \"(%@ IN \\(name))\", values[2], count: 0) {\n            lhs($0).contains(values[2])\n        }\n\n        assertQuery(Root.self, \"(NOT %@ IN \\(name))\", values[0], count: 0) {\n            !lhs($0).contains(values[0])\n        }\n        assertQuery(Root.self, \"(NOT %@ IN \\(name))\", values[2], count: 1) {\n            !lhs($0).contains(values[2])\n        }\n    }\n    private func validateCollectionContainsNil<Root: Object, T: RealmKeyedCollection>(_ name: String, _ lhs: (Query<Root>) -> Query<T>)\n            where T.Value: QueryValue & ExpressibleByNilLiteral {\n        assertQuery(Root.self, \"(%@ IN \\(name))\", NSNull(), count: 0) {\n            lhs($0).contains(nil)\n        }\n        assertQuery(Root.self, \"(NOT %@ IN \\(name))\", NSNull(), count: 1) {\n            !lhs($0).contains(nil)\n        }\n    }\n\n    func testCollectionContainsElement() {\n        validateCollectionContains(\"arrayBool\", \\Query<ModernAllTypesObject>.arrayBool)\n        validateCollectionContains(\"arrayInt\", \\Query<ModernAllTypesObject>.arrayInt)\n        validateCollectionContains(\"arrayInt8\", \\Query<ModernAllTypesObject>.arrayInt8)\n        validateCollectionContains(\"arrayInt16\", \\Query<ModernAllTypesObject>.arrayInt16)\n        validateCollectionContains(\"arrayInt32\", \\Query<ModernAllTypesObject>.arrayInt32)\n        validateCollectionContains(\"arrayInt64\", \\Query<ModernAllTypesObject>.arrayInt64)\n        validateCollectionContains(\"arrayFloat\", \\Query<ModernAllTypesObject>.arrayFloat)\n        validateCollectionContains(\"arrayDouble\", \\Query<ModernAllTypesObject>.arrayDouble)\n        validateCollectionContains(\"arrayString\", \\Query<ModernAllTypesObject>.arrayString)\n        validateCollectionContains(\"arrayBinary\", \\Query<ModernAllTypesObject>.arrayBinary)\n        validateCollectionContains(\"arrayDate\", \\Query<ModernAllTypesObject>.arrayDate)\n        validateCollectionContains(\"arrayDecimal\", \\Query<ModernAllTypesObject>.arrayDecimal)\n        validateCollectionContains(\"arrayObjectId\", \\Query<ModernAllTypesObject>.arrayObjectId)\n        validateCollectionContains(\"arrayUuid\", \\Query<ModernAllTypesObject>.arrayUuid)\n        validateCollectionContains(\"arrayAny\", \\Query<ModernAllTypesObject>.arrayAny)\n        validateCollectionContains(\"listInt\", \\Query<ModernCollectionsOfEnums>.listInt)\n        validateCollectionContains(\"listInt8\", \\Query<ModernCollectionsOfEnums>.listInt8)\n        validateCollectionContains(\"listInt16\", \\Query<ModernCollectionsOfEnums>.listInt16)\n        validateCollectionContains(\"listInt32\", \\Query<ModernCollectionsOfEnums>.listInt32)\n        validateCollectionContains(\"listInt64\", \\Query<ModernCollectionsOfEnums>.listInt64)\n        validateCollectionContains(\"listFloat\", \\Query<ModernCollectionsOfEnums>.listFloat)\n        validateCollectionContains(\"listDouble\", \\Query<ModernCollectionsOfEnums>.listDouble)\n        validateCollectionContains(\"listString\", \\Query<ModernCollectionsOfEnums>.listString)\n        validateCollectionContains(\"listBool\", \\Query<CustomPersistableCollections>.listBool)\n        validateCollectionContains(\"listInt\", \\Query<CustomPersistableCollections>.listInt)\n        validateCollectionContains(\"listInt8\", \\Query<CustomPersistableCollections>.listInt8)\n        validateCollectionContains(\"listInt16\", \\Query<CustomPersistableCollections>.listInt16)\n        validateCollectionContains(\"listInt32\", \\Query<CustomPersistableCollections>.listInt32)\n        validateCollectionContains(\"listInt64\", \\Query<CustomPersistableCollections>.listInt64)\n        validateCollectionContains(\"listFloat\", \\Query<CustomPersistableCollections>.listFloat)\n        validateCollectionContains(\"listDouble\", \\Query<CustomPersistableCollections>.listDouble)\n        validateCollectionContains(\"listString\", \\Query<CustomPersistableCollections>.listString)\n        validateCollectionContains(\"listBinary\", \\Query<CustomPersistableCollections>.listBinary)\n        validateCollectionContains(\"listDate\", \\Query<CustomPersistableCollections>.listDate)\n        validateCollectionContains(\"listDecimal\", \\Query<CustomPersistableCollections>.listDecimal)\n        validateCollectionContains(\"listObjectId\", \\Query<CustomPersistableCollections>.listObjectId)\n        validateCollectionContains(\"listUuid\", \\Query<CustomPersistableCollections>.listUuid)\n        validateCollectionContains(\"arrayOptBool\", \\Query<ModernAllTypesObject>.arrayOptBool)\n        validateCollectionContains(\"arrayOptInt\", \\Query<ModernAllTypesObject>.arrayOptInt)\n        validateCollectionContains(\"arrayOptInt8\", \\Query<ModernAllTypesObject>.arrayOptInt8)\n        validateCollectionContains(\"arrayOptInt16\", \\Query<ModernAllTypesObject>.arrayOptInt16)\n        validateCollectionContains(\"arrayOptInt32\", \\Query<ModernAllTypesObject>.arrayOptInt32)\n        validateCollectionContains(\"arrayOptInt64\", \\Query<ModernAllTypesObject>.arrayOptInt64)\n        validateCollectionContains(\"arrayOptFloat\", \\Query<ModernAllTypesObject>.arrayOptFloat)\n        validateCollectionContains(\"arrayOptDouble\", \\Query<ModernAllTypesObject>.arrayOptDouble)\n        validateCollectionContains(\"arrayOptString\", \\Query<ModernAllTypesObject>.arrayOptString)\n        validateCollectionContains(\"arrayOptBinary\", \\Query<ModernAllTypesObject>.arrayOptBinary)\n        validateCollectionContains(\"arrayOptDate\", \\Query<ModernAllTypesObject>.arrayOptDate)\n        validateCollectionContains(\"arrayOptDecimal\", \\Query<ModernAllTypesObject>.arrayOptDecimal)\n        validateCollectionContains(\"arrayOptObjectId\", \\Query<ModernAllTypesObject>.arrayOptObjectId)\n        validateCollectionContains(\"arrayOptUuid\", \\Query<ModernAllTypesObject>.arrayOptUuid)\n        validateCollectionContains(\"listIntOpt\", \\Query<ModernCollectionsOfEnums>.listIntOpt)\n        validateCollectionContains(\"listInt8Opt\", \\Query<ModernCollectionsOfEnums>.listInt8Opt)\n        validateCollectionContains(\"listInt16Opt\", \\Query<ModernCollectionsOfEnums>.listInt16Opt)\n        validateCollectionContains(\"listInt32Opt\", \\Query<ModernCollectionsOfEnums>.listInt32Opt)\n        validateCollectionContains(\"listInt64Opt\", \\Query<ModernCollectionsOfEnums>.listInt64Opt)\n        validateCollectionContains(\"listFloatOpt\", \\Query<ModernCollectionsOfEnums>.listFloatOpt)\n        validateCollectionContains(\"listDoubleOpt\", \\Query<ModernCollectionsOfEnums>.listDoubleOpt)\n        validateCollectionContains(\"listStringOpt\", \\Query<ModernCollectionsOfEnums>.listStringOpt)\n        validateCollectionContains(\"listOptBool\", \\Query<CustomPersistableCollections>.listOptBool)\n        validateCollectionContains(\"listOptInt\", \\Query<CustomPersistableCollections>.listOptInt)\n        validateCollectionContains(\"listOptInt8\", \\Query<CustomPersistableCollections>.listOptInt8)\n        validateCollectionContains(\"listOptInt16\", \\Query<CustomPersistableCollections>.listOptInt16)\n        validateCollectionContains(\"listOptInt32\", \\Query<CustomPersistableCollections>.listOptInt32)\n        validateCollectionContains(\"listOptInt64\", \\Query<CustomPersistableCollections>.listOptInt64)\n        validateCollectionContains(\"listOptFloat\", \\Query<CustomPersistableCollections>.listOptFloat)\n        validateCollectionContains(\"listOptDouble\", \\Query<CustomPersistableCollections>.listOptDouble)\n        validateCollectionContains(\"listOptString\", \\Query<CustomPersistableCollections>.listOptString)\n        validateCollectionContains(\"listOptBinary\", \\Query<CustomPersistableCollections>.listOptBinary)\n        validateCollectionContains(\"listOptDate\", \\Query<CustomPersistableCollections>.listOptDate)\n        validateCollectionContains(\"listOptDecimal\", \\Query<CustomPersistableCollections>.listOptDecimal)\n        validateCollectionContains(\"listOptObjectId\", \\Query<CustomPersistableCollections>.listOptObjectId)\n        validateCollectionContains(\"listOptUuid\", \\Query<CustomPersistableCollections>.listOptUuid)\n        validateCollectionContains(\"setBool\", \\Query<ModernAllTypesObject>.setBool)\n        validateCollectionContains(\"setInt\", \\Query<ModernAllTypesObject>.setInt)\n        validateCollectionContains(\"setInt8\", \\Query<ModernAllTypesObject>.setInt8)\n        validateCollectionContains(\"setInt16\", \\Query<ModernAllTypesObject>.setInt16)\n        validateCollectionContains(\"setInt32\", \\Query<ModernAllTypesObject>.setInt32)\n        validateCollectionContains(\"setInt64\", \\Query<ModernAllTypesObject>.setInt64)\n        validateCollectionContains(\"setFloat\", \\Query<ModernAllTypesObject>.setFloat)\n        validateCollectionContains(\"setDouble\", \\Query<ModernAllTypesObject>.setDouble)\n        validateCollectionContains(\"setString\", \\Query<ModernAllTypesObject>.setString)\n        validateCollectionContains(\"setBinary\", \\Query<ModernAllTypesObject>.setBinary)\n        validateCollectionContains(\"setDate\", \\Query<ModernAllTypesObject>.setDate)\n        validateCollectionContains(\"setDecimal\", \\Query<ModernAllTypesObject>.setDecimal)\n        validateCollectionContains(\"setObjectId\", \\Query<ModernAllTypesObject>.setObjectId)\n        validateCollectionContains(\"setUuid\", \\Query<ModernAllTypesObject>.setUuid)\n        validateCollectionContains(\"setAny\", \\Query<ModernAllTypesObject>.setAny)\n        validateCollectionContains(\"setInt\", \\Query<ModernCollectionsOfEnums>.setInt)\n        validateCollectionContains(\"setInt8\", \\Query<ModernCollectionsOfEnums>.setInt8)\n        validateCollectionContains(\"setInt16\", \\Query<ModernCollectionsOfEnums>.setInt16)\n        validateCollectionContains(\"setInt32\", \\Query<ModernCollectionsOfEnums>.setInt32)\n        validateCollectionContains(\"setInt64\", \\Query<ModernCollectionsOfEnums>.setInt64)\n        validateCollectionContains(\"setFloat\", \\Query<ModernCollectionsOfEnums>.setFloat)\n        validateCollectionContains(\"setDouble\", \\Query<ModernCollectionsOfEnums>.setDouble)\n        validateCollectionContains(\"setString\", \\Query<ModernCollectionsOfEnums>.setString)\n        validateCollectionContains(\"setBool\", \\Query<CustomPersistableCollections>.setBool)\n        validateCollectionContains(\"setInt\", \\Query<CustomPersistableCollections>.setInt)\n        validateCollectionContains(\"setInt8\", \\Query<CustomPersistableCollections>.setInt8)\n        validateCollectionContains(\"setInt16\", \\Query<CustomPersistableCollections>.setInt16)\n        validateCollectionContains(\"setInt32\", \\Query<CustomPersistableCollections>.setInt32)\n        validateCollectionContains(\"setInt64\", \\Query<CustomPersistableCollections>.setInt64)\n        validateCollectionContains(\"setFloat\", \\Query<CustomPersistableCollections>.setFloat)\n        validateCollectionContains(\"setDouble\", \\Query<CustomPersistableCollections>.setDouble)\n        validateCollectionContains(\"setString\", \\Query<CustomPersistableCollections>.setString)\n        validateCollectionContains(\"setBinary\", \\Query<CustomPersistableCollections>.setBinary)\n        validateCollectionContains(\"setDate\", \\Query<CustomPersistableCollections>.setDate)\n        validateCollectionContains(\"setDecimal\", \\Query<CustomPersistableCollections>.setDecimal)\n        validateCollectionContains(\"setObjectId\", \\Query<CustomPersistableCollections>.setObjectId)\n        validateCollectionContains(\"setUuid\", \\Query<CustomPersistableCollections>.setUuid)\n        validateCollectionContains(\"setOptBool\", \\Query<ModernAllTypesObject>.setOptBool)\n        validateCollectionContains(\"setOptInt\", \\Query<ModernAllTypesObject>.setOptInt)\n        validateCollectionContains(\"setOptInt8\", \\Query<ModernAllTypesObject>.setOptInt8)\n        validateCollectionContains(\"setOptInt16\", \\Query<ModernAllTypesObject>.setOptInt16)\n        validateCollectionContains(\"setOptInt32\", \\Query<ModernAllTypesObject>.setOptInt32)\n        validateCollectionContains(\"setOptInt64\", \\Query<ModernAllTypesObject>.setOptInt64)\n        validateCollectionContains(\"setOptFloat\", \\Query<ModernAllTypesObject>.setOptFloat)\n        validateCollectionContains(\"setOptDouble\", \\Query<ModernAllTypesObject>.setOptDouble)\n        validateCollectionContains(\"setOptString\", \\Query<ModernAllTypesObject>.setOptString)\n        validateCollectionContains(\"setOptBinary\", \\Query<ModernAllTypesObject>.setOptBinary)\n        validateCollectionContains(\"setOptDate\", \\Query<ModernAllTypesObject>.setOptDate)\n        validateCollectionContains(\"setOptDecimal\", \\Query<ModernAllTypesObject>.setOptDecimal)\n        validateCollectionContains(\"setOptObjectId\", \\Query<ModernAllTypesObject>.setOptObjectId)\n        validateCollectionContains(\"setOptUuid\", \\Query<ModernAllTypesObject>.setOptUuid)\n        validateCollectionContains(\"setIntOpt\", \\Query<ModernCollectionsOfEnums>.setIntOpt)\n        validateCollectionContains(\"setInt8Opt\", \\Query<ModernCollectionsOfEnums>.setInt8Opt)\n        validateCollectionContains(\"setInt16Opt\", \\Query<ModernCollectionsOfEnums>.setInt16Opt)\n        validateCollectionContains(\"setInt32Opt\", \\Query<ModernCollectionsOfEnums>.setInt32Opt)\n        validateCollectionContains(\"setInt64Opt\", \\Query<ModernCollectionsOfEnums>.setInt64Opt)\n        validateCollectionContains(\"setFloatOpt\", \\Query<ModernCollectionsOfEnums>.setFloatOpt)\n        validateCollectionContains(\"setDoubleOpt\", \\Query<ModernCollectionsOfEnums>.setDoubleOpt)\n        validateCollectionContains(\"setStringOpt\", \\Query<ModernCollectionsOfEnums>.setStringOpt)\n        validateCollectionContains(\"setOptBool\", \\Query<CustomPersistableCollections>.setOptBool)\n        validateCollectionContains(\"setOptInt\", \\Query<CustomPersistableCollections>.setOptInt)\n        validateCollectionContains(\"setOptInt8\", \\Query<CustomPersistableCollections>.setOptInt8)\n        validateCollectionContains(\"setOptInt16\", \\Query<CustomPersistableCollections>.setOptInt16)\n        validateCollectionContains(\"setOptInt32\", \\Query<CustomPersistableCollections>.setOptInt32)\n        validateCollectionContains(\"setOptInt64\", \\Query<CustomPersistableCollections>.setOptInt64)\n        validateCollectionContains(\"setOptFloat\", \\Query<CustomPersistableCollections>.setOptFloat)\n        validateCollectionContains(\"setOptDouble\", \\Query<CustomPersistableCollections>.setOptDouble)\n        validateCollectionContains(\"setOptString\", \\Query<CustomPersistableCollections>.setOptString)\n        validateCollectionContains(\"setOptBinary\", \\Query<CustomPersistableCollections>.setOptBinary)\n        validateCollectionContains(\"setOptDate\", \\Query<CustomPersistableCollections>.setOptDate)\n        validateCollectionContains(\"setOptDecimal\", \\Query<CustomPersistableCollections>.setOptDecimal)\n        validateCollectionContains(\"setOptObjectId\", \\Query<CustomPersistableCollections>.setOptObjectId)\n        validateCollectionContains(\"setOptUuid\", \\Query<CustomPersistableCollections>.setOptUuid)\n        validateCollectionContains(\"mapBool\", \\Query<ModernAllTypesObject>.mapBool)\n        validateCollectionContains(\"mapInt\", \\Query<ModernAllTypesObject>.mapInt)\n        validateCollectionContains(\"mapInt8\", \\Query<ModernAllTypesObject>.mapInt8)\n        validateCollectionContains(\"mapInt16\", \\Query<ModernAllTypesObject>.mapInt16)\n        validateCollectionContains(\"mapInt32\", \\Query<ModernAllTypesObject>.mapInt32)\n        validateCollectionContains(\"mapInt64\", \\Query<ModernAllTypesObject>.mapInt64)\n        validateCollectionContains(\"mapFloat\", \\Query<ModernAllTypesObject>.mapFloat)\n        validateCollectionContains(\"mapDouble\", \\Query<ModernAllTypesObject>.mapDouble)\n        validateCollectionContains(\"mapString\", \\Query<ModernAllTypesObject>.mapString)\n        validateCollectionContains(\"mapBinary\", \\Query<ModernAllTypesObject>.mapBinary)\n        validateCollectionContains(\"mapDate\", \\Query<ModernAllTypesObject>.mapDate)\n        validateCollectionContains(\"mapDecimal\", \\Query<ModernAllTypesObject>.mapDecimal)\n        validateCollectionContains(\"mapObjectId\", \\Query<ModernAllTypesObject>.mapObjectId)\n        validateCollectionContains(\"mapUuid\", \\Query<ModernAllTypesObject>.mapUuid)\n        validateCollectionContains(\"mapAny\", \\Query<ModernAllTypesObject>.mapAny)\n        validateCollectionContains(\"mapInt\", \\Query<ModernCollectionsOfEnums>.mapInt)\n        validateCollectionContains(\"mapInt8\", \\Query<ModernCollectionsOfEnums>.mapInt8)\n        validateCollectionContains(\"mapInt16\", \\Query<ModernCollectionsOfEnums>.mapInt16)\n        validateCollectionContains(\"mapInt32\", \\Query<ModernCollectionsOfEnums>.mapInt32)\n        validateCollectionContains(\"mapInt64\", \\Query<ModernCollectionsOfEnums>.mapInt64)\n        validateCollectionContains(\"mapFloat\", \\Query<ModernCollectionsOfEnums>.mapFloat)\n        validateCollectionContains(\"mapDouble\", \\Query<ModernCollectionsOfEnums>.mapDouble)\n        validateCollectionContains(\"mapString\", \\Query<ModernCollectionsOfEnums>.mapString)\n        validateCollectionContains(\"mapBool\", \\Query<CustomPersistableCollections>.mapBool)\n        validateCollectionContains(\"mapInt\", \\Query<CustomPersistableCollections>.mapInt)\n        validateCollectionContains(\"mapInt8\", \\Query<CustomPersistableCollections>.mapInt8)\n        validateCollectionContains(\"mapInt16\", \\Query<CustomPersistableCollections>.mapInt16)\n        validateCollectionContains(\"mapInt32\", \\Query<CustomPersistableCollections>.mapInt32)\n        validateCollectionContains(\"mapInt64\", \\Query<CustomPersistableCollections>.mapInt64)\n        validateCollectionContains(\"mapFloat\", \\Query<CustomPersistableCollections>.mapFloat)\n        validateCollectionContains(\"mapDouble\", \\Query<CustomPersistableCollections>.mapDouble)\n        validateCollectionContains(\"mapString\", \\Query<CustomPersistableCollections>.mapString)\n        validateCollectionContains(\"mapBinary\", \\Query<CustomPersistableCollections>.mapBinary)\n        validateCollectionContains(\"mapDate\", \\Query<CustomPersistableCollections>.mapDate)\n        validateCollectionContains(\"mapDecimal\", \\Query<CustomPersistableCollections>.mapDecimal)\n        validateCollectionContains(\"mapObjectId\", \\Query<CustomPersistableCollections>.mapObjectId)\n        validateCollectionContains(\"mapUuid\", \\Query<CustomPersistableCollections>.mapUuid)\n        validateCollectionContains(\"mapOptBool\", \\Query<ModernAllTypesObject>.mapOptBool)\n        validateCollectionContains(\"mapOptInt\", \\Query<ModernAllTypesObject>.mapOptInt)\n        validateCollectionContains(\"mapOptInt8\", \\Query<ModernAllTypesObject>.mapOptInt8)\n        validateCollectionContains(\"mapOptInt16\", \\Query<ModernAllTypesObject>.mapOptInt16)\n        validateCollectionContains(\"mapOptInt32\", \\Query<ModernAllTypesObject>.mapOptInt32)\n        validateCollectionContains(\"mapOptInt64\", \\Query<ModernAllTypesObject>.mapOptInt64)\n        validateCollectionContains(\"mapOptFloat\", \\Query<ModernAllTypesObject>.mapOptFloat)\n        validateCollectionContains(\"mapOptDouble\", \\Query<ModernAllTypesObject>.mapOptDouble)\n        validateCollectionContains(\"mapOptString\", \\Query<ModernAllTypesObject>.mapOptString)\n        validateCollectionContains(\"mapOptBinary\", \\Query<ModernAllTypesObject>.mapOptBinary)\n        validateCollectionContains(\"mapOptDate\", \\Query<ModernAllTypesObject>.mapOptDate)\n        validateCollectionContains(\"mapOptDecimal\", \\Query<ModernAllTypesObject>.mapOptDecimal)\n        validateCollectionContains(\"mapOptObjectId\", \\Query<ModernAllTypesObject>.mapOptObjectId)\n        validateCollectionContains(\"mapOptUuid\", \\Query<ModernAllTypesObject>.mapOptUuid)\n        validateCollectionContains(\"mapIntOpt\", \\Query<ModernCollectionsOfEnums>.mapIntOpt)\n        validateCollectionContains(\"mapInt8Opt\", \\Query<ModernCollectionsOfEnums>.mapInt8Opt)\n        validateCollectionContains(\"mapInt16Opt\", \\Query<ModernCollectionsOfEnums>.mapInt16Opt)\n        validateCollectionContains(\"mapInt32Opt\", \\Query<ModernCollectionsOfEnums>.mapInt32Opt)\n        validateCollectionContains(\"mapInt64Opt\", \\Query<ModernCollectionsOfEnums>.mapInt64Opt)\n        validateCollectionContains(\"mapFloatOpt\", \\Query<ModernCollectionsOfEnums>.mapFloatOpt)\n        validateCollectionContains(\"mapDoubleOpt\", \\Query<ModernCollectionsOfEnums>.mapDoubleOpt)\n        validateCollectionContains(\"mapStringOpt\", \\Query<ModernCollectionsOfEnums>.mapStringOpt)\n        validateCollectionContains(\"mapOptBool\", \\Query<CustomPersistableCollections>.mapOptBool)\n        validateCollectionContains(\"mapOptInt\", \\Query<CustomPersistableCollections>.mapOptInt)\n        validateCollectionContains(\"mapOptInt8\", \\Query<CustomPersistableCollections>.mapOptInt8)\n        validateCollectionContains(\"mapOptInt16\", \\Query<CustomPersistableCollections>.mapOptInt16)\n        validateCollectionContains(\"mapOptInt32\", \\Query<CustomPersistableCollections>.mapOptInt32)\n        validateCollectionContains(\"mapOptInt64\", \\Query<CustomPersistableCollections>.mapOptInt64)\n        validateCollectionContains(\"mapOptFloat\", \\Query<CustomPersistableCollections>.mapOptFloat)\n        validateCollectionContains(\"mapOptDouble\", \\Query<CustomPersistableCollections>.mapOptDouble)\n        validateCollectionContains(\"mapOptString\", \\Query<CustomPersistableCollections>.mapOptString)\n        validateCollectionContains(\"mapOptBinary\", \\Query<CustomPersistableCollections>.mapOptBinary)\n        validateCollectionContains(\"mapOptDate\", \\Query<CustomPersistableCollections>.mapOptDate)\n        validateCollectionContains(\"mapOptDecimal\", \\Query<CustomPersistableCollections>.mapOptDecimal)\n        validateCollectionContains(\"mapOptObjectId\", \\Query<CustomPersistableCollections>.mapOptObjectId)\n        validateCollectionContains(\"mapOptUuid\", \\Query<CustomPersistableCollections>.mapOptUuid)\n\n        validateCollectionContainsNil(\"arrayOptBool\", \\Query<ModernAllTypesObject>.arrayOptBool)\n        validateCollectionContainsNil(\"arrayOptInt\", \\Query<ModernAllTypesObject>.arrayOptInt)\n        validateCollectionContainsNil(\"arrayOptInt8\", \\Query<ModernAllTypesObject>.arrayOptInt8)\n        validateCollectionContainsNil(\"arrayOptInt16\", \\Query<ModernAllTypesObject>.arrayOptInt16)\n        validateCollectionContainsNil(\"arrayOptInt32\", \\Query<ModernAllTypesObject>.arrayOptInt32)\n        validateCollectionContainsNil(\"arrayOptInt64\", \\Query<ModernAllTypesObject>.arrayOptInt64)\n        validateCollectionContainsNil(\"arrayOptFloat\", \\Query<ModernAllTypesObject>.arrayOptFloat)\n        validateCollectionContainsNil(\"arrayOptDouble\", \\Query<ModernAllTypesObject>.arrayOptDouble)\n        validateCollectionContainsNil(\"arrayOptString\", \\Query<ModernAllTypesObject>.arrayOptString)\n        validateCollectionContainsNil(\"arrayOptBinary\", \\Query<ModernAllTypesObject>.arrayOptBinary)\n        validateCollectionContainsNil(\"arrayOptDate\", \\Query<ModernAllTypesObject>.arrayOptDate)\n        validateCollectionContainsNil(\"arrayOptDecimal\", \\Query<ModernAllTypesObject>.arrayOptDecimal)\n        validateCollectionContainsNil(\"arrayOptObjectId\", \\Query<ModernAllTypesObject>.arrayOptObjectId)\n        validateCollectionContainsNil(\"arrayOptUuid\", \\Query<ModernAllTypesObject>.arrayOptUuid)\n        validateCollectionContainsNil(\"listIntOpt\", \\Query<ModernCollectionsOfEnums>.listIntOpt)\n        validateCollectionContainsNil(\"listInt8Opt\", \\Query<ModernCollectionsOfEnums>.listInt8Opt)\n        validateCollectionContainsNil(\"listInt16Opt\", \\Query<ModernCollectionsOfEnums>.listInt16Opt)\n        validateCollectionContainsNil(\"listInt32Opt\", \\Query<ModernCollectionsOfEnums>.listInt32Opt)\n        validateCollectionContainsNil(\"listInt64Opt\", \\Query<ModernCollectionsOfEnums>.listInt64Opt)\n        validateCollectionContainsNil(\"listFloatOpt\", \\Query<ModernCollectionsOfEnums>.listFloatOpt)\n        validateCollectionContainsNil(\"listDoubleOpt\", \\Query<ModernCollectionsOfEnums>.listDoubleOpt)\n        validateCollectionContainsNil(\"listStringOpt\", \\Query<ModernCollectionsOfEnums>.listStringOpt)\n        validateCollectionContainsNil(\"listOptBool\", \\Query<CustomPersistableCollections>.listOptBool)\n        validateCollectionContainsNil(\"listOptInt\", \\Query<CustomPersistableCollections>.listOptInt)\n        validateCollectionContainsNil(\"listOptInt8\", \\Query<CustomPersistableCollections>.listOptInt8)\n        validateCollectionContainsNil(\"listOptInt16\", \\Query<CustomPersistableCollections>.listOptInt16)\n        validateCollectionContainsNil(\"listOptInt32\", \\Query<CustomPersistableCollections>.listOptInt32)\n        validateCollectionContainsNil(\"listOptInt64\", \\Query<CustomPersistableCollections>.listOptInt64)\n        validateCollectionContainsNil(\"listOptFloat\", \\Query<CustomPersistableCollections>.listOptFloat)\n        validateCollectionContainsNil(\"listOptDouble\", \\Query<CustomPersistableCollections>.listOptDouble)\n        validateCollectionContainsNil(\"listOptString\", \\Query<CustomPersistableCollections>.listOptString)\n        validateCollectionContainsNil(\"listOptBinary\", \\Query<CustomPersistableCollections>.listOptBinary)\n        validateCollectionContainsNil(\"listOptDate\", \\Query<CustomPersistableCollections>.listOptDate)\n        validateCollectionContainsNil(\"listOptDecimal\", \\Query<CustomPersistableCollections>.listOptDecimal)\n        validateCollectionContainsNil(\"listOptObjectId\", \\Query<CustomPersistableCollections>.listOptObjectId)\n        validateCollectionContainsNil(\"listOptUuid\", \\Query<CustomPersistableCollections>.listOptUuid)\n        validateCollectionContainsNil(\"setOptBool\", \\Query<ModernAllTypesObject>.setOptBool)\n        validateCollectionContainsNil(\"setOptInt\", \\Query<ModernAllTypesObject>.setOptInt)\n        validateCollectionContainsNil(\"setOptInt8\", \\Query<ModernAllTypesObject>.setOptInt8)\n        validateCollectionContainsNil(\"setOptInt16\", \\Query<ModernAllTypesObject>.setOptInt16)\n        validateCollectionContainsNil(\"setOptInt32\", \\Query<ModernAllTypesObject>.setOptInt32)\n        validateCollectionContainsNil(\"setOptInt64\", \\Query<ModernAllTypesObject>.setOptInt64)\n        validateCollectionContainsNil(\"setOptFloat\", \\Query<ModernAllTypesObject>.setOptFloat)\n        validateCollectionContainsNil(\"setOptDouble\", \\Query<ModernAllTypesObject>.setOptDouble)\n        validateCollectionContainsNil(\"setOptString\", \\Query<ModernAllTypesObject>.setOptString)\n        validateCollectionContainsNil(\"setOptBinary\", \\Query<ModernAllTypesObject>.setOptBinary)\n        validateCollectionContainsNil(\"setOptDate\", \\Query<ModernAllTypesObject>.setOptDate)\n        validateCollectionContainsNil(\"setOptDecimal\", \\Query<ModernAllTypesObject>.setOptDecimal)\n        validateCollectionContainsNil(\"setOptObjectId\", \\Query<ModernAllTypesObject>.setOptObjectId)\n        validateCollectionContainsNil(\"setOptUuid\", \\Query<ModernAllTypesObject>.setOptUuid)\n        validateCollectionContainsNil(\"setIntOpt\", \\Query<ModernCollectionsOfEnums>.setIntOpt)\n        validateCollectionContainsNil(\"setInt8Opt\", \\Query<ModernCollectionsOfEnums>.setInt8Opt)\n        validateCollectionContainsNil(\"setInt16Opt\", \\Query<ModernCollectionsOfEnums>.setInt16Opt)\n        validateCollectionContainsNil(\"setInt32Opt\", \\Query<ModernCollectionsOfEnums>.setInt32Opt)\n        validateCollectionContainsNil(\"setInt64Opt\", \\Query<ModernCollectionsOfEnums>.setInt64Opt)\n        validateCollectionContainsNil(\"setFloatOpt\", \\Query<ModernCollectionsOfEnums>.setFloatOpt)\n        validateCollectionContainsNil(\"setDoubleOpt\", \\Query<ModernCollectionsOfEnums>.setDoubleOpt)\n        validateCollectionContainsNil(\"setStringOpt\", \\Query<ModernCollectionsOfEnums>.setStringOpt)\n        validateCollectionContainsNil(\"setOptBool\", \\Query<CustomPersistableCollections>.setOptBool)\n        validateCollectionContainsNil(\"setOptInt\", \\Query<CustomPersistableCollections>.setOptInt)\n        validateCollectionContainsNil(\"setOptInt8\", \\Query<CustomPersistableCollections>.setOptInt8)\n        validateCollectionContainsNil(\"setOptInt16\", \\Query<CustomPersistableCollections>.setOptInt16)\n        validateCollectionContainsNil(\"setOptInt32\", \\Query<CustomPersistableCollections>.setOptInt32)\n        validateCollectionContainsNil(\"setOptInt64\", \\Query<CustomPersistableCollections>.setOptInt64)\n        validateCollectionContainsNil(\"setOptFloat\", \\Query<CustomPersistableCollections>.setOptFloat)\n        validateCollectionContainsNil(\"setOptDouble\", \\Query<CustomPersistableCollections>.setOptDouble)\n        validateCollectionContainsNil(\"setOptString\", \\Query<CustomPersistableCollections>.setOptString)\n        validateCollectionContainsNil(\"setOptBinary\", \\Query<CustomPersistableCollections>.setOptBinary)\n        validateCollectionContainsNil(\"setOptDate\", \\Query<CustomPersistableCollections>.setOptDate)\n        validateCollectionContainsNil(\"setOptDecimal\", \\Query<CustomPersistableCollections>.setOptDecimal)\n        validateCollectionContainsNil(\"setOptObjectId\", \\Query<CustomPersistableCollections>.setOptObjectId)\n        validateCollectionContainsNil(\"setOptUuid\", \\Query<CustomPersistableCollections>.setOptUuid)\n        validateCollectionContainsNil(\"mapOptBool\", \\Query<ModernAllTypesObject>.mapOptBool)\n        validateCollectionContainsNil(\"mapOptInt\", \\Query<ModernAllTypesObject>.mapOptInt)\n        validateCollectionContainsNil(\"mapOptInt8\", \\Query<ModernAllTypesObject>.mapOptInt8)\n        validateCollectionContainsNil(\"mapOptInt16\", \\Query<ModernAllTypesObject>.mapOptInt16)\n        validateCollectionContainsNil(\"mapOptInt32\", \\Query<ModernAllTypesObject>.mapOptInt32)\n        validateCollectionContainsNil(\"mapOptInt64\", \\Query<ModernAllTypesObject>.mapOptInt64)\n        validateCollectionContainsNil(\"mapOptFloat\", \\Query<ModernAllTypesObject>.mapOptFloat)\n        validateCollectionContainsNil(\"mapOptDouble\", \\Query<ModernAllTypesObject>.mapOptDouble)\n        validateCollectionContainsNil(\"mapOptString\", \\Query<ModernAllTypesObject>.mapOptString)\n        validateCollectionContainsNil(\"mapOptBinary\", \\Query<ModernAllTypesObject>.mapOptBinary)\n        validateCollectionContainsNil(\"mapOptDate\", \\Query<ModernAllTypesObject>.mapOptDate)\n        validateCollectionContainsNil(\"mapOptDecimal\", \\Query<ModernAllTypesObject>.mapOptDecimal)\n        validateCollectionContainsNil(\"mapOptObjectId\", \\Query<ModernAllTypesObject>.mapOptObjectId)\n        validateCollectionContainsNil(\"mapOptUuid\", \\Query<ModernAllTypesObject>.mapOptUuid)\n        validateCollectionContainsNil(\"mapIntOpt\", \\Query<ModernCollectionsOfEnums>.mapIntOpt)\n        validateCollectionContainsNil(\"mapInt8Opt\", \\Query<ModernCollectionsOfEnums>.mapInt8Opt)\n        validateCollectionContainsNil(\"mapInt16Opt\", \\Query<ModernCollectionsOfEnums>.mapInt16Opt)\n        validateCollectionContainsNil(\"mapInt32Opt\", \\Query<ModernCollectionsOfEnums>.mapInt32Opt)\n        validateCollectionContainsNil(\"mapInt64Opt\", \\Query<ModernCollectionsOfEnums>.mapInt64Opt)\n        validateCollectionContainsNil(\"mapFloatOpt\", \\Query<ModernCollectionsOfEnums>.mapFloatOpt)\n        validateCollectionContainsNil(\"mapDoubleOpt\", \\Query<ModernCollectionsOfEnums>.mapDoubleOpt)\n        validateCollectionContainsNil(\"mapStringOpt\", \\Query<ModernCollectionsOfEnums>.mapStringOpt)\n        validateCollectionContainsNil(\"mapOptBool\", \\Query<CustomPersistableCollections>.mapOptBool)\n        validateCollectionContainsNil(\"mapOptInt\", \\Query<CustomPersistableCollections>.mapOptInt)\n        validateCollectionContainsNil(\"mapOptInt8\", \\Query<CustomPersistableCollections>.mapOptInt8)\n        validateCollectionContainsNil(\"mapOptInt16\", \\Query<CustomPersistableCollections>.mapOptInt16)\n        validateCollectionContainsNil(\"mapOptInt32\", \\Query<CustomPersistableCollections>.mapOptInt32)\n        validateCollectionContainsNil(\"mapOptInt64\", \\Query<CustomPersistableCollections>.mapOptInt64)\n        validateCollectionContainsNil(\"mapOptFloat\", \\Query<CustomPersistableCollections>.mapOptFloat)\n        validateCollectionContainsNil(\"mapOptDouble\", \\Query<CustomPersistableCollections>.mapOptDouble)\n        validateCollectionContainsNil(\"mapOptString\", \\Query<CustomPersistableCollections>.mapOptString)\n        validateCollectionContainsNil(\"mapOptBinary\", \\Query<CustomPersistableCollections>.mapOptBinary)\n        validateCollectionContainsNil(\"mapOptDate\", \\Query<CustomPersistableCollections>.mapOptDate)\n        validateCollectionContainsNil(\"mapOptDecimal\", \\Query<CustomPersistableCollections>.mapOptDecimal)\n        validateCollectionContainsNil(\"mapOptObjectId\", \\Query<CustomPersistableCollections>.mapOptObjectId)\n        validateCollectionContainsNil(\"mapOptUuid\", \\Query<CustomPersistableCollections>.mapOptUuid)\n    }\n\n    func testListContainsObject() {\n        let obj = objects().first!\n        let colObj = collectionObject()\n        let result = realm.objects(ModernCollectionObject.self).where {\n            $0.list.contains(obj)\n        }\n        XCTAssertEqual(result.count, 0)\n        try! realm.write {\n            colObj.list.append(obj)\n        }\n        XCTAssertEqual(result.count, 1)\n    }\n\n    func testCollectionContainsRange() {\n        assertQuery(ModernAllTypesObject.self, \"((arrayInt.@min >= %@) && (arrayInt.@max <= %@))\",\n                    values: [1, 3], count: 1) {\n            $0.arrayInt.contains(1...3)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayInt.@min >= %@) && (arrayInt.@max < %@))\",\n                    values: [1, 3], count: 0) {\n            $0.arrayInt.contains(1..<3)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayInt8.@min >= %@) && (arrayInt8.@max <= %@))\",\n                    values: [Int8(8), Int8(9)], count: 1) {\n            $0.arrayInt8.contains(Int8(8)...Int8(9))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayInt8.@min >= %@) && (arrayInt8.@max < %@))\",\n                    values: [Int8(8), Int8(9)], count: 0) {\n            $0.arrayInt8.contains(Int8(8)..<Int8(9))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayInt16.@min >= %@) && (arrayInt16.@max <= %@))\",\n                    values: [Int16(16), Int16(17)], count: 1) {\n            $0.arrayInt16.contains(Int16(16)...Int16(17))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayInt16.@min >= %@) && (arrayInt16.@max < %@))\",\n                    values: [Int16(16), Int16(17)], count: 0) {\n            $0.arrayInt16.contains(Int16(16)..<Int16(17))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayInt32.@min >= %@) && (arrayInt32.@max <= %@))\",\n                    values: [Int32(32), Int32(33)], count: 1) {\n            $0.arrayInt32.contains(Int32(32)...Int32(33))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayInt32.@min >= %@) && (arrayInt32.@max < %@))\",\n                    values: [Int32(32), Int32(33)], count: 0) {\n            $0.arrayInt32.contains(Int32(32)..<Int32(33))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayInt64.@min >= %@) && (arrayInt64.@max <= %@))\",\n                    values: [Int64(64), Int64(65)], count: 1) {\n            $0.arrayInt64.contains(Int64(64)...Int64(65))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayInt64.@min >= %@) && (arrayInt64.@max < %@))\",\n                    values: [Int64(64), Int64(65)], count: 0) {\n            $0.arrayInt64.contains(Int64(64)..<Int64(65))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayFloat.@min >= %@) && (arrayFloat.@max <= %@))\",\n                    values: [Float(5.55444333), Float(6.55444333)], count: 1) {\n            $0.arrayFloat.contains(Float(5.55444333)...Float(6.55444333))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayFloat.@min >= %@) && (arrayFloat.@max < %@))\",\n                    values: [Float(5.55444333), Float(6.55444333)], count: 0) {\n            $0.arrayFloat.contains(Float(5.55444333)..<Float(6.55444333))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayDouble.@min >= %@) && (arrayDouble.@max <= %@))\",\n                    values: [123.456, 234.567], count: 1) {\n            $0.arrayDouble.contains(123.456...234.567)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayDouble.@min >= %@) && (arrayDouble.@max < %@))\",\n                    values: [123.456, 234.567], count: 0) {\n            $0.arrayDouble.contains(123.456..<234.567)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayDate.@min >= %@) && (arrayDate.@max <= %@))\",\n                    values: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)], count: 1) {\n            $0.arrayDate.contains(Date(timeIntervalSince1970: 1000000)...Date(timeIntervalSince1970: 2000000))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayDate.@min >= %@) && (arrayDate.@max < %@))\",\n                    values: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)], count: 0) {\n            $0.arrayDate.contains(Date(timeIntervalSince1970: 1000000)..<Date(timeIntervalSince1970: 2000000))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayDecimal.@min >= %@) && (arrayDecimal.@max <= %@))\",\n                    values: [Decimal128(123.456), Decimal128(234.567)], count: 1) {\n            $0.arrayDecimal.contains(Decimal128(123.456)...Decimal128(234.567))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayDecimal.@min >= %@) && (arrayDecimal.@max < %@))\",\n                    values: [Decimal128(123.456), Decimal128(234.567)], count: 0) {\n            $0.arrayDecimal.contains(Decimal128(123.456)..<Decimal128(234.567))\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listInt.@min >= %@) && (listInt.@max <= %@))\",\n                    values: [EnumInt.value1.rawValue, EnumInt.value2.rawValue], count: 1) {\n            $0.listInt.rawValue.contains(EnumInt.value1.rawValue...EnumInt.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listInt.@min >= %@) && (listInt.@max < %@))\",\n                    values: [EnumInt.value1.rawValue, EnumInt.value2.rawValue], count: 0) {\n            $0.listInt.rawValue.contains(EnumInt.value1.rawValue..<EnumInt.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listInt8.@min >= %@) && (listInt8.@max <= %@))\",\n                    values: [EnumInt8.value1.rawValue, EnumInt8.value2.rawValue], count: 1) {\n            $0.listInt8.rawValue.contains(EnumInt8.value1.rawValue...EnumInt8.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listInt8.@min >= %@) && (listInt8.@max < %@))\",\n                    values: [EnumInt8.value1.rawValue, EnumInt8.value2.rawValue], count: 0) {\n            $0.listInt8.rawValue.contains(EnumInt8.value1.rawValue..<EnumInt8.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listInt16.@min >= %@) && (listInt16.@max <= %@))\",\n                    values: [EnumInt16.value1.rawValue, EnumInt16.value2.rawValue], count: 1) {\n            $0.listInt16.rawValue.contains(EnumInt16.value1.rawValue...EnumInt16.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listInt16.@min >= %@) && (listInt16.@max < %@))\",\n                    values: [EnumInt16.value1.rawValue, EnumInt16.value2.rawValue], count: 0) {\n            $0.listInt16.rawValue.contains(EnumInt16.value1.rawValue..<EnumInt16.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listInt32.@min >= %@) && (listInt32.@max <= %@))\",\n                    values: [EnumInt32.value1.rawValue, EnumInt32.value2.rawValue], count: 1) {\n            $0.listInt32.rawValue.contains(EnumInt32.value1.rawValue...EnumInt32.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listInt32.@min >= %@) && (listInt32.@max < %@))\",\n                    values: [EnumInt32.value1.rawValue, EnumInt32.value2.rawValue], count: 0) {\n            $0.listInt32.rawValue.contains(EnumInt32.value1.rawValue..<EnumInt32.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listInt64.@min >= %@) && (listInt64.@max <= %@))\",\n                    values: [EnumInt64.value1.rawValue, EnumInt64.value2.rawValue], count: 1) {\n            $0.listInt64.rawValue.contains(EnumInt64.value1.rawValue...EnumInt64.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listInt64.@min >= %@) && (listInt64.@max < %@))\",\n                    values: [EnumInt64.value1.rawValue, EnumInt64.value2.rawValue], count: 0) {\n            $0.listInt64.rawValue.contains(EnumInt64.value1.rawValue..<EnumInt64.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listFloat.@min >= %@) && (listFloat.@max <= %@))\",\n                    values: [EnumFloat.value1.rawValue, EnumFloat.value2.rawValue], count: 1) {\n            $0.listFloat.rawValue.contains(EnumFloat.value1.rawValue...EnumFloat.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listFloat.@min >= %@) && (listFloat.@max < %@))\",\n                    values: [EnumFloat.value1.rawValue, EnumFloat.value2.rawValue], count: 0) {\n            $0.listFloat.rawValue.contains(EnumFloat.value1.rawValue..<EnumFloat.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listDouble.@min >= %@) && (listDouble.@max <= %@))\",\n                    values: [EnumDouble.value1.rawValue, EnumDouble.value2.rawValue], count: 1) {\n            $0.listDouble.rawValue.contains(EnumDouble.value1.rawValue...EnumDouble.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listDouble.@min >= %@) && (listDouble.@max < %@))\",\n                    values: [EnumDouble.value1.rawValue, EnumDouble.value2.rawValue], count: 0) {\n            $0.listDouble.rawValue.contains(EnumDouble.value1.rawValue..<EnumDouble.value2.rawValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listInt.@min >= %@) && (listInt.@max <= %@))\",\n                    values: [IntWrapper(persistedValue: 1).persistableValue, IntWrapper(persistedValue: 3).persistableValue], count: 1) {\n            $0.listInt.persistableValue.contains(IntWrapper(persistedValue: 1).persistableValue...IntWrapper(persistedValue: 3).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listInt.@min >= %@) && (listInt.@max < %@))\",\n                    values: [IntWrapper(persistedValue: 1).persistableValue, IntWrapper(persistedValue: 3).persistableValue], count: 0) {\n            $0.listInt.persistableValue.contains(IntWrapper(persistedValue: 1).persistableValue..<IntWrapper(persistedValue: 3).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listInt8.@min >= %@) && (listInt8.@max <= %@))\",\n                    values: [Int8Wrapper(persistedValue: Int8(8)).persistableValue, Int8Wrapper(persistedValue: Int8(9)).persistableValue], count: 1) {\n            $0.listInt8.persistableValue.contains(Int8Wrapper(persistedValue: Int8(8)).persistableValue...Int8Wrapper(persistedValue: Int8(9)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listInt8.@min >= %@) && (listInt8.@max < %@))\",\n                    values: [Int8Wrapper(persistedValue: Int8(8)).persistableValue, Int8Wrapper(persistedValue: Int8(9)).persistableValue], count: 0) {\n            $0.listInt8.persistableValue.contains(Int8Wrapper(persistedValue: Int8(8)).persistableValue..<Int8Wrapper(persistedValue: Int8(9)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listInt16.@min >= %@) && (listInt16.@max <= %@))\",\n                    values: [Int16Wrapper(persistedValue: Int16(16)).persistableValue, Int16Wrapper(persistedValue: Int16(17)).persistableValue], count: 1) {\n            $0.listInt16.persistableValue.contains(Int16Wrapper(persistedValue: Int16(16)).persistableValue...Int16Wrapper(persistedValue: Int16(17)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listInt16.@min >= %@) && (listInt16.@max < %@))\",\n                    values: [Int16Wrapper(persistedValue: Int16(16)).persistableValue, Int16Wrapper(persistedValue: Int16(17)).persistableValue], count: 0) {\n            $0.listInt16.persistableValue.contains(Int16Wrapper(persistedValue: Int16(16)).persistableValue..<Int16Wrapper(persistedValue: Int16(17)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listInt32.@min >= %@) && (listInt32.@max <= %@))\",\n                    values: [Int32Wrapper(persistedValue: Int32(32)).persistableValue, Int32Wrapper(persistedValue: Int32(33)).persistableValue], count: 1) {\n            $0.listInt32.persistableValue.contains(Int32Wrapper(persistedValue: Int32(32)).persistableValue...Int32Wrapper(persistedValue: Int32(33)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listInt32.@min >= %@) && (listInt32.@max < %@))\",\n                    values: [Int32Wrapper(persistedValue: Int32(32)).persistableValue, Int32Wrapper(persistedValue: Int32(33)).persistableValue], count: 0) {\n            $0.listInt32.persistableValue.contains(Int32Wrapper(persistedValue: Int32(32)).persistableValue..<Int32Wrapper(persistedValue: Int32(33)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listInt64.@min >= %@) && (listInt64.@max <= %@))\",\n                    values: [Int64Wrapper(persistedValue: Int64(64)).persistableValue, Int64Wrapper(persistedValue: Int64(65)).persistableValue], count: 1) {\n            $0.listInt64.persistableValue.contains(Int64Wrapper(persistedValue: Int64(64)).persistableValue...Int64Wrapper(persistedValue: Int64(65)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listInt64.@min >= %@) && (listInt64.@max < %@))\",\n                    values: [Int64Wrapper(persistedValue: Int64(64)).persistableValue, Int64Wrapper(persistedValue: Int64(65)).persistableValue], count: 0) {\n            $0.listInt64.persistableValue.contains(Int64Wrapper(persistedValue: Int64(64)).persistableValue..<Int64Wrapper(persistedValue: Int64(65)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listFloat.@min >= %@) && (listFloat.@max <= %@))\",\n                    values: [FloatWrapper(persistedValue: Float(5.55444333)).persistableValue, FloatWrapper(persistedValue: Float(6.55444333)).persistableValue], count: 1) {\n            $0.listFloat.persistableValue.contains(FloatWrapper(persistedValue: Float(5.55444333)).persistableValue...FloatWrapper(persistedValue: Float(6.55444333)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listFloat.@min >= %@) && (listFloat.@max < %@))\",\n                    values: [FloatWrapper(persistedValue: Float(5.55444333)).persistableValue, FloatWrapper(persistedValue: Float(6.55444333)).persistableValue], count: 0) {\n            $0.listFloat.persistableValue.contains(FloatWrapper(persistedValue: Float(5.55444333)).persistableValue..<FloatWrapper(persistedValue: Float(6.55444333)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listDouble.@min >= %@) && (listDouble.@max <= %@))\",\n                    values: [DoubleWrapper(persistedValue: 123.456).persistableValue, DoubleWrapper(persistedValue: 234.567).persistableValue], count: 1) {\n            $0.listDouble.persistableValue.contains(DoubleWrapper(persistedValue: 123.456).persistableValue...DoubleWrapper(persistedValue: 234.567).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listDouble.@min >= %@) && (listDouble.@max < %@))\",\n                    values: [DoubleWrapper(persistedValue: 123.456).persistableValue, DoubleWrapper(persistedValue: 234.567).persistableValue], count: 0) {\n            $0.listDouble.persistableValue.contains(DoubleWrapper(persistedValue: 123.456).persistableValue..<DoubleWrapper(persistedValue: 234.567).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listDate.@min >= %@) && (listDate.@max <= %@))\",\n                    values: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue], count: 1) {\n            $0.listDate.persistableValue.contains(DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue...DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listDate.@min >= %@) && (listDate.@max < %@))\",\n                    values: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue], count: 0) {\n            $0.listDate.persistableValue.contains(DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue..<DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listDecimal.@min >= %@) && (listDecimal.@max <= %@))\",\n                    values: [Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue, Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue], count: 1) {\n            $0.listDecimal.persistableValue.contains(Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue...Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listDecimal.@min >= %@) && (listDecimal.@max < %@))\",\n                    values: [Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue, Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue], count: 0) {\n            $0.listDecimal.persistableValue.contains(Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue..<Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayOptInt.@min >= %@) && (arrayOptInt.@max <= %@))\",\n                    values: [1, 3], count: 1) {\n            $0.arrayOptInt.contains(1...3)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayOptInt.@min >= %@) && (arrayOptInt.@max < %@))\",\n                    values: [1, 3], count: 0) {\n            $0.arrayOptInt.contains(1..<3)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayOptInt8.@min >= %@) && (arrayOptInt8.@max <= %@))\",\n                    values: [Int8(8), Int8(9)], count: 1) {\n            $0.arrayOptInt8.contains(Int8(8)...Int8(9))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayOptInt8.@min >= %@) && (arrayOptInt8.@max < %@))\",\n                    values: [Int8(8), Int8(9)], count: 0) {\n            $0.arrayOptInt8.contains(Int8(8)..<Int8(9))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayOptInt16.@min >= %@) && (arrayOptInt16.@max <= %@))\",\n                    values: [Int16(16), Int16(17)], count: 1) {\n            $0.arrayOptInt16.contains(Int16(16)...Int16(17))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayOptInt16.@min >= %@) && (arrayOptInt16.@max < %@))\",\n                    values: [Int16(16), Int16(17)], count: 0) {\n            $0.arrayOptInt16.contains(Int16(16)..<Int16(17))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayOptInt32.@min >= %@) && (arrayOptInt32.@max <= %@))\",\n                    values: [Int32(32), Int32(33)], count: 1) {\n            $0.arrayOptInt32.contains(Int32(32)...Int32(33))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayOptInt32.@min >= %@) && (arrayOptInt32.@max < %@))\",\n                    values: [Int32(32), Int32(33)], count: 0) {\n            $0.arrayOptInt32.contains(Int32(32)..<Int32(33))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayOptInt64.@min >= %@) && (arrayOptInt64.@max <= %@))\",\n                    values: [Int64(64), Int64(65)], count: 1) {\n            $0.arrayOptInt64.contains(Int64(64)...Int64(65))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayOptInt64.@min >= %@) && (arrayOptInt64.@max < %@))\",\n                    values: [Int64(64), Int64(65)], count: 0) {\n            $0.arrayOptInt64.contains(Int64(64)..<Int64(65))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayOptFloat.@min >= %@) && (arrayOptFloat.@max <= %@))\",\n                    values: [Float(5.55444333), Float(6.55444333)], count: 1) {\n            $0.arrayOptFloat.contains(Float(5.55444333)...Float(6.55444333))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayOptFloat.@min >= %@) && (arrayOptFloat.@max < %@))\",\n                    values: [Float(5.55444333), Float(6.55444333)], count: 0) {\n            $0.arrayOptFloat.contains(Float(5.55444333)..<Float(6.55444333))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayOptDouble.@min >= %@) && (arrayOptDouble.@max <= %@))\",\n                    values: [123.456, 234.567], count: 1) {\n            $0.arrayOptDouble.contains(123.456...234.567)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayOptDouble.@min >= %@) && (arrayOptDouble.@max < %@))\",\n                    values: [123.456, 234.567], count: 0) {\n            $0.arrayOptDouble.contains(123.456..<234.567)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayOptDate.@min >= %@) && (arrayOptDate.@max <= %@))\",\n                    values: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)], count: 1) {\n            $0.arrayOptDate.contains(Date(timeIntervalSince1970: 1000000)...Date(timeIntervalSince1970: 2000000))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayOptDate.@min >= %@) && (arrayOptDate.@max < %@))\",\n                    values: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)], count: 0) {\n            $0.arrayOptDate.contains(Date(timeIntervalSince1970: 1000000)..<Date(timeIntervalSince1970: 2000000))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayOptDecimal.@min >= %@) && (arrayOptDecimal.@max <= %@))\",\n                    values: [Decimal128(123.456), Decimal128(234.567)], count: 1) {\n            $0.arrayOptDecimal.contains(Decimal128(123.456)...Decimal128(234.567))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((arrayOptDecimal.@min >= %@) && (arrayOptDecimal.@max < %@))\",\n                    values: [Decimal128(123.456), Decimal128(234.567)], count: 0) {\n            $0.arrayOptDecimal.contains(Decimal128(123.456)..<Decimal128(234.567))\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listIntOpt.@min >= %@) && (listIntOpt.@max <= %@))\",\n                    values: [EnumInt.value1.rawValue, EnumInt.value2.rawValue], count: 1) {\n            $0.listIntOpt.rawValue.contains(EnumInt.value1.rawValue...EnumInt.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listIntOpt.@min >= %@) && (listIntOpt.@max < %@))\",\n                    values: [EnumInt.value1.rawValue, EnumInt.value2.rawValue], count: 0) {\n            $0.listIntOpt.rawValue.contains(EnumInt.value1.rawValue..<EnumInt.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listInt8Opt.@min >= %@) && (listInt8Opt.@max <= %@))\",\n                    values: [EnumInt8.value1.rawValue, EnumInt8.value2.rawValue], count: 1) {\n            $0.listInt8Opt.rawValue.contains(EnumInt8.value1.rawValue...EnumInt8.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listInt8Opt.@min >= %@) && (listInt8Opt.@max < %@))\",\n                    values: [EnumInt8.value1.rawValue, EnumInt8.value2.rawValue], count: 0) {\n            $0.listInt8Opt.rawValue.contains(EnumInt8.value1.rawValue..<EnumInt8.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listInt16Opt.@min >= %@) && (listInt16Opt.@max <= %@))\",\n                    values: [EnumInt16.value1.rawValue, EnumInt16.value2.rawValue], count: 1) {\n            $0.listInt16Opt.rawValue.contains(EnumInt16.value1.rawValue...EnumInt16.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listInt16Opt.@min >= %@) && (listInt16Opt.@max < %@))\",\n                    values: [EnumInt16.value1.rawValue, EnumInt16.value2.rawValue], count: 0) {\n            $0.listInt16Opt.rawValue.contains(EnumInt16.value1.rawValue..<EnumInt16.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listInt32Opt.@min >= %@) && (listInt32Opt.@max <= %@))\",\n                    values: [EnumInt32.value1.rawValue, EnumInt32.value2.rawValue], count: 1) {\n            $0.listInt32Opt.rawValue.contains(EnumInt32.value1.rawValue...EnumInt32.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listInt32Opt.@min >= %@) && (listInt32Opt.@max < %@))\",\n                    values: [EnumInt32.value1.rawValue, EnumInt32.value2.rawValue], count: 0) {\n            $0.listInt32Opt.rawValue.contains(EnumInt32.value1.rawValue..<EnumInt32.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listInt64Opt.@min >= %@) && (listInt64Opt.@max <= %@))\",\n                    values: [EnumInt64.value1.rawValue, EnumInt64.value2.rawValue], count: 1) {\n            $0.listInt64Opt.rawValue.contains(EnumInt64.value1.rawValue...EnumInt64.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listInt64Opt.@min >= %@) && (listInt64Opt.@max < %@))\",\n                    values: [EnumInt64.value1.rawValue, EnumInt64.value2.rawValue], count: 0) {\n            $0.listInt64Opt.rawValue.contains(EnumInt64.value1.rawValue..<EnumInt64.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listFloatOpt.@min >= %@) && (listFloatOpt.@max <= %@))\",\n                    values: [EnumFloat.value1.rawValue, EnumFloat.value2.rawValue], count: 1) {\n            $0.listFloatOpt.rawValue.contains(EnumFloat.value1.rawValue...EnumFloat.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listFloatOpt.@min >= %@) && (listFloatOpt.@max < %@))\",\n                    values: [EnumFloat.value1.rawValue, EnumFloat.value2.rawValue], count: 0) {\n            $0.listFloatOpt.rawValue.contains(EnumFloat.value1.rawValue..<EnumFloat.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listDoubleOpt.@min >= %@) && (listDoubleOpt.@max <= %@))\",\n                    values: [EnumDouble.value1.rawValue, EnumDouble.value2.rawValue], count: 1) {\n            $0.listDoubleOpt.rawValue.contains(EnumDouble.value1.rawValue...EnumDouble.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((listDoubleOpt.@min >= %@) && (listDoubleOpt.@max < %@))\",\n                    values: [EnumDouble.value1.rawValue, EnumDouble.value2.rawValue], count: 0) {\n            $0.listDoubleOpt.rawValue.contains(EnumDouble.value1.rawValue..<EnumDouble.value2.rawValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listOptInt.@min >= %@) && (listOptInt.@max <= %@))\",\n                    values: [IntWrapper(persistedValue: 1).persistableValue, IntWrapper(persistedValue: 3).persistableValue], count: 1) {\n            $0.listOptInt.persistableValue.contains(IntWrapper(persistedValue: 1).persistableValue...IntWrapper(persistedValue: 3).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listOptInt.@min >= %@) && (listOptInt.@max < %@))\",\n                    values: [IntWrapper(persistedValue: 1).persistableValue, IntWrapper(persistedValue: 3).persistableValue], count: 0) {\n            $0.listOptInt.persistableValue.contains(IntWrapper(persistedValue: 1).persistableValue..<IntWrapper(persistedValue: 3).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listOptInt8.@min >= %@) && (listOptInt8.@max <= %@))\",\n                    values: [Int8Wrapper(persistedValue: Int8(8)).persistableValue, Int8Wrapper(persistedValue: Int8(9)).persistableValue], count: 1) {\n            $0.listOptInt8.persistableValue.contains(Int8Wrapper(persistedValue: Int8(8)).persistableValue...Int8Wrapper(persistedValue: Int8(9)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listOptInt8.@min >= %@) && (listOptInt8.@max < %@))\",\n                    values: [Int8Wrapper(persistedValue: Int8(8)).persistableValue, Int8Wrapper(persistedValue: Int8(9)).persistableValue], count: 0) {\n            $0.listOptInt8.persistableValue.contains(Int8Wrapper(persistedValue: Int8(8)).persistableValue..<Int8Wrapper(persistedValue: Int8(9)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listOptInt16.@min >= %@) && (listOptInt16.@max <= %@))\",\n                    values: [Int16Wrapper(persistedValue: Int16(16)).persistableValue, Int16Wrapper(persistedValue: Int16(17)).persistableValue], count: 1) {\n            $0.listOptInt16.persistableValue.contains(Int16Wrapper(persistedValue: Int16(16)).persistableValue...Int16Wrapper(persistedValue: Int16(17)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listOptInt16.@min >= %@) && (listOptInt16.@max < %@))\",\n                    values: [Int16Wrapper(persistedValue: Int16(16)).persistableValue, Int16Wrapper(persistedValue: Int16(17)).persistableValue], count: 0) {\n            $0.listOptInt16.persistableValue.contains(Int16Wrapper(persistedValue: Int16(16)).persistableValue..<Int16Wrapper(persistedValue: Int16(17)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listOptInt32.@min >= %@) && (listOptInt32.@max <= %@))\",\n                    values: [Int32Wrapper(persistedValue: Int32(32)).persistableValue, Int32Wrapper(persistedValue: Int32(33)).persistableValue], count: 1) {\n            $0.listOptInt32.persistableValue.contains(Int32Wrapper(persistedValue: Int32(32)).persistableValue...Int32Wrapper(persistedValue: Int32(33)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listOptInt32.@min >= %@) && (listOptInt32.@max < %@))\",\n                    values: [Int32Wrapper(persistedValue: Int32(32)).persistableValue, Int32Wrapper(persistedValue: Int32(33)).persistableValue], count: 0) {\n            $0.listOptInt32.persistableValue.contains(Int32Wrapper(persistedValue: Int32(32)).persistableValue..<Int32Wrapper(persistedValue: Int32(33)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listOptInt64.@min >= %@) && (listOptInt64.@max <= %@))\",\n                    values: [Int64Wrapper(persistedValue: Int64(64)).persistableValue, Int64Wrapper(persistedValue: Int64(65)).persistableValue], count: 1) {\n            $0.listOptInt64.persistableValue.contains(Int64Wrapper(persistedValue: Int64(64)).persistableValue...Int64Wrapper(persistedValue: Int64(65)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listOptInt64.@min >= %@) && (listOptInt64.@max < %@))\",\n                    values: [Int64Wrapper(persistedValue: Int64(64)).persistableValue, Int64Wrapper(persistedValue: Int64(65)).persistableValue], count: 0) {\n            $0.listOptInt64.persistableValue.contains(Int64Wrapper(persistedValue: Int64(64)).persistableValue..<Int64Wrapper(persistedValue: Int64(65)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listOptFloat.@min >= %@) && (listOptFloat.@max <= %@))\",\n                    values: [FloatWrapper(persistedValue: Float(5.55444333)).persistableValue, FloatWrapper(persistedValue: Float(6.55444333)).persistableValue], count: 1) {\n            $0.listOptFloat.persistableValue.contains(FloatWrapper(persistedValue: Float(5.55444333)).persistableValue...FloatWrapper(persistedValue: Float(6.55444333)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listOptFloat.@min >= %@) && (listOptFloat.@max < %@))\",\n                    values: [FloatWrapper(persistedValue: Float(5.55444333)).persistableValue, FloatWrapper(persistedValue: Float(6.55444333)).persistableValue], count: 0) {\n            $0.listOptFloat.persistableValue.contains(FloatWrapper(persistedValue: Float(5.55444333)).persistableValue..<FloatWrapper(persistedValue: Float(6.55444333)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listOptDouble.@min >= %@) && (listOptDouble.@max <= %@))\",\n                    values: [DoubleWrapper(persistedValue: 123.456).persistableValue, DoubleWrapper(persistedValue: 234.567).persistableValue], count: 1) {\n            $0.listOptDouble.persistableValue.contains(DoubleWrapper(persistedValue: 123.456).persistableValue...DoubleWrapper(persistedValue: 234.567).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listOptDouble.@min >= %@) && (listOptDouble.@max < %@))\",\n                    values: [DoubleWrapper(persistedValue: 123.456).persistableValue, DoubleWrapper(persistedValue: 234.567).persistableValue], count: 0) {\n            $0.listOptDouble.persistableValue.contains(DoubleWrapper(persistedValue: 123.456).persistableValue..<DoubleWrapper(persistedValue: 234.567).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listOptDate.@min >= %@) && (listOptDate.@max <= %@))\",\n                    values: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue], count: 1) {\n            $0.listOptDate.persistableValue.contains(DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue...DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listOptDate.@min >= %@) && (listOptDate.@max < %@))\",\n                    values: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue], count: 0) {\n            $0.listOptDate.persistableValue.contains(DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue..<DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listOptDecimal.@min >= %@) && (listOptDecimal.@max <= %@))\",\n                    values: [Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue, Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue], count: 1) {\n            $0.listOptDecimal.persistableValue.contains(Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue...Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((listOptDecimal.@min >= %@) && (listOptDecimal.@max < %@))\",\n                    values: [Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue, Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue], count: 0) {\n            $0.listOptDecimal.persistableValue.contains(Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue..<Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setInt.@min >= %@) && (setInt.@max <= %@))\",\n                    values: [1, 3], count: 1) {\n            $0.setInt.contains(1...3)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setInt.@min >= %@) && (setInt.@max < %@))\",\n                    values: [1, 3], count: 0) {\n            $0.setInt.contains(1..<3)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setInt8.@min >= %@) && (setInt8.@max <= %@))\",\n                    values: [Int8(8), Int8(9)], count: 1) {\n            $0.setInt8.contains(Int8(8)...Int8(9))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setInt8.@min >= %@) && (setInt8.@max < %@))\",\n                    values: [Int8(8), Int8(9)], count: 0) {\n            $0.setInt8.contains(Int8(8)..<Int8(9))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setInt16.@min >= %@) && (setInt16.@max <= %@))\",\n                    values: [Int16(16), Int16(17)], count: 1) {\n            $0.setInt16.contains(Int16(16)...Int16(17))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setInt16.@min >= %@) && (setInt16.@max < %@))\",\n                    values: [Int16(16), Int16(17)], count: 0) {\n            $0.setInt16.contains(Int16(16)..<Int16(17))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setInt32.@min >= %@) && (setInt32.@max <= %@))\",\n                    values: [Int32(32), Int32(33)], count: 1) {\n            $0.setInt32.contains(Int32(32)...Int32(33))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setInt32.@min >= %@) && (setInt32.@max < %@))\",\n                    values: [Int32(32), Int32(33)], count: 0) {\n            $0.setInt32.contains(Int32(32)..<Int32(33))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setInt64.@min >= %@) && (setInt64.@max <= %@))\",\n                    values: [Int64(64), Int64(65)], count: 1) {\n            $0.setInt64.contains(Int64(64)...Int64(65))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setInt64.@min >= %@) && (setInt64.@max < %@))\",\n                    values: [Int64(64), Int64(65)], count: 0) {\n            $0.setInt64.contains(Int64(64)..<Int64(65))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setFloat.@min >= %@) && (setFloat.@max <= %@))\",\n                    values: [Float(5.55444333), Float(6.55444333)], count: 1) {\n            $0.setFloat.contains(Float(5.55444333)...Float(6.55444333))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setFloat.@min >= %@) && (setFloat.@max < %@))\",\n                    values: [Float(5.55444333), Float(6.55444333)], count: 0) {\n            $0.setFloat.contains(Float(5.55444333)..<Float(6.55444333))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setDouble.@min >= %@) && (setDouble.@max <= %@))\",\n                    values: [123.456, 234.567], count: 1) {\n            $0.setDouble.contains(123.456...234.567)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setDouble.@min >= %@) && (setDouble.@max < %@))\",\n                    values: [123.456, 234.567], count: 0) {\n            $0.setDouble.contains(123.456..<234.567)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setDate.@min >= %@) && (setDate.@max <= %@))\",\n                    values: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)], count: 1) {\n            $0.setDate.contains(Date(timeIntervalSince1970: 1000000)...Date(timeIntervalSince1970: 2000000))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setDate.@min >= %@) && (setDate.@max < %@))\",\n                    values: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)], count: 0) {\n            $0.setDate.contains(Date(timeIntervalSince1970: 1000000)..<Date(timeIntervalSince1970: 2000000))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setDecimal.@min >= %@) && (setDecimal.@max <= %@))\",\n                    values: [Decimal128(123.456), Decimal128(234.567)], count: 1) {\n            $0.setDecimal.contains(Decimal128(123.456)...Decimal128(234.567))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setDecimal.@min >= %@) && (setDecimal.@max < %@))\",\n                    values: [Decimal128(123.456), Decimal128(234.567)], count: 0) {\n            $0.setDecimal.contains(Decimal128(123.456)..<Decimal128(234.567))\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setInt.@min >= %@) && (setInt.@max <= %@))\",\n                    values: [EnumInt.value1.rawValue, EnumInt.value2.rawValue], count: 1) {\n            $0.setInt.rawValue.contains(EnumInt.value1.rawValue...EnumInt.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setInt.@min >= %@) && (setInt.@max < %@))\",\n                    values: [EnumInt.value1.rawValue, EnumInt.value2.rawValue], count: 0) {\n            $0.setInt.rawValue.contains(EnumInt.value1.rawValue..<EnumInt.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setInt8.@min >= %@) && (setInt8.@max <= %@))\",\n                    values: [EnumInt8.value1.rawValue, EnumInt8.value2.rawValue], count: 1) {\n            $0.setInt8.rawValue.contains(EnumInt8.value1.rawValue...EnumInt8.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setInt8.@min >= %@) && (setInt8.@max < %@))\",\n                    values: [EnumInt8.value1.rawValue, EnumInt8.value2.rawValue], count: 0) {\n            $0.setInt8.rawValue.contains(EnumInt8.value1.rawValue..<EnumInt8.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setInt16.@min >= %@) && (setInt16.@max <= %@))\",\n                    values: [EnumInt16.value1.rawValue, EnumInt16.value2.rawValue], count: 1) {\n            $0.setInt16.rawValue.contains(EnumInt16.value1.rawValue...EnumInt16.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setInt16.@min >= %@) && (setInt16.@max < %@))\",\n                    values: [EnumInt16.value1.rawValue, EnumInt16.value2.rawValue], count: 0) {\n            $0.setInt16.rawValue.contains(EnumInt16.value1.rawValue..<EnumInt16.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setInt32.@min >= %@) && (setInt32.@max <= %@))\",\n                    values: [EnumInt32.value1.rawValue, EnumInt32.value2.rawValue], count: 1) {\n            $0.setInt32.rawValue.contains(EnumInt32.value1.rawValue...EnumInt32.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setInt32.@min >= %@) && (setInt32.@max < %@))\",\n                    values: [EnumInt32.value1.rawValue, EnumInt32.value2.rawValue], count: 0) {\n            $0.setInt32.rawValue.contains(EnumInt32.value1.rawValue..<EnumInt32.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setInt64.@min >= %@) && (setInt64.@max <= %@))\",\n                    values: [EnumInt64.value1.rawValue, EnumInt64.value2.rawValue], count: 1) {\n            $0.setInt64.rawValue.contains(EnumInt64.value1.rawValue...EnumInt64.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setInt64.@min >= %@) && (setInt64.@max < %@))\",\n                    values: [EnumInt64.value1.rawValue, EnumInt64.value2.rawValue], count: 0) {\n            $0.setInt64.rawValue.contains(EnumInt64.value1.rawValue..<EnumInt64.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setFloat.@min >= %@) && (setFloat.@max <= %@))\",\n                    values: [EnumFloat.value1.rawValue, EnumFloat.value2.rawValue], count: 1) {\n            $0.setFloat.rawValue.contains(EnumFloat.value1.rawValue...EnumFloat.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setFloat.@min >= %@) && (setFloat.@max < %@))\",\n                    values: [EnumFloat.value1.rawValue, EnumFloat.value2.rawValue], count: 0) {\n            $0.setFloat.rawValue.contains(EnumFloat.value1.rawValue..<EnumFloat.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setDouble.@min >= %@) && (setDouble.@max <= %@))\",\n                    values: [EnumDouble.value1.rawValue, EnumDouble.value2.rawValue], count: 1) {\n            $0.setDouble.rawValue.contains(EnumDouble.value1.rawValue...EnumDouble.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setDouble.@min >= %@) && (setDouble.@max < %@))\",\n                    values: [EnumDouble.value1.rawValue, EnumDouble.value2.rawValue], count: 0) {\n            $0.setDouble.rawValue.contains(EnumDouble.value1.rawValue..<EnumDouble.value2.rawValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setInt.@min >= %@) && (setInt.@max <= %@))\",\n                    values: [IntWrapper(persistedValue: 1).persistableValue, IntWrapper(persistedValue: 3).persistableValue], count: 1) {\n            $0.setInt.persistableValue.contains(IntWrapper(persistedValue: 1).persistableValue...IntWrapper(persistedValue: 3).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setInt.@min >= %@) && (setInt.@max < %@))\",\n                    values: [IntWrapper(persistedValue: 1).persistableValue, IntWrapper(persistedValue: 3).persistableValue], count: 0) {\n            $0.setInt.persistableValue.contains(IntWrapper(persistedValue: 1).persistableValue..<IntWrapper(persistedValue: 3).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setInt8.@min >= %@) && (setInt8.@max <= %@))\",\n                    values: [Int8Wrapper(persistedValue: Int8(8)).persistableValue, Int8Wrapper(persistedValue: Int8(9)).persistableValue], count: 1) {\n            $0.setInt8.persistableValue.contains(Int8Wrapper(persistedValue: Int8(8)).persistableValue...Int8Wrapper(persistedValue: Int8(9)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setInt8.@min >= %@) && (setInt8.@max < %@))\",\n                    values: [Int8Wrapper(persistedValue: Int8(8)).persistableValue, Int8Wrapper(persistedValue: Int8(9)).persistableValue], count: 0) {\n            $0.setInt8.persistableValue.contains(Int8Wrapper(persistedValue: Int8(8)).persistableValue..<Int8Wrapper(persistedValue: Int8(9)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setInt16.@min >= %@) && (setInt16.@max <= %@))\",\n                    values: [Int16Wrapper(persistedValue: Int16(16)).persistableValue, Int16Wrapper(persistedValue: Int16(17)).persistableValue], count: 1) {\n            $0.setInt16.persistableValue.contains(Int16Wrapper(persistedValue: Int16(16)).persistableValue...Int16Wrapper(persistedValue: Int16(17)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setInt16.@min >= %@) && (setInt16.@max < %@))\",\n                    values: [Int16Wrapper(persistedValue: Int16(16)).persistableValue, Int16Wrapper(persistedValue: Int16(17)).persistableValue], count: 0) {\n            $0.setInt16.persistableValue.contains(Int16Wrapper(persistedValue: Int16(16)).persistableValue..<Int16Wrapper(persistedValue: Int16(17)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setInt32.@min >= %@) && (setInt32.@max <= %@))\",\n                    values: [Int32Wrapper(persistedValue: Int32(32)).persistableValue, Int32Wrapper(persistedValue: Int32(33)).persistableValue], count: 1) {\n            $0.setInt32.persistableValue.contains(Int32Wrapper(persistedValue: Int32(32)).persistableValue...Int32Wrapper(persistedValue: Int32(33)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setInt32.@min >= %@) && (setInt32.@max < %@))\",\n                    values: [Int32Wrapper(persistedValue: Int32(32)).persistableValue, Int32Wrapper(persistedValue: Int32(33)).persistableValue], count: 0) {\n            $0.setInt32.persistableValue.contains(Int32Wrapper(persistedValue: Int32(32)).persistableValue..<Int32Wrapper(persistedValue: Int32(33)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setInt64.@min >= %@) && (setInt64.@max <= %@))\",\n                    values: [Int64Wrapper(persistedValue: Int64(64)).persistableValue, Int64Wrapper(persistedValue: Int64(65)).persistableValue], count: 1) {\n            $0.setInt64.persistableValue.contains(Int64Wrapper(persistedValue: Int64(64)).persistableValue...Int64Wrapper(persistedValue: Int64(65)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setInt64.@min >= %@) && (setInt64.@max < %@))\",\n                    values: [Int64Wrapper(persistedValue: Int64(64)).persistableValue, Int64Wrapper(persistedValue: Int64(65)).persistableValue], count: 0) {\n            $0.setInt64.persistableValue.contains(Int64Wrapper(persistedValue: Int64(64)).persistableValue..<Int64Wrapper(persistedValue: Int64(65)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setFloat.@min >= %@) && (setFloat.@max <= %@))\",\n                    values: [FloatWrapper(persistedValue: Float(5.55444333)).persistableValue, FloatWrapper(persistedValue: Float(6.55444333)).persistableValue], count: 1) {\n            $0.setFloat.persistableValue.contains(FloatWrapper(persistedValue: Float(5.55444333)).persistableValue...FloatWrapper(persistedValue: Float(6.55444333)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setFloat.@min >= %@) && (setFloat.@max < %@))\",\n                    values: [FloatWrapper(persistedValue: Float(5.55444333)).persistableValue, FloatWrapper(persistedValue: Float(6.55444333)).persistableValue], count: 0) {\n            $0.setFloat.persistableValue.contains(FloatWrapper(persistedValue: Float(5.55444333)).persistableValue..<FloatWrapper(persistedValue: Float(6.55444333)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setDouble.@min >= %@) && (setDouble.@max <= %@))\",\n                    values: [DoubleWrapper(persistedValue: 123.456).persistableValue, DoubleWrapper(persistedValue: 234.567).persistableValue], count: 1) {\n            $0.setDouble.persistableValue.contains(DoubleWrapper(persistedValue: 123.456).persistableValue...DoubleWrapper(persistedValue: 234.567).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setDouble.@min >= %@) && (setDouble.@max < %@))\",\n                    values: [DoubleWrapper(persistedValue: 123.456).persistableValue, DoubleWrapper(persistedValue: 234.567).persistableValue], count: 0) {\n            $0.setDouble.persistableValue.contains(DoubleWrapper(persistedValue: 123.456).persistableValue..<DoubleWrapper(persistedValue: 234.567).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setDate.@min >= %@) && (setDate.@max <= %@))\",\n                    values: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue], count: 1) {\n            $0.setDate.persistableValue.contains(DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue...DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setDate.@min >= %@) && (setDate.@max < %@))\",\n                    values: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue], count: 0) {\n            $0.setDate.persistableValue.contains(DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue..<DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setDecimal.@min >= %@) && (setDecimal.@max <= %@))\",\n                    values: [Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue, Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue], count: 1) {\n            $0.setDecimal.persistableValue.contains(Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue...Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setDecimal.@min >= %@) && (setDecimal.@max < %@))\",\n                    values: [Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue, Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue], count: 0) {\n            $0.setDecimal.persistableValue.contains(Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue..<Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setOptInt.@min >= %@) && (setOptInt.@max <= %@))\",\n                    values: [1, 3], count: 1) {\n            $0.setOptInt.contains(1...3)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setOptInt.@min >= %@) && (setOptInt.@max < %@))\",\n                    values: [1, 3], count: 0) {\n            $0.setOptInt.contains(1..<3)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setOptInt8.@min >= %@) && (setOptInt8.@max <= %@))\",\n                    values: [Int8(8), Int8(9)], count: 1) {\n            $0.setOptInt8.contains(Int8(8)...Int8(9))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setOptInt8.@min >= %@) && (setOptInt8.@max < %@))\",\n                    values: [Int8(8), Int8(9)], count: 0) {\n            $0.setOptInt8.contains(Int8(8)..<Int8(9))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setOptInt16.@min >= %@) && (setOptInt16.@max <= %@))\",\n                    values: [Int16(16), Int16(17)], count: 1) {\n            $0.setOptInt16.contains(Int16(16)...Int16(17))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setOptInt16.@min >= %@) && (setOptInt16.@max < %@))\",\n                    values: [Int16(16), Int16(17)], count: 0) {\n            $0.setOptInt16.contains(Int16(16)..<Int16(17))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setOptInt32.@min >= %@) && (setOptInt32.@max <= %@))\",\n                    values: [Int32(32), Int32(33)], count: 1) {\n            $0.setOptInt32.contains(Int32(32)...Int32(33))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setOptInt32.@min >= %@) && (setOptInt32.@max < %@))\",\n                    values: [Int32(32), Int32(33)], count: 0) {\n            $0.setOptInt32.contains(Int32(32)..<Int32(33))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setOptInt64.@min >= %@) && (setOptInt64.@max <= %@))\",\n                    values: [Int64(64), Int64(65)], count: 1) {\n            $0.setOptInt64.contains(Int64(64)...Int64(65))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setOptInt64.@min >= %@) && (setOptInt64.@max < %@))\",\n                    values: [Int64(64), Int64(65)], count: 0) {\n            $0.setOptInt64.contains(Int64(64)..<Int64(65))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setOptFloat.@min >= %@) && (setOptFloat.@max <= %@))\",\n                    values: [Float(5.55444333), Float(6.55444333)], count: 1) {\n            $0.setOptFloat.contains(Float(5.55444333)...Float(6.55444333))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setOptFloat.@min >= %@) && (setOptFloat.@max < %@))\",\n                    values: [Float(5.55444333), Float(6.55444333)], count: 0) {\n            $0.setOptFloat.contains(Float(5.55444333)..<Float(6.55444333))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setOptDouble.@min >= %@) && (setOptDouble.@max <= %@))\",\n                    values: [123.456, 234.567], count: 1) {\n            $0.setOptDouble.contains(123.456...234.567)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setOptDouble.@min >= %@) && (setOptDouble.@max < %@))\",\n                    values: [123.456, 234.567], count: 0) {\n            $0.setOptDouble.contains(123.456..<234.567)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setOptDate.@min >= %@) && (setOptDate.@max <= %@))\",\n                    values: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)], count: 1) {\n            $0.setOptDate.contains(Date(timeIntervalSince1970: 1000000)...Date(timeIntervalSince1970: 2000000))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setOptDate.@min >= %@) && (setOptDate.@max < %@))\",\n                    values: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)], count: 0) {\n            $0.setOptDate.contains(Date(timeIntervalSince1970: 1000000)..<Date(timeIntervalSince1970: 2000000))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setOptDecimal.@min >= %@) && (setOptDecimal.@max <= %@))\",\n                    values: [Decimal128(123.456), Decimal128(234.567)], count: 1) {\n            $0.setOptDecimal.contains(Decimal128(123.456)...Decimal128(234.567))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((setOptDecimal.@min >= %@) && (setOptDecimal.@max < %@))\",\n                    values: [Decimal128(123.456), Decimal128(234.567)], count: 0) {\n            $0.setOptDecimal.contains(Decimal128(123.456)..<Decimal128(234.567))\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setIntOpt.@min >= %@) && (setIntOpt.@max <= %@))\",\n                    values: [EnumInt.value1.rawValue, EnumInt.value2.rawValue], count: 1) {\n            $0.setIntOpt.rawValue.contains(EnumInt.value1.rawValue...EnumInt.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setIntOpt.@min >= %@) && (setIntOpt.@max < %@))\",\n                    values: [EnumInt.value1.rawValue, EnumInt.value2.rawValue], count: 0) {\n            $0.setIntOpt.rawValue.contains(EnumInt.value1.rawValue..<EnumInt.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setInt8Opt.@min >= %@) && (setInt8Opt.@max <= %@))\",\n                    values: [EnumInt8.value1.rawValue, EnumInt8.value2.rawValue], count: 1) {\n            $0.setInt8Opt.rawValue.contains(EnumInt8.value1.rawValue...EnumInt8.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setInt8Opt.@min >= %@) && (setInt8Opt.@max < %@))\",\n                    values: [EnumInt8.value1.rawValue, EnumInt8.value2.rawValue], count: 0) {\n            $0.setInt8Opt.rawValue.contains(EnumInt8.value1.rawValue..<EnumInt8.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setInt16Opt.@min >= %@) && (setInt16Opt.@max <= %@))\",\n                    values: [EnumInt16.value1.rawValue, EnumInt16.value2.rawValue], count: 1) {\n            $0.setInt16Opt.rawValue.contains(EnumInt16.value1.rawValue...EnumInt16.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setInt16Opt.@min >= %@) && (setInt16Opt.@max < %@))\",\n                    values: [EnumInt16.value1.rawValue, EnumInt16.value2.rawValue], count: 0) {\n            $0.setInt16Opt.rawValue.contains(EnumInt16.value1.rawValue..<EnumInt16.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setInt32Opt.@min >= %@) && (setInt32Opt.@max <= %@))\",\n                    values: [EnumInt32.value1.rawValue, EnumInt32.value2.rawValue], count: 1) {\n            $0.setInt32Opt.rawValue.contains(EnumInt32.value1.rawValue...EnumInt32.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setInt32Opt.@min >= %@) && (setInt32Opt.@max < %@))\",\n                    values: [EnumInt32.value1.rawValue, EnumInt32.value2.rawValue], count: 0) {\n            $0.setInt32Opt.rawValue.contains(EnumInt32.value1.rawValue..<EnumInt32.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setInt64Opt.@min >= %@) && (setInt64Opt.@max <= %@))\",\n                    values: [EnumInt64.value1.rawValue, EnumInt64.value2.rawValue], count: 1) {\n            $0.setInt64Opt.rawValue.contains(EnumInt64.value1.rawValue...EnumInt64.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setInt64Opt.@min >= %@) && (setInt64Opt.@max < %@))\",\n                    values: [EnumInt64.value1.rawValue, EnumInt64.value2.rawValue], count: 0) {\n            $0.setInt64Opt.rawValue.contains(EnumInt64.value1.rawValue..<EnumInt64.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setFloatOpt.@min >= %@) && (setFloatOpt.@max <= %@))\",\n                    values: [EnumFloat.value1.rawValue, EnumFloat.value2.rawValue], count: 1) {\n            $0.setFloatOpt.rawValue.contains(EnumFloat.value1.rawValue...EnumFloat.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setFloatOpt.@min >= %@) && (setFloatOpt.@max < %@))\",\n                    values: [EnumFloat.value1.rawValue, EnumFloat.value2.rawValue], count: 0) {\n            $0.setFloatOpt.rawValue.contains(EnumFloat.value1.rawValue..<EnumFloat.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setDoubleOpt.@min >= %@) && (setDoubleOpt.@max <= %@))\",\n                    values: [EnumDouble.value1.rawValue, EnumDouble.value2.rawValue], count: 1) {\n            $0.setDoubleOpt.rawValue.contains(EnumDouble.value1.rawValue...EnumDouble.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((setDoubleOpt.@min >= %@) && (setDoubleOpt.@max < %@))\",\n                    values: [EnumDouble.value1.rawValue, EnumDouble.value2.rawValue], count: 0) {\n            $0.setDoubleOpt.rawValue.contains(EnumDouble.value1.rawValue..<EnumDouble.value2.rawValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setOptInt.@min >= %@) && (setOptInt.@max <= %@))\",\n                    values: [IntWrapper(persistedValue: 1).persistableValue, IntWrapper(persistedValue: 3).persistableValue], count: 1) {\n            $0.setOptInt.persistableValue.contains(IntWrapper(persistedValue: 1).persistableValue...IntWrapper(persistedValue: 3).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setOptInt.@min >= %@) && (setOptInt.@max < %@))\",\n                    values: [IntWrapper(persistedValue: 1).persistableValue, IntWrapper(persistedValue: 3).persistableValue], count: 0) {\n            $0.setOptInt.persistableValue.contains(IntWrapper(persistedValue: 1).persistableValue..<IntWrapper(persistedValue: 3).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setOptInt8.@min >= %@) && (setOptInt8.@max <= %@))\",\n                    values: [Int8Wrapper(persistedValue: Int8(8)).persistableValue, Int8Wrapper(persistedValue: Int8(9)).persistableValue], count: 1) {\n            $0.setOptInt8.persistableValue.contains(Int8Wrapper(persistedValue: Int8(8)).persistableValue...Int8Wrapper(persistedValue: Int8(9)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setOptInt8.@min >= %@) && (setOptInt8.@max < %@))\",\n                    values: [Int8Wrapper(persistedValue: Int8(8)).persistableValue, Int8Wrapper(persistedValue: Int8(9)).persistableValue], count: 0) {\n            $0.setOptInt8.persistableValue.contains(Int8Wrapper(persistedValue: Int8(8)).persistableValue..<Int8Wrapper(persistedValue: Int8(9)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setOptInt16.@min >= %@) && (setOptInt16.@max <= %@))\",\n                    values: [Int16Wrapper(persistedValue: Int16(16)).persistableValue, Int16Wrapper(persistedValue: Int16(17)).persistableValue], count: 1) {\n            $0.setOptInt16.persistableValue.contains(Int16Wrapper(persistedValue: Int16(16)).persistableValue...Int16Wrapper(persistedValue: Int16(17)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setOptInt16.@min >= %@) && (setOptInt16.@max < %@))\",\n                    values: [Int16Wrapper(persistedValue: Int16(16)).persistableValue, Int16Wrapper(persistedValue: Int16(17)).persistableValue], count: 0) {\n            $0.setOptInt16.persistableValue.contains(Int16Wrapper(persistedValue: Int16(16)).persistableValue..<Int16Wrapper(persistedValue: Int16(17)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setOptInt32.@min >= %@) && (setOptInt32.@max <= %@))\",\n                    values: [Int32Wrapper(persistedValue: Int32(32)).persistableValue, Int32Wrapper(persistedValue: Int32(33)).persistableValue], count: 1) {\n            $0.setOptInt32.persistableValue.contains(Int32Wrapper(persistedValue: Int32(32)).persistableValue...Int32Wrapper(persistedValue: Int32(33)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setOptInt32.@min >= %@) && (setOptInt32.@max < %@))\",\n                    values: [Int32Wrapper(persistedValue: Int32(32)).persistableValue, Int32Wrapper(persistedValue: Int32(33)).persistableValue], count: 0) {\n            $0.setOptInt32.persistableValue.contains(Int32Wrapper(persistedValue: Int32(32)).persistableValue..<Int32Wrapper(persistedValue: Int32(33)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setOptInt64.@min >= %@) && (setOptInt64.@max <= %@))\",\n                    values: [Int64Wrapper(persistedValue: Int64(64)).persistableValue, Int64Wrapper(persistedValue: Int64(65)).persistableValue], count: 1) {\n            $0.setOptInt64.persistableValue.contains(Int64Wrapper(persistedValue: Int64(64)).persistableValue...Int64Wrapper(persistedValue: Int64(65)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setOptInt64.@min >= %@) && (setOptInt64.@max < %@))\",\n                    values: [Int64Wrapper(persistedValue: Int64(64)).persistableValue, Int64Wrapper(persistedValue: Int64(65)).persistableValue], count: 0) {\n            $0.setOptInt64.persistableValue.contains(Int64Wrapper(persistedValue: Int64(64)).persistableValue..<Int64Wrapper(persistedValue: Int64(65)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setOptFloat.@min >= %@) && (setOptFloat.@max <= %@))\",\n                    values: [FloatWrapper(persistedValue: Float(5.55444333)).persistableValue, FloatWrapper(persistedValue: Float(6.55444333)).persistableValue], count: 1) {\n            $0.setOptFloat.persistableValue.contains(FloatWrapper(persistedValue: Float(5.55444333)).persistableValue...FloatWrapper(persistedValue: Float(6.55444333)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setOptFloat.@min >= %@) && (setOptFloat.@max < %@))\",\n                    values: [FloatWrapper(persistedValue: Float(5.55444333)).persistableValue, FloatWrapper(persistedValue: Float(6.55444333)).persistableValue], count: 0) {\n            $0.setOptFloat.persistableValue.contains(FloatWrapper(persistedValue: Float(5.55444333)).persistableValue..<FloatWrapper(persistedValue: Float(6.55444333)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setOptDouble.@min >= %@) && (setOptDouble.@max <= %@))\",\n                    values: [DoubleWrapper(persistedValue: 123.456).persistableValue, DoubleWrapper(persistedValue: 234.567).persistableValue], count: 1) {\n            $0.setOptDouble.persistableValue.contains(DoubleWrapper(persistedValue: 123.456).persistableValue...DoubleWrapper(persistedValue: 234.567).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setOptDouble.@min >= %@) && (setOptDouble.@max < %@))\",\n                    values: [DoubleWrapper(persistedValue: 123.456).persistableValue, DoubleWrapper(persistedValue: 234.567).persistableValue], count: 0) {\n            $0.setOptDouble.persistableValue.contains(DoubleWrapper(persistedValue: 123.456).persistableValue..<DoubleWrapper(persistedValue: 234.567).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setOptDate.@min >= %@) && (setOptDate.@max <= %@))\",\n                    values: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue], count: 1) {\n            $0.setOptDate.persistableValue.contains(DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue...DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setOptDate.@min >= %@) && (setOptDate.@max < %@))\",\n                    values: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue], count: 0) {\n            $0.setOptDate.persistableValue.contains(DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue..<DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setOptDecimal.@min >= %@) && (setOptDecimal.@max <= %@))\",\n                    values: [Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue, Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue], count: 1) {\n            $0.setOptDecimal.persistableValue.contains(Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue...Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((setOptDecimal.@min >= %@) && (setOptDecimal.@max < %@))\",\n                    values: [Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue, Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue], count: 0) {\n            $0.setOptDecimal.persistableValue.contains(Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue..<Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapInt.@min >= %@) && (mapInt.@max <= %@))\",\n                    values: [1, 3], count: 1) {\n            $0.mapInt.contains(1...3)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapInt.@min >= %@) && (mapInt.@max < %@))\",\n                    values: [1, 3], count: 0) {\n            $0.mapInt.contains(1..<3)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapInt8.@min >= %@) && (mapInt8.@max <= %@))\",\n                    values: [Int8(8), Int8(9)], count: 1) {\n            $0.mapInt8.contains(Int8(8)...Int8(9))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapInt8.@min >= %@) && (mapInt8.@max < %@))\",\n                    values: [Int8(8), Int8(9)], count: 0) {\n            $0.mapInt8.contains(Int8(8)..<Int8(9))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapInt16.@min >= %@) && (mapInt16.@max <= %@))\",\n                    values: [Int16(16), Int16(17)], count: 1) {\n            $0.mapInt16.contains(Int16(16)...Int16(17))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapInt16.@min >= %@) && (mapInt16.@max < %@))\",\n                    values: [Int16(16), Int16(17)], count: 0) {\n            $0.mapInt16.contains(Int16(16)..<Int16(17))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapInt32.@min >= %@) && (mapInt32.@max <= %@))\",\n                    values: [Int32(32), Int32(33)], count: 1) {\n            $0.mapInt32.contains(Int32(32)...Int32(33))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapInt32.@min >= %@) && (mapInt32.@max < %@))\",\n                    values: [Int32(32), Int32(33)], count: 0) {\n            $0.mapInt32.contains(Int32(32)..<Int32(33))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapInt64.@min >= %@) && (mapInt64.@max <= %@))\",\n                    values: [Int64(64), Int64(65)], count: 1) {\n            $0.mapInt64.contains(Int64(64)...Int64(65))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapInt64.@min >= %@) && (mapInt64.@max < %@))\",\n                    values: [Int64(64), Int64(65)], count: 0) {\n            $0.mapInt64.contains(Int64(64)..<Int64(65))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapFloat.@min >= %@) && (mapFloat.@max <= %@))\",\n                    values: [Float(5.55444333), Float(6.55444333)], count: 1) {\n            $0.mapFloat.contains(Float(5.55444333)...Float(6.55444333))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapFloat.@min >= %@) && (mapFloat.@max < %@))\",\n                    values: [Float(5.55444333), Float(6.55444333)], count: 0) {\n            $0.mapFloat.contains(Float(5.55444333)..<Float(6.55444333))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapDouble.@min >= %@) && (mapDouble.@max <= %@))\",\n                    values: [123.456, 234.567], count: 1) {\n            $0.mapDouble.contains(123.456...234.567)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapDouble.@min >= %@) && (mapDouble.@max < %@))\",\n                    values: [123.456, 234.567], count: 0) {\n            $0.mapDouble.contains(123.456..<234.567)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapDate.@min >= %@) && (mapDate.@max <= %@))\",\n                    values: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)], count: 1) {\n            $0.mapDate.contains(Date(timeIntervalSince1970: 1000000)...Date(timeIntervalSince1970: 2000000))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapDate.@min >= %@) && (mapDate.@max < %@))\",\n                    values: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)], count: 0) {\n            $0.mapDate.contains(Date(timeIntervalSince1970: 1000000)..<Date(timeIntervalSince1970: 2000000))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapDecimal.@min >= %@) && (mapDecimal.@max <= %@))\",\n                    values: [Decimal128(123.456), Decimal128(234.567)], count: 1) {\n            $0.mapDecimal.contains(Decimal128(123.456)...Decimal128(234.567))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapDecimal.@min >= %@) && (mapDecimal.@max < %@))\",\n                    values: [Decimal128(123.456), Decimal128(234.567)], count: 0) {\n            $0.mapDecimal.contains(Decimal128(123.456)..<Decimal128(234.567))\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapInt.@min >= %@) && (mapInt.@max <= %@))\",\n                    values: [EnumInt.value1.rawValue, EnumInt.value2.rawValue], count: 1) {\n            $0.mapInt.rawValue.contains(EnumInt.value1.rawValue...EnumInt.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapInt.@min >= %@) && (mapInt.@max < %@))\",\n                    values: [EnumInt.value1.rawValue, EnumInt.value2.rawValue], count: 0) {\n            $0.mapInt.rawValue.contains(EnumInt.value1.rawValue..<EnumInt.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapInt8.@min >= %@) && (mapInt8.@max <= %@))\",\n                    values: [EnumInt8.value1.rawValue, EnumInt8.value2.rawValue], count: 1) {\n            $0.mapInt8.rawValue.contains(EnumInt8.value1.rawValue...EnumInt8.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapInt8.@min >= %@) && (mapInt8.@max < %@))\",\n                    values: [EnumInt8.value1.rawValue, EnumInt8.value2.rawValue], count: 0) {\n            $0.mapInt8.rawValue.contains(EnumInt8.value1.rawValue..<EnumInt8.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapInt16.@min >= %@) && (mapInt16.@max <= %@))\",\n                    values: [EnumInt16.value1.rawValue, EnumInt16.value2.rawValue], count: 1) {\n            $0.mapInt16.rawValue.contains(EnumInt16.value1.rawValue...EnumInt16.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapInt16.@min >= %@) && (mapInt16.@max < %@))\",\n                    values: [EnumInt16.value1.rawValue, EnumInt16.value2.rawValue], count: 0) {\n            $0.mapInt16.rawValue.contains(EnumInt16.value1.rawValue..<EnumInt16.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapInt32.@min >= %@) && (mapInt32.@max <= %@))\",\n                    values: [EnumInt32.value1.rawValue, EnumInt32.value2.rawValue], count: 1) {\n            $0.mapInt32.rawValue.contains(EnumInt32.value1.rawValue...EnumInt32.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapInt32.@min >= %@) && (mapInt32.@max < %@))\",\n                    values: [EnumInt32.value1.rawValue, EnumInt32.value2.rawValue], count: 0) {\n            $0.mapInt32.rawValue.contains(EnumInt32.value1.rawValue..<EnumInt32.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapInt64.@min >= %@) && (mapInt64.@max <= %@))\",\n                    values: [EnumInt64.value1.rawValue, EnumInt64.value2.rawValue], count: 1) {\n            $0.mapInt64.rawValue.contains(EnumInt64.value1.rawValue...EnumInt64.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapInt64.@min >= %@) && (mapInt64.@max < %@))\",\n                    values: [EnumInt64.value1.rawValue, EnumInt64.value2.rawValue], count: 0) {\n            $0.mapInt64.rawValue.contains(EnumInt64.value1.rawValue..<EnumInt64.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapFloat.@min >= %@) && (mapFloat.@max <= %@))\",\n                    values: [EnumFloat.value1.rawValue, EnumFloat.value2.rawValue], count: 1) {\n            $0.mapFloat.rawValue.contains(EnumFloat.value1.rawValue...EnumFloat.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapFloat.@min >= %@) && (mapFloat.@max < %@))\",\n                    values: [EnumFloat.value1.rawValue, EnumFloat.value2.rawValue], count: 0) {\n            $0.mapFloat.rawValue.contains(EnumFloat.value1.rawValue..<EnumFloat.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapDouble.@min >= %@) && (mapDouble.@max <= %@))\",\n                    values: [EnumDouble.value1.rawValue, EnumDouble.value2.rawValue], count: 1) {\n            $0.mapDouble.rawValue.contains(EnumDouble.value1.rawValue...EnumDouble.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapDouble.@min >= %@) && (mapDouble.@max < %@))\",\n                    values: [EnumDouble.value1.rawValue, EnumDouble.value2.rawValue], count: 0) {\n            $0.mapDouble.rawValue.contains(EnumDouble.value1.rawValue..<EnumDouble.value2.rawValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapInt.@min >= %@) && (mapInt.@max <= %@))\",\n                    values: [IntWrapper(persistedValue: 1).persistableValue, IntWrapper(persistedValue: 3).persistableValue], count: 1) {\n            $0.mapInt.persistableValue.contains(IntWrapper(persistedValue: 1).persistableValue...IntWrapper(persistedValue: 3).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapInt.@min >= %@) && (mapInt.@max < %@))\",\n                    values: [IntWrapper(persistedValue: 1).persistableValue, IntWrapper(persistedValue: 3).persistableValue], count: 0) {\n            $0.mapInt.persistableValue.contains(IntWrapper(persistedValue: 1).persistableValue..<IntWrapper(persistedValue: 3).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapInt8.@min >= %@) && (mapInt8.@max <= %@))\",\n                    values: [Int8Wrapper(persistedValue: Int8(8)).persistableValue, Int8Wrapper(persistedValue: Int8(9)).persistableValue], count: 1) {\n            $0.mapInt8.persistableValue.contains(Int8Wrapper(persistedValue: Int8(8)).persistableValue...Int8Wrapper(persistedValue: Int8(9)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapInt8.@min >= %@) && (mapInt8.@max < %@))\",\n                    values: [Int8Wrapper(persistedValue: Int8(8)).persistableValue, Int8Wrapper(persistedValue: Int8(9)).persistableValue], count: 0) {\n            $0.mapInt8.persistableValue.contains(Int8Wrapper(persistedValue: Int8(8)).persistableValue..<Int8Wrapper(persistedValue: Int8(9)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapInt16.@min >= %@) && (mapInt16.@max <= %@))\",\n                    values: [Int16Wrapper(persistedValue: Int16(16)).persistableValue, Int16Wrapper(persistedValue: Int16(17)).persistableValue], count: 1) {\n            $0.mapInt16.persistableValue.contains(Int16Wrapper(persistedValue: Int16(16)).persistableValue...Int16Wrapper(persistedValue: Int16(17)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapInt16.@min >= %@) && (mapInt16.@max < %@))\",\n                    values: [Int16Wrapper(persistedValue: Int16(16)).persistableValue, Int16Wrapper(persistedValue: Int16(17)).persistableValue], count: 0) {\n            $0.mapInt16.persistableValue.contains(Int16Wrapper(persistedValue: Int16(16)).persistableValue..<Int16Wrapper(persistedValue: Int16(17)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapInt32.@min >= %@) && (mapInt32.@max <= %@))\",\n                    values: [Int32Wrapper(persistedValue: Int32(32)).persistableValue, Int32Wrapper(persistedValue: Int32(33)).persistableValue], count: 1) {\n            $0.mapInt32.persistableValue.contains(Int32Wrapper(persistedValue: Int32(32)).persistableValue...Int32Wrapper(persistedValue: Int32(33)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapInt32.@min >= %@) && (mapInt32.@max < %@))\",\n                    values: [Int32Wrapper(persistedValue: Int32(32)).persistableValue, Int32Wrapper(persistedValue: Int32(33)).persistableValue], count: 0) {\n            $0.mapInt32.persistableValue.contains(Int32Wrapper(persistedValue: Int32(32)).persistableValue..<Int32Wrapper(persistedValue: Int32(33)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapInt64.@min >= %@) && (mapInt64.@max <= %@))\",\n                    values: [Int64Wrapper(persistedValue: Int64(64)).persistableValue, Int64Wrapper(persistedValue: Int64(65)).persistableValue], count: 1) {\n            $0.mapInt64.persistableValue.contains(Int64Wrapper(persistedValue: Int64(64)).persistableValue...Int64Wrapper(persistedValue: Int64(65)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapInt64.@min >= %@) && (mapInt64.@max < %@))\",\n                    values: [Int64Wrapper(persistedValue: Int64(64)).persistableValue, Int64Wrapper(persistedValue: Int64(65)).persistableValue], count: 0) {\n            $0.mapInt64.persistableValue.contains(Int64Wrapper(persistedValue: Int64(64)).persistableValue..<Int64Wrapper(persistedValue: Int64(65)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapFloat.@min >= %@) && (mapFloat.@max <= %@))\",\n                    values: [FloatWrapper(persistedValue: Float(5.55444333)).persistableValue, FloatWrapper(persistedValue: Float(6.55444333)).persistableValue], count: 1) {\n            $0.mapFloat.persistableValue.contains(FloatWrapper(persistedValue: Float(5.55444333)).persistableValue...FloatWrapper(persistedValue: Float(6.55444333)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapFloat.@min >= %@) && (mapFloat.@max < %@))\",\n                    values: [FloatWrapper(persistedValue: Float(5.55444333)).persistableValue, FloatWrapper(persistedValue: Float(6.55444333)).persistableValue], count: 0) {\n            $0.mapFloat.persistableValue.contains(FloatWrapper(persistedValue: Float(5.55444333)).persistableValue..<FloatWrapper(persistedValue: Float(6.55444333)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapDouble.@min >= %@) && (mapDouble.@max <= %@))\",\n                    values: [DoubleWrapper(persistedValue: 123.456).persistableValue, DoubleWrapper(persistedValue: 234.567).persistableValue], count: 1) {\n            $0.mapDouble.persistableValue.contains(DoubleWrapper(persistedValue: 123.456).persistableValue...DoubleWrapper(persistedValue: 234.567).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapDouble.@min >= %@) && (mapDouble.@max < %@))\",\n                    values: [DoubleWrapper(persistedValue: 123.456).persistableValue, DoubleWrapper(persistedValue: 234.567).persistableValue], count: 0) {\n            $0.mapDouble.persistableValue.contains(DoubleWrapper(persistedValue: 123.456).persistableValue..<DoubleWrapper(persistedValue: 234.567).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapDate.@min >= %@) && (mapDate.@max <= %@))\",\n                    values: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue], count: 1) {\n            $0.mapDate.persistableValue.contains(DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue...DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapDate.@min >= %@) && (mapDate.@max < %@))\",\n                    values: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue], count: 0) {\n            $0.mapDate.persistableValue.contains(DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue..<DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapDecimal.@min >= %@) && (mapDecimal.@max <= %@))\",\n                    values: [Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue, Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue], count: 1) {\n            $0.mapDecimal.persistableValue.contains(Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue...Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapDecimal.@min >= %@) && (mapDecimal.@max < %@))\",\n                    values: [Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue, Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue], count: 0) {\n            $0.mapDecimal.persistableValue.contains(Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue..<Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapOptInt.@min >= %@) && (mapOptInt.@max <= %@))\",\n                    values: [1, 3], count: 1) {\n            $0.mapOptInt.contains(1...3)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapOptInt.@min >= %@) && (mapOptInt.@max < %@))\",\n                    values: [1, 3], count: 0) {\n            $0.mapOptInt.contains(1..<3)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapOptInt8.@min >= %@) && (mapOptInt8.@max <= %@))\",\n                    values: [Int8(8), Int8(9)], count: 1) {\n            $0.mapOptInt8.contains(Int8(8)...Int8(9))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapOptInt8.@min >= %@) && (mapOptInt8.@max < %@))\",\n                    values: [Int8(8), Int8(9)], count: 0) {\n            $0.mapOptInt8.contains(Int8(8)..<Int8(9))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapOptInt16.@min >= %@) && (mapOptInt16.@max <= %@))\",\n                    values: [Int16(16), Int16(17)], count: 1) {\n            $0.mapOptInt16.contains(Int16(16)...Int16(17))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapOptInt16.@min >= %@) && (mapOptInt16.@max < %@))\",\n                    values: [Int16(16), Int16(17)], count: 0) {\n            $0.mapOptInt16.contains(Int16(16)..<Int16(17))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapOptInt32.@min >= %@) && (mapOptInt32.@max <= %@))\",\n                    values: [Int32(32), Int32(33)], count: 1) {\n            $0.mapOptInt32.contains(Int32(32)...Int32(33))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapOptInt32.@min >= %@) && (mapOptInt32.@max < %@))\",\n                    values: [Int32(32), Int32(33)], count: 0) {\n            $0.mapOptInt32.contains(Int32(32)..<Int32(33))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapOptInt64.@min >= %@) && (mapOptInt64.@max <= %@))\",\n                    values: [Int64(64), Int64(65)], count: 1) {\n            $0.mapOptInt64.contains(Int64(64)...Int64(65))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapOptInt64.@min >= %@) && (mapOptInt64.@max < %@))\",\n                    values: [Int64(64), Int64(65)], count: 0) {\n            $0.mapOptInt64.contains(Int64(64)..<Int64(65))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapOptFloat.@min >= %@) && (mapOptFloat.@max <= %@))\",\n                    values: [Float(5.55444333), Float(6.55444333)], count: 1) {\n            $0.mapOptFloat.contains(Float(5.55444333)...Float(6.55444333))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapOptFloat.@min >= %@) && (mapOptFloat.@max < %@))\",\n                    values: [Float(5.55444333), Float(6.55444333)], count: 0) {\n            $0.mapOptFloat.contains(Float(5.55444333)..<Float(6.55444333))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapOptDouble.@min >= %@) && (mapOptDouble.@max <= %@))\",\n                    values: [123.456, 234.567], count: 1) {\n            $0.mapOptDouble.contains(123.456...234.567)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapOptDouble.@min >= %@) && (mapOptDouble.@max < %@))\",\n                    values: [123.456, 234.567], count: 0) {\n            $0.mapOptDouble.contains(123.456..<234.567)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapOptDate.@min >= %@) && (mapOptDate.@max <= %@))\",\n                    values: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)], count: 1) {\n            $0.mapOptDate.contains(Date(timeIntervalSince1970: 1000000)...Date(timeIntervalSince1970: 2000000))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapOptDate.@min >= %@) && (mapOptDate.@max < %@))\",\n                    values: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)], count: 0) {\n            $0.mapOptDate.contains(Date(timeIntervalSince1970: 1000000)..<Date(timeIntervalSince1970: 2000000))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapOptDecimal.@min >= %@) && (mapOptDecimal.@max <= %@))\",\n                    values: [Decimal128(123.456), Decimal128(234.567)], count: 1) {\n            $0.mapOptDecimal.contains(Decimal128(123.456)...Decimal128(234.567))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((mapOptDecimal.@min >= %@) && (mapOptDecimal.@max < %@))\",\n                    values: [Decimal128(123.456), Decimal128(234.567)], count: 0) {\n            $0.mapOptDecimal.contains(Decimal128(123.456)..<Decimal128(234.567))\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapIntOpt.@min >= %@) && (mapIntOpt.@max <= %@))\",\n                    values: [EnumInt.value1.rawValue, EnumInt.value2.rawValue], count: 1) {\n            $0.mapIntOpt.rawValue.contains(EnumInt.value1.rawValue...EnumInt.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapIntOpt.@min >= %@) && (mapIntOpt.@max < %@))\",\n                    values: [EnumInt.value1.rawValue, EnumInt.value2.rawValue], count: 0) {\n            $0.mapIntOpt.rawValue.contains(EnumInt.value1.rawValue..<EnumInt.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapInt8Opt.@min >= %@) && (mapInt8Opt.@max <= %@))\",\n                    values: [EnumInt8.value1.rawValue, EnumInt8.value2.rawValue], count: 1) {\n            $0.mapInt8Opt.rawValue.contains(EnumInt8.value1.rawValue...EnumInt8.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapInt8Opt.@min >= %@) && (mapInt8Opt.@max < %@))\",\n                    values: [EnumInt8.value1.rawValue, EnumInt8.value2.rawValue], count: 0) {\n            $0.mapInt8Opt.rawValue.contains(EnumInt8.value1.rawValue..<EnumInt8.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapInt16Opt.@min >= %@) && (mapInt16Opt.@max <= %@))\",\n                    values: [EnumInt16.value1.rawValue, EnumInt16.value2.rawValue], count: 1) {\n            $0.mapInt16Opt.rawValue.contains(EnumInt16.value1.rawValue...EnumInt16.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapInt16Opt.@min >= %@) && (mapInt16Opt.@max < %@))\",\n                    values: [EnumInt16.value1.rawValue, EnumInt16.value2.rawValue], count: 0) {\n            $0.mapInt16Opt.rawValue.contains(EnumInt16.value1.rawValue..<EnumInt16.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapInt32Opt.@min >= %@) && (mapInt32Opt.@max <= %@))\",\n                    values: [EnumInt32.value1.rawValue, EnumInt32.value2.rawValue], count: 1) {\n            $0.mapInt32Opt.rawValue.contains(EnumInt32.value1.rawValue...EnumInt32.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapInt32Opt.@min >= %@) && (mapInt32Opt.@max < %@))\",\n                    values: [EnumInt32.value1.rawValue, EnumInt32.value2.rawValue], count: 0) {\n            $0.mapInt32Opt.rawValue.contains(EnumInt32.value1.rawValue..<EnumInt32.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapInt64Opt.@min >= %@) && (mapInt64Opt.@max <= %@))\",\n                    values: [EnumInt64.value1.rawValue, EnumInt64.value2.rawValue], count: 1) {\n            $0.mapInt64Opt.rawValue.contains(EnumInt64.value1.rawValue...EnumInt64.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapInt64Opt.@min >= %@) && (mapInt64Opt.@max < %@))\",\n                    values: [EnumInt64.value1.rawValue, EnumInt64.value2.rawValue], count: 0) {\n            $0.mapInt64Opt.rawValue.contains(EnumInt64.value1.rawValue..<EnumInt64.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapFloatOpt.@min >= %@) && (mapFloatOpt.@max <= %@))\",\n                    values: [EnumFloat.value1.rawValue, EnumFloat.value2.rawValue], count: 1) {\n            $0.mapFloatOpt.rawValue.contains(EnumFloat.value1.rawValue...EnumFloat.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapFloatOpt.@min >= %@) && (mapFloatOpt.@max < %@))\",\n                    values: [EnumFloat.value1.rawValue, EnumFloat.value2.rawValue], count: 0) {\n            $0.mapFloatOpt.rawValue.contains(EnumFloat.value1.rawValue..<EnumFloat.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapDoubleOpt.@min >= %@) && (mapDoubleOpt.@max <= %@))\",\n                    values: [EnumDouble.value1.rawValue, EnumDouble.value2.rawValue], count: 1) {\n            $0.mapDoubleOpt.rawValue.contains(EnumDouble.value1.rawValue...EnumDouble.value2.rawValue)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"((mapDoubleOpt.@min >= %@) && (mapDoubleOpt.@max < %@))\",\n                    values: [EnumDouble.value1.rawValue, EnumDouble.value2.rawValue], count: 0) {\n            $0.mapDoubleOpt.rawValue.contains(EnumDouble.value1.rawValue..<EnumDouble.value2.rawValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapOptInt.@min >= %@) && (mapOptInt.@max <= %@))\",\n                    values: [IntWrapper(persistedValue: 1).persistableValue, IntWrapper(persistedValue: 3).persistableValue], count: 1) {\n            $0.mapOptInt.persistableValue.contains(IntWrapper(persistedValue: 1).persistableValue...IntWrapper(persistedValue: 3).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapOptInt.@min >= %@) && (mapOptInt.@max < %@))\",\n                    values: [IntWrapper(persistedValue: 1).persistableValue, IntWrapper(persistedValue: 3).persistableValue], count: 0) {\n            $0.mapOptInt.persistableValue.contains(IntWrapper(persistedValue: 1).persistableValue..<IntWrapper(persistedValue: 3).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapOptInt8.@min >= %@) && (mapOptInt8.@max <= %@))\",\n                    values: [Int8Wrapper(persistedValue: Int8(8)).persistableValue, Int8Wrapper(persistedValue: Int8(9)).persistableValue], count: 1) {\n            $0.mapOptInt8.persistableValue.contains(Int8Wrapper(persistedValue: Int8(8)).persistableValue...Int8Wrapper(persistedValue: Int8(9)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapOptInt8.@min >= %@) && (mapOptInt8.@max < %@))\",\n                    values: [Int8Wrapper(persistedValue: Int8(8)).persistableValue, Int8Wrapper(persistedValue: Int8(9)).persistableValue], count: 0) {\n            $0.mapOptInt8.persistableValue.contains(Int8Wrapper(persistedValue: Int8(8)).persistableValue..<Int8Wrapper(persistedValue: Int8(9)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapOptInt16.@min >= %@) && (mapOptInt16.@max <= %@))\",\n                    values: [Int16Wrapper(persistedValue: Int16(16)).persistableValue, Int16Wrapper(persistedValue: Int16(17)).persistableValue], count: 1) {\n            $0.mapOptInt16.persistableValue.contains(Int16Wrapper(persistedValue: Int16(16)).persistableValue...Int16Wrapper(persistedValue: Int16(17)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapOptInt16.@min >= %@) && (mapOptInt16.@max < %@))\",\n                    values: [Int16Wrapper(persistedValue: Int16(16)).persistableValue, Int16Wrapper(persistedValue: Int16(17)).persistableValue], count: 0) {\n            $0.mapOptInt16.persistableValue.contains(Int16Wrapper(persistedValue: Int16(16)).persistableValue..<Int16Wrapper(persistedValue: Int16(17)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapOptInt32.@min >= %@) && (mapOptInt32.@max <= %@))\",\n                    values: [Int32Wrapper(persistedValue: Int32(32)).persistableValue, Int32Wrapper(persistedValue: Int32(33)).persistableValue], count: 1) {\n            $0.mapOptInt32.persistableValue.contains(Int32Wrapper(persistedValue: Int32(32)).persistableValue...Int32Wrapper(persistedValue: Int32(33)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapOptInt32.@min >= %@) && (mapOptInt32.@max < %@))\",\n                    values: [Int32Wrapper(persistedValue: Int32(32)).persistableValue, Int32Wrapper(persistedValue: Int32(33)).persistableValue], count: 0) {\n            $0.mapOptInt32.persistableValue.contains(Int32Wrapper(persistedValue: Int32(32)).persistableValue..<Int32Wrapper(persistedValue: Int32(33)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapOptInt64.@min >= %@) && (mapOptInt64.@max <= %@))\",\n                    values: [Int64Wrapper(persistedValue: Int64(64)).persistableValue, Int64Wrapper(persistedValue: Int64(65)).persistableValue], count: 1) {\n            $0.mapOptInt64.persistableValue.contains(Int64Wrapper(persistedValue: Int64(64)).persistableValue...Int64Wrapper(persistedValue: Int64(65)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapOptInt64.@min >= %@) && (mapOptInt64.@max < %@))\",\n                    values: [Int64Wrapper(persistedValue: Int64(64)).persistableValue, Int64Wrapper(persistedValue: Int64(65)).persistableValue], count: 0) {\n            $0.mapOptInt64.persistableValue.contains(Int64Wrapper(persistedValue: Int64(64)).persistableValue..<Int64Wrapper(persistedValue: Int64(65)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapOptFloat.@min >= %@) && (mapOptFloat.@max <= %@))\",\n                    values: [FloatWrapper(persistedValue: Float(5.55444333)).persistableValue, FloatWrapper(persistedValue: Float(6.55444333)).persistableValue], count: 1) {\n            $0.mapOptFloat.persistableValue.contains(FloatWrapper(persistedValue: Float(5.55444333)).persistableValue...FloatWrapper(persistedValue: Float(6.55444333)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapOptFloat.@min >= %@) && (mapOptFloat.@max < %@))\",\n                    values: [FloatWrapper(persistedValue: Float(5.55444333)).persistableValue, FloatWrapper(persistedValue: Float(6.55444333)).persistableValue], count: 0) {\n            $0.mapOptFloat.persistableValue.contains(FloatWrapper(persistedValue: Float(5.55444333)).persistableValue..<FloatWrapper(persistedValue: Float(6.55444333)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapOptDouble.@min >= %@) && (mapOptDouble.@max <= %@))\",\n                    values: [DoubleWrapper(persistedValue: 123.456).persistableValue, DoubleWrapper(persistedValue: 234.567).persistableValue], count: 1) {\n            $0.mapOptDouble.persistableValue.contains(DoubleWrapper(persistedValue: 123.456).persistableValue...DoubleWrapper(persistedValue: 234.567).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapOptDouble.@min >= %@) && (mapOptDouble.@max < %@))\",\n                    values: [DoubleWrapper(persistedValue: 123.456).persistableValue, DoubleWrapper(persistedValue: 234.567).persistableValue], count: 0) {\n            $0.mapOptDouble.persistableValue.contains(DoubleWrapper(persistedValue: 123.456).persistableValue..<DoubleWrapper(persistedValue: 234.567).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapOptDate.@min >= %@) && (mapOptDate.@max <= %@))\",\n                    values: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue], count: 1) {\n            $0.mapOptDate.persistableValue.contains(DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue...DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapOptDate.@min >= %@) && (mapOptDate.@max < %@))\",\n                    values: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue], count: 0) {\n            $0.mapOptDate.persistableValue.contains(DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)).persistableValue..<DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapOptDecimal.@min >= %@) && (mapOptDecimal.@max <= %@))\",\n                    values: [Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue, Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue], count: 1) {\n            $0.mapOptDecimal.persistableValue.contains(Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue...Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue)\n        }\n        assertQuery(CustomPersistableCollections.self, \"((mapOptDecimal.@min >= %@) && (mapOptDecimal.@max < %@))\",\n                    values: [Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue, Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue], count: 0) {\n            $0.mapOptDecimal.persistableValue.contains(Decimal128Wrapper(persistedValue: Decimal128(123.456)).persistableValue..<Decimal128Wrapper(persistedValue: Decimal128(234.567)).persistableValue)\n        }\n    }\n\n    func testListContainsAnyInObject() {\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayBool IN %@)\",\n                    values: [NSArray(array: [true, true])], count: 1) {\n            $0.arrayBool.containsAny(in: [true, true])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayInt IN %@)\",\n                    values: [NSArray(array: [1, 3])], count: 1) {\n            $0.arrayInt.containsAny(in: [1, 3])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayInt8 IN %@)\",\n                    values: [NSArray(array: [Int8(8), Int8(9)])], count: 1) {\n            $0.arrayInt8.containsAny(in: [Int8(8), Int8(9)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayInt16 IN %@)\",\n                    values: [NSArray(array: [Int16(16), Int16(17)])], count: 1) {\n            $0.arrayInt16.containsAny(in: [Int16(16), Int16(17)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayInt32 IN %@)\",\n                    values: [NSArray(array: [Int32(32), Int32(33)])], count: 1) {\n            $0.arrayInt32.containsAny(in: [Int32(32), Int32(33)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayInt64 IN %@)\",\n                    values: [NSArray(array: [Int64(64), Int64(65)])], count: 1) {\n            $0.arrayInt64.containsAny(in: [Int64(64), Int64(65)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayFloat IN %@)\",\n                    values: [NSArray(array: [Float(5.55444333), Float(6.55444333)])], count: 1) {\n            $0.arrayFloat.containsAny(in: [Float(5.55444333), Float(6.55444333)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayDouble IN %@)\",\n                    values: [NSArray(array: [123.456, 234.567])], count: 1) {\n            $0.arrayDouble.containsAny(in: [123.456, 234.567])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayString IN %@)\",\n                    values: [NSArray(array: [\"Foo\", \"Foó\"])], count: 1) {\n            $0.arrayString.containsAny(in: [\"Foo\", \"Foó\"])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayBinary IN %@)\",\n                    values: [NSArray(array: [Data(count: 64), Data(count: 128)])], count: 1) {\n            $0.arrayBinary.containsAny(in: [Data(count: 64), Data(count: 128)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayDate IN %@)\",\n                    values: [NSArray(array: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])], count: 1) {\n            $0.arrayDate.containsAny(in: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayDecimal IN %@)\",\n                    values: [NSArray(array: [Decimal128(123.456), Decimal128(234.567)])], count: 1) {\n            $0.arrayDecimal.containsAny(in: [Decimal128(123.456), Decimal128(234.567)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayObjectId IN %@)\",\n                    values: [NSArray(array: [ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])], count: 1) {\n            $0.arrayObjectId.containsAny(in: [ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayUuid IN %@)\",\n                    values: [NSArray(array: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])], count: 1) {\n            $0.arrayUuid.containsAny(in: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayAny IN %@)\",\n                    values: [NSArray(array: [AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\")), AnyRealmValue.string(\"Hello\")])], count: 1) {\n            $0.arrayAny.containsAny(in: [AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\")), AnyRealmValue.string(\"Hello\")])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listInt IN %@)\",\n                    values: [NSArray(array: [EnumInt.value1, EnumInt.value2])], count: 1) {\n            $0.listInt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listInt8 IN %@)\",\n                    values: [NSArray(array: [EnumInt8.value1, EnumInt8.value2])], count: 1) {\n            $0.listInt8.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listInt16 IN %@)\",\n                    values: [NSArray(array: [EnumInt16.value1, EnumInt16.value2])], count: 1) {\n            $0.listInt16.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listInt32 IN %@)\",\n                    values: [NSArray(array: [EnumInt32.value1, EnumInt32.value2])], count: 1) {\n            $0.listInt32.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listInt64 IN %@)\",\n                    values: [NSArray(array: [EnumInt64.value1, EnumInt64.value2])], count: 1) {\n            $0.listInt64.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listFloat IN %@)\",\n                    values: [NSArray(array: [EnumFloat.value1, EnumFloat.value2])], count: 1) {\n            $0.listFloat.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listDouble IN %@)\",\n                    values: [NSArray(array: [EnumDouble.value1, EnumDouble.value2])], count: 1) {\n            $0.listDouble.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listString IN %@)\",\n                    values: [NSArray(array: [EnumString.value1, EnumString.value2])], count: 1) {\n            $0.listString.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listBool IN %@)\",\n                    values: [NSArray(array: [BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: true)])], count: 1) {\n            $0.listBool.containsAny(in: [BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: true)])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listInt IN %@)\",\n                    values: [NSArray(array: [IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])], count: 1) {\n            $0.listInt.containsAny(in: [IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listInt8 IN %@)\",\n                    values: [NSArray(array: [Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])], count: 1) {\n            $0.listInt8.containsAny(in: [Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listInt16 IN %@)\",\n                    values: [NSArray(array: [Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])], count: 1) {\n            $0.listInt16.containsAny(in: [Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listInt32 IN %@)\",\n                    values: [NSArray(array: [Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])], count: 1) {\n            $0.listInt32.containsAny(in: [Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listInt64 IN %@)\",\n                    values: [NSArray(array: [Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])], count: 1) {\n            $0.listInt64.containsAny(in: [Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listFloat IN %@)\",\n                    values: [NSArray(array: [FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])], count: 1) {\n            $0.listFloat.containsAny(in: [FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listDouble IN %@)\",\n                    values: [NSArray(array: [DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])], count: 1) {\n            $0.listDouble.containsAny(in: [DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listString IN %@)\",\n                    values: [NSArray(array: [StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])], count: 1) {\n            $0.listString.containsAny(in: [StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listBinary IN %@)\",\n                    values: [NSArray(array: [DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])], count: 1) {\n            $0.listBinary.containsAny(in: [DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listDate IN %@)\",\n                    values: [NSArray(array: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])], count: 1) {\n            $0.listDate.containsAny(in: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listDecimal IN %@)\",\n                    values: [NSArray(array: [Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])], count: 1) {\n            $0.listDecimal.containsAny(in: [Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listObjectId IN %@)\",\n                    values: [NSArray(array: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])], count: 1) {\n            $0.listObjectId.containsAny(in: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listUuid IN %@)\",\n                    values: [NSArray(array: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])], count: 1) {\n            $0.listUuid.containsAny(in: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptBool IN %@)\",\n                    values: [NSArray(array: [true, true])], count: 1) {\n            $0.arrayOptBool.containsAny(in: [true, true])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptInt IN %@)\",\n                    values: [NSArray(array: [1, 3])], count: 1) {\n            $0.arrayOptInt.containsAny(in: [1, 3])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptInt8 IN %@)\",\n                    values: [NSArray(array: [Int8(8), Int8(9)])], count: 1) {\n            $0.arrayOptInt8.containsAny(in: [Int8(8), Int8(9)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptInt16 IN %@)\",\n                    values: [NSArray(array: [Int16(16), Int16(17)])], count: 1) {\n            $0.arrayOptInt16.containsAny(in: [Int16(16), Int16(17)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptInt32 IN %@)\",\n                    values: [NSArray(array: [Int32(32), Int32(33)])], count: 1) {\n            $0.arrayOptInt32.containsAny(in: [Int32(32), Int32(33)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptInt64 IN %@)\",\n                    values: [NSArray(array: [Int64(64), Int64(65)])], count: 1) {\n            $0.arrayOptInt64.containsAny(in: [Int64(64), Int64(65)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptFloat IN %@)\",\n                    values: [NSArray(array: [Float(5.55444333), Float(6.55444333)])], count: 1) {\n            $0.arrayOptFloat.containsAny(in: [Float(5.55444333), Float(6.55444333)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptDouble IN %@)\",\n                    values: [NSArray(array: [123.456, 234.567])], count: 1) {\n            $0.arrayOptDouble.containsAny(in: [123.456, 234.567])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptString IN %@)\",\n                    values: [NSArray(array: [\"Foo\", \"Foó\"])], count: 1) {\n            $0.arrayOptString.containsAny(in: [\"Foo\", \"Foó\"])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptBinary IN %@)\",\n                    values: [NSArray(array: [Data(count: 64), Data(count: 128)])], count: 1) {\n            $0.arrayOptBinary.containsAny(in: [Data(count: 64), Data(count: 128)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptDate IN %@)\",\n                    values: [NSArray(array: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])], count: 1) {\n            $0.arrayOptDate.containsAny(in: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptDecimal IN %@)\",\n                    values: [NSArray(array: [Decimal128(123.456), Decimal128(234.567)])], count: 1) {\n            $0.arrayOptDecimal.containsAny(in: [Decimal128(123.456), Decimal128(234.567)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptObjectId IN %@)\",\n                    values: [NSArray(array: [ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])], count: 1) {\n            $0.arrayOptObjectId.containsAny(in: [ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptUuid IN %@)\",\n                    values: [NSArray(array: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])], count: 1) {\n            $0.arrayOptUuid.containsAny(in: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listIntOpt IN %@)\",\n                    values: [NSArray(array: [EnumInt.value1, EnumInt.value2])], count: 1) {\n            $0.listIntOpt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listInt8Opt IN %@)\",\n                    values: [NSArray(array: [EnumInt8.value1, EnumInt8.value2])], count: 1) {\n            $0.listInt8Opt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listInt16Opt IN %@)\",\n                    values: [NSArray(array: [EnumInt16.value1, EnumInt16.value2])], count: 1) {\n            $0.listInt16Opt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listInt32Opt IN %@)\",\n                    values: [NSArray(array: [EnumInt32.value1, EnumInt32.value2])], count: 1) {\n            $0.listInt32Opt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listInt64Opt IN %@)\",\n                    values: [NSArray(array: [EnumInt64.value1, EnumInt64.value2])], count: 1) {\n            $0.listInt64Opt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listFloatOpt IN %@)\",\n                    values: [NSArray(array: [EnumFloat.value1, EnumFloat.value2])], count: 1) {\n            $0.listFloatOpt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listDoubleOpt IN %@)\",\n                    values: [NSArray(array: [EnumDouble.value1, EnumDouble.value2])], count: 1) {\n            $0.listDoubleOpt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listStringOpt IN %@)\",\n                    values: [NSArray(array: [EnumString.value1, EnumString.value2])], count: 1) {\n            $0.listStringOpt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptBool IN %@)\",\n                    values: [NSArray(array: [BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: true)])], count: 1) {\n            $0.listOptBool.containsAny(in: [BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: true)])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptInt IN %@)\",\n                    values: [NSArray(array: [IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])], count: 1) {\n            $0.listOptInt.containsAny(in: [IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptInt8 IN %@)\",\n                    values: [NSArray(array: [Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])], count: 1) {\n            $0.listOptInt8.containsAny(in: [Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptInt16 IN %@)\",\n                    values: [NSArray(array: [Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])], count: 1) {\n            $0.listOptInt16.containsAny(in: [Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptInt32 IN %@)\",\n                    values: [NSArray(array: [Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])], count: 1) {\n            $0.listOptInt32.containsAny(in: [Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptInt64 IN %@)\",\n                    values: [NSArray(array: [Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])], count: 1) {\n            $0.listOptInt64.containsAny(in: [Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptFloat IN %@)\",\n                    values: [NSArray(array: [FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])], count: 1) {\n            $0.listOptFloat.containsAny(in: [FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptDouble IN %@)\",\n                    values: [NSArray(array: [DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])], count: 1) {\n            $0.listOptDouble.containsAny(in: [DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptString IN %@)\",\n                    values: [NSArray(array: [StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])], count: 1) {\n            $0.listOptString.containsAny(in: [StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptBinary IN %@)\",\n                    values: [NSArray(array: [DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])], count: 1) {\n            $0.listOptBinary.containsAny(in: [DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptDate IN %@)\",\n                    values: [NSArray(array: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])], count: 1) {\n            $0.listOptDate.containsAny(in: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptDecimal IN %@)\",\n                    values: [NSArray(array: [Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])], count: 1) {\n            $0.listOptDecimal.containsAny(in: [Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptObjectId IN %@)\",\n                    values: [NSArray(array: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])], count: 1) {\n            $0.listOptObjectId.containsAny(in: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptUuid IN %@)\",\n                    values: [NSArray(array: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])], count: 1) {\n            $0.listOptUuid.containsAny(in: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])\n        }\n\n        let colObj = ModernCollectionObject()\n        let obj = objects().first!\n        colObj.list.append(obj)\n        try! realm.write {\n            realm.add(colObj)\n        }\n\n        assertQuery(ModernCollectionObject.self, \"(ANY list IN %@)\", values: [NSArray(array: [obj])], count: 1) {\n            $0.list.containsAny(in: [obj])\n        }\n    }\n\n    func testCollectionFromProperty() {\n        try! realm.write {\n            let objCustomPersistableCollections = realm.objects(CustomPersistableCollections.self).first!\n            _ = realm.create(LinkToCustomPersistableCollections.self, value: [\n                \"list\": [objCustomPersistableCollections],\n                \"set\": [objCustomPersistableCollections],\n                \"map\": [\"foo\": objCustomPersistableCollections]\n            ])\n            let objModernCollectionsOfEnums = realm.objects(ModernCollectionsOfEnums.self).first!\n            _ = realm.create(LinkToModernCollectionsOfEnums.self, value: [\n                \"list\": [objModernCollectionsOfEnums],\n                \"set\": [objModernCollectionsOfEnums],\n                \"map\": [\"foo\": objModernCollectionsOfEnums]\n            ])\n            let objAllCustomPersistableTypes = realm.objects(AllCustomPersistableTypes.self).first!\n            _ = realm.create(LinkToAllCustomPersistableTypes.self, value: [\n                \"list\": [objAllCustomPersistableTypes],\n                \"set\": [objAllCustomPersistableTypes],\n                \"map\": [\"foo\": objAllCustomPersistableTypes]\n            ])\n            let objModernAllTypesObject = realm.objects(ModernAllTypesObject.self).first!\n            _ = realm.create(LinkToModernAllTypesObject.self, value: [\n                \"list\": [objModernAllTypesObject],\n                \"set\": [objModernAllTypesObject],\n                \"map\": [\"foo\": objModernAllTypesObject]\n            ])\n        }\n\n        func test<Root: LinkToTestObject>(\n                _ type: Root.Type, _ predicate: String, _ value: Any,\n                _ q1: ((Query<Root.Child>) -> Query<Bool>), _ q2: ((Query<Root.Child?>) -> Query<Bool>)) {\n            assertPredicate(predicate, [value], q1)\n            assertPredicate(predicate, [value], q2)\n            let obj = realm.objects(Root.self).first!\n            XCTAssertEqual(obj.list.where(q1).count, 1)\n            XCTAssertEqual(obj.set.where(q1).count, 1)\n            XCTAssertEqual(obj.map.where(q2).count, 1)\n        }\n\n        test(LinkToModernAllTypesObject.self, \"(boolCol == %@)\",\n             false,\n             { $0.boolCol == false },\n             { $0.boolCol == false })\n        test(LinkToModernAllTypesObject.self, \"(intCol == %@)\",\n             3,\n             { $0.intCol == 3 },\n             { $0.intCol == 3 })\n        test(LinkToModernAllTypesObject.self, \"(int8Col == %@)\",\n             Int8(9),\n             { $0.int8Col == Int8(9) },\n             { $0.int8Col == Int8(9) })\n        test(LinkToModernAllTypesObject.self, \"(int16Col == %@)\",\n             Int16(17),\n             { $0.int16Col == Int16(17) },\n             { $0.int16Col == Int16(17) })\n        test(LinkToModernAllTypesObject.self, \"(int32Col == %@)\",\n             Int32(33),\n             { $0.int32Col == Int32(33) },\n             { $0.int32Col == Int32(33) })\n        test(LinkToModernAllTypesObject.self, \"(int64Col == %@)\",\n             Int64(65),\n             { $0.int64Col == Int64(65) },\n             { $0.int64Col == Int64(65) })\n        test(LinkToModernAllTypesObject.self, \"(floatCol == %@)\",\n             Float(6.55444333),\n             { $0.floatCol == Float(6.55444333) },\n             { $0.floatCol == Float(6.55444333) })\n        test(LinkToModernAllTypesObject.self, \"(doubleCol == %@)\",\n             234.567,\n             { $0.doubleCol == 234.567 },\n             { $0.doubleCol == 234.567 })\n        test(LinkToModernAllTypesObject.self, \"(stringCol == %@)\",\n             \"Foó\",\n             { $0.stringCol == \"Foó\" },\n             { $0.stringCol == \"Foó\" })\n        test(LinkToModernAllTypesObject.self, \"(binaryCol == %@)\",\n             Data(count: 128),\n             { $0.binaryCol == Data(count: 128) },\n             { $0.binaryCol == Data(count: 128) })\n        test(LinkToModernAllTypesObject.self, \"(dateCol == %@)\",\n             Date(timeIntervalSince1970: 2000000),\n             { $0.dateCol == Date(timeIntervalSince1970: 2000000) },\n             { $0.dateCol == Date(timeIntervalSince1970: 2000000) })\n        test(LinkToModernAllTypesObject.self, \"(decimalCol == %@)\",\n             Decimal128(234.567),\n             { $0.decimalCol == Decimal128(234.567) },\n             { $0.decimalCol == Decimal128(234.567) })\n        test(LinkToModernAllTypesObject.self, \"(objectIdCol == %@)\",\n             ObjectId(\"61184062c1d8f096a3695045\"),\n             { $0.objectIdCol == ObjectId(\"61184062c1d8f096a3695045\") },\n             { $0.objectIdCol == ObjectId(\"61184062c1d8f096a3695045\") })\n        test(LinkToModernAllTypesObject.self, \"(uuidCol == %@)\",\n             UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!,\n             { $0.uuidCol == UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")! },\n             { $0.uuidCol == UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")! })\n        test(LinkToModernAllTypesObject.self, \"(intEnumCol == %@)\",\n             ModernIntEnum.value2,\n             { $0.intEnumCol == .value2 },\n             { $0.intEnumCol == .value2 })\n        test(LinkToModernAllTypesObject.self, \"(stringEnumCol == %@)\",\n             ModernStringEnum.value2,\n             { $0.stringEnumCol == .value2 },\n             { $0.stringEnumCol == .value2 })\n        test(LinkToAllCustomPersistableTypes.self, \"(bool == %@)\",\n             BoolWrapper(persistedValue: false),\n             { $0.bool == BoolWrapper(persistedValue: false) },\n             { $0.bool == BoolWrapper(persistedValue: false) })\n        test(LinkToAllCustomPersistableTypes.self, \"(int == %@)\",\n             IntWrapper(persistedValue: 3),\n             { $0.int == IntWrapper(persistedValue: 3) },\n             { $0.int == IntWrapper(persistedValue: 3) })\n        test(LinkToAllCustomPersistableTypes.self, \"(int8 == %@)\",\n             Int8Wrapper(persistedValue: Int8(9)),\n             { $0.int8 == Int8Wrapper(persistedValue: Int8(9)) },\n             { $0.int8 == Int8Wrapper(persistedValue: Int8(9)) })\n        test(LinkToAllCustomPersistableTypes.self, \"(int16 == %@)\",\n             Int16Wrapper(persistedValue: Int16(17)),\n             { $0.int16 == Int16Wrapper(persistedValue: Int16(17)) },\n             { $0.int16 == Int16Wrapper(persistedValue: Int16(17)) })\n        test(LinkToAllCustomPersistableTypes.self, \"(int32 == %@)\",\n             Int32Wrapper(persistedValue: Int32(33)),\n             { $0.int32 == Int32Wrapper(persistedValue: Int32(33)) },\n             { $0.int32 == Int32Wrapper(persistedValue: Int32(33)) })\n        test(LinkToAllCustomPersistableTypes.self, \"(int64 == %@)\",\n             Int64Wrapper(persistedValue: Int64(65)),\n             { $0.int64 == Int64Wrapper(persistedValue: Int64(65)) },\n             { $0.int64 == Int64Wrapper(persistedValue: Int64(65)) })\n        test(LinkToAllCustomPersistableTypes.self, \"(float == %@)\",\n             FloatWrapper(persistedValue: Float(6.55444333)),\n             { $0.float == FloatWrapper(persistedValue: Float(6.55444333)) },\n             { $0.float == FloatWrapper(persistedValue: Float(6.55444333)) })\n        test(LinkToAllCustomPersistableTypes.self, \"(double == %@)\",\n             DoubleWrapper(persistedValue: 234.567),\n             { $0.double == DoubleWrapper(persistedValue: 234.567) },\n             { $0.double == DoubleWrapper(persistedValue: 234.567) })\n        test(LinkToAllCustomPersistableTypes.self, \"(string == %@)\",\n             StringWrapper(persistedValue: \"Foó\"),\n             { $0.string == StringWrapper(persistedValue: \"Foó\") },\n             { $0.string == StringWrapper(persistedValue: \"Foó\") })\n        test(LinkToAllCustomPersistableTypes.self, \"(binary == %@)\",\n             DataWrapper(persistedValue: Data(count: 128)),\n             { $0.binary == DataWrapper(persistedValue: Data(count: 128)) },\n             { $0.binary == DataWrapper(persistedValue: Data(count: 128)) })\n        test(LinkToAllCustomPersistableTypes.self, \"(date == %@)\",\n             DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)),\n             { $0.date == DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)) },\n             { $0.date == DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)) })\n        test(LinkToAllCustomPersistableTypes.self, \"(decimal == %@)\",\n             Decimal128Wrapper(persistedValue: Decimal128(234.567)),\n             { $0.decimal == Decimal128Wrapper(persistedValue: Decimal128(234.567)) },\n             { $0.decimal == Decimal128Wrapper(persistedValue: Decimal128(234.567)) })\n        test(LinkToAllCustomPersistableTypes.self, \"(objectId == %@)\",\n             ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")),\n             { $0.objectId == ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")) },\n             { $0.objectId == ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")) })\n        test(LinkToAllCustomPersistableTypes.self, \"(uuid == %@)\",\n             UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!),\n             { $0.uuid == UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!) },\n             { $0.uuid == UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!) })\n        test(LinkToModernAllTypesObject.self, \"(optBoolCol == %@)\",\n             false,\n             { $0.optBoolCol == false },\n             { $0.optBoolCol == false })\n        test(LinkToModernAllTypesObject.self, \"(optIntCol == %@)\",\n             3,\n             { $0.optIntCol == 3 },\n             { $0.optIntCol == 3 })\n        test(LinkToModernAllTypesObject.self, \"(optInt8Col == %@)\",\n             Int8(9),\n             { $0.optInt8Col == Int8(9) },\n             { $0.optInt8Col == Int8(9) })\n        test(LinkToModernAllTypesObject.self, \"(optInt16Col == %@)\",\n             Int16(17),\n             { $0.optInt16Col == Int16(17) },\n             { $0.optInt16Col == Int16(17) })\n        test(LinkToModernAllTypesObject.self, \"(optInt32Col == %@)\",\n             Int32(33),\n             { $0.optInt32Col == Int32(33) },\n             { $0.optInt32Col == Int32(33) })\n        test(LinkToModernAllTypesObject.self, \"(optInt64Col == %@)\",\n             Int64(65),\n             { $0.optInt64Col == Int64(65) },\n             { $0.optInt64Col == Int64(65) })\n        test(LinkToModernAllTypesObject.self, \"(optFloatCol == %@)\",\n             Float(6.55444333),\n             { $0.optFloatCol == Float(6.55444333) },\n             { $0.optFloatCol == Float(6.55444333) })\n        test(LinkToModernAllTypesObject.self, \"(optDoubleCol == %@)\",\n             234.567,\n             { $0.optDoubleCol == 234.567 },\n             { $0.optDoubleCol == 234.567 })\n        test(LinkToModernAllTypesObject.self, \"(optStringCol == %@)\",\n             \"Foó\",\n             { $0.optStringCol == \"Foó\" },\n             { $0.optStringCol == \"Foó\" })\n        test(LinkToModernAllTypesObject.self, \"(optBinaryCol == %@)\",\n             Data(count: 128),\n             { $0.optBinaryCol == Data(count: 128) },\n             { $0.optBinaryCol == Data(count: 128) })\n        test(LinkToModernAllTypesObject.self, \"(optDateCol == %@)\",\n             Date(timeIntervalSince1970: 2000000),\n             { $0.optDateCol == Date(timeIntervalSince1970: 2000000) },\n             { $0.optDateCol == Date(timeIntervalSince1970: 2000000) })\n        test(LinkToModernAllTypesObject.self, \"(optDecimalCol == %@)\",\n             Decimal128(234.567),\n             { $0.optDecimalCol == Decimal128(234.567) },\n             { $0.optDecimalCol == Decimal128(234.567) })\n        test(LinkToModernAllTypesObject.self, \"(optObjectIdCol == %@)\",\n             ObjectId(\"61184062c1d8f096a3695045\"),\n             { $0.optObjectIdCol == ObjectId(\"61184062c1d8f096a3695045\") },\n             { $0.optObjectIdCol == ObjectId(\"61184062c1d8f096a3695045\") })\n        test(LinkToModernAllTypesObject.self, \"(optUuidCol == %@)\",\n             UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!,\n             { $0.optUuidCol == UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")! },\n             { $0.optUuidCol == UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")! })\n        test(LinkToModernAllTypesObject.self, \"(optIntEnumCol == %@)\",\n             ModernIntEnum.value2,\n             { $0.optIntEnumCol == .value2 },\n             { $0.optIntEnumCol == .value2 })\n        test(LinkToModernAllTypesObject.self, \"(optStringEnumCol == %@)\",\n             ModernStringEnum.value2,\n             { $0.optStringEnumCol == .value2 },\n             { $0.optStringEnumCol == .value2 })\n        test(LinkToAllCustomPersistableTypes.self, \"(optBool == %@)\",\n             BoolWrapper(persistedValue: false),\n             { $0.optBool == BoolWrapper(persistedValue: false) },\n             { $0.optBool == BoolWrapper(persistedValue: false) })\n        test(LinkToAllCustomPersistableTypes.self, \"(optInt == %@)\",\n             IntWrapper(persistedValue: 3),\n             { $0.optInt == IntWrapper(persistedValue: 3) },\n             { $0.optInt == IntWrapper(persistedValue: 3) })\n        test(LinkToAllCustomPersistableTypes.self, \"(optInt8 == %@)\",\n             Int8Wrapper(persistedValue: Int8(9)),\n             { $0.optInt8 == Int8Wrapper(persistedValue: Int8(9)) },\n             { $0.optInt8 == Int8Wrapper(persistedValue: Int8(9)) })\n        test(LinkToAllCustomPersistableTypes.self, \"(optInt16 == %@)\",\n             Int16Wrapper(persistedValue: Int16(17)),\n             { $0.optInt16 == Int16Wrapper(persistedValue: Int16(17)) },\n             { $0.optInt16 == Int16Wrapper(persistedValue: Int16(17)) })\n        test(LinkToAllCustomPersistableTypes.self, \"(optInt32 == %@)\",\n             Int32Wrapper(persistedValue: Int32(33)),\n             { $0.optInt32 == Int32Wrapper(persistedValue: Int32(33)) },\n             { $0.optInt32 == Int32Wrapper(persistedValue: Int32(33)) })\n        test(LinkToAllCustomPersistableTypes.self, \"(optInt64 == %@)\",\n             Int64Wrapper(persistedValue: Int64(65)),\n             { $0.optInt64 == Int64Wrapper(persistedValue: Int64(65)) },\n             { $0.optInt64 == Int64Wrapper(persistedValue: Int64(65)) })\n        test(LinkToAllCustomPersistableTypes.self, \"(optFloat == %@)\",\n             FloatWrapper(persistedValue: Float(6.55444333)),\n             { $0.optFloat == FloatWrapper(persistedValue: Float(6.55444333)) },\n             { $0.optFloat == FloatWrapper(persistedValue: Float(6.55444333)) })\n        test(LinkToAllCustomPersistableTypes.self, \"(optDouble == %@)\",\n             DoubleWrapper(persistedValue: 234.567),\n             { $0.optDouble == DoubleWrapper(persistedValue: 234.567) },\n             { $0.optDouble == DoubleWrapper(persistedValue: 234.567) })\n        test(LinkToAllCustomPersistableTypes.self, \"(optString == %@)\",\n             StringWrapper(persistedValue: \"Foó\"),\n             { $0.optString == StringWrapper(persistedValue: \"Foó\") },\n             { $0.optString == StringWrapper(persistedValue: \"Foó\") })\n        test(LinkToAllCustomPersistableTypes.self, \"(optBinary == %@)\",\n             DataWrapper(persistedValue: Data(count: 128)),\n             { $0.optBinary == DataWrapper(persistedValue: Data(count: 128)) },\n             { $0.optBinary == DataWrapper(persistedValue: Data(count: 128)) })\n        test(LinkToAllCustomPersistableTypes.self, \"(optDate == %@)\",\n             DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)),\n             { $0.optDate == DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)) },\n             { $0.optDate == DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)) })\n        test(LinkToAllCustomPersistableTypes.self, \"(optDecimal == %@)\",\n             Decimal128Wrapper(persistedValue: Decimal128(234.567)),\n             { $0.optDecimal == Decimal128Wrapper(persistedValue: Decimal128(234.567)) },\n             { $0.optDecimal == Decimal128Wrapper(persistedValue: Decimal128(234.567)) })\n        test(LinkToAllCustomPersistableTypes.self, \"(optObjectId == %@)\",\n             ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")),\n             { $0.optObjectId == ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")) },\n             { $0.optObjectId == ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")) })\n        test(LinkToAllCustomPersistableTypes.self, \"(optUuid == %@)\",\n             UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!),\n             { $0.optUuid == UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!) },\n             { $0.optUuid == UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!) })\n    }\n\n    func testSetContainsObject() {\n        let obj = objects().first!\n        let colObj = collectionObject()\n        let result = realm.objects(ModernCollectionObject.self).where {\n            $0.set.contains(obj)\n        }\n        XCTAssertEqual(result.count, 0)\n        try! realm.write {\n            colObj.set.insert(obj)\n        }\n        XCTAssertEqual(result.count, 1)\n    }\n\n    func testSetContainsAnyInObject() {\n        assertQuery(ModernAllTypesObject.self, \"(ANY setBool IN %@)\",\n                    values: [NSArray(array: [true, true])], count: 1) {\n            $0.setBool.containsAny(in: [true, true])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setInt IN %@)\",\n                    values: [NSArray(array: [1, 3])], count: 1) {\n            $0.setInt.containsAny(in: [1, 3])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setInt8 IN %@)\",\n                    values: [NSArray(array: [Int8(8), Int8(9)])], count: 1) {\n            $0.setInt8.containsAny(in: [Int8(8), Int8(9)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setInt16 IN %@)\",\n                    values: [NSArray(array: [Int16(16), Int16(17)])], count: 1) {\n            $0.setInt16.containsAny(in: [Int16(16), Int16(17)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setInt32 IN %@)\",\n                    values: [NSArray(array: [Int32(32), Int32(33)])], count: 1) {\n            $0.setInt32.containsAny(in: [Int32(32), Int32(33)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setInt64 IN %@)\",\n                    values: [NSArray(array: [Int64(64), Int64(65)])], count: 1) {\n            $0.setInt64.containsAny(in: [Int64(64), Int64(65)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setFloat IN %@)\",\n                    values: [NSArray(array: [Float(5.55444333), Float(6.55444333)])], count: 1) {\n            $0.setFloat.containsAny(in: [Float(5.55444333), Float(6.55444333)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setDouble IN %@)\",\n                    values: [NSArray(array: [123.456, 234.567])], count: 1) {\n            $0.setDouble.containsAny(in: [123.456, 234.567])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setString IN %@)\",\n                    values: [NSArray(array: [\"Foo\", \"Foó\"])], count: 1) {\n            $0.setString.containsAny(in: [\"Foo\", \"Foó\"])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setBinary IN %@)\",\n                    values: [NSArray(array: [Data(count: 64), Data(count: 128)])], count: 1) {\n            $0.setBinary.containsAny(in: [Data(count: 64), Data(count: 128)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setDate IN %@)\",\n                    values: [NSArray(array: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])], count: 1) {\n            $0.setDate.containsAny(in: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setDecimal IN %@)\",\n                    values: [NSArray(array: [Decimal128(123.456), Decimal128(234.567)])], count: 1) {\n            $0.setDecimal.containsAny(in: [Decimal128(123.456), Decimal128(234.567)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setObjectId IN %@)\",\n                    values: [NSArray(array: [ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])], count: 1) {\n            $0.setObjectId.containsAny(in: [ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setUuid IN %@)\",\n                    values: [NSArray(array: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])], count: 1) {\n            $0.setUuid.containsAny(in: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setAny IN %@)\",\n                    values: [NSArray(array: [AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\")), AnyRealmValue.string(\"Hello\")])], count: 1) {\n            $0.setAny.containsAny(in: [AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\")), AnyRealmValue.string(\"Hello\")])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setInt IN %@)\",\n                    values: [NSArray(array: [EnumInt.value1, EnumInt.value2])], count: 1) {\n            $0.setInt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setInt8 IN %@)\",\n                    values: [NSArray(array: [EnumInt8.value1, EnumInt8.value2])], count: 1) {\n            $0.setInt8.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setInt16 IN %@)\",\n                    values: [NSArray(array: [EnumInt16.value1, EnumInt16.value2])], count: 1) {\n            $0.setInt16.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setInt32 IN %@)\",\n                    values: [NSArray(array: [EnumInt32.value1, EnumInt32.value2])], count: 1) {\n            $0.setInt32.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setInt64 IN %@)\",\n                    values: [NSArray(array: [EnumInt64.value1, EnumInt64.value2])], count: 1) {\n            $0.setInt64.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setFloat IN %@)\",\n                    values: [NSArray(array: [EnumFloat.value1, EnumFloat.value2])], count: 1) {\n            $0.setFloat.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setDouble IN %@)\",\n                    values: [NSArray(array: [EnumDouble.value1, EnumDouble.value2])], count: 1) {\n            $0.setDouble.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setString IN %@)\",\n                    values: [NSArray(array: [EnumString.value1, EnumString.value2])], count: 1) {\n            $0.setString.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setBool IN %@)\",\n                    values: [NSArray(array: [BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: true)])], count: 1) {\n            $0.setBool.containsAny(in: [BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: true)])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setInt IN %@)\",\n                    values: [NSArray(array: [IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])], count: 1) {\n            $0.setInt.containsAny(in: [IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setInt8 IN %@)\",\n                    values: [NSArray(array: [Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])], count: 1) {\n            $0.setInt8.containsAny(in: [Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setInt16 IN %@)\",\n                    values: [NSArray(array: [Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])], count: 1) {\n            $0.setInt16.containsAny(in: [Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setInt32 IN %@)\",\n                    values: [NSArray(array: [Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])], count: 1) {\n            $0.setInt32.containsAny(in: [Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setInt64 IN %@)\",\n                    values: [NSArray(array: [Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])], count: 1) {\n            $0.setInt64.containsAny(in: [Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setFloat IN %@)\",\n                    values: [NSArray(array: [FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])], count: 1) {\n            $0.setFloat.containsAny(in: [FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setDouble IN %@)\",\n                    values: [NSArray(array: [DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])], count: 1) {\n            $0.setDouble.containsAny(in: [DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setString IN %@)\",\n                    values: [NSArray(array: [StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])], count: 1) {\n            $0.setString.containsAny(in: [StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setBinary IN %@)\",\n                    values: [NSArray(array: [DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])], count: 1) {\n            $0.setBinary.containsAny(in: [DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setDate IN %@)\",\n                    values: [NSArray(array: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])], count: 1) {\n            $0.setDate.containsAny(in: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setDecimal IN %@)\",\n                    values: [NSArray(array: [Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])], count: 1) {\n            $0.setDecimal.containsAny(in: [Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setObjectId IN %@)\",\n                    values: [NSArray(array: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])], count: 1) {\n            $0.setObjectId.containsAny(in: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setUuid IN %@)\",\n                    values: [NSArray(array: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])], count: 1) {\n            $0.setUuid.containsAny(in: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptBool IN %@)\",\n                    values: [NSArray(array: [true, true])], count: 1) {\n            $0.setOptBool.containsAny(in: [true, true])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptInt IN %@)\",\n                    values: [NSArray(array: [1, 3])], count: 1) {\n            $0.setOptInt.containsAny(in: [1, 3])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptInt8 IN %@)\",\n                    values: [NSArray(array: [Int8(8), Int8(9)])], count: 1) {\n            $0.setOptInt8.containsAny(in: [Int8(8), Int8(9)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptInt16 IN %@)\",\n                    values: [NSArray(array: [Int16(16), Int16(17)])], count: 1) {\n            $0.setOptInt16.containsAny(in: [Int16(16), Int16(17)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptInt32 IN %@)\",\n                    values: [NSArray(array: [Int32(32), Int32(33)])], count: 1) {\n            $0.setOptInt32.containsAny(in: [Int32(32), Int32(33)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptInt64 IN %@)\",\n                    values: [NSArray(array: [Int64(64), Int64(65)])], count: 1) {\n            $0.setOptInt64.containsAny(in: [Int64(64), Int64(65)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptFloat IN %@)\",\n                    values: [NSArray(array: [Float(5.55444333), Float(6.55444333)])], count: 1) {\n            $0.setOptFloat.containsAny(in: [Float(5.55444333), Float(6.55444333)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptDouble IN %@)\",\n                    values: [NSArray(array: [123.456, 234.567])], count: 1) {\n            $0.setOptDouble.containsAny(in: [123.456, 234.567])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptString IN %@)\",\n                    values: [NSArray(array: [\"Foo\", \"Foó\"])], count: 1) {\n            $0.setOptString.containsAny(in: [\"Foo\", \"Foó\"])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptBinary IN %@)\",\n                    values: [NSArray(array: [Data(count: 64), Data(count: 128)])], count: 1) {\n            $0.setOptBinary.containsAny(in: [Data(count: 64), Data(count: 128)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptDate IN %@)\",\n                    values: [NSArray(array: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])], count: 1) {\n            $0.setOptDate.containsAny(in: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptDecimal IN %@)\",\n                    values: [NSArray(array: [Decimal128(123.456), Decimal128(234.567)])], count: 1) {\n            $0.setOptDecimal.containsAny(in: [Decimal128(123.456), Decimal128(234.567)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptObjectId IN %@)\",\n                    values: [NSArray(array: [ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])], count: 1) {\n            $0.setOptObjectId.containsAny(in: [ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptUuid IN %@)\",\n                    values: [NSArray(array: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])], count: 1) {\n            $0.setOptUuid.containsAny(in: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setIntOpt IN %@)\",\n                    values: [NSArray(array: [EnumInt.value1, EnumInt.value2])], count: 1) {\n            $0.setIntOpt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setInt8Opt IN %@)\",\n                    values: [NSArray(array: [EnumInt8.value1, EnumInt8.value2])], count: 1) {\n            $0.setInt8Opt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setInt16Opt IN %@)\",\n                    values: [NSArray(array: [EnumInt16.value1, EnumInt16.value2])], count: 1) {\n            $0.setInt16Opt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setInt32Opt IN %@)\",\n                    values: [NSArray(array: [EnumInt32.value1, EnumInt32.value2])], count: 1) {\n            $0.setInt32Opt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setInt64Opt IN %@)\",\n                    values: [NSArray(array: [EnumInt64.value1, EnumInt64.value2])], count: 1) {\n            $0.setInt64Opt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setFloatOpt IN %@)\",\n                    values: [NSArray(array: [EnumFloat.value1, EnumFloat.value2])], count: 1) {\n            $0.setFloatOpt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setDoubleOpt IN %@)\",\n                    values: [NSArray(array: [EnumDouble.value1, EnumDouble.value2])], count: 1) {\n            $0.setDoubleOpt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setStringOpt IN %@)\",\n                    values: [NSArray(array: [EnumString.value1, EnumString.value2])], count: 1) {\n            $0.setStringOpt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptBool IN %@)\",\n                    values: [NSArray(array: [BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: true)])], count: 1) {\n            $0.setOptBool.containsAny(in: [BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: true)])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptInt IN %@)\",\n                    values: [NSArray(array: [IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])], count: 1) {\n            $0.setOptInt.containsAny(in: [IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptInt8 IN %@)\",\n                    values: [NSArray(array: [Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])], count: 1) {\n            $0.setOptInt8.containsAny(in: [Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptInt16 IN %@)\",\n                    values: [NSArray(array: [Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])], count: 1) {\n            $0.setOptInt16.containsAny(in: [Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptInt32 IN %@)\",\n                    values: [NSArray(array: [Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])], count: 1) {\n            $0.setOptInt32.containsAny(in: [Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptInt64 IN %@)\",\n                    values: [NSArray(array: [Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])], count: 1) {\n            $0.setOptInt64.containsAny(in: [Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptFloat IN %@)\",\n                    values: [NSArray(array: [FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])], count: 1) {\n            $0.setOptFloat.containsAny(in: [FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptDouble IN %@)\",\n                    values: [NSArray(array: [DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])], count: 1) {\n            $0.setOptDouble.containsAny(in: [DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptString IN %@)\",\n                    values: [NSArray(array: [StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])], count: 1) {\n            $0.setOptString.containsAny(in: [StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptBinary IN %@)\",\n                    values: [NSArray(array: [DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])], count: 1) {\n            $0.setOptBinary.containsAny(in: [DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptDate IN %@)\",\n                    values: [NSArray(array: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])], count: 1) {\n            $0.setOptDate.containsAny(in: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptDecimal IN %@)\",\n                    values: [NSArray(array: [Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])], count: 1) {\n            $0.setOptDecimal.containsAny(in: [Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptObjectId IN %@)\",\n                    values: [NSArray(array: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])], count: 1) {\n            $0.setOptObjectId.containsAny(in: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptUuid IN %@)\",\n                    values: [NSArray(array: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])], count: 1) {\n            $0.setOptUuid.containsAny(in: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])\n        }\n\n        let colObj = ModernCollectionObject()\n        let obj = objects().first!\n        colObj.set.insert(obj)\n        try! realm.write {\n            realm.add(colObj)\n        }\n\n        assertQuery(ModernCollectionObject.self, \"(ANY set IN %@)\", values: [NSArray(array: [obj])], count: 1) {\n            $0.set.containsAny(in: [obj])\n        }\n    }\n\n    // MARK: - Map\n\n    private func validateAllKeys<Root: Object, T: RealmKeyedCollection>(_ name: String, _ lhs: (Query<Root>) -> Query<T>)\n            where T.Key == String {\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys == %@)\", \"foo\", count: 1) {\n            lhs($0).keys == \"foo\"\n        }\n\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys != %@)\", \"foo\", count: 1) {\n            lhs($0).keys != \"foo\"\n        }\n\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys CONTAINS[cd] %@)\", \"foo\", count: 1) {\n            lhs($0).keys.contains(\"foo\", options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys CONTAINS %@)\", \"foo\", count: 1) {\n            lhs($0).keys.contains(\"foo\")\n        }\n\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys BEGINSWITH[cd] %@)\", \"foo\", count: 1) {\n            lhs($0).keys.starts(with: \"foo\", options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys BEGINSWITH %@)\", \"foo\", count: 1) {\n            lhs($0).keys.starts(with: \"foo\")\n        }\n\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys ENDSWITH[cd] %@)\", \"foo\", count: 1) {\n            lhs($0).keys.ends(with: \"foo\", options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys ENDSWITH %@)\", \"foo\", count: 1) {\n            lhs($0).keys.ends(with: \"foo\")\n        }\n\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys LIKE[c] %@)\", \"foo\", count: 1) {\n            lhs($0).keys.like(\"foo\", caseInsensitive: true)\n        }\n\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys LIKE %@)\", \"foo\", count: 1) {\n            lhs($0).keys.like(\"foo\")\n        }\n    }\n\n    func testMapAllKeys() {\n        validateAllKeys(\"mapBool\", \\Query<ModernAllTypesObject>.mapBool)\n        validateAllKeys(\"mapInt\", \\Query<ModernAllTypesObject>.mapInt)\n        validateAllKeys(\"mapInt8\", \\Query<ModernAllTypesObject>.mapInt8)\n        validateAllKeys(\"mapInt16\", \\Query<ModernAllTypesObject>.mapInt16)\n        validateAllKeys(\"mapInt32\", \\Query<ModernAllTypesObject>.mapInt32)\n        validateAllKeys(\"mapInt64\", \\Query<ModernAllTypesObject>.mapInt64)\n        validateAllKeys(\"mapFloat\", \\Query<ModernAllTypesObject>.mapFloat)\n        validateAllKeys(\"mapDouble\", \\Query<ModernAllTypesObject>.mapDouble)\n        validateAllKeys(\"mapString\", \\Query<ModernAllTypesObject>.mapString)\n        validateAllKeys(\"mapBinary\", \\Query<ModernAllTypesObject>.mapBinary)\n        validateAllKeys(\"mapDate\", \\Query<ModernAllTypesObject>.mapDate)\n        validateAllKeys(\"mapDecimal\", \\Query<ModernAllTypesObject>.mapDecimal)\n        validateAllKeys(\"mapObjectId\", \\Query<ModernAllTypesObject>.mapObjectId)\n        validateAllKeys(\"mapUuid\", \\Query<ModernAllTypesObject>.mapUuid)\n        validateAllKeys(\"mapAny\", \\Query<ModernAllTypesObject>.mapAny)\n        validateAllKeys(\"mapInt\", \\Query<ModernCollectionsOfEnums>.mapInt)\n        validateAllKeys(\"mapInt8\", \\Query<ModernCollectionsOfEnums>.mapInt8)\n        validateAllKeys(\"mapInt16\", \\Query<ModernCollectionsOfEnums>.mapInt16)\n        validateAllKeys(\"mapInt32\", \\Query<ModernCollectionsOfEnums>.mapInt32)\n        validateAllKeys(\"mapInt64\", \\Query<ModernCollectionsOfEnums>.mapInt64)\n        validateAllKeys(\"mapFloat\", \\Query<ModernCollectionsOfEnums>.mapFloat)\n        validateAllKeys(\"mapDouble\", \\Query<ModernCollectionsOfEnums>.mapDouble)\n        validateAllKeys(\"mapString\", \\Query<ModernCollectionsOfEnums>.mapString)\n        validateAllKeys(\"mapBool\", \\Query<CustomPersistableCollections>.mapBool)\n        validateAllKeys(\"mapInt\", \\Query<CustomPersistableCollections>.mapInt)\n        validateAllKeys(\"mapInt8\", \\Query<CustomPersistableCollections>.mapInt8)\n        validateAllKeys(\"mapInt16\", \\Query<CustomPersistableCollections>.mapInt16)\n        validateAllKeys(\"mapInt32\", \\Query<CustomPersistableCollections>.mapInt32)\n        validateAllKeys(\"mapInt64\", \\Query<CustomPersistableCollections>.mapInt64)\n        validateAllKeys(\"mapFloat\", \\Query<CustomPersistableCollections>.mapFloat)\n        validateAllKeys(\"mapDouble\", \\Query<CustomPersistableCollections>.mapDouble)\n        validateAllKeys(\"mapString\", \\Query<CustomPersistableCollections>.mapString)\n        validateAllKeys(\"mapBinary\", \\Query<CustomPersistableCollections>.mapBinary)\n        validateAllKeys(\"mapDate\", \\Query<CustomPersistableCollections>.mapDate)\n        validateAllKeys(\"mapDecimal\", \\Query<CustomPersistableCollections>.mapDecimal)\n        validateAllKeys(\"mapObjectId\", \\Query<CustomPersistableCollections>.mapObjectId)\n        validateAllKeys(\"mapUuid\", \\Query<CustomPersistableCollections>.mapUuid)\n        validateAllKeys(\"mapOptBool\", \\Query<ModernAllTypesObject>.mapOptBool)\n        validateAllKeys(\"mapOptInt\", \\Query<ModernAllTypesObject>.mapOptInt)\n        validateAllKeys(\"mapOptInt8\", \\Query<ModernAllTypesObject>.mapOptInt8)\n        validateAllKeys(\"mapOptInt16\", \\Query<ModernAllTypesObject>.mapOptInt16)\n        validateAllKeys(\"mapOptInt32\", \\Query<ModernAllTypesObject>.mapOptInt32)\n        validateAllKeys(\"mapOptInt64\", \\Query<ModernAllTypesObject>.mapOptInt64)\n        validateAllKeys(\"mapOptFloat\", \\Query<ModernAllTypesObject>.mapOptFloat)\n        validateAllKeys(\"mapOptDouble\", \\Query<ModernAllTypesObject>.mapOptDouble)\n        validateAllKeys(\"mapOptString\", \\Query<ModernAllTypesObject>.mapOptString)\n        validateAllKeys(\"mapOptBinary\", \\Query<ModernAllTypesObject>.mapOptBinary)\n        validateAllKeys(\"mapOptDate\", \\Query<ModernAllTypesObject>.mapOptDate)\n        validateAllKeys(\"mapOptDecimal\", \\Query<ModernAllTypesObject>.mapOptDecimal)\n        validateAllKeys(\"mapOptObjectId\", \\Query<ModernAllTypesObject>.mapOptObjectId)\n        validateAllKeys(\"mapOptUuid\", \\Query<ModernAllTypesObject>.mapOptUuid)\n        validateAllKeys(\"mapIntOpt\", \\Query<ModernCollectionsOfEnums>.mapIntOpt)\n        validateAllKeys(\"mapInt8Opt\", \\Query<ModernCollectionsOfEnums>.mapInt8Opt)\n        validateAllKeys(\"mapInt16Opt\", \\Query<ModernCollectionsOfEnums>.mapInt16Opt)\n        validateAllKeys(\"mapInt32Opt\", \\Query<ModernCollectionsOfEnums>.mapInt32Opt)\n        validateAllKeys(\"mapInt64Opt\", \\Query<ModernCollectionsOfEnums>.mapInt64Opt)\n        validateAllKeys(\"mapFloatOpt\", \\Query<ModernCollectionsOfEnums>.mapFloatOpt)\n        validateAllKeys(\"mapDoubleOpt\", \\Query<ModernCollectionsOfEnums>.mapDoubleOpt)\n        validateAllKeys(\"mapStringOpt\", \\Query<ModernCollectionsOfEnums>.mapStringOpt)\n        validateAllKeys(\"mapOptBool\", \\Query<CustomPersistableCollections>.mapOptBool)\n        validateAllKeys(\"mapOptInt\", \\Query<CustomPersistableCollections>.mapOptInt)\n        validateAllKeys(\"mapOptInt8\", \\Query<CustomPersistableCollections>.mapOptInt8)\n        validateAllKeys(\"mapOptInt16\", \\Query<CustomPersistableCollections>.mapOptInt16)\n        validateAllKeys(\"mapOptInt32\", \\Query<CustomPersistableCollections>.mapOptInt32)\n        validateAllKeys(\"mapOptInt64\", \\Query<CustomPersistableCollections>.mapOptInt64)\n        validateAllKeys(\"mapOptFloat\", \\Query<CustomPersistableCollections>.mapOptFloat)\n        validateAllKeys(\"mapOptDouble\", \\Query<CustomPersistableCollections>.mapOptDouble)\n        validateAllKeys(\"mapOptString\", \\Query<CustomPersistableCollections>.mapOptString)\n        validateAllKeys(\"mapOptBinary\", \\Query<CustomPersistableCollections>.mapOptBinary)\n        validateAllKeys(\"mapOptDate\", \\Query<CustomPersistableCollections>.mapOptDate)\n        validateAllKeys(\"mapOptDecimal\", \\Query<CustomPersistableCollections>.mapOptDecimal)\n        validateAllKeys(\"mapOptObjectId\", \\Query<CustomPersistableCollections>.mapOptObjectId)\n        validateAllKeys(\"mapOptUuid\", \\Query<CustomPersistableCollections>.mapOptUuid)\n    }\n\n    // swiftlint:disable unused_closure_parameter\n    func testMapAllValues() {\n        validateEquals(\"ANY mapBool.@allValues\", \\Query<ModernAllTypesObject>.mapBool.values, true)\n\n        validateEquals(\"ANY mapInt.@allValues\", \\Query<ModernAllTypesObject>.mapInt.values, 1, notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapInt.@allValues\", \\Query<ModernAllTypesObject>.mapInt.values, 3, ltCount: 1)\n\n        validateEquals(\"ANY mapInt8.@allValues\", \\Query<ModernAllTypesObject>.mapInt8.values, Int8(8), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapInt8.@allValues\", \\Query<ModernAllTypesObject>.mapInt8.values, Int8(9), ltCount: 1)\n\n        validateEquals(\"ANY mapInt16.@allValues\", \\Query<ModernAllTypesObject>.mapInt16.values, Int16(16), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapInt16.@allValues\", \\Query<ModernAllTypesObject>.mapInt16.values, Int16(17), ltCount: 1)\n\n        validateEquals(\"ANY mapInt32.@allValues\", \\Query<ModernAllTypesObject>.mapInt32.values, Int32(32), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapInt32.@allValues\", \\Query<ModernAllTypesObject>.mapInt32.values, Int32(33), ltCount: 1)\n\n        validateEquals(\"ANY mapInt64.@allValues\", \\Query<ModernAllTypesObject>.mapInt64.values, Int64(64), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapInt64.@allValues\", \\Query<ModernAllTypesObject>.mapInt64.values, Int64(65), ltCount: 1)\n\n        validateEquals(\"ANY mapFloat.@allValues\", \\Query<ModernAllTypesObject>.mapFloat.values, Float(5.55444333), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapFloat.@allValues\", \\Query<ModernAllTypesObject>.mapFloat.values, Float(6.55444333), ltCount: 1)\n\n        validateEquals(\"ANY mapDouble.@allValues\", \\Query<ModernAllTypesObject>.mapDouble.values, 123.456, notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapDouble.@allValues\", \\Query<ModernAllTypesObject>.mapDouble.values, 234.567, ltCount: 1)\n\n        validateEquals(\"ANY mapString.@allValues\", \\Query<ModernAllTypesObject>.mapString.values, \"Foo\", notEqualCount: 1)\n        validateStringOperations(\"ANY mapString.@allValues\", \\Query<ModernAllTypesObject>.mapString.values,\n                                 (\"Foo\", \"Foo\", \"Foo\")) { equals, options in\n            // Non-enum maps have the keys Foo and Foó, so !=[d] doesn't match any\n            if options.contains(.diacriticInsensitive) {\n                return equals ? 1 : 0\n            }\n            return 1\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapString.@allValues LIKE[c] %@)\", \"Foo\", count: 1) {\n            $0.mapString.values.like(\"Foo\", caseInsensitive: true)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapString.@allValues LIKE %@)\", \"Foo\", count: 1) {\n            $0.mapString.values.like(\"Foo\")\n        }\n\n        validateEquals(\"ANY mapBinary.@allValues\", \\Query<ModernAllTypesObject>.mapBinary.values, Data(count: 64), notEqualCount: 1)\n\n        validateEquals(\"ANY mapDate.@allValues\", \\Query<ModernAllTypesObject>.mapDate.values, Date(timeIntervalSince1970: 1000000), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapDate.@allValues\", \\Query<ModernAllTypesObject>.mapDate.values, Date(timeIntervalSince1970: 2000000), ltCount: 1)\n\n        validateEquals(\"ANY mapDecimal.@allValues\", \\Query<ModernAllTypesObject>.mapDecimal.values, Decimal128(123.456), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapDecimal.@allValues\", \\Query<ModernAllTypesObject>.mapDecimal.values, Decimal128(234.567), ltCount: 1)\n\n        validateEquals(\"ANY mapObjectId.@allValues\", \\Query<ModernAllTypesObject>.mapObjectId.values, ObjectId(\"61184062c1d8f096a3695046\"), notEqualCount: 1)\n\n        validateEquals(\"ANY mapUuid.@allValues\", \\Query<ModernAllTypesObject>.mapUuid.values, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, notEqualCount: 1)\n\n        validateEquals(\"ANY mapAny.@allValues\", \\Query<ModernAllTypesObject>.mapAny.values, AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\")), notEqualCount: 1)\n\n        validateEquals(\"ANY mapInt.@allValues\", \\Query<ModernCollectionsOfEnums>.mapInt.values, EnumInt.value1, notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapInt.@allValues\", \\Query<ModernCollectionsOfEnums>.mapInt.values, .value2, ltCount: 1)\n\n        validateEquals(\"ANY mapInt8.@allValues\", \\Query<ModernCollectionsOfEnums>.mapInt8.values, EnumInt8.value1, notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapInt8.@allValues\", \\Query<ModernCollectionsOfEnums>.mapInt8.values, .value2, ltCount: 1)\n\n        validateEquals(\"ANY mapInt16.@allValues\", \\Query<ModernCollectionsOfEnums>.mapInt16.values, EnumInt16.value1, notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapInt16.@allValues\", \\Query<ModernCollectionsOfEnums>.mapInt16.values, .value2, ltCount: 1)\n\n        validateEquals(\"ANY mapInt32.@allValues\", \\Query<ModernCollectionsOfEnums>.mapInt32.values, EnumInt32.value1, notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapInt32.@allValues\", \\Query<ModernCollectionsOfEnums>.mapInt32.values, .value2, ltCount: 1)\n\n        validateEquals(\"ANY mapInt64.@allValues\", \\Query<ModernCollectionsOfEnums>.mapInt64.values, EnumInt64.value1, notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapInt64.@allValues\", \\Query<ModernCollectionsOfEnums>.mapInt64.values, .value2, ltCount: 1)\n\n        validateEquals(\"ANY mapFloat.@allValues\", \\Query<ModernCollectionsOfEnums>.mapFloat.values, EnumFloat.value1, notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapFloat.@allValues\", \\Query<ModernCollectionsOfEnums>.mapFloat.values, .value2, ltCount: 1)\n\n        validateEquals(\"ANY mapDouble.@allValues\", \\Query<ModernCollectionsOfEnums>.mapDouble.values, EnumDouble.value1, notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapDouble.@allValues\", \\Query<ModernCollectionsOfEnums>.mapDouble.values, .value2, ltCount: 1)\n\n        validateEquals(\"ANY mapString.@allValues\", \\Query<ModernCollectionsOfEnums>.mapString.values, EnumString.value1, notEqualCount: 1)\n        validateStringOperations(\"ANY mapString.@allValues\", \\Query<ModernCollectionsOfEnums>.mapString.values,\n                                 (.value1, .value1, .value1)) { equals, options in\n            return 1\n        }\n\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapString.@allValues LIKE[c] %@)\", EnumString.value1, count: 1) {\n            $0.mapString.values.like(.value1, caseInsensitive: true)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapString.@allValues LIKE %@)\", EnumString.value1, count: 1) {\n            $0.mapString.values.like(.value1)\n        }\n\n        validateEquals(\"ANY mapBool.@allValues\", \\Query<CustomPersistableCollections>.mapBool.values, BoolWrapper(persistedValue: true))\n\n        validateEquals(\"ANY mapInt.@allValues\", \\Query<CustomPersistableCollections>.mapInt.values, IntWrapper(persistedValue: 1), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapInt.@allValues\", \\Query<CustomPersistableCollections>.mapInt.values, IntWrapper(persistedValue: 3), ltCount: 1)\n\n        validateEquals(\"ANY mapInt8.@allValues\", \\Query<CustomPersistableCollections>.mapInt8.values, Int8Wrapper(persistedValue: Int8(8)), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapInt8.@allValues\", \\Query<CustomPersistableCollections>.mapInt8.values, Int8Wrapper(persistedValue: Int8(9)), ltCount: 1)\n\n        validateEquals(\"ANY mapInt16.@allValues\", \\Query<CustomPersistableCollections>.mapInt16.values, Int16Wrapper(persistedValue: Int16(16)), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapInt16.@allValues\", \\Query<CustomPersistableCollections>.mapInt16.values, Int16Wrapper(persistedValue: Int16(17)), ltCount: 1)\n\n        validateEquals(\"ANY mapInt32.@allValues\", \\Query<CustomPersistableCollections>.mapInt32.values, Int32Wrapper(persistedValue: Int32(32)), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapInt32.@allValues\", \\Query<CustomPersistableCollections>.mapInt32.values, Int32Wrapper(persistedValue: Int32(33)), ltCount: 1)\n\n        validateEquals(\"ANY mapInt64.@allValues\", \\Query<CustomPersistableCollections>.mapInt64.values, Int64Wrapper(persistedValue: Int64(64)), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapInt64.@allValues\", \\Query<CustomPersistableCollections>.mapInt64.values, Int64Wrapper(persistedValue: Int64(65)), ltCount: 1)\n\n        validateEquals(\"ANY mapFloat.@allValues\", \\Query<CustomPersistableCollections>.mapFloat.values, FloatWrapper(persistedValue: Float(5.55444333)), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapFloat.@allValues\", \\Query<CustomPersistableCollections>.mapFloat.values, FloatWrapper(persistedValue: Float(6.55444333)), ltCount: 1)\n\n        validateEquals(\"ANY mapDouble.@allValues\", \\Query<CustomPersistableCollections>.mapDouble.values, DoubleWrapper(persistedValue: 123.456), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapDouble.@allValues\", \\Query<CustomPersistableCollections>.mapDouble.values, DoubleWrapper(persistedValue: 234.567), ltCount: 1)\n\n        validateEquals(\"ANY mapString.@allValues\", \\Query<CustomPersistableCollections>.mapString.values, StringWrapper(persistedValue: \"Foo\"), notEqualCount: 1)\n        validateStringOperations(\"ANY mapString.@allValues\", \\Query<CustomPersistableCollections>.mapString.values,\n                                 (StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foo\"))) { equals, options in\n            // Non-enum maps have the keys Foo and Foó, so !=[d] doesn't match any\n            if options.contains(.diacriticInsensitive) {\n                return equals ? 1 : 0\n            }\n            return 1\n        }\n\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapString.@allValues LIKE[c] %@)\", StringWrapper(persistedValue: \"Foo\"), count: 1) {\n            $0.mapString.values.like(StringWrapper(persistedValue: \"Foo\"), caseInsensitive: true)\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapString.@allValues LIKE %@)\", StringWrapper(persistedValue: \"Foo\"), count: 1) {\n            $0.mapString.values.like(StringWrapper(persistedValue: \"Foo\"))\n        }\n\n        validateEquals(\"ANY mapBinary.@allValues\", \\Query<CustomPersistableCollections>.mapBinary.values, DataWrapper(persistedValue: Data(count: 64)), notEqualCount: 1)\n\n        validateEquals(\"ANY mapDate.@allValues\", \\Query<CustomPersistableCollections>.mapDate.values, DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapDate.@allValues\", \\Query<CustomPersistableCollections>.mapDate.values, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)), ltCount: 1)\n\n        validateEquals(\"ANY mapDecimal.@allValues\", \\Query<CustomPersistableCollections>.mapDecimal.values, Decimal128Wrapper(persistedValue: Decimal128(123.456)), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapDecimal.@allValues\", \\Query<CustomPersistableCollections>.mapDecimal.values, Decimal128Wrapper(persistedValue: Decimal128(234.567)), ltCount: 1)\n\n        validateEquals(\"ANY mapObjectId.@allValues\", \\Query<CustomPersistableCollections>.mapObjectId.values, ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), notEqualCount: 1)\n\n        validateEquals(\"ANY mapUuid.@allValues\", \\Query<CustomPersistableCollections>.mapUuid.values, UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), notEqualCount: 1)\n\n        validateEquals(\"ANY mapOptBool.@allValues\", \\Query<ModernAllTypesObject>.mapOptBool.values, true)\n\n        validateEquals(\"ANY mapOptInt.@allValues\", \\Query<ModernAllTypesObject>.mapOptInt.values, 1, notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapOptInt.@allValues\", \\Query<ModernAllTypesObject>.mapOptInt.values, 3, ltCount: 1)\n\n        validateEquals(\"ANY mapOptInt8.@allValues\", \\Query<ModernAllTypesObject>.mapOptInt8.values, Int8(8), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapOptInt8.@allValues\", \\Query<ModernAllTypesObject>.mapOptInt8.values, Int8(9), ltCount: 1)\n\n        validateEquals(\"ANY mapOptInt16.@allValues\", \\Query<ModernAllTypesObject>.mapOptInt16.values, Int16(16), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapOptInt16.@allValues\", \\Query<ModernAllTypesObject>.mapOptInt16.values, Int16(17), ltCount: 1)\n\n        validateEquals(\"ANY mapOptInt32.@allValues\", \\Query<ModernAllTypesObject>.mapOptInt32.values, Int32(32), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapOptInt32.@allValues\", \\Query<ModernAllTypesObject>.mapOptInt32.values, Int32(33), ltCount: 1)\n\n        validateEquals(\"ANY mapOptInt64.@allValues\", \\Query<ModernAllTypesObject>.mapOptInt64.values, Int64(64), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapOptInt64.@allValues\", \\Query<ModernAllTypesObject>.mapOptInt64.values, Int64(65), ltCount: 1)\n\n        validateEquals(\"ANY mapOptFloat.@allValues\", \\Query<ModernAllTypesObject>.mapOptFloat.values, Float(5.55444333), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapOptFloat.@allValues\", \\Query<ModernAllTypesObject>.mapOptFloat.values, Float(6.55444333), ltCount: 1)\n\n        validateEquals(\"ANY mapOptDouble.@allValues\", \\Query<ModernAllTypesObject>.mapOptDouble.values, 123.456, notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapOptDouble.@allValues\", \\Query<ModernAllTypesObject>.mapOptDouble.values, 234.567, ltCount: 1)\n\n        validateEquals(\"ANY mapOptString.@allValues\", \\Query<ModernAllTypesObject>.mapOptString.values, \"Foo\", notEqualCount: 1)\n        validateStringOperations(\"ANY mapOptString.@allValues\", \\Query<ModernAllTypesObject>.mapOptString.values,\n                                 (\"Foo\", \"Foo\", \"Foo\")) { equals, options in\n            // Non-enum maps have the keys Foo and Foó, so !=[d] doesn't match any\n            if options.contains(.diacriticInsensitive) {\n                return equals ? 1 : 0\n            }\n            return 1\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapOptString.@allValues LIKE[c] %@)\", \"Foo\", count: 1) {\n            $0.mapOptString.values.like(\"Foo\", caseInsensitive: true)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapOptString.@allValues LIKE %@)\", \"Foo\", count: 1) {\n            $0.mapOptString.values.like(\"Foo\")\n        }\n\n        validateEquals(\"ANY mapOptBinary.@allValues\", \\Query<ModernAllTypesObject>.mapOptBinary.values, Data(count: 64), notEqualCount: 1)\n\n        validateEquals(\"ANY mapOptDate.@allValues\", \\Query<ModernAllTypesObject>.mapOptDate.values, Date(timeIntervalSince1970: 1000000), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapOptDate.@allValues\", \\Query<ModernAllTypesObject>.mapOptDate.values, Date(timeIntervalSince1970: 2000000), ltCount: 1)\n\n        validateEquals(\"ANY mapOptDecimal.@allValues\", \\Query<ModernAllTypesObject>.mapOptDecimal.values, Decimal128(123.456), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapOptDecimal.@allValues\", \\Query<ModernAllTypesObject>.mapOptDecimal.values, Decimal128(234.567), ltCount: 1)\n\n        validateEquals(\"ANY mapOptObjectId.@allValues\", \\Query<ModernAllTypesObject>.mapOptObjectId.values, ObjectId(\"61184062c1d8f096a3695046\"), notEqualCount: 1)\n\n        validateEquals(\"ANY mapOptUuid.@allValues\", \\Query<ModernAllTypesObject>.mapOptUuid.values, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, notEqualCount: 1)\n\n        validateEquals(\"ANY mapIntOpt.@allValues\", \\Query<ModernCollectionsOfEnums>.mapIntOpt.values, EnumInt.value1, notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapIntOpt.@allValues\", \\Query<ModernCollectionsOfEnums>.mapIntOpt.values, .value2, ltCount: 1)\n\n        validateEquals(\"ANY mapInt8Opt.@allValues\", \\Query<ModernCollectionsOfEnums>.mapInt8Opt.values, EnumInt8.value1, notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapInt8Opt.@allValues\", \\Query<ModernCollectionsOfEnums>.mapInt8Opt.values, .value2, ltCount: 1)\n\n        validateEquals(\"ANY mapInt16Opt.@allValues\", \\Query<ModernCollectionsOfEnums>.mapInt16Opt.values, EnumInt16.value1, notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapInt16Opt.@allValues\", \\Query<ModernCollectionsOfEnums>.mapInt16Opt.values, .value2, ltCount: 1)\n\n        validateEquals(\"ANY mapInt32Opt.@allValues\", \\Query<ModernCollectionsOfEnums>.mapInt32Opt.values, EnumInt32.value1, notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapInt32Opt.@allValues\", \\Query<ModernCollectionsOfEnums>.mapInt32Opt.values, .value2, ltCount: 1)\n\n        validateEquals(\"ANY mapInt64Opt.@allValues\", \\Query<ModernCollectionsOfEnums>.mapInt64Opt.values, EnumInt64.value1, notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapInt64Opt.@allValues\", \\Query<ModernCollectionsOfEnums>.mapInt64Opt.values, .value2, ltCount: 1)\n\n        validateEquals(\"ANY mapFloatOpt.@allValues\", \\Query<ModernCollectionsOfEnums>.mapFloatOpt.values, EnumFloat.value1, notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapFloatOpt.@allValues\", \\Query<ModernCollectionsOfEnums>.mapFloatOpt.values, .value2, ltCount: 1)\n\n        validateEquals(\"ANY mapDoubleOpt.@allValues\", \\Query<ModernCollectionsOfEnums>.mapDoubleOpt.values, EnumDouble.value1, notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapDoubleOpt.@allValues\", \\Query<ModernCollectionsOfEnums>.mapDoubleOpt.values, .value2, ltCount: 1)\n\n        validateEquals(\"ANY mapStringOpt.@allValues\", \\Query<ModernCollectionsOfEnums>.mapStringOpt.values, EnumString.value1, notEqualCount: 1)\n        validateStringOperations(\"ANY mapStringOpt.@allValues\", \\Query<ModernCollectionsOfEnums>.mapStringOpt.values,\n                                 (.value1, .value1, .value1)) { equals, options in\n            return 1\n        }\n\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapStringOpt.@allValues LIKE[c] %@)\", EnumString.value1, count: 1) {\n            $0.mapStringOpt.values.like(.value1, caseInsensitive: true)\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapStringOpt.@allValues LIKE %@)\", EnumString.value1, count: 1) {\n            $0.mapStringOpt.values.like(.value1)\n        }\n\n        validateEquals(\"ANY mapOptBool.@allValues\", \\Query<CustomPersistableCollections>.mapOptBool.values, BoolWrapper(persistedValue: true))\n\n        validateEquals(\"ANY mapOptInt.@allValues\", \\Query<CustomPersistableCollections>.mapOptInt.values, IntWrapper(persistedValue: 1), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapOptInt.@allValues\", \\Query<CustomPersistableCollections>.mapOptInt.values, IntWrapper(persistedValue: 3), ltCount: 1)\n\n        validateEquals(\"ANY mapOptInt8.@allValues\", \\Query<CustomPersistableCollections>.mapOptInt8.values, Int8Wrapper(persistedValue: Int8(8)), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapOptInt8.@allValues\", \\Query<CustomPersistableCollections>.mapOptInt8.values, Int8Wrapper(persistedValue: Int8(9)), ltCount: 1)\n\n        validateEquals(\"ANY mapOptInt16.@allValues\", \\Query<CustomPersistableCollections>.mapOptInt16.values, Int16Wrapper(persistedValue: Int16(16)), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapOptInt16.@allValues\", \\Query<CustomPersistableCollections>.mapOptInt16.values, Int16Wrapper(persistedValue: Int16(17)), ltCount: 1)\n\n        validateEquals(\"ANY mapOptInt32.@allValues\", \\Query<CustomPersistableCollections>.mapOptInt32.values, Int32Wrapper(persistedValue: Int32(32)), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapOptInt32.@allValues\", \\Query<CustomPersistableCollections>.mapOptInt32.values, Int32Wrapper(persistedValue: Int32(33)), ltCount: 1)\n\n        validateEquals(\"ANY mapOptInt64.@allValues\", \\Query<CustomPersistableCollections>.mapOptInt64.values, Int64Wrapper(persistedValue: Int64(64)), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapOptInt64.@allValues\", \\Query<CustomPersistableCollections>.mapOptInt64.values, Int64Wrapper(persistedValue: Int64(65)), ltCount: 1)\n\n        validateEquals(\"ANY mapOptFloat.@allValues\", \\Query<CustomPersistableCollections>.mapOptFloat.values, FloatWrapper(persistedValue: Float(5.55444333)), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapOptFloat.@allValues\", \\Query<CustomPersistableCollections>.mapOptFloat.values, FloatWrapper(persistedValue: Float(6.55444333)), ltCount: 1)\n\n        validateEquals(\"ANY mapOptDouble.@allValues\", \\Query<CustomPersistableCollections>.mapOptDouble.values, DoubleWrapper(persistedValue: 123.456), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapOptDouble.@allValues\", \\Query<CustomPersistableCollections>.mapOptDouble.values, DoubleWrapper(persistedValue: 234.567), ltCount: 1)\n\n        validateEquals(\"ANY mapOptString.@allValues\", \\Query<CustomPersistableCollections>.mapOptString.values, StringWrapper(persistedValue: \"Foo\"), notEqualCount: 1)\n        validateStringOperations(\"ANY mapOptString.@allValues\", \\Query<CustomPersistableCollections>.mapOptString.values,\n                                 (StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foo\"))) { equals, options in\n            // Non-enum maps have the keys Foo and Foó, so !=[d] doesn't match any\n            if options.contains(.diacriticInsensitive) {\n                return equals ? 1 : 0\n            }\n            return 1\n        }\n\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapOptString.@allValues LIKE[c] %@)\", StringWrapper(persistedValue: \"Foo\"), count: 1) {\n            $0.mapOptString.values.like(StringWrapper(persistedValue: \"Foo\"), caseInsensitive: true)\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapOptString.@allValues LIKE %@)\", StringWrapper(persistedValue: \"Foo\"), count: 1) {\n            $0.mapOptString.values.like(StringWrapper(persistedValue: \"Foo\"))\n        }\n\n        validateEquals(\"ANY mapOptBinary.@allValues\", \\Query<CustomPersistableCollections>.mapOptBinary.values, DataWrapper(persistedValue: Data(count: 64)), notEqualCount: 1)\n\n        validateEquals(\"ANY mapOptDate.@allValues\", \\Query<CustomPersistableCollections>.mapOptDate.values, DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapOptDate.@allValues\", \\Query<CustomPersistableCollections>.mapOptDate.values, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)), ltCount: 1)\n\n        validateEquals(\"ANY mapOptDecimal.@allValues\", \\Query<CustomPersistableCollections>.mapOptDecimal.values, Decimal128Wrapper(persistedValue: Decimal128(123.456)), notEqualCount: 1)\n        validateNumericComparisons(\"ANY mapOptDecimal.@allValues\", \\Query<CustomPersistableCollections>.mapOptDecimal.values, Decimal128Wrapper(persistedValue: Decimal128(234.567)), ltCount: 1)\n\n        validateEquals(\"ANY mapOptObjectId.@allValues\", \\Query<CustomPersistableCollections>.mapOptObjectId.values, ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), notEqualCount: 1)\n\n        validateEquals(\"ANY mapOptUuid.@allValues\", \\Query<CustomPersistableCollections>.mapOptUuid.values, UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), notEqualCount: 1)\n\n    }\n    // swiftlint:enable unused_closure_parameter\n\n    func testMapContainsObject() {\n        let obj = objects().first!\n        let colObj = collectionObject()\n        let result = realm.objects(ModernCollectionObject.self).where {\n            $0.map.contains(obj)\n        }\n        XCTAssertEqual(result.count, 0)\n        try! realm.write {\n            colObj.map[\"foo\"] = obj\n        }\n        XCTAssertEqual(result.count, 1)\n    }\n\n    private func validateMapSubscriptEquality<Root: Object, T: RealmKeyedCollection>(_ name: String, _ lhs: (Query<Root>) -> Query<T>, value: T.Value)\n            where T.Key == String {\n        assertQuery(Root.self, \"(\\(name)[%@] == %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"] == value\n        }\n        assertQuery(Root.self, \"(\\(name)[%@] != %@)\", values: [\"foo\", value], count: 0) {\n            lhs($0)[\"foo\"] != value\n        }\n    }\n\n    private func validateMapSubscriptNumericComparisons<Root: Object, T: RealmKeyedCollection>(_ name: String, _ lhs: (Query<Root>) -> Query<T>, value: T.Value)\n            where T.Value.PersistedType: _QueryNumeric, T.Key == String {\n        assertQuery(Root.self, \"(\\(name)[%@] > %@)\", values: [\"foo\", value], count: 0) {\n            lhs($0)[\"foo\"] > value\n        }\n        assertQuery(Root.self, \"(\\(name)[%@] >= %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"] >= value\n        }\n        assertQuery(Root.self, \"(\\(name)[%@] < %@)\", values: [\"foo\", value], count: 0) {\n            lhs($0)[\"foo\"] < value\n        }\n        assertQuery(Root.self, \"(\\(name)[%@] <= %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"] <= value\n        }\n    }\n\n    private func validateMapSubscriptStringComparisons<Root: Object, T: RealmKeyedCollection>(_ name: String, _ lhs: (Query<Root>) -> Query<T>, value: T.Value)\n            where T.Value.PersistedType: _QueryString, T.Key == String {\n        assertQuery(Root.self, \"(\\(name)[%@] CONTAINS[cd] %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"].contains(value, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(Root.self, \"(\\(name)[%@] CONTAINS %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"].contains(value)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name)[%@] CONTAINS %@)\", values: [\"foo\", value], count: 0) {\n            !lhs($0)[\"foo\"].contains(value)\n        }\n\n        assertQuery(Root.self, \"(\\(name)[%@] BEGINSWITH[cd] %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"].starts(with: value, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(Root.self, \"(\\(name)[%@] BEGINSWITH %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"].starts(with: value)\n        }\n\n        assertQuery(Root.self, \"(\\(name)[%@] ENDSWITH[cd] %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"].ends(with: value, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(Root.self, \"(\\(name)[%@] ENDSWITH %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"].ends(with: value)\n        }\n\n        assertQuery(Root.self, \"(\\(name)[%@] LIKE[c] %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"].like(value, caseInsensitive: true)\n        }\n\n        assertQuery(Root.self, \"(\\(name)[%@] LIKE %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"].like(value)\n        }\n    }\n\n    func testMapAllKeysAllValuesSubscript() {\n        validateMapSubscriptEquality(\"mapBool\", \\Query<ModernAllTypesObject>.mapBool, value: true)\n\n        validateMapSubscriptEquality(\"mapInt\", \\Query<ModernAllTypesObject>.mapInt, value: 1)\n        validateMapSubscriptNumericComparisons(\"mapInt\", \\Query<ModernAllTypesObject>.mapInt, value: 1)\n\n        validateMapSubscriptEquality(\"mapInt8\", \\Query<ModernAllTypesObject>.mapInt8, value: Int8(8))\n        validateMapSubscriptNumericComparisons(\"mapInt8\", \\Query<ModernAllTypesObject>.mapInt8, value: Int8(8))\n\n        validateMapSubscriptEquality(\"mapInt16\", \\Query<ModernAllTypesObject>.mapInt16, value: Int16(16))\n        validateMapSubscriptNumericComparisons(\"mapInt16\", \\Query<ModernAllTypesObject>.mapInt16, value: Int16(16))\n\n        validateMapSubscriptEquality(\"mapInt32\", \\Query<ModernAllTypesObject>.mapInt32, value: Int32(32))\n        validateMapSubscriptNumericComparisons(\"mapInt32\", \\Query<ModernAllTypesObject>.mapInt32, value: Int32(32))\n\n        validateMapSubscriptEquality(\"mapInt64\", \\Query<ModernAllTypesObject>.mapInt64, value: Int64(64))\n        validateMapSubscriptNumericComparisons(\"mapInt64\", \\Query<ModernAllTypesObject>.mapInt64, value: Int64(64))\n\n        validateMapSubscriptEquality(\"mapFloat\", \\Query<ModernAllTypesObject>.mapFloat, value: Float(5.55444333))\n        validateMapSubscriptNumericComparisons(\"mapFloat\", \\Query<ModernAllTypesObject>.mapFloat, value: Float(5.55444333))\n\n        validateMapSubscriptEquality(\"mapDouble\", \\Query<ModernAllTypesObject>.mapDouble, value: 123.456)\n        validateMapSubscriptNumericComparisons(\"mapDouble\", \\Query<ModernAllTypesObject>.mapDouble, value: 123.456)\n\n        validateMapSubscriptEquality(\"mapString\", \\Query<ModernAllTypesObject>.mapString, value: \"Foo\")\n        validateMapSubscriptStringComparisons(\"mapString\", \\Query<ModernAllTypesObject>.mapString, value: \"Foo\")\n\n        validateMapSubscriptEquality(\"mapBinary\", \\Query<ModernAllTypesObject>.mapBinary, value: Data(count: 64))\n\n        validateMapSubscriptEquality(\"mapDate\", \\Query<ModernAllTypesObject>.mapDate, value: Date(timeIntervalSince1970: 1000000))\n        validateMapSubscriptNumericComparisons(\"mapDate\", \\Query<ModernAllTypesObject>.mapDate, value: Date(timeIntervalSince1970: 1000000))\n\n        validateMapSubscriptEquality(\"mapDecimal\", \\Query<ModernAllTypesObject>.mapDecimal, value: Decimal128(123.456))\n        validateMapSubscriptNumericComparisons(\"mapDecimal\", \\Query<ModernAllTypesObject>.mapDecimal, value: Decimal128(123.456))\n\n        validateMapSubscriptEquality(\"mapObjectId\", \\Query<ModernAllTypesObject>.mapObjectId, value: ObjectId(\"61184062c1d8f096a3695046\"))\n\n        validateMapSubscriptEquality(\"mapUuid\", \\Query<ModernAllTypesObject>.mapUuid, value: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!)\n\n        validateMapSubscriptEquality(\"mapAny\", \\Query<ModernAllTypesObject>.mapAny, value: AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\")))\n\n        validateMapSubscriptEquality(\"mapInt\", \\Query<ModernCollectionsOfEnums>.mapInt, value: .value1)\n        validateMapSubscriptNumericComparisons(\"mapInt\", \\Query<ModernCollectionsOfEnums>.mapInt, value: .value1)\n\n        validateMapSubscriptEquality(\"mapInt8\", \\Query<ModernCollectionsOfEnums>.mapInt8, value: .value1)\n        validateMapSubscriptNumericComparisons(\"mapInt8\", \\Query<ModernCollectionsOfEnums>.mapInt8, value: .value1)\n\n        validateMapSubscriptEquality(\"mapInt16\", \\Query<ModernCollectionsOfEnums>.mapInt16, value: .value1)\n        validateMapSubscriptNumericComparisons(\"mapInt16\", \\Query<ModernCollectionsOfEnums>.mapInt16, value: .value1)\n\n        validateMapSubscriptEquality(\"mapInt32\", \\Query<ModernCollectionsOfEnums>.mapInt32, value: .value1)\n        validateMapSubscriptNumericComparisons(\"mapInt32\", \\Query<ModernCollectionsOfEnums>.mapInt32, value: .value1)\n\n        validateMapSubscriptEquality(\"mapInt64\", \\Query<ModernCollectionsOfEnums>.mapInt64, value: .value1)\n        validateMapSubscriptNumericComparisons(\"mapInt64\", \\Query<ModernCollectionsOfEnums>.mapInt64, value: .value1)\n\n        validateMapSubscriptEquality(\"mapFloat\", \\Query<ModernCollectionsOfEnums>.mapFloat, value: .value1)\n        validateMapSubscriptNumericComparisons(\"mapFloat\", \\Query<ModernCollectionsOfEnums>.mapFloat, value: .value1)\n\n        validateMapSubscriptEquality(\"mapDouble\", \\Query<ModernCollectionsOfEnums>.mapDouble, value: .value1)\n        validateMapSubscriptNumericComparisons(\"mapDouble\", \\Query<ModernCollectionsOfEnums>.mapDouble, value: .value1)\n\n        validateMapSubscriptEquality(\"mapString\", \\Query<ModernCollectionsOfEnums>.mapString, value: .value1)\n        validateMapSubscriptStringComparisons(\"mapString\", \\Query<ModernCollectionsOfEnums>.mapString, value: .value1)\n\n        validateMapSubscriptEquality(\"mapBool\", \\Query<CustomPersistableCollections>.mapBool, value: BoolWrapper(persistedValue: true))\n\n        validateMapSubscriptEquality(\"mapInt\", \\Query<CustomPersistableCollections>.mapInt, value: IntWrapper(persistedValue: 1))\n        validateMapSubscriptNumericComparisons(\"mapInt\", \\Query<CustomPersistableCollections>.mapInt, value: IntWrapper(persistedValue: 1))\n\n        validateMapSubscriptEquality(\"mapInt8\", \\Query<CustomPersistableCollections>.mapInt8, value: Int8Wrapper(persistedValue: Int8(8)))\n        validateMapSubscriptNumericComparisons(\"mapInt8\", \\Query<CustomPersistableCollections>.mapInt8, value: Int8Wrapper(persistedValue: Int8(8)))\n\n        validateMapSubscriptEquality(\"mapInt16\", \\Query<CustomPersistableCollections>.mapInt16, value: Int16Wrapper(persistedValue: Int16(16)))\n        validateMapSubscriptNumericComparisons(\"mapInt16\", \\Query<CustomPersistableCollections>.mapInt16, value: Int16Wrapper(persistedValue: Int16(16)))\n\n        validateMapSubscriptEquality(\"mapInt32\", \\Query<CustomPersistableCollections>.mapInt32, value: Int32Wrapper(persistedValue: Int32(32)))\n        validateMapSubscriptNumericComparisons(\"mapInt32\", \\Query<CustomPersistableCollections>.mapInt32, value: Int32Wrapper(persistedValue: Int32(32)))\n\n        validateMapSubscriptEquality(\"mapInt64\", \\Query<CustomPersistableCollections>.mapInt64, value: Int64Wrapper(persistedValue: Int64(64)))\n        validateMapSubscriptNumericComparisons(\"mapInt64\", \\Query<CustomPersistableCollections>.mapInt64, value: Int64Wrapper(persistedValue: Int64(64)))\n\n        validateMapSubscriptEquality(\"mapFloat\", \\Query<CustomPersistableCollections>.mapFloat, value: FloatWrapper(persistedValue: Float(5.55444333)))\n        validateMapSubscriptNumericComparisons(\"mapFloat\", \\Query<CustomPersistableCollections>.mapFloat, value: FloatWrapper(persistedValue: Float(5.55444333)))\n\n        validateMapSubscriptEquality(\"mapDouble\", \\Query<CustomPersistableCollections>.mapDouble, value: DoubleWrapper(persistedValue: 123.456))\n        validateMapSubscriptNumericComparisons(\"mapDouble\", \\Query<CustomPersistableCollections>.mapDouble, value: DoubleWrapper(persistedValue: 123.456))\n\n        validateMapSubscriptEquality(\"mapString\", \\Query<CustomPersistableCollections>.mapString, value: StringWrapper(persistedValue: \"Foo\"))\n        validateMapSubscriptStringComparisons(\"mapString\", \\Query<CustomPersistableCollections>.mapString, value: StringWrapper(persistedValue: \"Foo\"))\n\n        validateMapSubscriptEquality(\"mapBinary\", \\Query<CustomPersistableCollections>.mapBinary, value: DataWrapper(persistedValue: Data(count: 64)))\n\n        validateMapSubscriptEquality(\"mapDate\", \\Query<CustomPersistableCollections>.mapDate, value: DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)))\n        validateMapSubscriptNumericComparisons(\"mapDate\", \\Query<CustomPersistableCollections>.mapDate, value: DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)))\n\n        validateMapSubscriptEquality(\"mapDecimal\", \\Query<CustomPersistableCollections>.mapDecimal, value: Decimal128Wrapper(persistedValue: Decimal128(123.456)))\n        validateMapSubscriptNumericComparisons(\"mapDecimal\", \\Query<CustomPersistableCollections>.mapDecimal, value: Decimal128Wrapper(persistedValue: Decimal128(123.456)))\n\n        validateMapSubscriptEquality(\"mapObjectId\", \\Query<CustomPersistableCollections>.mapObjectId, value: ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")))\n\n        validateMapSubscriptEquality(\"mapUuid\", \\Query<CustomPersistableCollections>.mapUuid, value: UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!))\n\n        validateMapSubscriptEquality(\"mapOptBool\", \\Query<ModernAllTypesObject>.mapOptBool, value: true)\n\n        validateMapSubscriptEquality(\"mapOptInt\", \\Query<ModernAllTypesObject>.mapOptInt, value: 1)\n        validateMapSubscriptNumericComparisons(\"mapOptInt\", \\Query<ModernAllTypesObject>.mapOptInt, value: 1)\n\n        validateMapSubscriptEquality(\"mapOptInt8\", \\Query<ModernAllTypesObject>.mapOptInt8, value: Int8(8))\n        validateMapSubscriptNumericComparisons(\"mapOptInt8\", \\Query<ModernAllTypesObject>.mapOptInt8, value: Int8(8))\n\n        validateMapSubscriptEquality(\"mapOptInt16\", \\Query<ModernAllTypesObject>.mapOptInt16, value: Int16(16))\n        validateMapSubscriptNumericComparisons(\"mapOptInt16\", \\Query<ModernAllTypesObject>.mapOptInt16, value: Int16(16))\n\n        validateMapSubscriptEquality(\"mapOptInt32\", \\Query<ModernAllTypesObject>.mapOptInt32, value: Int32(32))\n        validateMapSubscriptNumericComparisons(\"mapOptInt32\", \\Query<ModernAllTypesObject>.mapOptInt32, value: Int32(32))\n\n        validateMapSubscriptEquality(\"mapOptInt64\", \\Query<ModernAllTypesObject>.mapOptInt64, value: Int64(64))\n        validateMapSubscriptNumericComparisons(\"mapOptInt64\", \\Query<ModernAllTypesObject>.mapOptInt64, value: Int64(64))\n\n        validateMapSubscriptEquality(\"mapOptFloat\", \\Query<ModernAllTypesObject>.mapOptFloat, value: Float(5.55444333))\n        validateMapSubscriptNumericComparisons(\"mapOptFloat\", \\Query<ModernAllTypesObject>.mapOptFloat, value: Float(5.55444333))\n\n        validateMapSubscriptEquality(\"mapOptDouble\", \\Query<ModernAllTypesObject>.mapOptDouble, value: 123.456)\n        validateMapSubscriptNumericComparisons(\"mapOptDouble\", \\Query<ModernAllTypesObject>.mapOptDouble, value: 123.456)\n\n        validateMapSubscriptEquality(\"mapOptString\", \\Query<ModernAllTypesObject>.mapOptString, value: \"Foo\")\n        validateMapSubscriptStringComparisons(\"mapOptString\", \\Query<ModernAllTypesObject>.mapOptString, value: \"Foo\")\n\n        validateMapSubscriptEquality(\"mapOptBinary\", \\Query<ModernAllTypesObject>.mapOptBinary, value: Data(count: 64))\n\n        validateMapSubscriptEquality(\"mapOptDate\", \\Query<ModernAllTypesObject>.mapOptDate, value: Date(timeIntervalSince1970: 1000000))\n        validateMapSubscriptNumericComparisons(\"mapOptDate\", \\Query<ModernAllTypesObject>.mapOptDate, value: Date(timeIntervalSince1970: 1000000))\n\n        validateMapSubscriptEquality(\"mapOptDecimal\", \\Query<ModernAllTypesObject>.mapOptDecimal, value: Decimal128(123.456))\n        validateMapSubscriptNumericComparisons(\"mapOptDecimal\", \\Query<ModernAllTypesObject>.mapOptDecimal, value: Decimal128(123.456))\n\n        validateMapSubscriptEquality(\"mapOptObjectId\", \\Query<ModernAllTypesObject>.mapOptObjectId, value: ObjectId(\"61184062c1d8f096a3695046\"))\n\n        validateMapSubscriptEquality(\"mapOptUuid\", \\Query<ModernAllTypesObject>.mapOptUuid, value: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!)\n\n        validateMapSubscriptEquality(\"mapIntOpt\", \\Query<ModernCollectionsOfEnums>.mapIntOpt, value: .value1)\n        validateMapSubscriptNumericComparisons(\"mapIntOpt\", \\Query<ModernCollectionsOfEnums>.mapIntOpt, value: .value1)\n\n        validateMapSubscriptEquality(\"mapInt8Opt\", \\Query<ModernCollectionsOfEnums>.mapInt8Opt, value: .value1)\n        validateMapSubscriptNumericComparisons(\"mapInt8Opt\", \\Query<ModernCollectionsOfEnums>.mapInt8Opt, value: .value1)\n\n        validateMapSubscriptEquality(\"mapInt16Opt\", \\Query<ModernCollectionsOfEnums>.mapInt16Opt, value: .value1)\n        validateMapSubscriptNumericComparisons(\"mapInt16Opt\", \\Query<ModernCollectionsOfEnums>.mapInt16Opt, value: .value1)\n\n        validateMapSubscriptEquality(\"mapInt32Opt\", \\Query<ModernCollectionsOfEnums>.mapInt32Opt, value: .value1)\n        validateMapSubscriptNumericComparisons(\"mapInt32Opt\", \\Query<ModernCollectionsOfEnums>.mapInt32Opt, value: .value1)\n\n        validateMapSubscriptEquality(\"mapInt64Opt\", \\Query<ModernCollectionsOfEnums>.mapInt64Opt, value: .value1)\n        validateMapSubscriptNumericComparisons(\"mapInt64Opt\", \\Query<ModernCollectionsOfEnums>.mapInt64Opt, value: .value1)\n\n        validateMapSubscriptEquality(\"mapFloatOpt\", \\Query<ModernCollectionsOfEnums>.mapFloatOpt, value: .value1)\n        validateMapSubscriptNumericComparisons(\"mapFloatOpt\", \\Query<ModernCollectionsOfEnums>.mapFloatOpt, value: .value1)\n\n        validateMapSubscriptEquality(\"mapDoubleOpt\", \\Query<ModernCollectionsOfEnums>.mapDoubleOpt, value: .value1)\n        validateMapSubscriptNumericComparisons(\"mapDoubleOpt\", \\Query<ModernCollectionsOfEnums>.mapDoubleOpt, value: .value1)\n\n        validateMapSubscriptEquality(\"mapStringOpt\", \\Query<ModernCollectionsOfEnums>.mapStringOpt, value: .value1)\n        validateMapSubscriptStringComparisons(\"mapStringOpt\", \\Query<ModernCollectionsOfEnums>.mapStringOpt, value: .value1)\n\n        validateMapSubscriptEquality(\"mapOptBool\", \\Query<CustomPersistableCollections>.mapOptBool, value: BoolWrapper(persistedValue: true))\n\n        validateMapSubscriptEquality(\"mapOptInt\", \\Query<CustomPersistableCollections>.mapOptInt, value: IntWrapper(persistedValue: 1))\n        validateMapSubscriptNumericComparisons(\"mapOptInt\", \\Query<CustomPersistableCollections>.mapOptInt, value: IntWrapper(persistedValue: 1))\n\n        validateMapSubscriptEquality(\"mapOptInt8\", \\Query<CustomPersistableCollections>.mapOptInt8, value: Int8Wrapper(persistedValue: Int8(8)))\n        validateMapSubscriptNumericComparisons(\"mapOptInt8\", \\Query<CustomPersistableCollections>.mapOptInt8, value: Int8Wrapper(persistedValue: Int8(8)))\n\n        validateMapSubscriptEquality(\"mapOptInt16\", \\Query<CustomPersistableCollections>.mapOptInt16, value: Int16Wrapper(persistedValue: Int16(16)))\n        validateMapSubscriptNumericComparisons(\"mapOptInt16\", \\Query<CustomPersistableCollections>.mapOptInt16, value: Int16Wrapper(persistedValue: Int16(16)))\n\n        validateMapSubscriptEquality(\"mapOptInt32\", \\Query<CustomPersistableCollections>.mapOptInt32, value: Int32Wrapper(persistedValue: Int32(32)))\n        validateMapSubscriptNumericComparisons(\"mapOptInt32\", \\Query<CustomPersistableCollections>.mapOptInt32, value: Int32Wrapper(persistedValue: Int32(32)))\n\n        validateMapSubscriptEquality(\"mapOptInt64\", \\Query<CustomPersistableCollections>.mapOptInt64, value: Int64Wrapper(persistedValue: Int64(64)))\n        validateMapSubscriptNumericComparisons(\"mapOptInt64\", \\Query<CustomPersistableCollections>.mapOptInt64, value: Int64Wrapper(persistedValue: Int64(64)))\n\n        validateMapSubscriptEquality(\"mapOptFloat\", \\Query<CustomPersistableCollections>.mapOptFloat, value: FloatWrapper(persistedValue: Float(5.55444333)))\n        validateMapSubscriptNumericComparisons(\"mapOptFloat\", \\Query<CustomPersistableCollections>.mapOptFloat, value: FloatWrapper(persistedValue: Float(5.55444333)))\n\n        validateMapSubscriptEquality(\"mapOptDouble\", \\Query<CustomPersistableCollections>.mapOptDouble, value: DoubleWrapper(persistedValue: 123.456))\n        validateMapSubscriptNumericComparisons(\"mapOptDouble\", \\Query<CustomPersistableCollections>.mapOptDouble, value: DoubleWrapper(persistedValue: 123.456))\n\n        validateMapSubscriptEquality(\"mapOptString\", \\Query<CustomPersistableCollections>.mapOptString, value: StringWrapper(persistedValue: \"Foo\"))\n        validateMapSubscriptStringComparisons(\"mapOptString\", \\Query<CustomPersistableCollections>.mapOptString, value: StringWrapper(persistedValue: \"Foo\"))\n\n        validateMapSubscriptEquality(\"mapOptBinary\", \\Query<CustomPersistableCollections>.mapOptBinary, value: DataWrapper(persistedValue: Data(count: 64)))\n\n        validateMapSubscriptEquality(\"mapOptDate\", \\Query<CustomPersistableCollections>.mapOptDate, value: DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)))\n        validateMapSubscriptNumericComparisons(\"mapOptDate\", \\Query<CustomPersistableCollections>.mapOptDate, value: DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)))\n\n        validateMapSubscriptEquality(\"mapOptDecimal\", \\Query<CustomPersistableCollections>.mapOptDecimal, value: Decimal128Wrapper(persistedValue: Decimal128(123.456)))\n        validateMapSubscriptNumericComparisons(\"mapOptDecimal\", \\Query<CustomPersistableCollections>.mapOptDecimal, value: Decimal128Wrapper(persistedValue: Decimal128(123.456)))\n\n        validateMapSubscriptEquality(\"mapOptObjectId\", \\Query<CustomPersistableCollections>.mapOptObjectId, value: ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")))\n\n        validateMapSubscriptEquality(\"mapOptUuid\", \\Query<CustomPersistableCollections>.mapOptUuid, value: UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!))\n\n    }\n\n    func testMapSubscriptObject() {\n        assertThrows(assertQuery(ModernCollectionObject.self, \"\", count: 0) {\n            $0.map[\"foo\"].objectCol.intCol == 5\n        }, reason: \"Cannot apply key path to Map subscripts.\")\n    }\n\n    func testMapContainsAnyInObject() {\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapBool IN %@)\",\n                    values: [NSArray(array: [true, true])], count: 1) {\n            $0.mapBool.containsAny(in: [true, true])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapInt IN %@)\",\n                    values: [NSArray(array: [1, 3])], count: 1) {\n            $0.mapInt.containsAny(in: [1, 3])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapInt8 IN %@)\",\n                    values: [NSArray(array: [Int8(8), Int8(9)])], count: 1) {\n            $0.mapInt8.containsAny(in: [Int8(8), Int8(9)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapInt16 IN %@)\",\n                    values: [NSArray(array: [Int16(16), Int16(17)])], count: 1) {\n            $0.mapInt16.containsAny(in: [Int16(16), Int16(17)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapInt32 IN %@)\",\n                    values: [NSArray(array: [Int32(32), Int32(33)])], count: 1) {\n            $0.mapInt32.containsAny(in: [Int32(32), Int32(33)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapInt64 IN %@)\",\n                    values: [NSArray(array: [Int64(64), Int64(65)])], count: 1) {\n            $0.mapInt64.containsAny(in: [Int64(64), Int64(65)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapFloat IN %@)\",\n                    values: [NSArray(array: [Float(5.55444333), Float(6.55444333)])], count: 1) {\n            $0.mapFloat.containsAny(in: [Float(5.55444333), Float(6.55444333)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapDouble IN %@)\",\n                    values: [NSArray(array: [123.456, 234.567])], count: 1) {\n            $0.mapDouble.containsAny(in: [123.456, 234.567])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapString IN %@)\",\n                    values: [NSArray(array: [\"Foo\", \"Foó\"])], count: 1) {\n            $0.mapString.containsAny(in: [\"Foo\", \"Foó\"])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapBinary IN %@)\",\n                    values: [NSArray(array: [Data(count: 64), Data(count: 128)])], count: 1) {\n            $0.mapBinary.containsAny(in: [Data(count: 64), Data(count: 128)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapDate IN %@)\",\n                    values: [NSArray(array: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])], count: 1) {\n            $0.mapDate.containsAny(in: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapDecimal IN %@)\",\n                    values: [NSArray(array: [Decimal128(123.456), Decimal128(234.567)])], count: 1) {\n            $0.mapDecimal.containsAny(in: [Decimal128(123.456), Decimal128(234.567)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapObjectId IN %@)\",\n                    values: [NSArray(array: [ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])], count: 1) {\n            $0.mapObjectId.containsAny(in: [ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapUuid IN %@)\",\n                    values: [NSArray(array: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])], count: 1) {\n            $0.mapUuid.containsAny(in: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapAny IN %@)\",\n                    values: [NSArray(array: [AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\")), AnyRealmValue.string(\"Hello\")])], count: 1) {\n            $0.mapAny.containsAny(in: [AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\")), AnyRealmValue.string(\"Hello\")])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapInt IN %@)\",\n                    values: [NSArray(array: [EnumInt.value1, EnumInt.value2])], count: 1) {\n            $0.mapInt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapInt8 IN %@)\",\n                    values: [NSArray(array: [EnumInt8.value1, EnumInt8.value2])], count: 1) {\n            $0.mapInt8.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapInt16 IN %@)\",\n                    values: [NSArray(array: [EnumInt16.value1, EnumInt16.value2])], count: 1) {\n            $0.mapInt16.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapInt32 IN %@)\",\n                    values: [NSArray(array: [EnumInt32.value1, EnumInt32.value2])], count: 1) {\n            $0.mapInt32.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapInt64 IN %@)\",\n                    values: [NSArray(array: [EnumInt64.value1, EnumInt64.value2])], count: 1) {\n            $0.mapInt64.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapFloat IN %@)\",\n                    values: [NSArray(array: [EnumFloat.value1, EnumFloat.value2])], count: 1) {\n            $0.mapFloat.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapDouble IN %@)\",\n                    values: [NSArray(array: [EnumDouble.value1, EnumDouble.value2])], count: 1) {\n            $0.mapDouble.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapString IN %@)\",\n                    values: [NSArray(array: [EnumString.value1, EnumString.value2])], count: 1) {\n            $0.mapString.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapBool IN %@)\",\n                    values: [NSArray(array: [BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: true)])], count: 1) {\n            $0.mapBool.containsAny(in: [BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: true)])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapInt IN %@)\",\n                    values: [NSArray(array: [IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])], count: 1) {\n            $0.mapInt.containsAny(in: [IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapInt8 IN %@)\",\n                    values: [NSArray(array: [Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])], count: 1) {\n            $0.mapInt8.containsAny(in: [Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapInt16 IN %@)\",\n                    values: [NSArray(array: [Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])], count: 1) {\n            $0.mapInt16.containsAny(in: [Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapInt32 IN %@)\",\n                    values: [NSArray(array: [Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])], count: 1) {\n            $0.mapInt32.containsAny(in: [Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapInt64 IN %@)\",\n                    values: [NSArray(array: [Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])], count: 1) {\n            $0.mapInt64.containsAny(in: [Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapFloat IN %@)\",\n                    values: [NSArray(array: [FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])], count: 1) {\n            $0.mapFloat.containsAny(in: [FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapDouble IN %@)\",\n                    values: [NSArray(array: [DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])], count: 1) {\n            $0.mapDouble.containsAny(in: [DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapString IN %@)\",\n                    values: [NSArray(array: [StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])], count: 1) {\n            $0.mapString.containsAny(in: [StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapBinary IN %@)\",\n                    values: [NSArray(array: [DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])], count: 1) {\n            $0.mapBinary.containsAny(in: [DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapDate IN %@)\",\n                    values: [NSArray(array: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])], count: 1) {\n            $0.mapDate.containsAny(in: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapDecimal IN %@)\",\n                    values: [NSArray(array: [Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])], count: 1) {\n            $0.mapDecimal.containsAny(in: [Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapObjectId IN %@)\",\n                    values: [NSArray(array: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])], count: 1) {\n            $0.mapObjectId.containsAny(in: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapUuid IN %@)\",\n                    values: [NSArray(array: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])], count: 1) {\n            $0.mapUuid.containsAny(in: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapOptBool IN %@)\",\n                    values: [NSArray(array: [true, true])], count: 1) {\n            $0.mapOptBool.containsAny(in: [true, true])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapOptInt IN %@)\",\n                    values: [NSArray(array: [1, 3])], count: 1) {\n            $0.mapOptInt.containsAny(in: [1, 3])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapOptInt8 IN %@)\",\n                    values: [NSArray(array: [Int8(8), Int8(9)])], count: 1) {\n            $0.mapOptInt8.containsAny(in: [Int8(8), Int8(9)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapOptInt16 IN %@)\",\n                    values: [NSArray(array: [Int16(16), Int16(17)])], count: 1) {\n            $0.mapOptInt16.containsAny(in: [Int16(16), Int16(17)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapOptInt32 IN %@)\",\n                    values: [NSArray(array: [Int32(32), Int32(33)])], count: 1) {\n            $0.mapOptInt32.containsAny(in: [Int32(32), Int32(33)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapOptInt64 IN %@)\",\n                    values: [NSArray(array: [Int64(64), Int64(65)])], count: 1) {\n            $0.mapOptInt64.containsAny(in: [Int64(64), Int64(65)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapOptFloat IN %@)\",\n                    values: [NSArray(array: [Float(5.55444333), Float(6.55444333)])], count: 1) {\n            $0.mapOptFloat.containsAny(in: [Float(5.55444333), Float(6.55444333)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapOptDouble IN %@)\",\n                    values: [NSArray(array: [123.456, 234.567])], count: 1) {\n            $0.mapOptDouble.containsAny(in: [123.456, 234.567])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapOptString IN %@)\",\n                    values: [NSArray(array: [\"Foo\", \"Foó\"])], count: 1) {\n            $0.mapOptString.containsAny(in: [\"Foo\", \"Foó\"])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapOptBinary IN %@)\",\n                    values: [NSArray(array: [Data(count: 64), Data(count: 128)])], count: 1) {\n            $0.mapOptBinary.containsAny(in: [Data(count: 64), Data(count: 128)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapOptDate IN %@)\",\n                    values: [NSArray(array: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])], count: 1) {\n            $0.mapOptDate.containsAny(in: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapOptDecimal IN %@)\",\n                    values: [NSArray(array: [Decimal128(123.456), Decimal128(234.567)])], count: 1) {\n            $0.mapOptDecimal.containsAny(in: [Decimal128(123.456), Decimal128(234.567)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapOptObjectId IN %@)\",\n                    values: [NSArray(array: [ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])], count: 1) {\n            $0.mapOptObjectId.containsAny(in: [ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY mapOptUuid IN %@)\",\n                    values: [NSArray(array: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])], count: 1) {\n            $0.mapOptUuid.containsAny(in: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapIntOpt IN %@)\",\n                    values: [NSArray(array: [EnumInt.value1, EnumInt.value2])], count: 1) {\n            $0.mapIntOpt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapInt8Opt IN %@)\",\n                    values: [NSArray(array: [EnumInt8.value1, EnumInt8.value2])], count: 1) {\n            $0.mapInt8Opt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapInt16Opt IN %@)\",\n                    values: [NSArray(array: [EnumInt16.value1, EnumInt16.value2])], count: 1) {\n            $0.mapInt16Opt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapInt32Opt IN %@)\",\n                    values: [NSArray(array: [EnumInt32.value1, EnumInt32.value2])], count: 1) {\n            $0.mapInt32Opt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapInt64Opt IN %@)\",\n                    values: [NSArray(array: [EnumInt64.value1, EnumInt64.value2])], count: 1) {\n            $0.mapInt64Opt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapFloatOpt IN %@)\",\n                    values: [NSArray(array: [EnumFloat.value1, EnumFloat.value2])], count: 1) {\n            $0.mapFloatOpt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapDoubleOpt IN %@)\",\n                    values: [NSArray(array: [EnumDouble.value1, EnumDouble.value2])], count: 1) {\n            $0.mapDoubleOpt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY mapStringOpt IN %@)\",\n                    values: [NSArray(array: [EnumString.value1, EnumString.value2])], count: 1) {\n            $0.mapStringOpt.containsAny(in: [.value1, .value2])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapOptBool IN %@)\",\n                    values: [NSArray(array: [BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: true)])], count: 1) {\n            $0.mapOptBool.containsAny(in: [BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: true)])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapOptInt IN %@)\",\n                    values: [NSArray(array: [IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])], count: 1) {\n            $0.mapOptInt.containsAny(in: [IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapOptInt8 IN %@)\",\n                    values: [NSArray(array: [Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])], count: 1) {\n            $0.mapOptInt8.containsAny(in: [Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapOptInt16 IN %@)\",\n                    values: [NSArray(array: [Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])], count: 1) {\n            $0.mapOptInt16.containsAny(in: [Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapOptInt32 IN %@)\",\n                    values: [NSArray(array: [Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])], count: 1) {\n            $0.mapOptInt32.containsAny(in: [Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapOptInt64 IN %@)\",\n                    values: [NSArray(array: [Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])], count: 1) {\n            $0.mapOptInt64.containsAny(in: [Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapOptFloat IN %@)\",\n                    values: [NSArray(array: [FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])], count: 1) {\n            $0.mapOptFloat.containsAny(in: [FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapOptDouble IN %@)\",\n                    values: [NSArray(array: [DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])], count: 1) {\n            $0.mapOptDouble.containsAny(in: [DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapOptString IN %@)\",\n                    values: [NSArray(array: [StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])], count: 1) {\n            $0.mapOptString.containsAny(in: [StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapOptBinary IN %@)\",\n                    values: [NSArray(array: [DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])], count: 1) {\n            $0.mapOptBinary.containsAny(in: [DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapOptDate IN %@)\",\n                    values: [NSArray(array: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])], count: 1) {\n            $0.mapOptDate.containsAny(in: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapOptDecimal IN %@)\",\n                    values: [NSArray(array: [Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])], count: 1) {\n            $0.mapOptDecimal.containsAny(in: [Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapOptObjectId IN %@)\",\n                    values: [NSArray(array: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])], count: 1) {\n            $0.mapOptObjectId.containsAny(in: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY mapOptUuid IN %@)\",\n                    values: [NSArray(array: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])], count: 1) {\n            $0.mapOptUuid.containsAny(in: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])\n        }\n\n        let colObj = ModernCollectionObject()\n        let obj = objects().first!\n        colObj.map[\"foo\"] = obj\n        try! realm.write {\n            realm.add(colObj)\n        }\n\n        assertQuery(ModernCollectionObject.self, \"(ANY map IN %@)\", values: [NSArray(array: [obj])], count: 1) {\n            $0.map.containsAny(in: [obj])\n        }\n    }\n\n    // MARK: - Linking Objects\n\n    func testLinkingObjects() {\n        let objects = Array(self.objects())\n        assertQuery(\"(%@ IN linkingObjects)\", objects.first!, count: 0) {\n            $0.linkingObjects.contains(objects.first!)\n        }\n\n        assertQuery(\"(ANY linkingObjects IN %@)\", objects, count: 0) {\n            $0.linkingObjects.containsAny(in: objects)\n        }\n\n        assertQuery(\"(NOT %@ IN linkingObjects)\", objects.first!, count: 1) {\n            !$0.linkingObjects.contains(objects.first!)\n        }\n\n        assertQuery(\"(NOT ANY linkingObjects IN %@)\", objects, count: 1) {\n            !$0.linkingObjects.containsAny(in: objects)\n        }\n    }\n\n    // MARK: - Compound\n\n    func testCompoundAnd() {\n        assertQuery(\"((boolCol == %@) && (optBoolCol == %@))\", values: [false, false], count: 1) {\n            $0.boolCol == false && $0.optBoolCol == false\n        }\n        assertQuery(\"((boolCol == %@) && (optBoolCol == %@))\", values: [false, false], count: 1) {\n            ($0.boolCol == false) && ($0.optBoolCol == false)\n        }\n\n        // List\n\n        assertQuery(\"((boolCol == %@) && (%@ IN arrayBool))\", values: [false, true], count: 1) {\n            $0.boolCol == false && $0.arrayBool.contains(true)\n        }\n        assertQuery(\"((boolCol != %@) && (%@ IN arrayBool))\", values: [true, true], count: 1) {\n            $0.boolCol != true && $0.arrayBool.contains(true)\n        }\n        assertQuery(\"((boolCol == %@) && (%@ IN arrayOptBool))\", values: [false, true], count: 1) {\n            $0.boolCol == false && $0.arrayOptBool.contains(true)\n        }\n        assertQuery(\"((boolCol != %@) && (%@ IN arrayOptBool))\", values: [true, true], count: 1) {\n            $0.boolCol != true && $0.arrayOptBool.contains(true)\n        }\n\n        // Set\n\n        assertQuery(\"((boolCol == %@) && (%@ IN setBool))\", values: [false, true], count: 1) {\n            $0.boolCol == false && $0.setBool.contains(true)\n        }\n        assertQuery(\"((boolCol != %@) && (%@ IN setBool))\", values: [true, true], count: 1) {\n            $0.boolCol != true && $0.setBool.contains(true)\n        }\n        assertQuery(\"((boolCol == %@) && (%@ IN setOptBool))\", values: [false, true], count: 1) {\n            $0.boolCol == false && $0.setOptBool.contains(true)\n        }\n        assertQuery(\"((boolCol != %@) && (%@ IN setOptBool))\", values: [true, true], count: 1) {\n            $0.boolCol != true && $0.setOptBool.contains(true)\n        }\n\n        // Map\n\n        assertQuery(\"((boolCol == %@) && (%@ IN mapBool))\", values: [false, true], count: 1) {\n            $0.boolCol == false && $0.mapBool.contains(true)\n        }\n        assertQuery(\"((boolCol != %@) && (mapBool[%@] == %@))\",\n                    values: [true, \"foo\", true], count: 1) {\n            ($0.boolCol != true) && ($0.mapBool[\"foo\"] == true)\n        }\n        assertQuery(\"(((boolCol != %@) && (mapBool[%@] == %@)) && (mapBool[%@] == %@))\",\n                    values: [true, \"foo\", true, \"bar\", true], count: 1) {\n            ($0.boolCol != true) &&\n            ($0.mapBool[\"foo\"] == true) &&\n            ($0.mapBool[\"bar\"] == true)\n        }\n        assertQuery(\"((boolCol == %@) && (%@ IN mapOptBool))\", values: [false, true], count: 1) {\n            $0.boolCol == false && $0.mapOptBool.contains(true)\n        }\n        assertQuery(\"((boolCol != %@) && (mapOptBool[%@] == %@))\",\n                    values: [true, \"foo\", true], count: 1) {\n            ($0.boolCol != true) && ($0.mapOptBool[\"foo\"] == true)\n        }\n        assertQuery(\"(((boolCol != %@) && (mapOptBool[%@] == %@)) && (mapOptBool[%@] == %@))\",\n                    values: [true, \"foo\", true, \"bar\", true], count: 1) {\n            ($0.boolCol != true) &&\n            ($0.mapOptBool[\"foo\"] == true) &&\n            ($0.mapOptBool[\"bar\"] == true)\n        }\n\n        // Aggregates\n\n        let sumarrayInt = 1 + 3\n        assertQuery(\"((((((arrayInt.@min <= %@) && (arrayInt.@max >= %@)) && (arrayInt.@sum == %@)) && (arrayInt.@count != %@)) && (arrayInt.@avg > %@)) && (arrayInt.@avg < %@))\",\n                    values: [1, 3, sumarrayInt, 0, 1, 3], count: 1) {\n            ($0.arrayInt.min <= 1) &&\n            ($0.arrayInt.max >= 3) &&\n            ($0.arrayInt.sum == sumarrayInt) &&\n            ($0.arrayInt.count != 0) &&\n            ($0.arrayInt.avg > 1) &&\n            ($0.arrayInt.avg < 3)\n        }\n        let sumarrayOptInt = 1 + 3\n        assertQuery(\"((((((arrayOptInt.@min <= %@) && (arrayOptInt.@max >= %@)) && (arrayOptInt.@sum == %@)) && (arrayOptInt.@count != %@)) && (arrayOptInt.@avg > %@)) && (arrayOptInt.@avg < %@))\",\n                    values: [1, 3, sumarrayOptInt, 0, 1, 3], count: 1) {\n            ($0.arrayOptInt.min <= 1) &&\n            ($0.arrayOptInt.max >= 3) &&\n            ($0.arrayOptInt.sum == sumarrayOptInt) &&\n            ($0.arrayOptInt.count != 0) &&\n            ($0.arrayOptInt.avg > 1) &&\n            ($0.arrayOptInt.avg < 3)\n        }\n        let summapInt = 1 + 3\n        assertQuery(\"((((((mapInt.@min <= %@) && (mapInt.@max >= %@)) && (mapInt.@sum == %@)) && (mapInt.@count != %@)) && (mapInt.@avg > %@)) && (mapInt.@avg < %@))\",\n                    values: [1, 3, summapInt, 0, 1, 3], count: 1) {\n            ($0.mapInt.min <= 1) &&\n            ($0.mapInt.max >= 3) &&\n            ($0.mapInt.sum == summapInt) &&\n            ($0.mapInt.count != 0) &&\n            ($0.mapInt.avg > 1) &&\n            ($0.mapInt.avg < 3)\n        }\n        let summapOptInt = 1 + 3\n        assertQuery(\"((((((mapOptInt.@min <= %@) && (mapOptInt.@max >= %@)) && (mapOptInt.@sum == %@)) && (mapOptInt.@count != %@)) && (mapOptInt.@avg > %@)) && (mapOptInt.@avg < %@))\",\n                    values: [1, 3, summapOptInt, 0, 1, 3], count: 1) {\n            ($0.mapOptInt.min <= 1) &&\n            ($0.mapOptInt.max >= 3) &&\n            ($0.mapOptInt.sum == summapOptInt) &&\n            ($0.mapOptInt.count != 0) &&\n            ($0.mapOptInt.avg > 1) &&\n            ($0.mapOptInt.avg < 3)\n        }\n\n        // Keypath Collection Aggregates\n\n        createKeypathCollectionAggregatesObject()\n\n        let sumdoubleCol = 123.456 + 234.567 + 345.678\n        assertQuery(LinkToModernAllTypesObject.self, \"((((((list.@min.doubleCol <= %@) && (list.@max.doubleCol >= %@)) && (list.@sum.doubleCol == %@)) && (list.@min.doubleCol != %@)) && (list.@avg.doubleCol > %@)) && (list.@avg.doubleCol < %@))\",\n                    values: [123.456, 345.678, sumdoubleCol, 234.567, 123.456, 345.678], count: 1) {\n            $0.list.doubleCol.min <= 123.456 &&\n            $0.list.doubleCol.max >= 345.678 &&\n            $0.list.doubleCol.sum == sumdoubleCol &&\n            $0.list.doubleCol.min != 234.567 &&\n            $0.list.doubleCol.avg > 123.456 &&\n            $0.list.doubleCol.avg < 345.678\n        }\n\n        let sumoptDoubleCol = 123.456 + 234.567 + 345.678\n        assertQuery(LinkToModernAllTypesObject.self, \"((((((list.@min.optDoubleCol <= %@) && (list.@max.optDoubleCol >= %@)) && (list.@sum.optDoubleCol == %@)) && (list.@min.optDoubleCol != %@)) && (list.@avg.optDoubleCol > %@)) && (list.@avg.optDoubleCol < %@))\",\n                    values: [123.456, 345.678, sumoptDoubleCol, 234.567, 123.456, 345.678], count: 1) {\n            $0.list.optDoubleCol.min <= 123.456 &&\n            $0.list.optDoubleCol.max >= 345.678 &&\n            $0.list.optDoubleCol.sum == sumoptDoubleCol &&\n            $0.list.optDoubleCol.min != 234.567 &&\n            $0.list.optDoubleCol.avg > 123.456 &&\n            $0.list.optDoubleCol.avg < 345.678\n        }\n    }\n\n    func testCompoundOr() {\n        assertQuery(ModernAllTypesObject.self, \"((boolCol == %@) || (intCol == %@))\", values: [false, 3], count: 1) {\n            $0.boolCol == false || $0.intCol == 3\n        }\n        assertQuery(ModernAllTypesObject.self, \"((boolCol == %@) || (intCol == %@))\", values: [false, 3], count: 1) {\n            ($0.boolCol == false) || ($0.intCol == 3)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((intCol == %@) || (int8Col == %@))\", values: [3, Int8(9)], count: 1) {\n            $0.intCol == 3 || $0.int8Col == Int8(9)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((intCol == %@) || (int8Col == %@))\", values: [3, Int8(9)], count: 1) {\n            ($0.intCol == 3) || ($0.int8Col == Int8(9))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((int8Col == %@) || (int16Col == %@))\", values: [Int8(9), Int16(17)], count: 1) {\n            $0.int8Col == Int8(9) || $0.int16Col == Int16(17)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((int8Col == %@) || (int16Col == %@))\", values: [Int8(9), Int16(17)], count: 1) {\n            ($0.int8Col == Int8(9)) || ($0.int16Col == Int16(17))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((int16Col == %@) || (int32Col == %@))\", values: [Int16(17), Int32(33)], count: 1) {\n            $0.int16Col == Int16(17) || $0.int32Col == Int32(33)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((int16Col == %@) || (int32Col == %@))\", values: [Int16(17), Int32(33)], count: 1) {\n            ($0.int16Col == Int16(17)) || ($0.int32Col == Int32(33))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((int32Col == %@) || (int64Col == %@))\", values: [Int32(33), Int64(65)], count: 1) {\n            $0.int32Col == Int32(33) || $0.int64Col == Int64(65)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((int32Col == %@) || (int64Col == %@))\", values: [Int32(33), Int64(65)], count: 1) {\n            ($0.int32Col == Int32(33)) || ($0.int64Col == Int64(65))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((int64Col == %@) || (floatCol == %@))\", values: [Int64(65), Float(6.55444333)], count: 1) {\n            $0.int64Col == Int64(65) || $0.floatCol == Float(6.55444333)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((int64Col == %@) || (floatCol == %@))\", values: [Int64(65), Float(6.55444333)], count: 1) {\n            ($0.int64Col == Int64(65)) || ($0.floatCol == Float(6.55444333))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((floatCol == %@) || (doubleCol == %@))\", values: [Float(6.55444333), 234.567], count: 1) {\n            $0.floatCol == Float(6.55444333) || $0.doubleCol == 234.567\n        }\n        assertQuery(ModernAllTypesObject.self, \"((floatCol == %@) || (doubleCol == %@))\", values: [Float(6.55444333), 234.567], count: 1) {\n            ($0.floatCol == Float(6.55444333)) || ($0.doubleCol == 234.567)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((doubleCol == %@) || (stringCol == %@))\", values: [234.567, \"Foó\"], count: 1) {\n            $0.doubleCol == 234.567 || $0.stringCol == \"Foó\"\n        }\n        assertQuery(ModernAllTypesObject.self, \"((doubleCol == %@) || (stringCol == %@))\", values: [234.567, \"Foó\"], count: 1) {\n            ($0.doubleCol == 234.567) || ($0.stringCol == \"Foó\")\n        }\n        assertQuery(ModernAllTypesObject.self, \"((stringCol == %@) || (binaryCol == %@))\", values: [\"Foó\", Data(count: 128)], count: 1) {\n            $0.stringCol == \"Foó\" || $0.binaryCol == Data(count: 128)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((stringCol == %@) || (binaryCol == %@))\", values: [\"Foó\", Data(count: 128)], count: 1) {\n            ($0.stringCol == \"Foó\") || ($0.binaryCol == Data(count: 128))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((binaryCol == %@) || (dateCol == %@))\", values: [Data(count: 128), Date(timeIntervalSince1970: 2000000)], count: 1) {\n            $0.binaryCol == Data(count: 128) || $0.dateCol == Date(timeIntervalSince1970: 2000000)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((binaryCol == %@) || (dateCol == %@))\", values: [Data(count: 128), Date(timeIntervalSince1970: 2000000)], count: 1) {\n            ($0.binaryCol == Data(count: 128)) || ($0.dateCol == Date(timeIntervalSince1970: 2000000))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((dateCol == %@) || (decimalCol == %@))\", values: [Date(timeIntervalSince1970: 2000000), Decimal128(234.567)], count: 1) {\n            $0.dateCol == Date(timeIntervalSince1970: 2000000) || $0.decimalCol == Decimal128(234.567)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((dateCol == %@) || (decimalCol == %@))\", values: [Date(timeIntervalSince1970: 2000000), Decimal128(234.567)], count: 1) {\n            ($0.dateCol == Date(timeIntervalSince1970: 2000000)) || ($0.decimalCol == Decimal128(234.567))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((decimalCol == %@) || (objectIdCol == %@))\", values: [Decimal128(234.567), ObjectId(\"61184062c1d8f096a3695045\")], count: 1) {\n            $0.decimalCol == Decimal128(234.567) || $0.objectIdCol == ObjectId(\"61184062c1d8f096a3695045\")\n        }\n        assertQuery(ModernAllTypesObject.self, \"((decimalCol == %@) || (objectIdCol == %@))\", values: [Decimal128(234.567), ObjectId(\"61184062c1d8f096a3695045\")], count: 1) {\n            ($0.decimalCol == Decimal128(234.567)) || ($0.objectIdCol == ObjectId(\"61184062c1d8f096a3695045\"))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((objectIdCol == %@) || (uuidCol == %@))\", values: [ObjectId(\"61184062c1d8f096a3695045\"), UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!], count: 1) {\n            $0.objectIdCol == ObjectId(\"61184062c1d8f096a3695045\") || $0.uuidCol == UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!\n        }\n        assertQuery(ModernAllTypesObject.self, \"((objectIdCol == %@) || (uuidCol == %@))\", values: [ObjectId(\"61184062c1d8f096a3695045\"), UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!], count: 1) {\n            ($0.objectIdCol == ObjectId(\"61184062c1d8f096a3695045\")) || ($0.uuidCol == UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((uuidCol == %@) || (intEnumCol == %@))\", values: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!, ModernIntEnum.value2], count: 1) {\n            $0.uuidCol == UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")! || $0.intEnumCol == .value2\n        }\n        assertQuery(ModernAllTypesObject.self, \"((uuidCol == %@) || (intEnumCol == %@))\", values: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!, ModernIntEnum.value2], count: 1) {\n            ($0.uuidCol == UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!) || ($0.intEnumCol == .value2)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((intEnumCol == %@) || (stringEnumCol == %@))\", values: [ModernIntEnum.value2, ModernStringEnum.value2], count: 1) {\n            $0.intEnumCol == .value2 || $0.stringEnumCol == .value2\n        }\n        assertQuery(ModernAllTypesObject.self, \"((intEnumCol == %@) || (stringEnumCol == %@))\", values: [ModernIntEnum.value2, ModernStringEnum.value2], count: 1) {\n            ($0.intEnumCol == .value2) || ($0.stringEnumCol == .value2)\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((bool == %@) || (int == %@))\", values: [BoolWrapper(persistedValue: false), IntWrapper(persistedValue: 3)], count: 1) {\n            $0.bool == BoolWrapper(persistedValue: false) || $0.int == IntWrapper(persistedValue: 3)\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((bool == %@) || (int == %@))\", values: [BoolWrapper(persistedValue: false), IntWrapper(persistedValue: 3)], count: 1) {\n            ($0.bool == BoolWrapper(persistedValue: false)) || ($0.int == IntWrapper(persistedValue: 3))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((int == %@) || (int8 == %@))\", values: [IntWrapper(persistedValue: 3), Int8Wrapper(persistedValue: Int8(9))], count: 1) {\n            $0.int == IntWrapper(persistedValue: 3) || $0.int8 == Int8Wrapper(persistedValue: Int8(9))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((int == %@) || (int8 == %@))\", values: [IntWrapper(persistedValue: 3), Int8Wrapper(persistedValue: Int8(9))], count: 1) {\n            ($0.int == IntWrapper(persistedValue: 3)) || ($0.int8 == Int8Wrapper(persistedValue: Int8(9)))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((int8 == %@) || (int16 == %@))\", values: [Int8Wrapper(persistedValue: Int8(9)), Int16Wrapper(persistedValue: Int16(17))], count: 1) {\n            $0.int8 == Int8Wrapper(persistedValue: Int8(9)) || $0.int16 == Int16Wrapper(persistedValue: Int16(17))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((int8 == %@) || (int16 == %@))\", values: [Int8Wrapper(persistedValue: Int8(9)), Int16Wrapper(persistedValue: Int16(17))], count: 1) {\n            ($0.int8 == Int8Wrapper(persistedValue: Int8(9))) || ($0.int16 == Int16Wrapper(persistedValue: Int16(17)))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((int16 == %@) || (int32 == %@))\", values: [Int16Wrapper(persistedValue: Int16(17)), Int32Wrapper(persistedValue: Int32(33))], count: 1) {\n            $0.int16 == Int16Wrapper(persistedValue: Int16(17)) || $0.int32 == Int32Wrapper(persistedValue: Int32(33))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((int16 == %@) || (int32 == %@))\", values: [Int16Wrapper(persistedValue: Int16(17)), Int32Wrapper(persistedValue: Int32(33))], count: 1) {\n            ($0.int16 == Int16Wrapper(persistedValue: Int16(17))) || ($0.int32 == Int32Wrapper(persistedValue: Int32(33)))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((int32 == %@) || (int64 == %@))\", values: [Int32Wrapper(persistedValue: Int32(33)), Int64Wrapper(persistedValue: Int64(65))], count: 1) {\n            $0.int32 == Int32Wrapper(persistedValue: Int32(33)) || $0.int64 == Int64Wrapper(persistedValue: Int64(65))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((int32 == %@) || (int64 == %@))\", values: [Int32Wrapper(persistedValue: Int32(33)), Int64Wrapper(persistedValue: Int64(65))], count: 1) {\n            ($0.int32 == Int32Wrapper(persistedValue: Int32(33))) || ($0.int64 == Int64Wrapper(persistedValue: Int64(65)))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((int64 == %@) || (float == %@))\", values: [Int64Wrapper(persistedValue: Int64(65)), FloatWrapper(persistedValue: Float(6.55444333))], count: 1) {\n            $0.int64 == Int64Wrapper(persistedValue: Int64(65)) || $0.float == FloatWrapper(persistedValue: Float(6.55444333))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((int64 == %@) || (float == %@))\", values: [Int64Wrapper(persistedValue: Int64(65)), FloatWrapper(persistedValue: Float(6.55444333))], count: 1) {\n            ($0.int64 == Int64Wrapper(persistedValue: Int64(65))) || ($0.float == FloatWrapper(persistedValue: Float(6.55444333)))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((float == %@) || (double == %@))\", values: [FloatWrapper(persistedValue: Float(6.55444333)), DoubleWrapper(persistedValue: 234.567)], count: 1) {\n            $0.float == FloatWrapper(persistedValue: Float(6.55444333)) || $0.double == DoubleWrapper(persistedValue: 234.567)\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((float == %@) || (double == %@))\", values: [FloatWrapper(persistedValue: Float(6.55444333)), DoubleWrapper(persistedValue: 234.567)], count: 1) {\n            ($0.float == FloatWrapper(persistedValue: Float(6.55444333))) || ($0.double == DoubleWrapper(persistedValue: 234.567))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((double == %@) || (string == %@))\", values: [DoubleWrapper(persistedValue: 234.567), StringWrapper(persistedValue: \"Foó\")], count: 1) {\n            $0.double == DoubleWrapper(persistedValue: 234.567) || $0.string == StringWrapper(persistedValue: \"Foó\")\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((double == %@) || (string == %@))\", values: [DoubleWrapper(persistedValue: 234.567), StringWrapper(persistedValue: \"Foó\")], count: 1) {\n            ($0.double == DoubleWrapper(persistedValue: 234.567)) || ($0.string == StringWrapper(persistedValue: \"Foó\"))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((string == %@) || (binary == %@))\", values: [StringWrapper(persistedValue: \"Foó\"), DataWrapper(persistedValue: Data(count: 128))], count: 1) {\n            $0.string == StringWrapper(persistedValue: \"Foó\") || $0.binary == DataWrapper(persistedValue: Data(count: 128))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((string == %@) || (binary == %@))\", values: [StringWrapper(persistedValue: \"Foó\"), DataWrapper(persistedValue: Data(count: 128))], count: 1) {\n            ($0.string == StringWrapper(persistedValue: \"Foó\")) || ($0.binary == DataWrapper(persistedValue: Data(count: 128)))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((binary == %@) || (date == %@))\", values: [DataWrapper(persistedValue: Data(count: 128)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))], count: 1) {\n            $0.binary == DataWrapper(persistedValue: Data(count: 128)) || $0.date == DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((binary == %@) || (date == %@))\", values: [DataWrapper(persistedValue: Data(count: 128)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))], count: 1) {\n            ($0.binary == DataWrapper(persistedValue: Data(count: 128))) || ($0.date == DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((date == %@) || (decimal == %@))\", values: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)), Decimal128Wrapper(persistedValue: Decimal128(234.567))], count: 1) {\n            $0.date == DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)) || $0.decimal == Decimal128Wrapper(persistedValue: Decimal128(234.567))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((date == %@) || (decimal == %@))\", values: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)), Decimal128Wrapper(persistedValue: Decimal128(234.567))], count: 1) {\n            ($0.date == DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))) || ($0.decimal == Decimal128Wrapper(persistedValue: Decimal128(234.567)))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((decimal == %@) || (objectId == %@))\", values: [Decimal128Wrapper(persistedValue: Decimal128(234.567)), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))], count: 1) {\n            $0.decimal == Decimal128Wrapper(persistedValue: Decimal128(234.567)) || $0.objectId == ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((decimal == %@) || (objectId == %@))\", values: [Decimal128Wrapper(persistedValue: Decimal128(234.567)), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))], count: 1) {\n            ($0.decimal == Decimal128Wrapper(persistedValue: Decimal128(234.567))) || ($0.objectId == ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((objectId == %@) || (uuid == %@))\", values: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)], count: 1) {\n            $0.objectId == ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")) || $0.uuid == UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((objectId == %@) || (uuid == %@))\", values: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)], count: 1) {\n            ($0.objectId == ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))) || ($0.uuid == UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optBoolCol == %@) || (optIntCol == %@))\", values: [false, 3], count: 1) {\n            $0.optBoolCol == false || $0.optIntCol == 3\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optBoolCol == %@) || (optIntCol == %@))\", values: [false, 3], count: 1) {\n            ($0.optBoolCol == false) || ($0.optIntCol == 3)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optIntCol == %@) || (optInt8Col == %@))\", values: [3, Int8(9)], count: 1) {\n            $0.optIntCol == 3 || $0.optInt8Col == Int8(9)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optIntCol == %@) || (optInt8Col == %@))\", values: [3, Int8(9)], count: 1) {\n            ($0.optIntCol == 3) || ($0.optInt8Col == Int8(9))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optInt8Col == %@) || (optInt16Col == %@))\", values: [Int8(9), Int16(17)], count: 1) {\n            $0.optInt8Col == Int8(9) || $0.optInt16Col == Int16(17)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optInt8Col == %@) || (optInt16Col == %@))\", values: [Int8(9), Int16(17)], count: 1) {\n            ($0.optInt8Col == Int8(9)) || ($0.optInt16Col == Int16(17))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optInt16Col == %@) || (optInt32Col == %@))\", values: [Int16(17), Int32(33)], count: 1) {\n            $0.optInt16Col == Int16(17) || $0.optInt32Col == Int32(33)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optInt16Col == %@) || (optInt32Col == %@))\", values: [Int16(17), Int32(33)], count: 1) {\n            ($0.optInt16Col == Int16(17)) || ($0.optInt32Col == Int32(33))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optInt32Col == %@) || (optInt64Col == %@))\", values: [Int32(33), Int64(65)], count: 1) {\n            $0.optInt32Col == Int32(33) || $0.optInt64Col == Int64(65)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optInt32Col == %@) || (optInt64Col == %@))\", values: [Int32(33), Int64(65)], count: 1) {\n            ($0.optInt32Col == Int32(33)) || ($0.optInt64Col == Int64(65))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optInt64Col == %@) || (optFloatCol == %@))\", values: [Int64(65), Float(6.55444333)], count: 1) {\n            $0.optInt64Col == Int64(65) || $0.optFloatCol == Float(6.55444333)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optInt64Col == %@) || (optFloatCol == %@))\", values: [Int64(65), Float(6.55444333)], count: 1) {\n            ($0.optInt64Col == Int64(65)) || ($0.optFloatCol == Float(6.55444333))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optFloatCol == %@) || (optDoubleCol == %@))\", values: [Float(6.55444333), 234.567], count: 1) {\n            $0.optFloatCol == Float(6.55444333) || $0.optDoubleCol == 234.567\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optFloatCol == %@) || (optDoubleCol == %@))\", values: [Float(6.55444333), 234.567], count: 1) {\n            ($0.optFloatCol == Float(6.55444333)) || ($0.optDoubleCol == 234.567)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optDoubleCol == %@) || (optStringCol == %@))\", values: [234.567, \"Foó\"], count: 1) {\n            $0.optDoubleCol == 234.567 || $0.optStringCol == \"Foó\"\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optDoubleCol == %@) || (optStringCol == %@))\", values: [234.567, \"Foó\"], count: 1) {\n            ($0.optDoubleCol == 234.567) || ($0.optStringCol == \"Foó\")\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optStringCol == %@) || (optBinaryCol == %@))\", values: [\"Foó\", Data(count: 128)], count: 1) {\n            $0.optStringCol == \"Foó\" || $0.optBinaryCol == Data(count: 128)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optStringCol == %@) || (optBinaryCol == %@))\", values: [\"Foó\", Data(count: 128)], count: 1) {\n            ($0.optStringCol == \"Foó\") || ($0.optBinaryCol == Data(count: 128))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optBinaryCol == %@) || (optDateCol == %@))\", values: [Data(count: 128), Date(timeIntervalSince1970: 2000000)], count: 1) {\n            $0.optBinaryCol == Data(count: 128) || $0.optDateCol == Date(timeIntervalSince1970: 2000000)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optBinaryCol == %@) || (optDateCol == %@))\", values: [Data(count: 128), Date(timeIntervalSince1970: 2000000)], count: 1) {\n            ($0.optBinaryCol == Data(count: 128)) || ($0.optDateCol == Date(timeIntervalSince1970: 2000000))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optDateCol == %@) || (optDecimalCol == %@))\", values: [Date(timeIntervalSince1970: 2000000), Decimal128(234.567)], count: 1) {\n            $0.optDateCol == Date(timeIntervalSince1970: 2000000) || $0.optDecimalCol == Decimal128(234.567)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optDateCol == %@) || (optDecimalCol == %@))\", values: [Date(timeIntervalSince1970: 2000000), Decimal128(234.567)], count: 1) {\n            ($0.optDateCol == Date(timeIntervalSince1970: 2000000)) || ($0.optDecimalCol == Decimal128(234.567))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optDecimalCol == %@) || (optObjectIdCol == %@))\", values: [Decimal128(234.567), ObjectId(\"61184062c1d8f096a3695045\")], count: 1) {\n            $0.optDecimalCol == Decimal128(234.567) || $0.optObjectIdCol == ObjectId(\"61184062c1d8f096a3695045\")\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optDecimalCol == %@) || (optObjectIdCol == %@))\", values: [Decimal128(234.567), ObjectId(\"61184062c1d8f096a3695045\")], count: 1) {\n            ($0.optDecimalCol == Decimal128(234.567)) || ($0.optObjectIdCol == ObjectId(\"61184062c1d8f096a3695045\"))\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optObjectIdCol == %@) || (optUuidCol == %@))\", values: [ObjectId(\"61184062c1d8f096a3695045\"), UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!], count: 1) {\n            $0.optObjectIdCol == ObjectId(\"61184062c1d8f096a3695045\") || $0.optUuidCol == UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optObjectIdCol == %@) || (optUuidCol == %@))\", values: [ObjectId(\"61184062c1d8f096a3695045\"), UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!], count: 1) {\n            ($0.optObjectIdCol == ObjectId(\"61184062c1d8f096a3695045\")) || ($0.optUuidCol == UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optUuidCol == %@) || (optIntEnumCol == %@))\", values: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!, ModernIntEnum.value2], count: 1) {\n            $0.optUuidCol == UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")! || $0.optIntEnumCol == .value2\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optUuidCol == %@) || (optIntEnumCol == %@))\", values: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!, ModernIntEnum.value2], count: 1) {\n            ($0.optUuidCol == UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!) || ($0.optIntEnumCol == .value2)\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optIntEnumCol == %@) || (optStringEnumCol == %@))\", values: [ModernIntEnum.value2, ModernStringEnum.value2], count: 1) {\n            $0.optIntEnumCol == .value2 || $0.optStringEnumCol == .value2\n        }\n        assertQuery(ModernAllTypesObject.self, \"((optIntEnumCol == %@) || (optStringEnumCol == %@))\", values: [ModernIntEnum.value2, ModernStringEnum.value2], count: 1) {\n            ($0.optIntEnumCol == .value2) || ($0.optStringEnumCol == .value2)\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optBool == %@) || (optInt == %@))\", values: [BoolWrapper(persistedValue: false), IntWrapper(persistedValue: 3)], count: 1) {\n            $0.optBool == BoolWrapper(persistedValue: false) || $0.optInt == IntWrapper(persistedValue: 3)\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optBool == %@) || (optInt == %@))\", values: [BoolWrapper(persistedValue: false), IntWrapper(persistedValue: 3)], count: 1) {\n            ($0.optBool == BoolWrapper(persistedValue: false)) || ($0.optInt == IntWrapper(persistedValue: 3))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optInt == %@) || (optInt8 == %@))\", values: [IntWrapper(persistedValue: 3), Int8Wrapper(persistedValue: Int8(9))], count: 1) {\n            $0.optInt == IntWrapper(persistedValue: 3) || $0.optInt8 == Int8Wrapper(persistedValue: Int8(9))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optInt == %@) || (optInt8 == %@))\", values: [IntWrapper(persistedValue: 3), Int8Wrapper(persistedValue: Int8(9))], count: 1) {\n            ($0.optInt == IntWrapper(persistedValue: 3)) || ($0.optInt8 == Int8Wrapper(persistedValue: Int8(9)))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optInt8 == %@) || (optInt16 == %@))\", values: [Int8Wrapper(persistedValue: Int8(9)), Int16Wrapper(persistedValue: Int16(17))], count: 1) {\n            $0.optInt8 == Int8Wrapper(persistedValue: Int8(9)) || $0.optInt16 == Int16Wrapper(persistedValue: Int16(17))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optInt8 == %@) || (optInt16 == %@))\", values: [Int8Wrapper(persistedValue: Int8(9)), Int16Wrapper(persistedValue: Int16(17))], count: 1) {\n            ($0.optInt8 == Int8Wrapper(persistedValue: Int8(9))) || ($0.optInt16 == Int16Wrapper(persistedValue: Int16(17)))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optInt16 == %@) || (optInt32 == %@))\", values: [Int16Wrapper(persistedValue: Int16(17)), Int32Wrapper(persistedValue: Int32(33))], count: 1) {\n            $0.optInt16 == Int16Wrapper(persistedValue: Int16(17)) || $0.optInt32 == Int32Wrapper(persistedValue: Int32(33))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optInt16 == %@) || (optInt32 == %@))\", values: [Int16Wrapper(persistedValue: Int16(17)), Int32Wrapper(persistedValue: Int32(33))], count: 1) {\n            ($0.optInt16 == Int16Wrapper(persistedValue: Int16(17))) || ($0.optInt32 == Int32Wrapper(persistedValue: Int32(33)))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optInt32 == %@) || (optInt64 == %@))\", values: [Int32Wrapper(persistedValue: Int32(33)), Int64Wrapper(persistedValue: Int64(65))], count: 1) {\n            $0.optInt32 == Int32Wrapper(persistedValue: Int32(33)) || $0.optInt64 == Int64Wrapper(persistedValue: Int64(65))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optInt32 == %@) || (optInt64 == %@))\", values: [Int32Wrapper(persistedValue: Int32(33)), Int64Wrapper(persistedValue: Int64(65))], count: 1) {\n            ($0.optInt32 == Int32Wrapper(persistedValue: Int32(33))) || ($0.optInt64 == Int64Wrapper(persistedValue: Int64(65)))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optInt64 == %@) || (optFloat == %@))\", values: [Int64Wrapper(persistedValue: Int64(65)), FloatWrapper(persistedValue: Float(6.55444333))], count: 1) {\n            $0.optInt64 == Int64Wrapper(persistedValue: Int64(65)) || $0.optFloat == FloatWrapper(persistedValue: Float(6.55444333))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optInt64 == %@) || (optFloat == %@))\", values: [Int64Wrapper(persistedValue: Int64(65)), FloatWrapper(persistedValue: Float(6.55444333))], count: 1) {\n            ($0.optInt64 == Int64Wrapper(persistedValue: Int64(65))) || ($0.optFloat == FloatWrapper(persistedValue: Float(6.55444333)))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optFloat == %@) || (optDouble == %@))\", values: [FloatWrapper(persistedValue: Float(6.55444333)), DoubleWrapper(persistedValue: 234.567)], count: 1) {\n            $0.optFloat == FloatWrapper(persistedValue: Float(6.55444333)) || $0.optDouble == DoubleWrapper(persistedValue: 234.567)\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optFloat == %@) || (optDouble == %@))\", values: [FloatWrapper(persistedValue: Float(6.55444333)), DoubleWrapper(persistedValue: 234.567)], count: 1) {\n            ($0.optFloat == FloatWrapper(persistedValue: Float(6.55444333))) || ($0.optDouble == DoubleWrapper(persistedValue: 234.567))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optDouble == %@) || (optString == %@))\", values: [DoubleWrapper(persistedValue: 234.567), StringWrapper(persistedValue: \"Foó\")], count: 1) {\n            $0.optDouble == DoubleWrapper(persistedValue: 234.567) || $0.optString == StringWrapper(persistedValue: \"Foó\")\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optDouble == %@) || (optString == %@))\", values: [DoubleWrapper(persistedValue: 234.567), StringWrapper(persistedValue: \"Foó\")], count: 1) {\n            ($0.optDouble == DoubleWrapper(persistedValue: 234.567)) || ($0.optString == StringWrapper(persistedValue: \"Foó\"))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optString == %@) || (optBinary == %@))\", values: [StringWrapper(persistedValue: \"Foó\"), DataWrapper(persistedValue: Data(count: 128))], count: 1) {\n            $0.optString == StringWrapper(persistedValue: \"Foó\") || $0.optBinary == DataWrapper(persistedValue: Data(count: 128))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optString == %@) || (optBinary == %@))\", values: [StringWrapper(persistedValue: \"Foó\"), DataWrapper(persistedValue: Data(count: 128))], count: 1) {\n            ($0.optString == StringWrapper(persistedValue: \"Foó\")) || ($0.optBinary == DataWrapper(persistedValue: Data(count: 128)))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optBinary == %@) || (optDate == %@))\", values: [DataWrapper(persistedValue: Data(count: 128)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))], count: 1) {\n            $0.optBinary == DataWrapper(persistedValue: Data(count: 128)) || $0.optDate == DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optBinary == %@) || (optDate == %@))\", values: [DataWrapper(persistedValue: Data(count: 128)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))], count: 1) {\n            ($0.optBinary == DataWrapper(persistedValue: Data(count: 128))) || ($0.optDate == DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optDate == %@) || (optDecimal == %@))\", values: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)), Decimal128Wrapper(persistedValue: Decimal128(234.567))], count: 1) {\n            $0.optDate == DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)) || $0.optDecimal == Decimal128Wrapper(persistedValue: Decimal128(234.567))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optDate == %@) || (optDecimal == %@))\", values: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)), Decimal128Wrapper(persistedValue: Decimal128(234.567))], count: 1) {\n            ($0.optDate == DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))) || ($0.optDecimal == Decimal128Wrapper(persistedValue: Decimal128(234.567)))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optDecimal == %@) || (optObjectId == %@))\", values: [Decimal128Wrapper(persistedValue: Decimal128(234.567)), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))], count: 1) {\n            $0.optDecimal == Decimal128Wrapper(persistedValue: Decimal128(234.567)) || $0.optObjectId == ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optDecimal == %@) || (optObjectId == %@))\", values: [Decimal128Wrapper(persistedValue: Decimal128(234.567)), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))], count: 1) {\n            ($0.optDecimal == Decimal128Wrapper(persistedValue: Decimal128(234.567))) || ($0.optObjectId == ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")))\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optObjectId == %@) || (optUuid == %@))\", values: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)], count: 1) {\n            $0.optObjectId == ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")) || $0.optUuid == UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"((optObjectId == %@) || (optUuid == %@))\", values: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)], count: 1) {\n            ($0.optObjectId == ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))) || ($0.optUuid == UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!))\n        }\n\n        // List / Set\n\n        assertQuery(\"((boolCol == %@) || (%@ IN arrayBool))\", values: [false, true], count: 1) {\n            $0.boolCol == false || $0.arrayBool.contains(true)\n        }\n        assertQuery(\"((boolCol != %@) || (%@ IN arrayBool))\", values: [true, true], count: 1) {\n            $0.boolCol != true || $0.arrayBool.contains(true)\n        }\n        assertQuery(\"((boolCol == %@) || (%@ IN arrayOptBool))\", values: [false, true], count: 1) {\n            $0.boolCol == false || $0.arrayOptBool.contains(true)\n        }\n        assertQuery(\"((boolCol != %@) || (%@ IN arrayOptBool))\", values: [true, true], count: 1) {\n            $0.boolCol != true || $0.arrayOptBool.contains(true)\n        }\n        assertQuery(\"((boolCol == %@) || (%@ IN setBool))\", values: [false, true], count: 1) {\n            $0.boolCol == false || $0.setBool.contains(true)\n        }\n        assertQuery(\"((boolCol != %@) || (%@ IN setBool))\", values: [true, true], count: 1) {\n            $0.boolCol != true || $0.setBool.contains(true)\n        }\n        assertQuery(\"((boolCol == %@) || (%@ IN setOptBool))\", values: [false, true], count: 1) {\n            $0.boolCol == false || $0.setOptBool.contains(true)\n        }\n        assertQuery(\"((boolCol != %@) || (%@ IN setOptBool))\", values: [true, true], count: 1) {\n            $0.boolCol != true || $0.setOptBool.contains(true)\n        }\n\n        // Map\n\n        assertQuery(\"((boolCol == %@) || (%@ IN mapBool))\", values: [false, true], count: 1) {\n            $0.boolCol == false || $0.mapBool.contains(true)\n        }\n        assertQuery(\"((boolCol != %@) || (mapBool[%@] == %@))\",\n                    values: [true, \"foo\", true], count: 1) {\n            ($0.boolCol != true) || ($0.mapBool[\"foo\"] == true)\n        }\n        assertQuery(\"(((boolCol != %@) || (mapBool[%@] == %@)) || (mapBool[%@] == %@))\",\n                    values: [true, \"foo\", true, \"bar\", true], count: 1) {\n            ($0.boolCol != true) ||\n            ($0.mapBool[\"foo\"] == true) ||\n            ($0.mapBool[\"bar\"] == true)\n        }\n        assertQuery(\"((boolCol == %@) || (%@ IN mapOptBool))\", values: [false, true], count: 1) {\n            $0.boolCol == false || $0.mapOptBool.contains(true)\n        }\n        assertQuery(\"((boolCol != %@) || (mapOptBool[%@] == %@))\",\n                    values: [true, \"foo\", true], count: 1) {\n            ($0.boolCol != true) || ($0.mapOptBool[\"foo\"] == true)\n        }\n        assertQuery(\"(((boolCol != %@) || (mapOptBool[%@] == %@)) || (mapOptBool[%@] == %@))\",\n                    values: [true, \"foo\", true, \"bar\", true], count: 1) {\n            ($0.boolCol != true) ||\n            ($0.mapOptBool[\"foo\"] == true) ||\n            ($0.mapOptBool[\"bar\"] == true)\n        }\n        assertQuery(\"((boolCol == %@) || (%@ IN mapInt))\", values: [false, 3], count: 1) {\n            $0.boolCol == false || $0.mapInt.contains(3)\n        }\n        assertQuery(\"((boolCol != %@) || (mapInt[%@] == %@))\",\n                    values: [true, \"foo\", 3], count: 1) {\n            ($0.boolCol != true) || ($0.mapInt[\"foo\"] == 3)\n        }\n        assertQuery(\"(((boolCol != %@) || (mapInt[%@] == %@)) || (mapInt[%@] == %@))\",\n                    values: [true, \"foo\", 1, \"bar\", 3], count: 1) {\n            ($0.boolCol != true) ||\n            ($0.mapInt[\"foo\"] == 1) ||\n            ($0.mapInt[\"bar\"] == 3)\n        }\n        assertQuery(\"((boolCol == %@) || (%@ IN mapOptInt))\", values: [false, 3], count: 1) {\n            $0.boolCol == false || $0.mapOptInt.contains(3)\n        }\n        assertQuery(\"((boolCol != %@) || (mapOptInt[%@] == %@))\",\n                    values: [true, \"foo\", 3], count: 1) {\n            ($0.boolCol != true) || ($0.mapOptInt[\"foo\"] == 3)\n        }\n        assertQuery(\"(((boolCol != %@) || (mapOptInt[%@] == %@)) || (mapOptInt[%@] == %@))\",\n                    values: [true, \"foo\", 1, \"bar\", 3], count: 1) {\n            ($0.boolCol != true) ||\n            ($0.mapOptInt[\"foo\"] == 1) ||\n            ($0.mapOptInt[\"bar\"] == 3)\n        }\n\n        // Aggregates\n\n        let sumarrayInt = 1 + 3\n        assertQuery(\"((((((arrayInt.@min <= %@) || (arrayInt.@max >= %@)) || (arrayInt.@sum != %@)) || (arrayInt.@count == %@)) || (arrayInt.@avg > %@)) || (arrayInt.@avg < %@))\",\n                    values: [1, 5, sumarrayInt, 0, 3, 1], count: 1) {\n            ($0.arrayInt.min <= 1) ||\n            ($0.arrayInt.max >= 5) ||\n            ($0.arrayInt.sum != sumarrayInt) ||\n            ($0.arrayInt.count == 0) ||\n            ($0.arrayInt.avg > 3) ||\n            ($0.arrayInt.avg < 1)\n        }\n        let sumarrayOptInt = 1 + 3\n        assertQuery(\"((((((arrayOptInt.@min <= %@) || (arrayOptInt.@max >= %@)) || (arrayOptInt.@sum != %@)) || (arrayOptInt.@count == %@)) || (arrayOptInt.@avg > %@)) || (arrayOptInt.@avg < %@))\",\n                    values: [1, 5, sumarrayOptInt, 0, 3, 1], count: 1) {\n            ($0.arrayOptInt.min <= 1) ||\n            ($0.arrayOptInt.max >= 5) ||\n            ($0.arrayOptInt.sum != sumarrayOptInt) ||\n            ($0.arrayOptInt.count == 0) ||\n            ($0.arrayOptInt.avg > 3) ||\n            ($0.arrayOptInt.avg < 1)\n        }\n\n        // Keypath Collection Aggregates\n\n        createKeypathCollectionAggregatesObject()\n\n        let sumdoubleCol = 123.456 + 234.567 + 345.678\n        assertQuery(LinkToModernAllTypesObject.self, \"((((((list.@min.doubleCol < %@) || (list.@max.doubleCol > %@)) || (list.@sum.doubleCol != %@)) || (list.@min.doubleCol == %@)) || (list.@avg.doubleCol >= %@)) || (list.@avg.doubleCol <= %@))\",\n                    values: [123.456, 345.678, sumdoubleCol, 0, 345.678, 123.456], count: 0) {\n            $0.list.doubleCol.min < 123.456 ||\n            $0.list.doubleCol.max > 345.678 ||\n            $0.list.doubleCol.sum != sumdoubleCol ||\n            $0.list.doubleCol.min == 0 ||\n            $0.list.doubleCol.avg >= 345.678 ||\n            $0.list.doubleCol.avg <= 123.456\n        }\n\n        let sumoptDoubleCol = 123.456 + 234.567 + 345.678\n        assertQuery(LinkToModernAllTypesObject.self, \"((((((list.@min.optDoubleCol < %@) || (list.@max.optDoubleCol > %@)) || (list.@sum.optDoubleCol != %@)) || (list.@min.optDoubleCol == %@)) || (list.@avg.optDoubleCol >= %@)) || (list.@avg.optDoubleCol <= %@))\",\n                    values: [123.456, 345.678, sumoptDoubleCol, 0, 345.678, 123.456], count: 0) {\n            $0.list.optDoubleCol.min < 123.456 ||\n            $0.list.optDoubleCol.max > 345.678 ||\n            $0.list.optDoubleCol.sum != sumoptDoubleCol ||\n            $0.list.optDoubleCol.min == 0 ||\n            $0.list.optDoubleCol.avg >= 345.678 ||\n            $0.list.optDoubleCol.avg <= 123.456\n        }\n    }\n\n    func validateCompoundMixed<Root: Object, T: _Persistable, U: _Persistable>(\n            _ name1: String, _ lhs1: (Query<Root>) -> Query<T>, _ value1: T,\n            _ name2: String, _ lhs2: (Query<Root>) -> Query<U>, _ value2: U) {\n        assertQuery(Root.self, \"(((\\(name1) == %@) || (\\(name2) == %@)) && ((\\(name1) != %@) || (\\(name2) != %@)))\",\n                    values: [value1, value2, value1, value2], count: 0) {\n            (lhs1($0) == value1 || lhs2($0) == value2) && (lhs1($0) != value1 || lhs2($0) != value2)\n        }\n        assertQuery(Root.self, \"((\\(name1) == %@) || (\\(name2) == %@))\", values: [value1, value2], count: 1) {\n            (lhs1($0) == value1) || (lhs2($0) == value2)\n        }\n    }\n\n    func validateCompoundString<Root: Object, T: _Persistable, U: _Persistable>(\n            _ name1: String, _ lhs1: (Query<Root>) -> Query<T>, _ value1: T,\n            _ name2: String, _ lhs2: (Query<Root>) -> Query<U>, _ value2: U) where U.PersistedType: _QueryBinary {\n        assertQuery(Root.self, \"(NOT ((\\(name1) == %@) || (\\(name2) CONTAINS %@)) && (\\(name2) == %@))\",\n                    values: [value1, value2, value2], count: 0) {\n            !(lhs1($0) == value1 || lhs2($0).contains(value2)) && (lhs2($0) == value2)\n        }\n    }\n\n    func testCompoundMixed() {\n        validateCompoundMixed(\"boolCol\", \\Query<ModernAllTypesObject>.boolCol, false,\n                              \"intCol\", \\Query<ModernAllTypesObject>.intCol, 3)\n        validateCompoundMixed(\"intCol\", \\Query<ModernAllTypesObject>.intCol, 3,\n                              \"int8Col\", \\Query<ModernAllTypesObject>.int8Col, Int8(9))\n        validateCompoundMixed(\"int8Col\", \\Query<ModernAllTypesObject>.int8Col, Int8(9),\n                              \"int16Col\", \\Query<ModernAllTypesObject>.int16Col, Int16(17))\n        validateCompoundMixed(\"int16Col\", \\Query<ModernAllTypesObject>.int16Col, Int16(17),\n                              \"int32Col\", \\Query<ModernAllTypesObject>.int32Col, Int32(33))\n        validateCompoundMixed(\"int32Col\", \\Query<ModernAllTypesObject>.int32Col, Int32(33),\n                              \"int64Col\", \\Query<ModernAllTypesObject>.int64Col, Int64(65))\n        validateCompoundMixed(\"int64Col\", \\Query<ModernAllTypesObject>.int64Col, Int64(65),\n                              \"floatCol\", \\Query<ModernAllTypesObject>.floatCol, Float(6.55444333))\n        validateCompoundMixed(\"floatCol\", \\Query<ModernAllTypesObject>.floatCol, Float(6.55444333),\n                              \"doubleCol\", \\Query<ModernAllTypesObject>.doubleCol, 234.567)\n        validateCompoundMixed(\"doubleCol\", \\Query<ModernAllTypesObject>.doubleCol, 234.567,\n                              \"stringCol\", \\Query<ModernAllTypesObject>.stringCol, \"Foó\")\n        validateCompoundString(\"doubleCol\", \\Query<ModernAllTypesObject>.doubleCol, 234.567,\n                               \"stringCol\", \\Query<ModernAllTypesObject>.stringCol, \"Foó\")\n        validateCompoundMixed(\"stringCol\", \\Query<ModernAllTypesObject>.stringCol, \"Foó\",\n                              \"binaryCol\", \\Query<ModernAllTypesObject>.binaryCol, Data(count: 128))\n        validateCompoundMixed(\"binaryCol\", \\Query<ModernAllTypesObject>.binaryCol, Data(count: 128),\n                              \"dateCol\", \\Query<ModernAllTypesObject>.dateCol, Date(timeIntervalSince1970: 2000000))\n        validateCompoundMixed(\"dateCol\", \\Query<ModernAllTypesObject>.dateCol, Date(timeIntervalSince1970: 2000000),\n                              \"decimalCol\", \\Query<ModernAllTypesObject>.decimalCol, Decimal128(234.567))\n        validateCompoundMixed(\"decimalCol\", \\Query<ModernAllTypesObject>.decimalCol, Decimal128(234.567),\n                              \"objectIdCol\", \\Query<ModernAllTypesObject>.objectIdCol, ObjectId(\"61184062c1d8f096a3695045\"))\n        validateCompoundMixed(\"objectIdCol\", \\Query<ModernAllTypesObject>.objectIdCol, ObjectId(\"61184062c1d8f096a3695045\"),\n                              \"uuidCol\", \\Query<ModernAllTypesObject>.uuidCol, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)\n        validateCompoundMixed(\"uuidCol\", \\Query<ModernAllTypesObject>.uuidCol, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!,\n                              \"intEnumCol\", \\Query<ModernAllTypesObject>.intEnumCol, .value2)\n        validateCompoundMixed(\"intEnumCol\", \\Query<ModernAllTypesObject>.intEnumCol, .value2,\n                              \"stringEnumCol\", \\Query<ModernAllTypesObject>.stringEnumCol, .value2)\n        validateCompoundMixed(\"bool\", \\Query<AllCustomPersistableTypes>.bool, BoolWrapper(persistedValue: false),\n                              \"int\", \\Query<AllCustomPersistableTypes>.int, IntWrapper(persistedValue: 3))\n        validateCompoundMixed(\"int\", \\Query<AllCustomPersistableTypes>.int, IntWrapper(persistedValue: 3),\n                              \"int8\", \\Query<AllCustomPersistableTypes>.int8, Int8Wrapper(persistedValue: Int8(9)))\n        validateCompoundMixed(\"int8\", \\Query<AllCustomPersistableTypes>.int8, Int8Wrapper(persistedValue: Int8(9)),\n                              \"int16\", \\Query<AllCustomPersistableTypes>.int16, Int16Wrapper(persistedValue: Int16(17)))\n        validateCompoundMixed(\"int16\", \\Query<AllCustomPersistableTypes>.int16, Int16Wrapper(persistedValue: Int16(17)),\n                              \"int32\", \\Query<AllCustomPersistableTypes>.int32, Int32Wrapper(persistedValue: Int32(33)))\n        validateCompoundMixed(\"int32\", \\Query<AllCustomPersistableTypes>.int32, Int32Wrapper(persistedValue: Int32(33)),\n                              \"int64\", \\Query<AllCustomPersistableTypes>.int64, Int64Wrapper(persistedValue: Int64(65)))\n        validateCompoundMixed(\"int64\", \\Query<AllCustomPersistableTypes>.int64, Int64Wrapper(persistedValue: Int64(65)),\n                              \"float\", \\Query<AllCustomPersistableTypes>.float, FloatWrapper(persistedValue: Float(6.55444333)))\n        validateCompoundMixed(\"float\", \\Query<AllCustomPersistableTypes>.float, FloatWrapper(persistedValue: Float(6.55444333)),\n                              \"double\", \\Query<AllCustomPersistableTypes>.double, DoubleWrapper(persistedValue: 234.567))\n        validateCompoundMixed(\"double\", \\Query<AllCustomPersistableTypes>.double, DoubleWrapper(persistedValue: 234.567),\n                              \"string\", \\Query<AllCustomPersistableTypes>.string, StringWrapper(persistedValue: \"Foó\"))\n        validateCompoundString(\"double\", \\Query<AllCustomPersistableTypes>.double, DoubleWrapper(persistedValue: 234.567),\n                               \"string\", \\Query<AllCustomPersistableTypes>.string, StringWrapper(persistedValue: \"Foó\"))\n        validateCompoundMixed(\"string\", \\Query<AllCustomPersistableTypes>.string, StringWrapper(persistedValue: \"Foó\"),\n                              \"binary\", \\Query<AllCustomPersistableTypes>.binary, DataWrapper(persistedValue: Data(count: 128)))\n        validateCompoundMixed(\"binary\", \\Query<AllCustomPersistableTypes>.binary, DataWrapper(persistedValue: Data(count: 128)),\n                              \"date\", \\Query<AllCustomPersistableTypes>.date, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)))\n        validateCompoundMixed(\"date\", \\Query<AllCustomPersistableTypes>.date, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)),\n                              \"decimal\", \\Query<AllCustomPersistableTypes>.decimal, Decimal128Wrapper(persistedValue: Decimal128(234.567)))\n        validateCompoundMixed(\"decimal\", \\Query<AllCustomPersistableTypes>.decimal, Decimal128Wrapper(persistedValue: Decimal128(234.567)),\n                              \"objectId\", \\Query<AllCustomPersistableTypes>.objectId, ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")))\n        validateCompoundMixed(\"objectId\", \\Query<AllCustomPersistableTypes>.objectId, ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")),\n                              \"uuid\", \\Query<AllCustomPersistableTypes>.uuid, UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!))\n        validateCompoundMixed(\"optBoolCol\", \\Query<ModernAllTypesObject>.optBoolCol, false,\n                              \"optIntCol\", \\Query<ModernAllTypesObject>.optIntCol, 3)\n        validateCompoundMixed(\"optIntCol\", \\Query<ModernAllTypesObject>.optIntCol, 3,\n                              \"optInt8Col\", \\Query<ModernAllTypesObject>.optInt8Col, Int8(9))\n        validateCompoundMixed(\"optInt8Col\", \\Query<ModernAllTypesObject>.optInt8Col, Int8(9),\n                              \"optInt16Col\", \\Query<ModernAllTypesObject>.optInt16Col, Int16(17))\n        validateCompoundMixed(\"optInt16Col\", \\Query<ModernAllTypesObject>.optInt16Col, Int16(17),\n                              \"optInt32Col\", \\Query<ModernAllTypesObject>.optInt32Col, Int32(33))\n        validateCompoundMixed(\"optInt32Col\", \\Query<ModernAllTypesObject>.optInt32Col, Int32(33),\n                              \"optInt64Col\", \\Query<ModernAllTypesObject>.optInt64Col, Int64(65))\n        validateCompoundMixed(\"optInt64Col\", \\Query<ModernAllTypesObject>.optInt64Col, Int64(65),\n                              \"optFloatCol\", \\Query<ModernAllTypesObject>.optFloatCol, Float(6.55444333))\n        validateCompoundMixed(\"optFloatCol\", \\Query<ModernAllTypesObject>.optFloatCol, Float(6.55444333),\n                              \"optDoubleCol\", \\Query<ModernAllTypesObject>.optDoubleCol, 234.567)\n        validateCompoundMixed(\"optDoubleCol\", \\Query<ModernAllTypesObject>.optDoubleCol, 234.567,\n                              \"optStringCol\", \\Query<ModernAllTypesObject>.optStringCol, \"Foó\")\n        validateCompoundString(\"optDoubleCol\", \\Query<ModernAllTypesObject>.optDoubleCol, 234.567,\n                               \"optStringCol\", \\Query<ModernAllTypesObject>.optStringCol, \"Foó\")\n        validateCompoundMixed(\"optStringCol\", \\Query<ModernAllTypesObject>.optStringCol, \"Foó\",\n                              \"optBinaryCol\", \\Query<ModernAllTypesObject>.optBinaryCol, Data(count: 128))\n        validateCompoundMixed(\"optBinaryCol\", \\Query<ModernAllTypesObject>.optBinaryCol, Data(count: 128),\n                              \"optDateCol\", \\Query<ModernAllTypesObject>.optDateCol, Date(timeIntervalSince1970: 2000000))\n        validateCompoundMixed(\"optDateCol\", \\Query<ModernAllTypesObject>.optDateCol, Date(timeIntervalSince1970: 2000000),\n                              \"optDecimalCol\", \\Query<ModernAllTypesObject>.optDecimalCol, Decimal128(234.567))\n        validateCompoundMixed(\"optDecimalCol\", \\Query<ModernAllTypesObject>.optDecimalCol, Decimal128(234.567),\n                              \"optObjectIdCol\", \\Query<ModernAllTypesObject>.optObjectIdCol, ObjectId(\"61184062c1d8f096a3695045\"))\n        validateCompoundMixed(\"optObjectIdCol\", \\Query<ModernAllTypesObject>.optObjectIdCol, ObjectId(\"61184062c1d8f096a3695045\"),\n                              \"optUuidCol\", \\Query<ModernAllTypesObject>.optUuidCol, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)\n        validateCompoundMixed(\"optUuidCol\", \\Query<ModernAllTypesObject>.optUuidCol, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!,\n                              \"optIntEnumCol\", \\Query<ModernAllTypesObject>.optIntEnumCol, .value2)\n        validateCompoundMixed(\"optIntEnumCol\", \\Query<ModernAllTypesObject>.optIntEnumCol, .value2,\n                              \"optStringEnumCol\", \\Query<ModernAllTypesObject>.optStringEnumCol, .value2)\n        validateCompoundMixed(\"optBool\", \\Query<AllCustomPersistableTypes>.optBool, BoolWrapper(persistedValue: false),\n                              \"optInt\", \\Query<AllCustomPersistableTypes>.optInt, IntWrapper(persistedValue: 3))\n        validateCompoundMixed(\"optInt\", \\Query<AllCustomPersistableTypes>.optInt, IntWrapper(persistedValue: 3),\n                              \"optInt8\", \\Query<AllCustomPersistableTypes>.optInt8, Int8Wrapper(persistedValue: Int8(9)))\n        validateCompoundMixed(\"optInt8\", \\Query<AllCustomPersistableTypes>.optInt8, Int8Wrapper(persistedValue: Int8(9)),\n                              \"optInt16\", \\Query<AllCustomPersistableTypes>.optInt16, Int16Wrapper(persistedValue: Int16(17)))\n        validateCompoundMixed(\"optInt16\", \\Query<AllCustomPersistableTypes>.optInt16, Int16Wrapper(persistedValue: Int16(17)),\n                              \"optInt32\", \\Query<AllCustomPersistableTypes>.optInt32, Int32Wrapper(persistedValue: Int32(33)))\n        validateCompoundMixed(\"optInt32\", \\Query<AllCustomPersistableTypes>.optInt32, Int32Wrapper(persistedValue: Int32(33)),\n                              \"optInt64\", \\Query<AllCustomPersistableTypes>.optInt64, Int64Wrapper(persistedValue: Int64(65)))\n        validateCompoundMixed(\"optInt64\", \\Query<AllCustomPersistableTypes>.optInt64, Int64Wrapper(persistedValue: Int64(65)),\n                              \"optFloat\", \\Query<AllCustomPersistableTypes>.optFloat, FloatWrapper(persistedValue: Float(6.55444333)))\n        validateCompoundMixed(\"optFloat\", \\Query<AllCustomPersistableTypes>.optFloat, FloatWrapper(persistedValue: Float(6.55444333)),\n                              \"optDouble\", \\Query<AllCustomPersistableTypes>.optDouble, DoubleWrapper(persistedValue: 234.567))\n        validateCompoundMixed(\"optDouble\", \\Query<AllCustomPersistableTypes>.optDouble, DoubleWrapper(persistedValue: 234.567),\n                              \"optString\", \\Query<AllCustomPersistableTypes>.optString, StringWrapper(persistedValue: \"Foó\"))\n        validateCompoundString(\"optDouble\", \\Query<AllCustomPersistableTypes>.optDouble, DoubleWrapper(persistedValue: 234.567),\n                               \"optString\", \\Query<AllCustomPersistableTypes>.optString, StringWrapper(persistedValue: \"Foó\"))\n        validateCompoundMixed(\"optString\", \\Query<AllCustomPersistableTypes>.optString, StringWrapper(persistedValue: \"Foó\"),\n                              \"optBinary\", \\Query<AllCustomPersistableTypes>.optBinary, DataWrapper(persistedValue: Data(count: 128)))\n        validateCompoundMixed(\"optBinary\", \\Query<AllCustomPersistableTypes>.optBinary, DataWrapper(persistedValue: Data(count: 128)),\n                              \"optDate\", \\Query<AllCustomPersistableTypes>.optDate, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)))\n        validateCompoundMixed(\"optDate\", \\Query<AllCustomPersistableTypes>.optDate, DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000)),\n                              \"optDecimal\", \\Query<AllCustomPersistableTypes>.optDecimal, Decimal128Wrapper(persistedValue: Decimal128(234.567)))\n        validateCompoundMixed(\"optDecimal\", \\Query<AllCustomPersistableTypes>.optDecimal, Decimal128Wrapper(persistedValue: Decimal128(234.567)),\n                              \"optObjectId\", \\Query<AllCustomPersistableTypes>.optObjectId, ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")))\n        validateCompoundMixed(\"optObjectId\", \\Query<AllCustomPersistableTypes>.optObjectId, ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\")),\n                              \"optUuid\", \\Query<AllCustomPersistableTypes>.optUuid, UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!))\n\n        // Aggregates\n\n        let sumarrayInt = 1 + 3\n        assertQuery(\"(((((arrayInt.@min <= %@) || (arrayInt.@max >= %@)) && (arrayInt.@sum == %@)) && (arrayInt.@count != %@)) && ((arrayInt.@avg > %@) && (arrayInt.@avg < %@)))\",\n                    values: [1, 5, sumarrayInt, 0, 1, 5], count: 1) {\n            (($0.arrayInt.min <= 1) || ($0.arrayInt.max >= 5)) &&\n            ($0.arrayInt.sum == sumarrayInt) &&\n            ($0.arrayInt.count != 0) &&\n            ($0.arrayInt.avg > 1 && $0.arrayInt.avg < 5)\n        }\n        let sumarrayOptInt = 1 + 3\n        assertQuery(\"(((((arrayOptInt.@min <= %@) || (arrayOptInt.@max >= %@)) && (arrayOptInt.@sum == %@)) && (arrayOptInt.@count != %@)) && ((arrayOptInt.@avg > %@) && (arrayOptInt.@avg < %@)))\",\n                    values: [1, 5, sumarrayOptInt, 0, 1, 5], count: 1) {\n            (($0.arrayOptInt.min <= 1) || ($0.arrayOptInt.max >= 5)) &&\n            ($0.arrayOptInt.sum == sumarrayOptInt) &&\n            ($0.arrayOptInt.count != 0) &&\n            ($0.arrayOptInt.avg > 1 && $0.arrayOptInt.avg < 5)\n        }\n        let summapInt = 1 + 3\n        assertQuery(\"(((((mapInt.@min <= %@) || (mapInt.@max >= %@)) && (mapInt.@sum == %@)) && (mapInt.@count != %@)) && ((mapInt.@avg > %@) && (mapInt.@avg < %@)))\",\n                    values: [1, 5, summapInt, 0, 1, 5], count: 1) {\n            (($0.mapInt.min <= 1) || ($0.mapInt.max >= 5)) &&\n            ($0.mapInt.sum == summapInt) &&\n            ($0.mapInt.count != 0) &&\n            ($0.mapInt.avg > 1 && $0.mapInt.avg < 5)\n        }\n        let summapOptInt = 1 + 3\n        assertQuery(\"(((((mapOptInt.@min <= %@) || (mapOptInt.@max >= %@)) && (mapOptInt.@sum == %@)) && (mapOptInt.@count != %@)) && ((mapOptInt.@avg > %@) && (mapOptInt.@avg < %@)))\",\n                    values: [1, 5, summapOptInt, 0, 1, 5], count: 1) {\n            (($0.mapOptInt.min <= 1) || ($0.mapOptInt.max >= 5)) &&\n            ($0.mapOptInt.sum == summapOptInt) &&\n            ($0.mapOptInt.count != 0) &&\n            ($0.mapOptInt.avg > 1 && $0.mapOptInt.avg < 5)\n        }\n\n        // Keypath Collection Aggregates\n\n        createKeypathCollectionAggregatesObject()\n\n        let sumdoubleCol = 123.456 + 234.567 + 345.678\n        assertQuery(LinkToModernAllTypesObject.self, \"(((((list.@min.doubleCol <= %@) || (list.@max.doubleCol >= %@)) && (list.@sum.doubleCol == %@)) && (list.@sum.doubleCol != %@)) && ((list.@avg.doubleCol > %@) && (list.@avg.doubleCol < %@)))\", values: [123.456, 345.678, sumdoubleCol, 0, 123.456, 345.678], count: 1) {\n            ($0.list.doubleCol.min <= 123.456 || $0.list.doubleCol.max >= 345.678) &&\n            $0.list.doubleCol.sum == sumdoubleCol &&\n            $0.list.doubleCol.sum != 0 &&\n            ($0.list.doubleCol.avg > 123.456 && $0.list.doubleCol.avg < 345.678)\n        }\n\n        let sumoptDoubleCol = 123.456 + 234.567 + 345.678\n        assertQuery(LinkToModernAllTypesObject.self, \"(((((list.@min.optDoubleCol <= %@) || (list.@max.optDoubleCol >= %@)) && (list.@sum.optDoubleCol == %@)) && (list.@sum.optDoubleCol != %@)) && ((list.@avg.optDoubleCol > %@) && (list.@avg.optDoubleCol < %@)))\", values: [123.456, 345.678, sumoptDoubleCol, 0, 123.456, 345.678], count: 1) {\n            ($0.list.optDoubleCol.min <= 123.456 || $0.list.optDoubleCol.max >= 345.678) &&\n            $0.list.optDoubleCol.sum == sumoptDoubleCol &&\n            $0.list.optDoubleCol.sum != 0 &&\n            ($0.list.optDoubleCol.avg > 123.456 && $0.list.optDoubleCol.avg < 345.678)\n        }\n    }\n\n    func testAny() {\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayBool == %@)\", true, count: 1) {\n            $0.arrayBool == true\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayInt == %@)\", 1, count: 1) {\n            $0.arrayInt == 1\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayInt8 == %@)\", Int8(8), count: 1) {\n            $0.arrayInt8 == Int8(8)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayInt16 == %@)\", Int16(16), count: 1) {\n            $0.arrayInt16 == Int16(16)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayInt32 == %@)\", Int32(32), count: 1) {\n            $0.arrayInt32 == Int32(32)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayInt64 == %@)\", Int64(64), count: 1) {\n            $0.arrayInt64 == Int64(64)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayFloat == %@)\", Float(5.55444333), count: 1) {\n            $0.arrayFloat == Float(5.55444333)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayDouble == %@)\", 123.456, count: 1) {\n            $0.arrayDouble == 123.456\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayString == %@)\", \"Foo\", count: 1) {\n            $0.arrayString == \"Foo\"\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayBinary == %@)\", Data(count: 64), count: 1) {\n            $0.arrayBinary == Data(count: 64)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayDate == %@)\", Date(timeIntervalSince1970: 1000000), count: 1) {\n            $0.arrayDate == Date(timeIntervalSince1970: 1000000)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayDecimal == %@)\", Decimal128(123.456), count: 1) {\n            $0.arrayDecimal == Decimal128(123.456)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayObjectId == %@)\", ObjectId(\"61184062c1d8f096a3695046\"), count: 1) {\n            $0.arrayObjectId == ObjectId(\"61184062c1d8f096a3695046\")\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayUuid == %@)\", UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, count: 1) {\n            $0.arrayUuid == UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayAny == %@)\", AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\")), count: 1) {\n            $0.arrayAny == AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\"))\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listInt == %@)\", EnumInt.value1, count: 1) {\n            $0.listInt == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listInt8 == %@)\", EnumInt8.value1, count: 1) {\n            $0.listInt8 == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listInt16 == %@)\", EnumInt16.value1, count: 1) {\n            $0.listInt16 == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listInt32 == %@)\", EnumInt32.value1, count: 1) {\n            $0.listInt32 == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listInt64 == %@)\", EnumInt64.value1, count: 1) {\n            $0.listInt64 == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listFloat == %@)\", EnumFloat.value1, count: 1) {\n            $0.listFloat == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listDouble == %@)\", EnumDouble.value1, count: 1) {\n            $0.listDouble == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listString == %@)\", EnumString.value1, count: 1) {\n            $0.listString == .value1\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listBool == %@)\", BoolWrapper(persistedValue: true), count: 1) {\n            $0.listBool == BoolWrapper(persistedValue: true)\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listInt == %@)\", IntWrapper(persistedValue: 1), count: 1) {\n            $0.listInt == IntWrapper(persistedValue: 1)\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listInt8 == %@)\", Int8Wrapper(persistedValue: Int8(8)), count: 1) {\n            $0.listInt8 == Int8Wrapper(persistedValue: Int8(8))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listInt16 == %@)\", Int16Wrapper(persistedValue: Int16(16)), count: 1) {\n            $0.listInt16 == Int16Wrapper(persistedValue: Int16(16))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listInt32 == %@)\", Int32Wrapper(persistedValue: Int32(32)), count: 1) {\n            $0.listInt32 == Int32Wrapper(persistedValue: Int32(32))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listInt64 == %@)\", Int64Wrapper(persistedValue: Int64(64)), count: 1) {\n            $0.listInt64 == Int64Wrapper(persistedValue: Int64(64))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listFloat == %@)\", FloatWrapper(persistedValue: Float(5.55444333)), count: 1) {\n            $0.listFloat == FloatWrapper(persistedValue: Float(5.55444333))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listDouble == %@)\", DoubleWrapper(persistedValue: 123.456), count: 1) {\n            $0.listDouble == DoubleWrapper(persistedValue: 123.456)\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listString == %@)\", StringWrapper(persistedValue: \"Foo\"), count: 1) {\n            $0.listString == StringWrapper(persistedValue: \"Foo\")\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listBinary == %@)\", DataWrapper(persistedValue: Data(count: 64)), count: 1) {\n            $0.listBinary == DataWrapper(persistedValue: Data(count: 64))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listDate == %@)\", DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), count: 1) {\n            $0.listDate == DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listDecimal == %@)\", Decimal128Wrapper(persistedValue: Decimal128(123.456)), count: 1) {\n            $0.listDecimal == Decimal128Wrapper(persistedValue: Decimal128(123.456))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listObjectId == %@)\", ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), count: 1) {\n            $0.listObjectId == ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\"))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listUuid == %@)\", UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), count: 1) {\n            $0.listUuid == UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptBool == %@)\", true, count: 1) {\n            $0.arrayOptBool == true\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptInt == %@)\", 1, count: 1) {\n            $0.arrayOptInt == 1\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptInt8 == %@)\", Int8(8), count: 1) {\n            $0.arrayOptInt8 == Int8(8)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptInt16 == %@)\", Int16(16), count: 1) {\n            $0.arrayOptInt16 == Int16(16)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptInt32 == %@)\", Int32(32), count: 1) {\n            $0.arrayOptInt32 == Int32(32)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptInt64 == %@)\", Int64(64), count: 1) {\n            $0.arrayOptInt64 == Int64(64)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptFloat == %@)\", Float(5.55444333), count: 1) {\n            $0.arrayOptFloat == Float(5.55444333)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptDouble == %@)\", 123.456, count: 1) {\n            $0.arrayOptDouble == 123.456\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptString == %@)\", \"Foo\", count: 1) {\n            $0.arrayOptString == \"Foo\"\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptBinary == %@)\", Data(count: 64), count: 1) {\n            $0.arrayOptBinary == Data(count: 64)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptDate == %@)\", Date(timeIntervalSince1970: 1000000), count: 1) {\n            $0.arrayOptDate == Date(timeIntervalSince1970: 1000000)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptDecimal == %@)\", Decimal128(123.456), count: 1) {\n            $0.arrayOptDecimal == Decimal128(123.456)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptObjectId == %@)\", ObjectId(\"61184062c1d8f096a3695046\"), count: 1) {\n            $0.arrayOptObjectId == ObjectId(\"61184062c1d8f096a3695046\")\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY arrayOptUuid == %@)\", UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, count: 1) {\n            $0.arrayOptUuid == UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listIntOpt == %@)\", EnumInt.value1, count: 1) {\n            $0.listIntOpt == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listInt8Opt == %@)\", EnumInt8.value1, count: 1) {\n            $0.listInt8Opt == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listInt16Opt == %@)\", EnumInt16.value1, count: 1) {\n            $0.listInt16Opt == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listInt32Opt == %@)\", EnumInt32.value1, count: 1) {\n            $0.listInt32Opt == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listInt64Opt == %@)\", EnumInt64.value1, count: 1) {\n            $0.listInt64Opt == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listFloatOpt == %@)\", EnumFloat.value1, count: 1) {\n            $0.listFloatOpt == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listDoubleOpt == %@)\", EnumDouble.value1, count: 1) {\n            $0.listDoubleOpt == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY listStringOpt == %@)\", EnumString.value1, count: 1) {\n            $0.listStringOpt == .value1\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptBool == %@)\", BoolWrapper(persistedValue: true), count: 1) {\n            $0.listOptBool == BoolWrapper(persistedValue: true)\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptInt == %@)\", IntWrapper(persistedValue: 1), count: 1) {\n            $0.listOptInt == IntWrapper(persistedValue: 1)\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptInt8 == %@)\", Int8Wrapper(persistedValue: Int8(8)), count: 1) {\n            $0.listOptInt8 == Int8Wrapper(persistedValue: Int8(8))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptInt16 == %@)\", Int16Wrapper(persistedValue: Int16(16)), count: 1) {\n            $0.listOptInt16 == Int16Wrapper(persistedValue: Int16(16))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptInt32 == %@)\", Int32Wrapper(persistedValue: Int32(32)), count: 1) {\n            $0.listOptInt32 == Int32Wrapper(persistedValue: Int32(32))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptInt64 == %@)\", Int64Wrapper(persistedValue: Int64(64)), count: 1) {\n            $0.listOptInt64 == Int64Wrapper(persistedValue: Int64(64))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptFloat == %@)\", FloatWrapper(persistedValue: Float(5.55444333)), count: 1) {\n            $0.listOptFloat == FloatWrapper(persistedValue: Float(5.55444333))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptDouble == %@)\", DoubleWrapper(persistedValue: 123.456), count: 1) {\n            $0.listOptDouble == DoubleWrapper(persistedValue: 123.456)\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptString == %@)\", StringWrapper(persistedValue: \"Foo\"), count: 1) {\n            $0.listOptString == StringWrapper(persistedValue: \"Foo\")\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptBinary == %@)\", DataWrapper(persistedValue: Data(count: 64)), count: 1) {\n            $0.listOptBinary == DataWrapper(persistedValue: Data(count: 64))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptDate == %@)\", DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), count: 1) {\n            $0.listOptDate == DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptDecimal == %@)\", Decimal128Wrapper(persistedValue: Decimal128(123.456)), count: 1) {\n            $0.listOptDecimal == Decimal128Wrapper(persistedValue: Decimal128(123.456))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptObjectId == %@)\", ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), count: 1) {\n            $0.listOptObjectId == ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\"))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY listOptUuid == %@)\", UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), count: 1) {\n            $0.listOptUuid == UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setBool == %@)\", true, count: 1) {\n            $0.setBool == true\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setInt == %@)\", 1, count: 1) {\n            $0.setInt == 1\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setInt8 == %@)\", Int8(8), count: 1) {\n            $0.setInt8 == Int8(8)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setInt16 == %@)\", Int16(16), count: 1) {\n            $0.setInt16 == Int16(16)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setInt32 == %@)\", Int32(32), count: 1) {\n            $0.setInt32 == Int32(32)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setInt64 == %@)\", Int64(64), count: 1) {\n            $0.setInt64 == Int64(64)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setFloat == %@)\", Float(5.55444333), count: 1) {\n            $0.setFloat == Float(5.55444333)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setDouble == %@)\", 123.456, count: 1) {\n            $0.setDouble == 123.456\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setString == %@)\", \"Foo\", count: 1) {\n            $0.setString == \"Foo\"\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setBinary == %@)\", Data(count: 64), count: 1) {\n            $0.setBinary == Data(count: 64)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setDate == %@)\", Date(timeIntervalSince1970: 1000000), count: 1) {\n            $0.setDate == Date(timeIntervalSince1970: 1000000)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setDecimal == %@)\", Decimal128(123.456), count: 1) {\n            $0.setDecimal == Decimal128(123.456)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setObjectId == %@)\", ObjectId(\"61184062c1d8f096a3695046\"), count: 1) {\n            $0.setObjectId == ObjectId(\"61184062c1d8f096a3695046\")\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setUuid == %@)\", UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, count: 1) {\n            $0.setUuid == UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setAny == %@)\", AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\")), count: 1) {\n            $0.setAny == AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\"))\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setInt == %@)\", EnumInt.value1, count: 1) {\n            $0.setInt == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setInt8 == %@)\", EnumInt8.value1, count: 1) {\n            $0.setInt8 == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setInt16 == %@)\", EnumInt16.value1, count: 1) {\n            $0.setInt16 == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setInt32 == %@)\", EnumInt32.value1, count: 1) {\n            $0.setInt32 == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setInt64 == %@)\", EnumInt64.value1, count: 1) {\n            $0.setInt64 == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setFloat == %@)\", EnumFloat.value1, count: 1) {\n            $0.setFloat == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setDouble == %@)\", EnumDouble.value1, count: 1) {\n            $0.setDouble == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setString == %@)\", EnumString.value1, count: 1) {\n            $0.setString == .value1\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setBool == %@)\", BoolWrapper(persistedValue: true), count: 1) {\n            $0.setBool == BoolWrapper(persistedValue: true)\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setInt == %@)\", IntWrapper(persistedValue: 1), count: 1) {\n            $0.setInt == IntWrapper(persistedValue: 1)\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setInt8 == %@)\", Int8Wrapper(persistedValue: Int8(8)), count: 1) {\n            $0.setInt8 == Int8Wrapper(persistedValue: Int8(8))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setInt16 == %@)\", Int16Wrapper(persistedValue: Int16(16)), count: 1) {\n            $0.setInt16 == Int16Wrapper(persistedValue: Int16(16))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setInt32 == %@)\", Int32Wrapper(persistedValue: Int32(32)), count: 1) {\n            $0.setInt32 == Int32Wrapper(persistedValue: Int32(32))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setInt64 == %@)\", Int64Wrapper(persistedValue: Int64(64)), count: 1) {\n            $0.setInt64 == Int64Wrapper(persistedValue: Int64(64))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setFloat == %@)\", FloatWrapper(persistedValue: Float(5.55444333)), count: 1) {\n            $0.setFloat == FloatWrapper(persistedValue: Float(5.55444333))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setDouble == %@)\", DoubleWrapper(persistedValue: 123.456), count: 1) {\n            $0.setDouble == DoubleWrapper(persistedValue: 123.456)\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setString == %@)\", StringWrapper(persistedValue: \"Foo\"), count: 1) {\n            $0.setString == StringWrapper(persistedValue: \"Foo\")\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setBinary == %@)\", DataWrapper(persistedValue: Data(count: 64)), count: 1) {\n            $0.setBinary == DataWrapper(persistedValue: Data(count: 64))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setDate == %@)\", DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), count: 1) {\n            $0.setDate == DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setDecimal == %@)\", Decimal128Wrapper(persistedValue: Decimal128(123.456)), count: 1) {\n            $0.setDecimal == Decimal128Wrapper(persistedValue: Decimal128(123.456))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setObjectId == %@)\", ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), count: 1) {\n            $0.setObjectId == ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\"))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setUuid == %@)\", UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), count: 1) {\n            $0.setUuid == UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptBool == %@)\", true, count: 1) {\n            $0.setOptBool == true\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptInt == %@)\", 1, count: 1) {\n            $0.setOptInt == 1\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptInt8 == %@)\", Int8(8), count: 1) {\n            $0.setOptInt8 == Int8(8)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptInt16 == %@)\", Int16(16), count: 1) {\n            $0.setOptInt16 == Int16(16)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptInt32 == %@)\", Int32(32), count: 1) {\n            $0.setOptInt32 == Int32(32)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptInt64 == %@)\", Int64(64), count: 1) {\n            $0.setOptInt64 == Int64(64)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptFloat == %@)\", Float(5.55444333), count: 1) {\n            $0.setOptFloat == Float(5.55444333)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptDouble == %@)\", 123.456, count: 1) {\n            $0.setOptDouble == 123.456\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptString == %@)\", \"Foo\", count: 1) {\n            $0.setOptString == \"Foo\"\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptBinary == %@)\", Data(count: 64), count: 1) {\n            $0.setOptBinary == Data(count: 64)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptDate == %@)\", Date(timeIntervalSince1970: 1000000), count: 1) {\n            $0.setOptDate == Date(timeIntervalSince1970: 1000000)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptDecimal == %@)\", Decimal128(123.456), count: 1) {\n            $0.setOptDecimal == Decimal128(123.456)\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptObjectId == %@)\", ObjectId(\"61184062c1d8f096a3695046\"), count: 1) {\n            $0.setOptObjectId == ObjectId(\"61184062c1d8f096a3695046\")\n        }\n        assertQuery(ModernAllTypesObject.self, \"(ANY setOptUuid == %@)\", UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, count: 1) {\n            $0.setOptUuid == UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setIntOpt == %@)\", EnumInt.value1, count: 1) {\n            $0.setIntOpt == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setInt8Opt == %@)\", EnumInt8.value1, count: 1) {\n            $0.setInt8Opt == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setInt16Opt == %@)\", EnumInt16.value1, count: 1) {\n            $0.setInt16Opt == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setInt32Opt == %@)\", EnumInt32.value1, count: 1) {\n            $0.setInt32Opt == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setInt64Opt == %@)\", EnumInt64.value1, count: 1) {\n            $0.setInt64Opt == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setFloatOpt == %@)\", EnumFloat.value1, count: 1) {\n            $0.setFloatOpt == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setDoubleOpt == %@)\", EnumDouble.value1, count: 1) {\n            $0.setDoubleOpt == .value1\n        }\n        assertQuery(ModernCollectionsOfEnums.self, \"(ANY setStringOpt == %@)\", EnumString.value1, count: 1) {\n            $0.setStringOpt == .value1\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptBool == %@)\", BoolWrapper(persistedValue: true), count: 1) {\n            $0.setOptBool == BoolWrapper(persistedValue: true)\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptInt == %@)\", IntWrapper(persistedValue: 1), count: 1) {\n            $0.setOptInt == IntWrapper(persistedValue: 1)\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptInt8 == %@)\", Int8Wrapper(persistedValue: Int8(8)), count: 1) {\n            $0.setOptInt8 == Int8Wrapper(persistedValue: Int8(8))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptInt16 == %@)\", Int16Wrapper(persistedValue: Int16(16)), count: 1) {\n            $0.setOptInt16 == Int16Wrapper(persistedValue: Int16(16))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptInt32 == %@)\", Int32Wrapper(persistedValue: Int32(32)), count: 1) {\n            $0.setOptInt32 == Int32Wrapper(persistedValue: Int32(32))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptInt64 == %@)\", Int64Wrapper(persistedValue: Int64(64)), count: 1) {\n            $0.setOptInt64 == Int64Wrapper(persistedValue: Int64(64))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptFloat == %@)\", FloatWrapper(persistedValue: Float(5.55444333)), count: 1) {\n            $0.setOptFloat == FloatWrapper(persistedValue: Float(5.55444333))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptDouble == %@)\", DoubleWrapper(persistedValue: 123.456), count: 1) {\n            $0.setOptDouble == DoubleWrapper(persistedValue: 123.456)\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptString == %@)\", StringWrapper(persistedValue: \"Foo\"), count: 1) {\n            $0.setOptString == StringWrapper(persistedValue: \"Foo\")\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptBinary == %@)\", DataWrapper(persistedValue: Data(count: 64)), count: 1) {\n            $0.setOptBinary == DataWrapper(persistedValue: Data(count: 64))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptDate == %@)\", DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), count: 1) {\n            $0.setOptDate == DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptDecimal == %@)\", Decimal128Wrapper(persistedValue: Decimal128(123.456)), count: 1) {\n            $0.setOptDecimal == Decimal128Wrapper(persistedValue: Decimal128(123.456))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptObjectId == %@)\", ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), count: 1) {\n            $0.setOptObjectId == ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\"))\n        }\n        assertQuery(CustomPersistableCollections.self, \"(ANY setOptUuid == %@)\", UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), count: 1) {\n            $0.setOptUuid == UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!)\n        }\n\n        assertQuery(\"(((ANY arrayCol.intCol != %@) && (ANY arrayCol.objectCol.intCol > %@)) && ((ANY setCol.intCol != %@) && (ANY setCol.objectCol.intCol > %@)))\", values: [123, 456, 123, 456], count: 0) {\n            (($0.arrayCol.intCol != 123) && ($0.arrayCol.objectCol.intCol > 456)) && (($0.setCol.intCol != 123) && ($0.setCol.objectCol.intCol > 456))\n        }\n    }\n\n    func testSubquery() {\n        // List\n\n        // Count of results will be 0 because there are no `ModernAllTypesObject`s in the list.\n        assertQuery(\"(SUBQUERY(arrayCol, $col1, ($col1.intCol != %@)).@count > %@)\", values: [123, 0], count: 0) {\n            ($0.arrayCol.intCol != 123).count > 0\n        }\n\n        assertQuery(\"((intCol == %@) && (SUBQUERY(arrayCol, $col1, ($col1.stringCol == %@)).@count == %@))\", values: [5, \"Bar\", 0], count: 0) {\n            $0.intCol == 5 &&\n            ($0.arrayCol.stringCol == \"Bar\").count == 0\n        }\n\n        // Set\n\n        // Will be 0 results because there are no `ModernAllTypesObject`s in the set.\n        assertQuery(\"(SUBQUERY(arrayCol, $col1, ($col1.intCol != %@)).@count > %@)\", values: [123, 0], count: 0) {\n            ($0.arrayCol.intCol != 123).count > 0\n        }\n\n        assertQuery(\"((intCol == %@) && (SUBQUERY(setCol, $col1, ($col1.stringCol == %@)).@count == %@))\", values: [5, \"Bar\", 0], count: 0) {\n            $0.intCol == 5 &&\n            ($0.setCol.stringCol == \"Bar\").count == 0\n        }\n\n        let object = objects().first!\n        try! realm.write {\n            let modernObj = ModernAllTypesObject(value: [\"intCol\": 5, \"stringCol\": \"Foo\"])\n            object.arrayCol.append(modernObj)\n            object.setCol.insert(modernObj)\n        }\n\n        // Results count should now be 1\n        assertQuery(\"(SUBQUERY(arrayCol, $col1, ($col1.arrayInt.@count >= %@)).@count > %@)\", values: [0, 0], count: 1) {\n            ($0.arrayCol.arrayInt.count >= 0).count > 0\n        }\n\n        // Subquery in a subquery\n        assertQuery(\"(SUBQUERY(arrayCol, $col1, (($col1.arrayInt.@count >= %@) && (SUBQUERY(arrayCol, $col2, ($col2.intCol != %@)).@count > %@))).@count > %@)\", values: [0, 123, 0, 0], count: 0) {\n            ($0.arrayCol.arrayInt.count >= 0 && ($0.arrayCol.intCol != 123).count > 0).count > 0\n        }\n\n        assertQuery(\"(SUBQUERY(arrayCol, $col1, ($col1.intCol != %@)).@count > %@)\", values: [123, 0], count: 1) {\n            ($0.arrayCol.intCol != 123).count > 0\n        }\n\n        assertQuery(\"(SUBQUERY(arrayCol, $col1, (($col1.intCol > %@) && ($col1.intCol <= %@))).@count > %@)\", values: [0, 5, 0], count: 1) {\n            ($0.arrayCol.intCol > 0 && $0.arrayCol.intCol <= 5 ).count > 0\n        }\n\n        assertQuery(\"((SUBQUERY(arrayCol, $col1, ($col1.intCol == %@)).@count == %@) && (SUBQUERY(arrayCol, $col2, ($col2.stringCol == %@)).@count == %@))\", values: [5, 1, \"Bar\", 0], count: 1) {\n            ($0.arrayCol.intCol == 5).count == 1 &&\n            ($0.arrayCol.stringCol == \"Bar\").count == 0\n        }\n\n        // Set\n\n        // Will be 0 results because there are no `ModernAllTypesObject`s in the set.\n        assertQuery(\"(SUBQUERY(arrayCol, $col1, ($col1.intCol != %@)).@count > %@)\", values: [123, 0], count: 1) {\n            ($0.arrayCol.intCol != 123).count > 0\n        }\n\n        assertQuery(\"((intCol == %@) && (SUBQUERY(setCol, $col1, ($col1.stringCol == %@)).@count == %@))\", values: [3, \"Bar\", 0], count: 1) {\n            ($0.intCol == 3) &&\n            ($0.setCol.stringCol == \"Bar\").count == 0\n        }\n\n        assertQuery(\"((intCol == %@) && (SUBQUERY(setCol, $col1, (($col1.intCol == %@) && ($col1.stringCol != %@))).@count == %@))\", values: [3, 5, \"Blah\", 1], count: 1) {\n            ($0.intCol == 3) &&\n            (((($0.setCol.intCol == 5) && ($0.setCol.stringCol != \"Blah\"))).count == 1)\n        }\n\n        // Column comparison\n\n        assertQuery(\"(SUBQUERY(arrayCol, $col1, ($col1.stringCol == stringCol)).@count == %@)\", 0, count: 1) {\n            ($0.arrayCol.stringCol == $0.stringCol).count == 0\n        }\n\n        assertThrows(assertQuery(\"\", count: 1) {\n            ($0.stringCol == $0.stringCol).count == 0\n        }, reason: \"Subqueries must contain a keypath starting with a collection.\")\n    }\n\n    // MARK: - Collection Aggregations\n\n    private func validateAverage<Root: Object, T: RealmCollection>(_ name: String, _ average: T.Element, _ min: T.Element, _ lhs: (Query<Root>) -> Query<T>)\n            where T.Element.PersistedType: _QueryNumeric, T.Element: QueryValue {\n        assertQuery(Root.self, \"(object.\\(name).@avg == %@)\", average, count: 1) {\n            lhs($0).avg == average\n        }\n        assertQuery(Root.self, \"(object.\\(name).@avg == %@)\", min, count: 0) {\n            lhs($0).avg == min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@avg != %@)\", average, count: 0) {\n            lhs($0).avg != average\n        }\n        assertQuery(Root.self, \"(object.\\(name).@avg != %@)\", min, count: 1) {\n            lhs($0).avg != min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@avg > %@)\", average, count: 0) {\n            lhs($0).avg > average\n        }\n        assertQuery(Root.self, \"(object.\\(name).@avg > %@)\", min, count: 1) {\n            lhs($0).avg > min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@avg < %@)\", average, count: 0) {\n            lhs($0).avg < average\n        }\n        assertQuery(Root.self, \"(object.\\(name).@avg >= %@)\", average, count: 1) {\n            lhs($0).avg >= average\n        }\n        assertQuery(Root.self, \"(object.\\(name).@avg <= %@)\", average, count: 1) {\n            lhs($0).avg <= average\n        }\n    }\n\n    private func validateAverage<Root: Object, T: RealmKeyedCollection>(_ name: String, _ average: T.Value, _ min: T.Value, _ lhs: (Query<Root>) -> Query<T>)\n            where T.Value.PersistedType: _QueryNumeric, T.Value: QueryValue {\n        assertQuery(Root.self, \"(object.\\(name).@avg == %@)\", average, count: 1) {\n            lhs($0).avg == average\n        }\n        assertQuery(Root.self, \"(object.\\(name).@avg == %@)\", min, count: 0) {\n            lhs($0).avg == min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@avg != %@)\", average, count: 0) {\n            lhs($0).avg != average\n        }\n        assertQuery(Root.self, \"(object.\\(name).@avg != %@)\", min, count: 1) {\n            lhs($0).avg != min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@avg > %@)\", average, count: 0) {\n            lhs($0).avg > average\n        }\n        assertQuery(Root.self, \"(object.\\(name).@avg > %@)\", min, count: 1) {\n            lhs($0).avg > min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@avg < %@)\", average, count: 0) {\n            lhs($0).avg < average\n        }\n        assertQuery(Root.self, \"(object.\\(name).@avg >= %@)\", average, count: 1) {\n            lhs($0).avg >= average\n        }\n        assertQuery(Root.self, \"(object.\\(name).@avg <= %@)\", average, count: 1) {\n            lhs($0).avg <= average\n        }\n    }\n\n    func testCollectionAggregatesAvg() {\n        initLinkedCollectionAggregatesObject()\n\n        validateAverage(\"arrayInt\", Int.average(), 1,\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt)\n        validateAverage(\"arrayInt8\", Int8.average(), Int8(8),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt8)\n        validateAverage(\"arrayInt16\", Int16.average(), Int16(16),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt16)\n        validateAverage(\"arrayInt32\", Int32.average(), Int32(32),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt32)\n        validateAverage(\"arrayInt64\", Int64.average(), Int64(64),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt64)\n        validateAverage(\"arrayFloat\", Float.average(), Float(5.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayFloat)\n        validateAverage(\"arrayDouble\", Double.average(), 123.456,\n                    \\Query<LinkToModernAllTypesObject>.object.arrayDouble)\n        validateAverage(\"arrayDecimal\", Decimal128.average(), Decimal128(123.456),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayDecimal)\n        validateAverage(\"listInt\", EnumInt.average(), EnumInt.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt.rawValue)\n        validateAverage(\"listInt8\", EnumInt8.average(), EnumInt8.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt8.rawValue)\n        validateAverage(\"listInt16\", EnumInt16.average(), EnumInt16.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt16.rawValue)\n        validateAverage(\"listInt32\", EnumInt32.average(), EnumInt32.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt32.rawValue)\n        validateAverage(\"listInt64\", EnumInt64.average(), EnumInt64.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt64.rawValue)\n        validateAverage(\"listDouble\", EnumDouble.average(), EnumDouble.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listDouble.rawValue)\n        validateAverage(\"listInt\", IntWrapper.average(), IntWrapper(persistedValue: 1),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt)\n        validateAverage(\"listInt8\", Int8Wrapper.average(), Int8Wrapper(persistedValue: Int8(8)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt8)\n        validateAverage(\"listInt16\", Int16Wrapper.average(), Int16Wrapper(persistedValue: Int16(16)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt16)\n        validateAverage(\"listInt32\", Int32Wrapper.average(), Int32Wrapper(persistedValue: Int32(32)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt32)\n        validateAverage(\"listInt64\", Int64Wrapper.average(), Int64Wrapper(persistedValue: Int64(64)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt64)\n        validateAverage(\"listFloat\", FloatWrapper.average(), FloatWrapper(persistedValue: Float(5.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listFloat)\n        validateAverage(\"listDouble\", DoubleWrapper.average(), DoubleWrapper(persistedValue: 123.456),\n                    \\Query<LinkToCustomPersistableCollections>.object.listDouble)\n        validateAverage(\"listDecimal\", Decimal128Wrapper.average(), Decimal128Wrapper(persistedValue: Decimal128(123.456)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listDecimal)\n        validateAverage(\"arrayOptInt\", Int?.average(), 1,\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt)\n        validateAverage(\"arrayOptInt8\", Int8?.average(), Int8(8),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt8)\n        validateAverage(\"arrayOptInt16\", Int16?.average(), Int16(16),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt16)\n        validateAverage(\"arrayOptInt32\", Int32?.average(), Int32(32),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt32)\n        validateAverage(\"arrayOptInt64\", Int64?.average(), Int64(64),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt64)\n        validateAverage(\"arrayOptFloat\", Float?.average(), Float(5.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptFloat)\n        validateAverage(\"arrayOptDouble\", Double?.average(), 123.456,\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptDouble)\n        validateAverage(\"arrayOptDecimal\", Decimal128?.average(), Decimal128(123.456),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptDecimal)\n        validateAverage(\"listIntOpt\", EnumInt?.average(), EnumInt.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listIntOpt.rawValue)\n        validateAverage(\"listInt8Opt\", EnumInt8?.average(), EnumInt8.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt8Opt.rawValue)\n        validateAverage(\"listInt16Opt\", EnumInt16?.average(), EnumInt16.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt16Opt.rawValue)\n        validateAverage(\"listInt32Opt\", EnumInt32?.average(), EnumInt32.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt32Opt.rawValue)\n        validateAverage(\"listInt64Opt\", EnumInt64?.average(), EnumInt64.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt64Opt.rawValue)\n        validateAverage(\"listDoubleOpt\", EnumDouble?.average(), EnumDouble.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listDoubleOpt.rawValue)\n        validateAverage(\"listOptInt\", IntWrapper?.average(), IntWrapper(persistedValue: 1),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt)\n        validateAverage(\"listOptInt8\", Int8Wrapper?.average(), Int8Wrapper(persistedValue: Int8(8)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt8)\n        validateAverage(\"listOptInt16\", Int16Wrapper?.average(), Int16Wrapper(persistedValue: Int16(16)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt16)\n        validateAverage(\"listOptInt32\", Int32Wrapper?.average(), Int32Wrapper(persistedValue: Int32(32)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt32)\n        validateAverage(\"listOptInt64\", Int64Wrapper?.average(), Int64Wrapper(persistedValue: Int64(64)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt64)\n        validateAverage(\"listOptFloat\", FloatWrapper?.average(), FloatWrapper(persistedValue: Float(5.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptFloat)\n        validateAverage(\"listOptDouble\", DoubleWrapper?.average(), DoubleWrapper(persistedValue: 123.456),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptDouble)\n        validateAverage(\"listOptDecimal\", Decimal128Wrapper?.average(), Decimal128Wrapper(persistedValue: Decimal128(123.456)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptDecimal)\n        validateAverage(\"setInt\", Int.average(), 1,\n                    \\Query<LinkToModernAllTypesObject>.object.setInt)\n        validateAverage(\"setInt8\", Int8.average(), Int8(8),\n                    \\Query<LinkToModernAllTypesObject>.object.setInt8)\n        validateAverage(\"setInt16\", Int16.average(), Int16(16),\n                    \\Query<LinkToModernAllTypesObject>.object.setInt16)\n        validateAverage(\"setInt32\", Int32.average(), Int32(32),\n                    \\Query<LinkToModernAllTypesObject>.object.setInt32)\n        validateAverage(\"setInt64\", Int64.average(), Int64(64),\n                    \\Query<LinkToModernAllTypesObject>.object.setInt64)\n        validateAverage(\"setFloat\", Float.average(), Float(5.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.setFloat)\n        validateAverage(\"setDouble\", Double.average(), 123.456,\n                    \\Query<LinkToModernAllTypesObject>.object.setDouble)\n        validateAverage(\"setDecimal\", Decimal128.average(), Decimal128(123.456),\n                    \\Query<LinkToModernAllTypesObject>.object.setDecimal)\n        validateAverage(\"setInt\", EnumInt.average(), EnumInt.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt.rawValue)\n        validateAverage(\"setInt8\", EnumInt8.average(), EnumInt8.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt8.rawValue)\n        validateAverage(\"setInt16\", EnumInt16.average(), EnumInt16.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt16.rawValue)\n        validateAverage(\"setInt32\", EnumInt32.average(), EnumInt32.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt32.rawValue)\n        validateAverage(\"setInt64\", EnumInt64.average(), EnumInt64.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt64.rawValue)\n        validateAverage(\"setDouble\", EnumDouble.average(), EnumDouble.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setDouble.rawValue)\n        validateAverage(\"setInt\", IntWrapper.average(), IntWrapper(persistedValue: 1),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt)\n        validateAverage(\"setInt8\", Int8Wrapper.average(), Int8Wrapper(persistedValue: Int8(8)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt8)\n        validateAverage(\"setInt16\", Int16Wrapper.average(), Int16Wrapper(persistedValue: Int16(16)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt16)\n        validateAverage(\"setInt32\", Int32Wrapper.average(), Int32Wrapper(persistedValue: Int32(32)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt32)\n        validateAverage(\"setInt64\", Int64Wrapper.average(), Int64Wrapper(persistedValue: Int64(64)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt64)\n        validateAverage(\"setFloat\", FloatWrapper.average(), FloatWrapper(persistedValue: Float(5.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setFloat)\n        validateAverage(\"setDouble\", DoubleWrapper.average(), DoubleWrapper(persistedValue: 123.456),\n                    \\Query<LinkToCustomPersistableCollections>.object.setDouble)\n        validateAverage(\"setDecimal\", Decimal128Wrapper.average(), Decimal128Wrapper(persistedValue: Decimal128(123.456)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setDecimal)\n        validateAverage(\"setOptInt\", Int?.average(), 1,\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt)\n        validateAverage(\"setOptInt8\", Int8?.average(), Int8(8),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt8)\n        validateAverage(\"setOptInt16\", Int16?.average(), Int16(16),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt16)\n        validateAverage(\"setOptInt32\", Int32?.average(), Int32(32),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt32)\n        validateAverage(\"setOptInt64\", Int64?.average(), Int64(64),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt64)\n        validateAverage(\"setOptFloat\", Float?.average(), Float(5.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptFloat)\n        validateAverage(\"setOptDouble\", Double?.average(), 123.456,\n                    \\Query<LinkToModernAllTypesObject>.object.setOptDouble)\n        validateAverage(\"setOptDecimal\", Decimal128?.average(), Decimal128(123.456),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptDecimal)\n        validateAverage(\"setIntOpt\", EnumInt?.average(), EnumInt.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setIntOpt.rawValue)\n        validateAverage(\"setInt8Opt\", EnumInt8?.average(), EnumInt8.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt8Opt.rawValue)\n        validateAverage(\"setInt16Opt\", EnumInt16?.average(), EnumInt16.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt16Opt.rawValue)\n        validateAverage(\"setInt32Opt\", EnumInt32?.average(), EnumInt32.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt32Opt.rawValue)\n        validateAverage(\"setInt64Opt\", EnumInt64?.average(), EnumInt64.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt64Opt.rawValue)\n        validateAverage(\"setDoubleOpt\", EnumDouble?.average(), EnumDouble.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setDoubleOpt.rawValue)\n        validateAverage(\"setOptInt\", IntWrapper?.average(), IntWrapper(persistedValue: 1),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt)\n        validateAverage(\"setOptInt8\", Int8Wrapper?.average(), Int8Wrapper(persistedValue: Int8(8)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt8)\n        validateAverage(\"setOptInt16\", Int16Wrapper?.average(), Int16Wrapper(persistedValue: Int16(16)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt16)\n        validateAverage(\"setOptInt32\", Int32Wrapper?.average(), Int32Wrapper(persistedValue: Int32(32)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt32)\n        validateAverage(\"setOptInt64\", Int64Wrapper?.average(), Int64Wrapper(persistedValue: Int64(64)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt64)\n        validateAverage(\"setOptFloat\", FloatWrapper?.average(), FloatWrapper(persistedValue: Float(5.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptFloat)\n        validateAverage(\"setOptDouble\", DoubleWrapper?.average(), DoubleWrapper(persistedValue: 123.456),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptDouble)\n        validateAverage(\"setOptDecimal\", Decimal128Wrapper?.average(), Decimal128Wrapper(persistedValue: Decimal128(123.456)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptDecimal)\n        validateAverage(\"mapInt\", Int.average(), 1,\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt)\n        validateAverage(\"mapInt8\", Int8.average(), Int8(8),\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt8)\n        validateAverage(\"mapInt16\", Int16.average(), Int16(16),\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt16)\n        validateAverage(\"mapInt32\", Int32.average(), Int32(32),\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt32)\n        validateAverage(\"mapInt64\", Int64.average(), Int64(64),\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt64)\n        validateAverage(\"mapFloat\", Float.average(), Float(5.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.mapFloat)\n        validateAverage(\"mapDouble\", Double.average(), 123.456,\n                    \\Query<LinkToModernAllTypesObject>.object.mapDouble)\n        validateAverage(\"mapDecimal\", Decimal128.average(), Decimal128(123.456),\n                    \\Query<LinkToModernAllTypesObject>.object.mapDecimal)\n        validateAverage(\"mapInt\", EnumInt.average(), EnumInt.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt.rawValue)\n        validateAverage(\"mapInt8\", EnumInt8.average(), EnumInt8.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt8.rawValue)\n        validateAverage(\"mapInt16\", EnumInt16.average(), EnumInt16.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt16.rawValue)\n        validateAverage(\"mapInt32\", EnumInt32.average(), EnumInt32.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt32.rawValue)\n        validateAverage(\"mapInt64\", EnumInt64.average(), EnumInt64.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt64.rawValue)\n        validateAverage(\"mapDouble\", EnumDouble.average(), EnumDouble.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapDouble.rawValue)\n        validateAverage(\"mapInt\", IntWrapper.average(), IntWrapper(persistedValue: 1),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt)\n        validateAverage(\"mapInt8\", Int8Wrapper.average(), Int8Wrapper(persistedValue: Int8(8)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt8)\n        validateAverage(\"mapInt16\", Int16Wrapper.average(), Int16Wrapper(persistedValue: Int16(16)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt16)\n        validateAverage(\"mapInt32\", Int32Wrapper.average(), Int32Wrapper(persistedValue: Int32(32)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt32)\n        validateAverage(\"mapInt64\", Int64Wrapper.average(), Int64Wrapper(persistedValue: Int64(64)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt64)\n        validateAverage(\"mapFloat\", FloatWrapper.average(), FloatWrapper(persistedValue: Float(5.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapFloat)\n        validateAverage(\"mapDouble\", DoubleWrapper.average(), DoubleWrapper(persistedValue: 123.456),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapDouble)\n        validateAverage(\"mapDecimal\", Decimal128Wrapper.average(), Decimal128Wrapper(persistedValue: Decimal128(123.456)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapDecimal)\n        validateAverage(\"mapOptInt\", Int?.average(), 1,\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt)\n        validateAverage(\"mapOptInt8\", Int8?.average(), Int8(8),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt8)\n        validateAverage(\"mapOptInt16\", Int16?.average(), Int16(16),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt16)\n        validateAverage(\"mapOptInt32\", Int32?.average(), Int32(32),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt32)\n        validateAverage(\"mapOptInt64\", Int64?.average(), Int64(64),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt64)\n        validateAverage(\"mapOptFloat\", Float?.average(), Float(5.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptFloat)\n        validateAverage(\"mapOptDouble\", Double?.average(), 123.456,\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptDouble)\n        validateAverage(\"mapOptDecimal\", Decimal128?.average(), Decimal128(123.456),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptDecimal)\n        validateAverage(\"mapIntOpt\", EnumInt?.average(), EnumInt.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapIntOpt.rawValue)\n        validateAverage(\"mapInt8Opt\", EnumInt8?.average(), EnumInt8.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt8Opt.rawValue)\n        validateAverage(\"mapInt16Opt\", EnumInt16?.average(), EnumInt16.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt16Opt.rawValue)\n        validateAverage(\"mapInt32Opt\", EnumInt32?.average(), EnumInt32.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt32Opt.rawValue)\n        validateAverage(\"mapInt64Opt\", EnumInt64?.average(), EnumInt64.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt64Opt.rawValue)\n        validateAverage(\"mapDoubleOpt\", EnumDouble?.average(), EnumDouble.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapDoubleOpt.rawValue)\n        validateAverage(\"mapOptInt\", IntWrapper?.average(), IntWrapper(persistedValue: 1),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt)\n        validateAverage(\"mapOptInt8\", Int8Wrapper?.average(), Int8Wrapper(persistedValue: Int8(8)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt8)\n        validateAverage(\"mapOptInt16\", Int16Wrapper?.average(), Int16Wrapper(persistedValue: Int16(16)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt16)\n        validateAverage(\"mapOptInt32\", Int32Wrapper?.average(), Int32Wrapper(persistedValue: Int32(32)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt32)\n        validateAverage(\"mapOptInt64\", Int64Wrapper?.average(), Int64Wrapper(persistedValue: Int64(64)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt64)\n        validateAverage(\"mapOptFloat\", FloatWrapper?.average(), FloatWrapper(persistedValue: Float(5.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptFloat)\n        validateAverage(\"mapOptDouble\", DoubleWrapper?.average(), DoubleWrapper(persistedValue: 123.456),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptDouble)\n        validateAverage(\"mapOptDecimal\", Decimal128Wrapper?.average(), Decimal128Wrapper(persistedValue: Decimal128(123.456)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptDecimal)\n    }\n\n    private func validateSum<Root: Object, T: RealmCollection>(_ name: String, _ sum: T.Element, _ min: T.Element, _ lhs: (Query<Root>) -> Query<T>)\n            where T.Element.PersistedType: _QueryNumeric, T.Element: QueryValue {\n        assertQuery(Root.self, \"(object.\\(name).@sum == %@)\", sum, count: 1) {\n            lhs($0).sum == sum\n        }\n        assertQuery(Root.self, \"(object.\\(name).@sum == %@)\", min, count: 0) {\n            lhs($0).sum == min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@sum != %@)\", sum, count: 0) {\n            lhs($0).sum != sum\n        }\n        assertQuery(Root.self, \"(object.\\(name).@sum != %@)\", min, count: 1) {\n            lhs($0).sum != min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@sum > %@)\", sum, count: 0) {\n            lhs($0).sum > sum\n        }\n        assertQuery(Root.self, \"(object.\\(name).@sum > %@)\", min, count: 1) {\n            lhs($0).sum > min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@sum < %@)\", sum, count: 0) {\n            lhs($0).sum < sum\n        }\n        assertQuery(Root.self, \"(object.\\(name).@sum >= %@)\", sum, count: 1) {\n            lhs($0).sum >= sum\n        }\n        assertQuery(Root.self, \"(object.\\(name).@sum <= %@)\", sum, count: 1) {\n            lhs($0).sum <= sum\n        }\n    }\n\n    private func validateSum<Root: Object, T: RealmKeyedCollection>(_ name: String, _ sum: T.Value, _ min: T.Value, _ lhs: (Query<Root>) -> Query<T>)\n            where T.Value.PersistedType: _QueryNumeric, T.Value: QueryValue {\n        assertQuery(Root.self, \"(object.\\(name).@sum == %@)\", sum, count: 1) {\n            lhs($0).sum == sum\n        }\n        assertQuery(Root.self, \"(object.\\(name).@sum == %@)\", min, count: 0) {\n            lhs($0).sum == min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@sum != %@)\", sum, count: 0) {\n            lhs($0).sum != sum\n        }\n        assertQuery(Root.self, \"(object.\\(name).@sum != %@)\", min, count: 1) {\n            lhs($0).sum != min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@sum > %@)\", sum, count: 0) {\n            lhs($0).sum > sum\n        }\n        assertQuery(Root.self, \"(object.\\(name).@sum > %@)\", min, count: 1) {\n            lhs($0).sum > min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@sum < %@)\", sum, count: 0) {\n            lhs($0).sum < sum\n        }\n        assertQuery(Root.self, \"(object.\\(name).@sum >= %@)\", sum, count: 1) {\n            lhs($0).sum >= sum\n        }\n        assertQuery(Root.self, \"(object.\\(name).@sum <= %@)\", sum, count: 1) {\n            lhs($0).sum <= sum\n        }\n    }\n\n    func testCollectionAggregatesSum() {\n        initLinkedCollectionAggregatesObject()\n\n        validateSum(\"arrayInt\", Int.sum(), 1,\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt)\n        validateSum(\"arrayInt8\", Int8.sum(), Int8(8),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt8)\n        validateSum(\"arrayInt16\", Int16.sum(), Int16(16),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt16)\n        validateSum(\"arrayInt32\", Int32.sum(), Int32(32),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt32)\n        validateSum(\"arrayInt64\", Int64.sum(), Int64(64),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt64)\n        validateSum(\"arrayFloat\", Float.sum(), Float(5.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayFloat)\n        validateSum(\"arrayDouble\", Double.sum(), 123.456,\n                    \\Query<LinkToModernAllTypesObject>.object.arrayDouble)\n        validateSum(\"arrayDecimal\", Decimal128.sum(), Decimal128(123.456),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayDecimal)\n        validateSum(\"listInt\", EnumInt.sum(), EnumInt.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt.rawValue)\n        validateSum(\"listInt8\", EnumInt8.sum(), EnumInt8.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt8.rawValue)\n        validateSum(\"listInt16\", EnumInt16.sum(), EnumInt16.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt16.rawValue)\n        validateSum(\"listInt32\", EnumInt32.sum(), EnumInt32.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt32.rawValue)\n        validateSum(\"listInt64\", EnumInt64.sum(), EnumInt64.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt64.rawValue)\n        validateSum(\"listDouble\", EnumDouble.sum(), EnumDouble.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listDouble.rawValue)\n        validateSum(\"listInt\", IntWrapper.sum(), IntWrapper(persistedValue: 1),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt)\n        validateSum(\"listInt8\", Int8Wrapper.sum(), Int8Wrapper(persistedValue: Int8(8)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt8)\n        validateSum(\"listInt16\", Int16Wrapper.sum(), Int16Wrapper(persistedValue: Int16(16)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt16)\n        validateSum(\"listInt32\", Int32Wrapper.sum(), Int32Wrapper(persistedValue: Int32(32)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt32)\n        validateSum(\"listInt64\", Int64Wrapper.sum(), Int64Wrapper(persistedValue: Int64(64)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt64)\n        validateSum(\"listFloat\", FloatWrapper.sum(), FloatWrapper(persistedValue: Float(5.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listFloat)\n        validateSum(\"listDouble\", DoubleWrapper.sum(), DoubleWrapper(persistedValue: 123.456),\n                    \\Query<LinkToCustomPersistableCollections>.object.listDouble)\n        validateSum(\"listDecimal\", Decimal128Wrapper.sum(), Decimal128Wrapper(persistedValue: Decimal128(123.456)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listDecimal)\n        validateSum(\"arrayOptInt\", Int?.sum(), 1,\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt)\n        validateSum(\"arrayOptInt8\", Int8?.sum(), Int8(8),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt8)\n        validateSum(\"arrayOptInt16\", Int16?.sum(), Int16(16),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt16)\n        validateSum(\"arrayOptInt32\", Int32?.sum(), Int32(32),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt32)\n        validateSum(\"arrayOptInt64\", Int64?.sum(), Int64(64),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt64)\n        validateSum(\"arrayOptFloat\", Float?.sum(), Float(5.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptFloat)\n        validateSum(\"arrayOptDouble\", Double?.sum(), 123.456,\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptDouble)\n        validateSum(\"arrayOptDecimal\", Decimal128?.sum(), Decimal128(123.456),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptDecimal)\n        validateSum(\"listIntOpt\", EnumInt?.sum(), EnumInt.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listIntOpt.rawValue)\n        validateSum(\"listInt8Opt\", EnumInt8?.sum(), EnumInt8.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt8Opt.rawValue)\n        validateSum(\"listInt16Opt\", EnumInt16?.sum(), EnumInt16.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt16Opt.rawValue)\n        validateSum(\"listInt32Opt\", EnumInt32?.sum(), EnumInt32.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt32Opt.rawValue)\n        validateSum(\"listInt64Opt\", EnumInt64?.sum(), EnumInt64.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt64Opt.rawValue)\n        validateSum(\"listDoubleOpt\", EnumDouble?.sum(), EnumDouble.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listDoubleOpt.rawValue)\n        validateSum(\"listOptInt\", IntWrapper?.sum(), IntWrapper(persistedValue: 1),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt)\n        validateSum(\"listOptInt8\", Int8Wrapper?.sum(), Int8Wrapper(persistedValue: Int8(8)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt8)\n        validateSum(\"listOptInt16\", Int16Wrapper?.sum(), Int16Wrapper(persistedValue: Int16(16)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt16)\n        validateSum(\"listOptInt32\", Int32Wrapper?.sum(), Int32Wrapper(persistedValue: Int32(32)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt32)\n        validateSum(\"listOptInt64\", Int64Wrapper?.sum(), Int64Wrapper(persistedValue: Int64(64)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt64)\n        validateSum(\"listOptFloat\", FloatWrapper?.sum(), FloatWrapper(persistedValue: Float(5.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptFloat)\n        validateSum(\"listOptDouble\", DoubleWrapper?.sum(), DoubleWrapper(persistedValue: 123.456),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptDouble)\n        validateSum(\"listOptDecimal\", Decimal128Wrapper?.sum(), Decimal128Wrapper(persistedValue: Decimal128(123.456)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptDecimal)\n        validateSum(\"setInt\", Int.sum(), 1,\n                    \\Query<LinkToModernAllTypesObject>.object.setInt)\n        validateSum(\"setInt8\", Int8.sum(), Int8(8),\n                    \\Query<LinkToModernAllTypesObject>.object.setInt8)\n        validateSum(\"setInt16\", Int16.sum(), Int16(16),\n                    \\Query<LinkToModernAllTypesObject>.object.setInt16)\n        validateSum(\"setInt32\", Int32.sum(), Int32(32),\n                    \\Query<LinkToModernAllTypesObject>.object.setInt32)\n        validateSum(\"setInt64\", Int64.sum(), Int64(64),\n                    \\Query<LinkToModernAllTypesObject>.object.setInt64)\n        validateSum(\"setFloat\", Float.sum(), Float(5.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.setFloat)\n        validateSum(\"setDouble\", Double.sum(), 123.456,\n                    \\Query<LinkToModernAllTypesObject>.object.setDouble)\n        validateSum(\"setDecimal\", Decimal128.sum(), Decimal128(123.456),\n                    \\Query<LinkToModernAllTypesObject>.object.setDecimal)\n        validateSum(\"setInt\", EnumInt.sum(), EnumInt.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt.rawValue)\n        validateSum(\"setInt8\", EnumInt8.sum(), EnumInt8.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt8.rawValue)\n        validateSum(\"setInt16\", EnumInt16.sum(), EnumInt16.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt16.rawValue)\n        validateSum(\"setInt32\", EnumInt32.sum(), EnumInt32.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt32.rawValue)\n        validateSum(\"setInt64\", EnumInt64.sum(), EnumInt64.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt64.rawValue)\n        validateSum(\"setDouble\", EnumDouble.sum(), EnumDouble.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setDouble.rawValue)\n        validateSum(\"setInt\", IntWrapper.sum(), IntWrapper(persistedValue: 1),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt)\n        validateSum(\"setInt8\", Int8Wrapper.sum(), Int8Wrapper(persistedValue: Int8(8)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt8)\n        validateSum(\"setInt16\", Int16Wrapper.sum(), Int16Wrapper(persistedValue: Int16(16)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt16)\n        validateSum(\"setInt32\", Int32Wrapper.sum(), Int32Wrapper(persistedValue: Int32(32)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt32)\n        validateSum(\"setInt64\", Int64Wrapper.sum(), Int64Wrapper(persistedValue: Int64(64)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt64)\n        validateSum(\"setFloat\", FloatWrapper.sum(), FloatWrapper(persistedValue: Float(5.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setFloat)\n        validateSum(\"setDouble\", DoubleWrapper.sum(), DoubleWrapper(persistedValue: 123.456),\n                    \\Query<LinkToCustomPersistableCollections>.object.setDouble)\n        validateSum(\"setDecimal\", Decimal128Wrapper.sum(), Decimal128Wrapper(persistedValue: Decimal128(123.456)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setDecimal)\n        validateSum(\"setOptInt\", Int?.sum(), 1,\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt)\n        validateSum(\"setOptInt8\", Int8?.sum(), Int8(8),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt8)\n        validateSum(\"setOptInt16\", Int16?.sum(), Int16(16),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt16)\n        validateSum(\"setOptInt32\", Int32?.sum(), Int32(32),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt32)\n        validateSum(\"setOptInt64\", Int64?.sum(), Int64(64),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt64)\n        validateSum(\"setOptFloat\", Float?.sum(), Float(5.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptFloat)\n        validateSum(\"setOptDouble\", Double?.sum(), 123.456,\n                    \\Query<LinkToModernAllTypesObject>.object.setOptDouble)\n        validateSum(\"setOptDecimal\", Decimal128?.sum(), Decimal128(123.456),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptDecimal)\n        validateSum(\"setIntOpt\", EnumInt?.sum(), EnumInt.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setIntOpt.rawValue)\n        validateSum(\"setInt8Opt\", EnumInt8?.sum(), EnumInt8.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt8Opt.rawValue)\n        validateSum(\"setInt16Opt\", EnumInt16?.sum(), EnumInt16.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt16Opt.rawValue)\n        validateSum(\"setInt32Opt\", EnumInt32?.sum(), EnumInt32.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt32Opt.rawValue)\n        validateSum(\"setInt64Opt\", EnumInt64?.sum(), EnumInt64.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt64Opt.rawValue)\n        validateSum(\"setDoubleOpt\", EnumDouble?.sum(), EnumDouble.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setDoubleOpt.rawValue)\n        validateSum(\"setOptInt\", IntWrapper?.sum(), IntWrapper(persistedValue: 1),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt)\n        validateSum(\"setOptInt8\", Int8Wrapper?.sum(), Int8Wrapper(persistedValue: Int8(8)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt8)\n        validateSum(\"setOptInt16\", Int16Wrapper?.sum(), Int16Wrapper(persistedValue: Int16(16)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt16)\n        validateSum(\"setOptInt32\", Int32Wrapper?.sum(), Int32Wrapper(persistedValue: Int32(32)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt32)\n        validateSum(\"setOptInt64\", Int64Wrapper?.sum(), Int64Wrapper(persistedValue: Int64(64)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt64)\n        validateSum(\"setOptFloat\", FloatWrapper?.sum(), FloatWrapper(persistedValue: Float(5.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptFloat)\n        validateSum(\"setOptDouble\", DoubleWrapper?.sum(), DoubleWrapper(persistedValue: 123.456),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptDouble)\n        validateSum(\"setOptDecimal\", Decimal128Wrapper?.sum(), Decimal128Wrapper(persistedValue: Decimal128(123.456)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptDecimal)\n        validateSum(\"mapInt\", Int.sum(), 1,\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt)\n        validateSum(\"mapInt8\", Int8.sum(), Int8(8),\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt8)\n        validateSum(\"mapInt16\", Int16.sum(), Int16(16),\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt16)\n        validateSum(\"mapInt32\", Int32.sum(), Int32(32),\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt32)\n        validateSum(\"mapInt64\", Int64.sum(), Int64(64),\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt64)\n        validateSum(\"mapFloat\", Float.sum(), Float(5.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.mapFloat)\n        validateSum(\"mapDouble\", Double.sum(), 123.456,\n                    \\Query<LinkToModernAllTypesObject>.object.mapDouble)\n        validateSum(\"mapDecimal\", Decimal128.sum(), Decimal128(123.456),\n                    \\Query<LinkToModernAllTypesObject>.object.mapDecimal)\n        validateSum(\"mapInt\", EnumInt.sum(), EnumInt.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt.rawValue)\n        validateSum(\"mapInt8\", EnumInt8.sum(), EnumInt8.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt8.rawValue)\n        validateSum(\"mapInt16\", EnumInt16.sum(), EnumInt16.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt16.rawValue)\n        validateSum(\"mapInt32\", EnumInt32.sum(), EnumInt32.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt32.rawValue)\n        validateSum(\"mapInt64\", EnumInt64.sum(), EnumInt64.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt64.rawValue)\n        validateSum(\"mapDouble\", EnumDouble.sum(), EnumDouble.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapDouble.rawValue)\n        validateSum(\"mapInt\", IntWrapper.sum(), IntWrapper(persistedValue: 1),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt)\n        validateSum(\"mapInt8\", Int8Wrapper.sum(), Int8Wrapper(persistedValue: Int8(8)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt8)\n        validateSum(\"mapInt16\", Int16Wrapper.sum(), Int16Wrapper(persistedValue: Int16(16)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt16)\n        validateSum(\"mapInt32\", Int32Wrapper.sum(), Int32Wrapper(persistedValue: Int32(32)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt32)\n        validateSum(\"mapInt64\", Int64Wrapper.sum(), Int64Wrapper(persistedValue: Int64(64)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt64)\n        validateSum(\"mapFloat\", FloatWrapper.sum(), FloatWrapper(persistedValue: Float(5.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapFloat)\n        validateSum(\"mapDouble\", DoubleWrapper.sum(), DoubleWrapper(persistedValue: 123.456),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapDouble)\n        validateSum(\"mapDecimal\", Decimal128Wrapper.sum(), Decimal128Wrapper(persistedValue: Decimal128(123.456)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapDecimal)\n        validateSum(\"mapOptInt\", Int?.sum(), 1,\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt)\n        validateSum(\"mapOptInt8\", Int8?.sum(), Int8(8),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt8)\n        validateSum(\"mapOptInt16\", Int16?.sum(), Int16(16),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt16)\n        validateSum(\"mapOptInt32\", Int32?.sum(), Int32(32),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt32)\n        validateSum(\"mapOptInt64\", Int64?.sum(), Int64(64),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt64)\n        validateSum(\"mapOptFloat\", Float?.sum(), Float(5.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptFloat)\n        validateSum(\"mapOptDouble\", Double?.sum(), 123.456,\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptDouble)\n        validateSum(\"mapOptDecimal\", Decimal128?.sum(), Decimal128(123.456),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptDecimal)\n        validateSum(\"mapIntOpt\", EnumInt?.sum(), EnumInt.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapIntOpt.rawValue)\n        validateSum(\"mapInt8Opt\", EnumInt8?.sum(), EnumInt8.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt8Opt.rawValue)\n        validateSum(\"mapInt16Opt\", EnumInt16?.sum(), EnumInt16.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt16Opt.rawValue)\n        validateSum(\"mapInt32Opt\", EnumInt32?.sum(), EnumInt32.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt32Opt.rawValue)\n        validateSum(\"mapInt64Opt\", EnumInt64?.sum(), EnumInt64.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt64Opt.rawValue)\n        validateSum(\"mapDoubleOpt\", EnumDouble?.sum(), EnumDouble.value1.rawValue,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapDoubleOpt.rawValue)\n        validateSum(\"mapOptInt\", IntWrapper?.sum(), IntWrapper(persistedValue: 1),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt)\n        validateSum(\"mapOptInt8\", Int8Wrapper?.sum(), Int8Wrapper(persistedValue: Int8(8)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt8)\n        validateSum(\"mapOptInt16\", Int16Wrapper?.sum(), Int16Wrapper(persistedValue: Int16(16)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt16)\n        validateSum(\"mapOptInt32\", Int32Wrapper?.sum(), Int32Wrapper(persistedValue: Int32(32)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt32)\n        validateSum(\"mapOptInt64\", Int64Wrapper?.sum(), Int64Wrapper(persistedValue: Int64(64)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt64)\n        validateSum(\"mapOptFloat\", FloatWrapper?.sum(), FloatWrapper(persistedValue: Float(5.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptFloat)\n        validateSum(\"mapOptDouble\", DoubleWrapper?.sum(), DoubleWrapper(persistedValue: 123.456),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptDouble)\n        validateSum(\"mapOptDecimal\", Decimal128Wrapper?.sum(), Decimal128Wrapper(persistedValue: Decimal128(123.456)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptDecimal)\n    }\n\n\n    private func validateMin<Root: Object, T: RealmCollection>(_ name: String, min: T.Element, max: T.Element, _ lhs: (Query<Root>) -> Query<T>)\n            where T.Element.PersistedType: _QueryNumeric, T.Element: QueryValue {\n        assertQuery(Root.self, \"(object.\\(name).@min == %@)\", min, count: 1) {\n            lhs($0).min == min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@min == %@)\", max, count: 0) {\n            lhs($0).min == max\n        }\n        assertQuery(Root.self, \"(object.\\(name).@min != %@)\", min, count: 0) {\n            lhs($0).min != min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@min != %@)\", max, count: 1) {\n            lhs($0).min != max\n        }\n        assertQuery(Root.self, \"(object.\\(name).@min > %@)\", min, count: 0) {\n            lhs($0).min > min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@min < %@)\", min, count: 0) {\n            lhs($0).min < min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@min >= %@)\", min, count: 1) {\n            lhs($0).min >= min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@min <= %@)\", min, count: 1) {\n            lhs($0).min <= min\n        }\n    }\n\n    private func validateMin<Root: Object, T: RealmKeyedCollection>(_ name: String, min: T.Value, max: T.Value, _ lhs: (Query<Root>) -> Query<T>)\n            where T.Value.PersistedType: _QueryNumeric, T.Value: QueryValue {\n        assertQuery(Root.self, \"(object.\\(name).@min == %@)\", min, count: 1) {\n            lhs($0).min == min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@min == %@)\", max, count: 0) {\n            lhs($0).min == max\n        }\n        assertQuery(Root.self, \"(object.\\(name).@min != %@)\", min, count: 0) {\n            lhs($0).min != min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@min != %@)\", max, count: 1) {\n            lhs($0).min != max\n        }\n        assertQuery(Root.self, \"(object.\\(name).@min > %@)\", min, count: 0) {\n            lhs($0).min > min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@min < %@)\", min, count: 0) {\n            lhs($0).min < min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@min >= %@)\", min, count: 1) {\n            lhs($0).min >= min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@min <= %@)\", min, count: 1) {\n            lhs($0).min <= min\n        }\n    }\n\n    func testCollectionAggregatesMin() {\n        initLinkedCollectionAggregatesObject()\n\n        validateMin(\"arrayInt\", min: 1, max: 5,\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt)\n        validateMin(\"arrayInt8\", min: Int8(8), max: Int8(10),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt8)\n        validateMin(\"arrayInt16\", min: Int16(16), max: Int16(18),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt16)\n        validateMin(\"arrayInt32\", min: Int32(32), max: Int32(34),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt32)\n        validateMin(\"arrayInt64\", min: Int64(64), max: Int64(66),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt64)\n        validateMin(\"arrayFloat\", min: Float(5.55444333), max: Float(7.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayFloat)\n        validateMin(\"arrayDouble\", min: 123.456, max: 345.678,\n                    \\Query<LinkToModernAllTypesObject>.object.arrayDouble)\n        validateMin(\"arrayDecimal\", min: Decimal128(123.456), max: Decimal128(345.678),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayDecimal)\n        validateMin(\"listInt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt)\n        validateMin(\"listInt8\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt8)\n        validateMin(\"listInt16\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt16)\n        validateMin(\"listInt32\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt32)\n        validateMin(\"listInt64\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt64)\n        validateMin(\"listDouble\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listDouble)\n        validateMin(\"listInt\", min: IntWrapper(persistedValue: 1), max: IntWrapper(persistedValue: 5),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt)\n        validateMin(\"listInt8\", min: Int8Wrapper(persistedValue: Int8(8)), max: Int8Wrapper(persistedValue: Int8(10)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt8)\n        validateMin(\"listInt16\", min: Int16Wrapper(persistedValue: Int16(16)), max: Int16Wrapper(persistedValue: Int16(18)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt16)\n        validateMin(\"listInt32\", min: Int32Wrapper(persistedValue: Int32(32)), max: Int32Wrapper(persistedValue: Int32(34)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt32)\n        validateMin(\"listInt64\", min: Int64Wrapper(persistedValue: Int64(64)), max: Int64Wrapper(persistedValue: Int64(66)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt64)\n        validateMin(\"listFloat\", min: FloatWrapper(persistedValue: Float(5.55444333)), max: FloatWrapper(persistedValue: Float(7.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listFloat)\n        validateMin(\"listDouble\", min: DoubleWrapper(persistedValue: 123.456), max: DoubleWrapper(persistedValue: 345.678),\n                    \\Query<LinkToCustomPersistableCollections>.object.listDouble)\n        validateMin(\"listDecimal\", min: Decimal128Wrapper(persistedValue: Decimal128(123.456)), max: Decimal128Wrapper(persistedValue: Decimal128(345.678)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listDecimal)\n        validateMin(\"arrayOptInt\", min: 1, max: 5,\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt)\n        validateMin(\"arrayOptInt8\", min: Int8(8), max: Int8(10),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt8)\n        validateMin(\"arrayOptInt16\", min: Int16(16), max: Int16(18),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt16)\n        validateMin(\"arrayOptInt32\", min: Int32(32), max: Int32(34),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt32)\n        validateMin(\"arrayOptInt64\", min: Int64(64), max: Int64(66),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt64)\n        validateMin(\"arrayOptFloat\", min: Float(5.55444333), max: Float(7.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptFloat)\n        validateMin(\"arrayOptDouble\", min: 123.456, max: 345.678,\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptDouble)\n        validateMin(\"arrayOptDecimal\", min: Decimal128(123.456), max: Decimal128(345.678),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptDecimal)\n        validateMin(\"listIntOpt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listIntOpt)\n        validateMin(\"listInt8Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt8Opt)\n        validateMin(\"listInt16Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt16Opt)\n        validateMin(\"listInt32Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt32Opt)\n        validateMin(\"listInt64Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt64Opt)\n        validateMin(\"listDoubleOpt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listDoubleOpt)\n        validateMin(\"listOptInt\", min: IntWrapper(persistedValue: 1), max: IntWrapper(persistedValue: 5),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt)\n        validateMin(\"listOptInt8\", min: Int8Wrapper(persistedValue: Int8(8)), max: Int8Wrapper(persistedValue: Int8(10)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt8)\n        validateMin(\"listOptInt16\", min: Int16Wrapper(persistedValue: Int16(16)), max: Int16Wrapper(persistedValue: Int16(18)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt16)\n        validateMin(\"listOptInt32\", min: Int32Wrapper(persistedValue: Int32(32)), max: Int32Wrapper(persistedValue: Int32(34)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt32)\n        validateMin(\"listOptInt64\", min: Int64Wrapper(persistedValue: Int64(64)), max: Int64Wrapper(persistedValue: Int64(66)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt64)\n        validateMin(\"listOptFloat\", min: FloatWrapper(persistedValue: Float(5.55444333)), max: FloatWrapper(persistedValue: Float(7.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptFloat)\n        validateMin(\"listOptDouble\", min: DoubleWrapper(persistedValue: 123.456), max: DoubleWrapper(persistedValue: 345.678),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptDouble)\n        validateMin(\"listOptDecimal\", min: Decimal128Wrapper(persistedValue: Decimal128(123.456)), max: Decimal128Wrapper(persistedValue: Decimal128(345.678)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptDecimal)\n        validateMin(\"setInt\", min: 1, max: 5,\n                    \\Query<LinkToModernAllTypesObject>.object.setInt)\n        validateMin(\"setInt8\", min: Int8(8), max: Int8(10),\n                    \\Query<LinkToModernAllTypesObject>.object.setInt8)\n        validateMin(\"setInt16\", min: Int16(16), max: Int16(18),\n                    \\Query<LinkToModernAllTypesObject>.object.setInt16)\n        validateMin(\"setInt32\", min: Int32(32), max: Int32(34),\n                    \\Query<LinkToModernAllTypesObject>.object.setInt32)\n        validateMin(\"setInt64\", min: Int64(64), max: Int64(66),\n                    \\Query<LinkToModernAllTypesObject>.object.setInt64)\n        validateMin(\"setFloat\", min: Float(5.55444333), max: Float(7.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.setFloat)\n        validateMin(\"setDouble\", min: 123.456, max: 345.678,\n                    \\Query<LinkToModernAllTypesObject>.object.setDouble)\n        validateMin(\"setDecimal\", min: Decimal128(123.456), max: Decimal128(345.678),\n                    \\Query<LinkToModernAllTypesObject>.object.setDecimal)\n        validateMin(\"setInt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt)\n        validateMin(\"setInt8\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt8)\n        validateMin(\"setInt16\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt16)\n        validateMin(\"setInt32\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt32)\n        validateMin(\"setInt64\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt64)\n        validateMin(\"setDouble\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setDouble)\n        validateMin(\"setInt\", min: IntWrapper(persistedValue: 1), max: IntWrapper(persistedValue: 5),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt)\n        validateMin(\"setInt8\", min: Int8Wrapper(persistedValue: Int8(8)), max: Int8Wrapper(persistedValue: Int8(10)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt8)\n        validateMin(\"setInt16\", min: Int16Wrapper(persistedValue: Int16(16)), max: Int16Wrapper(persistedValue: Int16(18)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt16)\n        validateMin(\"setInt32\", min: Int32Wrapper(persistedValue: Int32(32)), max: Int32Wrapper(persistedValue: Int32(34)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt32)\n        validateMin(\"setInt64\", min: Int64Wrapper(persistedValue: Int64(64)), max: Int64Wrapper(persistedValue: Int64(66)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt64)\n        validateMin(\"setFloat\", min: FloatWrapper(persistedValue: Float(5.55444333)), max: FloatWrapper(persistedValue: Float(7.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setFloat)\n        validateMin(\"setDouble\", min: DoubleWrapper(persistedValue: 123.456), max: DoubleWrapper(persistedValue: 345.678),\n                    \\Query<LinkToCustomPersistableCollections>.object.setDouble)\n        validateMin(\"setDecimal\", min: Decimal128Wrapper(persistedValue: Decimal128(123.456)), max: Decimal128Wrapper(persistedValue: Decimal128(345.678)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setDecimal)\n        validateMin(\"setOptInt\", min: 1, max: 5,\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt)\n        validateMin(\"setOptInt8\", min: Int8(8), max: Int8(10),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt8)\n        validateMin(\"setOptInt16\", min: Int16(16), max: Int16(18),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt16)\n        validateMin(\"setOptInt32\", min: Int32(32), max: Int32(34),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt32)\n        validateMin(\"setOptInt64\", min: Int64(64), max: Int64(66),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt64)\n        validateMin(\"setOptFloat\", min: Float(5.55444333), max: Float(7.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptFloat)\n        validateMin(\"setOptDouble\", min: 123.456, max: 345.678,\n                    \\Query<LinkToModernAllTypesObject>.object.setOptDouble)\n        validateMin(\"setOptDecimal\", min: Decimal128(123.456), max: Decimal128(345.678),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptDecimal)\n        validateMin(\"setIntOpt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setIntOpt)\n        validateMin(\"setInt8Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt8Opt)\n        validateMin(\"setInt16Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt16Opt)\n        validateMin(\"setInt32Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt32Opt)\n        validateMin(\"setInt64Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt64Opt)\n        validateMin(\"setDoubleOpt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setDoubleOpt)\n        validateMin(\"setOptInt\", min: IntWrapper(persistedValue: 1), max: IntWrapper(persistedValue: 5),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt)\n        validateMin(\"setOptInt8\", min: Int8Wrapper(persistedValue: Int8(8)), max: Int8Wrapper(persistedValue: Int8(10)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt8)\n        validateMin(\"setOptInt16\", min: Int16Wrapper(persistedValue: Int16(16)), max: Int16Wrapper(persistedValue: Int16(18)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt16)\n        validateMin(\"setOptInt32\", min: Int32Wrapper(persistedValue: Int32(32)), max: Int32Wrapper(persistedValue: Int32(34)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt32)\n        validateMin(\"setOptInt64\", min: Int64Wrapper(persistedValue: Int64(64)), max: Int64Wrapper(persistedValue: Int64(66)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt64)\n        validateMin(\"setOptFloat\", min: FloatWrapper(persistedValue: Float(5.55444333)), max: FloatWrapper(persistedValue: Float(7.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptFloat)\n        validateMin(\"setOptDouble\", min: DoubleWrapper(persistedValue: 123.456), max: DoubleWrapper(persistedValue: 345.678),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptDouble)\n        validateMin(\"setOptDecimal\", min: Decimal128Wrapper(persistedValue: Decimal128(123.456)), max: Decimal128Wrapper(persistedValue: Decimal128(345.678)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptDecimal)\n        validateMin(\"mapInt\", min: 1, max: 5,\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt)\n        validateMin(\"mapInt8\", min: Int8(8), max: Int8(10),\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt8)\n        validateMin(\"mapInt16\", min: Int16(16), max: Int16(18),\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt16)\n        validateMin(\"mapInt32\", min: Int32(32), max: Int32(34),\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt32)\n        validateMin(\"mapInt64\", min: Int64(64), max: Int64(66),\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt64)\n        validateMin(\"mapFloat\", min: Float(5.55444333), max: Float(7.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.mapFloat)\n        validateMin(\"mapDouble\", min: 123.456, max: 345.678,\n                    \\Query<LinkToModernAllTypesObject>.object.mapDouble)\n        validateMin(\"mapDecimal\", min: Decimal128(123.456), max: Decimal128(345.678),\n                    \\Query<LinkToModernAllTypesObject>.object.mapDecimal)\n        validateMin(\"mapInt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt)\n        validateMin(\"mapInt8\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt8)\n        validateMin(\"mapInt16\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt16)\n        validateMin(\"mapInt32\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt32)\n        validateMin(\"mapInt64\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt64)\n        validateMin(\"mapDouble\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapDouble)\n        validateMin(\"mapInt\", min: IntWrapper(persistedValue: 1), max: IntWrapper(persistedValue: 5),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt)\n        validateMin(\"mapInt8\", min: Int8Wrapper(persistedValue: Int8(8)), max: Int8Wrapper(persistedValue: Int8(10)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt8)\n        validateMin(\"mapInt16\", min: Int16Wrapper(persistedValue: Int16(16)), max: Int16Wrapper(persistedValue: Int16(18)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt16)\n        validateMin(\"mapInt32\", min: Int32Wrapper(persistedValue: Int32(32)), max: Int32Wrapper(persistedValue: Int32(34)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt32)\n        validateMin(\"mapInt64\", min: Int64Wrapper(persistedValue: Int64(64)), max: Int64Wrapper(persistedValue: Int64(66)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt64)\n        validateMin(\"mapFloat\", min: FloatWrapper(persistedValue: Float(5.55444333)), max: FloatWrapper(persistedValue: Float(7.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapFloat)\n        validateMin(\"mapDouble\", min: DoubleWrapper(persistedValue: 123.456), max: DoubleWrapper(persistedValue: 345.678),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapDouble)\n        validateMin(\"mapDecimal\", min: Decimal128Wrapper(persistedValue: Decimal128(123.456)), max: Decimal128Wrapper(persistedValue: Decimal128(345.678)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapDecimal)\n        validateMin(\"mapOptInt\", min: 1, max: 5,\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt)\n        validateMin(\"mapOptInt8\", min: Int8(8), max: Int8(10),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt8)\n        validateMin(\"mapOptInt16\", min: Int16(16), max: Int16(18),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt16)\n        validateMin(\"mapOptInt32\", min: Int32(32), max: Int32(34),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt32)\n        validateMin(\"mapOptInt64\", min: Int64(64), max: Int64(66),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt64)\n        validateMin(\"mapOptFloat\", min: Float(5.55444333), max: Float(7.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptFloat)\n        validateMin(\"mapOptDouble\", min: 123.456, max: 345.678,\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptDouble)\n        validateMin(\"mapOptDecimal\", min: Decimal128(123.456), max: Decimal128(345.678),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptDecimal)\n        validateMin(\"mapIntOpt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapIntOpt)\n        validateMin(\"mapInt8Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt8Opt)\n        validateMin(\"mapInt16Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt16Opt)\n        validateMin(\"mapInt32Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt32Opt)\n        validateMin(\"mapInt64Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt64Opt)\n        validateMin(\"mapDoubleOpt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapDoubleOpt)\n        validateMin(\"mapOptInt\", min: IntWrapper(persistedValue: 1), max: IntWrapper(persistedValue: 5),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt)\n        validateMin(\"mapOptInt8\", min: Int8Wrapper(persistedValue: Int8(8)), max: Int8Wrapper(persistedValue: Int8(10)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt8)\n        validateMin(\"mapOptInt16\", min: Int16Wrapper(persistedValue: Int16(16)), max: Int16Wrapper(persistedValue: Int16(18)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt16)\n        validateMin(\"mapOptInt32\", min: Int32Wrapper(persistedValue: Int32(32)), max: Int32Wrapper(persistedValue: Int32(34)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt32)\n        validateMin(\"mapOptInt64\", min: Int64Wrapper(persistedValue: Int64(64)), max: Int64Wrapper(persistedValue: Int64(66)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt64)\n        validateMin(\"mapOptFloat\", min: FloatWrapper(persistedValue: Float(5.55444333)), max: FloatWrapper(persistedValue: Float(7.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptFloat)\n        validateMin(\"mapOptDouble\", min: DoubleWrapper(persistedValue: 123.456), max: DoubleWrapper(persistedValue: 345.678),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptDouble)\n        validateMin(\"mapOptDecimal\", min: Decimal128Wrapper(persistedValue: Decimal128(123.456)), max: Decimal128Wrapper(persistedValue: Decimal128(345.678)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptDecimal)\n    }\n\n    private func validateMax<Root: Object, T: RealmCollection>(_ name: String, min: T.Element, max: T.Element, _ lhs: (Query<Root>) -> Query<T>)\n            where T.Element.PersistedType: _QueryNumeric, T.Element: QueryValue {\n        assertQuery(Root.self, \"(object.\\(name).@max == %@)\", max, count: 1) {\n            lhs($0).max == max\n        }\n        assertQuery(Root.self, \"(object.\\(name).@max == %@)\", min, count: 0) {\n            lhs($0).max == min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@max != %@)\", max, count: 0) {\n            lhs($0).max != max\n        }\n        assertQuery(Root.self, \"(object.\\(name).@max != %@)\", min, count: 1) {\n            lhs($0).max != min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@max > %@)\", max, count: 0) {\n            lhs($0).max > max\n        }\n        assertQuery(Root.self, \"(object.\\(name).@max < %@)\", max, count: 0) {\n            lhs($0).max < max\n        }\n        assertQuery(Root.self, \"(object.\\(name).@max >= %@)\", max, count: 1) {\n            lhs($0).max >= max\n        }\n        assertQuery(Root.self, \"(object.\\(name).@max <= %@)\", max, count: 1) {\n            lhs($0).max <= max\n        }\n    }\n\n    private func validateMax<Root: Object, T: RealmKeyedCollection>(_ name: String, min: T.Value, max: T.Value, _ lhs: (Query<Root>) -> Query<T>)\n            where T.Value.PersistedType: _QueryNumeric, T.Value: QueryValue {\n        assertQuery(Root.self, \"(object.\\(name).@max == %@)\", max, count: 1) {\n            lhs($0).max == max\n        }\n        assertQuery(Root.self, \"(object.\\(name).@max == %@)\", min, count: 0) {\n            lhs($0).max == min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@max != %@)\", max, count: 0) {\n            lhs($0).max != max\n        }\n        assertQuery(Root.self, \"(object.\\(name).@max != %@)\", min, count: 1) {\n            lhs($0).max != min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@max > %@)\", max, count: 0) {\n            lhs($0).max > max\n        }\n        assertQuery(Root.self, \"(object.\\(name).@max < %@)\", max, count: 0) {\n            lhs($0).max < max\n        }\n        assertQuery(Root.self, \"(object.\\(name).@max >= %@)\", max, count: 1) {\n            lhs($0).max >= max\n        }\n        assertQuery(Root.self, \"(object.\\(name).@max <= %@)\", max, count: 1) {\n            lhs($0).max <= max\n        }\n    }\n\n    func testCollectionAggregatesMax() {\n        initLinkedCollectionAggregatesObject()\n\n        validateMax(\"arrayInt\", min: 1, max: 5,\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt)\n        validateMax(\"arrayInt8\", min: Int8(8), max: Int8(10),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt8)\n        validateMax(\"arrayInt16\", min: Int16(16), max: Int16(18),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt16)\n        validateMax(\"arrayInt32\", min: Int32(32), max: Int32(34),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt32)\n        validateMax(\"arrayInt64\", min: Int64(64), max: Int64(66),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayInt64)\n        validateMax(\"arrayFloat\", min: Float(5.55444333), max: Float(7.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayFloat)\n        validateMax(\"arrayDouble\", min: 123.456, max: 345.678,\n                    \\Query<LinkToModernAllTypesObject>.object.arrayDouble)\n        validateMax(\"arrayDecimal\", min: Decimal128(123.456), max: Decimal128(345.678),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayDecimal)\n        validateMax(\"listInt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt)\n        validateMax(\"listInt8\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt8)\n        validateMax(\"listInt16\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt16)\n        validateMax(\"listInt32\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt32)\n        validateMax(\"listInt64\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt64)\n        validateMax(\"listDouble\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listDouble)\n        validateMax(\"listInt\", min: IntWrapper(persistedValue: 1), max: IntWrapper(persistedValue: 5),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt)\n        validateMax(\"listInt8\", min: Int8Wrapper(persistedValue: Int8(8)), max: Int8Wrapper(persistedValue: Int8(10)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt8)\n        validateMax(\"listInt16\", min: Int16Wrapper(persistedValue: Int16(16)), max: Int16Wrapper(persistedValue: Int16(18)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt16)\n        validateMax(\"listInt32\", min: Int32Wrapper(persistedValue: Int32(32)), max: Int32Wrapper(persistedValue: Int32(34)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt32)\n        validateMax(\"listInt64\", min: Int64Wrapper(persistedValue: Int64(64)), max: Int64Wrapper(persistedValue: Int64(66)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listInt64)\n        validateMax(\"listFloat\", min: FloatWrapper(persistedValue: Float(5.55444333)), max: FloatWrapper(persistedValue: Float(7.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listFloat)\n        validateMax(\"listDouble\", min: DoubleWrapper(persistedValue: 123.456), max: DoubleWrapper(persistedValue: 345.678),\n                    \\Query<LinkToCustomPersistableCollections>.object.listDouble)\n        validateMax(\"listDecimal\", min: Decimal128Wrapper(persistedValue: Decimal128(123.456)), max: Decimal128Wrapper(persistedValue: Decimal128(345.678)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listDecimal)\n        validateMax(\"arrayOptInt\", min: 1, max: 5,\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt)\n        validateMax(\"arrayOptInt8\", min: Int8(8), max: Int8(10),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt8)\n        validateMax(\"arrayOptInt16\", min: Int16(16), max: Int16(18),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt16)\n        validateMax(\"arrayOptInt32\", min: Int32(32), max: Int32(34),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt32)\n        validateMax(\"arrayOptInt64\", min: Int64(64), max: Int64(66),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptInt64)\n        validateMax(\"arrayOptFloat\", min: Float(5.55444333), max: Float(7.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptFloat)\n        validateMax(\"arrayOptDouble\", min: 123.456, max: 345.678,\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptDouble)\n        validateMax(\"arrayOptDecimal\", min: Decimal128(123.456), max: Decimal128(345.678),\n                    \\Query<LinkToModernAllTypesObject>.object.arrayOptDecimal)\n        validateMax(\"listIntOpt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listIntOpt)\n        validateMax(\"listInt8Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt8Opt)\n        validateMax(\"listInt16Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt16Opt)\n        validateMax(\"listInt32Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt32Opt)\n        validateMax(\"listInt64Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listInt64Opt)\n        validateMax(\"listDoubleOpt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.listDoubleOpt)\n        validateMax(\"listOptInt\", min: IntWrapper(persistedValue: 1), max: IntWrapper(persistedValue: 5),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt)\n        validateMax(\"listOptInt8\", min: Int8Wrapper(persistedValue: Int8(8)), max: Int8Wrapper(persistedValue: Int8(10)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt8)\n        validateMax(\"listOptInt16\", min: Int16Wrapper(persistedValue: Int16(16)), max: Int16Wrapper(persistedValue: Int16(18)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt16)\n        validateMax(\"listOptInt32\", min: Int32Wrapper(persistedValue: Int32(32)), max: Int32Wrapper(persistedValue: Int32(34)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt32)\n        validateMax(\"listOptInt64\", min: Int64Wrapper(persistedValue: Int64(64)), max: Int64Wrapper(persistedValue: Int64(66)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptInt64)\n        validateMax(\"listOptFloat\", min: FloatWrapper(persistedValue: Float(5.55444333)), max: FloatWrapper(persistedValue: Float(7.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptFloat)\n        validateMax(\"listOptDouble\", min: DoubleWrapper(persistedValue: 123.456), max: DoubleWrapper(persistedValue: 345.678),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptDouble)\n        validateMax(\"listOptDecimal\", min: Decimal128Wrapper(persistedValue: Decimal128(123.456)), max: Decimal128Wrapper(persistedValue: Decimal128(345.678)),\n                    \\Query<LinkToCustomPersistableCollections>.object.listOptDecimal)\n        validateMax(\"setInt\", min: 1, max: 5,\n                    \\Query<LinkToModernAllTypesObject>.object.setInt)\n        validateMax(\"setInt8\", min: Int8(8), max: Int8(10),\n                    \\Query<LinkToModernAllTypesObject>.object.setInt8)\n        validateMax(\"setInt16\", min: Int16(16), max: Int16(18),\n                    \\Query<LinkToModernAllTypesObject>.object.setInt16)\n        validateMax(\"setInt32\", min: Int32(32), max: Int32(34),\n                    \\Query<LinkToModernAllTypesObject>.object.setInt32)\n        validateMax(\"setInt64\", min: Int64(64), max: Int64(66),\n                    \\Query<LinkToModernAllTypesObject>.object.setInt64)\n        validateMax(\"setFloat\", min: Float(5.55444333), max: Float(7.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.setFloat)\n        validateMax(\"setDouble\", min: 123.456, max: 345.678,\n                    \\Query<LinkToModernAllTypesObject>.object.setDouble)\n        validateMax(\"setDecimal\", min: Decimal128(123.456), max: Decimal128(345.678),\n                    \\Query<LinkToModernAllTypesObject>.object.setDecimal)\n        validateMax(\"setInt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt)\n        validateMax(\"setInt8\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt8)\n        validateMax(\"setInt16\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt16)\n        validateMax(\"setInt32\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt32)\n        validateMax(\"setInt64\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt64)\n        validateMax(\"setDouble\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setDouble)\n        validateMax(\"setInt\", min: IntWrapper(persistedValue: 1), max: IntWrapper(persistedValue: 5),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt)\n        validateMax(\"setInt8\", min: Int8Wrapper(persistedValue: Int8(8)), max: Int8Wrapper(persistedValue: Int8(10)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt8)\n        validateMax(\"setInt16\", min: Int16Wrapper(persistedValue: Int16(16)), max: Int16Wrapper(persistedValue: Int16(18)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt16)\n        validateMax(\"setInt32\", min: Int32Wrapper(persistedValue: Int32(32)), max: Int32Wrapper(persistedValue: Int32(34)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt32)\n        validateMax(\"setInt64\", min: Int64Wrapper(persistedValue: Int64(64)), max: Int64Wrapper(persistedValue: Int64(66)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setInt64)\n        validateMax(\"setFloat\", min: FloatWrapper(persistedValue: Float(5.55444333)), max: FloatWrapper(persistedValue: Float(7.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setFloat)\n        validateMax(\"setDouble\", min: DoubleWrapper(persistedValue: 123.456), max: DoubleWrapper(persistedValue: 345.678),\n                    \\Query<LinkToCustomPersistableCollections>.object.setDouble)\n        validateMax(\"setDecimal\", min: Decimal128Wrapper(persistedValue: Decimal128(123.456)), max: Decimal128Wrapper(persistedValue: Decimal128(345.678)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setDecimal)\n        validateMax(\"setOptInt\", min: 1, max: 5,\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt)\n        validateMax(\"setOptInt8\", min: Int8(8), max: Int8(10),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt8)\n        validateMax(\"setOptInt16\", min: Int16(16), max: Int16(18),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt16)\n        validateMax(\"setOptInt32\", min: Int32(32), max: Int32(34),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt32)\n        validateMax(\"setOptInt64\", min: Int64(64), max: Int64(66),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptInt64)\n        validateMax(\"setOptFloat\", min: Float(5.55444333), max: Float(7.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptFloat)\n        validateMax(\"setOptDouble\", min: 123.456, max: 345.678,\n                    \\Query<LinkToModernAllTypesObject>.object.setOptDouble)\n        validateMax(\"setOptDecimal\", min: Decimal128(123.456), max: Decimal128(345.678),\n                    \\Query<LinkToModernAllTypesObject>.object.setOptDecimal)\n        validateMax(\"setIntOpt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setIntOpt)\n        validateMax(\"setInt8Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt8Opt)\n        validateMax(\"setInt16Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt16Opt)\n        validateMax(\"setInt32Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt32Opt)\n        validateMax(\"setInt64Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setInt64Opt)\n        validateMax(\"setDoubleOpt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.setDoubleOpt)\n        validateMax(\"setOptInt\", min: IntWrapper(persistedValue: 1), max: IntWrapper(persistedValue: 5),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt)\n        validateMax(\"setOptInt8\", min: Int8Wrapper(persistedValue: Int8(8)), max: Int8Wrapper(persistedValue: Int8(10)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt8)\n        validateMax(\"setOptInt16\", min: Int16Wrapper(persistedValue: Int16(16)), max: Int16Wrapper(persistedValue: Int16(18)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt16)\n        validateMax(\"setOptInt32\", min: Int32Wrapper(persistedValue: Int32(32)), max: Int32Wrapper(persistedValue: Int32(34)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt32)\n        validateMax(\"setOptInt64\", min: Int64Wrapper(persistedValue: Int64(64)), max: Int64Wrapper(persistedValue: Int64(66)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptInt64)\n        validateMax(\"setOptFloat\", min: FloatWrapper(persistedValue: Float(5.55444333)), max: FloatWrapper(persistedValue: Float(7.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptFloat)\n        validateMax(\"setOptDouble\", min: DoubleWrapper(persistedValue: 123.456), max: DoubleWrapper(persistedValue: 345.678),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptDouble)\n        validateMax(\"setOptDecimal\", min: Decimal128Wrapper(persistedValue: Decimal128(123.456)), max: Decimal128Wrapper(persistedValue: Decimal128(345.678)),\n                    \\Query<LinkToCustomPersistableCollections>.object.setOptDecimal)\n        validateMax(\"mapInt\", min: 1, max: 5,\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt)\n        validateMax(\"mapInt8\", min: Int8(8), max: Int8(10),\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt8)\n        validateMax(\"mapInt16\", min: Int16(16), max: Int16(18),\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt16)\n        validateMax(\"mapInt32\", min: Int32(32), max: Int32(34),\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt32)\n        validateMax(\"mapInt64\", min: Int64(64), max: Int64(66),\n                    \\Query<LinkToModernAllTypesObject>.object.mapInt64)\n        validateMax(\"mapFloat\", min: Float(5.55444333), max: Float(7.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.mapFloat)\n        validateMax(\"mapDouble\", min: 123.456, max: 345.678,\n                    \\Query<LinkToModernAllTypesObject>.object.mapDouble)\n        validateMax(\"mapDecimal\", min: Decimal128(123.456), max: Decimal128(345.678),\n                    \\Query<LinkToModernAllTypesObject>.object.mapDecimal)\n        validateMax(\"mapInt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt)\n        validateMax(\"mapInt8\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt8)\n        validateMax(\"mapInt16\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt16)\n        validateMax(\"mapInt32\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt32)\n        validateMax(\"mapInt64\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt64)\n        validateMax(\"mapDouble\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapDouble)\n        validateMax(\"mapInt\", min: IntWrapper(persistedValue: 1), max: IntWrapper(persistedValue: 5),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt)\n        validateMax(\"mapInt8\", min: Int8Wrapper(persistedValue: Int8(8)), max: Int8Wrapper(persistedValue: Int8(10)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt8)\n        validateMax(\"mapInt16\", min: Int16Wrapper(persistedValue: Int16(16)), max: Int16Wrapper(persistedValue: Int16(18)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt16)\n        validateMax(\"mapInt32\", min: Int32Wrapper(persistedValue: Int32(32)), max: Int32Wrapper(persistedValue: Int32(34)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt32)\n        validateMax(\"mapInt64\", min: Int64Wrapper(persistedValue: Int64(64)), max: Int64Wrapper(persistedValue: Int64(66)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapInt64)\n        validateMax(\"mapFloat\", min: FloatWrapper(persistedValue: Float(5.55444333)), max: FloatWrapper(persistedValue: Float(7.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapFloat)\n        validateMax(\"mapDouble\", min: DoubleWrapper(persistedValue: 123.456), max: DoubleWrapper(persistedValue: 345.678),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapDouble)\n        validateMax(\"mapDecimal\", min: Decimal128Wrapper(persistedValue: Decimal128(123.456)), max: Decimal128Wrapper(persistedValue: Decimal128(345.678)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapDecimal)\n        validateMax(\"mapOptInt\", min: 1, max: 5,\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt)\n        validateMax(\"mapOptInt8\", min: Int8(8), max: Int8(10),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt8)\n        validateMax(\"mapOptInt16\", min: Int16(16), max: Int16(18),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt16)\n        validateMax(\"mapOptInt32\", min: Int32(32), max: Int32(34),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt32)\n        validateMax(\"mapOptInt64\", min: Int64(64), max: Int64(66),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptInt64)\n        validateMax(\"mapOptFloat\", min: Float(5.55444333), max: Float(7.55444333),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptFloat)\n        validateMax(\"mapOptDouble\", min: 123.456, max: 345.678,\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptDouble)\n        validateMax(\"mapOptDecimal\", min: Decimal128(123.456), max: Decimal128(345.678),\n                    \\Query<LinkToModernAllTypesObject>.object.mapOptDecimal)\n        validateMax(\"mapIntOpt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapIntOpt)\n        validateMax(\"mapInt8Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt8Opt)\n        validateMax(\"mapInt16Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt16Opt)\n        validateMax(\"mapInt32Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt32Opt)\n        validateMax(\"mapInt64Opt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapInt64Opt)\n        validateMax(\"mapDoubleOpt\", min: .value1, max: .value3,\n                    \\Query<LinkToModernCollectionsOfEnums>.object.mapDoubleOpt)\n        validateMax(\"mapOptInt\", min: IntWrapper(persistedValue: 1), max: IntWrapper(persistedValue: 5),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt)\n        validateMax(\"mapOptInt8\", min: Int8Wrapper(persistedValue: Int8(8)), max: Int8Wrapper(persistedValue: Int8(10)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt8)\n        validateMax(\"mapOptInt16\", min: Int16Wrapper(persistedValue: Int16(16)), max: Int16Wrapper(persistedValue: Int16(18)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt16)\n        validateMax(\"mapOptInt32\", min: Int32Wrapper(persistedValue: Int32(32)), max: Int32Wrapper(persistedValue: Int32(34)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt32)\n        validateMax(\"mapOptInt64\", min: Int64Wrapper(persistedValue: Int64(64)), max: Int64Wrapper(persistedValue: Int64(66)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptInt64)\n        validateMax(\"mapOptFloat\", min: FloatWrapper(persistedValue: Float(5.55444333)), max: FloatWrapper(persistedValue: Float(7.55444333)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptFloat)\n        validateMax(\"mapOptDouble\", min: DoubleWrapper(persistedValue: 123.456), max: DoubleWrapper(persistedValue: 345.678),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptDouble)\n        validateMax(\"mapOptDecimal\", min: Decimal128Wrapper(persistedValue: Decimal128(123.456)), max: Decimal128Wrapper(persistedValue: Decimal128(345.678)),\n                    \\Query<LinkToCustomPersistableCollections>.object.mapOptDecimal)\n    }\n\n\n    // @Count\n\n    private func validateCount<Root: Object, T: RealmCollection>(_ name: String, _ lhs: (Query<Root>) -> Query<T>) {\n        assertQuery(Root.self, \"(object.\\(name).@count == %@)\", 3, count: 1) {\n            lhs($0).count == 3\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count == %@)\", 0, count: 0) {\n            lhs($0).count == 0\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count != %@)\", 3, count: 0) {\n            lhs($0).count != 3\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count != %@)\", 2, count: 1) {\n            lhs($0).count != 2\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count < %@)\", 3, count: 0) {\n            lhs($0).count < 3\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count < %@)\", 4, count: 1) {\n            lhs($0).count < 4\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count > %@)\", 2, count: 1) {\n            lhs($0).count > 2\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count > %@)\", 3, count: 0) {\n            lhs($0).count > 3\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count <= %@)\", 2, count: 0) {\n            lhs($0).count <= 2\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count <= %@)\", 3, count: 1) {\n            lhs($0).count <= 3\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count >= %@)\", 3, count: 1) {\n            lhs($0).count >= 3\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count >= %@)\", 4, count: 0) {\n            lhs($0).count >= 4\n        }\n    }\n    private func validateCount<Root: Object, T: RealmKeyedCollection>(_ name: String, _ lhs: (Query<Root>) -> Query<T>) {\n        assertQuery(Root.self, \"(object.\\(name).@count == %@)\", 3, count: 1) {\n            lhs($0).count == 3\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count == %@)\", 0, count: 0) {\n            lhs($0).count == 0\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count != %@)\", 3, count: 0) {\n            lhs($0).count != 3\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count != %@)\", 2, count: 1) {\n            lhs($0).count != 2\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count < %@)\", 3, count: 0) {\n            lhs($0).count < 3\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count < %@)\", 4, count: 1) {\n            lhs($0).count < 4\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count > %@)\", 2, count: 1) {\n            lhs($0).count > 2\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count > %@)\", 3, count: 0) {\n            lhs($0).count > 3\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count <= %@)\", 2, count: 0) {\n            lhs($0).count <= 2\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count <= %@)\", 3, count: 1) {\n            lhs($0).count <= 3\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count >= %@)\", 3, count: 1) {\n            lhs($0).count >= 3\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count >= %@)\", 4, count: 0) {\n            lhs($0).count >= 4\n        }\n    }\n\n    func testCollectionAggregatesCount() {\n        initLinkedCollectionAggregatesObject()\n\n        validateCount(\"arrayInt\", \\Query<LinkToModernAllTypesObject>.object.arrayInt)\n        validateCount(\"arrayInt8\", \\Query<LinkToModernAllTypesObject>.object.arrayInt8)\n        validateCount(\"arrayInt16\", \\Query<LinkToModernAllTypesObject>.object.arrayInt16)\n        validateCount(\"arrayInt32\", \\Query<LinkToModernAllTypesObject>.object.arrayInt32)\n        validateCount(\"arrayInt64\", \\Query<LinkToModernAllTypesObject>.object.arrayInt64)\n        validateCount(\"arrayFloat\", \\Query<LinkToModernAllTypesObject>.object.arrayFloat)\n        validateCount(\"arrayDouble\", \\Query<LinkToModernAllTypesObject>.object.arrayDouble)\n        validateCount(\"arrayString\", \\Query<LinkToModernAllTypesObject>.object.arrayString)\n        validateCount(\"arrayBinary\", \\Query<LinkToModernAllTypesObject>.object.arrayBinary)\n        validateCount(\"arrayDate\", \\Query<LinkToModernAllTypesObject>.object.arrayDate)\n        validateCount(\"arrayDecimal\", \\Query<LinkToModernAllTypesObject>.object.arrayDecimal)\n        validateCount(\"arrayObjectId\", \\Query<LinkToModernAllTypesObject>.object.arrayObjectId)\n        validateCount(\"arrayUuid\", \\Query<LinkToModernAllTypesObject>.object.arrayUuid)\n        validateCount(\"arrayAny\", \\Query<LinkToModernAllTypesObject>.object.arrayAny)\n        validateCount(\"listInt\", \\Query<LinkToModernCollectionsOfEnums>.object.listInt)\n        validateCount(\"listInt8\", \\Query<LinkToModernCollectionsOfEnums>.object.listInt8)\n        validateCount(\"listInt16\", \\Query<LinkToModernCollectionsOfEnums>.object.listInt16)\n        validateCount(\"listInt32\", \\Query<LinkToModernCollectionsOfEnums>.object.listInt32)\n        validateCount(\"listInt64\", \\Query<LinkToModernCollectionsOfEnums>.object.listInt64)\n        validateCount(\"listFloat\", \\Query<LinkToModernCollectionsOfEnums>.object.listFloat)\n        validateCount(\"listDouble\", \\Query<LinkToModernCollectionsOfEnums>.object.listDouble)\n        validateCount(\"listString\", \\Query<LinkToModernCollectionsOfEnums>.object.listString)\n        validateCount(\"listInt\", \\Query<LinkToCustomPersistableCollections>.object.listInt)\n        validateCount(\"listInt8\", \\Query<LinkToCustomPersistableCollections>.object.listInt8)\n        validateCount(\"listInt16\", \\Query<LinkToCustomPersistableCollections>.object.listInt16)\n        validateCount(\"listInt32\", \\Query<LinkToCustomPersistableCollections>.object.listInt32)\n        validateCount(\"listInt64\", \\Query<LinkToCustomPersistableCollections>.object.listInt64)\n        validateCount(\"listFloat\", \\Query<LinkToCustomPersistableCollections>.object.listFloat)\n        validateCount(\"listDouble\", \\Query<LinkToCustomPersistableCollections>.object.listDouble)\n        validateCount(\"listString\", \\Query<LinkToCustomPersistableCollections>.object.listString)\n        validateCount(\"listBinary\", \\Query<LinkToCustomPersistableCollections>.object.listBinary)\n        validateCount(\"listDate\", \\Query<LinkToCustomPersistableCollections>.object.listDate)\n        validateCount(\"listDecimal\", \\Query<LinkToCustomPersistableCollections>.object.listDecimal)\n        validateCount(\"listObjectId\", \\Query<LinkToCustomPersistableCollections>.object.listObjectId)\n        validateCount(\"listUuid\", \\Query<LinkToCustomPersistableCollections>.object.listUuid)\n        validateCount(\"arrayOptInt\", \\Query<LinkToModernAllTypesObject>.object.arrayOptInt)\n        validateCount(\"arrayOptInt8\", \\Query<LinkToModernAllTypesObject>.object.arrayOptInt8)\n        validateCount(\"arrayOptInt16\", \\Query<LinkToModernAllTypesObject>.object.arrayOptInt16)\n        validateCount(\"arrayOptInt32\", \\Query<LinkToModernAllTypesObject>.object.arrayOptInt32)\n        validateCount(\"arrayOptInt64\", \\Query<LinkToModernAllTypesObject>.object.arrayOptInt64)\n        validateCount(\"arrayOptFloat\", \\Query<LinkToModernAllTypesObject>.object.arrayOptFloat)\n        validateCount(\"arrayOptDouble\", \\Query<LinkToModernAllTypesObject>.object.arrayOptDouble)\n        validateCount(\"arrayOptString\", \\Query<LinkToModernAllTypesObject>.object.arrayOptString)\n        validateCount(\"arrayOptBinary\", \\Query<LinkToModernAllTypesObject>.object.arrayOptBinary)\n        validateCount(\"arrayOptDate\", \\Query<LinkToModernAllTypesObject>.object.arrayOptDate)\n        validateCount(\"arrayOptDecimal\", \\Query<LinkToModernAllTypesObject>.object.arrayOptDecimal)\n        validateCount(\"arrayOptObjectId\", \\Query<LinkToModernAllTypesObject>.object.arrayOptObjectId)\n        validateCount(\"arrayOptUuid\", \\Query<LinkToModernAllTypesObject>.object.arrayOptUuid)\n        validateCount(\"listIntOpt\", \\Query<LinkToModernCollectionsOfEnums>.object.listIntOpt)\n        validateCount(\"listInt8Opt\", \\Query<LinkToModernCollectionsOfEnums>.object.listInt8Opt)\n        validateCount(\"listInt16Opt\", \\Query<LinkToModernCollectionsOfEnums>.object.listInt16Opt)\n        validateCount(\"listInt32Opt\", \\Query<LinkToModernCollectionsOfEnums>.object.listInt32Opt)\n        validateCount(\"listInt64Opt\", \\Query<LinkToModernCollectionsOfEnums>.object.listInt64Opt)\n        validateCount(\"listFloatOpt\", \\Query<LinkToModernCollectionsOfEnums>.object.listFloatOpt)\n        validateCount(\"listDoubleOpt\", \\Query<LinkToModernCollectionsOfEnums>.object.listDoubleOpt)\n        validateCount(\"listStringOpt\", \\Query<LinkToModernCollectionsOfEnums>.object.listStringOpt)\n        validateCount(\"listOptInt\", \\Query<LinkToCustomPersistableCollections>.object.listOptInt)\n        validateCount(\"listOptInt8\", \\Query<LinkToCustomPersistableCollections>.object.listOptInt8)\n        validateCount(\"listOptInt16\", \\Query<LinkToCustomPersistableCollections>.object.listOptInt16)\n        validateCount(\"listOptInt32\", \\Query<LinkToCustomPersistableCollections>.object.listOptInt32)\n        validateCount(\"listOptInt64\", \\Query<LinkToCustomPersistableCollections>.object.listOptInt64)\n        validateCount(\"listOptFloat\", \\Query<LinkToCustomPersistableCollections>.object.listOptFloat)\n        validateCount(\"listOptDouble\", \\Query<LinkToCustomPersistableCollections>.object.listOptDouble)\n        validateCount(\"listOptString\", \\Query<LinkToCustomPersistableCollections>.object.listOptString)\n        validateCount(\"listOptBinary\", \\Query<LinkToCustomPersistableCollections>.object.listOptBinary)\n        validateCount(\"listOptDate\", \\Query<LinkToCustomPersistableCollections>.object.listOptDate)\n        validateCount(\"listOptDecimal\", \\Query<LinkToCustomPersistableCollections>.object.listOptDecimal)\n        validateCount(\"listOptObjectId\", \\Query<LinkToCustomPersistableCollections>.object.listOptObjectId)\n        validateCount(\"listOptUuid\", \\Query<LinkToCustomPersistableCollections>.object.listOptUuid)\n        validateCount(\"setInt\", \\Query<LinkToModernAllTypesObject>.object.setInt)\n        validateCount(\"setInt8\", \\Query<LinkToModernAllTypesObject>.object.setInt8)\n        validateCount(\"setInt16\", \\Query<LinkToModernAllTypesObject>.object.setInt16)\n        validateCount(\"setInt32\", \\Query<LinkToModernAllTypesObject>.object.setInt32)\n        validateCount(\"setInt64\", \\Query<LinkToModernAllTypesObject>.object.setInt64)\n        validateCount(\"setFloat\", \\Query<LinkToModernAllTypesObject>.object.setFloat)\n        validateCount(\"setDouble\", \\Query<LinkToModernAllTypesObject>.object.setDouble)\n        validateCount(\"setString\", \\Query<LinkToModernAllTypesObject>.object.setString)\n        validateCount(\"setBinary\", \\Query<LinkToModernAllTypesObject>.object.setBinary)\n        validateCount(\"setDate\", \\Query<LinkToModernAllTypesObject>.object.setDate)\n        validateCount(\"setDecimal\", \\Query<LinkToModernAllTypesObject>.object.setDecimal)\n        validateCount(\"setObjectId\", \\Query<LinkToModernAllTypesObject>.object.setObjectId)\n        validateCount(\"setUuid\", \\Query<LinkToModernAllTypesObject>.object.setUuid)\n        validateCount(\"setAny\", \\Query<LinkToModernAllTypesObject>.object.setAny)\n        validateCount(\"setInt\", \\Query<LinkToModernCollectionsOfEnums>.object.setInt)\n        validateCount(\"setInt8\", \\Query<LinkToModernCollectionsOfEnums>.object.setInt8)\n        validateCount(\"setInt16\", \\Query<LinkToModernCollectionsOfEnums>.object.setInt16)\n        validateCount(\"setInt32\", \\Query<LinkToModernCollectionsOfEnums>.object.setInt32)\n        validateCount(\"setInt64\", \\Query<LinkToModernCollectionsOfEnums>.object.setInt64)\n        validateCount(\"setFloat\", \\Query<LinkToModernCollectionsOfEnums>.object.setFloat)\n        validateCount(\"setDouble\", \\Query<LinkToModernCollectionsOfEnums>.object.setDouble)\n        validateCount(\"setString\", \\Query<LinkToModernCollectionsOfEnums>.object.setString)\n        validateCount(\"setInt\", \\Query<LinkToCustomPersistableCollections>.object.setInt)\n        validateCount(\"setInt8\", \\Query<LinkToCustomPersistableCollections>.object.setInt8)\n        validateCount(\"setInt16\", \\Query<LinkToCustomPersistableCollections>.object.setInt16)\n        validateCount(\"setInt32\", \\Query<LinkToCustomPersistableCollections>.object.setInt32)\n        validateCount(\"setInt64\", \\Query<LinkToCustomPersistableCollections>.object.setInt64)\n        validateCount(\"setFloat\", \\Query<LinkToCustomPersistableCollections>.object.setFloat)\n        validateCount(\"setDouble\", \\Query<LinkToCustomPersistableCollections>.object.setDouble)\n        validateCount(\"setString\", \\Query<LinkToCustomPersistableCollections>.object.setString)\n        validateCount(\"setBinary\", \\Query<LinkToCustomPersistableCollections>.object.setBinary)\n        validateCount(\"setDate\", \\Query<LinkToCustomPersistableCollections>.object.setDate)\n        validateCount(\"setDecimal\", \\Query<LinkToCustomPersistableCollections>.object.setDecimal)\n        validateCount(\"setObjectId\", \\Query<LinkToCustomPersistableCollections>.object.setObjectId)\n        validateCount(\"setUuid\", \\Query<LinkToCustomPersistableCollections>.object.setUuid)\n        validateCount(\"setOptInt\", \\Query<LinkToModernAllTypesObject>.object.setOptInt)\n        validateCount(\"setOptInt8\", \\Query<LinkToModernAllTypesObject>.object.setOptInt8)\n        validateCount(\"setOptInt16\", \\Query<LinkToModernAllTypesObject>.object.setOptInt16)\n        validateCount(\"setOptInt32\", \\Query<LinkToModernAllTypesObject>.object.setOptInt32)\n        validateCount(\"setOptInt64\", \\Query<LinkToModernAllTypesObject>.object.setOptInt64)\n        validateCount(\"setOptFloat\", \\Query<LinkToModernAllTypesObject>.object.setOptFloat)\n        validateCount(\"setOptDouble\", \\Query<LinkToModernAllTypesObject>.object.setOptDouble)\n        validateCount(\"setOptString\", \\Query<LinkToModernAllTypesObject>.object.setOptString)\n        validateCount(\"setOptBinary\", \\Query<LinkToModernAllTypesObject>.object.setOptBinary)\n        validateCount(\"setOptDate\", \\Query<LinkToModernAllTypesObject>.object.setOptDate)\n        validateCount(\"setOptDecimal\", \\Query<LinkToModernAllTypesObject>.object.setOptDecimal)\n        validateCount(\"setOptObjectId\", \\Query<LinkToModernAllTypesObject>.object.setOptObjectId)\n        validateCount(\"setOptUuid\", \\Query<LinkToModernAllTypesObject>.object.setOptUuid)\n        validateCount(\"setIntOpt\", \\Query<LinkToModernCollectionsOfEnums>.object.setIntOpt)\n        validateCount(\"setInt8Opt\", \\Query<LinkToModernCollectionsOfEnums>.object.setInt8Opt)\n        validateCount(\"setInt16Opt\", \\Query<LinkToModernCollectionsOfEnums>.object.setInt16Opt)\n        validateCount(\"setInt32Opt\", \\Query<LinkToModernCollectionsOfEnums>.object.setInt32Opt)\n        validateCount(\"setInt64Opt\", \\Query<LinkToModernCollectionsOfEnums>.object.setInt64Opt)\n        validateCount(\"setFloatOpt\", \\Query<LinkToModernCollectionsOfEnums>.object.setFloatOpt)\n        validateCount(\"setDoubleOpt\", \\Query<LinkToModernCollectionsOfEnums>.object.setDoubleOpt)\n        validateCount(\"setStringOpt\", \\Query<LinkToModernCollectionsOfEnums>.object.setStringOpt)\n        validateCount(\"setOptInt\", \\Query<LinkToCustomPersistableCollections>.object.setOptInt)\n        validateCount(\"setOptInt8\", \\Query<LinkToCustomPersistableCollections>.object.setOptInt8)\n        validateCount(\"setOptInt16\", \\Query<LinkToCustomPersistableCollections>.object.setOptInt16)\n        validateCount(\"setOptInt32\", \\Query<LinkToCustomPersistableCollections>.object.setOptInt32)\n        validateCount(\"setOptInt64\", \\Query<LinkToCustomPersistableCollections>.object.setOptInt64)\n        validateCount(\"setOptFloat\", \\Query<LinkToCustomPersistableCollections>.object.setOptFloat)\n        validateCount(\"setOptDouble\", \\Query<LinkToCustomPersistableCollections>.object.setOptDouble)\n        validateCount(\"setOptString\", \\Query<LinkToCustomPersistableCollections>.object.setOptString)\n        validateCount(\"setOptBinary\", \\Query<LinkToCustomPersistableCollections>.object.setOptBinary)\n        validateCount(\"setOptDate\", \\Query<LinkToCustomPersistableCollections>.object.setOptDate)\n        validateCount(\"setOptDecimal\", \\Query<LinkToCustomPersistableCollections>.object.setOptDecimal)\n        validateCount(\"setOptObjectId\", \\Query<LinkToCustomPersistableCollections>.object.setOptObjectId)\n        validateCount(\"setOptUuid\", \\Query<LinkToCustomPersistableCollections>.object.setOptUuid)\n        validateCount(\"mapInt\", \\Query<LinkToModernAllTypesObject>.object.mapInt)\n        validateCount(\"mapInt8\", \\Query<LinkToModernAllTypesObject>.object.mapInt8)\n        validateCount(\"mapInt16\", \\Query<LinkToModernAllTypesObject>.object.mapInt16)\n        validateCount(\"mapInt32\", \\Query<LinkToModernAllTypesObject>.object.mapInt32)\n        validateCount(\"mapInt64\", \\Query<LinkToModernAllTypesObject>.object.mapInt64)\n        validateCount(\"mapFloat\", \\Query<LinkToModernAllTypesObject>.object.mapFloat)\n        validateCount(\"mapDouble\", \\Query<LinkToModernAllTypesObject>.object.mapDouble)\n        validateCount(\"mapString\", \\Query<LinkToModernAllTypesObject>.object.mapString)\n        validateCount(\"mapBinary\", \\Query<LinkToModernAllTypesObject>.object.mapBinary)\n        validateCount(\"mapDate\", \\Query<LinkToModernAllTypesObject>.object.mapDate)\n        validateCount(\"mapDecimal\", \\Query<LinkToModernAllTypesObject>.object.mapDecimal)\n        validateCount(\"mapObjectId\", \\Query<LinkToModernAllTypesObject>.object.mapObjectId)\n        validateCount(\"mapUuid\", \\Query<LinkToModernAllTypesObject>.object.mapUuid)\n        validateCount(\"mapAny\", \\Query<LinkToModernAllTypesObject>.object.mapAny)\n        validateCount(\"mapInt\", \\Query<LinkToModernCollectionsOfEnums>.object.mapInt)\n        validateCount(\"mapInt8\", \\Query<LinkToModernCollectionsOfEnums>.object.mapInt8)\n        validateCount(\"mapInt16\", \\Query<LinkToModernCollectionsOfEnums>.object.mapInt16)\n        validateCount(\"mapInt32\", \\Query<LinkToModernCollectionsOfEnums>.object.mapInt32)\n        validateCount(\"mapInt64\", \\Query<LinkToModernCollectionsOfEnums>.object.mapInt64)\n        validateCount(\"mapFloat\", \\Query<LinkToModernCollectionsOfEnums>.object.mapFloat)\n        validateCount(\"mapDouble\", \\Query<LinkToModernCollectionsOfEnums>.object.mapDouble)\n        validateCount(\"mapString\", \\Query<LinkToModernCollectionsOfEnums>.object.mapString)\n        validateCount(\"mapInt\", \\Query<LinkToCustomPersistableCollections>.object.mapInt)\n        validateCount(\"mapInt8\", \\Query<LinkToCustomPersistableCollections>.object.mapInt8)\n        validateCount(\"mapInt16\", \\Query<LinkToCustomPersistableCollections>.object.mapInt16)\n        validateCount(\"mapInt32\", \\Query<LinkToCustomPersistableCollections>.object.mapInt32)\n        validateCount(\"mapInt64\", \\Query<LinkToCustomPersistableCollections>.object.mapInt64)\n        validateCount(\"mapFloat\", \\Query<LinkToCustomPersistableCollections>.object.mapFloat)\n        validateCount(\"mapDouble\", \\Query<LinkToCustomPersistableCollections>.object.mapDouble)\n        validateCount(\"mapString\", \\Query<LinkToCustomPersistableCollections>.object.mapString)\n        validateCount(\"mapBinary\", \\Query<LinkToCustomPersistableCollections>.object.mapBinary)\n        validateCount(\"mapDate\", \\Query<LinkToCustomPersistableCollections>.object.mapDate)\n        validateCount(\"mapDecimal\", \\Query<LinkToCustomPersistableCollections>.object.mapDecimal)\n        validateCount(\"mapObjectId\", \\Query<LinkToCustomPersistableCollections>.object.mapObjectId)\n        validateCount(\"mapUuid\", \\Query<LinkToCustomPersistableCollections>.object.mapUuid)\n        validateCount(\"mapOptInt\", \\Query<LinkToModernAllTypesObject>.object.mapOptInt)\n        validateCount(\"mapOptInt8\", \\Query<LinkToModernAllTypesObject>.object.mapOptInt8)\n        validateCount(\"mapOptInt16\", \\Query<LinkToModernAllTypesObject>.object.mapOptInt16)\n        validateCount(\"mapOptInt32\", \\Query<LinkToModernAllTypesObject>.object.mapOptInt32)\n        validateCount(\"mapOptInt64\", \\Query<LinkToModernAllTypesObject>.object.mapOptInt64)\n        validateCount(\"mapOptFloat\", \\Query<LinkToModernAllTypesObject>.object.mapOptFloat)\n        validateCount(\"mapOptDouble\", \\Query<LinkToModernAllTypesObject>.object.mapOptDouble)\n        validateCount(\"mapOptString\", \\Query<LinkToModernAllTypesObject>.object.mapOptString)\n        validateCount(\"mapOptBinary\", \\Query<LinkToModernAllTypesObject>.object.mapOptBinary)\n        validateCount(\"mapOptDate\", \\Query<LinkToModernAllTypesObject>.object.mapOptDate)\n        validateCount(\"mapOptDecimal\", \\Query<LinkToModernAllTypesObject>.object.mapOptDecimal)\n        validateCount(\"mapOptObjectId\", \\Query<LinkToModernAllTypesObject>.object.mapOptObjectId)\n        validateCount(\"mapOptUuid\", \\Query<LinkToModernAllTypesObject>.object.mapOptUuid)\n        validateCount(\"mapIntOpt\", \\Query<LinkToModernCollectionsOfEnums>.object.mapIntOpt)\n        validateCount(\"mapInt8Opt\", \\Query<LinkToModernCollectionsOfEnums>.object.mapInt8Opt)\n        validateCount(\"mapInt16Opt\", \\Query<LinkToModernCollectionsOfEnums>.object.mapInt16Opt)\n        validateCount(\"mapInt32Opt\", \\Query<LinkToModernCollectionsOfEnums>.object.mapInt32Opt)\n        validateCount(\"mapInt64Opt\", \\Query<LinkToModernCollectionsOfEnums>.object.mapInt64Opt)\n        validateCount(\"mapFloatOpt\", \\Query<LinkToModernCollectionsOfEnums>.object.mapFloatOpt)\n        validateCount(\"mapDoubleOpt\", \\Query<LinkToModernCollectionsOfEnums>.object.mapDoubleOpt)\n        validateCount(\"mapStringOpt\", \\Query<LinkToModernCollectionsOfEnums>.object.mapStringOpt)\n        validateCount(\"mapOptInt\", \\Query<LinkToCustomPersistableCollections>.object.mapOptInt)\n        validateCount(\"mapOptInt8\", \\Query<LinkToCustomPersistableCollections>.object.mapOptInt8)\n        validateCount(\"mapOptInt16\", \\Query<LinkToCustomPersistableCollections>.object.mapOptInt16)\n        validateCount(\"mapOptInt32\", \\Query<LinkToCustomPersistableCollections>.object.mapOptInt32)\n        validateCount(\"mapOptInt64\", \\Query<LinkToCustomPersistableCollections>.object.mapOptInt64)\n        validateCount(\"mapOptFloat\", \\Query<LinkToCustomPersistableCollections>.object.mapOptFloat)\n        validateCount(\"mapOptDouble\", \\Query<LinkToCustomPersistableCollections>.object.mapOptDouble)\n        validateCount(\"mapOptString\", \\Query<LinkToCustomPersistableCollections>.object.mapOptString)\n        validateCount(\"mapOptBinary\", \\Query<LinkToCustomPersistableCollections>.object.mapOptBinary)\n        validateCount(\"mapOptDate\", \\Query<LinkToCustomPersistableCollections>.object.mapOptDate)\n        validateCount(\"mapOptDecimal\", \\Query<LinkToCustomPersistableCollections>.object.mapOptDecimal)\n        validateCount(\"mapOptObjectId\", \\Query<LinkToCustomPersistableCollections>.object.mapOptObjectId)\n        validateCount(\"mapOptUuid\", \\Query<LinkToCustomPersistableCollections>.object.mapOptUuid)\n    }\n\n    // MARK: - Keypath Collection Aggregations\n\n    private func validateKeypathAverage<Root: Object, T>(_ name: String, _ average: T, _ min: T, _ lhs: (Query<Root>) -> Query<T>)\n            where T: _Persistable & QueryValue, T.PersistedType: _QueryNumeric {\n        assertQuery(Root.self, \"(list.@avg.\\(name) == %@)\", average, count: 1) {\n            lhs($0).avg == average\n        }\n        assertQuery(Root.self, \"(list.@avg.\\(name) == %@)\", min, count: 0) {\n            lhs($0).avg == min\n        }\n        assertQuery(Root.self, \"(list.@avg.\\(name) != %@)\", average, count: 0) {\n            lhs($0).avg != average\n        }\n        assertQuery(Root.self, \"(list.@avg.\\(name) != %@)\", min, count: 1) {\n            lhs($0).avg != min\n        }\n        assertQuery(Root.self, \"(list.@avg.\\(name) > %@)\", average, count: 0) {\n            lhs($0).avg > average\n        }\n        assertQuery(Root.self, \"(list.@avg.\\(name) > %@)\", min, count: 1) {\n            lhs($0).avg > min\n        }\n        assertQuery(Root.self, \"(list.@avg.\\(name) < %@)\", average, count: 0) {\n            lhs($0).avg < average\n        }\n        assertQuery(Root.self, \"(list.@avg.\\(name) >= %@)\", average, count: 1) {\n            lhs($0).avg >= average\n        }\n        assertQuery(Root.self, \"(list.@avg.\\(name) <= %@)\", average, count: 1) {\n            lhs($0).avg <= average\n        }\n    }\n\n    func testKeypathCollectionAggregatesAvg() {\n        createKeypathCollectionAggregatesObject()\n\n        validateKeypathAverage(\"intCol\", Int.average(), 1,\n                    \\Query<LinkToModernAllTypesObject>.list.intCol)\n        validateKeypathAverage(\"int8Col\", Int8.average(), Int8(8),\n                    \\Query<LinkToModernAllTypesObject>.list.int8Col)\n        validateKeypathAverage(\"int16Col\", Int16.average(), Int16(16),\n                    \\Query<LinkToModernAllTypesObject>.list.int16Col)\n        validateKeypathAverage(\"int32Col\", Int32.average(), Int32(32),\n                    \\Query<LinkToModernAllTypesObject>.list.int32Col)\n        validateKeypathAverage(\"int64Col\", Int64.average(), Int64(64),\n                    \\Query<LinkToModernAllTypesObject>.list.int64Col)\n        validateKeypathAverage(\"floatCol\", Float.average(), Float(5.55444333),\n                    \\Query<LinkToModernAllTypesObject>.list.floatCol)\n        validateKeypathAverage(\"doubleCol\", Double.average(), 123.456,\n                    \\Query<LinkToModernAllTypesObject>.list.doubleCol)\n        validateKeypathAverage(\"decimalCol\", Decimal128.average(), Decimal128(123.456),\n                    \\Query<LinkToModernAllTypesObject>.list.decimalCol)\n        validateKeypathAverage(\"intEnumCol\", ModernIntEnum.average(), ModernIntEnum.value1.rawValue,\n                    \\Query<LinkToModernAllTypesObject>.list.intEnumCol.rawValue)\n        validateKeypathAverage(\"int\", IntWrapper.average(), IntWrapper(persistedValue: 1),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int)\n        validateKeypathAverage(\"int8\", Int8Wrapper.average(), Int8Wrapper(persistedValue: Int8(8)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int8)\n        validateKeypathAverage(\"int16\", Int16Wrapper.average(), Int16Wrapper(persistedValue: Int16(16)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int16)\n        validateKeypathAverage(\"int32\", Int32Wrapper.average(), Int32Wrapper(persistedValue: Int32(32)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int32)\n        validateKeypathAverage(\"int64\", Int64Wrapper.average(), Int64Wrapper(persistedValue: Int64(64)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int64)\n        validateKeypathAverage(\"float\", FloatWrapper.average(), FloatWrapper(persistedValue: Float(5.55444333)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.float)\n        validateKeypathAverage(\"double\", DoubleWrapper.average(), DoubleWrapper(persistedValue: 123.456),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.double)\n        validateKeypathAverage(\"decimal\", Decimal128Wrapper.average(), Decimal128Wrapper(persistedValue: Decimal128(123.456)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.decimal)\n        validateKeypathAverage(\"optIntCol\", Int?.average(), 1,\n                    \\Query<LinkToModernAllTypesObject>.list.optIntCol)\n        validateKeypathAverage(\"optInt8Col\", Int8?.average(), Int8(8),\n                    \\Query<LinkToModernAllTypesObject>.list.optInt8Col)\n        validateKeypathAverage(\"optInt16Col\", Int16?.average(), Int16(16),\n                    \\Query<LinkToModernAllTypesObject>.list.optInt16Col)\n        validateKeypathAverage(\"optInt32Col\", Int32?.average(), Int32(32),\n                    \\Query<LinkToModernAllTypesObject>.list.optInt32Col)\n        validateKeypathAverage(\"optInt64Col\", Int64?.average(), Int64(64),\n                    \\Query<LinkToModernAllTypesObject>.list.optInt64Col)\n        validateKeypathAverage(\"optFloatCol\", Float?.average(), Float(5.55444333),\n                    \\Query<LinkToModernAllTypesObject>.list.optFloatCol)\n        validateKeypathAverage(\"optDoubleCol\", Double?.average(), 123.456,\n                    \\Query<LinkToModernAllTypesObject>.list.optDoubleCol)\n        validateKeypathAverage(\"optDecimalCol\", Decimal128?.average(), Decimal128(123.456),\n                    \\Query<LinkToModernAllTypesObject>.list.optDecimalCol)\n        validateKeypathAverage(\"optIntEnumCol\", ModernIntEnum.average(), ModernIntEnum.value1.rawValue,\n                    \\Query<LinkToModernAllTypesObject>.list.optIntEnumCol.rawValue)\n        validateKeypathAverage(\"optInt\", IntWrapper?.average(), IntWrapper(persistedValue: 1),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt)\n        validateKeypathAverage(\"optInt8\", Int8Wrapper?.average(), Int8Wrapper(persistedValue: Int8(8)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt8)\n        validateKeypathAverage(\"optInt16\", Int16Wrapper?.average(), Int16Wrapper(persistedValue: Int16(16)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt16)\n        validateKeypathAverage(\"optInt32\", Int32Wrapper?.average(), Int32Wrapper(persistedValue: Int32(32)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt32)\n        validateKeypathAverage(\"optInt64\", Int64Wrapper?.average(), Int64Wrapper(persistedValue: Int64(64)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt64)\n        validateKeypathAverage(\"optFloat\", FloatWrapper?.average(), FloatWrapper(persistedValue: Float(5.55444333)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optFloat)\n        validateKeypathAverage(\"optDouble\", DoubleWrapper?.average(), DoubleWrapper(persistedValue: 123.456),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optDouble)\n        validateKeypathAverage(\"optDecimal\", Decimal128Wrapper?.average(), Decimal128Wrapper(persistedValue: Decimal128(123.456)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optDecimal)\n    }\n\n    private func validateKeypathSum<Root: Object, T>(_ name: String, _ sum: T, _ min: T, _ lhs: (Query<Root>) -> Query<T>)\n            where T: _Persistable & QueryValue, T.PersistedType: _QueryNumeric {\n        assertQuery(Root.self, \"(list.@sum.\\(name) == %@)\", sum, count: 1) {\n            lhs($0).sum == sum\n        }\n        assertQuery(Root.self, \"(list.@sum.\\(name) == %@)\", min, count: 0) {\n            lhs($0).sum == min\n        }\n        assertQuery(Root.self, \"(list.@sum.\\(name) != %@)\", sum, count: 0) {\n            lhs($0).sum != sum\n        }\n        assertQuery(Root.self, \"(list.@sum.\\(name) != %@)\", min, count: 1) {\n            lhs($0).sum != min\n        }\n        assertQuery(Root.self, \"(list.@sum.\\(name) > %@)\", sum, count: 0) {\n            lhs($0).sum > sum\n        }\n        assertQuery(Root.self, \"(list.@sum.\\(name) > %@)\", min, count: 1) {\n            lhs($0).sum > min\n        }\n        assertQuery(Root.self, \"(list.@sum.\\(name) < %@)\", sum, count: 0) {\n            lhs($0).sum < sum\n        }\n        assertQuery(Root.self, \"(list.@sum.\\(name) >= %@)\", sum, count: 1) {\n            lhs($0).sum >= sum\n        }\n        assertQuery(Root.self, \"(list.@sum.\\(name) <= %@)\", sum, count: 1) {\n            lhs($0).sum <= sum\n        }\n    }\n\n    func testKeypathCollectionAggregatesSum() {\n        createKeypathCollectionAggregatesObject()\n\n        validateKeypathSum(\"intCol\", Int.sum(), 1,\n                    \\Query<LinkToModernAllTypesObject>.list.intCol)\n        validateKeypathSum(\"int8Col\", Int8.sum(), Int8(8),\n                    \\Query<LinkToModernAllTypesObject>.list.int8Col)\n        validateKeypathSum(\"int16Col\", Int16.sum(), Int16(16),\n                    \\Query<LinkToModernAllTypesObject>.list.int16Col)\n        validateKeypathSum(\"int32Col\", Int32.sum(), Int32(32),\n                    \\Query<LinkToModernAllTypesObject>.list.int32Col)\n        validateKeypathSum(\"int64Col\", Int64.sum(), Int64(64),\n                    \\Query<LinkToModernAllTypesObject>.list.int64Col)\n        validateKeypathSum(\"floatCol\", Float.sum(), Float(5.55444333),\n                    \\Query<LinkToModernAllTypesObject>.list.floatCol)\n        validateKeypathSum(\"doubleCol\", Double.sum(), 123.456,\n                    \\Query<LinkToModernAllTypesObject>.list.doubleCol)\n        validateKeypathSum(\"decimalCol\", Decimal128.sum(), Decimal128(123.456),\n                    \\Query<LinkToModernAllTypesObject>.list.decimalCol)\n        validateKeypathSum(\"intEnumCol\", ModernIntEnum.sum(), ModernIntEnum.value1.rawValue,\n                    \\Query<LinkToModernAllTypesObject>.list.intEnumCol.rawValue)\n        validateKeypathSum(\"int\", IntWrapper.sum(), IntWrapper(persistedValue: 1),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int)\n        validateKeypathSum(\"int8\", Int8Wrapper.sum(), Int8Wrapper(persistedValue: Int8(8)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int8)\n        validateKeypathSum(\"int16\", Int16Wrapper.sum(), Int16Wrapper(persistedValue: Int16(16)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int16)\n        validateKeypathSum(\"int32\", Int32Wrapper.sum(), Int32Wrapper(persistedValue: Int32(32)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int32)\n        validateKeypathSum(\"int64\", Int64Wrapper.sum(), Int64Wrapper(persistedValue: Int64(64)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int64)\n        validateKeypathSum(\"float\", FloatWrapper.sum(), FloatWrapper(persistedValue: Float(5.55444333)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.float)\n        validateKeypathSum(\"double\", DoubleWrapper.sum(), DoubleWrapper(persistedValue: 123.456),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.double)\n        validateKeypathSum(\"decimal\", Decimal128Wrapper.sum(), Decimal128Wrapper(persistedValue: Decimal128(123.456)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.decimal)\n        validateKeypathSum(\"optIntCol\", Int?.sum(), 1,\n                    \\Query<LinkToModernAllTypesObject>.list.optIntCol)\n        validateKeypathSum(\"optInt8Col\", Int8?.sum(), Int8(8),\n                    \\Query<LinkToModernAllTypesObject>.list.optInt8Col)\n        validateKeypathSum(\"optInt16Col\", Int16?.sum(), Int16(16),\n                    \\Query<LinkToModernAllTypesObject>.list.optInt16Col)\n        validateKeypathSum(\"optInt32Col\", Int32?.sum(), Int32(32),\n                    \\Query<LinkToModernAllTypesObject>.list.optInt32Col)\n        validateKeypathSum(\"optInt64Col\", Int64?.sum(), Int64(64),\n                    \\Query<LinkToModernAllTypesObject>.list.optInt64Col)\n        validateKeypathSum(\"optFloatCol\", Float?.sum(), Float(5.55444333),\n                    \\Query<LinkToModernAllTypesObject>.list.optFloatCol)\n        validateKeypathSum(\"optDoubleCol\", Double?.sum(), 123.456,\n                    \\Query<LinkToModernAllTypesObject>.list.optDoubleCol)\n        validateKeypathSum(\"optDecimalCol\", Decimal128?.sum(), Decimal128(123.456),\n                    \\Query<LinkToModernAllTypesObject>.list.optDecimalCol)\n        validateKeypathSum(\"optIntEnumCol\", ModernIntEnum.sum(), ModernIntEnum.value1.rawValue,\n                    \\Query<LinkToModernAllTypesObject>.list.optIntEnumCol.rawValue)\n        validateKeypathSum(\"optInt\", IntWrapper?.sum(), IntWrapper(persistedValue: 1),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt)\n        validateKeypathSum(\"optInt8\", Int8Wrapper?.sum(), Int8Wrapper(persistedValue: Int8(8)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt8)\n        validateKeypathSum(\"optInt16\", Int16Wrapper?.sum(), Int16Wrapper(persistedValue: Int16(16)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt16)\n        validateKeypathSum(\"optInt32\", Int32Wrapper?.sum(), Int32Wrapper(persistedValue: Int32(32)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt32)\n        validateKeypathSum(\"optInt64\", Int64Wrapper?.sum(), Int64Wrapper(persistedValue: Int64(64)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt64)\n        validateKeypathSum(\"optFloat\", FloatWrapper?.sum(), FloatWrapper(persistedValue: Float(5.55444333)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optFloat)\n        validateKeypathSum(\"optDouble\", DoubleWrapper?.sum(), DoubleWrapper(persistedValue: 123.456),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optDouble)\n        validateKeypathSum(\"optDecimal\", Decimal128Wrapper?.sum(), Decimal128Wrapper(persistedValue: Decimal128(123.456)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optDecimal)\n    }\n\n\n    private func validateKeypathMin<Root: Object, T>(_ name: String, min: T, max: T, _ lhs: (Query<Root>) -> Query<T>)\n            where T: _Persistable & QueryValue, T.PersistedType: _QueryNumeric {\n        assertQuery(Root.self, \"(list.@min.\\(name) == %@)\", min, count: 1) {\n            lhs($0).min == min\n        }\n        assertQuery(Root.self, \"(list.@min.\\(name) == %@)\", max, count: 0) {\n            lhs($0).min == max\n        }\n        assertQuery(Root.self, \"(list.@min.\\(name) != %@)\", min, count: 0) {\n            lhs($0).min != min\n        }\n        assertQuery(Root.self, \"(list.@min.\\(name) != %@)\", max, count: 1) {\n            lhs($0).min != max\n        }\n        assertQuery(Root.self, \"(list.@min.\\(name) > %@)\", min, count: 0) {\n            lhs($0).min > min\n        }\n        assertQuery(Root.self, \"(list.@min.\\(name) < %@)\", min, count: 0) {\n            lhs($0).min < min\n        }\n        assertQuery(Root.self, \"(list.@min.\\(name) >= %@)\", min, count: 1) {\n            lhs($0).min >= min\n        }\n        assertQuery(Root.self, \"(list.@min.\\(name) <= %@)\", min, count: 1) {\n            lhs($0).min <= min\n        }\n    }\n\n    func testKeypathCollectionAggregatesMin() {\n        createKeypathCollectionAggregatesObject()\n\n        validateKeypathMin(\"intCol\", min: 1, max: 5,\n                    \\Query<LinkToModernAllTypesObject>.list.intCol)\n        validateKeypathMin(\"int8Col\", min: Int8(8), max: Int8(10),\n                    \\Query<LinkToModernAllTypesObject>.list.int8Col)\n        validateKeypathMin(\"int16Col\", min: Int16(16), max: Int16(18),\n                    \\Query<LinkToModernAllTypesObject>.list.int16Col)\n        validateKeypathMin(\"int32Col\", min: Int32(32), max: Int32(34),\n                    \\Query<LinkToModernAllTypesObject>.list.int32Col)\n        validateKeypathMin(\"int64Col\", min: Int64(64), max: Int64(66),\n                    \\Query<LinkToModernAllTypesObject>.list.int64Col)\n        validateKeypathMin(\"floatCol\", min: Float(5.55444333), max: Float(7.55444333),\n                    \\Query<LinkToModernAllTypesObject>.list.floatCol)\n        validateKeypathMin(\"doubleCol\", min: 123.456, max: 345.678,\n                    \\Query<LinkToModernAllTypesObject>.list.doubleCol)\n        validateKeypathMin(\"dateCol\", min: Date(timeIntervalSince1970: 1000000), max: Date(timeIntervalSince1970: 3000000),\n                    \\Query<LinkToModernAllTypesObject>.list.dateCol)\n        validateKeypathMin(\"decimalCol\", min: Decimal128(123.456), max: Decimal128(345.678),\n                    \\Query<LinkToModernAllTypesObject>.list.decimalCol)\n        validateKeypathMin(\"intEnumCol\", min: ModernIntEnum.value1.rawValue, max: ModernIntEnum.value3.rawValue,\n                    \\Query<LinkToModernAllTypesObject>.list.intEnumCol.rawValue)\n        validateKeypathMin(\"int\", min: IntWrapper(persistedValue: 1), max: IntWrapper(persistedValue: 5),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int)\n        validateKeypathMin(\"int8\", min: Int8Wrapper(persistedValue: Int8(8)), max: Int8Wrapper(persistedValue: Int8(10)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int8)\n        validateKeypathMin(\"int16\", min: Int16Wrapper(persistedValue: Int16(16)), max: Int16Wrapper(persistedValue: Int16(18)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int16)\n        validateKeypathMin(\"int32\", min: Int32Wrapper(persistedValue: Int32(32)), max: Int32Wrapper(persistedValue: Int32(34)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int32)\n        validateKeypathMin(\"int64\", min: Int64Wrapper(persistedValue: Int64(64)), max: Int64Wrapper(persistedValue: Int64(66)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int64)\n        validateKeypathMin(\"float\", min: FloatWrapper(persistedValue: Float(5.55444333)), max: FloatWrapper(persistedValue: Float(7.55444333)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.float)\n        validateKeypathMin(\"double\", min: DoubleWrapper(persistedValue: 123.456), max: DoubleWrapper(persistedValue: 345.678),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.double)\n        validateKeypathMin(\"date\", min: DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), max: DateWrapper(persistedValue: Date(timeIntervalSince1970: 3000000)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.date)\n        validateKeypathMin(\"decimal\", min: Decimal128Wrapper(persistedValue: Decimal128(123.456)), max: Decimal128Wrapper(persistedValue: Decimal128(345.678)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.decimal)\n        validateKeypathMin(\"optIntCol\", min: 1, max: 5,\n                    \\Query<LinkToModernAllTypesObject>.list.optIntCol)\n        validateKeypathMin(\"optInt8Col\", min: Int8(8), max: Int8(10),\n                    \\Query<LinkToModernAllTypesObject>.list.optInt8Col)\n        validateKeypathMin(\"optInt16Col\", min: Int16(16), max: Int16(18),\n                    \\Query<LinkToModernAllTypesObject>.list.optInt16Col)\n        validateKeypathMin(\"optInt32Col\", min: Int32(32), max: Int32(34),\n                    \\Query<LinkToModernAllTypesObject>.list.optInt32Col)\n        validateKeypathMin(\"optInt64Col\", min: Int64(64), max: Int64(66),\n                    \\Query<LinkToModernAllTypesObject>.list.optInt64Col)\n        validateKeypathMin(\"optFloatCol\", min: Float(5.55444333), max: Float(7.55444333),\n                    \\Query<LinkToModernAllTypesObject>.list.optFloatCol)\n        validateKeypathMin(\"optDoubleCol\", min: 123.456, max: 345.678,\n                    \\Query<LinkToModernAllTypesObject>.list.optDoubleCol)\n        validateKeypathMin(\"optDateCol\", min: Date(timeIntervalSince1970: 1000000), max: Date(timeIntervalSince1970: 3000000),\n                    \\Query<LinkToModernAllTypesObject>.list.optDateCol)\n        validateKeypathMin(\"optDecimalCol\", min: Decimal128(123.456), max: Decimal128(345.678),\n                    \\Query<LinkToModernAllTypesObject>.list.optDecimalCol)\n        validateKeypathMin(\"optIntEnumCol\", min: ModernIntEnum.value1.rawValue, max: ModernIntEnum.value3.rawValue,\n                    \\Query<LinkToModernAllTypesObject>.list.optIntEnumCol.rawValue)\n        validateKeypathMin(\"optInt\", min: IntWrapper(persistedValue: 1), max: IntWrapper(persistedValue: 5),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt)\n        validateKeypathMin(\"optInt8\", min: Int8Wrapper(persistedValue: Int8(8)), max: Int8Wrapper(persistedValue: Int8(10)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt8)\n        validateKeypathMin(\"optInt16\", min: Int16Wrapper(persistedValue: Int16(16)), max: Int16Wrapper(persistedValue: Int16(18)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt16)\n        validateKeypathMin(\"optInt32\", min: Int32Wrapper(persistedValue: Int32(32)), max: Int32Wrapper(persistedValue: Int32(34)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt32)\n        validateKeypathMin(\"optInt64\", min: Int64Wrapper(persistedValue: Int64(64)), max: Int64Wrapper(persistedValue: Int64(66)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt64)\n        validateKeypathMin(\"optFloat\", min: FloatWrapper(persistedValue: Float(5.55444333)), max: FloatWrapper(persistedValue: Float(7.55444333)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optFloat)\n        validateKeypathMin(\"optDouble\", min: DoubleWrapper(persistedValue: 123.456), max: DoubleWrapper(persistedValue: 345.678),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optDouble)\n        validateKeypathMin(\"optDate\", min: DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), max: DateWrapper(persistedValue: Date(timeIntervalSince1970: 3000000)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optDate)\n        validateKeypathMin(\"optDecimal\", min: Decimal128Wrapper(persistedValue: Decimal128(123.456)), max: Decimal128Wrapper(persistedValue: Decimal128(345.678)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optDecimal)\n    }\n\n    private func validateKeypathMax<Root: Object, T>(_ name: String, min: T, max: T, _ lhs: (Query<Root>) -> Query<T>)\n            where T: _Persistable & QueryValue, T.PersistedType: _QueryNumeric {\n        assertQuery(Root.self, \"(list.@max.\\(name) == %@)\", max, count: 1) {\n            lhs($0).max == max\n        }\n        assertQuery(Root.self, \"(list.@max.\\(name) == %@)\", min, count: 0) {\n            lhs($0).max == min\n        }\n        assertQuery(Root.self, \"(list.@max.\\(name) != %@)\", max, count: 0) {\n            lhs($0).max != max\n        }\n        assertQuery(Root.self, \"(list.@max.\\(name) != %@)\", min, count: 1) {\n            lhs($0).max != min\n        }\n        assertQuery(Root.self, \"(list.@max.\\(name) > %@)\", max, count: 0) {\n            lhs($0).max > max\n        }\n        assertQuery(Root.self, \"(list.@max.\\(name) < %@)\", max, count: 0) {\n            lhs($0).max < max\n        }\n        assertQuery(Root.self, \"(list.@max.\\(name) >= %@)\", max, count: 1) {\n            lhs($0).max >= max\n        }\n        assertQuery(Root.self, \"(list.@max.\\(name) <= %@)\", max, count: 1) {\n            lhs($0).max <= max\n        }\n    }\n\n    func testKeypathCollectionAggregatesMax() {\n        createKeypathCollectionAggregatesObject()\n\n        validateKeypathMax(\"intCol\", min: 1, max: 5,\n                    \\Query<LinkToModernAllTypesObject>.list.intCol)\n        validateKeypathMax(\"int8Col\", min: Int8(8), max: Int8(10),\n                    \\Query<LinkToModernAllTypesObject>.list.int8Col)\n        validateKeypathMax(\"int16Col\", min: Int16(16), max: Int16(18),\n                    \\Query<LinkToModernAllTypesObject>.list.int16Col)\n        validateKeypathMax(\"int32Col\", min: Int32(32), max: Int32(34),\n                    \\Query<LinkToModernAllTypesObject>.list.int32Col)\n        validateKeypathMax(\"int64Col\", min: Int64(64), max: Int64(66),\n                    \\Query<LinkToModernAllTypesObject>.list.int64Col)\n        validateKeypathMax(\"floatCol\", min: Float(5.55444333), max: Float(7.55444333),\n                    \\Query<LinkToModernAllTypesObject>.list.floatCol)\n        validateKeypathMax(\"doubleCol\", min: 123.456, max: 345.678,\n                    \\Query<LinkToModernAllTypesObject>.list.doubleCol)\n        validateKeypathMax(\"dateCol\", min: Date(timeIntervalSince1970: 1000000), max: Date(timeIntervalSince1970: 3000000),\n                    \\Query<LinkToModernAllTypesObject>.list.dateCol)\n        validateKeypathMax(\"decimalCol\", min: Decimal128(123.456), max: Decimal128(345.678),\n                    \\Query<LinkToModernAllTypesObject>.list.decimalCol)\n        validateKeypathMax(\"intEnumCol\", min: ModernIntEnum.value1.rawValue, max: ModernIntEnum.value3.rawValue,\n                    \\Query<LinkToModernAllTypesObject>.list.intEnumCol.rawValue)\n        validateKeypathMax(\"int\", min: IntWrapper(persistedValue: 1), max: IntWrapper(persistedValue: 5),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int)\n        validateKeypathMax(\"int8\", min: Int8Wrapper(persistedValue: Int8(8)), max: Int8Wrapper(persistedValue: Int8(10)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int8)\n        validateKeypathMax(\"int16\", min: Int16Wrapper(persistedValue: Int16(16)), max: Int16Wrapper(persistedValue: Int16(18)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int16)\n        validateKeypathMax(\"int32\", min: Int32Wrapper(persistedValue: Int32(32)), max: Int32Wrapper(persistedValue: Int32(34)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int32)\n        validateKeypathMax(\"int64\", min: Int64Wrapper(persistedValue: Int64(64)), max: Int64Wrapper(persistedValue: Int64(66)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.int64)\n        validateKeypathMax(\"float\", min: FloatWrapper(persistedValue: Float(5.55444333)), max: FloatWrapper(persistedValue: Float(7.55444333)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.float)\n        validateKeypathMax(\"double\", min: DoubleWrapper(persistedValue: 123.456), max: DoubleWrapper(persistedValue: 345.678),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.double)\n        validateKeypathMax(\"date\", min: DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), max: DateWrapper(persistedValue: Date(timeIntervalSince1970: 3000000)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.date)\n        validateKeypathMax(\"decimal\", min: Decimal128Wrapper(persistedValue: Decimal128(123.456)), max: Decimal128Wrapper(persistedValue: Decimal128(345.678)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.decimal)\n        validateKeypathMax(\"optIntCol\", min: 1, max: 5,\n                    \\Query<LinkToModernAllTypesObject>.list.optIntCol)\n        validateKeypathMax(\"optInt8Col\", min: Int8(8), max: Int8(10),\n                    \\Query<LinkToModernAllTypesObject>.list.optInt8Col)\n        validateKeypathMax(\"optInt16Col\", min: Int16(16), max: Int16(18),\n                    \\Query<LinkToModernAllTypesObject>.list.optInt16Col)\n        validateKeypathMax(\"optInt32Col\", min: Int32(32), max: Int32(34),\n                    \\Query<LinkToModernAllTypesObject>.list.optInt32Col)\n        validateKeypathMax(\"optInt64Col\", min: Int64(64), max: Int64(66),\n                    \\Query<LinkToModernAllTypesObject>.list.optInt64Col)\n        validateKeypathMax(\"optFloatCol\", min: Float(5.55444333), max: Float(7.55444333),\n                    \\Query<LinkToModernAllTypesObject>.list.optFloatCol)\n        validateKeypathMax(\"optDoubleCol\", min: 123.456, max: 345.678,\n                    \\Query<LinkToModernAllTypesObject>.list.optDoubleCol)\n        validateKeypathMax(\"optDateCol\", min: Date(timeIntervalSince1970: 1000000), max: Date(timeIntervalSince1970: 3000000),\n                    \\Query<LinkToModernAllTypesObject>.list.optDateCol)\n        validateKeypathMax(\"optDecimalCol\", min: Decimal128(123.456), max: Decimal128(345.678),\n                    \\Query<LinkToModernAllTypesObject>.list.optDecimalCol)\n        validateKeypathMax(\"optIntEnumCol\", min: ModernIntEnum.value1.rawValue, max: ModernIntEnum.value3.rawValue,\n                    \\Query<LinkToModernAllTypesObject>.list.optIntEnumCol.rawValue)\n        validateKeypathMax(\"optInt\", min: IntWrapper(persistedValue: 1), max: IntWrapper(persistedValue: 5),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt)\n        validateKeypathMax(\"optInt8\", min: Int8Wrapper(persistedValue: Int8(8)), max: Int8Wrapper(persistedValue: Int8(10)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt8)\n        validateKeypathMax(\"optInt16\", min: Int16Wrapper(persistedValue: Int16(16)), max: Int16Wrapper(persistedValue: Int16(18)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt16)\n        validateKeypathMax(\"optInt32\", min: Int32Wrapper(persistedValue: Int32(32)), max: Int32Wrapper(persistedValue: Int32(34)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt32)\n        validateKeypathMax(\"optInt64\", min: Int64Wrapper(persistedValue: Int64(64)), max: Int64Wrapper(persistedValue: Int64(66)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optInt64)\n        validateKeypathMax(\"optFloat\", min: FloatWrapper(persistedValue: Float(5.55444333)), max: FloatWrapper(persistedValue: Float(7.55444333)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optFloat)\n        validateKeypathMax(\"optDouble\", min: DoubleWrapper(persistedValue: 123.456), max: DoubleWrapper(persistedValue: 345.678),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optDouble)\n        validateKeypathMax(\"optDate\", min: DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), max: DateWrapper(persistedValue: Date(timeIntervalSince1970: 3000000)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optDate)\n        validateKeypathMax(\"optDecimal\", min: Decimal128Wrapper(persistedValue: Decimal128(123.456)), max: Decimal128Wrapper(persistedValue: Decimal128(345.678)),\n                    \\Query<LinkToAllCustomPersistableTypes>.list.optDecimal)\n    }\n\n    func testAggregateNotSupported() {\n        assertThrows(assertQuery(\"\", count: 0) { $0.intCol.avg == 1 },\n                     reason: \"Invalid keypath 'intCol.@avg': Property 'ModernAllTypesObject.intCol' is not a link or collection and can only appear at the end of a keypath.\")\n\n        assertThrows(assertQuery(\"\", count: 0) { $0.doubleCol.max != 1 },\n                     reason: \"Invalid keypath 'doubleCol.@max': Property 'ModernAllTypesObject.doubleCol' is not a link or collection and can only appear at the end of a keypath.\")\n\n        assertThrows(assertQuery(\"\", count: 0) { $0.dateCol.min > Date() },\n                     reason: \"Invalid keypath 'dateCol.@min': Property 'ModernAllTypesObject.dateCol' is not a link or collection and can only appear at the end of a keypath.\")\n\n        assertThrows(assertQuery(\"\", count: 0) { $0.decimalCol.sum < 1 },\n                     reason: \"Invalid keypath 'decimalCol.@sum': Property 'ModernAllTypesObject.decimalCol' is not a link or collection and can only appear at the end of a keypath.\")\n    }\n\n    // MARK: Column comparison\n\n    func testColumnComparison() {\n        // Basic comparison\n\n        assertQuery(\"(stringEnumCol == stringEnumCol)\", count: 1) {\n            $0.stringEnumCol == $0.stringEnumCol\n        }\n\n        assertQuery(\"(stringCol != stringCol)\", count: 0) {\n            $0.stringCol != $0.stringCol\n        }\n\n        assertQuery(\"(stringEnumCol != stringEnumCol)\", count: 0) {\n            $0.stringEnumCol != $0.stringEnumCol\n        }\n\n        assertQuery(\"(stringEnumCol > stringEnumCol)\", count: 0) {\n            $0.stringEnumCol > $0.stringEnumCol\n        }\n\n        assertQuery(\"(stringCol > stringCol)\", count: 0) {\n            $0.stringCol > $0.stringCol\n        }\n\n        assertQuery(\"(stringEnumCol >= stringEnumCol)\", count: 1) {\n            $0.stringEnumCol >= $0.stringEnumCol\n        }\n\n        assertQuery(\"(stringCol >= stringCol)\", count: 1) {\n            $0.stringCol >= $0.stringCol\n        }\n\n        assertQuery(\"(stringEnumCol < stringEnumCol)\", count: 0) {\n            $0.stringEnumCol < $0.stringEnumCol\n        }\n\n        assertQuery(\"(stringCol < stringCol)\", count: 0) {\n            $0.stringCol < $0.stringCol\n        }\n\n        assertQuery(\"(stringEnumCol <= stringEnumCol)\", count: 1) {\n            $0.stringEnumCol <= $0.stringEnumCol\n        }\n\n        assertQuery(\"(stringCol <= stringCol)\", count: 1) {\n            $0.stringCol <= $0.stringCol\n        }\n\n        assertThrows(assertQuery(\"\", count: 1) {\n            $0.arrayCol == $0.arrayCol\n        }, reason: \"Comparing two collection columns is not permitted.\")\n\n        assertThrows(assertQuery(\"\", count: 1) {\n            $0.arrayCol != $0.arrayCol\n        }, reason: \"Comparing two collection columns is not permitted.\")\n\n        assertQuery(\"(intCol > intCol)\", count: 0) {\n            $0.intCol > $0.intCol\n        }\n\n        assertQuery(\"(intEnumCol > intEnumCol)\", count: 0) {\n            $0.intEnumCol > $0.intEnumCol\n        }\n\n        assertQuery(\"(intCol >= intCol)\", count: 1) {\n            $0.intCol >= $0.intCol\n        }\n\n        assertQuery(\"(intEnumCol >= intEnumCol)\", count: 1) {\n            $0.intEnumCol >= $0.intEnumCol\n        }\n\n        assertQuery(\"(intCol < intCol)\", count: 0) {\n            $0.intCol < $0.intCol\n        }\n\n        assertQuery(\"(intEnumCol < intEnumCol)\", count: 0) {\n            $0.intEnumCol < $0.intEnumCol\n        }\n\n        assertQuery(\"(intCol <= intCol)\", count: 1) {\n            $0.intCol <= $0.intCol\n        }\n\n        assertQuery(\"(intEnumCol <= intEnumCol)\", count: 1) {\n            $0.intEnumCol <= $0.intEnumCol\n        }\n\n        assertQuery(\"(optStringCol == optStringCol)\", count: 1) {\n            $0.optStringCol == $0.optStringCol\n        }\n\n        assertQuery(\"(optStringCol != optStringCol)\", count: 0) {\n            $0.optStringCol != $0.optStringCol\n        }\n\n        assertQuery(\"(optIntCol > optIntCol)\", count: 0) {\n            $0.optIntCol > $0.optIntCol\n        }\n\n        assertQuery(\"(optIntCol >= optIntCol)\", count: 1) {\n            $0.optIntCol >= $0.optIntCol\n        }\n\n        assertQuery(\"(optIntCol < optIntCol)\", count: 0) {\n            $0.optIntCol < $0.optIntCol\n        }\n\n        assertQuery(\"(optIntCol <= optIntCol)\", count: 1) {\n            $0.optIntCol <= $0.optIntCol\n        }\n\n        // Basic comparison with one level depth\n\n        assertQuery(\"(objectCol.stringCol == objectCol.stringCol)\", count: 1) {\n            $0.objectCol.stringCol == $0.objectCol.stringCol\n        }\n\n        assertQuery(\"(objectCol.stringCol != objectCol.stringCol)\", count: 0) {\n            $0.objectCol.stringCol != $0.objectCol.stringCol\n        }\n\n        assertQuery(\"(objectCol.intCol > objectCol.intCol)\", count: 0) {\n            $0.objectCol.intCol > $0.objectCol.intCol\n        }\n\n        assertQuery(\"(objectCol.intCol >= objectCol.intCol)\", count: 1) {\n            $0.objectCol.intCol >= $0.objectCol.intCol\n        }\n\n        assertQuery(\"(objectCol.intCol < objectCol.intCol)\", count: 0) {\n            $0.objectCol.intCol < $0.objectCol.intCol\n        }\n\n        assertQuery(\"(objectCol.intCol <= objectCol.intCol)\", count: 1) {\n            $0.objectCol.intCol <= $0.objectCol.intCol\n        }\n\n        assertQuery(\"(objectCol.optStringCol == objectCol.optStringCol)\", count: 1) {\n            $0.objectCol.optStringCol == $0.objectCol.optStringCol\n        }\n\n        assertQuery(\"(objectCol.optStringCol != objectCol.optStringCol)\", count: 0) {\n            $0.objectCol.optStringCol != $0.objectCol.optStringCol\n        }\n\n        assertQuery(\"(objectCol.optIntCol > objectCol.optIntCol)\", count: 0) {\n            $0.objectCol.optIntCol > $0.objectCol.optIntCol\n        }\n\n        assertQuery(\"(objectCol.optIntCol >= objectCol.optIntCol)\", count: 1) {\n            $0.objectCol.optIntCol >= $0.objectCol.optIntCol\n        }\n\n        assertQuery(\"(objectCol.optIntCol < objectCol.optIntCol)\", count: 0) {\n            $0.objectCol.optIntCol < $0.objectCol.optIntCol\n        }\n\n        assertQuery(\"(objectCol.optIntCol <= objectCol.optIntCol)\", count: 1) {\n            $0.objectCol.optIntCol <= $0.objectCol.optIntCol\n        }\n\n        // String comparison\n\n        assertQuery(\"(stringCol CONTAINS[cd] stringCol)\", count: 1) {\n            $0.stringCol.contains($0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(stringCol BEGINSWITH[cd] stringCol)\", count: 1) {\n            $0.stringCol.starts(with: $0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(stringCol ENDSWITH[cd] stringCol)\", count: 1) {\n            $0.stringCol.ends(with: $0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(stringCol LIKE[c] stringCol)\", count: 1) {\n            $0.stringCol.like($0.stringCol, caseInsensitive: true)\n        }\n\n        assertQuery(\"(stringCol ==[cd] stringCol)\", count: 1) {\n            $0.stringCol.equals($0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(stringCol !=[cd] stringCol)\", count: 0) {\n            $0.stringCol.notEquals($0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        // String with optional col\n\n        assertQuery(\"(stringCol CONTAINS[cd] optStringCol)\", count: 1) {\n            $0.stringCol.contains($0.optStringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol CONTAINS[cd] optStringCol)\", count: 1) {\n            $0.optStringCol.contains($0.optStringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol CONTAINS[cd] stringCol)\", count: 1) {\n            $0.optStringCol.contains($0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(stringCol BEGINSWITH[cd] stringCol)\", count: 1) {\n            $0.stringCol.starts(with: $0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol BEGINSWITH[cd] optStringCol)\", count: 1) {\n            $0.optStringCol.starts(with: $0.optStringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol BEGINSWITH[cd] stringCol)\", count: 1) {\n            $0.optStringCol.starts(with: $0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(stringCol ENDSWITH[cd] stringCol)\", count: 1) {\n            $0.stringCol.ends(with: $0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol ENDSWITH[cd] optStringCol)\", count: 1) {\n            $0.optStringCol.ends(with: $0.optStringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol ENDSWITH[cd] stringCol)\", count: 1) {\n            $0.optStringCol.ends(with: $0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(stringCol LIKE[c] stringCol)\", count: 1) {\n            $0.stringCol.like($0.stringCol, caseInsensitive: true)\n        }\n\n        assertQuery(\"(optStringCol LIKE[c] optStringCol)\", count: 1) {\n            $0.optStringCol.like($0.optStringCol, caseInsensitive: true)\n        }\n\n        assertQuery(\"(optStringCol LIKE[c] stringCol)\", count: 1) {\n            $0.optStringCol.like($0.stringCol, caseInsensitive: true)\n        }\n\n        assertQuery(\"(stringCol ==[cd] stringCol)\", count: 1) {\n            $0.stringCol.equals($0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol ==[cd] optStringCol)\", count: 1) {\n            $0.optStringCol.equals($0.optStringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol ==[cd] stringCol)\", count: 1) {\n            $0.optStringCol.equals($0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(stringCol !=[cd] stringCol)\", count: 0) {\n            $0.stringCol.notEquals($0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol !=[cd] optStringCol)\", count: 0) {\n            $0.optStringCol.notEquals($0.optStringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol !=[cd] stringCol)\", count: 0) {\n            $0.optStringCol.notEquals($0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n    }\n\n    // MARK: - ContainsIn\n\n    func testContainsIn() {\n\n        assertQuery(ModernAllTypesObject.self, \"(boolCol IN %@)\",\n                    values: [NSArray(array: [true, false])], count: 1) {\n            $0.boolCol.in([true, false])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT boolCol IN %@)\",\n                    values: [NSArray(array: [false])], count: 0) {\n            !$0.boolCol.in([false])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(intCol IN %@)\",\n                    values: [NSArray(array: [1, 3])], count: 1) {\n            $0.intCol.in([1, 3])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT intCol IN %@)\",\n                    values: [NSArray(array: [3])], count: 0) {\n            !$0.intCol.in([3])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(int8Col IN %@)\",\n                    values: [NSArray(array: [Int8(8), Int8(9)])], count: 1) {\n            $0.int8Col.in([Int8(8), Int8(9)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT int8Col IN %@)\",\n                    values: [NSArray(array: [Int8(9)])], count: 0) {\n            !$0.int8Col.in([Int8(9)])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(int16Col IN %@)\",\n                    values: [NSArray(array: [Int16(16), Int16(17)])], count: 1) {\n            $0.int16Col.in([Int16(16), Int16(17)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT int16Col IN %@)\",\n                    values: [NSArray(array: [Int16(17)])], count: 0) {\n            !$0.int16Col.in([Int16(17)])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(int32Col IN %@)\",\n                    values: [NSArray(array: [Int32(32), Int32(33)])], count: 1) {\n            $0.int32Col.in([Int32(32), Int32(33)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT int32Col IN %@)\",\n                    values: [NSArray(array: [Int32(33)])], count: 0) {\n            !$0.int32Col.in([Int32(33)])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(int64Col IN %@)\",\n                    values: [NSArray(array: [Int64(64), Int64(65)])], count: 1) {\n            $0.int64Col.in([Int64(64), Int64(65)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT int64Col IN %@)\",\n                    values: [NSArray(array: [Int64(65)])], count: 0) {\n            !$0.int64Col.in([Int64(65)])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(floatCol IN %@)\",\n                    values: [NSArray(array: [Float(5.55444333), Float(6.55444333)])], count: 1) {\n            $0.floatCol.in([Float(5.55444333), Float(6.55444333)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT floatCol IN %@)\",\n                    values: [NSArray(array: [Float(6.55444333)])], count: 0) {\n            !$0.floatCol.in([Float(6.55444333)])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(doubleCol IN %@)\",\n                    values: [NSArray(array: [123.456, 234.567])], count: 1) {\n            $0.doubleCol.in([123.456, 234.567])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT doubleCol IN %@)\",\n                    values: [NSArray(array: [234.567])], count: 0) {\n            !$0.doubleCol.in([234.567])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(stringCol IN %@)\",\n                    values: [NSArray(array: [\"Foo\", \"Foó\"])], count: 1) {\n            $0.stringCol.in([\"Foo\", \"Foó\"])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT stringCol IN %@)\",\n                    values: [NSArray(array: [\"Foó\"])], count: 0) {\n            !$0.stringCol.in([\"Foó\"])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(binaryCol IN %@)\",\n                    values: [NSArray(array: [Data(count: 64), Data(count: 128)])], count: 1) {\n            $0.binaryCol.in([Data(count: 64), Data(count: 128)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT binaryCol IN %@)\",\n                    values: [NSArray(array: [Data(count: 128)])], count: 0) {\n            !$0.binaryCol.in([Data(count: 128)])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(dateCol IN %@)\",\n                    values: [NSArray(array: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])], count: 1) {\n            $0.dateCol.in([Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT dateCol IN %@)\",\n                    values: [NSArray(array: [Date(timeIntervalSince1970: 2000000)])], count: 0) {\n            !$0.dateCol.in([Date(timeIntervalSince1970: 2000000)])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(decimalCol IN %@)\",\n                    values: [NSArray(array: [Decimal128(123.456), Decimal128(234.567)])], count: 1) {\n            $0.decimalCol.in([Decimal128(123.456), Decimal128(234.567)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT decimalCol IN %@)\",\n                    values: [NSArray(array: [Decimal128(234.567)])], count: 0) {\n            !$0.decimalCol.in([Decimal128(234.567)])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(objectIdCol IN %@)\",\n                    values: [NSArray(array: [ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])], count: 1) {\n            $0.objectIdCol.in([ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT objectIdCol IN %@)\",\n                    values: [NSArray(array: [ObjectId(\"61184062c1d8f096a3695045\")])], count: 0) {\n            !$0.objectIdCol.in([ObjectId(\"61184062c1d8f096a3695045\")])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(uuidCol IN %@)\",\n                    values: [NSArray(array: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])], count: 1) {\n            $0.uuidCol.in([UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT uuidCol IN %@)\",\n                    values: [NSArray(array: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])], count: 0) {\n            !$0.uuidCol.in([UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(intEnumCol IN %@)\",\n                    values: [NSArray(array: [ModernIntEnum.value1, ModernIntEnum.value2])], count: 1) {\n            $0.intEnumCol.in([ModernIntEnum.value1, ModernIntEnum.value2])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT intEnumCol IN %@)\",\n                    values: [NSArray(array: [ModernIntEnum.value2])], count: 0) {\n            !$0.intEnumCol.in([ModernIntEnum.value2])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(stringEnumCol IN %@)\",\n                    values: [NSArray(array: [ModernStringEnum.value1, ModernStringEnum.value2])], count: 1) {\n            $0.stringEnumCol.in([ModernStringEnum.value1, ModernStringEnum.value2])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT stringEnumCol IN %@)\",\n                    values: [NSArray(array: [ModernStringEnum.value2])], count: 0) {\n            !$0.stringEnumCol.in([ModernStringEnum.value2])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(bool IN %@)\",\n                    values: [NSArray(array: [BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: false)])], count: 1) {\n            $0.bool.in([BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: false)])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT bool IN %@)\",\n                    values: [NSArray(array: [BoolWrapper(persistedValue: false)])], count: 0) {\n            !$0.bool.in([BoolWrapper(persistedValue: false)])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(int IN %@)\",\n                    values: [NSArray(array: [IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])], count: 1) {\n            $0.int.in([IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT int IN %@)\",\n                    values: [NSArray(array: [IntWrapper(persistedValue: 3)])], count: 0) {\n            !$0.int.in([IntWrapper(persistedValue: 3)])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(int8 IN %@)\",\n                    values: [NSArray(array: [Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])], count: 1) {\n            $0.int8.in([Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT int8 IN %@)\",\n                    values: [NSArray(array: [Int8Wrapper(persistedValue: Int8(9))])], count: 0) {\n            !$0.int8.in([Int8Wrapper(persistedValue: Int8(9))])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(int16 IN %@)\",\n                    values: [NSArray(array: [Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])], count: 1) {\n            $0.int16.in([Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT int16 IN %@)\",\n                    values: [NSArray(array: [Int16Wrapper(persistedValue: Int16(17))])], count: 0) {\n            !$0.int16.in([Int16Wrapper(persistedValue: Int16(17))])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(int32 IN %@)\",\n                    values: [NSArray(array: [Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])], count: 1) {\n            $0.int32.in([Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT int32 IN %@)\",\n                    values: [NSArray(array: [Int32Wrapper(persistedValue: Int32(33))])], count: 0) {\n            !$0.int32.in([Int32Wrapper(persistedValue: Int32(33))])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(int64 IN %@)\",\n                    values: [NSArray(array: [Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])], count: 1) {\n            $0.int64.in([Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT int64 IN %@)\",\n                    values: [NSArray(array: [Int64Wrapper(persistedValue: Int64(65))])], count: 0) {\n            !$0.int64.in([Int64Wrapper(persistedValue: Int64(65))])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(float IN %@)\",\n                    values: [NSArray(array: [FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])], count: 1) {\n            $0.float.in([FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT float IN %@)\",\n                    values: [NSArray(array: [FloatWrapper(persistedValue: Float(6.55444333))])], count: 0) {\n            !$0.float.in([FloatWrapper(persistedValue: Float(6.55444333))])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(double IN %@)\",\n                    values: [NSArray(array: [DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])], count: 1) {\n            $0.double.in([DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT double IN %@)\",\n                    values: [NSArray(array: [DoubleWrapper(persistedValue: 234.567)])], count: 0) {\n            !$0.double.in([DoubleWrapper(persistedValue: 234.567)])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(string IN %@)\",\n                    values: [NSArray(array: [StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])], count: 1) {\n            $0.string.in([StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT string IN %@)\",\n                    values: [NSArray(array: [StringWrapper(persistedValue: \"Foó\")])], count: 0) {\n            !$0.string.in([StringWrapper(persistedValue: \"Foó\")])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(binary IN %@)\",\n                    values: [NSArray(array: [DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])], count: 1) {\n            $0.binary.in([DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT binary IN %@)\",\n                    values: [NSArray(array: [DataWrapper(persistedValue: Data(count: 128))])], count: 0) {\n            !$0.binary.in([DataWrapper(persistedValue: Data(count: 128))])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(date IN %@)\",\n                    values: [NSArray(array: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])], count: 1) {\n            $0.date.in([DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT date IN %@)\",\n                    values: [NSArray(array: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])], count: 0) {\n            !$0.date.in([DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(decimal IN %@)\",\n                    values: [NSArray(array: [Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])], count: 1) {\n            $0.decimal.in([Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT decimal IN %@)\",\n                    values: [NSArray(array: [Decimal128Wrapper(persistedValue: Decimal128(234.567))])], count: 0) {\n            !$0.decimal.in([Decimal128Wrapper(persistedValue: Decimal128(234.567))])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(objectId IN %@)\",\n                    values: [NSArray(array: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])], count: 1) {\n            $0.objectId.in([ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT objectId IN %@)\",\n                    values: [NSArray(array: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])], count: 0) {\n            !$0.objectId.in([ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(uuid IN %@)\",\n                    values: [NSArray(array: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])], count: 1) {\n            $0.uuid.in([UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT uuid IN %@)\",\n                    values: [NSArray(array: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])], count: 0) {\n            !$0.uuid.in([UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(optBoolCol IN %@)\",\n                    values: [NSArray(array: [true, false])], count: 1) {\n            $0.optBoolCol.in([true, false])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT optBoolCol IN %@)\",\n                    values: [NSArray(array: [false])], count: 0) {\n            !$0.optBoolCol.in([false])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(optIntCol IN %@)\",\n                    values: [NSArray(array: [1, 3])], count: 1) {\n            $0.optIntCol.in([1, 3])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT optIntCol IN %@)\",\n                    values: [NSArray(array: [3])], count: 0) {\n            !$0.optIntCol.in([3])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(optInt8Col IN %@)\",\n                    values: [NSArray(array: [Int8(8), Int8(9)])], count: 1) {\n            $0.optInt8Col.in([Int8(8), Int8(9)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT optInt8Col IN %@)\",\n                    values: [NSArray(array: [Int8(9)])], count: 0) {\n            !$0.optInt8Col.in([Int8(9)])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(optInt16Col IN %@)\",\n                    values: [NSArray(array: [Int16(16), Int16(17)])], count: 1) {\n            $0.optInt16Col.in([Int16(16), Int16(17)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT optInt16Col IN %@)\",\n                    values: [NSArray(array: [Int16(17)])], count: 0) {\n            !$0.optInt16Col.in([Int16(17)])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(optInt32Col IN %@)\",\n                    values: [NSArray(array: [Int32(32), Int32(33)])], count: 1) {\n            $0.optInt32Col.in([Int32(32), Int32(33)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT optInt32Col IN %@)\",\n                    values: [NSArray(array: [Int32(33)])], count: 0) {\n            !$0.optInt32Col.in([Int32(33)])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(optInt64Col IN %@)\",\n                    values: [NSArray(array: [Int64(64), Int64(65)])], count: 1) {\n            $0.optInt64Col.in([Int64(64), Int64(65)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT optInt64Col IN %@)\",\n                    values: [NSArray(array: [Int64(65)])], count: 0) {\n            !$0.optInt64Col.in([Int64(65)])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(optFloatCol IN %@)\",\n                    values: [NSArray(array: [Float(5.55444333), Float(6.55444333)])], count: 1) {\n            $0.optFloatCol.in([Float(5.55444333), Float(6.55444333)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT optFloatCol IN %@)\",\n                    values: [NSArray(array: [Float(6.55444333)])], count: 0) {\n            !$0.optFloatCol.in([Float(6.55444333)])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(optDoubleCol IN %@)\",\n                    values: [NSArray(array: [123.456, 234.567])], count: 1) {\n            $0.optDoubleCol.in([123.456, 234.567])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT optDoubleCol IN %@)\",\n                    values: [NSArray(array: [234.567])], count: 0) {\n            !$0.optDoubleCol.in([234.567])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(optStringCol IN %@)\",\n                    values: [NSArray(array: [\"Foo\", \"Foó\"])], count: 1) {\n            $0.optStringCol.in([\"Foo\", \"Foó\"])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT optStringCol IN %@)\",\n                    values: [NSArray(array: [\"Foó\"])], count: 0) {\n            !$0.optStringCol.in([\"Foó\"])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(optBinaryCol IN %@)\",\n                    values: [NSArray(array: [Data(count: 64), Data(count: 128)])], count: 1) {\n            $0.optBinaryCol.in([Data(count: 64), Data(count: 128)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT optBinaryCol IN %@)\",\n                    values: [NSArray(array: [Data(count: 128)])], count: 0) {\n            !$0.optBinaryCol.in([Data(count: 128)])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(optDateCol IN %@)\",\n                    values: [NSArray(array: [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])], count: 1) {\n            $0.optDateCol.in([Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT optDateCol IN %@)\",\n                    values: [NSArray(array: [Date(timeIntervalSince1970: 2000000)])], count: 0) {\n            !$0.optDateCol.in([Date(timeIntervalSince1970: 2000000)])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(optDecimalCol IN %@)\",\n                    values: [NSArray(array: [Decimal128(123.456), Decimal128(234.567)])], count: 1) {\n            $0.optDecimalCol.in([Decimal128(123.456), Decimal128(234.567)])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT optDecimalCol IN %@)\",\n                    values: [NSArray(array: [Decimal128(234.567)])], count: 0) {\n            !$0.optDecimalCol.in([Decimal128(234.567)])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(optObjectIdCol IN %@)\",\n                    values: [NSArray(array: [ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])], count: 1) {\n            $0.optObjectIdCol.in([ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\")])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT optObjectIdCol IN %@)\",\n                    values: [NSArray(array: [ObjectId(\"61184062c1d8f096a3695045\")])], count: 0) {\n            !$0.optObjectIdCol.in([ObjectId(\"61184062c1d8f096a3695045\")])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(optUuidCol IN %@)\",\n                    values: [NSArray(array: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])], count: 1) {\n            $0.optUuidCol.in([UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT optUuidCol IN %@)\",\n                    values: [NSArray(array: [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])], count: 0) {\n            !$0.optUuidCol.in([UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(optIntEnumCol IN %@)\",\n                    values: [NSArray(array: [ModernIntEnum.value1, ModernIntEnum.value2])], count: 1) {\n            $0.optIntEnumCol.in([ModernIntEnum.value1, ModernIntEnum.value2])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT optIntEnumCol IN %@)\",\n                    values: [NSArray(array: [ModernIntEnum.value2])], count: 0) {\n            !$0.optIntEnumCol.in([ModernIntEnum.value2])\n        }\n\n        assertQuery(ModernAllTypesObject.self, \"(optStringEnumCol IN %@)\",\n                    values: [NSArray(array: [ModernStringEnum.value1, ModernStringEnum.value2])], count: 1) {\n            $0.optStringEnumCol.in([ModernStringEnum.value1, ModernStringEnum.value2])\n        }\n        assertQuery(ModernAllTypesObject.self, \"(NOT optStringEnumCol IN %@)\",\n                    values: [NSArray(array: [ModernStringEnum.value2])], count: 0) {\n            !$0.optStringEnumCol.in([ModernStringEnum.value2])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(optBool IN %@)\",\n                    values: [NSArray(array: [BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: false)])], count: 1) {\n            $0.optBool.in([BoolWrapper(persistedValue: true), BoolWrapper(persistedValue: false)])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT optBool IN %@)\",\n                    values: [NSArray(array: [BoolWrapper(persistedValue: false)])], count: 0) {\n            !$0.optBool.in([BoolWrapper(persistedValue: false)])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(optInt IN %@)\",\n                    values: [NSArray(array: [IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])], count: 1) {\n            $0.optInt.in([IntWrapper(persistedValue: 1), IntWrapper(persistedValue: 3)])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT optInt IN %@)\",\n                    values: [NSArray(array: [IntWrapper(persistedValue: 3)])], count: 0) {\n            !$0.optInt.in([IntWrapper(persistedValue: 3)])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(optInt8 IN %@)\",\n                    values: [NSArray(array: [Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])], count: 1) {\n            $0.optInt8.in([Int8Wrapper(persistedValue: Int8(8)), Int8Wrapper(persistedValue: Int8(9))])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT optInt8 IN %@)\",\n                    values: [NSArray(array: [Int8Wrapper(persistedValue: Int8(9))])], count: 0) {\n            !$0.optInt8.in([Int8Wrapper(persistedValue: Int8(9))])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(optInt16 IN %@)\",\n                    values: [NSArray(array: [Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])], count: 1) {\n            $0.optInt16.in([Int16Wrapper(persistedValue: Int16(16)), Int16Wrapper(persistedValue: Int16(17))])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT optInt16 IN %@)\",\n                    values: [NSArray(array: [Int16Wrapper(persistedValue: Int16(17))])], count: 0) {\n            !$0.optInt16.in([Int16Wrapper(persistedValue: Int16(17))])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(optInt32 IN %@)\",\n                    values: [NSArray(array: [Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])], count: 1) {\n            $0.optInt32.in([Int32Wrapper(persistedValue: Int32(32)), Int32Wrapper(persistedValue: Int32(33))])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT optInt32 IN %@)\",\n                    values: [NSArray(array: [Int32Wrapper(persistedValue: Int32(33))])], count: 0) {\n            !$0.optInt32.in([Int32Wrapper(persistedValue: Int32(33))])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(optInt64 IN %@)\",\n                    values: [NSArray(array: [Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])], count: 1) {\n            $0.optInt64.in([Int64Wrapper(persistedValue: Int64(64)), Int64Wrapper(persistedValue: Int64(65))])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT optInt64 IN %@)\",\n                    values: [NSArray(array: [Int64Wrapper(persistedValue: Int64(65))])], count: 0) {\n            !$0.optInt64.in([Int64Wrapper(persistedValue: Int64(65))])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(optFloat IN %@)\",\n                    values: [NSArray(array: [FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])], count: 1) {\n            $0.optFloat.in([FloatWrapper(persistedValue: Float(5.55444333)), FloatWrapper(persistedValue: Float(6.55444333))])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT optFloat IN %@)\",\n                    values: [NSArray(array: [FloatWrapper(persistedValue: Float(6.55444333))])], count: 0) {\n            !$0.optFloat.in([FloatWrapper(persistedValue: Float(6.55444333))])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(optDouble IN %@)\",\n                    values: [NSArray(array: [DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])], count: 1) {\n            $0.optDouble.in([DoubleWrapper(persistedValue: 123.456), DoubleWrapper(persistedValue: 234.567)])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT optDouble IN %@)\",\n                    values: [NSArray(array: [DoubleWrapper(persistedValue: 234.567)])], count: 0) {\n            !$0.optDouble.in([DoubleWrapper(persistedValue: 234.567)])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(optString IN %@)\",\n                    values: [NSArray(array: [StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])], count: 1) {\n            $0.optString.in([StringWrapper(persistedValue: \"Foo\"), StringWrapper(persistedValue: \"Foó\")])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT optString IN %@)\",\n                    values: [NSArray(array: [StringWrapper(persistedValue: \"Foó\")])], count: 0) {\n            !$0.optString.in([StringWrapper(persistedValue: \"Foó\")])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(optBinary IN %@)\",\n                    values: [NSArray(array: [DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])], count: 1) {\n            $0.optBinary.in([DataWrapper(persistedValue: Data(count: 64)), DataWrapper(persistedValue: Data(count: 128))])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT optBinary IN %@)\",\n                    values: [NSArray(array: [DataWrapper(persistedValue: Data(count: 128))])], count: 0) {\n            !$0.optBinary.in([DataWrapper(persistedValue: Data(count: 128))])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(optDate IN %@)\",\n                    values: [NSArray(array: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])], count: 1) {\n            $0.optDate.in([DateWrapper(persistedValue: Date(timeIntervalSince1970: 1000000)), DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT optDate IN %@)\",\n                    values: [NSArray(array: [DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])], count: 0) {\n            !$0.optDate.in([DateWrapper(persistedValue: Date(timeIntervalSince1970: 2000000))])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(optDecimal IN %@)\",\n                    values: [NSArray(array: [Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])], count: 1) {\n            $0.optDecimal.in([Decimal128Wrapper(persistedValue: Decimal128(123.456)), Decimal128Wrapper(persistedValue: Decimal128(234.567))])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT optDecimal IN %@)\",\n                    values: [NSArray(array: [Decimal128Wrapper(persistedValue: Decimal128(234.567))])], count: 0) {\n            !$0.optDecimal.in([Decimal128Wrapper(persistedValue: Decimal128(234.567))])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(optObjectId IN %@)\",\n                    values: [NSArray(array: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])], count: 1) {\n            $0.optObjectId.in([ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695046\")), ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT optObjectId IN %@)\",\n                    values: [NSArray(array: [ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])], count: 0) {\n            !$0.optObjectId.in([ObjectIdWrapper(persistedValue: ObjectId(\"61184062c1d8f096a3695045\"))])\n        }\n\n        assertQuery(AllCustomPersistableTypes.self, \"(optUuid IN %@)\",\n                    values: [NSArray(array: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])], count: 1) {\n            $0.optUuid.in([UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!), UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(NOT optUuid IN %@)\",\n                    values: [NSArray(array: [UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])], count: 0) {\n            !$0.optUuid.in([UUIDWrapper(persistedValue: UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!)])\n        }\n    }\n}\n\nprivate protocol LinkToTestObject: Object {\n    associatedtype Child: Object\n    var object: Child? { get }\n    var list: List<Child> { get }\n    var set: MutableSet<Child> { get }\n    var map: Map<String, Child?> { get }\n}\nextension LinkToCustomPersistableCollections: LinkToTestObject {}\nextension LinkToModernCollectionsOfEnums: LinkToTestObject {}\nextension LinkToAllCustomPersistableTypes: LinkToTestObject {}\nextension LinkToModernAllTypesObject: LinkToTestObject {}\n\nprivate protocol QueryValue {\n    static func queryValues() -> [Self]\n}\n\nextension Bool: QueryValue {\n    static func queryValues() -> [Bool] {\n        return [true, true, false]\n    }\n}\nextension BoolWrapper: QueryValue {\n    static func queryValues() -> [BoolWrapper] {\n        return Bool.queryValues().map(BoolWrapper.init)\n    }\n}\n\nextension Int: QueryValue {\n    static func queryValues() -> [Int] {\n        return [1, 3, 5]\n    }\n}\nextension IntWrapper: QueryValue {\n    static func queryValues() -> [IntWrapper] {\n        return Int.queryValues().map(IntWrapper.init)\n    }\n}\nextension EnumInt: QueryValue {\n    static func queryValues() -> [EnumInt] {\n        return [.value1, .value2, .value3]\n    }\n}\n\nextension Int8: QueryValue {\n    static func queryValues() -> [Int8] {\n        return [Int8(8), Int8(9), Int8(10)]\n    }\n}\nextension Int8Wrapper: QueryValue {\n    static func queryValues() -> [Int8Wrapper] {\n        return Int8.queryValues().map(Int8Wrapper.init)\n    }\n}\nextension EnumInt8: QueryValue {\n    static func queryValues() -> [EnumInt8] {\n        return [.value1, .value2, .value3]\n    }\n}\n\nextension Int16: QueryValue {\n    static func queryValues() -> [Int16] {\n        return [Int16(16), Int16(17), Int16(18)]\n    }\n}\nextension Int16Wrapper: QueryValue {\n    static func queryValues() -> [Int16Wrapper] {\n        return Int16.queryValues().map(Int16Wrapper.init)\n    }\n}\nextension EnumInt16: QueryValue {\n    static func queryValues() -> [EnumInt16] {\n        return [.value1, .value2, .value3]\n    }\n}\n\nextension Int32: QueryValue {\n    static func queryValues() -> [Int32] {\n        return [Int32(32), Int32(33), Int32(34)]\n    }\n}\nextension Int32Wrapper: QueryValue {\n    static func queryValues() -> [Int32Wrapper] {\n        return Int32.queryValues().map(Int32Wrapper.init)\n    }\n}\nextension EnumInt32: QueryValue {\n    static func queryValues() -> [EnumInt32] {\n        return [.value1, .value2, .value3]\n    }\n}\n\nextension Int64: QueryValue {\n    static func queryValues() -> [Int64] {\n        return [Int64(64), Int64(65), Int64(66)]\n    }\n}\nextension Int64Wrapper: QueryValue {\n    static func queryValues() -> [Int64Wrapper] {\n        return Int64.queryValues().map(Int64Wrapper.init)\n    }\n}\nextension EnumInt64: QueryValue {\n    static func queryValues() -> [EnumInt64] {\n        return [.value1, .value2, .value3]\n    }\n}\n\nextension Float: QueryValue {\n    static func queryValues() -> [Float] {\n        return [Float(5.55444333), Float(6.55444333), Float(7.55444333)]\n    }\n}\nextension FloatWrapper: QueryValue {\n    static func queryValues() -> [FloatWrapper] {\n        return Float.queryValues().map(FloatWrapper.init)\n    }\n}\nextension EnumFloat: QueryValue {\n    static func queryValues() -> [EnumFloat] {\n        return [.value1, .value2, .value3]\n    }\n}\n\nextension Double: QueryValue {\n    static func queryValues() -> [Double] {\n        return [123.456, 234.567, 345.678]\n    }\n}\nextension DoubleWrapper: QueryValue {\n    static func queryValues() -> [DoubleWrapper] {\n        return Double.queryValues().map(DoubleWrapper.init)\n    }\n}\nextension EnumDouble: QueryValue {\n    static func queryValues() -> [EnumDouble] {\n        return [.value1, .value2, .value3]\n    }\n}\n\nextension String: QueryValue {\n    static func queryValues() -> [String] {\n        return [\"Foo\", \"Foó\", \"foo\"]\n    }\n}\nextension StringWrapper: QueryValue {\n    static func queryValues() -> [StringWrapper] {\n        return String.queryValues().map(StringWrapper.init)\n    }\n}\nextension EnumString: QueryValue {\n    static func queryValues() -> [EnumString] {\n        return [.value1, .value2, .value3]\n    }\n}\n\nextension Data: QueryValue {\n    static func queryValues() -> [Data] {\n        return [Data(count: 64), Data(count: 128), Data(count: 256)]\n    }\n}\nextension DataWrapper: QueryValue {\n    static func queryValues() -> [DataWrapper] {\n        return Data.queryValues().map(DataWrapper.init)\n    }\n}\n\nextension Date: QueryValue {\n    static func queryValues() -> [Date] {\n        return [Date(timeIntervalSince1970: 1000000), Date(timeIntervalSince1970: 2000000), Date(timeIntervalSince1970: 3000000)]\n    }\n}\nextension DateWrapper: QueryValue {\n    static func queryValues() -> [DateWrapper] {\n        return Date.queryValues().map(DateWrapper.init)\n    }\n}\n\nextension Decimal128: QueryValue {\n    static func queryValues() -> [Decimal128] {\n        return [Decimal128(123.456), Decimal128(234.567), Decimal128(345.678)]\n    }\n}\nextension Decimal128Wrapper: QueryValue {\n    static func queryValues() -> [Decimal128Wrapper] {\n        return Decimal128.queryValues().map(Decimal128Wrapper.init)\n    }\n}\n\nextension ObjectId: QueryValue {\n    static func queryValues() -> [ObjectId] {\n        return [ObjectId(\"61184062c1d8f096a3695046\"), ObjectId(\"61184062c1d8f096a3695045\"), ObjectId(\"61184062c1d8f096a3695044\")]\n    }\n}\nextension ObjectIdWrapper: QueryValue {\n    static func queryValues() -> [ObjectIdWrapper] {\n        return ObjectId.queryValues().map(ObjectIdWrapper.init)\n    }\n}\n\nextension UUID: QueryValue {\n    static func queryValues() -> [UUID] {\n        return [UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!, UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d08e\")!]\n    }\n}\nextension UUIDWrapper: QueryValue {\n    static func queryValues() -> [UUIDWrapper] {\n        return UUID.queryValues().map(UUIDWrapper.init)\n    }\n}\n\nextension ModernIntEnum: QueryValue {\n    static func queryValues() -> [ModernIntEnum] {\n        return [.value1, .value2, .value3]\n    }\n    fileprivate static func sum() -> Int {\n        return Self.value1.rawValue + Self.value2.rawValue + Self.value3.rawValue\n    }\n    fileprivate static func average() -> Int {\n        return Self.value2.rawValue\n    }\n}\n\nextension AnyRealmValue: QueryValue {\n    static func queryValues() -> [AnyRealmValue] {\n        return [AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\")), AnyRealmValue.string(\"Hello\"), AnyRealmValue.int(123)]\n    }\n}\n\nextension Optional: QueryValue where Wrapped: QueryValue {\n    static func queryValues() -> [Self] {\n        return Wrapped.queryValues().map(Self.init)\n    }\n}\n\nprivate protocol AddableQueryValue {\n    associatedtype SumType\n    static func sum() -> SumType\n    static func average() -> SumType\n}\n\nextension Int: AddableQueryValue {\n    fileprivate typealias SumType = Int\n    fileprivate static func sum() -> SumType {\n        return 1 + 3 + 5\n    }\n    fileprivate static func average() -> SumType {\n        return sum() / 3\n    }\n}\nextension IntWrapper: AddableQueryValue {\n    fileprivate typealias SumType = IntWrapper\n    fileprivate static func sum() -> SumType {\n        return IntWrapper(persistedValue: Int.sum())\n    }\n    fileprivate static func average() -> SumType {\n        return IntWrapper(persistedValue: Int.average())\n    }\n}\nextension EnumInt: AddableQueryValue {\n    fileprivate typealias SumType = Int\n    fileprivate static func sum() -> SumType {\n        return Self.value1.rawValue + Self.value2.rawValue + Self.value3.rawValue\n    }\n    fileprivate static func average() -> SumType {\n        return sum() / 3\n    }\n}\n\nextension Int8: AddableQueryValue {\n    fileprivate typealias SumType = Int8\n    fileprivate static func sum() -> SumType {\n        return Int8(8) + Int8(9) + Int8(10)\n    }\n    fileprivate static func average() -> SumType {\n        return sum() / 3\n    }\n}\nextension Int8Wrapper: AddableQueryValue {\n    fileprivate typealias SumType = Int8Wrapper\n    fileprivate static func sum() -> SumType {\n        return Int8Wrapper(persistedValue: Int8.sum())\n    }\n    fileprivate static func average() -> SumType {\n        return Int8Wrapper(persistedValue: Int8.average())\n    }\n}\nextension EnumInt8: AddableQueryValue {\n    fileprivate typealias SumType = Int8\n    fileprivate static func sum() -> SumType {\n        return Self.value1.rawValue + Self.value2.rawValue + Self.value3.rawValue\n    }\n    fileprivate static func average() -> SumType {\n        return sum() / 3\n    }\n}\n\nextension Int16: AddableQueryValue {\n    fileprivate typealias SumType = Int16\n    fileprivate static func sum() -> SumType {\n        return Int16(16) + Int16(17) + Int16(18)\n    }\n    fileprivate static func average() -> SumType {\n        return sum() / 3\n    }\n}\nextension Int16Wrapper: AddableQueryValue {\n    fileprivate typealias SumType = Int16Wrapper\n    fileprivate static func sum() -> SumType {\n        return Int16Wrapper(persistedValue: Int16.sum())\n    }\n    fileprivate static func average() -> SumType {\n        return Int16Wrapper(persistedValue: Int16.average())\n    }\n}\nextension EnumInt16: AddableQueryValue {\n    fileprivate typealias SumType = Int16\n    fileprivate static func sum() -> SumType {\n        return Self.value1.rawValue + Self.value2.rawValue + Self.value3.rawValue\n    }\n    fileprivate static func average() -> SumType {\n        return sum() / 3\n    }\n}\n\nextension Int32: AddableQueryValue {\n    fileprivate typealias SumType = Int32\n    fileprivate static func sum() -> SumType {\n        return Int32(32) + Int32(33) + Int32(34)\n    }\n    fileprivate static func average() -> SumType {\n        return sum() / 3\n    }\n}\nextension Int32Wrapper: AddableQueryValue {\n    fileprivate typealias SumType = Int32Wrapper\n    fileprivate static func sum() -> SumType {\n        return Int32Wrapper(persistedValue: Int32.sum())\n    }\n    fileprivate static func average() -> SumType {\n        return Int32Wrapper(persistedValue: Int32.average())\n    }\n}\nextension EnumInt32: AddableQueryValue {\n    fileprivate typealias SumType = Int32\n    fileprivate static func sum() -> SumType {\n        return Self.value1.rawValue + Self.value2.rawValue + Self.value3.rawValue\n    }\n    fileprivate static func average() -> SumType {\n        return sum() / 3\n    }\n}\n\nextension Int64: AddableQueryValue {\n    fileprivate typealias SumType = Int64\n    fileprivate static func sum() -> SumType {\n        return Int64(64) + Int64(65) + Int64(66)\n    }\n    fileprivate static func average() -> SumType {\n        return sum() / 3\n    }\n}\nextension Int64Wrapper: AddableQueryValue {\n    fileprivate typealias SumType = Int64Wrapper\n    fileprivate static func sum() -> SumType {\n        return Int64Wrapper(persistedValue: Int64.sum())\n    }\n    fileprivate static func average() -> SumType {\n        return Int64Wrapper(persistedValue: Int64.average())\n    }\n}\nextension EnumInt64: AddableQueryValue {\n    fileprivate typealias SumType = Int64\n    fileprivate static func sum() -> SumType {\n        return Self.value1.rawValue + Self.value2.rawValue + Self.value3.rawValue\n    }\n    fileprivate static func average() -> SumType {\n        return sum() / 3\n    }\n}\n\nextension Float: AddableQueryValue {\n    fileprivate typealias SumType = Float\n    fileprivate static func sum() -> SumType {\n        return Float(5.55444333) + Float(6.55444333) + Float(7.55444333)\n    }\n    fileprivate static func average() -> SumType {\n        return sum() / 3\n    }\n}\nextension FloatWrapper: AddableQueryValue {\n    fileprivate typealias SumType = FloatWrapper\n    fileprivate static func sum() -> SumType {\n        return FloatWrapper(persistedValue: Float.sum())\n    }\n    fileprivate static func average() -> SumType {\n        return FloatWrapper(persistedValue: Float.average())\n    }\n}\nextension EnumFloat: AddableQueryValue {\n    fileprivate typealias SumType = Float\n    fileprivate static func sum() -> SumType {\n        return Self.value1.rawValue + Self.value2.rawValue + Self.value3.rawValue\n    }\n    fileprivate static func average() -> SumType {\n        return sum() / 3\n    }\n}\n\nextension Double: AddableQueryValue {\n    fileprivate typealias SumType = Double\n    fileprivate static func sum() -> SumType {\n        return 123.456 + 234.567 + 345.678\n    }\n    fileprivate static func average() -> SumType {\n        return sum() / 3\n    }\n}\nextension DoubleWrapper: AddableQueryValue {\n    fileprivate typealias SumType = DoubleWrapper\n    fileprivate static func sum() -> SumType {\n        return DoubleWrapper(persistedValue: Double.sum())\n    }\n    fileprivate static func average() -> SumType {\n        return DoubleWrapper(persistedValue: Double.average())\n    }\n}\nextension EnumDouble: AddableQueryValue {\n    fileprivate typealias SumType = Double\n    fileprivate static func sum() -> SumType {\n        return Self.value1.rawValue + Self.value2.rawValue + Self.value3.rawValue\n    }\n    fileprivate static func average() -> SumType {\n        return sum() / 3\n    }\n}\n\nextension Decimal128: AddableQueryValue {\n    fileprivate typealias SumType = Decimal128\n    fileprivate static func sum() -> SumType {\n        return Decimal128(123.456) + Decimal128(234.567) + Decimal128(345.678)\n    }\n    fileprivate static func average() -> SumType {\n        return sum() / 3\n    }\n}\nextension Decimal128Wrapper: AddableQueryValue {\n    fileprivate typealias SumType = Decimal128Wrapper\n    fileprivate static func sum() -> SumType {\n        return Decimal128Wrapper(persistedValue: Decimal128.sum())\n    }\n    fileprivate static func average() -> SumType {\n        return Decimal128Wrapper(persistedValue: Decimal128.average())\n    }\n}\n\nextension Optional: AddableQueryValue where Wrapped: AddableQueryValue {\n    fileprivate typealias SumType = Optional<Wrapped.SumType>\n    fileprivate static func sum() -> SumType {\n        return .some(Wrapped.sum())\n    }\n    fileprivate static func average() -> SumType {\n        return .some(Wrapped.average())\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/QueryTests.swift.gyb",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"(AS IS)\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\n// This file is generated from a template. Do not edit directly.\n// swiftlint:disable large_tuple vertical_parameter_alignment\n%{\n    # How to use:\n    #\n    # $ wget https://github.com/apple/swift/raw/main/utils/gyb\n    # $ wget https://github.com/apple/swift/raw/main/utils/gyb.py\n    # $ chmod +x gyb\n    #\n    # ./YOUR_GYB_LOCATION/gyb --line-directive '' -o QueryTests.swift QueryTests.swift.gyb\n}%\n%{\n    import collections\n    import itertools\n    import sys\n\n\n    def lowerFirst(str):\n        return str[0].lower() + str[1:]\n\n    class Property(object):\n        def __init__(self, colName, values, type, category, enumName=''):\n            self.isEnum = enumName != ''\n            self.colName = colName\n            self.rawValueName = colName if not self.isEnum else colName + '.rawValue'\n            self.comparableName = self.rawValueName\n            self.values = values\n            self.type = type\n            self.category = category\n            self.enumName = enumName\n            self.typeName = enumName if enumName != '' else type\n            self.className = 'ModernAllTypesObject'\n            self.linkingClassName = 'LinkToModernAllTypesObject'\n\n        def value(self, index):\n            return self.values[index]\n        def enumValue(self, index):\n            return self.enumName + self.values[index]\n        def rawValue(self, index):\n            return self.value(index) if not self.isEnum else self.enumValue(index) + '.rawValue'\n        def comparableValue(self, index):\n            return self.rawValue(index)\n        def wrap(self, value):\n            if '?' in self.type:\n                return '{}.some({})'.format(self.type, value)\n            return value\n\n    class WrapperProperty(object):\n        def __init__(self, base, collection, optional):\n            self.baseName = base.name\n            self.isEnum = False\n            self.colName = (\n                collection +\n                (('Opt' if collection else 'opt') if optional else '') +\n                (base.colName() if collection or optional else lowerFirst(base.colName()))\n            )\n            self.values = [self.wrap(v) for v in (base.collectionValues if collection else base.values)]\n            self.rawValueName = self.colName\n            self.comparableName = self.colName + '.persistableValue'\n            self.type = base.name + 'Wrapper' + ('?' if optional else '')\n            self.category = base.category\n            self.enumName = ''\n            self.typeName = self.type\n            if collection:\n                self.className = 'CustomPersistableCollections'\n                self.linkingClassName = 'LinkToCustomPersistableCollections'\n            else:\n                self.className = 'AllCustomPersistableTypes'\n                self.linkingClassName = 'LinkToAllCustomPersistableTypes'\n\n        def value(self, index):\n            return self.values[index]\n        def enumValue(self, index):\n            return self.values[index]\n        def rawValue(self, index):\n            return self.values[index]\n        def comparableValue(self, index):\n            return self.value(index) + '.persistableValue'\n        def wrap(self, value):\n            return '{}Wrapper(persistedValue: {})'.format(self.baseName, value)\n\n    class EnumProperty(Property):\n        def __init__(self, type, collection, category, optional=False):\n            super(EnumProperty, self).__init__(collection + type + ('Opt' if optional else ''),\n                ['.value1', '.value2', '.value3'], 'Enum' + type + ('?' if optional else ''),\n                category, 'Enum' + type)\n            self.className = 'ModernCollectionsOfEnums'\n            self.linkingClassName = 'LinkToModernCollectionsOfEnums'\n\n    class Type(object):\n        def __init__(self, name, category, values, collectionValues=None):\n            self.name = name\n            self.values = values\n            self.collectionValues = collectionValues or values\n            self.category = category\n\n        def colName(self):\n            if self.name == 'Decimal128':\n                return 'Decimal'\n            if self.name == 'UUID':\n                return 'Uuid'\n            if self.name == 'Data':\n                return 'Binary'\n            return self.name\n\n        def hasEnum(self):\n            return (self.category == 'numeric' or self.category == 'string') and self.name != 'Decimal128' and self.name != 'Date'\n\n    types = [\n        Type('Bool', 'bool', ['true', 'false'], ['true', 'true', 'false']),\n        Type('Int', 'numeric', ['1', '3', '5']),\n        Type('Int8', 'numeric', ['Int8(8)', 'Int8(9)', 'Int8(10)']),\n        Type('Int16', 'numeric', ['Int16(16)', 'Int16(17)', 'Int16(18)']),\n        Type('Int32', 'numeric', ['Int32(32)', 'Int32(33)', 'Int32(34)']),\n        Type('Int64', 'numeric', ['Int64(64)', 'Int64(65)', 'Int64(66)']),\n        Type('Float', 'numeric', ['Float(5.55444333)', 'Float(6.55444333)', 'Float(7.55444333)']),\n        Type('Double', 'numeric', ['123.456', '234.567', '345.678']),\n        Type('String', 'string', ['\"Foo\"', '\"Foó\"', '\"foo\"']),\n        Type('Data', 'binary', ['Data(count: 64)', 'Data(count: 128)'],\n             ['Data(count: 64)', 'Data(count: 128)', 'Data(count: 256)']),\n        Type('Date', 'numeric', ['Date(timeIntervalSince1970: 1000000)', 'Date(timeIntervalSince1970: 2000000)', 'Date(timeIntervalSince1970: 3000000)']),\n        Type('Decimal128', 'numeric', ['Decimal128(123.456)', 'Decimal128(234.567)', 'Decimal128(345.678)']),\n        Type('ObjectId', 'objectId',\n             ['ObjectId(\"61184062c1d8f096a3695046\")', 'ObjectId(\"61184062c1d8f096a3695045\")', 'ObjectId(\"61184062c1d8f096a3695044\")']),\n        Type('UUID', 'uuid', ['UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!', 'UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09f\")!', 'UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d08e\")!'])\n    ]\n\n    properties = [Property(lowerFirst(t.colName()) + 'Col', t.values, t.name, t.category) for t in types]\n    optProperties = [Property('opt' + t.colName() + 'Col', t.values, t.name + '?', t.category) for t in types]\n    listProperties = [Property('array' + t.colName(), t.collectionValues, t.name, t.category) for t in types]\n    optListProperties = [Property('arrayOpt' + t.colName(), t.collectionValues, t.name + '?', t.category) for t in types]\n    setProperties = [Property('set' + t.colName(), t.collectionValues, t.name, t.category) for t in types]\n    optSetProperties = [Property('setOpt' + t.colName(), t.collectionValues, t.name + '?', t.category) for t in types]\n    mapProperties = [Property('map' + t.colName(), t.collectionValues, t.name, t.category) for t in types]\n    optMapProperties = [Property('mapOpt' + t.colName(), t.collectionValues, t.name + '?', t.category) for t in types]\n\n    properties += [\n        Property('intEnumCol', ['.value1', '.value2', '.value3'], 'Int', 'numeric', 'ModernIntEnum'),\n        Property('stringEnumCol', ['.value1', '.value2'], 'String', 'string', 'ModernStringEnum'),\n    ]\n    optProperties += [\n        Property('optIntEnumCol', ['.value1', '.value2', '.value3'], 'Int?', 'numeric', 'ModernIntEnum'),\n        Property('optStringEnumCol', ['.value1', '.value2'], 'String?', 'string', 'ModernStringEnum'),\n    ]\n    anyCollectionValues = ['AnyRealmValue.objectId(ObjectId(\"61184062c1d8f096a3695046\"))', 'AnyRealmValue.string(\"Hello\")', 'AnyRealmValue.int(123)']\n    listProperties += [\n        Property('arrayAny', anyCollectionValues, 'AnyRealmValue', 'any'),\n    ]\n    setProperties += [\n        Property('setAny', anyCollectionValues, 'AnyRealmValue', 'any'),\n    ]\n    mapProperties += [\n        Property('mapAny', anyCollectionValues, 'AnyRealmValue', 'any'),\n    ]\n\n    listProperties += [\n        EnumProperty(t.name, 'list', t.category) for t in types if t.hasEnum()\n    ]\n    optListProperties += [\n        EnumProperty(t.name, 'list', t.category, True) for t in types if t.hasEnum()\n    ]\n    setProperties += [\n        EnumProperty(t.name, 'set', t.category) for t in types if t.hasEnum()\n    ]\n    optSetProperties += [\n        EnumProperty(t.name, 'set', t.category, True) for t in types if t.hasEnum()\n    ]\n    mapProperties += [\n        EnumProperty(t.name, 'map', t.category) for t in types if t.hasEnum()\n    ]\n    optMapProperties += [\n        EnumProperty(t.name, 'map', t.category, True) for t in types if t.hasEnum()\n    ]\n\n    properties += [WrapperProperty(t, '', False) for t in types]\n    optProperties += [WrapperProperty(t, '', True) for t in types]\n    listProperties += [WrapperProperty(t, 'list', False) for t in types]\n    optListProperties += [WrapperProperty(t, 'list', True) for t in types]\n    setProperties += [WrapperProperty(t, 'set', False) for t in types]\n    optSetProperties += [WrapperProperty(t, 'set', True) for t in types]\n    mapProperties += [WrapperProperty(t, 'map', False) for t in types]\n    optMapProperties += [WrapperProperty(t, 'map', True) for t in types]\n\n    anyRealmValues = [\n        Property('', ['.none'], '', 'null', 'AnyRealmValue'),\n        Property('', ['.int(123)'], '', 'numeric', 'AnyRealmValue'),\n        Property('', ['.bool(true)'], '', 'bool', 'AnyRealmValue'),\n        Property('', ['.float(123.456)'], '', 'numeric', 'AnyRealmValue'),\n        Property('', ['.double(123.456)'], '', 'numeric', 'AnyRealmValue'),\n        Property('', ['.string(\"FooBar\")'], '', 'string', 'AnyRealmValue'),\n        Property('', ['.data(Data(count: 64))'], '', 'binary', 'AnyRealmValue'),\n        Property('', ['.date(Date(timeIntervalSince1970: 1000000))'], '', 'numeric', 'AnyRealmValue'),\n        Property('', ['.object(circleObject)'], '', 'object', 'AnyRealmValue'),\n        Property('', ['.objectId(ObjectId(\"61184062c1d8f096a3695046\"))'], '', 'objectId', 'AnyRealmValue'),\n        Property('', ['.decimal128(123.456)'], '', 'numeric', 'AnyRealmValue'),\n        Property('', ['.uuid(UUID(uuidString: \"33041937-05b2-464a-98ad-3910cbe0d09e\")!)'], '', 'uuid', 'AnyRealmValue'),\n    ]\n\n    classNames = set((p.className, p.linkingClassName) for p in properties + listProperties)\n\n    def numeric(properties):\n        return (p for p in properties if p.category == 'numeric')\n    def canSum(properties):\n        # FIXME: EnumFloat depends on https://github.com/realm/realm-core/pull/5081\n        return (p for p in properties if p.category == 'numeric' and\n                                         not p.type.strip('?') in ['Date', 'DateWrapper', 'EnumFloat'])\n    def string(properties):\n        return (p for p in properties if p.category == 'string')\n    def binary(properties):\n        return (p for p in properties if p.category == 'binary')\n\n    def groupByClass(properties):\n        return [list(p) for _, p in itertools.groupby(properties, lambda x: x.className)]\n}%\n\nclass QueryTests: TestCase {\n    private var realm: Realm!\n\n    // MARK: Test data population\n\n    private func objects() -> Results<ModernAllTypesObject> {\n        realm.objects(ModernAllTypesObject.self)\n    }\n\n    private func getOrCreate<T: Object>(_ type: T.Type) -> T {\n        if let object = realm.objects(T.self).first {\n            return object\n        }\n        let object = T()\n        try! realm.write {\n            realm.add(object)\n        }\n        return object\n    }\n\n    private func collectionObject() -> ModernCollectionObject {\n        return getOrCreate(ModernCollectionObject.self)\n    }\n\n    private func setAnyRealmValueCol(with value: AnyRealmValue, object: ModernAllTypesObject) {\n        try! realm.write {\n            object.anyCol = value\n        }\n    }\n\n    private var circleObject: ModernCircleObject {\n        return getOrCreate(ModernCircleObject.self)\n    }\n\n    override func setUp() {\n        realm = inMemoryRealm(\"QueryTests\")\n        try! realm.write {\n            % for className, _ in classNames:\n            let obj${className} = ${className}()\n            % end\n\n            % for property in properties + optProperties:\n            obj${property.className}.${property.colName} = ${property.value(1)}\n            % end\n\n            % for property in (p for p in listProperties + optListProperties):\n            obj${property.className}.${property.colName}.append(objectsIn: [${property.value(0)}, ${property.value(1)}])\n            % end\n\n            % for property in (p for p in setProperties + optSetProperties):\n            obj${property.className}.${property.colName}.insert(objectsIn: [${property.value(0)}, ${property.value(1)}])\n            % end\n\n            % for property in (p for p in mapProperties + optMapProperties):\n            obj${property.className}.${property.colName}[\"foo\"] = ${property.value(0)}\n            obj${property.className}.${property.colName}[\"bar\"] = ${property.value(1)}\n            % end\n\n            % for className in set(p.className for p in properties + listProperties):\n            realm.add(obj${className})\n            % end\n        }\n    }\n\n    override func tearDown() {\n        realm = nil\n    }\n\n    private func createKeypathCollectionAggregatesObject() {\n        realm.beginWrite()\n        realm.deleteAll()\n\n        % for className, linkingClassName in classNames:\n        let parent${linkingClassName} = realm.create(${linkingClassName}.self)\n        let children${className} = [${className}(), ${className}(), ${className}()]\n        parent${linkingClassName}.list.append(objectsIn: children${className})\n\n        % end\n\n        % for property in numeric(properties + optProperties):\n        initForKeypathCollectionAggregates(children${property.className}, \\.${property.colName})\n        % end\n\n        try! realm.commitWrite()\n    }\n\n    private func initForKeypathCollectionAggregates<O: Object, T: QueryValue>(\n            _ objects: [O],\n            _ keyPath: ReferenceWritableKeyPath<O, T>) {\n        for (obj, value) in zip(objects, T.queryValues()) {\n            obj[keyPath: keyPath] = value\n        }\n    }\n\n    private func initLinkedCollectionAggregatesObject() {\n        realm.beginWrite()\n        realm.deleteAll()\n\n        % for (parent, child) in set((p.linkingClassName, p.className) for p in listProperties):\n        let parent${parent} = realm.create(${parent}.self)\n        let obj${child} = ${child}()\n        parent${parent}[\"object\"] = obj${child}\n        % end\n\n        % for property in listProperties + optListProperties + setProperties + optSetProperties:\n        obj${property.className}[\"${property.colName}\"] = ${property.type}.queryValues()\n        % end\n        % for property in mapProperties + optMapProperties:\n        populateMap(obj${property.className}.${property.colName})\n        % end\n\n        try! realm.commitWrite()\n    }\n\n    private func populateMap<T: QueryValue>(_ map: Map<String, T>) {\n        let values = T.queryValues()\n        map[\"foo\"] = values[2]\n        map[\"bar\"] = values[1]\n        map[\"baz\"] = values[0]\n    }\n\n    // MARK: - Assertion Helpers\n\n    private func assertCount<T: Object>(_ expectedCount: Int,\n                                        _ query: ((Query<T>) -> Query<Bool>)) {\n        let results = realm.objects(T.self).where(query)\n        XCTAssertEqual(results.count, expectedCount)\n    }\n\n    private func assertPredicate<T: _RealmSchemaDiscoverable>(\n            _ predicate: String, _ values: [Any],\n            _ query: ((Query<T>) -> Query<Bool>)) {\n        let (queryStr, constructedValues) = query(Query<T>._constructForTesting())._constructPredicate()\n        XCTAssertEqual(queryStr, predicate)\n        XCTAssertEqual(constructedValues.count, values.count)\n        XCTAssertEqual(NSPredicate(format: queryStr, argumentArray: constructedValues),\n                       NSPredicate(format: predicate, argumentArray: values))\n    }\n\n    private func assertQuery(_ predicate: String, _ value: Any,\n                             count expectedCount: Int,\n                             _ query: ((Query<ModernAllTypesObject>) -> Query<Bool>)) {\n        assertCount(expectedCount, query)\n        assertPredicate(predicate, [value], query)\n    }\n\n    private func assertQuery<T: Object>(_ type: T.Type,\n                             _ predicate: String, _ value: Any,\n                             count expectedCount: Int,\n                             _ query: ((Query<T>) -> Query<Bool>)) {\n        assertCount(expectedCount, query)\n        assertPredicate(predicate, [value], query)\n    }\n\n    private func assertQuery(_ predicate: String, values: [Any] = [],\n                             count expectedCount: Int,\n                             _ query: ((Query<ModernAllTypesObject>) -> Query<Bool>)) {\n        assertCount(expectedCount, query)\n        assertPredicate(predicate, values, query)\n    }\n\n    private func assertQuery<T: Object>(_ type: T.Type, _ predicate: String,\n                                        values: [Any] = [],\n                                        count expectedCount: Int,\n                                        _ query: ((Query<T>) -> Query<Bool>)) {\n        assertCount(expectedCount, query)\n        assertPredicate(predicate, values, query)\n    }\n\n    // MARK: - Basic Comparison\n\n    func validateEquals<Root: Object, T: _Persistable>(\n            _ name: String, _ lhs: (Query<Root>) -> Query<T>, _ value: T,\n            equalCount: Int = 1, notEqualCount: Int = 0) {\n        assertQuery(Root.self, \"(\\(name) == %@)\", value, count: equalCount) {\n            lhs($0) == value\n        }\n        assertQuery(Root.self, \"(\\(name) != %@)\", value, count: notEqualCount) {\n            lhs($0) != value\n        }\n    }\n    func validateEqualsNil<Root: Object, T: _RealmSchemaDiscoverable & ExpressibleByNilLiteral>(\n            _ name: String, _ lhs: (Query<Root>) -> Query<T>) {\n        assertQuery(Root.self, \"(\\(name) == %@)\", NSNull(), count: 0) {\n            lhs($0) == nil\n        }\n        assertQuery(Root.self, \"(\\(name) != %@)\", NSNull(), count: 1) {\n            lhs($0) != nil\n        }\n    }\n\n    func testEquals() {\n        % for property in properties + optProperties:\n        validateEquals(\"${property.colName}\", \\Query<${property.className}>.${property.colName}, ${property.enumValue(1)})\n        % end\n\n        % for property in optProperties:\n        validateEqualsNil(\"${property.colName}\", \\Query<${property.className}>.${property.colName})\n        % end\n    }\n\n    func testImplicitBooleanOperation() {\n        assertQuery(ModernAllTypesObject.self, \"boolCol == true\", count: 0, { $0.boolCol })\n        assertQuery(ModernAllTypesObject.self, \"boolCol == false\", count: 1, { !$0.boolCol })\n\n        initLinkedCollectionAggregatesObject()\n        assertQuery(LinkToModernAllTypesObject.self, \"object.boolCol == true\", count: 0, { $0.object.boolCol })\n        assertQuery(LinkToModernAllTypesObject.self, \"object.boolCol == false\", count: 1, { !$0.object.boolCol })\n\n        let object = ModernEmbeddedParentObject()\n        let nestedObject = ModernEmbeddedTreeObject1()\n        object.object = nestedObject\n        try! realm.write {\n            realm.add(object)\n        }\n        assertQuery(ModernEmbeddedParentObject.self, \"object.bool == true\", count: 0, { $0.object.bool })\n        assertQuery(ModernEmbeddedParentObject.self, \"object.bool == false\", count: 1, { !$0.object.bool })\n\n        assertQuery(ModernAllTypesObject.self, \"((intCol == %@) && boolCol == true)\", 0, count: 0, { $0.intCol == 0 && $0.boolCol })\n        assertQuery(ModernAllTypesObject.self, \"(boolCol == true && (intCol == %@))\", 0, count: 0, { $0.boolCol && $0.intCol == 0 })\n        assertQuery(ModernAllTypesObject.self, \"((intCol == %@) || boolCol == false)\", 0, count: 1, { $0.intCol == 0 || !$0.boolCol })\n        assertQuery(ModernAllTypesObject.self, \"(boolCol == false || (intCol == %@))\", 0, count: 1, { !$0.boolCol || $0.intCol == 0 })\n    }\n\n    func testEqualAnyRealmValue() {\n        let circleObject = self.circleObject\n        let object = objects()[0]\n        % for value in anyRealmValues:\n        setAnyRealmValueCol(with: ${value.value(0)}, object: object)\n        assertQuery(\"(anyCol == %@)\", ${value.enumValue(0)}, count: 1) {\n            $0.anyCol == ${value.value(0)}\n        }\n        % end\n    }\n\n    func testEqualAnyRealmList() {\n        let circleObject = self.circleObject\n        let object = objects()[0]\n        let list = List<AnyRealmValue>()\n        % for value in anyRealmValues:\n        list.removeAll()\n        list.append(${value.value(0)})\n        setAnyRealmValueCol(with: .list(list), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.list(list), count: 1) {\n            let list = List<AnyRealmValue>()\n            list.append(${value.value(0)})\n            return $0.anyCol == .list(list)\n        }\n        % end\n    }\n\n    func testEqualAnyRealmDictionary() {\n        let circleObject = self.circleObject\n        let object = objects()[0]\n        let dictionary = Map<String, AnyRealmValue>()\n        % for value in anyRealmValues:\n        dictionary.removeAll()\n        dictionary[\"key\"] = AnyRealmValue${value.value(0)}\n        setAnyRealmValueCol(with: .dictionary(dictionary), object: object)\n        assertQuery(\"(anyCol == %@)\", AnyRealmValue.dictionary(dictionary), count: 1) {\n            let dictionary = Map<String, AnyRealmValue>()\n            dictionary[\"key\"] = AnyRealmValue${value.value(0)}\n            return $0.anyCol == .dictionary(dictionary)\n        }\n        % end\n    }\n\n    func testNestedAnyRealmList() {\n        let object = objects()[0]\n        let subArray2: AnyRealmValue = AnyRealmValue.fromArray([ .string(\"john\"), .bool(false) ])\n        let subArray3: AnyRealmValue = AnyRealmValue.fromArray([ subArray2, .double(76.54) ])\n        let subArray4: AnyRealmValue = AnyRealmValue.fromArray([ subArray3, .int(99)])\n        let array: Array<AnyRealmValue> = [\n            subArray4, .float(20.34)\n        ]\n\n        setAnyRealmValueCol(with: AnyRealmValue.fromArray(array), object: object)\n        assertQuery(\"(anyCol[%@] == %@)\", values: [1, AnyRealmValue.float(20.34)], count: 1) {\n            $0.anyCol[1] == .float(20.34)\n        }\n\n        assertQuery(\"(anyCol[%K] == %@)\", values: [\"#any\", AnyRealmValue.float(20.34)], count: 1) {\n            $0.anyCol.any == .float(20.34)\n        }\n\n        assertQuery(\"(anyCol[%@][%@] == %@)\", values: [0, 1, AnyRealmValue.int(99)], count: 1) {\n            $0.anyCol[0][1] == .int(99)\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%@] == %@)\", values: [0, 0, 1, AnyRealmValue.double(76.54)], count: 1) {\n            $0.anyCol[0][0][1] == .double(76.54)\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%K] == %@)\", values: [0, 0, \"#any\", AnyRealmValue.double(76.54)], count: 1) {\n            $0.anyCol[0][0].any == .double(76.54)\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%@][%@] == %@)\", values: [0, 0, 0, 0, AnyRealmValue.string(\"john\")], count: 1) {\n            $0.anyCol[0][0][0][0] == .string(\"john\")\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%@][%@] == %@)\", values: [0, 0, 0, 1, AnyRealmValue.bool(false)], count: 1) {\n            $0.anyCol[0][0][0][1] == .bool(false)\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%@][%K] == %@)\", values: [0, 0, 0, \"#any\", AnyRealmValue.string(\"john\")], count: 1) {\n            $0.anyCol[0][0][0].any == .string(\"john\")\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%@][%K] == %@)\", values: [0, 0, 0, \"#any\", AnyRealmValue.bool(false)], count: 1) {\n            $0.anyCol[0][0][0].any == .bool(false)\n        }\n\n        assertQuery(\"(anyCol[%@][%@] >= %@)\", values: [0, 1, AnyRealmValue.int(99)], count: 1) {\n            $0.anyCol[0][1] >= .int(99)\n        }\n\n        assertQuery(\"(anyCol[%@][%@] <= %@)\", values: [0, 1, AnyRealmValue.int(99)], count: 1) {\n            $0.anyCol[0][1] <= .int(99)\n        }\n\n        assertQuery(\"(anyCol[%@][%@] != %@)\", values: [0, 1, AnyRealmValue.int(99)], count: 0) {\n            $0.anyCol[0][1] != .int(99)\n        }\n\n        assertQuery(\"(anyCol[%@] == %@)\", values: [\"#any\", AnyRealmValue.float(20.34)], count: 0) {\n            $0.anyCol[\"#any\"] == .float(20.34)\n        }\n    }\n\n    func testNestedAnyRealmDictionary() {\n        let object = objects()[0]\n        let subDict2: AnyRealmValue = AnyRealmValue.fromDictionary([\"key6\": .string(\"john\"), \"key7\": .bool(false)])\n        let subDict3: AnyRealmValue = AnyRealmValue.fromDictionary([\"key4\": subDict2, \"key5\": .double(76.54)])\n        let subDict4: AnyRealmValue = AnyRealmValue.fromDictionary([\"key2\": subDict3, \"key3\": .int(99)])\n        let dict: Dictionary<String, AnyRealmValue> = [\n            \"key0\": subDict4, \"key1\": .float(20.34)\n        ]\n\n        setAnyRealmValueCol(with: AnyRealmValue.fromDictionary(dict), object: object)\n        assertQuery(\"(anyCol[%@] == %@)\", values: [\"key1\", AnyRealmValue.float(20.34)], count: 1) {\n            $0.anyCol[\"key1\"] == .float(20.34)\n        }\n\n        assertQuery(\"(anyCol[%K] == %@)\", values: [\"#any\", AnyRealmValue.float(20.34)], count: 1) {\n            $0.anyCol.any == .float(20.34)\n        }\n\n        assertQuery(\"(anyCol[%@][%@] == %@)\", values: [\"key0\", \"key3\", AnyRealmValue.int(99)], count: 1) {\n            $0.anyCol[\"key0\"][\"key3\"] == .int(99)\n        }\n\n        assertQuery(\"(anyCol[%@][%K] == %@)\", values: [\"key0\", \"#any\", AnyRealmValue.int(99)], count: 1) {\n            $0.anyCol[\"key0\"].any == .int(99)\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%@] == %@)\", values: [\"key0\", \"key2\", \"key5\", AnyRealmValue.double(76.54)], count: 1) {\n            $0.anyCol[\"key0\"][\"key2\"][\"key5\"] == .double(76.54)\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%K] == %@)\", values: [\"key0\", \"key2\", \"#any\", AnyRealmValue.double(76.54)], count: 1) {\n            $0.anyCol[\"key0\"][\"key2\"].any == .double(76.54)\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%@][%@] == %@)\", values: [\"key0\", \"key2\", \"key4\", \"key6\", AnyRealmValue.string(\"john\")], count: 1) {\n            $0.anyCol[\"key0\"][\"key2\"][\"key4\"][\"key6\"] == .string(\"john\")\n        }\n\n        assertQuery(\"(anyCol[%@][%@][%@][%@] == %@)\", values: [\"key0\", \"key2\", \"key4\", \"key7\", AnyRealmValue.bool(false)], count: 1) {\n            $0.anyCol[\"key0\"][\"key2\"][\"key4\"][\"key7\"] == .bool(false)\n        }\n\n        assertQuery(\"(anyCol[%@][%K] >= %@)\", values: [\"key0\", \"#any\", AnyRealmValue.int(99)], count: 1) {\n            $0.anyCol[\"key0\"].any >= .int(99)\n        }\n\n        assertQuery(\"(anyCol[%@][%K] <= %@)\", values: [\"key0\", \"#any\", AnyRealmValue.int(99)], count: 1) {\n            $0.anyCol[\"key0\"].any <= .int(99)\n        }\n\n        assertQuery(\"(anyCol[%@][%@] != %@)\", values: [\"key0\", \"key3\", AnyRealmValue.int(99)], count: 0) {\n            $0.anyCol[\"key0\"][\"key3\"] != .int(99)\n        }\n\n        assertQuery(\"(anyCol[%@][%@] == %@)\", values: [\"key0\", \"#any\", AnyRealmValue.int(99)], count: 0) {\n            $0.anyCol[\"key0\"][\"#any\"] == .int(99)\n        }\n    }\n\n    func testEqualObject() {\n        let nestedObject = ModernAllTypesObject()\n        let object = objects().first!\n        try! realm.write {\n            object.objectCol = nestedObject\n        }\n        assertQuery(\"(objectCol == %@)\", nestedObject, count: 1) {\n            $0.objectCol == nestedObject\n        }\n    }\n\n    func testEqualEmbeddedObject() {\n        let object = ModernEmbeddedParentObject()\n        let nestedObject = ModernEmbeddedTreeObject1()\n        nestedObject.value = 123\n        object.object = nestedObject\n        try! realm.write {\n            realm.add(object)\n        }\n\n        let result1 = realm.objects(ModernEmbeddedParentObject.self).where {\n            $0.object == nestedObject\n        }\n        XCTAssertEqual(result1.count, 1)\n\n        let nestedObject2 = ModernEmbeddedTreeObject1()\n        nestedObject2.value = 123\n        let result2 = realm.objects(ModernEmbeddedParentObject.self).where {\n            $0.object == nestedObject2\n        }\n        XCTAssertEqual(result2.count, 0)\n    }\n\n    private func createLinksToMappedEmbeddedObject() {\n        try! realm.write {\n            let obj = realm.objects(AllCustomPersistableTypes.self).first!\n            obj.object = EmbeddedObjectWrapper(value: 2)\n            _ = realm.create(LinkToAllCustomPersistableTypes.self, value: [obj, [obj], [obj], [\"1\": obj]])\n        }\n    }\n\n    func testEqualMappedToEmbeddedObject() {\n        createLinksToMappedEmbeddedObject()\n\n        assertQuery(AllCustomPersistableTypes.self, \"(object.value == %@)\", 2, count: 1) {\n            $0.object.persistableValue.value == 2\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(object == %@)\", EmbeddedObjectWrapper(value: 2), count: 1) {\n            $0.object == EmbeddedObjectWrapper(value: 2)\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(object.value == %@)\", 3, count: 0) {\n            $0.object.persistableValue.value == 3\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(object == %@)\", EmbeddedObjectWrapper(value: 3), count: 0) {\n            $0.object == EmbeddedObjectWrapper(value: 3)\n        }\n        % for modifier, path, keyPath in [('', 'object', 'object'), ('ANY ', 'list', 'list'), ('ANY ', 'set', 'set'), ('ANY ', 'map.values', 'map.@allValues')]:\n\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(${modifier}${keyPath}.object.value == %@)\", 2, count: 1) {\n            $0.${path}.object.persistableValue.value == 2\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(${modifier}${keyPath}.object == %@)\", EmbeddedObjectWrapper(value: 2), count: 1) {\n            $0.${path}.object == EmbeddedObjectWrapper(value: 2)\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(${modifier}${keyPath}.object.value == %@)\", 3, count: 0) {\n            $0.${path}.object.persistableValue.value == 3\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(${modifier}${keyPath}.object == %@)\", EmbeddedObjectWrapper(value: 3), count: 0) {\n            $0.${path}.object == EmbeddedObjectWrapper(value: 3)\n        }\n        % end\n    }\n\n    func testMemberwiseEquality() {\n        realm.beginWrite()\n        let obj1 = AddressSwiftWrapper(persistedValue: AddressSwift(value: [\"a\", \"b\"]))\n        let obj2 = AddressSwiftWrapper(persistedValue: AddressSwift(value: [\"a\", \"c\"]))\n        let obj3 = AddressSwiftWrapper(persistedValue: AddressSwift(value: [\"b\", \"b\"]))\n        let linkObj1 = realm.create(LinkToAddressSwiftWrapper.self, value: [obj1, obj1])\n        let linkObj2 = realm.create(LinkToAddressSwiftWrapper.self, value: [obj2, obj2])\n        _ = realm.create(LinkToAddressSwiftWrapper.self, value: [obj3, obj3])\n\n        // Test basic equality\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(object == %@)\", obj1, count: 1) {\n            $0.object == obj1\n        }\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(object != %@)\", obj1, count: 2) {\n            $0.object != obj1\n        }\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(optObject == %@)\", obj1, count: 1) {\n            $0.optObject == obj1\n        }\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(optObject != %@)\", obj1, count: 2) {\n            $0.optObject != obj1\n        }\n\n        // Verify that the expanded comparison nested groups correctly. If it doesn't\n        // start/end a subgroup, it'd end up as ((x or y) and z) instead of (x or (y and z)).\n        assertQuery(LinkToAddressSwiftWrapper.self, \"((object.city != %@) || (object == %@))\", values: [\"c\", obj1], count: 3) {\n            $0.object.persistableValue.city != \"c\" || $0.object == obj1\n        }\n        // Check for ((x and y) or Z) rather than (x and (y or z))\n        assertQuery(LinkToAddressSwiftWrapper.self, \"((object == %@) || (object.city != %@))\", values: [obj1, \"c\"], count: 3) {\n             $0.object == obj1 || $0.object.persistableValue.city != \"c\"\n        }\n\n        // Basic equality in collections\n        linkObj1.list.append(obj1)\n        linkObj1.map[\"foo\"] = obj1\n        linkObj1.optMap[\"foo\"] = obj1\n\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(ANY list == %@)\", obj1, count: 1) {\n            $0.list == obj1\n        }\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(ANY list != %@)\", obj1, count: 0) {\n            $0.list != obj1\n        }\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(ANY map.@allValues == %@)\", obj1, count: 1) {\n            $0.map.values == obj1\n        }\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(ANY map.@allValues != %@)\", obj1, count: 0) {\n            $0.map.values != obj1\n        }\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(ANY optMap.@allValues != %@)\", obj1, count: 0) {\n            $0.optMap.values != obj1\n        }\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(ANY optMap.@allValues == %@)\", obj1, count: 1) {\n            $0.optMap.values == obj1\n        }\n\n        // Verify that collections use a subquery. If they didn't, this object would\n        // now match as it has objects which match each property separately\n        linkObj2.list.append(obj2)\n        linkObj2.list.append(obj3)\n\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(ANY list == %@)\", obj1, count: 1) {\n            $0.list == obj1\n        }\n        assertQuery(LinkToAddressSwiftWrapper.self, \"(ANY list != %@)\", obj1, count: 1) {\n            $0.list != obj1\n        }\n\n        realm.cancelWrite()\n    }\n\n    func testInvalidMemberwiseEquality() {\n        assertThrows(assertQuery(LinkToWrapperForTypeWithObjectLink.self, \"\", count: 0) {\n            $0.link == WrapperForTypeWithObjectLink()\n        }, reason: \"Unsupported property 'TypeWithObjectLink.value' for memberwise equality query: object links are not implemented.\")\n        assertThrows(assertQuery(LinkToWrapperForTypeWithCollection.self, \"\", count: 0) {\n            $0.link == WrapperForTypeWithCollection()\n        }, reason: \"Unsupported property 'TypeWithCollection.list' for memberwise equality query: equality on collections is not implemented.\")\n    }\n\n    func testNotEqualAnyRealmValue() {\n        let circleObject = self.circleObject\n        let object = objects()[0]\n        % for value in anyRealmValues:\n        setAnyRealmValueCol(with: ${value.value(0)}, object: object)\n        assertQuery(\"(anyCol != %@)\", ${value.enumValue(0)}, count: 0) {\n            $0.anyCol != ${value.value(0)}\n        }\n        % end\n    }\n\n    func testNotEqualObject() {\n        let nestedObject = ModernAllTypesObject()\n        let object = objects().first!\n        try! realm.write {\n            object.objectCol = nestedObject\n        }\n        // Count will be one because nestedObject.objectCol will be nil\n        assertQuery(\"(objectCol != %@)\", nestedObject, count: 1) {\n            $0.objectCol != nestedObject\n        }\n    }\n\n    func testNotEqualEmbeddedObject() {\n        let object = ModernEmbeddedParentObject()\n        let nestedObject = ModernEmbeddedTreeObject1()\n        nestedObject.value = 123\n        object.object = nestedObject\n        try! realm.write {\n            realm.add(object)\n        }\n\n        let result1 = realm.objects(ModernEmbeddedParentObject.self).where {\n            $0.object != nestedObject\n        }\n        XCTAssertEqual(result1.count, 0)\n\n        let nestedObject2 = ModernEmbeddedTreeObject1()\n        nestedObject2.value = 123\n        let result2 = realm.objects(ModernEmbeddedParentObject.self).where {\n            $0.object != nestedObject2\n        }\n        XCTAssertEqual(result2.count, 1)\n    }\n\n    func testNotEqualMappedToEmbeddedObject() {\n        createLinksToMappedEmbeddedObject()\n\n        assertQuery(AllCustomPersistableTypes.self, \"(object.value != %@)\", 2, count: 0) {\n            $0.object.persistableValue.value != 2\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(object != %@)\", EmbeddedObjectWrapper(value: 2), count: 0) {\n            $0.object != EmbeddedObjectWrapper(value: 2)\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(object.value != %@)\", 3, count: 1) {\n            $0.object.persistableValue.value != 3\n        }\n        assertQuery(AllCustomPersistableTypes.self, \"(object != %@)\", EmbeddedObjectWrapper(value: 3), count: 1) {\n            $0.object != EmbeddedObjectWrapper(value: 3)\n        }\n\n        % for modifier, path, keyPath in [('', 'object', 'object'), ('ANY ', 'list', 'list'), ('ANY ', 'set', 'set'), ('ANY ', 'map.values', 'map.@allValues')]:\n\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(${modifier}${keyPath}.object.value != %@)\", 2, count: 0) {\n            $0.${path}.object.persistableValue.value != 2\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(${modifier}${keyPath}.object != %@)\", EmbeddedObjectWrapper(value: 2), count: 0) {\n            $0.${path}.object != EmbeddedObjectWrapper(value: 2)\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(${modifier}${keyPath}.object.value != %@)\", 3, count: 1) {\n            $0.${path}.object.persistableValue.value != 3\n        }\n        assertQuery(LinkToAllCustomPersistableTypes.self, \"(${modifier}${keyPath}.object != %@)\", EmbeddedObjectWrapper(value: 3), count: 1) {\n            $0.${path}.object != EmbeddedObjectWrapper(value: 3)\n        }\n        % end\n    }\n\n    func validateNumericComparisons<Root: Object, T: _Persistable>(\n            _ name: String, _ lhs: (Query<Root>) -> Query<T>,\n            _ value: T, count: Int = 1, ltCount: Int = 0, gtCount: Int = 0) where T.PersistedType: _QueryNumeric {\n        assertQuery(Root.self, \"(\\(name) > %@)\", value, count: gtCount) {\n            lhs($0) > value\n        }\n        assertQuery(Root.self, \"(\\(name) >= %@)\", value, count: count) {\n            lhs($0) >= value\n        }\n        assertQuery(Root.self, \"(\\(name) < %@)\", value, count: ltCount) {\n            lhs($0) < value\n        }\n        assertQuery(Root.self, \"(\\(name) <= %@)\", value, count: count) {\n            lhs($0) <= value\n        }\n    }\n\n    func testNumericComparisons() {\n        % for property in numeric(properties + optProperties):\n        validateNumericComparisons(\"${property.colName}\", \\Query<${property.className}>.${property.colName}, ${property.value(1)})\n        % end\n\n        % for property in numeric(optProperties):\n        validateNumericComparisons(\"${property.colName}\", \\Query<${property.className}>.${property.colName}, nil, count: 0)\n        % end\n    }\n\n    func validateStringComparisons<Root: Object, T: _Persistable>(\n            _ name: String, _ lhs: (Query<Root>) -> Query<T>,\n            _ value: T, letCount: Int = 1, getCount: Int = 1, ltCount: Int = 0, gtCount: Int = 0) where T.PersistedType: _QueryString {\n        assertQuery(Root.self, \"(\\(name) > %@)\", value, count: gtCount) {\n            lhs($0) > value\n        }\n        assertQuery(Root.self, \"(\\(name) >= %@)\", value, count: getCount) {\n            lhs($0) >= value\n        }\n        assertQuery(Root.self, \"(\\(name) < %@)\", value, count: ltCount) {\n            lhs($0) < value\n        }\n        assertQuery(Root.self, \"(\\(name) <= %@)\", value, count: letCount) {\n            lhs($0) <= value\n        }\n    }\n\n    func testStringComparisons() {\n        % for property in string(properties + optProperties):\n        validateStringComparisons(\"${property.colName}\", \\Query<${property.className}>.${property.colName}, ${property.value(1)})\n        % end\n\n        % for property in string(optProperties):\n        validateStringComparisons(\"${property.colName}\", \\Query<${property.className}>.${property.colName}, nil, letCount: 0, gtCount: 1)\n        % end\n    }\n\n    func testGreaterThanNumericAnyRealmValue() {\n        let object = objects()[0]\n        % for value in numeric(anyRealmValues):\n        setAnyRealmValueCol(with: ${value.value(0)}, object: object)\n        assertQuery(\"(anyCol > %@)\", ${value.enumValue(0)}, count: 0) {\n            $0.anyCol > ${value.value(0)}\n        }\n        assertQuery(\"(anyCol >= %@)\", ${value.enumValue(0)}, count: 1) {\n            $0.anyCol >= ${value.value(0)}\n        }\n        % end\n    }\n\n    func testGreaterThanStringAnyRealmValue() {\n        let object = objects()[0]\n        % for value in string(anyRealmValues):\n        setAnyRealmValueCol(with: ${value.value(0)}, object: object)\n        assertQuery(\"(anyCol > %@)\", ${value.enumValue(0)}, count: 0) {\n            $0.anyCol > ${value.value(0)}\n        }\n        assertQuery(\"(anyCol >= %@)\", ${value.enumValue(0)}, count: 1) {\n            $0.anyCol >= ${value.value(0)}\n        }\n        % end\n    }\n\n    func testLessThanNumericAnyRealmValue() {\n        let object = objects()[0]\n        % for value in numeric(anyRealmValues):\n        setAnyRealmValueCol(with: ${value.value(0)}, object: object)\n        assertQuery(\"(anyCol < %@)\", ${value.enumValue(0)}, count: 0) {\n            $0.anyCol < ${value.value(0)}\n        }\n        assertQuery(\"(anyCol <= %@)\", ${value.enumValue(0)}, count: 1) {\n            $0.anyCol <= ${value.value(0)}\n        }\n        % end\n    }\n\n    func testLessThanStringAnyRealmValue() {\n        let object = objects()[0]\n        % for value in string(anyRealmValues):\n        setAnyRealmValueCol(with: ${value.value(0)}, object: object)\n        assertQuery(\"(anyCol < %@)\", ${value.enumValue(0)}, count: 0) {\n            $0.anyCol < ${value.value(0)}\n        }\n        assertQuery(\"(anyCol <= %@)\", ${value.enumValue(0)}, count: 1) {\n            $0.anyCol <= ${value.value(0)}\n        }\n        % end\n    }\n\n    private func validateNumericContains<Root: Object, T: _RealmSchemaDiscoverable & QueryValue & Comparable>(\n            _ name: String, _ lhs: (Query<Root>) -> Query<T>) {\n        let values = T.queryValues()\n        assertQuery(Root.self, \"((\\(name) >= %@) && (\\(name) < %@))\", values: [values[0], values[2]], count: 1) {\n            lhs($0).contains(values[0]..<values[2])\n        }\n        assertQuery(Root.self, \"((\\(name) >= %@) && (\\(name) < %@))\", values: [values[0], values[1]], count: 0) {\n            lhs($0).contains(values[0]..<values[1])\n        }\n        assertQuery(Root.self, \"(\\(name) BETWEEN {%@, %@})\", values: [values[0], values[2]], count: 1) {\n            lhs($0).contains(values[0]...values[2])\n        }\n        assertQuery(Root.self, \"(\\(name) BETWEEN {%@, %@})\", values: [values[0], values[1]], count: 1) {\n            lhs($0).contains(values[0]...values[1])\n        }\n    }\n    private func validateNumericContains<Root: Object, T: _RealmSchemaDiscoverable & OptionalProtocol>(\n            _ name: String, _ lhs: (Query<Root>) -> Query<T>) where T.Wrapped: Comparable & QueryValue {\n        let values = T.Wrapped.queryValues()\n        assertQuery(Root.self, \"((\\(name) >= %@) && (\\(name) < %@))\", values: [values[0], values[2]], count: 1) {\n            lhs($0).contains(values[0]..<values[2])\n        }\n        assertQuery(Root.self, \"((\\(name) >= %@) && (\\(name) < %@))\", values: [values[0], values[1]], count: 0) {\n            lhs($0).contains(values[0]..<values[1])\n        }\n        assertQuery(Root.self, \"(\\(name) BETWEEN {%@, %@})\", values: [values[0], values[2]], count: 1) {\n            lhs($0).contains(values[0]...values[2])\n        }\n        assertQuery(Root.self, \"(\\(name) BETWEEN {%@, %@})\", values: [values[0], values[1]], count: 1) {\n            lhs($0).contains(values[0]...values[1])\n        }\n    }\n\n    func testNumericContains() {\n        % for property in numeric(properties + optProperties):\n        validateNumericContains(\"${property.colName}\", \\Query<${property.className}>.${property.comparableName})\n        % end\n    }\n\n    // MARK: - Strings\n\n    let stringModifiers: [(String, StringOptions)] = [\n        (\"\", []),\n        (\"[c]\", [.caseInsensitive]),\n        (\"[d]\", [.diacriticInsensitive]),\n        (\"[cd]\", [.caseInsensitive, .diacriticInsensitive]),\n    ]\n\n    private func validateStringOperations<Root: Object, T: _Persistable>(\n            _ name: String, _ lhs: (Query<Root>) -> Query<T>,\n            _ values: (T, T, T), count: (Bool, StringOptions) -> Int)\n            where T.PersistedType: _QueryString {\n        let (full, prefix, suffix) = values\n        for (modifier, options) in stringModifiers {\n            let matchingCount = count(true, options)\n            let notMatchingCount = count(false, options)\n            assertQuery(Root.self, \"(\\(name) ==\\(modifier) %@)\", full, count: matchingCount) {\n                lhs($0).equals(full, options: [options])\n            }\n            assertQuery(Root.self, \"(NOT \\(name) ==\\(modifier) %@)\", full, count: 1 - matchingCount) {\n                !lhs($0).equals(full, options: [options])\n            }\n            assertQuery(Root.self, \"(\\(name) !=\\(modifier) %@)\", full, count: notMatchingCount) {\n                lhs($0).notEquals(full, options: [options])\n            }\n            assertQuery(Root.self, \"(NOT \\(name) !=\\(modifier) %@)\", full, count: 1 - notMatchingCount) {\n                !lhs($0).notEquals(full, options: [options])\n            }\n\n            assertQuery(Root.self, \"(\\(name) CONTAINS\\(modifier) %@)\", full, count: matchingCount) {\n                lhs($0).contains(full, options: [options])\n            }\n            assertQuery(Root.self, \"(NOT \\(name) CONTAINS\\(modifier) %@)\", full, count: 1 - matchingCount) {\n                !lhs($0).contains(full, options: [options])\n            }\n\n            assertQuery(Root.self, \"(\\(name) BEGINSWITH\\(modifier) %@)\", prefix, count: matchingCount) {\n                lhs($0).starts(with: prefix, options: [options])\n            }\n            assertQuery(Root.self, \"(NOT \\(name) BEGINSWITH\\(modifier) %@)\", prefix, count: 1 - matchingCount) {\n                !lhs($0).starts(with: prefix, options: [options])\n            }\n\n            assertQuery(Root.self, \"(\\(name) ENDSWITH\\(modifier) %@)\", suffix, count: matchingCount) {\n                lhs($0).ends(with: suffix, options: [options])\n            }\n            assertQuery(Root.self, \"(NOT \\(name) ENDSWITH\\(modifier) %@)\", suffix, count: 1 - matchingCount) {\n                !lhs($0).ends(with: suffix, options: [options])\n            }\n        }\n    }\n\n    % def ifEnum(p, c1, c2): return c1 if p.isEnum else c2\n    func testStringOperations() {\n        % for p in string(properties + optProperties):\n        validateStringOperations(\"${p.colName}\", \\Query<${p.className}>.${p.rawValueName},\n                                 (${p.wrap('\"Foó\"')}, ${p.wrap('\"Fo\"')}, ${p.wrap('\"oó\"')}),\n                                 count: { (equals, _) in equals ? ${ifEnum(p, 0, 1)} : ${ifEnum(p, 1, 0)} })\n        % end\n    }\n\n    private func validateStringLike<Root: Object, T: _Persistable>(\n            _ name: String, _ lhs: (Query<Root>) -> Query<T>, _ strings: [(T, Int, Int)], canMatch: Bool) where T.PersistedType: _QueryString {\n        for (str, sensitiveCount, insensitiveCount) in strings {\n            assertQuery(Root.self, \"(\\(name) LIKE %@)\", str, count: canMatch ? sensitiveCount : 0) {\n                lhs($0).like(str)\n            }\n            assertQuery(Root.self, \"(\\(name) LIKE[c] %@)\", str, count: canMatch ? insensitiveCount : 0) {\n                lhs($0).like(str, caseInsensitive: true)\n            }\n        }\n    }\n\n    func testStringLike() {\n        let likeStrings: [(String, Int, Int)] = [\n            (\"Foó\", 1, 1),\n            (\"f*\", 0, 1),\n            (\"*ó\", 1, 1),\n            (\"f?ó\", 0, 1),\n            (\"f*ó\", 0, 1),\n            (\"f??ó\", 0, 0),\n            (\"*o*\", 1, 1),\n            (\"*O*\", 0, 1),\n            (\"?o?\", 1, 1),\n            (\"?O?\", 0, 1)\n        ]\n        % for property in string(properties + optProperties):\n        validateStringLike(\"${property.colName}\", \\Query<${property.className}>.${property.rawValueName},\n                           likeStrings.map { (${property.wrap('$0.0')}, $0.1, $0.2) }, canMatch: ${ifEnum(property, 'false', 'true')})\n        % end\n    }\n\n    private func validateStringLexicographicalComparison<Root: Object, T: _Persistable>(\n            _ name: String, _ lhs: (Query<Root>) -> Query<T>, _ strings: [(T, Int, Int, Int, Int)]) where T.PersistedType: _QueryString {\n        for (str, gtCount, getCount, ltCount, letCount) in strings {\n            assertQuery(Root.self, \"(\\(name) > %@)\", str, count: gtCount) {\n                lhs($0) > str\n            }\n            assertQuery(Root.self, \"(\\(name) >= %@)\", str, count: getCount) {\n                lhs($0) >= str\n            }\n            assertQuery(Root.self, \"(\\(name) < %@)\", str, count: ltCount) {\n                lhs($0) < str\n            }\n            assertQuery(Root.self, \"(\\(name) <= %@)\", str, count: letCount) {\n                lhs($0) <= str\n            }\n        }\n    }\n\n    func testLexicographicalComparison() throws {\n        let obj = objects().first!\n        try realm.write {\n            obj.stringEnumCol = .value4\n            obj.optStringEnumCol = .value4\n        }\n        let likeStrings: [(String, Int, Int, Int, Int)] = [\n            (\"Foó\", 0, 1, 0, 1),\n            (\"Foo\", 1, 1, 0, 0),\n            (\"f*\", 0, 0, 1, 1),\n            (\"*ó\", 1, 1, 0, 0),\n            (\"f?ó\", 0, 0, 1, 1),\n            (\"f*ó\", 0, 0, 1, 1),\n            (\"f??ó\", 0, 0, 1, 1),\n            (\"*o*\", 1, 1, 0, 0),\n            (\"*O*\", 1, 1, 0, 0),\n            (\"?o?\", 1, 1, 0, 0),\n            (\"?O?\", 1, 1, 0, 0),\n            (\"Foô\", 0, 0, 1, 1),\n            (\"Fpó\", 0, 0, 1, 1),\n            (\"Goó\", 0, 0, 1, 1),\n            (\"Foò\", 1, 1, 0, 0),\n            (\"Fnó\", 1, 1, 0, 0),\n            (\"Eoó\", 1, 1, 0, 0),\n        ]\n        % for property in string(properties + optProperties):\n        validateStringLexicographicalComparison(\"${property.colName}\", \\Query<${property.className}>.${property.rawValueName},\n                           likeStrings.map { (${property.wrap('$0.0')}, $0.1, $0.2, $0.3, $0.4) })\n        % end\n    }\n\n    // MARK: - Data\n\n    func validateData<Root: Object, T: _Persistable>(_ name: String, _ lhs: (Query<Root>) -> Query<T>,\n                                                     zeroData: T, oneData: T) where T.PersistedType: _QueryBinary {\n        assertQuery(Root.self, \"(\\(name) BEGINSWITH %@)\", zeroData, count: 1) {\n            lhs($0).starts(with: zeroData)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name) BEGINSWITH %@)\", zeroData, count: 0) {\n            !lhs($0).starts(with: zeroData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) ENDSWITH %@)\", zeroData, count: 1) {\n            lhs($0).ends(with: zeroData)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name) ENDSWITH %@)\", zeroData, count: 0) {\n            !lhs($0).ends(with: zeroData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) CONTAINS %@)\", zeroData, count: 1) {\n            lhs($0).contains(zeroData)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name) CONTAINS %@)\", zeroData, count: 0) {\n            !lhs($0).contains(zeroData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) == %@)\", zeroData, count: 0) {\n            lhs($0).equals(zeroData)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name) == %@)\", zeroData, count: 1) {\n            !lhs($0).equals(zeroData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) != %@)\", zeroData, count: 1) {\n            lhs($0).notEquals(zeroData)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name) != %@)\", zeroData, count: 0) {\n            !lhs($0).notEquals(zeroData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) BEGINSWITH %@)\", oneData, count: 0) {\n            lhs($0).starts(with: oneData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) ENDSWITH %@)\", oneData, count: 0) {\n            lhs($0).ends(with: oneData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) CONTAINS %@)\", oneData, count: 0) {\n            lhs($0).contains(oneData)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name) CONTAINS %@)\", oneData, count: 1) {\n            !lhs($0).contains(oneData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) CONTAINS %@)\", oneData, count: 0) {\n            lhs($0).contains(oneData)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name) CONTAINS %@)\", oneData, count: 1) {\n            !lhs($0).contains(oneData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) == %@)\", oneData, count: 0) {\n            lhs($0).equals(oneData)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name) == %@)\", oneData, count: 1) {\n            !lhs($0).equals(oneData)\n        }\n\n        assertQuery(Root.self, \"(\\(name) != %@)\", oneData, count: 1) {\n            lhs($0).notEquals(oneData)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name) != %@)\", oneData, count: 0) {\n            !lhs($0).notEquals(oneData)\n        }\n    }\n\n    func testBinarySearchQueries() {\n        % for property in binary(properties + optProperties):\n        validateData(\"${property.colName}\", \\Query<${property.className}>.${property.colName},\n                     zeroData: ${property.wrap('Data(count: 28)')}, oneData: ${property.wrap('Data(repeating: 1, count: 28)')})\n        % end\n    }\n\n    // MARK: - Array/Set\n\n    % for (protocol, element) in [('RealmCollection', 'Element'), ('RealmKeyedCollection', 'Value')]:\n    private func validateCollectionContains<Root: Object, T: ${protocol}>(_ name: String, _ lhs: (Query<Root>) -> Query<T>)\n            where T.${element}: QueryValue {\n        let values = T.${element}.queryValues()\n\n        assertQuery(Root.self, \"(%@ IN \\(name))\", values[0], count: 1) {\n            lhs($0).contains(values[0])\n        }\n        assertQuery(Root.self, \"(%@ IN \\(name))\", values[2], count: 0) {\n            lhs($0).contains(values[2])\n        }\n\n        assertQuery(Root.self, \"(NOT %@ IN \\(name))\", values[0], count: 0) {\n            !lhs($0).contains(values[0])\n        }\n        assertQuery(Root.self, \"(NOT %@ IN \\(name))\", values[2], count: 1) {\n            !lhs($0).contains(values[2])\n        }\n    }\n    private func validateCollectionContainsNil<Root: Object, T: ${protocol}>(_ name: String, _ lhs: (Query<Root>) -> Query<T>)\n            where T.${element}: QueryValue & ExpressibleByNilLiteral {\n        assertQuery(Root.self, \"(%@ IN \\(name))\", NSNull(), count: 0) {\n            lhs($0).contains(nil)\n        }\n        assertQuery(Root.self, \"(NOT %@ IN \\(name))\", NSNull(), count: 1) {\n            !lhs($0).contains(nil)\n        }\n    }\n    % end\n\n    func testCollectionContainsElement() {\n        % for property in listProperties + optListProperties + setProperties + optSetProperties + mapProperties + optMapProperties:\n        validateCollectionContains(\"${property.colName}\", \\Query<${property.className}>.${property.colName})\n        % end\n\n        % for property in optListProperties + optSetProperties + optMapProperties:\n        validateCollectionContainsNil(\"${property.colName}\", \\Query<${property.className}>.${property.colName})\n        % end\n    }\n\n    func testListContainsObject() {\n        let obj = objects().first!\n        let colObj = collectionObject()\n        let result = realm.objects(ModernCollectionObject.self).where {\n            $0.list.contains(obj)\n        }\n        XCTAssertEqual(result.count, 0)\n        try! realm.write {\n            colObj.list.append(obj)\n        }\n        XCTAssertEqual(result.count, 1)\n    }\n\n    func testCollectionContainsRange() {\n        % for property in numeric(listProperties + optListProperties + setProperties + optSetProperties + mapProperties + optMapProperties):\n        assertQuery(${property.className}.self, \"((${property.colName}.@min >= %@) && (${property.colName}.@max <= %@))\",\n                    values: [${property.comparableValue(0)}, ${property.comparableValue(1)}], count: 1) {\n            $0.${property.comparableName}.contains(${property.comparableValue(0)}...${property.comparableValue(1)})\n        }\n        assertQuery(${property.className}.self, \"((${property.colName}.@min >= %@) && (${property.colName}.@max < %@))\",\n                    values: [${property.comparableValue(0)}, ${property.comparableValue(1)}], count: 0) {\n            $0.${property.comparableName}.contains(${property.comparableValue(0)}..<${property.comparableValue(1)})\n        }\n        % end\n    }\n\n    func testListContainsAnyInObject() {\n        % for property in listProperties + optListProperties:\n        assertQuery(${property.className}.self, \"(ANY ${property.colName} IN %@)\",\n                    values: [NSArray(array: [${property.enumValue(0)}, ${property.enumValue(1)}])], count: 1) {\n            $0.${property.colName}.containsAny(in: [${property.value(0)}, ${property.value(1)}])\n        }\n        % end\n\n        let colObj = ModernCollectionObject()\n        let obj = objects().first!\n        colObj.list.append(obj)\n        try! realm.write {\n            realm.add(colObj)\n        }\n\n        assertQuery(ModernCollectionObject.self, \"(ANY list IN %@)\", values: [NSArray(array: [obj])], count: 1) {\n            $0.list.containsAny(in: [obj])\n        }\n    }\n\n    func testCollectionFromProperty() {\n        try! realm.write {\n            % for className, linkingClassName in classNames:\n            let obj${className} = realm.objects(${className}.self).first!\n            _ = realm.create(${linkingClassName}.self, value: [\n                \"list\": [obj${className}],\n                \"set\": [obj${className}],\n                \"map\": [\"foo\": obj${className}]\n            ])\n            % end\n        }\n\n        func test<Root: LinkToTestObject>(\n                _ type: Root.Type, _ predicate: String, _ value: Any,\n                _ q1: ((Query<Root.Child>) -> Query<Bool>), _ q2: ((Query<Root.Child?>) -> Query<Bool>)) {\n            assertPredicate(predicate, [value], q1)\n            assertPredicate(predicate, [value], q2)\n            let obj = realm.objects(Root.self).first!\n            XCTAssertEqual(obj.list.where(q1).count, 1)\n            XCTAssertEqual(obj.set.where(q1).count, 1)\n            XCTAssertEqual(obj.map.where(q2).count, 1)\n        }\n\n        // swiftlint:disable opening_brace\n        % for property in properties + optProperties:\n        test(${property.linkingClassName}.self, \"(${property.colName} == %@)\",\n             ${property.enumValue(1)},\n             { $0.${property.colName} == ${property.value(1)} },\n             { $0.${property.colName} == ${property.value(1)} })\n        % end\n        // swiftlint:enable opening_brace\n    }\n\n    func testSetContainsObject() {\n        let obj = objects().first!\n        let colObj = collectionObject()\n        let result = realm.objects(ModernCollectionObject.self).where {\n            $0.set.contains(obj)\n        }\n        XCTAssertEqual(result.count, 0)\n        try! realm.write {\n            colObj.set.insert(obj)\n        }\n        XCTAssertEqual(result.count, 1)\n    }\n\n    func testSetContainsAnyInObject() {\n        % for property in setProperties + optSetProperties:\n        assertQuery(${property.className}.self, \"(ANY ${property.colName} IN %@)\",\n                    values: [NSArray(array: [${property.enumValue(0)}, ${property.enumValue(1)}])], count: 1) {\n            $0.${property.colName}.containsAny(in: [${property.value(0)}, ${property.value(1)}])\n        }\n        % end\n\n        let colObj = ModernCollectionObject()\n        let obj = objects().first!\n        colObj.set.insert(obj)\n        try! realm.write {\n            realm.add(colObj)\n        }\n\n        assertQuery(ModernCollectionObject.self, \"(ANY set IN %@)\", values: [NSArray(array: [obj])], count: 1) {\n            $0.set.containsAny(in: [obj])\n        }\n    }\n\n    // MARK: - Map\n\n    private func validateAllKeys<Root: Object, T: RealmKeyedCollection>(_ name: String, _ lhs: (Query<Root>) -> Query<T>)\n            where T.Key == String {\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys == %@)\", \"foo\", count: 1) {\n            lhs($0).keys == \"foo\"\n        }\n\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys != %@)\", \"foo\", count: 1) {\n            lhs($0).keys != \"foo\"\n        }\n\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys CONTAINS[cd] %@)\", \"foo\", count: 1) {\n            lhs($0).keys.contains(\"foo\", options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys CONTAINS %@)\", \"foo\", count: 1) {\n            lhs($0).keys.contains(\"foo\")\n        }\n\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys BEGINSWITH[cd] %@)\", \"foo\", count: 1) {\n            lhs($0).keys.starts(with: \"foo\", options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys BEGINSWITH %@)\", \"foo\", count: 1) {\n            lhs($0).keys.starts(with: \"foo\")\n        }\n\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys ENDSWITH[cd] %@)\", \"foo\", count: 1) {\n            lhs($0).keys.ends(with: \"foo\", options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys ENDSWITH %@)\", \"foo\", count: 1) {\n            lhs($0).keys.ends(with: \"foo\")\n        }\n\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys LIKE[c] %@)\", \"foo\", count: 1) {\n            lhs($0).keys.like(\"foo\", caseInsensitive: true)\n        }\n\n        assertQuery(Root.self, \"(ANY \\(name).@allKeys LIKE %@)\", \"foo\", count: 1) {\n            lhs($0).keys.like(\"foo\")\n        }\n    }\n\n    func testMapAllKeys() {\n        % for property in mapProperties + optMapProperties:\n        validateAllKeys(\"${property.colName}\", \\Query<${property.className}>.${property.colName})\n        % end\n    }\n\n    // swiftlint:disable unused_closure_parameter\n    func testMapAllValues() {\n        % for property in mapProperties + optMapProperties:\n        % notEqualCount = ', notEqualCount: 1' if property.category != 'bool' else ''\n        validateEquals(\"ANY ${property.colName}.@allValues\", \\Query<${property.className}>.${property.colName}.values, ${property.enumValue(0)}${notEqualCount})\n        % if property.category == 'numeric':\n        validateNumericComparisons(\"ANY ${property.colName}.@allValues\", \\Query<${property.className}>.${property.colName}.values, ${property.value(1)}, ltCount: 1)\n        % end\n        % if property.category == 'string':\n        validateStringOperations(\"ANY ${property.colName}.@allValues\", \\Query<${property.className}>.${property.colName}.values,\n                                 (${property.value(0)}, ${property.value(0)}, ${property.value(0)})) { equals, options in\n            % if not property.isEnum:\n            // Non-enum maps have the keys Foo and Foó, so !=[d] doesn't match any\n            if options.contains(.diacriticInsensitive) {\n                return equals ? 1 : 0\n            }\n            % end\n            return 1\n        }\n\n        assertQuery(${property.className}.self, \"(ANY ${property.colName}.@allValues LIKE[c] %@)\", ${property.enumValue(0)}, count: 1) {\n            $0.${property.colName}.values.like(${property.value(0)}, caseInsensitive: true)\n        }\n        assertQuery(${property.className}.self, \"(ANY ${property.colName}.@allValues LIKE %@)\", ${property.enumValue(0)}, count: 1) {\n            $0.${property.colName}.values.like(${property.value(0)})\n        }\n        % end\n\n        % end\n    }\n    // swiftlint:enable unused_closure_parameter\n\n    func testMapContainsObject() {\n        let obj = objects().first!\n        let colObj = collectionObject()\n        let result = realm.objects(ModernCollectionObject.self).where {\n            $0.map.contains(obj)\n        }\n        XCTAssertEqual(result.count, 0)\n        try! realm.write {\n            colObj.map[\"foo\"] = obj\n        }\n        XCTAssertEqual(result.count, 1)\n    }\n\n    private func validateMapSubscriptEquality<Root: Object, T: RealmKeyedCollection>(_ name: String, _ lhs: (Query<Root>) -> Query<T>, value: T.Value)\n            where T.Key == String {\n        assertQuery(Root.self, \"(\\(name)[%@] == %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"] == value\n        }\n        assertQuery(Root.self, \"(\\(name)[%@] != %@)\", values: [\"foo\", value], count: 0) {\n            lhs($0)[\"foo\"] != value\n        }\n    }\n\n    private func validateMapSubscriptNumericComparisons<Root: Object, T: RealmKeyedCollection>(_ name: String, _ lhs: (Query<Root>) -> Query<T>, value: T.Value)\n            where T.Value.PersistedType: _QueryNumeric, T.Key == String {\n        assertQuery(Root.self, \"(\\(name)[%@] > %@)\", values: [\"foo\", value], count: 0) {\n            lhs($0)[\"foo\"] > value\n        }\n        assertQuery(Root.self, \"(\\(name)[%@] >= %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"] >= value\n        }\n        assertQuery(Root.self, \"(\\(name)[%@] < %@)\", values: [\"foo\", value], count: 0) {\n            lhs($0)[\"foo\"] < value\n        }\n        assertQuery(Root.self, \"(\\(name)[%@] <= %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"] <= value\n        }\n    }\n\n    private func validateMapSubscriptStringComparisons<Root: Object, T: RealmKeyedCollection>(_ name: String, _ lhs: (Query<Root>) -> Query<T>, value: T.Value)\n            where T.Value.PersistedType: _QueryString, T.Key == String {\n        assertQuery(Root.self, \"(\\(name)[%@] CONTAINS[cd] %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"].contains(value, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(Root.self, \"(\\(name)[%@] CONTAINS %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"].contains(value)\n        }\n\n        assertQuery(Root.self, \"(NOT \\(name)[%@] CONTAINS %@)\", values: [\"foo\", value], count: 0) {\n            !lhs($0)[\"foo\"].contains(value)\n        }\n\n        assertQuery(Root.self, \"(\\(name)[%@] BEGINSWITH[cd] %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"].starts(with: value, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(Root.self, \"(\\(name)[%@] BEGINSWITH %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"].starts(with: value)\n        }\n\n        assertQuery(Root.self, \"(\\(name)[%@] ENDSWITH[cd] %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"].ends(with: value, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(Root.self, \"(\\(name)[%@] ENDSWITH %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"].ends(with: value)\n        }\n\n        assertQuery(Root.self, \"(\\(name)[%@] LIKE[c] %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"].like(value, caseInsensitive: true)\n        }\n\n        assertQuery(Root.self, \"(\\(name)[%@] LIKE %@)\", values: [\"foo\", value], count: 1) {\n            lhs($0)[\"foo\"].like(value)\n        }\n    }\n\n    func testMapAllKeysAllValuesSubscript() {\n        % for property in mapProperties + optMapProperties:\n        validateMapSubscriptEquality(\"${property.colName}\", \\Query<${property.className}>.${property.colName}, value: ${property.value(0)})\n        % if property.category == 'numeric':\n        validateMapSubscriptNumericComparisons(\"${property.colName}\", \\Query<${property.className}>.${property.colName}, value: ${property.value(0)})\n        % end\n        % if property.category == 'string':\n        validateMapSubscriptStringComparisons(\"${property.colName}\", \\Query<${property.className}>.${property.colName}, value: ${property.value(0)})\n        % end\n\n        % end\n    }\n\n    func testMapSubscriptObject() {\n        assertThrows(assertQuery(ModernCollectionObject.self, \"\", count: 0) {\n            $0.map[\"foo\"].objectCol.intCol == 5\n        }, reason: \"Cannot apply key path to Map subscripts.\")\n    }\n\n    func testMapContainsAnyInObject() {\n        % for property in mapProperties + optMapProperties:\n        assertQuery(${property.className}.self, \"(ANY ${property.colName} IN %@)\",\n                    values: [NSArray(array: [${property.enumValue(0)}, ${property.enumValue(1)}])], count: 1) {\n            $0.${property.colName}.containsAny(in: [${property.value(0)}, ${property.value(1)}])\n        }\n        % end\n\n        let colObj = ModernCollectionObject()\n        let obj = objects().first!\n        colObj.map[\"foo\"] = obj\n        try! realm.write {\n            realm.add(colObj)\n        }\n\n        assertQuery(ModernCollectionObject.self, \"(ANY map IN %@)\", values: [NSArray(array: [obj])], count: 1) {\n            $0.map.containsAny(in: [obj])\n        }\n    }\n\n    // MARK: - Linking Objects\n\n    func testLinkingObjects() {\n        let objects = Array(self.objects())\n        assertQuery(\"(%@ IN linkingObjects)\", objects.first!, count: 0) {\n            $0.linkingObjects.contains(objects.first!)\n        }\n\n        assertQuery(\"(ANY linkingObjects IN %@)\", objects, count: 0) {\n            $0.linkingObjects.containsAny(in: objects)\n        }\n\n        assertQuery(\"(NOT %@ IN linkingObjects)\", objects.first!, count: 1) {\n            !$0.linkingObjects.contains(objects.first!)\n        }\n\n        assertQuery(\"(NOT ANY linkingObjects IN %@)\", objects, count: 1) {\n            !$0.linkingObjects.containsAny(in: objects)\n        }\n    }\n\n    // MARK: - Compound\n\n    func testCompoundAnd() {\n        % p1 = properties[0]\n        % p2 = optProperties[0]\n        assertQuery(\"((${p1.colName} == %@) && (${p2.colName} == %@))\", values: [${p1.enumValue(1)}, ${p2.enumValue(1)}], count: 1) {\n            $0.${p1.colName} == ${p1.value(1)} && $0.${p2.colName} == ${p2.value(1)}\n        }\n        assertQuery(\"((${p1.colName} == %@) && (${p2.colName} == %@))\", values: [${p1.enumValue(1)}, ${p2.enumValue(1)}], count: 1) {\n            ($0.${p1.colName} == ${p1.value(1)}) && ($0.${p2.colName} == ${p2.value(1)})\n        }\n\n        // List\n\n        % for listProperty in [listProperties[0], optListProperties[0]]:\n        % property = properties[0]\n        % value1 = property.enumValue(1)\n        % wrongValue = property.enumValue(0)\n        % value2 = listProperty.enumValue(1)\n        assertQuery(\"((${property.colName} == %@) && (%@ IN ${listProperty.colName}))\", values: [${value1}, ${value2}], count: 1) {\n            $0.${property.colName} == ${property.value(1)} && $0.${listProperty.colName}.contains(${listProperty.value(1)})\n        }\n        % if not property.isEnum:\n        assertQuery(\"((${property.colName} != %@) && (%@ IN ${listProperty.colName}))\", values: [${wrongValue}, ${value2}], count: 1) {\n            $0.${property.colName} != ${property.value(0)} && $0.${listProperty.colName}.contains(${listProperty.value(1)})\n        }\n        % else:\n        assertQuery(\"((${property.colName} != %@) && (%@ IN ${listProperty.colName}))\", values: [${value1}, ${value2}], count: 0) {\n            $0.${property.colName} != ${property.value(1)} && $0.${listProperty.colName}.contains(${listProperty.value(1)})\n        }\n        % end\n        % end\n\n        // Set\n\n        % for setProperty in [setProperties[0], optSetProperties[0]]:\n        % value1 = property.enumValue(1)\n        % wrongValue = property.enumValue(0)\n        % value2 = setProperty.enumValue(1)\n        assertQuery(\"((${property.colName} == %@) && (%@ IN ${setProperty.colName}))\", values: [${value1}, ${value2}], count: 1) {\n            $0.${property.colName} == ${property.value(1)} && $0.${setProperty.colName}.contains(${setProperty.value(1)})\n        }\n        % if not property.isEnum:\n        assertQuery(\"((${property.colName} != %@) && (%@ IN ${setProperty.colName}))\", values: [${wrongValue}, ${value2}], count: 1) {\n            $0.${property.colName} != ${property.value(0)} && $0.${setProperty.colName}.contains(${setProperty.value(1)})\n        }\n        % else:\n        assertQuery(\"((${property.colName} != %@) && (%@ IN ${setProperty.colName}))\", values: [${value1}, ${value2}], count: 0) {\n            $0.${property.colName} != ${property.value(1)} && $0.${setProperty.colName}.contains(${setProperty.value(1)})\n        }\n        % end\n        % end\n\n        // Map\n\n        % for mapProperty in [mapProperties[0], optMapProperties[0]]:\n        % value1 = property.enumValue(1)\n        % wrongValue = property.enumValue(0)\n        % value2 = mapProperty.enumValue(1)\n        assertQuery(\"((${property.colName} == %@) && (%@ IN ${mapProperty.colName}))\", values: [${value1}, ${value2}], count: 1) {\n            $0.${property.colName} == ${property.value(1)} && $0.${mapProperty.colName}.contains(${mapProperty.value(1)})\n        }\n        % if not property.isEnum:\n        assertQuery(\"((${property.colName} != %@) && (${mapProperty.colName}[%@] == %@))\",\n                    values: [${wrongValue}, \"foo\", ${value2}], count: 1) {\n            ($0.${property.colName} != ${property.value(0)}) && ($0.${mapProperty.colName}[\"foo\"] == ${mapProperty.value(1)})\n        }\n        assertQuery(\"(((${property.colName} != %@) && (${mapProperty.colName}[%@] == %@)) && (${mapProperty.colName}[%@] == %@))\",\n                    values: [${wrongValue}, \"foo\", ${mapProperty.value(0)}, \"bar\", ${mapProperty.value(1)}], count: 1) {\n            ($0.${property.colName} != ${property.value(0)}) &&\n            ($0.${mapProperty.colName}[\"foo\"] == ${mapProperty.value(0)}) &&\n            ($0.${mapProperty.colName}[\"bar\"] == ${mapProperty.value(1)})\n        }\n        % else:\n        assertQuery(\"((${property.colName} != %@) && (${mapProperty.colName}[%@] == %@))\",\n                    values: [${value1}, \"foo\", ${value2}], count: 0) {\n            ($0.${property.colName} != ${property.value(1)}) && ($0.${mapProperty.colName}[\"foo\"] == ${mapProperty.value(1)})\n        }\n        % end\n        % end\n\n        // Aggregates\n\n        % for listProperty in [listProperties[1], optListProperties[1], mapProperties[1], optMapProperties[1]]:\n        let sum${listProperty.colName} = ${listProperty.value(0)} + ${listProperty.value(1)}\n        assertQuery(\"((((((${listProperty.colName}.@min <= %@) && (${listProperty.colName}.@max >= %@)) && (${listProperty.colName}.@sum == %@)) && (${listProperty.colName}.@count != %@)) && (${listProperty.colName}.@avg > %@)) && (${listProperty.colName}.@avg < %@))\",\n                    values: [${listProperty.value(0)}, ${listProperty.value(1)}, sum${listProperty.colName}, 0, ${listProperty.value(0)}, ${listProperty.value(1)}], count: 1) {\n            ($0.${listProperty.colName}.min <= ${listProperty.value(0)}) &&\n            ($0.${listProperty.colName}.max >= ${listProperty.value(1)}) &&\n            ($0.${listProperty.colName}.sum == sum${listProperty.colName}) &&\n            ($0.${listProperty.colName}.count != 0) &&\n            ($0.${listProperty.colName}.avg > ${listProperty.value(0)}) &&\n            ($0.${listProperty.colName}.avg < ${listProperty.value(1)})\n        }\n        % end\n\n        // Keypath Collection Aggregates\n\n        createKeypathCollectionAggregatesObject()\n        % for property in [properties[7], optProperties[7]]:\n\n        let sum${property.colName} = ${property.value(0)} + ${property.value(1)} + ${property.value(2)}\n        assertQuery(LinkToModernAllTypesObject.self, \"((((((list.@min.${property.colName} <= %@) && (list.@max.${property.colName} >= %@)) && (list.@sum.${property.colName} == %@)) && (list.@min.${property.colName} != %@)) && (list.@avg.${property.colName} > %@)) && (list.@avg.${property.colName} < %@))\",\n                    values: [${property.value(0)}, ${property.value(2)}, sum${property.colName}, ${property.value(1)}, ${property.value(0)}, ${property.value(2)}], count: 1) {\n            $0.list.${property.colName}.min <= ${property.value(0)} &&\n            $0.list.${property.colName}.max >= ${property.value(2)} &&\n            $0.list.${property.colName}.sum == sum${property.colName} &&\n            $0.list.${property.colName}.min != ${property.value(1)} &&\n            $0.list.${property.colName}.avg > ${property.value(0)} &&\n            $0.list.${property.colName}.avg < ${property.value(2)}\n        }\n        % end\n    }\n\n    func testCompoundOr() {\n        % for props in groupByClass(properties + optProperties):\n        % for p1, p2 in zip(props, props[1:]):\n        assertQuery(${p1.className}.self, \"((${p1.colName} == %@) || (${p2.colName} == %@))\", values: [${p1.enumValue(1)}, ${p2.enumValue(1)}], count: 1) {\n            $0.${p1.colName} == ${p1.value(1)} || $0.${p2.colName} == ${p2.value(1)}\n        }\n        assertQuery(${p1.className}.self, \"((${p1.colName} == %@) || (${p2.colName} == %@))\", values: [${p1.enumValue(1)}, ${p2.enumValue(1)}], count: 1) {\n            ($0.${p1.colName} == ${p1.value(1)}) || ($0.${p2.colName} == ${p2.value(1)})\n        }\n        % end\n        % end\n\n        // List / Set\n\n        % for listProperty in [listProperties[0], optListProperties[0], setProperties[0], optSetProperties[0]]:\n        % property = properties[0]\n        % value1 = property.enumValue(1)\n        % wrongValue = property.enumValue(0)\n        % value2 = listProperty.enumValue(1)\n        assertQuery(\"((${property.colName} == %@) || (%@ IN ${listProperty.colName}))\", values: [${value1}, ${value2}], count: 1) {\n            $0.${property.colName} == ${property.value(1)} || $0.${listProperty.colName}.contains(${listProperty.value(1)})\n        }\n        % if not property.isEnum:\n        assertQuery(\"((${property.colName} != %@) || (%@ IN ${listProperty.colName}))\", values: [${wrongValue}, ${value2}], count: 1) {\n            $0.${property.colName} != ${property.value(0)} || $0.${listProperty.colName}.contains(${listProperty.value(1)})\n        }\n        % else:\n        assertQuery(\"((${property.colName} != %@) || (%@ IN ${listProperty.colName}))\", values: [${value1}, ${value2}], count: 1) {\n            $0.${property.colName} != ${property.value(1)} || $0.${listProperty.colName}.contains(${listProperty.value(1)})\n        }\n        % end\n        % end\n\n        // Map\n\n        % for mapProperty in [mapProperties[0], optMapProperties[0], mapProperties[1], optMapProperties[1]]:\n        % property = properties[0]\n        % value1 = property.enumValue(1)\n        % wrongValue = property.enumValue(0)\n        % value2 = mapProperty.enumValue(1)\n        assertQuery(\"((${property.colName} == %@) || (%@ IN ${mapProperty.colName}))\", values: [${value1}, ${value2}], count: 1) {\n            $0.${property.colName} == ${property.value(1)} || $0.${mapProperty.colName}.contains(${mapProperty.value(1)})\n        }\n        % if not property.isEnum:\n        assertQuery(\"((${property.colName} != %@) || (${mapProperty.colName}[%@] == %@))\",\n                    values: [${wrongValue}, \"foo\", ${value2}], count: 1) {\n            ($0.${property.colName} != ${property.value(0)}) || ($0.${mapProperty.colName}[\"foo\"] == ${mapProperty.value(1)})\n        }\n        assertQuery(\"(((${property.colName} != %@) || (${mapProperty.colName}[%@] == %@)) || (${mapProperty.colName}[%@] == %@))\",\n                    values: [${wrongValue}, \"foo\", ${mapProperty.value(0)}, \"bar\", ${mapProperty.value(1)}], count: 1) {\n            ($0.${property.colName} != ${property.value(0)}) ||\n            ($0.${mapProperty.colName}[\"foo\"] == ${mapProperty.value(0)}) ||\n            ($0.${mapProperty.colName}[\"bar\"] == ${mapProperty.value(1)})\n        }\n        % else:\n        assertQuery(\"(${property.colName} != %@ || (${mapProperty.colName}[%@] == %@))\",\n                    values: [${value1}, \"foo\", ${value2}], count: 1) {\n            ($0.${property.colName} != ${property.value(1)}) || ($0.${mapProperty.colName}[\"foo\"] == ${mapProperty.value(1)})\n        }\n        % end\n        % end\n\n        // Aggregates\n\n        % for listProperty in [listProperties[1], optListProperties[1]]:\n        let sum${listProperty.colName} = ${listProperty.value(0)} + ${listProperty.value(1)}\n        assertQuery(\"((((((${listProperty.colName}.@min <= %@) || (${listProperty.colName}.@max >= %@)) || (${listProperty.colName}.@sum != %@)) || (${listProperty.colName}.@count == %@)) || (${listProperty.colName}.@avg > %@)) || (${listProperty.colName}.@avg < %@))\",\n                    values: [${listProperty.value(0)}, ${listProperty.value(2)}, sum${listProperty.colName}, 0, ${listProperty.value(1)}, ${listProperty.value(0)}], count: 1) {\n            ($0.${listProperty.colName}.min <= ${listProperty.value(0)}) ||\n            ($0.${listProperty.colName}.max >= ${listProperty.value(2)}) ||\n            ($0.${listProperty.colName}.sum != sum${listProperty.colName}) ||\n            ($0.${listProperty.colName}.count == 0) ||\n            ($0.${listProperty.colName}.avg > ${listProperty.value(1)}) ||\n            ($0.${listProperty.colName}.avg < ${listProperty.value(0)})\n        }\n        % end\n\n        // Keypath Collection Aggregates\n\n        createKeypathCollectionAggregatesObject()\n        % for property in [properties[7], optProperties[7]]:\n\n        let sum${property.colName} = ${property.value(0)} + ${property.value(1)} + ${property.value(2)}\n        assertQuery(LinkToModernAllTypesObject.self, \"((((((list.@min.${property.colName} < %@) || (list.@max.${property.colName} > %@)) || (list.@sum.${property.colName} != %@)) || (list.@min.${property.colName} == %@)) || (list.@avg.${property.colName} >= %@)) || (list.@avg.${property.colName} <= %@))\",\n                    values: [${property.value(0)}, ${property.value(2)}, sum${property.colName}, 0, ${property.value(2)}, ${property.value(0)}], count: 0) {\n            $0.list.${property.colName}.min < ${property.value(0)} ||\n            $0.list.${property.colName}.max > ${property.value(2)} ||\n            $0.list.${property.colName}.sum != sum${property.colName} ||\n            $0.list.${property.colName}.min == 0 ||\n            $0.list.${property.colName}.avg >= ${property.value(2)} ||\n            $0.list.${property.colName}.avg <= ${property.value(0)}\n        }\n        % end\n    }\n\n    func validateCompoundMixed<Root: Object, T: _Persistable, U: _Persistable>(\n            _ name1: String, _ lhs1: (Query<Root>) -> Query<T>, _ value1: T,\n            _ name2: String, _ lhs2: (Query<Root>) -> Query<U>, _ value2: U) {\n        assertQuery(Root.self, \"(((\\(name1) == %@) || (\\(name2) == %@)) && ((\\(name1) != %@) || (\\(name2) != %@)))\",\n                    values: [value1, value2, value1, value2], count: 0) {\n            (lhs1($0) == value1 || lhs2($0) == value2) && (lhs1($0) != value1 || lhs2($0) != value2)\n        }\n        assertQuery(Root.self, \"((\\(name1) == %@) || (\\(name2) == %@))\", values: [value1, value2], count: 1) {\n            (lhs1($0) == value1) || (lhs2($0) == value2)\n        }\n    }\n\n    func validateCompoundString<Root: Object, T: _Persistable, U: _Persistable>(\n            _ name1: String, _ lhs1: (Query<Root>) -> Query<T>, _ value1: T,\n            _ name2: String, _ lhs2: (Query<Root>) -> Query<U>, _ value2: U) where U.PersistedType: _QueryBinary {\n        assertQuery(Root.self, \"(NOT ((\\(name1) == %@) || (\\(name2) CONTAINS %@)) && (\\(name2) == %@))\",\n                    values: [value1, value2, value2], count: 0) {\n            !(lhs1($0) == value1 || lhs2($0).contains(value2)) && (lhs2($0) == value2)\n        }\n    }\n\n    func testCompoundMixed() {\n        % for props in groupByClass(properties + optProperties):\n        % for p1, p2 in zip(props, props[1:]):\n        validateCompoundMixed(\"${p1.colName}\", \\Query<${p1.className}>.${p1.colName}, ${p1.value(1)},\n                              \"${p2.colName}\", \\Query<${p2.className}>.${p2.colName}, ${p2.value(1)})\n        % if p2.enumName == '' and p2.category == 'string':\n        validateCompoundString(\"${p1.colName}\", \\Query<${p1.className}>.${p1.colName}, ${p1.value(1)},\n                               \"${p2.colName}\", \\Query<${p2.className}>.${p2.colName}, ${p2.value(1)})\n        % end\n        % end\n        % end\n\n        // Aggregates\n\n        % for listProperty in [listProperties[1], optListProperties[1], mapProperties[1], optMapProperties[1]]:\n        let sum${listProperty.colName} = ${listProperty.value(0)} + ${listProperty.value(1)}\n        assertQuery(\"(((((${listProperty.colName}.@min <= %@) || (${listProperty.colName}.@max >= %@)) && (${listProperty.colName}.@sum == %@)) && (${listProperty.colName}.@count != %@)) && ((${listProperty.colName}.@avg > %@) && (${listProperty.colName}.@avg < %@)))\",\n                    values: [${listProperty.value(0)}, ${listProperty.value(2)}, sum${listProperty.colName}, 0, ${listProperty.value(0)}, ${listProperty.value(2)}], count: 1) {\n            (($0.${listProperty.colName}.min <= ${listProperty.value(0)}) || ($0.${listProperty.colName}.max >= ${listProperty.value(2)})) &&\n            ($0.${listProperty.colName}.sum == sum${listProperty.colName}) &&\n            ($0.${listProperty.colName}.count != 0) &&\n            ($0.${listProperty.colName}.avg > ${listProperty.value(0)} && $0.${listProperty.colName}.avg < ${listProperty.value(2)})\n        }\n        % end\n\n        // Keypath Collection Aggregates\n\n        createKeypathCollectionAggregatesObject()\n        % for property in [properties[7], optProperties[7]]:\n\n        let sum${property.colName} = ${property.value(0)} + ${property.value(1)} + ${property.value(2)}\n        assertQuery(LinkToModernAllTypesObject.self, \"(((((list.@min.${property.colName} <= %@) || (list.@max.${property.colName} >= %@)) && (list.@sum.${property.colName} == %@)) && (list.@sum.${property.colName} != %@)) && ((list.@avg.${property.colName} > %@) && (list.@avg.${property.colName} < %@)))\", values: [${property.value(0)}, ${property.value(2)}, sum${property.colName}, 0, ${property.value(0)}, ${property.value(2)}], count: 1) {\n            ($0.list.${property.colName}.min <= ${property.value(0)} || $0.list.${property.colName}.max >= ${property.value(2)}) &&\n            $0.list.${property.colName}.sum == sum${property.colName} &&\n            $0.list.${property.colName}.sum != 0 &&\n            ($0.list.${property.colName}.avg > ${property.value(0)} && $0.list.${property.colName}.avg < ${property.value(2)})\n        }\n        % end\n    }\n\n    func testAny() {\n        % for property in listProperties + optListProperties + setProperties + optSetProperties:\n        assertQuery(${property.className}.self, \"(ANY ${property.colName} == %@)\", ${property.enumValue(0)}, count: 1) {\n            $0.${property.colName} == ${property.value(0)}\n        }\n        % end\n\n        assertQuery(\"(((ANY arrayCol.intCol != %@) && (ANY arrayCol.objectCol.intCol > %@)) && ((ANY setCol.intCol != %@) && (ANY setCol.objectCol.intCol > %@)))\", values: [123, 456, 123, 456], count: 0) {\n            (($0.arrayCol.intCol != 123) && ($0.arrayCol.objectCol.intCol > 456)) && (($0.setCol.intCol != 123) && ($0.setCol.objectCol.intCol > 456))\n        }\n    }\n\n    func testSubquery() {\n        // List\n\n        // Count of results will be 0 because there are no `ModernAllTypesObject`s in the list.\n        assertQuery(\"(SUBQUERY(arrayCol, $col1, ($col1.intCol != %@)).@count > %@)\", values: [123, 0], count: 0) {\n            ($0.arrayCol.intCol != 123).count > 0\n        }\n\n        assertQuery(\"((intCol == %@) && (SUBQUERY(arrayCol, $col1, ($col1.stringCol == %@)).@count == %@))\", values: [5, \"Bar\", 0], count: 0) {\n            $0.intCol == 5 &&\n            ($0.arrayCol.stringCol == \"Bar\").count == 0\n        }\n\n        // Set\n\n        // Will be 0 results because there are no `ModernAllTypesObject`s in the set.\n        assertQuery(\"(SUBQUERY(arrayCol, $col1, ($col1.intCol != %@)).@count > %@)\", values: [123, 0], count: 0) {\n            ($0.arrayCol.intCol != 123).count > 0\n        }\n\n        assertQuery(\"((intCol == %@) && (SUBQUERY(setCol, $col1, ($col1.stringCol == %@)).@count == %@))\", values: [5, \"Bar\", 0], count: 0) {\n            $0.intCol == 5 &&\n            ($0.setCol.stringCol == \"Bar\").count == 0\n        }\n\n        let object = objects().first!\n        try! realm.write {\n            let modernObj = ModernAllTypesObject(value: [\"intCol\": 5, \"stringCol\": \"Foo\"])\n            object.arrayCol.append(modernObj)\n            object.setCol.insert(modernObj)\n        }\n\n        // Results count should now be 1\n        assertQuery(\"(SUBQUERY(arrayCol, $col1, ($col1.arrayInt.@count >= %@)).@count > %@)\", values: [0, 0], count: 1) {\n            ($0.arrayCol.arrayInt.count >= 0).count > 0\n        }\n\n        // Subquery in a subquery\n        assertQuery(\"(SUBQUERY(arrayCol, $col1, (($col1.arrayInt.@count >= %@) && (SUBQUERY(arrayCol, $col2, ($col2.intCol != %@)).@count > %@))).@count > %@)\", values: [0, 123, 0, 0], count: 0) {\n            ($0.arrayCol.arrayInt.count >= 0 && ($0.arrayCol.intCol != 123).count > 0).count > 0\n        }\n\n        assertQuery(\"(SUBQUERY(arrayCol, $col1, ($col1.intCol != %@)).@count > %@)\", values: [123, 0], count: 1) {\n            ($0.arrayCol.intCol != 123).count > 0\n        }\n\n        assertQuery(\"(SUBQUERY(arrayCol, $col1, (($col1.intCol > %@) && ($col1.intCol <= %@))).@count > %@)\", values: [0, 5, 0], count: 1) {\n            ($0.arrayCol.intCol > 0 && $0.arrayCol.intCol <= 5 ).count > 0\n        }\n\n        assertQuery(\"((SUBQUERY(arrayCol, $col1, ($col1.intCol == %@)).@count == %@) && (SUBQUERY(arrayCol, $col2, ($col2.stringCol == %@)).@count == %@))\", values: [5, 1, \"Bar\", 0], count: 1) {\n            ($0.arrayCol.intCol == 5).count == 1 &&\n            ($0.arrayCol.stringCol == \"Bar\").count == 0\n        }\n\n        // Set\n\n        // Will be 0 results because there are no `ModernAllTypesObject`s in the set.\n        assertQuery(\"(SUBQUERY(arrayCol, $col1, ($col1.intCol != %@)).@count > %@)\", values: [123, 0], count: 1) {\n            ($0.arrayCol.intCol != 123).count > 0\n        }\n\n        assertQuery(\"((intCol == %@) && (SUBQUERY(setCol, $col1, ($col1.stringCol == %@)).@count == %@))\", values: [3, \"Bar\", 0], count: 1) {\n            ($0.intCol == 3) &&\n            ($0.setCol.stringCol == \"Bar\").count == 0\n        }\n\n        assertQuery(\"((intCol == %@) && (SUBQUERY(setCol, $col1, (($col1.intCol == %@) && ($col1.stringCol != %@))).@count == %@))\", values: [3, 5, \"Blah\", 1], count: 1) {\n            ($0.intCol == 3) &&\n            (((($0.setCol.intCol == 5) && ($0.setCol.stringCol != \"Blah\"))).count == 1)\n        }\n\n        // Column comparison\n\n        assertQuery(\"(SUBQUERY(arrayCol, $col1, ($col1.stringCol == stringCol)).@count == %@)\", 0, count: 1) {\n            ($0.arrayCol.stringCol == $0.stringCol).count == 0\n        }\n\n        assertThrows(assertQuery(\"\", count: 1) {\n            ($0.stringCol == $0.stringCol).count == 0\n        }, reason: \"Subqueries must contain a keypath starting with a collection.\")\n    }\n\n    // MARK: - Collection Aggregations\n\n    % for (short, long, ushort, ulong) in [('avg', 'average', 'Avg', 'Average'), ('sum', 'sum', 'Sum', 'Sum')]:\n    % for (protocol, element) in [('RealmCollection', 'Element'), ('RealmKeyedCollection', 'Value')]:\n    private func validate${ulong}<Root: Object, T: ${protocol}>(_ name: String, _ ${long}: T.${element}, _ min: T.${element}, _ lhs: (Query<Root>) -> Query<T>)\n            where T.${element}.PersistedType: _QueryNumeric, T.${element}: QueryValue {\n        assertQuery(Root.self, \"(object.\\(name).@${short} == %@)\", ${long}, count: 1) {\n            lhs($0).${short} == ${long}\n        }\n        assertQuery(Root.self, \"(object.\\(name).@${short} == %@)\", min, count: 0) {\n            lhs($0).${short} == min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@${short} != %@)\", ${long}, count: 0) {\n            lhs($0).${short} != ${long}\n        }\n        assertQuery(Root.self, \"(object.\\(name).@${short} != %@)\", min, count: 1) {\n            lhs($0).${short} != min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@${short} > %@)\", ${long}, count: 0) {\n            lhs($0).${short} > ${long}\n        }\n        assertQuery(Root.self, \"(object.\\(name).@${short} > %@)\", min, count: 1) {\n            lhs($0).${short} > min\n        }\n        assertQuery(Root.self, \"(object.\\(name).@${short} < %@)\", ${long}, count: 0) {\n            lhs($0).${short} < ${long}\n        }\n        assertQuery(Root.self, \"(object.\\(name).@${short} >= %@)\", ${long}, count: 1) {\n            lhs($0).${short} >= ${long}\n        }\n        assertQuery(Root.self, \"(object.\\(name).@${short} <= %@)\", ${long}, count: 1) {\n            lhs($0).${short} <= ${long}\n        }\n    }\n\n    % end\n    func testCollectionAggregates${ushort}() {\n        initLinkedCollectionAggregatesObject()\n\n        % for property in canSum(listProperties + optListProperties + setProperties + optSetProperties + mapProperties + optMapProperties):\n        validate${ulong}(\"${property.colName}\", ${property.type}.${long}(), ${property.rawValue(0)},\n                    \\Query<${property.linkingClassName}>.object.${property.rawValueName})\n        % end\n    }\n\n    %end\n\n    % for (lower, upper, other) in [('min', 'Min', 'max'), ('max', 'Max', 'min')]:\n    % for (protocol, element) in [('RealmCollection', 'Element'), ('RealmKeyedCollection', 'Value')]:\n    private func validate${upper}<Root: Object, T: ${protocol}>(_ name: String, min: T.${element}, max: T.${element}, _ lhs: (Query<Root>) -> Query<T>)\n            where T.${element}.PersistedType: _QueryNumeric, T.${element}: QueryValue {\n        assertQuery(Root.self, \"(object.\\(name).@${lower} == %@)\", ${lower}, count: 1) {\n            lhs($0).${lower} == ${lower}\n        }\n        assertQuery(Root.self, \"(object.\\(name).@${lower} == %@)\", ${other}, count: 0) {\n            lhs($0).${lower} == ${other}\n        }\n        assertQuery(Root.self, \"(object.\\(name).@${lower} != %@)\", ${lower}, count: 0) {\n            lhs($0).${lower} != ${lower}\n        }\n        assertQuery(Root.self, \"(object.\\(name).@${lower} != %@)\", ${other}, count: 1) {\n            lhs($0).${lower} != ${other}\n        }\n        assertQuery(Root.self, \"(object.\\(name).@${lower} > %@)\", ${lower}, count: 0) {\n            lhs($0).${lower} > ${lower}\n        }\n        assertQuery(Root.self, \"(object.\\(name).@${lower} < %@)\", ${lower}, count: 0) {\n            lhs($0).${lower} < ${lower}\n        }\n        assertQuery(Root.self, \"(object.\\(name).@${lower} >= %@)\", ${lower}, count: 1) {\n            lhs($0).${lower} >= ${lower}\n        }\n        assertQuery(Root.self, \"(object.\\(name).@${lower} <= %@)\", ${lower}, count: 1) {\n            lhs($0).${lower} <= ${lower}\n        }\n    }\n\n    % end\n    func testCollectionAggregates${upper}() {\n        initLinkedCollectionAggregatesObject()\n\n        % for property in canSum(listProperties + optListProperties + setProperties + optSetProperties + mapProperties + optMapProperties):\n        validate${upper}(\"${property.colName}\", min: ${property.value(0)}, max: ${property.value(2)},\n                    \\Query<${property.linkingClassName}>.object.${property.colName})\n        % end\n    }\n\n    %end\n\n    // @Count\n\n    % for (protocol, element) in [('RealmCollection', 'Element'), ('RealmKeyedCollection', 'Value')]:\n    private func validateCount<Root: Object, T: ${protocol}>(_ name: String, _ lhs: (Query<Root>) -> Query<T>) {\n        assertQuery(Root.self, \"(object.\\(name).@count == %@)\", 3, count: 1) {\n            lhs($0).count == 3\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count == %@)\", 0, count: 0) {\n            lhs($0).count == 0\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count != %@)\", 3, count: 0) {\n            lhs($0).count != 3\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count != %@)\", 2, count: 1) {\n            lhs($0).count != 2\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count < %@)\", 3, count: 0) {\n            lhs($0).count < 3\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count < %@)\", 4, count: 1) {\n            lhs($0).count < 4\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count > %@)\", 2, count: 1) {\n            lhs($0).count > 2\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count > %@)\", 3, count: 0) {\n            lhs($0).count > 3\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count <= %@)\", 2, count: 0) {\n            lhs($0).count <= 2\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count <= %@)\", 3, count: 1) {\n            lhs($0).count <= 3\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count >= %@)\", 3, count: 1) {\n            lhs($0).count >= 3\n        }\n        assertQuery(Root.self, \"(object.\\(name).@count >= %@)\", 4, count: 0) {\n            lhs($0).count >= 4\n        }\n    }\n    % end\n\n    func testCollectionAggregatesCount() {\n        initLinkedCollectionAggregatesObject()\n\n        % for property in (p for p in listProperties + optListProperties + setProperties + optSetProperties + mapProperties + optMapProperties if p.category != 'bool'):\n        validateCount(\"${property.colName}\", \\Query<${property.linkingClassName}>.object.${property.colName})\n        % end\n    }\n\n    // MARK: - Keypath Collection Aggregations\n\n    % for (short, long, ushort, ulong) in [('avg', 'average', 'Avg', 'Average'), ('sum', 'sum', 'Sum', 'Sum')]:\n    private func validateKeypath${ulong}<Root: Object, T>(_ name: String, _ ${long}: T, _ min: T, _ lhs: (Query<Root>) -> Query<T>)\n            where T: _Persistable & QueryValue, T.PersistedType: _QueryNumeric {\n        assertQuery(Root.self, \"(list.@${short}.\\(name) == %@)\", ${long}, count: 1) {\n            lhs($0).${short} == ${long}\n        }\n        assertQuery(Root.self, \"(list.@${short}.\\(name) == %@)\", min, count: 0) {\n            lhs($0).${short} == min\n        }\n        assertQuery(Root.self, \"(list.@${short}.\\(name) != %@)\", ${long}, count: 0) {\n            lhs($0).${short} != ${long}\n        }\n        assertQuery(Root.self, \"(list.@${short}.\\(name) != %@)\", min, count: 1) {\n            lhs($0).${short} != min\n        }\n        assertQuery(Root.self, \"(list.@${short}.\\(name) > %@)\", ${long}, count: 0) {\n            lhs($0).${short} > ${long}\n        }\n        assertQuery(Root.self, \"(list.@${short}.\\(name) > %@)\", min, count: 1) {\n            lhs($0).${short} > min\n        }\n        assertQuery(Root.self, \"(list.@${short}.\\(name) < %@)\", ${long}, count: 0) {\n            lhs($0).${short} < ${long}\n        }\n        assertQuery(Root.self, \"(list.@${short}.\\(name) >= %@)\", ${long}, count: 1) {\n            lhs($0).${short} >= ${long}\n        }\n        assertQuery(Root.self, \"(list.@${short}.\\(name) <= %@)\", ${long}, count: 1) {\n            lhs($0).${short} <= ${long}\n        }\n    }\n\n    func testKeypathCollectionAggregates${ushort}() {\n        createKeypathCollectionAggregatesObject()\n\n        % for property in canSum(properties + optProperties):\n        validateKeypath${ulong}(\"${property.colName}\", ${property.typeName}.${long}(), ${property.rawValue(0)},\n                    \\Query<${property.linkingClassName}>.list.${property.rawValueName})\n        % end\n    }\n\n    %end\n\n    % for (lower, upper, other) in [('min', 'Min', 'max'), ('max', 'Max', 'min')]:\n    private func validateKeypath${upper}<Root: Object, T>(_ name: String, min: T, max: T, _ lhs: (Query<Root>) -> Query<T>)\n            where T: _Persistable & QueryValue, T.PersistedType: _QueryNumeric {\n        assertQuery(Root.self, \"(list.@${lower}.\\(name) == %@)\", ${lower}, count: 1) {\n            lhs($0).${lower} == ${lower}\n        }\n        assertQuery(Root.self, \"(list.@${lower}.\\(name) == %@)\", ${other}, count: 0) {\n            lhs($0).${lower} == ${other}\n        }\n        assertQuery(Root.self, \"(list.@${lower}.\\(name) != %@)\", ${lower}, count: 0) {\n            lhs($0).${lower} != ${lower}\n        }\n        assertQuery(Root.self, \"(list.@${lower}.\\(name) != %@)\", ${other}, count: 1) {\n            lhs($0).${lower} != ${other}\n        }\n        assertQuery(Root.self, \"(list.@${lower}.\\(name) > %@)\", ${lower}, count: 0) {\n            lhs($0).${lower} > ${lower}\n        }\n        assertQuery(Root.self, \"(list.@${lower}.\\(name) < %@)\", ${lower}, count: 0) {\n            lhs($0).${lower} < ${lower}\n        }\n        assertQuery(Root.self, \"(list.@${lower}.\\(name) >= %@)\", ${lower}, count: 1) {\n            lhs($0).${lower} >= ${lower}\n        }\n        assertQuery(Root.self, \"(list.@${lower}.\\(name) <= %@)\", ${lower}, count: 1) {\n            lhs($0).${lower} <= ${lower}\n        }\n    }\n\n    func testKeypathCollectionAggregates${upper}() {\n        createKeypathCollectionAggregatesObject()\n\n        % for property in numeric(properties + optProperties):\n        validateKeypath${upper}(\"${property.colName}\", min: ${property.rawValue(0)}, max: ${property.rawValue(2)},\n                    \\Query<${property.linkingClassName}>.list.${property.rawValueName})\n        % end\n    }\n\n    %end\n    func testAggregateNotSupported() {\n        assertThrows(assertQuery(\"\", count: 0) { $0.intCol.avg == 1 },\n                     reason: \"Invalid keypath 'intCol.@avg': Property 'ModernAllTypesObject.intCol' is not a link or collection and can only appear at the end of a keypath.\")\n\n        assertThrows(assertQuery(\"\", count: 0) { $0.doubleCol.max != 1 },\n                     reason: \"Invalid keypath 'doubleCol.@max': Property 'ModernAllTypesObject.doubleCol' is not a link or collection and can only appear at the end of a keypath.\")\n\n        assertThrows(assertQuery(\"\", count: 0) { $0.dateCol.min > Date() },\n                     reason: \"Invalid keypath 'dateCol.@min': Property 'ModernAllTypesObject.dateCol' is not a link or collection and can only appear at the end of a keypath.\")\n\n        assertThrows(assertQuery(\"\", count: 0) { $0.decimalCol.sum < 1 },\n                     reason: \"Invalid keypath 'decimalCol.@sum': Property 'ModernAllTypesObject.decimalCol' is not a link or collection and can only appear at the end of a keypath.\")\n    }\n\n    // MARK: Column comparison\n\n    func testColumnComparison() {\n        // Basic comparison\n\n        assertQuery(\"(stringEnumCol == stringEnumCol)\", count: 1) {\n            $0.stringEnumCol == $0.stringEnumCol\n        }\n\n        assertQuery(\"(stringCol != stringCol)\", count: 0) {\n            $0.stringCol != $0.stringCol\n        }\n\n        assertQuery(\"(stringEnumCol != stringEnumCol)\", count: 0) {\n            $0.stringEnumCol != $0.stringEnumCol\n        }\n\n        assertQuery(\"(stringEnumCol > stringEnumCol)\", count: 0) {\n            $0.stringEnumCol > $0.stringEnumCol\n        }\n\n        assertQuery(\"(stringCol > stringCol)\", count: 0) {\n            $0.stringCol > $0.stringCol\n        }\n\n        assertQuery(\"(stringEnumCol >= stringEnumCol)\", count: 1) {\n            $0.stringEnumCol >= $0.stringEnumCol\n        }\n\n        assertQuery(\"(stringCol >= stringCol)\", count: 1) {\n            $0.stringCol >= $0.stringCol\n        }\n\n        assertQuery(\"(stringEnumCol < stringEnumCol)\", count: 0) {\n            $0.stringEnumCol < $0.stringEnumCol\n        }\n\n        assertQuery(\"(stringCol < stringCol)\", count: 0) {\n            $0.stringCol < $0.stringCol\n        }\n\n        assertQuery(\"(stringEnumCol <= stringEnumCol)\", count: 1) {\n            $0.stringEnumCol <= $0.stringEnumCol\n        }\n\n        assertQuery(\"(stringCol <= stringCol)\", count: 1) {\n            $0.stringCol <= $0.stringCol\n        }\n\n        assertThrows(assertQuery(\"\", count: 1) {\n            $0.arrayCol == $0.arrayCol\n        }, reason: \"Comparing two collection columns is not permitted.\")\n\n        assertThrows(assertQuery(\"\", count: 1) {\n            $0.arrayCol != $0.arrayCol\n        }, reason: \"Comparing two collection columns is not permitted.\")\n\n        assertQuery(\"(intCol > intCol)\", count: 0) {\n            $0.intCol > $0.intCol\n        }\n\n        assertQuery(\"(intEnumCol > intEnumCol)\", count: 0) {\n            $0.intEnumCol > $0.intEnumCol\n        }\n\n        assertQuery(\"(intCol >= intCol)\", count: 1) {\n            $0.intCol >= $0.intCol\n        }\n\n        assertQuery(\"(intEnumCol >= intEnumCol)\", count: 1) {\n            $0.intEnumCol >= $0.intEnumCol\n        }\n\n        assertQuery(\"(intCol < intCol)\", count: 0) {\n            $0.intCol < $0.intCol\n        }\n\n        assertQuery(\"(intEnumCol < intEnumCol)\", count: 0) {\n            $0.intEnumCol < $0.intEnumCol\n        }\n\n        assertQuery(\"(intCol <= intCol)\", count: 1) {\n            $0.intCol <= $0.intCol\n        }\n\n        assertQuery(\"(intEnumCol <= intEnumCol)\", count: 1) {\n            $0.intEnumCol <= $0.intEnumCol\n        }\n\n        assertQuery(\"(optStringCol == optStringCol)\", count: 1) {\n            $0.optStringCol == $0.optStringCol\n        }\n\n        assertQuery(\"(optStringCol != optStringCol)\", count: 0) {\n            $0.optStringCol != $0.optStringCol\n        }\n\n        assertQuery(\"(optIntCol > optIntCol)\", count: 0) {\n            $0.optIntCol > $0.optIntCol\n        }\n\n        assertQuery(\"(optIntCol >= optIntCol)\", count: 1) {\n            $0.optIntCol >= $0.optIntCol\n        }\n\n        assertQuery(\"(optIntCol < optIntCol)\", count: 0) {\n            $0.optIntCol < $0.optIntCol\n        }\n\n        assertQuery(\"(optIntCol <= optIntCol)\", count: 1) {\n            $0.optIntCol <= $0.optIntCol\n        }\n\n        // Basic comparison with one level depth\n\n        assertQuery(\"(objectCol.stringCol == objectCol.stringCol)\", count: 1) {\n            $0.objectCol.stringCol == $0.objectCol.stringCol\n        }\n\n        assertQuery(\"(objectCol.stringCol != objectCol.stringCol)\", count: 0) {\n            $0.objectCol.stringCol != $0.objectCol.stringCol\n        }\n\n        assertQuery(\"(objectCol.intCol > objectCol.intCol)\", count: 0) {\n            $0.objectCol.intCol > $0.objectCol.intCol\n        }\n\n        assertQuery(\"(objectCol.intCol >= objectCol.intCol)\", count: 1) {\n            $0.objectCol.intCol >= $0.objectCol.intCol\n        }\n\n        assertQuery(\"(objectCol.intCol < objectCol.intCol)\", count: 0) {\n            $0.objectCol.intCol < $0.objectCol.intCol\n        }\n\n        assertQuery(\"(objectCol.intCol <= objectCol.intCol)\", count: 1) {\n            $0.objectCol.intCol <= $0.objectCol.intCol\n        }\n\n        assertQuery(\"(objectCol.optStringCol == objectCol.optStringCol)\", count: 1) {\n            $0.objectCol.optStringCol == $0.objectCol.optStringCol\n        }\n\n        assertQuery(\"(objectCol.optStringCol != objectCol.optStringCol)\", count: 0) {\n            $0.objectCol.optStringCol != $0.objectCol.optStringCol\n        }\n\n        assertQuery(\"(objectCol.optIntCol > objectCol.optIntCol)\", count: 0) {\n            $0.objectCol.optIntCol > $0.objectCol.optIntCol\n        }\n\n        assertQuery(\"(objectCol.optIntCol >= objectCol.optIntCol)\", count: 1) {\n            $0.objectCol.optIntCol >= $0.objectCol.optIntCol\n        }\n\n        assertQuery(\"(objectCol.optIntCol < objectCol.optIntCol)\", count: 0) {\n            $0.objectCol.optIntCol < $0.objectCol.optIntCol\n        }\n\n        assertQuery(\"(objectCol.optIntCol <= objectCol.optIntCol)\", count: 1) {\n            $0.objectCol.optIntCol <= $0.objectCol.optIntCol\n        }\n\n        // String comparison\n\n        assertQuery(\"(stringCol CONTAINS[cd] stringCol)\", count: 1) {\n            $0.stringCol.contains($0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(stringCol BEGINSWITH[cd] stringCol)\", count: 1) {\n            $0.stringCol.starts(with: $0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(stringCol ENDSWITH[cd] stringCol)\", count: 1) {\n            $0.stringCol.ends(with: $0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(stringCol LIKE[c] stringCol)\", count: 1) {\n            $0.stringCol.like($0.stringCol, caseInsensitive: true)\n        }\n\n        assertQuery(\"(stringCol ==[cd] stringCol)\", count: 1) {\n            $0.stringCol.equals($0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(stringCol !=[cd] stringCol)\", count: 0) {\n            $0.stringCol.notEquals($0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        // String with optional col\n\n        assertQuery(\"(stringCol CONTAINS[cd] optStringCol)\", count: 1) {\n            $0.stringCol.contains($0.optStringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol CONTAINS[cd] optStringCol)\", count: 1) {\n            $0.optStringCol.contains($0.optStringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol CONTAINS[cd] stringCol)\", count: 1) {\n            $0.optStringCol.contains($0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(stringCol BEGINSWITH[cd] stringCol)\", count: 1) {\n            $0.stringCol.starts(with: $0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol BEGINSWITH[cd] optStringCol)\", count: 1) {\n            $0.optStringCol.starts(with: $0.optStringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol BEGINSWITH[cd] stringCol)\", count: 1) {\n            $0.optStringCol.starts(with: $0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(stringCol ENDSWITH[cd] stringCol)\", count: 1) {\n            $0.stringCol.ends(with: $0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol ENDSWITH[cd] optStringCol)\", count: 1) {\n            $0.optStringCol.ends(with: $0.optStringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol ENDSWITH[cd] stringCol)\", count: 1) {\n            $0.optStringCol.ends(with: $0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(stringCol LIKE[c] stringCol)\", count: 1) {\n            $0.stringCol.like($0.stringCol, caseInsensitive: true)\n        }\n\n        assertQuery(\"(optStringCol LIKE[c] optStringCol)\", count: 1) {\n            $0.optStringCol.like($0.optStringCol, caseInsensitive: true)\n        }\n\n        assertQuery(\"(optStringCol LIKE[c] stringCol)\", count: 1) {\n            $0.optStringCol.like($0.stringCol, caseInsensitive: true)\n        }\n\n        assertQuery(\"(stringCol ==[cd] stringCol)\", count: 1) {\n            $0.stringCol.equals($0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol ==[cd] optStringCol)\", count: 1) {\n            $0.optStringCol.equals($0.optStringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol ==[cd] stringCol)\", count: 1) {\n            $0.optStringCol.equals($0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(stringCol !=[cd] stringCol)\", count: 0) {\n            $0.stringCol.notEquals($0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol !=[cd] optStringCol)\", count: 0) {\n            $0.optStringCol.notEquals($0.optStringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n\n        assertQuery(\"(optStringCol !=[cd] stringCol)\", count: 0) {\n            $0.optStringCol.notEquals($0.stringCol, options: [.caseInsensitive, .diacriticInsensitive])\n        }\n    }\n\n    // MARK: - ContainsIn\n\n    func testContainsIn() {\n        % for property in properties + optProperties:\n\n        assertQuery(${property.className}.self, \"(${property.colName} IN %@)\",\n                    values: [NSArray(array: [${property.enumValue(0)}, ${property.enumValue(1)}])], count: 1) {\n            $0.${property.colName}.in([${property.enumValue(0)}, ${property.enumValue(1)}])\n        }\n        assertQuery(${property.className}.self, \"(NOT ${property.colName} IN %@)\",\n                    values: [NSArray(array: [${property.enumValue(1)}])], count: 0) {\n            !$0.${property.colName}.in([${property.enumValue(1)}])\n        }\n        % end\n    }\n}\n\nprivate protocol LinkToTestObject: Object {\n    associatedtype Child: Object\n    var object: Child? { get }\n    var list: List<Child> { get }\n    var set: MutableSet<Child> { get }\n    var map: Map<String, Child?> { get }\n}\n% for _, linkingClassName in classNames:\nextension ${linkingClassName}: LinkToTestObject {}\n% end\n\nprivate protocol QueryValue {\n    static func queryValues() -> [Self]\n}\n\n% for type in types:\nextension ${type.name}: QueryValue {\n    static func queryValues() -> [${type.name}] {\n        return [${type.collectionValues[0]}, ${type.collectionValues[1]}, ${type.collectionValues[2]}]\n    }\n}\nextension ${type.name}Wrapper: QueryValue {\n    static func queryValues() -> [${type.name}Wrapper] {\n        return ${type.name}.queryValues().map(${type.name}Wrapper.init)\n    }\n}\n% if type.hasEnum():\nextension Enum${type.name}: QueryValue {\n    static func queryValues() -> [Enum${type.name}] {\n        return [.value1, .value2, .value3]\n    }\n}\n% end\n\n% end\nextension ModernIntEnum: QueryValue {\n    static func queryValues() -> [ModernIntEnum] {\n        return [.value1, .value2, .value3]\n    }\n    fileprivate static func sum() -> Int {\n        return Self.value1.rawValue + Self.value2.rawValue + Self.value3.rawValue\n    }\n    fileprivate static func average() -> Int {\n        return Self.value2.rawValue\n    }\n}\n\nextension AnyRealmValue: QueryValue {\n    static func queryValues() -> [AnyRealmValue] {\n        return [${anyCollectionValues[0]}, ${anyCollectionValues[1]}, ${anyCollectionValues[2]}]\n    }\n}\n\nextension Optional: QueryValue where Wrapped: QueryValue {\n    static func queryValues() -> [Self] {\n        return Wrapped.queryValues().map(Self.init)\n    }\n}\n\nprivate protocol AddableQueryValue {\n    associatedtype SumType\n    static func sum() -> SumType\n    static func average() -> SumType\n}\n\n% for type in (t for t in types if t.category == 'numeric' and t.name != 'Date'):\nextension ${type.name}: AddableQueryValue {\n    fileprivate typealias SumType = ${type.name}\n    fileprivate static func sum() -> SumType {\n        return ${type.collectionValues[0]} + ${type.collectionValues[1]} + ${type.collectionValues[2]}\n    }\n    fileprivate static func average() -> SumType {\n        return sum() / 3\n    }\n}\nextension ${type.name}Wrapper: AddableQueryValue {\n    fileprivate typealias SumType = ${type.name}Wrapper\n    fileprivate static func sum() -> SumType {\n        return ${type.name}Wrapper(persistedValue: ${type.name}.sum())\n    }\n    fileprivate static func average() -> SumType {\n        return ${type.name}Wrapper(persistedValue: ${type.name}.average())\n    }\n}\n% if type.hasEnum():\nextension Enum${type.name}: AddableQueryValue {\n    fileprivate typealias SumType = ${type.name}\n    fileprivate static func sum() -> SumType {\n        return Self.value1.rawValue + Self.value2.rawValue + Self.value3.rawValue\n    }\n    fileprivate static func average() -> SumType {\n        return sum() / 3\n    }\n}\n% end\n\n% end\nextension Optional: AddableQueryValue where Wrapped: AddableQueryValue {\n    fileprivate typealias SumType = Optional<Wrapped.SumType>\n    fileprivate static func sum() -> SumType {\n        return .some(Wrapped.sum())\n    }\n    fileprivate static func average() -> SumType {\n        return .some(Wrapped.average())\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/RealmCollectionTypeTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n// swiftlint:disable type_name\n\nimport XCTest\nimport RealmSwift\n\n#if canImport(RealmSwiftTestSupport)\nimport RealmSwiftTestSupport\n#endif\n\nclass CTTAggregateObject: Object {\n    @Persisted var intCol = 0\n    @Persisted var int8Col = 0\n    @Persisted var int16Col = 0\n    @Persisted var int32Col = 0\n    @Persisted var int64Col = 0\n    @Persisted var floatCol = 0 as Float\n    @Persisted var doubleCol = 0.0\n    @Persisted var boolCol = false\n    @Persisted var dateCol = Date()\n    @Persisted var trueCol = true\n    @Persisted var stringListCol: List<CTTNullableStringObjectWithLink>\n    @Persisted var stringSetCol: MutableSet<CTTNullableStringObjectWithLink>\n    @Persisted var linkCol: CTTLinkTarget?\n    @Persisted var childIntCol: CTTIntegerObject?\n}\n\nclass CTTIntegerObject: Object {\n    @Persisted var intCol = 0\n}\n\nclass CTTAggregateObjectList: Object {\n    @Persisted var list: List<CTTAggregateObject>\n}\n\nclass CTTAggregateObjectSet: Object {\n    @Persisted var set: MutableSet<CTTAggregateObject>\n}\n\nclass CTTNullableStringObjectWithLink: Object {\n    @Persisted var stringCol: String? = \"\"\n    @Persisted var linkCol: CTTLinkTarget?\n}\n\nclass CTTLinkTarget: Object {\n    @Persisted var id = 0\n    @Persisted(originProperty: \"linkCol\") var stringObjects: LinkingObjects<CTTNullableStringObjectWithLink>\n    @Persisted(originProperty: \"linkCol\") var aggregateObjects: LinkingObjects<CTTAggregateObject>\n}\n\nclass CTTStringList: Object {\n    @Persisted var array: List<CTTNullableStringObjectWithLink>\n}\n\nclass CTTStringSet: Object {\n    @Persisted var set: MutableSet<CTTNullableStringObjectWithLink>\n}\n\nstruct Config {\n    static let config = Realm.Configuration(inMemoryIdentifier: \"collection\",\n                                            objectTypes: [CTTAggregateObject.self,\n                                                          CTTNullableStringObjectWithLink.self,\n                                                          CTTIntegerObject.self,\n                                                          CTTAggregateObjectList.self,\n                                                          CTTAggregateObjectSet.self,\n                                                          CTTNullableStringObjectWithLink.self,\n                                                          CTTLinkTarget.self,\n                                                          CTTStringList.self,\n                                                          CTTStringSet.self,\n\n                                                          SwiftDoubleListOfSwiftObject.self,\n                                                          SwiftListOfSwiftObject.self,\n                                                          SwiftObject.self,\n                                                          SwiftBoolObject.self])\n}\nclass RealmCollectionTests<Collection: RealmCollection, AggregateCollection: RealmCollection>: TestCase where\n        Collection.Element == CTTNullableStringObjectWithLink, Collection.Index == Int,\n        AggregateCollection.Element == CTTAggregateObject, AggregateCollection.Index == Int {\n    var str1: CTTNullableStringObjectWithLink!\n    var str2: CTTNullableStringObjectWithLink!\n    var collection: Collection!\n\n    func realm() -> Realm {\n        return try! Realm(configuration: Config.config)\n    }\n\n    func getCollection(_ realm: Realm) -> Collection {\n        fatalError(\"Abstract method. Try running tests using Control-U.\")\n    }\n\n    func getAggregateableCollectionInWrite(_ realm: Realm) -> AggregateCollection {\n        fatalError(\"Abstract method. Try running tests using Control-U.\")\n    }\n    func getAggregateableCollection() -> AggregateCollection {\n        let realm = self.realm()\n        return try! realm.write {\n            getAggregateableCollectionInWrite(realm)\n        }\n    }\n\n    func makeAggregateableObjectsInWriteTransaction() -> [CTTAggregateObject] {\n        let obj1 = CTTAggregateObject()\n        obj1.intCol = 1\n        obj1.int8Col = 1\n        obj1.int16Col = 1\n        obj1.int32Col = 1\n        obj1.int64Col = 1\n        obj1.floatCol = 1.1\n        obj1.doubleCol = 1.11\n        obj1.dateCol = Date(timeIntervalSince1970: 1)\n        obj1.boolCol = false\n\n        let obj2 = CTTAggregateObject()\n        obj2.intCol = 2\n        obj2.int8Col = 2\n        obj2.int16Col = 2\n        obj2.int32Col = 2\n        obj2.int64Col = 2\n        obj2.floatCol = 2.2\n        obj2.doubleCol = 2.22\n        obj2.dateCol = Date(timeIntervalSince1970: 2)\n        obj2.boolCol = false\n\n        let obj3 = CTTAggregateObject()\n        obj3.intCol = 3\n        obj3.int8Col = 3\n        obj3.int16Col = 3\n        obj3.int32Col = 3\n        obj3.int64Col = 3\n        obj3.floatCol = 2.2\n        obj3.doubleCol = 2.22\n        obj3.dateCol = Date(timeIntervalSince1970: 2)\n        obj3.boolCol = false\n\n        self.realm().add([obj1, obj2, obj3])\n        return [obj1, obj2, obj3]\n    }\n\n    func makeAggregateableObjects() -> [CTTAggregateObject] {\n        return try! self.realm().write {\n            makeAggregateableObjectsInWriteTransaction()\n        }\n    }\n\n    override func setUp() {\n        super.setUp()\n        let target1 = CTTLinkTarget()\n        target1.id = 1\n\n        let str1 = CTTNullableStringObjectWithLink()\n        str1.stringCol = \"1\"\n        str1.linkCol = target1\n        self.str1 = str1\n\n        let str2 = CTTNullableStringObjectWithLink()\n        str2.stringCol = \"2\"\n        str2.linkCol = target1\n        self.str2 = str2\n\n        let realm = self.realm()\n        try! realm.write {\n            realm.add(str1)\n            realm.add(str2)\n            realm.add(target1)\n            collection = getCollection(realm)\n        }\n    }\n\n    override func tearDown() {\n        str1 = nil\n        str2 = nil\n        collection = nil\n\n        super.tearDown()\n    }\n\n    override class var defaultTestSuite: XCTestSuite {\n        // Don't run tests for the base class\n        if isEqual(RealmCollectionTests.self) {\n            return XCTestSuite(name: \"empty\")\n        }\n        return super.defaultTestSuite\n    }\n\n    func testRealm() {\n        XCTAssertEqual(collection.realm!.configuration.fileURL, self.realm().configuration.fileURL)\n    }\n\n    func testDescription() {\n        // swiftlint:disable:next line_length\n        assertMatches(collection.description, \"Results<CTTNullableStringObjectWithLink> <0x[0-9a-f]+> \\\\(\\n\\t\\\\[0\\\\] CTTNullableStringObjectWithLink \\\\{\\n\\t\\tstringCol = 1;\\n\\t\\tlinkCol = CTTLinkTarget \\\\{\\n\\t\\t\\tid = 1;\\n\\t\\t\\\\};\\n\\t\\\\},\\n\\t\\\\[1\\\\] CTTNullableStringObjectWithLink \\\\{\\n\\t\\tstringCol = 2;\\n\\t\\tlinkCol = CTTLinkTarget \\\\{\\n\\t\\t\\tid = 1;\\n\\t\\t\\\\};\\n\\t\\\\}\\n\\\\)\")\n    }\n\n    func testCount() {\n        XCTAssertEqual(2, collection.count)\n        XCTAssertEqual(1, collection.filter(\"stringCol = '1'\").count)\n        XCTAssertEqual(1, collection.filter(\"stringCol = '2'\").count)\n        XCTAssertEqual(0, collection.filter(\"stringCol = '0'\").count)\n\n        XCTAssertEqual(1, collection.where { $0.stringCol == \"1\" }.count)\n        XCTAssertEqual(1, collection.where { $0.stringCol == \"2\" }.count)\n        XCTAssertEqual(0, collection.where { $0.stringCol == \"0\" }.count)\n    }\n\n    func testIndexOfObject() {\n        XCTAssertEqual(0, collection.index(of: str1)!)\n        XCTAssertEqual(1, collection.index(of: str2)!)\n\n        let str1Only = collection.filter(\"stringCol = '1'\")\n        XCTAssertEqual(0, str1Only.index(of: str1)!)\n        XCTAssertNil(str1Only.index(of: str2))\n\n        let str1OnlyQuery = collection.where { $0.stringCol == \"1\" }\n        XCTAssertEqual(0, str1OnlyQuery.index(of: str1)!)\n        XCTAssertNil(str1OnlyQuery.index(of: str2))\n    }\n\n    func testIndexOfPredicate() {\n        let pred1 = NSPredicate(format: \"stringCol = '1'\")\n        let pred2 = NSPredicate(format: \"stringCol = '2'\")\n        let pred3 = NSPredicate(format: \"stringCol = '3'\")\n\n        XCTAssertEqual(0, collection.index(matching: pred1)!)\n        XCTAssertEqual(1, collection.index(matching: pred2)!)\n        XCTAssertNil(collection.index(matching: pred3))\n    }\n\n    func testIndexOfQuery() {\n        XCTAssertEqual(0, collection.index(matching: { $0.stringCol == \"1\" })!)\n        XCTAssertEqual(1, collection.index(matching: { $0.stringCol == \"2\" })!)\n        XCTAssertNil(collection.index(matching: { $0.stringCol == \"3\" }))\n    }\n\n    func testIndexOfFormat() {\n        XCTAssertEqual(0, collection.index(matching: \"stringCol = '1'\")!)\n        XCTAssertEqual(0, collection.index(matching: \"stringCol = %@\", \"1\")!)\n        XCTAssertEqual(1, collection.index(matching: \"stringCol = %@\", \"2\")!)\n        XCTAssertNil(collection.index(matching: \"stringCol = %@\", \"3\"))\n    }\n\n    func testSubscript() {\n        assertEqual(str1, collection[0])\n        assertEqual(str2, collection[1])\n\n        assertThrows(collection[200])\n        assertThrows(collection[-200])\n    }\n\n    func testObjectsAtIndexes() {\n        assertThrows(collection.objects(at: [0, 10]))\n        let objs = collection.objects(at: [0, 1])\n        assertEqual(str1, objs[0])\n        assertEqual(str2, objs[1])\n    }\n\n    func testFirst() {\n        assertEqual(str1, collection.first!)\n        assertEqual(str2, collection.filter(\"stringCol = '2'\").first!)\n        XCTAssertNil(collection.filter(\"stringCol = '3'\").first)\n\n        assertEqual(str2, collection.where { $0.stringCol == \"2\" }.first!)\n        XCTAssertNil(collection.where { $0.stringCol == \"3\" }.first)\n    }\n\n    func testLast() {\n        assertEqual(str2, collection.last!)\n        assertEqual(str2, collection.filter(\"stringCol = '2'\").last!)\n        XCTAssertNil(collection.filter(\"stringCol = '3'\").last)\n\n        assertEqual(str2, collection.where { $0.stringCol == \"2\" }.last!)\n        XCTAssertNil(collection.where { $0.stringCol == \"3\" }.last)\n    }\n\n    func testValueForKey() {\n        let expected = Array(collection.map { $0.stringCol })\n        let actual = collection.value(forKey: \"stringCol\") as! [String]?\n        XCTAssertEqual(expected as! [String], actual!)\n\n        assertEqual(Array(collection), collection.value(forKey: \"self\") as! [CTTNullableStringObjectWithLink])\n    }\n\n    func testSetValueForKey() {\n        try! self.realm().write {\n            collection.setValue(\"hi there!\", forKey: \"stringCol\")\n        }\n        let expected = Array((0..<collection.count).map { _ in \"hi there!\" })\n        let actual = Array(collection.map { $0.stringCol })\n        XCTAssertEqual(expected, actual as! [String])\n    }\n\n    func testFilterFormat() {\n        XCTAssertEqual(1, collection.filter(\"stringCol = '1'\").count)\n        XCTAssertEqual(1, collection.filter(\"stringCol = %@\", \"1\").count)\n        XCTAssertEqual(1, collection.filter(\"stringCol = %@\", \"2\").count)\n        XCTAssertEqual(0, collection.filter(\"stringCol = %@\", \"3\").count)\n\n        XCTAssertEqual(1, collection.filter(\"stringCol = %@\", AnyRealmValue.string(\"1\")).count)\n        XCTAssertEqual(1, collection.filter(\"stringCol = %@\", AnyRealmValue.string(\"2\")).count)\n        XCTAssertEqual(0, collection.filter(\"stringCol = %@\", AnyRealmValue.string(\"3\")).count)\n\n        XCTAssertEqual(1, collection.filter(\"stringCol = %@\", StringWrapper(persistedValue: \"1\")).count)\n        XCTAssertEqual(1, collection.filter(\"stringCol = %@\", StringWrapper(persistedValue: \"2\")).count)\n        XCTAssertEqual(0, collection.filter(\"stringCol = %@\", StringWrapper(persistedValue: \"3\")).count)\n\n        XCTAssertEqual(1, collection.filter { $0.stringCol == \"1\" }.count)\n        XCTAssertEqual(1, collection.filter { $0.stringCol == \"2\" }.count)\n        XCTAssertEqual(0, collection.filter { $0.stringCol == \"3\" }.count)\n\n        XCTAssertEqual(1, collection.where { $0.stringCol == \"1\" }.count)\n        XCTAssertEqual(0, collection.where { $0.stringCol == \"3\" }.count)\n    }\n\n    func testFilterWithAnyVarags() {\n        let firstCriterion: String? = \"1\"\n        let secondCriterion: String = \"2\"\n        let thirdCriterion: String? = nil\n        let result = collection.filter(\"stringCol = %@ OR stringCol = %@ OR stringCol = %@\",\n                                       firstCriterion as Any, secondCriterion as Any, thirdCriterion as Any)\n        XCTAssertEqual(2, result.count)\n\n        let queryResult = collection.where { $0.stringCol == firstCriterion || $0.stringCol == secondCriterion || $0.stringCol == thirdCriterion }\n        XCTAssertEqual(2, queryResult.count)\n    }\n\n    func testFilterList() {\n        let outerArray = SwiftDoubleListOfSwiftObject()\n        let realm = self.realm()\n        let innerArray = SwiftListOfSwiftObject()\n        innerArray.array.append(SwiftObject())\n        outerArray.array.append(innerArray)\n        try! realm.write {\n            realm.add(outerArray)\n        }\n        XCTAssertEqual(1, outerArray.array.filter(\"ANY array IN %@\", realm.objects(SwiftObject.self)).count)\n        XCTAssertEqual(1, outerArray.array.where { $0.array.containsAny(in: realm.objects(SwiftObject.self)) }.count)\n    }\n\n    func testFilterResults() {\n        let array = SwiftListOfSwiftObject()\n        let realm = self.realm()\n        array.array.append(SwiftObject())\n        try! realm.write {\n            realm.add(array)\n        }\n        XCTAssertEqual(1, realm.objects(SwiftListOfSwiftObject.self).filter(\"ANY array IN %@\", realm.objects(SwiftObject.self)).count)\n        XCTAssertEqual(1, realm.objects(SwiftListOfSwiftObject.self).where { $0.array.containsAny(in: realm.objects(SwiftObject.self)) }.count)\n    }\n\n    func testFilterPredicate() {\n        XCTAssertEqual(1, collection.filter(NSPredicate(format: \"stringCol = '1'\")).count)\n        XCTAssertEqual(1, collection.filter(NSPredicate(format: \"stringCol = '2'\")).count)\n        XCTAssertEqual(0, collection.filter(NSPredicate(format: \"stringCol = '3'\")).count)\n\n        let pred1 = NSPredicate(format: \"stringCol = %@\", argumentArray: [AnyRealmValue.string(\"1\")])\n        let pred2 = NSPredicate(format: \"stringCol = %@\", argumentArray: [AnyRealmValue.string(\"2\")])\n        let pred3 = NSPredicate(format: \"stringCol = %@\", argumentArray: [AnyRealmValue.string(\"3\")])\n        XCTAssertEqual(1, collection.filter(pred1).count)\n        XCTAssertEqual(1, collection.filter(pred2).count)\n        XCTAssertEqual(0, collection.filter(pred3).count)\n    }\n\n    func testSortWithProperty() {\n        var sorted = collection.sorted(byKeyPath: \"stringCol\", ascending: true)\n        XCTAssertEqual(\"1\", sorted[0].stringCol)\n        XCTAssertEqual(\"2\", sorted[1].stringCol)\n\n        sorted = collection.sorted(byKeyPath: \"stringCol\", ascending: false)\n        XCTAssertEqual(\"2\", sorted[0].stringCol)\n        XCTAssertEqual(\"1\", sorted[1].stringCol)\n\n        sorted = collection.sorted(byKeyPath: \"linkCol.id\", ascending: true)\n        XCTAssertEqual(\"1\", sorted[0].stringCol)\n        XCTAssertEqual(\"2\", sorted[1].stringCol)\n\n        assertThrows(collection.sorted(byKeyPath: \"noSuchCol\", ascending: true),\n                     reason: \"Cannot sort on key path 'noSuchCol': property 'CTTNullableStringObjectWithLink.noSuchCol' does not exist\")\n    }\n\n    func testSortWithSwiftKeyPath() {\n        var sorted = collection.sorted(by: \\.stringCol, ascending: true)\n        XCTAssertEqual(\"1\", sorted[0].stringCol)\n        XCTAssertEqual(\"2\", sorted[1].stringCol)\n\n        sorted = collection.sorted(by: \\.stringCol, ascending: false)\n        XCTAssertEqual(\"2\", sorted[0].stringCol)\n        XCTAssertEqual(\"1\", sorted[1].stringCol)\n\n        sorted = collection.sorted(by: \\.linkCol?.id, ascending: true)\n        XCTAssertEqual(\"1\", sorted[0].stringCol)\n        XCTAssertEqual(\"2\", sorted[1].stringCol)\n\n        let nonOptionalSorted = getAggregateableCollection().sorted(by: \\.intCol, ascending: true)\n        nonOptionalSorted.enumerated().forEach { e in\n            XCTAssertEqual(e.offset+1, nonOptionalSorted[e.offset].intCol)\n        }\n    }\n\n    func testSortWithDescriptor() {\n        let collection = getAggregateableCollection()\n\n        let notActuallySorted = collection.sorted(by: [])\n        collection.enumerated().forEach { (e) in\n            assertEqual(e.element, notActuallySorted[e.offset])\n        }\n\n        let sorted = collection.sorted(by: [SortDescriptor(keyPath: \"intCol\", ascending: true)])\n        sorted.enumerated().forEach { (e) in\n            XCTAssertEqual(e.offset+1, sorted[e.offset].intCol)\n        }\n        assertThrows(collection.sorted(by: [SortDescriptor(keyPath: \"noSuchCol\")]),\n                     reason: \"Cannot sort on key path 'noSuchCol': property 'CTTAggregateObject.noSuchCol' does not exist\")\n    }\n\n    func testSortWithDescriptorBySwiftKeyPath() {\n        let collection = getAggregateableCollection()\n\n        let notActuallySorted = collection.sorted(by: [])\n        collection.enumerated().forEach { (e) in\n            assertEqual(e.element, notActuallySorted[e.offset])\n        }\n\n        let sorted = collection.sorted(by: [SortDescriptor(keyPath: \\CTTAggregateObject.intCol,\n                                                           ascending: true)])\n        sorted.enumerated().forEach { (e) in\n            XCTAssertEqual(e.offset+1, sorted[e.offset].intCol)\n        }\n    }\n\n    func testMin() {\n        let collection = getAggregateableCollection()\n        XCTAssertEqual(1, collection.min(ofProperty: \"intCol\") as NSNumber?)\n        XCTAssertEqual(1, collection.min(ofProperty: \"intCol\") as Int?)\n        XCTAssertEqual(1, collection.min(ofProperty: \"int8Col\") as NSNumber?)\n        XCTAssertEqual(1, collection.min(ofProperty: \"int8Col\") as Int8?)\n        XCTAssertEqual(1, collection.min(ofProperty: \"int16Col\") as NSNumber?)\n        XCTAssertEqual(1, collection.min(ofProperty: \"int16Col\") as Int16?)\n        XCTAssertEqual(1, collection.min(ofProperty: \"int32Col\") as NSNumber?)\n        XCTAssertEqual(1, collection.min(ofProperty: \"int32Col\") as Int32?)\n        XCTAssertEqual(1, collection.min(ofProperty: \"int64Col\") as NSNumber?)\n        XCTAssertEqual(1, collection.min(ofProperty: \"int64Col\") as Int64?)\n        XCTAssertEqual(1.1 as Float as NSNumber, collection.min(ofProperty: \"floatCol\") as NSNumber?)\n        XCTAssertEqual(1.1, collection.min(ofProperty: \"floatCol\") as Float?)\n        XCTAssertEqual(1.11, collection.min(ofProperty: \"doubleCol\") as NSNumber?)\n        XCTAssertEqual(1.11, collection.min(ofProperty: \"doubleCol\") as Double?)\n        XCTAssertEqual(NSDate(timeIntervalSince1970: 1), collection.min(ofProperty: \"dateCol\") as NSDate?)\n        XCTAssertEqual(Date(timeIntervalSince1970: 1), collection.min(ofProperty: \"dateCol\") as Date?)\n\n        assertThrows(collection.min(ofProperty: \"noSuchCol\") as NSNumber?, named: \"Invalid property name\")\n        assertThrows(collection.min(ofProperty: \"noSuchCol\") as Float?, named: \"Invalid property name\")\n    }\n\n    func testMinBySwiftKeyPath() {\n        let collection = getAggregateableCollection()\n        XCTAssertEqual(1, collection.min(of: \\.intCol))\n        XCTAssertEqual(1, collection.min(of: \\.int8Col))\n        XCTAssertEqual(1, collection.min(of: \\.int16Col))\n        XCTAssertEqual(1, collection.min(of: \\.int32Col))\n        XCTAssertEqual(1, collection.min(of: \\.int64Col))\n        XCTAssertEqual(1.1, collection.min(of: \\.floatCol))\n        XCTAssertEqual(1.11, collection.min(of: \\.doubleCol))\n        XCTAssertEqual(Date(timeIntervalSince1970: 1), collection.min(of: \\.dateCol))\n    }\n\n    func testMax() {\n        let collection = getAggregateableCollection()\n        XCTAssertEqual(3, collection.max(ofProperty: \"intCol\") as NSNumber?)\n        XCTAssertEqual(3, collection.max(ofProperty: \"intCol\") as Int?)\n        XCTAssertEqual(3, collection.max(ofProperty: \"int8Col\") as NSNumber?)\n        XCTAssertEqual(3, collection.max(ofProperty: \"int8Col\") as Int8?)\n        XCTAssertEqual(3, collection.max(ofProperty: \"int16Col\") as NSNumber?)\n        XCTAssertEqual(3, collection.max(ofProperty: \"int16Col\") as Int16?)\n        XCTAssertEqual(3, collection.max(ofProperty: \"int32Col\") as NSNumber?)\n        XCTAssertEqual(3, collection.max(ofProperty: \"int32Col\") as Int32?)\n        XCTAssertEqual(3, collection.max(ofProperty: \"int64Col\") as NSNumber?)\n        XCTAssertEqual(3, collection.max(ofProperty: \"int64Col\") as Int64?)\n        XCTAssertEqual(2.2 as Float as NSNumber, collection.max(ofProperty: \"floatCol\") as NSNumber?)\n        XCTAssertEqual(2.2, collection.max(ofProperty: \"floatCol\") as Float?)\n        XCTAssertEqual(2.22, collection.max(ofProperty: \"doubleCol\") as NSNumber?)\n        XCTAssertEqual(2.22, collection.max(ofProperty: \"doubleCol\") as Double?)\n        XCTAssertEqual(NSDate(timeIntervalSince1970: 2), collection.max(ofProperty: \"dateCol\") as NSDate?)\n        XCTAssertEqual(Date(timeIntervalSince1970: 2), collection.max(ofProperty: \"dateCol\") as Date?)\n\n        assertThrows(collection.max(ofProperty: \"noSuchCol\") as NSNumber?, named: \"Invalid property name\")\n        assertThrows(collection.max(ofProperty: \"noSuchCol\") as Float?, named: \"Invalid property name\")\n    }\n\n    func testMaxBySwiftKeyPath() {\n        let collection = getAggregateableCollection()\n        XCTAssertEqual(3, collection.max(of: \\.intCol))\n        XCTAssertEqual(3, collection.max(of: \\.int8Col))\n        XCTAssertEqual(3, collection.max(of: \\.int16Col))\n        XCTAssertEqual(3, collection.max(of: \\.int32Col))\n        XCTAssertEqual(3, collection.max(of: \\.int64Col))\n        XCTAssertEqual(2.2, collection.max(of: \\.floatCol))\n        XCTAssertEqual(2.22, collection.max(of: \\.doubleCol))\n        XCTAssertEqual(2.22, collection.max(of: \\.doubleCol))\n        XCTAssertEqual(Date(timeIntervalSince1970: 2), collection.max(of: \\.dateCol))\n    }\n\n    func testSum() {\n        let collection = getAggregateableCollection()\n        XCTAssertEqual(6, collection.sum(ofProperty: \"intCol\") as NSNumber)\n        XCTAssertEqual(6, collection.sum(ofProperty: \"intCol\") as Int)\n        XCTAssertEqual(6, collection.sum(ofProperty: \"int8Col\") as NSNumber)\n        XCTAssertEqual(6, collection.sum(ofProperty: \"int8Col\") as Int8)\n        XCTAssertEqual(6, collection.sum(ofProperty: \"int16Col\") as NSNumber)\n        XCTAssertEqual(6, collection.sum(ofProperty: \"int16Col\") as Int16)\n        XCTAssertEqual(6, collection.sum(ofProperty: \"int32Col\") as NSNumber)\n        XCTAssertEqual(6, collection.sum(ofProperty: \"int32Col\") as Int32)\n        XCTAssertEqual(6, collection.sum(ofProperty: \"int64Col\") as NSNumber)\n        XCTAssertEqual(6, collection.sum(ofProperty: \"int64Col\") as Int64)\n        XCTAssertEqual(5.5, (collection.sum(ofProperty: \"floatCol\") as NSNumber).floatValue,\n                                   accuracy: 0.001)\n        XCTAssertEqual(5.5, collection.sum(ofProperty: \"floatCol\") as Float, accuracy: 0.001)\n        XCTAssertEqual(5.55, (collection.sum(ofProperty: \"doubleCol\") as NSNumber).doubleValue,\n                                   accuracy: 0.001)\n        XCTAssertEqual(5.55, collection.sum(ofProperty: \"doubleCol\") as Double, accuracy: 0.001)\n\n        assertThrows(collection.sum(ofProperty: \"noSuchCol\") as NSNumber, named: \"Invalid property name\")\n        assertThrows(collection.sum(ofProperty: \"noSuchCol\") as Float, named: \"Invalid property name\")\n    }\n\n    func testSumBySwiftKeyPath() {\n        let collection = getAggregateableCollection()\n        XCTAssertEqual(6, collection.sum(of: \\.intCol))\n        XCTAssertEqual(6, collection.sum(of: \\.int8Col))\n        XCTAssertEqual(6, collection.sum(of: \\.int16Col))\n        XCTAssertEqual(6, collection.sum(of: \\.int32Col))\n        XCTAssertEqual(6, collection.sum(of: \\.int64Col))\n        XCTAssertEqual(5.5, (collection.sum(of: \\.floatCol)),\n                                   accuracy: 0.001)\n        XCTAssertEqual(5.55, (collection.sum(of: \\.doubleCol)),\n                                   accuracy: 0.001)\n    }\n\n    func testAverage() {\n        let collection = getAggregateableCollection()\n        XCTAssertEqual(2, collection.average(ofProperty: \"intCol\"))\n        XCTAssertEqual(2, collection.average(ofProperty: \"int8Col\"))\n        XCTAssertEqual(2, collection.average(ofProperty: \"int16Col\"))\n        XCTAssertEqual(2, collection.average(ofProperty: \"int32Col\"))\n        XCTAssertEqual(2, collection.average(ofProperty: \"int64Col\"))\n        XCTAssertEqual(1.8333, collection.average(ofProperty: \"floatCol\")!, accuracy: 0.001)\n        XCTAssertEqual(1.85, collection.average(ofProperty: \"doubleCol\")!, accuracy: 0.001)\n\n        assertThrows(collection.average(ofProperty: \"noSuchCol\") as Double?, named: \"Invalid property name\")\n    }\n\n    func testAverageBySwiftKeyPath() {\n        let collection = getAggregateableCollection()\n        XCTAssertEqual(2, collection.average(of: \\.intCol))\n        XCTAssertEqual(2, collection.average(of: \\.int8Col))\n        XCTAssertEqual(2, collection.average(of: \\.int16Col))\n        XCTAssertEqual(2, collection.average(of: \\.int32Col))\n        XCTAssertEqual(2, collection.average(of: \\.int64Col))\n        XCTAssertEqual(1.8333, collection.average(of: \\.floatCol)!, accuracy: 0.001)\n        XCTAssertEqual(1.85, collection.average(of: \\.doubleCol)!, accuracy: 0.001)\n    }\n\n    func testFastEnumeration() {\n        var str = \"\"\n        for obj in collection {\n            str += obj.stringCol!\n        }\n\n        XCTAssertEqual(str, \"12\")\n    }\n\n    func testFastEnumerationWithMutation() {\n        let realm = self.realm()\n        try! realm.write {\n            for obj in collection {\n                realm.delete(obj)\n            }\n        }\n        XCTAssertEqual(0, collection.count)\n    }\n\n    func testAssignListProperty() {\n        let realm = self.realm()\n        try! realm.write {\n            let array = CTTStringList()\n            realm.add(array)\n            array[\"array\"] = getCollection(realm)\n        }\n    }\n\n    func testAssignSetProperty() {\n        let realm = self.realm()\n        try! realm.write {\n            let set = CTTStringSet()\n            realm.add(set)\n            set[\"set\"] = getCollection(realm)\n        }\n    }\n\n    func testArrayAggregateWithSwiftObjectDoesntThrow() {\n        let collection = getAggregateableCollection()\n\n        // Should not throw a type error.\n        XCTAssertEqual(0, collection.filter(\"ANY stringListCol == %@\", CTTNullableStringObjectWithLink()).count)\n        XCTAssertEqual(0, collection.where { $0.stringListCol.contains(CTTNullableStringObjectWithLink()) }.count)\n    }\n\n    @MainActor\n    func testObserve() {\n        let ex = expectation(description: \"initial notification\")\n        let token = collection.observe { (changes: RealmCollectionChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 2)\n            case .update:\n                XCTFail(\"Shouldn't happen\")\n            case .error:\n                XCTFail(\"Shouldn't happen\")\n            }\n\n            ex.fulfill()\n        }\n        waitForExpectations(timeout: 1, handler: nil)\n\n        // add a second notification and wait for it\n        var ex2 = expectation(description: \"second initial notification\")\n        let token2 = collection.observe { _ in\n            ex2.fulfill()\n        }\n        waitForExpectations(timeout: 1, handler: nil)\n\n        // make a write and implicitly verify that only the unskipped\n        // notification is called (the first would error on .update)\n        ex2 = expectation(description: \"change notification\")\n        let realm = self.realm()\n        realm.beginWrite()\n        realm.delete(collection)\n        try! realm.commitWrite(withoutNotifying: [token])\n        waitForExpectations(timeout: 1, handler: nil)\n\n        token.invalidate()\n        token2.invalidate()\n    }\n\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    private actor TestActor {\n        private var gotInitial = false\n        private var gotChange = false\n        var expectation: XCTestExpectation!\n\n        func expect(_ description: String) {\n            expectation = XCTestExpectation(description: description)\n        }\n\n        func check<Collection2: RealmCollection>(_ changes: RealmCollectionChange<Collection2>) {\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 2)\n                XCTAssertFalse(gotInitial)\n                gotInitial = true\n\n            case let .update(collection, deletions, _, _):\n                XCTAssertEqual(collection.count, 0)\n                XCTAssertEqual(deletions, [0, 1])\n                XCTAssertFalse(gotChange)\n                gotChange = true\n\n            case .error(let error):\n                XCTFail(\"Unexpected error: \\(error)\")\n            }\n            expectation.fulfill()\n        }\n\n        func checkFiltered<Collection2: RealmCollection>(_ changes: RealmCollectionChange<Collection2>) {\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 2)\n                XCTAssertFalse(gotInitial)\n                gotInitial = true\n\n            case let .update(_, _, _, modifications):\n                XCTAssertEqual(modifications, [0])\n                XCTAssertFalse(gotChange)\n                gotChange = true\n\n            case .error(let error):\n                XCTFail(\"Unexpected error: \\(error)\")\n            }\n            expectation.fulfill()\n        }\n\n        func observe(_ tsr: ThreadSafeReference<Collection>) async throws -> NotificationToken {\n            let realm = try await openRealm(configuration: Config.config, actor: self)\n            return try XCTUnwrap(realm.resolve(tsr)).observe(check)\n        }\n    }\n\n    @MainActor\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    func testObserveOnActor() async throws {\n        let actor = TestActor()\n        await actor.expect(\"initial notification\")\n        let token = await collection.observe(on: actor) { actor, changes in\n            actor.check(changes)\n        }\n        await fulfillment(of: [actor.expectation])\n\n        await actor.expect(\"change notification\")\n        let realm = self.realm()\n        try realm.write {\n            realm.delete(collection)\n        }\n        await fulfillment(of: [actor.expectation])\n        token.invalidate()\n    }\n\n    @MainActor\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    func testObserveInsideActor() async throws {\n        let actor = TestActor()\n        await actor.expect(\"initial notification\")\n        let token = try await actor.observe(ThreadSafeReference(to: collection))\n        await fulfillment(of: [actor.expectation])\n\n        await actor.expect(\"change notification\")\n        let realm = self.realm()\n        try realm.write {\n            realm.delete(collection)\n        }\n        await fulfillment(of: [actor.expectation])\n        token.invalidate()\n    }\n\n    @MainActor\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    func testCancelTaskForObservationInit() async throws {\n        let task = Locked<Task<Void, Never>?>(wrappedValue: nil)\n        task.wrappedValue = Task { @MainActor in\n            task.wrappedValue!.cancel()\n            let token = await collection.observe(on: CustomGlobalActor.shared) { _, _ in\n                XCTFail(\"should not have been registered\")\n            }\n            XCTAssertFalse(token.invalidate())\n        }\n        await _ = task.wrappedValue!.value\n    }\n\n    @MainActor\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    func testObserveOnActorWithStringKeyPath() async throws {\n        let actor = TestActor()\n        await actor.expect(\"initial notification\")\n        let token = await collection.observe(keyPaths: [\"stringCol\"], on: actor) { actor, changes in\n            actor.checkFiltered(changes)\n        }\n        await fulfillment(of: [actor.expectation])\n\n        await actor.expect(\"change notification\")\n        let realm = self.realm()\n        try realm.write {\n            collection[0].stringCol = \"a\"\n            collection[1].linkCol = nil\n        }\n        await fulfillment(of: [actor.expectation])\n        token.invalidate()\n    }\n\n    @MainActor\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    func testObserveOnActorWithKeyPath() async throws {\n        let actor = TestActor()\n        await actor.expect(\"initial notification\")\n        let token = await collection.observe(keyPaths: [\\.stringCol], on: actor) { actor, changes in\n            actor.checkFiltered(changes)\n        }\n        await fulfillment(of: [actor.expectation])\n\n        await actor.expect(\"change notification\")\n        let realm = self.realm()\n        try realm.write {\n            collection[0].stringCol = \"a\"\n            collection[1].linkCol = nil\n        }\n        await fulfillment(of: [actor.expectation])\n        token.invalidate()\n    }\n\n    @MainActor\n    func testObserveKeyPath() {\n        var ex = expectation(description: \"initial notification\")\n        let token0 = collection.observe(keyPaths: [\"stringCol\"]) { (changes: RealmCollectionChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 2)\n            case .update(_, let deletions, let insertions, let modifications):\n                XCTAssertEqual(deletions, [])\n                XCTAssertEqual(insertions, [])\n                XCTAssertEqual(modifications, [0])\n            case .error:\n                XCTFail(\"error not expected\")\n            }\n            ex.fulfill()\n        }\n        waitForExpectations(timeout: 0.2, handler: nil)\n\n        // Expect a change notification for the token observing `stringCol` keypath.\n        ex = self.expectation(description: \"change notification\")\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            let realm = unsafeSelf.realm()\n            realm.beginWrite()\n            let obj = realm.objects(CTTNullableStringObjectWithLink.self).first!\n            obj.stringCol = \"changed\"\n            try! realm.commitWrite()\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token0.invalidate()\n    }\n\n    func expectNoChange(fn: @Sendable @escaping (Realm) -> Void) {\n        let ex = self.expectation(description: \"refresh\")\n        let token = self.realm().observe { _, _ in\n            ex.fulfill()\n        }\n\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            let realm = unsafeSelf.realm()\n            realm.beginWrite()\n            fn(realm)\n            try! realm.commitWrite()\n        }\n        wait(for: [ex], timeout: 0.2)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testObserveKeyPathNoChange() {\n        let ex = expectation(description: \"initial notification\")\n        let token0 = collection.observe(keyPaths: [\"stringCol\"]) { (changes: RealmCollectionChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 2)\n            default:\n                XCTFail(\"Unexpected change: \\(changes)\")\n            }\n            ex.fulfill()\n        }\n        waitForExpectations(timeout: 0.2, handler: nil)\n\n        // Expect no notification for `stringCol` key path because only `linkCol.id` will be modified.\n        expectNoChange { realm in\n            let obj = realm.objects(CTTNullableStringObjectWithLink.self).first!\n            obj.linkCol!.id = 2\n        }\n        token0.invalidate()\n    }\n\n    @MainActor\n    func testObserveKeyPathWithLink() {\n        var ex = expectation(description: \"initial notification\")\n        let token = collection.observe(keyPaths: [\"linkCol.id\"]) { (changes: RealmCollectionChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 2)\n            case .update(_, let deletions, let insertions, let modifications):\n                XCTAssertEqual(deletions, [])\n                XCTAssertEqual(insertions, [])\n                // The reason two column changes are expected here is because the\n                // single CTTLinkTarget object that is modified is linked to two origin objects.\n                // The 0, 1 index refers to the origin objects.\n                XCTAssertEqual(modifications, [0, 1])\n            case .error:\n                XCTFail(\"error not expected\")\n            }\n            ex.fulfill()\n        }\n        waitForExpectations(timeout: 0.2, handler: nil)\n\n        // Only expect a change notification for `linkCol.id` keypath.\n        ex = self.expectation(description: \"change notification\")\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            let realm = unsafeSelf.realm()\n            realm.beginWrite()\n            let obj = realm.objects(CTTNullableStringObjectWithLink.self).first!\n            obj.linkCol!.id = 2\n            try! realm.commitWrite()\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testObserveKeyPathWithLinkNoChange() {\n        let ex = expectation(description: \"initial notification\")\n        let token = collection.observe(keyPaths: [\"linkCol.id\"]) { (changes: RealmCollectionChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 2)\n            default:\n                XCTFail(\"Unexpected change: \\(changes)\")\n            }\n            ex.fulfill()\n        }\n        waitForExpectations(timeout: 0.2, handler: nil)\n\n        // Expect no notification for `linkCol.id` key path because only `stringCol` will be modified.\n        expectNoChange { realm in\n            let obj = realm.objects(CTTNullableStringObjectWithLink.self).first!\n            obj.stringCol = \"changed\"\n        }\n        token.invalidate()\n    }\n\n    @MainActor\n    func testObserveKeyPathWithLinkNoChangeList() {\n        let ex = expectation(description: \"initial notification\")\n        let token = collection.observe(keyPaths: [\"linkCol\"]) { (changes: RealmCollectionChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 2)\n            default:\n                XCTFail(\"Unexpected change: \\(changes)\")\n            }\n            ex.fulfill()\n        }\n        waitForExpectations(timeout: 0.2, handler: nil)\n\n        // Expect no notification for `linkCol` key path because only `linkCol.id` will be modified.\n        expectNoChange { realm in\n            let obj = realm.objects(CTTNullableStringObjectWithLink.self).first!\n            obj.linkCol!.id = 2\n        }\n        token.invalidate()\n    }\n\n    @MainActor\n    func testObservePartialKeyPath() {\n        var ex = expectation(description: \"initial notification\")\n        let token0 = collection.observe(keyPaths: [\\.stringCol]) { (changes: RealmCollectionChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 2)\n            case .update(_, let deletions, let insertions, let modifications):\n                XCTAssertEqual(deletions, [])\n                XCTAssertEqual(insertions, [])\n                XCTAssertEqual(modifications, [0])\n            case .error:\n                XCTFail(\"error not expected\")\n            }\n            ex.fulfill()\n        }\n        waitForExpectations(timeout: 0.2, handler: nil)\n\n        // Expect a change notification for the token observing `stringCol` keypath.\n        ex = self.expectation(description: \"change notification\")\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            let realm = unsafeSelf.realm()\n            realm.beginWrite()\n            let obj = realm.objects(CTTNullableStringObjectWithLink.self).first!\n            obj.stringCol = \"changed\"\n            try! realm.commitWrite()\n        }\n        waitForExpectations(timeout: 0.1, handler: nil)\n        token0.invalidate()\n    }\n\n    @MainActor\n    func testObservePartialKeyPathNoChange() {\n        let ex = expectation(description: \"initial notification\")\n        let token0 = collection.observe(keyPaths: [\\.stringCol]) { (changes: RealmCollectionChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 2)\n            default:\n                XCTFail(\"Unexpected change: \\(changes)\")\n            }\n            ex.fulfill()\n        }\n        waitForExpectations(timeout: 0.2, handler: nil)\n\n        // Expect no notification for `stringCol` key path because only `linkCol.id` will be modified.\n        expectNoChange { realm in\n            let obj = realm.objects(CTTNullableStringObjectWithLink.self).first!\n            obj.linkCol!.id = 2\n        }\n        token0.invalidate()\n    }\n\n    @MainActor\n    func testObservePartialKeyPathWithLink() {\n        var ex = expectation(description: \"initial notification\")\n        let token = collection.observe(keyPaths: [\\.linkCol?.id]) { (changes: RealmCollectionChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 2)\n            case .update(_, let deletions, let insertions, let modifications):\n                XCTAssertEqual(deletions, [])\n                XCTAssertEqual(insertions, [])\n                // The reason two column changes are expected here is because the\n                // single CTTLinkTarget object that is modified is linked to two origin objects.\n                // The 0, 1 index refers to the origin objects.\n                XCTAssertEqual(modifications, [0, 1])\n            case .error:\n                XCTFail(\"error not expected\")\n            }\n            ex.fulfill()\n        }\n        waitForExpectations(timeout: 0.2, handler: nil)\n\n        // Only expect a change notification for `linkCol.id` keypath.\n        ex = self.expectation(description: \"change notification\")\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            let realm = unsafeSelf.realm()\n            realm.beginWrite()\n            let obj = realm.objects(CTTNullableStringObjectWithLink.self).first!\n            obj.linkCol!.id = 2\n            try! realm.commitWrite()\n        }\n        waitForExpectations(timeout: 0.2, handler: nil)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testObservePartialKeyPathWithLinkNoChangeList() {\n        let ex = expectation(description: \"initial notification\")\n        let token = collection.observe(keyPaths: [\\.linkCol]) { (changes: RealmCollectionChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 2)\n            default:\n                XCTFail(\"Unexpected change: \\(changes)\")\n            }\n            ex.fulfill()\n        }\n        waitForExpectations(timeout: 0.2, handler: nil)\n\n        // Expect no notification for `linkCol` key path because only `linkCol.id` will be modified.\n        expectNoChange { realm in\n            let obj = realm.objects(CTTNullableStringObjectWithLink.self).first!\n            obj.linkCol!.id = 2\n        }\n        token.invalidate()\n    }\n\n    func testObserveOnQueue() {\n        let sema = DispatchSemaphore(value: 0)\n        let token = collection.observe(keyPaths: nil, on: queue) { @Sendable (changes: RealmCollectionChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 2)\n            case .update(let collection, let deletions, _, _):\n                XCTAssertEqual(collection.count, 0)\n                XCTAssertEqual(deletions, [0, 1])\n            case .error:\n                XCTFail(\"Shouldn't happen\")\n            }\n\n            sema.signal()\n        }\n        sema.wait()\n\n        let realm = self.realm()\n        try! realm.write {\n            realm.delete(collection)\n        }\n        sema.wait()\n\n        token.invalidate()\n    }\n\n    func testValueForKeyPath() {\n        XCTAssertEqual([\"1\", \"2\"], collection.value(forKeyPath: \"@unionOfObjects.stringCol\") as! NSArray?)\n\n        let theCollection = getAggregateableCollection()\n        XCTAssertEqual(3, (theCollection.value(forKeyPath: \"@count\") as! NSNumber?)?.int64Value)\n        XCTAssertEqual(3, (theCollection.value(forKeyPath: \"@max.intCol\") as! NSNumber?)?.int64Value)\n        XCTAssertEqual(1, (theCollection.value(forKeyPath: \"@min.intCol\") as! NSNumber?)?.int64Value)\n        XCTAssertEqual(6, (theCollection.value(forKeyPath: \"@sum.intCol\") as! NSNumber?)?.int64Value)\n        XCTAssertEqual(2.0, (theCollection.value(forKeyPath: \"@avg.intCol\") as! NSNumber?)?.doubleValue)\n    }\n\n    func testInvalidate() {\n        XCTAssertFalse(collection.isInvalidated)\n        self.realm().invalidate()\n        XCTAssertTrue(collection.realm == nil || collection.isInvalidated)\n    }\n\n    func testIsFrozen() {\n        XCTAssertFalse(collection.isFrozen)\n        XCTAssertTrue(collection.freeze().isFrozen)\n    }\n\n    func testThaw() {\n        let frozen = collection.freeze()\n        XCTAssertTrue(frozen.isFrozen)\n\n        let frozenRealm = frozen.realm!\n        assertThrows(try! frozenRealm.write {}, reason: \"Can't perform transactions on a frozen Realm\")\n\n        let live = frozen.thaw()\n        XCTAssertFalse(live!.isFrozen)\n\n        let liveRealm = live!.realm!\n        try! liveRealm.write { liveRealm.delete(live!) }\n        XCTAssertTrue(live!.isEmpty)\n        XCTAssertFalse(frozen.isEmpty)\n    }\n\n    func testThawFromDifferentThread() {\n        nonisolated(unsafe) let frozen = collection.freeze()\n        XCTAssertTrue(frozen.isFrozen)\n\n        dispatchSyncNewThread {\n            let live = frozen.thaw()\n            XCTAssertFalse(live!.isFrozen)\n\n            let liveRealm = live!.realm!\n            try! liveRealm.write { liveRealm.delete(live!) }\n            XCTAssertTrue(live!.isEmpty)\n            XCTAssertFalse(frozen.isEmpty)\n        }\n    }\n\n\n    func testThawPreviousVersion() {\n        let frozen = collection.freeze()\n        XCTAssertTrue(frozen.isFrozen)\n        XCTAssertEqual(collection.count, frozen.count)\n\n        let realm = collection.realm!\n        try! realm.write { realm.delete(collection) }\n        XCTAssertNotEqual(frozen.count, collection.count, \"Frozen collections should not change\")\n\n        let live = frozen.thaw()\n        XCTAssertTrue(live!.isEmpty, \"Thawed collection should reflect transactions since the original reference was frozen\")\n        XCTAssertFalse(frozen.isEmpty)\n        XCTAssertEqual(live!.count, self.collection.count)\n    }\n\n    func testThawUpdatedOnDifferentThread() {\n        let tsr = ThreadSafeReference(to: collection)\n        nonisolated(unsafe) var frozen: Collection?\n        nonisolated(unsafe) var frozenQuery: Results<CTTNullableStringObjectWithLink>?\n\n        XCTAssertEqual(collection.count, 2) // stringCol \"1\" and \"2\"\n        XCTAssertEqual(collection.filter(\"stringCol == %@\", \"3\").count, 0)\n        XCTAssertEqual(collection.where { $0.stringCol == \"3\" }.count, 0)\n\n        let configuration = self.collection.realm!.configuration\n        dispatchSyncNewThread {\n            let realm = try! Realm(configuration: configuration)\n            let collection = realm.resolve(tsr)!\n            try! realm.write { collection.first!.stringCol = \"3\" }\n            try! realm.write { realm.delete(collection.last!) }\n\n            let query = collection.filter(\"stringCol == %@\", \"1\")\n            frozen = collection.freeze() // Results::Mode::TableView\n            frozenQuery = query.freeze() // Results::Mode::Query\n\n        }\n\n        let thawed = frozen!.thaw()\n        XCTAssertEqual(frozen!.count, 1)\n        XCTAssertEqual(frozen!.first?.stringCol, \"3\")\n        XCTAssertEqual(frozen!.filter(\"stringCol == %@\", \"1\").count, 0)\n        XCTAssertEqual(frozen!.filter(\"stringCol == %@\", \"2\").count, 0)\n        XCTAssertEqual(frozen!.filter(\"stringCol == %@\", \"3\").count, 1)\n\n        XCTAssertEqual(frozen!.where { $0.stringCol == \"1\" }.count, 0)\n        XCTAssertEqual(frozen!.where { $0.stringCol == \"2\" }.count, 0)\n        XCTAssertEqual(frozen!.where { $0.stringCol == \"3\" }.count, 1)\n\n        XCTAssertEqual(thawed!.count, 2)\n        XCTAssertEqual(thawed!.first?.stringCol, \"1\")\n        XCTAssertEqual(thawed!.filter(\"stringCol == %@\", \"1\").count, 1)\n        XCTAssertEqual(thawed!.filter(\"stringCol == %@\", \"2\").count, 1)\n        XCTAssertEqual(thawed!.filter(\"stringCol == %@\", \"3\").count, 0)\n\n        XCTAssertEqual(thawed!.where { $0.stringCol == \"1\" }.count, 1)\n        XCTAssertEqual(thawed!.where { $0.stringCol == \"2\" }.count, 1)\n        XCTAssertEqual(thawed!.where { $0.stringCol == \"3\" }.count, 0)\n\n        XCTAssertEqual(collection.count, 2)\n        XCTAssertEqual(collection.first?.stringCol, \"1\")\n        XCTAssertEqual(collection.filter(\"stringCol == %@\", \"1\").count, 1)\n        XCTAssertEqual(collection.filter(\"stringCol == %@\", \"2\").count, 1)\n        XCTAssertEqual(collection.filter(\"stringCol == %@\", \"3\").count, 0)\n\n        XCTAssertEqual(collection.where { $0.stringCol == \"1\" }.count, 1)\n        XCTAssertEqual(collection.where { $0.stringCol == \"2\" }.count, 1)\n        XCTAssertEqual(collection.where { $0.stringCol == \"3\" }.count, 0)\n\n        let thawedQuery = frozenQuery!.thaw()\n        XCTAssertEqual(frozenQuery!.count, 0)\n        XCTAssertEqual(frozenQuery!.first?.stringCol, nil)\n        XCTAssertEqual(frozenQuery!.filter(\"stringCol == %@\", \"1\").count, 0)\n        XCTAssertEqual(frozenQuery!.filter(\"stringCol == %@\", \"2\").count, 0)\n        XCTAssertEqual(frozenQuery!.filter(\"stringCol == %@\", \"3\").count, 0)\n\n        XCTAssertEqual(frozenQuery!.where { $0.stringCol == \"1\" }.count, 0)\n        XCTAssertEqual(frozenQuery!.where { $0.stringCol == \"2\" }.count, 0)\n        XCTAssertEqual(frozenQuery!.where { $0.stringCol == \"3\" }.count, 0)\n\n        XCTAssertEqual(thawedQuery!.count, 1)\n        XCTAssertEqual(thawedQuery!.first?.stringCol, \"1\")\n        XCTAssertEqual(thawedQuery!.filter(\"stringCol == %@\", \"1\").count, 1)\n        XCTAssertEqual(thawedQuery!.filter(\"stringCol == %@\", \"2\").count, 0)\n        XCTAssertEqual(thawedQuery!.filter(\"stringCol == %@\", \"3\").count, 0)\n\n        XCTAssertEqual(thawedQuery!.where { $0.stringCol == \"1\" }.count, 1)\n        XCTAssertEqual(thawedQuery!.where { $0.stringCol == \"2\" }.count, 0)\n        XCTAssertEqual(thawedQuery!.where { $0.stringCol == \"3\" }.count, 0)\n\n        collection.realm!.refresh()\n\n        XCTAssertEqual(thawed!.count, 1)\n        XCTAssertEqual(thawed!.first?.stringCol, \"3\")\n        XCTAssertEqual(thawed!.filter(\"stringCol == %@\", \"1\").count, 0)\n        XCTAssertEqual(thawed!.filter(\"stringCol == %@\", \"2\").count, 0)\n        XCTAssertEqual(thawed!.filter(\"stringCol == %@\", \"3\").count, 1)\n\n        XCTAssertEqual(thawed!.where { $0.stringCol == \"1\" }.count, 0)\n        XCTAssertEqual(thawed!.where { $0.stringCol == \"2\" }.count, 0)\n        XCTAssertEqual(thawed!.where { $0.stringCol == \"3\" }.count, 1)\n\n        XCTAssertEqual(thawedQuery!.count, 0)\n        XCTAssertEqual(thawedQuery!.first?.stringCol, nil)\n        XCTAssertEqual(thawedQuery!.filter(\"stringCol == %@\", \"1\").count, 0)\n        XCTAssertEqual(thawedQuery!.filter(\"stringCol == %@\", \"2\").count, 0)\n        XCTAssertEqual(thawedQuery!.filter(\"stringCol == %@\", \"3\").count, 0)\n\n        XCTAssertEqual(thawedQuery!.where { $0.stringCol == \"1\" }.count, 0)\n        XCTAssertEqual(thawedQuery!.where { $0.stringCol == \"2\" }.count, 0)\n        XCTAssertEqual(thawedQuery!.where { $0.stringCol == \"3\" }.count, 0)\n\n        XCTAssertEqual(collection.count, 1)\n        XCTAssertEqual(collection.first?.stringCol, \"3\")\n        XCTAssertEqual(collection.filter(\"stringCol == %@\", \"1\").count, 0)\n        XCTAssertEqual(collection.filter(\"stringCol == %@\", \"2\").count, 0)\n        XCTAssertEqual(collection.filter(\"stringCol == %@\", \"3\").count, 1)\n\n        XCTAssertEqual(collection.where { $0.stringCol == \"1\" }.count, 0)\n        XCTAssertEqual(collection.where { $0.stringCol == \"2\" }.count, 0)\n        XCTAssertEqual(collection.where { $0.stringCol == \"3\" }.count, 1)\n    }\n\n    func testThawDeletedParent() {\n        let frozenElement = collection.first!.freeze()\n        XCTAssertTrue(frozenElement.isFrozen)\n\n        let realm = collection.realm!\n        try! realm.write { realm.delete(collection) }\n        XCTAssertNil(collection.first)\n        XCTAssertNotNil(frozenElement)\n\n        let thawed = frozenElement.thaw()\n        XCTAssertNil(thawed)\n    }\n\n    func testFreezeFromWrongThread() {\n        nonisolated(unsafe) let unsafeSelf = self\n        nonisolated(unsafe) let unsafeCollection = self.collection!\n        dispatchSyncNewThread {\n            unsafeSelf.assertThrows(unsafeCollection.freeze(), reason: \"Realm accessed from incorrect thread\")\n        }\n    }\n\n    func testAccessFrozenCollectionFromDifferentThread() {\n        nonisolated(unsafe) let frozen = collection.freeze()\n        dispatchSyncNewThread {\n            XCTAssertEqual(frozen[0].stringCol, \"1\")\n            XCTAssertEqual(frozen[1].stringCol, \"2\")\n        }\n    }\n\n    func testObserveFrozenCollection() {\n        let frozen = collection.freeze()\n        assertThrows(frozen.observe({ _ in }),\n                     reason: \"Frozen Realms do not change and do not have change notifications.\")\n    }\n\n    func testQueryFrozenCollection() {\n        let frozen = collection.freeze()\n        XCTAssertEqual(frozen.filter(\"stringCol = '1'\").count, 1)\n        XCTAssertEqual(frozen.filter(\"stringCol = '2'\").count, 1)\n        XCTAssertEqual(frozen.filter(\"stringCol = '3'\").count, 0)\n        XCTAssertTrue(frozen.filter(\"stringCol = '3'\").isFrozen)\n\n        XCTAssertEqual(frozen.where { $0.stringCol == \"1\" }.count, 1)\n        XCTAssertEqual(frozen.where { $0.stringCol == \"2\" }.count, 1)\n        XCTAssertEqual(frozen.where { $0.stringCol == \"3\" }.count, 0)\n        XCTAssertTrue(frozen.where { $0.stringCol == \"3\" }.isFrozen)\n    }\n\n    func testFilterWithInt8Property() {\n        _ = makeAggregateableObjects()\n        var results = self.realm().objects(CTTAggregateObject.self).filter(\"int8Col = %d\", Int8(0))\n        XCTAssertEqual(results.count, 0)\n        results = self.realm().objects(CTTAggregateObject.self).filter(\"int8Col = %d\", Int8(1))\n        XCTAssertEqual(results.count, 1)\n        results = self.realm().objects(CTTAggregateObject.self).filter(\"int8Col = %d\", Int8(2))\n        XCTAssertEqual(results.count, 1)\n        results = self.realm().objects(CTTAggregateObject.self).filter(\"int8Col = %d\", Int8(3))\n        XCTAssertEqual(results.count, 1)\n\n        results = self.realm().objects(CTTAggregateObject.self).where { $0.int8Col == 0 }\n        XCTAssertEqual(results.count, 0)\n        results = self.realm().objects(CTTAggregateObject.self).where { $0.int8Col == 1 }\n        XCTAssertEqual(results.count, 1)\n        results = self.realm().objects(CTTAggregateObject.self).where { $0.int8Col == 2 }\n        XCTAssertEqual(results.count, 1)\n        results = self.realm().objects(CTTAggregateObject.self).where { $0.int8Col == 3 }\n        XCTAssertEqual(results.count, 1)\n    }\n\n    func testFilterWithInt16Property() {\n        _ = makeAggregateableObjects()\n        var results = self.realm().objects(CTTAggregateObject.self).filter(\"int16Col = %d\", Int16(0))\n        XCTAssertEqual(results.count, 0)\n        results = self.realm().objects(CTTAggregateObject.self).filter(\"int16Col = %d\", Int16(1))\n        XCTAssertEqual(results.count, 1)\n        results = self.realm().objects(CTTAggregateObject.self).filter(\"int16Col = %d\", Int16(2))\n        XCTAssertEqual(results.count, 1)\n        results = self.realm().objects(CTTAggregateObject.self).filter(\"int16Col = %d\", Int16(3))\n        XCTAssertEqual(results.count, 1)\n\n        results = self.realm().objects(CTTAggregateObject.self).where { $0.int16Col == 0 }\n        XCTAssertEqual(results.count, 0)\n        results = self.realm().objects(CTTAggregateObject.self).where { $0.int16Col == 1 }\n        XCTAssertEqual(results.count, 1)\n        results = self.realm().objects(CTTAggregateObject.self).where { $0.int16Col == 2 }\n        XCTAssertEqual(results.count, 1)\n        results = self.realm().objects(CTTAggregateObject.self).where { $0.int16Col == 3 }\n        XCTAssertEqual(results.count, 1)\n    }\n\n    func testFilterWithInt32Property() {\n        _ = makeAggregateableObjects()\n        var results = self.realm().objects(CTTAggregateObject.self).filter(\"int32Col = %d\", Int32(0))\n        XCTAssertEqual(results.count, 0)\n        results = self.realm().objects(CTTAggregateObject.self).filter(\"int32Col = %d\", Int32(1))\n        XCTAssertEqual(results.count, 1)\n        results = self.realm().objects(CTTAggregateObject.self).filter(\"int32Col = %d\", Int32(2))\n        XCTAssertEqual(results.count, 1)\n        results = self.realm().objects(CTTAggregateObject.self).filter(\"int32Col = %d\", Int32(3))\n        XCTAssertEqual(results.count, 1)\n\n        results = self.realm().objects(CTTAggregateObject.self).where { $0.int32Col == 0 }\n        XCTAssertEqual(results.count, 0)\n        results = self.realm().objects(CTTAggregateObject.self).where { $0.int32Col == 1 }\n        XCTAssertEqual(results.count, 1)\n        results = self.realm().objects(CTTAggregateObject.self).where { $0.int32Col == 2 }\n        XCTAssertEqual(results.count, 1)\n        results = self.realm().objects(CTTAggregateObject.self).where { $0.int32Col == 3 }\n        XCTAssertEqual(results.count, 1)\n    }\n\n    func testFilterWithInt64Property() {\n        _ = makeAggregateableObjects()\n        var results = self.realm().objects(CTTAggregateObject.self).filter(\"int64Col = %d\", Int64(0))\n        XCTAssertEqual(results.count, 0)\n        results = self.realm().objects(CTTAggregateObject.self).filter(\"int64Col = %d\", Int64(1))\n        XCTAssertEqual(results.count, 1)\n        results = self.realm().objects(CTTAggregateObject.self).filter(\"int64Col = %d\", Int64(2))\n        XCTAssertEqual(results.count, 1)\n        results = self.realm().objects(CTTAggregateObject.self).filter(\"int64Col = %d\", Int64(3))\n        XCTAssertEqual(results.count, 1)\n\n        results = self.realm().objects(CTTAggregateObject.self).where { $0.int64Col == 0 }\n        XCTAssertEqual(results.count, 0)\n        results = self.realm().objects(CTTAggregateObject.self).where { $0.int64Col == 1 }\n        XCTAssertEqual(results.count, 1)\n        results = self.realm().objects(CTTAggregateObject.self).where { $0.int64Col == 2 }\n        XCTAssertEqual(results.count, 1)\n        results = self.realm().objects(CTTAggregateObject.self).where { $0.int64Col == 3 }\n        XCTAssertEqual(results.count, 1)\n    }\n}\n\n// MARK: Results\n\nclass ResultsTests: RealmCollectionTests<Results<CTTNullableStringObjectWithLink>, Results<CTTAggregateObject>> {\n    override class var defaultTestSuite: XCTestSuite {\n        // Don't run tests for the base class\n        if isEqual(ResultsTests.self) {\n            return XCTestSuite(name: \"empty\")\n        }\n        return super.defaultTestSuite\n    }\n\n    func addObjectToResults() {\n        let realm = self.realm()\n        try! realm.write {\n            realm.create(CTTNullableStringObjectWithLink.self, value: [\"a\"])\n        }\n    }\n\n    @MainActor\n    func testNotificationBlockUpdating() {\n        var theExpectation = expectation(description: \"\")\n        var calls = 0\n        let token = collection.observe { (changes: RealmCollectionChange) in\n            switch changes {\n            case .initial(let results):\n                XCTAssertEqual(results.count, calls + 2)\n                XCTAssertEqual(results, self.collection)\n            case .update(let results, _, _, _):\n                XCTAssertEqual(results.count, calls + 2)\n                XCTAssertEqual(results, self.collection)\n            case .error:\n                XCTFail(\"Shouldn't happen\")\n            }\n            calls += 1\n            theExpectation.fulfill()\n        }\n        waitForExpectations(timeout: 1, handler: nil)\n\n        theExpectation = expectation(description: \"\")\n        addObjectToResults()\n        waitForExpectations(timeout: 1, handler: nil)\n\n        token.invalidate()\n    }\n\n    @MainActor\n    func testNotificationBlockChangeIndices() {\n        var theExpectation = expectation(description: \"\")\n        var calls = 0\n        let token = collection.observe { (change: RealmCollectionChange) in\n            switch change {\n            case .initial(let results):\n                XCTAssertEqual(calls, 0)\n                XCTAssertEqual(results.count, 2)\n            case .update(let results, let deletions, let insertions, let modifications):\n                XCTAssertEqual(calls, 1)\n                XCTAssertEqual(results.count, 3)\n                XCTAssertEqual(deletions, [])\n                XCTAssertEqual(insertions, [2])\n                XCTAssertEqual(modifications, [])\n            case .error(let error):\n                XCTFail(String(describing: error))\n            }\n\n            calls += 1\n            theExpectation.fulfill()\n        }\n        waitForExpectations(timeout: 1, handler: nil)\n\n        theExpectation = expectation(description: \"\")\n        addObjectToResults()\n        waitForExpectations(timeout: 1, handler: nil)\n\n        token.invalidate()\n    }\n}\n\nclass ResultsWithCustomInitializerTests: TestCase {\n    func testValueForKey() {\n        let realm = realmWithTestPath()\n        try! realm.write {\n            realm.add(SwiftCustomInitializerObject(stringVal: \"A\"))\n        }\n\n        let collection = realm.objects(SwiftCustomInitializerObject.self)\n        let expected = Array(collection.map { $0.stringCol })\n        let actual = collection.value(forKey: \"stringCol\") as! [String]?\n        XCTAssertEqual(expected, actual!)\n        assertEqual(Array(collection), collection.value(forKey: \"self\") as! [SwiftCustomInitializerObject])\n    }\n}\n\nclass ResultsDistinctTests: TestCase {\n    func testDistinctResultsUsingKeyPaths() {\n        let realm = realmWithTestPath()\n\n        let obj1 = CTTAggregateObject()\n        obj1.intCol = 1\n        obj1.trueCol = true\n        let obj2 = CTTAggregateObject()\n        obj2.intCol = 1\n        obj2.trueCol = true\n        let obj3 = CTTAggregateObject()\n        obj3.intCol = 1\n        obj3.trueCol = false\n        let obj4 = CTTAggregateObject()\n        obj4.intCol = 2\n        obj4.trueCol = false\n\n        let childObj1 = CTTIntegerObject()\n        childObj1.intCol = 1\n        obj1.childIntCol = childObj1\n\n        let childObj2 = CTTIntegerObject()\n        childObj2.intCol = 1\n        obj2.childIntCol = childObj2\n\n        let childObj3 = CTTIntegerObject()\n        childObj3.intCol = 2\n        obj3.childIntCol = childObj3\n\n        try! realm.write {\n            realm.add(obj1)\n            realm.add(obj2)\n            realm.add(obj3)\n            realm.add(obj4)\n        }\n\n        let collection = realm.objects(CTTAggregateObject.self)\n        var distinctResults = collection.distinct(by: [\"intCol\"])\n        var expected = [[\"int\": 1], [\"int\": 2]]\n        var actual = Array(distinctResults.map { [\"int\": $0.intCol] })\n        XCTAssertEqual(expected as NSObject, actual as NSObject)\n        assertEqual(distinctResults.map { $0 }, distinctResults.value(forKey: \"self\") as! [CTTAggregateObject])\n\n        distinctResults = collection.distinct(by: [\"intCol\", \"trueCol\"])\n        expected = [[\"int\": 1, \"true\": 1], [\"int\": 1, \"true\": 0], [\"int\": 2, \"true\": 0]]\n        actual = distinctResults.map { [\"int\": $0.intCol, \"true\": $0.trueCol ? 1 : 0] }\n        XCTAssertEqual(expected as NSObject, actual as NSObject)\n        assertEqual(distinctResults.map { $0 }, distinctResults.value(forKey: \"self\") as! [CTTAggregateObject])\n\n        distinctResults = collection.distinct(by: [\"childIntCol.intCol\"])\n        expected = [[\"int\": 1], [\"int\": 2]]\n        actual = distinctResults.map { [\"int\": $0.childIntCol!.intCol] }\n        XCTAssertEqual(expected as NSObject, actual as NSObject)\n        assertEqual(distinctResults.map { $0 }, distinctResults.value(forKey: \"self\") as! [CTTAggregateObject])\n\n        assertThrows(collection.distinct(by: [\"childCol\"]))\n        assertThrows(collection.distinct(by: [\"@sum.intCol\"]))\n        assertThrows(collection.distinct(by: [\"stringListCol\"]))\n    }\n\n    func testDistinctResultsUsingSwiftKeyPaths() {\n        let realm = realmWithTestPath()\n\n        let obj1 = CTTAggregateObject()\n        obj1.intCol = 1\n        obj1.trueCol = true\n        let obj2 = CTTAggregateObject()\n        obj2.intCol = 1\n        obj2.trueCol = true\n        let obj3 = CTTAggregateObject()\n        obj3.intCol = 1\n        obj3.trueCol = false\n        let obj4 = CTTAggregateObject()\n        obj4.intCol = 2\n        obj4.trueCol = false\n\n        let childObj1 = CTTIntegerObject()\n        childObj1.intCol = 1\n        obj1.childIntCol = childObj1\n\n        let childObj2 = CTTIntegerObject()\n        childObj2.intCol = 1\n        obj2.childIntCol = childObj2\n\n        let childObj3 = CTTIntegerObject()\n        childObj3.intCol = 2\n        obj3.childIntCol = childObj3\n\n        try! realm.write {\n            realm.add(obj1)\n            realm.add(obj2)\n            realm.add(obj3)\n            realm.add(obj4)\n        }\n\n        let collection = realm.objects(CTTAggregateObject.self)\n        var distinctResults = collection.distinct(by: [\\CTTAggregateObject.intCol])\n        var expected = [[\"int\": 1], [\"int\": 2]]\n        var actual = Array(distinctResults.map { [\"int\": $0.intCol] })\n        XCTAssertEqual(expected as NSObject, actual as NSObject)\n        assertEqual(distinctResults.map { $0 }, distinctResults.value(forKey: \"self\") as! [CTTAggregateObject])\n\n        distinctResults = collection.distinct(by: [\\CTTAggregateObject.intCol, \\CTTAggregateObject.trueCol])\n        expected = [[\"int\": 1, \"true\": 1], [\"int\": 1, \"true\": 0], [\"int\": 2, \"true\": 0]]\n        actual = distinctResults.map { [\"int\": $0.intCol, \"true\": $0.trueCol ? 1 : 0] }\n        XCTAssertEqual(expected as NSObject, actual as NSObject)\n        assertEqual(distinctResults.map { $0 }, distinctResults.value(forKey: \"self\") as! [CTTAggregateObject])\n\n        distinctResults = collection.distinct(by: [\\CTTAggregateObject.childIntCol?.intCol])\n        expected = [[\"int\": 1], [\"int\": 2]]\n        actual = distinctResults.map { [\"int\": $0.childIntCol!.intCol] }\n        XCTAssertEqual(expected as NSObject, actual as NSObject)\n        assertEqual(distinctResults.map { $0 }, distinctResults.value(forKey: \"self\") as! [CTTAggregateObject])\n    }\n}\n\nclass ResultsEquatabilityTests: TestCase {\n    func testEquatability() {\n        let realm = realmWithTestPath()\n        try! realm.write {\n            realm.add(SwiftCustomInitializerObject(stringVal: \"A\"))\n        }\n\n        let resultsA = realm.objects(SwiftCustomInitializerObject.self)\n        let resultsB = realm.objects(SwiftCustomInitializerObject.self)\n        XCTAssertNotEqual(resultsA, resultsB)\n        XCTAssertEqual(resultsA, resultsA)\n        XCTAssertEqual(resultsB, resultsB)\n    }\n}\n\nclass ResultsFromTableTests: ResultsTests {\n    override func getCollection(_ realm: Realm) -> Results<CTTNullableStringObjectWithLink> {\n        return realm.objects(CTTNullableStringObjectWithLink.self)\n    }\n\n    override func getAggregateableCollectionInWrite(_ realm: Realm) -> Results<CTTAggregateObject> {\n        _ = makeAggregateableObjectsInWriteTransaction()\n        return realm.objects(CTTAggregateObject.self)\n    }\n}\n\nclass ResultsFromTableViewTests: ResultsTests {\n    override func getCollection(_ realm: Realm) -> Results<CTTNullableStringObjectWithLink> {\n        return realm.objects(CTTNullableStringObjectWithLink.self).filter(\"stringCol != ''\")\n    }\n\n    override func getAggregateableCollectionInWrite(_ realm: Realm) -> Results<CTTAggregateObject> {\n        _ = makeAggregateableObjectsInWriteTransaction()\n        return realm.objects(CTTAggregateObject.self).filter(\"trueCol == true\")\n    }\n}\n\nclass ResultsFromLinkViewTests: ResultsTests {\n    override func getCollection(_ realm: Realm) -> Results<CTTNullableStringObjectWithLink> {\n        let array = realm.create(CTTStringList.self, value: [[str1, str2]])\n        return array.array.filter(NSPredicate(value: true))\n    }\n\n    override func getAggregateableCollectionInWrite(_ realm: Realm) -> Results<CTTAggregateObject> {\n        let list = CTTAggregateObjectList()\n        realm.add(list)\n        list.list.append(objectsIn: makeAggregateableObjectsInWriteTransaction())\n        return list.list.filter(NSPredicate(value: true))\n    }\n\n    override func addObjectToResults() {\n        let realm = self.realm()\n        try! realm.write {\n            let array = realm.objects(CTTStringList.self).last!\n            array.array.append(realm.create(CTTNullableStringObjectWithLink.self, value: [\"a\"]))\n        }\n    }\n}\n\n// MARK: List\n\nclass ListRealmCollectionTests: RealmCollectionTests<List<CTTNullableStringObjectWithLink>, List<CTTAggregateObject>> {\n    override class var defaultTestSuite: XCTestSuite {\n        // Don't run tests for the base class\n        if isEqual(ListRealmCollectionTests.self) {\n            return XCTestSuite(name: \"empty\")\n        }\n        return super.defaultTestSuite\n    }\n\n    override func testDescription() {\n        // swiftlint:disable:next line_length\n        assertMatches(collection.description, \"List<CTTNullableStringObjectWithLink> <0x[0-9a-f]+> \\\\(\\n\\t\\\\[0\\\\] CTTNullableStringObjectWithLink \\\\{\\n\\t\\tstringCol = 1;\\n\\t\\tlinkCol = CTTLinkTarget \\\\{\\n\\t\\t\\tid = 1;\\n\\t\\t\\\\};\\n\\t\\\\},\\n\\t\\\\[1\\\\] CTTNullableStringObjectWithLink \\\\{\\n\\t\\tstringCol = 2;\\n\\t\\tlinkCol = CTTLinkTarget \\\\{\\n\\t\\t\\tid = 1;\\n\\t\\t\\\\};\\n\\t\\\\}\\n\\\\)\")\n    }\n}\n\nclass ListUnmanagedRealmCollectionTests: ListRealmCollectionTests {\n    override func getCollection(_ realm: Realm) -> List<CTTNullableStringObjectWithLink> {\n        return CTTStringList(value: [[str1, str2]]).array\n    }\n\n    override func getAggregateableCollectionInWrite(_ realm: Realm) -> List<CTTAggregateObject> {\n        return CTTAggregateObjectList(value: [makeAggregateableObjectsInWriteTransaction()]).list\n    }\n\n    override func testRealm() {\n        XCTAssertNil(collection.realm)\n    }\n\n    override func testCount() {\n        XCTAssertEqual(2, collection.count)\n    }\n\n    override func testIndexOfObject() {\n        XCTAssertEqual(0, collection.index(of: str1)!)\n        XCTAssertEqual(1, collection.index(of: str2)!)\n    }\n\n    override func testSortWithDescriptor() {\n        let collection = getAggregateableCollection()\n        assertThrows(collection.sorted(by: [SortDescriptor(keyPath: \"intCol\", ascending: true)]))\n        assertThrows(collection.sorted(by: [SortDescriptor(keyPath: \"doubleCol\", ascending: false),\n            SortDescriptor(keyPath: \"intCol\", ascending: false)]))\n    }\n\n    override func testSortWithDescriptorBySwiftKeyPath() {\n        let collection = getAggregateableCollection()\n        assertThrows(collection.sorted(by: [SortDescriptor(keyPath: \\CTTAggregateObject.intCol, ascending: true)]))\n        assertThrows(collection.sorted(by: [SortDescriptor(keyPath: \\CTTAggregateObject.doubleCol, ascending: false),\n            SortDescriptor(keyPath: \"intCol\", ascending: false)]))\n    }\n\n    override func testFastEnumerationWithMutation() {\n        // No standalone removal interface provided on RealmCollectionType\n    }\n\n    override func testFirst() {\n        XCTAssertEqual(str1, collection.first!)\n    }\n\n    override func testLast() {\n        XCTAssertEqual(str2, collection.last!)\n    }\n\n    // MARK: Things not implemented in standalone\n\n    override func testSortWithProperty() {\n        assertThrows(collection.sorted(byKeyPath: \"stringCol\", ascending: true))\n        assertThrows(collection.sorted(byKeyPath: \"noSuchCol\", ascending: true))\n    }\n\n    override func testSortWithSwiftKeyPath() {\n        assertThrows(collection.sorted(by: \\.stringCol, ascending: true))\n    }\n\n    override func testFilterFormat() {\n        assertThrows(collection.filter(\"stringCol = '1'\"))\n        assertThrows(collection.filter(\"noSuchCol = '1'\"))\n        assertThrows(collection.where { $0.stringCol == \"1\" })\n    }\n\n    override func testFilterPredicate() {\n        let pred1 = NSPredicate(format: \"stringCol = '1'\")\n        let pred2 = NSPredicate(format: \"noSuchCol = '2'\")\n\n        assertThrows(collection.filter(pred1))\n        assertThrows(collection.filter(pred2))\n    }\n\n    override func testFilterWithAnyVarags() {\n        // Functionality not supported for standalone lists; don't test.\n    }\n\n    override func testArrayAggregateWithSwiftObjectDoesntThrow() {\n        assertThrows(collection.filter(\"ANY stringListCol == %@\", CTTNullableStringObjectWithLink()))\n    }\n\n    override func testObserve() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    override func testCancelTaskForObservationInit() async throws {}\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    override func testObserveOnActor() async throws {}\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    override func testObserveInsideActor() async throws {}\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    override func testObserveOnActorWithStringKeyPath() async throws {}\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    override func testObserveOnActorWithKeyPath() async throws {}\n\n    override func testObserveKeyPath() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    override func testObserveKeyPathNoChange() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    override func testObserveKeyPathWithLink() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    override func testObserveKeyPathWithLinkNoChange() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    override func testObserveKeyPathWithLinkNoChangeList() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    override func testObservePartialKeyPath() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    override func testObservePartialKeyPathNoChange() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    override func testObservePartialKeyPathWithLink() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    override func testObservePartialKeyPathWithLinkNoChangeList() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    override func testObserveOnQueue() {\n        assertThrows(collection.observe(on: DispatchQueue(label: \"bg\")) { _ in })\n    }\n\n    func testFreeze() {\n        assertThrows(collection.freeze(),\n                     reason: \"This method may only be called on RLMArray instances retrieved from an RLMRealm\")\n    }\n\n    override func testIsFrozen() {\n        XCTAssertFalse(collection.isFrozen)\n    }\n\n    override func testThaw() {}\n    override func testThawFromDifferentThread() {}\n    override func testThawPreviousVersion() {}\n    override func testThawDeletedParent() {}\n    override func testThawUpdatedOnDifferentThread() {}\n    override func testFreezeFromWrongThread() {}\n    override func testAccessFrozenCollectionFromDifferentThread() {}\n    override func testObserveFrozenCollection() {}\n    override func testQueryFrozenCollection() {}\n}\n\nclass ListNewlyAddedRealmCollectionTests: ListRealmCollectionTests {\n    override func getCollection(_ realm: Realm) -> List<CTTNullableStringObjectWithLink> {\n        let array = CTTStringList(value: [[str1, str2]])\n        realm.add(array)\n        return array.array\n    }\n\n    override func getAggregateableCollectionInWrite(_ realm: Realm) -> List<CTTAggregateObject> {\n        let list = CTTAggregateObjectList(value: [makeAggregateableObjectsInWriteTransaction()])\n        realm.add(list)\n        return list.list\n    }\n}\n\nclass ListNewlyCreatedRealmCollectionTests: ListRealmCollectionTests {\n    override func getCollection(_ realm: Realm) -> List<CTTNullableStringObjectWithLink> {\n        realm.create(CTTStringList.self, value: [[str1, str2]]).array\n    }\n\n    override func getAggregateableCollectionInWrite(_ realm: Realm) -> List<CTTAggregateObject> {\n        realm.create(CTTAggregateObjectList.self,\n                     value: [makeAggregateableObjectsInWriteTransaction()]).list\n    }\n}\n\nclass ListRetrievedRealmCollectionTests: ListRealmCollectionTests {\n    override func getCollection(_ realm: Realm) -> List<CTTNullableStringObjectWithLink> {\n        _ = realm.create(CTTStringList.self, value: [[str1, str2]])\n        return realm.objects(CTTStringList.self).first!.array\n    }\n\n    override func getAggregateableCollectionInWrite(_ realm: Realm) -> List<CTTAggregateObject> {\n        _ = realm.create(CTTAggregateObjectList.self,\n                         value: [makeAggregateableObjectsInWriteTransaction()])\n        return realm.objects(CTTAggregateObjectList.self).first!.list\n    }\n}\n\n// MARK: MutableSet\n\nclass MutableSetRealmCollectionTests: RealmCollectionTests<MutableSet<CTTNullableStringObjectWithLink>, MutableSet<CTTAggregateObject>> {\n    override class var defaultTestSuite: XCTestSuite {\n        // Don't run tests for the base class\n        if isEqual(MutableSetRealmCollectionTests.self) {\n            return XCTestSuite(name: \"empty\")\n        }\n        return super.defaultTestSuite\n    }\n\n    // Tests which don't apply to Set\n    override func testIndexOfObject() { }\n    override func testIndexOfFormat() { }\n    override func testIndexOfPredicate() { }\n    override func testIndexOfQuery() {}\n\n    // These can give any object in the Set\n    override func testFirst() {\n        let first = collection.first!\n        XCTAssert(first.isSameObject(as: str1) || first.isSameObject(as: str2))\n    }\n\n    override func testLast() {\n        let last = collection.last!\n        XCTAssert(last.isSameObject(as: str1) || last.isSameObject(as: str2))\n    }\n\n    override func testValueForKey() {\n        let expected = Set(collection.map { $0.stringCol })\n        let actual = collection.value(forKey: \"stringCol\") as Any? as! Set<String>?\n        XCTAssertEqual(expected, actual!)\n        let actual2 = collection.value(forKey: \"stringCol\") as [AnyObject] as! [String]\n        XCTAssertEqual(expected, Set(actual2))\n        // comparing value(forKey: \"self\") won't work because an NSSet will be produced, we don't know\n        // the order of the objects and using [NSSet contains] won't work for a linked object.\n    }\n\n    override func testValueForKeyPath() {\n        let collection = getAggregateableCollection()\n        XCTAssertEqual(3, (collection.value(forKeyPath: \"@count\") as! NSNumber?)?.int64Value)\n        XCTAssertEqual(3, (collection.value(forKeyPath: \"@max.intCol\") as! NSNumber?)?.int64Value)\n        XCTAssertEqual(1, (collection.value(forKeyPath: \"@min.intCol\") as! NSNumber?)?.int64Value)\n        XCTAssertEqual(6, (collection.value(forKeyPath: \"@sum.intCol\") as! NSNumber?)?.int64Value)\n        XCTAssertEqual(2.0, (collection.value(forKeyPath: \"@avg.intCol\") as! NSNumber?)?.doubleValue)\n    }\n\n    override func testAccessFrozenCollectionFromDifferentThread() {\n        nonisolated(unsafe) let frozen = collection.freeze()\n        dispatchSyncNewThread {\n            let o = frozen.map { $0.stringCol }\n            XCTAssertTrue(o.contains(\"1\"))\n            XCTAssertTrue(o.contains(\"2\"))\n        }\n    }\n\n    override func testFastEnumeration() {\n        var str = \"\"\n        for obj in collection {\n            str += obj.stringCol!\n        }\n\n        XCTAssertTrue((str == \"12\") || (str == \"21\"))\n    }\n\n    override func testDescription() {\n        // ordering is not guaranteed, so handle that the objects could be in any position\n        // swiftlint:disable:next line_length\n        assertMatches(collection.description, \"MutableSet<CTTNullableStringObjectWithLink> <0x[0-9a-f]+> \\\\(\\n\\t\\\\[0\\\\] CTTNullableStringObjectWithLink \\\\{\\n\\t\\tstringCol = [0-9]+;\\n\\t\\tlinkCol = CTTLinkTarget \\\\{\\n\\t\\t\\tid = 1;\\n\\t\\t\\\\};\\n\\t\\\\},\\n\\t\\\\[1\\\\] CTTNullableStringObjectWithLink \\\\{\\n\\t\\tstringCol = [0-9]+;\\n\\t\\tlinkCol = CTTLinkTarget \\\\{\\n\\t\\t\\tid = 1;\\n\\t\\t\\\\};\\n\\t\\\\}\\n\\\\)\")\n    }\n}\n\nclass MutableSetUnmanagedRealmCollectionTests: MutableSetRealmCollectionTests {\n    override func getCollection(_ realm: Realm) -> MutableSet<CTTNullableStringObjectWithLink> {\n        return CTTStringSet(value: [[str1, str2]]).set\n    }\n\n    override func getAggregateableCollectionInWrite(_ realm: Realm) -> MutableSet<CTTAggregateObject> {\n        return CTTAggregateObjectSet(value: [makeAggregateableObjectsInWriteTransaction()]).set\n    }\n\n    override func testRealm() {\n        XCTAssertNil(collection.realm)\n    }\n\n    override func testCount() {\n        XCTAssertEqual(2, collection.count)\n    }\n\n    override func testSortWithDescriptor() {\n        let collection = getAggregateableCollection()\n        assertThrows(collection.sorted(by: [SortDescriptor(keyPath: \"intCol\", ascending: true)]))\n        assertThrows(collection.sorted(by: [SortDescriptor(keyPath: \"doubleCol\", ascending: false),\n            SortDescriptor(keyPath: \"intCol\", ascending: false)]))\n    }\n\n    override func testSortWithDescriptorBySwiftKeyPath() {\n        let collection = getAggregateableCollection()\n        assertThrows(collection.sorted(by: [SortDescriptor(keyPath: \\CTTAggregateObject.intCol, ascending: true)]))\n        assertThrows(collection.sorted(by: [SortDescriptor(keyPath: \\CTTAggregateObject.doubleCol, ascending: false),\n            SortDescriptor(keyPath: \\CTTAggregateObject.intCol, ascending: false)]))\n    }\n\n    override func testFastEnumerationWithMutation() {\n        // No standalone removal interface provided on RealmCollectionType\n    }\n\n    // MARK: Things not implemented in standalone\n\n    override func testSortWithProperty() {\n        assertThrows(collection.sorted(byKeyPath: \"stringCol\", ascending: true))\n        assertThrows(collection.sorted(byKeyPath: \"noSuchCol\", ascending: true))\n    }\n\n    override func testSortWithSwiftKeyPath() {\n        assertThrows(collection.sorted(by: \\.stringCol, ascending: true))\n    }\n\n    override func testFilterFormat() {\n        assertThrows(collection.filter(\"stringCol = '1'\"))\n        assertThrows(collection.filter(\"noSuchCol = '1'\"))\n    }\n\n    override func testFilterPredicate() {\n        let pred1 = NSPredicate(format: \"stringCol = '1'\")\n        let pred2 = NSPredicate(format: \"noSuchCol = '2'\")\n\n        assertThrows(collection.filter(pred1))\n        assertThrows(collection.filter(pred2))\n    }\n\n    override func testFilterWithAnyVarags() {\n        // Functionality not supported for standalone lists; don't test.\n    }\n\n    override func testArrayAggregateWithSwiftObjectDoesntThrow() {\n        assertThrows(collection.filter(\"ANY stringListCol == %@\", CTTNullableStringObjectWithLink()))\n    }\n\n    override func testObserve() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    override func testCancelTaskForObservationInit() async throws {}\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    override func testObserveOnActor() async throws {}\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    override func testObserveInsideActor() async throws {}\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    override func testObserveOnActorWithStringKeyPath() async throws {}\n    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n    override func testObserveOnActorWithKeyPath() async throws {}\n\n    override func testObserveOnQueue() {\n        assertThrows(collection.observe(on: DispatchQueue(label: \"bg\")) { _ in })\n    }\n\n    override func testObserveKeyPath() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    override func testObserveKeyPathNoChange() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    override func testObserveKeyPathWithLink() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    override func testObserveKeyPathWithLinkNoChange() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    override func testObserveKeyPathWithLinkNoChangeList() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    override func testObservePartialKeyPath() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    override func testObservePartialKeyPathNoChange() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    override func testObservePartialKeyPathWithLink() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    override func testObservePartialKeyPathWithLinkNoChangeList() {\n        assertThrows(collection.observe { _ in })\n    }\n\n    func testFreeze() {\n        assertThrows(collection.freeze(),\n                     reason: \"This method may only be called on RLMSet instances retrieved from an RLMRealm\")\n    }\n\n    override func testIsFrozen() {\n        XCTAssertFalse(collection.isFrozen)\n    }\n\n    override func testThaw() {}\n    override func testThawFromDifferentThread() {}\n    override func testThawPreviousVersion() {}\n    override func testThawDeletedParent() {}\n    override func testThawUpdatedOnDifferentThread() {}\n    override func testFreezeFromWrongThread() {}\n    override func testAccessFrozenCollectionFromDifferentThread() {}\n    override func testObserveFrozenCollection() {}\n    override func testQueryFrozenCollection() {}\n}\n\nclass MutableSetNewlyAddedRealmCollectionTests: MutableSetRealmCollectionTests {\n    override func getCollection(_ realm: Realm) -> MutableSet<CTTNullableStringObjectWithLink> {\n        let set = CTTStringSet(value: [[str1, str2]])\n        realm.add(set)\n        return set.set\n    }\n\n    override func getAggregateableCollectionInWrite(_ realm: Realm) -> MutableSet<CTTAggregateObject> {\n        let set = CTTAggregateObjectSet(value: [makeAggregateableObjectsInWriteTransaction()])\n        realm.add(set)\n        return set.set\n    }\n}\n\nclass MutableSetNewlyCreatedRealmCollectionTests: MutableSetRealmCollectionTests {\n    override func getCollection(_ realm: Realm) -> MutableSet<CTTNullableStringObjectWithLink> {\n        realm.create(CTTStringSet.self, value: [[str1, str2]]).set\n    }\n\n    override func getAggregateableCollectionInWrite(_ realm: Realm) -> MutableSet<CTTAggregateObject> {\n        realm.create(CTTAggregateObjectSet.self,\n                     value: [makeAggregateableObjectsInWriteTransaction()]).set\n    }\n}\n\nclass MutableSetRetrievedRealmCollectionTests: MutableSetRealmCollectionTests {\n    override func getCollection(_ realm: Realm) -> MutableSet<CTTNullableStringObjectWithLink> {\n        _ = realm.create(CTTStringSet.self, value: [[str1, str2]])\n        return realm.objects(CTTStringSet.self).first!.set\n    }\n\n    override func getAggregateableCollectionInWrite(_ realm: Realm) -> MutableSet<CTTAggregateObject> {\n        _ = realm.create(CTTAggregateObjectSet.self,\n                         value: [makeAggregateableObjectsInWriteTransaction()])\n        return realm.objects(CTTAggregateObjectSet.self).first!.set\n    }\n}\nclass LinkingObjectsCollectionTypeTests: RealmCollectionTests<LinkingObjects<CTTNullableStringObjectWithLink>, LinkingObjects<CTTAggregateObject>> {\n    override func getCollection(_ realm: Realm) -> LinkingObjects<CTTNullableStringObjectWithLink> {\n        let target = realm.create(CTTLinkTarget.self, value: [0])\n        for object in realm.objects(CTTNullableStringObjectWithLink.self) {\n            object.linkCol = target\n        }\n        return target.stringObjects\n    }\n\n    override func getAggregateableCollectionInWrite(_ realm: Realm) -> LinkingObjects<CTTAggregateObject> {\n        let objects = makeAggregateableObjectsInWriteTransaction()\n        let target = realm.create(CTTLinkTarget.self, value: [0])\n        for object in objects {\n            object.linkCol = target\n        }\n        return target.aggregateObjects\n    }\n\n    override func testDescription() {\n        // swiftlint:disable:next line_length\n        assertMatches(collection.description, \"LinkingObjects<CTTNullableStringObjectWithLink> <0x[0-9a-f]+> \\\\(\\n\\t\\\\[0\\\\] CTTNullableStringObjectWithLink \\\\{\\n\\t\\tstringCol = 1;\\n\\t\\tlinkCol = CTTLinkTarget \\\\{\\n\\t\\t\\tid = 0;\\n\\t\\t\\\\};\\n\\t\\\\},\\n\\t\\\\[1\\\\] CTTNullableStringObjectWithLink \\\\{\\n\\t\\tstringCol = 2;\\n\\t\\tlinkCol = CTTLinkTarget \\\\{\\n\\t\\t\\tid = 0;\\n\\t\\t\\\\};\\n\\t\\\\}\\n\\\\)\")\n    }\n}\n\nclass LinkingObjectsEquatabilityTests: TestCase {\n    func testEquatability() {\n        let realm = realmWithTestPath()\n\n        var parentA: CTTLinkTarget!\n        var parentB: CTTLinkTarget!\n\n        try! realm.write {\n            parentA = realm.create(CTTLinkTarget.self, value: [0])\n            parentB = realm.create(CTTLinkTarget.self, value: [0])\n\n            let targetA = realm.create(CTTNullableStringObjectWithLink.self)\n            let targetB = realm.create(CTTNullableStringObjectWithLink.self)\n\n            targetA.linkCol = parentA\n            targetB.linkCol = parentB\n        }\n\n        XCTAssertNotEqual(parentA.stringObjects, parentA.stringObjects)\n        XCTAssertNotEqual(parentA.stringObjects, parentB.stringObjects)\n\n        let ref = parentA.stringObjects\n        XCTAssertEqual(ref, ref)\n    }\n}\n\n\nclass AnyRealmCollectionTests: RealmCollectionTests<AnyRealmCollection<CTTNullableStringObjectWithLink>, AnyRealmCollection<CTTAggregateObject>> {\n    override func getCollection(_ realm: Realm) -> AnyRealmCollection<CTTNullableStringObjectWithLink> {\n        AnyRealmCollection(realm.create(CTTStringList.self, value: [[str1, str2]]).array)\n    }\n\n    override func getAggregateableCollectionInWrite(_ realm: Realm) -> AnyRealmCollection<CTTAggregateObject> {\n        AnyRealmCollection(realm.create(CTTAggregateObjectSet.self,\n                                        value: [makeAggregateableObjectsInWriteTransaction()]).set)\n    }\n\n    override func testDescription() {\n        // swiftlint:disable:next line_length\n        assertMatches(collection.description, \"AnyRealmCollection<CTTNullableStringObjectWithLink> <0x[0-9a-f]+> \\\\(\\n\\t\\\\[0\\\\] CTTNullableStringObjectWithLink \\\\{\\n\\t\\tstringCol = 1;\\n\\t\\tlinkCol = CTTLinkTarget \\\\{\\n\\t\\t\\tid = 1;\\n\\t\\t\\\\};\\n\\t\\\\},\\n\\t\\\\[1\\\\] CTTNullableStringObjectWithLink \\\\{\\n\\t\\tstringCol = 2;\\n\\t\\tlinkCol = CTTLinkTarget \\\\{\\n\\t\\t\\tid = 1;\\n\\t\\t\\\\};\\n\\t\\\\}\\n\\\\)\")\n    }\n}\n\nclass AnyRealmCollectionEquatabilityTests: TestCase {\n    func testEquatability() {\n        let realm = realmWithTestPath()\n        try! realm.write {\n            realm.add(SwiftCustomInitializerObject(stringVal: \"A\"))\n            realm.add(SwiftListObject(value: [\"int\": [1, 2, 3]]))\n            realm.add(SwiftListObject(value: [\"int\": [1, 2, 3]]))\n        }\n\n        let resultsA = AnyRealmCollection(realm.objects(SwiftCustomInitializerObject.self))\n        let resultsB = AnyRealmCollection(realm.objects(SwiftCustomInitializerObject.self))\n        XCTAssertNotEqual(resultsA, resultsB)\n        XCTAssertEqual(resultsA, resultsA)\n        XCTAssertEqual(resultsB, resultsB)\n\n        let listResultsA = realm.objects(SwiftListObject.self)[0]\n        let listResultsB = realm.objects(SwiftListObject.self)[1]\n\n        let listA = AnyRealmCollection(listResultsA.int)\n        let listB = AnyRealmCollection(listResultsB.int)\n        XCTAssertNotEqual(listA, listB)\n        XCTAssertEqual(listA, listA)\n        XCTAssertEqual(listB, listB)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/RealmConfigurationTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\nimport class Realm.Private.RLMRealmConfiguration\n\nclass RealmConfigurationTests: TestCase {\n    func testDefaultConfiguration() {\n        let defaultConfiguration = Realm.Configuration.defaultConfiguration\n\n        XCTAssertEqual(defaultConfiguration.fileURL, try! Realm().configuration.fileURL)\n        XCTAssertNil(defaultConfiguration.inMemoryIdentifier)\n        XCTAssertNil(defaultConfiguration.encryptionKey)\n        XCTAssertFalse(defaultConfiguration.readOnly)\n        XCTAssertEqual(defaultConfiguration.schemaVersion, 0)\n        XCTAssert(defaultConfiguration.migrationBlock == nil)\n    }\n\n    func testSetDefaultConfiguration() {\n        let fileURL = Realm.Configuration.defaultConfiguration.fileURL\n        let configuration = Realm.Configuration(fileURL: URL(fileURLWithPath: \"/dev/null\"))\n        Realm.Configuration.defaultConfiguration = configuration\n        XCTAssertEqual(Realm.Configuration.defaultConfiguration.fileURL, URL(fileURLWithPath: \"/dev/null\"))\n        Realm.Configuration.defaultConfiguration.fileURL = fileURL\n    }\n\n    func testCannotSetMutuallyExclusiveProperties() {\n        var configuration = Realm.Configuration()\n        configuration.readOnly = true\n        configuration.deleteRealmIfMigrationNeeded = true\n        assertThrows(try! Realm(configuration: configuration),\n                     reason: \"Cannot set `deleteRealmIfMigrationNeeded` when `readOnly` is set.\")\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/RealmPropertyTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport Realm\nimport RealmSwift\n\nclass RealmPropertyObject: Object {\n    var optionalIntValue = RealmProperty<Int?>()\n    var optionalInt8Value = RealmProperty<Int8?>()\n    var optionalInt16Value = RealmProperty<Int16?>()\n    var optionalInt32Value = RealmProperty<Int32?>()\n    var optionalInt64Value = RealmProperty<Int64?>()\n    var optionalFloatValue = RealmProperty<Float?>()\n    var optionalDoubleValue = RealmProperty<Double?>()\n    var optionalBoolValue = RealmProperty<Bool?>()\n    // required for schema validation, but not used in tests.\n    @objc dynamic var int = 0\n}\n\nclass RealmPropertyTests: TestCase {\n    private func test<T: Equatable>(keyPath: KeyPath<RealmPropertyObject, RealmProperty<T?>>,\n                                    value: T?) {\n        let o = RealmPropertyObject()\n        o[keyPath: keyPath].value = value\n        XCTAssertEqual(o[keyPath: keyPath].value, value)\n        o[keyPath: keyPath].value = nil\n        XCTAssertNil(o[keyPath: keyPath].value)\n        let realm = realmWithTestPath()\n        try! realm.write {\n            realm.add(o)\n        }\n        XCTAssertNil(o[keyPath: keyPath].value)\n        try! realm.write {\n            o[keyPath: keyPath].value = value\n        }\n        XCTAssertEqual(o[keyPath: keyPath].value, value)\n    }\n\n    func testObject() {\n        test(keyPath: \\.optionalIntValue, value: 123456)\n        test(keyPath: \\.optionalInt8Value, value: 127 as Int8)\n        test(keyPath: \\.optionalInt16Value, value: 32766 as Int16)\n        test(keyPath: \\.optionalInt32Value, value: 2147483647 as Int32)\n        test(keyPath: \\.optionalInt64Value, value: 0x7FFFFFFFFFFFFFFF as Int64)\n        test(keyPath: \\.optionalFloatValue, value: 12345.6789 as Float)\n        test(keyPath: \\.optionalDoubleValue, value: 12345.6789 as Double)\n        test(keyPath: \\.optionalBoolValue, value: true)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/RealmSwiftTests-BridgingHeader.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"TestUtils.h\"\n#import \"RLMAssertions.h\"\n#import \"RLMTestCase.h\"\n"
  },
  {
    "path": "RealmSwift/Tests/RealmTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#if DEBUG\n    @testable import RealmSwift\n#else\n    import RealmSwift\n#endif\nimport Foundation\nimport Realm\nimport XCTest\n\n#if canImport(RealmSwiftTestSupport)\nimport RealmSwiftTestSupport\n#endif\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass RealmTests: TestCase {\n    enum TestError: Error {\n        case intentional\n    }\n\n    func testFileURL() {\n        XCTAssertEqual(try! Realm(fileURL: testRealmURL()).configuration.fileURL,\n                       testRealmURL())\n    }\n\n    func testReadOnly() {\n        autoreleasepool {\n            XCTAssertEqual(try! Realm().configuration.readOnly, false)\n\n            try! Realm().write {\n                try! Realm().create(SwiftIntObject.self, value: [100])\n            }\n        }\n        let config = Realm.Configuration(fileURL: defaultRealmURL(), readOnly: true)\n        let readOnlyRealm = try! Realm(configuration: config)\n        XCTAssertEqual(true, readOnlyRealm.configuration.readOnly)\n        XCTAssertEqual(1, readOnlyRealm.objects(SwiftIntObject.self).count)\n\n        assertThrows(try! Realm(), \"Realm has different readOnly settings\")\n    }\n\n    func testOpeningInvalidPathThrows() {\n        let url = URL(fileURLWithPath: \"/dev/null/foo\")\n        assertFails(.fileOperationFailed, url.appendingPathExtension(\"lock\"),\n                    \"Failed to open file at path '\\(url.path).lock': parent path is not a directory\") {\n            try Realm(configuration: .init(fileURL: url))\n        }\n    }\n\n    func testReadOnlyFile() throws {\n        autoreleasepool {\n            let realm = try! Realm(fileURL: testRealmURL())\n            try! realm.write {\n                realm.create(SwiftStringObject.self, value: [\"a\"])\n            }\n        }\n\n        let fileManager = FileManager.default\n        try! fileManager.setAttributes([FileAttributeKey.immutable: true],\n                                       ofItemAtPath: testRealmURL().path)\n\n        // Should not be able to open read-write\n        assertFails(.filePermissionDenied, testRealmURL(),\n                    \"Failed to open Realm file at path '\\(testRealmURL().path)': Operation not permitted. Please use a path where your app has read-write permissions.\") {\n            try Realm(fileURL: testRealmURL())\n        }\n\n        assertSucceeds {\n            let realm = try Realm(configuration:\n                                    Realm.Configuration(fileURL: testRealmURL(), readOnly: true))\n            XCTAssertEqual(1, realm.objects(SwiftStringObject.self).count)\n        }\n\n        try! fileManager.setAttributes([FileAttributeKey.immutable: false],\n                                       ofItemAtPath: testRealmURL().path)\n    }\n\n    func testReadOnlyRealmMustExist() {\n        assertFails(.fileNotFound, defaultRealmURL(),\n                    \"Failed to open Realm file at path '\\(defaultRealmURL().path)': No such file or directory\") {\n            try Realm(configuration:\n                        Realm.Configuration(fileURL: defaultRealmURL(), readOnly: true))\n        }\n    }\n\n    func testFilePermissionDenied() {\n        autoreleasepool {\n            _ = try! Realm(fileURL: testRealmURL())\n        }\n\n        // Make Realm at test path temporarily unreadable\n        let fileManager = FileManager.default\n        let permissions = try! fileManager\n            .attributesOfItem(atPath: testRealmURL().path)[FileAttributeKey.posixPermissions] as! NSNumber\n        try! fileManager.setAttributes([FileAttributeKey.posixPermissions: 0000],\n                                       ofItemAtPath: testRealmURL().path)\n\n        assertFails(.filePermissionDenied, testRealmURL(), \"Failed to open Realm file at path '\\(testRealmURL().path)': Permission denied. Please use a path where your app has read-write permissions.\") {\n            try Realm(fileURL: testRealmURL())\n        }\n\n        try! fileManager.setAttributes([FileAttributeKey.posixPermissions: permissions], ofItemAtPath: testRealmURL().path)\n    }\n\n#if !SWIFT_PACKAGE && DEBUG\n    func testUnsupportedFileFormatVersion() {\n        let config = Realm.Configuration.defaultConfiguration\n        let bundledRealmPath = Bundle(for: RealmTests.self).path(forResource: \"fileformat-pre-null.realm\",\n                                                                 ofType: nil)!\n        try! FileManager.default.copyItem(atPath: bundledRealmPath, toPath: config.fileURL!.path)\n        assertFails(.unsupportedFileFormatVersion, \"Database has an unsupported version (2) and cannot be upgraded\") {\n            try Realm(configuration: config)\n        }\n    }\n\n    func testFileFormatUpgradeRequiredButDisabled() {\n        var config = Realm.Configuration.defaultConfiguration\n        let bundledRealmPath = Bundle(for: RealmTests.self).path(forResource: \"file-format-version-21.realm\",\n                                                                 ofType: nil)!\n        try! FileManager.default.copyItem(atPath: bundledRealmPath, toPath: config.fileURL!.path)\n        config.disableFormatUpgrade = true\n        assertFails(.fileFormatUpgradeRequired, \"Database upgrade required but prohibited.\") {\n            try Realm(configuration: config)\n        }\n    }\n#endif\n\n    func testSchema() {\n        let schema = try! Realm().schema\n        XCTAssert(schema as AnyObject is Schema)\n        XCTAssertEqual(1, schema.objectSchema.filter({ $0.className == \"SwiftStringObject\" }).count)\n    }\n\n    func testIsEmpty() {\n        let realm = try! Realm()\n        XCTAssert(realm.isEmpty, \"Realm should be empty on creation.\")\n\n        realm.beginWrite()\n        realm.create(SwiftStringObject.self, value: [\"a\"])\n        XCTAssertFalse(realm.isEmpty, \"Realm should not be empty within a write transaction after adding an object.\")\n        realm.cancelWrite()\n\n        XCTAssertTrue(realm.isEmpty, \"Realm should be empty after canceling a write transaction that added an object.\")\n\n        realm.beginWrite()\n        realm.create(SwiftStringObject.self, value: [\"a\"])\n        try! realm.commitWrite()\n        XCTAssertFalse(realm.isEmpty,\n                       \"Realm should not be empty after committing a write transaction that added an object.\")\n    }\n\n    func testInit() {\n        XCTAssertEqual(try! Realm(fileURL: testRealmURL()).configuration.fileURL,\n                       testRealmURL())\n    }\n\n    func testInitFailable() {\n        FileManager.default.createFile(atPath: defaultRealmURL().path,\n                                       contents: \"a\".data(using: String.Encoding.utf8, allowLossyConversion: false),\n                                       attributes: nil)\n\n        assertFails(.invalidDatabase, defaultRealmURL(),\n                    \"Failed to open Realm file at path '\\(defaultRealmURL().path)': file is non-empty but too small (1 bytes) to be a valid Realm.\") {\n            _ = try Realm()\n        }\n    }\n\n    func testInitInMemory() {\n        autoreleasepool {\n            let realm = inMemoryRealm(\"identifier\")\n            try! realm.write {\n                realm.create(SwiftIntObject.self, value: [1])\n                return\n            }\n        }\n        let realm = inMemoryRealm(\"identifier\")\n        XCTAssertEqual(realm.objects(SwiftIntObject.self).count, 0)\n\n        try! realm.write {\n            realm.create(SwiftIntObject.self, value: [1])\n            XCTAssertEqual(realm.objects(SwiftIntObject.self).count, 1)\n\n            inMemoryRealm(\"identifier\").create(SwiftIntObject.self, value: [1])\n            XCTAssertEqual(realm.objects(SwiftIntObject.self).count, 2)\n        }\n\n        let realm2 = inMemoryRealm(\"identifier2\")\n        XCTAssertEqual(realm2.objects(SwiftIntObject.self).count, 0)\n    }\n\n    func testInitCustomClassList() {\n        let configuration = Realm.Configuration(fileURL: Realm.Configuration.defaultConfiguration.fileURL,\n                                                objectTypes: [\n                                                    EmbeddedTreeObject1.self,\n                                                    EmbeddedTreeObject2.self,\n                                                    EmbeddedTreeObject3.self,\n                                                    EmbeddedParentObject.self,\n                                                    SwiftStringObject.self\n                                                ])\n        let sorted = configuration.objectTypes!.sorted { $0.className() < $1.className() }\n        XCTAssertTrue(sorted[0] is EmbeddedParentObject.Type)\n        XCTAssertTrue(sorted[1] is EmbeddedTreeObject1.Type)\n        XCTAssertTrue(sorted[2] is EmbeddedTreeObject2.Type)\n        XCTAssertTrue(sorted[3] is EmbeddedTreeObject3.Type)\n        XCTAssertTrue(sorted[4] is SwiftStringObject.Type)\n\n        let realm = try! Realm(configuration: configuration)\n        XCTAssertEqual([\"EmbeddedParentObject\", \"EmbeddedTreeObject1\", \"EmbeddedTreeObject2\", \"EmbeddedTreeObject3\", \"SwiftStringObject\"],\n                       realm.schema.objectSchema.map { $0.className }.sorted())\n    }\n\n    func testWrite() {\n        try! Realm().write {\n            self.assertThrows(try! Realm().beginWrite())\n            self.assertThrows(try! Realm().write { })\n            try! Realm().create(SwiftStringObject.self, value: [\"1\"])\n            XCTAssertEqual(try! Realm().objects(SwiftStringObject.self).count, 1)\n        }\n        XCTAssertEqual(try! Realm().objects(SwiftStringObject.self).count, 1)\n    }\n\n    func testDynamicWrite() {\n        try! Realm().write {\n            self.assertThrows(try! Realm().beginWrite())\n            self.assertThrows(try! Realm().write { })\n            try! Realm().dynamicCreate(\"SwiftStringObject\", value: [\"1\"])\n            XCTAssertEqual(try! Realm().objects(SwiftStringObject.self).count, 1)\n        }\n        XCTAssertEqual(try! Realm().objects(SwiftStringObject.self).count, 1)\n    }\n\n    func testWriteWithoutNotifying() {\n        let realm = try! Realm()\n        let token = realm.observe { _, _ in\n            XCTFail(\"should not have been called\")\n        }\n\n        try! realm.write(withoutNotifying: [token]) {\n            realm.deleteAll()\n        }\n\n        // local realm notifications are called synchronously so no need to wait for anything\n        token.invalidate()\n    }\n\n    func testDynamicWriteSubscripting() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let object = realm.dynamicCreate(\"SwiftStringObject\", value: [\"1\"])\n        try! realm.commitWrite()\n\n        XCTAssertNotNil(object, \"Dynamic Object Creation Failed\")\n\n        let stringVal = object[\"stringCol\"] as! String\n        XCTAssertEqual(stringVal, \"1\", \"Object Subscripting Failed\")\n    }\n\n    func testBeginWrite() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        assertThrows(realm.beginWrite())\n        realm.cancelWrite()\n        realm.beginWrite()\n        realm.create(SwiftStringObject.self, value: [\"1\"])\n        XCTAssertEqual(realm.objects(SwiftStringObject.self).count, 1)\n    }\n\n    func testWriteReturning() {\n        let realm = try! Realm()\n        let object = try! realm.write {\n            return realm.create(SwiftStringObject.self, value: [\"1\"])\n        }\n        XCTAssertEqual(object.stringCol, \"1\")\n    }\n\n    func testCommitWrite() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        realm.create(SwiftStringObject.self, value: [\"1\"])\n        try! realm.commitWrite()\n        XCTAssertEqual(realm.objects(SwiftStringObject.self).count, 1)\n        realm.beginWrite()\n    }\n\n    func testCancelWrite() {\n        let realm = try! Realm()\n        assertThrows(realm.cancelWrite())\n        realm.beginWrite()\n        realm.create(SwiftStringObject.self, value: [\"1\"])\n        realm.cancelWrite()\n        XCTAssertEqual(realm.objects(SwiftStringObject.self).count, 0)\n\n        try! realm.write {\n            self.assertThrows(self.realmWithTestPath().cancelWrite())\n            let object = realm.create(SwiftStringObject.self)\n            realm.cancelWrite()\n            XCTAssertTrue(object.isInvalidated)\n            XCTAssertEqual(realm.objects(SwiftStringObject.self).count, 0)\n        }\n        XCTAssertEqual(realm.objects(SwiftStringObject.self).count, 0)\n    }\n\n    func testThrowsWrite() {\n        assertFails(TestError.intentional) {\n            try Realm().write {\n                throw TestError.intentional\n            }\n        }\n        assertFails(TestError.intentional) {\n            try Realm().write {\n                try! Realm().create(SwiftStringObject.self, value: [\"1\"])\n                throw TestError.intentional\n            }\n        }\n    }\n\n    func testInWriteTransaction() {\n        let realm = try! Realm()\n        XCTAssertFalse(realm.isInWriteTransaction)\n        realm.beginWrite()\n        XCTAssertTrue(realm.isInWriteTransaction)\n        realm.cancelWrite()\n        try! realm.write {\n            XCTAssertTrue(realm.isInWriteTransaction)\n            realm.cancelWrite()\n            XCTAssertFalse(realm.isInWriteTransaction)\n        }\n\n        realm.beginWrite()\n        realm.invalidate()\n        XCTAssertFalse(realm.isInWriteTransaction)\n    }\n\n    func testAddSingleObject() {\n        let realm = try! Realm()\n        assertThrows(realm.add(SwiftObject()))\n        XCTAssertEqual(0, realm.objects(SwiftObject.self).count)\n        var defaultRealmObject: SwiftObject!\n        try! realm.write {\n            defaultRealmObject = SwiftObject()\n            realm.add(defaultRealmObject)\n            XCTAssertEqual(1, realm.objects(SwiftObject.self).count)\n            realm.add(defaultRealmObject)\n            XCTAssertEqual(1, realm.objects(SwiftObject.self).count)\n        }\n        XCTAssertEqual(1, realm.objects(SwiftObject.self).count)\n\n        let testRealm = realmWithTestPath()\n        try! testRealm.write {\n            self.assertThrows(testRealm.add(defaultRealmObject))\n        }\n    }\n\n    func testAddWithUpdateSingleObject() {\n        let realm = try! Realm()\n        XCTAssertEqual(0, realm.objects(SwiftPrimaryStringObject.self).count)\n        var defaultRealmObject: SwiftPrimaryStringObject!\n        try! realm.write {\n            defaultRealmObject = SwiftPrimaryStringObject()\n            realm.add(defaultRealmObject, update: .all)\n            XCTAssertEqual(1, realm.objects(SwiftPrimaryStringObject.self).count)\n            realm.add(SwiftPrimaryStringObject(), update: .all)\n            XCTAssertEqual(1, realm.objects(SwiftPrimaryStringObject.self).count)\n        }\n        XCTAssertEqual(1, realm.objects(SwiftPrimaryStringObject.self).count)\n\n        let testRealm = realmWithTestPath()\n        try! testRealm.write {\n            self.assertThrows(testRealm.add(defaultRealmObject, update: .all))\n        }\n    }\n\n    func testAddMultipleObjects() {\n        let realm = try! Realm()\n        assertThrows(realm.add([SwiftObject(), SwiftObject()]))\n        XCTAssertEqual(0, realm.objects(SwiftObject.self).count)\n        try! realm.write {\n            let objs = [SwiftObject(), SwiftObject()]\n            realm.add(objs)\n            XCTAssertEqual(2, realm.objects(SwiftObject.self).count)\n        }\n        XCTAssertEqual(2, realm.objects(SwiftObject.self).count)\n\n        let testRealm = realmWithTestPath()\n        try! testRealm.write {\n            self.assertThrows(testRealm.add(realm.objects(SwiftObject.self)))\n        }\n    }\n\n    func testAddWithUpdateMultipleObjects() {\n        let realm = try! Realm()\n        XCTAssertEqual(0, realm.objects(SwiftPrimaryStringObject.self).count)\n        try! realm.write {\n            let objs = [SwiftPrimaryStringObject(), SwiftPrimaryStringObject()]\n            realm.add(objs, update: .all)\n            XCTAssertEqual(1, realm.objects(SwiftPrimaryStringObject.self).count)\n        }\n        XCTAssertEqual(1, realm.objects(SwiftPrimaryStringObject.self).count)\n\n        let testRealm = realmWithTestPath()\n        try! testRealm.write {\n            self.assertThrows(testRealm.add(realm.objects(SwiftPrimaryStringObject.self), update: .all))\n        }\n    }\n\n    // create() tests are in ObjectCreationTests.swift\n\n    func testDeleteSingleObject() {\n        let realm = try! Realm()\n        XCTAssertEqual(0, realm.objects(SwiftObject.self).count)\n        assertThrows(realm.delete(SwiftObject()))\n        var defaultRealmObject: SwiftObject!\n        try! realm.write {\n            defaultRealmObject = SwiftObject()\n            self.assertThrows(realm.delete(defaultRealmObject))\n            XCTAssertEqual(0, realm.objects(SwiftObject.self).count)\n            realm.add(defaultRealmObject)\n            XCTAssertEqual(1, realm.objects(SwiftObject.self).count)\n            realm.delete(defaultRealmObject)\n            XCTAssertEqual(0, realm.objects(SwiftObject.self).count)\n        }\n        assertThrows(realm.delete(defaultRealmObject))\n        XCTAssertEqual(0, realm.objects(SwiftObject.self).count)\n\n        let testRealm = realmWithTestPath()\n        assertThrows(testRealm.delete(defaultRealmObject))\n        try! testRealm.write {\n            self.assertThrows(testRealm.delete(defaultRealmObject))\n        }\n    }\n\n    func testDeleteSequenceOfObjects() {\n        let realm = try! Realm()\n        XCTAssertEqual(0, realm.objects(SwiftObject.self).count)\n        var objs: [SwiftObject]!\n        try! realm.write {\n            objs = [SwiftObject(), SwiftObject()]\n            realm.add(objs)\n            XCTAssertEqual(2, realm.objects(SwiftObject.self).count)\n            realm.delete(objs)\n            XCTAssertEqual(0, realm.objects(SwiftObject.self).count)\n        }\n        XCTAssertEqual(0, realm.objects(SwiftObject.self).count)\n\n        let testRealm = realmWithTestPath()\n        assertThrows(testRealm.delete(objs))\n        try! testRealm.write {\n            self.assertThrows(testRealm.delete(objs))\n        }\n    }\n\n    func testDeleteListOfObjects() {\n        let realm = try! Realm()\n        XCTAssertEqual(0, realm.objects(SwiftCompanyObject.self).count)\n        try! realm.write {\n            let obj = SwiftCompanyObject()\n            obj.employees.append(SwiftEmployeeObject())\n            realm.add(obj)\n            XCTAssertEqual(1, realm.objects(SwiftEmployeeObject.self).count)\n            realm.delete(obj.employees)\n            XCTAssertEqual(0, obj.employees.count)\n            XCTAssertEqual(0, realm.objects(SwiftEmployeeObject.self).count)\n        }\n        XCTAssertEqual(0, realm.objects(SwiftEmployeeObject.self).count)\n    }\n\n    func testDeleteMutableSetOfObjects() {\n        let realm = try! Realm()\n        XCTAssertEqual(0, realm.objects(SwiftCompanyObject.self).count)\n        try! realm.write {\n            let obj = SwiftCompanyObject()\n            obj.employeeSet.insert(SwiftEmployeeObject())\n            realm.add(obj)\n            XCTAssertEqual(1, realm.objects(SwiftEmployeeObject.self).count)\n            realm.delete(obj.employeeSet)\n            XCTAssertEqual(0, obj.employeeSet.count)\n            XCTAssertEqual(0, realm.objects(SwiftEmployeeObject.self).count)\n        }\n        XCTAssertEqual(0, realm.objects(SwiftEmployeeObject.self).count)\n    }\n\n    func testDeleteResults() {\n        let realm = try! Realm(fileURL: testRealmURL())\n        XCTAssertEqual(0, realm.objects(SwiftCompanyObject.self).count)\n        try! realm.write {\n            realm.add(SwiftIntObject(value: [1]))\n            realm.add(SwiftIntObject(value: [1]))\n            realm.add(SwiftIntObject(value: [2]))\n            XCTAssertEqual(3, realm.objects(SwiftIntObject.self).count)\n            realm.delete(realm.objects(SwiftIntObject.self).filter(\"intCol = 1\"))\n            XCTAssertEqual(1, realm.objects(SwiftIntObject.self).count)\n        }\n        XCTAssertEqual(1, realm.objects(SwiftIntObject.self).count)\n    }\n\n    func testDeleteAll() {\n        let realm = try! Realm()\n        try! realm.write {\n            realm.add(SwiftObject())\n            XCTAssertEqual(1, realm.objects(SwiftObject.self).count)\n            realm.deleteAll()\n            XCTAssertEqual(0, realm.objects(SwiftObject.self).count)\n        }\n        XCTAssertEqual(0, realm.objects(SwiftObject.self).count)\n    }\n\n    func testObjects() {\n        try! Realm().write {\n            try! Realm().create(SwiftIntObject.self, value: [100])\n            try! Realm().create(SwiftIntObject.self, value: [200])\n            try! Realm().create(SwiftIntObject.self, value: [300])\n        }\n\n        XCTAssertEqual(0, try! Realm().objects(SwiftStringObject.self).count)\n        XCTAssertEqual(3, try! Realm().objects(SwiftIntObject.self).count)\n        assertThrows(try! Realm().objects(Object.self))\n    }\n\n    func testDynamicObjects() {\n        try! Realm().write {\n            try! Realm().create(SwiftIntObject.self, value: [100])\n            try! Realm().create(SwiftIntObject.self, value: [200])\n            try! Realm().create(SwiftIntObject.self, value: [300])\n        }\n\n        XCTAssertEqual(0, try! Realm().dynamicObjects(\"SwiftStringObject\").count)\n        XCTAssertEqual(3, try! Realm().dynamicObjects(\"SwiftIntObject\").count)\n        assertThrows(try! Realm().dynamicObjects(\"Object\"))\n    }\n\n    func testDynamicObjectProperties() {\n        try! Realm().write {\n            try! Realm().create(SwiftObject.self)\n        }\n\n        let object = try! Realm().dynamicObjects(\"SwiftObject\")[0]\n        let dictionary = SwiftObject.defaultValues()\n\n        XCTAssertEqual(object[\"boolCol\"] as? NSNumber, dictionary[\"boolCol\"] as! NSNumber?)\n        XCTAssertEqual(object[\"intCol\"] as? NSNumber, dictionary[\"intCol\"] as! NSNumber?)\n        XCTAssertEqual(object[\"int8Col\"] as? NSNumber, dictionary[\"int8Col\"] as! NSNumber?)\n        XCTAssertEqual(object[\"int16Col\"] as? NSNumber, dictionary[\"int16Col\"] as! NSNumber?)\n        XCTAssertEqual(object[\"int32Col\"] as? NSNumber, dictionary[\"int32Col\"] as! NSNumber?)\n        XCTAssertEqual(object[\"int64Col\"] as? NSNumber, dictionary[\"int64Col\"] as! NSNumber?)\n        XCTAssertEqual(object[\"floatCol\"] as! Float, dictionary[\"floatCol\"] as! Float, accuracy: 0.001)\n        XCTAssertEqual(object[\"doubleCol\"] as? NSNumber, dictionary[\"doubleCol\"] as! NSNumber?)\n        XCTAssertEqual(object[\"stringCol\"] as! String?, dictionary[\"stringCol\"] as! String?)\n        XCTAssertEqual(object[\"binaryCol\"] as! NSData?, dictionary[\"binaryCol\"] as! NSData?)\n        XCTAssertEqual(object[\"dateCol\"] as! Date?, dictionary[\"dateCol\"] as! Date?)\n        XCTAssertEqual((object[\"objectCol\"] as? SwiftBoolObject)?.boolCol, false)\n    }\n\n    func testDynamicObjectOptionalProperties() {\n        try! Realm().write {\n            try! Realm().create(SwiftOptionalDefaultValuesObject.self)\n        }\n\n        let object = try! Realm().dynamicObjects(\"SwiftOptionalDefaultValuesObject\")[0]\n        let dictionary = SwiftOptionalDefaultValuesObject.defaultValues()\n\n        XCTAssertEqual(object[\"optIntCol\"] as? NSNumber, dictionary[\"optIntCol\"] as! NSNumber?)\n        XCTAssertEqual(object[\"optInt8Col\"] as? NSNumber, dictionary[\"optInt8Col\"] as! NSNumber?)\n        XCTAssertEqual(object[\"optInt16Col\"] as? NSNumber, dictionary[\"optInt16Col\"] as! NSNumber?)\n        XCTAssertEqual(object[\"optInt32Col\"] as? NSNumber, dictionary[\"optInt32Col\"] as! NSNumber?)\n        XCTAssertEqual(object[\"optInt64Col\"] as? NSNumber, dictionary[\"optInt64Col\"] as! NSNumber?)\n        XCTAssertEqual(object[\"optFloatCol\"] as? NSNumber, dictionary[\"optFloatCol\"] as! NSNumber?)\n        XCTAssertEqual(object[\"optDoubleCol\"] as? NSNumber, dictionary[\"optDoubleCol\"] as! NSNumber?)\n        XCTAssertEqual(object[\"optStringCol\"] as! String?, dictionary[\"optStringCol\"] as! String?)\n        XCTAssertEqual(object[\"optNSStringCol\"] as! String?, dictionary[\"optNSStringCol\"] as! String?)\n        XCTAssertEqual(object[\"optBinaryCol\"] as! NSData?, dictionary[\"optBinaryCol\"] as! NSData?)\n        XCTAssertEqual(object[\"optDateCol\"] as! Date?, dictionary[\"optDateCol\"] as! Date?)\n        XCTAssertEqual(object[\"optDecimalCol\"] as! Decimal128?, dictionary[\"optDecimalCol\"] as! Decimal128?)\n        XCTAssertEqual(object[\"optObjectIdCol\"] as! ObjectId?, dictionary[\"optObjectIdCol\"] as! ObjectId?)\n        XCTAssertEqual((object[\"optObjectCol\"] as? SwiftBoolObject)?.boolCol, true)\n        XCTAssertEqual(object[\"optUuidCol\"] as! UUID, dictionary[\"optUuidCol\"] as! UUID)\n    }\n\n    func testIterateDynamicObjects() {\n        try! Realm().write {\n            for _ in 1..<3 {\n                try! Realm().create(SwiftObject.self)\n            }\n        }\n\n        let objects = try! Realm().dynamicObjects(\"SwiftObject\")\n        let dictionary = SwiftObject.defaultValues()\n\n        for object in objects {\n            XCTAssertEqual(object[\"boolCol\"] as? NSNumber, dictionary[\"boolCol\"] as! NSNumber?)\n            XCTAssertEqual(object[\"intCol\"] as? NSNumber, dictionary[\"intCol\"] as! NSNumber?)\n            XCTAssertEqual(object[\"int8Col\"] as? NSNumber, dictionary[\"int8Col\"] as! NSNumber?)\n            XCTAssertEqual(object[\"int16Col\"] as? NSNumber, dictionary[\"int16Col\"] as! NSNumber?)\n            XCTAssertEqual(object[\"int32Col\"] as? NSNumber, dictionary[\"int32Col\"] as! NSNumber?)\n            XCTAssertEqual(object[\"int64Col\"] as? NSNumber, dictionary[\"int64Col\"] as! NSNumber?)\n            XCTAssertEqual(object[\"floatCol\"] as? NSNumber, dictionary[\"floatCol\"] as! NSNumber?)\n            XCTAssertEqual(object[\"doubleCol\"] as? NSNumber, dictionary[\"doubleCol\"] as! NSNumber?)\n            XCTAssertEqual(object[\"stringCol\"] as! String?, dictionary[\"stringCol\"] as! String?)\n            XCTAssertEqual(object[\"binaryCol\"] as! NSData?, dictionary[\"binaryCol\"] as! NSData?)\n            XCTAssertEqual(object[\"dateCol\"] as! Date?, dictionary[\"dateCol\"] as! Date?)\n            XCTAssertEqual((object[\"objectCol\"] as? SwiftBoolObject)?.boolCol, false)\n        }\n    }\n\n    func testDynamicObjectListProperties() {\n        try! Realm().write {\n            try! Realm().create(SwiftArrayPropertyObject.self, value: [\"string\", [[\"array\"]], [[2]]])\n        }\n\n        let object = try! Realm().dynamicObjects(\"SwiftArrayPropertyObject\")[0]\n\n        XCTAssertEqual(object[\"name\"] as? String, \"string\")\n\n        let array = object[\"array\"] as! List<DynamicObject>\n        XCTAssertEqual(array.first![\"stringCol\"] as? String, \"array\")\n        XCTAssertEqual(array.last![\"stringCol\"] as? String, \"array\")\n\n        for object in array {\n            XCTAssertEqual(object[\"stringCol\"] as? String, \"array\")\n        }\n\n        let intArray = object[\"intArray\"] as! List<DynamicObject>\n        XCTAssertEqual(intArray[0][\"intCol\"] as? Int, 2)\n        XCTAssertEqual(intArray.first![\"intCol\"] as? Int, 2)\n        XCTAssertEqual(intArray.last![\"intCol\"] as? Int, 2)\n\n        for object in intArray {\n            XCTAssertEqual(object[\"intCol\"] as? Int, 2)\n        }\n    }\n\n    func testDynamicObjectMutableSetProperties() {\n        try! Realm().write {\n            try! Realm().create(SwiftMutableSetPropertyObject.self, value: [\"string\", [[\"set\"]], [[2]]])\n        }\n\n        let object = try! Realm().dynamicObjects(\"SwiftMutableSetPropertyObject\")[0]\n\n        XCTAssertEqual(object[\"name\"] as? String, \"string\")\n\n        let set = object[\"set\"] as! MutableSet<DynamicObject>\n        XCTAssertEqual(set.first![\"stringCol\"] as? String, \"set\")\n        XCTAssertEqual(set.last![\"stringCol\"] as? String, \"set\")\n\n        for object in set {\n            XCTAssertEqual(object[\"stringCol\"] as? String, \"set\")\n        }\n\n        let intSet = object[\"intSet\"] as! MutableSet<DynamicObject>\n        XCTAssertEqual(intSet[0][\"intCol\"] as? Int, 2)\n        XCTAssertEqual(intSet.first![\"intCol\"] as? Int, 2)\n        XCTAssertEqual(intSet.last![\"intCol\"] as? Int, 2)\n\n        for object in intSet {\n            XCTAssertEqual(object[\"intCol\"] as? Int, 2)\n        }\n    }\n\n    func testIntPrimaryKey() {\n        func testIntPrimaryKey<O: Object>(for type: O.Type)\n        where O: SwiftPrimaryKeyObjectType, O.PrimaryKey: ExpressibleByIntegerLiteral {\n\n            let realm = try! Realm()\n            try! realm.write {\n                realm.create(type, value: [\"a\", 1])\n                realm.create(type, value: [\"b\", 2])\n            }\n\n            let object = realm.object(ofType: type, forPrimaryKey: 1 as O.PrimaryKey)\n            XCTAssertNotNil(object)\n\n            let missingObject = realm.object(ofType: type, forPrimaryKey: 0 as O.PrimaryKey)\n            XCTAssertNil(missingObject)\n        }\n\n        testIntPrimaryKey(for: SwiftPrimaryIntObject.self)\n        testIntPrimaryKey(for: SwiftPrimaryInt8Object.self)\n        testIntPrimaryKey(for: SwiftPrimaryInt16Object.self)\n        testIntPrimaryKey(for: SwiftPrimaryInt32Object.self)\n        testIntPrimaryKey(for: SwiftPrimaryInt64Object.self)\n    }\n\n    func testOptionalIntPrimaryKey() {\n        func testOptionalIntPrimaryKey<O: Object, Wrapped>(for type: O.Type, _ wrapped: Wrapped.Type)\n        where Wrapped: ExpressibleByIntegerLiteral {\n            let realm = try! Realm()\n            try! realm.write {\n                realm.create(type, value: [\"a\", NSNull()])\n                realm.create(type, value: [\"b\", 2])\n            }\n\n            let object1a = realm.object(ofType: type, forPrimaryKey: NSNull())\n            XCTAssertNotNil(object1a)\n\n            let object1b = realm.object(ofType: type, forPrimaryKey: nil as Wrapped?)\n            XCTAssertNotNil(object1b)\n\n            let object2 = realm.object(ofType: type, forPrimaryKey: 2 as Wrapped)\n            XCTAssertNotNil(object2)\n\n            let missingObject = realm.object(ofType: type, forPrimaryKey: 0 as Wrapped)\n            XCTAssertNil(missingObject)\n        }\n\n        testOptionalIntPrimaryKey(for: SwiftPrimaryOptionalIntObject.self, Int.self)\n        testOptionalIntPrimaryKey(for: SwiftPrimaryOptionalInt8Object.self, Int8.self)\n        testOptionalIntPrimaryKey(for: SwiftPrimaryOptionalInt16Object.self, Int16.self)\n        testOptionalIntPrimaryKey(for: SwiftPrimaryOptionalInt32Object.self, Int32.self)\n        testOptionalIntPrimaryKey(for: SwiftPrimaryOptionalInt64Object.self, Int64.self)\n    }\n\n    func testStringPrimaryKey() {\n        let realm = try! Realm()\n        try! realm.write {\n            realm.create(SwiftPrimaryStringObject.self, value: [\"a\", 1])\n            realm.create(SwiftPrimaryStringObject.self, value: [\"b\", 2])\n        }\n\n        // When this is directly inside the XCTAssertNotNil, it doesn't work\n        let object = realm.object(ofType: SwiftPrimaryStringObject.self, forPrimaryKey: \"a\")\n        XCTAssertNotNil(object)\n\n        // When this is directly inside the XCTAssertNil, it fails for some reason\n        let missingObject = realm.object(ofType: SwiftPrimaryStringObject.self, forPrimaryKey: \"z\")\n        XCTAssertNil(missingObject)\n    }\n\n    func testOptionalStringPrimaryKey() {\n        let realm = try! Realm()\n        try! realm.write {\n            realm.create(SwiftPrimaryStringObject.self, value: [\"a\", 1])\n            realm.create(SwiftPrimaryStringObject.self, value: [\"b\", 2])\n\n            realm.create(SwiftPrimaryOptionalStringObject.self, value: [NSNull(), 1])\n            realm.create(SwiftPrimaryOptionalStringObject.self, value: [\"b\", 2])\n        }\n\n        let object1 = realm.object(ofType: SwiftPrimaryOptionalStringObject.self, forPrimaryKey: NSNull())\n        XCTAssertNotNil(object1)\n\n        let object2 = realm.object(ofType: SwiftPrimaryOptionalStringObject.self, forPrimaryKey: \"b\")\n        XCTAssertNotNil(object2)\n\n        let missingObject = realm.object(ofType: SwiftPrimaryOptionalStringObject.self, forPrimaryKey: \"z\")\n        XCTAssertNil(missingObject)\n    }\n\n    func testUUIDPrimaryKey() {\n        let realm = try! Realm()\n        try! realm.write {\n            realm.create(SwiftPrimaryUUIDObject.self, value: [UUID(uuidString: \"8a12daba-8b23-11eb-8dcd-0242ac130003\")!, \"a\"])\n            realm.create(SwiftPrimaryUUIDObject.self, value: [UUID(uuidString: \"85d4fbee-6ec6-47df-bfa1-615931903d7e\")!, \"b\"])\n        }\n\n        let object1 = realm.object(ofType: SwiftPrimaryUUIDObject.self, forPrimaryKey: UUID(uuidString: \"8a12daba-8b23-11eb-8dcd-0242ac130003\")!)!\n        XCTAssertNotNil(object1)\n        XCTAssertEqual(object1.stringCol, \"a\")\n\n        let object2 = realm.object(ofType: SwiftPrimaryUUIDObject.self, forPrimaryKey: UUID(uuidString: \"85d4fbee-6ec6-47df-bfa1-615931903d7e\")!)!\n        XCTAssertNotNil(object2)\n        XCTAssertEqual(object2.stringCol, \"b\")\n\n        XCTAssertNil(realm.object(ofType: SwiftPrimaryUUIDObject.self, forPrimaryKey: UUID(uuidString: \"4ee1fa48-8b23-11eb-8dcd-0242ac130003\")!))\n    }\n\n    func testObjectIdPrimaryKey() {\n        let realm = try! Realm()\n        try! realm.write {\n            realm.create(SwiftPrimaryObjectIdObject.self, value: [ObjectId(\"1234567890ab1234567890aa\"), 1])\n            realm.create(SwiftPrimaryObjectIdObject.self, value: [ObjectId(\"1234567890ab1234567890ab\"), 2])\n        }\n\n        let object1 = realm.object(ofType: SwiftPrimaryObjectIdObject.self, forPrimaryKey: ObjectId(\"1234567890ab1234567890aa\"))!\n        XCTAssertNotNil(object1)\n        XCTAssertEqual(object1.intCol, 1)\n\n        let object2 = realm.object(ofType: SwiftPrimaryObjectIdObject.self, forPrimaryKey: ObjectId(\"1234567890ab1234567890ab\"))!\n        XCTAssertNotNil(object2)\n        XCTAssertEqual(object2.intCol, 2)\n\n        XCTAssertNil(realm.object(ofType: SwiftPrimaryObjectIdObject.self, forPrimaryKey: ObjectId(\"1234567890ab1234567890ac\")))\n    }\n\n    func testDynamicObjectForPrimaryKey() {\n        let realm = try! Realm()\n        try! realm.write {\n            realm.create(SwiftPrimaryStringObject.self, value: [\"a\", 1])\n            realm.create(SwiftPrimaryStringObject.self, value: [\"b\", 2])\n        }\n\n        XCTAssertNotNil(realm.dynamicObject(ofType: \"SwiftPrimaryStringObject\", forPrimaryKey: \"a\"))\n        XCTAssertNil(realm.dynamicObject(ofType: \"SwiftPrimaryStringObject\", forPrimaryKey: \"z\"))\n    }\n\n    func testDynamicObjectForPrimaryKeySubscripting() {\n        let realm = try! Realm()\n        try! realm.write {\n            realm.create(SwiftPrimaryStringObject.self, value: [\"a\", 1])\n        }\n\n        let object = realm.dynamicObject(ofType: \"SwiftPrimaryStringObject\", forPrimaryKey: \"a\")\n\n        let stringVal = object![\"stringCol\"] as! String\n\n        XCTAssertEqual(stringVal, \"a\", \"Object Subscripting Failed!\")\n    }\n\n    func testObserve() {\n        let realm = try! Realm()\n        var notificationCalled = false\n        let token = realm.observe { _, realm in\n            XCTAssertEqual(realm.configuration.fileURL, self.defaultRealmURL())\n            notificationCalled = true\n        }\n        XCTAssertFalse(notificationCalled)\n        try! realm.write {}\n        XCTAssertTrue(notificationCalled)\n        token.invalidate()\n    }\n\n    func testRemoveNotification() {\n        let realm = try! Realm()\n        var notificationCalled = false\n        let token = realm.observe { (_, realm) in\n            XCTAssertEqual(realm.configuration.fileURL, self.defaultRealmURL())\n            notificationCalled = true\n        }\n        token.invalidate()\n        try! realm.write {}\n        XCTAssertFalse(notificationCalled)\n    }\n\n    @MainActor\n    func testAutorefresh() {\n        let realm = try! Realm()\n        XCTAssertTrue(realm.autorefresh, \"Autorefresh should default to true\")\n        realm.autorefresh = false\n        XCTAssertFalse(realm.autorefresh)\n        realm.autorefresh = true\n        XCTAssertTrue(realm.autorefresh)\n\n        // test that autoreresh is applied\n        // we have two notifications, one for opening the realm, and a second when performing our transaction\n        let notificationFired = expectation(description: \"notification fired\")\n        let token = realm.observe { _, realm in\n            XCTAssertNotNil(realm, \"Realm should not be nil\")\n            notificationFired.fulfill()\n        }\n\n        dispatchSyncNewThread { @Sendable in\n            let realm = try! Realm()\n            try! realm.write {\n                realm.create(SwiftStringObject.self, value: [\"string\"])\n            }\n        }\n        waitForExpectations(timeout: 1, handler: nil)\n        token.invalidate()\n\n        // get object\n        let results = realm.objects(SwiftStringObject.self)\n        XCTAssertEqual(results.count, Int(1), \"There should be 1 object of type StringObject\")\n        XCTAssertEqual(results[0].stringCol, \"string\", \"Value of first column should be 'string'\")\n    }\n\n    @MainActor\n    func testRefresh() {\n        let realm = try! Realm()\n        realm.autorefresh = false\n\n        // test that autorefresh is not applied\n        // we have two notifications, one for opening the realm, and a second when performing our transaction\n        let notificationFired = expectation(description: \"notification fired\")\n        var token: NotificationToken!\n        token = realm.observe { _, realm in\n            XCTAssertNotNil(realm, \"Realm should not be nil\")\n            token.invalidate()\n            notificationFired.fulfill()\n        }\n\n        let results = realm.objects(SwiftStringObject.self)\n        XCTAssertEqual(results.count, Int(0), \"There should be 1 object of type StringObject\")\n\n        dispatchSyncNewThread { @Sendable in\n            try! Realm().write {\n                _ = try! Realm().create(SwiftStringObject.self, value: [\"string\"])\n            }\n        }\n        waitForExpectations(timeout: 1, handler: nil)\n\n        XCTAssertEqual(results.count, Int(0), \"There should be 1 object of type StringObject\")\n\n        // refresh\n        realm.refresh()\n\n        XCTAssertEqual(results.count, Int(1), \"There should be 1 object of type StringObject\")\n        XCTAssertEqual(results[0].stringCol, \"string\", \"Value of first column should be 'string'\")\n    }\n\n    func testInvalidate() {\n        let realm = try! Realm()\n        let object = SwiftObject()\n        try! realm.write {\n            realm.add(object)\n            return\n        }\n        realm.invalidate()\n        XCTAssertEqual(object.isInvalidated, true)\n\n        try! realm.write {\n            realm.add(SwiftObject())\n            return\n        }\n        XCTAssertEqual(realm.objects(SwiftObject.self).count, 2)\n        XCTAssertEqual(object.isInvalidated, true)\n    }\n\n    func testWriteCopyToPath() throws {\n        let realm = try Realm()\n        try realm.write {\n            realm.add(SwiftObject())\n        }\n        let fileURL = defaultRealmURL().deletingLastPathComponent().appendingPathComponent(\"copy.realm\")\n        try realm.writeCopy(toFile: fileURL)\n        try autoreleasepool {\n            let copy = try Realm(fileURL: fileURL)\n            XCTAssertEqual(1, copy.objects(SwiftObject.self).count)\n\n            let frozenCopy = copy.freeze()\n            XCTAssertEqual(1, frozenCopy.objects(SwiftObject.self).count)\n            XCTAssertTrue(frozenCopy.isFrozen)\n            XCTAssertTrue(frozenCopy.objects(SwiftObject.self).isFrozen)\n        }\n        try FileManager.default.removeItem(at: fileURL)\n    }\n\n    func testWriteCopyForConfiguration() throws {\n        var localConfig = Realm.Configuration()\n        localConfig.fileURL = defaultRealmURL().deletingLastPathComponent().appendingPathComponent(\"original.realm\")\n\n        let realm = try Realm(configuration: localConfig)\n        try realm.write {\n            realm.add(SwiftBoolObject())\n        }\n\n        XCTAssertEqual(realm.objects(SwiftBoolObject.self).count, 1)\n\n        var destinationConfig = Realm.Configuration()\n        destinationConfig.fileURL = defaultRealmURL().deletingLastPathComponent().appendingPathComponent(\"destination.realm\")\n\n        try realm.writeCopy(configuration: destinationConfig)\n\n        let destinationRealm = try Realm(configuration: destinationConfig)\n        XCTAssertEqual(destinationRealm.objects(SwiftBoolObject.self).count, 1)\n\n        try destinationRealm.write {\n            destinationRealm.add(SwiftBoolObject())\n        }\n\n        XCTAssertEqual(destinationRealm.objects(SwiftBoolObject.self).count, 2)\n\n        let frozenRealm = destinationRealm.freeze()\n        XCTAssertTrue(frozenRealm.isFrozen)\n        XCTAssertTrue(frozenRealm.objects(SwiftBoolObject.self).isFrozen)\n\n        try FileManager.default.removeItem(at: localConfig.fileURL!)\n        try FileManager.default.removeItem(at: destinationConfig.fileURL!)\n    }\n\n    func testSeedFilePath() throws {\n        var localConfig = Realm.Configuration()\n        localConfig.fileURL = defaultRealmURL().deletingLastPathComponent().appendingPathComponent(\"original.realm\")\n\n        try autoreleasepool {\n            let realm = try Realm(configuration: localConfig)\n            try realm.write {\n                realm.add(SwiftBoolObject())\n            }\n            XCTAssertEqual(realm.objects(SwiftBoolObject.self).count, 1)\n        }\n\n        var destinationConfig = Realm.Configuration()\n        destinationConfig.fileURL = defaultRealmURL().deletingLastPathComponent().appendingPathComponent(\"destination.realm\")\n        destinationConfig.seedFilePath = defaultRealmURL().deletingLastPathComponent().appendingPathComponent(\"original.realm\")\n\n        try autoreleasepool {\n            // Should copy the seed file over before opening\n            let destinationRealm = try Realm(configuration: destinationConfig)\n            XCTAssertEqual(destinationRealm.objects(SwiftBoolObject.self).count, 1)\n\n            try destinationRealm.write {\n                destinationRealm.add(SwiftBoolObject())\n            }\n\n            XCTAssertEqual(destinationRealm.objects(SwiftBoolObject.self).count, 2)\n        }\n\n        try autoreleasepool {\n            let realm = try Realm(configuration: localConfig)\n            try realm.write {\n                realm.deleteAll()\n            }\n            XCTAssertEqual(realm.objects(SwiftBoolObject.self).count, 0)\n        }\n\n        try autoreleasepool {\n            // Should not have copied the seed file as the Realm already exists\n            let destinationRealm = try Realm(configuration: destinationConfig)\n            XCTAssertEqual(destinationRealm.objects(SwiftBoolObject.self).count, 2)\n        }\n    }\n\n    func testEquals() {\n        nonisolated(unsafe) let realm = try! Realm()\n        XCTAssertTrue(try! realm == Realm())\n\n        let testRealm = realmWithTestPath()\n        XCTAssertFalse(realm == testRealm)\n\n        dispatchSyncNewThread {\n            let otherThreadRealm = try! Realm()\n            XCTAssertFalse(realm == otherThreadRealm)\n        }\n    }\n\n    func testCatchSpecificErrors() {\n        do {\n            _ = try Realm(configuration: Realm.Configuration(fileURL: URL(fileURLWithPath: \"/dev/null/foo\")))\n            XCTFail(\"Error should be thrown\")\n        } catch Realm.Error.fileOperationFailed {\n            // Success to catch the error\n        } catch {\n            XCTFail(\"Unexpected error \\(error)\")\n        }\n        do {\n            _ = try Realm(configuration: Realm.Configuration(fileURL: defaultRealmURL(), readOnly: true))\n            XCTFail(\"Error should be thrown\")\n        } catch Realm.Error.fileNotFound {\n            // Success to catch the error\n        } catch {\n            XCTFail(\"Unexpected error \\(error)\")\n        }\n    }\n\n    func testExists() {\n        let config = Realm.Configuration()\n        XCTAssertFalse(Realm.fileExists(for: config))\n        autoreleasepool { _ = try! Realm(configuration: config) }\n        XCTAssertTrue(Realm.fileExists(for: config))\n        XCTAssertTrue(try! Realm.deleteFiles(for: config))\n        XCTAssertFalse(Realm.fileExists(for: config))\n    }\n\n    func testThaw() {\n        XCTAssertEqual(try! Realm().objects(SwiftBoolObject.self).count, 0)\n        let realm = try! Realm()\n        nonisolated(unsafe) let frozenRealm = realm.freeze()\n        XCTAssert(frozenRealm.isFrozen)\n\n        dispatchSyncNewThread {\n            let thawedRealm = frozenRealm.thaw()\n            XCTAssertFalse(thawedRealm.isFrozen)\n            try! thawedRealm.write {\n                try! Realm().create(SwiftBoolObject.self, value: [\"boolCol\": true])\n            }\n        }\n        XCTAssertEqual(try! Realm().objects(SwiftBoolObject.self).count, 0)\n        realm.refresh()\n        XCTAssertEqual(try! Realm().objects(SwiftBoolObject.self).count, 1)\n    }\n\n    // MARK: - Async Transactions\n\n    @MainActor\n    func testAsyncTransactionShouldWrite() {\n        let realm = try! Realm()\n        let asyncComplete = expectation(description: \"async transaction complete\")\n\n        realm.writeAsync {\n            realm.create(SwiftStringObject.self, value: [\"string\"])\n        } onComplete: { _ in\n            let object = realm.objects(SwiftStringObject.self).first\n            XCTAssertEqual(object?.stringCol, \"string\")\n            asyncComplete.fulfill()\n        }\n\n        waitForExpectations(timeout: 1, handler: nil)\n    }\n\n    @MainActor\n    func testAsyncTransactionShouldWriteOnCommit() {\n        let realm = try! Realm()\n        let writeComplete = expectation(description: \"async transaction complete\")\n\n        DispatchQueue.main.async {\n            let realm = try! Realm()\n            realm.beginAsyncWrite {\n                realm.create(SwiftStringObject.self, value: [\"string\"])\n\n                realm.commitAsyncWrite { _ in\n                    let object = realm.objects(SwiftStringObject.self).first\n                    XCTAssertEqual(object?.stringCol, \"string\")\n                    writeComplete.fulfill()\n                }\n            }\n        }\n\n        waitForExpectations(timeout: 1, handler: nil)\n        XCTAssertEqual(realm.objects(SwiftStringObject.self).count, 1)\n    }\n\n    @MainActor\n    func testAsyncTransactionShouldCancel() {\n        let realm = try! Realm()\n        let asyncComplete = expectation(description: \"async transaction complete\")\n        asyncComplete.isInverted = true\n\n        let asyncTransactionId = realm.beginAsyncWrite {\n            realm.create(SwiftStringObject.self, value: [\"string\"])\n            realm.commitAsyncWrite { _ in\n                asyncComplete.fulfill()\n            }\n        }\n\n        try! realm.cancelAsyncWrite(asyncTransactionId)\n\n        waitForExpectations(timeout: 1, handler: nil)\n        XCTAssertNil(realm.objects(SwiftStringObject.self).first)\n    }\n\n    @MainActor\n    func testAsyncTransactionShouldCancelWithoutCommit() {\n        let realm = try! Realm()\n        let asyncComplete = expectation(description: \"async transaction complete\")\n\n        XCTAssertNil(realm.objects(SwiftStringObject.self).first)\n\n        realm.beginAsyncWrite {\n            realm.create(SwiftStringObject.self, value: [\"string\"])\n            asyncComplete.fulfill()\n        }\n\n        waitForExpectations(timeout: 1, handler: nil)\n        XCTAssertNil(realm.objects(SwiftStringObject.self).first)\n    }\n\n    @MainActor\n    func testAsyncTransactionShouldNotAutoCommitOnCanceledTransaction() {\n        let realm = try! Realm()\n        let waitComplete = expectation(description: \"async wait complete\")\n        let writeComplete = expectation(description: \"async transaction complete\")\n        writeComplete.isInverted = true\n\n        DispatchQueue.main.async {\n            let realm = try! Realm()\n            let transactionId = realm.writeAsync({\n                realm.create(SwiftStringObject.self, value: [\"string\"])\n            }, onComplete: { _ in\n                writeComplete.fulfill()\n            })\n            try! realm.cancelAsyncWrite(transactionId)\n            waitComplete.fulfill()\n        }\n\n        waitForExpectations(timeout: 1, handler: nil)\n        XCTAssertNil(realm.objects(SwiftStringObject.self).first)\n    }\n\n    @MainActor\n    func testAsyncTransactionShouldAutorefresh() {\n        let realm = try! Realm()\n        realm.autorefresh = false\n\n        // test that autoreresh is not applied\n        // we have two notifications, one for opening the realm, and a second when performing our transaction\n        let notificationFired = expectation(description: \"notification fired\")\n        var token: NotificationToken!\n        token = realm.observe { _, realm in\n            XCTAssertNotNil(realm, \"Realm should not be nil\")\n            token.invalidate()\n            notificationFired.fulfill()\n        }\n\n        let results = realm.objects(SwiftStringObject.self)\n        XCTAssertEqual(results.count, 0)\n\n        realm.writeAsync {\n            realm.create(SwiftStringObject.self, value: [\"string\"])\n        }\n\n        waitForExpectations(timeout: 1, handler: nil)\n        XCTAssertEqual(results.count, 1)\n\n        // refresh\n        realm.refresh()\n\n        XCTAssertEqual(results.count, 1)\n        XCTAssertEqual(results[0].stringCol, \"string\")\n    }\n\n    @MainActor\n    func testAsyncTransactionSyncCommit() {\n        let realm = try! Realm()\n        let asyncComplete = expectation(description: \"async transaction complete\")\n        XCTAssertEqual(0, realm.objects(SwiftStringObject.self).count)\n\n        realm.beginAsyncWrite {\n            realm.create(SwiftStringObject.self, value: [\"string\"])\n            realm.commitAsyncWrite(allowGrouping: true) { _ in\n                asyncComplete.fulfill()\n            }\n        }\n\n        realm.beginAsyncWrite {\n            realm.create(SwiftStringObject.self, value: [\"string 2\"])\n            realm.commitAsyncWrite()\n        }\n\n        waitForExpectations(timeout: 1, handler: nil)\n        XCTAssertEqual(2, realm.objects(SwiftStringObject.self).count)\n    }\n\n    @MainActor\n    func testAsyncTransactionSyncAfterAsyncWithoutCommit() {\n        let realm = try! Realm()\n        XCTAssertEqual(0, realm.objects(SwiftStringObject.self).count)\n        let asyncComplete = expectation(description: \"async transaction complete\")\n\n        realm.beginAsyncWrite {\n            realm.create(SwiftStringObject.self, value: [\"string\"])\n            asyncComplete.fulfill()\n        }\n\n        try! realm.write {\n            realm.create(SwiftStringObject.self, value: [\"string 2\"])\n        }\n\n        waitForExpectations(timeout: 1, handler: nil)\n        XCTAssertEqual(1, realm.objects(SwiftStringObject.self).count)\n        XCTAssertEqual(\"string 2\", realm.objects(SwiftStringObject.self).first?.stringCol)\n    }\n\n    @MainActor\n    func testAsyncTransactionWriteWithSync() {\n        let realm = try! Realm()\n        let asyncComplete = expectation(description: \"async transaction complete\")\n\n        XCTAssertEqual(0, realm.objects(SwiftStringObject.self).count)\n\n        try! realm.write {\n            realm.create(SwiftStringObject.self, value: [\"string\"])\n        }\n\n        realm.beginWrite()\n        realm.create(SwiftStringObject.self, value: [\"string 2\"])\n        realm.commitAsyncWrite { _ in\n            asyncComplete.fulfill()\n        }\n\n        waitForExpectations(timeout: 1, handler: nil)\n        XCTAssertEqual(2, realm.objects(SwiftStringObject.self).count)\n    }\n\n    @MainActor\n    func testAsyncTransactionMixedWithSync() {\n        let realm = try! Realm()\n        let asyncComplete = expectation(description: \"async transaction complete\")\n\n        XCTAssertEqual(0, realm.objects(SwiftStringObject.self).count)\n\n        realm.writeAsync {\n            realm.create(SwiftStringObject.self, value: [\"string\"])\n        }\n\n        realm.writeAsync {\n            realm.create(SwiftStringObject.self, value: [\"string 2\"])\n        } onComplete: { _ in\n            asyncComplete.fulfill()\n        }\n\n        realm.beginWrite()\n        realm.create(SwiftStringObject.self, value: [\"string 3\"])\n        try! realm.commitWrite()\n\n        waitForExpectations(timeout: 1, handler: nil)\n        XCTAssertEqual(3, realm.objects(SwiftStringObject.self).count)\n    }\n\n    @MainActor\n    func testAsyncTransactionMixedWithCancelledSync() {\n        let realm = try! Realm()\n        let asyncComplete = expectation(description: \"async transaction complete\")\n\n        XCTAssertEqual(0, realm.objects(SwiftStringObject.self).count)\n\n        realm.writeAsync {\n            realm.create(SwiftStringObject.self, value: [\"string\"])\n        }\n\n        realm.writeAsync {\n            realm.create(SwiftStringObject.self, value: [\"string 2\"])\n        } onComplete: { _ in\n            asyncComplete.fulfill()\n        }\n\n        realm.beginWrite()\n        realm.create(SwiftStringObject.self, value: [\"string 3\"])\n        realm.cancelWrite()\n\n        waitForExpectations(timeout: 1, handler: nil)\n        XCTAssertEqual(2, realm.objects(SwiftStringObject.self).count)\n    }\n\n    @MainActor\n    func testAsyncTransactionChangeNotification() {\n        let realm = try! Realm()\n        let asyncWriteComplete = expectation(description: \"async write complete\")\n        asyncWriteComplete.expectedFulfillmentCount = 2\n        let updateComplete = expectation(description: \"update complete\")\n        updateComplete.expectedFulfillmentCount = 2\n\n        let resultsUnderTest = realm.objects(SwiftStringObject.self)\n        let token = resultsUnderTest.observe { change in\n            switch change {\n            case .initial:\n                return // ignore\n            case .update:\n                updateComplete.fulfill()\n            case .error:\n                XCTFail(\"should not get here for this test\")\n            }\n        }\n\n        realm.writeAsync {\n            realm.create(SwiftStringObject.self, value: [\"string 1\"])\n        } onComplete: { _ in\n            asyncWriteComplete.fulfill()\n        }\n\n        realm.writeAsync {\n            realm.create(SwiftStringObject.self, value: [\"string 2\"])\n        } onComplete: { _ in\n            asyncWriteComplete.fulfill()\n        }\n\n        waitForExpectations(timeout: 1, handler: nil)\n        XCTAssertEqual(2, realm.objects(SwiftStringObject.self).count)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testBeginAsyncTransactionInAsyncTransaction() {\n        let realm = try! Realm()\n        let transaction1 = expectation(description: \"async transaction 1 complete\")\n        let transaction2 = expectation(description: \"async transaction 2 complete\")\n        XCTAssertEqual(0, realm.objects(SwiftStringObject.self).count)\n\n        realm.beginAsyncWrite {\n            realm.create(SwiftStringObject.self, value: [\"string\"])\n\n            realm.beginAsyncWrite {\n                realm.create(SwiftStringObject.self, value: [\"string 2\"])\n                realm.commitAsyncWrite { _ in\n                    transaction1.fulfill()\n                }\n            }\n            realm.commitAsyncWrite { _ in\n                transaction2.fulfill()\n            }\n        }\n\n        waitForExpectations(timeout: 1, handler: nil)\n        XCTAssertEqual(2, realm.objects(SwiftStringObject.self).count)\n    }\n\n    @MainActor\n    func testAsyncTransactionFromSyncTransaction() {\n        let realm = try! Realm()\n        let transaction1 = expectation(description: \"async transaction 1 complete\")\n\n        realm.beginWrite()\n        realm.create(SwiftStringObject.self, value: [\"string\"])\n\n        realm.beginAsyncWrite {\n            realm.create(SwiftStringObject.self, value: [\"string 2\"])\n            realm.commitAsyncWrite { _ in\n                transaction1.fulfill()\n            }\n        }\n\n        try! realm.commitWrite()\n\n        waitForExpectations(timeout: 1, handler: nil)\n        XCTAssertEqual(2, realm.objects(SwiftStringObject.self).count)\n    }\n\n    @MainActor\n    func testAsyncTransactionCancel() {\n        let waitComplete = expectation(description: \"async wait complete\")\n        let expectation = XCTestExpectation(description: \"testAsyncTransactionCancel expectation\")\n        expectation.expectedFulfillmentCount = 3\n        let unexpectation = XCTestExpectation(description: \"should not fulfill\")\n        unexpectation.isInverted = true\n\n        DispatchQueue.main.async { @MainActor in\n            let realm = try! Realm()\n            realm.beginAsyncWrite {\n                realm.create(SwiftStringObject.self, value: [\"string\"])\n                expectation.fulfill()\n            }\n            realm.beginAsyncWrite {\n                realm.create(SwiftStringObject.self, value: [\"string\"])\n                realm.commitAsyncWrite()\n                expectation.fulfill()\n            }\n            realm.beginAsyncWrite {\n                realm.create(SwiftStringObject.self, value: [\"string\"])\n                expectation.fulfill()\n                realm.commitAsyncWrite()\n            }\n            let asyncTransactionIdB = realm.beginAsyncWrite {\n                unexpectation.fulfill()\n            }\n            try! realm.cancelAsyncWrite(asyncTransactionIdB)\n            self.wait(for: [expectation, unexpectation], timeout: 3)\n            waitComplete.fulfill()\n        }\n\n        let realm = try! Realm()\n        self.wait(for: [waitComplete], timeout: 4)\n        XCTAssertEqual(2, realm.objects(SwiftStringObject.self).count)\n    }\n\n    @MainActor\n    func testAsyncTransactionCommit() {\n        let realm = try! Realm()\n        let changesAddedExpectation = expectation(description: \"testAsyncTransactionCommit expectation\")\n        changesAddedExpectation.expectedFulfillmentCount = 2\n\n        realm.beginAsyncWrite {\n            realm.create(SwiftStringObject.self, value: [\"with 'commit' should commit\"])\n            realm.commitAsyncWrite()\n            changesAddedExpectation.fulfill()\n        }\n        realm.beginAsyncWrite {\n            realm.create(SwiftStringObject.self, value: [\"without 'commit' should not commit\"])\n            changesAddedExpectation.fulfill()\n        }\n        let asyncTransactionId = realm.beginAsyncWrite {\n            realm.create(SwiftStringObject.self, value: [\"'cancel' after 'begin' should not commit\"])\n            realm.commitAsyncWrite()\n            changesAddedExpectation.fulfill()\n        }\n        try! realm.cancelAsyncWrite(asyncTransactionId)\n\n        waitForExpectations(timeout: 1, handler: nil)\n        XCTAssertEqual(1, realm.objects(SwiftStringObject.self).count)\n    }\n\n    @MainActor\n    func testAsyncTransactionShouldWriteObjectFromOutsideOfTransaction() {\n        let realm = try! Realm()\n        let asyncComplete = expectation(description: \"async transaction complete\")\n        let objU = SwiftStringObject(value: [\"string U\"])\n\n        realm.beginAsyncWrite {\n            realm.create(SwiftStringObject.self, value: [\"string I\"])\n            realm.add(objU)\n            realm.commitAsyncWrite { _ in\n                asyncComplete.fulfill()\n            }\n        }\n\n        waitForExpectations(timeout: 1, handler: nil)\n        XCTAssertNotNil(realm.objects(SwiftStringObject.self).first { $0.stringCol == \"string U\" })\n        XCTAssertNotNil(realm.objects(SwiftStringObject.self).first { $0.stringCol == \"string I\" })\n    }\n\n    @MainActor\n    func testAsyncTransactionShouldChangeExistingObject() {\n        let realm = try! Realm()\n        let asyncComplete = expectation(description: \"async transaction complete\")\n        try! realm.write({\n            realm.create(SwiftStringObject.self, value: [\"string A\"])\n        })\n        let objA = realm.objects(SwiftStringObject.self).first(where: { $0.stringCol == \"string A\" })!\n\n        realm.beginAsyncWrite {\n            objA.stringCol = \"string B\"\n            realm.commitAsyncWrite { _ in\n                asyncComplete.fulfill()\n            }\n        }\n\n        waitForExpectations(timeout: 1, handler: nil)\n        XCTAssertNil(realm.objects(SwiftStringObject.self).first { $0.stringCol == \"string A\" })\n        XCTAssertNotNil(realm.objects(SwiftStringObject.self).first { $0.stringCol == \"string B\" })\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nextension RealmTests {\n    // MARK: - Async Refresh\n\n    func manuallyAdvancedRealm() throws -> (Realm, String) {\n        let config = RLMRealmConfiguration.default()\n        config.disableAutomaticChangeNotifications = true\n        config.cache = false\n        return (ObjectiveCSupport.convert(object: try RLMRealm(configuration: config)), config.pathOnDisk)\n    }\n\n    @MainActor\n    func testAsyncRefresh() async throws {\n        let realm = try await openRealm(actor: MainActor.shared)\n        realm.autorefresh = false\n\n        let results = realm.objects(SwiftStringObject.self)\n        XCTAssertEqual(results.count, 0)\n        var didRefresh = await realm.asyncRefresh()\n        XCTAssertFalse(didRefresh)\n\n        try await Task { @CustomGlobalActor in\n            let realm = try await openRealm(actor: CustomGlobalActor.shared)\n            try! realm.write {\n                _ = realm.create(SwiftStringObject.self, value: [\"string\"])\n            }\n        }.value\n\n        XCTAssertEqual(results.count, 0)\n        didRefresh = await realm.asyncRefresh()\n        XCTAssertTrue(didRefresh)\n        XCTAssertEqual(results.count, 1)\n    }\n\n    @MainActor\n    func testAsyncRefreshWaitsForLatest() async throws {\n        let (realm, path) = try manuallyAdvancedRealm()\n        let results = realm.objects(SwiftStringObject.self)\n        // Observe so that it has to wait and can't just advance immediately\n        let token = results.observe { _ in }\n        XCTAssertEqual(results.count, 0)\n\n        let (realm2, _) = try manuallyAdvancedRealm()\n        try! realm2.write {\n            _ = realm2.create(SwiftStringObject.self, value: [\"string\"])\n        }\n        RLMRunAsyncNotifiers(path)\n        // Notifiers are now up to date for the above write, but the Realm hasn't\n        // been refreshed\n\n        try! realm2.write {\n            _ = realm2.create(SwiftStringObject.self, value: [\"string\"])\n        }\n        // Notifiers are now newer than the Realm, but still out of date\n\n        Task { @MainActor in\n            // This will run only when the parent task suspends as they're both\n            // on the main actor\n            RLMRunAsyncNotifiers(path)\n        }\n\n        XCTAssertEqual(results.count, 0)\n        // Here notify() will advance to the version with one object, but we\n        // need to wait for the version with two\n        let didRefresh = await realm.asyncRefresh()\n        XCTAssertTrue(didRefresh)\n        XCTAssertEqual(results.count, 2)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testAsyncRefreshWaitsForLatestAutorefreshOff() async throws {\n        let (realm, path) = try manuallyAdvancedRealm()\n        realm.autorefresh = false\n        let results = realm.objects(SwiftStringObject.self)\n        // Observe so that it has to wait and can't just advance immediately\n        let token = results.observe { _ in }\n        XCTAssertEqual(results.count, 0)\n\n        let (realm2, _) = try manuallyAdvancedRealm()\n        try! realm2.write {\n            _ = realm2.create(SwiftStringObject.self, value: [\"string\"])\n        }\n        RLMRunAsyncNotifiers(path)\n        // Notifiers are now up to date for the above write, but the Realm hasn't\n        // been refreshed\n\n        try! realm2.write {\n            _ = realm2.create(SwiftStringObject.self, value: [\"string\"])\n        }\n        // Notifiers are now newer than the Realm, but still out of date\n\n        Task { @MainActor in\n            // This will run only when the parent task suspends as they're both\n            // on the main actor\n            RLMRunAsyncNotifiers(path)\n        }\n\n        XCTAssertEqual(results.count, 0)\n        // Here notify() will advance to the version with one object, but we\n        // need to wait for the version with two\n        let didRefresh = await realm.asyncRefresh()\n        XCTAssertTrue(didRefresh)\n        XCTAssertEqual(results.count, 2)\n        token.invalidate()\n    }\n\n    @MainActor\n    func testAsyncRefreshWithMultipleWaiters() async throws {\n        let (realm, path) = try manuallyAdvancedRealm()\n        let results = realm.objects(SwiftStringObject.self)\n        let token = results.observe { _ in }\n        XCTAssertEqual(results.count, 0)\n\n        // The order of execution here is weird. Each of the nested tasks can\n        // run only when the outer task suspends, so this runs when we hit\n        // the bottom asyncRefresh(), and then the task with RLMRunAsyncNotifiers\n        // runs when we hit the inner asyncRefresh\n        let task = Task { @MainActor in\n            Task { @MainActor in\n                RLMRunAsyncNotifiers(path)\n            }\n            XCTAssertEqual(results.count, 0)\n            await realm.asyncRefresh()\n            XCTAssertEqual(results.count, 1)\n        }\n\n        let (realm2, _) = try manuallyAdvancedRealm()\n        try! realm2.write {\n            _ = realm2.create(SwiftStringObject.self, value: [\"string\"])\n        }\n\n        XCTAssertEqual(results.count, 0)\n        await realm.asyncRefresh()\n        XCTAssertEqual(results.count, 1)\n        // Verify that both continuations were resumed\n        _ = await task.value\n        token.invalidate()\n    }\n\n    @available(macOS 10.15.4, iOS 13.4, tvOS 13.4, watchOS 6.4, *)\n    func testAsyncRefreshOnQueueConfinedRealm() async throws {\n        let realm = Locked<Realm?>(wrappedValue: nil)\n        let queue = self.queue\n        dispatchSyncNewThread {\n            realm.wrappedValue = try! Realm(queue: queue)\n        }\n        // asyncRefresh() has to be called from a statically isolated context,\n        // but the test as whole can't be isolated (or the dispatch async breaks),\n        // and we have to hop to the actor before fork and not after or the child\n        // crashes before we get to the precondition\n        try await Task { @MainActor in\n            try await assertPreconditionFailure(\"asyncRefresh() can only be called on main thread or actor-isolated Realms\") {\n                _ = await realm.wrappedValue!.asyncRefresh()\n            }\n            try await assertPreconditionFailure(\"asyncWrite() can only be called on main thread or actor-isolated Realms\") {\n                _ = try await realm.wrappedValue!.asyncWrite { }\n            }\n        }.value\n    }\n\n    @MainActor\n    func testAsyncRefreshTaskCancellation() async throws {\n        let (realm, _) = try manuallyAdvancedRealm()\n        let results = realm.objects(SwiftStringObject.self)\n        let token = results.observe { _ in }\n\n        let (realm2, _) = try manuallyAdvancedRealm()\n        try! realm2.write {\n            _ = realm2.create(SwiftStringObject.self, value: [\"string\"])\n        }\n\n        let task = Task { @MainActor in\n            let didRefresh = await realm.asyncRefresh()\n            XCTAssertFalse(didRefresh)\n        }\n        task.cancel()\n        _ = await task.value\n        token.invalidate()\n    }\n\n    // MARK: - Async Writes\n\n    @MainActor\n    func testAsyncWriteBasics() async throws {\n        let realm = try await openRealm(actor: MainActor.shared)\n        let obj = try await realm.asyncWrite {\n            XCTAssertTrue(realm.isInWriteTransaction)\n            XCTAssertTrue(realm.isPerformingAsynchronousWriteOperations)\n            return realm.create(SwiftStringObject.self, value: [\"foo\"])\n        }\n        XCTAssertFalse(realm.isInWriteTransaction)\n        XCTAssertFalse(realm.isPerformingAsynchronousWriteOperations)\n        XCTAssertEqual(realm.objects(SwiftStringObject.self).count, 1)\n        XCTAssertEqual(obj.stringCol, \"foo\")\n    }\n\n    @MainActor\n    func testAsyncWriteCancel() async throws {\n        let realm = try await openRealm(actor: MainActor.shared)\n        try await realm.asyncWrite {\n            realm.create(SwiftStringObject.self, value: [\"foo\"])\n            realm.cancelWrite()\n            XCTAssertFalse(realm.isInWriteTransaction)\n        }\n        XCTAssertEqual(realm.objects(SwiftStringObject.self).count, 0)\n    }\n\n    @MainActor\n    func testAsyncWriteBeginNewWriteAfterCancel() async throws {\n        let realm = try await openRealm(actor: MainActor.shared)\n        try await realm.asyncWrite {\n            realm.create(SwiftStringObject.self, value: [\"foo\"])\n            realm.cancelWrite()\n            realm.beginWrite()\n            realm.create(SwiftStringObject.self, value: [\"bar\"])\n        }\n        let objects = realm.objects(SwiftStringObject.self)\n        XCTAssertEqual(objects.count, 1)\n        XCTAssertEqual(try XCTUnwrap(objects.first).stringCol, \"bar\")\n    }\n\n    @MainActor\n    func testAsyncWriteModifyExistingObject() async throws {\n        let realm = try await openRealm(actor: MainActor.shared)\n        let obj = try await realm.asyncWrite {\n            realm.create(SwiftStringObject.self, value: [\"foo\"])\n        }\n        try await realm.asyncWrite {\n            obj.stringCol = \"bar\"\n        }\n        XCTAssertEqual(obj.stringCol, \"bar\")\n    }\n\n    @MainActor\n    func testAsyncWriteCancelsOnThrow() async throws {\n        let realm = try await openRealm(actor: MainActor.shared)\n\n        await assertThrowsErrorAsync(try await realm.asyncWrite {\n            realm.create(SwiftStringObject.self, value: [\"foo\"])\n            throw Realm.Error(.fail)\n        }, Realm.Error(.fail))\n\n        await assertThrowsErrorAsync(try await realm.asyncWrite {\n            realm.create(SwiftStringObject.self, value: [\"foo\"])\n            realm.cancelWrite()\n            throw Realm.Error(.fail)\n        }, Realm.Error(.fail))\n\n        XCTAssertEqual(realm.objects(SwiftStringObject.self).count, 0)\n    }\n\n    @CustomGlobalActor\n    func testAsyncWriteCustomGlobalActor() async throws {\n        let realm = try await openRealm(actor: CustomGlobalActor.shared)\n        let obj = try await realm.asyncWrite {\n            realm.create(SwiftStringObject.self, value: [\"foo\"])\n        }\n        XCTAssertEqual(realm.objects(SwiftStringObject.self).count, 1)\n        XCTAssertEqual(obj.stringCol, \"foo\")\n        try await realm.asyncWrite {\n            obj.stringCol = \"bar\"\n        }\n        XCTAssertEqual(obj.stringCol, \"bar\")\n    }\n\n    func testAsyncWriteCustomActor() async throws {\n        actor TestActor {\n            var realm: Realm!\n            var obj: SwiftStringObject?\n            init() async throws {\n                realm = try await openRealm(actor: self)\n            }\n\n            var count: Int {\n                realm.objects(SwiftStringObject.self).count\n            }\n\n            var value: String? {\n                obj?.stringCol\n            }\n\n            func create() async throws {\n                obj = try await realm.asyncWrite {\n                    realm.create(SwiftStringObject.self, value: [\"foo\"])\n                }\n            }\n\n            func modify() async throws {\n                try await realm.asyncWrite {\n                    obj?.stringCol = \"bar\"\n                }\n            }\n\n            func close() {\n                realm = nil\n                obj = nil\n            }\n        }\n        let actor = try await TestActor()\n        var count = await actor.count\n        XCTAssertEqual(count, 0)\n\n        try await actor.create()\n        count = await actor.count\n        var value = await actor.value\n        XCTAssertEqual(count, 1)\n        XCTAssertEqual(value, \"foo\")\n\n        try await actor.modify()\n        count = await actor.count\n        value = await actor.value\n        XCTAssertEqual(count, 1)\n        XCTAssertEqual(value, \"bar\")\n\n        await actor.close()\n    }\n\n    @MainActor\n    func testAsyncWriteTaskCancellation() async throws {\n        let realm = try await openRealm(actor: MainActor.shared)\n        realm.beginWrite()\n\n        let ex = expectation(description: \"Background thread ready\")\n        let task = Task { @CustomGlobalActor in\n            let realm = try await openRealm(actor: CustomGlobalActor.shared)\n            ex.fulfill()\n            try await realm.asyncWrite {\n                XCTFail(\"Should not have been called\")\n            }\n        }\n        await fulfillment(of: [ex], timeout: 2.0)\n        Task { @CustomGlobalActor in\n            // Cancel the task from within its actor so that we can be sure\n            // that it has suspended with the task cancellation handler set\n            task.cancel()\n        }\n        await assertThrowsErrorAsync(try await task.value, CancellationError())\n        realm.cancelWrite()\n    }\n\n    @MainActor\n    func testAsyncWriteTaskCancelledBeforeWriteCalled() async throws {\n        let realm = try await openRealm(actor: MainActor.shared)\n        realm.beginWrite()\n\n        let ex = expectation(description: \"Background thread ready\")\n        let task = Task { @CustomGlobalActor in\n            let realm = try await openRealm(actor: CustomGlobalActor.shared)\n            ex.fulfill()\n            // Block until cancelWrite() is called, ensuring that the Task is\n            // cancelled before the call to asyncWrite\n            realm.beginWrite()\n            realm.cancelWrite()\n            try await realm.asyncWrite {\n                XCTFail(\"Should not have been called\")\n            }\n        }\n        await fulfillment(of: [ex], timeout: 2.0)\n        task.cancel()\n        realm.cancelWrite()\n\n        await assertThrowsErrorAsync(try await task.value, CancellationError())\n    }\n\n    // FIXME: deadlocks without https://github.com/realm/realm-core/pull/6413\n    @MainActor\n    func skip_testAsyncWriteTaskCancellationTiming() async throws {\n        let realm = try await openRealm(actor: MainActor.shared)\n        realm.beginWrite()\n\n        // Try to hit the timing windows which can't be deterministically tested\n        // by just repeating it a bunch of times. This should trigger tsan errors\n        // if the locking is incorrect.\n        for _ in 0..<1000 {\n            let ex = expectation(description: \"Background thread ready\")\n            let task = Task { @CustomGlobalActor in\n                let realm = try await openRealm(actor: CustomGlobalActor.shared)\n                // Tearing down a Realm which is in the middle of async writes\n                // is itself async, so we need to explicitly wait for that to\n                // happen or we'll hit a data race when we try to close all\n                // remaining open Realms in tearDown\n                defer { realm.invalidate() }\n                ex.fulfill()\n                try await realm.asyncWrite {\n                    XCTFail(\"Should not have been called\")\n                }\n            }\n            await fulfillment(of: [ex], timeout: 2.0)\n            task.cancel()\n            await assertThrowsErrorAsync(try await task.value, CancellationError())\n        }\n        realm.cancelWrite()\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\n@globalActor actor CustomGlobalActor: GlobalActor {\n#if compiler(<6.2)\n    static var shared = CustomGlobalActor()\n#else\n    static let shared = CustomGlobalActor()\n#endif\n}\n\n#if compiler(<6)\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension CancellationError: Equatable {\n    public static func == (lhs: CancellationError, rhs: CancellationError) -> Bool {\n        true\n    }\n}\n#else\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\nextension CancellationError: @retroactive Equatable {\n    public static func == (lhs: CancellationError, rhs: CancellationError) -> Bool {\n        true\n    }\n}\n#endif\n\n// Helper\nextension LogLevel {\n    var logLevel: String {\n        switch self {\n        case .off:\n            return \"Off\"\n        case .fatal:\n            return \"Fatal\"\n        case .error:\n            return \"Error\"\n        case .warn:\n            return \"Warn\"\n        case .info:\n            return \"Info\"\n        case .detail:\n            return \"Details\"\n        case .debug:\n            return \"Debug\"\n        case .trace:\n            return \"Trace\"\n        case .all:\n            return \"All\"\n        default:\n            return \"unknown\"\n        }\n    }\n}\n\n@available(macOS 12.0, watchOS 8.0, iOS 15.0, tvOS 15.0, macCatalyst 15.0, *)\nclass LoggerTests: TestCase {\n    var logger: Logger!\n    override func setUp() {\n        logger = Logger.shared\n    }\n    override func tearDown() {\n        Logger.shared = logger\n    }\n    func testSetDefaultLogLevel() throws {\n        nonisolated(unsafe) var logs: String = \"\"\n        let logger = Logger(level: .off) { level, message in\n            logs += \"\\(Date.now) \\(level.logLevel) \\(message)\"\n        }\n        Logger.shared = logger\n\n        try autoreleasepool { _ = try Realm() }\n        XCTAssertTrue(logs.isEmpty)\n\n        logger.level = .all\n        try autoreleasepool { _ = try Realm() } // We should be getting logs after changing the log level\n        XCTAssertEqual(Logger.shared.level, .all)\n        XCTAssertTrue(logs.contains(\"Details DB:\"))\n        XCTAssertTrue(logs.contains(\"Trace DB:\"))\n    }\n\n    func testDefaultLogger() throws {\n        nonisolated(unsafe) var logs: String = \"\"\n        let logger = Logger(level: .off) { level, message in\n            logs += \"\\(Date.now) \\(level.logLevel) \\(message)\"\n        }\n        Logger.shared = logger\n\n        XCTAssertEqual(Logger.shared.level, .off)\n        try autoreleasepool { _ = try Realm() }\n        XCTAssertTrue(logs.isEmpty)\n\n        // Info\n        logger.level = .detail\n        try autoreleasepool { _ = try Realm() }\n\n        XCTAssertTrue(!logs.isEmpty)\n        XCTAssertTrue(logs.contains(\"Details DB:\"))\n\n        // Trace\n        logs = \"\"\n        logger.level = .trace\n        try autoreleasepool { _ = try Realm() }\n\n        XCTAssertTrue(!logs.isEmpty)\n        XCTAssertTrue(logs.contains(\"Trace DB:\"))\n\n        // Detail\n        logs = \"\"\n        logger.level = .detail\n        try autoreleasepool { _ = try Realm() }\n\n        XCTAssertTrue(!logs.isEmpty)\n        XCTAssertTrue(logs.contains(\"Details DB:\"))\n        XCTAssertFalse(logs.contains(\"Trace DB:\"))\n\n        logs = \"\"\n        Logger.shared = Logger(level: .trace) { level, message in\n            logs += \"\\(Date.now) \\(level.logLevel) \\(message)\"\n        }\n        XCTAssertEqual(Logger.shared.level, .trace)\n        try autoreleasepool { _ = try Realm() }\n        XCTAssertTrue(!logs.isEmpty)\n        XCTAssertTrue(logs.contains(\"Details DB:\"))\n        XCTAssertTrue(logs.contains(\"Trace DB:\"))\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/SchemaTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\nclass SchemaTests: TestCase {\n    var schema: Schema!\n\n    override func setUp() {\n        super.setUp()\n        autoreleasepool {\n            self.schema = try! Realm().schema\n        }\n    }\n\n    func testObjectSchema() {\n        let objectSchema = schema.objectSchema\n        XCTAssertTrue(objectSchema.count > 0)\n    }\n\n    func testDescription() {\n        XCTAssert(schema.description as Any is String)\n    }\n\n    func testSubscript() {\n        XCTAssertEqual(schema[\"SwiftObject\"]!.className, \"SwiftObject\")\n        XCTAssertNil(schema[\"NoSuchClass\"])\n    }\n\n    func testEquals() {\n        XCTAssertTrue(try! schema == Realm().schema)\n    }\n\n    func testNoSchemaForUnpersistedObjectClasses() {\n        XCTAssertNil(schema[\"RLMObject\"])\n        XCTAssertNil(schema[\"RLMObjectBase\"])\n        XCTAssertNil(schema[\"RLMDynamicObject\"])\n        XCTAssertNil(schema[\"Object\"])\n        XCTAssertNil(schema[\"DynamicObject\"])\n        XCTAssertNil(schema[\"MigrationObject\"])\n    }\n\n    func testValidNestedClass() throws {\n        let privateSubclass = try XCTUnwrap(schema[\"PrivateObjectSubclass\"])\n        XCTAssertEqual(privateSubclass.className, \"PrivateObjectSubclass\")\n\n        let parent = try XCTUnwrap(schema[\"ObjectWithNestedEmbeddedObject\"])\n        XCTAssertEqual(parent.properties[1].objectClassName, \"ObjectWithNestedEmbeddedObject_NestedInnerClass\")\n        XCTAssertNotNil(schema[\"ObjectWithNestedEmbeddedObject_NestedInnerClass\"])\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/SectionedResultsTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2022 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\n#endif\n\nclass BaseSectionedResultsTests: RLMTestCaseBase {\n    var realm: Realm?\n    var obj: ModernAllTypesObject?\n\n    override func tearDown() {\n        obj = nil\n        realm = nil\n    }\n\n    override func invokeTest() {\n        autoreleasepool { super.invokeTest() }\n    }\n}\n\nclass BasePrimitiveSectionedResultsTests<TestData: SectionedResultsTestData>: RLMTestCaseBase {\n    var realm: Realm?\n    var obj: ModernAllTypesObject?\n\n    override func setUp() {\n        realm = try! Realm(configuration: .init(inMemoryIdentifier: \"BasePrimitiveSectionedResultsTests\",\n                                                objectTypes: [ModernAllTypesObject.self]))\n        obj = TestData.setupObject()\n        try! realm?.write {\n            realm?.add(obj!)\n        }\n        super.setUp()\n    }\n\n    override func tearDown() {\n        obj = nil\n        realm = nil\n    }\n\n    override func invokeTest() {\n        autoreleasepool { super.invokeTest() }\n    }\n\n    private func assert<T: RealmCollection>(_ collection: T, ascending: Bool = true) where T.Element == TestData.Element {\n        let sectionedResults = collection.sectioned(by: TestData.sectionBlock, ascending: ascending)\n        var sectionCount = 0\n        var elementCount = 0\n        let keys = TestData.orderedKeys(ascending: ascending)\n        for section in sectionedResults {\n            XCTAssertEqual(section.key, keys[sectionCount])\n            sectionCount += 1\n            let expValues = ascending ? TestData.expectedSectionedValues[section.key] : TestData.expectedSectionedValues[section.key]!.reversed()\n            for (i, value) in expValues!.enumerated() {\n                XCTAssertEqual(section[i], value)\n                elementCount += 1\n            }\n        }\n        XCTAssertEqual(sectionCount, TestData.expectedSectionedValues.keys.count)\n        XCTAssertEqual(elementCount, TestData.expectedSectionedValues.values.flatMap { $0 }.count)\n    }\n\n    func testCreationFromResults() {\n        if !TestData.skipResultsTests {\n            let results = TestData.results(obj!)\n            assert(results)\n            assert(results, ascending: false)\n        }\n    }\n\n    func testCreationFromList() {\n        let list = TestData.list(obj!)\n        assert(list)\n        assert(list, ascending: false)\n    }\n\n    func testCreationFromMutableSet() {\n        let set = TestData.mutableSet(obj!)\n        assert(set)\n        assert(set, ascending: false)\n    }\n\n    func testCreationFromAnyRealmCollection() {\n        if !TestData.skipResultsTests {\n            let collection = TestData.anyRealmCollection(obj!)\n            assert(collection)\n            assert(collection, ascending: false)\n        }\n    }\n\n    func testFrozenFromParentCollection() {\n        let collection = TestData.list(obj!)\n        let sectionedResults = collection.sectioned(by: TestData.sectionBlock)\n        XCTAssertFalse(sectionedResults.isFrozen)\n        let frozenCollection = collection.freeze()\n        let frozenSectionedResults = frozenCollection.sectioned(by: TestData.sectionBlock)\n        XCTAssertTrue(frozenSectionedResults.isFrozen)\n        XCTAssertEqual(frozenSectionedResults.count, TestData.expectedSectionedValues.count)\n\n        guard let thawedSectionedResults = frozenSectionedResults.thaw() else {\n            return XCTFail(\"Could not thaw sectioned results.\")\n        }\n        XCTAssertFalse(thawedSectionedResults.isFrozen)\n        XCTAssertEqual(thawedSectionedResults.count, TestData.expectedSectionedValues.count)\n    }\n\n    func testFrozen() {\n        let collection = TestData.list(obj!)\n        let sectionedResults = collection.sectioned(by: TestData.sectionBlock)\n        XCTAssertFalse(sectionedResults.isFrozen)\n        let frozenSectionedResults = sectionedResults.freeze()\n        XCTAssertTrue(frozenSectionedResults.isFrozen)\n        XCTAssertEqual(frozenSectionedResults.count, TestData.expectedSectionedValues.count)\n\n        guard let thawedSectionedResults = frozenSectionedResults.thaw() else {\n            return XCTFail(\"Could not thaw sectioned results.\")\n        }\n        XCTAssertFalse(thawedSectionedResults.isFrozen)\n        XCTAssertEqual(thawedSectionedResults.count, TestData.expectedSectionedValues.count)\n    }\n}\n\n// swiftlint:disable:next type_name\nclass BaseOptionalPrimitiveSectionedResultsTests<TestData: OptionalSectionedResultsTestData>: BaseSectionedResultsTests {\n    override func setUp() {\n        realm = try! Realm(configuration: .init(inMemoryIdentifier: \"BaseOptionalPrimitiveSectionedResultsTests\",\n                                                objectTypes: [ModernAllTypesObject.self]))\n        obj = TestData.setupObject()\n        try! realm?.write {\n            realm?.add(obj!)\n        }\n        super.setUp()\n    }\n\n    private func assertOptional<T: RealmCollection>(_ collection: T, asending: Bool = true) where T.Element == Optional<TestData.Element> {\n        let sectionedResults = collection.sectioned(by: TestData.sectionBlock, ascending: asending)\n        var sectionCount = 0\n        var elementCount = 0\n        let keys = TestData.orderedKeysOpt(ascending: asending)\n        for section in sectionedResults {\n            XCTAssertEqual(section.key, keys[sectionCount])\n            sectionCount += 1\n            let expValues = asending ? TestData.expectedSectionedValuesOpt[section.key] : TestData.expectedSectionedValuesOpt[section.key]!.reversed()\n            for (i, value) in expValues!.enumerated() {\n                XCTAssertEqual(section[i], value)\n                elementCount += 1\n            }\n        }\n        XCTAssertEqual(sectionCount, TestData.expectedSectionedValuesOpt.keys.count)\n        XCTAssertEqual(elementCount, TestData.expectedSectionedValuesOpt.values.flatMap { $0 }.count)\n    }\n\n    func testCreationFromResultsOptional() {\n        if !TestData.skipResultsTests {\n            let results = TestData.resultsOpt(obj!)\n            assertOptional(results)\n            assertOptional(results, asending: false)\n        }\n    }\n\n    func testCreationFromListOptional() {\n        let list = TestData.listOpt(obj!)\n        assertOptional(list)\n        assertOptional(list, asending: false)\n    }\n\n    func testCreationFromMutableSetOptional() {\n        let set = TestData.mutableSetOpt(obj!)\n        assertOptional(set)\n        assertOptional(set, asending: false)\n    }\n\n    func testCreationFromAnyRealmCollectionOptional() {\n        if !TestData.skipResultsTests {\n            let collection = TestData.anyRealmCollectionOpt(obj!)\n            assertOptional(collection)\n            assertOptional(collection, asending: false)\n        }\n    }\n\n    func testEquality() {\n        let collection = TestData.listOpt(obj!)\n        let sectionedResults = collection.sectioned(by: TestData.sectionBlock)\n        let sectionedResults2 = collection.sectioned(by: TestData.sectionBlock)\n        XCTAssertEqual(sectionedResults, sectionedResults)\n        XCTAssertNotEqual(sectionedResults, sectionedResults2)\n    }\n\n    func testFrozenFromParentCollection() {\n        let collection = TestData.listOpt(obj!)\n        let sectionedResults = collection.sectioned(by: TestData.sectionBlock)\n        XCTAssertFalse(sectionedResults.isFrozen)\n        let frozenCollection = collection.freeze()\n        let frozenSectionedResults = frozenCollection.sectioned(by: TestData.sectionBlock)\n        XCTAssertTrue(frozenSectionedResults.isFrozen)\n        XCTAssertEqual(frozenSectionedResults.count, TestData.expectedSectionedValuesOpt.count)\n\n        guard let thawedSectionedResults = frozenSectionedResults.thaw() else {\n            return XCTFail(\"Could not thaw sectioned results.\")\n        }\n        XCTAssertFalse(thawedSectionedResults.isFrozen)\n        XCTAssertEqual(thawedSectionedResults.count, TestData.expectedSectionedValuesOpt.count)\n    }\n\n    func testFrozen() {\n        let collection = TestData.listOpt(obj!)\n        let sectionedResults = collection.sectioned(by: TestData.sectionBlock)\n        XCTAssertFalse(sectionedResults.isFrozen)\n        let frozenSectionedResults = sectionedResults.freeze()\n        XCTAssertTrue(frozenSectionedResults.isFrozen)\n        XCTAssertEqual(frozenSectionedResults.count, TestData.expectedSectionedValuesOpt.count)\n\n        guard let thawedSectionedResults = frozenSectionedResults.thaw() else {\n            return XCTFail(\"Could not thaw sectioned results.\")\n        }\n        XCTAssertFalse(thawedSectionedResults.isFrozen)\n        XCTAssertEqual(thawedSectionedResults.count, TestData.expectedSectionedValuesOpt.count)\n    }\n}\n\nclass PrimitiveSectionedResultsTests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        let suite = XCTestSuite(name: \"Primitive SectionedResults Tests\")\n\n        BasePrimitiveSectionedResultsTests<SectionedResultsTestDataInt>.defaultTestSuite.tests.forEach(suite.addTest)\n        BasePrimitiveSectionedResultsTests<SectionedResultsTestDataBool>.defaultTestSuite.tests.forEach(suite.addTest)\n        BasePrimitiveSectionedResultsTests<SectionedResultsTestDataFloat>.defaultTestSuite.tests.forEach(suite.addTest)\n        BasePrimitiveSectionedResultsTests<SectionedResultsTestDataDouble>.defaultTestSuite.tests.forEach(suite.addTest)\n        BasePrimitiveSectionedResultsTests<SectionedResultsTestDataString>.defaultTestSuite.tests.forEach(suite.addTest)\n        BasePrimitiveSectionedResultsTests<SectionedResultsTestDataAnyRealmValue>.defaultTestSuite.tests.forEach(suite.addTest)\n        BasePrimitiveSectionedResultsTests<SectionedResultsTestDataBinary>.defaultTestSuite.tests.forEach(suite.addTest)\n        BasePrimitiveSectionedResultsTests<SectionedResultsTestDataDate>.defaultTestSuite.tests.forEach(suite.addTest)\n        BasePrimitiveSectionedResultsTests<SectionedResultsTestDataDecimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        BaseOptionalPrimitiveSectionedResultsTests<SectionedResultsTestDataOptionalInt>.defaultTestSuite.tests.forEach(suite.addTest)\n        BaseOptionalPrimitiveSectionedResultsTests<SectionedResultsTestDataOptionalBool>.defaultTestSuite.tests.forEach(suite.addTest)\n        BaseOptionalPrimitiveSectionedResultsTests<SectionedResultsTestDataOptionalFloat>.defaultTestSuite.tests.forEach(suite.addTest)\n        BaseOptionalPrimitiveSectionedResultsTests<SectionedResultsTestDataOptionalDouble>.defaultTestSuite.tests.forEach(suite.addTest)\n        BaseOptionalPrimitiveSectionedResultsTests<SectionedResultsTestDataOptionalString>.defaultTestSuite.tests.forEach(suite.addTest)\n        BaseOptionalPrimitiveSectionedResultsTests<SectionedResultsTestDataOptionalBinary>.defaultTestSuite.tests.forEach(suite.addTest)\n        BaseOptionalPrimitiveSectionedResultsTests<SectionedResultsTestDataOptionalDate>.defaultTestSuite.tests.forEach(suite.addTest)\n        BaseOptionalPrimitiveSectionedResultsTests<SectionedResultsTestDataOptionalDecimal128>.defaultTestSuite.tests.forEach(suite.addTest)\n\n        return suite\n    }\n}\n\nextension ModernAllTypesObject {\n    var firstLetter: String? {\n        stringCol.first.map { String($0) }\n    }\n}\n\nextension ModernAllTypesProjection {\n    var firstLetter: String? {\n        stringCol.first.map { String($0) }\n    }\n}\n\nclass SectionedResultsTestsBase: RLMTestCaseBase {\n    func createObjects(_ r: Realm? = nil) -> Realm {\n        let o1 = ModernAllTypesObject()\n        o1.stringCol = \"banana\"\n        o1.arrayString.append(objectsIn: [\"banana\", \"box\", \"apple\", \"chalk\"])\n        o1.setString.insert(objectsIn: [\"banana\", \"box\", \"apple\", \"chalk\"])\n        let o2 = ModernAllTypesObject()\n        o2.stringCol = \"box\"\n        let o3 = ModernAllTypesObject()\n        o3.stringCol = \"apple\"\n        let o4 = ModernAllTypesObject()\n        o4.stringCol = \"chalk\"\n        let realm = try! r ?? Realm(configuration: .init(inMemoryIdentifier: \"sectioned results test\"))\n        try! realm.write {\n            realm.deleteAll()\n            realm.add([o1, o2, o3, o4])\n        }\n        return realm\n    }\n}\n\nclass SectionedResultsTests: SectionedResultsTestsBase {\n    func testCreationFromResults() {\n        let realm = createObjects()\n        let results = realm.objects(ModernAllTypesObject.self)\n\n        func assert(ascending: Bool, sectionCount: Int, sectionKeys: [String]) {\n            let sectionedResults = results.sectioned(by: \\.firstLetter, ascending: ascending)\n            XCTAssertEqual(sectionedResults.count, sectionCount)\n            XCTAssertEqual(sectionedResults.map { $0.key }, sectionKeys)\n\n            let sectionedResults2 = results.sectioned(by: \\.firstLetter,\n                                                      sortDescriptors: [SortDescriptor.init(keyPath: \"stringCol\", ascending: ascending)])\n            XCTAssertEqual(sectionedResults2.count, sectionCount)\n            XCTAssertEqual(sectionedResults2.map { $0.key }, sectionKeys)\n            let sectionedResults3 = results.sectioned(by: { String($0.stringCol.first!) },\n                                                      sortDescriptors: [SortDescriptor.init(keyPath: \"stringCol\", ascending: ascending)])\n            XCTAssertEqual(sectionedResults3.count, sectionCount)\n            XCTAssertEqual(sectionedResults3.map { $0.key }, sectionKeys)\n        }\n\n        assert(ascending: true, sectionCount: 3, sectionKeys: [\"a\", \"b\", \"c\"])\n        assert(ascending: false, sectionCount: 3, sectionKeys: [\"c\", \"b\", \"a\"])\n    }\n\n    func testCreationFromList() {\n        let realm = createObjects()\n        let list = realm.objects(ModernAllTypesObject.self)[0].arrayString\n\n        func assert(ascending: Bool, sectionCount: Int, sectionKeys: [String]) {\n            let sectionedResults = list.sectioned(by: { String($0.first!) }, ascending: ascending)\n            XCTAssertEqual(sectionedResults.count, sectionCount)\n            XCTAssertEqual(sectionedResults.map { $0.key }, sectionKeys)\n        }\n\n        assert(ascending: true, sectionCount: 3, sectionKeys: [\"a\", \"b\", \"c\"])\n        assert(ascending: false, sectionCount: 3, sectionKeys: [\"c\", \"b\", \"a\"])\n    }\n\n    func testCreateFromMutableSet() {\n        let realm = createObjects()\n        let set = realm.objects(ModernAllTypesObject.self)[0].setString\n\n        func assert(ascending: Bool, sectionCount: Int, sectionKeys: [String]) {\n            let sectionedResults = set.sectioned(by: { String($0.first!) }, ascending: ascending)\n            XCTAssertEqual(sectionedResults.count, sectionCount)\n            XCTAssertEqual(sectionedResults.map { $0.key }, sectionKeys)\n        }\n\n        assert(ascending: true, sectionCount: 3, sectionKeys: [\"a\", \"b\", \"c\"])\n        assert(ascending: false, sectionCount: 3, sectionKeys: [\"c\", \"b\", \"a\"])\n    }\n\n    func testAllKeys() {\n        let realm = createObjects()\n        let results = realm.objects(ModernAllTypesObject.self)\n        let sectionedResults = results.sectioned(by: \\.firstLetter, ascending: true)\n        XCTAssertEqual(sectionedResults.allKeys, [\"a\", \"b\", \"c\"])\n    }\n\n    func testSubscript() {\n        let realm = createObjects()\n        let results = realm.objects(ModernAllTypesObject.self)\n        let sectionedResults = results.sectioned(by: \\.firstLetter, ascending: true)\n        let section = sectionedResults[0]\n        XCTAssertEqual(section.count, 1)\n        var obj = section[0]\n        XCTAssertEqual(obj.stringCol, \"apple\")\n        obj = sectionedResults[IndexPath(item: 0, section: 0)]\n        XCTAssertEqual(obj.stringCol, \"apple\")\n    }\n\n    @MainActor\n    func testObservation() {\n        let realm = createObjects()\n        let results = realm.objects(ModernAllTypesObject.self)\n        let sectionedResults = results.sectioned(by: \\.firstLetter, ascending: true)\n        let ex = expectation(description: \"initial notification\")\n        let token = sectionedResults.observe { (changes: SectionedResultsChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 3)\n            case .update:\n                XCTFail(\"Shouldn't happen\")\n            }\n\n            ex.fulfill()\n        }\n        waitForExpectations(timeout: 1, handler: nil)\n\n        // add a second notification and wait for it\n        var ex2 = expectation(description: \"second initial notification\")\n        let token2 = sectionedResults.observe { _ in\n            ex2.fulfill()\n        }\n        waitForExpectations(timeout: 1, handler: nil)\n\n        // make a write and implicitly verify that only the unskipped\n        // notification is called (the first would error on .update)\n        ex2 = expectation(description: \"change notification\")\n\n        try! realm.write(withoutNotifying: [token]) {\n            realm.delete(results)\n        }\n        waitForExpectations(timeout: 1, handler: nil)\n        token.invalidate()\n        token2.invalidate()\n    }\n\n    @MainActor\n    func testObserveWithKeyPathFilter() {\n        let realm = createObjects()\n        let results = realm.objects(ModernAllTypesObject.self)\n        let sectionedResults = results.sectioned(by: \\.firstLetter, ascending: true)\n\n        let ex = expectation(description: \"notifications\")\n        ex.expectedFulfillmentCount = 3\n        let token = sectionedResults.observe(keyPaths: [\\.boolCol]) { _ in\n            ex.fulfill()\n        }\n\n        let obj = results.where { $0.stringCol.starts(with: \"a\") }[0]\n        // Expect notification as changing sections.\n        try! realm.write {\n            obj.stringCol = \"box\"\n        }\n        // Expect notification as the observed property is modified.\n        try! realm.write {\n            obj.boolCol = true\n        }\n        waitForExpectations(timeout: 1.0)\n\n        let exRealm = expectation(description: \"notifications\")\n        exRealm.expectedFulfillmentCount = 2\n        let realmToken = realm.observe { _, _ in\n            exRealm.fulfill()\n        }\n        // Expect no notification as the object will not change sections.\n        try! realm.write {\n            obj.stringCol = \"box\"\n        }\n        try! realm.write {\n            obj.stringCol = \"box\"\n        }\n        waitForExpectations(timeout: 1)\n\n        token.invalidate()\n        realmToken.invalidate()\n    }\n\n    @MainActor\n    func testObserveWithKeyPathFilterOnSection() {\n        let realm = createObjects()\n        let results = realm.objects(ModernAllTypesObject.self)\n        let sectionedResults = results.sectioned(by: \\.firstLetter, ascending: true)[0]\n\n        let ex = expectation(description: \"notifications\")\n        ex.expectedFulfillmentCount = 2\n        let token = sectionedResults.observe(keyPaths: [\\.boolCol]) { _ in\n            ex.fulfill()\n        }\n\n        let obj = results.where { $0.stringCol.starts(with: \"a\") }[0]\n        try! realm.write {\n            obj.boolCol = false\n        }\n        waitForExpectations(timeout: 1.0)\n\n        let exRealm = expectation(description: \"notifications\")\n        exRealm.expectedFulfillmentCount = 2\n        let realmToken = realm.observe { _, _ in\n            exRealm.fulfill()\n        }\n        // Expect no notification as the object will not change sections.\n        try! realm.write {\n            obj.intCol = 123\n        }\n        try! realm.write {\n            obj.intCol = 456\n        }\n        waitForExpectations(timeout: 1)\n\n        token.invalidate()\n        realmToken.invalidate()\n    }\n\n    func testObserveOnQueue() {\n        let realm = createObjects()\n        let results = realm.objects(ModernAllTypesObject.self)\n        let sectionedResults = results.sectioned(by: \\.firstLetter, ascending: true)\n        let sema = DispatchSemaphore(value: 0)\n        let queue = DispatchQueue(label: \"background\")\n        var firstRun = true\n        let token = sectionedResults.observe(keyPaths: [\\.stringCol],\n                                             on: queue) { (changes: SectionedResultsChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 3)\n            case let .update(collection, deletions: deletions, insertions: insertions, modifications: modifications,\n                             sectionsToInsert: sectionsToInsert, sectionsToDelete: sectionsToDelete):\n                if firstRun {\n                    XCTAssertEqual(collection.count, 3)\n                    XCTAssertEqual(sectionsToDelete, [0])\n                    XCTAssertEqual(sectionsToInsert, [2])\n                    XCTAssertEqual(deletions.count, 2)\n                    XCTAssertEqual(deletions, [IndexPath(item: 0, section: 1), IndexPath(item: 1, section: 1)])\n                    XCTAssertTrue(modifications.isEmpty)\n                    XCTAssertEqual(insertions.count, 2)\n                    XCTAssertEqual(insertions, [IndexPath(item: 0, section: 0),\n                                                IndexPath(item: 0, section: 2)])\n                } else {\n                    XCTAssertEqual(collection.count, 3)\n                    XCTAssertTrue(sectionsToDelete.isEmpty)\n                    XCTAssertTrue(sectionsToInsert.isEmpty)\n                    XCTAssertTrue(deletions.isEmpty)\n                    XCTAssertTrue(insertions.isEmpty)\n                    XCTAssertEqual(modifications.count, 1)\n                    XCTAssertEqual(modifications, [IndexPath(item: 0, section: 0)])\n                }\n            }\n            XCTAssertFalse(Thread.isMainThread)\n            sema.signal()\n        }\n        sema.wait()\n\n        try! realm.write {\n            realm.delete([results[2], results[0]]) // banana, apple\n            results[0].stringCol = \"bog\" // previously: box\n            let o = ModernAllTypesObject()\n            o.stringCol = \"zebra\"\n            realm.add(o)\n        }\n        sema.wait()\n        // Check modifications.\n        firstRun = false\n        try! realm.write {\n            results[0].stringCol = \"bogg\" // previously: bog\n            results[1].intCol = 1 // should be ignored.\n        }\n        sema.wait()\n        token.invalidate()\n    }\n\n    func testObservationOnSection() {\n        let realm = createObjects()\n        let results = realm.objects(ModernAllTypesObject.self)\n        let sectionedResults = results.sectioned(by: \\.firstLetter, ascending: true)\n        let section1 = sectionedResults[0]\n        let section2 = sectionedResults[1]\n\n        var firstRun = true\n        // Only get notifications for key 'a'.\n        let token1 = section1.observe(keyPaths: [\\.stringCol]) { (changes: SectionedResultsChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 1)\n            case let .update(collection, deletions: deletions, insertions: insertions, modifications: modifications,\n                             sectionsToInsert: sectionsToInsert, sectionsToDelete: sectionsToDelete):\n                if firstRun {\n                    XCTAssertEqual(sectionsToDelete, [0])\n                    XCTAssertTrue(sectionsToInsert.isEmpty)\n                    XCTAssertTrue(deletions.isEmpty)\n                    XCTAssertTrue(modifications.isEmpty)\n                    XCTAssertTrue(insertions.isEmpty)\n                } else {\n                    XCTAssertEqual(collection.count, 1)\n                    XCTAssertEqual(insertions, [IndexPath(item: 0, section: 0)])\n                    XCTAssertEqual(sectionsToInsert, [0])\n                }\n            }\n        }\n\n        // Only get notifications for key 'b'.\n        let token2 = section2.observe(keyPaths: [\\.stringCol]) { (changes: SectionedResultsChange) in\n            switch changes {\n            case .initial(let collection):\n                if firstRun {\n                    XCTAssertEqual(collection.count, 2)\n                }\n            case let .update(collection, deletions: deletions, insertions: insertions, modifications: modifications,\n                             sectionsToInsert: sectionsToInsert, sectionsToDelete: sectionsToDelete):\n                if firstRun {\n                    XCTAssertEqual(collection.count, 1)\n                    XCTAssertTrue(sectionsToDelete.isEmpty)\n                    XCTAssertTrue(sectionsToInsert.isEmpty)\n                    XCTAssertEqual(deletions, [IndexPath(item: 0, section: 1)])\n                    XCTAssertTrue(modifications.isEmpty)\n                    XCTAssertTrue(insertions.isEmpty)\n                } else {\n                    XCTAssertEqual(collection.count, 2)\n                    XCTAssertTrue(sectionsToDelete.isEmpty)\n                    XCTAssertTrue(sectionsToInsert.isEmpty)\n                    XCTAssertEqual(deletions, [IndexPath(item: 0, section: 0)])\n                    XCTAssertTrue(modifications.isEmpty)\n                    XCTAssertEqual(insertions, [IndexPath(item: 0, section: 0), IndexPath(item: 1, section: 0)])\n                }\n            }\n        }\n\n        try! realm.write {\n            realm.delete([results[2], results[0]]) // banana, apple\n        }\n        try! realm.write {}\n        firstRun = false\n        try! realm.write {\n            results[0].stringCol = \"bog\" // previously: box\n            let o = ModernAllTypesObject()\n            o.stringCol = \"bag\"\n            realm.add(o)\n        }\n        try! realm.write {}\n        try! realm.write {\n            let o = ModernAllTypesObject()\n            o.stringCol = \"app\"\n            realm.add(o)\n        }\n        try! realm.write {}\n        token1.invalidate()\n        token2.invalidate()\n    }\n\n    func testObservationOnSectionOnQueue() {\n        let realm = createObjects()\n        let results = realm.objects(ModernAllTypesObject.self)\n        let sectionedResults = results.sectioned(by: \\.firstLetter, ascending: true)\n        let section1 = sectionedResults[0]\n        let section2 = sectionedResults[1]\n\n        let sema1 = DispatchSemaphore(value: 0)\n        let sema2 = DispatchSemaphore(value: 0)\n        let queue = DispatchQueue(label: \"background\")\n        var firstRun = true\n        // Only get notifications for key 'a'.\n        let token1 = section1.observe(keyPaths: [\\.stringCol],\n                                      on: queue) { (changes: SectionedResultsChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 1)\n            case let .update(collection, deletions: deletions, insertions: insertions, modifications: modifications,\n                             sectionsToInsert: sectionsToInsert, sectionsToDelete: sectionsToDelete):\n                if firstRun {\n                    XCTAssertEqual(sectionsToDelete, [0])\n                    XCTAssertTrue(sectionsToInsert.isEmpty)\n                    XCTAssertTrue(deletions.isEmpty)\n                    XCTAssertTrue(modifications.isEmpty)\n                    XCTAssertTrue(insertions.isEmpty)\n                } else {\n                    XCTAssertEqual(collection.count, 1)\n                    XCTAssertEqual(insertions, [IndexPath(item: 0, section: 0)])\n                    XCTAssertEqual(sectionsToInsert, [0])\n                }\n            }\n            XCTAssertFalse(Thread.isMainThread)\n            sema1.signal()\n        }\n        sema1.wait()\n        // Only get notifications for key 'b'.\n        let token2 = section2.observe(keyPaths: [\\.stringCol],\n                                      on: queue) { (changes: SectionedResultsChange) in\n            switch changes {\n            case .initial(let collection):\n                if firstRun {\n                    XCTAssertEqual(collection.count, 2)\n                }\n            case let .update(collection, deletions: deletions, insertions: insertions, modifications: modifications,\n                             sectionsToInsert: sectionsToInsert, sectionsToDelete: sectionsToDelete):\n                if firstRun {\n                    XCTAssertEqual(collection.count, 1)\n                    XCTAssertTrue(sectionsToDelete.isEmpty)\n                    XCTAssertTrue(sectionsToInsert.isEmpty)\n                    XCTAssertEqual(deletions, [IndexPath(item: 0, section: 1)])\n                    XCTAssertTrue(modifications.isEmpty)\n                    XCTAssertTrue(insertions.isEmpty)\n                } else {\n                    XCTAssertEqual(collection.count, 2)\n                    XCTAssertTrue(sectionsToDelete.isEmpty)\n                    XCTAssertTrue(sectionsToInsert.isEmpty)\n                    XCTAssertEqual(deletions, [IndexPath(item: 0, section: 0)])\n                    XCTAssertTrue(modifications.isEmpty)\n                    XCTAssertEqual(insertions, [IndexPath(item: 0, section: 0), IndexPath(item: 1, section: 0)])\n                }\n            }\n            XCTAssertFalse(Thread.isMainThread)\n            sema2.signal()\n        }\n        sema2.wait()\n\n        try! realm.write {\n            realm.delete([results[2], results[0]]) // banana, apple\n        }\n        sema1.wait()\n        sema2.wait()\n        firstRun = false\n        try! realm.write {\n            results[0].stringCol = \"bog\" // previously: box\n            let o = ModernAllTypesObject()\n            o.stringCol = \"bag\"\n            realm.add(o)\n        }\n        sema2.wait()\n        try! realm.write {\n            let o = ModernAllTypesObject()\n            o.stringCol = \"app\"\n            realm.add(o)\n        }\n        sema1.wait()\n        token1.invalidate()\n        token2.invalidate()\n    }\n\n    func testFrozenResults() {\n        let realm = createObjects()\n        let frozenResults = realm.objects(ModernAllTypesObject.self).freeze()\n        XCTAssertTrue(frozenResults.isFrozen)\n        try! realm.write {\n            let o = ModernAllTypesObject()\n            o.stringCol = \"z\"\n            realm.add(o)\n        }\n\n        func assert(ascending: Bool, sectionCount: Int, sectionKeys: [String]) {\n            let sectionedResults = frozenResults.sectioned(by: \\.firstLetter, ascending: ascending)\n\n            XCTAssertTrue(sectionedResults.isFrozen)\n            XCTAssertEqual(sectionedResults.count, sectionCount)\n            XCTAssertEqual(sectionedResults.map { $0.key }, sectionKeys)\n            guard let thawed = sectionedResults.thaw() else {\n                return XCTFail(\"Could not produce thawed sectioned results\")\n            }\n            XCTAssertFalse(thawed.isFrozen)\n            XCTAssertEqual(thawed.count, 4)\n            XCTAssertEqual(thawed.map { $0.key }, ascending ? sectionKeys + [\"z\"] : [\"z\"] + sectionKeys)\n        }\n\n        assert(ascending: true, sectionCount: 3, sectionKeys: [\"a\", \"b\", \"c\"])\n        assert(ascending: false, sectionCount: 3, sectionKeys: [\"c\", \"b\", \"a\"])\n    }\n\n    func testFrozen() {\n        let realm = createObjects()\n        let results = realm.objects(ModernAllTypesObject.self)\n        XCTAssertFalse(results.isFrozen)\n\n        func assert(ascending: Bool, sectionCount: Int, sectionKeys: [String], newSection: String) {\n            let frozenSectionedResults = results.sectioned(by: \\.firstLetter, ascending: ascending).freeze()\n            try! realm.write {\n                let o = ModernAllTypesObject()\n                o.stringCol = newSection\n                realm.add(o)\n            }\n            XCTAssertTrue(frozenSectionedResults.isFrozen)\n            XCTAssertEqual(frozenSectionedResults.count, sectionCount)\n            XCTAssertEqual(frozenSectionedResults.map { $0.key }, sectionKeys)\n            guard let thawed = frozenSectionedResults.thaw() else {\n                return XCTFail(\"Could not produce thawed sectioned results\")\n            }\n            XCTAssertFalse(thawed.isFrozen)\n            XCTAssertEqual(thawed.count, sectionCount + 1)\n            XCTAssertEqual(thawed.map { $0.key }, ascending ? sectionKeys + [newSection]\n                                                            : [newSection] + sectionKeys)\n        }\n\n        assert(ascending: true, sectionCount: 3, sectionKeys: [\"a\", \"b\", \"c\"], newSection: \"d\")\n        assert(ascending: false, sectionCount: 4, sectionKeys: [\"d\", \"c\", \"b\", \"a\"], newSection: \"e\")\n    }\n\n    func testFrozenSection() {\n        let realm = createObjects()\n        let results = realm.objects(ModernAllTypesObject.self)\n        XCTAssertFalse(results.isFrozen)\n\n        func assert(ascending: Bool, beforeCount: Int, afterCount: Int, sectionKey: String) {\n            let frozenSection = results.sectioned(by: \\.firstLetter, ascending: ascending)[0].freeze()\n            try! realm.write {\n                let o = ModernAllTypesObject()\n                o.stringCol = sectionKey\n                realm.add(o)\n            }\n            XCTAssertTrue(frozenSection.isFrozen)\n            XCTAssertEqual(frozenSection.count, 1)\n            XCTAssertEqual(frozenSection.key, sectionKey)\n            guard let thawed = frozenSection.thaw() else {\n                return XCTFail(\"Could not produce thawed sectioned results\")\n            }\n            XCTAssertFalse(thawed.isFrozen)\n            XCTAssertEqual(thawed.count, 2)\n            XCTAssertEqual(thawed.key, sectionKey)\n        }\n\n        assert(ascending: true, beforeCount: 1, afterCount: 2, sectionKey: \"a\")\n        assert(ascending: false, beforeCount: 1, afterCount: 2, sectionKey: \"c\")\n    }\n}\n\nclass SectionedResultsProjectionTests: SectionedResultsTestsBase {\n    func testCreationFromResults() {\n        let realm = createObjects()\n        let results = realm.objects(ModernAllTypesProjection.self)\n\n        func assert(ascending: Bool, sectionCount: Int, sectionKeys: [String]) {\n            let sectionedResults = results.sectioned(by: \\.firstLetter, ascending: ascending)\n            XCTAssertEqual(sectionedResults.count, sectionCount)\n            XCTAssertEqual(sectionedResults.map { $0.key }, sectionKeys)\n            var o: ModernAllTypesProjection = sectionedResults[0][0]\n            XCTAssertEqual(o.stringCol, ascending ? \"apple\" : \"chalk\")\n\n            let sectionedResults2 = results.sectioned(by: \\.firstLetter,\n                                                      sortDescriptors: [SortDescriptor.init(keyPath: \"stringCol\", ascending: ascending)])\n            XCTAssertEqual(sectionedResults2.count, sectionCount)\n            XCTAssertEqual(sectionedResults2.map { $0.key }, sectionKeys)\n            o = sectionedResults2[0][0]\n            XCTAssertEqual(o.stringCol, ascending ? \"apple\" : \"chalk\")\n\n            let sectionedResults3 = results.sectioned(by: { String($0.stringCol.first!) },\n                                                      sortDescriptors: [SortDescriptor.init(keyPath: \"stringCol\", ascending: ascending)])\n            XCTAssertEqual(sectionedResults3.count, sectionCount)\n            XCTAssertEqual(sectionedResults3.map { $0.key }, sectionKeys)\n            o = sectionedResults3[0][0]\n            XCTAssertEqual(o.stringCol, ascending ? \"apple\" : \"chalk\")\n        }\n\n        assert(ascending: true, sectionCount: 3, sectionKeys: [\"a\", \"b\", \"c\"])\n        assert(ascending: false, sectionCount: 3, sectionKeys: [\"c\", \"b\", \"a\"])\n    }\n\n    func testCreationFromList() {\n        let realm = createObjects()\n        let list = realm.objects(ModernAllTypesProjection.self)[0].arrayString\n\n        func assert(ascending: Bool, sectionCount: Int, sectionKeys: [String]) {\n            let sectionedResults = list.sectioned(by: { String($0.first!) }, ascending: ascending)\n            XCTAssertEqual(sectionedResults.count, sectionCount)\n            XCTAssertEqual(sectionedResults.map { $0.key }, sectionKeys)\n        }\n\n        assert(ascending: true, sectionCount: 3, sectionKeys: [\"a\", \"b\", \"c\"])\n        assert(ascending: false, sectionCount: 3, sectionKeys: [\"c\", \"b\", \"a\"])\n    }\n\n    func testCreateFromMutableSet() {\n        let realm = createObjects()\n        let set = realm.objects(ModernAllTypesProjection.self)[0].setString\n\n        func assert(ascending: Bool, sectionCount: Int, sectionKeys: [String]) {\n            let sectionedResults = set.sectioned(by: { String($0.first!) }, ascending: ascending)\n            XCTAssertEqual(sectionedResults.count, sectionCount)\n            XCTAssertEqual(sectionedResults.map { $0.key }, sectionKeys)\n        }\n\n        assert(ascending: true, sectionCount: 3, sectionKeys: [\"a\", \"b\", \"c\"])\n        assert(ascending: false, sectionCount: 3, sectionKeys: [\"c\", \"b\", \"a\"])\n    }\n\n    @MainActor\n    func testObservation() {\n        let realm = createObjects()\n        let results = realm.objects(ModernAllTypesProjection.self)\n        let sectionedResults = results.sectioned(by: \\.firstLetter, ascending: true)\n        let ex = expectation(description: \"initial notification\")\n        let token = sectionedResults.observe { (changes: SectionedResultsChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 3)\n            case .update:\n                XCTFail(\"Shouldn't happen\")\n            }\n\n            ex.fulfill()\n        }\n        waitForExpectations(timeout: 1, handler: nil)\n\n        // add a second notification and wait for it\n        var ex2 = expectation(description: \"second initial notification\")\n        let token2 = sectionedResults.observe { _ in\n            ex2.fulfill()\n        }\n        waitForExpectations(timeout: 1, handler: nil)\n\n        // make a write and implicitly verify that only the unskipped\n        // notification is called (the first would error on .update)\n        ex2 = expectation(description: \"change notification\")\n\n        try! realm.write(withoutNotifying: [token]) {\n            realm.delete(realm.objects(ModernAllTypesObject.self))\n        }\n        waitForExpectations(timeout: 1, handler: nil)\n        token.invalidate()\n        token2.invalidate()\n    }\n\n    func testObserveOnQueue() {\n        let realm = createObjects()\n        let results = realm.objects(ModernAllTypesProjection.self)\n        let sectionedResults = results.sectioned(by: \\.firstLetter, ascending: true)\n        let sema = DispatchSemaphore(value: 0)\n        let queue = DispatchQueue(label: \"background\")\n        var firstRun = true\n        let token = sectionedResults.observe(keyPaths: [\"stringCol\"],\n                                             on: queue) { (changes: SectionedResultsChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 3)\n            case let .update(collection, deletions: deletions, insertions: insertions, modifications: modifications,\n                             sectionsToInsert: sectionsToInsert, sectionsToDelete: sectionsToDelete):\n                if firstRun {\n                    XCTAssertEqual(collection.count, 3)\n                    XCTAssertEqual(sectionsToDelete, [0])\n                    XCTAssertEqual(sectionsToInsert, [2])\n                    XCTAssertEqual(deletions.count, 2)\n                    XCTAssertEqual(deletions, [IndexPath(item: 0, section: 1), IndexPath(item: 1, section: 1)])\n                    XCTAssertTrue(modifications.isEmpty)\n                    XCTAssertEqual(insertions.count, 2)\n                    XCTAssertEqual(insertions, [IndexPath(item: 0, section: 0),\n                                                IndexPath(item: 0, section: 2)])\n                } else {\n                    XCTAssertEqual(collection.count, 3)\n                    XCTAssertTrue(sectionsToDelete.isEmpty)\n                    XCTAssertTrue(sectionsToInsert.isEmpty)\n                    XCTAssertTrue(deletions.isEmpty)\n                    XCTAssertTrue(insertions.isEmpty)\n                    XCTAssertEqual(modifications.count, 1)\n                    XCTAssertEqual(modifications, [IndexPath(item: 0, section: 0)])\n                }\n            }\n            XCTAssertFalse(Thread.isMainThread)\n            sema.signal()\n        }\n        sema.wait()\n\n        try! realm.write {\n            realm.delete([results[2].rootObject, results[0].rootObject]) // banana, apple\n            results[0].stringCol = \"bog\" // previously: box\n            let o = ModernAllTypesObject()\n            o.stringCol = \"zebra\"\n            realm.add(o)\n        }\n        sema.wait()\n        // Check modifications.\n        firstRun = false\n        try! realm.write {\n            results[0].stringCol = \"bogg\" // previously: bog\n            results[1].intCol = 1 // should be ignored.\n        }\n        sema.wait()\n        token.invalidate()\n    }\n\n    func testObservationOnSection() {\n        let realm = createObjects()\n        let results = realm.objects(ModernAllTypesProjection.self)\n        let sectionedResults = results.sectioned(by: \\.firstLetter, ascending: true)\n        let section1 = sectionedResults[0]\n        let section2 = sectionedResults[1]\n\n        var firstRun = true\n        // Only get notifications for key 'a'.\n        let token1 = section1.observe(keyPaths: [\"stringCol\"]) { (changes: SectionedResultsChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 1)\n            case let .update(collection, deletions: deletions, insertions: insertions, modifications: modifications,\n                             sectionsToInsert: sectionsToInsert, sectionsToDelete: sectionsToDelete):\n                if firstRun {\n                    XCTAssertEqual(sectionsToDelete, [0])\n                    XCTAssertTrue(sectionsToInsert.isEmpty)\n                    XCTAssertTrue(deletions.isEmpty)\n                    XCTAssertTrue(modifications.isEmpty)\n                    XCTAssertTrue(insertions.isEmpty)\n                } else {\n                    XCTAssertEqual(collection.count, 1)\n                    XCTAssertEqual(insertions, [IndexPath(item: 0, section: 0)])\n                    XCTAssertEqual(sectionsToInsert, [0])\n                }\n            }\n        }\n\n        // Only get notifications for key 'b'.\n        let token2 = section2.observe(keyPaths: [\"stringCol\"]) { (changes: SectionedResultsChange) in\n            switch changes {\n            case .initial(let collection):\n                if firstRun {\n                    XCTAssertEqual(collection.count, 2)\n                }\n            case let .update(collection, deletions: deletions, insertions: insertions, modifications: modifications,\n                             sectionsToInsert: sectionsToInsert, sectionsToDelete: sectionsToDelete):\n                if firstRun {\n                    XCTAssertEqual(collection.count, 1)\n                    XCTAssertTrue(sectionsToDelete.isEmpty)\n                    XCTAssertTrue(sectionsToInsert.isEmpty)\n                    XCTAssertEqual(deletions, [IndexPath(item: 0, section: 1)])\n                    XCTAssertTrue(modifications.isEmpty)\n                    XCTAssertTrue(insertions.isEmpty)\n                } else {\n                    XCTAssertEqual(collection.count, 2)\n                    XCTAssertTrue(sectionsToDelete.isEmpty)\n                    XCTAssertTrue(sectionsToInsert.isEmpty)\n                    XCTAssertEqual(deletions, [IndexPath(item: 0, section: 0)])\n                    XCTAssertTrue(modifications.isEmpty)\n                    XCTAssertEqual(insertions, [IndexPath(item: 0, section: 0), IndexPath(item: 1, section: 0)])\n                }\n            }\n        }\n\n        try! realm.write {\n            realm.delete([results[2].rootObject, results[0].rootObject]) // banana, apple\n        }\n        try! realm.write {}\n        firstRun = false\n        try! realm.write {\n            results[0].stringCol = \"bog\" // previously: box\n            let o = ModernAllTypesObject()\n            o.stringCol = \"bag\"\n            realm.add(o)\n        }\n        try! realm.write {}\n        try! realm.write {\n            let o = ModernAllTypesObject()\n            o.stringCol = \"app\"\n            realm.add(o)\n        }\n        try! realm.write {}\n        token1.invalidate()\n        token2.invalidate()\n    }\n\n    func testObservationOnSectionOnQueue() {\n        let realm = createObjects()\n        let results = realm.objects(ModernAllTypesObject.self)\n        let sectionedResults = results.sectioned(by: \\.firstLetter, ascending: true)\n        let section1 = sectionedResults[0]\n        let section2 = sectionedResults[1]\n\n        let sema1 = DispatchSemaphore(value: 0)\n        let sema2 = DispatchSemaphore(value: 0)\n        let queue = DispatchQueue(label: \"background\")\n        var firstRun = true\n        // Only get notifications for key 'a'.\n        let token1 = section1.observe(keyPaths: [\"stringCol\"],\n                                      on: queue) { (changes: SectionedResultsChange) in\n            switch changes {\n            case .initial(let collection):\n                XCTAssertEqual(collection.count, 1)\n            case let .update(collection, deletions: deletions, insertions: insertions, modifications: modifications,\n                             sectionsToInsert: sectionsToInsert, sectionsToDelete: sectionsToDelete):\n                if firstRun {\n                    XCTAssertEqual(sectionsToDelete, [0])\n                    XCTAssertTrue(sectionsToInsert.isEmpty)\n                    XCTAssertTrue(deletions.isEmpty)\n                    XCTAssertTrue(modifications.isEmpty)\n                    XCTAssertTrue(insertions.isEmpty)\n                } else {\n                    XCTAssertEqual(collection.count, 1)\n                    XCTAssertEqual(insertions, [IndexPath(item: 0, section: 0)])\n                    XCTAssertEqual(sectionsToInsert, [0])\n                }\n            }\n            XCTAssertFalse(Thread.isMainThread)\n            sema1.signal()\n        }\n        sema1.wait()\n        // Only get notifications for key 'b'.\n        let token2 = section2.observe(keyPaths: [\"stringCol\"],\n                                      on: queue) { (changes: SectionedResultsChange) in\n            switch changes {\n            case .initial(let collection):\n                if firstRun {\n                    XCTAssertEqual(collection.count, 2)\n                }\n            case let .update(collection, deletions: deletions, insertions: insertions, modifications: modifications,\n                             sectionsToInsert: sectionsToInsert, sectionsToDelete: sectionsToDelete):\n                if firstRun {\n                    XCTAssertEqual(collection.count, 1)\n                    XCTAssertTrue(sectionsToDelete.isEmpty)\n                    XCTAssertTrue(sectionsToInsert.isEmpty)\n                    XCTAssertEqual(deletions, [IndexPath(item: 0, section: 1)])\n                    XCTAssertTrue(modifications.isEmpty)\n                    XCTAssertTrue(insertions.isEmpty)\n                } else {\n                    XCTAssertEqual(collection.count, 2)\n                    XCTAssertTrue(sectionsToDelete.isEmpty)\n                    XCTAssertTrue(sectionsToInsert.isEmpty)\n                    XCTAssertEqual(deletions, [IndexPath(item: 0, section: 0)])\n                    XCTAssertTrue(modifications.isEmpty)\n                    XCTAssertEqual(insertions, [IndexPath(item: 0, section: 0), IndexPath(item: 1, section: 0)])\n                }\n            }\n            XCTAssertFalse(Thread.isMainThread)\n            sema2.signal()\n        }\n        sema2.wait()\n\n        try! realm.write {\n            realm.delete([results[2], results[0]]) // banana, apple\n        }\n        sema1.wait()\n        sema2.wait()\n        firstRun = false\n        try! realm.write {\n            results[0].stringCol = \"bog\" // previously: box\n            let o = ModernAllTypesObject()\n            o.stringCol = \"bag\"\n            realm.add(o)\n        }\n        sema2.wait()\n        try! realm.write {\n            let o = ModernAllTypesObject()\n            o.stringCol = \"app\"\n            realm.add(o)\n        }\n        sema1.wait()\n        token1.invalidate()\n        token2.invalidate()\n    }\n\n    func testFrozenResults() {\n        let realm = createObjects()\n        let frozenResults = realm.objects(ModernAllTypesProjection.self).freeze()\n        XCTAssertTrue(frozenResults.isFrozen)\n        try! realm.write {\n            let o = ModernAllTypesObject()\n            o.stringCol = \"z\"\n            realm.add(o)\n        }\n\n        func assert(ascending: Bool, sectionCount: Int, sectionKeys: [String]) {\n            let sectionedResults = frozenResults.sectioned(by: \\.firstLetter, ascending: ascending)\n\n            XCTAssertTrue(sectionedResults.isFrozen)\n            XCTAssertEqual(sectionedResults.count, sectionCount)\n            XCTAssertEqual(sectionedResults.map { $0.key }, sectionKeys)\n            guard let thawed = sectionedResults.thaw() else {\n                return XCTFail(\"Could not produce thawed sectioned results\")\n            }\n            XCTAssertFalse(thawed.isFrozen)\n            XCTAssertEqual(thawed.count, 4)\n            XCTAssertEqual(thawed.map { $0.key }, ascending ? sectionKeys + [\"z\"] : [\"z\"] + sectionKeys)\n        }\n\n        assert(ascending: true, sectionCount: 3, sectionKeys: [\"a\", \"b\", \"c\"])\n        assert(ascending: false, sectionCount: 3, sectionKeys: [\"c\", \"b\", \"a\"])\n    }\n\n    func testFrozen() {\n        let realm = createObjects()\n        let results = realm.objects(ModernAllTypesObject.self)\n        XCTAssertFalse(results.isFrozen)\n\n        func assert(ascending: Bool, sectionCount: Int, sectionKeys: [String], newSection: String) {\n            let frozenSectionedResults = results.sectioned(by: \\.firstLetter, ascending: ascending).freeze()\n            try! realm.write {\n                let o = ModernAllTypesObject()\n                o.stringCol = newSection\n                realm.add(o)\n            }\n            XCTAssertTrue(frozenSectionedResults.isFrozen)\n            XCTAssertEqual(frozenSectionedResults.count, sectionCount)\n            XCTAssertEqual(frozenSectionedResults.map { $0.key }, sectionKeys)\n            guard let thawed = frozenSectionedResults.thaw() else {\n                return XCTFail(\"Could not produce thawed sectioned results\")\n            }\n            XCTAssertFalse(thawed.isFrozen)\n            XCTAssertEqual(thawed.count, sectionCount + 1)\n            XCTAssertEqual(thawed.map { $0.key }, ascending ? sectionKeys + [newSection] : [newSection] + sectionKeys)\n        }\n\n        assert(ascending: true, sectionCount: 3, sectionKeys: [\"a\", \"b\", \"c\"], newSection: \"d\")\n        assert(ascending: false, sectionCount: 4, sectionKeys: [\"d\", \"c\", \"b\", \"a\"], newSection: \"e\")\n    }\n\n    func testFrozenSection() {\n        let realm = createObjects()\n        let results = realm.objects(ModernAllTypesObject.self)\n        XCTAssertFalse(results.isFrozen)\n\n        func assert(ascending: Bool, sectionKey: String, beforeCount: Int, afterCount: Int) {\n            let frozenSection = results.sectioned(by: \\.firstLetter, ascending: ascending)[0].freeze()\n            try! realm.write {\n                let o = ModernAllTypesObject()\n                o.stringCol = sectionKey\n                realm.add(o)\n            }\n            XCTAssertTrue(frozenSection.isFrozen)\n            XCTAssertEqual(frozenSection.count, beforeCount)\n            XCTAssertEqual(frozenSection.key, sectionKey)\n            guard let thawed = frozenSection.thaw() else {\n                return XCTFail(\"Could not produce thawed section.\")\n            }\n            XCTAssertFalse(thawed.isFrozen)\n            XCTAssertEqual(thawed.count, afterCount)\n            XCTAssertEqual(thawed.key, sectionKey)\n        }\n\n        assert(ascending: true, sectionKey: \"a\", beforeCount: 1, afterCount: 2)\n        assert(ascending: false, sectionKey: \"c\", beforeCount: 1, afterCount: 2)\n    }\n\n    func testFastEnumeration() {\n        let realm = createObjects()\n        let results = realm.objects(ModernAllTypesObject.self)\n        let sectionedResults = results.sectioned(by: \\.firstLetter, ascending: true)\n        var keys = [\"a\", \"b\", \"c\"]\n        var strs = [\"apple\", \"banana\", \"box\", \"chalk\"]\n        for section in sectionedResults {\n            XCTAssertEqual(section.key, keys.first!)\n            for obj in section {\n                XCTAssertEqual(obj.stringCol, strs.first!)\n                strs = Array(strs.dropFirst())\n            }\n            keys = Array(keys.dropFirst())\n        }\n        XCTAssertTrue(keys.isEmpty)\n        XCTAssertTrue(strs.isEmpty)\n    }\n}\n\nprotocol SectionedResultsTestData {\n    associatedtype Key: _Persistable, Hashable\n    associatedtype Element: RealmCollectionValue, _Persistable\n\n    static var values: [Element] { get }\n    static var expectedSectionedValues: [Key: [Element]] { get }\n    static func orderedKeys(ascending: Bool) -> [Key]\n    static func setupObject() -> ModernAllTypesObject\n    static func list(_ obj: ModernAllTypesObject) -> List<Element>\n    static func mutableSet(_ obj: ModernAllTypesObject) -> MutableSet<Element>\n    static func results(_ obj: ModernAllTypesObject) -> Results<Element>\n    static func anyRealmCollection(_ obj: ModernAllTypesObject) -> AnyRealmCollection<Element>\n    static func sectionBlock(_ element: Element) -> Key\n    static var skipResultsTests: Bool { get }\n}\n\nprotocol OptionalSectionedResultsTestData {\n    associatedtype Key: _Persistable, Hashable\n    associatedtype Element: _RealmCollectionValueInsideOptional, _Persistable\n    static var values: [Element] { get }\n    static var expectedSectionedValuesOpt: [Key: [Element??]] { get }\n    static func orderedKeysOpt(ascending: Bool) -> [Key]\n    static func setupObject() -> ModernAllTypesObject\n    static func listOpt(_ obj: ModernAllTypesObject) -> List<Element?>\n    static func mutableSetOpt(_ obj: ModernAllTypesObject) -> MutableSet<Element?>\n    static func resultsOpt(_ obj: ModernAllTypesObject) -> Results<Element?>\n    static func anyRealmCollectionOpt(_ obj: ModernAllTypesObject) -> AnyRealmCollection<Element?>\n    static func sectionBlock(_ element: Element?) -> Key\n    static var skipResultsTests: Bool { get }\n}\n\nextension SectionedResultsTestData {\n    static func anyRealmCollection(_ obj: ModernAllTypesObject) -> AnyRealmCollection<Element> {\n        AnyRealmCollection(results(obj))\n    }\n    static var skipResultsTests: Bool {\n        false\n    }\n}\n\nextension OptionalSectionedResultsTestData {\n    static func anyRealmCollectionOpt(_ obj: ModernAllTypesObject) -> AnyRealmCollection<Element?> {\n        AnyRealmCollection(resultsOpt(obj))\n    }\n    static var skipResultsTests: Bool {\n        false\n    }\n}\n\nstruct SectionedResultsTestDataInt: SectionedResultsTestData {\n    static var values: [Int] {\n        [5, 4, 3, 2, 1]\n    }\n    static var expectedSectionedValues: [Int: [Int]] {\n        [1: [1, 3, 5], 0: [2, 4]]\n    }\n\n    static func orderedKeys(ascending: Bool) -> [Int] {\n        return [1, 0]\n    }\n\n    static func setupObject() -> ModernAllTypesObject {\n        let object = ModernAllTypesObject()\n        object.arrayInt.append(objectsIn: values)\n        object.setInt.insert(objectsIn: values)\n        object.arrayOptInt.append(objectsIn: values + [nil])\n        object.setOptInt.insert(objectsIn: values + [nil])\n        return object\n    }\n\n    static func list(_ obj: ModernAllTypesObject) -> List<Int> {\n        obj.arrayInt\n    }\n    static func mutableSet(_ obj: ModernAllTypesObject) -> MutableSet<Int> {\n        obj.setInt\n    }\n    static func results(_ obj: ModernAllTypesObject) -> Results<Int> {\n        obj.arrayInt.sorted(ascending: true)\n    }\n\n    static func sectionBlock(_ element: Int) -> Int {\n        element % 2\n    }\n}\n\nstruct SectionedResultsTestDataOptionalInt: OptionalSectionedResultsTestData {\n    static var values: [Int] {\n        [5, 4, 3, 2, 1]\n    }\n\n    static var expectedSectionedValuesOpt: [Int?: [Int??]] {\n        return [1: [1, 3, 5], 0: [2, 4], nil: [.some(.none)]]\n    }\n\n    static func orderedKeysOpt(ascending: Bool) -> [Int?] {\n        return ascending ? [nil, 1, 0] : [1, 0, nil]\n    }\n\n    static func setupObject() -> ModernAllTypesObject {\n        let object = ModernAllTypesObject()\n        object.arrayOptInt.append(objectsIn: values + [nil])\n        object.setOptInt.insert(objectsIn: values + [nil])\n        return object\n    }\n\n    static func listOpt(_ obj: ModernAllTypesObject) -> List<Int?> {\n        obj.arrayOptInt\n    }\n    static func mutableSetOpt(_ obj: ModernAllTypesObject) -> MutableSet<Int?> {\n        obj.setOptInt\n    }\n    static func resultsOpt(_ obj: ModernAllTypesObject) -> Results<Int?> {\n        obj.arrayOptInt.sorted(ascending: true)\n    }\n\n    static func sectionBlock(_ element: Int?) -> Int? {\n        guard let element = element else {\n            return nil\n        }\n        return element % 2\n    }\n}\n\nstruct SectionedResultsTestDataFloat: SectionedResultsTestData {\n    static var values: [Float] {\n        [5.5, 4.4, 3.3, 2.2, 1.1]\n    }\n    static var expectedSectionedValues: [String: [Float]] {\n        [\"small\": [1.1, 2.2, 3.3, 4.4], \"large\": [5.5]]\n    }\n\n    static func orderedKeys(ascending: Bool) -> [String] {\n        return ascending ? [\"small\", \"large\"] : [\"large\", \"small\"]\n    }\n\n    static func setupObject() -> ModernAllTypesObject {\n        let object = ModernAllTypesObject()\n        object.arrayFloat.append(objectsIn: values)\n        object.setFloat.insert(objectsIn: values)\n        return object\n    }\n\n    static func list(_ obj: ModernAllTypesObject) -> List<Float> {\n        obj.arrayFloat\n    }\n    static func mutableSet(_ obj: ModernAllTypesObject) -> MutableSet<Float> {\n        obj.setFloat\n    }\n    static func results(_ obj: ModernAllTypesObject) -> Results<Float> {\n        obj.arrayFloat.sorted(ascending: true)\n    }\n\n    static func sectionBlock(_ element: Float) -> String {\n        return (element >= 5.0) ? \"large\" : \"small\"\n    }\n}\n\nstruct SectionedResultsTestDataOptionalFloat: OptionalSectionedResultsTestData {\n    static var values: [Float] {\n        [5.5, 4.4, 3.3, 2.2, 1.1]\n    }\n\n    static var expectedSectionedValuesOpt: [Float?: [Float??]] {\n        return [0.0: [1.1, 2.2, 3.3, 4.4], 1.0: [5.5], nil: [.some(.none)]]\n    }\n\n    static func orderedKeysOpt(ascending: Bool) -> [Float?] {\n        return ascending ? [nil, 0.0, 1.0] : [1.0, 0.0, nil]\n    }\n\n    static func setupObject() -> ModernAllTypesObject {\n        let object = ModernAllTypesObject()\n        object.arrayOptFloat.append(objectsIn: values + [nil])\n        object.setOptFloat.insert(objectsIn: values + [nil])\n        return object\n    }\n\n    static func listOpt(_ obj: ModernAllTypesObject) -> List<Float?> {\n        obj.arrayOptFloat\n    }\n    static func mutableSetOpt(_ obj: ModernAllTypesObject) -> MutableSet<Float?> {\n        obj.setOptFloat\n    }\n    static func resultsOpt(_ obj: ModernAllTypesObject) -> Results<Float?> {\n        obj.arrayOptFloat.sorted(ascending: true)\n    }\n\n    static func sectionBlock(_ element: Float?) -> Float? {\n        guard let element = element else {\n            return nil\n        }\n        return (element >= 5.0) ? 1.0 : 0.0\n    }\n}\n\nstruct SectionedResultsTestDataDouble: SectionedResultsTestData {\n    static var values: [Double] {\n        [5.5, 4.4, 3.3, 2.2, 1.1]\n    }\n    static var expectedSectionedValues: [String: [Double]] {\n        [\"small\": [1.1, 2.2, 3.3, 4.4], \"large\": [5.5]]\n    }\n\n    static func orderedKeys(ascending: Bool) -> [String] {\n        return ascending ? [\"small\", \"large\"] : [\"large\", \"small\"]\n    }\n\n    static func setupObject() -> ModernAllTypesObject {\n        let object = ModernAllTypesObject()\n        object.arrayDouble.append(objectsIn: values)\n        object.setDouble.insert(objectsIn: values)\n        object.arrayOptDouble.append(objectsIn: values + [nil])\n        object.setOptDouble.insert(objectsIn: values + [nil])\n        return object\n    }\n\n    static func list(_ obj: ModernAllTypesObject) -> List<Double> {\n        obj.arrayDouble\n    }\n    static func mutableSet(_ obj: ModernAllTypesObject) -> MutableSet<Double> {\n        obj.setDouble\n    }\n    static func results(_ obj: ModernAllTypesObject) -> Results<Double> {\n        obj.arrayDouble.sorted(ascending: true)\n    }\n\n    static func sectionBlock(_ element: Double) -> String {\n        return (element >= 5.0) ? \"large\" : \"small\"\n    }\n}\n\nstruct SectionedResultsTestDataOptionalDouble: OptionalSectionedResultsTestData {\n    static var values: [Double] {\n        [5.5, 4.4, 3.3, 2.2, 1.1]\n    }\n\n    static var expectedSectionedValuesOpt: [Double?: [Double??]] {\n        return [0.0: [1.1, 2.2, 3.3, 4.4], 1.0: [5.5], nil: [.some(.none)]]\n    }\n\n    static func orderedKeysOpt(ascending: Bool) -> [Double?] {\n        return ascending ? [nil, 0.0, 1.0] : [1.0, 0.0, nil]\n    }\n\n    static func setupObject() -> ModernAllTypesObject {\n        let object = ModernAllTypesObject()\n        object.arrayDouble.append(objectsIn: values)\n        object.setDouble.insert(objectsIn: values)\n        object.arrayOptDouble.append(objectsIn: values + [nil])\n        object.setOptDouble.insert(objectsIn: values + [nil])\n        return object\n    }\n\n    static func listOpt(_ obj: ModernAllTypesObject) -> List<Double?> {\n        obj.arrayOptDouble\n    }\n    static func mutableSetOpt(_ obj: ModernAllTypesObject) -> MutableSet<Double?> {\n        obj.setOptDouble\n    }\n    static func resultsOpt(_ obj: ModernAllTypesObject) -> Results<Double?> {\n        obj.arrayOptDouble.sorted(ascending: true)\n    }\n    static func sectionBlock(_ element: Double?) -> Double? {\n        guard let element = element else {\n            return nil\n        }\n        return (element >= 5.0) ? 1.0 : 0.0\n    }\n}\n\nstruct SectionedResultsTestDataString: SectionedResultsTestData {\n    static var values: [String] {\n        [\"apple\", \"banana\", \"any\", \"phone\", \"door\"]\n    }\n    static var expectedSectionedValues: [String: [String]] {\n        [\"a\": [\"any\", \"apple\"], \"b\": [\"banana\"], \"d\": [\"door\"], \"p\": [\"phone\"]]\n    }\n\n    static func orderedKeys(ascending: Bool) -> [String] {\n        return ascending ? [\"a\", \"b\", \"d\", \"p\"] : [\"p\", \"d\", \"b\", \"a\"]\n    }\n\n    static func setupObject() -> ModernAllTypesObject {\n        let object = ModernAllTypesObject()\n        object.arrayString.append(objectsIn: values)\n        object.setString.insert(objectsIn: values)\n        return object\n    }\n\n    static func list(_ obj: ModernAllTypesObject) -> List<String> {\n        obj.arrayString\n    }\n    static func mutableSet(_ obj: ModernAllTypesObject) -> MutableSet<String> {\n        obj.setString\n    }\n    static func results(_ obj: ModernAllTypesObject) -> Results<String> {\n        obj.arrayString.sorted(ascending: true)\n    }\n\n    static func sectionBlock(_ element: String) -> String {\n        String(element.first!)\n    }\n}\n\nstruct SectionedResultsTestDataOptionalString: OptionalSectionedResultsTestData {\n    static var values: [String] {\n        [\"apple\", \"banana\", \"any\", \"phone\", \"door\"]\n    }\n    static var expectedSectionedValuesOpt: [String?: [String??]] {\n        return [\"a\": [\"any\", \"apple\"], \"b\": [\"banana\"], \"d\": [\"door\"], \"p\": [\"phone\"], nil: [.some(.none)]]\n    }\n\n    static func orderedKeysOpt(ascending: Bool) -> [String?] {\n        return ascending ? [nil, \"a\", \"b\", \"d\", \"p\"] : [\"p\", \"d\", \"b\", \"a\", nil]\n    }\n\n    static func setupObject() -> ModernAllTypesObject {\n        let object = ModernAllTypesObject()\n        object.arrayOptString.append(objectsIn: values + [nil])\n        object.setOptString.insert(objectsIn: values + [nil])\n        return object\n    }\n\n    static func listOpt(_ obj: ModernAllTypesObject) -> List<String?> {\n        obj.arrayOptString\n    }\n    static func mutableSetOpt(_ obj: ModernAllTypesObject) -> MutableSet<String?> {\n        obj.setOptString\n    }\n    static func resultsOpt(_ obj: ModernAllTypesObject) -> Results<String?> {\n        obj.arrayOptString.sorted(ascending: true)\n    }\n\n    static func sectionBlock(_ element: String?) -> String? {\n        guard let element = element else {\n            return nil\n        }\n        return String(element.first!)\n    }\n}\n\nstruct SectionedResultsTestDataAnyRealmValue: SectionedResultsTestData {\n    static var values: [AnyRealmValue] {\n        [.string(\"apple\"), .int(2), .bool(true), .data(.init(repeating: 1, count: 1)), .decimal128(123.456)]\n    }\n    static var expectedSectionedValues: [String: [AnyRealmValue]] {\n        [\"alphanumeric\": [.bool(true), .int(2), .decimal128(123.456), .string(\"apple\")], \"data\": [.data(.init(repeating: 1, count: 1))]]\n    }\n\n    static func orderedKeys(ascending: Bool) -> [String] {\n        return ascending ? [\"alphanumeric\", \"data\"] : [\"data\", \"alphanumeric\"]\n    }\n\n    static func setupObject() -> ModernAllTypesObject {\n        let object = ModernAllTypesObject()\n        object.arrayAny.append(objectsIn: values)\n        object.setAny.insert(objectsIn: values)\n        return object\n    }\n\n    static func list(_ obj: ModernAllTypesObject) -> List<AnyRealmValue> {\n        obj.arrayAny\n    }\n    static func mutableSet(_ obj: ModernAllTypesObject) -> MutableSet<AnyRealmValue> {\n        obj.setAny\n    }\n    static func results(_ obj: ModernAllTypesObject) -> Results<AnyRealmValue> {\n        obj.arrayAny.sorted(ascending: true)\n    }\n\n    static func sectionBlock(_ element: AnyRealmValue) -> String {\n        switch element {\n        case .int:\n            return \"alphanumeric\"\n        case .bool:\n            return \"alphanumeric\"\n        case .string:\n            return \"alphanumeric\"\n        case .data:\n            return \"data\"\n        case .decimal128:\n            return \"alphanumeric\"\n        default:\n            XCTFail(\"Element not supported\")\n            return \"\"\n        }\n    }\n}\n\nstruct SectionedResultsTestDataBinary: SectionedResultsTestData {\n    static var values: [Data] {\n        [Data(base64Encoded: \"more\")!,\n         Data(base64Encoded: \"door\")!,\n         Data(base64Encoded: \"absolute\")!,\n         Data(base64Encoded: \"abstract\")!]\n    }\n    static var expectedSectionedValues: [String: [Data]] {\n        [\"short\": [Data(base64Encoded: \"door\")!,\n                   Data(base64Encoded: \"more\")!],\n         \"long\": [Data(base64Encoded: \"absolute\")!,\n                  Data(base64Encoded: \"abstract\")!]]\n    }\n\n    static func orderedKeys(ascending: Bool) -> [String] {\n        ascending ? [\"long\", \"short\"] : [\"short\", \"long\"]\n    }\n\n    static func setupObject() -> ModernAllTypesObject {\n        let object = ModernAllTypesObject()\n        object.arrayBinary.append(objectsIn: values)\n        object.setBinary.insert(objectsIn: values)\n        return object\n    }\n\n    static func list(_ obj: ModernAllTypesObject) -> List<Data> {\n        obj.arrayBinary\n    }\n    static func mutableSet(_ obj: ModernAllTypesObject) -> MutableSet<Data> {\n        obj.setBinary\n    }\n    static func results(_ obj: ModernAllTypesObject) -> Results<Data> {\n        obj.arrayBinary.sorted(ascending: true)\n    }\n\n    static func sectionBlock(_ element: Data) -> String {\n        return element.base64EncodedString().count == 4 ? \"short\" : \"long\"\n    }\n}\n\nstruct SectionedResultsTestDataOptionalBinary: OptionalSectionedResultsTestData {\n    static var values: [Data] {\n        [Data(base64Encoded: \"more\")!,\n         Data(base64Encoded: \"door\")!,\n         Data(base64Encoded: \"absolute\")!,\n         Data(base64Encoded: \"abstract\")!]\n    }\n    static var expectedSectionedValuesOpt: [String?: [Data??]] {\n        [\"short\": [Data(base64Encoded: \"door\")!, Data(base64Encoded: \"more\")!],\n         \"long\": [Data(base64Encoded: \"absolute\")!, Data(base64Encoded: \"abstract\")!],\n         nil: [.some(.none)]]\n    }\n\n    static func orderedKeysOpt(ascending: Bool) -> [String?] {\n        ascending ? [nil, \"long\", \"short\"] : [\"short\", \"long\", nil]\n    }\n\n    static func setupObject() -> ModernAllTypesObject {\n        let object = ModernAllTypesObject()\n        object.arrayOptBinary.append(objectsIn: values + [nil])\n        object.setOptBinary.insert(objectsIn: values + [nil])\n        return object\n    }\n\n    static func listOpt(_ obj: ModernAllTypesObject) -> List<Data?> {\n        obj.arrayOptBinary\n    }\n    static func mutableSetOpt(_ obj: ModernAllTypesObject) -> MutableSet<Data?> {\n        obj.setOptBinary\n    }\n    static func resultsOpt(_ obj: ModernAllTypesObject) -> Results<Data?> {\n        obj.arrayOptBinary.sorted(ascending: true)\n    }\n\n    static func sectionBlock(_ element: Data?) -> String? {\n        guard let element = element else {\n            return nil\n        }\n        return element.base64EncodedString().count == 4 ? \"short\" : \"long\"\n    }\n}\n\nstruct SectionedResultsTestDataDate: SectionedResultsTestData {\n    static var values: [Date] {\n        [Date(timeIntervalSince1970: 1656547200), // 6-30-22\n         Date(timeIntervalSince1970: 1653868800), // 5-30-22\n         Date(timeIntervalSince1970: 1651276800), // 4-30-22\n         Date(timeIntervalSince1970: 1650412800)] // 4-20-22\n    }\n    static var expectedSectionedValues: [Date: [Date]] {\n        [Date(timeIntervalSince1970: 1653955200): [Date(timeIntervalSince1970: 1656547200)], // June\n         Date(timeIntervalSince1970: 1651276800): [Date(timeIntervalSince1970: 1653868800)], // May\n         Date(timeIntervalSince1970: 1648684800): [Date(timeIntervalSince1970: 1650412800), // April\n                                                   Date(timeIntervalSince1970: 1651276800)]]\n    }\n\n    static func orderedKeys(ascending: Bool) -> [Date] {\n        let keys = [Date(timeIntervalSince1970: 1648684800), Date(timeIntervalSince1970: 1651276800), Date(timeIntervalSince1970: 1653955200)]\n        return ascending ? keys : keys.reversed()\n    }\n\n    static func setupObject() -> ModernAllTypesObject {\n        let object = ModernAllTypesObject()\n        object.arrayDate.append(objectsIn: values)\n        object.setDate.insert(objectsIn: values)\n        return object\n    }\n\n    static func list(_ obj: ModernAllTypesObject) -> List<Date> {\n        obj.arrayDate\n    }\n    static func mutableSet(_ obj: ModernAllTypesObject) -> MutableSet<Date> {\n        obj.setDate\n    }\n    static func results(_ obj: ModernAllTypesObject) -> Results<Date> {\n        obj.arrayDate.sorted(ascending: true)\n    }\n\n    static func sectionBlock(_ element: Date) -> Date {\n        var cal = Calendar(identifier: .gregorian)\n        cal.timeZone = TimeZone(secondsFromGMT: 0)!\n        let comps = cal.dateComponents([.month, .year], from: element)\n        return cal.date(from: DateComponents(year: comps.year, month: comps.month, day: 0, hour: 0, minute: 0, second: 0))!\n    }\n}\n\nstruct SectionedResultsTestDataOptionalDate: OptionalSectionedResultsTestData {\n    static var values: [Date] {\n        [Date(timeIntervalSince1970: 1656547200), // 6-30-22\n         Date(timeIntervalSince1970: 1653868800), // 5-30-22\n         Date(timeIntervalSince1970: 1651276800), // 4-30-22\n         Date(timeIntervalSince1970: 1650412800)] // 4-20-22\n    }\n    static var expectedSectionedValuesOpt: [Date?: [Date??]] {\n        [nil: [.some(.none)],\n         Date(timeIntervalSince1970: 1653955200): [Date(timeIntervalSince1970: 1656547200)], // June\n         Date(timeIntervalSince1970: 1651276800): [Date(timeIntervalSince1970: 1653868800)], // May\n         Date(timeIntervalSince1970: 1648684800): [Date(timeIntervalSince1970: 1650412800), // April\n                                                   Date(timeIntervalSince1970: 1651276800)]]\n    }\n\n    static func orderedKeysOpt(ascending: Bool) -> [Date?] {\n        let keys = [nil, Date(timeIntervalSince1970: 1648684800), Date(timeIntervalSince1970: 1651276800), Date(timeIntervalSince1970: 1653955200)]\n        return ascending ? keys : keys.reversed()\n    }\n\n    static func setupObject() -> ModernAllTypesObject {\n        let object = ModernAllTypesObject()\n        object.arrayOptDate.append(objectsIn: values + [nil])\n        object.setOptDate.insert(objectsIn: values + [nil])\n        return object\n    }\n\n    static func listOpt(_ obj: ModernAllTypesObject) -> List<Date?> {\n        obj.arrayOptDate\n    }\n    static func mutableSetOpt(_ obj: ModernAllTypesObject) -> MutableSet<Date?> {\n        obj.setOptDate\n    }\n    static func resultsOpt(_ obj: ModernAllTypesObject) -> Results<Date?> {\n        obj.arrayOptDate.sorted(ascending: true)\n    }\n\n    static func sectionBlock(_ element: Date?) -> Date? {\n        guard let date = element else {\n            return nil\n        }\n        var cal = Calendar(identifier: .gregorian)\n        cal.timeZone = TimeZone(secondsFromGMT: 0)!\n        let comps = cal.dateComponents([.month, .year], from: date)\n        return cal.date(from: DateComponents(year: comps.year, month: comps.month, day: 0, hour: 0, minute: 0, second: 0))!\n    }\n}\n\nstruct SectionedResultsTestDataDecimal128: SectionedResultsTestData {\n    static var values: [Decimal128] {\n        [Decimal128(1.0),\n         Decimal128(3.0),\n         Decimal128(2.0),\n         Decimal128(4.0)]\n    }\n    static var expectedSectionedValues: [Decimal128: [Decimal128]] {\n        [Decimal128(1.0): [Decimal128(1.0),\n                           Decimal128(3.0)],\n         Decimal128(2.0): [Decimal128(2.0),\n                           Decimal128(4.0)]]\n    }\n\n    static func orderedKeys(ascending: Bool) -> [Decimal128] {\n        let keys = [Decimal128(1.0), Decimal128(2.0)]\n        return ascending ? keys : keys.reversed()\n    }\n\n    static func setupObject() -> ModernAllTypesObject {\n        let object = ModernAllTypesObject()\n        object.arrayDecimal.append(objectsIn: values)\n        object.setDecimal.insert(objectsIn: values)\n        return object\n    }\n\n    static func list(_ obj: ModernAllTypesObject) -> List<Decimal128> {\n        obj.arrayDecimal\n    }\n    static func mutableSet(_ obj: ModernAllTypesObject) -> MutableSet<Decimal128> {\n        obj.setDecimal\n    }\n    static func results(_ obj: ModernAllTypesObject) -> Results<Decimal128> {\n        obj.arrayDecimal.sorted(ascending: true)\n    }\n\n    static func sectionBlock(_ element: Decimal128) -> Decimal128 {\n        return element.doubleValue.truncatingRemainder(dividingBy: 2.0) == 0 ? Decimal128(2.0) : Decimal128(1.0)\n    }\n}\n// swiftlint:disable:next type_name\nstruct SectionedResultsTestDataOptionalDecimal128: OptionalSectionedResultsTestData {\n    static var values: [Decimal128] {\n        [Decimal128(1.0),\n         Decimal128(3.0),\n         Decimal128(2.0),\n         Decimal128(4.000)]\n    }\n    static var expectedSectionedValuesOpt: [Decimal128?: [Decimal128??]] {\n        [Decimal128(1.0): [Decimal128(1.0),\n                           Decimal128(3.0)],\n         Decimal128(2.0): [Decimal128(2.0),\n                           Decimal128(4.0)],\n         nil: [.some(.none)]]\n    }\n\n    static func orderedKeysOpt(ascending: Bool) -> [Decimal128?] {\n        let keys: [Decimal128?] = [nil, Decimal128(1.0), Decimal128(2.0)]\n        return ascending ? keys : keys.reversed()\n    }\n\n    static func setupObject() -> ModernAllTypesObject {\n        let object = ModernAllTypesObject()\n        object.arrayOptDecimal.append(objectsIn: values + [nil])\n        object.setOptDecimal.insert(objectsIn: values + [nil])\n        return object\n    }\n\n    static func listOpt(_ obj: ModernAllTypesObject) -> List<Decimal128?> {\n        obj.arrayOptDecimal\n    }\n    static func mutableSetOpt(_ obj: ModernAllTypesObject) -> MutableSet<Decimal128?> {\n        obj.setOptDecimal\n    }\n    static func resultsOpt(_ obj: ModernAllTypesObject) -> Results<Decimal128?> {\n        obj.arrayOptDecimal.sorted(ascending: true)\n    }\n\n    static func sectionBlock(_ element: Decimal128?) -> Decimal128? {\n        guard let decimal = element else {\n            return nil\n        }\n        return decimal.doubleValue.truncatingRemainder(dividingBy: 2.0) == 0 ? Decimal128(2.0) : Decimal128(1.0)\n    }\n}\n\nstruct SectionedResultsTestDataBool: SectionedResultsTestData {\n    static var values: [Bool] {\n        [true, false]\n    }\n    static var expectedSectionedValues: [Bool: [Bool]] {\n        [false: [false], true: [true]]\n    }\n\n    static func orderedKeys(ascending: Bool) -> [Bool] {\n        return ascending ? [false, true] : [true, false]\n    }\n\n    static func setupObject() -> ModernAllTypesObject {\n        let object = ModernAllTypesObject()\n        object.arrayBool.append(objectsIn: values)\n        object.setBool.insert(objectsIn: values)\n        return object\n    }\n\n    static func list(_ obj: ModernAllTypesObject) -> List<Bool> {\n        obj.arrayBool\n    }\n    static func mutableSet(_ obj: ModernAllTypesObject) -> MutableSet<Bool> {\n        obj.setBool\n    }\n    static func results(_ obj: ModernAllTypesObject) -> Results<Bool> {\n        fatalError(\"Not implemented\")\n    }\n\n    static func sectionBlock(_ element: Bool) -> Bool {\n        element\n    }\n\n    static var skipResultsTests: Bool {\n        true\n    }\n}\n\nstruct SectionedResultsTestDataOptionalBool: OptionalSectionedResultsTestData {\n    static var values: [Bool] {\n        [true, false]\n    }\n\n    static var expectedSectionedValuesOpt: [Bool?: [Bool??]] {\n        return [false: [false], true: [true], nil: [.some(.none)]]\n    }\n\n    static func orderedKeysOpt(ascending: Bool) -> [Bool?] {\n        return ascending ? [nil, false, true] : [true, false, nil]\n    }\n\n    static func setupObject() -> ModernAllTypesObject {\n        let object = ModernAllTypesObject()\n        object.arrayOptBool.append(objectsIn: values + [nil])\n        object.setOptBool.insert(objectsIn: values + [nil])\n        return object\n    }\n\n    static func listOpt(_ obj: ModernAllTypesObject) -> List<Bool?> {\n        obj.arrayOptBool\n    }\n    static func mutableSetOpt(_ obj: ModernAllTypesObject) -> MutableSet<Bool?> {\n        obj.setOptBool\n    }\n    static func resultsOpt(_ obj: ModernAllTypesObject) -> Results<Bool?> {\n        fatalError(\"Not implemented\")\n    }\n\n    static func sectionBlock(_ element: Bool?) -> Bool? {\n        guard let element = element else {\n            return nil\n        }\n        return element\n    }\n\n    static var skipResultsTests: Bool {\n        true\n    }\n}\n\n// Missing:\n// Sectioning on Enum\n"
  },
  {
    "path": "RealmSwift/Tests/SortDescriptorTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\nclass SortDescriptorTests: TestCase {\n\n    let sortDescriptor = SortDescriptor(keyPath: \"property\")\n\n    func testAscendingDefaultsToTrue() {\n        XCTAssertTrue(sortDescriptor.ascending)\n    }\n\n    func testReversedReturnsReversedDescriptor() {\n        let reversed = sortDescriptor.reversed()\n        XCTAssertEqual(reversed.keyPath, sortDescriptor.keyPath, \"Key path should stay the same when reversed.\")\n        XCTAssertFalse(reversed.ascending)\n        XCTAssertTrue(reversed.reversed().ascending)\n    }\n\n    func testDescription() {\n        XCTAssertEqual(sortDescriptor.description, \"SortDescriptor(keyPath: property, direction: ascending)\")\n    }\n\n    func testStringLiteralConvertible() {\n        let literalSortDescriptor: RealmSwift.SortDescriptor = \"property\"\n        XCTAssertEqual(sortDescriptor, literalSortDescriptor,\n            \"SortDescriptor should conform to StringLiteralConvertible\")\n    }\n\n    func testComparison() {\n        let sortDescriptor1 = SortDescriptor(keyPath: \"property1\", ascending: true)\n        let sortDescriptor2 = SortDescriptor(keyPath: \"property1\", ascending: false)\n        let sortDescriptor3 = SortDescriptor(keyPath: \"property2\", ascending: true)\n        let sortDescriptor4 = SortDescriptor(keyPath: \"property2\", ascending: false)\n\n        // validate different\n        XCTAssertNotEqual(sortDescriptor1, sortDescriptor2, \"Should not match\")\n        XCTAssertNotEqual(sortDescriptor1, sortDescriptor3, \"Should not match\")\n        XCTAssertNotEqual(sortDescriptor1, sortDescriptor4, \"Should not match\")\n\n        XCTAssertNotEqual(sortDescriptor2, sortDescriptor3, \"Should not match\")\n        XCTAssertNotEqual(sortDescriptor2, sortDescriptor4, \"Should not match\")\n\n        XCTAssertNotEqual(sortDescriptor3, sortDescriptor4, \"Should not match\")\n\n        let sortDescriptor5 = SortDescriptor(keyPath: \"property1\", ascending: true)\n        let sortDescriptor6 = SortDescriptor(keyPath: \"property2\", ascending: true)\n\n        // validate same\n        XCTAssertEqual(sortDescriptor1, sortDescriptor5, \"Should match\")\n        XCTAssertEqual(sortDescriptor3, sortDescriptor6, \"Should match\")\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/SwiftLinkTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\nclass SwiftLinkTests: TestCase {\n\n    func testBasicLink() {\n        let realm = realmWithTestPath()\n\n        let owner = SwiftOwnerObject()\n        owner.name = \"Tim\"\n        owner.dog = SwiftDogObject()\n        owner.dog!.dogName = \"Harvie\"\n\n        try! realm.write { realm.add(owner) }\n\n        let owners = realm.objects(SwiftOwnerObject.self)\n        let dogs = realm.objects(SwiftDogObject.self)\n        XCTAssertEqual(owners.count, Int(1), \"Expecting 1 owner\")\n        XCTAssertEqual(dogs.count, Int(1), \"Expecting 1 dog\")\n        XCTAssertEqual(owners[0].name, \"Tim\", \"Tim is named Tim\")\n        XCTAssertEqual(dogs[0].dogName, \"Harvie\", \"Harvie is named Harvie\")\n\n        XCTAssertEqual(owners[0].dog!.dogName, \"Harvie\", \"Tim's dog should be Harvie\")\n    }\n\n    func testMultipleOwnerLink() {\n        let realm = realmWithTestPath()\n\n        let owner = SwiftOwnerObject()\n        owner.name = \"Tim\"\n        owner.dog = SwiftDogObject()\n        owner.dog!.dogName = \"Harvie\"\n\n        try! realm.write { realm.add(owner) }\n\n        XCTAssertEqual(realm.objects(SwiftOwnerObject.self).count, Int(1), \"Expecting 1 owner\")\n        XCTAssertEqual(realm.objects(SwiftDogObject.self).count, Int(1), \"Expecting 1 dog\")\n\n        realm.beginWrite()\n        let fiel = realm.create(SwiftOwnerObject.self, value: [\"Fiel\", NSNull()])\n        fiel.dog = owner.dog\n        try! realm.commitWrite()\n\n        XCTAssertEqual(realm.objects(SwiftOwnerObject.self).count, Int(2), \"Expecting 2 owners\")\n        XCTAssertEqual(realm.objects(SwiftDogObject.self).count, Int(1), \"Expecting 1 dog\")\n    }\n\n    func testLinkRemoval() {\n        let realm = realmWithTestPath()\n\n        let owner = SwiftOwnerObject()\n        owner.name = \"Tim\"\n        owner.dog = SwiftDogObject()\n        owner.dog!.dogName = \"Harvie\"\n\n        try! realm.write { realm.add(owner) }\n\n        XCTAssertEqual(realm.objects(SwiftOwnerObject.self).count, Int(1), \"Expecting 1 owner\")\n        XCTAssertEqual(realm.objects(SwiftDogObject.self).count, Int(1), \"Expecting 1 dog\")\n\n        try! realm.write { realm.delete(owner.dog!) }\n\n        XCTAssertNil(owner.dog, \"Dog should be nullified when deleted\")\n\n        // refresh owner and check\n        let owner2 = realm.objects(SwiftOwnerObject.self).first!\n        XCTAssertNotNil(owner2, \"Should have 1 owner\")\n        XCTAssertNil(owner2.dog, \"Dog should be nullified when deleted\")\n        XCTAssertEqual(realm.objects(SwiftDogObject.self).count, Int(0), \"Expecting 0 dogs\")\n    }\n\n    func testLinkingObjects() {\n        let realm = realmWithTestPath()\n\n        let owner = SwiftOwnerObject()\n        owner.name = \"Tim\"\n        owner.dog = SwiftDogObject()\n        owner.dog!.dogName = \"Harvie\"\n\n        XCTAssertEqual(0, owner.dog!.owners.count, \"Linking objects are not available until the object is persisted\")\n\n        try! realm.write {\n            realm.add(owner)\n        }\n\n        let owners = owner.dog!.owners\n        XCTAssertEqual(1, owners.count)\n        XCTAssertEqual(owner.name, owners.first!.name)\n\n        try! realm.write {\n            owner.dog = nil\n        }\n\n        XCTAssertEqual(0, owners.count)\n    }\n\n    func testLinkingObjectsWithNoPersistedProps() {\n        let realm = realmWithTestPath()\n\n        let target = OnlyComputedProps()\n\n        let source1 = LinkToOnlyComputed()\n        source1.value = 1\n        source1.link = target\n\n        XCTAssertEqual(target.backlinks.count, 0, \"Linking objects are not available until the object is persisted\")\n\n        try! realm.write {\n            realm.add(source1)\n        }\n\n        XCTAssertEqual(target.backlinks.count, 1)\n        XCTAssertEqual(target.backlinks.first!.value, source1.value)\n\n        let source2 = LinkToOnlyComputed()\n        source2.value = 2\n        source2.link = target\n\n        XCTAssertEqual(target.backlinks.count, 1, \"Linking objects to an unpersisted object are not available\")\n        try! realm.write {\n            realm.add(source2)\n        }\n\n        XCTAssertEqual(target.backlinks.count, 2)\n        XCTAssertTrue(target.backlinks.contains(where: { $0.value == 2 }))\n\n        let targetWithNoLinks = OnlyComputedProps()\n        try! realm.write {\n            // Implicitly verify we can persist a RealmObject with no persisted properties and\n            // no objects linking to it\n            realm.add(targetWithNoLinks)\n        }\n\n        XCTAssertEqual(targetWithNoLinks.backlinks.count, 0, \"No object is linking to targetWithNoLinks\")\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/SwiftTestObjects.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport RealmSwift\nimport Realm\n\nfinal class SwiftStringObject: Object {\n    @objc dynamic var stringCol = \"\"\n\n    convenience init(stringCol: String) {\n        self.init()\n        self.stringCol = stringCol\n    }\n}\n\nclass ModernSwiftStringObject: Object {\n    @Persisted var stringCol = \"\"\n}\n\nclass ModernSwiftStringProjection: Projection<ModernSwiftStringObject> {\n    @Projected(\\ModernSwiftStringObject.stringCol) var string\n}\n\nclass SwiftBoolObject: Object, Identifiable {\n    @objc dynamic var boolCol = false\n}\n\nclass SwiftIntObject: Object {\n    @objc dynamic var intCol = 0\n}\n\nclass SwiftInt8Object: Object {\n    @objc dynamic var int8Col = 0\n}\n\nclass SwiftInt16Object: Object {\n    @objc dynamic var int16Col = 0\n}\n\nclass SwiftInt32Object: Object {\n    @objc dynamic var int32Col = 0\n}\n\nclass SwiftInt64Object: Object {\n    @objc dynamic var int64Col = 0\n}\n\nclass SwiftLongObject: Object {\n    @objc dynamic var longCol: Int64 = 0\n}\n\n@objc enum IntEnum: Int, RealmEnum, Codable {\n    case value1 = 1\n    case value2 = 3\n}\n\nclass SwiftObject: Object {\n    @objc dynamic var boolCol = false\n    @objc dynamic var intCol = 123\n    @objc dynamic var int8Col: Int8 = 123\n    @objc dynamic var int16Col: Int16 = 123\n    @objc dynamic var int32Col: Int32 = 123\n    @objc dynamic var int64Col: Int64 = 123\n    @objc dynamic var intEnumCol = IntEnum.value1\n    @objc dynamic var floatCol = 1.23 as Float\n    @objc dynamic var doubleCol = 12.3\n    @objc dynamic var stringCol = \"a\"\n    @objc dynamic var binaryCol = Data(\"a\".utf8)\n    @objc dynamic var dateCol = Date(timeIntervalSince1970: 1)\n    @objc dynamic var decimalCol = Decimal128(\"123e4\")\n    @objc dynamic var objectIdCol = ObjectId(\"1234567890ab1234567890ab\")\n    @objc dynamic var objectCol: SwiftBoolObject? = SwiftBoolObject()\n    @objc dynamic var uuidCol: UUID = UUID(uuidString: \"137decc8-b300-4954-a233-f89909f4fd89\")!\n    let anyCol = RealmProperty<AnyRealmValue>()\n\n    let arrayCol = List<SwiftBoolObject>()\n    let setCol = MutableSet<SwiftBoolObject>()\n    let mapCol = Map<String, SwiftBoolObject?>()\n\n    class func defaultValues() -> [String: Any] {\n        return  [\n            \"boolCol\": false,\n            \"intCol\": 123,\n            \"int8Col\": 123 as Int8,\n            \"int16Col\": 123 as Int16,\n            \"int32Col\": 123 as Int32,\n            \"int64Col\": 123 as Int64,\n            \"floatCol\": 1.23 as Float,\n            \"doubleCol\": 12.3,\n            \"stringCol\": \"a\",\n            \"binaryCol\": Data(\"a\".utf8),\n            \"dateCol\": Date(timeIntervalSince1970: 1),\n            \"decimalCol\": Decimal128(\"123e4\"),\n            \"objectIdCol\": ObjectId(\"1234567890ab1234567890ab\"),\n            \"objectCol\": [false],\n            \"uuidCol\": UUID(uuidString: \"137decc8-b300-4954-a233-f89909f4fd89\")!\n        ]\n    }\n}\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass SwiftOptionalObject: Object {\n    @objc dynamic var optNSStringCol: NSString?\n    @objc dynamic var optStringCol: String?\n    @objc dynamic var optBinaryCol: Data?\n    @objc dynamic var optDateCol: Date?\n    @objc dynamic var optDecimalCol: Decimal128?\n    @objc dynamic var optObjectIdCol: ObjectId?\n    @objc dynamic var optUuidCol: UUID?\n    let optIntCol = RealmOptional<Int>()\n    let optInt8Col = RealmOptional<Int8>()\n    let optInt16Col = RealmOptional<Int16>()\n    let optInt32Col = RealmOptional<Int32>()\n    let optInt64Col = RealmOptional<Int64>()\n    let optFloatCol = RealmOptional<Float>()\n    let optDoubleCol = RealmOptional<Double>()\n    let optBoolCol = RealmOptional<Bool>()\n    let optEnumCol = RealmOptional<IntEnum>()\n    let otherIntCol = RealmProperty<Int?>()\n    @objc dynamic var optObjectCol: SwiftBoolObject?\n}\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass SwiftOptionalPrimaryObject: SwiftOptionalObject {\n    let id = RealmOptional<Int>()\n\n    override class func primaryKey() -> String? { return \"id\" }\n}\n\nclass SwiftListObject: Object {\n    let int = List<Int>()\n    let int8 = List<Int8>()\n    let int16 = List<Int16>()\n    let int32 = List<Int32>()\n    let int64 = List<Int64>()\n    let float = List<Float>()\n    let double = List<Double>()\n    let string = List<String>()\n    let data = List<Data>()\n    let date = List<Date>()\n    let decimal = List<Decimal128>()\n    let objectId = List<ObjectId>()\n    let uuid = List<UUID>()\n    let any = List<AnyRealmValue>()\n\n    let intOpt = List<Int?>()\n    let int8Opt = List<Int8?>()\n    let int16Opt = List<Int16?>()\n    let int32Opt = List<Int32?>()\n    let int64Opt = List<Int64?>()\n    let floatOpt = List<Float?>()\n    let doubleOpt = List<Double?>()\n    let stringOpt = List<String?>()\n    let dataOpt = List<Data?>()\n    let dateOpt = List<Date?>()\n    let decimalOpt = List<Decimal128?>()\n    let objectIdOpt = List<ObjectId?>()\n    let uuidOpt = List<UUID?>()\n}\n\nclass SwiftMutableSetObject: Object {\n    let int = MutableSet<Int>()\n    let int8 = MutableSet<Int8>()\n    let int16 = MutableSet<Int16>()\n    let int32 = MutableSet<Int32>()\n    let int64 = MutableSet<Int64>()\n    let float = MutableSet<Float>()\n    let double = MutableSet<Double>()\n    let string = MutableSet<String>()\n    let data = MutableSet<Data>()\n    let date = MutableSet<Date>()\n    let decimal = MutableSet<Decimal128>()\n    let objectId = MutableSet<ObjectId>()\n    let uuid = MutableSet<UUID>()\n    let any = MutableSet<AnyRealmValue>()\n\n    let intOpt = MutableSet<Int?>()\n    let int8Opt = MutableSet<Int8?>()\n    let int16Opt = MutableSet<Int16?>()\n    let int32Opt = MutableSet<Int32?>()\n    let int64Opt = MutableSet<Int64?>()\n    let floatOpt = MutableSet<Float?>()\n    let doubleOpt = MutableSet<Double?>()\n    let stringOpt = MutableSet<String?>()\n    let dataOpt = MutableSet<Data?>()\n    let dateOpt = MutableSet<Date?>()\n    let decimalOpt = MutableSet<Decimal128?>()\n    let objectIdOpt = MutableSet<ObjectId?>()\n    let uuidOpt = MutableSet<UUID?>()\n}\n\nclass SwiftMapObject: Object {\n    let int = Map<String, Int>()\n    let int8 = Map<String, Int8>()\n    let int16 = Map<String, Int16>()\n    let int32 = Map<String, Int32>()\n    let int64 = Map<String, Int64>()\n    let float = Map<String, Float>()\n    let double = Map<String, Double>()\n    let bool = Map<String, Bool>()\n    let string = Map<String, String>()\n    let data = Map<String, Data>()\n    let date = Map<String, Date>()\n    let decimal = Map<String, Decimal128>()\n    let objectId = Map<String, ObjectId>()\n    let uuid = Map<String, UUID>()\n    let object = Map<String, SwiftStringObject?>()\n    let any = Map<String, AnyRealmValue>()\n\n    let intOpt = Map<String, Int?>()\n    let int8Opt = Map<String, Int8?>()\n    let int16Opt = Map<String, Int16?>()\n    let int32Opt = Map<String, Int32?>()\n    let int64Opt = Map<String, Int64?>()\n    let floatOpt = Map<String, Float?>()\n    let doubleOpt = Map<String, Double?>()\n    let boolOpt = Map<String, Bool?>()\n    let stringOpt = Map<String, String?>()\n    let dataOpt = Map<String, Data?>()\n    let dateOpt = Map<String, Date?>()\n    let decimalOpt = Map<String, Decimal128?>()\n    let objectIdOpt = Map<String, ObjectId?>()\n    let uuidOpt = Map<String, UUID?>()\n}\n\nclass SwiftImplicitlyUnwrappedOptionalObject: Object {\n    @objc dynamic var optNSStringCol: NSString!\n    @objc dynamic var optStringCol: String!\n    @objc dynamic var optBinaryCol: Data!\n    @objc dynamic var optDateCol: Date!\n    @objc dynamic var optDecimalCol: Decimal128!\n    @objc dynamic var optObjectIdCol: ObjectId!\n    @objc dynamic var optObjectCol: SwiftBoolObject!\n    @objc dynamic var optUuidCol: UUID!\n}\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass SwiftOptionalDefaultValuesObject: Object {\n    @objc dynamic var optNSStringCol: NSString? = \"A\"\n    @objc dynamic var optStringCol: String? = \"B\"\n    @objc dynamic var optBinaryCol: Data? = Data(\"C\".utf8)\n    @objc dynamic var optDateCol: Date? = Date(timeIntervalSince1970: 10)\n    @objc dynamic var optDecimalCol: Decimal128? = \"123\"\n    @objc dynamic var optObjectIdCol: ObjectId? = ObjectId(\"1234567890ab1234567890ab\")\n    @objc dynamic var optUuidCol: UUID? = UUID(uuidString: \"00000000-0000-0000-0000-000000000000\")\n    let optIntCol = RealmOptional<Int>(1)\n    let optInt8Col = RealmOptional<Int8>(1)\n    let optInt16Col = RealmOptional<Int16>(1)\n    let optInt32Col = RealmOptional<Int32>(1)\n    let optInt64Col = RealmOptional<Int64>(1)\n    let optFloatCol = RealmOptional<Float>(2.2)\n    let optDoubleCol = RealmOptional<Double>(3.3)\n    let optBoolCol = RealmOptional<Bool>(true)\n    @objc dynamic var optObjectCol: SwiftBoolObject? = SwiftBoolObject(value: [true])\n\n    class func defaultValues() -> [String: Any] {\n        return [\n            \"optNSStringCol\": \"A\",\n            \"optStringCol\": \"B\",\n            \"optBinaryCol\": Data(\"C\".utf8),\n            \"optDateCol\": Date(timeIntervalSince1970: 10),\n            \"optDecimalCol\": Decimal128(\"123\"),\n            \"optObjectIdCol\": ObjectId(\"1234567890ab1234567890ab\"),\n            \"optIntCol\": 1,\n            \"optInt8Col\": Int8(1),\n            \"optInt16Col\": Int16(1),\n            \"optInt32Col\": Int32(1),\n            \"optInt64Col\": Int64(1),\n            \"optFloatCol\": 2.2 as Float,\n            \"optDoubleCol\": 3.3,\n            \"optBoolCol\": true,\n            \"optUuidCol\": UUID(uuidString: \"00000000-0000-0000-0000-000000000000\")!\n        ]\n    }\n}\n\nclass SwiftOptionalIgnoredPropertiesObject: Object {\n    @objc dynamic var id = 0\n\n    @objc dynamic var optNSStringCol: NSString? = \"A\"\n    @objc dynamic var optStringCol: String? = \"B\"\n    @objc dynamic var optBinaryCol: Data? = Data(\"C\".utf8)\n    @objc dynamic var optDateCol: Date? = Date(timeIntervalSince1970: 10)\n    @objc dynamic var optDecimalCol: Decimal128? = \"123\"\n    @objc dynamic var optObjectIdCol: ObjectId? = ObjectId(\"1234567890ab1234567890ab\")\n    @objc dynamic var optObjectCol: SwiftBoolObject? = SwiftBoolObject(value: [true])\n\n    override class func ignoredProperties() -> [String] {\n        return [\n            \"optNSStringCol\",\n            \"optStringCol\",\n            \"optBinaryCol\",\n            \"optDateCol\",\n            \"optDecimalCol\",\n            \"optObjectIdCol\",\n            \"optObjectCol\"\n        ]\n    }\n}\n\nclass SwiftDogObject: Object {\n    @objc dynamic var dogName = \"\"\n    let owners = LinkingObjects(fromType: SwiftOwnerObject.self, property: \"dog\")\n}\n\nclass SwiftOwnerObject: Object {\n    @objc dynamic var name = \"\"\n    @objc dynamic var dog: SwiftDogObject? = SwiftDogObject()\n}\n\nclass SwiftAggregateObject: Object {\n    @objc dynamic var intCol = 0\n    @objc dynamic var int8Col: Int8 = 0\n    @objc dynamic var int16Col: Int16 = 0\n    @objc dynamic var int32Col: Int32 = 0\n    @objc dynamic var int64Col: Int64 = 0\n    @objc dynamic var floatCol = 0 as Float\n    @objc dynamic var doubleCol = 0.0\n    @objc dynamic var decimalCol = 0.0 as Decimal128\n    @objc dynamic var boolCol = false\n    @objc dynamic var dateCol = Date()\n    @objc dynamic var trueCol = true\n    let stringListCol = List<SwiftStringObject>()\n}\n\nclass SwiftAllIntSizesObject: Object {\n    @objc dynamic var int8: Int8  = 0\n    @objc dynamic var int16: Int16 = 0\n    @objc dynamic var int32: Int32 = 0\n    @objc dynamic var int64: Int64 = 0\n}\n\nclass SwiftEmployeeObject: Object {\n    @objc dynamic var name = \"\"\n    @objc dynamic var age = 0\n    @objc dynamic var hired = false\n}\n\nclass SwiftCompanyObject: Object {\n    @objc dynamic var name = \"\"\n    let employees = List<SwiftEmployeeObject>()\n    let employeeSet = MutableSet<SwiftEmployeeObject>()\n    let employeeMap = Map<String, SwiftEmployeeObject?>()\n}\n\nclass SwiftArrayPropertyObject: Object {\n    @objc dynamic var name = \"\"\n    let array = List<SwiftStringObject>()\n    let intArray = List<SwiftIntObject>()\n    let swiftObjArray = List<SwiftObject>()\n}\n\nclass SwiftMutableSetPropertyObject: Object {\n    @objc dynamic var name = \"\"\n    let set = MutableSet<SwiftStringObject>()\n    let intSet = MutableSet<SwiftIntObject>()\n    let swiftObjSet = MutableSet<SwiftObject>()\n}\n\nclass SwiftMapPropertyObject: Object {\n    @objc dynamic var name = \"\"\n    let map = Map<String, SwiftStringObject?>()\n    let intMap = Map<String, SwiftIntObject?>()\n    let swiftObjectMap = Map<String, SwiftObject?>()\n    let dogMap = Map<String, SwiftDogObject?>()\n}\n\nclass SwiftDoubleListOfSwiftObject: Object {\n    let array = List<SwiftListOfSwiftObject>()\n}\n\nclass SwiftListOfSwiftObject: Object {\n    let array = List<SwiftObject>()\n}\n\nclass SwiftMutableSetOfSwiftObject: Object {\n    let set = MutableSet<SwiftObject>()\n}\n\nclass SwiftMapOfSwiftObject: Object {\n    let map = Map<String, SwiftObject?>()\n}\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass SwiftMapOfSwiftOptionalObject: Object {\n    let map = Map<String, SwiftOptionalObject?>()\n}\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass SwiftListOfSwiftOptionalObject: Object {\n    let array = List<SwiftOptionalObject>()\n}\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass SwiftMutableSetOfSwiftOptionalObject: Object {\n    let set = MutableSet<SwiftOptionalObject>()\n}\n\nclass SwiftArrayPropertySubclassObject: SwiftArrayPropertyObject {\n    let boolArray = List<SwiftBoolObject>()\n}\n\nclass SwiftLinkToPrimaryStringObject: Object {\n    @objc dynamic var pk = \"\"\n    @objc dynamic var object: SwiftPrimaryStringObject?\n    let objects = List<SwiftPrimaryStringObject>()\n\n    override class func primaryKey() -> String? {\n        return \"pk\"\n    }\n}\n\nclass SwiftUTF8Object: Object {\n    // swiftlint:disable:next identifier_name\n    @objc dynamic var 柱колоéнǢкƱаم👍 = \"值значен™👍☞⎠‱௹♣︎☐▼❒∑⨌⧭иеمرحبا\"\n}\n\nclass SwiftIgnoredPropertiesObject: Object {\n    @objc dynamic var name = \"\"\n    @objc dynamic var age = 0\n    @objc dynamic var runtimeProperty: AnyObject?\n    @objc dynamic var runtimeDefaultProperty = \"property\"\n    @objc dynamic var readOnlyProperty: Int { return 0 }\n\n    override class func ignoredProperties() -> [String] {\n        return [\"runtimeProperty\", \"runtimeDefaultProperty\"]\n    }\n}\n\nclass SwiftRecursiveObject: Object {\n    let objects = List<SwiftRecursiveObject>()\n    let objectSet = MutableSet<SwiftRecursiveObject>()\n}\n\nprotocol SwiftPrimaryKeyObjectType {\n    associatedtype PrimaryKey\n    static func primaryKey() -> String?\n}\n\nclass SwiftPrimaryStringObject: Object, SwiftPrimaryKeyObjectType {\n    @objc dynamic var stringCol = \"\"\n    @objc dynamic var intCol = 0\n\n    typealias PrimaryKey = String\n    override class func primaryKey() -> String? {\n        return \"stringCol\"\n    }\n}\n\nclass SwiftPrimaryOptionalStringObject: Object, SwiftPrimaryKeyObjectType {\n    @objc dynamic var stringCol: String? = \"\"\n    @objc dynamic var intCol = 0\n\n    typealias PrimaryKey = String?\n    override class func primaryKey() -> String? {\n        return \"stringCol\"\n    }\n}\n\nclass SwiftPrimaryIntObject: Object, SwiftPrimaryKeyObjectType {\n    @objc dynamic var stringCol = \"\"\n    @objc dynamic var intCol = 0\n\n    typealias PrimaryKey = Int\n    override class func primaryKey() -> String? {\n        return \"intCol\"\n    }\n}\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass SwiftPrimaryOptionalIntObject: Object, SwiftPrimaryKeyObjectType {\n    @objc dynamic var stringCol = \"\"\n    let intCol = RealmOptional<Int>()\n\n    typealias PrimaryKey = RealmOptional<Int>\n    override class func primaryKey() -> String? {\n        return \"intCol\"\n    }\n}\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass SwiftPrimaryInt8Object: Object, SwiftPrimaryKeyObjectType {\n    @objc dynamic var stringCol = \"\"\n    @objc dynamic var int8Col: Int8 = 0\n\n    typealias PrimaryKey = Int8\n    override class func primaryKey() -> String? {\n        return \"int8Col\"\n    }\n}\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass SwiftPrimaryOptionalInt8Object: Object, SwiftPrimaryKeyObjectType {\n    @objc dynamic var stringCol = \"\"\n    let int8Col = RealmOptional<Int8>()\n\n    typealias PrimaryKey = RealmOptional<Int8>\n    override class func primaryKey() -> String? {\n        return \"int8Col\"\n    }\n}\n\nclass SwiftPrimaryInt16Object: Object, SwiftPrimaryKeyObjectType {\n    @objc dynamic var stringCol = \"\"\n    @objc dynamic var int16Col: Int16 = 0\n\n    typealias PrimaryKey = Int16\n    override class func primaryKey() -> String? {\n        return \"int16Col\"\n    }\n}\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass SwiftPrimaryOptionalInt16Object: Object, SwiftPrimaryKeyObjectType {\n    @objc dynamic var stringCol = \"\"\n    let int16Col = RealmOptional<Int16>()\n\n    typealias PrimaryKey = RealmOptional<Int16>\n    override class func primaryKey() -> String? {\n        return \"int16Col\"\n    }\n}\n\nclass SwiftPrimaryInt32Object: Object, SwiftPrimaryKeyObjectType {\n    @objc dynamic var stringCol = \"\"\n    @objc dynamic var int32Col: Int32 = 0\n\n    typealias PrimaryKey = Int32\n    override class func primaryKey() -> String? {\n        return \"int32Col\"\n    }\n}\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass SwiftPrimaryOptionalInt32Object: Object, SwiftPrimaryKeyObjectType {\n    @objc dynamic var stringCol = \"\"\n    let int32Col = RealmOptional<Int32>()\n\n    typealias PrimaryKey = RealmOptional<Int32>\n    override class func primaryKey() -> String? {\n        return \"int32Col\"\n    }\n}\n\nclass SwiftPrimaryInt64Object: Object, SwiftPrimaryKeyObjectType {\n    @objc dynamic var stringCol = \"\"\n    @objc dynamic var int64Col: Int64 = 0\n\n    typealias PrimaryKey = Int64\n    override class func primaryKey() -> String? {\n        return \"int64Col\"\n    }\n}\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass SwiftPrimaryOptionalInt64Object: Object, SwiftPrimaryKeyObjectType {\n    @objc dynamic var stringCol = \"\"\n    let int64Col = RealmOptional<Int64>()\n\n    typealias PrimaryKey = RealmOptional<Int64>\n    override class func primaryKey() -> String? {\n        return \"int64Col\"\n    }\n}\n\nclass SwiftPrimaryUUIDObject: Object, SwiftPrimaryKeyObjectType {\n    @objc dynamic var uuidCol: UUID = UUID(uuidString: \"85d4fbee-6ec6-47df-bfa1-615931903d7e\")!\n    @objc dynamic var stringCol = \"\"\n\n    typealias PrimaryKey = Int64\n    override class func primaryKey() -> String? {\n        return \"uuidCol\"\n    }\n}\n\nclass SwiftPrimaryObjectIdObject: Object, SwiftPrimaryKeyObjectType {\n    @objc dynamic var objectIdCol: ObjectId = ObjectId.generate()\n    @objc dynamic var intCol = 0\n\n    typealias PrimaryKey = Int64\n    override class func primaryKey() -> String? {\n        return \"objectIdCol\"\n    }\n}\n\nclass SwiftIndexedPropertiesObject: Object {\n    @objc dynamic var stringCol = \"\"\n    @objc dynamic var intCol = 0\n    @objc dynamic var int8Col: Int8 = 0\n    @objc dynamic var int16Col: Int16 = 0\n    @objc dynamic var int32Col: Int32 = 0\n    @objc dynamic var int64Col: Int64 = 0\n    @objc dynamic var boolCol = false\n    @objc dynamic var dateCol = Date()\n    @objc dynamic var uuidCol = UUID(uuidString: \"85d4fbee-6ec6-47df-bfa1-615931903d7e\")!\n\n    @objc dynamic var floatCol: Float = 0.0\n    @objc dynamic var doubleCol: Double = 0.0\n    @objc dynamic var dataCol = Data()\n\n    let anyCol = RealmProperty<AnyRealmValue>()\n\n    override class func indexedProperties() -> [String] {\n        return [\"stringCol\", \"intCol\", \"int8Col\", \"int16Col\",\n                \"int32Col\", \"int64Col\", \"boolCol\", \"dateCol\", \"anyCol\", \"uuidCol\"]\n    }\n}\n\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass SwiftIndexedOptionalPropertiesObject: Object {\n    @objc dynamic var optionalStringCol: String? = \"\"\n    let optionalIntCol = RealmOptional<Int>()\n    let optionalInt8Col = RealmOptional<Int8>()\n    let optionalInt16Col = RealmOptional<Int16>()\n    let optionalInt32Col = RealmOptional<Int32>()\n    let optionalInt64Col = RealmOptional<Int64>()\n    let optionalBoolCol = RealmOptional<Bool>()\n    @objc dynamic var optionalDateCol: Date? = Date()\n    @objc dynamic var optionalUUIDCol: UUID? = UUID(uuidString: \"85d4fbee-6ec6-47df-bfa1-615931903d7e\")\n\n    let optionalFloatCol = RealmOptional<Float>()\n    let optionalDoubleCol = RealmOptional<Double>()\n    @objc dynamic var optionalDataCol: Data? = Data()\n\n    override class func indexedProperties() -> [String] {\n        return [\"optionalStringCol\", \"optionalIntCol\", \"optionalInt8Col\", \"optionalInt16Col\",\n            \"optionalInt32Col\", \"optionalInt64Col\", \"optionalBoolCol\", \"optionalDateCol\", \"optionalUUIDCol\"]\n    }\n}\n\nclass SwiftCustomInitializerObject: Object {\n    @objc dynamic var stringCol: String\n\n    init(stringVal: String) {\n        stringCol = stringVal\n        super.init()\n    }\n\n    required override init() {\n        stringCol = \"\"\n        super.init()\n    }\n}\n\nclass SwiftConvenienceInitializerObject: Object {\n    @objc dynamic var stringCol = \"\"\n\n    convenience init(stringCol: String) {\n        self.init()\n        self.stringCol = stringCol\n    }\n}\n\nclass SwiftObjectiveCTypesObject: Object {\n    @objc dynamic var stringCol: NSString?\n    @objc dynamic var dateCol: NSDate?\n    @objc dynamic var dataCol: NSData?\n}\n\nclass SwiftComputedPropertyNotIgnoredObject: Object {\n    @objc dynamic var _urlBacking = \"\"\n\n    // Dynamic; no ivar\n    @objc dynamic var dynamicURL: URL? {\n        get {\n            return URL(string: _urlBacking)\n        }\n        set {\n            _urlBacking = newValue?.absoluteString ?? \"\"\n        }\n    }\n\n    // Non-dynamic; no ivar\n    var url: URL? {\n        get {\n            return URL(string: _urlBacking)\n        }\n        set {\n            _urlBacking = newValue?.absoluteString ?? \"\"\n        }\n    }\n}\n\n@objc(SwiftObjcRenamedObject)\nclass SwiftObjcRenamedObject: Object {\n    @objc dynamic var stringCol = \"\"\n}\n\n@objc(SwiftObjcRenamedObjectWithTotallyDifferentName)\nclass SwiftObjcArbitrarilyRenamedObject: Object {\n    @objc dynamic var boolCol = false\n}\n\nclass SwiftCircleObject: Object {\n    @objc dynamic var obj: SwiftCircleObject?\n    let array = List<SwiftCircleObject>()\n}\n\n// Exists to serve as a superclass to `SwiftGenericPropsOrderingObject`\nclass SwiftGenericPropsOrderingParent: Object {\n    var implicitlyIgnoredComputedProperty: Int { return 0 }\n    let implicitlyIgnoredReadOnlyProperty: Int = 1\n    let parentFirstList = List<SwiftIntObject>()\n    let parentFirstSet = MutableSet<SwiftIntObject>()\n    @objc dynamic var parentFirstNumber = 0\n    func parentFunction() -> Int { return parentFirstNumber + 1 }\n    @objc dynamic var parentSecondNumber = 1\n    var parentComputedProp: String { return \"hello world\" }\n}\n\n// Used to verify that Swift properties (generic and otherwise) are detected properly and\n// added to the schema in the correct order.\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass SwiftGenericPropsOrderingObject: SwiftGenericPropsOrderingParent {\n    func myFunction() -> Int { return firstNumber + secondNumber + thirdNumber }\n    @objc dynamic var dynamicComputed: Int { return 999 }\n    var firstIgnored = 999\n    @objc dynamic var dynamicIgnored = 999\n    @objc dynamic var firstNumber = 0                   // Managed property\n    class func myClassFunction(x: Int, y: Int) -> Int { return x + y }\n    var secondIgnored = 999\n    lazy var lazyIgnored = 999\n    let firstArray = List<SwiftStringObject>()          // Managed property\n    let firstSet = MutableSet<SwiftStringObject>()          // Managed property\n    @objc dynamic var secondNumber = 0                  // Managed property\n    var computedProp: String { return \"\\(firstNumber), \\(secondNumber), and \\(thirdNumber)\" }\n    let secondArray = List<SwiftStringObject>()         // Managed property\n    let secondSet = MutableSet<SwiftStringObject>()         // Managed property\n    override class func ignoredProperties() -> [String] {\n        return [\"firstIgnored\", \"dynamicIgnored\", \"secondIgnored\", \"thirdIgnored\", \"lazyIgnored\", \"dynamicLazyIgnored\"]\n    }\n    let firstOptionalNumber = RealmOptional<Int>()      // Managed property\n    var thirdIgnored = 999\n    @objc dynamic lazy var dynamicLazyIgnored = 999\n    let firstLinking = LinkingObjects(fromType: SwiftGenericPropsOrderingHelper.self, property: \"first\")\n    let secondLinking = LinkingObjects(fromType: SwiftGenericPropsOrderingHelper.self, property: \"second\")\n    @objc dynamic var thirdNumber = 0                   // Managed property\n    let secondOptionalNumber = RealmOptional<Int>()     // Managed property\n}\n\n// Only exists to allow linking object properties on `SwiftGenericPropsNotLastObject`.\n@available(*, deprecated) // Silence deprecation warnings for RealmOptional\nclass SwiftGenericPropsOrderingHelper: Object {\n    @objc dynamic var first: SwiftGenericPropsOrderingObject?\n    @objc dynamic var second: SwiftGenericPropsOrderingObject?\n}\n\nclass SwiftRenamedProperties1: Object {\n    @objc dynamic var propA = 0\n    @objc dynamic var propB = \"\"\n    let linking1 = LinkingObjects(fromType: LinkToSwiftRenamedProperties1.self, property: \"linkA\")\n    let linking2 = LinkingObjects(fromType: LinkToSwiftRenamedProperties2.self, property: \"linkD\")\n\n    override class func _realmObjectName() -> String { return \"Swift Renamed Properties\" }\n    override class func propertiesMapping() -> [String: String] {\n        return [\"propA\": \"prop 1\", \"propB\": \"prop 2\"]\n    }\n}\n\nclass SwiftRenamedProperties2: Object {\n    @objc dynamic var propC = 0\n    @objc dynamic var propD = \"\"\n    let linking1 = LinkingObjects(fromType: LinkToSwiftRenamedProperties1.self, property: \"linkA\")\n    let linking2 = LinkingObjects(fromType: LinkToSwiftRenamedProperties2.self, property: \"linkD\")\n\n    override class func _realmObjectName() -> String { return \"Swift Renamed Properties\" }\n    override class func propertiesMapping() -> [String: String] {\n        return [\"propC\": \"prop 1\", \"propD\": \"prop 2\"]\n    }\n}\n\nclass LinkToSwiftRenamedProperties1: Object {\n    @objc dynamic var linkA: SwiftRenamedProperties1?\n    @objc dynamic var linkB: SwiftRenamedProperties2?\n    let array1 = List<SwiftRenamedProperties1>()\n    let set1 = MutableSet<SwiftRenamedProperties1>()\n\n    override class func _realmObjectName() -> String { return \"Link To Swift Renamed Properties\" }\n    override class func propertiesMapping() -> [String: String] {\n        return [\"linkA\": \"link 1\", \"linkB\": \"link 2\", \"array1\": \"array\", \"set1\": \"set\"]\n    }\n}\n\nclass LinkToSwiftRenamedProperties2: Object {\n    @objc dynamic var linkC: SwiftRenamedProperties1?\n    @objc dynamic var linkD: SwiftRenamedProperties2?\n    let array2 = List<SwiftRenamedProperties2>()\n    let set2 = MutableSet<SwiftRenamedProperties2>()\n\n    override class func _realmObjectName() -> String { return \"Link To Swift Renamed Properties\" }\n    override class func propertiesMapping() -> [String: String] {\n        return [\"linkC\": \"link 1\", \"linkD\": \"link 2\", \"array2\": \"array\", \"set2\": \"set\"]\n    }\n}\n\nclass EmbeddedParentObject: Object {\n    @objc dynamic var object: EmbeddedTreeObject1?\n    let array = List<EmbeddedTreeObject1>()\n    let map = Map<String, EmbeddedTreeObject1?>()\n}\n\nclass EmbeddedPrimaryParentObject: Object {\n    @objc dynamic var pk: Int = 0\n    @objc dynamic var object: EmbeddedTreeObject1?\n    let array = List<EmbeddedTreeObject1>()\n\n    override class func primaryKey() -> String? {\n        return \"pk\"\n    }\n}\n\nprotocol EmbeddedTreeObject: EmbeddedObject {\n    var value: Int { get set }\n}\n\nclass EmbeddedTreeObject1: EmbeddedObject, EmbeddedTreeObject {\n    @objc dynamic var value = 0\n    @objc dynamic var child: EmbeddedTreeObject2?\n    let children = List<EmbeddedTreeObject2>()\n\n    let parent1 = LinkingObjects(fromType: EmbeddedParentObject.self, property: \"object\")\n    let parent2 = LinkingObjects(fromType: EmbeddedParentObject.self, property: \"array\")\n}\n\nclass EmbeddedTreeObject2: EmbeddedObject, EmbeddedTreeObject {\n    @objc dynamic var value = 0\n    @objc dynamic var child: EmbeddedTreeObject3?\n    let children = List<EmbeddedTreeObject3>()\n\n    let parent3 = LinkingObjects(fromType: EmbeddedTreeObject1.self, property: \"child\")\n    let parent4 = LinkingObjects(fromType: EmbeddedTreeObject1.self, property: \"children\")\n}\n\nclass EmbeddedTreeObject3: EmbeddedObject, EmbeddedTreeObject {\n    @objc dynamic var value = 0\n\n    let parent3 = LinkingObjects(fromType: EmbeddedTreeObject2.self, property: \"child\")\n    let parent4 = LinkingObjects(fromType: EmbeddedTreeObject2.self, property: \"children\")\n}\n\nclass ObjectWithNestedEmbeddedObject: Object {\n    @objc dynamic var value = 0\n    @objc dynamic var inner: NestedInnerClass?\n\n    @objc(ObjectWithNestedEmbeddedObject_NestedInnerClass)\n    class NestedInnerClass: EmbeddedObject {\n        @objc dynamic var value = 0\n    }\n}\n\n@objc(PrivateObjectSubclass)\nprivate class PrivateObjectSubclass: Object {\n    @objc dynamic var value = 0\n}\n\nclass LinkToOnlyComputed: Object {\n    @Persisted var value: Int = 0\n    @Persisted var link: OnlyComputedProps?\n}\n\nclass OnlyComputedProps: Object {\n    @Persisted(originProperty: \"link\") var backlinks: LinkingObjects<LinkToOnlyComputed>\n}\n"
  },
  {
    "path": "RealmSwift/Tests/SwiftUITests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\nimport SwiftUI\nimport Combine\n\nclass SwiftUIObject: Object, ObjectKeyIdentifiable {\n    @Persisted var list: RealmSwift.List<SwiftBoolObject>\n    @Persisted var stringList: RealmSwift.List<SwiftStringObject>\n    @Persisted var set: RealmSwift.MutableSet<SwiftBoolObject>\n    @Persisted var map: Map<String, SwiftBoolObject?>\n    @Persisted var primitiveList: RealmSwift.List<Int>\n    @Persisted var primitiveSet: RealmSwift.MutableSet<Int>\n    @Persisted var primitiveMap: Map<String, Int>\n    @Persisted var str = \"foo\"\n    @Persisted var int = 0\n\n    convenience init(str: String = \"foo\") {\n        self.init()\n        self.str = str\n    }\n}\n\nclass UIElementsProjection: Projection<SwiftUIObject>, ObjectKeyIdentifiable {\n    @Projected(\\SwiftUIObject.str) var label\n    @Projected(\\SwiftUIObject.int) var counter\n}\n\nclass EmbeddedTreeSwiftUIObject1: EmbeddedObject, EmbeddedTreeObject, ObjectKeyIdentifiable {\n    @objc dynamic var value = 0\n    @objc dynamic var child: EmbeddedTreeObject2?\n    let children = RealmSwift.List<EmbeddedTreeObject2>()\n}\n\nprivate let inMemoryIdentifier = \"swiftui-tests\"\n\nfunc hasSwiftUI() -> Bool {\n    if #available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) {\n        return true\n    }\n    return false\n}\n\n@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)\nclass SwiftUITests: TestCase {\n    override class var defaultTestSuite: XCTestSuite {\n        if hasSwiftUI() {\n            return super.defaultTestSuite\n        }\n        return XCTestSuite(name: \"\\(type(of: self))\")\n    }\n\n    // MARK: - List Operations\n\n    @MainActor func testManagedUnmanagedListAppendPrimitive() throws {\n        let object = SwiftUIObject()\n        @StateRealmObject var state = object.primitiveList\n        XCTAssertEqual(state.count, 0)\n        $state.append(1)\n        XCTAssertEqual(state.count, 1)\n\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try realm.write { realm.add(object) }\n\n        $state.append(2)\n        XCTAssertEqual(state.count, 2)\n    }\n\n    @MainActor func testManagedUnmanagedListAppendUnmanagedObject() throws {\n        let object = SwiftUIObject()\n        @StateRealmObject var state = object.list\n        XCTAssertEqual(state.count, 0)\n        $state.append(SwiftBoolObject())\n        XCTAssertEqual(state.count, 1)\n\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try realm.write { realm.add(object) }\n\n        $state.append(SwiftBoolObject())\n        XCTAssertEqual(state.count, 2)\n    }\n\n    @MainActor func testManagedListAppendUnmanagedObservedObject() throws {\n        let object = SwiftUIObject()\n        @StateRealmObject var state = object.list\n        XCTAssertEqual(state.count, 0)\n\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try realm.write { realm.add(object) }\n\n        _state.update()\n        $state.append(SwiftBoolObject())\n        XCTAssertEqual(state.count, 1)\n    }\n\n    @MainActor func testManagedListAppendFrozenObject() throws {\n        let listObj = SwiftUIObject()\n        @StateRealmObject var state = listObj.list\n        XCTAssertEqual(state.count, 0)\n\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        let obj = SwiftBoolObject()\n        try realm.write {\n            realm.add(listObj)\n            realm.add(obj)\n        }\n        let frozen = obj.freeze()\n\n        _state.update()\n        $state.append(frozen)\n        XCTAssertEqual(state.count, 1)\n    }\n\n    @MainActor func testManagedUnmanagedListRemovePrimitive() throws {\n        let object = SwiftUIObject()\n        @StateRealmObject var state = object.primitiveList\n        XCTAssertEqual(state.count, 0)\n        $state.append(1)\n        XCTAssertEqual(state.count, 1)\n\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try realm.write { realm.add(object) }\n\n        $state.append(2)\n        XCTAssertEqual(state.count, 2)\n\n        $state.remove(at: 0)\n        XCTAssertEqual(state[0], 2)\n        XCTAssertEqual(state.count, 1)\n    }\n\n    @MainActor func testManagedUnmanagedListRemoveUnmanagedObject() throws {\n        let object = SwiftUIObject()\n        @StateRealmObject var state = object.list\n        XCTAssertEqual(state.count, 0)\n        $state.append(SwiftBoolObject())\n        XCTAssertEqual(state.count, 1)\n        $state.remove(at: 0)\n        XCTAssertEqual(state.count, 0)\n    }\n\n    @MainActor func testManagedListAppendRemoveObservedObject() throws {\n        let object = SwiftUIObject()\n        @StateRealmObject var state = object.list\n        XCTAssertEqual(state.count, 0)\n\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try realm.write { realm.add(object) }\n\n        _state.update()\n        $state.append(SwiftBoolObject())\n        XCTAssertEqual(state.count, 1)\n\n        $state.remove(at: 0)\n        XCTAssertEqual(state.count, 0)\n    }\n\n    // MARK: - MutableSet Operations\n\n    @MainActor func testManagedUnmanagedMutableSetInsertPrimitive() throws {\n        let object = SwiftUIObject()\n        @StateRealmObject var state = object.primitiveSet\n        XCTAssertEqual(state.count, 0)\n        $state.insert(1)\n        XCTAssertEqual(state.count, 1)\n\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try realm.write { realm.add(object) }\n\n        $state.insert(2)\n        XCTAssertEqual(state.count, 2)\n    }\n    @MainActor func testManagedUnmanagedMutableSetInsertUnmanagedObject() throws {\n        let object = SwiftUIObject()\n        @StateRealmObject var state = object.set\n        XCTAssertEqual(state.count, 0)\n        $state.insert(SwiftBoolObject())\n        XCTAssertEqual(state.count, 1)\n\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try realm.write { realm.add(object) }\n\n        $state.insert(SwiftBoolObject())\n        XCTAssertEqual(state.count, 2)\n    }\n    @MainActor func testManagedMutableSetInsertUnmanagedObservedObject() throws {\n        let object = SwiftUIObject()\n        @StateRealmObject var state = object.set\n        XCTAssertEqual(state.count, 0)\n\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try realm.write { realm.add(object) }\n\n        _state.update()\n        $state.insert(SwiftBoolObject())\n        XCTAssertEqual(state.count, 1)\n    }\n    @MainActor func testManagedMutableSetInsertFrozenObject() throws {\n        let object = SwiftUIObject()\n        @StateRealmObject var state = object.set\n        XCTAssertEqual(state.count, 0)\n\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        let obj = SwiftBoolObject()\n        try realm.write {\n            realm.add(object)\n            realm.add(obj)\n        }\n        let frozen = obj.freeze()\n        _state.update()\n        $state.insert(frozen)\n        XCTAssertEqual(state.count, 1)\n    }\n    @MainActor func testMutableSetRemovePrimitive() throws {\n        let object = SwiftUIObject()\n        @StateRealmObject var state = object.primitiveSet\n        XCTAssertEqual(state.count, 0)\n        $state.insert(1)\n        XCTAssertEqual(state.count, 1)\n\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try realm.write { realm.add(object) }\n\n        $state.insert(2)\n        XCTAssertEqual(state.count, 2)\n\n        $state.remove(1)\n        XCTAssertEqual(state.count, 1)\n    }\n    @MainActor func testUnmanagedMutableSetRemoveUnmanagedObject() throws {\n        let object = SwiftUIObject()\n        @StateRealmObject var state = object.set\n        XCTAssertEqual(state.count, 0)\n        let obj = SwiftBoolObject()\n        $state.insert(obj)\n        XCTAssertEqual(state.count, 1)\n        $state.remove(obj)\n        XCTAssertEqual(state.count, 0)\n    }\n    @MainActor func testManagedMutableSetRemoveUnmanagedObject() throws {\n        let object = SwiftUIObject()\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try realm.write { realm.add(object) }\n        @StateRealmObject var state = object.set\n        XCTAssertEqual(state.count, 0)\n        let obj = SwiftBoolObject()\n        $state.insert(obj)\n        XCTAssertEqual(state.count, 1)\n        XCTAssertNotNil(obj.realm)\n        $state.remove(obj)\n        XCTAssertEqual(state.count, 0)\n    }\n\n    @MainActor func testManagedMutableSetRemoveObservedObject() throws {\n        let object = SwiftUIObject()\n        @StateRealmObject var state = object.set\n        XCTAssertEqual(state.count, 0)\n\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try realm.write { realm.add(object) }\n\n        _state.update()\n        let obj = SwiftBoolObject()\n        let objState = StateRealmObject(wrappedValue: obj)\n\n        var hit = 0\n        // This will append an observer to SwiftUIKVO\n        let cancellable = objState._publisher\n            .sink { _ in\n            } receiveValue: { _ in\n                hit += 1\n            }\n        objState.wrappedValue.boolCol = true\n        XCTAssertEqual(hit, 1)\n        $state.insert(objState.wrappedValue)\n        XCTAssertEqual(state.count, 1)\n        $state.remove(objState.wrappedValue)\n        XCTAssertEqual(state.count, 0)\n        cancellable.cancel()\n    }\n\n    // MARK: - Map Operations\n\n    @MainActor func testManagedUnmanagedMapAppendPrimitive() throws {\n        let object = SwiftUIObject()\n        @StateRealmObject var state = object.primitiveMap\n        XCTAssertEqual(state.count, 0)\n        $state.set(object: 1, for: \"one\")\n        XCTAssertEqual(state.count, 1)\n        XCTAssertEqual($state[\"one\"], 1)\n\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try realm.write { realm.add(object) }\n\n        $state.set(object: 2, for: \"two\")\n        $state.set(object: 3, for: \"two\")\n        XCTAssertEqual(state.count, 2)\n        XCTAssertEqual($state[\"two\"], 3)\n    }\n\n    @MainActor func testManagedUnmanagedMapAppendUnmanagedObject() throws {\n        let object = SwiftUIObject()\n        @StateRealmObject var state = object.map\n        XCTAssertEqual(state.count, 0)\n        $state.set(object: SwiftBoolObject(), for: \"one\")\n        XCTAssertEqual(state.count, 1)\n\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try realm.write { realm.add(object) }\n\n        $state.set(object: SwiftBoolObject(), for: \"two\")\n        XCTAssertEqual(state.count, 2)\n    }\n\n    @MainActor func testManagedMapAppendUnmanagedObservedObject() throws {\n        let object = SwiftUIObject()\n        @StateRealmObject var state = object.map\n        XCTAssertEqual(state.count, 0)\n\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try realm.write { realm.add(object) }\n\n        _state.update()\n        $state.set(object: SwiftBoolObject(), for: \"one\")\n        XCTAssertEqual(state.count, 1)\n    }\n\n    @MainActor func testManagedUnmanagedMapRemovePrimitive() throws {\n        let object = SwiftUIObject()\n        @StateRealmObject var state = object.primitiveMap\n        XCTAssertEqual(state.count, 0)\n        $state.set(object: 1, for: \"one\")\n        XCTAssertEqual(state.count, 1)\n\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try realm.write { realm.add(object) }\n\n        $state.set(object: 2, for: \"two\")\n        XCTAssertEqual(state.count, 2)\n\n        $state.set(object: nil, for: \"one\")\n        XCTAssertEqual(state.count, 1)\n        XCTAssertEqual(state.keys, [\"two\"])\n    }\n\n    @MainActor func testManagedUnmanagedMapRemoveUnmanagedObject() throws {\n        let object = SwiftUIObject()\n        @StateRealmObject var state = object.map\n        XCTAssertEqual(state.count, 0)\n        $state.set(object: SwiftBoolObject(), for: \"one\")\n        XCTAssertEqual(state.count, 1)\n        $state.set(object: nil, for: \"one\")\n        XCTAssertEqual(state.count, 0)\n    }\n\n    @MainActor func testManagedMapAppendRemoveObservedObject() throws {\n        let object = SwiftUIObject()\n        @StateRealmObject var state = object.map\n        XCTAssertEqual(state.count, 0)\n\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try realm.write { realm.add(object) }\n\n        _state.update()\n        $state.set(object: SwiftBoolObject(), for: \"one\")\n        XCTAssertEqual(state.count, 1)\n\n        $state.set(object: nil, for: \"one\")\n        XCTAssertEqual(state.count, 0)\n    }\n\n    // MARK: - ObservedResults Operations\n    @MainActor func testResultsAppendUnmanagedObject() throws {\n        let object = SwiftUIObject()\n        let fullResults = ObservedResults(SwiftUIObject.self,\n                                          configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        XCTAssertEqual(fullResults.wrappedValue.count, 0)\n        fullResults.projectedValue.append(object)\n        XCTAssertEqual(fullResults.wrappedValue.count, 1)\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        realm.beginWrite()\n        object.str = \"abc\"\n        object.int = 1\n        // add another default inited object for filter comparison\n        realm.add(SwiftUIObject())\n        try realm.commitWrite()\n        let filteredResults = ObservedResults(SwiftUIObject.self,\n                                              configuration: inMemoryRealm(inMemoryIdentifier).configuration,\n                                              filter: NSPredicate(format: \"str = %@\", \"abc\"))\n        XCTAssertEqual(fullResults.wrappedValue.count, 2)\n        XCTAssertEqual(filteredResults.wrappedValue.count, 1)\n        var sortedResults = ObservedResults(SwiftUIObject.self,\n                                            configuration: inMemoryRealm(inMemoryIdentifier).configuration,\n                                            filter: NSPredicate(format: \"int >= 0\"),\n                                            sortDescriptor: SortDescriptor(keyPath: \"int\", ascending: true))\n        XCTAssertEqual(sortedResults.wrappedValue.count, 2)\n        XCTAssertEqual(sortedResults.wrappedValue[0].int, 0)\n        XCTAssertEqual(sortedResults.wrappedValue[1].int, 1)\n        sortedResults = ObservedResults(SwiftUIObject.self,\n                                        configuration: inMemoryRealm(inMemoryIdentifier).configuration,\n                                        filter: NSPredicate(format: \"int >= 0\"),\n                                        sortDescriptor: SortDescriptor(keyPath: \"int\", ascending: false))\n        XCTAssertEqual(sortedResults.wrappedValue.count, 2)\n        XCTAssertEqual(sortedResults.wrappedValue[0].int, 1)\n        XCTAssertEqual(sortedResults.wrappedValue[1].int, 0)\n    }\n    @MainActor func testResultsAppendManagedObject() throws {\n        @ObservedResults(SwiftUIObject.self, configuration: inMemoryRealm(inMemoryIdentifier).configuration) var state\n        let object = SwiftUIObject()\n        XCTAssertEqual(state.count, 0)\n        $state.append(object)\n        XCTAssertEqual(state.count, 1)\n        $state.append(object)\n        XCTAssertEqual(state.count, 1)\n    }\n    @MainActor func testResultsRemoveUnmanagedObject() throws {\n        @ObservedResults(SwiftUIObject.self, configuration: inMemoryRealm(inMemoryIdentifier).configuration) var state\n        let object = SwiftUIObject()\n        XCTAssertEqual(state.count, 0)\n        assertThrows($state.remove(object))\n        XCTAssertEqual(state.count, 0)\n    }\n    @MainActor func testResultsRemoveManagedObject() throws {\n        @ObservedResults(SwiftUIObject.self, configuration: inMemoryRealm(inMemoryIdentifier).configuration) var state\n        let object = SwiftUIObject()\n        XCTAssertEqual(state.count, 0)\n        $state.append(object)\n        XCTAssertEqual(state.count, 1)\n        $state.remove(object)\n        XCTAssertEqual(state.count, 0)\n    }\n    @MainActor func testResultsMoveUnmanagedObject() throws {\n        @ObservedResults(SwiftUIObject.self, configuration: inMemoryRealm(inMemoryIdentifier).configuration) var state\n        let object = SwiftUIObject()\n        XCTAssertEqual(state.count, 0)\n\n        object.stringList.append(SwiftStringObject(stringCol: \"Tom\"))\n        object.stringList.append(SwiftStringObject(stringCol: \"Sam\"))\n        object.stringList.append(SwiftStringObject(stringCol: \"Dan\"))\n        object.stringList.append(SwiftStringObject(stringCol: \"Paul\"))\n\n        let binding = object.bind(\\.stringList)\n        XCTAssertEqual(object.stringList.first!.stringCol, \"Tom\")\n        XCTAssertEqual(object.stringList[1].stringCol, \"Sam\")\n        XCTAssertEqual(object.stringList[2].stringCol, \"Dan\")\n        XCTAssertEqual(object.stringList.last!.stringCol, \"Paul\")\n\n        binding.move(fromOffsets: IndexSet([0]), toOffset: 3)\n        XCTAssertEqual(object.stringList.first!.stringCol, \"Sam\")\n        XCTAssertEqual(object.stringList[1].stringCol, \"Dan\")\n        XCTAssertEqual(object.stringList[2].stringCol, \"Tom\")\n        XCTAssertEqual(object.stringList.last!.stringCol, \"Paul\")\n\n        binding.move(fromOffsets: IndexSet([2]), toOffset: 4)\n        XCTAssertEqual(object.stringList.first!.stringCol, \"Sam\")\n        XCTAssertEqual(object.stringList[1].stringCol, \"Dan\")\n        XCTAssertEqual(object.stringList[2].stringCol, \"Paul\")\n        XCTAssertEqual(object.stringList.last!.stringCol, \"Tom\")\n\n        binding.move(fromOffsets: IndexSet([3]), toOffset: 0)\n        XCTAssertEqual(object.stringList.first!.stringCol, \"Tom\")\n        XCTAssertEqual(object.stringList[1].stringCol, \"Sam\")\n        XCTAssertEqual(object.stringList[2].stringCol, \"Dan\")\n        XCTAssertEqual(object.stringList.last!.stringCol, \"Paul\")\n\n        XCTAssertEqual(state.count, 0)\n    }\n    @MainActor func testResultsMoveManagedObject() throws {\n        @ObservedResults(SwiftUIObject.self, configuration: inMemoryRealm(inMemoryIdentifier).configuration) var state\n        let object = SwiftUIObject()\n        XCTAssertEqual(state.count, 0)\n\n        object.stringList.append(SwiftStringObject(stringCol: \"Tom\"))\n        object.stringList.append(SwiftStringObject(stringCol: \"Sam\"))\n        object.stringList.append(SwiftStringObject(stringCol: \"Dan\"))\n        object.stringList.append(SwiftStringObject(stringCol: \"Paul\"))\n\n        $state.append(object)\n\n        let binding = object.bind(\\.stringList)\n        XCTAssertEqual(object.stringList.first!.stringCol, \"Tom\")\n        XCTAssertEqual(object.stringList[1].stringCol, \"Sam\")\n        XCTAssertEqual(object.stringList[2].stringCol, \"Dan\")\n        XCTAssertEqual(object.stringList.last!.stringCol, \"Paul\")\n\n        binding.move(fromOffsets: IndexSet([0]), toOffset: 3)\n        XCTAssertEqual(object.stringList.first!.stringCol, \"Sam\")\n        XCTAssertEqual(object.stringList[1].stringCol, \"Dan\")\n        XCTAssertEqual(object.stringList[2].stringCol, \"Tom\")\n        XCTAssertEqual(object.stringList.last!.stringCol, \"Paul\")\n\n        binding.move(fromOffsets: IndexSet([2]), toOffset: 4)\n        XCTAssertEqual(object.stringList.first!.stringCol, \"Sam\")\n        XCTAssertEqual(object.stringList[1].stringCol, \"Dan\")\n        XCTAssertEqual(object.stringList[2].stringCol, \"Paul\")\n        XCTAssertEqual(object.stringList.last!.stringCol, \"Tom\")\n\n        binding.move(fromOffsets: IndexSet([3]), toOffset: 0)\n        XCTAssertEqual(object.stringList.first!.stringCol, \"Tom\")\n        XCTAssertEqual(object.stringList[1].stringCol, \"Sam\")\n        XCTAssertEqual(object.stringList[2].stringCol, \"Dan\")\n        XCTAssertEqual(object.stringList.last!.stringCol, \"Paul\")\n\n        XCTAssertEqual(state.count, 1)\n    }\n    @MainActor func testSwiftQuerySyntax() throws {\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try realm.write {\n            realm.add(SwiftUIObject(value: [\"str\": \"apple\"]))\n            realm.add(SwiftUIObject(value: [\"str\": \"antenna\"]))\n            realm.add(SwiftUIObject(value: [\"str\": \"baz\"]))\n        }\n\n        let filteredResults = ObservedResults(SwiftUIObject.self,\n                                              configuration: realm.configuration,\n                                              where: { $0.str.starts(with: \"a\") },\n                                              sortDescriptor: SortDescriptor.init(keyPath: \\SwiftUIObject.str, ascending: true))\n        XCTAssertEqual(filteredResults.wrappedValue.count, 2)\n        XCTAssertEqual(filteredResults.wrappedValue[0].str, \"antenna\")\n    }\n    @MainActor func testResultsAppendFrozenObject() throws {\n        let state1 = ObservedResults(SwiftUIObject.self, configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        let object1 = SwiftUIObject()\n        XCTAssertEqual(state1.wrappedValue.count, 0)\n        state1.projectedValue.append(object1)\n        XCTAssertEqual(state1.wrappedValue.count, 1)\n        state1.projectedValue.append(object1)\n        XCTAssertEqual(state1.wrappedValue.count, 1)\n        let state2 = ObservedResults(SwiftUIObject.self, configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        for item in state1.wrappedValue {\n            XCTAssert(item.isFrozen)\n            state2.append(item)\n        }\n        XCTAssertEqual(state1.wrappedValue.count, 1)\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        let object2 = SwiftUIObject()\n        try! realm.write {\n            realm.add(object2)\n        }\n        let frozenObj = object2.freeze()\n        state2.append(frozenObj)\n        XCTAssertEqual(state1.wrappedValue.count, 2)\n        XCTAssertEqual(state2.wrappedValue.count, 2)\n    }\n    // MARK: Object Operations\n    @MainActor func testUnmanagedObjectModification() throws {\n        @StateRealmObject var state = SwiftUIObject()\n        state.str = \"bar\"\n        XCTAssertEqual(state.str, \"bar\")\n        XCTAssertEqual($state.wrappedValue.str, \"bar\")\n    }\n    @MainActor func testManagedObjectModification() throws {\n        @StateRealmObject var state = SwiftUIObject()\n        ObservedResults(SwiftUIObject.self,\n                        configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n            .projectedValue.append(state)\n        assertThrows(state.str = \"bar\")\n        $state.str.wrappedValue = \"bar\"\n        XCTAssertEqual($state.wrappedValue.str, \"bar\")\n    }\n    @MainActor func testManagedObjectDelete() throws {\n        let results = ObservedResults(SwiftUIObject.self,\n                                      configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        @StateRealmObject var state = SwiftUIObject()\n        XCTAssertEqual(results.wrappedValue.count, 0)\n        $state.delete()\n        XCTAssertEqual(results.wrappedValue.count, 0)\n        results.projectedValue.append(state)\n        XCTAssertEqual(results.wrappedValue.count, 1)\n        $state.delete()\n    }\n    // MARK: Bind\n    @MainActor func testUnmanagedManagedObjectBind() {\n        let object = SwiftUIObject()\n        let binding = object.bind(\\.str)\n        XCTAssertEqual(object.str, \"foo\")\n        XCTAssertEqual(binding.wrappedValue, \"foo\")\n        binding.wrappedValue = \"bar\"\n        XCTAssertEqual(binding.wrappedValue, \"bar\")\n\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try? realm.write { realm.add(object) }\n\n        let managedBinding = object.bind(\\.str)\n        XCTAssertEqual(object.str, \"bar\")\n        XCTAssertEqual(binding.wrappedValue, \"bar\")\n        managedBinding.wrappedValue = \"baz\"\n        XCTAssertEqual(object.str, \"baz\")\n        XCTAssertEqual(binding.wrappedValue, \"baz\")\n    }\n\n    @MainActor func testStateRealmObjectKVO() throws {\n        @StateRealmObject var object = SwiftUIObject()\n        var hit = 0\n\n        let cancellable = _object._publisher\n            .sink { _ in\n            } receiveValue: { _ in\n                hit += 1\n            }\n        XCTAssertEqual(hit, 0)\n        object.int += 1\n        XCTAssertEqual(hit, 1)\n        XCTAssertNotNil(object.observationInfo)\n        let realm = try Realm()\n        try realm.write {\n            realm.add(object)\n        }\n        XCTAssertEqual(hit, 1)\n        XCTAssertNil(object.observationInfo)\n        try realm.write {\n            object.thaw()!.int += 1\n        }\n        XCTAssertEqual(hit, 2)\n        cancellable.cancel()\n        XCTAssertEqual(hit, 2)\n    }\n\n    // MARK: - Projection ObservedResults Operations\n    @MainActor func testResultsAppendProjection() throws {\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        @ObservedResults(UIElementsProjection.self, configuration: inMemoryRealm(inMemoryIdentifier).configuration) var state\n        XCTAssertEqual(state.count, 0)\n        try! realm.write {\n            realm.create(SwiftUIObject.self)\n        }\n        XCTAssertEqual(state.count, 1)\n    }\n\n    @MainActor func testResultsRemoveProjection() throws {\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        @ObservedResults(UIElementsProjection.self, configuration: inMemoryRealm(inMemoryIdentifier).configuration) var state\n        var object: SwiftUIObject!\n        try! realm.write {\n            object = realm.create(SwiftUIObject.self)\n        }\n        XCTAssertEqual(state.count, 1)\n        try! realm.write {\n            realm.delete(object)\n        }\n        XCTAssertEqual(state.count, 0)\n    }\n\n    @MainActor func testProjectionStateRealmObjectKVO() throws {\n        @StateRealmObject var projection = UIElementsProjection(projecting: SwiftUIObject())\n        var hit = 0\n\n        let cancellable = _projection._publisher\n            .sink { _ in\n            } receiveValue: { _ in\n                hit += 1\n            }\n        XCTAssertEqual(hit, 0)\n        projection.counter += 1\n        XCTAssertEqual(hit, 1)\n        XCTAssertNotNil(projection.rootObject.observationInfo)\n        let realm = try Realm()\n        try realm.write {\n            realm.add(projection.rootObject)\n        }\n        XCTAssertEqual(hit, 1)\n        XCTAssertNil(projection.rootObject.observationInfo)\n        try realm.write {\n            projection.thaw()!.counter += 1\n        }\n        XCTAssertEqual(hit, 2)\n        cancellable.cancel()\n        XCTAssertEqual(hit, 2)\n    }\n\n    @MainActor func testProjectionDelete() throws {\n        let results = ObservedResults(UIElementsProjection.self,\n                                      configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        let projection = UIElementsProjection(projecting: SwiftUIObject())\n        @StateRealmObject var state = projection\n\n        XCTAssertEqual(results.wrappedValue.count, 0)\n        $state.delete()\n        XCTAssertEqual(results.wrappedValue.count, 0)\n        results.projectedValue.append(state)\n        XCTAssertEqual(results.wrappedValue.count, 1)\n        $state.delete()\n    }\n\n    // MARK: - Projection Bind\n    @MainActor func testProjectionBind() {\n        let projection = UIElementsProjection(projecting: SwiftUIObject())\n        let binding = projection.bind(\\.label)\n        XCTAssertEqual(projection.label, \"foo\")\n        XCTAssertEqual(binding.wrappedValue, \"foo\")\n        binding.wrappedValue = \"bar\"\n        XCTAssertEqual(binding.wrappedValue, \"bar\")\n\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try? realm.write { realm.add(projection.rootObject) }\n\n        let managedBinding = projection.bind(\\.label)\n        XCTAssertEqual(projection.label, \"bar\")\n        XCTAssertEqual(binding.wrappedValue, \"bar\")\n        managedBinding.wrappedValue = \"baz\"\n        XCTAssertEqual(projection.label, \"baz\")\n        XCTAssertEqual(binding.wrappedValue, \"baz\")\n    }\n\n    // MARK: - ObservedSectionedResults\n\n    @MainActor func testObservedSectionedResults() throws {\n        let fullResults = ObservedSectionedResults(SwiftUIObject.self,\n                                                   sectionKeyPath: \\.str,\n                                                   configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        XCTAssertEqual(fullResults.wrappedValue.count, 0)\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try realm.write {\n            let object = SwiftUIObject()\n            object.str = \"abc\"\n            object.int = 1\n            // add another default inited object for filter comparison\n            realm.add(object)\n        }\n        realm.refresh()\n        XCTAssertEqual(fullResults.wrappedValue.count, 1)\n        XCTAssertEqual(fullResults.wrappedValue[0].key, \"abc\")\n\n        try realm.write {\n            let object = SwiftUIObject()\n            object.str = \"def\"\n            object.int = 1\n            // add another default inited object for filter comparison\n            realm.add(object)\n        }\n\n        var filteredResults = ObservedSectionedResults(SwiftUIObject.self,\n                                                       sectionKeyPath: \\.str,\n                                                       filter: NSPredicate(format: \"str = %@\", \"def\"),\n                                                       configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        XCTAssertEqual(filteredResults.wrappedValue.count, 1)\n        XCTAssertEqual(filteredResults.wrappedValue[0].key, \"def\")\n\n        filteredResults = ObservedSectionedResults(SwiftUIObject.self,\n                                                   sectionKeyPath: \\.str,\n                                                   where: { $0.str == \"def\" },\n                                                   configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        XCTAssertEqual(filteredResults.wrappedValue.count, 1)\n        XCTAssertEqual(filteredResults.wrappedValue[0].key, \"def\")\n        fullResults.where = { $0.str == \"def\" }\n        XCTAssertEqual(fullResults.wrappedValue.count, 1)\n        XCTAssertEqual(fullResults.wrappedValue[0].key, \"def\")\n        fullResults.filter = NSPredicate(format: \"str != %@\", \"def\")\n        XCTAssertEqual(fullResults.wrappedValue.count, 1)\n        XCTAssertEqual(fullResults.wrappedValue[0].key, \"abc\")\n    }\n\n    @MainActor func testObservedSectionedResultsWithProjection() throws {\n        let fullResults = ObservedSectionedResults(UIElementsProjection.self,\n                                                   sectionKeyPath: \\.label,\n                                                   configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        XCTAssertEqual(fullResults.wrappedValue.count, 0)\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        try realm.write {\n            let object = SwiftUIObject()\n            object.str = \"abc\"\n            object.int = 1\n            // add another default inited object for filter comparison\n            realm.add(object)\n        }\n        realm.refresh()\n        XCTAssertEqual(fullResults.wrappedValue.count, 1)\n        XCTAssertEqual(fullResults.wrappedValue[0].key, \"abc\")\n\n        try realm.write {\n            let object = SwiftUIObject()\n            object.str = \"def\"\n            object.int = 1\n            // add another default inited object for filter comparison\n            realm.add(object)\n        }\n\n        let filteredResults = ObservedSectionedResults(UIElementsProjection.self,\n                                                       sectionKeyPath: \\.label,\n                                                       filter: NSPredicate(format: \"str = %@\", \"def\"),\n                                                       configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        XCTAssertEqual(filteredResults.wrappedValue.count, 1)\n        XCTAssertEqual(filteredResults.wrappedValue[0].key, \"def\")\n    }\n\n    @MainActor func testAllObservedSectionedResultsConstructors() throws {\n        let realm = inMemoryRealm(inMemoryIdentifier)\n        let object1 = SwiftUIObject()\n        let object2 = SwiftUIObject()\n        try realm.write {\n            object1.str = \"foo\"\n            realm.add(object1)\n            object2.str = \"bar\"\n            realm.add(object2)\n        }\n        // Projections with `sectionKeyPath`\n        var projectionSectionedResults = ObservedSectionedResults(UIElementsProjection.self,\n                                                                  sectionKeyPath: \\.label,\n                                                                  configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        XCTAssertEqual(projectionSectionedResults.wrappedValue.count, 2)\n        XCTAssertEqual(projectionSectionedResults.wrappedValue.allKeys, [\"bar\", \"foo\"])\n        XCTAssertEqual(projectionSectionedResults.wrappedValue[0].count, 1)\n        XCTAssertEqual(projectionSectionedResults.wrappedValue[0][0].label, \"bar\")\n        XCTAssertEqual(projectionSectionedResults.wrappedValue[1].count, 1)\n        XCTAssertEqual(projectionSectionedResults.wrappedValue[1][0].label, \"foo\")\n\n        projectionSectionedResults = ObservedSectionedResults(UIElementsProjection.self,\n                                                              sectionKeyPath: \\.label,\n                                                              sortDescriptors: [SortDescriptor.init(keyPath: \"str\", ascending: false)],\n                                                              configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        XCTAssertEqual(projectionSectionedResults.wrappedValue.count, 2)\n        XCTAssertEqual(projectionSectionedResults.wrappedValue.allKeys, [\"foo\", \"bar\"])\n        XCTAssertEqual(projectionSectionedResults.wrappedValue[0].count, 1)\n        XCTAssertEqual(projectionSectionedResults.wrappedValue[0][0].label, \"foo\")\n        XCTAssertEqual(projectionSectionedResults.wrappedValue[1].count, 1)\n        XCTAssertEqual(projectionSectionedResults.wrappedValue[1][0].label, \"bar\")\n\n        projectionSectionedResults = ObservedSectionedResults(UIElementsProjection.self,\n                                                              sectionKeyPath: \\.label,\n                                                              sortDescriptors: [SortDescriptor.init(keyPath: \"str\")],\n                                                              filter: NSPredicate(format: \"str == 'foo'\"),\n                                                              configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        XCTAssertEqual(projectionSectionedResults.wrappedValue.count, 1)\n        XCTAssertEqual(projectionSectionedResults.wrappedValue.allKeys, [\"foo\"])\n        XCTAssertEqual(projectionSectionedResults.wrappedValue[0].count, 1)\n        XCTAssertEqual(projectionSectionedResults.wrappedValue[0][0].label, \"foo\")\n\n        // Projections with `sectionBlock`\n        projectionSectionedResults = ObservedSectionedResults(UIElementsProjection.self,\n                                                              sectionBlock: { $0.label.first.map(String.init(_:)) ?? \"\" },\n                                                              sortDescriptors: [SortDescriptor.init(keyPath: \"str\")],\n                                                              configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        XCTAssertEqual(projectionSectionedResults.wrappedValue.count, 2)\n        XCTAssertEqual(projectionSectionedResults.wrappedValue.allKeys, [\"b\", \"f\"])\n        XCTAssertEqual(projectionSectionedResults.wrappedValue[0].count, 1)\n        XCTAssertEqual(projectionSectionedResults.wrappedValue[0][0].label, \"bar\")\n        XCTAssertEqual(projectionSectionedResults.wrappedValue[1].count, 1)\n        XCTAssertEqual(projectionSectionedResults.wrappedValue[1][0].label, \"foo\")\n\n        projectionSectionedResults = ObservedSectionedResults(UIElementsProjection.self,\n                                                              sectionBlock: { $0.label.first.map(String.init(_:)) ?? \"\" },\n                                                              sortDescriptors: [SortDescriptor.init(keyPath: \"str\")],\n                                                              filter: NSPredicate(format: \"str == 'foo'\"),\n                                                              configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        XCTAssertEqual(projectionSectionedResults.wrappedValue.count, 1)\n        XCTAssertEqual(projectionSectionedResults.wrappedValue.allKeys, [\"f\"])\n        XCTAssertEqual(projectionSectionedResults.wrappedValue[0].count, 1)\n        XCTAssertEqual(projectionSectionedResults.wrappedValue[0][0].label, \"foo\")\n\n        // Objects with `sectionKeyPath`\n        var objectSectionedResults = ObservedSectionedResults(SwiftUIObject.self,\n                                                              sectionKeyPath: \\.str,\n                                                              configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        XCTAssertEqual(objectSectionedResults.wrappedValue.count, 2)\n        XCTAssertEqual(objectSectionedResults.wrappedValue.allKeys, [\"bar\", \"foo\"])\n        XCTAssertEqual(objectSectionedResults.wrappedValue[0].count, 1)\n        XCTAssertEqual(objectSectionedResults.wrappedValue[0][0].str, \"bar\")\n        XCTAssertEqual(objectSectionedResults.wrappedValue[1].count, 1)\n        XCTAssertEqual(objectSectionedResults.wrappedValue[1][0].str, \"foo\")\n\n        objectSectionedResults = ObservedSectionedResults(SwiftUIObject.self,\n                                                          sectionKeyPath: \\.str,\n                                                          sortDescriptors: [SortDescriptor.init(keyPath: \"str\", ascending: false)],\n                                                          configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        XCTAssertEqual(objectSectionedResults.wrappedValue.count, 2)\n        XCTAssertEqual(objectSectionedResults.wrappedValue.allKeys, [\"foo\", \"bar\"])\n        XCTAssertEqual(objectSectionedResults.wrappedValue[0].count, 1)\n        XCTAssertEqual(objectSectionedResults.wrappedValue[0][0].str, \"foo\")\n        XCTAssertEqual(objectSectionedResults.wrappedValue[1].count, 1)\n        XCTAssertEqual(objectSectionedResults.wrappedValue[1][0].str, \"bar\")\n\n        objectSectionedResults = ObservedSectionedResults(SwiftUIObject.self,\n                                                          sectionKeyPath: \\.str,\n                                                          sortDescriptors: [SortDescriptor.init(keyPath: \"str\")],\n                                                          where: { $0.str == \"foo\" },\n                                                          configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        XCTAssertEqual(objectSectionedResults.wrappedValue.count, 1)\n        XCTAssertEqual(objectSectionedResults.wrappedValue.allKeys, [\"foo\"])\n        XCTAssertEqual(objectSectionedResults.wrappedValue[0].count, 1)\n        XCTAssertEqual(objectSectionedResults.wrappedValue[0][0].str, \"foo\")\n\n        objectSectionedResults = ObservedSectionedResults(SwiftUIObject.self,\n                                                          sectionKeyPath: \\.str,\n                                                          sortDescriptors: [SortDescriptor.init(keyPath: \"str\")],\n                                                          filter: NSPredicate(format: \"str == 'foo'\"),\n                                                          configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        XCTAssertEqual(objectSectionedResults.wrappedValue.count, 1)\n        XCTAssertEqual(objectSectionedResults.wrappedValue.allKeys, [\"foo\"])\n        XCTAssertEqual(objectSectionedResults.wrappedValue[0].count, 1)\n        XCTAssertEqual(objectSectionedResults.wrappedValue[0][0].str, \"foo\")\n        // Objects with `sectionBlock`\n        objectSectionedResults = ObservedSectionedResults(SwiftUIObject.self,\n                                                          sectionBlock: { $0.str.first.map(String.init(_:)) ?? \"\" },\n                                                          sortDescriptors: [SortDescriptor.init(keyPath: \"str\")],\n                                                          configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        XCTAssertEqual(objectSectionedResults.wrappedValue.count, 2)\n        XCTAssertEqual(objectSectionedResults.wrappedValue.allKeys, [\"b\", \"f\"])\n        XCTAssertEqual(objectSectionedResults.wrappedValue[0].count, 1)\n        XCTAssertEqual(objectSectionedResults.wrappedValue[0][0].str, \"bar\")\n        XCTAssertEqual(objectSectionedResults.wrappedValue[1].count, 1)\n        XCTAssertEqual(objectSectionedResults.wrappedValue[1][0].str, \"foo\")\n\n        objectSectionedResults = ObservedSectionedResults(SwiftUIObject.self,\n                                                          sectionBlock: { $0.str.first.map(String.init(_:)) ?? \"\" },\n                                                          sortDescriptors: [SortDescriptor.init(keyPath: \"str\")],\n                                                          filter: NSPredicate(format: \"str == 'foo'\"),\n                                                          configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        XCTAssertEqual(objectSectionedResults.wrappedValue.count, 1)\n        XCTAssertEqual(objectSectionedResults.wrappedValue.allKeys, [\"f\"])\n        XCTAssertEqual(objectSectionedResults.wrappedValue[0].count, 1)\n        XCTAssertEqual(objectSectionedResults.wrappedValue[0][0].str, \"foo\")\n\n        objectSectionedResults = ObservedSectionedResults(SwiftUIObject.self,\n                                                          sectionBlock: { $0.str.first.map(String.init(_:)) ?? \"\" },\n                                                          sortDescriptors: [SortDescriptor.init(keyPath: \"str\")],\n                                                          where: { $0.str == \"foo\" },\n                                                          configuration: inMemoryRealm(inMemoryIdentifier).configuration)\n        XCTAssertEqual(objectSectionedResults.wrappedValue.count, 1)\n        XCTAssertEqual(objectSectionedResults.wrappedValue.allKeys, [\"f\"])\n        XCTAssertEqual(objectSectionedResults.wrappedValue[0].count, 1)\n        XCTAssertEqual(objectSectionedResults.wrappedValue[0][0].str, \"foo\")\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/SwiftUnicodeTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\n#if canImport(RealmSwiftTestSupport)\nimport RealmSwiftTestSupport\n#endif\n\nlet utf8TestString = \"值значен™👍☞⎠‱௹♣︎☐▼❒∑⨌⧭иеمرحبا\"\n\nclass SwiftUnicodeTests: TestCase {\n    func testUTF8StringContents() {\n        let realm = realmWithTestPath()\n\n        try! realm.write {\n            realm.create(SwiftStringObject.self, value: [utf8TestString])\n            return\n        }\n\n        let obj1 = realm.objects(SwiftStringObject.self).first!\n        XCTAssertEqual(obj1.stringCol, utf8TestString)\n\n        let obj2 = realm.objects(SwiftStringObject.self).filter(\"stringCol == %@\", utf8TestString).first!\n        assertEqual(obj1, obj2)\n        XCTAssertEqual(obj2.stringCol, utf8TestString)\n\n        XCTAssertEqual(Int(0), realm.objects(SwiftStringObject.self).filter(\"stringCol != %@\", utf8TestString).count)\n    }\n\n    func testUTF8PropertyWithUTF8StringContents() {\n        let realm = realmWithTestPath()\n        try! realm.write {\n            realm.create(SwiftUTF8Object.self, value: [utf8TestString])\n            return\n        }\n\n        let obj1 = realm.objects(SwiftUTF8Object.self).first!\n        XCTAssertEqual(obj1.柱колоéнǢкƱаم👍, utf8TestString,\n            \"Storing and retrieving a string with UTF8 content should work\")\n\n        let obj2 = realm.objects(SwiftUTF8Object.self).filter(\"%K == %@\", \"柱колоéнǢкƱаم👍\", utf8TestString).first!\n        assertEqual(obj1, obj2)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/TestCase.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\nimport Realm.Dynamic\nimport RealmSwift\nimport XCTest\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\nimport RealmSwiftTestSupport\n#endif\n\nfunc inMemoryRealm(_ inMememoryIdentifier: String) -> Realm {\n    return try! Realm(configuration: Realm.Configuration(inMemoryIdentifier: inMememoryIdentifier))\n}\n\n@available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\nfunc openRealm(configuration: Realm.Configuration = .defaultConfiguration,\n               actor: isolated any Actor) async throws -> Realm {\n#if compiler(<6)\n    try await Realm(configuration: configuration, actor: actor)\n#else\n    try await Realm.open(configuration: configuration)\n#endif\n}\n\nclass TestCase: RLMTestCaseBase {\n    @Locked var exceptionThrown = false\n    var testDir: String! = nil\n\n    let queue = DispatchQueue(label: \"background\")\n\n    func configurationWithTestPath(configuration: Realm.Configuration = Realm.Configuration()) -> Realm.Configuration {\n        var configuration = configuration\n        configuration.fileURL = testRealmURL()\n        return configuration\n    }\n\n    @discardableResult\n    func realmWithTestPath(configuration: Realm.Configuration = Realm.Configuration()) -> Realm {\n        var configuration = configuration\n        configuration.fileURL = testRealmURL()\n        return try! Realm(configuration: configuration)\n    }\n\n    override class func tearDown() {\n        RLMRealm.resetRealmState()\n        super.tearDown()\n    }\n\n    override func invokeTest() {\n        testDir = RLMRealmPathForFile(realmFilePrefix())\n\n        do {\n            try FileManager.default.removeItem(atPath: testDir)\n        } catch {\n            // The directory shouldn't actually already exist, so not an error\n        }\n        try! FileManager.default.createDirectory(at: URL(fileURLWithPath: testDir, isDirectory: true),\n                                                     withIntermediateDirectories: true, attributes: nil)\n\n        let config = Realm.Configuration(fileURL: defaultRealmURL())\n        Realm.Configuration.defaultConfiguration = config\n\n        exceptionThrown = false\n        autoreleasepool { super.invokeTest() }\n        queue.sync { }\n\n        if !exceptionThrown {\n            XCTAssertFalse(RLMHasCachedRealmForPath(defaultRealmURL().path))\n            XCTAssertFalse(RLMHasCachedRealmForPath(testRealmURL().path))\n        }\n\n        resetRealmState()\n\n        do {\n            try FileManager.default.removeItem(atPath: testDir)\n        } catch {\n            XCTFail(\"Unable to delete realm files\")\n        }\n\n        // Verify that there are no remaining realm files after the test\n        let parentDir = (testDir as NSString).deletingLastPathComponent\n        for url in FileManager.default.enumerator(atPath: parentDir)! {\n            let url = url as! NSString\n            XCTAssertNotEqual(url.pathExtension, \"realm\", \"Lingering realm file at \\(parentDir)/\\(url)\")\n            assert(url.pathExtension != \"realm\")\n        }\n    }\n\n    func dispatchSyncNewThread(block: @Sendable @escaping () -> Void) {\n        queue.async {\n            autoreleasepool {\n                block()\n            }\n        }\n        queue.sync { }\n    }\n\n    func dispatchSyncBackground(block: @Sendable @escaping (TestCase) -> Void) {\n        nonisolated(unsafe) let unsafeSelf = self\n        queue.async {\n            autoreleasepool {\n                block(unsafeSelf)\n            }\n        }\n        queue.sync { }\n    }\n\n    func assertThrows<T>(_ block: @autoclosure () -> T, named: String? = RLMExceptionName,\n                         _ message: String? = nil, fileName: String = #file, lineNumber: UInt = #line) {\n        exceptionThrown = true\n        RLMAssertThrowsWithName(self, { _ = block() }, named, message, fileName, lineNumber)\n    }\n\n    func assertThrows<T>(_ block: @autoclosure () -> T, reason: String,\n                         _ message: String? = nil, fileName: String = #file, lineNumber: UInt = #line) {\n        exceptionThrown = true\n        RLMAssertThrowsWithReason(self, { _ = block() }, reason, message, fileName, lineNumber)\n    }\n\n    func assertThrows<T>(_ block: @autoclosure () -> T, reasonMatching regexString: String,\n                         _ message: String? = nil, fileName: String = #file, lineNumber: UInt = #line) {\n        exceptionThrown = true\n        RLMAssertThrowsWithReasonMatching(self, { _ = block() }, regexString, message, fileName, lineNumber)\n    }\n\n    private func realmFilePrefix() -> String {\n        let name: String? = self.name\n        return name!.trimmingCharacters(in: CharacterSet(charactersIn: \"-[]\"))\n    }\n\n    internal func testRealmURL() -> URL {\n        return realmURLForFile(\"test.realm\")\n    }\n\n    internal func defaultRealmURL() -> URL {\n        return realmURLForFile(\"default.realm\")\n    }\n\n    private func realmURLForFile(_ fileName: String) -> URL {\n        let directory = URL(fileURLWithPath: testDir, isDirectory: true)\n        return directory.appendingPathComponent(fileName, isDirectory: false)\n    }\n}\n\nextension Realm {\n    @discardableResult\n    public func create<T: Object>(_ type: T.Type, value: [String: Any], update: UpdatePolicy = .error) -> T {\n        return create(type, value: value as Any, update: update)\n    }\n\n    @discardableResult\n    public func create<T: Object>(_ type: T.Type, value: [Any], update: UpdatePolicy = .error) -> T {\n        return create(type, value: value as Any, update: update)\n    }\n}\n\nextension Object {\n    public convenience init(value: [String: Any]) {\n        self.init(value: value as Any)\n    }\n\n    public convenience init(value: [Any]) {\n        self.init(value: value as Any)\n    }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/TestUtils.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2022 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport RealmSwift\nimport XCTest\n\n#if canImport(RealmTestSupport)\nimport RealmTestSupport\n#endif\n\n// Wrap a sendable value in a lock to enable sharing a mutable variable between\n// threads.\n//\n// When guarding a member variable this can be used as a property wrapper to\n// simplify use. Due to a bug in the Swift compiler\n// (https://github.com/apple/swift/issues/61358), this current doesn't work for\n// local variables.\n@propertyWrapper\npublic class Locked<T>: @unchecked Sendable {\n    private var _value: T\n    private let lock: os_unfair_lock_t = .allocate(capacity: 1)\n\n    public init(_ value: T) {\n        _value = value\n        lock.initialize(to: os_unfair_lock())\n    }\n\n    public var value: T {\n        get {\n            withLock {$0 }\n        }\n        set {\n            withLock {\n                $0 = newValue\n            }\n        }\n        // Accessor for modify operations (e.g. += and mutating functions on structs)\n        // which eliminates race conditions which would otherwise happen if multiple\n        // threads mutated the value at the same time.\n        _modify {\n            os_unfair_lock_lock(lock)\n            yield &_value\n            os_unfair_lock_unlock(lock)\n        }\n    }\n\n    // Invoke a closure while holding the lock. This can be used to safely\n    // perform logic more complicated than a simple assignment or read of the\n    // value.\n    public func withLock<U>(_ fn: (inout T) -> U) -> U {\n        os_unfair_lock_lock(lock)\n        let ret = fn(&_value)\n        os_unfair_lock_unlock(lock)\n        return ret\n    }\n\n    // Property wrapper implementation\n    public convenience init(wrappedValue: T) {\n        self.init(wrappedValue)\n    }\n    public var wrappedValue: T {\n        get { value }\n        set { value = newValue }\n    }\n}\n\n/// Check whether two test objects are equal (refer to the same row in the same Realm), even if their models\n/// don't define a primary key.\npublic func assertEqual<O: Object>(_ o1: O?, _ o2: O?, fileName: StaticString = #filePath, lineNumber: UInt = #line) {\n    if o1 == nil && o2 == nil {\n        return\n    }\n    if let o1 = o1, let o2 = o2, o1.isSameObject(as: o2) {\n        return\n    }\n    XCTFail(\"Objects expected to be equal, but weren't. First: \\(String(describing: o1)), \"\n        + \"second: \\(String(describing: o2))\", file: (fileName), line: lineNumber)\n}\n\n/// Check whether two collections containing Realm objects are equal.\npublic func assertEqual<C: Collection>(_ c1: C, _ c2: C, fileName: StaticString = #filePath, lineNumber: UInt = #line)\nwhere C.Iterator.Element: Object {\n    XCTAssertEqual(c1.count, c2.count, \"Collection counts were incorrect\", file: (fileName), line: lineNumber)\n    for (o1, o2) in zip(c1, c2) {\n        assertEqual(o1, o2, fileName: fileName, lineNumber: lineNumber)\n    }\n}\n\npublic func assertEqual<T: Equatable>(_ expected: [T?], _ actual: [T?], file: StaticString = #file, line: UInt = #line) {\n    if expected.count != actual.count {\n        XCTFail(\"assertEqual failed: (\\\"\\(expected)\\\") is not equal to (\\\"\\(actual)\\\")\",\n            file: (file), line: line)\n        return\n    }\n\n    XCTAssertEqual(expected.count, actual.count, \"Collection counts were incorrect\", file: (file), line: line)\n    for (e, a) in zip(expected, actual) where e != a {\n        XCTFail(\"assertEqual failed: (\\\"\\(expected)\\\") is not equal to (\\\"\\(actual)\\\")\",\n            file: (file), line: line)\n        return\n    }\n}\n\npublic func assertSucceeds(message: String? = nil, fileName: StaticString = #filePath,\n                           lineNumber: UInt = #line, block: () throws -> Void) {\n    do {\n        try block()\n    } catch {\n        XCTFail(\"Expected no error, but instead caught <\\(error)>.\",\n            file: (fileName), line: lineNumber)\n    }\n}\n\npublic func assertFails<T>(_ expectedError: Realm.Error.Code, _ message: String? = nil,\n                           fileName: StaticString = #filePath, lineNumber: UInt = #line,\n                           block: () throws -> T) {\n    do {\n        _ = try autoreleasepool(invoking: block)\n        XCTFail(\"Expected to catch <\\(expectedError)>, but no error was thrown.\",\n            file: fileName, line: lineNumber)\n    } catch let e as Realm.Error where e.code == expectedError {\n        if message != nil {\n            XCTAssertEqual(e.localizedDescription, message, file: fileName, line: lineNumber)\n        }\n    } catch {\n        XCTFail(\"Expected to catch <\\(expectedError)>, but instead caught <\\(error)>.\",\n            file: fileName, line: lineNumber)\n    }\n}\n\npublic func assertFails<T>(_ expectedError: Realm.Error.Code, _ file: URL, _ message: String,\n                           fileName: StaticString = #filePath, lineNumber: UInt = #line,\n                           block: () throws -> T) {\n    do {\n        _ = try autoreleasepool(invoking: block)\n        XCTFail(\"Expected to catch <\\(expectedError)>, but no error was thrown.\",\n            file: fileName, line: lineNumber)\n    } catch let e as Realm.Error where e.code == expectedError {\n        XCTAssertEqual(e.localizedDescription, message, file: fileName, line: lineNumber)\n        XCTAssertEqual(e.fileURL, file, file: fileName, line: lineNumber)\n    } catch {\n        XCTFail(\"Expected to catch <\\(expectedError)>, but instead caught <\\(error)>.\",\n            file: fileName, line: lineNumber)\n    }\n}\n\npublic func assertFails<T>(_ expectedError: Error, _ message: String? = nil,\n                           fileName: StaticString = #filePath, lineNumber: UInt = #line,\n                           block: () throws -> T) {\n    do {\n        _ = try autoreleasepool(invoking: block)\n        XCTFail(\"Expected to catch <\\(expectedError)>, but no error was thrown.\",\n            file: fileName, line: lineNumber)\n    } catch let e where e._code == expectedError._code {\n        // Success!\n    } catch {\n        XCTFail(\"Expected to catch <\\(expectedError)>, but instead caught <\\(error)>.\",\n            file: fileName, line: lineNumber)\n    }\n}\n\npublic func assertNil<T>(block: @autoclosure() -> T?, _ message: String? = nil,\n                         fileName: StaticString = #filePath, lineNumber: UInt = #line) {\n    XCTAssert(block() == nil, message ?? \"\", file: (fileName), line: lineNumber)\n}\n\n\npublic extension XCTestCase {\n    func assertMatches(_ block: @autoclosure () -> String, _ regexString: String, _ message: String? = nil,\n                       fileName: String = #file, lineNumber: UInt = #line) {\n        RLMAssertMatches(self, block, regexString, message, fileName, lineNumber)\n    }\n}\n\n/// Check that a `MutableSet` contains all expected elements.\npublic func assertSetContains<T, U>(_ set: MutableSet<T>, keyPath: KeyPath<T, U>, items: [U]) where U: Hashable {\n    var itemMap = Dictionary(uniqueKeysWithValues: items.map { ($0, false)})\n    set.map { $0[keyPath: keyPath]}.forEach {\n        itemMap[$0] = items.contains($0)\n    }\n    // ensure all items are present in the set.\n    XCTAssertFalse(itemMap.values.contains(false))\n}\n\n/// Check that an `AnyRealmCollection` contains all expected elements.\npublic func assertAnyRealmCollectionContains<T, U>(_ set: AnyRealmCollection<T>, keyPath: KeyPath<T, U>, items: [U]) where U: Hashable {\n    var itemMap = Dictionary(uniqueKeysWithValues: items.map { ($0, false) })\n    set.map { $0[keyPath: keyPath]}.forEach {\n        itemMap[$0] = items.contains($0)\n    }\n    // ensure all items are present in the set.\n    XCTAssertFalse(itemMap.values.contains(false))\n}\n\n#if compiler(<6)\n@_unsafeInheritExecutor\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\npublic func assertThrowsErrorAsync<T, E: Equatable & Error>(\n    _ expression: @autoclosure () async throws -> T,\n    _ expectedError: E,\n    file: StaticString = #filePath, line: UInt = #line) async {\n    do {\n        _ = try await expression()\n        XCTFail(\"Expected expression to throw error \\(expectedError)\", file: file, line: line)\n    } catch let error as E {\n        XCTAssertEqual(error, expectedError, file: file, line: line)\n    } catch {\n        XCTFail(\"Expected expression to throw error \\(expectedError) but got \\(error)\", file: file, line: line)\n    }\n}\n\n// Fork, call an expression which should hit a precondition failure in the child\n// process, and then verify that the expected failure message was printed. Note\n// that Swift and Foundation do not support fork(), so anything which does more\n// than a very limited amount of work before the precondition failure is very\n// likely to break.\n@_unsafeInheritExecutor\n@available(macOS 10.15.4, iOS 13.4, tvOS 13.4, watchOS 6.4, *)\npublic func assertPreconditionFailure<T>(_ message: String, _ expression: () async throws -> T,\n                                         file: StaticString = #filePath, line: UInt = #line) async throws {\n    // We can't perform these tests on tvOS, watchOS, or on devices\n    guard RLMCanFork() else { return }\n\n    let pipe = Pipe()\n\n    let pid = RLMFork()\n    if pid == -1 {\n        return XCTFail(\"Failed to fork for test\", file: file, line: line)\n    }\n\n    if pid == 0 {\n        // In child process\n        // Point stdout and stderr at our pipe\n        let fd = pipe.fileHandleForWriting.fileDescriptor\n        while dup2(fd, STDOUT_FILENO) == -1 && errno == EINTR {}\n        while dup2(fd, STDERR_FILENO) == -1 && errno == EINTR {}\n        _ = try await expression()\n        exit(0)\n    }\n\n    try pipe.fileHandleForWriting.close()\n    while true {\n        var status: Int32 = 0\n        let ret = waitpid(pid, &status, 0)\n        if ret == -1 && errno == EINTR {\n            continue\n        }\n        guard ret > 0 else {\n            return XCTFail(\"Failed to wait for child process to exit? errno: \\(errno)\", file: file, line: line)\n        }\n        guard status != 0 else {\n            return XCTFail(\"Expected child process to crash with message \\\"\\(message)\\\", but it exited cleanly\", file: file, line: line)\n        }\n        break\n    }\n\n    guard let data = try pipe.fileHandleForReading.readToEnd() else {\n        return XCTFail(\"Expected child process to crash with message \\\"\\(message)\\\", but it exited without printing anything\", file: file, line: line)\n    }\n    guard let str = String(data: data, encoding: .utf8) else {\n        return XCTFail(\"Expected child process to crash with message \\\"\\(message)\\\", but it did not print valid utf-8\", file: file, line: line)\n    }\n\n    if !str.contains(\"Precondition failed: \\(message)\") && !str.contains(\"Fatal error: \\(message)\") {\n        XCTFail(\"Expected \\\"\\(str)\\\" to contain \\\"\\(message)\\\")\", file: file, line: line)\n    }\n}\n#else\n@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)\npublic func assertThrowsErrorAsync<T: Sendable, E: Equatable & Error>(\n    _ expression: @autoclosure () async throws -> T,\n    _ expectedError: E,\n    _isolation: isolated (any Actor)? = #isolation,\n    file: StaticString = #filePath, line: UInt = #line\n) async {\n    do {\n        _ = try await expression()\n        XCTFail(\"Expected expression to throw error \\(expectedError)\", file: file, line: line)\n    } catch let error as E {\n        XCTAssertEqual(error, expectedError, file: file, line: line)\n    } catch {\n        XCTFail(\"Expected expression to throw error \\(expectedError) but got \\(error)\", file: file, line: line)\n    }\n}\n\n// Fork, call an expression which should hit a precondition failure in the child\n// process, and then verify that the expected failure message was printed. Note\n// that Swift and Foundation do not support fork(), so anything which does more\n// than a very limited amount of work before the precondition failure is very\n// likely to break.\n@available(macOS 10.15.4, iOS 13.4, tvOS 13.4, watchOS 6.4, *)\npublic func assertPreconditionFailure<T: Sendable>(\n    _ message: String, _ expression: () async throws -> T,\n    _isolation: isolated (any Actor)? = #isolation,\n    file: StaticString = #filePath, line: UInt = #line\n) async throws {\n    // We can't perform these tests on tvOS, watchOS, or on devices\n    guard RLMCanFork() else { return }\n\n    let pipe = Pipe()\n\n    let pid = RLMFork()\n    if pid == -1 {\n        return XCTFail(\"Failed to fork for test\", file: file, line: line)\n    }\n\n    if pid == 0 {\n        // In child process\n        // Point stdout and stderr at our pipe\n        let fd = pipe.fileHandleForWriting.fileDescriptor\n        while dup2(fd, STDOUT_FILENO) == -1 && errno == EINTR {}\n        while dup2(fd, STDERR_FILENO) == -1 && errno == EINTR {}\n        _ = try await expression()\n        exit(0)\n    }\n\n    try pipe.fileHandleForWriting.close()\n    while true {\n        var status: Int32 = 0\n        let ret = waitpid(pid, &status, 0)\n        if ret == -1 && errno == EINTR {\n            continue\n        }\n        guard ret > 0 else {\n            return XCTFail(\"Failed to wait for child process to exit? errno: \\(errno)\", file: file, line: line)\n        }\n        guard status != 0 else {\n            return XCTFail(\"Expected child process to crash with message \\\"\\(message)\\\", but it exited cleanly\", file: file, line: line)\n        }\n        break\n    }\n\n    guard let data = try pipe.fileHandleForReading.readToEnd() else {\n        return XCTFail(\"Expected child process to crash with message \\\"\\(message)\\\", but it exited without printing anything\", file: file, line: line)\n    }\n    guard let str = String(data: data, encoding: .utf8) else {\n        return XCTFail(\"Expected child process to crash with message \\\"\\(message)\\\", but it did not print valid utf-8\", file: file, line: line)\n    }\n\n    if !str.contains(\"Precondition failed: \\(message)\") && !str.contains(\"Fatal error: \\(message)\") {\n        XCTFail(\"Expected \\\"\\(str)\\\" to contain \\\"\\(message)\\\")\", file: file, line: line)\n    }\n}\n#endif\n"
  },
  {
    "path": "RealmSwift/Tests/TestValueFactory.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport RealmSwift\n\n// MARK: - ObjectFactory\n\nprotocol ObjectFactory {\n    static func get<T: Object>() -> T\n}\nstruct ManagedObjectFactory: ObjectFactory {\n    static func get<T: Object>() -> T {\n        let config = Realm.Configuration(inMemoryIdentifier: \"test\",\n                                         objectTypes: [ModernAllTypesObject.self,\n                                                       ModernCollectionsOfEnums.self,\n                                                       ModernEmbeddedObject.self,\n                                                       CustomPersistableCollections.self,\n                                                       SwiftStringObject.self])\n        let realm = try! Realm(configuration: config)\n        if !realm.isInWriteTransaction {\n            realm.beginWrite()\n        }\n        let obj = T()\n        realm.add(obj)\n        return obj\n    }\n}\nstruct UnmanagedObjectFactory: ObjectFactory {\n    static func get<T: Object>() -> T {\n        return T()\n    }\n}\n\n// MARK: ValueFactory\n\nprotocol ValueFactory where Self: RealmCollectionValue {\n    associatedtype Wrapped: RealmCollectionValue = Self\n\n    static func values() -> [Self]\n    static func min() -> Self\n    static func max() -> Self\n}\nextension ValueFactory {\n    static func min() -> Self { values().first! }\n    static func max() -> Self { values().last! }\n}\nextension ValueFactory where Self: PersistableEnum {\n    static func values() -> [Self] {\n        return Array(Self.allCases)\n    }\n}\n\nprotocol NumericValueFactory: ValueFactory {\n    associatedtype AverageType: RealmCollectionValue = Double where AverageType.PersistedType: AddableType\n    static func sum(_ values: [Self]) -> Double\n    static func average() -> Double\n    static func doubleValue(_ value: Self) -> Double\n    static var zero: Self { get }\n}\nextension NumericValueFactory {\n    static func sum() -> Double {\n        return sum(values())\n    }\n    static func average() -> Double {\n        return sum() / 3\n    }\n}\nextension NumericValueFactory where Self: AdditiveArithmetic {\n    static func sum(_ values: [Self]) -> Double {\n        return doubleValue(values.reduce(.zero, +))\n    }\n}\nextension NumericValueFactory where PersistedType == Self {\n    static func doubleValue(_ value: Self) -> Double {\n        return (value as! NSNumber).doubleValue\n    }\n}\nextension NumericValueFactory where Self: PersistableEnum {\n    static func doubleValue(_ value: Self) -> Double {\n        return (value as! NSNumber).doubleValue\n    }\n}\nextension NumericValueFactory where Self: CustomPersistable, PersistedType: NumericValueFactory {\n    static func sum(_ values: [Self]) -> Double {\n        return PersistedType.sum(values.map { $0.persistableValue })\n    }\n}\n\nprotocol ListValueFactory: ValueFactory {\n    associatedtype ListRoot: Object\n    static var array: KeyPath<ListRoot, List<Self>> { get }\n}\n\nprotocol SetValueFactory: ValueFactory {\n    associatedtype SetRoot: Object\n    static var mutableSet: KeyPath<SetRoot, MutableSet<Self>> { get }\n}\n\nprotocol MapValueFactory: ValueFactory {\n    associatedtype MapRoot: Object\n    static var map: KeyPath<MapRoot, Map<String, Self>> { get }\n}\n\nprotocol ListValueFactoryOptional: ListValueFactory where Self: _RealmCollectionValueInsideOptional {\n    static var optArray: KeyPath<ListRoot, List<Self?>> { get }\n}\n\nprotocol SetValueFactoryOptional: SetValueFactory where Self: _RealmCollectionValueInsideOptional {\n    static var optMutableSet: KeyPath<SetRoot, MutableSet<Self?>> { get }\n}\n\nprotocol MapValueFactoryOptional: MapValueFactory where Self: _RealmCollectionValueInsideOptional {\n    static var optMap: KeyPath<MapRoot, Map<String, Self?>> { get }\n}\n\n// MARK: Optional\n\nextension Optional: ValueFactory where Wrapped: ValueFactory & _RealmCollectionValueInsideOptional {\n    static func values() -> [Self] {\n        var v = Array<Self>(Wrapped.values())\n        v.remove(at: 1)\n        v.insert(nil, at: 0)\n        return v\n    }\n\n    static func min() -> Self { Self.some(Wrapped.min()) }\n}\n\nextension Optional: NumericValueFactory where Wrapped: NumericValueFactory & _RealmCollectionValueInsideOptional {\n    typealias AverageType = Wrapped.AverageType\n    static func doubleValue(_ value: Self) -> Double {\n        return Wrapped.doubleValue(value!)\n    }\n\n    static func min() -> Self { Self.some(Wrapped.min()) }\n    static func sum(_ values: [Self]) -> Double {\n        return Wrapped.sum(values.compactMap { $0 })\n    }\n    static func average() -> Double {\n        return sum() / 2\n    }\n    static var zero: Optional<Wrapped> {\n        Wrapped.zero\n    }\n}\n\nextension Optional: ListValueFactory where Wrapped: ListValueFactoryOptional {\n    static var array: KeyPath<Wrapped.ListRoot, List<Self>> { Wrapped.optArray }\n}\nextension Optional: SetValueFactory where Wrapped: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<Wrapped.SetRoot, MutableSet<Self>> { Wrapped.optMutableSet }\n}\nextension Optional: MapValueFactory where Wrapped: MapValueFactoryOptional {\n    static var map: KeyPath<Wrapped.MapRoot, Map<String, Self>> { Wrapped.optMap }\n}\n\n// MARK: - Bool\n\nextension Bool: ValueFactory {\n    private static let _values: [Bool] = [true, false, true]\n    static func values() -> [Bool] {\n        return _values\n    }\n}\nextension Bool: ListValueFactoryOptional {\n    static var array: KeyPath<ModernAllTypesObject, List<Bool>> { \\.arrayBool }\n    static var optArray: KeyPath<ModernAllTypesObject, List<Bool?>> { \\.arrayOptBool }\n}\nextension Bool: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernAllTypesObject, MutableSet<Bool>> { \\.setBool }\n    static var optMutableSet: KeyPath<ModernAllTypesObject, MutableSet<Bool?>> { \\.setOptBool }\n}\nextension Bool: MapValueFactoryOptional {\n    static var map: KeyPath<ModernAllTypesObject, Map<String, Bool>> { \\.mapBool }\n    static var optMap: KeyPath<ModernAllTypesObject, Map<String, Bool?>> { \\.mapOptBool }\n}\n\n// MARK: - Int\n\nextension Int: NumericValueFactory {\n    private static let _values: [Int] = [1, 2, 3]\n    static func values() -> [Int] {\n        return _values\n    }\n}\nextension Int: ListValueFactoryOptional {\n    static var array: KeyPath<ModernAllTypesObject, List<Int>> { \\.arrayInt }\n    static var optArray: KeyPath<ModernAllTypesObject, List<Int?>> { \\.arrayOptInt }\n}\nextension Int: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernAllTypesObject, MutableSet<Int>> { \\.setInt }\n    static var optMutableSet: KeyPath<ModernAllTypesObject, MutableSet<Int?>> { \\.setOptInt }\n}\nextension Int: MapValueFactoryOptional {\n    static var map: KeyPath<ModernAllTypesObject, Map<String, Int>> { \\.mapInt }\n    static var optMap: KeyPath<ModernAllTypesObject, Map<String, Int?>> { \\.mapOptInt }\n}\n\n// MARK: - Int8\n\nextension Int8: NumericValueFactory {\n    private static let _values: [Int8] = [1, 2, 3]\n    static func values() -> [Int8] {\n        return _values\n    }\n}\nextension Int8: ListValueFactoryOptional {\n    static var array: KeyPath<ModernAllTypesObject, List<Int8>> { \\.arrayInt8 }\n    static var optArray: KeyPath<ModernAllTypesObject, List<Int8?>> { \\.arrayOptInt8 }\n}\nextension Int8: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernAllTypesObject, MutableSet<Int8>> { \\.setInt8 }\n    static var optMutableSet: KeyPath<ModernAllTypesObject, MutableSet<Int8?>> { \\.setOptInt8 }\n}\nextension Int8: MapValueFactoryOptional {\n    static var map: KeyPath<ModernAllTypesObject, Map<String, Int8>> { \\.mapInt8 }\n    static var optMap: KeyPath<ModernAllTypesObject, Map<String, Int8?>> { \\.mapOptInt8 }\n}\n\n// MARK: - Int16\n\nextension Int16: NumericValueFactory {\n    private static let _values: [Int16] = [1, 2, 3]\n    static func values() -> [Int16] {\n        return _values\n    }\n}\nextension Int16: ListValueFactoryOptional {\n    static var array: KeyPath<ModernAllTypesObject, List<Int16>> { \\.arrayInt16 }\n    static var optArray: KeyPath<ModernAllTypesObject, List<Int16?>> { \\.arrayOptInt16 }\n}\nextension Int16: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernAllTypesObject, MutableSet<Int16>> { \\.setInt16 }\n    static var optMutableSet: KeyPath<ModernAllTypesObject, MutableSet<Int16?>> { \\.setOptInt16 }\n}\nextension Int16: MapValueFactoryOptional {\n    static var map: KeyPath<ModernAllTypesObject, Map<String, Int16>> { \\.mapInt16 }\n    static var optMap: KeyPath<ModernAllTypesObject, Map<String, Int16?>> { \\.mapOptInt16 }\n}\n\n// MARK: - Int32\n\nextension Int32: NumericValueFactory {\n    private static let _values: [Int32] = [1, 2, 3]\n    static func values() -> [Int32] {\n        return _values\n    }\n}\nextension Int32: ListValueFactoryOptional {\n    static var array: KeyPath<ModernAllTypesObject, List<Int32>> { \\.arrayInt32 }\n    static var optArray: KeyPath<ModernAllTypesObject, List<Int32?>> { \\.arrayOptInt32 }\n}\nextension Int32: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernAllTypesObject, MutableSet<Int32>> { \\.setInt32 }\n    static var optMutableSet: KeyPath<ModernAllTypesObject, MutableSet<Int32?>> { \\.setOptInt32 }\n}\nextension Int32: MapValueFactoryOptional {\n    static var map: KeyPath<ModernAllTypesObject, Map<String, Int32>> { \\.mapInt32 }\n    static var optMap: KeyPath<ModernAllTypesObject, Map<String, Int32?>> { \\.mapOptInt32 }\n}\n\n// MARK: - Int64\n\nextension Int64: NumericValueFactory {\n    private static let _values: [Int64] = [1, 2, 3]\n    static func values() -> [Int64] {\n        return _values\n    }\n}\nextension Int64: ListValueFactoryOptional {\n    static var array: KeyPath<ModernAllTypesObject, List<Int64>> { \\.arrayInt64 }\n    static var optArray: KeyPath<ModernAllTypesObject, List<Int64?>> { \\.arrayOptInt64 }\n}\nextension Int64: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernAllTypesObject, MutableSet<Int64>> { \\.setInt64 }\n    static var optMutableSet: KeyPath<ModernAllTypesObject, MutableSet<Int64?>> { \\.setOptInt64 }\n}\nextension Int64: MapValueFactoryOptional {\n    static var map: KeyPath<ModernAllTypesObject, Map<String, Int64>> { \\.mapInt64 }\n    static var optMap: KeyPath<ModernAllTypesObject, Map<String, Int64?>> { \\.mapOptInt64 }\n}\n\n// MARK: - Float\n\nextension Float: NumericValueFactory {\n    private static let _values: [Float] = [1.1, 2.2, 3.3]\n    static func values() -> [Float] {\n        return _values\n    }\n}\nextension Float: ListValueFactoryOptional {\n    static var array: KeyPath<ModernAllTypesObject, List<Float>> { \\.arrayFloat }\n    static var optArray: KeyPath<ModernAllTypesObject, List<Float?>> { \\.arrayOptFloat }\n}\nextension Float: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernAllTypesObject, MutableSet<Float>> { \\.setFloat }\n    static var optMutableSet: KeyPath<ModernAllTypesObject, MutableSet<Float?>> { \\.setOptFloat }\n}\nextension Float: MapValueFactoryOptional {\n    static var map: KeyPath<ModernAllTypesObject, Map<String, Float>> { \\.mapFloat }\n    static var optMap: KeyPath<ModernAllTypesObject, Map<String, Float?>> { \\.mapOptFloat }\n}\n\n// MARK: - Double\n\nextension Double: NumericValueFactory {\n    private static let _values: [Double] = [1.1, 2.2, 3.3]\n    static func values() -> [Double] {\n        return _values\n    }\n}\nextension Double: ListValueFactoryOptional {\n    static var array: KeyPath<ModernAllTypesObject, List<Double>> { \\.arrayDouble }\n    static var optArray: KeyPath<ModernAllTypesObject, List<Double?>> { \\.arrayOptDouble }\n}\nextension Double: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernAllTypesObject, MutableSet<Double>> { \\.setDouble }\n    static var optMutableSet: KeyPath<ModernAllTypesObject, MutableSet<Double?>> { \\.setOptDouble }\n}\nextension Double: MapValueFactoryOptional {\n    static var map: KeyPath<ModernAllTypesObject, Map<String, Double>> { \\.mapDouble }\n    static var optMap: KeyPath<ModernAllTypesObject, Map<String, Double?>> { \\.mapOptDouble }\n}\n\n// MARK: - String\n\nextension String: ValueFactory {\n    private static let _values: [String] = [\"a\", \"b\", \"c\"]\n    static func values() -> [String] {\n        return _values\n    }\n}\nextension String: ListValueFactoryOptional {\n    static var array: KeyPath<ModernAllTypesObject, List<String>> { \\.arrayString }\n    static var optArray: KeyPath<ModernAllTypesObject, List<String?>> { \\.arrayOptString }\n}\nextension String: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernAllTypesObject, MutableSet<String>> { \\.setString }\n    static var optMutableSet: KeyPath<ModernAllTypesObject, MutableSet<String?>> { \\.setOptString }\n}\nextension String: MapValueFactoryOptional {\n    static var map: KeyPath<ModernAllTypesObject, Map<String, String>> { \\.mapString }\n    static var optMap: KeyPath<ModernAllTypesObject, Map<String, String?>> { \\.mapOptString }\n}\n\n// MARK: - Data\n\nextension Data: ValueFactory {\n    private static let _values: [Data] = [Data(\"a\".utf8), Data(\"b\".utf8), Data(\"c\".utf8)]\n    static func values() -> [Data] {\n        return _values\n    }\n}\nextension Data: ListValueFactoryOptional {\n    static var array: KeyPath<ModernAllTypesObject, List<Data>> { \\.arrayBinary }\n    static var optArray: KeyPath<ModernAllTypesObject, List<Data?>> { \\.arrayOptBinary }\n}\nextension Data: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernAllTypesObject, MutableSet<Data>> { \\.setBinary }\n    static var optMutableSet: KeyPath<ModernAllTypesObject, MutableSet<Data?>> { \\.setOptBinary }\n}\nextension Data: MapValueFactoryOptional {\n    static var map: KeyPath<ModernAllTypesObject, Map<String, Data>> { \\.mapBinary }\n    static var optMap: KeyPath<ModernAllTypesObject, Map<String, Data?>> { \\.mapOptBinary }\n}\n\n// MARK: - Date\n\nextension Date: ValueFactory {\n    private static let _values: [Date] = [Date(), Date().addingTimeInterval(10), Date().addingTimeInterval(20)]\n    static func values() -> [Date] {\n        return _values\n    }\n}\nextension Date: ListValueFactoryOptional {\n    static var array: KeyPath<ModernAllTypesObject, List<Date>> { \\.arrayDate }\n    static var optArray: KeyPath<ModernAllTypesObject, List<Date?>> { \\.arrayOptDate }\n}\nextension Date: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernAllTypesObject, MutableSet<Date>> { \\.setDate }\n    static var optMutableSet: KeyPath<ModernAllTypesObject, MutableSet<Date?>> { \\.setOptDate }\n}\nextension Date: MapValueFactoryOptional {\n    static var map: KeyPath<ModernAllTypesObject, Map<String, Date>> { \\.mapDate }\n    static var optMap: KeyPath<ModernAllTypesObject, Map<String, Date?>> { \\.mapOptDate }\n}\n\n// MARK: - Decimal128\n\nextension Decimal128: NumericValueFactory {\n    private static let _values: [Decimal128] = [Decimal128(number: 1), Decimal128(number: 2), Decimal128(number: 3)]\n    static func values() -> [Decimal128] {\n        return _values\n    }\n\n    static func doubleValue(_ value: Decimal128) -> Double {\n        return value.doubleValue\n    }\n}\nextension Decimal128: ListValueFactoryOptional {\n    static var array: KeyPath<ModernAllTypesObject, List<Decimal128>> { \\.arrayDecimal }\n    static var optArray: KeyPath<ModernAllTypesObject, List<Decimal128?>> { \\.arrayOptDecimal }\n}\nextension Decimal128: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernAllTypesObject, MutableSet<Decimal128>> { \\.setDecimal }\n    static var optMutableSet: KeyPath<ModernAllTypesObject, MutableSet<Decimal128?>> { \\.setOptDecimal }\n}\nextension Decimal128: MapValueFactoryOptional {\n    static var map: KeyPath<ModernAllTypesObject, Map<String, Decimal128>> { \\.mapDecimal }\n    static var optMap: KeyPath<ModernAllTypesObject, Map<String, Decimal128?>> { \\.mapOptDecimal }\n}\n\n// MARK: - ObjectId\n\nextension ObjectId: ValueFactory {\n    private static let _values: [ObjectId] = [ObjectId.generate(), ObjectId.generate(), ObjectId.generate()]\n    static func values() -> [ObjectId] {\n        return _values\n    }\n}\nextension ObjectId: ListValueFactoryOptional {\n    static var array: KeyPath<ModernAllTypesObject, List<ObjectId>> { \\.arrayObjectId }\n    static var optArray: KeyPath<ModernAllTypesObject, List<ObjectId?>> { \\.arrayOptObjectId }\n}\nextension ObjectId: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernAllTypesObject, MutableSet<ObjectId>> { \\.setObjectId }\n    static var optMutableSet: KeyPath<ModernAllTypesObject, MutableSet<ObjectId?>> { \\.setOptObjectId }\n}\nextension ObjectId: MapValueFactoryOptional {\n    static var map: KeyPath<ModernAllTypesObject, Map<String, ObjectId>> { \\.mapObjectId }\n    static var optMap: KeyPath<ModernAllTypesObject, Map<String, ObjectId?>> { \\.mapOptObjectId }\n}\n\n// MARK: - UUID\n\nextension UUID: ValueFactory {\n    private static let _values: [UUID] = [UUID(), UUID(), UUID()]\n    static func values() -> [UUID] {\n        return _values\n    }\n}\nextension UUID: ListValueFactoryOptional {\n    static var array: KeyPath<ModernAllTypesObject, List<UUID>> { \\.arrayUuid }\n    static var optArray: KeyPath<ModernAllTypesObject, List<UUID?>> { \\.arrayOptUuid }\n}\nextension UUID: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernAllTypesObject, MutableSet<UUID>> { \\.setUuid }\n    static var optMutableSet: KeyPath<ModernAllTypesObject, MutableSet<UUID?>> { \\.setOptUuid }\n}\nextension UUID: MapValueFactoryOptional {\n    static var map: KeyPath<ModernAllTypesObject, Map<String, UUID>> { \\.mapUuid }\n    static var optMap: KeyPath<ModernAllTypesObject, Map<String, UUID?>> { \\.mapOptUuid }\n}\n\n// MARK: - EnumInt\n\nenum EnumInt: Int, PersistableEnum {\n    case value1 = 1\n    case value2 = 2\n    case value3 = 3\n}\nextension EnumInt: ValueFactory {\n    static func values() -> [EnumInt] {\n        return EnumInt.allCases\n    }\n}\nextension EnumInt: ListValueFactoryOptional {\n    static var array: KeyPath<ModernCollectionsOfEnums, List<EnumInt>> { \\.listInt }\n    static var optArray: KeyPath<ModernCollectionsOfEnums, List<EnumInt?>> { \\.listIntOpt }\n}\nextension EnumInt: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernCollectionsOfEnums, MutableSet<EnumInt>> { \\.setInt }\n    static var optMutableSet: KeyPath<ModernCollectionsOfEnums, MutableSet<EnumInt?>> { \\.setIntOpt }\n}\nextension EnumInt: MapValueFactoryOptional {\n    static var map: KeyPath<ModernCollectionsOfEnums, Map<String, EnumInt>> { \\.mapInt }\n    static var optMap: KeyPath<ModernCollectionsOfEnums, Map<String, EnumInt?>> { \\.mapIntOpt }\n}\n\n// MARK: - EnumInt8\n\nenum EnumInt8: Int8, PersistableEnum {\n    case value1 = 1\n    case value2 = 2\n    case value3 = 3\n}\nextension EnumInt8: ValueFactory {\n    static func values() -> [EnumInt8] {\n        return EnumInt8.allCases\n    }\n}\nextension EnumInt8: ListValueFactoryOptional {\n    static var array: KeyPath<ModernCollectionsOfEnums, List<EnumInt8>> { \\.listInt8 }\n    static var optArray: KeyPath<ModernCollectionsOfEnums, List<EnumInt8?>> { \\.listInt8Opt }\n}\nextension EnumInt8: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernCollectionsOfEnums, MutableSet<EnumInt8>> { \\.setInt8 }\n    static var optMutableSet: KeyPath<ModernCollectionsOfEnums, MutableSet<EnumInt8?>> { \\.setInt8Opt }\n}\nextension EnumInt8: MapValueFactoryOptional {\n    static var map: KeyPath<ModernCollectionsOfEnums, Map<String, EnumInt8>> { \\.mapInt8 }\n    static var optMap: KeyPath<ModernCollectionsOfEnums, Map<String, EnumInt8?>> { \\.mapInt8Opt }\n}\n\n// MARK: - EnumInt16\n\nenum EnumInt16: Int16, PersistableEnum {\n    case value1 = 1\n    case value2 = 2\n    case value3 = 3\n}\nextension EnumInt16: ValueFactory {\n    static func values() -> [EnumInt16] {\n        return EnumInt16.allCases\n    }\n}\nextension EnumInt16: ListValueFactoryOptional {\n    static var array: KeyPath<ModernCollectionsOfEnums, List<EnumInt16>> { \\.listInt16 }\n    static var optArray: KeyPath<ModernCollectionsOfEnums, List<EnumInt16?>> { \\.listInt16Opt }\n}\nextension EnumInt16: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernCollectionsOfEnums, MutableSet<EnumInt16>> { \\.setInt16 }\n    static var optMutableSet: KeyPath<ModernCollectionsOfEnums, MutableSet<EnumInt16?>> { \\.setInt16Opt }\n}\nextension EnumInt16: MapValueFactoryOptional {\n    static var map: KeyPath<ModernCollectionsOfEnums, Map<String, EnumInt16>> { \\.mapInt16 }\n    static var optMap: KeyPath<ModernCollectionsOfEnums, Map<String, EnumInt16?>> { \\.mapInt16Opt }\n}\n\n// MARK: - EnumInt32\n\nenum EnumInt32: Int32, PersistableEnum {\n    case value1 = 1\n    case value2 = 2\n    case value3 = 3\n}\nextension EnumInt32: ValueFactory {\n    static func values() -> [EnumInt32] {\n        return EnumInt32.allCases\n    }\n}\nextension EnumInt32: ListValueFactoryOptional {\n    static var array: KeyPath<ModernCollectionsOfEnums, List<EnumInt32>> { \\.listInt32 }\n    static var optArray: KeyPath<ModernCollectionsOfEnums, List<EnumInt32?>> { \\.listInt32Opt }\n}\nextension EnumInt32: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernCollectionsOfEnums, MutableSet<EnumInt32>> { \\.setInt32 }\n    static var optMutableSet: KeyPath<ModernCollectionsOfEnums, MutableSet<EnumInt32?>> { \\.setInt32Opt }\n}\nextension EnumInt32: MapValueFactoryOptional {\n    static var map: KeyPath<ModernCollectionsOfEnums, Map<String, EnumInt32>> { \\.mapInt32 }\n    static var optMap: KeyPath<ModernCollectionsOfEnums, Map<String, EnumInt32?>> { \\.mapInt32Opt }\n}\n\n// MARK: - EnumInt64\n\nenum EnumInt64: Int64, PersistableEnum {\n    case value1 = 1\n    case value2 = 2\n    case value3 = 3\n}\nextension EnumInt64: ValueFactory {\n    static func values() -> [EnumInt64] {\n        return EnumInt64.allCases\n    }\n}\nextension EnumInt64: ListValueFactoryOptional {\n    static var array: KeyPath<ModernCollectionsOfEnums, List<EnumInt64>> { \\.listInt64 }\n    static var optArray: KeyPath<ModernCollectionsOfEnums, List<EnumInt64?>> { \\.listInt64Opt }\n}\nextension EnumInt64: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernCollectionsOfEnums, MutableSet<EnumInt64>> { \\.setInt64 }\n    static var optMutableSet: KeyPath<ModernCollectionsOfEnums, MutableSet<EnumInt64?>> { \\.setInt64Opt }\n}\nextension EnumInt64: MapValueFactoryOptional {\n    static var map: KeyPath<ModernCollectionsOfEnums, Map<String, EnumInt64>> { \\.mapInt64 }\n    static var optMap: KeyPath<ModernCollectionsOfEnums, Map<String, EnumInt64?>> { \\.mapInt64Opt }\n}\n\n// MARK: - EnumFloat\n\nenum EnumFloat: Float, PersistableEnum {\n    case value1 = 1.1\n    case value2 = 2.2\n    case value3 = 3.3\n}\nextension EnumFloat: ValueFactory {\n    static func values() -> [EnumFloat] {\n        return EnumFloat.allCases\n    }\n}\nextension EnumFloat: ListValueFactoryOptional {\n    static var array: KeyPath<ModernCollectionsOfEnums, List<EnumFloat>> { \\.listFloat }\n    static var optArray: KeyPath<ModernCollectionsOfEnums, List<EnumFloat?>> { \\.listFloatOpt }\n}\nextension EnumFloat: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernCollectionsOfEnums, MutableSet<EnumFloat>> { \\.setFloat }\n    static var optMutableSet: KeyPath<ModernCollectionsOfEnums, MutableSet<EnumFloat?>> { \\.setFloatOpt }\n}\nextension EnumFloat: MapValueFactoryOptional {\n    static var map: KeyPath<ModernCollectionsOfEnums, Map<String, EnumFloat>> { \\.mapFloat }\n    static var optMap: KeyPath<ModernCollectionsOfEnums, Map<String, EnumFloat?>> { \\.mapFloatOpt }\n}\n\n// MARK: - EnumDouble\n\nenum EnumDouble: Double, PersistableEnum {\n    case value1 = 1.1\n    case value2 = 2.2\n    case value3 = 3.3\n}\nextension EnumDouble: ValueFactory {\n    static func values() -> [EnumDouble] {\n        return EnumDouble.allCases\n    }\n}\nextension EnumDouble: ListValueFactoryOptional {\n    static var array: KeyPath<ModernCollectionsOfEnums, List<EnumDouble>> { \\.listDouble }\n    static var optArray: KeyPath<ModernCollectionsOfEnums, List<EnumDouble?>> { \\.listDoubleOpt }\n}\nextension EnumDouble: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernCollectionsOfEnums, MutableSet<EnumDouble>> { \\.setDouble }\n    static var optMutableSet: KeyPath<ModernCollectionsOfEnums, MutableSet<EnumDouble?>> { \\.setDoubleOpt }\n}\nextension EnumDouble: MapValueFactoryOptional {\n    static var map: KeyPath<ModernCollectionsOfEnums, Map<String, EnumDouble>> { \\.mapDouble }\n    static var optMap: KeyPath<ModernCollectionsOfEnums, Map<String, EnumDouble?>> { \\.mapDoubleOpt }\n}\n\n// MARK: - EnumString\n\nenum EnumString: String, PersistableEnum {\n    case value1 = \"a\"\n    case value2 = \"b\"\n    case value3 = \"c\"\n}\nextension EnumString: ValueFactory {\n    static func values() -> [EnumString] {\n        return EnumString.allCases\n    }\n}\nextension EnumString: ListValueFactoryOptional {\n    static var array: KeyPath<ModernCollectionsOfEnums, List<EnumString>> { \\.listString }\n    static var optArray: KeyPath<ModernCollectionsOfEnums, List<EnumString?>> { \\.listStringOpt }\n}\nextension EnumString: SetValueFactoryOptional {\n    static var mutableSet: KeyPath<ModernCollectionsOfEnums, MutableSet<EnumString>> { \\.setString }\n    static var optMutableSet: KeyPath<ModernCollectionsOfEnums, MutableSet<EnumString?>> { \\.setStringOpt }\n}\nextension EnumString: MapValueFactoryOptional {\n    static var map: KeyPath<ModernCollectionsOfEnums, Map<String, EnumString>> { \\.mapString }\n    static var optMap: KeyPath<ModernCollectionsOfEnums, Map<String, EnumString?>> { \\.mapStringOpt }\n}\n\n// MARK: - Custom Persistable\n\nextension CustomPersistable where PersistedType: ValueFactory {\n    typealias Wrapped = Self\n    static func values() -> [Self] { PersistedType.values().map(Self.init) }\n}\nextension CustomPersistable where PersistedType: NumericValueFactory {\n    typealias AverageType = PersistedType.AverageType\n    static func doubleValue(_ value: Self) -> Double { PersistedType.doubleValue(value.persistableValue) }\n    static var zero: Self { Self(persistedValue: PersistedType.zero) }\n}\n\nextension BoolWrapper: ValueFactory {}\nextension BoolWrapper: ListValueFactoryOptional {\n    static var array: KeyPath<CustomPersistableCollections, List<BoolWrapper>> { \\.listBool }\n    static var optArray: KeyPath<CustomPersistableCollections, List<BoolWrapper?>> { \\.listOptBool }\n}\n\nextension IntWrapper: NumericValueFactory {}\nextension IntWrapper: ListValueFactoryOptional {\n    static var array: KeyPath<CustomPersistableCollections, List<IntWrapper>> { \\.listInt }\n    static var optArray: KeyPath<CustomPersistableCollections, List<IntWrapper?>> { \\.listOptInt }\n}\n\nextension Int8Wrapper: NumericValueFactory {}\nextension Int8Wrapper: ListValueFactoryOptional {\n    static var array: KeyPath<CustomPersistableCollections, List<Int8Wrapper>> { \\.listInt8 }\n    static var optArray: KeyPath<CustomPersistableCollections, List<Int8Wrapper?>> { \\.listOptInt8 }\n}\n\nextension Int16Wrapper: NumericValueFactory {}\nextension Int16Wrapper: ListValueFactoryOptional {\n    static var array: KeyPath<CustomPersistableCollections, List<Int16Wrapper>> { \\.listInt16 }\n    static var optArray: KeyPath<CustomPersistableCollections, List<Int16Wrapper?>> { \\.listOptInt16 }\n}\n\nextension Int32Wrapper: NumericValueFactory {}\nextension Int32Wrapper: ListValueFactoryOptional {\n    static var array: KeyPath<CustomPersistableCollections, List<Int32Wrapper>> { \\.listInt32 }\n    static var optArray: KeyPath<CustomPersistableCollections, List<Int32Wrapper?>> { \\.listOptInt32 }\n}\n\nextension Int64Wrapper: NumericValueFactory {}\nextension Int64Wrapper: ListValueFactoryOptional {\n    static var array: KeyPath<CustomPersistableCollections, List<Int64Wrapper>> { \\.listInt64 }\n    static var optArray: KeyPath<CustomPersistableCollections, List<Int64Wrapper?>> { \\.listOptInt64 }\n}\n\nextension FloatWrapper: NumericValueFactory {}\nextension FloatWrapper: ListValueFactoryOptional {\n    static var array: KeyPath<CustomPersistableCollections, List<FloatWrapper>> { \\.listFloat }\n    static var optArray: KeyPath<CustomPersistableCollections, List<FloatWrapper?>> { \\.listOptFloat }\n}\n\nextension DoubleWrapper: NumericValueFactory {}\nextension DoubleWrapper: ListValueFactoryOptional {\n    static var array: KeyPath<CustomPersistableCollections, List<DoubleWrapper>> { \\.listDouble }\n    static var optArray: KeyPath<CustomPersistableCollections, List<DoubleWrapper?>> { \\.listOptDouble }\n}\n\nextension StringWrapper: ValueFactory {}\nextension StringWrapper: ListValueFactoryOptional {\n    static var array: KeyPath<CustomPersistableCollections, List<StringWrapper>> { \\.listString }\n    static var optArray: KeyPath<CustomPersistableCollections, List<StringWrapper?>> { \\.listOptString }\n}\n\nextension DataWrapper: ValueFactory {}\nextension DataWrapper: ListValueFactoryOptional {\n    static var array: KeyPath<CustomPersistableCollections, List<DataWrapper>> { \\.listBinary }\n    static var optArray: KeyPath<CustomPersistableCollections, List<DataWrapper?>> { \\.listOptBinary }\n}\n\nextension DateWrapper: ValueFactory {}\nextension DateWrapper: ListValueFactoryOptional {\n    static var array: KeyPath<CustomPersistableCollections, List<DateWrapper>> { \\.listDate }\n    static var optArray: KeyPath<CustomPersistableCollections, List<DateWrapper?>> { \\.listOptDate }\n}\n\nextension Decimal128Wrapper: NumericValueFactory {\n    static func doubleValue(_ value: Decimal128Wrapper) -> Double {\n        return value.persistableValue.doubleValue\n    }\n}\nextension Decimal128Wrapper: ListValueFactoryOptional {\n    static var array: KeyPath<CustomPersistableCollections, List<Decimal128Wrapper>> { \\.listDecimal }\n    static var optArray: KeyPath<CustomPersistableCollections, List<Decimal128Wrapper?>> { \\.listOptDecimal }\n}\n\nextension ObjectIdWrapper: ValueFactory {}\nextension ObjectIdWrapper: ListValueFactoryOptional {\n    static var array: KeyPath<CustomPersistableCollections, List<ObjectIdWrapper>> { \\.listObjectId }\n    static var optArray: KeyPath<CustomPersistableCollections, List<ObjectIdWrapper?>> { \\.listOptObjectId }\n}\n\nextension UUIDWrapper: ValueFactory {}\nextension UUIDWrapper: ListValueFactoryOptional {\n    static var array: KeyPath<CustomPersistableCollections, List<UUIDWrapper>> { \\.listUuid }\n    static var optArray: KeyPath<CustomPersistableCollections, List<UUIDWrapper?>> { \\.listOptUuid }\n}\n\nextension EmbeddedObjectWrapper: ValueFactory {\n    static func values() -> [EmbeddedObjectWrapper] {\n        Int.values().map { EmbeddedObjectWrapper(value: $0) }\n    }\n}\nextension EmbeddedObjectWrapper: ListValueFactory {\n    static var array: KeyPath<CustomPersistableCollections, List<EmbeddedObjectWrapper>> { \\.listObject }\n}\n"
  },
  {
    "path": "RealmSwift/Tests/ThreadSafeReferenceTests.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2016 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport XCTest\nimport RealmSwift\n\n#if canImport(RealmSwiftTestSupport)\nimport RealmSwiftTestSupport\n#endif\n\nclass ThreadSafeReferenceTests: TestCase {\n    /// Resolve a thread-safe reference confirming that you can't resolve it a second time.\n    func assertResolve<T>(_ realm: Realm, _ reference: ThreadSafeReference<T>) -> T? {\n        XCTAssertFalse(reference.isInvalidated)\n        let object = realm.resolve(reference)\n        XCTAssert(reference.isInvalidated)\n        assertThrows(realm.resolve(reference), reason: \"Can only resolve a thread safe reference once\")\n        return object\n    }\n\n    func testInvalidThreadSafeReferenceConstruction() {\n        let stringObject = SwiftStringObject()\n        let arrayParent = SwiftArrayPropertyObject(value: [\"arrayObject\", [[\"a\"]]])\n        let arrayObject = arrayParent.array\n        let setParent = SwiftMutableSetPropertyObject(value: [\"setObject\", [[\"a\"]]])\n        let setObject = setParent.set\n\n        assertThrows(ThreadSafeReference(to: stringObject), reason: \"Cannot construct reference to unmanaged object\")\n        assertThrows(ThreadSafeReference(to: arrayObject), reason: \"Cannot construct reference to unmanaged object\")\n        assertThrows(ThreadSafeReference(to: setObject), reason: \"Cannot construct reference to unmanaged object\")\n\n        let realm = try! Realm()\n        realm.beginWrite()\n        realm.add(stringObject)\n        realm.add(arrayParent)\n        realm.add(setParent)\n        realm.deleteAll()\n        try! realm.commitWrite()\n\n        assertThrows(ThreadSafeReference(to: stringObject), reason: \"Cannot construct reference to invalidated object\")\n        assertThrows(ThreadSafeReference(to: arrayObject), reason: \"Cannot construct reference to invalidated object\")\n        assertThrows(ThreadSafeReference(to: setObject), reason: \"Cannot construct reference to invalidated object\")\n    }\n\n    func testInvalidThreadSafeReferenceUsage() {\n        let realm = try! Realm()\n        realm.beginWrite()\n        let stringObject = realm.create(SwiftStringObject.self, value: [\"stringCol\": \"hello\"])\n        let ref1 = ThreadSafeReference(to: stringObject)\n        try! realm.commitWrite()\n        let ref2 = ThreadSafeReference(to: stringObject)\n        let ref3 = ThreadSafeReference(to: stringObject)\n\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            XCTAssertNil(unsafeSelf.realmWithTestPath().resolve(ref1))\n            let realm = try! Realm()\n            _ = realm.resolve(ref2)\n            unsafeSelf.assertThrows(realm.resolve(ref2),\n                                    reason: \"Can only resolve a thread safe reference once\")\n            // Assert that we can resolve a different reference to the same object.\n            XCTAssertEqual(unsafeSelf.assertResolve(realm, ref3)!.stringCol, \"hello\")\n        }\n    }\n\n    func testPassThreadSafeReferenceToDeletedObject() {\n        let realm = try! Realm()\n        let intObject = SwiftIntObject()\n        try! realm.write {\n            realm.add(intObject)\n        }\n        let ref1 = ThreadSafeReference(to: intObject)\n        let ref2 = ThreadSafeReference(to: intObject)\n        XCTAssertEqual(0, intObject.intCol)\n        dispatchSyncNewThread {\n            let realm = try! Realm()\n            try! realm.write {\n                realm.deleteAll()\n            }\n        }\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            let realm = try! Realm()\n            XCTAssertEqual(unsafeSelf.assertResolve(realm, ref1)!.intCol, 0)\n            realm.refresh()\n            XCTAssertNil(unsafeSelf.assertResolve(realm, ref2))\n        }\n    }\n\n    func testPassThreadSafeReferencesToMultipleObjects() {\n        let realm = try! Realm()\n        let (stringObject, intObject) = (SwiftStringObject(), SwiftIntObject())\n        try! realm.write {\n            realm.add(stringObject)\n            realm.add(intObject)\n        }\n        let stringObjectRef = ThreadSafeReference(to: stringObject)\n        let intObjectRef = ThreadSafeReference(to: intObject)\n        XCTAssertEqual(\"\", stringObject.stringCol)\n        XCTAssertEqual(0, intObject.intCol)\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            let realm = try! Realm()\n            let stringObject = unsafeSelf.assertResolve(realm, stringObjectRef)!\n            let intObject = unsafeSelf.assertResolve(realm, intObjectRef)!\n            try! realm.write {\n                stringObject.stringCol = \"the meaning of life\"\n                intObject.intCol = 42\n            }\n        }\n        XCTAssertEqual(\"\", stringObject.stringCol)\n        XCTAssertEqual(0, intObject.intCol)\n        realm.refresh()\n        XCTAssertEqual(\"the meaning of life\", stringObject.stringCol)\n        XCTAssertEqual(42, intObject.intCol)\n    }\n\n    func testPassThreadSafeReferenceToList() {\n        let realm = try! Realm()\n        let company = SwiftCompanyObject()\n        try! realm.write {\n            realm.add(company)\n            company.employees.append(SwiftEmployeeObject(value: [\"name\": \"jg\"]))\n        }\n        XCTAssertEqual(1, company.employees.count)\n        XCTAssertEqual(\"jg\", company.employees[0].name)\n        let listRef = ThreadSafeReference(to: company.employees)\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            let realm = try! Realm()\n            let employees = unsafeSelf.assertResolve(realm, listRef)!\n            XCTAssertEqual(1, employees.count)\n            XCTAssertEqual(\"jg\", employees[0].name)\n\n            try! realm.write {\n                employees.removeAll()\n                employees.append(SwiftEmployeeObject(value: [\"name\": \"jp\"]))\n                employees.append(SwiftEmployeeObject(value: [\"name\": \"az\"]))\n            }\n            XCTAssertEqual(2, employees.count)\n            XCTAssertEqual(\"jp\", employees[0].name)\n            XCTAssertEqual(\"az\", employees[1].name)\n        }\n        XCTAssertEqual(1, company.employees.count)\n        XCTAssertEqual(\"jg\", company.employees[0].name)\n        realm.refresh()\n        XCTAssertEqual(2, company.employees.count)\n        XCTAssertEqual(\"jp\", company.employees[0].name)\n        XCTAssertEqual(\"az\", company.employees[1].name)\n    }\n\n    func testPassThreadSafeReferenceToMutableSet() {\n        let realm = try! Realm()\n        let company = SwiftCompanyObject()\n        try! realm.write {\n            realm.add(company)\n            company.employeeSet.insert(SwiftEmployeeObject(value: [\"name\": \"jg\"]))\n        }\n        XCTAssertEqual(1, company.employeeSet.count)\n        XCTAssertEqual(\"jg\", company.employeeSet[0].name)\n        let setRef = ThreadSafeReference(to: company.employeeSet)\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            let realm = try! Realm()\n            let employeeSet = unsafeSelf.assertResolve(realm, setRef)!\n            XCTAssertEqual(1, employeeSet.count)\n            XCTAssertEqual(\"jg\", employeeSet[0].name)\n\n            try! realm.write {\n                employeeSet.removeAll()\n                employeeSet.insert(SwiftEmployeeObject(value: [\"name\": \"jp\"]))\n                employeeSet.insert(SwiftEmployeeObject(value: [\"name\": \"az\"]))\n            }\n            XCTAssertEqual(2, employeeSet.count)\n            assertSetContains(employeeSet, keyPath: \\.name, items: [\"jp\", \"az\"])\n        }\n        XCTAssertEqual(1, company.employeeSet.count)\n        XCTAssertEqual(\"jg\", company.employeeSet[0].name)\n        realm.refresh()\n        XCTAssertEqual(2, company.employeeSet.count)\n        assertSetContains(company.employeeSet, keyPath: \\.name, items: [\"jp\", \"az\"])\n    }\n\n    func testPassThreadSafeReferenceToResults() {\n        let realm = try! Realm()\n        let allObjects = realm.objects(SwiftStringObject.self)\n        let results = allObjects\n            .filter(\"stringCol != 'C'\")\n            .sorted(byKeyPath: \"stringCol\", ascending: false)\n        let resultsRef = ThreadSafeReference(to: results)\n        try! realm.write {\n            realm.create(SwiftStringObject.self, value: [\"A\"])\n            realm.create(SwiftStringObject.self, value: [\"B\"])\n            realm.create(SwiftStringObject.self, value: [\"C\"])\n            realm.create(SwiftStringObject.self, value: [\"D\"])\n        }\n        XCTAssertEqual(4, allObjects.count)\n        XCTAssertEqual(3, results.count)\n        XCTAssertEqual(\"D\", results[0].stringCol)\n        XCTAssertEqual(\"B\", results[1].stringCol)\n        XCTAssertEqual(\"A\", results[2].stringCol)\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            let realm = try! Realm()\n            let results = unsafeSelf.assertResolve(realm, resultsRef)!\n            let allObjects = realm.objects(SwiftStringObject.self)\n            XCTAssertEqual(0, allObjects.count)\n            XCTAssertEqual(0, results.count)\n            realm.refresh()\n            XCTAssertEqual(4, allObjects.count)\n            XCTAssertEqual(3, results.count)\n            XCTAssertEqual(\"D\", results[0].stringCol)\n            XCTAssertEqual(\"B\", results[1].stringCol)\n            XCTAssertEqual(\"A\", results[2].stringCol)\n            try! realm.write {\n                realm.delete(results[2])\n                realm.delete(results[0])\n                realm.create(SwiftStringObject.self, value: [\"E\"])\n            }\n            XCTAssertEqual(3, allObjects.count)\n            XCTAssertEqual(2, results.count)\n            XCTAssertEqual(\"E\", results[0].stringCol)\n            XCTAssertEqual(\"B\", results[1].stringCol)\n        }\n        XCTAssertEqual(4, allObjects.count)\n        XCTAssertEqual(3, results.count)\n        XCTAssertEqual(\"D\", results[0].stringCol)\n        XCTAssertEqual(\"B\", results[1].stringCol)\n        XCTAssertEqual(\"A\", results[2].stringCol)\n        realm.refresh()\n        XCTAssertEqual(3, allObjects.count)\n        XCTAssertEqual(2, results.count)\n        XCTAssertEqual(\"E\", results[0].stringCol)\n        XCTAssertEqual(\"B\", results[1].stringCol)\n    }\n\n    func testPassThreadSafeReferenceToLinkingObjects() {\n        let realm = try! Realm()\n        let dogA = SwiftDogObject(value: [\"dogName\": \"Cookie\", \"age\": 10])\n        let unaccessedDogB = SwiftDogObject(value: [\"dogName\": \"Skipper\", \"age\": 7])\n        // Ensures that a `LinkingObjects` without cached results can be handed over\n\n        try! realm.write {\n            realm.add(SwiftOwnerObject(value: [\"name\": \"Andrea\", \"dog\": dogA]))\n            realm.add(SwiftOwnerObject(value: [\"name\": \"Mike\", \"dog\": unaccessedDogB]))\n        }\n        XCTAssertEqual(1, dogA.owners.count)\n        XCTAssertEqual(\"Andrea\", dogA.owners[0].name)\n        let ownersARef = ThreadSafeReference(to: dogA.owners)\n        let ownersBRef = ThreadSafeReference(to: unaccessedDogB.owners)\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            let realm = try! Realm()\n            let ownersA = unsafeSelf.assertResolve(realm, ownersARef)!\n            let ownersB = unsafeSelf.assertResolve(realm, ownersBRef)!\n\n            XCTAssertEqual(1, ownersA.count)\n            XCTAssertEqual(\"Andrea\", ownersA[0].name)\n            XCTAssertEqual(1, ownersB.count)\n            XCTAssertEqual(\"Mike\", ownersB[0].name)\n\n            try! realm.write {\n                (ownersA[0].dog, ownersB[0].dog) = (ownersB[0].dog, ownersA[0].dog)\n            }\n            XCTAssertEqual(1, ownersA.count)\n            XCTAssertEqual(\"Mike\", ownersA[0].name)\n            XCTAssertEqual(1, ownersB.count)\n            XCTAssertEqual(\"Andrea\", ownersB[0].name)\n        }\n        XCTAssertEqual(1, dogA.owners.count)\n        XCTAssertEqual(\"Andrea\", dogA.owners[0].name)\n        XCTAssertEqual(1, unaccessedDogB.owners.count)\n        XCTAssertEqual(\"Mike\", unaccessedDogB.owners[0].name)\n        realm.refresh()\n        XCTAssertEqual(1, dogA.owners.count)\n        XCTAssertEqual(\"Mike\", dogA.owners[0].name)\n        XCTAssertEqual(1, unaccessedDogB.owners.count)\n        XCTAssertEqual(\"Andrea\", unaccessedDogB.owners[0].name)\n    }\n\n    func testPassThreadSafeReferenceToAnyRealmCollection() {\n        let realm = try! Realm()\n        let company = SwiftCompanyObject()\n        try! realm.write {\n            realm.add(company)\n            company.employees.append(SwiftEmployeeObject(value: [\"name\": \"A\"]))\n            company.employees.append(SwiftEmployeeObject(value: [\"name\": \"B\"]))\n            company.employees.append(SwiftEmployeeObject(value: [\"name\": \"C\"]))\n            company.employees.append(SwiftEmployeeObject(value: [\"name\": \"D\"]))\n            company.employeeSet.insert(SwiftEmployeeObject(value: [\"name\": \"A\"]))\n            company.employeeSet.insert(SwiftEmployeeObject(value: [\"name\": \"B\"]))\n            company.employeeSet.insert(SwiftEmployeeObject(value: [\"name\": \"C\"]))\n            company.employeeSet.insert(SwiftEmployeeObject(value: [\"name\": \"D\"]))\n        }\n        let results = AnyRealmCollection(realm.objects(SwiftEmployeeObject.self)\n            .filter(\"name != 'C'\")\n            .sorted(byKeyPath: \"name\", ascending: false))\n        let list = AnyRealmCollection(company.employees)\n        let set = AnyRealmCollection(company.employeeSet)\n        XCTAssertEqual(6, results.count)\n        XCTAssertEqual(\"D\", results[0].name)\n        XCTAssertEqual(\"D\", results[1].name)\n        XCTAssertEqual(\"B\", results[2].name)\n        XCTAssertEqual(4, list.count)\n        XCTAssertEqual(\"A\", list[0].name)\n        XCTAssertEqual(\"B\", list[1].name)\n        XCTAssertEqual(\"C\", list[2].name)\n        XCTAssertEqual(\"D\", list[3].name)\n        XCTAssertEqual(4, set.count)\n        assertAnyRealmCollectionContains(set, keyPath: \\.name, items: [\"A\", \"B\", \"C\", \"D\"])\n        let resultsRef = ThreadSafeReference(to: results)\n        let listRef = ThreadSafeReference(to: list)\n        let setRef = ThreadSafeReference(to: set)\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            let realm = try! Realm()\n            let results = unsafeSelf.assertResolve(realm, resultsRef)!\n            let list = unsafeSelf.assertResolve(realm, listRef)!\n            let set = unsafeSelf.assertResolve(realm, setRef)!\n            XCTAssertEqual(6, results.count)\n            XCTAssertEqual(\"D\", results[0].name)\n            XCTAssertEqual(\"D\", results[1].name)\n            XCTAssertEqual(\"B\", results[2].name)\n            XCTAssertEqual(4, list.count)\n            XCTAssertEqual(\"A\", list[0].name)\n            XCTAssertEqual(\"B\", list[1].name)\n            XCTAssertEqual(\"C\", list[2].name)\n            XCTAssertEqual(\"D\", list[3].name)\n            XCTAssertEqual(4, set.count)\n            assertAnyRealmCollectionContains(set, keyPath: \\.name, items: [\"A\", \"B\", \"C\", \"D\"])\n        }\n    }\n}\n\n// MARK: TestThreadSafeWrappersStruct\nstruct TestThreadSafeWrapperStruct {\n    @ThreadSafe var stringObject: SwiftStringObject?\n    @ThreadSafe var intObject: SwiftIntObject?\n    @ThreadSafe var employees: List<SwiftEmployeeObject>?\n    @ThreadSafe var stringMap: Map<String, SwiftStringObject?>?\n    @ThreadSafe var employeeSet: MutableSet<SwiftEmployeeObject>?\n    @ThreadSafe var owners: LinkingObjects<SwiftOwnerObject>?\n    @ThreadSafe var results: Results<SwiftStringObject>?\n\n    @ThreadSafe var arcResults: AnyRealmCollection<SwiftEmployeeObject>?\n    @ThreadSafe var arcList: AnyRealmCollection<SwiftEmployeeObject>?\n    @ThreadSafe var arcSet: AnyRealmCollection<SwiftEmployeeObject>?\n}\n\n// MARK: ThreadSafeWrapperTests\nclass ThreadSafeWrapperTests: ThreadSafeReferenceTests {\n    func wrapperStruct() -> TestThreadSafeWrapperStruct {\n        let realm = try! Realm()\n        var stringObj: SwiftStringObject?, intObj: SwiftIntObject?\n        try! realm.write({\n            stringObj = realm.create(SwiftStringObject.self, value: [\"stringCol\": \"before\"])\n            intObj = realm.create(SwiftIntObject.self, value: [\"intCol\": 1])\n        })\n        return TestThreadSafeWrapperStruct(stringObject: stringObj, intObject: intObj)\n    }\n\n    func testThreadSafeWrapperInvalidConstruction() {\n        let unmanagedObj = SwiftStringObject(value: [\"stringCol\": \"before\"])\n        assertThrows(TestThreadSafeWrapperStruct(stringObject: unmanagedObj), reason: \"Only managed objects may be wrapped as thread safe.\")\n    }\n\n    func testThreadSafeWrapper() {\n        let testStruct = wrapperStruct()\n        XCTAssertEqual(testStruct.stringObject!.stringCol, \"before\")\n        XCTAssertEqual(testStruct.intObject!.intCol, 1)\n\n        dispatchSyncNewThread {\n            try! Realm().write({\n                testStruct.stringObject!.stringCol = \"after\"\n                testStruct.intObject!.intCol = 2\n            })\n        }\n        XCTAssertEqual(testStruct.stringObject!.stringCol, \"after\")\n        XCTAssertEqual(testStruct.intObject!.intCol, 2)\n\n        // Edit value again to test the same thread safe reference isn't resolved twice\n        dispatchSyncNewThread {\n            try! Realm().write({\n                testStruct.stringObject!.stringCol = \"after, again\"\n                testStruct.intObject!.intCol = 3\n            })\n        }\n        XCTAssertEqual(testStruct.stringObject!.stringCol, \"after, again\")\n        XCTAssertEqual(testStruct.intObject!.intCol, 3)\n    }\n\n    func testThreadSafeWrapperDeleteObject() {\n        let testStruct = wrapperStruct()\n        XCTAssertEqual(testStruct.stringObject!.stringCol, \"before\")\n        XCTAssertEqual(testStruct.intObject!.intCol, 1)\n\n        dispatchSyncNewThread {\n            let realm = try! Realm()\n            try! realm.write({\n                realm.delete(testStruct.stringObject!)\n                realm.delete(testStruct.intObject!)\n            })\n        }\n        XCTAssertNil(testStruct.stringObject)\n        XCTAssertNil(testStruct.intObject)\n    }\n\n    func testThreadSafeWrapperReassign() {\n        let testStruct = wrapperStruct()\n        XCTAssertEqual(testStruct.stringObject!.stringCol, \"before\")\n        XCTAssertEqual(testStruct.intObject!.intCol, 1)\n\n        dispatchSyncNewThread {\n            let realm = try! Realm()\n            try! realm.write({\n                let stringObj = realm.create(SwiftStringObject.self, value: [\"stringCol\": \"after\"])\n                let intObj = realm.create(SwiftIntObject.self, value: [\"intCol\": 2])\n\n                testStruct.stringObject = stringObj\n                testStruct.intObject = intObj\n            })\n        }\n        XCTAssertEqual(testStruct.stringObject!.stringCol, \"after\")\n        XCTAssertEqual(testStruct.intObject!.intCol, 2)\n    }\n\n    func testThreadSafeWrapperReassignToNil() {\n        let testStruct = wrapperStruct()\n        XCTAssertEqual(testStruct.stringObject!.stringCol, \"before\")\n        XCTAssertEqual(testStruct.intObject!.intCol, 1)\n\n        dispatchSyncNewThread {\n            let realm = try! Realm()\n            try! realm.write({\n                testStruct.stringObject = nil\n                testStruct.intObject = nil\n            })\n        }\n        XCTAssertNil(testStruct.stringObject)\n        XCTAssertNil(testStruct.intObject)\n\n        dispatchSyncNewThread {\n            let realm = try! Realm()\n            try! realm.write({\n                testStruct.stringObject = realm.create(SwiftStringObject.self, value: [\"stringCol\": \"after, again\"])\n                testStruct.intObject = realm.create(SwiftIntObject.self, value: [\"intCol\": 3])\n            })\n        }\n        XCTAssertEqual(testStruct.stringObject!.stringCol, \"after, again\")\n        XCTAssertEqual(testStruct.intObject!.intCol, 3)\n    }\n\n    func testThreadSafeWrapperNilConstruction() {\n        let testStruct = TestThreadSafeWrapperStruct(stringObject: nil, intObject: nil)\n        XCTAssertEqual(testStruct.stringObject, nil)\n        XCTAssertEqual(testStruct.intObject, nil)\n\n        let config = {\n            var config = Realm.Configuration.defaultConfiguration\n            config.objectTypes = [SwiftStringObject.self, SwiftIntObject.self]\n            return config\n        }()\n        dispatchSyncNewThread {\n            let realm = try! Realm(configuration: config)\n            try! realm.write({\n                testStruct.stringObject = realm.create(SwiftStringObject.self, value: [\"stringCol\": \"after\"])\n                testStruct.intObject = realm.create(SwiftIntObject.self, value: [\"intCol\": 2])\n            })\n        }\n        XCTAssertEqual(testStruct.stringObject!.stringCol, \"after\")\n        XCTAssertEqual(testStruct.intObject!.intCol, 2)\n\n        // Edit value again to test the same thread safe reference isn't resolved twice\n        dispatchSyncNewThread {\n            let realm = try! Realm(configuration: config)\n            try! realm.write({\n                testStruct.stringObject!.stringCol = \"after, again\"\n                testStruct.intObject!.intCol = 3\n            })\n        }\n        XCTAssertEqual(testStruct.stringObject!.stringCol, \"after, again\")\n        XCTAssertEqual(testStruct.intObject!.intCol, 3)\n    }\n\n    func testThreadSafeWrapperDifferentConfig() {\n        let testStruct = wrapperStruct()\n        XCTAssertEqual(testStruct.stringObject!.stringCol, \"before\")\n        XCTAssertEqual(testStruct.intObject!.intCol, 1)\n\n        dispatchSyncNewThread {\n            var config = Realm.Configuration.defaultConfiguration\n            config.fileURL = config.fileURL!.deletingLastPathComponent().appendingPathComponent(\"newpath.realm\")\n            config.objectTypes = [SwiftEmployeeObject.self,\n                                  SwiftStringObject.self,\n                                  SwiftIntObject.self]\n\n            let realm = try! Realm(configuration: config) // Different realm config than original\n            try! realm.write({\n                let stringObj = realm.create(SwiftStringObject.self, value: [\"stringCol\": \"after\"])\n                let intObj = realm.create(SwiftIntObject.self, value: [\"intCol\": 2])\n\n                testStruct.stringObject = stringObj\n                testStruct.intObject = intObj\n            })\n        }\n        XCTAssertEqual(testStruct.stringObject!.stringCol, \"after\")\n        XCTAssertEqual(testStruct.intObject!.intCol, 2)\n    }\n\n    func testThreadSafeWrapperInvalidReassign() {\n        let testStruct = wrapperStruct()\n        XCTAssertEqual(testStruct.stringObject!.stringCol, \"before\")\n        XCTAssertEqual(testStruct.intObject!.intCol, 1)\n\n        nonisolated(unsafe) let unsafeSelf = self\n        dispatchSyncNewThread {\n            let realm = try! Realm()\n            try! realm.write {\n                unsafeSelf.assertThrows(testStruct.stringObject = SwiftStringObject(),\n                                        reason: \"Only managed objects may be wrapped as thread safe.\")\n            }\n        }\n    }\n\n    func testThreadSafeWrapperToList() {\n        let realm = try! Realm()\n        let company = SwiftCompanyObject()\n        try! realm.write {\n            realm.add(company)\n            company.employees.append(SwiftEmployeeObject(value: [\"name\": \"jg\"]))\n        }\n\n        XCTAssertEqual(1, company.employees.count)\n        XCTAssertEqual(\"jg\", company.employees[0].name)\n        let testStruct = TestThreadSafeWrapperStruct(employees: company.employees)\n        dispatchSyncNewThread {\n            let realm = try! Realm()\n            XCTAssertEqual(1, testStruct.employees!.count)\n            XCTAssertEqual(\"jg\", testStruct.employees![0].name)\n\n            try! realm.write {\n                testStruct.employees!.removeAll()\n                testStruct.employees!.append(SwiftEmployeeObject(value: [\"name\": \"jp\"]))\n                testStruct.employees!.append(SwiftEmployeeObject(value: [\"name\": \"az\"]))\n            }\n            XCTAssertEqual(2, testStruct.employees!.count)\n            XCTAssertEqual(\"jp\", testStruct.employees![0].name)\n            XCTAssertEqual(\"az\", testStruct.employees![1].name)\n        }\n        XCTAssertEqual(2, testStruct.employees!.count)\n        XCTAssertEqual(\"jp\", testStruct.employees![0].name)\n        XCTAssertEqual(\"az\", testStruct.employees![1].name)\n    }\n\n    func testThreadSafeWrapperToMap() {\n        let testStruct = TestThreadSafeWrapperStruct()\n        let realm = try! Realm()\n        try! realm.write {\n            let mapObject = SwiftMapObject()\n            mapObject.object[\"before\"] = realm.create(SwiftStringObject.self, value: [\"stringCol\": \"first\"])\n            realm.add(mapObject)\n            testStruct.stringMap = mapObject.object\n        }\n        dispatchSyncNewThread {\n            XCTAssertEqual(testStruct.stringMap?.count, 1)\n            XCTAssertEqual(testStruct.stringMap?[\"before\"]??.stringCol, \"first\")\n            let realm = try! Realm()\n            try! realm.write {\n                let swiftStringObject = realm.create(SwiftStringObject.self, value: [\"stringCol\": \"second\"])\n                testStruct.stringMap![\"after\"] = swiftStringObject\n            }\n        }\n        XCTAssertEqual(testStruct.stringMap?.count, 2)\n        XCTAssertEqual(testStruct.stringMap?[\"before\"]??.stringCol, \"first\")\n        XCTAssertEqual(testStruct.stringMap?[\"after\"]??.stringCol, \"second\")\n    }\n\n    func testThreadSafeWrapperToMutableSet() {\n        let realm = try! Realm()\n        let company = SwiftCompanyObject()\n        try! realm.write {\n            realm.add(company)\n            company.employeeSet.insert(SwiftEmployeeObject(value: [\"name\": \"jg\"]))\n        }\n        XCTAssertEqual(1, company.employeeSet.count)\n        XCTAssertEqual(\"jg\", company.employeeSet[0].name)\n        let testStruct = TestThreadSafeWrapperStruct(employeeSet: company.employeeSet)\n        dispatchSyncNewThread {\n            let realm = try! Realm()\n            XCTAssertEqual(1, testStruct.employeeSet!.count)\n            XCTAssertEqual(\"jg\", testStruct.employeeSet![0].name)\n\n            try! realm.write {\n                testStruct.employeeSet!.removeAll()\n                testStruct.employeeSet!.insert(SwiftEmployeeObject(value: [\"name\": \"jp\"]))\n                testStruct.employeeSet!.insert(SwiftEmployeeObject(value: [\"name\": \"az\"]))\n            }\n            XCTAssertEqual(2, testStruct.employeeSet!.count)\n            assertSetContains(testStruct.employeeSet!, keyPath: \\.name, items: [\"jp\", \"az\"])\n        }\n        XCTAssertEqual(2, testStruct.employeeSet!.count)\n        assertSetContains(testStruct.employeeSet!, keyPath: \\.name, items: [\"jp\", \"az\"])\n    }\n\n    func testThreadSafeWrapperToResults() {\n        let realm = try! Realm()\n        let allObjects = realm.objects(SwiftStringObject.self)\n        let results = allObjects\n            .filter(\"stringCol != 'C'\")\n            .sorted(byKeyPath: \"stringCol\", ascending: false)\n        let resultsStruct = TestThreadSafeWrapperStruct(results: results)\n        try! realm.write {\n            realm.create(SwiftStringObject.self, value: [\"A\"])\n            realm.create(SwiftStringObject.self, value: [\"B\"])\n            realm.create(SwiftStringObject.self, value: [\"C\"])\n            realm.create(SwiftStringObject.self, value: [\"D\"])\n        }\n        XCTAssertEqual(4, allObjects.count)\n        XCTAssertEqual(3, resultsStruct.results!.count)\n        XCTAssertEqual(\"D\", resultsStruct.results![0].stringCol)\n        XCTAssertEqual(\"B\", resultsStruct.results![1].stringCol)\n        XCTAssertEqual(\"A\", resultsStruct.results![2].stringCol)\n        dispatchSyncNewThread {\n            let realm = try! Realm()\n            let allObjects = realm.objects(SwiftStringObject.self)\n            XCTAssertEqual(4, allObjects.count)\n            XCTAssertEqual(3, resultsStruct.results!.count)\n            XCTAssertEqual(\"D\", resultsStruct.results![0].stringCol)\n            XCTAssertEqual(\"B\", resultsStruct.results![1].stringCol)\n            XCTAssertEqual(\"A\", resultsStruct.results![2].stringCol)\n            try! realm.write {\n                realm.delete(resultsStruct.results![2])\n                realm.delete(resultsStruct.results![0])\n                realm.create(SwiftStringObject.self, value: [\"E\"])\n            }\n            XCTAssertEqual(3, allObjects.count)\n            XCTAssertEqual(2, resultsStruct.results!.count)\n            XCTAssertEqual(\"E\", resultsStruct.results![0].stringCol)\n            XCTAssertEqual(\"B\", resultsStruct.results![1].stringCol)\n        }\n        realm.refresh()\n        XCTAssertEqual(3, allObjects.count)\n        XCTAssertEqual(2, resultsStruct.results!.count)\n        XCTAssertEqual(\"E\", resultsStruct.results![0].stringCol)\n        XCTAssertEqual(\"B\", resultsStruct.results![1].stringCol)\n    }\n\n    func testThreadSafeWrapperLinkingObjects() {\n        let realm = try! Realm()\n        let dog = SwiftDogObject(value: [\"dogName\": \"Cookie\", \"age\": 10])\n\n        try! realm.write {\n            realm.add(SwiftOwnerObject(value: [\"name\": \"Andrea\", \"dog\": dog]))\n        }\n\n        let linkingObjectsStruct = TestThreadSafeWrapperStruct(owners: dog.owners)\n        XCTAssertEqual(1, linkingObjectsStruct.owners!.count)\n        XCTAssertEqual(\"Andrea\", linkingObjectsStruct.owners![0].name)\n        dispatchSyncNewThread {\n            let realm = try! Realm()\n            XCTAssertEqual(1, linkingObjectsStruct.owners!.count)\n            XCTAssertEqual(\"Andrea\", linkingObjectsStruct.owners![0].name)\n\n            try! realm.write {\n                linkingObjectsStruct.owners![0].name = \"Mike\"\n            }\n            XCTAssertEqual(1, linkingObjectsStruct.owners!.count)\n            XCTAssertEqual(\"Mike\", linkingObjectsStruct.owners![0].name)\n        }\n        XCTAssertEqual(1, linkingObjectsStruct.owners!.count)\n        XCTAssertEqual(\"Mike\", linkingObjectsStruct.owners![0].name)\n    }\n\n    func testThreadSafeWrapperToAnyRealmCollection() {\n        let realm = try! Realm()\n        let company = SwiftCompanyObject()\n        try! realm.write {\n            realm.add(company)\n            company.employees.append(SwiftEmployeeObject(value: [\"name\": \"A\"]))\n            company.employees.append(SwiftEmployeeObject(value: [\"name\": \"B\"]))\n            company.employees.append(SwiftEmployeeObject(value: [\"name\": \"C\"]))\n            company.employees.append(SwiftEmployeeObject(value: [\"name\": \"D\"]))\n            company.employeeSet.insert(SwiftEmployeeObject(value: [\"name\": \"A\"]))\n            company.employeeSet.insert(SwiftEmployeeObject(value: [\"name\": \"B\"]))\n            company.employeeSet.insert(SwiftEmployeeObject(value: [\"name\": \"C\"]))\n            company.employeeSet.insert(SwiftEmployeeObject(value: [\"name\": \"D\"]))\n        }\n\n        let testStruct = TestThreadSafeWrapperStruct(arcResults: AnyRealmCollection(realm.objects(SwiftEmployeeObject.self)\n                                                                                            .filter(\"name != 'C'\")\n                                                                                            .sorted(byKeyPath: \"name\", ascending: false)),\n                                                          arcList: AnyRealmCollection(company.employees),\n                                                          arcSet: AnyRealmCollection(company.employeeSet))\n\n        XCTAssertEqual(6, testStruct.arcResults!.count)\n        XCTAssertEqual(\"D\", testStruct.arcResults![0].name)\n        XCTAssertEqual(\"D\", testStruct.arcResults![1].name)\n        XCTAssertEqual(\"B\", testStruct.arcResults![2].name)\n        XCTAssertEqual(4, testStruct.arcList!.count)\n        XCTAssertEqual(\"A\", testStruct.arcList![0].name)\n        XCTAssertEqual(\"B\", testStruct.arcList![1].name)\n        XCTAssertEqual(\"C\", testStruct.arcList![2].name)\n        XCTAssertEqual(\"D\", testStruct.arcList![3].name)\n        XCTAssertEqual(4, testStruct.arcSet!.count)\n        assertAnyRealmCollectionContains(testStruct.arcSet!, keyPath: \\.name, items: [\"A\", \"B\", \"C\", \"D\"])\n\n        dispatchSyncNewThread {\n            XCTAssertEqual(6, testStruct.arcResults!.count)\n            XCTAssertEqual(\"D\", testStruct.arcResults![0].name)\n            XCTAssertEqual(\"D\", testStruct.arcResults![1].name)\n            XCTAssertEqual(\"B\", testStruct.arcResults![2].name)\n            XCTAssertEqual(4, testStruct.arcList!.count)\n            XCTAssertEqual(\"A\", testStruct.arcList![0].name)\n            XCTAssertEqual(\"B\", testStruct.arcList![1].name)\n            XCTAssertEqual(\"C\", testStruct.arcList![2].name)\n            XCTAssertEqual(\"D\", testStruct.arcList![3].name)\n            XCTAssertEqual(4, testStruct.arcSet!.count)\n            assertAnyRealmCollectionContains(testStruct.arcSet!, keyPath: \\.name, items: [\"A\", \"B\", \"C\", \"D\"])\n        }\n    }\n\n#if swift(<6) // Swift 6 has not implemented sendability checking for property wrappers\n    func testThreadSafeWrapperInline() throws {\n        let values = [\"A\", \"B\", \"C\", \"D\"]\n        try autoreleasepool {\n            let realm = try Realm()\n            try realm.write {\n                realm.create(SwiftStringObject.self, value: [\"A\"])\n                realm.create(SwiftStringObject.self, value: [\"B\"])\n                realm.create(SwiftStringObject.self, value: [\"C\"])\n                realm.create(SwiftStringObject.self, value: [\"D\"])\n            }\n        }\n\n        let realm = try! Realm()\n        @ThreadSafe var results = realm.objects(SwiftStringObject.self)\n        dispatchSyncNewThread {\n            guard let results else {\n                return XCTFail(\"no results\")\n            }\n            results.indices.forEach { idx in\n                XCTAssertEqual(results[idx].stringCol, values[idx])\n            }\n        }\n        @ThreadSafe var swiftStringObject = results!.first\n        dispatchSyncNewThread {\n            guard let swiftStringObject else {\n                return XCTFail(\"no results\")\n            }\n\n            XCTAssertEqual(swiftStringObject.stringCol, \"A\")\n        }\n    }\n\n    func mutateStringCol(@ThreadSafe stringObj: SwiftStringObject?) {\n        dispatchSyncNewThread {\n            let realm = try! Realm()\n            try! realm.write {\n                stringObj?.stringCol = \"after\"\n            }\n        }\n    }\n\n    func testThreadSafeFunctionArgument() {\n        let realm = try! Realm()\n        @ThreadSafe var stringObj = try! realm.write {\n            realm.create(SwiftStringObject.self, value: [\"stringCol\": \"before\"])\n        }\n\n        XCTAssertEqual(stringObj!.stringCol, \"before\")\n        self.mutateStringCol(stringObj: stringObj)\n        realm.refresh()\n        XCTAssertEqual(stringObj!.stringCol, \"after\")\n    }\n\n    func testThreadSafeUnmanagedArgument() {\n        nonisolated(unsafe) let stringObj = SwiftStringObject(value: [\"stringCol\": \"before\"])\n\n        dispatchSyncNewThread {\n            self.assertThrows(self.mutateStringCol(stringObj: stringObj),\n                              reason: \"Only managed objects may be wrapped as thread safe.\")\n        }\n    }\n\n    func testThreadSafeMultipleDispatch() {\n        let realm = try! Realm()\n        @ThreadSafe var obj = try! realm.write {\n            realm.create(SwiftStringObject.self, value: [\"stringCol\": \"before\"])\n        }\n        let ex = expectation(description: \"executes first block\")\n\n        DispatchQueue.concurrentPerform(iterations: 100) { i in\n            try! obj?.realm?.write {\n                obj?.stringCol = \"middle\"\n            }\n            if i == 99 { ex.fulfill() }\n        }\n\n        waitForExpectations(timeout: 5, handler: nil)\n        XCTAssertNotEqual(obj?.stringCol, \"before\")\n    }\n#endif\n}\n"
  },
  {
    "path": "RealmSwift/ThreadSafeReference.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2016 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Realm\n\n/**\n Objects of types which conform to `ThreadConfined` can be managed by a Realm, which will make\n them bound to a thread-specific `Realm` instance. Managed objects must be explicitly exported\n and imported to be passed between threads.\n\n Managed instances of objects conforming to this protocol can be converted to a thread-safe\n reference for transport between threads by passing to the `ThreadSafeReference(to:)` constructor.\n\n Note that only types defined by Realm can meaningfully conform to this protocol, and defining new\n classes which attempt to conform to it will not make them work with `ThreadSafeReference`.\n */\npublic protocol ThreadConfined {\n    /**\n     The Realm which manages the object, or `nil` if the object is unmanaged.\n\n     Unmanaged objects are not confined to a thread and cannot be passed to methods expecting a\n     `ThreadConfined` object.\n     */\n    var realm: Realm? { get }\n\n    /// Indicates if the object can no longer be accessed because it is now invalid.\n    var isInvalidated: Bool { get }\n\n    /**\n    Indicates if the object is frozen.\n\n    Frozen objects are not confined to their source thread. Forming a `ThreadSafeReference` to a\n    frozen object is allowed, but is unlikely to be useful.\n    */\n    var isFrozen: Bool { get }\n\n    /**\n     Returns a frozen snapshot of this object.\n\n     Unlike normal Realm live objects, the frozen copy can be read from any thread, and the values\n     read will never update to reflect new writes to the Realm. Frozen collections can be queried\n     like any other Realm collection. Frozen objects cannot be mutated, and cannot be observed for\n     change notifications.\n\n     Unmanaged Realm objects cannot be frozen.\n\n     - warning: Holding onto a frozen object for an extended period while performing write\n     transaction on the Realm may result in the Realm file growing to large sizes. See\n     `Realm.Configuration.maximumNumberOfActiveVersions` for more information.\n    */\n    func freeze() -> Self\n\n    /**\n     Returns a live (mutable) reference of this object.\n     Will return self if called on an already live object.\n     */\n    func thaw() -> Self?\n}\n\n/**\n An object intended to be passed between threads containing a thread-safe reference to its\n thread-confined object.\n\n To resolve a thread-safe reference on a target Realm on a different thread, pass to\n `Realm.resolve(_:)`.\n\n - warning: A `ThreadSafeReference` object must be resolved at most once.\n            Failing to resolve a `ThreadSafeReference` will result in the source version of the\n            Realm being pinned until the reference is deallocated.\n\n - note: Prefer short-lived `ThreadSafeReference`s as the data for the version of the source Realm\n         will be retained until all references have been resolved or deallocated.\n\n - see: `ThreadConfined`\n - see: `Realm.resolve(_:)`\n */\n@frozen public struct ThreadSafeReference<Confined: ThreadConfined> {\n    /**\n     Indicates if the reference can no longer be resolved because an attempt to resolve it has\n     already occurred. References can only be resolved once.\n     */\n    public var isInvalidated: Bool { return objectiveCReference.isInvalidated }\n\n    private let objectiveCReference: RLMThreadSafeReference<RLMThreadConfined>\n\n    /**\n     Create a thread-safe reference to the thread-confined object.\n\n     - parameter threadConfined: The thread-confined object to create a thread-safe reference to.\n\n     - note: You may continue to use and access the thread-confined object after passing it to this\n             constructor.\n     */\n    public init(to threadConfined: Confined) {\n        objectiveCReference = RLMThreadSafeReference(threadConfined: (threadConfined as! _ObjcBridgeable)._rlmObjcValue as! RLMThreadConfined)\n    }\n\n    internal func resolve(in realm: Realm) -> Confined? {\n        guard let resolved = realm.rlmRealm.__resolve(objectiveCReference) as? RLMThreadConfined else { return nil }\n        return (Confined.self as! _ObjcBridgeable.Type)._rlmFromObjc(resolved).flatMap { $0 as? Confined }\n    }\n}\n\n// MARK: ThreadSafe propertyWrapper\n\n/**\n    A property wrapper type that may be passed between threads.\n\n    A `@ThreadSafe` property contains a thread-safe reference to the underlying wrapped value.\n    This reference is resolved to the thread on which the wrapped value is accessed. A new thread\n    safe reference is created each time the property is accessed.\n\n - warning: This property wrapper should not be used for properties on long lived objects.\n            `@ThreadSafe` properties contain a `ThreadSafeReference` which\n            can pin the source version of the Realm in use. This means that this property\n            wrapper is **better suited for function arguments and local variables**\n            **that get captured by an aynchronously dispatched block.**\n\n - see: `ThreadSafeReference`\n - see: `ThreadConfined`\n*/\n@propertyWrapper public final class ThreadSafe<T: ThreadConfined> {\n    private var threadSafeReference: ThreadSafeReference<T>?\n    private var rlmConfiguration: RLMRealmConfiguration?\n    private let lock = NSLock()\n\n    /// :nodoc:\n    public var wrappedValue: T? {\n        get {\n            lock.lock()\n            guard let threadSafeReference = threadSafeReference,\n                  let rlmConfig = rlmConfiguration else {\n                lock.unlock()\n                return nil\n            }\n            do {\n                let rlmRealm = try RLMRealm(configuration: rlmConfig)\n                let realm = Realm(rlmRealm)\n                guard let value = threadSafeReference.resolve(in: realm) else {\n                    self.threadSafeReference = nil\n                    lock.unlock()\n                    return nil\n                }\n                self.threadSafeReference = ThreadSafeReference(to: value)\n                lock.unlock()\n                return value\n            // FIXME: wrappedValue should throw\n            // As of Swift 5.5 property wrappers can't have throwing accessors.\n            } catch let error as NSError {\n                lock.unlock()\n                throwRealmException(error.localizedDescription)\n            }\n        }\n        set {\n            lock.lock()\n            guard let newValue = newValue else {\n                threadSafeReference = nil\n                lock.unlock()\n                return\n            }\n            guard let rlmConfiguration = newValue.realm?.rlmRealm.configuration else {\n                lock.unlock()\n                throwRealmException(\"Only managed objects may be wrapped as thread safe.\")\n            }\n            self.rlmConfiguration = rlmConfiguration\n            threadSafeReference = ThreadSafeReference(to: newValue)\n            lock.unlock()\n        }\n    }\n\n    /// :nodoc:\n    public init(wrappedValue: T?) {\n        self.wrappedValue = wrappedValue\n    }\n}\n\nextension Realm {\n    // MARK: Thread Safe Reference\n\n    /**\n     Returns the same object as the one referenced when the `ThreadSafeReference` was first\n     created, but resolved for the current Realm for this thread. Returns `nil` if this object was\n     deleted after the reference was created.\n\n     - parameter reference: The thread-safe reference to the thread-confined object to resolve in\n                            this Realm.\n\n     - warning: A `ThreadSafeReference` object must be resolved at most once.\n                Failing to resolve a `ThreadSafeReference` will result in the source version of the\n                Realm being pinned until the reference is deallocated.\n                An exception will be thrown if a reference is resolved more than once.\n\n     - warning: Cannot call within a write transaction.\n\n     - note: Will refresh this Realm if the source Realm was at a later version than this one.\n\n     - see: `ThreadSafeReference(to:)`\n     */\n    public func resolve<Confined>(_ reference: ThreadSafeReference<Confined>) -> Confined? {\n        return reference.resolve(in: self)\n    }\n}\n\nextension ThreadSafeReference: Sendable {\n}\nextension RLMThreadSafeReference: @unchecked Sendable {\n}\nextension ThreadSafe: @unchecked Sendable {\n}\n"
  },
  {
    "path": "RealmSwift/Util.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport Realm\nimport os.log\n\n#if BUILDING_REALM_SWIFT_TESTS\nimport RealmSwift\n#endif\n\n// MARK: Internal Helpers\n\n// Swift 3.1 provides fixits for some of our uses of unsafeBitCast\n// to use unsafeDowncast instead, but the bitcast is required.\ninternal func noWarnUnsafeBitCast<T, U>(_ x: T, to type: U.Type) -> U {\n    return unsafeBitCast(x, to: type)\n}\n\n/// Given a list of `Any`-typed varargs, unwrap any optionals and\n/// replace them with the underlying value or NSNull.\ninternal func unwrapOptionals(in varargs: [Any]) -> [Any] {\n    return varargs.map { arg in\n        if let someArg = arg as Any? {\n            return someArg\n        }\n        return NSNull()\n    }\n}\n\ninternal func notFoundToNil(index: UInt) -> Int? {\n    if index == UInt(NSNotFound) {\n        return nil\n    }\n    return Int(index)\n}\n\ninternal func throwRealmException(_ message: String, userInfo: [AnyHashable: Any]? = nil) -> Never {\n    NSException(name: NSExceptionName(rawValue: RLMExceptionName), reason: message, userInfo: userInfo).raise()\n    fatalError() // unreachable\n}\n\ninternal func throwForNegativeIndex(_ int: Int, parameterName: String = \"index\") {\n    if int < 0 {\n        throwRealmException(\"Cannot pass a negative value for '\\(parameterName)'.\")\n    }\n}\n\ninternal func gsub(pattern: String, template: String, string: String, error: NSErrorPointer = nil) -> String? {\n    let regex = try? NSRegularExpression(pattern: pattern, options: [])\n    return regex?.stringByReplacingMatches(in: string, options: [],\n                                           range: NSRange(location: 0, length: string.utf16.count),\n                                           withTemplate: template)\n}\n\nextension ObjectBase {\n    // Must *only* be used to call Realm Objective-C APIs that are exposed on `RLMObject`\n    // but actually operate on `RLMObjectBase`. Do not expose cast value to user.\n    internal func unsafeCastToRLMObject() -> RLMObject {\n        return noWarnUnsafeBitCast(self, to: RLMObject.self)\n    }\n}\n\ninternal func coerceToNil(_ value: Any) -> Any? {\n    if value is NSNull {\n        return nil\n    }\n    // nil in Any is bridged to obj-c as NSNull. In the obj-c code we usually\n    // convert NSNull back to nil, which ends up as Optional<Any>.none\n    if case Optional<Any>.none = value {\n        return nil\n    }\n    return value\n}\n\n// MARK: CustomObjectiveCBridgeable\n\ninternal extension _ObjcBridgeable {\n    static func _rlmFromObjc(_ value: Any) -> Self? { _rlmFromObjc(value, insideOptional: false) }\n}\n/// :nodoc:\npublic func dynamicBridgeCast<T>(fromObjectiveC x: Any) -> T {\n    if let bridged = failableDynamicBridgeCast(fromObjectiveC: x) as T? {\n        return bridged\n    }\n    fatalError(\"Could not convert value '\\(x)' to type '\\(T.self)'\")\n}\n\n/// :nodoc:\n@usableFromInline\ninternal func failableDynamicBridgeCast<T>(fromObjectiveC x: Any) -> T? {\n    if let bridgeableType = T.self as? _ObjcBridgeable.Type {\n        return bridgeableType._rlmFromObjc(x).flatMap { $0 as? T }\n    }\n    if let value = x as? T {\n        return value\n    }\n    return nil\n}\n\n/// :nodoc:\npublic func dynamicBridgeCast<T>(fromSwift x: T) -> Any {\n    if let x = x as? _ObjcBridgeable {\n        return x._rlmObjcValue\n    }\n    return x\n}\n\n@usableFromInline\ninternal func staticBridgeCast<T: _ObjcBridgeable>(fromSwift x: T) -> Any {\n    return x._rlmObjcValue\n}\n@usableFromInline\ninternal func staticBridgeCast<T: _ObjcBridgeable>(fromObjectiveC x: Any) -> T {\n    if let value = T._rlmFromObjc(x) {\n        return value\n    }\n    throwRealmException(\"Could not convert value '\\(x)' to type '\\(T.self)'.\")\n}\n@usableFromInline\ninternal func failableStaticBridgeCast<T: _ObjcBridgeable>(fromObjectiveC x: Any) -> T? {\n    return T._rlmFromObjc(x)\n}\n\ninternal func logRuntimeIssue(_ message: StaticString) {\n    if #available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *) {\n        // Reporting a runtime issue to Xcode requires pretending to be\n        // one of the system libraries which are allowed to do so. We do\n        // this by looking up a symbol defined by SwiftUI, getting the\n        // dso information from that, and passing that to os_log() to\n        // claim that we're SwiftUI. As this is obviously not a particularly legal thing to do, we only do it in debug and simulator builds.\n        var dso = #dsohandle\n        #if DEBUG || targetEnvironment(simulator)\n        let sym = dlsym(dlopen(nil, RTLD_LAZY), \"$s7SwiftUI3AppMp\")\n        var info = Dl_info()\n        dladdr(sym, &info)\n        if let base = info.dli_fbase {\n            dso = UnsafeRawPointer(base)\n        }\n        #endif\n        let log = OSLog(subsystem: \"com.apple.runtime-issues\", category: \"Realm\")\n        os_log(.fault, dso: dso, log: log, message)\n    } else {\n        print(message)\n    }\n}\n\n@available(macOS 10.15, tvOS 13.0, iOS 13.0, watchOS 6.0, *)\nextension Actor {\n    @_unavailableFromAsync\n    internal func invokeIsolated<Ret, Arg>(_ operation: (isolated Self, Arg) throws -> Ret, _ arg: Arg,\n                                           file: StaticString = #fileID, line: UInt = #line\n    ) rethrows -> Ret {\n        preconditionIsolated(file: file, line: line)\n        return try withoutActuallyEscaping(operation) { fn in\n            try unsafeBitCast(fn, to: ((Self, Arg) throws -> Ret).self)(self, arg)\n        }\n    }\n}\n"
  },
  {
    "path": "RealmSwift.podspec",
    "content": "# coding: utf-8\nPod::Spec.new do |s|\n  s.name                      = 'RealmSwift'\n  version                     = `sh build.sh get-version`\n  s.version                   = version\n  s.summary                   = 'Realm Swift is a modern data framework & database for iOS, macOS, tvOS & watchOS.'\n  s.description               = <<-DESC\n                                The Realm Database, for Swift. (If you want to use Realm from Objective-C, see the “Realm” pod.)\n\n                                Realm is a fast, easy-to-use replacement for Core Data & SQLite. Works on iOS, macOS, tvOS & watchOS. Learn more and get help at https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/.\n                                DESC\n  s.homepage                  = \"https://realm.io\"\n  s.source                    = { :git => 'https://github.com/realm/realm-swift.git', :tag => \"v#{s.version}\" }\n  s.author                    = { 'Realm' => 'realm-help@mongodb.com' }\n  s.requires_arc              = true\n  s.license                   = { :type => 'Apache 2.0', :file => 'LICENSE' }\n  s.ios.deployment_target     = '12.0'\n  s.osx.deployment_target     = '10.13'\n  s.watchos.deployment_target = '4.0'\n  s.tvos.deployment_target    = '12.0'\n  s.preserve_paths            = %w(build.sh)\n  s.swift_version             = '5'\n\n  s.weak_frameworks = 'SwiftUI'\n\n  s.dependency 'Realm', \"= #{s.version}\"\n  s.source_files = 'RealmSwift/*.swift', 'RealmSwift/Impl/*.swift', 'Realm/Swift/*.swift'\n  s.resource_bundles = {'realm_swift_privacy' => ['RealmSwift/PrivacyInfo.xcprivacy']}\n\n  s.pod_target_xcconfig = {\n    'APPLICATION_EXTENSION_API_ONLY' => 'YES',\n\n    'IPHONEOS_DEPLOYMENT_TARGET_1500' => '12.0',\n    'IPHONEOS_DEPLOYMENT_TARGET_1600' => '12.0',\n    'IPHONEOS_DEPLOYMENT_TARGET_2600' => '12.0',\n    'IPHONEOS_DEPLOYMENT_TARGET' => '$(IPHONEOS_DEPLOYMENT_TARGET_$(XCODE_VERSION_MAJOR))',\n    'MACOSX_DEPLOYMENT_TARGET_1500' => '10.13',\n    'MACOSX_DEPLOYMENT_TARGET_1600' => '10.13',\n    'MACOSX_DEPLOYMENT_TARGET_2600' => '10.13',\n    'MACOSX_DEPLOYMENT_TARGET' => '$(MACOSX_DEPLOYMENT_TARGET_$(XCODE_VERSION_MAJOR))',\n    'WATCHOS_DEPLOYMENT_TARGET_1500' => '4.0',\n    'WATCHOS_DEPLOYMENT_TARGET_1600' => '4.0',\n    'WATCHOS_DEPLOYMENT_TARGET_2600' => '4.0',\n    'WATCHOS_DEPLOYMENT_TARGET' => '$(WATCHOS_DEPLOYMENT_TARGET_$(XCODE_VERSION_MAJOR))',\n    'TVOS_DEPLOYMENT_TARGET_1500' => '12.0',\n    'TVOS_DEPLOYMENT_TARGET_1600' => '12.0',\n    'TVOS_DEPLOYMENT_TARGET_2600' => '12.0',\n    'TVOS_DEPLOYMENT_TARGET' => '$(TVOS_DEPLOYMENT_TARGET_$(XCODE_VERSION_MAJOR))',\n  }\nend\n"
  },
  {
    "path": "SUPPORT.md",
    "content": "# Support\n\nThe Realm team is here to help you with your Realm-related issues!\n\n## Documentation\n\nBefore asking questions, please familiarize yourself with our [Realm Swift](https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/) documentation. We also have a number of [Tech Notes](https://www.mongodb.com/developer/products/realm/) which cover various topics that may be of interest.\n\n## Stack Overflow\n\nIf you have questions about configuring or using Realm you can ask them on Stack Overflow. We continually monitor the [`realm` tag](https://stackoverflow.com/tags/realm). Please also tag your question with `ios`, `swift`, or other tags as appropriate.\n\nWhen asking questions on Stack Overflow, please keep in mind Stack Overflow's [question guidelines](https://stackoverflow.com/help/how-to-ask), and please use their search functionality to see if your question has been asked before.\n\n## GitHub Issues\n\nIf you are running into issues with Realm, including potential bugs or feature requests, we encourage you to file an issue on our [GitHub issue tracker](https://github.com/realm/realm-swift/issues). Please check out our [Contribution Guidelines](CONTRIBUTING.md) for information on how to properly file an issue.\n\nWe greatly appreciate demonstration projects that we can run for ourselves in order to see issues or potential bugs; we prioritize clearly-written tickets that include reproduction cases. You may attach these to the ticket; let us know if you need to share them confidentially, and we’ll provide instructions on how to do so. \n"
  },
  {
    "path": "build.sh",
    "content": "#!/bin/bash\n\n##################################################################################\n# Custom build tool for Realm Objective-C binding.\n#\n# (C) Copyright 2011-2022 by realm.io.\n##################################################################################\n\nset -eo pipefail\n\nreadonly source_root=\"$(dirname \"$0\")\"\n\n: \"${REALM_CORE_VERSION:=$(sed -n 's/^REALM_CORE_VERSION=\\(.*\\)$/\\1/p' \"${source_root}/dependencies.list\")}\" # set to \"current\" to always use the current build\n\n# Provide a fallback value for TMPDIR, relevant for Xcode Bots\n: \"${TMPDIR:=$(getconf DARWIN_USER_TEMP_DIR)}\"\n\nPATH=/usr/libexec:$PATH\n\nif [ -n \"${CI}\" ]; then\n    CODESIGN_PARAMS=(CODE_SIGN_IDENTITY='' CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO)\nfi\n\nif [ -n \"${GITHUB_WORKSPACE}\" ]; then\n    DERIVED_DATA=\"$GITHUB_WORKSPACE/build/DerivedData\"\n    ROOT_WORKSPACE=\"$GITHUB_WORKSPACE\"\n    BRANCH=\"${GITHUB_HEAD_REF:-${GITHUB_REF}}\"\nelse\n    ROOT_WORKSPACE=\"$(pwd)\"\n    DERIVED_DATA=\"$ROOT_WORKSPACE/build/DerivedData\"\n    BRANCH=\"$(git branch --show-current)\"\nfi\n\nusage() {\ncat <<EOF\nUsage: sh $0 command [argument]\n\ncommand:\n  clean:                clean up/remove all generated files\n  download-core:        downloads core library (binary version)\n  build [platforms]:    builds xcframeworks for Realm and RealmSwift for given platforms (default all)\n  build-static [plats]: builds static xcframework for Realm platforms (default all)\n  analyze-osx:          analyzes macOS framework\n\n  test:                 tests all iOS and macOS frameworks\n  test-all:             tests all iOS and macOS frameworks in both Debug and Release configurations\n  test-ios-static:      tests static iOS framework on 32-bit and 64-bit simulators\n  test-ios-dynamic:     tests dynamic iOS framework on 32-bit and 64-bit simulators\n  test-ios-swift:       tests RealmSwift iOS framework on 32-bit and 64-bit simulators\n  test-ios-devices:     tests ObjC & Swift iOS frameworks on all attached iOS devices\n  test-ios-devices-objc:  tests ObjC iOS framework on all attached iOS devices\n  test-ios-devices-swift: tests Swift iOS framework on all attached iOS devices\n  test-tvos:            tests tvOS framework\n  test-tvos-swift:      tests RealmSwift tvOS framework\n  test-tvos-devices:    tests ObjC & Swift tvOS frameworks on all attached tvOS devices\n  test-osx:             tests macOS framework\n  test-osx-swift:       tests RealmSwift macOS framework\n  test-catalyst:        tests Mac Catalyst framework\n  test-catalyst-swift:  tests RealmSwift Mac Catalyst framework\n  test-swiftpm:         tests ObjC and Swift macOS frameworks via SwiftPM\n  test-ios-swiftui:        tests SwiftUI framework UI tests\n  verify:               verifies docs, cocoapods, swiftpm, xcframework, swiftlint, spm-ios, watchos in both Debug and Release configurations\n\n  docs:                 builds docs in docs/output\n  examples:             builds all examples\n  examples-ios:         builds all objc iOS examples\n  examples-ios-swift:   builds all Swift iOS examples\n  examples-osx:         builds all macOS examples\n  examples-tvos:        builds all objc tvOS examples\n  examples-tvos-swift:  builds all Swift tvOS examples\n\n  get-version:          get the current version\n  set-version version:  set the version\n  set-core-version version: set the version of core to use\n\n  release-package-examples:       build release package the examples\n  release-package-docs:           build release package the docs\n  release-package-*:              build release package for the given platform, configuration and target (this is executed in XCode Cloud)\n  release-create-xcframework_[xcode-version] [platform]:  creates an xcframework from the framework build by the previous step\n  release-package:                creates the final packages\n  release-package-test-examples:  test a built examples release package\n\n  test-package-release: locally build a complete release package for all platforms\n\n  publish-github:       create a Github release for the currently checked-out tag\n  publish-docs:         publish a built docs release to the website\n  publish-cocoapods [tag]: publish the requested tag to CocoaPods\n  prepare-publish-changelog: creates a changelog file to be used in Slack\n\nargument:\n  version: version in the x.y.z format\n  platform: exactly one of \"osx ios watchos tvos visionos\"\n  platforms: one or more of \"osx ios watchos tvos visionos\"\n\nenvironment variables:\n  XCMODE: xcodebuild (default), xctool\n  CONFIGURATION: Debug, Release (default), or Static\n  LINKAGE: Static\n  REALM_CORE_VERSION: version in x.y.z format or \"current\" to use local build\n  REALM_EXTRA_BUILD_ARGUMENTS: additional arguments to pass to the build tool\n  REALM_XCODE_VERSION: the version number of Xcode to use (e.g.: 13.3.1)\n  REALM_XCODE_OLDEST_VERSION: the version number of oldest available Xcode to use (e.g.: 12.4)\n  REALM_XCODE_LATEST_VERSION: the version number of latest available Xcode to use (e.g.: 13.3.1)\nEOF\n}\n\n######################################\n# Xcode Helpers\n######################################\n\nxcode_version_major() {\n    echo \"${REALM_XCODE_VERSION%%.*}\"\n}\n\nxcode() {\n    mkdir -p build/DerivedData\n    CMD=\"xcodebuild -IDECustomDerivedDataLocation=build/DerivedData\"\n    echo \"Building with command: $CMD $*\"\n    xcodebuild -IDECustomDerivedDataLocation=build/DerivedData \"$@\"\n}\n\nxc() {\n    # Logs xcodebuild output in realtime\n    : \"${NSUnbufferedIO:=YES}\"\n    xcode \"$@\" ${REALM_EXTRA_BUILD_ARGUMENTS[@]}\n}\n\nxctest() {\n    local scheme=\"$1\"\n    xc -scheme \"$scheme\" \"${@:2}\" build-for-testing\n    xc -scheme \"$scheme\" \"${@:2}\" test-without-building\n}\n\nbuild_combined() {\n    local product=\"$1\"\n    local platform=\"$2\"\n    local config=\"$CONFIGURATION\"\n\n    local config_suffix simulator_suffix destination build_args\n    case \"$platform\" in\n        osx)\n            destination='generic/platform=macOS'\n            config_suffix=\n            ;;\n        ios)\n            destination='generic/platform=iOS'\n            config_suffix=-iphoneos\n            simulator_suffix=iphonesimulator\n            ;;\n        watchos)\n            destination='generic/platform=watchOS'\n            config_suffix=-watchos\n            simulator_suffix=watchsimulator\n            ;;\n        tvos)\n            destination='generic/platform=tvOS'\n            config_suffix=-appletvos\n            simulator_suffix=appletvsimulator\n            ;;\n        visionos)\n            destination='generic/platform=visionOS'\n            config_suffix=-xros\n            simulator_suffix=xrsimulator\n            ;;\n        catalyst)\n            destination='generic/platform=macOS,variant=Mac Catalyst'\n            config_suffix=-maccatalyst\n            ;;\n    esac\n\n    build_args=(-scheme \"$product\" -configuration \"$config\" build REALM_HIDE_SYMBOLS=YES)\n\n    # Derive build paths\n    local build_products_path=\"$DERIVED_DATA/Realm/Build/Products\"\n    local product_name=\"$product.framework\"\n    local os_path=\"$build_products_path/$config${config_suffix}/$product_name\"\n    local simulator_path=\"$build_products_path/$config-$simulator_suffix/$product_name\"\n    local out_path=\"build/$config/$platform\"\n    local xcframework_path=\"$out_path/$product.xcframework\"\n\n    # Build for each platform\n    xc -destination \"$destination\" \"${build_args[@]}\"\n    simulator_framework=()\n    if [[ -n \"$simulator_suffix\" ]]; then\n        xc -destination \"$destination Simulator\" \"${build_args[@]}\"\n        simulator_framework+=(-framework \"$simulator_path\")\n    fi\n\n    # Create the xcframework\n    rm -rf \"$xcframework_path\"\n    xcodebuild -create-xcframework -allow-internal-distribution -output \"$xcframework_path\" \\\n        -framework \"$os_path\" \"${simulator_framework[@]}\"\n}\n\ncreate_xcframework() {\n    local product=\"$1\"\n    local config=\"$2\"\n\n    local out_path=\"$ROOT_WORKSPACE/$config/$product.xcframework\"\n    find \"$ROOT_WORKSPACE\"/build-*/\"$config\" -name \"$product.framework\" \\\n        | sed 's/.*/-framework &/' \\\n        | xargs xcodebuild -create-xcframework -allow-internal-distribution -output \"$out_path\"\n    codesign --timestamp -s \"$SIGNING_IDENTITY\" \"$out_path\"\n}\n\n# Artifacts are zipped by the artifacts store so they're endup nested zipped, so we need to unzip this zip.\nunzip_artifact() {\n    initial_path=\"$1\"\n    file_name=${initial_path%.*}\n\n    unzip \"$file_name.zip\" -d \"$file_name\"\n    rm \"$file_name.zip\"\n\n    mv \"$file_name/$file_name.zip\" \"$file_name.zip\"\n    rm -rf \"$file_name\"\n}\n\nclean_retrieve() {\n    mkdir -p \"$2\"\n    rm -rf \"$2/$3\"\n    cp -R \"$1\" \"$2\"\n}\n\nplist_get() {\n    /usr/libexec/PlistBuddy -c \"Print :$2\" \"$1\" 2> /dev/null\n}\n\niphone_name() {\n    if (( $(xcode_version_major) < 16 )); then\n        echo 'iPhone 15'\n    elif (( $(xcode_version_major) < 26 )); then\n        echo 'iPhone 16'\n    else\n        echo 'iPhone 17'\n    fi\n}\n\n######################################\n# Device Test Helper\n######################################\n\ntest_devices() {\n    local serial_numbers=()\n    local awk_script=\"\n    /^ +Vendor ID: / { is_apple = 0; }\n    /^ +Vendor ID: 0x05[aA][cC] / { is_apple = 1; }\n    /^ +Serial Number: / {\n        if (is_apple) {\n            match(\\$0, /^ +Serial Number: /);\n            print substr(\\$0, RLENGTH + 1);\n        }\n    }\n    \"\n    local serial_numbers_text=$(/usr/sbin/system_profiler SPUSBDataType | /usr/bin/awk \"$awk_script\")\n    while read -r number; do\n        if [[ \"$number\" != \"\" ]]; then\n            serial_numbers+=(\"$number\")\n        fi\n    done <<< \"$serial_numbers_text\"\n    if [[ ${#serial_numbers[@]} == 0 ]]; then\n        echo \"At least one iOS/tvOS device must be connected to this computer to run device tests\"\n        if [ -z \"${JENKINS_HOME}\" ]; then\n            # Don't fail if running locally and there's no device\n            exit 0\n        fi\n        exit 1\n    fi\n    local sdk=\"$1\"\n    local scheme=\"$2\"\n    local configuration=\"$3\"\n    local failed=0\n    for device in \"${serial_numbers[@]}\"; do\n        xc -scheme \"$scheme\" -configuration \"$configuration\" -destination \"id=$device\" -sdk \"$sdk\" test || failed=1\n    done\n    return $failed\n}\n\n######################################\n# Docs\n######################################\n\nbuild_docs() {\n    local language=\"$1\"\n    local version=$(sh build.sh get-version)\n\n    local xcodebuild_arguments=\"--objc,Realm/Realm.h,--,-x,objective-c,-isysroot,$(xcrun --show-sdk-path),-I,$(pwd)\"\n    local module=\"Realm\"\n    local objc=\"--objc\"\n\n    if [[ \"$language\" == \"swift\" ]]; then\n        xcodebuild_arguments=\"-scheme,RealmSwift\"\n        module=\"RealmSwift\"\n        objc=\"\"\n    fi\n\n    jazzy \\\n      \"${objc}\" \\\n      --clean \\\n      --author Realm \\\n      --author_url https://docs.mongodb.com/realm-sdks \\\n      --github_url https://github.com/realm/realm-swift \\\n      --github-file-prefix \"https://github.com/realm/realm-swift/tree/v${version}\" \\\n      --module-version \"${version}\" \\\n      --xcodebuild-arguments \"${xcodebuild_arguments}\" \\\n      --module \"${module}\" \\\n      --root-url \"https://docs.mongodb.com/realm-sdks/${language}/${version}/\" \\\n      --output \"docs/${language}_output\" \\\n      --head \"$(cat docs/custom_head.html)\" \\\n      --exclude 'RealmSwift/Impl/*'\n}\n\n######################################\n# Input Validation\n######################################\n\nif [ \"$#\" -eq 0 ] || [ \"$#\" -gt 3 ]; then\n    usage\n    exit 1\nfi\n\n######################################\n# Variables\n######################################\n\nCOMMAND=\"$1\"\nLINKAGE=\"dynamic\"\n\n# Use Debug config if command ends with -debug, otherwise default to Release\ncase \"$COMMAND\" in\n    *-debug)\n        COMMAND=\"${COMMAND%-debug}\"\n        CONFIGURATION=\"Debug\"\n        ;;\n    *-static)\n        COMMAND=\"${COMMAND%-static}\"\n        LINKAGE=\"static\"\n        CONFIGURATION=\"Static\"\n        ;;\nesac\nexport CONFIGURATION=${CONFIGURATION:-Release}\n\n# Pre-choose Xcode version for those operations that do not override it\nREALM_XCODE_VERSION=${xcode_version:-$REALM_XCODE_VERSION}\nsource \"${source_root}/scripts/swift-version.sh\"\nset_xcode_version\n\n######################################\n# Commands\n######################################\n\ncase \"$COMMAND\" in\n\n    ######################################\n    # Clean\n    ######################################\n    \"clean\")\n        find . -type d -name build -exec rm -r \"{}\" +\n        exit 0\n        ;;\n\n    ######################################\n    # Dependencies\n    ######################################\n    \"download-core\")\n        sh scripts/download-core.sh\n        exit 0\n        ;;\n\n    ######################################\n    # Building\n    ######################################\n    \"build\")\n        sh build.sh xcframework\n        exit 0\n        ;;\n\n    \"ios\")\n        build_combined Realm ios\n        exit 0\n        ;;\n\n    \"ios-swift\")\n        build_combined Realm ios\n        build_combined RealmSwift ios\n        exit 0\n        ;;\n\n    \"watchos\")\n        build_combined Realm watchos\n        exit 0\n        ;;\n\n    \"watchos-swift\")\n        build_combined Realm watchos\n        build_combined RealmSwift watchos\n        exit 0\n        ;;\n\n    \"tvos\")\n        build_combined Realm tvos\n        exit 0\n        ;;\n\n    \"tvos-swift\")\n        build_combined Realm tvos\n        build_combined RealmSwift tvos\n        exit 0\n        ;;\n\n    \"osx\")\n        build_combined Realm osx\n        exit 0\n        ;;\n\n    \"osx-swift\")\n        build_combined Realm osx\n        build_combined RealmSwift osx\n        exit 0\n        ;;\n\n    \"catalyst\")\n        build_combined Realm catalyst\n        ;;\n\n    \"catalyst-swift\")\n        build_combined Realm catalyst\n        build_combined RealmSwift catalyst\n        ;;\n\n    \"visionos\")\n        build_combined Realm visionos\n        ;;\n\n    \"visionos-swift\")\n        build_combined Realm visionos\n        build_combined RealmSwift visionos\n        ;;\n\n    \"xcframework\")\n        # Build all of the requested frameworks\n        shift\n        PLATFORMS=\"${*:-osx ios watchos tvos catalyst visionos}\"\n        for platform in $PLATFORMS; do\n            sh build.sh \"$platform-swift\"\n        done\n\n        # Assemble them into xcframeworks\n        rm -rf \"$DERIVED_DATA/Realm/Build/Products\"*.xcframework\n        find \"$DERIVED_DATA/Realm/Build/Products\" -name 'Realm.framework' \\\n            | sed 's/.*/-framework &/' \\\n            | xargs xcodebuild -create-xcframework -allow-internal-distribution -output \"build/$CONFIGURATION/Realm.xcframework\"\n        find \"$DERIVED_DATA/Realm/Build/Products\" -name 'RealmSwift.framework' \\\n            | sed 's/.*/-framework &/' \\\n            | xargs xcodebuild -create-xcframework -allow-internal-distribution -output \"build/$CONFIGURATION/RealmSwift.xcframework\"\n\n        # Because we have a module named Realm and a type named Realm we need to manually resolve the naming\n        # collisions that are happening. These collisions create a red herring which tells the user the xcframework\n        # was compiled with an older Swift version and is not compatible with the current compiler.\n        find \"build/$CONFIGURATION/RealmSwift.xcframework\" -name \"*.swiftinterface\" \\\n            -exec sed -i '' 's/Realm\\.//g' {} \\; \\\n            -exec sed -i '' 's/import Private/import Realm.Private\\nimport Realm.Swift/g' {} \\; \\\n            -exec sed -i '' 's/RealmSwift.Configuration/RealmSwift.Realm.Configuration/g' {} \\; \\\n            -exec sed -i '' 's/extension Configuration/extension Realm.Configuration/g' {} \\; \\\n            -exec sed -i '' 's/RealmSwift.Error[[:>:]]/RealmSwift.Realm.Error/g' {} \\; \\\n            -exec sed -i '' 's/extension Error/extension Realm.Error/g' {} \\; \\\n            -exec sed -i '' 's/RealmSwift.AsyncOpenTask/RealmSwift.Realm.AsyncOpenTask/g' {} \\; \\\n            -exec sed -i '' 's/RealmSwift.UpdatePolicy/RealmSwift.Realm.UpdatePolicy/g' {} \\; \\\n            -exec sed -i '' 's/RealmSwift.Notification[[:>:]]/RealmSwift.Realm.Notification/g' {} \\; \\\n            -exec sed -i '' 's/τ_1_0/V/g' {} \\; # Generics will use τ_1_0 which needs to be changed to the correct type name.\n\n        exit 0\n        ;;\n\n    ######################################\n    # Analysis\n    ######################################\n\n    \"analyze-osx\")\n        xc -scheme Realm -configuration \"$CONFIGURATION\" analyze\n        exit 0\n        ;;\n\n    ######################################\n    # Testing\n    ######################################\n    \"test\")\n        set +e # Run both sets of tests even if the first fails\n        failed=0\n        sh build.sh test-ios || failed=1\n        sh build.sh test-ios-swift || failed=1\n        sh build.sh test-ios-devices || failed=1\n        sh build.sh test-tvos-devices || failed=1\n        sh build.sh test-osx || failed=1\n        sh build.sh test-osx-swift || failed=1\n        sh build.sh test-catalyst || failed=1\n        sh build.sh test-catalyst-swift || failed=1\n        exit $failed\n        ;;\n\n    \"test-all\")\n        set +e\n        failed=0\n        sh build.sh test || failed=1\n        sh build.sh test-debug || failed=1\n        exit $failed\n        ;;\n\n    \"test-ios\")\n        xctest Realm -configuration \"$CONFIGURATION\" -sdk iphonesimulator -destination \"name=$(iphone_name)\"\n        exit 0\n        ;;\n\n    \"test-ios-swift\")\n        xctest RealmSwift -configuration \"$CONFIGURATION\" -sdk iphonesimulator -destination \"name=$(iphone_name)\"\n        exit 0\n        ;;\n\n    \"test-ios-devices\")\n        failed=0\n        trap \"failed=1\" ERR\n        sh build.sh test-ios-devices-objc\n        sh build.sh test-ios-devices-swift\n        exit $failed\n        ;;\n\n    \"test-ios-devices-objc\")\n        test_devices iphoneos \"Realm\" \"$CONFIGURATION\"\n        exit $?\n        ;;\n\n    \"test-ios-devices-swift\")\n        test_devices iphoneos \"RealmSwift\" \"$CONFIGURATION\"\n        exit $?\n        ;;\n\n    \"test-tvos\")\n        destination=\"Apple TV\"\n        xctest Realm -configuration \"$CONFIGURATION\" -sdk appletvsimulator -destination \"name=$destination\"\n        exit $?\n        ;;\n\n    \"test-tvos-swift\")\n        destination=\"Apple TV\"\n        xctest RealmSwift -configuration \"$CONFIGURATION\" -sdk appletvsimulator -destination \"name=$destination\"\n        exit $?\n        ;;\n\n    \"test-tvos-devices\")\n        test_devices appletvos TestHost \"$CONFIGURATION\"\n        ;;\n\n    \"test-osx\")\n        xctest Realm -configuration \"$CONFIGURATION\" -destination \"platform=macOS,arch=$(uname -m)\"\n        exit 0\n        ;;\n\n    \"test-osx-swift\")\n        xctest RealmSwift -configuration \"$CONFIGURATION\" -destination \"platform=macOS,arch=$(uname -m)\"\n        exit 0\n        ;;\n\n    test-swiftpm*)\n        SANITIZER=$(echo \"$COMMAND\" | cut -d - -f 3)\n        # FIXME: throwing an exception from a property getter corrupts Swift's\n        # runtime exclusivity checking state. Unfortunately, this is something\n        # we do a lot in tests.\n        SWIFT_TEST_FLAGS=(-Xcc -g0 -Xswiftc -enforce-exclusivity=none)\n        if [ -n \"$SANITIZER\" ]; then\n            SWIFT_TEST_FLAGS+=(--sanitize \"$SANITIZER\")\n            export ASAN_OPTIONS='check_initialization_order=true:detect_stack_use_after_return=true'\n        fi\n        xcrun swift package resolve\n        xcrun swift test --configuration \"$(echo \"$CONFIGURATION\" | tr \"[:upper:]\" \"[:lower:]\")\" \"${SWIFT_TEST_FLAGS[@]}\"\n        exit 0\n        ;;\n\n    \"test-ios-swiftui\")\n        xctest 'SwiftUITestHost' -configuration \"$CONFIGURATION\" -sdk iphonesimulator -destination \"name=$(iphone_name)\"\n        exit 0\n        ;;\n\n    \"test-catalyst\")\n        xctest Realm -configuration \"$CONFIGURATION\" -destination 'platform=macOS,variant=Mac Catalyst' CODE_SIGN_IDENTITY=''\n        exit 0\n        ;;\n\n    \"test-catalyst-swift\")\n        xctest RealmSwift -configuration \"$CONFIGURATION\" -destination 'platform=macOS,variant=Mac Catalyst' CODE_SIGN_IDENTITY=''\n        exit 0\n        ;;\n\n    \"test-visionos\")\n        xctest Realm -configuration \"$CONFIGURATION\" -sdk xrsimulator -destination 'platform=visionOS Simulator,name=Apple Vision Pro' CODE_SIGN_IDENTITY=''\n        exit 0\n        ;;\n\n    \"test-visionos-swift\")\n        xctest RealmSwift -configuration \"$CONFIGURATION\" -sdk xrsimulator -destination 'platform=visionOS Simulator,name=Apple Vision Pro' CODE_SIGN_IDENTITY=''\n        exit 0\n        ;;\n\n    ######################################\n    # Full verification\n    ######################################\n    \"verify\")\n        sh build.sh verify-cocoapods\n        sh build.sh verify-docs\n        sh build.sh verify-spm-ios\n        sh build.sh verify-swiftlint\n        sh build.sh verify-swiftpm\n        sh build.sh verify-watchos\n        sh buils.sh verify-xcframework\n\n        sh build.sh verify-osx\n        sh build.sh verify-osx-debug\n        sh build.sh verify-osx-swift\n        sh build.sh verify-osx-swift-debug\n        sh build.sh verify-ios-static\n        sh build.sh verify-ios-static-debug\n        sh build.sh verify-ios-dynamic\n        sh build.sh verify-ios-dynamic-debug\n        sh build.sh verify-ios-swift\n        sh build.sh verify-ios-swift-debug\n        sh build.sh verify-ios-device-objc\n        sh build.sh verify-ios-device-swift\n        sh build.sh verify-tvos\n        sh build.sh verify-tvos-debug\n        sh build.sh verify-tvos-device\n        sh build.sh verify-catalyst\n        sh build.sh verify-catalyst-swift\n        sh build.sh verify-ios-swiftui\n        ;;\n\n    \"verify-cocoapods\")\n        export REALM_TEST_BRANCH=\"$BRANCH\"\n        if [[ -d .git ]]; then\n            # Verify the current branch, unless one was already specified in the sha environment variable.\n            if [[ -z $BRANCH ]]; then\n                export REALM_TEST_BRANCH=$(git rev-parse --abbrev-ref HEAD)\n            fi\n\n            if [[ $(git log -1 '@{push}..') != \"\" ]] || ! git diff-index --quiet HEAD; then\n                echo \"WARNING: verify-cocoapods will test the latest revision of $BRANCH found on GitHub.\"\n                echo \"         Any unpushed local changes will not be tested.\"\n                echo \"\"\n                sleep 1\n            fi\n        fi\n\n        cd examples/installation\n        ./build.rb ios cocoapods static\n        ./build.rb ios cocoapods dynamic\n        ./build.rb osx cocoapods\n        ./build.rb tvos cocoapods\n        ./build.rb watchos cocoapods\n        ./build.rb catalyst cocoapods\n        ;;\n\n    verify-cocoapods-*)\n        PLATFORM=$(echo \"$COMMAND\" | cut -d - -f 3)\n        cd examples/installation\n\n        REALM_TEST_BRANCH=\"$BRANCH\" ./build.rb \"$PLATFORM\" cocoapods \"$LINKAGE\"\n        ;;\n\n    \"verify-docs\")\n        sh build.sh docs\n        for lang in swift objc; do\n            undocumented=\"docs/${lang}_output/undocumented.json\"\n            if ruby -rjson -e \"j = JSON.parse(File.read('docs/${lang}_output/undocumented.json')); exit j['warnings'].length != 0\"; then\n                echo \"Undocumented Realm $lang declarations:\"\n                cat \"$undocumented\"\n                exit 1\n            fi\n        done\n        exit 0\n        ;;\n\n    \"verify-spm\")\n        export REALM_TEST_BRANCH=\"$BRANCH\"\n        if [[ -d .git ]]; then\n            # Verify the current branch, unless one was already specified in the sha environment variable.\n            if [[ -z $BRANCH ]]; then\n                export REALM_TEST_BRANCH=$(git rev-parse --abbrev-ref HEAD)\n            fi\n\n            if [[ $(git log -1 '@{push}..') != \"\" ]] || ! git diff-index --quiet HEAD; then\n                echo \"WARNING: verify-spm will test the latest revision of $BRANCH found on GitHub.\"\n                echo \"         Any unpushed local changes will not be tested.\"\n                echo \"\"\n                sleep 1\n            fi\n        fi\n\n        cd examples/installation\n        ./build.rb ios spm static\n        ./build.rb ios spm dynamic\n        ./build.rb osx spm\n        ./build.rb watchos spm\n        ./build.rb tvos spm\n        ./build.rb catalyst spm\n        exit 0\n        ;;\n\n    verify-spm-*)\n        PLATFORM=$(echo \"$COMMAND\" | cut -d - -f 3)\n        cd examples/installation\n\n        REALM_TEST_BRANCH=\"$BRANCH\" ./build.rb \"$PLATFORM\" spm \"$LINKAGE\"\n        exit 0\n        ;;\n\n    \"verify-swiftlint\")\n        swiftlint lint --strict\n        exit 0\n        ;;\n\n    verify-swiftpm*)\n        sh build.sh \"test-$(echo \"$COMMAND\" | cut -d - -f 2-)\"\n        exit 0\n        ;;\n\n    \"verify-watchos\")\n        sh build.sh watchos-swift\n        exit 0\n        ;;\n\n    \"verify-xcframework\")\n        sh build.sh xcframework osx\n        exit 0\n        ;;\n\n    \"verify-osx-encryption\")\n        REALM_ENCRYPT_ALL=YES sh build.sh test-osx\n        exit 0\n        ;;\n\n    \"verify-osx\")\n        REALM_EXTRA_BUILD_ARGUMENTS=\"$REALM_EXTRA_BUILD_ARGUMENTS -workspace examples/osx/objc/RealmExamples.xcworkspace\" \\\n            sh build.sh test-osx\n        sh build.sh examples-osx\n\n        (\n            cd examples/osx/objc/build/DerivedData/RealmExamples/Build/Products/Release\n            DYLD_FRAMEWORK_PATH=. ./JSONImport >/dev/null\n        )\n        exit 0\n        ;;\n\n    \"verify-osx-swift-evolution\")\n        export REALM_EXTRA_BUILD_ARGUMENTS=\"$REALM_EXTRA_BUILD_ARGUMENTS REALM_BUILD_LIBRARY_FOR_DISTRIBUTION=YES\"\n        sh build.sh test-osx-swift\n        exit 0\n        ;;\n\n    \"verify-ios\")\n        REALM_EXTRA_BUILD_ARGUMENTS=\"$REALM_EXTRA_BUILD_ARGUMENTS -workspace examples/ios/objc/RealmExamples.xcworkspace\" \\\n            sh build.sh test-ios\n        sh build.sh examples-ios\n        ;;\n\n    \"verify-ios-swift\")\n        REALM_EXTRA_BUILD_ARGUMENTS=\"$REALM_EXTRA_BUILD_ARGUMENTS -workspace examples/ios/swift/RealmExamples.xcworkspace\" \\\n            sh build.sh test-ios-swift\n        sh build.sh examples-ios-swift\n        ;;\n\n    \"verify-ios-swift-evolution\")\n        export REALM_EXTRA_BUILD_ARGUMENTS=\"$REALM_EXTRA_BUILD_ARGUMENTS REALM_BUILD_LIBRARY_FOR_DISTRIBUTION=YES\"\n        sh build.sh test-ios-swift\n        exit 0\n        ;;\n\n    \"verify-tvos\")\n        REALM_EXTRA_BUILD_ARGUMENTS=\"$REALM_EXTRA_BUILD_ARGUMENTS -workspace examples/tvos/objc/RealmExamples.xcworkspace\" \\\n            sh build.sh test-tvos\n        sh build.sh examples-tvos\n        exit 0\n        ;;\n\n    \"verify-tvos-swift\")\n        REALM_EXTRA_BUILD_ARGUMENTS=\"$REALM_EXTRA_BUILD_ARGUMENTS -workspace examples/tvos/swift/RealmExamples.xcworkspace\" \\\n            sh build.sh test-tvos-swift\n        sh build.sh examples-tvos-swift\n        exit 0\n        ;;\n\n    \"verify-tvos-swift-evolution\")\n        export REALM_EXTRA_BUILD_ARGUMENTS=\"$REALM_EXTRA_BUILD_ARGUMENTS REALM_BUILD_LIBRARY_FOR_DISTRIBUTION=YES\"\n        sh build.sh test-tvos-swift\n        exit 0\n        ;;\n\n    \"verify-xcframework-evolution-mode\")\n        export REALM_EXTRA_BUILD_ARGUMENTS=\"$REALM_EXTRA_BUILD_ARGUMENTS REALM_BUILD_LIBRARY_FOR_DISTRIBUTION=YES\"\n        unset REALM_SWIFT_VERSION\n\n        # Build with the oldest supported Xcode version\n        REALM_XCODE_VERSION=$REALM_XCODE_OLDEST_VERSION sh build.sh xcframework osx\n\n        # Try to import the built framework using the newest supported version\n        cd examples/installation\n        REALM_XCODE_VERSION=$REALM_XCODE_LATEST_VERSION ./build.rb osx xcframework\n\n        exit 0\n        ;;\n\n    verify-*)\n        sh build.sh \"test-$(echo \"$COMMAND\" | cut -d - -f 2-)\"\n        exit 0\n        ;;\n\n    ######################################\n    # Docs\n    ######################################\n    \"docs\")\n        build_docs objc\n        build_docs swift\n        exit 0\n        ;;\n\n    ######################################\n    # Examples\n    ######################################\n    \"examples\")\n        sh build.sh clean\n        sh build.sh examples-ios\n        sh build.sh examples-ios-swift\n        sh build.sh examples-osx\n        sh build.sh examples-tvos\n        sh build.sh examples-tvos-swift\n        exit 0\n        ;;\n\n    \"examples-ios\")\n        workspace=\"examples/ios/objc/RealmExamples.xcworkspace\"\n\n        examples=\"Simple TableView Migration Backlink GroupedTableView Encryption\"\n        versions=\"0 1 2 3 4 5\"\n        for example in $examples; do\n            if [ \"$example\" = \"Migration\" ]; then\n                # The migration example needs to be built for each schema version to ensure each compiles.\n                for version in $versions; do\n                    xc -workspace \"$workspace\" -scheme \"$example\" -configuration \"$CONFIGURATION\" -sdk iphonesimulator \"${CODESIGN_PARAMS[@]}\" GCC_PREPROCESSOR_DEFINITIONS=\"\\$(GCC_PREPROCESSOR_DEFINITIONS) SCHEMA_VERSION_$version\"\n                done\n            else\n                xc -workspace \"$workspace\" -scheme \"$example\" -configuration \"$CONFIGURATION\" -sdk iphonesimulator \"${CODESIGN_PARAMS[@]}\"\n            fi\n        done\n        if [ -n \"$CI\" ]; then\n            xc -workspace \"$workspace\" -scheme Extension -configuration \"$CONFIGURATION\" -sdk iphonesimulator \"${CODESIGN_PARAMS[@]}\"\n        fi\n\n        exit 0\n        ;;\n\n    \"examples-ios-swift\")\n        workspace=\"examples/ios/swift/RealmExamples.xcworkspace\"\n        if [[ ! -d \"$workspace\" ]]; then\n            workspace=\"${workspace/swift/swift-$REALM_XCODE_VERSION}\"\n        fi\n\n        examples=\"Simple TableView Migration Backlink GroupedTableView Encryption AppClip AppClipParent\"\n        versions=\"0 1 2 3 4 5\"\n        for example in $examples; do\n            if [ \"$example\" = \"Migration\" ]; then\n                # The migration example needs to be built for each schema version to ensure each compiles.\n                for version in $versions; do\n                    xc -workspace \"$workspace\" -scheme \"$example\" -configuration \"$CONFIGURATION\" -sdk iphonesimulator \"${CODESIGN_PARAMS[@]}\" OTHER_SWIFT_FLAGS=\"\\$(OTHER_SWIFT_FLAGS) -DSCHEMA_VERSION_$version\"\n                done\n            else\n                xc -workspace \"$workspace\" -scheme \"$example\" -configuration \"$CONFIGURATION\" -sdk iphonesimulator \"${CODESIGN_PARAMS[@]}\"\n            fi\n        done\n\n        exit 0\n        ;;\n\n    \"examples-osx\")\n        workspace=\"examples/osx/objc/RealmExamples.xcworkspace\"\n\n        xc -workspace \"$workspace\" \\\n           -scheme JSONImport -configuration \"${CONFIGURATION}\" \\\n           -destination \"platform=macOS,arch=$(uname -m)\" \\\n           build \"${CODESIGN_PARAMS[@]}\"\n        ;;\n\n    \"examples-tvos\")\n        workspace=\"examples/tvos/objc/RealmExamples.xcworkspace\"\n\n        examples=\"DownloadCache PreloadedData\"\n        for example in $examples; do\n            xc -workspace \"$workspace\" -scheme \"$example\" -configuration \"$CONFIGURATION\" -sdk appletvsimulator \"${CODESIGN_PARAMS[@]}\"\n        done\n\n        exit 0\n        ;;\n\n    \"examples-tvos-swift\")\n        workspace=\"examples/tvos/swift/RealmExamples.xcworkspace\"\n        if [[ ! -d \"$workspace\" ]]; then\n            workspace=\"${workspace/swift/swift-$REALM_XCODE_VERSION}\"\n        fi\n\n        examples=\"DownloadCache PreloadedData\"\n        for example in $examples; do\n            xc -workspace \"$workspace\" -scheme \"$example\" -configuration \"$CONFIGURATION\" -sdk appletvsimulator \"${CODESIGN_PARAMS[@]}\"\n        done\n\n        exit 0\n        ;;\n\n    ######################################\n    # Versioning\n    ######################################\n    \"get-version\")\n        plist_get 'Realm/Realm-Info.plist' 'CFBundleShortVersionString'\n        exit 0\n        ;;\n\n    \"set-version\")\n        realm_version=\"$2\"\n        version_files=\"Realm/Realm-Info.plist\"\n\n        if [ -z \"$realm_version\" ]; then\n            echo \"You must specify a version.\"\n            exit 1\n        fi\n        # The bundle version can contain only three groups of digits separated by periods,\n        # so strip off any -beta.x tag from the end of the version string.\n        bundle_version=$(echo \"$realm_version\" | cut -d - -f 1)\n        for version_file in $version_files; do\n            PlistBuddy -c \"Set :CFBundleVersion $bundle_version\" \"$version_file\"\n            PlistBuddy -c \"Set :CFBundleShortVersionString $realm_version\" \"$version_file\"\n        done\n        sed -i '' \"s/^VERSION=.*/VERSION=$realm_version/\" dependencies.list\n        sed -i '' \"s/^let cocoaVersion =.*/let cocoaVersion = Version(\\\"$realm_version\\\")/\" Package.swift\n        sed -i '' \"s/x.y.z Release notes (yyyy-MM-dd)/$realm_version Release notes ($(date '+%Y-%m-%d'))/\" CHANGELOG.md\n\n        exit 0\n        ;;\n\n    \"set-core-version\")\n        new_version=\"$2\"\n        old_version=\"$(sed -n 's/^REALM_CORE_VERSION=\\(.*\\)$/\\1/p' \"${source_root}/dependencies.list\")\"\n\n        sed -i '' \"s/^REALM_CORE_VERSION=.*/REALM_CORE_VERSION=v$new_version/\" dependencies.list\n        sed -i '' \"s/^let coreVersion =.*/let coreVersion = Version(\\\"$new_version\\\")/\" Package.swift\n        sed -i '' \"s/Upgraded realm-core from ? to ?/Upgraded realm-core from $old_version to $new_version/\" CHANGELOG.md\n\n        exit 0\n        ;;\n\n    ######################################\n    # Continuous Integration PR\n    ######################################\n\n    \"ci-pr\")\n        echo \"Building with Xcode Version $(xcodebuild -version)\"\n        export REALM_EXTRA_BUILD_ARGUMENTS='GCC_GENERATE_DEBUGGING_SYMBOLS=NO -allowProvisioningUpdates'\n        target=\"$2\"\n        sh build.sh install-xcode-platform \"$target\"\n        sh build.sh \"verify-$target\"\n        ;;\n\n    \"install-xcode-platform\")\n        target=\"$2\"\n        # If there are already simulators installed on the GHA VM we happen to\n        # run on, downloadPlatform sometimes fails due to it being in the middle\n        # of updating caches and timing out. Calling simctl list first waits for\n        # this to happen. If there are no simulators already installed, simctl\n        # also won't be installed yet.\n        xcrun simctl list > /dev/null || true\n        case \"$target\" in\n            ios*) xcodebuild -downloadPlatform iOS ;;\n            tvos*) xcodebuild -downloadPlatform tvOS ;;\n            visionos*) xcodebuild -downloadPlatform visionOS ;;\n            watchos*) xcodebuild -downloadPlatform watchOS ;;\n        esac\n        ;;\n\n    ######################################\n    # Release packaging\n    ######################################\n\n    \"release-package-examples\")\n        ./scripts/package_examples.rb\n        zip --symlinks -r realm-examples.zip examples -x \"examples/installation/*\"\n        ;;\n\n    \"release-package-docs\")\n        sh build.sh docs\n        zip -r docs/realm-docs.zip docs/objc_output docs/swift_output\n        ;;\n\n    \"release-package\")\n        version=\"$(sed -n 's/^VERSION=\\(.*\\)$/\\1/p' \"${source_root}/dependencies.list\")\"\n        find . -regex './build-[a-z]*-[12].*' -maxdepth 1 \\\n            | sed 's@./build-[a-z]*-\\(.*\\)-.*@\\1@' \\\n            | sort -u --version-sort \\\n            | xargs ./scripts/create-release-package.rb \"${ROOT_WORKSPACE}/pkg\" \"${version}\"\n        ;;\n\n    \"release-test-examples\")\n        VERSION=\"$(sed -n 's/^VERSION=\\(.*\\)$/\\1/p' \"${source_root}/dependencies.list\")\"\n        filename=\"realm-swift-${VERSION}\"\n        unzip \"${filename}\"\n\n        cp \"$0\" \"${filename}\"\n        cp -r \"${source_root}/scripts\" \"${filename}\"\n        cp \"dependencies.list\" \"${filename}\"\n\n        cd \"${filename}\"\n        sh build.sh examples-ios\n        sh build.sh examples-tvos\n        sh build.sh examples-osx\n        sh build.sh examples-ios-swift\n        sh build.sh examples-tvos-swift\n        cd ..\n        rm -rf \"${filename}\"\n\n        exit 0\n        ;;\n\n    \"install-apple-certificates\")\n        # create variables\n        CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12\n        KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db\n\n        # import certificate and provisioning profile from secrets\n        echo \"$DEVELOPMENT_CERTIFICATE_BASE64\" | base64 --decode -o $CERTIFICATE_PATH\n\n        # create temporary keychain\n        security create-keychain -p \"$KEYCHAIN_PASSWORD\" $KEYCHAIN_PATH\n        security set-keychain-settings -lut 21600 $KEYCHAIN_PATH\n        security unlock-keychain -p \"$KEYCHAIN_PASSWORD\" $KEYCHAIN_PATH\n\n        # import certificate to keychain\n        security import $CERTIFICATE_PATH -P \"$P12_PASSWORD\" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH\n        security set-key-partition-list -S apple-tool:,apple: -k \"$KEYCHAIN_PASSWORD\" $KEYCHAIN_PATH\n        security list-keychain -d user -s $KEYCHAIN_PATH\n\n        exit 0\n        ;;\n\n    ######################################\n    # Release tests\n    ######################################\n\n    \"test-package-examples\")\n        VERSION=\"$(sed -n 's/^VERSION=\\(.*\\)$/\\1/p' \"${source_root}/dependencies.list\")\"\n        dir=\"realm-swift-${VERSION}\"\n\n        # Unzip it\n        unzip \"${dir}.zip\"\n\n        # Copy the build.sh file into the downloaded directory\n        cp \"$0\" \"${dir}\"\n\n        # Copy the scripts into the downloaded directory\n        cp -r \"${ROOT_WORKSPACE}/scripts\" \"${dir}\"\n\n        # Copy dependencies.list\n        cp -r \"${ROOT_WORKSPACE}/dependencies.list\" \"${dir}\"\n\n        cd \"${dir}\"\n        # Test Examples\n        sh build.sh examples-ios\n        sh build.sh examples-tvos\n        sh build.sh examples-osx\n        sh build.sh examples-ios-swift\n        sh build.sh examples-tvos-swift\n        ;;\n\n    ######################################\n    # Publish\n    ######################################\n\n    \"publish-github\")\n        sha=\"$2\"\n        VERSION=\"$(sed -n 's/^VERSION=\\(.*\\)$/\\1/p' \"${source_root}/dependencies.list\")\"\n\n        ./scripts/github_release.rb download-artifacts release-package \"${sha}\"\n\n        unzip release-package.zip -d release-package\n\n        ./scripts/github_release.rb create-release \"$VERSION\"\n        exit 0\n        ;;\n\n    \"publish-docs\")\n        sha=\"$2\"\n\n        ./scripts/github_release.rb download-artifacts realm-docs \"${sha}\"\n        unzip_artifact realm-docs.zip\n        unzip realm-docs.zip\n\n        VERSION=\"$(sed -n 's/^VERSION=\\(.*\\)$/\\1/p' \"${source_root}/dependencies.list\")\"\n        PRERELEASE_REGEX='alpha|beta|rc|preview'\n        if [[ $VERSION =~ $PRERELEASE_REGEX ]]; then\n          echo \"Pre-release version\"\n          exit 0\n        fi\n\n        s3cmd put --no-mime-magic --guess-mime-type --recursive --acl-public docs/swift_output/ s3://realm-sdks/docs/realm-sdks/swift/${VERSION}/\n        s3cmd put --no-mime-magic --guess-mime-type --recursive --acl-public docs/swift_output/ s3://realm-sdks/docs/realm-sdks/swift/latest/\n\n        s3cmd put --no-mime-magic --guess-mime-type --recursive --acl-public docs/objc_output/ s3://realm-sdks/docs/realm-sdks/objc/${VERSION}/\n        s3cmd put --no-mime-magic --guess-mime-type --recursive --acl-public docs/objc_output/ s3://realm-sdks/docs/realm-sdks/objc/latest/\n        ;;\n\n    \"publish-cocoapods\")\n        cd \"${ROOT_WORKSPACE}\"\n        pod trunk push Realm.podspec --verbose --allow-warnings\n        pod trunk push RealmSwift.podspec --verbose --allow-warnings --synchronous\n        exit 0\n        ;;\n\n    \"prepare-publish-changelog\")\n        VERSION=\"$(sed -n 's/^VERSION=\\(.*\\)$/\\1/p' \"${source_root}/dependencies.list\")\"\n        ./scripts/github_release.rb package-release-notes \"$VERSION\"\n        exit 0\n        ;;\n\n    \"add-empty-changelog\")\n        empty_section=$(cat <<EOS\nx.y.z Release notes (yyyy-MM-dd)\n=============================================================\n### Enhancements\n* None.\n\n### Fixed\n* <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-swift/issues/????), since v?.?.?)\n* None.\n\n<!-- ### Breaking Changes - ONLY INCLUDE FOR NEW MAJOR version -->\n\n### Compatibility\n* Carthage release for Swift is built with Xcode 26.3.\n* CocoaPods: 1.10 or later.\n* Xcode: 26.1-26.4 beta 1\n\n### Internal\n* Upgraded realm-core from ? to ?\n\nEOS)\n        changelog=$(cat CHANGELOG.md)\n        echo \"$empty_section\" > CHANGELOG.md\n        echo >> CHANGELOG.md\n        echo \"$changelog\" >> CHANGELOG.md\n        ;;\n\n    *)\n        echo \"Unknown command '$COMMAND'\"\n        usage\n        exit 1\n        ;;\nesac\n"
  },
  {
    "path": "contrib/Development.md",
    "content": "# Developing Realm\n\n## Building Realm\n\nThere are three ways to build Realm\n1. \\[Recommended] Using Xcode, open Package.swift. With this approach you can build either against a released Core version or a custom branch.\n1. Using Xcode, open Realm.xcodeproj. This will download the version of Core specified in `dependencies.list/REALM_CORE_VERSION` and build the Swift SDK against it.\n1. From the command line, run `./build.sh build`. Similarly to 2., this also downloads Core and builds against it.\n\n### Building against a custom branch of Core\n\nTo build Realm against a custom Core branch, update `Package.swift` by updating the Realm Core dependency from `exact` to `branch`:\n\n```diff\n    dependencies: [\n-        .package(url: \"https://github.com/realm/realm-core.git\", exact: coreVersion)\n+        .package(url: \"https://github.com/realm/realm-core.git\", branch: \"*your-custom-branch*\")\n    ],\n\n"
  },
  {
    "path": "contrib/ReleaseProcess.md",
    "content": "## Releasing from master\n\nFollow these steps to release a new version of the Realm Swift SDK.\n\n1. Open Github actions [Prepare-release](https://github.com/realm/realm-swift/actions/workflows/master-push.yml) page and cancel any workflow runs. This is not mandatory.\n2. Update the version number and set the release date in the changelog: `sh build.sh set-version X.Y.Z`\n3. Take another look over `CHANGELOG.md` to make sure it looks sensible. Delete any remaining placeholders for things which didn't happen in this release (e.g. the breaking changes section).\n4. Commit and push to `master`. This automatically kicks off a build that current takes around 1 hours.\n5. Once the [Prepare-release](https://github.com/realm/realm-swift/actions/workflows/master-push.yml) job completes, run the [Publish-release](https://github.com/realm/realm-swift/actions/workflows/publish-release.yml) workflow manually to publish the release. This tags the version, creates a release on github, pushes to CocoaPods, and updates the website, and then runs another set of tests to validate that the published release can be installed. This process takes 1-2 hours.\n\n## Releasing alpha/beta/preview/rc version from other branches\n\nFollow these steps when we have long-lived branches that we are making alpha/beta releases from.\n\n1. Update the version number and set the release date in the changelog: `sh build.sh set-version X.Y.Z-preview`. Note that the presence of `alpha`, `beta`, `preview` or `rc` in the version number is semantically significant and makes the release job not mark the version as the latest release on the web site.\n2. Take another look over `CHANGELOG.md` to make sure it looks sensible. Delete any remaining placeholders for things which didn't happen in this release (e.g. the breaking changes section).\n3. Commit and push to the branch.\n4. Run the [Prepare-release](https://github.com/realm/realm-swift/actions/workflows/master-push.yml) workflow manually using the desired branch (it only automatically runs for pushes to `master`).\n5. Run the [Publish-release](https://github.com/realm/realm-swift/actions/workflows/publish-release.yml) job to publish the release, selecting the desired branch. This tags the version, creates a release on github, pushes to CocoaPods, and updates the website, and then runs another set of tests to validate that the published release can be installed. This process takes 1-2 hours.\n\n## Releasing a backported fix\n\nFollow these steps when there are changes in `master` that shouldn't be included in the release.\n\n1. Check out the base release which is being hotfixed (e.g. `git checkout v0.96.0`).\n2. Run `sh build.sh add-empty-changelog`and  commit the result.\n3. Cherry-pick the commit(s) you want to include in the release.\n4. Move the changelog entries from the cherry-picked commit(s) to the section for the version being released (they are likely to end up in the wrong place from the automatic merge).\n5. Set version: `sh build.sh set-version X.Y.Z`\n6. Push to a new branch of the format `release/0.96.1` or similar.\n7. Open a draft PR for the release branch to run the PR CI job on it.\n8. Once the PR job passes, run [Prepare-release](https://github.com/realm/realm-swift/actions/workflows/master-push.yml) workflow for the release branch.\n8. Run the [release-cocoa](https://ci.realm.io/job/release-cocoa/) job selecting your branch branch name as a parameter and confirm that it succeeded.\n10. Close the draft PR for the release branch without merging it.\n"
  },
  {
    "path": "contrib/SignXCFramework.md",
    "content": "## Signing the XCFramework\n\nBy Apple's requirements, we should sign our release\n  binaries so Xcode can validate it was signed by the same developer on every new version. \n\nFollow these steps to update the signing certificate in case of change or after the current used certificate has been revoke.\n\n1. Create an Apple Distribution or Apple Development certificate from XCode's Settings/Accounts menu or from Apple's developer portal.\n2. Export the given certificate with a distintic password, edit github's secret variable `P12_PASSWORD` with the new password. https://help.apple.com/xcode/mac/current/#/dev154b28f09\n3. Generate a Base64 string from the exported certificate using\n   ```\n   base64 -i BUILD_CERTIFICATE.p12 | pbcopy\n   ```\n4. Edit github's secret variable `DEVELOPMENT_CERTIFICATE_BASE64` with the copied value.\n5. Edit the current github's secret variable `SIGNING_IDENTITY` to the new identity associated to the exported certificate.\n\n"
  },
  {
    "path": "contrib/UpgradingXcode.md",
    "content": "Check https://developer.apple.com/documentation/xcode-release-notes to see new Xcode releases\n and https://developer.apple.com/xcode-cloud/release-notes/ for Xcode cloud release notes. Xcode cloud doesn't\n update Xcode versions immediately after release, this may take from a few a hours to some days.\n\n# Update Xcode cloud workflow's Xcode version(s)\n\n## https://github.com/realm/realm-swift\n\n1. Update `pr-ci-matrix.rb`. Add or remove version(s) from XCODE_VERSIONS.\n2. Run `ruby ./scripts/xcode_cloud_helper.rb -t {APP_STORE_CONNECT_TOKEN} synchronize-workflows` and select `create` if you want just to create new workflows, `delete` to remove unused workflows and `both` if you want both create and clean.\n2. You can also run the `update-xcode-cloud-workflows` Github action manually for step 2.\n3. Enable manually the new created workflows.\n4. If needed, add environment values to the newly created workflows.\n5. Update version(s) from xcode_versions in `scripts/package-examples.rb`.\n6. Update XCODE_VERSION in `.github/workflows/master-push.yml` and `.github/workflows/publish-release.yml` and check if DOC_VERSION, RELEASE_VERSION and TEST_VERSION needs to be updated.\n7. Search for `#if swift` and see if there's any we can remove.\n8. Update the Carthage version in CHANGELOG.md (and add a changelog entry).\n9. If there's new project settings migrations, open each of the Xcode projects and apply/skip them as applicable. Note that we generally do *not* want to use the Swift version migrations as we support multiple Swift versions at once.\n\n## Notes\n\n* New workflows which includes an environment value should update the environment values manually, e.g. targets\n  with server test. `App Store Connect API` doesn't have allow to set environment values for workflows in the \n  current API.\n"
  },
  {
    "path": "dependencies.list",
    "content": "VERSION=20.0.4\nREALM_CORE_VERSION=v20.1.4\n"
  },
  {
    "path": "docs/README.md",
    "content": "# Realm SDK for Swift\nUse the Realm SDK for Swift to develop iOS, macOS, watchOS and tvOS\napps in Swift and Objective-C.\n\n## Get Started with the Swift SDK\n\nThese docs contain minimal-explanation code examples of how to work\nwith the Swift SDK.\n\nTo get started with SwiftUI, see: [SwiftUI Quick Start](swiftui-tutorial.md)\n\n### Install the Swift SDK\nUse Swift Package Manager, CocoaPods, or Carthage to\nInstall the SDK for iOS, macOS, tvOS, and watchOS in your project.\n\nImport `RealmSwift` in your project files to get started.\n\n### Define an Object Schema\nUse Swift to idiomatically define an object schema.\n\n### Open a Database\nThe SDK's database - Realm - stores objects in files on your\ndevice. Or you can open an in-memory database which does not\ncreate a file.\n\nConfigure and open a database to specify the options for your database file.\n\n### Read and Write Data\n- Create, read, update, and delete objects from the device database.\n- Filter data using the SDK's type-safe .where syntax, or construct an NSPredicate.\n\n### React to Changes\nLive objects mean that your data is always up-to-date.\nYou can register a notification handler\nto watch for changes and perform some logic, such as updating\nyour UI. Or in SwiftUI, use the Swift property wrappers\nto update Views when data changes.\n\n## Realm SwiftUI\n\nThe Swift SDK offers property wrappers and convenience\nfeatures designed to make it easier to work with SwiftUI.\nFor example View code that demonstrates common SwiftUI\npatterns, check out the SwiftUI documentation.\n\n```swift\nstruct SearchableDogsView: View {\n    @ObservedResults(Dog.self) var dogs\n    @State private var searchFilter = \"\"\n\n    var body: some View {\n        NavigationView {\n            // The list shows the dogs in the realm.\n            List {\n                ForEach(dogs) { dog in\n                    DogRow(dog: dog)\n                }\n            }\n            .searchable(text: $searchFilter,\n                        collection: $dogs,\n                        keyPath: \\.name) {\n                ForEach(dogs) { dogsFiltered in\n                    Text(dogsFiltered.name).searchCompletion(dogsFiltered.name)\n                }\n            }\n        }\n    }\n}\n\n```\n\n## Generating API Reference Docs\n\nYou can generate the API docs locally by running `sh build.sh docs` from the root of this repository.\nThis requires installation of [jazzy](https://github.com/realm/jazzy/).\nYou will find the output in `docs/swift_output/` and `docs/objc_output/`.\n"
  },
  {
    "path": "docs/custom_head.html",
    "content": "<link rel=\"icon\" href=\"https://realm.io/img/favicon.ico\">\n    <link rel=\"apple-touch-icon-precomposed\" sizes=\"57x57\" href=\"https://realm.io/img/favicon-57x57.png\">\n    <link rel=\"apple-touch-icon-precomposed\" sizes=\"114x114\" href=\"https://realm.io/img/favicon-114x114.png\">\n    <link rel=\"apple-touch-icon-precomposed\" sizes=\"72x72\" href=\"https://realm.io/img/favicon-72x72.png\">\n    <link rel=\"apple-touch-icon-precomposed\" sizes=\"144x144\" href=\"https://realm.io/img/favicon-144x144.png\">\n    <link rel=\"apple-touch-icon-precomposed\" sizes=\"120x120\" href=\"https://realm.io/img/favicon-120x120.png\">\n    <link rel=\"apple-touch-icon-precomposed\" sizes=\"152x152\" href=\"https://realm.io/img/favicon-152x152.png\">\n    <link rel=\"icon\" type=\"image/png\" href=\"https://realm.io/img/favicon-32x32.png\" sizes=\"32x32\">\n    <link rel=\"icon\" type=\"image/png\" href=\"https://realm.io/img/favicon-16x16.png\" sizes=\"16x16\">\n    <script defer>\n      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n      })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');\n      ga('create', 'UA-50247013-1', 'realm.io');\n      ga('send', 'pageview');\n    </script>\n"
  },
  {
    "path": "docs/example-projects.md",
    "content": "# Realm SDK Example Projects\nExplore engineering and expert-provided example projects to learn best\npractices and common development patterns for the Swift SDK.\n\n|Project Name|Description|Source Code|\n| --- | --- | --- |\n|Integrating In-App Purchases|Use [DELETE ME]'s efficient data management and synchronization capabilities to build a recipes library with in-app purchases (IAP) using StoreKit.|[Swift](https://github.com/realm/realm-swift-samples/tree/main/InAppPurchasesAtlasAppServices)|\n|RTicket|Build a simple issue ticket system with Realm and SwiftUI.|[Swift](https://github.com/mongodb-developer/RTicket)|\n|RCurrency|Use Realm to cache data retrieved from an API and access the data offline.|[Swift](https://github.com/realm/RCurrency)|\n|RChat|Build a simple chat app with SwiftUI and Realm.|[Swift](https://github.com/realm/RChat)|\n"
  },
  {
    "path": "docs/guides/crud/create.md",
    "content": "# CRUD - Create - Swift SDK\n## Create a New Object\n### About The Examples On This Page\nThe examples on this page use the following models:\n\n#### Objective-C\n\n```objectivec\n// DogToy.h\n@interface DogToy : RLMObject\n@property NSString *name;\n@end\n\n// Dog.h\n@interface Dog : RLMObject\n@property NSString *name;\n@property int age;\n@property NSString *color;\n\n// To-one relationship\n@property DogToy *favoriteToy;\n\n@end\n\n// Enable Dog for use in RLMArray\nRLM_COLLECTION_TYPE(Dog)\n\n// Person.h\n// A person has a primary key ID, a collection of dogs, and can be a member of multiple clubs.\n@interface Person : RLMObject\n@property int _id;\n@property NSString *name;\n\n// To-many relationship - a person can have many dogs\n@property RLMArray<Dog *><Dog> *dogs;\n\n// Inverse relationship - a person can be a member of many clubs\n@property (readonly) RLMLinkingObjects *clubs;\n@end\n\nRLM_COLLECTION_TYPE(Person)\n\n// DogClub.h\n@interface DogClub : RLMObject\n@property NSString *name;\n@property RLMArray<Person *><Person> *members;\n@end\n\n// Dog.m\n@implementation Dog\n@end\n\n// DogToy.m\n@implementation DogToy\n@end\n\n// Person.m\n@implementation Person\n// Define the primary key for the class\n+ (NSString *)primaryKey {\n    return @\"_id\";\n}\n\n// Define the inverse relationship to dog clubs\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{\n        @\"clubs\": [RLMPropertyDescriptor descriptorWithClass:DogClub.class propertyName:@\"members\"],\n    };\n}\n@end\n\n// DogClub.m\n@implementation DogClub\n@end\n\n```\n\n#### Swift\n\n```swift\nclass DogToy: Object {\n    @Persisted var name = \"\"\n}\n\nclass Dog: Object {\n    @Persisted var name = \"\"\n    @Persisted var age = 0\n    @Persisted var color = \"\"\n    @Persisted var currentCity = \"\"\n    @Persisted var citiesVisited: MutableSet<String>\n    @Persisted var companion: AnyRealmValue\n\n    // To-one relationship\n    @Persisted var favoriteToy: DogToy?\n\n    // Map of city name -> favorite park in that city\n    @Persisted var favoriteParksByCity: Map<String, String>\n}\n\nclass Person: Object {\n    @Persisted(primaryKey: true) var id = 0\n    @Persisted var name = \"\"\n\n    // To-many relationship - a person can have many dogs\n    @Persisted var dogs: List<Dog>\n\n    // Embed a single object.\n    // Embedded object properties must be marked optional.\n    @Persisted var address: Address?\n\n    convenience init(name: String, address: Address) {\n        self.init()\n        self.name = name\n        self.address = address\n    }\n}\n\nclass Address: EmbeddedObject {\n    @Persisted var street: String?\n    @Persisted var city: String?\n    @Persisted var country: String?\n    @Persisted var postalCode: String?\n}\n\n```\n\n### Create an Object\n#### Objective-C\n\nTo add an object to a realm, instantiate it as you would any other\nobject and then pass it to `-[RLMRealm addObject:]` inside\nof a write transaction.\n\n```objectivec\n// Get the default realm.\n// You only need to do this once per thread.\nRLMRealm *realm = [RLMRealm defaultRealm];\n\n// Instantiate the class.\nDog *dog = [[Dog alloc] init];\ndog.name = @\"Max\";\ndog.age = 5;\n\n// Open a thread-safe transaction.\n[realm transactionWithBlock:^() {\n    // Add the instance to the realm.\n    [realm addObject:dog];\n}];\n\n```\n\n#### Swift\n\nTo add an object to a realm, instantiate it as you would any other\nobject and then pass it to `Realm.add(_:update:)`\ninside of a write transaction.\n\n```swift\n// Instantiate the class and set its values.\nlet dog = Dog()\ndog.name = \"Rex\"\ndog.age = 10\n\n// Get the default realm. You only need to do this once per thread.\nlet realm = try! Realm()\n// Open a thread-safe transaction.\ntry! realm.write {\n    // Add the instance to the realm.\n    realm.add(dog)\n}\n\n```\n\n### Initialize Objects with a Value\nYou can initialize an object by passing an initializer value to\n`Object.init(value:)`.\nThe initializer value can be a [key-value coding](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/KeyValueCoding/)\ncompliant object, a dictionary, or an array containing one element for\neach managed property.\n\n> Note:\n> When using an array as an initializer value, you must include all\nproperties in the same order as they are defined in the model.\n>\n\n#### Objective-C\n\n```objectivec\n// (1) Create a Dog object from a dictionary\nDog *myDog = [[Dog alloc] initWithValue:@{@\"name\" : @\"Pluto\", @\"age\" : @3}];\n\n// (2) Create a Dog object from an array\nDog *myOtherDog = [[Dog alloc] initWithValue:@[@\"Pluto\", @3]];\n\nRLMRealm *realm = [RLMRealm defaultRealm];\n\n// Add to the realm with transaction\n[realm transactionWithBlock:^() {\n    [realm addObject:myDog];\n    [realm addObject:myOtherDog];\n}];\n\n```\n\n#### Swift\n\n```swift\n// (1) Create a Dog object from a dictionary\nlet myDog = Dog(value: [\"name\": \"Pluto\", \"age\": 3])\n\n// (2) Create a Dog object from an array\nlet myOtherDog = Dog(value: [\"Fido\", 5])\n\nlet realm = try! Realm()\n// Add to the realm inside a transaction\ntry! realm.write {\n    realm.add([myDog, myOtherDog])\n}\n\n```\n\nYou can even initialize related or\nembedded objects by nesting initializer\nvalues:\n\n#### Objective-C\n\n```objectivec\n// Instead of using pre-existing dogs...\nPerson *aPerson = [[Person alloc]\n    initWithValue:@[@123, @\"Jane\", @[aDog, anotherDog]]];\n\n// ...we can create them inline\nPerson *anotherPerson = [[Person alloc]\n    initWithValue:@[@123, @\"Jane\", @[@[@\"Buster\", @5], @[@\"Buddy\", @6]]]];\n\n```\n\n#### Swift\n\n```swift\n// Instead of using pre-existing dogs...\nlet aPerson = Person(value: [123, \"Jane\", [aDog, anotherDog]])\n\n// ...we can create them inline\nlet anotherPerson = Person(value: [123, \"Jane\", [[\"Buster\", 5], [\"Buddy\", 6]]])\n\n```\n\n#### Some Property Types are Only Mutable in a Write Transaction\nSome property types are only mutable in a write transaction. For example,\nyou can instantiate an object with a MutableSet\nproperty, but you can only set that property's value in a write transaction.\nYou cannot initialize the object with a value for that property unless\nyou do so inside a write transaction.\n\n### Create an Object with JSON\nRealm does not directly support JSON, but you can use\n[JSONSerialization.jsonObject(with:options:)](https://developer.apple.com/documentation/foundation/jsonserialization/1415493-jsonobject) to\nconvert JSON into a value that you can pass to\n`Realm.create(_:value:update:)`.\n\n#### Objective-C\n\n```objectivec\n// Specify a dog toy in JSON\nNSData *data = [@\"{\\\"name\\\": \\\"Tennis ball\\\"}\" dataUsingEncoding: NSUTF8StringEncoding];\nRLMRealm *realm = [RLMRealm defaultRealm];\n\n// Insert from NSData containing JSON\n[realm transactionWithBlock:^{\n    id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:NULL];\n    [DogToy createInRealm:realm withValue:json];\n}];\n\n```\n\n#### Swift\n\n```swift\n// Specify a dog toy in JSON\nlet data = \"{\\\"name\\\": \\\"Tennis ball\\\"}\".data(using: .utf8)!\nlet realm = try! Realm()\n// Insert from data containing JSON\ntry! realm.write {\n    let json = try! JSONSerialization.jsonObject(with: data, options: [])\n    realm.create(DogToy.self, value: json)\n}\n\n```\n\nNested objects or arrays in the JSON map to to-one or to-many relationships.\n\nThe JSON property names and types must match the destination\nobject schema exactly. For example:\n\n- `float` properties must be initialized with float-backed `NSNumbers`.\n- `Date` and `Data` properties cannot be inferred from strings. Convert them to the appropriate type before passing to `Realm.create(_:value:update:)`.\n- Required properties cannot be `null` or missing in the JSON.\n\nRealm ignores any properties in the JSON not defined in the\nobject schema.\n\n> Tip:\n> If your JSON schema doesn't exactly align with your Realm objects,\nconsider using a third-party framework to transform your JSON. There\nare many model mapping frameworks that work with Realm.\nSee a [partial list in the realm-swift repository](https://github.com/realm/realm-swift/issues/694#issuecomment-144785299).\n>\n\n### Create an Embedded Object\nTo create an embedded object, assign an instance of the embedded object\nto a parent object's property:\n\n#### Objective-C\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n[realm transactionWithBlock:^{\n    Address *address = [[Address alloc] init];\n    address.street = @\"123 Fake St.\";\n    address.city = @\"Springfield\";\n    address.country = @\"USA\";\n    address.postalCode = @\"90710\";\n\n    Contact *contact = [Contact contactWithName:@\"Nick Riviera\"];\n\n    // Assign the embedded object property\n    contact.address = address;\n\n    [realm addObject:contact];\n\n    NSLog(@\"Added contact: %@\", contact);\n}];\n\n```\n\n#### Swift\n\n```swift\n// Open the default realm\nlet realm = try! Realm()\n\ntry! realm.write {\n    let address = Address()\n    address.street = \"123 Fake St\"\n    address.city = \"Springfield\"\n    address.country = \"USA\"\n    address.postalCode = \"90710\"\n    let contact = Person(name: \"Nick Riviera\", address: address)\n    realm.add(contact)\n}\n\n```\n\n### Create an Object with a Map Property\nWhen you create an object that has a `map property`, you can set the values for keys in a few ways:\n\n- Set keys and values on the object and then add the object to the realm\n- Set the object's keys and values directly inside a write transaction\n- Use key-value coding to set or update keys and values inside a write transaction\n\n```swift\nlet realm = try! Realm()\n// Record a dog's name and current city\nlet dog = Dog()\ndog.name = \"Wolfie\"\ndog.currentCity = \"New York\"\n// Set map values\ndog.favoriteParksByCity[\"New York\"] = \"Domino Park\"\n// Store the data in a realm\ntry! realm.write {\n    realm.add(dog)\n    // You can also set map values inside a write transaction\n    dog.favoriteParksByCity[\"Chicago\"] = \"Wrigley Field\"\n    dog.favoriteParksByCity.setValue(\"Bush Park\", forKey: \"Ottawa\")\n}\n\n```\n\nRealm disallows the use of `.` or `$` characters in map keys.\nYou can use percent encoding and decoding to store a map key that contains\none of these disallowed characters.\n\n```\n// Percent encode . or $ characters to use them in map keys\nlet mapKey = \"New York.Brooklyn\"\nlet encodedMapKey = \"New York%2EBrooklyn\"\n\n```\n\n### Create an Object with a MutableSet Property\nYou can create objects that contain `MutableSet` properties as you would any Realm object, but you\ncan only mutate a MutableSet within a write transaction. This means you can\nonly set the value(s) of a mutable set property within a write transaction.\n\n```swift\nlet realm = try! Realm()\n\n// Record a dog's name and current city\nlet dog = Dog()\ndog.name = \"Maui\"\ndog.currentCity = \"New York\"\n\n// Store the data in a realm. Add the dog's current city\n// to the citiesVisited MutableSet\ntry! realm.write {\n    realm.add(dog)\n    // You can only mutate the MutableSet in a write transaction.\n    // This means you can't set values at initialization, but must do it during a write.\n    dog.citiesVisited.insert(dog.currentCity)\n}\n\n// You can also add multiple items to the set.\ntry! realm.write {\n    dog.citiesVisited.insert(objectsIn: [\"Boston\", \"Chicago\"])\n}\n\nprint(\"\\(dog.name) has visited: \\(dog.citiesVisited)\")\n\n```\n\n### Create an Object with an AnyRealmValue Property\nWhen you create an object with an AnyRealmValue property, you must specify the type of the value you store in\nthe property. The Realm Swift SDK provides an `AnyRealmValue enum` that iterates through all of the types the\nAnyRealmValue can store.\n\nLater, when you read an AnyRealmValue,\nyou must check the type before you do anything with the value.\n\n```swift\n// Create a Dog object and then set its properties\nlet myDog = Dog()\nmyDog.name = \"Rex\"\n// This dog has no companion.\n// You can set the field's type to \"none\", which represents `nil`\nmyDog.companion = .none\n\n// Create another Dog whose companion is a cat.\n// We don't have a Cat object, so we'll use a string to describe the companion.\nlet theirDog = Dog()\ntheirDog.name = \"Wolfie\"\ntheirDog.companion = .string(\"Fluffy the Cat\")\n\n// Another dog might have a dog as a companion.\n// We do have an object that can represent that, so we can specify the\n// type is a Dog object, and even set the object's value.\nlet anotherDog = Dog()\nanotherDog.name = \"Fido\"\n// Note: this sets Spot as a companion of Fido, but does not set\n// Fido as a companion of Spot. Spot has no companion in this instance.\nanotherDog.companion = .object(Dog(value: [\"name\": \"Spot\"]))\n\n// Add the dogs to the realm\nlet realm = try! Realm()\ntry! realm.write {\n    realm.add([myDog, theirDog, anotherDog])\n}\n// After adding these dogs to the realm, we now have 4 dog objects.\nlet dogs = realm.objects(Dog.self)\nXCTAssertEqual(dogs.count, 4)\n\n```\n\n## Create an Object Asynchronously\nYou can use Swift concurrency features to write asynchronously to an\nactor-isolated realm.\n\nThis function from the example `RealmActor` defined on the\nUse Realm with Actors page shows how you might\nwrite to an actor-isolated realm:\n\n```swift\nfunc createTodo(name: String, owner: String, status: String) async throws {\n    try await realm.asyncWrite {\n        realm.create(Todo.self, value: [\n            \"_id\": ObjectId.generate(),\n            \"name\": name,\n            \"owner\": owner,\n            \"status\": status\n        ])\n    }\n}\n\n```\n\nAnd you might perform this write using Swift's async syntax:\n\n```swift\nfunc createObject() async throws {\n    // Because this function is not isolated to this actor,\n    // you must await operations completed on the actor\n    try await actor.createTodo(name: \"Take the ring to Mount Doom\", owner: \"Frodo\", status: \"In Progress\")\n    let taskCount = await actor.count\n    print(\"The actor currently has \\(taskCount) tasks\")\n}\n\nlet actor = try await RealmActor()\n\ntry await createObject()\n\n```\n\nThis operation does not block or perform I/O on the calling thread. For\nmore information about writing to realm using Swift concurrency features,\nrefer to Use Realm with Actors - Swift SDK.\n\n## Copy an Object to Another Realm\n#### Objective-C\n\nTo copy an object from one realm to another, pass the original\nobject to `+[RLMObject createInRealm:withValue:]`:\n\n```objectivec\nRLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\nconfiguration.inMemoryIdentifier = @\"first realm\";\nRLMRealm *realm = [RLMRealm realmWithConfiguration:configuration error:nil];\n\n[realm transactionWithBlock:^{\n    Dog *dog = [[Dog alloc] init];\n    dog.name = @\"Wolfie\";\n    dog.age = 1;\n    [realm addObject:dog];\n}];\n\n// Later, fetch the instance we want to copy\nDog *wolfie = [[Dog objectsInRealm:realm where:@\"name == 'Wolfie'\"] firstObject];\n\n// Open the other realm\nRLMRealmConfiguration *otherConfiguration = [RLMRealmConfiguration defaultConfiguration];\notherConfiguration.inMemoryIdentifier = @\"second realm\";\nRLMRealm *otherRealm = [RLMRealm realmWithConfiguration:otherConfiguration error:nil];\n[otherRealm transactionWithBlock:^{\n    // Copy to the other realm\n    Dog *wolfieCopy = [[wolfie class] createInRealm:otherRealm withValue:wolfie];\n    wolfieCopy.age = 2;\n\n    // Verify that the copy is separate from the original\n    XCTAssertNotEqual(wolfie.age, wolfieCopy.age);\n}];\n\n```\n\n#### Swift\n\nTo copy an object from one realm to another, pass the original\nobject to `Realm.create(_:value:update:):`:\n\n```swift\nlet realm = try! Realm(configuration: Realm.Configuration(inMemoryIdentifier: \"first realm\"))\n\ntry! realm.write {\n    let dog = Dog()\n    dog.name = \"Wolfie\"\n    dog.age = 1\n    realm.add(dog)\n}\n\n// Later, fetch the instance we want to copy\nlet wolfie = realm.objects(Dog.self).first(where: { $0.name == \"Wolfie\" })!\n\n// Open the other realm\nlet otherRealm = try! Realm(configuration: Realm.Configuration(inMemoryIdentifier: \"second realm\"))\ntry! otherRealm.write {\n    // Copy to the other realm\n    let wolfieCopy = otherRealm.create(type(of: wolfie), value: wolfie)\n    wolfieCopy.age = 2\n\n    // Verify that the copy is separate from the original\n    XCTAssertNotEqual(wolfie.age, wolfieCopy.age)\n}\n\n```\n\n> Important:\n> The `create` methods do not support handling cyclical object\ngraphs. Do not pass in an object containing relationships involving\nobjects that refer back to their parents, either directly or\nindirectly.\n>\n"
  },
  {
    "path": "docs/guides/crud/crud.md",
    "content": "# CRUD - Swift SDK\n## Write Transactions\nRealm uses a highly efficient storage engine\nto persist objects. You can **create** objects in a realm,\n**update** objects in a realm, and eventually **delete**\nobjects from a realm. Because these operations modify the\nstate of the realm, we call them writes.\n\nRealm handles writes in terms of **transactions**. A\ntransaction is a list of read and write operations that\nRealm treats as a single indivisible operation. In other\nwords, a transaction is *all or nothing*: either all of the\noperations in the transaction succeed or none of the\noperations in the transaction take effect.\n\nAll writes must happen in a transaction.\n\nA realm allows only one open transaction at a time. Realm\nblocks other writes on other threads until the open\ntransaction is complete. Consequently, there is no race\ncondition when reading values from the realm within a\ntransaction.\n\nWhen you are done with your transaction, Realm either\n**commits** it or **cancels** it:\n\n- When Realm **commits** a transaction, Realm writes\nall changes to disk.\n- When Realm **cancels** a write transaction or an operation in\nthe transaction causes an error, all changes are discarded\n(or \"rolled back\").\n\n### Run a Transaction\nThe Swift SDK represents each transaction as a callback function\nthat contains zero or more read and write operations. To run\na transaction, define a transaction callback and pass it to\nthe realm's `write` method. Within this callback, you are\nfree to create, read, update, and delete on the realm. If\nthe code in the callback throws an exception when Realm runs\nit, Realm cancels the transaction. Otherwise, Realm commits\nthe transaction immediately after the callback.\n\n> Important:\n> Since transactions block each other, it is best to avoid\nopening transactions on both the UI thread and a\nbackground thread. If a background transaction\nblocks your UI thread's transaction, your app may appear\nunresponsive.\n>\n\n> Example:\n> The following code shows how to run a transaction with\nthe realm's write method. If the code in the callback\nthrows an exception, Realm cancels the transaction.\nOtherwise, Realm commits the transaction.\n>\n> #### Objective-C\n>\n> ```objectivec\n> // Open the default realm.\n> RLMRealm *realm = [RLMRealm defaultRealm];\n>\n> // Open a thread-safe transaction.\n> [realm transactionWithBlock:^() {\n>     // ... Make changes ...\n>     // Realm automatically cancels the transaction in case of exception.\n>     // Otherwise, Realm automatically commits the transaction at the\n>     // end of the code block.\n> }];\n>\n> ```\n>\n>\n> #### Swift\n>\n> ```swift\n> // Open the default realm.\n> let realm = try! Realm()\n>\n> // Prepare to handle exceptions.\n> do {\n>     // Open a thread-safe transaction.\n>     try realm.write {\n>         // Make any writes within this code block.\n>         // Realm automatically cancels the transaction\n>         // if this code throws an exception. Otherwise,\n>         // Realm automatically commits the transaction\n>         // after the end of this code block.\n>     }\n> } catch let error as NSError {\n>     // Failed to write to realm.\n>     // ... Handle error ...\n> }\n>\n> ```\n>\n>\n\n## Interface-Driven Writes\nRealm always delivers notifications asynchronously, so they\nnever block the UI thread. However, there are situations when the UI\nmust reflect changes instantly. If you update the UI directly at the\nsame time as the write, the eventual notification could double that\nupdate. This could lead to your app crashing due to inconsistent state\nbetween the UI and the backing data store. To avoid this, you can write\nwithout sending a notification to a specific handler. We call this type\nof transaction an **interface-driven write**.\n\n> Example:\n> Say we decide to manage a table view's data source manually, because\nour app design requires an instantaneous response to UI-driven table\nupdates. As soon as a user adds an item to the table view, we insert\nit to our data source, which writes to the realm but also\nimmediately kicks off the animation. However, when Realm\ndelivers the change notification for this insertion a little later,\nit indicates that an object has been added. But we already updated\nthe table view for it! Rather than writing complicated code to handle\nthis case, we can use interface-driven writes to prevent a specific\nnotification handler from firing for that specific write.\n>\n\nInterface-driven writes, also known as silent writes, are especially\nuseful when using fine-grained collection notifications. While you use\ninterface-driven writes for the current user's updates and update the UI\nimmediately, the sync process can use standard notifications to update\nthe UI.\n"
  },
  {
    "path": "docs/guides/crud/delete.md",
    "content": "# CRUD - Delete - Swift SDK\n## Delete Realm Objects\nDeleting Realm Objects must occur within write transactions. For\nmore information about write transactions, see: Transactions.\n\nIf you want to delete the Realm file itself, see: Delete a Realm.\n\n> Important:\n> You cannot access or modify an object after you have deleted it from\na realm. If you try to use a deleted object, Realm throws an\nerror.\n>\n\n### About The Examples On This Page\nThe examples on this page use the following models:\n\n#### Objective-C\n\n```objectivec\n// DogToy.h\n@interface DogToy : RLMObject\n@property NSString *name;\n@end\n\n// Dog.h\n@interface Dog : RLMObject\n@property NSString *name;\n@property int age;\n@property NSString *color;\n\n// To-one relationship\n@property DogToy *favoriteToy;\n\n@end\n\n// Enable Dog for use in RLMArray\nRLM_COLLECTION_TYPE(Dog)\n\n// Person.h\n// A person has a primary key ID, a collection of dogs, and can be a member of multiple clubs.\n@interface Person : RLMObject\n@property int _id;\n@property NSString *name;\n\n// To-many relationship - a person can have many dogs\n@property RLMArray<Dog *><Dog> *dogs;\n\n// Inverse relationship - a person can be a member of many clubs\n@property (readonly) RLMLinkingObjects *clubs;\n@end\n\nRLM_COLLECTION_TYPE(Person)\n\n// DogClub.h\n@interface DogClub : RLMObject\n@property NSString *name;\n@property RLMArray<Person *><Person> *members;\n@end\n\n// Dog.m\n@implementation Dog\n@end\n\n// DogToy.m\n@implementation DogToy\n@end\n\n// Person.m\n@implementation Person\n// Define the primary key for the class\n+ (NSString *)primaryKey {\n    return @\"_id\";\n}\n\n// Define the inverse relationship to dog clubs\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{\n        @\"clubs\": [RLMPropertyDescriptor descriptorWithClass:DogClub.class propertyName:@\"members\"],\n    };\n}\n@end\n\n// DogClub.m\n@implementation DogClub\n@end\n\n```\n\n#### Swift\n\n```swift\nclass Dog: Object {\n    @Persisted var name = \"\"\n    @Persisted var age = 0\n    @Persisted var color = \"\"\n    @Persisted var currentCity = \"\"\n    @Persisted var citiesVisited: MutableSet<String>\n    @Persisted var companion: AnyRealmValue\n\n    // Map of city name -> favorite park in that city\n    @Persisted var favoriteParksByCity: Map<String, String>\n}\n\n```\n\n### Delete an Object\n#### Objective-C\n\nTo delete an object from a realm, pass the object to\n`-[RLMRealm deleteObject:]`\ninside of a write transaction.\n\n```objectivec\n[realm transactionWithBlock:^() {\n    // Delete the instance from the realm.\n    [realm deleteObject:dog];\n}];\n\n```\n\n#### Swift\n\nTo delete an object from a realm, pass the object to\n`Realm.delete(_:)`\ninside of a write transaction.\n\n```swift\n// Previously, we've added a dog object to the realm.\nlet dog = Dog(value: [\"name\": \"Max\", \"age\": 5])\n\nlet realm = try! Realm()\ntry! realm.write {\n    realm.add(dog)\n}\n\n// Delete the instance from the realm.\ntry! realm.write {\n    realm.delete(dog)\n}\n\n```\n\n### Delete Multiple Objects\n#### Swift\n\n> Version added: 10.19.0\n\nTo delete a collection of objects from a realm, pass the\ncollection to `Realm.delete(_:)`\ninside of a write transaction.\n\n```swift\nlet realm = try! Realm()\ntry! realm.write {\n    // Find dogs younger than 2 years old.\n    let puppies = realm.objects(Dog.self).where {\n        $0.age < 2\n    }\n\n    // Delete the objects in the collection from the realm.\n    realm.delete(puppies)\n}\n\n```\n\n#### Swift Nspredicate\n\nTo delete a collection of objects from a realm, pass the\ncollection to `Realm.delete(_:)`\ninside of a write transaction.\n\n```swift\nlet realm = try! Realm()\ntry! realm.write {\n    // Find dogs younger than 2 years old.\n    let puppies = realm.objects(Dog.self).filter(\"age < 2\")\n\n    // Delete the objects in the collection from the realm.\n    realm.delete(puppies)\n}\n\n```\n\n#### Objective-C\n\nTo delete a collection of objects from a realm, pass the\ncollection to `-[Realm deleteObjects:]`\ninside of a write transaction.\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n\n[realm transactionWithBlock:^() {\n    // Find dogs younger than 2 years old.\n    RLMResults<Dog *> *puppies = [Dog objectsInRealm:realm where:@\"age < 2\"];\n\n    // Delete all objects in the collection from the realm.\n    [realm deleteObjects:puppies];\n}];\n\n```\n\n### Delete an Object and Its Related Objects\nSometimes, you want to delete related objects when you delete the parent\nobject. We call this a **chaining delete**. Realm does not delete\nthe related objects for you. If you do not delete the objects yourself,\nthey remain orphaned in your realm. Whether or not this is a problem\ndepends on your application's needs.\n\nThe best way to delete dependent objects is to iterate through\nthe dependencies and delete them before deleting the parent object.\n\n#### Objective-C\n\n```objectivec\n[realm transactionWithBlock:^() {\n    // Delete Ali's dogs.\n    [realm deleteObjects:[ali dogs]];\n    // Delete Ali.\n    [realm deleteObject:ali];\n}];\n\n```\n\n#### Swift\n\n```swift\nlet person = realm.object(ofType: Person.self, forPrimaryKey: 1)!\ntry! realm.write {\n    // Delete the related collection\n    realm.delete(person.dogs)\n    realm.delete(person)\n}\n\n```\n\n### Delete All Objects of a Specific Type\n#### Objective-C\n\nTo delete all objects of a given object type from a realm, pass\nthe result of [+[YourRealmObjectClass\nallObjectsInRealm:]]\nto `-[Realm deleteObjects:]`\ninside of a write transaction. Replace `YourRealmObjectClass`\nwith your Realm object class name.\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n\n[realm transactionWithBlock:^() {\n    // Delete all instances of Dog from the realm.\n    RLMResults<Dog *> *allDogs = [Dog allObjectsInRealm:realm];\n    [realm deleteObjects:allDogs];\n}];\n\n```\n\n#### Swift\n\nTo delete all objects of a given object type from a realm, pass\nthe result of `Realm.objects(_)`\nfor the type you wish to delete to `Realm.delete(_:)`\ninside of a write transaction.\n\n```swift\nlet realm = try! Realm()\n\ntry! realm.write {\n    // Delete all instances of Dog from the realm.\n    let allDogs = realm.objects(Dog.self)\n    realm.delete(allDogs)\n}\n\n```\n\n### Delete All Objects in a Realm\n#### Objective-C\n\nTo delete all objects from the realm, call [-[RLMRealm\ndeleteAllObjects]]\ninside of a write transaction. This clears the realm of all object\ninstances but does not affect the realm's schema.\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n\n[realm transactionWithBlock:^() {\n    // Delete all objects from the realm.\n    [realm deleteAllObjects];\n}];\n\n```\n\n#### Swift\n\nTo delete all objects from the realm, call\n`Realm.deleteAll()` inside of a\nwrite transaction. This clears the realm of all object instances\nbut does not affect the realm's schema.\n\n```swift\nlet realm = try! Realm()\n\ntry! realm.write {\n    // Delete all objects from the realm.\n    realm.deleteAll()\n}\n\n```\n\n### Delete Map Keys/Values\nYou can delete `map` entries in a few ways:\n\n- Use `removeObject(for:)` to remove the key and the value\n- If the dictionary's value is optional, you can set the value of the key to\n`nil` to keep the key.\n\n```swift\nlet realm = try! Realm()\n\n// Find the dog we want to update\nlet wolfie = realm.objects(Dog.self).where {\n    $0.name == \"Wolfie\"\n}.first!\n\n// Delete an entry\ntry! realm.write {\n    // Use removeObject(for:)\n    wolfie.favoriteParksByCity.removeObject(for: \"New York\")\n    // Or assign `nil` to delete non-optional values.\n    // If the value type were optional (e.g. Map<String, String?>)\n    // this would assign `nil` to that entry rather than deleting it.\n    wolfie.favoriteParksByCity[\"New York\"] = nil\n}\nXCTAssertNil(wolfie.favoriteParksByCity[\"New York\"])\n\n```\n\n### Delete MutableSet Elements\nYou can delete specific elements from a `MutableSet`, or clear all of the elements from the set.\nIf you are working with multiple sets, you can also remove elements in one\nset from the other set; see: Update a MutableSet Property.\n\n```swift\nlet realm = try! Realm()\n\n// Record a dog's name and list of cities he has visited.\nlet dog = Dog()\ndog.name = \"Maui\"\nlet dogCitiesVisited = [\"New York\", \"Boston\", \"Toronto\"]\ntry! realm.write {\n    realm.add(dog)\n    dog.citiesVisited.insert(objectsIn: dogCitiesVisited)\n}\nXCTAssertEqual(dog.citiesVisited.count, 3)\n\n// Later... we decide the dog didn't really visit Toronto\n// since the plane just stopped there for a layover.\n// Remove the element from the set.\ntry! realm.write {\n    dog.citiesVisited.remove(\"Toronto\")\n}\nXCTAssertEqual(dog.citiesVisited.count, 2)\n\n// Or, in the case where the person entered the data for\n// the wrong dog, remove all elements from the set.\ntry! realm.write {\n    dog.citiesVisited.removeAll()\n}\nXCTAssertEqual(dog.citiesVisited.count, 0)\n\n```\n\n### Delete the Value of an AnyRealmValue\nTo delete the value of an AnyRealmValue, set it to `.none`.\n\n```swift\nlet realm = try! Realm()\n\n// Wolfie's companion is \"Fluffy the Cat\", represented by a string.\n// Fluffy has gone to visit friends for the summer, so Wolfie has no companion.\nlet wolfie = realm.objects(Dog.self).where {\n    $0.name == \"Wolfie\"\n}.first!\n\ntry! realm.write {\n    // You cannot set an AnyRealmValue to nil; you must set it to `.none`, instead.\n    wolfie.companion = .none\n}\n\n```\n\n## Delete an Object Asynchronously\nYou can use Swift concurrency features to asynchronously delete objects\nusing an actor-isolated realm.\n\nThis function from the example `RealmActor` defined on the\nUse Realm with Actors page shows how you might\ndelete an object in an actor-isolated realm:\n\n```swift\nfunc deleteTodo(id: ObjectId) async throws {\n    try await realm.asyncWrite {\n        let todoToDelete = realm.object(ofType: Todo.self, forPrimaryKey: id)\n        realm.delete(todoToDelete!)\n    }\n}\n\n```\n\nAnd you might perform this deletion using Swift's async syntax:\n\n```swift\nlet actor = try await RealmActor()\nlet todoId = await actor.getObjectId(forTodoNamed: \"Keep Mr. Frodo safe from that Gollum\")\n\ntry await actor.deleteTodo(id: todoId)\nlet updatedTodoCount = await actor.count\nif updatedTodoCount == todoCount - 1 {\n    print(\"Successfully deleted the todo\")\n}\n\n```\n\nThis operation does not block or perform I/O on the calling thread. For\nmore information about writing to realm using Swift concurrency features,\nrefer to Use Realm with Actors.\n"
  },
  {
    "path": "docs/guides/crud/filter-data.md",
    "content": "# Filter Data - Swift SDK\n## Overview\nTo filter data in your realm, you can leverage\nRealm's query engine.\n\n> Version added: 10.19.0\n>\n\nThe Realm Swift Query API offers an\nidiomatic way for Swift developers to query data. Use Swift-style syntax\nto query a realm with the benefits of auto-completion and\ntype safety. The Realm Swift Query API does not replace the NSPredicate\nQuery API in newer SDK versions; instead, you can use either.\n\nFor SDK versions prior to 10.19.0, or for Objective-C developers,\nRealm's query engine supports NSPredicate Query.\n\n## About the Examples on This Page\nThe examples in this page use a simple data set for a\ntask list app. The two Realm object types are `Project`\nand `Task`. A `Task` has a name, assignee's name, and\ncompleted flag. There is also an arbitrary number for\npriority -- higher is more important -- and a count of\nminutes spent working on it. Finally, a `Task` can have one\nor more string `labels` and one or more integer `ratings`.\n\nA `Project` has zero or more `Tasks`.\n\nSee the schema for these two classes, `Project` and\n`Task`, below:\n\n#### Objective-C\n\n```objectivec\n// Task.h\n@interface Task : RLMObject\n@property NSString *name;\n@property bool isComplete;\n@property NSString *assignee;\n@property int priority;\n@property int progressMinutes;\n@end\nRLM_COLLECTION_TYPE(Task)\n// Task.m\n@implementation Task\n@end\n\n// Project.h\n@interface Project : RLMObject\n@property NSString *name;\n@property RLMArray<Task> *tasks;\n@end\n// Project.m\n@implementation Project\n@end\n\n```\n\n#### Swift\n\n```swift\nclass Task: Object {\n    @Persisted var name = \"\"\n    @Persisted var isComplete = false\n    @Persisted var assignee: String?\n    @Persisted var priority = 0\n    @Persisted var progressMinutes = 0\n    @Persisted var labels: MutableSet<String>\n    @Persisted var ratings: MutableSet<Int>\n}\n\nclass Project: Object {\n    @Persisted var name = \"\"\n    @Persisted var tasks: List<Task>\n}\n\n```\n\nYou can set up the realm for these examples with the following code:\n\n#### Objective-C\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n[realm transactionWithBlock:^() {\n    // Add projects and tasks here\n}];\n\nRLMResults *tasks = [Task allObjectsInRealm:realm];\nRLMResults *projects = [Project allObjectsInRealm:realm];\n\n```\n\n#### Swift\n\n```swift\nlet realm = try! Realm()\ntry! realm.write {\n    // Add tasks and projects here.\n    let project = Project()\n    project.name = \"New Project\"\n    let task = Task()\n    task.assignee = \"Alex\"\n    task.priority = 5\n    project.tasks.append(task)\n    realm.add(project)\n    // ...\n}\nlet tasks = realm.objects(Task.self)\nlet projects = realm.objects(Project.self)\n\n```\n\n## Realm Swift Query API\n> Version added: 10.19.0\n> For SDK versions older than 10.19.0, use the NSPredicate query API.\n>\n\nYou can build a filter with Swift-style syntax using the `.where`\n`Realm Swift query API`:\n\n```swift\nlet realmSwiftQuery = projects.where {\n    ($0.tasks.progressMinutes > 1) && ($0.tasks.assignee == \"Ali\")\n}\n\n```\n\nThis query API constructs an NSPredicate\nto perform the query. It gives developers a type-safe idiomatic API to\nuse directly, and abstracts away the NSPredicate construction.\n\nThe `.where` API takes a callback that evaluates to true or false. The\ncallback receives an instance of the type being queried, and you can\nleverage the compiler to statically check that you are creating valid queries\nthat reference valid properties.\n\nIn the examples on this page, we use the `$0` shorthand to reference\nthe variable passed into the callback.\n\n### Operators\nThere are several types of operators available to query a\nRealm collection. Queries\nwork by **evaluating** an operator expression for every\nobject in the collection being\nqueried. If the expression resolves to `true`, Realm\nDatabase includes the object in the results collection.\n\n#### Comparison Operators\nYou can use Swift comparison operators with the Realm Swift\nQuery API (`==`, `!=`, `>`, `>=`, `<`, `<=`).\n\n> Example:\n> The following example uses the query engine's\ncomparison operators to:\n>\n> - Find high priority tasks by comparing the value of the `priority` property value with a threshold number, above which priority can be considered high.\n> - Find long-running tasks by seeing if the `progressMinutes` property is at or above a certain value.\n> - Find unassigned tasks by finding tasks where the `assignee` property is equal to `null`.\n>\n> ```swift\n> let highPriorityTasks = tasks.where {\n>     $0.priority > 5\n> }\n> print(\"High-priority tasks: \\(highPriorityTasks.count)\")\n>\n> let longRunningTasks = tasks.where {\n>     $0.progressMinutes >= 120\n> }\n> print(\"Long running tasks: \\(longRunningTasks.count)\")\n>\n> let unassignedTasks = tasks.where {\n>     $0.assignee == nil\n> }\n> print(\"Unassigned tasks: \\(unassignedTasks.count)\")\n>\n> ```\n>\n\n#### Collections\nYou can query for values within a collection using the `.contains` operators.\nYou can search for individual values by element, or search within a range.\n\n|Operator|Description|\n| --- | --- |\n|.in(_ collection:)|Evaluates to `true` if the property referenced by the expression contains an element in the given array.|\n|.contains(_ element:)|Equivalent to the `IN` operator. Evaluates to `true` if the property referenced by the expression contains the value.|\n|`.contains(_ range:)`|Equivalent to the `BETWEEN` operator. Evaluates to `true` if the property referenced by the expression contains a value that is within the range.|\n|`.containsAny(in: )`|Equivalent to the `IN` operator combined with the `ANY` operator. Evaluates to `true` if any elements contained in the given array are present in the collection.|\n\n> Example:\n> - Find tasks where the `labels` MutableSet collection property contains \"quick win\".\n> - Find tasks where the `progressMinutes` property is within a given range of minutes.\n>\n> ```swift\n> let quickWinTasks = tasks.where {\n>     $0.labels.contains(\"quick win\")\n> }\n> print(\"Tasks labeled 'quick win': \\(quickWinTasks.count)\")\n>\n> let progressBetween30and60 = tasks.where {\n>     $0.progressMinutes.contains(30...60)\n> }\n> print(\"Tasks with progress between 30 and 60 minutes: \\(progressBetween30and60.count)\")\n>\n> ```\n>\n> Find tasks where the `labels` MutableSet collection property contains any of the elements in the given array: \"quick win\" or \"bug\".\n>\n> ```swift\n> let quickWinOrBugTasks = tasks.where {\n>     $0.labels.containsAny(in: [\"quick win\", \"bug\"])\n> }\n> print(\"Tasks labeled 'quick win' or 'bug': \\(quickWinOrBugTasks.count)\")\n>\n> ```\n>\n\n> Version added: 10.23.0\n> :The `IN` operator\n>\n\nThe Realm Swift Query API now supports the `IN` operator. Evaluates to `true` if the property referenced by the expression contains the value.\n\n> Example:\n> Find tasks assigned to specific teammates Ali or Jamie by seeing if the `assignee` property is in a list of names.\n>\n> ```swift\n> let taskAssigneeInAliOrJamie = tasks.where {\n>     let assigneeNames = [\"Ali\", \"Jamie\"]\n>     return $0.assignee.in(assigneeNames)\n> }\n> print(\"Tasks IN Ali or Jamie: \\(taskAssigneeInAliOrJamie.count)\")\n>\n> ```\n>\n\n#### Logical Operators\nYou can make compound queries using Swift logical operators (`&&`, `!`,\n`||`).\n\n> Example:\n> We can use the query language's logical operators to find\nall of Ali's completed tasks. That is, we find all tasks\nwhere the `assignee` property value is equal to 'Ali' AND\nthe `isComplete` property value is `true`:\n>\n> ```swift\n> let aliComplete = tasks.where {\n>     ($0.assignee == \"Ali\") && ($0.isComplete == true)\n> }\n> print(\"Ali's complete tasks: \\(aliComplete.count)\")\n>\n> ```\n>\n\n#### String Operators\nYou can compare string values using these string operators.\nRegex-like wildcards allow more flexibility in search.\n\n> Note:\n> You can use the following options with string operators:\n>\n> - `.caseInsensitive` for case insensitivity. `$0.name.contains(\"f\", options: .caseInsensitive)`\n> - `.diacriticInsensitive` for diacritic insensitivity: Realm treats\nspecial characters as the base character (e.g. `é` -> `e`). `$0.name.contains(\"e\", options: .diacriticInsensitive)`\n>\n\n|Operator|Description|\n| --- | --- |\n|.starts(with value: String)|Evaluates to `true` if the collection contains an element whose value begins with the specified string value.|\n|.contains(_ value: String)|Evaluates to `true` if the left-hand string expression is found anywhere in the right-hand string expression.|\n|.ends(with value: String)|Evaluates to `true` if the collection contains an element whose value ends with the specified string value.|\n|.like(_ value: String)|Evaluates to `true` if the left-hand string expression matches the right-hand string wildcard string expression. A wildcard string expression is a string that uses normal characters with two special wildcard characters: The `*` wildcard matches zero or more of any character The `?` wildcard matches any character. For example, the wildcard string \"d?g\" matches \"dog\", \"dig\", and \"dug\", but not \"ding\", \"dg\", or \"a dog\".|\n|==|Evaluates to `true` if the left-hand string is lexicographically equal to the right-hand string.|\n|!=|Evaluates to `true` if the left-hand string is not lexicographically equal to the right-hand string.|\n\n> Example:\n> The following example uses the query engine's string operators to find:\n>\n> - Projects with a name starting with the letter 'e'\n> - Projects with names that contain 'ie'\n> - Projects with an `assignee` property whose value is similar to `Al?x`\n> - Projects that contain e-like characters with diacritic insensitivity\n>\n> ```swift\n> // Use the .caseInsensitive option for case-insensitivity.\n> let startWithE = projects.where {\n>     $0.name.starts(with: \"e\", options: .caseInsensitive)\n> }\n> print(\"Projects that start with 'e': \\(startWithE.count)\")\n>\n> let containIe = projects.where {\n>     $0.name.contains(\"ie\")\n> }\n> print(\"Projects that contain 'ie': \\(containIe.count)\")\n>\n> let likeWildcard = tasks.where {\n>     $0.assignee.like(\"Al?x\")\n> }\n> print(\"Tasks with assignees like Al?x: \\(likeWildcard.count)\")\n>\n> // Use the .diacriticInsensitive option for diacritic insensitivity: contains 'e', 'E', 'é', etc.\n> let containElike = projects.where {\n>     $0.name.contains(\"e\", options: .diacriticInsensitive)\n> }\n> print(\"Projects that contain 'e', 'E', 'é', etc.: \\(containElike.count)\")\n>\n> ```\n>\n\n> Note:\n> String sorting and case-insensitive queries are only supported for\ncharacter sets in 'Latin Basic', 'Latin Supplement', 'Latin Extended\nA', and 'Latin Extended B' (UTF-8 range 0-591).\n>\n\n#### Geospatial Operators\n> Version added: 10.47.0\n\nUse the `geoWithin` operator to query geospatial data with one of the\nSDK's provided shapes:\n\n- `GeoCircle`\n- `GeoBox`\n- `GeoPolygon`\n\nThis operator evaluates to `true` if:\n\n- An object has a geospatial data \"shape\" containing a `String` property\nwith the value of Point and a `List` containing a longitude/latitude\npair.\n- The longitude/latitude of the persisted object falls within the geospatial\nquery shape.\n\n```swift\nlet companiesInSmallCircle = realm.objects(Geospatial_Company.self).where {\n    $0.location.geoWithin(smallCircle!)\n}\nprint(\"Number of companies in small circle: \\(companiesInSmallCircle.count)\")\n\n```\n\nFor more information about querying geospatial data, refer to\nQuery Geospatial Data.\n\n#### Aggregate Operators\nYou can apply an aggregate operator to a collection property\nof a Realm object. Aggregate operators traverse a\ncollection and reduce it\nto a single value.\n\n|Operator|Description|\n| --- | --- |\n|.avg|Evaluates to the average value of a given numerical property across a collection.|\n|.count|Evaluates to the number of objects in the given collection. This is currently only supported on to-many relationship collections and not on lists of primitives. In order to use `.count` on a list of primitives, consider wrapping the primitives in a Realm object.|\n|.max|Evaluates to the highest value of a given numerical property across a collection.|\n|.min|Evaluates to the lowest value of a given numerical property across a collection.|\n|.sum|Evaluates to the sum of a given numerical property across a collection.|\n\n> Example:\n> We create a couple of filters to show different facets of\nthe data:\n>\n> - Projects with average tasks priority above 5.\n> - Projects that contain only low-priority tasks below 5.\n> - Projects where all tasks are high-priority above 5.\n> - Projects that contain more than 5 tasks.\n> - Long running projects.\n>\n> ```swift\n> let averageTaskPriorityAbove5 = projects.where {\n>     $0.tasks.priority.avg > 5\n> }\n> print(\"Projects with average task priority above 5: \\(averageTaskPriorityAbove5.count)\")\n>\n> let allTasksLowerPriority = projects.where {\n>     $0.tasks.priority.max < 5\n> }\n> print(\"Projects where all tasks are lower priority: \\(allTasksLowerPriority.count)\")\n>\n> let allTasksHighPriority = projects.where {\n>     $0.tasks.priority.min > 5\n> }\n> print(\"Projects where all tasks are high priority: \\(allTasksHighPriority.count)\")\n>\n> let moreThan5Tasks = projects.where {\n>     $0.tasks.count > 5\n> }\n> print(\"Projects with more than 5 tasks: \\(moreThan5Tasks.count)\")\n>\n> let longRunningProjects = projects.where {\n>     $0.tasks.progressMinutes.sum > 100\n> }\n> print(\"Long running projects: \\(longRunningProjects.count)\")\n>\n> ```\n>\n\n#### Set Operators\nA **set operator** uses specific rules to determine whether\nto pass each input collection object to the output\ncollection by applying a given query expression to every element of\na given list property of\nthe object.\n\n> Example:\n> Running the following queries in `projects` collections returns:\n>\n> - Projects where a set of string `labels` contains any of \"quick win\", \"bug\".\n> - Projects where any element in a set of integer `ratings` is greater than 3.\n>\n> ```swift\n> let projectsWithGivenLabels = projects.where {\n>     $0.tasks.labels.containsAny(in: [\"quick win\", \"bug\"])\n> }\n> print(\"Projects with quick wins: \\(projectsWithGivenLabels.count)\")\n>\n> let projectsWithRatingsOver3 = projects.where {\n>     $0.tasks.ratings > 3\n> }\n> print(\"Projects with any ratings over 3: \\(projectsWithRatingsOver3.count)\")\n>\n> ```\n>\n\n### Subqueries\nYou can iterate through a collection property with another query using a\nsubquery. To form a subquery, you must wrap the expression in parentheses\nand immediately follow it with the `.count` aggregator.\n\n```swift\n(<query>).count > n\n```\n\nIf the expression does not produce a valid subquery, you'll get an\nexception at runtime.\n\n> Example:\n> Running the following query on a `projects` collection returns projects\nwith tasks that have not been completed by a user named Alex.\n>\n> ```swift\n> let subquery = projects.where {\n>             ($0.tasks.isComplete == false && $0.tasks.assignee == \"Alex\").count > 0\n> }\n> print(\"Projects with incomplete tasks assigned to Alex: \\(subquery.count)\")\n>\n> ```\n>\n\n## NSPredicate Queries\nYou can build a filter with NSPredicate:\n\n#### Objective-C\n\n```objectivec\nNSPredicate *predicate = [NSPredicate predicateWithFormat:@\"progressMinutes > %@ AND name == %@\", @1, @\"Ali\"];\n\n```\n\n#### Swift\n\n```swift\nlet predicate = NSPredicate(format: \"progressMinutes > 1 AND name == %@\", \"Ali\")\n\n```\n\n### Expressions\nFilters consist of **expressions** in an NSPredicate. An expression consists of\none of the following:\n\n- The name (keypath) of a property of the object currently being evaluated.\n- An operator and up to two argument expression(s).\n- A value, such as a string (`'hello'`) or a number (`5`).\n\n### Dot Notation\nWhen referring to an object property, you can use **dot notation** to refer\nto child properties of that object. You can even refer to the properties of\nembedded objects and relationships with dot notation.\n\nFor example, consider a query on an object with a `workplace` property that\nrefers to a Workplace object. The Workplace object has an embedded object\nproperty, `address`. You can chain dot notations to refer to the zipcode\nproperty of that address:\n\n```objective-c\nworkplace.address.zipcode == 10012\n```\n\n### Substitutions\nYou can use the following substitutions in your predicate format strings:\n\n- `%@` to specify values\n- `%K` to specify [keypaths](https://docs.swift.org/swift-book/ReferenceManual/Expressions.html#grammar_key-path-expression)\n\n#### Objective-C\n\n```objectivec\n[NSPredicate predicateWithFormat:@\"%K > %@ AND %K == %@\", @\"progressMinutes\", @1, @\"name\", @\"Ali\"];\n\n```\n\n#### Swift\n\n```swift\nNSPredicate(format: \"%K > %@ AND %K == %@\", \"progressMinutes\", NSNumber(1), \"name\", \"Ali\")\n\n```\n\n### Operators\nThere are several types of operators available to filter a\nRealm collection. Filters\nwork by **evaluating** an operator expression for every\nobject in the collection being\nfiltered. If the expression resolves to `true`, Realm\nDatabase includes the object in the results collection.\n\n#### Comparison Operators\nThe most straightforward operation in a search is to compare\nvalues.\n\n> Important:\n> The type on both sides of the operator must be equivalent. For\nexample, comparing an ObjectId with string will result in a precondition failure with a\nmessage like:\n>\n> ```\n> \"Expected object of type object id for property 'id' on object of type\n> 'User', but received: 11223344556677889900aabb (Invalid value)\"\n> ```\n>\n> You can compare any numeric type with any other numeric type.\n>\n\n|Operator|Description|\n| --- | --- |\n|`between`|Evaluates to `true` if the left-hand numerical or date expression is between or equal to the right-hand range. For dates, this evaluates to `true` if the left-hand date is within the right-hand date range.|\n|== , =|Evaluates to `true` if the left-hand expression is equal to the right-hand expression.|\n|>|Evaluates to `true` if the left-hand numerical or date expression is greater than the right-hand numerical or date expression. For dates, this evaluates to `true` if the left-hand date is later than the right-hand date.|\n|>=|Evaluates to `true` if the left-hand numerical or date expression is greater than or equal to the right-hand numerical or date expression. For dates, this evaluates to `true` if the left-hand date is later than or the same as the right-hand date.|\n|`in`|Evaluates to `true` if the left-hand expression is in the right-hand list or string.|\n|<|Evaluates to `true` if the left-hand numerical or date expression is less than the right-hand numerical or date expression. For dates, this evaluates to `true` if the left-hand date is earlier than the right-hand date.|\n|<=|Evaluates to `true` if the left-hand numeric expression is less than or equal to the right-hand numeric expression. For dates, this evaluates to `true` if the left-hand date is earlier than or the same as the right-hand date.|\n|!= , <>|Evaluates to `true` if the left-hand expression is not equal to the right-hand expression.|\n\n> Example:\n> The following example uses the query engine's\ncomparison operators to:\n>\n> - Find high priority tasks by comparing the value of the `priority` property value with a threshold number, above which priority can be considered high.\n> - Find long-running tasks by seeing if the `progressMinutes` property is at or above a certain value.\n> - Find unassigned tasks by finding tasks where the `assignee` property is equal to `null`.\n> - Find tasks assigned to specific teammates Ali or Jamie by seeing if the `assignee` property is in a list of names.\n>\n> #### Objective-C\n>\n> ```objectivec\n> NSLog(@\"High priority tasks: %lu\",\n>       [[tasks objectsWithPredicate:[NSPredicate predicateWithFormat:@\"priority > %@\", @5]] count]);\n>\n> NSLog(@\"Short running tasks: %lu\",\n>       [[tasks objectsWhere:@\"progressMinutes between {1, 15}\"] count]);\n>\n> NSLog(@\"Unassigned tasks: %lu\",\n>       [[tasks objectsWhere:@\"assignee == nil\"] count]);\n>\n> NSLog(@\"Ali or Jamie's tasks: %lu\",\n>       [[tasks objectsWhere:@\"assignee IN {'Ali', 'Jamie'}\"] count]);\n>\n> NSLog(@\"Tasks with progress between 30 and 60 minutes: %lu\",\n>       [[tasks objectsWhere:@\"progressMinutes BETWEEN {30, 60}\"] count]);\n>\n>\n> ```\n>\n>\n> #### Swift\n>\n> ```swift\n> let highPriorityTasks = tasks.filter(\"priority > 5\")\n> print(\"High priority tasks: \\(highPriorityTasks.count)\")\n>\n> let longRunningTasks = tasks.filter(\"progressMinutes > 120\")\n> print(\"Long running tasks: \\(longRunningTasks.count)\")\n>\n> let unassignedTasks = tasks.filter(\"assignee == nil\")\n> print(\"Unassigned tasks: \\(unassignedTasks.count)\")\n>\n> let aliOrJamiesTasks = tasks.filter(\"assignee IN {'Ali', 'Jamie'}\")\n> print(\"Ali or Jamie's tasks: \\(aliOrJamiesTasks.count)\")\n>\n> let progressBetween30and60 = tasks.filter(\"progressMinutes BETWEEN {30, 60}\")\n> print(\"Tasks with progress between 30 and 60 minutes: \\(progressBetween30and60.count)\")\n>\n> ```\n>\n>\n\n#### Logical Operators\nYou can make compound predicates using logical operators.\n\n|Operator|Description|\n| --- | --- |\n|and &&|Evaluates to `true` if both left-hand and right-hand expressions are `true`.|\n|not !|Negates the result of the given expression.|\n|or \\\\|\\\\||Evaluates to `true` if either expression returns `true`.|\n\n> Example:\n> We can use the query language's logical operators to find\nall of Ali's completed tasks. That is, we find all tasks\nwhere the `assignee` property value is equal to 'Ali' AND\nthe `isComplete` property value is `true`:\n>\n> #### Objective-C\n>\n> ```objectivec\n> NSLog(@\"Ali's complete tasks: %lu\",\n>   [[tasks objectsWhere:@\"assignee == 'Ali' AND isComplete == true\"] count]);\n>\n> ```\n>\n>\n> #### Swift\n>\n> ```swift\n> let aliComplete = tasks.filter(\"assignee == 'Ali' AND isComplete == true\")\n> print(\"Ali's complete tasks: \\(aliComplete.count)\")\n>\n> ```\n>\n>\n\n#### String Operators\nYou can compare string values using these string operators.\nRegex-like wildcards allow more flexibility in search.\n\n> Note:\n> You can use the following modifiers with the string operators:\n>\n> - `[c]` for case insensitivity. `[NSPredicate predicateWithFormat: @\"name CONTAINS[c] 'f'\"]``NSPredicate(format: \"name CONTAINS[c] 'f'\")`\n> - `[d]` for diacritic insensitivity: Realm treats special characters as the base character (e.g. `é` -> `e`). `[NSPredicate predicateWithFormat: @\"name CONTAINS[d] 'e'\"]``NSPredicate(format: \"name CONTAINS[d] 'e'\")`\n>\n\n|Operator|Description|\n| --- | --- |\n|beginsWith|Evaluates to `true` if the left-hand string expression begins with the right-hand string expression. This is similar to `contains`, but only matches if the right-hand string expression is found at the beginning of the left-hand string expression.|\n|contains , in|Evaluates to `true` if the left-hand string expression is found anywhere in the right-hand string expression.|\n|endsWith|Evaluates to `true` if the left-hand string expression ends with the right-hand string expression. This is similar to `contains`, but only matches if the left-hand string expression is found at the very end of the right-hand string expression.|\n|like|Evaluates to `true` if the left-hand string expression matches the right-hand string wildcard string expression. A wildcard string expression is a string that uses normal characters with two special wildcard characters: The `*` wildcard matches zero or more of any character The `?` wildcard matches any character. For example, the wildcard string \"d?g\" matches \"dog\", \"dig\", and \"dug\", but not \"ding\", \"dg\", or \"a dog\".|\n|== , =|Evaluates to `true` if the left-hand string is lexicographically equal to the right-hand string.|\n|!= , <>|Evaluates to `true` if the left-hand string is not lexicographically equal to the right-hand string.|\n\n> Example:\n> We use the query engine's string operators to find\nprojects with a name starting with the letter 'e' and\nprojects with names that contain 'ie':\n>\n> #### Objective-C\n>\n> ```objectivec\n> // Use [c] for case-insensitivity.\n> NSLog(@\"Projects that start with 'e': %lu\",\n>   [[projects objectsWhere:@\"name BEGINSWITH[c] 'e'\"] count]);\n>\n> NSLog(@\"Projects that contain 'ie': %lu\",\n>   [[projects objectsWhere:@\"name CONTAINS 'ie'\"] count]);\n>\n> ```\n>\n>\n> #### Swift\n>\n> ```swift\n> // Use [c] for case-insensitivity.\n> let startWithE = projects.filter(\"name BEGINSWITH[c] 'e'\")\n> print(\"Projects that start with 'e': \\(startWithE.count)\")\n>\n> let containIe = projects.filter(\"name CONTAINS 'ie'\")\n> print(\"Projects that contain 'ie': \\(containIe.count)\")\n>\n> // [d] for diacritic insensitivty: contains 'e', 'E', 'é', etc.\n> let containElike = projects.filter(\"name CONTAINS[cd] 'e'\")\n> print(\"Projects that contain 'e', 'E', 'é', etc.: \\(containElike.count)\")\n>\n> ```\n>\n>\n\n> Note:\n> String sorting and case-insensitive queries are only supported for\ncharacter sets in 'Latin Basic', 'Latin Supplement', 'Latin Extended\nA', and 'Latin Extended B' (UTF-8 range 0-591).\n>\n\n#### Geospatial Operators\n> Version added: 10.47.0\n\nYou can perform a geospatial query using the `IN` operator with one\nof the SDK's provided shapes:\n\n- `GeoCircle`\n- `GeoBox`\n- `GeoPolygon`\n\nThis operator evaluates to `true` if:\n\n- An object has a geospatial data \"shape\" containing a `String` property\nwith the value of Point and a `List` containing a longitude/latitude\npair.\n- The longitude/latitude of the persisted object falls within the geospatial\nquery shape.\n\n```swift\nlet filterArguments = NSMutableArray()\nfilterArguments.add(largeBox)\nlet companiesInLargeBox = realm.objects(Geospatial_Company.self)\n    .filter(NSPredicate(format: \"location IN %@\", argumentArray: filterArguments as? [Any]))\nprint(\"Number of companies in large box: \\(companiesInLargeBox.count)\")\n\n```\n\nFor more information about querying geospatial data, refer to\nQuery Geospatial Data.\n\n#### Aggregate Operators\nYou can apply an aggregate operator to a collection property\nof a Realm object. Aggregate operators traverse a\ncollection and reduce it\nto a single value.\n\n|Operator|Description|\n| --- | --- |\n|@avg|Evaluates to the average value of a given numerical property across a collection.|\n|@count|Evaluates to the number of objects in the given collection. This is currently only supported on to-many relationship collections and not on lists of primitives. In order to use `@count` on a list of primitives, consider wrapping the primitives in a Realm object.|\n|@max|Evaluates to the highest value of a given numerical property across a collection.|\n|@min|Evaluates to the lowest value of a given numerical property across a collection.|\n|@sum|Evaluates to the sum of a given numerical property across a collection.|\n\n> Example:\n> We create a couple of filters to show different facets of\nthe data:\n>\n> - Projects with average tasks priority above 5.\n> - Long running projects.\n>\n> #### Objective-C\n>\n> ```objectivec\n> NSLog(@\"Projects with average tasks priority above 5: %lu\",\n>       [[projects objectsWhere:@\"tasks.@avg.priority > 5\"] count]);\n>\n> NSLog(@\"Projects where all tasks are lower priority: %lu\",\n>       [[projects objectsWhere:@\"tasks.@max.priority < 5\"] count]);\n>\n> NSLog(@\"Projects where all tasks are high priority: %lu\",\n>       [[projects objectsWhere:@\"tasks.@min.priority > 5\"] count]);\n>\n> NSLog(@\"Projects with more than 5 tasks: %lu\",\n>       [[projects objectsWhere:@\"tasks.@count > 5\"] count]);\n>\n> NSLog(@\"Long running projects: %lu\",\n>       [[projects objectsWhere:@\"tasks.@sum.progressMinutes > 100\"] count]);\n>\n> ```\n>\n>\n> #### Swift\n>\n> ```swift\n> let averageTaskPriorityAbove5 = projects.filter(\"tasks.@avg.priority > 5\")\n> print(\"Projects with average task priority above 5: \\(averageTaskPriorityAbove5.count)\")\n>\n> let allTasksLowerPriority = projects.filter(\"tasks.@max.priority < 5\")\n> print(\"Projects where all tasks are lower priority: \\(allTasksLowerPriority.count)\")\n>\n> let allTasksHighPriority = projects.filter(\"tasks.@min.priority > 5\")\n> print(\"Projects where all tasks are high priority: \\(allTasksHighPriority.count)\")\n>\n> let moreThan5Tasks = projects.filter(\"tasks.@count > 5\")\n> print(\"Projects with more than 5 tasks: \\(moreThan5Tasks.count)\")\n>\n> let longRunningProjects = projects.filter(\"tasks.@sum.progressMinutes > 100\")\n> print(\"Long running projects: \\(longRunningProjects.count)\")\n>\n> ```\n>\n>\n\n#### Set Operators\nA **set operator** uses specific rules to determine whether\nto pass each input collection object to the output\ncollection by applying a given predicate to every element of\na given list property of\nthe object.\n\n|Operator|Description|\n| --- | --- |\n|`ALL`|Returns objects where the predicate evaluates to `true` for all objects in the collection.|\n|`ANY`, `SOME`|Returns objects where the predicate evaluates to `true` for any objects in the collection.|\n|`NONE`|Returns objects where the predicate evaluates to false for all objects in the collection.|\n\n> Example:\n> We use the query engine's set operators to find:\n>\n> - Projects with no complete tasks.\n> - Projects with any top priority tasks.\n>\n> #### Objective-C\n>\n> ```objectivec\n> NSLog(@\"Projects with no complete tasks: %lu\",\n>   [[projects objectsWhere:@\"NONE tasks.isComplete == true\"] count]);\n>\n> NSLog(@\"Projects with any top priority tasks: %lu\",\n>   [[projects objectsWhere:@\"ANY tasks.priority == 10\"] count]);\n>\n> ```\n>\n>\n> #### Swift\n>\n> ```swift\n> let noCompleteTasks = projects.filter(\"NONE tasks.isComplete == true\")\n> print(\"Projects with no complete tasks: \\(noCompleteTasks.count)\")\n>\n> let anyTopPriorityTasks = projects.filter(\"ANY tasks.priority == 10\")\n> print(\"Projects with any top priority tasks: \\(anyTopPriorityTasks.count)\")\n>\n> ```\n>\n>\n\n### Subqueries\nYou can iterate through a collection property with another query using the\n`SUBQUERY()` predicate function. `SUBQUERY()` has the following signature:\n\n```objective-c\nSUBQUERY(<collection>, <variableName>, <predicate>)\n```\n\n- `collection`: the name of the list property to iterate through\n- `variableName`: a variable name of the current element to use in the subquery\n- `predicate`: a string that contains the subquery predicate. You can use the\nvariable name specified by `variableName` to refer to the currently iterated\nelement.\n\n> Example:\n> Running the following filter on a `projects` collection returns projects\nwith tasks that have not been completed by a user named Alex.\n>\n> #### Objective-C\n>\n> ```objectivec\n> NSPredicate *predicate = [NSPredicate predicateWithFormat:\n>                           @\"SUBQUERY(tasks, $task, $task.isComplete == %@ AND $task.assignee == %@).@count > 0\",\n>                           @NO,\n>                           @\"Alex\"];\n> NSLog(@\"Projects with incomplete tasks assigned to Alex: %lu\",\n>   [[projects objectsWithPredicate:predicate] count]);\n>\n> ```\n>\n>\n> #### Swift\n>\n> ```swift\n> let predicate = NSPredicate(\n>     format: \"SUBQUERY(tasks, $task, $task.isComplete == false AND $task.assignee == %@).@count > 0\", \"Alex\")\n> print(\"Projects with incomplete tasks assigned to Alex: \\(projects.filter(predicate).count)\")\n>\n> ```\n>\n>\n"
  },
  {
    "path": "docs/guides/crud/react-to-changes.md",
    "content": "# React to Changes - Swift SDK\nAll Realm objects are **live objects**, which means they\nautomatically update whenever they're modified. Realm emits a\nnotification event whenever any property changes. You can register a\nnotification handler to listen for these notification events, and update\nyour UI with the latest data.\n\nThis page shows how to manually register notification listeners in Swift.\nRealm SDK for Swift offers SwiftUI property wrappers to make it easy to\nautomatically update the UI when data changes. For more about how to use\nthe SwiftUI property wrappers to react to changes, refer to\nObserve an Object.\n\n## Register a Realm Change Listener\nYou can register a notification handler on an entire realm. Realm calls the notification\nhandler whenever any write transaction involving that Realm is\ncommitted. The handler receives no information about the change.\n\n#### Objective-C\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n\n// Observe realm notifications. Keep a strong reference to the notification token\n// or the observation will stop.\nRLMNotificationToken *token = [realm addNotificationBlock:^(RLMNotification  _Nonnull notification, RLMRealm * _Nonnull realm) {\n    // `notification` is an enum specifying what kind of notification was emitted.\n    // ... update UI ...\n}];\n\n// ...\n\n// Later, explicitly stop observing.\n[token invalidate];\n\n```\n\n#### Swift\n\n```swift\nlet realm = try! Realm()\n\n// Observe realm notifications. Keep a strong reference to the notification token\n// or the observation will stop.\nlet token = realm.observe { notification, realm in\n    // `notification` is an enum specifying what kind of notification was emitted\n    viewController.updateUI()\n}\n\n// ...\n\n// Later, explicitly stop observing.\ntoken.invalidate()\n\n```\n\n## Register a Collection Change Listener\nYou can register a notification handler on a collection within a\nrealm.\n\nRealm notifies your handler:\n\n- After first retrieving the collection.\n- Whenever a write transaction adds, changes, or removes objects in the collection.\n\nNotifications describe the changes since the prior notification with\nthree lists of indices: the indices of the objects that were deleted,\ninserted, and modified.\n\n> Important:\n> In collection notification handlers, always apply changes\nin the following order: deletions, insertions, then\nmodifications. Handling insertions before deletions may\nresult in unexpected behavior.\n>\n\nCollection notifications provide a `change` parameter that reports which\nobjects are deleted, added, or modified during the write transaction. This\n`RealmCollectionChange`\nresolves to an array of index paths that you can pass to a `UITableView`'s\nbatch update methods.\n\n> Important:\n> This example of a collection change listener does not support\nhigh-frequency updates. Under an intense workload, this collection\nchange listener may cause the app to throw an exception.\n>\n\n#### Objective-C\n\n```objectivec\n@interface CollectionNotificationExampleViewController : UITableViewController\n@end\n\n@implementation CollectionNotificationExampleViewController {\n    RLMNotificationToken *_notificationToken;\n}\n- (void)viewDidLoad {\n    [super viewDidLoad];\n\n    // Observe RLMResults Notifications\n    __weak typeof(self) weakSelf = self;\n    _notificationToken = [[Dog objectsWhere:@\"age > 5\"]\n      addNotificationBlock:^(RLMResults<Dog *> *results, RLMCollectionChange *changes, NSError *error) {\n\n        if (error) {\n            NSLog(@\"Failed to open realm on background worker: %@\", error);\n            return;\n        }\n\n        UITableView *tableView = weakSelf.tableView;\n        // Initial run of the query will pass nil for the change information\n        if (!changes) {\n            [tableView reloadData];\n            return;\n        }\n\n        // Query results have changed, so apply them to the UITableView\n        [tableView performBatchUpdates:^{\n            // Always apply updates in the following order: deletions, insertions, then modifications.\n            // Handling insertions before deletions may result in unexpected behavior.\n            [tableView deleteRowsAtIndexPaths:[changes deletionsInSection:0]\n                             withRowAnimation:UITableViewRowAnimationAutomatic];\n            [tableView insertRowsAtIndexPaths:[changes insertionsInSection:0]\n                             withRowAnimation:UITableViewRowAnimationAutomatic];\n            [tableView reloadRowsAtIndexPaths:[changes modificationsInSection:0]\n                             withRowAnimation:UITableViewRowAnimationAutomatic];\n        } completion:^(BOOL finished) {\n            // ...\n        }];\n    }];\n}\n@end\n\n```\n\n#### Swift\n\n```swift\nclass CollectionNotificationExampleViewController: UITableViewController {\n    var notificationToken: NotificationToken?\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        let realm = try! Realm()\n        let results = realm.objects(Dog.self)\n\n        // Observe collection notifications. Keep a strong\n        // reference to the notification token or the\n        // observation will stop.\n        notificationToken = results.observe { [weak self] (changes: RealmCollectionChange) in\n            guard let tableView = self?.tableView else { return }\n            switch changes {\n            case .initial:\n                // Results are now populated and can be accessed without blocking the UI\n                tableView.reloadData()\n            case .update(_, let deletions, let insertions, let modifications):\n                // Query results have changed, so apply them to the UITableView\n                tableView.performBatchUpdates({\n                    // Always apply updates in the following order: deletions, insertions, then modifications.\n                    // Handling insertions before deletions may result in unexpected behavior.\n                    tableView.deleteRows(at: deletions.map({ IndexPath(row: $0, section: 0)}),\n                                         with: .automatic)\n                    tableView.insertRows(at: insertions.map({ IndexPath(row: $0, section: 0) }),\n                                         with: .automatic)\n                    tableView.reloadRows(at: modifications.map({ IndexPath(row: $0, section: 0) }),\n                                         with: .automatic)\n                }, completion: { finished in\n                    // ...\n                })\n            case .error(let error):\n                // An error occurred while opening the Realm file on the background worker thread\n                fatalError(\"\\(error)\")\n            }\n        }\n    }\n}\n\n```\n\n## Register an Object Change Listener\nYou can register a notification handler on a specific object\nwithin a realm. Realm notifies your handler:\n\n- When the object is deleted.\n- When any of the object's properties change.\n\nThe handler receives information about what fields changed\nand whether the object was deleted.\n\n#### Objective-C\n\n```objectivec\n@interface Dog : RLMObject\n@property NSString *name;\n@property int age;\n@end\n\n@implementation Dog\n@end\n\nRLMNotificationToken *objectNotificationToken = nil;\n\nvoid objectNotificationExample() {\n    Dog *dog = [[Dog alloc] init];\n    dog.name = @\"Max\";\n    dog.age = 3;\n    \n    // Open the default realm\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm transactionWithBlock:^{\n        [realm addObject:dog];\n    }];\n\n    // Observe object notifications. Keep a strong reference to the notification token\n    // or the observation will stop. Invalidate the token when done observing.\n    objectNotificationToken = [dog addNotificationBlock:^(BOOL deleted, NSArray<RLMPropertyChange *> * _Nullable changes, NSError * _Nullable error) {\n        if (error != nil) {\n            NSLog(@\"An error occurred: %@\", [error localizedDescription]);\n            return;\n        }\n        if (deleted) {\n            NSLog(@\"The object was deleted.\");\n            return;\n        }\n        NSLog(@\"Property %@ changed to '%@'\",\n              changes[0].name,\n              changes[0].value);\n    }];\n\n    // Now update to trigger the notification\n    [realm transactionWithBlock:^{\n        dog.name = @\"Wolfie\";\n    }];\n\n}\n\n```\n\n#### Swift\n\n```swift\n// Define the dog class.\nclass Dog: Object {\n    @Persisted var name = \"\"\n}\n\nvar objectNotificationToken: NotificationToken?\n\nfunc objectNotificationExample() {\n    let dog = Dog()\n    dog.name = \"Max\"\n\n    // Open the default realm.\n    let realm = try! Realm()\n    try! realm.write {\n        realm.add(dog)\n    }\n    // Observe object notifications. Keep a strong reference to the notification token\n    // or the observation will stop. Invalidate the token when done observing.\n    objectNotificationToken = dog.observe { change in\n        switch change {\n        case .change(let object, let properties):\n            for property in properties {\n                print(\"Property '\\(property.name)' of object \\(object) changed to '\\(property.newValue!)'\")\n            }\n        case .error(let error):\n            print(\"An error occurred: \\(error)\")\n        case .deleted:\n            print(\"The object was deleted.\")\n        }\n    }\n\n    // Now update to trigger the notification\n    try! realm.write {\n        dog.name = \"Wolfie\"\n    }\n}\n\n```\n\n## Register a Key Path Change Listener\n> Version added: 10.12.0\n\nIn addition to registering a notification handler on an `object`\nor `collection`, you can pass an optional string `keyPaths` parameter to specify the key path or\nkey paths to watch.\n\n> Example:\n> ```swift\n> // Define the dog class.\n> class Dog: Object {\n>     @Persisted var name = \"\"\n>     @Persisted var favoriteToy = \"\"\n>     @Persisted var age: Int?\n> }\n>\n> var objectNotificationToken: NotificationToken?\n>\n> func objectNotificationExample() {\n>     let dog = Dog()\n>     dog.name = \"Max\"\n>     dog.favoriteToy = \"Ball\"\n>     dog.age = 2\n>\n>     // Open the default realm.\n>     let realm = try! Realm()\n>     try! realm.write {\n>         realm.add(dog)\n>     }\n>     // Observe notifications on some of the object's key paths. Keep a strong\n>     // reference to the notification token or the observation will stop.\n>     // Invalidate the token when done observing.\n>     objectNotificationToken = dog.observe(keyPaths: [\"favoriteToy\", \"age\"], { change in\n>         switch change {\n>         case .change(let object, let properties):\n>             for property in properties {\n>                 print(\"Property '\\(property.name)' of object \\(object) changed to '\\(property.newValue!)'\")\n>             }\n>         case .error(let error):\n>             print(\"An error occurred: \\(error)\")\n>         case .deleted:\n>             print(\"The object was deleted.\")\n>         }\n>     })\n>\n>     // Now update to trigger the notification\n>     try! realm.write {\n>         dog.favoriteToy = \"Frisbee\"\n>     }\n>     // When you specify one or more key paths, changes to other properties\n>     // do not trigger notifications. In this example, changing the \"name\"\n>     // property does not trigger a notification.\n>     try! realm.write {\n>         dog.name = \"Maxamillion\"\n>     }\n> }\n> ```\n>\n\n> Version added: 10.14.0\n\nYou can `observe`\na partially type-erased [PartialKeyPath](https://developer.apple.com/documentation/swift/partialkeypath)\non `Objects` or `RealmCollections`.\n\n```swift\nobjectNotificationToken = dog.observe(keyPaths: [\\Dog.favoriteToy, \\Dog.age], { change in\n```\n\nWhen you specify `keyPaths`, *only* changes to those\n`keyPaths` trigger notification blocks. Any other changes do not trigger\nnotification blocks.\n\n> Example:\n> Consider a `Dog` object where one of its properties is a list of\n`siblings`:\n>\n> ```swift\n> class Dog: Object {\n>     @Persisted var name = \"\"\n>     @Persisted var siblings: List<Dog>\n>     @Persisted var age: Int?\n> }\n> ```\n>\n> If you pass `siblings` as a `keyPath` to observe, any insertion,\ndeletion, or modification to the `siblings` list would trigger a\nnotification. However, a change to `someSibling.name` would not trigger\na notification, unless you explicitly observed `[\"siblings.name\"]`.\n>\n\n> Note:\n> Multiple notification tokens on the same object which filter for\nseparate key paths *do not* filter exclusively. If one key path\nchange is satisfied for one notification token, then all notification\ntoken blocks for that object will execute.\n>\n\n### Realm Collections\nWhen you observe key paths on the various collection types, expect these\nbehaviors:\n\n- `LinkingObjects`:\nObserving a property of the LinkingObject triggers a notification for a\nchange to that property, but does not trigger notifications for changes to\nits other properties. Insertions or deletions to the list or the object\nthat the list is on trigger a notification.\n- `Lists`:\nObserving a property of the list's object will triggers a notification for\na change to that property, but does not trigger notifications for changes\nto its other properties. Insertions or deletions to the list or the object\nthat the list is on trigger a notification.\n- `Map`:\nObserving a property of the map's object triggers a notification for a change\nto that property, but does not trigger notifications for changes to its other\nproperties. Insertions or deletions to the Map or the object that the map is\non trigger a notification. The `change` parameter reports, in the form of\nkeys within the map, which key-value pairs are added, removed, or modified\nduring each write transaction.\n- `MutableSet`:\nObserving a property of a MutableSet's object triggers a notification\nfor a change to that property, but does not trigger notifications for changes\nto its other properties. Insertions or deletions to the MutableSet or the\nobject that the MutableSet is on trigger a notification.\n- `Results`:\nObserving a property of the Result triggers a notification for a change to\nthat property, but does not trigger notifications for changes to its other\nproperties. Insertions or deletions to the Result trigger a notification.\n\n## Write Silently\nYou can write to a realm *without* sending a notification to a\nspecific observer by passing the observer's notification token in an\narray to `realm.write(withoutNotifying:_)`:\n\n#### Objective-C\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n\n// Observe realm notifications\nRLMNotificationToken *token = [realm addNotificationBlock:^(RLMNotification  _Nonnull notification, RLMRealm * _Nonnull realm) {\n    // ... handle update\n}];\n\n// Later, pass the token in an array to the realm's `-transactionWithoutNotifying:block:` method.\n// Realm will _not_ notify the handler after this write.\n[realm transactionWithoutNotifying:@[token] block:^{\n   // ... write to realm\n}];\n\n// Finally\n[token invalidate];\n\n```\n\n#### Swift\n\n```swift\nlet realm = try! Realm()\n\n// Observe realm notifications\nlet token = realm.observe { notification, realm in\n    // ... handle update\n}\n\n// Later, pass the token in an array to the realm.write(withoutNotifying:)\n// method to write without sending a notification to that observer.\ntry! realm.write(withoutNotifying: [token]) {\n    // ... write to realm\n}\n\n// Finally\ntoken.invalidate()\n\n```\n\n## Stop Watching for Changes\nObservation stops when the token returned by an `observe` call becomes\ninvalid. You can explicitly invalidate a token by calling its\n`invalidate()` method.\n\n> Important:\n> Notifications stop if the token is in a local variable that goes out\nof scope.\n>\n\n#### Objective-C\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n\n// Observe and obtain token\nRLMNotificationToken *token = [realm addNotificationBlock:^(RLMNotification  _Nonnull notification, RLMRealm * _Nonnull realm) {\n    /* ... */\n}];\n\n// Stop observing\n[token invalidate];\n\n```\n\n#### Swift\n\n```swift\nlet realm = try! Realm()\n\n// Observe and obtain token\nlet token = realm.observe { notification, realm in /* ... */ }\n\n// Stop observing\ntoken.invalidate()\n\n```\n\n## Key-value Observation\n### Key-value Observation Compliance\nRealm objects are [key-value observing (KVO)\ncompliant](https://developer.apple.com/documentation/swift/cocoa_design_patterns/using_key-value_observing_in_swift)\nfor most properties:\n\n- Almost all managed (non-ignored) properties on `Object` subclasses\n- The `invalidated` property on `Object` and `List`\n\nYou cannot observe `LinkingObjects` properties via Key-value observation.\n\n> Important:\n> You cannot add an object to a realm (with `realm.add(obj)` or similar\nmethods) while it has any registered observers.\n>\n\n### Managed vs. Unmanaged KVO Considerations\nObserving the properties of unmanaged instances of `Object` subclasses\nworks like any other dynamic property.\n\nObserving the properties of managed objects works differently. With\nrealm-managed objects, the value of a property may change when:\n\n- You assign to it\n- The realm is refreshed, either manually with `realm.refresh()` or\nautomatically on a runloop thread\n- You begin a write transaction after changes on another thread\n\nRealm applies changes made in the write transaction(s) on other threads\nat once. Observers see Key-value observation notifications at once.\nIntermediate steps do not trigger KVO notifications.\n\n> Example:\n> Say your app performs a write transaction that increments a property\nfrom 1 to 10. On the main thread, you get a single notification of a\nchange directly from 1 to 10. You won't get notifications for every\nincremental change between 1 and 10.\n>\n\nAvoid modifying managed Realm objects from within\n`observeValueForKeyPath(_:ofObject:change:context:)`. Property values\ncan change when not in a write transaction, or as part of beginning a\nwrite transaction.\n\n### Observing Realm Lists\nObserving changes made to Realm `List` properties is simpler than\n`NSMutableArray` properties:\n\n- You don't have to mark `List` properties as dynamic to observe them.\n- You can call modification methods on `List` directly. Anyone observing\nthe property that stores it gets a notification.\n\nYou don't need to use `mutableArrayValueForKey(_:)`, although realm\ndoes support this for code compatibility.\n\n> Seealso:\n> Examples of using Realm with [ReactiveCocoa from Objective-C](https://github.com/realm/realm-swift/tree/master/examples/ios/objc/TableView),\nand [ReactKit from Swift](https://github.com/realm/realm-swift/tree/v2.3.0/examples/ios/swift-2.2/ReactKit).\n>\n\n## React to Changes on a Different Actor\nYou can observe notifications on a different actor. Calling\n`await object.observe(on: Actor)` or\n`await collection.observe(on: Actor)` registers a block to be called each\ntime the object or collection changes.\n\n```swift\n// Create a simple actor\nactor BackgroundActor {\n    public func deleteTodo(tsrToTodo tsr: ThreadSafeReference<Todo>) throws {\n        let realm = try! Realm()\n        try realm.write {\n            // Resolve the thread safe reference on the Actor where you want to use it.\n            // Then, do something with the object.\n            let todoOnActor = realm.resolve(tsr)\n            realm.delete(todoOnActor!)\n        }\n    }\n}\n\n// Execute some code on a different actor - in this case, the MainActor\n@MainActor\nfunc mainThreadFunction() async throws {\n    let backgroundActor = BackgroundActor()\n    let realm = try! await Realm()\n\n    // Create a todo item so there is something to observe\n    try await realm.asyncWrite {\n        realm.create(Todo.self, value: [\n            \"_id\": ObjectId.generate(),\n            \"name\": \"Arrive safely in Bree\",\n            \"owner\": \"Merry\",\n            \"status\": \"In Progress\"\n        ])\n    }\n\n    // Get the collection of todos on the current actor\n    let todoCollection = realm.objects(Todo.self)\n\n    // Register a notification token, providing the actor where you want to observe changes.\n    // This is only required if you want to observe on a different actor.\n    let token = await todoCollection.observe(on: backgroundActor, { actor, changes in\n        print(\"A change occurred on actor: \\(actor)\")\n        switch changes {\n        case .initial:\n            print(\"The initial value of the changed object was: \\(changes)\")\n        case .update(_, let deletions, let insertions, let modifications):\n            if !deletions.isEmpty {\n                print(\"An object was deleted: \\(changes)\")\n            } else if !insertions.isEmpty {\n                print(\"An object was inserted: \\(changes)\")\n            } else if !modifications.isEmpty {\n                print(\"An object was modified: \\(changes)\")\n            }\n        case .error(let error):\n            print(\"An error occurred: \\(error.localizedDescription)\")\n        }\n    })\n\n    // Update an object to trigger the notification.\n    // This example triggers a notification that the object is deleted.\n    // We can pass a thread-safe reference to an object to update it on a different actor.\n    let todo = todoCollection.where {\n        $0.name == \"Arrive safely in Bree\"\n    }.first!\n    let threadSafeReferenceToTodo = ThreadSafeReference(to: todo)\n    try await backgroundActor.deleteTodo(tsrToTodo: threadSafeReferenceToTodo)\n\n    // Invalidate the token when done observing\n    token.invalidate()\n}\n\n```\n\nFor more information about change notifications on another actor,\nrefer to Observe Notifications on a Different Actor.\n\n## React to Changes to a Class Projection\nLike other realm objects, you can react to changes\nto a class projection. When you register a class projection change listener,\nyou see notifications for changes made through the class projection object\ndirectly. You also see notifications for changes to the underlying object's\nproperties that project through the class projection object.\n\nProperties on the underlying object that are not `@Projected` in the\nclass projection do not generate notifications.\n\nThis notification block fires for changes in:\n\n- `Person.firstName` property of the class projection's underlying\n`Person` object, but not changes to `Person.lastName` or\n`Person.friends`.\n- `PersonProjection.firstName` property, but not another class projection\nthat uses the same underlying object's property.\n\n```swift\nlet realm = try! Realm()\nlet projectedPerson = realm.objects(PersonProjection.self).first(where: { $0.firstName == \"Jason\" })!\nlet token = projectedPerson.observe(keyPaths: [\"firstName\"], { change in\n    switch change {\n    case .change(let object, let properties):\n        for property in properties {\n            print(\"Property '\\(property.name)' of object \\(object) changed to '\\(property.newValue!)'\")\n        }\n    case .error(let error):\n        print(\"An error occurred: \\(error)\")\n    case .deleted:\n        print(\"The object was deleted.\")\n    }\n})\n\n// Now update to trigger the notification\ntry! realm.write {\n    projectedPerson.firstName = \"David\"\n}\n\n```\n\n## Notification Delivery\nNotification delivery can vary depending on:\n\n- Whether or not the notification occurs within a write transaction\n- The relative threads of the write and the observation\n\nWhen your application relies on the timing of notification delivery, such\nas when you use notifications to update a `UITableView`, it's important\nto understand the specific behaviors for your application code's context.\n\n### Perform Writes Only on a Different Thread than the Observing Thread\nReading an observed collection or object from inside a change notification\nalways accurately tells you what has changed in the collection passed to\nthe callback since the last time the callback was invoked.\n\nReading collections or objects outside of change notifications always gives\nyou the exact same values you saw in the most recent change notification\nfor that object.\n\nReading objects other than the observed one *inside* a change notification\nmay see a different value prior to the notification for that change being\ndelivered. Realm `refresh` brings the entire realm from 'old version' to\n'latest version' in one operation. However, there might have been multiple\nchange notifications fired between 'old version' and 'latest version'. Inside\na callback, you may see changes that have pending notifications.\n\nWrites on different threads eventually become visible on the observing\nthread. Explicitly calling `refresh()` blocks until the writes made on\nother threads are visible and the appropriate notifications have been sent.\nIf you call `refresh()` within a notification callback, it's a no-op.\n\n### Perform Writes on the Observing Thread, Outside of Notifications\nAt the start of the write transaction all behaviors above apply to this\ncontext. Additionally, you can expect to always see the latest version of\nthe data.\n\nInside a write transaction, the only changes you see are those you've made\nso far within the write transaction.\n\nBetween committing a write transaction and the next set of change\nnotifications being sent, you can see the changes you made in the write\ntransaction, but no other changes. Writes made on different threads do\nnot become visible until you receive the next set of notifications.\nPerforming another write on the same thread sends notifications for the\nprevious write first.\n\n### Perform Writes Inside of Notifications\nWhen you perform writes within notifications, you see many of the same\nbehaviors above, with a few exceptions.\n\nCallbacks invoked before the one that performed a write behave normally.\nWhile Realm invokes change callbacks in a stable order, this is not strictly\nthe order in which you added the observations.\n\nIf beginning the write refreshes the realm, which can happen if another\nthread is making writes, this triggers recursive notifications. These\nnested notifications report the changes made since the last call to the\ncallback. For callbacks before the one making the write, this means the\ninner notification reports only the changes made after the ones already\nreported in the outer notification. If the callback making the write tries\nto write again in the inner notification, Realm throws an exception.\nThe callbacks after the one making the write get a single notification for\nboth sets of changes.\n\nAfter the callback completes the write and returns, Realm does not invoke\nany of the subsequent callbacks as they no longer have any changes to report.\nRealm provides a notification later for the write as if the write had happened\noutside of a notification.\n\nIf beginning the write doesn't refresh the realm, the write happens as\nusual. However, Realm invokes the subsequent callbacks in an inconsistent\nstate. They continue to report the original change information, but the\nobserved object/collection now includes the changes from the write made\nin the previous callback.\n\nIf you try to perform manual checks and write handling to get more fine-grained\nnotifications from within a write transaction, you can get notifications\nnested more than two levels deep. An example of a manual write handling is\nchecking `realm.isInWriteTransaction`, and if so making changes, calling\n`realm.commitWrite()` and then `realm.beginWrite()`. The nested\nnotifications and potential for error make this manual manipulation\nerror-prone and difficult to debug.\n\nYou can use the writeAsync API to sidestep complexity\nif you don't need fine-grained change information from inside your write block.\nObserving an async write similar to this provides notifications even if the\nnotification happens to be delivered inside a write transaction:\n\n```swift\nlet token = dog.observe(keyPaths: [\\Dog.age]) { change in\n   guard case let .change(dog, _) = change else { return }\n   dog.realm!.writeAsync {\n      dog.isPuppy = dog.age < 2\n   }\n}\n```\n\nHowever, because the write is async the realm may have changed between the\nnotification and when the write happens. In this case, the change information\npassed to the notification may no longer be applicable.\n\n### Updating a UITableView Based on Notifications\nIf you only update a `UITableView` via notifications, in the time between\na write transaction and the next notification arriving, the TableView's\nstate is out of sync with the data. The TableView could have a pending update\nscheduled, which can appear to cause delayed or inconsistent updates.\n\nYou can address these behaviors in a few ways.\n\nThe following examples use this very basic `UITableViewController`.\n\n```swift\nclass TableViewController: UITableViewController {\n    let realm = try! Realm()\n    let results = try! Realm().objects(DemoObject.self).sorted(byKeyPath: \"date\")\n    var notificationToken: NotificationToken!\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n\n        tableView.register(UITableViewCell.self, forCellReuseIdentifier: \"cell\")\n\n        notificationToken = results.observe { (changes: RealmCollectionChange) in\n            switch changes {\n            case .initial:\n                self.tableView.reloadData()\n            case .update(_, let deletions, let insertions, let modifications):\n                // Always apply updates in the following order: deletions, insertions, then modifications.\n                // Handling insertions before deletions may result in unexpected behavior.\n                self.tableView.beginUpdates()\n                self.tableView.deleteRows(at: deletions.map { IndexPath(row: $0, section: 0) }, with: .automatic)\n                self.tableView.insertRows(at: insertions.map { IndexPath(row: $0, section: 0) }, with: .automatic)\n                self.tableView.reloadRows(at: modifications.map { IndexPath(row: $0, section: 0) }, with: .automatic)\n                self.tableView.endUpdates()\n            case .error(let err):\n                fatalError(\"\\(err)\")\n            }\n        }\n    }\n\n    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n        return results.count\n    }\n\n    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n        let object = results[indexPath.row]\n        let cell = tableView.dequeueReusableCell(withIdentifier: \"cell\", for: indexPath)\n        cell.textLabel?.text = object.title\n        return cell\n    }\n\n    func delete(at index: Int) throws {\n        try realm.write {\n            realm.delete(results[index])\n        }\n    }\n}\n\n```\n\n#### Update the UITableView Directly Without a Notification\nUpdating the `UITableView` directly without waiting for a notification\nprovides the most responsive UI. This code updates the TableView immediately\ninstead of requiring hops between threads, which add a small amount of\nlag to each update. The downside is that it requires frequent manual\nupdates to the view.\n\n```swift\nfunc delete(at index: Int) throws {\n    try realm.write(withoutNotifying: [notificationToken]) {\n        realm.delete(results[index])\n    }\n    tableView.deleteRows(at: [IndexPath(row: index, section: 0)], with: .automatic)\n}\n\n```\n\n#### Force a Refresh After a Write\nForcing a `refresh()` after a write provides the notifications from the\nwrite immediately rather than on a future run of the run loop. There's no\nwindow for the TableView to read out-of-sync values.\n\nThe downside is that this means things we recommend doing in the background,\nsuch as writing, rerunning the query and re-sorting the results, happen\non the main thread. When these operations are computationally expensive,\nthis can cause delays on the main thread.\n\n```swift\nfunc delete(at index: Int) throws {\n    try realm.write {\n        realm.delete(results[index])\n    }\n    realm.refresh()\n}\n\n```\n\n#### Perform the Write on a Background Thread\nPerforming a write on a background thread blocks the main thread for the\nleast amount of time. However, the code to perform a write on the background\nrequires more familiarity with Realm's threading model and Swift DispatchQueue\nusage. Since the write doesn't happen on the main thread, the main thread\nnever sees the write before the notifications arrive.\n\n```swift\nfunc delete(at index: Int) throws {\n    func delete(at index: Int) throws {\n        @ThreadSafe var object = results[index]\n        DispatchQueue.global().async {\n            guard let object = object else { return }\n            let realm = object.realm!\n            try! realm.write {\n                if !object.isInvalidated {\n                    realm.delete(object)\n                }\n            }\n        }\n    }\n}\n\n```\n\n## Change Notification Limits\nChanges in nested documents deeper than four levels down do not trigger\nchange notifications.\n\nIf you have a data structure where you need to listen for changes five\nlevels down or deeper, workarounds include:\n\n- Refactor the schema to reduce nesting.\n- Add something like \"push-to-refresh\" to enable users to manually refresh data.\n\nIn the Swift SDK, you can also use\nkey path filtering to work\naround this limitation. This feature is not available in the other SDKs.\n"
  },
  {
    "path": "docs/guides/crud/read.md",
    "content": "# CRUD - Read - Swift SDK\n## Read from a Realm\nA read from a realm generally consists of the following\nsteps:\n\n- Get all objects of a certain type from the realm.\n- Optionally, filter the results.\n- Optionally, sort the results.\n- Alternately, get all objects of a certain type, divided into\nsections. As with regular results, you can\nfilter and sort sectioned results.\n\nQuery, filter, and sort operations return either a results or\nSectionedResults collection. These\ncollections are live, meaning they always contain the latest\nresults of the associated query.\n\n### Read Characteristics\nWhen you design your app's data access patterns around the\nfollowing three key characteristics of reads in Realm,\nyou can be confident you are reading data as\nefficiently as possible.\n\n#### Results Are Not Copies\nResults to a query are not copies of your data: modifying\nthe results of a query will modify the data on disk\ndirectly. This memory mapping also means that results are\n**live**: that is, they always reflect the current state on\ndisk.\n\nSee also: Collections are Live.\n\n#### Results Are Lazy\nRealm only runs a query when you actually request the\nresults of that query. This lazy evaluation enables you to write\nelegant, highly performant code for handling large data sets and complex\nqueries. You can chain several filter and sort operations without requiring extra work to process the\nintermediate state.\n\n#### References Are Retained\nOne benefit of Realm's object model is that\nRealm automatically retains all of an object's\nrelationships as direct\nreferences, so you can traverse your graph of relationships\ndirectly through the results of a query.\n\nA **direct reference**, or pointer, allows you to access a\nrelated object's properties directly through the reference.\n\nOther databases typically copy objects from database storage\ninto application memory when you need to work with them\ndirectly. Because application objects contain direct\nreferences, you are left with a choice: copy the object\nreferred to by each direct reference out of the database in\ncase it's needed, or just copy the foreign key for each\nobject and query for the object with that key if it's\naccessed. If you choose to copy referenced objects into\napplication memory, you can use up a lot of resources for\nobjects that are never accessed, but if you choose to only\ncopy the foreign key, referenced object lookups can cause\nyour application to slow down.\n\nRealm bypasses all of this using zero-copy\nlive objects. Realm object accessors point\ndirectly into database storage using memory mapping, so there is no\ndistinction between the objects in Realm and the results\nof your query in application memory. Because of this, you can traverse\ndirect references across an entire realm from any query result.\n\n### Limiting Query Results\nAs a result of lazy evaluation, you do not need any special mechanism to\nlimit query results with Realm. For example, if your query\nmatches thousands of objects, but you only want to load the first ten,\nsimply access only the first ten elements of the results collection.\n\n### Pagination\nThanks to lazy evaluation, the common task of pagination becomes quite\nsimple. For example, suppose you have a results collection associated\nwith a query that matches thousands of objects in your realm. You\ndisplay one hundred objects per page. To advance to any page, simply\naccess the elements of the results collection starting at the index that\ncorresponds to the target page.\n\n## Read Realm Objects\n### About The Examples On This Page\nThe examples on this page use the following models:\n\n#### Objective-C\n\n```objectivec\n// DogToy.h\n@interface DogToy : RLMObject\n@property NSString *name;\n@end\n\n// Dog.h\n@interface Dog : RLMObject\n@property NSString *name;\n@property int age;\n@property NSString *color;\n\n// To-one relationship\n@property DogToy *favoriteToy;\n\n@end\n\n// Enable Dog for use in RLMArray\nRLM_COLLECTION_TYPE(Dog)\n\n// Person.h\n// A person has a primary key ID, a collection of dogs, and can be a member of multiple clubs.\n@interface Person : RLMObject\n@property int _id;\n@property NSString *name;\n\n// To-many relationship - a person can have many dogs\n@property RLMArray<Dog *><Dog> *dogs;\n\n// Inverse relationship - a person can be a member of many clubs\n@property (readonly) RLMLinkingObjects *clubs;\n@end\n\nRLM_COLLECTION_TYPE(Person)\n\n// DogClub.h\n@interface DogClub : RLMObject\n@property NSString *name;\n@property RLMArray<Person *><Person> *members;\n@end\n\n// Dog.m\n@implementation Dog\n@end\n\n// DogToy.m\n@implementation DogToy\n@end\n\n// Person.m\n@implementation Person\n// Define the primary key for the class\n+ (NSString *)primaryKey {\n    return @\"_id\";\n}\n\n// Define the inverse relationship to dog clubs\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{\n        @\"clubs\": [RLMPropertyDescriptor descriptorWithClass:DogClub.class propertyName:@\"members\"],\n    };\n}\n@end\n\n// DogClub.m\n@implementation DogClub\n@end\n\n```\n\n#### Swift\n\n```swift\nclass DogToy: Object {\n    @Persisted var id: ObjectId\n    @Persisted var name = \"\"\n}\n\nclass Dog: Object {\n    @Persisted var name = \"\"\n    @Persisted var age = 0\n    @Persisted var color = \"\"\n    @Persisted var currentCity = \"\"\n    @Persisted var citiesVisited: MutableSet<String>\n    @Persisted var companion: AnyRealmValue\n\n    // To-one relationship\n    @Persisted var favoriteToy: DogToy?\n\n    // Map of city name -> favorite park in that city\n    @Persisted var favoriteParksByCity: Map<String, String>\n    \n    // Computed variable that is not persisted, but only\n    // used to section query results.\n    var firstLetter: String {\n        return name.first.map(String.init(_:)) ?? \"\"\n    }\n}\nclass Person: Object {\n    @Persisted(primaryKey: true) var id = 0\n    @Persisted var name = \"\"\n\n    // To-many relationship - a person can have many dogs\n    @Persisted var dogs: List<Dog>\n\n    // Inverse relationship - a person can be a member of many clubs\n    @Persisted(originProperty: \"members\") var clubs: LinkingObjects<DogClub>\n\n    // Embed a single object.\n    // Embedded object properties must be marked optional.\n    @Persisted var address: Address?\n\n    convenience init(name: String, address: Address) {\n        self.init()\n        self.name = name\n        self.address = address\n    }\n}\n\nclass DogClub: Object {\n    @Persisted var name = \"\"\n    @Persisted var members: List<Person>\n\n    // DogClub has an array of regional office addresses.\n    // These are embedded objects.\n    @Persisted var regionalOfficeAddresses: List<Address>\n\n    convenience init(name: String, addresses: [Address]) {\n        self.init()\n        self.name = name\n        self.regionalOfficeAddresses.append(objectsIn: addresses)\n    }\n}\n\nclass Address: EmbeddedObject {\n    @Persisted var street: String?\n    @Persisted var city: String?\n    @Persisted var country: String?\n    @Persisted var postalCode: String?\n}\n\n```\n\n### Find a Specific Object by Primary Key\n#### Objective-C\n\nIf you know the primary key for\na given object, you can look it up directly with\n`+[RLMObject objectForPrimaryKey:]`.\n\n```objectivec\n// Get a specific person from the default realm\nPerson *specificPerson = [Person objectForPrimaryKey:@12345];\n\n```\n\n#### Swift\n\nIf you know the primary key for a given\nobject, you can look it up directly with\n`Realm.object(ofType:forPrimaryKey:)`.\n\n```swift\nlet realm = try! Realm()\n\nlet specificPerson = realm.object(ofType: Person.self, forPrimaryKey: 12345)\n\n```\n\n### Query All Objects of a Given Type\n#### Objective-C\n\nTo query for objects of a given type in a realm, pass the realm\ninstance to `+[YourRealmObjectClass allObjectsInRealm:]`.\nReplace `YourRealmObjectClass` with your Realm object class\nname. This returns an `RLMResults` object representing all objects of the\ngiven type in the realm.\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n\nRLMResults *dogs = [Dog allObjectsInRealm:realm];\nRLMResults *people = [Person allObjectsInRealm:realm];\n\n```\n\n#### Swift\n\nTo query for objects of a given type in a realm, pass the metatype\ninstance `YourClassName.self` to `Realm.objects(_)`.\nThis returns a `Results` object\nrepresenting all objects of the given type in the realm.\n\n```swift\nlet realm = try! Realm()\n// Access all dogs in the realm\nlet dogs = realm.objects(Dog.self)\n\n```\n\n### Filter Queries Based on Object Properties\nA filter selects a subset of results based on the value(s) of one or\nmore object properties. Realm provides a full-featured\nquery engine that you can use to define filters.\n\n#### Swift\n\n> Version added: 10.19.0\n\nTo use the Realm Swift Query API,\ncall `.where` with a closure that\ncontains a query expression as an argument.\n\n```swift\nlet realm = try! Realm()\n// Access all dogs in the realm\nlet dogs = realm.objects(Dog.self)\n\n// Query by age\nlet puppies = dogs.where {\n    $0.age < 2\n}\n\n// Query by person\nlet dogsWithoutFavoriteToy = dogs.where {\n    $0.favoriteToy == nil\n}\n\n// Query by person's name\nlet dogsWhoLikeTennisBalls = dogs.where {\n    $0.favoriteToy.name == \"Tennis ball\"\n}\n\n```\n\n#### Swift Nspredicate\n\nTo filter, call `Results.filter(_:)`\nwith a query predicate.\n\n```swift\nlet realm = try! Realm()\n// Access all dogs in the realm\nlet dogs = realm.objects(Dog.self)\n\n// Filter by age\nlet puppies = dogs.filter(\"age < 2\")\n\n// Filter by person\nlet dogsWithoutFavoriteToy = dogs.filter(\"favoriteToy == nil\")\n\n// Filter by person's name\nlet dogsWhoLikeTennisBalls = dogs.filter(\"favoriteToy.name == 'Tennis ball'\")\n\n```\n\n#### Objective-C\n\nTo filter, call `-[RLMResults objectsWhere:]`\nwith a query predicate.\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n\n// Access all dogs in the realm\nRLMResults *dogs = [Dog allObjectsInRealm:realm];\n\n// Filter by age\nRLMResults *puppies = [dogs objectsWhere:@\"age < 2\"];\n\n// Filter by favorite toy\nRLMResults *dogsWithoutFavoriteToy = [dogs objectsWhere:@\"favoriteToy == nil\"];\n\n// Filter by favorite toy's name\nRLMResults *dogsWhoLikeTennisBalls = [dogs objectsWhere:@\"favoriteToy.name == %@\", @\"Tennis ball\"];\n\n```\n\n> Tip:\n> To filter a query based on a property of an embedded object or a related object, use dot-notation as if it were\nin a regular, nested object.\n>\n\n### Filter on Object ID Properties\nThe types in your predicate must match the types of the\nproperties. Avoid comparing\n`ObjectId` properties to strings, as\nRealm does not automatically convert strings to ObjectIds.\n\n#### Swift\n\n> Version added: 10.19.0\n\nThe Realm Swift Query API's built-in type safety simplifies writing a\nquery with an ObjectId:\n\n```swift\nlet realm = try! Realm()\n\nlet dogToys = realm.objects(DogToy.self)\n\n// Get specific user by ObjectId id\nlet specificToy = dogToys.where {\n    $0.id == ObjectId(\"11223344556677889900aabb\")\n}\n\n```\n\n#### Swift Nspredicate\n\nThe following example shows the correct and incorrect way to write a\nquery with an ObjectId given the following Realm object:\n\n```swift\nlet realm = try! Realm()\n\nlet dogToys = realm.objects(DogToy.self)\n\n// Get specific toy by ObjectId id\nlet specificToy = dogToys.filter(\"id = %@\", ObjectId(\"11223344556677889900aabb\")).first\n\n// WRONG: Realm will not convert the string to an object id\n// users.filter(\"id = '11223344556677889900aabb'\") // not ok\n// users.filter(\"id = %@\", \"11223344556677889900aabb\") // not ok\n\n```\n\n### Query a Relationship\nYou can query through a relationship the same way you would access a\nmember of a regular Swift or Objective-C object.\n\n#### Objective-C\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n\n// Establish a relationship\nDog *dog = [[Dog alloc] init];\ndog.name = @\"Rex\";\ndog.age = 10;\n\nPerson *person = [[Person alloc] init];\nperson._id = 12345;\n[person.dogs addObject:dog];\n\n[realm transactionWithBlock:^() {\n    [realm addObject:person];\n}];\n\n// Later, query the specific person\nPerson *specificPerson = [Person objectForPrimaryKey:@12345];\n\n// Access directly through a relationship\nNSLog(@\"# dogs: %lu\", [specificPerson.dogs count]);\nNSLog(@\"First dog's name: %@\", specificPerson.dogs[0].name);\n\n```\n\n#### Swift\n\n```swift\nlet realm = try! Realm()\n\n// Establish a relationship\nlet dog = Dog()\ndog.name = \"Rex\"\ndog.age = 10\n\nlet person = Person()\nperson.id = 12345\nperson.dogs.append(dog)\n\ntry! realm.write {\n    realm.add(person)\n}\n\n// Later, query the specific person\nlet specificPerson = realm.object(ofType: Person.self, forPrimaryKey: 12345)\n\n// Access directly through a relationship\nlet specificPersonDogs = specificPerson!.dogs\nlet firstDog = specificPersonDogs[0]\nprint(\"# dogs: \\(specificPersonDogs.count)\")\nprint(\"First dog's name: \\(firstDog.name)\")\n\n```\n\n### Query an Inverse Relationship\nYou can query through an inverse relationship the same way you would\naccess a member of a regular Swift or Objective-C object.\n\n#### Objective-C\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n\n// Establish a relationship\nPerson *person = [[Person alloc] init];\nperson._id = 12345;\n\nDogClub *club = [[DogClub alloc] init];\nclub.name = @\"Pooch Pals\";\n[club.members addObject:person];\n\n[realm transactionWithBlock:^() {\n    [realm addObject:club];\n}];\n\n// Later, query the specific person\nPerson *specificPerson = [Person objectForPrimaryKey:@12345];\n    \n// Access directly through an inverse relationship\nNSLog(@\"# memberships: %lu\", [specificPerson.clubs count]);\nNSLog(@\"First club's name: %@\", [specificPerson.clubs[0] name]);\n\n```\n\n#### Swift\n\n```swift\nlet realm = try! Realm()\n\n// Establish an inverse relationship\nlet person = Person()\nperson.id = 12345\n\nlet club = DogClub()\nclub.name = \"Pooch Pals\"\nclub.members.append(person)\n\ntry! realm.write {\n    realm.add(club)\n}\n\n// Later, query the specific person\nlet specificPerson = realm.object(ofType: Person.self, forPrimaryKey: 12345)\n\n// Access directly through an inverse relationship\nlet clubs = specificPerson!.clubs\nlet firstClub = clubs[0]\nprint(\"# memberships: \\(clubs.count)\")\nprint(\"First club's name: \\(firstClub.name)\")\n\n```\n\n### Query a Collection on Embedded Object Properties\nUse dot notation to filter or sort a collection of objects based on an embedded object\nproperty value:\n\n> Note:\n> It is not possible to query embedded objects directly. Instead,\naccess embedded objects through a query for the parent object type.\n>\n\n#### Swift\n\n> Version added: 10.19.0\n\n```swift\n// Open the default realm\nlet realm = try! Realm()\n\n// Get all contacts in Los Angeles, sorted by street address\nlet losAngelesPeople = realm.objects(Person.self)\n    .where {\n        $0.address.city == \"Los Angeles\"\n    }\n    .sorted(byKeyPath: \"address.street\")\nprint(\"Los Angeles Person: \\(losAngelesPeople)\")\n\n```\n\n#### Swift Nspredicate\n\n```swift\n// Open the default realm\nlet realm = try! Realm()\n\n// Get all people in Los Angeles, sorted by street address\nlet losAngelesPeople = realm.objects(Person.self)\n    .filter(\"address.city = %@\", \"Los Angeles\")\n    .sorted(byKeyPath: \"address.street\")\nprint(\"Los Angeles Person: \\(losAngelesPeople)\")\n\n```\n\n#### Objective-C\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\nRLMResults<Contact *> *losAngelesContacts = [Contact objectsInRealm:realm where:@\"address.city = %@\", @\"Los Angeles\"];\n\nlosAngelesContacts = [losAngelesContacts sortedResultsUsingKeyPath:@\"address.street\" ascending:YES]; \nNSLog(@\"Los Angeles Contacts: %@\", losAngelesContacts);\n\n```\n\n### Query a Map Property\nYou can iterate and check the values of a realm `map`\nas you would a standard [Dictionary](https://developer.apple.com/documentation/swift/dictionary):\n\n```swift\nlet realm = try! Realm()\n\nlet dogs = realm.objects(Dog.self)\n\n// Find dogs who have favorite parks\nlet dogsWithFavoriteParks = dogs.where {\n    $0.favoriteParksByCity.count >= 1\n}\n\nfor dog in dogsWithFavoriteParks {\n    // Check if an entry exists\n    if dog.favoriteParksByCity.keys.contains(\"Chicago\") {\n        print(\"\\(dog.name) has a favorite park in Chicago\")\n    }\n\n    // Iterate over entries\n    for element in dog.favoriteParksByCity {\n        print(\"\\(dog.name)'s favorite park in \\(element.key) is \\(element.value)\")\n    }\n}\n\n```\n\n### Query a MutableSet Property\nYou can query a `MutableSet` to check if\nit contains an element. If you are working with multiple sets, you can\ncheck for the intersection of two sets, or check whether one set is a subset\nof the other set.\n\n```swift\nlet realm = try! Realm()\n\n// Find dogs who have visited New York\nlet newYorkDogs = realm.objects(Dog.self).where {\n    $0.citiesVisited.contains(\"New York\")\n}\n\n// Get some information about the cities they have visited\nfor dog in newYorkDogs {\n    print(\"Cities \\(dog.name) has visited: \\(dog.citiesVisited)\")\n}\n\n// Check whether two dogs have visited some of the same cities.\n// Use \"intersects\" to find out whether the values of the two sets share common elements.\nlet isInBothCitiesVisited = (dog.citiesVisited.intersects(dog2.citiesVisited))\nprint(\"The two dogs have visited some of the same cities: \\(isInBothCitiesVisited)\")\n// Prints \"The two dogs have visited some of the same cities: true\"\n\n// Or you can check whether a set is a subset of another set. In this example,\n// the first dog has visited \"New York\" and \"Toronto\", while dog2 has visited both of\n// those but also \"Toronto\" and \"Boston\".\nlet isSubset = (dog.citiesVisited.isSubset(of: dog2.citiesVisited))\nprint(\"\\(dog.name)'s set of cities visited is a subset of \\(dog2.name)'s: \\(isSubset)\")\n// Prints \"Maui's set of cities visited is a subset of Lita's: true\"\n\n```\n\n### Read and Query AnyRealmValue Property\nWhen you read an AnyRealmValue property, check the value's type before doing\nanything with it. The Realm Swift SDK provides an `AnyRealmValue enum` that iterates through all of the types the\nAnyRealmValue can store.\n\n```swift\nlet realm = try! Realm()\n\nlet dogs = realm.objects(Dog.self)\n\nfor dog in dogs {\n    // Verify the type of the ``AnyRealmProperty`` when attempting to get it. This\n    // returns an object whose property contains the matched type.\n\n    // If you only care about one type, check for that type.\n    if case let .string(companion) = dog.companion {\n        print(\"\\(dog.name)'s companion is: \\(companion)\")\n        // Prints \"Wolfie's companion is: Fluffy the Cat\"\n    }\n\n    // Or if you want to do something with multiple types of data\n    // that could be in the value, switch on the type.\n    switch dog.companion {\n    case .string:\n        print(\"\\(dog.name)'s companion is: \\(dog.companion)\")\n        // Prints \"Wolfie's companion is: string(\"Fluffy the Cat\")\n    case .object:\n        print(\"\\(dog.name)'s companion is: \\(dog.companion)\")\n        // Prints \"Fido's companion is: object(Dog { name = Spot })\"\n    case .none:\n        print(\"\\(dog.name) has no companion\")\n        // Prints \"Rex has no companion\" and \"Spot has no companion\"\n    default:\n        print(\"\\(dog.name)'s companion is another type.\")\n    }\n}\n\n```\n\nYou can compare these mixed value types:\n\n- Numeric: int, bool, float, double, decimal\n- Byte-based: string, binary\n- Time-based: timestamp, objectId\n\nWhen using the `AnyRealmValue` mixed data type, keep these things in mind:\n\n- `equals` queries match on value and type\n- `not equals` queries match objects with either different values or\ndifferent types\n- realm converts comparable numeric properties where possible. For example,\nin a mixed type field, 1 matches all of 1.0, 1, and true.\n- String properties do not match numeric queries. For example, in a mixed\ntype field, 1 does not match \"1\". \"1\" does not match 1, 1.0, or true.\n\n### Query Geospatial Data\n> Version added: 10.47.0\n\nThe Swift SDK provides several shapes to simplify querying\ngeospatial data. You can use the\n`GeoCircle`, `GeoBox`, and `GeoPolygon` shapes to set the boundaries for\nyour geospatial data queries.\n\nThe SDK provides two specialized non-persistable data types to define shapes:\n\n- `GeoPoint`: A struct that represents the coordinates of a point formed by\na pair of doubles consisting of these values: Latitude: ranges between -90 and 90 degrees, inclusive.Longitude: ranges between -180 and 180 degrees, inclusive.\n- `RLMDistance`: A helper struct to represent and convert a distance.\n\n#### Define Geospatial Shapes\n#### Geocircle\n\nA `GeoCircle` is a circular shape whose bounds originate from a central\n`GeoPoint`, and has a size corresponding to a radius measured in\nradians. You can use the SDK's convenience `RLMDistance` data type to\neasily work with radii in different units.\n\n`RLMDistance` enables you to specify the radius distance for your geo shapes\nin one of four units:\n\n- `.degrees`\n- `.kilometers`\n- `.miles`\n- `.radians`\n\nYou can optionally use the supplied convenience methods to convert a\nmeasurement to a different distance units.\n\n```swift\n// You can create a GeoCircle radius measured in radians.\n// This radian distance corresponds with 0.25 degrees.\nlet smallCircle = GeoCircle(center: (47.3, -121.9), radiusInRadians: 0.004363323)\n\n// You can also create a GeoCircle radius measured with a Distance.\n// You can specify a Distance in .degrees, .kilometers, .miles, or .radians.\nlet largeCircle = GeoCircle(center: GeoPoint(latitude: 47.8, longitude: -122.6)!, radius: Distance.kilometers(44.4)!)\n\n```\n\n![Two GeoCircles](../../images/geocircles.png)\n\n#### Geobox\n\nA `GeoBox` is a rectangular shape whose bounds are determined by\ncoordinates for a bottom-left and a top-right corner.\n\n```swift\nlet largeBox = GeoBox(bottomLeft: (47.3, -122.7), topRight: (48.1, -122.1))\n\nlet smallBoxBottomLeft = GeoPoint(latitude: 47.5, longitude: -122.4)!\nlet smallBoxTopRight = GeoPoint(latitude: 47.9, longitude: -121.8)\nlet smallBox = GeoBox(bottomLeft: smallBoxBottomLeft, topRight: smallBoxTopRight!)\n\n```\n\n![2 GeoBoxes](../../images/geoboxes.png)\n\n#### Geopolygon\n\nA `GeoPolygon` is a polygon shape whose bounds consist of an outer\nring, and 0 or more inner holes to exclude from the geospatial query.\n\nA polygon's outer ring must contain at least three segments. The last\nand the first `GeoPoint` must be the same, which indicates a closed\npolygon. This means that it takes at least four `GeoPoint` values to\nconstruct a polygon.\n\nInner holes in a `GeoPolygon` must be entirely contained within the\nouter ring.\n\nHoles have the following restrictions:\n\n- Holes may not cross. The boundary of a hole may not intersect both the\ninterior and the exterior of any other hole.\n- Holes may not share edges. If a hole contains an edge AB, then no other\nhole may contain it.\n- Holes may share vertices. However, no vertex may appear twice in a\nsingle hole.\n- No hole may be empty.\n- Only one nesting is allowed.\n\n```swift\n// Create a basic polygon\nlet basicPolygon = GeoPolygon(outerRing: [\n    (48.0, -122.8),\n    (48.2, -121.8),\n    (47.6, -121.6),\n    (47.0, -122.0),\n    (47.2, -122.6),\n    (48.0, -122.8)\n])\n\n// Create a polygon with one hole\nlet outerRing: [GeoPoint] = [\n    GeoPoint(latitude: 48.0, longitude: -122.8)!,\n    GeoPoint(latitude: 48.2, longitude: -121.8)!,\n    GeoPoint(latitude: 47.6, longitude: -121.6)!,\n    GeoPoint(latitude: 47.0, longitude: -122.0)!,\n    GeoPoint(latitude: 47.2, longitude: -122.6)!,\n    GeoPoint(latitude: 48.0, longitude: -122.8)!\n]\n\nlet hole: [GeoPoint] = [\n    GeoPoint(latitude: 47.8, longitude: -122.6)!,\n    GeoPoint(latitude: 47.7, longitude: -122.2)!,\n    GeoPoint(latitude: 47.4, longitude: -122.6)!,\n    GeoPoint(latitude: 47.6, longitude: -122.5)!,\n    GeoPoint(latitude: 47.8, longitude: -122.6)!\n]\n\nlet polygonWithOneHole = GeoPolygon(outerRing: outerRing, holes: [hole])\n\n// Add a second hole to the polygon\nlet hole2: [GeoPoint] = [\n    GeoPoint(latitude: 47.55, longitude: -122.05)!,\n    GeoPoint(latitude: 47.55, longitude: -121.9)!,\n    GeoPoint(latitude: 47.3, longitude: -122.1)!,\n    GeoPoint(latitude: 47.55, longitude: -122.05)!\n]\n\nlet polygonWithTwoHoles = GeoPolygon(outerRing: outerRing, holes: [hole, hole2])\n\n```\n\n![3 GeoPolygons](../../images/geopolygons.png)\n\n#### Query with Geospatial Shapes\nYou can then use these shapes in a geospatial query. You can query geospatial\ndata in three ways:\n\n- Using the `.geoWithin()` operator with the type-safe Realm Swift Query API\n- Using a `.filter()` with RQL\n- Using a `.filter()` with an NSPredicate query\n\nThe examples below show the results of queries using these two `Company`\nobjects:\n\n```swift\nlet company1 = Geospatial_Company()\ncompany1.location = CustomGeoPoint(47.68, -122.35)\n\nlet company2 = Geospatial_Company(CustomGeoPoint(47.9, -121.85))\n\n```\n\n![2 GeoPoints](../../images/geopoints.png)\n\n#### Geocircle\n\n```swift\nlet companiesInSmallCircle = realm.objects(Geospatial_Company.self).where {\n    $0.location.geoWithin(smallCircle!)\n}\nprint(\"Number of companies in small circle: \\(companiesInSmallCircle.count)\")\n\nlet companiesInLargeCircle = realm.objects(Geospatial_Company.self)\n    .filter(\"location IN %@\", largeCircle)\nprint(\"Number of companies in large circle: \\(companiesInLargeCircle.count)\")\n\n```\n\n![Querying a GeoCircle example.](../../images/geocircles-query.png)\n\n#### Geobox\n\n```swift\nlet companiesInSmallBox = realm.objects(Geospatial_Company.self).where {\n    $0.location.geoWithin(smallBox)\n}\nprint(\"Number of companies in small box: \\(companiesInSmallBox.count)\")\n\nlet filterArguments = NSMutableArray()\nfilterArguments.add(largeBox)\nlet companiesInLargeBox = realm.objects(Geospatial_Company.self)\n    .filter(NSPredicate(format: \"location IN %@\", argumentArray: filterArguments as? [Any]))\nprint(\"Number of companies in large box: \\(companiesInLargeBox.count)\")\n\n```\n\n![Querying a GeoBox example.](../../images/geoboxes-query.png)\n\n#### Geopolygon\n\n```swift\nlet companiesInBasicPolygon = realm.objects(Geospatial_Company.self).where {\n    $0.location.geoWithin(basicPolygon!)\n}\nprint(\"Number of companies in basic polygon: \\(companiesInBasicPolygon.count)\")\n\nlet companiesInPolygonWithTwoHoles = realm.objects(Geospatial_Company.self).where {\n    $0.location.geoWithin(polygonWithTwoHoles!)\n}\nprint(\"Number of companies in polygon with two holes: \\(companiesInPolygonWithTwoHoles.count)\")\n\n```\n\n![Querying a GeoPolygon example.](../../images/geopolygons-query.png)\n\n### Query a Custom Persistable Property\nWhen you use type projection to map unsupported\ntypes to supported types, accessing those properties is often based on the\npersisted type.\n\n#### Queries on Realm Objects\nWhen working with projected types, queries operate on the persisted type.\nHowever, you can use the mapped types interchangeably with the persisted\ntypes in arguments in most cases. The exception is queries on embedded\nobjects.\n\n> Tip:\n> Projected types support sorting and aggregates where\nthe persisted type supports them.\n>\n\n```swift\nlet akcClub = realm.objects(Club.self).where {\n    $0.name == \"American Kennel Club\"\n}.first!\n// You can use type-safe expressions to check for equality\nXCTAssert(akcClub.url == URL(string: \"https://akc.org\")!)\n\nlet clubs = realm.objects(Club.self)\n// You can use the persisted property type in NSPredicate query expressions\nlet akcByUrl = clubs.filter(\"url == 'https://akc.org'\").first!\nXCTAssert(akcByUrl.name == \"American Kennel Club\")\n\n```\n\n#### Queries on Embedded Objects\nYou can query embedded types on the supported property types within the\nobject using memberwise equality.\n\nObject link properties support equality comparisons, but do not support\nmemberwise comparisons. You can query embedded objects for memberwise\nequality on all primitive types. You cannot perform memberwise comparison\non objects and collections.\n\n#### Dynamic APIs\nBecause the schema has no concept of custom type mappings, reading data via\nany of the dynamic APIs gives the underlying persisted type. Realm does\nsupport writing mapped types via a dynamic API, and converts the projected\ntype to the persisted type.\n\nThe most common use of the dynamic APIs is migration. You can write projected\ntypes during migration, and Realm converts the projected type to the persisted\ntype. However, reading data during a migration gives the underlying persisted\ntype.\n\n## Read an Object Asynchronously\nWhen you use an actor-isolated realm, you can use Swift concurrency features\nto asynchronously query objects.\n\n```swift\nlet actor = try await RealmActor()\n\n// Read objects in functions isolated to the actor and pass primitive values to the caller\nfunc getObjectId(in actor: isolated RealmActor, forTodoNamed name: String) async -> ObjectId {\n    let todo = actor.realm.objects(Todo.self).where {\n        $0.name == name\n    }.first!\n    return todo._id\n}\nlet objectId = await getObjectId(in: actor, forTodoNamed: \"Keep it safe\")\n\n```\n\nIf you need to manually advance the state of an observed realm on the main\nthread or an actor-isolated realm, call `await realm.asyncRefresh()`.\nThis updates the realm and outstanding objects managed by the Realm to point to\nthe most recent data and deliver any applicable notifications.\n\nFor more information about working with realm using Swift concurrency features,\nrefer to Use Realm with Actors - Swift SDK.\n\n## Sort Query Results\nA sort operation allows you to configure the order in which Realm\nDatabase returns queried objects. You can sort based on one or more\nproperties of the objects in the results collection. Realm only\nguarantees a consistent order of results if you explicitly sort them.\n\n#### Objective-C\n\nTo sort, call [-[RLMResults\nsortedResultsUsingKeyPath:ascending:]](https://www.mongodb.com/docs/realm-sdks/objc/latest/Classes/RLMResults.html#/c:objc(cs)RLMResults(im)sortedResultsUsingKeyPath:ascending:)\nwith the desired key path to sort by.\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n\nRLMResults *dogs = [Dog allObjectsInRealm:realm];\n\n// Sort dogs by name\nRLMResults *dogsSorted = [dogs sortedResultsUsingKeyPath:@\"name\" ascending:NO];\n\n// You can also sort on the members of linked objects. In this example,\n// we sort the dogs by their favorite toys' names.\nRLMResults *dogsSortedByFavoriteToyName = [dogs sortedResultsUsingKeyPath:@\"favoriteToy.name\" ascending:YES];\n\n```\n\n#### Swift\n\n> Version added: 10.11.0\n\nYou can sort using the type-safe keyPath by calling\n`Results.sorted(by: )` with the\nkeyPath name and optional sort order:\n\n```swift\nlet realm = try! Realm()\n// Access all dogs in the realm\nlet dogs = realm.objects(Dog.self)\n\n// Sort by type-safe keyPath\nlet dogsSorted = dogs.sorted(by: \\.name)\n\n```\n\nTo sort using the older API, call `Results.sorted(byKeyPath:ascending:)`\nwith the desired key path to sort by.\n\n```swift\nlet realm = try! Realm()\n// Access all dogs in the realm\nlet dogs = realm.objects(Dog.self)\n\nlet dogsSorted = dogs.sorted(byKeyPath: \"name\", ascending: false)\n\n// You can also sort on the members of linked objects. In this example,\n// we sort the dogs by their favorite toys' names.\nlet dogsSortedByFavoriteToyName = dogs.sorted(byKeyPath: \"favoriteToy.name\")\n\n```\n\n> Tip:\n> To sort a query based on a property of an embedded object or a related object, use dot-notation as if it\nwere in a regular, nested object.\n>\n\n> Note:\n> String sorting and case-insensitive queries are only supported for\ncharacter sets in 'Latin Basic', 'Latin Supplement', 'Latin Extended\nA', and 'Latin Extended B' (UTF-8 range 0-591).\n>\n\n## Section Query Results\nYou can split results into individual sections. Each section corresponds\nto a key generated from a property on the object it represents.\n\nFor example, you might add a computed variable to your object to get the\nfirst letter of the `name` property:\n\n```swift\n// Computed variable that is not persisted, but only\n// used to section query results.\nvar firstLetter: String {\n    return name.first.map(String.init(_:)) ?? \"\"\n}\n\n```\n\nThen, you can create a `SectionedResults`\ntype-safe collection for that object, and use it to retrieve objects sectioned\nby that computed variable:\n\n```swift\nvar dogsByFirstLetter: SectionedResults<String, Dog>\n\ndogsByFirstLetter = realm.objects(Dog.self).sectioned(by: \\.firstLetter, ascending: true)\n\n```\n\nYou can get a count of the sections, get a list of keys, or access an individual\n`ResultSection` by index:\n\n```swift\nlet realm = try! Realm()\n\nvar dogsByFirstLetter: SectionedResults<String, Dog>\n\ndogsByFirstLetter = realm.objects(Dog.self).sectioned(by: \\.firstLetter, ascending: true)\n\n// You can get a count of the sections in the SectionedResults\nlet sectionCount = dogsByFirstLetter.count\n\n// Get an array containing all section keys for objects that match the query.\nlet sectionKeys = dogsByFirstLetter.allKeys\n// This example realm contains 4 dogs, \"Rex\", \"Wolfie\", \"Fido\", \"Spot\".\n// Prints [\"F\", \"R\", \"S\", \"W\"]\nprint(sectionKeys)\n\n// Get a specific key by index position\nlet sectionKey = dogsByFirstLetter[0].key\n// Prints \"Key for index 0: F\"\nprint(\"Key for index 0: \\(sectionKey)\")\n\n// You can access Results Sections by the index of the key you want in SectionedResults.\n// \"F\" is the key at index position 0. When we access this Results Section, we get dogs whose name begins with \"F\".\nlet dogsByF = dogsByFirstLetter[0]\n// Prints \"Fido\"\nprint(dogsByF.first?.name)\n\n```\n\nYou can also section using a callback. This enables you to section a\ncollection of primitives, or have more control over how the section key is\ngenerated.\n\n```swift\nlet realm = try! Realm()\nlet results = realm.objects(Dog.self)\nlet sectionedResults = results.sectioned(by: { String($0.name.first!) },\n                                         sortDescriptors: [SortDescriptor.init(keyPath: \"name\", ascending: true)])\nlet sectionKeys = sectionedResults.allKeys\n\n```\n\nYou can observe\n`SectionedResults` and `ResultsSection` instances, and both conform to\n`ThreadConfined`.\n\n## Aggregate Data\nYou can use Realm's aggregation operators for sophisticated queries\nagainst list properties.\n\n#### Swift\n\n> Version added: 10.19.0\n\n```swift\nlet realm = try! Realm()\n\nlet people = realm.objects(Person.self)\n\n// People whose dogs' average age is 5\npeople.where {\n    $0.dogs.age.avg == 5\n}\n\n// People with older dogs\npeople.where {\n    $0.dogs.age.min > 5\n}\n\n// People with younger dogs\npeople.where {\n    $0.dogs.age.max < 2\n}\n\n// People with many dogs\npeople.where {\n    $0.dogs.count > 2\n}\n\n// People whose dogs' ages combined > 10 years\npeople.where {\n    $0.dogs.age.sum > 10\n}\n\n```\n\n#### Swift Nspredicate\n\n```swift\nlet realm = try! Realm()\n\nlet people = realm.objects(Person.self)\n\n// People whose dogs' average age is 5\npeople.filter(\"dogs.@avg.age == 5\")\n\n// People with older dogs\npeople.filter(\"dogs.@min.age > 5\")\n\n// People with younger dogs\npeople.filter(\"dogs.@max.age < 2\")\n\n// People with many dogs\npeople.filter(\"dogs.@count > 2\")\n\n// People whose dogs' ages combined > 10 years\npeople.filter(\"dogs.@sum.age > 10\")\n\n```\n\n#### Objective-C\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n\nRLMResults *people = [Person allObjectsInRealm:realm];\n\n// People whose dogs' average age is 5\n[people objectsWhere:@\"dogs.@avg.age == 5\"];\n\n// People with older dogs\n[people objectsWhere:@\"dogs.@min.age > 5\"];\n\n// People with younger dogs\n[people objectsWhere:@\"dogs.@max.age < 2\"];\n\n// People with many dogs\n[people objectsWhere:@\"dogs.@count > 2\"];\n\n// People whose dogs' ages combined > 10 years\n[people objectsWhere:@\"dogs.@sum.age > 10\"];\n\n```\n\n## Chain Queries\nBecause results are lazily evaluated, you\ncan chain several queries together. Unlike traditional databases, this\ndoes not require a separate trip to the database for each successive\nquery.\n\n> Example:\n> To get a result set for tan dogs, and tan dogs whose names start with\n'B', chain two queries like this:\n>\n> #### Swift\n>\n> > Version added: 10.19.0\n>\n> ```swift\n> let realm = try! Realm()\n> let tanDogs = realm.objects(Dog.self).where {\n>     $0.color == \"tan\"\n> }\n> let tanDogsWithBNames = tanDogs.where {\n>     $0.name.starts(with: \"B\")\n> }\n>\n> ```\n>\n>\n> #### Swift Nspredicate\n>\n> ```swift\n> let realm = try! Realm()\n> let tanDogs = realm.objects(Dog.self).filter(\"color = 'tan'\")\n> let tanDogsWithBNames = tanDogs.filter(\"name BEGINSWITH 'B'\")\n>\n> ```\n>\n>\n> #### Objective-C\n>\n> ```objectivec\n> RLMRealm *realm = [RLMRealm defaultRealm];\n> RLMResults<Dog *> *tanDogs = [Dog objectsInRealm:realm where:@\"color = 'tan'\"];\n> RLMResults<Dog *> *tanDogsWithBNames = [tanDogs objectsWhere:@\"name BEGINSWITH 'B'\"];\n>\n> ```\n>\n>\n\n## Query Class Projections\nTo query for class projections in a\nrealm, pass the metatype instance `YourProjectionName.self` to\n`Realm.objects(_)`.\nThis returns a `Results` object\nrepresenting all of the class projection objects in the realm.\n\n```swift\n// Retrieve all class projections of the given type `PersonProjection`\nlet people = realm.objects(PersonProjection.self)\n// Use projection data in your view\nprint(people.first?.firstName)\nprint(people.first?.homeCity)\nprint(people.first?.firstFriendsName)\n\n```\n\n> Tip:\n> Don't do derived queries on top of class projection results. Instead, run a\nquery against the Realm object directly and then project the result. If you\ntry to do a derived query on top of class projection results, querying a\nfield with the same name and type as the original object works, but querying\na field with a name or type that isn't in the original object fails.\n>\n"
  },
  {
    "path": "docs/guides/crud/threading.md",
    "content": "# Threading - Swift SDK\nTo make your iOS and tvOS apps fast and responsive, you must\nbalance the computing time needed to lay out the visuals and\nhandle user interactions with the time needed to process\nyour data and run your business logic. Typically, app\ndevelopers spread this work across multiple threads: the\nmain or UI thread for all of the user interface-related\nwork, and one or more background threads to compute heavier\nworkloads before sending it to the UI thread for\npresentation. By offloading heavy work to background\nthreads, the UI thread can remain highly responsive\nregardless of the size of the workload. But it can be\nnotoriously difficult to write thread-safe, performant, and\nmaintainable multithreaded code that avoids issues like\ndeadlocking and race conditions. Realm aims to\nsimplify this for you.\n\n> Seealso:\n> As of 10.26.0, Realm provides async write methods to perform background\nwrites. See: Perform a Background Write. With\nasync write, you don't need to pass a thread-safe reference or frozen objects\nacross threads.\n>\n\nThis page describes how to manually manage realm files and objects across threads.\nRealm also supports using a [Swift actor](https://developer.apple.com/documentation/swift/actor)\nto manage realm access using Swift concurrency features. For an overview\nof Realm's actor support, refer to Use Realm with Actors - Swift SDK.\n\n## Three Rules to Follow\nBefore exploring Realm's tools for multithreaded apps, you need to\nunderstand and follow these three rules:\n\nRealm's Multiversion Concurrency Control (MVCC)\narchitecture eliminates the need to lock for read operations. The values you\nread will never be corrupted or in a partially-modified state. You can freely\nread from the same Realm file on any thread without the need for locks or\nmutexes. Unnecessarily locking would be a performance bottleneck since each\nthread might need to wait its turn before reading.\n\nYou can write to a Realm file from any thread, but there can be only one\nwriter at a time. Consequently, synchronous write transactions block each\nother. A synchronous write on the UI thread may result in your app appearing\nunresponsive while it waits for a write on a background thread to complete.\n\nLive objects, collections, and realm instances are\n**thread-confined**: that is, they are only valid on the\nthread on which they were created. Practically speaking,\nthis means you cannot pass live instances to other\nthreads. However, Realm offers several mechanisms for\nsharing objects across threads.\n\n## Perform a Background Write\n> Version added: 10.26.0\n\nYou can add, modify, or delete objects in the background using\n`writeAsync`.\n\nWith `writeAsync`, you don't need to pass a thread-safe reference or frozen objects\nacross threads. Instead, call `realm.writeAsync`. You can provide\na completion block for the method to execute on the source thread after\nthe write completes or fails.\n\nThings to consider when performing background writes:\n\n- Async writes block closing or invalidating the realm\n- You can explicitly commit or cancel transactions\n\n```swift\nlet realm = try! Realm()\n\n// Query for a specific person object on the main thread\nlet people = realm.objects(Person.self)\nlet thisPerson = people.where {\n    $0.name == \"Dachary\"\n}.first\n\n// Perform an async write to add dogs to that person's dog list.\n// No need to pass a thread-safe reference or frozen object.\nrealm.writeAsync {\n    thisPerson?.dogs.append(objectsIn: [\n        Dog(value: [\"name\": \"Ben\", \"age\": 13]),\n        Dog(value: [\"name\": \"Lita\", \"age\": 9]),\n        Dog(value: [\"name\": \"Maui\", \"age\": 1])\n    ])\n} onComplete: { _ in\n    // Confirm the three dogs were successfully added to the person's dogs list\n    XCTAssertEqual(thisPerson!.dogs.count, 3)\n    // Query for one of the dogs we added and see that it is present\n    let dogs = realm.objects(Dog.self)\n    let benDogs = dogs.where {\n        $0.name == \"Ben\"\n    }\n    XCTAssertEqual(benDogs.count, 1)\n}\n\n```\n\n### Wait for Async Writes to Complete\nThe SDK provides a `Bool` to signal whether the realm is currently\nperforming an async write. The\n`isPerformingAsynchronousWriteOperations`\nvariable becomes `true` after a call to one of:\n\n- `writeAsync`\n- `beginAsyncWrite`\n- `commitAsyncWrite`\n\nIt remains true until all scheduled async write operations have completed.\nWhile this is true, this blocks closing or `invalidating` the realm.\n\n### Commit or Cancel an Async Write\nTo complete an async write, you or the SDK must call either:\n\n- `commitAsyncWrite`\n- `cancelAsyncWrite`\n\nWhen you use the `writeAsync` method, the SDK handles committing or\ncanceling the transaction. This provides the convenience of the async write\nwithout the need to manually keep state tied to the scope of the object.\nHowever, while in the `writeAsync` block, you *can* explicitly call\n`commitAsyncWrite` or `cancelAsyncWrite`. If you return without\ncalling one of these methods, `writeAsync` either:\n\n- Commits the write after executing the instructions in the write block\n- Returns an error\n\nIn either case, this completes the `writeAsync` operation.\n\nFor more control over when to commit or cancel the async write transaction,\nuse the `beginAsyncWrite` method. When you use this method, you must\nexplicitly commit the transactions. Returning without committing an async\nwrite cancels the transaction. `beginAsyncWrite` returns an ID that you\ncan pass to `cancelAsyncWrite`.\n\n`commitAsyncWrite` asynchronously commits a write transaction. This is\nthe step that persists the data to the realm. `commitAsyncWrite` can\ntake an `onComplete` block. . This block executes on the source thread\nonce the commit completes or fails with an error.\n\nCalling `commitAsyncWrite` immediately returns. This allows the caller\nto proceed while the SDK performs the I/O on a background thread. This method\nreturns an ID that you can pass to `cancelAsyncWrite`. This cancels the\npending invocation of the completion block. It does not cancel the commit\nitself.\n\nYou can group sequential calls to `commitAsyncWrite`. Batching these calls\nimproves write performance; particularly when the batched transactions are\nsmall. To permit grouping transactions, set the `isGroupingAllowed`\nparameter to `true`.\n\nYou can call `cancelAsyncWrite` on either `beginAsyncWrite` or\n`commitAsyncWrite`. When you call it on `beginAsyncWrite`, this cancels\nthe entire write transaction. When you call it on `commitAsyncWrite`, this\ncancels only an `onComplete` block you may have passed to\n`commitAsyncWrite`. It does not cancel the commit itself. You need the ID\nof the `beginAsyncWrite` or the `commitAsyncWrite` you want to cancel.\n\n## Communication Across Threads\nTo access the same Realm file from different threads, you must instantiate a\nrealm instance on every thread that needs access. As long as you specify the same\nconfiguration, all realm instances will map to the same file on disk.\n\nOne of the key rules when working with Realm in a multithreaded\nenvironment is that objects are thread-confined: **you cannot access the\ninstances of a realm, collection, or object that originated on other threads.**\nRealm's Multiversion Concurrency Control (MVCC)\narchitecture means that there could be many active versions of an object at any\ntime. Thread-confinement ensures that all instances in that thread are of the\nsame internal version.\n\nWhen you need to communicate across threads, you have several options depending\non your use case:\n\n- To modify an object on two threads, query\nfor the object on both threads.\n- To react to changes made on any thread, use Realm's\nnotifications.\n- To see changes that happened on another thread in the current thread's realm\ninstance, refresh your realm instance.\n- To send a fast, read-only view of the object to other threads,\n\"freeze\" the object.\n- To keep and share many read-only views of the object in your app, copy\nthe object from the realm.\n- To share an instance of a realm or specific object with another thread or\nacross actor boundaries, share a thread-safe reference to the realm instance or object. For more\ninformation, refer to Pass a ThreadSafeReference.\n\n### Create a Serial Queue to use Realm on a Background Thread\nWhen using Realm on a background thread, create a serial queue. Realm\ndoes not support using realms in concurrent queues, such as the `global()`\nqueue.\n\n```swift\n// Initialize a serial queue, and\n// perform realm operations on it\nlet serialQueue = DispatchQueue(label: \"serial-queue\")\nserialQueue.async {\n    let realm = try! Realm(configuration: .defaultConfiguration, queue: serialQueue)\n    // Do something with Realm on the non-main thread\n}\n\n```\n\n### Pass Instances Across Threads\nInstances of `Realm`, `Results`, `List`, and managed `Objects`\nare *thread-confined*. That means you may only use them on the thread\nwhere you created them. However, Realm provides a mechanism called\n**thread-safe references** that allows you to copy an instance\ncreated on one thread to another thread.\n\n#### Sendable Conformance\n> Version added: 10.20.0\n> @ThreadSafe wrapper and ThreadSafeReference conform to `Sendable`\n>\n\nIf you are using Swift 5.6 or higher, both the `@ThreadSafe\nproperty wrapper` and\n`ThreadSafeReference`\nconform to [Sendable](https://developer.apple.com/documentation/swift/sendable).\n\n#### Use the @ThreadSafe Wrapper\n> Version added: 10.17.0\n\nYou can pass thread-confined instances to another thread as follows:\n\n1. Use the `@ThreadSafe` property wrapper to declare a variable that references the original object. By definition, `@ThreadSafe`-wrapped variables are always optional.\n2. Pass the `@ThreadSafe`-wrapped variable to the other thread.\n3. Use the `@ThreadSafe`-wrapped variable as you would any optional. If the referenced object is removed from the realm, the referencing variable becomes nil.\n\n```swift\nlet realm = try! Realm()\n\nlet person = Person(name: \"Jane\")\ntry! realm.write {\n    realm.add(person)\n}\n\n// Create thread-safe reference to person\n@ThreadSafe var personRef = person\n\n// @ThreadSafe vars are always optional. If the referenced object is deleted,\n// the @ThreadSafe var will be nullified.\nprint(\"Person's name: \\(personRef?.name ?? \"unknown\")\")\n\n// Pass the reference to a background thread\nDispatchQueue(label: \"background\", autoreleaseFrequency: .workItem).async {\n    let realm = try! Realm()\n    try! realm.write {\n        // Resolve within the transaction to ensure you get the\n        // latest changes from other threads. If the person\n        // object was deleted, personRef will be nil.\n        guard let person = personRef else {\n            return // person was deleted\n        }\n        person.name = \"Jane Doe\"\n    }\n}\n\n```\n\nAnother way to work with an object on another thread is to query for it\nagain on that thread. But if the object does not have a primary\nkey, it is not trivial to\nquery for it. You can use the `@ThreadSafe` wrapper on any object,\nregardless of whether it has a primary key.\n\n> Example:\n> The following example shows how to use `@ThreadSafe` on a function\nparameter. This is useful for functions that may run asynchronously\nor on another thread.\n>\n> > Tip:\n> > If your app accesses Realm in an `async/await` context, mark the code\nwith `@MainActor` to avoid threading-related crashes.\n> >\n>\n> ```swift\n> func someLongCallToGetNewName() async -> String {\n>     return \"Janet\"\n> }\n>\n> @MainActor\n> func loadNameInBackground(@ThreadSafe person: Person?) async {\n>     let newName = await someLongCallToGetNewName()\n>     let realm = try! await Realm()\n>     try! realm.write {\n>         person?.name = newName\n>     }\n> }\n>\n> @MainActor\n> func createAndUpdatePerson() async {\n>     let realm = try! await Realm()\n>\n>     let person = Person(name: \"Jane\")\n>     try! realm.write {\n>         realm.add(person)\n>     }\n>     await loadNameInBackground(person: person)\n> }\n>\n> await createAndUpdatePerson()\n>\n> ```\n>\n\n#### Use ThreadSafeReference (Legacy Swift / Objective-C)\nBefore Realm Swift SDK version 10.17.0 or in Objective-C, you can pass\nthread-confined instances to another thread as follows:\n\n1. Initialize a `ThreadSafeReference` with the thread-confined object.\n2. Pass the reference to the other thread or queue.\n3. Resolve the reference on the other thread's realm by calling `Realm.resolve(_:)`. Use the returned object as normal.\n\n> Important:\n> You must resolve a `ThreadSafeReference` exactly once. Otherwise,\nthe source realm remains pinned until the reference gets\ndeallocated. For this reason, `ThreadSafeReference` should be\nshort-lived.\n>\n\n```swift\nlet person = Person(name: \"Jane\")\nlet realm = try! Realm()\n\ntry! realm.write {\n    realm.add(person)\n}\n\n// Create thread-safe reference to person\nlet personRef = ThreadSafeReference(to: person)\n\n// Pass the reference to a background thread\nDispatchQueue(label: \"background\", autoreleaseFrequency: .workItem).async {\n    let realm = try! Realm()\n    try! realm.write {\n        // Resolve within the transaction to ensure you get the latest changes from other threads\n        guard let person = realm.resolve(personRef) else {\n            return // person was deleted\n        }\n        person.name = \"Jane Doe\"\n    }\n}\n\n```\n\nAnother way to work with an object on another thread is to query for it\nagain on that thread. But if the object does not have a primary\nkey, it is not trivial to\nquery for it. You can use `ThreadSafeReference` on any object,\nregardless of whether it has a primary key. You can also use it with\nlists and results.\n\nThe downside is that `ThreadSafeReference` requires some boilerplate.\nYou must remember to wrap everything in a `DispatchQueue` with a\nproperly-scoped `autoreleaseFrequency` so the objects do not linger on\nthe background thread. So, it can be helpful to make a convenience extension\nto handle the boilerplate as follows:\n\n```swift\nextension Realm {\n    func writeAsync<T: ThreadConfined>(_ passedObject: T, errorHandler: @escaping ((_ error: Swift.Error) -> Void) = { _ in return }, block: @escaping ((Realm, T?) -> Void)) {\n        let objectReference = ThreadSafeReference(to: passedObject)\n        let configuration = self.configuration\n        DispatchQueue(label: \"background\", autoreleaseFrequency: .workItem).async {\n            do {\n                let realm = try Realm(configuration: configuration)\n                try realm.write {\n                    // Resolve within the transaction to ensure you get the latest changes from other threads\n                    let object = realm.resolve(objectReference)\n                    block(realm, object)\n                }\n            } catch {\n                errorHandler(error)\n            }\n        }\n    }\n}\n\n```\n\nThis extension adds a `writeAsync()` method to the Realm class. This\nmethod passes an instance to a background thread for you.\n\n> Example:\n> Suppose you made an email app and want to delete all read emails in\nthe background. You can now do it with two lines of code. Note that\nthe closure runs on the background thread and receives its own\nversion of both the realm and passed object:\n>\n> ```swift\n> let realm = try! Realm()\n> let readEmails = realm.objects(Email.self).where {\n>     $0.read == true\n> }\n> realm.writeAsync(readEmails) { (realm, readEmails) in\n>     guard let readEmails = readEmails else {\n>         // Already deleted\n>         return\n>     }\n>     realm.delete(readEmails)\n> }\n>\n> ```\n>\n\n### Use the Same Realm Across Threads\nYou cannot share realm instances across threads.\n\nTo use the same Realm file across threads, open a different realm\ninstance on each thread. As long as you use the same\n`configuration`, all Realm\ninstances will map to the same file on disk.\n\n### Refreshing Realms\nWhen you open a realm, it reflects the most recent successful write\ncommit and remains on that version until it is **refreshed**. This means\nthat the realm will not see changes that happened on another thread\nuntil the next refresh. A realm on the UI thread -- more precisely,\non any event loop thread -- automatically refreshes itself at\nthe beginning of that thread's loop. However, you must manually refresh\nrealm instances that do not exist on loop threads or that have\nauto-refresh disabled.\n\n#### Objective-C\n\n```objective-c\nif (![realm autorefresh]) {\n    [realm refresh]\n}\n```\n\n#### Swift\n\n```swift\nif (!realm.autorefresh) {\n   // Manually refresh\n   realm.refresh()\n}\n```\n\n### Frozen Objects\nLive, thread-confined objects work fine in most cases.\nHowever, some apps -- those based on reactive, event\nstream-based architectures, for example -- need to send\nimmutable copies around to many threads for processing\nbefore ultimately ending up on the UI thread. Making a deep\ncopy every time would be expensive, and Realm does not allow\nlive instances to be shared across threads. In this case,\nyou can **freeze** and **thaw** objects, collections, and realms.\n\nFreezing creates an immutable view of a specific object,\ncollection, or realm. The frozen object, collection, or realm still\nexists on disk, and does not need to be deeply copied when passed around\nto other threads. You can freely share the frozen object across threads\nwithout concern for thread issues. When you freeze a realm, its child\nobjects also become frozen.\n\n> Tip:\n> Realm does not currently support using `thaw()` with Swift Actors.\nTo work with Realm data across actor boundaries, use\n`ThreadSafeReference` instead of frozen objects. For more information,\nrefer to Pass a ThreadSafeReference.\n>\n\nFrozen objects are not live and do not automatically update.\nThey are effectively snapshots of the object state at the\ntime of freezing. Thawing an object returns a live version of the frozen\nobject.\n\n#### Objective-C\n\n```objectivec\n// Get an immutable copy of the realm that can be passed across threads\nRLMRealm *frozenRealm = [realm freeze];\n\nRLMResults *dogs = [Dog allObjectsInRealm:realm];\n\n// You can freeze collections\nRLMResults *frozenDogs = [dogs freeze];\n\n// You can still read from frozen realms\nRLMResults *frozenDogs2 = [Dog allObjectsInRealm:frozenRealm];\n\nDog *dog = [dogs firstObject];\n\n// You can freeze objects\nDog *frozenDog = [dog freeze];\n\n// To modify frozen objects, you can thaw them\n// You can thaw collections\nRLMResults *thawedDogs = [dogs thaw];\n\n// You can thaw objects\nDog *thawedDog = [dog thaw];\n\n// You can thaw frozen realms\nRLMRealm *thawedRealm = [realm thaw];\n```\n\n#### Swift\n\n```swift\nlet realm = try! Realm()\n\n// Get an immutable copy of the realm that can be passed across threads\nlet frozenRealm = realm.freeze()\n\nassert(frozenRealm.isFrozen)\n\nlet people = realm.objects(Person.self)\n\n// You can freeze collections\nlet frozenPeople = people.freeze()\n\nassert(frozenPeople.isFrozen)\n\n// You can still read from frozen realms\nlet frozenPeople2 = frozenRealm.objects(Person.self)\n\nassert(frozenPeople2.isFrozen)\n\nlet person = people.first!\n\nassert(!person.realm!.isFrozen)\n\n// You can freeze objects\nlet frozenPerson = person.freeze()\n\nassert(frozenPerson.isFrozen)\n// Frozen objects have a reference to a frozen realm\nassert(frozenPerson.realm!.isFrozen)\n\n```\n\nWhen working with frozen objects, an attempt to do any of\nthe following throws an exception:\n\n- Opening a write transaction on a frozen realm.\n- Modifying a frozen object.\n- Adding a change listener to a frozen realm, collection, or object.\n\nYou can use `isFrozen` to check if the object is frozen. This is always\nthread-safe.\n\n#### Objective-C\n\n```objective-c\nif ([realm isFrozen]) {\n    // ...\n}\n```\n\n#### Swift\n\n```swift\nif (realm.isFrozen) {\n    // ...\n}\n```\n\nFrozen objects remain valid as long as the live realm that\nspawned them stays open. Therefore, avoid closing the live\nrealm until all threads are done with the frozen objects.\nYou can close a frozen realm before the live realm is closed.\n\n> Important:\n> Caching too many frozen objects can have a negative\nimpact on the realm file size. \"Too many\" depends on your\nspecific target device and the size of your Realm\nobjects. If you need to cache a large number of versions,\nconsider copying what you need out of the realm instead.\n>\n\n#### Modify a Frozen Object\nTo modify a frozen object, you must thaw the object. Alternately, you can\nquery for it on an unfrozen realm, then modify it. Calling `thaw`\non a live object, collection, or realm returns itself.\n\nThawing an object or collection also thaws the realm it references.\n\n```swift\n// Read from a frozen realm\nlet frozenPeople = frozenRealm.objects(Person.self)\n\n// The collection that we pull from the frozen realm is also frozen\nassert(frozenPeople.isFrozen)\n\n// Get an individual person from the collection\nlet frozenPerson = frozenPeople.first!\n\n// To modify the person, you must first thaw it\n// You can also thaw collections and realms\nlet thawedPerson = frozenPerson.thaw()\n\n// Check to make sure this person is valid. An object is\n// invalidated when it is deleted from its managing realm,\n// or when its managing realm has invalidate() called on it.\nassert(thawedPerson?.isInvalidated == false)\n\n// Thawing the person also thaws the frozen realm it references\nassert(thawedPerson!.realm!.isFrozen == false)\n\n// Let's make the code easier to follow by naming the thawed realm\nlet thawedRealm = thawedPerson!.realm!\n\n// Now, you can modify the todo\ntry! thawedRealm.write {\n   thawedPerson!.name = \"John Michael Kane\"\n}\n\n```\n\n#### Append to a Frozen Collection\nWhen you append to a frozen collection,\nyou must thaw both the collection and the object that you want to append.\nIn this example, we query for two objects in a frozen Realm:\n\n- A Person object that has a List property\nof Dog objects\n- A Dog object\n\nWe must thaw both objects before we can append the Dog to\nthe Dog List collection on the Person. If we thaw only the Person object\nbut not the Dog, Realm throws an error.\n\nThe same rule applies when passing frozen objects across threads. A common\ncase might be calling a function on a background thread to do some work\ninstead of blocking the UI.\n\n```swift\n// Get a copy of frozen objects.\n// Here, we're getting them from a frozen realm,\n// but you might also be passing them across threads.\nlet frozenTimmy = frozenRealm.objects(Person.self).where {\n    $0.name == \"Timmy\"\n}.first!\nlet frozenLassie = frozenRealm.objects(Dog.self).where {\n    $0.name == \"Lassie\"\n}.first!\n// Confirm the objects are frozen.\nassert(frozenTimmy.isFrozen == true)\nassert(frozenLassie.isFrozen == true)\n// Thaw the frozen objects. You must thaw both the object\n// you want to append and the collection you want to append it to.\nlet thawedTimmy = frozenTimmy.thaw()\nlet thawedLassie = frozenLassie.thaw()\nlet realm = try! Realm()\ntry! realm.write {\n    thawedTimmy?.dogs.append(thawedLassie!)\n}\nXCTAssertEqual(thawedTimmy?.dogs.first?.name, \"Lassie\")\n\n```\n\n## Realm's Threading Model in Depth\nRealm provides safe, fast, lock-free, and concurrent access\nacross threads with its [Multiversion Concurrency\nControl (MVCC)](https://en.wikipedia.org/wiki/Multiversion_concurrency_control)\narchitecture.\n\n### Compared and Contrasted with Git\nIf you are familiar with a distributed version control\nsystem like [Git](https://git-scm.com/), you may already\nhave an intuitive understanding of MVCC. Two fundamental\nelements of Git are:\n\n- Commits, which are atomic writes.\n- Branches, which are different versions of the commit history.\n\nSimilarly, Realm has atomically-committed writes in the form\nof transactions. Realm also has many\ndifferent versions of the history at any given time, like\nbranches.\n\nUnlike Git, which actively supports distribution and\ndivergence through forking, a realm only has one true latest\nversion at any given time and always writes to the head of\nthat latest version. Realm cannot write to a previous\nversion. This means your data converges on one\nlatest version of the truth.\n\n### Internal Structure\nA realm is implemented using a [B+ tree](https://en.wikipedia.org/wiki/B%2B_tree) data structure. The top-level node represents a\nversion of the realm; child nodes are objects in that\nversion of the realm. The realm has a pointer to its latest\nversion, much like how Git has a pointer to its HEAD commit.\n\nRealm uses a copy-on-write technique to ensure\n[isolation](https://en.wikipedia.org/wiki/Isolation_(database_systems)) and\n[durability](https://en.wikipedia.org/wiki/Durability_(database_systems)).\nWhen you make changes, Realm copies the relevant part of the\ntree for writing. Realm then commits the changes in two\nphases:\n\n- Realm writes changes to disk and verifies success.\n- Realm then sets its latest version pointer to point to the newly-written version.\n\nThis two-step commit process guarantees that even if the\nwrite failed partway, the original version is not corrupted\nin any way because the changes were made to a copy of the\nrelevant part of the tree. Likewise, the realm's root\npointer will point to the original version until the new\nversion is guaranteed to be valid.\n\n> Example:\n> The following diagram illustrates the commit process:\n>\n> ![Realm copies the relevant part of the tree for writes, then replaces the latest version by updating a pointer.](../../images/mvcc-diagram.png)\n>\n> 1. The realm is structured as a tree. The realm has a pointer\nto its latest version, V1.\n> 2. When writing, Realm creates a new version V2 based on V1.\nRealm makes copies of objects for modification (A 1,\nC 1),  while links to unmodified objects continue to\npoint to the original versions (B, D).\n> 3. After validating the commit, Realm updates the\npointer to the new latest version, V2. Realm then discards\nold nodes no longer connected to the tree.\n>\n\nRealm uses zero-copy techniques\nlike memory mapping to handle data. When you read a value\nfrom the realm, you are virtually looking at the value on\nthe actual disk, not a copy of it. This is the basis for\nlive objects. This is also why a realm\nhead pointer can be set to point to the new version after\nthe write to disk has been validated.\n\n## Summary\n- Realm enables simple and safe multithreaded code when you follow\nthese rules: don't lock to readavoid writes on the UI thread if you\nwrite on background threads, and don't pass live objects to other threads.\n- There is a proper way to share objects across threads for each use case.\n- In order to see changes made on other threads in your realm\ninstance, you must manually **refresh** realm instances that do\nnot exist on \"loop\" threads or that have auto-refresh disabled.\n- For apps based on reactive, event-stream-based architectures, you can\n**freeze** objects, collections, and realms in order to pass\nshallow copies around efficiently to different threads for processing.\n- Realm's multiversion concurrency control (MVCC)\narchitecture is similar to Git's. Unlike Git, Realm has\nonly one true latest version for each realm.\n- Realm commits in two stages to guarantee isolation and durability.\n\n## Sendable, Non-Sendable and Thread-Confined Types\nThe Realm Swift SDK public API contains types that fall into three broad\ncategories:\n\n- Sendable\n- Not Sendable and not thread confined\n- Thread-confined\n\nYou can share types that are not Sendable and not thread confined between\nthreads, but you must synchronize them.\n\nThread-confined types, unless frozen, are confined to an isolation context.\nYou cannot pass them between these contexts even with synchronization.\n"
  },
  {
    "path": "docs/guides/crud/update.md",
    "content": "# CRUD - Update - Swift SDK\n## Update Realm Objects\nUpdates to Realm Objects must occur within write transactions. For\nmore information about write transactions, see: Transactions.\n\n### About The Examples On This Page\nThe examples on this page use the following models:\n\n#### Objective-C\n\n```objectivec\n// DogToy.h\n@interface DogToy : RLMObject\n@property NSString *name;\n@end\n\n// Dog.h\n@interface Dog : RLMObject\n@property NSString *name;\n@property int age;\n@property NSString *color;\n\n// To-one relationship\n@property DogToy *favoriteToy;\n\n@end\n\n// Enable Dog for use in RLMArray\nRLM_COLLECTION_TYPE(Dog)\n\n// Person.h\n// A person has a primary key ID, a collection of dogs, and can be a member of multiple clubs.\n@interface Person : RLMObject\n@property int _id;\n@property NSString *name;\n\n// To-many relationship - a person can have many dogs\n@property RLMArray<Dog *><Dog> *dogs;\n\n// Inverse relationship - a person can be a member of many clubs\n@property (readonly) RLMLinkingObjects *clubs;\n@end\n\nRLM_COLLECTION_TYPE(Person)\n\n// DogClub.h\n@interface DogClub : RLMObject\n@property NSString *name;\n@property RLMArray<Person *><Person> *members;\n@end\n\n// Dog.m\n@implementation Dog\n@end\n\n// DogToy.m\n@implementation DogToy\n@end\n\n// Person.m\n@implementation Person\n// Define the primary key for the class\n+ (NSString *)primaryKey {\n    return @\"_id\";\n}\n\n// Define the inverse relationship to dog clubs\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{\n        @\"clubs\": [RLMPropertyDescriptor descriptorWithClass:DogClub.class propertyName:@\"members\"],\n    };\n}\n@end\n\n// DogClub.m\n@implementation DogClub\n@end\n\n```\n\n#### Swift\n\n```swift\nclass Dog: Object {\n    @Persisted var name = \"\"\n    @Persisted var age = 0\n    @Persisted var color = \"\"\n    @Persisted var currentCity = \"\"\n    @Persisted var citiesVisited: MutableSet<String>\n    @Persisted var companion: AnyRealmValue\n\n    // Map of city name -> favorite park in that city\n    @Persisted var favoriteParksByCity: Map<String, String>\n}\n\nclass Person: Object {\n    @Persisted(primaryKey: true) var id = 0\n    @Persisted var name = \"\"\n\n    // To-many relationship - a person can have many dogs\n    @Persisted var dogs: List<Dog>\n\n    // Embed a single object.\n    // Embedded object properties must be marked optional.\n    @Persisted var address: Address?\n}\n\nclass Address: EmbeddedObject {\n    @Persisted var street: String?\n    @Persisted var city: String?\n    @Persisted var country: String?\n    @Persisted var postalCode: String?\n}\n\n```\n\n### Update an Object\nYou can modify properties of a Realm object inside of a write\ntransaction in the same way that you would update any other Swift or\nObjective-C object.\n\n#### Objective-C\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n// Open a thread-safe transaction.\n[realm transactionWithBlock:^{\n    // Get a dog to update.\n    Dog *dog = [[Dog allObjectsInRealm: realm] firstObject];\n\n    // Update some properties on the instance.\n    // These changes are saved to the realm.\n    dog.name = @\"Wolfie\";\n    dog.age += 1;\n}];\n\n```\n\n#### Swift\n\n```swift\nlet realm = try! Realm()\n\n// Get a dog to update\nlet dog = realm.objects(Dog.self).first!\n\n// Open a thread-safe transaction\ntry! realm.write {\n    // Update some properties on the instance.\n    // These changes are saved to the realm\n    dog.name = \"Wolfie\"\n    dog.age += 1\n}\n\n```\n\n> Tip:\n> To update a property of an embedded object or a related object, modify the property with\ndot-notation or bracket-notation as if it were in a regular, nested\nobject.\n>\n\n### Update Properties with Key-value Coding\n`Object`, `Result`, and `List` all conform to\n[key-value coding](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/KeyValueCoding/).\nThis can be useful when you need to determine which property to update\nat runtime.\n\nApplying KVC to a collection is a great way to update objects in bulk.\nAvoid the overhead of iterating over a collection while creating\naccessors for every item.\n\n```swift\nlet realm = try! Realm()\n\nlet allDogs = realm.objects(Dog.self)\n\ntry! realm.write {\n    allDogs.first?.setValue(\"Sparky\", forKey: \"name\")\n    // Move the dogs to Toronto for vacation\n    allDogs.setValue(\"Toronto\", forKey: \"currentCity\")\n}\n\n```\n\nYou can also add values for embedded objects or relationships this\nway. In this example, we add a collection to an object's list property:\n\n#### Objective-C\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n\n[realm transactionWithBlock:^() {\n    // Create a person to take care of some dogs.\n    Person *ali = [[Person alloc] initWithValue:@{@\"_id\": @1, @\"name\": @\"Ali\"}];\n    [realm addObject:ali];\n\n    // Find dogs younger than 2.\n    RLMResults<Dog *> *puppies = [Dog objectsInRealm:realm where:@\"age < 2\"];\n\n    // Batch update: give all puppies to Ali.\n    [ali setValue:puppies forKey:@\"dogs\"];\n}];\n\n```\n\n#### Swift\n\n```swift\nlet realm = try! Realm()\ntry! realm.write {\n    // Create a person to take care of some dogs.\n    let person = Person(value: [\"id\": 1, \"name\": \"Ali\"])\n    realm.add(person)\n\n    let dog = Dog(value: [\"name\": \"Rex\", \"age\": 1])\n    realm.add(dog)\n\n    // Find dogs younger than 2.\n    let puppies = realm.objects(Dog.self).filter(\"age < 2\")\n\n    // Give all puppies to Ali.\n    person.setValue(puppies, forKey: \"dogs\")\n\n}\n\n```\n\n### Upsert an Object\nAn **upsert** either inserts or updates an object depending on whether\nthe object already exists. Upserts require the data model to have a\nprimary key.\n\n#### Objective-C\n\nTo upsert an object, call `-[RLMRealm addOrUpdateObject:]`.\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n[realm transactionWithBlock:^{\n    Person *jones = [[Person alloc] initWithValue:@{@\"_id\": @1234, @\"name\": @\"Jones\"}];\n    // Add a new person to the realm. Since nobody with ID 1234\n    // has been added yet, this adds the instance to the realm.\n    [realm addOrUpdateObject:jones];\n    \n    Person *bowie = [[Person alloc] initWithValue:@{@\"_id\": @1234, @\"name\": @\"Bowie\"}];\n    // Judging by the ID, it's the same person, just with a different name.\n    // This overwrites the original entry (i.e. Jones -> Bowie).\n    [realm addOrUpdateObject:bowie];\n}];\n\n```\n\n#### Swift\n\nTo upsert an object, call `Realm.add(_:update:)`\nwith the second parameter, update policy, set to `.modified`.\n\n```swift\nlet realm = try! Realm()\ntry! realm.write {\n    let person1 = Person(value: [\"id\": 1234, \"name\": \"Jones\"])\n    // Add a new person to the realm. Since nobody with ID 1234\n    // has been added yet, this adds the instance to the realm.\n    realm.add(person1, update: .modified)\n\n    let person2 = Person(value: [\"id\": 1234, \"name\": \"Bowie\"])\n    // Judging by the ID, it's the same person, just with a\n    // different name. When `update` is:\n    // - .modified: update the fields that have changed.\n    // - .all: replace all of the fields regardless of\n    //   whether they've changed.\n    // - .error: throw an exception if a key with the same\n    //   primary key already exists.\n    realm.add(person2, update: .modified)\n}\n\n```\n\nYou can also partially update an object by passing the primary key and a\nsubset of the values to update:\n\n#### Objective-C\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n[realm transactionWithBlock:^{\n    // Only update the provided values.\n    // Note that the \"name\" property will remain the same\n    // for the person with primary key \"_id\" 123.\n    [Person createOrUpdateModifiedInRealm:realm\n        withValue:@{@\"_id\": @123, @\"dogs\": @[@[@\"Buster\", @5]]}];\n}];\n\n```\n\n#### Swift\n\n```swift\nlet realm = try! Realm()\ntry! realm.write {\n    // Use .modified to only update the provided values.\n    // Note that the \"name\" property will remain the same\n    // for the person with primary key \"id\" 123.\n    realm.create(Person.self,\n                 value: [\"id\": 123, \"dogs\": [[\"Buster\", 5]]],\n                 update: .modified)\n}\n\n```\n\n### Update a Map/Dictionary\nYou can update a realm `map` as you would a\nstandard [Dictionary](https://developer.apple.com/documentation/swift/dictionary):\n\n```swift\nlet realm = try! Realm()\n\n// Find the dog we want to update\nlet wolfie = realm.objects(Dog.self).where {\n    $0.name == \"Wolfie\"\n}.first!\n\nprint(\"Wolfie's favorite park in New York is: \\(wolfie.favoriteParksByCity[\"New York\"])\")\nXCTAssertTrue(wolfie.favoriteParksByCity[\"New York\"] == \"Domino Park\")\n\n// Update values for keys, or add values if the keys do not currently exist\ntry! realm.write {\n    wolfie.favoriteParksByCity[\"New York\"] = \"Washington Square Park\"\n    wolfie.favoriteParksByCity.updateValue(\"A Street Park\", forKey: \"Boston\")\n    wolfie.favoriteParksByCity.setValue(\"Little Long Pond\", forKey: \"Seal Harbor\")\n}\n\nXCTAssertTrue(wolfie.favoriteParksByCity[\"New York\"] == \"Washington Square Park\")\n\n```\n\n### Update a MutableSet Property\nYou can `insert` elements into a `MutableSet` during write transactions to add them to the\nproperty. If you are working with multiple sets, you can also insert or\nremove set elements contained in one set from the other set. Alternately,\nyou can mutate a set to contain only the common elements from both.\n\n```swift\nlet realm = try! Realm()\n\n// Record a dog's name, current city, and store it to the cities visited.\nlet dog = Dog()\ndog.name = \"Maui\"\ndog.currentCity = \"New York\"\ntry! realm.write {\n    realm.add(dog)\n    dog.citiesVisited.insert(dog.currentCity)\n}\n\n// Update the dog's current city, and add it to the set of cities visited.\ntry! realm.write {\n    dog.currentCity = \"Toronto\"\n    dog.citiesVisited.insert(dog.currentCity)\n}\nXCTAssertEqual(dog.citiesVisited.count, 2)\n\n// If you're operating with two sets, you can insert the elements from one set into another set.\n// The dog2 set contains one element that isn't present in the dog set.\ntry! realm.write {\n    dog.citiesVisited.formUnion(dog2.citiesVisited)\n}\nXCTAssertEqual(dog.citiesVisited.count, 3)\n\n// Or you can remove elements that are present in the second set. This removes the one element\n// that we added above from the dog2 set.\ntry! realm.write {\n    dog.citiesVisited.subtract(dog2.citiesVisited)\n}\nXCTAssertEqual(dog.citiesVisited.count, 2)\n\n// If the sets contain common elements, you can mutate the set to only contain those common elements.\n// In this case, the two sets contain no common elements, so this set should now contain 0 items.\ntry! realm.write {\n    dog.citiesVisited.formIntersection(dog2.citiesVisited)\n}\nXCTAssertEqual(dog.citiesVisited.count, 0)\n\n```\n\n### Update an AnyRealmValue Property\nYou can update an AnyRealmValue property through assignment, but you must\nspecify the type of the value when you assign it. The Realm Swift SDK\nprovides an `AnyRealmValue enum` that\niterates through all of the types the AnyRealmValue can store.\n\n```swift\nlet realm = try! Realm()\n\n// Get a dog to update\nlet rex = realm.objects(Dog.self).where {\n    $0.name == \"Rex\"\n}.first!\n\ntry! realm.write {\n    // As with creating an object with an AnyRealmValue, you must specify the\n    // type of the value when you update the property.\n    rex.companion = .object(Dog(value: [\"name\": \"Regina\"]))\n}\n\n```\n\n### Update an Embedded Object Property\nTo update a property in an embedded object, modify the property in a\nwrite transaction. If the embedded object is null, updating an embedded\nobject property has no effect.\n\n#### Objective-C\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n[realm transactionWithBlock: ^{\n    Contact *contact = [Contact objectInRealm:realm\n                                forPrimaryKey:[[RLMObjectId alloc] initWithString:@\"5f481c21f634a1f4eeaa7268\" error:nil]];\n    contact.address.street = @\"Hollywood Upstairs Medical College\";\n    contact.address.city = @\"Los Angeles\";\n    contact.address.postalCode = @\"90210\";\n    NSLog(@\"Updated contact: %@\", contact);\n}];\n\n```\n\n#### Swift\n\n```swift\n// Open the default realm\nlet realm = try! Realm()\n\nlet idOfPersonToUpdate = 123\n\n// Find the person to update by ID\nguard let person = realm.object(ofType: Person.self, forPrimaryKey: idOfPersonToUpdate) else {\n    print(\"Person \\(idOfPersonToUpdate) not found\")\n    return\n}\n\ntry! realm.write {\n    // Update the embedded object directly through the person\n    // If the embedded object is null, updating these properties has no effect\n    person.address?.street = \"789 Any Street\"\n    person.address?.city = \"Anytown\"\n    person.address?.postalCode = \"12345\"\n    print(\"Updated person: \\(person)\")\n}\n\n```\n\n### Overwrite an Embedded Object\nTo overwrite an embedded object, reassign the embedded object property\nof a party to a new instance in a write transaction.\n\n#### Objective-C\n\n```objectivec\nRLMRealm *realm = [RLMRealm defaultRealm];\n[realm transactionWithBlock: ^{\n    Contact *contact = [Contact objectInRealm:realm\n                                forPrimaryKey:[[RLMObjectId alloc] initWithString:@\"5f481c21f634a1f4eeaa7268\" error:nil]];\n    Address *newAddress = [[Address alloc] init];\n    newAddress.street = @\"Hollywood Upstairs Medical College\";\n    newAddress.city = @\"Los Angeles\";\n    newAddress.country = @\"USA\";\n    newAddress.postalCode = @\"90210\";\n    contact.address = newAddress;\n    NSLog(@\"Updated contact: %@\", contact);\n}];\n\n```\n\n#### Swift\n\n```swift\n// Open the default realm\nlet realm = try! Realm()\n\nlet idOfPersonToUpdate = 123\n\n// Find the person to update by ID\nguard let person = realm.object(ofType: Person.self, forPrimaryKey: idOfPersonToUpdate) else {\n    print(\"Person \\(idOfPersonToUpdate) not found\")\n    return\n}\n\ntry! realm.write {\n    let newAddress = Address()\n    newAddress.street = \"789 Any Street\"\n    newAddress.city = \"Anytown\"\n    newAddress.country = \"USA\"\n    newAddress.postalCode = \"12345\"\n\n    // Overwrite the embedded object\n    person.address = newAddress\n    print(\"Updated person: \\(person)\")\n}\n\n```\n\n## Update an Object Asynchronously\nYou can use Swift concurrency features to asynchronously update objects\nusing an actor-isolated realm.\n\nThis function from the example `RealmActor` defined on the\nUse Realm with Actors page shows how you might\nupdate an object in an actor-isolated realm:\n\n```swift\nfunc updateTodo(_id: ObjectId, name: String, owner: String, status: String) async throws {\n    try await realm.asyncWrite {\n        realm.create(Todo.self, value: [\n            \"_id\": _id,\n            \"name\": name,\n            \"owner\": owner,\n            \"status\": status\n        ], update: .modified)\n    }\n}\n\n```\n\nAnd you might perform this update using Swift's async syntax:\n\n```swift\nlet actor = try await RealmActor()\n\n// Read objects in functions isolated to the actor and pass primitive values to the caller\nfunc getObjectId(in actor: isolated RealmActor, forTodoNamed name: String) async -> ObjectId {\n    let todo = actor.realm.objects(Todo.self).where {\n        $0.name == name\n    }.first!\n    return todo._id\n}\nlet objectId = await getObjectId(in: actor, forTodoNamed: \"Keep it safe\")\n\ntry await actor.updateTodo(_id: objectId, name: \"Keep it safe\", owner: \"Frodo\", status: \"Completed\")\n\n```\n\nThis operation does not block or perform I/O on the calling thread. For\nmore information about writing to realm using Swift concurrency features,\nrefer to Use Realm with Actors - Swift SDK.\n\n## Update Properties through Class Projections\n### Change Class Projection Properties\nYou can make changes to a class projection's properties in a write transaction.\n\n```swift\n// Retrieve all class projections of the given type `PersonProjection`\n// and filter for the first class projection where the `firstName` property\n// value is \"Jason\"\nlet person = realm.objects(PersonProjection.self).first(where: { $0.firstName == \"Jason\" })!\n// Update class projection property in a write transaction\ntry! realm.write {\n    person.firstName = \"David\"\n}\n\n```\n"
  },
  {
    "path": "docs/guides/logging.md",
    "content": "# Logging - Swift SDK\nYou can set or change your app's log level when developing or debugging\nyour application. You might want to change the log level to log different\namounts of data depending on your development needs.\n\n## Set or Change the Realm Log Level\nYou can set the level of detail reported by the Realm Swift SDK. Set the\nlog level for the default logger with `Logger.shared.level`:\n\n```swift\nLogger.shared.level = .trace\n\n```\n\nThe `RLMLogLevel` enum represents the different levels of logging you can configure.\n\nYou can change the log level to increase or decrease verbosity at different\npoints in your code.\n```swift\n// Set a log level that isn't too verbose\nLogger.shared.level = .warn\n\n// Later, when trying to debug something, change the log level for more verbosity\nLogger.shared.level = .trace\n\n```\n\n## Turn Off Logging\nThe default log threshold level for the Realm Swift SDK is `.info`. This\ndisplays some information in the console. You can disable logging entirely\nby setting the log level to `.off`:\n\n```swift\nLogger.shared.level = .off\n\n```\n\n## Customize the Logging Function\nInitialize an instance of a `Logger` and define the function to use for logging.\n\n```swift\n// Create an instance of `Logger` and define the log function to invoke.\nlet logger = Logger(level: .detail) { level, message in\n    // You may pass log information to a logging service, or\n    // you could simply print the logs for debugging. Define\n    // the log function that makes sense for your application.\n    print(\"REALM DEBUG: \\(Date.now) \\(level) \\(message) \\n\")\n}\n\n```\n\n> Tip:\n> To diagnose and troubleshoot errors while developing your application, set the\nlog level to `debug` or `trace`. For production deployments, decrease the\nlog level for improved performance.\n>\n\nYou can set a logger as the default logger for your app with `Logger.shared`.\nAfter you set the default logger, you can change the log level during the app\nlifecycle as needed.\n\n```swift\nlet logger = Logger(level: .info) { level, message in\n    // You may pass log information to a logging service, or\n    // you could simply print the logs for debugging. Define\n    // the log function that makes sense for your application.\n    print(\"REALM DEBUG: \\(Date.now) \\(level) \\(message) \\n\")\n}\n\n// Set a logger as the default\nLogger.shared = logger\n\n// After setting a default logger, you can change\n// the log level at any point during the app lifecycle\nLogger.shared.level = .debug\n\n```\n"
  },
  {
    "path": "docs/guides/model-data/change-an-object-model.md",
    "content": "# Change an Object Model - Swift SDK\n\n## Overview\nWhen you update your object schema, you must increment the schema version\nand perform a migration.\n\n> Seealso:\n> This page provides general Swift and Objective-C migration examples.\nIf you are using Realm with SwiftUI, see the SwiftUI-specific\nmigration examples.\n>\n\nIf your schema update adds optional properties or removes properties,\nRealm can perform the migration automatically. You only need to\nincrement the `schemaVersion`.\n\nFor more complex schema updates, you must also manually specify the migration logic\nin a `migrationBlock`. This might include changes such as:\n\n- Adding required properties that must be populated with default values\n- Combining fields\n- Renaming a field\n- Changing a field's type\n- Converting from an object to an embedded object\n\n> Tip:\n> When developing or debugging your application, you may prefer to delete\nthe realm instead of migrating it. Use the\n`deleteRealmIfMigrationNeeded`\nflag to delete the database automatically when a schema mismatch would\nrequire a migration.\n>\n> Never release an app to production with this flag set to `true`.\n>\n\n## Schema Version\nA **schema version** identifies the state of a Realm Schema at some point in time. Realm tracks the schema\nversion of each realm and uses it to map the objects in each realm\nto the correct schema.\n\nSchema versions are integers that you may include\nin the realm configuration when you open a realm. If a client\napplication does not specify a version number when it opens a realm then\nthe realm defaults to version `0`.\n\n> Important:\n> Migrations must update a realm to a higher schema version.\nRealm will throw an error if a client application opens\na realm with a schema version that is lower than the realm's\ncurrent version or if the specified schema version is the same as the\nrealm's current version but includes different object\nschemas.\n>\n\n### Migrations\nLocal migrations have access to the existing\nRealm Schema, version, and objects and define logic that\nincrementally updates the realm to its new schema version.\nTo perform a local migration you must specify a new schema\nversion that is higher than the current version and provide\na migration function when you open the out-of-date realm.\n\nIn iOS, you can update underlying data to reflect schema changes using\nmanual migrations. During such a\nmanual migration, you can define new and deleted properties when they\nare added or removed from your schema.\n\n## Automatically Update Schema\n### Add a Property\nRealm can automatically migrate added\nproperties, but you must specify an updated schema version when you make\nthese changes.\n\n> Note:\n> Realm does not automatically set values for new required\nproperties. You must use a migration block to set default values for\nnew required properties. For new optional properties, existing records\ncan have null values. This means you don't need a migration block when\nadding optional properties.\n>\n\n> Example:\n> A realm using schema version `1` has a `Person` object type\nthat has first name, last name, and age properties:\n>\n> #### Objective-C\n>\n> ```objectivec\n> // In the first version of the app, the Person model\n> // has separate fields for first and last names,\n> // and an age property.\n> @interface Person : RLMObject\n> @property NSString *firstName;\n> @property NSString *lastName;\n> @property int age;\n> @end\n>\n> @implementation Person\n> + (NSArray<NSString *> *)requiredProperties {\n>     return @[@\"firstName\", @\"lastName\", @\"age\"];\n> }\n> @end\n>\n> ```\n>\n>\n> #### Swift\n>\n> ```swift\n> // In the first version of the app, the Person model\n> // has separate fields for first and last names,\n> // and an age property.\n> class Person: Object {\n>     @Persisted var firstName = \"\"\n>     @Persisted var lastName = \"\"\n>     @Persisted var age = 0\n> }\n>\n> ```\n>\n>\n> The developer decides that the `Person` class needs an `email` field and updates\nthe schema.\n>\n> #### Objective-C\n>\n> ```objectivec\n> // In a new version, you add a property\n> // on the Person model.\n> @interface Person : RLMObject\n> @property NSString *firstName;\n> @property NSString *lastName;\n> // Add a new \"email\" property.\n> @property NSString *email;\n> // New properties can be migrated\n> // automatically, but must update the schema version.\n> @property int age;\n> @end\n>\n> @implementation Person\n> + (NSArray<NSString *> *)requiredProperties {\n>     return @[@\"firstName\", @\"lastName\", @\"email\", @\"age\"];\n> }\n> @end\n>\n> ```\n>\n>\n> #### Swift\n>\n> ```swift\n> // In a new version, you add a property\n> // on the Person model.\n> class Person: Object {\n>     @Persisted var firstName = \"\"\n>     @Persisted var lastName = \"\"\n>     // Add a new \"email\" property.\n>     @Persisted var email: String?\n>     // New properties can be migrated\n>     // automatically, but must update the schema version.\n>     @Persisted var age = 0\n>\n> }\n>\n> ```\n>\n>\n> Realm automatically migrates the realm to conform to\nthe updated `Person` schema. But the developer must set the realm's\nschema version to `2`.\n>\n> #### Objective-C\n>\n> ```objectivec\n> // When you open the realm, specify that the schema\n> // is now using a newer version.\n> RLMRealmConfiguration *config = [[RLMRealmConfiguration alloc] init];\n> // Set the new schema version\n> config.schemaVersion = 2;\n> // Use this configuration when opening realms\n> [RLMRealmConfiguration setDefaultConfiguration:config];\n> RLMRealm *realm = [RLMRealm defaultRealm];\n>\n> ```\n>\n>\n> #### Swift\n>\n> ```swift\n> // When you open the realm, specify that the schema\n> // is now using a newer version.\n> let config = Realm.Configuration(\n>     schemaVersion: 2)\n> // Use this configuration when opening realms\n> Realm.Configuration.defaultConfiguration = config\n> let realm = try! Realm()\n>\n> ```\n>\n>\n\n### Delete a Property\nTo delete a property from a schema, remove the property from the object's class\nand set a `schemaVersion` of the realm's configuration object. Deleting a property\nwill not impact existing objects.\n\n> Example:\n> A realm using schema version `1` has a `Person` object type\nthat has first name, last name, and age properties:\n>\n> #### Objective-C\n>\n> ```objectivec\n> // In the first version of the app, the Person model\n> // has separate fields for first and last names,\n> // and an age property.\n> @interface Person : RLMObject\n> @property NSString *firstName;\n> @property NSString *lastName;\n> @property int age;\n> @end\n>\n> @implementation Person\n> + (NSArray<NSString *> *)requiredProperties {\n>     return @[@\"firstName\", @\"lastName\", @\"age\"];\n> }\n> @end\n>\n> ```\n>\n>\n> #### Swift\n>\n> ```swift\n> // In the first version of the app, the Person model\n> // has separate fields for first and last names,\n> // and an age property.\n> class Person: Object {\n>     @Persisted var firstName = \"\"\n>     @Persisted var lastName = \"\"\n>     @Persisted var age = 0\n> }\n>\n> ```\n>\n>\n> The developer decides that the `Person` does not need the `age` field and updates the schema.\n>\n> #### Objective-C\n>\n> ```objectivec\n> // In a new version, you remove a property\n> // on the Person model.\n> @interface Person : RLMObject\n> @property NSString *firstName;\n> @property NSString *lastName;\n> // Remove the \"age\" property.\n> // @property int age;\n> // Removed properties can be migrated\n> // automatically, but must update the schema version.\n> @end\n>\n> @implementation Person\n> + (NSArray<NSString *> *)requiredProperties {\n>     return @[@\"firstName\", @\"lastName\"];\n> }\n> @end\n>\n> ```\n>\n>\n> #### Swift\n>\n> ```swift\n> // In a new version, you remove a property\n> // on the Person model.\n> class Person: Object {\n>     @Persisted var firstName = \"\"\n>     @Persisted var lastName = \"\"\n>     // Remove the \"age\" property.\n>     // @Persisted var age = 0\n>     // Removed properties can be migrated\n>     // automatically, but must update the schema version.\n>\n> }\n>\n> ```\n>\n>\n> Realm automatically migrates the realm to conform to\nthe updated `Person` schema. But the developer must set the realm's\nschema version to `2`.\n>\n> #### Objective-C\n>\n> ```objectivec\n> // When you open the realm, specify that the schema\n> // is now using a newer version.\n> RLMRealmConfiguration *config = [[RLMRealmConfiguration alloc] init];\n> // Set the new schema version\n> config.schemaVersion = 2;\n> // Use this configuration when opening realms\n> [RLMRealmConfiguration setDefaultConfiguration:config];\n> RLMRealm *realm = [RLMRealm defaultRealm];\n>\n> ```\n>\n>\n> #### Swift\n>\n> ```swift\n> // When you open the realm, specify that the schema\n> // is now using a newer version.\n> let config = Realm.Configuration(\n>     schemaVersion: 2)\n> // Use this configuration when opening realms\n> Realm.Configuration.defaultConfiguration = config\n> let realm = try! Realm()\n>\n> ```\n>\n>\n\n> Tip:\n> SwiftUI developers may see an error that a migration is required when they\nadd or delete properties. This is related to the lifecycle in SwiftUI.\nThe Views are laid out, and then the `.environment` modifier sets the\nconfig.\n>\n> To resolve a migration error in these circumstances, pass\n`Realm.Configuration(schemaVersion: <Your Incremented Version>)`\ninto the `ObservedResults` constructor.\n>\n\n## Manually Migrate Schema\nFor more complex schema updates, Realm requires a manual\nmigration for old instances of a given object to the new schema.\n\n### Rename a Property\nTo rename a property during a migration, use the\n`Migration.renameProperty(onType:from:to:)`\nmethod.\n\nRealm applies any new nullability or indexing settings\nduring the rename operation.\n\n> Example:\n> Rename `age` to `yearsSinceBirth` within a `migrationBlock`.\n>\n> #### Objective-C\n>\n> ```objectivec\n> RLMRealmConfiguration *config = [[RLMRealmConfiguration alloc] init];\n> config.schemaVersion = 2;\n> config.migrationBlock = ^(RLMMigration * _Nonnull migration, uint64_t oldSchemaVersion) {\n>     if (oldSchemaVersion < 2) {\n>         // Rename the \"age\" property to \"yearsSinceBirth\".\n>         // The renaming operation should be done outside of calls to `enumerateObjects(ofType: _:)`.\n>         [migration renamePropertyForClass:[Person className] oldName:@\"age\" newName:@\"yearsSinceBirth\"];\n>     }\n> };\n>\n> ```\n>\n>\n> #### Swift\n>\n> ```swift\n> let config = Realm.Configuration(\n>     schemaVersion: 2,\n>     migrationBlock: { migration, oldSchemaVersion in\n>         if oldSchemaVersion < 2 {\n>             // Rename the \"age\" property to \"yearsSinceBirth\".\n>             // The renaming operation should be done outside of calls to `enumerateObjects(ofType: _:)`.\n>             migration.renameProperty(onType: Person.className(), from: \"age\", to: \"yearsSinceBirth\")\n>         }\n>     })\n>\n> ```\n>\n>\n\n### Modify Properties\n> Tip:\n> You can use the `deleteRealmIfMigrationNeeded`\nmethod to delete the realm if it would require a migration. This can\nbe useful during development when you need to iterate quickly and don't\nwant to perform the migration.\n>\n\nTo define custom migration logic, set the `migrationBlock`\nproperty of the `Configuration` when opening a realm.\n\nThe migration block receives a `Migration object` that you can use to perform the migration. You\ncan use the Migration object's `enumerateObjects(ofType:_:)`\nmethod to iterate over and update all instances of a given\nRealm type in the realm.\n\n> Example:\n> A realm using schema version `1` has a `Person` object type\nthat has separate fields for first and last names:\n>\n> #### Objective-C\n>\n> ```objectivec\n> // In the first version of the app, the Person model\n> // has separate fields for first and last names,\n> // and an age property.\n> @interface Person : RLMObject\n> @property NSString *firstName;\n> @property NSString *lastName;\n> @property int age;\n> @end\n>\n> @implementation Person\n> + (NSArray<NSString *> *)requiredProperties {\n>     return @[@\"firstName\", @\"lastName\", @\"age\"];\n> }\n> @end\n>\n> ```\n>\n>\n> #### Swift\n>\n> ```swift\n> // In the first version of the app, the Person model\n> // has separate fields for first and last names,\n> // and an age property.\n> class Person: Object {\n>     @Persisted var firstName = \"\"\n>     @Persisted var lastName = \"\"\n>     @Persisted var age = 0\n> }\n>\n> ```\n>\n>\n> The developer decides that the `Person` class should use a combined\n`fullName` field instead of the separate `firstName` and\n`lastName` fields and updates the schema.\n>\n> To migrate the realm to conform to the updated `Person` schema,\nthe developer sets the realm's schema version to `2` and\ndefines a migration function to set the value of `fullName` based\non the existing `firstName` and `lastName` properties.\n>\n> #### Objective-C\n>\n> ```objectivec\n> // In version 2, the Person model has one\n> // combined field for the full name and age as a Int.\n> // A manual migration will be required to convert from\n> // version 1 to this version.\n> @interface Person : RLMObject\n> @property NSString *fullName;\n> @property int age;\n> @end\n>\n> @implementation Person\n> + (NSArray<NSString *> *)requiredProperties {\n>     return @[@\"fullName\", @\"age\"];\n> }\n> @end\n>\n> ```\n>\n> ```objectivec\n> RLMRealmConfiguration *config = [[RLMRealmConfiguration alloc] init];\n> // Set the new schema version\n> config.schemaVersion = 2;\n> config.migrationBlock = ^(RLMMigration * _Nonnull migration, uint64_t oldSchemaVersion) {\n>     if (oldSchemaVersion < 2) {\n>         // Iterate over every 'Person' object stored in the Realm file to\n>         // apply the migration\n>         [migration enumerateObjects:[Person className]\n>                             block:^(RLMObject * _Nullable oldObject, RLMObject * _Nullable newObject) {\n>             // Combine name fields into a single field\n>             newObject[@\"fullName\"] = [NSString stringWithFormat:@\"%@ %@\",\n>                                         oldObject[@\"firstName\"],\n>                                         oldObject[@\"lastName\"]];\n>         }];\n>     }\n> };\n>\n> // Tell Realm to use this new configuration object for the default Realm\n> [RLMRealmConfiguration setDefaultConfiguration:config];\n>\n> // Now that we've told Realm how to handle the schema change, opening the realm\n> // will automatically perform the migration\n> RLMRealm *realm = [RLMRealm defaultRealm];\n>\n> ```\n>\n>\n> #### Swift\n>\n> ```swift\n> // In version 2, the Person model has one\n> // combined field for the full name and age as a Int.\n> // A manual migration will be required to convert from\n> // version 1 to this version.\n> class Person: Object {\n>     @Persisted var fullName = \"\"\n>     @Persisted var age = 0\n> }\n>\n> ```\n>\n> ```swift\n> // In application(_:didFinishLaunchingWithOptions:)\n> let config = Realm.Configuration(\n>     schemaVersion: 2, // Set the new schema version.\n>     migrationBlock: { migration, oldSchemaVersion in\n>         if oldSchemaVersion < 2 {\n>             // The enumerateObjects(ofType:_:) method iterates over\n>             // every Person object stored in the Realm file to apply the migration\n>             migration.enumerateObjects(ofType: Person.className()) { oldObject, newObject in\n>                 // combine name fields into a single field\n>                 let firstName = oldObject![\"firstName\"] as? String\n>                 let lastName = oldObject![\"lastName\"] as? String\n>                 newObject![\"fullName\"] = \"\\(firstName!) \\(lastName!)\"\n>             }\n>         }\n>     }\n> )\n>\n> // Tell Realm to use this new configuration object for the default Realm\n> Realm.Configuration.defaultConfiguration = config\n>\n> // Now that we've told Realm how to handle the schema change, opening the file\n> // will automatically perform the migration\n> let realm = try! Realm()\n>\n> ```\n>\n>\n> Later, the developer decides that the `age` field should be of type `String`\nrather than `Int` and updates the schema.\n>\n> To migrate the realm to conform to the updated `Person` schema,\nthe developer sets the realm's schema version to `3` and\nadds a conditional to the migration function so that the function defines\nhow to migrate from any previous version to the new one.\n>\n> #### Objective-C\n>\n> ```objectivec\n> // In version 3, the Person model has one\n> // combined field for the full name and age as a String.\n> // A manual migration will be required to convert from\n> // version 2 to this version.\n> @interface Person : RLMObject\n> @property NSString *fullName;\n> @property NSString *age;\n> @end\n>\n> @implementation Person\n> + (NSArray<NSString *> *)requiredProperties {\n>     return @[@\"fullName\", @\"age\"];\n> }\n> @end\n>\n> ```\n>\n> ```objectivec\n> RLMRealmConfiguration *config = [[RLMRealmConfiguration alloc] init];\n> // Set the new schema version\n> config.schemaVersion = 3;\n> config.migrationBlock = ^(RLMMigration * _Nonnull migration, uint64_t oldSchemaVersion) {\n>     if (oldSchemaVersion < 2) {\n>         // Previous Migration.\n>         [migration enumerateObjects:[Person className]\n>                             block:^(RLMObject * _Nullable oldObject, RLMObject * _Nullable newObject) {\n>             newObject[@\"fullName\"] = [NSString stringWithFormat:@\"%@ %@\",\n>                                         oldObject[@\"firstName\"],\n>                                         oldObject[@\"lastName\"]];\n>         }];\n>     }\n>     if (oldSchemaVersion < 3) {\n>         // New Migration\n>         [migration enumerateObjects:[Person className]\n>                             block:^(RLMObject * _Nullable oldObject, RLMObject * _Nullable newObject) {\n>             // Make age a String instead of an Int\n>             newObject[@\"age\"] = [oldObject[@\"age\"] stringValue];\n>         }];\n>     }\n> };\n>\n> // Tell Realm to use this new configuration object for the default Realm\n> [RLMRealmConfiguration setDefaultConfiguration:config];\n>\n> // Now that we've told Realm how to handle the schema change, opening the realm\n> // will automatically perform the migration\n> RLMRealm *realm = [RLMRealm defaultRealm];\n>\n> ```\n>\n>\n> #### Swift\n>\n> ```swift\n> // In version 3, the Person model has one\n> // combined field for the full name and age as a String.\n> // A manual migration will be required to convert from\n> // version 2 to this version.\n>  class Person: Object {\n>     @Persisted var fullName = \"\"\n>     @Persisted var age = \"0\"\n>  }\n>\n> ```\n>\n> ```swift\n> // In application(_:didFinishLaunchingWithOptions:)\n> let config = Realm.Configuration(\n>     schemaVersion: 3, // Set the new schema version.\n>     migrationBlock: { migration, oldSchemaVersion in\n>         if oldSchemaVersion < 2 {\n>             // Previous Migration.\n>             migration.enumerateObjects(ofType: Person.className()) { oldObject, newObject in\n>                 let firstName = oldObject![\"firstName\"] as? String\n>                 let lastName = oldObject![\"lastName\"] as? String\n>                 newObject![\"fullName\"] = \"\\(firstName!) \\(lastName!)\"\n>             }\n>         }\n>         if oldSchemaVersion < 3 {\n>             // New Migration.\n>             migration.enumerateObjects(ofType: Person.className()) { oldObject, newObject in\n>                 // Make age a String instead of an Int\n>                 newObject![\"age\"] = \"\\(oldObject![\"age\"] ?? 0)\"\n>             }\n>         }\n>     }\n> )\n>\n> // Tell Realm to use this new configuration object for the default Realm\n> Realm.Configuration.defaultConfiguration = config\n>\n> // Now that we've told Realm how to handle the schema change, opening the file\n> // will automatically perform the migration\n> let realm = try! Realm()\n>\n> ```\n>\n>\n\n> Tip:\n> Avoid nesting or otherwise skipping `if (oldSchemaVersion < X)` statements\nin migration blocks. This ensures that all updates can be applied in the correct order,\nno matter which schema version a client starts from. The goal is to define\nmigration logic which can transform data from any outdated schema version to\nmatch the current schema.\n>\n\n### Convert from Object to EmbeddedObject\nEmbedded objects cannot exist\nindependently of a parent object. When changing an Object to an\nEmbeddedObject, the migration block must ensure that every embedded\nobject has exactly one backlink to a parent object. Having no backlinks\nor multiple backlinks raises the following exceptions:\n\n```\nAt least one object does not have a backlink (data would get lost).\n```\n\n```\nAt least one object does have multiple backlinks.\n```\n\n> Seealso:\n> Define an Embedded Object Property\n>\n\n## Additional Migration Examples\nPlease check out the additional migration examples on the\n[realm-swift repo](https://github.com/realm/realm-swift/tree/master/examples/ios/swift/Migration).\n"
  },
  {
    "path": "docs/guides/model-data/model-data.md",
    "content": "# Model Data - Swift SDK\n## Object Types & Schemas\nRealm applications model data as objects composed of\nfield-value pairs that each contain one or more supported data types.\n\nRealm objects are regular Swift or Objective-C classes, but\nthey also bring a few additional features like live queries. The Swift SDK memory maps Realm objects directly to\nnative Swift or Objective-C objects, which means there's no need to use\na special data access library, such as an [ORM](https://en.wikipedia.org/wiki/Object-relational_mapping). Instead, you can work with Realm objects\nas you would any other class instance.\n\nEvery Realm object conforms to a specific **object type**, which is\nessentially a class that defines the properties\nand relationships for objects of that type.\nRealm guarantees that all objects in a realm conform to\nthe schema for their object type and validates objects whenever they're\ncreated, modified, or deleted.\n\n> Example:\n> The following schema defines a `Dog` object type with a string name,\noptional string breed, date of birth, and primary key ID.\n>\n> #### Objective-C\n>\n> ```objectivec\n> // A dog has an _id primary key, a string name, an optional\n> // string breed, and a date of birth.\n> @interface Dog : RLMObject\n> @property RLMObjectId *_id;\n> @property NSString *name;\n> @property NSString *breed;\n> @property NSDate *dateOfBirth;\n> @end\n>\n> @implementation Dog\n> + (NSString *)primaryKey {\n>     return @\"_id\";\n> }\n>\n> + (NSArray<NSString *> *)requiredProperties {\n>     return @[\n>         @\"_id\", @\"name\", @\"dateOfBirth\"\n>     ];\n> }\n> @end\n>\n> ```\n>\n>\n> #### Swift\n>\n> ```swift\n> // A dog has an _id primary key, a string name, an optional\n> // string breed, and a date of birth.\n> class Dog: Object {\n>     @Persisted(primaryKey: true) var _id: ObjectId\n>     @Persisted var name = \"\"\n>     @Persisted var breed: String?\n>     @Persisted var dateOfBirth = Date()\n> }\n>\n> ```\n>\n>\n\n### Realm Schema\nA **realm schema** is a list of valid object schemas that a realm may contain. Every Realm object must\nconform to an object type that's included in its realm's schema.\n\nBy default, the Swift SDK automatically adds all classes in your project\nthat derive from [RLMObject](https://www.mongodb.com/docs/realm-sdks/objc/latest/Classes/RLMObject.html) or\n[RLMEmbeddedObject](https://www.mongodb.com/docs/realm-sdks/objc/latest/Classes/RLMEmbeddedObject.html) to the\nrealm schema.\n\n> Tip:\n> To control which classes Realm adds to a realm schema, see\nProvide a Subset of Classes to a Realm.\n>\n\nIf a realm already contains data when you open it,\nRealm validates each object to ensure that an object\nschema was provided for its type and that it meets all of the\nconstraints specified in the schema.\n\n> Tip:\n> For code examples that show how to configure and open a realm in the\nSwift SDK, see Configure & Open a Realm - Swift SDK.\n>\n\n### Model Inheritance\nYou can subclass Realm models to share behavior between\nclasses, but there are limitations. In particular, Realm\ndoes not allow you to:\n\n- Cast between polymorphic classes: subclass to subclass, subclass to parent, parent to subclass\n- Query on multiple classes simultaneously: for example, \"get all instances of parent class and subclass\"\n- Multi-class containers: `List` and `Results` with a mixture of parent and subclass\n\n> Tip:\n> Check out the [code samples](https://github.com/realm/realm-swift/issues/1109#issuecomment-143834756) for working\naround these limitations.\n>\n\n> Version added: 10.10.0While you can't mix  and  property declarations\nwithin a class, you can mix the notation styles across base and subclasses.\nFor example, a base class could have a  property,\nand a subclass could have an  property, with\nboth persisted. However, the  property would be ignored if\nthe  property were within the same base or subclass.\n\n### Swift Structs\nRealm does not support Swift structs as models for a variety of\nreasons. Realm's design focuses on \"live\" objects.\nThis concept is not compatible with value type structs. By design,\nRealm provides features that are incompatible with these\nsemantics, such as:\n\n- Live data\n- Reactive APIs\n- Low memory footprint of data\n- Good operation performance\n- Lazy and cheap access to partial data\n- Lack of data serialization/deserialization\n- Keeping potentially complex object graphs synchronized\n\nThat said, it is sometimes useful to detach objects from their backing\nrealm. This typically isn't an ideal design decision. Instead,\ndevelopers use this as a workaround for temporary limitations in our\nlibrary.\n\nYou can use key-value coding to initialize an unmanaged object as a copy of\na managed object. Then, you can work with that unmanaged object\nlike any other [NSObject](https://developer.apple.com/documentation/objectivec/nsobject).\n\n```swift\nlet standaloneModelObject = MyModel(value: persistedModelObject)\n```\n\n## Properties\nYour Realm object model is a collection of properties. On the most basic level,\nwhen you create your model, your declarations give Realm information about\neach property:\n\n- The data type and whether the property is optional or required\n- Whether Realm should store or ignore the property\n- Whether the property is a primary key or should be indexed\n\nProperties are also the mechanism for establishing relationships between Realm object types.\n\nThe Realm Swift SDK uses reflection to determine the properties\nin your models at runtime. Your project must not set\n`SWIFT_REFLECTION_METADATA_LEVEL = none`, or Realm cannot discover\nchildren of types, such as properties and enum cases. Reflection is enabled\nby default if your project does not specifically set a level for this setting.\n\n## View Models with Realm\n> Version added: 10.21.0\n\nYou can work with a subset of your Realm object's properties\nby creating a class projection. A class projection is a class that passes\nthrough or transforms some or all of your Realm object's\nproperties. Class projection enables you to build view models that use an\nabstraction of your object model. This simplifies using and testing Realm objects\nin your application.\n\nWith class projection, you can use a subset of your object's properties\ndirectly in the UI or transform them. When you use a class projection for\nthis, you get all the benefits of Realm's live objects:\n\n- The class-projected object live updates\n- You can observe it for changes\n- You can apply changes directly to the properties in write transactions\n\n> Seealso:\n> Define a Class Projection\n>\n\n## Relationships\nRealm doesn't use bridge tables or explicit joins to define\nrelationships as you would in a relational database. Realm\nhandles relationships through embedded objects or reference properties to\nother Realm objects. You read from and write to these\nproperties directly. This makes querying relationships as performant as\nquerying against any other property.\n\nRealm supports **to-one**, **to-many**, and **inverse**\nrelationships.\n\n### To-One Relationship\nA **to-one** relationship means that an object relates to one other object.\nYou define a to-one relationship for an object type in its object\nschema. Specify a property where the type is the related Realm\nobject type. For example, a dog might have a to-one relationship with\na favorite toy.\n\n> Tip:\n> To learn how to define a to-one relationship, see\nDefine a To-One Relationship Property.\n>\n\n### To-Many Relationship\nA **to-many** relationship means that an object relates to more than one\nother object. In Realm, a to-many relationship is a list of\nreferences to other objects. For example, a person might have many dogs.\n\nA `List` represents the to-many\nrelationship between two Realm\ntypes. Lists are mutable: within a write transaction, you can add and\nremove elements to and from a list. Lists are not associated with a\nquery and are usually declared as a property of an object model.\n\n> Tip:\n> To learn how to define a to-many relationship, see\nDefine a To-Many Relationship Property.\n>\n\n### Inverse Relationship\nRelationship definitions in Realm are unidirectional. An\n**inverse relationship** links an object back to an object that refers\nto it. You must explicitly define a property in the object's model as an\ninverse relationship. Inverse relationships can link back to objects in\na to-one or to-many relationship.\n\nA `LinkingObjects` collection\nrepresents the inverse relationship\nbetween two Realm types. You cannot directly add or remove\nitems from a LinkingObjects collection.\n\nInverse relationships automatically update themselves with corresponding\nbacklinks. You can find the same set of Realm objects with a\nmanual query, but the inverse relationship field reduces boilerplate query\ncode and capacity for error.\n\nFor example, consider a task tracker with the to-many relationship \"User has\nmany Tasks\". This does not automatically create the inverse relationship\n\"Task belongs to User\". To create the inverse relationship, add a User\nproperty on the Task that points back to the task's owner. When you specify\nthe inverse relationship from task to user, you can query on that. If you\ndon't specify the inverse relationship, you must run a separate query to\nlook up the user to whom the task is assigned.\n\n> Important:\n> You cannot manually set the value of an inverse relationship property.\nInstead, Realm updates implicit relationships when you add\nor remove an object in the relationship.\n>\n\nRelationships can be many-to-one or many-to-many. So following inverse\nrelationships can result in zero, one, or many objects.\n\n> Tip:\n> To learn how to define an inverse relationship, see\nDefine an Inverse Relationship Property.\n>\n"
  },
  {
    "path": "docs/guides/model-data/object-models.md",
    "content": "# Define a Realm Object Model - Swift SDK\n## Define a New Object Type\n#### Objective-C\n\nYou can define a Realm object by deriving from the\n`RLMObject` or\n`RLMEmbeddedObject` class. The name of the\nclass becomes the table name in the realm, and properties of the\nclass persist in the database. This makes it as easy to work with\npersisted objects as it is to work with regular Objective-C\nobjects.\n\n```objectivec\n// A dog has an _id primary key, a string name, an optional\n// string breed, and a date of birth.\n@interface Dog : RLMObject\n@property RLMObjectId *_id;\n@property NSString *name;\n@property NSString *breed;\n@property NSDate *dateOfBirth;\n@end\n\n@implementation Dog\n+ (NSString *)primaryKey {\n    return @\"_id\";\n}\n\n+ (NSArray<NSString *> *)requiredProperties {\n    return @[\n        @\"_id\", @\"name\", @\"dateOfBirth\"\n    ];\n}\n@end\n\n```\n\n#### Swift\n\nYou can define a Realm object by deriving from the\n`Object` or\n`EmbeddedObject`\nclass. The name of the class becomes the table name in the realm,\nand properties of the class persist in the database. This makes it\nas easy to work with persisted objects as it is to work with\nregular Swift objects.\n\n```swift\n// A dog has an _id primary key, a string name, an optional\n// string breed, and a date of birth.\nclass Dog: Object {\n    @Persisted(primaryKey: true) var _id: ObjectId\n    @Persisted var name = \"\"\n    @Persisted var breed: String?\n    @Persisted var dateOfBirth = Date()\n}\n\n```\n\n> Note:\n> Class names are limited to a maximum of 57 UTF-8 characters.\n>\n\n## Declare Properties\nWhen you declare the property attributes of a class, you can specify whether\nor not those properties should be managed by the realm. **Managed properties**\nare stored or updated in the database. **Ignored properties** are not\nstored to the database. You can mix managed and ignored properties\nwithin a class.\n\nThe syntax to mark properties as managed or ignored varies depending on which\nversion of the SDK you use.\n\n### Persisted Property Attributes\n> Version added: 10.10.0The  declaration style replaces the ,\n, and  declaration notations from older\nversions of the SDK. For an older version of the SDK, see:\n.\n\nDeclare model properties that you want to store to the database as\n`@Persisted`. This enables them to access the underlying database data.\n\nWhen you declare any properties as `@Persisted` within a class, the other\nproperties within that class are automatically ignored.\n\nIf you mix `@Persisted` and `@objc dynamic` property declarations within\na class definition, any property attributes marked as `@objc dynamic` will\nbe ignored.\n\n> Seealso:\n> Our Supported Property Types\npage contains a property declaration cheatsheet.\n>\n\n### Objective-C Dynamic Property Attributes\n> Version changed: 10.10.0This property declaration information is for versions of the SDK before\n10.10.0.\n\nDeclare dynamic Realm model properties in the Objective-C runtime. This\nenables them to access the underlying database data.\n\nYou can either:\n\n- Use `@objc dynamic var` to declare individual properties\n- Use `@objcMembers` to declare a class. Then, declare individual\nproperties with `dynamic var`.\n\nUse `let` to declare `LinkingObjects`, `List`, `RealmOptional` and\n`RealmProperty`. The Objective-C runtime cannot represent these\ngeneric properties.\n\n> Version changed: 10.8.0\n> `RealmProperty` replaces `RealmOptional`\n>\n\n> Seealso:\n> Our Supported Property Types\npage contains a property declaration cheatsheet.\n>\n\n> Tip:\n> For reference on which types Realm supports for use as\nproperties, see Supported Property Types.\n>\n\n#### Swift\n\nWhen declaring non-generic properties, use the `@Persisted` annotation.\nThe `@Persisted` attribute turns Realm model properties into accessors\nfor the underlying database data.\n\n#### Objective-C\n\nDeclare properties on your object type as you would on a normal\nObjective-C interface.\n\nIn order to use your interface in a Realm array, pass your\ninterface name to the `RLM_COLLECTION_TYPE()` macro. You can put this\nat the bottom of your interface's header file. The\n`RLM_COLLECTION_TYPE()` macro creates a protocol that allows you to\ntag `RLMArray` with your type:\n\n```objectivec\n// Task.h\n@interface Task : RLMObject\n@property NSString *description;\n@end\n\n// Define an RLMArray<Task> type\nRLM_COLLECTION_TYPE(Task)\n\n// User.h\n// #include \"Task.h\"\n@interface User : RLMObject\n@property NSString *name;\n// Use RLMArray<Task> to have a list of tasks\n// Note the required double tag (<Task *><Task>)\n@property RLMArray<Task *><Task> *tasks;\n@end\n\n```\n\n#### Swift Pre 10.10.0\n\nWhen declaring non-generic properties, use the `@objc dynamic\nvar` annotation. The `@objc dynamic var` attribute turns Realm\nmodel properties into accessors for the underlying database data.\nIf the class is declared as `@objcMembers` (Swift 4 or later),\nyou can declare properties as `dynamic var` without `@objc`.\n\nTo declare properties of generic types `LinkingObjects`,\n`List`, and `RealmProperty`, use `let`. Generic properties\ncannot be represented in the Objective‑C runtime, which\nRealm uses for dynamic dispatch of dynamic\nproperties.\n\n> Note:\n> Property names are limited to a maximum of 63 UTF-8 characters.\n>\n\n### Specify an Optional/Required Property\n#### Swift\n\nYou can declare properties as optional or required (non-optional) using\nstandard Swift syntax.\n\n```swift\nclass Person: Object {\n    // Required string property\n    @Persisted var name = \"\"\n\n    // Optional string property\n    @Persisted var address: String?\n\n    // Required numeric property\n    @Persisted var ageYears = 0\n\n    // Optional numeric property\n    @Persisted var heightCm: Float?\n}\n\n```\n\n#### Objective-C\n\nTo declare a given property as required, implement the\n`requiredProperties`\nmethod and return an array of required property names.\n\n```objectivec\n@interface Person : RLMObject\n// Required property - included in `requiredProperties`\n// return value array\n@property NSString *name;\n\n// Optional string property - not included in `requiredProperties`\n@property NSString *address;\n\n// Required numeric property\n@property int ageYears;\n\n// Optional numeric properties use NSNumber tagged\n// with RLMInt, RLMFloat, etc.\n@property NSNumber<RLMFloat> *heightCm;\n@end\n\n@implementation Person\n// Specify required pointer-type properties here.\n// Implicitly required properties (such as properties\n// of primitive types) do not need to be named here.\n+ (NSArray<NSString *> *)requiredProperties {\n    return @[@\"name\"];\n}\n@end\n\n```\n\n#### Swift Pre 10.10.0\n\n> Version changed: 10.8.0\n> `RealmProperty` replaces `RealmOptional`\n>\n\nYou can declare `String`, `Date`, `Data`, and\n`ObjectId` properties as\noptional or required (non-optional) using standard Swift syntax.\nDeclare optional numeric types using the `RealmProperty`\ntype.\n\n```swift\nclass Person: Object {\n    // Required string property\n    @objc dynamic var name = \"\"\n\n    // Optional string property\n    @objc dynamic var address: String?\n\n    // Required numeric property\n    @objc dynamic var ageYears = 0\n\n    // Optional numeric property\n    let heightCm = RealmProperty<Float?>()\n}\n\n```\n\nRealmProperty supports `Int`, `Float`, `Double`, `Bool`,\nand all of the sized versions of `Int` (`Int8`, `Int16`,\n`Int32`, `Int64`).\n\n### Specify a Primary Key\nYou can designate a property as the **primary key** of your class.\n\nPrimary keys allow you to efficiently find, update, and upsert objects.\n\nPrimary keys are subject to the following limitations:\n\n- You can define only one primary key per object model.\n- Primary key values must be unique across all instances of an object\nin a realm. Realm throws an error if you try to\ninsert a duplicate primary key value.\n- Primary key values are immutable. To change the primary key value of\nan object, you must delete the original object and insert a new object\nwith a different primary key value.\n- Embedded objects cannot define a\nprimary key.\n\n#### Swift\n\nDeclare the property with `primaryKey: true`\non the `@Persisted` notation to set the model's primary key.\n\n```swift\nclass Project: Object {\n    @Persisted(primaryKey: true) var id = 0\n    @Persisted var name = \"\"\n}\n\n```\n\n#### Objective-C\n\nOverride `+[RLMObject primaryKey]` to\nset the model's primary key.\n\n```objectivec\n@interface Project : RLMObject\n@property NSInteger id; // Intended primary key\n@property NSString *name;\n@end\n\n@implementation Project\n// Return the name of the primary key property\n+ (NSString *)primaryKey {\n    return @\"id\";\n}\n@end\n\n```\n\n#### Swift Pre 10.10.0\n\nOverride `Object.primaryKey()`\nto set the model's primary key.\n\n```swift\nclass Project: Object {\n    @objc dynamic var id = 0\n    @objc dynamic var name = \"\"\n\n    // Return the name of the primary key property\n    override static func primaryKey() -> String? {\n        return \"id\"\n    }\n}\n\n```\n\n### Index a Property\nYou can create an index on a given property of your model. Indexes speed up\nqueries using equality and IN operators. They make insert and update operation\nspeed slightly slower. Indexes use memory and take up more space in the realm\nfile. Each index entry is a minimum of 12 bytes. It's best to only add indexes\nwhen optimizing the read performance for specific situations.\n\nRealm supports indexing for string, integer, boolean, `Date`, `UUID`,\n`ObjectId`, and `AnyRealmValue` properties.\n\n> Version added: 10.8.0\n> `UUID` and `AnyRealmValue` types\n>\n\n#### Swift\n\nTo index a property, declare the property with\n`indexed:true`\non the `@Persisted` notation.\n\n```swift\nclass Book: Object {\n    @Persisted var priceCents = 0\n    @Persisted(indexed: true) var title = \"\"\n}\n\n```\n\n#### Objective-C\n\nTo index a property, override `RLMObject\nindexedProperties`\nand return a list of indexed property names.\n\n```objectivec\n@interface Book : RLMObject\n@property int priceCents;\n@property NSString *title;\n@end\n\n@implementation Book\n// Return a list of indexed property names\n+ (NSArray *)indexedProperties {\n    return @[@\"title\"];\n}\n@end\n\n```\n\n#### Swift Pre 10.10.0\n\nTo index a property, override\n`Object.indexedProperties()`\nand return a list of indexed property names.\n\n```swift\nclass Book: Object {\n    @objc dynamic var priceCents = 0\n    @objc dynamic var title = \"\"\n\n    // Return a list of indexed property names\n    override static func indexedProperties() -> [String] {\n        return [\"title\"]\n    }\n}\n\n```\n\n### Ignore a Property\nIgnored properties behave exactly like normal properties. They can't be\nused in queries and won't trigger Realm notifications. You can still\nobserve them using [KVO](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html).\n\n> Tip:\n> Realm automatically ignores read-only properties.\n>\n\n#### Swift\n\n> Deprecated:\n\nIf you don't want to save a field in your model to its realm,\nleave the `@Persisted` notation off the property attribute.\n\nAdditionally, if you mix `@Persisted` and `@objc dynamic`\nproperty declarations within a class, the `@objc dynamic`\nproperties will be ignored.\n\n```swift\nclass Person: Object {\n    // If some properties are marked as @Persisted,\n    // any properties that do not have the @Persisted\n    // annotation are automatically ignored.\n    var tmpId = 0\n\n    // The @Persisted properties are managed\n    @Persisted var firstName = \"\"\n    @Persisted var lastName = \"\"\n\n    // Read-only properties are automatically ignored\n    var name: String {\n        return \"\\(firstName) \\(lastName)\"\n    }\n\n    // If you mix the pre-10.10 property declaration\n    // syntax `@objc dynamic` with the 10.10+ @Persisted\n    // annotation within a class, `@objc dynamic`\n    // properties are ignored.\n    @objc dynamic var email = \"\"\n}\n\n```\n\n#### Objective-C\n\nIf you don't want to save a field in your model to its realm,\noverride `+[RLMObject ignoredProperties]`\nand return a list of ignored property names.\n\n```objectivec\n@interface Person : RLMObject\n@property NSInteger tmpId;\n@property (readonly) NSString *name; // read-only properties are automatically ignored\n@property NSString *firstName;\n@property NSString *lastName;\n@end\n\n@implementation Person\n+ (NSArray *)ignoredProperties {\n    return @[@\"tmpId\"];\n}\n- (NSString *)name {\n    return [NSString stringWithFormat:@\"%@ %@\", self.firstName, self.lastName];\n}\n@end\n\n```\n\n#### Swift Pre 10.10.0\n\nIf you don't want to save a field in your model to its realm,\noverride `Object.ignoredProperties()`\nand return a list of ignored property names.\n\n```swift\nclass Person: Object {\n    @objc dynamic var tmpId = 0\n    @objc dynamic var firstName = \"\"\n    @objc dynamic var lastName = \"\"\n\n    // Read-only properties are automatically ignored\n    var name: String {\n        return \"\\(firstName) \\(lastName)\"\n    }\n\n    // Return a list of ignored property names\n    override static func ignoredProperties() -> [String] {\n        return [\"tmpId\"]\n    }\n}\n\n```\n\n### Declare Enum Properties\n#### Swift\n\n> Version changed: 10.10.0\n> Protocol is now `PersistableEnum` rather than `RealmEnum`.\n>\n\nYou can use enums with `@Persisted` by marking them as complying with the\n`PersistableEnum`\nprotocol. A `PersistableEnum` can be any `RawRepresentable` enum\nwhose raw type is a type that Realm supports.\n\n```swift\n// Define the enum\nenum TaskStatusEnum: String, PersistableEnum {\n    case notStarted\n    case inProgress\n    case complete\n}\n\n// To use the enum:\nclass Task: Object {\n    @Persisted var name: String = \"\"\n    @Persisted var owner: String?\n\n    // Required enum property\n    @Persisted var status = TaskStatusEnum.notStarted\n\n    // Optional enum property\n    @Persisted var optionalTaskStatusEnumProperty: TaskStatusEnum?\n}\n\n```\n\n#### Swift Pre 10.10.0\n\nRealm supports only `Int`-backed `@objc` enums.\n\n```swift\n// Define the enum\n@objc enum TaskStatusEnum: Int, RealmEnum {\n    case notStarted = 1\n    case inProgress = 2\n    case complete = 3\n}\n\n// To use the enum:\nclass Task: Object {\n    @objc dynamic var name: String = \"\"\n    @objc dynamic var owner: String?\n\n    // Required enum property\n    @objc dynamic var status = TaskStatusEnum.notStarted\n    // Optional enum property\n    let optionalTaskStatusEnumProperty = RealmProperty<TaskStatusEnum?>()\n}\n\n```\n\n> Seealso:\n> `RealmEnum`\n>\n\n### Remap a Property Name\n> Version added: 10.33.0\n\nYou can map the public name of a property in your object model to a different\nprivate name to store in the realm.\n\nDeclare the name you want to use in your project as the `@Persisted`\nproperty on the object model. Then, pass a dictionary containing the\npublic and private values for the property names via the\n`propertiesMapping()` function.\n\nIn this example, `firstName` is the public property name we use in the code\nthroughout the project to perform CRUD operations. Using the `propertiesMapping()`\nfunction, we map that to store values using the private property name\n`first_name` in the realm.\n\n```swift\nclass Person: Object {\n    @Persisted var firstName = \"\"\n    @Persisted var lastName = \"\"\n\n    override class public func propertiesMapping() -> [String: String] {\n        [\"firstName\": \"first_name\",\n         \"lastName\": \"last_name\"]\n    }\n}\n\n```\n\n## Define a Class Projection\n### About These Examples\nThe examples in this section use a simple data set. The two Realm object\ntypes are `Person` and an embedded object `Address`. A `Person` has\na first and last name, an optional `Address`, and a list of friends\nconsisting of other `Person` objects. An `Address` has a city and country.\n\nSee the schema for these two classes, `Person` and `Address`, below:\n\n```swift\nclass Person: Object {\n    @Persisted var firstName = \"\"\n    @Persisted var lastName = \"\"\n    @Persisted var address: Address?\n    @Persisted var friends = List<Person>()\n}\n\nclass Address: EmbeddedObject {\n    @Persisted var city: String = \"\"\n    @Persisted var country = \"\"\n}\n\n```\n\n### How to Define a Class Projection\n> Version added: 10.21.0\n\nDefine a class projection by creating a class of type `Projection`. Specify the `Object`\nor `EmbeddedObject` base whose\nproperties you want to use in the class projection. Use the `@Projected`\nproperty wrapper to declare a property that you want to project from a\n`@Persisted` property on the base object.\n\n> Note:\n> When you use a List or a MutableSet in a class projection, the type in the\nclass projection should be `ProjectedCollection`.\n>\n\n```swift\nclass PersonProjection: Projection<Person> {\n    @Projected(\\Person.firstName) var firstName // Passthrough from original object\n    @Projected(\\Person.address?.city) var homeCity // Rename and access embedded object property through keypath\n    @Projected(\\Person.friends.projectTo.firstName) var firstFriendsName: ProjectedCollection<String> // Collection mapping\n}\n\n```\n\nWhen you define a class projection, you can transform the original `@Persisted`\nproperty in several ways:\n\n- Passthrough: the property is the same name and type as the original object\n- Rename: the property has the same type as the original object, but a\ndifferent name\n- Keypath resolution: use keypath resolution to access properties of the\noriginal object, including embedded object properties\n- Collection mapping: Project lists or\nmutable sets of `Object` s or\n`EmbeddedObject` s as a collection of primitive values\n- Exclusion: when you use a class projection, the underlying object's\nproperties that are not `@Projected` through the class projection are\nexcluded. This enables you to watch for changes to a class projection\nand not see changes for properties that are not part of the class\nprojection.\n\n## Define Unstructured Data\n> Version added: 10.51.0\n\nStarting in SDK version 10.51.0, you can store collections of mixed data\nwithin a `AnyRealmValue` property. You can use this feature to model complex data\nstructures, such as JSON, without having to define a\nstrict data model.\n\n**Unstructured data** is data that doesn't easily conform to an expected\nschema, making it difficult or impractical to model to individual\ndata classes. For example, your app might have highly variable data or dynamic\ndata whose structure is unknown at runtime.\n\nStoring collections in a mixed property offers flexibility without sacrificing\nfunctionality. And\nyou can work with them the same way you would a non-mixed\ncollection:\n\n- You can nest mixed collections up to 100 levels.\n- You can query on and react to changes on mixed collections.\n- You can find and update individual mixed collection elements.\n\nHowever, storing data in mixed collections is less performant than using a structured\nschema or serializing JSON blobs into a single string property.\n\nTo model unstructured data in your app, define the appropriate properties in\nyour schema as AnyRealmValue types. You can then\nset these `AnyRealmValue` properties as a list or a\ndictionary collection of `AnyRealmValue` elements.\nNote that `AnyRealmValue` *cannot* represent a `MutableSet` or an embedded\nobject.\n\n> Tip:\n> - Use a map of mixed data types when the type is unknown but each value will have a unique identifier.\n> - Use a list of mixed data types when the type is unknown but the order of\nobjects is meaningful.\n>\n"
  },
  {
    "path": "docs/guides/model-data/relationships.md",
    "content": "# Model Relationships - Swift SDK\n## Declare Relationship Properties\n\n### Define a To-One Relationship Property\nA **to-one** relationship maps one property to a single instance of\nanother object type. For example, you can model a person having at most\none companion dog as a to-one relationship.\n\nSetting a relationship field to null removes the connection between objects.\nRealm does not delete the referenced object, though, unless it is\nan embedded object.\n\n> Important:\n> When you declare a to-one relationship in your object model, it must\nbe an optional property. If you try to make a to-one relationship\nrequired, Realm throws an exception at runtime.\n>\n\n#### Objective-C\n\n```objectivec\n// Dog.h\n@interface Dog : RLMObject\n@property NSString *name;\n// No backlink to person -- one-directional relationship\n@end\n\n// Define an RLMArray<Dog> type\nRLM_COLLECTION_TYPE(Dog)\n\n// Person.h\n@interface Person : RLMObject\n@property NSString *name;\n// A person can have one dog\n@property Dog *dog;\n@end\n\n// Dog.m\n@implementation Dog\n@end\n\n// Person.m\n@implementation Person\n@end\n\n```\n\n#### Swift\n\n```swift\nclass Person: Object {\n    @Persisted var name: String = \"\"\n    @Persisted var birthdate: Date = Date(timeIntervalSince1970: 1)\n\n    // A person can have one dog\n    @Persisted var dog: Dog?\n}\n\nclass Dog: Object {\n    @Persisted var name: String = \"\"\n    @Persisted var age: Int = 0\n    @Persisted var breed: String?\n    // No backlink to person -- one-directional relationship\n}\n\n```\n\n> Seealso:\n> For more information about to-one relationships, see:\nTo-One Relationship.\n>\n\n### Define a To-Many Relationship Property\nA **to-many** relationship maps one property to zero or more instances\nof another object type. For example, you can model a person having any\nnumber of companion dogs as a to-many relationship.\n\n#### Objective-C\n\nUse `RLMArray` tagged with your\ntarget type to define your to-many relationship property.\n\n> Tip:\n> Remember to use the `RLM_COLLECTION_TYPE()` macro with your type\nto declare the RLMArray protocol for your type.\n>\n\n```objectivec\n// Dog.h\n@interface Dog : RLMObject\n@property NSString *name;\n// No backlink to person -- one-directional relationship\n@end\n\n// Define an RLMArray<Dog> type\nRLM_COLLECTION_TYPE(Dog)\n\n// Person.h\n@interface Person : RLMObject\n@property NSString *name;\n// A person can have many dogs\n@property RLMArray<Dog *><Dog> *dogs;\n@end\n\n// Dog.m\n@implementation Dog\n@end\n\n// Person.m\n@implementation Person\n@end\n\n```\n\n#### Swift\n\nUse `List` tagged with your target\ntype to define your to-many relationship property.\n\n```swift\nclass Person: Object {\n    @Persisted var name: String = \"\"\n    @Persisted var birthdate: Date = Date(timeIntervalSince1970: 1)\n\n    // A person can have many dogs\n    @Persisted var dogs: List<Dog>\n}\n\nclass Dog: Object {\n    @Persisted var name: String = \"\"\n    @Persisted var age: Int = 0\n    @Persisted var breed: String?\n    // No backlink to person -- one-directional relationship\n}\n\n```\n\n> Seealso:\n> For more information about to-many relationships, see:\nTo-Many Relationship.\n>\n\n### Define an Inverse Relationship Property\nAn **inverse relationship** property is an automatic backlink\nrelationship. Realm automatically updates implicit\nrelationships whenever an object is added or removed in a corresponding\nto-many list or to-one relationship property. You cannot manually set\nthe value of an inverse relationship property.\n\n#### Swift\n\nTo define an inverse relationship, use `LinkingObjects` in your object model. The\n`LinkingObjects` definition specifies the object type and\nproperty name of the relationship that it inverts.\n\n```swift\nclass User: Object {\n    @Persisted(primaryKey: true) var _id: ObjectId\n    @Persisted var _partition: String = \"\"\n    @Persisted var name: String = \"\"\n\n    // A user can have many tasks.\n    @Persisted var tasks: List<Task>\n}\n\nclass Task: Object {\n    @Persisted(primaryKey: true) var _id: ObjectId\n    @Persisted var _partition: String = \"\"\n    @Persisted var text: String = \"\"\n\n    // Backlink to the user. This is automatically updated whenever\n    // this task is added to or removed from a user's task list.\n    @Persisted(originProperty: \"tasks\") var assignee: LinkingObjects<User>\n}\n\n```\n\n#### Objective-C\n\nTo define an inverse relationship, use\n`RLMLinkingObjects` in your object model.\nOverride `+[RLMObject linkingObjectProperties]`\nmethod in your class to specify the object type and property name\nof the relationship that it inverts.\n\n```objectivec\n// Task.h\n@interface Task : RLMObject\n@property NSString *description;\n@property (readonly) RLMLinkingObjects *assignees;\n@end\n\n// Define an RLMArray<Task> type\nRLM_COLLECTION_TYPE(Task)\n\n// User.h\n@interface User : RLMObject\n@property NSString *name;\n@property RLMArray<Task *><Task> *tasks;\n@end\n\n// Task.m\n@implementation Task\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{\n        @\"assignees\": [RLMPropertyDescriptor descriptorWithClass:User.class propertyName:@\"tasks\"],\n    };\n}\n@end\n\n// User.m\n@implementation User\n@end\n\n```\n\n#### Swift Pre 10.10.0\n\nTo define an inverse relationship, use `LinkingObjects`\nin your object model. The `LinkingObjects` definition specifies\nthe object type and property name of the relationship that it inverts.\n\n```swift\nclass User: Object {\n    @objc dynamic var _id: ObjectId = ObjectId.generate()\n    @objc dynamic var _partition: String = \"\"\n    @objc dynamic var name: String = \"\"\n\n    // A user can have many tasks.\n    let tasks = List<Task>()\n\n    override static func primaryKey() -> String? {\n        return \"_id\"\n    }\n}\n\nclass Task: Object {\n    @objc dynamic var _id: ObjectId = ObjectId.generate()\n    @objc dynamic var _partition: String = \"\"\n    @objc dynamic var text: String = \"\"\n\n    // Backlink to the user. This is automatically updated whenever\n    // this task is added to or removed from a user's task list.\n    let assignee = LinkingObjects(fromType: User.self, property: \"tasks\")\n\n    override static func primaryKey() -> String? {\n        return \"_id\"\n    }\n}\n\n```\n\n> Seealso:\n> For more information about inverse relationships, see:\nInverse Relationship.\n>\n\n### Define an Embedded Object Property\nAn **embedded object** exists as nested data inside of a single,\nspecific parent object. It inherits the lifecycle of its parent object\nand cannot exist as an independent Realm object. Realm automatically\ndeletes embedded objects if their parent object is deleted or when\noverwritten by a new embedded object instance.\n\n> Note:\n> When you delete a Realm object, any embedded objects referenced by\nthat object are deleted with it. If you want the referenced objects\nto persist after the deletion of the parent object, your type should\nnot be an embedded object at all. Use a regular Realm object with a to-one relationship instead.\n>\n\n#### Objective-C\n\nYou can define an embedded object by deriving from the\n`RLMEmbeddedObject` class. You can use your\nembedded object in another model as you would any other type.\n\n```objectivec\n// Define an embedded object\n@interface Address : RLMEmbeddedObject\n@property NSString *street;\n@property NSString *city;\n@property NSString *country;\n@property NSString *postalCode;\n@end\n\n// Enable Address for use in RLMArray\nRLM_COLLECTION_TYPE(Address)\n\n@implementation Address\n@end\n\n// Define an object with one embedded object\n@interface Contact : RLMObject\n@property NSString *name;\n\n// Embed a single object.\n@property Address *address;\n@end\n\n@implementation Contact\n@end\n\n// Define an object with an array of embedded objects\n@interface Business : RLMObject\n@property NSString *name;\n// Embed an array of objects\n@property RLMArray<Address *><Address> *addresses;\n@end\n\n```\n\n#### Swift\n\nYou can define an embedded object by deriving from the\n`EmbeddedObject`\nclass. You can use your embedded object in another model as you\nwould any other type.\n\n```swift\nclass Person: Object {\n    @Persisted(primaryKey: true) var id = 0\n    @Persisted var name = \"\"\n\n    // To-many relationship - a person can have many dogs\n    @Persisted var dogs: List<Dog>\n\n    // Inverse relationship - a person can be a member of many clubs\n    @Persisted(originProperty: \"members\") var clubs: LinkingObjects<DogClub>\n\n    // Embed a single object.\n    // Embedded object properties must be marked optional.\n    @Persisted var address: Address?\n\n    convenience init(name: String, address: Address) {\n        self.init()\n        self.name = name\n        self.address = address\n    }\n}\n\nclass DogClub: Object {\n    @Persisted var name = \"\"\n    @Persisted var members: List<Person>\n\n    // DogClub has an array of regional office addresses.\n    // These are embedded objects.\n    @Persisted var regionalOfficeAddresses: List<Address>\n\n    convenience init(name: String, addresses: [Address]) {\n        self.init()\n        self.name = name\n        self.regionalOfficeAddresses.append(objectsIn: addresses)\n    }\n}\n\nclass Address: EmbeddedObject {\n    @Persisted var street: String?\n    @Persisted var city: String?\n    @Persisted var country: String?\n    @Persisted var postalCode: String?\n}\n\n```\n"
  },
  {
    "path": "docs/guides/model-data/supported-types.md",
    "content": "# Supported Types - Swift SDK\n## Collection Types\nRealm has several types to represent groups of objects,\nwhich we call **collections**. A collection is an object that contains\nzero or more instances of one Realm type. Realm collections are **homogenous**:\nall objects in a collection are of the same type.\n\nYou can filter and sort any collection using Realm's\nquery engine. Collections are\nlive, so they always reflect the current state\nof the realm instance on the current thread. You can also\nlisten for changes in the collection by subscribing to collection\nnotifications.\n\nAll collection types conform to the `RealmCollection` protocol. This protocol inherits from\n`CollectionType`, so you can use\na Realm collection as you would any other standard library\ncollections.\n\nUsing the RealmCollection protocol, you can write generic code that can\noperate on any Realm collection:\n\n```swift\nfunc operateOn<C: RealmCollection>(collection: C) {\n    // Collection could be either Results or List\n    print(\"operating on collection containing \\(collection.count) objects\")\n}\n\n```\n\n### Results and Sectioned Results\nThe Swift SDK `Results` collection is\na class representing objects retrieved from queries. A\n`[Results` collection represents the\nlazily-evaluated results of a query operation. Results are immutable:\nyou cannot add or remove elements to or from the results collection.\nResults have an associated query that determines their contents.\n\nThe Swift SDK also provides `SectionedResults`,\na type-safe collection which holds `ResultsSection` as its elements.\nEach `ResultSection` is a results\ncollection that contains only objects that belong to a given section key.\n\nFor example, an app that includes a contact list might use SectionedResults\nto display a list of contacts divided into sections, where each section\ncontains all the contacts whose first name starts with the given letter.\nThe `ResultsSection` whose key is \"L\" would contain \"Larry\", \"Liam\",\nand \"Lisa\".\n\n> Seealso:\n> Reads\n>\n\n### Collections as Properties\nThe Swift SDK also offers several collection types you can use as properties\nin your data model:\n\n1. `List`, a class representing\nto-many relationships in models.\n2. `LinkingObjects`, a class\nrepresenting inverse relationships in models.\n3. MutableSet, a class representing\na to-many relationship.\n4. Map, a class representing an associative array of key-value\npairs with unique keys.\n5. `AnyRealmCollection`, a [type-erased](https://en.wikipedia.org/wiki/Type_erasure) class that can forward calls to a concrete Realm collection like Results, List or LinkingObjects.\n\n### Collections are Live\nLike live objects, Realm collections\nare usually **live**:\n\n- Live results collections always reflect the current results of the associated query.\n- Live lists always reflect the current state of the relationship on the realm instance.\n\nThere are two cases when a collection is **not** live:\n\n- The collection is unmanaged. For example, a List property of\na Realm object that has not been added to a realm yet\nor that has been copied from a realm is not live.\n- The collection is frozen.\n\nCombined with collection notifications, live collections enable\nclean, reactive code. For example, suppose your view displays the\nresults of a query. You can keep a reference to the results collection\nin your view class, then read the results collection as needed without\nhaving to refresh it or validate that it is up-to-date.\n\n> Important:\n> Since results update themselves automatically, do not\nstore the positional index of an object in the collection\nor the count of objects in a collection. The stored index\nor count value could be outdated by the time you use\nit.\n>\n\n## Supported Property Types\nYou can use the following types to define your object model\nproperties.\n\n### Property Cheat Sheet\n#### Swift\n\n> Version changed: 10.10.0\n> `@Persisted` property declaration syntax\n>\n\n|Type|Required|Optional|\n| --- | --- | --- |\n|Bool|`@Persisted var boolName: Bool`|`@Persisted var optBoolName: Bool?`|\n|Int, Int8, Int16, Int32, Int64|`@Persisted var intName: Int`|`@Persisted var optIntName: Int?`|\n|Float|`@Persisted var floatName: Float`|`@Persisted var optFloatName: Float?`|\n|Double|`@Persisted var doubleName: Double`|`@Persisted var optDoubleName: Double?`|\n|String|`@Persisted var stringName: String`|`@Persisted var optStringName: String?`|\n|Data|`@Persisted var dataName: Data`|`@Persisted var optDataName: Data?`|\n|Date|`@Persisted var dateName: Date`|`@Persisted var optDateName: Date?`|\n|Decimal128|`@Persisted var decimalName: Decimal128`|`@Persisted var optDecimalName: Decimal128?`|\n|`UUID`|`@Persisted var uuidName: UUID`|`@Persisted var optUuidName: UUID?`|\n|`ObjectId`|`@Persisted var objectIdName: ObjectId`|`@Persisted var optObjectIdName: ObjectId?`|\n|`List`|`@Persisted var listName: List<MyCustomObjectType>`|N/A|\n|MutableSet|`@Persisted var mutableSetName: MutableSet<String>`|N/A|\n|Map|`@Persisted var mapName: Map<String, String>`|N/A|\n|AnyRealmValue|`@Persisted var anyRealmValueName: AnyRealmValue`|N/A|\n|User-defined `Object`|N/A|`@Persisted var optObjectPropertyName: MyCustomObjectType?`|\n|User-defined `EmbeddedObject`|N/A|`@Persisted var optEmbeddedObjectPropertyName: MyEmbeddedObjectType?`|\n|User-defined `Enums`|`@Persisted var enumName: MyPersistableEnum`|`@Persisted var optEnumName: MyPersistableEnum?`|\n\n`CGFloat` properties are discouraged, as the type is not\nplatform independent.\n\nTo use Key-Value Coding with a user-defined object in the `@Persisted`\nsyntax, add the `@objc` attribute: `@Persisted @objc var myObject: MyClass?`\n\n##### Setting Default Values\nWith the `@Persisted` property declaration syntax, you may see a\nperformance impact when setting default values for:\n\n- `List`\n- `MutableSet`\n- `Dictionary`\n- `Decimal128`\n- `UUID`\n- `ObjectId`\n\n`@Persisted var listProperty: List<Int>` and `@Persisted var\nlistProperty = List<Int>()` are both valid, and are functionally\nequivalent. However, the second declaration will result in poorer\nperformance.\n\nThis is because the List is created when the parent object is\ncreated, rather than lazily as needed. For most types, this is\na difference so small you can't measure it. For the types listed\nhere, you may see a performance impact when using the second\ndeclaration style.\n\n#### Objective-C\n\n|Type|Required|Optional|\n| --- | --- | --- |\n|Boolean|`@property BOOL boolName;`|`@property NSNumber<RLMBool> *optBoolName;`|\n|Integer|`@property int intName;`|`@property NSNumber<RLMInt> *optIntName;`|\n|Float|`@property float floatName;`|`@property NSNumber<RLMFloat> *optFloatName;`|\n|Double|`@property double doubleName;`|`@property NSNumber<RLMDouble> *optDoubleName;`|\n|String|`@property NSString *stringName;`|`@property NSString *optStringName;`|\n|Data|`@property NSData *dataName;`|`@property NSData *optDataName;`|\n|Date|`@property NSDate *dateName;`|`@property NSDate *optDateName;`|\n|Decimal128|`@property RLMDecimal128 *decimalName;`|`@property RLMDecimal128 *optDecimalName;`|\n|NSUUID|`@property NSUUID *uuidName;`|`@property NSUUID *optUuidName;`|\n|`RLMObjectId`|`@property RLMObjectId *objectIdName;`|`@property RLMObjectId *optObjectIdName;`|\n|`RLMArray`|`@property RLMArray<MyObject *><MyObject> *arrayName;`|N/A|\n|`RLMSet`|`@property RLMSet<RLMString> *setName;`|N/A|\n|`RLMDictionary`|`@property RLMDictionary<NSString *, NSString *><RLMString, RLMString> *dictionaryName;`|N/A|\n|User-defined `RLMObject`|N/A|`@property MyObject *optObjectPropertyName;`|\n|User-defined `RLMEmbeddedObject`|N/A|`@property MyEmbeddedObject *optEmbeddedObjectPropertyName;`|\n\nAdditionally:\n\n- Integral types `int`, `NSInteger`, `long`, `long long`\n\n`CGFloat` properties are discouraged, as the type is not\nplatform independent.\n\n#### Swift Pre 10.10.0\n\n> Version changed: 10.8.0\n> `RealmProperty` replaces `RealmOptional`\n>\n\n|Type|Required|Optional|\n| --- | --- | --- |\n|Bool|`@objc dynamic var value = false`|`let value = RealmProperty<Bool?>()`|\n|Int, Int8, Int16, Int32, Int64|`@objc dynamic var value = 0`|`let value = RealmProperty<Int?>()`|\n|Float|`@objc dynamic var value: Float = 0.0`|`let value = RealmProperty<Float?>()`|\n|Double|`@objc dynamic var value: Double = 0.0`|`let value = RealmProperty<Double?>()`|\n|String|`@objc dynamic var value = \"\"`|`@objc dynamic var value: String? = nil`|\n|Data|`@objc dynamic var value = Data()`|`@objc dynamic var value: Data? = nil`|\n|Date|`@objc dynamic var value = Date()`|`@objc dynamic var value: Date? = nil`|\n|Decimal128|`@objc dynamic var decimal: Decimal128 = 0`|`@objc dynamic var decimal: Decimal128?`|\n|`UUID`|`@objc dynamic var uuid = UUID()`|`@objc dynamic var uuidOpt: UUID?`|\n|`ObjectId`|`@objc dynamic var objectId = ObjectId.generate()`|`@objc dynamic var objectId: ObjectId?`|\n|`List`|`let value = List<Type>()`||\n|MutableSet|`let value = MutableSet<Type>()`||\n|Map|`let value = Map<String, String>()`||\n|AnyRealmValue|`let value = RealmProperty<AnyRealmValue>()`|N/A|\n|User-defined `Object`|N/A|`@objc dynamic var value: MyClass?`|\n\nAdditionally:\n\n- `EmbeddedObject`-derived types\n- `Enum`\n\nYou can use `RealmProperty <T?>` to\nrepresent integers, doubles, and other types as optional.\n\n`CGFloat` properties are discouraged, as the type is not\nplatform independent.\n\n### Unique Identifiers\n> Version added: 10.8.0\n> `UUID` type\n>\n\n`ObjectId` is a 12-byte unique value. `UUID` is a\n16-byte globally-unique value. You can index\nboth types, and use either as a primary key.\n\n> Note:\n> When declaring default values for `@Persisted` UUID or ObjectId property\nattributes, both of these syntax types are valid:\n>\n> - `@Persisted var value: UUID`\n> - `@Persisted var value = UUID()`\n>\n> However, the second will result in poorer performance. This is because the\nlatter creates a new identifier that is never used any time an object is\nread from the realm, while the former only creates them when needed.\n>\n> `@Persisted var id: ObjectId` has equivalent behavior to `@objc dynamic\nvar _id = ObjectId.generate()`. They both make random ObjectIds.\n>\n> `@Persisted var _id = ObjectId()` has equivalent behavior to `@objc\ndynamic var _id = ObjectId()`. They both make zero-initialized ObjectIds.\n>\n\n### Size Limitations\nData and string properties cannot hold more than 16MB. To store\nlarger amounts of data, either:\n\n- Break the data into 16MB chunks, or\n- Store data directly on the file system and store paths to the files in the realm.\n\nRealm throws a runtime exception if your app attempts to\nstore more than 16MB in a single property.\n\nTo avoid size limitations and a performance impact, it is best not to\nstore large blobs, such as image and video files, directly in a\nrealm. Instead, save the file to a file store and keep only the\nlocation of the file and any relevant metadata in the realm.\n\n### AnyRealmCollection\nTo store a collection as a property or variable without needing to know\nthe concrete collection type, Swift's type system requires a type-erased\nwrapper like `AnyRealmCollection`:\n\n```swift\nclass ViewController {\n//    let collection: RealmCollection\n//                    ^\n//                    error: protocol 'RealmCollection' can only be used\n//                    as a generic constraint because it has Self or\n//                    associated type requirements\n//\n//    init<C: RealmCollection>(collection: C) where C.ElementType == MyModel {\n//        self.collection = collection\n//    }\n\n    let collection: AnyRealmCollection<MyModel>\n\n    init<C: RealmCollection & _ObjcBridgeable>(collection: C) where C.ElementType == MyModel {\n        self.collection = AnyRealmCollection(collection)\n    }\n}\n\n```\n\n### Mutable Set\n> Version added: 10.8.0\n\nA `MutableSet`\ncollection represents a to-many relationship\ncontaining distinct values. A `MutableSet` supports the following types\n(and their optional versions):\n\n- Bool\n- Data\n- Date\n- Decimal128\n- Double\n- Float\n- Int\n- Int8\n- Int16\n- Int32\n- Int64\n- Object\n- ObjectId\n- String\n- UUID\n\nLike Swift's [Set](https://developer.apple.com/documentation/swift/set), `MutableSet` is a\ngeneric type that is parameterized on the type it stores. Unlike\n[native Swift collections](https://developer.apple.com/documentation/swift/swift_standard_library/collections),\nRealm mutable sets are reference types, as opposed to value\ntypes (structs).\n\nYou can only call the `MutableSets` mutation methods during a write\ntransaction. As a result, `MutableSets` are immutable if you open the\nmanaging realm as a read-only realm.\n\nYou can filter and sort a `MutableSet` with the same predicates as Results. Like other\nRealm collections, you can register a change listener on a `MutableSet`.\n\nFor example, a `Dog` class model might contain a `MutableSet` for\n`citiesVisited`:\n\n```swift\nclass Dog: Object {\n    @Persisted var name = \"\"\n    @Persisted var currentCity = \"\"\n    @Persisted var citiesVisited: MutableSet<String>\n}\n```\n\n> Note:\n> When declaring default values for `@Persisted` MutableSet property attributes,\nboth of these syntax types is valid:\n>\n> - `@Persisted var value: MutableSet<String>`\n> - `@Persisted var value = MutableSet<String>()`\n>\n> However, the second will result in significantly worse performance. This is\nbecause the MutableSet is created when the parent object is created, rather than\nlazily as needed.\n>\n\n### Map/Dictionary\n> Version added: 10.8.0\n\nThe `Map` is an associative array that\ncontains key-value pairs with unique keys.\n\nLike Swift's [Dictionary](https://developer.apple.com/documentation/swift/dictionary),\n`Map` is a generic type that is parameterized on its key and value\ntypes. Unlike [native Swift collections](https://developer.apple.com/documentation/swift/swift_standard_library/collections),\nRealm Maps are reference types (classes), as opposed to\nvalue types (structs).\n\nYou can declare a Map as a property of an object:\n\n```swift\nclass Dog: Object {\n    @Persisted var name = \"\"\n    @Persisted var currentCity = \"\"\n\n    // Map of city name -> favorite park in that city\n    @Persisted var favoriteParksByCity: Map<String, String>\n}\n```\n\nRealm disallows the use of `.` or `$` characters in map keys.\nYou can use percent encoding and decoding to store a map key that contains\none of these disallowed characters.\n\n```\n// Percent encode . or $ characters to use them in map keys\nlet mapKey = \"New York.Brooklyn\"\nlet encodedMapKey = \"New York%2EBrooklyn\"\n\n```\n\n> Note:\n> When declaring default values for `@Persisted` Map property attributes, both\nof these syntax types is valid:\n>\n> - `@Persisted var value: Map<String, String>`\n> - `@Persisted var value = Map<String, String>()`\n>\n> However, the second will result in significantly worse performance. This is\nbecause the Map is created when the parent object is created, rather than\nlazily as needed.\n>\n\n### AnyRealmValue\n> Version changed: 10.51.0\n> `AnyRealmValue` properties can hold lists or maps of mixed data.\n>\n\n> Version added: 10.8.0\n\n`AnyRealmValue` is a Realm property type that can hold different\ndata types. Supported `AnyRealmValue` data types include:\n\n- Int\n- Float\n- Double\n- Decimal128\n- ObjectID\n- UUID\n- Bool\n- Date\n- Data\n- String\n- List\n- Map\n- Object\n\n`AnyRealmValue` *cannot* hold a `MutableSet` or embedded object.\n\nThis mixed data type\nis indexable, but you can't use it as a\nprimary key. Because `null` is a\npermitted value, you can't declare an `AnyRealmValue` as optional.\n\n```swift\nclass Dog: Object {\n    @Persisted var name = \"\"\n    @Persisted var currentCity = \"\"\n\n    @Persisted var companion: AnyRealmValue\n}\n```\n\n#### Collections as Mixed\nIn version 10.51.0 and later, a `AnyRealmValue` data type can\ncontain collections (a list or map, but *not* a set) of `AnyRealmValue`\nelements. You can use mixed collections to\nmodel unstructured or variable data. For more information, refer to\nDefine Unstructured Data.\n\n- You can nest mixed collections up to 100 levels.\n- You can query mixed collection properties and\nregister a listener for changes,\nas you would a normal collection.\n- You can find and update individual mixed collection elements\n- You *cannot* store sets or embedded objects in mixed collections.\n\nTo use mixed collections in your app, define the `AnyRealmValue` type\nproperty in your data model.\nThen, you can create the list or map collections like any other mixed data value.\n\n### Geospatial Data\n> Version added: 10.47.0\n\nGeospatial data, or \"geodata\", specifies points and geometric objects on\nthe Earth's surface.\n\nIf you want to persist geospatial data, it must conform to the\n[GeoJSON spec](https://datatracker.ietf.org/doc/html/rfc7946).\n\nTo persist geospatial data with the Swift SDK, create a GeoJSON-compatible\nembedded class that you can use in your data model.\n\nYour custom embedded object must contain the two fields required by the\nGeoJSON spec:\n\n- A field of type `String` property that maps to a `type` property with\nthe value of `\"Point\"`: `@Persisted var type: String = \"Point\"`\n- A field of type `List<Double>` that maps to a `coordinates`\nproperty containing a latitude/longitude pair:\n`@Persisted private var coordinates: List<Double>`\n\n```swift\nclass CustomGeoPoint: EmbeddedObject {\n    @Persisted private var type: String = \"Point\"\n    @Persisted private var coordinates: List<Double>\n\n    public var latitude: Double { return coordinates[1] }\n    public var longitude: Double { return coordinates[0] }\n\n    convenience init(_ latitude: Double, _ longitude: Double) {\n        self.init()\n        // Longitude comes first in the coordinates array of a GeoJson document\n        coordinates.append(objectsIn: [longitude, latitude])\n    }\n}\n\n```\n\n## Map Unsupported Types to Supported Types\n> Version added: 10.20.0\n\nYou can use Type Projection to persist unsupported types as supported types\nin Realm. This enables you to work with Swift types that Realm\ndoes not support, but store them as types that Realm does support. You could\nstore a URL as a `String`, for example, but read it from\nRealm and use it in your application as though it were a URL.\n\n### Declare Type Projections\nTo use type projection with Realm:\n\n1. Use one of Realm's custom type protocols to map an unsupported data type\nto a type that Realm supports\n2. Use the projected types as @Persisted properties in the Realm object\nmodel\n\n#### Conform to the Type Projection Protocol\nYou can map an unsupported data type to a type that Realm supports using one of the Realm type projection protocols.\n\nThe Swift SDK provides two type projection protocols:\n\n- CustomPersistable\n- FailableCustomPersistable\n\nUse `CustomPersistable`\nwhen there is no chance the conversion can fail.\n\nUse `FailableCustomPersistable`\nwhen it is possible for the conversion to fail.\n\n```swift\n// Extend a type as a CustomPersistable if if is impossible for\n// conversion between the mapped type and the persisted type to fail.\nextension CLLocationCoordinate2D: CustomPersistable {\n    // Define the storage object that is persisted to the database.\n    // The `PersistedType` must be a type that Realm supports.\n    // In this example, the PersistedType is an embedded object.\n    public typealias PersistedType = Location\n    // Construct an instance of the mapped type from the persisted type.\n    // When reading from the database, this converts the persisted type to the mapped type.\n    public init(persistedValue: PersistedType) {\n        self.init(latitude: persistedValue.latitude, longitude: persistedValue.longitude)\n    }\n    // Construct an instance of the persisted type from the mapped type.\n    // When writing to the database, this converts the mapped type to a persistable type.\n    public var persistableValue: PersistedType {\n        Location(value: [self.latitude, self.longitude])\n    }\n}\n\n// Extend a type as a FailableCustomPersistable if it is possible for\n// conversion between the mapped type and the persisted type to fail.\n// This returns nil on read if the underlying column contains nil or\n// something that can't be converted to the specified type.\nextension URL: FailableCustomPersistable {\n    // Define the storage object that is persisted to the database.\n    // The `PersistedType` must be a type that Realm supports.\n    public typealias PersistedType = String\n    // Construct an instance of the mapped type from the persisted type.\n    // When reading from the database, this converts the persisted type to the mapped type.\n    // This must be a failable initializer when the conversion may fail.\n    public init?(persistedValue: String) { self.init(string: persistedValue) }\n    // Construct an instance of the persisted type from the mapped type.\n    // When writing to the database, this converts the mapped type to a persistable type.\n    public var persistableValue: String { self.absoluteString }\n}\n\n```\n\n> Seealso:\n> These are protocols modeled after Swift's built-in [RawRepresentable](https://developer.apple.com/documentation/swift/rawrepresentable).\n>\n\n##### Supported PersistedTypes\nThe `PersistedType` can use any of the primitive types that the\nSwift SDK supports. It can also be\nan Embedded Object.\n\n`PersistedType` cannot be an optional or a collection. However you can use the mapped type as an\noptional or collection property in your object model.\n\n```swift\nextension URL: FailableCustomPersistable {\n   // The `PersistedType` cannot be an optional, so this is not a valid\n   // conformance to the FailableCustomPersistable protocol.\n   public typealias PersistedType = String?\n   ...\n}\n\nclass Club: Object {\n   @Persisted var id: ObjectId\n   @Persisted var name: String\n   // Although the `PersistedType` cannot be optional, you can use the\n   // custom-mapped type as an optional in your object model.\n   @Persisted var url: URL?\n}\n```\n\n#### Use Type Projection in the Model\nA type that conforms to one of the type projection protocols can be used with\nthe `@Persisted` property declaration syntax introduced in Swift SDK\nversion 10.10.0. It does not work with the `@objc dynamic` syntax.\n\nYou can use projected types for:\n\n- Top-level types\n- Optional versions of the type\n- The types for a collection\n\nWhen using a `FailableCustomPersistable` as a property, define it as an\noptional property. When it is optional, the `FailableCustomPersistable`\nprotocol maps invalid values to `nil`. When it is a required property, it is\nforce-unwrapped. If you have a value that can't be converted to the projected\ntype, reading that property throws an unwrapped fail exception.\n\n```swift\nclass Club: Object {\n    @Persisted var id: ObjectId\n    @Persisted var name: String\n    // Since we declared the URL as a FailableCustomPersistable,\n    // it must be optional.\n    @Persisted var url: URL?\n    // Here, the `location` property maps to an embedded object.\n    // We can declare the property as required.\n    // If the underlying field contains nil, this becomes\n    // a default-constructed instance of CLLocationCoordinate\n    // with field values of `0`.\n    @Persisted var location: CLLocationCoordinate2D\n}\n\npublic class Location: EmbeddedObject {\n    @Persisted var latitude: Double\n    @Persisted var longitude: Double\n}\n\n```\n\nWhen your model contains projected types, you can create the object with values using the persisted type, or\nby assigning to the field properties of an initialized object using the\nprojected types.\n\n```swift\n// Initialize objects and assign values\nlet club = Club(value: [\"name\": \"American Kennel Club\", \"url\": \"https://akc.org\"])\nlet club2 = Club()\nclub2.name = \"Continental Kennel Club\"\n// When assigning the value to a type-projected property, type safety\n// checks for the mapped type - not the persisted type.\nclub2.url = URL(string: \"https://ckcusa.com/\")!\nclub2.location = CLLocationCoordinate2D(latitude: 40.7509, longitude: 73.9777)\n\n```\n\n##### Type Projection in the Schema\nWhen you declare your type as conforming to a type projection protocol, you\nspecify the type that should be persisted in realm. For example, if\nyou map a custom type `URL` to a persisted type of `String`, a `URL`\nproperty appears as a `String` in the schema, and dynamic access to the\nproperty acts on strings.\n\nThe schema does not directly represent mapped types. Changing a property\nfrom its persisted type to its mapped type, or vice versa, does not require\na migration.\n"
  },
  {
    "path": "docs/guides/quick-start.md",
    "content": "# Quick Start - Swift SDK\nThis Quick Start demonstrates how to use Realm with the Realm Swift SDK.\nBefore you begin, ensure you have installed the Swift SDK.\n\n> Seealso:\n> If your app uses SwiftUI, check out the [SwiftUI Quick Start](swiftui-tutorial.md).\n>\n\n## Import Realm\nNear the top of any Swift file that uses Realm, add the following import\nstatement:\n\n```swift\nimport RealmSwift\n\n```\n\n## Define Your Object Model\nFor a local realm, you can define your object model directly in code.\n\n```swift\nclass Todo: Object {\n   @Persisted(primaryKey: true) var _id: ObjectId\n   @Persisted var name: String = \"\"\n   @Persisted var status: String = \"\"\n   @Persisted var ownerId: String\n\n   convenience init(name: String, ownerId: String) {\n       self.init()\n       self.name = name\n       self.ownerId = ownerId\n   }\n}\n\n```\n\n## Open a Realm\nIn a local realm, the simplest option to open a realm\nis to use the default realm with no configuration parameter:\n\n```swift\n// Open the default realm\nlet realm = try! Realm()\n\n```\n\nYou can also specify a `Realm.Configuration`\nparameter to open a realm at a specific file URL, in-memory, or with a\nsubset of classes.\n\nFor more information, see: Configure and Open a Realm.\n\n## Create, Read, Update, and Delete Objects\nOnce you have opened a realm, you can modify it and its objects\nin a write transaction block.\n\nTo create a new Todo object, instantiate the Todo class and add it to the realm in a write block:\n\n```swift\nlet todo = Todo(name: \"Do laundry\", ownerId: user.id)\ntry! realm.write {\n    realm.add(todo)\n}\n\n```\n\nYou can retrieve a live collection of all todos in the realm:\n\n```swift\n// Get all todos in the realm\nlet todos = realm.objects(Todo.self)\n\n```\n\nYou can also filter that collection using where:\n\n```swift\nlet todosInProgress = todos.where {\n    $0.status == \"InProgress\"\n}\nprint(\"A list of all todos in progress: \\(todosInProgress)\")\n\n```\n\nTo modify a todo, update its properties in a write transaction block:\n\n```swift\n// All modifications to a realm must happen in a write block.\nlet todoToUpdate = todos[0]\ntry! realm.write {\n    todoToUpdate.status = \"InProgress\"\n}\n\n```\n\nFinally, you can delete a todo:\n\n```swift\n// All modifications to a realm must happen in a write block.\nlet todoToDelete = todos[0]\ntry! realm.write {\n    // Delete the Todo.\n    realm.delete(todoToDelete)\n}\n\n```\n\n## Watch for Changes\nYou can watch a realm, collection, or object for changes with the `observe` method.\n\n```swift\n// Retain notificationToken as long as you want to observe\nlet notificationToken = todos.observe { (changes) in\n    switch changes {\n    case .initial: break\n        // Results are now populated and can be accessed without blocking the UI\n    case .update(_, let deletions, let insertions, let modifications):\n        // Query results have changed.\n        print(\"Deleted indices: \", deletions)\n        print(\"Inserted indices: \", insertions)\n        print(\"Modified modifications: \", modifications)\n    case .error(let error):\n        // An error occurred while opening the Realm file on the background worker thread\n        fatalError(\"\\(error)\")\n    }\n}\n\n```\n\nBe sure to retain the notification token returned by `observe` as\nlong as you want to continue observing. When you are done observing,\ninvalidate the token to free the resources:\n\n```swift\n// Invalidate notification tokens when done observing\nnotificationToken.invalidate()\n\n```\n"
  },
  {
    "path": "docs/guides/realm-files/bundle-a-realm.md",
    "content": "# Bundle a Realm File - Swift SDK\n\nRealm supports **bundling** realm files. When you bundle\na realm file, you include a database and all of its data in your\napplication download.\n\nThis allows users to start applications for the first time with a set of\ninitial data.\n\n## Overview\nTo create and bundle a realm file with your application:\n\n1. Create a realm file that\ncontains the data you'd like to bundle.\n2. Bundle the realm file in your\nproduction application.\n3. In your production application,\nopen the realm from the bundled asset file.\n\n## Create a Realm File for Bundling\n1. Build a temporary realm app that shares the data model of your\napplication.\n2. Open a realm and add the data you wish to bundle.\n3. Use the `writeCopy(configuration:)`\nmethod to copy the realm to a new file:\n\n> Tip:\n> If your app accesses Realm in an `async/await` context, mark the code\nwith `@MainActor` to avoid threading-related crashes.\n>\n\n`writeCopy(configuration: )`\nautomatically compacts your realm to the smallest possible size before\ncopying.\n\n## Bundle a Realm File in Your Production Application\nNow that you have a copy of the realm that contains the initial data,\nbundle it with your production application. At a broad level, this entails:\n\n1. Create a new project with the exact same data models as your production\napp. Open a realm and add the data you wish to bundle. Since realm\nfiles are cross-platform, you can do this in a macOS app.\n2. Drag the compacted copy of your realm file to your production app's Xcode\nProject Navigator.\n3. Go to your app target's Build Phases tab in Xcode. Add the\nrealm file to the Copy Bundle Resources build phase.\n4. At this point, your app can access the bundled realm file. Find its path\nwith [Bundle.main.path(forResource:ofType)](https://developer.apple.com/documentation/foundation/bundle/1410989-path).\n\nYou can open the realm at the bundle path directly if the\n`readOnly` property is set to `true` on the\n`Realm.Configuration`. If\nyou want to modify the bundled realm, first copy the bundled file to\nyour app's Documents folder with setting `seedFilePath` with the URL of the bundled Realm on your Configuration.\n\n> Tip:\n> See the [migration sample app](https://github.com/realm/realm-swift/tree/master/examples/ios/swift/Migration) for a\ncomplete working app that uses a bundled local realm.\n>\n\n## Open a Realm from a Bundled Realm File\nNow that you have a copy of the realm included with your production\napplication, you need to add code to use it. Use the `seedFilePath`\nmethod when configuring your realm to open the realm\nfrom the bundled file:\n\n> Tip:\n> If your app accesses Realm in an `async/await` context, mark the code\nwith `@MainActor` to avoid threading-related crashes.\n>\n\n```swift\ntry await openBundledSyncedRealm()\n\n// Opening a realm and accessing it must be done from the same thread.\n// Marking this function as `@MainActor` avoids threading-related issues.\n@MainActor\nfunc openBundledRealm() async throws {\n\n    // Find the path of the seed.realm file in your project\n    let realmURL = Bundle.main.url(forResource: \"seed\", withExtension: \".realm\")\n    print(\"The bundled realm URL is: \\(realmURL)\")\n\n    // When you use the `seedFilePath` parameter, this copies the\n    // realm at the specified path for use with the user's config\n    newUserConfig.seedFilePath = realmURL\n\n    // Open the realm, downloading any changes before opening it.\n    // This starts with the existing data in the bundled realm, but checks\n    // for any updates to the data before opening it in your application.\n    let realm = try await Realm(configuration: newUserConfig, downloadBeforeOpen: .always)\n    print(\"Successfully opened the bundled realm\")\n\n    // Read and write to the bundled realm as normal\n    let todos = realm.objects(Todo.self)\n\n    // There should be one todo whose owner is Daenerys because that's\n    // what was in the bundled realm.\n    var daenerysTodos = todos.where { $0.owner == \"Daenerys\" }\n    XCTAssertEqual(daenerysTodos.count, 1)\n    print(\"The bundled realm has \\(daenerysTodos.count) todos whose owner is Daenerys\")\n\n    // Write as usual to the realm, and see the object count increment\n    let todo = Todo(value: [\"name\": \"Banish Ser Jorah\", \"owner\": \"Daenerys\", \"status\": \"In Progress\"])\n    try realm.write {\n        realm.add(todo)\n    }\n    print(\"Successfully added a todo to the realm\")\n\n    daenerysTodos = todos.where { $0.owner == \"Daenerys\" }\n    XCTAssertEqual(daenerysTodos.count, 2)\n}\n\n```\n"
  },
  {
    "path": "docs/guides/realm-files/compacting.md",
    "content": "# Reduce Realm File Size - Swift SDK\n## Overview\nThe size of a realm file is always larger than the total\nsize of the objects stored within it. This architecture enables some of\nrealm's great performance, concurrency, and safety benefits.\n\nRealm writes new data within unused space tracked inside a\nfile. In some situations, unused space may comprise a significant\nportion of a realm file. Realm's default behavior is to automatically\ncompact a realm file to prevent it from growing too large.\nYou can use manual compaction strategies when\nautomatic compaction is not sufficient for your use case\nor you're using a version of the SDK that doesn't have automatic\ncompaction.\n\n## Realm File Size\nGenerally, a realm file takes less space on disk than a\ncomparable SQLite database. These factors can affect\nfile size:\n\n- Pinning transactions\n- Threading\n- Dispatch Queues\n\nWhen you consider reducing the file size through compacting, there are a\ncouple of things to keep in mind:\n\n- Compacting can be a resource-intensive operation\n- Compacting can block the UI thread\n\nBecause of these factors, you probably don't want to compact a realm every\ntime you open it, but instead want to consider when to compact a\nrealm. This varies based on your application's\nplatform and usage patterns. When deciding when to compact, consider iOS\nfile size limitations.\n\n### Avoid Pinning Transactions\nRealm ties read transaction lifetimes to the memory lifetime\nof realm instances. Avoid \"pinning\" old Realm transactions.\nUse auto-refreshing realms, and wrap the use of Realm APIs\nfrom background threads in explicit autorelease pools.\n\n### Threading\nRealm updates the version of your data that it accesses at\nthe start of a run loop iteration. While this gives you a consistent\nview of your data, it has file size implications.\n\nImagine this scenario:\n\n- **Thread A**: Read some data from a realm, and then block the thread on a\nlong-running operation.\n- **Thread B**: Write data on another thread.\n- **Thread A**: The version on the read thread isn't updated. Realm has\nto hold intermediate versions of the data, growing in file size with\nevery write.\n\nTo avoid this issue, call `invalidate()`\non the realm. This tells the realm that you no longer need the\nobjects you've read so far. This frees realm from tracking\nintermediate versions of those objects. The next time you access it,\nrealm will have the latest version of the objects.\n\nYou can also use these two methods to compact your Realm:\n\n- Set `shouldCompactOnLaunch`\nin the configuration\n- Use `writeCopy(toFile:encryptionKey:)`\n\n> Seealso:\n> Advanced Guides: Threading\n>\n\n### Dispatch Queues\nWhen accessing Realm using [Grand Central Dispatch](https://developer.apple.com/documentation/dispatch), you may see similar file growth. A dispatch\nqueue's autorelease pool may not drain immediately upon executing your\ncode. Realm cannot reuse intermediate versions of the data until the\ndispatch pool deallocates the realm object. Use an explicit\nautorelease pool when accessing realm from a dispatch queue.\n\n## Automatic Compaction\n> Version added: 10.35.0\n\nThe SDK automatically compacts Realm files in the background by continuously reallocating data\nwithin the file and removing unused file space. Automatic compaction is sufficient for minimizing the Realm file size\nfor most applications.\n\nAutomatic compaction begins when the size of unused space in the file is more than twice the size of user\ndata in the file. Automatic compaction only takes place when\nthe file is not being accessed.\n\n## Manual Compaction\nManual compaction can be used for applications that\nrequire stricter management of file size or that use an older version\nof the SDK that does not support automatic compaction.\n\nRealm manual compaction works by:\n\n1. Reading the entire contents of the realm file\n2. Writing the contents to a new file at a different location\n3. Replacing the original file\n\nIf the file contains a lot of data, this can be an expensive operation.\n\nUse `shouldCompactOnLaunch()`\n(Swift) or `shouldCompactOnLaunch`\n(Objective-C) on a realm's configuration object to compact a realm.\nSpecify conditions to execute this method, such as:\n\n- The size of the file on disk\n- How much free space the file contains\n\nFor more information about the conditions to execute in the method, see:\nTips for Using Manual Compaction.\n\n> Important:\n> Compacting cannot occur while a realm is being accessed,\nregardless of any configuration settings.\n>\n\n#### Objective-C\n\n```objectivec\nRLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\nconfig.shouldCompactOnLaunch = ^BOOL(NSUInteger totalBytes, NSUInteger usedBytes) {\n    // totalBytes refers to the size of the file on disk in bytes (data + free space)\n    // usedBytes refers to the number of bytes used by data in the file\n\n    // Compact if the file is over 100MB in size and less than 50% 'used'\n    NSUInteger oneHundredMB = 100 * 1024 * 1024;\n    return (totalBytes > oneHundredMB) && ((double)usedBytes / totalBytes) < 0.5;\n};\n\nNSError *error = nil;\n// Realm is compacted on the first open if the configuration block conditions were met.\nRLMRealm *realm = [RLMRealm realmWithConfiguration:config error:&error];\nif (error) {\n    // handle error compacting or opening Realm\n}\n\n```\n\n#### Swift\n\n```swift\nlet config = Realm.Configuration(shouldCompactOnLaunch: { totalBytes, usedBytes in\n    // totalBytes refers to the size of the file on disk in bytes (data + free space)\n    // usedBytes refers to the number of bytes used by data in the file\n\n    // Compact if the file is over 100MB in size and less than 50% 'used'\n    let oneHundredMB = 100 * 1024 * 1024\n    return (totalBytes > oneHundredMB) && (Double(usedBytes) / Double(totalBytes)) < 0.5\n})\ndo {\n    // Realm is compacted on the first open if the configuration block conditions were met.\n    let realm = try Realm(configuration: config)\n} catch {\n    // handle error compacting or opening Realm\n}\n\n```\n\n### Compact a Realm Asynchronously\nWhen you use the Swift async/await syntax to open a realm asynchronously,\nyou can compact a realm in the background.\n\n```swift\nfunc testAsyncCompact() async {\n    let config = Realm.Configuration(shouldCompactOnLaunch: { totalBytes, usedBytes in\n        // totalBytes refers to the size of the file on disk in bytes (data + free space)\n        // usedBytes refers to the number of bytes used by data in the file\n\n        // Compact if the file is over 100MB in size and less than 50% 'used'\n        let oneHundredMB = 100 * 1024 * 1024\n        return (totalBytes > oneHundredMB) && (Double(usedBytes) / Double(totalBytes)) < 0.5\n    })\n\n    do {\n        // Realm is compacted asynchronously on the first open if the\n        // configuration block conditions were met.\n        let realm = try await Realm(configuration: config)\n    } catch {\n        // handle error compacting or opening Realm\n    }\n}\n\n```\n\nStarting with Realm Swift SDK Versions 10.15.0 and 10.16.0, many of the\nRealm APIs support the Swift async/await syntax. Projects must\nmeet these requirements:\n\n|Swift SDK Version|Swift Version Requirement|Supported OS|\n| --- | --- | --- |\n|10.25.0|Swift 5.6|iOS 13.x|\n|10.15.0 or 10.16.0|Swift 5.5|iOS 15.x|\n\nIf your app accesses Realm in an `async/await` context, mark the code\nwith `@MainActor` to avoid threading-related crashes.\n\n### Make a Compacted Copy\nYou can save a compacted (and optionally encrypted) copy of a realm to another file location\nwith the `Realm.writeCopy(toFile:encryptionKey:)`\nmethod. The destination file cannot already exist.\n\n> Important:\n> Avoid calling this method within a write transaction. If called within a write transaction, this\nmethod copies the absolute latest data. This includes any\n**uncommitted** changes you made in the transaction before this\nmethod call.\n>\n\n### Tips for Using Manual Compaction\nCompacting a realm can be an expensive operation that can block\nthe UI thread. Your application should not compact every time you open\na realm. Instead, try to optimize compacting so your application does\nit just often enough to prevent the file size from growing too large.\nIf your application runs in a resource-constrained environment,\nyou may want to compact when you reach a certain file size or when the\nfile size negatively impacts performance.\n\nThese recommendations can help you optimize manual compaction for your\napplication:\n\n- Set the max file size to a multiple of your average realm state\nsize. If your average realm state size is 10MB, you might set the max\nfile size to 20MB or 40MB, depending on expected usage and device\nconstraints.\n- As a starting point, compact realms when more than 50% of the realm file\nsize is no longer in use. Divide the currently used bytes by the total\nfile size to determine the percentage of space that is currently used.\nThen, check for that to be less than 50%. This means that greater than\n50% of your realm file size is unused space, and it is a good time to\ncompact. After experimentation, you may find a different percentage\nworks best for your application.\n\nThese calculations might look like this in your `shouldCompactOnLaunch`\ncallback:\n\n```swift\n// Set a maxFileSize equal to 20MB in bytes\nlet maxFileSize = 20 * 1024 * 1024\n// Check for the realm file size to be greater than the max file size,\n// and the amount of bytes currently used to be less than 50% of the\n// total realm file size\nreturn (realmFileSizeInBytes > maxFileSize) && (Double(usedBytes) / Double(realmFileSizeInBytes)) < 0.5\n```\n\nExperiment with conditions to find the right balance of how often to\ncompact realm files in your application.\n\n#### Consider iOS File Size Limitations\nA large realm file can impact the performance and reliability of\nyour app. Any single realm file cannot be larger than the amount\nof memory your application would be allowed to map in iOS. This limit\ndepends on the device and on how fragmented the memory space is at\nthat point in time.\n\nIf you need to store more data, map it over multiple realm files.\n\n## Summary\n- Realm's architecture enables threading-related benefits,\nbut can result in file size growth.\n- Automatic compaction manages file size growth when the file is not being accessed.\n- Manual compaction strategies like `shouldCompactOnLaunch()` can be used when automatic compaction does not meet application needs.\n- Compacting cannot occur if another process is accessing the realm.\n- You can compact a realm in the background when you use async/await syntax.\n"
  },
  {
    "path": "docs/guides/realm-files/configure-and-open-a-realm.md",
    "content": "# Configure & Open a Realm - Swift SDK\nWhen you open a realm, you can pass a `Realm.Configuration` that specifies additional details\nabout how to configure the realm file. This includes things like:\n\n- Pass a fileURL or in-memory identifier to customize how the realm is stored on device\n- Specify the realm use only a subset of your app's classes\n- Whether and when to compact a realm to reduce its file size\n- Pass an encryption key to encrypt a realm\n- Provide a schema version or migration block when making schema changes\n\n## Open a Realm\nYou can open a local realm with several different configuration\noptions:\n\n- No configuration - i.e. default configuration\n- Specify a file URL for the realm\n- Open the realm only in memory, without saving a file to the file system\n\n### Open a Default Realm or Realm at a File URL\n#### Objective-C\n\nYou can open the default realm with [+[RLMRealm\ndefaultRealm]].\n\nYou can also pass a `RLMRealmConfiguration` object to\n`+[RLMRealm realmWithConfiguration:error:]`\nto open a realm at a specific file URL or in memory.\n\nYou can set the default realm configuration by passing a\nRLMRealmConfiguration instance to\n`+[RLMRealmConfiguration setDefaultConfiguration:]`.\n\n```objectivec\n// Open the default realm\nRLMRealm *defaultRealm = [RLMRealm defaultRealm];\n\n// Open the realm with a specific file URL, for example a username\nNSString *username = @\"GordonCole\";\nRLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\nconfiguration.fileURL = [[[configuration.fileURL URLByDeletingLastPathComponent]\n                         URLByAppendingPathComponent:username]\n                         URLByAppendingPathExtension:@\"realm\"];\nNSError *error = nil;\nRLMRealm *realm = [RLMRealm realmWithConfiguration:configuration\n                                             error:&error];\n\n```\n\n#### Swift\n\nYou can open a realm with the `Realm()` initializer.\nIf you omit the `Realm.Configuration` parameter, you will open the\ndefault realm.\n\nYou can set the default realm configuration by assigning a new\nRealm.Configuration instance to the\n`Realm.Configuration.defaultConfiguration`\nclass property.\n\n```swift\n// Open the default realm\nlet defaultRealm = try! Realm()\n\n// Open the realm with a specific file URL, for example a username\nlet username = \"GordonCole\"\nvar config = Realm.Configuration.defaultConfiguration\nconfig.fileURL!.deleteLastPathComponent()\nconfig.fileURL!.appendPathComponent(username)\nconfig.fileURL!.appendPathExtension(\"realm\")\nlet realm = try! Realm(configuration: config)\n\n```\n\n### Open an In-Memory Realm\n\nYou can open a realm entirely in memory, which will not create a\n`.realm` file or its associated auxiliary files. Instead the SDK stores objects in memory while the\nrealm is open and discards them immediately when all instances are\nclosed.\n\n#### Objective-C\n\nSet the `inMemoryIdentifier`\nproperty of the realm configuration.\n\n```objectivec\n// Open the realm with a specific in-memory identifier.\nNSString *identifier = @\"MyRealm\";\nRLMRealmConfiguration *configuration = [[RLMRealmConfiguration alloc] init];\nconfiguration.inMemoryIdentifier = identifier;\n// Open the realm\nRLMRealm *realm = [RLMRealm realmWithConfiguration:configuration error:nil];\n\n```\n\n#### Swift\n\nSet the `inMemoryIdentifier`\nproperty of the realm configuration.\n\n```swift\n// Open the realm with a specific in-memory identifier.\nlet identifier = \"MyRealm\"\nlet config = Realm.Configuration(\n    inMemoryIdentifier: identifier)\n// Open the realm\nlet realm = try! Realm(configuration: config)\n\n```\n\n> Important:\n> When all *in-memory* realm instances with a particular identifier\ngo out of scope, Realm deletes **all data** in that\nrealm. To avoid this, hold onto a strong reference to any\nin-memory realms during your app's lifetime.\n>\n\n### Open a Realm with Swift Concurrency Features\nYou can use Swift's async/await syntax to open a MainActor-isolated realm,\nor specify an actor when opening a realm asynchronously:\n\n```swift\n@MainActor\nfunc mainThreadFunction() async throws {\n    // These are identical: the async init produces a\n    // MainActor-isolated Realm if no actor is supplied\n    let realm1 = try await Realm()\n    let realm2 = try await Realm(actor: MainActor.shared)\n\n    try await useTheRealm(realm: realm1)\n}\n\n```\n\nOr you can define a custom realm actor to manage all of your realm operations:\n\n```swift\nactor RealmActor {\n    // An implicitly-unwrapped optional is used here to let us pass `self` to\n    // `Realm(actor:)` within `init`\n    var realm: Realm!\n    init() async throws {\n        realm = try await Realm(actor: self)\n    }\n\n    var count: Int {\n        realm.objects(Todo.self).count\n    }\n\n    func createTodo(name: String, owner: String, status: String) async throws {\n        try await realm.asyncWrite {\n            realm.create(Todo.self, value: [\n                \"_id\": ObjectId.generate(),\n                \"name\": name,\n                \"owner\": owner,\n                \"status\": status\n            ])\n        }\n    }\n\n    func getTodoOwner(forTodoNamed name: String) -> String {\n        let todo = realm.objects(Todo.self).where {\n            $0.name == name\n        }.first!\n        return todo.owner\n    }\n\n    struct TodoStruct {\n        var id: ObjectId\n        var name, owner, status: String\n    }\n\n    func getTodoAsStruct(forTodoNamed name: String) -> TodoStruct {\n        let todo = realm.objects(Todo.self).where {\n            $0.name == name\n        }.first!\n        return TodoStruct(id: todo._id, name: todo.name, owner: todo.owner, status: todo.status)\n    }\n\n    func updateTodo(_id: ObjectId, name: String, owner: String, status: String) async throws {\n        try await realm.asyncWrite {\n            realm.create(Todo.self, value: [\n                \"_id\": _id,\n                \"name\": name,\n                \"owner\": owner,\n                \"status\": status\n            ], update: .modified)\n        }\n    }\n\n    func deleteTodo(id: ObjectId) async throws {\n        try await realm.asyncWrite {\n            let todoToDelete = realm.object(ofType: Todo.self, forPrimaryKey: id)\n            realm.delete(todoToDelete!)\n        }\n    }\n\n    func close() {\n        realm = nil\n    }\n\n}\n\n```\n\nAn actor-isolated realm may be used with either local or global actors.\n\n```swift\n// A simple example of a custom global actor\n@globalActor actor BackgroundActor: GlobalActor {\n    static var shared = BackgroundActor()\n}\n\n@BackgroundActor\nfunc backgroundThreadFunction() async throws {\n    // Explicitly specifying the actor is required for anything that is not MainActor\n    let realm = try await Realm(actor: BackgroundActor.shared)\n    try await realm.asyncWrite {\n        _ = realm.create(Todo.self, value: [\n            \"name\": \"Pledge fealty and service to Gondor\",\n            \"owner\": \"Pippin\",\n            \"status\": \"In Progress\"\n        ])\n    }\n    // Thread-confined Realms would sometimes throw an exception here, as we\n    // may end up on a different thread after an `await`\n    let todoCount = realm.objects(Todo.self).count\n    print(\"The number of Realm objects is: \\(todoCount)\")\n}\n\n@MainActor\nfunc mainThreadFunction() async throws {\n    try await backgroundThreadFunction()\n}\n\n```\n\nFor more information about working with actor-isolated realms, refer to\nUse Realm with Actors - Swift SDK.\n\n## Close a Realm\nThere is no need to manually close a realm in Swift or Objective-C.\nWhen a realm goes out of scope and is removed from memory due to\n[ARC](https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html),\nthe realm is closed.\n\n## Handle Errors When Accessing a Realm\n#### Objective-C\n\nTo handle errors when accessing a realm, provide an\n`NSError` pointer to the `error` parameter:\n\n```objectivec\nNSError *error = nil;\nRLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\nRLMRealm *realm = [RLMRealm realmWithConfiguration:config error:&error];\nif (!realm) {\n    // Handle error\n    return;\n}\n// Use realm\n\n```\n\n#### Swift\n\nTo handle errors when accessing a realm, use Swift's built-in\nerror handling mechanism:\n\n```swift\ndo {\n    let realm = try Realm()\n    // Use realm\n} catch let error as NSError {\n    // Handle error\n}\n\n```\n\n## Provide a Subset of Classes to a Realm\n> Tip:\n> Some applications, such as watchOS apps and iOS app extensions, have\ntight constraints on their memory footprints. To optimize your data\nmodel for low-memory environments, open the realm with a subset\nof classes.\n>\n\n#### Objective-C\n\nBy default, the Swift SDK automatically adds all\n`RLMObject`- and\n`RLMEmbeddedObject`-derived\nclasses in your executable to the realm schema. You can control\nwhich objects get added by setting the `objectClasses`\nproperty of the `RLMRealmConfiguration` object.\n\n```objectivec\nRLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n\n// Given a RLMObject subclass called `Task`\n// Limit the realm to only the Task object. All other\n// Object- and EmbeddedObject-derived classes are not added.\nconfig.objectClasses = @[[Task class]];\n\nNSError *error = nil;\nRLMRealm *realm = [RLMRealm realmWithConfiguration:config error:&error];\n\nif (error != nil) {\n    // Something went wrong\n} else {\n    // Use realm\n}\n\n```\n\n#### Swift\n\nBy default, the Swift SDK automatically adds all\n`Object`- and\n`EmbeddedObject`-derived\nclasses in your executable to the realm schema. You can control\nwhich objects get added by setting the `objectTypes`\nproperty of the `Realm.Configuration` object.\n\n```swift\nvar config = Realm.Configuration.defaultConfiguration\n\n// Given: `class Dog: Object`\n// Limit the realm to only the Dog object. All other\n// Object- and EmbeddedObject-derived classes are not added.\nconfig.objectTypes = [Dog.self]\n\nlet realm = try! Realm(configuration: config)\n\n```\n\n## Initialize Properties Using Realm APIs\nYou might define properties whose values are initialized using\nRealm APIs. For example:\n\n```swift\nclass SomeSwiftType {\n    let persons = try! Realm().objects(Person.self)\n    // ...\n}\n```\n\nIf this initialization code runs before you set up your Realm\nconfigurations, you might get unexpected behavior. For example, if you\nset a migration block for the default realm\nconfiguration in `applicationDidFinishLaunching()`, but you create an\ninstance of `SomeSwiftType` before\n`applicationDidFinishLaunching()`, you might be accessing your\nrealm before it has been correctly configured.\n\nTo avoid such issues, consider doing one of the following:\n\n- Defer instantiation of any type that eagerly initializes properties using Realm APIs until after your app has completed setting up its realm configurations.\n- Define your properties using Swift's `lazy` keyword. This allows you to safely instantiate such types at any time during your application's lifecycle, as long as you do not attempt to access your `lazy` properties until after your app has set up its realm configurations.\n- Only initialize your properties using Realm APIs that explicitly take in user-defined configurations. You can be sure that the configuration values you are using have been set up properly before they are used to open realms.\n\n## Use Realm When the Device Is Locked\nBy default, iOS 8 and above encrypts app files using\n`NSFileProtection` whenever the device is locked. If your app attempts\nto access a realm while the device is locked, you might see the\nfollowing error:\n\n```text\nopen() failed: Operation not permitted\n```\n\nTo handle this, downgrade the file protection of the folder containing\nthe Realm files.\n\n> Tip:\n> If you reduce iOS file encryption, consider using Realm's\nbuilt-in encryption to secure your data\ninstead.\n>\n\nThis example shows how to apply a less strict protection level to the\nparent directory of the default realm.\n\n```swift\nlet realm = try! Realm()\n\n// Get the realm file's parent directory\nlet folderPath = realm.configuration.fileURL!.deletingLastPathComponent().path\n\n// Disable file protection for this directory after the user has unlocked the device once\ntry! FileManager.default.setAttributes([FileAttributeKey.protectionKey: FileProtectionType.completeUntilFirstUserAuthentication],\n                                       ofItemAtPath: folderPath)\n\n```\n\nRealm may create and delete auxiliary files at any time.\nInstead of downgrading file protection on the files, apply it to the\nparent folder. This way, the file protection applies to all relevant\nfiles regardless of creation time.\n"
  },
  {
    "path": "docs/guides/realm-files/delete-a-realm.md",
    "content": "# Delete a Realm File - Swift SDK\nIn some cases, you may want to completely delete a realm file from disk.\n\nRealm avoids copying data into memory except when absolutely required.\nAs a result, all objects managed by a realm have references to the file\non disk. Before you can safely delete the file, you must ensure the\ndeallocation of these objects:\n\n- All objects read from or added to the realm\n- All List and Results objects\n- All ThreadSafeReference objects\n- The realm itself\n\n> Warning:\n> If you delete a realm file or any of its auxiliary files while one or\nmore instances of the realm are open, you might corrupt the realm or\ndisrupt sync.\n>\n\n## Delete a Realm File to Avoid Migration\nIf you iterate rapidly as you develop your app, you may want to delete a\nrealm file instead of migrating it when you make schema changes. The Realm\nconfiguration provides a `deleteRealmIfMigrationNeeded`\nparameter to help with this case.\n\nWhen you set this property to `true`, the SDK deletes the realm file when\na migration would be required. Then, you can create objects that match the\nnew schema instead of writing migration blocks for development or test data.\n\n```swift\ndo {\n    // Delete the realm if a migration would be required, instead of migrating it.\n    // While it's useful during development, do not leave this set to `true` in a production app!\n    let configuration = Realm.Configuration(deleteRealmIfMigrationNeeded: true)\n    let realm = try Realm(configuration: configuration)\n} catch {\n    print(\"Error opening realm: \\(error.localizedDescription)\")\n}\n\n```\n\n## Delete a Realm File\nIn practice, there are two safe times to delete the realm file:\n\n1. On application startup before ever opening the realm.\n2. After only having opened the realm within an explicit `autorelease` pool, which ensures deallocation of all of objects within it.\n\n"
  },
  {
    "path": "docs/guides/realm-files/encrypt-a-realm.md",
    "content": "# Encrypt a Realm - Swift SDK\n## Overview\nYou can encrypt the realm file on disk with AES-256 +\nSHA-2 by supplying a 64-byte encryption key when opening a\nrealm.\n\nRealm transparently encrypts and decrypts data with standard\n[AES-256 encryption](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard) using the\nfirst 256 bits of the given 512-bit encryption key. Realm\nuses the other 256 bits of the 512-bit encryption key to validate\nintegrity using a [hash-based message authentication code\n(HMAC)](https://en.wikipedia.org/wiki/HMAC).\n\n> Warning:\n> Do not use cryptographically-weak hashes for realm encryption keys.\nFor optimal security, we recommend generating random rather than derived\nencryption keys.\n>\n\n> Note:\n> You must encrypt a realm the first time you open it.\nIf you try to open an existing unencrypted realm using a configuration\nthat contains an encryption key, Realm throws an error.\n>\n\n## Considerations\nThe following are key impacts to consider when encrypting a realm.\n\n### Storing & Reusing Keys\nYou **must** pass the same encryption key every time you open the encrypted realm.\nIf you don't provide a key or specify the wrong key for an encrypted\nrealm, the Realm SDK throws an error.\n\nApps should store the encryption key in the Keychain so that other apps\ncannot read the key.\n\n### Performance Impact\nReads and writes on encrypted realms can be up to 10% slower than unencrypted realms.\n\n### Accessing an Encrypted Realm from Multiple Processes\n> Version changed: 10.38.0\n\nStarting with Realm Swift SDK version 10.38.0, Realm supports opening\nthe same encrypted realm in multiple processes.\n\nIf your app uses Realm Swift SDK version 10.37.2 or earlier, attempting to\nopen an encrypted realm from multiple processes throws this error:\n`Encrypted interprocess sharing is currently unsupported.`\n\nApps using earlier SDK versions have two options to work with realms in\nmultiple processes:\n\n- Use an unencrypted realm.\n- Store data that you want to encrypt as `NSData` properties on realm\nobjects. Then, you can encrypt and decrypt individual fields.\n\nOne possible tool to encrypt and decrypt fields is [Apple's\nCryptoKit framework](https://developer.apple.com/documentation/cryptokit). You can use [Swift\nCrypto](https://github.com/apple/swift-crypto) to simplify app\ndevelopment with CryptoKit.\n\n## Example\nThe following code demonstrates how to generate an encryption key and\nopen an encrypted realm:\n\n#### Objective-C\n\n```objectivec\n// Generate a random encryption key\nNSMutableData *key = [NSMutableData dataWithLength:64];\n(void)SecRandomCopyBytes(kSecRandomDefault, key.length, (uint8_t *)key.mutableBytes);\n\n// Open the encrypted Realm file\nRLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\nconfig.encryptionKey = key;\n\nNSError *error = nil;\nRLMRealm *realm = [RLMRealm realmWithConfiguration:config error:&error];\nif (!realm) {\n    // If the encryption key is wrong, `error` will say that it's an invalid database\n    NSLog(@\"Error opening realm: %@\", error);\n} else {\n    // Use the realm as normal...\n}\n\n```\n\n#### Swift\n\n```swift\n// Generate a random encryption key\nvar key = Data(count: 64)\n_ = key.withUnsafeMutableBytes { (pointer: UnsafeMutableRawBufferPointer) in\n    SecRandomCopyBytes(kSecRandomDefault, 64, pointer.baseAddress!) }\n\n// Configure for an encrypted realm\nvar config = Realm.Configuration(encryptionKey: key)\n\ndo {\n    // Open the encrypted realm\n    let realm = try Realm(configuration: config)\n    // ... use the realm as normal ...\n} catch let error as NSError {\n    // If the encryption key is wrong, `error` will say that it's an invalid database\n    fatalError(\"Error opening realm: \\(error.localizedDescription)\")\n}\n\n```\n\nThe following Swift example demonstrates how to store and retrieve a\ngenerated key from the Keychain:\n\n```swift\n// Retrieve the existing encryption key for the app if it exists or create a new one\nfunc getKey() -> Data {\n    // Identifier for our keychain entry - should be unique for your application\n    let keychainIdentifier = \"io.Realm.EncryptionExampleKey\"\n    let keychainIdentifierData = keychainIdentifier.data(using: String.Encoding.utf8, allowLossyConversion: false)!\n\n    // First check in the keychain for an existing key\n    var query: [NSString: AnyObject] = [\n        kSecClass: kSecClassKey,\n        kSecAttrApplicationTag: keychainIdentifierData as AnyObject,\n        kSecAttrKeySizeInBits: 512 as AnyObject,\n        kSecReturnData: true as AnyObject\n    ]\n\n    // To avoid Swift optimization bug, should use withUnsafeMutablePointer() function to retrieve the keychain item\n    // See also: http://stackoverflow.com/questions/24145838/querying-ios-keychain-using-swift/27721328#27721328\n    var dataTypeRef: AnyObject?\n    var status = withUnsafeMutablePointer(to: &dataTypeRef) { SecItemCopyMatching(query as CFDictionary, UnsafeMutablePointer($0)) }\n    if status == errSecSuccess {\n        // swiftlint:disable:next force_cast\n        return dataTypeRef as! Data\n    }\n\n    // No pre-existing key from this application, so generate a new one\n    // Generate a random encryption key\n    var key = Data(count: 64)\n    key.withUnsafeMutableBytes({ (pointer: UnsafeMutableRawBufferPointer) in\n        let result = SecRandomCopyBytes(kSecRandomDefault, 64, pointer.baseAddress!)\n        assert(result == 0, \"Failed to get random bytes\")\n    })\n\n    // Store the key in the keychain\n    query = [\n        kSecClass: kSecClassKey,\n        kSecAttrApplicationTag: keychainIdentifierData as AnyObject,\n        kSecAttrKeySizeInBits: 512 as AnyObject,\n        kSecValueData: key as AnyObject\n    ]\n\n    status = SecItemAdd(query as CFDictionary, nil)\n    assert(status == errSecSuccess, \"Failed to insert the new key in the keychain\")\n\n    return key\n}\n\n// ...\n// Use the getKey() function to get the stored encryption key or create a new one\nvar config = Realm.Configuration(encryptionKey: getKey())\n\ndo {\n    // Open the realm with the configuration\n    let realm = try Realm(configuration: config)\n\n    // Use the realm as normal\n\n} catch let error as NSError {\n    // If the encryption key is wrong, `error` will say that it's an invalid database\n    fatalError(\"Error opening realm: \\(error)\")\n}\n\n```\n"
  },
  {
    "path": "docs/guides/realm-files/realm-files.md",
    "content": "# Work with Realm Files - Swift SDK\nA **realm** is the core data structure used to organize data in\nRealm. A realm is a collection of the objects that you use\nin your application, called Realm objects, as well as additional metadata\nthat describe the objects. To learn how to define a Realm object, see\nDefine an Object Model.\n\n## Realm Files\nRealm stores a binary encoded version of every object and type in a\nrealm in a single `.realm` file. The file is located at a specific\npath that you can define when you open the\nrealm. You can open, view, and edit the contents of these files with\nRealm Studio.\n\n### In-Memory Realms\nYou can also open a realm entirely in memory, which does not create a `.realm`\nfile or its associated auxiliary files. Instead the SDK stores objects in memory\nwhile the realm is open and discards them immediately when all instances are\nclosed.\n\n> See:\n> To open an in-memory realm, refer to Open an In-Memory Realm.\n>\n\n### Default Realm\nCalling `Realm()` or\n`RLMRealm` opens the default realm.\nThis method returns a realm object that maps to a file named\n`default.realm`. You can find this file:\n\n- iOS: in the Documents folder of your app\n- macOS: in the Application Support folder of your app\n\n> See:\n> To open a default realm, refer to Open a Default Realm or Realm at a File URL.\n>\n\n### Auxiliary Realm Files\nRealm creates additional files for each realm:\n\n- **realm files**, suffixed with \"realm\", e.g. default.realm:\ncontain object data.\n- **lock files**, suffixed with \"lock\", e.g. default.realm.lock:\nkeep track of which versions of data in a realm are\nactively in use. This prevents realm from reclaiming storage space\nthat is still used by a client application.\n- **note files**, suffixed with \"note\", e.g. default.realm.note:\nenable inter-thread and inter-process notifications.\n- **management files**, suffixed with \"management\", e.g. default.realm.management:\ninternal state management.\n\nDeleting these files has important implications.\nFor more information about deleting `.realm` or auxiliary files, see:\nDelete a Realm\n\n## Find a Realm File Path\nThe realm file is located at a specific path that you can optionally define\nwhen you open the realm.\n\n```swift\n// Get on-disk location of the default Realm\nlet realm = try! Realm()\nprint(\"Realm is located at:\", realm.configuration.fileURL!)\n```\n\n> See:\n> To open a realm at a specific path, refer to Open a Default Realm or Realm at a File URL.\n>\n"
  },
  {
    "path": "docs/guides/realm-files/tvos.md",
    "content": "# Build for tvOS\n## Overview\nThis page details considerations when using Realm on tvOS.\n\n> Seealso:\n> Install the SDK for iOS, macOS, tvOS, and watchOS\n>\n\n## Avoid Storing Important User Data\nAvoid storing important user data in a realm on tvOS. Instead, it's\nbest to treat Realm as a rebuildable cache.\n\n> Note:\n> The reason for this has to do with where Realm writes its\nRealm files. On other Apple platforms,\nRealm writes its Realm files to the \"Documents\"\ndirectory. Because tvOS restricts writes to that directory, the\ndefault Realm file location on tvOS is instead `NSCachesDirectory`.\ntvOS can purge files in that directory at any time, so reliable\nlong-term persistence is not possible.\n>\n\nYou can also use Realm as an initial data source by\nbundling prebuilt Realm files in your app.\nNote that the [App Store guidelines](https://developer.apple.com/tvos/submit/) limit your\napp size to 4GB.\n\n> Tip:\n> Browse our [tvOS examples](https://github.com/realm/realm-swift/tree/master/examples/tvos) for sample tvOS apps\nthat demonstrate how to use Realm as an offline cache.\n>\n\n## Share Realm Files with TV Services Extensions\nTo share a Realm file between a tvOS app and a\nTV services extension such as [Top Shelf](https://developer.apple.com/design/human-interface-guidelines/tvos/overview/top-shelf/), use the\n`Library/Caches/` directory in the shared container for the\napplication group:\n\n```swift\nlet fileUrl = FileManager.default\n    .containerURL(forSecurityApplicationGroupIdentifier: \"group.com.mongodb.realm.examples.extension\")!\n    .appendingPathComponent(\"Library/Caches/default.realm\")\n\n```\n"
  },
  {
    "path": "docs/guides/swift-concurrency.md",
    "content": "# Swift Concurrency - Swift SDK\nSwift's concurrency system provides built-in support for writing asynchronous\nand parallel code in a structured way. For a detailed overview of the\nSwift concurrency system, refer to the [Swift Programming Language Concurrency\ntopic](https://docs.swift.org/swift-book/LanguageGuide/Concurrency.html).\n\nWhile the considerations on this page broadly apply to using realm with\nSwift concurrency features, Realm Swift SDK version 10.39.0 adds support\nfor using Realm with Swift Actors. You can use Realm isolated to a single\nactor or use Realm across actors.\n\nRealm's actor support simplifies using Realm in a MainActor and background actor\ncontext, and supersedes much of the advice on this page regarding concurrency\nconsiderations. For more information, refer to Use Realm with Actors - Swift SDK.\n\n## Realm Concurrency Caveats\nAs you implement concurrency features in your app, consider this caveat\nabout Realm's threading model and Swift concurrency threading behaviors.\n\n### Suspending Execution with Await\nAnywhere you use the Swift keyword `await` marks a possible suspension\npoint in the execution of your code. With Swift 5.7, once your code suspends,\nsubsequent code might not execute on the same thread. This means that\nanywhere you use `await` in your code, the subsequent code could be\nexecuted on a different thread than the code that precedes or follows it.\n\nThis is inherently incompatible with Realm's live object paradigm. Live objects, collections, and realm instances are\n**thread-confined**: that is, they are only valid on the thread on which\nthey were created. Practically speaking, this means you cannot pass live\ninstances to other threads. However, Realm offers several\nmechanisms for sharing objects across threads. These mechanisms typically require\nyour code to do some explicit handling to safely pass data across threads.\n\nYou can use some of these mechanisms, such as frozen objects or the ThreadSafeReference, to safely use Realm objects and instances\nacross threads with the `await` keyword. You can also avoid\nthreading-related issues by marking any asynchronous Realm code with\n`@MainActor` to ensure your apps always execute this code on the main\nthread.\n\nAs a general rule, keep in mind that using Realm in an `await` context\n*without* incorporating threading protection may yield inconsistent behavior.\nSometimes, the code may succeed. In other cases, it may throw an error\nrelated to writing on an incorrect thread.\n\n### Perform Background Writes\nA commonly-requested use case for asynchronous code is to perform write\noperations in the background without blocking the main thread.\n\nRealm has two APIs that allow for performing asynchronous writes:\n\n- The [writeAsync()](https://www.mongodb.com/docs/realm-sdks/swift/latest/Structs/Realm.html#/s:10RealmSwift0A0V10writeAsync_10onCompletes6UInt32Vyyc_ys5Error_pSgcSgtF)\nAPI allows for performing async writes using Swift completion handlers.\n- The [asyncWrite()](https://www.mongodb.com/docs/realm-sdks/swift/latest/Structs/Realm.html#/s:10RealmSwift0A0V10asyncWriteyxxyKXEYaKlF)\nAPI allows for performing async writes using Swift async/await syntax.\n\nBoth of these APIs allow you to add, update, or delete objects in the\nbackground without using frozen objects or passing a thread-safe reference.\n\nWith the `writeAsync()` API, waiting to obtain the write lock and\ncommitting a transaction occur in the background. The write block itself\nruns on the calling thread. This provides thread-safety without requiring\nyou to manually handle frozen objects or passing references across threads.\n\nHowever, while the write block itself is executed, this does block new\ntransactions on the calling thread. This means that a large write using\nthe `writeAsync()` API could block small, quick writes while it executes.\n\nThe `asyncWrite()` API suspends the calling task while waiting for its\nturn to write rather than blocking the thread. In addition, the actual\nI/O to write data to disk is done by a background worker thread. For small\nwrites, using this function on the main thread may block the main thread\nfor less time than manually dispatching the write to a background thread.\n\nFor more information, including code examples, refer to: Perform a Background Write.\n\n## Tasks and TaskGroups\nSwift concurrency provides APIs to manage [Tasks](https://developer.apple.com/documentation/swift/task)\nand [TaskGroups](https://developer.apple.com/documentation/swift/taskgroup). The [Swift concurrency\ndocumentation](https://docs.swift.org/swift-book/LanguageGuide/Concurrency.html)\ndefines a task as a unit of work that can be run asynchronously as part of\nyour program. Task allows you to specifically define a unit of asynchronous\nwork. TaskGroup lets you define a collection of Tasks to execute as a unit\nunder the parent TaskGroup.\n\nTasks and TaskGroups provide the ability to yield the thread to other\nimportant work or to cancel a long-running task that could be blocking\nother operations. To get these benefits, you might be tempted to use Tasks\nand TaskGroups to manage realm writes in the background.\n\nHowever, the thread-confined constraints described in Suspending\nExecution with Await above apply in\nthe Task context. If your Task contains `await` points, subsequent code\nmight run or resume on a different thread and violate Realm's thread confinement.\n\nYou must annotate functions that you run in a Task context with `@MainActor`\nto ensure code that accesses Realm only runs on the main thread. This negates\nsome of the benefits of using Tasks, and may mean this is not a good design\nchoice for apps that use Realm unless you are using Tasks solely for\nnetworking activities like managing users.\n\n## Actor Isolation\n> Seealso:\n> The information in this section is applicable to Realm SDK versions earlier\nthan 10.39.0. Starting in Realm Swift SDK version 10.39.0 and newer,\nthe SDK supports using Realm with Swift Actors and related async functionality.\n>\n> For more information, refer to Use Realm with Actors - Swift SDK.\n>\n\nActor isolation provides the perception of confining Realm access to a\ndedicated actor, and therefore seems like a safe way to manage Realm\naccess in an asynchronous context.\n\nHowever, using Realm in a non-`@MainActor` async function is currently\nnot supported.\n\nIn Swift 5.6, this would often work by coincidence. Execution after an\n`await` would continue on whatever thread the awaited thing ran on.\nUsing `await Realm()` in an async function would result in the code\nfollowing that running on the main thread until your next call to an\nactor-isolated function.\n\nSwift 5.7 instead hops threads whenever changing actor isolation contexts.\nAn unisolated async function always runs on a background thread instead.\n\nIf you have code which uses `await Realm()` and works in 5.6, marking\nthe function as `@MainActor` will make it work with Swift 5.7. It will\nfunction how it did - unintentionally - in 5.6.\n\n## Errors Related to Concurrency Code\nMost often, the error you see related to accessing Realm through concurrency\ncode is `Realm accessed from incorrect thread.` This is due to the\nthread-isolation issues described on this page.\n\nTo avoid threading-related issues in code that uses Swift concurrency features:\n\n- Upgrade to a version of the Realm Swift SDK that supports actor-isolated realms,\nand use this as an alternative to manually managing threading. For more\ninformation, refer to Use Realm with Actors - Swift SDK.\n- Do not change execution contexts when accessing a realm. If you open a realm\non the main thread to provide data for your UI, annotate subsequent functions\nwhere you access the realm asynchronously with `@MainActor` to ensure it\nalways runs on the main thread. Remember that `await` marks a suspension\npoint that could change to a different thread.\n- Apps that do not use actor-isolated realms can use the `writeAsync` API to\nperform a background write. This manages realm\naccess in a thread-safe way without requiring you to write specialized code\nto do it yourself. This is a special API that outsources aspects of the\nwrite process - where it is safe to do so - to run in an async context.\nUnless you are writing to an actor-isolated realm, you do not use this\nmethod with Swift's `async/await` syntax. Use this method synchronously\nin your code. Alternately, you can use the `asyncWrite` API with Swift's\n`async/await` syntax when awaiting writes to asynchronous realms.\n- If you want to explicitly write concurrency code that is not actor-isolated\nwhere accessing a realm is done in a thread-safe way, you can explicitly\npass instances across threads where\napplicable to avoid threading-related crashes. This does require a good\nunderstanding of Realm's threading model, as well as being mindful of\nSwift concurrency threading behaviors.\n\n## Sendable, Non-Sendable and Thread-Confined Types\nThe Realm Swift SDK public API contains types that fall into three broad\ncategories:\n\n- Sendable\n- Not Sendable and not thread confined\n- Thread-confined\n\nYou can share types that are not Sendable and not thread confined between\nthreads, but you must synchronize them.\n\nThread-confined types, unless frozen, are confined to an isolation context.\nYou cannot pass them between these contexts even with synchronization.\n"
  },
  {
    "path": "docs/guides/swiftui/configure-and-open-realm.md",
    "content": "# Configure and Open a Realm - SwiftUI\nThe Swift SDK provides property wrappers to open a realm in a\nSwiftUI-friendly way.\n\nYou can:\n\n- Implicitly open a realm\nwith a `defaultConfiguration` or specify a different configuration.\n\n## Open a Realm with a Configuration\nWhen you use `@ObservedRealmObject`\nor `@ObservedResults`, these\nproperty wrappers implicitly open a realm and retrieve the specified\nobjects or results.\n\n```swift\n// Implicitly use the default realm's objects(Dog.self)\n@ObservedResults(Dog.self) var dogs\n\n```\n\n> Note:\n> The `@ObservedResults` property wrapper is intended for use in a\nSwiftUI View. If you want to observe results in a view model, register\na change listener.\n>\n\nWhen you do not specify a configuration, these property wrappers use the\n`defaultConfiguration`.\nYou can set the defaultConfiguration\nglobally, and property wrappers across the app can use that configuration\nwhen they implicitly open a realm.\n\nYou can provide alternative configurations that the property wrappers use\nto implicitly open the realm.\nTo do this, create explicit configurations.\nThen, use environment injection to pass the respective configurations\nto the views that need them.\nPassing a configuration to a view where property wrappers open a realm\nuses the passed configuration instead of the `defaultConfiguration`.\n"
  },
  {
    "path": "docs/guides/swiftui/filter-data.md",
    "content": "# Filter Data - SwiftUI\n## Observe in SwiftUI Views\nThe `@ObservedResults` property wrapper used in the examples on this page\nis intended for use in a SwiftUI View. If you want to observe results\nin a view model instead, register a change listener.\n\n## Search a Realm Collection\n> Version added: 10.19.0\n\nThe Realm Swift SDK allows you to extend [.searchable](https://developer.apple.com/documentation/swiftui/view/searchable(text:placement:prompt:)-18a8f).\nWhen you use `ObservedResults`\nto query a realm, you can specify collection and keypath in the result set\nto mark it as searchable.\n\nThe collection is the bound collection represented by your ObservedResults\nquery. In this example, it is the `dogs` variable that represents the\ncollection of all Dog objects in the realm.\n\nThe keypath is the object property that you want to search. In this\nexample, we search the dogs collection by dog name. The Realm Swift\n`.searchable` implementation only supports keypaths with `String` types.\n\n```swift\nstruct SearchableDogsView: View {\n    @ObservedResults(Dog.self) var dogs\n    @State private var searchFilter = \"\"\n    \n    var body: some View {\n        NavigationView {\n            // The list shows the dogs in the realm.\n            List {\n                ForEach(dogs) { dog in\n                    DogRow(dog: dog)\n                }\n            }\n            .searchable(text: $searchFilter,\n                        collection: $dogs,\n                        keyPath: \\.name) {\n                ForEach(dogs) { dogsFiltered in\n                    Text(dogsFiltered.name).searchCompletion(dogsFiltered.name)\n                }\n            }\n        }\n    }\n}\n\n```\n\n## Filter or Query a Realm with ObservedResults\nThe `@ObservedResults` property wrapper\nopens a realm and returns all objects of the specified type. However, you\ncan filter or query `@ObservedResults` to use only a subset of the objects\nin your view.\n\n> Seealso:\n> For more information about the query syntax and types of queries that Realm\nsupports, see: Read and Filter Data.\n>\n\n### Filter with an NSPredicate\nTo filter `@ObservedResults` using the NSPredicate Query API, pass an [NSPredicate](https://developer.apple.com/documentation/foundation/nspredicate) as an argument to `filter`:\n\n```swift\nstruct FilterDogsViewNSPredicate: View {\n    @ObservedResults(Dog.self, filter: NSPredicate(format: \"weight > 40\")) var dogs\n    \n    var body: some View {\n        NavigationView {\n            // The list shows the dogs in the realm.\n            List {\n                ForEach(dogs) { dog in\n                    DogRow(dog: dog)\n                }\n            }\n        }\n    }\n}\n\n```\n\n### Query with the Realm Type-Safe Query API\n> Version added: 10.24.0\n> Use *where* to perform type-safe queries on ObservedResults.\n>\n\nTo use `@ObservedResults` with the Realm Type-Safe Query API, pass a query in a closure as an argument to\n`where`:\n\n```swift\nstruct FilterDogsViewTypeSafeQuery: View {\n    @ObservedResults(Dog.self, where: ( { $0.weight > 40 } )) var dogs\n    \n    var body: some View {\n        NavigationView {\n            // The list shows the dogs in the realm.\n            List {\n                ForEach(dogs) { dog in\n                    DogRow(dog: dog)\n                }\n            }\n        }\n    }\n}\n\n```\n\n## Section Filtered Results\n> Version added: 10.29.0\n\nThe `@ObservedSectionedResults`\nproperty wrapper opens a realm and returns all objects of the specified type,\ndivided into sections by the specified key path. Similar to\n`@ObservedResults` above, you can filter or query `@ObservedSectionedResults`\nto use only a subset of the objects in your view:\n\n```swift\n@ObservedSectionedResults(Dog.self,\n                          sectionKeyPath: \\.firstLetter,\n                          where: ( { $0.weight > 40 } )) var dogs\n\n```\n"
  },
  {
    "path": "docs/guides/swiftui/model-data/change-an-object-model.md",
    "content": "# Change an Object Model - SwiftUI\n## Overview\nWhen you update your object schema, you must increment the schema version\nand perform a migration. You might update your object schema between major\nversion releases of your app.\n\nFor information on how to actually perform the migration, see:\nChange an Object Model.\n\nThis page focuses on how to use migrated data in SwiftUI Views.\n\n## Use Migrated Data with SwiftUI\nTo perform a migration:\n\n- Update your schema and write a migration block, if required\n- Specify a `Realm.Configuration`\nthat uses this migration logic and/or updated schema version when you\ninitialize your realm.\n\nFrom here, you have a few options to pass the configuration object. You can:\n\n- Set the configuration as the default configuration. If you do not explicitly pass the\nconfiguration via environment injection or as a parameter, property\nwrappers use the default configuration.\n- Use environment injection to provide this configuration to the first view\nin your hierarchy that uses Realm\n- Explicitly provide the configuration to a Realm property wrapper that takes\na configuration object, such as `@ObservedResults` or `@AsyncOpen`.\n\n> Example:\n> For example, you might want to add a property to an existing object. We\ncould add a `favoriteTreat` property to the `Dog` object in DoggoDB:\n>\n> ```swift\n> @Persisted var favoriteTreat = \"\"\n> ```\n>\n> After you add your new property to the schema, you must increment the\nschema version. Your `Realm.Configuration` might look like this:\n>\n> ```swift\n> let config = Realm.Configuration(schemaVersion: 2)\n>\n> ```\n>\n> Declare this configuration somewhere that is accessible to the first view\nin the hierarchy that needs it. Declaring this above your `@main` app\nentrypoint makes it available everywhere, but you could also put it in\nthe file where you first open a realm.\n>\n\n### Set a Default Configuration\nYou can set a default configuration in a SwiftUI app the same as any other\nRealm Swift app. Set the default realm configuration by assigning a new\nRealm.Configuration instance to the `Realm.Configuration.defaultConfiguration`\nclass property.\n\n```swift\n// Open the default realm\nlet defaultRealm = try! Realm()\n\n// Open the realm with a specific file URL, for example a username\nlet username = \"GordonCole\"\nvar config = Realm.Configuration.defaultConfiguration\nconfig.fileURL!.deleteLastPathComponent()\nconfig.fileURL!.appendPathComponent(username)\nconfig.fileURL!.appendPathExtension(\"realm\")\nlet realm = try! Realm(configuration: config)\n\n```\n\n### Pass the Configuration Object as an Environment Object\nOnce you have declared the configuration, you can inject it as an environment\nobject to the first view in your hierarchy that opens a realm. If you are\nusing the `@ObservedResults` or `@ObservedRealmObject` property wrappers,\nthese views implicitly open a realm, so they also need access to this\nconfiguration.\n\n```swift\n.environment(\\.realmConfiguration, config)\n```\n\nYou can pass the realm configuration environment object directly\nto the `LocalOnlyContentView`:\n\n```swift\n.environment(\\.realmConfiguration, config)\n\n```\n\nWhich opens a realm implicitly with:\n\n```swift\nstruct LocalOnlyContentView: View {\n    // Implicitly use the default realm's objects(Dog.self)\n    @ObservedResults(Dog.self) var dogs\n\n    var body: some View {\n        if dogs.first != nil {\n            // If dogs exist, go to the DogsView\n            DogsView()\n        } else {\n            // If there is no Dog object, add one here.\n            AddDogView()\n        }\n    }\n}\n\n```\n\n### Explicitly Pass the Updated Configuration to a Realm SwiftUI Property Wrapper\nYou can explicitly pass the configuration object to a Realm SwiftUI\nproperty wrapper that takes a configuration object, such as `@ObservedResults`\nor `@AutoOpen`. In this case, you might pass it directly to `@ObservedResults`\nin our `DogsView`.\n\n```swift\n// Use a `config` that you've passed in from above.\n@ObservedResults(Dog.self, configuration: config) var dogs\n```\n"
  },
  {
    "path": "docs/guides/swiftui/model-data/define-a-realm-object-model.md",
    "content": "# Realm Object Models - SwiftUI\n## Concepts: Object Models and Relationships\nModeling data for SwiftUI builds on the same object model and relationship\nconcepts in the Swift SDK. If you are unfamiliar with Realm Swift SDK\ndata modeling concepts, see: Define a Realm Object Model - Swift SDK.\n\n## Binding the Object Model to the UI\nThe Model-View-ViewModel (MVVM) design pattern advocates creating a view\nmodel that abstracts the model from the View code. While you can certainly\ndo that with Realm, the Swift SDK provides tools that make it easy to\nwork directly with your data in SwiftUI Views. These tools include things\nlike:\n\n- Property wrappers that create bindings to underlying observable objects\n- A class to project and transform underlying model objects for use in\nspecific views\n\n## Transforming Data for SwiftUI Views\nThe Realm Swift SDK provides a special type of object, called a `Projection`, to transform\nand work with subsets of your data. Consider a projection similar to\na view model. It lets you pass through or transform the original\nobject's properties in different ways:\n\n- Passthrough: The projection's property has the same name and type as\nthe original object.\n- Rename: The projection's property has the same type as the original object,\nbut a different name.\n- Keypath resolution: Use this to access specific properties of the\nprojected Object.\n- Collection mapping: You can map some collection types to a collection of primitive values.\n- Exclusion: All properties of the original Realm object not defined in\nthe projection model. Any changes to those properties do not trigger a\nchange notification when observing the projection.\n\nWhen you use a Projection, you get all the benefits of Realm's\nlive objects:\n\n- The class-projected object live updates\n- You can observe it for changes\n- You can apply changes directly to the properties in write transactions\n\n## Define a New Object\nYou can define a Realm object by deriving from the\n`Object` or\n`EmbeddedObject`\nclass. The name of the class becomes the table name in the realm,\nand properties of the class persist in the database. This makes it\nas easy to work with persisted objects as it is to work with\nregular Swift objects.\n\nThe Realm SwiftUI documentation uses a model for a fictional app,\nDoggoDB. This app is a company directory of employees who have dogs. It\nlets people share a few details about their dogs with other employees.\n\nThe data model includes a Person object, with a to-many\nrelationship to that person's Dog objects.\nIt also uses a special Realm Swift SDK data type, `PersistableEnum`, to store information\nabout the person's business unit.\n\n```swift\nclass Person: Object, ObjectKeyIdentifiable {\n    @Persisted(primaryKey: true) var _id: ObjectId\n    @Persisted var firstName = \"\"\n    @Persisted var lastName = \"\"\n    @Persisted var personId = \"\"\n    @Persisted var company = \"my business\"\n    @Persisted var businessUnit = BusinessUnitEnum.engineering\n    @Persisted var profileImageUrl: URL?\n    @Persisted var dogs: List<Dog>\n}\n\nenum BusinessUnitEnum: String, PersistableEnum, CaseIterable {\n    case customerEngineering = \"Customer Engineering\"\n    case educationCommunityAndDocs = \"Education, Community and Docs\"\n    case engineering = \"Engineering\"\n    case financeAndOperations = \"Finance and Operations\"\n    case humanResourcesAndRescruiting = \"Human Resources and Recruiting\"\n    case management = \"Management\"\n    case marketing = \"Marketing\"\n    case product = \"Product\"\n    case sales = \"Sales\"\n}\n\nclass Dog: Object, ObjectKeyIdentifiable {\n    @Persisted(primaryKey: true) var _id: UUID\n    @Persisted var name = \"\"\n    @Persisted var breed = \"\"\n    @Persisted var weight = 0\n    @Persisted var favoriteToy = \"\"\n    @Persisted var profileImageUrl: URL?\n    @Persisted var dateLastUpdated = Date()\n    @Persisted(originProperty: \"dogs\") var person: LinkingObjects<Person>\n    var firstLetter: String {\n        guard let char = name.first else {\n            return \"\"\n        }\n        return String(char)\n    }\n}\n\n```\n\n> Seealso:\n> For complete details about defining a Realm object model, see:\n>\n> - Object Models\n> - Relationships\n> - Supported Data Types\n>\n\n## Define a Projection\nOur fictional DoggoDB app has a user Profile view. This view displays\nsome details about the person, but we don't need all of the properties\nof the `Person` model. We can create a `Projection` with only the details we want. We can also modify\nthe `lastName` property to use just the first initial of the last name.\n\n```swift\nclass Profile: Projection<Person> {\n    @Projected(\\Person.firstName) var firstName // Passthrough from original object\n    @Projected(\\Person.lastName.localizedCapitalized.first) var lastNameInitial // Access and transform the original property\n    @Projected(\\Person.personId) var personId\n    @Projected(\\Person.businessUnit) var businessUnit\n    @Projected(\\Person.profileImageUrl) var profileImageUrl\n    @Projected(\\Person.dogs) var dogs\n}\n\n```\n\nWe can use this projection in the Profile view instead of the original\n`Person` object.\n\nClass projection works with SwiftUI property wrappers:\n\n- `ObservedRealmObject`\n- `ObservedResults`\n\n> Seealso:\n> For a complete example of using a class projection in a SwiftUI\napplication, see [the Projections example app](https://github.com/realm/realm-cocoa/tree/master/examples#projections).\n>\n"
  },
  {
    "path": "docs/guides/swiftui/pass-realm-data-between-views.md",
    "content": "# Pass Realm Data Between SwiftUI Views\nThe Realm Swift SDK provides several ways to pass realm data between views:\n\n- Pass Realm objects to a view\n- Use environment injection to: Inject a partition value into a viewInject an opened realm into a viewInject a realm configuration into a view\n\n## Pass Realm Objects to a View\nWhen you use the `@ObservedRealmObject` or `@ObservedResults` property\nwrapper, you implicitly open a realm and retrieve the specified objects\nor results. You can then pass those objects to a view further down the\nhierarchy.\n\n```swift\nstruct DogsView: View {\n    @ObservedResults(Dog.self) var dogs\n\n    /// The button to be displayed on the top left.\n    var leadingBarButton: AnyView?\n\n    var body: some View {\n        NavigationView {\n            VStack {\n                // The list shows the dogs in the realm.\n                // The ``@ObservedResults`` above implicitly opens a realm and retrieves\n                // all the Dog objects. We can then pass those objects to views further down the\n                // hierarchy.\n                List {\n                    ForEach(dogs) { dog in\n                        DogRow(dog: dog)\n                    }.onDelete(perform: $dogs.remove)\n                }.listStyle(GroupedListStyle())\n                    .navigationBarTitle(\"Dogs\", displayMode: .large)\n                    .navigationBarBackButtonHidden(true)\n                    .navigationBarItems(\n                        leading: self.leadingBarButton,\n                        // Edit button on the right to enable rearranging items\n                        trailing: EditButton())\n            }.padding()\n        }\n    }\n}\n\n```\n\n## Pass Environment Values\n[Environment](https://developer.apple.com/documentation/swiftui/environment) injection is a\nuseful tool in SwiftUI development with Realm.\nRealm property wrappers provide different ways for you to\nwork with environment values when developing your SwiftUI application.\n\n### Inject an Opened Realm\nYou can inject a realm that you opened in another SwiftUI view into\na view as an environment value. The property wrapper uses this passed-in\nrealm to populate the view:\n\n```swift\nListView()\n   .environment(\\.realm, realm)\n```\n\n### Inject a Realm Configuration\nYou can use a realm other than the default realm by passing a different\nconfiguration in an environment object.\n\n```swift\nLocalOnlyContentView()\n.environment(\\.realmConfiguration, Realm.Configuration( /* ... */ ))\n```\n"
  },
  {
    "path": "docs/guides/swiftui/react-to-changes.md",
    "content": "# React to Changes - SwiftUI\n## Observe an Object\nThe Swift SDK provides the `@ObservedRealmObject` property wrapper that invalidates a view\nwhen an observed object changes. You can use this property wrapper to\ncreate a view that automatically updates itself when the observed object\nchanges.\n\n```swift\nstruct DogDetailView: View {\n    @ObservedRealmObject var dog: Dog\n\n    var body: some View {\n        VStack {\n            Text(dog.name)\n                .font(.title2)\n            Text(\"\\(dog.name) is a \\(dog.breed)\")\n            AsyncImage(url: dog.profileImageUrl) { image in\n                            image.resizable()\n                        } placeholder: {\n                            ProgressView()\n                        }\n                        .aspectRatio(contentMode: .fit)\n                        .frame(width: 150, height: 150)\n            Text(\"Favorite toy: \\(dog.favoriteToy)\")\n        }\n    }\n}\n\n```\n\n## Observe Query Results\nThe Swift SDK provides the `@ObservedResults`\nproperty wrapper that lets you observe a collection of query results. You\ncan perform a quick write to an ObservedResults collection, and the view\nautomatically updates itself when the observed query changes. For example,\nyou can remove a dog from an observed list of dogs using `onDelete`.\n\n> Note:\n> The `@ObservedResults` property wrapper is intended for use in a\nSwiftUI View. If you want to observe results in a view model, register\na change listener.\n>\n\n```swift\nstruct DogsView: View {\n    @ObservedResults(Dog.self) var dogs\n\n    /// The button to be displayed on the top left.\n    var leadingBarButton: AnyView?\n\n    var body: some View {\n        NavigationView {\n            VStack {\n                // The list shows the dogs in the realm.\n                // The ``@ObservedResults`` above implicitly opens a realm and retrieves\n                // all the Dog objects. We can then pass those objects to views further down the\n                // hierarchy.\n                List {\n                    ForEach(dogs) { dog in\n                        DogRow(dog: dog)\n                    }.onDelete(perform: $dogs.remove)\n                }.listStyle(GroupedListStyle())\n                    .navigationBarTitle(\"Dogs\", displayMode: .large)\n                    .navigationBarBackButtonHidden(true)\n                    .navigationBarItems(\n                        leading: self.leadingBarButton,\n                        // Edit button on the right to enable rearranging items\n                        trailing: EditButton())\n            }.padding()\n        }\n    }\n}\n\n```\n\n> Seealso:\n> For more information about the query syntax and types of queries that Realm\nsupports, see: Read and Filter\nData.\n>\n\n### Sort Observed Results\nThe `@ObservedResults`\nproperty wrapper can take a `SortDescriptor` parameter to sort the query results.\n\n```swift\nstruct SortedDogsView: View {\n    @ObservedResults(Dog.self,\n                     sortDescriptor: SortDescriptor(keyPath: \"name\",\n                        ascending: true)) var dogs\n\n    var body: some View {\n        NavigationView {\n            // The list shows the dogs in the realm, sorted by name\n            List(dogs) { dog in\n                DogRow(dog: dog)\n            }\n        }\n    }\n}\n\n```\n\n> Tip:\n> You cannot use a computed property as a `SortDescriptor` for `@ObservedResults`.\n>\n\n### Observe Sectioned Results\n> Version added: 10.29.0\n\nYou can observe a results set that is divided into sections by a key\ngenerated from a property on the object. We've added a computed variable\nto the model that we don't persist; we just use this to section the results\nset.\n\n```swift\nvar firstLetter: String {\n    guard let char = name.first else {\n        return \"\"\n    }\n    return String(char)\n}\n\n```\n\nThen, we can use the `@ObservedSectionedResults` property wrapper to\nobserve the results set divided into sections based on the computed variable\nkey.\n\n```swift\n@ObservedSectionedResults(Dog.self,\n                          sectionKeyPath: \\.firstLetter) var dogs\n\n```\n\nYou might use these observed sectioned results to populate a List view\ndivided by sections:\n\n```swift\nstruct SectionedDogsView: View {\n    @ObservedSectionedResults(Dog.self,\n                              sectionKeyPath: \\.firstLetter) var dogs\n\n    /// The button to be displayed on the top left.\n    var leadingBarButton: AnyView?\n\n    var body: some View {\n        NavigationView {\n            VStack {\n                // The list shows the dogs in the realm, split into sections according to the keypath.\n                List {\n                    ForEach(dogs) { section in\n                        Section(header: Text(section.key)) {\n                            ForEach(section) { dog in\n                                DogRow(dog: dog)\n                            }\n                        }\n                    }\n                }\n                .listStyle(GroupedListStyle())\n                    .navigationBarTitle(\"Dogs\", displayMode: .large)\n                    .navigationBarBackButtonHidden(true)\n                    .navigationBarItems(\n                        leading: self.leadingBarButton,\n                        // Edit button on the right to enable rearranging items\n                        trailing: EditButton())\n            }.padding()\n        }\n    }\n}\n\n```\n"
  },
  {
    "path": "docs/guides/swiftui/swiftui-previews.md",
    "content": "# Use Realm with SwiftUI Previews\n## Overview\nSwiftUI Previews are a useful tool during development. You can work with Realm\ndata in SwiftUI Previews in a few ways:\n\n- Initialize individual objects to use in detail views\n- Conditionally use an array of objects in place of `@ObservedResults`\n- Create a realm that contains data for the previews\n\nSwiftUI Preview debugging can be opaque, so we also have a few tips to debug\nissue with persisting Realms within SwiftUI Previews.\n\n### Initialize an Object for a Detail View\nIn the simplest case, you can use SwiftUI Previews with one or more objects\nthat use Realm properties you can set directly at initialization.\nYou might want to do this when previewing a Detail view. Consider DoggoDB's\n`DogDetailView`:\n\n```swift\nstruct DogDetailView: View {\n    @ObservedRealmObject var dog: Dog\n\n    var body: some View {\n        VStack {\n            Text(dog.name)\n                .font(.title2)\n            Text(\"\\(dog.name) is a \\(dog.breed)\")\n            AsyncImage(url: dog.profileImageUrl) { image in\n                            image.resizable()\n                        } placeholder: {\n                            ProgressView()\n                        }\n                        .aspectRatio(contentMode: .fit)\n                        .frame(width: 150, height: 150)\n            Text(\"Favorite toy: \\(dog.favoriteToy)\")\n        }\n    }\n}\n\n```\n\nCreate an extension for your model object. Where you put this extension depends\non convention in your codebase. You may put it directly in the model file,\nhave a dedicated directory for sample data, or use some other convention in\nyour codebase.\n\nIn this extension, initialize one or more Realm objects with `static let`:\n\n```swift\nextension Dog {\n    static let dog1 = Dog(value: [\"name\": \"Lita\", \"breed\": \"Lab mix\", \"weight\": 27, \"favoriteToy\": \"Squeaky duck\", \"profileImageUrl\": \"https://www.corporaterunaways.com/images/2021/04/lita-768x768.jpeg\"])\n    static let dog2 = Dog(value: [\"name\": \"Maui\", \"breed\": \"English Springer Spaniel\", \"weight\": 42, \"favoriteToy\": \"Wubba\", \"profileImageUrl\": \"https://www.corporaterunaways.com/images/2021/04/maui_with_leaf-768x576.jpeg\"])\n    static let dog3 = Dog(value: [\"name\": \"Ben\", \"breed\": \"Border Collie mix\", \"weight\": 48, \"favoriteToy\": \"Frisbee\", \"profileImageUrl\": \"https://www.corporaterunaways.com/images/2012/03/ben-630x420.jpg\"])\n\n}\n\n```\n\nIn this example, we initialize objects with a value. You can only initialize objects with\na value when your model contains properties that you can directly initialize.\nIf your model object contains properties that are only mutable within a\nwrite transaction, such as a List property,\nyou must instead create a realm to use with your SwiftUI Previews.\n\nAfter you have initialized an object as an extension of your model class,\nyou can use it in your SwiftUI Preview. You can pass the object directly\nto the View in the Preview:\n\n```swift\nstruct DogDetailView_Previews: PreviewProvider {\n    static var previews: some View {\n        NavigationView {\n            DogDetailView(dog: Dog.dog1)\n        }\n    }\n}\n\n```\n\n### Conditionally Use ObservedResults in a List View\nWhen you use `@ObservedResults`\nin a List view, this implicitly opens a realm and queries it. For this to\nwork in a Preview, you need a realm populated with data. As an alternative, you can conditionally\nuse a static array in Previews and only use the `@ObservedResults` variable\nwhen running the app.\n\nYou could do this in multiple ways, but for the sake of making our\ncode easier to read and understand, we'll create an `EnvironmentValue`\nthat can detect whether the app is running in a Preview:\n\n```swift\nimport Foundation\nimport SwiftUI\n\npublic extension EnvironmentValues {\n   var isPreview: Bool {\n      #if DEBUG\n      return ProcessInfo.processInfo.environment[\"XCODE_RUNNING_FOR_PREVIEWS\"] == \"1\"\n      #else\n      return false\n      #endif\n   }\n}\n```\n\nThen, we can use this as an environment value in our view, and conditionally\nchange which variable we use based on whether or not we are in a Preview.\n\nThis example builds on the Dog extension we defined above. We'll create an `dogArray` as\na `static let` in our Dog extension, and include the item objects we\nalready created:\n\n```swift\nstatic let dogArray = [dog1, dog2, dog3]\n```\n\nThen, when we iterate through our List, use the static `dogArray` if\nrunning in a Preview, or use the `@ObservedResults` query if not in a Preview.\n\n```swift\nstruct DogsView: View {\n   @Environment(\\.isPreview) var isPreview\n   @ObservedResults(Dog.self) var dogs\n   var previewDogs = Dog.dogArray\n\n   var body: some View {\n      NavigationView {\n         VStack {\n            List {\n               if isPreview {\n                  ForEach(previewDogs) { dog in\n                     DogRow(dog: dog)\n                  }\n               } else {\n                  ForEach(dogs) { dog in\n                     DogRow(dog: dog)\n                  }.onDelete(perform: $dogs.remove)\n               }\n            }\n            ... More View code\n```\n\nThis has the benefit of being lightweight and not persisting any data, but\nthe downside of making the View code more verbose. If you prefer cleaner\nView code, you can create a realm with data that you use in the Previews.\n\n### Create a Realm with Data for Previews\nIn some cases, your only option to see realm data in a SwiftUI Preview\nis to create a realm that contains the data. You might do this when populating\na property that can only be populated during a write transaction, rather\nthan initialized directly with a value, such as a List or MutableSet.\nYou might also want to do this if your view relies on more complex object\nhierarchies being passed in from other views.\n\nHowever, using a realm directly does inject state into your SwiftUI Previews,\nwhich can come with drawbacks. Whether you're using Realm or Core Data,\nstateful SwiftUI Previews can cause issues like:\n\n- Seeing unexpected or duplicated data due to re-running the realm file\ncreation steps repeatedly\n- Needing to perform a migration within the SwiftUI Preview when you make model changes\n- Potential issues related to changing state within views\n- Unexplained crashes or performance issues related to issues that are not\nsurfaced in a visible way in SwiftUI Previews\n\nYou can avoid or fix some of these issues with these tips:\n\n- Use an in-memory realm, when possible (demonstrated in the example above)\n- Manually delete all preview data from the command line to reset state\n- Check out diagnostic logs to try to troubleshoot SwiftUI Preview issues\n\nYou can create a static variable for your realm in your model extension.\nThis is where you do the work to populate your realm. In our case, we\ncreate a `Person` and append some `Dog` objects to the `dogs`\nList property. This example builds on the example above where we initialized\na few Dog objects in an Dog extension.\n\nWe'll create a `Person` extension, and create a single `Person` object\nin that extension. Then, we'll create a `previewRealm` by adding the\n`Person` we just created, and appending the example `Dog` objects from\nthe `Dog` extension.\n\nTo avoid adding these objects more than once, we add a check to see if the\nPerson already exists by querying for Person objects and checking that\nthe count is 1. If the realm contains a Person, we can use it in our\nSwiftUI Preview. If not, we add the data.\n\n```swift\nstatic var previewRealm: Realm {\n    var realm: Realm\n    let identifier = \"previewRealm\"\n    let config = Realm.Configuration(inMemoryIdentifier: identifier)\n    do {\n        realm = try Realm(configuration: config)\n        // Check to see whether the in-memory realm already contains a Person.\n        // If it does, we'll just return the existing realm.\n        // If it doesn't, we'll add a Person append the Dogs.\n        let realmObjects = realm.objects(Person.self)\n        if realmObjects.count == 1 {\n            return realm\n        } else {\n            try realm.write {\n                realm.add(person)\n                person.dogs.append(objectsIn: [Dog.dog1, Dog.dog2, Dog.dog3])\n            }\n            return realm\n        }\n    } catch let error {\n        fatalError(\"Can't bootstrap item data: \\(error.localizedDescription)\")\n    }\n}\n\n```\n\nTo use it in the SwiftUI Preview, our ProfileView code expects a Profile.\nThis is a projection of the Person object. In our\nPreview, we can get the realm, query it for the Profile, and pass it to the\nview:\n\n```swift\nstruct ProfileView_Previews: PreviewProvider {\n    static var previews: some View {\n        let realm = Person.previewRealm\n        let profile = realm.objects(Profile.self)\n        ProfileView(profile: profile.first!)\n    }\n}\n\n```\n\nIf you don't have a View that is expecting a realm object to be passed in,\nbut instead uses `@ObservedResults` to query a realm or otherwise work\nwith an existing realm, you can inject the realm into the view as an\nenvironment value:\n\n```swift\nstruct SomeListView_Previews: PreviewProvider {\n   static var previews: some View {\n      SomeListView()\n         .environment(\\.realm, Person.previewRealm)\n   }\n}\n```\n\n#### Use an In-Memory Realm\nWhen possible, use an in-memory realm\nto get around some of the state-related issues that can come from using\na database within a SwiftUI Preview.\n\nUse the `inMemoryIdentifier`\nconfiguration property when you initialize the realm.\n\n```swift\nstatic var previewRealm: Realm {\n   var realm: Realm\n   let identifier = \"previewRealm\"\n   let config = Realm.Configuration(inMemoryIdentifier: identifier)\n   do {\n      realm = try Realm(configuration: config)\n      // ... Add data to realm\n```\n\n> Note:\n> Do not use the the `deleteRealmIfMigrationNeeded`\nconfiguration property when you initialize a realm for SwiftUI Previews.\nDue to the way Apple has implemented SwiftUI Previews, using this property\nto bypass migration issues causes SwiftUI Previews to crash.\n>\n\n#### Delete SwiftUI Previews\nIf you run into other SwiftUI Preview issues related to state,\nsuch as a failure to load a realm in a Preview due to migration being\nrequired, there are a few things you can do to remove cached Preview data.\n\nThe Apple-recommended fix is to close Xcode and use the command line to\ndelete all your existing SwiftUI Preview data.\n\n1. Close Xcode.\n2. From your command line, run: `xcrun simctl --set previews delete all`\n\nIt's possible that data may persist after running this command. This is\nlikely due to Xcode retaining a reference due to something in the Preview\nand being unable to delete it. You can also try these steps to resolve issues:\n\n- Build for a different simulator\n- Restart the computer and re-run `xcrun simctl --set previews delete all`\n- Delete stored Preview data directly. This data is stored in\n`~/Library/Developer/Xcode/UserData/Previews`.\n\n#### Get Detailed Information about SwiftUI Preview Crashes\nIf you have an unexplained SwiftUI Preview crash when using realm, first try\nrunning the application on the simulator. The error messaging and logs available\nfor the simulator make it easier to find and diagnose issues. If you can\ndebug the issue in the simulator, this is the easiest route.\n\nIf you cannot replicate a SwiftUI Preview crash in the simulator, you can\nview crash logs for the SwiftUI Preview app. These logs are available in\n`~/Library/Logs/DiagnosticReports/`. These logs sometimes appear after\na delay, so wait a few minutes after a crash if you don't see the relevant\nlog immediately.\n"
  },
  {
    "path": "docs/guides/swiftui/swiftui-tutorial.md",
    "content": "# Realm with SwiftUI QuickStart\n## Prerequisites\n- Have Xcode 12.4 or later (minimum Swift version 5.3.1).\n- Create a new Xcode project using the SwiftUI \"App\" template with a minimum iOS target of 15.0.\n- Install the Swift SDK. This SwiftUI app requires a minimum\nSDK version of 10.19.0.\n\n## Overview\n> Seealso:\n> This page provides a small working app to get you up and running with\nRealm and SwiftUI quickly. If you'd like to see additional examples,\nincluding more explanation about Realm's SwiftUI features, see:\nSwiftUI.\n>\n\nThis page contains all of the code for a working Realm and SwiftUI app.\nThe app starts on the `ItemsView`, where you can edit a list of items:\n\n- Press the `Add` button on the bottom right of the screen to add\nrandomly-generated items.\n- Press the `Edit` button on the top right to modify the list order,\nwhich the app persists in the realm.\n- You can also swipe to delete items.\n\nWhen you have items in the list, you can press one of the items to\nnavigate to the `ItemDetailsView`. This is where you can modify the\nitem name or mark it as a favorite:\n\n- Press the text field in the center of the screen and type a new name.\nWhen you press Return, the item name should update across the app.\n- You can also toggle its favorite status by pressing the heart toggle in the\ntop right.\n\n### Get Started\nWe assume you have created an Xcode project with the SwiftUI \"App\"\ntemplate. Open the main Swift file and delete all of the code inside,\nincluding any `@main` `App` classes that Xcode generated for you. At\nthe top of the file, import the Realm and SwiftUI frameworks:\n\n```swift\nimport RealmSwift\nimport SwiftUI\n\n```\n\n> Tip:\n> Just want to dive right in with the complete code? Jump to\nComplete Code below.\n>\n\n### Define Models\nA common Realm data modeling use case is to have \"things\" and\n\"containers of things\". This app defines two related Realm object models: item\nand itemGroup.\n\nAn item has two user-facing properties:\n\n- A randomly generated-name, which the user can edit.\n- An `isFavorite` boolean property, which shows whether the user \"favorited\"\nthe item.\n\nAn itemGroup contains items. You can extend the itemGroup to have a name and an\nassociation with a specific user, but that's out of scope of this guide.\n\nPaste the following code into your main Swift file to define the models:\n\n```swift\n/// Random adjectives for more interesting demo item names\nlet randomAdjectives = [\n    \"fluffy\", \"classy\", \"bumpy\", \"bizarre\", \"wiggly\", \"quick\", \"sudden\",\n    \"acoustic\", \"smiling\", \"dispensable\", \"foreign\", \"shaky\", \"purple\", \"keen\",\n    \"aberrant\", \"disastrous\", \"vague\", \"squealing\", \"ad hoc\", \"sweet\"\n]\n\n/// Random noun for more interesting demo item names\nlet randomNouns = [\n    \"floor\", \"monitor\", \"hair tie\", \"puddle\", \"hair brush\", \"bread\",\n    \"cinder block\", \"glass\", \"ring\", \"twister\", \"coasters\", \"fridge\",\n    \"toe ring\", \"bracelet\", \"cabinet\", \"nail file\", \"plate\", \"lace\",\n    \"cork\", \"mouse pad\"\n]\n\n/// An individual item. Part of an `ItemGroup`.\nfinal class Item: Object, ObjectKeyIdentifiable {\n    /// The unique ID of the Item. `primaryKey: true` declares the\n    /// _id member as the primary key to the realm.\n    @Persisted(primaryKey: true) var _id: ObjectId\n\n    /// The name of the Item, By default, a random name is generated.\n    @Persisted var name = \"\\(randomAdjectives.randomElement()!) \\(randomNouns.randomElement()!)\"\n\n    /// A flag indicating whether the user \"favorited\" the item.\n    @Persisted var isFavorite = false\n\n    /// Users can enter a description, which is an empty string by default\n    @Persisted var itemDescription = \"\"\n\n    /// The backlink to the `ItemGroup` this item is a part of.\n    @Persisted(originProperty: \"items\") var group: LinkingObjects<ItemGroup>\n}\n\n/// Represents a collection of items.\nfinal class ItemGroup: Object, ObjectKeyIdentifiable {\n    /// The unique ID of the ItemGroup. `primaryKey: true` declares the\n    /// _id member as the primary key to the realm.\n    @Persisted(primaryKey: true) var _id: ObjectId\n\n    /// The collection of Items in this group.\n    @Persisted var items = RealmSwift.List<Item>()\n}\n\n```\n\n### Views and Observed Objects\nThe entrypoint of the app is the `ContentView` class that derives from\n`SwiftUI.App`. For now, this always displays the\n`LocalOnlyContentView`.\n\n```swift\n@main\nstruct ContentView: SwiftUI.App {\n    var body: some Scene {\n        WindowGroup {\n            LocalOnlyContentView()\n        }\n    }\n}\n\n```\n\n> Tip:\n> You can use a realm other than the default realm by passing\nan environment object from higher in the View hierarchy:\n>\n> ```swift\n> LocalOnlyContentView()\n>   .environment(\\.realmConfiguration, Realm.Configuration( /* ... */ ))\n> ```\n>\n\nThe LocalOnlyContentView has an `@ObservedResults` itemGroups. This implicitly uses the default\nrealm to load all itemGroups when the view appears.\n\nThis app only expects there to ever be one itemGroup. If there is an itemGroup\nin the realm, the LocalOnlyContentView renders an `ItemsView` for\nthat itemGroup.\n\nIf there is no itemGroup already in the realm, then the\nLocalOnlyContentView displays a ProgressView while it adds one. Because\nthe view observes the itemGroups thanks to the `@ObservedResults` property\nwrapper, the view immediately refreshes upon adding that first itemGroup and\ndisplays the ItemsView.\n\n```swift\n/// The main content view\nstruct LocalOnlyContentView: View {\n    @State var searchFilter: String = \"\"\n    // Implicitly use the default realm's objects(ItemGroup.self)\n    @ObservedResults(ItemGroup.self) var itemGroups\n\n    var body: some View {\n        if let itemGroup = itemGroups.first {\n            // Pass the ItemGroup objects to a view further\n            // down the hierarchy\n            ItemsView(itemGroup: itemGroup)\n        } else {\n            // For this small app, we only want one itemGroup in the realm.\n            // You can expand this app to support multiple itemGroups.\n            // For now, if there is no itemGroup, add one here.\n            ProgressView().onAppear {\n                $itemGroups.append(ItemGroup())\n            }\n        }\n    }\n}\n\n```\n\n> Tip:\n> Starting in SDK version 10.12.0, you can use an optional key path parameter\nwith `@ObservedResults` to filter change notifications to only those\noccurring on the provided key path or key paths. For example:\n>\n> ```\n> @ObservedResults(MyObject.self, keyPaths: [\"myList.property\"])\n> ```\n>\n\nThe ItemsView receives the itemGroup from the parent view and stores it in\nan `@ObservedRealmObject`\nproperty. This allows the ItemsView to \"know\" when the object has\nchanged regardless of where that change happened.\n\nThe ItemsView iterates over the itemGroup's items and passes each item to an\n`ItemRow` for rendering as a list.\n\nTo define what happens when a user deletes or moves a row, we pass the\n`remove` and `move` methods of the Realm\n`List` as the handlers of the respective\nremove and move events of the SwiftUI List. Thanks to the\n`@ObservedRealmObject` property wrapper, we can use these methods\nwithout explicitly opening a write transaction. The property wrapper\nautomatically opens a write transaction as needed.\n\n```swift\n/// The screen containing a list of items in an ItemGroup. Implements functionality for adding, rearranging,\n/// and deleting items in the ItemGroup.\nstruct ItemsView: View {\n    @ObservedRealmObject var itemGroup: ItemGroup\n\n    /// The button to be displayed on the top left.\n    var leadingBarButton: AnyView?\n\n    var body: some View {\n        NavigationView {\n            VStack {\n                // The list shows the items in the realm.\n                List {\n                    ForEach(itemGroup.items) { item in\n                        ItemRow(item: item)\n                    }.onDelete(perform: $itemGroup.items.remove)\n                    .onMove(perform: $itemGroup.items.move)\n                }\n                .listStyle(GroupedListStyle())\n                    .navigationBarTitle(\"Items\", displayMode: .large)\n                    .navigationBarBackButtonHidden(true)\n                    .navigationBarItems(\n                        leading: self.leadingBarButton,\n                        // Edit button on the right to enable rearranging items\n                        trailing: EditButton())\n                // Action bar at bottom contains Add button.\n                HStack {\n                    Spacer()\n                    Button(action: {\n                        // The bound collection automatically\n                        // handles write transactions, so we can\n                        // append directly to it.\n                        $itemGroup.items.append(Item())\n                    }) { Image(systemName: \"plus\") }\n                }.padding()\n            }\n        }\n    }\n}\n\n```\n\nFinally, the `ItemRow` and `ItemDetailsView` classes use the\n`@ObservedRealmObject` property wrapper with the item passed in from\nabove. These classes demonstrate a few more examples of how to use the\nproperty wrapper to display and update properties.\n\n```swift\n/// Represents an Item in a list.\nstruct ItemRow: View {\n    @ObservedRealmObject var item: Item\n\n    var body: some View {\n        // You can click an item in the list to navigate to an edit details screen.\n        NavigationLink(destination: ItemDetailsView(item: item)) {\n            Text(item.name)\n            if item.isFavorite {\n                // If the user \"favorited\" the item, display a heart icon\n                Image(systemName: \"heart.fill\")\n            }\n        }\n    }\n}\n\n/// Represents a screen where you can edit the item's name.\nstruct ItemDetailsView: View {\n    @ObservedRealmObject var item: Item\n\n    var body: some View {\n        VStack(alignment: .leading) {\n            Text(\"Enter a new name:\")\n            // Accept a new name\n            TextField(\"New name\", text: $item.name)\n                .navigationBarTitle(item.name)\n                .navigationBarItems(trailing: Toggle(isOn: $item.isFavorite) {\n                    Image(systemName: item.isFavorite ? \"heart.fill\" : \"heart\")\n                })\n        }.padding()\n    }\n}\n\n```\n\n> Tip:\n> `@ObservedRealmObject` is a frozen object. If you want to modify\nthe properties of an `@ObservedRealmObject`\ndirectly in a write transaction, you must `.thaw()` it first.\n>\n\nAt this point, you have everything you need to work with\nRealm and SwiftUI. Test it out and see if everything is\nworking as expected.\n\n## Complete Code\nIf you would like to copy and paste or examine the complete code, see below.\n\n```swift\nimport RealmSwift\nimport SwiftUI\n\n// MARK: Models\n\n/// Random adjectives for more interesting demo item names\nlet randomAdjectives = [\n    \"fluffy\", \"classy\", \"bumpy\", \"bizarre\", \"wiggly\", \"quick\", \"sudden\",\n    \"acoustic\", \"smiling\", \"dispensable\", \"foreign\", \"shaky\", \"purple\", \"keen\",\n    \"aberrant\", \"disastrous\", \"vague\", \"squealing\", \"ad hoc\", \"sweet\"\n]\n\n/// Random noun for more interesting demo item names\nlet randomNouns = [\n    \"floor\", \"monitor\", \"hair tie\", \"puddle\", \"hair brush\", \"bread\",\n    \"cinder block\", \"glass\", \"ring\", \"twister\", \"coasters\", \"fridge\",\n    \"toe ring\", \"bracelet\", \"cabinet\", \"nail file\", \"plate\", \"lace\",\n    \"cork\", \"mouse pad\"\n]\n\n/// An individual item. Part of an `ItemGroup`.\nfinal class Item: Object, ObjectKeyIdentifiable {\n    /// The unique ID of the Item. `primaryKey: true` declares the\n    /// _id member as the primary key to the realm.\n    @Persisted(primaryKey: true) var _id: ObjectId\n\n    /// The name of the Item, By default, a random name is generated.\n    @Persisted var name = \"\\(randomAdjectives.randomElement()!) \\(randomNouns.randomElement()!)\"\n\n    /// A flag indicating whether the user \"favorited\" the item.\n    @Persisted var isFavorite = false\n\n    /// Users can enter a description, which is an empty string by default\n    @Persisted var itemDescription = \"\"\n\n    /// The backlink to the `ItemGroup` this item is a part of.\n    @Persisted(originProperty: \"items\") var group: LinkingObjects<ItemGroup>\n\n}\n\n/// Represents a collection of items.\nfinal class ItemGroup: Object, ObjectKeyIdentifiable {\n    /// The unique ID of the ItemGroup. `primaryKey: true` declares the\n    /// _id member as the primary key to the realm.\n    @Persisted(primaryKey: true) var _id: ObjectId\n\n    /// The collection of Items in this group.\n    @Persisted var items = RealmSwift.List<Item>()\n\n}\n\nextension Item {\n    static let item1 = Item(value: [\"name\": \"fluffy coasters\", \"isFavorite\": false, \"ownerId\": \"previewRealm\"])\n    static let item2 = Item(value: [\"name\": \"sudden cinder block\", \"isFavorite\": true, \"ownerId\": \"previewRealm\"])\n    static let item3 = Item(value: [\"name\": \"classy mouse pad\", \"isFavorite\": false, \"ownerId\": \"previewRealm\"])\n}\n\nextension ItemGroup {\n    static let itemGroup = ItemGroup(value: [\"ownerId\": \"previewRealm\"])\n\n    static var previewRealm: Realm {\n        var realm: Realm\n        let identifier = \"previewRealm\"\n        let config = Realm.Configuration(inMemoryIdentifier: identifier)\n        do {\n            realm = try Realm(configuration: config)\n            // Check to see whether the in-memory realm already contains an ItemGroup.\n            // If it does, we'll just return the existing realm.\n            // If it doesn't, we'll add an ItemGroup and append the Items.\n            let realmObjects = realm.objects(ItemGroup.self)\n            if realmObjects.count == 1 {\n                return realm\n            } else {\n                try realm.write {\n                    realm.add(itemGroup)\n                    itemGroup.items.append(objectsIn: [Item.item1, Item.item2, Item.item3])\n                }\n                return realm\n            }\n        } catch let error {\n            fatalError(\"Can't bootstrap item data: \\(error.localizedDescription)\")\n        }\n    }\n}\n\n// MARK: Views\n\n// MARK: Main Views\n/// The main screen that determines whether to present the SyncContentView or the LocalOnlyContentView.\n/// For now, it always displays the LocalOnlyContentView.\n@main\nstruct ContentView: SwiftUI.App {\n    var body: some Scene {\n        WindowGroup {\n            LocalOnlyContentView()\n        }\n    }\n}\n\n/// The main content view\nstruct LocalOnlyContentView: View {\n    @State var searchFilter: String = \"\"\n    // Implicitly use the default realm's objects(ItemGroup.self)\n    @ObservedResults(ItemGroup.self) var itemGroups\n\n    var body: some View {\n        if let itemGroup = itemGroups.first {\n            // Pass the ItemGroup objects to a view further\n            // down the hierarchy\n            ItemsView(itemGroup: itemGroup)\n        } else {\n            // For this small app, we only want one itemGroup in the realm.\n            // You can expand this app to support multiple itemGroups.\n            // For now, if there is no itemGroup, add one here.\n            ProgressView().onAppear {\n                $itemGroups.append(ItemGroup())\n            }\n        }\n    }\n}\n\n// MARK: Item Views\n/// The screen containing a list of items in an ItemGroup. Implements functionality for adding, rearranging,\n/// and deleting items in the ItemGroup.\nstruct ItemsView: View {\n    @ObservedRealmObject var itemGroup: ItemGroup\n\n    /// The button to be displayed on the top left.\n    var leadingBarButton: AnyView?\n\n    var body: some View {\n        NavigationView {\n            VStack {\n                // The list shows the items in the realm.\n                List {\n                    ForEach(itemGroup.items) { item in\n                        ItemRow(item: item)\n                    }.onDelete(perform: $itemGroup.items.remove)\n                    .onMove(perform: $itemGroup.items.move)\n                }\n                .listStyle(GroupedListStyle())\n                    .navigationBarTitle(\"Items\", displayMode: .large)\n                    .navigationBarBackButtonHidden(true)\n                    .navigationBarItems(\n                        leading: self.leadingBarButton,\n                        // Edit button on the right to enable rearranging items\n                        trailing: EditButton())\n                // Action bar at bottom contains Add button.\n                HStack {\n                    Spacer()\n                    Button(action: {\n                        // The bound collection automatically\n                        // handles write transactions, so we can\n                        // append directly to it.\n                        $itemGroup.items.append(Item())\n                    }) { Image(systemName: \"plus\") }\n                }.padding()\n            }\n        }\n    }\n}\n\nstruct ItemsView_Previews: PreviewProvider {\n    static var previews: some View {\n        let realm = ItemGroup.previewRealm\n        let itemGroup = realm.objects(ItemGroup.self)\n        ItemsView(itemGroup: itemGroup.first!)\n    }\n}\n\n/// Represents an Item in a list.\nstruct ItemRow: View {\n    @ObservedRealmObject var item: Item\n\n    var body: some View {\n        // You can click an item in the list to navigate to an edit details screen.\n        NavigationLink(destination: ItemDetailsView(item: item)) {\n            Text(item.name)\n            if item.isFavorite {\n                // If the user \"favorited\" the item, display a heart icon\n                Image(systemName: \"heart.fill\")\n            }\n        }\n    }\n}\n\n/// Represents a screen where you can edit the item's name.\nstruct ItemDetailsView: View {\n    @ObservedRealmObject var item: Item\n\n    var body: some View {\n        VStack(alignment: .leading) {\n            Text(\"Enter a new name:\")\n            // Accept a new name\n            TextField(\"New name\", text: $item.name)\n                .navigationBarTitle(item.name)\n                .navigationBarItems(trailing: Toggle(isOn: $item.isFavorite) {\n                    Image(systemName: item.isFavorite ? \"heart.fill\" : \"heart\")\n                })\n        }.padding()\n    }\n}\n\nstruct ItemDetailsView_Previews: PreviewProvider {\n    static var previews: some View {\n        NavigationView {\n            ItemDetailsView(item: Item.item2)\n        }\n    }\n}\n\n```\n"
  },
  {
    "path": "docs/guides/swiftui/write.md",
    "content": "# Write Data - SwiftUI\n## Perform a Quick Write\nIn addition to performing writes inside a transaction block, the Realm Swift\nSDK offers a convenience feature to enable quick writes without explicitly\nperforming a write transaction.\n\nWhen you use the `@ObservedRealmObject` or `@ObservedResults` property\nwrappers, you can implicitly open a write transaction. Use the `$` operator\nto create a two-way binding to the state object. Then, when you make changes\nto the bound object or collection, you initiate an implicit write.\n\nThe Realm SwiftUI property wrappers work with frozen data to provide thread safety. When you use `$` to\ncreate a two-way binding, the Realm Swift SDK manages thawing the\nfrozen objects so you can write to them.\n\n### Update an Object's Properties\nIn this example, we create a two-way binding with one of the state object's\nproperties. `$dog.favoriteToy` creates a binding to the model Dog\nobject's `favoriteToy` property\n\nWhen the app user updates that field in this example, Realm\nopens an implicit write transaction and saves the new value to the database.\n\n```swift\nstruct EditDogDetails: View {\n    @ObservedRealmObject var dog: Dog\n    \n    var body: some View {\n        VStack {\n            Text(dog.name)\n                .font(.title2)\n            TextField(\"Favorite toy\", text: $dog.favoriteToy)\n        }\n    }\n}\n\n```\n\n### Add or Remove Objects in an ObservedResults Collection\nWhile a regular Realm Results collection\nis immutable, `ObservedResults`\nis a mutable collection that allows you to perform writes using a two-way\nbinding. When you update the bound collection, Realm opens an implicit write\ntransaction and saves the changes to the collection.\n\nIn this example, we remove an element from the results set using\n`$dogs.remove` in the `onDelete`. Using the `$dogs` here creates a\ntwo-way binding to a `BoundCollection` that lets us mutate the\n`@ObservedResults` `dogs` collection.\n\nWe add an item to the results using `$dogs.append` in the\n`addDogButton`.\n\nThese actions write directly to the `@ObservedResults` collection.\n\n```swift\nstruct DogsListView: View {\n    @ObservedResults(Dog.self) var dogs\n    \n    var body: some View {\n        NavigationView {\n            VStack {\n                // The list shows the dogs in the realm.\n                List {\n                    ForEach(dogs) { dog in\n                        DogRow(dog: dog)\n                        // Because `$dogs` here accesses an ObservedResults\n                        // collection, we can remove the specific dog from the collection.\n                        // Regular Realm Results are immutable, but you can write directly\n                        // to an `@ObservedResults` collection.\n                    }.onDelete(perform: $dogs.remove)\n                }.listStyle(GroupedListStyle())\n                    .navigationBarTitle(\"Dogs\", displayMode: .large)\n                    .navigationBarBackButtonHidden(true)\n                // Action bar at bottom contains Add button.\n                HStack {\n                    Spacer()\n                    Button(action: {\n                        // The bound collection automatically\n                        // handles write transactions, so we can\n                        // append directly to it. This example assumes\n                        // we have some values to populate the Dog object.\n                        $dogs.append(Dog(value: [\"name\":\"Bandido\"]))\n                    }) { Image(systemName: \"plus\") }\n                    .accessibilityIdentifier(\"addDogButton\")\n                }.padding()\n            }\n        }\n    }\n}\n\n```\n\n> Note:\n> The `@ObservedResults` property wrapper is intended for use in a\nSwiftUI View. If you want to observe results in a view model, register\na change listener.\n>\n\n### Append an Object to a List\nWhen you have a two-way binding with an `@ObservedRealmObject` that has\na list property, you can add new objects to the list.\n\nIn this example, the `Person` object has a list property that forms a\nto-many relationship with one or more dogs.\n\n```swift\nclass Person: Object, ObjectKeyIdentifiable {\n   @Persisted(primaryKey: true) var _id: ObjectId\n   @Persisted var firstName = \"\"\n   @Persisted var lastName = \"\"\n   ...\n   @Persisted var dogs: List<Dog>\n}\n```\n\nWhen the user presses the `Save` button, this:\n\n- Creates a `Dog` object with the details that the user has entered\n- Appends the `Dog` object to the `Person` object's `dogs` list\n\n```swift\nstruct AddDogToPersonView: View {\n    @ObservedRealmObject var person: Person\n    @Binding var isInAddDogView: Bool\n    @State var name = \"\"\n    @State var breed = \"\"\n    @State var weight = 0\n    @State var favoriteToy = \"\"\n    @State var profileImageUrl: URL?\n\n    var body: some View {\n        Form {\n            TextField(\"Dog's name\", text: $name)\n            TextField(\"Dog's breed\", text: $breed)\n            TextField(\"Dog's weight\", value: $weight, format: .number)\n            TextField(\"Dog's favorite toy\", text: $favoriteToy)\n            TextField(\"Image link\", value: $profileImageUrl, format: .url)\n                            .keyboardType(.URL)\n                            .textInputAutocapitalization(.never)\n                            .disableAutocorrection(true)\n            Section {\n                Button(action: {\n                    let dog = createDog(name: name, breed: breed, weight: weight, favoriteToy: favoriteToy, profileImageUrl: profileImageUrl)\n                    $person.dogs.append(dog)\n                    isInAddDogView.toggle()\n                }) {\n                    Text(\"Save\")\n                }\n                Button(action: {\n                    isInAddDogView.toggle()\n                }) {\n                    Text(\"Cancel\")\n                }\n            }\n        }\n    }\n}\n```\n\n### Use Create to Copy an Object Into the Realm\nThere may be times when you create a new object, and set one of its properties\nto an object that already exists in the realm. Then, when you go to add the\nnew object to the realm, you see an error similar to:\n\n```shell\nObject is already managed by another Realm. Use create instead to copy it into this Realm.\n```\n\nWhen this occurs, you can use the `.create`\nmethod to initialize the object, and use `modified: .update` to set its\nproperty to the existing object.\n\n> Example:\n> Consider a version of the DoggoDB `Dog` model where the `favoriteToy`\nproperty isn't just a `String`, but is an optional `DogToy` object:\n>\n> ```swift\n> class Dog: Object, ObjectKeyIdentifiable {\n>    @Persisted(primaryKey: true) var _id: UUID\n>    @Persisted var name = \"\"\n>    ...\n>    @Persisted var favoriteToy: DogToy?\n>    ...\n> }\n> ```\n>\n> When your app goes to create a new `Dog` object, perhaps it checks to see\nif the `DogToy` already exists in the realm, and then set the `favoriteToy`\nproperty to the existing dog toy.\n>\n> When you go to append the new `Dog` to the `Person` object, you may\nsee an error similar to:\n>\n> ```shell\n> Object is already managed by another Realm. Use create instead to copy it into this Realm.\n> ```\n>\n> The `Dog` object remains unmanaged until you append it to the `Person`\nobject's `dogs` property. When the Realm Swift SDK checks the `Dog`\nobject to find the realm that is currently managing it, it finds nothing.\n>\n> When you use the `$` notation to perform a quick write that appends the\n`Dog` object to the `Person` object, this write uses the realm it has\naccess to in the view. This is a realm instance implicitly opened by\nthe `@ObservedRealmObject` or `@ObservedResults` property wrapper.\nThe existing `DogToy` object, however, may be managed by a different\nrealm instance.\n>\n> To solve this error, use the `.create`\nmethod when you initialize the `Dog` object, and use\n`modified: .update` to set its `favoriteToy` value to the existing\nobject:\n>\n> ```swift\n> // When working with an `@ObservedRealmObject` `Person`, this is a frozen object.\n> // Thaw the object and get its realm to perform the write to append the new dog.\n> let thawedPersonRealm = frozenPerson.thaw()!.realm!\n> try! thawedPersonRealm.write {\n>     // Use the .create method with `update: .modified` to copy the\n>     // existing object into the realm\n>     let dog = thawedPersonRealm.create(Dog.self, value:\n>                                         [\"name\": \"Maui\",\n>                                          \"favoriteToy\": wubba],\n>                                        update: .modified)\n>     person.dogs.append(dog)\n> }\n>\n> ```\n>\n\n## Perform an Explicit Write\nIn some cases, you may want or need to explicitly perform a write transaction\ninstead of using the implicit `$` to perform a quick write. You may want\nto do this when:\n\n- You need to look up additional objects to perform a write\n- You need to perform a write to objects you don't have access to in the view\n\nIf you pass an object you are observing with `@ObservedRealmObject` or\n`@ObservedResults` into a function where you perform an explicit write\ntransaction that modifies the object, you must thaw it first.\n\n```swift\nlet thawedCompany = company.thaw()!\n\n```\n\nYou can access the realm that is managing the object or objects by calling\n`.realm` on the object or collection:\n\n```swift\nlet realm = company.realm!.thaw()\n\n```\n\nBecause the SwiftUI property wrappers use frozen objects, you must thaw\nthe realm before you can write to it.\n\n> Example:\n> Consider a version of the DoggoDB app where a `Company` object\nhas a list of `Employee` objects. Each `Employee` has a list of\n`Dog` objects. But for business reasons, you also wanted to have a\nlist of `Dog` objects available directly on the `Company` object,\nwithout being associated with an `Employee`. The model might look\nsomething like:\n>\n> ```swift\n> class Company: Object, ObjectKeyIdentifiable {\n>     @Persisted(primaryKey: true) var _id: ObjectId\n>     @Persisted var companyName = \"\"\n>     @Persisted var employees: List<Employee>\n>     @Persisted var dogs: List<Dog>\n> }\n>\n> ```\n>\n> Consider a view where you have access to the `Company` object, but\nwant to perform an explicit write to add an existing dog to an existing\nemployee. Your function might look something like:\n>\n> ```swift\n> // The `frozenCompany` here represents an `@ObservedRealmObject var company: Company`\n> performAnExplicitWrite(company: frozenCompany, employeeName: \"Dachary\", dogName: \"Maui\")\n>\n> func performAnExplicitWrite(company: Company, employeeName: String, dogName: String) {\n>     // Get the realm that is managing the `Company` object you passed in.\n>     // Thaw the realm so you can write to it.\n>     let realm = company.realm!.thaw()\n>     // Thawing the `Company` object that you passed in also thaws the objects in its List properties.\n>     // This lets you append the `Dog` to the `Employee` without individually thawing both of them.\n>     let thawedCompany = company.thaw()!\n>     let thisEmployee = thawedCompany.employees.where { $0.name == employeeName }.first!\n>     let thisDog = thawedCompany.dogs.where { $0.name == dogName }.first!\n>     try! realm.write {\n>         thisEmployee.dogs.append(thisDog)\n>     }\n> }\n>\n> ```\n>\n"
  },
  {
    "path": "docs/guides/swiftui.md",
    "content": "# SwiftUI - Swift SDK\n## Overview\nThe Realm Swift SDK offers features that integrate into SwiftUI.\nThis documentation provides an overview of those features.\n\n- [Quick Start](swiftui-tutorial.md)\n- [Model Data](model-data/define-a-realm-object-model.md)\n- [Configure and Open a Realm](configure-and-open-realm.md)\n- [React to Changes](react-to-changes.md)\n- [Pass Realm Data Between Views](pass-realm-data-between-views.md)\n- [Write Data](write.md)\n- [Filter Data](filter-data.md)\n- [Use Realm with SwiftUI Previews](swiftui-previews.md)\n\n## Requirements\n- Xcode project using the SwiftUI \"App\" template. To use all of the Realm\nSwift SDK's SwiftUI features, the minimum iOS target is 15.0. Some features\nare compatible with older versions of iOS.\n- Install the Swift SDK. Use the most recent version of\nthe Realm Swift SDK to get all of the features and enhancements for SwiftUI.\n"
  },
  {
    "path": "docs/guides/test-and-debug.md",
    "content": "# Test and Debug - Swift SDK\n## Testing\n### Test Using a Default Realm\nThe easiest way to use and test Realm-backed applications\nis to use the default realm. To avoid overriding application data or\nleaking state between tests, set the default realm to a new file for\neach test.\n\n```swift\n// A base class which each of your Realm-using tests should inherit from rather\n// than directly from XCTestCase\nclass TestCaseBase: XCTestCase {\n    override func setUp() {\n        super.setUp()\n\n        // Use an in-memory Realm identified by the name of the current test.\n        // This ensures that each test can't accidentally access or modify the data\n        // from other tests or the application itself, and because they're in-memory,\n        // there's nothing that needs to be cleaned up.\n        Realm.Configuration.defaultConfiguration.inMemoryIdentifier = self.name\n    }\n}\n\n```\n\n### Injecting Realm Instances\nAnother way to test Realm-related code is to have all the\nmethods you'd like to test accept a realm instance as an argument. This\nenables you to pass in different realms when running the app and when\ntesting it.\n\nFor example, suppose your app has a method to `GET` a user profile\nfrom a JSON API. You want to test that the local profile is properly\ncreated.\n\n### Simplify Testing with Class Projections\n> Version added: 10.21.0\n\nIf you want to work with a subset of an object's properties for testing,\nyou can create a class projection.\nA class projection is a model abstraction where you can pass through, rename,\nor exclude realm object properties. While this feature simplifies view\nmodel implementation, it also simplifies testing with Realm.\n\n> Example:\n> This example uses the object models\nand the class projection from the\nDefine and Use Class Projections page.\n>\n> In this example, we create a realm object using the full object model.\nThen, we view retrieve the object as a class projection, working with\nonly a subset of its properties.\n>\n> With this class projection, we don't need to access or account for\nproperties that we don't need to test.\n>\n> ```swift\n> func testWithProjection() {\n>     let realm = try! Realm()\n>     // Create a Realm object, populate it with values\n>     let jasonBourne = Person(value: [\"firstName\": \"Jason\",\n>                                                        \"lastName\": \"Bourne\",\n>                                                        \"address\": [\n>                                                         \"city\": \"Zurich\",\n>                                                         \"country\": \"Switzerland\"]])\n>     try! realm.write {\n>         realm.add(jasonBourne)\n>     }\n>\n>     // Retrieve all class projections of the given type `PersonProjection`\n>     // and filter for the first class projection where the `firstName` property\n>     // value is \"Jason\"\n>     let person = realm.objects(PersonProjection.self).first(where: { $0.firstName == \"Jason\" })!\n>     // Verify that we have the correct PersonProjection\n>     XCTAssert(person.firstName == \"Jason\")\n>     // See that `homeCity` exists as a projection property\n>     // Although it is not on the object model\n>     XCTAssert(person.homeCity == \"Zurich\")\n>\n>     // Change a value on the class projection\n>     try! realm.write {\n>         person.firstName = \"David\"\n>     }\n>\n>     // Verify that the projected property's value has changed\n>     XCTAssert(person.firstName == \"David\")\n> }\n>\n> ```\n>\n\n### Test Targets\nDon't link the Realm framework directly to your test target.\nThis can cause your tests to fail with an exception message \"Object type\n'YourObject' is not managed by the Realm.\" Unlinking Realm\nfrom your test target should resolve this issue.\n\nCompile your model class files in your application or framework targets;\ndon't add them to your unit test targets. Otherwise, those classes are\nduplicated when testing, which can lead to difficult-to-debug issues.\n\nExpose all the code that you need for testing to your unit test\ntargets. Use the `public` access modifier or [@testable](https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/testing_with_xcode/chapters/04-writing_tests.html).\n\nSince you're using Realm as a dynamic framework, you'll\nneed to make sure your unit test target can find Realm.\nAdd the parent path to `RealmSwift.framework` to your unit test's\n\"Framework Search Paths\".\n\n## Debugging\n### Debug Using Realm Studio\nRealm Studio enables you to open and edit local\nrealms. It supports Mac, Windows and Linux.\n\n### LLDB\nDebugging apps using Realm's Swift API must be done through\nthe LLDB console.\n\nAlthough the LLDB script allows inspecting the contents of your realm\nvariables in Xcode's UI, this doesn't yet work for Swift. Those\nvariables will show incorrect data. Instead, use LLDB's `po`\ncommand to inspect the contents of data stored in a realm.\n\n## Troubleshooting\n### Resolve Build Issues\nSome developers experience build issues after installing the Realm Swift SDK via\nCocoaPods or Carthage. Common causes of these issues include:\n\n- Installation issues: Initial install failedUsing an unsupported version of the dependency manager\n- Build tool issues: Build tools have stale cachesUpdating build tool versions\n- Making changes to your project setup, such as: Adding a new targetSharing dependencies across targets\n\nA fix that often clears these issues is to delete derived data\nand clean the Xcode build folder.\n\n#### Cocoapods\n\n##### Reset the Cocoapods Integration State\nRun these commands in the terminal, in the root of your project:\n\n```bash\npod cache clean Realm\npod cache clean RealmSwift\npod deintegrate || rm -rf Pods\npod install --repo-update --verbose\n# Assumes the default DerivedData location:\nrm -rf ~/Library/Developer/Xcode/DerivedData\n```\n\n##### Clean the Xcode Build Folder\nWith your project open in Xcode, go to the Product drop-down menu,\nand select Clean Build Folder.\n\n#### Carthage\n\n##### Reset Carthage-managed Dependency State\nRun these commands in the terminal, in the root of your project:\n\n```bash\nrm -rf Carthage\n# Assumes default DerivedData location:\nrm -rf ~/Library/Developer/Xcode/DerivedData\ncarthage update\n```\n\n##### Clean the Xcode Build Folder\nWith your project open in Xcode, go to the Product drop-down menu,\nand select Clean Build Folder.\n\n### Issues Opening Realm Before Loading the UI\nYou may open a realm and immediately see crashes with error messages\nrelated to properties being optional or required. Issues with your\nobject model can cause\nthese types of crashes. These errors occur after you open a realm,\nbut before you get to the UI.\n\nRealm has a \"schema discovery\" phase when a realm opens on the device.\nAt this time, Realm examines the schema for any objects that it manages.\nYou can specify that a given realm should manage only a subset\nof objects in your\napplication.\n\nIf you see errors related to properties during schema discovery, these are\nlikely due to schema issues and not issues with data from a specific object.\nFor example, you may see schema discovery errors if you define a to-one\nrelationship as required\ninstead of optional.\n\nTo debug these crashes, check the schema you've defined.\n\nYou can tell these are schema discovery issues because they occur before\nthe UI loads. This means that no UI element is attempting to incorrectly\nuse a property, and there aren't any objects in memory that could have\nbad data. If you get errors related to properties *after* the UI loads,\nthis is probably not due to invalid schema. Instead, those errors are\nlikely a result of incorrect, wrongly-typed or missing data.\n\n### No Properties are Defined for Model\nThe Realm Swift SDK uses the Swift language reflection feature to determine\nthe properties in your model at runtime. If you get a crash similar to\nthe following, confirm that your project has not disabled reflection metadata:\n\n```shell\nTerminating app due to uncaught exception 'RLMException', reason: 'No properties are defined for 'ObjectName'.\n```\n\nIf you set `SWIFT_REFLECTION_METADATA_LEVEL = none`, Realm cannot\ndiscover children of types, such as properties and enums. Reflection is\nenabled by default if your project does not specifically set a level for\nthis setting.\n\n### Bad Alloc/Not Enough Memory Available\nIn iOS or iPad devices with little available memory, or where you have a\nmemory-intensive application that uses multiple realms or many notifications,\nyou may encounter the following error:\n\n```console\nlibc++abi: terminating due to an uncaught exception of type std::bad_alloc: std::bad_alloc\n```\n\nThis error typically indicates that a resource cannot be allocated because\nnot enough memory is available.\n\nIf you are building for iOS 15+ or iPad 15+, you can add the\n[Extended Virtual Addressing Entitlement](https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_kernel_extended-virtual-addressing)\nto resolve this issue.\n\nAdd these keys to your Property List, and set the values to `true`:\n\n```xml\n<key>com.apple.developer.kernel.extended-virtual-addressing</key>\n<true/>\n<key>com.apple.developer.kernel.increased-memory-limit</key>\n<true/>\n```\n\n### Swift Package Target Cannot be Built Dynamically\n> Version changed: 10.49.3\n\nSwift SDK v10.49.3 changed the details for installing the package with\nSwift Package Manager (SPM). When you update from an older version of the\npackage to v10.49.3 or newer, you may get a build error similar to:\n\n```console\nSwift package target `Realm` is linked as a static library by `TargetName`\nand `Realm`, but cannot be built dynamically because there is a package\nproduct with the same name.\n```\n\nTo resolve this error, unlink either the `Realm` or the `RealmSwift`\npackage from your build target. You can do this in Xcode by following these\nsteps:\n\n1. In your project Targets, select your build target.\n2. Go to the Build Phases tab.\n3. Expand the Link Binary With Libraries element.\n4. Select either `Realm` or `RealmSwift`, and click the Remove items\n(-) button to remove the unneeded binary. If you use Swift or Swift\nand Objective-C APIs, keep `RealmSwift`. If you use only Objective-C\nAPIs, keep `Realm`.\n\nNow your target should build without this error.\n"
  },
  {
    "path": "docs/guides/use-realm-with-actors.md",
    "content": "# Use Realm with Actors - Swift SDK\nStarting with Realm Swift SDK version 10.39.0, Realm supports built-in\nfunctionality for using Realm with Swift Actors. Realm's actor support\nprovides an alternative to managing threads or dispatch queues to perform\nasynchronous work. You can use Realm with actors in a few different ways:\n\n- Work with realm *only* on a specific actor with an actor-isolated realm\n- Use Realm across actors based on the needs of your application\n\nYou might want to use an actor-isolated realm if you want to restrict all\nrealm access to a single actor. This negates the need to pass data across\nthe actor boundary, and can simplify data race debugging.\n\nYou might want to use realms across actors in cases where you want to\nperform different types of work on different actors. For example, you might\nwant to read objects on the MainActor but use a background actor for large\nwrites.\n\nFor general information about Swift actors, refer to [Apple's Actor\ndocumentation](https://developer.apple.com/documentation/swift/actor).\n\n## Prerequisites\nTo use Realm in a Swift actor, your project must:\n\n- Use Realm Swift SDK version 10.39.0 or later\n- Use Swift 5.8/Xcode 14.3\n\nIn addition, we strongly recommend enabling these settings in your project:\n\n- `SWIFT_STRICT_CONCURRENCY=complete`: enables strict concurrency checking\n- `OTHER_SWIFT_FLAGS=-Xfrontend-enable-actor-data-race-checks`: enables\nruntime actor data-race detection\n\n## About the Examples on This Page\nThe examples on this page use the following model:\n\n```swift\nclass Todo: Object {\n    @Persisted(primaryKey: true) var _id: ObjectId\n    @Persisted var name: String\n    @Persisted var owner: String\n    @Persisted var status: String\n}\n\n```\n\n## Open an Actor-Isolated Realm\nYou can use the Swift async/await syntax to await opening a realm.\n\nInitializing a realm with `try await Realm()` opens a MainActor-isolated\nrealm. Alternately, you can explicitly specify an actor when opening a\nrealm with the `await` syntax.\n\n```swift\n@MainActor\nfunc mainThreadFunction() async throws {\n    // These are identical: the async init produces a\n    // MainActor-isolated Realm if no actor is supplied\n    let realm1 = try await Realm()\n    let realm2 = try await Realm(actor: MainActor.shared)\n\n    try await useTheRealm(realm: realm1)\n}\n\n```\n\nYou can specify a default configuration or customize your configuration when\nopening an actor-isolated realm:\n\n```swift\n@MainActor\nfunc mainThreadFunction() async throws {\n    let username = \"Galadriel\"\n\n    // Customize the default realm config\n    var config = Realm.Configuration.defaultConfiguration\n    config.fileURL!.deleteLastPathComponent()\n    config.fileURL!.appendPathComponent(username)\n    config.fileURL!.appendPathExtension(\"realm\")\n\n    // Open an actor-isolated realm with a specific configuration\n    let realm = try await Realm(configuration: config, actor: MainActor.shared)\n\n    try await useTheRealm(realm: realm)\n}\n\n```\n\nFor more general information about configuring a realm, refer to\nConfigure & Open a Realm.\n\n## Define a Custom Realm Actor\nYou can define a specific actor to manage Realm in asynchronous contexts.\nYou can use this actor to manage realm access and perform write operations.\n\n```swift\nactor RealmActor {\n    // An implicitly-unwrapped optional is used here to let us pass `self` to\n    // `Realm(actor:)` within `init`\n    var realm: Realm!\n    init() async throws {\n        realm = try await Realm(actor: self)\n    }\n\n    var count: Int {\n        realm.objects(Todo.self).count\n    }\n\n    func createTodo(name: String, owner: String, status: String) async throws {\n        try await realm.asyncWrite {\n            realm.create(Todo.self, value: [\n                \"_id\": ObjectId.generate(),\n                \"name\": name,\n                \"owner\": owner,\n                \"status\": status\n            ])\n        }\n    }\n\n    func getTodoOwner(forTodoNamed name: String) -> String {\n        let todo = realm.objects(Todo.self).where {\n            $0.name == name\n        }.first!\n        return todo.owner\n    }\n\n    struct TodoStruct {\n        var id: ObjectId\n        var name, owner, status: String\n    }\n\n    func getTodoAsStruct(forTodoNamed name: String) -> TodoStruct {\n        let todo = realm.objects(Todo.self).where {\n            $0.name == name\n        }.first!\n        return TodoStruct(id: todo._id, name: todo.name, owner: todo.owner, status: todo.status)\n    }\n\n    func updateTodo(_id: ObjectId, name: String, owner: String, status: String) async throws {\n        try await realm.asyncWrite {\n            realm.create(Todo.self, value: [\n                \"_id\": _id,\n                \"name\": name,\n                \"owner\": owner,\n                \"status\": status\n            ], update: .modified)\n        }\n    }\n\n    func deleteTodo(id: ObjectId) async throws {\n        try await realm.asyncWrite {\n            let todoToDelete = realm.object(ofType: Todo.self, forPrimaryKey: id)\n            realm.delete(todoToDelete!)\n        }\n    }\n\n    func close() {\n        realm = nil\n    }\n\n}\n\n```\n\nAn actor-isolated realm may be used with either local or global actors.\n\n```swift\n// A simple example of a custom global actor\n@globalActor actor BackgroundActor: GlobalActor {\n    static var shared = BackgroundActor()\n}\n\n@BackgroundActor\nfunc backgroundThreadFunction() async throws {\n    // Explicitly specifying the actor is required for anything that is not MainActor\n    let realm = try await Realm(actor: BackgroundActor.shared)\n    try await realm.asyncWrite {\n        _ = realm.create(Todo.self, value: [\n            \"name\": \"Pledge fealty and service to Gondor\",\n            \"owner\": \"Pippin\",\n            \"status\": \"In Progress\"\n        ])\n    }\n    // Thread-confined Realms would sometimes throw an exception here, as we\n    // may end up on a different thread after an `await`\n    let todoCount = realm.objects(Todo.self).count\n    print(\"The number of Realm objects is: \\(todoCount)\")\n}\n\n@MainActor\nfunc mainThreadFunction() async throws {\n    try await backgroundThreadFunction()\n}\n\n```\n\n### Use a Realm Actor Synchronously in an Isolated Function\nWhen a function is confined to a specific actor, you can use the actor-isolated\nrealm synchronously.\n\n```swift\nfunc createObject(in actor: isolated RealmActor) async throws {\n    // Because this function is isolated to this actor, you can use\n    // realm synchronously in this context without async/await keywords\n    try actor.realm.write {\n        actor.realm.create(Todo.self, value: [\n            \"name\": \"Keep it secret\",\n            \"owner\": \"Frodo\",\n            \"status\": \"In Progress\"\n        ])\n    }\n    let taskCount = actor.count\n    print(\"The actor currently has \\(taskCount) tasks\")\n}\n\nlet actor = try await RealmActor()\n\ntry await createObject(in: actor)\n\n```\n\n### Use a Realm Actor in Async Functions\nWhen a function isn't confined to a specific actor, you can use your Realm actor\nwith Swift's async/await syntax.\n\n```swift\nfunc createObject() async throws {\n    // Because this function is not isolated to this actor,\n    // you must await operations completed on the actor\n    try await actor.createTodo(name: \"Take the ring to Mount Doom\", owner: \"Frodo\", status: \"In Progress\")\n    let taskCount = await actor.count\n    print(\"The actor currently has \\(taskCount) tasks\")\n}\n\nlet actor = try await RealmActor()\n\ntry await createObject()\n\n```\n\n## Write to an Actor-Isolated Realm\nActor-isolated realms can use Swift async/await syntax for asynchronous\nwrites. Using `try await realm.asyncWrite { ... }` suspends the current task,\nacquires the write lock without blocking the current thread, and then invokes\nthe block. Realm writes the data to disk on a background thread and resumes\nthe task when that completes.\n\nThis function from the example `RealmActor` defined above shows how you might\nwrite to an actor-isolated realm:\n\n```swift\nfunc createTodo(name: String, owner: String, status: String) async throws {\n    try await realm.asyncWrite {\n        realm.create(Todo.self, value: [\n            \"_id\": ObjectId.generate(),\n            \"name\": name,\n            \"owner\": owner,\n            \"status\": status\n        ])\n    }\n}\n\n```\n\nAnd you might perform this write using Swift's async syntax:\n\n```swift\nfunc createObject() async throws {\n    // Because this function is not isolated to this actor,\n    // you must await operations completed on the actor\n    try await actor.createTodo(name: \"Take the ring to Mount Doom\", owner: \"Frodo\", status: \"In Progress\")\n    let taskCount = await actor.count\n    print(\"The actor currently has \\(taskCount) tasks\")\n}\n\nlet actor = try await RealmActor()\n\ntry await createObject()\n\n```\n\nThis does not block the calling thread while waiting to write. It does\nnot perform I/O on the calling thread. For small writes, this is safe to\nuse from `@MainActor` functions without blocking the UI. Writes that\nnegatively impact your app's performance due to complexity and/or platform\nresource constraints may still benefit from being done on a background thread.\n\nAsynchronous writes are only supported for actor-isolated Realms or in\n`@MainActor` functions.\n\n## Pass Realm Data Across the Actor Boundary\nRealm objects are not [Sendable](https://developer.apple.com/documentation/swift/sendable),\nand cannot cross the actor boundary directly. To pass Realm data across\nthe actor boundary, you have two options:\n\n- Pass a `ThreadSafeReference` to or from the actor\n- Pass other types that *are* Sendable, such as passing values directly\nor by creating structs to pass across actor boundaries\n\n### Pass a ThreadSafeReference\nYou can create a `ThreadSafeReference` on an\nactor where you have access to the object. In this case, we create a\n`ThreadSafeReference` on the `MainActor`. Then, pass the `ThreadSafeReference` to the destination actor.\n\n```swift\n// We can pass a thread-safe reference to an object to update it on a different actor.\nlet todo = todoCollection.where {\n    $0.name == \"Arrive safely in Bree\"\n}.first!\nlet threadSafeReferenceToTodo = ThreadSafeReference(to: todo)\ntry await backgroundActor.deleteTodo(tsrToTodo: threadSafeReferenceToTodo)\n\n```\n\nOn the destination actor, you must `resolve()` the reference within a\nwrite transaction before you can use it. This retrieves a version of the\nobject local to that actor.\n\n```swift\nactor BackgroundActor {\n    public func deleteTodo(tsrToTodo tsr: ThreadSafeReference<Todo>) throws {\n        let realm = try! Realm()\n        try realm.write {\n            // Resolve the thread safe reference on the Actor where you want to use it.\n            // Then, do something with the object.\n            let todoOnActor = realm.resolve(tsr)\n            realm.delete(todoOnActor!)\n        }\n    }\n}\n\n```\n\n> Important:\n> You must resolve a `ThreadSafeReference` exactly once. Otherwise,\nthe source realm remains pinned until the reference gets\ndeallocated. For this reason, `ThreadSafeReference` should be\nshort-lived.\n>\n> If you may need to share the same realm object across actors more than\nonce, you may prefer to share the primary key\nand query for it on\nthe actor where you want to use it. Refer to the \"Pass a Primary Key\nand Query for the Object on Another Actor\" section on this page for an example.\n>\n\n### Pass a Sendable Type\nWhile Realm objects are not Sendable, you can work around this by passing\nSendable types across actor boundaries. You can use a few strategies to\npass Sendable types and work with data across actor boundaries:\n\n- Pass Sendable Realm types or primitive values instead of complete Realm objects\n- Pass an object's primary key and query for the object on another actor\n- Create a Sendable representation of your Realm object, such as a struct\n\n#### Pass Sendable Realm Types and Primitive Values\nIf you only need a piece of information from the Realm object, such as a\n`String` or `Int`, you can pass the value directly across actors instead\nof passing the Realm object. For a full list of which Realm types are Sendable,\nrefer to Sendable, Non-Sendable and Thread-Confined Types.\n\n```swift\n@MainActor\nfunc mainThreadFunction() async throws {\n    // Create an object in an actor-isolated realm.\n    // Pass primitive data to the actor instead of\n    // creating the object here and passing the object.\n    let actor = try await RealmActor()\n    try await actor.createTodo(name: \"Prepare fireworks for birthday party\", owner: \"Gandalf\", status: \"In Progress\")\n\n    // Later, get information off the actor-confined realm\n    let todoOwner = await actor.getTodoOwner(forTodoNamed: \"Prepare fireworks for birthday party\")\n}\n\n```\n\n#### Pass a Primary Key and Query for the Object on Another Actor\nIf you want to use a Realm object on another actor, you can share the\nprimary key and\nquery for it on the actor\nwhere you want to use it.\n\n```swift\n// Execute code on a specific actor - in this case, the @MainActor\n@MainActor\nfunc mainThreadFunction() async throws {\n    // Create an object off the main actor\n    func createObject(in actor: isolated BackgroundActor) async throws -> ObjectId {\n        let realm = try await Realm(actor: actor)\n        let newTodo = try await realm.asyncWrite {\n            return realm.create(Todo.self, value: [\n                \"name\": \"Pledge fealty and service to Gondor\",\n                \"owner\": \"Pippin\",\n                \"status\": \"In Progress\"\n            ])\n        }\n\n        // Share the todo's primary key so we can easily query for it on another actor\n        return newTodo._id\n    }\n\n    // Initialize an actor where you want to perform background work\n    let actor = BackgroundActor()\n    let newTodoId = try await createObject(in: actor)\n    let realm = try await Realm()\n    let todoOnMainActor = realm.object(ofType: Todo.self, forPrimaryKey: newTodoId)\n}\n\n```\n\n#### Create a Sendable Representation of Your Object\nIf you need to work with more than a simple value, but don't want the\noverhead of passing around `ThreadSafeReferences` or querying objects on\ndifferent actors, you can create a struct or other Sendable representation\nof your data to pass across the actor boundary.\n\nFor example, your actor might have a function that creates a struct\nrepresentation of the Realm object.\n\n```swift\nstruct TodoStruct {\n    var id: ObjectId\n    var name, owner, status: String\n}\n\nfunc getTodoAsStruct(forTodoNamed name: String) -> TodoStruct {\n    let todo = realm.objects(Todo.self).where {\n        $0.name == name\n    }.first!\n    return TodoStruct(id: todo._id, name: todo.name, owner: todo.owner, status: todo.status)\n}\n\n```\n\nThen, you can call a function to get the data as a struct on another actor.\n\n```swift\n@MainActor\nfunc mainThreadFunction() async throws {\n    // Create an object in an actor-isolated realm.\n    let actor = try await RealmActor()\n    try await actor.createTodo(name: \"Leave the ring on the mantle\", owner: \"Bilbo\", status: \"In Progress\")\n\n    // Get information as a struct or other Sendable type.\n    let todoAsStruct = await actor.getTodoAsStruct(forTodoNamed: \"Leave the ring on the mantle\")\n}\n\n```\n\n## Observe Notifications on a Different Actor\nYou can observe notifications on an actor-isolated realm using Swift's\nasync/await syntax.\n\nCalling `await object.observe(on: Actor)` or\n`await collection.observe(on: Actor)` registers a block to be called\neach time the object or collection changes.\n\nThe SDK asynchronously calls the block on the given actor's executor.\n\nFor write transactions performed on different threads or in different\nprocesses, the SDK calls the block when the realm is (auto)refreshed\nto a version including the changes. For local writes, the SDK calls the block\nat some point in the future after the write transaction is committed.\n\nLike other Realm notifications, you can\nonly observe objects or collections managed by a realm. You must retain the\nreturned token for as long as you want to watch for updates.\n\nIf you need to manually advance the state of an observed realm on the main\nthread or on another actor, call `await realm.asyncRefresh()`.\nThis updates the realm and outstanding objects managed by the Realm to point to\nthe most recent data and deliver any applicable notifications.\n\n### Observation Limitations\nYou *cannot* call the `.observe()` method:\n\n- During a write transaction\n- When the containing realm is read-only\n- On an actor-confined realm from outside the actor\n\n### Register a Collection Change Listener\nThe SDK calls a collection notification block after each write transaction which:\n\n- Deletes an object from the collection.\n- Inserts an object into the collection.\n- Modifies any of the managed properties of an object in the collection. This\nincludes self-assignments that set a property to its existing value.\n\n> Important:\n> In collection notification handlers, always apply changes\nin the following order: deletions, insertions, then\nmodifications. Handling insertions before deletions may\nresult in unexpected behavior.\n>\n\nThese notifications provide information about the actor on which the change\noccurred. Like non-actor-isolated collection notifications, they also provide\na `change` parameter that reports which objects are deleted, added, or\nmodified during the write transaction. This `RealmCollectionChange`\nresolves to an array of index paths that you can pass to a `UITableView`'s\nbatch update methods.\n\n```swift\n// Create a simple actor\nactor BackgroundActor {\n    public func deleteTodo(tsrToTodo tsr: ThreadSafeReference<Todo>) throws {\n        let realm = try! Realm()\n        try realm.write {\n            // Resolve the thread safe reference on the Actor where you want to use it.\n            // Then, do something with the object.\n            let todoOnActor = realm.resolve(tsr)\n            realm.delete(todoOnActor!)\n        }\n    }\n}\n\n// Execute some code on a different actor - in this case, the MainActor\n@MainActor\nfunc mainThreadFunction() async throws {\n    let backgroundActor = BackgroundActor()\n    let realm = try! await Realm()\n\n    // Create a todo item so there is something to observe\n    try await realm.asyncWrite {\n        realm.create(Todo.self, value: [\n            \"_id\": ObjectId.generate(),\n            \"name\": \"Arrive safely in Bree\",\n            \"owner\": \"Merry\",\n            \"status\": \"In Progress\"\n        ])\n    }\n\n    // Get the collection of todos on the current actor\n    let todoCollection = realm.objects(Todo.self)\n\n    // Register a notification token, providing the actor where you want to observe changes.\n    // This is only required if you want to observe on a different actor.\n    let token = await todoCollection.observe(on: backgroundActor, { actor, changes in\n        print(\"A change occurred on actor: \\(actor)\")\n        switch changes {\n        case .initial:\n            print(\"The initial value of the changed object was: \\(changes)\")\n        case .update(_, let deletions, let insertions, let modifications):\n            if !deletions.isEmpty {\n                print(\"An object was deleted: \\(changes)\")\n            } else if !insertions.isEmpty {\n                print(\"An object was inserted: \\(changes)\")\n            } else if !modifications.isEmpty {\n                print(\"An object was modified: \\(changes)\")\n            }\n        case .error(let error):\n            print(\"An error occurred: \\(error.localizedDescription)\")\n        }\n    })\n\n    // Update an object to trigger the notification.\n    // This example triggers a notification that the object is deleted.\n    // We can pass a thread-safe reference to an object to update it on a different actor.\n    let todo = todoCollection.where {\n        $0.name == \"Arrive safely in Bree\"\n    }.first!\n    let threadSafeReferenceToTodo = ThreadSafeReference(to: todo)\n    try await backgroundActor.deleteTodo(tsrToTodo: threadSafeReferenceToTodo)\n\n    // Invalidate the token when done observing\n    token.invalidate()\n}\n\n```\n\n### Register an Object Change Listener\nThe SDK calls an object notification block after each write transaction which:\n\n- Deletes the object.\n- Modifies any of the managed properties of the object. This includes\nself-assignments that set a property to its existing value.\n\nThe block is passed a copy of the object isolated to the requested actor,\nalong with information about what changed. This object can be safely used\non that actor.\n\nBy default, only direct changes to the object's properties produce notifications.\nChanges to linked objects do not produce notifications. If a non-nil, non-empty\nkeypath array is passed in, only changes to the properties identified by those\nkeypaths produce change notifications. The keypaths may traverse link\nproperties to receive information about changes to linked objects.\n\n```swift\n// Execute some code on a specific actor - in this case, the MainActor\n@MainActor\nfunc mainThreadFunction() async throws {\n    // Initialize an instance of another actor\n    // where you want to do background work\n    let backgroundActor = BackgroundActor()\n\n    // Create a todo item so there is something to observe\n    let realm = try! await Realm()\n    let scourTheShire = try await realm.asyncWrite {\n        return realm.create(Todo.self, value: [\n            \"_id\": ObjectId.generate(),\n            \"name\": \"Scour the Shire\",\n            \"owner\": \"Merry\",\n            \"status\": \"In Progress\"\n        ])\n    }\n\n    // Register a notification token, providing the actor\n    let token = await scourTheShire.observe(on: backgroundActor, { actor, change in\n        print(\"A change occurred on actor: \\(actor)\")\n        switch change {\n        case .change(let object, let properties):\n            for property in properties {\n                print(\"Property '\\(property.name)' of object \\(object) changed to '\\(property.newValue!)'\")\n            }\n        case .error(let error):\n            print(\"An error occurred: \\(error)\")\n        case .deleted:\n            print(\"The object was deleted.\")\n        }\n    })\n\n    // Update the object to trigger the notification.\n    // This triggers a notification that the object's `status` property has been changed.\n    try await realm.asyncWrite {\n        scourTheShire.status = \"Complete\"\n    }\n\n    // Invalidate the token when done observing\n    token.invalidate()\n}\n\n```\n"
  },
  {
    "path": "docs/guides/xcode-playgrounds.md",
    "content": "# Use Realm in Xcode Playgrounds\n## Prerequisites\nYou can only use Swift packages within Xcode projects that have at least one\nscheme and target. To use Realm in Xcode Playgrounds, you must first have\nan Xcode project where you have Installed the Swift SDK.\n\n## Create a Playground\n\nWithin a project, go to File > New > Playground. Select the type of\nPlayground you want. For this example, we've used a Blank iOS\nPlayground.\n\nName and save the playground in the root of your\nproject. Be sure to add it to the project.\n\nYou should see your new Playground in your Project navigator.\n\n## Import Realm\nAdd the following import statement to use Realm in the playground:\n\n```swift\nimport RealmSwift\n\n```\n\n## Experiment with Realm\nExperiment with Realm. For this example, we'll:\n\n- Define a new Realm object type\n- Create a new object of that type and write it to realm\n- Query objects of the type, and filter them\n\n```swift\nclass Drink: Object {\n    @Persisted var name = \"\"\n    @Persisted var rating = 0\n    @Persisted var source = \"\"\n    @Persisted var drinkType = \"\"\n}\n\nlet drink = Drink(value: [\"name\": \"Los Cabellos\", \"rating\": 10, \"source\": \"AeroPress\", \"drinkType\": \"Coffee\"])\n\nlet realm = try! Realm(configuration: config)\n\ntry! realm.write {\n    realm.add(drink)\n}\n\nlet drinks = realm.objects(Drink.self)\n\nlet coffeeDrinks = drinks.where {\n    $0.drinkType == \"Coffee\"\n}\n\nprint(coffeeDrinks.first?.name)\n```\n\n## Managing the Realm File in Your Playground\nWhen you work with a default realm\nin a Playground, you might run into a situation where you need to delete the\nrealm. For example, if you are experimenting with an object type and add\nproperties to the object, you may get an error that you must migrate the\nrealm.\n\nYou can specify `Realm.configuration` details to open the file at a specific\npath, and delete the realm if it exists at the path.\n\n```swift\nvar config = Realm.Configuration()\n\nconfig.fileURL!.deleteLastPathComponent()\nconfig.fileURL!.appendPathComponent(\"playgroundRealm\")\nconfig.fileURL!.appendPathExtension(\"realm\")\n\nif Realm.fileExists(for: config) {\n    try Realm.deleteFiles(for: config)\n    print(\"Successfully deleted existing realm at path: \\(config.fileURL!)\")\n} else {\n    print(\"No file currently exists at path\")\n}\n```\n\nAlternately, you can open the realm in-memory only, or use the\n`deleteRealmIfMigrationNeeded`\nmethod to automatically delete a realm when migration is needed.\n"
  },
  {
    "path": "docs/install.md",
    "content": "# Install the SDK for iOS, macOS, tvOS, and watchOS\n## Overview\nRealm SDK for Swift enables you to build iOS, macOS, tvOS,\nand watchOS applications using either the Swift or Objective-C programming\nlanguages. This page details how to install the SDK in your project and get\nstarted.\n\n## Prerequisites\nBefore getting started, ensure your development environment\nmeets the following prerequisites:\n\n- Your project uses an Xcode version and minimum OS version listed in the\nOS Support section of this page.\n- Reflection is enabled in your project. The Swift SDK uses reflection to\ndetermine your model's properties. Your project must not set\n`SWIFT_REFLECTION_METADATA_LEVEL = none`, or the SDK cannot see properties\nin your model. Reflection is enabled by default if your project does\nnot specifically set a level for this setting.\n\n## Installation\nYou can use `SwiftPM`, `CocoaPods`, or `Carthage` to add the\nSwift SDK to your project.\n\n> Tip:\n> The SDK uses Realm Core database for device data persistence. When you\ninstall the Swift SDK, the package names reflect Realm naming.\n>\n\n#### Swiftpm\n\n##### Add Package Dependency\nIn Xcode, select `File` > `Add Packages...`.\n\n##### Specify the Repository\nCopy and paste the following into the search/input box.\n\n```sh\nhttps://github.com/realm/realm-swift.git\n```\n\n##### Specify Options\nIn the options for the `realm-swift` package, we recommend setting\nthe `Dependency Rule` to `Up to Next Major Version`,\nand enter the [current Realm Swift SDK version](https://github.com/realm/realm-swift/releases) . Then, click `Add Package`.\n\n##### Select the Package Products\n> Version changed: 10.49.3\n> Instead of adding both, only add one package.\n>\n\nSelect either `RealmSwift` or `Realm`, then click `Add Package`.\n\n- If you use Swift or Swift and Objective-C APIs, add `RealmSwift`.\n- If you use *only* Objective-C APIs, add `Realm`.\n\n##### (Optional) Build RealmSwift as a Dynamic Framework\nTo use the Privacy Manifest supplied by the SDK, build `RealmSwift`\nas a dynamic framework. If you build `RealmSwift` as a static\nframework, you must supply your own Privacy Manifest.\n\nTo build `RealmSwift` as a dynamic framework:\n\n1. In your project Targets, select your build target.\n2. Go to the General tab.\n3. Expand the Frameworks and Libraries element.\n4. For the `RealmSwift` framework, change the\nEmbed option from \"Do Not Embed\" to \"Embed & Sign.\"\n\nNow, Xcode builds `RealmSwift` dynamically, and can provide the\nSDK-supplied Privacy Manifest.\n\n#### Cocoapods\n\nIf you are installing with [CocoaPods](https://guides.cocoapods.org/using/getting-started.html), you need CocoaPods 1.10.1 or later.\n\n##### Update the CocoaPods repositories\nOn the command line, run `pod repo update` to ensure\nCocoaPods can access the latest available Realm versions.\n\n##### Initialize CocoaPods for Your Project\nIf you do not already have a Podfile for your project,\nrun `pod init` in the root directory of your project to\ncreate a Podfile for your project. A Podfile allows you\nto specify project dependencies to CocoaPods.\n\n##### Add the SDK as a Dependency in Your Podfile\n#### Objective-C\n\nAdd the line `pod 'Realm', '~>10'` to your main and test\ntargets.\n\nAdd the line `use_frameworks!` as well if it is not\nalready there.\n\nWhen done, your Podfile should look something like this:\n\n```text\n# Uncomment the next line to define a global platform for your project\n# platform :ios, '11.0'\n\ntarget 'MyDeviceSDKProject' do\n# Comment the next line if you don't want to use dynamic frameworks\nuse_frameworks!\n\n# Pods for MyDeviceSDKProject\npod 'Realm', '~>10'\n\ntarget 'MyRealmProjectTests' do\n   inherit! :search_paths\n   # Pods for testing\n   pod 'Realm', '~>10'\nend\n\nend\n```\n\n#### Swift\n\nAdd the line `use_frameworks!` if it is not\nalready there.\n\nAdd the line `pod 'RealmSwift', '~>10'` to your main and test\ntargets.\n\nWhen done, your Podfile should look something like this:\n\n```text\nplatform :ios, '12.0'\n\ntarget 'MyDeviceSDKProject' do\n  # Comment the next line if you don't want to use dynamic frameworks\n  use_frameworks!\n\n  # Pods for MyDeviceSDKProject\n  pod 'RealmSwift', '~>10'\n\nend\n```\n\n##### Install the Dependencies\nFrom the command line, run `pod install` to fetch the\ndependencies.\n\n###### Use the CocoaPods-Generated  File\n\n##### Use the CocoaPods-Generated .xcworkspace File\nCocoaPods generates an `.xcworkspace` file for you. This\nfile has all of the dependencies configured. From now on,\nopen this file -- not the `.xcodeproj` file -- to work\non your project.\n\n#### Carthage\n\nIf you are installing with [Carthage](https://github.com/Carthage/Carthage#installing-carthage), you need Carthage 0.33 or later.\n\n##### Add the SDK as a Dependency in Your Cartfile\nAdd the SDK as a dependency by appending the line `github\n\"realm/realm-swift\"` to your Cartfile.\n\nYou can create a Cartfile or append to an existing one by\nrunning the following command in your project directory:\n\n```bash\necho 'github \"realm/realm-swift\"' >> Cartfile\n```\n\n##### Install the Dependencies\nFrom the command line, run `carthage update --use-xcframeworks`\nto fetch the dependencies.\n\n##### Add the Frameworks to Your Project\nCarthage places the built dependencies in the `Carthage/Build`\ndirectory.\n\nOpen your project's `xcodeproj` file in Xcode. Go to\nthe Project Navigator panel and click your application\nname to open the project settings editor. Select the\nGeneral tab.\n\nIn Finder, open the `Carthage/Build/` directory. Drag the\n`RealmSwift.xcframework` and `Realm.xcframework` files\nfound in that directory to the Frameworks,\nLibraries, and Embedded Content section of your\nproject's General settings.\n\n#### Dynamic Framework\n\n##### Download and Extract the Framework\nDownload the [latest release of the Swift SDK](https://github.com/realm/realm-swift/releases) and extract the zip.\n\n##### Copy Framework(s) Into Your Project\nDrag `Realm.xcframework` and `RealmSwift.xcframework` (if using)\nto the File Navigator of your Xcode project. Select the\nCopy items if needed checkbox and press Finish.\n\n> Tip:\n> If using the Objective-C API within a Swift project, we\nrecommend you include both Realm Swift and Realm Objective-C in your\nproject. Within your Swift files, you can access the Swift API and\nall required wrappers. Using the RealmSwift API in mixed\nSwift/Objective-C projects is possible because the vast majority of\nRealmSwift types are directly aliased from their Objective-C\ncounterparts.\n>\n\n## Import the SDK\n> Tip:\n> The SDK uses Realm Core database for device data persistence. When you\nimport the Swift SDK, the package names reflect Realm naming.\n>\n\nAdd the following line at the top of your source files to use the SDK:\n\n#### Objective-C\n\n```objectivec\n#include <Realm/Realm.h>\n\n```\n\n#### Swift\n\n```swift\nimport RealmSwift\n\n```\n\n## App Download File Size\nThe SDK should only add around 5 to 8 MB to your app's download\nsize. The releases we distribute are significantly larger because they\ninclude support for the iOS, watchOS and tvOS simulators, some debug symbols,\nand bitcode, all of which are stripped by the App Store automatically when\napps are downloaded.\n\n## Troubleshooting\nIf you have build issues after using one of these methods to install\nthe SDK, see our troubleshooting guidelines\nfor information about resolving those issues.\n\n## OS Support\n> Important:\n> There are special considerations when using the SDK with\ntvOS. See Build for tvOS for more information.\n>\n\n### Xcode 15\n> Version changed: 10.50.0\n> Minimum required Xcode version is 15.1\n>\n\n|Supported OS|Realm|\n| --- | --- |\n|iOS 12.0+|X|\n|macOS 10.14+|X|\n|tvOS 12.0+|X|\n|watchOS 4.0+|X|\n|visionOS 1.0+|X|\n\n### Xcode 14\n> Version changed: 10.50.0\n> Removed support for Xcode 14.\n>\n\nSwift SDK version 10.50.0 drops support for Xcode 14. For v10.49.3 and earlier,\nthese Xcode 14 requirements apply:\n\n- [Xcode](https://developer.apple.com/xcode/) version 14.1 or higher.\n- When using Xcode 14, a target of iOS 11.0 or higher, macOS 10.13 or higher, tvOS 11.0 or higher, or watchOS 4.0 or higher.\n\n## Swift Concurrency Support\nThe Swift SDK supports Swift's concurrency-related language features.\nFor best practices on using the Swift SDK's concurrency features, refer\nto the documentation below.\n\n### Async/Await Support\nStarting with Realm Swift SDK Versions 10.15.0 and 10.16.0, many of the\nRealm APIs support the Swift async/await syntax. Projects must\nmeet these requirements:\n\n|Swift SDK Version|Swift Version Requirement|Supported OS|\n| --- | --- | --- |\n|10.25.0|Swift 5.6|iOS 13.x|\n|10.15.0 or 10.16.0|Swift 5.5|iOS 15.x|\n\nIf your app accesses Realm in an `async/await` context, mark the code\nwith `@MainActor` to avoid threading-related crashes.\n\nFor more information about async/await support in the Swift SDK, refer\nto Swift Concurrency: Async/Await APIs.\n\n### Actor Support\nThe Swift SDK supports actor-isolated realm instances. For more information,\nrefer to Use Realm with Actors - Swift SDK.\n\n## Apple Privacy Manifest\n> Version changed: 10.49.3\n> Build RealmSwift as a dynamic framework to include the Privacy Manifest.\n>\n\nApple requires apps that use `RealmSwift` to provide a privacy manifest\ncontaining details about the SDK's data collection and use practices. The\nbundled manifest file must be included when submitting new apps or app updates\nto the App Store. For more details about Apple's requirements, refer to\n[Upcoming third-party SDK requirements](https://developer.apple.com/support/third-party-SDK-requirements/)\non the Apple Developer website.\n\nStarting in Swift SDK version 10.46.0, the SDK ships with privacy manifests\nfor `Realm` and `RealmSwift`. Each package contains its own privacy manifest\nwith Apple's required API disclosures and the reasons for using those APIs.\n\nYou can view the privacy manifests in each package, or in the `realm-swift`\nGitHub repository:\n\n- `Realm`: [https://github.com/realm/realm-swift/blob/master/Realm/PrivacyInfo.xcprivacy](https://github.com/realm/realm-swift/blob/master/Realm/PrivacyInfo.xcprivacy)\n- `RealmSwift`: [https://github.com/realm/realm-swift/blob/master/RealmSwift/PrivacyInfo.xcprivacy](https://github.com/realm/realm-swift/blob/master/RealmSwift/PrivacyInfo.xcprivacy)\n\nTo include these manifests in a build target that uses `RealmSwift`, you must\nbuild `RealmSwift` as a dynamic framework. For details, refer to the Swift\nPackage Manager Installation instructions step\n**(Optional) Build RealmSwift as a Dynamic Framework**.\n\nThe Swift SDK does not include analytics code in builds for the App Store.\n\nYou may need to add additional disclosures to your app's privacy manifest\ndetailing your data collection and use practices when using these APIs.\n\nFor more information, refer to Apple's\n[Privacy manifest files documentation](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files).\n"
  },
  {
    "path": "examples/README.md",
    "content": "# Realm Examples\n\nIncluded in this folder are sample iOS/OSX apps using Realm.\n\n## iOS (Objective-C)\n\nThe following examples are located in the `ios/objc/RealmExamples.xcodeproj` project:\n\n### Simple\n\nThis app covers several introductory concepts about Realm. Without any UI distractions, just a little console output.\n\n### TableView\n\nThis app demonstrates how Realm can be the data source for UITableViews.\n\nYou can add rows by tapping the add button and remove rows by swiping right-to-left.\n\nThe application also demonstrates how to import data in a background thread.\n\n### GroupedTableView\n\nA sample app to demonstrate how to use Realm to populate a table view with sections.\n\n### Migration\n\nThis example showcases Realm's migration features.\n\n### REST\n\nUsing data from FourSquare, this example demonstrates how to populate a Realm with external json data.\n\n### Encryption\n\nThis simple app shows how to use an encrypted realm.\n\n### Backlink\n\nThis simple app demonstrates how to define models with inverse relationships using `-linkingObjectsOfClass:forProperty:`.\n\n#### Installation Instructions\n\n1. [Download the macOS version](https://realm.io/docs/realm-mobile-platform/get-started/) of the Realm Mobile Platform.\n2. Run a local instance of the Realm Mobile Platform.\n3. Open the Realm Object Server Dashboard in your browser by visiting 'http://localhost:9080'.\n4. Create a user account with the email 'demo@realm.io' and the password 'password'.\n5. Build the Draw app and deploy it to iOS devices on the same network as your Mac.\n\n## iOS (Swift)\n\nIn the `ios/swift/RealmExamples.xcodeproj` project, you will find the following examples:\n\n### GettingStarted.playground\n\nThis is a Swift Playground that goes over a few Realm basics.\n\n### Simple\n\nThis app covers several introductory concepts about Realm. Without any UI distractions, just a little console output.\n\n### TableView\n\nThis app demonstrates how Realm can be the data source for UITableViews.\n\nYou can add rows by tapping the add button and remove rows by swiping right-to-left.\n\nThe application also demonstrates how to import data in a background thread.\n\n### GroupedTableView\n\nA sample app to demonstrate how to use Realm to populate a table view with sections.\n\n### Migration\n\nThis example showcases Realm's migration features.\n\n### Encryption\n\nThis simple app shows how to use an encrypted realm.\n\n### Backlink\n\nThis simple app demonstrates how to define models with inverse relationships using `linkingObjectsOfClass(_:forProperty:)`.\n\n### Projections\n\nThis app demonstrates how to define Projection on Realm Object and how to use it in SwiftUI application.\n\n### AppClip / AppClipParent\n\nThese two targets demonstrate how to use Realm to persist data between an App Clip and its parent.\n\n#### Example Usage\n\nFor the purpose of this example, the app clip invocation and parent application download is simulated by running each target.\n\nFor more information on complete App Clip flow see: [Responding to invocations](https://developer.apple.com/documentation/app_clips/responding_to_invocations) and [Launch Experience](https://developer.apple.com/documentation/app_clips/testing_your_app_clip_s_launch_experience).\n\n![alt text](https://github.com/realm/realm-swift/blob/em/appclip_ex/examples/ios/swift/AppClip/appclip_ex.gif?raw=true)\n\n**Note:** When testing App Group Entitlements on MacOS (including the iOS simulator), `containerURL(forSecurityApplicationGroupIdentifier:)` will always return the shared directory URL, even when the group identifier is invalid.  Be sure to test on physical devices with non-simulated iOS for expected security behavior. See [Return Value](https://developer.apple.com/documentation/foundation/filemanager/1412643-containerurl).\n\n\n\n## OSX (Objective-C)\n\nIn the `osx/objc/RealmExamples.xcodeproj` project, you will find the following examples:\n\n### JSONImport\n\nThis is a small OS X command-line program which demonstrates how to import data from JSON into a Realm.\n\nOpen the project in Xcode, and press \"Run\" to build and run the program. It will write output to the console.\n\n## Installation Examples\n\nThe `installation/` directory contains example Xcode projects demonstrating how\nto install Realm Objective-C and Realm Swift from all available methods defined\nin <https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/install/#install-realm-for-ios--macos--tvos--and-watchos>.\n\n## tvOS (Objective-C)\n\n### DownloadCache\n\nA tvOS app that demonstrates how to use Realm to store data and display data from a REST API.\n\n### PreloadedData\n\nA tvOS app that demonstrates how to use a Realm file included in your app bundle.\n\n## tvOS (Swift)\n\n### DownloadCache\n\nA tvOS app that demonstrates how to use Realm to store data and display data from a REST API.\n\n### PreloadedData\n\nA tvOS app that demonstrates how to use a Realm file included in your app bundle.\n"
  },
  {
    "path": "examples/installation/.gitignore",
    "content": "Podfile.lock\nPods/\nrealm-objc-latest\nrealm-swift-latest\nCocoaPodsExample.xcworkspace\nCocoaPodsDynamicExample.xcworkspace\nCartfile.resolved\nSwiftPackageManager.xcodeproj\nSwiftPackageManagerDynamic.xcodeproj\n"
  },
  {
    "path": "examples/installation/Carthage.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 56;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t3F938BA62A4E1886002356FE /* RealmSwift.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F938BA42A4E1886002356FE /* RealmSwift.xcframework */; };\n\t\t3F938BA72A4E1886002356FE /* RealmSwift.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3F938BA42A4E1886002356FE /* RealmSwift.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t3F938BA82A4E1886002356FE /* Realm.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F938BA52A4E1886002356FE /* Realm.xcframework */; };\n\t\t3F938BA92A4E1886002356FE /* Realm.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3F938BA52A4E1886002356FE /* Realm.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t3FEC917F2A4D41250044BFF5 /* SwiftExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FEC91692A4D3B140044BFF5 /* SwiftExampleApp.swift */; };\n\t\t3FEC91822A4D41250044BFF5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3FEC916D2A4D3B150044BFF5 /* Assets.xcassets */; };\n\t\t3FEC91832A4D41250044BFF5 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3FEC91712A4D3B150044BFF5 /* Preview Assets.xcassets */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXCopyFilesBuildPhase section */\n\t\t3F938BAA2A4E1886002356FE /* Embed Frameworks */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\t3F938BA72A4E1886002356FE /* RealmSwift.xcframework in Embed Frameworks */,\n\t\t\t\t3F938BA92A4E1886002356FE /* Realm.xcframework in Embed Frameworks */,\n\t\t\t);\n\t\t\tname = \"Embed Frameworks\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXCopyFilesBuildPhase section */\n\n/* Begin PBXFileReference section */\n\t\t3F938BA42A4E1886002356FE /* RealmSwift.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = RealmSwift.xcframework; path = Carthage/Build/RealmSwift.xcframework; sourceTree = \"<group>\"; };\n\t\t3F938BA52A4E1886002356FE /* Realm.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Realm.xcframework; path = Carthage/Build/Realm.xcframework; sourceTree = \"<group>\"; };\n\t\t3FEC91692A4D3B140044BFF5 /* SwiftExampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftExampleApp.swift; sourceTree = \"<group>\"; };\n\t\t3FEC916D2A4D3B150044BFF5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \"<group>\"; };\n\t\t3FEC916F2A4D3B150044BFF5 /* SwiftExample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SwiftExample.entitlements; sourceTree = \"<group>\"; };\n\t\t3FEC91712A4D3B150044BFF5 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = \"Preview Assets.xcassets\"; sourceTree = \"<group>\"; };\n\t\t3FEC91872A4D41250044BFF5 /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t3FEC91802A4D41250044BFF5 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3F938BA62A4E1886002356FE /* RealmSwift.xcframework in Frameworks */,\n\t\t\t\t3F938BA82A4E1886002356FE /* Realm.xcframework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t3F938BA32A4E1886002356FE /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3F938BA52A4E1886002356FE /* Realm.xcframework */,\n\t\t\t\t3F938BA42A4E1886002356FE /* RealmSwift.xcframework */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3FEC915D2A4D3B140044BFF5 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FEC91682A4D3B140044BFF5 /* Source */,\n\t\t\t\t3FEC91672A4D3B140044BFF5 /* Products */,\n\t\t\t\t3F938BA32A4E1886002356FE /* Frameworks */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3FEC91672A4D3B140044BFF5 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FEC91872A4D41250044BFF5 /* App.app */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3FEC91682A4D3B140044BFF5 /* Source */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FEC91702A4D3B150044BFF5 /* Preview Content */,\n\t\t\t\t3FEC916D2A4D3B150044BFF5 /* Assets.xcassets */,\n\t\t\t\t3FEC916F2A4D3B150044BFF5 /* SwiftExample.entitlements */,\n\t\t\t\t3FEC91692A4D3B140044BFF5 /* SwiftExampleApp.swift */,\n\t\t\t);\n\t\t\tpath = Source;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3FEC91702A4D3B150044BFF5 /* Preview Content */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FEC91712A4D3B150044BFF5 /* Preview Assets.xcassets */,\n\t\t\t);\n\t\t\tpath = \"Preview Content\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXNativeTarget section */\n\t\t3FEC917D2A4D41250044BFF5 /* App */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 3FEC91842A4D41250044BFF5 /* Build configuration list for PBXNativeTarget \"App\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t3FEC917E2A4D41250044BFF5 /* Sources */,\n\t\t\t\t3FEC91802A4D41250044BFF5 /* Frameworks */,\n\t\t\t\t3FEC91812A4D41250044BFF5 /* Resources */,\n\t\t\t\t3F938BAA2A4E1886002356FE /* Embed Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = App;\n\t\t\tproductName = SwiftPM;\n\t\t\tproductReference = 3FEC91872A4D41250044BFF5 /* App.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t3FEC915E2A4D3B140044BFF5 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tBuildIndependentTargetsInParallel = 1;\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 3FEC91612A4D3B140044BFF5 /* Build configuration list for PBXProject \"Carthage\" */;\n\t\t\tcompatibilityVersion = \"Xcode 14.0\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t\tBase,\n\t\t\t);\n\t\t\tmainGroup = 3FEC915D2A4D3B140044BFF5;\n\t\t\tproductRefGroup = 3FEC91672A4D3B140044BFF5 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t3FEC917D2A4D41250044BFF5 /* App */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t3FEC91812A4D41250044BFF5 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FEC91822A4D41250044BFF5 /* Assets.xcassets in Resources */,\n\t\t\t\t3FEC91832A4D41250044BFF5 /* Preview Assets.xcassets in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t3FEC917E2A4D41250044BFF5 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FEC917F2A4D41250044BFF5 /* SwiftExampleApp.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t3FEC91732A4D3B150044BFF5 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++20\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tENABLE_USER_SCRIPT_SANDBOXING = NO;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu17;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tLOCALIZATION_PREFERS_STRING_CATALOGS = YES;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"DEBUG $(inherited)\";\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t3FEC91742A4D3B150044BFF5 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++20\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_USER_SCRIPT_SANDBOXING = NO;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu17;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tLOCALIZATION_PREFERS_STRING_CATALOGS = YES;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t3FEC91852A4D41250044BFF5 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = Source/SwiftExample.entitlements;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEVELOPMENT_ASSET_PATHS = \"\\\"Source/Preview Content\\\"\";\n\t\t\t\tENABLE_PREVIEWS = YES;\n\t\t\t\tGENERATE_INFOPLIST_FILE = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]\" = UIStatusBarStyleDefault;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]\" = UIStatusBarStyleDefault;\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = \"UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = \"UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 17.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\";\n\t\t\t\t\"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]\" = \"@executable_path/../Frameworks\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 13.4;\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.Realm.App;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = auto;\n\t\t\t\tSUPPORTED_PLATFORMS = \"appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator watchos watchsimulator\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t\tSUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSWIFT_EMIT_LOC_STRINGS = YES;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2,3,4,6,7\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t3FEC91862A4D41250044BFF5 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = Source/SwiftExample.entitlements;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEVELOPMENT_ASSET_PATHS = \"\\\"Source/Preview Content\\\"\";\n\t\t\t\tENABLE_PREVIEWS = YES;\n\t\t\t\tGENERATE_INFOPLIST_FILE = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]\" = UIStatusBarStyleDefault;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]\" = UIStatusBarStyleDefault;\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = \"UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = \"UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 17.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\";\n\t\t\t\t\"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]\" = \"@executable_path/../Frameworks\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 13.4;\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.Realm.App;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = auto;\n\t\t\t\tSUPPORTED_PLATFORMS = \"appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator watchos watchsimulator\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t\tSUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSWIFT_EMIT_LOC_STRINGS = YES;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2,3,4,5,6,7\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t3FEC91612A4D3B140044BFF5 /* Build configuration list for PBXProject \"Carthage\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t3FEC91732A4D3B150044BFF5 /* Debug */,\n\t\t\t\t3FEC91742A4D3B150044BFF5 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t3FEC91842A4D41250044BFF5 /* Build configuration list for PBXNativeTarget \"App\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t3FEC91852A4D41250044BFF5 /* Debug */,\n\t\t\t\t3FEC91862A4D41250044BFF5 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 3FEC915E2A4D3B140044BFF5 /* Project object */;\n}\n"
  },
  {
    "path": "examples/installation/CocoaPods.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 56;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t3FEC917F2A4D41250044BFF5 /* SwiftExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FEC91692A4D3B140044BFF5 /* SwiftExampleApp.swift */; };\n\t\t3FEC91822A4D41250044BFF5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3FEC916D2A4D3B150044BFF5 /* Assets.xcassets */; };\n\t\t3FEC91832A4D41250044BFF5 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3FEC91712A4D3B150044BFF5 /* Preview Assets.xcassets */; };\n\t\tE314772E6D33E037E705FDBB /* Pods_App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25EBEF352D634D7820A0E2BF /* Pods_App.framework */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t012DB6ABD37FF9723F260762 /* Pods-App.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-App.release.xcconfig\"; path = \"Target Support Files/Pods-App/Pods-App.release.xcconfig\"; sourceTree = \"<group>\"; };\n\t\t25EBEF352D634D7820A0E2BF /* Pods_App.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_App.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t30696D5AF3299BB30E01E6B6 /* Pods-macOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-macOS.debug.xcconfig\"; path = \"Target Support Files/Pods-macOS/Pods-macOS.debug.xcconfig\"; sourceTree = \"<group>\"; };\n\t\t3FEC91692A4D3B140044BFF5 /* SwiftExampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftExampleApp.swift; sourceTree = \"<group>\"; };\n\t\t3FEC916D2A4D3B150044BFF5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \"<group>\"; };\n\t\t3FEC916F2A4D3B150044BFF5 /* SwiftExample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SwiftExample.entitlements; sourceTree = \"<group>\"; };\n\t\t3FEC91712A4D3B150044BFF5 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = \"Preview Assets.xcassets\"; sourceTree = \"<group>\"; };\n\t\t3FEC91872A4D41250044BFF5 /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t45A2DE050EFA4D7BE8D8D682 /* Pods-watchOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-watchOS.release.xcconfig\"; path = \"Target Support Files/Pods-watchOS/Pods-watchOS.release.xcconfig\"; sourceTree = \"<group>\"; };\n\t\t47A9606E545D1C71F51747F9 /* libPods-macOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = \"libPods-macOS.a\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t551C4089A220B7CAC99DE535 /* Pods-App.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-App.debug.xcconfig\"; path = \"Target Support Files/Pods-App/Pods-App.debug.xcconfig\"; sourceTree = \"<group>\"; };\n\t\t611B5C3940ABD898BBC1347B /* Pods-watchOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-watchOS.debug.xcconfig\"; path = \"Target Support Files/Pods-watchOS/Pods-watchOS.debug.xcconfig\"; sourceTree = \"<group>\"; };\n\t\t6AF03745C896A33FEB088C17 /* Pods-tvOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-tvOS.release.xcconfig\"; path = \"Target Support Files/Pods-tvOS/Pods-tvOS.release.xcconfig\"; sourceTree = \"<group>\"; };\n\t\t83F10638D6B5E68A2535A6B6 /* Pods-iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-iOS.debug.xcconfig\"; path = \"Target Support Files/Pods-iOS/Pods-iOS.debug.xcconfig\"; sourceTree = \"<group>\"; };\n\t\t84848F925DE3E6A4D8A1D337 /* Pods-iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-iOS.release.xcconfig\"; path = \"Target Support Files/Pods-iOS/Pods-iOS.release.xcconfig\"; sourceTree = \"<group>\"; };\n\t\tA4D891FC83CF283E80C98471 /* libPods-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = \"libPods-tvOS.a\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tB34B12B11F827A5F60187F42 /* libPods-watchOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = \"libPods-watchOS.a\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tBF77A6DAF403942F6695ADFE /* Pods-tvOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-tvOS.debug.xcconfig\"; path = \"Target Support Files/Pods-tvOS/Pods-tvOS.debug.xcconfig\"; sourceTree = \"<group>\"; };\n\t\tF8A8C4CE362469BBBBACF8B7 /* Pods-macOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-macOS.release.xcconfig\"; path = \"Target Support Files/Pods-macOS/Pods-macOS.release.xcconfig\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t3FEC91802A4D41250044BFF5 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE314772E6D33E037E705FDBB /* Pods_App.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t3FEC915D2A4D3B140044BFF5 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FEC91682A4D3B140044BFF5 /* Source */,\n\t\t\t\t3FEC91672A4D3B140044BFF5 /* Products */,\n\t\t\t\t926A319CC8B885CD63E21B9E /* Pods */,\n\t\t\t\t9BFD37A5E01011406A863C9A /* Frameworks */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3FEC91672A4D3B140044BFF5 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FEC91872A4D41250044BFF5 /* App.app */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3FEC91682A4D3B140044BFF5 /* Source */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FEC91702A4D3B150044BFF5 /* Preview Content */,\n\t\t\t\t3FEC916D2A4D3B150044BFF5 /* Assets.xcassets */,\n\t\t\t\t3FEC916F2A4D3B150044BFF5 /* SwiftExample.entitlements */,\n\t\t\t\t3FEC91692A4D3B140044BFF5 /* SwiftExampleApp.swift */,\n\t\t\t);\n\t\t\tpath = Source;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3FEC91702A4D3B150044BFF5 /* Preview Content */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FEC91712A4D3B150044BFF5 /* Preview Assets.xcassets */,\n\t\t\t);\n\t\t\tpath = \"Preview Content\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t926A319CC8B885CD63E21B9E /* Pods */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t83F10638D6B5E68A2535A6B6 /* Pods-iOS.debug.xcconfig */,\n\t\t\t\t84848F925DE3E6A4D8A1D337 /* Pods-iOS.release.xcconfig */,\n\t\t\t\t30696D5AF3299BB30E01E6B6 /* Pods-macOS.debug.xcconfig */,\n\t\t\t\tF8A8C4CE362469BBBBACF8B7 /* Pods-macOS.release.xcconfig */,\n\t\t\t\tBF77A6DAF403942F6695ADFE /* Pods-tvOS.debug.xcconfig */,\n\t\t\t\t6AF03745C896A33FEB088C17 /* Pods-tvOS.release.xcconfig */,\n\t\t\t\t611B5C3940ABD898BBC1347B /* Pods-watchOS.debug.xcconfig */,\n\t\t\t\t45A2DE050EFA4D7BE8D8D682 /* Pods-watchOS.release.xcconfig */,\n\t\t\t\t551C4089A220B7CAC99DE535 /* Pods-App.debug.xcconfig */,\n\t\t\t\t012DB6ABD37FF9723F260762 /* Pods-App.release.xcconfig */,\n\t\t\t);\n\t\t\tpath = Pods;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t9BFD37A5E01011406A863C9A /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t47A9606E545D1C71F51747F9 /* libPods-macOS.a */,\n\t\t\t\tA4D891FC83CF283E80C98471 /* libPods-tvOS.a */,\n\t\t\t\tB34B12B11F827A5F60187F42 /* libPods-watchOS.a */,\n\t\t\t\t25EBEF352D634D7820A0E2BF /* Pods_App.framework */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXNativeTarget section */\n\t\t3FEC917D2A4D41250044BFF5 /* App */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 3FEC91842A4D41250044BFF5 /* Build configuration list for PBXNativeTarget \"App\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tB56F1236CC1F04E652F44D86 /* [CP] Check Pods Manifest.lock */,\n\t\t\t\t3FEC917E2A4D41250044BFF5 /* Sources */,\n\t\t\t\t3FEC91802A4D41250044BFF5 /* Frameworks */,\n\t\t\t\t3FEC91812A4D41250044BFF5 /* Resources */,\n\t\t\t\t3653D19BAAE97F1AB839AD70 /* [CP] Embed Pods Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = App;\n\t\t\tproductName = SwiftPM;\n\t\t\tproductReference = 3FEC91872A4D41250044BFF5 /* App.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t3FEC915E2A4D3B140044BFF5 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tBuildIndependentTargetsInParallel = 1;\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 3FEC91612A4D3B140044BFF5 /* Build configuration list for PBXProject \"CocoaPods\" */;\n\t\t\tcompatibilityVersion = \"Xcode 14.0\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t\tBase,\n\t\t\t);\n\t\t\tmainGroup = 3FEC915D2A4D3B140044BFF5;\n\t\t\tproductRefGroup = 3FEC91672A4D3B140044BFF5 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t3FEC917D2A4D41250044BFF5 /* App */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t3FEC91812A4D41250044BFF5 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FEC91822A4D41250044BFF5 /* Assets.xcassets in Resources */,\n\t\t\t\t3FEC91832A4D41250044BFF5 /* Preview Assets.xcassets in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXShellScriptBuildPhase section */\n\t\t3653D19BAAE97F1AB839AD70 /* [CP] Embed Pods Frameworks */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputFileListPaths = (\n\t\t\t\t\"${PODS_ROOT}/Target Support Files/Pods-App/Pods-App-frameworks-${CONFIGURATION}-input-files.xcfilelist\",\n\t\t\t);\n\t\t\tname = \"[CP] Embed Pods Frameworks\";\n\t\t\toutputFileListPaths = (\n\t\t\t\t\"${PODS_ROOT}/Target Support Files/Pods-App/Pods-App-frameworks-${CONFIGURATION}-output-files.xcfilelist\",\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"\\\"${PODS_ROOT}/Target Support Files/Pods-App/Pods-App-frameworks.sh\\\"\\n\";\n\t\t\tshowEnvVarsInLog = 0;\n\t\t};\n\t\tB56F1236CC1F04E652F44D86 /* [CP] Check Pods Manifest.lock */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputFileListPaths = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t\t\"${PODS_PODFILE_DIR_PATH}/Podfile.lock\",\n\t\t\t\t\"${PODS_ROOT}/Manifest.lock\",\n\t\t\t);\n\t\t\tname = \"[CP] Check Pods Manifest.lock\";\n\t\t\toutputFileListPaths = (\n\t\t\t);\n\t\t\toutputPaths = (\n\t\t\t\t\"$(DERIVED_FILE_DIR)/Pods-App-checkManifestLockResult.txt\",\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"diff \\\"${PODS_PODFILE_DIR_PATH}/Podfile.lock\\\" \\\"${PODS_ROOT}/Manifest.lock\\\" > /dev/null\\nif [ $? != 0 ] ; then\\n    # print error to STDERR\\n    echo \\\"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\\\" >&2\\n    exit 1\\nfi\\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\\necho \\\"SUCCESS\\\" > \\\"${SCRIPT_OUTPUT_FILE_0}\\\"\\n\";\n\t\t\tshowEnvVarsInLog = 0;\n\t\t};\n/* End PBXShellScriptBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t3FEC917E2A4D41250044BFF5 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FEC917F2A4D41250044BFF5 /* SwiftExampleApp.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t3FEC91732A4D3B150044BFF5 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++20\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tENABLE_USER_SCRIPT_SANDBOXING = NO;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu17;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tLOCALIZATION_PREFERS_STRING_CATALOGS = YES;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"DEBUG $(inherited)\";\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t3FEC91742A4D3B150044BFF5 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++20\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_USER_SCRIPT_SANDBOXING = NO;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu17;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tLOCALIZATION_PREFERS_STRING_CATALOGS = YES;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t3FEC91852A4D41250044BFF5 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 551C4089A220B7CAC99DE535 /* Pods-App.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = Source/SwiftExample.entitlements;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEVELOPMENT_ASSET_PATHS = \"\\\"Source/Preview Content\\\"\";\n\t\t\t\tENABLE_PREVIEWS = YES;\n\t\t\t\tGENERATE_INFOPLIST_FILE = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]\" = UIStatusBarStyleDefault;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]\" = UIStatusBarStyleDefault;\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = \"UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = \"UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 16.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\";\n\t\t\t\t\"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]\" = \"@executable_path/../Frameworks\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 13.4;\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.Realm.App;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = auto;\n\t\t\t\tSUPPORTED_PLATFORMS = \"appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator watchos watchsimulator\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t\tSUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSWIFT_EMIT_LOC_STRINGS = YES;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2,3,4,6,7\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t3FEC91862A4D41250044BFF5 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 012DB6ABD37FF9723F260762 /* Pods-App.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = Source/SwiftExample.entitlements;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEVELOPMENT_ASSET_PATHS = \"\\\"Source/Preview Content\\\"\";\n\t\t\t\tENABLE_PREVIEWS = YES;\n\t\t\t\tGENERATE_INFOPLIST_FILE = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]\" = UIStatusBarStyleDefault;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]\" = UIStatusBarStyleDefault;\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = \"UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = \"UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 16.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\";\n\t\t\t\t\"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]\" = \"@executable_path/../Frameworks\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 13.4;\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.Realm.App;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = auto;\n\t\t\t\tSUPPORTED_PLATFORMS = \"appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator watchos watchsimulator\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t\tSUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSWIFT_EMIT_LOC_STRINGS = YES;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2,3,4,5,6,7\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t3FEC91612A4D3B140044BFF5 /* Build configuration list for PBXProject \"CocoaPods\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t3FEC91732A4D3B150044BFF5 /* Debug */,\n\t\t\t\t3FEC91742A4D3B150044BFF5 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t3FEC91842A4D41250044BFF5 /* Build configuration list for PBXNativeTarget \"App\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t3FEC91852A4D41250044BFF5 /* Debug */,\n\t\t\t\t3FEC91862A4D41250044BFF5 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 3FEC915E2A4D3B140044BFF5 /* Project object */;\n}\n"
  },
  {
    "path": "examples/installation/CocoaPods.xcodeproj/xcshareddata/xcschemes/App.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1510\"\n   version = \"1.7\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"3FEC917D2A4D41250044BFF5\"\n               BuildableName = \"App.app\"\n               BlueprintName = \"App\"\n               ReferencedContainer = \"container:CocoaPods.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      shouldAutocreateTestPlan = \"YES\">\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"3FEC917D2A4D41250044BFF5\"\n            BuildableName = \"App.app\"\n            BlueprintName = \"App\"\n            ReferencedContainer = \"container:CocoaPods.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"3FEC917D2A4D41250044BFF5\"\n            BuildableName = \"App.app\"\n            BlueprintName = \"App\"\n            ReferencedContainer = \"container:CocoaPods.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/installation/CocoaPods.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"group:CocoaPods.xcodeproj\">\n   </FileRef>\n   <FileRef\n      location = \"group:Pods/Pods.xcodeproj\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "examples/installation/CocoaPods.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>IDEDidComputeMac32BitWarning</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/installation/Podfile",
    "content": "project 'CocoaPods.xcodeproj'\nuse_modular_headers!\n\nos = (ENV['REALM_PLATFORM'] || :ios).to_sym\nif os == :catalyst\n  os = :ios\nend\nversion = case os\n          when :osx then 10.15\n          when :ios, :tvos then 12.0\n          when :watchos then 5.0\n          end\ntarget 'App' do\n  platform os, version\n  use_frameworks! unless ENV['REALM_BUILD_STATIC']\n\n  if ENV['REALM_TEST_RELEASE']\n    pod 'RealmSwift', ENV['REALM_TEST_RELEASE']\n  elsif ENV['REALM_TEST_BRANCH']\n    pod 'Realm', git: 'https://github.com/realm/realm-swift', branch: ENV['REALM_TEST_BRANCH']\n    pod 'RealmSwift', git: 'https://github.com/realm/realm-swift', branch: ENV['REALM_TEST_BRANCH']\n  else\n    pod 'RealmSwift'\n  end\n\n  pod 'SubRealm', path: 'SubRealm'\nend\n"
  },
  {
    "path": "examples/installation/Source/Assets.xcassets/AccentColor.colorset/Contents.json",
    "content": "{\n  \"colors\" : [\n    {\n      \"idiom\" : \"universal\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "examples/installation/Source/Assets.xcassets/AppIcon.appiconset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"platform\" : \"ios\",\n      \"size\" : \"1024x1024\"\n    },\n    {\n      \"idiom\" : \"mac\",\n      \"scale\" : \"1x\",\n      \"size\" : \"16x16\"\n    },\n    {\n      \"idiom\" : \"mac\",\n      \"scale\" : \"2x\",\n      \"size\" : \"16x16\"\n    },\n    {\n      \"idiom\" : \"mac\",\n      \"scale\" : \"1x\",\n      \"size\" : \"32x32\"\n    },\n    {\n      \"idiom\" : \"mac\",\n      \"scale\" : \"2x\",\n      \"size\" : \"32x32\"\n    },\n    {\n      \"idiom\" : \"mac\",\n      \"scale\" : \"1x\",\n      \"size\" : \"128x128\"\n    },\n    {\n      \"idiom\" : \"mac\",\n      \"scale\" : \"2x\",\n      \"size\" : \"128x128\"\n    },\n    {\n      \"idiom\" : \"mac\",\n      \"scale\" : \"1x\",\n      \"size\" : \"256x256\"\n    },\n    {\n      \"idiom\" : \"mac\",\n      \"scale\" : \"2x\",\n      \"size\" : \"256x256\"\n    },\n    {\n      \"idiom\" : \"mac\",\n      \"scale\" : \"1x\",\n      \"size\" : \"512x512\"\n    },\n    {\n      \"idiom\" : \"mac\",\n      \"scale\" : \"2x\",\n      \"size\" : \"512x512\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "examples/installation/Source/Assets.xcassets/Contents.json",
    "content": "{\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "examples/installation/Source/ObjCImport.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2023 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/Realm.h>\n\n@interface ObjcModel : RLMObject\n@property (nonatomic) int value;\n@end\n\n@implementation ObjcModel\n@end\n"
  },
  {
    "path": "examples/installation/Source/Preview Content/Preview Assets.xcassets/Contents.json",
    "content": "{\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "examples/installation/Source/SwiftExample.entitlements",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n    <key>com.apple.security.app-sandbox</key>\n    <true/>\n    <key>com.apple.security.files.user-selected.read-only</key>\n    <true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/installation/Source/SwiftExampleApp.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2023 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport SwiftUI\nimport RealmSwift\n\n#if COCOAPODS\nimport SubRealm\n#endif\n\nclass MyModel: Object {\n    @Persisted var value: Int\n}\n\n@main\nstruct SwiftExampleApp: SwiftUI.App {\n    let realm = try! Realm()\n#if COCOAPODS\n    let subrealm = try! SubRealm.findTestModel()\n#endif\n    var body: some Scene {\n        WindowGroup {\n            Text(\"Hello, world: \\(realm.objects(MyModel.self).count)!\")\n        }\n    }\n}\n"
  },
  {
    "path": "examples/installation/Static/StaticExample/Base.lproj/LaunchScreen.xib",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.XIB\" version=\"3.0\" toolsVersion=\"6214\" systemVersion=\"14A314h\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" launchScreen=\"YES\" useTraitCollections=\"YES\">\n    <dependencies>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"6207\"/>\n        <capability name=\"Constraints with non-1.0 multipliers\" minToolsVersion=\"5.1\"/>\n    </dependencies>\n    <objects>\n        <placeholder placeholderIdentifier=\"IBFilesOwner\" id=\"-1\" userLabel=\"File's Owner\"/>\n        <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"-2\" customClass=\"UIResponder\"/>\n        <view contentMode=\"scaleToFill\" id=\"iN0-l3-epB\">\n            <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"480\" height=\"480\"/>\n            <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n            <subviews>\n                <label opaque=\"NO\" clipsSubviews=\"YES\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"  Copyright (c) 2015 Realm. All rights reserved.\" textAlignment=\"center\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" minimumFontSize=\"9\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"8ie-xW-0ye\">\n                    <rect key=\"frame\" x=\"20\" y=\"439\" width=\"441\" height=\"21\"/>\n                    <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"17\"/>\n                    <color key=\"textColor\" cocoaTouchSystemColor=\"darkTextColor\"/>\n                    <nil key=\"highlightedColor\"/>\n                </label>\n                <label opaque=\"NO\" clipsSubviews=\"YES\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"StaticExample\" textAlignment=\"center\" lineBreakMode=\"middleTruncation\" baselineAdjustment=\"alignBaselines\" minimumFontSize=\"18\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"kId-c2-rCX\">\n                    <rect key=\"frame\" x=\"20\" y=\"140\" width=\"441\" height=\"43\"/>\n                    <fontDescription key=\"fontDescription\" type=\"boldSystem\" pointSize=\"36\"/>\n                    <color key=\"textColor\" cocoaTouchSystemColor=\"darkTextColor\"/>\n                    <nil key=\"highlightedColor\"/>\n                </label>\n            </subviews>\n            <color key=\"backgroundColor\" white=\"1\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"calibratedWhite\"/>\n            <constraints>\n                <constraint firstItem=\"kId-c2-rCX\" firstAttribute=\"centerY\" secondItem=\"iN0-l3-epB\" secondAttribute=\"bottom\" multiplier=\"1/3\" constant=\"1\" id=\"5cJ-9S-tgC\"/>\n                <constraint firstAttribute=\"centerX\" secondItem=\"kId-c2-rCX\" secondAttribute=\"centerX\" id=\"Koa-jz-hwk\"/>\n                <constraint firstAttribute=\"bottom\" secondItem=\"8ie-xW-0ye\" secondAttribute=\"bottom\" constant=\"20\" id=\"Kzo-t9-V3l\"/>\n                <constraint firstItem=\"8ie-xW-0ye\" firstAttribute=\"leading\" secondItem=\"iN0-l3-epB\" secondAttribute=\"leading\" constant=\"20\" symbolic=\"YES\" id=\"MfP-vx-nX0\"/>\n                <constraint firstAttribute=\"centerX\" secondItem=\"8ie-xW-0ye\" secondAttribute=\"centerX\" id=\"ZEH-qu-HZ9\"/>\n                <constraint firstItem=\"kId-c2-rCX\" firstAttribute=\"leading\" secondItem=\"iN0-l3-epB\" secondAttribute=\"leading\" constant=\"20\" symbolic=\"YES\" id=\"fvb-Df-36g\"/>\n            </constraints>\n            <nil key=\"simulatedStatusBarMetrics\"/>\n            <freeformSimulatedSizeMetrics key=\"simulatedDestinationMetrics\"/>\n            <point key=\"canvasLocation\" x=\"548\" y=\"455\"/>\n        </view>\n    </objects>\n</document>\n"
  },
  {
    "path": "examples/installation/Static/StaticExample/Base.lproj/Main.storyboard",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\" version=\"3.0\" toolsVersion=\"6211\" systemVersion=\"14A298i\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" useTraitCollections=\"YES\" initialViewController=\"vXZ-lx-hvc\">\n    <dependencies>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"6204\"/>\n    </dependencies>\n    <scenes>\n        <!--View Controller-->\n        <scene sceneID=\"ufC-wZ-h7g\">\n            <objects>\n                <viewController id=\"vXZ-lx-hvc\" customClass=\"ViewController\" customModuleProvider=\"\" sceneMemberID=\"viewController\">\n                    <layoutGuides>\n                        <viewControllerLayoutGuide type=\"top\" id=\"jyV-Pf-zRb\"/>\n                        <viewControllerLayoutGuide type=\"bottom\" id=\"2fi-mo-0CV\"/>\n                    </layoutGuides>\n                    <view key=\"view\" contentMode=\"scaleToFill\" id=\"kh9-bI-dsS\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"600\" height=\"600\"/>\n                        <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                        <color key=\"backgroundColor\" white=\"1\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"calibratedWhite\"/>\n                    </view>\n                </viewController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"x5A-6p-PRh\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n        </scene>\n    </scenes>\n</document>\n"
  },
  {
    "path": "examples/installation/Static/StaticExample/Images.xcassets/AppIcon.appiconset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"60x60\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"60x60\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/installation/Static/StaticExample/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIMainStoryboardFile</key>\n\t<string>Main</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/installation/Static/StaticExample/main.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n#import <Realm/Realm.h>\n\n@interface MyModel : RLMObject\n@property (nonatomic) int value;\n@end\n@implementation MyModel\n@end\n\n@interface AppDelegate : UIResponder <UIApplicationDelegate>\n@property (strong, nonatomic) UIWindow *window;\n@end\n\n@implementation AppDelegate\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    return YES;\n}\n@end\n\n@interface ViewController : UIViewController\n@end\n@implementation ViewController\n@end\n\nint main(int argc, char * argv[]) {\n    @autoreleasepool {\n        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));\n    }\n}\n"
  },
  {
    "path": "examples/installation/Static/StaticExample.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 54;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t3FCABC1F28BE9B9D008C966A /* libcompression.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3FCABC1E28BE9B9C008C966A /* libcompression.tbd */; };\n\t\t3FCABC2128BE9BC5008C966A /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3FCABC2028BE9BB3008C966A /* libc++.tbd */; };\n\t\tE88ABBB51AFA9DE300FA1E1D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E88ABBB41AFA9DE300FA1E1D /* main.m */; };\n\t\tE88ABBBE1AFA9DE300FA1E1D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E88ABBBC1AFA9DE300FA1E1D /* Main.storyboard */; };\n\t\tE88ABBC01AFA9DE300FA1E1D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E88ABBBF1AFA9DE300FA1E1D /* Images.xcassets */; };\n\t\tE88ABBC31AFA9DE300FA1E1D /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = E88ABBC11AFA9DE300FA1E1D /* LaunchScreen.xib */; };\n\t\tE88ABBDB1AFAA5D600FA1E1D /* Realm.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = E88ABBDA1AFAA5D600FA1E1D /* Realm.xcframework */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t3FCABC1E28BE9B9C008C966A /* libcompression.tbd */ = {isa = PBXFileReference; lastKnownFileType = \"sourcecode.text-based-dylib-definition\"; name = libcompression.tbd; path = usr/lib/libcompression.tbd; sourceTree = SDKROOT; };\n\t\t3FCABC2028BE9BB3008C966A /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = \"sourcecode.text-based-dylib-definition\"; name = \"libc++.tbd\"; path = \"usr/lib/libc++.tbd\"; sourceTree = SDKROOT; };\n\t\tE88ABBAF1AFA9DE300FA1E1D /* StaticExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = StaticExample.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE88ABBB31AFA9DE300FA1E1D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tE88ABBB41AFA9DE300FA1E1D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = \"<group>\"; };\n\t\tE88ABBBD1AFA9DE300FA1E1D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = \"<group>\"; };\n\t\tE88ABBBF1AFA9DE300FA1E1D /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = \"<group>\"; };\n\t\tE88ABBC21AFA9DE300FA1E1D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = \"<group>\"; };\n\t\tE88ABBDA1AFAA5D600FA1E1D /* Realm.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Realm.xcframework; path = \"../../../build/Static/Realm.xcframework\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\tE88ABBAC1AFA9DE300FA1E1D /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FCABC2128BE9BC5008C966A /* libc++.tbd in Frameworks */,\n\t\t\t\t3FCABC1F28BE9B9D008C966A /* libcompression.tbd in Frameworks */,\n\t\t\t\tE88ABBDB1AFAA5D600FA1E1D /* Realm.xcframework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t3FCABC1D28BE9B9C008C966A /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FCABC2028BE9BB3008C966A /* libc++.tbd */,\n\t\t\t\t3FCABC1E28BE9B9C008C966A /* libcompression.tbd */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE88ABBA61AFA9DE300FA1E1D = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FCABC1D28BE9B9C008C966A /* Frameworks */,\n\t\t\t\tE88ABBB01AFA9DE300FA1E1D /* Products */,\n\t\t\t\tE88ABBB11AFA9DE300FA1E1D /* StaticExample */,\n\t\t\t\tE88ABBDA1AFAA5D600FA1E1D /* Realm.xcframework */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE88ABBB01AFA9DE300FA1E1D /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE88ABBAF1AFA9DE300FA1E1D /* StaticExample.app */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE88ABBB11AFA9DE300FA1E1D /* StaticExample */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE88ABBB41AFA9DE300FA1E1D /* main.m */,\n\t\t\t\tE88ABBB31AFA9DE300FA1E1D /* Info.plist */,\n\t\t\t\tE88ABBBF1AFA9DE300FA1E1D /* Images.xcassets */,\n\t\t\t\tE88ABBC11AFA9DE300FA1E1D /* LaunchScreen.xib */,\n\t\t\t\tE88ABBBC1AFA9DE300FA1E1D /* Main.storyboard */,\n\t\t\t);\n\t\t\tpath = StaticExample;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXNativeTarget section */\n\t\tE88ABBAE1AFA9DE300FA1E1D /* StaticExample */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = E88ABBD21AFA9DE400FA1E1D /* Build configuration list for PBXNativeTarget \"StaticExample\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE88ABBAB1AFA9DE300FA1E1D /* Sources */,\n\t\t\t\tE88ABBAC1AFA9DE300FA1E1D /* Frameworks */,\n\t\t\t\tE88ABBAD1AFA9DE300FA1E1D /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = StaticExample;\n\t\t\tproductName = StaticExample;\n\t\t\tproductReference = E88ABBAF1AFA9DE300FA1E1D /* StaticExample.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tE88ABBA71AFA9DE300FA1E1D /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastUpgradeCheck = 1430;\n\t\t\t\tORGANIZATIONNAME = Realm;\n\t\t\t\tTargetAttributes = {\n\t\t\t\t\tE88ABBAE1AFA9DE300FA1E1D = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 6.3.1;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tbuildConfigurationList = E88ABBAA1AFA9DE300FA1E1D /* Build configuration list for PBXProject \"StaticExample\" */;\n\t\t\tcompatibilityVersion = \"Xcode 3.2\";\n\t\t\tdevelopmentRegion = English;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tEnglish,\n\t\t\t\ten,\n\t\t\t\tBase,\n\t\t\t);\n\t\t\tmainGroup = E88ABBA61AFA9DE300FA1E1D;\n\t\t\tproductRefGroup = E88ABBB01AFA9DE300FA1E1D /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\tE88ABBAE1AFA9DE300FA1E1D /* StaticExample */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\tE88ABBAD1AFA9DE300FA1E1D /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE88ABBC01AFA9DE300FA1E1D /* Images.xcassets in Resources */,\n\t\t\t\tE88ABBC31AFA9DE300FA1E1D /* LaunchScreen.xib in Resources */,\n\t\t\t\tE88ABBBE1AFA9DE300FA1E1D /* Main.storyboard in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\tE88ABBAB1AFA9DE300FA1E1D /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE88ABBB51AFA9DE300FA1E1D /* main.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXVariantGroup section */\n\t\tE88ABBBC1AFA9DE300FA1E1D /* Main.storyboard */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\tE88ABBBD1AFA9DE300FA1E1D /* Base */,\n\t\t\t);\n\t\t\tname = Main.storyboard;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE88ABBC11AFA9DE300FA1E1D /* LaunchScreen.xib */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\tE88ABBC21AFA9DE300FA1E1D /* Base */,\n\t\t\t);\n\t\t\tname = LaunchScreen.xib;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXVariantGroup section */\n\n/* Begin XCBuildConfiguration section */\n\t\tE88ABBD01AFA9DE400FA1E1D /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_SYMBOLS_PRIVATE_EXTERN = NO;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE88ABBD11AFA9DE400FA1E1D /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE88ABBD31AFA9DE400FA1E1D /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tFRAMEWORK_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"../../../realm-objc-latest/ios/static\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = StaticExample/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tOTHER_LDFLAGS = \"-lz\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.$(PRODUCT_NAME:rfc1034identifier)\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE88ABBD41AFA9DE400FA1E1D /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tFRAMEWORK_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"../../../realm-objc-latest/ios/static\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = StaticExample/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tOTHER_LDFLAGS = \"-lz\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.$(PRODUCT_NAME:rfc1034identifier)\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\tE88ABBAA1AFA9DE300FA1E1D /* Build configuration list for PBXProject \"StaticExample\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE88ABBD01AFA9DE400FA1E1D /* Debug */,\n\t\t\t\tE88ABBD11AFA9DE400FA1E1D /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE88ABBD21AFA9DE400FA1E1D /* Build configuration list for PBXNativeTarget \"StaticExample\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE88ABBD31AFA9DE400FA1E1D /* Debug */,\n\t\t\t\tE88ABBD41AFA9DE400FA1E1D /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = E88ABBA71AFA9DE300FA1E1D /* Project object */;\n}\n"
  },
  {
    "path": "examples/installation/Static/StaticExample.xcodeproj/xcshareddata/xcschemes/StaticExample.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E88ABBAE1AFA9DE300FA1E1D\"\n               BuildableName = \"StaticExample.app\"\n               BlueprintName = \"StaticExample\"\n               ReferencedContainer = \"container:StaticExample.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"NO\"\n            buildForArchiving = \"NO\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E88ABBC71AFA9DE400FA1E1D\"\n               BuildableName = \"StaticExampleTests.xctest\"\n               BlueprintName = \"StaticExampleTests\"\n               ReferencedContainer = \"container:StaticExample.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <Testables>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E88ABBC71AFA9DE400FA1E1D\"\n               BuildableName = \"StaticExampleTests.xctest\"\n               BlueprintName = \"StaticExampleTests\"\n               ReferencedContainer = \"container:StaticExample.xcodeproj\">\n            </BuildableReference>\n         </TestableReference>\n      </Testables>\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E88ABBAE1AFA9DE300FA1E1D\"\n            BuildableName = \"StaticExample.app\"\n            BlueprintName = \"StaticExample\"\n            ReferencedContainer = \"container:StaticExample.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E88ABBAE1AFA9DE300FA1E1D\"\n            BuildableName = \"StaticExample.app\"\n            BlueprintName = \"StaticExample\"\n            ReferencedContainer = \"container:StaticExample.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E88ABBAE1AFA9DE300FA1E1D\"\n            BuildableName = \"StaticExample.app\"\n            BlueprintName = \"StaticExample\"\n            ReferencedContainer = \"container:StaticExample.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/installation/SubRealm/SubRealm.podspec",
    "content": "Pod::Spec.new do |s|\n  s.name                       = \"SubRealm\"\n  s.version                    = \"1.0.0\"\n  s.summary                    = \"Test Realm as a transitive dependency\"\n  s.homepage                   = \"https://realm.io\"\n  s.author                     = { 'Realm' => 'realm-help@mongodb.com' }\n  s.license                    = { type: 'Apache 2.0', file: '../../../LICENSE' }\n  s.source                     = { git: 'https://github.com/realm/realm-swift.git', tag: \"v#{s.version}\" }\n  s.swift_version              = '5'\n  s.ios.deployment_target      = '12.0'\n  s.osx.deployment_target      = '10.15'\n  s.watchos.deployment_target  = '5.0'\n  s.tvos.deployment_target     = '12.0'\n  s.visionos.deployment_target = '1.0'\n  s.source_files               = \"*.swift\"\n  s.dependency 'RealmSwift'\nend\n"
  },
  {
    "path": "examples/installation/SubRealm/SubRealm.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2023 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport RealmSwift\n\npublic class TestObject: Object {\n    @Persisted public var name: String\n}\n\npublic class SubRealm {\n    public static func storeTestModel() throws {\n        let realm = try Realm()\n        let model = TestObject()\n        model.name = \"Test\"\n        try realm.write {\n            realm.add(model)\n        }\n    }\n\n    public static func findTestModel() throws -> TestObject? {\n        let realm = try Realm()\n        return realm.objects(TestObject.self).first\n    }\n}\n"
  },
  {
    "path": "examples/installation/SwiftPackageManager.notxcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 56;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t3FEC916A2A4D3B140044BFF5 /* SwiftExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FEC91692A4D3B140044BFF5 /* SwiftExampleApp.swift */; };\n\t\t3FEC916E2A4D3B150044BFF5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3FEC916D2A4D3B150044BFF5 /* Assets.xcassets */; };\n\t\t3FEC91722A4D3B150044BFF5 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3FEC91712A4D3B150044BFF5 /* Preview Assets.xcassets */; };\n\t\t3FEC917C2A4D3DB90044BFF5 /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 3FEC917B2A4D3DB90044BFF5 /* RealmSwift */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t3FEC91662A4D3B140044BFF5 /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t3FEC91692A4D3B140044BFF5 /* SwiftExampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftExampleApp.swift; sourceTree = \"<group>\"; };\n\t\t3FEC916D2A4D3B150044BFF5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \"<group>\"; };\n\t\t3FEC916F2A4D3B150044BFF5 /* SwiftExample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SwiftExample.entitlements; sourceTree = \"<group>\"; };\n\t\t3FEC91712A4D3B150044BFF5 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = \"Preview Assets.xcassets\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t3FEC91632A4D3B140044BFF5 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FEC917C2A4D3DB90044BFF5 /* RealmSwift in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t3FEC915D2A4D3B140044BFF5 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FEC91682A4D3B140044BFF5 /* Source */,\n\t\t\t\t3FEC91672A4D3B140044BFF5 /* Products */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3FEC91672A4D3B140044BFF5 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FEC91662A4D3B140044BFF5 /* App.app */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3FEC91682A4D3B140044BFF5 /* Source */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FEC91702A4D3B150044BFF5 /* Preview Content */,\n\t\t\t\t3FEC916D2A4D3B150044BFF5 /* Assets.xcassets */,\n\t\t\t\t3FEC916F2A4D3B150044BFF5 /* SwiftExample.entitlements */,\n\t\t\t\t3FEC91692A4D3B140044BFF5 /* SwiftExampleApp.swift */,\n\t\t\t);\n\t\t\tpath = Source;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3FEC91702A4D3B150044BFF5 /* Preview Content */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FEC91712A4D3B150044BFF5 /* Preview Assets.xcassets */,\n\t\t\t);\n\t\t\tpath = \"Preview Content\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXNativeTarget section */\n\t\t3FEC91652A4D3B140044BFF5 /* App */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 3FEC91752A4D3B150044BFF5 /* Build configuration list for PBXNativeTarget \"App\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t3FEC91622A4D3B140044BFF5 /* Sources */,\n\t\t\t\t3FEC91632A4D3B140044BFF5 /* Frameworks */,\n\t\t\t\t3FEC91642A4D3B140044BFF5 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = App;\n\t\t\tpackageProductDependencies = (\n\t\t\t\t3FEC917B2A4D3DB90044BFF5 /* RealmSwift */,\n\t\t\t);\n\t\t\tproductName = SwiftPM;\n\t\t\tproductReference = 3FEC91662A4D3B140044BFF5 /* App.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t3FEC915E2A4D3B140044BFF5 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tBuildIndependentTargetsInParallel = 1;\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t\tTargetAttributes = {\n\t\t\t\t\t3FEC91652A4D3B140044BFF5 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 15.0;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tbuildConfigurationList = 3FEC91612A4D3B140044BFF5 /* Build configuration list for PBXProject \"SwiftPackageManager\" */;\n\t\t\tcompatibilityVersion = \"Xcode 14.0\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t\tBase,\n\t\t\t);\n\t\t\tmainGroup = 3FEC915D2A4D3B140044BFF5;\n\t\t\tpackageReferences = (\n\t\t\t\t3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference \"realm-swift\" */,\n\t\t\t);\n\t\t\tproductRefGroup = 3FEC91672A4D3B140044BFF5 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t3FEC91652A4D3B140044BFF5 /* App */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t3FEC91642A4D3B140044BFF5 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FEC916E2A4D3B150044BFF5 /* Assets.xcassets in Resources */,\n\t\t\t\t3FEC91722A4D3B150044BFF5 /* Preview Assets.xcassets in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t3FEC91622A4D3B140044BFF5 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FEC916A2A4D3B140044BFF5 /* SwiftExampleApp.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t3FEC91732A4D3B150044BFF5 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++20\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tENABLE_USER_SCRIPT_SANDBOXING = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu17;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tLOCALIZATION_PREFERS_STRING_CATALOGS = YES;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"DEBUG $(inherited)\";\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t3FEC91742A4D3B150044BFF5 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++20\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_USER_SCRIPT_SANDBOXING = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu17;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tLOCALIZATION_PREFERS_STRING_CATALOGS = YES;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t3FEC91762A4D3B150044BFF5 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = Source/SwiftExample.entitlements;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEVELOPMENT_ASSET_PATHS = \"\\\"Source/Preview Content\\\"\";\n\t\t\t\tENABLE_PREVIEWS = YES;\n\t\t\t\tGENERATE_INFOPLIST_FILE = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]\" = UIStatusBarStyleDefault;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]\" = UIStatusBarStyleDefault;\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = \"UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = \"UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 17.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\";\n\t\t\t\t\"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]\" = \"@executable_path/../Frameworks\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 13.4;\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.Realm.App;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = auto;\n\t\t\t\tSUPPORTED_PLATFORMS = \"xrsimulator xros watchsimulator watchos macosx iphonesimulator iphoneos driverkit appletvsimulator appletvos\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t\tSUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSWIFT_EMIT_LOC_STRINGS = YES;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2,3,7\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t3FEC91772A4D3B150044BFF5 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = Source/SwiftExample.entitlements;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEVELOPMENT_ASSET_PATHS = \"\\\"Source/Preview Content\\\"\";\n\t\t\t\tENABLE_PREVIEWS = YES;\n\t\t\t\tGENERATE_INFOPLIST_FILE = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]\" = UIStatusBarStyleDefault;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]\" = UIStatusBarStyleDefault;\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = \"UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = \"UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 17.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\";\n\t\t\t\t\"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]\" = \"@executable_path/../Frameworks\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 13.4;\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.Realm.App;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = auto;\n\t\t\t\tSUPPORTED_PLATFORMS = \"xrsimulator xros watchsimulator watchos macosx iphonesimulator iphoneos driverkit appletvsimulator appletvos\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t\tSUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSWIFT_EMIT_LOC_STRINGS = YES;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2,3,7\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t3FEC91612A4D3B140044BFF5 /* Build configuration list for PBXProject \"SwiftPackageManager\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t3FEC91732A4D3B150044BFF5 /* Debug */,\n\t\t\t\t3FEC91742A4D3B150044BFF5 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t3FEC91752A4D3B150044BFF5 /* Build configuration list for PBXNativeTarget \"App\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t3FEC91762A4D3B150044BFF5 /* Debug */,\n\t\t\t\t3FEC91772A4D3B150044BFF5 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\n/* Begin XCRemoteSwiftPackageReference section */\n\t\t3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference \"realm-swift\" */ = {\n\t\t\tisa = XCRemoteSwiftPackageReference;\n\t\t\trepositoryURL = \"https://github.com/realm/realm-swift.git\";\n\t\t\trequirement = {\n\t\t\t\tbranch = master;\n\t\t\t\tkind = branch;\n\t\t\t};\n\t\t};\n/* End XCRemoteSwiftPackageReference section */\n\n/* Begin XCSwiftPackageProductDependency section */\n\t\t3FEC917B2A4D3DB90044BFF5 /* RealmSwift */ = {\n\t\t\tisa = XCSwiftPackageProductDependency;\n\t\t\tpackage = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference \"realm-swift\" */;\n\t\t\tproductName = RealmSwift;\n\t\t};\n/* End XCSwiftPackageProductDependency section */\n\t};\n\trootObject = 3FEC915E2A4D3B140044BFF5 /* Project object */;\n}\n"
  },
  {
    "path": "examples/installation/SwiftPackageManagerDynamic.notxcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 56;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t3FEC916A2A4D3B140044BFF5 /* SwiftExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FEC91692A4D3B140044BFF5 /* SwiftExampleApp.swift */; };\n\t\t3FEC916E2A4D3B150044BFF5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3FEC916D2A4D3B150044BFF5 /* Assets.xcassets */; };\n\t\t3FEC91722A4D3B150044BFF5 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3FEC91712A4D3B150044BFF5 /* Preview Assets.xcassets */; };\n\t\t3FEC917C2A4D3DB90044BFF5 /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 3FEC917B2A4D3DB90044BFF5 /* RealmSwift */; };\n\t\t3FF673252A684E4400500A25 /* Framework1.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3FF6731F2A684E4400500A25 /* Framework1.framework */; };\n\t\t3FF673262A684E4400500A25 /* Framework1.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3FF6731F2A684E4400500A25 /* Framework1.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t3FF673362A684E4E00500A25 /* Framework2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3FF673302A684E4E00500A25 /* Framework2.framework */; };\n\t\t3FF673372A684E4E00500A25 /* Framework2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3FF673302A684E4E00500A25 /* Framework2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t3FF6733F2A684E7200500A25 /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 3FF6733E2A684E7200500A25 /* RealmSwift */; };\n\t\t3FF673432A684E7700500A25 /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 3FF673422A684E7700500A25 /* RealmSwift */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t3FF673232A684E4400500A25 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 3FEC915E2A4D3B140044BFF5 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 3FF6731E2A684E4400500A25;\n\t\t\tremoteInfo = Framework1;\n\t\t};\n\t\t3FF673342A684E4E00500A25 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 3FEC915E2A4D3B140044BFF5 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 3FF6732F2A684E4E00500A25;\n\t\t\tremoteInfo = Framework2;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXCopyFilesBuildPhase section */\n\t\t3FF673272A684E4400500A25 /* Embed Frameworks */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\t3FF673262A684E4400500A25 /* Framework1.framework in Embed Frameworks */,\n\t\t\t\t3FF673372A684E4E00500A25 /* Framework2.framework in Embed Frameworks */,\n\t\t\t);\n\t\t\tname = \"Embed Frameworks\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXCopyFilesBuildPhase section */\n\n/* Begin PBXFileReference section */\n\t\t3FEC91662A4D3B140044BFF5 /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t3FEC91692A4D3B140044BFF5 /* SwiftExampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftExampleApp.swift; sourceTree = \"<group>\"; };\n\t\t3FEC916D2A4D3B150044BFF5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \"<group>\"; };\n\t\t3FEC916F2A4D3B150044BFF5 /* SwiftExample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SwiftExample.entitlements; sourceTree = \"<group>\"; };\n\t\t3FEC91712A4D3B150044BFF5 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = \"Preview Assets.xcassets\"; sourceTree = \"<group>\"; };\n\t\t3FF6731F2A684E4400500A25 /* Framework1.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Framework1.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t3FF673302A684E4E00500A25 /* Framework2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Framework2.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t3FEC91632A4D3B140044BFF5 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FF673252A684E4400500A25 /* Framework1.framework in Frameworks */,\n\t\t\t\t3FF673362A684E4E00500A25 /* Framework2.framework in Frameworks */,\n\t\t\t\t3FEC917C2A4D3DB90044BFF5 /* RealmSwift in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t3FF6731C2A684E4400500A25 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FF6733F2A684E7200500A25 /* RealmSwift in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t3FF6732D2A684E4E00500A25 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FF673432A684E7700500A25 /* RealmSwift in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t3FEC915D2A4D3B140044BFF5 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FEC91682A4D3B140044BFF5 /* Source */,\n\t\t\t\t3FEC91672A4D3B140044BFF5 /* Products */,\n\t\t\t\t3FF6733B2A684E7200500A25 /* Frameworks */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3FEC91672A4D3B140044BFF5 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FEC91662A4D3B140044BFF5 /* App.app */,\n\t\t\t\t3FF6731F2A684E4400500A25 /* Framework1.framework */,\n\t\t\t\t3FF673302A684E4E00500A25 /* Framework2.framework */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3FEC91682A4D3B140044BFF5 /* Source */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FEC91702A4D3B150044BFF5 /* Preview Content */,\n\t\t\t\t3FEC916D2A4D3B150044BFF5 /* Assets.xcassets */,\n\t\t\t\t3FEC916F2A4D3B150044BFF5 /* SwiftExample.entitlements */,\n\t\t\t\t3FEC91692A4D3B140044BFF5 /* SwiftExampleApp.swift */,\n\t\t\t);\n\t\t\tpath = Source;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3FEC91702A4D3B150044BFF5 /* Preview Content */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FEC91712A4D3B150044BFF5 /* Preview Assets.xcassets */,\n\t\t\t);\n\t\t\tpath = \"Preview Content\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3FF6733B2A684E7200500A25 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t3FF6731A2A684E4400500A25 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t3FF6732B2A684E4E00500A25 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t3FEC91652A4D3B140044BFF5 /* App */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 3FEC91752A4D3B150044BFF5 /* Build configuration list for PBXNativeTarget \"App\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t3FEC91622A4D3B140044BFF5 /* Sources */,\n\t\t\t\t3FEC91632A4D3B140044BFF5 /* Frameworks */,\n\t\t\t\t3FEC91642A4D3B140044BFF5 /* Resources */,\n\t\t\t\t3FF673272A684E4400500A25 /* Embed Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t3FF673242A684E4400500A25 /* PBXTargetDependency */,\n\t\t\t\t3FF673352A684E4E00500A25 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = App;\n\t\t\tpackageProductDependencies = (\n\t\t\t\t3FEC917B2A4D3DB90044BFF5 /* RealmSwift */,\n\t\t\t);\n\t\t\tproductName = SwiftPM;\n\t\t\tproductReference = 3FEC91662A4D3B140044BFF5 /* App.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\t3FF6731E2A684E4400500A25 /* Framework1 */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 3FF6732A2A684E4400500A25 /* Build configuration list for PBXNativeTarget \"Framework1\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t3FF6731A2A684E4400500A25 /* Headers */,\n\t\t\t\t3FF6731B2A684E4400500A25 /* Sources */,\n\t\t\t\t3FF6731C2A684E4400500A25 /* Frameworks */,\n\t\t\t\t3FF6731D2A684E4400500A25 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = Framework1;\n\t\t\tpackageProductDependencies = (\n\t\t\t\t3FF6733E2A684E7200500A25 /* RealmSwift */,\n\t\t\t);\n\t\t\tproductName = Framework1;\n\t\t\tproductReference = 3FF6731F2A684E4400500A25 /* Framework1.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n\t\t3FF6732F2A684E4E00500A25 /* Framework2 */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 3FF673382A684E4E00500A25 /* Build configuration list for PBXNativeTarget \"Framework2\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t3FF6732B2A684E4E00500A25 /* Headers */,\n\t\t\t\t3FF6732C2A684E4E00500A25 /* Sources */,\n\t\t\t\t3FF6732D2A684E4E00500A25 /* Frameworks */,\n\t\t\t\t3FF6732E2A684E4E00500A25 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = Framework2;\n\t\t\tpackageProductDependencies = (\n\t\t\t\t3FF673422A684E7700500A25 /* RealmSwift */,\n\t\t\t);\n\t\t\tproductName = Framework2;\n\t\t\tproductReference = 3FF673302A684E4E00500A25 /* Framework2.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t3FEC915E2A4D3B140044BFF5 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tBuildIndependentTargetsInParallel = 1;\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t\tTargetAttributes = {\n\t\t\t\t\t3FEC91652A4D3B140044BFF5 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 15.0;\n\t\t\t\t\t};\n\t\t\t\t\t3FF6731E2A684E4400500A25 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 15.0;\n\t\t\t\t\t};\n\t\t\t\t\t3FF6732F2A684E4E00500A25 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 15.0;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tbuildConfigurationList = 3FEC91612A4D3B140044BFF5 /* Build configuration list for PBXProject \"SwiftPackageManagerDynamic\" */;\n\t\t\tcompatibilityVersion = \"Xcode 14.0\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t\tBase,\n\t\t\t);\n\t\t\tmainGroup = 3FEC915D2A4D3B140044BFF5;\n\t\t\tpackageReferences = (\n\t\t\t\t3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference \"realm-swift\" */,\n\t\t\t);\n\t\t\tproductRefGroup = 3FEC91672A4D3B140044BFF5 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t3FEC91652A4D3B140044BFF5 /* App */,\n\t\t\t\t3FF6731E2A684E4400500A25 /* Framework1 */,\n\t\t\t\t3FF6732F2A684E4E00500A25 /* Framework2 */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t3FEC91642A4D3B140044BFF5 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FEC916E2A4D3B150044BFF5 /* Assets.xcassets in Resources */,\n\t\t\t\t3FEC91722A4D3B150044BFF5 /* Preview Assets.xcassets in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t3FF6731D2A684E4400500A25 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t3FF6732E2A684E4E00500A25 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t3FEC91622A4D3B140044BFF5 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FEC916A2A4D3B140044BFF5 /* SwiftExampleApp.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t3FF6731B2A684E4400500A25 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t3FF6732C2A684E4E00500A25 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\t3FF673242A684E4400500A25 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 3FF6731E2A684E4400500A25 /* Framework1 */;\n\t\t\ttargetProxy = 3FF673232A684E4400500A25 /* PBXContainerItemProxy */;\n\t\t};\n\t\t3FF673352A684E4E00500A25 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 3FF6732F2A684E4E00500A25 /* Framework2 */;\n\t\t\ttargetProxy = 3FF673342A684E4E00500A25 /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t3FEC91732A4D3B150044BFF5 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++20\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tENABLE_USER_SCRIPT_SANDBOXING = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu17;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tLOCALIZATION_PREFERS_STRING_CATALOGS = YES;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"DEBUG $(inherited)\";\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t3FEC91742A4D3B150044BFF5 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++20\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_USER_SCRIPT_SANDBOXING = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu17;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tLOCALIZATION_PREFERS_STRING_CATALOGS = YES;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t3FEC91762A4D3B150044BFF5 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = Source/SwiftExample.entitlements;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEVELOPMENT_ASSET_PATHS = \"\\\"Source/Preview Content\\\"\";\n\t\t\t\tENABLE_PREVIEWS = YES;\n\t\t\t\tGENERATE_INFOPLIST_FILE = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]\" = UIStatusBarStyleDefault;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]\" = UIStatusBarStyleDefault;\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = \"UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = \"UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 17.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\";\n\t\t\t\t\"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]\" = \"@executable_path/../Frameworks\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 13.4;\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.Realm.App;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = auto;\n\t\t\t\tSUPPORTED_PLATFORMS = \"xrsimulator xros watchsimulator watchos macosx iphonesimulator iphoneos driverkit appletvsimulator appletvos\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t\tSUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSWIFT_EMIT_LOC_STRINGS = YES;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2,3,7\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t3FEC91772A4D3B150044BFF5 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = Source/SwiftExample.entitlements;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEVELOPMENT_ASSET_PATHS = \"\\\"Source/Preview Content\\\"\";\n\t\t\t\tENABLE_PREVIEWS = YES;\n\t\t\t\tGENERATE_INFOPLIST_FILE = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]\" = UIStatusBarStyleDefault;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]\" = UIStatusBarStyleDefault;\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = \"UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = \"UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 17.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\";\n\t\t\t\t\"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]\" = \"@executable_path/../Frameworks\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 13.4;\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.Realm.App;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = auto;\n\t\t\t\tSUPPORTED_PLATFORMS = \"xrsimulator xros watchsimulator watchos macosx iphonesimulator iphoneos driverkit appletvsimulator appletvos\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t\tSUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSWIFT_EMIT_LOC_STRINGS = YES;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2,3,7\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t3FF673282A684E4400500A25 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tENABLE_MODULE_VERIFIER = YES;\n\t\t\t\tGENERATE_INFOPLIST_FILE = YES;\n\t\t\t\tINFOPLIST_KEY_NSHumanReadableCopyright = \"\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 17.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\t\"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]\" = (\n\t\t\t\t\t\"@executable_path/../Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 13.4;\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tMODULE_VERIFIER_SUPPORTED_LANGUAGES = \"objective-c objective-c++\";\n\t\t\t\tMODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = \"gnu17 gnu++20\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.Realm.Framework1;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME:c99extidentifier)\";\n\t\t\t\tSDKROOT = auto;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSUPPORTED_PLATFORMS = \"$(AVAILABLE_PLATFORMS)\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t\tSUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSWIFT_EMIT_LOC_STRINGS = YES;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2,3,4,6,7\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t3FF673292A684E4400500A25 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tENABLE_MODULE_VERIFIER = YES;\n\t\t\t\tGENERATE_INFOPLIST_FILE = YES;\n\t\t\t\tINFOPLIST_KEY_NSHumanReadableCopyright = \"\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 17.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\t\"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]\" = (\n\t\t\t\t\t\"@executable_path/../Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 13.4;\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tMODULE_VERIFIER_SUPPORTED_LANGUAGES = \"objective-c objective-c++\";\n\t\t\t\tMODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = \"gnu17 gnu++20\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.Realm.Framework1;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME:c99extidentifier)\";\n\t\t\t\tSDKROOT = auto;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSUPPORTED_PLATFORMS = \"$(AVAILABLE_PLATFORMS)\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t\tSUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSWIFT_EMIT_LOC_STRINGS = YES;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2,3,4,6,7\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t3FF673392A684E4E00500A25 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tENABLE_MODULE_VERIFIER = YES;\n\t\t\t\tGENERATE_INFOPLIST_FILE = YES;\n\t\t\t\tINFOPLIST_KEY_NSHumanReadableCopyright = \"\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 17.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tMODULE_VERIFIER_SUPPORTED_LANGUAGES = \"objective-c objective-c++\";\n\t\t\t\tMODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = \"gnu17 gnu++20\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.Realm.Framework2;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME:c99extidentifier)\";\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSUPPORTED_PLATFORMS = \"$(AVAILABLE_PLATFORMS)\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t\tSUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSWIFT_EMIT_LOC_STRINGS = YES;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2,3,4,6,7\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t3FF6733A2A684E4E00500A25 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tENABLE_MODULE_VERIFIER = YES;\n\t\t\t\tGENERATE_INFOPLIST_FILE = YES;\n\t\t\t\tINFOPLIST_KEY_NSHumanReadableCopyright = \"\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 17.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tMODULE_VERIFIER_SUPPORTED_LANGUAGES = \"objective-c objective-c++\";\n\t\t\t\tMODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = \"gnu17 gnu++20\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.Realm.Framework2;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME:c99extidentifier)\";\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSUPPORTED_PLATFORMS = \"$(AVAILABLE_PLATFORMS)\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t\tSUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSWIFT_EMIT_LOC_STRINGS = YES;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2,3,4,6,7\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t3FEC91612A4D3B140044BFF5 /* Build configuration list for PBXProject \"SwiftPackageManagerDynamic\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t3FEC91732A4D3B150044BFF5 /* Debug */,\n\t\t\t\t3FEC91742A4D3B150044BFF5 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t3FEC91752A4D3B150044BFF5 /* Build configuration list for PBXNativeTarget \"App\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t3FEC91762A4D3B150044BFF5 /* Debug */,\n\t\t\t\t3FEC91772A4D3B150044BFF5 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t3FF6732A2A684E4400500A25 /* Build configuration list for PBXNativeTarget \"Framework1\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t3FF673282A684E4400500A25 /* Debug */,\n\t\t\t\t3FF673292A684E4400500A25 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t3FF673382A684E4E00500A25 /* Build configuration list for PBXNativeTarget \"Framework2\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t3FF673392A684E4E00500A25 /* Debug */,\n\t\t\t\t3FF6733A2A684E4E00500A25 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\n/* Begin XCRemoteSwiftPackageReference section */\n\t\t3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference \"realm-swift\" */ = {\n\t\t\tisa = XCRemoteSwiftPackageReference;\n\t\t\trepositoryURL = \"https://github.com/realm/realm-swift.git\";\n\t\t\trequirement = {\n\t\t\t\tbranch = master;\n\t\t\t\tkind = branch;\n\t\t\t};\n\t\t};\n/* End XCRemoteSwiftPackageReference section */\n\n/* Begin XCSwiftPackageProductDependency section */\n\t\t3FEC917B2A4D3DB90044BFF5 /* RealmSwift */ = {\n\t\t\tisa = XCSwiftPackageProductDependency;\n\t\t\tpackage = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference \"realm-swift\" */;\n\t\t\tproductName = RealmSwift;\n\t\t};\n\t\t3FF6733E2A684E7200500A25 /* RealmSwift */ = {\n\t\t\tisa = XCSwiftPackageProductDependency;\n\t\t\tpackage = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference \"realm-swift\" */;\n\t\t\tproductName = RealmSwift;\n\t\t};\n\t\t3FF673422A684E7700500A25 /* RealmSwift */ = {\n\t\t\tisa = XCSwiftPackageProductDependency;\n\t\t\tpackage = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference \"realm-swift\" */;\n\t\t\tproductName = RealmSwift;\n\t\t};\n/* End XCSwiftPackageProductDependency section */\n\t};\n\trootObject = 3FEC915E2A4D3B140044BFF5 /* Project object */;\n}\n"
  },
  {
    "path": "examples/installation/XCFramework.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 56;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t3F938BA62A4E1886002356FE /* RealmSwift.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F938BA42A4E1886002356FE /* RealmSwift.xcframework */; };\n\t\t3F938BA72A4E1886002356FE /* RealmSwift.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3F938BA42A4E1886002356FE /* RealmSwift.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t3F938BA82A4E1886002356FE /* Realm.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F938BA52A4E1886002356FE /* Realm.xcframework */; };\n\t\t3F938BA92A4E1886002356FE /* Realm.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3F938BA52A4E1886002356FE /* Realm.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t3FD2CB222A4F34F500DF7B4F /* ObjCImport.m in Sources */ = {isa = PBXBuildFile; fileRef = 3FD2CB212A4F34F500DF7B4F /* ObjCImport.m */; };\n\t\t3FEC917F2A4D41250044BFF5 /* SwiftExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FEC91692A4D3B140044BFF5 /* SwiftExampleApp.swift */; };\n\t\t3FEC91822A4D41250044BFF5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3FEC916D2A4D3B150044BFF5 /* Assets.xcassets */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXCopyFilesBuildPhase section */\n\t\t3F938BAA2A4E1886002356FE /* Embed Frameworks */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\t3F938BA72A4E1886002356FE /* RealmSwift.xcframework in Embed Frameworks */,\n\t\t\t\t3F938BA92A4E1886002356FE /* Realm.xcframework in Embed Frameworks */,\n\t\t\t);\n\t\t\tname = \"Embed Frameworks\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXCopyFilesBuildPhase section */\n\n/* Begin PBXFileReference section */\n\t\t3F938BA42A4E1886002356FE /* RealmSwift.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = RealmSwift.xcframework; path = ../../build/RealmSwift.xcframework; sourceTree = \"<group>\"; };\n\t\t3F938BA52A4E1886002356FE /* Realm.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Realm.xcframework; path = ../../build/Realm.xcframework; sourceTree = \"<group>\"; };\n\t\t3FD2CB212A4F34F500DF7B4F /* ObjCImport.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ObjCImport.m; sourceTree = \"<group>\"; };\n\t\t3FEC91692A4D3B140044BFF5 /* SwiftExampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftExampleApp.swift; sourceTree = \"<group>\"; };\n\t\t3FEC916D2A4D3B150044BFF5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \"<group>\"; };\n\t\t3FEC916F2A4D3B150044BFF5 /* SwiftExample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SwiftExample.entitlements; sourceTree = \"<group>\"; };\n\t\t3FEC91872A4D41250044BFF5 /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t3FEC91802A4D41250044BFF5 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3F938BA62A4E1886002356FE /* RealmSwift.xcframework in Frameworks */,\n\t\t\t\t3F938BA82A4E1886002356FE /* Realm.xcframework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t3F938BA32A4E1886002356FE /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3F938BA52A4E1886002356FE /* Realm.xcframework */,\n\t\t\t\t3F938BA42A4E1886002356FE /* RealmSwift.xcframework */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3FEC915D2A4D3B140044BFF5 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FEC91682A4D3B140044BFF5 /* Source */,\n\t\t\t\t3FEC91672A4D3B140044BFF5 /* Products */,\n\t\t\t\t3F938BA32A4E1886002356FE /* Frameworks */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3FEC91672A4D3B140044BFF5 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FEC91872A4D41250044BFF5 /* App.app */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3FEC91682A4D3B140044BFF5 /* Source */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3FEC916D2A4D3B150044BFF5 /* Assets.xcassets */,\n\t\t\t\t3FEC916F2A4D3B150044BFF5 /* SwiftExample.entitlements */,\n\t\t\t\t3FEC91692A4D3B140044BFF5 /* SwiftExampleApp.swift */,\n\t\t\t\t3FD2CB212A4F34F500DF7B4F /* ObjCImport.m */,\n\t\t\t);\n\t\t\tpath = Source;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXNativeTarget section */\n\t\t3FEC917D2A4D41250044BFF5 /* App */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 3FEC91842A4D41250044BFF5 /* Build configuration list for PBXNativeTarget \"App\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t3FEC917E2A4D41250044BFF5 /* Sources */,\n\t\t\t\t3FEC91802A4D41250044BFF5 /* Frameworks */,\n\t\t\t\t3FEC91812A4D41250044BFF5 /* Resources */,\n\t\t\t\t3F938BAA2A4E1886002356FE /* Embed Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = App;\n\t\t\tproductName = SwiftPM;\n\t\t\tproductReference = 3FEC91872A4D41250044BFF5 /* App.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t3FEC915E2A4D3B140044BFF5 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tBuildIndependentTargetsInParallel = 1;\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t\tTargetAttributes = {\n\t\t\t\t\t3FEC917D2A4D41250044BFF5 = {\n\t\t\t\t\t\tLastSwiftMigration = 1500;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tbuildConfigurationList = 3FEC91612A4D3B140044BFF5 /* Build configuration list for PBXProject \"XCFramework\" */;\n\t\t\tcompatibilityVersion = \"Xcode 14.0\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t\tBase,\n\t\t\t);\n\t\t\tmainGroup = 3FEC915D2A4D3B140044BFF5;\n\t\t\tproductRefGroup = 3FEC91672A4D3B140044BFF5 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t3FEC917D2A4D41250044BFF5 /* App */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t3FEC91812A4D41250044BFF5 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FEC91822A4D41250044BFF5 /* Assets.xcassets in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t3FEC917E2A4D41250044BFF5 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FD2CB222A4F34F500DF7B4F /* ObjCImport.m in Sources */,\n\t\t\t\t3FEC917F2A4D41250044BFF5 /* SwiftExampleApp.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t3FEC91732A4D3B150044BFF5 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++20\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tENABLE_USER_SCRIPT_SANDBOXING = NO;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu17;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tLOCALIZATION_PREFERS_STRING_CATALOGS = YES;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"DEBUG $(inherited)\";\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t3FEC91742A4D3B150044BFF5 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++20\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_USER_SCRIPT_SANDBOXING = NO;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu17;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tLOCALIZATION_PREFERS_STRING_CATALOGS = YES;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t3FEC91852A4D41250044BFF5 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = Source/SwiftExample.entitlements;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEVELOPMENT_ASSET_PATHS = \"\\\"Source/Preview Content\\\"\";\n\t\t\t\tENABLE_PREVIEWS = YES;\n\t\t\t\tGENERATE_INFOPLIST_FILE = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]\" = UIStatusBarStyleDefault;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]\" = UIStatusBarStyleDefault;\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = \"UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = \"UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 17.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\";\n\t\t\t\t\"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]\" = \"@executable_path/../Frameworks\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 13.4;\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.Realm.App;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = auto;\n\t\t\t\tSUPPORTED_PLATFORMS = \"appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator watchos watchsimulator\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t\tSUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSWIFT_EMIT_LOC_STRINGS = YES;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2,3,4,6,7\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t3FEC91862A4D41250044BFF5 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = Source/SwiftExample.entitlements;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEVELOPMENT_ASSET_PATHS = \"\\\"Source/Preview Content\\\"\";\n\t\t\t\tENABLE_PREVIEWS = YES;\n\t\t\t\tGENERATE_INFOPLIST_FILE = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]\" = YES;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]\" = UIStatusBarStyleDefault;\n\t\t\t\t\"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]\" = UIStatusBarStyleDefault;\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = \"UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = \"UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 17.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\";\n\t\t\t\t\"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]\" = \"@executable_path/../Frameworks\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 13.4;\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.Realm.App;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = auto;\n\t\t\t\tSUPPORTED_PLATFORMS = \"appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator watchos watchsimulator\";\n\t\t\t\tSUPPORTS_MACCATALYST = YES;\n\t\t\t\tSUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;\n\t\t\t\tSWIFT_EMIT_LOC_STRINGS = YES;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2,3,4,5,6,7\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t3FEC91612A4D3B140044BFF5 /* Build configuration list for PBXProject \"XCFramework\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t3FEC91732A4D3B150044BFF5 /* Debug */,\n\t\t\t\t3FEC91742A4D3B150044BFF5 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t3FEC91842A4D41250044BFF5 /* Build configuration list for PBXNativeTarget \"App\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t3FEC91852A4D41250044BFF5 /* Debug */,\n\t\t\t\t3FEC91862A4D41250044BFF5 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 3FEC915E2A4D3B140044BFF5 /* Project object */;\n}\n"
  },
  {
    "path": "examples/installation/build.rb",
    "content": "#!/usr/bin/env ruby\n\nrequire 'fileutils'\n\ndef usage()\n  puts <<~END\n    Usage: ruby #{__FILE__} test-all\n    Usage: ruby #{__FILE__} platform method [linkage]\n\n    platform:\n      ios\n      osx\n      tvos\n      visionos\n      watchos\n\n    method:\n      cocoapods\n      carthage\n      spm\n      xcframework\n\n    linkage:\n      static\n      dynamic (default)\n\n    environment variables:\n      REALM_XCODE_VERSION: Xcode version to use\n      REALM_TEST_RELEASE: Version number to test, or \"latest\" to test the latest release\n      REALM_TEST_BRANCH: Name of a branch to test\n  END\n  exit 1\nend\nusage unless ARGV.length >= 1\n\ndef read_setting(name)\n  `sh -c 'source ../../scripts/swift-version.sh; set_xcode_version; echo \"$#{name}\"'`.chomp()\nend\n\nENV['DEVELOPER_DIR'] = read_setting 'DEVELOPER_DIR'\nENV['REALM_XCODE_VERSION'] ||= read_setting 'REALM_XCODE_VERSION'\n\nif ENV['REALM_TEST_RELEASE'] == 'latest'\n  ENV['REALM_TEST_RELEASE'] = `curl --silent https://static.realm.io/update/cocoa`\nend\n\nTEST_RELEASE = ENV['REALM_TEST_RELEASE']\nTEST_BRANCH = ENV['REALM_TEST_BRANCH']\nXCODE_VERSION = ENV['REALM_XCODE_VERSION']\nREALM_CORE_VERSION = ENV['REALM_CORE_VERSION']\n\nDEPENDENCIES = File.open(\"../../dependencies.list\").map { |line| line.chomp.split(\"=\") }.to_h\n\ndef replace_in_file(filepath, *args)\n  contents = File.read(filepath)\n  File.open(filepath, \"w\") do |file|\n    args.each_slice(2) { |pattern, replacement|\n      contents = contents.gsub pattern, replacement\n    }\n    file.puts contents\n  end\nend\n\ndef sh(*args)\n  system(*args) or exit(1)\nend\n\n# Copy a xcframework to the location which the installation example looks. This\n# shells out to `cp` because Ruby currently doesn't have native bindings for\n# clonefile-based copying.\ndef copy_xcframework(path, framework, dir = '')\n  FileUtils.mkdir_p \"../../build/#{dir}\"\n  FileUtils.rm_rf \"../../build/#{dir}/#{framework}.xcframework\"\n\n  source = \"#{path}/#{framework}.xcframework\"\n  if not Dir.exist? source\n    raise \"Missing XCFramework to test at '#{source}'\"\n  end\n\n  puts \"Copying xcframework from #{source} into ../../build/#{dir}\"\n  sh 'cp', '-cR', source, \"../../build/#{dir}\"\nend\n\ndef download_release(version)\n  # Download and extract the zip if the extracted directory doesn't already\n  # exist. For master-push workflow testing, we already downloaded a local copy of the zip that\n  # just needs to be extracted.\n  unless Dir.exist? \"realm-swift-#{version}\"\n    unless File.exist? \"realm-swift-#{version}.zip\"\n      sh 'curl', '-OL', \"https://github.com/realm/realm-swift/releases/download/v#{version}/realm-swift-#{version}.zip\"\n    end\n    sh 'unzip', \"realm-swift-#{version}.zip\"\n    FileUtils.rm \"realm-swift-#{version}.zip\"\n  end\n\n  unless Dir.exist?(\"realm-swift-#{version}/#{XCODE_VERSION}\")\n    raise \"No build for Xcode version #{XCODE_VERSION} found in #{version} release package\"\n  end\n\n  copy_xcframework \"realm-swift-#{version}\", 'Realm'\n  copy_xcframework \"realm-swift-#{version}/static\", 'Realm', 'Static'\n  copy_xcframework \"realm-swift-#{version}/#{XCODE_VERSION}\", 'RealmSwift'\nend\n\ndef download_realm(platform, method, static)\n  case method\n  when 'cocoapods'\n    # The podfile takes care of reading the env variables and importing the\n    # correct thing\n    ENV['REALM_PLATFORM'] = platform\n    sh 'pod', 'install'\n\n  when 'carthage'\n    version = if TEST_RELEASE\n      \" == #{TEST_RELEASE}\"\n    elsif TEST_BRANCH\n      \" \\\"#{TEST_BRANCH}\\\"\"\n    else\n      ''\n    end\n    File.write 'Cartfile', 'github \"realm/realm-swift\"' + version\n\n    platformName = case platform\n                   when 'ios' then 'iOS'\n                   when 'osx' then 'Mac'\n                   when 'tvos' then 'tvOS'\n                   when 'watchos' then 'watchOS'\n                   else raise \"Unsupported platform for Carthage: #{platform}\"\n                   end\n    sh 'carthage', 'update', '--use-xcframeworks', '--platform', platformName\n\n  when 'spm'\n    project = static ? 'SwiftPackageManager' : 'SwiftPackageManagerDynamic'\n    # We have to hide the spm example from carthage because otherwise\n    # it'll fetch the example's package dependencies as part of deciding\n    # what to build from this repo.\n    unless File.symlink? \"#{project}.xcodeproj/project.pbxproj\"\n      FileUtils.mkdir_p \"#{project}.xcodeproj\"\n      File.symlink \"../#{project}.notxcodeproj/project.pbxproj\",\n                 \"#{project}.xcodeproj/project.pbxproj\"\n    end\n\n    # Update the XcodeProj to reference the requested branch or version\n    if TEST_RELEASE\n      replace_in_file \"#{project}.xcodeproj/project.pbxproj\",\n        /(branch|version) = .*;/, \"version = #{TEST_RELEASE};\",\n      /kind = .*;/, \"kind = exactVersion;\"\n    elsif TEST_BRANCH\n      replace_in_file \"#{project}.xcodeproj/project.pbxproj\",\n      /(branch|version) = .*;/, \"branch = #{TEST_BRANCH};\",\n      /kind = .*;/, \"kind = branch;\"\n    end\n\n    sh 'xcodebuild', '-project', \"#{project}.xcodeproj\", '-resolvePackageDependencies', '-IDEPackageOnlyUseVersionsFromResolvedFile=NO', '-IDEDisableAutomaticPackageResolution=NO'\n\n  when 'xcframework'\n    # If we're testing a branch then we should already have a built zip\n    # supplied by Github actions, but we need to know what version tag it has. If\n    # we're testing a release, we'll download the zip.\n    version = TEST_BRANCH ? DEPENDENCIES['VERSION'] : TEST_RELEASE\n    if version\n      download_release version\n    else\n      if static\n        copy_xcframework \"../../build/Static/#{platform}\", 'Realm', 'Static'\n      else\n        copy_xcframework \"../../build/Release/#{platform}\", 'Realm'\n        copy_xcframework \"../../build/Release/#{platform}\", 'RealmSwift'\n      end\n    end\n\n  else\n    usage\n  end\nend\n\ndef build_app(platform, method, static)\n  archive_path = \"#{Dir.pwd}/out.xcarchive\"\n  FileUtils.rm_rf archive_path\n\n  build_args = ['clean', 'archive', '-archivePath', archive_path]\n  case platform\n  when 'ios'\n    build_args += ['-sdk', 'iphoneos', '-destination', 'generic/platform=iphoneos']\n  when 'tvos'\n    build_args += ['-sdk', 'appletvos', '-destination', 'generic/platform=appletvos']\n  when 'watchos'\n    build_args += ['-sdk', 'watchos', '-destination', 'generic/platform=watchos']\n  when 'osx'\n    build_args += ['-sdk', 'macosx', '-destination', 'generic/platform=macOS']\n  when 'catalyst'\n    build_args += ['-destination', 'generic/platform=macOS,variant=Mac Catalyst']\n  end\n  build_args += ['CODE_SIGN_IDENTITY=', 'CODE_SIGNING_REQUIRED=NO', 'AD_HOC_CODE_SIGNING_ALLOWED=YES']\n\n  case method\n  when 'cocoapods'\n    sh 'xcodebuild', '-workspace', 'CocoaPods.xcworkspace', '-scheme', 'App', *build_args\n\n  when 'carthage'\n    sh 'xcodebuild', '-project', 'Carthage.xcodeproj', '-scheme', 'App', *build_args\n\n  when 'spm'\n    sh 'xcodebuild', '-project', static ? 'SwiftPackageManager.xcodeproj' : 'SwiftPackageManagerDynamic.xcodeproj', '-scheme', 'App', *build_args\n\n  when 'xcframework'\n    if static\n      sh 'xcodebuild', '-project', 'Static/StaticExample.xcodeproj', '-scheme', 'StaticExample', *build_args\n    else\n      sh 'xcodebuild', '-project', 'XCFramework.xcodeproj', '-scheme', 'App', *build_args\n    end\n  end\nend\n\ndef validate_build(static)\n  has_frameworks = Dir[\"out.xcarchive/Products/Applications/**/Frameworks/*.framework\"].length != 0\n  if has_frameworks and static\n    raise 'Static build configuration has embedded frameworks'\n  elsif not has_frameworks and not static\n    raise 'Dyanmic build configuration is missing embedded frameworks'\n  end\nend\n\ndef test(platform, method, linkage = 'dynamic')\n  static = linkage == 'static'\n  if static\n    ENV['REALM_BUILD_STATIC'] = '1'\n  else\n    ENV.delete 'REALM_BUILD_STATIC'\n  end\n\n  puts \"Testing #{method} for #{platform} and #{linkage}\"\n\n  download_realm(platform, method, static)\n  build_app(platform, method, static)\n  validate_build(static)\nend\n\nif ARGV[0] == 'test-all'\n  platforms = ['ios', 'osx', 'tvos', 'watchos', 'catalyst']\n  if /15\\..*/ =~ XCODE_VERSION\n    platforms += ['visionos']\n  end\n\n  for platform in platforms\n    for method in ['cocoapods', 'carthage', 'spm', 'xcframework']\n      next if platform == 'catalyst' && method == 'carthage'\n      next if platform == 'visionos' && method != 'spm' && method != 'xcframework'\n      test platform, method, 'dynamic'\n    end\n\n    test platform, 'cocoapods', 'static' unless platform == 'visionos'\n    test platform, 'spm', 'static'\n  end\n\n  test 'ios', 'xcframework', 'static'\n\nelse\n  test(*ARGV)\nend\n"
  },
  {
    "path": "examples/ios/objc/.gitignore",
    "content": "Pods/\n"
  },
  {
    "path": "examples/ios/objc/Backlink/AppDelegate.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n@interface AppDelegate : UIResponder <UIApplicationDelegate>\n\n@property (strong, nonatomic) UIWindow *window;\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/Backlink/AppDelegate.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"AppDelegate.h\"\n#import <Realm/Realm.h>\n\n// Define your models\n@interface Dog : RLMObject\n@property NSString *name;\n@property NSInteger age;\n@property (readonly) RLMLinkingObjects *owners;\n@end\nRLM_COLLECTION_TYPE(Dog)\n\n@interface Person : RLMObject\n@property NSString      *name;\n@property RLMArray<Dog> *dogs;\n@end\n\n@implementation Person\n@end\n\n@implementation Dog\n+ (NSDictionary *)linkingObjectsProperties\n{\n    // Define \"owners\" as the inverse relationship to Person.dogs\n    return @{ @\"owners\": [RLMPropertyDescriptor descriptorWithClass:Person.class propertyName:@\"dogs\"] };\n}\n@end\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{\n    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];\n    self.window.rootViewController = [[UIViewController alloc] init];\n    [self.window makeKeyAndVisible];\n\n    [[NSFileManager defaultManager] removeItemAtURL:[RLMRealmConfiguration defaultConfiguration].fileURL error:nil];\n\n    RLMRealm *realm = [RLMRealm defaultRealm];\n    [realm transactionWithBlock:^{\n        [Person createInRealm:realm withValue:@[@\"John\", @[@[@\"Fido\", @1]]]];\n        [Person createInRealm:realm withValue:@[@\"Mary\", @[@[@\"Rex\", @2]]]];\n    }];\n\n    // Log all dogs and their owners using the \"owners\" inverse relationship\n    RLMResults *allDogs = [Dog allObjects];\n    for (Dog *dog in allDogs) {\n        NSArray *ownerNames = [dog.owners valueForKeyPath:@\"name\"];\n        NSLog(@\"%@ has %lu owners (%@)\", dog.name, (unsigned long)ownerNames.count, ownerNames);\n    }\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/Backlink/Backlink-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleDisplayName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1.0</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/objc/Backlink/main.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n#import \"AppDelegate.h\"\n\nint main(int argc, char * argv[])\n{\n    @autoreleasepool {\n        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));\n    }\n}\n"
  },
  {
    "path": "examples/ios/objc/Common/LaunchScreen.xib",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.XIB\" version=\"3.0\" toolsVersion=\"10116\" systemVersion=\"15F18b\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" launchScreen=\"YES\" useTraitCollections=\"YES\">\n    <dependencies>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"10085\"/>\n        <capability name=\"Constraints with non-1.0 multipliers\" minToolsVersion=\"5.1\"/>\n    </dependencies>\n    <objects>\n        <placeholder placeholderIdentifier=\"IBFilesOwner\" id=\"-1\" userLabel=\"File's Owner\"/>\n        <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"-2\" customClass=\"UIResponder\"/>\n        <view contentMode=\"scaleToFill\" id=\"iN0-l3-epB\">\n            <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"480\" height=\"480\"/>\n            <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n            <subviews>\n                <label opaque=\"NO\" clipsSubviews=\"YES\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"  Copyright (c) 2016 Realm. All rights reserved.\" textAlignment=\"center\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" minimumFontSize=\"9\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"8ie-xW-0ye\">\n                    <rect key=\"frame\" x=\"20\" y=\"439\" width=\"441\" height=\"21\"/>\n                    <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"17\"/>\n                    <color key=\"textColor\" red=\"0.0\" green=\"0.0\" blue=\"0.0\" alpha=\"1\" colorSpace=\"calibratedRGB\"/>\n                    <nil key=\"highlightedColor\"/>\n                    <variation key=\"widthClass=compact\">\n                        <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"11\"/>\n                    </variation>\n                </label>\n                <label opaque=\"NO\" clipsSubviews=\"YES\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"RealmExamples\" textAlignment=\"center\" lineBreakMode=\"middleTruncation\" baselineAdjustment=\"alignBaselines\" minimumFontSize=\"18\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"kId-c2-rCX\">\n                    <rect key=\"frame\" x=\"20\" y=\"140\" width=\"441\" height=\"43\"/>\n                    <fontDescription key=\"fontDescription\" type=\"boldSystem\" pointSize=\"36\"/>\n                    <color key=\"textColor\" red=\"0.0\" green=\"0.0\" blue=\"0.0\" alpha=\"1\" colorSpace=\"calibratedRGB\"/>\n                    <nil key=\"highlightedColor\"/>\n                </label>\n            </subviews>\n            <color key=\"backgroundColor\" white=\"1\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"calibratedWhite\"/>\n            <constraints>\n                <constraint firstItem=\"kId-c2-rCX\" firstAttribute=\"centerY\" secondItem=\"iN0-l3-epB\" secondAttribute=\"bottom\" multiplier=\"1/3\" constant=\"1\" id=\"Kid-kn-2rF\"/>\n                <constraint firstAttribute=\"centerX\" secondItem=\"kId-c2-rCX\" secondAttribute=\"centerX\" id=\"Koa-jz-hwk\"/>\n                <constraint firstAttribute=\"bottom\" secondItem=\"8ie-xW-0ye\" secondAttribute=\"bottom\" constant=\"20\" id=\"Kzo-t9-V3l\"/>\n                <constraint firstItem=\"8ie-xW-0ye\" firstAttribute=\"leading\" secondItem=\"iN0-l3-epB\" secondAttribute=\"leading\" constant=\"20\" symbolic=\"YES\" id=\"MfP-vx-nX0\"/>\n                <constraint firstAttribute=\"centerX\" secondItem=\"8ie-xW-0ye\" secondAttribute=\"centerX\" id=\"ZEH-qu-HZ9\"/>\n                <constraint firstItem=\"kId-c2-rCX\" firstAttribute=\"leading\" secondItem=\"iN0-l3-epB\" secondAttribute=\"leading\" constant=\"20\" symbolic=\"YES\" id=\"fvb-Df-36g\"/>\n            </constraints>\n            <nil key=\"simulatedStatusBarMetrics\"/>\n            <freeformSimulatedSizeMetrics key=\"simulatedDestinationMetrics\"/>\n            <point key=\"canvasLocation\" x=\"404\" y=\"445\"/>\n        </view>\n    </objects>\n</document>\n"
  },
  {
    "path": "examples/ios/objc/Encryption/AppDelegate.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n@interface AppDelegate : UIResponder <UIApplicationDelegate>\n\n@property (strong, nonatomic) UIWindow *window;\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/Encryption/AppDelegate.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"AppDelegate.h\"\n\n#import \"LabelViewController.h\"\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{\n    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];\n    self.window.rootViewController = [[LabelViewController alloc] init];\n    [self.window makeKeyAndVisible];\n\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/Encryption/Encryption-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleDisplayName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1.0</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/objc/Encryption/LabelViewController.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n@interface LabelViewController : UIViewController\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/Encryption/LabelViewController.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"LabelViewController.h\"\n\n#import <Realm/Realm.h>\n#import <Security/Security.h>\n\n// Model definition\n@interface StringObject : RLMObject\n@property NSString *stringProp;\n@end\n\n@implementation StringObject\n// Nothing needed\n@end\n\n@interface LabelViewController ()\n@property (nonatomic, strong) UITextView *textView;\n@end\n\n@implementation LabelViewController\n// Create a view to display output in\n- (void)loadView {\n    CGRect applicationFrame = [[UIScreen mainScreen] applicationFrame];\n    UIView *contentView = [[UIView alloc] initWithFrame:applicationFrame];\n    contentView.backgroundColor = [UIColor whiteColor];\n    self.view = contentView;\n\n    self.textView = [[UITextView alloc] initWithFrame:applicationFrame];\n    [self.view addSubview:self.textView];\n}\n\n- (void)viewDidAppear:(BOOL)animated {\n    [super viewDidAppear:animated];\n\n    // Use an autorelease pool to close the Realm at the end of the block, so\n    // that we can try to reopen it with different keys\n    @autoreleasepool {\n        RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n        configuration.encryptionKey = [self getKey];\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:configuration\n                                                     error:nil];\n\n        // Add an object\n        [realm beginWriteTransaction];\n        StringObject *obj = [[StringObject alloc] init];\n        obj.stringProp = @\"abcd\";\n        [realm addObject:obj];\n        [realm commitWriteTransaction];\n    }\n\n    // Opening with wrong key fails since it decrypts to the wrong thing\n    @autoreleasepool {\n        uint8_t buffer[64];\n        int status = SecRandomCopyBytes(kSecRandomDefault, 64, buffer);\n        NSAssert(status == 0, @\"Failed to generate random bytes for key\");\n        (void)status;\n\n        NSError *error;\n        RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n        configuration.encryptionKey = [[NSData alloc] initWithBytes:buffer length:sizeof(buffer)];\n        [RLMRealm realmWithConfiguration:configuration\n                                   error:&error];\n        [self log:@\"Open with wrong key: %@\", error];\n    }\n\n    // Opening wihout supplying a key at all fails\n    @autoreleasepool {\n        NSError *error;\n        [RLMRealm realmWithConfiguration:[RLMRealmConfiguration defaultConfiguration] error:&error];\n        [self log:@\"Open with no key: %@\", error];\n    }\n\n    // Reopening with the correct key works and can read the data\n    @autoreleasepool {\n        RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n        configuration.encryptionKey = [self getKey];\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:configuration\n                                                     error:nil];\n\n        [self log:@\"Saved object: %@\", [[[StringObject allObjectsInRealm:realm] firstObject] stringProp]];\n    }\n}\n\n// Log a message to the screen since we can't just use NSLog() with no debugger attached\n- (void)log:(NSString *)format, ... {\n    va_list args;\n    va_start(args, format);\n    NSString *str = [[NSString alloc] initWithFormat:format arguments:args];\n    va_end(args);\n    self.textView.text = [[self.textView.text\n                           stringByAppendingString:str]\n                           stringByAppendingString:@\"\\n\\n\"];\n}\n\n- (NSData *)getKey {\n    // Identifier for our keychain entry - should be unique for your application\n    static const uint8_t kKeychainIdentifier[] = \"io.Realm.EncryptionExampleKey\";\n    NSData *tag = [[NSData alloc] initWithBytesNoCopy:(void *)kKeychainIdentifier\n                                               length:sizeof(kKeychainIdentifier)\n                                         freeWhenDone:NO];\n\n    // First check in the keychain for an existing key\n    NSDictionary *query = @{(__bridge id)kSecClass: (__bridge id)kSecClassKey,\n                            (__bridge id)kSecAttrApplicationTag: tag,\n                            (__bridge id)kSecAttrKeySizeInBits: @512,\n                            (__bridge id)kSecReturnData: @YES};\n\n    CFTypeRef dataRef = NULL;\n    OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, &dataRef);\n    if (status == errSecSuccess) {\n        return (__bridge NSData *)dataRef;\n    }\n\n    // No pre-existing key from this application, so generate a new one\n    uint8_t buffer[64];\n    status = SecRandomCopyBytes(kSecRandomDefault, 64, buffer);\n    NSAssert(status == 0, @\"Failed to generate random bytes for key\");\n    NSData *keyData = [[NSData alloc] initWithBytes:buffer length:sizeof(buffer)];\n\n    // Store the key in the keychain\n    query = @{(__bridge id)kSecClass: (__bridge id)kSecClassKey,\n              (__bridge id)kSecAttrApplicationTag: tag,\n              (__bridge id)kSecAttrKeySizeInBits: @512,\n              (__bridge id)kSecValueData: keyData};\n\n    status = SecItemAdd((__bridge CFDictionaryRef)query, NULL);\n    NSAssert(status == errSecSuccess, @\"Failed to insert new key in the keychain\");\n\n    return keyData;\n}\n@end\n"
  },
  {
    "path": "examples/ios/objc/Encryption/main.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n#import \"AppDelegate.h\"\n\nint main(int argc, char * argv[])\n{\n    @autoreleasepool {\n        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));\n    }\n}\n"
  },
  {
    "path": "examples/ios/objc/Extension/AppDelegate.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n@interface AppDelegate : UIResponder <UIApplicationDelegate>\n\n@property (strong, nonatomic) UIWindow *window;\n\n\n@end\n\n"
  },
  {
    "path": "examples/ios/objc/Extension/AppDelegate.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"AppDelegate.h\"\n#import \"Tick.h\"\n\n@interface TickViewController : UIViewController\n\n@property (nonatomic, strong) UIButton *button;\n@property (nonatomic, strong) Tick *tick;\n@property (nonatomic, strong) RLMNotificationToken *notificationToken;\n\n@end\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = [[[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:@\"group.io.realm.examples.extension\"] URLByAppendingPathComponent:@\"extension.realm\"];\n    [RLMRealmConfiguration setDefaultConfiguration:configuration];\n    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];\n    self.window.rootViewController = [[TickViewController alloc] init];\n    [self.window makeKeyAndVisible];\n    return YES;\n}\n\n@end\n\n@implementation TickViewController\n\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    self.tick = [Tick allObjects].firstObject;\n    if (!self.tick) {\n        [[RLMRealm defaultRealm] transactionWithBlock:^{\n            self.tick = [Tick createInDefaultRealmWithValue:@[@\"\", @0]];\n        }];\n    }\n    self.notificationToken = [self.tick.realm addNotificationBlock:^(NSString *notification, RLMRealm *realm) {\n        // Occasionally, respond immediately to the notification by triggering a new notification.\n        if (self.tick.count % 13 == 0) {\n            [self tock];\n        }\n        [self updateLabel];\n    }];\n    self.button = [UIButton buttonWithType:UIButtonTypeSystem];\n    self.button.frame = self.view.bounds;\n    [self.button addTarget:self action:@selector(tock) forControlEvents:UIControlEventTouchUpInside];\n    self.button.titleLabel.textAlignment = NSTextAlignmentCenter;\n    [self.button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];\n    [self.view addSubview:self.button];\n    self.view.backgroundColor = [UIColor purpleColor];\n    [self updateLabel];\n}\n\n- (void)viewWillAppear:(BOOL)animated {\n    [super viewWillAppear:animated];\n    self.button.frame = self.view.bounds;\n    [self updateLabel];\n}\n\n- (void)viewDidAppear:(BOOL)animated {\n    [super viewDidAppear:animated];\n    [self tock];\n    [self updateLabel];\n}\n\n- (void)updateLabel {\n    [self.button setTitle:@(self.tick.count).stringValue forState:UIControlStateNormal];\n}\n\n- (void)tock {\n    [[RLMRealm defaultRealm] transactionWithBlock:^{\n        self.tick.count++;\n    }];\n}\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/Extension/Extension.entitlements",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>com.apple.security.application-groups</key>\n\t<array>\n\t\t<string>group.io.realm.examples.extension</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/objc/Extension/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleDisplayName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1.0</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/objc/Extension/Tick.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/Realm.h>\n\n@interface Tick : RLMObject\n\n@property (nonatomic, strong) NSString *tickID;\n\n@property (nonatomic, assign) NSInteger count;\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/Extension/Tick.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"Tick.h\"\n\n@implementation Tick\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/Extension/main.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n#import \"AppDelegate.h\"\n\nint main(int argc, char * argv[])\n{\n    @autoreleasepool {\n        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));\n    }\n}\n"
  },
  {
    "path": "examples/ios/objc/GroupedTableView/AppDelegate.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n@interface AppDelegate : UIResponder <UIApplicationDelegate>\n\n@property (strong, nonatomic) UIWindow *window;\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/GroupedTableView/AppDelegate.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"AppDelegate.h\"\n#import \"TableViewController.h\"\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{\n    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];\n\n    self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:\n                                      [[TableViewController alloc] initWithStyle:UITableViewStylePlain]];\n    [self.window makeKeyAndVisible];\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/GroupedTableView/Images.xcassets/AppIcon.appiconset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"60x60\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"76x76\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"76x76\",\n      \"scale\" : \"2x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/ios/objc/GroupedTableView/Images.xcassets/LaunchImage.launchimage/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"iphone\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"iphone\",\n      \"subtype\" : \"retina4\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"ipad\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"orientation\" : \"landscape\",\n      \"idiom\" : \"ipad\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"ipad\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"orientation\" : \"landscape\",\n      \"idiom\" : \"ipad\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"2x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/ios/objc/GroupedTableView/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleDisplayName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1.0</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations~ipad</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationPortraitUpsideDown</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/objc/GroupedTableView/TableViewController.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n@interface TableViewController : UITableViewController\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/GroupedTableView/TableViewController.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"TableViewController.h\"\n#import <Realm/Realm.h>\n\n// Realm model object\n@interface DemoObject : RLMObject\n@property NSString *phoneNumber;\n@property NSDate   *date;\n@property NSString *contactName;\n@end\n\n@implementation DemoObject\n// None needed\n@end\n\nstatic NSString * const kCellID    = @\"cell\";\nstatic NSString * const kTableName = @\"table\";\n\n@interface TableViewController ()\n\n@property (nonatomic, strong) RLMSectionedResults<NSString *, DemoObject *> *sectionedResults;\n@property (nonatomic, strong) RLMNotificationToken *notification;\n\n@end\n\n@implementation TableViewController\n\n#pragma mark - View Lifecycle\n\n- (void)viewDidLoad\n{\n    [super viewDidLoad];\n    // Section Titles\n    [self setupUI];\n\n    self.sectionedResults = [[DemoObject allObjects] sectionedResultsSortedUsingKeyPath:@\"contactName\"\n                                                                              ascending:YES\n                                                                               keyBlock:^(DemoObject *object) {\n        return [object.contactName substringToIndex:1];\n    }];\n\n    // Set realm notification block\n    __weak typeof(self) weakSelf = self;\n    self.notification = [self.sectionedResults addNotificationBlock:^(RLMSectionedResults<NSString *, DemoObject *> *col,\n                                                                      RLMSectionedResultsChange *changes) {\n        if (changes) {\n            [weakSelf.tableView performBatchUpdates:^{\n                [weakSelf.tableView deleteRowsAtIndexPaths:changes.deletions withRowAnimation:UITableViewRowAnimationAutomatic];\n                [weakSelf.tableView insertRowsAtIndexPaths:changes.insertions withRowAnimation:UITableViewRowAnimationAutomatic];\n                [weakSelf.tableView reloadRowsAtIndexPaths:changes.modifications withRowAnimation:UITableViewRowAnimationAutomatic];\n                [weakSelf.tableView insertSections:changes.sectionsToInsert withRowAnimation:UITableViewRowAnimationAutomatic];\n                [weakSelf.tableView deleteSections:changes.sectionsToRemove withRowAnimation:UITableViewRowAnimationAutomatic];\n            } completion:^(BOOL finished) {\n                // Noop\n            }];\n        }\n    }];\n\n    [self.tableView reloadData];\n}\n\n#pragma mark - UI\n\n- (void)setupUI\n{\n    self.title = @\"GroupedTableView\";\n    self.navigationItem.leftBarButtonItem =\n    [[UIBarButtonItem alloc] initWithTitle:@\"BG Add\"\n                                     style:UIBarButtonItemStylePlain\n                                    target:self\n                                    action:@selector(backgroundAdd)];\n    self.navigationItem.rightBarButtonItem =\n    [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd\n                                                  target:self\n                                                  action:@selector(add)];\n}\n\n#pragma mark - UITableViewDataSource\n\n- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView\n{\n    return self.sectionedResults.count;\n}\n\n- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section\n{\n    return self.sectionedResults[section].key;\n}\n\n- (NSArray<NSString *> *)sectionIndexTitlesForTableView:(UITableView *)tableView\n{\n    return self.sectionedResults.allKeys;\n}\n\n- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section\n{\n    return self.sectionedResults[section].count;\n}\n\n- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath\n{\n    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellID];\n\n    if (!cell) {\n        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle\n                                      reuseIdentifier:kCellID];\n    }\n\n    DemoObject *object = self.sectionedResults[indexPath.section][indexPath.row];\n    cell.textLabel.text = [NSString stringWithFormat:@\"%@: %@\", object.contactName, object.phoneNumber];\n    cell.detailTextLabel.text = object.date.description;\n\n    return cell;\n}\n\n- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle\nforRowAtIndexPath:(NSIndexPath *)indexPath\n{\n    if (editingStyle == UITableViewCellEditingStyleDelete) {\n        RLMRealm *realm = RLMRealm.defaultRealm;\n        [realm beginWriteTransaction];\n        DemoObject *object = self.sectionedResults[indexPath.section][indexPath.row];\n        [realm deleteObject:object];\n        [realm commitWriteTransaction];\n    }\n}\n\n#pragma mark - Actions\n\n- (void)backgroundAdd\n{\n    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);\n    // Import many items in a background thread\n    dispatch_async(queue, ^{\n        // Get new realm and table since we are in a new thread\n        @autoreleasepool {\n            RLMRealm *realm = [RLMRealm defaultRealm];\n            [realm beginWriteTransaction];\n            for (NSInteger index = 0; index < 5; index++) {\n                // Add row via dictionary. Order is ignored.\n                [DemoObject createInRealm:realm withValue:@{@\"phoneNumber\": [self randomContactInfo],\n                                                             @\"date\": [NSDate date],\n                                                             @\"contactName\": [self randomContactName]}];\n            }\n            [realm commitWriteTransaction];\n        }\n    });\n}\n\n- (void)add\n{\n    [[RLMRealm defaultRealm] transactionWithBlock:^{\n        [DemoObject createInDefaultRealmWithValue:@[[self randomContactInfo], [NSDate date], [self randomContactName]]];\n    }];\n}\n\n#pragma - Helpers\n\n- (NSInteger)randomNumberBetween:(NSInteger)min maxNumber:(NSInteger)max\n{\n    return min + arc4random_uniform((uint32_t)(max - min + 1));\n}\n\n- (NSString *)randomContactInfo\n{\n    NSInteger rand1 = [self randomNumberBetween:0 maxNumber:9];\n    NSInteger rand2 = [self randomNumberBetween:0 maxNumber:9];\n    NSInteger rand3 = [self randomNumberBetween:0 maxNumber:9];\n    return [NSString stringWithFormat:@\"555-55%ld-%ld%ld55\", (long)rand1, rand2, rand3];\n}\n\n- (NSString *)randomContactName\n{\n    NSArray *names = @[@\"John\", @\"Mary\", @\"Fred\", @\"Sarah\", @\"Sally\", @\"James\"];\n    return [names objectAtIndex:arc4random()%[names count]];\n}\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/GroupedTableView/main.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n#import \"AppDelegate.h\"\n\nint main(int argc, char * argv[])\n{\n    @autoreleasepool {\n        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));\n    }\n}\n"
  },
  {
    "path": "examples/ios/objc/Migration/AppDelegate.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n@interface AppDelegate : UIResponder <UIApplicationDelegate>\n\n@property (strong, nonatomic) UIWindow *window;\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/Migration/AppDelegate.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"AppDelegate.h\"\n#import <Realm/Realm.h>\n#import \"Example_v0.h\"\n#import \"Example_v1.h\"\n#import \"Example_v2.h\"\n#import \"Example_v3.h\"\n#import \"Example_v4.h\"\n#import \"Example_v5.h\"\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{\n    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];\n    self.window.rootViewController = [[UIViewController alloc] init];\n    [self.window makeKeyAndVisible];\n    \n    #if CREATE_EXAMPLES\n    [self addExampleDataToRealm:exampleData];\n    #else\n    [self performMigration];\n    #endif\n    \n    return YES;\n}\n\n- (void)addExampleDataToRealm:(void (^)(RLMRealm*))examplesData {\n    NSURL *url = [self realmUrlFor:schemaVersion usingTemplate:false];\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = url;\n    configuration.schemaVersion = schemaVersion;\n    [RLMRealmConfiguration setDefaultConfiguration:configuration];\n    NSError *error;\n    RLMRealm *realm = [RLMRealm realmWithConfiguration:configuration error:&error];\n    if (error) {\n        @throw [NSException exceptionWithName:@\"RLMExampleException\" reason:@\"Could not open realm.\" userInfo:nil];\n    }\n    [realm beginWriteTransaction];\n    exampleData(realm);\n    [realm commitWriteTransaction];\n}\n\n// Any version before the current versions will be migrated to check if all version combinations work.\n- (void)performMigration {\n    for (NSInteger oldSchemaVersion = 0; oldSchemaVersion < schemaVersion; oldSchemaVersion++) {\n        NSURL *realmUrl = [self realmUrlFor:oldSchemaVersion usingTemplate:true];\n        RLMRealmConfiguration *realmConfiguration = [RLMRealmConfiguration defaultConfiguration];\n        realmConfiguration.fileURL = realmUrl;\n        realmConfiguration.schemaVersion = schemaVersion;\n        realmConfiguration.migrationBlock = migrationBlock;\n        [RLMRealmConfiguration setDefaultConfiguration:realmConfiguration];\n        NSError *error;\n        [RLMRealm performMigrationForConfiguration:realmConfiguration error:&error];\n        if (error) {\n            @throw [NSException exceptionWithName:@\"RLMExampleException\" reason:@\"Could not migrate realm.\" userInfo:nil];\n        }\n        RLMRealm *realm = [RLMRealm realmWithConfiguration:realmConfiguration error:&error];\n        if (error) {\n            @throw [NSException exceptionWithName:@\"RLMExampleException\" reason:@\"Could not open realm.\" userInfo:nil];\n        }\n        migrationCheck(realm);\n    }\n}\n\n- (NSURL*)realmUrlFor:(NSInteger)schemaVersion usingTemplate:(BOOL)usingTemplate {\n    NSURL *defaultRealmURL = [RLMRealmConfiguration defaultConfiguration].fileURL;\n    NSURL *defaultRealmParentURL = [defaultRealmURL URLByDeletingLastPathComponent];\n    NSString *fileName = [NSString stringWithFormat:@\"default-v%ld\", schemaVersion];\n    NSString *fileExtension = @\"realm\";\n    NSString *fileNameWithExtension = [NSString stringWithFormat:@\"%@.%@\", fileName, fileExtension];\n    NSURL *destinationUrl = [defaultRealmParentURL URLByAppendingPathComponent:fileNameWithExtension];\n    if ([[NSFileManager defaultManager] fileExistsAtPath:destinationUrl.path]) {\n        NSError *error;\n        [[NSFileManager defaultManager] removeItemAtPath:destinationUrl.path error:&error];\n        if (error) {\n            @throw [NSException exceptionWithName:@\"RLMExampleException\" reason:@\"Could not remove realm file.\" userInfo:nil];\n        }\n    }\n    if (usingTemplate) {\n        NSURL *bundleUrl = [[NSBundle mainBundle] URLForResource:fileName withExtension:fileExtension];\n        NSError *error;\n        [[NSFileManager defaultManager] copyItemAtPath:bundleUrl.path toPath:destinationUrl.path error:&error];\n        if (error) {\n            @throw [NSException exceptionWithName:@\"RLMExampleException\" reason:@\"Could not copy realm template to new path.\" userInfo:nil];\n        }\n    }\n\n    return destinationUrl;\n}\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/Migration/Examples/Example_v0.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#ifndef SCHEMA_VERSION_0\n#define SCHEMA_VERSION_0 0\n#endif\n\n#if SCHEMA_VERSION_0\n\n#import <Foundation/Foundation.h>\n#import <Realm/Realm.h>\n\n#pragma mark - Schema\n\nNSInteger schemaVersion = 0;\n\n@interface Person : RLMObject\n@property NSString *firstName;\n@property NSString *lastName;\n@property NSInteger age;\n+ (Person *)personWithFirstName:(NSString *)firstName lastName:(NSString *)lastName age:(int)age;\n@end\n\n@implementation Person\n+ (Person *)personWithFirstName:(NSString *)firstName lastName:(NSString *)lastName age:(int)age {\n    Person *person = [[self alloc] init];\n    person.firstName = firstName;\n    person.lastName = lastName;\n    person.age = age;\n    return person;\n}\n+ (NSArray *)requiredProperties {\n    return @[@\"firstName\", @\"lastName\", @\"age\"];\n}\n@end\n\n#pragma mark - Migration\n\n// Migration block to migrate from *any* previous version to this version.\nRLMMigrationBlock migrationBlock = ^(RLMMigration* migration, uint64_t schemaVersion) {};\n\n// This block checks if the migration led to the expected result.\n// All older versions should have been migrated to the below stated `exampleData`.\ntypedef void (^MigrationCheck) (RLMRealm *realm);\nMigrationCheck migrationCheck = ^(RLMRealm *realm) {\n    RLMResults<Person *> *persons = [Person allObjects];\n    assert(persons.count == 3);\n    assert([persons[0].firstName isEqualToString:@\"John\"]);\n    assert([persons[0].lastName isEqualToString:@\"Doe\"]);\n    assert(persons[0].age == 42);\n    assert([persons[1].firstName isEqualToString:@\"Jane\"]);\n    assert([persons[1].lastName isEqualToString:@\"Doe\"]);\n    assert(persons[1].age == 43);\n    assert([persons[2].firstName isEqualToString:@\"John\"]);\n    assert([persons[2].lastName isEqualToString:@\"Smith\"]);\n    assert(persons[2].age == 44);\n};\n\n#pragma mark - Example data\n\n// Example data for this schema version.\ntypedef void (^ExampleData) (RLMRealm *realm);\nExampleData exampleData = ^(RLMRealm *realm) {\n    Person *person1 = [Person personWithFirstName:@\"John\" lastName:@\"Doe\" age:42];\n    Person *person2 = [Person personWithFirstName:@\"Jane\" lastName:@\"Doe\" age: 43];\n    Person *person3 = [Person personWithFirstName:@\"John\" lastName:@\"Smith\" age: 44];\n    [realm addObjects:@[person1, person2, person3]];\n};\n\n#endif\n"
  },
  {
    "path": "examples/ios/objc/Migration/Examples/Example_v1.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#ifndef SCHEMA_VERSION_1\n#define SCHEMA_VERSION_1 0\n#endif\n\n#if SCHEMA_VERSION_1\n\n#import <Foundation/Foundation.h>\n#import <Realm/Realm.h>\n\n#pragma mark - Schema\n\nNSInteger schemaVersion = 1;\n\n// Changes from previous version:\n// - combine `firstName` and `lastName` into `fullName`\n\n@interface Person : RLMObject\n@property NSString *fullName;\n@property NSInteger age;\n+ (Person *)personWithFullName:(NSString *)fullName age:(int)age;\n@end\n\n@implementation Person\n+ (Person *)personWithFullName:(NSString *)fullName age:(int)age {\n    Person *person = [[self alloc] init];\n    person.fullName = fullName;\n    person.age = age;\n    return person;\n}\n+ (NSArray *)requiredProperties {\n    return @[@\"fullName\", @\"age\"];\n}\n@end\n\n#pragma mark - Migration\n\n// Migration block to migrate from *any* previous version to this version.\nRLMMigrationBlock migrationBlock = ^(RLMMigration *migration, uint64_t oldSchemaVersion) {\n    if (oldSchemaVersion < 1) {\n        [migration enumerateObjects:Person.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            if (oldSchemaVersion < 1) {\n                // combine name fields into a single field\n                newObject[@\"fullName\"] = [NSString stringWithFormat:@\"%@ %@\", oldObject[@\"firstName\"], oldObject[@\"lastName\"]];\n            }\n        }];\n    }\n};\n\n// This block checks if the migration led to the expected result.\n// All older versions should have been migrated to the below stated `exampleData`.\ntypedef void (^MigrationCheck) (RLMRealm *realm);\nMigrationCheck migrationCheck = ^(RLMRealm *realm) {\n    RLMResults<Person *> *persons = [Person allObjects];\n    assert(persons.count == 3);\n    assert([persons[0].fullName isEqualToString:@\"John Doe\"]);\n    assert(persons[0].age == 42);\n    assert([persons[1].fullName isEqualToString:@\"Jane Doe\"]);\n    assert(persons[1].age == 43);\n    assert([persons[2].fullName isEqualToString:@\"John Smith\"]);\n    assert(persons[2].age == 44);\n};\n\n#pragma mark - Example data\n\n// Example data for this schema version.\ntypedef void (^ExampleData) (RLMRealm *realm);\nExampleData exampleData = ^(RLMRealm *realm) {\n    Person *person1 = [Person personWithFullName:@\"John Doe\" age: 42];\n    Person *person2 = [Person personWithFullName:@\"Jane Doe\" age: 43];\n    Person *person3 = [Person personWithFullName:@\"John Smith\" age: 44];\n    [realm addObjects:@[person1, person2, person3]];\n};\n\n#endif\n"
  },
  {
    "path": "examples/ios/objc/Migration/Examples/Example_v2.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#ifndef SCHEMA_VERSION_2\n#define SCHEMA_VERSION_2 0\n#endif\n\n#if SCHEMA_VERSION_2\n\n#import <Foundation/Foundation.h>\n#import <Realm/Realm.h>\n\n#pragma mark - Schema\n\nNSInteger schemaVersion = 2;\n\n// Changes from previous version:\n// add a `Dog` object\n// add a list of `dogs` to the `Person` object\n\n@interface Dog : RLMObject\n@property NSString *name;\n+ (Dog *)dogWithName:(NSString *)name;\n@end\nRLM_COLLECTION_TYPE(Dog)\n\n@implementation Dog\n+ (Dog *)dogWithName:(NSString *)name {\n    Dog *dog = [[self alloc] init];\n    dog.name = name;\n    return dog;\n}\n+ (NSArray *)requiredProperties {\n    return @[@\"name\"];\n}\n@end\n\n@interface Person : RLMObject\n@property NSString *fullName;\n@property NSInteger age;\n@property RLMArray<Dog *><Dog> *dogs;\n+ (Person *)personWithFullName:(NSString *)fullName age:(int)age;\n@end\n\n@implementation Person\n+ (Person *)personWithFullName:(NSString *)fullName age:(int)age {\n    Person *person = [[self alloc] init];\n    person.fullName = fullName;\n    person.age = age;\n    return person;\n}\n+ (NSArray *)requiredProperties {\n    return @[@\"fullName\", @\"age\"];\n}\n@end\n\n#pragma mark - Migration\n\n// Migration block to migrate from *any* previous version to this version.\nRLMMigrationBlock migrationBlock = ^(RLMMigration *migration, uint64_t oldSchemaVersion) {\n    if (oldSchemaVersion < 1) {\n        [migration enumerateObjects:Person.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            // combine name fields into a single field\n            newObject[@\"fullName\"] = [NSString stringWithFormat:@\"%@ %@\", oldObject[@\"firstName\"], oldObject[@\"lastName\"]];\n        }];\n    }\n    if (oldSchemaVersion < 2) {\n        [migration enumerateObjects:Person.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            // Add a pet to a specific person\n            if ([newObject[@\"fullName\"] isEqualToString:@\"John Doe\"]) {\n                Dog *marley = [Dog dogWithName:@\"Marley\"];\n                Dog *lassie = [Dog dogWithName:@\"Lassie\"];\n                RLMArray<Dog *><Dog> *dogs = newObject[@\"dogs\"];\n                [dogs addObject:marley];\n                [dogs addObject:lassie];\n            } else if ([newObject[@\"fullName\"] isEqualToString:@\"Jane Doe\"]) {\n                Dog *toto = [Dog dogWithName:@\"Toto\"];\n                RLMArray<Dog *><Dog> *dogs = newObject[@\"dogs\"];\n                [dogs addObject:toto];\n            }\n        }];\n        [migration createObject:Dog.className withValue:@[@\"Slinkey\"]];\n    }\n};\n\n// This block checks if the migration led to the expected result.\n// All older versions should have been migrated to the below stated `exampleData`.\ntypedef void (^MigrationCheck) (RLMRealm *realm);\nMigrationCheck migrationCheck = ^(RLMRealm *realm) {\n    RLMResults<Person *> *persons = [Person allObjects];\n    assert(persons.count == 3);\n    assert([persons[0].fullName isEqualToString:@\"John Doe\"]);\n    assert(persons[0].age == 42);\n    assert(persons[0].dogs.count == 2);\n    assert([persons[0].dogs[0].name isEqualToString:@\"Marley\"]);\n    assert([persons[0].dogs[1].name isEqualToString:@\"Lassie\"]);\n    assert([persons[1].fullName isEqualToString:@\"Jane Doe\"]);\n    assert(persons[1].age == 43);\n    assert(persons[1].dogs.count == 1);\n    assert([persons[1].dogs[0].name isEqualToString:@\"Toto\"]);\n    assert([persons[2].fullName isEqualToString:@\"John Smith\"]);\n    assert(persons[2].age == 44);\n    RLMResults *dogs = [Dog allObjects];\n    assert(dogs.count == 4);\n    assert([dogs objectsWithPredicate:[NSPredicate predicateWithFormat:@\"name == 'Slinkey'\"]].count == 1);\n};\n\n#pragma mark - Example data\n\n// Example data for this schema version.\ntypedef void (^ExampleData) (RLMRealm *realm);\nExampleData exampleData = ^(RLMRealm *realm) {\n    Person *person1 = [Person personWithFullName:@\"John Doe\" age: 42];\n    Person *person2 = [Person personWithFullName:@\"Jane Doe\" age: 43];\n    Person *person3 = [Person personWithFullName:@\"John Smith\" age: 44];\n    Dog *pet1 = [Dog dogWithName:@\"Marley\"];\n    Dog *pet2 = [Dog dogWithName:@\"Lassie\"];\n    Dog *pet3 = [Dog dogWithName:@\"Toto\"];\n    Dog *pet4 = [Dog dogWithName:@\"Slinkey\"];\n    [realm addObjects:@[person1, person2, person3]];\n    // pet1, pet2 and pet3 get added automatically by adding them to a list.\n    // pet4 has to be added manually though since it's not attached to a person yet.\n    [realm addObject:pet4];\n    [person1.dogs addObject:pet1];\n    [person1.dogs addObject:pet2];\n    [person2.dogs addObject:pet3];\n};\n\n#endif\n"
  },
  {
    "path": "examples/ios/objc/Migration/Examples/Example_v3.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#ifndef SCHEMA_VERSION_3\n#define SCHEMA_VERSION_3 0\n#endif\n\n#if SCHEMA_VERSION_3\n\n#import <Foundation/Foundation.h>\n#import <Realm/Realm.h>\n\n#pragma mark - Schema\n\nNSInteger schemaVersion = 3;\n\n// Changes from previous version:\n// rename the `Dog` object to `Pet`\n// add a `kind` property to `Pet`\n// change the `dogs` property on `Person`:\n// - rename to `pets`\n// - change type to `RLMArray<Pet *><Pet>`\n\n// Renaming tables is not supported yet: https://github.com/realm/realm-swift/issues/2491\n// The recommended way is to create a new type instead and migrate the old type.\n// Here we create `Pet` and migrate its data from `Dog` so simulate renaming the table.\n\n@interface Pet : RLMObject\ntypedef NS_ENUM(int, Kind) {\n    unspecified,\n    dog,\n    chicken,\n    cow\n};\n@property NSString *name;\n@property NSInteger kindValue;\n@property enum Kind kind;\n+ (Pet *)petWithName:(NSString *)name kind:(enum Kind)kind;\n@end\nRLM_COLLECTION_TYPE(Pet)\n\n@implementation Pet\n+ (Pet *)petWithName:(NSString *)name kind:(enum Kind)kind {\n    Pet *pet = [[self alloc] init];\n    pet.name = name;\n    pet.kind = kind;\n    return pet;\n}\n- (enum Kind)kind {\n    return (Kind)_kindValue;\n}\n- (void)setKind:(enum Kind)kind {\n    _kindValue = kind;\n}\n+ (NSArray *)requiredProperties {\n    return @[@\"name\", @\"kindValue\"];\n}\n+ (NSArray *)ignoredProperties {\n    return @[@\"kind\"];\n}\n@end\n\n@interface Person : RLMObject\n@property NSString *fullName;\n@property NSInteger age;\n@property RLMArray<Pet *><Pet> *pets;\n+ (Person *)personWithFullName:(NSString *)fullName age:(int)age;\n@end\n\n@implementation Person\n+ (Person *)personWithFullName:(NSString *)fullName age:(int)age {\n    Person *person = [[self alloc] init];\n    person.fullName = fullName;\n    person.age = age;\n    return person;\n}\n+ (NSArray *)requiredProperties {\n    return @[@\"fullName\", @\"age\"];\n}\n@end\n\n#pragma mark - Migration\n\n// Migration block to migrate from *any* previous version to this version.\nRLMMigrationBlock migrationBlock = ^(RLMMigration *migration, uint64_t oldSchemaVersion) {\n    if (oldSchemaVersion < 1) {\n        [migration enumerateObjects:Person.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            // combine name fields into a single field\n            newObject[@\"fullName\"] = [NSString stringWithFormat:@\"%@ %@\", oldObject[@\"firstName\"], oldObject[@\"lastName\"]];\n        }];\n    }\n    if (oldSchemaVersion < 2) {\n        [migration enumerateObjects:Person.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            // Add a pet to a specific person\n            if ([newObject[@\"fullName\"] isEqualToString:@\"John Doe\"]) {\n                // `Dog` was changed to `Pet` in v2 already, but we still need to account for this\n                // if upgrading from pre v2 to v3.\n                Pet *marley = [Pet petWithName:@\"Marley\" kind:dog];\n                Pet *lassie = [Pet petWithName:@\"Lassie\" kind:dog];\n                RLMArray<Pet *><Pet> *pets = newObject[@\"pets\"];\n                [pets addObject:marley];\n                [pets addObject:lassie];\n            } else if ([newObject[@\"fullName\"] isEqualToString:@\"Jane Doe\"]) {\n                Pet *toto = [Pet petWithName:@\"Toto\" kind:dog];\n                RLMArray<Pet *><Pet> *pets = newObject[@\"pets\"];\n                [pets addObject:toto];\n            }\n        }];\n        [migration createObject:Pet.className withValue:@[@\"Slinkey\", @1]];\n    }\n    if (oldSchemaVersion == 2) {\n        // This branch is only relevant for version 2. If we are migration from a previous\n        // version, we would not be able to access `dogs` since they did not exist back there.\n        // Migration from v0 and v1 to v3 is done in the previous blocks.\n        // Related issue: https://github.com/realm/realm-swift/issues/6263\n        [migration enumerateObjects:Person.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            RLMArray<Pet *><Pet> *pets = newObject[@\"pets\"];\n            for (RLMObject *dog in oldObject[@\"dogs\"]) {\n                Pet *pet = (Pet *)[migration createObject:Pet.className withValue:@[dog[@\"name\"], @1]];\n                [pets addObject:pet];\n            }\n        }];\n        // We migrate over the old dog list to make sure all dogs get added, even those without\n        // an owner.\n        // Related issue: https://github.com/realm/realm-swift/issues/6734\n        [migration enumerateObjects:@\"Dog\" block:^(RLMObject *oldDogObject, RLMObject *newDogObject) {\n            __block bool dogFound = false;\n            [migration enumerateObjects:Person.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n                for (Pet *pet in newObject[@\"pets\"]) {\n                    if ([pet[@\"name\"] isEqualToString:oldDogObject[@\"name\"]]) {\n                        dogFound = true;\n                        break;\n                    }\n                }\n            }];\n            if (!dogFound) {\n                [migration createObject:Pet.className withValue:@[oldDogObject[@\"name\"], @1]];\n            }\n        }];\n        // The data cannot be deleted just yet since the table is target of cross-table link columns.\n        // See https://github.com/realm/realm-swift/issues/3686\n        // [migration deleteDataForClassName:@\"Dog\"];\n    }\n};\n\n// This block checks if the migration led to the expected result.\n// All older versions should have been migrated to the below stated `exampleData`.\ntypedef void (^MigrationCheck) (RLMRealm *realm);\nMigrationCheck migrationCheck = ^(RLMRealm *realm) {\n    RLMResults<Person *> *persons = [Person allObjects];\n    assert(persons.count == 3);\n    assert([persons[0].fullName isEqualToString:@\"John Doe\"]);\n    assert(persons[0].age == 42);\n    assert(persons[0].pets.count == 2);\n    assert([persons[0].pets[0].name isEqualToString:@\"Marley\"]);\n    assert([persons[0].pets[1].name isEqualToString:@\"Lassie\"]);\n    assert([persons[1].fullName isEqualToString:@\"Jane Doe\"]);\n    assert(persons[1].age == 43);\n    assert(persons[1].pets.count == 1);\n    assert([persons[1].pets[0].name isEqualToString:@\"Toto\"]);\n    assert([persons[2].fullName isEqualToString:@\"John Smith\"]);\n    assert(persons[2].age == 44);\n    RLMResults *pets = [Pet allObjects];\n    assert(pets.count == 4);\n    assert([pets objectsWithPredicate:[NSPredicate predicateWithFormat:@\"name == 'Slinkey'\"]].count == 1);\n};\n\n#pragma mark - Example data\n\n// Example data for this schema version.\ntypedef void (^ExampleData) (RLMRealm *realm);\nExampleData exampleData = ^(RLMRealm *realm) {\n    Person *person1 = [Person personWithFullName:@\"John Doe\" age: 42];\n    Person *person2 = [Person personWithFullName:@\"Jane Doe\" age: 43];\n    Person *person3 = [Person personWithFullName:@\"John Smith\" age: 44];\n    Pet *pet1 = [Pet petWithName:@\"Marley\" kind:dog];\n    Pet *pet2 = [Pet petWithName:@\"Lassie\" kind:dog];\n    Pet *pet3 = [Pet petWithName:@\"Toto\" kind:dog];\n    Pet *pet4 = [Pet petWithName:@\"Slinkey\" kind:dog];\n    [realm addObjects:@[person1, person2, person3]];\n    // pet1, pet2 and pet3 get added automatically by adding them to a list.\n    // pet4 has to be added manually though since it's not attached to a person yet.\n    [realm addObject:pet4];\n    [person1.pets addObject:pet1];\n    [person1.pets addObject:pet2];\n    [person2.pets addObject:pet3];\n};\n\n#endif\n"
  },
  {
    "path": "examples/ios/objc/Migration/Examples/Example_v4.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#ifndef SCHEMA_VERSION_4\n#define SCHEMA_VERSION_4 0\n#endif\n\n#if SCHEMA_VERSION_4\n\n#import <Foundation/Foundation.h>\n#import <Realm/Realm.h>\n\n#pragma mark - Schema\n\nNSInteger schemaVersion = 4;\n\n// Changes from previous version:\n// Add an `Address` to the `Person`.\n\n@interface Pet : RLMObject\ntypedef NS_ENUM(int, Kind) {\n    unspecified,\n    dog,\n    chicken,\n    cow\n};\n@property NSString *name;\n@property NSInteger kindValue;\n@property enum Kind kind;\n+ (Pet *)petWithName:(NSString *)name kind:(enum Kind)kind;\n@end\nRLM_COLLECTION_TYPE(Pet)\n\n@implementation Pet\n+ (Pet *)petWithName:(NSString *)name kind:(enum Kind)kind {\n    Pet *pet = [[self alloc] init];\n    pet.name = name;\n    pet.kind = kind;\n    return pet;\n}\n- (enum Kind)kind {\n    return (Kind)_kindValue;\n}\n- (void)setKind:(enum Kind)kind {\n    _kindValue = kind;\n}\n+ (NSArray *)requiredProperties {\n    return @[@\"name\", @\"kindValue\"];\n}\n+ (NSArray *)ignoredProperties {\n    return @[@\"kind\"];\n}\n@end\n\n@class Address;\n@interface Person : RLMObject\n@property NSString *fullName;\n@property NSInteger age;\n@property Address *address;\n@property RLMArray<Pet *><Pet> *pets;\n+ (Person *)personWithFullName:(NSString *)fullName age:(int)age;\n@end\n\n@implementation Person\n+ (Person *)personWithFullName:(NSString *)fullName age:(int)age {\n    Person *person = [[self alloc] init];\n    person.fullName = fullName;\n    person.age = age;\n    return person;\n}\n+ (NSArray *)requiredProperties {\n    return @[@\"fullName\", @\"age\"];\n}\n@end\n\n@interface Address : RLMObject\n@property NSString *street;\n@property NSString *city;\n@property (readonly) RLMLinkingObjects *residents;\n+ (Address *)addressWithStreet:(NSString *)street city:(NSString *)city;\n@end\n\n@implementation Address\n+ (Address *)addressWithStreet:(NSString *)street city:(NSString *)city {\n    Address *address = [[self alloc] init];\n    address.street = street;\n    address.city = city;\n    return address;\n}\n+ (NSArray *)requiredProperties {\n    return @[@\"street\", @\"city\"];\n}\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{\n        @\"residents\": [RLMPropertyDescriptor descriptorWithClass:Person.class propertyName:@\"address\"],\n    };\n}\n@end\n\n#pragma mark - Migration\n\n// Migration block to migrate from *any* previous version to this version.\nRLMMigrationBlock migrationBlock = ^(RLMMigration *migration, uint64_t oldSchemaVersion) {\n    if (oldSchemaVersion < 1) {\n        [migration enumerateObjects:Person.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            // combine name fields into a single field\n            newObject[@\"fullName\"] = [NSString stringWithFormat:@\"%@ %@\", oldObject[@\"firstName\"], oldObject[@\"lastName\"]];\n        }];\n    }\n    if (oldSchemaVersion < 2) {\n        [migration enumerateObjects:Person.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            // Add a pet to a specific person\n            if ([newObject[@\"fullName\"] isEqualToString:@\"John Doe\"]) {\n                // `Dog` was changed to `Pet` in v2 already, but we still need to account for this\n                // if upgrading from pre v2 to v3.\n                Pet *marley = [Pet petWithName:@\"Marley\" kind:dog];\n                Pet *lassie = [Pet petWithName:@\"Lassie\" kind:dog];\n                RLMArray<Pet *><Pet> *pets = newObject[@\"pets\"];\n                [pets addObject:marley];\n                [pets addObject:lassie];\n            } else if ([newObject[@\"fullName\"] isEqualToString:@\"Jane Doe\"]) {\n                Pet *toto = [Pet petWithName:@\"Toto\" kind:dog];\n                RLMArray<Pet *><Pet> *pets = newObject[@\"pets\"];\n                [pets addObject:toto];\n            }\n        }];\n        [migration createObject:Pet.className withValue:@[@\"Slinkey\", @1]];\n    }\n    if (oldSchemaVersion == 2) {\n        // This branch is only relevant for version 2. If we are migration from a previous\n        // version, we would not be able to access `dogs` since they did not exist back there.\n        // Migration from v0 and v1 to v3 is done in the previous blocks.\n        // Related issue: https://github.com/realm/realm-swift/issues/6263\n        [migration enumerateObjects:Person.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            RLMArray<Pet *><Pet> *pets = newObject[@\"pets\"];\n            for (RLMObject *dog in oldObject[@\"dogs\"]) {\n                Pet *pet = (Pet *)[migration createObject:Pet.className withValue:@[dog[@\"name\"], @1]];\n                [pets addObject:pet];\n            }\n        }];\n        // We migrate over the old dog list to make sure all dogs get added, even those without\n        // an owner.\n        // Related issue: https://github.com/realm/realm-swift/issues/6734\n        [migration enumerateObjects:@\"Dog\" block:^(RLMObject *oldDogObject, RLMObject *newDogObject) {\n            __block bool dogFound = false;\n            [migration enumerateObjects:Person.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n                for (Pet *pet in newObject[@\"pets\"]) {\n                    if ([pet[@\"name\"] isEqualToString:oldDogObject[@\"name\"]]) {\n                        dogFound = true;\n                        break;\n                    }\n                }\n            }];\n            if (!dogFound) {\n                [migration createObject:Pet.className withValue:@[oldDogObject[@\"name\"], @1]];\n            }\n        }];\n        // The data cannot be deleted just yet since the table is target of cross-table link columns.\n        // See https://github.com/realm/realm-swift/issues/3686\n        // [migration deleteDataForClassName:@\"Dog\"];\n    }\n    if (oldSchemaVersion < 4) {\n        [migration enumerateObjects:Person.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            if ([newObject[@\"fullName\"] isEqualToString:@\"John Doe\"]) {\n                Address *address = (Address *)[migration createObject:Address.className withValue:@[@\"Broadway\", @\"New York\"]];\n                newObject[@\"address\"] = address;\n            }\n        }];\n    }\n};\n\n// This block checks if the migration led to the expected result.\n// All older versions should have been migrated to the below stated `exampleData`.\ntypedef void (^MigrationCheck) (RLMRealm *realm);\nMigrationCheck migrationCheck = ^(RLMRealm *realm) {\n    RLMResults<Person *> *persons = [Person allObjects];\n    assert(persons.count == 3);\n    assert([persons[0].fullName isEqualToString:@\"John Doe\"]);\n    assert(persons[0].age == 42);\n    assert(persons[0].address != nil);\n    assert([persons[0].address.city isEqualToString:@\"New York\"]);\n    assert([persons[0].address.street isEqualToString:@\"Broadway\"]);\n    assert(persons[0].pets.count == 2);\n    assert([persons[0].pets[0].name isEqualToString:@\"Marley\"]);\n    assert([persons[0].pets[1].name isEqualToString:@\"Lassie\"]);\n    assert([persons[1].fullName isEqualToString:@\"Jane Doe\"]);\n    assert(persons[1].age == 43);\n    assert(persons[1].address == nil);\n    assert(persons[1].pets.count == 1);\n    assert([persons[1].pets[0].name isEqualToString:@\"Toto\"]);\n    assert([persons[2].fullName isEqualToString:@\"John Smith\"]);\n    assert(persons[2].age == 44);\n    assert(persons[2].address == nil);\n    RLMResults *pets = [Pet allObjects];\n    assert(pets.count == 4);\n    assert([pets objectsWithPredicate:[NSPredicate predicateWithFormat:@\"name == 'Slinkey'\"]].count == 1);\n};\n\n#pragma mark - Example data\n\n// Example data for this schema version.\ntypedef void (^ExampleData) (RLMRealm *realm);\nExampleData exampleData = ^(RLMRealm *realm) {\n    Person *person1 = [Person personWithFullName:@\"John Doe\" age: 42];\n    Person *person2 = [Person personWithFullName:@\"Jane Doe\" age: 43];\n    Person *person3 = [Person personWithFullName:@\"John Smith\" age: 44];\n    Pet *pet1 = [Pet petWithName:@\"Marley\" kind:dog];\n    Pet *pet2 = [Pet petWithName:@\"Lassie\" kind:dog];\n    Pet *pet3 = [Pet petWithName:@\"Toto\" kind:dog];\n    Pet *pet4 = [Pet petWithName:@\"Slinkey\" kind:dog];\n    [realm addObjects:@[person1, person2, person3]];\n    // pet1, pet2 and pet3 get added automatically by adding them to a list.\n    // pet4 has to be added manually though since it's not attached to a person yet.\n    [realm addObject:pet4];\n    [person1.pets addObject:pet1];\n    [person1.pets addObject:pet2];\n    [person2.pets addObject:pet3];\n};\n\n#endif\n"
  },
  {
    "path": "examples/ios/objc/Migration/Examples/Example_v5.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#ifndef SCHEMA_VERSION_5\n#define SCHEMA_VERSION_5 1\n#endif\n\n#if SCHEMA_VERSION_5 && !SCHEMA_VERSION_4 && !SCHEMA_VERSION_3 && !SCHEMA_VERSION_2 && !SCHEMA_VERSION_1 && !SCHEMA_VERSION_0\n\n#import <Foundation/Foundation.h>\n#import <Realm/Realm.h>\n\n#pragma mark - Schema\n\nNSInteger schemaVersion = 5;\n\n// Changes from previous version:\n// - Change the `Address` from `Object` to `EmbeddedObject`.\n//\n// Be aware that this only works if there is only one `LinkingObject` per `Address`.\n// See https://github.com/realm/realm-swift/issues/7060\n\n@interface Pet : RLMObject\ntypedef NS_ENUM(int, Kind) {\n    unspecified,\n    dog,\n    chicken,\n    cow\n};\n@property NSString *name;\n@property NSInteger kindValue;\n@property enum Kind kind;\n+ (Pet *)petWithName:(NSString *)name kind:(enum Kind)kind;\n@end\nRLM_COLLECTION_TYPE(Pet)\n\n@implementation Pet\n+ (Pet *)petWithName:(NSString *)name kind:(enum Kind)kind {\n    Pet *pet = [[self alloc] init];\n    pet.name = name;\n    pet.kind = kind;\n    return pet;\n}\n- (enum Kind)kind {\n    return (Kind)_kindValue;\n}\n- (void)setKind:(enum Kind)kind {\n    _kindValue = kind;\n}\n+ (NSArray *)requiredProperties {\n    return @[@\"name\", @\"kindValue\"];\n}\n+ (NSArray *)ignoredProperties {\n    return @[@\"kind\"];\n}\n@end\n\n@class Address;\n@interface Person : RLMObject\n@property NSString *fullName;\n@property NSInteger age;\n@property Address *address;\n@property RLMArray<Pet *><Pet> *pets;\n+ (Person *)personWithFullName:(NSString *)fullName age:(int)age;\n@end\n\n@implementation Person\n+ (Person *)personWithFullName:(NSString *)fullName age:(int)age {\n    Person *person = [[self alloc] init];\n    person.fullName = fullName;\n    person.age = age;\n    return person;\n}\n+ (NSArray *)requiredProperties {\n    return @[@\"fullName\", @\"age\"];\n}\n@end\n\n@interface Address : RLMEmbeddedObject\n@property NSString *street;\n@property NSString *city;\n@property (readonly) RLMLinkingObjects *residents;\n+ (Address *)addressWithStreet:(NSString *)street city:(NSString *)city;\n@end\n\n@implementation Address\n+ (Address *)addressWithStreet:(NSString *)street city:(NSString *)city {\n    Address *address = [[self alloc] init];\n    address.street = street;\n    address.city = city;\n    return address;\n}\n+ (NSArray *)requiredProperties {\n    return @[@\"street\", @\"city\"];\n}\n+ (NSDictionary *)linkingObjectsProperties {\n    return @{\n        @\"residents\": [RLMPropertyDescriptor descriptorWithClass:Person.class propertyName:@\"address\"],\n    };\n}\n@end\n\n#pragma mark - Migration\n\n// Migration block to migrate from *any* previous version to this version.\nRLMMigrationBlock migrationBlock = ^(RLMMigration *migration, uint64_t oldSchemaVersion) {\n    if (oldSchemaVersion < 1) {\n        [migration enumerateObjects:Person.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            // combine name fields into a single field\n            newObject[@\"fullName\"] = [NSString stringWithFormat:@\"%@ %@\", oldObject[@\"firstName\"], oldObject[@\"lastName\"]];\n        }];\n    }\n    if (oldSchemaVersion < 2) {\n        [migration enumerateObjects:Person.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            // Add a pet to a specific person\n            if ([newObject[@\"fullName\"] isEqualToString:@\"John Doe\"]) {\n                // `Dog` was changed to `Pet` in v2 already, but we still need to account for this\n                // if upgrading from pre v2 to v3.\n                Pet *marley = [Pet petWithName:@\"Marley\" kind:dog];\n                Pet *lassie = [Pet petWithName:@\"Lassie\" kind:dog];\n                RLMArray<Pet *><Pet> *pets = newObject[@\"pets\"];\n                [pets addObject:marley];\n                [pets addObject:lassie];\n            } else if ([newObject[@\"fullName\"] isEqualToString:@\"Jane Doe\"]) {\n                Pet *toto = [Pet petWithName:@\"Toto\" kind:dog];\n                RLMArray<Pet *><Pet> *pets = newObject[@\"pets\"];\n                [pets addObject:toto];\n            }\n        }];\n        [migration createObject:Pet.className withValue:@[@\"Slinkey\", @1]];\n    }\n    if (oldSchemaVersion == 2) {\n        // This branch is only relevant for version 2. If we are migration from a previous\n        // version, we would not be able to access `dogs` since they did not exist back there.\n        // Migration from v0 and v1 to v3 is done in the previous blocks.\n        // Related issue: https://github.com/realm/realm-swift/issues/6263\n        [migration enumerateObjects:Person.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            RLMArray<Pet *><Pet> *pets = newObject[@\"pets\"];\n            for (RLMObject *dog in oldObject[@\"dogs\"]) {\n                Pet *pet = (Pet *)[migration createObject:Pet.className withValue:@[dog[@\"name\"], @1]];\n                [pets addObject:pet];\n            }\n        }];\n        // We migrate over the old dog list to make sure all dogs get added, even those without\n        // an owner.\n        // Related issue: https://github.com/realm/realm-swift/issues/6734\n        [migration enumerateObjects:@\"Dog\" block:^(RLMObject *oldDogObject, RLMObject *newDogObject) {\n            __block bool dogFound = false;\n            [migration enumerateObjects:Person.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n                for (Pet *pet in newObject[@\"pets\"]) {\n                    if ([pet[@\"name\"] isEqualToString:oldDogObject[@\"name\"]]) {\n                        dogFound = true;\n                        break;\n                    }\n                }\n            }];\n            if (!dogFound) {\n                [migration createObject:Pet.className withValue:@[oldDogObject[@\"name\"], @1]];\n            }\n        }];\n        // The data cannot be deleted just yet since the table is target of cross-table link columns.\n        // See https://github.com/realm/realm-swift/issues/3686\n        // [migration deleteDataForClassName:@\"Dog\"];\n    }\n    if (oldSchemaVersion < 4) {\n        [migration enumerateObjects:Person.className block:^(RLMObject *oldObject, RLMObject *newObject) {\n            if ([newObject[@\"fullName\"] isEqualToString:@\"John Doe\"]) {\n                Address *address = [Address addressWithStreet:@\"Broadway\" city:@\"New York\"];\n                newObject[@\"address\"] = address;\n            }\n        }];\n    }\n};\n\n// This block checks if the migration led to the expected result.\n// All older versions should have been migrated to the below stated `exampleData`.\ntypedef void (^MigrationCheck) (RLMRealm *realm);\nMigrationCheck migrationCheck = ^(RLMRealm *realm) {\n    RLMResults<Person *> *persons = [Person allObjects];\n    assert(persons.count == 3);\n    assert([persons[0].fullName isEqualToString:@\"John Doe\"]);\n    assert(persons[0].age == 42);\n    assert(persons[0].address != nil);\n    assert([persons[0].address.city isEqualToString:@\"New York\"]);\n    assert([persons[0].address.street isEqualToString:@\"Broadway\"]);\n    assert(persons[0].pets.count == 2);\n    assert([persons[0].pets[0].name isEqualToString:@\"Marley\"]);\n    assert([persons[0].pets[1].name isEqualToString:@\"Lassie\"]);\n    assert([persons[1].fullName isEqualToString:@\"Jane Doe\"]);\n    assert(persons[1].age == 43);\n    assert(persons[1].address == nil);\n    assert(persons[1].pets.count == 1);\n    assert([persons[1].pets[0].name isEqualToString:@\"Toto\"]);\n    assert([persons[2].fullName isEqualToString:@\"John Smith\"]);\n    assert(persons[2].age == 44);\n    assert(persons[2].address == nil);\n    RLMResults *pets = [Pet allObjects];\n    assert(pets.count == 4);\n    assert([pets objectsWithPredicate:[NSPredicate predicateWithFormat:@\"name == 'Slinkey'\"]].count == 1);\n};\n\n#pragma mark - Example data\n\n// Example data for this schema version.\ntypedef void (^ExampleData) (RLMRealm *realm);\nExampleData exampleData = ^(RLMRealm *realm) {\n    Person *person1 = [Person personWithFullName:@\"John Doe\" age: 42];\n    Person *person2 = [Person personWithFullName:@\"Jane Doe\" age: 43];\n    Person *person3 = [Person personWithFullName:@\"John Smith\" age: 44];\n    Pet *pet1 = [Pet petWithName:@\"Marley\" kind:dog];\n    Pet *pet2 = [Pet petWithName:@\"Lassie\" kind:dog];\n    Pet *pet3 = [Pet petWithName:@\"Toto\" kind:dog];\n    Pet *pet4 = [Pet petWithName:@\"Slinkey\" kind:dog];\n    [realm addObjects:@[person1, person2, person3]];\n    // pet1, pet2 and pet3 get added automatically by adding them to a list.\n    // pet4 has to be added manually though since it's not attached to a person yet.\n    [realm addObject:pet4];\n    [person1.pets addObject:pet1];\n    [person1.pets addObject:pet2];\n    [person2.pets addObject:pet3];\n};\n\n#endif\n"
  },
  {
    "path": "examples/ios/objc/Migration/Migration-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleDisplayName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1.0</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/objc/Migration/main.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n#import \"AppDelegate.h\"\n\nint main(int argc, char * argv[])\n{\n    @autoreleasepool {\n        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));\n    }\n}\n"
  },
  {
    "path": "examples/ios/objc/REST/AppDelegate.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n@interface AppDelegate : UIResponder <UIApplicationDelegate>\n\n@property (strong, nonatomic) UIWindow *window;\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/REST/AppDelegate.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n// This app gives a simple example of retrieving data from the foursquare REST API\n// and persisting it in a Realm. To run this app, you will need to provide a foursquare\n// client ID and client secret. To get these, signup at https://developer.foursquare.com/\n\n#import \"AppDelegate.h\"\n#import \"Venue.h\"\n#import <Realm/Realm.h>\n\n#error Provide your foursquare client ID and client secret\nNSString *clientID = @\"YOUR CLIENT ID\";\nNSString *clientSecret = @\"YOUR CLIENT SECRET\";\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{\n    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];\n    self.window.rootViewController = [[UIViewController alloc] init];\n    [self.window makeKeyAndVisible];\n\n    // Ensure we start with an empty database\n    [[NSFileManager defaultManager] removeItemAtURL:[RLMRealmConfiguration defaultConfiguration].fileURL error:nil];\n\n    // Query Foursquare API\n    NSDictionary *foursquareVenues = [self getFoursquareVenues];\n\n    // Persist the results to Realm\n    [self persistToDefaultRealm:foursquareVenues];\n\n    return YES;\n}\n\n-(NSDictionary*)getFoursquareVenues\n{\n    // Call the foursquare API - here we use an NSData method for our API request,\n    // but you could use anything that will allow you to call the API and serialize\n    // the response as an NSDictionary or NSArray\n    NSData *apiResponse = [[NSData alloc] initWithContentsOfURL:\n                           [NSURL URLWithString:[NSString stringWithFormat:@\"https://api.foursquare.com/v2/venues/search?near=San%@Francisco&client_id=%@&client_secret=%@&v=20140101&limit=50\", @\"%20\", clientID, clientSecret]]];\n\n    // Serialize the NSData object from the response into an NSDictionary\n    NSDictionary *serializedResponse = [[NSJSONSerialization JSONObjectWithData:apiResponse\n                                                                        options:kNilOptions\n                                                                          error:nil]\n                                        objectForKey:@\"response\"];\n\n    // Extract the venues from the response as an NSDictionary\n    return serializedResponse[@\"venues\"];\n}\n\n- (void)persistToDefaultRealm:(NSDictionary*)foursquareVenues\n{\n   // Open the default Realm file\n    RLMRealm *defaultRealm = [RLMRealm defaultRealm];\n\n    // Begin a write transaction to save to the default Realm\n    [defaultRealm beginWriteTransaction];\n\n    for (id venue in foursquareVenues) {\n        // Store the foursquare venue name and id in a Realm Object\n        Venue *newVenue = [[Venue alloc] init];\n        newVenue.foursquareID = venue[@\"id\"];\n        newVenue.name = venue[@\"name\"];\n\n        // Add the Venue object to the default Realm\n        // (alternatively you could serialize the API response as an NSArray and call addObjectsFromArray)\n        [defaultRealm addObject:newVenue];\n    }\n\n    // Persist all the Venues with a single commit\n    [defaultRealm commitWriteTransaction];\n\n    // Show all the venues that were persisted\n    NSLog(@\"Here are all the venues persisted to the default Realm: \\n\\n %@\",\n          [[Venue allObjects] description]);\n}\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/REST/REST-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleDisplayName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1.0</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations~ipad</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationPortraitUpsideDown</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/objc/REST/Venue.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Foundation/Foundation.h>\n#import <Realm/Realm.h>\n\n@interface Venue : RLMObject\n@property NSString * foursquareID;\n@property NSString * name;\n@end\n"
  },
  {
    "path": "examples/ios/objc/REST/Venue.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"Venue.h\"\n\n@implementation Venue\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/REST/main.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"AppDelegate.h\"\n\nint main(int argc, char * argv[])\n{\n    @autoreleasepool {\n        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));\n    }\n}\n"
  },
  {
    "path": "examples/ios/objc/RealmExamples.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t0295B8FF19D102880036D6C3 /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0295B8FE19D102880036D6C3 /* Realm.framework */; };\n\t\t0295B90019D102880036D6C3 /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0295B8FE19D102880036D6C3 /* Realm.framework */; };\n\t\t0295B90119D102880036D6C3 /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0295B8FE19D102880036D6C3 /* Realm.framework */; };\n\t\t0295B90219D102880036D6C3 /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0295B8FE19D102880036D6C3 /* Realm.framework */; };\n\t\t0295B90319D102880036D6C3 /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0295B8FE19D102880036D6C3 /* Realm.framework */; };\n\t\t227D20DE1CB6009D008F641B /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 227D20DD1CB6009D008F641B /* LaunchScreen.xib */; };\n\t\t227D20DF1CB6009D008F641B /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 227D20DD1CB6009D008F641B /* LaunchScreen.xib */; };\n\t\t227D20E01CB6009D008F641B /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 227D20DD1CB6009D008F641B /* LaunchScreen.xib */; };\n\t\t227D20E11CB6009D008F641B /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 227D20DD1CB6009D008F641B /* LaunchScreen.xib */; };\n\t\t227D20E31CB6009D008F641B /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 227D20DD1CB6009D008F641B /* LaunchScreen.xib */; };\n\t\t227D20E41CB6009D008F641B /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 227D20DD1CB6009D008F641B /* LaunchScreen.xib */; };\n\t\t227D20E51CB6009D008F641B /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 227D20DD1CB6009D008F641B /* LaunchScreen.xib */; };\n\t\t227D20E61CB6009D008F641B /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 227D20DD1CB6009D008F641B /* LaunchScreen.xib */; };\n\t\t3F08725E27F3C95E007A1175 /* libcompression.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F08725D27F3C8CF007A1175 /* libcompression.tbd */; };\n\t\t3F08725F27F3C96A007A1175 /* libcompression.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F08725D27F3C8CF007A1175 /* libcompression.tbd */; };\n\t\t3F08726027F3C971007A1175 /* libcompression.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F08725D27F3C8CF007A1175 /* libcompression.tbd */; };\n\t\t3F08726127F3C977007A1175 /* libcompression.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F08725D27F3C8CF007A1175 /* libcompression.tbd */; };\n\t\t3F08726227F3C97D007A1175 /* libcompression.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F08725D27F3C8CF007A1175 /* libcompression.tbd */; };\n\t\t3F08726427F3C989007A1175 /* libcompression.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F08725D27F3C8CF007A1175 /* libcompression.tbd */; };\n\t\t3F08726527F3C98E007A1175 /* libcompression.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F08725D27F3C8CF007A1175 /* libcompression.tbd */; };\n\t\t3F08726627F3C993007A1175 /* libcompression.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F08725D27F3C8CF007A1175 /* libcompression.tbd */; };\n\t\t3F08726727F3C999007A1175 /* libcompression.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F08725D27F3C8CF007A1175 /* libcompression.tbd */; };\n\t\t3FC898FD1A140F550067CBEC /* LabelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3FC898FC1A140F550067CBEC /* LabelViewController.m */; };\n\t\t7DD1D7E225DC2D3D00E63229 /* default-v2.realm in Resources */ = {isa = PBXBuildFile; fileRef = 7DD1D7D225DC2C7400E63229 /* default-v2.realm */; };\n\t\t7DD1D7E325DC2D3D00E63229 /* default-v3.realm in Resources */ = {isa = PBXBuildFile; fileRef = 7DD1D7D325DC2C7400E63229 /* default-v3.realm */; };\n\t\t7DD1D7E425DC2D3D00E63229 /* default-v0.realm in Resources */ = {isa = PBXBuildFile; fileRef = 7DD1D7D425DC2C7400E63229 /* default-v0.realm */; };\n\t\t7DD1D7E525DC2D3D00E63229 /* default-v5.realm in Resources */ = {isa = PBXBuildFile; fileRef = 7DD1D7D525DC2C7400E63229 /* default-v5.realm */; };\n\t\t7DD1D7E625DC2D3D00E63229 /* default-v4.realm in Resources */ = {isa = PBXBuildFile; fileRef = 7DD1D7D125DC2C7400E63229 /* default-v4.realm */; };\n\t\t7DD1D7E725DC2D3D00E63229 /* default-v1.realm in Resources */ = {isa = PBXBuildFile; fileRef = 7DD1D7D025DC2C7400E63229 /* default-v1.realm */; };\n\t\tC06134DF1A718BB800D22D12 /* TodayExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = C0DC42061A7079D00067156A /* TodayExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };\n\t\tC06134E41A71AA4E00D22D12 /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0295B8FE19D102880036D6C3 /* Realm.framework */; };\n\t\tC06134E51A71AA5600D22D12 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71A919BA502500F3EDB4 /* Foundation.framework */; };\n\t\tC06134E61A71AA5A00D22D12 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71AB19BA502500F3EDB4 /* CoreGraphics.framework */; };\n\t\tC0DC41D41A7072680067156A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C0DC41D31A7072670067156A /* AppDelegate.m */; };\n\t\tC0DC41F41A70729D0067156A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71AB19BA502500F3EDB4 /* CoreGraphics.framework */; };\n\t\tC0DC41F51A70729D0067156A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71A919BA502500F3EDB4 /* Foundation.framework */; };\n\t\tC0DC41F61A70729D0067156A /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E8F70ED019BA52E8006F60D5 /* libc++.dylib */; };\n\t\tC0DC41F71A70729D0067156A /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0295B8FE19D102880036D6C3 /* Realm.framework */; };\n\t\tC0DC41F81A70729D0067156A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71AD19BA502500F3EDB4 /* UIKit.framework */; };\n\t\tC0DC41FC1A7072DE0067156A /* Tick.m in Sources */ = {isa = PBXBuildFile; fileRef = C0DC41FB1A7072DE0067156A /* Tick.m */; };\n\t\tC0DC42011A7078130067156A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C0DC41FD1A7073E40067156A /* main.m */; };\n\t\tC0DC42081A7079D00067156A /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0DC42071A7079D00067156A /* NotificationCenter.framework */; };\n\t\tC0DC420E1A7079D00067156A /* TodayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C0DC420D1A7079D00067156A /* TodayViewController.m */; };\n\t\tC0DC42101A7079D00067156A /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C0DC420F1A7079D00067156A /* MainInterface.storyboard */; };\n\t\tC0DC42181A707B960067156A /* Tick.m in Sources */ = {isa = PBXBuildFile; fileRef = C0DC41FB1A7072DE0067156A /* Tick.m */; };\n\t\tC0DC42191A707BF80067156A /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E8F70ED019BA52E8006F60D5 /* libc++.dylib */; };\n\t\tE879D9CE1A12AA120035E2EB /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E8F70ED019BA52E8006F60D5 /* libc++.dylib */; };\n\t\tE879D9CF1A12AA120035E2EB /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71AB19BA502500F3EDB4 /* CoreGraphics.framework */; };\n\t\tE879D9D01A12AA120035E2EB /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71AD19BA502500F3EDB4 /* UIKit.framework */; };\n\t\tE879D9D11A12AA120035E2EB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71A919BA502500F3EDB4 /* Foundation.framework */; };\n\t\tE879D9D21A12AA120035E2EB /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0295B8FE19D102880036D6C3 /* Realm.framework */; };\n\t\tE879D9E21A12AA400035E2EB /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E879D9DC1A12AA400035E2EB /* AppDelegate.m */; };\n\t\tE879D9E31A12AA400035E2EB /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E879D9DD1A12AA400035E2EB /* Images.xcassets */; };\n\t\tE879D9E51A12AA400035E2EB /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E879D9DF1A12AA400035E2EB /* main.m */; };\n\t\tE879D9E61A12AA400035E2EB /* TableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E879D9E11A12AA400035E2EB /* TableViewController.m */; };\n\t\tE8AB71DD19BA503500F3EDB4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71A919BA502500F3EDB4 /* Foundation.framework */; };\n\t\tE8AB71DE19BA503500F3EDB4 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71AB19BA502500F3EDB4 /* CoreGraphics.framework */; };\n\t\tE8AB71DF19BA503500F3EDB4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71AD19BA502500F3EDB4 /* UIKit.framework */; };\n\t\tE8AB720B19BA503B00F3EDB4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71A919BA502500F3EDB4 /* Foundation.framework */; };\n\t\tE8AB720C19BA503B00F3EDB4 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71AB19BA502500F3EDB4 /* CoreGraphics.framework */; };\n\t\tE8AB720D19BA503B00F3EDB4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71AD19BA502500F3EDB4 /* UIKit.framework */; };\n\t\tE8AB723919BA504000F3EDB4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71A919BA502500F3EDB4 /* Foundation.framework */; };\n\t\tE8AB723A19BA504000F3EDB4 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71AB19BA502500F3EDB4 /* CoreGraphics.framework */; };\n\t\tE8AB723B19BA504000F3EDB4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71AD19BA502500F3EDB4 /* UIKit.framework */; };\n\t\tE8AB726719BA504500F3EDB4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71A919BA502500F3EDB4 /* Foundation.framework */; };\n\t\tE8AB726819BA504500F3EDB4 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71AB19BA502500F3EDB4 /* CoreGraphics.framework */; };\n\t\tE8AB726919BA504500F3EDB4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71AD19BA502500F3EDB4 /* UIKit.framework */; };\n\t\tE8AB729519BA504900F3EDB4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71A919BA502500F3EDB4 /* Foundation.framework */; };\n\t\tE8AB729619BA504900F3EDB4 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71AB19BA502500F3EDB4 /* CoreGraphics.framework */; };\n\t\tE8AB729719BA504900F3EDB4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71AD19BA502500F3EDB4 /* UIKit.framework */; };\n\t\tE8BDBFCC1A116FCB00450CFF /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E8BDBFC91A116FCB00450CFF /* AppDelegate.m */; };\n\t\tE8BDBFCE1A116FCB00450CFF /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E8BDBFCB1A116FCB00450CFF /* main.m */; };\n\t\tE8BDBFD11A1172B200450CFF /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0295B8FE19D102880036D6C3 /* Realm.framework */; };\n\t\tE8BDBFD21A1172B600450CFF /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E8F70ED019BA52E8006F60D5 /* libc++.dylib */; };\n\t\tE8BDBFD31A1172BC00450CFF /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71AB19BA502500F3EDB4 /* CoreGraphics.framework */; };\n\t\tE8BDBFD41A1172BF00450CFF /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71AD19BA502500F3EDB4 /* UIKit.framework */; };\n\t\tE8BDBFD51A1172C300450CFF /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AB71A919BA502500F3EDB4 /* Foundation.framework */; };\n\t\tE8D5D6AA19BA53DF0053D333 /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E8F70ED019BA52E8006F60D5 /* libc++.dylib */; };\n\t\tE8F70E9319BA5083006F60D5 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F70E9019BA5083006F60D5 /* AppDelegate.m */; };\n\t\tE8F70E9419BA5083006F60D5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F70E9119BA5083006F60D5 /* main.m */; };\n\t\tE8F70E9E19BA508B006F60D5 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F70E9819BA508B006F60D5 /* AppDelegate.m */; };\n\t\tE8F70E9F19BA508B006F60D5 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E8F70E9919BA508B006F60D5 /* Images.xcassets */; };\n\t\tE8F70EA019BA508B006F60D5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F70E9A19BA508B006F60D5 /* main.m */; };\n\t\tE8F70EA219BA508B006F60D5 /* TableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F70E9D19BA508B006F60D5 /* TableViewController.m */; };\n\t\tE8F70EAA19BA5093006F60D5 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F70EA519BA5093006F60D5 /* AppDelegate.m */; };\n\t\tE8F70EAB19BA5093006F60D5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F70EA619BA5093006F60D5 /* main.m */; };\n\t\tE8F70EAD19BA5093006F60D5 /* Venue.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F70EA919BA5093006F60D5 /* Venue.m */; };\n\t\tE8F70EBC19BA50A3006F60D5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F70EB419BA50A3006F60D5 /* main.m */; };\n\t\tE8F70EBE19BA50A3006F60D5 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F70EB719BA50A3006F60D5 /* AppDelegate.m */; };\n\t\tE8F70EC419BA50AB006F60D5 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F70EC119BA50AB006F60D5 /* AppDelegate.m */; };\n\t\tE8F70EC619BA50AB006F60D5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F70EC319BA50AB006F60D5 /* main.m */; };\n\t\tE8F70ED119BA52E8006F60D5 /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E8F70ED019BA52E8006F60D5 /* libc++.dylib */; };\n\t\tE8F70ED519BA530C006F60D5 /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E8F70ED019BA52E8006F60D5 /* libc++.dylib */; };\n\t\tE8F70ED919BA534E006F60D5 /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E8F70ED019BA52E8006F60D5 /* libc++.dylib */; };\n\t\tE8F70EDD19BA5380006F60D5 /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E8F70ED019BA52E8006F60D5 /* libc++.dylib */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\tC06134E01A718BB800D22D12 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = E8AB719E19BA502500F3EDB4 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = C0DC42051A7079D00067156A;\n\t\t\tremoteInfo = TodayExtension;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXCopyFilesBuildPhase section */\n\t\t3F336E871DA2F8A4006CB5A0 /* Embed Watch Content */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"$(CONTENTS_FOLDER_PATH)/Watch\";\n\t\t\tdstSubfolderSpec = 16;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tname = \"Embed Watch Content\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tC06134E21A718BB800D22D12 /* Embed App Extensions */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 13;\n\t\t\tfiles = (\n\t\t\t\tC06134DF1A718BB800D22D12 /* TodayExtension.appex in Embed App Extensions */,\n\t\t\t);\n\t\t\tname = \"Embed App Extensions\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXCopyFilesBuildPhase section */\n\n/* Begin PBXFileReference section */\n\t\t0295B8FE19D102880036D6C3 /* Realm.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Realm.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t0A73D4401B1442B200E1E8EE /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../../README.md; sourceTree = SOURCE_ROOT; };\n\t\t227D20DD1CB6009D008F641B /* LaunchScreen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LaunchScreen.xib; sourceTree = \"<group>\"; };\n\t\t3F08725D27F3C8CF007A1175 /* libcompression.tbd */ = {isa = PBXFileReference; lastKnownFileType = \"sourcecode.text-based-dylib-definition\"; name = libcompression.tbd; path = usr/lib/libcompression.tbd; sourceTree = SDKROOT; };\n\t\t3FC898FB1A140F550067CBEC /* LabelViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LabelViewController.h; sourceTree = \"<group>\"; };\n\t\t3FC898FC1A140F550067CBEC /* LabelViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LabelViewController.m; sourceTree = \"<group>\"; };\n\t\t7D56426A25DD66160079F4C2 /* Example_v0.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Example_v0.h; sourceTree = \"<group>\"; };\n\t\t7D56427625DD6A7F0079F4C2 /* Example_v2.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Example_v2.h; sourceTree = \"<group>\"; };\n\t\t7D56427725DD6A860079F4C2 /* Example_v3.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Example_v3.h; sourceTree = \"<group>\"; };\n\t\t7D56427825DD6A8B0079F4C2 /* Example_v4.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Example_v4.h; sourceTree = \"<group>\"; };\n\t\t7D56427925DD6A920079F4C2 /* Example_v5.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Example_v5.h; sourceTree = \"<group>\"; };\n\t\t7D718BC825DAADB500A74FDD /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../../swift/Migration/README.md; sourceTree = \"<group>\"; };\n\t\t7DD1D7D025DC2C7400E63229 /* default-v1.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"default-v1.realm\"; sourceTree = \"<group>\"; };\n\t\t7DD1D7D125DC2C7400E63229 /* default-v4.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"default-v4.realm\"; sourceTree = \"<group>\"; };\n\t\t7DD1D7D225DC2C7400E63229 /* default-v2.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"default-v2.realm\"; sourceTree = \"<group>\"; };\n\t\t7DD1D7D325DC2C7400E63229 /* default-v3.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"default-v3.realm\"; sourceTree = \"<group>\"; };\n\t\t7DD1D7D425DC2C7400E63229 /* default-v0.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"default-v0.realm\"; sourceTree = \"<group>\"; };\n\t\t7DD1D7D525DC2C7400E63229 /* default-v5.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"default-v5.realm\"; sourceTree = \"<group>\"; };\n\t\tC0DC41CC1A7072670067156A /* extension.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = extension.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tC0DC41D21A7072670067156A /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = \"<group>\"; };\n\t\tC0DC41D31A7072670067156A /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = \"<group>\"; };\n\t\tC0DC41FA1A7072DE0067156A /* Tick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tick.h; sourceTree = \"<group>\"; };\n\t\tC0DC41FB1A7072DE0067156A /* Tick.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Tick.m; sourceTree = \"<group>\"; };\n\t\tC0DC41FD1A7073E40067156A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = \"<group>\"; };\n\t\tC0DC41FF1A70775F0067156A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tC0DC42061A7079D00067156A /* TodayExtension.appex */ = {isa = PBXFileReference; explicitFileType = \"wrapper.app-extension\"; includeInIndex = 0; path = TodayExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tC0DC42071A7079D00067156A /* NotificationCenter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NotificationCenter.framework; path = System/Library/Frameworks/NotificationCenter.framework; sourceTree = SDKROOT; };\n\t\tC0DC420B1A7079D00067156A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tC0DC420C1A7079D00067156A /* TodayViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TodayViewController.h; sourceTree = \"<group>\"; };\n\t\tC0DC420D1A7079D00067156A /* TodayViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TodayViewController.m; sourceTree = \"<group>\"; };\n\t\tC0DC420F1A7079D00067156A /* MainInterface.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = MainInterface.storyboard; sourceTree = \"<group>\"; };\n\t\tC0DC421B1A717B660067156A /* TodayExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = TodayExtension.entitlements; sourceTree = \"<group>\"; };\n\t\tC0DC421C1A717BD00067156A /* Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Extension.entitlements; sourceTree = \"<group>\"; };\n\t\tE879D9D81A12AA120035E2EB /* GroupedTableView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GroupedTableView.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE879D9DB1A12AA400035E2EB /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = \"<group>\"; };\n\t\tE879D9DC1A12AA400035E2EB /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = \"<group>\"; };\n\t\tE879D9DD1A12AA400035E2EB /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = \"<group>\"; };\n\t\tE879D9DE1A12AA400035E2EB /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tE879D9DF1A12AA400035E2EB /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = \"<group>\"; };\n\t\tE879D9E01A12AA400035E2EB /* TableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableViewController.h; sourceTree = \"<group>\"; };\n\t\tE879D9E11A12AA400035E2EB /* TableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableViewController.m; sourceTree = \"<group>\"; };\n\t\tE8AB71A919BA502500F3EDB4 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };\n\t\tE8AB71AB19BA502500F3EDB4 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };\n\t\tE8AB71AD19BA502500F3EDB4 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };\n\t\tE8AB71C219BA502500F3EDB4 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };\n\t\tE8AB71DC19BA503500F3EDB4 /* Simple.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Simple.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE8AB720A19BA503B00F3EDB4 /* Migration.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Migration.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE8AB723819BA504000F3EDB4 /* Encryption.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Encryption.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE8AB726619BA504500F3EDB4 /* TableView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TableView.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE8AB729419BA504900F3EDB4 /* REST.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = REST.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE8BDBFA11A116FAC00450CFF /* Backlink.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Backlink.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE8BDBFC81A116FCB00450CFF /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = \"<group>\"; };\n\t\tE8BDBFC91A116FCB00450CFF /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = \"<group>\"; };\n\t\tE8BDBFCA1A116FCB00450CFF /* Backlink-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = \"Backlink-Info.plist\"; sourceTree = \"<group>\"; };\n\t\tE8BDBFCB1A116FCB00450CFF /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = \"<group>\"; };\n\t\tE8F70E8F19BA5083006F60D5 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = \"<group>\"; };\n\t\tE8F70E9019BA5083006F60D5 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = \"<group>\"; };\n\t\tE8F70E9119BA5083006F60D5 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = \"<group>\"; };\n\t\tE8F70E9219BA5083006F60D5 /* Simple-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = \"Simple-Info.plist\"; sourceTree = \"<group>\"; };\n\t\tE8F70E9719BA508B006F60D5 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = \"<group>\"; };\n\t\tE8F70E9819BA508B006F60D5 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = \"<group>\"; };\n\t\tE8F70E9919BA508B006F60D5 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = \"<group>\"; };\n\t\tE8F70E9A19BA508B006F60D5 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = \"<group>\"; };\n\t\tE8F70E9B19BA508B006F60D5 /* TableView-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = \"TableView-Info.plist\"; sourceTree = \"<group>\"; };\n\t\tE8F70E9C19BA508B006F60D5 /* TableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableViewController.h; sourceTree = \"<group>\"; };\n\t\tE8F70E9D19BA508B006F60D5 /* TableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableViewController.m; sourceTree = \"<group>\"; };\n\t\tE8F70EA419BA5093006F60D5 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = \"<group>\"; };\n\t\tE8F70EA519BA5093006F60D5 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = \"<group>\"; };\n\t\tE8F70EA619BA5093006F60D5 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = \"<group>\"; };\n\t\tE8F70EA719BA5093006F60D5 /* REST-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = \"REST-Info.plist\"; sourceTree = \"<group>\"; };\n\t\tE8F70EA819BA5093006F60D5 /* Venue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Venue.h; sourceTree = \"<group>\"; };\n\t\tE8F70EA919BA5093006F60D5 /* Venue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Venue.m; sourceTree = \"<group>\"; };\n\t\tE8F70EAF19BA50A3006F60D5 /* Example_v1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Example_v1.h; sourceTree = \"<group>\"; };\n\t\tE8F70EB419BA50A3006F60D5 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = \"<group>\"; };\n\t\tE8F70EB519BA50A3006F60D5 /* Migration-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = \"Migration-Info.plist\"; sourceTree = \"<group>\"; };\n\t\tE8F70EB619BA50A3006F60D5 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = \"<group>\"; };\n\t\tE8F70EB719BA50A3006F60D5 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = \"<group>\"; };\n\t\tE8F70EC019BA50AB006F60D5 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = \"<group>\"; };\n\t\tE8F70EC119BA50AB006F60D5 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = \"<group>\"; };\n\t\tE8F70EC219BA50AB006F60D5 /* Encryption-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = \"Encryption-Info.plist\"; sourceTree = \"<group>\"; };\n\t\tE8F70EC319BA50AB006F60D5 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = \"<group>\"; };\n\t\tE8F70ED019BA52E8006F60D5 /* libc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = \"compiled.mach-o.dylib\"; name = \"libc++.dylib\"; path = \"usr/lib/libc++.dylib\"; sourceTree = SDKROOT; };\n\t\tF18464511DC1551200DAB8B9 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = \"sourcecode.text-based-dylib-definition\"; name = \"libc++.tbd\"; path = \"usr/lib/libc++.tbd\"; sourceTree = SDKROOT; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\tC0DC41C91A7072670067156A /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tC0DC41F41A70729D0067156A /* CoreGraphics.framework in Frameworks */,\n\t\t\t\tC0DC41F51A70729D0067156A /* Foundation.framework in Frameworks */,\n\t\t\t\tC0DC41F61A70729D0067156A /* libc++.dylib in Frameworks */,\n\t\t\t\t3F08726027F3C971007A1175 /* libcompression.tbd in Frameworks */,\n\t\t\t\tC0DC41F71A70729D0067156A /* Realm.framework in Frameworks */,\n\t\t\t\tC0DC41F81A70729D0067156A /* UIKit.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tC0DC42031A7079D00067156A /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tC06134E61A71AA5A00D22D12 /* CoreGraphics.framework in Frameworks */,\n\t\t\t\tC06134E51A71AA5600D22D12 /* Foundation.framework in Frameworks */,\n\t\t\t\tC0DC42191A707BF80067156A /* libc++.dylib in Frameworks */,\n\t\t\t\t3F08726127F3C977007A1175 /* libcompression.tbd in Frameworks */,\n\t\t\t\tC0DC42081A7079D00067156A /* NotificationCenter.framework in Frameworks */,\n\t\t\t\tC06134E41A71AA4E00D22D12 /* Realm.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE879D9CD1A12AA120035E2EB /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE879D9CF1A12AA120035E2EB /* CoreGraphics.framework in Frameworks */,\n\t\t\t\tE879D9D11A12AA120035E2EB /* Foundation.framework in Frameworks */,\n\t\t\t\tE879D9CE1A12AA120035E2EB /* libc++.dylib in Frameworks */,\n\t\t\t\t3F08726227F3C97D007A1175 /* libcompression.tbd in Frameworks */,\n\t\t\t\tE879D9D21A12AA120035E2EB /* Realm.framework in Frameworks */,\n\t\t\t\tE879D9D01A12AA120035E2EB /* UIKit.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8AB71D919BA503500F3EDB4 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8AB71DE19BA503500F3EDB4 /* CoreGraphics.framework in Frameworks */,\n\t\t\t\tE8AB71DD19BA503500F3EDB4 /* Foundation.framework in Frameworks */,\n\t\t\t\tE8F70ED119BA52E8006F60D5 /* libc++.dylib in Frameworks */,\n\t\t\t\t3F08726627F3C993007A1175 /* libcompression.tbd in Frameworks */,\n\t\t\t\t0295B8FF19D102880036D6C3 /* Realm.framework in Frameworks */,\n\t\t\t\tE8AB71DF19BA503500F3EDB4 /* UIKit.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8AB720719BA503B00F3EDB4 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8AB720C19BA503B00F3EDB4 /* CoreGraphics.framework in Frameworks */,\n\t\t\t\tE8AB720B19BA503B00F3EDB4 /* Foundation.framework in Frameworks */,\n\t\t\t\tE8F70ED519BA530C006F60D5 /* libc++.dylib in Frameworks */,\n\t\t\t\t3F08726427F3C989007A1175 /* libcompression.tbd in Frameworks */,\n\t\t\t\t0295B90019D102880036D6C3 /* Realm.framework in Frameworks */,\n\t\t\t\tE8AB720D19BA503B00F3EDB4 /* UIKit.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8AB723519BA504000F3EDB4 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8AB723A19BA504000F3EDB4 /* CoreGraphics.framework in Frameworks */,\n\t\t\t\tE8AB723919BA504000F3EDB4 /* Foundation.framework in Frameworks */,\n\t\t\t\tE8F70ED919BA534E006F60D5 /* libc++.dylib in Frameworks */,\n\t\t\t\t3F08725F27F3C96A007A1175 /* libcompression.tbd in Frameworks */,\n\t\t\t\t0295B90119D102880036D6C3 /* Realm.framework in Frameworks */,\n\t\t\t\tE8AB723B19BA504000F3EDB4 /* UIKit.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8AB726319BA504500F3EDB4 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8AB726819BA504500F3EDB4 /* CoreGraphics.framework in Frameworks */,\n\t\t\t\tE8AB726719BA504500F3EDB4 /* Foundation.framework in Frameworks */,\n\t\t\t\tE8F70EDD19BA5380006F60D5 /* libc++.dylib in Frameworks */,\n\t\t\t\t3F08726727F3C999007A1175 /* libcompression.tbd in Frameworks */,\n\t\t\t\t0295B90219D102880036D6C3 /* Realm.framework in Frameworks */,\n\t\t\t\tE8AB726919BA504500F3EDB4 /* UIKit.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8AB729119BA504900F3EDB4 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8AB729619BA504900F3EDB4 /* CoreGraphics.framework in Frameworks */,\n\t\t\t\tE8AB729519BA504900F3EDB4 /* Foundation.framework in Frameworks */,\n\t\t\t\tE8D5D6AA19BA53DF0053D333 /* libc++.dylib in Frameworks */,\n\t\t\t\t3F08726527F3C98E007A1175 /* libcompression.tbd in Frameworks */,\n\t\t\t\t0295B90319D102880036D6C3 /* Realm.framework in Frameworks */,\n\t\t\t\tE8AB729719BA504900F3EDB4 /* UIKit.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8BDBF9E1A116FAC00450CFF /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8BDBFD31A1172BC00450CFF /* CoreGraphics.framework in Frameworks */,\n\t\t\t\tE8BDBFD51A1172C300450CFF /* Foundation.framework in Frameworks */,\n\t\t\t\tE8BDBFD21A1172B600450CFF /* libc++.dylib in Frameworks */,\n\t\t\t\t3F08725E27F3C95E007A1175 /* libcompression.tbd in Frameworks */,\n\t\t\t\tE8BDBFD11A1172B200450CFF /* Realm.framework in Frameworks */,\n\t\t\t\tE8BDBFD41A1172BF00450CFF /* UIKit.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t227D20DC1CB6009D008F641B /* Common */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t227D20DD1CB6009D008F641B /* LaunchScreen.xib */,\n\t\t\t);\n\t\t\tpath = Common;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t7D718BED25DAADE400A74FDD /* Examples */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7D56426A25DD66160079F4C2 /* Example_v0.h */,\n\t\t\t\tE8F70EAF19BA50A3006F60D5 /* Example_v1.h */,\n\t\t\t\t7D56427625DD6A7F0079F4C2 /* Example_v2.h */,\n\t\t\t\t7D56427725DD6A860079F4C2 /* Example_v3.h */,\n\t\t\t\t7D56427825DD6A8B0079F4C2 /* Example_v4.h */,\n\t\t\t\t7D56427925DD6A920079F4C2 /* Example_v5.h */,\n\t\t\t);\n\t\t\tpath = Examples;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t7DD1D7D625DC2CC000E63229 /* RealmTemplates */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7DD1D7D425DC2C7400E63229 /* default-v0.realm */,\n\t\t\t\t7DD1D7D025DC2C7400E63229 /* default-v1.realm */,\n\t\t\t\t7DD1D7D225DC2C7400E63229 /* default-v2.realm */,\n\t\t\t\t7DD1D7D325DC2C7400E63229 /* default-v3.realm */,\n\t\t\t\t7DD1D7D125DC2C7400E63229 /* default-v4.realm */,\n\t\t\t\t7DD1D7D525DC2C7400E63229 /* default-v5.realm */,\n\t\t\t);\n\t\t\tpath = RealmTemplates;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tC0DC41CD1A7072670067156A /* Extension */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tC0DC41D21A7072670067156A /* AppDelegate.h */,\n\t\t\t\tC0DC41D31A7072670067156A /* AppDelegate.m */,\n\t\t\t\tC0DC421C1A717BD00067156A /* Extension.entitlements */,\n\t\t\t\tC0DC41FF1A70775F0067156A /* Info.plist */,\n\t\t\t\tC0DC41FD1A7073E40067156A /* main.m */,\n\t\t\t\tC0DC41FA1A7072DE0067156A /* Tick.h */,\n\t\t\t\tC0DC41FB1A7072DE0067156A /* Tick.m */,\n\t\t\t);\n\t\t\tpath = Extension;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tC0DC42091A7079D00067156A /* TodayExtension */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tC0DC420A1A7079D00067156A /* Supporting Files */,\n\t\t\t\tC0DC420F1A7079D00067156A /* MainInterface.storyboard */,\n\t\t\t\tC0DC421B1A717B660067156A /* TodayExtension.entitlements */,\n\t\t\t\tC0DC420C1A7079D00067156A /* TodayViewController.h */,\n\t\t\t\tC0DC420D1A7079D00067156A /* TodayViewController.m */,\n\t\t\t);\n\t\t\tpath = TodayExtension;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tC0DC420A1A7079D00067156A /* Supporting Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tC0DC420B1A7079D00067156A /* Info.plist */,\n\t\t\t);\n\t\t\tname = \"Supporting Files\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE879D9DA1A12AA400035E2EB /* GroupedTableView */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE879D9DB1A12AA400035E2EB /* AppDelegate.h */,\n\t\t\t\tE879D9DC1A12AA400035E2EB /* AppDelegate.m */,\n\t\t\t\tE879D9DD1A12AA400035E2EB /* Images.xcassets */,\n\t\t\t\tE879D9DE1A12AA400035E2EB /* Info.plist */,\n\t\t\t\tE879D9DF1A12AA400035E2EB /* main.m */,\n\t\t\t\tE879D9E01A12AA400035E2EB /* TableViewController.h */,\n\t\t\t\tE879D9E11A12AA400035E2EB /* TableViewController.m */,\n\t\t\t);\n\t\t\tpath = GroupedTableView;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8AB719D19BA502500F3EDB4 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE8BDBFC71A116FCB00450CFF /* Backlink */,\n\t\t\t\t227D20DC1CB6009D008F641B /* Common */,\n\t\t\t\tE8F70EBF19BA50AB006F60D5 /* Encryption */,\n\t\t\t\tC0DC41CD1A7072670067156A /* Extension */,\n\t\t\t\tE8AB71A819BA502500F3EDB4 /* Frameworks */,\n\t\t\t\tE879D9DA1A12AA400035E2EB /* GroupedTableView */,\n\t\t\t\tE8F70EAE19BA50A3006F60D5 /* Migration */,\n\t\t\t\tE8AB71A719BA502500F3EDB4 /* Products */,\n\t\t\t\tE8F70EA319BA5093006F60D5 /* REST */,\n\t\t\t\tE8F70E8E19BA5083006F60D5 /* Simple */,\n\t\t\t\tE8F70E9619BA508B006F60D5 /* TableView */,\n\t\t\t\tC0DC42091A7079D00067156A /* TodayExtension */,\n\t\t\t\t0A73D4401B1442B200E1E8EE /* README.md */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8AB71A719BA502500F3EDB4 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE8BDBFA11A116FAC00450CFF /* Backlink.app */,\n\t\t\t\tE8AB723819BA504000F3EDB4 /* Encryption.app */,\n\t\t\t\tC0DC41CC1A7072670067156A /* extension.app */,\n\t\t\t\tE879D9D81A12AA120035E2EB /* GroupedTableView.app */,\n\t\t\t\tE8AB720A19BA503B00F3EDB4 /* Migration.app */,\n\t\t\t\tE8AB729419BA504900F3EDB4 /* REST.app */,\n\t\t\t\tE8AB71DC19BA503500F3EDB4 /* Simple.app */,\n\t\t\t\tE8AB726619BA504500F3EDB4 /* TableView.app */,\n\t\t\t\tC0DC42061A7079D00067156A /* TodayExtension.appex */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8AB71A819BA502500F3EDB4 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE8AB71AB19BA502500F3EDB4 /* CoreGraphics.framework */,\n\t\t\t\tE8AB71A919BA502500F3EDB4 /* Foundation.framework */,\n\t\t\t\tE8F70ED019BA52E8006F60D5 /* libc++.dylib */,\n\t\t\t\tF18464511DC1551200DAB8B9 /* libc++.tbd */,\n\t\t\t\t3F08725D27F3C8CF007A1175 /* libcompression.tbd */,\n\t\t\t\tC0DC42071A7079D00067156A /* NotificationCenter.framework */,\n\t\t\t\t0295B8FE19D102880036D6C3 /* Realm.framework */,\n\t\t\t\tE8AB71AD19BA502500F3EDB4 /* UIKit.framework */,\n\t\t\t\tE8AB71C219BA502500F3EDB4 /* XCTest.framework */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8BDBFC71A116FCB00450CFF /* Backlink */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE8BDBFC81A116FCB00450CFF /* AppDelegate.h */,\n\t\t\t\tE8BDBFC91A116FCB00450CFF /* AppDelegate.m */,\n\t\t\t\tE8BDBFCA1A116FCB00450CFF /* Backlink-Info.plist */,\n\t\t\t\tE8BDBFCB1A116FCB00450CFF /* main.m */,\n\t\t\t);\n\t\t\tpath = Backlink;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8F70E8E19BA5083006F60D5 /* Simple */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE8F70E8F19BA5083006F60D5 /* AppDelegate.h */,\n\t\t\t\tE8F70E9019BA5083006F60D5 /* AppDelegate.m */,\n\t\t\t\tE8F70E9119BA5083006F60D5 /* main.m */,\n\t\t\t\tE8F70E9219BA5083006F60D5 /* Simple-Info.plist */,\n\t\t\t);\n\t\t\tpath = Simple;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8F70E9619BA508B006F60D5 /* TableView */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE8F70E9719BA508B006F60D5 /* AppDelegate.h */,\n\t\t\t\tE8F70E9819BA508B006F60D5 /* AppDelegate.m */,\n\t\t\t\tE8F70E9919BA508B006F60D5 /* Images.xcassets */,\n\t\t\t\tE8F70E9A19BA508B006F60D5 /* main.m */,\n\t\t\t\tE8F70E9B19BA508B006F60D5 /* TableView-Info.plist */,\n\t\t\t\tE8F70E9C19BA508B006F60D5 /* TableViewController.h */,\n\t\t\t\tE8F70E9D19BA508B006F60D5 /* TableViewController.m */,\n\t\t\t);\n\t\t\tpath = TableView;\n\t\t\tsourceTree = SOURCE_ROOT;\n\t\t};\n\t\tE8F70EA319BA5093006F60D5 /* REST */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE8F70EA419BA5093006F60D5 /* AppDelegate.h */,\n\t\t\t\tE8F70EA519BA5093006F60D5 /* AppDelegate.m */,\n\t\t\t\tE8F70EA619BA5093006F60D5 /* main.m */,\n\t\t\t\tE8F70EA719BA5093006F60D5 /* REST-Info.plist */,\n\t\t\t\tE8F70EA819BA5093006F60D5 /* Venue.h */,\n\t\t\t\tE8F70EA919BA5093006F60D5 /* Venue.m */,\n\t\t\t);\n\t\t\tpath = REST;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8F70EAE19BA50A3006F60D5 /* Migration */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7D718BED25DAADE400A74FDD /* Examples */,\n\t\t\t\t7DD1D7D625DC2CC000E63229 /* RealmTemplates */,\n\t\t\t\tE8F70EB619BA50A3006F60D5 /* AppDelegate.h */,\n\t\t\t\tE8F70EB719BA50A3006F60D5 /* AppDelegate.m */,\n\t\t\t\tE8F70EB419BA50A3006F60D5 /* main.m */,\n\t\t\t\tE8F70EB519BA50A3006F60D5 /* Migration-Info.plist */,\n\t\t\t\t7D718BC825DAADB500A74FDD /* README.md */,\n\t\t\t);\n\t\t\tpath = Migration;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8F70EBF19BA50AB006F60D5 /* Encryption */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE8F70EC019BA50AB006F60D5 /* AppDelegate.h */,\n\t\t\t\tE8F70EC119BA50AB006F60D5 /* AppDelegate.m */,\n\t\t\t\tE8F70EC219BA50AB006F60D5 /* Encryption-Info.plist */,\n\t\t\t\t3FC898FB1A140F550067CBEC /* LabelViewController.h */,\n\t\t\t\t3FC898FC1A140F550067CBEC /* LabelViewController.m */,\n\t\t\t\tE8F70EC319BA50AB006F60D5 /* main.m */,\n\t\t\t);\n\t\t\tpath = Encryption;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXNativeTarget section */\n\t\tC0DC41CB1A7072670067156A /* extension */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = C0DC41EC1A7072680067156A /* Build configuration list for PBXNativeTarget \"extension\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tC0DC41C81A7072670067156A /* Sources */,\n\t\t\t\tC0DC41C91A7072670067156A /* Frameworks */,\n\t\t\t\t227D20831CB4E4B9008F641B /* Resources */,\n\t\t\t\t3F336E871DA2F8A4006CB5A0 /* Embed Watch Content */,\n\t\t\t\tC06134E21A718BB800D22D12 /* Embed App Extensions */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\tC06134E11A718BB800D22D12 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = extension;\n\t\t\tproductName = Extension;\n\t\t\tproductReference = C0DC41CC1A7072670067156A /* extension.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\tC0DC42051A7079D00067156A /* TodayExtension */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = C0DC42141A7079D00067156A /* Build configuration list for PBXNativeTarget \"TodayExtension\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tC0DC42021A7079D00067156A /* Sources */,\n\t\t\t\tC0DC42031A7079D00067156A /* Frameworks */,\n\t\t\t\tC0DC42041A7079D00067156A /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = TodayExtension;\n\t\t\tproductName = TodayExtension;\n\t\t\tproductReference = C0DC42061A7079D00067156A /* TodayExtension.appex */;\n\t\t\tproductType = \"com.apple.product-type.app-extension\";\n\t\t};\n\t\tE879D9C61A12AA120035E2EB /* GroupedTableView */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = E879D9D51A12AA120035E2EB /* Build configuration list for PBXNativeTarget \"GroupedTableView\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE879D9C91A12AA120035E2EB /* Sources */,\n\t\t\t\tE879D9CD1A12AA120035E2EB /* Frameworks */,\n\t\t\t\tE879D9D31A12AA120035E2EB /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = GroupedTableView;\n\t\t\tproductName = TableView;\n\t\t\tproductReference = E879D9D81A12AA120035E2EB /* GroupedTableView.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\tE8AB71DB19BA503500F3EDB4 /* Simple */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = E8AB720019BA503500F3EDB4 /* Build configuration list for PBXNativeTarget \"Simple\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE8AB71D819BA503500F3EDB4 /* Sources */,\n\t\t\t\tE8AB71D919BA503500F3EDB4 /* Frameworks */,\n\t\t\t\t227D20A51CB50248008F641B /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = Simple;\n\t\t\tproductName = Simple;\n\t\t\tproductReference = E8AB71DC19BA503500F3EDB4 /* Simple.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\tE8AB720919BA503B00F3EDB4 /* Migration */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = E8AB722E19BA503B00F3EDB4 /* Build configuration list for PBXNativeTarget \"Migration\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE8AB720619BA503B00F3EDB4 /* Sources */,\n\t\t\t\tE8AB720719BA503B00F3EDB4 /* Frameworks */,\n\t\t\t\tE8AB720819BA503B00F3EDB4 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = Migration;\n\t\t\tproductName = Migration;\n\t\t\tproductReference = E8AB720A19BA503B00F3EDB4 /* Migration.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\tE8AB723719BA504000F3EDB4 /* Encryption */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = E8AB725C19BA504000F3EDB4 /* Build configuration list for PBXNativeTarget \"Encryption\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE8AB723419BA504000F3EDB4 /* Sources */,\n\t\t\t\tE8AB723519BA504000F3EDB4 /* Frameworks */,\n\t\t\t\t227D20801CB4E36D008F641B /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = Encryption;\n\t\t\tproductName = Encryption;\n\t\t\tproductReference = E8AB723819BA504000F3EDB4 /* Encryption.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\tE8AB726519BA504500F3EDB4 /* TableView */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = E8AB728A19BA504500F3EDB4 /* Build configuration list for PBXNativeTarget \"TableView\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE8AB726219BA504500F3EDB4 /* Sources */,\n\t\t\t\tE8AB726319BA504500F3EDB4 /* Frameworks */,\n\t\t\t\tE8AB726419BA504500F3EDB4 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = TableView;\n\t\t\tproductName = TableView;\n\t\t\tproductReference = E8AB726619BA504500F3EDB4 /* TableView.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\tE8AB729319BA504900F3EDB4 /* REST */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = E8AB72B819BA504900F3EDB4 /* Build configuration list for PBXNativeTarget \"REST\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE8AB729019BA504900F3EDB4 /* Sources */,\n\t\t\t\tE8AB729119BA504900F3EDB4 /* Frameworks */,\n\t\t\t\t227D208C1CB4E6C5008F641B /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = REST;\n\t\t\tproductName = REST;\n\t\t\tproductReference = E8AB729419BA504900F3EDB4 /* REST.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\tE8BDBFA01A116FAC00450CFF /* Backlink */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = E8BDBFC51A116FAC00450CFF /* Build configuration list for PBXNativeTarget \"Backlink\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE8BDBF9D1A116FAC00450CFF /* Sources */,\n\t\t\t\tE8BDBF9E1A116FAC00450CFF /* Frameworks */,\n\t\t\t\t227D20A21CB501A1008F641B /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = Backlink;\n\t\t\tproductName = Backlink;\n\t\t\tproductReference = E8BDBFA11A116FAC00450CFF /* Backlink.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tE8AB719E19BA502500F3EDB4 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tCLASSPREFIX = RLM;\n\t\t\t\tLastUpgradeCheck = 1430;\n\t\t\t\tORGANIZATIONNAME = Realm;\n\t\t\t\tTargetAttributes = {\n\t\t\t\t\tC0DC41CB1A7072670067156A = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 6.2;\n\t\t\t\t\t\tSystemCapabilities = {\n\t\t\t\t\t\t\tcom.apple.ApplicationGroups.iOS = {\n\t\t\t\t\t\t\t\tenabled = 1;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t\tC0DC42051A7079D00067156A = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 6.2;\n\t\t\t\t\t\tSystemCapabilities = {\n\t\t\t\t\t\t\tcom.apple.ApplicationGroups.iOS = {\n\t\t\t\t\t\t\t\tenabled = 1;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t\tE8BDBFA01A116FAC00450CFF = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 6.1;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tbuildConfigurationList = E8AB71A119BA502500F3EDB4 /* Build configuration list for PBXProject \"RealmExamples\" */;\n\t\t\tcompatibilityVersion = \"Xcode 3.2\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t\tBase,\n\t\t\t);\n\t\t\tmainGroup = E8AB719D19BA502500F3EDB4;\n\t\t\tproductRefGroup = E8AB71A719BA502500F3EDB4 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\tE8BDBFA01A116FAC00450CFF /* Backlink */,\n\t\t\t\tE8AB723719BA504000F3EDB4 /* Encryption */,\n\t\t\t\tC0DC41CB1A7072670067156A /* extension */,\n\t\t\t\tC0DC42051A7079D00067156A /* TodayExtension */,\n\t\t\t\tE879D9C61A12AA120035E2EB /* GroupedTableView */,\n\t\t\t\tE8AB720919BA503B00F3EDB4 /* Migration */,\n\t\t\t\tE8AB729319BA504900F3EDB4 /* REST */,\n\t\t\t\tE8AB71DB19BA503500F3EDB4 /* Simple */,\n\t\t\t\tE8AB726519BA504500F3EDB4 /* TableView */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t227D20801CB4E36D008F641B /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t227D20DF1CB6009D008F641B /* LaunchScreen.xib in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t227D20831CB4E4B9008F641B /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t227D20E01CB6009D008F641B /* LaunchScreen.xib in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t227D208C1CB4E6C5008F641B /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t227D20E41CB6009D008F641B /* LaunchScreen.xib in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t227D20A21CB501A1008F641B /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t227D20DE1CB6009D008F641B /* LaunchScreen.xib in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t227D20A51CB50248008F641B /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t227D20E51CB6009D008F641B /* LaunchScreen.xib in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tC0DC42041A7079D00067156A /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tC0DC42101A7079D00067156A /* MainInterface.storyboard in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE879D9D31A12AA120035E2EB /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE879D9E31A12AA400035E2EB /* Images.xcassets in Resources */,\n\t\t\t\t227D20E11CB6009D008F641B /* LaunchScreen.xib in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8AB720819BA503B00F3EDB4 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t7DD1D7E425DC2D3D00E63229 /* default-v0.realm in Resources */,\n\t\t\t\t7DD1D7E725DC2D3D00E63229 /* default-v1.realm in Resources */,\n\t\t\t\t7DD1D7E225DC2D3D00E63229 /* default-v2.realm in Resources */,\n\t\t\t\t7DD1D7E325DC2D3D00E63229 /* default-v3.realm in Resources */,\n\t\t\t\t7DD1D7E625DC2D3D00E63229 /* default-v4.realm in Resources */,\n\t\t\t\t7DD1D7E525DC2D3D00E63229 /* default-v5.realm in Resources */,\n\t\t\t\t227D20E31CB6009D008F641B /* LaunchScreen.xib in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8AB726419BA504500F3EDB4 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8F70E9F19BA508B006F60D5 /* Images.xcassets in Resources */,\n\t\t\t\t227D20E61CB6009D008F641B /* LaunchScreen.xib in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\tC0DC41C81A7072670067156A /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tC0DC41D41A7072680067156A /* AppDelegate.m in Sources */,\n\t\t\t\tC0DC42011A7078130067156A /* main.m in Sources */,\n\t\t\t\tC0DC41FC1A7072DE0067156A /* Tick.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tC0DC42021A7079D00067156A /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tC0DC42181A707B960067156A /* Tick.m in Sources */,\n\t\t\t\tC0DC420E1A7079D00067156A /* TodayViewController.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE879D9C91A12AA120035E2EB /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE879D9E21A12AA400035E2EB /* AppDelegate.m in Sources */,\n\t\t\t\tE879D9E51A12AA400035E2EB /* main.m in Sources */,\n\t\t\t\tE879D9E61A12AA400035E2EB /* TableViewController.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8AB71D819BA503500F3EDB4 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8F70E9319BA5083006F60D5 /* AppDelegate.m in Sources */,\n\t\t\t\tE8F70E9419BA5083006F60D5 /* main.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8AB720619BA503B00F3EDB4 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8F70EBE19BA50A3006F60D5 /* AppDelegate.m in Sources */,\n\t\t\t\tE8F70EBC19BA50A3006F60D5 /* main.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8AB723419BA504000F3EDB4 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8F70EC419BA50AB006F60D5 /* AppDelegate.m in Sources */,\n\t\t\t\t3FC898FD1A140F550067CBEC /* LabelViewController.m in Sources */,\n\t\t\t\tE8F70EC619BA50AB006F60D5 /* main.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8AB726219BA504500F3EDB4 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8F70E9E19BA508B006F60D5 /* AppDelegate.m in Sources */,\n\t\t\t\tE8F70EA019BA508B006F60D5 /* main.m in Sources */,\n\t\t\t\tE8F70EA219BA508B006F60D5 /* TableViewController.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8AB729019BA504900F3EDB4 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8F70EAA19BA5093006F60D5 /* AppDelegate.m in Sources */,\n\t\t\t\tE8F70EAB19BA5093006F60D5 /* main.m in Sources */,\n\t\t\t\tE8F70EAD19BA5093006F60D5 /* Venue.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8BDBF9D1A116FAC00450CFF /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8BDBFCC1A116FCB00450CFF /* AppDelegate.m in Sources */,\n\t\t\t\tE8BDBFCE1A116FCB00450CFF /* main.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\tC06134E11A718BB800D22D12 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = C0DC42051A7079D00067156A /* TodayExtension */;\n\t\t\ttargetProxy = C06134E01A718BB800D22D12 /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\tAC1CA6392B1FF0BE002167B0 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tCONFIGURATION_BUILD_DIR = \"$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\";\n\t\t\t\tCONFIGURATION_TEMP_DIR = \"$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\";\n\t\t\t\tCOPY_PHASE_STRIP = YES;\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tOTHER_LDFLAGS = \"-lz\";\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\tAC1CA63A2B1FF0BE002167B0 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/Backlink/Backlink-Info.plist\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\tAC1CA63C2B1FF0BE002167B0 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tINFOPLIST_FILE = \"Encryption/Encryption-Info.plist\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\tAC1CA63D2B1FF0BE002167B0 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = Extension/Extension.entitlements;\n\t\t\t\tCODE_SIGN_IDENTITY = \"iPhone Developer\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tINFOPLIST_FILE = Extension/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.examples.$(PRODUCT_NAME:rfc1034identifier)\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tPROVISIONING_PROFILE = \"\";\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\tAC1CA63E2B1FF0BE002167B0 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = TodayExtension/TodayExtension.entitlements;\n\t\t\t\tCODE_SIGN_IDENTITY = \"iPhone Developer\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tINFOPLIST_FILE = TodayExtension/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks\";\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.examples.extension.$(PRODUCT_NAME:rfc1034identifier)-2\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tPROVISIONING_PROFILE = \"\";\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\tAC1CA63F2B1FF0BE002167B0 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/GroupedTableView/Info.plist\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tOTHER_LDFLAGS = (\n\t\t\t\t\t\"-lz\",\n\t\t\t\t\t\"-ObjC\",\n\t\t\t\t);\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = GroupedTableView;\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\tAC1CA6412B1FF0BE002167B0 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tINFOPLIST_FILE = \"Migration/Migration-Info.plist\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\tAC1CA6422B1FF0BE002167B0 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tINFOPLIST_FILE = \"REST/REST-Info.plist\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\tAC1CA6432B1FF0BE002167B0 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tINFOPLIST_FILE = \"Simple/Simple-Info.plist\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\tAC1CA6442B1FF0BE002167B0 /* Static */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tINFOPLIST_FILE = \"TableView/TableView-Info.plist\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Static;\n\t\t};\n\t\tC0DC41ED1A7072680067156A /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = Extension/Extension.entitlements;\n\t\t\t\tCODE_SIGN_IDENTITY = \"iPhone Developer\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = Extension/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = YES;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.examples.$(PRODUCT_NAME:rfc1034identifier)\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tPROVISIONING_PROFILE = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tC0DC41EE1A7072680067156A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = Extension/Extension.entitlements;\n\t\t\t\tCODE_SIGN_IDENTITY = \"iPhone Developer\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tINFOPLIST_FILE = Extension/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.examples.$(PRODUCT_NAME:rfc1034identifier)\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tPROVISIONING_PROFILE = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tC0DC42151A7079D00067156A /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = TodayExtension/TodayExtension.entitlements;\n\t\t\t\tCODE_SIGN_IDENTITY = \"iPhone Developer\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = TodayExtension/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks\";\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = YES;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.examples.extension.$(PRODUCT_NAME:rfc1034identifier)-2\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tPROVISIONING_PROFILE = \"\";\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tC0DC42161A7079D00067156A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = TodayExtension/TodayExtension.entitlements;\n\t\t\t\tCODE_SIGN_IDENTITY = \"iPhone Developer\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tINFOPLIST_FILE = TodayExtension/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks\";\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.examples.extension.$(PRODUCT_NAME:rfc1034identifier)-2\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tPROVISIONING_PROFILE = \"\";\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE879D9D61A12AA120035E2EB /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/GroupedTableView/Info.plist\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tOTHER_LDFLAGS = (\n\t\t\t\t\t\"-lz\",\n\t\t\t\t\t\"-ObjC\",\n\t\t\t\t);\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = GroupedTableView;\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE879D9D71A12AA120035E2EB /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/GroupedTableView/Info.plist\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tOTHER_LDFLAGS = (\n\t\t\t\t\t\"-lz\",\n\t\t\t\t\t\"-ObjC\",\n\t\t\t\t);\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = GroupedTableView;\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE8AB71D019BA502500F3EDB4 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tCONFIGURATION_BUILD_DIR = \"$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\";\n\t\t\t\tCONFIGURATION_TEMP_DIR = \"$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_SYMBOLS_PRIVATE_EXTERN = NO;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tOTHER_LDFLAGS = \"-lz\";\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE8AB71D119BA502500F3EDB4 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tCONFIGURATION_BUILD_DIR = \"$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\";\n\t\t\t\tCONFIGURATION_TEMP_DIR = \"$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\";\n\t\t\t\tCOPY_PHASE_STRIP = YES;\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tOTHER_LDFLAGS = \"-lz\";\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE8AB720119BA503500F3EDB4 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = \"Simple/Simple-Info.plist\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE8AB720219BA503500F3EDB4 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tINFOPLIST_FILE = \"Simple/Simple-Info.plist\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE8AB722F19BA503B00F3EDB4 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = \"Migration/Migration-Info.plist\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE8AB723019BA503B00F3EDB4 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tINFOPLIST_FILE = \"Migration/Migration-Info.plist\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE8AB725D19BA504000F3EDB4 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = \"Encryption/Encryption-Info.plist\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE8AB725E19BA504000F3EDB4 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tINFOPLIST_FILE = \"Encryption/Encryption-Info.plist\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE8AB728B19BA504500F3EDB4 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = \"TableView/TableView-Info.plist\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE8AB728C19BA504500F3EDB4 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tINFOPLIST_FILE = \"TableView/TableView-Info.plist\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE8AB72B919BA504900F3EDB4 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = \"REST/REST-Info.plist\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE8AB72BA19BA504900F3EDB4 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tINFOPLIST_FILE = \"REST/REST-Info.plist\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE8BDBFC11A116FAC00450CFF /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/Backlink/Backlink-Info.plist\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = YES;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE8BDBFC21A116FAC00450CFF /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/Backlink/Backlink-Info.plist\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\tC0DC41EC1A7072680067156A /* Build configuration list for PBXNativeTarget \"extension\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tC0DC41ED1A7072680067156A /* Debug */,\n\t\t\t\tC0DC41EE1A7072680067156A /* Release */,\n\t\t\t\tAC1CA63D2B1FF0BE002167B0 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tC0DC42141A7079D00067156A /* Build configuration list for PBXNativeTarget \"TodayExtension\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tC0DC42151A7079D00067156A /* Debug */,\n\t\t\t\tC0DC42161A7079D00067156A /* Release */,\n\t\t\t\tAC1CA63E2B1FF0BE002167B0 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE879D9D51A12AA120035E2EB /* Build configuration list for PBXNativeTarget \"GroupedTableView\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE879D9D61A12AA120035E2EB /* Debug */,\n\t\t\t\tE879D9D71A12AA120035E2EB /* Release */,\n\t\t\t\tAC1CA63F2B1FF0BE002167B0 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE8AB71A119BA502500F3EDB4 /* Build configuration list for PBXProject \"RealmExamples\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE8AB71D019BA502500F3EDB4 /* Debug */,\n\t\t\t\tE8AB71D119BA502500F3EDB4 /* Release */,\n\t\t\t\tAC1CA6392B1FF0BE002167B0 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE8AB720019BA503500F3EDB4 /* Build configuration list for PBXNativeTarget \"Simple\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE8AB720119BA503500F3EDB4 /* Debug */,\n\t\t\t\tE8AB720219BA503500F3EDB4 /* Release */,\n\t\t\t\tAC1CA6432B1FF0BE002167B0 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE8AB722E19BA503B00F3EDB4 /* Build configuration list for PBXNativeTarget \"Migration\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE8AB722F19BA503B00F3EDB4 /* Debug */,\n\t\t\t\tE8AB723019BA503B00F3EDB4 /* Release */,\n\t\t\t\tAC1CA6412B1FF0BE002167B0 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE8AB725C19BA504000F3EDB4 /* Build configuration list for PBXNativeTarget \"Encryption\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE8AB725D19BA504000F3EDB4 /* Debug */,\n\t\t\t\tE8AB725E19BA504000F3EDB4 /* Release */,\n\t\t\t\tAC1CA63C2B1FF0BE002167B0 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE8AB728A19BA504500F3EDB4 /* Build configuration list for PBXNativeTarget \"TableView\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE8AB728B19BA504500F3EDB4 /* Debug */,\n\t\t\t\tE8AB728C19BA504500F3EDB4 /* Release */,\n\t\t\t\tAC1CA6442B1FF0BE002167B0 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE8AB72B819BA504900F3EDB4 /* Build configuration list for PBXNativeTarget \"REST\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE8AB72B919BA504900F3EDB4 /* Debug */,\n\t\t\t\tE8AB72BA19BA504900F3EDB4 /* Release */,\n\t\t\t\tAC1CA6422B1FF0BE002167B0 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE8BDBFC51A116FAC00450CFF /* Build configuration list for PBXNativeTarget \"Backlink\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE8BDBFC11A116FAC00450CFF /* Debug */,\n\t\t\t\tE8BDBFC21A116FAC00450CFF /* Release */,\n\t\t\t\tAC1CA63A2B1FF0BE002167B0 /* Static */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = E8AB719E19BA502500F3EDB4 /* Project object */;\n}\n"
  },
  {
    "path": "examples/ios/objc/RealmExamples.xcodeproj/xcshareddata/xcschemes/Backlink.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5DD7557B1BE056DE002800DA\"\n               BuildableName = \"Realm.framework\"\n               BlueprintName = \"Realm iOS static\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E8BDBFA01A116FAC00450CFF\"\n               BuildableName = \"Backlink.app\"\n               BlueprintName = \"Backlink\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8BDBFA01A116FAC00450CFF\"\n            BuildableName = \"Backlink.app\"\n            BlueprintName = \"Backlink\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8BDBFA01A116FAC00450CFF\"\n            BuildableName = \"Backlink.app\"\n            BlueprintName = \"Backlink\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8BDBFA01A116FAC00450CFF\"\n            BuildableName = \"Backlink.app\"\n            BlueprintName = \"Backlink\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/ios/objc/RealmExamples.xcodeproj/xcshareddata/xcschemes/Encryption.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5DD7557B1BE056DE002800DA\"\n               BuildableName = \"Realm.framework\"\n               BlueprintName = \"Realm iOS static\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E8AB723719BA504000F3EDB4\"\n               BuildableName = \"Encryption.app\"\n               BlueprintName = \"Encryption\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8AB723719BA504000F3EDB4\"\n            BuildableName = \"Encryption.app\"\n            BlueprintName = \"Encryption\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"\"\n      selectedLauncherIdentifier = \"Xcode.IDEFoundation.Launcher.PosixSpawn\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8AB723719BA504000F3EDB4\"\n            BuildableName = \"Encryption.app\"\n            BlueprintName = \"Encryption\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8AB723719BA504000F3EDB4\"\n            BuildableName = \"Encryption.app\"\n            BlueprintName = \"Encryption\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/ios/objc/RealmExamples.xcodeproj/xcshareddata/xcschemes/Extension.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5DD7557B1BE056DE002800DA\"\n               BuildableName = \"Realm.framework\"\n               BlueprintName = \"Realm iOS static\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"C0DC41CB1A7072670067156A\"\n               BuildableName = \"extension.app\"\n               BlueprintName = \"extension\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"C0DC41CB1A7072670067156A\"\n            BuildableName = \"extension.app\"\n            BlueprintName = \"extension\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"C0DC41CB1A7072670067156A\"\n            BuildableName = \"extension.app\"\n            BlueprintName = \"extension\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"C0DC41CB1A7072670067156A\"\n            BuildableName = \"extension.app\"\n            BlueprintName = \"extension\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/ios/objc/RealmExamples.xcodeproj/xcshareddata/xcschemes/GroupedTableView.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5DD7557B1BE056DE002800DA\"\n               BuildableName = \"Realm.framework\"\n               BlueprintName = \"Realm iOS static\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E879D9C61A12AA120035E2EB\"\n               BuildableName = \"GroupedTableView.app\"\n               BlueprintName = \"GroupedTableView\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E879D9C61A12AA120035E2EB\"\n            BuildableName = \"GroupedTableView.app\"\n            BlueprintName = \"GroupedTableView\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E879D9C61A12AA120035E2EB\"\n            BuildableName = \"GroupedTableView.app\"\n            BlueprintName = \"GroupedTableView\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E879D9C61A12AA120035E2EB\"\n            BuildableName = \"GroupedTableView.app\"\n            BlueprintName = \"GroupedTableView\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/ios/objc/RealmExamples.xcodeproj/xcshareddata/xcschemes/Migration.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5DD7557B1BE056DE002800DA\"\n               BuildableName = \"Realm.framework\"\n               BlueprintName = \"Realm iOS static\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E8AB720919BA503B00F3EDB4\"\n               BuildableName = \"Migration.app\"\n               BlueprintName = \"Migration\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8AB720919BA503B00F3EDB4\"\n            BuildableName = \"Migration.app\"\n            BlueprintName = \"Migration\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8AB720919BA503B00F3EDB4\"\n            BuildableName = \"Migration.app\"\n            BlueprintName = \"Migration\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8AB720919BA503B00F3EDB4\"\n            BuildableName = \"Migration.app\"\n            BlueprintName = \"Migration\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/ios/objc/RealmExamples.xcodeproj/xcshareddata/xcschemes/REST.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5DD7557B1BE056DE002800DA\"\n               BuildableName = \"Realm.framework\"\n               BlueprintName = \"Realm iOS static\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E8AB729319BA504900F3EDB4\"\n               BuildableName = \"REST.app\"\n               BlueprintName = \"REST\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8AB729319BA504900F3EDB4\"\n            BuildableName = \"REST.app\"\n            BlueprintName = \"REST\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8AB729319BA504900F3EDB4\"\n            BuildableName = \"REST.app\"\n            BlueprintName = \"REST\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8AB729319BA504900F3EDB4\"\n            BuildableName = \"REST.app\"\n            BlueprintName = \"REST\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/ios/objc/RealmExamples.xcodeproj/xcshareddata/xcschemes/Simple.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5DD7557B1BE056DE002800DA\"\n               BuildableName = \"Realm.framework\"\n               BlueprintName = \"Realm iOS static\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E8AB71DB19BA503500F3EDB4\"\n               BuildableName = \"Simple.app\"\n               BlueprintName = \"Simple\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8AB71DB19BA503500F3EDB4\"\n            BuildableName = \"Simple.app\"\n            BlueprintName = \"Simple\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8AB71DB19BA503500F3EDB4\"\n            BuildableName = \"Simple.app\"\n            BlueprintName = \"Simple\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8AB71DB19BA503500F3EDB4\"\n            BuildableName = \"Simple.app\"\n            BlueprintName = \"Simple\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/ios/objc/RealmExamples.xcodeproj/xcshareddata/xcschemes/TableView.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5DD7557B1BE056DE002800DA\"\n               BuildableName = \"Realm.framework\"\n               BlueprintName = \"Realm iOS static\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E8AB726519BA504500F3EDB4\"\n               BuildableName = \"TableView.app\"\n               BlueprintName = \"TableView\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8AB726519BA504500F3EDB4\"\n            BuildableName = \"TableView.app\"\n            BlueprintName = \"TableView\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8AB726519BA504500F3EDB4\"\n            BuildableName = \"TableView.app\"\n            BlueprintName = \"TableView\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8AB726519BA504500F3EDB4\"\n            BuildableName = \"TableView.app\"\n            BlueprintName = \"TableView\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/ios/objc/RealmExamples.xcodeproj/xcshareddata/xcschemes/TodayExtension.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   wasCreatedForAppExtension = \"YES\"\n   version = \"2.0\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5DD7557B1BE056DE002800DA\"\n               BuildableName = \"Realm.framework\"\n               BlueprintName = \"Realm iOS static\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"C0DC42051A7079D00067156A\"\n               BuildableName = \"TodayExtension.appex\"\n               BlueprintName = \"TodayExtension\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"C0DC41CB1A7072670067156A\"\n               BuildableName = \"extension.app\"\n               BlueprintName = \"extension\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"C0DC41CB1A7072670067156A\"\n            BuildableName = \"extension.app\"\n            BlueprintName = \"extension\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"\"\n      selectedLauncherIdentifier = \"Xcode.IDEFoundation.Launcher.PosixSpawn\"\n      launchStyle = \"0\"\n      askForAppToLaunch = \"Yes\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\"\n      launchAutomaticallySubstyle = \"2\">\n      <RemoteRunnable\n         runnableDebuggingMode = \"2\"\n         BundleIdentifier = \"com.apple.springboard\"\n         RemotePath = \"/Today\">\n      </RemoteRunnable>\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"C0DC41CB1A7072670067156A\"\n            BuildableName = \"extension.app\"\n            BlueprintName = \"extension\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      launchAutomaticallySubstyle = \"2\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"C0DC41CB1A7072670067156A\"\n            BuildableName = \"extension.app\"\n            BlueprintName = \"extension\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/ios/objc/RealmExamples.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"group:RealmExamples.xcodeproj\">\n   </FileRef>\n   <FileRef\n      location = \"group:../../../Realm.xcodeproj\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "examples/ios/objc/RealmExamples.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>IDEDidComputeMac32BitWarning</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/objc/RealmExamples.xcworkspace/xcshareddata/RealmExamples.xcscmblueprint",
    "content": "{\n  \"DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey\" : \"9FB1FDDBA011002795A1FF5BD3CABFA2F79E6A59\",\n  \"DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey\" : {\n\n  },\n  \"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey\" : {\n    \"9FB1FDDBA011002795A1FF5BD3CABFA2F79E6A59\" : 9223372036854775807,\n    \"8F3C415DA79CDA7D23734F285B95F9F9A3C0CB81\" : 9223372036854775807\n  },\n  \"DVTSourceControlWorkspaceBlueprintIdentifierKey\" : \"2AC1F783-2EB4-4770-9637-97862959857C\",\n  \"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey\" : {\n    \"9FB1FDDBA011002795A1FF5BD3CABFA2F79E6A59\" : \"realm-cocoa\\/\",\n    \"8F3C415DA79CDA7D23734F285B95F9F9A3C0CB81\" : \"realm-cocoa\\/Realm\\/ObjectStore\\/\"\n  },\n  \"DVTSourceControlWorkspaceBlueprintNameKey\" : \"RealmExamples\",\n  \"DVTSourceControlWorkspaceBlueprintVersion\" : 204,\n  \"DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey\" : \"examples\\/ios\\/objc\\/RealmExamples.xcworkspace\",\n  \"DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey\" : [\n    {\n      \"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey\" : \"https:\\/\\/github.com\\/realm\\/realm-object-store.git\",\n      \"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey\" : \"com.apple.dt.Xcode.sourcecontrol.Git\",\n      \"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey\" : \"8F3C415DA79CDA7D23734F285B95F9F9A3C0CB81\"\n    },\n    {\n      \"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey\" : \"https:\\/\\/www.github.com\\/realm\\/realm-cocoa\",\n      \"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey\" : \"com.apple.dt.Xcode.sourcecontrol.Git\",\n      \"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey\" : \"9FB1FDDBA011002795A1FF5BD3CABFA2F79E6A59\"\n    }\n  ]\n}"
  },
  {
    "path": "examples/ios/objc/RealmExamples.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>\n\t<false/>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/objc/Simple/AppDelegate.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n@interface AppDelegate : UIResponder <UIApplicationDelegate>\n\n@property (strong, nonatomic) UIWindow *window;\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/Simple/AppDelegate.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"AppDelegate.h\"\n#import <Realm/Realm.h>\n\n// Define your models\n@interface Dog : RLMObject\n@property NSString *name;\n@property NSInteger age;\n@end\n\n@implementation Dog\n// No need for implementation\n@end\n\nRLM_COLLECTION_TYPE(Dog)\n\n@interface Person : RLMObject\n@property NSString      *name;\n@property RLMArray<Dog> *dogs;\n@end\n\n@implementation Person\n@end\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{\n    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];\n    self.window.rootViewController = [[UIViewController alloc] init];\n    [self.window makeKeyAndVisible];\n\n    [[NSFileManager defaultManager] removeItemAtURL:[RLMRealmConfiguration defaultConfiguration].fileURL error:nil];\n\n    // Create a standalone object\n    Dog *mydog = [[Dog alloc] init];\n\n    // Set & read properties\n    mydog.name = @\"Rex\";\n    mydog.age = 9;\n    NSLog(@\"Name of dog: %@\", mydog.name);\n\n    // Realms are used to group data together\n    RLMRealm *realm = [RLMRealm defaultRealm]; // Create realm pointing to default file\n\n    // Save your object\n    [realm beginWriteTransaction];\n    [realm addObject:mydog];\n    [realm commitWriteTransaction];\n\n    // Query\n    RLMResults *results = [Dog objectsInRealm:realm where:@\"name contains 'x'\"];\n\n    // Queries are chainable!\n    RLMResults *results2 = [results objectsWhere:@\"age > 8\"];\n    NSLog(@\"Number of dogs: %li\", (unsigned long)results2.count);\n\n    // Link objects\n    Person *person = [[Person alloc] init];\n    person.name = @\"Tim\";\n    [person.dogs addObject:mydog];\n\n    [realm beginWriteTransaction];\n    [realm addObject:person];\n    [realm commitWriteTransaction];\n\n    // Multi-threading\n    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{\n        @autoreleasepool {\n            RLMRealm *otherRealm = [RLMRealm defaultRealm];\n            RLMResults *otherResults = [Dog objectsInRealm:otherRealm where:@\"name contains 'Rex'\"];\n            NSLog(@\"Number of dogs: %li\", (unsigned long)otherResults.count);\n        }\n    });\n\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/Simple/Simple-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleDisplayName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1.0</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/objc/Simple/main.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n#import \"AppDelegate.h\"\n\nint main(int argc, char * argv[])\n{\n    @autoreleasepool {\n        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));\n    }\n}\n"
  },
  {
    "path": "examples/ios/objc/TableView/AppDelegate.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n@interface AppDelegate : UIResponder <UIApplicationDelegate>\n\n@property (strong, nonatomic) UIWindow *window;\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/TableView/AppDelegate.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"AppDelegate.h\"\n#import \"TableViewController.h\"\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{\n    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];\n\n    self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:\n                                      [[TableViewController alloc] initWithStyle:UITableViewStylePlain]];\n    [self.window makeKeyAndVisible];\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/TableView/Images.xcassets/AppIcon.appiconset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"60x60\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"76x76\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"76x76\",\n      \"scale\" : \"2x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/ios/objc/TableView/Images.xcassets/LaunchImage.launchimage/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"iphone\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"iphone\",\n      \"subtype\" : \"retina4\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"ipad\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"orientation\" : \"landscape\",\n      \"idiom\" : \"ipad\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"ipad\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"orientation\" : \"landscape\",\n      \"idiom\" : \"ipad\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"2x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/ios/objc/TableView/TableView-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleDisplayName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1.0</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations~ipad</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationPortraitUpsideDown</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/objc/TableView/TableViewController.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n@interface TableViewController : UITableViewController\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/TableView/TableViewController.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"TableViewController.h\"\n#import <Realm/Realm.h>\n\n// Realm model object\n@interface DemoObject : RLMObject\n@property NSString *title;\n@property NSDate   *date;\n@end\n\n@implementation DemoObject\n// None needed\n@end\n\nstatic NSString * const kCellID    = @\"cell\";\nstatic NSString * const kTableName = @\"table\";\n\n@interface TableViewController ()\n\n@property (nonatomic, strong) RLMResults *array;\n@property (nonatomic, strong) RLMNotificationToken *notification;\n\n@end\n\n@implementation TableViewController\n\n#pragma mark - View Lifecycle\n\n- (void)viewDidLoad\n{\n    [super viewDidLoad];\n    self.array = [[DemoObject allObjects] sortedResultsUsingKeyPath:@\"date\" ascending:YES];\n    [self setupUI];\n\n    // Set realm notification block\n    __weak typeof(self) weakSelf = self;\n    self.notification = [self.array addNotificationBlock:^(RLMResults *data, RLMCollectionChange *changes, NSError *error) {\n        if (error) {\n            NSLog(@\"Failed to open Realm on background worker: %@\", error);\n            return;\n        }\n\n        UITableView *tv = weakSelf.tableView;\n        // Initial run of the query will pass nil for the change information\n        if (!changes) {\n            [tv reloadData];\n            return;\n        }\n\n        // changes is non-nil, so we just need to update the tableview\n        [tv beginUpdates];\n        [tv deleteRowsAtIndexPaths:[changes deletionsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic];\n        [tv insertRowsAtIndexPaths:[changes insertionsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic];\n        [tv reloadRowsAtIndexPaths:[changes modificationsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic];\n        [tv endUpdates];\n    }];\n}\n\n#pragma mark - UI\n\n- (void)setupUI\n{\n    self.title = @\"TableViewExample\";\n    self.navigationItem.leftBarButtonItem =\n        [[UIBarButtonItem alloc] initWithTitle:@\"BG Add\"\n                                         style:UIBarButtonItemStylePlain\n                                        target:self\n                                        action:@selector(backgroundAdd)];\n    self.navigationItem.rightBarButtonItem =\n        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd\n                                                      target:self\n                                                      action:@selector(add)];\n}\n\n#pragma mark - UITableViewDataSource\n\n- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section\n{\n    return self.array.count;\n}\n\n- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath\n{\n    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellID];\n\n    if (!cell) {\n        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle\n                                      reuseIdentifier:kCellID];\n    }\n\n    DemoObject *object = self.array[indexPath.row];\n    cell.textLabel.text = object.title;\n    cell.detailTextLabel.text = object.date.description;\n\n    return cell;\n}\n\n- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle\n                                            forRowAtIndexPath:(NSIndexPath *)indexPath\n{\n    if (editingStyle == UITableViewCellEditingStyleDelete) {\n        RLMRealm *realm = RLMRealm.defaultRealm;\n        [realm beginWriteTransaction];\n        [realm deleteObject:self.array[indexPath.row]];\n        [realm commitWriteTransaction];\n    }\n}\n\n#pragma mark - Actions\n\n- (void)backgroundAdd\n{\n    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);\n    // Import many items in a background thread\n    dispatch_async(queue, ^{\n        // Get new realm and table since we are in a new thread\n        @autoreleasepool {\n            RLMRealm *realm = [RLMRealm defaultRealm];\n            [realm beginWriteTransaction];\n            for (NSInteger index = 0; index < 5; index++) {\n                // Add row via dictionary. Order is ignored.\n                [DemoObject createInRealm:realm withValue:@{@\"title\": [self randomString],\n                                                             @\"date\": [self randomDate]}];\n            }\n            [realm commitWriteTransaction];\n        }\n    });\n}\n\n- (void)add\n{\n    RLMRealm *realm = RLMRealm.defaultRealm;\n    [realm beginWriteTransaction];\n    [DemoObject createInRealm:realm withValue:@[[self randomString], [self randomDate]]];\n    [realm commitWriteTransaction];\n}\n\n#pragma - Helpers\n\n- (NSString *)randomString\n{\n    return [NSString stringWithFormat:@\"Title %d\", arc4random()];\n}\n\n- (NSDate *)randomDate\n{\n    return [NSDate dateWithTimeIntervalSince1970:arc4random()];\n}\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/TableView/main.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n#import \"AppDelegate.h\"\n\nint main(int argc, char * argv[])\n{\n    @autoreleasepool {\n        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));\n    }\n}\n"
  },
  {
    "path": "examples/ios/objc/TodayExtension/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleDisplayName</key>\n\t<string>TodayExtension</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>XPC!</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>NSExtension</key>\n\t<dict>\n\t\t<key>NSExtensionMainStoryboard</key>\n\t\t<string>MainInterface</string>\n\t\t<key>NSExtensionPointIdentifier</key>\n\t\t<string>com.apple.widget-extension</string>\n\t</dict>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/objc/TodayExtension/MainInterface.storyboard",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\" version=\"3.0\" toolsVersion=\"6724\" systemVersion=\"14B25\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" initialViewController=\"M4Y-Lb-cyx\">\n    <dependencies>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"6711\"/>\n    </dependencies>\n    <scenes>\n        <!--Today View Controller-->\n        <scene sceneID=\"cwh-vc-ff4\">\n            <objects>\n                <viewController id=\"M4Y-Lb-cyx\" customClass=\"TodayViewController\" sceneMemberID=\"viewController\">\n                    <layoutGuides>\n                        <viewControllerLayoutGuide type=\"top\" id=\"Ft6-oW-KC0\"/>\n                        <viewControllerLayoutGuide type=\"bottom\" id=\"FKl-LY-JtV\"/>\n                    </layoutGuides>\n                    <view key=\"view\" contentMode=\"scaleToFill\" simulatedAppContext=\"notificationCenter\" id=\"S3S-Oj-5AN\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"320\" height=\"37\"/>\n                        <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n                    </view>\n                    <extendedEdge key=\"edgesForExtendedLayout\"/>\n                    <nil key=\"simulatedStatusBarMetrics\"/>\n                    <nil key=\"simulatedTopBarMetrics\"/>\n                    <nil key=\"simulatedBottomBarMetrics\"/>\n                    <freeformSimulatedSizeMetrics key=\"simulatedDestinationMetrics\"/>\n                    <size key=\"freeformSize\" width=\"320\" height=\"37\"/>\n                </viewController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"vXp-U4-Rya\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"516\" y=\"285\"/>\n        </scene>\n    </scenes>\n    <simulatedMetricsContainer key=\"defaultSimulatedMetrics\">\n        <simulatedStatusBarMetrics key=\"statusBar\"/>\n        <simulatedOrientationMetrics key=\"orientation\"/>\n        <simulatedScreenMetrics key=\"destination\" type=\"retina4\"/>\n    </simulatedMetricsContainer>\n</document>\n"
  },
  {
    "path": "examples/ios/objc/TodayExtension/TodayExtension.entitlements",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>com.apple.security.application-groups</key>\n\t<array>\n\t\t<string>group.io.realm.examples.extension</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/objc/TodayExtension/TodayViewController.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n@interface TodayViewController : UIViewController\n\n@end\n"
  },
  {
    "path": "examples/ios/objc/TodayExtension/TodayViewController.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2015 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"TodayViewController.h\"\n#import <NotificationCenter/NotificationCenter.h>\n\n#import \"Tick.h\"\n\n@interface TodayViewController () <NCWidgetProviding>\n\n@property (nonatomic, strong) UIButton *button;\n@property (nonatomic, strong) Tick *tick;\n@property (nonatomic, strong) RLMNotificationToken *notificationToken;\n\n@end\n\n@implementation TodayViewController\n\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    self.preferredContentSize = CGSizeMake(0, 200.0);\n    RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration];\n    configuration.fileURL = [[[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:@\"group.io.realm.examples.extension\"] URLByAppendingPathComponent:@\"extension.realm\"];\n    [RLMRealmConfiguration setDefaultConfiguration:configuration];\n    self.tick = [Tick allObjects].firstObject;\n    if (!self.tick) {\n        [[RLMRealm defaultRealm] transactionWithBlock:^{\n            self.tick = [Tick createInDefaultRealmWithValue:@[@\"\", @0]];\n        }];\n    }\n    self.notificationToken = [self.tick.realm addNotificationBlock:^(NSString *notification, RLMRealm *realm) {\n        // Occasionally, respond immediately to the notification by triggering a new notification.\n        if (self.tick.count % 19 == 0) {\n            [self tock];\n        }\n        [self updateLabel];\n    }];\n    self.button = [UIButton buttonWithType:UIButtonTypeSystem];\n    self.button.frame = self.view.bounds;\n    [self.button addTarget:self action:@selector(tock) forControlEvents:UIControlEventTouchUpInside];\n    self.button.titleLabel.textAlignment = NSTextAlignmentCenter;\n    [self.button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];\n    [self.view addSubview:self.button];\n    [self updateLabel];\n}\n\n- (void)viewWillAppear:(BOOL)animated {\n    [super viewWillAppear:animated];\n    self.button.frame = self.view.bounds;\n    [self updateLabel];\n}\n\n- (void)viewDidAppear:(BOOL)animated {\n    [super viewDidAppear:animated];\n    [self tock];\n    [self updateLabel];\n}\n\n- (void)updateLabel {\n    [self.button setTitle:@(self.tick.count).stringValue forState:UIControlStateNormal];\n}\n\n- (void)tock {\n    [[RLMRealm defaultRealm] transactionWithBlock:^{\n        self.tick.count++;\n    }];\n}\n\n@end\n"
  },
  {
    "path": "examples/ios/swift/.gitignore",
    "content": "Pods/\n"
  },
  {
    "path": "examples/ios/swift/AppClip/AppClip.entitlements",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>com.apple.developer.associated-domains</key>\n\t<array>\n\t\t<string>webcredentials:example.com</string>\n\t\t<string>appclips:example.com</string>\n\t</array>\n\t<key>com.apple.developer.parent-application-identifiers</key>\n\t<array>\n\t\t<string>$(AppIdentifierPrefix)io.realm.AppClip.AppClipParent</string>\n\t</array>\n\t<key>com.apple.security.application-groups</key>\n\t<array>\n\t\t<string>group.TEAM_ID.com.domain.APP_GROUP</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/swift/AppClip/AppClipApp.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport SwiftUI\nimport RealmSwift\n\n@main\nstruct AppClipApp: SwiftUI.App {\n    var body: some Scene {\n        WindowGroup {\n            // This is ContentView.swift shared from AppClipParent\n            ContentView(objects: demoObjects().list)\n        }\n    }\n\n    private func demoObjects() -> DemoObjects {\n        let config = Realm.Configuration(fileURL: FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: Constants.groupId)!.appendingPathComponent(\"default.realm\"))\n        let realm = try! Realm(configuration: config)\n\n        if let demoObjects = realm.object(ofType: DemoObjects.self, forPrimaryKey: 0) {\n            return demoObjects\n        } else {\n            return try! realm.write { realm.create(DemoObjects.self, value: []) }\n        }\n    }\n}\n"
  },
  {
    "path": "examples/ios/swift/AppClip/Assets.xcassets/AccentColor.colorset/Contents.json",
    "content": "{\n  \"colors\" : [\n    {\n      \"idiom\" : \"universal\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "examples/ios/swift/AppClip/Assets.xcassets/AppIcon.appiconset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"60x60\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"60x60\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"76x76\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"76x76\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"83.5x83.5\"\n    },\n    {\n      \"idiom\" : \"ios-marketing\",\n      \"scale\" : \"1x\",\n      \"size\" : \"1024x1024\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "examples/ios/swift/AppClip/Assets.xcassets/Contents.json",
    "content": "{\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "examples/ios/swift/AppClip/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>$(DEVELOPMENT_LANGUAGE)</string>\n\t<key>CFBundleDisplayName</key>\n\t<string>AppClipParent</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UIApplicationSceneManifest</key>\n\t<dict>\n\t\t<key>UIApplicationSupportsMultipleScenes</key>\n\t\t<true/>\n\t</dict>\n\t<key>UIApplicationSupportsIndirectInputEvents</key>\n\t<true/>\n\t<key>UILaunchScreen</key>\n\t<dict/>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations~ipad</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationPortraitUpsideDown</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/swift/AppClip/Preview Content/Preview Assets.xcassets/Contents.json",
    "content": "{\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "examples/ios/swift/AppClipParent/AppClipParent.entitlements",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>com.apple.developer.associated-domains</key>\n\t<array>\n\t\t<string>appclips:example.com</string>\n\t\t<string>webcredentials:example.com</string>\n\t</array>\n\t<key>com.apple.security.application-groups</key>\n\t<array>\n\t\t<string>group.TEAM_ID.com.domain.APP_GROUP</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/swift/AppClipParent/AppClipParentApp.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport SwiftUI\nimport RealmSwift\n\n@main\nstruct AppClipParentApp: SwiftUI.App {\n    var body: some Scene {\n        WindowGroup {\n            ContentView(objects: demoObjects().list)\n        }\n    }\n\n    private func demoObjects() -> DemoObjects {\n        let config = Realm.Configuration(fileURL: FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: Constants.groupId)!.appendingPathComponent(\"default.realm\"))\n        let realm = try! Realm(configuration: config)\n\n        if let demoObjects = realm.object(ofType: DemoObjects.self, forPrimaryKey: 0) {\n            return demoObjects\n        } else {\n            return try! realm.write { realm.create(DemoObjects.self, value: []) }\n        }\n    }\n}\n"
  },
  {
    "path": "examples/ios/swift/AppClipParent/Assets.xcassets/AccentColor.colorset/Contents.json",
    "content": "{\n  \"colors\" : [\n    {\n      \"idiom\" : \"universal\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "examples/ios/swift/AppClipParent/Assets.xcassets/AppIcon.appiconset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"60x60\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"60x60\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"76x76\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"76x76\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"83.5x83.5\"\n    },\n    {\n      \"idiom\" : \"ios-marketing\",\n      \"scale\" : \"1x\",\n      \"size\" : \"1024x1024\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "examples/ios/swift/AppClipParent/Assets.xcassets/Contents.json",
    "content": "{\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "examples/ios/swift/AppClipParent/Constants.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nstruct Constants {\n    static let groupId = \"group.TEAM_ID.com.domain.APP_GROUP\"\n}\n"
  },
  {
    "path": "examples/ios/swift/AppClipParent/ContentView.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport SwiftUI\nimport RealmSwift\n\nstruct ContentView: View {\n    @ObservedObject var objects: RealmSwift.List<DemoObject>\n\n    var body: some View {\n        Section(header: Button(\"Add Object\", action: addObject)) {\n            List {\n                ForEach(objects, id: \\.uuid) { object in\n                    ContentViewRow(object: object)\n                }\n            }\n        }\n    }\n\n    private func addObject() {\n        /*\n         The app clip and parent application share data by accessing a common realm file path within an App Group.\n         */\n        let config = Realm.Configuration(fileURL: FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: Constants.groupId)!.appendingPathComponent(\"default.realm\"))\n\n        let realm = try! Realm(configuration: config)\n        try! realm.write {\n            objects.append(DemoObject())\n        }\n    }\n}\n\nstruct ContentViewRow: View {\n    var object: DemoObject\n\n    var body: some View {\n        VStack {\n            Text(verbatim: object.uuid.uuidString).fixedSize()\n            Text(object.date.description).font(.footnote).frame(alignment: .leading)\n        }\n    }\n}\n"
  },
  {
    "path": "examples/ios/swift/AppClipParent/DemoObject.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2020 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport RealmSwift\n\nfinal class DemoObject: Object {\n    @Persisted var uuid: UUID\n    @Persisted var date: Date\n    @Persisted var title: String\n}\n\n/*\n For a more detailed example of SwiftUI List updating, see the ListSwiftUI example target.\n */\nfinal class DemoObjects: Object {\n    @Persisted(primaryKey: true) var id: Int\n    @Persisted var list: List<DemoObject>\n}\n"
  },
  {
    "path": "examples/ios/swift/AppClipParent/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>$(DEVELOPMENT_LANGUAGE)</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UIApplicationSceneManifest</key>\n\t<dict>\n\t\t<key>UIApplicationSupportsMultipleScenes</key>\n\t\t<true/>\n\t</dict>\n\t<key>UIApplicationSupportsIndirectInputEvents</key>\n\t<true/>\n\t<key>UILaunchScreen</key>\n\t<dict/>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations~ipad</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationPortraitUpsideDown</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/swift/AppClipParent/Preview Content/Preview Assets.xcassets/Contents.json",
    "content": "{\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "examples/ios/swift/Backlink/AppDelegate.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport UIKit\nimport RealmSwift\n\nclass Dog: Object {\n    @Persisted var name: String\n    @Persisted var age: Int\n    // Define \"owners\" as the inverse relationship to Person.dogs\n    @Persisted(originProperty: \"dogs\") var owners: LinkingObjects<Person>\n}\n\nclass Person: Object {\n    @Persisted var name: String\n    @Persisted var dogs: List<Dog>\n}\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n    var window: UIWindow?\n\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {\n        window = UIWindow(frame: UIScreen.main.bounds)\n        window?.rootViewController = UIViewController()\n        window?.makeKeyAndVisible()\n\n        _ = try! Realm.deleteFiles(for: Realm.Configuration.defaultConfiguration)\n\n        let realm = try! Realm()\n        try! realm.write {\n            realm.create(Person.self, value: [\"John\", [[\"Fido\", 1]]])\n            realm.create(Person.self, value: [\"Mary\", [[\"Rex\", 2]]])\n        }\n\n        // Log all dogs and their owners using the \"owners\" inverse relationship\n        let allDogs = realm.objects(Dog.self)\n        for dog in allDogs {\n            let ownerNames = Array(dog.owners.map(\\.name))\n            print(\"\\(dog.name) has \\(ownerNames.count) owners (\\(ownerNames))\")\n        }\n        return true\n    }\n}\n"
  },
  {
    "path": "examples/ios/swift/Backlink/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UIRequiresFullScreen</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/swift/Common/LaunchScreen.xib",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.XIB\" version=\"3.0\" toolsVersion=\"10116\" systemVersion=\"15F18b\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" launchScreen=\"YES\" useTraitCollections=\"YES\">\n    <dependencies>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"10085\"/>\n        <capability name=\"Constraints with non-1.0 multipliers\" minToolsVersion=\"5.1\"/>\n    </dependencies>\n    <objects>\n        <placeholder placeholderIdentifier=\"IBFilesOwner\" id=\"-1\" userLabel=\"File's Owner\"/>\n        <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"-2\" customClass=\"UIResponder\"/>\n        <view contentMode=\"scaleToFill\" id=\"iN0-l3-epB\">\n            <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"480\" height=\"480\"/>\n            <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n            <subviews>\n                <label opaque=\"NO\" clipsSubviews=\"YES\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"  Copyright (c) 2016 Realm. All rights reserved.\" textAlignment=\"center\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" minimumFontSize=\"9\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"8ie-xW-0ye\">\n                    <rect key=\"frame\" x=\"20\" y=\"439\" width=\"441\" height=\"21\"/>\n                    <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"17\"/>\n                    <color key=\"textColor\" red=\"0.0\" green=\"0.0\" blue=\"0.0\" alpha=\"1\" colorSpace=\"calibratedRGB\"/>\n                    <nil key=\"highlightedColor\"/>\n                    <variation key=\"widthClass=compact\">\n                        <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"11\"/>\n                    </variation>\n                </label>\n                <label opaque=\"NO\" clipsSubviews=\"YES\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"RealmExamples\" textAlignment=\"center\" lineBreakMode=\"middleTruncation\" baselineAdjustment=\"alignBaselines\" minimumFontSize=\"18\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"kId-c2-rCX\">\n                    <rect key=\"frame\" x=\"20\" y=\"140\" width=\"441\" height=\"43\"/>\n                    <fontDescription key=\"fontDescription\" type=\"boldSystem\" pointSize=\"36\"/>\n                    <color key=\"textColor\" red=\"0.0\" green=\"0.0\" blue=\"0.0\" alpha=\"1\" colorSpace=\"calibratedRGB\"/>\n                    <nil key=\"highlightedColor\"/>\n                </label>\n            </subviews>\n            <color key=\"backgroundColor\" white=\"1\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"calibratedWhite\"/>\n            <constraints>\n                <constraint firstItem=\"kId-c2-rCX\" firstAttribute=\"centerY\" secondItem=\"iN0-l3-epB\" secondAttribute=\"bottom\" multiplier=\"1/3\" constant=\"1\" id=\"Kid-kn-2rF\"/>\n                <constraint firstAttribute=\"centerX\" secondItem=\"kId-c2-rCX\" secondAttribute=\"centerX\" id=\"Koa-jz-hwk\"/>\n                <constraint firstAttribute=\"bottom\" secondItem=\"8ie-xW-0ye\" secondAttribute=\"bottom\" constant=\"20\" id=\"Kzo-t9-V3l\"/>\n                <constraint firstItem=\"8ie-xW-0ye\" firstAttribute=\"leading\" secondItem=\"iN0-l3-epB\" secondAttribute=\"leading\" constant=\"20\" symbolic=\"YES\" id=\"MfP-vx-nX0\"/>\n                <constraint firstAttribute=\"centerX\" secondItem=\"8ie-xW-0ye\" secondAttribute=\"centerX\" id=\"ZEH-qu-HZ9\"/>\n                <constraint firstItem=\"kId-c2-rCX\" firstAttribute=\"leading\" secondItem=\"iN0-l3-epB\" secondAttribute=\"leading\" constant=\"20\" symbolic=\"YES\" id=\"fvb-Df-36g\"/>\n            </constraints>\n            <nil key=\"simulatedStatusBarMetrics\"/>\n            <freeformSimulatedSizeMetrics key=\"simulatedDestinationMetrics\"/>\n            <point key=\"canvasLocation\" x=\"404\" y=\"445\"/>\n        </view>\n    </objects>\n</document>\n"
  },
  {
    "path": "examples/ios/swift/Encryption/AppDelegate.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport UIKit\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n    var window: UIWindow?\n\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {\n        window = UIWindow(frame: UIScreen.main.bounds)\n        window?.rootViewController = ViewController()\n        window?.makeKeyAndVisible()\n\n        return true\n    }\n}\n"
  },
  {
    "path": "examples/ios/swift/Encryption/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UIRequiresFullScreen</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/swift/Encryption/ViewController.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport RealmSwift\nimport Security\nimport UIKit\n\n// Model definition\nclass EncryptionObject: Object {\n    @Persisted var stringProp: String\n}\n\nclass ViewController: UIViewController {\n    let textView = UITextView(frame: UIScreen.main.applicationFrame)\n\n    // Create a view to display output in\n    override func loadView() {\n        super.loadView()\n        view.addSubview(textView)\n    }\n\n    override func viewDidAppear(_ animated: Bool) {\n        super.viewDidAppear(animated)\n\n        // Use an autorelease pool to close the Realm at the end of the block, so\n        // that we can try to reopen it with different keys\n        autoreleasepool {\n            let configuration = Realm.Configuration(encryptionKey: getKey() as Data)\n            let realm = try! Realm(configuration: configuration)\n\n            // Add an object\n            try! realm.write {\n                let obj = EncryptionObject()\n                obj.stringProp = \"abcd\"\n                realm.add(obj)\n            }\n        }\n\n        // Opening with wrong key fails since it decrypts to the wrong thing\n        autoreleasepool {\n            do {\n                let configuration = Realm.Configuration(encryptionKey: \"1234567890123456789012345678901234567890123456789012345678901234\".data(using: .utf8, allowLossyConversion: false))\n                _ = try Realm(configuration: configuration)\n            } catch {\n                log(text: \"Open with wrong key: \\(error)\")\n            }\n        }\n\n        // Opening without supplying a key at all fails\n        autoreleasepool {\n            do {\n                _ = try Realm()\n            } catch {\n                log(text: \"Open with no key: \\(error)\")\n            }\n        }\n\n        // Reopening with the correct key works and can read the data\n        autoreleasepool {\n            let configuration = Realm.Configuration(encryptionKey: getKey() as Data)\n            let realm = try! Realm(configuration: configuration)\n            if let stringProp = realm.objects(EncryptionObject.self).first?.stringProp {\n                log(text: \"Saved object: \\(stringProp)\")\n            }\n        }\n    }\n\n    func log(text: String) {\n        textView.text += \"\\(text)\\n\\n\"\n    }\n\n    func getKey() -> NSData {\n        // Identifier for our keychain entry - should be unique for your application\n        let keychainIdentifier = \"io.Realm.EncryptionExampleKey\"\n        let keychainIdentifierData = keychainIdentifier.data(using: String.Encoding.utf8, allowLossyConversion: false)!\n\n        // First check in the keychain for an existing key\n        var query: [NSString: AnyObject] = [\n            kSecClass: kSecClassKey,\n            kSecAttrApplicationTag: keychainIdentifierData as AnyObject,\n            kSecAttrKeySizeInBits: 512 as AnyObject,\n            kSecReturnData: true as AnyObject\n        ]\n\n        // To avoid Swift optimization bug, should use withUnsafeMutablePointer() function to retrieve the keychain item\n        // See also: http://stackoverflow.com/questions/24145838/querying-ios-keychain-using-swift/27721328#27721328\n        var dataTypeRef: AnyObject?\n        var status = withUnsafeMutablePointer(to: &dataTypeRef) { SecItemCopyMatching(query as CFDictionary, UnsafeMutablePointer($0)) }\n        if status == errSecSuccess {\n            return dataTypeRef as! NSData\n        }\n\n        // No pre-existing key from this application, so generate a new one\n        let keyData = NSMutableData(length: 64)!\n        let result = SecRandomCopyBytes(kSecRandomDefault, 64, keyData.mutableBytes.bindMemory(to: UInt8.self, capacity: 64))\n        assert(result == 0, \"Failed to get random bytes\")\n\n        // Store the key in the keychain\n        query = [\n            kSecClass: kSecClassKey,\n            kSecAttrApplicationTag: keychainIdentifierData as AnyObject,\n            kSecAttrKeySizeInBits: 512 as AnyObject,\n            kSecValueData: keyData\n        ]\n\n        status = SecItemAdd(query as CFDictionary, nil)\n        assert(status == errSecSuccess, \"Failed to insert the new key in the keychain\")\n\n        return keyData\n    }\n}\n"
  },
  {
    "path": "examples/ios/swift/GettingStarted.playground/Contents.swift",
    "content": "//: To get this Playground running do the following:\n//:\n//: 1) In the scheme selector choose RealmSwift > iPhone 6s\n//: 2) Press Cmd + B\n//: 3) If the Playground didn't already run press the ▶︎ button at the bottom\n\nimport Foundation\nimport RealmSwift\n\n//: I. Define the data entities\n\nclass Person: Object {\n    @Persisted var name: String\n    @Persisted var age: Int\n    @Persisted var spouse: Person?\n    @Persisted var cars: List<Car>\n\n    override var description: String { return \"Person {\\(name), \\(age), \\(spouse?.name ?? \"nil\")}\" }\n}\n\nclass Car: Object {\n    @Persisted var brand: String\n    @Persisted var name: String?\n    @Persisted var year: Int\n\n    override var description: String { return \"Car {\\(brand), \\(name), \\(year)}\" }\n}\n\n//: II. Init the realm file\n\nlet realm = try! Realm(configuration: Realm.Configuration(inMemoryIdentifier: \"TemporaryRealm\"))\n\n//: III. Create the objects\n\nlet car1 = Car(value: [\"brand\": \"BMW\", \"year\": 1980])\n\nlet car2 = Car()\ncar2.brand = \"DeLorean\"\ncar2.name = \"Outatime\"\ncar2.year = 1981\n\n// people\nlet wife = Person()\nwife.name = \"Jennifer\"\nwife.cars.append(objectsIn: [car1, car2])\nwife.age = 47\n\nlet husband = Person(value: [\n    \"name\": \"Marty\",\n    \"age\": 47,\n    \"spouse\": wife\n])\n\nwife.spouse = husband\n\n//: IV. Write objects to the realm\n\ntry! realm.write {\n    realm.add(husband)\n}\n\n//: V. Read objects back from the realm\n\nlet favorites = [\"Jennifer\"]\n\nlet favoritePeopleWithSpousesAndCars = realm.objects(Person.self)\n    .filter(\"cars.@count > 1 && spouse != nil && name IN %@\", favorites)\n    .sorted(byKeyPath: \"age\")\n\nfor person in favoritePeopleWithSpousesAndCars {\n    person.name\n    person.age\n\n    guard let car = person.cars.first else {\n        continue\n    }\n    car.name\n    car.brand\n\n//: VI. Update objects\n\n    try! realm.write {\n        car.year += 1\n    }\n    car.year\n}\n\n//: VII. Delete objects\n\ntry! realm.write {\n    realm.deleteAll()\n}\n\nrealm.objects(Person.self).count\n//: Thanks! To learn more about Realm go to https://www.mongodb.com/docs/realm/\n"
  },
  {
    "path": "examples/ios/swift/GettingStarted.playground/contents.xcplayground",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<playground version='5.0' target-platform='ios' display-mode='rendered'>\n    <timeline fileName='timeline.xctimeline'/>\n</playground>"
  },
  {
    "path": "examples/ios/swift/GroupedTableView/AppDelegate.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport UIKit\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n\n    var window: UIWindow?\n\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {\n        window = UIWindow(frame: UIScreen.main.bounds)\n        window?.rootViewController = UINavigationController(rootViewController: TableViewController(style: .plain))\n        window?.makeKeyAndVisible()\n        return true\n    }\n}\n"
  },
  {
    "path": "examples/ios/swift/GroupedTableView/Images.xcassets/AppIcon.appiconset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"20x20\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"20x20\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"60x60\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"60x60\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"20x20\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"20x20\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"76x76\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"76x76\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"83.5x83.5\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ios-marketing\",\n      \"size\" : \"1024x1024\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/ios/swift/GroupedTableView/Images.xcassets/LaunchImage.launchimage/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"iphone\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"iphone\",\n      \"subtype\" : \"retina4\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"ipad\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"orientation\" : \"landscape\",\n      \"idiom\" : \"ipad\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"ipad\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"orientation\" : \"landscape\",\n      \"idiom\" : \"ipad\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"2x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/ios/swift/GroupedTableView/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UIRequiresFullScreen</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/swift/GroupedTableView/TableViewController.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport UIKit\nimport RealmSwift\n\nclass DemoObject: Object {\n    @Persisted var phoneNumber: String\n    @Persisted var date: Date\n    @Persisted var contactName: String\n    var firstLetter: String {\n        guard let char = contactName.first else {\n            return \"\"\n        }\n        return String(char)\n    }\n}\n\nclass Cell: UITableViewCell {\n    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String!) {\n        super.init(style: .subtitle, reuseIdentifier: reuseIdentifier)\n    }\n\n    required init(coder: NSCoder) {\n        fatalError(\"NSCoding not supported\")\n    }\n}\n\nclass TableViewController: UITableViewController {\n    var notificationToken: NotificationToken?\n    var realm: Realm!\n    var sectionedResults: SectionedResults<String, DemoObject>!\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n\n        setupUI()\n        realm = try! Realm()\n        sectionedResults = realm.objects(DemoObject.self)\n            .sectioned(by: \\.firstLetter, ascending: true)\n\n        // Set realm notification block\n        notificationToken = sectionedResults.observe { change in\n            switch change {\n            case .initial:\n                break\n            case let .update(_,\n                             deletions: deletions,\n                             insertions: insertions,\n                             modifications: modifications,\n                             sectionsToInsert: sectionsToInsert,\n                             sectionsToDelete: sectionsToDelete):\n                self.tableView.performBatchUpdates {\n                    self.tableView.deleteRows(at: deletions, with: .automatic)\n                    self.tableView.insertRows(at: insertions, with: .automatic)\n                    self.tableView.reloadRows(at: modifications, with: .automatic)\n                    self.tableView.insertSections(sectionsToInsert, with: .automatic)\n                    self.tableView.deleteSections(sectionsToDelete, with: .automatic)\n                }\n            }\n        }\n        tableView.reloadData()\n    }\n\n    // UI\n\n    func setupUI() {\n        tableView.register(Cell.self, forCellReuseIdentifier: \"cell\")\n\n        self.title = \"GroupedTableView\"\n        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: \"BG Add\", style: .plain, target: self, action: #selector(TableViewController.backgroundAdd))\n        self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(TableViewController.add))\n    }\n\n    // Table view data source\n\n    override func numberOfSections(in tableView: UITableView) -> Int {\n        return sectionedResults.count\n    }\n\n    override func sectionIndexTitles(for tableView: UITableView) -> [String]? {\n        return sectionedResults.allKeys\n    }\n\n    override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {\n        return sectionedResults[section].key\n    }\n\n    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n        return sectionedResults[section].count\n    }\n\n    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n        let cell = tableView.dequeueReusableCell(withIdentifier: \"cell\", for: indexPath) as! Cell\n\n        let object = sectionedResults[indexPath]\n        cell.textLabel?.text = \"\\(object.contactName): \\(object.phoneNumber)\"\n        cell.detailTextLabel?.text = object.date.description\n\n        return cell\n    }\n\n    override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {\n        if editingStyle == .delete {\n            try! realm.write {\n                realm.delete(sectionedResults[indexPath])\n            }\n        }\n    }\n\n    // MARK: Actions\n\n    @objc func backgroundAdd() {\n        // Import many items in a background thread\n        DispatchQueue.global().async {\n            // Get new realm and table since we are in a new thread\n            autoreleasepool {\n                let realm = try! Realm()\n                realm.beginWrite()\n                for _ in 0..<5 {\n                    // Add row via dictionary. Order is ignored.\n                    realm.create(DemoObject.self, value: [\"contactName\": randomName(), \"date\": NSDate(), \"phoneNumber\": randomPhoneNumber()])\n                }\n                try! realm.commitWrite()\n            }\n        }\n    }\n\n    @objc func add() {\n        try! realm.write {\n            realm.create(DemoObject.self, value: [\"contactName\": randomName(), \"date\": NSDate(), \"phoneNumber\": randomPhoneNumber()])\n        }\n    }\n}\n\n// MARK: Helpers\n\nfunc randomPhoneNumber() -> String {\n    return \"555-55\\(Int.random(in: 0...9))5-55\\(Int.random(in: 0...9))\"\n}\n\nfunc randomName() -> String {\n    return [\"John\", \"Jane\", \"Mary\", \"Eric\", \"Sarah\", \"Sally\"].randomElement()!\n}\n"
  },
  {
    "path": "examples/ios/swift/ListSwiftUI/Assets.xcassets/AppIcon.appiconset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"20x20\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"20x20\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"60x60\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"60x60\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"20x20\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"20x20\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"76x76\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"76x76\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"83.5x83.5\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ios-marketing\",\n      \"size\" : \"1024x1024\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/ios/swift/ListSwiftUI/Assets.xcassets/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/ios/swift/ListSwiftUI/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>$(DEVELOPMENT_LANGUAGE)</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UIApplicationSceneManifest</key>\n\t<dict>\n\t\t<key>UIApplicationSupportsMultipleScenes</key>\n\t\t<false/>\n\t\t<key>UISceneConfigurations</key>\n\t\t<dict>\n\t\t\t<key>UIWindowSceneSessionRoleApplication</key>\n\t\t\t<array>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>UISceneConfigurationName</key>\n\t\t\t\t\t<string>Default Configuration</string>\n\t\t\t\t\t<key>UISceneDelegateClassName</key>\n\t\t\t\t\t<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>\n\t\t\t\t</dict>\n\t\t\t</array>\n\t\t</dict>\n\t</dict>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations~ipad</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationPortraitUpsideDown</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/swift/ListSwiftUI/Preview Content/Preview Assets.xcassets/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/ios/swift/ListSwiftUI/Views/App.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport Foundation\nimport SwiftUI\n\n@main\nstruct App: SwiftUI.App {\n    var view: some View {\n        ContentView()\n    }\n\n    var body: some Scene {\n        WindowGroup {\n            view\n        }\n    }\n}\n"
  },
  {
    "path": "examples/ios/swift/ListSwiftUI/Views/ContentView.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport RealmSwift\nimport SwiftUI\n\nclass Reminder: EmbeddedObject, ObjectKeyIdentifiable {\n    enum Priority: Int, PersistableEnum, CaseIterable, Identifiable, CustomStringConvertible {\n        var id: Int { self.rawValue }\n\n        case low, medium, high\n\n        var description: String {\n            switch self {\n            case .low: return \"low\"\n            case .medium: return \"medium\"\n            case .high: return \"high\"\n            }\n        }\n    }\n    @Persisted var title: String\n    @Persisted var notes: String\n    @Persisted var isFlagged: Bool\n    @Persisted var date: Date\n    @Persisted var isComplete: Bool\n    @Persisted var priority: Priority = .low\n}\n\nclass ReminderList: Object, ObjectKeyIdentifiable {\n    @Persisted var name = \"New List\"\n    @Persisted var icon: String = \"list.bullet\"\n    @Persisted var reminders: RealmSwift.List<Reminder>\n}\n\nstruct FocusableTextField: UIViewRepresentable {\n    class Coordinator: NSObject, UITextFieldDelegate {\n        @Binding var text: String\n        var didBecomeFirstResponder = false\n\n        init(text: Binding<String>) {\n            _text = text\n        }\n\n        func textFieldDidChangeSelection(_ textField: UITextField) {\n            text = textField.text ?? \"\"\n        }\n    }\n\n    let title: String\n    @Binding var text: String\n    @Binding var isFirstResponder: Bool\n\n    init(_ title: String, text: Binding<String>, isFirstResponder: Binding<Bool>) {\n        self.title = title\n        self._text = text\n        self._isFirstResponder = isFirstResponder\n    }\n\n    func makeUIView(context: UIViewRepresentableContext<Self>) -> UITextField {\n        let textField = UITextField(frame: .zero)\n        textField.placeholder = title\n        textField.delegate = context.coordinator\n        return textField\n    }\n\n    func makeCoordinator() -> Coordinator {\n        return Coordinator(text: $text)\n    }\n\n    func updateUIView(_ uiView: UITextField, context: UIViewRepresentableContext<Self>) {\n        uiView.text = text\n        if isFirstResponder && !context.coordinator.didBecomeFirstResponder {\n            uiView.becomeFirstResponder()\n            context.coordinator.didBecomeFirstResponder = true\n        }\n    }\n}\n\nstruct ReminderRowView: View {\n    @ObservedRealmObject var list: ReminderList\n    @ObservedRealmObject var reminder: Reminder\n    @State var hasFocus: Bool\n    @State var showReminderForm = false\n\n    var body: some View {\n        NavigationLink(destination: ReminderFormView(list: list,\n                                                     reminder: reminder,\n                                                     showReminderForm: $showReminderForm), isActive: $showReminderForm) {\n            FocusableTextField(\"title\", text: reminder.bind(\\.title), isFirstResponder: $hasFocus).textCase(.lowercase)\n        }.isDetailLink(true)\n    }\n}\n\nstruct ReminderFormView: View {\n    @ObservedRealmObject var list: ReminderList\n    @ObservedRealmObject var reminder: Reminder\n    @Binding var showReminderForm: Bool\n\n    var body: some View {\n        Form {\n            TextField(\"title\", text: $reminder.title)\n            DatePicker(\"date\", selection: $reminder.date)\n            Picker(\"priority\", selection: $reminder.priority, content: {\n                ForEach(Reminder.Priority.allCases) { priority in\n                    Text(priority.description).tag(priority)\n                }\n            })\n        }\n        .navigationTitle(reminder.title)\n        .navigationBarItems(trailing:\n        Button(\"Save\") {\n            if reminder.realm == nil {\n                $list.reminders.append(reminder)\n            }\n            showReminderForm.toggle()\n        }.disabled(reminder.title.isEmpty))\n    }\n}\n\nstruct ReminderListView: View {\n    @ObservedRealmObject var list: ReminderList\n    @State var newReminderAdded = false\n    @State var showReminderForm = false\n\n    func shouldFocusReminder(_ reminder: Reminder) -> Bool {\n        return newReminderAdded &&\n            list.reminders.lastIndex(of: reminder) == (list.reminders.count - 1)\n    }\n\n    var body: some View {\n        VStack {\n            List {\n                ForEach(list.reminders) { reminder in\n                    ReminderRowView(list: list,\n                                    reminder: reminder,\n                                    hasFocus: shouldFocusReminder(reminder))\n                }\n                .onMove(perform: $list.reminders.move)\n                .onDelete(perform: $list.reminders.remove)\n            }\n        }.navigationTitle(list.name)\n        .navigationBarItems(trailing: HStack {\n            EditButton()\n            Button(\"add\") {\n                newReminderAdded = true\n                $list.reminders.append(Reminder())\n            }.accessibility(identifier: \"addReminder\")\n        })\n    }\n}\n\nstruct ReminderListRowView: View {\n    @ObservedRealmObject var list: ReminderList\n\n    var body: some View {\n        HStack {\n            Image(systemName: list.icon)\n            TextField(\"List Name\", text: $list.name)\n            Spacer()\n            Text(\"\\(list.reminders.count)\")\n        }.frame(minWidth: 100)\n    }\n}\n\nstruct ReminderListResultsView: View {\n    @ObservedResults(ReminderList.self) var reminders\n    @Binding var searchFilter: String\n\n    var body: some View {\n        let list = List {\n            ForEach(reminders) { list in\n                NavigationLink(destination: ReminderListView(list: list)) {\n                    ReminderListRowView(list: list).tag(list)\n                }.accessibilityIdentifier(list.name)\n            }.onDelete(perform: $reminders.remove)\n        }\n        if #available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *) {\n            list\n                .searchable(text: $searchFilter,\n                            collection: $reminders,\n                            keyPath: \\.name) {\n                    ForEach(reminders) { remindersFiltered in\n                        Text(remindersFiltered.name).searchCompletion(remindersFiltered.name)\n                    }\n                }\n        } else {\n            list\n                .onChange(of: searchFilter) { value in\n                    $reminders.where = { $0.name.contains(value, options: .caseInsensitive) }\n                }\n        }\n    }\n}\n\npublic extension Color {\n    static let lightText = Color(UIColor.lightText)\n    static let darkText = Color(UIColor.darkText)\n\n    static let label = Color(UIColor.label)\n    static let secondaryLabel = Color(UIColor.secondaryLabel)\n    static let tertiaryLabel = Color(UIColor.tertiaryLabel)\n    static let quaternaryLabel = Color(UIColor.quaternaryLabel)\n\n    static let systemBackground = Color(UIColor.systemBackground)\n    static let secondarySystemBackground = Color(UIColor.secondarySystemBackground)\n    static let tertiarySystemBackground = Color(UIColor.tertiarySystemBackground)\n}\n\nstruct SearchView: View {\n    @Binding var searchFilter: String\n\n    var body: some View {\n        VStack {\n            Spacer()\n            HStack {\n                Image(systemName: \"magnifyingglass\").foregroundColor(.gray)\n                    .padding(.leading, 7)\n                    .padding(.top, 7)\n                    .padding(.bottom, 7)\n                TextField(\"search\", text: $searchFilter)\n                    .padding(.top, 7)\n                    .padding(.bottom, 7)\n            }.background(RoundedRectangle(cornerRadius: 15)\n                            .fill(Color.secondarySystemBackground))\n            Spacer()\n        }.frame(maxHeight: 40).padding()\n    }\n}\n\nstruct Footer: View {\n    @ObservedResults(ReminderList.self) var lists\n\n    var body: some View {\n        HStack {\n            Button(action: {\n                $lists.append(ReminderList())\n            }, label: {\n                HStack {\n                    Image(systemName: \"plus.circle\")\n                    Text(\"Add list\")\n                }\n            }).buttonStyle(BorderlessButtonStyle())\n            .padding()\n            .accessibility(identifier: \"addList\")\n            Spacer()\n        }\n    }\n}\n\nstruct ContentView: View {\n    @State var searchFilter: String = \"\"\n\n    var body: some View {\n        NavigationView {\n            VStack {\n                if #available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *) {\n                    // Don't add a SearchView in case searchable is available\n                } else {\n                    SearchView(searchFilter: $searchFilter)\n                }\n                ReminderListResultsView(searchFilter: $searchFilter)\n                Spacer()\n                Footer()\n            }\n            .navigationBarItems(trailing: EditButton())\n            .navigationTitle(\"reminders\")\n        }\n    }\n}\n\n#if DEBUG\nstruct Content_Preview: PreviewProvider {\n    static var previews: some View {\n        ContentView()\n    }\n}\n#endif\n"
  },
  {
    "path": "examples/ios/swift/Migration/AppDelegate.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport UIKit\nimport RealmSwift\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n\n    var window: UIWindow?\n\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {\n        window = UIWindow(frame: UIScreen.main.bounds)\n        window?.rootViewController = UIViewController()\n        window?.makeKeyAndVisible()\n\n        #if CREATE_EXAMPLES\n        addExampleDataToRealm(exampleData)\n        #else\n        performMigration()\n        #endif\n\n        return true\n    }\n\n    private func addExampleDataToRealm(_ exampleData: (Realm) -> Void) {\n        let url = realmUrl(for: schemaVersion, usingTemplate: false)\n        let configuration = Realm.Configuration(fileURL: url, schemaVersion: UInt64(schemaVersion))\n        let realm = try! Realm(configuration: configuration)\n\n        try! realm.write {\n            exampleData(realm)\n        }\n    }\n\n    // Any version before the current versions will be migrated to check if all version combinations work.\n    private func performMigration() {\n        for oldSchemaVersion in 0..<schemaVersion {\n            let url = realmUrl(for: oldSchemaVersion, usingTemplate: true)\n            let realmConfiguration = Realm.Configuration(fileURL: url, schemaVersion: UInt64(schemaVersion), migrationBlock: migrationBlock)\n            try! Realm.performMigration(for: realmConfiguration)\n            let realm = try! Realm(configuration: realmConfiguration)\n            migrationCheck(realm)\n        }\n    }\n\n    private func realmUrl(for schemaVersion: Int, usingTemplate: Bool) -> URL {\n        let defaultURL = Realm.Configuration.defaultConfiguration.fileURL!\n        let defaultParentURL = defaultURL.deletingLastPathComponent()\n        let fileName = \"default-v\\(schemaVersion)\"\n        let destinationUrl = defaultParentURL.appendingPathComponent(fileName + \".realm\")\n        if FileManager.default.fileExists(atPath: destinationUrl.path) {\n            try! FileManager.default.removeItem(at: destinationUrl)\n        }\n        if usingTemplate {\n            let bundleUrl = Bundle.main.url(forResource: fileName, withExtension: \"realm\")!\n            try! FileManager.default.copyItem(at: bundleUrl, to: destinationUrl)\n        }\n\n        return destinationUrl\n    }\n}\n"
  },
  {
    "path": "examples/ios/swift/Migration/Examples/Example_v0.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#if SCHEMA_VERSION_0\n\nimport Foundation\nimport RealmSwift\n\n// MARK: - Schema\n\nlet schemaVersion = 0\n\nclass Person: Object {\n    @Persisted var firstName = \"\"\n    @Persisted var lastName = \"\"\n    @Persisted var age = 0\n    convenience init(firstName: String, lastName: String, age: Int) {\n        self.init()\n        self.firstName = firstName\n        self.lastName = lastName\n        self.age = age\n    }\n}\n\n// MARK: - Migration\n\n// Migration block to migrate from *any* previous version to this version.\nlet migrationBlock: MigrationBlock = { _, _ in }\n\n// This block checks if the migration led to the expected result.\n// All older versions should have been migrated to the below stated `exampleData`.\nlet migrationCheck: (Realm) -> Void = { realm in\n    let persons = realm.objects(Person.self)\n    assert(persons.count == 3)\n    assert(persons[0].firstName == \"John\")\n    assert(persons[0].lastName == \"Doe\")\n    assert(persons[0].age == 42)\n    assert(persons[1].firstName == \"Jane\")\n    assert(persons[1].lastName == \"Doe\")\n    assert(persons[1].age == 43)\n    assert(persons[2].firstName == \"John\")\n    assert(persons[2].lastName == \"Smith\")\n    assert(persons[2].age == 44)\n}\n\n// MARK: - Example data\n\n// Example data for this schema version.\nlet exampleData: (Realm) -> Void = { realm in\n    let person1 = Person(firstName: \"John\", lastName: \"Doe\", age: 42)\n    let person2 = Person(firstName: \"Jane\", lastName: \"Doe\", age: 43)\n    let person3 = Person(firstName: \"John\", lastName: \"Smith\", age: 44)\n    realm.add([person1, person2, person3])\n}\n\n#endif\n"
  },
  {
    "path": "examples/ios/swift/Migration/Examples/Example_v1.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#if SCHEMA_VERSION_1\n\nimport Foundation\nimport RealmSwift\n\n// MARK: - Schema\n\nlet schemaVersion = 1\n\n// Changes from previous version:\n// - combine `firstName` and `lastName` into `fullName`\n\nclass Person: Object {\n    @Persisted var fullName = \"\"\n    @Persisted var age = 0\n    convenience init(fullName: String, age: Int) {\n        self.init()\n        self.fullName = fullName\n        self.age = age\n    }\n}\n\n// MARK: - Migration\n\n// Migration block to migrate from *any* previous version to this version.\nlet migrationBlock: MigrationBlock = { migration, oldSchemaVersion in\n    if oldSchemaVersion < 1 {\n        migration.enumerateObjects(ofType: Person.className()) { oldObject, newObject in\n            // combine name fields into a single field\n            let firstName = oldObject![\"firstName\"] as! String\n            let lastName = oldObject![\"lastName\"] as! String\n            newObject![\"fullName\"] = \"\\(firstName) \\(lastName)\"\n        }\n    }\n}\n\n// This block checks if the migration led to the expected result.\n// All older versions should have been migrated to the below stated `exampleData`.\nlet migrationCheck: (Realm) -> Void = { realm in\n    let persons = realm.objects(Person.self)\n    assert(persons.count == 3)\n    assert(persons[0].fullName == \"John Doe\")\n    assert(persons[0].age == 42)\n    assert(persons[1].fullName == \"Jane Doe\")\n    assert(persons[1].age == 43)\n    assert(persons[2].fullName == \"John Smith\")\n    assert(persons[2].age == 44)\n}\n\n// MARK: - Example data\n\n// Example data for this schema version.\nlet exampleData: (Realm) -> Void = { realm in\n    let person1 = Person(fullName: \"John Doe\", age: 42)\n    let person2 = Person(fullName: \"Jane Doe\", age: 43)\n    let person3 = Person(fullName: \"John Smith\", age: 44)\n    realm.add([person1, person2, person3])\n}\n\n#endif\n"
  },
  {
    "path": "examples/ios/swift/Migration/Examples/Example_v2.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#if SCHEMA_VERSION_2\n\nimport Foundation\nimport RealmSwift\n\n// MARK: - Schema\n\nlet schemaVersion = 2\n\n// Changes from previous version:\n// add a `Dog` object\n// add a list of `dogs` to the `Person` object\n\nclass Dog: Object {\n    @Persisted var name = \"\"\n    convenience init(name: String) {\n        self.init()\n        self.name = name\n    }\n}\n\nclass Person: Object {\n    @Persisted var fullName = \"\"\n    @Persisted var age = 0\n    @Persisted var dogs: List<Dog>\n    convenience init(fullName: String, age: Int) {\n        self.init()\n        self.fullName = fullName\n        self.age = age\n    }\n}\n\n// MARK: - Migration\n\n// Migration block to migrate from *any* previous version to this version.\nlet migrationBlock: MigrationBlock = { migration, oldSchemaVersion in\n    if oldSchemaVersion < 1 {\n        migration.enumerateObjects(ofType: Person.className()) { oldObject, newObject in\n            // combine name fields into a single field\n            let firstName = oldObject![\"firstName\"] as! String\n            let lastName = oldObject![\"lastName\"] as! String\n            newObject![\"fullName\"] = \"\\(firstName) \\(lastName)\"\n        }\n    }\n    if oldSchemaVersion < 2 {\n        migration.enumerateObjects(ofType: Person.className()) { _, newObject in\n            // Add a pet to a specific person\n            if newObject![\"fullName\"] as! String == \"John Doe\" {\n                let dogs = newObject![\"dogs\"] as! List<MigrationObject>\n                let marley = migration.create(Dog.className(), value: [\"Marley\"])\n                let lassie = migration.create(Dog.className(), value: [\"Lassie\"])\n                dogs.append(marley)\n                dogs.append(lassie)\n            } else if newObject![\"fullName\"] as! String == \"Jane Doe\" {\n                let dogs = newObject![\"dogs\"] as! List<MigrationObject>\n                let toto = migration.create(Dog.className(), value: [\"Toto\"])\n                dogs.append(toto)\n            }\n        }\n        let slinkey = migration.create(Dog.className(), value: [\"Slinkey\"])\n    }\n}\n\n// This block checks if the migration led to the expected result.\n// All older versions should have been migrated to the below stated `exampleData`.\nlet migrationCheck: (Realm) -> Void = { realm in\n    let persons = realm.objects(Person.self)\n    assert(persons.count == 3)\n    assert(persons[0].fullName == \"John Doe\")\n    assert(persons[0].age == 42)\n    assert(persons[0].dogs.count == 2)\n    assert(persons[0].dogs[0].name == \"Marley\")\n    assert(persons[0].dogs[1].name == \"Lassie\")\n    assert(persons[1].fullName == \"Jane Doe\")\n    assert(persons[1].age == 43)\n    assert(persons[1].dogs.count == 1)\n    assert(persons[1].dogs[0].name == \"Toto\")\n    assert(persons[2].fullName == \"John Smith\")\n    assert(persons[2].age == 44)\n    let dogs = realm.objects(Dog.self)\n    assert(dogs.count == 4)\n    assert(dogs.contains { $0.name == \"Slinkey\" })\n}\n\n// MARK: - Example data\n\n// Example data for this schema version.\nlet exampleData: (Realm) -> Void = { realm in\n    let person1 = Person(fullName: \"John Doe\", age: 42)\n    let person2 = Person(fullName: \"Jane Doe\", age: 43)\n    let person3 = Person(fullName: \"John Smith\", age: 44)\n    let pet1 = Dog(name: \"Marley\")\n    let pet2 = Dog(name: \"Lassie\")\n    let pet3 = Dog(name: \"Toto\")\n    let pet4 = Dog(name: \"Slinkey\")\n    realm.add([person1, person2, person3])\n    // pet1, pet2 and pet3 get added automatically by adding them to a list.\n    // pet4 has to be added manually though since it's not attached to a person yet.\n    realm.add(pet4)\n    person1.dogs.append(pet1)\n    person1.dogs.append(pet2)\n    person2.dogs.append(pet3)\n}\n\n#endif\n"
  },
  {
    "path": "examples/ios/swift/Migration/Examples/Example_v3.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#if SCHEMA_VERSION_3\n\nimport Foundation\nimport RealmSwift\n\n// MARK: - Schema\n\nlet schemaVersion = 3\n\n// Changes from previous version:\n// rename the `Dog` object to `Pet`\n// add a `kind` property to `Pet`\n// change the `dogs` property on `Person`:\n// - rename to `pets`\n// - change type to `List<Pet>`\n\n// Renaming tables is not supported yet: https://github.com/realm/realm-swift/issues/2491\n// The recommended way is to create a new type instead and migrate the old type.\n// Here we create `Pet` and migrate its data from `Dog` so simulate renaming the table.\n\nclass Pet: Object {\n    enum Kind: Int, PersistableEnum {\n        case unspecified\n        case dog\n        case chicken\n        case cow\n    }\n\n    @Persisted var name = \"\"\n    @Persisted var kind = Kind.unspecified\n\n    convenience init(name: String, kind: Kind) {\n        self.init()\n        self.name = name\n        self.kind = kind\n    }\n}\n\nclass Person: Object {\n    @Persisted var fullName = \"\"\n    @Persisted var age = 0\n    @Persisted var pets: List<Pet>\n    convenience init(fullName: String, age: Int) {\n        self.init()\n        self.fullName = fullName\n        self.age = age\n    }\n}\n\n// MARK: - Migration\n\n// Migration block to migrate from *any* previous version to this version.\nlet migrationBlock: MigrationBlock = { migration, oldSchemaVersion in\n    if oldSchemaVersion < 1 {\n        migration.enumerateObjects(ofType: Person.className()) { oldObject, newObject in\n            // combine name fields into a single field\n            let firstName = oldObject![\"firstName\"] as! String\n            let lastName = oldObject![\"lastName\"] as! String\n            newObject![\"fullName\"] = \"\\(firstName) \\(lastName)\"\n        }\n    }\n    if oldSchemaVersion < 2 {\n        migration.enumerateObjects(ofType: Person.className()) { _, newObject in\n            // Add a pet to a specific person\n            if newObject![\"fullName\"] as! String == \"John Doe\" {\n                // `Dog` was changed to `Pet` in v2 already, but we still need to account for this\n                // if upgrading from pre v2 to v3.\n                let dogs = newObject![\"pets\"] as! List<MigrationObject>\n                let marley = migration.create(Pet.className(), value: [\"Marley\", Pet.Kind.dog.rawValue])\n                let lassie = migration.create(Pet.className(), value: [\"Lassie\", Pet.Kind.dog.rawValue])\n                dogs.append(marley)\n                dogs.append(lassie)\n            } else if newObject![\"fullName\"] as! String == \"Jane Doe\" {\n                let dogs = newObject![\"pets\"] as! List<MigrationObject>\n                let toto = migration.create(Pet.className(), value: [\"Toto\", Pet.Kind.dog.rawValue])\n                dogs.append(toto)\n            }\n        }\n        let slinkey = migration.create(Pet.className(), value: [\"Slinkey\", Pet.Kind.dog.rawValue])\n    }\n    if oldSchemaVersion == 2 {\n        // This branch is only relevant for version 2. If we are migration from a previous\n        // version, we would not be able to access `dogs` since they did not exist back there.\n        // Migration from v0 and v1 to v3 is done in the previous blocks.\n        // Related issue: https://github.com/realm/realm-swift/issues/6263\n        migration.enumerateObjects(ofType: Person.className()) { oldObject, newObject in\n            let pets = newObject![\"pets\"] as! List<MigrationObject>\n            for dog in oldObject![\"dogs\"] as! List<DynamicObject> {\n                let pet = migration.create(Pet.className(), value: [dog[\"name\"], Pet.Kind.dog.rawValue])\n                pets.append(pet)\n            }\n        }\n        // We migrate over the old dog list to make sure all dogs get added, even those without\n        // an owner.\n        // Related issue: https://github.com/realm/realm-swift/issues/6734\n        migration.enumerateObjects(ofType: \"Dog\") { oldDogObject, _ in\n            var dogFound = false\n            migration.enumerateObjects(ofType: Person.className()) { _, newObject in\n                for pet in newObject![\"pets\"] as! List<DynamicObject> where pet[\"name\"] as! String == oldDogObject![\"name\"] as! String {\n                    dogFound = true\n                    break\n                }\n            }\n            if !dogFound {\n                migration.create(Pet.className(), value: [oldDogObject![\"name\"], Pet.Kind.dog.rawValue])\n            }\n        }\n        // The data cannot be deleted just yet since the table is target of cross-table link columns.\n        // See https://github.com/realm/realm-swift/issues/3686\n        // migration.deleteData(forType: Pet.Kind.dog)\n    }\n}\n\n// This block checks if the migration led to the expected result.\n// All older versions should have been migrated to the below stated `exampleData`.\nlet migrationCheck: (Realm) -> Void = { realm in\n    let persons = realm.objects(Person.self)\n    assert(persons.count == 3)\n    assert(persons[0].fullName == \"John Doe\")\n    assert(persons[0].age == 42)\n    assert(persons[0].pets.count == 2)\n    assert(persons[0].pets[0].name == \"Marley\")\n    assert(persons[0].pets[0].kind.rawValue == Pet.Kind.dog.rawValue)\n    assert(persons[0].pets[1].name == \"Lassie\")\n    assert(persons[0].pets[1].kind.rawValue == Pet.Kind.dog.rawValue)\n    assert(persons[1].fullName == \"Jane Doe\")\n    assert(persons[1].age == 43)\n    assert(persons[1].pets.count == 1)\n    assert(persons[1].pets[0].name == \"Toto\")\n    assert(persons[1].pets[0].kind.rawValue == Pet.Kind.dog.rawValue)\n    assert(persons[2].fullName == \"John Smith\")\n    assert(persons[2].age == 44)\n    let pets = realm.objects(Pet.self)\n    assert(pets.count == 4)\n    assert(pets.contains { $0.name == \"Slinkey\" && $0.kind.rawValue == Pet.Kind.dog.rawValue })\n}\n\n// MARK: - Example data\n\n// Example data for this schema version.\nlet exampleData: (Realm) -> Void = { realm in\n    let person1 = Person(fullName: \"John Doe\", age: 42)\n    let person2 = Person(fullName: \"Jane Doe\", age: 43)\n    let person3 = Person(fullName: \"John Smith\", age: 44)\n    let pet1 = Pet(name: \"Marley\", kind: .dog)\n    let pet2 = Pet(name: \"Lassie\", kind: .dog)\n    let pet3 = Pet(name: \"Toto\", kind: .dog)\n    let pet4 = Pet(name: \"Slinkey\", kind: .dog)\n    realm.add([person1, person2, person3])\n    person1.pets.append(pet1)\n    person1.pets.append(pet2)\n    person2.pets.append(pet3)\n    // pet1, pet2 and pet3 get added automatically by adding them to a list.\n    // pet4 has to be added manually though since it's not attached to a person yet.\n    realm.add(pet4)\n}\n\n#endif\n"
  },
  {
    "path": "examples/ios/swift/Migration/Examples/Example_v4.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#if SCHEMA_VERSION_4\n\nimport Foundation\nimport RealmSwift\n\n// MARK: - Schema\n\nlet schemaVersion = 4\n\n// Changes from previous version:\n// Add an `Address` to the `Person`.\n\nclass Pet: Object {\n    enum Kind: Int, PersistableEnum {\n        case unspecified\n        case dog\n        case chicken\n        case cow\n    }\n\n    @Persisted var name = \"\"\n    @Persisted var kind = Kind.unspecified\n\n    convenience init(name: String, kind: Kind) {\n        self.init()\n        self.name = name\n        self.kind = kind\n    }\n}\n\nclass Person: Object {\n    @Persisted var fullName = \"\"\n    @Persisted var age = 0\n    @Persisted var address: Address?\n    @Persisted var pets: List<Pet>\n    convenience init(fullName: String, age: Int, address: Address?) {\n        self.init()\n        self.fullName = fullName\n        self.age = age\n        self.address = address\n    }\n}\n\nclass Address: Object {\n    @Persisted var street = \"\"\n    @Persisted var city = \"\"\n    @Persisted(originProperty: \"adddress\")\n    var residents: LinkingObjects<Person>\n    convenience init(street: String, city: String) {\n        self.init()\n        self.street = street\n        self.city = city\n    }\n}\n\n// MARK: - Migration\n\n// Migration block to migrate from *any* previous version to this version.\nlet migrationBlock: MigrationBlock = { migration, oldSchemaVersion in\n    if oldSchemaVersion < 1 {\n        migration.enumerateObjects(ofType: Person.className()) { oldObject, newObject in\n            // combine name fields into a single field\n            let firstName = oldObject![\"firstName\"] as! String\n            let lastName = oldObject![\"lastName\"] as! String\n            newObject![\"fullName\"] = \"\\(firstName) \\(lastName)\"\n        }\n    }\n    if oldSchemaVersion < 2 {\n        migration.enumerateObjects(ofType: Person.className()) { _, newObject in\n            // Add a pet to a specific person\n            if newObject![\"fullName\"] as! String == \"John Doe\" {\n                // `Dog` was changed to `Pet` in v2 already, but we still need to account for this\n                // if upgrading from pre v2 to v3.\n                let dogs = newObject![\"pets\"] as! List<MigrationObject>\n                let marley = migration.create(Pet.className(), value: [\"Marley\", Pet.Kind.dog.rawValue])\n                let lassie = migration.create(Pet.className(), value: [\"Lassie\", Pet.Kind.dog.rawValue])\n                dogs.append(marley)\n                dogs.append(lassie)\n            } else if newObject![\"fullName\"] as! String == \"Jane Doe\" {\n                let dogs = newObject![\"pets\"] as! List<MigrationObject>\n                let toto = migration.create(Pet.className(), value: [\"Toto\", Pet.Kind.dog.rawValue])\n                dogs.append(toto)\n            }\n        }\n        let slinkey = migration.create(Pet.className(), value: [\"Slinkey\", Pet.Kind.dog.rawValue])\n    }\n    if oldSchemaVersion == 2 {\n        // This branch is only relevant for version 2. If we are migration from a previous\n        // version, we would not be able to access `dogs` since they did not exist back there.\n        // Migration from v0 and v1 to v3 is done in the previous blocks.\n        // Related issue: https://github.com/realm/realm-swift/issues/6263\n        migration.enumerateObjects(ofType: Person.className()) { oldObject, newObject in\n            let pets = newObject![\"pets\"] as! List<MigrationObject>\n            for dog in oldObject![\"dogs\"] as! List<DynamicObject> {\n                let pet = migration.create(Pet.className(), value: [dog[\"name\"], Pet.Kind.dog.rawValue])\n                pets.append(pet)\n            }\n        }\n        // We migrate over the old dog list to make sure all dogs get added, even those without\n        // an owner.\n        // Related issue: https://github.com/realm/realm-swift/issues/6734\n        migration.enumerateObjects(ofType: \"Dog\") { oldDogObject, _ in\n            var dogFound = false\n            migration.enumerateObjects(ofType: Person.className()) { _, newObject in\n                for pet in newObject![\"pets\"] as! List<DynamicObject> where pet[\"name\"] as! String == oldDogObject![\"name\"] as! String {\n                    dogFound = true\n                    break\n                }\n            }\n            if !dogFound {\n                migration.create(Pet.className(), value: [oldDogObject![\"name\"], Pet.Kind.dog.rawValue])\n            }\n        }\n        // The data cannot be deleted just yet since the table is target of cross-table link columns.\n        // See https://github.com/realm/realm-swift/issues/3686\n        // migration.deleteData(forType: Pet.Kind.dog)\n    }\n    if oldSchemaVersion < 4 {\n        migration.enumerateObjects(ofType: Person.className()) { _, newObject in\n            if newObject![\"fullName\"] as! String == \"John Doe\" {\n                let address = migration.create(Address.className(), value: [\"Broadway\", \"New York\"])\n                newObject![\"address\"] = address\n            }\n        }\n    }\n}\n\n// This block checks if the migration led to the expected result.\n// All older versions should have been migrated to the below stated `exampleData`.\nlet migrationCheck: (Realm) -> Void = { realm in\n    let persons = realm.objects(Person.self)\n    assert(persons.count == 3)\n    assert(persons[0].fullName == \"John Doe\")\n    assert(persons[0].age == 42)\n    assert(persons[0].address != nil)\n    assert(persons[0].address?.city == \"New York\")\n    assert(persons[0].address?.street == \"Broadway\")\n    assert(persons[0].pets.count == 2)\n    assert(persons[0].pets[0].name == \"Marley\")\n    assert(persons[0].pets[0].kind.rawValue == Pet.Kind.dog.rawValue)\n    assert(persons[0].pets[1].name == \"Lassie\")\n    assert(persons[0].pets[1].kind.rawValue == Pet.Kind.dog.rawValue)\n    assert(persons[1].fullName == \"Jane Doe\")\n    assert(persons[1].age == 43)\n    assert(persons[1].address == nil)\n    assert(persons[1].pets.count == 1)\n    assert(persons[1].pets[0].name == \"Toto\")\n    assert(persons[1].pets[0].kind.rawValue == Pet.Kind.dog.rawValue)\n    assert(persons[2].fullName == \"John Smith\")\n    assert(persons[2].age == 44)\n    assert(persons[2].address == nil)\n    let pets = realm.objects(Pet.self)\n    assert(pets.count == 4)\n    assert(pets.contains { $0.name == \"Slinkey\" && $0.kind.rawValue == Pet.Kind.dog.rawValue })\n}\n\n// MARK: - Example data\n\n// Example data for this schema version.\nlet exampleData: (Realm) -> Void = { realm in\n    let address = Address(street: \"Broadway\", city: \"New York\")\n    let person1 = Person(fullName: \"John Doe\", age: 42, address: address)\n    let person2 = Person(fullName: \"Jane Doe\", age: 43, address: nil)\n    let person3 = Person(fullName: \"John Smith\", age: 44, address: nil)\n    let pet1 = Pet(name: \"Marley\", kind: .dog)\n    let pet2 = Pet(name: \"Lassie\", kind: .dog)\n    let pet3 = Pet(name: \"Toto\", kind: .dog)\n    let pet4 = Pet(name: \"Slinkey\", kind: .dog)\n    realm.add([person1, person2, person3])\n    person1.pets.append(pet1)\n    person1.pets.append(pet2)\n    person2.pets.append(pet3)\n    // pet1, pet2 and pet3 get added automatically by adding them to a list.\n    // pet4 has to be added manually though since it's not attached to a person yet.\n    realm.add(pet4)\n}\n\n#endif\n"
  },
  {
    "path": "examples/ios/swift/Migration/Examples/Example_v5.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2021 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#if !SCHEMA_VERSION_0 && !SCHEMA_VERSION_1 && !SCHEMA_VERSION_2 && !SCHEMA_VERSION_3 && !SCHEMA_VERSION_4\n\nimport Foundation\nimport RealmSwift\n\n// MARK: - Schema\n\nlet schemaVersion = 5\n\n// Changes from previous version:\n// - Change the `Address` from `Object` to `EmbeddedObject`.\n//\n// Be aware that this only works if there is only one `LinkingObject` per `Address`.\n// See https://github.com/realm/realm-swift/issues/7060\n\n// Renaming tables is not supported yet: https://github.com/realm/realm-swift/issues/2491\n// The recommended way is to create a new type instead and migrate the old type.\n// Here we create `Pet` and migrate its data from `Dog` so simulate renaming the table.\n\nclass Pet: Object {\n    enum Kind: Int, PersistableEnum {\n        case unspecified\n        case dog\n        case chicken\n        case cow\n    }\n\n    @Persisted var name = \"\"\n    @Persisted var kind = Kind.unspecified\n\n    convenience init(name: String, kind: Kind) {\n        self.init()\n        self.name = name\n        self.kind = kind\n    }\n}\n\nclass Person: Object {\n    @Persisted var fullName = \"\"\n    @Persisted var age = 0\n    @Persisted var address: Address?\n    @Persisted var pets: List<Pet>\n    convenience init(fullName: String, age: Int, address: Address?) {\n        self.init()\n        self.fullName = fullName\n        self.age = age\n        self.address = address\n    }\n}\n\nclass Address: EmbeddedObject {\n    @Persisted var street = \"\"\n    @Persisted var city = \"\"\n    @Persisted(originProperty: \"address\")\n    var residents: LinkingObjects<Person>\n    convenience init(street: String, city: String) {\n        self.init()\n        self.street = street\n        self.city = city\n    }\n}\n\n// MARK: - Migration\n\n// Migration block to migrate from *any* previous version to this version.\nlet migrationBlock: MigrationBlock = { migration, oldSchemaVersion in\n    if oldSchemaVersion < 1 {\n        migration.enumerateObjects(ofType: Person.className()) { oldObject, newObject in\n            // combine name fields into a single field\n            let firstName = oldObject![\"firstName\"] as! String\n            let lastName = oldObject![\"lastName\"] as! String\n            newObject![\"fullName\"] = \"\\(firstName) \\(lastName)\"\n        }\n    }\n    if oldSchemaVersion < 2 {\n        migration.enumerateObjects(ofType: Person.className()) { _, newObject in\n            // Add a pet to a specific person\n            if newObject![\"fullName\"] as! String == \"John Doe\" {\n                // `Dog` was changed to `Pet` in v2 already, but we still need to account for this\n                // if upgrading from pre v2 to v3.\n                let dogs = newObject![\"pets\"] as! List<MigrationObject>\n                let marley = migration.create(Pet.className(), value: [\"Marley\", Pet.Kind.dog.rawValue])\n                let lassie = migration.create(Pet.className(), value: [\"Lassie\", Pet.Kind.dog.rawValue])\n                dogs.append(marley)\n                dogs.append(lassie)\n            } else if newObject![\"fullName\"] as! String == \"Jane Doe\" {\n                let dogs = newObject![\"pets\"] as! List<MigrationObject>\n                let toto = migration.create(Pet.className(), value: [\"Toto\", Pet.Kind.dog.rawValue])\n                dogs.append(toto)\n            }\n        }\n        let slinkey = migration.create(Pet.className(), value: [\"Slinkey\", Pet.Kind.dog.rawValue])\n    }\n    if oldSchemaVersion == 2 {\n        // This branch is only relevant for version 2. If we are migration from a previous\n        // version, we would not be able to access `dogs` since they did not exist back there.\n        // Migration from v0 and v1 to v3 is done in the previous blocks.\n        // Related issue: https://github.com/realm/realm-swift/issues/6263\n        migration.enumerateObjects(ofType: Person.className()) { oldObject, newObject in\n            let pets = newObject![\"pets\"] as! List<MigrationObject>\n            for dog in oldObject![\"dogs\"] as! List<DynamicObject> {\n                let pet = migration.create(Pet.className(), value: [dog[\"name\"], Pet.Kind.dog.rawValue])\n                pets.append(pet)\n            }\n        }\n        // We enumerate the old dog list to make sure all dogs get added, even those without an owner.\n        // Related issue: https://github.com/realm/realm-swift/issues/6734\n        migration.enumerateObjects(ofType: \"Dog\") { oldDogObject, _ in\n            var dogFound = false\n            migration.enumerateObjects(ofType: Person.className()) { _, newObject in\n                for pet in newObject![\"pets\"] as! List<DynamicObject> where pet[\"name\"] as! String == oldDogObject![\"name\"] as! String {\n                    dogFound = true\n                    break\n                }\n            }\n            if !dogFound {\n                migration.create(Pet.className(), value: [oldDogObject![\"name\"], Pet.Kind.dog.rawValue])\n            }\n        }\n        // The data cannot be deleted just yet since the table is target of cross-table link columns.\n        // See https://github.com/realm/realm-swift/issues/3686\n        // migration.deleteData(forType: \"Dog\")\n    }\n    if oldSchemaVersion < 4 {\n        migration.enumerateObjects(ofType: Person.className()) { _, newObject in\n            if newObject![\"fullName\"] as! String == \"John Doe\" {\n                let address = Address(value: [\"Broadway\", \"New York\"])\n                newObject![\"address\"] = address\n            }\n        }\n    }\n}\n\n// This block checks if the migration led to the expected result.\n// All older versions should have been migrated to the below stated `exampleData`.\nlet migrationCheck: (Realm) -> Void = { realm in\n    let persons = realm.objects(Person.self)\n    assert(persons.count == 3)\n    assert(persons[0].fullName == \"John Doe\")\n    assert(persons[0].age == 42)\n    assert(persons[0].address != nil)\n    assert(persons[0].address?.city == \"New York\")\n    assert(persons[0].address?.street == \"Broadway\")\n    assert(persons[0].pets.count == 2)\n    assert(persons[0].pets[0].name == \"Marley\")\n    assert(persons[0].pets[0].kind.rawValue == Pet.Kind.dog.rawValue)\n    assert(persons[0].pets[1].name == \"Lassie\")\n    assert(persons[0].pets[1].kind.rawValue == Pet.Kind.dog.rawValue)\n    assert(persons[1].fullName == \"Jane Doe\")\n    assert(persons[1].age == 43)\n    assert(persons[1].address == nil)\n    assert(persons[1].pets.count == 1)\n    assert(persons[1].pets[0].name == \"Toto\")\n    assert(persons[1].pets[0].kind.rawValue == Pet.Kind.dog.rawValue)\n    assert(persons[2].fullName == \"John Smith\")\n    assert(persons[2].age == 44)\n    assert(persons[2].address == nil)\n    let pets = realm.objects(Pet.self)\n    assert(pets.count == 4)\n    assert(pets.contains { $0.name == \"Slinkey\" && $0.kind.rawValue == Pet.Kind.dog.rawValue })\n}\n\n// MARK: - Example data\n\n// Example data for this schema version.\nlet exampleData: (Realm) -> Void = { realm in\n    let address = Address(street: \"Broadway\", city: \"New York\")\n    let person1 = Person(fullName: \"John Doe\", age: 42, address: address)\n    let person2 = Person(fullName: \"Jane Doe\", age: 43, address: nil)\n    let person3 = Person(fullName: \"John Smith\", age: 44, address: nil)\n    let pet1 = Pet(name: \"Marley\", kind: .dog)\n    let pet2 = Pet(name: \"Lassie\", kind: .dog)\n    let pet3 = Pet(name: \"Toto\", kind: .dog)\n    let pet4 = Pet(name: \"Slinkey\", kind: .dog)\n    realm.add([person1, person2, person3])\n    person1.pets.append(pet1)\n    person1.pets.append(pet2)\n    person2.pets.append(pet3)\n    // pet1, pet2 and pet3 get added automatically by adding them to a list.\n    // pet4 has to be added manually though since it's not attached to a person yet.\n    realm.add(pet4)\n}\n\n#endif\n"
  },
  {
    "path": "examples/ios/swift/Migration/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UIRequiresFullScreen</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/swift/Migration/Migration.xcconfig",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n// This file is used to create new examples.\n// To create a new example for a specific version you have to uncomment the\n// following line and the corresponding line with the schema version you\n// want to create (v5 being the default).\n//OTHER_SWIFT_FLAGS = $(inherited) -DCREATE_EXAMPLES;\n\n// If you want to test older versions, uncommene the corresponding version.\n//OTHER_SWIFT_FLAGS = $(inherited) -DSCHEMA_VERSION_0;\n//OTHER_SWIFT_FLAGS = $(inherited) -DSCHEMA_VERSION_1;\n//OTHER_SWIFT_FLAGS = $(inherited) -DSCHEMA_VERSION_2;\n//OTHER_SWIFT_FLAGS = $(inherited) -DSCHEMA_VERSION_3;\n//OTHER_SWIFT_FLAGS = $(inherited) -DSCHEMA_VERSION_4;\n"
  },
  {
    "path": "examples/ios/swift/Migration/README.md",
    "content": "# Migration Examples\n\nThe Migration project shows several examples of migrations and migration blocks.\n\nThe purpose of this example is to provide a more in depth view of certain problems and pitfalls users might face when \nmigrations get more complex and the number of versions increases.\n\n## How to use the example\n\nYou can build and run the project as is. Migrations from all prior version to the current version will be checked:\n   - v0 -> v5\n   - v1 -> v5\n   - v2 -> v5\n   - v3 -> v5\n   - v4 -> v5\n\nThe files to look at are located in the `Examples` folder. Every file contains an extract of everything necessary for\nthis version (schema version, objects, migration and migration checks).\n\nIf you want to compare older versions among each other (i.e. v2 -> v3) you can do so by enabling the schema version, for example:\n   - Deactivate version 5 by setting `#define SCHEMA_VERSION_5 1` to `#define SCHEMA_VERSION_5 0` in `Example_v5.h`.\n   - Activate version 3 by seting `#define SCHEMA_VERSION_3 0` to `#define SCHEMA_VERSION_3 1` in `Example_v3.h`.\n"
  },
  {
    "path": "examples/ios/swift/PlaygroundFrameworkWrapper/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>FMWK</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>$(CURRENT_PROJECT_VERSION)</string>\n\t<key>NSPrincipalClass</key>\n\t<string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/swift/PlaygroundFrameworkWrapper/PlaygroundFrameworkWrapper.swift",
    "content": "// The PlaygroundFrameworkWrapper framework enables\n// a binary release of RealmSwift.framework to be used\n// in Xcode Playgrounds.\n"
  },
  {
    "path": "examples/ios/swift/Projections/Assets.xcassets/AccentColor.colorset/Contents.json",
    "content": "{\n  \"colors\" : [\n    {\n      \"idiom\" : \"universal\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "examples/ios/swift/Projections/Assets.xcassets/AppIcon.appiconset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"60x60\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"60x60\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"76x76\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"76x76\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"83.5x83.5\"\n    },\n    {\n      \"idiom\" : \"ios-marketing\",\n      \"scale\" : \"1x\",\n      \"size\" : \"1024x1024\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "examples/ios/swift/Projections/Assets.xcassets/Contents.json",
    "content": "{\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "examples/ios/swift/Projections/ContentView.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n //\n // Copyright 2021 Realm Inc.\n //\n // Licensed under the Apache License, Version 2.0 (the \"License\");\n // you may not use this file except in compliance with the License.\n // You may obtain a copy of the License at\n //\n // http://www.apache.org/licenses/LICENSE-2.0\n //\n // Unless required by applicable law or agreed to in writing, software\n // distributed under the License is distributed on an \"AS IS\" BASIS,\n // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n // See the License for the specific language governing permissions and\n // limitations under the License.\n //\n ////////////////////////////////////////////////////////////////////////////\n\nimport SwiftUI\nimport RealmSwift\n\nclass Series: Object {\n    @Persisted var title: String\n    @Persisted var episodes: RealmSwift.List<Movie>\n}\n\nclass Movie: Object {\n    @Persisted var title: String\n    @Persisted var episodeNumber: Int\n    @Persisted var length: Int\n    @Persisted(originProperty: \"episodes\")\n    var series: LinkingObjects<Series>\n}\n\nclass SeriesModel: Projection<Series> {\n    @Projected(\\Series.title) var title\n    @Projected(\\Series.episodes.count) var epCount\n    @Projected(\\Series.episodes.first?.title.quoted) var firstEpisode\n    @Projected(\\Series.episodes) var episodes\n}\n\nextension String {\n    var quoted: String {\n        \"\\\"\\(self)\\\"\"\n    }\n}\n\nstruct SeriesCellView: View {\n    @ObservedRealmObject var series: SeriesModel\n\n    var body: some View {\n        VStack {\n            HStack {\n                Text(series.title)\n                Text(\"\\(series.epCount) \\(series.epCount == 1 ? \"episode\" : \"episodes\")\")\n                    .font(.footnote)\n            }\n            if let firstTitle = series.firstEpisode, !firstTitle.isEmpty {\n                Text(\"start watch from \" + firstTitle)\n                    .font(.footnote)\n            }\n        }\n    }\n}\n\nstruct EpisodeCellView: View {\n    @ObservedRealmObject var episode: Movie\n\n    var body: some View {\n        Text(episode.title)\n            .padding()\n    }\n}\n\nstruct SeriesView: View {\n    @ObservedRealmObject var series: SeriesModel\n    var body: some View {\n        VStack {\n            Text(\"Episodes\")\n            List($series.episodes) { episode in\n                EpisodeCellView(episode: episode.wrappedValue)\n            }\n        }\n    }\n}\n\nstruct ContentView: View {\n    @Environment(\\.realm) var realm\n    @ObservedResults(SeriesModel.self) var series\n\n    var body: some View {\n        NavigationView {\n            List {\n                ForEach(series) { series in\n                    NavigationLink(destination: SeriesView(series: series)) {\n                      SeriesCellView(series: series)\n                    }\n                }\n            }\n        }\n        .navigationTitle(\"Movies\")\n        .onAppear(perform: fillData)\n    }\n\n    // Add records to display in the view\n    func fillData() {\n        if realm.objects(Movie.self).count == 0 {\n            let sw = Series(value: [\"Space Shooter\",\n                                    [[\"Revived Beliefs\", 4],\n                                     [\"The Tyrany Evens the Score\", 5],\n                                     [\"Comeback of Magician\", 6],\n                                     [\"The Mirage Hazard\", 1],\n                                     [\"Offence of Siblings\", 2],\n                                     [\"Vendetta of Bad Guys\", 3]]])\n            try! realm.write {\n                realm.add(sw)\n            }\n        }\n    }\n}\n\nstruct ContentView_Previews: PreviewProvider {\n    static var previews: some View {\n        ContentView()\n    }\n}\n"
  },
  {
    "path": "examples/ios/swift/Projections/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>UIApplicationSceneManifest</key>\n\t<dict>\n\t\t<key>UIApplicationSupportsMultipleScenes</key>\n\t\t<false/>\n\t</dict>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/swift/Projections/Preview Content/Preview Assets.xcassets/Contents.json",
    "content": "{\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "examples/ios/swift/Projections/ProjectionsApp.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n //\n // Copyright 2021 Realm Inc.\n //\n // Licensed under the Apache License, Version 2.0 (the \"License\");\n // you may not use this file except in compliance with the License.\n // You may obtain a copy of the License at\n //\n // http://www.apache.org/licenses/LICENSE-2.0\n //\n // Unless required by applicable law or agreed to in writing, software\n // distributed under the License is distributed on an \"AS IS\" BASIS,\n // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n // See the License for the specific language governing permissions and\n // limitations under the License.\n //\n ////////////////////////////////////////////////////////////////////////////\n\nimport SwiftUI\n\n@main\nstruct ProjectionsApp: App {\n    var body: some Scene {\n        WindowGroup {\n            ContentView()\n        }\n    }\n}\n"
  },
  {
    "path": "examples/ios/swift/RealmExamples.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t0CF50F83272FF6330048A358 /* ProjectionsApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CF50F82272FF6330048A358 /* ProjectionsApp.swift */; };\n\t\t0CF50F85272FF6330048A358 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CF50F84272FF6330048A358 /* ContentView.swift */; };\n\t\t0CF50F87272FF6340048A358 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0CF50F86272FF6340048A358 /* Assets.xcassets */; };\n\t\t0CF50F8A272FF6340048A358 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0CF50F89272FF6340048A358 /* Preview Assets.xcassets */; };\n\t\t227D20F21CB609A1008F641B /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 227D20F11CB609A1008F641B /* LaunchScreen.xib */; };\n\t\t227D20F31CB609A1008F641B /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 227D20F11CB609A1008F641B /* LaunchScreen.xib */; };\n\t\t227D20F41CB609A1008F641B /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 227D20F11CB609A1008F641B /* LaunchScreen.xib */; };\n\t\t227D20F51CB609A1008F641B /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 227D20F11CB609A1008F641B /* LaunchScreen.xib */; };\n\t\t227D20F61CB609A1008F641B /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 227D20F11CB609A1008F641B /* LaunchScreen.xib */; };\n\t\t227D20F71CB609A1008F641B /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 227D20F11CB609A1008F641B /* LaunchScreen.xib */; };\n\t\t3F7B506A2D120F3D004B792D /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; };\n\t\t3F7B506B2D120F3D004B792D /* Realm.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t3F7B506C2D120F3D004B792D /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; };\n\t\t3F7B506D2D120F3D004B792D /* RealmSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t3F7B506F2D120FFB004B792D /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; };\n\t\t3F7B50702D120FFB004B792D /* Realm.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t3F7B50712D120FFB004B792D /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; };\n\t\t3F7B50722D120FFB004B792D /* RealmSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t3F7B50742D121000004B792D /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; };\n\t\t3F7B50752D121000004B792D /* Realm.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t3F7B50762D121000004B792D /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; };\n\t\t3F7B50772D121000004B792D /* RealmSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t3F7B507D2D121019004B792D /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; };\n\t\t3F7B507E2D121019004B792D /* Realm.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t3F7B507F2D121019004B792D /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; };\n\t\t3F7B50802D121019004B792D /* RealmSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t3F7B50812D121063004B792D /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; };\n\t\t3F7B50822D121063004B792D /* Realm.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t3F7B50832D121063004B792D /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; };\n\t\t3F7B50842D121063004B792D /* RealmSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t3FA2F2FF268FCA380015062E /* DemoObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FA2F2FD268FCA380015062E /* DemoObject.swift */; };\n\t\t3FA2F300268FCA380015062E /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FA2F2FE268FCA380015062E /* Constants.swift */; };\n\t\t3FA2F301268FCA960015062E /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FA2F2FE268FCA380015062E /* Constants.swift */; };\n\t\t3FA2F302268FCA960015062E /* DemoObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FA2F2FD268FCA380015062E /* DemoObject.swift */; };\n\t\t3FA2F303268FCAAD0015062E /* AppClipApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53454CB924EAC3F900678E48 /* AppClipApp.swift */; };\n\t\t3FA2F304268FCAC80015062E /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53454CCE24EAC43500678E48 /* ContentView.swift */; };\n\t\t3FC898FF1A1414110067CBEC /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FC898FE1A1414110067CBEC /* ViewController.swift */; };\n\t\t493759AB230D8CA60078C28E /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 493759AA230D8CA60078C28E /* ContentView.swift */; };\n\t\t493759AD230D8CAA0078C28E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 493759AC230D8CAA0078C28E /* Assets.xcassets */; };\n\t\t493759B0230D8CAA0078C28E /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 493759AF230D8CAA0078C28E /* Preview Assets.xcassets */; };\n\t\t53379DB625CB0E020008A269 /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53379DB525CB0E020008A269 /* App.swift */; };\n\t\t53454CCD24EAC43500678E48 /* AppClipParentApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53454CCC24EAC43500678E48 /* AppClipParentApp.swift */; };\n\t\t53454CCF24EAC43500678E48 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53454CCE24EAC43500678E48 /* ContentView.swift */; };\n\t\t53454CD124EAC43700678E48 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 53454CD024EAC43700678E48 /* Assets.xcassets */; };\n\t\t53454CD424EAC43700678E48 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 53454CD324EAC43700678E48 /* Preview Assets.xcassets */; };\n\t\t53454CEC24EAC45700678E48 /* AppClip.app in Embed App Clips */ = {isa = PBXBuildFile; fileRef = 53454CDD24EAC45500678E48 /* AppClip.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };\n\t\t7D46395025C2E2750089EFD9 /* Example_v3.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D46394F25C2E2750089EFD9 /* Example_v3.swift */; };\n\t\t7D46395425C2E7140089EFD9 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 7D46395325C2E7140089EFD9 /* README.md */; };\n\t\t7D46399825C45FF00089EFD9 /* Example_v4.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D46399725C45FF00089EFD9 /* Example_v4.swift */; };\n\t\t7D4639A025C46C660089EFD9 /* Example_v5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D46399F25C46C660089EFD9 /* Example_v5.swift */; };\n\t\t7DADCBA525C816B600048287 /* default-v0.realm in Resources */ = {isa = PBXBuildFile; fileRef = 7DADCB9F25C816B500048287 /* default-v0.realm */; };\n\t\t7DADCBA625C816B600048287 /* default-v1.realm in Resources */ = {isa = PBXBuildFile; fileRef = 7DADCBA025C816B500048287 /* default-v1.realm */; };\n\t\t7DADCBA725C816B600048287 /* default-v3.realm in Resources */ = {isa = PBXBuildFile; fileRef = 7DADCBA125C816B500048287 /* default-v3.realm */; };\n\t\t7DADCBA825C816B600048287 /* default-v4.realm in Resources */ = {isa = PBXBuildFile; fileRef = 7DADCBA225C816B500048287 /* default-v4.realm */; };\n\t\t7DADCBA925C816B600048287 /* default-v5.realm in Resources */ = {isa = PBXBuildFile; fileRef = 7DADCBA325C816B500048287 /* default-v5.realm */; };\n\t\t7DADCBAA25C816B600048287 /* default-v2.realm in Resources */ = {isa = PBXBuildFile; fileRef = 7DADCBA425C816B600048287 /* default-v2.realm */; };\n\t\t7DADCBB225C8284500048287 /* Migration.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 7DADCBB125C8284500048287 /* Migration.xcconfig */; };\n\t\t7DFFB15E25C19F0700CA8AE5 /* Example_v0.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DFFB15D25C19F0700CA8AE5 /* Example_v0.swift */; };\n\t\t7DFFB16F25C1B65A00CA8AE5 /* Example_v1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DFFB16E25C1B65A00CA8AE5 /* Example_v1.swift */; };\n\t\t7DFFB17725C1B84E00CA8AE5 /* Example_v2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DFFB17625C1B84E00CA8AE5 /* Example_v2.swift */; };\n\t\tC07E5D7A1B15003B00ED625C /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; };\n\t\tC07E5D7B1B15003B00ED625C /* Realm.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\tC07E5D7C1B15004800ED625C /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; };\n\t\tC07E5D7D1B15004800ED625C /* Realm.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\tC07E5D7E1B15004C00ED625C /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; };\n\t\tC07E5D7F1B15004C00ED625C /* Realm.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\tC07E5D801B15004F00ED625C /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; };\n\t\tC07E5D811B15004F00ED625C /* Realm.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\tC07E5D821B15005300ED625C /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; };\n\t\tC07E5D831B15005300ED625C /* Realm.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\tC07E5D841B15005500ED625C /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; };\n\t\tC07E5D851B15005500ED625C /* Realm.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\tE886FB671A12A73E00CB2D0B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E886FB631A12A73E00CB2D0B /* AppDelegate.swift */; };\n\t\tE886FB681A12A73E00CB2D0B /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E886FB641A12A73E00CB2D0B /* Images.xcassets */; };\n\t\tE886FB6A1A12A73E00CB2D0B /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E886FB661A12A73E00CB2D0B /* TableViewController.swift */; };\n\t\tE8CA270B1CF9031300FF203A /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; };\n\t\tE8CA270C1CF9031300FF203A /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; };\n\t\tE8CA270D1CF9031600FF203A /* Realm.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = C07E5D791B15001500ED625C /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\tE8CA270E1CF9031600FF203A /* RealmSwift.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\tE8CB088219BA6AEE0018434A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8CB088019BA6AEE0018434A /* AppDelegate.swift */; };\n\t\tE8CB088A19BA6AF70018434A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8CB088519BA6AF70018434A /* AppDelegate.swift */; };\n\t\tE8CB089219BA6B000018434A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8CB089019BA6B000018434A /* AppDelegate.swift */; };\n\t\tE8CB089919BA6B080018434A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8CB089519BA6B080018434A /* AppDelegate.swift */; };\n\t\tE8CB089A19BA6B080018434A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E8CB089619BA6B080018434A /* Images.xcassets */; };\n\t\tE8CB089C19BA6B080018434A /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8CB089819BA6B080018434A /* TableViewController.swift */; };\n\t\tE8D212F11AF6A9E800DAB243 /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; };\n\t\tE8D212F21AF6A9E800DAB243 /* RealmSwift.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\tE8D212F31AF6A9EF00DAB243 /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; };\n\t\tE8D212F41AF6A9EF00DAB243 /* RealmSwift.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\tE8D212F51AF6A9FD00DAB243 /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; };\n\t\tE8D212F61AF6A9FD00DAB243 /* RealmSwift.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\tE8D212F71AF6AA0000DAB243 /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; };\n\t\tE8D212F81AF6AA0000DAB243 /* RealmSwift.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\tE8D212F91AF6AA0300DAB243 /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; };\n\t\tE8D212FA1AF6AA0300DAB243 /* RealmSwift.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\tE8D212FB1AF6AA0600DAB243 /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; };\n\t\tE8D212FC1AF6AA0600DAB243 /* RealmSwift.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = C09C490F1A605A4800638C9F /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\tE8D3F2781A11766A00620884 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8D3F2761A11766A00620884 /* AppDelegate.swift */; };\n\t\tE8F14D131CF8FD7F00564AF5 /* PlaygroundFrameworkWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8F14D121CF8FD7F00564AF5 /* PlaygroundFrameworkWrapper.swift */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t53454CEA24EAC45700678E48 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = E805758D19BA55E600376620 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 53454CDC24EAC45500678E48;\n\t\t\tremoteInfo = AppClip;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXCopyFilesBuildPhase section */\n\t\t3F7B506E2D120F3D004B792D /* Embed Frameworks */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\t3F7B506B2D120F3D004B792D /* Realm.framework in Embed Frameworks */,\n\t\t\t\t3F7B506D2D120F3D004B792D /* RealmSwift.framework in Embed Frameworks */,\n\t\t\t);\n\t\t\tname = \"Embed Frameworks\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t3F7B50732D120FFB004B792D /* Embed Frameworks */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\t3F7B50702D120FFB004B792D /* Realm.framework in Embed Frameworks */,\n\t\t\t\t3F7B50722D120FFB004B792D /* RealmSwift.framework in Embed Frameworks */,\n\t\t\t);\n\t\t\tname = \"Embed Frameworks\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t3F7B50782D121000004B792D /* Embed Frameworks */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\t3F7B50752D121000004B792D /* Realm.framework in Embed Frameworks */,\n\t\t\t\t3F7B50772D121000004B792D /* RealmSwift.framework in Embed Frameworks */,\n\t\t\t);\n\t\t\tname = \"Embed Frameworks\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t3F7B50852D121063004B792D /* Embed Frameworks */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\t3F7B50822D121063004B792D /* Realm.framework in Embed Frameworks */,\n\t\t\t\t3F7B50842D121063004B792D /* RealmSwift.framework in Embed Frameworks */,\n\t\t\t);\n\t\t\tname = \"Embed Frameworks\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t53454CF024EAC45700678E48 /* Embed App Clips */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"$(CONTENTS_FOLDER_PATH)/AppClips\";\n\t\t\tdstSubfolderSpec = 16;\n\t\t\tfiles = (\n\t\t\t\t53454CEC24EAC45700678E48 /* AppClip.app in Embed App Clips */,\n\t\t\t);\n\t\t\tname = \"Embed App Clips\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tC01304E31A60A4A000EB3E1E /* CopyFiles */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\tC07E5D7B1B15003B00ED625C /* Realm.framework in CopyFiles */,\n\t\t\t\tE8D212F21AF6A9E800DAB243 /* RealmSwift.framework in CopyFiles */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tC01304E51A60A6CE00EB3E1E /* CopyFiles */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\tC07E5D7F1B15004C00ED625C /* Realm.framework in CopyFiles */,\n\t\t\t\tE8D212F61AF6A9FD00DAB243 /* RealmSwift.framework in CopyFiles */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tC01304E71A60A6EC00EB3E1E /* CopyFiles */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\tC07E5D811B15004F00ED625C /* Realm.framework in CopyFiles */,\n\t\t\t\tE8D212F81AF6AA0000DAB243 /* RealmSwift.framework in CopyFiles */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tC01304E91A60B77600EB3E1E /* CopyFiles */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\tC07E5D7D1B15004800ED625C /* Realm.framework in CopyFiles */,\n\t\t\t\tE8D212F41AF6A9EF00DAB243 /* RealmSwift.framework in CopyFiles */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tC09C490D1A6059BA00638C9F /* CopyFiles */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\tC07E5D831B15005300ED625C /* Realm.framework in CopyFiles */,\n\t\t\t\tE8D212FA1AF6AA0300DAB243 /* RealmSwift.framework in CopyFiles */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tC09C491C1A6068E500638C9F /* CopyFiles */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\tC07E5D851B15005500ED625C /* Realm.framework in CopyFiles */,\n\t\t\t\tE8D212FC1AF6AA0600DAB243 /* RealmSwift.framework in CopyFiles */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8F14D141CF900E500564AF5 /* CopyFiles */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\tE8CA270D1CF9031600FF203A /* Realm.framework in CopyFiles */,\n\t\t\t\tE8CA270E1CF9031600FF203A /* RealmSwift.framework in CopyFiles */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXCopyFilesBuildPhase section */\n\n/* Begin PBXFileReference section */\n\t\t0A73D4411B1443A700E1E8EE /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../../README.md; sourceTree = SOURCE_ROOT; };\n\t\t0CF50F80272FF6330048A358 /* Projections.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Projections.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t0CF50F82272FF6330048A358 /* ProjectionsApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectionsApp.swift; sourceTree = \"<group>\"; };\n\t\t0CF50F84272FF6330048A358 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = \"<group>\"; };\n\t\t0CF50F86272FF6340048A358 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \"<group>\"; };\n\t\t0CF50F89272FF6340048A358 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = \"Preview Assets.xcassets\"; sourceTree = \"<group>\"; };\n\t\t0CF50F98273008BF0048A358 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = \"<group>\"; };\n\t\t0CF50F99273008DF0048A358 /* Realm.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Realm.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t0CF50F9A273008DF0048A358 /* RealmSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = RealmSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t227D20F11CB609A1008F641B /* LaunchScreen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LaunchScreen.xib; sourceTree = \"<group>\"; };\n\t\t3F7B50612D12042D004B792D /* Realm.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Realm.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t3F7B50622D12042D004B792D /* RealmSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = RealmSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t3FA2F2FD268FCA380015062E /* DemoObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DemoObject.swift; path = AppClipParent/DemoObject.swift; sourceTree = SOURCE_ROOT; };\n\t\t3FA2F2FE268FCA380015062E /* Constants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Constants.swift; path = AppClipParent/Constants.swift; sourceTree = SOURCE_ROOT; };\n\t\t3FC898FE1A1414110067CBEC /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = ViewController.swift; sourceTree = \"<group>\"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };\n\t\t493759A4230D8CA60078C28E /* ListSwiftUI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ListSwiftUI.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t493759AA230D8CA60078C28E /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = \"<group>\"; };\n\t\t493759AC230D8CAA0078C28E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \"<group>\"; };\n\t\t493759AF230D8CAA0078C28E /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = \"Preview Assets.xcassets\"; sourceTree = \"<group>\"; };\n\t\t493759B4230D8CAA0078C28E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\t493759B9230D9F9A0078C28E /* Realm.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Realm.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t493759BD230D9F9D0078C28E /* RealmSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = RealmSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t53379DB525CB0E020008A269 /* App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = \"<group>\"; };\n\t\t53454CB924EAC3F900678E48 /* AppClipApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppClipApp.swift; sourceTree = \"<group>\"; };\n\t\t53454CBD24EAC3FA00678E48 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \"<group>\"; };\n\t\t53454CC024EAC3FA00678E48 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = \"Preview Assets.xcassets\"; sourceTree = \"<group>\"; };\n\t\t53454CC224EAC3FA00678E48 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\t53454CCA24EAC43500678E48 /* AppClipParent.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AppClipParent.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t53454CCC24EAC43500678E48 /* AppClipParentApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppClipParentApp.swift; sourceTree = \"<group>\"; };\n\t\t53454CCE24EAC43500678E48 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = \"<group>\"; };\n\t\t53454CD024EAC43700678E48 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \"<group>\"; };\n\t\t53454CD324EAC43700678E48 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = \"Preview Assets.xcassets\"; sourceTree = \"<group>\"; };\n\t\t53454CD524EAC43700678E48 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\t53454CDD24EAC45500678E48 /* AppClip.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AppClip.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t7D46394F25C2E2750089EFD9 /* Example_v3.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Example_v3.swift; sourceTree = \"<group>\"; };\n\t\t7D46395325C2E7140089EFD9 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = \"<group>\"; xcLanguageSpecificationIdentifier = xcode.lang.markdown; };\n\t\t7D46399725C45FF00089EFD9 /* Example_v4.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Example_v4.swift; sourceTree = \"<group>\"; };\n\t\t7D46399F25C46C660089EFD9 /* Example_v5.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Example_v5.swift; sourceTree = \"<group>\"; };\n\t\t7DADCB9F25C816B500048287 /* default-v0.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"default-v0.realm\"; sourceTree = \"<group>\"; };\n\t\t7DADCBA025C816B500048287 /* default-v1.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"default-v1.realm\"; sourceTree = \"<group>\"; };\n\t\t7DADCBA125C816B500048287 /* default-v3.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"default-v3.realm\"; sourceTree = \"<group>\"; };\n\t\t7DADCBA225C816B500048287 /* default-v4.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"default-v4.realm\"; sourceTree = \"<group>\"; };\n\t\t7DADCBA325C816B500048287 /* default-v5.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"default-v5.realm\"; sourceTree = \"<group>\"; };\n\t\t7DADCBA425C816B600048287 /* default-v2.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"default-v2.realm\"; sourceTree = \"<group>\"; };\n\t\t7DADCBB125C8284500048287 /* Migration.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Migration.xcconfig; sourceTree = \"<group>\"; };\n\t\t7DFFB15D25C19F0700CA8AE5 /* Example_v0.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Example_v0.swift; sourceTree = \"<group>\"; };\n\t\t7DFFB16E25C1B65A00CA8AE5 /* Example_v1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Example_v1.swift; sourceTree = \"<group>\"; };\n\t\t7DFFB17625C1B84E00CA8AE5 /* Example_v2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Example_v2.swift; sourceTree = \"<group>\"; };\n\t\t9C318E8C1CA42C7800879076 /* GettingStarted.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = GettingStarted.playground; sourceTree = \"<group>\"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };\n\t\tAC2D0C0E269C470900126DCF /* Realm.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Realm.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tAC2D0C0F269C470900126DCF /* RealmSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = RealmSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tAC2D0C15269C471200126DCF /* Realm.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Realm.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tAC2D0C16269C471200126DCF /* RealmSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = RealmSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tC07E5D791B15001500ED625C /* Realm.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Realm.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tC09C490F1A605A4800638C9F /* RealmSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RealmSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tCFEDF01D24B72B67007FF10A /* Realm.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Realm.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tCFEDF02124B72B6B007FF10A /* RealmSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = RealmSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tCFF1724924B7310D00A16A59 /* Realm.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Realm.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tCFF1724A24B7310E00A16A59 /* RealmSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RealmSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE886FB601A12A6FC00CB2D0B /* GroupedTableView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GroupedTableView.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE886FB631A12A73E00CB2D0B /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = \"<group>\"; };\n\t\tE886FB641A12A73E00CB2D0B /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = \"<group>\"; };\n\t\tE886FB651A12A73E00CB2D0B /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tE886FB661A12A73E00CB2D0B /* TableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = \"<group>\"; };\n\t\tE8CB07EF19BA6AB60018434A /* Encryption.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Encryption.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE8CB081419BA6ABD0018434A /* Migration.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Migration.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE8CB083919BA6AC60018434A /* TableView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TableView.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE8CB085E19BA6ACA0018434A /* Simple.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Simple.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE8CB088019BA6AEE0018434A /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = \"<group>\"; };\n\t\tE8CB088119BA6AEE0018434A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tE8CB088519BA6AF70018434A /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = AppDelegate.swift; sourceTree = \"<group>\"; };\n\t\tE8CB088919BA6AF70018434A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tE8CB089019BA6B000018434A /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = AppDelegate.swift; sourceTree = \"<group>\"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };\n\t\tE8CB089119BA6B000018434A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tE8CB089519BA6B080018434A /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = \"<group>\"; };\n\t\tE8CB089619BA6B080018434A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = \"<group>\"; };\n\t\tE8CB089719BA6B080018434A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tE8CB089819BA6B080018434A /* TableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = \"<group>\"; };\n\t\tE8D3F2531A11765200620884 /* Backlink.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Backlink.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE8D3F2761A11766A00620884 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = AppDelegate.swift; sourceTree = \"<group>\"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };\n\t\tE8D3F2771A11766A00620884 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tE8F14D0A1CF8FD0C00564AF5 /* PlaygroundFrameworkWrapper.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PlaygroundFrameworkWrapper.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE8F14D0E1CF8FD0C00564AF5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tE8F14D121CF8FD7F00564AF5 /* PlaygroundFrameworkWrapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlaygroundFrameworkWrapper.swift; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t0CF50F7D272FF6330048A358 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3F7B506F2D120FFB004B792D /* Realm.framework in Frameworks */,\n\t\t\t\t3F7B50712D120FFB004B792D /* RealmSwift.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t493759A1230D8CA60078C28E /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3F7B50812D121063004B792D /* Realm.framework in Frameworks */,\n\t\t\t\t3F7B50832D121063004B792D /* RealmSwift.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t53454CC724EAC43500678E48 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t53454CDA24EAC45500678E48 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3F7B506A2D120F3D004B792D /* Realm.framework in Frameworks */,\n\t\t\t\t3F7B506C2D120F3D004B792D /* RealmSwift.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE886FB581A12A6FC00CB2D0B /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tC07E5D7E1B15004C00ED625C /* Realm.framework in Frameworks */,\n\t\t\t\tE8D212F51AF6A9FD00DAB243 /* RealmSwift.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8CB07EC19BA6AB60018434A /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tC07E5D7C1B15004800ED625C /* Realm.framework in Frameworks */,\n\t\t\t\tE8D212F31AF6A9EF00DAB243 /* RealmSwift.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8CB081119BA6ABD0018434A /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tC07E5D801B15004F00ED625C /* Realm.framework in Frameworks */,\n\t\t\t\tE8D212F71AF6AA0000DAB243 /* RealmSwift.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8CB083619BA6AC60018434A /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tC07E5D841B15005500ED625C /* Realm.framework in Frameworks */,\n\t\t\t\tE8D212FB1AF6AA0600DAB243 /* RealmSwift.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8CB085B19BA6ACA0018434A /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tC07E5D821B15005300ED625C /* Realm.framework in Frameworks */,\n\t\t\t\tE8D212F91AF6AA0300DAB243 /* RealmSwift.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8D3F2501A11765200620884 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tC07E5D7A1B15003B00ED625C /* Realm.framework in Frameworks */,\n\t\t\t\tE8D212F11AF6A9E800DAB243 /* RealmSwift.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8F14D061CF8FD0C00564AF5 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8CA270B1CF9031300FF203A /* Realm.framework in Frameworks */,\n\t\t\t\tE8CA270C1CF9031300FF203A /* RealmSwift.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t0295B90519D103180036D6C3 /* RealmSwift */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tC07E5D791B15001500ED625C /* Realm.framework */,\n\t\t\t\tC09C490F1A605A4800638C9F /* RealmSwift.framework */,\n\t\t\t);\n\t\t\tname = RealmSwift;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t0CF50F81272FF6330048A358 /* Projections */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t0CF50F88272FF6340048A358 /* Preview Content */,\n\t\t\t\t0CF50F86272FF6340048A358 /* Assets.xcassets */,\n\t\t\t\t0CF50F84272FF6330048A358 /* ContentView.swift */,\n\t\t\t\t0CF50F98273008BF0048A358 /* Info.plist */,\n\t\t\t\t0CF50F82272FF6330048A358 /* ProjectionsApp.swift */,\n\t\t\t);\n\t\t\tpath = Projections;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t0CF50F88272FF6340048A358 /* Preview Content */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t0CF50F89272FF6340048A358 /* Preview Assets.xcassets */,\n\t\t\t);\n\t\t\tpath = \"Preview Content\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t227D20F01CB609A1008F641B /* Common */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t227D20F11CB609A1008F641B /* LaunchScreen.xib */,\n\t\t\t);\n\t\t\tpath = Common;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t493759A5230D8CA60078C28E /* ListSwiftUI */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t493759AE230D8CAA0078C28E /* Preview Content */,\n\t\t\t\t49E693B22317FD3100189AAE /* Views */,\n\t\t\t\t493759AC230D8CAA0078C28E /* Assets.xcassets */,\n\t\t\t\t493759B4230D8CAA0078C28E /* Info.plist */,\n\t\t\t);\n\t\t\tpath = ListSwiftUI;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t493759AE230D8CAA0078C28E /* Preview Content */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t493759AF230D8CAA0078C28E /* Preview Assets.xcassets */,\n\t\t\t);\n\t\t\tpath = \"Preview Content\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t493759B8230D9F9A0078C28E /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3F7B50612D12042D004B792D /* Realm.framework */,\n\t\t\t\t0CF50F99273008DF0048A358 /* Realm.framework */,\n\t\t\t\tAC2D0C15269C471200126DCF /* Realm.framework */,\n\t\t\t\tAC2D0C0E269C470900126DCF /* Realm.framework */,\n\t\t\t\tCFF1724924B7310D00A16A59 /* Realm.framework */,\n\t\t\t\tCFEDF01D24B72B67007FF10A /* Realm.framework */,\n\t\t\t\t493759B9230D9F9A0078C28E /* Realm.framework */,\n\t\t\t\t3F7B50622D12042D004B792D /* RealmSwift.framework */,\n\t\t\t\t0CF50F9A273008DF0048A358 /* RealmSwift.framework */,\n\t\t\t\tAC2D0C16269C471200126DCF /* RealmSwift.framework */,\n\t\t\t\tAC2D0C0F269C470900126DCF /* RealmSwift.framework */,\n\t\t\t\tCFF1724A24B7310E00A16A59 /* RealmSwift.framework */,\n\t\t\t\tCFEDF02124B72B6B007FF10A /* RealmSwift.framework */,\n\t\t\t\t493759BD230D9F9D0078C28E /* RealmSwift.framework */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t49E693B22317FD3100189AAE /* Views */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t53379DB525CB0E020008A269 /* App.swift */,\n\t\t\t\t493759AA230D8CA60078C28E /* ContentView.swift */,\n\t\t\t);\n\t\t\tpath = Views;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t53454CB824EAC3F900678E48 /* AppClip */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t53454CBF24EAC3FA00678E48 /* Preview Content */,\n\t\t\t\t53454CB924EAC3F900678E48 /* AppClipApp.swift */,\n\t\t\t\t53454CBD24EAC3FA00678E48 /* Assets.xcassets */,\n\t\t\t\t3FA2F2FE268FCA380015062E /* Constants.swift */,\n\t\t\t\t3FA2F2FD268FCA380015062E /* DemoObject.swift */,\n\t\t\t\t53454CC224EAC3FA00678E48 /* Info.plist */,\n\t\t\t);\n\t\t\tpath = AppClip;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t53454CBF24EAC3FA00678E48 /* Preview Content */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t53454CC024EAC3FA00678E48 /* Preview Assets.xcassets */,\n\t\t\t);\n\t\t\tpath = \"Preview Content\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t53454CCB24EAC43500678E48 /* AppClipParent */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t53454CD224EAC43700678E48 /* Preview Content */,\n\t\t\t\t53454CCC24EAC43500678E48 /* AppClipParentApp.swift */,\n\t\t\t\t53454CD024EAC43700678E48 /* Assets.xcassets */,\n\t\t\t\t53454CCE24EAC43500678E48 /* ContentView.swift */,\n\t\t\t\t53454CD524EAC43700678E48 /* Info.plist */,\n\t\t\t);\n\t\t\tpath = AppClipParent;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t53454CD224EAC43700678E48 /* Preview Content */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t53454CD324EAC43700678E48 /* Preview Assets.xcassets */,\n\t\t\t);\n\t\t\tpath = \"Preview Content\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t7D46396525C30B580089EFD9 /* Examples */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7DFFB15D25C19F0700CA8AE5 /* Example_v0.swift */,\n\t\t\t\t7DFFB16E25C1B65A00CA8AE5 /* Example_v1.swift */,\n\t\t\t\t7DFFB17625C1B84E00CA8AE5 /* Example_v2.swift */,\n\t\t\t\t7D46394F25C2E2750089EFD9 /* Example_v3.swift */,\n\t\t\t\t7D46399725C45FF00089EFD9 /* Example_v4.swift */,\n\t\t\t\t7D46399F25C46C660089EFD9 /* Example_v5.swift */,\n\t\t\t);\n\t\t\tpath = Examples;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t7D46396A25C30B7F0089EFD9 /* RealmTemplates */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7DADCB9F25C816B500048287 /* default-v0.realm */,\n\t\t\t\t7DADCBA025C816B500048287 /* default-v1.realm */,\n\t\t\t\t7DADCBA425C816B600048287 /* default-v2.realm */,\n\t\t\t\t7DADCBA125C816B500048287 /* default-v3.realm */,\n\t\t\t\t7DADCBA225C816B500048287 /* default-v4.realm */,\n\t\t\t\t7DADCBA325C816B500048287 /* default-v5.realm */,\n\t\t\t);\n\t\t\tpath = RealmTemplates;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE805758C19BA55E600376620 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t53454CB824EAC3F900678E48 /* AppClip */,\n\t\t\t\t53454CCB24EAC43500678E48 /* AppClipParent */,\n\t\t\t\tE8D3F2751A11766A00620884 /* Backlink */,\n\t\t\t\t227D20F01CB609A1008F641B /* Common */,\n\t\t\t\tE8CB087F19BA6AEE0018434A /* Encryption */,\n\t\t\t\t493759B8230D9F9A0078C28E /* Frameworks */,\n\t\t\t\tE886FB621A12A73E00CB2D0B /* GroupedTableView */,\n\t\t\t\t493759A5230D8CA60078C28E /* ListSwiftUI */,\n\t\t\t\tE8CB088419BA6AF70018434A /* Migration */,\n\t\t\t\tE8F14D0B1CF8FD0C00564AF5 /* PlaygroundFrameworkWrapper */,\n\t\t\t\tE805759619BA55E600376620 /* Products */,\n\t\t\t\t0CF50F81272FF6330048A358 /* Projections */,\n\t\t\t\t0295B90519D103180036D6C3 /* RealmSwift */,\n\t\t\t\tE8CB088F19BA6B000018434A /* Simple */,\n\t\t\t\tE8CB089419BA6B080018434A /* TableView */,\n\t\t\t\t9C318E8C1CA42C7800879076 /* GettingStarted.playground */,\n\t\t\t\t0A73D4411B1443A700E1E8EE /* README.md */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE805759619BA55E600376620 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t53454CDD24EAC45500678E48 /* AppClip.app */,\n\t\t\t\t53454CCA24EAC43500678E48 /* AppClipParent.app */,\n\t\t\t\tE8D3F2531A11765200620884 /* Backlink.app */,\n\t\t\t\tE8CB07EF19BA6AB60018434A /* Encryption.app */,\n\t\t\t\tE886FB601A12A6FC00CB2D0B /* GroupedTableView.app */,\n\t\t\t\t493759A4230D8CA60078C28E /* ListSwiftUI.app */,\n\t\t\t\tE8CB081419BA6ABD0018434A /* Migration.app */,\n\t\t\t\tE8F14D0A1CF8FD0C00564AF5 /* PlaygroundFrameworkWrapper.framework */,\n\t\t\t\t0CF50F80272FF6330048A358 /* Projections.app */,\n\t\t\t\tE8CB085E19BA6ACA0018434A /* Simple.app */,\n\t\t\t\tE8CB083919BA6AC60018434A /* TableView.app */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE886FB621A12A73E00CB2D0B /* GroupedTableView */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE886FB631A12A73E00CB2D0B /* AppDelegate.swift */,\n\t\t\t\tE886FB641A12A73E00CB2D0B /* Images.xcassets */,\n\t\t\t\tE886FB651A12A73E00CB2D0B /* Info.plist */,\n\t\t\t\tE886FB661A12A73E00CB2D0B /* TableViewController.swift */,\n\t\t\t);\n\t\t\tpath = GroupedTableView;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8CB087F19BA6AEE0018434A /* Encryption */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE8CB088019BA6AEE0018434A /* AppDelegate.swift */,\n\t\t\t\tE8CB088119BA6AEE0018434A /* Info.plist */,\n\t\t\t\t3FC898FE1A1414110067CBEC /* ViewController.swift */,\n\t\t\t);\n\t\t\tpath = Encryption;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8CB088419BA6AF70018434A /* Migration */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7D46396525C30B580089EFD9 /* Examples */,\n\t\t\t\t7D46396A25C30B7F0089EFD9 /* RealmTemplates */,\n\t\t\t\tE8CB088519BA6AF70018434A /* AppDelegate.swift */,\n\t\t\t\tE8CB088919BA6AF70018434A /* Info.plist */,\n\t\t\t\t7DADCBB125C8284500048287 /* Migration.xcconfig */,\n\t\t\t\t7D46395325C2E7140089EFD9 /* README.md */,\n\t\t\t);\n\t\t\tpath = Migration;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8CB088F19BA6B000018434A /* Simple */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE8CB089019BA6B000018434A /* AppDelegate.swift */,\n\t\t\t\tE8CB089119BA6B000018434A /* Info.plist */,\n\t\t\t);\n\t\t\tpath = Simple;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8CB089419BA6B080018434A /* TableView */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE8CB089519BA6B080018434A /* AppDelegate.swift */,\n\t\t\t\tE8CB089619BA6B080018434A /* Images.xcassets */,\n\t\t\t\tE8CB089719BA6B080018434A /* Info.plist */,\n\t\t\t\tE8CB089819BA6B080018434A /* TableViewController.swift */,\n\t\t\t);\n\t\t\tpath = TableView;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8D3F2751A11766A00620884 /* Backlink */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE8D3F2761A11766A00620884 /* AppDelegate.swift */,\n\t\t\t\tE8D3F2771A11766A00620884 /* Info.plist */,\n\t\t\t);\n\t\t\tpath = Backlink;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8F14D0B1CF8FD0C00564AF5 /* PlaygroundFrameworkWrapper */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE8F14D0E1CF8FD0C00564AF5 /* Info.plist */,\n\t\t\t\tE8F14D121CF8FD7F00564AF5 /* PlaygroundFrameworkWrapper.swift */,\n\t\t\t);\n\t\t\tpath = PlaygroundFrameworkWrapper;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXNativeTarget section */\n\t\t0CF50F7F272FF6330048A358 /* Projections */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 0CF50F8B272FF6340048A358 /* Build configuration list for PBXNativeTarget \"Projections\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t0CF50F7C272FF6330048A358 /* Sources */,\n\t\t\t\t0CF50F7D272FF6330048A358 /* Frameworks */,\n\t\t\t\t0CF50F7E272FF6330048A358 /* Resources */,\n\t\t\t\t3F7B50732D120FFB004B792D /* Embed Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = Projections;\n\t\t\tproductName = Projections;\n\t\t\tproductReference = 0CF50F80272FF6330048A358 /* Projections.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\t493759A3230D8CA60078C28E /* ListSwiftUI */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 493759B7230D8CAA0078C28E /* Build configuration list for PBXNativeTarget \"ListSwiftUI\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t493759A0230D8CA60078C28E /* Sources */,\n\t\t\t\t493759A1230D8CA60078C28E /* Frameworks */,\n\t\t\t\t493759A2230D8CA60078C28E /* Resources */,\n\t\t\t\t3F7B50852D121063004B792D /* Embed Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = ListSwiftUI;\n\t\t\tproductName = ListSwiftUI;\n\t\t\tproductReference = 493759A4230D8CA60078C28E /* ListSwiftUI.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\t53454CC924EAC43500678E48 /* AppClipParent */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 53454CD624EAC43700678E48 /* Build configuration list for PBXNativeTarget \"AppClipParent\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t53454CC624EAC43500678E48 /* Sources */,\n\t\t\t\t53454CC724EAC43500678E48 /* Frameworks */,\n\t\t\t\t53454CC824EAC43500678E48 /* Resources */,\n\t\t\t\t53454CF024EAC45700678E48 /* Embed App Clips */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t53454CEB24EAC45700678E48 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = AppClipParent;\n\t\t\tproductName = AppClipParent;\n\t\t\tproductReference = 53454CCA24EAC43500678E48 /* AppClipParent.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\t53454CDC24EAC45500678E48 /* AppClip */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 53454CED24EAC45700678E48 /* Build configuration list for PBXNativeTarget \"AppClip\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t53454CD924EAC45500678E48 /* Sources */,\n\t\t\t\t53454CDA24EAC45500678E48 /* Frameworks */,\n\t\t\t\t53454CDB24EAC45500678E48 /* Resources */,\n\t\t\t\t3F7B506E2D120F3D004B792D /* Embed Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = AppClip;\n\t\t\tproductName = AppClip;\n\t\t\tproductReference = 53454CDD24EAC45500678E48 /* AppClip.app */;\n\t\t\tproductType = \"com.apple.product-type.application.on-demand-install-capable\";\n\t\t};\n\t\tE886FB511A12A6FC00CB2D0B /* GroupedTableView */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = E886FB5D1A12A6FC00CB2D0B /* Build configuration list for PBXNativeTarget \"GroupedTableView\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE886FB541A12A6FC00CB2D0B /* Sources */,\n\t\t\t\tE886FB581A12A6FC00CB2D0B /* Frameworks */,\n\t\t\t\tE886FB5B1A12A6FC00CB2D0B /* Resources */,\n\t\t\t\tC01304E51A60A6CE00EB3E1E /* CopyFiles */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = GroupedTableView;\n\t\t\tproductName = TableView;\n\t\t\tproductReference = E886FB601A12A6FC00CB2D0B /* GroupedTableView.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\tE8CB07EE19BA6AB60018434A /* Encryption */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = E8CB080E19BA6AB70018434A /* Build configuration list for PBXNativeTarget \"Encryption\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE8CB07EB19BA6AB60018434A /* Sources */,\n\t\t\t\tE8CB07EC19BA6AB60018434A /* Frameworks */,\n\t\t\t\tC01304E91A60B77600EB3E1E /* CopyFiles */,\n\t\t\t\t227D20941CB4EEE7008F641B /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = Encryption;\n\t\t\tproductName = Encryption;\n\t\t\tproductReference = E8CB07EF19BA6AB60018434A /* Encryption.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\tE8CB081319BA6ABD0018434A /* Migration */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = E8CB082F19BA6ABE0018434A /* Build configuration list for PBXNativeTarget \"Migration\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE8CB081019BA6ABD0018434A /* Sources */,\n\t\t\t\tE8CB081119BA6ABD0018434A /* Frameworks */,\n\t\t\t\tE8CB081219BA6ABD0018434A /* Resources */,\n\t\t\t\tC01304E71A60A6EC00EB3E1E /* CopyFiles */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = Migration;\n\t\t\tproductName = Migration;\n\t\t\tproductReference = E8CB081419BA6ABD0018434A /* Migration.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\tE8CB083819BA6AC60018434A /* TableView */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = E8CB085419BA6AC70018434A /* Build configuration list for PBXNativeTarget \"TableView\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE8CB083519BA6AC60018434A /* Sources */,\n\t\t\t\tE8CB083619BA6AC60018434A /* Frameworks */,\n\t\t\t\tE8CB083719BA6AC60018434A /* Resources */,\n\t\t\t\tC09C491C1A6068E500638C9F /* CopyFiles */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = TableView;\n\t\t\tproductName = TableView;\n\t\t\tproductReference = E8CB083919BA6AC60018434A /* TableView.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\tE8CB085D19BA6ACA0018434A /* Simple */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = E8CB087919BA6ACB0018434A /* Build configuration list for PBXNativeTarget \"Simple\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE8CB085A19BA6ACA0018434A /* Sources */,\n\t\t\t\tE8CB085B19BA6ACA0018434A /* Frameworks */,\n\t\t\t\tC09C490D1A6059BA00638C9F /* CopyFiles */,\n\t\t\t\t227D209D1CB4F451008F641B /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = Simple;\n\t\t\tproductName = Simple;\n\t\t\tproductReference = E8CB085E19BA6ACA0018434A /* Simple.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\tE8D3F2521A11765200620884 /* Backlink */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = E8D3F2731A11765200620884 /* Build configuration list for PBXNativeTarget \"Backlink\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE8D3F24F1A11765200620884 /* Sources */,\n\t\t\t\tE8D3F2501A11765200620884 /* Frameworks */,\n\t\t\t\tC01304E31A60A4A000EB3E1E /* CopyFiles */,\n\t\t\t\t227D20911CB4EB18008F641B /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = Backlink;\n\t\t\tproductName = Backlink;\n\t\t\tproductReference = E8D3F2531A11765200620884 /* Backlink.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\tE8F14D091CF8FD0C00564AF5 /* PlaygroundFrameworkWrapper */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = E8F14D111CF8FD0C00564AF5 /* Build configuration list for PBXNativeTarget \"PlaygroundFrameworkWrapper\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE8F14D051CF8FD0C00564AF5 /* Sources */,\n\t\t\t\tE8F14D061CF8FD0C00564AF5 /* Frameworks */,\n\t\t\t\tE8F14D141CF900E500564AF5 /* CopyFiles */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = PlaygroundFrameworkWrapper;\n\t\t\tproductName = PlaygroundFrameworkWrapper;\n\t\t\tproductReference = E8F14D0A1CF8FD0C00564AF5 /* PlaygroundFrameworkWrapper.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tE805758D19BA55E600376620 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1310;\n\t\t\t\tLastUpgradeCheck = 1430;\n\t\t\t\tORGANIZATIONNAME = Realm;\n\t\t\t\tTargetAttributes = {\n\t\t\t\t\t0CF50F7F272FF6330048A358 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 13.1;\n\t\t\t\t\t\tDevelopmentTeam = QX5CR2FTN2;\n\t\t\t\t\t\tProvisioningStyle = Automatic;\n\t\t\t\t\t};\n\t\t\t\t\t493759A3230D8CA60078C28E = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 11.0;\n\t\t\t\t\t\tDevelopmentTeam = 2Z8M9MTEVV;\n\t\t\t\t\t\tProvisioningStyle = Automatic;\n\t\t\t\t\t};\n\t\t\t\t\t53454CC924EAC43500678E48 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 12.0;\n\t\t\t\t\t\tProvisioningStyle = Automatic;\n\t\t\t\t\t};\n\t\t\t\t\t53454CDC24EAC45500678E48 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 12.0;\n\t\t\t\t\t\tLastSwiftMigration = 1300;\n\t\t\t\t\t\tProvisioningStyle = Automatic;\n\t\t\t\t\t};\n\t\t\t\t\tE8CB07EE19BA6AB60018434A = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 6.0;\n\t\t\t\t\t};\n\t\t\t\t\tE8CB081319BA6ABD0018434A = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 6.0;\n\t\t\t\t\t};\n\t\t\t\t\tE8CB083819BA6AC60018434A = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 6.0;\n\t\t\t\t\t};\n\t\t\t\t\tE8CB085D19BA6ACA0018434A = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 6.0;\n\t\t\t\t\t};\n\t\t\t\t\tE8D3F2521A11765200620884 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 6.1;\n\t\t\t\t\t\tLastSwiftMigration = 1130;\n\t\t\t\t\t};\n\t\t\t\t\tE8F14D091CF8FD0C00564AF5 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.3.1;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tbuildConfigurationList = E805759019BA55E600376620 /* Build configuration list for PBXProject \"RealmExamples\" */;\n\t\t\tcompatibilityVersion = \"Xcode 3.2\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t\tBase,\n\t\t\t);\n\t\t\tmainGroup = E805758C19BA55E600376620;\n\t\t\tproductRefGroup = E805759619BA55E600376620 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\tE8D3F2521A11765200620884 /* Backlink */,\n\t\t\t\tE8CB07EE19BA6AB60018434A /* Encryption */,\n\t\t\t\tE886FB511A12A6FC00CB2D0B /* GroupedTableView */,\n\t\t\t\tE8CB081319BA6ABD0018434A /* Migration */,\n\t\t\t\tE8CB085D19BA6ACA0018434A /* Simple */,\n\t\t\t\tE8CB083819BA6AC60018434A /* TableView */,\n\t\t\t\tE8F14D091CF8FD0C00564AF5 /* PlaygroundFrameworkWrapper */,\n\t\t\t\t493759A3230D8CA60078C28E /* ListSwiftUI */,\n\t\t\t\t53454CC924EAC43500678E48 /* AppClipParent */,\n\t\t\t\t53454CDC24EAC45500678E48 /* AppClip */,\n\t\t\t\t0CF50F7F272FF6330048A358 /* Projections */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t0CF50F7E272FF6330048A358 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t0CF50F87272FF6340048A358 /* Assets.xcassets in Resources */,\n\t\t\t\t0CF50F8A272FF6340048A358 /* Preview Assets.xcassets in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t227D20911CB4EB18008F641B /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t227D20F21CB609A1008F641B /* LaunchScreen.xib in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t227D20941CB4EEE7008F641B /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t227D20F31CB609A1008F641B /* LaunchScreen.xib in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t227D209D1CB4F451008F641B /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t227D20F61CB609A1008F641B /* LaunchScreen.xib in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t493759A2230D8CA60078C28E /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t493759AD230D8CAA0078C28E /* Assets.xcassets in Resources */,\n\t\t\t\t493759B0230D8CAA0078C28E /* Preview Assets.xcassets in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t53454CC824EAC43500678E48 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t53454CD124EAC43700678E48 /* Assets.xcassets in Resources */,\n\t\t\t\t53454CD424EAC43700678E48 /* Preview Assets.xcassets in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t53454CDB24EAC45500678E48 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE886FB5B1A12A6FC00CB2D0B /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE886FB681A12A73E00CB2D0B /* Images.xcassets in Resources */,\n\t\t\t\t227D20F41CB609A1008F641B /* LaunchScreen.xib in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8CB081219BA6ABD0018434A /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t7DADCBA525C816B600048287 /* default-v0.realm in Resources */,\n\t\t\t\t7DADCBA625C816B600048287 /* default-v1.realm in Resources */,\n\t\t\t\t7DADCBAA25C816B600048287 /* default-v2.realm in Resources */,\n\t\t\t\t7DADCBA725C816B600048287 /* default-v3.realm in Resources */,\n\t\t\t\t7DADCBA825C816B600048287 /* default-v4.realm in Resources */,\n\t\t\t\t7DADCBA925C816B600048287 /* default-v5.realm in Resources */,\n\t\t\t\t227D20F51CB609A1008F641B /* LaunchScreen.xib in Resources */,\n\t\t\t\t7DADCBB225C8284500048287 /* Migration.xcconfig in Resources */,\n\t\t\t\t7D46395425C2E7140089EFD9 /* README.md in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8CB083719BA6AC60018434A /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8CB089A19BA6B080018434A /* Images.xcassets in Resources */,\n\t\t\t\t227D20F71CB609A1008F641B /* LaunchScreen.xib in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t0CF50F7C272FF6330048A358 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t0CF50F85272FF6330048A358 /* ContentView.swift in Sources */,\n\t\t\t\t0CF50F83272FF6330048A358 /* ProjectionsApp.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t493759A0230D8CA60078C28E /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t53379DB625CB0E020008A269 /* App.swift in Sources */,\n\t\t\t\t493759AB230D8CA60078C28E /* ContentView.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t53454CC624EAC43500678E48 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t53454CCD24EAC43500678E48 /* AppClipParentApp.swift in Sources */,\n\t\t\t\t3FA2F301268FCA960015062E /* Constants.swift in Sources */,\n\t\t\t\t53454CCF24EAC43500678E48 /* ContentView.swift in Sources */,\n\t\t\t\t3FA2F302268FCA960015062E /* DemoObject.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t53454CD924EAC45500678E48 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FA2F303268FCAAD0015062E /* AppClipApp.swift in Sources */,\n\t\t\t\t3FA2F300268FCA380015062E /* Constants.swift in Sources */,\n\t\t\t\t3FA2F304268FCAC80015062E /* ContentView.swift in Sources */,\n\t\t\t\t3FA2F2FF268FCA380015062E /* DemoObject.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE886FB541A12A6FC00CB2D0B /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE886FB671A12A73E00CB2D0B /* AppDelegate.swift in Sources */,\n\t\t\t\tE886FB6A1A12A73E00CB2D0B /* TableViewController.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8CB07EB19BA6AB60018434A /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8CB088219BA6AEE0018434A /* AppDelegate.swift in Sources */,\n\t\t\t\t3FC898FF1A1414110067CBEC /* ViewController.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8CB081019BA6ABD0018434A /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8CB088A19BA6AF70018434A /* AppDelegate.swift in Sources */,\n\t\t\t\t7DFFB15E25C19F0700CA8AE5 /* Example_v0.swift in Sources */,\n\t\t\t\t7DFFB16F25C1B65A00CA8AE5 /* Example_v1.swift in Sources */,\n\t\t\t\t7DFFB17725C1B84E00CA8AE5 /* Example_v2.swift in Sources */,\n\t\t\t\t7D46395025C2E2750089EFD9 /* Example_v3.swift in Sources */,\n\t\t\t\t7D46399825C45FF00089EFD9 /* Example_v4.swift in Sources */,\n\t\t\t\t7D4639A025C46C660089EFD9 /* Example_v5.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8CB083519BA6AC60018434A /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8CB089919BA6B080018434A /* AppDelegate.swift in Sources */,\n\t\t\t\tE8CB089C19BA6B080018434A /* TableViewController.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8CB085A19BA6ACA0018434A /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8CB089219BA6B000018434A /* AppDelegate.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8D3F24F1A11765200620884 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8D3F2781A11766A00620884 /* AppDelegate.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tE8F14D051CF8FD0C00564AF5 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE8F14D131CF8FD7F00564AF5 /* PlaygroundFrameworkWrapper.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\t53454CEB24EAC45700678E48 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 53454CDC24EAC45500678E48 /* AppClip */;\n\t\t\ttargetProxy = 53454CEA24EAC45700678E48 /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t0CF50F8C272FF6340048A358 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++17\";\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tDEVELOPMENT_ASSET_PATHS = \"\\\"Projections/Preview Content\\\"\";\n\t\t\t\tDEVELOPMENT_TEAM = QX5CR2FTN2;\n\t\t\t\tENABLE_PREVIEWS = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGENERATE_INFOPLIST_FILE = YES;\n\t\t\t\tINFOPLIST_FILE = Projections/Info.plist;\n\t\t\t\tINFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;\n\t\t\t\tINFOPLIST_KEY_UILaunchScreen_Generation = YES;\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations = \"UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = \"UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = \"UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 15.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.realm.Projections;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_EMIT_LOC_STRINGS = YES;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t0CF50F8D272FF6340048A358 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++17\";\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tDEVELOPMENT_ASSET_PATHS = \"\\\"Projections/Preview Content\\\"\";\n\t\t\t\tDEVELOPMENT_TEAM = QX5CR2FTN2;\n\t\t\t\tENABLE_PREVIEWS = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGENERATE_INFOPLIST_FILE = YES;\n\t\t\t\tINFOPLIST_FILE = Projections/Info.plist;\n\t\t\t\tINFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;\n\t\t\t\tINFOPLIST_KEY_UILaunchScreen_Generation = YES;\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations = \"UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = \"UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tINFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = \"UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 15.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.realm.Projections;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSWIFT_EMIT_LOC_STRINGS = YES;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t493759B5230D8CAA0078C28E /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tDEVELOPMENT_ASSET_PATHS = \"ListSwiftUI/Preview\\\\ Content\";\n\t\t\t\tDEVELOPMENT_TEAM = 2Z8M9MTEVV;\n\t\t\t\tENABLE_PREVIEWS = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tINFOPLIST_FILE = ListSwiftUI/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 14.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.realm.ListSwiftUI;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t493759B6230D8CAA0078C28E /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tDEVELOPMENT_ASSET_PATHS = \"ListSwiftUI/Preview\\\\ Content\";\n\t\t\t\tDEVELOPMENT_TEAM = 2Z8M9MTEVV;\n\t\t\t\tENABLE_PREVIEWS = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tINFOPLIST_FILE = ListSwiftUI/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 14.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.realm.ListSwiftUI;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t53454CD724EAC43700678E48 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tDEVELOPMENT_ASSET_PATHS = \"\\\"AppClipParent/Preview Content\\\"\";\n\t\t\t\tENABLE_PREVIEWS = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tINFOPLIST_FILE = AppClipParent/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 14.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.realm.AppClipParent;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t53454CD824EAC43700678E48 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tDEVELOPMENT_ASSET_PATHS = \"\\\"AppClipParent/Preview Content\\\"\";\n\t\t\t\tENABLE_PREVIEWS = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tINFOPLIST_FILE = AppClipParent/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 14.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.realm.AppClipParent;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t53454CEE24EAC45700678E48 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = AppClip/AppClip.entitlements;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tDEVELOPMENT_ASSET_PATHS = \"\\\"AppClip/Preview Content\\\"\";\n\t\t\t\tENABLE_PREVIEWS = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tINFOPLIST_FILE = AppClip/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 14.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.realm.AppClipParent.Clip;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t53454CEF24EAC45700678E48 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = AppClip/AppClip.entitlements;\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tDEVELOPMENT_ASSET_PATHS = \"\\\"AppClip/Preview Content\\\"\";\n\t\t\t\tENABLE_PREVIEWS = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tINFOPLIST_FILE = AppClip/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 14.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.realm.AppClipParent.Clip;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE80575AF19BA55E700376620 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_SYMBOLS_PRIVATE_EXTERN = NO;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 4.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE80575B019BA55E700376620 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = YES;\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Owholemodule\";\n\t\t\t\tSWIFT_VERSION = 4.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE886FB5E1A12A6FC00CB2D0B /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/GroupedTableView/Info.plist\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.$(PRODUCT_NAME:rfc1034identifier)\";\n\t\t\t\tPRODUCT_NAME = GroupedTableView;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE886FB5F1A12A6FC00CB2D0B /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/GroupedTableView/Info.plist\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.$(PRODUCT_NAME:rfc1034identifier)\";\n\t\t\t\tPRODUCT_NAME = GroupedTableView;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE8CB080A19BA6AB70018434A /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = Encryption/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE8CB080B19BA6AB70018434A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tINFOPLIST_FILE = Encryption/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE8CB083019BA6ABE0018434A /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 7DADCBB125C8284500048287 /* Migration.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = Migration/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE8CB083119BA6ABE0018434A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 7DADCBB125C8284500048287 /* Migration.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tINFOPLIST_FILE = Migration/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE8CB085519BA6AC70018434A /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = TableView/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE8CB085619BA6AC70018434A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tINFOPLIST_FILE = TableView/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE8CB087A19BA6ACB0018434A /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = Simple/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE8CB087B19BA6ACB0018434A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tINFOPLIST_FILE = Simple/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE8D3F26F1A11765200620884 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = Backlink/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE8D3F2701A11765200620884 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tINFOPLIST_FILE = Backlink/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"io.realm.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE8F14D0F1CF8FD0C00564AF5 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tINFOPLIST_FILE = PlaygroundFrameworkWrapper/Info.plist;\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.realm.PlaygroundFrameworkWrapper;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE8F14D101CF8FD0C00564AF5 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tINFOPLIST_FILE = PlaygroundFrameworkWrapper/Info.plist;\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.realm.PlaygroundFrameworkWrapper;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t0CF50F8B272FF6340048A358 /* Build configuration list for PBXNativeTarget \"Projections\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t0CF50F8C272FF6340048A358 /* Debug */,\n\t\t\t\t0CF50F8D272FF6340048A358 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t493759B7230D8CAA0078C28E /* Build configuration list for PBXNativeTarget \"ListSwiftUI\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t493759B5230D8CAA0078C28E /* Debug */,\n\t\t\t\t493759B6230D8CAA0078C28E /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t53454CD624EAC43700678E48 /* Build configuration list for PBXNativeTarget \"AppClipParent\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t53454CD724EAC43700678E48 /* Debug */,\n\t\t\t\t53454CD824EAC43700678E48 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t53454CED24EAC45700678E48 /* Build configuration list for PBXNativeTarget \"AppClip\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t53454CEE24EAC45700678E48 /* Debug */,\n\t\t\t\t53454CEF24EAC45700678E48 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE805759019BA55E600376620 /* Build configuration list for PBXProject \"RealmExamples\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE80575AF19BA55E700376620 /* Debug */,\n\t\t\t\tE80575B019BA55E700376620 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE886FB5D1A12A6FC00CB2D0B /* Build configuration list for PBXNativeTarget \"GroupedTableView\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE886FB5E1A12A6FC00CB2D0B /* Debug */,\n\t\t\t\tE886FB5F1A12A6FC00CB2D0B /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE8CB080E19BA6AB70018434A /* Build configuration list for PBXNativeTarget \"Encryption\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE8CB080A19BA6AB70018434A /* Debug */,\n\t\t\t\tE8CB080B19BA6AB70018434A /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE8CB082F19BA6ABE0018434A /* Build configuration list for PBXNativeTarget \"Migration\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE8CB083019BA6ABE0018434A /* Debug */,\n\t\t\t\tE8CB083119BA6ABE0018434A /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE8CB085419BA6AC70018434A /* Build configuration list for PBXNativeTarget \"TableView\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE8CB085519BA6AC70018434A /* Debug */,\n\t\t\t\tE8CB085619BA6AC70018434A /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE8CB087919BA6ACB0018434A /* Build configuration list for PBXNativeTarget \"Simple\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE8CB087A19BA6ACB0018434A /* Debug */,\n\t\t\t\tE8CB087B19BA6ACB0018434A /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE8D3F2731A11765200620884 /* Build configuration list for PBXNativeTarget \"Backlink\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE8D3F26F1A11765200620884 /* Debug */,\n\t\t\t\tE8D3F2701A11765200620884 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE8F14D111CF8FD0C00564AF5 /* Build configuration list for PBXNativeTarget \"PlaygroundFrameworkWrapper\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE8F14D0F1CF8FD0C00564AF5 /* Debug */,\n\t\t\t\tE8F14D101CF8FD0C00564AF5 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = E805758D19BA55E600376620 /* Project object */;\n}\n"
  },
  {
    "path": "examples/ios/swift/RealmExamples.xcodeproj/xcshareddata/xcschemes/AppClip.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"686F531424A8EF2100BA4AC1\"\n               BuildableName = \"AppClip.app\"\n               BlueprintName = \"AppClip\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <Testables>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"686F531424A8EF2100BA4AC1\"\n            BuildableName = \"AppClip.app\"\n            BlueprintName = \"AppClip\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n      <EnvironmentVariables>\n         <EnvironmentVariable\n            key = \"_XCAppClipURL\"\n            value = \"https://example.com\"\n            isEnabled = \"YES\">\n         </EnvironmentVariable>\n      </EnvironmentVariables>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"686F531424A8EF2100BA4AC1\"\n            BuildableName = \"AppClip.app\"\n            BlueprintName = \"AppClip\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/ios/swift/RealmExamples.xcodeproj/xcshareddata/xcschemes/Backlink.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5D660FCB1BE98C560021E04F\"\n               BuildableName = \"RealmSwift.framework\"\n               BlueprintName = \"RealmSwift\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E8D3F2521A11765200620884\"\n               BuildableName = \"Backlink.app\"\n               BlueprintName = \"Backlink\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <Testables>\n      </Testables>\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8D3F2521A11765200620884\"\n            BuildableName = \"Backlink.app\"\n            BlueprintName = \"Backlink\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8D3F2521A11765200620884\"\n            BuildableName = \"Backlink.app\"\n            BlueprintName = \"Backlink\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8D3F2521A11765200620884\"\n            BuildableName = \"Backlink.app\"\n            BlueprintName = \"Backlink\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/ios/swift/RealmExamples.xcodeproj/xcshareddata/xcschemes/Encryption.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5D660FCB1BE98C560021E04F\"\n               BuildableName = \"RealmSwift.framework\"\n               BlueprintName = \"RealmSwift\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E8CB07EE19BA6AB60018434A\"\n               BuildableName = \"Encryption.app\"\n               BlueprintName = \"Encryption\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <Testables>\n      </Testables>\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8CB07EE19BA6AB60018434A\"\n            BuildableName = \"Encryption.app\"\n            BlueprintName = \"Encryption\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"\"\n      selectedLauncherIdentifier = \"Xcode.IDEFoundation.Launcher.PosixSpawn\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8CB07EE19BA6AB60018434A\"\n            BuildableName = \"Encryption.app\"\n            BlueprintName = \"Encryption\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8CB07EE19BA6AB60018434A\"\n            BuildableName = \"Encryption.app\"\n            BlueprintName = \"Encryption\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/ios/swift/RealmExamples.xcodeproj/xcshareddata/xcschemes/GroupedTableView.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5D660FCB1BE98C560021E04F\"\n               BuildableName = \"RealmSwift.framework\"\n               BlueprintName = \"RealmSwift\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E886FB511A12A6FC00CB2D0B\"\n               BuildableName = \"GroupedTableView.app\"\n               BlueprintName = \"GroupedTableView\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <Testables>\n      </Testables>\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E886FB511A12A6FC00CB2D0B\"\n            BuildableName = \"GroupedTableView.app\"\n            BlueprintName = \"GroupedTableView\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E886FB511A12A6FC00CB2D0B\"\n            BuildableName = \"GroupedTableView.app\"\n            BlueprintName = \"GroupedTableView\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E886FB511A12A6FC00CB2D0B\"\n            BuildableName = \"GroupedTableView.app\"\n            BlueprintName = \"GroupedTableView\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/ios/swift/RealmExamples.xcodeproj/xcshareddata/xcschemes/Migration.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5D660FCB1BE98C560021E04F\"\n               BuildableName = \"RealmSwift.framework\"\n               BlueprintName = \"RealmSwift\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E8CB081319BA6ABD0018434A\"\n               BuildableName = \"Migration.app\"\n               BlueprintName = \"Migration\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <Testables>\n      </Testables>\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8CB081319BA6ABD0018434A\"\n            BuildableName = \"Migration.app\"\n            BlueprintName = \"Migration\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8CB081319BA6ABD0018434A\"\n            BuildableName = \"Migration.app\"\n            BlueprintName = \"Migration\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8CB081319BA6ABD0018434A\"\n            BuildableName = \"Migration.app\"\n            BlueprintName = \"Migration\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/ios/swift/RealmExamples.xcodeproj/xcshareddata/xcschemes/Simple.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5D660FCB1BE98C560021E04F\"\n               BuildableName = \"RealmSwift.framework\"\n               BlueprintName = \"RealmSwift\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E8CB085D19BA6ACA0018434A\"\n               BuildableName = \"Simple.app\"\n               BlueprintName = \"Simple\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <Testables>\n      </Testables>\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8CB085D19BA6ACA0018434A\"\n            BuildableName = \"Simple.app\"\n            BlueprintName = \"Simple\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8CB085D19BA6ACA0018434A\"\n            BuildableName = \"Simple.app\"\n            BlueprintName = \"Simple\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8CB085D19BA6ACA0018434A\"\n            BuildableName = \"Simple.app\"\n            BlueprintName = \"Simple\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/ios/swift/RealmExamples.xcodeproj/xcshareddata/xcschemes/TableView.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5D660FCB1BE98C560021E04F\"\n               BuildableName = \"RealmSwift.framework\"\n               BlueprintName = \"RealmSwift\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E8CB083819BA6AC60018434A\"\n               BuildableName = \"TableView.app\"\n               BlueprintName = \"TableView\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <Testables>\n      </Testables>\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8CB083819BA6AC60018434A\"\n            BuildableName = \"TableView.app\"\n            BlueprintName = \"TableView\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8CB083819BA6AC60018434A\"\n            BuildableName = \"TableView.app\"\n            BlueprintName = \"TableView\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E8CB083819BA6AC60018434A\"\n            BuildableName = \"TableView.app\"\n            BlueprintName = \"TableView\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/ios/swift/RealmExamples.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"group:RealmExamples.xcodeproj\">\n   </FileRef>\n   <FileRef\n      location = \"group:../../../Realm.xcodeproj\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "examples/ios/swift/RealmExamples.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>IDEDidComputeMac32BitWarning</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/swift/RealmExamples.xcworkspace/xcshareddata/RealmExamples.xcscmblueprint",
    "content": "{\n  \"DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey\" : \"9FB1FDDBA011002795A1FF5BD3CABFA2F79E6A59\",\n  \"DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey\" : {\n\n  },\n  \"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey\" : {\n    \"9FB1FDDBA011002795A1FF5BD3CABFA2F79E6A59\" : 9223372036854775807,\n    \"8F3C415DA79CDA7D23734F285B95F9F9A3C0CB81\" : 9223372036854775807\n  },\n  \"DVTSourceControlWorkspaceBlueprintIdentifierKey\" : \"382D912A-B3A9-46DF-8DD9-1DF0D7888DE7\",\n  \"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey\" : {\n    \"9FB1FDDBA011002795A1FF5BD3CABFA2F79E6A59\" : \"realm-cocoa\\/\",\n    \"8F3C415DA79CDA7D23734F285B95F9F9A3C0CB81\" : \"realm-cocoa\\/Realm\\/ObjectStore\\/\"\n  },\n  \"DVTSourceControlWorkspaceBlueprintNameKey\" : \"RealmExamples\",\n  \"DVTSourceControlWorkspaceBlueprintVersion\" : 204,\n  \"DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey\" : \"examples\\/ios\\/swift-3.0\\/RealmExamples.xcworkspace\",\n  \"DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey\" : [\n    {\n      \"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey\" : \"github.com:realm\\/realm-object-store-private.git\",\n      \"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey\" : \"com.apple.dt.Xcode.sourcecontrol.Git\",\n      \"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey\" : \"8F3C415DA79CDA7D23734F285B95F9F9A3C0CB81\"\n    },\n    {\n      \"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey\" : \"github.com:realm\\/realm-cocoa.git\",\n      \"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey\" : \"com.apple.dt.Xcode.sourcecontrol.Git\",\n      \"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey\" : \"9FB1FDDBA011002795A1FF5BD3CABFA2F79E6A59\"\n    }\n  ]\n}"
  },
  {
    "path": "examples/ios/swift/RealmExamples.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/swift/Simple/AppDelegate.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport UIKit\nimport RealmSwift\n\nclass Dog: Object {\n    @Persisted var name: String\n    @Persisted var age: Int\n}\n\nclass Person: Object {\n    @Persisted var name: String\n    @Persisted var dogs: List<Dog>\n}\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n    var window: UIWindow?\n\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {\n        window = UIWindow(frame: UIScreen.main.bounds)\n        window?.rootViewController = UIViewController()\n        window?.makeKeyAndVisible()\n\n        _ = try! Realm.deleteFiles(for: Realm.Configuration.defaultConfiguration)\n\n        // Create a standalone object\n        let mydog = Dog()\n\n        // Set & read properties\n        mydog.name = \"Rex\"\n        mydog.age = 9\n        print(\"Name of dog: \\(mydog.name)\")\n\n        // Realms are used to group data together\n        let realm = try! Realm() // Create realm pointing to default file\n\n        // Save your object\n        realm.beginWrite()\n        realm.add(mydog)\n        try! realm.commitWrite()\n\n        // Query\n        let results = realm.objects(Dog.self).filter(\"name contains 'x'\")\n\n        // Queries are chainable!\n        let results2 = results.filter(\"age > 8\")\n        print(\"Number of dogs: \\(results.count)\")\n        print(\"Dogs older than eight: \\(results2.count)\")\n\n        // Link objects\n        let person = Person()\n        person.name = \"Tim\"\n        person.dogs.append(mydog)\n\n        try! realm.write {\n            realm.add(person)\n        }\n\n        // Multi-threading\n        DispatchQueue.global().async {\n            autoreleasepool {\n                let otherRealm = try! Realm()\n                let otherResults = otherRealm.objects(Dog.self).filter(\"name contains 'Rex'\")\n                print(\"Number of dogs \\(otherResults.count)\")\n            }\n        }\n\n        return true\n    }\n}\n"
  },
  {
    "path": "examples/ios/swift/Simple/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UIRequiresFullScreen</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/swift/TableView/AppDelegate.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport UIKit\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n\n    var window: UIWindow?\n\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {\n        window = UIWindow(frame: UIScreen.main.bounds)\n        window?.rootViewController = UINavigationController(rootViewController: TableViewController(style: .plain))\n        window?.makeKeyAndVisible()\n        return true\n    }\n}\n"
  },
  {
    "path": "examples/ios/swift/TableView/Images.xcassets/AppIcon.appiconset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"60x60\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"60x60\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"76x76\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"76x76\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"83.5x83.5\"\n    },\n    {\n      \"idiom\" : \"ios-marketing\",\n      \"scale\" : \"1x\",\n      \"size\" : \"1024x1024\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "examples/ios/swift/TableView/Images.xcassets/LaunchImage.launchimage/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"iphone\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"iphone\",\n      \"subtype\" : \"retina4\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"ipad\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"orientation\" : \"landscape\",\n      \"idiom\" : \"ipad\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"ipad\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"orientation\" : \"landscape\",\n      \"idiom\" : \"ipad\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"2x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/ios/swift/TableView/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UIRequiresFullScreen</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/ios/swift/TableView/TableViewController.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport UIKit\nimport RealmSwift\n\nclass DemoObject: Object {\n    @Persisted var title: String\n    @Persisted var date: Date\n}\n\nclass Cell: UITableViewCell {\n    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String!) {\n        super.init(style: .subtitle, reuseIdentifier: reuseIdentifier)\n    }\n\n    required init(coder: NSCoder) {\n        fatalError(\"NSCoding not supported\")\n    }\n}\n\nclass TableViewController: UITableViewController {\n    let realm = try! Realm()\n    let results = try! Realm().objects(DemoObject.self).sorted(byKeyPath: \"date\")\n    var notificationToken: NotificationToken?\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n\n        setupUI()\n\n        // Set results notification block\n        self.notificationToken = results.observe { (changes: RealmCollectionChange) in\n            switch changes {\n            case .initial:\n                // Results are now populated and can be accessed without blocking the UI\n                self.tableView.reloadData()\n            case .update(_, let deletions, let insertions, let modifications):\n                // Query results have changed, so apply them to the TableView\n                self.tableView.beginUpdates()\n                self.tableView.insertRows(at: insertions.map { IndexPath(row: $0, section: 0) }, with: .automatic)\n                self.tableView.deleteRows(at: deletions.map { IndexPath(row: $0, section: 0) }, with: .automatic)\n                self.tableView.reloadRows(at: modifications.map { IndexPath(row: $0, section: 0) }, with: .automatic)\n                self.tableView.endUpdates()\n            case .error(let err):\n                // An error occurred while opening the Realm file on the background worker thread\n                fatalError(\"\\(err)\")\n            }\n        }\n    }\n\n    // UI\n\n    func setupUI() {\n        tableView.register(Cell.self, forCellReuseIdentifier: \"cell\")\n\n        self.title = \"TableView\"\n        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: \"BG Add\", style: .plain,\n                                                                target: self, action: #selector(backgroundAdd))\n        self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .add,\n                                                                 target: self, action: #selector(add))\n    }\n\n    // Table view data source\n\n    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n        return results.count\n    }\n\n    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n        let cell = tableView.dequeueReusableCell(withIdentifier: \"cell\", for: indexPath) as! Cell\n\n        let object = results[indexPath.row]\n        cell.textLabel?.text = object.title\n        cell.detailTextLabel?.text = object.date.description\n\n        return cell\n    }\n\n    override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {\n        if editingStyle == .delete {\n            realm.beginWrite()\n            realm.delete(results[indexPath.row])\n            try! realm.commitWrite()\n        }\n    }\n\n    // Actions\n\n    @objc func backgroundAdd() {\n        // Import many items in a background thread\n        DispatchQueue.global().async {\n            // Get new realm and table since we are in a new thread\n            autoreleasepool {\n                let realm = try! Realm()\n                realm.beginWrite()\n                for _ in 0..<5 {\n                    // Add row via dictionary. Order is ignored.\n                    realm.create(DemoObject.self, value: [\"title\": TableViewController.randomString(), \"date\": TableViewController.randomDate()])\n                }\n                try! realm.commitWrite()\n            }\n        }\n    }\n\n    @objc func add() {\n        realm.beginWrite()\n        realm.create(DemoObject.self, value: [TableViewController.randomString(), TableViewController.randomDate()])\n        try! realm.commitWrite()\n    }\n\n    // Helpers\n\n    class func randomString() -> String {\n        return \"Title \\(Int.random(in: 0..<100))\"\n    }\n\n    class func randomDate() -> NSDate {\n        return NSDate(timeIntervalSince1970: TimeInterval.random(in: 0..<TimeInterval.greatestFiniteMagnitude))\n    }\n}\n"
  },
  {
    "path": "examples/osx/objc/JSONImport/Person.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/Realm.h>\n\n@interface Person : RLMObject\n// Add properties here to define the model\n@property NSString  *fullName;\n@property NSDate    *birthdate;\n@property NSInteger  numberOfFriends;\n@end\n\n// This protocol enables typed collections. i.e.:\n// RLMArray<Person>\nRLM_COLLECTION_TYPE(Person)\n"
  },
  {
    "path": "examples/osx/objc/JSONImport/Person.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"Person.h\"\n\n@implementation Person\n\n// Specify default values for properties\n\n//+ (NSDictionary *)defaultPropertyValues\n//{\n//    return @{};\n//}\n\n// Specify properties to ignore (Realm won't persist these)\n\n//+ (NSArray *)ignoredProperties\n//{\n//    return @[];\n//}\n\n- (NSString *)description {\n    return [NSString stringWithFormat:@\"%@ was born on %@ and had %ld friends\",\n            self.fullName,\n            self.birthdate,\n            (long)self.numberOfFriends];\n}\n\n@end\n"
  },
  {
    "path": "examples/osx/objc/JSONImport/main.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Foundation/Foundation.h>\n#import <Realm/Realm.h>\n#import \"Person.h\"\n\nint main(int argc, const char * argv[])\n{\n    @autoreleasepool {\n        // Import JSON\n        NSString *jsonFilePath = [[NSBundle mainBundle] pathForResource:@\"persons\" ofType:@\"json\"];\n        NSData *jsonData = [NSData dataWithContentsOfFile:jsonFilePath];\n        NSError *error = nil;\n        NSArray *personDicts = [NSJSONSerialization JSONObjectWithData:jsonData\n                                                               options:0\n                                                                 error:&error];\n        if (error) {\n            NSLog(@\"There was an error reading the JSON file: %@\", error.localizedDescription);\n            return 1;\n        }\n\n        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];\n        dateFormatter.locale = [NSLocale localeWithLocaleIdentifier:@\"en_US_POSIX\"];\n        dateFormatter.dateFormat = @\"MMMM dd, yyyy\";\n        dateFormatter.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0];\n\n        [[NSFileManager defaultManager] removeItemAtURL:[RLMRealmConfiguration defaultConfiguration].fileURL\n                                                   error:nil];\n\n        RLMRealm *realm = [RLMRealm defaultRealm];\n        [realm beginWriteTransaction];\n\n        // Add Person objects in realm for every person dictionary in JSON array\n        for (NSDictionary *personDict in personDicts) {\n            Person *person = [[Person alloc] init];\n            person.fullName = personDict[@\"name\"];\n            person.birthdate = [dateFormatter dateFromString:personDict[@\"birthdate\"]];\n            person.numberOfFriends = [(NSNumber *)personDict[@\"friendCount\"] integerValue];\n            [realm addObject:person];\n        }\n        [realm commitWriteTransaction];\n\n        // Print all persons from realm\n        for (Person *person in [Person allObjects]) {\n            NSLog(@\"person persisted to realm: %@\", person);\n        }\n\n        // Realm file saved at default path (~/Documents/default.realm)\n    }\n    return 0;\n}\n"
  },
  {
    "path": "examples/osx/objc/JSONImport/persons.json",
    "content": "[\n {\n    \"name\": \"John Coltrane\",\n    \"birthdate\": \"September 23, 1926\",\n    \"friendCount\": 123456\n },\n {\n    \"name\": \"Miles Davis\",\n    \"birthdate\": \"May 26, 1926\",\n    \"friendCount\": 234567\n },\n {\n    \"name\": \"Duke Ellington\",\n    \"birthdate\": \"April 29, 1899\",\n    \"friendCount\": 345678\n }\n]\n"
  },
  {
    "path": "examples/osx/objc/RealmExamples.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\tE823C33D19BA4A5F00D2FF5F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8F1E82019BA4A3800FAD64E /* Foundation.framework */; };\n\t\tE823C34D19BA4A7600D2FF5F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E823C34919BA4A7600D2FF5F /* main.m */; };\n\t\tE823C34E19BA4A7600D2FF5F /* Person.m in Sources */ = {isa = PBXBuildFile; fileRef = E823C34B19BA4A7600D2FF5F /* Person.m */; };\n\t\tE823C35119BA4B7500D2FF5F /* persons.json in CopyFiles */ = {isa = PBXBuildFile; fileRef = E823C34C19BA4A7600D2FF5F /* persons.json */; };\n\t\tE823C35319BA4B8600D2FF5F /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E823C35219BA4B8600D2FF5F /* libc++.dylib */; };\n\t\tE85A517119BA76B7006C63CB /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E85A517019BA76B7006C63CB /* Realm.framework */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXCopyFilesBuildPhase section */\n\t\tE823C33A19BA4A5F00D2FF5F /* CopyFiles */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 12;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 16;\n\t\t\tfiles = (\n\t\t\t\tE823C35119BA4B7500D2FF5F /* persons.json in CopyFiles */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXCopyFilesBuildPhase section */\n\n/* Begin PBXFileReference section */\n\t\t0ADF47111B1578CF00F67B16 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../../README.md; sourceTree = SOURCE_ROOT; };\n\t\tE823C33C19BA4A5F00D2FF5F /* JSONImport */ = {isa = PBXFileReference; explicitFileType = \"compiled.mach-o.executable\"; includeInIndex = 0; path = JSONImport; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE823C34919BA4A7600D2FF5F /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = \"<group>\"; };\n\t\tE823C34A19BA4A7600D2FF5F /* Person.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Person.h; sourceTree = \"<group>\"; };\n\t\tE823C34B19BA4A7600D2FF5F /* Person.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Person.m; sourceTree = \"<group>\"; };\n\t\tE823C34C19BA4A7600D2FF5F /* persons.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = persons.json; sourceTree = \"<group>\"; };\n\t\tE823C35219BA4B8600D2FF5F /* libc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = \"compiled.mach-o.dylib\"; name = \"libc++.dylib\"; path = \"usr/lib/libc++.dylib\"; sourceTree = SDKROOT; };\n\t\tE85A517019BA76B7006C63CB /* Realm.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Realm.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE8F1E82019BA4A3800FAD64E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\tE823C33919BA4A5F00D2FF5F /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE823C33D19BA4A5F00D2FF5F /* Foundation.framework in Frameworks */,\n\t\t\t\tE823C35319BA4B8600D2FF5F /* libc++.dylib in Frameworks */,\n\t\t\t\tE85A517119BA76B7006C63CB /* Realm.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\tE823C34819BA4A7600D2FF5F /* JSONImport */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE823C34919BA4A7600D2FF5F /* main.m */,\n\t\t\t\tE823C34A19BA4A7600D2FF5F /* Person.h */,\n\t\t\t\tE823C34B19BA4A7600D2FF5F /* Person.m */,\n\t\t\t\tE823C34C19BA4A7600D2FF5F /* persons.json */,\n\t\t\t);\n\t\t\tpath = JSONImport;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8F1E81419BA4A3800FAD64E = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE8F1E81F19BA4A3800FAD64E /* Frameworks */,\n\t\t\t\tE823C34819BA4A7600D2FF5F /* JSONImport */,\n\t\t\t\tE8F1E81E19BA4A3800FAD64E /* Products */,\n\t\t\t\t0ADF47111B1578CF00F67B16 /* README.md */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8F1E81E19BA4A3800FAD64E /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE823C33C19BA4A5F00D2FF5F /* JSONImport */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE8F1E81F19BA4A3800FAD64E /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE8F1E82019BA4A3800FAD64E /* Foundation.framework */,\n\t\t\t\tE823C35219BA4B8600D2FF5F /* libc++.dylib */,\n\t\t\t\tE85A517019BA76B7006C63CB /* Realm.framework */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXNativeTarget section */\n\t\tE823C33B19BA4A5F00D2FF5F /* JSONImport */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = E823C34719BA4A5F00D2FF5F /* Build configuration list for PBXNativeTarget \"JSONImport\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE823C33819BA4A5F00D2FF5F /* Sources */,\n\t\t\t\tE823C33919BA4A5F00D2FF5F /* Frameworks */,\n\t\t\t\tE823C33A19BA4A5F00D2FF5F /* CopyFiles */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = JSONImport;\n\t\t\tproductName = JSONImport;\n\t\t\tproductReference = E823C33C19BA4A5F00D2FF5F /* JSONImport */;\n\t\t\tproductType = \"com.apple.product-type.tool\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tE8F1E81519BA4A3800FAD64E /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastUpgradeCheck = 1430;\n\t\t\t\tORGANIZATIONNAME = Realm;\n\t\t\t};\n\t\t\tbuildConfigurationList = E8F1E81819BA4A3800FAD64E /* Build configuration list for PBXProject \"RealmExamples\" */;\n\t\t\tcompatibilityVersion = \"Xcode 3.2\";\n\t\t\tdevelopmentRegion = English;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tEnglish,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = E8F1E81419BA4A3800FAD64E;\n\t\t\tproductRefGroup = E8F1E81E19BA4A3800FAD64E /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\tE823C33B19BA4A5F00D2FF5F /* JSONImport */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\tE823C33819BA4A5F00D2FF5F /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE823C34D19BA4A7600D2FF5F /* main.m in Sources */,\n\t\t\t\tE823C34E19BA4A7600D2FF5F /* Person.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\tE823C34519BA4A5F00D2FF5F /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tOTHER_LDFLAGS = \"\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE823C34619BA4A5F00D2FF5F /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"\";\n\t\t\t\tOTHER_LDFLAGS = \"\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE8F1E82919BA4A3900FAD64E /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_ENABLE_OBJC_EXCEPTIONS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_SYMBOLS_PRIVATE_EXTERN = NO;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.13;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE8F1E82A19BA4A3900FAD64E /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = YES;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_ENABLE_OBJC_EXCEPTIONS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.13;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\tE823C34719BA4A5F00D2FF5F /* Build configuration list for PBXNativeTarget \"JSONImport\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE823C34519BA4A5F00D2FF5F /* Debug */,\n\t\t\t\tE823C34619BA4A5F00D2FF5F /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE8F1E81819BA4A3800FAD64E /* Build configuration list for PBXProject \"RealmExamples\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE8F1E82919BA4A3900FAD64E /* Debug */,\n\t\t\t\tE8F1E82A19BA4A3900FAD64E /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = E8F1E81519BA4A3800FAD64E /* Project object */;\n}\n"
  },
  {
    "path": "examples/osx/objc/RealmExamples.xcodeproj/xcshareddata/xcschemes/JSONImport.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\"\n            hideIssues = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5D659E7D1BE04556006515A0\"\n               BuildableName = \"Realm.framework\"\n               BlueprintName = \"Realm\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\"\n            hideIssues = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"E823C33B19BA4A5F00D2FF5F\"\n               BuildableName = \"JSONImport\"\n               BlueprintName = \"JSONImport\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <Testables>\n      </Testables>\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E823C33B19BA4A5F00D2FF5F\"\n            BuildableName = \"JSONImport\"\n            BlueprintName = \"JSONImport\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E823C33B19BA4A5F00D2FF5F\"\n            BuildableName = \"JSONImport\"\n            BlueprintName = \"JSONImport\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"E823C33B19BA4A5F00D2FF5F\"\n            BuildableName = \"JSONImport\"\n            BlueprintName = \"JSONImport\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/osx/objc/RealmExamples.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"group:RealmExamples.xcodeproj\">\n   </FileRef>\n   <FileRef\n      location = \"group:../../../Realm.xcodeproj\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "examples/osx/objc/RealmExamples.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>\n\t<false/>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/AppDelegate.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n@interface AppDelegate : UIResponder <UIApplicationDelegate>\n\n@property (strong, nonatomic) UIWindow *window;\n\n@end\n"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/AppDelegate.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"AppDelegate.h\"\n\n@interface AppDelegate ()\n\n@end\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json",
    "content": "{\n  \"layers\" : [\n    {\n      \"filename\" : \"Front.imagestacklayer\"\n    },\n    {\n      \"filename\" : \"Middle.imagestacklayer\"\n    },\n    {\n      \"filename\" : \"Back.imagestacklayer\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}\n"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json",
    "content": "{\n  \"layers\" : [\n    {\n      \"filename\" : \"Front.imagestacklayer\"\n    },\n    {\n      \"filename\" : \"Middle.imagestacklayer\"\n    },\n    {\n      \"filename\" : \"Back.imagestacklayer\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}\n"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json",
    "content": "{\n  \"assets\" : [\n    {\n      \"size\" : \"1280x768\",\n      \"idiom\" : \"tv\",\n      \"filename\" : \"App Icon - Large.imagestack\",\n      \"role\" : \"primary-app-icon\"\n    },\n    {\n      \"size\" : \"400x240\",\n      \"idiom\" : \"tv\",\n      \"filename\" : \"App Icon - Small.imagestack\",\n      \"role\" : \"primary-app-icon\"\n    },\n    {\n      \"size\" : \"1920x720\",\n      \"idiom\" : \"tv\",\n      \"filename\" : \"Top Shelf Image.imageset\",\n      \"role\" : \"top-shelf-image\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}\n"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Assets.xcassets/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Assets.xcassets/LaunchImage.launchimage/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"orientation\" : \"landscape\",\n      \"idiom\" : \"tv\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"9.0\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Base.lproj/Main.storyboard",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder.AppleTV.Storyboard\" version=\"3.0\" toolsVersion=\"9531\" systemVersion=\"15C50\" targetRuntime=\"AppleTV\" propertyAccessControl=\"none\" useAutolayout=\"YES\" initialViewController=\"o1f-Wg-HFv\">\n    <dependencies>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"9529\"/>\n    </dependencies>\n    <scenes>\n        <!--Repositories View Controller-->\n        <scene sceneID=\"TGC-cV-31p\">\n            <objects>\n                <collectionViewController id=\"5G5-gs-SCO\" customClass=\"RepositoriesViewController\" sceneMemberID=\"viewController\">\n                    <collectionView key=\"view\" clipsSubviews=\"YES\" multipleTouchEnabled=\"YES\" contentMode=\"scaleToFill\" dataMode=\"prototypes\" id=\"xAL-5D-kDM\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"1920\" height=\"1080\"/>\n                        <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n                        <collectionViewFlowLayout key=\"collectionViewLayout\" minimumLineSpacing=\"48\" minimumInteritemSpacing=\"48\" id=\"nI6-1G-lNM\">\n                            <size key=\"itemSize\" width=\"548\" height=\"440\"/>\n                            <size key=\"headerReferenceSize\" width=\"0.0\" height=\"0.0\"/>\n                            <size key=\"footerReferenceSize\" width=\"0.0\" height=\"0.0\"/>\n                            <inset key=\"sectionInset\" minX=\"90\" minY=\"70\" maxX=\"90\" maxY=\"70\"/>\n                        </collectionViewFlowLayout>\n                        <cells>\n                            <collectionViewCell opaque=\"NO\" multipleTouchEnabled=\"YES\" contentMode=\"center\" reuseIdentifier=\"Cell\" id=\"krh-8w-jF8\" customClass=\"RepositoryCell\">\n                                <rect key=\"frame\" x=\"90\" y=\"215\" width=\"548\" height=\"440\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <view key=\"contentView\" opaque=\"NO\" clipsSubviews=\"YES\" multipleTouchEnabled=\"YES\" contentMode=\"center\">\n                                    <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"548\" height=\"440\"/>\n                                    <autoresizingMask key=\"autoresizingMask\"/>\n                                    <subviews>\n                                        <imageView userInteractionEnabled=\"NO\" contentMode=\"scaleAspectFill\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" adjustsImageWhenAncestorFocused=\"YES\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"qi7-WI-nKv\">\n                                            <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"548\" height=\"300\"/>\n                                            <constraints>\n                                                <constraint firstAttribute=\"height\" constant=\"300\" id=\"mWR-hT-RDW\"/>\n                                            </constraints>\n                                        </imageView>\n                                        <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"Label\" textAlignment=\"natural\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"dzB-jG-rgK\">\n                                            <rect key=\"frame\" x=\"204\" y=\"336\" width=\"140\" height=\"69\"/>\n                                            <fontDescription key=\"fontDescription\" style=\"UICTFontTextStyleTitle2\"/>\n                                            <color key=\"textColor\" red=\"0.0\" green=\"0.0\" blue=\"0.0\" alpha=\"1\" colorSpace=\"calibratedRGB\"/>\n                                            <nil key=\"highlightedColor\"/>\n                                        </label>\n                                    </subviews>\n                                    <color key=\"backgroundColor\" white=\"0.0\" alpha=\"0.0\" colorSpace=\"calibratedWhite\"/>\n                                </view>\n                                <constraints>\n                                    <constraint firstItem=\"dzB-jG-rgK\" firstAttribute=\"leading\" relation=\"greaterThanOrEqual\" secondItem=\"krh-8w-jF8\" secondAttribute=\"leading\" constant=\"36\" id=\"FZ9-DG-FdA\"/>\n                                    <constraint firstAttribute=\"trailing\" secondItem=\"qi7-WI-nKv\" secondAttribute=\"trailing\" id=\"HOQ-kv-ybq\"/>\n                                    <constraint firstItem=\"dzB-jG-rgK\" firstAttribute=\"centerX\" secondItem=\"krh-8w-jF8\" secondAttribute=\"centerX\" id=\"KIf-TT-fLt\"/>\n                                    <constraint firstItem=\"qi7-WI-nKv\" firstAttribute=\"leading\" secondItem=\"krh-8w-jF8\" secondAttribute=\"leading\" id=\"OCc-gq-8Gn\"/>\n                                    <constraint firstItem=\"qi7-WI-nKv\" firstAttribute=\"top\" secondItem=\"krh-8w-jF8\" secondAttribute=\"top\" id=\"Rmm-08-FHu\"/>\n                                    <constraint firstAttribute=\"trailing\" relation=\"greaterThanOrEqual\" secondItem=\"dzB-jG-rgK\" secondAttribute=\"trailing\" constant=\"36\" id=\"e9Q-6V-03h\"/>\n                                    <constraint firstItem=\"dzB-jG-rgK\" firstAttribute=\"top\" secondItem=\"qi7-WI-nKv\" secondAttribute=\"bottom\" constant=\"36\" id=\"qK8-LG-RcM\"/>\n                                </constraints>\n                                <connections>\n                                    <outlet property=\"avatarImageView\" destination=\"qi7-WI-nKv\" id=\"mpV-Bq-qu2\"/>\n                                    <outlet property=\"titleLabel\" destination=\"dzB-jG-rgK\" id=\"Iel-x7-kyK\"/>\n                                </connections>\n                            </collectionViewCell>\n                        </cells>\n                        <connections>\n                            <outlet property=\"dataSource\" destination=\"5G5-gs-SCO\" id=\"VsH-Lc-b47\"/>\n                            <outlet property=\"delegate\" destination=\"5G5-gs-SCO\" id=\"dWQ-XB-uEE\"/>\n                        </connections>\n                    </collectionView>\n                    <navigationItem key=\"navigationItem\" id=\"1gY-Mf-jMD\">\n                        <nil key=\"title\"/>\n                        <segmentedControl key=\"titleView\" opaque=\"NO\" contentMode=\"scaleToFill\" contentHorizontalAlignment=\"left\" contentVerticalAlignment=\"top\" segmentControlStyle=\"bar\" selectedSegmentIndex=\"0\" id=\"8c7-I4-3u4\">\n                            <rect key=\"frame\" x=\"576\" y=\"63\" width=\"768\" height=\"70\"/>\n                            <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                            <color key=\"backgroundColor\" white=\"0.0\" alpha=\"0.10000000000000001\" colorSpace=\"calibratedWhite\"/>\n                            <segments>\n                                <segment title=\"A to Z\"/>\n                                <segment title=\"Z to A\"/>\n                            </segments>\n                            <connections>\n                                <action selector=\"valueChanged:\" destination=\"5G5-gs-SCO\" eventType=\"valueChanged\" id=\"n5o-gg-hiR\"/>\n                            </connections>\n                        </segmentedControl>\n                        <barButtonItem key=\"rightBarButtonItem\" id=\"Qy0-CQ-Bcc\">\n                            <view key=\"customView\" contentMode=\"scaleToFill\" id=\"7M6-s6-dqI\">\n                                <rect key=\"frame\" x=\"1494\" y=\"44\" width=\"426\" height=\"108\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <subviews>\n                                    <textField opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"left\" contentVerticalAlignment=\"center\" borderStyle=\"roundedRect\" textAlignment=\"natural\" minimumFontSize=\"17\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"DaN-Wc-5wV\">\n                                        <rect key=\"frame\" x=\"8\" y=\"31\" width=\"252\" height=\"46\"/>\n                                        <fontDescription key=\"fontDescription\" style=\"UICTFontTextStyleHeadline\"/>\n                                        <textInputTraits key=\"textInputTraits\"/>\n                                        <connections>\n                                            <outlet property=\"delegate\" destination=\"5G5-gs-SCO\" id=\"sdu-5J-kCk\"/>\n                                        </connections>\n                                    </textField>\n                                    <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"8S0-jl-iBv\">\n                                        <rect key=\"frame\" x=\"268\" y=\"31\" width=\"149\" height=\"46\"/>\n                                        <fontDescription key=\"fontDescription\" style=\"UICTFontTextStyleBody\"/>\n                                        <inset key=\"contentEdgeInsets\" minX=\"40\" minY=\"20\" maxX=\"40\" maxY=\"20\"/>\n                                        <state key=\"normal\" title=\"Clear\"/>\n                                        <connections>\n                                            <action selector=\"clearSearchField:\" destination=\"5G5-gs-SCO\" eventType=\"primaryActionTriggered\" id=\"U22-23-qQ4\"/>\n                                        </connections>\n                                    </button>\n                                </subviews>\n                                <color key=\"backgroundColor\" white=\"0.0\" alpha=\"0.0\" colorSpace=\"calibratedWhite\"/>\n                            </view>\n                        </barButtonItem>\n                    </navigationItem>\n                    <connections>\n                        <outlet property=\"searchField\" destination=\"DaN-Wc-5wV\" id=\"ySj-9o-Hbm\"/>\n                        <outlet property=\"sortOrderControl\" destination=\"8c7-I4-3u4\" id=\"maF-iT-E50\"/>\n                    </connections>\n                </collectionViewController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"LDu-Zu-7R4\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"5251\" y=\"91\"/>\n        </scene>\n        <!--Navigation Controller-->\n        <scene sceneID=\"hQj-QX-YtZ\">\n            <objects>\n                <navigationController automaticallyAdjustsScrollViewInsets=\"NO\" id=\"o1f-Wg-HFv\" sceneMemberID=\"viewController\">\n                    <toolbarItems/>\n                    <navigationBar key=\"navigationBar\" contentMode=\"scaleToFill\" id=\"pms-Dz-pYm\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"1920\" height=\"145\"/>\n                        <autoresizingMask key=\"autoresizingMask\"/>\n                    </navigationBar>\n                    <nil name=\"viewControllers\"/>\n                    <connections>\n                        <segue destination=\"5G5-gs-SCO\" kind=\"relationship\" relationship=\"rootViewController\" id=\"3rn-N0-VNi\"/>\n                    </connections>\n                </navigationController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"xk8-a3-h4d\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"3119\" y=\"91\"/>\n        </scene>\n    </scenes>\n</document>\n"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UIMainStoryboardFile</key>\n\t<string>Main</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>arm64</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/RepositoriesViewController.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n@interface RepositoriesViewController : UICollectionViewController\n\n@end\n"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/RepositoriesViewController.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RepositoriesViewController.h\"\n#import \"RepositoryCell.h\"\n#import \"Repository.h\"\n\n@interface RepositoriesViewController () <UITextFieldDelegate>\n\n@property (nonatomic, weak) IBOutlet UISegmentedControl *sortOrderControl;\n@property (nonatomic, weak) IBOutlet UITextField *searchField;\n\n@property (nonatomic) RLMResults *results;\n@property (nonatomic) RLMNotificationToken *token;\n\n@end\n\n@implementation RepositoriesViewController\n\n- (void)dealloc {\n    [self.token invalidate];\n}\n\n- (void)viewDidLoad {\n    [super viewDidLoad];\n\n    __weak typeof(self) weakSelf = self;\n    self.token = [[RLMRealm defaultRealm] addNotificationBlock:^(NSString * _Nonnull notification, RLMRealm * _Nonnull realm) {\n        [weakSelf reloadData];\n    }];\n\n    NSURLComponents *components = [NSURLComponents componentsWithString:@\"https://api.github.com/search/repositories\"];\n    components.queryItems = @[[NSURLQueryItem queryItemWithName:@\"q\" value:@\"language:objc\"],\n                              [NSURLQueryItem queryItemWithName:@\"sort\" value:@\"stars\"],\n                              [NSURLQueryItem queryItemWithName:@\"order\" value:@\"desc\"]];\n    [[[NSURLSession sharedSession] dataTaskWithURL:components.URL completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {\n        if (!error) {\n            NSError *jsonError = nil;\n            NSDictionary *repositories = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&jsonError];\n            if (!jsonError) {\n                NSArray *items = repositories[@\"items\"];\n\n                RLMRealm *realm = [RLMRealm defaultRealm];\n                [realm transactionWithBlock:^{\n                    for (NSDictionary *item in items) {\n                        Repository *repository = [Repository new];\n                        repository.identifier = [NSString stringWithFormat:@\"%@\", item[@\"id\"]];\n                        repository.name = item[@\"name\"];\n                        repository.avatarURL = item[@\"owner\"][@\"avatar_url\"];\n\n                        [realm addOrUpdateObject:repository];\n                    }\n                }];\n            } else {\n                NSLog(@\"%@\", jsonError);\n            }\n        } else {\n            NSLog(@\"%@\", error);\n        }\n    }] resume];\n}\n\n- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {\n    return self.results.count;\n}\n\n- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {\n    RepositoryCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@\"Cell\" forIndexPath:indexPath];\n\n    Repository *repository = self.results[indexPath.item];\n\n    cell.titleLabel.text = repository.name;\n\n    [[[NSURLSession sharedSession] dataTaskWithURL:[NSURL URLWithString:repository.avatarURL] completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {\n        if (!error) {\n            dispatch_async(dispatch_get_main_queue(), ^{\n                UIImage *image = [UIImage imageWithData:data];\n                cell.avatarImageView.image = image;\n            });\n        } else {\n            NSLog(@\"%@\", error);\n        }\n    }] resume];\n\n    return cell;\n}\n\n- (void)reloadData {\n    self.results = [Repository allObjects];\n    if (self.searchField.text.length > 0) {\n        self.results = [self.results objectsWhere:@\"name contains[c] %@\", self.searchField.text];\n    }\n    self.results = [self.results sortedResultsUsingKeyPath:@\"name\" ascending:self.sortOrderControl.selectedSegmentIndex == 0];\n\n    [self.collectionView reloadData];\n}\n\n- (IBAction)valueChanged:(id)sender {\n    [self reloadData];\n}\n\n- (IBAction)clearSearchField:(id)sender {\n    self.searchField.text = nil;\n    [self reloadData];\n}\n\n- (void)textFieldDidEndEditing:(UITextField *)textField {\n    [self reloadData];\n}\n\n@end\n"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Repository.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/Realm.h>\n\n@interface Repository : RLMObject\n\n@property NSString *identifier;\n@property NSString *name;\n@property NSString *avatarURL;\n\n@end\n"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/Repository.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"Repository.h\"\n\n@implementation Repository\n\n+ (NSString *)primaryKey {\n    return @\"identifier\";\n}\n\n+ (NSArray<NSString *> *)requiredProperties {\n    return @[@\"identifier\"];\n}\n\n@end\n"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/RepositoryCell.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n@interface RepositoryCell : UICollectionViewCell\n\n@property (nonatomic, weak) IBOutlet UIImageView *avatarImageView;\n@property (nonatomic, weak) IBOutlet UILabel *titleLabel;\n\n@end\n"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/RepositoryCell.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RepositoryCell.h\"\n\n@implementation RepositoryCell\n\n- (void)prepareForReuse {\n    self.avatarImageView.image = nil;\n    self.titleLabel.text = nil;\n}\n\n@end\n"
  },
  {
    "path": "examples/tvos/objc/DownloadCache/main.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n#import \"AppDelegate.h\"\n\nint main(int argc, char * argv[]) {\n    @autoreleasepool {\n        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));\n    }\n}\n"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/AppDelegate.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n@interface AppDelegate : UIResponder <UIApplicationDelegate>\n\n@property (strong, nonatomic) UIWindow *window;\n\n@end\n"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/AppDelegate.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"AppDelegate.h\"\n\n@interface AppDelegate ()\n\n@end\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json",
    "content": "{\n  \"layers\" : [\n    {\n      \"filename\" : \"Front.imagestacklayer\"\n    },\n    {\n      \"filename\" : \"Middle.imagestacklayer\"\n    },\n    {\n      \"filename\" : \"Back.imagestacklayer\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}\n"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json",
    "content": "{\n  \"layers\" : [\n    {\n      \"filename\" : \"Front.imagestacklayer\"\n    },\n    {\n      \"filename\" : \"Middle.imagestacklayer\"\n    },\n    {\n      \"filename\" : \"Back.imagestacklayer\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}\n"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json",
    "content": "{\n  \"assets\" : [\n    {\n      \"size\" : \"1280x768\",\n      \"idiom\" : \"tv\",\n      \"filename\" : \"App Icon - Large.imagestack\",\n      \"role\" : \"primary-app-icon\"\n    },\n    {\n      \"size\" : \"400x240\",\n      \"idiom\" : \"tv\",\n      \"filename\" : \"App Icon - Small.imagestack\",\n      \"role\" : \"primary-app-icon\"\n    },\n    {\n      \"size\" : \"1920x720\",\n      \"idiom\" : \"tv\",\n      \"filename\" : \"Top Shelf Image.imageset\",\n      \"role\" : \"top-shelf-image\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}\n"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Assets.xcassets/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Assets.xcassets/LaunchImage.launchimage/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"orientation\" : \"landscape\",\n      \"idiom\" : \"tv\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"9.0\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Base.lproj/Main.storyboard",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder.AppleTV.Storyboard\" version=\"3.0\" toolsVersion=\"9531\" systemVersion=\"15B42\" targetRuntime=\"AppleTV\" propertyAccessControl=\"none\" useAutolayout=\"YES\" initialViewController=\"ONA-Vj-POp\">\n    <dependencies>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"9529\"/>\n    </dependencies>\n    <scenes>\n        <!--Navigation Controller-->\n        <scene sceneID=\"8YU-nd-Drz\">\n            <objects>\n                <navigationController automaticallyAdjustsScrollViewInsets=\"NO\" id=\"ONA-Vj-POp\" sceneMemberID=\"viewController\">\n                    <toolbarItems/>\n                    <navigationBar key=\"navigationBar\" contentMode=\"scaleToFill\" id=\"3Yf-us-Raj\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"1920\" height=\"145\"/>\n                        <autoresizingMask key=\"autoresizingMask\"/>\n                    </navigationBar>\n                    <nil name=\"viewControllers\"/>\n                    <connections>\n                        <segue destination=\"hDB-FS-HlB\" kind=\"relationship\" relationship=\"rootViewController\" id=\"2VN-2R-iQO\"/>\n                    </connections>\n                </navigationController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"w4A-Eb-Ytb\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"-418\" y=\"-466\"/>\n        </scene>\n        <!--Places View Controller-->\n        <scene sceneID=\"3SX-w1-fes\">\n            <objects>\n                <tableViewController id=\"hDB-FS-HlB\" customClass=\"PlacesViewController\" sceneMemberID=\"viewController\">\n                    <tableView key=\"view\" clipsSubviews=\"YES\" contentMode=\"scaleToFill\" alwaysBounceVertical=\"YES\" dataMode=\"prototypes\" style=\"plain\" separatorStyle=\"default\" rowHeight=\"100\" sectionHeaderHeight=\"40\" sectionFooterHeight=\"40\" id=\"IUD-zz-MfF\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"1920\" height=\"1080\"/>\n                        <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n                        <prototypes>\n                            <tableViewCell contentMode=\"scaleToFill\" selectionStyle=\"default\" indentationLevel=\"10\" indentationWidth=\"10\" reuseIdentifier=\"Cell\" textLabel=\"OHe-sv-gf9\" detailTextLabel=\"tyF-zv-jgh\" style=\"IBUITableViewCellStyleSubtitle\" id=\"hQK-VE-s8n\">\n                                <rect key=\"frame\" x=\"0.0\" y=\"199\" width=\"1880\" height=\"100\"/>\n                                <autoresizingMask key=\"autoresizingMask\"/>\n                                <tableViewCellContentView key=\"contentView\" opaque=\"NO\" clipsSubviews=\"YES\" multipleTouchEnabled=\"YES\" contentMode=\"center\" tableViewCell=\"hQK-VE-s8n\" id=\"ZXR-Ia-tte\">\n                                    <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"1904\" height=\"100\"/>\n                                    <autoresizingMask key=\"autoresizingMask\"/>\n                                    <subviews>\n                                        <label opaque=\"NO\" multipleTouchEnabled=\"YES\" contentMode=\"left\" text=\"Title\" textAlignment=\"natural\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" id=\"OHe-sv-gf9\">\n                                            <rect key=\"frame\" x=\"120\" y=\"4\" width=\"72\" height=\"46\"/>\n                                            <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                            <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"38\"/>\n                                            <color key=\"textColor\" red=\"0.0\" green=\"0.0\" blue=\"0.0\" alpha=\"1\" colorSpace=\"calibratedRGB\"/>\n                                            <nil key=\"highlightedColor\"/>\n                                        </label>\n                                        <label opaque=\"NO\" multipleTouchEnabled=\"YES\" contentMode=\"left\" text=\"Detail\" textAlignment=\"natural\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" id=\"tyF-zv-jgh\">\n                                            <rect key=\"frame\" x=\"120\" y=\"50\" width=\"96\" height=\"46\"/>\n                                            <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                            <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"38\"/>\n                                            <color key=\"textColor\" red=\"0.0\" green=\"0.0\" blue=\"0.0\" alpha=\"0.40000000000000002\" colorSpace=\"calibratedRGB\"/>\n                                            <nil key=\"highlightedColor\"/>\n                                        </label>\n                                    </subviews>\n                                </tableViewCellContentView>\n                            </tableViewCell>\n                        </prototypes>\n                        <connections>\n                            <outlet property=\"dataSource\" destination=\"hDB-FS-HlB\" id=\"13v-QP-1Gl\"/>\n                            <outlet property=\"delegate\" destination=\"hDB-FS-HlB\" id=\"yxi-JL-K3Y\"/>\n                        </connections>\n                    </tableView>\n                    <navigationItem key=\"navigationItem\" id=\"6n1-wG-246\">\n                        <nil key=\"title\"/>\n                        <textField key=\"titleView\" opaque=\"NO\" contentMode=\"scaleToFill\" contentHorizontalAlignment=\"left\" contentVerticalAlignment=\"center\" borderStyle=\"roundedRect\" placeholder=\"Search by Postal Code\" textAlignment=\"natural\" minimumFontSize=\"17\" clearButtonMode=\"whileEditing\" id=\"sF7-Gz-fdi\">\n                            <rect key=\"frame\" x=\"576\" y=\"75\" width=\"768\" height=\"46\"/>\n                            <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                            <fontDescription key=\"fontDescription\" style=\"UICTFontTextStyleHeadline\"/>\n                            <textInputTraits key=\"textInputTraits\" keyboardType=\"numberPad\"/>\n                            <connections>\n                                <outlet property=\"delegate\" destination=\"hDB-FS-HlB\" id=\"3V9-UV-hbH\"/>\n                            </connections>\n                        </textField>\n                    </navigationItem>\n                    <connections>\n                        <outlet property=\"searchField\" destination=\"sF7-Gz-fdi\" id=\"Zfn-o1-Ghl\"/>\n                    </connections>\n                </tableViewController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"3VU-mS-6UN\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"1922\" y=\"-466\"/>\n        </scene>\n    </scenes>\n</document>\n"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UIMainStoryboardFile</key>\n\t<string>Main</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>arm64</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Place.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Realm/Realm.h>\n\n@interface Place : RLMObject\n\n@property NSString *postalCode;\n@property NSString *placeName;\n@property NSString *state;\n@property NSString *stateAbbreviation;\n@property NSString *county;\n@property double latitude;\n@property double longitude;\n\n@end\n"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/Place.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"Place.h\"\n\n@implementation Place\n\n@end\n"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/PlacesViewController.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n\n@interface PlacesViewController : UITableViewController\n\n@end\n"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/PlacesViewController.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"PlacesViewController.h\"\n#import \"Place.h\"\n\n@interface PlacesViewController () <UITextFieldDelegate>\n\n@property (nonatomic, weak) IBOutlet UITextField *searchField;\n@property (nonatomic) RLMResults *results;\n\n@end\n\n@implementation PlacesViewController\n\n- (void)viewDidLoad {\n    [super viewDidLoad];\n\n    RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];\n    config.readOnly = YES;\n    config.fileURL = [[NSBundle mainBundle] URLForResource:@\"Places\" withExtension:@\"realm\"];\n    [RLMRealmConfiguration setDefaultConfiguration:config];\n\n    [self reloadData];\n}\n\n- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {\n    return self.results.count;\n}\n\n- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\n    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@\"Cell\" forIndexPath:indexPath];\n\n    Place *place = self.results[indexPath.row];\n\n    cell.textLabel.text = place.postalCode;\n    if (place.county) {\n        cell.detailTextLabel.text = [NSString stringWithFormat:@\"%@, %@, %@\", place.placeName, place.state, place.county];\n    } else {\n        cell.detailTextLabel.text = [NSString stringWithFormat:@\"%@, %@\", place.placeName, place.state];\n    }\n\n    return cell;\n}\n\n- (void)reloadData {\n    self.results = [Place allObjects];\n    if (self.searchField.text.length > 0) {\n        self.results = [self.results objectsWhere:@\"postalCode beginswith %@\", self.searchField.text];\n    }\n    self.results = [self.results sortedResultsUsingKeyPath:@\"postalCode\" ascending:YES];\n\n    [self.tableView reloadData];\n}\n\n- (void)textFieldDidEndEditing:(UITextField *)textField {\n    [self reloadData];\n}\n\n@end\n"
  },
  {
    "path": "examples/tvos/objc/PreloadedData/main.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <UIKit/UIKit.h>\n#import \"AppDelegate.h\"\n\nint main(int argc, char * argv[]) {\n    @autoreleasepool {\n        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));\n    }\n}\n"
  },
  {
    "path": "examples/tvos/objc/RealmExamples.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t1403AF6F1BFDC8D300C1FBB4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1403AF6E1BFDC8D300C1FBB4 /* main.m */; };\n\t\t1403AF721BFDC8D300C1FBB4 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1403AF711BFDC8D300C1FBB4 /* AppDelegate.m */; };\n\t\t1403AF751BFDC8D300C1FBB4 /* RepositoriesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1403AF741BFDC8D300C1FBB4 /* RepositoriesViewController.m */; };\n\t\t1403AF781BFDC8D300C1FBB4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1403AF761BFDC8D300C1FBB4 /* Main.storyboard */; };\n\t\t1403AF7A1BFDC8D300C1FBB4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1403AF791BFDC8D300C1FBB4 /* Assets.xcassets */; };\n\t\t1403AF831BFDCA8200C1FBB4 /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1403AF811BFDCA8200C1FBB4 /* Realm.framework */; };\n\t\t1403AF841BFDCA8200C1FBB4 /* Realm.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 1403AF811BFDCA8200C1FBB4 /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t1403AF8E1BFDDDCF00C1FBB4 /* Repository.m in Sources */ = {isa = PBXBuildFile; fileRef = 1403AF8D1BFDDDCE00C1FBB4 /* Repository.m */; };\n\t\t1403AF911BFDDE0B00C1FBB4 /* RepositoryCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1403AF901BFDDE0B00C1FBB4 /* RepositoryCell.m */; };\n\t\t14835DF51BFE5AAB00B9A267 /* Places.realm in Resources */ = {isa = PBXBuildFile; fileRef = 14835DF41BFE5AAB00B9A267 /* Places.realm */; };\n\t\t14835DF81BFE5D4100B9A267 /* Place.m in Sources */ = {isa = PBXBuildFile; fileRef = 14835DF71BFE5D4100B9A267 /* Place.m */; };\n\t\t1493911B1BFE50940036B420 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1493911A1BFE50940036B420 /* main.m */; };\n\t\t1493911E1BFE50940036B420 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1493911D1BFE50940036B420 /* AppDelegate.m */; };\n\t\t149391211BFE50940036B420 /* PlacesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 149391201BFE50940036B420 /* PlacesViewController.m */; };\n\t\t149391241BFE50940036B420 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 149391221BFE50940036B420 /* Main.storyboard */; };\n\t\t149391261BFE50940036B420 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 149391251BFE50940036B420 /* Assets.xcassets */; };\n\t\t1493912B1BFE52880036B420 /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1403AF811BFDCA8200C1FBB4 /* Realm.framework */; };\n\t\t1493912C1BFE52880036B420 /* Realm.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 1403AF811BFDCA8200C1FBB4 /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n/* End PBXBuildFile section */\n\n/* Begin PBXCopyFilesBuildPhase section */\n\t\t1403AF871BFDCA8200C1FBB4 /* Embed Frameworks */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\t1403AF841BFDCA8200C1FBB4 /* Realm.framework in Embed Frameworks */,\n\t\t\t);\n\t\t\tname = \"Embed Frameworks\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t1493912F1BFE52880036B420 /* Embed Frameworks */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\t1493912C1BFE52880036B420 /* Realm.framework in Embed Frameworks */,\n\t\t\t);\n\t\t\tname = \"Embed Frameworks\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXCopyFilesBuildPhase section */\n\n/* Begin PBXFileReference section */\n\t\t1403AF6B1BFDC8D300C1FBB4 /* DownloadCache.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DownloadCache.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t1403AF6E1BFDC8D300C1FBB4 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = \"<group>\"; };\n\t\t1403AF701BFDC8D300C1FBB4 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = \"<group>\"; };\n\t\t1403AF711BFDC8D300C1FBB4 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = \"<group>\"; };\n\t\t1403AF731BFDC8D300C1FBB4 /* RepositoriesViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RepositoriesViewController.h; sourceTree = \"<group>\"; };\n\t\t1403AF741BFDC8D300C1FBB4 /* RepositoriesViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RepositoriesViewController.m; sourceTree = \"<group>\"; };\n\t\t1403AF771BFDC8D300C1FBB4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = \"<group>\"; };\n\t\t1403AF791BFDC8D300C1FBB4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \"<group>\"; };\n\t\t1403AF7B1BFDC8D300C1FBB4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\t1403AF811BFDCA8200C1FBB4 /* Realm.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Realm.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t1403AF8C1BFDDDCE00C1FBB4 /* Repository.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Repository.h; sourceTree = \"<group>\"; };\n\t\t1403AF8D1BFDDDCE00C1FBB4 /* Repository.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Repository.m; sourceTree = \"<group>\"; };\n\t\t1403AF8F1BFDDE0B00C1FBB4 /* RepositoryCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RepositoryCell.h; sourceTree = \"<group>\"; };\n\t\t1403AF901BFDDE0B00C1FBB4 /* RepositoryCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RepositoryCell.m; sourceTree = \"<group>\"; };\n\t\t14835DF41BFE5AAB00B9A267 /* Places.realm */ = {isa = PBXFileReference; lastKnownFileType = file; name = Places.realm; path = \"Seed Data/Places.realm\"; sourceTree = \"<group>\"; };\n\t\t14835DF61BFE5D4100B9A267 /* Place.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Place.h; sourceTree = \"<group>\"; };\n\t\t14835DF71BFE5D4100B9A267 /* Place.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Place.m; sourceTree = \"<group>\"; };\n\t\t149391171BFE50930036B420 /* PreloadedData.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PreloadedData.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t1493911A1BFE50940036B420 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = \"<group>\"; };\n\t\t1493911C1BFE50940036B420 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = \"<group>\"; };\n\t\t1493911D1BFE50940036B420 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = \"<group>\"; };\n\t\t1493911F1BFE50940036B420 /* PlacesViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlacesViewController.h; sourceTree = \"<group>\"; };\n\t\t149391201BFE50940036B420 /* PlacesViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PlacesViewController.m; sourceTree = \"<group>\"; };\n\t\t149391231BFE50940036B420 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = \"<group>\"; };\n\t\t149391251BFE50940036B420 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \"<group>\"; };\n\t\t149391271BFE50940036B420 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t1403AF681BFDC8D300C1FBB4 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t1403AF831BFDCA8200C1FBB4 /* Realm.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t149391141BFE50930036B420 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t1493912B1BFE52880036B420 /* Realm.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t1403AF3F1BFDC60A00C1FBB4 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t1403AF6C1BFDC8D300C1FBB4 /* DownloadCache */,\n\t\t\t\t149391181BFE50930036B420 /* PreloadedData */,\n\t\t\t\t1403AF491BFDC60A00C1FBB4 /* Products */,\n\t\t\t\t1403AF881BFDCAC800C1FBB4 /* Realm */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t1403AF491BFDC60A00C1FBB4 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t1403AF6B1BFDC8D300C1FBB4 /* DownloadCache.app */,\n\t\t\t\t149391171BFE50930036B420 /* PreloadedData.app */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t1403AF6C1BFDC8D300C1FBB4 /* DownloadCache */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t1403AF6D1BFDC8D300C1FBB4 /* Supporting Files */,\n\t\t\t\t1403AF701BFDC8D300C1FBB4 /* AppDelegate.h */,\n\t\t\t\t1403AF711BFDC8D300C1FBB4 /* AppDelegate.m */,\n\t\t\t\t1403AF791BFDC8D300C1FBB4 /* Assets.xcassets */,\n\t\t\t\t1403AF7B1BFDC8D300C1FBB4 /* Info.plist */,\n\t\t\t\t1403AF761BFDC8D300C1FBB4 /* Main.storyboard */,\n\t\t\t\t1403AF731BFDC8D300C1FBB4 /* RepositoriesViewController.h */,\n\t\t\t\t1403AF741BFDC8D300C1FBB4 /* RepositoriesViewController.m */,\n\t\t\t\t1403AF8C1BFDDDCE00C1FBB4 /* Repository.h */,\n\t\t\t\t1403AF8D1BFDDDCE00C1FBB4 /* Repository.m */,\n\t\t\t\t1403AF8F1BFDDE0B00C1FBB4 /* RepositoryCell.h */,\n\t\t\t\t1403AF901BFDDE0B00C1FBB4 /* RepositoryCell.m */,\n\t\t\t);\n\t\t\tpath = DownloadCache;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t1403AF6D1BFDC8D300C1FBB4 /* Supporting Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t1403AF6E1BFDC8D300C1FBB4 /* main.m */,\n\t\t\t);\n\t\t\tname = \"Supporting Files\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t1403AF881BFDCAC800C1FBB4 /* Realm */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t1403AF811BFDCA8200C1FBB4 /* Realm.framework */,\n\t\t\t);\n\t\t\tname = Realm;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t14835DF11BFE582C00B9A267 /* Seed Data */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t14835DF41BFE5AAB00B9A267 /* Places.realm */,\n\t\t\t);\n\t\t\tname = \"Seed Data\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t149391181BFE50930036B420 /* PreloadedData */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t14835DF11BFE582C00B9A267 /* Seed Data */,\n\t\t\t\t149391191BFE50940036B420 /* Supporting Files */,\n\t\t\t\t1493911C1BFE50940036B420 /* AppDelegate.h */,\n\t\t\t\t1493911D1BFE50940036B420 /* AppDelegate.m */,\n\t\t\t\t149391251BFE50940036B420 /* Assets.xcassets */,\n\t\t\t\t149391271BFE50940036B420 /* Info.plist */,\n\t\t\t\t149391221BFE50940036B420 /* Main.storyboard */,\n\t\t\t\t14835DF61BFE5D4100B9A267 /* Place.h */,\n\t\t\t\t14835DF71BFE5D4100B9A267 /* Place.m */,\n\t\t\t\t1493911F1BFE50940036B420 /* PlacesViewController.h */,\n\t\t\t\t149391201BFE50940036B420 /* PlacesViewController.m */,\n\t\t\t);\n\t\t\tpath = PreloadedData;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t149391191BFE50940036B420 /* Supporting Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t1493911A1BFE50940036B420 /* main.m */,\n\t\t\t);\n\t\t\tname = \"Supporting Files\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXNativeTarget section */\n\t\t1403AF6A1BFDC8D300C1FBB4 /* DownloadCache */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 1403AF7E1BFDC8D300C1FBB4 /* Build configuration list for PBXNativeTarget \"DownloadCache\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t1403AF671BFDC8D300C1FBB4 /* Sources */,\n\t\t\t\t1403AF681BFDC8D300C1FBB4 /* Frameworks */,\n\t\t\t\t1403AF691BFDC8D300C1FBB4 /* Resources */,\n\t\t\t\t1403AF871BFDCA8200C1FBB4 /* Embed Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = DownloadCache;\n\t\t\tproductName = DownloadCache;\n\t\t\tproductReference = 1403AF6B1BFDC8D300C1FBB4 /* DownloadCache.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\t149391161BFE50930036B420 /* PreloadedData */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 1493912A1BFE50940036B420 /* Build configuration list for PBXNativeTarget \"PreloadedData\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t149391131BFE50930036B420 /* Sources */,\n\t\t\t\t149391141BFE50930036B420 /* Frameworks */,\n\t\t\t\t149391151BFE50930036B420 /* Resources */,\n\t\t\t\t1493912F1BFE52880036B420 /* Embed Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = PreloadedData;\n\t\t\tproductName = PreloadedData;\n\t\t\tproductReference = 149391171BFE50930036B420 /* PreloadedData.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t1403AF401BFDC60A00C1FBB4 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastUpgradeCheck = 1430;\n\t\t\t\tORGANIZATIONNAME = Realm;\n\t\t\t\tTargetAttributes = {\n\t\t\t\t\t1403AF6A1BFDC8D300C1FBB4 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.2;\n\t\t\t\t\t};\n\t\t\t\t\t149391161BFE50930036B420 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.2;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tbuildConfigurationList = 1403AF431BFDC60A00C1FBB4 /* Build configuration list for PBXProject \"RealmExamples\" */;\n\t\t\tcompatibilityVersion = \"Xcode 3.2\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t\tBase,\n\t\t\t);\n\t\t\tmainGroup = 1403AF3F1BFDC60A00C1FBB4;\n\t\t\tproductRefGroup = 1403AF491BFDC60A00C1FBB4 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t1403AF6A1BFDC8D300C1FBB4 /* DownloadCache */,\n\t\t\t\t149391161BFE50930036B420 /* PreloadedData */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t1403AF691BFDC8D300C1FBB4 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t1403AF7A1BFDC8D300C1FBB4 /* Assets.xcassets in Resources */,\n\t\t\t\t1403AF781BFDC8D300C1FBB4 /* Main.storyboard in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t149391151BFE50930036B420 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t149391261BFE50940036B420 /* Assets.xcassets in Resources */,\n\t\t\t\t149391241BFE50940036B420 /* Main.storyboard in Resources */,\n\t\t\t\t14835DF51BFE5AAB00B9A267 /* Places.realm in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t1403AF671BFDC8D300C1FBB4 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t1403AF721BFDC8D300C1FBB4 /* AppDelegate.m in Sources */,\n\t\t\t\t1403AF6F1BFDC8D300C1FBB4 /* main.m in Sources */,\n\t\t\t\t1403AF751BFDC8D300C1FBB4 /* RepositoriesViewController.m in Sources */,\n\t\t\t\t1403AF8E1BFDDDCF00C1FBB4 /* Repository.m in Sources */,\n\t\t\t\t1403AF911BFDDE0B00C1FBB4 /* RepositoryCell.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t149391131BFE50930036B420 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t1493911E1BFE50940036B420 /* AppDelegate.m in Sources */,\n\t\t\t\t1493911B1BFE50940036B420 /* main.m in Sources */,\n\t\t\t\t14835DF81BFE5D4100B9A267 /* Place.m in Sources */,\n\t\t\t\t149391211BFE50940036B420 /* PlacesViewController.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXVariantGroup section */\n\t\t1403AF761BFDC8D300C1FBB4 /* Main.storyboard */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\t1403AF771BFDC8D300C1FBB4 /* Base */,\n\t\t\t);\n\t\t\tname = Main.storyboard;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t149391221BFE50940036B420 /* Main.storyboard */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\t149391231BFE50940036B420 /* Base */,\n\t\t\t);\n\t\t\tname = Main.storyboard;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXVariantGroup section */\n\n/* Begin XCBuildConfiguration section */\n\t\t1403AF5D1BFDC60B00C1FBB4 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSDKROOT = appletvos;\n\t\t\t\tTARGETED_DEVICE_FAMILY = 3;\n\t\t\t\tTVOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t1403AF5E1BFDC60B00C1FBB4 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tSDKROOT = appletvos;\n\t\t\t\tTARGETED_DEVICE_FAMILY = 3;\n\t\t\t\tTVOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t1403AF7C1BFDC8D300C1FBB4 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = \"App Icon & Top Shelf Image\";\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tINFOPLIST_FILE = DownloadCache/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.realm.DownloadCache;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t1403AF7D1BFDC8D300C1FBB4 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = \"App Icon & Top Shelf Image\";\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tINFOPLIST_FILE = DownloadCache/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.realm.DownloadCache;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t149391281BFE50940036B420 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = \"App Icon & Top Shelf Image\";\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tINFOPLIST_FILE = PreloadedData/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.realm.PreloadedData;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t149391291BFE50940036B420 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = \"App Icon & Top Shelf Image\";\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tINFOPLIST_FILE = PreloadedData/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.realm.PreloadedData;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t1403AF431BFDC60A00C1FBB4 /* Build configuration list for PBXProject \"RealmExamples\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t1403AF5D1BFDC60B00C1FBB4 /* Debug */,\n\t\t\t\t1403AF5E1BFDC60B00C1FBB4 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t1403AF7E1BFDC8D300C1FBB4 /* Build configuration list for PBXNativeTarget \"DownloadCache\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t1403AF7C1BFDC8D300C1FBB4 /* Debug */,\n\t\t\t\t1403AF7D1BFDC8D300C1FBB4 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t1493912A1BFE50940036B420 /* Build configuration list for PBXNativeTarget \"PreloadedData\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t149391281BFE50940036B420 /* Debug */,\n\t\t\t\t149391291BFE50940036B420 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 1403AF401BFDC60A00C1FBB4 /* Project object */;\n}\n"
  },
  {
    "path": "examples/tvos/objc/RealmExamples.xcodeproj/xcshareddata/xcschemes/DownloadCache.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5D659E7D1BE04556006515A0\"\n               BuildableName = \"Realm.framework\"\n               BlueprintName = \"Realm\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"1403AF6A1BFDC8D300C1FBB4\"\n               BuildableName = \"DownloadCache.app\"\n               BlueprintName = \"DownloadCache\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"1403AF6A1BFDC8D300C1FBB4\"\n            BuildableName = \"DownloadCache.app\"\n            BlueprintName = \"DownloadCache\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"1403AF6A1BFDC8D300C1FBB4\"\n            BuildableName = \"DownloadCache.app\"\n            BlueprintName = \"DownloadCache\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"1403AF6A1BFDC8D300C1FBB4\"\n            BuildableName = \"DownloadCache.app\"\n            BlueprintName = \"DownloadCache\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/tvos/objc/RealmExamples.xcodeproj/xcshareddata/xcschemes/PreloadedData.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5D659E7D1BE04556006515A0\"\n               BuildableName = \"Realm.framework\"\n               BlueprintName = \"Realm\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"149391161BFE50930036B420\"\n               BuildableName = \"PreloadedData.app\"\n               BlueprintName = \"PreloadedData\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"149391161BFE50930036B420\"\n            BuildableName = \"PreloadedData.app\"\n            BlueprintName = \"PreloadedData\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"149391161BFE50930036B420\"\n            BuildableName = \"PreloadedData.app\"\n            BlueprintName = \"PreloadedData\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"149391161BFE50930036B420\"\n            BuildableName = \"PreloadedData.app\"\n            BlueprintName = \"PreloadedData\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/tvos/objc/RealmExamples.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"group:RealmExamples.xcodeproj\">\n   </FileRef>\n   <FileRef\n      location = \"group:../../../Realm.xcodeproj\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "examples/tvos/objc/RealmExamples.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>\n\t<false/>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/AppDelegate.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport UIKit\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n    var window: UIWindow?\n\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {\n        return true\n    }\n}\n"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json",
    "content": "{\n  \"layers\" : [\n    {\n      \"filename\" : \"Front.imagestacklayer\"\n    },\n    {\n      \"filename\" : \"Middle.imagestacklayer\"\n    },\n    {\n      \"filename\" : \"Back.imagestacklayer\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}\n"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json",
    "content": "{\n  \"layers\" : [\n    {\n      \"filename\" : \"Front.imagestacklayer\"\n    },\n    {\n      \"filename\" : \"Middle.imagestacklayer\"\n    },\n    {\n      \"filename\" : \"Back.imagestacklayer\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}\n"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json",
    "content": "{\n  \"assets\" : [\n    {\n      \"size\" : \"1280x768\",\n      \"idiom\" : \"tv\",\n      \"filename\" : \"App Icon - Large.imagestack\",\n      \"role\" : \"primary-app-icon\"\n    },\n    {\n      \"size\" : \"400x240\",\n      \"idiom\" : \"tv\",\n      \"filename\" : \"App Icon - Small.imagestack\",\n      \"role\" : \"primary-app-icon\"\n    },\n    {\n      \"size\" : \"1920x720\",\n      \"idiom\" : \"tv\",\n      \"filename\" : \"Top Shelf Image.imageset\",\n      \"role\" : \"top-shelf-image\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}\n"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Assets.xcassets/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Assets.xcassets/LaunchImage.launchimage/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"orientation\" : \"landscape\",\n      \"idiom\" : \"tv\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"9.0\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Base.lproj/Main.storyboard",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder.AppleTV.Storyboard\" version=\"3.0\" toolsVersion=\"9531\" systemVersion=\"15C50\" targetRuntime=\"AppleTV\" propertyAccessControl=\"none\" useAutolayout=\"YES\" initialViewController=\"SGO-h1-0KE\">\n    <dependencies>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"9529\"/>\n    </dependencies>\n    <scenes>\n        <!--Repositories View Controller-->\n        <scene sceneID=\"Ddf-G2-6Ub\">\n            <objects>\n                <collectionViewController id=\"Lzj-QC-eFp\" customClass=\"RepositoriesViewController\" customModule=\"DownloadCache\" customModuleProvider=\"target\" sceneMemberID=\"viewController\">\n                    <collectionView key=\"view\" clipsSubviews=\"YES\" multipleTouchEnabled=\"YES\" contentMode=\"scaleToFill\" dataMode=\"prototypes\" id=\"9gd-9D-iKp\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"1920\" height=\"1080\"/>\n                        <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n                        <collectionViewFlowLayout key=\"collectionViewLayout\" minimumLineSpacing=\"48\" minimumInteritemSpacing=\"48\" id=\"XHR-qz-pDy\">\n                            <size key=\"itemSize\" width=\"548\" height=\"440\"/>\n                            <size key=\"headerReferenceSize\" width=\"0.0\" height=\"0.0\"/>\n                            <size key=\"footerReferenceSize\" width=\"0.0\" height=\"0.0\"/>\n                            <inset key=\"sectionInset\" minX=\"90\" minY=\"70\" maxX=\"90\" maxY=\"70\"/>\n                        </collectionViewFlowLayout>\n                        <cells>\n                            <collectionViewCell opaque=\"NO\" multipleTouchEnabled=\"YES\" contentMode=\"center\" reuseIdentifier=\"Cell\" id=\"jXV-gg-RQH\" customClass=\"RepositoryCell\" customModule=\"DownloadCache\" customModuleProvider=\"target\">\n                                <rect key=\"frame\" x=\"90\" y=\"215\" width=\"548\" height=\"440\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <view key=\"contentView\" opaque=\"NO\" clipsSubviews=\"YES\" multipleTouchEnabled=\"YES\" contentMode=\"center\">\n                                    <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"548\" height=\"440\"/>\n                                    <autoresizingMask key=\"autoresizingMask\"/>\n                                    <subviews>\n                                        <imageView userInteractionEnabled=\"NO\" contentMode=\"scaleAspectFill\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" adjustsImageWhenAncestorFocused=\"YES\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"vsI-n0-9MJ\">\n                                            <rect key=\"frame\" x=\"0.0\" y=\"18\" width=\"548\" height=\"300\"/>\n                                            <constraints>\n                                                <constraint firstAttribute=\"height\" constant=\"300\" id=\"z4a-v7-MSJ\"/>\n                                            </constraints>\n                                        </imageView>\n                                        <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"Label\" textAlignment=\"natural\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"MYq-cR-I9T\">\n                                            <rect key=\"frame\" x=\"204\" y=\"354\" width=\"140\" height=\"69\"/>\n                                            <fontDescription key=\"fontDescription\" style=\"UICTFontTextStyleTitle2\"/>\n                                            <color key=\"textColor\" red=\"0.0\" green=\"0.0\" blue=\"0.0\" alpha=\"1\" colorSpace=\"calibratedRGB\"/>\n                                            <nil key=\"highlightedColor\"/>\n                                        </label>\n                                    </subviews>\n                                    <color key=\"backgroundColor\" white=\"0.0\" alpha=\"0.0\" colorSpace=\"calibratedWhite\"/>\n                                </view>\n                                <constraints>\n                                    <constraint firstAttribute=\"trailing\" relation=\"greaterThanOrEqual\" secondItem=\"MYq-cR-I9T\" secondAttribute=\"trailing\" constant=\"36\" id=\"2hG-1N-ujv\"/>\n                                    <constraint firstAttribute=\"trailing\" secondItem=\"vsI-n0-9MJ\" secondAttribute=\"trailing\" id=\"NA7-m8-2R7\"/>\n                                    <constraint firstItem=\"MYq-cR-I9T\" firstAttribute=\"top\" secondItem=\"vsI-n0-9MJ\" secondAttribute=\"bottom\" constant=\"36\" id=\"Pyh-Cf-VpZ\"/>\n                                    <constraint firstItem=\"MYq-cR-I9T\" firstAttribute=\"leading\" relation=\"greaterThanOrEqual\" secondItem=\"jXV-gg-RQH\" secondAttribute=\"leading\" constant=\"36\" id=\"W8L-Dx-RKX\"/>\n                                    <constraint firstItem=\"vsI-n0-9MJ\" firstAttribute=\"top\" secondItem=\"jXV-gg-RQH\" secondAttribute=\"top\" constant=\"18\" id=\"WeO-29-yTu\"/>\n                                    <constraint firstItem=\"MYq-cR-I9T\" firstAttribute=\"centerX\" secondItem=\"jXV-gg-RQH\" secondAttribute=\"centerX\" id=\"Xbv-il-6Ke\"/>\n                                    <constraint firstItem=\"vsI-n0-9MJ\" firstAttribute=\"leading\" secondItem=\"jXV-gg-RQH\" secondAttribute=\"leading\" id=\"pRd-xp-dOj\"/>\n                                </constraints>\n                                <connections>\n                                    <outlet property=\"avatarImageView\" destination=\"vsI-n0-9MJ\" id=\"bUV-YT-JeP\"/>\n                                    <outlet property=\"titleLabel\" destination=\"MYq-cR-I9T\" id=\"ncM-ZM-Zwu\"/>\n                                </connections>\n                            </collectionViewCell>\n                        </cells>\n                        <connections>\n                            <outlet property=\"dataSource\" destination=\"Lzj-QC-eFp\" id=\"I3P-ov-UiH\"/>\n                            <outlet property=\"delegate\" destination=\"Lzj-QC-eFp\" id=\"2h3-OL-B4R\"/>\n                        </connections>\n                    </collectionView>\n                    <navigationItem key=\"navigationItem\" id=\"iHH-lM-C3B\">\n                        <nil key=\"title\"/>\n                        <segmentedControl key=\"titleView\" opaque=\"NO\" contentMode=\"scaleToFill\" contentHorizontalAlignment=\"left\" contentVerticalAlignment=\"top\" segmentControlStyle=\"bar\" selectedSegmentIndex=\"0\" id=\"baC-W4-etT\">\n                            <rect key=\"frame\" x=\"576\" y=\"63\" width=\"768\" height=\"70\"/>\n                            <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                            <color key=\"backgroundColor\" white=\"0.0\" alpha=\"0.10000000000000001\" colorSpace=\"calibratedWhite\"/>\n                            <segments>\n                                <segment title=\"A to Z\"/>\n                                <segment title=\"Z to A\"/>\n                            </segments>\n                            <connections>\n                                <action selector=\"valueChanged:\" destination=\"Lzj-QC-eFp\" eventType=\"valueChanged\" id=\"bxz-KG-3GC\"/>\n                            </connections>\n                        </segmentedControl>\n                        <barButtonItem key=\"rightBarButtonItem\" id=\"Etp-QS-ce2\">\n                            <view key=\"customView\" contentMode=\"scaleToFill\" id=\"CQd-xG-tmf\">\n                                <rect key=\"frame\" x=\"1494\" y=\"44\" width=\"426\" height=\"108\"/>\n                                <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                <subviews>\n                                    <button opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"1rE-lW-aqq\">\n                                        <rect key=\"frame\" x=\"268\" y=\"31\" width=\"149\" height=\"46\"/>\n                                        <fontDescription key=\"fontDescription\" style=\"UICTFontTextStyleBody\"/>\n                                        <inset key=\"contentEdgeInsets\" minX=\"40\" minY=\"20\" maxX=\"40\" maxY=\"20\"/>\n                                        <state key=\"normal\" title=\"Clear\"/>\n                                        <connections>\n                                            <action selector=\"clearSearchField:\" destination=\"Lzj-QC-eFp\" eventType=\"primaryActionTriggered\" id=\"0mq-wr-Sp4\"/>\n                                        </connections>\n                                    </button>\n                                    <textField opaque=\"NO\" contentMode=\"scaleToFill\" fixedFrame=\"YES\" contentHorizontalAlignment=\"left\" contentVerticalAlignment=\"center\" borderStyle=\"roundedRect\" textAlignment=\"natural\" minimumFontSize=\"17\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"vwj-Zy-sHa\">\n                                        <rect key=\"frame\" x=\"8\" y=\"31\" width=\"252\" height=\"46\"/>\n                                        <fontDescription key=\"fontDescription\" style=\"UICTFontTextStyleHeadline\"/>\n                                        <textInputTraits key=\"textInputTraits\"/>\n                                        <connections>\n                                            <outlet property=\"delegate\" destination=\"Lzj-QC-eFp\" id=\"DIP-se-FnB\"/>\n                                        </connections>\n                                    </textField>\n                                </subviews>\n                                <color key=\"backgroundColor\" white=\"0.0\" alpha=\"0.0\" colorSpace=\"calibratedWhite\"/>\n                            </view>\n                        </barButtonItem>\n                    </navigationItem>\n                    <connections>\n                        <outlet property=\"searchField\" destination=\"vwj-Zy-sHa\" id=\"N9f-PW-rJq\"/>\n                        <outlet property=\"sortOrderControl\" destination=\"baC-W4-etT\" id=\"NkH-ML-zUi\"/>\n                    </connections>\n                </collectionViewController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"G3h-Wb-SgG\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"6763\" y=\"314\"/>\n        </scene>\n        <!--Navigation Controller-->\n        <scene sceneID=\"kay-Nc-w7t\">\n            <objects>\n                <navigationController automaticallyAdjustsScrollViewInsets=\"NO\" id=\"SGO-h1-0KE\" sceneMemberID=\"viewController\">\n                    <toolbarItems/>\n                    <navigationBar key=\"navigationBar\" contentMode=\"scaleToFill\" id=\"I3W-PB-b9d\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"1920\" height=\"145\"/>\n                        <autoresizingMask key=\"autoresizingMask\"/>\n                    </navigationBar>\n                    <nil name=\"viewControllers\"/>\n                    <connections>\n                        <segue destination=\"Lzj-QC-eFp\" kind=\"relationship\" relationship=\"rootViewController\" id=\"aUw-Ua-RXT\"/>\n                    </connections>\n                </navigationController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"bzp-DE-fD3\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"4631\" y=\"314\"/>\n        </scene>\n    </scenes>\n</document>\n"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UIMainStoryboardFile</key>\n\t<string>Main</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>arm64</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/RepositoriesViewController.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport UIKit\nimport RealmSwift\n\nclass RepositoriesViewController: UICollectionViewController, UITextFieldDelegate {\n    @IBOutlet weak var sortOrderControl: UISegmentedControl!\n    @IBOutlet weak var searchField: UITextField!\n\n    var results: Results<Repository>?\n    var token: NotificationToken?\n\n    deinit {\n        token?.invalidate()\n    }\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n\n        let realm = try! Realm()\n        token = realm.observe { [weak self] _, _ in\n            self?.reloadData()\n        }\n\n        var components = URLComponents(string: \"https://api.github.com/search/repositories\")!\n        components.queryItems = [\n            URLQueryItem(name: \"q\", value: \"language:objc\"),\n            URLQueryItem(name: \"sort\", value: \"stars\"),\n            URLQueryItem(name: \"order\", value: \"desc\")\n        ]\n        URLSession.shared.dataTask(with: URLRequest(url: components.url!)) { data, _, error in\n            if let error = error {\n                print(error)\n                return\n            }\n\n            do {\n                let repositories = try JSONSerialization.jsonObject(with: data!, options: []) as! [String: AnyObject]\n                let items = repositories[\"items\"] as! [[String: AnyObject]]\n\n                let realm = try Realm()\n                try realm.write {\n                    for item in items {\n                        let repository = Repository()\n                        repository.identifier = String(item[\"id\"] as! Int)\n                        repository.name = item[\"name\"] as? String\n                        repository.avatarURL = item[\"owner\"]![\"avatar_url\"] as? String\n\n                        realm.add(repository, update: .modified)\n                    }\n                }\n            } catch {\n                print(error.localizedDescription)\n            }\n        }.resume()\n    }\n\n    override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {\n        return results?.count ?? 0\n    }\n\n    override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {\n        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: \"Cell\", for: indexPath) as! RepositoryCell\n        let repository = results![indexPath.item]\n        cell.titleLabel.text = repository.name\n\n        URLSession.shared.dataTask(with: URLRequest(url: URL(string: repository.avatarURL!)!)) { (data, _, error) in\n            if let error = error {\n                print(error.localizedDescription)\n                return\n            }\n\n            DispatchQueue.main.async {\n                let image = UIImage(data: data!)!\n                cell.avatarImageView!.image = image\n            }\n        }.resume()\n\n        return cell\n    }\n\n    func reloadData() {\n        let realm = try! Realm()\n        results = realm.objects(Repository.self)\n        if let text = searchField.text, !text.isEmpty {\n            results = results?.filter(\"name contains[c] %@\", text)\n        }\n        results = results?.sorted(byKeyPath: \"name\", ascending: sortOrderControl!.selectedSegmentIndex == 0)\n\n        collectionView?.reloadData()\n    }\n\n    @IBAction func valueChanged(sender: AnyObject) {\n        reloadData()\n    }\n\n    @IBAction func clearSearchField(sender: AnyObject) {\n        searchField.text = nil\n        reloadData()\n    }\n\n    func textFieldDidEndEditing(_ textField: UITextField) {\n        reloadData()\n    }\n}\n"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/Repository.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport UIKit\nimport RealmSwift\n\nclass Repository: Object {\n    @objc dynamic var identifier = \"\"\n    @objc dynamic var name: String?\n    @objc dynamic var avatarURL: String?\n\n    override static func primaryKey() -> String? {\n        return \"identifier\"\n    }\n}\n"
  },
  {
    "path": "examples/tvos/swift/DownloadCache/RepositoryCell.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport UIKit\n\nclass RepositoryCell: UICollectionViewCell {\n    @IBOutlet weak var avatarImageView: UIImageView!\n    @IBOutlet weak var titleLabel: UILabel!\n\n    override func prepareForReuse() {\n        avatarImageView.image = nil\n        titleLabel.text = nil\n    }\n}\n"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/AppDelegate.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport UIKit\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n    var window: UIWindow?\n\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {\n        return true\n    }\n}\n"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json",
    "content": "{\n  \"layers\" : [\n    {\n      \"filename\" : \"Front.imagestacklayer\"\n    },\n    {\n      \"filename\" : \"Middle.imagestacklayer\"\n    },\n    {\n      \"filename\" : \"Back.imagestacklayer\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}\n"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json",
    "content": "{\n  \"layers\" : [\n    {\n      \"filename\" : \"Front.imagestacklayer\"\n    },\n    {\n      \"filename\" : \"Middle.imagestacklayer\"\n    },\n    {\n      \"filename\" : \"Back.imagestacklayer\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}\n"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json",
    "content": "{\n  \"assets\" : [\n    {\n      \"size\" : \"1280x768\",\n      \"idiom\" : \"tv\",\n      \"filename\" : \"App Icon - Large.imagestack\",\n      \"role\" : \"primary-app-icon\"\n    },\n    {\n      \"size\" : \"400x240\",\n      \"idiom\" : \"tv\",\n      \"filename\" : \"App Icon - Small.imagestack\",\n      \"role\" : \"primary-app-icon\"\n    },\n    {\n      \"size\" : \"1920x720\",\n      \"idiom\" : \"tv\",\n      \"filename\" : \"Top Shelf Image.imageset\",\n      \"role\" : \"top-shelf-image\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}\n"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"tv\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Assets.xcassets/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Assets.xcassets/LaunchImage.launchimage/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"orientation\" : \"landscape\",\n      \"idiom\" : \"tv\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"9.0\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Base.lproj/Main.storyboard",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder.AppleTV.Storyboard\" version=\"3.0\" toolsVersion=\"9531\" systemVersion=\"15B42\" targetRuntime=\"AppleTV\" propertyAccessControl=\"none\" useAutolayout=\"YES\" initialViewController=\"vfU-Cr-UBK\">\n    <dependencies>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"9529\"/>\n    </dependencies>\n    <scenes>\n        <!--Places View Controller-->\n        <scene sceneID=\"1OB-Xo-pFR\">\n            <objects>\n                <tableViewController id=\"4mM-5r-ixa\" customClass=\"PlacesViewController\" customModule=\"PreloadedData\" customModuleProvider=\"target\" sceneMemberID=\"viewController\">\n                    <tableView key=\"view\" clipsSubviews=\"YES\" contentMode=\"scaleToFill\" alwaysBounceVertical=\"YES\" dataMode=\"prototypes\" style=\"plain\" separatorStyle=\"default\" rowHeight=\"100\" sectionHeaderHeight=\"40\" sectionFooterHeight=\"40\" id=\"xk7-nw-gkd\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"1920\" height=\"1080\"/>\n                        <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n                        <prototypes>\n                            <tableViewCell contentMode=\"scaleToFill\" selectionStyle=\"default\" indentationWidth=\"10\" reuseIdentifier=\"Cell\" textLabel=\"MmL-YB-dhZ\" detailTextLabel=\"iB8-dq-Irw\" style=\"IBUITableViewCellStyleSubtitle\" id=\"s5g-3Z-ygV\">\n                                <rect key=\"frame\" x=\"0.0\" y=\"199\" width=\"1880\" height=\"100\"/>\n                                <autoresizingMask key=\"autoresizingMask\"/>\n                                <tableViewCellContentView key=\"contentView\" opaque=\"NO\" clipsSubviews=\"YES\" multipleTouchEnabled=\"YES\" contentMode=\"center\" tableViewCell=\"s5g-3Z-ygV\" id=\"NrI-sd-hIf\">\n                                    <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"1904\" height=\"100\"/>\n                                    <autoresizingMask key=\"autoresizingMask\"/>\n                                    <subviews>\n                                        <label opaque=\"NO\" multipleTouchEnabled=\"YES\" contentMode=\"left\" text=\"Title\" textAlignment=\"natural\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" id=\"MmL-YB-dhZ\">\n                                            <rect key=\"frame\" x=\"20\" y=\"4\" width=\"72\" height=\"46\"/>\n                                            <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                            <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"38\"/>\n                                            <color key=\"textColor\" red=\"0.0\" green=\"0.0\" blue=\"0.0\" alpha=\"1\" colorSpace=\"calibratedRGB\"/>\n                                            <nil key=\"highlightedColor\"/>\n                                        </label>\n                                        <label opaque=\"NO\" multipleTouchEnabled=\"YES\" contentMode=\"left\" text=\"Subtitle\" textAlignment=\"natural\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" id=\"iB8-dq-Irw\">\n                                            <rect key=\"frame\" x=\"20\" y=\"50\" width=\"128\" height=\"46\"/>\n                                            <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                                            <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"38\"/>\n                                            <color key=\"textColor\" red=\"0.0\" green=\"0.0\" blue=\"0.0\" alpha=\"0.40000000000000002\" colorSpace=\"calibratedRGB\"/>\n                                            <nil key=\"highlightedColor\"/>\n                                        </label>\n                                    </subviews>\n                                </tableViewCellContentView>\n                            </tableViewCell>\n                        </prototypes>\n                        <connections>\n                            <outlet property=\"dataSource\" destination=\"4mM-5r-ixa\" id=\"2bm-ph-vZC\"/>\n                            <outlet property=\"delegate\" destination=\"4mM-5r-ixa\" id=\"Xh1-uu-OGG\"/>\n                        </connections>\n                    </tableView>\n                    <navigationItem key=\"navigationItem\" id=\"6Yu-X3-vo1\">\n                        <nil key=\"title\"/>\n                        <textField key=\"titleView\" opaque=\"NO\" contentMode=\"scaleToFill\" contentHorizontalAlignment=\"left\" contentVerticalAlignment=\"center\" borderStyle=\"roundedRect\" textAlignment=\"natural\" minimumFontSize=\"17\" clearButtonMode=\"whileEditing\" id=\"m8a-PC-P2z\">\n                            <rect key=\"frame\" x=\"576\" y=\"75\" width=\"768\" height=\"46\"/>\n                            <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n                            <fontDescription key=\"fontDescription\" style=\"UICTFontTextStyleHeadline\"/>\n                            <textInputTraits key=\"textInputTraits\" keyboardType=\"numberPad\"/>\n                            <connections>\n                                <outlet property=\"delegate\" destination=\"4mM-5r-ixa\" id=\"NfA-x3-2wu\"/>\n                            </connections>\n                        </textField>\n                    </navigationItem>\n                    <connections>\n                        <outlet property=\"searchField\" destination=\"m8a-PC-P2z\" id=\"Nyk-3h-EwJ\"/>\n                    </connections>\n                </tableViewController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"FQg-5M-XBd\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"6950\" y=\"-2646\"/>\n        </scene>\n        <!--Navigation Controller-->\n        <scene sceneID=\"5Vc-An-kd3\">\n            <objects>\n                <navigationController automaticallyAdjustsScrollViewInsets=\"NO\" id=\"vfU-Cr-UBK\" sceneMemberID=\"viewController\">\n                    <toolbarItems/>\n                    <navigationBar key=\"navigationBar\" contentMode=\"scaleToFill\" id=\"JSQ-on-QdL\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"1920\" height=\"145\"/>\n                        <autoresizingMask key=\"autoresizingMask\"/>\n                    </navigationBar>\n                    <nil name=\"viewControllers\"/>\n                    <connections>\n                        <segue destination=\"4mM-5r-ixa\" kind=\"relationship\" relationship=\"rootViewController\" id=\"BgL-CL-iHA\"/>\n                    </connections>\n                </navigationController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"aDl-xK-jLb\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"4818\" y=\"-2646\"/>\n        </scene>\n    </scenes>\n</document>\n"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UIMainStoryboardFile</key>\n\t<string>Main</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>arm64</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/Place.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport UIKit\nimport RealmSwift\n\nclass Place: Object {\n    @objc dynamic var postalCode: String?\n    @objc dynamic var placeName: String?\n    @objc dynamic var state: String?\n    @objc dynamic var stateAbbreviation: String?\n    @objc dynamic var county: String?\n    @objc dynamic var latitude = 0.0\n    @objc dynamic var longitude = 0.0\n}\n"
  },
  {
    "path": "examples/tvos/swift/PreloadedData/PlacesViewController.swift",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\nimport UIKit\nimport RealmSwift\n\nclass PlacesViewController: UITableViewController, UITextFieldDelegate {\n    @IBOutlet weak var searchField: UITextField!\n\n    var results: Results<Place>?\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n\n        let seedFileURL = Bundle.main.url(forResource: \"Places\", withExtension: \"realm\")\n        let config = Realm.Configuration(fileURL: seedFileURL, readOnly: true)\n        Realm.Configuration.defaultConfiguration = config\n\n        reloadData()\n    }\n\n    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n        return results?.count ?? 0\n    }\n\n    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n        let cell = tableView.dequeueReusableCell(withIdentifier: \"Cell\", for: indexPath)\n\n        let place = results![indexPath.row]\n\n        cell.textLabel!.text = place.postalCode\n        cell.detailTextLabel!.text = \"\\(place.placeName!), \\(place.state!)\"\n        if let county = place.county {\n            cell.detailTextLabel!.text = cell.detailTextLabel!.text! + \", \\(county)\"\n        }\n        return cell\n    }\n\n    func reloadData() {\n        let realm = try! Realm()\n        results = realm.objects(Place.self)\n        if let text = searchField.text, !text.isEmpty {\n            results = results?.filter(\"postalCode beginswith %@\", text)\n        }\n        results = results?.sorted(byKeyPath: \"postalCode\")\n\n        tableView?.reloadData()\n    }\n\n    func textFieldDidEndEditing(_ textField: UITextField) {\n        reloadData()\n    }\n}\n"
  },
  {
    "path": "examples/tvos/swift/RealmExamples.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t14835E1B1BFE5E4000B9A267 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14835E1A1BFE5E4000B9A267 /* AppDelegate.swift */; };\n\t\t14835E1D1BFE5E4000B9A267 /* RepositoriesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14835E1C1BFE5E4000B9A267 /* RepositoriesViewController.swift */; };\n\t\t14835E201BFE5E4000B9A267 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 14835E1E1BFE5E4000B9A267 /* Main.storyboard */; };\n\t\t14835E221BFE5E4100B9A267 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 14835E211BFE5E4100B9A267 /* Assets.xcassets */; };\n\t\t14835E451BFE5F5900B9A267 /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14835E431BFE5F5900B9A267 /* Realm.framework */; };\n\t\t14835E461BFE5F5900B9A267 /* Realm.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 14835E431BFE5F5900B9A267 /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t14835E471BFE5F5900B9A267 /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14835E441BFE5F5900B9A267 /* RealmSwift.framework */; };\n\t\t14835E481BFE5F5900B9A267 /* RealmSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 14835E441BFE5F5900B9A267 /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t14835E531BFE603300B9A267 /* RepositoryCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14835E521BFE603300B9A267 /* RepositoryCell.swift */; };\n\t\t14835E551BFE605000B9A267 /* Repository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14835E541BFE605000B9A267 /* Repository.swift */; };\n\t\t14AACA891BFE7B740046BD85 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14AACA881BFE7B740046BD85 /* AppDelegate.swift */; };\n\t\t14AACA8B1BFE7B740046BD85 /* PlacesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14AACA8A1BFE7B740046BD85 /* PlacesViewController.swift */; };\n\t\t14AACA8E1BFE7B740046BD85 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 14AACA8C1BFE7B740046BD85 /* Main.storyboard */; };\n\t\t14AACA901BFE7B740046BD85 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 14AACA8F1BFE7B740046BD85 /* Assets.xcassets */; };\n\t\t14AACA961BFE7C260046BD85 /* Place.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14AACA951BFE7C260046BD85 /* Place.swift */; };\n\t\t14AACA981BFE7C420046BD85 /* Places.realm in Resources */ = {isa = PBXBuildFile; fileRef = 14AACA971BFE7C420046BD85 /* Places.realm */; };\n\t\t14AACA9A1BFE7D0A0046BD85 /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14835E431BFE5F5900B9A267 /* Realm.framework */; };\n\t\t14AACA9B1BFE7D0A0046BD85 /* Realm.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 14835E431BFE5F5900B9A267 /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t14AACA9C1BFE7D0A0046BD85 /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14835E441BFE5F5900B9A267 /* RealmSwift.framework */; };\n\t\t14AACA9D1BFE7D0A0046BD85 /* RealmSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 14835E441BFE5F5900B9A267 /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n/* End PBXBuildFile section */\n\n/* Begin PBXCopyFilesBuildPhase section */\n\t\t14835E491BFE5F5A00B9A267 /* Embed Frameworks */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\t14835E461BFE5F5900B9A267 /* Realm.framework in Embed Frameworks */,\n\t\t\t\t14835E481BFE5F5900B9A267 /* RealmSwift.framework in Embed Frameworks */,\n\t\t\t);\n\t\t\tname = \"Embed Frameworks\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t14AACA9E1BFE7D0A0046BD85 /* Embed Frameworks */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\t14AACA9B1BFE7D0A0046BD85 /* Realm.framework in Embed Frameworks */,\n\t\t\t\t14AACA9D1BFE7D0A0046BD85 /* RealmSwift.framework in Embed Frameworks */,\n\t\t\t);\n\t\t\tname = \"Embed Frameworks\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXCopyFilesBuildPhase section */\n\n/* Begin PBXFileReference section */\n\t\t14835E181BFE5E4000B9A267 /* DownloadCache.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DownloadCache.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t14835E1A1BFE5E4000B9A267 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = \"<group>\"; };\n\t\t14835E1C1BFE5E4000B9A267 /* RepositoriesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RepositoriesViewController.swift; sourceTree = \"<group>\"; };\n\t\t14835E1F1BFE5E4000B9A267 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = \"<group>\"; };\n\t\t14835E211BFE5E4100B9A267 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \"<group>\"; };\n\t\t14835E231BFE5E4100B9A267 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\t14835E431BFE5F5900B9A267 /* Realm.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Realm.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t14835E441BFE5F5900B9A267 /* RealmSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RealmSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t14835E521BFE603300B9A267 /* RepositoryCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepositoryCell.swift; sourceTree = \"<group>\"; };\n\t\t14835E541BFE605000B9A267 /* Repository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Repository.swift; sourceTree = \"<group>\"; };\n\t\t14AACA861BFE7B740046BD85 /* PreloadedData.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PreloadedData.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t14AACA881BFE7B740046BD85 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = \"<group>\"; };\n\t\t14AACA8A1BFE7B740046BD85 /* PlacesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlacesViewController.swift; sourceTree = \"<group>\"; };\n\t\t14AACA8D1BFE7B740046BD85 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = \"<group>\"; };\n\t\t14AACA8F1BFE7B740046BD85 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \"<group>\"; };\n\t\t14AACA911BFE7B740046BD85 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\t14AACA951BFE7C260046BD85 /* Place.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Place.swift; sourceTree = \"<group>\"; };\n\t\t14AACA971BFE7C420046BD85 /* Places.realm */ = {isa = PBXFileReference; lastKnownFileType = file; name = Places.realm; path = \"Seed Data/Places.realm\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t14835E151BFE5E4000B9A267 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t14835E451BFE5F5900B9A267 /* Realm.framework in Frameworks */,\n\t\t\t\t14835E471BFE5F5900B9A267 /* RealmSwift.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t14AACA831BFE7B740046BD85 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t14AACA9A1BFE7D0A0046BD85 /* Realm.framework in Frameworks */,\n\t\t\t\t14AACA9C1BFE7D0A0046BD85 /* RealmSwift.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t14835DF91BFE5E0B00B9A267 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t14835E191BFE5E4000B9A267 /* DownloadCache */,\n\t\t\t\t14AACA871BFE7B740046BD85 /* PreloadedData */,\n\t\t\t\t14835E031BFE5E0B00B9A267 /* Products */,\n\t\t\t\t14835E511BFE5FBD00B9A267 /* RealmSwift */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t14835E031BFE5E0B00B9A267 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t14835E181BFE5E4000B9A267 /* DownloadCache.app */,\n\t\t\t\t14AACA861BFE7B740046BD85 /* PreloadedData.app */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t14835E191BFE5E4000B9A267 /* DownloadCache */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t14835E1A1BFE5E4000B9A267 /* AppDelegate.swift */,\n\t\t\t\t14835E211BFE5E4100B9A267 /* Assets.xcassets */,\n\t\t\t\t14835E231BFE5E4100B9A267 /* Info.plist */,\n\t\t\t\t14835E1E1BFE5E4000B9A267 /* Main.storyboard */,\n\t\t\t\t14835E1C1BFE5E4000B9A267 /* RepositoriesViewController.swift */,\n\t\t\t\t14835E541BFE605000B9A267 /* Repository.swift */,\n\t\t\t\t14835E521BFE603300B9A267 /* RepositoryCell.swift */,\n\t\t\t);\n\t\t\tpath = DownloadCache;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t14835E511BFE5FBD00B9A267 /* RealmSwift */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t14835E431BFE5F5900B9A267 /* Realm.framework */,\n\t\t\t\t14835E441BFE5F5900B9A267 /* RealmSwift.framework */,\n\t\t\t);\n\t\t\tname = RealmSwift;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t14AACA871BFE7B740046BD85 /* PreloadedData */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t14AACA991BFE7C450046BD85 /* Seed Data */,\n\t\t\t\t14AACA881BFE7B740046BD85 /* AppDelegate.swift */,\n\t\t\t\t14AACA8F1BFE7B740046BD85 /* Assets.xcassets */,\n\t\t\t\t14AACA911BFE7B740046BD85 /* Info.plist */,\n\t\t\t\t14AACA8C1BFE7B740046BD85 /* Main.storyboard */,\n\t\t\t\t14AACA951BFE7C260046BD85 /* Place.swift */,\n\t\t\t\t14AACA8A1BFE7B740046BD85 /* PlacesViewController.swift */,\n\t\t\t);\n\t\t\tpath = PreloadedData;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t14AACA991BFE7C450046BD85 /* Seed Data */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t14AACA971BFE7C420046BD85 /* Places.realm */,\n\t\t\t);\n\t\t\tname = \"Seed Data\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXNativeTarget section */\n\t\t14835E171BFE5E4000B9A267 /* DownloadCache */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 14835E241BFE5E4100B9A267 /* Build configuration list for PBXNativeTarget \"DownloadCache\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t14835E141BFE5E4000B9A267 /* Sources */,\n\t\t\t\t14835E151BFE5E4000B9A267 /* Frameworks */,\n\t\t\t\t14835E161BFE5E4000B9A267 /* Resources */,\n\t\t\t\t14835E491BFE5F5A00B9A267 /* Embed Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = DownloadCache;\n\t\t\tproductName = DownloadCache;\n\t\t\tproductReference = 14835E181BFE5E4000B9A267 /* DownloadCache.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\t14AACA851BFE7B740046BD85 /* PreloadedData */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 14AACA921BFE7B740046BD85 /* Build configuration list for PBXNativeTarget \"PreloadedData\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t14AACA821BFE7B740046BD85 /* Sources */,\n\t\t\t\t14AACA831BFE7B740046BD85 /* Frameworks */,\n\t\t\t\t14AACA841BFE7B740046BD85 /* Resources */,\n\t\t\t\t14AACA9E1BFE7D0A0046BD85 /* Embed Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = PreloadedData;\n\t\t\tproductName = PreloadedData;\n\t\t\tproductReference = 14AACA861BFE7B740046BD85 /* PreloadedData.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t14835DFA1BFE5E0B00B9A267 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 0720;\n\t\t\t\tLastUpgradeCheck = 1430;\n\t\t\t\tORGANIZATIONNAME = Realm;\n\t\t\t\tTargetAttributes = {\n\t\t\t\t\t14835E171BFE5E4000B9A267 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.2;\n\t\t\t\t\t\tLastSwiftMigration = 1130;\n\t\t\t\t\t};\n\t\t\t\t\t14AACA851BFE7B740046BD85 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.2;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tbuildConfigurationList = 14835DFD1BFE5E0B00B9A267 /* Build configuration list for PBXProject \"RealmExamples\" */;\n\t\t\tcompatibilityVersion = \"Xcode 3.2\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t\tBase,\n\t\t\t);\n\t\t\tmainGroup = 14835DF91BFE5E0B00B9A267;\n\t\t\tproductRefGroup = 14835E031BFE5E0B00B9A267 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t14835E171BFE5E4000B9A267 /* DownloadCache */,\n\t\t\t\t14AACA851BFE7B740046BD85 /* PreloadedData */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t14835E161BFE5E4000B9A267 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t14835E221BFE5E4100B9A267 /* Assets.xcassets in Resources */,\n\t\t\t\t14835E201BFE5E4000B9A267 /* Main.storyboard in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t14AACA841BFE7B740046BD85 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t14AACA901BFE7B740046BD85 /* Assets.xcassets in Resources */,\n\t\t\t\t14AACA8E1BFE7B740046BD85 /* Main.storyboard in Resources */,\n\t\t\t\t14AACA981BFE7C420046BD85 /* Places.realm in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t14835E141BFE5E4000B9A267 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t14835E1B1BFE5E4000B9A267 /* AppDelegate.swift in Sources */,\n\t\t\t\t14835E1D1BFE5E4000B9A267 /* RepositoriesViewController.swift in Sources */,\n\t\t\t\t14835E551BFE605000B9A267 /* Repository.swift in Sources */,\n\t\t\t\t14835E531BFE603300B9A267 /* RepositoryCell.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t14AACA821BFE7B740046BD85 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t14AACA891BFE7B740046BD85 /* AppDelegate.swift in Sources */,\n\t\t\t\t14AACA961BFE7C260046BD85 /* Place.swift in Sources */,\n\t\t\t\t14AACA8B1BFE7B740046BD85 /* PlacesViewController.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXVariantGroup section */\n\t\t14835E1E1BFE5E4000B9A267 /* Main.storyboard */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\t14835E1F1BFE5E4000B9A267 /* Base */,\n\t\t\t);\n\t\t\tname = Main.storyboard;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t14AACA8C1BFE7B740046BD85 /* Main.storyboard */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\t14AACA8D1BFE7B740046BD85 /* Base */,\n\t\t\t);\n\t\t\tname = Main.storyboard;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXVariantGroup section */\n\n/* Begin XCBuildConfiguration section */\n\t\t14835E0F1BFE5E0B00B9A267 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSDKROOT = appletvos;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 4.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = 3;\n\t\t\t\tTVOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t14835E101BFE5E0B00B9A267 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tSDKROOT = appletvos;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Owholemodule\";\n\t\t\t\tSWIFT_VERSION = 4.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = 3;\n\t\t\t\tTVOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t14835E251BFE5E4100B9A267 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = \"App Icon & Top Shelf Image\";\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tINFOPLIST_FILE = DownloadCache/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.realm.DownloadCache;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t14835E261BFE5E4100B9A267 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = \"App Icon & Top Shelf Image\";\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tINFOPLIST_FILE = DownloadCache/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.realm.DownloadCache;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t14AACA931BFE7B740046BD85 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = \"App Icon & Top Shelf Image\";\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tINFOPLIST_FILE = PreloadedData/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.realm.PreloadedData;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t14AACA941BFE7B740046BD85 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = \"App Icon & Top Shelf Image\";\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tINFOPLIST_FILE = PreloadedData/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = io.realm.PreloadedData;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t14835DFD1BFE5E0B00B9A267 /* Build configuration list for PBXProject \"RealmExamples\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t14835E0F1BFE5E0B00B9A267 /* Debug */,\n\t\t\t\t14835E101BFE5E0B00B9A267 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t14835E241BFE5E4100B9A267 /* Build configuration list for PBXNativeTarget \"DownloadCache\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t14835E251BFE5E4100B9A267 /* Debug */,\n\t\t\t\t14835E261BFE5E4100B9A267 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t14AACA921BFE7B740046BD85 /* Build configuration list for PBXNativeTarget \"PreloadedData\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t14AACA931BFE7B740046BD85 /* Debug */,\n\t\t\t\t14AACA941BFE7B740046BD85 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 14835DFA1BFE5E0B00B9A267 /* Project object */;\n}\n"
  },
  {
    "path": "examples/tvos/swift/RealmExamples.xcodeproj/xcshareddata/xcschemes/DownloadCache.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5D660FCB1BE98C560021E04F\"\n               BuildableName = \"RealmSwift.framework\"\n               BlueprintName = \"RealmSwift\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"14835E171BFE5E4000B9A267\"\n               BuildableName = \"DownloadCache.app\"\n               BlueprintName = \"DownloadCache\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"14835E171BFE5E4000B9A267\"\n            BuildableName = \"DownloadCache.app\"\n            BlueprintName = \"DownloadCache\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"14835E171BFE5E4000B9A267\"\n            BuildableName = \"DownloadCache.app\"\n            BlueprintName = \"DownloadCache\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"14835E171BFE5E4000B9A267\"\n            BuildableName = \"DownloadCache.app\"\n            BlueprintName = \"DownloadCache\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/tvos/swift/RealmExamples.xcodeproj/xcshareddata/xcschemes/PreloadedData.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1430\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"5D660FCB1BE98C560021E04F\"\n               BuildableName = \"RealmSwift.framework\"\n               BlueprintName = \"RealmSwift\"\n               ReferencedContainer = \"container:../../../Realm.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"14AACA851BFE7B740046BD85\"\n               BuildableName = \"PreloadedData.app\"\n               BlueprintName = \"PreloadedData\"\n               ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      disableMainThreadChecker = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"14AACA851BFE7B740046BD85\"\n            BuildableName = \"PreloadedData.app\"\n            BlueprintName = \"PreloadedData\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"14AACA851BFE7B740046BD85\"\n            BuildableName = \"PreloadedData.app\"\n            BlueprintName = \"PreloadedData\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"14AACA851BFE7B740046BD85\"\n            BuildableName = \"PreloadedData.app\"\n            BlueprintName = \"PreloadedData\"\n            ReferencedContainer = \"container:RealmExamples.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "examples/tvos/swift/RealmExamples.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"group:RealmExamples.xcodeproj\">\n   </FileRef>\n   <FileRef\n      location = \"group:../../../Realm.xcodeproj\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "examples/tvos/swift/RealmExamples.xcworkspace/xcshareddata/RealmExamples.xcscmblueprint",
    "content": "{\n  \"DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey\" : \"9FB1FDDBA011002795A1FF5BD3CABFA2F79E6A59\",\n  \"DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey\" : {\n\n  },\n  \"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey\" : {\n    \"9FB1FDDBA011002795A1FF5BD3CABFA2F79E6A59\" : 0,\n    \"8F3C415DA79CDA7D23734F285B95F9F9A3C0CB81\" : 0\n  },\n  \"DVTSourceControlWorkspaceBlueprintIdentifierKey\" : \"1704DB1C-4304-4E23-A31F-7898B29FB132\",\n  \"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey\" : {\n    \"9FB1FDDBA011002795A1FF5BD3CABFA2F79E6A59\" : \"realm-cocoa\\/\",\n    \"8F3C415DA79CDA7D23734F285B95F9F9A3C0CB81\" : \"realm-cocoa\\/Realm\\/ObjectStore\\/\"\n  },\n  \"DVTSourceControlWorkspaceBlueprintNameKey\" : \"RealmExamples\",\n  \"DVTSourceControlWorkspaceBlueprintVersion\" : 204,\n  \"DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey\" : \"examples\\/tvos\\/swift-3.0\\/RealmExamples.xcworkspace\",\n  \"DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey\" : [\n    {\n      \"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey\" : \"github.com:realm\\/realm-object-store-private.git\",\n      \"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey\" : \"com.apple.dt.Xcode.sourcecontrol.Git\",\n      \"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey\" : \"8F3C415DA79CDA7D23734F285B95F9F9A3C0CB81\"\n    },\n    {\n      \"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey\" : \"github.com:realm\\/realm-cocoa.git\",\n      \"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey\" : \"com.apple.dt.Xcode.sourcecontrol.Git\",\n      \"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey\" : \"9FB1FDDBA011002795A1FF5BD3CABFA2F79E6A59\"\n    }\n  ]\n}"
  },
  {
    "path": "examples/tvos/swift/RealmExamples.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>\n\t<false/>\n</dict>\n</plist>\n"
  },
  {
    "path": "plugin/README.md",
    "content": "# Realm Plugin\n\nThe Realm Plugin for Xcode adds several useful features for developing with Realm:\n\n1. A LLDB script which adds support for inspecting the property values of\n   persisted RLMObjects in the debugger pane.\n2. File templates for RLMObject subclasses.\n3. A menu item in Xcode's 'File' menu to quickly launch the Realm Browser.\n   Note that this item will only appear in Xcode 7 and in unsigned versions of\n   Xcode 8 or later (not recommended).\n\nTo install the Realm Plugin, open `RealmPlugin.xcodeproj` and Build. This will\nprompt for your password. After building the plugin, restart Xcode.\n"
  },
  {
    "path": "plugin/RealmPlugin/RLMPRealmPlugin.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <AppKit/AppKit.h>\n\n@interface RLMPRealmPlugin : NSObject\n\n@end\n"
  },
  {
    "path": "plugin/RealmPlugin/RLMPRealmPlugin.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMPRealmPlugin.h\"\n\n#import \"RLMPSimulatorManager.h\"\n\nstatic RLMPRealmPlugin *sharedPlugin;\n\nstatic NSString *const RootDeviceSimulatorPath = @\"Library/Developer/CoreSimulator/Devices\";\nstatic NSString *const DeviceSimulatorApplicationPath = @\"data/Containers/Data/Application\";\n\nstatic NSString *const RLMPErrorDomain = @\"io.Realm.error\";\n\nstatic NSArray * RLMPGlobFilesAtDirectoryURLWithPredicate(NSFileManager *fileManager, NSURL *directoryURL, NSPredicate *filteredPredicate, BOOL (^handler)(NSURL *URL, NSError *error))\n{\n    NSDirectoryEnumerator *directoryEnumerator = [fileManager enumeratorAtURL:directoryURL\n                                            includingPropertiesForKeys:@[NSURLNameKey, NSURLIsDirectoryKey]\n                                                               options:NSDirectoryEnumerationSkipsHiddenFiles\n                                                          errorHandler:handler];\n    NSMutableArray *fileURLs = [NSMutableArray array];\n    for (NSURL *fileURL in directoryEnumerator) {\n        NSString *fileName;\n        [fileURL getResourceValue:&fileName forKey:NSURLNameKey error:nil];\n        \n        NSString *isDirectory;\n        [fileURL getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:nil];\n        \n        // Check whether it is a directory or not\n        if (![isDirectory boolValue]) {\n            [fileURLs addObject:fileURL];\n        }\n    }\n    \n    return [fileURLs filteredArrayUsingPredicate:filteredPredicate];\n}\n\n@interface RLMPRealmPlugin()\n\n@property (nonatomic, strong) NSBundle *bundle;\n@property (nonatomic, strong) NSURL *browserUrl;\n\n@end\n\n@implementation RLMPRealmPlugin\n\n+ (void)pluginDidLoad:(NSBundle *)plugin\n{\n    static dispatch_once_t onceToken;\n    NSString *currentApplicationName = [[NSBundle mainBundle] infoDictionary][@\"CFBundleName\"];\n    if ([currentApplicationName isEqual:@\"Xcode\"]) {\n        dispatch_once(&onceToken, ^{\n            sharedPlugin = [[self alloc] initWithBundle:plugin];\n        });\n    }\n}\n\n- (id)initWithBundle:(NSBundle *)plugin\n{\n    if (self = [super init]) {\n        // Save reference to plugin's bundle, for resource acccess\n        self.bundle = plugin;\n        [[NSNotificationCenter defaultCenter] addObserver:self\n                                                 selector:@selector(didApplicationFinishLaunchingNotification:)\n                                                     name:NSApplicationDidFinishLaunchingNotification\n                                                   object:nil];\n    }\n    \n    return self;\n}\n\n- (void)didApplicationFinishLaunchingNotification:(NSNotification *)notification\n{\n    // Look for the Realm Browser\n    NSString *urlString = [[NSWorkspace sharedWorkspace] fullPathForApplication:@\"Realm Browser\"];\n    if (urlString) {\n        self.browserUrl = [NSURL fileURLWithPath:urlString];\n        \n        // Create menu item to open Browser under File:\n        NSMenuItem *menuItem = [[NSApp mainMenu] itemWithTitle:@\"File\"];\n        if (menuItem) {\n            [[menuItem submenu] addItem:[NSMenuItem separatorItem]];\n            NSMenuItem *actionMenuItem = [[NSMenuItem alloc] initWithTitle:@\"Open Realm...\"\n                                                                    action:@selector(openBrowser)\n                                                             keyEquivalent:@\"\"];\n            [actionMenuItem setTarget:self];\n            [[menuItem submenu] addItem:actionMenuItem];\n        }\n    }\n    else {\n        NSLog(@\"Realm Plugin: Couldn't find Realm Browser. Will not show 'Open Realm...' menu item.\");\n    }\n}\n\n- (void)openBrowser\n{\n    // This shouldn't be possible to call without having the Browser installed\n    if (!self.browserUrl) {\n        NSString *title = @\"Please install the Realm Browser\";\n        NSString *message = @\"You need to install the Realm Browser in order to use it from this plugin. Please visit realm.io for more information.\";\n        \n        NSError *error = [NSError errorWithDomain:RLMPErrorDomain\n                                             code:-1\n                                         userInfo:@{ NSLocalizedDescriptionKey : title,\n                                                     NSLocalizedRecoverySuggestionErrorKey : message }];\n        [self showError:error];\n        return;\n    }\n    \n    // Find Device UUID\n    NSString *bootedSimulatorUUID = [RLMPSimulatorManager bootedSimulatorUUID];\n    \n    // Find Realm File URL\n    NSArray *realmFileURLs = [self realmFilesURLWithDeviceUUID:bootedSimulatorUUID];\n    \n    if (realmFileURLs.count == 0) {\n        NSString *title = @\"Unable to find Realm file\";\n        NSString *message = @\"You must launch iOS Simulator with app that uses Realm\";\n        \n        NSError *error = [NSError errorWithDomain:RLMPErrorDomain\n                                             code:-1\n                                         userInfo:@{ NSLocalizedDescriptionKey : title,\n                                                     NSLocalizedRecoverySuggestionErrorKey : message }];\n        [self showError:error];\n        return;\n    }\n    \n    NSMutableArray *arguments = [NSMutableArray array];\n    for (NSURL *realmFileURL in realmFileURLs) {\n        [arguments addObject:realmFileURL.path];\n    }\n    \n    NSDictionary *configuration = @{ NSWorkspaceLaunchConfigurationArguments : arguments };\n    \n    // Show confirmation alert if 2 or more files are detected\n    if (arguments.count > 1) {\n        NSAlert *alert = [[NSAlert alloc] init];\n        [alert setMessageText:@\"Realm Browser\"];\n        [alert setInformativeText:[NSString stringWithFormat:@\"%ld Realm files are detected. Are you sure to open them at once?\", arguments.count]];\n        [alert setAlertStyle:NSInformationalAlertStyle];\n        [alert addButtonWithTitle:@\"OK\"];\n        [alert addButtonWithTitle:@\"Cancel\"];\n        [alert beginSheetModalForWindow:[NSApp mainWindow] completionHandler:^(NSModalResponse returnCode) {\n            if (returnCode == NSAlertFirstButtonReturn) {\n                [self openRealmBrowserWithConfiguration:configuration];\n            }\n        }];\n    } else {\n        [self openRealmBrowserWithConfiguration:configuration];\n    }\n}\n\n- (void)openRealmBrowserWithConfiguration:(NSDictionary *)configuration\n{\n    NSError *error;\n    if (![[NSWorkspace sharedWorkspace] launchApplicationAtURL:self.browserUrl options:NSWorkspaceLaunchNewInstance configuration:configuration error:&error]) {\n        // This will happen if the Browser was present at Xcode launch and then was deleted\n        [self showError:error];\n    }\n}\n\n- (NSArray *)realmFilesURLWithDeviceUUID:(NSString *)deviceUUID\n{\n    NSFileManager *fileManager = [NSFileManager defaultManager];\n    NSURL *homeURL = [NSURL URLWithString:NSHomeDirectory()];\n    \n    NSMutableString *fullPath = [NSMutableString string];\n    [fullPath appendFormat:@\"%@/%@/%@\", RootDeviceSimulatorPath, deviceUUID, DeviceSimulatorApplicationPath];\n    NSURL *bootedDeviceDirectoryURL = [homeURL URLByAppendingPathComponent:fullPath];\n    \n    NSArray* fileURLs = RLMPGlobFilesAtDirectoryURLWithPredicate(fileManager, bootedDeviceDirectoryURL, [NSPredicate predicateWithFormat:@\"pathExtension == 'realm'\"], ^BOOL(NSURL *URL, NSError *error) {\n        if (error) {\n            NSLog(@\"%@\", error);\n            return NO;\n        }\n        return YES;\n    });\n    \n    return fileURLs;\n}\n\n- (void)showError:(NSError *)error\n{\n    NSAlert *alert = [NSAlert alertWithError:error];\n    [alert runModal];\n}\n\n- (void)dealloc\n{\n    [[NSNotificationCenter defaultCenter] removeObserver:self];\n}\n\n@end\n"
  },
  {
    "path": "plugin/RealmPlugin/RLMPSimulatorManager.h",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import <Foundation/Foundation.h>\n\n/**\n \n RLMPSimulatorManager is a helper class to monitor iOS Simulator status and corresponding UUID. \n \n The only usage is to return UUID of booted Simulator which is found by using command xcrun.\n \n    NSString *bootedUUID = [RLMPSimulatorManager bootedSimulatorUUID];\n*/\n\n@interface RLMPSimulatorManager : NSObject\n\n/**\n UUID of booted Simulator\n*/\n+ (NSString *)bootedSimulatorUUID;\n\n@end\n"
  },
  {
    "path": "plugin/RealmPlugin/RLMPSimulatorManager.m",
    "content": "////////////////////////////////////////////////////////////////////////////\n//\n// Copyright 2014 Realm Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////\n\n#import \"RLMPSimulatorManager.h\"\n\nstatic NSString *const RLMPBootedSimulatorKey = @\"Booted\";\n\nstatic NSTask *RLMPLaunchedTaskSynchonouslyWithProperty(NSString *path, NSArray *arguments, NSString *__autoreleasing *output)\n{\n    // Setup task with given parameters\n    NSTask *task = [[NSTask alloc] init];\n    task.launchPath = path;\n    task.arguments = arguments;\n\n    // Setup output Pipe to created Task\n    NSPipe *outputPipe = [NSPipe pipe];\n    task.standardOutput = outputPipe;\n\n    [task launch];\n    [task waitUntilExit];\n\n    NSData *outputData = [[outputPipe fileHandleForReading] readDataToEndOfFile];\n\n    *output = [[NSString alloc] initWithData:outputData encoding:NSUTF8StringEncoding];\n\n    return task;\n}\n\n@interface RLMPSimulatorManager ()\n\n@end\n\n@implementation RLMPSimulatorManager\n\n+ (NSString *)bootedSimulatorUUID\n{\n    NSString *deviceData = [self readDeviceData];\n\n    __block NSString *bootedDeviceUUID;\n    if (deviceData) {\n        // Process output\n        NSDictionary *deviceStatuses = [self processDeviceData:deviceData];\n\n        [deviceStatuses enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *value, BOOL *stop) {\n            if ([value isEqualToString:RLMPBootedSimulatorKey]) {\n                bootedDeviceUUID = key;\n                // Stop when we found single booted device\n                *stop = YES;\n            }\n        }];\n    }\n\n    return bootedDeviceUUID;\n}\n\n+ (NSString *)readDeviceData\n{\n    // Find out Xcode path from mainBundle\n    NSURL *bundleURL = [[NSBundle mainBundle] infoDictionary][@\"CFBundleInfoPlistURL\"];\n\n    // Append with xcrun path\n    NSString *pathToXcrun = @\"Contents/Developer/usr/bin/xcrun\";\n    NSURL *fullURL = [[NSURL alloc] initWithString:pathToXcrun relativeToURL:bundleURL.baseURL];\n\n    // Set parameters to get device detail\n    NSArray *args = @[@\"simctl\", @\"list\", @\"devices\"];\n\n    NSString *output;\n    RLMPLaunchedTaskSynchonouslyWithProperty(fullURL.path, args, &output);\n\n    return output;\n}\n\n+ (NSDictionary *)processDeviceData:(NSString *)data\n{\n    NSMutableDictionary *device = [NSMutableDictionary dictionary];\n    NSScanner *scanner = [NSScanner scannerWithString:data];\n\n    // Skip punctuation ( ) as we only want status inside\n    scanner.charactersToBeSkipped = [NSCharacterSet punctuationCharacterSet];\n    while (![scanner isAtEnd]) {\n        NSString *deviceKey;\n        NSString *deviceStatus;\n        // Scan up to (\n        [scanner scanUpToString:@\"(\" intoString:nil];\n        [scanner scanUpToString:@\")\" intoString:&deviceKey];\n\n        // Scan up to (\n        [scanner scanUpToString:@\"(\" intoString:nil];\n        [scanner scanUpToString:@\")\" intoString:&deviceStatus];\n\n        [scanner scanUpToCharactersFromSet:[NSCharacterSet newlineCharacterSet] intoString:nil];\n\n        if (deviceKey && deviceStatus) {\n            [device setValue:deviceStatus forKey:deviceKey];\n        }\n    }\n\n    return device;\n}\n\n@end\n"
  },
  {
    "path": "plugin/RealmPlugin/RealmPlugin-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>English</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIconFile</key>\n\t<string></string>\n\t<key>CFBundleIdentifier</key>\n\t<string>io.realm.${PRODUCT_NAME:rfc1034identifier}</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>BNDL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>DVTPlugInCompatibilityUUIDs</key>\n\t<array>\n\t\t<string>FEC992CC-CA4A-4CFD-8881-77300FCB848A</string>\n\t\t<string>C4A681B0-4A26-480E-93EC-1218098B9AA0</string>\n\t\t<string>A2E4D43F-41F4-4FB9-BB94-7177011C9AED</string>\n\t\t<string>AD68E85B-441B-4301-B564-A45E4919A6AD</string>\n\t\t<string>63FC1C47-140D-42B0-BB4D-A10B2D225574</string>\n\t\t<string>37B30044-3B14-46BA-ABAA-F01000C27B63</string>\n\t\t<string>640F884E-CE55-4B40-87C0-8869546CAB7A</string>\n\t\t<string>992275C1-432A-4CF7-B659-D84ED6D42D3F</string>\n\t\t<string>A16FF353-8441-459E-A50C-B071F53F51B7</string>\n\t\t<string>9F75337B-21B4-4ADC-B558-F9CADF7073A7</string>\n\t\t<string>7FDF5C7A-131F-4ABB-9EDC-8C5F8F0B8A90</string>\n\t\t<string>0420B86A-AA43-4792-9ED0-6FE0F2B16A13</string>\n\t\t<string>E969541F-E6F9-4D25-8158-72DC3545A6C6</string>\n\t\t<string>8DC44374-2B35-4C57-A6FE-2AD66A36AAD9</string>\n\t\t<string>AABB7188-E14E-4433-AD3B-5CD791EAD9A3</string>\n\t\t<string>CC0D0F4F-05B3-431A-8F33-F84AFCB2C651</string>\n\t\t<string>7265231C-39B4-402C-89E1-16167C4CC990</string>\n\t\t<string>9AFF134A-08DC-4096-8CEE-62A4BB123046</string>\n\t\t<string>F41BD31E-2683-44B8-AE7F-5F09E919790E</string>\n\t\t<string>ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C</string>\n\t</array>\n\t<key>NSPrincipalClass</key>\n\t<string>RLMPRealmPlugin</string>\n\t<key>XC4Compatible</key>\n\t<true/>\n\t<key>XC5Compatible</key>\n\t<true/>\n\t<key>XCPluginHasUI</key>\n\t<false/>\n</dict>\n</plist>\n"
  },
  {
    "path": "plugin/RealmPlugin/RealmPlugin-Prefix.pch",
    "content": "//\n//  Prefix header\n//\n//  The contents of this file are implicitly included at the beginning of every source file.\n//\n\n#ifdef __OBJC__\n    #import <Foundation/Foundation.h>\n#endif\n"
  },
  {
    "path": "plugin/RealmPlugin/en.lproj/InfoPlist.strings",
    "content": "/* Localized versions of Info.plist keys */\n\n"
  },
  {
    "path": "plugin/RealmPlugin.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t2263AABA19B0A1E6007240D9 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2263AAB919B0A1E6007240D9 /* AppKit.framework */; };\n\t\t2263AABC19B0A1E6007240D9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2263AABB19B0A1E6007240D9 /* Foundation.framework */; };\n\t\t2263AAC219B0A1E6007240D9 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2263AAC019B0A1E6007240D9 /* InfoPlist.strings */; };\n\t\t2263AAC519B0A1E6007240D9 /* RLMPRealmPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 2263AAC419B0A1E6007240D9 /* RLMPRealmPlugin.m */; };\n\t\t3CF8FC5D1B494F3B0066DC23 /* RLMPSimulatorManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CF8FC5C1B494F3B0066DC23 /* RLMPSimulatorManager.m */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t2263AAB619B0A1E6007240D9 /* RealmPlugin.xcplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RealmPlugin.xcplugin; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t2263AAB919B0A1E6007240D9 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };\n\t\t2263AABB19B0A1E6007240D9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };\n\t\t2263AABF19B0A1E6007240D9 /* RealmPlugin-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = \"RealmPlugin-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t2263AAC119B0A1E6007240D9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = \"<group>\"; };\n\t\t2263AAC319B0A1E6007240D9 /* RLMPRealmPlugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RLMPRealmPlugin.h; sourceTree = \"<group>\"; };\n\t\t2263AAC419B0A1E6007240D9 /* RLMPRealmPlugin.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RLMPRealmPlugin.m; sourceTree = \"<group>\"; };\n\t\t2263AAC619B0A1E6007240D9 /* RealmPlugin-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = \"RealmPlugin-Prefix.pch\"; sourceTree = \"<group>\"; };\n\t\t22B78F1F19B0A47600968525 /* ___FILEBASENAME___.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"___FILEBASENAME___.h\"; sourceTree = \"<group>\"; };\n\t\t22B78F2019B0A47600968525 /* ___FILEBASENAME___.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = \"___FILEBASENAME___.m\"; sourceTree = \"<group>\"; };\n\t\t22B78F2119B0A47600968525 /* TemplateIcon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = TemplateIcon.icns; sourceTree = \"<group>\"; };\n\t\t22B78F2219B0A47600968525 /* TemplateInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = TemplateInfo.plist; sourceTree = \"<group>\"; };\n\t\t22B78F2319B0A47600968525 /* install_templates.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = install_templates.sh; sourceTree = \"<group>\"; };\n\t\t3CF8FC5B1B494F3B0066DC23 /* RLMPSimulatorManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMPSimulatorManager.h; sourceTree = \"<group>\"; };\n\t\t3CF8FC5C1B494F3B0066DC23 /* RLMPSimulatorManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RLMPSimulatorManager.m; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t2263AAB319B0A1E6007240D9 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t2263AABA19B0A1E6007240D9 /* AppKit.framework in Frameworks */,\n\t\t\t\t2263AABC19B0A1E6007240D9 /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t2263AAAD19B0A1E5007240D9 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2263AAB819B0A1E6007240D9 /* Frameworks */,\n\t\t\t\t2263AAB719B0A1E6007240D9 /* Products */,\n\t\t\t\t2263AABD19B0A1E6007240D9 /* RealmPlugin */,\n\t\t\t\t22B78F1319B0A47600968525 /* Templates */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2263AAB719B0A1E6007240D9 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2263AAB619B0A1E6007240D9 /* RealmPlugin.xcplugin */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2263AAB819B0A1E6007240D9 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2263AAB919B0A1E6007240D9 /* AppKit.framework */,\n\t\t\t\t2263AABB19B0A1E6007240D9 /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2263AABD19B0A1E6007240D9 /* RealmPlugin */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2263AABE19B0A1E6007240D9 /* Supporting Files */,\n\t\t\t\t2263AAC319B0A1E6007240D9 /* RLMPRealmPlugin.h */,\n\t\t\t\t2263AAC419B0A1E6007240D9 /* RLMPRealmPlugin.m */,\n\t\t\t\t3CF8FC5B1B494F3B0066DC23 /* RLMPSimulatorManager.h */,\n\t\t\t\t3CF8FC5C1B494F3B0066DC23 /* RLMPSimulatorManager.m */,\n\t\t\t);\n\t\t\tpath = RealmPlugin;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2263AABE19B0A1E6007240D9 /* Supporting Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2263AAC019B0A1E6007240D9 /* InfoPlist.strings */,\n\t\t\t\t2263AABF19B0A1E6007240D9 /* RealmPlugin-Info.plist */,\n\t\t\t\t2263AAC619B0A1E6007240D9 /* RealmPlugin-Prefix.pch */,\n\t\t\t);\n\t\t\tname = \"Supporting Files\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t22B78F1319B0A47600968525 /* Templates */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t22B78F1D19B0A47600968525 /* file_templates */,\n\t\t\t\t22B78F2319B0A47600968525 /* install_templates.sh */,\n\t\t\t);\n\t\t\tpath = Templates;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t22B78F1D19B0A47600968525 /* file_templates */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t22B78F1E19B0A47600968525 /* Realm Model Object.xctemplate */,\n\t\t\t);\n\t\t\tpath = file_templates;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t22B78F1E19B0A47600968525 /* Realm Model Object.xctemplate */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t22B78F1F19B0A47600968525 /* ___FILEBASENAME___.h */,\n\t\t\t\t22B78F2019B0A47600968525 /* ___FILEBASENAME___.m */,\n\t\t\t\t22B78F2119B0A47600968525 /* TemplateIcon.icns */,\n\t\t\t\t22B78F2219B0A47600968525 /* TemplateInfo.plist */,\n\t\t\t);\n\t\t\tpath = \"Realm Model Object.xctemplate\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXNativeTarget section */\n\t\t2263AAB519B0A1E6007240D9 /* RealmPlugin */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 2263AAC919B0A1E6007240D9 /* Build configuration list for PBXNativeTarget \"RealmPlugin\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t22B78EF819B0A3AF00968525 /* Install Templates */,\n\t\t\t\t3F527BDF1A16C34300CA8B97 /* Install LLDB Script */,\n\t\t\t\t2263AAB219B0A1E6007240D9 /* Sources */,\n\t\t\t\t2263AAB319B0A1E6007240D9 /* Frameworks */,\n\t\t\t\t2263AAB419B0A1E6007240D9 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = RealmPlugin;\n\t\t\tproductName = RealmPlugin;\n\t\t\tproductReference = 2263AAB619B0A1E6007240D9 /* RealmPlugin.xcplugin */;\n\t\t\tproductType = \"com.apple.product-type.bundle\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t2263AAAE19B0A1E5007240D9 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tCLASSPREFIX = RLMP;\n\t\t\t\tLastUpgradeCheck = 1430;\n\t\t\t\tORGANIZATIONNAME = Realm;\n\t\t\t};\n\t\t\tbuildConfigurationList = 2263AAB119B0A1E5007240D9 /* Build configuration list for PBXProject \"RealmPlugin\" */;\n\t\t\tcompatibilityVersion = \"Xcode 3.2\";\n\t\t\tdevelopmentRegion = English;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 2263AAAD19B0A1E5007240D9;\n\t\t\tproductRefGroup = 2263AAB719B0A1E6007240D9 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t2263AAB519B0A1E6007240D9 /* RealmPlugin */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t2263AAB419B0A1E6007240D9 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t2263AAC219B0A1E6007240D9 /* InfoPlist.strings in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXShellScriptBuildPhase section */\n\t\t22B78EF819B0A3AF00968525 /* Install Templates */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t);\n\t\t\tname = \"Install Templates\";\n\t\t\toutputPaths = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"cd Templates && sh install_templates.sh\";\n\t\t};\n\t\t3F527BDF1A16C34300CA8B97 /* Install LLDB Script */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t);\n\t\t\tname = \"Install LLDB Script\";\n\t\t\toutputPaths = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"python rlm_lldb.py\";\n\t\t};\n/* End PBXShellScriptBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t2263AAB219B0A1E6007240D9 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t2263AAC519B0A1E6007240D9 /* RLMPRealmPlugin.m in Sources */,\n\t\t\t\t3CF8FC5D1B494F3B0066DC23 /* RLMPSimulatorManager.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXVariantGroup section */\n\t\t2263AAC019B0A1E6007240D9 /* InfoPlist.strings */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\t2263AAC119B0A1E6007240D9 /* en */,\n\t\t\t);\n\t\t\tname = InfoPlist.strings;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXVariantGroup section */\n\n/* Begin XCBuildConfiguration section */\n\t\t2263AAC719B0A1E6007240D9 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_ENABLE_OBJC_EXCEPTIONS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_SYMBOLS_PRIVATE_EXTERN = NO;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.9;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t2263AAC819B0A1E6007240D9 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = YES;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_ENABLE_OBJC_EXCEPTIONS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.9;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t2263AACA19B0A1E6007240D9 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tDEPLOYMENT_LOCATION = YES;\n\t\t\t\tDSTROOT = \"$(HOME)\";\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"RealmPlugin/RealmPlugin-Prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"RealmPlugin/RealmPlugin-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"/Library/Application Support/Developer/Shared/Xcode/Plug-ins\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = xcplugin;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t2263AACB19B0A1E6007240D9 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tDEPLOYMENT_LOCATION = YES;\n\t\t\t\tDSTROOT = \"$(HOME)\";\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"RealmPlugin/RealmPlugin-Prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"RealmPlugin/RealmPlugin-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"/Library/Application Support/Developer/Shared/Xcode/Plug-ins\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = xcplugin;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t2263AAB119B0A1E5007240D9 /* Build configuration list for PBXProject \"RealmPlugin\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t2263AAC719B0A1E6007240D9 /* Debug */,\n\t\t\t\t2263AAC819B0A1E6007240D9 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t2263AAC919B0A1E6007240D9 /* Build configuration list for PBXNativeTarget \"RealmPlugin\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t2263AACA19B0A1E6007240D9 /* Debug */,\n\t\t\t\t2263AACB19B0A1E6007240D9 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 2263AAAE19B0A1E5007240D9 /* Project object */;\n}\n"
  },
  {
    "path": "plugin/Templates/file_templates/Realm Model Object.xctemplate/Objective-C/___FILEBASENAME___.h",
    "content": "//\n//  ___FILENAME___\n//  ___PROJECTNAME___\n//\n//  Created by ___FULLUSERNAME___ on ___DATE___.\n//___COPYRIGHT___\n//\n\n#import <Realm/Realm.h>\n\n@interface ___FILEBASENAMEASIDENTIFIER___ : RLMObject\n<# Add properties here to define the model #>\n@end\n\n// This protocol enables typed collections. i.e.:\n// RLMArray<___FILEBASENAMEASIDENTIFIER___ *><___FILEBASENAMEASIDENTIFIER___>\nRLM_COLLECTION_TYPE(___FILEBASENAMEASIDENTIFIER___)\n"
  },
  {
    "path": "plugin/Templates/file_templates/Realm Model Object.xctemplate/Objective-C/___FILEBASENAME___.m",
    "content": "//\n//  ___FILENAME___\n//  ___PROJECTNAME___\n//\n//  Created by ___FULLUSERNAME___ on ___DATE___.\n//___COPYRIGHT___\n//\n\n#import \"___FILEBASENAME___.h\"\n\n@implementation ___FILEBASENAMEASIDENTIFIER___\n\n// Specify default values for properties\n\n//+ (NSDictionary *)defaultPropertyValues\n//{\n//    return @{};\n//}\n\n// Specify properties to ignore (Realm won't persist these)\n\n//+ (NSArray *)ignoredProperties\n//{\n//    return @[];\n//}\n\n@end\n"
  },
  {
    "path": "plugin/Templates/file_templates/Realm Model Object.xctemplate/Swift/___FILEBASENAME___.swift",
    "content": "//\n//  ___FILENAME___\n//  ___PROJECTNAME___\n//\n//  Created by ___FULLUSERNAME___ on ___DATE___.\n// ___COPYRIGHT___\n//\n\nimport Foundation\nimport RealmSwift\n\nclass ___FILEBASENAMEASIDENTIFIER___: Object {\n    \n// Specify properties to ignore (Realm won't persist these)\n    \n//  override static func ignoredProperties() -> [String] {\n//    return []\n//  }\n}\n"
  },
  {
    "path": "plugin/Templates/file_templates/Realm Model Object.xctemplate/TemplateInfo.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>AllowedTypes</key>\n\t<array>\n\t\t<string>public.objective-c-source</string>\n\t\t<string>public.objective-c-plus-plus-source</string>\n\t</array>\n\t<key>DefaultCompletionName</key>\n\t<string>MyClass</string>\n\t<key>Description</key>\n\t<string>A Realm model object class, with implementation and header files.</string>\n\t<key>Kind</key>\n\t<string>Xcode.IDEKit.TextSubstitutionFileTemplateKind</string>\n\t<key>Options</key>\n\t<array>\n\t\t<dict>\n\t\t\t<key>Description</key>\n\t\t\t<string>The name of the class to create</string>\n\t\t\t<key>Identifier</key>\n\t\t\t<string>productName</string>\n\t\t\t<key>Name</key>\n\t\t\t<string>Model Object Class</string>\n\t\t\t<key>NotPersisted</key>\n\t\t\t<true/>\n\t\t\t<key>Required</key>\n\t\t\t<true/>\n\t\t\t<key>Type</key>\n\t\t\t<string>text</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>AllowedTypes</key>\n\t\t\t<dict>\n\t\t\t\t<key>Objective-C</key>\n\t\t\t\t<array>\n\t\t\t\t\t<string>public.objective-c-source</string>\n\t\t\t\t\t<string>public.objective-c-plus-plus-source</string>\n\t\t\t\t</array>\n\t\t\t\t<key>Swift</key>\n\t\t\t\t<array>\n\t\t\t\t\t<string>public.swift-source</string>\n\t\t\t\t</array>\n\t\t\t</dict>\n\t\t\t<key>Default</key>\n\t\t\t<string>Objective-C</string>\n\t\t\t<key>Description</key>\n\t\t\t<string>The implementation language</string>\n\t\t\t<key>Identifier</key>\n\t\t\t<string>languageChoice</string>\n\t\t\t<key>MainTemplateFiles</key>\n\t\t\t<dict>\n\t\t\t\t<key>Swift</key>\n\t\t\t\t<string>___FILEBASENAME___.swift</string>\n\t\t\t\t<key>Objective-C</key>\n\t\t\t\t<string>___FILEBASENAME___.m</string>\n\t\t\t</dict>\n\t\t\t<key>Name</key>\n\t\t\t<string>Language</string>\n\t\t\t<key>Required</key>\n\t\t\t<true/>\n\t\t\t<key>Type</key>\n\t\t\t<string>popup</string>\n\t\t\t<key>Values</key>\n\t\t\t<array>\n\t\t\t\t<string>Objective-C</string>\n\t\t\t\t<string>Swift</string>\n\t\t\t</array>\n\t\t</dict>\n\t</array>\n\t<key>Platforms</key>\n\t<array>\n\t\t<string>com.apple.platform.iphoneos</string>\n\t\t<string>com.apple.platform.macosx</string>\n\t</array>\n\t<key>Summary</key>\n\t<string>A Realm model object</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "plugin/Templates/install_templates.sh",
    "content": "#!/bin/sh\nPATH=/bin:/usr/bin:/usr/libexec\n\nFILE_TEMPLATES_DIR=\"$HOME/Library/Developer/Xcode/Templates/File Templates/Realm\"\nmkdir -p \"$FILE_TEMPLATES_DIR\"\n\nfor dir in \"file_templates/*/\"\ndo\n  cp -R ${dir%*/} \"$FILE_TEMPLATES_DIR\"\ndone\n"
  },
  {
    "path": "plugin/rlm_lldb.py",
    "content": "#!/usr/bin/python\n##############################################################################\n#\n# Copyright 2014 Realm Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http:#www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n##############################################################################\n\n# In the lldb shell, load with:\n# command script import [Realm path]/plugin/rlm_lldb.py --allow-reload\n# To load automatically, add that line to your ~/.lldbinit file (which you will\n# have to create if you have not set up any previous lldb scripts), or run this\n# file as a Python script outside of Xcode to install it automatically\n\nif __name__ == '__main__':\n    # Script is being run directly, so install it\n    import errno\n    import shutil\n    import os\n\n    source = os.path.realpath(__file__)\n    destination = os.path.expanduser(\"~/Library/Application Support/Realm\")\n\n    # Copy the file into place\n    try:\n        os.makedirs(destination, 0o744)\n    except os.error as e:\n        # It's fine if the directory already exists\n        if e.errno != errno.EEXIST:\n            raise\n\n    shutil.copy2(source, destination + '/rlm_lldb.py')\n\n    # Add it to ~/.lldbinit\n    load_line = 'command script import \"~/Library/Application Support/Realm/rlm_lldb.py\" --allow-reload\\n'\n    is_installed = False\n    try:\n        with open(os.path.expanduser('~/.lldbinit')) as f:\n            for line in f:\n                if line == load_line:\n                    is_installed = True\n                    break\n    except IOError as e:\n        if e.errno != errno.ENOENT:\n            raise\n        # File not existing yet is fine\n\n    if not is_installed:\n        with open(os.path.expanduser('~/.lldbinit'), 'a') as f:\n            f.write('\\n' + load_line)\n\n    exit(0)\n\nimport lldb\n\nproperty_types = {\n    0: 'int64_t',\n    10: 'double',\n    1: 'bool',\n    9: 'float',\n}\n\ndef cache_lookup(cache, key, generator):\n    value = cache.get(key, None)\n    if not value:\n        value = generator(key)\n        cache[key] = value\n    return value\n\nivar_cache = {}\ndef get_ivar_info(obj, ivar):\n    def get_offset(ivar):\n        class_name, ivar_name = ivar.split('.')\n        frame = obj.GetThread().GetSelectedFrame()\n        ptr = frame.EvaluateExpression(\"&(({} *)0)->{}\".format(class_name, ivar_name))\n        return (ptr.GetValueAsUnsigned(), ptr.deref.type, ptr.deref.size)\n\n    return cache_lookup(ivar_cache, ivar, get_offset)\n\ndef get_ivar(obj, addr, ivar):\n    offset, _, size = get_ivar_info(obj, ivar)\n    if isinstance(addr, lldb.SBAddress):\n        addr = addr.GetFileAddress()\n    return obj.GetProcess().ReadUnsignedFromMemory(addr + offset, size, lldb.SBError())\n\nobject_table_ptr_offset = None\ndef is_object_deleted(obj):\n    addr = obj.GetAddress().GetFileAddress()\n    global object_table_ptr_offset\n    if not object_table_ptr_offset:\n        row, _, _ = get_ivar_info(obj, 'RLMObject._row')\n        table, _, _ = get_ivar_info(obj, 'realm::Row.m_table')\n        ptr, _, _ = get_ivar_info(obj, 'realm::TableRef.m_ptr')\n        object_table_ptr_offset = row + table + ptr\n\n    ptr = obj.GetProcess().ReadUnsignedFromMemory(addr + object_table_ptr_offset,\n            obj.target.addr_size, lldb.SBError())\n    return ptr == 0\n\nclass SyntheticChildrenProvider(object):\n    def __init__(self, class_name):\n        self._class_name = class_name\n\n    def _eval(self, expr):\n        frame = self.obj.GetThread().GetSelectedFrame()\n        return frame.EvaluateExpression(expr)\n\n    def _get_ivar(self, addr, ivar):\n        return get_ivar(self.obj, addr, ivar)\n\n    def _to_str(self, val):\n        return self.obj.GetProcess().ReadCStringFromMemory(val, 1024, lldb.SBError())\n\n    def _value_from_ivar(self, ivar):\n        offset, ivar_type, _ = get_ivar_info(self.obj, '{}._{}'.format(self._class_name, ivar))\n        return self.obj.CreateChildAtOffset(ivar, offset, ivar_type)\n\ndef RLMObject_SummaryProvider(obj, _):\n    if is_object_deleted(obj):\n        return '[Deleted object]'\n    return None\n\nschema_cache = {}\nclass RLMObject_SyntheticChildrenProvider(SyntheticChildrenProvider):\n    def __init__(self, obj, _):\n        super(RLMObject_SyntheticChildrenProvider, self).__init__('RLMObject')\n\n        self.obj = obj\n\n        if not obj.GetAddress() or is_object_deleted(obj):\n            self.props = []\n            return\n\n        object_schema = self._get_ivar(self.obj.GetAddress(), 'RLMObject._objectSchema')\n\n        def get_schema(object_schema):\n            properties = self._get_ivar(object_schema, 'RLMObjectSchema._properties')\n            if not properties:\n                return None\n            count = self._eval(\"(NSUInteger)[((NSArray *){}) count]\".format(properties)).GetValueAsUnsigned()\n            return [self._get_prop(properties, i) for i in range(count)]\n\n        self.props = cache_lookup(schema_cache, object_schema, get_schema)\n\n    def num_children(self):\n        return len(self.props) + 2\n\n    def has_children(self):\n        return not is_object_deleted(self.obj)\n\n    def get_child_index(self, name):\n        if name == 'realm':\n            return 0\n        if name == 'objectSchema':\n            return 1\n        return next(i for i, (prop_name, _) in enumerate(self.props) if prop_name == name)\n\n    def get_child_at_index(self, index):\n        if index == 0:\n            return self._value_from_ivar('realm')\n        if index == 1:\n            return self._value_from_ivar('objectSchema')\n\n        name, getter = self.props[index - 2]\n        value = self._eval(getter)\n        return self.obj.CreateValueFromData(name, value.GetData(), value.GetType())\n\n    def update(self):\n        pass\n\n    def _get_prop(self, props, i):\n        prop = self._eval(\"(NSUInteger)[((NSArray *){}) objectAtIndex:{}]\".format(props, i)).GetValueAsUnsigned()\n        name = self._to_str(self._eval('[(NSString *){} UTF8String]'.format(self._get_ivar(prop, \"RLMProperty._name\"))).GetValueAsUnsigned())\n        type = self._get_ivar(prop, 'RLMProperty._type')\n        getter = \"({})[(id){} {}]\".format(property_types.get(type, 'id'), self.obj.GetAddress(), name)\n        return name, getter\n\nclass_name_cache = {}\ndef get_object_class_name(frame, obj, addr, ivar):\n    class_name_ptr = get_ivar(obj, addr, ivar)\n    def get_class_name(ptr):\n        utf8_addr = frame.EvaluateExpression('(const char *)[(NSString *){} UTF8String]'.format(class_name_ptr)).GetValueAsUnsigned()\n        return obj.GetProcess().ReadCStringFromMemory(utf8_addr, 1024, lldb.SBError())\n\n    return cache_lookup(class_name_cache, class_name_ptr, get_class_name)\n\ndef RLMArray_SummaryProvider(obj, _):\n    frame = obj.GetThread().GetSelectedFrame()\n    class_name = get_object_class_name(frame, obj, obj.GetAddress(), 'RLMArray._objectClassName')\n    count = frame.EvaluateExpression('(NSUInteger)[(RLMArray *){} count]'.format(obj.GetAddress())).GetValueAsUnsigned()\n    return \"({}[{}])\".format(class_name, count)\n\nresults_mode_offset = None\nmode_type = None\nmode_query_value = None\ndef is_results_evaluated(obj):\n    global results_mode_offset, mode_type, mode_query_value\n    if not results_mode_offset:\n        results_offset, _, _ = get_ivar_info(obj, 'RLMResults._results')\n        mode_offset, mode_type, _ = get_ivar_info(obj, 'Results.m_mode')\n        results_mode_offset = results_offset + mode_offset\n        mode_query_value = next(m for m in mode_type.enum_members if m.name == 'Query').GetValueAsUnsigned()\n\n    addr = obj.GetAddress().GetFileAddress()\n    mode = obj.GetProcess().ReadUnsignedFromMemory(addr + results_mode_offset, mode_type.size, lldb.SBError())\n    return mode != mode_query_value\n\ndef results_object_class_name(obj):\n    class_info = get_ivar(obj, obj.GetAddress(), 'RLMResults._info')\n    object_schema = get_ivar(obj, class_info, 'RLMClassInfo.rlmObjectSchema')\n    return get_object_class_name(obj.GetThread().GetSelectedFrame(), obj, object_schema, 'RLMObjectSchema._className')\n\ndef RLMResults_SummaryProvider(obj, _):\n    class_name = results_object_class_name(obj)\n\n    if not is_results_evaluated(obj):\n        return 'Unevaluated query on ' + class_name\n\n    frame = obj.GetThread().GetSelectedFrame()\n    count = frame.EvaluateExpression('(NSUInteger)[(RLMResults *){} count]'.format(obj.GetAddress())).GetValueAsUnsigned()\n    return \"({}[{}])\".format(class_name, count)\n\nclass RLMCollection_SyntheticChildrenProvider(SyntheticChildrenProvider):\n    def __init__(self, valobj, _):\n        super(RLMCollection_SyntheticChildrenProvider, self).__init__(valobj.deref.type.name)\n\n        self.obj = valobj\n        self.addr = self.obj.GetAddress()\n\n    def num_children(self):\n        if not self.count:\n            self.count = self._eval(\"(NSUInteger)[(id){} count]\".format(self.addr)).GetValueAsUnsigned()\n        return self.count + 1\n\n    def has_children(self):\n        return True\n\n    def get_child_index(self, name):\n        if name == 'realm':\n            return 0\n        if not name.startswith('['):\n            return None\n        return int(name.lstrip('[').rstrip(']')) + 1\n\n    def get_child_at_index(self, index):\n        if index == 0:\n            return self._value_from_ivar('realm')\n        value = self._eval('(id)[(id){} objectAtIndex:{}]'.format(self.addr, index - 1))\n        return self.obj.CreateValueFromData('[' + str(index - 1) + ']', value.GetData(), value.GetType())\n\n    def update(self):\n        self.count = None\n\ndef __lldb_init_module(debugger, _):\n    debugger.HandleCommand('type summary add RLMArray -F rlm_lldb.RLMArray_SummaryProvider')\n    debugger.HandleCommand('type summary add RLMArrayLinkView -F rlm_lldb.RLMArray_SummaryProvider')\n    debugger.HandleCommand('type summary add RLMResults -F rlm_lldb.RLMResults_SummaryProvider')\n    debugger.HandleCommand('type summary add -x RLMAccessor_ -F rlm_lldb.RLMObject_SummaryProvider')\n\n    debugger.HandleCommand('type synthetic add RLMArray --python-class rlm_lldb.RLMCollection_SyntheticChildrenProvider')\n    debugger.HandleCommand('type synthetic add RLMArrayLinkView --python-class rlm_lldb.RLMCollection_SyntheticChildrenProvider')\n    debugger.HandleCommand('type synthetic add RLMResults --python-class rlm_lldb.RLMCollection_SyntheticChildrenProvider')\n    debugger.HandleCommand('type synthetic add -x RLMAccessor_.* --python-class rlm_lldb.RLMObject_SyntheticChildrenProvider')\n"
  },
  {
    "path": "scripts/create-release-package.rb",
    "content": "#!/usr/bin/env ruby\n\nrequire 'fileutils'\nrequire 'pathname'\nrequire 'tmpdir'\n\nraise 'usage: create-release-package.rb destination_path version [xcode_versions]' unless ARGV.length >= 3\n\nDESTINATION = Pathname(ARGV[0])\nVERSION = ARGV[1]\nXCODE_VERSIONS = ARGV[2..]\nROOT = Pathname(__FILE__).+('../..').expand_path\nBUILD_SH = Pathname(__FILE__).+('../../build.sh').expand_path\nVERBOSE = false\nOBJC_XCODE_VERSION = XCODE_VERSIONS.reduce { |a, e| e.include?('beta') ? a : e }\n\ndef sh(*args)\n  puts \"executing: #{args.join(' ')}\" if VERBOSE\n  system(*args, VERBOSE ? {} : {:out => '/dev/null'}) || exit(1)\nend\n\ndef platforms(xcode_version)\n  if xcode_version.to_f >= 15.2\n    %w{osx ios watchos tvos catalyst visionos}\n  else\n    %w{osx ios watchos tvos catalyst}\n  end\nend\n\ndef create_xcframework(root, xcode_version, configuration, name)\n  prefix = \"#{root}/#{xcode_version}\"\n  output = \"#{prefix}/#{configuration}/#{name}.xcframework\"\n  files = Dir.glob \"#{prefix}/build/#{configuration}/*/#{name}.xcframework/*/#{name}.framework\"\n\n  sh 'xcodebuild', '-create-xcframework', '-allow-internal-distribution',\n     '-output', output, *files.flat_map {|f| ['-framework', f]}\nend\n\ndef zip(name, *files)\n  path = (DESTINATION + name).to_path\n  FileUtils.rm_f path\n  sh 'zip', '--symlinks', '-r', path, *files\nend\n\nputs \"Packaging version #{VERSION} for Xcode versions #{XCODE_VERSIONS.join(', ')}\"\nFileUtils.mkdir_p DESTINATION\n\nDir.mktmpdir do |tmp|\n  # The default temp directory is in /var, which is a symlink to /private/var\n  # xcodebuild's relative path resolution breaks due to this and we need to\n  # give it the fully resolved path\n  tmp = File.realpath tmp\n\n  for version in XCODE_VERSIONS\n    puts \"Extracting source binaries for Xcode #{version}\"\n    FileUtils.mkdir_p \"#{tmp}/#{version}\"\n    Dir.chdir(\"#{tmp}/#{version}\") do\n      for platform in platforms(version)\n        sh 'tar', 'xf', \"#{ROOT}/build-#{platform}-#{version}-swift/build.tar\"\n      end\n      sh 'tar', 'xf', \"#{ROOT}/build-ios-#{version}-static/build.tar\"\n    end\n  end\n\n  for version in XCODE_VERSIONS\n    puts \"Creating Swift XCFrameworks for Xcode #{version}\"\n    create_xcframework tmp, version, 'Release', 'RealmSwift'\n  end\n\n  puts 'Creating Obj-C XCFrameworks'\n  create_xcframework tmp, OBJC_XCODE_VERSION, 'Release', 'Realm'\n  create_xcframework tmp, OBJC_XCODE_VERSION, 'Static', 'Realm'\n\n  puts 'Creating release package'\n  package_dir = \"#{tmp}/realm-swift-#{VERSION}\"\n  FileUtils.mkdir_p package_dir\n  sh 'cp', \"#{ROOT}/LICENSE\", package_dir\n  sh 'unzip', \"#{ROOT}/realm-examples/realm-examples.zip\", '-d', package_dir\n  for lang in %w(objc swift)\n    File.write \"#{package_dir}/#{lang}-docs.webloc\", %Q{\n      <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n      <!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n      <plist version=\"1.0\">\n      <dict>\n          <key>URL</key>\n          <string>https://www.mongodb.com/docs/realm-sdks/${lang}/${version}</string>\n      </dict>\n      </plist>\n    }\n  end\n  sh 'cp', '-Rca', \"#{tmp}/#{OBJC_XCODE_VERSION}/Release/Realm.xcframework\", \"#{package_dir}\"\n  FileUtils.mkdir_p \"#{package_dir}/static\"\n  sh 'cp', '-Rca', \"#{tmp}/#{OBJC_XCODE_VERSION}/Static/Realm.xcframework\", \"#{package_dir}/static\"\n  for version in XCODE_VERSIONS\n    FileUtils.mkdir_p \"#{package_dir}/#{version}\"\n    sh 'cp', '-Rca', \"#{tmp}/#{version}/Release/RealmSwift.xcframework\", \"#{package_dir}/#{version}\"\n  end\n\n  Dir.chdir(tmp) do\n    zip \"realm-swift-#{VERSION}.zip\", \"realm-swift-#{VERSION}\"\n  end\n\n  puts 'Creating SPM release zips'\n  Dir.chdir \"#{tmp}/#{OBJC_XCODE_VERSION}/Release\" do\n    zip 'Realm.spm.zip', \"Realm.xcframework\"\n  end\n  for version in XCODE_VERSIONS\n    Dir.chdir \"#{tmp}/#{version}/Release\" do\n      zip \"RealmSwift@#{version}.spm.zip\", 'RealmSwift.xcframework'\n    end\n  end\nend\n\nputs 'Creating Carthage release zip'\nDir.mktmpdir do |tmp|\n  tmp = File.realpath tmp\n  Dir.chdir(tmp) do\n    for platform in platforms('15.1')\n      sh 'tar', 'xf', \"#{ROOT}/build-#{platform}-#{OBJC_XCODE_VERSION}-swift/build.tar\"\n    end\n    create_xcframework tmp, '', 'Release', 'RealmSwift'\n    create_xcframework tmp, '', 'Release', 'Realm'\n\n    Dir.chdir('Release') do\n      zip 'Carthage.xcframework.zip', 'Realm.xcframework', 'RealmSwift.xcframework'\n    end\n  end\nend\n"
  },
  {
    "path": "scripts/download-core.sh",
    "content": "#!/usr/bin/env bash\n\nset -euo pipefail\nsource_root=\"$(dirname \"$0\")/..\"\nreadonly source_root\n\n# override this env variable if you need to download from a private mirror\n: \"${REALM_BASE_URL:=\"https://static.realm.io/downloads/core\"}\"\n# set to \"current\" to always use the current build\n: \"${REALM_CORE_VERSION:=$(sed -n 's/^REALM_CORE_VERSION=\\(.*\\)$/\\1/p' \"${source_root}/dependencies.list\")}\"\n# Provide a fallback value for TMPDIR, relevant for Xcode Bots\n: \"${TMPDIR:=$(getconf DARWIN_USER_TEMP_DIR)}\"\n\nreadonly dst=\"$source_root/core\"\ncopy_core() {\n    local src=\"$1\"\n    rm -rf \"$dst\"\n    mkdir \"$dst\"\n    ditto \"$src\" \"$dst\"\n\n    # XCFramework processing only copies the \"realm\" headers, so put the third-party ones in a known location\n    mkdir -p \"$dst/include\"\n    find \"$src\" -name external -exec ditto \"{}\" \"$dst/include/external\" \\; -quit\n\n    # Remove the C API header to avoid accidentally pulling it in\n    find \"$dst\" -name realm.h -delete\n}\n\ntries_left=3\nreadonly version=\"$REALM_CORE_VERSION\"\nreadonly url=\"${REALM_BASE_URL}/${version}/cocoa/realm-monorepo-xcframework-${version}.tar.xz\"\n# First check if we need to do anything\nif [ -e \"$dst\" ]; then\n    if [ -e \"$dst/version.txt\" ]; then\n        if [ \"$(cat \"$dst/version.txt\")\" == \"$version\" ]; then\n            echo \"Version ${version} already present\"\n            exit 0\n        else\n            echo \"Switching from version $(cat \"$dst/version.txt\") to ${version}\"\n        fi\n    else\n        if [ \"$(find \"$dst\" -name librealm-monorepo.a)\" ]; then\n            echo 'Using existing custom core build without checking version'\n            exit 0\n        fi\n    fi\nfi\n\n# We may already have this version downloaded and just need to set it as\n# the active one\nreadonly versioned_name=\"realm-core-${version}-xcframework\"\nreadonly versioned_dir=\"$source_root/$versioned_name\"\nif [ -e \"$versioned_dir/version.txt\" ]; then\n    echo \"Setting ${version} as the active version\"\n    copy_core \"$versioned_dir\"\n    exit 0\nfi\n\necho \"Downloading dependency: ${version} from ${url}\"\n\nif [ -z \"$TMPDIR\" ]; then\n    TMPDIR='/tmp'\nfi\ntemp_dir=$(dirname \"$TMPDIR/waste\")/realm-core-tmp\nreadonly temp_dir\nmkdir -p \"$temp_dir\"\nreadonly tar_path=\"${temp_dir}/${versioned_name}.tar.xz\"\nreadonly temp_path=\"${tar_path}.tmp\"\n\nwhile [ 0 -lt $tries_left ] && [ ! -f \"$tar_path\" ]; do\n    if ! error=$(/usr/bin/curl --fail --silent --show-error --location \"$url\" --output \"$temp_path\" 2>&1); then\n        tries_left=$((tries_left-1))\n    else\n        mv \"$temp_path\" \"$tar_path\"\n    fi\ndone\n\nif [ ! -f \"$tar_path\" ]; then\n    printf \"Downloading core failed:\\n\\t%s\\n\\t%s\\n\" \"$url\" \"$error\"\n    exit 1\nfi\n\n(\n    cd \"$temp_dir\"\n    rm -rf core\n    tar xf \"$tar_path\" --xz\n    if [ ! -f core/version.txt ]; then\n        printf %s \"${version}\" > core/version.txt\n    fi\n\n    mv core \"${versioned_name}\"\n)\n\nrm -rf \"${versioned_dir}\"\nmv \"${temp_dir}/${versioned_name}\" \"$source_root\"\ncopy_core \"$versioned_dir\"\n"
  },
  {
    "path": "scripts/generate-rlmversion.sh",
    "content": "#!/bin/sh\n\n: ${SRCROOT:?\"generate-rlmversion.sh must be invoked as part of an Xcode script phase\"}\n\nTEMPORARY_FILE=\"${TARGET_TEMP_DIR}/RLMVersion.h\"\nDESTINATION_FILE=\"${DERIVED_FILE_DIR}/RLMVersion.h\"\n\necho \"#define REALM_COCOA_VERSION @\\\"$(sh build.sh get-version)\\\"\" > ${TEMPORARY_FILE}\n\nif ! cmp -s \"${TEMPORARY_FILE}\" \"${DESTINATION_FILE}\"; then\n  echo \"Updating ${DESTINATION_FILE}\"\n  cp \"${TEMPORARY_FILE}\" \"${DESTINATION_FILE}\"\nfi\n"
  },
  {
    "path": "scripts/github_release.rb",
    "content": "#!/usr/bin/env ruby\n\nrequire 'pathname'\nrequire 'octokit'\nrequire 'fileutils'\n\nBUILD_SH = Pathname(__FILE__).+('../../build.sh').expand_path\n\nREPOSITORY = 'realm/realm-swift'\n\ndef sh(*args)\n  puts \"executing: #{args.join(' ')}\" if false\n  system(*args, false ? {} : {:out => '/dev/null'}) || exit(1)\nend\n\ndef release_notes(version)\n  changelog = BUILD_SH.parent.+('CHANGELOG.md').readlines\n  current_version_index = changelog.find_index { |line| line =~ (/^#{Regexp.escape version}/) }\n  unless current_version_index\n    raise \"Update the changelog for the last version (#{version})\"\n  end\n  current_version_index += 2\n  previous_version_lines = changelog[(current_version_index+1)...-1]\n  previous_version_index = current_version_index + (previous_version_lines.find_index { |line| line =~ /^\\d+\\.\\d+\\.\\d+(-(alpha|beta|rc)(\\.\\d+)?)?\\s+/ } || changelog.count)\n\n  relevant = changelog[current_version_index..previous_version_index]\n\n  relevant.join.strip\nend\n\ndef create_release(version)\n  access_token = ENV['GITHUB_ACCESS_TOKEN']\n  raise 'GITHUB_ACCESS_TOKEN must be set to create GitHub releases' unless access_token\n\n  release_notes = release_notes(version)\n  github = Octokit::Client.new\n  github.access_token = ENV['GITHUB_ACCESS_TOKEN']\n\n  puts 'Creating GitHub release'\n  prerelease = (version =~ /alpha|beta|rc|preview/) ? true : false\n  release = \"v#{version}\"\n  response = github.create_release(REPOSITORY, release, name: release, body: release_notes, prerelease: prerelease)\n  release_url = response[:url]\n\n  Dir.glob 'release-package/*.zip' do |upload|\n    puts \"Uploading #{upload} to GitHub\"\n    github.upload_asset(release_url, upload, content_type: 'application/zip')\n  end\nend\n\ndef package_release_notes(version)\n  release_notes = release_notes(version)\n  FileUtils.mkdir_p(\"ExtractedChangelog\")\n  out_file = File.new(\"ExtractedChangelog/CHANGELOG.md\", \"w\")\n  out_file.puts(release_notes)\nend\n\ndef download_artifacts(key, sha)\n  access_token = ENV['GITHUB_ACCESS_TOKEN']\n  raise 'GITHUB_ACCESS_TOKEN must be set to create GitHub releases' unless access_token\n\n  github = Octokit::Client.new\n  github.auto_paginate = true\n  github.access_token = ENV['GITHUB_ACCESS_TOKEN']\n\n  response = github.repository_artifacts(REPOSITORY)\n  sha_artifacts = response[:artifacts].filter { |artifact| artifact[:workflow_run][:head_sha] == sha && artifact[:name] == key }\n  sha_artifacts.each { |artifact|\n    download_url = github.artifact_download_url(REPOSITORY, artifact[:id])\n    download(artifact[:name], download_url)\n  }\nend\n\ndef download(name, url)\n  sh 'curl', '--output', \"#{name}.zip\", \"#{url}\"\nend\n\nif ARGV[0] == 'create-release'\n  version = ARGV[1]\n  create_release(version)\nelsif ARGV[0] == 'package-release-notes'\n  version = ARGV[1]\n  package_release_notes(version)\nelsif ARGV[0] == 'download-artifacts'\n  key = ARGV[1]\n  sha = ARGV[2]\n  download_artifacts(key, sha)\nend\n"
  },
  {
    "path": "scripts/package_examples.rb",
    "content": "#!/usr/bin/env ruby\nrequire 'fileutils'\nrequire 'xcodeproj'\n\n##########################\n# Helpers\n##########################\n\ndef remove_reference_to_realm_xcode_project(workspace_path)\n  workspace = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)\n  file_references = workspace.file_references.reject do |file_reference|\n    file_reference.path == '../../../Realm.xcodeproj'\n  end\n  workspace = Xcodeproj::Workspace.new(nil)\n  file_references.each { |ref| workspace << ref }\n  workspace.save_as(workspace_path)\nend\n\ndef replace_in_file(filepath, pattern, replacement)\n  contents = File.read(filepath)\n  File.open(filepath, \"w\") do |file|\n    file.puts contents.gsub(pattern, replacement)\n  end\nend\n\ndef replace_framework(example, framework, path)\n  project_path = \"#{example}/RealmExamples.xcodeproj\"\n  replace_in_file(\"#{project_path}/project.pbxproj\",\n                  /lastKnownFileType = wrapper.framework; path = (#{framework}).framework; sourceTree = BUILT_PRODUCTS_DIR;/,\n                  \"lastKnownFileType = wrapper.xcframework; name = \\\\1.xcframework; path = \\\"#{path}/\\\\1.xcframework\\\"; sourceTree = \\\"<group>\\\";\")\n  replace_in_file(\"#{project_path}/project.pbxproj\",\n                  /(#{framework}).framework/, \"\\\\1.xcframework\")\nend\n\n##########################\n# Script\n##########################\n\nbase_examples = [\n  \"examples/ios/objc\",\n  \"examples/osx/objc\",\n  \"examples/tvos/objc\",\n  \"examples/ios/swift\",\n  \"examples/tvos/swift\",\n]\n\nxcode_versions = %w(26.1 26.2 26.3 26.4)\n\n# Remove reference to Realm.xcodeproj from all example workspaces.\nbase_examples.each do |example|\n  remove_reference_to_realm_xcode_project(\"#{example}/RealmExamples.xcworkspace\")\nend\n\n# Make a copy of each Swift example for each Swift version.\nbase_examples.each do |example|\n  if example =~ /\\/swift$/\n    xcode_versions.each do |xcode_version|\n      FileUtils.cp_r example, \"#{example}-#{xcode_version}\"\n    end\n    FileUtils.rm_r example\n  end\nend\n\n# Update the paths to the prebuilt frameworks\nreplace_framework('examples/ios/objc', 'Realm', '../../../static')\nreplace_framework('examples/osx/objc', 'Realm', '../../..')\nreplace_framework('examples/tvos/objc', 'Realm', '../../..')\n\nxcode_versions.each do |xcode_version|\n  replace_framework(\"examples/ios/swift-#{xcode_version}\", 'Realm', \"../../..\")\n  replace_framework(\"examples/tvos/swift-#{xcode_version}\", 'Realm', \"../../..\")\n  replace_framework(\"examples/ios/swift-#{xcode_version}\", 'RealmSwift', \"../../../#{xcode_version}\")\n  replace_framework(\"examples/tvos/swift-#{xcode_version}\", 'RealmSwift', \"../../../#{xcode_version}\")\nend\n\n# Update Playground imports and instructions\n\nxcode_versions.each do |xcode_version|\n  playground_file = \"examples/ios/swift-#{xcode_version}/GettingStarted.playground/Contents.swift\"\n  replace_in_file(playground_file, 'choose RealmSwift', 'choose PlaygroundFrameworkWrapper')\n  replace_in_file(playground_file,\n                  \"import Foundation\\n\",\n                  \"import Foundation\\nimport PlaygroundFrameworkWrapper // only necessary to use a binary release of Realm Swift in this playground.\\n\")\nend\n\n"
  },
  {
    "path": "scripts/pr-ci-matrix.rb",
    "content": "#!/usr/bin/env ruby\nXCODE_VERSIONS = %w(26.1 26.2 26.3 26.4)\nDOC_VERSION = '26.3'\n\nall = ->(v) { true }\nlatest_only = ->(v) { v == XCODE_VERSIONS.last }\noldest_and_latest = ->(v) { v == XCODE_VERSIONS.first or v == XCODE_VERSIONS.last }\n\ndef minimum_version(major)\n  ->(v) { v.split('.').first.to_i >= major }\nend\n\ntargets = {\n  'osx' => all,\n  'osx-encryption' => latest_only,\n\n  'swiftpm' => oldest_and_latest,\n  'swiftpm-debug' => all,\n  'swiftpm-address' => latest_only,\n  'swiftpm-thread' => latest_only,\n\n  'ios-static' => oldest_and_latest,\n  'ios' => oldest_and_latest,\n  'watchos' => oldest_and_latest,\n  'tvos' => oldest_and_latest,\n  'visionos' => oldest_and_latest,\n\n  'osx-swift' => all,\n  'ios-swift' => oldest_and_latest,\n  'tvos-swift' => oldest_and_latest,\n\n  'osx-swift-evolution' => latest_only,\n  'ios-swift-evolution' => latest_only,\n  'tvos-swift-evolution' => latest_only,\n\n  'catalyst' => oldest_and_latest,\n  'catalyst-swift' => oldest_and_latest,\n\n  'xcframework' => latest_only,\n\n  'cocoapods-osx' => all,\n  'cocoapods-ios-static' => latest_only,\n  'cocoapods-ios' => latest_only,\n  'cocoapods-watchos' => latest_only,\n  'cocoapods-tvos' => latest_only,\n  'cocoapods-catalyst' => latest_only,\n  'ios-swiftui' => latest_only,\n}\n\noutput_file = \"\"\"\n# This is a generated file produced by scripts/pr-ci-matrix.rb.\nname: Pull request build and test\non:\n  pull_request:\n    paths-ignore:\n      - '**.md'\n  workflow_dispatch:\n\njobs:\n  docs:\n    runs-on: macos-26\n    name: Test docs\n    steps:\n      - uses: actions/checkout@v4\n      - uses: ruby/setup-ruby@v1\n        with:\n          bundler-cache: true\n      - run: sudo xcode-select -switch /Applications/Xcode_#{DOC_VERSION}.app\n      - run: bundle exec sh build.sh verify-docs\n  swiftlint:\n    runs-on: macos-26\n    name: Check swiftlint\n    steps:\n      - uses: actions/checkout@v4\n      - run: sudo xcode-select -switch /Applications/Xcode_#{DOC_VERSION}.app\n      - run: brew install swiftlint\n      - run: sh build.sh verify-swiftlint\n\"\"\"\n\ntargets.each { |name, filter|\n  XCODE_VERSIONS.each { |version|\n    if not filter.call(version)\n      next\n    end\n    image = 'macos-26'\n    output_file << \"\"\"\n  #{name}-#{version.gsub(' ', '_').gsub('.', '_')}:\n    runs-on: #{image}\n    name: Test #{name} on Xcode #{version}\n    env:\n      DEVELOPER_DIR: '/Applications/Xcode_#{version}.app/Contents/Developer'\n    steps:\n      - uses: actions/checkout@v4\n      - run: sh -x build.sh ci-pr #{name}\n\"\"\"\n  }\n}\n\nFile.open('.github/workflows/build-pr.yml', \"w\") do |file|\n  file.puts output_file\nend\n"
  },
  {
    "path": "scripts/release-matrix.rb",
    "content": "#!/usr/bin/env ruby\n# Matrix of resulting build actions for each release workflow\n\nBuildDestination = Struct.new(:build_platform, :destination) do |cls|\n  def cls.macOS\n    BuildDestination.new('MACOS', 'ANY_MAC')\n  end\n\n  def cls.catalyst\n    BuildDestination.new('MACOS', 'ANY_MAC_CATALYST')\n  end\n\n  def cls.iOS\n    BuildDestination.new('IOS', 'ANY_IOS_DEVICE')\n  end\n\n  def cls.iOSSimulator\n    BuildDestination.new('IOS', 'ANY_IOS_SIMULATOR')\n  end\n\n  def cls.tvOS\n    BuildDestination.new('TVOS', 'ANY_TVOS_DEVICE')\n  end\n\n  def cls.tvOSSimulator\n    BuildDestination.new('TVOS', 'ANY_TVOS_SIMULATOR')\n  end\n\n  def cls.watchOS\n    BuildDestination.new('WATCHOS', 'ANY_WATCHOS_DEVICE')\n  end\n\n  def cls.watchOSSimulator\n    BuildDestination.new('WATCHOS', 'ANY_WATCHOS_SIMULATOR')\n  end\n\n  def cls.visionOS\n    BuildDestination.new('VISIONOS', 'ANY_VISIONOS_DEVICE')\n  end\n\n  def cls.visionOSSimulator\n    BuildDestination.new('VISIONOS', 'ANY_VISIONOS_SIMULATOR')\n  end\n\n  def cls.generic\n    BuildDestination.new('MACOS', nil)\n  end\nend\n\nRELEASE_DESTINATIONS = { \"osx\" => BuildDestination.macOS, \n                         \"catalyst\" => BuildDestination.catalyst, \n                         \"ios\" => BuildDestination.iOS,\n                         \"iossimulator\" => BuildDestination.iOSSimulator, \n                         \"tvos\" => BuildDestination.tvOS, \n                         \"tvossimulator\" => BuildDestination.tvOSSimulator,\n                         \"watchos\" => BuildDestination.watchOS, \n                         \"watchossimulator\" => BuildDestination.watchOSSimulator,\n                         \"visionos\" => BuildDestination.visionOS, \n                         \"visionossimulator\" => BuildDestination.visionOSSimulator\n                        }\n\nReleaseTarget = Struct.new(:name, :scheme, :platform) do\n  def action\n    build_destination = RELEASE_DESTINATIONS[platform]\n    action = {\n      name: self.name,\n      actionType: 'BUILD',\n      destination: build_destination.destination,\n      buildDistributionAudience: nil,\n      scheme: self.scheme,\n      platform: build_destination.build_platform,\n      isRequiredToPass: true\n    }\n\n    return action\n  end\nend"
  },
  {
    "path": "scripts/setup-cocoapods.sh",
    "content": "#!/usr/bin/env bash\n\nset -euo pipefail\nsource_root=\"$(dirname \"$0\")/..\"\nreadonly source_root\n\nif [ ! -f \"$source_root/core/version.txt\" ]; then\n  sh \"$source_root/scripts/download-core.sh\"\nfi\n\nrm -rf \"$source_root/include\"\nmkdir -p \"$source_root/include\"\ncp -R \"$source_root/core/realm-monorepo.xcframework/ios-arm64/Headers\" \"$source_root/include/core\"\n\nmkdir -p \"$source_root/include\"\ncp \"$source_root/Realm/\"*.h \"$source_root/Realm/\"*.hpp \"$source_root/include\"\necho \"#define REALM_IOPLATFORMUUID @\\\"$(sh $source_root/build.sh get-ioplatformuuid)\\\"\" >> \"$source_root/Realm/RLMAnalytics.hpp\"\n"
  },
  {
    "path": "scripts/swift-version.sh",
    "content": "#!/usr/bin/env bash\n\n: \"${REALM_XCODE_VERSION:=}\"\n: \"${DEVELOPER_DIR:=}\"\n\nget_xcode_version() {\n    \"$1\" -version 2>/dev/null | sed -ne 's/^Xcode \\([^\\b ]*\\).*/\\1/p'\n}\n\nis_xcode_version() {\n    test \"$(get_xcode_version \"$1\")\" = \"$2\"\n}\n\nfind_xcode_with_version() {\n    local path required_version\n\n    if [ -z \"$1\" ]; then\n        echo \"find_xcode_with_version requires an Xcode version\" >&2\n        exit 1\n    fi\n    required_version=$1\n\n    # First check if the currently active one is fine, unless we are in a CI run\n    if [ -z \"$JENKINS_HOME\" ] && is_xcode_version xcodebuild \"$required_version\"; then\n        xcode-select -p\n        return 0\n    fi\n\n    # Check the spot where we install it on CI machines\n    path=\"/Applications/Xcode-${required_version}.app/Contents/Developer\"\n    if [ -d \"$path\" ]; then\n        if is_xcode_version \"$path/usr/bin/xcodebuild\" \"$required_version\"; then\n            echo \"$path\"\n            return 0\n        fi\n    fi\n\n    # Check all of the items in /Applications that look promising per #4534\n    for path in /Applications/Xcode*.app/Contents/Developer; do\n        if is_xcode_version \"$path/usr/bin/xcodebuild\" \"$required_version\"; then\n            echo \"$path\"\n            return 0\n        fi\n    done\n\n    # Use Spotlight to see if we can find others installed copies of Xcode\n    for path in $(/usr/bin/mdfind \"kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'\" 2>/dev/null); do\n        path=\"$path/Contents/Developer\"\n        if [ ! -d \"$path\" ]; then\n            continue\n        fi\n        if is_xcode_version \"$path/usr/bin/xcodebuild\" \"$required_version\"; then\n            echo \"$path\"\n            return 0\n        fi\n    done\n\n    echo \"No Xcode found with version $required_version\" >&2\n    exit 1\n}\n\ntest_xcode_for_swift_version() {\n    if [ -z \"$1\" ] || [ -z \"$2\" ]; then\n        echo \"test_xcode_for_swift_version called with empty parameter(s): '$1' or '$2'\" >&2\n        exit 1\n    fi\n    local path=$1\n    local required_version=$2\n\n    for swift in \"$path\"/Toolchains/*.xctoolchain/usr/bin/swift; do\n        if [ \"$(get_swift_version \"$swift\")\" = \"$required_version\" ]; then\n            return 0\n        fi\n    done\n    return 1\n}\n\nfind_xcode_for_swift() {\n    local path required_version\n\n    if [ -z \"$1\" ]; then\n        echo \"find_xcode_for_swift requires a Swift version\" >&2\n        exit 1\n    fi\n    required_version=$1\n\n    # First check if the currently active one is fine, unless we are in a CI run\n    if [ -z \"$JENKINS_HOME\" ] && test_xcode_for_swift_version \"$(xcode-select -p)\" \"$required_version\"; then\n        DEVELOPER_DIR=$(xcode-select -p)\n        return 0\n    fi\n\n    # Check all of the items in /Applications that look promising per #4534\n    for path in /Applications/Xcode*.app/Contents/Developer; do\n        if test_xcode_for_swift_version \"$path\" \"$required_version\"; then\n            DEVELOPER_DIR=$path\n            return 0\n        fi\n    done\n\n    # Use Spotlight to see if we can find others installed copies of Xcode\n    for path in $(/usr/bin/mdfind \"kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'\" 2>/dev/null); do\n        path=\"$path/Contents/Developer\"\n        if [ ! -d \"$path\" ]; then\n            continue\n        fi\n        if test_xcode_for_swift_version \"$path\" \"$required_version\"; then\n            DEVELOPER_DIR=$path\n            return 0\n        fi\n    done\n\n    echo \"No version of Xcode found that supports Swift $required_version\" >&2\n    exit 1\n}\n\nfind_default_xcode_version() {\n    DEVELOPER_DIR=\"$(xcode-select -p)\"\n    # Verify that DEVELOPER_DIR points to an Xcode installation, rather than the Xcode command-line tools.\n    if [ -x \"$DEVELOPER_DIR/usr/bin/xcodebuild\" ]; then\n        # It's an Xcode installation so we're good to go.\n        return 0\n    fi\n\n    echo \"WARNING: The active Xcode command line tools, as returned by 'xcode-select -p', are not from Xcode.\" >&2\n    echo \"         The newest version of Xcode will be used instead.\"                                          >&2\n\n    # Find the newest version of Xcode available on the system, based on CFBundleVersion.\n    local xcode_version newest_xcode_version newest_xcode_path\n    newest_xcode_version=0\n    for path in $(/usr/bin/mdfind \"kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'\" 2>/dev/null); do\n        xcode_version=$(/usr/libexec/PlistBuddy -c \"Print :CFBundleVersion\" \"$path/Contents/Info.plist\")\n        if echo \"$xcode_version\" \"$newest_xcode_version\" | awk '{exit !( $1 > $2)}'; then\n            newest_xcode_version=\"$xcode_version\"\n            newest_xcode_path=\"$path\"\n        fi\n    done\n\n    if [ -z \"$newest_xcode_path\" ]; then\n        echo \"No version of Xcode could be found\" >&2\n        exit 1\n    fi\n\n    DEVELOPER_DIR=\"$newest_xcode_path/Contents/Developer\"\n}\n\nset_xcode_version() {\n    if [ -n \"$REALM_XCODE_VERSION\" ]; then\n        DEVELOPER_DIR=$(find_xcode_with_version \"$REALM_XCODE_VERSION\")\n    elif [ -z \"$DEVELOPER_DIR\" ]; then\n        find_default_xcode_version\n    fi\n    export DEVELOPER_DIR\n    # Setting this silences some seemingly spurious warnings\n    export XCODE_DEVELOPER_DIR_PATH=\"$DEVELOPER_DIR\"\n\n    REALM_XCODE_VERSION=\"$(get_xcode_version \"$DEVELOPER_DIR/usr/bin/xcodebuild\")\"\n    export REALM_XCODE_VERSION\n}\n\nreturn 2>/dev/null || { # only run if called directly\n    set_xcode_version\n    echo \"Found Xcode version $REALM_XCODE_VERSION at $DEVELOPER_DIR\"\n}\n"
  }
]